@near-wallet-selector/modal-ui
Version:
Modal UI package for NEAR wallet Selector
5,145 lines • 180 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var client = require('react-dom/client');
var React = require('react');
var core = require('@near-wallet-selector/core');
var QRCode = require('qrcode');
var copy = require('copy-to-clipboard');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode);
var copy__default = /*#__PURE__*/_interopDefaultLegacy(copy);
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var fails$h = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
var fails$g = fails$h;
var functionBindNative = !fails$g(function () {
// eslint-disable-next-line es/no-function-prototype-bind -- safe
var test = (function () { /* empty */ }).bind();
// eslint-disable-next-line no-prototype-builtins -- safe
return typeof test != 'function' || test.hasOwnProperty('prototype');
});
var NATIVE_BIND$3 = functionBindNative;
var FunctionPrototype$2 = Function.prototype;
var call$e = FunctionPrototype$2.call;
// eslint-disable-next-line es/no-function-prototype-bind -- safe
var uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$2.bind.bind(call$e, call$e);
var functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function (fn) {
return function () {
return call$e.apply(fn, arguments);
};
};
var uncurryThis$h = functionUncurryThis;
var toString$5 = uncurryThis$h({}.toString);
var stringSlice$2 = uncurryThis$h(''.slice);
var classofRaw$2 = function (it) {
return stringSlice$2(toString$5(it), 8, -1);
};
var uncurryThis$g = functionUncurryThis;
var fails$f = fails$h;
var classof$6 = classofRaw$2;
var $Object$4 = Object;
var split = uncurryThis$g(''.split);
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var indexedObject = fails$f(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins -- safe
return !$Object$4('z').propertyIsEnumerable(0);
}) ? function (it) {
return classof$6(it) === 'String' ? split(it, '') : $Object$4(it);
} : $Object$4;
// we can't use just `it == null` since of `document.all` special case
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
var isNullOrUndefined$4 = function (it) {
return it === null || it === undefined;
};
var isNullOrUndefined$3 = isNullOrUndefined$4;
var $TypeError$f = TypeError;
// `RequireObjectCoercible` abstract operation
// https://tc39.es/ecma262/#sec-requireobjectcoercible
var requireObjectCoercible$4 = function (it) {
if (isNullOrUndefined$3(it)) throw new $TypeError$f("Can't call method on " + it);
return it;
};
// toObject with fallback for non-array-like ES3 strings
var IndexedObject$2 = indexedObject;
var requireObjectCoercible$3 = requireObjectCoercible$4;
var toIndexedObject$5 = function (it) {
return IndexedObject$2(requireObjectCoercible$3(it));
};
var check = function (it) {
return it && it.Math === Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var globalThis_1 =
// eslint-disable-next-line es/no-global-this -- safe
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
// eslint-disable-next-line no-restricted-globals -- safe
check(typeof self == 'object' && self) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
// eslint-disable-next-line no-new-func -- fallback
(function () { return this; })() || Function('return this')();
var sharedStore = {exports: {}};
var globalThis$k = globalThis_1;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty$6 = Object.defineProperty;
var defineGlobalProperty$3 = function (key, value) {
try {
defineProperty$6(globalThis$k, key, { value: value, configurable: true, writable: true });
} catch (error) {
globalThis$k[key] = value;
} return value;
};
var globalThis$j = globalThis_1;
var defineGlobalProperty$2 = defineGlobalProperty$3;
var SHARED = '__core-js_shared__';
var store$3 = sharedStore.exports = globalThis$j[SHARED] || defineGlobalProperty$2(SHARED, {});
(store$3.versions || (store$3.versions = [])).push({
version: '3.41.0',
mode: 'global',
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
license: 'https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE',
source: 'https://github.com/zloirock/core-js'
});
var store$2 = sharedStore.exports;
var shared$3 = function (key, value) {
return store$2[key] || (store$2[key] = value || {});
};
var requireObjectCoercible$2 = requireObjectCoercible$4;
var $Object$3 = Object;
// `ToObject` abstract operation
// https://tc39.es/ecma262/#sec-toobject
var toObject$5 = function (argument) {
return $Object$3(requireObjectCoercible$2(argument));
};
var uncurryThis$f = functionUncurryThis;
var toObject$4 = toObject$5;
var hasOwnProperty = uncurryThis$f({}.hasOwnProperty);
// `HasOwnProperty` abstract operation
// https://tc39.es/ecma262/#sec-hasownproperty
// eslint-disable-next-line es/no-object-hasown -- safe
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
return hasOwnProperty(toObject$4(it), key);
};
var uncurryThis$e = functionUncurryThis;
var id = 0;
var postfix = Math.random();
var toString$4 = uncurryThis$e(1.0.toString);
var uid$2 = function (key) {
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$4(++id + postfix, 36);
};
var globalThis$i = globalThis_1;
var navigator = globalThis$i.navigator;
var userAgent$7 = navigator && navigator.userAgent;
var environmentUserAgent = userAgent$7 ? String(userAgent$7) : '';
var globalThis$h = globalThis_1;
var userAgent$6 = environmentUserAgent;
var process$3 = globalThis$h.process;
var Deno$1 = globalThis$h.Deno;
var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
var v8 = versions && versions.v8;
var match, version;
if (v8) {
match = v8.split('.');
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
// but their correct versions are not interesting for us
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
}
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
// so check `userAgent` even if `.v8` exists, but 0
if (!version && userAgent$6) {
match = userAgent$6.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = userAgent$6.match(/Chrome\/(\d+)/);
if (match) version = +match[1];
}
}
var environmentV8Version = version;
/* eslint-disable es/no-symbol -- required for testing */
var V8_VERSION$1 = environmentV8Version;
var fails$e = fails$h;
var globalThis$g = globalThis_1;
var $String$5 = globalThis$g.String;
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$e(function () {
var symbol = Symbol('symbol detection');
// Chrome 38 Symbol has incorrect toString conversion
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
// of course, fail.
return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) ||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
});
/* eslint-disable es/no-symbol -- required for testing */
var NATIVE_SYMBOL$2 = symbolConstructorDetection;
var useSymbolAsUid = NATIVE_SYMBOL$2 &&
!Symbol.sham &&
typeof Symbol.iterator == 'symbol';
var globalThis$f = globalThis_1;
var shared$2 = shared$3;
var hasOwn$b = hasOwnProperty_1;
var uid$1 = uid$2;
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
var Symbol$1 = globalThis$f.Symbol;
var WellKnownSymbolsStore = shared$2('wks');
var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
var wellKnownSymbol$g = function (name) {
if (!hasOwn$b(WellKnownSymbolsStore, name)) {
WellKnownSymbolsStore[name] = NATIVE_SYMBOL$1 && hasOwn$b(Symbol$1, name)
? Symbol$1[name]
: createWellKnownSymbol('Symbol.' + name);
} return WellKnownSymbolsStore[name];
};
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
var documentAll = typeof document == 'object' && document.all;
// `IsCallable` abstract operation
// https://tc39.es/ecma262/#sec-iscallable
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
var isCallable$k = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
return typeof argument == 'function' || argument === documentAll;
} : function (argument) {
return typeof argument == 'function';
};
var isCallable$j = isCallable$k;
var isObject$b = function (it) {
return typeof it == 'object' ? it !== null : isCallable$j(it);
};
var isObject$a = isObject$b;
var $String$4 = String;
var $TypeError$e = TypeError;
// `Assert: Type(argument) is Object`
var anObject$b = function (argument) {
if (isObject$a(argument)) return argument;
throw new $TypeError$e($String$4(argument) + ' is not an object');
};
var objectDefineProperties = {};
var fails$d = fails$h;
// Detect IE8's incomplete defineProperty implementation
var descriptors = !fails$d(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
});
var DESCRIPTORS$c = descriptors;
var fails$c = fails$h;
// V8 ~ Chrome 36-
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
var v8PrototypeDefineBug = DESCRIPTORS$c && fails$c(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
value: 42,
writable: false
}).prototype !== 42;
});
var objectDefineProperty = {};
var globalThis$e = globalThis_1;
var isObject$9 = isObject$b;
var document$3 = globalThis$e.document;
// typeof document.createElement is 'object' in old IE
var EXISTS$1 = isObject$9(document$3) && isObject$9(document$3.createElement);
var documentCreateElement$2 = function (it) {
return EXISTS$1 ? document$3.createElement(it) : {};
};
var DESCRIPTORS$b = descriptors;
var fails$b = fails$h;
var createElement$1 = documentCreateElement$2;
// Thanks to IE8 for its funny defineProperty
var ie8DomDefine = !DESCRIPTORS$b && !fails$b(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty(createElement$1('div'), 'a', {
get: function () { return 7; }
}).a !== 7;
});
var NATIVE_BIND$2 = functionBindNative;
var call$d = Function.prototype.call;
// eslint-disable-next-line es/no-function-prototype-bind -- safe
var functionCall = NATIVE_BIND$2 ? call$d.bind(call$d) : function () {
return call$d.apply(call$d, arguments);
};
var globalThis$d = globalThis_1;
var isCallable$i = isCallable$k;
var aFunction = function (argument) {
return isCallable$i(argument) ? argument : undefined;
};
var getBuiltIn$7 = function (namespace, method) {
return arguments.length < 2 ? aFunction(globalThis$d[namespace]) : globalThis$d[namespace] && globalThis$d[namespace][method];
};
var uncurryThis$d = functionUncurryThis;
var objectIsPrototypeOf = uncurryThis$d({}.isPrototypeOf);
var getBuiltIn$6 = getBuiltIn$7;
var isCallable$h = isCallable$k;
var isPrototypeOf$4 = objectIsPrototypeOf;
var USE_SYMBOL_AS_UID = useSymbolAsUid;
var $Object$2 = Object;
var isSymbol$2 = USE_SYMBOL_AS_UID ? function (it) {
return typeof it == 'symbol';
} : function (it) {
var $Symbol = getBuiltIn$6('Symbol');
return isCallable$h($Symbol) && isPrototypeOf$4($Symbol.prototype, $Object$2(it));
};
var $String$3 = String;
var tryToString$5 = function (argument) {
try {
return $String$3(argument);
} catch (error) {
return 'Object';
}
};
var isCallable$g = isCallable$k;
var tryToString$4 = tryToString$5;
var $TypeError$d = TypeError;
// `Assert: IsCallable(argument) is true`
var aCallable$a = function (argument) {
if (isCallable$g(argument)) return argument;
throw new $TypeError$d(tryToString$4(argument) + ' is not a function');
};
var aCallable$9 = aCallable$a;
var isNullOrUndefined$2 = isNullOrUndefined$4;
// `GetMethod` abstract operation
// https://tc39.es/ecma262/#sec-getmethod
var getMethod$3 = function (V, P) {
var func = V[P];
return isNullOrUndefined$2(func) ? undefined : aCallable$9(func);
};
var call$c = functionCall;
var isCallable$f = isCallable$k;
var isObject$8 = isObject$b;
var $TypeError$c = TypeError;
// `OrdinaryToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
var ordinaryToPrimitive$1 = function (input, pref) {
var fn, val;
if (pref === 'string' && isCallable$f(fn = input.toString) && !isObject$8(val = call$c(fn, input))) return val;
if (isCallable$f(fn = input.valueOf) && !isObject$8(val = call$c(fn, input))) return val;
if (pref !== 'string' && isCallable$f(fn = input.toString) && !isObject$8(val = call$c(fn, input))) return val;
throw new $TypeError$c("Can't convert object to primitive value");
};
var call$b = functionCall;
var isObject$7 = isObject$b;
var isSymbol$1 = isSymbol$2;
var getMethod$2 = getMethod$3;
var ordinaryToPrimitive = ordinaryToPrimitive$1;
var wellKnownSymbol$f = wellKnownSymbol$g;
var $TypeError$b = TypeError;
var TO_PRIMITIVE = wellKnownSymbol$f('toPrimitive');
// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
var toPrimitive$1 = function (input, pref) {
if (!isObject$7(input) || isSymbol$1(input)) return input;
var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
var result;
if (exoticToPrim) {
if (pref === undefined) pref = 'default';
result = call$b(exoticToPrim, input, pref);
if (!isObject$7(result) || isSymbol$1(result)) return result;
throw new $TypeError$b("Can't convert object to primitive value");
}
if (pref === undefined) pref = 'number';
return ordinaryToPrimitive(input, pref);
};
var toPrimitive = toPrimitive$1;
var isSymbol = isSymbol$2;
// `ToPropertyKey` abstract operation
// https://tc39.es/ecma262/#sec-topropertykey
var toPropertyKey$2 = function (argument) {
var key = toPrimitive(argument, 'string');
return isSymbol(key) ? key : key + '';
};
var DESCRIPTORS$a = descriptors;
var IE8_DOM_DEFINE$1 = ie8DomDefine;
var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
var anObject$a = anObject$b;
var toPropertyKey$1 = toPropertyKey$2;
var $TypeError$a = TypeError;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
var ENUMERABLE = 'enumerable';
var CONFIGURABLE$1 = 'configurable';
var WRITABLE = 'writable';
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
anObject$a(O);
P = toPropertyKey$1(P);
anObject$a(Attributes);
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
var current = $getOwnPropertyDescriptor$1(O, P);
if (current && current[WRITABLE]) {
O[P] = Attributes.value;
Attributes = {
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
writable: false
};
}
} return $defineProperty(O, P, Attributes);
} : $defineProperty : function defineProperty(O, P, Attributes) {
anObject$a(O);
P = toPropertyKey$1(P);
anObject$a(Attributes);
if (IE8_DOM_DEFINE$1) try {
return $defineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$a('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var ceil = Math.ceil;
var floor$1 = Math.floor;
// `Math.trunc` method
// https://tc39.es/ecma262/#sec-math.trunc
// eslint-disable-next-line es/no-math-trunc -- safe
var mathTrunc = Math.trunc || function trunc(x) {
var n = +x;
return (n > 0 ? floor$1 : ceil)(n);
};
var trunc = mathTrunc;
// `ToIntegerOrInfinity` abstract operation
// https://tc39.es/ecma262/#sec-tointegerorinfinity
var toIntegerOrInfinity$2 = function (argument) {
var number = +argument;
// eslint-disable-next-line no-self-compare -- NaN check
return number !== number || number === 0 ? 0 : trunc(number);
};
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
var max = Math.max;
var min$1 = Math.min;
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
var toAbsoluteIndex$1 = function (index, length) {
var integer = toIntegerOrInfinity$1(index);
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
};
var toIntegerOrInfinity = toIntegerOrInfinity$2;
var min = Math.min;
// `ToLength` abstract operation
// https://tc39.es/ecma262/#sec-tolength
var toLength$1 = function (argument) {
var len = toIntegerOrInfinity(argument);
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};
var toLength = toLength$1;
// `LengthOfArrayLike` abstract operation
// https://tc39.es/ecma262/#sec-lengthofarraylike
var lengthOfArrayLike$4 = function (obj) {
return toLength(obj.length);
};
var toIndexedObject$4 = toIndexedObject$5;
var toAbsoluteIndex = toAbsoluteIndex$1;
var lengthOfArrayLike$3 = lengthOfArrayLike$4;
// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod$1 = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIndexedObject$4($this);
var length = lengthOfArrayLike$3(O);
if (length === 0) return !IS_INCLUDES && -1;
var index = toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare -- NaN check
if (IS_INCLUDES && el !== el) while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare -- NaN check
if (value !== value) return true;
// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) {
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
var arrayIncludes = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: createMethod$1(true),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: createMethod$1(false)
};
var hiddenKeys$4 = {};
var uncurryThis$c = functionUncurryThis;
var hasOwn$a = hasOwnProperty_1;
var toIndexedObject$3 = toIndexedObject$5;
var indexOf = arrayIncludes.indexOf;
var hiddenKeys$3 = hiddenKeys$4;
var push$1 = uncurryThis$c([].push);
var objectKeysInternal = function (object, names) {
var O = toIndexedObject$3(object);
var i = 0;
var result = [];
var key;
for (key in O) !hasOwn$a(hiddenKeys$3, key) && hasOwn$a(O, key) && push$1(result, key);
// Don't enum bug & hidden keys
while (names.length > i) if (hasOwn$a(O, key = names[i++])) {
~indexOf(result, key) || push$1(result, key);
}
return result;
};
// IE8- don't enum bug keys
var enumBugKeys$3 = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
var internalObjectKeys$1 = objectKeysInternal;
var enumBugKeys$2 = enumBugKeys$3;
// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
// eslint-disable-next-line es/no-object-keys -- safe
var objectKeys$2 = Object.keys || function keys(O) {
return internalObjectKeys$1(O, enumBugKeys$2);
};
var DESCRIPTORS$9 = descriptors;
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
var definePropertyModule$3 = objectDefineProperty;
var anObject$9 = anObject$b;
var toIndexedObject$2 = toIndexedObject$5;
var objectKeys$1 = objectKeys$2;
// `Object.defineProperties` method
// https://tc39.es/ecma262/#sec-object.defineproperties
// eslint-disable-next-line es/no-object-defineproperties -- safe
objectDefineProperties.f = DESCRIPTORS$9 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
anObject$9(O);
var props = toIndexedObject$2(Properties);
var keys = objectKeys$1(Properties);
var length = keys.length;
var index = 0;
var key;
while (length > index) definePropertyModule$3.f(O, key = keys[index++], props[key]);
return O;
};
var getBuiltIn$5 = getBuiltIn$7;
var html$2 = getBuiltIn$5('document', 'documentElement');
var shared$1 = shared$3;
var uid = uid$2;
var keys = shared$1('keys');
var sharedKey$3 = function (key) {
return keys[key] || (keys[key] = uid(key));
};
/* global ActiveXObject -- old IE, WSH */
var anObject$8 = anObject$b;
var definePropertiesModule = objectDefineProperties;
var enumBugKeys$1 = enumBugKeys$3;
var hiddenKeys$2 = hiddenKeys$4;
var html$1 = html$2;
var documentCreateElement$1 = documentCreateElement$2;
var sharedKey$2 = sharedKey$3;
var GT = '>';
var LT = '<';
var PROTOTYPE = 'prototype';
var SCRIPT = 'script';
var IE_PROTO$1 = sharedKey$2('IE_PROTO');
var EmptyConstructor = function () { /* empty */ };
var scriptTag = function (content) {
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
};
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
var NullProtoObjectViaActiveX = function (activeXDocument) {
activeXDocument.write(scriptTag(''));
activeXDocument.close();
var temp = activeXDocument.parentWindow.Object;
// eslint-disable-next-line no-useless-assignment -- avoid memory leak
activeXDocument = null;
return temp;
};
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var NullProtoObjectViaIFrame = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = documentCreateElement$1('iframe');
var JS = 'java' + SCRIPT + ':';
var iframeDocument;
iframe.style.display = 'none';
html$1.appendChild(iframe);
// https://github.com/zloirock/core-js/issues/475
iframe.src = String(JS);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
return iframeDocument.F;
};
// Check for document.domain and active x support
// No need to use active x approach when document.domain is not set
// see https://github.com/es-shims/es5-shim/issues/150
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
// avoid IE GC bug
var activeXDocument;
var NullProtoObject = function () {
try {
activeXDocument = new ActiveXObject('htmlfile');
} catch (error) { /* ignore */ }
NullProtoObject = typeof document != 'undefined'
? document.domain && activeXDocument
? NullProtoObjectViaActiveX(activeXDocument) // old IE
: NullProtoObjectViaIFrame()
: NullProtoObjectViaActiveX(activeXDocument); // WSH
var length = enumBugKeys$1.length;
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys$1[length]];
return NullProtoObject();
};
hiddenKeys$2[IE_PROTO$1] = true;
// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
// eslint-disable-next-line es/no-object-create -- safe
var objectCreate = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
EmptyConstructor[PROTOTYPE] = anObject$8(O);
result = new EmptyConstructor();
EmptyConstructor[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO$1] = O;
} else result = NullProtoObject();
return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
};
var wellKnownSymbol$e = wellKnownSymbol$g;
var create$1 = objectCreate;
var defineProperty$5 = objectDefineProperty.f;
var UNSCOPABLES = wellKnownSymbol$e('unscopables');
var ArrayPrototype$1 = Array.prototype;
// Array.prototype[@@unscopables]
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
if (ArrayPrototype$1[UNSCOPABLES] === undefined) {
defineProperty$5(ArrayPrototype$1, UNSCOPABLES, {
configurable: true,
value: create$1(null)
});
}
// add a key to Array.prototype[@@unscopables]
var addToUnscopables$2 = function (key) {
ArrayPrototype$1[UNSCOPABLES][key] = true;
};
var iterators = {};
var globalThis$c = globalThis_1;
var isCallable$e = isCallable$k;
var WeakMap$1 = globalThis$c.WeakMap;
var weakMapBasicDetection = isCallable$e(WeakMap$1) && /native code/.test(String(WeakMap$1));
var createPropertyDescriptor$3 = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var DESCRIPTORS$8 = descriptors;
var definePropertyModule$2 = objectDefineProperty;
var createPropertyDescriptor$2 = createPropertyDescriptor$3;
var createNonEnumerableProperty$4 = DESCRIPTORS$8 ? function (object, key, value) {
return definePropertyModule$2.f(object, key, createPropertyDescriptor$2(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var NATIVE_WEAK_MAP = weakMapBasicDetection;
var globalThis$b = globalThis_1;
var isObject$6 = isObject$b;
var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
var hasOwn$9 = hasOwnProperty_1;
var shared = sharedStore.exports;
var sharedKey$1 = sharedKey$3;
var hiddenKeys$1 = hiddenKeys$4;
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
var TypeError$2 = globalThis$b.TypeError;
var WeakMap = globalThis$b.WeakMap;
var set$1, get, has;
var enforce = function (it) {
return has(it) ? get(it) : set$1(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject$6(it) || (state = get(it)).type !== TYPE) {
throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
if (NATIVE_WEAK_MAP || shared.state) {
var store$1 = shared.state || (shared.state = new WeakMap());
/* eslint-disable no-self-assign -- prototype methods protection */
store$1.get = store$1.get;
store$1.has = store$1.has;
store$1.set = store$1.set;
/* eslint-enable no-self-assign -- prototype methods protection */
set$1 = function (it, metadata) {
if (store$1.has(it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
store$1.set(it, metadata);
return metadata;
};
get = function (it) {
return store$1.get(it) || {};
};
has = function (it) {
return store$1.has(it);
};
} else {
var STATE = sharedKey$1('state');
hiddenKeys$1[STATE] = true;
set$1 = function (it, metadata) {
if (hasOwn$9(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
createNonEnumerableProperty$3(it, STATE, metadata);
return metadata;
};
get = function (it) {
return hasOwn$9(it, STATE) ? it[STATE] : {};
};
has = function (it) {
return hasOwn$9(it, STATE);
};
}
var internalState = {
set: set$1,
get: get,
has: has,
enforce: enforce,
getterFor: getterFor
};
var objectGetOwnPropertyDescriptor = {};
var objectPropertyIsEnumerable = {};
var $propertyIsEnumerable = {}.propertyIsEnumerable;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor$2(this, V);
return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable;
var DESCRIPTORS$7 = descriptors;
var call$a = functionCall;
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
var createPropertyDescriptor$1 = createPropertyDescriptor$3;
var toIndexedObject$1 = toIndexedObject$5;
var toPropertyKey = toPropertyKey$2;
var hasOwn$8 = hasOwnProperty_1;
var IE8_DOM_DEFINE = ie8DomDefine;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$7 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject$1(O);
P = toPropertyKey(P);
if (IE8_DOM_DEFINE) try {
return $getOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (hasOwn$8(O, P)) return createPropertyDescriptor$1(!call$a(propertyIsEnumerableModule$1.f, O, P), O[P]);
};
var makeBuiltIn$3 = {exports: {}};
var DESCRIPTORS$6 = descriptors;
var hasOwn$7 = hasOwnProperty_1;
var FunctionPrototype$1 = Function.prototype;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getDescriptor = DESCRIPTORS$6 && Object.getOwnPropertyDescriptor;
var EXISTS = hasOwn$7(FunctionPrototype$1, 'name');
// additional protection from minified / mangled / dropped function names
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
var CONFIGURABLE = EXISTS && (!DESCRIPTORS$6 || (DESCRIPTORS$6 && getDescriptor(FunctionPrototype$1, 'name').configurable));
var functionName = {
EXISTS: EXISTS,
PROPER: PROPER,
CONFIGURABLE: CONFIGURABLE
};
var uncurryThis$b = functionUncurryThis;
var isCallable$d = isCallable$k;
var store = sharedStore.exports;
var functionToString = uncurryThis$b(Function.toString);
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
if (!isCallable$d(store.inspectSource)) {
store.inspectSource = function (it) {
return functionToString(it);
};
}
var inspectSource$3 = store.inspectSource;
var uncurryThis$a = functionUncurryThis;
var fails$a = fails$h;
var isCallable$c = isCallable$k;
var hasOwn$6 = hasOwnProperty_1;
var DESCRIPTORS$5 = descriptors;
var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
var inspectSource$2 = inspectSource$3;
var InternalStateModule$2 = internalState;
var enforceInternalState = InternalStateModule$2.enforce;
var getInternalState$1 = InternalStateModule$2.get;
var $String$2 = String;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty$4 = Object.defineProperty;
var stringSlice$1 = uncurryThis$a(''.slice);
var replace$1 = uncurryThis$a(''.replace);
var join = uncurryThis$a([].join);
var CONFIGURABLE_LENGTH = DESCRIPTORS$5 && !fails$a(function () {
return defineProperty$4(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
});
var TEMPLATE = String(String).split('String');
var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
if (stringSlice$1($String$2(name), 0, 7) === 'Symbol(') {
name = '[' + replace$1($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
}
if (options && options.getter) name = 'get ' + name;
if (options && options.setter) name = 'set ' + name;
if (!hasOwn$6(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
if (DESCRIPTORS$5) defineProperty$4(value, 'name', { value: name, configurable: true });
else value.name = name;
}
if (CONFIGURABLE_LENGTH && options && hasOwn$6(options, 'arity') && value.length !== options.arity) {
defineProperty$4(value, 'length', { value: options.arity });
}
try {
if (options && hasOwn$6(options, 'constructor') && options.constructor) {
if (DESCRIPTORS$5) defineProperty$4(value, 'prototype', { writable: false });
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
} else if (value.prototype) value.prototype = undefined;
} catch (error) { /* empty */ }
var state = enforceInternalState(value);
if (!hasOwn$6(state, 'source')) {
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
} return value;
};
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
// eslint-disable-next-line no-extend-native -- required
Function.prototype.toString = makeBuiltIn$2(function toString() {
return isCallable$c(this) && getInternalState$1(this).source || inspectSource$2(this);
}, 'toString');
var isCallable$b = isCallable$k;
var definePropertyModule$1 = objectDefineProperty;
var makeBuiltIn$1 = makeBuiltIn$3.exports;
var defineGlobalProperty$1 = defineGlobalProperty$3;
var defineBuiltIn$6 = function (O, key, value, options) {
if (!options) options = {};
var simple = options.enumerable;
var name = options.name !== undefined ? options.name : key;
if (isCallable$b(value)) makeBuiltIn$1(value, name, options);
if (options.global) {
if (simple) O[key] = value;
else defineGlobalProperty$1(key, value);
} else {
try {
if (!options.unsafe) delete O[key];
else if (O[key]) simple = true;
} catch (error) { /* empty */ }
if (simple) O[key] = value;
else definePropertyModule$1.f(O, key, {
value: value,
enumerable: false,
configurable: !options.nonConfigurable,
writable: !options.nonWritable
});
} return O;
};
var objectGetOwnPropertyNames = {};
var internalObjectKeys = objectKeysInternal;
var enumBugKeys = enumBugKeys$3;
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return internalObjectKeys(O, hiddenKeys);
};
var objectGetOwnPropertySymbols = {};
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
var getBuiltIn$4 = getBuiltIn$7;
var uncurryThis$9 = functionUncurryThis;
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
var anObject$7 = anObject$b;
var concat$1 = uncurryThis$9([].concat);
// all object keys, includes non-enumerable and symbols
var ownKeys$1 = getBuiltIn$4('Reflect', 'ownKeys') || function ownKeys(it) {
var keys = getOwnPropertyNamesModule.f(anObject$7(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
};
var hasOwn$5 = hasOwnProperty_1;
var ownKeys = ownKeys$1;
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
var definePropertyModule = objectDefineProperty;
var copyConstructorProperties$2 = function (target, source, exceptions) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!hasOwn$5(target, key) && !(exceptions && hasOwn$5(exceptions, key))) {
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
}
};
var fails$9 = fails$h;
var isCallable$a = isCallable$k;
var replacement = /#|\.prototype\./;
var isForced$2 = function (feature, detection) {
var value = data[normalize(feature)];
return value === POLYFILL ? true
: value === NATIVE ? false
: isCallable$a(detection) ? fails$9(detection)
: !!detection;
};
var normalize = isForced$2.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced$2.data = {};
var NATIVE = isForced$2.NATIVE = 'N';
var POLYFILL = isForced$2.POLYFILL = 'P';
var isForced_1 = isForced$2;
var globalThis$a = globalThis_1;
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
var defineBuiltIn$5 = defineBuiltIn$6;
var defineGlobalProperty = defineGlobalProperty$3;
var copyConstructorProperties$1 = copyConstructorProperties$2;
var isForced$1 = isForced_1;
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.dontCallGetSet - prevent calling a getter on target
options.name - the .name of the function if it does not match the key
*/
var _export = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = globalThis$a;
} else if (STATIC) {
target = globalThis$a[TARGET] || defineGlobalProperty(TARGET, {});
} else {
target = globalThis$a[TARGET] && globalThis$a[TARGET].prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.dontCallGetSet) {
descriptor = getOwnPropertyDescriptor$1(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contained in target
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty == typeof targetProperty) continue;
copyConstructorProperties$1(sourceProperty, targetProperty);
}
// add a flag to not completely full polyfills
if (options.sham || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty$2(sourceProperty, 'sham', true);
}
defineBuiltIn$5(target, key, sourceProperty, options);
}
};
var fails$8 = fails$h;
var correctPrototypeGetter = !fails$8(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
return Object.getPrototypeOf(new F()) !== F.prototype;
});
var hasOwn$4 = hasOwnProperty_1;
var isCallable$9 = isCallable$k;
var toObject$3 = toObject$5;
var sharedKey = sharedKey$3;
var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
var IE_PROTO = sharedKey('IE_PROTO');
var $Object$1 = Object;
var ObjectPrototype = $Object$1.prototype;
// `Object.getPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.getprototypeof
// eslint-disable-next-line es/no-object-getprototypeof -- safe
var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
var object = toObject$3(O);
if (hasOwn$4(object, IE_PROTO)) return object[IE_PROTO];
var constructor = object.constructor;
if (isCallable$9(constructor) && object instanceof constructor) {
return constructor.prototype;
} return object instanceof $Object$1 ? ObjectPrototype : null;
};
var fails$7 = fails$h;
var isCallable$8 = isCallable$k;
var isObject$5 = isObject$b;
var getPrototypeOf$1 = objectGetPrototypeOf;
var defineBuiltIn$4 = defineBuiltIn$6;
var wellKnownSymbol$d = wellKnownSymbol$g;
var ITERATOR$5 = wellKnownSymbol$d('iterator');
var BUGGY_SAFARI_ITERATORS$1 = false;
// `%IteratorPrototype%` object
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
/* eslint-disable es/no-array-prototype-keys -- safe */
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
else {
PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
}
}
var NEW_ITERATOR_PROTOTYPE = !isObject$5(IteratorPrototype$2) || fails$7(function () {
var test = {};
// FF44- legacy iterators case
return IteratorPrototype$2[ITERATOR$5].call(test) !== test;
});
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
// `%IteratorPrototype%[@@iterator]()` method
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
if (!isCallable$8(IteratorPrototype$2[ITERATOR$5])) {
defineBuiltIn$4(IteratorPrototype$2, ITERATOR$5, function () {
return this;
});
}
var iteratorsCore = {
IteratorPrototype: IteratorPrototype$2,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
};
var defineProperty$3 = objectDefineProperty.f;
var hasOwn$3 = hasOwnProperty_1;
var wellKnownSymbol$c = wellKnownSymbol$g;
var TO_STRING_TAG$2 = wellKnownSymbol$c('toStringTag');
var setToStringTag$4 = function (target, TAG, STATIC) {
if (target && !STATIC) target = target.prototype;
if (target && !hasOwn$3(target, TO_STRING_TAG$2)) {
defineProperty$3(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
}
};
var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
var create = objectCreate;
var createPropertyDescriptor = createPropertyDescriptor$3;
var setToStringTag$3 = setToStringTag$4;
var Iterators$4 = iterators;
var returnThis$1 = function () { return this; };
var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
var TO_STRING_TAG = NAME + ' Iterator';
IteratorConstructor.prototype = create(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
setToStringTag$3(IteratorConstructor, TO_STRING_TAG, false);
Iterators$4[TO_STRING_TAG] = returnThis$1;
return IteratorConstructor;
};
var uncurryThis$8 = functionUncurryThis;
var aCallable$8 = aCallable$a;
var functionUncurryThisAccessor = function (object, key, method) {
try {
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
return uncurryThis$8(aCallable$8(Object.getOwnPropertyDescriptor(object, key)[method]));
} catch (error) { /* empty */ }
};
var isObject$4 = isObject$b;
var isPossiblePrototype$1 = function (argument) {
return isObject$4(argument) || argument === null;
};
var isPossiblePrototype = isPossiblePrototype$1;
var $String$1 = String;
var $TypeError$9 = TypeError;
var aPossiblePrototype$1 = function (argument) {
if (isPossiblePrototype(argument)) return argument;
throw new $TypeError$9("Can't set " + $String$1(argument) + ' as a prototype');
};
/* eslint-disable no-proto -- safe */
var uncurryThisAccessor = functionUncurryThisAccessor;
var isObject$3 = isObject$b;
var requireObjectCoercible$1 = requireObjectCoercible$4;
var aPossiblePrototype = aPossiblePrototype$1;
// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
// eslint-disable-next-line es/no-object-setprototypeof -- safe
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var CORRECT_SETTER = false;
var test = {};
var setter;
try {
setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
setter(test, []);
CORRECT_SETTER = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
requireObjectCoercible$1(O);
aPossiblePrototype(proto);
if (!isObject$3(O)) return O;
if (CORRECT_SETTER) setter(O, proto);
else O.__proto__ = proto;
return O;
};
}() : undefined);
var $$c = _export;
var call$9 = functionCall;
var FunctionName = functionName;
var isCallable$7 = isCallable$k;
var createIteratorConstructor = iteratorCreateConstructor;
var getPrototypeOf = objectGetPrototypeOf;
var setPrototypeOf$1 = objectSetPrototypeOf;
var setToStringTag$2 = setToStringTag$4;
var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
var defineBuiltIn$3 = defineBuiltIn$6;
var wellKnownSymbol$b = wellKnownSymbol$g;
var Iterators$3 = iterators;
var IteratorsCore = iteratorsCore;
var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER;
var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
var IteratorPrototype = IteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
var ITERATOR$4 = wellKnownSymbol$b('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';
var returnThis = function () { return this; };
var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
createIteratorConstructor(IteratorConstructor, NAME, next);
var getIterationMethod = function (KIND) {
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
switch (KIND) {
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
}
return function () { return new IteratorConstructor(this); };
};
var TO_STRING_TAG = NAME + ' Iterator';
var INCORRECT_VALUES_NAME = false;
var IterablePrototype = Iterable.prototype;
var nativeIterator = IterablePrototype[ITERATOR$4]
|| IterablePrototype['@@iterator']
|| DEFAULT && IterablePrototype[DEFAULT];
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
var CurrentIteratorPrototype, methods, KEY;
// fix native
if (anyNativeIterator) {
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
if (setPrototypeOf$1) {
setPrototypeOf$1(CurrentIteratorPrototype, IteratorPrototype);
} else if (!isCallable$7(CurrentIteratorPrototype[ITERATOR$4])) {
defineBuiltIn$3(CurrentIteratorPrototype, ITERATOR$4, returnThis);
}
}
// Set @@toStringTag to native iterators
setToStringTag$2(CurrentIteratorPrototype, TO_STRING_TAG, true);
}
}
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
if (PROPER_FUNCTION_NAME$1 && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
if (CONFIGURABLE_FUNCTION_NAME) {
createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
} else {
INCORRECT_VALUES_NAME = true;
defaultIterator = function values() { return call$9(nativeIterator, this); };
}
}
// export additional methods
if (DEFAULT) {
methods = {
values: getIterationMethod(VALUES),
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
entries: getIterationMethod(ENTRIES)
};
if (FORCED) for (KEY in methods) {
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
defineBuiltIn$3(IterablePrototype, KEY, methods[KEY]);
}
} else $$c({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
}
// define iterator
if (IterablePrototype[ITERATOR$4] !== defaultIterator) {
defineBuiltIn$3(IterablePrototype, ITERATOR$4, defaultIterator, { name: DEFAULT });
}
Iterators$3[NAME] = defaultIterator;
return methods;
};
// `CreateIterResultObject` abstract operation
// https://tc39.es/ecma262/#sec-createiterresultobject
var createIterResultObject$1 = function (value, done) {
return { value: value, done: done };
};
var toIndexedObject = toIndexedObject$5;
var addToUnscopables$1 = addToUnscopables$2;
var Iterators$2 = iterators;
var InternalStateModule$1 = internalState;
var defineProperty$2 = objectDefineProperty.f;
var defineIterator = iteratorDefine;
var createIterResultObject = createIterResultObject$1;
var DESCRIPTORS$4 = descriptors;
var ARRAY_ITERATOR = 'Array Iterator';
var setInternalState$1 = InternalStateModule$1.set;
var getInternalState = InternalStateModule$1.getterFor(ARRAY_ITERATOR);
// `Array.prototype.entries` method
// https://tc39.es/ecma262/#sec-array.prototype.entries
// `Array.prototype.keys` method
// https://tc39.es/ecma262/#sec-array.prototype.keys
// `Array.prototype.values` method
// https://tc39.es/ecma262/#sec-array.prototype.values
// `Array.prototype[@@iterator]` method
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
// `CreateArrayIterator` internal method
// https://tc39.es/ecma262/#sec-createarrayiterator
var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
setInternalState$1(this, {
type: ARRAY_ITERATOR,
target: toIndexedObject(iterated), // target
index: 0, // next index
kind: kind // kind
});
// `%ArrayIteratorPrototype%.next` method
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
}, function () {
var state = getInternalState(this);
var target = state.target;
var index = state.index++;
if (!target || index >= target.length) {
state.target = null;
return createIterResultObject(undefined, true);
}
switch (state.kind) {
case 'keys': return createIterResultObject(index, false);
case 'values': return createIterResultObject(target[index], false);
} return createIterResultObject([index, target[index]], false);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values%
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
// https://tc39.es/ecma262/#sec-createmappedargumentsobject
var values = Iterators$2.Arguments = Iterators$2.Array;
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables$1('keys');
addToUnscopables$1('values');
addToUnscopables$1('entries');
// V8 ~ Chrome 45- bug
if (DESCRIPTORS$4 && values.name !== 'values') try {
defineProperty$2(values, 'name', { value: 'values' });
} catch (error) { /* empty */ }
var DESCRIPTORS$3 = descriptors;
var uncurryThis$7 = functionUncurryThis;
var call$8 = functionCall;
var fails$6 = fails$h;
var objectKeys = objectKeys$2;
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
var toObject$2 = toObject$5;
var IndexedObject$1 = indexedObject;
// eslint-disable-next-line es/no-object-assign -- safe
var $assign = Object.assign;
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
var defineProperty$1 = Object.defineProperty;
var concat = uncurryThis$7([].concat);
// `Object.assign` method
// https://tc39.es/ecma262/#sec-object.assign
var objectAssign = !$assign || fails$6(function () {
// should have correct order of operations (Edge bug)
if (DESCRIPTORS$3 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
enumerable: true,
get: function () {
defineProperty$1(this, 'b', {
value: 3,
enumerable: false
});
}
}), { b: 2 })).b !== 1) return true;
// should work with symbols and should have deterministic property order (V8 bug)
var A = {};
var B = {};
// eslint-disable-next-line es/no-symbol -- safe
var symbol = Symbol('assign detection');
var alphabet = 'abcdefghijklmnopqrst';
A[symbol] = 7;
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
var T = toObject$2(target);
var argumentsLength = arguments.length;
var index = 1;
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
var propertyIsEnumerable = propertyIsEnumerableModule.f;
while (argumentsLength > index) {
var S = IndexedObject$1(arguments[index++]);
var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
var length = keys.length;
var j = 0;
var key;
while (length > j) {
key = keys[j++];
if (!DESCRIPTORS$3 || call$8(propertyIsEnumerable, S, key)) T[key] = S[key];
}
} return T;
} : $assign;
var $$b = _export;
var assign = objectAssign;
// `Object.assign` method
// https://tc39.es/ecma262/#sec-object.assign
// eslint-disable-next-line es/no-object-assign -- required for testing
$$b({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
assign: assign
});
// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
var domIterables = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
};
// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
var documentCreateElement = documentCreateElement$2;
var classList = documentCreateElement('span').classList;
var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
var globalThis$9 = globalThis_1;
var DOMIterables = domIterables;
var DOMTokenListPrototype = domTokenListPrototype;
var ArrayIteratorMethods = es_array_iterator;
var createNonEnumerableProperty = createNonEnumerableProperty$4;
var setToStringTag$1 = setToStringTag$4;
var wellKnownSymbol$a = wellKnownSymbol$g;
var ITERATOR$3 = wellKnownSymbol$a('iterator');
var ArrayValues = ArrayIteratorMethods.values;
var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
if (CollectionPrototype) {
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype[ITERATOR$3] !== ArrayValues) try {
createNonEnumerableProperty(CollectionPrototype, ITERATOR$3, ArrayValues);
} catch (error) {
CollectionPrototype[ITERATOR$3] = ArrayValues;
}
setToStringTag$1(CollectionPrototype, COLLECTION_NAME, true);
if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
} catch (error) {
CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
}
}
}
};
for (var COLLECTION_NAME in DOMIterables) {
handlePrototype(globalThis$9[COLLECTION_NAME] && globalThis$9[COLLECTION_NAME].prototype, COLLECTION_NAME);
}
handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
const CloseIcon = () => {
return jsxRuntime.jsxs("svg", Object.assign({
xmlns: "http://www.w3.org/2000/svg",
height: "16",
viewBox: "0 0 24 24",
width: "16",
fill: "#C1C1C1"
}, {
children: [jsxRuntime.jsx("path", {
d: "M0 0h24v24H0z",
fill: "none"
}), jsxRuntime.jsx("path", {
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
})]
}));
};
const CloseButton = ({
onClick
}) => {
return jsxRuntime.jsx("button", Object.assign({
onClick: onClick,
className: "close-button"
}, {
children: jsxRuntime.jsx(CloseIcon, {})
}));
};
const ModalHeader = ({
title,
onCloseModal
}) => {
const additionalClasses = title === "Get a Wallet" ? " -open" : "";
return jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal-header"
}, {
children: [jsxRuntime.jsx("h3", Object.assign({
className: `middleTitle ${additionalClasses}`
}, {
children: title
})), jsxRuntime.jsx(CloseButton, {
onClick: onCloseModal
})]
}));
};
const BackArrowIcon = () => {
return jsxRuntime.jsx("svg", Object.assign({
width: "8",
height: "14",
viewBox: "0 0 8 14",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: jsxRuntime.jsx("path", {
d: "M7 13L1 7L7 1",
stroke: "#6494EE",
strokeWidth: "1.5",
strokeLinecap: "round",
strokeLinejoin: "round"
})
}));
};
const BackArrow = ({
onClick
}) => {
return jsxRuntime.jsx("button", Object.assign({
onClick: onClick,
className: "back-button"
}, {
children: jsxRuntime.jsx(BackArrowIcon, {})
}));
};
const WalletNetworkChanged = ({
selector,
onBack,
onCloseModal
}) => {
return jsxRuntime.jsxs(React.Fragment, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal-header-wrapper"
}, {
children: [jsxRuntime.jsx(BackArrow, {
onClick: onBack
}), jsxRuntime.jsx(ModalHeader, {
title: "You Must Change the Network",
onCloseModal: onCloseModal
})]
})), jsxRuntime.jsx("div", Object.assign({
className: "switch-network-message-wrapper"
}, {
children: jsxRuntime.jsxs("div", Object.assign({
className: "content"
}, {
children: [jsxRuntime.jsxs("p", {
children: ["We've detected that you need to change your wallet's network to", jsxRuntime.jsx("strong", Object.assign({
className: "network-id"
}, {
children: ` ${selector.options.network.networkId}`
})), " ", "for this dApp."]
}), jsxRuntime.jsx("p", {
children: "Some wallets may not support changing networks. If you can not change networks you may consider switching to another wallet."
})]
}))
}))]
});
};
var wellKnownSymbol$9 = wellKnownSymbol$g;
var TO_STRING_TAG$1 = wellKnownSymbol$9('toStringTag');
var test$1 = {};
test$1[TO_STRING_TAG$1] = 'z';
var toStringTagSupport = String(test$1) === '[object z]';
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
var isCallable$6 = isCallable$k;
var classofRaw$1 = classofRaw$2;
var wellKnownSymbol$8 = wellKnownSymbol$g;
var TO_STRING_TAG = wellKnownSymbol$8('toStringTag');
var $Object = Object;
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (error) { /* empty */ }
};
// getting tag from ES6+ `Object.prototype.toString`
var classof$5 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
var O, tag, result;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
// builtinTag case
: CORRECT_ARGUMENTS ? classofRaw$1(O)
// ES3 arguments fallback
: (result = classofRaw$1(O)) === 'Object' && isCallable$6(O.callee) ? 'Arguments' : result;
};
var classof$4 = classof$5;
var $String = String;
var toString$3 = function (argument) {
if (classof$4(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
return $String(argument);
};
var makeBuiltIn = makeBuiltIn$3.exports;
var defineProperty = objectDefineProperty;
var defineBuiltInAccessor$2 = function (target, name, descriptor) {
if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
return defineProperty.f(target, name, descriptor);
};
var $$a = _export;
var DESCRIPTORS$2 = descriptors;
var globalThis$8 = globalThis_1;
var uncurryThis$6 = functionUncurryThis;
var hasOwn$2 = hasOwnProperty_1;
var isCallable$5 = isCallable$k;
var isPrototypeOf$3 = objectIsPrototypeOf;
var toString$2 = toString$3;
var defineBuiltInAccessor$1 = defineBuiltInAccessor$2;
var copyConstructorProperties = copyConstructorProperties$2;
var NativeSymbol = globalThis$8.Symbol;
var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
if (DESCRIPTORS$2 && isCallable$5(NativeSymbol) && (!('description' in SymbolPrototype) ||
// Safari 12 bug
NativeSymbol().description !== undefined
)) {
var EmptyStringDescriptionStore = {};
// wrap Symbol constructor for correct work with undefined description
var SymbolWrapper = function Symbol() {
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$2(arguments[0]);
var result = isPrototypeOf$3(SymbolPrototype, this)
// eslint-disable-next-line sonarjs/inconsistent-function-call -- ok
? new NativeSymbol(description)
// in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
: description === undefined ? NativeSymbol() : NativeSymbol(description);
if (description === '') EmptyStringDescriptionStore[result] = true;
return result;
};
copyConstructorProperties(SymbolWrapper, NativeSymbol);
SymbolWrapper.prototype = SymbolPrototype;
SymbolPrototype.constructor = SymbolWrapper;
var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';
var thisSymbolValue = uncurryThis$6(SymbolPrototype.valueOf);
var symbolDescriptiveString = uncurryThis$6(SymbolPrototype.toString);
var regexp = /^Symbol\((.*)\)[^)]+$/;
var replace = uncurryThis$6(''.replace);
var stringSlice = uncurryThis$6(''.slice);
defineBuiltInAccessor$1(SymbolPrototype, 'description', {
configurable: true,
get: function description() {
var symbol = thisSymbolValue(this);
if (hasOwn$2(EmptyStringDescriptionStore, symbol)) return '';
var string = symbolDescriptiveString(symbol);
var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
return desc === '' ? undefined : desc;
}
});
$$a({ global: true, constructor: true, forced: true }, {
Symbol: SymbolWrapper
});
}
var $$9 = _export;
var $includes = arrayIncludes.includes;
var fails$5 = fails$h;
var addToUnscopables = addToUnscopables$2;
// FF99+ bug
var BROKEN_ON_SPARSE = fails$5(function () {
// eslint-disable-next-line es/no-array-prototype-includes -- detection
return !Array(1).includes();
});
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
$$9({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
includes: function includes(el /* , fromIndex = 0 */) {
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
}
});
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('includes');
var aCallable$7 = aCallable$a;
var toObject$1 = toObject$5;
var IndexedObject = indexedObject;
var lengthOfArrayLike$2 = lengthOfArrayLike$4;
var $TypeError$8 = TypeError;
var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
// `Array.prototype.{ reduce, reduceRight }` methods implementation
var createMethod = function (IS_RIGHT) {
return function (that, callbackfn, argumentsLength, memo) {
var O = toObject$1(that);
var self = IndexedObject(O);
var length = lengthOfArrayLike$2(O);
aCallable$7(callbackfn);
if (length === 0 && argumentsLength < 2) throw new $TypeError$8(REDUCE_EMPTY);
var index = IS_RIGHT ? length - 1 : 0;
var i = IS_RIGHT ? -1 : 1;
if (argumentsLength < 2) while (true) {
if (index in self) {
memo = self[index];
index += i;
break;
}
index += i;
if (IS_RIGHT ? index < 0 : length <= index) {
throw new $TypeError$8(REDUCE_EMPTY);
}
}
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
memo = callbackfn(memo, self[index], index, O);
}
return memo;
};
};
var arrayReduce = {
// `Array.prototype.reduce` method
// https://tc39.es/ecma262/#sec-array.prototype.reduce
left: createMethod(false),
// `Array.prototype.reduceRight` method
// https://tc39.es/ecma262/#sec-array.prototype.reduceright
right: createMethod(true)
};
var fails$4 = fails$h;
var arrayMethodIsStrict$2 = function (METHOD_NAME, argument) {
var method = [][METHOD_NAME];
return !!method && fails$4(function () {
// eslint-disable-next-line no-useless-call -- required for testing
method.call(null, argument || function () { return 1; }, 1);
});
};
/* global Bun, Deno -- detection */
var globalThis$7 = globalThis_1;
var userAgent$5 = environmentUserAgent;
var classof$3 = classofRaw$2;
var userAgentStartsWith = function (string) {
return userAgent$5.slice(0, string.length) === string;
};
var environment = (function () {
if (userAgentStartsWith('Bun/')) return 'BUN';
if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
if (userAgentStartsWith('Deno/')) return 'DENO';
if (userAgentStartsWith('Node.js/')) return 'NODE';
if (globalThis$7.Bun && typeof Bun.version == 'string') return 'BUN';
if (globalThis$7.Deno && typeof Deno.version == 'object') return 'DENO';
if (classof$3(globalThis$7.process) === 'process') return 'NODE';
if (globalThis$7.window && globalThis$7.document) return 'BROWSER';
return 'REST';
})();
var ENVIRONMENT$1 = environment;
var environmentIsNode = ENVIRONMENT$1 === 'NODE';
var $$8 = _export;
var $reduce = arrayReduce.left;
var arrayMethodIsStrict$1 = arrayMethodIsStrict$2;
var CHROME_VERSION = environmentV8Version;
var IS_NODE$3 = environmentIsNode;
// Chrome 80-82 has a critical bug
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
var CHROME_BUG = !IS_NODE$3 && CHROME_VERSION > 79 && CHROME_VERSION < 83;
var FORCED$1 = CHROME_BUG || !arrayMethodIsStrict$1('reduce');
// `Array.prototype.reduce` method
// https://tc39.es/ecma262/#sec-array.prototype.reduce
$$8({ target: 'Array', proto: true, forced: FORCED$1 }, {
reduce: function reduce(callbackfn /* , initialValue */) {
var length = arguments.length;
return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
}
});
var tryToString$3 = tryToString$5;
var $TypeError$7 = TypeError;
var deletePropertyOrThrow$1 = function (O, P) {
if (!delete O[P]) throw new $TypeError$7('Cannot delete property ' + tryToString$3(P) + ' of ' + tryToString$3(O));
};
var uncurryThis$5 = functionUncurryThis;
var arraySlice$2 = uncurryThis$5([].slice);
var arraySlice$1 = arraySlice$2;
var floor = Math.floor;
var sort = function (array, comparefn) {
var length = array.length;
if (length < 8) {
// insertion sort
var i = 1;
var element, j;
while (i < length) {
j = i;
element = array[i];
while (j && comparefn(array[j - 1], element) > 0) {
array[j] = array[--j];
}
if (j !== i++) array[j] = element;
}
} else {
// merge sort
var middle = floor(length / 2);
var left = sort(arraySlice$1(array, 0, middle), comparefn);
var right = sort(arraySlice$1(array, middle), comparefn);
var llength = left.length;
var rlength = right.length;
var lindex = 0;
var rindex = 0;
while (lindex < llength || rindex < rlength) {
array[lindex + rindex] = (lindex < llength && rindex < rlength)
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
: lindex < llength ? left[lindex++] : right[rindex++];
}
}
return array;
};
var arraySort = sort;
var userAgent$4 = environmentUserAgent;
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
var environmentFfVersion = !!firefox && +firefox[1];
var UA = environmentUserAgent;
var environmentIsIeOrEdge = /MSIE|Trident/.test(UA);
var userAgent$3 = environmentUserAgent;
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
var environmentWebkitVersion = !!webkit && +webkit[1];
var $$7 = _export;
var uncurryThis$4 = functionUncurryThis;
var aCallable$6 = aCallable$a;
var toObject = toObject$5;
var lengthOfArrayLike$1 = lengthOfArrayLike$4;
var deletePropertyOrThrow = deletePropertyOrThrow$1;
var toString$1 = toString$3;
var fails$3 = fails$h;
var internalSort = arraySort;
var arrayMethodIsStrict = arrayMethodIsStrict$2;
var FF = environmentFfVersion;
var IE_OR_EDGE = environmentIsIeOrEdge;
var V8 = environmentV8Version;
var WEBKIT = environmentWebkitVersion;
var test = [];
var nativeSort = uncurryThis$4(test.sort);
var push = uncurryThis$4(test.push);
// IE8-
var FAILS_ON_UNDEFINED = fails$3(function () {
test.sort(undefined);
});
// V8 bug
var FAILS_ON_NULL = fails$3(function () {
test.sort(null);
});
// Old WebKit
var STRICT_METHOD = arrayMethodIsStrict('sort');
var STABLE_SORT = !fails$3(function () {
// feature detection can be too slow, so check engines versions
if (V8) return V8 < 70;
if (FF && FF > 3) return;
if (IE_OR_EDGE) return true;
if (WEBKIT) return WEBKIT < 603;
var result = '';
var code, chr, value, index;
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
for (code = 65; code < 76; code++) {
chr = String.fromCharCode(code);
switch (code) {
case 66: case 69: case 70: case 72: value = 3; break;
case 68: case 71: value = 4; break;
default: value = 2;
}
for (index = 0; index < 47; index++) {
test.push({ k: chr + index, v: value });
}
}
test.sort(function (a, b) { return b.v - a.v; });
for (index = 0; index < test.length; index++) {
chr = test[index].k.charAt(0);
if (result.charAt(result.length - 1) !== chr) result += chr;
}
return result !== 'DGBEFHACIJK';
});
var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
var getSortCompare = function (comparefn) {
return function (x, y) {
if (y === undefined) return -1;
if (x === undefined) return 1;
if (comparefn !== undefined) return +comparefn(x, y) || 0;
return toString$1(x) > toString$1(y) ? 1 : -1;
};
};
// `Array.prototype.sort` method
// https://tc39.es/ecma262/#sec-array.prototype.sort
$$7({ target: 'Array', proto: true, forced: FORCED }, {
sort: function sort(comparefn) {
if (comparefn !== undefined) aCallable$6(comparefn);
var array = toObject(this);
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
var items = [];
var arrayLength = lengthOfArrayLike$1(array);
var itemsLength, index;
for (index = 0; index < arrayLength; index++) {
if (index in array) push(items, array[index]);
}
internalSort(items, getSortCompare(comparefn));
itemsLength = lengthOfArrayLike$1(items);
index = 0;
while (index < itemsLength) array[index] = items[index++];
while (index < arrayLength) deletePropertyOrThrow(array, index++);
return array;
}
});
var isObject$2 = isObject$b;
var classof$2 = classofRaw$2;
var wellKnownSymbol$7 = wellKnownSymbol$g;
var MATCH$1 = wellKnownSymbol$7('match');
// `IsRegExp` abstract operation
// https://tc39.es/ecma262/#sec-isregexp
var isRegexp = function (it) {
var isRegExp;
return isObject$2(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$2(it) === 'RegExp');
};
var isRegExp = isRegexp;
var $TypeError$6 = TypeError;
var notARegexp = function (it) {
if (isRegExp(it)) {
throw new $TypeError$6("The method doesn't accept regular expressions");
} return it;
};
var wellKnownSymbol$6 = wellKnownSymbol$g;
var MATCH = wellKnownSymbol$6('match');
var correctIsRegexpLogic = function (METHOD_NAME) {
var regexp = /./;
try {
'/./'[METHOD_NAME](regexp);
} catch (error1) {
try {
regexp[MATCH] = false;
return '/./'[METHOD_NAME](regexp);
} catch (error2) { /* empty */ }
} return false;
};
var $$6 = _export;
var uncurryThis$3 = functionUncurryThis;
var notARegExp = notARegexp;
var requireObjectCoercible = requireObjectCoercible$4;
var toString = toString$3;
var correctIsRegExpLogic = correctIsRegexpLogic;
var stringIndexOf = uncurryThis$3(''.indexOf);
// `String.prototype.includes` method
// https://tc39.es/ecma262/#sec-string.prototype.includes
$$6({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
includes: function includes(searchString /* , position = 0 */) {
return !!~stringIndexOf(
toString(requireObjectCoercible(this)),
toString(notARegExp(searchString)),
arguments.length > 1 ? arguments[1] : undefined
);
}
});
const WarningIcon = () => {
return jsxRuntime.jsxs("svg", Object.assign({
width: "18",
height: "18",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: [jsxRuntime.jsx("path", {
d: "M4.95215 16.3536L10.2152 5.85657C10.9531 4.38481 13.0538 4.38519 13.7912 5.85723L19.0494 16.3543C19.7156 17.6841 18.7486 19.25 17.2612 19.25H6.74001C5.25228 19.25 4.28535 17.6835 4.95215 16.3536Z",
stroke: "#E6B73E",
strokeWidth: "1.5",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M12 10V12",
stroke: "#E6B73E",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M12.5 16C12.5 16.2761 12.2761 16.5 12 16.5C11.7239 16.5 11.5 16.2761 11.5 16C11.5 15.7239 11.7239 15.5 12 15.5C12.2761 15.5 12.5 15.7239 12.5 16Z",
stroke: "#E6B73E"
})]
}));
};
const WalletOptions = ({
selector,
handleWalletClick
}) => {
const [modules, setModules] = React.useState([]);
const [recentModules, setRecentModules] = React.useState([]);
const [moreModules, setMoreModules] = React.useState([]);
const [activeWalletId, setActiveWalletId] = React.useState("");
React.useEffect(() => {
const subscription = selector.store.observable.subscribe(state => {
const {
selectedWalletId
} = selector.store.getState();
if (selectedWalletId) {
setActiveWalletId(selectedWalletId);
}
const wallets = state.modules.filter(module => !(module.type === "instant-link" && selectedWalletId !== module.id));
if (selector.options.optimizeWalletOrder) {
state.modules.sort((current, next) => {
if (current.metadata.deprecated === next.metadata.deprecated) {
return 0;
}
return current.metadata.deprecated ? 1 : -1;
});
state.modules.sort((current, next) => {
if (next.metadata.available === current.metadata.available) {
return 0;
}
return next.metadata.available ? 1 : -1;
});
const moreWallets = [];
const recentlySignedInWallets = [];
wallets.forEach(module => {
if (selector.store.getState().recentlySignedInWallets.includes(module.id)) {
recentlySignedInWallets.push(module);
} else {
moreWallets.push(module);
}
});
setRecentModules(recentlySignedInWallets);
setMoreModules(moreWallets);
}
if (selector.options.randomizeWalletOrder) {
setModules(wallets.sort(() => Math.random() - 0.5));
} else {
setModules(wallets);
}
});
return () => subscription.unsubscribe();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
React.useEffect(() => {
const {
recentlySignedInWallets
} = selector.store.getState();
if (recentlySignedInWallets.length) {
setActiveWalletId(recentlySignedInWallets[0]);
}
}, [selector.store]);
function renderOptionsList(modulesToRender) {
return modulesToRender.reduce((result, module, index) => {
const {
selectedWalletId
} = selector.store.getState();
const {
name,
description,
iconUrl,
deprecated
} = module.metadata;
const selected = module.id === selectedWalletId;
result.push(jsxRuntime.jsxs("li", Object.assign({
tabIndex: 0,
className: `single-wallet ${activeWalletId === module.id ? "selected-wallet" : ""} ${selected ? "connected-wallet" : ""} ${deprecated ? "deprecated-wallet" : ""} sidebar ${module.id}`,
onClick: () => {
if (selector.options.network.networkId === "testnet" && module.id === "here-wallet") {
alert("Here Wallet is not supported on testnet");
return;
}
if (module.id === modulesToRender[index].id) {
setActiveWalletId(module.id);
}
return handleWalletClick(module);
}
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "icon"
}, {
children: jsxRuntime.jsx("img", {
src: iconUrl,
alt: name
})
})), jsxRuntime.jsxs("div", Object.assign({
className: "content"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "title"
}, {
children: name
})), jsxRuntime.jsx("div", Object.assign({
className: "description"
}, {
children: description
}))]
})), deprecated && jsxRuntime.jsx("div", Object.assign({
className: "warning-triangle"
}, {
children: jsxRuntime.jsx(WarningIcon, {})
}))]
}), module.id));
return result;
}, []);
}
return jsxRuntime.jsx("div", {
children: jsxRuntime.jsx("div", Object.assign({
className: "wallet-options-wrapper"
}, {
children: jsxRuntime.jsx("div", Object.assign({
className: "options-list"
}, {
children: selector.options.optimizeWalletOrder && selector.store.getState().recentlySignedInWallets.length > 0 ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
children: [renderOptionsList(recentModules), renderOptionsList(moreModules)]
}) : renderOptionsList(modules)
}))
}))
});
};
const ConnectionErrorIcon = () => {
return jsxRuntime.jsxs("svg", Object.assign({
width: "21",
height: "20",
viewBox: "0 0 21 20",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: [jsxRuntime.jsx("path", {
d: "M10.5001 18.3333C15.1025 18.3333 18.8334 14.6023 18.8334 9.99996C18.8334 5.39759 15.1025 1.66663 10.5001 1.66663C5.89771 1.66663 2.16675 5.39759 2.16675 9.99996C2.16675 14.6023 5.89771 18.3333 10.5001 18.3333Z",
stroke: "#CE5A6F",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M13 7.5L8 12.5",
stroke: "#CE5A6F",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M8 7.5L13 12.5",
stroke: "#CE5A6F",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
})]
}));
};
const ConnectionSuccessIcon = () => {
return jsxRuntime.jsxs("svg", Object.assign({
width: "21",
height: "20",
viewBox: "0 0 21 20",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: [jsxRuntime.jsx("path", {
d: "M18.8333 9.2333V9.99997C18.8323 11.797 18.2504 13.5455 17.1744 14.9848C16.0984 16.4241 14.586 17.477 12.8628 17.9866C11.1395 18.4961 9.29768 18.4349 7.61202 17.8121C5.92636 17.1894 4.48717 16.0384 3.50909 14.5309C2.53101 13.0233 2.06645 11.24 2.18469 9.4469C2.30293 7.65377 2.99763 5.94691 4.16519 4.58086C5.33275 3.21482 6.91061 2.26279 8.66345 1.86676C10.4163 1.47073 12.2502 1.65192 13.8916 2.3833",
stroke: "#4FD98F",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M18.8333 3.33337L10.5 11.675L8 9.17504",
stroke: "#4FD98F",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
})]
}));
};
const RetryIcon = () => jsxRuntime.jsx("svg", Object.assign({
width: "14",
height: "12",
viewBox: "0 0 14 12",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: jsxRuntime.jsx("path", {
d: "M6.91301 11.0202C6.91301 11.1866 6.8469 11.3462 6.72921 11.4639C6.61153 11.5816 6.45192 11.6477 6.28549 11.6477C3.11273 11.6477 0.515625 9.13343 0.515625 6C0.515625 2.86657 3.11273 0.352295 6.28549 0.352295C8.88343 0.352295 11.0957 2.03824 11.8119 4.36928L12.3164 3.51585C12.4011 3.3725 12.5392 3.26864 12.7004 3.22714C12.8616 3.18564 13.0328 3.20988 13.1761 3.29454C13.3195 3.3792 13.4233 3.51733 13.4648 3.67856C13.5063 3.83979 13.4821 4.0109 13.3974 4.15425L12.0336 6.45935C11.9501 6.60075 11.8145 6.70379 11.6559 6.74633C11.4972 6.78888 11.3283 6.76755 11.1852 6.68693L8.82403 5.35574C8.75222 5.31525 8.6891 5.26102 8.63825 5.19613C8.58741 5.13125 8.54984 5.05698 8.5277 4.97758C8.50556 4.89817 8.49927 4.81519 8.5092 4.73335C8.51913 4.65152 8.54508 4.57244 8.58557 4.50064C8.62606 4.42883 8.68029 4.36571 8.74518 4.31486C8.81007 4.26402 8.88433 4.22645 8.96373 4.20431C9.04314 4.18217 9.12613 4.17588 9.20796 4.18581C9.28979 4.19574 9.36887 4.22169 9.44067 4.26218L10.6723 4.95664C10.192 3.04228 8.42074 1.60734 6.28632 1.60734C3.77791 1.60734 1.77067 3.5878 1.77067 6C1.77067 8.4122 3.77791 10.3927 6.28549 10.3927C6.45192 10.3927 6.61153 10.4588 6.72921 10.5765C6.8469 10.6941 6.91301 10.8538 6.91301 11.0202Z",
fill: "white"
})
}));
const ConnectionResult = ({
module,
message,
err,
onRetry
}) => {
return jsxRuntime.jsx("div", Object.assign({
className: "connection connecting-details"
}, {
children: err ? jsxRuntime.jsxs("div", Object.assign({
className: "error-wrapper"
}, {
children: [(module === null || module === void 0 ? void 0 : module.metadata.available) && jsxRuntime.jsxs("button", Object.assign({
className: "loading-dots",
onClick: onRetry
}, {
children: [jsxRuntime.jsx(RetryIcon, {}), core.translate("modal.ledger.retry")]
})), jsxRuntime.jsxs("div", Object.assign({
className: "error-floating"
}, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "error"
}, {
children: [jsxRuntime.jsx(ConnectionErrorIcon, {}), core.translate("modal.wallet.connectionFailed")]
})), jsxRuntime.jsx("p", {
children: message
})]
}))]
})) : jsxRuntime.jsx("div", Object.assign({
className: "success"
}, {
children: jsxRuntime.jsxs("button", Object.assign({
className: "loading-dots",
onClick: onRetry
}, {
children: [core.translate("modal.wallet.connectionSuccessful"), jsxRuntime.jsx(ConnectionSuccessIcon, {})]
}))
}))
}));
};
const AlertMessage = ({
message,
module,
onBack
}) => {
return jsxRuntime.jsxs(React.Fragment, {
children: [jsxRuntime.jsx(ModalHeader, {
title: "",
onCloseModal: () => onBack(false)
}), jsxRuntime.jsx("div", Object.assign({
className: "alert-message connecting-wrapper connecting-wrapper-err"
}, {
children: jsxRuntime.jsxs("div", Object.assign({
className: "content"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "icon"
}, {
children: jsxRuntime.jsx("img", {
src: module === null || module === void 0 ? void 0 : module.metadata.iconUrl,
alt: module === null || module === void 0 ? void 0 : module.metadata.name
})
})), jsxRuntime.jsx("h3", Object.assign({
className: "connecting-name"
}, {
children: module === null || module === void 0 ? void 0 : module.metadata.name
})), message !== null && jsxRuntime.jsx("div", Object.assign({
className: "connecting-message"
}, {
children: jsxRuntime.jsx("span", {
children: core.translate("modal.wallet.connectionNotSuccessful")
})
})), jsxRuntime.jsx(ConnectionResult, {
module: module,
message: message,
err: message !== null,
onRetry: () => {
onBack(true);
}
})]
}))
}))]
});
};
var getBuiltIn$3 = getBuiltIn$7;
var defineBuiltInAccessor = defineBuiltInAccessor$2;
var wellKnownSymbol$5 = wellKnownSymbol$g;
var DESCRIPTORS$1 = descriptors;
var SPECIES$2 = wellKnownSymbol$5('species');
var setSpecies$1 = function (CONSTRUCTOR_NAME) {
var Constructor = getBuiltIn$3(CONSTRUCTOR_NAME);
if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES$2]) {
defineBuiltInAccessor(Constructor, SPECIES$2, {
configurable: true,
get: function () { return this; }
});
}
};
var isPrototypeOf$2 = objectIsPrototypeOf;
var $TypeError$5 = TypeError;
var anInstance$1 = function (it, Prototype) {
if (isPrototypeOf$2(Prototype, it)) return it;
throw new $TypeError$5('Incorrect invocation');
};
var uncurryThis$2 = functionUncurryThis;
var fails$2 = fails$h;
var isCallable$4 = isCallable$k;
var classof$1 = classof$5;
var getBuiltIn$2 = getBuiltIn$7;
var inspectSource$1 = inspectSource$3;
var noop = function () { /* empty */ };
var construct = getBuiltIn$2('Reflect', 'construct');
var constructorRegExp = /^\s*(?:class|function)\b/;
var exec = uncurryThis$2(constructorRegExp.exec);
var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
var isConstructorModern = function isConstructor(argument) {
if (!isCallable$4(argument)) return false;
try {
construct(noop, [], argument);
return true;
} catch (error) {
return false;
}
};
var isConstructorLegacy = function isConstructor(argument) {
if (!isCallable$4(argument)) return false;
switch (classof$1(argument)) {
case 'AsyncFunction':
case 'GeneratorFunction':
case 'AsyncGeneratorFunction': return false;
}
try {
// we can't check .prototype since constructors produced by .bind haven't it
// `Function#toString` throws on some built-it function in some legacy engines
// (for example, `DOMQuad` and similar in FF41-)
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
} catch (error) {
return true;
}
};
isConstructorLegacy.sham = true;
// `IsConstructor` abstract operation
// https://tc39.es/ecma262/#sec-isconstructor
var isConstructor$1 = !construct || fails$2(function () {
var called;
return isConstructorModern(isConstructorModern.call)
|| !isConstructorModern(Object)
|| !isConstructorModern(function () { called = true; })
|| called;
}) ? isConstructorLegacy : isConstructorModern;
var isConstructor = isConstructor$1;
var tryToString$2 = tryToString$5;
var $TypeError$4 = TypeError;
// `Assert: IsConstructor(argument) is true`
var aConstructor$1 = function (argument) {
if (isConstructor(argument)) return argument;
throw new $TypeError$4(tryToString$2(argument) + ' is not a constructor');
};
var anObject$6 = anObject$b;
var aConstructor = aConstructor$1;
var isNullOrUndefined$1 = isNullOrUndefined$4;
var wellKnownSymbol$4 = wellKnownSymbol$g;
var SPECIES$1 = wellKnownSymbol$4('species');
// `SpeciesConstructor` abstract operation
// https://tc39.es/ecma262/#sec-speciesconstructor
var speciesConstructor$1 = function (O, defaultConstructor) {
var C = anObject$6(O).constructor;
var S;
return C === undefined || isNullOrUndefined$1(S = anObject$6(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
};
var NATIVE_BIND$1 = functionBindNative;
var FunctionPrototype = Function.prototype;
var apply$1 = FunctionPrototype.apply;
var call$7 = FunctionPrototype.call;
// eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$7.bind(apply$1) : function () {
return call$7.apply(apply$1, arguments);
});
var classofRaw = classofRaw$2;
var uncurryThis$1 = functionUncurryThis;
var functionUncurryThisClause = function (fn) {
// Nashorn bug:
// https://github.com/zloirock/core-js/issues/1128
// https://github.com/zloirock/core-js/issues/1130
if (classofRaw(fn) === 'Function') return uncurryThis$1(fn);
};
var uncurryThis = functionUncurryThisClause;
var aCallable$5 = aCallable$a;
var NATIVE_BIND = functionBindNative;
var bind$4 = uncurryThis(uncurryThis.bind);
// optional / simple context binding
var functionBindContext = function (fn, that) {
aCallable$5(fn);
return that === undefined ? fn : NATIVE_BIND ? bind$4(fn, that) : function (/* ...args */) {
return fn.apply(that, arguments);
};
};
var $TypeError$3 = TypeError;
var validateArgumentsLength$1 = function (passed, required) {
if (passed < required) throw new $TypeError$3('Not enough arguments');
return passed;
};
var userAgent$2 = environmentUserAgent;
// eslint-disable-next-line redos/no-vulnerable -- safe
var environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
var globalThis$6 = globalThis_1;
var apply = functionApply;
var bind$3 = functionBindContext;
var isCallable$3 = isCallable$k;
var hasOwn$1 = hasOwnProperty_1;
var fails$1 = fails$h;
var html = html$2;
var arraySlice = arraySlice$2;
var createElement = documentCreateElement$2;
var validateArgumentsLength = validateArgumentsLength$1;
var IS_IOS$1 = environmentIsIos;
var IS_NODE$2 = environmentIsNode;
var set = globalThis$6.setImmediate;
var clear = globalThis$6.clearImmediate;
var process$2 = globalThis$6.process;
var Dispatch = globalThis$6.Dispatch;
var Function$1 = globalThis$6.Function;
var MessageChannel = globalThis$6.MessageChannel;
var String$1 = globalThis$6.String;
var counter = 0;
var queue$2 = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var $location, defer, channel, port;
fails$1(function () {
// Deno throws a ReferenceError on `location` access without `--location` flag
$location = globalThis$6.location;
});
var run = function (id) {
if (hasOwn$1(queue$2, id)) {
var fn = queue$2[id];
delete queue$2[id];
fn();
}
};
var runner = function (id) {
return function () {
run(id);
};
};
var eventListener = function (event) {
run(event.data);
};
var globalPostMessageDefer = function (id) {
// old engines have not location.origin
globalThis$6.postMessage(String$1(id), $location.protocol + '//' + $location.host);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!set || !clear) {
set = function setImmediate(handler) {
validateArgumentsLength(arguments.length, 1);
var fn = isCallable$3(handler) ? handler : Function$1(handler);
var args = arraySlice(arguments, 1);
queue$2[++counter] = function () {
apply(fn, undefined, args);
};
defer(counter);
return counter;
};
clear = function clearImmediate(id) {
delete queue$2[id];
};
// Node.js 0.8-
if (IS_NODE$2) {
defer = function (id) {
process$2.nextTick(runner(id));
};
// Sphere (JS game engine) Dispatch API
} else if (Dispatch && Dispatch.now) {
defer = function (id) {
Dispatch.now(runner(id));
};
// Browsers with MessageChannel, includes WebWorkers
// except iOS - https://github.com/zloirock/core-js/issues/624
} else if (MessageChannel && !IS_IOS$1) {
channel = new MessageChannel();
port = channel.port2;
channel.port1.onmessage = eventListener;
defer = bind$3(port.postMessage, port);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (
globalThis$6.addEventListener &&
isCallable$3(globalThis$6.postMessage) &&
!globalThis$6.importScripts &&
$location && $location.protocol !== 'file:' &&
!fails$1(globalPostMessageDefer)
) {
defer = globalPostMessageDefer;
globalThis$6.addEventListener('message', eventListener, false);
// IE8-
} else if (ONREADYSTATECHANGE in createElement('script')) {
defer = function (id) {
html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
html.removeChild(this);
run(id);
};
};
// Rest old browsers
} else {
defer = function (id) {
setTimeout(runner(id), 0);
};
}
}
var task$1 = {
set: set,
clear: clear
};
var globalThis$5 = globalThis_1;
var DESCRIPTORS = descriptors;
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Avoid NodeJS experimental warning
var safeGetBuiltIn$1 = function (name) {
if (!DESCRIPTORS) return globalThis$5[name];
var descriptor = getOwnPropertyDescriptor(globalThis$5, name);
return descriptor && descriptor.value;
};
var Queue$2 = function () {
this.head = null;
this.tail = null;
};
Queue$2.prototype = {
add: function (item) {
var entry = { item: item, next: null };
var tail = this.tail;
if (tail) tail.next = entry;
else this.head = entry;
this.tail = entry;
},
get: function () {
var entry = this.head;
if (entry) {
var next = this.head = entry.next;
if (next === null) this.tail = null;
return entry.item;
}
}
};
var queue$1 = Queue$2;
var userAgent$1 = environmentUserAgent;
var environmentIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && typeof Pebble != 'undefined';
var userAgent = environmentUserAgent;
var environmentIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
var globalThis$4 = globalThis_1;
var safeGetBuiltIn = safeGetBuiltIn$1;
var bind$2 = functionBindContext;
var macrotask = task$1.set;
var Queue$1 = queue$1;
var IS_IOS = environmentIsIos;
var IS_IOS_PEBBLE = environmentIsIosPebble;
var IS_WEBOS_WEBKIT = environmentIsWebosWebkit;
var IS_NODE$1 = environmentIsNode;
var MutationObserver = globalThis$4.MutationObserver || globalThis$4.WebKitMutationObserver;
var document$2 = globalThis$4.document;
var process$1 = globalThis$4.process;
var Promise$1 = globalThis$4.Promise;
var microtask$1 = safeGetBuiltIn('queueMicrotask');
var notify$1, toggle, node, promise, then;
// modern engines have queueMicrotask method
if (!microtask$1) {
var queue = new Queue$1();
var flush = function () {
var parent, fn;
if (IS_NODE$1 && (parent = process$1.domain)) parent.exit();
while (fn = queue.get()) try {
fn();
} catch (error) {
if (queue.head) notify$1();
throw error;
}
if (parent) parent.enter();
};
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
// also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
toggle = true;
node = document$2.createTextNode('');
new MutationObserver(flush).observe(node, { characterData: true });
notify$1 = function () {
node.data = toggle = !toggle;
};
// environments with maybe non-completely correct, but existent Promise
} else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
// Promise.resolve without an argument throws an error in LG WebOS 2
promise = Promise$1.resolve(undefined);
// workaround of WebKit ~ iOS Safari 10.1 bug
promise.constructor = Promise$1;
then = bind$2(promise.then, promise);
notify$1 = function () {
then(flush);
};
// Node.js without promises
} else if (IS_NODE$1) {
notify$1 = function () {
process$1.nextTick(flush);
};
// for other environments - macrotask based on:
// - setImmediate
// - MessageChannel
// - window.postMessage
// - onreadystatechange
// - setTimeout
} else {
// `webpack` dev server bug on IE global methods - use bind(fn, global)
macrotask = bind$2(macrotask, globalThis$4);
notify$1 = function () {
macrotask(flush);
};
}
microtask$1 = function (fn) {
if (!queue.head) notify$1();
queue.add(fn);
};
}
var microtask_1 = microtask$1;
var hostReportErrors$1 = function (a, b) {
try {
// eslint-disable-next-line no-console -- safe
arguments.length === 1 ? console.error(a) : console.error(a, b);
} catch (error) { /* empty */ }
};
var perform$3 = function (exec) {
try {
return { error: false, value: exec() };
} catch (error) {
return { error: true, value: error };
}
};
var globalThis$3 = globalThis_1;
var promiseNativeConstructor = globalThis$3.Promise;
var globalThis$2 = globalThis_1;
var NativePromiseConstructor$3 = promiseNativeConstructor;
var isCallable$2 = isCallable$k;
var isForced = isForced_1;
var inspectSource = inspectSource$3;
var wellKnownSymbol$3 = wellKnownSymbol$g;
var ENVIRONMENT = environment;
var V8_VERSION = environmentV8Version;
NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
var SPECIES = wellKnownSymbol$3('species');
var SUBCLASSING = false;
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$2(globalThis$2.PromiseRejectionEvent);
var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$3);
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
// We can't detect it synchronously, so just check versions
if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
// We can't use @@species feature detection in V8 since it causes
// deoptimization and performance degradation
// https://github.com/zloirock/core-js/issues/679
if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
// Detect correctness of subclassing with @@species support
var promise = new NativePromiseConstructor$3(function (resolve) { resolve(1); });
var FakePromise = function (exec) {
exec(function () { /* empty */ }, function () { /* empty */ });
};
var constructor = promise.constructor = {};
constructor[SPECIES] = FakePromise;
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
if (!SUBCLASSING) return true;
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
} return !GLOBAL_CORE_JS_PROMISE && (ENVIRONMENT === 'BROWSER' || ENVIRONMENT === 'DENO') && !NATIVE_PROMISE_REJECTION_EVENT$1;
});
var promiseConstructorDetection = {
CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
SUBCLASSING: SUBCLASSING
};
var newPromiseCapability$2 = {};
var aCallable$4 = aCallable$a;
var $TypeError$2 = TypeError;
var PromiseCapability = function (C) {
var resolve, reject;
this.promise = new C(function ($$resolve, $$reject) {
if (resolve !== undefined || reject !== undefined) throw new $TypeError$2('Bad Promise constructor');
resolve = $$resolve;
reject = $$reject;
});
this.resolve = aCallable$4(resolve);
this.reject = aCallable$4(reject);
};
// `NewPromiseCapability` abstract operation
// https://tc39.es/ecma262/#sec-newpromisecapability
newPromiseCapability$2.f = function (C) {
return new PromiseCapability(C);
};
var $$5 = _export;
var IS_NODE = environmentIsNode;
var globalThis$1 = globalThis_1;
var call$6 = functionCall;
var defineBuiltIn$2 = defineBuiltIn$6;
var setPrototypeOf = objectSetPrototypeOf;
var setToStringTag = setToStringTag$4;
var setSpecies = setSpecies$1;
var aCallable$3 = aCallable$a;
var isCallable$1 = isCallable$k;
var isObject$1 = isObject$b;
var anInstance = anInstance$1;
var speciesConstructor = speciesConstructor$1;
var task = task$1.set;
var microtask = microtask_1;
var hostReportErrors = hostReportErrors$1;
var perform$2 = perform$3;
var Queue = queue$1;
var InternalStateModule = internalState;
var NativePromiseConstructor$2 = promiseNativeConstructor;
var PromiseConstructorDetection = promiseConstructorDetection;
var newPromiseCapabilityModule$3 = newPromiseCapability$2;
var PROMISE = 'Promise';
var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR;
var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
var setInternalState = InternalStateModule.set;
var NativePromisePrototype$1 = NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype;
var PromiseConstructor = NativePromiseConstructor$2;
var PromisePrototype = NativePromisePrototype$1;
var TypeError$1 = globalThis$1.TypeError;
var document$1 = globalThis$1.document;
var process = globalThis$1.process;
var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
var newGenericPromiseCapability = newPromiseCapability$1;
var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && globalThis$1.dispatchEvent);
var UNHANDLED_REJECTION = 'unhandledrejection';
var REJECTION_HANDLED = 'rejectionhandled';
var PENDING = 0;
var FULFILLED = 1;
var REJECTED = 2;
var HANDLED = 1;
var UNHANDLED = 2;
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
// helpers
var isThenable = function (it) {
var then;
return isObject$1(it) && isCallable$1(then = it.then) ? then : false;
};
var callReaction = function (reaction, state) {
var value = state.value;
var ok = state.state === FULFILLED;
var handler = ok ? reaction.ok : reaction.fail;
var resolve = reaction.resolve;
var reject = reaction.reject;
var domain = reaction.domain;
var result, then, exited;
try {
if (handler) {
if (!ok) {
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
state.rejection = HANDLED;
}
if (handler === true) result = value;
else {
if (domain) domain.enter();
result = handler(value); // can throw
if (domain) {
domain.exit();
exited = true;
}
}
if (result === reaction.promise) {
reject(new TypeError$1('Promise-chain cycle'));
} else if (then = isThenable(result)) {
call$6(then, result, resolve, reject);
} else resolve(result);
} else reject(value);
} catch (error) {
if (domain && !exited) domain.exit();
reject(error);
}
};
var notify = function (state, isReject) {
if (state.notified) return;
state.notified = true;
microtask(function () {
var reactions = state.reactions;
var reaction;
while (reaction = reactions.get()) {
callReaction(reaction, state);
}
state.notified = false;
if (isReject && !state.rejection) onUnhandled(state);
});
};
var dispatchEvent = function (name, promise, reason) {
var event, handler;
if (DISPATCH_EVENT) {
event = document$1.createEvent('Event');
event.promise = promise;
event.reason = reason;
event.initEvent(name, false, true);
globalThis$1.dispatchEvent(event);
} else event = { promise: promise, reason: reason };
if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis$1['on' + name])) handler(event);
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
};
var onUnhandled = function (state) {
call$6(task, globalThis$1, function () {
var promise = state.facade;
var value = state.value;
var IS_UNHANDLED = isUnhandled(state);
var result;
if (IS_UNHANDLED) {
result = perform$2(function () {
if (IS_NODE) {
process.emit('unhandledRejection', value, promise);
} else dispatchEvent(UNHANDLED_REJECTION, promise, value);
});
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
if (result.error) throw result.value;
}
});
};
var isUnhandled = function (state) {
return state.rejection !== HANDLED && !state.parent;
};
var onHandleUnhandled = function (state) {
call$6(task, globalThis$1, function () {
var promise = state.facade;
if (IS_NODE) {
process.emit('rejectionHandled', promise);
} else dispatchEvent(REJECTION_HANDLED, promise, state.value);
});
};
var bind$1 = function (fn, state, unwrap) {
return function (value) {
fn(state, value, unwrap);
};
};
var internalReject = function (state, value, unwrap) {
if (state.done) return;
state.done = true;
if (unwrap) state = unwrap;
state.value = value;
state.state = REJECTED;
notify(state, true);
};
var internalResolve = function (state, value, unwrap) {
if (state.done) return;
state.done = true;
if (unwrap) state = unwrap;
try {
if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself");
var then = isThenable(value);
if (then) {
microtask(function () {
var wrapper = { done: false };
try {
call$6(then, value,
bind$1(internalResolve, wrapper, state),
bind$1(internalReject, wrapper, state)
);
} catch (error) {
internalReject(wrapper, error, state);
}
});
} else {
state.value = value;
state.state = FULFILLED;
notify(state, false);
}
} catch (error) {
internalReject({ done: false }, error, state);
}
};
// constructor polyfill
if (FORCED_PROMISE_CONSTRUCTOR$4) {
// 25.4.3.1 Promise(executor)
PromiseConstructor = function Promise(executor) {
anInstance(this, PromisePrototype);
aCallable$3(executor);
call$6(Internal, this);
var state = getInternalPromiseState(this);
try {
executor(bind$1(internalResolve, state), bind$1(internalReject, state));
} catch (error) {
internalReject(state, error);
}
};
PromisePrototype = PromiseConstructor.prototype;
// eslint-disable-next-line no-unused-vars -- required for `.length`
Internal = function Promise(executor) {
setInternalState(this, {
type: PROMISE,
done: false,
notified: false,
parent: false,
reactions: new Queue(),
rejection: false,
state: PENDING,
value: null
});
};
// `Promise.prototype.then` method
// https://tc39.es/ecma262/#sec-promise.prototype.then
Internal.prototype = defineBuiltIn$2(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
var state = getInternalPromiseState(this);
var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
state.parent = true;
reaction.ok = isCallable$1(onFulfilled) ? onFulfilled : true;
reaction.fail = isCallable$1(onRejected) && onRejected;
reaction.domain = IS_NODE ? process.domain : undefined;
if (state.state === PENDING) state.reactions.add(reaction);
else microtask(function () {
callReaction(reaction, state);
});
return reaction.promise;
});
OwnPromiseCapability = function () {
var promise = new Internal();
var state = getInternalPromiseState(promise);
this.promise = promise;
this.resolve = bind$1(internalResolve, state);
this.reject = bind$1(internalReject, state);
};
newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
return C === PromiseConstructor || C === PromiseWrapper
? new OwnPromiseCapability(C)
: newGenericPromiseCapability(C);
};
if (isCallable$1(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
nativeThen = NativePromisePrototype$1.then;
if (!NATIVE_PROMISE_SUBCLASSING) {
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
defineBuiltIn$2(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
var that = this;
return new PromiseConstructor(function (resolve, reject) {
call$6(nativeThen, that, resolve, reject);
}).then(onFulfilled, onRejected);
// https://github.com/zloirock/core-js/issues/640
}, { unsafe: true });
}
// make `.constructor === Promise` work for native promise-based APIs
try {
delete NativePromisePrototype$1.constructor;
} catch (error) { /* empty */ }
// make `instanceof Promise` work for native promise-based APIs
if (setPrototypeOf) {
setPrototypeOf(NativePromisePrototype$1, PromisePrototype);
}
}
}
// `Promise` constructor
// https://tc39.es/ecma262/#sec-promise-executor
$$5({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
Promise: PromiseConstructor
});
setToStringTag(PromiseConstructor, PROMISE, false);
setSpecies(PROMISE);
var wellKnownSymbol$2 = wellKnownSymbol$g;
var Iterators$1 = iterators;
var ITERATOR$2 = wellKnownSymbol$2('iterator');
var ArrayPrototype = Array.prototype;
// check on default Array iterator
var isArrayIteratorMethod$1 = function (it) {
return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
};
var classof = classof$5;
var getMethod$1 = getMethod$3;
var isNullOrUndefined = isNullOrUndefined$4;
var Iterators = iterators;
var wellKnownSymbol$1 = wellKnownSymbol$g;
var ITERATOR$1 = wellKnownSymbol$1('iterator');
var getIteratorMethod$2 = function (it) {
if (!isNullOrUndefined(it)) return getMethod$1(it, ITERATOR$1)
|| getMethod$1(it, '@@iterator')
|| Iterators[classof(it)];
};
var call$5 = functionCall;
var aCallable$2 = aCallable$a;
var anObject$5 = anObject$b;
var tryToString$1 = tryToString$5;
var getIteratorMethod$1 = getIteratorMethod$2;
var $TypeError$1 = TypeError;
var getIterator$1 = function (argument, usingIterator) {
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
if (aCallable$2(iteratorMethod)) return anObject$5(call$5(iteratorMethod, argument));
throw new $TypeError$1(tryToString$1(argument) + ' is not iterable');
};
var call$4 = functionCall;
var anObject$4 = anObject$b;
var getMethod = getMethod$3;
var iteratorClose$1 = function (iterator, kind, value) {
var innerResult, innerError;
anObject$4(iterator);
try {
innerResult = getMethod(iterator, 'return');
if (!innerResult) {
if (kind === 'throw') throw value;
return value;
}
innerResult = call$4(innerResult, iterator);
} catch (error) {
innerError = true;
innerResult = error;
}
if (kind === 'throw') throw value;
if (innerError) throw innerResult;
anObject$4(innerResult);
return value;
};
var bind = functionBindContext;
var call$3 = functionCall;
var anObject$3 = anObject$b;
var tryToString = tryToString$5;
var isArrayIteratorMethod = isArrayIteratorMethod$1;
var lengthOfArrayLike = lengthOfArrayLike$4;
var isPrototypeOf$1 = objectIsPrototypeOf;
var getIterator = getIterator$1;
var getIteratorMethod = getIteratorMethod$2;
var iteratorClose = iteratorClose$1;
var $TypeError = TypeError;
var Result = function (stopped, result) {
this.stopped = stopped;
this.result = result;
};
var ResultPrototype = Result.prototype;
var iterate$2 = function (iterable, unboundFunction, options) {
var that = options && options.that;
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
var IS_RECORD = !!(options && options.IS_RECORD);
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
var INTERRUPTED = !!(options && options.INTERRUPTED);
var fn = bind(unboundFunction, that);
var iterator, iterFn, index, length, result, next, step;
var stop = function (condition) {
if (iterator) iteratorClose(iterator, 'normal', condition);
return new Result(true, condition);
};
var callFn = function (value) {
if (AS_ENTRIES) {
anObject$3(value);
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
} return INTERRUPTED ? fn(value, stop) : fn(value);
};
if (IS_RECORD) {
iterator = iterable.iterator;
} else if (IS_ITERATOR) {
iterator = iterable;
} else {
iterFn = getIteratorMethod(iterable);
if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
// optimisation for array iterators
if (isArrayIteratorMethod(iterFn)) {
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
result = callFn(iterable[index]);
if (result && isPrototypeOf$1(ResultPrototype, result)) return result;
} return new Result(false);
}
iterator = getIterator(iterable, iterFn);
}
next = IS_RECORD ? iterable.next : iterator.next;
while (!(step = call$3(next, iterator)).done) {
try {
result = callFn(step.value);
} catch (error) {
iteratorClose(iterator, 'throw', error);
}
if (typeof result == 'object' && result && isPrototypeOf$1(ResultPrototype, result)) return result;
} return new Result(false);
};
var wellKnownSymbol = wellKnownSymbol$g;
var ITERATOR = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;
try {
var called = 0;
var iteratorWithReturn = {
next: function () {
return { done: !!called++ };
},
'return': function () {
SAFE_CLOSING = true;
}
};
iteratorWithReturn[ITERATOR] = function () {
return this;
};
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }
var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
try {
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
} catch (error) { return false; } // workaround of old WebKit + `eval` bug
var ITERATION_SUPPORT = false;
try {
var object = {};
object[ITERATOR] = function () {
return {
next: function () {
return { done: ITERATION_SUPPORT = true };
}
};
};
exec(object);
} catch (error) { /* empty */ }
return ITERATION_SUPPORT;
};
var NativePromiseConstructor$1 = promiseNativeConstructor;
var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
});
var $$4 = _export;
var call$2 = functionCall;
var aCallable$1 = aCallable$a;
var newPromiseCapabilityModule$2 = newPromiseCapability$2;
var perform$1 = perform$3;
var iterate$1 = iterate$2;
var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
// `Promise.all` method
// https://tc39.es/ecma262/#sec-promise.all
$$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
all: function all(iterable) {
var C = this;
var capability = newPromiseCapabilityModule$2.f(C);
var resolve = capability.resolve;
var reject = capability.reject;
var result = perform$1(function () {
var $promiseResolve = aCallable$1(C.resolve);
var values = [];
var counter = 0;
var remaining = 1;
iterate$1(iterable, function (promise) {
var index = counter++;
var alreadyCalled = false;
remaining++;
call$2($promiseResolve, C, promise).then(function (value) {
if (alreadyCalled) return;
alreadyCalled = true;
values[index] = value;
--remaining || resolve(values);
}, reject);
});
--remaining || resolve(values);
});
if (result.error) reject(result.value);
return capability.promise;
}
});
var $$3 = _export;
var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
var NativePromiseConstructor = promiseNativeConstructor;
var getBuiltIn$1 = getBuiltIn$7;
var isCallable = isCallable$k;
var defineBuiltIn$1 = defineBuiltIn$6;
var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
// `Promise.prototype.catch` method
// https://tc39.es/ecma262/#sec-promise.prototype.catch
$$3({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
'catch': function (onRejected) {
return this.then(undefined, onRejected);
}
});
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
if (isCallable(NativePromiseConstructor)) {
var method = getBuiltIn$1('Promise').prototype['catch'];
if (NativePromisePrototype['catch'] !== method) {
defineBuiltIn$1(NativePromisePrototype, 'catch', method, { unsafe: true });
}
}
var $$2 = _export;
var call$1 = functionCall;
var aCallable = aCallable$a;
var newPromiseCapabilityModule$1 = newPromiseCapability$2;
var perform = perform$3;
var iterate = iterate$2;
var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
// `Promise.race` method
// https://tc39.es/ecma262/#sec-promise.race
$$2({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
race: function race(iterable) {
var C = this;
var capability = newPromiseCapabilityModule$1.f(C);
var reject = capability.reject;
var result = perform(function () {
var $promiseResolve = aCallable(C.resolve);
iterate(iterable, function (promise) {
call$1($promiseResolve, C, promise).then(capability.resolve, reject);
});
});
if (result.error) reject(result.value);
return capability.promise;
}
});
var $$1 = _export;
var newPromiseCapabilityModule = newPromiseCapability$2;
var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
// `Promise.reject` method
// https://tc39.es/ecma262/#sec-promise.reject
$$1({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
reject: function reject(r) {
var capability = newPromiseCapabilityModule.f(this);
var capabilityReject = capability.reject;
capabilityReject(r);
return capability.promise;
}
});
var anObject$2 = anObject$b;
var isObject = isObject$b;
var newPromiseCapability = newPromiseCapability$2;
var promiseResolve$1 = function (C, x) {
anObject$2(C);
if (isObject(x) && x.constructor === C) return x;
var promiseCapability = newPromiseCapability.f(C);
var resolve = promiseCapability.resolve;
resolve(x);
return promiseCapability.promise;
};
var $ = _export;
var getBuiltIn = getBuiltIn$7;
var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
var promiseResolve = promiseResolve$1;
getBuiltIn('Promise');
// `Promise.resolve` method
// https://tc39.es/ecma262/#sec-promise.resolve
$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
resolve: function resolve(x) {
return promiseResolve(this, x);
}
});
const HardwareWalletAccountsForm = ({
accounts,
onSelectedChanged,
onSubmit,
onChangeRoute
}) => {
return jsxRuntime.jsxs("div", Object.assign({
className: "choose-ledger-account-form-wrapper"
}, {
children: [jsxRuntime.jsxs("p", {
children: ["We found ", accounts.length, " accounts on your device. Select the account(s) you wish to connect."]
}), jsxRuntime.jsx("div", Object.assign({
className: "button-wrapper"
}, {
children: jsxRuntime.jsx("button", Object.assign({
onClick: () => {
onChangeRoute("SpecifyHDPath");
}
}, {
children: "HD.../0"
}))
})), jsxRuntime.jsx("form", Object.assign({
className: "form",
onSubmit: e => {
onSubmit(accounts, e);
}
}, {
children: jsxRuntime.jsxs("div", {
children: [jsxRuntime.jsx("div", Object.assign({
className: "nws-form-control"
}, {
children: accounts.map((account, index) => jsxRuntime.jsxs("div", Object.assign({
className: "account"
}, {
children: [jsxRuntime.jsx("input", {
onChange: e => {
onSelectedChanged(index, e.target.checked);
},
checked: account.selected,
type: "checkbox",
id: account.accountId,
name: account.accountId,
value: account.accountId
}), jsxRuntime.jsxs("label", Object.assign({
htmlFor: account.accountId
}, {
children: [" ", account.accountId]
})), jsxRuntime.jsx("br", {})]
}), index))
})), jsxRuntime.jsx("div", Object.assign({
className: "action-buttons"
}, {
children: jsxRuntime.jsx("button", Object.assign({
className: "middleButton",
type: "submit",
disabled: !accounts.some(x => x.selected)
}, {
children: "Connect"
}))
}))]
})
}))]
}));
};
const WalletConnecting = ({
wallet,
onBack
}) => {
return jsxRuntime.jsxs(React.Fragment, {
children: [jsxRuntime.jsx(ModalHeader, {
title: "",
onCloseModal: onBack
}), jsxRuntime.jsx("div", Object.assign({
className: "connecting-wrapper"
}, {
children: jsxRuntime.jsxs("div", Object.assign({
className: "content"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "icon"
}, {
children: jsxRuntime.jsx("img", {
src: wallet === null || wallet === void 0 ? void 0 : wallet.metadata.iconUrl,
alt: wallet === null || wallet === void 0 ? void 0 : wallet.metadata.name
})
})), jsxRuntime.jsx("h3", Object.assign({
className: "connecting-name"
}, {
children: wallet === null || wallet === void 0 ? void 0 : wallet.metadata.name
})), jsxRuntime.jsx("div", Object.assign({
className: "connecting-message"
}, {
children: jsxRuntime.jsx("span", {
children: core.translate(`modal.wallet.connectingMessage.${wallet === null || wallet === void 0 ? void 0 : wallet.type}`)
})
})), jsxRuntime.jsx("div", Object.assign({
className: "connecting-details"
}, {
children: jsxRuntime.jsxs("div", Object.assign({
className: "loading-dots"
}, {
children: [jsxRuntime.jsx("div", {
className: "loading-dot"
}), jsxRuntime.jsx("div", {
className: "loading-dot"
}), jsxRuntime.jsx("div", {
className: "loading-dot"
})]
}))
}))]
}))
}))]
});
};
const LedgerDeviceIcon = () => {
return jsxRuntime.jsxs("svg", Object.assign({
width: "317",
height: "157",
viewBox: "0 0 317 157",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: [jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M249.99 16.0994C270.063 -0.864155 289.788 1.58873 301.497 10.7365C307.402 15.3499 311.278 21.6575 312.267 28.1258C313.247 34.5412 311.413 41.2233 305.692 46.8044C297.366 54.9273 286.343 55.3362 273.015 51.5109C261.654 48.25 249.058 42.0377 235.726 35.4627L235.726 35.4626L235.717 35.458C233.367 34.2992 230.995 33.129 228.602 31.9618C212.742 24.2253 196.067 16.6575 179.842 13.8595C163.538 11.0479 147.552 13.0313 133.266 24.522C128.032 28.732 123.478 35.2086 121.716 44.8205C119.961 54.3947 120.992 66.9771 126.703 83.4311C135.432 108.583 132.899 126.677 123.575 138.063C114.217 149.491 97.5614 154.733 76.7887 153.121C55.0043 151.43 29.0621 142.206 3.29867 125.227L0.887817 127.942C27.2472 145.405 53.9251 154.952 76.5105 156.705C97.9028 158.365 115.96 153.035 126.356 140.341C136.785 127.606 139.045 108.029 130.099 82.2524C124.521 66.1801 123.642 54.2493 125.252 45.4687C126.854 36.7258 130.94 31.006 135.519 27.3232C148.794 16.6458 163.649 14.715 179.231 17.4021C194.891 20.1027 211.146 27.4463 227.026 35.1928C229.381 36.3415 231.729 37.5001 234.066 38.6531L234.073 38.6568C247.382 45.223 260.324 51.608 272.024 54.9662C285.819 58.9258 298.493 58.8501 308.202 49.3776C314.764 42.9759 316.974 35.1288 315.82 27.5826C314.675 20.0893 310.237 13.0029 303.71 7.90363C290.555 -2.37382 268.938 -4.62038 247.67 13.3537L249.99 16.0994Z",
fill: "url(#paint0_linear_3_672)"
}), jsxRuntime.jsx("path", {
d: "M260.264 17.8767L177.605 89.4649L157.679 73.9664L239.23 3.85423L260.264 17.8767Z",
fill: "#6A7075"
}), jsxRuntime.jsx("path", {
d: "M205.939 54.4577L199.764 50.2636L233.316 20.9053L239.907 25.8395L205.939 54.4577Z",
fill: "#494E52"
}), jsxRuntime.jsx("path", {
d: "M260.264 17.8757L177.605 89.4639L182.033 98.3202L264.323 26.363L260.264 17.8757Z",
fill: "#494E52"
}), jsxRuntime.jsx("path", {
d: "M177.236 89.4646L181.295 98.3209L165.059 85.7745L170.963 85.0365L177.236 89.4646Z",
fill: "black"
}), jsxRuntime.jsx("path", {
d: "M93.4708 99.6384L91.9948 110.13L174.653 92.894L164.69 85.7749L93.4708 99.6384Z",
fill: "#DCDADA"
}), jsxRuntime.jsx("path", {
d: "M93.1157 104.323L94.314 100.129L165.613 86.3483L169.208 89.344L93.1157 104.323Z",
fill: "#C1C1C1"
}), jsxRuntime.jsx("path", {
d: "M94.2086 99.7963L86.0903 101.272L92.3635 110.129L94.2086 99.7963Z",
fill: "#B3AAAA"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M86.0903 100.907L89.0027 74.1304L178.455 55.2416C184.695 53.9962 195.766 54.7675 197.177 63.7058C198.284 70.717 195.506 73.9943 191.628 77.3592C188.495 80.0671 180.152 82.4646 178.343 82.8944C178.293 82.9064 178.241 82.9188 178.186 82.9319C177.38 83.1245 176.007 83.4525 170.644 84.5088C169.085 84.8158 167.382 85.1501 165.557 85.5078L164.933 85.63C146.312 89.2764 115.528 95.2297 93.9844 99.3849C91.1808 99.9257 88.5337 100.436 86.0903 100.907ZM185.076 75.554C190.748 73.3535 193.99 68.0745 192.318 63.7631C190.645 59.4517 184.691 57.7405 179.019 59.941C173.347 62.1416 170.105 67.4206 171.778 71.732C173.45 76.0434 179.404 77.7546 185.076 75.554Z",
fill: "#F4F1E8"
}), jsxRuntime.jsx("path", {
d: "M199.764 50.3994L196.768 48.3043L232.194 18.0454L233.316 21.6403L199.764 50.3994Z",
fill: "black"
}), jsxRuntime.jsx("path", {
d: "M239.968 25.9943L232.588 20.4592V17.5071L241.813 24.5183L239.968 25.9943Z",
fill: "black"
}), jsxRuntime.jsx("ellipse", {
cx: "182.084",
cy: "68.0811",
rx: "10.242",
ry: "7.46772",
transform: "rotate(-23.7949 182.084 68.0811)",
fill: "#494E52"
}), jsxRuntime.jsx("ellipse", {
cx: "182.084",
cy: "68.0816",
rx: "6.68462",
ry: "4.87394",
transform: "rotate(-23.7949 182.084 68.0816)",
fill: "#494E52"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M238.725 2.93094L260.368 17.2564L264.865 26.4556L181.615 99.0341L175.16 94.311L92.0028 110.947L85.3267 101.399L88.3269 73.8157L178.118 54.8553L238.725 2.93094ZM178.599 56.2622L89.6786 75.0388L86.9321 100.29C89.0979 99.8725 91.4124 99.4263 93.8446 98.9572C115.388 94.8019 146.171 88.8488 164.791 85.2026L165.415 85.0804C167.24 84.7228 168.943 84.3885 170.501 84.0816C175.853 83.0275 177.219 82.701 178.015 82.5107C178.07 82.4976 178.122 82.4852 178.173 82.4732C179.048 82.2652 181.558 81.5669 184.235 80.5851C186.742 79.6655 189.286 78.5354 190.802 77.3758L191.151 77.0922L191.644 76.6595C193.341 75.147 194.723 73.6739 195.61 71.871C196.571 69.916 196.982 67.5029 196.448 64.1178C195.8 60.0131 192.959 57.7574 189.408 56.6566C185.833 55.5483 181.637 55.6566 178.603 56.2615C178.601 56.2617 178.6 56.262 178.599 56.2622ZM192.631 77.7565L259.555 18.9531L263.042 26.0869L181.808 96.9078L178.132 89.5713L191.724 78.529C191.859 78.4249 191.988 78.32 192.11 78.2144L192.111 78.2136C192.286 78.0617 192.46 77.9094 192.631 77.7565ZM185.491 81.6908C185.24 81.7868 184.99 81.8802 184.743 81.9709C182.013 82.9723 179.447 83.6875 178.514 83.9093C178.463 83.9213 178.411 83.9338 178.356 83.9468C177.635 84.1192 176.472 84.3971 172.491 85.1919L177.172 88.4492L185.491 81.6908ZM176.631 89.8707L170.479 85.5903C169.306 85.8213 168.054 86.0673 166.731 86.3265L175.769 92.9276L179.548 95.6924L176.631 89.8707ZM164.758 86.7132C146.252 90.3362 116.027 96.1817 94.6324 100.308L93.2258 109.197L173.543 93.1293L164.758 86.7132ZM91.888 108.207L93.0909 100.606C91.0848 100.993 89.1642 101.363 87.3471 101.713L91.888 108.207ZM258.581 17.8436L197.306 71.6841C198.142 69.5779 198.41 67.0795 197.906 63.8876C197.143 59.0539 193.743 56.4549 189.845 55.2467C186.921 54.3402 183.662 54.1916 180.861 54.449L238.84 4.77668L258.581 17.8436ZM232.505 16.82L243.089 24.5643L205.915 56.5106L196.042 48.0665L232.505 16.82ZM232.118 19.096L198.312 48.0654L199.744 49.29L232.584 20.9424L232.118 19.096ZM233.456 22.1396L200.878 50.2604L205.913 54.5664L239.041 26.0969L233.456 22.1396ZM240.195 25.1054L240.717 24.6571L233.759 19.5663L234.06 20.7586L240.195 25.1054Z",
fill: "black"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M190.194 69.9744C191.32 68.1409 191.576 66.2271 190.942 64.5937C190.308 62.9603 188.829 61.7198 186.761 61.1254C184.691 60.5307 182.116 60.6196 179.553 61.6139C176.991 62.6081 175.029 64.2794 173.902 66.1141C172.776 67.9477 172.52 69.8614 173.154 71.4948C173.788 73.1282 175.267 74.3687 177.335 74.9631C179.405 75.5578 181.98 75.4689 184.543 74.4746C187.105 73.4804 189.067 71.8091 190.194 69.9744ZM185.077 75.8508C190.749 73.6502 193.991 68.3712 192.318 64.0598C190.645 59.7484 184.691 58.0372 179.019 60.2378C173.347 62.4383 170.105 67.7173 171.778 72.0287C173.451 76.3401 179.405 78.0513 185.077 75.8508Z",
fill: "black"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M187.391 69.169C188.127 67.9713 188.266 66.7721 187.881 65.7812C187.497 64.7903 186.586 63.9984 185.235 63.6102C183.883 63.2216 182.173 63.2741 180.456 63.9404C178.738 64.6068 177.441 65.7208 176.705 66.9196C175.969 68.1172 175.83 69.3165 176.215 70.3074C176.599 71.2983 177.511 72.0901 178.861 72.4783C180.214 72.8669 181.923 72.8144 183.64 72.1481C185.358 71.4818 186.655 70.3678 187.391 69.169ZM184.174 73.5242C188.156 71.9795 190.432 68.2738 189.257 65.2473C188.083 62.2208 183.904 61.0196 179.922 62.5643C175.94 64.1091 173.665 67.8148 174.839 70.8412C176.013 73.8677 180.193 75.0689 184.174 73.5242Z",
fill: "black"
}), jsxRuntime.jsx("path", {
d: "M240.499 41.2441C239.744 40.3649 239.844 39.04 240.724 38.285L249.781 30.5067C250.66 29.7516 251.985 29.8523 252.74 30.7315V30.7315C253.495 31.6108 253.395 32.9356 252.516 33.6907L243.458 41.469C242.579 42.224 241.254 42.1234 240.499 41.2441V41.2441Z",
fill: "black"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M250.743 31.6265L241.685 39.4048C241.424 39.6287 241.395 40.0217 241.619 40.2825C241.842 40.5433 242.235 40.5731 242.496 40.3492L251.554 32.5709C251.815 32.3469 251.845 31.954 251.621 31.6932C251.397 31.4324 251.004 31.4025 250.743 31.6265ZM240.724 38.285C239.844 39.04 239.744 40.3649 240.499 41.2441C241.254 42.1234 242.579 42.224 243.458 41.469L252.516 33.6907C253.395 32.9356 253.495 31.6108 252.74 30.7315C251.985 29.8523 250.66 29.7516 249.781 30.5067L240.724 38.285Z",
fill: "black"
}), jsxRuntime.jsx("path", {
d: "M205.779 71.4647C205.005 70.5642 205.108 69.2073 206.009 68.4339L214.989 60.7218C215.89 59.9485 217.247 60.0516 218.02 60.9521V60.9521C218.793 61.8526 218.69 63.2095 217.79 63.9829L208.809 71.695C207.909 72.4683 206.552 72.3652 205.779 71.4647V71.4647Z",
fill: "black"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M215.951 61.8416L206.97 69.5537C206.688 69.796 206.656 70.221 206.898 70.5031C207.141 70.7851 207.566 70.8174 207.848 70.5752L216.828 62.863C217.11 62.6208 217.143 62.1958 216.9 61.9137C216.658 61.6317 216.233 61.5994 215.951 61.8416ZM206.009 68.4339C205.108 69.2073 205.005 70.5642 205.779 71.4647C206.552 72.3652 207.909 72.4683 208.809 71.695L217.79 63.9829C218.69 63.2095 218.793 61.8526 218.02 60.9521C217.247 60.0516 215.89 59.9485 214.989 60.7218L206.009 68.4339Z",
fill: "black"
}), jsxRuntime.jsx("circle", {
cx: "141.356",
cy: "19.525",
r: "10.1855",
fill: "#FE89B4"
}), jsxRuntime.jsx("ellipse", {
cx: "139.062",
cy: "14.7094",
rx: "2.42519",
ry: "1.94015",
transform: "rotate(-34.544 139.062 14.7094)",
fill: "#FDF7FF"
}), jsxRuntime.jsx("circle", {
cx: "252.489",
cy: "79.7577",
r: "7.78893",
fill: "#EC5236"
}), jsxRuntime.jsx("ellipse", {
cx: "250.434",
cy: "76.3701",
rx: "2.61272",
ry: "2.09018",
transform: "rotate(-34.544 250.434 76.3701)",
fill: "#EDB69D"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M100.436 79.9254C100.461 79.6567 100.732 79.3897 101.042 79.329L106.657 78.2299C107.587 78.0478 108.281 78.5536 108.207 79.3596L107.759 84.2243C107.734 84.493 107.463 84.76 107.153 84.8207L100.416 86.1396C100.106 86.2003 99.8742 86.0317 99.899 85.7631L100.436 79.9254Z",
fill: "#B3AAAA"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M95.8553 81.7775C95.9294 80.9715 96.7437 80.1704 97.6739 79.9883L98.7968 79.7685C99.1069 79.7078 99.3382 79.8764 99.3135 80.1451L99.1344 82.091C99.1096 82.3597 98.8382 82.6267 98.5282 82.6874L96.2824 83.127C95.9723 83.1877 95.741 83.0191 95.7657 82.7505L95.8553 81.7775Z",
fill: "#B3AAAA"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M95.5865 84.6965C95.6112 84.4278 95.8826 84.1608 96.1927 84.1001L98.4385 83.6605C98.7486 83.5998 98.9799 83.7684 98.9552 84.037L98.7761 85.9829C98.7513 86.2516 98.4799 86.5186 98.1699 86.5793L95.9241 87.019C95.614 87.0797 95.3827 86.9111 95.4074 86.6424L95.5865 84.6965Z",
fill: "#B3AAAA"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M95.2282 88.5884C95.2529 88.3197 95.5244 88.0527 95.8344 87.992L98.0802 87.5524C98.3903 87.4917 98.6216 87.6603 98.5969 87.929L98.4178 89.8749C98.3931 90.1435 98.1216 90.4105 97.8116 90.4712L96.6887 90.6911C95.7584 90.8732 95.0645 90.3674 95.1387 89.5614L95.2282 88.5884Z",
fill: "#B3AAAA"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M99.7197 87.709C99.7444 87.4403 100.016 87.1733 100.326 87.1126L102.572 86.673C102.882 86.6123 103.113 86.7809 103.088 87.0496L102.909 88.9955C102.885 89.2641 102.613 89.5312 102.303 89.5919L100.057 90.0315C99.7472 90.0922 99.5159 89.9236 99.5406 89.6549L99.7197 87.709Z",
fill: "#B3AAAA"
}), jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M104.211 86.8298C104.236 86.5611 104.507 86.2941 104.817 86.2334L107.063 85.7938C107.373 85.7331 107.605 85.9017 107.58 86.1704L107.49 87.1433C107.416 87.9493 106.602 88.7504 105.672 88.9325L104.549 89.1523C104.239 89.213 104.007 89.0444 104.032 88.7757L104.211 86.8298Z",
fill: "#B3AAAA"
}), jsxRuntime.jsx("defs", {
children: jsxRuntime.jsxs("linearGradient", Object.assign({
id: "paint0_linear_3_672",
x1: "-44.5195",
y1: "122.42",
x2: "263.357",
y2: "-8.65023",
gradientUnits: "userSpaceOnUse"
}, {
children: [jsxRuntime.jsx("stop", {
offset: "0.110697",
stopColor: "#232323"
}), jsxRuntime.jsx("stop", {
offset: "1",
stopColor: "#3D3D3D"
})]
}))
})]
}));
};
const UpArrowIcon = () => {
return jsxRuntime.jsx("svg", Object.assign({
width: "10",
height: "7",
viewBox: "0 0 10 7",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: jsxRuntime.jsx("path", {
d: "M9 5.4762L5 1.4762L1 5.4762",
stroke: "#4F7CD1",
strokeWidth: "1.5",
strokeLinecap: "round",
strokeLinejoin: "round"
})
}));
};
const DownArrowIcon = () => {
return jsxRuntime.jsx("svg", Object.assign({
width: "10",
height: "7",
viewBox: "0 0 10 7",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: jsxRuntime.jsx("path", {
d: "M1 1.52382L5 5.52382L9 1.52382",
stroke: "#4F7CD1",
strokeWidth: "1.5",
strokeLinecap: "round",
strokeLinejoin: "round"
})
}));
};
const DEFAULT_DERIVATION_PATH = "44'/397'/0'/0'/1'";
const DerivationPath = ({
selector,
options,
onBack,
onConnected,
params,
onError,
onCloseModal
}) => {
const [route, setRoute] = React.useState("EnterDerivationPath");
const [derivationPath, setDerivationPath] = React.useState(DEFAULT_DERIVATION_PATH);
const [customDerivationPath, setCustomDerivationPath] = React.useState(1);
const [accounts, setAccounts] = React.useState([]);
const [selectedAccounts, setSelectedAccounts] = React.useState([]);
const [hardwareWallet, setHardwareWallet] = React.useState();
const [customAccountId, setCustomAccountId] = React.useState("");
const [connecting, setConnecting] = React.useState(false);
const initialHeaderTitle = core.translate("modal.ledger.connectWithLedger");
const [headerTitle, setHeaderTitle] = React.useState(initialHeaderTitle);
const getAccountIds = publicKey => __awaiter(void 0, void 0, void 0, function* () {
const url = `${selector.options.network.indexerUrl}/public_key/ed25519:${publicKey}`;
const response = yield fetch(url);
if (!response.ok) {
throw new Error("Failed to get account ID from public key");
}
const jsonResponse = yield response.json();
const {
account_ids: accountIds
} = jsonResponse;
return Array.isArray(accountIds) ? accountIds : [];
});
const resolveAccounts = wallet => __awaiter(void 0, void 0, void 0, function* () {
const publicKey = yield wallet.getPublicKey(derivationPath);
try {
const accountIds = yield getAccountIds(publicKey);
return accountIds.map((accountId, index) => {
return {
derivationPath,
publicKey,
accountId,
selected: index === 0
};
});
} catch (e) {
return null;
}
});
const handleValidateAccount = () => __awaiter(void 0, void 0, void 0, function* () {
const wallet = yield selector.wallet(params.walletId);
if (wallet.type !== "hardware") {
return;
}
setConnecting(true);
setHardwareWallet(wallet);
try {
const resolvedAccounts = yield resolveAccounts(wallet);
if (!resolvedAccounts) {
setRoute("AddCustomAccountId");
return;
}
const noAccounts = resolvedAccounts.length === 0;
const multipleAccounts = resolvedAccounts.length > 1;
if (noAccounts) {
setHeaderTitle(core.translate("modal.ledger.noAccountsFound"));
setRoute("NoAccountsFound");
return;
}
setAccounts(resolvedAccounts);
if (!multipleAccounts) {
setSelectedAccounts(resolvedAccounts);
setRoute("OverviewAccounts");
} else {
setHeaderTitle(core.translate("modal.ledger.selectYourAccounts"));
setRoute("ChooseAccount");
}
} catch (err) {
setConnecting(false);
const message = err && typeof err === "object" && "message" in err ? err.message : "Something went wrong";
onError(message, wallet);
} finally {
setConnecting(false);
}
});
const handleAddCustomAccountId = () => __awaiter(void 0, void 0, void 0, function* () {
try {
setConnecting(true);
const publicKey = yield hardwareWallet.getPublicKey(derivationPath);
const accountList = [{
derivationPath: derivationPath,
publicKey,
accountId: customAccountId,
selected: true
}];
setAccounts(accountList);
setSelectedAccounts(accountList);
setHeaderTitle(core.translate("modal.ledger.connecting1Account"));
setRoute("OverviewAccounts");
} catch (err) {
setConnecting(false);
const message = err && typeof err === "object" && "message" in err ? err.message : "Something went wrong";
onError(message, hardwareWallet);
} finally {
setConnecting(false);
}
});
const handleSignIn = () => {
const mapAccounts = selectedAccounts.map(account => {
return {
derivationPath: account.derivationPath,
publicKey: account.publicKey,
accountId: account.accountId
};
});
return hardwareWallet.signIn({
contractId: options.contractId,
methodNames: options.methodNames,
accounts: mapAccounts
}).then(() => onConnected()).catch(err => {
onError(`Error: ${err.message}`, hardwareWallet);
});
};
const handleOnBackButtonClick = () => {
if (route === "SpecifyHDPath" || route === "NoAccountsFound" || route === "ChooseAccount") {
setHeaderTitle(core.translate("modal.ledger.connectWithLedger"));
setRoute("EnterDerivationPath");
}
if (route === "OverviewAccounts") {
setHeaderTitle(core.translate("modal.ledger.selectYourAccounts"));
setRoute("ChooseAccount");
}
};
if (connecting) {
return jsxRuntime.jsx("div", Object.assign({
className: "derivation-path-wrapper"
}, {
children: jsxRuntime.jsx(WalletConnecting, {
wallet: hardwareWallet,
onBack: () => {
setConnecting(false);
}
})
}));
}
return jsxRuntime.jsxs(React.Fragment, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal-header-wrapper"
}, {
children: [(route === "SpecifyHDPath" || route === "NoAccountsFound" || route === "ChooseAccount" || route === "OverviewAccounts") && jsxRuntime.jsx(BackArrow, {
onClick: handleOnBackButtonClick
}), jsxRuntime.jsx(ModalHeader, {
title: headerTitle,
onCloseModal: onCloseModal
})]
})), jsxRuntime.jsxs("div", Object.assign({
className: "derivation-path-wrapper"
}, {
children: [route === "EnterDerivationPath" && jsxRuntime.jsxs("div", Object.assign({
className: "enter-derivation-path"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "ledger-image"
}, {
children: jsxRuntime.jsx(LedgerDeviceIcon, {})
})), jsxRuntime.jsxs("div", Object.assign({
className: "ledger-description"
}, {
children: [jsxRuntime.jsx("p", {
children: core.translate("modal.ledger.makeSureYourLedger")
}), jsxRuntime.jsx("p", Object.assign({
className: "specify-path",
onClick: () => {
setHeaderTitle(core.translate("modal.ledger.specifyHDPath"));
setRoute("SpecifyHDPath");
}
}, {
children: core.translate("modal.ledger.specifyHDPath")
}))]
})), jsxRuntime.jsx("div", Object.assign({
className: "action-buttons"
}, {
children: jsxRuntime.jsx("button", Object.assign({
className: "middleButton",
onClick: handleValidateAccount
}, {
children: core.translate("modal.ledger.continue")
}))
}))]
})), route === "SpecifyHDPath" && jsxRuntime.jsxs("div", Object.assign({
className: "specify-path-wrapper"
}, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "change-path-wrapper"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "display-path"
}, {
children: jsxRuntime.jsx("span", {
children: derivationPath.slice(0, -2)
})
})), jsxRuntime.jsxs("div", Object.assign({
className: "change-path"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "path-value"
}, {
children: jsxRuntime.jsx("span", {
children: customDerivationPath
})
})), jsxRuntime.jsxs("div", Object.assign({
className: "buttons-wrapper"
}, {
children: [jsxRuntime.jsx("button", Object.assign({
onClick: () => {
const newValue = customDerivationPath + 1;
const path = derivationPath.slice(0, -2);
setDerivationPath(`${path}${newValue}'`);
setCustomDerivationPath(newValue);
}
}, {
children: jsxRuntime.jsx(UpArrowIcon, {})
})), jsxRuntime.jsx("button", Object.assign({
onClick: () => {
const newValue = customDerivationPath - 1;
if (newValue < 0) {
return;
}
const path = derivationPath.slice(0, -2);
setDerivationPath(`${path}${newValue}'`);
setCustomDerivationPath(newValue);
}
}, {
children: jsxRuntime.jsx(DownArrowIcon, {})
}))]
}))]
}))]
})), jsxRuntime.jsx("p", Object.assign({
className: "path-description"
}, {
children: core.translate("modal.ledger.enterYourPreferredHDPath")
})), jsxRuntime.jsx("p", Object.assign({
className: "what-link"
}, {
children: jsxRuntime.jsx("a", Object.assign({
href: "https://www.ledger.com/academy/crypto/what-are-hierarchical-deterministic-hd-wallets",
target: "_blank"
}, {
children: "What's this?"
}))
})), jsxRuntime.jsx("div", Object.assign({
className: "action-buttons"
}, {
children: jsxRuntime.jsx("button", Object.assign({
className: "middleButton",
onClick: handleValidateAccount
}, {
children: core.translate("modal.ledger.scan")
}))
}))]
})), route === "NoAccountsFound" && jsxRuntime.jsx("div", Object.assign({
className: "no-accounts-found-wrapper"
}, {
children: jsxRuntime.jsxs("p", {
children: [core.translate("modal.ledger.cantFindAnyAccount"), " ", jsxRuntime.jsx("a", Object.assign({
href: `https://${selector.options.network.networkId === "testnet" ? "testnet" : "app"}.mynearwallet.com/create`,
target: "_blank"
}, {
children: "MyNearWallet"
})), " ", core.translate("modal.ledger.orConnectAnAnotherLedger")]
})
})), route === "ChooseAccount" && jsxRuntime.jsx(HardwareWalletAccountsForm, {
accounts: accounts,
onSelectedChanged: (index, selected) => {
setAccounts(prevAccounts => {
const updateAccounts = prevAccounts.map((account, idx) => {
const selectedValue = index === idx ? selected : account.selected;
return Object.assign(Object.assign({}, account), {
selected: selectedValue
});
});
return [...updateAccounts];
});
},
onSubmit: (acc, e) => {
e.preventDefault();
const selectedAcc = acc.filter(account => account.selected);
setSelectedAccounts(selectedAcc);
const numberOfAccounts = selectedAcc.length;
setHeaderTitle(`${core.translate("modal.ledger.connecting")} ${numberOfAccounts} ${core.translate("modal.ledger.ofAccounts")}`);
setRoute("OverviewAccounts");
},
onChangeRoute: newRoute => {
if (newRoute === "SpecifyHDPath") {
setHeaderTitle(core.translate("modal.ledger.specifyHDPath"));
}
setRoute(newRoute);
}
}), route === "AddCustomAccountId" && jsxRuntime.jsxs("div", Object.assign({
className: "enter-custom-account"
}, {
children: [jsxRuntime.jsx("p", {
children: core.translate("modal.ledger.failedToAutomatically")
}), jsxRuntime.jsx("div", Object.assign({
className: "input-wrapper"
}, {
children: jsxRuntime.jsx("input", {
type: "text",
placeholder: "Account ID",
value: customAccountId,
onChange: e => {
setCustomAccountId(e.target.value);
}
})
})), jsxRuntime.jsx("div", Object.assign({
className: "action-buttons"
}, {
children: jsxRuntime.jsx("button", Object.assign({
className: "middleButton",
onClick: handleAddCustomAccountId
}, {
children: core.translate("ledger.Continue")
}))
}))]
})), route === "OverviewAccounts" && jsxRuntime.jsxs("div", Object.assign({
className: "overview-wrapper"
}, {
children: [jsxRuntime.jsx("p", {
children: core.translate("modal.ledger.overviewTheListOfAuthorized")
}), jsxRuntime.jsx("div", Object.assign({
className: "accounts"
}, {
children: selectedAccounts.map((account, index) => jsxRuntime.jsx("div", {
children: jsxRuntime.jsx("div", Object.assign({
className: "account"
}, {
children: jsxRuntime.jsx("span", {
children: account.accountId
})
}))
}, account.accountId))
})), jsxRuntime.jsx("div", Object.assign({
className: "action-buttons"
}, {
children: jsxRuntime.jsx("button", Object.assign({
className: "middleButton",
onClick: handleSignIn,
disabled: accounts.length === 0
}, {
children: core.translate("modal.ledger.finish")
}))
}))]
}))]
}))]
});
};
const WalletNotInstalled = ({
module,
onBack
}) => {
return jsxRuntime.jsxs("div", Object.assign({
className: "wallet-not-installed-wrapper"
}, {
children: [jsxRuntime.jsx(ModalHeader, {
title: "",
onCloseModal: onBack
}), jsxRuntime.jsxs("div", Object.assign({
className: "wallet-data"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: `wallet-icon-box ${module.id}`
}, {
children: jsxRuntime.jsx("img", {
src: module.metadata.iconUrl,
alt: module.metadata.name
})
})), jsxRuntime.jsx("h2", {
children: module.metadata.name
})]
})), jsxRuntime.jsxs("p", {
children: [core.translate("modal.install.youllNeedToInstall"), " ", module.metadata.name, core.translate("modal.install.toContinueAfterInstalling"), jsxRuntime.jsxs("span", Object.assign({
className: "refresh-link",
onClick: () => window.location.reload()
}, {
children: [" ", core.translate("modal.install.refreshThePage")]
}))]
}), jsxRuntime.jsx("div", Object.assign({
className: "action-buttons"
}, {
children: jsxRuntime.jsxs("button", Object.assign({
className: "middleButton",
onClick: () => {
if (module.type !== "injected") {
return;
}
window.open(module.metadata.downloadUrl, "_blank");
}
}, {
children: [core.translate("modal.install.open"), " ", module.metadata.name]
}))
}))]
}));
};
const QRIcon = () => jsxRuntime.jsxs("svg", Object.assign({
width: "18",
height: "16",
viewBox: "0 0 18 16",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: [jsxRuntime.jsx("path", {
d: "M7.22224 1.33334H1.44446V6.66668H7.22224V1.33334Z",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M15.8889 1.33334H10.1111V6.66668H15.8889V1.33334Z",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M7.22224 9.33334H1.44446V14.6667H7.22224V9.33334Z",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M10.1111 13.1429V14.6667H15.8889M10.1111 9.33334V10.8572H12.5873V9.33334H15.8889V12.381",
stroke: "#4C5155",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("rect", {
x: "3.61108",
y: "3.33334",
width: "1.44444",
height: "1.33333",
fill: "#4C5155"
}), jsxRuntime.jsx("rect", {
x: "3.61108",
y: "11.3333",
width: "1.44444",
height: "1.33333",
fill: "#4C5155"
}), jsxRuntime.jsx("rect", {
x: "12.2778",
y: "3.33334",
width: "1.44445",
height: "1.33333",
fill: "#4C5155"
})]
}));
const LinkIcon = () => jsxRuntime.jsxs("svg", Object.assign({
width: "18",
height: "16",
viewBox: "0 0 18 16",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: [jsxRuntime.jsx("path", {
d: "M13 8.66667V12.6667C13 13.0203 12.8478 13.3594 12.577 13.6095C12.3061 13.8595 11.9387 14 11.5556 14H3.61113C3.22804 14 2.86064 13.8595 2.58975 13.6095C2.31887 13.3594 2.16669 13.0203 2.16669 12.6667V5.33333C2.16669 4.97971 2.31887 4.64057 2.58975 4.39052C2.86064 4.14048 3.22804 4 3.61113 4H7.94447",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M10.8333 2H15.1666V6",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round"
}), jsxRuntime.jsx("path", {
d: "M7.22223 9.33333L15.1667 2",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round"
})]
}));
const WalletIcon = () => jsxRuntime.jsx("svg", Object.assign({
width: "24",
height: "24",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, {
children: jsxRuntime.jsx("path", {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M5 6.5C5 6.36739 5.05268 6.24021 5.14645 6.14645C5.24021 6.05268 5.36739 6 5.5 6H16C16.2652 6 16.5196 5.89464 16.7071 5.70711C16.8946 5.51957 17 5.26522 17 5C17 4.73478 16.8946 4.48043 16.7071 4.29289C16.5196 4.10536 16.2652 4 16 4H5.5C4.83696 4 4.20107 4.26339 3.73223 4.73223C3.26339 5.20107 3 5.83696 3 6.5V18C3 18.5304 3.21071 19.0391 3.58579 19.4142C3.96086 19.7893 4.46957 20 5 20H19C19.5304 20 20.0391 19.7893 20.4142 19.4142C20.7893 19.0391 21 18.5304 21 18V9C21 8.46957 20.7893 7.96086 20.4142 7.58579C20.0391 7.21071 19.5304 7 19 7H5.5C5.36739 7 5.24021 6.94732 5.14645 6.85355C5.05268 6.75979 5 6.63261 5 6.5ZM15.5 15C15.8978 15 16.2794 14.842 16.5607 14.5607C16.842 14.2794 17 13.8978 17 13.5C17 13.1022 16.842 12.7206 16.5607 12.4393C16.2794 12.158 15.8978 12 15.5 12C15.1022 12 14.7206 12.158 14.4393 12.4393C14.158 12.7206 14 13.1022 14 13.5C14 13.8978 14.158 14.2794 14.4393 14.5607C14.7206 14.842 15.1022 15 15.5 15Z",
fill: "#888888"
})
}));
const WalletHome = ({
selector
}) => {
const [modules, setModules] = React.useState([]);
const [route, setRoute] = React.useState("WalletInfo");
React.useEffect(() => {
const subscription = selector.store.observable.subscribe(state => {
const filterByType = item => {
return item.type !== "bridge" && item.type !== "hardware" && item.type !== "instant-link";
};
const filteredModules = state.modules.filter(filterByType);
setModules(filteredModules);
});
return () => subscription.unsubscribe();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const getWalletUrl = module => {
let url = "";
if (module.type === "injected") {
url = module.metadata.downloadUrl;
}
if (module.type === "browser") {
url = module.metadata.walletUrl;
}
return url;
};
return jsxRuntime.jsxs("div", Object.assign({
className: "wallet-home-wrapper"
}, {
children: [route === "GetWallets" && jsxRuntime.jsx("div", Object.assign({
className: "nws-modal-header-wrapper"
}, {
children: jsxRuntime.jsx(BackArrow, {
onClick: () => {
setRoute("WalletInfo");
}
})
})), route === "GetWallets" && jsxRuntime.jsx("div", Object.assign({
className: "get-wallet-wrapper"
}, {
children: modules.map(module => {
const {
iconUrl,
name
} = module.metadata;
const qrIcon = ["nearfi", "here-wallet"].includes(module.id);
const hereWalletType = module.id === "here-wallet" ? "mobile" : "";
const walletUrl = getWalletUrl(module);
return jsxRuntime.jsxs("div", Object.assign({
tabIndex: 0,
className: `single-wallet-get ${module.id}`,
onClick: () => {
if (walletUrl) {
window.open(walletUrl, "_blank");
}
}
}, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "small-icon"
}, {
children: [qrIcon && walletUrl && jsxRuntime.jsx(QRIcon, {}), !qrIcon && walletUrl && jsxRuntime.jsx(LinkIcon, {})]
})), jsxRuntime.jsx("div", Object.assign({
className: "icon"
}, {
children: jsxRuntime.jsx("img", {
src: iconUrl,
alt: name
})
})), jsxRuntime.jsxs("div", Object.assign({
className: "content"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "title"
}, {
children: name
})), jsxRuntime.jsx("div", Object.assign({
className: "type"
}, {
children: core.translate(`modal.walletTypes.${hereWalletType || module.type}`)
}))]
}))]
}), module.id);
})
})), route === "WalletInfo" && jsxRuntime.jsx("div", Object.assign({
className: "wallet-info-wrapper"
}, {
children: jsxRuntime.jsxs("div", Object.assign({
className: "info"
}, {
children: [jsxRuntime.jsx(WalletIcon, {}), jsxRuntime.jsx("p", {
children: core.translate("modal.wallet.whatIsAWalletDescription")
}), jsxRuntime.jsx("p", {
children: core.translate("modal.wallet.selectWalletOr")
}), jsxRuntime.jsx("p", Object.assign({
className: "button",
onClick: () => {
setRoute("GetWallets");
}
}, {
children: core.translate("modal.wallet.createNewWallet")
}))]
}))
}))]
}));
};
const WalletConnected = ({
module,
onCloseModal
}) => {
return jsxRuntime.jsxs(React.Fragment, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal-header"
}, {
children: [jsxRuntime.jsx("h3", Object.assign({
className: "middleTitle"
}, {
children: ``
})), jsxRuntime.jsx(CloseButton, {
onClick: onCloseModal
})]
})), jsxRuntime.jsx("div", Object.assign({
className: "connecting-wrapper"
}, {
children: jsxRuntime.jsxs("div", Object.assign({
className: "content"
}, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "icon"
}, {
children: [jsxRuntime.jsx("div", {
className: "green-dot"
}), jsxRuntime.jsx("img", {
src: module === null || module === void 0 ? void 0 : module.metadata.iconUrl,
alt: module === null || module === void 0 ? void 0 : module.metadata.name
})]
})), jsxRuntime.jsx("h3", Object.assign({
className: "connecting-name"
}, {
children: module === null || module === void 0 ? void 0 : module.metadata.name
})), jsxRuntime.jsxs("div", Object.assign({
className: "wallet-connected-success"
}, {
children: [jsxRuntime.jsx(ConnectionSuccessIcon, {}), jsxRuntime.jsx("span", {
children: core.translate("modal.wallet.connectionSuccessful")
})]
}))]
}))
}))]
});
};
var anObject$1 = anObject$b;
// `RegExp.prototype.flags` getter implementation
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
var regexpFlags = function () {
var that = anObject$1(this);
var result = '';
if (that.hasIndices) result += 'd';
if (that.global) result += 'g';
if (that.ignoreCase) result += 'i';
if (that.multiline) result += 'm';
if (that.dotAll) result += 's';
if (that.unicode) result += 'u';
if (that.unicodeSets) result += 'v';
if (that.sticky) result += 'y';
return result;
};
var call = functionCall;
var hasOwn = hasOwnProperty_1;
var isPrototypeOf = objectIsPrototypeOf;
var regExpFlags = regexpFlags;
var RegExpPrototype$1 = RegExp.prototype;
var regexpGetFlags = function (R) {
var flags = R.flags;
return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype$1, R)
? call(regExpFlags, R) : flags;
};
var PROPER_FUNCTION_NAME = functionName.PROPER;
var defineBuiltIn = defineBuiltIn$6;
var anObject = anObject$b;
var $toString = toString$3;
var fails = fails$h;
var getRegExpFlags = regexpGetFlags;
var TO_STRING = 'toString';
var RegExpPrototype = RegExp.prototype;
var nativeToString = RegExpPrototype[TO_STRING];
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
// FF44- RegExp#toString has a wrong name
var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
// `RegExp.prototype.toString` method
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
if (NOT_GENERIC || INCORRECT_NAME) {
defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
var R = anObject(this);
var pattern = $toString(R.source);
var flags = $toString(getRegExpFlags(R));
return '/' + pattern + '/' + flags;
}, { unsafe: true });
}
function formatQRCodeImage(data) {
return __awaiter(this, void 0, void 0, function* () {
return yield QRCode__default["default"].toString(data, {
margin: 0,
type: "svg"
});
});
}
const ScanQRCode = ({
wallet,
uri,
handleOpenDefaultModal
}) => {
const [notification, setNotification] = React__default["default"].useState("");
const [svg, setSvg] = React__default["default"].useState("");
const copyToClipboard = () => {
if (!uri) {
return;
}
const success = copy__default["default"](uri);
if (success) {
setNotification(core.translate("modal.qr.copiedToClipboard"));
setTimeout(() => setNotification(""), 1200);
} else {
setNotification(core.translate("modal.qr.failedToCopy"));
setTimeout(() => setNotification(""), 1200);
}
};
React__default["default"].useEffect(() => {
(() => __awaiter(void 0, void 0, void 0, function* () {
if (uri) {
setSvg(yield formatQRCodeImage(uri));
}
}))();
}, [uri]);
return jsxRuntime.jsx("section", Object.assign({
className: "scan-qr-code"
}, {
children: jsxRuntime.jsxs("section", Object.assign({
className: "qr-code"
}, {
children: [jsxRuntime.jsx("img", {
src: wallet === null || wallet === void 0 ? void 0 : wallet.metadata.iconUrl,
alt: wallet === null || wallet === void 0 ? void 0 : wallet.metadata.name
}), jsxRuntime.jsx("div", {
dangerouslySetInnerHTML: {
__html: svg
}
}), jsxRuntime.jsx("p", {
children: core.translate("modal.qr.scanQRCodeMessage")
}), jsxRuntime.jsxs("p", {
children: [jsxRuntime.jsx("span", Object.assign({
className: "copy-to-clipboard",
onClick: copyToClipboard
}, {
children: notification ? notification : core.translate("modal.qr.copyToClipboard")
})), " ", core.translate("general.or"), " ", jsxRuntime.jsx("span", Object.assign({
className: "open-in-official-dialogue",
onClick: handleOpenDefaultModal
}, {
children: core.translate("modal.qr.openInOfficialDialogue")
}))]
})]
}))
}));
};
const getThemeClass = theme => {
switch (theme) {
case "dark":
return "dark-theme";
case "light":
return "light-theme";
default:
return "";
}
};
const Modal = ({
selector,
options,
visible,
hide,
emitter
}) => {
var _a, _b, _c;
const [route, setRoute] = React.useState({
name: "WalletHome"
});
const [alertMessage, setAlertMessage] = React.useState(null);
const [selectedWallet, setSelectedWallet] = React.useState();
const [bridgeWalletUri, setBridgeWalletUri] = React.useState();
const [isClosing, setIsClosing] = React.useState(false);
const [shouldRender, setShouldRender] = React.useState(false);
// Handle visibility and closing animation
React.useEffect(() => {
if (visible) {
setIsClosing(false);
setShouldRender(true);
return undefined;
}
// Start closing animation
setIsClosing(true);
// Wait for animation to complete before unmounting
const timer = setTimeout(() => {
setShouldRender(false);
setIsClosing(false);
}, 200); // Match animation duration
return () => clearTimeout(timer);
}, [visible]);
// Handle route initialization when modal becomes visible
React.useEffect(() => {
if (!visible) {
return;
}
setRoute({
name: "WalletHome"
});
core.allowOnlyLanguage(selector.options.languageCode);
const {
selectedWalletId,
modules
} = selector.store.getState();
if (selectedWalletId) {
const module = modules.find(m => m.id === selectedWalletId);
setSelectedWallet(module);
setRoute({
name: "WalletConnected",
params: {
module
}
});
}
setBridgeWalletUri("");
// eslint-disable-next-line
}, [visible]);
React.useEffect(() => {
const subscription = selector.on("networkChanged", ({
networkId
}) => {
// Switched back to the correct network.
if (networkId === selector.options.network.networkId) {
return handleDismissClick({});
}
setRoute({
name: "WalletNetworkChanged"
});
});
return () => subscription.remove();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const handleDismissClick = React.useCallback(({
hideReason
}) => {
setAlertMessage(null);
setRoute({
name: "WalletHome"
});
if (hideReason === "user-triggered") {
emitter.emit("onHide", {
hideReason
});
}
if (hideReason === "wallet-navigation") {
emitter.emit("onHide", {
hideReason
});
}
hide();
}, [hide, emitter]);
React.useEffect(() => {
const close = e => {
if (e.key === "Escape") {
handleDismissClick({
hideReason: "user-triggered"
});
}
};
window.addEventListener("keydown", close);
return () => window.removeEventListener("keydown", close);
}, [handleDismissClick]);
const handleWalletClick = (module, qrCodeModal) => __awaiter(void 0, void 0, void 0, function* () {
setSelectedWallet(module);
const {
selectedWalletId
} = selector.store.getState();
if (selectedWalletId === module.id) {
setRoute({
name: "WalletConnected",
params: {
module
}
});
return;
}
try {
const {
deprecated,
available
} = module.metadata;
if (module.type === "injected" && !available) {
setRoute({
name: "WalletNotInstalled",
params: {
module: module
}
});
return;
}
const wallet = yield module.wallet();
if (deprecated) {
setAlertMessage(`${module.metadata.name} is deprecated. Please select another wallet.`);
setRoute({
name: "AlertMessage",
params: {
module: module
}
});
return;
}
if (wallet.type === "hardware") {
setRoute({
name: "DerivationPath",
params: {
walletId: wallet.id || "ledger"
}
});
return;
}
setRoute({
name: "WalletConnecting",
params: {
wallet: wallet
}
});
if (wallet.type === "bridge") {
const subscription = selector.on("uriChanged", ({
uri
}) => {
setBridgeWalletUri(uri);
setRoute({
name: "ScanQRCode",
params: {
uri,
wallet
}
});
});
yield wallet.signIn({
contractId: options.contractId,
methodNames: options.methodNames,
qrCodeModal
});
subscription.remove();
handleDismissClick({
hideReason: "wallet-navigation"
});
return;
}
if (wallet.type === "browser") {
yield wallet.signIn({
contractId: options.contractId,
methodNames: options.methodNames,
successUrl: wallet.metadata.successUrl,
failureUrl: wallet.metadata.failureUrl
});
handleDismissClick({
hideReason: "wallet-navigation"
});
return;
}
yield wallet.signIn({
contractId: options.contractId,
methodNames: options.methodNames
});
handleDismissClick({
hideReason: "wallet-navigation"
});
} catch (err) {
const {
name
} = module.metadata;
const message = err && typeof err === "object" && "message" in err ? err.message : "Something went wrong";
setAlertMessage(`Failed to sign in with ${name}: ${message}`);
setRoute({
name: "AlertMessage",
params: {
module: module
}
});
}
});
if (!shouldRender) {
return null;
}
return jsxRuntime.jsxs("div", Object.assign({
className: `nws-modal-wrapper ${getThemeClass(options === null || options === void 0 ? void 0 : options.theme)} ${isClosing ? "closing" : "open"}`
}, {
children: [jsxRuntime.jsx("div", {
className: "nws-modal-overlay",
onClick: () => {
handleDismissClick({
hideReason: "user-triggered"
});
}
}), jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal-background"
}, {
children: [jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal-title-wrapper"
}, {
children: [jsxRuntime.jsx("h2", Object.assign({
className: "nws-modal-title"
}, {
children: core.translate("modal.wallet.connectYourWallet")
})), jsxRuntime.jsx(CloseButton, {
onClick: () => handleDismissClick({
hideReason: "user-triggered"
})
})]
})), jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal"
}, {
children: [jsxRuntime.jsx("div", Object.assign({
className: "modal-left"
}, {
children: jsxRuntime.jsx(WalletOptions, {
handleWalletClick: module => {
handleWalletClick(module, false);
},
selector: selector
})
})), jsxRuntime.jsx("div", Object.assign({
className: "modal-right"
}, {
children: jsxRuntime.jsxs("div", Object.assign({
className: "nws-modal-body"
}, {
children: [route.name === "AlertMessage" && alertMessage && jsxRuntime.jsx(AlertMessage, {
message: alertMessage,
module: (_a = route.params) === null || _a === void 0 ? void 0 : _a.module,
onBack: retry => {
if (retry) {
handleWalletClick(selectedWallet, false);
}
setAlertMessage(null);
setRoute({
name: "WalletHome"
});
}
}), route.name === "DerivationPath" && jsxRuntime.jsx(DerivationPath, {
selector: selector,
options: options,
onConnected: () => {
handleDismissClick({
hideReason: "wallet-navigation"
});
},
params: route.params,
onBack: () => setRoute({
name: "WalletHome"
}),
onError: (message, wallet) => {
const {
modules
} = selector.store.getState();
const findModule = modules.find(module => module.id === wallet.id);
setAlertMessage(message);
setRoute({
name: "AlertMessage",
params: {
module: findModule
}
});
},
onCloseModal: () => handleDismissClick({
hideReason: "user-triggered"
})
}), route.name === "WalletNetworkChanged" && jsxRuntime.jsx(WalletNetworkChanged, {
selector: selector,
onBack: () => setRoute({
name: "WalletHome"
}),
onCloseModal: () => handleDismissClick({
hideReason: "user-triggered"
})
}), route.name === "WalletNotInstalled" && jsxRuntime.jsx(WalletNotInstalled, {
module: (_b = route.params) === null || _b === void 0 ? void 0 : _b.module,
onBack: () => {
setRoute({
name: "WalletHome"
});
}
}), route.name === "WalletConnecting" && jsxRuntime.jsx(WalletConnecting, {
wallet: (_c = route.params) === null || _c === void 0 ? void 0 : _c.wallet,
onBack: () => {
setRoute({
name: "WalletHome"
});
}
}), route.name === "WalletHome" && jsxRuntime.jsx(WalletHome, {
selector: selector
}), route.name === "WalletConnected" && jsxRuntime.jsx(WalletConnected, {
module: selectedWallet,
onCloseModal: () => handleDismissClick({
hideReason: "user-triggered"
})
}), route.name === "ScanQRCode" && jsxRuntime.jsx(ScanQRCode, {
handleOpenDefaultModal: () => {
handleWalletClick(selectedWallet, true);
},
uri: bridgeWalletUri,
wallet: selectedWallet
})]
}))
}))]
}))]
}))]
}));
};
const MODAL_ELEMENT_ID = "near-wallet-selector-modal";
let modalInstance = null;
let root = null;
/**
* Initiates a modal instance
* @param {WalletSelector} selector Selector
* @param {ModalOptions} options Modal options
* @returns {WalletSelectorModal} Returns a WalletSelectorModal object
*/
const setupModal = (selector, options) => {
if (!root) {
const body = document.body;
const container = document.createElement("div");
container.id = MODAL_ELEMENT_ID;
body.appendChild(container);
root = client.createRoot(container);
}
const emitter = new core.EventEmitter();
selector.store.getState().modules.forEach(module => __awaiter(void 0, void 0, void 0, function* () {
if ("topLevelInjected" in module.metadata) {
if (!module.metadata.topLevelInjected) {
return;
}
const wallet = yield module.wallet();
if (wallet.type !== "injected") {
return;
}
yield wallet.signIn({
contractId: options.contractId,
methodNames: options.methodNames
});
}
}));
const render = (visible = false) => {
root.render(jsxRuntime.jsx(Modal, {
selector: selector,
options: options,
visible: visible,
hide: () => render(false),
emitter: emitter
}));
};
if (!modalInstance) {
modalInstance = {
show: () => {
render(true);
},
hide: () => {
render(false);
},
on: (eventName, callback) => {
return emitter.on(eventName, callback);
},
off: (eventName, callback) => {
emitter.off(eventName, callback);
}
};
}
return modalInstance;
};
exports.setupModal = setupModal;