magic-sdk 6.2.0 → 6.2.1
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/es/index.js +1 -1
- package/dist/magic.js +1 -1
- package/dist/modern/index.mjs +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=require("@magic-sdk/provider"),t=require("@magic-sdk/commons"),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){var t={exports:{}};return e(t,t.exports),t.exports}function i(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}o(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof y?t:y).prototype),i=new N(n||[]);return o._invoke=function(e,t,r){var n=s;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===s)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=f(e,t,r);if("normal"===c.type){if(n=r.done?h:l,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s="suspendedStart",l="suspendedYield",d="executing",h="completed",v={};function y(){}function p(){}function m(){}var b={};b[i]=function(){return this};var g=Object.getPrototypeOf,_=g&&g(g(O([])));_&&_!==r&&n.call(_,i)&&(b=_);var w=m.prototype=y.prototype=Object.create(b);function I(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function S(e,t){function r(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,a,u)},function(e){r("throw",e,a,u)}):t.resolve(l).then(function(e){s.value=e,a(s)},function(e){return r("throw",e,a,u)})}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t(function(t,o){r(e,n,t,o)})}return o=o?o.then(i,i):i()}}function E(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:x}}function x(){return{value:t,done:!0}}return p.prototype=w.constructor=m,m.constructor=p,m[u]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},I(S.prototype),S.prototype[a]=function(){return this},e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(w),w[u]="Generator",w[i]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(c&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});var a=o(function(e,t){e.exports=function e(t,r,n){function o(u,c){if(!r[u]){if(!t[u]){if(!c&&i)return i(u);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=r[u]={exports:{}};t[u][0].call(s.exports,function(e){return o(t[u][1][e]||e)},s,s.exports,e,t,r,n)}return r[u].exports}for(var a=i,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(e,t,n){(function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(s),u=e.document.createTextNode("");a.observe(u,{characterData:!0}),r=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){s(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(s,0)};else{var c=new e.MessageChannel;c.port1.onmessage=s,r=function(){c.port2.postMessage(0)}}var f=[];function s(){var e,t;n=!0;for(var r=f.length;r;){for(t=f,f=[],e=-1;++e<r;)t[e]();r=f.length}n=!1}t.exports=function(e){1!==f.push(e)||n||r()}}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function f(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&h(this,e)}function s(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=v(function(){t(o,n)});"error"===a.status&&n(a.value)}function v(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=f,f.prototype.catch=function(e){return this.then(null,e)},f.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==c?l(r,this.state===u?e:t,this.outcome):this.queue.push(new s(r,e,t)),r},s.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},s.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},s.prototype.callRejected=function(e){i.reject(this.promise,e)},s.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=v(d,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=u,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},f.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},f.reject=function(e){var t=new this(o);return i.reject(t,e)},f.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),u=0,c=-1,f=new this(o);++c<r;)s(e[c],c);return f;function s(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==r||n||(n=!0,i.resolve(f,a))},function(e){n||(n=!0,i.reject(f,e))})}},f.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n=-1,a=new this(o);++n<t;)this.resolve(e[n]).then(function(e){r||(r=!0,i.resolve(a,e))},function(e){r||(r=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,h={},v=Object.prototype.toString,y="readonly",p="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function b(e){var t=h[e.name],r={};r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function g(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function w(e,t){return new a(function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),g(e)}})}function I(e){return w(e,!1)}function S(e){return w(e,!0)}function E(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version>e.db.version;if(e.version<e.db.version&&(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),n||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function j(e){return i([m(atob(e.data))],{type:e.type})}function A(e){return e&&e.__local_forage_encoded_blob}function N(e){var t=this,r=t._initReady().then(function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(r,e,e),r}function O(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)}).then(function(){return function(e){b(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,E(e)?S(e):t}).then(function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){O(e,t,r,n-1)})}).catch(r);r(o)}}var x={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=h[r.name];o||(h[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=N);var i=[];function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var f=o.forages[c];f!==t&&i.push(f._initReady().catch(u))}var s=o.forages.slice(0);return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,E(r,t._defaultConfig.version)?S(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<s.length;n++){var i=s[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),u=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;A(n)&&(n=j(n));var o=e(n,r.key,u++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),A(e)&&(e=j(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=new a(function(r,o){var u;n.ready().then(function(){return u=n._dbInfo,"[object Blob]"===v.call(t)?function(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a(function(t){var r=e.transaction(l,p),n=i([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return d=e})}(u.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)}));var r}):t}).then(function(t){O(n._dbInfo,p,function(i,a){if(i)return o(i);try{var u=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=u.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){o(c.error?c.error:c.transaction.error)}}catch(e){o(e)}})}).catch(o)});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,p,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){n(a.error?a.error:a.transaction.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,p,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){r(i.error?i.error:i.transaction.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),u=!1,c=a.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||u?t(r.key):(u=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var c=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var r=h[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});n=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;b(e);var n=h[e.name],i=n.forages;t.close();for(var u=0;u<i.length;u++){var c=i[u];c._dbInfo.db=null,c._dbInfo.version=r}return new a(function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,g(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e);var r=h[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return new a(function(t,r){var n=o.deleteDatabase(e.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<n.length;t++)g(n[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return u(n,t),n}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=/^~~local_forage_type~([^~]+)~/,R="__lfsc__:",L=R.length,D="arbf",C="blob",T="si08",P="ui08",F="uic8",M="si16",z="si32",U="ur16",q="ui32",W="fl32",G="fl64",K=L+D.length,H=Object.prototype.toString;function J(e){var t,r,n,o,i,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),s=new Uint8Array(f);for(t=0;t<u;t+=4)r=k.indexOf(e[t]),n=k.indexOf(e[t+1]),o=k.indexOf(e[t+2]),i=k.indexOf(e[t+3]),s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return f}function Q(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=k[r[t]>>2],n+=k[(3&r[t])<<4|r[t+1]>>4],n+=k[(15&r[t+1])<<2|r[t+2]>>6],n+=k[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var V={serialize:function(e,t){var r="";if(e&&(r=H.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===H.call(e.buffer))){var n,o=R;e instanceof ArrayBuffer?(n=e,o+=D):(n=e.buffer,"[object Int8Array]"===r?o+=T:"[object Uint8Array]"===r?o+=P:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=M:"[object Uint16Array]"===r?o+=U:"[object Int32Array]"===r?o+=z:"[object Uint32Array]"===r?o+=q:"[object Float32Array]"===r?o+=W:"[object Float64Array]"===r?o+=G:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+Q(this.result);t("__lfsc__:blob"+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,L)!==R)return JSON.parse(e);var t,r=e.substring(K),n=e.substring(L,K);if(n===C&&B.test(r)){var o=r.match(B);t=o[1],r=r.substring(o[0].length)}var a=J(r);switch(n){case D:return a;case C:return i([a],{type:t});case T:return new Int8Array(a);case P:return new Uint8Array(a);case F:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case U:return new Uint16Array(a);case z:return new Int32Array(a);case q:return new Uint32Array(a);case W:return new Float32Array(a);case G:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:J,bufferToString:Q};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Y(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,u){u.rows.length?i(e,a):X(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}function Z(e,t,r,n){var o=this;e=f(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var u=t,c=o._dbInfo;c.serializer.serialize(t,function(t,f){f?a(f):c.db.transaction(function(r){Y(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(u)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Z.apply(o,[e,u,r,n-1]));a(t)}})})}).catch(a)});return u(i,r),i}function $(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){X(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)});return r.serializer=V,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),f=c.value;if(f&&(f=o.serializer.deserialize(f)),void 0!==(f=e(f,c.key,u+1)))return void t(f)}t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){return Z.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key);e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,o=this;return u(n=e.name?new a(function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:$(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u]));a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}};function te(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=V,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,u=0;u<i;u++){var c=localStorage.key(u);if(0===c.indexOf(n)){var f=localStorage.getItem(c);if(f&&(f=t.serializer.deserialize(f)),void 0!==(f=e(f,c.substring(o),a++)))return f}}});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new a(function(o,i){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){localStorage.removeItem(r._dbInfo.keyPrefix+e)});return u(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return u(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return u(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n});return u(r,e),r},dropInstance:function(e,t){if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this;return u(n=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){for(var r=e.length,n=0;n<r;){if((o=e[n])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;n++}var o,i;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ue={INDEXEDDB:x,WEBSQL:ee,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),le={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function he(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=oe(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=new(function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(r)){var n=ue[r],o=n._driver;this[r]=o,ie[o]||this.defineDriver(n)}this._defaultConfig=he({},le),this._config=he({},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(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=se.concat("_initStorage"),c=0,f=i.length;c<f;c++){var s=i[c];if((!ne(fe,s)||e[s])&&"function"!=typeof e[s])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return u(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var l=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}});return c(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(new Error("Driver not found."));return c(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(V);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;oe(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function u(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var f=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=f.then(function(){var e=o[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var o=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(u).catch(r)}i();var c=new Error("No available storage method found.");return n._driverSet=a.reject(c),n._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet}),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){he(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)de(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}),u=o(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,r="__lfsc__:".length,n=r+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),o=new Uint8Array(n),i=0,a=0;i<r;i+=4){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=u<<2|c>>4,o[a++]=(15&c)<<4|f>>2,o[a++]=(3&f)<<6|63&s}return n}function a(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];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 u(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=u(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var r=this;if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?c(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var h={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var o,a=e.substring(n),u=e.substring(r,n);if("blob"===u&&t.test(a)){var c=a.match(t);o=c[1],a=a.substring(c[0].length)}var f=i(a);switch(u){case"arbf":return f;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([f],{type:o});case"si08":return new Int8Array(f);case"ui08":return new Uint8Array(f);case"uic8":return new Uint8ClampedArray(f);case"si16":return new Int16Array(f);case"ur16":return new Uint16Array(f);case"si32":return new Int32Array(f);case"ui32":return new Uint32Array(f);case"fl32":return new Float32Array(f);case"fl64":return new Float64Array(f);default:throw new Error("Unkown type: "+u)}},serialize:function(e,t){var r="";if(e&&(r=o.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var n=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(n=e,i+="arbf"):(n=e.buffer,"[object Int8Array]"===r?i+="si08":"[object Uint8Array]"===r?i+="ui08":"[object Uint8ClampedArray]"===r?i+="uic8":"[object Int16Array]"===r?i+="si16":"[object Uint16Array]"===r?i+="ur16":"[object Int32Array]"===r?i+="si32":"[object Uint32Array]"===r?i+="ui32":"[object Float32Array]"===r?i+="fl32":"[object Float64Array]"===r?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(n))}else if("[object Blob]"===r){var u=new FileReader;u.onload=function(){var r="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+r)},u.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:i},v={},y=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return v[t]||(v[t]=new e(t)),v[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete v[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?u(e):{},r=c(t,this._defaultConfig),n=y.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=h,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return f(r,e),r},e.dropInstance=function(e,t){var r=l.apply(this,arguments),n=r.promise,o=r.callback;return f(n.then(function(e){y.resolve(e).drop()}),o),n},e.getItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return f(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then(function(){for(var t=r._dbInfo.mStore,n=t.keys(),o=0;o<n.length;o++){var i=t.get(n[o]);if(i&&(i=r._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,n[o],o+1)))return i}});return f(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then(function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return f(n,t),n},e.keys=function(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return f(r,e),r},e.length=function(e){var t=this.keys().then(function(e){return e.length});return f(t,e),t},e.removeItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return f(n,t),n},e.setItem=function(e,t,r){var n=this;e=d(e);var o=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(o,i){n._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{n._dbInfo.mStore.set(e,t),o(r)}catch(e){i(e)}})})});return f(o,r),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),c=n(u),f=Object.assign(Object.create(null),u,{default:c});function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var d={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},h=function(t){var r,n;function o(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).iframe=void 0,e.activeElement=null,e}n=t,(r=o).prototype=Object.create(n.prototype),r.prototype.constructor=r,s(r,n);var i=o.prototype;return i.init=function(){var t=this;this.test="hello",this.iframe=new Promise(function(r){var n=function(){if(o=encodeURIComponent(t.parameters),i=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(i.find(function(e){return e.src.includes(o)})))e.createDuplicateIframeWarning().log();else{var n=document.createElement("iframe");n.classList.add("magic-iframe"),n.dataset.magicIframeLabel=e.createURL(t.endpoint).host,n.title="Secure Modal",n.src=e.createURL("/send?params="+encodeURIComponent(t.parameters),t.endpoint).href,function(e){for(var t=0,r=Object.entries(d);t<r.length;t++){var n=r[t];e.style[n[0]]=n[1]}}(n),document.body.appendChild(n),r(n)}var o,i};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}),window.addEventListener("message",function(e){if(e.origin===t.endpoint&&e.data&&e.data.msgType&&t.messageHandlers.size){var r;e.data.response=null!=(r=e.data.response)?r:{};for(var n,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t.messageHandlers.values());!(n=o()).done;)(0,n.value)(e)}})},i.showOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){t.style.display="block",e.activeElement=document.activeElement,t.focus()})}catch(e){return Promise.reject(e)}},i.hideOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){var r;t.style.display="none",null!==(r=e.activeElement)&&void 0!==r&&r.focus&&e.activeElement.focus(),e.activeElement=null})}catch(e){return Promise.reject(e)}},i._post=function(t){try{var r=this;return Promise.resolve(r.iframe).then(function(n){if(!n||!n.contentWindow)throw e.createModalNotReadyError();n.contentWindow.postMessage(t,r.endpoint)})}catch(e){return Promise.reject(e)}},o}(e.ViewController),v=e.createSDK(e.SDKBase,{platform:"web",sdkName:"magic-sdk",version:"6.2.0",defaultEndpoint:"https://auth.magic.link/",ViewController:h,configureStorage:function(){try{var e=a.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return Promise.resolve(e.defineDriver(f)).then(function(){return Promise.resolve(e.setDriver([a.INDEXEDDB,a.LOCALSTORAGE,u._driver])).then(function(){return e})})}catch(e){return Promise.reject(e)}}});exports.Magic=v,Object.keys(t).forEach(function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
|
|
1
|
+
var e=require("@magic-sdk/provider"),t=require("@magic-sdk/commons"),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){var t={exports:{}};return e(t,t.exports),t.exports}function i(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}o(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof y?t:y).prototype),i=new N(n||[]);return o._invoke=function(e,t,r){var n=s;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===s)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=f(e,t,r);if("normal"===c.type){if(n=r.done?h:l,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s="suspendedStart",l="suspendedYield",d="executing",h="completed",v={};function y(){}function p(){}function m(){}var b={};b[i]=function(){return this};var g=Object.getPrototypeOf,_=g&&g(g(O([])));_&&_!==r&&n.call(_,i)&&(b=_);var w=m.prototype=y.prototype=Object.create(b);function I(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function S(e,t){function r(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,a,u)},function(e){r("throw",e,a,u)}):t.resolve(l).then(function(e){s.value=e,a(s)},function(e){return r("throw",e,a,u)})}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t(function(t,o){r(e,n,t,o)})}return o=o?o.then(i,i):i()}}function E(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:x}}function x(){return{value:t,done:!0}}return p.prototype=w.constructor=m,m.constructor=p,m[u]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},I(S.prototype),S.prototype[a]=function(){return this},e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(w),w[u]="Generator",w[i]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(c&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});var a=o(function(e,t){e.exports=function e(t,r,n){function o(u,c){if(!r[u]){if(!t[u]){if(!c&&i)return i(u);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=r[u]={exports:{}};t[u][0].call(s.exports,function(e){return o(t[u][1][e]||e)},s,s.exports,e,t,r,n)}return r[u].exports}for(var a=i,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(e,t,n){(function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(s),u=e.document.createTextNode("");a.observe(u,{characterData:!0}),r=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){s(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(s,0)};else{var c=new e.MessageChannel;c.port1.onmessage=s,r=function(){c.port2.postMessage(0)}}var f=[];function s(){var e,t;n=!0;for(var r=f.length;r;){for(t=f,f=[],e=-1;++e<r;)t[e]();r=f.length}n=!1}t.exports=function(e){1!==f.push(e)||n||r()}}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function f(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&h(this,e)}function s(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=v(function(){t(o,n)});"error"===a.status&&n(a.value)}function v(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=f,f.prototype.catch=function(e){return this.then(null,e)},f.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==c?l(r,this.state===u?e:t,this.outcome):this.queue.push(new s(r,e,t)),r},s.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},s.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},s.prototype.callRejected=function(e){i.reject(this.promise,e)},s.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=v(d,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=u,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},f.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},f.reject=function(e){var t=new this(o);return i.reject(t,e)},f.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),u=0,c=-1,f=new this(o);++c<r;)s(e[c],c);return f;function s(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==r||n||(n=!0,i.resolve(f,a))},function(e){n||(n=!0,i.reject(f,e))})}},f.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n=-1,a=new this(o);++n<t;)this.resolve(e[n]).then(function(e){r||(r=!0,i.resolve(a,e))},function(e){r||(r=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,h={},v=Object.prototype.toString,y="readonly",p="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function b(e){var t=h[e.name],r={};r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function g(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function w(e,t){return new a(function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),g(e)}})}function I(e){return w(e,!1)}function S(e){return w(e,!0)}function E(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version>e.db.version;if(e.version<e.db.version&&(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),n||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function j(e){return i([m(atob(e.data))],{type:e.type})}function A(e){return e&&e.__local_forage_encoded_blob}function N(e){var t=this,r=t._initReady().then(function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(r,e,e),r}function O(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)}).then(function(){return function(e){b(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,E(e)?S(e):t}).then(function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){O(e,t,r,n-1)})}).catch(r);r(o)}}var x={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=h[r.name];o||(h[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=N);var i=[];function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var f=o.forages[c];f!==t&&i.push(f._initReady().catch(u))}var s=o.forages.slice(0);return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,E(r,t._defaultConfig.version)?S(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<s.length;n++){var i=s[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),u=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;A(n)&&(n=j(n));var o=e(n,r.key,u++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),A(e)&&(e=j(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=new a(function(r,o){var u;n.ready().then(function(){return u=n._dbInfo,"[object Blob]"===v.call(t)?function(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a(function(t){var r=e.transaction(l,p),n=i([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return d=e})}(u.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)}));var r}):t}).then(function(t){O(n._dbInfo,p,function(i,a){if(i)return o(i);try{var u=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=u.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){o(c.error?c.error:c.transaction.error)}}catch(e){o(e)}})}).catch(o)});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,p,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){n(a.error?a.error:a.transaction.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,p,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){r(i.error?i.error:i.transaction.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),u=!1,c=a.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||u?t(r.key):(u=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var c=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var r=h[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});n=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;b(e);var n=h[e.name],i=n.forages;t.close();for(var u=0;u<i.length;u++){var c=i[u];c._dbInfo.db=null,c._dbInfo.version=r}return new a(function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,g(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e);var r=h[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return new a(function(t,r){var n=o.deleteDatabase(e.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<n.length;t++)g(n[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return u(n,t),n}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=/^~~local_forage_type~([^~]+)~/,R="__lfsc__:",L=R.length,D="arbf",C="blob",T="si08",P="ui08",F="uic8",M="si16",z="si32",U="ur16",q="ui32",W="fl32",G="fl64",K=L+D.length,H=Object.prototype.toString;function J(e){var t,r,n,o,i,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),s=new Uint8Array(f);for(t=0;t<u;t+=4)r=k.indexOf(e[t]),n=k.indexOf(e[t+1]),o=k.indexOf(e[t+2]),i=k.indexOf(e[t+3]),s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return f}function Q(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=k[r[t]>>2],n+=k[(3&r[t])<<4|r[t+1]>>4],n+=k[(15&r[t+1])<<2|r[t+2]>>6],n+=k[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var V={serialize:function(e,t){var r="";if(e&&(r=H.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===H.call(e.buffer))){var n,o=R;e instanceof ArrayBuffer?(n=e,o+=D):(n=e.buffer,"[object Int8Array]"===r?o+=T:"[object Uint8Array]"===r?o+=P:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=M:"[object Uint16Array]"===r?o+=U:"[object Int32Array]"===r?o+=z:"[object Uint32Array]"===r?o+=q:"[object Float32Array]"===r?o+=W:"[object Float64Array]"===r?o+=G:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+Q(this.result);t("__lfsc__:blob"+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,L)!==R)return JSON.parse(e);var t,r=e.substring(K),n=e.substring(L,K);if(n===C&&B.test(r)){var o=r.match(B);t=o[1],r=r.substring(o[0].length)}var a=J(r);switch(n){case D:return a;case C:return i([a],{type:t});case T:return new Int8Array(a);case P:return new Uint8Array(a);case F:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case U:return new Uint16Array(a);case z:return new Int32Array(a);case q:return new Uint32Array(a);case W:return new Float32Array(a);case G:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:J,bufferToString:Q};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Y(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,u){u.rows.length?i(e,a):X(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}function Z(e,t,r,n){var o=this;e=f(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var u=t,c=o._dbInfo;c.serializer.serialize(t,function(t,f){f?a(f):c.db.transaction(function(r){Y(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(u)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Z.apply(o,[e,u,r,n-1]));a(t)}})})}).catch(a)});return u(i,r),i}function $(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){X(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)});return r.serializer=V,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),f=c.value;if(f&&(f=o.serializer.deserialize(f)),void 0!==(f=e(f,c.key,u+1)))return void t(f)}t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){return Z.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key);e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,o=this;return u(n=e.name?new a(function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:$(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u]));a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}};function te(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=V,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,u=0;u<i;u++){var c=localStorage.key(u);if(0===c.indexOf(n)){var f=localStorage.getItem(c);if(f&&(f=t.serializer.deserialize(f)),void 0!==(f=e(f,c.substring(o),a++)))return f}}});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new a(function(o,i){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){localStorage.removeItem(r._dbInfo.keyPrefix+e)});return u(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return u(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return u(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n});return u(r,e),r},dropInstance:function(e,t){if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this;return u(n=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){for(var r=e.length,n=0;n<r;){if((o=e[n])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;n++}var o,i;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ue={INDEXEDDB:x,WEBSQL:ee,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),le={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function he(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=oe(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=new(function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(r)){var n=ue[r],o=n._driver;this[r]=o,ie[o]||this.defineDriver(n)}this._defaultConfig=he({},le),this._config=he({},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(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=se.concat("_initStorage"),c=0,f=i.length;c<f;c++){var s=i[c];if((!ne(fe,s)||e[s])&&"function"!=typeof e[s])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return u(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var l=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}});return c(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(new Error("Driver not found."));return c(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(V);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;oe(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function u(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var f=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=f.then(function(){var e=o[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var o=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(u).catch(r)}i();var c=new Error("No available storage method found.");return n._driverSet=a.reject(c),n._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet}),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){he(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)de(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}),u=o(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,r="__lfsc__:".length,n=r+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),o=new Uint8Array(n),i=0,a=0;i<r;i+=4){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=u<<2|c>>4,o[a++]=(15&c)<<4|f>>2,o[a++]=(3&f)<<6|63&s}return n}function a(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];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 u(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=u(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var r=this;if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?c(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var h={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var o,a=e.substring(n),u=e.substring(r,n);if("blob"===u&&t.test(a)){var c=a.match(t);o=c[1],a=a.substring(c[0].length)}var f=i(a);switch(u){case"arbf":return f;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([f],{type:o});case"si08":return new Int8Array(f);case"ui08":return new Uint8Array(f);case"uic8":return new Uint8ClampedArray(f);case"si16":return new Int16Array(f);case"ur16":return new Uint16Array(f);case"si32":return new Int32Array(f);case"ui32":return new Uint32Array(f);case"fl32":return new Float32Array(f);case"fl64":return new Float64Array(f);default:throw new Error("Unkown type: "+u)}},serialize:function(e,t){var r="";if(e&&(r=o.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var n=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(n=e,i+="arbf"):(n=e.buffer,"[object Int8Array]"===r?i+="si08":"[object Uint8Array]"===r?i+="ui08":"[object Uint8ClampedArray]"===r?i+="uic8":"[object Int16Array]"===r?i+="si16":"[object Uint16Array]"===r?i+="ur16":"[object Int32Array]"===r?i+="si32":"[object Uint32Array]"===r?i+="ui32":"[object Float32Array]"===r?i+="fl32":"[object Float64Array]"===r?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(n))}else if("[object Blob]"===r){var u=new FileReader;u.onload=function(){var r="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+r)},u.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:i},v={},y=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return v[t]||(v[t]=new e(t)),v[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete v[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?u(e):{},r=c(t,this._defaultConfig),n=y.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=h,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return f(r,e),r},e.dropInstance=function(e,t){var r=l.apply(this,arguments),n=r.promise,o=r.callback;return f(n.then(function(e){y.resolve(e).drop()}),o),n},e.getItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return f(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then(function(){for(var t=r._dbInfo.mStore,n=t.keys(),o=0;o<n.length;o++){var i=t.get(n[o]);if(i&&(i=r._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,n[o],o+1)))return i}});return f(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then(function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return f(n,t),n},e.keys=function(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return f(r,e),r},e.length=function(e){var t=this.keys().then(function(e){return e.length});return f(t,e),t},e.removeItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return f(n,t),n},e.setItem=function(e,t,r){var n=this;e=d(e);var o=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(o,i){n._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{n._dbInfo.mStore.set(e,t),o(r)}catch(e){i(e)}})})});return f(o,r),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),c=n(u),f=Object.assign(Object.create(null),u,{default:c});function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var d={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},h=function(t){var r,n;function o(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=t.call.apply(t,[this].concat(n))||this).iframe=void 0,e.activeElement=null,e}n=t,(r=o).prototype=Object.create(n.prototype),r.prototype.constructor=r,s(r,n);var i=o.prototype;return i.init=function(){var t=this;this.test="hello",this.iframe=new Promise(function(r){var n=function(){if(o=encodeURIComponent(t.parameters),i=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(i.find(function(e){return e.src.includes(o)})))e.createDuplicateIframeWarning().log();else{var n=document.createElement("iframe");n.classList.add("magic-iframe"),n.dataset.magicIframeLabel=e.createURL(t.endpoint).host,n.title="Secure Modal",n.src=e.createURL("/send?params="+encodeURIComponent(t.parameters),t.endpoint).href,function(e){for(var t=0,r=Object.entries(d);t<r.length;t++){var n=r[t];e.style[n[0]]=n[1]}}(n),document.body.appendChild(n),r(n)}var o,i};["loaded","interactive","complete"].includes(document.readyState)?n():window.addEventListener("load",n,!1)}),window.addEventListener("message",function(e){if(e.origin===t.endpoint&&e.data&&e.data.msgType&&t.messageHandlers.size){var r;e.data.response=null!=(r=e.data.response)?r:{};for(var n,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t.messageHandlers.values());!(n=o()).done;)(0,n.value)(e)}})},i.showOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){t.style.display="block",e.activeElement=document.activeElement,t.focus()})}catch(e){return Promise.reject(e)}},i.hideOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){var r;t.style.display="none",null!==(r=e.activeElement)&&void 0!==r&&r.focus&&e.activeElement.focus(),e.activeElement=null})}catch(e){return Promise.reject(e)}},i._post=function(t){try{var r=this;return Promise.resolve(r.iframe).then(function(n){if(!n||!n.contentWindow)throw e.createModalNotReadyError();n.contentWindow.postMessage(t,r.endpoint)})}catch(e){return Promise.reject(e)}},o}(e.ViewController),v=e.createSDK(e.SDKBase,{platform:"web",sdkName:"magic-sdk",version:"6.2.1",defaultEndpoint:"https://auth.magic.link/",ViewController:h,configureStorage:function(){try{var e=a.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return Promise.resolve(e.defineDriver(f)).then(function(){return Promise.resolve(e.setDriver([a.INDEXEDDB,a.LOCALSTORAGE,u._driver])).then(function(){return e})})}catch(e){return Promise.reject(e)}}});exports.Magic=v,Object.keys(t).forEach(function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createModalNotReadyError as e,createURL as t,createDuplicateIframeWarning as r,ViewController as n,createSDK as o,SDKBase as i}from"@magic-sdk/provider";export*from"@magic-sdk/commons";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){var t={exports:{}};return e(t,t.exports),t.exports}function f(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}c(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof y?t:y).prototype),i=new N(n||[]);return o._invoke=function(e,t,r){var n=s;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===s)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=f(e,t,r);if("normal"===c.type){if(n=r.done?h:l,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s="suspendedStart",l="suspendedYield",d="executing",h="completed",v={};function y(){}function p(){}function m(){}var b={};b[i]=function(){return this};var g=Object.getPrototypeOf,_=g&&g(g(O([])));_&&_!==r&&n.call(_,i)&&(b=_);var w=m.prototype=y.prototype=Object.create(b);function I(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function S(e,t){function r(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,a,u)},function(e){r("throw",e,a,u)}):t.resolve(l).then(function(e){s.value=e,a(s)},function(e){return r("throw",e,a,u)})}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t(function(t,o){r(e,n,t,o)})}return o=o?o.then(i,i):i()}}function E(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:x}}function x(){return{value:t,done:!0}}return p.prototype=w.constructor=m,m.constructor=p,m[u]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},I(S.prototype),S.prototype[a]=function(){return this},e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(w),w[u]="Generator",w[i]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(c&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});var s=c(function(e,t){e.exports=function e(t,r,n){function o(a,u){if(!r[a]){if(!t[a]){if(!u&&f)return f(a);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var s=r[a]={exports:{}};t[a][0].call(s.exports,function(e){return o(t[a][1][e]||e)},s,s.exports,e,t,r,n)}return r[a].exports}for(var i=f,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){(function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(s),u=e.document.createTextNode("");a.observe(u,{characterData:!0}),r=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){s(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(s,0)};else{var c=new e.MessageChannel;c.port1.onmessage=s,r=function(){c.port2.postMessage(0)}}var f=[];function s(){var e,t;n=!0;for(var r=f.length;r;){for(t=f,f=[],e=-1;++e<r;)t[e]();r=f.length}n=!1}t.exports=function(e){1!==f.push(e)||n||r()}}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function f(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&h(this,e)}function s(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=v(function(){t(o,n)});"error"===a.status&&n(a.value)}function v(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=f,f.prototype.catch=function(e){return this.then(null,e)},f.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==c?l(r,this.state===u?e:t,this.outcome):this.queue.push(new s(r,e,t)),r},s.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},s.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},s.prototype.callRejected=function(e){i.reject(this.promise,e)},s.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=v(d,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=u,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},f.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},f.reject=function(e){var t=new this(o);return i.reject(t,e)},f.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),u=0,c=-1,f=new this(o);++c<r;)s(e[c],c);return f;function s(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==r||n||(n=!0,i.resolve(f,a))},function(e){n||(n=!0,i.reject(f,e))})}},f.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n=-1,a=new this(o);++n<t;)this.resolve(e[n]).then(function(e){r||(r=!0,i.resolve(a,e))},function(e){r||(r=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,h={},v=Object.prototype.toString,y="readonly",p="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function b(e){var t=h[e.name],r={};r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function g(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function w(e,t){return new a(function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),g(e)}})}function I(e){return w(e,!1)}function S(e){return w(e,!0)}function E(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version>e.db.version;if(e.version<e.db.version&&(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),n||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function j(e){return i([m(atob(e.data))],{type:e.type})}function A(e){return e&&e.__local_forage_encoded_blob}function N(e){var t=this,r=t._initReady().then(function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(r,e,e),r}function O(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)}).then(function(){return function(e){b(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,E(e)?S(e):t}).then(function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){O(e,t,r,n-1)})}).catch(r);r(o)}}var x={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=h[r.name];o||(h[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=N);var i=[];function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var f=o.forages[c];f!==t&&i.push(f._initReady().catch(u))}var s=o.forages.slice(0);return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,E(r,t._defaultConfig.version)?S(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<s.length;n++){var i=s[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),u=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;A(n)&&(n=j(n));var o=e(n,r.key,u++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),A(e)&&(e=j(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=new a(function(r,o){var u;n.ready().then(function(){return u=n._dbInfo,"[object Blob]"===v.call(t)?function(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a(function(t){var r=e.transaction(l,p),n=i([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return d=e})}(u.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)}));var r}):t}).then(function(t){O(n._dbInfo,p,function(i,a){if(i)return o(i);try{var u=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=u.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){o(c.error?c.error:c.transaction.error)}}catch(e){o(e)}})}).catch(o)});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,p,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){n(a.error?a.error:a.transaction.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,p,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){r(i.error?i.error:i.transaction.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),u=!1,c=a.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||u?t(r.key):(u=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var c=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var r=h[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});n=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;b(e);var n=h[e.name],i=n.forages;t.close();for(var u=0;u<i.length;u++){var c=i[u];c._dbInfo.db=null,c._dbInfo.version=r}return new a(function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,g(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e);var r=h[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return new a(function(t,r){var n=o.deleteDatabase(e.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<n.length;t++)g(n[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return u(n,t),n}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=/^~~local_forage_type~([^~]+)~/,L="__lfsc__:",R=L.length,D="arbf",C="blob",T="si08",P="ui08",F="uic8",M="si16",z="si32",U="ur16",q="ui32",W="fl32",G="fl64",H=R+D.length,K=Object.prototype.toString;function J(e){var t,r,n,o,i,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),s=new Uint8Array(f);for(t=0;t<u;t+=4)r=k.indexOf(e[t]),n=k.indexOf(e[t+1]),o=k.indexOf(e[t+2]),i=k.indexOf(e[t+3]),s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return f}function Q(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=k[r[t]>>2],n+=k[(3&r[t])<<4|r[t+1]>>4],n+=k[(15&r[t+1])<<2|r[t+2]>>6],n+=k[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var X={serialize:function(e,t){var r="";if(e&&(r=K.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===K.call(e.buffer))){var n,o=L;e instanceof ArrayBuffer?(n=e,o+=D):(n=e.buffer,"[object Int8Array]"===r?o+=T:"[object Uint8Array]"===r?o+=P:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=M:"[object Uint16Array]"===r?o+=U:"[object Int32Array]"===r?o+=z:"[object Uint32Array]"===r?o+=q:"[object Float32Array]"===r?o+=W:"[object Float64Array]"===r?o+=G:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+Q(this.result);t("__lfsc__:blob"+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,R)!==L)return JSON.parse(e);var t,r=e.substring(H),n=e.substring(R,H);if(n===C&&B.test(r)){var o=r.match(B);t=o[1],r=r.substring(o[0].length)}var a=J(r);switch(n){case D:return a;case C:return i([a],{type:t});case T:return new Int8Array(a);case P:return new Uint8Array(a);case F:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case U:return new Uint16Array(a);case z:return new Int32Array(a);case q:return new Uint32Array(a);case W:return new Float32Array(a);case G:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:J,bufferToString:Q};function V(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Y(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,u){u.rows.length?i(e,a):V(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}function Z(e,t,r,n){var o=this;e=f(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var u=t,c=o._dbInfo;c.serializer.serialize(t,function(t,f){f?a(f):c.db.transaction(function(r){Y(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(u)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Z.apply(o,[e,u,r,n-1]));a(t)}})})}).catch(a)});return u(i,r),i}function $(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){V(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)});return r.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),f=c.value;if(f&&(f=o.serializer.deserialize(f)),void 0!==(f=e(f,c.key,u+1)))return void t(f)}t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){return Z.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key);e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,o=this;return u(n=e.name?new a(function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:$(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u]));a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}};function te(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,u=0;u<i;u++){var c=localStorage.key(u);if(0===c.indexOf(n)){var f=localStorage.getItem(c);if(f&&(f=t.serializer.deserialize(f)),void 0!==(f=e(f,c.substring(o),a++)))return f}}});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new a(function(o,i){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){localStorage.removeItem(r._dbInfo.keyPrefix+e)});return u(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return u(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return u(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n});return u(r,e),r},dropInstance:function(e,t){if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this;return u(n=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){for(var r=e.length,n=0;n<r;){if((o=e[n])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;n++}var o,i;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ue={INDEXEDDB:x,WEBSQL:ee,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),le={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function he(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=oe(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=new(function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(r)){var n=ue[r],o=n._driver;this[r]=o,ie[o]||this.defineDriver(n)}this._defaultConfig=he({},le),this._config=he({},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(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=se.concat("_initStorage"),c=0,f=i.length;c<f;c++){var s=i[c];if((!ne(fe,s)||e[s])&&"function"!=typeof e[s])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return u(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var l=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}});return c(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(new Error("Driver not found."));return c(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(X);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;oe(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function u(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var f=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=f.then(function(){var e=o[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var o=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(u).catch(r)}i();var c=new Error("No available storage method found.");return n._driverSet=a.reject(c),n._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet}),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){he(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)de(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}),l=c(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,r="__lfsc__:".length,n=r+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),o=new Uint8Array(n),i=0,a=0;i<r;i+=4){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=u<<2|c>>4,o[a++]=(15&c)<<4|f>>2,o[a++]=(3&f)<<6|63&s}return n}function a(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];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 u(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=u(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var r=this;if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?c(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var h={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var o,a=e.substring(n),u=e.substring(r,n);if("blob"===u&&t.test(a)){var c=a.match(t);o=c[1],a=a.substring(c[0].length)}var f=i(a);switch(u){case"arbf":return f;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([f],{type:o});case"si08":return new Int8Array(f);case"ui08":return new Uint8Array(f);case"uic8":return new Uint8ClampedArray(f);case"si16":return new Int16Array(f);case"ur16":return new Uint16Array(f);case"si32":return new Int32Array(f);case"ui32":return new Uint32Array(f);case"fl32":return new Float32Array(f);case"fl64":return new Float64Array(f);default:throw new Error("Unkown type: "+u)}},serialize:function(e,t){var r="";if(e&&(r=o.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var n=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(n=e,i+="arbf"):(n=e.buffer,"[object Int8Array]"===r?i+="si08":"[object Uint8Array]"===r?i+="ui08":"[object Uint8ClampedArray]"===r?i+="uic8":"[object Int16Array]"===r?i+="si16":"[object Uint16Array]"===r?i+="ur16":"[object Int32Array]"===r?i+="si32":"[object Uint32Array]"===r?i+="ui32":"[object Float32Array]"===r?i+="fl32":"[object Float64Array]"===r?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(n))}else if("[object Blob]"===r){var u=new FileReader;u.onload=function(){var r="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+r)},u.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:i},v={},y=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return v[t]||(v[t]=new e(t)),v[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete v[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?u(e):{},r=c(t,this._defaultConfig),n=y.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=h,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return f(r,e),r},e.dropInstance=function(e,t){var r=l.apply(this,arguments),n=r.promise,o=r.callback;return f(n.then(function(e){y.resolve(e).drop()}),o),n},e.getItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return f(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then(function(){for(var t=r._dbInfo.mStore,n=t.keys(),o=0;o<n.length;o++){var i=t.get(n[o]);if(i&&(i=r._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,n[o],o+1)))return i}});return f(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then(function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return f(n,t),n},e.keys=function(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return f(r,e),r},e.length=function(e){var t=this.keys().then(function(e){return e.length});return f(t,e),t},e.removeItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return f(n,t),n},e.setItem=function(e,t,r){var n=this;e=d(e);var o=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(o,i){n._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{n._dbInfo.mStore.set(e,t),o(r)}catch(e){i(e)}})})});return f(o,r),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),d=u(l),h=Object.assign(Object.create(null),l,{default:d});function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var p={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},m=o(i,{platform:"web",sdkName:"magic-sdk",version:"6.2.0",defaultEndpoint:"https://auth.magic.link/",ViewController:function(n){var o,i;function a(){for(var e,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n.call.apply(n,[this].concat(r))||this).iframe=void 0,e.activeElement=null,e}i=n,(o=a).prototype=Object.create(i.prototype),o.prototype.constructor=o,v(o,i);var u=a.prototype;return u.init=function(){var e=this;this.test="hello",this.iframe=new Promise(function(n){var o=function(){if(i=encodeURIComponent(e.parameters),a=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(a.find(function(e){return e.src.includes(i)})))r().log();else{var o=document.createElement("iframe");o.classList.add("magic-iframe"),o.dataset.magicIframeLabel=t(e.endpoint).host,o.title="Secure Modal",o.src=t("/send?params="+encodeURIComponent(e.parameters),e.endpoint).href,function(e){for(var t=0,r=Object.entries(p);t<r.length;t++){var n=r[t];e.style[n[0]]=n[1]}}(o),document.body.appendChild(o),n(o)}var i,a};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)}),window.addEventListener("message",function(t){if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){var r;t.data.response=null!=(r=t.data.response)?r:{};for(var n,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(e,t):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.messageHandlers.values());!(n=o()).done;)(0,n.value)(t)}})},u.showOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){t.style.display="block",e.activeElement=document.activeElement,t.focus()})}catch(e){return Promise.reject(e)}},u.hideOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){var r;t.style.display="none",null!==(r=e.activeElement)&&void 0!==r&&r.focus&&e.activeElement.focus(),e.activeElement=null})}catch(e){return Promise.reject(e)}},u._post=function(t){try{var r=this;return Promise.resolve(r.iframe).then(function(n){if(!n||!n.contentWindow)throw e();n.contentWindow.postMessage(t,r.endpoint)})}catch(e){return Promise.reject(e)}},a}(n),configureStorage:function(){try{var e=s.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return Promise.resolve(e.defineDriver(h)).then(function(){return Promise.resolve(e.setDriver([s.INDEXEDDB,s.LOCALSTORAGE,l._driver])).then(function(){return e})})}catch(e){return Promise.reject(e)}}});export{m as Magic};
|
|
1
|
+
import{createModalNotReadyError as e,createURL as t,createDuplicateIframeWarning as r,ViewController as n,createSDK as o,SDKBase as i}from"@magic-sdk/provider";export*from"@magic-sdk/commons";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){var t={exports:{}};return e(t,t.exports),t.exports}function f(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}c(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof y?t:y).prototype),i=new N(n||[]);return o._invoke=function(e,t,r){var n=s;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===s)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var c=f(e,t,r);if("normal"===c.type){if(n=r.done?h:l,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s="suspendedStart",l="suspendedYield",d="executing",h="completed",v={};function y(){}function p(){}function m(){}var b={};b[i]=function(){return this};var g=Object.getPrototypeOf,_=g&&g(g(O([])));_&&_!==r&&n.call(_,i)&&(b=_);var w=m.prototype=y.prototype=Object.create(b);function I(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function S(e,t){function r(o,i,a,u){var c=f(e[o],e,i);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,a,u)},function(e){r("throw",e,a,u)}):t.resolve(l).then(function(e){s.value=e,a(s)},function(e){return r("throw",e,a,u)})}u(c.arg)}var o;this._invoke=function(e,n){function i(){return new t(function(t,o){r(e,n,t,o)})}return o=o?o.then(i,i):i()}}function E(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function O(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:x}}function x(){return{value:t,done:!0}}return p.prototype=w.constructor=m,m.constructor=p,m[u]=p.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},I(S.prototype),S.prototype[a]=function(){return this},e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(w),w[u]="Generator",w[i]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=O,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(c&&f){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});var s=c(function(e,t){e.exports=function e(t,r,n){function o(a,u){if(!r[a]){if(!t[a]){if(!u&&f)return f(a);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var s=r[a]={exports:{}};t[a][0].call(s.exports,function(e){return o(t[a][1][e]||e)},s,s.exports,e,t,r,n)}return r[a].exports}for(var i=f,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){(function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(s),u=e.document.createTextNode("");a.observe(u,{characterData:!0}),r=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){s(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(s,0)};else{var c=new e.MessageChannel;c.port1.onmessage=s,r=function(){c.port2.postMessage(0)}}var f=[];function s(){var e,t;n=!0;for(var r=f.length;r;){for(t=f,f=[],e=-1;++e<r;)t[e]();r=f.length}n=!1}t.exports=function(e){1!==f.push(e)||n||r()}}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function f(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&h(this,e)}function s(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=v(function(){t(o,n)});"error"===a.status&&n(a.value)}function v(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=f,f.prototype.catch=function(e){return this.then(null,e)},f.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==c?l(r,this.state===u?e:t,this.outcome):this.queue.push(new s(r,e,t)),r},s.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},s.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},s.prototype.callRejected=function(e){i.reject(this.promise,e)},s.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=v(d,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)h(e,n);else{e.state=u,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},f.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},f.reject=function(e){var t=new this(o);return i.reject(t,e)},f.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),u=0,c=-1,f=new this(o);++c<r;)s(e[c],c);return f;function s(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==r||n||(n=!0,i.resolve(f,a))},function(e){n||(n=!0,i.reject(f,e))})}},f.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n=-1,a=new this(o);++n<t;)this.resolve(e[n]).then(function(e){r||(r=!0,i.resolve(a,e))},function(e){r||(r=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,h={},v=Object.prototype.toString,y="readonly",p="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function b(e){var t=h[e.name],r={};r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function g(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=h[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function w(e,t){return new a(function(r,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),g(e)}})}function I(e){return w(e,!1)}function S(e){return w(e,!0)}function E(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version>e.db.version;if(e.version<e.db.version&&(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),n||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function j(e){return i([m(atob(e.data))],{type:e.type})}function A(e){return e&&e.__local_forage_encoded_blob}function N(e){var t=this,r=t._initReady().then(function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(r,e,e),r}function O(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)}).then(function(){return function(e){b(e);for(var t=h[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,E(e)?S(e):t}).then(function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){O(e,t,r,n-1)})}).catch(r);r(o)}}var x={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=h[r.name];o||(h[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=N);var i=[];function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var f=o.forages[c];f!==t&&i.push(f._initReady().catch(u))}var s=o.forages.slice(0);return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,E(r,t._defaultConfig.version)?S(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<s.length;n++){var i=s[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),u=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;A(n)&&(n=j(n));var o=e(n,r.key,u++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),A(e)&&(e=j(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=new a(function(r,o){var u;n.ready().then(function(){return u=n._dbInfo,"[object Blob]"===v.call(t)?function(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a(function(t){var r=e.transaction(l,p),n=i([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return d=e})}(u.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)}));var r}):t}).then(function(t){O(n._dbInfo,p,function(i,a){if(i)return o(i);try{var u=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var c=u.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){o(c.error?c.error:c.transaction.error)}}catch(e){o(e)}})}).catch(o)});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){O(r._dbInfo,p,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){n(a.error?a.error:a.transaction.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,p,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){r(i.error?i.error:i.transaction.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){O(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),u=!1,c=a.openKeyCursor();c.onsuccess=function(){var r=c.result;r?0===e||u?t(r.key):(u=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){O(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var c=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var r=h[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});n=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;b(e);var n=h[e.name],i=n.forages;t.close();for(var u=0;u<i.length;u++){var c=i[u];c._dbInfo.db=null,c._dbInfo.version=r}return new a(function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,g(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e);var r=h[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return new a(function(t,r){var n=o.deleteDatabase(e.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<n.length;t++)g(n[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return u(n,t),n}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=/^~~local_forage_type~([^~]+)~/,L="__lfsc__:",R=L.length,D="arbf",C="blob",T="si08",P="ui08",F="uic8",M="si16",z="si32",U="ur16",q="ui32",W="fl32",G="fl64",H=R+D.length,K=Object.prototype.toString;function J(e){var t,r,n,o,i,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),s=new Uint8Array(f);for(t=0;t<u;t+=4)r=k.indexOf(e[t]),n=k.indexOf(e[t+1]),o=k.indexOf(e[t+2]),i=k.indexOf(e[t+3]),s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return f}function Q(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=k[r[t]>>2],n+=k[(3&r[t])<<4|r[t+1]>>4],n+=k[(15&r[t+1])<<2|r[t+2]>>6],n+=k[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var X={serialize:function(e,t){var r="";if(e&&(r=K.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===K.call(e.buffer))){var n,o=L;e instanceof ArrayBuffer?(n=e,o+=D):(n=e.buffer,"[object Int8Array]"===r?o+=T:"[object Uint8Array]"===r?o+=P:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=M:"[object Uint16Array]"===r?o+=U:"[object Int32Array]"===r?o+=z:"[object Uint32Array]"===r?o+=q:"[object Float32Array]"===r?o+=W:"[object Float64Array]"===r?o+=G:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+Q(this.result);t("__lfsc__:blob"+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,R)!==L)return JSON.parse(e);var t,r=e.substring(H),n=e.substring(R,H);if(n===C&&B.test(r)){var o=r.match(B);t=o[1],r=r.substring(o[0].length)}var a=J(r);switch(n){case D:return a;case C:return i([a],{type:t});case T:return new Int8Array(a);case P:return new Uint8Array(a);case F:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case U:return new Uint16Array(a);case z:return new Int32Array(a);case q:return new Uint32Array(a);case W:return new Float32Array(a);case G:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:J,bufferToString:Q};function V(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Y(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,u){u.rows.length?i(e,a):V(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}function Z(e,t,r,n){var o=this;e=f(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var u=t,c=o._dbInfo;c.serializer.serialize(t,function(t,f){f?a(f):c.db.transaction(function(r){Y(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(u)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Z.apply(o,[e,u,r,n-1]));a(t)}})})}).catch(a)});return u(i,r),i}function $(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){V(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)});return r.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),f=c.value;if(f&&(f=o.serializer.deserialize(f)),void 0!==(f=e(f,c.key,u+1)))return void t(f)}t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},setItem:function(e,t,r){return Z.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=f(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){Y(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){Y(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key);e(n)},function(e,t){r(t)})})}).catch(r)});return u(r,e),r},dropInstance:function(e,t){t=s.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,o=this;return u(n=e.name?new a(function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:$(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u]));a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}};function te(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,u=0;u<i;u++){var c=localStorage.key(u);if(0===c.indexOf(n)){var f=localStorage.getItem(c);if(f&&(f=t.serializer.deserialize(f)),void 0!==(f=e(f,c.substring(o),a++)))return f}}});return u(n,t),n},getItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return u(n,t),n},setItem:function(e,t,r){var n=this;e=f(e);var o=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new a(function(o,i){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return u(o,r),o},removeItem:function(e,t){var r=this;e=f(e);var n=r.ready().then(function(){localStorage.removeItem(r._dbInfo.keyPrefix+e)});return u(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return u(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return u(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n});return u(r,e),r},dropInstance:function(e,t){if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this;return u(n=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){for(var r=e.length,n=0;n<r;){if((o=e[n])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;n++}var o,i;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ue={INDEXEDDB:x,WEBSQL:ee,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),le={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function he(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=oe(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=new(function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(r)){var n=ue[r],o=n._driver;this[r]=o,ie[o]||this.defineDriver(n)}this._defaultConfig=he({},le),this._config=he({},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(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=se.concat("_initStorage"),c=0,f=i.length;c<f;c++){var s=i[c];if((!ne(fe,s)||e[s])&&"function"!=typeof e[s])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return u(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var l=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}});return c(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(new Error("Driver not found."));return c(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(X);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;oe(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function u(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var f=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=f.then(function(){var e=o[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var o=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(u).catch(r)}i();var c=new Error("No available storage method found.");return n._driverSet=a.reject(c),n._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet}),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){he(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)de(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}),l=c(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,r="__lfsc__:".length,n=r+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),o=new Uint8Array(n),i=0,a=0;i<r;i+=4){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=u<<2|c>>4,o[a++]=(15&c)<<4|f>>2,o[a++]=(3&f)<<6|63&s}return n}function a(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];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 u(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=u(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var r=this;if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?c(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var h={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var o,a=e.substring(n),u=e.substring(r,n);if("blob"===u&&t.test(a)){var c=a.match(t);o=c[1],a=a.substring(c[0].length)}var f=i(a);switch(u){case"arbf":return f;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([f],{type:o});case"si08":return new Int8Array(f);case"ui08":return new Uint8Array(f);case"uic8":return new Uint8ClampedArray(f);case"si16":return new Int16Array(f);case"ur16":return new Uint16Array(f);case"si32":return new Int32Array(f);case"ui32":return new Uint32Array(f);case"fl32":return new Float32Array(f);case"fl64":return new Float64Array(f);default:throw new Error("Unkown type: "+u)}},serialize:function(e,t){var r="";if(e&&(r=o.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var n=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(n=e,i+="arbf"):(n=e.buffer,"[object Int8Array]"===r?i+="si08":"[object Uint8Array]"===r?i+="ui08":"[object Uint8ClampedArray]"===r?i+="uic8":"[object Int16Array]"===r?i+="si16":"[object Uint16Array]"===r?i+="ur16":"[object Int32Array]"===r?i+="si32":"[object Uint32Array]"===r?i+="ui32":"[object Float32Array]"===r?i+="fl32":"[object Float64Array]"===r?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(n))}else if("[object Blob]"===r){var u=new FileReader;u.onload=function(){var r="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+r)},u.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:i},v={},y=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return v[t]||(v[t]=new e(t)),v[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete v[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?u(e):{},r=c(t,this._defaultConfig),n=y.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=h,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return f(r,e),r},e.dropInstance=function(e,t){var r=l.apply(this,arguments),n=r.promise,o=r.callback;return f(n.then(function(e){y.resolve(e).drop()}),o),n},e.getItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return f(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then(function(){for(var t=r._dbInfo.mStore,n=t.keys(),o=0;o<n.length;o++){var i=t.get(n[o]);if(i&&(i=r._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,n[o],o+1)))return i}});return f(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then(function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return f(n,t),n},e.keys=function(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return f(r,e),r},e.length=function(e){var t=this.keys().then(function(e){return e.length});return f(t,e),t},e.removeItem=function(e,t){var r=this;e=d(e);var n=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return f(n,t),n},e.setItem=function(e,t,r){var n=this;e=d(e);var o=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(o,i){n._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{n._dbInfo.mStore.set(e,t),o(r)}catch(e){i(e)}})})});return f(o,r),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),d=u(l),h=Object.assign(Object.create(null),l,{default:d});function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var p={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},m=o(i,{platform:"web",sdkName:"magic-sdk",version:"6.2.1",defaultEndpoint:"https://auth.magic.link/",ViewController:function(n){var o,i;function a(){for(var e,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n.call.apply(n,[this].concat(r))||this).iframe=void 0,e.activeElement=null,e}i=n,(o=a).prototype=Object.create(i.prototype),o.prototype.constructor=o,v(o,i);var u=a.prototype;return u.init=function(){var e=this;this.test="hello",this.iframe=new Promise(function(n){var o=function(){if(i=encodeURIComponent(e.parameters),a=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(a.find(function(e){return e.src.includes(i)})))r().log();else{var o=document.createElement("iframe");o.classList.add("magic-iframe"),o.dataset.magicIframeLabel=t(e.endpoint).host,o.title="Secure Modal",o.src=t("/send?params="+encodeURIComponent(e.parameters),e.endpoint).href,function(e){for(var t=0,r=Object.entries(p);t<r.length;t++){var n=r[t];e.style[n[0]]=n[1]}}(o),document.body.appendChild(o),n(o)}var i,a};["loaded","interactive","complete"].includes(document.readyState)?o():window.addEventListener("load",o,!1)}),window.addEventListener("message",function(t){if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){var r;t.data.response=null!=(r=t.data.response)?r:{};for(var n,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(e,t):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.messageHandlers.values());!(n=o()).done;)(0,n.value)(t)}})},u.showOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){t.style.display="block",e.activeElement=document.activeElement,t.focus()})}catch(e){return Promise.reject(e)}},u.hideOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){var r;t.style.display="none",null!==(r=e.activeElement)&&void 0!==r&&r.focus&&e.activeElement.focus(),e.activeElement=null})}catch(e){return Promise.reject(e)}},u._post=function(t){try{var r=this;return Promise.resolve(r.iframe).then(function(n){if(!n||!n.contentWindow)throw e();n.contentWindow.postMessage(t,r.endpoint)})}catch(e){return Promise.reject(e)}},a}(n),configureStorage:function(){try{var e=s.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return Promise.resolve(e.defineDriver(h)).then(function(){return Promise.resolve(e.setDriver([s.INDEXEDDB,s.LOCALSTORAGE,l._driver])).then(function(){return e})})}catch(e){return Promise.reject(e)}}});export{m as Magic};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/magic.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Magic=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function s(e,t,r){return(s=a()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,o(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var l,h,d,p,v,y,m,g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _(e){var t={exports:{}};return e(t,t.exports),t.exports}function b(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}_(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof v?t:v).prototype),i=new S(n||[]);return o._invoke=function(e,t,r){var n=f;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=c(e,t,r);if("normal"===u.type){if(n=r.done?d:l,u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(e,r,i),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f="suspendedStart",l="suspendedYield",h="executing",d="completed",p={};function v(){}function y(){}function m(){}var g={};g[i]=function(){return this};var E=Object.getPrototypeOf,_=E&&E(E(N([])));_&&_!==r&&n.call(_,i)&&(g=_);var b=m.prototype=v.prototype=Object.create(g);function I(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function w(e,t){function r(o,i,a,s){var u=c(e[o],e,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,a,s)},function(e){r("throw",e,a,s)}):t.resolve(l).then(function(e){f.value=e,a(f)},function(e){return r("throw",e,a,s)})}s(u.arg)}var o;this._invoke=function(e,n){function i(){return new t(function(t,o){r(e,n,t,o)})}return o=o?o.then(i,i):i()}}function R(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var o=c(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function N(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:L}}function L(){return{value:t,done:!0}}return y.prototype=b.constructor=m,m.constructor=y,m[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},I(w.prototype),w.prototype[a]=function(){return this},e.AsyncIterator=w,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(b),b[s]="Generator",b[i]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=N,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}),function(e){e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS"}(l||(l={})),function(e){e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE"}(h||(h={})),function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser"}(d||(d={})),function(e){e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode"}(p||(p={})),function(e){e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT"}(v||(v={})),function(e){e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST"}(y||(y={})),function(e){e.Harmony="HARMONY"}(m||(m={}));var I={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},w="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){var e;return(e=console).error.apply(e,["SEMVER"].concat([].slice.call(arguments)))}:function(){},R=function(e){var t={exports:{}};return function(e,t){var r=I.MAX_SAFE_COMPONENT_LENGTH,n=(t=e.exports={}).re=[],o=t.src=[],i=t.t={},a=0,s=function(e,t,r){var s=a++;w(s,t),i[e]=s,o[s]=t,n[s]=new RegExp(t,r?"g":void 0)};s("NUMERICIDENTIFIER","0|[1-9]\\d*"),s("NUMERICIDENTIFIERLOOSE","[0-9]+"),s("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),s("MAINVERSION","("+o[i.NUMERICIDENTIFIER]+")\\.("+o[i.NUMERICIDENTIFIER]+")\\.("+o[i.NUMERICIDENTIFIER]+")"),s("MAINVERSIONLOOSE","("+o[i.NUMERICIDENTIFIERLOOSE]+")\\.("+o[i.NUMERICIDENTIFIERLOOSE]+")\\.("+o[i.NUMERICIDENTIFIERLOOSE]+")"),s("PRERELEASEIDENTIFIER","(?:"+o[i.NUMERICIDENTIFIER]+"|"+o[i.NONNUMERICIDENTIFIER]+")"),s("PRERELEASEIDENTIFIERLOOSE","(?:"+o[i.NUMERICIDENTIFIERLOOSE]+"|"+o[i.NONNUMERICIDENTIFIER]+")"),s("PRERELEASE","(?:-("+o[i.PRERELEASEIDENTIFIER]+"(?:\\."+o[i.PRERELEASEIDENTIFIER]+")*))"),s("PRERELEASELOOSE","(?:-?("+o[i.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+o[i.PRERELEASEIDENTIFIERLOOSE]+")*))"),s("BUILDIDENTIFIER","[0-9A-Za-z-]+"),s("BUILD","(?:\\+("+o[i.BUILDIDENTIFIER]+"(?:\\."+o[i.BUILDIDENTIFIER]+")*))"),s("FULLPLAIN","v?"+o[i.MAINVERSION]+o[i.PRERELEASE]+"?"+o[i.BUILD]+"?"),s("FULL","^"+o[i.FULLPLAIN]+"$"),s("LOOSEPLAIN","[v=\\s]*"+o[i.MAINVERSIONLOOSE]+o[i.PRERELEASELOOSE]+"?"+o[i.BUILD]+"?"),s("LOOSE","^"+o[i.LOOSEPLAIN]+"$"),s("GTLT","((?:<|>)?=?)"),s("XRANGEIDENTIFIERLOOSE",o[i.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*"),s("XRANGEIDENTIFIER",o[i.NUMERICIDENTIFIER]+"|x|X|\\*"),s("XRANGEPLAIN","[v=\\s]*("+o[i.XRANGEIDENTIFIER]+")(?:\\.("+o[i.XRANGEIDENTIFIER]+")(?:\\.("+o[i.XRANGEIDENTIFIER]+")(?:"+o[i.PRERELEASE]+")?"+o[i.BUILD]+"?)?)?"),s("XRANGEPLAINLOOSE","[v=\\s]*("+o[i.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+o[i.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+o[i.XRANGEIDENTIFIERLOOSE]+")(?:"+o[i.PRERELEASELOOSE]+")?"+o[i.BUILD]+"?)?)?"),s("XRANGE","^"+o[i.GTLT]+"\\s*"+o[i.XRANGEPLAIN]+"$"),s("XRANGELOOSE","^"+o[i.GTLT]+"\\s*"+o[i.XRANGEPLAINLOOSE]+"$"),s("COERCE","(^|[^\\d])(\\d{1,"+r+"})(?:\\.(\\d{1,"+r+"}))?(?:\\.(\\d{1,"+r+"}))?(?:$|[^\\d])"),s("COERCERTL",o[i.COERCE],!0),s("LONETILDE","(?:~>?)"),s("TILDETRIM","(\\s*)"+o[i.LONETILDE]+"\\s+",!0),t.tildeTrimReplace="$1~",s("TILDE","^"+o[i.LONETILDE]+o[i.XRANGEPLAIN]+"$"),s("TILDELOOSE","^"+o[i.LONETILDE]+o[i.XRANGEPLAINLOOSE]+"$"),s("LONECARET","(?:\\^)"),s("CARETTRIM","(\\s*)"+o[i.LONECARET]+"\\s+",!0),t.caretTrimReplace="$1^",s("CARET","^"+o[i.LONECARET]+o[i.XRANGEPLAIN]+"$"),s("CARETLOOSE","^"+o[i.LONECARET]+o[i.XRANGEPLAINLOOSE]+"$"),s("COMPARATORLOOSE","^"+o[i.GTLT]+"\\s*("+o[i.LOOSEPLAIN]+")$|^$"),s("COMPARATOR","^"+o[i.GTLT]+"\\s*("+o[i.FULLPLAIN]+")$|^$"),s("COMPARATORTRIM","(\\s*)"+o[i.GTLT]+"\\s*("+o[i.LOOSEPLAIN]+"|"+o[i.XRANGEPLAIN]+")",!0),t.comparatorTrimReplace="$1$2$3",s("HYPHENRANGE","^\\s*("+o[i.XRANGEPLAIN]+")\\s+-\\s+("+o[i.XRANGEPLAIN]+")\\s*$"),s("HYPHENRANGELOOSE","^\\s*("+o[i.XRANGEPLAINLOOSE]+")\\s+-\\s+("+o[i.XRANGEPLAINLOOSE]+")\\s*$"),s("STAR","(<|>)?=?\\s*\\*"),s("GTE0","^\\s*>=\\s*0.0.0\\s*$"),s("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}(t,t.exports),t.exports}(),A=/^[0-9]+$/,O=I.MAX_LENGTH,S=I.MAX_SAFE_INTEGER,N=R.re,L=R.t,T=function(e,t){var r=A.test(e),n=A.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},M=function(){function e(t,r){if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>O)throw new TypeError("version is longer than "+O+" characters");w("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;var n=t.trim().match(r.loose?N[L.LOOSE]:N[L.FULL]);if(!n)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>S||this.major<0)throw new TypeError("Invalid major version");if(this.minor>S||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>S||this.patch<0)throw new TypeError("Invalid patch version");this.prerelease=n[4]?n[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<S)return t}return e}):[],this.build=n[5]?n[5].split("."):[],this.format()}var t=e.prototype;return t.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},t.toString=function(){return this.version},t.compare=function(t){if(w("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)},t.compareMain=function(t){return t instanceof e||(t=new e(t,this.options)),T(this.major,t.major)||T(this.minor,t.minor)||T(this.patch,t.patch)},t.comparePre=function(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;var r=0;do{var n=this.prerelease[r],o=t.prerelease[r];if(w("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return T(n,o)}while(++r)},t.compareBuild=function(t){t instanceof e||(t=new e(t,this.options));var r=0;do{var n=this.build[r],o=t.build[r];if(w("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return T(n,o)}while(++r)},t.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},e}(),P=function(e,t,r){return new M(e,r).compare(new M(t,r))},j=function(e,t,r,n){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return function(e,t,r){return 0===P(e,t,r)}(e,r,n);case"!=":return function(e,t,r){return 0!==P(e,t,r)}(e,r,n);case">":return function(e,t,r){return P(e,t,r)>0}(e,r,n);case">=":return function(e,t,r){return P(e,t,r)>=0}(e,r,n);case"<":return function(e,t,r){return P(e,t,r)<0}(e,r,n);case"<=":return function(e,t,r){return P(e,t,r)<=0}(e,r,n);default:throw new TypeError("Invalid operator: "+t)}},C=Symbol("SemVer ANY"),k=function(){function e(t,r){if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}w("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.value=this.semver===C?"":this.operator+this.semver.version,w("comp",this)}var r=e.prototype;return r.parse=function(e){var t=e.match(this.options.loose?D[x.COMPARATORLOOSE]:D[x.COMPARATOR]);if(!t)throw new TypeError("Invalid comparator: "+e);this.operator=void 0!==t[1]?t[1]:"","="===this.operator&&(this.operator=""),this.semver=t[2]?new M(t[2],this.options.loose):C},r.toString=function(){return this.value},r.test=function(e){if(w("Comparator.test",e,this.options.loose),this.semver===C||e===C)return!0;if("string"==typeof e)try{e=new M(e,this.options)}catch(e){return!1}return j(e,this.operator,this.semver,this.options)},r.intersects=function(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),""===this.operator)return""===this.value||new U(t.value,r).test(this.value);if(""===t.operator)return""===t.value||new U(this.value,r).test(t.semver);var n=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),o=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),i=this.semver.version===t.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=j(this.semver,"<",t.semver,r)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=j(this.semver,">",t.semver,r)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return n||o||i&&a||s||u},t(e,null,[{key:"ANY",get:function(){return C}}]),e}(),D=R.re,x=R.t,U=function(){function e(t,r){var n=this;if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof k)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map(function(e){return n.parseRange(e.trim())}).filter(function(e){return e.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}var t=e.prototype;return t.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range},t.toString=function(){return this.range},t.parseRange=function(e){var t=this,r=this.options.loose;e=(e=e.trim()).replace(r?F[G.HYPHENRANGELOOSE]:F[G.HYPHENRANGE],te(this.options.includePrerelease)),w("hyphen replace",e),e=e.replace(F[G.COMPARATORTRIM],B),w("comparator trim",e,F[G.COMPARATORTRIM]),e=(e=(e=e.replace(F[G.TILDETRIM],W)).replace(F[G.CARETTRIM],H)).split(/\s+/).join(" ");var n=r?F[G.COMPARATORLOOSE]:F[G.COMPARATOR];return e.split(" ").map(function(e){return K(e,t.options)}).join(" ").split(/\s+/).map(function(e){return ee(e,t.options)}).filter(this.options.loose?function(e){return!!e.match(n)}:function(){return!0}).map(function(e){return new k(e,t.options)})},t.intersects=function(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(function(e){return z(e,r)&&t.set.some(function(t){return z(t,r)&&e.every(function(e){return t.every(function(t){return e.intersects(t,r)})})})})},t.test=function(e){if(!e)return!1;if("string"==typeof e)try{e=new M(e,this.options)}catch(e){return!1}for(var t=0;t<this.set.length;t++)if(re(this.set[t],e,this.options))return!0;return!1},e}(),F=R.re,G=R.t,B=R.comparatorTrimReplace,W=R.tildeTrimReplace,H=R.caretTrimReplace,z=function(e,t){for(var r=!0,n=e.slice(),o=n.pop();r&&n.length;)r=n.every(function(e){return o.intersects(e,t)}),o=n.pop();return r},K=function(e,t){return w("comp",e,t),e=Y(e,t),w("caret",e),e=q(e,t),w("tildes",e),e=$(e,t),w("xrange",e),e=Z(e,t),w("stars",e),e},X=function(e){return!e||"x"===e.toLowerCase()||"*"===e},q=function(e,t){return e.trim().split(/\s+/).map(function(e){return V(e,t)}).join(" ")},V=function(e,t){return e.replace(t.loose?F[G.TILDELOOSE]:F[G.TILDE],function(t,r,n,o,i){var a;return w("tilde",e,t,r,n,o,i),X(r)?a="":X(n)?a=">="+r+".0.0 <"+(+r+1)+".0.0-0":X(o)?a=">="+r+"."+n+".0 <"+r+"."+(+n+1)+".0-0":i?(w("replaceTilde pr",i),a=">="+r+"."+n+"."+o+"-"+i+" <"+r+"."+(+n+1)+".0-0"):a=">="+r+"."+n+"."+o+" <"+r+"."+(+n+1)+".0-0",w("tilde return",a),a})},Y=function(e,t){return e.trim().split(/\s+/).map(function(e){return J(e,t)}).join(" ")},J=function(e,t){w("caret",e,t);var r=t.includePrerelease?"-0":"";return e.replace(t.loose?F[G.CARETLOOSE]:F[G.CARET],function(t,n,o,i,a){var s;return w("caret",e,t,n,o,i,a),X(n)?s="":X(o)?s=">="+n+".0.0"+r+" <"+(+n+1)+".0.0-0":X(i)?s="0"===n?">="+n+"."+o+".0"+r+" <"+n+"."+(+o+1)+".0-0":">="+n+"."+o+".0"+r+" <"+(+n+1)+".0.0-0":a?(w("replaceCaret pr",a),s="0"===n?"0"===o?">="+n+"."+o+"."+i+"-"+a+" <"+n+"."+o+"."+(+i+1)+"-0":">="+n+"."+o+"."+i+"-"+a+" <"+n+"."+(+o+1)+".0-0":">="+n+"."+o+"."+i+"-"+a+" <"+(+n+1)+".0.0-0"):(w("no pr"),s="0"===n?"0"===o?">="+n+"."+o+"."+i+r+" <"+n+"."+o+"."+(+i+1)+"-0":">="+n+"."+o+"."+i+r+" <"+n+"."+(+o+1)+".0-0":">="+n+"."+o+"."+i+" <"+(+n+1)+".0.0-0"),w("caret return",s),s})},$=function(e,t){return w("replaceXRanges",e,t),e.split(/\s+/).map(function(e){return Q(e,t)}).join(" ")},Q=function(e,t){return(e=e.trim()).replace(t.loose?F[G.XRANGELOOSE]:F[G.XRANGE],function(r,n,o,i,a,s){w("xRange",e,r,n,o,i,a,s);var u=X(o),c=u||X(i),f=c||X(a);return"="===n&&f&&(n=""),s=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(c&&(i=0),a=0,">"===n?(n=">=",c?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):"<="===n&&(n="<",c?o=+o+1:i=+i+1),"<"===n&&(s="-0"),r=n+o+"."+i+"."+a+s):c?r=">="+o+".0.0"+s+" <"+(+o+1)+".0.0-0":f&&(r=">="+o+"."+i+".0"+s+" <"+o+"."+(+i+1)+".0-0"),w("xRange return",r),r})},Z=function(e,t){return w("replaceStars",e,t),e.trim().replace(F[G.STAR],"")},ee=function(e,t){return w("replaceGTE0",e,t),e.trim().replace(F[t.includePrerelease?G.GTE0PRE:G.GTE0],"")},te=function(e){return function(t,r,n,o,i,a,s,u,c,f,l,h,d){return((r=X(n)?"":X(o)?">="+n+".0.0"+(e?"-0":""):X(i)?">="+n+"."+o+".0"+(e?"-0":""):a?">="+r:">="+r+(e?"-0":""))+" "+(u=X(c)?"":X(f)?"<"+(+c+1)+".0.0-0":X(l)?"<"+c+"."+(+f+1)+".0-0":h?"<="+c+"."+f+"."+l+"-"+h:e?"<"+c+"."+f+"."+(+l+1)+"-0":"<="+u)).trim()}},re=function(e,t,r){for(var n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(var o=0;o<e.length;o++)if(w(e[o].semver),e[o].semver!==k.ANY&&e[o].semver.prerelease.length>0){var i=e[o].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0},ne=I.MAX_LENGTH,oe=R.re,ie=R.t,ae=R.re,se=R.t;function ue(e){return String.fromCharCode(parseInt(e.slice(1),16))}function ce(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}function fe(e){return t=JSON.stringify(e),btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,ue));var t}function le(e){return JSON.parse(decodeURIComponent(Array.from(atob(e),ce).join("")))}function he(e){return void 0===e}function de(e){return function(e){return null===e}(e)||he(e)}function pe(e){if(!e)return!0;for(var t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var ve={},ye={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn"},me=function(e){function t(r,n){var o;return(o=e.call(this,"Magic SDK Error: ["+r+"] "+n)||this).code=void 0,o.rawMessage=void 0,o.__proto__=Error,o.code=r,o.rawMessage=n,Object.setPrototypeOf(c(o),t.prototype),o}return n(t,e),t}(u(Error)),ge=function(e){function t(r){var n;(n=e.call(this)||this).__proto__=Error,n.code=void 0,n.rawMessage=void 0;var o=Number(null==r?void 0:r.code);return n.rawMessage=(null==r?void 0:r.message)||"Internal error",n.code=function(e){return!de(e)&&"number"==typeof e&&Object.values(d).includes(e)}(o)?o:d.InternalError,n.message="Magic RPC Error: ["+n.code+"] "+n.rawMessage,Object.setPrototypeOf(c(n),t.prototype),n}return n(t,e),t}(u(Error)),Ee=function(){function e(e,t){this.code=void 0,this.rawMessage=void 0,this.message=void 0,this.code=e,this.rawMessage=t,this.message="Magic SDK Warning: ["+e+"] "+t}return e.prototype.log=function(){console.warn(this.message)},e}(),_e=function(e){function t(r,n,o,i){var a;return(a=e.call(this,"Magic Extension Error ("+r.name+"): ["+n+"] "+o)||this).code=void 0,a.rawMessage=void 0,a.data=void 0,a.__proto__=Error,a.code=n,a.rawMessage=o,a.data=i,Object.setPrototypeOf(c(a),t.prototype),a}return n(t,e),t}(u(Error)),be=function(){function e(e,t,r){this.code=void 0,this.rawMessage=void 0,this.message=void 0,this.code=t,this.rawMessage=r,this.message="Magic Extension Warning ("+e.name+"): ["+t+"] "+r}return e.prototype.log=function(){console.warn(this.message)},e}();function Ie(){return new me(l.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function we(){return new me(l.MalformedResponse,"Response from the Magic iframe is malformed.")}function Re(e){return new me(l.ExtensionNotInitialized,"Extensions must be initialized with a Magic SDK instance before `Extension."+e+"` can be accessed. Do not invoke `Extension."+e+"` inside an extension constructor.")}function Ae(e){var t="Some extensions are incompatible with `"+ve.sdkName+"@"+ve.version+"`:";return e.filter(function(e){return null!=e.compat}).forEach(function(e){var r=e.compat[ve.sdkName];"string"==typeof r?t+="\n - Extension `"+e.name+"` supports version(s) `"+r+"`":r||(t+="\n - Extension `"+e.name+"` does not support "+ve.platform+" environments.")}),new me(l.IncompatibleExtensions,t)}function Oe(e){return new me(l.InvalidArgument,"Invalid "+function(e){var t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?t+"st":2===r&&12!==n?t+"nd":3===r&&13!==n?t+"rd":t+"th"}(e.argument)+" argument given to `"+e.procedure+"`.\n Expected: `"+e.expected+"`\n Received: `"+e.received+"`")}var Se=regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<Number.MAX_SAFE_INTEGER)){e.next=6;break}return e.next=4,++t;case 4:e.next=7;break;case 6:t=0;case 7:e.next=1;break;case 9:case"end":return e.stop()}},e)})();function Ne(){return Se.next().value}var Le=Symbol("Payload pre-processed by Magic SDK");function Te(e){return Object.defineProperty(e,Le,{value:!0,enumerable:!1}),e}function Me(e){var t,r,n;return function(e){return!!e[Le]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=Ne(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],Te(e)),e}function Pe(e,t){return void 0===t&&(t=[]),Te({params:t,method:e,jsonrpc:"2.0",id:Ne()})}var je,Ce=function(){function e(t){this._jsonrpc=void 0,this._id=void 0,this._result=void 0,this._error=void 0,t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):function(e){return!de(e)&&!(he(e.jsonrpc)||he(e.id)||he(e.result)&&he(e.error))}(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=void 0,this._error=void 0)}var r=e.prototype;return r.applyError=function(e){return this._error=e,this},r.applyResult=function(e){return this._result=e,this},t(e,[{key:"hasError",get:function(){return null!=this._error}},{key:"hasResult",get:function(){return void 0!==this._result}},{key:"payload",get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}}]),e}(),ke=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(e,t,n,i,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,i||e,a),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=this._events[r?r+e:e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,o=t.length,i=new Array(o);n<o;n++)i[n]=t[n].fn;return i},s.prototype.listenerCount=function(e){var t=this._events[r?r+e:e];return t?t.fn?1:t.length:0},s.prototype.emit=function(e,t,n,o,i,a){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,f=this._events[s],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,n),!0;case 4:return f.fn.call(f.context,t,n,o),!0;case 5:return f.fn.call(f.context,t,n,o,i),!0;case 6:return f.fn.call(f.context,t,n,o,i,a),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];f.fn.apply(f.context,u)}else{var h,d=f.length;for(c=0;c<d;c++)switch(f[c].once&&this.removeListener(e,f[c].fn,void 0,!0),l){case 1:f[c].fn.call(f[c].context);break;case 2:f[c].fn.call(f[c].context,t);break;case 3:f[c].fn.call(f[c].context,t,n);break;case 4:f[c].fn.call(f[c].context,t,n,o);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];f[c].fn.apply(f[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return i(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return i(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,o){var i=r?r+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var s=this._events[i];if(s.fn)s.fn!==t||o&&!s.once||n&&s.context!==n||a(this,i);else{for(var u=0,c=[],f=s.length;u<f;u++)(s[u].fn!==t||o&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},s.prototype.removeAllListeners=function(e){var t;return e?this._events[t=r?r+e:e]&&a(this,t):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(je={exports:{}}),je.exports));function De(){var e=new ke;return{emitter:e,createChainingEmitterMethod:function(t,r){return function(){return e[t].apply(e,[].slice.call(arguments)),r}},createBoundEmitterMethod:function(t){return function(){return e[t].apply(e,[].slice.call(arguments))}}}}var xe=Symbol("isPromiEvent");function Ue(e){return!!e[xe]}function Fe(e){var t=Ge(e),r=De(),n=r.createBoundEmitterMethod,o=r.createChainingEmitterMethod,i=Symbol("Promise.then"),a=Symbol("Promise.catch"),s=Symbol("Promise.finally"),u=function(e,t){return function(){var r=t[e].apply(t,[].slice.call(arguments));return c(r)}},c=function(e){var t;return Object.assign(e,((t={})[xe]=!0,t[i]=e[i]||e.then,t[a]=e[a]||e.catch,t[s]=e[s]||e.finally,t.then=u(i,e),t.catch=u(a,e),t.finally=u(s,e),t.on=o("on",e),t.once=o("once",e),t.addListener=o("addListener",e),t.off=o("off",e),t.removeListener=o("removeListener",e),t.removeAllListeners=o("removeAllListeners",e),t.emit=n("emit"),t.eventNames=n("eventNames"),t.listeners=n("listeners"),t.listenerCount=n("listenerCount"),t))},f=c(t.then(function(e){return f.emit("done",e),f.emit("settled"),e},function(e){throw f.emit("error",e),f.emit("settled"),e}));return f}function Ge(e){return new Promise(function(t,r){var n=e(t,r);Promise.resolve(n).catch(r)})}var Be,We=function(){function e(e){this.sdk=void 0,this.sdk=e}return e.prototype.request=function(e){var t=this.overlay.post(y.MAGIC_HANDLE_REQUEST,Me(e)),r=Fe(function(e,r){t.then(function(t){if(n(),t.hasError)r(new ge(t.payload.error));else{if(!t.hasResult)throw we();e(t.payload.result)}}).catch(function(e){n(),r(e)})}),n=this.overlay.on(v.MAGIC_HANDLE_EVENT,function(t){var n,o=t.data.response;if(o.id===e.id&&null!=(n=o.result)&&n.event){var i=o.result,a=i.params;r.emit.apply(r,[i.event].concat(void 0===a?[]:a))}});return r},t(e,[{key:"overlay",get:function(){return this.sdk.overlay}}]),e}(),He=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.loginWithMagicLink=function(e){var t=e.showUI,r=Pe(this.sdk.testMode?p.LoginWithMagicLinkTestMode:p.LoginWithMagicLink,[{email:e.email,showUI:void 0===t||t,redirectURI:e.redirectURI}]);return this.request(r)},r.loginWithSMS=function(e){var t=Pe(this.sdk.testMode?p.LoginWithSmsTestMode:p.LoginWithSms,[{phoneNumber:e.phoneNumber,showUI:!0}]);return this.request(t)},r.loginWithCredential=function(e){var t=null!=e?e:"";if(!e&&"web"===ve.platform){t=window.location.search;var r=window.location.origin+window.location.pathname;window.history.replaceState(null,"",r)}var n=Pe(this.sdk.testMode?p.LoginWithCredentialTestMode:p.LoginWithCredential,[t]);return this.request(n)},t}(We);function ze(e){return function(){try{var t=arguments,r=function(r){return n||(Be=r),Promise.resolve(Be.ready()).then(function(){var r;return(r=Be)[e].apply(r,[].slice.call(t))})},n=Be;return Promise.resolve(n?r(n):Promise.resolve(ve.configureStorage()).then(r))}catch(e){return Promise.reject(e)}}}var Ke=ze("getItem"),Xe=ze("setItem"),qe=ze("removeItem"),Ve=ze("clear"),Ye=ze("length"),Je=ze("key"),$e=ze("keys"),Qe=ze("iterate"),Ze={__proto__:null,getItem:Ke,setItem:Xe,removeItem:qe,clear:Ve,length:Ye,key:Je,keys:$e,iterate:Qe};function et(){var e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;var t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),(t+=e[14].toString(16))+e[15].toString(16)}var tt={name:"ECDSA",namedCurve:"P-256"},rt={name:"ECDSA",namedCurve:"P-256"};function nt(e){return ot(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})}(e))}function ot(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var it=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.getIdToken=function(e){var t=Pe(this.sdk.testMode?p.GetIdTokenTestMode:p.GetIdToken,[e]);return this.request(t)},r.generateIdToken=function(e){var t=Pe(this.sdk.testMode?p.GenerateIdTokenTestMode:p.GenerateIdToken,[e]);return this.request(t)},r.getMetadata=function(){var e=Pe(this.sdk.testMode?p.GetMetadataTestMode:p.GetMetadata);return this.request(e)},r.updateEmail=function(e){var t=e.showUI,r=Pe(this.sdk.testMode?p.UpdateEmailTestMode:p.UpdateEmail,[{email:e.email,showUI:void 0===t||t}]);return this.request(r)},r.isLoggedIn=function(){var e=Pe(this.sdk.testMode?p.IsLoggedInTestMode:p.IsLoggedIn);return this.request(e)},r.logout=function(){qe("STORE_KEY_PUBLIC_JWK"),qe("STORE_KEY_PRIVATE_KEY");var e=Pe(this.sdk.testMode?p.LogoutTestMode:p.Logout);return this.request(e)},r.showSettings=function(){var e=Pe(this.sdk.testMode?p.UserSettingsTestMode:p.UserSettings);return this.request(e)},t}(We);function at(){return(at=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var st=De(),ut=st.createBoundEmitterMethod,ct=st.createChainingEmitterMethod,ft=function(e){function t(){var t;return(t=e.call.apply(e,[this].concat([].slice.call(arguments)))||this).isMagic=!0,t.on=ct("on",c(t)),t.once=ct("once",c(t)),t.addListener=ct("addListener",c(t)),t.off=ct("off",c(t)),t.removeListener=ct("removeListener",c(t)),t.removeAllListeners=ct("removeAllListeners",c(t)),t.emit=ut("emit"),t.eventNames=ut("eventNames"),t.listeners=ut("listeners"),t.listenerCount=ut("listenerCount"),t}n(t,e);var r=t.prototype;return r.sendAsync=function(e,t){var r=this;if(!t)throw Oe({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(y.MAGIC_HANDLE_REQUEST,e.map(function(e){var t=Me(e);return r.prefixPayloadMethodForTestMode(t),t})).then(function(e){t(null,e.map(function(e){return at({},e.payload,{error:e.hasError?new ge(e.payload.error):null})}))});else{var n=Me(e);this.prefixPayloadMethodForTestMode(n),this.overlay.post(y.MAGIC_HANDLE_REQUEST,n).then(function(e){t(e.hasError?new ge(e.payload.error):null,e.payload)})}},r.send=function(e,t){if("string"==typeof e){var r=Pe(e,Array.isArray(t)?t:[]);return this.request(r)}if(!Array.isArray(e)&&!t){var n=new Ee(h.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return n.log(),new Ce(e).applyError({code:-32603,message:n.rawMessage}).payload}this.sendAsync(e,t)},r.enable=function(){var e=Pe("eth_accounts");return this.request(e)},r.request=function(t){return this.prefixPayloadMethodForTestMode(t),e.prototype.request.call(this,t)},r.prefixPayloadMethodForTestMode=function(e){this.sdk.testMode&&(e.method="testMode/eth/"+e.method)},t}(We);function lt(e,t){return t?new URL(e,t):new URL(e)}var ht=["request","overlay","sdk"],dt=function(e){function t(){var t;(t=e.call(this,void 0)||this).__sdk_access_field_descriptors__=new Map,t.__is_initialized__=!1,t.utils={createPromiEvent:Fe,isPromiEvent:Ue,encodeJSON:fe,decodeJSON:le,createJsonRpcRequestPayload:Pe,standardizeJsonRpcRequestPayload:Me,storage:Ze};var r=[c(t)].concat(function(e){for(var t=Object.getPrototypeOf(e),r=[t];t!==We.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}(c(t)));return ht.forEach(function(e){var n=r.map(function(t){return Object.getOwnPropertyDescriptor(t,e)}),o=n.findIndex(function(e){return!!e}),i=n[o];i&&(t.__sdk_access_field_descriptors__.set(e,{descriptor:i,isPrototypeField:o>0}),Object.defineProperty(c(t),e,{configurable:!0,get:function(){throw Re(e)}}))}),t}n(t,e);var r=t.prototype;return r.init=function(e){var t=this;this.__is_initialized__||(ht.forEach(function(e){if(t.__sdk_access_field_descriptors__.has(e)){var r=t.__sdk_access_field_descriptors__.get(e),n=r.descriptor;r.isPrototypeField?delete t[e]:Object.defineProperty(t,e,n)}}),this.sdk=e,this.__is_initialized__=!0)},r.createDeprecationWarning=function(e){var t=e.useInstead;return new be(this,"DEPRECATION_NOTICE","`"+e.method+"` will be removed from this Extension in version `"+e.removalVersion+"`."+(t?" Use `"+t+"` instead.":""))},r.createWarning=function(e,t){return new be(this,e,t)},r.createError=function(e,t,r){return new _e(this,e,t,r)},t}(We),pt=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(dt);function vt(e){return!e.compat||null==e.compat[ve.sdkName]||("string"==typeof e.compat[ve.sdkName]?function(e,t,r){try{t=new U(t,void 0)}catch(e){return!1}return t.test(e)}(function(e,t){if(e instanceof M)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;var r=null;if((t=t||{}).rtl){for(var n;(n=ae[se.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&n.index+n[0].length===r.index+r[0].length||(r=n),ae[se.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;ae[se.COERCERTL].lastIndex=-1}else r=e.match(ae[se.COERCE]);return null===r?null:function(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof M)return e;if("string"!=typeof e)return null;if(e.length>ne)return null;if(!(t.loose?oe[ie.LOOSE]:oe[ie.FULL]).test(e))return null;try{return new M(e,t)}catch(e){return null}}(r[2]+"."+(r[3]||"0")+"."+(r[4]||"0"),t)}(ve.version),e.compat[ve.sdkName]):!!e.compat[ve.sdkName])}function yt(e){var t,r=this,n=null!=(t=null==e?void 0:e.extensions)?t:[],o={},i=[];if(Array.isArray(n)?n.forEach(function(e){vt(e)?(e.init(r),(e.name||e.name!==pt.Anonymous)&&(r[e.name]=e),e instanceof pt.Internal&&(pe(e.config)||(o[e.name]=e.config))):i.push(e)}):Object.keys(n).forEach(function(e){if(vt(n[e])){n[e].init(r);var t=n[e];r[e]=t,t instanceof pt.Internal&&(pe(t.config)||(o[n[e].name]=t.config))}else i.push(n[e])}),i.length)throw Ae(i);return o}pt.Internal=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(dt),pt.Anonymous="anonymous extension";var mt=function(){function e(e,t){var r;if(this.apiKey=void 0,this.endpoint=void 0,this.parameters=void 0,this.testMode=void 0,this.auth=void 0,this.user=void 0,this.rpcProvider=void 0,this.apiKey=e,!e)throw Ie();"react-native"===ve.platform&&null!=t&&t.endpoint&&new Ee(h.ReactNativeEndpointConfiguration,"CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The `endpoint` parameter SHOULD NOT be provided. The Magic `<iframe>` is automatically wrapped by a WebView pointed at `"+ve.defaultEndpoint+"`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.").log();var n=ve.defaultEndpoint,o=ve.version;this.testMode=!(null==t||!t.testMode),this.endpoint=lt(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new He(this),this.user=new it(this),this.rpcProvider=new ft(this);var i=yt.call(this,t);this.parameters=fe({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:lt(this.endpoint).host,sdk:ye[ve.sdkName],version:o,ext:pe(i)?void 0:i,locale:(null==t?void 0:t.locale)||"en_US"})}return e.prototype.preload=function(){try{return Promise.resolve(this.overlay.ready).then(function(){})}catch(e){return Promise.reject(e)}},t(e,[{key:"overlay",get:function(){if(!e.__overlays__.has(this.parameters)){var t=new ve.ViewController(this.endpoint,this.parameters);t.init(),e.__overlays__.set(this.parameters,t)}return e.__overlays__.get(this.parameters)}}]),e}();mt.__overlays__=new Map;var gt=function(){function e(e,t){this.endpoint=void 0,this.parameters=void 0,this.ready=void 0,this.messageHandlers=new Set,this.endpoint=e,this.parameters=t,this.ready=this.waitForReady(),this.listen()}var t=e.prototype;return t.post=function(e,t){try{var r=this;return Promise.resolve(Ge(function(n){try{var o;return Promise.resolve(r.ready).then(function(){var i=[],a=Array.isArray(t)?t.map(function(e){return e.id}):[];return Promise.resolve(function(e,t){try{return Promise.resolve(Ke("rt")).then(function(r){function n(){return o?r?{msgType:e,payload:t,jwt:o,rt:r}:{msgType:e,payload:t,jwt:o}:{msgType:e,payload:t}}var o,i=function(){if("web"===ve.platform){var e=function(e,t){try{var r=Promise.resolve(function(){try{var e;return Promise.resolve(function(){try{var e,t=function(t){if(e)return t;console.info("webcrypto is not supported")},r=function(){if(function(){var e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return e=1,Promise.resolve(Ke("STORE_KEY_PUBLIC_JWK")).then(function(e){function t(e){return Ke("STORE_KEY_PUBLIC_JWK")}return e?t():Promise.resolve(function(){try{var e=null,t=window.crypto.subtle;return Promise.resolve(t.generateKey(tt,!0,["sign"])).then(function(r){return Promise.resolve(t.exportKey("jwk",r.privateKey)).then(function(n){return Promise.resolve(t.exportKey("jwk",r.publicKey)).then(function(r){return e=r,Promise.resolve(t.importKey("jwk",n,rt,!1,["sign"])).then(function(t){return Promise.resolve(Xe("STORE_KEY_PRIVATE_KEY",t)).then(function(){return Promise.resolve(Xe("STORE_KEY_PUBLIC_JWK",e)).then(function(e){})})})})})})}catch(e){return Promise.reject(e)}}()).then(t)})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(t){if(t){var r=window.crypto.subtle;return Promise.resolve(Ke("STORE_KEY_PRIVATE_KEY")).then(function(n){if(n&&r){var o={iat:Math.floor((new Date).getTime()/1e3),jti:et()},i=nt(JSON.stringify({typ:"dpop+jwt",alg:"ES256",jwk:t})),a=nt(JSON.stringify(o)),s=(e=i+"."+a,(new TextEncoder).encode(e));return Promise.resolve(r.sign({name:"ECDSA",hash:{name:"SHA-256"}},n,s)).then(function(e){return i+"."+a+"."+function(e){var t="";return e.forEach(function(e){t+=String.fromCharCode(e)}),ot(t)}(new Uint8Array(e))})}console.info("unable to find private key or webcrypto unsupported")})}console.info("unable to create public key or webcrypto is unsupported")})}catch(e){return Promise.reject(e)}}()).then(function(e){o=e})}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}(0,function(e){console.error("webcrypto error",e)});if(e&&e.then)return e.then(function(){})}}();return i&&i.then?i.then(n):n()})}catch(e){return Promise.reject(e)}}(e+"-"+r.parameters,t)).then(function(e){return Promise.resolve(r._post(e)).then(function(){var e=r.on(v.MAGIC_HANDLE_RESPONSE,(o=function(){return e()},function(e){var r=function(e,t){var r,n=null==(r=t.data.response)?void 0:r.id,o=function(e,t){return t&&Array.isArray(e)?e.find(function(e){return e.id===t}):e}(e,n);return n&&o?{id:n,response:new Ce(o).applyResult(t.data.response.result).applyError(t.data.response.error)}:{}}(t,e),s=r.id,u=r.response;!function(e){try{Promise.resolve(e.data.rt?Promise.resolve(Xe("rt",e.data.rt)).then(function(e){}):void 0)}catch(e){return Promise.reject(e)}}(e),s&&u&&Array.isArray(t)&&a.includes(s)?(i.push(u),i.length===t.length&&(o(),n(i))):s&&u&&!Array.isArray(t)&&s===t.id&&(o(),n(u))}))})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},t.on=function(e,t){var r=this,n=t.bind(window),o=function(t){t.data.msgType===e+"-"+r.parameters&&n(t)};return this.messageHandlers.add(o),function(){return r.messageHandlers.delete(o)}},t.waitForReady=function(){var e=this;return new Promise(function(t){e.on(v.MAGIC_OVERLAY_READY,function(){return t()})})},t.listen=function(){var e=this;this.on(v.MAGIC_HIDE_OVERLAY,function(){e.hideOverlay()}),this.on(v.MAGIC_SHOW_OVERLAY,function(){e.showOverlay()})},e}(),Et={__proto__:null,Extension:pt,ExtensionError:_e,ExtensionWarning:be,RPCError:ge,SDKError:me,SDKWarning:Ee,isPromiEvent:Ue,get EthChainType(){return m},get MagicIncomingWindowMessage(){return v},get MagicOutgoingWindowMessage(){return y},get MagicPayloadMethod(){return p},get RPCErrorCode(){return d},get SDKErrorCode(){return l},get SDKWarningCode(){return h}},_t=_(function(e,t){e.exports=function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){if(!s&&b)return b(a);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){return o(t[a][1][e]||e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var i=b,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){(function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(f),s=e.document.createTextNode("");a.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var u=new e.MessageChannel;u.port1.onmessage=f,r=function(){u.port2.postMessage(0)}}var c=[];function f(){var e,t;n=!0;for(var r=c.length;r;){for(t=c,c=[],e=-1;++e<r;)t[e]();r=c.length}n=!1}t.exports=function(e){1!==c.push(e)||n||r()}}).call(this,void 0!==g?g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],u=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=p(function(){t(o,n)});"error"===a.status&&n(a.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==u?l(r,this.state===s?e:t,this.outcome):this.queue.push(new f(r,e,t)),r},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=p(h,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)d(e,n);else{e.state=s,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},c.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},c.reject=function(e){var t=new this(o);return i.reject(t,e)},c.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),s=0,u=-1,c=new this(o);++u<r;)f(e[u],u);return c;function f(e,o){t.resolve(e).then(function(e){a[o]=e,++s!==r||n||(n=!0,i.resolve(c,a))},function(e){n||(n=!0,i.reject(c,e))})}},c.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n=-1,a=new this(o);++n<t;)this.resolve(e[n]).then(function(e){r||(r=!0,i.resolve(a,e))},function(e){r||(r=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==g?g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},p=Object.prototype.toString,v="readonly",y="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function g(e){var t=d[e.name],r={};r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function E(e){var t=d[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=d[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function b(e,t){return new a(function(r,n){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);g(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),E(e)}})}function I(e){return b(e,!1)}function w(e){return b(e,!0)}function R(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version>e.db.version;if(e.version<e.db.version&&(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),n||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function A(e){return i([m(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function S(e){var t=this,r=t._initReady().then(function(){var e=d[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return u(r,e,e),r}function N(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),w(e)}).then(function(){return function(e){g(e);for(var t=d[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,R(e)?w(e):t}).then(function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){N(e,t,r,n-1)})}).catch(r);r(o)}}var L={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=d[r.name];o||(d[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=S);var i=[];function s(){return a.resolve()}for(var u=0;u<o.forages.length;u++){var c=o.forages[u];c!==t&&i.push(c._initReady().catch(s))}var f=o.forages.slice(0);return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,R(r,t._defaultConfig.version)?w(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<f.length;n++){var i=f[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){N(r._dbInfo,v,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),s=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;O(n)&&(n=A(n));var o=e(n,r.key,s++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){N(r._dbInfo,v,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),O(e)&&(e=A(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var o=new a(function(r,o){var s;n.ready().then(function(){return s=n._dbInfo,"[object Blob]"===p.call(t)?function(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var r=e.transaction(l,y),n=i([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return h=e})}(s.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)}));var r}):t}).then(function(t){N(n._dbInfo,y,function(i,a){if(i)return o(i);try{var s=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var u=s.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){o(u.error?u.error:u.transaction.error)}}catch(e){o(e)}})}).catch(o)});return s(o,r),o},removeItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){N(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){n(a.error?a.error:a.transaction.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){N(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){r(i.error?i.error:i.transaction.error)}}catch(e){r(e)}})}).catch(r)});return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){N(t._dbInfo,v,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){N(r._dbInfo,v,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),s=!1,u=a.openKeyCursor();u.onsuccess=function(){var r=u.result;r?0===e||s?t(r.key):(s=!0,r.advance(e)):t(null)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){N(t._dbInfo,v,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var u=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var r=d[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;g(e);var n=d[e.name],i=n.forages;t.close();for(var s=0;s<i.length;s++){var u=i[s];u._dbInfo.db=null,u._dbInfo.version=r}return new a(function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,E(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){g(e);var r=d[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return new a(function(t,r){var n=o.deleteDatabase(e.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<n.length;t++)E(n[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return s(n,t),n}},T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",j=P.length,C="arbf",k="blob",D="si08",x="ui08",U="uic8",F="si16",G="si32",B="ur16",W="ui32",H="fl32",z="fl64",K=j+C.length,X=Object.prototype.toString;function q(e){var t,r,n,o,i,a=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var c=new ArrayBuffer(a),f=new Uint8Array(c);for(t=0;t<s;t+=4)r=T.indexOf(e[t]),n=T.indexOf(e[t+1]),o=T.indexOf(e[t+2]),i=T.indexOf(e[t+3]),f[u++]=r<<2|n>>4,f[u++]=(15&n)<<4|o>>2,f[u++]=(3&o)<<6|63&i;return c}function V(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=T[r[t]>>2],n+=T[(3&r[t])<<4|r[t+1]>>4],n+=T[(15&r[t+1])<<2|r[t+2]>>6],n+=T[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var Y={serialize:function(e,t){var r="";if(e&&(r=X.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===X.call(e.buffer))){var n,o=P;e instanceof ArrayBuffer?(n=e,o+=C):(n=e.buffer,"[object Int8Array]"===r?o+=D:"[object Uint8Array]"===r?o+=x:"[object Uint8ClampedArray]"===r?o+=U:"[object Int16Array]"===r?o+=F:"[object Uint16Array]"===r?o+=B:"[object Int32Array]"===r?o+=G:"[object Uint32Array]"===r?o+=W:"[object Float32Array]"===r?o+=H:"[object Float64Array]"===r?o+=z:t(new Error("Failed to get type for BinaryArray"))),t(o+V(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+V(this.result);t("__lfsc__:blob"+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,j)!==P)return JSON.parse(e);var t,r=e.substring(K),n=e.substring(j,K);if(n===k&&M.test(r)){var o=r.match(M);t=o[1],r=r.substring(o[0].length)}var a=q(r);switch(n){case C:return a;case k:return i([a],{type:t});case D:return new Int8Array(a);case x:return new Uint8Array(a);case U:return new Uint8ClampedArray(a);case F:return new Int16Array(a);case B:return new Uint16Array(a);case G:return new Int32Array(a);case W:return new Uint32Array(a);case H:return new Float32Array(a);case z:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:q,bufferToString:V};function J(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function $(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,s){s.rows.length?i(e,a):J(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}function Q(e,t,r,n){var o=this;e=c(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var s=t,u=o._dbInfo;u.serializer.serialize(t,function(t,c){c?a(c):u.db.transaction(function(r){$(r,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(s)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Q.apply(o,[e,s,r,n-1]));a(t)}})})}).catch(a)});return s(i,r),i}function Z(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){J(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)});return r.serializer=Y,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,s=0;s<a;s++){var u=i.item(s),c=u.value;if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,u.key,s+1)))return void t(c)}t()},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},setItem:function(e,t,r){return Q.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){$(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){$(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){$(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key);e(n)},function(e,t){r(t)})})}).catch(r)});return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,o=this;return s(n=e.name?new a(function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:Z(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],s=0,u=e.storeNames.length;s<u;s++)i.push(o(e.storeNames[s]));a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}};function te(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=Y,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,s=0;s<i;s++){var u=localStorage.key(s);if(0===u.indexOf(n)){var c=localStorage.getItem(u);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,u.substring(o),a++)))return c}}});return s(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return s(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var o=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new a(function(o,i){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return s(o,r),o},removeItem:function(e,t){var r=this;e=c(e);var n=r.ready().then(function(){localStorage.removeItem(r._dbInfo.keyPrefix+e)});return s(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return s(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return s(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n});return s(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this;return s(n=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},oe=function(e,t){for(var r=e.length,n=0;n<r;){if(ne(e[n],t))return!0;n++}return!1},ie=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ae={},se={},ue={INDEXEDDB:L,WEBSQL:ee,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],le=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),he={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function pe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=ie(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=new(function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(r)){var n=ue[r],o=n._driver;this[r]=o,ae[o]||this.defineDriver(n)}this._defaultConfig=pe({},he),this._config=pe({},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(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=le.concat("_initStorage"),u=0,c=i.length;u<c;u++){var f=i[u];if((!oe(fe,f)||e[f])&&"function"!=typeof e[f])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return s(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var l=function(r){ae[n]&&console.info("Redefining LocalForage driver: "+n),ae[n]=e,se[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}});return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ae[e]?a.resolve(ae[e]):a.reject(new Error("Driver not found."));return u(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(Y);return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ie(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function s(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=c.then(function(){var e=o[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var o=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(s).catch(r)}i();var u=new Error("No available storage method found.");return n._driverSet=a.reject(u),n._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet}),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!se[e]},e.prototype._extend=function(e){pe(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=le.length;e<t;e++)de(this,le[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}),bt=E(_(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,r="__lfsc__:".length,n=r+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),o=new Uint8Array(n),i=0,a=0;i<r;i+=4){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=s<<2|u>>4,o[a++]=(15&u)<<4|c>>2,o[a++]=(3&c)<<6|63&f}return n}function a(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];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 s(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=s(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}function u(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function c(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function f(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var r=this;if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?u(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function h(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var d={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var o,a=e.substring(n),s=e.substring(r,n);if("blob"===s&&t.test(a)){var u=a.match(t);o=u[1],a=a.substring(u[0].length)}var c=i(a);switch(s){case"arbf":return c;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([c],{type:o});case"si08":return new Int8Array(c);case"ui08":return new Uint8Array(c);case"uic8":return new Uint8ClampedArray(c);case"si16":return new Int16Array(c);case"ur16":return new Uint16Array(c);case"si32":return new Int32Array(c);case"ui32":return new Uint32Array(c);case"fl32":return new Float32Array(c);case"fl64":return new Float64Array(c);default:throw new Error("Unkown type: "+s)}},serialize:function(e,t){var r="";if(e&&(r=o.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var n=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(n=e,i+="arbf"):(n=e.buffer,"[object Int8Array]"===r?i+="si08":"[object Uint8Array]"===r?i+="ui08":"[object Uint8ClampedArray]"===r?i+="uic8":"[object Int16Array]"===r?i+="si16":"[object Uint16Array]"===r?i+="ur16":"[object Int32Array]"===r?i+="si32":"[object Uint32Array]"===r?i+="ui32":"[object Float32Array]"===r?i+="fl32":"[object Float64Array]"===r?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(n))}else if("[object Blob]"===r){var s=new FileReader;s.onload=function(){var r="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+r)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:i},p={},v=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return p[t]||(p[t]=new e(t)),p[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete p[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?s(e):{},r=u(t,this._defaultConfig),n=v.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=d,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return c(r,e),r},e.dropInstance=function(e,t){var r=l.apply(this,arguments),n=r.promise,o=r.callback;return c(n.then(function(e){v.resolve(e).drop()}),o),n},e.getItem=function(e,t){var r=this;e=h(e);var n=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return c(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then(function(){for(var t=r._dbInfo.mStore,n=t.keys(),o=0;o<n.length;o++){var i=t.get(n[o]);if(i&&(i=r._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,n[o],o+1)))return i}});return c(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then(function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return c(n,t),n},e.keys=function(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return c(r,e),r},e.length=function(e){var t=this.keys().then(function(e){return e.length});return c(t,e),t},e.removeItem=function(e,t){var r=this;e=h(e);var n=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return c(n,t),n},e.setItem=function(e,t,r){var n=this;e=h(e);var o=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(o,i){n._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{n._dbInfo.mStore.set(e,t),o(r)}catch(e){i(e)}})})});return c(o,r),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)})),It={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},wt=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).iframe=void 0,t.activeElement=null,t}n(t,e);var r=t.prototype;return r.init=function(){var e=this;this.test="hello",this.iframe=new Promise(function(t){var r=function(){if(n=encodeURIComponent(e.parameters),o=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(o.find(function(e){return e.src.includes(n)})))new Ee(h.DuplicateIframe,"Duplicate iframes found.").log();else{var r=document.createElement("iframe");r.classList.add("magic-iframe"),r.dataset.magicIframeLabel=lt(e.endpoint).host,r.title="Secure Modal",r.src=lt("/send?params="+encodeURIComponent(e.parameters),e.endpoint).href,function(e){for(var t=0,r=Object.entries(It);t<r.length;t++){var n=r[t];e.style[n[0]]=n[1]}}(r),document.body.appendChild(r),t(r)}var n,o};["loaded","interactive","complete"].includes(document.readyState)?r():window.addEventListener("load",r,!1)}),window.addEventListener("message",function(t){if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){var r;t.data.response=null!=(r=t.data.response)?r:{};for(var n,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.messageHandlers.values());!(n=o()).done;)(0,n.value)(t)}})},r.showOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){t.style.display="block",e.activeElement=document.activeElement,t.focus()})}catch(e){return Promise.reject(e)}},r.hideOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){var r;t.style.display="none",null!==(r=e.activeElement)&&void 0!==r&&r.focus&&e.activeElement.focus(),e.activeElement=null})}catch(e){return Promise.reject(e)}},r._post=function(e){try{var t=this;return Promise.resolve(t.iframe).then(function(r){if(!r||!r.contentWindow)throw new me(l.ModalNotReady,"Modal is not ready.");r.contentWindow.postMessage(e,t.endpoint)})}catch(e){return Promise.reject(e)}},t}(gt);return Object.assign(function(e,t){return Object.assign(ve,t),e}(mt,{platform:"web",sdkName:"magic-sdk",version:"6.2.0",defaultEndpoint:"https://auth.magic.link/",ViewController:wt,configureStorage:function(){try{var e=_t.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return Promise.resolve(e.defineDriver(bt)).then(function(){return Promise.resolve(e.setDriver([_t.INDEXEDDB,_t.LOCALSTORAGE,bt._driver])).then(function(){return e})})}catch(e){return Promise.reject(e)}}}),r({},Et))}();
|
|
1
|
+
var Magic=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function s(e,t,r){return(s=a()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,o(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var l,h,d,p,v,y,m,g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _(e){var t={exports:{}};return e(t,t.exports),t.exports}function b(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}_(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof v?t:v).prototype),i=new S(n||[]);return o._invoke=function(e,t,r){var n=f;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=R(a,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=c(e,t,r);if("normal"===u.type){if(n=r.done?d:l,u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(e,r,i),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f="suspendedStart",l="suspendedYield",h="executing",d="completed",p={};function v(){}function y(){}function m(){}var g={};g[i]=function(){return this};var E=Object.getPrototypeOf,_=E&&E(E(N([])));_&&_!==r&&n.call(_,i)&&(g=_);var b=m.prototype=v.prototype=Object.create(g);function I(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function w(e,t){function r(o,i,a,s){var u=c(e[o],e,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then(function(e){r("next",e,a,s)},function(e){r("throw",e,a,s)}):t.resolve(l).then(function(e){f.value=e,a(f)},function(e){return r("throw",e,a,s)})}s(u.arg)}var o;this._invoke=function(e,n){function i(){return new t(function(t,o){r(e,n,t,o)})}return o=o?o.then(i,i):i()}}function R(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method))return p;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var o=c(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function N(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:L}}function L(){return{value:t,done:!0}}return y.prototype=b.constructor=m,m.constructor=y,m[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},I(w.prototype),w.prototype[a]=function(){return this},e.AsyncIterator=w,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},I(b),b[s]="Generator",b[i]=function(){return this},b.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=N,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),p}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}),function(e){e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS"}(l||(l={})),function(e){e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE"}(h||(h={})),function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser"}(d||(d={})),function(e){e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode"}(p||(p={})),function(e){e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT"}(v||(v={})),function(e){e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST"}(y||(y={})),function(e){e.Harmony="HARMONY"}(m||(m={}));var I={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},w="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){var e;return(e=console).error.apply(e,["SEMVER"].concat([].slice.call(arguments)))}:function(){},R=function(e){var t={exports:{}};return function(e,t){var r=I.MAX_SAFE_COMPONENT_LENGTH,n=(t=e.exports={}).re=[],o=t.src=[],i=t.t={},a=0,s=function(e,t,r){var s=a++;w(s,t),i[e]=s,o[s]=t,n[s]=new RegExp(t,r?"g":void 0)};s("NUMERICIDENTIFIER","0|[1-9]\\d*"),s("NUMERICIDENTIFIERLOOSE","[0-9]+"),s("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),s("MAINVERSION","("+o[i.NUMERICIDENTIFIER]+")\\.("+o[i.NUMERICIDENTIFIER]+")\\.("+o[i.NUMERICIDENTIFIER]+")"),s("MAINVERSIONLOOSE","("+o[i.NUMERICIDENTIFIERLOOSE]+")\\.("+o[i.NUMERICIDENTIFIERLOOSE]+")\\.("+o[i.NUMERICIDENTIFIERLOOSE]+")"),s("PRERELEASEIDENTIFIER","(?:"+o[i.NUMERICIDENTIFIER]+"|"+o[i.NONNUMERICIDENTIFIER]+")"),s("PRERELEASEIDENTIFIERLOOSE","(?:"+o[i.NUMERICIDENTIFIERLOOSE]+"|"+o[i.NONNUMERICIDENTIFIER]+")"),s("PRERELEASE","(?:-("+o[i.PRERELEASEIDENTIFIER]+"(?:\\."+o[i.PRERELEASEIDENTIFIER]+")*))"),s("PRERELEASELOOSE","(?:-?("+o[i.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+o[i.PRERELEASEIDENTIFIERLOOSE]+")*))"),s("BUILDIDENTIFIER","[0-9A-Za-z-]+"),s("BUILD","(?:\\+("+o[i.BUILDIDENTIFIER]+"(?:\\."+o[i.BUILDIDENTIFIER]+")*))"),s("FULLPLAIN","v?"+o[i.MAINVERSION]+o[i.PRERELEASE]+"?"+o[i.BUILD]+"?"),s("FULL","^"+o[i.FULLPLAIN]+"$"),s("LOOSEPLAIN","[v=\\s]*"+o[i.MAINVERSIONLOOSE]+o[i.PRERELEASELOOSE]+"?"+o[i.BUILD]+"?"),s("LOOSE","^"+o[i.LOOSEPLAIN]+"$"),s("GTLT","((?:<|>)?=?)"),s("XRANGEIDENTIFIERLOOSE",o[i.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*"),s("XRANGEIDENTIFIER",o[i.NUMERICIDENTIFIER]+"|x|X|\\*"),s("XRANGEPLAIN","[v=\\s]*("+o[i.XRANGEIDENTIFIER]+")(?:\\.("+o[i.XRANGEIDENTIFIER]+")(?:\\.("+o[i.XRANGEIDENTIFIER]+")(?:"+o[i.PRERELEASE]+")?"+o[i.BUILD]+"?)?)?"),s("XRANGEPLAINLOOSE","[v=\\s]*("+o[i.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+o[i.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+o[i.XRANGEIDENTIFIERLOOSE]+")(?:"+o[i.PRERELEASELOOSE]+")?"+o[i.BUILD]+"?)?)?"),s("XRANGE","^"+o[i.GTLT]+"\\s*"+o[i.XRANGEPLAIN]+"$"),s("XRANGELOOSE","^"+o[i.GTLT]+"\\s*"+o[i.XRANGEPLAINLOOSE]+"$"),s("COERCE","(^|[^\\d])(\\d{1,"+r+"})(?:\\.(\\d{1,"+r+"}))?(?:\\.(\\d{1,"+r+"}))?(?:$|[^\\d])"),s("COERCERTL",o[i.COERCE],!0),s("LONETILDE","(?:~>?)"),s("TILDETRIM","(\\s*)"+o[i.LONETILDE]+"\\s+",!0),t.tildeTrimReplace="$1~",s("TILDE","^"+o[i.LONETILDE]+o[i.XRANGEPLAIN]+"$"),s("TILDELOOSE","^"+o[i.LONETILDE]+o[i.XRANGEPLAINLOOSE]+"$"),s("LONECARET","(?:\\^)"),s("CARETTRIM","(\\s*)"+o[i.LONECARET]+"\\s+",!0),t.caretTrimReplace="$1^",s("CARET","^"+o[i.LONECARET]+o[i.XRANGEPLAIN]+"$"),s("CARETLOOSE","^"+o[i.LONECARET]+o[i.XRANGEPLAINLOOSE]+"$"),s("COMPARATORLOOSE","^"+o[i.GTLT]+"\\s*("+o[i.LOOSEPLAIN]+")$|^$"),s("COMPARATOR","^"+o[i.GTLT]+"\\s*("+o[i.FULLPLAIN]+")$|^$"),s("COMPARATORTRIM","(\\s*)"+o[i.GTLT]+"\\s*("+o[i.LOOSEPLAIN]+"|"+o[i.XRANGEPLAIN]+")",!0),t.comparatorTrimReplace="$1$2$3",s("HYPHENRANGE","^\\s*("+o[i.XRANGEPLAIN]+")\\s+-\\s+("+o[i.XRANGEPLAIN]+")\\s*$"),s("HYPHENRANGELOOSE","^\\s*("+o[i.XRANGEPLAINLOOSE]+")\\s+-\\s+("+o[i.XRANGEPLAINLOOSE]+")\\s*$"),s("STAR","(<|>)?=?\\s*\\*"),s("GTE0","^\\s*>=\\s*0.0.0\\s*$"),s("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}(t,t.exports),t.exports}(),A=/^[0-9]+$/,O=I.MAX_LENGTH,S=I.MAX_SAFE_INTEGER,N=R.re,L=R.t,T=function(e,t){var r=A.test(e),n=A.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},M=function(){function e(t,r){if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>O)throw new TypeError("version is longer than "+O+" characters");w("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;var n=t.trim().match(r.loose?N[L.LOOSE]:N[L.FULL]);if(!n)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>S||this.major<0)throw new TypeError("Invalid major version");if(this.minor>S||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>S||this.patch<0)throw new TypeError("Invalid patch version");this.prerelease=n[4]?n[4].split(".").map(function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<S)return t}return e}):[],this.build=n[5]?n[5].split("."):[],this.format()}var t=e.prototype;return t.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},t.toString=function(){return this.version},t.compare=function(t){if(w("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)},t.compareMain=function(t){return t instanceof e||(t=new e(t,this.options)),T(this.major,t.major)||T(this.minor,t.minor)||T(this.patch,t.patch)},t.comparePre=function(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;var r=0;do{var n=this.prerelease[r],o=t.prerelease[r];if(w("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return T(n,o)}while(++r)},t.compareBuild=function(t){t instanceof e||(t=new e(t,this.options));var r=0;do{var n=this.build[r],o=t.build[r];if(w("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return T(n,o)}while(++r)},t.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var r=this.prerelease.length;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);-1===r&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},e}(),P=function(e,t,r){return new M(e,r).compare(new M(t,r))},j=function(e,t,r,n){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return function(e,t,r){return 0===P(e,t,r)}(e,r,n);case"!=":return function(e,t,r){return 0!==P(e,t,r)}(e,r,n);case">":return function(e,t,r){return P(e,t,r)>0}(e,r,n);case">=":return function(e,t,r){return P(e,t,r)>=0}(e,r,n);case"<":return function(e,t,r){return P(e,t,r)<0}(e,r,n);case"<=":return function(e,t,r){return P(e,t,r)<=0}(e,r,n);default:throw new TypeError("Invalid operator: "+t)}},C=Symbol("SemVer ANY"),k=function(){function e(t,r){if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}w("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.value=this.semver===C?"":this.operator+this.semver.version,w("comp",this)}var r=e.prototype;return r.parse=function(e){var t=e.match(this.options.loose?D[x.COMPARATORLOOSE]:D[x.COMPARATOR]);if(!t)throw new TypeError("Invalid comparator: "+e);this.operator=void 0!==t[1]?t[1]:"","="===this.operator&&(this.operator=""),this.semver=t[2]?new M(t[2],this.options.loose):C},r.toString=function(){return this.value},r.test=function(e){if(w("Comparator.test",e,this.options.loose),this.semver===C||e===C)return!0;if("string"==typeof e)try{e=new M(e,this.options)}catch(e){return!1}return j(e,this.operator,this.semver,this.options)},r.intersects=function(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),""===this.operator)return""===this.value||new U(t.value,r).test(this.value);if(""===t.operator)return""===t.value||new U(this.value,r).test(t.semver);var n=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),o=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),i=this.semver.version===t.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=j(this.semver,"<",t.semver,r)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=j(this.semver,">",t.semver,r)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return n||o||i&&a||s||u},t(e,null,[{key:"ANY",get:function(){return C}}]),e}(),D=R.re,x=R.t,U=function(){function e(t,r){var n=this;if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof k)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map(function(e){return n.parseRange(e.trim())}).filter(function(e){return e.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}var t=e.prototype;return t.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range},t.toString=function(){return this.range},t.parseRange=function(e){var t=this,r=this.options.loose;e=(e=e.trim()).replace(r?F[G.HYPHENRANGELOOSE]:F[G.HYPHENRANGE],te(this.options.includePrerelease)),w("hyphen replace",e),e=e.replace(F[G.COMPARATORTRIM],B),w("comparator trim",e,F[G.COMPARATORTRIM]),e=(e=(e=e.replace(F[G.TILDETRIM],W)).replace(F[G.CARETTRIM],H)).split(/\s+/).join(" ");var n=r?F[G.COMPARATORLOOSE]:F[G.COMPARATOR];return e.split(" ").map(function(e){return K(e,t.options)}).join(" ").split(/\s+/).map(function(e){return ee(e,t.options)}).filter(this.options.loose?function(e){return!!e.match(n)}:function(){return!0}).map(function(e){return new k(e,t.options)})},t.intersects=function(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(function(e){return z(e,r)&&t.set.some(function(t){return z(t,r)&&e.every(function(e){return t.every(function(t){return e.intersects(t,r)})})})})},t.test=function(e){if(!e)return!1;if("string"==typeof e)try{e=new M(e,this.options)}catch(e){return!1}for(var t=0;t<this.set.length;t++)if(re(this.set[t],e,this.options))return!0;return!1},e}(),F=R.re,G=R.t,B=R.comparatorTrimReplace,W=R.tildeTrimReplace,H=R.caretTrimReplace,z=function(e,t){for(var r=!0,n=e.slice(),o=n.pop();r&&n.length;)r=n.every(function(e){return o.intersects(e,t)}),o=n.pop();return r},K=function(e,t){return w("comp",e,t),e=Y(e,t),w("caret",e),e=q(e,t),w("tildes",e),e=$(e,t),w("xrange",e),e=Z(e,t),w("stars",e),e},X=function(e){return!e||"x"===e.toLowerCase()||"*"===e},q=function(e,t){return e.trim().split(/\s+/).map(function(e){return V(e,t)}).join(" ")},V=function(e,t){return e.replace(t.loose?F[G.TILDELOOSE]:F[G.TILDE],function(t,r,n,o,i){var a;return w("tilde",e,t,r,n,o,i),X(r)?a="":X(n)?a=">="+r+".0.0 <"+(+r+1)+".0.0-0":X(o)?a=">="+r+"."+n+".0 <"+r+"."+(+n+1)+".0-0":i?(w("replaceTilde pr",i),a=">="+r+"."+n+"."+o+"-"+i+" <"+r+"."+(+n+1)+".0-0"):a=">="+r+"."+n+"."+o+" <"+r+"."+(+n+1)+".0-0",w("tilde return",a),a})},Y=function(e,t){return e.trim().split(/\s+/).map(function(e){return J(e,t)}).join(" ")},J=function(e,t){w("caret",e,t);var r=t.includePrerelease?"-0":"";return e.replace(t.loose?F[G.CARETLOOSE]:F[G.CARET],function(t,n,o,i,a){var s;return w("caret",e,t,n,o,i,a),X(n)?s="":X(o)?s=">="+n+".0.0"+r+" <"+(+n+1)+".0.0-0":X(i)?s="0"===n?">="+n+"."+o+".0"+r+" <"+n+"."+(+o+1)+".0-0":">="+n+"."+o+".0"+r+" <"+(+n+1)+".0.0-0":a?(w("replaceCaret pr",a),s="0"===n?"0"===o?">="+n+"."+o+"."+i+"-"+a+" <"+n+"."+o+"."+(+i+1)+"-0":">="+n+"."+o+"."+i+"-"+a+" <"+n+"."+(+o+1)+".0-0":">="+n+"."+o+"."+i+"-"+a+" <"+(+n+1)+".0.0-0"):(w("no pr"),s="0"===n?"0"===o?">="+n+"."+o+"."+i+r+" <"+n+"."+o+"."+(+i+1)+"-0":">="+n+"."+o+"."+i+r+" <"+n+"."+(+o+1)+".0-0":">="+n+"."+o+"."+i+" <"+(+n+1)+".0.0-0"),w("caret return",s),s})},$=function(e,t){return w("replaceXRanges",e,t),e.split(/\s+/).map(function(e){return Q(e,t)}).join(" ")},Q=function(e,t){return(e=e.trim()).replace(t.loose?F[G.XRANGELOOSE]:F[G.XRANGE],function(r,n,o,i,a,s){w("xRange",e,r,n,o,i,a,s);var u=X(o),c=u||X(i),f=c||X(a);return"="===n&&f&&(n=""),s=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(c&&(i=0),a=0,">"===n?(n=">=",c?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):"<="===n&&(n="<",c?o=+o+1:i=+i+1),"<"===n&&(s="-0"),r=n+o+"."+i+"."+a+s):c?r=">="+o+".0.0"+s+" <"+(+o+1)+".0.0-0":f&&(r=">="+o+"."+i+".0"+s+" <"+o+"."+(+i+1)+".0-0"),w("xRange return",r),r})},Z=function(e,t){return w("replaceStars",e,t),e.trim().replace(F[G.STAR],"")},ee=function(e,t){return w("replaceGTE0",e,t),e.trim().replace(F[t.includePrerelease?G.GTE0PRE:G.GTE0],"")},te=function(e){return function(t,r,n,o,i,a,s,u,c,f,l,h,d){return((r=X(n)?"":X(o)?">="+n+".0.0"+(e?"-0":""):X(i)?">="+n+"."+o+".0"+(e?"-0":""):a?">="+r:">="+r+(e?"-0":""))+" "+(u=X(c)?"":X(f)?"<"+(+c+1)+".0.0-0":X(l)?"<"+c+"."+(+f+1)+".0-0":h?"<="+c+"."+f+"."+l+"-"+h:e?"<"+c+"."+f+"."+(+l+1)+"-0":"<="+u)).trim()}},re=function(e,t,r){for(var n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(var o=0;o<e.length;o++)if(w(e[o].semver),e[o].semver!==k.ANY&&e[o].semver.prerelease.length>0){var i=e[o].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0},ne=I.MAX_LENGTH,oe=R.re,ie=R.t,ae=R.re,se=R.t;function ue(e){return String.fromCharCode(parseInt(e.slice(1),16))}function ce(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}function fe(e){return t=JSON.stringify(e),btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,ue));var t}function le(e){return JSON.parse(decodeURIComponent(Array.from(atob(e),ce).join("")))}function he(e){return void 0===e}function de(e){return function(e){return null===e}(e)||he(e)}function pe(e){if(!e)return!0;for(var t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var ve={},ye={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn"},me=function(e){function t(r,n){var o;return(o=e.call(this,"Magic SDK Error: ["+r+"] "+n)||this).code=void 0,o.rawMessage=void 0,o.__proto__=Error,o.code=r,o.rawMessage=n,Object.setPrototypeOf(c(o),t.prototype),o}return n(t,e),t}(u(Error)),ge=function(e){function t(r){var n;(n=e.call(this)||this).__proto__=Error,n.code=void 0,n.rawMessage=void 0;var o=Number(null==r?void 0:r.code);return n.rawMessage=(null==r?void 0:r.message)||"Internal error",n.code=function(e){return!de(e)&&"number"==typeof e&&Object.values(d).includes(e)}(o)?o:d.InternalError,n.message="Magic RPC Error: ["+n.code+"] "+n.rawMessage,Object.setPrototypeOf(c(n),t.prototype),n}return n(t,e),t}(u(Error)),Ee=function(){function e(e,t){this.code=void 0,this.rawMessage=void 0,this.message=void 0,this.code=e,this.rawMessage=t,this.message="Magic SDK Warning: ["+e+"] "+t}return e.prototype.log=function(){console.warn(this.message)},e}(),_e=function(e){function t(r,n,o,i){var a;return(a=e.call(this,"Magic Extension Error ("+r.name+"): ["+n+"] "+o)||this).code=void 0,a.rawMessage=void 0,a.data=void 0,a.__proto__=Error,a.code=n,a.rawMessage=o,a.data=i,Object.setPrototypeOf(c(a),t.prototype),a}return n(t,e),t}(u(Error)),be=function(){function e(e,t,r){this.code=void 0,this.rawMessage=void 0,this.message=void 0,this.code=t,this.rawMessage=r,this.message="Magic Extension Warning ("+e.name+"): ["+t+"] "+r}return e.prototype.log=function(){console.warn(this.message)},e}();function Ie(){return new me(l.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function we(){return new me(l.MalformedResponse,"Response from the Magic iframe is malformed.")}function Re(e){return new me(l.ExtensionNotInitialized,"Extensions must be initialized with a Magic SDK instance before `Extension."+e+"` can be accessed. Do not invoke `Extension."+e+"` inside an extension constructor.")}function Ae(e){var t="Some extensions are incompatible with `"+ve.sdkName+"@"+ve.version+"`:";return e.filter(function(e){return null!=e.compat}).forEach(function(e){var r=e.compat[ve.sdkName];"string"==typeof r?t+="\n - Extension `"+e.name+"` supports version(s) `"+r+"`":r||(t+="\n - Extension `"+e.name+"` does not support "+ve.platform+" environments.")}),new me(l.IncompatibleExtensions,t)}function Oe(e){return new me(l.InvalidArgument,"Invalid "+function(e){var t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?t+"st":2===r&&12!==n?t+"nd":3===r&&13!==n?t+"rd":t+"th"}(e.argument)+" argument given to `"+e.procedure+"`.\n Expected: `"+e.expected+"`\n Received: `"+e.received+"`")}var Se=regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<Number.MAX_SAFE_INTEGER)){e.next=6;break}return e.next=4,++t;case 4:e.next=7;break;case 6:t=0;case 7:e.next=1;break;case 9:case"end":return e.stop()}},e)})();function Ne(){return Se.next().value}var Le=Symbol("Payload pre-processed by Magic SDK");function Te(e){return Object.defineProperty(e,Le,{value:!0,enumerable:!1}),e}function Me(e){var t,r,n;return function(e){return!!e[Le]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=Ne(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],Te(e)),e}function Pe(e,t){return void 0===t&&(t=[]),Te({params:t,method:e,jsonrpc:"2.0",id:Ne()})}var je,Ce=function(){function e(t){this._jsonrpc=void 0,this._id=void 0,this._result=void 0,this._error=void 0,t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):function(e){return!de(e)&&!(he(e.jsonrpc)||he(e.id)||he(e.result)&&he(e.error))}(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=void 0,this._error=void 0)}var r=e.prototype;return r.applyError=function(e){return this._error=e,this},r.applyResult=function(e){return this._result=e,this},t(e,[{key:"hasError",get:function(){return null!=this._error}},{key:"hasResult",get:function(){return void 0!==this._result}},{key:"payload",get:function(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}}]),e}(),ke=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(e,t,n,i,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,i||e,a),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=this._events[r?r+e:e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,o=t.length,i=new Array(o);n<o;n++)i[n]=t[n].fn;return i},s.prototype.listenerCount=function(e){var t=this._events[r?r+e:e];return t?t.fn?1:t.length:0},s.prototype.emit=function(e,t,n,o,i,a){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,f=this._events[s],l=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),l){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,n),!0;case 4:return f.fn.call(f.context,t,n,o),!0;case 5:return f.fn.call(f.context,t,n,o,i),!0;case 6:return f.fn.call(f.context,t,n,o,i,a),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];f.fn.apply(f.context,u)}else{var h,d=f.length;for(c=0;c<d;c++)switch(f[c].once&&this.removeListener(e,f[c].fn,void 0,!0),l){case 1:f[c].fn.call(f[c].context);break;case 2:f[c].fn.call(f[c].context,t);break;case 3:f[c].fn.call(f[c].context,t,n);break;case 4:f[c].fn.call(f[c].context,t,n,o);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];f[c].fn.apply(f[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return i(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return i(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,o){var i=r?r+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var s=this._events[i];if(s.fn)s.fn!==t||o&&!s.once||n&&s.context!==n||a(this,i);else{for(var u=0,c=[],f=s.length;u<f;u++)(s[u].fn!==t||o&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},s.prototype.removeAllListeners=function(e){var t;return e?this._events[t=r?r+e:e]&&a(this,t):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(je={exports:{}}),je.exports));function De(){var e=new ke;return{emitter:e,createChainingEmitterMethod:function(t,r){return function(){return e[t].apply(e,[].slice.call(arguments)),r}},createBoundEmitterMethod:function(t){return function(){return e[t].apply(e,[].slice.call(arguments))}}}}var xe=Symbol("isPromiEvent");function Ue(e){return!!e[xe]}function Fe(e){var t=Ge(e),r=De(),n=r.createBoundEmitterMethod,o=r.createChainingEmitterMethod,i=Symbol("Promise.then"),a=Symbol("Promise.catch"),s=Symbol("Promise.finally"),u=function(e,t){return function(){var r=t[e].apply(t,[].slice.call(arguments));return c(r)}},c=function(e){var t;return Object.assign(e,((t={})[xe]=!0,t[i]=e[i]||e.then,t[a]=e[a]||e.catch,t[s]=e[s]||e.finally,t.then=u(i,e),t.catch=u(a,e),t.finally=u(s,e),t.on=o("on",e),t.once=o("once",e),t.addListener=o("addListener",e),t.off=o("off",e),t.removeListener=o("removeListener",e),t.removeAllListeners=o("removeAllListeners",e),t.emit=n("emit"),t.eventNames=n("eventNames"),t.listeners=n("listeners"),t.listenerCount=n("listenerCount"),t))},f=c(t.then(function(e){return f.emit("done",e),f.emit("settled"),e},function(e){throw f.emit("error",e),f.emit("settled"),e}));return f}function Ge(e){return new Promise(function(t,r){var n=e(t,r);Promise.resolve(n).catch(r)})}var Be,We=function(){function e(e){this.sdk=void 0,this.sdk=e}return e.prototype.request=function(e){var t=this.overlay.post(y.MAGIC_HANDLE_REQUEST,Me(e)),r=Fe(function(e,r){t.then(function(t){if(n(),t.hasError)r(new ge(t.payload.error));else{if(!t.hasResult)throw we();e(t.payload.result)}}).catch(function(e){n(),r(e)})}),n=this.overlay.on(v.MAGIC_HANDLE_EVENT,function(t){var n,o=t.data.response;if(o.id===e.id&&null!=(n=o.result)&&n.event){var i=o.result,a=i.params;r.emit.apply(r,[i.event].concat(void 0===a?[]:a))}});return r},t(e,[{key:"overlay",get:function(){return this.sdk.overlay}}]),e}(),He=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.loginWithMagicLink=function(e){var t=e.showUI,r=Pe(this.sdk.testMode?p.LoginWithMagicLinkTestMode:p.LoginWithMagicLink,[{email:e.email,showUI:void 0===t||t,redirectURI:e.redirectURI}]);return this.request(r)},r.loginWithSMS=function(e){var t=Pe(this.sdk.testMode?p.LoginWithSmsTestMode:p.LoginWithSms,[{phoneNumber:e.phoneNumber,showUI:!0}]);return this.request(t)},r.loginWithCredential=function(e){var t=null!=e?e:"";if(!e&&"web"===ve.platform){t=window.location.search;var r=window.location.origin+window.location.pathname;window.history.replaceState(null,"",r)}var n=Pe(this.sdk.testMode?p.LoginWithCredentialTestMode:p.LoginWithCredential,[t]);return this.request(n)},t}(We);function ze(e){return function(){try{var t=arguments,r=function(r){return n||(Be=r),Promise.resolve(Be.ready()).then(function(){var r;return(r=Be)[e].apply(r,[].slice.call(t))})},n=Be;return Promise.resolve(n?r(n):Promise.resolve(ve.configureStorage()).then(r))}catch(e){return Promise.reject(e)}}}var Ke=ze("getItem"),Xe=ze("setItem"),qe=ze("removeItem"),Ve=ze("clear"),Ye=ze("length"),Je=ze("key"),$e=ze("keys"),Qe=ze("iterate"),Ze={__proto__:null,getItem:Ke,setItem:Xe,removeItem:qe,clear:Ve,length:Ye,key:Je,keys:$e,iterate:Qe};function et(){var e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;var t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),(t+=e[14].toString(16))+e[15].toString(16)}var tt={name:"ECDSA",namedCurve:"P-256"},rt={name:"ECDSA",namedCurve:"P-256"};function nt(e){return ot(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})}(e))}function ot(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var it=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.getIdToken=function(e){var t=Pe(this.sdk.testMode?p.GetIdTokenTestMode:p.GetIdToken,[e]);return this.request(t)},r.generateIdToken=function(e){var t=Pe(this.sdk.testMode?p.GenerateIdTokenTestMode:p.GenerateIdToken,[e]);return this.request(t)},r.getMetadata=function(){var e=Pe(this.sdk.testMode?p.GetMetadataTestMode:p.GetMetadata);return this.request(e)},r.updateEmail=function(e){var t=e.showUI,r=Pe(this.sdk.testMode?p.UpdateEmailTestMode:p.UpdateEmail,[{email:e.email,showUI:void 0===t||t}]);return this.request(r)},r.isLoggedIn=function(){var e=Pe(this.sdk.testMode?p.IsLoggedInTestMode:p.IsLoggedIn);return this.request(e)},r.logout=function(){qe("STORE_KEY_PUBLIC_JWK"),qe("STORE_KEY_PRIVATE_KEY");var e=Pe(this.sdk.testMode?p.LogoutTestMode:p.Logout);return this.request(e)},r.showSettings=function(){var e=Pe(this.sdk.testMode?p.UserSettingsTestMode:p.UserSettings);return this.request(e)},t}(We);function at(){return(at=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var st=De(),ut=st.createBoundEmitterMethod,ct=st.createChainingEmitterMethod,ft=function(e){function t(){var t;return(t=e.call.apply(e,[this].concat([].slice.call(arguments)))||this).isMagic=!0,t.on=ct("on",c(t)),t.once=ct("once",c(t)),t.addListener=ct("addListener",c(t)),t.off=ct("off",c(t)),t.removeListener=ct("removeListener",c(t)),t.removeAllListeners=ct("removeAllListeners",c(t)),t.emit=ut("emit"),t.eventNames=ut("eventNames"),t.listeners=ut("listeners"),t.listenerCount=ut("listenerCount"),t}n(t,e);var r=t.prototype;return r.sendAsync=function(e,t){var r=this;if(!t)throw Oe({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(y.MAGIC_HANDLE_REQUEST,e.map(function(e){var t=Me(e);return r.prefixPayloadMethodForTestMode(t),t})).then(function(e){t(null,e.map(function(e){return at({},e.payload,{error:e.hasError?new ge(e.payload.error):null})}))});else{var n=Me(e);this.prefixPayloadMethodForTestMode(n),this.overlay.post(y.MAGIC_HANDLE_REQUEST,n).then(function(e){t(e.hasError?new ge(e.payload.error):null,e.payload)})}},r.send=function(e,t){if("string"==typeof e){var r=Pe(e,Array.isArray(t)?t:[]);return this.request(r)}if(!Array.isArray(e)&&!t){var n=new Ee(h.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return n.log(),new Ce(e).applyError({code:-32603,message:n.rawMessage}).payload}this.sendAsync(e,t)},r.enable=function(){var e=Pe("eth_accounts");return this.request(e)},r.request=function(t){return this.prefixPayloadMethodForTestMode(t),e.prototype.request.call(this,t)},r.prefixPayloadMethodForTestMode=function(e){this.sdk.testMode&&(e.method="testMode/eth/"+e.method)},t}(We);function lt(e,t){return t?new URL(e,t):new URL(e)}var ht=["request","overlay","sdk"],dt=function(e){function t(){var t;(t=e.call(this,void 0)||this).__sdk_access_field_descriptors__=new Map,t.__is_initialized__=!1,t.utils={createPromiEvent:Fe,isPromiEvent:Ue,encodeJSON:fe,decodeJSON:le,createJsonRpcRequestPayload:Pe,standardizeJsonRpcRequestPayload:Me,storage:Ze};var r=[c(t)].concat(function(e){for(var t=Object.getPrototypeOf(e),r=[t];t!==We.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}(c(t)));return ht.forEach(function(e){var n=r.map(function(t){return Object.getOwnPropertyDescriptor(t,e)}),o=n.findIndex(function(e){return!!e}),i=n[o];i&&(t.__sdk_access_field_descriptors__.set(e,{descriptor:i,isPrototypeField:o>0}),Object.defineProperty(c(t),e,{configurable:!0,get:function(){throw Re(e)}}))}),t}n(t,e);var r=t.prototype;return r.init=function(e){var t=this;this.__is_initialized__||(ht.forEach(function(e){if(t.__sdk_access_field_descriptors__.has(e)){var r=t.__sdk_access_field_descriptors__.get(e),n=r.descriptor;r.isPrototypeField?delete t[e]:Object.defineProperty(t,e,n)}}),this.sdk=e,this.__is_initialized__=!0)},r.createDeprecationWarning=function(e){var t=e.useInstead;return new be(this,"DEPRECATION_NOTICE","`"+e.method+"` will be removed from this Extension in version `"+e.removalVersion+"`."+(t?" Use `"+t+"` instead.":""))},r.createWarning=function(e,t){return new be(this,e,t)},r.createError=function(e,t,r){return new _e(this,e,t,r)},t}(We),pt=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(dt);function vt(e){return!e.compat||null==e.compat[ve.sdkName]||("string"==typeof e.compat[ve.sdkName]?function(e,t,r){try{t=new U(t,void 0)}catch(e){return!1}return t.test(e)}(function(e,t){if(e instanceof M)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;var r=null;if((t=t||{}).rtl){for(var n;(n=ae[se.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&n.index+n[0].length===r.index+r[0].length||(r=n),ae[se.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;ae[se.COERCERTL].lastIndex=-1}else r=e.match(ae[se.COERCE]);return null===r?null:function(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof M)return e;if("string"!=typeof e)return null;if(e.length>ne)return null;if(!(t.loose?oe[ie.LOOSE]:oe[ie.FULL]).test(e))return null;try{return new M(e,t)}catch(e){return null}}(r[2]+"."+(r[3]||"0")+"."+(r[4]||"0"),t)}(ve.version),e.compat[ve.sdkName]):!!e.compat[ve.sdkName])}function yt(e){var t,r=this,n=null!=(t=null==e?void 0:e.extensions)?t:[],o={},i=[];if(Array.isArray(n)?n.forEach(function(e){vt(e)?(e.init(r),(e.name||e.name!==pt.Anonymous)&&(r[e.name]=e),e instanceof pt.Internal&&(pe(e.config)||(o[e.name]=e.config))):i.push(e)}):Object.keys(n).forEach(function(e){if(vt(n[e])){n[e].init(r);var t=n[e];r[e]=t,t instanceof pt.Internal&&(pe(t.config)||(o[n[e].name]=t.config))}else i.push(n[e])}),i.length)throw Ae(i);return o}pt.Internal=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(dt),pt.Anonymous="anonymous extension";var mt=function(){function e(e,t){var r;if(this.apiKey=void 0,this.endpoint=void 0,this.parameters=void 0,this.testMode=void 0,this.auth=void 0,this.user=void 0,this.rpcProvider=void 0,this.apiKey=e,!e)throw Ie();"react-native"===ve.platform&&null!=t&&t.endpoint&&new Ee(h.ReactNativeEndpointConfiguration,"CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The `endpoint` parameter SHOULD NOT be provided. The Magic `<iframe>` is automatically wrapped by a WebView pointed at `"+ve.defaultEndpoint+"`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.").log();var n=ve.defaultEndpoint,o=ve.version;this.testMode=!(null==t||!t.testMode),this.endpoint=lt(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new He(this),this.user=new it(this),this.rpcProvider=new ft(this);var i=yt.call(this,t);this.parameters=fe({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:lt(this.endpoint).host,sdk:ye[ve.sdkName],version:o,ext:pe(i)?void 0:i,locale:(null==t?void 0:t.locale)||"en_US"})}return e.prototype.preload=function(){try{return Promise.resolve(this.overlay.ready).then(function(){})}catch(e){return Promise.reject(e)}},t(e,[{key:"overlay",get:function(){if(!e.__overlays__.has(this.parameters)){var t=new ve.ViewController(this.endpoint,this.parameters);t.init(),e.__overlays__.set(this.parameters,t)}return e.__overlays__.get(this.parameters)}}]),e}();mt.__overlays__=new Map;var gt=function(){function e(e,t){this.endpoint=void 0,this.parameters=void 0,this.ready=void 0,this.messageHandlers=new Set,this.endpoint=e,this.parameters=t,this.ready=this.waitForReady(),this.listen()}var t=e.prototype;return t.post=function(e,t){try{var r=this;return Promise.resolve(Ge(function(n){try{var o;return Promise.resolve(r.ready).then(function(){var i=[],a=Array.isArray(t)?t.map(function(e){return e.id}):[];return Promise.resolve(function(e,t){try{return Promise.resolve(Ke("rt")).then(function(r){function n(){return o?r?{msgType:e,payload:t,jwt:o,rt:r}:{msgType:e,payload:t,jwt:o}:{msgType:e,payload:t}}var o,i=function(){if("web"===ve.platform){var e=function(e,t){try{var r=Promise.resolve(function(){try{var e;return Promise.resolve(function(){try{var e,t=function(t){if(e)return t;console.info("webcrypto is not supported")},r=function(){if(function(){var e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return e=1,Promise.resolve(Ke("STORE_KEY_PUBLIC_JWK")).then(function(e){function t(e){return Ke("STORE_KEY_PUBLIC_JWK")}return e?t():Promise.resolve(function(){try{var e=null,t=window.crypto.subtle;return Promise.resolve(t.generateKey(tt,!0,["sign"])).then(function(r){return Promise.resolve(t.exportKey("jwk",r.privateKey)).then(function(n){return Promise.resolve(t.exportKey("jwk",r.publicKey)).then(function(r){return e=r,Promise.resolve(t.importKey("jwk",n,rt,!1,["sign"])).then(function(t){return Promise.resolve(Xe("STORE_KEY_PRIVATE_KEY",t)).then(function(){return Promise.resolve(Xe("STORE_KEY_PUBLIC_JWK",e)).then(function(e){})})})})})})}catch(e){return Promise.reject(e)}}()).then(t)})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(t){if(t){var r=window.crypto.subtle;return Promise.resolve(Ke("STORE_KEY_PRIVATE_KEY")).then(function(n){if(n&&r){var o={iat:Math.floor((new Date).getTime()/1e3),jti:et()},i=nt(JSON.stringify({typ:"dpop+jwt",alg:"ES256",jwk:t})),a=nt(JSON.stringify(o)),s=(e=i+"."+a,(new TextEncoder).encode(e));return Promise.resolve(r.sign({name:"ECDSA",hash:{name:"SHA-256"}},n,s)).then(function(e){return i+"."+a+"."+function(e){var t="";return e.forEach(function(e){t+=String.fromCharCode(e)}),ot(t)}(new Uint8Array(e))})}console.info("unable to find private key or webcrypto unsupported")})}console.info("unable to create public key or webcrypto is unsupported")})}catch(e){return Promise.reject(e)}}()).then(function(e){o=e})}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}(0,function(e){console.error("webcrypto error",e)});if(e&&e.then)return e.then(function(){})}}();return i&&i.then?i.then(n):n()})}catch(e){return Promise.reject(e)}}(e+"-"+r.parameters,t)).then(function(e){return Promise.resolve(r._post(e)).then(function(){var e=r.on(v.MAGIC_HANDLE_RESPONSE,(o=function(){return e()},function(e){var r=function(e,t){var r,n=null==(r=t.data.response)?void 0:r.id,o=function(e,t){return t&&Array.isArray(e)?e.find(function(e){return e.id===t}):e}(e,n);return n&&o?{id:n,response:new Ce(o).applyResult(t.data.response.result).applyError(t.data.response.error)}:{}}(t,e),s=r.id,u=r.response;!function(e){try{Promise.resolve(e.data.rt?Promise.resolve(Xe("rt",e.data.rt)).then(function(e){}):void 0)}catch(e){return Promise.reject(e)}}(e),s&&u&&Array.isArray(t)&&a.includes(s)?(i.push(u),i.length===t.length&&(o(),n(i))):s&&u&&!Array.isArray(t)&&s===t.id&&(o(),n(u))}))})})})}catch(e){return Promise.reject(e)}}))}catch(e){return Promise.reject(e)}},t.on=function(e,t){var r=this,n=t.bind(window),o=function(t){t.data.msgType===e+"-"+r.parameters&&n(t)};return this.messageHandlers.add(o),function(){return r.messageHandlers.delete(o)}},t.waitForReady=function(){var e=this;return new Promise(function(t){e.on(v.MAGIC_OVERLAY_READY,function(){return t()})})},t.listen=function(){var e=this;this.on(v.MAGIC_HIDE_OVERLAY,function(){e.hideOverlay()}),this.on(v.MAGIC_SHOW_OVERLAY,function(){e.showOverlay()})},e}(),Et={__proto__:null,Extension:pt,ExtensionError:_e,ExtensionWarning:be,RPCError:ge,SDKError:me,SDKWarning:Ee,isPromiEvent:Ue,get EthChainType(){return m},get MagicIncomingWindowMessage(){return v},get MagicOutgoingWindowMessage(){return y},get MagicPayloadMethod(){return p},get RPCErrorCode(){return d},get SDKErrorCode(){return l},get SDKWarningCode(){return h}},_t=_(function(e,t){e.exports=function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){if(!s&&b)return b(a);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){return o(t[a][1][e]||e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var i=b,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){(function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(f),s=e.document.createTextNode("");a.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var u=new e.MessageChannel;u.port1.onmessage=f,r=function(){u.port2.postMessage(0)}}var c=[];function f(){var e,t;n=!0;for(var r=c.length;r;){for(t=c,c=[],e=-1;++e<r;)t[e]();r=c.length}n=!1}t.exports=function(e){1!==c.push(e)||n||r()}}).call(this,void 0!==g?g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1);function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],u=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=p(function(){t(o,n)});"error"===a.status&&n(a.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==u?l(r,this.state===s?e:t,this.outcome):this.queue.push(new f(r,e,t)),r},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=p(h,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)d(e,n);else{e.state=s,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},c.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},c.reject=function(e){var t=new this(o);return i.reject(t,e)},c.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),s=0,u=-1,c=new this(o);++u<r;)f(e[u],u);return c;function f(e,o){t.resolve(e).then(function(e){a[o]=e,++s!==r||n||(n=!0,i.resolve(c,a))},function(e){n||(n=!0,i.reject(c,e))})}},c.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var n=-1,a=new this(o);++n<t;)this.resolve(e[n]).then(function(e){r||(r=!0,i.resolve(a,e))},function(e){r||(r=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==g?g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},p=Object.prototype.toString,v="readonly",y="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function g(e){var t=d[e.name],r={};r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function E(e){var t=d[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=d[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function b(e,t){return new a(function(r,n){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);g(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),E(e)}})}function I(e){return b(e,!1)}function w(e){return b(e,!0)}function R(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version>e.db.version;if(e.version<e.db.version&&(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),n||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function A(e){return i([m(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function S(e){var t=this,r=t._initReady().then(function(){var e=d[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return u(r,e,e),r}function N(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),w(e)}).then(function(){return function(e){g(e);for(var t=d[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,R(e)?w(e):t}).then(function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){N(e,t,r,n-1)})}).catch(r);r(o)}}var L={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=d[r.name];o||(d[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=S);var i=[];function s(){return a.resolve()}for(var u=0;u<o.forages.length;u++){var c=o.forages[u];c!==t&&i.push(c._initReady().catch(s))}var f=o.forages.slice(0);return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,R(r,t._defaultConfig.version)?w(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<f.length;n++){var i=f[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){N(r._dbInfo,v,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),s=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;O(n)&&(n=A(n));var o=e(n,r.key,s++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){N(r._dbInfo,v,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),O(e)&&(e=A(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var o=new a(function(r,o){var s;n.ready().then(function(){return s=n._dbInfo,"[object Blob]"===p.call(t)?function(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var r=e.transaction(l,y),n=i([""]);r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return h=e})}(s.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)}));var r}):t}).then(function(t){N(n._dbInfo,y,function(i,a){if(i)return o(i);try{var s=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var u=s.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){o(u.error?u.error:u.transaction.error)}}catch(e){o(e)}})}).catch(o)});return s(o,r),o},removeItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){N(r._dbInfo,y,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){n(a.error?a.error:a.transaction.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){N(t._dbInfo,y,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){r(i.error?i.error:i.transaction.error)}}catch(e){r(e)}})}).catch(r)});return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){N(t._dbInfo,v,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){N(r._dbInfo,v,function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),s=!1,u=a.openKeyCursor();u.onsuccess=function(){var r=u.result;r?0===e||s?t(r.key):(s=!0,r.advance(e)):t(null)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)});return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){N(t._dbInfo,v,function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}})}).catch(r)});return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;if(e.name){var u=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var r=d[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;g(e);var n=d[e.name],i=n.forages;t.close();for(var s=0;s<i.length;s++){var u=i[s];u._dbInfo.db=null,u._dbInfo.version=r}return new a(function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,E(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){g(e);var r=d[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return new a(function(t,r){var n=o.deleteDatabase(e.name);n.onerror=n.onblocked=function(e){var t=n.result;t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<n.length;t++)E(n[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments");return s(n,t),n}},T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",j=P.length,C="arbf",k="blob",D="si08",x="ui08",U="uic8",F="si16",G="si32",B="ur16",W="ui32",H="fl32",z="fl64",K=j+C.length,X=Object.prototype.toString;function q(e){var t,r,n,o,i,a=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var c=new ArrayBuffer(a),f=new Uint8Array(c);for(t=0;t<s;t+=4)r=T.indexOf(e[t]),n=T.indexOf(e[t+1]),o=T.indexOf(e[t+2]),i=T.indexOf(e[t+3]),f[u++]=r<<2|n>>4,f[u++]=(15&n)<<4|o>>2,f[u++]=(3&o)<<6|63&i;return c}function V(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=T[r[t]>>2],n+=T[(3&r[t])<<4|r[t+1]>>4],n+=T[(15&r[t+1])<<2|r[t+2]>>6],n+=T[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var Y={serialize:function(e,t){var r="";if(e&&(r=X.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===X.call(e.buffer))){var n,o=P;e instanceof ArrayBuffer?(n=e,o+=C):(n=e.buffer,"[object Int8Array]"===r?o+=D:"[object Uint8Array]"===r?o+=x:"[object Uint8ClampedArray]"===r?o+=U:"[object Int16Array]"===r?o+=F:"[object Uint16Array]"===r?o+=B:"[object Int32Array]"===r?o+=G:"[object Uint32Array]"===r?o+=W:"[object Float32Array]"===r?o+=H:"[object Float64Array]"===r?o+=z:t(new Error("Failed to get type for BinaryArray"))),t(o+V(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+V(this.result);t("__lfsc__:blob"+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,j)!==P)return JSON.parse(e);var t,r=e.substring(K),n=e.substring(j,K);if(n===k&&M.test(r)){var o=r.match(M);t=o[1],r=r.substring(o[0].length)}var a=q(r);switch(n){case C:return a;case k:return i([a],{type:t});case D:return new Int8Array(a);case x:return new Uint8Array(a);case U:return new Uint8ClampedArray(a);case F:return new Int16Array(a);case B:return new Uint16Array(a);case G:return new Int32Array(a);case W:return new Uint32Array(a);case H:return new Float32Array(a);case z:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:q,bufferToString:V};function J(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function $(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,s){s.rows.length?i(e,a):J(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}function Q(e,t,r,n){var o=this;e=c(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var s=t,u=o._dbInfo;u.serializer.serialize(t,function(t,c){c?a(c):u.db.transaction(function(r){$(r,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(s)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Q.apply(o,[e,s,r,n-1]));a(t)}})})}).catch(a)});return s(i,r),i}function Z(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a(function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){J(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)});return r.serializer=Y,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,s=0;s<a;s++){var u=i.item(s),c=u.value;if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,u.key,s+1)))return void t(c)}t()},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},setItem:function(e,t,r){return Q.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=c(e);var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){$(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){$(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c;e(n)},function(e,t){r(t)})})}).catch(r)});return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(r){$(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)},function(e,t){n(t)})})}).catch(n)});return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo;n.db.transaction(function(t){$(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key);e(n)},function(e,t){r(t)})})}).catch(r)});return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,o=this;return s(n=e.name?new a(function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:Z(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],s=0,u=e.storeNames.length;s<u;s++)i.push(o(e.storeNames[s]));a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}};function te(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=Y,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,s=0;s<i;s++){var u=localStorage.key(s);if(0===u.indexOf(n)){var c=localStorage.getItem(u);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,u.substring(o),a++)))return c}}});return s(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n});return s(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var o=n.ready().then(function(){void 0===t&&(t=null);var r=t;return new a(function(o,i){var a=n._dbInfo;a.serializer.serialize(t,function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return s(o,r),o},removeItem:function(e,t){var r=this;e=c(e);var n=r.ready().then(function(){localStorage.removeItem(r._dbInfo.keyPrefix+e)});return s(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}});return s(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t});return s(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n});return s(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this;return s(n=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},oe=function(e,t){for(var r=e.length,n=0;n<r;){if(ne(e[n],t))return!0;n++}return!1},ie=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ae={},se={},ue={INDEXEDDB:L,WEBSQL:ee,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],le=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),he={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}function pe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=ie(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=new(function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(r)){var n=ue[r],o=n._driver;this[r]=o,ae[o]||this.defineDriver(n)}this._defaultConfig=pe({},he),this._config=pe({},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(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=le.concat("_initStorage"),u=0,c=i.length;u<c;u++){var f=i[u];if((!oe(fe,f)||e[f])&&"function"!=typeof e[f])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return s(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var l=function(r){ae[n]&&console.info("Redefining LocalForage driver: "+n),ae[n]=e,se[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,r):l(!!e._support):l(!0)}catch(e){r(e)}});return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ae[e]?a.resolve(ae[e]):a.reject(new Error("Driver not found."));return u(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(Y);return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ie(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function s(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=c.then(function(){var e=o[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var o=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(s).catch(r)}i();var u=new Error("No available storage method found.");return n._driverSet=a.reject(u),n._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet}),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!se[e]},e.prototype._extend=function(e){pe(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=le.length;e<t;e++)de(this,le[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}),bt=E(_(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,r="__lfsc__:".length,n=r+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),o=new Uint8Array(n),i=0,a=0;i<r;i+=4){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=s<<2|u>>4,o[a++]=(15&u)<<4|c>>2,o[a++]=(3&c)<<6|63&f}return n}function a(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];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 s(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=s(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n}function u(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function c(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function f(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var r=this;if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?u(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function h(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var d={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var o,a=e.substring(n),s=e.substring(r,n);if("blob"===s&&t.test(a)){var u=a.match(t);o=u[1],a=a.substring(u[0].length)}var c=i(a);switch(s){case"arbf":return c;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([c],{type:o});case"si08":return new Int8Array(c);case"ui08":return new Uint8Array(c);case"uic8":return new Uint8ClampedArray(c);case"si16":return new Int16Array(c);case"ur16":return new Uint16Array(c);case"si32":return new Int32Array(c);case"ui32":return new Uint32Array(c);case"fl32":return new Float32Array(c);case"fl64":return new Float64Array(c);default:throw new Error("Unkown type: "+s)}},serialize:function(e,t){var r="";if(e&&(r=o.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var n=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(n=e,i+="arbf"):(n=e.buffer,"[object Int8Array]"===r?i+="si08":"[object Uint8Array]"===r?i+="ui08":"[object Uint8ClampedArray]"===r?i+="uic8":"[object Int16Array]"===r?i+="si16":"[object Uint16Array]"===r?i+="ur16":"[object Int32Array]"===r?i+="si32":"[object Uint32Array]"===r?i+="ui32":"[object Float32Array]"===r?i+="fl32":"[object Float64Array]"===r?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(n))}else if("[object Blob]"===r){var s=new FileReader;s.onload=function(){var r="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+r)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:i},p={},v=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return p[t]||(p[t]=new e(t)),p[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete p[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?s(e):{},r=u(t,this._defaultConfig),n=v.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=d,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return c(r,e),r},e.dropInstance=function(e,t){var r=l.apply(this,arguments),n=r.promise,o=r.callback;return c(n.then(function(e){v.resolve(e).drop()}),o),n},e.getItem=function(e,t){var r=this;e=h(e);var n=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return c(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then(function(){for(var t=r._dbInfo.mStore,n=t.keys(),o=0;o<n.length;o++){var i=t.get(n[o]);if(i&&(i=r._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,n[o],o+1)))return i}});return c(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then(function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return c(n,t),n},e.keys=function(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return c(r,e),r},e.length=function(e){var t=this.keys().then(function(e){return e.length});return c(t,e),t},e.removeItem=function(e,t){var r=this;e=h(e);var n=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return c(n,t),n},e.setItem=function(e,t,r){var n=this;e=h(e);var o=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(o,i){n._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{n._dbInfo.mStore.set(e,t),o(r)}catch(e){i(e)}})})});return c(o,r),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)})),It={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},wt=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).iframe=void 0,t.activeElement=null,t}n(t,e);var r=t.prototype;return r.init=function(){var e=this;this.test="hello",this.iframe=new Promise(function(t){var r=function(){if(n=encodeURIComponent(e.parameters),o=[].slice.call(document.querySelectorAll(".magic-iframe")),Boolean(o.find(function(e){return e.src.includes(n)})))new Ee(h.DuplicateIframe,"Duplicate iframes found.").log();else{var r=document.createElement("iframe");r.classList.add("magic-iframe"),r.dataset.magicIframeLabel=lt(e.endpoint).host,r.title="Secure Modal",r.src=lt("/send?params="+encodeURIComponent(e.parameters),e.endpoint).href,function(e){for(var t=0,r=Object.entries(It);t<r.length;t++){var n=r[t];e.style[n[0]]=n[1]}}(r),document.body.appendChild(r),t(r)}var n,o};["loaded","interactive","complete"].includes(document.readyState)?r():window.addEventListener("load",r,!1)}),window.addEventListener("message",function(t){if(t.origin===e.endpoint&&t.data&&t.data.msgType&&e.messageHandlers.size){var r;t.data.response=null!=(r=t.data.response)?r:{};for(var n,o=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e.messageHandlers.values());!(n=o()).done;)(0,n.value)(t)}})},r.showOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){t.style.display="block",e.activeElement=document.activeElement,t.focus()})}catch(e){return Promise.reject(e)}},r.hideOverlay=function(){try{var e=this;return Promise.resolve(e.iframe).then(function(t){var r;t.style.display="none",null!==(r=e.activeElement)&&void 0!==r&&r.focus&&e.activeElement.focus(),e.activeElement=null})}catch(e){return Promise.reject(e)}},r._post=function(e){try{var t=this;return Promise.resolve(t.iframe).then(function(r){if(!r||!r.contentWindow)throw new me(l.ModalNotReady,"Modal is not ready.");r.contentWindow.postMessage(e,t.endpoint)})}catch(e){return Promise.reject(e)}},t}(gt);return Object.assign(function(e,t){return Object.assign(ve,t),e}(mt,{platform:"web",sdkName:"magic-sdk",version:"6.2.1",defaultEndpoint:"https://auth.magic.link/",ViewController:wt,configureStorage:function(){try{var e=_t.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return Promise.resolve(e.defineDriver(bt)).then(function(){return Promise.resolve(e.setDriver([_t.INDEXEDDB,_t.LOCALSTORAGE,bt._driver])).then(function(){return e})})}catch(e){return Promise.reject(e)}}}),r({},Et))}();
|
package/dist/modern/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ViewController as e,createModalNotReadyError as t,createURL as n,createDuplicateIframeWarning as r,createSDK as o,SDKBase as i}from"@magic-sdk/provider";export*from"@magic-sdk/commons";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){var t={exports:{}};return e(t,t.exports),t.exports}function f(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}var s=c(function(e,t){e.exports=function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){if(!u&&f)return f(a);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){return o(t[a][1][e]||e)},s,s.exports,e,t,n,r)}return n[a].exports}for(var i=f,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){(function(e){var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(s),u=e.document.createTextNode("");a.observe(u,{characterData:!0}),n=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){s(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(s,0)};else{var c=new e.MessageChannel;c.port1.onmessage=s,n=function(){c.port2.postMessage(0)}}var f=[];function s(){var e,t;r=!0;for(var n=f.length;n;){for(t=f,f=[],e=-1;++e<n;)t[e]();n=f.length}r=!1}t.exports=function(e){1!==f.push(e)||r||n()}}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1);function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function f(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&v(this,e)}function s(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r(function(){var r;try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function v(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=h(function(){t(o,r)});"error"===a.status&&r(a.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=f,f.prototype.catch=function(e){return this.then(null,e)},f.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(o);return this.state!==c?l(n,this.state===u?e:t,this.outcome):this.queue.push(new s(n,e,t)),n},s.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},s.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},s.prototype.callRejected=function(e){i.reject(this.promise,e)},s.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=h(d,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)v(e,r);else{e.state=u,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},f.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},f.reject=function(e){var t=new this(o);return i.reject(t,e)},f.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a=new Array(n),u=0,c=-1,f=new this(o);++c<n;)s(e[c],c);return f;function s(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==n||r||(r=!0,i.resolve(f,a))},function(e){r||(r=!0,i.reject(f,e))})}},f.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var r=-1,a=new this(o);++r<t;)this.resolve(e[r]).then(function(e){n||(n=!0,i.resolve(a,e))},function(e){n||(n=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,v={},h=Object.prototype.toString,y="readonly",p="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function m(e){var t=v[e.name],n={};n.promise=new a(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady=t.dbReady?t.dbReady.then(function(){return n.promise}):n.promise}function g(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var n=v[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function w(e,t){return new a(function(n,r){if(v[e.name]=v[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);m(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){n(a.result),g(e)}})}function I(e){return w(e,!1)}function S(e){return w(e,!0)}function E(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version>e.db.version;if(e.version<e.db.version&&(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),r||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function A(e){return i([b(atob(e.data))],{type:e.type})}function j(e){return e&&e.__local_forage_encoded_blob}function N(e){var t=this,n=t._initReady().then(function(){var e=v[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(n,e,e),n}function O(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)}).then(function(){return function(e){m(e);for(var t=v[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,E(e)?S(e):t}).then(function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r}).catch(function(t){throw _(e,t),t})}(e).then(function(){O(e,t,n,r-1)})}).catch(n);n(o)}}var B={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=v[n.name];o||(v[n.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=N);var i=[];function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var f=o.forages[c];f!==t&&i.push(f._initReady().catch(u))}var s=o.forages.slice(0);return a.all(i).then(function(){return n.db=o.db,I(n)}).then(function(e){return n.db=e,E(n,t._defaultConfig.version)?S(n):e}).then(function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<s.length;r++){var i=s[r];i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).openCursor(),u=1;a.onsuccess=function(){var n=a.result;if(n){var r=n.value;j(r)&&(r=A(r));var o=e(r,n.key,u++);void 0!==o?t(o):n.continue()}else t()},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},getItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),j(e)&&(e=A(e)),t(e)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},setItem:function(e,t,n){var r=this;e=f(e);var o=new a(function(n,o){var u;r.ready().then(function(){return u=r._dbInfo,"[object Blob]"===h.call(t)?function(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a(function(t){var n=e.transaction(l,p),r=i([""]);n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return d=e})}(u.db).then(function(e){return e?t:(n=t,new a(function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)}));var n}):t}).then(function(t){O(r._dbInfo,p,function(i,a){if(i)return o(i);try{var u=a.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var c=u.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){o(c.error?c.error:c.transaction.error)}}catch(e){o(e)}})}).catch(o)});return u(o,n),o},removeItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,p,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){r(a.error)},i.onabort=function(){r(a.error?a.error:a.transaction.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,p,function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){n(i.error?i.error:i.transaction.error)}}catch(e){n(e)}})}).catch(n)});return u(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,y,function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){n(i.error)}}catch(e){n(e)}})}).catch(n)});return u(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){e<0?t(null):n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName),u=!1,c=a.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||u?t(n.key):(u=!0,n.advance(e)):t(null)},c.onerror=function(){r(c.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,y,function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){n(i.error)}}catch(e){n(e)}})}).catch(n)});return u(n,e),n},dropInstance:function(e,t){t=s.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;if(e.name){var c=e.name===n.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var n=v[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t});r=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;m(e);var r=v[e.name],i=r.forages;t.close();for(var u=0;u<i.length;u++){var c=i[u];c._dbInfo.db=null,c._dbInfo.version=n}return new a(function(t,r){var i=o.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,g(n._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){m(e);var n=v[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;return new a(function(t,n){var r=o.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<r.length;t++)g(r[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else r=a.reject("Invalid arguments");return u(r,t),r}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=/^~~local_forage_type~([^~]+)~/,R="__lfsc__:",D=R.length,C="arbf",T="blob",F="si08",L="ui08",z="uic8",M="si16",P="si32",U="ur16",q="ui32",W="fl32",H="fl64",K=D+C.length,J=Object.prototype.toString;function Q(e){var t,n,r,o,i,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),s=new Uint8Array(f);for(t=0;t<u;t+=4)n=k.indexOf(e[t]),r=k.indexOf(e[t+1]),o=k.indexOf(e[t+2]),i=k.indexOf(e[t+3]),s[c++]=n<<2|r>>4,s[c++]=(15&r)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return f}function X(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=k[n[t]>>2],r+=k[(3&n[t])<<4|n[t+1]>>4],r+=k[(15&n[t+1])<<2|n[t+2]>>6],r+=k[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var G={serialize:function(e,t){var n="";if(e&&(n=J.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var r,o=R;e instanceof ArrayBuffer?(r=e,o+=C):(r=e.buffer,"[object Int8Array]"===n?o+=F:"[object Uint8Array]"===n?o+=L:"[object Uint8ClampedArray]"===n?o+=z:"[object Int16Array]"===n?o+=M:"[object Uint16Array]"===n?o+=U:"[object Int32Array]"===n?o+=P:"[object Uint32Array]"===n?o+=q:"[object Float32Array]"===n?o+=W:"[object Float64Array]"===n?o+=H:t(new Error("Failed to get type for BinaryArray"))),t(o+X(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n="~~local_forage_type~"+e.type+"~"+X(this.result);t("__lfsc__:blob"+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,D)!==R)return JSON.parse(e);var t,n=e.substring(K),r=e.substring(D,K);if(r===T&&x.test(n)){var o=n.match(x);t=o[1],n=n.substring(o[0].length)}var a=Q(n);switch(r){case C:return a;case T:return i([a],{type:t});case F:return new Int8Array(a);case L:return new Uint8Array(a);case z:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case U:return new Uint16Array(a);case P:return new Int32Array(a);case q:return new Uint32Array(a);case W:return new Float32Array(a);case H:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:Q,bufferToString:X};function V(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Y(e,t,n,r,o,i){e.executeSql(n,r,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,u){u.rows.length?i(e,a):V(e,t,function(){e.executeSql(n,r,o,i)},i)},i):i(e,a)},i)}function Z(e,t,n,r){var o=this;e=f(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var u=t,c=o._dbInfo;c.serializer.serialize(t,function(t,f){f?a(f):c.db.transaction(function(n){Y(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(u)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void i(Z.apply(o,[e,u,n,r-1]));a(t)}})})}).catch(a)});return u(i,n),i}function $(e){return new a(function(t,n){e.transaction(function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){n(t)})},function(e){n(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new a(function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction(function(o){V(o,n,function(){t._dbInfo=n,e()},function(e,t){r(t)})},r)});return n.serializer=G,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName,[],function(n,r){for(var i=r.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),f=c.value;if(f&&(f=o.serializer.deserialize(f)),void 0!==(f=e(f,c.key,u+1)))return void t(f)}t()},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},getItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},setItem:function(e,t,n){return Z.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){Y(t,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)});return u(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){Y(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(t,n){var r=n.rows.item(0).c;e(r)},function(e,t){n(t)})})}).catch(n)});return u(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){Y(t,r,"SELECT key FROM "+r.storeName,[],function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)},function(e,t){n(t)})})}).catch(n)});return u(n,e),n},dropInstance:function(e,t){t=s.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return u(r=e.name?new a(function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:r,storeNames:[e.storeName]}:$(r))}).then(function(e){return new a(function(t,n){e.db.transaction(function(r){function o(e){return new a(function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}for(var i=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u]));a.all(i).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):a.reject("Invalid arguments"),t),r}};function te(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}var ne={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=G,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then(function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,u=0;u<i;u++){var c=localStorage.key(u);if(0===c.indexOf(r)){var f=localStorage.getItem(c);if(f&&(f=t.serializer.deserialize(f)),void 0!==(f=e(f,c.substring(o),a++)))return f}}});return u(r,t),r},getItem:function(e,t){var n=this;e=f(e);var r=n.ready().then(function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r});return u(r,t),r},setItem:function(e,t,n){var r=this;e=f(e);var o=r.ready().then(function(){void 0===t&&(t=null);var n=t;return new a(function(o,i){var a=r._dbInfo;a.serializer.serialize(t,function(t,r){if(r)i(r);else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return u(o,n),o},removeItem:function(e,t){var n=this;e=f(e);var r=n.ready().then(function(){localStorage.removeItem(n._dbInfo.keyPrefix+e)});return u(r,t),r},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}});return u(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length});return u(t,e),t},key:function(e,t){var n=this,r=n.ready().then(function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t});return u(r,t),r},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r});return u(n,e),n},dropInstance:function(e,t){if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this;return u(r=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}}):a.reject("Invalid arguments"),t),r}},re=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;r++}var o,i;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ue={INDEXEDDB:B,WEBSQL:ee,LOCALSTORAGE:ne},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),le={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var n=arguments;return e.ready().then(function(){return e[t].apply(e,n)})}}function ve(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(arguments[0][n]=oe(t[n])?t[n].slice():t[n])}return arguments[0]}var he=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(n)){var r=ue[n],o=r._driver;this[n]=o,ie[o]||this.defineDriver(r)}this._defaultConfig=ve({},le),this._config=ve({},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(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new a(function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var i=se.concat("_initStorage"),c=0,f=i.length;c<f;c++){var s=i[c];if((!re(fe,s)||e[s])&&"function"!=typeof e[s])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t);return u(n,arguments[arguments.length-1]),n}},n=0,r=fe.length;n<r;n++){var o=fe[n];e[o]||(e[o]=t(o))}}();var l=function(n){ie[r]&&console.info("Redefining LocalForage driver: "+r),ie[r]=e,ae[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!0)}catch(e){n(e)}});return c(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ie[e]?a.resolve(ie[e]):a.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(G);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;oe(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){r._config.driver=r.driver()}function u(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var f=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=f.then(function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then(function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(u).catch(n)}i();var c=new Error("No available storage method found.");return r._driverSet=a.reject(c),r._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return r._driverSet=a.reject(e),r._driverSet}),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){ve(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)de(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=he},{3:3}]},{},[4])(4)}),l=c(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,n="__lfsc__:".length,r=n+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,n=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var r=new ArrayBuffer(t),o=new Uint8Array(r),i=0,a=0;i<n;i+=4){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=u<<2|c>>4,o[a++]=(15&c)<<4|f>>2,o[a++]=(3&f)<<6|63&s}return r}function a(e){for(var t=new Uint8Array(e),n="",r=0;r<t.length;r+=3)n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[r]>>2],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[r])<<4|t[r+1]>>4],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[r+1])<<2|t[r+2]>>6],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[r+2]];return t.length%3==2?n=n.substring(0,n.length-1)+"=":t.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function u(e){var t,n;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var r=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,r[a]=u(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var n=this;if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?c(e,n._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var v={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,n))return JSON.parse(e);var o,a=e.substring(r),u=e.substring(n,r);if("blob"===u&&t.test(a)){var c=a.match(t);o=c[1],a=a.substring(c[0].length)}var f=i(a);switch(u){case"arbf":return f;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}([f],{type:o});case"si08":return new Int8Array(f);case"ui08":return new Uint8Array(f);case"uic8":return new Uint8ClampedArray(f);case"si16":return new Int16Array(f);case"ur16":return new Uint16Array(f);case"si32":return new Int32Array(f);case"ui32":return new Uint32Array(f);case"fl32":return new Float32Array(f);case"fl64":return new Float64Array(f);default:throw new Error("Unkown type: "+u)}},serialize:function(e,t){var n="";if(e&&(n=o.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var r=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(r=e,i+="arbf"):(r=e.buffer,"[object Int8Array]"===n?i+="si08":"[object Uint8Array]"===n?i+="ui08":"[object Uint8ClampedArray]"===n?i+="uic8":"[object Int16Array]"===n?i+="si16":"[object Uint16Array]"===n?i+="ur16":"[object Int32Array]"===n?i+="si32":"[object Uint32Array]"===n?i+="ui32":"[object Float32Array]"===n?i+="fl32":"[object Float64Array]"===n?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(r))}else if("[object Blob]"===n){var u=new FileReader;u.onload=function(){var n="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+n)},u.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},stringToBuffer:i},h={},y=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return h[t]||(h[t]=new e(t)),h[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete h[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?u(e):{},n=c(t,this._defaultConfig),r=y.resolve(n);return this._dbInfo=t,this._dbInfo.serializer=v,this._dbInfo.keyPrefix=n,this._dbInfo.mStore=r,Promise.resolve()},e.clear=function(e){var t=this,n=this.ready().then(function(){t._dbInfo.mStore.clear()});return f(n,e),n},e.dropInstance=function(e,t){var n=l.apply(this,arguments),r=n.promise,o=n.callback;return f(r.then(function(e){y.resolve(e).drop()}),o),r},e.getItem=function(e,t){var n=this;e=d(e);var r=this.ready().then(function(){var t=n._dbInfo.mStore.get(e);return null==t?null:n._dbInfo.serializer.deserialize(t)});return f(r,t),r},e.iterate=function(e,t){var n=this,r=this.ready().then(function(){for(var t=n._dbInfo.mStore,r=t.keys(),o=0;o<r.length;o++){var i=t.get(r[o]);if(i&&(i=n._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,r[o],o+1)))return i}});return f(r,t),r},e.key=function(e,t){var n=this,r=this.ready().then(function(){var t;try{void 0===(t=n._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return f(r,t),r},e.keys=function(e){var t=this,n=this.ready().then(function(){return t._dbInfo.mStore.keys()});return f(n,e),n},e.length=function(e){var t=this.keys().then(function(e){return e.length});return f(t,e),t},e.removeItem=function(e,t){var n=this;e=d(e);var r=this.ready().then(function(){n._dbInfo.mStore.rm(e)});return f(r,t),r},e.setItem=function(e,t,n){var r=this;e=d(e);var o=this.ready().then(function(){void 0===t&&(t=null);var n=t;return new Promise(function(o,i){r._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{r._dbInfo.mStore.set(e,t),o(n)}catch(e){i(e)}})})});return f(o,n),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),d=u(l),v=Object.assign(Object.create(null),l,{default:d});const h={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},y=o(i,{platform:"web",sdkName:"magic-sdk",version:"6.2.0",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends e{constructor(...e){super(...e),this.iframe=void 0,this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(e=>{const t=()=>{if(function(e){const t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(t=>t.src.includes(e)))}(encodeURIComponent(this.parameters)))r().log();else{const t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=n(this.endpoint).host,t.title="Secure Modal",t.src=n(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(const[t,n]of Object.entries(h))e.style[t]=n}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)}),window.addEventListener("message",e=>{if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){var t;e.data.response=null!=(t=e.data.response)?t:{};for(const t of this.messageHandlers.values())t(e)}})}async showOverlay(){const e=await this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}async hideOverlay(){var e;(await this.iframe).style.display="none",null!==(e=this.activeElement)&&void 0!==e&&e.focus&&this.activeElement.focus(),this.activeElement=null}async _post(e){const n=await this.iframe;if(!n||!n.contentWindow)throw t();n.contentWindow.postMessage(e,this.endpoint)}},configureStorage:async()=>{const e=s.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return await e.defineDriver(v),await e.setDriver([s.INDEXEDDB,s.LOCALSTORAGE,l._driver]),e}});export{y as Magic};
|
|
1
|
+
import{ViewController as e,createModalNotReadyError as t,createURL as n,createDuplicateIframeWarning as r,createSDK as o,SDKBase as i}from"@magic-sdk/provider";export*from"@magic-sdk/commons";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){var t={exports:{}};return e(t,t.exports),t.exports}function f(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.')}var s=c(function(e,t){e.exports=function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){if(!u&&f)return f(a);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var s=n[a]={exports:{}};t[a][0].call(s.exports,function(e){return o(t[a][1][e]||e)},s,s.exports,e,t,n,r)}return n[a].exports}for(var i=f,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){(function(e){var n,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(s),u=e.document.createTextNode("");a.observe(u,{characterData:!0}),n=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){s(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(s,0)};else{var c=new e.MessageChannel;c.port1.onmessage=s,n=function(){c.port2.postMessage(0)}}var f=[];function s(){var e,t;r=!0;for(var n=f.length;n;){for(t=f,f=[],e=-1;++e<n;)t[e]();n=f.length}r=!1}t.exports=function(e){1!==f.push(e)||r||n()}}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1);function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function f(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==o&&v(this,e)}function s(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r(function(){var r;try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function v(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=h(function(){t(o,r)});"error"===a.status&&r(a.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=f,f.prototype.catch=function(e){return this.then(null,e)},f.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(o);return this.state!==c?l(n,this.state===u?e:t,this.outcome):this.queue.push(new s(n,e,t)),n},s.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},s.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},s.prototype.callRejected=function(e){i.reject(this.promise,e)},s.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=h(d,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)v(e,r);else{e.state=u,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},f.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},f.reject=function(e){var t=new this(o);return i.reject(t,e)},f.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a=new Array(n),u=0,c=-1,f=new this(o);++c<n;)s(e[c],c);return f;function s(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==n||r||(r=!0,i.resolve(f,a))},function(e){r||(r=!0,i.reject(f,e))})}},f.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var r=-1,a=new this(o);++r<t;)this.resolve(e[r]).then(function(e){n||(n=!0,i.resolve(a,e))},function(e){n||(n=!0,i.reject(a,e))});return a}},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==a?a:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,v={},h=Object.prototype.toString,y="readonly",p="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}function m(e){var t=v[e.name],n={};n.promise=new a(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady=t.dbReady?t.dbReady.then(function(){return n.promise}):n.promise}function g(e){var t=v[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var n=v[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function w(e,t){return new a(function(n,r){if(v[e.name]=v[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);m(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){n(a.result),g(e)}})}function I(e){return w(e,!1)}function S(e){return w(e,!0)}function E(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version>e.db.version;if(e.version<e.db.version&&(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),r||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function A(e){return i([b(atob(e.data))],{type:e.type})}function j(e){return e&&e.__local_forage_encoded_blob}function N(e){var t=this,n=t._initReady().then(function(){var e=v[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(n,e,e),n}function O(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)}).then(function(){return function(e){m(e);for(var t=v[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,E(e)?S(e):t}).then(function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r}).catch(function(t){throw _(e,t),t})}(e).then(function(){O(e,t,n,r-1)})}).catch(n);n(o)}}var B={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=v[n.name];o||(v[n.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=N);var i=[];function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var f=o.forages[c];f!==t&&i.push(f._initReady().catch(u))}var s=o.forages.slice(0);return a.all(i).then(function(){return n.db=o.db,I(n)}).then(function(e){return n.db=e,E(n,t._defaultConfig.version)?S(n):e}).then(function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<s.length;r++){var i=s[r];i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}})},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).openCursor(),u=1;a.onsuccess=function(){var n=a.result;if(n){var r=n.value;j(r)&&(r=A(r));var o=e(r,n.key,u++);void 0!==o?t(o):n.continue()}else t()},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},getItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),j(e)&&(e=A(e)),t(e)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},setItem:function(e,t,n){var r=this;e=f(e);var o=new a(function(n,o){var u;r.ready().then(function(){return u=r._dbInfo,"[object Blob]"===h.call(t)?function(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a(function(t){var n=e.transaction(l,p),r=i([""]);n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return d=e})}(u.db).then(function(e){return e?t:(n=t,new a(function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)}));var n}):t}).then(function(t){O(r._dbInfo,p,function(i,a){if(i)return o(i);try{var u=a.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var c=u.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){o(c.error?c.error:c.transaction.error)}}catch(e){o(e)}})}).catch(o)});return u(o,n),o},removeItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,p,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){r(a.error)},i.onabort=function(){r(a.error?a.error:a.transaction.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,p,function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){n(i.error?i.error:i.transaction.error)}}catch(e){n(e)}})}).catch(n)});return u(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,y,function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){n(i.error)}}catch(e){n(e)}})}).catch(n)});return u(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){e<0?t(null):n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName),u=!1,c=a.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||u?t(n.key):(u=!0,n.advance(e)):t(null)},c.onerror=function(){r(c.error)}}catch(e){r(e)}})}).catch(r)});return u(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,y,function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){n(i.error)}}catch(e){n(e)}})}).catch(n)});return u(n,e),n},dropInstance:function(e,t){t=s.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;if(e.name){var c=e.name===n.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):I(e).then(function(t){var n=v[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t});r=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;m(e);var r=v[e.name],i=r.forages;t.close();for(var u=0;u<i.length;u++){var c=i[u];c._dbInfo.db=null,c._dbInfo.version=n}return new a(function(t,r){var i=o.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,g(n._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){m(e);var n=v[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;return new a(function(t,n){var r=o.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<r.length;t++)g(r[t]._dbInfo)}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else r=a.reject("Invalid arguments");return u(r,t),r}},k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=/^~~local_forage_type~([^~]+)~/,R="__lfsc__:",D=R.length,C="arbf",T="blob",F="si08",L="ui08",z="uic8",M="si16",P="si32",U="ur16",q="ui32",W="fl32",H="fl64",K=D+C.length,J=Object.prototype.toString;function Q(e){var t,n,r,o,i,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var f=new ArrayBuffer(a),s=new Uint8Array(f);for(t=0;t<u;t+=4)n=k.indexOf(e[t]),r=k.indexOf(e[t+1]),o=k.indexOf(e[t+2]),i=k.indexOf(e[t+3]),s[c++]=n<<2|r>>4,s[c++]=(15&r)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return f}function X(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=k[n[t]>>2],r+=k[(3&n[t])<<4|n[t+1]>>4],r+=k[(15&n[t+1])<<2|n[t+2]>>6],r+=k[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var G={serialize:function(e,t){var n="";if(e&&(n=J.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var r,o=R;e instanceof ArrayBuffer?(r=e,o+=C):(r=e.buffer,"[object Int8Array]"===n?o+=F:"[object Uint8Array]"===n?o+=L:"[object Uint8ClampedArray]"===n?o+=z:"[object Int16Array]"===n?o+=M:"[object Uint16Array]"===n?o+=U:"[object Int32Array]"===n?o+=P:"[object Uint32Array]"===n?o+=q:"[object Float32Array]"===n?o+=W:"[object Float64Array]"===n?o+=H:t(new Error("Failed to get type for BinaryArray"))),t(o+X(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n="~~local_forage_type~"+e.type+"~"+X(this.result);t("__lfsc__:blob"+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,D)!==R)return JSON.parse(e);var t,n=e.substring(K),r=e.substring(D,K);if(r===T&&x.test(n)){var o=n.match(x);t=o[1],n=n.substring(o[0].length)}var a=Q(n);switch(r){case C:return a;case T:return i([a],{type:t});case F:return new Int8Array(a);case L:return new Uint8Array(a);case z:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case U:return new Uint16Array(a);case P:return new Int32Array(a);case q:return new Uint32Array(a);case W:return new Float32Array(a);case H:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:Q,bufferToString:X};function V(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Y(e,t,n,r,o,i){e.executeSql(n,r,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,u){u.rows.length?i(e,a):V(e,t,function(){e.executeSql(n,r,o,i)},i)},i):i(e,a)},i)}function Z(e,t,n,r){var o=this;e=f(e);var i=new a(function(i,a){o.ready().then(function(){void 0===t&&(t=null);var u=t,c=o._dbInfo;c.serializer.serialize(t,function(t,f){f?a(f):c.db.transaction(function(n){Y(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){i(u)},function(e,t){a(t)})},function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void i(Z.apply(o,[e,u,n,r-1]));a(t)}})})}).catch(a)});return u(i,n),i}function $(e){return new a(function(t,n){e.transaction(function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name);t({db:e,storeNames:o})},function(e,t){n(t)})},function(e){n(e)})})}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new a(function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction(function(o){V(o,n,function(){t._dbInfo=n,e()},function(e,t){r(t)})},r)});return n.serializer=G,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName,[],function(n,r){for(var i=r.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),f=c.value;if(f&&(f=o.serializer.deserialize(f)),void 0!==(f=e(f,c.key,u+1)))return void t(f)}t()},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},getItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},setItem:function(e,t,n){return Z.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=f(e);var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){Y(t,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)});return u(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){Y(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(t,n){var r=n.rows.item(0).c;e(r)},function(e,t){n(t)})})}).catch(n)});return u(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo;o.db.transaction(function(n){Y(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)},function(e,t){r(t)})})}).catch(r)});return u(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){Y(t,r,"SELECT key FROM "+r.storeName,[],function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)},function(e,t){n(t)})})}).catch(n)});return u(n,e),n},dropInstance:function(e,t){t=s.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return u(r=e.name?new a(function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:r,storeNames:[e.storeName]}:$(r))}).then(function(e){return new a(function(t,n){e.db.transaction(function(r){function o(e){return new a(function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}for(var i=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u]));a.all(i).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):a.reject("Invalid arguments"),t),r}};function te(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}var ne={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=te(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=G,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then(function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,u=0;u<i;u++){var c=localStorage.key(u);if(0===c.indexOf(r)){var f=localStorage.getItem(c);if(f&&(f=t.serializer.deserialize(f)),void 0!==(f=e(f,c.substring(o),a++)))return f}}});return u(r,t),r},getItem:function(e,t){var n=this;e=f(e);var r=n.ready().then(function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r});return u(r,t),r},setItem:function(e,t,n){var r=this;e=f(e);var o=r.ready().then(function(){void 0===t&&(t=null);var n=t;return new a(function(o,i){var a=r._dbInfo;a.serializer.serialize(t,function(t,r){if(r)i(r);else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})});return u(o,n),o},removeItem:function(e,t){var n=this;e=f(e);var r=n.ready().then(function(){localStorage.removeItem(n._dbInfo.keyPrefix+e)});return u(r,t),r},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}});return u(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length});return u(t,e),t},key:function(e,t){var n=this,r=n.ready().then(function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t});return u(r,t),r},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r});return u(n,e),n},dropInstance:function(e,t){if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this;return u(r=e.name?new a(function(t){t(e.storeName?te(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}}):a.reject("Invalid arguments"),t),r}},re=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0;r++}var o,i;return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ue={INDEXEDDB:B,WEBSQL:ee,LOCALSTORAGE:ne},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],se=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),le={description:"",driver:ce.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var n=arguments;return e.ready().then(function(){return e[t].apply(e,n)})}}function ve(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(arguments[0][n]=oe(t[n])?t[n].slice():t[n])}return arguments[0]}var he=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(n)){var r=ue[n],o=r._driver;this[n]=o,ie[o]||this.defineDriver(r)}this._defaultConfig=ve({},le),this._config=ve({},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(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new a(function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var i=se.concat("_initStorage"),c=0,f=i.length;c<f;c++){var s=i[c];if((!re(fe,s)||e[s])&&"function"!=typeof e[s])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t);return u(n,arguments[arguments.length-1]),n}},n=0,r=fe.length;n<r;n++){var o=fe[n];e[o]||(e[o]=t(o))}}();var l=function(n){ie[r]&&console.info("Redefining LocalForage driver: "+r),ie[r]=e,ae[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!0)}catch(e){n(e)}});return c(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ie[e]?a.resolve(ie[e]):a.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(G);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;oe(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){r._config.driver=r.driver()}function u(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var f=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve();return this._driverSet=f.then(function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then(function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(u).catch(n)}i();var c=new Error("No available storage method found.");return r._driverSet=a.reject(c),r._driverSet}()}}(o)})}).catch(function(){i();var e=new Error("No available storage method found.");return r._driverSet=a.reject(e),r._driverSet}),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){ve(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=se.length;e<t;e++)de(this,se[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=he},{3:3}]},{},[4])(4)}),l=c(function(e,t){"undefined"!=typeof self&&self,function(e){var t=/^~~local_forage_type~([^~]+)~/,n="__lfsc__:".length,r=n+"arbf".length,o=Object.prototype.toString;function i(e){var t=.75*e.length,n=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var r=new ArrayBuffer(t),o=new Uint8Array(r),i=0,a=0;i<n;i+=4){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+1]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+2]),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[i+3]);o[a++]=u<<2|c>>4,o[a++]=(15&c)<<4|f>>2,o[a++]=(3&f)<<6|63&s}return r}function a(e){for(var t=new Uint8Array(e),n="",r=0;r<t.length;r+=3)n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[r]>>2],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[r])<<4|t[r+1]>>4],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[r+1])<<2|t[r+2]>>6],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[r+2]];return t.length%3==2?n=n.substring(0,n.length-1)+"=":t.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function u(e){var t,n;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var r=e instanceof Date?new Date(e):e.constructor();try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,r[a]=u(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r}function c(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function l(e,t){var n=this;if(t=s.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?c(e,n._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var v={bufferToString:a,deserialize:function(e){if("__lfsc__:"!==e.substring(0,n))return JSON.parse(e);var o,a=e.substring(r),u=e.substring(n,r);if("blob"===u&&t.test(a)){var c=a.match(t);o=c[1],a=a.substring(c[0].length)}var f=i(a);switch(u){case"arbf":return f;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}([f],{type:o});case"si08":return new Int8Array(f);case"ui08":return new Uint8Array(f);case"uic8":return new Uint8ClampedArray(f);case"si16":return new Int16Array(f);case"ur16":return new Uint16Array(f);case"si32":return new Int32Array(f);case"ui32":return new Uint32Array(f);case"fl32":return new Float32Array(f);case"fl64":return new Float64Array(f);default:throw new Error("Unkown type: "+u)}},serialize:function(e,t){var n="";if(e&&(n=o.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===o.call(e.buffer))){var r=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(r=e,i+="arbf"):(r=e.buffer,"[object Int8Array]"===n?i+="si08":"[object Uint8Array]"===n?i+="ui08":"[object Uint8ClampedArray]"===n?i+="uic8":"[object Int16Array]"===n?i+="si16":"[object Uint16Array]"===n?i+="ur16":"[object Int32Array]"===n?i+="si32":"[object Uint32Array]"===n?i+="ui32":"[object Float32Array]"===n?i+="fl32":"[object Float64Array]"===n?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+a(r))}else if("[object Blob]"===n){var u=new FileReader;u.onload=function(){var n="~~local_forage_type~"+e.type+"~"+a(this.result);t("__lfsc__:blob"+n)},u.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},stringToBuffer:i},h={},y=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return h[t]||(h[t]=new e(t)),h[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete h[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?u(e):{},n=c(t,this._defaultConfig),r=y.resolve(n);return this._dbInfo=t,this._dbInfo.serializer=v,this._dbInfo.keyPrefix=n,this._dbInfo.mStore=r,Promise.resolve()},e.clear=function(e){var t=this,n=this.ready().then(function(){t._dbInfo.mStore.clear()});return f(n,e),n},e.dropInstance=function(e,t){var n=l.apply(this,arguments),r=n.promise,o=n.callback;return f(r.then(function(e){y.resolve(e).drop()}),o),r},e.getItem=function(e,t){var n=this;e=d(e);var r=this.ready().then(function(){var t=n._dbInfo.mStore.get(e);return null==t?null:n._dbInfo.serializer.deserialize(t)});return f(r,t),r},e.iterate=function(e,t){var n=this,r=this.ready().then(function(){for(var t=n._dbInfo.mStore,r=t.keys(),o=0;o<r.length;o++){var i=t.get(r[o]);if(i&&(i=n._dbInfo.serializer.deserialize(i)),void 0!==(i=e(i,r[o],o+1)))return i}});return f(r,t),r},e.key=function(e,t){var n=this,r=this.ready().then(function(){var t;try{void 0===(t=n._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t});return f(r,t),r},e.keys=function(e){var t=this,n=this.ready().then(function(){return t._dbInfo.mStore.keys()});return f(n,e),n},e.length=function(e){var t=this.keys().then(function(e){return e.length});return f(t,e),t},e.removeItem=function(e,t){var n=this;e=d(e);var r=this.ready().then(function(){n._dbInfo.mStore.rm(e)});return f(r,t),r},e.setItem=function(e,t,n){var r=this;e=d(e);var o=this.ready().then(function(){void 0===t&&(t=null);var n=t;return new Promise(function(o,i){r._dbInfo.serializer.serialize(t,function(t,a){if(a)i(a);else try{r._dbInfo.mStore.set(e,t),o(n)}catch(e){i(e)}})})});return f(o,n),o},Object.defineProperty(e,"__esModule",{value:!0})}(t)}),d=u(l),v=Object.assign(Object.create(null),l,{default:d});const h={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"},y=o(i,{platform:"web",sdkName:"magic-sdk",version:"6.2.1",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends e{constructor(...e){super(...e),this.iframe=void 0,this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(e=>{const t=()=>{if(function(e){const t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find(t=>t.src.includes(e)))}(encodeURIComponent(this.parameters)))r().log();else{const t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=n(this.endpoint).host,t.title="Secure Modal",t.src=n(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(const[t,n]of Object.entries(h))e.style[t]=n}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)}),window.addEventListener("message",e=>{if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){var t;e.data.response=null!=(t=e.data.response)?t:{};for(const t of this.messageHandlers.values())t(e)}})}async showOverlay(){const e=await this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}async hideOverlay(){var e;(await this.iframe).style.display="none",null!==(e=this.activeElement)&&void 0!==e&&e.focus&&this.activeElement.focus(),this.activeElement=null}async _post(e){const n=await this.iframe;if(!n||!n.contentWindow)throw t();n.contentWindow.postMessage(e,this.endpoint)}},configureStorage:async()=>{const e=s.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return await e.defineDriver(v),await e.setDriver([s.INDEXEDDB,s.LOCALSTORAGE,l._driver]),e}});export{y as Magic};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magic-sdk",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "Passwordless authentication for the web.",
|
|
5
5
|
"author": "Magic Labs <team@magic.link> (https://magic.link/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@magic-sdk/commons": "^2.2.
|
|
32
|
-
"@magic-sdk/provider": "^6.2.
|
|
31
|
+
"@magic-sdk/commons": "^2.2.1",
|
|
32
|
+
"@magic-sdk/provider": "^6.2.1",
|
|
33
33
|
"@magic-sdk/types": "^5.2.0",
|
|
34
34
|
"localforage": "^1.7.4"
|
|
35
35
|
},
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@babel/runtime": "^7.9.6",
|
|
40
40
|
"localforage-driver-memory": "^1.0.5"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "1d878945f37e143c26b701cf2e4bdc47552d773b"
|
|
43
43
|
}
|