@manifoldxyz/client-sdk
Version:
Manifold Client SDK for headless purchasing and display of Manifold products
1,075 lines • 986 kB
JavaScript
"use strict";
const ethers = require("ethers");
const studioAppsClientPublic = require("@manifoldxyz/studio-apps-client-public");
function _interopNamespaceDefault(e) {
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
if (e) {
for (const k2 in e) {
if (k2 !== "default") {
const d2 = Object.getOwnPropertyDescriptor(e, k2);
Object.defineProperty(n, k2, d2.get ? d2 : {
enumerable: true,
get: () => e[k2]
});
}
}
}
n.default = e;
return Object.freeze(n);
}
const ethers__namespace = /* @__PURE__ */ _interopNamespaceDefault(ethers);
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2["UNSUPPORTED_NETWORK"] = "UNSUPPORTED_NETWORK";
ErrorCode2["WRONG_NETWORK"] = "WRONG_NETWORK";
ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
ErrorCode2["MISSING_RPC_URL"] = "MISSING_RPC_URL";
ErrorCode2["NOT_FOUND"] = "NOT_FOUND";
ErrorCode2["RESOURCE_NOT_FOUND"] = "RESOURCE_NOT_FOUND";
ErrorCode2["INVALID_INPUT"] = "INVALID_INPUT";
ErrorCode2["MISSING_TOKENS"] = "MISSING_TOKENS";
ErrorCode2["VALIDATION_FAILED"] = "VALIDATION_FAILED";
ErrorCode2["UNSUPPORTED_TYPE"] = "UNSUPPORTED_TYPE";
ErrorCode2["ESTIMATION_FAILED"] = "ESTIMATION_FAILED";
ErrorCode2["TRANSACTION_FAILED"] = "TRANSACTION_FAILED";
ErrorCode2["TRANSACTION_REVERTED"] = "TRANSACTION_REVERTED";
ErrorCode2["TRANSACTION_REJECTED"] = "TRANSACTION_REJECTED";
ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED";
ErrorCode2["TRANSACTION_PENDING"] = "TRANSACTION_PENDING";
ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
ErrorCode2["GAS_ESTIMATION_FAILED"] = "GAS_ESTIMATION_FAILED";
ErrorCode2["GAS_PRICE_TOO_LOW"] = "GAS_PRICE_TOO_LOW";
ErrorCode2["NONCE_ERROR"] = "NONCE_ERROR";
ErrorCode2["CONTRACT_ERROR"] = "CONTRACT_ERROR";
ErrorCode2["LEDGER_ERROR"] = "LEDGER_ERROR";
ErrorCode2["HARDWARE_WALLET_ERROR"] = "HARDWARE_WALLET_ERROR";
ErrorCode2["NOT_ELIGIBLE"] = "NOT_ELIGIBLE";
ErrorCode2["SOLD_OUT"] = "SOLD_OUT";
ErrorCode2["LIMIT_REACHED"] = "LIMIT_REACHED";
ErrorCode2["ENDED"] = "ENDED";
ErrorCode2["NOT_STARTED"] = "NOT_STARTED";
ErrorCode2["API_ERROR"] = "API_ERROR";
ErrorCode2["RATE_LIMITED"] = "RATE_LIMITED";
ErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
ErrorCode2["TIMEOUT"] = "TIMEOUT";
ErrorCode2["UNSUPPORTED_PRODUCT_TYPE"] = "PRODUCT_TYPE_NOT_SUPPORTED";
ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
return ErrorCode2;
})(ErrorCode || {});
class ClientSDKError extends Error {
/**
* Creates a new ClientSDKError.
*
* @param code - Error code from the ErrorCode enum
* @param message - Human-readable error message
* @param details - Optional additional error details (metadata, original error, etc.)
*/
constructor(code, message, details) {
super(message);
this.code = code;
this.details = details;
this.name = "ClientSDKError";
}
}
var AppType = /* @__PURE__ */ ((AppType2) => {
AppType2["EDITION"] = "edition";
AppType2["BURN_REDEEM"] = "burn-redeem";
AppType2["BLIND_MINT"] = "blind-mint";
return AppType2;
})(AppType || {});
var AppId = /* @__PURE__ */ ((AppId2) => {
AppId2[AppId2["BLIND_MINT_1155"] = 2526777015] = "BLIND_MINT_1155";
AppId2[AppId2["EDITION"] = 2522713783] = "EDITION";
AppId2[AppId2["BURN_REDEEM"] = 2520944311] = "BURN_REDEEM";
return AppId2;
})(AppId || {});
function validateAddress(address) {
return /^0x[a-fA-F0-9]{40}$/.test(address);
}
function validateInstanceId(instanceId) {
return /^\d+$/.test(instanceId);
}
function parseManifoldUrl(url) {
const match = url.match(/manifold\.xyz\/@[\w-]+\/id\/(\d+)/);
if (match && match[1]) {
return { instanceId: match[1] };
}
return null;
}
async function estimateGas$1(params) {
const {
publicProvider,
contractAddress,
abi: abi2,
functionName,
args = [],
from: from2,
networkId,
value,
fallbackGas
} = params;
try {
const valueBigInt = value ? BigInt(value.toString()) : void 0;
const gasEstimate = await publicProvider.estimateContractGas({
contractAddress,
abi: abi2,
functionName,
args,
from: from2,
value: valueBigInt,
networkId
});
return gasEstimate;
} catch (error) {
if (fallbackGas) {
console.warn(`Gas estimation failed for ${functionName}, using fallback:`, error);
return fallbackGas;
}
throw new ClientSDKError(
ErrorCode.GAS_ESTIMATION_FAILED,
`Failed to estimate gas for ${functionName}`,
{
contractAddress,
functionName,
from: from2,
networkId,
originalError: error instanceof Error ? error : void 0
}
);
}
}
const t$1 = "0x0000000000000000000000000000000000000000";
var u$1 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function f$1(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function l$1(e) {
if (e.__esModule) return e;
var r2 = e.default;
if (typeof r2 == "function") {
var t2 = function o2() {
return this instanceof o2 ? Reflect.construct(r2, arguments, this.constructor) : r2.apply(this, arguments);
};
t2.prototype = r2.prototype;
} else t2 = {};
return Object.defineProperty(t2, "__esModule", { value: true }), Object.keys(e).forEach(function(o2) {
var n = Object.getOwnPropertyDescriptor(e, o2);
Object.defineProperty(t2, o2, n.get ? n : {
enumerable: true,
get: function() {
return e[o2];
}
});
}), t2;
}
const Ve$1 = (e) => e.charAt(0).toUpperCase() + e.slice(1);
var t = /* @__PURE__ */ ((e) => (e[e.Mainnet = 1] = "Mainnet", e[e.Optimism = 10] = "Optimism", e[e.Base = 8453] = "Base", e[e.Sepolia = 11155111] = "Sepolia", e[e.Shape = 360] = "Shape", e[e.ApeChain = 33139] = "ApeChain", e))(t || {});
const s = {
1: {
chainId: "0x1",
rpcUrls: ["https://mainnet.infura.io"],
chainName: "Ethereum Mainnet",
displayName: "Ethereum",
alternateNames: ["mainnet", "eth"],
nativeCurrency: {
name: "Ethereum",
symbol: "ETH",
decimals: 18
},
// @todo: we should really just match the chains.json structure here and do an array of structs
blockExplorerUrls: ["https://etherscan.io"]
},
10: {
chainId: "0xA",
rpcUrls: ["https://mainnet.optimism.io/"],
chainName: "Optimism Mainnet",
displayName: "Optimism",
alternateNames: ["op", "oeth"],
nativeCurrency: {
name: "Ethereum",
symbol: "OETH",
decimals: 18
},
blockExplorerUrls: ["https://optimistic.etherscan.io/"]
},
8453: {
chainId: "0x2105",
rpcUrls: ["https://mainnet.base.org"],
chainName: "Base Mainnet",
displayName: "Base",
nativeCurrency: {
name: "Ethereum",
symbol: "ETH",
decimals: 18
},
blockExplorerUrls: ["https://basescan.org"]
},
360: {
chainId: "0x168",
rpcUrls: ["https://mainnet.shape.network"],
chainName: "Shape Mainnet",
displayName: "Shape",
alternateNames: [],
nativeCurrency: {
name: "Ethereum",
symbol: "ETH",
decimals: 18
},
blockExplorerUrls: ["https://shapescan.xyz/"]
},
33139: {
chainId: "0x8173",
rpcUrls: ["https://rpc.apechain.com"],
chainName: "ApeChain Mainnet",
displayName: "ApeChain",
alternateNames: ["ape", "apechain"],
nativeCurrency: {
name: "ApeChain",
symbol: "APE",
decimals: 18
},
blockExplorerUrls: ["https://apescan.io/"]
},
11155111: {
chainId: "0xAA36A7",
rpcUrls: ["https://rpc.sepolia.org"],
chainName: "Ethereum Testnet Sepolia",
displayName: "Sepolia",
alternateNames: ["sep"],
nativeCurrency: {
name: "Sepolia Ether",
symbol: "ETH",
decimals: 18
},
blockExplorerUrls: ["https://sepolia.etherscan.io"]
}
}, h$1 = [
1,
8453,
10,
360,
33139
/* ApeChain */
], l = [
11155111
/* Sepolia */
], r = Object.keys(s).map((e) => parseInt(e)), c = (e) => r.includes(e);
function u(e, a = false) {
if (!c(e))
throw new Error("Unsupported Network");
const n = s[e];
return a ? n.displayName : n.displayName.toLowerCase();
}
function y$1(e) {
return l.includes(e);
}
function E$2(e) {
var p;
const a = e.toLowerCase(), n = Ve$1(a);
if (n in t)
return t[n];
for (const i of r) {
const o2 = s[i];
if (o2.displayName.toLowerCase() === a || (p = o2.alternateNames) != null && p.includes(a))
return i;
}
return null;
}
const d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
MAIN_NETWORKS: h$1,
NETWORK_CONFIGS: s,
NetworkId: t,
SUPPORTED_NETWORKS: r,
TEST_NETWORKS: l,
getDisplayNameForNetworkId: u,
isSupportedNetwork: c,
isTestnet: y$1,
resolveChainIdByName: E$2
}, Symbol.toStringTag, { value: "Module" }));
const Ci = "logger/5.8.0";
let xr = false, Er = false;
const En = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 };
let Tr = En.default, ir = null;
function Ui() {
try {
const n = [];
if (["NFD", "NFC", "NFKD", "NFKC"].forEach((e) => {
try {
if ("test".normalize(e) !== "test")
throw new Error("bad normalize");
} catch {
n.push(e);
}
}), n.length)
throw new Error("missing " + n.join(", "));
if ("é".normalize("NFD") !== "é")
throw new Error("broken implementation");
} catch (n) {
return n.message;
}
return null;
}
const Ar = Ui();
var ur;
(function(n) {
n.DEBUG = "DEBUG", n.INFO = "INFO", n.WARNING = "WARNING", n.ERROR = "ERROR", n.OFF = "OFF";
})(ur || (ur = {}));
var it;
(function(n) {
n.UNKNOWN_ERROR = "UNKNOWN_ERROR", n.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", n.UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION", n.NETWORK_ERROR = "NETWORK_ERROR", n.SERVER_ERROR = "SERVER_ERROR", n.TIMEOUT = "TIMEOUT", n.BUFFER_OVERRUN = "BUFFER_OVERRUN", n.NUMERIC_FAULT = "NUMERIC_FAULT", n.MISSING_NEW = "MISSING_NEW", n.INVALID_ARGUMENT = "INVALID_ARGUMENT", n.MISSING_ARGUMENT = "MISSING_ARGUMENT", n.UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT", n.CALL_EXCEPTION = "CALL_EXCEPTION", n.INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS", n.NONCE_EXPIRED = "NONCE_EXPIRED", n.REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED", n.UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT", n.TRANSACTION_REPLACED = "TRANSACTION_REPLACED", n.ACTION_REJECTED = "ACTION_REJECTED";
})(it || (it = {}));
const _r = "0123456789abcdef";
class S {
constructor(e) {
Object.defineProperty(this, "version", {
enumerable: true,
value: e,
writable: false
});
}
_log(e, t2) {
const r2 = e.toLowerCase();
En[r2] == null && this.throwArgumentError("invalid log level name", "logLevel", e), !(Tr > En[r2]) && console.log.apply(console, t2);
}
debug(...e) {
this._log(S.levels.DEBUG, e);
}
info(...e) {
this._log(S.levels.INFO, e);
}
warn(...e) {
this._log(S.levels.WARNING, e);
}
makeError(e, t2, r2) {
if (Er)
return this.makeError("censored error", t2, {});
t2 || (t2 = S.errors.UNKNOWN_ERROR), r2 || (r2 = {});
const s2 = [];
Object.keys(r2).forEach((c2) => {
const p = r2[c2];
try {
if (p instanceof Uint8Array) {
let b2 = "";
for (let x2 = 0; x2 < p.length; x2++)
b2 += _r[p[x2] >> 4], b2 += _r[p[x2] & 15];
s2.push(c2 + "=Uint8Array(0x" + b2 + ")");
} else
s2.push(c2 + "=" + JSON.stringify(p));
} catch {
s2.push(c2 + "=" + JSON.stringify(r2[c2].toString()));
}
}), s2.push(`code=${t2}`), s2.push(`version=${this.version}`);
const i = e;
let o2 = "";
switch (t2) {
case it.NUMERIC_FAULT: {
o2 = "NUMERIC_FAULT";
const c2 = e;
switch (c2) {
case "overflow":
case "underflow":
case "division-by-zero":
o2 += "-" + c2;
break;
case "negative-power":
case "negative-width":
o2 += "-unsupported";
break;
case "unbound-bitwise-result":
o2 += "-unbound-result";
break;
}
break;
}
case it.CALL_EXCEPTION:
case it.INSUFFICIENT_FUNDS:
case it.MISSING_NEW:
case it.NONCE_EXPIRED:
case it.REPLACEMENT_UNDERPRICED:
case it.TRANSACTION_REPLACED:
case it.UNPREDICTABLE_GAS_LIMIT:
o2 = t2;
break;
}
o2 && (e += " [ See: https://links.ethers.org/v5-errors-" + o2 + " ]"), s2.length && (e += " (" + s2.join(", ") + ")");
const d2 = new Error(e);
return d2.reason = i, d2.code = t2, Object.keys(r2).forEach(function(c2) {
d2[c2] = r2[c2];
}), d2;
}
throwError(e, t2, r2) {
throw this.makeError(e, t2, r2);
}
throwArgumentError(e, t2, r2) {
return this.throwError(e, S.errors.INVALID_ARGUMENT, {
argument: t2,
value: r2
});
}
assert(e, t2, r2, s2) {
e || this.throwError(t2, r2, s2);
}
assertArgument(e, t2, r2, s2) {
e || this.throwArgumentError(t2, r2, s2);
}
checkNormalize(e) {
Ar && this.throwError("platform missing String.prototype.normalize", S.errors.UNSUPPORTED_OPERATION, {
operation: "String.prototype.normalize",
form: Ar
});
}
checkSafeUint53(e, t2) {
typeof e == "number" && (t2 == null && (t2 = "value not safe"), (e < 0 || e >= 9007199254740991) && this.throwError(t2, S.errors.NUMERIC_FAULT, {
operation: "checkSafeInteger",
fault: "out-of-safe-range",
value: e
}), e % 1 && this.throwError(t2, S.errors.NUMERIC_FAULT, {
operation: "checkSafeInteger",
fault: "non-integer",
value: e
}));
}
checkArgumentCount(e, t2, r2) {
r2 ? r2 = ": " + r2 : r2 = "", e < t2 && this.throwError("missing argument" + r2, S.errors.MISSING_ARGUMENT, {
count: e,
expectedCount: t2
}), e > t2 && this.throwError("too many arguments" + r2, S.errors.UNEXPECTED_ARGUMENT, {
count: e,
expectedCount: t2
});
}
checkNew(e, t2) {
(e === Object || e == null) && this.throwError("missing new", S.errors.MISSING_NEW, { name: t2.name });
}
checkAbstract(e, t2) {
e === t2 ? this.throwError("cannot instantiate abstract class " + JSON.stringify(t2.name) + " directly; use a sub-class", S.errors.UNSUPPORTED_OPERATION, { name: e.name, operation: "new" }) : (e === Object || e == null) && this.throwError("missing new", S.errors.MISSING_NEW, { name: t2.name });
}
static globalLogger() {
return ir || (ir = new S(Ci)), ir;
}
static setCensorship(e, t2) {
if (!e && t2 && this.globalLogger().throwError("cannot permanently disable censorship", S.errors.UNSUPPORTED_OPERATION, {
operation: "setCensorship"
}), xr) {
if (!e)
return;
this.globalLogger().throwError("error censorship permanent", S.errors.UNSUPPORTED_OPERATION, {
operation: "setCensorship"
});
}
Er = !!e, xr = !!t2;
}
static setLogLevel(e) {
const t2 = En[e.toLowerCase()];
if (t2 == null) {
S.globalLogger().warn("invalid log level - " + e);
return;
}
Tr = t2;
}
static from(e) {
return new S(e);
}
}
S.errors = it;
S.levels = ur;
const Bi = "bytes/5.8.0", gt = new S(Bi);
function Wr(n) {
return !!n.toHexString;
}
function on(n) {
return n.slice || (n.slice = function() {
const e = Array.prototype.slice.call(arguments);
return on(new Uint8Array(Array.prototype.slice.apply(n, e)));
}), n;
}
function Fi(n) {
return He(n) && !(n.length % 2) || rn(n);
}
function Nr(n) {
return typeof n == "number" && n == n && n % 1 === 0;
}
function rn(n) {
if (n == null)
return false;
if (n.constructor === Uint8Array)
return true;
if (typeof n == "string" || !Nr(n.length) || n.length < 0)
return false;
for (let e = 0; e < n.length; e++) {
const t2 = n[e];
if (!Nr(t2) || t2 < 0 || t2 >= 256)
return false;
}
return true;
}
function Le(n, e) {
if (e || (e = {}), typeof n == "number") {
gt.checkSafeUint53(n, "invalid arrayify value");
const t2 = [];
for (; n; )
t2.unshift(n & 255), n = parseInt(String(n / 256));
return t2.length === 0 && t2.push(0), on(new Uint8Array(t2));
}
if (e.allowMissingPrefix && typeof n == "string" && n.substring(0, 2) !== "0x" && (n = "0x" + n), Wr(n) && (n = n.toHexString()), He(n)) {
let t2 = n.substring(2);
t2.length % 2 && (e.hexPad === "left" ? t2 = "0" + t2 : e.hexPad === "right" ? t2 += "0" : gt.throwArgumentError("hex data is odd-length", "value", n));
const r2 = [];
for (let s2 = 0; s2 < t2.length; s2 += 2)
r2.push(parseInt(t2.substring(s2, s2 + 2), 16));
return on(new Uint8Array(r2));
}
return rn(n) ? on(new Uint8Array(n)) : gt.throwArgumentError("invalid arrayify value", "value", n);
}
function Yt(n) {
const e = n.map((s2) => Le(s2)), t2 = e.reduce((s2, i) => s2 + i.length, 0), r2 = new Uint8Array(t2);
return e.reduce((s2, i) => (r2.set(i, s2), s2 + i.length), 0), on(r2);
}
function Di(n) {
let e = Le(n);
if (e.length === 0)
return e;
let t2 = 0;
for (; t2 < e.length && e[t2] === 0; )
t2++;
return t2 && (e = e.slice(t2)), e;
}
function He(n, e) {
return !(typeof n != "string" || !n.match(/^0x[0-9A-Fa-f]*$/) || e && n.length !== 2 + 2 * e);
}
const sr = "0123456789abcdef";
function Ue(n, e) {
if (e || (e = {}), typeof n == "number") {
gt.checkSafeUint53(n, "invalid hexlify value");
let t2 = "";
for (; n; )
t2 = sr[n & 15] + t2, n = Math.floor(n / 16);
return t2.length ? (t2.length % 2 && (t2 = "0" + t2), "0x" + t2) : "0x00";
}
if (typeof n == "bigint")
return n = n.toString(16), n.length % 2 ? "0x0" + n : "0x" + n;
if (e.allowMissingPrefix && typeof n == "string" && n.substring(0, 2) !== "0x" && (n = "0x" + n), Wr(n))
return n.toHexString();
if (He(n))
return n.length % 2 && (e.hexPad === "left" ? n = "0x0" + n.substring(2) : e.hexPad === "right" ? n += "0" : gt.throwArgumentError("hex data is odd-length", "value", n)), n.toLowerCase();
if (rn(n)) {
let t2 = "0x";
for (let r2 = 0; r2 < n.length; r2++) {
let s2 = n[r2];
t2 += sr[(s2 & 240) >> 4] + sr[s2 & 15];
}
return t2;
}
return gt.throwArgumentError("invalid hexlify value", "value", n);
}
function Li(n) {
if (typeof n != "string")
n = Ue(n);
else if (!He(n) || n.length % 2)
return null;
return (n.length - 2) / 2;
}
function Jr(n, e, t2) {
return typeof n != "string" ? n = Ue(n) : (!He(n) || n.length % 2) && gt.throwArgumentError("invalid hexData", "value", n), e = 2 + 2 * e, t2 != null ? "0x" + n.substring(e, 2 + 2 * t2) : "0x" + n.substring(e);
}
function Gi(n) {
let e = "0x";
return n.forEach((t2) => {
e += Ue(t2).substring(2);
}), e;
}
function In(n, e) {
for (typeof n != "string" ? n = Ue(n) : He(n) || gt.throwArgumentError("invalid hex string", "value", n), n.length > 2 * e + 2 && gt.throwArgumentError("value out of range", "value", arguments[1]); n.length < 2 * e + 2; )
n = "0x0" + n.substring(2);
return n;
}
var mr = { exports: {} };
const $i = {}, qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: $i
}, Symbol.toStringTag, { value: "Module" })), zi = /* @__PURE__ */ l$1(qi);
(function(n) {
(function(e, t2) {
function r2(v2, a) {
if (!v2) throw new Error(a || "Assertion failed");
}
function s2(v2, a) {
v2.super_ = a;
var l2 = function() {
};
l2.prototype = a.prototype, v2.prototype = new l2(), v2.prototype.constructor = v2;
}
function i(v2, a, l2) {
if (i.isBN(v2))
return v2;
this.negative = 0, this.words = null, this.length = 0, this.red = null, v2 !== null && ((a === "le" || a === "be") && (l2 = a, a = 10), this._init(v2 || 0, a || 10, l2 || "be"));
}
typeof e == "object" ? e.exports = i : t2.BN = i, i.BN = i, i.wordSize = 26;
var o2;
try {
typeof window < "u" && typeof window.Buffer < "u" ? o2 = window.Buffer : o2 = zi.Buffer;
} catch {
}
i.isBN = function(a) {
return a instanceof i ? true : a !== null && typeof a == "object" && a.constructor.wordSize === i.wordSize && Array.isArray(a.words);
}, i.max = function(a, l2) {
return a.cmp(l2) > 0 ? a : l2;
}, i.min = function(a, l2) {
return a.cmp(l2) < 0 ? a : l2;
}, i.prototype._init = function(a, l2, h2) {
if (typeof a == "number")
return this._initNumber(a, l2, h2);
if (typeof a == "object")
return this._initArray(a, l2, h2);
l2 === "hex" && (l2 = 16), r2(l2 === (l2 | 0) && l2 >= 2 && l2 <= 36), a = a.toString().replace(/\s+/g, "");
var y2 = 0;
a[0] === "-" && (y2++, this.negative = 1), y2 < a.length && (l2 === 16 ? this._parseHex(a, y2, h2) : (this._parseBase(a, l2, y2), h2 === "le" && this._initArray(this.toArray(), l2, h2)));
}, i.prototype._initNumber = function(a, l2, h2) {
a < 0 && (this.negative = 1, a = -a), a < 67108864 ? (this.words = [a & 67108863], this.length = 1) : a < 4503599627370496 ? (this.words = [
a & 67108863,
a / 67108864 & 67108863
], this.length = 2) : (r2(a < 9007199254740992), this.words = [
a & 67108863,
a / 67108864 & 67108863,
1
], this.length = 3), h2 === "le" && this._initArray(this.toArray(), l2, h2);
}, i.prototype._initArray = function(a, l2, h2) {
if (r2(typeof a.length == "number"), a.length <= 0)
return this.words = [0], this.length = 1, this;
this.length = Math.ceil(a.length / 3), this.words = new Array(this.length);
for (var y2 = 0; y2 < this.length; y2++)
this.words[y2] = 0;
var w2, M2, E2 = 0;
if (h2 === "be")
for (y2 = a.length - 1, w2 = 0; y2 >= 0; y2 -= 3)
M2 = a[y2] | a[y2 - 1] << 8 | a[y2 - 2] << 16, this.words[w2] |= M2 << E2 & 67108863, this.words[w2 + 1] = M2 >>> 26 - E2 & 67108863, E2 += 24, E2 >= 26 && (E2 -= 26, w2++);
else if (h2 === "le")
for (y2 = 0, w2 = 0; y2 < a.length; y2 += 3)
M2 = a[y2] | a[y2 + 1] << 8 | a[y2 + 2] << 16, this.words[w2] |= M2 << E2 & 67108863, this.words[w2 + 1] = M2 >>> 26 - E2 & 67108863, E2 += 24, E2 >= 26 && (E2 -= 26, w2++);
return this._strip();
};
function d2(v2, a) {
var l2 = v2.charCodeAt(a);
if (l2 >= 48 && l2 <= 57)
return l2 - 48;
if (l2 >= 65 && l2 <= 70)
return l2 - 55;
if (l2 >= 97 && l2 <= 102)
return l2 - 87;
r2(false, "Invalid character in " + v2);
}
function c2(v2, a, l2) {
var h2 = d2(v2, l2);
return l2 - 1 >= a && (h2 |= d2(v2, l2 - 1) << 4), h2;
}
i.prototype._parseHex = function(a, l2, h2) {
this.length = Math.ceil((a.length - l2) / 6), this.words = new Array(this.length);
for (var y2 = 0; y2 < this.length; y2++)
this.words[y2] = 0;
var w2 = 0, M2 = 0, E2;
if (h2 === "be")
for (y2 = a.length - 1; y2 >= l2; y2 -= 2)
E2 = c2(a, l2, y2) << w2, this.words[M2] |= E2 & 67108863, w2 >= 18 ? (w2 -= 18, M2 += 1, this.words[M2] |= E2 >>> 26) : w2 += 8;
else {
var m2 = a.length - l2;
for (y2 = m2 % 2 === 0 ? l2 + 1 : l2; y2 < a.length; y2 += 2)
E2 = c2(a, l2, y2) << w2, this.words[M2] |= E2 & 67108863, w2 >= 18 ? (w2 -= 18, M2 += 1, this.words[M2] |= E2 >>> 26) : w2 += 8;
}
this._strip();
};
function p(v2, a, l2, h2) {
for (var y2 = 0, w2 = 0, M2 = Math.min(v2.length, l2), E2 = a; E2 < M2; E2++) {
var m2 = v2.charCodeAt(E2) - 48;
y2 *= h2, m2 >= 49 ? w2 = m2 - 49 + 10 : m2 >= 17 ? w2 = m2 - 17 + 10 : w2 = m2, r2(m2 >= 0 && w2 < h2, "Invalid character"), y2 += w2;
}
return y2;
}
i.prototype._parseBase = function(a, l2, h2) {
this.words = [0], this.length = 1;
for (var y2 = 0, w2 = 1; w2 <= 67108863; w2 *= l2)
y2++;
y2--, w2 = w2 / l2 | 0;
for (var M2 = a.length - h2, E2 = M2 % y2, m2 = Math.min(M2, M2 - E2) + h2, u2 = 0, g2 = h2; g2 < m2; g2 += y2)
u2 = p(a, g2, g2 + y2, l2), this.imuln(w2), this.words[0] + u2 < 67108864 ? this.words[0] += u2 : this._iaddn(u2);
if (E2 !== 0) {
var G2 = 1;
for (u2 = p(a, g2, a.length, l2), g2 = 0; g2 < E2; g2++)
G2 *= l2;
this.imuln(G2), this.words[0] + u2 < 67108864 ? this.words[0] += u2 : this._iaddn(u2);
}
this._strip();
}, i.prototype.copy = function(a) {
a.words = new Array(this.length);
for (var l2 = 0; l2 < this.length; l2++)
a.words[l2] = this.words[l2];
a.length = this.length, a.negative = this.negative, a.red = this.red;
};
function b2(v2, a) {
v2.words = a.words, v2.length = a.length, v2.negative = a.negative, v2.red = a.red;
}
if (i.prototype._move = function(a) {
b2(a, this);
}, i.prototype.clone = function() {
var a = new i(null);
return this.copy(a), a;
}, i.prototype._expand = function(a) {
for (; this.length < a; )
this.words[this.length++] = 0;
return this;
}, i.prototype._strip = function() {
for (; this.length > 1 && this.words[this.length - 1] === 0; )
this.length--;
return this._normSign();
}, i.prototype._normSign = function() {
return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}, typeof Symbol < "u" && typeof Symbol.for == "function")
try {
i.prototype[Symbol.for("nodejs.util.inspect.custom")] = x2;
} catch {
i.prototype.inspect = x2;
}
else
i.prototype.inspect = x2;
function x2() {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
}
var T = [
"",
"0",
"00",
"000",
"0000",
"00000",
"000000",
"0000000",
"00000000",
"000000000",
"0000000000",
"00000000000",
"000000000000",
"0000000000000",
"00000000000000",
"000000000000000",
"0000000000000000",
"00000000000000000",
"000000000000000000",
"0000000000000000000",
"00000000000000000000",
"000000000000000000000",
"0000000000000000000000",
"00000000000000000000000",
"000000000000000000000000",
"0000000000000000000000000"
], k2 = [
0,
0,
25,
16,
12,
11,
10,
9,
8,
8,
7,
7,
7,
7,
6,
6,
6,
6,
6,
6,
6,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5
], D2 = [
0,
0,
33554432,
43046721,
16777216,
48828125,
60466176,
40353607,
16777216,
43046721,
1e7,
19487171,
35831808,
62748517,
7529536,
11390625,
16777216,
24137569,
34012224,
47045881,
64e6,
4084101,
5153632,
6436343,
7962624,
9765625,
11881376,
14348907,
17210368,
20511149,
243e5,
28629151,
33554432,
39135393,
45435424,
52521875,
60466176
];
i.prototype.toString = function(a, l2) {
a = a || 10, l2 = l2 | 0 || 1;
var h2;
if (a === 16 || a === "hex") {
h2 = "";
for (var y2 = 0, w2 = 0, M2 = 0; M2 < this.length; M2++) {
var E2 = this.words[M2], m2 = ((E2 << y2 | w2) & 16777215).toString(16);
w2 = E2 >>> 24 - y2 & 16777215, y2 += 2, y2 >= 26 && (y2 -= 26, M2--), w2 !== 0 || M2 !== this.length - 1 ? h2 = T[6 - m2.length] + m2 + h2 : h2 = m2 + h2;
}
for (w2 !== 0 && (h2 = w2.toString(16) + h2); h2.length % l2 !== 0; )
h2 = "0" + h2;
return this.negative !== 0 && (h2 = "-" + h2), h2;
}
if (a === (a | 0) && a >= 2 && a <= 36) {
var u2 = k2[a], g2 = D2[a];
h2 = "";
var G2 = this.clone();
for (G2.negative = 0; !G2.isZero(); ) {
var f2 = G2.modrn(g2).toString(a);
G2 = G2.idivn(g2), G2.isZero() ? h2 = f2 + h2 : h2 = T[u2 - f2.length] + f2 + h2;
}
for (this.isZero() && (h2 = "0" + h2); h2.length % l2 !== 0; )
h2 = "0" + h2;
return this.negative !== 0 && (h2 = "-" + h2), h2;
}
r2(false, "Base should be between 2 and 36");
}, i.prototype.toNumber = function() {
var a = this.words[0];
return this.length === 2 ? a += this.words[1] * 67108864 : this.length === 3 && this.words[2] === 1 ? a += 4503599627370496 + this.words[1] * 67108864 : this.length > 2 && r2(false, "Number can only safely store up to 53 bits"), this.negative !== 0 ? -a : a;
}, i.prototype.toJSON = function() {
return this.toString(16, 2);
}, o2 && (i.prototype.toBuffer = function(a, l2) {
return this.toArrayLike(o2, a, l2);
}), i.prototype.toArray = function(a, l2) {
return this.toArrayLike(Array, a, l2);
};
var q2 = function(a, l2) {
return a.allocUnsafe ? a.allocUnsafe(l2) : new a(l2);
};
i.prototype.toArrayLike = function(a, l2, h2) {
this._strip();
var y2 = this.byteLength(), w2 = h2 || Math.max(1, y2);
r2(y2 <= w2, "byte array longer than desired length"), r2(w2 > 0, "Requested array length <= 0");
var M2 = q2(a, w2), E2 = l2 === "le" ? "LE" : "BE";
return this["_toArrayLike" + E2](M2, y2), M2;
}, i.prototype._toArrayLikeLE = function(a, l2) {
for (var h2 = 0, y2 = 0, w2 = 0, M2 = 0; w2 < this.length; w2++) {
var E2 = this.words[w2] << M2 | y2;
a[h2++] = E2 & 255, h2 < a.length && (a[h2++] = E2 >> 8 & 255), h2 < a.length && (a[h2++] = E2 >> 16 & 255), M2 === 6 ? (h2 < a.length && (a[h2++] = E2 >> 24 & 255), y2 = 0, M2 = 0) : (y2 = E2 >>> 24, M2 += 2);
}
if (h2 < a.length)
for (a[h2++] = y2; h2 < a.length; )
a[h2++] = 0;
}, i.prototype._toArrayLikeBE = function(a, l2) {
for (var h2 = a.length - 1, y2 = 0, w2 = 0, M2 = 0; w2 < this.length; w2++) {
var E2 = this.words[w2] << M2 | y2;
a[h2--] = E2 & 255, h2 >= 0 && (a[h2--] = E2 >> 8 & 255), h2 >= 0 && (a[h2--] = E2 >> 16 & 255), M2 === 6 ? (h2 >= 0 && (a[h2--] = E2 >> 24 & 255), y2 = 0, M2 = 0) : (y2 = E2 >>> 24, M2 += 2);
}
if (h2 >= 0)
for (a[h2--] = y2; h2 >= 0; )
a[h2--] = 0;
}, Math.clz32 ? i.prototype._countBits = function(a) {
return 32 - Math.clz32(a);
} : i.prototype._countBits = function(a) {
var l2 = a, h2 = 0;
return l2 >= 4096 && (h2 += 13, l2 >>>= 13), l2 >= 64 && (h2 += 7, l2 >>>= 7), l2 >= 8 && (h2 += 4, l2 >>>= 4), l2 >= 2 && (h2 += 2, l2 >>>= 2), h2 + l2;
}, i.prototype._zeroBits = function(a) {
if (a === 0) return 26;
var l2 = a, h2 = 0;
return l2 & 8191 || (h2 += 13, l2 >>>= 13), l2 & 127 || (h2 += 7, l2 >>>= 7), l2 & 15 || (h2 += 4, l2 >>>= 4), l2 & 3 || (h2 += 2, l2 >>>= 2), l2 & 1 || h2++, h2;
}, i.prototype.bitLength = function() {
var a = this.words[this.length - 1], l2 = this._countBits(a);
return (this.length - 1) * 26 + l2;
};
function Fe(v2) {
for (var a = new Array(v2.bitLength()), l2 = 0; l2 < a.length; l2++) {
var h2 = l2 / 26 | 0, y2 = l2 % 26;
a[l2] = v2.words[h2] >>> y2 & 1;
}
return a;
}
i.prototype.zeroBits = function() {
if (this.isZero()) return 0;
for (var a = 0, l2 = 0; l2 < this.length; l2++) {
var h2 = this._zeroBits(this.words[l2]);
if (a += h2, h2 !== 26) break;
}
return a;
}, i.prototype.byteLength = function() {
return Math.ceil(this.bitLength() / 8);
}, i.prototype.toTwos = function(a) {
return this.negative !== 0 ? this.abs().inotn(a).iaddn(1) : this.clone();
}, i.prototype.fromTwos = function(a) {
return this.testn(a - 1) ? this.notn(a).iaddn(1).ineg() : this.clone();
}, i.prototype.isNeg = function() {
return this.negative !== 0;
}, i.prototype.neg = function() {
return this.clone().ineg();
}, i.prototype.ineg = function() {
return this.isZero() || (this.negative ^= 1), this;
}, i.prototype.iuor = function(a) {
for (; this.length < a.length; )
this.words[this.length++] = 0;
for (var l2 = 0; l2 < a.length; l2++)
this.words[l2] = this.words[l2] | a.words[l2];
return this._strip();
}, i.prototype.ior = function(a) {
return r2((this.negative | a.negative) === 0), this.iuor(a);
}, i.prototype.or = function(a) {
return this.length > a.length ? this.clone().ior(a) : a.clone().ior(this);
}, i.prototype.uor = function(a) {
return this.length > a.length ? this.clone().iuor(a) : a.clone().iuor(this);
}, i.prototype.iuand = function(a) {
var l2;
this.length > a.length ? l2 = a : l2 = this;
for (var h2 = 0; h2 < l2.length; h2++)
this.words[h2] = this.words[h2] & a.words[h2];
return this.length = l2.length, this._strip();
}, i.prototype.iand = function(a) {
return r2((this.negative | a.negative) === 0), this.iuand(a);
}, i.prototype.and = function(a) {
return this.length > a.length ? this.clone().iand(a) : a.clone().iand(this);
}, i.prototype.uand = function(a) {
return this.length > a.length ? this.clone().iuand(a) : a.clone().iuand(this);
}, i.prototype.iuxor = function(a) {
var l2, h2;
this.length > a.length ? (l2 = this, h2 = a) : (l2 = a, h2 = this);
for (var y2 = 0; y2 < h2.length; y2++)
this.words[y2] = l2.words[y2] ^ h2.words[y2];
if (this !== l2)
for (; y2 < l2.length; y2++)
this.words[y2] = l2.words[y2];
return this.length = l2.length, this._strip();
}, i.prototype.ixor = function(a) {
return r2((this.negative | a.negative) === 0), this.iuxor(a);
}, i.prototype.xor = function(a) {
return this.length > a.length ? this.clone().ixor(a) : a.clone().ixor(this);
}, i.prototype.uxor = function(a) {
return this.length > a.length ? this.clone().iuxor(a) : a.clone().iuxor(this);
}, i.prototype.inotn = function(a) {
r2(typeof a == "number" && a >= 0);
var l2 = Math.ceil(a / 26) | 0, h2 = a % 26;
this._expand(l2), h2 > 0 && l2--;
for (var y2 = 0; y2 < l2; y2++)
this.words[y2] = ~this.words[y2] & 67108863;
return h2 > 0 && (this.words[y2] = ~this.words[y2] & 67108863 >> 26 - h2), this._strip();
}, i.prototype.notn = function(a) {
return this.clone().inotn(a);
}, i.prototype.setn = function(a, l2) {
r2(typeof a == "number" && a >= 0);
var h2 = a / 26 | 0, y2 = a % 26;
return this._expand(h2 + 1), l2 ? this.words[h2] = this.words[h2] | 1 << y2 : this.words[h2] = this.words[h2] & ~(1 << y2), this._strip();
}, i.prototype.iadd = function(a) {
var l2;
if (this.negative !== 0 && a.negative === 0)
return this.negative = 0, l2 = this.isub(a), this.negative ^= 1, this._normSign();
if (this.negative === 0 && a.negative !== 0)
return a.negative = 0, l2 = this.isub(a), a.negative = 1, l2._normSign();
var h2, y2;
this.length > a.length ? (h2 = this, y2 = a) : (h2 = a, y2 = this);
for (var w2 = 0, M2 = 0; M2 < y2.length; M2++)
l2 = (h2.words[M2] | 0) + (y2.words[M2] | 0) + w2, this.words[M2] = l2 & 67108863, w2 = l2 >>> 26;
for (; w2 !== 0 && M2 < h2.length; M2++)
l2 = (h2.words[M2] | 0) + w2, this.words[M2] = l2 & 67108863, w2 = l2 >>> 26;
if (this.length = h2.length, w2 !== 0)
this.words[this.length] = w2, this.length++;
else if (h2 !== this)
for (; M2 < h2.length; M2++)
this.words[M2] = h2.words[M2];
return this;
}, i.prototype.add = function(a) {
var l2;
return a.negative !== 0 && this.negative === 0 ? (a.negative = 0, l2 = this.sub(a), a.negative ^= 1, l2) : a.negative === 0 && this.negative !== 0 ? (this.negative = 0, l2 = a.sub(this), this.negative = 1, l2) : this.length > a.length ? this.clone().iadd(a) : a.clone().iadd(this);
}, i.prototype.isub = function(a) {
if (a.negative !== 0) {
a.negative = 0;
var l2 = this.iadd(a);
return a.negative = 1, l2._normSign();
} else if (this.negative !== 0)
return this.negative = 0, this.iadd(a), this.negative = 1, this._normSign();
var h2 = this.cmp(a);
if (h2 === 0)
return this.negative = 0, this.length = 1, this.words[0] = 0, this;
var y2, w2;
h2 > 0 ? (y2 = this, w2 = a) : (y2 = a, w2 = this);
for (var M2 = 0, E2 = 0; E2 < w2.length; E2++)
l2 = (y2.words[E2] | 0) - (w2.words[E2] | 0) + M2, M2 = l2 >> 26, this.words[E2] = l2 & 67108863;
for (; M2 !== 0 && E2 < y2.length; E2++)
l2 = (y2.words[E2] | 0) + M2, M2 = l2 >> 26, this.words[E2] = l2 & 67108863;
if (M2 === 0 && E2 < y2.length && y2 !== this)
for (; E2 < y2.length; E2++)
this.words[E2] = y2.words[E2];
return this.length = Math.max(this.length, E2), y2 !== this && (this.negative = 1), this._strip();
}, i.prototype.sub = function(a) {
return this.clone().isub(a);
};
function X2(v2, a, l2) {
l2.negative = a.negative ^ v2.negative;
var h2 = v2.length + a.length | 0;
l2.length = h2, h2 = h2 - 1 | 0;
var y2 = v2.words[0] | 0, w2 = a.words[0] | 0, M2 = y2 * w2, E2 = M2 & 67108863, m2 = M2 / 67108864 | 0;
l2.words[0] = E2;
for (var u2 = 1; u2 < h2; u2++) {
for (var g2 = m2 >>> 26, G2 = m2 & 67108863, f2 = Math.min(u2, a.length - 1), A2 = Math.max(0, u2 - v2.length + 1); A2 <= f2; A2++) {
var _2 = u2 - A2 | 0;
y2 = v2.words[_2] | 0, w2 = a.words[A2] | 0, M2 = y2 * w2 + G2, g2 += M2 / 67108864 | 0, G2 = M2 & 67108863;
}
l2.words[u2] = G2 | 0, m2 = g2 | 0;
}
return m2 !== 0 ? l2.words[u2] = m2 | 0 : l2.length--, l2._strip();
}
var $e = function(a, l2, h2) {
var y2 = a.words, w2 = l2.words, M2 = h2.words, E2 = 0, m2, u2, g2, G2 = y2[0] | 0, f2 = G2 & 8191, A2 = G2 >>> 13, _2 = y2[1] | 0, N2 = _2 & 8191, I2 = _2 >>> 13, L = y2[2] | 0, C2 = L & 8191, P2 = L >>> 13, Pe = y2[3] | 0, U = Pe & 8191, V2 = Pe >>> 13, St = y2[4] | 0, ee2 = St & 8191, te2 = St >>> 13, kt = y2[5] | 0, ne2 = kt & 8191, re2 = kt >>> 13, Pt = y2[6] | 0, ie = Pt & 8191, se = Pt >>> 13, Ot = y2[7] | 0, ae2 = Ot & 8191, oe = Ot >>> 13, Ct = y2[8] | 0, ue = Ct & 8191, le = Ct >>> 13, Ut = y2[9] | 0, fe = Ut & 8191, de = Ut >>> 13, Bt = w2[0] | 0, he = Bt & 8191, pe = Bt >>> 13, Ft = w2[1] | 0, ce = Ft & 8191, me = Ft >>> 13, Dt = w2[2] | 0, ye = Dt & 8191, ge = Dt >>> 13, Lt = w2[3] | 0, we = Lt & 8191, ve = Lt >>> 13, Gt = w2[4] | 0, be = Gt & 8191, Me = Gt >>> 13, $t = w2[5] | 0, xe = $t & 8191, Ee = $t >>> 13, qt = w2[6] | 0, Te = qt & 8191, Ae = qt >>> 13, zt = w2[7] | 0, _e = zt & 8191, Ne = zt >>> 13, Vt = w2[8] | 0, Re = Vt & 8191, Ie = Vt >>> 13, jt = w2[9] | 0, Se = jt & 8191, ke = jt >>> 13;
h2.negative = a.negative ^ l2.negative, h2.length = 19, m2 = Math.imul(f2, he), u2 = Math.imul(f2, pe), u2 = u2 + Math.imul(A2, he) | 0, g2 = Math.imul(A2, pe);
var vt = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (vt >>> 26) | 0, vt &= 67108863, m2 = Math.imul(N2, he), u2 = Math.imul(N2, pe), u2 = u2 + Math.imul(I2, he) | 0, g2 = Math.imul(I2, pe), m2 = m2 + Math.imul(f2, ce) | 0, u2 = u2 + Math.imul(f2, me) | 0, u2 = u2 + Math.imul(A2, ce) | 0, g2 = g2 + Math.imul(A2, me) | 0;
var bt = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (bt >>> 26) | 0, bt &= 67108863, m2 = Math.imul(C2, he), u2 = Math.imul(C2, pe), u2 = u2 + Math.imul(P2, he) | 0, g2 = Math.imul(P2, pe), m2 = m2 + Math.imul(N2, ce) | 0, u2 = u2 + Math.imul(N2, me) | 0, u2 = u2 + Math.imul(I2, ce) | 0, g2 = g2 + Math.imul(I2, me) | 0, m2 = m2 + Math.imul(f2, ye) | 0, u2 = u2 + Math.imul(f2, ge) | 0, u2 = u2 + Math.imul(A2, ye) | 0, g2 = g2 + Math.imul(A2, ge) | 0;
var Mt = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (Mt >>> 26) | 0, Mt &= 67108863, m2 = Math.imul(U, he), u2 = Math.imul(U, pe), u2 = u2 + Math.imul(V2, he) | 0, g2 = Math.imul(V2, pe), m2 = m2 + Math.imul(C2, ce) | 0, u2 = u2 + Math.imul(C2, me) | 0, u2 = u2 + Math.imul(P2, ce) | 0, g2 = g2 + Math.imul(P2, me) | 0, m2 = m2 + Math.imul(N2, ye) | 0, u2 = u2 + Math.imul(N2, ge) | 0, u2 = u2 + Math.imul(I2, ye) | 0, g2 = g2 + Math.imul(I2, ge) | 0, m2 = m2 + Math.imul(f2, we) | 0, u2 = u2 + Math.imul(f2, ve) | 0, u2 = u2 + Math.imul(A2, we) | 0, g2 = g2 + Math.imul(A2, ve) | 0;
var xt = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (xt >>> 26) | 0, xt &= 67108863, m2 = Math.imul(ee2, he), u2 = Math.imul(ee2, pe), u2 = u2 + Math.imul(te2, he) | 0, g2 = Math.imul(te2, pe), m2 = m2 + Math.imul(U, ce) | 0, u2 = u2 + Math.imul(U, me) | 0, u2 = u2 + Math.imul(V2, ce) | 0, g2 = g2 + Math.imul(V2, me) | 0, m2 = m2 + Math.imul(C2, ye) | 0, u2 = u2 + Math.imul(C2, ge) | 0, u2 = u2 + Math.imul(P2, ye) | 0, g2 = g2 + Math.imul(P2, ge) | 0, m2 = m2 + Math.imul(N2, we) | 0, u2 = u2 + Math.imul(N2, ve) | 0, u2 = u2 + Math.imul(I2, we) | 0, g2 = g2 + Math.imul(I2, ve) | 0, m2 = m2 + Math.imul(f2, be) | 0, u2 = u2 + Math.imul(f2, Me) | 0, u2 = u2 + Math.imul(A2, be) | 0, g2 = g2 + Math.imul(A2, Me) | 0;
var Et = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (Et >>> 26) | 0, Et &= 67108863, m2 = Math.imul(ne2, he), u2 = Math.imul(ne2, pe), u2 = u2 + Math.imul(re2, he) | 0, g2 = Math.imul(re2, pe), m2 = m2 + Math.imul(ee2, ce) | 0, u2 = u2 + Math.imul(ee2, me) | 0, u2 = u2 + Math.imul(te2, ce) | 0, g2 = g2 + Math.imul(te2, me) | 0, m2 = m2 + Math.imul(U, ye) | 0, u2 = u2 + Math.imul(U, ge) | 0, u2 = u2 + Math.imul(V2, ye) | 0, g2 = g2 + Math.imul(V2, ge) | 0, m2 = m2 + Math.imul(C2, we) | 0, u2 = u2 + Math.imul(C2, ve) | 0, u2 = u2 + Math.imul(P2, we) | 0, g2 = g2 + Math.imul(P2, ve) | 0, m2 = m2 + Math.imul(N2, be) | 0, u2 = u2 + Math.imul(N2, Me) | 0, u2 = u2 + Math.imul(I2, be) | 0, g2 = g2 + Math.imul(I2, Me) | 0, m2 = m2 + Math.imul(f2, xe) | 0, u2 = u2 + Math.imul(f2, Ee) | 0, u2 = u2 + Math.imul(A2, xe) | 0, g2 = g2 + Math.imul(A2, Ee) | 0;
var Vn = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (Vn >>> 26) | 0, Vn &= 67108863, m2 = Math.imul(ie, he), u2 = Math.imul(ie, pe), u2 = u2 + Math.imul(se, he) | 0, g2 = Math.imul(se, pe), m2 = m2 + Math.imul(ne2, ce) | 0, u2 = u2 + Math.imul(ne2, me) | 0, u2 = u2 + Math.imul(re2, ce) | 0, g2 = g2 + Math.imul(re2, me) | 0, m2 = m2 + Math.imul(ee2, ye) | 0, u2 = u2 + Math.imul(ee2, ge) | 0, u2 = u2 + Math.imul(te2, ye) | 0, g2 = g2 + Math.imul(te2, ge) | 0, m2 = m2 + Math.imul(U, we) | 0, u2 = u2 + Math.imul(U, ve) | 0, u2 = u2 + Math.imul(V2, we) | 0, g2 = g2 + Math.imul(V2, ve) | 0, m2 = m2 + Math.imul(C2, be) | 0, u2 = u2 + Math.imul(C2, Me) | 0, u2 = u2 + Math.imul(P2, be) | 0, g2 = g2 + Math.imul(P2, Me) | 0, m2 = m2 + Math.imul(N2, xe) | 0, u2 = u2 + Math.imul(N2, Ee) | 0, u2 = u2 + Math.imul(I2, xe) | 0, g2 = g2 + Math.imul(I2, Ee) | 0, m2 = m2 + Math.imul(f2, Te) | 0, u2 = u2 + Math.imul(f2, Ae) | 0, u2 = u2 + Math.imul(A2, Te) | 0, g2 = g2 + Math.imul(A2, Ae) | 0;
var jn = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (jn >>> 26) | 0, jn &= 67108863, m2 = Math.imul(ae2, he), u2 = Math.imul(ae2, pe), u2 = u2 + Math.imul(oe, he) | 0, g2 = Math.imul(oe, pe), m2 = m2 + Math.imul(ie, ce) | 0, u2 = u2 + Math.imul(ie, me) | 0, u2 = u2 + Math.imul(se, ce) | 0, g2 = g2 + Math.imul(se, me) | 0, m2 = m2 + Math.imul(ne2, ye) | 0, u2 = u2 + Math.imul(ne2, ge) | 0, u2 = u2 + Math.imul(re2, ye) | 0, g2 = g2 + Math.imul(re2, ge) | 0, m2 = m2 + Math.imul(ee2, we) | 0, u2 = u2 + Math.imul(ee2, ve) | 0, u2 = u2 + Math.imul(te2, we) | 0, g2 = g2 + Math.imul(te2, ve) | 0, m2 = m2 + Math.imul(U, be) | 0, u2 = u2 + Math.imul(U, Me) | 0, u2 = u2 + Math.imul(V2, be) | 0, g2 = g2 + Math.imul(V2, Me) | 0, m2 = m2 + Math.imul(C2, xe) | 0, u2 = u2 + Math.imul(C2, Ee) | 0, u2 = u2 + Math.imul(P2, xe) | 0, g2 = g2 + Math.imul(P2, Ee) | 0, m2 = m2 + Math.imul(N2, Te) | 0, u2 = u2 + Math.imul(N2, Ae) | 0, u2 = u2 + Math.imul(I2, Te) | 0, g2 = g2 + Math.imul(I2, Ae) | 0, m2 = m2 + Math.imul(f2, _e) | 0, u2 = u2 + Math.imul(f2, Ne) | 0, u2 = u2 + Math.imul(A2, _e) | 0, g2 = g2 + Math.imul(A2, Ne) | 0;
var Hn = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (Hn >>> 26) | 0, Hn &= 67108863, m2 = Math.imul(ue, he), u2 = Math.imul(ue, pe), u2 = u2 + Math.imul(le, he) | 0, g2 = Math.imul(le, pe), m2 = m2 + Math.imul(ae2, ce) | 0, u2 = u2 + Math.imul(ae2, me) | 0, u2 = u2 + Math.imul(oe, ce) | 0, g2 = g2 + Math.imul(oe, me) | 0, m2 = m2 + Math.imul(ie, ye) | 0, u2 = u2 + Math.imul(ie, ge) | 0, u2 = u2 + Math.imul(se, ye) | 0, g2 = g2 + Math.imul(se, ge) | 0, m2 = m2 + Math.imul(ne2, we) | 0, u2 = u2 + Math.imul(ne2, ve) | 0, u2 = u2 + Math.imul(re2, we) | 0, g2 = g2 + Math.imul(re2, ve) | 0, m2 = m2 + Math.imul(ee2, be) | 0, u2 = u2 + Math.imul(ee2, Me) | 0, u2 = u2 + Math.imul(te2, be) | 0, g2 = g2 + Math.imul(te2, Me) | 0, m2 = m2 + Math.imul(U, xe) | 0, u2 = u2 + Math.imul(U, Ee) | 0, u2 = u2 + Math.imul(V2, xe) | 0, g2 = g2 + Math.imul(V2, Ee) | 0, m2 = m2 + Math.imul(C2, Te) | 0, u2 = u2 + Math.imul(C2, Ae) | 0, u2 = u2 + Math.imul(P2, Te) | 0, g2 = g2 + Math.imul(P2, Ae) | 0, m2 = m2 + Math.imul(N2, _e) | 0, u2 = u2 + Math.imul(N2, Ne) | 0, u2 = u2 + Math.imul(I2, _e) | 0, g2 = g2 + Math.imul(I2, Ne) | 0, m2 = m2 + Math.imul(f2, Re) | 0, u2 = u2 + Math.imul(f2, Ie) | 0, u2 = u2 + Math.imul(A2, Re) | 0, g2 = g2 + Math.imul(A2, Ie) | 0;
var Zn = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (Zn >>> 26) | 0, Zn &= 67108863, m2 = Math.imul(fe, he), u2 = Math.imul(fe, pe), u2 = u2 + Math.imul(de, he) | 0, g2 = Math.imul(de, pe), m2 = m2 + Math.imul(ue, ce) | 0, u2 = u2 + Math.imul(ue, me) | 0, u2 = u2 + Math.imul(le, ce) | 0, g2 = g2 + Math.imul(le, me) | 0, m2 = m2 + Math.imul(ae2, ye) | 0, u2 = u2 + Math.imul(ae2, ge) | 0, u2 = u2 + Math.imul(oe, ye) | 0, g2 = g2 + Math.imul(oe, ge) | 0, m2 = m2 + Math.imul(ie, we) | 0, u2 = u2 + Math.imul(ie, ve) | 0, u2 = u2 + Math.imul(se, we) | 0, g2 = g2 + Math.imul(se, ve) | 0, m2 = m2 + Math.imul(ne2, be) | 0, u2 = u2 + Math.imul(ne2, Me) | 0, u2 = u2 + Math.imul(re2, be) | 0, g2 = g2 + Math.imul(re2, Me) | 0, m2 = m2 + Math.imul(ee2, xe) | 0, u2 = u2 + Math.imul(ee2, Ee) | 0, u2 = u2 + Math.imul(te2, xe) | 0, g2 = g2 + Math.imul(te2, Ee) | 0, m2 = m2 + Math.imul(U, Te) | 0, u2 = u2 + Math.imul(U, Ae) | 0, u2 = u2 + Math.imul(V2, Te) | 0, g2 = g2 + Math.imul(V2, Ae) | 0, m2 = m2 + Math.imul(C2, _e) | 0, u2 = u2 + Math.imul(C2, Ne) | 0, u2 = u2 + Math.imul(P2, _e) | 0, g2 = g2 + Math.imul(P2, Ne) | 0, m2 = m2 + Math.imul(N2, Re) | 0, u2 = u2 + Math.imul(N2, Ie) | 0, u2 = u2 + Math.imul(I2, Re) | 0, g2 = g2 + Math.imul(I2, Ie) | 0, m2 = m2 + Math.imul(f2, Se) | 0, u2 = u2 + Math.imul(f2, ke) | 0, u2 = u2 + Math.imul(A2, Se) | 0, g2 = g2 + Math.imul(A2, ke) | 0;
var Wn = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (Wn >>> 26) | 0, Wn &= 67108863, m2 = Math.imul(fe, ce), u2 = Math.imul(fe, me), u2 = u2 + Math.imul(de, ce) | 0, g2 = Math.imul(de, me), m2 = m2 + Math.imul(ue, ye) | 0, u2 = u2 + Math.imul(ue, ge) | 0, u2 = u2 + Math.imul(le, ye) | 0, g2 = g2 + Math.imul(le, ge) | 0, m2 = m2 + Math.imul(ae2, we) | 0, u2 = u2 + Math.imul(ae2, ve) | 0, u2 = u2 + Math.imul(oe, we) | 0, g2 = g2 + Math.imul(oe, ve) | 0, m2 = m2 + Math.imul(ie, be) | 0, u2 = u2 + Math.imul(ie, Me) | 0, u2 = u2 + Math.imul(se, be) | 0, g2 = g2 + Math.imul(se, Me) | 0, m2 = m2 + Math.imul(ne2, xe) | 0, u2 = u2 + Math.imul(ne2, Ee) | 0, u2 = u2 + Math.imul(re2, xe) | 0, g2 = g2 + Math.imul(re2, Ee) | 0, m2 = m2 + Math.imul(ee2, Te) | 0, u2 = u2 + Math.imul(ee2, Ae) | 0, u2 = u2 + Math.imul(te2, Te) | 0, g2 = g2 + Math.imul(te2, Ae) | 0, m2 = m2 + Math.imul(U, _e) | 0, u2 = u2 + Math.imul(U, Ne) | 0, u2 = u2 + Math.imul(V2, _e) | 0, g2 = g2 + Math.imul(V2, Ne) | 0, m2 = m2 + Math.imul(C2, Re) | 0, u2 = u2 + Math.imul(C2, Ie) | 0, u2 = u2 + Math.imul(P2, Re) | 0, g2 = g2 + Math.imul(P2, Ie) | 0, m2 = m2 + Math.imul(N2, Se) | 0, u2 = u2 + Math.imul(N2, ke) | 0, u2 = u2 + Math.imul(I2, Se) | 0, g2 = g2 + Math.imul(I2, ke) | 0;
var Jn = (E2 + m2 | 0) + ((u2 & 8191) << 13) | 0;
E2 = (g2 + (u2 >>> 13) | 0) + (Jn >>> 26) | 0, Jn &= 67108863, m2 = Math.imul(fe, ye), u2 = Math.imul(fe, ge), u2 = u2 + Math.imul(de, ye) | 0, g2 = Math.imul(de, ge), m2 = m2 + Math.imul(ue, we) | 0, u2 = u2 + Math.imul(ue, ve) | 0, u2 = u2 + Math.imul(le, we) | 0, g2 = g2 + Math.imul(le, ve) | 0, m2 = m2 + Math.imul(ae2, be) | 0, u2 = u2 + Math.imul(ae2, Me) | 0, u2 = u2 + Math.imul(oe, be) | 0, g2 = g2 + Math.imul(oe, Me) | 0, m2 = m2 + Math.imul(ie, xe) | 0, u2 = u2 + Math.imul(ie, Ee) | 0, u2 = u2 + Math.imul(se, xe) | 0, g2 = g2 + Math.imul(se, Ee) | 0, m2 = m2 + Math.imul(ne2, Te) | 0, u2 = u2 + Math.imul(ne2, Ae) | 0, u2 = u2 + Math.imul(re2, Te) | 0, g2 = g2 + Math.imul(re2, Ae) | 0, m2 = m2 + Math.imul(ee2, _e) | 0, u2 = u2 + Math.imul(ee2, Ne) | 0, u2 = u2 + Math.imul(te2, _e) | 0, g2 = g2 + Math.imul(te2, Ne) | 0, m2 = m2 + Math.imul(U, Re) | 0, u2 = u2 + Math.imul(U, Ie) | 0, u2 = u2 + Math.imul(V2, Re) | 0, g2 = g2 + Math.imul(V2, Ie) | 0, m2 = m2 + Math.imul(C2, Se) | 0, u2 = u2 + Math.imul(C2, ke) | 0, u2 = u2 + Math.imul(P2, Se) | 0, g2 = g2