UNPKG

@skalenetwork/metaport

Version:

SKALE Metaport Widget

1,612 lines 3.88 MB
var DZ = Object.defineProperty; var gZ = (t, e, M) => e in t ? DZ(t, e, { enumerable: !0, configurable: !0, writable: !0, value: M }) : t[e] = M; var v = (t, e, M) => (gZ(t, typeof e != "symbol" ? e + "" : e, M), M), Xg = (t, e, M) => { if (!e.has(t)) throw TypeError("Cannot " + M); }; var C = (t, e, M) => (Xg(t, e, "read from private field"), M ? M.call(t) : e.get(t)), Ne = (t, e, M) => { if (e.has(t)) throw TypeError("Cannot add the same private member more than once"); e instanceof WeakSet ? e.add(t) : e.set(t, M); }, F = (t, e, M, n) => (Xg(t, e, "write to private field"), n ? n.call(t, M) : e.set(t, M), M); var To = (t, e, M, n) => ({ set _(i) { F(t, e, i, M); }, get _() { return C(t, e, n); } }), de = (t, e, M) => (Xg(t, e, "access private method"), M); import * as h from "react"; import p, { useCallback as jn, Children as lZ, isValidElement as OI, cloneElement as fI, forwardRef as zZ, useContext as $e, useEffect as it, useState as Qt, createContext as xn, useMemo as Yu, useReducer as yd, Fragment as wC, useRef as YN } from "react"; import ot, { jsx as O, jsxs as Ie } from "react/jsx-runtime"; import * as pC from "react-dom"; import vL, { createPortal as TZ } from "react-dom"; /** * @license * SKALE Metaport * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ const M$e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })); /** * @license * SKALE Metaport * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ var hM = /* @__PURE__ */ ((t) => (t.eth = "eth", t.erc20 = "erc20", t.erc721 = "erc721", t.erc721meta = "erc721meta", t.erc1155 = "erc1155", t))(hM || {}), gi = /* @__PURE__ */ ((t) => (t.erc20wrap = "erc20wrap", t.sfuelwrap = "sfuelwrap", t))(gi || {}); const AZ = { "honorable-steel-rasalhague": { address: "0x02891b34B7911A9C68e82C193cd7A6fBf0c3b30A", func: "0x0c11dedd" }, "affectionate-immediate-pollux": { address: "0xFcE116dB669A22CF811D86F0591F8AeCA68abB01", func: "0x0c11dedd" }, "elated-tan-skat": { address: "0x2B267A3e49b351DEdac892400a530ABb2f899d23", func: "0x6a627842" }, "turbulent-unique-scheat": { address: "0xCf616Cc9C2bC15A35324B2634B6dBaF585e5D8E4", func: "0x0c11dedd" }, "parallel-stormy-spica": { address: "0xa5C297dF8f8386E4b940D61EF9A8f2bB367a6fAB", func: "0x0c11dedd" }, "wan-red-ain": { address: "0xb51a0E538c76C82e76757dc6D5a3938136C03c0C", func: "0x0c11dedd" }, "green-giddy-denebola": { address: "0x5a6869ef5b81DCb58EBF51b8F893c31f5AFE3Fa8", func: "0x0c11dedd" } }, dZ = { "staging-perfect-parallel-gacrux": { address: "0x4576d1B9eeaE16d6Ca643e55D21E0Dc00e8A7b6D", func: "0x0c11dedd" }, "staging-severe-violet-wezen": { address: "0x37412E23bBF1058A7e325A16C01FF654E1D53562", func: "0x0c11dedd" }, "staging-legal-crazy-castor": { address: "0x436389289aEAFefD1d7471b7FbEc67539Bde3E34", func: "0x6a627842" }, "staging-utter-unripe-menkar": { address: "0x84b7265Bc964BB69b4275d4Dac4df0FD87556960", func: "0x0c11dedd" }, "staging-faint-slimy-achird": { address: "0xfd56A3456fbAB0fc013213edCc830B9d32403C8B", func: "0x0c11dedd" }, "staging-fast-active-bellatrix": { address: "0x1B2e7E6E66a6c202cdC0C31DF996b530af22CBee", func: "0x0c11dedd" } }, SZ = { "skale-innocent-nasty": { address: "0xC0ED18Fe6654C8211582671E28E75d73BF61A60f", func: "0x0c11dedd" }, "international-villainous-zaurak": { address: "0x8bcA6a0E1427dBc2C2F40134d805d5929B80f56E", func: "0x0c11dedd" } }, xZ = null, EZ = { mainnet: AZ, staging: dZ, legacy: SZ, regression: xZ }; /** * @license * SKALE Metaport * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ const Vt = "mainnet", wZ = "0x0000000000000000000000000000000000000000", pZ = "m2s", OZ = "s2m", fZ = "s2s", mZ = "https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/", CZ = 2n ** 256n - 1n, hD = "115792089237316195423570985008687907853269984665640564039457584007913129639935", bZ = 21000000000000n, Q4 = "18", YD = "Ooops... Something went wrong...", Dd = "Error during the transfer", Xu = "20pt", Gz = 99e3, hZ = "https://", YZ = { mainnet: "https://etherscan.io", staging: "https://goerli.etherscan.io/", legacy: "https://goerli.etherscan.io/", regression: "https://goerli.etherscan.io/" }, UZ = { mainnet: "explorer.mainnet.skalenodes.com", staging: "explorer.staging-v3.skalenodes.com", legacy: "legacy-explorer.skalenodes.com", regression: "regression-explorer.skalenodes.com" }, kZ = { mainnet: "wss://ethereum.publicnode.com", staging: "wss://ethereum-goerli.publicnode.com", legacy: "wss://ethereum-goerli.publicnode.com ", regression: "wss://ethereum-goerli.publicnode.com " }, QZ = 5, vZ = 2, PZ = 5, Cw = { sfuel: { warning: "You need sFUEL on the destination chain", error: "You need sFUEL to perform a transfer" }, gas: { warning: "You need ETH on the destination chain", error: "You need ETH to perform a transfer" } }, ZZ = "0x00000000", jy = EZ, RZ = 1.2, tc = 5e-3, GZ = 150000n, BZ = 10, UN = BZ * 1e3, bw = 0.01, WZ = ["🎉", "👌", "✅", "🙌", "🎊"], hw = "rgb(136 135 135 / 15%)", OC = 6e3, _Z = 60; /** * @license * SKALE Metaport * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ class fC { constructor(e, M, n, i, u, a) { v(this, "address"); v(this, "keyname"); v(this, "type"); v(this, "meta"); v(this, "connections"); v(this, "chain"); this.address = e, this.meta = i, this.meta.decimals = this.meta.decimals ? this.meta.decimals : Q4, this.connections = u, this.type = M, this.keyname = n, this.chain = a; } wrapper(e) { return this.connections[e].wrapper; } isClone(e) { return this.connections[e].clone; } wrapsSFuel(e) { return this.connections[e].wrapsSFuel; } } /** * @license * SKALE Metaport * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ const sy = { topLeft: { top: Xu, left: Xu, right: "auto", bottom: "auto" }, topRight: { top: Xu, left: "auto", right: Xu, bottom: "auto" }, bottomRight: { top: "auto", left: "auto", right: Xu, bottom: Xu }, bottomLeft: { top: "auto", left: Xu, right: "auto", bottom: Xu } }; /** * @license * SKALE Metaport * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ var mC = /* @__PURE__ */ ((t) => (t[t.NO_REQEST = 0] = "NO_REQEST", t[t.RECEIVED = 1] = "RECEIVED", t[t.IN_PROGRESS = 2] = "IN_PROGRESS", t[t.IN_PROGRESS_HUB = 3] = "IN_PROGRESS_HUB", t[t.DONE = 4] = "DONE", t[t.ERROR = 5] = "ERROR", t))(mC || {}), He = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function v4(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } function UD(t) { if (t.__esModule) return t; var e = t.default; if (typeof e == "function") { var M = function n() { return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); }; M.prototype = e.prototype; } else M = {}; return Object.defineProperty(M, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) { var i = Object.getOwnPropertyDescriptor(t, n); Object.defineProperty(M, n, i.get ? i : { enumerable: !0, get: function() { return t[n]; } }); }), M; } var Bz = { exports: {} }, $g, Yw; function VZ() { if (Yw) return $g; Yw = 1; var t = 1e3, e = t * 60, M = e * 60, n = M * 24, i = n * 7, u = n * 365.25; $g = function(N, c) { c = c || {}; var L = typeof N; if (L === "string" && N.length > 0) return a(N); if (L === "number" && isFinite(N)) return c.long ? j(N) : r(N); throw new Error( "val is not a non-empty string or a valid number. val=" + JSON.stringify(N) ); }; function a(N) { if (N = String(N), !(N.length > 100)) { var c = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( N ); if (c) { var L = parseFloat(c[1]), I = (c[2] || "ms").toLowerCase(); switch (I) { case "years": case "year": case "yrs": case "yr": case "y": return L * u; case "weeks": case "week": case "w": return L * i; case "days": case "day": case "d": return L * n; case "hours": case "hour": case "hrs": case "hr": case "h": return L * M; case "minutes": case "minute": case "mins": case "min": case "m": return L * e; case "seconds": case "second": case "secs": case "sec": case "s": return L * t; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": return L; default: return; } } } } function r(N) { var c = Math.abs(N); return c >= n ? Math.round(N / n) + "d" : c >= M ? Math.round(N / M) + "h" : c >= e ? Math.round(N / e) + "m" : c >= t ? Math.round(N / t) + "s" : N + "ms"; } function j(N) { var c = Math.abs(N); return c >= n ? s(N, c, n, "day") : c >= M ? s(N, c, M, "hour") : c >= e ? s(N, c, e, "minute") : c >= t ? s(N, c, t, "second") : N + " ms"; } function s(N, c, L, I) { var y = c >= L * 1.5; return Math.round(N / L) + " " + I + (y ? "s" : ""); } return $g; } function FZ(t) { M.debug = M, M.default = M, M.coerce = j, M.disable = u, M.enable = i, M.enabled = a, M.humanize = VZ(), M.destroy = s, Object.keys(t).forEach((N) => { M[N] = t[N]; }), M.names = [], M.skips = [], M.formatters = {}; function e(N) { let c = 0; for (let L = 0; L < N.length; L++) c = (c << 5) - c + N.charCodeAt(L), c |= 0; return M.colors[Math.abs(c) % M.colors.length]; } M.selectColor = e; function M(N) { let c, L = null, I, y; function D(...l) { if (!D.enabled) return; const d = D, S = Number(/* @__PURE__ */ new Date()), z = S - (c || S); d.diff = z, d.prev = c, d.curr = S, c = S, l[0] = M.coerce(l[0]), typeof l[0] != "string" && l.unshift("%O"); let T = 0; l[0] = l[0].replace(/%([a-zA-Z%])/g, (x, g) => { if (x === "%%") return "%"; T++; const E = M.formatters[g]; if (typeof E == "function") { const Y = l[T]; x = E.call(d, Y), l.splice(T, 1), T--; } return x; }), M.formatArgs.call(d, l), (d.log || M.log).apply(d, l); } return D.namespace = N, D.useColors = M.useColors(), D.color = M.selectColor(N), D.extend = n, D.destroy = M.destroy, Object.defineProperty(D, "enabled", { enumerable: !0, configurable: !1, get: () => L !== null ? L : (I !== M.namespaces && (I = M.namespaces, y = M.enabled(N)), y), set: (l) => { L = l; } }), typeof M.init == "function" && M.init(D), D; } function n(N, c) { const L = M(this.namespace + (typeof c > "u" ? ":" : c) + N); return L.log = this.log, L; } function i(N) { M.save(N), M.namespaces = N, M.names = [], M.skips = []; let c; const L = (typeof N == "string" ? N : "").split(/[\s,]+/), I = L.length; for (c = 0; c < I; c++) L[c] && (N = L[c].replace(/\*/g, ".*?"), N[0] === "-" ? M.skips.push(new RegExp("^" + N.slice(1) + "$")) : M.names.push(new RegExp("^" + N + "$"))); } function u() { const N = [ ...M.names.map(r), ...M.skips.map(r).map((c) => "-" + c) ].join(","); return M.enable(""), N; } function a(N) { if (N[N.length - 1] === "*") return !0; let c, L; for (c = 0, L = M.skips.length; c < L; c++) if (M.skips[c].test(N)) return !1; for (c = 0, L = M.names.length; c < L; c++) if (M.names[c].test(N)) return !0; return !1; } function r(N) { return N.toString().substring(2, N.toString().length - 2).replace(/\.\*\?$/, "*"); } function j(N) { return N instanceof Error ? N.stack || N.message : N; } function s() { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } return M.enable(M.load()), M; } var HZ = FZ; (function(t, e) { e.formatArgs = n, e.save = i, e.load = u, e.useColors = M, e.storage = a(), e.destroy = (() => { let j = !1; return () => { j || (j = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")); }; })(), e.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ]; function M() { return typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs) ? !0 : typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/) ? !1 : typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } function n(j) { if (j[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + j[0] + (this.useColors ? "%c " : " ") + "+" + t.exports.humanize(this.diff), !this.useColors) return; const s = "color: " + this.color; j.splice(1, 0, s, "color: inherit"); let N = 0, c = 0; j[0].replace(/%[a-zA-Z%]/g, (L) => { L !== "%%" && (N++, L === "%c" && (c = N)); }), j.splice(c, 0, s); } e.log = console.debug || console.log || (() => { }); function i(j) { try { j ? e.storage.setItem("debug", j) : e.storage.removeItem("debug"); } catch { } } function u() { let j; try { j = e.storage.getItem("debug"); } catch { } return !j && typeof process < "u" && "env" in process && (j = process.env.DEBUG), j; } function a() { try { return localStorage; } catch { } } t.exports = HZ(e); const { formatters: r } = t.exports; r.j = function(j) { try { return JSON.stringify(j); } catch (s) { return "[UnexpectedJSONParseError]: " + s.message; } }; })(Bz, Bz.exports); var JZ = Bz.exports; const Ut = /* @__PURE__ */ v4(JZ), CC = "6.7.1"; function XZ(t, e, M) { const n = e.split("|").map((u) => u.trim()); for (let u = 0; u < n.length; u++) switch (e) { case "any": return; case "bigint": case "boolean": case "number": case "string": if (typeof t === e) return; } const i = new Error(`invalid value for type ${e}`); throw i.code = "INVALID_ARGUMENT", i.argument = `value.${M}`, i.value = t, i; } async function mM(t) { const e = Object.keys(t); return (await Promise.all(e.map((n) => Promise.resolve(t[n])))).reduce((n, i, u) => (n[e[u]] = i, n), {}); } function _e(t, e, M) { for (let n in e) { let i = e[n]; const u = M ? M[n] : null; u && XZ(i, u, n), Object.defineProperty(t, n, { enumerable: !0, value: i, writable: !1 }); } } function Vj(t) { if (t == null) return "null"; if (Array.isArray(t)) return "[ " + t.map(Vj).join(", ") + " ]"; if (t instanceof Uint8Array) { const e = "0123456789abcdef"; let M = "0x"; for (let n = 0; n < t.length; n++) M += e[t[n] >> 4], M += e[t[n] & 15]; return M; } if (typeof t == "object" && typeof t.toJSON == "function") return Vj(t.toJSON()); switch (typeof t) { case "boolean": case "symbol": return t.toString(); case "bigint": return BigInt(t).toString(); case "number": return t.toString(); case "string": return JSON.stringify(t); case "object": { const e = Object.keys(t); return e.sort(), "{ " + e.map((M) => `${Vj(M)}: ${Vj(t[M])}`).join(", ") + " }"; } } return "[ COULD NOT SERIALIZE ]"; } function Wn(t, e) { return t && t.code === e; } function gd(t) { return Wn(t, "CALL_EXCEPTION"); } function sM(t, e, M) { { const i = []; if (M) { if ("message" in M || "code" in M || "name" in M) throw new Error(`value will overwrite populated values: ${Vj(M)}`); for (const u in M) { const a = M[u]; i.push(u + "=" + Vj(a)); } } i.push(`code=${e}`), i.push(`version=${CC}`), i.length && (t += " (" + i.join(", ") + ")"); } let n; switch (e) { case "INVALID_ARGUMENT": n = new TypeError(t); break; case "NUMERIC_FAULT": case "BUFFER_OVERRUN": n = new RangeError(t); break; default: n = new Error(t); } return _e(n, { code: e }), M && Object.assign(n, M), n; } function le(t, e, M, n) { if (!t) throw sM(e, M, n); } function J(t, e, M, n) { le(t, e, "INVALID_ARGUMENT", { argument: M, value: n }); } function bC(t, e, M) { M == null && (M = ""), M && (M = ": " + M), le(t >= e, "missing arguemnt" + M, "MISSING_ARGUMENT", { count: t, expectedCount: e }), le(t <= e, "too many arguemnts" + M, "UNEXPECTED_ARGUMENT", { count: t, expectedCount: e }); } const $Z = ["NFD", "NFC", "NFKD", "NFKC"].reduce((t, e) => { try { if ("test".normalize(e) !== "test") throw new Error("bad"); if (e === "NFD") { const M = String.fromCharCode(233).normalize("NFD"), n = String.fromCharCode(101, 769); if (M !== n) throw new Error("broken"); } t.push(e); } catch { } return t; }, []); function hC(t) { le($Z.indexOf(t) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { operation: "String.prototype.normalize", info: { form: t } }); } function Va(t, e, M) { if (M == null && (M = ""), t !== e) { let n = M, i = "new"; M && (n += ".", i += " " + M), le(!1, `private constructor; use ${n}from* methods`, "UNSUPPORTED_OPERATION", { operation: i }); } } function YC(t, e, M) { if (t instanceof Uint8Array) return M ? new Uint8Array(t) : t; if (typeof t == "string" && t.match(/^0x([0-9a-f][0-9a-f])*$/i)) { const n = new Uint8Array((t.length - 2) / 2); let i = 2; for (let u = 0; u < n.length; u++) n[u] = parseInt(t.substring(i, i + 2), 16), i += 2; return n; } J(!1, "invalid BytesLike value", e || "value", t); } function ke(t, e) { return YC(t, e, !1); } function YM(t, e) { return YC(t, e, !0); } function Zt(t, e) { return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || typeof e == "number" && t.length !== 2 + 2 * e || e === !0 && t.length % 2 !== 0); } function UC(t) { return Zt(t, !0) || t instanceof Uint8Array; } const Uw = "0123456789abcdef"; function me(t) { const e = ke(t); let M = "0x"; for (let n = 0; n < e.length; n++) { const i = e[n]; M += Uw[(i & 240) >> 4] + Uw[i & 15]; } return M; } function bt(t) { return "0x" + t.map((e) => me(e).substring(2)).join(""); } function Fr(t) { return Zt(t, !0) ? (t.length - 2) / 2 : ke(t).length; } function Pt(t, e, M) { const n = ke(t); return M != null && M > n.length && le(!1, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { buffer: n, length: n.length, offset: M }), me(n.slice(e ?? 0, M ?? n.length)); } function kC(t, e, M) { const n = ke(t); le(e >= n.length, "padding exceeds data length", "BUFFER_OVERRUN", { buffer: new Uint8Array(n), length: e, offset: e + 1 }); const i = new Uint8Array(e); return i.fill(0), M ? i.set(n, e - n.length) : i.set(n, 0), me(i); } function li(t, e) { return kC(t, e, !0); } function QC(t, e) { return kC(t, e, !1); } const kD = BigInt(0), Ii = BigInt(1), Fj = 9007199254740991; function Ny(t, e) { const M = QD(t, "value"), n = BigInt(nt(e, "width")); if (le(M >> n === kD, "overflow", "NUMERIC_FAULT", { operation: "fromTwos", fault: "overflow", value: t }), M >> n - Ii) { const i = (Ii << n) - Ii; return -((~M & i) + Ii); } return M; } function ld(t, e) { let M = Ve(t, "value"); const n = BigInt(nt(e, "width")), i = Ii << n - Ii; if (M < kD) { M = -M, le(M <= i, "too low", "NUMERIC_FAULT", { operation: "toTwos", fault: "overflow", value: t }); const u = (Ii << n) - Ii; return (~M & u) + Ii; } else le(M < i, "too high", "NUMERIC_FAULT", { operation: "toTwos", fault: "overflow", value: t }); return M; } function Tr(t, e) { const M = QD(t, "value"), n = BigInt(nt(e, "bits")); return M & (Ii << n) - Ii; } function Ve(t, e) { switch (typeof t) { case "bigint": return t; case "number": return J(Number.isInteger(t), "underflow", e || "value", t), J(t >= -Fj && t <= Fj, "overflow", e || "value", t), BigInt(t); case "string": try { if (t === "") throw new Error("empty string"); return t[0] === "-" && t[1] !== "-" ? -BigInt(t.substring(1)) : BigInt(t); } catch (M) { J(!1, `invalid BigNumberish string: ${M.message}`, e || "value", t); } } J(!1, "invalid BigNumberish value", e || "value", t); } function QD(t, e) { const M = Ve(t, e); return le(M >= kD, "unsigned value cannot be negative", "NUMERIC_FAULT", { fault: "overflow", operation: "getUint", value: t }), M; } const kw = "0123456789abcdef"; function pu(t) { if (t instanceof Uint8Array) { let e = "0x0"; for (const M of t) e += kw[M >> 4], e += kw[M & 15]; return BigInt(e); } return Ve(t); } function nt(t, e) { switch (typeof t) { case "bigint": return J(t >= -Fj && t <= Fj, "overflow", e || "value", t), Number(t); case "number": return J(Number.isInteger(t), "underflow", e || "value", t), J(t >= -Fj && t <= Fj, "overflow", e || "value", t), t; case "string": try { if (t === "") throw new Error("empty string"); return nt(BigInt(t), e); } catch (M) { J(!1, `invalid numeric string: ${M.message}`, e || "value", t); } } J(!1, "invalid numeric value", e || "value", t); } function KZ(t) { return nt(pu(t)); } function Hi(t, e) { let n = QD(t, "value").toString(16); if (e == null) n.length % 2 && (n = "0" + n); else { const i = nt(e, "width"); for (le(i * 2 >= n.length, `value exceeds width (${i} bits)`, "NUMERIC_FAULT", { operation: "toBeHex", fault: "overflow", value: t }); n.length < i * 2; ) n = "0" + n; } return "0x" + n; } function WM(t) { const e = QD(t, "value"); if (e === kD) return new Uint8Array([]); let M = e.toString(16); M.length % 2 && (M = "0" + M); const n = new Uint8Array(M.length / 2); for (let i = 0; i < n.length; i++) { const u = i * 2; n[i] = parseInt(M.substring(u, u + 2), 16); } return n; } function Hj(t) { let e = me(UC(t) ? t : WM(t)).substring(2); for (; e.startsWith("0"); ) e = e.substring(1); return e === "" && (e = "0"), "0x" + e; } const Wz = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; let PL = null; function qZ(t) { if (PL == null) { PL = {}; for (let M = 0; M < Wz.length; M++) PL[Wz[M]] = BigInt(M); } const e = PL[t]; return J(e != null, "invalid base58 value", "letter", t), e; } const e9 = BigInt(0), _z = BigInt(58); function vC(t) { let e = pu(ke(t)), M = ""; for (; e; ) M = Wz[Number(e % _z)] + M, e /= _z; return M; } function t9(t) { let e = e9; for (let M = 0; M < t.length; M++) e *= _z, e += qZ(t[M]); return e; } function M9(t) { t = atob(t); const e = new Uint8Array(t.length); for (let M = 0; M < t.length; M++) e[M] = t.charCodeAt(M); return ke(e); } function n9(t) { const e = ke(t); let M = ""; for (let n = 0; n < e.length; n++) M += String.fromCharCode(e[n]); return btoa(M); } var ls; class PC { /** * Create a new **EventPayload** for %%emitter%% with * the %%listener%% and for %%filter%%. */ constructor(e, M, n) { /** * The event filter. */ v(this, "filter"); /** * The **EventEmitterable**. */ v(this, "emitter"); Ne(this, ls, void 0); F(this, ls, M), _e(this, { emitter: e, filter: n }); } /** * Unregister the triggered listener for future events. */ async removeListener() { C(this, ls) != null && await this.emitter.off(this.filter, C(this, ls)); } } ls = new WeakMap(); function i9(t, e, M, n, i) { J(!1, `invalid codepoint at offset ${e}; ${t}`, "bytes", M); } function ZC(t, e, M, n, i) { if (t === "BAD_PREFIX" || t === "UNEXPECTED_CONTINUE") { let u = 0; for (let a = e + 1; a < M.length && M[a] >> 6 === 2; a++) u++; return u; } return t === "OVERRUN" ? M.length - e - 1 : 0; } function u9(t, e, M, n, i) { return t === "OVERLONG" ? (J(typeof i == "number", "invalid bad code point for replacement", "badCodepoint", i), n.push(i), 0) : (n.push(65533), ZC(t, e, M)); } const a9 = Object.freeze({ error: i9, ignore: ZC, replace: u9 }); function r9(t, e) { e == null && (e = a9.error); const M = ke(t, "bytes"), n = []; let i = 0; for (; i < M.length; ) { const u = M[i++]; if (!(u >> 7)) { n.push(u); continue; } let a = null, r = null; if ((u & 224) === 192) a = 1, r = 127; else if ((u & 240) === 224) a = 2, r = 2047; else if ((u & 248) === 240) a = 3, r = 65535; else { (u & 192) === 128 ? i += e("UNEXPECTED_CONTINUE", i - 1, M, n) : i += e("BAD_PREFIX", i - 1, M, n); continue; } if (i - 1 + a >= M.length) { i += e("OVERRUN", i - 1, M, n); continue; } let j = u & (1 << 8 - a - 1) - 1; for (let s = 0; s < a; s++) { let N = M[i]; if ((N & 192) != 128) { i += e("MISSING_CONTINUE", i, M, n), j = null; break; } j = j << 6 | N & 63, i++; } if (j !== null) { if (j > 1114111) { i += e("OUT_OF_RANGE", i - 1 - a, M, n, j); continue; } if (j >= 55296 && j <= 57343) { i += e("UTF16_SURROGATE", i - 1 - a, M, n, j); continue; } if (j <= r) { i += e("OVERLONG", i - 1 - a, M, n, j); continue; } n.push(j); } } return n; } function kM(t, e) { e != null && (hC(e), t = t.normalize(e)); let M = []; for (let n = 0; n < t.length; n++) { const i = t.charCodeAt(n); if (i < 128) M.push(i); else if (i < 2048) M.push(i >> 6 | 192), M.push(i & 63 | 128); else if ((i & 64512) == 55296) { n++; const u = t.charCodeAt(n); J(n < t.length && (u & 64512) === 56320, "invalid surrogate pair", "str", t); const a = 65536 + ((i & 1023) << 10) + (u & 1023); M.push(a >> 18 | 240), M.push(a >> 12 & 63 | 128), M.push(a >> 6 & 63 | 128), M.push(a & 63 | 128); } else M.push(i >> 12 | 224), M.push(i >> 6 & 63 | 128), M.push(i & 63 | 128); } return new Uint8Array(M); } function j9(t) { return t.map((e) => e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10 & 1023) + 55296, (e & 1023) + 56320))).join(""); } function zd(t, e) { return j9(r9(t, e)); } async function s9(t, e) { const M = t.url.split(":")[0].toLowerCase(); le(M === "http" || M === "https", `unsupported protocol ${M}`, "UNSUPPORTED_OPERATION", { info: { protocol: M }, operation: "request" }), le(M === "https" || !t.credentials || t.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { operation: "request" }); let n; if (e) { const s = new AbortController(); n = s.signal, e.addListener(() => { s.abort(); }); } const i = { method: t.method, headers: new Headers(Array.from(t)), body: t.body || void 0, signal: n }, u = await fetch(t.url, i), a = {}; u.headers.forEach((s, N) => { a[N.toLowerCase()] = s; }); const r = await u.arrayBuffer(), j = r == null ? null : new Uint8Array(r); return { statusCode: u.status, statusMessage: u.statusText, headers: a, body: j }; } const N9 = 12, o9 = 250; let Qw = s9; const c9 = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"), L9 = new RegExp("^ipfs://(ipfs/)?(.*)$", "i"); let Kg = !1; async function RC(t, e) { try { const M = t.match(c9); if (!M) throw new Error("invalid data"); return new ba(200, "OK", { "content-type": M[1] || "text/plain" }, M[2] ? M9(M[3]) : y9(M[3])); } catch { return new ba(599, "BAD REQUEST (invalid data: URI)", {}, null, new Uu(t)); } } function GC(t) { async function e(M, n) { try { const i = M.match(L9); if (!i) throw new Error("invalid link"); return new Uu(`${t}${i[2]}`); } catch { return new ba(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new Uu(M)); } } return e; } const ZL = { data: RC, ipfs: GC("https://gateway.ipfs.io/ipfs/") }, BC = /* @__PURE__ */ new WeakMap(); var wr, ca; class I9 { constructor(e) { Ne(this, wr, void 0); Ne(this, ca, void 0); F(this, wr, []), F(this, ca, !1), BC.set(e, () => { if (!C(this, ca)) { F(this, ca, !0); for (const M of C(this, wr)) setTimeout(() => { M(); }, 0); F(this, wr, []); } }); } addListener(e) { le(!C(this, ca), "singal already cancelled", "UNSUPPORTED_OPERATION", { operation: "fetchCancelSignal.addCancelListener" }), C(this, wr).push(e); } get cancelled() { return C(this, ca); } checkSignal() { le(!this.cancelled, "cancelled", "CANCELLED", {}); } } wr = new WeakMap(), ca = new WeakMap(); function RL(t) { if (t == null) throw new Error("missing signal; should not happen"); return t.checkSignal(), t; } var zs, Ts, ri, cu, As, ds, IM, Dn, Lu, pr, Or, fr, bi, Iu, mr, Bo; const ED = class ED { /** * Create a new FetchRequest instance with default values. * * Once created, each property may be set before issuing a * ``.send()`` to make the request. */ constructor(e) { Ne(this, mr); Ne(this, zs, void 0); Ne(this, Ts, void 0); Ne(this, ri, void 0); Ne(this, cu, void 0); Ne(this, As, void 0); Ne(this, ds, void 0); Ne(this, IM, void 0); Ne(this, Dn, void 0); Ne(this, Lu, void 0); // Hooks Ne(this, pr, void 0); Ne(this, Or, void 0); Ne(this, fr, void 0); Ne(this, bi, void 0); Ne(this, Iu, void 0); F(this, ds, String(e)), F(this, zs, !1), F(this, Ts, !0), F(this, ri, {}), F(this, cu, ""), F(this, As, 3e5), F(this, Iu, { slotInterval: o9, maxAttempts: N9 }); } /** * The fetch URI to requrest. */ get url() { return C(this, ds); } set url(e) { F(this, ds, String(e)); } /** * The fetch body, if any, to send as the request body. //(default: null)// * * When setting a body, the intrinsic ``Content-Type`` is automatically * set and will be used if **not overridden** by setting a custom * header. * * If %%body%% is null, the body is cleared (along with the * intrinsic ``Content-Type``) and the . * * If %%body%% is a string, the intrincis ``Content-Type`` is set to * ``text/plain``. * * If %%body%% is a Uint8Array, the intrincis ``Content-Type`` is set to * ``application/octet-stream``. * * If %%body%% is any other object, the intrincis ``Content-Type`` is * set to ``application/json``. */ get body() { return C(this, IM) == null ? null : new Uint8Array(C(this, IM)); } set body(e) { if (e == null) F(this, IM, void 0), F(this, Dn, void 0); else if (typeof e == "string") F(this, IM, kM(e)), F(this, Dn, "text/plain"); else if (e instanceof Uint8Array) F(this, IM, e), F(this, Dn, "application/octet-stream"); else if (typeof e == "object") F(this, IM, kM(JSON.stringify(e))), F(this, Dn, "application/json"); else throw new Error("invalid body"); } /** * Returns true if the request has a body. */ hasBody() { return C(this, IM) != null; } /** * The HTTP method to use when requesting the URI. If no method * has been explicitly set, then ``GET`` is used if the body is * null and ``POST`` otherwise. */ get method() { return C(this, cu) ? C(this, cu) : this.hasBody() ? "POST" : "GET"; } set method(e) { e == null && (e = ""), F(this, cu, String(e).toUpperCase()); } /** * The headers that will be used when requesting the URI. All * keys are lower-case. * * This object is a copy, so any chnages will **NOT** be reflected * in the ``FetchRequest``. * * To set a header entry, use the ``setHeader`` method. */ get headers() { const e = Object.assign({}, C(this, ri)); return C(this, Lu) && (e.authorization = `Basic ${n9(kM(C(this, Lu)))}`), this.allowGzip && (e["accept-encoding"] = "gzip"), e["content-type"] == null && C(this, Dn) && (e["content-type"] = C(this, Dn)), this.body && (e["content-length"] = String(this.body.length)), e; } /** * Get the header for %%key%%, ignoring case. */ getHeader(e) { return this.headers[e.toLowerCase()]; } /** * Set the header for %%key%% to %%value%%. All values are coerced * to a string. */ setHeader(e, M) { C(this, ri)[String(e).toLowerCase()] = String(M); } /** * Clear all headers, resetting all intrinsic headers. */ clearHeaders() { F(this, ri, {}); } [Symbol.iterator]() { const e = this.headers, M = Object.keys(e); let n = 0; return { next: () => { if (n < M.length) { const i = M[n++]; return { value: [i, e[i]], done: !1 }; } return { value: void 0, done: !0 }; } }; } /** * The value that will be sent for the ``Authorization`` header. * * To set the credentials, use the ``setCredentials`` method. */ get credentials() { return C(this, Lu) || null; } /** * Sets an ``Authorization`` for %%username%% with %%password%%. */ setCredentials(e, M) { J(!e.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"), F(this, Lu, `${e}:${M}`); } /** * Enable and request gzip-encoded responses. The response will * automatically be decompressed. //(default: true)// */ get allowGzip() { return C(this, Ts); } set allowGzip(e) { F(this, Ts, !!e); } /** * Allow ``Authentication`` credentials to be sent over insecure * channels. //(default: false)// */ get allowInsecureAuthentication() { return !!C(this, zs); } set allowInsecureAuthentication(e) { F(this, zs, !!e); } /** * The timeout (in milliseconds) to wait for a complere response. * //(default: 5 minutes)// */ get timeout() { return C(this, As); } set timeout(e) { J(e >= 0, "timeout must be non-zero", "timeout", e), F(this, As, e); } /** * This function is called prior to each request, for example * during a redirection or retry in case of server throttling. * * This offers an opportunity to populate headers or update * content before sending a request. */ get preflightFunc() { return C(this, pr) || null; } set preflightFunc(e) { F(this, pr, e); } /** * This function is called after each response, offering an * opportunity to provide client-level throttling or updating * response data. * * Any error thrown in this causes the ``send()`` to throw. * * To schedule a retry attempt (assuming the maximum retry limit * has not been reached), use [[response.throwThrottleError]]. */ get processFunc() { return C(this, Or) || null; } set processFunc(e) { F(this, Or, e); } /** * This function is called on each retry attempt. */ get retryFunc() { return C(this, fr) || null; } set retryFunc(e) { F(this, fr, e); } toString() { return `<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${C(this, IM) ? me(C(this, IM)) : "null"}>`; } /** * Update the throttle parameters used to determine maximum * attempts and exponential-backoff properties. */ setThrottleParams(e) { e.slotInterval != null && (C(this, Iu).slotInterval = e.slotInterval), e.maxAttempts != null && (C(this, Iu).maxAttempts = e.maxAttempts); } /** * Resolves to the response by sending the request. */ send() { return le(C(this, bi) == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }), F(this, bi, new I9(this)), de(this, mr, Bo).call(this, 0, vw() + this.timeout, 0, this, new ba(0, "", {}, null, this)); } /** * Cancels the inflight response, causing a ``CANCELLED`` * error to be rejected from the [[send]]. */ cancel() { le(C(this, bi) != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); const e = BC.get(this); if (!e) throw new Error("missing signal; should not happen"); e(); } /** * Returns a new [[FetchRequest]] that represents the redirection * to %%location%%. */ redirect(e) { const M = this.url.split(":")[0].toLowerCase(), n = e.split(":")[0].toLowerCase(); le(this.method === "GET" && (M !== "https" || n !== "http") && e.match(/^https?:/), "unsupported redirect", "UNSUPPORTED_OPERATION", { operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})` }); const i = new ED(e); return i.method = "GET", i.allowGzip = this.allowGzip, i.timeout = this.timeout, F(i, ri, Object.assign({}, C(this, ri))), C(this, IM) && F(i, IM, new Uint8Array(C(this, IM))), F(i, Dn, C(this, Dn)), i; } /** * Create a new copy of this request. */ clone() { const e = new ED(this.url); return F(e, cu, C(this, cu)), C(this, IM) && F(e, IM, C(this, IM)), F(e, Dn, C(this, Dn)), F(e, ri, Object.assign({}, C(this, ri))), F(e, Lu, C(this, Lu)), this.allowGzip && (e.allowGzip = !0), e.timeout = this.timeout, this.allowInsecureAuthentication && (e.allowInsecureAuthentication = !0), F(e, pr, C(this, pr)), F(e, Or, C(this, Or)), F(e, fr, C(this, fr)), e; } /** * Locks all static configuration for gateways and FetchGetUrlFunc * registration. */ static lockConfig() { Kg = !0; } /** * Get the current Gateway function for %%scheme%%. */ static getGateway(e) { return ZL[e.toLowerCase()] || null; } /** * Use the %%func%% when fetching URIs using %%scheme%%. * * This method affects all requests globally. * * If [[lockConfig]] has been called, no change is made and this * throws. */ static registerGateway(e, M) { if (e = e.toLowerCase(), e === "http" || e === "https") throw new Error(`cannot intercept ${e}; use registerGetUrl`); if (Kg) throw new Error("gateways locked"); ZL[e] = M; } /** * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. * * This method affects all requests globally. * * If [[lockConfig]] has been called, no change is made and this * throws. */ static registerGetUrl(e) { if (Kg) throw new Error("gateways locked"); Qw = e; } /** * Creates a function that can "fetch" data URIs. * * Note that this is automatically done internally to support * data URIs, so it is not necessary to register it. * * This is not generally something that is needed, but may * be useful in a wrapper to perfom custom data URI functionality. */ static createDataGateway() { return RC; } /** * Creates a function that will fetch IPFS (unvalidated) from * a custom gateway baseUrl. * * The default IPFS gateway used internally is * ``"https:/\/gateway.ipfs.io/ipfs/"``. */ static createIpfsGatewayFunc(e) { return GC(e); } }; zs = new WeakMap(), Ts = new WeakMap(), ri = new WeakMap(), cu = new WeakMap(), As = new WeakMap(), ds = new WeakMap(), IM = new WeakMap(), Dn = new WeakMap(), Lu = new WeakMap(), pr = new WeakMap(), Or = new WeakMap(), fr = new WeakMap(), bi = new WeakMap(), Iu = new WeakMap(), mr = new WeakSet(), Bo = async function(e, M, n, i, u) { var N, c, L; if (e >= C(this, Iu).maxAttempts) return u.makeServerError("exceeded maximum retry limit"); le(vw() <= M, "timeout", "TIMEOUT", { operation: "request.send", reason: "timeout", request: i }), n > 0 && await D9(n); let a = this.clone(); const r = (a.url.split(":")[0] || "").toLowerCase(); if (r in ZL) { const I = await ZL[r](a.url, RL(C(i, bi))); if (I instanceof ba) { let y = I; if (this.processFunc) { RL(C(i, bi)); try { y = await this.processFunc(a, y); } catch (D) { (D.throttle == null || typeof D.stall != "number") && y.makeServerError("error in post-processing function", D).assertOk(); } } return y; } a = I; } this.preflightFunc && (a = await this.preflightFunc(a)); const j = await Qw(a, RL(C(i, bi))); let s = new ba(j.statusCode, j.statusMessage, j.headers, j.body, i); if (s.statusCode === 301 || s.statusCode === 302) { try { const I = s.headers.location || ""; return de(N = a.redirect(I), mr, Bo).call(N, e + 1, M, 0, i, s); } catch { } return s; } else if (s.statusCode === 429 && (this.retryFunc == null || await this.retryFunc(a, s, e))) { const I = s.headers["retry-after"]; let y = C(this, Iu).slotInterval * Math.trunc(Math.random() * Math.pow(2, e)); return typeof I == "string" && I.match(/^[1-9][0-9]*$/) && (y = parseInt(I)), de(c = a.clone(), mr, Bo).call(c, e + 1, M, y, i, s); } if (this.processFunc) { RL(C(i, bi)); try { s = await this.processFunc(a, s); } catch (I) { (I.throttle == null || typeof I.stall != "number") && s.makeServerError("error in post-processing function", I).assertOk(); let y = C(this, Iu).slotInterval * Math.trunc(Math.random() * Math.pow(2, e)); return I.stall >= 0 && (y = I.stall), de(L = a.clone(), mr, Bo).call(L, e + 1, M, y, i, s); } } return s; }; let Uu = ED; var c4, L4, I4, ji, Ss, Cr; const Dw = class Dw { constructor(e, M, n, i, u) { Ne(this, c4, void 0); Ne(this, L4, void 0); Ne(this, I4, void 0); Ne(this, ji, void 0); Ne(this, Ss, void 0); Ne(this, Cr, void 0); F(this, c4, e), F(this, L4, M), F(this, I4, Object.keys(n).reduce((a, r) => (a[r.toLowerCase()] = String(n[r]), a), {})), F(this, ji, i == null ? null : new Uint8Array(i)), F(this, Ss, u || null), F(this, Cr, { message: "" }); } toString() { return `<FetchResponse status=${this.statusCode} body=${C(this, ji) ? me(C(this, ji)) : "null"}>`; } /** * The response status code. */ get statusCode() { return C(this, c4); } /** * The response status message. */ get statusMessage() { return C(this, L4); } /** * The response headers. All keys are lower-case. */ get headers() { return Object.assign({}, C(this, I4)); } /** * The response body, or ``null`` if there was no body. */ get body() { return C(this, ji) == null ? null : new Uint8Array(C(this, ji)); } /** * The response body as a UTF-8 encoded string, or the empty * string (i.e. ``""``) if there was no body. * * An error is thrown if the body is invalid UTF-8 data. */ get bodyText() { try { return C(this, ji) == null ? "" : zd(C(this, ji)); } catch { le(!1, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { operation: "bodyText", info: { response: this } }); } } /** * The response body, decoded as JSON. * * An error is thrown if the body is invalid JSON-encoded data * or if there was no body. */ get bodyJson() { try { return JSON.parse(this.bodyText); } catch { le(!1, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { operation: "bodyJson", info: { r