UNPKG

hypersync-query-builder-component

Version:

React component for building HyperSync blockchain queries with an intuitive UI

1,437 lines (1,435 loc) 177 kB
import * as W from "react"; import ht from "react"; function $t(r, a) { return r > a ? r : a; } function Le(r) { return r === void 0 ? { BS_PRIVATE_NESTED_SOME_NONE: 0 } : r !== null && r.BS_PRIVATE_NESTED_SOME_NONE !== void 0 ? { BS_PRIVATE_NESTED_SOME_NONE: r.BS_PRIVATE_NESTED_SOME_NONE + 1 | 0 } : r; } function Pe(r) { if (r === null || r.BS_PRIVATE_NESTED_SOME_NONE === void 0) return r; let a = r.BS_PRIVATE_NESTED_SOME_NONE; if (a !== 0) return { BS_PRIVATE_NESTED_SOME_NONE: a - 1 | 0 }; } function nt(r, a) { if (a >= 0 && a < r.length) return Le(r[a]); } function zt(r, a) { if (r <= 0) return []; let t = new Array(r); for (let s = 0; s < r; ++s) t[s] = a(s); return t; } function Ht(r, a) { let t = a - r | 0, s = new Array(t + 1 | 0); for (let u = 0; u <= t; ++u) s[u] = r + u | 0; return s; } function ce(r, a) { let t = r.length, s = new Array(t), u = 0; for (let o = 0; o < t; ++o) { let g = r[o]; a(g, o) && (s[u] = g, u = u + 1 | 0); } return s.length = u, s; } function Wt(r, a, t) { return r.reduce(t, a); } function be(r, a) { let t = r.length, s = new Array(t), u = 0; for (let o = 0; o < t; ++o) { let g = r[o], b = a(g); b !== void 0 && (s[u] = Pe(b), u = u + 1 | 0); } return s.length = u, s; } function pe(r, a) { let t = parseInt(r); if (!(isNaN(t) || t > 2147483647 || t < -2147483648)) return t | 0; } let Gt = "JsExn"; function rt(r, a) { if (r !== void 0) return Le(a(Pe(r))); } function ve(r, a) { if (r !== void 0) return a(Pe(r)); } function m(r, a) { return r !== void 0 ? Pe(r) : a; } function Fe(r) { return r !== void 0; } function ft(r) { return r === void 0; } var Ce = { exports: {} }, we = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var at; function Vt() { if (at) return we; at = 1; var r = ht, a = Symbol.for("react.element"), t = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, u = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 }; function g(b, y, l) { var h, i = {}, d = null, c = null; l !== void 0 && (d = "" + l), y.key !== void 0 && (d = "" + y.key), y.ref !== void 0 && (c = y.ref); for (h in y) s.call(y, h) && !o.hasOwnProperty(h) && (i[h] = y[h]); if (b && b.defaultProps) for (h in y = b.defaultProps, y) i[h] === void 0 && (i[h] = y[h]); return { $$typeof: a, type: b, key: d, ref: c, props: i, _owner: u.current }; } return we.Fragment = t, we.jsx = g, we.jsxs = g, we; } var Be = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var it; function Jt() { return it || (it = 1, process.env.NODE_ENV !== "production" && function() { var r = ht, a = Symbol.for("react.element"), t = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), b = Symbol.for("react.context"), y = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), i = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), c = Symbol.for("react.offscreen"), f = Symbol.iterator, k = "@@iterator"; function A(n) { if (n === null || typeof n != "object") return null; var x = f && n[f] || n[k]; return typeof x == "function" ? x : null; } var p = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function _(n) { { for (var x = arguments.length, N = new Array(x > 1 ? x - 1 : 0), w = 1; w < x; w++) N[w - 1] = arguments[w]; S("error", n, N); } } function S(n, x, N) { { var w = p.ReactDebugCurrentFrame, $ = w.getStackAddendum(); $ !== "" && (x += "%s", N = N.concat([$])); var H = N.map(function(P) { return String(P); }); H.unshift("Warning: " + x), Function.prototype.apply.call(console[n], console, H); } } var G = !1, q = !1, K = !1, Q = !1, j = !1, C; C = Symbol.for("react.module.reference"); function T(n) { return !!(typeof n == "string" || typeof n == "function" || n === s || n === o || j || n === u || n === l || n === h || Q || n === c || G || q || K || typeof n == "object" && n !== null && (n.$$typeof === d || n.$$typeof === i || n.$$typeof === g || n.$$typeof === b || n.$$typeof === y || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. n.$$typeof === C || n.getModuleId !== void 0)); } function E(n, x, N) { var w = n.displayName; if (w) return w; var $ = x.displayName || x.name || ""; return $ !== "" ? N + "(" + $ + ")" : N; } function B(n) { return n.displayName || "Context"; } function R(n) { if (n == null) return null; if (typeof n.tag == "number" && _("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof n == "function") return n.displayName || n.name || null; if (typeof n == "string") return n; switch (n) { case s: return "Fragment"; case t: return "Portal"; case o: return "Profiler"; case u: return "StrictMode"; case l: return "Suspense"; case h: return "SuspenseList"; } if (typeof n == "object") switch (n.$$typeof) { case b: var x = n; return B(x) + ".Consumer"; case g: var N = n; return B(N._context) + ".Provider"; case y: return E(n, n.render, "ForwardRef"); case i: var w = n.displayName || null; return w !== null ? w : R(n.type) || "Memo"; case d: { var $ = n, H = $._payload, P = $._init; try { return R(P(H)); } catch { return null; } } } return null; } var M = Object.assign, O = 0, z, ee, Z, te, ne, de, ue; function fe() { } fe.__reactDisabledLog = !0; function xe() { { if (O === 0) { z = console.log, ee = console.info, Z = console.warn, te = console.error, ne = console.group, de = console.groupCollapsed, ue = console.groupEnd; var n = { configurable: !0, enumerable: !0, value: fe, writable: !0 }; Object.defineProperties(console, { info: n, log: n, warn: n, error: n, group: n, groupCollapsed: n, groupEnd: n }); } O++; } } function I() { { if (O--, O === 0) { var n = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: M({}, n, { value: z }), info: M({}, n, { value: ee }), warn: M({}, n, { value: Z }), error: M({}, n, { value: te }), group: M({}, n, { value: ne }), groupCollapsed: M({}, n, { value: de }), groupEnd: M({}, n, { value: ue }) }); } O < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var v = p.ReactCurrentDispatcher, L; function V(n, x, N) { { if (L === void 0) try { throw Error(); } catch ($) { var w = $.stack.trim().match(/\n( *(at )?)/); L = w && w[1] || ""; } return ` ` + L + n; } } var J = !1, D; { var le = typeof WeakMap == "function" ? WeakMap : Map; D = new le(); } function X(n, x) { if (!n || J) return ""; { var N = D.get(n); if (N !== void 0) return N; } var w; J = !0; var $ = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var H; H = v.current, v.current = null, xe(); try { if (x) { var P = function() { throw Error(); }; if (Object.defineProperty(P.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(P, []); } catch (ie) { w = ie; } Reflect.construct(n, [], P); } else { try { P.call(); } catch (ie) { w = ie; } n.call(P.prototype); } } else { try { throw Error(); } catch (ie) { w = ie; } n(); } } catch (ie) { if (ie && w && typeof ie.stack == "string") { for (var F = ie.stack.split(` `), se = w.stack.split(` `), U = F.length - 1, Y = se.length - 1; U >= 1 && Y >= 0 && F[U] !== se[Y]; ) Y--; for (; U >= 1 && Y >= 0; U--, Y--) if (F[U] !== se[Y]) { if (U !== 1 || Y !== 1) do if (U--, Y--, Y < 0 || F[U] !== se[Y]) { var oe = ` ` + F[U].replace(" at new ", " at "); return n.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", n.displayName)), typeof n == "function" && D.set(n, oe), oe; } while (U >= 1 && Y >= 0); break; } } } finally { J = !1, v.current = H, I(), Error.prepareStackTrace = $; } var ke = n ? n.displayName || n.name : "", Ne = ke ? V(ke) : ""; return typeof n == "function" && D.set(n, Ne), Ne; } function re(n, x, N) { return X(n, !1); } function ye(n) { var x = n.prototype; return !!(x && x.isReactComponent); } function ge(n, x, N) { if (n == null) return ""; if (typeof n == "function") return X(n, ye(n)); if (typeof n == "string") return V(n); switch (n) { case l: return V("Suspense"); case h: return V("SuspenseList"); } if (typeof n == "object") switch (n.$$typeof) { case y: return re(n.render); case i: return ge(n.type, x, N); case d: { var w = n, $ = w._payload, H = w._init; try { return ge(H($), x, N); } catch { } } } return ""; } var he = Object.prototype.hasOwnProperty, Ee = {}, me = p.ReactDebugCurrentFrame; function ae(n) { if (n) { var x = n._owner, N = ge(n.type, n._source, x ? x.type : null); me.setExtraStackFrame(N); } else me.setExtraStackFrame(null); } function bt(n, x, N, w, $) { { var H = Function.call.bind(he); for (var P in n) if (H(n, P)) { var F = void 0; try { if (typeof n[P] != "function") { var se = Error((w || "React class") + ": " + N + " type `" + P + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof n[P] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw se.name = "Invariant Violation", se; } F = n[P](x, P, w, N, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (U) { F = U; } F && !(F instanceof Error) && (ae($), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", w || "React class", N, P, typeof F), ae(null)), F instanceof Error && !(F.message in Ee) && (Ee[F.message] = !0, ae($), _("Failed %s type: %s", N, F.message), ae(null)); } } } var yt = Array.isArray; function Me(n) { return yt(n); } function Nt(n) { { var x = typeof Symbol == "function" && Symbol.toStringTag, N = x && n[Symbol.toStringTag] || n.constructor.name || "Object"; return N; } } function jt(n) { try { return Ve(n), !1; } catch { return !0; } } function Ve(n) { return "" + n; } function Je(n) { if (jt(n)) return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Nt(n)), Ve(n); } var Ue = p.ReactCurrentOwner, kt = { key: !0, ref: !0, __self: !0, __source: !0 }, Qe, Ye; function vt(n) { if (he.call(n, "ref")) { var x = Object.getOwnPropertyDescriptor(n, "ref").get; if (x && x.isReactWarning) return !1; } return n.ref !== void 0; } function _t(n) { if (he.call(n, "key")) { var x = Object.getOwnPropertyDescriptor(n, "key").get; if (x && x.isReactWarning) return !1; } return n.key !== void 0; } function St(n, x) { typeof n.ref == "string" && Ue.current; } function Tt(n, x) { { var N = function() { Qe || (Qe = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", x)); }; N.isReactWarning = !0, Object.defineProperty(n, "key", { get: N, configurable: !0 }); } } function Et(n, x) { { var N = function() { Ye || (Ye = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", x)); }; N.isReactWarning = !0, Object.defineProperty(n, "ref", { get: N, configurable: !0 }); } } var wt = function(n, x, N, w, $, H, P) { var F = { // This tag allows us to uniquely identify this as a React Element $$typeof: a, // Built-in properties that belong on the element type: n, key: x, ref: N, props: P, // Record the component responsible for creating this element. _owner: H }; return F._store = {}, Object.defineProperty(F._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(F, "_self", { configurable: !1, enumerable: !1, writable: !1, value: w }), Object.defineProperty(F, "_source", { configurable: !1, enumerable: !1, writable: !1, value: $ }), Object.freeze && (Object.freeze(F.props), Object.freeze(F)), F; }; function Bt(n, x, N, w, $) { { var H, P = {}, F = null, se = null; N !== void 0 && (Je(N), F = "" + N), _t(x) && (Je(x.key), F = "" + x.key), vt(x) && (se = x.ref, St(x, $)); for (H in x) he.call(x, H) && !kt.hasOwnProperty(H) && (P[H] = x[H]); if (n && n.defaultProps) { var U = n.defaultProps; for (H in U) P[H] === void 0 && (P[H] = U[H]); } if (F || se) { var Y = typeof n == "function" ? n.displayName || n.name || "Unknown" : n; F && Tt(P, Y), se && Et(P, Y); } return wt(n, F, se, $, w, Ue.current, P); } } var De = p.ReactCurrentOwner, qe = p.ReactDebugCurrentFrame; function je(n) { if (n) { var x = n._owner, N = ge(n.type, n._source, x ? x.type : null); qe.setExtraStackFrame(N); } else qe.setExtraStackFrame(null); } var Ie; Ie = !1; function $e(n) { return typeof n == "object" && n !== null && n.$$typeof === a; } function Ke() { { if (De.current) { var n = R(De.current.type); if (n) return ` Check the render method of \`` + n + "`."; } return ""; } } function At(n) { return ""; } var Ze = {}; function Lt(n) { { var x = Ke(); if (!x) { var N = typeof n == "string" ? n : n.displayName || n.name; N && (x = ` Check the top-level render call using <` + N + ">."); } return x; } } function Xe(n, x) { { if (!n._store || n._store.validated || n.key != null) return; n._store.validated = !0; var N = Lt(x); if (Ze[N]) return; Ze[N] = !0; var w = ""; n && n._owner && n._owner !== De.current && (w = " It was passed a child from " + R(n._owner.type) + "."), je(n), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', N, w), je(null); } } function et(n, x) { { if (typeof n != "object") return; if (Me(n)) for (var N = 0; N < n.length; N++) { var w = n[N]; $e(w) && Xe(w, x); } else if ($e(n)) n._store && (n._store.validated = !0); else if (n) { var $ = A(n); if (typeof $ == "function" && $ !== n.entries) for (var H = $.call(n), P; !(P = H.next()).done; ) $e(P.value) && Xe(P.value, x); } } } function Ct(n) { { var x = n.type; if (x == null || typeof x == "string") return; var N; if (typeof x == "function") N = x.propTypes; else if (typeof x == "object" && (x.$$typeof === y || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. x.$$typeof === i)) N = x.propTypes; else return; if (N) { var w = R(x); bt(N, n.props, "prop", w, n); } else if (x.PropTypes !== void 0 && !Ie) { Ie = !0; var $ = R(x); _("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", $ || "Unknown"); } typeof x.getDefaultProps == "function" && !x.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function Rt(n) { { for (var x = Object.keys(n.props), N = 0; N < x.length; N++) { var w = x[N]; if (w !== "children" && w !== "key") { je(n), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", w), je(null); break; } } n.ref !== null && (je(n), _("Invalid attribute `ref` supplied to `React.Fragment`."), je(null)); } } var tt = {}; function st(n, x, N, w, $, H) { { var P = T(n); if (!P) { var F = ""; (n === void 0 || typeof n == "object" && n !== null && Object.keys(n).length === 0) && (F += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var se = At(); se ? F += se : F += Ke(); var U; n === null ? U = "null" : Me(n) ? U = "array" : n !== void 0 && n.$$typeof === a ? (U = "<" + (R(n.type) || "Unknown") + " />", F = " Did you accidentally export a JSX literal instead of a component?") : U = typeof n, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", U, F); } var Y = Bt(n, x, N, $, H); if (Y == null) return Y; if (P) { var oe = x.children; if (oe !== void 0) if (w) if (Me(oe)) { for (var ke = 0; ke < oe.length; ke++) et(oe[ke], n); Object.freeze && Object.freeze(oe); } else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else et(oe, n); } if (he.call(x, "key")) { var Ne = R(n), ie = Object.keys(x).filter(function(It) { return It !== "key"; }), ze = ie.length > 0 ? "{key: someKey, " + ie.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!tt[Ne + ze]) { var Dt = ie.length > 0 ? "{" + ie.join(": ..., ") + ": ...}" : "{}"; _(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, ze, Ne, Dt, Ne), tt[Ne + ze] = !0; } } return n === s ? Rt(Y) : Ct(Y), Y; } } function Ot(n, x, N) { return st(n, x, N, !0); } function Ft(n, x, N) { return st(n, x, N, !1); } var Pt = Ft, Mt = Ot; Be.Fragment = s, Be.jsx = Pt, Be.jsxs = Mt; }()), Be; } var lt; function Ut() { return lt || (lt = 1, process.env.NODE_ENV === "production" ? Ce.exports = Vt() : Ce.exports = Jt()), Ce.exports; } var e = Ut(); function xt(r) { let a = m(r.hash, []), t = m(r.miner, []); if (!(a.length > 0 || t.length > 0)) return "No filters applied - will match all blocks"; let u = []; if (a.length > 0) { let o; a.length === 1 ? o = "the block hash is " + a[0] : o = "the block hash is " + a.join(" OR "), u.push(o); } if (t.length > 0) { let o; t.length === 1 ? o = "the miner address is " + t[0] : o = "the miner address is " + t.join(" OR "), u.push(o); } return u.length > 0 ? "Match blocks where: " + u.join(" AND ") : "No filters applied - will match all blocks"; } function He(r) { let a = m(r.hash, []), t = m(r.miner, []); if (!(a.length > 0 || t.length > 0)) return "No filters"; let u = [], o = []; a.length > 0 && o.push("hash"), t.length > 0 && o.push("miner"); let g = o.length > 1; g && u.push("AND"); let b = 0; if (a.length > 0) { let y = b === (o.length - 1 | 0), l = g ? y ? "└── " : "├── " : ""; a.length === 1 ? u.push(l + "hash = " + a[0]) : (u.push(l + "OR (hash)"), a.forEach((h, i) => { let d = i === (a.length - 1 | 0), c = g ? y ? d ? " └── " : " ├── " : d ? "│ └── " : "│ ├── " : d ? "└── " : "├── "; u.push(c + h); })), b = b + 1 | 0; } if (t.length > 0) { let y = g ? "└── " : ""; t.length === 1 ? u.push(y + "miner = " + t[0]) : (u.push(y + "OR (miner)"), t.forEach((l, h) => { let i = h === (t.length - 1 | 0), d = g ? i ? " └── " : " ├── " : i ? "└── " : "├── "; u.push(d + l); })); } return u.join(` `); } function gt(r) { let a = r.status, t = m(r.from_, []), s = m(r.to_, []), u = m(r.sighash, []), o = m(r.kind, []), g = m(r.contractAddress, []), b = m(r.authorizationList, []); if (!(t.length > 0 || s.length > 0 || u.length > 0 || Fe(a) || o.length > 0 || g.length > 0 || b.length > 0)) return "No filters applied - will match all transactions"; let l = []; if (t.length > 0) { let h; t.length === 1 ? h = "the sender address is " + t[0] : h = "the sender address is " + t.join(" OR "), l.push(h); } if (s.length > 0) { let h; s.length === 1 ? h = "the recipient address is " + s[0] : h = "the recipient address is " + s.join(" OR "), l.push(h); } if (u.length > 0) { let h; u.length === 1 ? h = "the function signature is " + u[0] : h = "the function signature is " + u.join(" OR "), l.push(h); } if (a !== void 0) { let h = a === 1 ? "successful" : "failed"; l.push("the transaction is " + h); } if (o.length > 0) { let h; if (o.length === 1) h = "the transaction kind is " + o[0].toString(); else { let i = o.length, d; switch (i) { case 0: d = ""; break; case 1: d = o[0].toString(); break; case 2: d = o[0].toString() + " OR " + o[1].toString(); break; default: let c = o[0].toString(), f = o[1].toString(), k = o.slice(2), A = Wt(k, "", (p, _) => p + " OR " + _.toString()); d = c + " OR " + f + A; } h = "the transaction kind is " + d; } l.push(h); } if (g.length > 0) { let h; g.length === 1 ? h = "the contract address is " + g[0] : h = "the contract address is " + g.join(" OR "), l.push(h); } if (b.length > 0) { let h = b.length === 1 ? "the authorization list includes " + b.length.toString() + " authorization" : "the authorization list includes " + b.length.toString() + " authorizations"; l.push(h); } return l.length > 0 ? "Match transactions where: " + l.join(" AND ") : "No filters applied - will match all transactions"; } function We(r) { let a = r.status, t = m(r.from_, []), s = m(r.to_, []), u = m(r.sighash, []), o = m(r.kind, []), g = m(r.contractAddress, []), b = m(r.authorizationList, []); if (!(t.length > 0 || s.length > 0 || u.length > 0 || Fe(a) || o.length > 0 || g.length > 0 || b.length > 0)) return "No filters"; let l = [], h = []; t.length > 0 && h.push("from"), s.length > 0 && h.push("to"), u.length > 0 && h.push("sighash"), Fe(a) && h.push("status"), o.length > 0 && h.push("kind"), g.length > 0 && h.push("contractAddress"), b.length > 0 && h.push("authorizationList"); let i = h.length > 1; i && l.push("AND"); let d = 0; if (t.length > 0) { let c = d === (h.length - 1 | 0), f = i ? c ? "└── " : "├── " : ""; t.length === 1 ? l.push(f + "from = " + t[0]) : (l.push(f + "OR (from)"), t.forEach((k, A) => { let p = A === (t.length - 1 | 0), _ = i ? c ? p ? " └── " : " ├── " : p ? "│ └── " : "│ ├── " : p ? "└── " : "├── "; l.push(_ + k); })), d = d + 1 | 0; } if (s.length > 0) { let c = d === (h.length - 1 | 0), f = i ? c ? "└── " : "├── " : ""; s.length === 1 ? l.push(f + "to = " + s[0]) : (l.push(f + "OR (to)"), s.forEach((k, A) => { let p = A === (s.length - 1 | 0), _ = i ? c ? p ? " └── " : " ├── " : p ? "│ └── " : "│ ├── " : p ? "└── " : "├── "; l.push(_ + k); })), d = d + 1 | 0; } if (u.length > 0) { let c = d === (h.length - 1 | 0), f = i ? c ? "└── " : "├── " : ""; u.length === 1 ? l.push(f + "sighash = " + u[0]) : (l.push(f + "OR (sighash)"), u.forEach((k, A) => { let p = A === (u.length - 1 | 0), _ = i ? c ? p ? " └── " : " ├── " : p ? "│ └── " : "│ ├── " : p ? "└── " : "├── "; l.push(_ + k); })), d = d + 1 | 0; } if (a !== void 0) { let c = d === (h.length - 1 | 0), f = i ? c ? "└── " : "├── " : "", k = a === 1 ? "success" : "failed"; l.push(f + "status = " + a.toString() + " (" + k + ")"), d = d + 1 | 0; } if (o.length > 0) { let c = d === (h.length - 1 | 0), f = i ? c ? "└── " : "├── " : ""; o.length === 1 ? l.push(f + "kind = " + o[0].toString()) : (l.push(f + "OR (kind)"), o.forEach((k, A) => { let p = A === (o.length - 1 | 0), _ = i ? c ? p ? " └── " : " ├── " : p ? "│ └── " : "│ ├── " : p ? "└── " : "├── "; l.push(_ + k.toString()); })), d = d + 1 | 0; } if (g.length > 0) { let c = d === (h.length - 1 | 0), f = i ? c ? "└── " : "├── " : ""; g.length === 1 ? l.push(f + "contractAddress = " + g[0]) : (l.push(f + "OR (contractAddress)"), g.forEach((k, A) => { let p = A === (g.length - 1 | 0), _ = i ? c ? p ? " └── " : " ├── " : p ? "│ └── " : "│ ├── " : p ? "└── " : "├── "; l.push(_ + k); })), d = d + 1 | 0; } if (b.length > 0) { let c = d === (h.length - 1 | 0), f = i ? c ? "└── " : "├── " : ""; b.length === 1 ? l.push(f + "authorizationList has " + b.length.toString() + " authorization") : l.push(f + "authorizationList has " + b.length.toString() + " authorizations"), d = d + 1 | 0; } return l.join(` `); } function _e(r) { let a = m(r.address, []), t = m(r.topics, []); return a.length === 0 ? t.length === 0 : !1; } function Se(r) { let a = m(r.from_, []), t = m(r.to_, []), s = m(r.sighash, []), u = m(r.kind, []), o = m(r.contractAddress, []), g = m(r.authorizationList, []); return a.length === 0 && t.length === 0 && s.length === 0 && ft(r.status) && u.length === 0 && o.length === 0 ? g.length === 0 : !1; } function Te(r) { let a = m(r.hash, []), t = m(r.miner, []); return a.length === 0 ? t.length === 0 : !1; } function Qt(r) { let a = m(r.address, []), t = m(r.topics, []), s = []; if (a.length > 0) { let o; a.length === 1 ? o = "the contract address is " + a[0] : o = "the contract address is " + a.join(" OR "), s.push(o); } let u = []; if (t.forEach((o, g) => { if (o.length <= 0) return; let b; if (o.length === 1) b = "topic[" + g.toString() + "] is " + o[0]; else { let y = o.join(" OR "); b = "topic[" + g.toString() + "] is " + y; } u.push(b); }), u.length > 0) { let o = u.join(" AND "); s.push(o); } return s.join(" AND "); } function Yt(r) { let a = gt(r); return a.startsWith("Match transactions where: ") ? a.slice(26) : a; } function qt(r) { let a = xt(r); return a.startsWith("Match blocks where: ") ? a.slice(20) : a; } function Kt(r) { if (r === void 0 || r.length === 0) return "selecting None"; if (r.length === 1 && _e(r[0])) return "selecting ALL"; let a = r.map((t) => { if (_e(t)) return "ALL logs"; let s = Qt(t); return s.includes(" AND ") ? "(" + s + ")" : s; }).filter((t) => t !== ""); return a.length === 0 ? "selecting None" : "Match logs where: " + a.join(" OR "); } function Zt(r) { if (r === void 0 || r.length === 0) return "selecting None"; if (r.length === 1 && Se(r[0])) return "selecting ALL"; let a = r.map((t) => { if (Se(t)) return "ALL transactions"; let s = Yt(t); return s.includes(" AND ") ? "(" + s + ")" : s; }).filter((t) => t !== ""); return a.length === 0 ? "selecting None" : "Match transactions where: " + a.join(" OR "); } function Xt(r) { if (r === void 0 || r.length === 0) return "selecting None"; if (r.length === 1 && Te(r[0])) return "selecting ALL"; let a = r.map((t) => { if (Te(t)) return "ALL blocks"; let s = qt(t); return s.includes(" AND ") ? "(" + s + ")" : s; }).filter((t) => t !== ""); return a.length === 0 ? "selecting None" : "Match blocks where: " + a.join(" OR "); } function es(r) { let a = m(r.address, []), t = m(r.topics, []); if (a.length === 0 && t.length === 0) return "No filters applied - will match all logs"; let s = []; if (a.length > 0) { let o; a.length === 1 ? o = "the contract address is " + a[0] : o = "the contract address is " + a.join(" OR "), s.push(o); } let u = []; if (t.forEach((o, g) => { if (o.length <= 0) return; let b; if (o.length === 1) b = "topic[" + g.toString() + "] is " + o[0]; else { let y = o.join(" OR "); b = "topic[" + g.toString() + "] is " + y; } u.push(b); }), u.length > 0) { let o = u.join(" AND "); s.push(o); } return s.length > 0 ? "Match logs where: " + s.join(" AND ") : "No filters applied - will match all logs"; } function Ge(r) { let a = m(r.address, []), t = m(r.topics, []); if (a.length === 0 && t.length === 0) return "No filters"; let s = [], u = a.length > 0 && t.some((g) => g.length > 0); if (u && s.push("AND"), a.length > 0) { let g = u ? "├── " : ""; a.length === 1 ? s.push(g + "address = " + a[0]) : (s.push(g + "OR (address)"), a.forEach((b, y) => { let l = y === (a.length - 1 | 0), h = u ? l ? "│ └── " : "│ ├── " : l ? "└── " : "├── "; s.push(h + b); })); } let o = be(t, (g) => { if (g.length > 0) return g; }); if (o.length > 0) { let g = o.length > 1, b = u ? "└── " : ""; g && s.push(b + "AND (topics)"); let y = { contents: 0 }; t.forEach((l, h) => { if (l.length <= 0) return; let i = y.contents === (o.length - 1 | 0), d = u ? g ? i ? " └── " : " ├── " : "└── " : g ? i ? "└── " : "├── " : ""; l.length === 1 ? s.push(d + "topic[" + h.toString() + "] = " + l[0]) : (s.push(d + "OR (topic[" + h.toString() + "])"), l.forEach((c, f) => { let k = f === (l.length - 1 | 0), A = u ? g ? i ? k ? " └── " : " ├── " : k ? " │ └── " : " │ ├── " : k ? "└── " : "├── " : g ? i ? k ? " └── " : " ├── " : k ? "│ └── " : "│ ├── " : k ? "└── " : "├── "; s.push(A + c); })), y.contents = y.contents + 1 | 0; }); } return s.join(` `); } function ts(r) { if (r === void 0 || r.length === 0) return "No filters"; if (r.length === 1 && _e(r[0])) return "All logs"; let a = r.filter((o) => !_e(o)), t = r.some(_e); if (a.length === 0 && t) return "All logs"; if (a.length === 1 && !t) return Ge(a[0]); let s = []; s.push("OR"); let u = t ? a.concat([{ address: void 0, topics: void 0 }]) : a; return u.forEach((o, g) => { let b = g === (u.length - 1 | 0), y = b ? "└── " : "├── "; if (_e(o)) { s.push(y + "All logs"); return; } let l = Ge(o); if (l.includes(` `)) { l.split(` `).forEach((i, d) => { if (d === 0) { s.push(y + i); return; } let c = b ? " " : "│ "; s.push(c + i); }); return; } s.push(y + l); }), s.join(` `); } function ss(r) { if (r === void 0 || r.length === 0) return "No filters"; if (r.length === 1 && Se(r[0])) return "All transactions"; let a = r.filter((o) => !Se(o)), t = r.some(Se); if (a.length === 0 && t) return "All transactions"; if (a.length === 1 && !t) return We(a[0]); let s = []; s.push("OR"); let u = t ? a.concat([{ from_: void 0, to_: void 0, sighash: void 0, status: void 0, kind: void 0, contractAddress: void 0, authorizationList: void 0 }]) : a; return u.forEach((o, g) => { let b = g === (u.length - 1 | 0), y = b ? "└── " : "├── "; if (Se(o)) { s.push(y + "All transactions"); return; } let l = We(o); if (l.includes(` `)) { l.split(` `).forEach((i, d) => { if (d === 0) { s.push(y + i); return; } let c = b ? " " : "│ "; s.push(c + i); }); return; } s.push(y + l); }), s.join(` `); } function ns(r) { if (r === void 0 || r.length === 0) return "No filters"; if (r.length === 1 && Te(r[0])) return "All blocks"; let a = r.filter((o) => !Te(o)), t = r.some(Te); if (a.length === 0 && t) return "All blocks"; if (a.length === 1 && !t) return He(a[0]); let s = []; s.push("OR"); let u = t ? a.concat([{ hash: void 0, miner: void 0 }]) : a; return u.forEach((o, g) => { let b = g === (u.length - 1 | 0), y = b ? "└── " : "├── "; if (Te(o)) { s.push(y + "All blocks"); return; } let l = He(o); if (l.includes(` `)) { l.split(` `).forEach((i, d) => { if (d === 0) { s.push(y + i); return; } let c = b ? " " : "│ "; s.push(c + i); }); return; } s.push(y + l); }), s.join(` `); } function rs(r) { let a = r.onRemove, t = r.onFilterChange, s = r.filterState, u = W.useState(() => !0), o = u[1], g = u[0], b = W.useState(() => ""), y = b[1], l = b[0], h = W.useState(() => ""), i = h[1], d = h[0], c = W.useState(() => 0), f = c[1], k = c[0], p = { address: void 0, topics: [["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]] }, S = { address: void 0, topics: [ ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"], [], ["0x0000000000000000000000000000000000000000000000000000000000000000"] ] }, G = () => { if (l !== "" && l.startsWith("0x")) return t({ address: m(s.address, []).concat([l]), topics: s.topics }), y((T) => ""); }, q = () => { if (!(d !== "" && d.startsWith("0x"))) return; let T = $t(m(s.topics, []).length, k + 1 | 0), E = zt(T, (M) => M < m(s.topics, []).length ? m(s.topics, [])[M] : []), R = m(nt(E, k), []).concat([d]); E[k] = R, t({ address: s.address, topics: E }), i((M) => ""); }, K = () => es({ address: s.address, topics: s.topics }), Q = () => Ge({ address: s.address, topics: s.topics }), j = () => { let T = m(s.address, []), E = m(s.topics, []), B; T.length > 0 ? B = ` "address": [ ` + T.map((z) => ' "' + z + '"').join(`, `) + ` ]` : B = ""; let R; E.length > 0 ? R = ` "topics": [ ` + E.map((z) => z.length === 0 ? " []" : ` [ ` + z.map((Z) => ' "' + Z + '"').join(`, `) + ` ]`).join(`, `) + ` ]` : R = ""; let M = [ B, R ].filter((O) => O !== ""); return M.length > 0 ? `{ ` + M.join(`, `) + ` }` : "{}"; }, C = m(s.address, []).length > 0 || m(s.topics, []).length > 0; return e.jsxs("div", { children: [ e.jsx("div", { children: e.jsxs("div", { children: [ e.jsxs("div", { children: [ e.jsx("h3", { children: "Log Filter " + (r.filterIndex + 1 | 0).toString(), className: "text-lg font-medium text-gray-900" }), C ? e.jsx("span", { children: "Active", className: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800" }) : null ], className: "flex items-center space-x-3" }), e.jsxs("div", { children: [ e.jsx("button", { children: e.jsx("svg", { children: e.jsx("path", { d: "M19 9l-7 7-7-7", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" }), className: "w-4 h-4 transform transition-transform " + (g ? "rotate-180" : "rotate-0"), fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" }), className: "inline-flex items-center p-2 text-sm font-medium text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500", onClick: (T) => o((E) => !E) }), e.jsx("button", { children: e.jsx("svg", { children: e.jsx("path", { d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" }), className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" }), className: "inline-flex items-center p-2 text-sm font-medium text-red-500 hover:text-red-700 hover:bg-red-100 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500", onClick: (T) => a() }) ], className: "flex items-center space-x-2" }) ], className: "flex items-center justify-between" }), className: "p-4 border-b border-gray-200" }), g ? e.jsxs("div", { children: [ e.jsxs("div", { children: [ e.jsx("button", { children: "Transfer Events", className: "px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500", onClick: (T) => t(p) }), e.jsx("button", { children: "Burn Events", className: "px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-md hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500", onClick: (T) => t(S) }) ], className: "mb-4 flex flex-wrap gap-2" }), e.jsxs("div", { children: [ e.jsx("label", { children: "Contract Addresses", className: "block text-sm font-medium text-gray-700 mb-2" }), e.jsxs("div", { children: [ e.jsx("input", { className: "flex-1 border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500", placeholder: "0x...", type: "text", value: l, onChange: (T) => { let E = T.target; y((B) => E.value); } }), e.jsx("button", { children: m(s.address, []).length > 0 ? "Add (via OR) Address" : "Add Address", className: "px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed", disabled: l.length === 0 || !l.startsWith("0x"), onClick: (T) => G() }) ], className: "flex space-x-2 mb-3" }), e.jsx("div", { children: m(s.address, []).map((T, E) => e.jsxs("div", { children: [ e.jsx("span", { children: T, className: "text-sm font-mono text-gray-800" }), e.jsx("button", { children: "Remove", className: "text-red-600 hover:text-red-800 text-sm", onClick: (B) => { let R = m(s.address, []), M = ce(R, (O, z) => z !== E); t({ address: M.length > 0 ? M : void 0, topics: s.topics }); } }) ], className: "flex items-center justify-between bg-gray-50 px-3 py-2 rounded-md" }, E.toString())), className: "space-y-2" }) ], className: "mb-6" }), e.jsxs("div", { children: [ e.jsx("label", { children: "Event Topics", className: "block text-sm font-medium text-gray-700 mb-2" }), e.jsxs("div", { children: [ e.jsx("select", { children: Ht(0, 3).map((T, E) => e.jsx("option", { children: "Topic " + E.toString(), value: E.toString() }, E.toString())), className: "border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500", value: k.toString(), onChange: (T) => { let E = T.target, B = pe(E.value); if (B !== void 0) return f((R) => B); } }), e.jsx("input", { className: "flex-1 border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500", placeholder: "0x...", type: "text", value: d, onChange: (T) => { let E = T.target; i((B) => E.value); } }), e.jsx("button", { children: k < m(s.topics, []).length && m(s.topics, [])[k].length > 0 ? "Add (via OR) Topic" : "Add Topic", className: "px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed", disabled: d.length === 0 || !d.startsWith("0x"), onClick: (T) => q() }) ], className: "flex space-x-2 mb-3" }), e.jsx("div", { children: m(s.topics, []).map((T, E) => e.jsxs("div", { children: [ e.jsx("h4", { children: "Topic " + E.toString(), className: "text-sm font-medium text-gray-700 mb-2" }), e.jsx("div", { children: T.map((B, R) => e.jsxs("div", { children: [ e.jsx("span", { children: B, className: "text-sm font-mono text-gray-800" }), e.jsx("button", { children: "Remove", className: "text-red-600 hover:text-red-800 text-sm", onClick: (M) => { let O = m(s.topics, []), z = m(nt(O, E), []), ee = ce(z, (te, ne) => ne !== R), Z = O.map((te, ne) => ne === E ? ee : te); t({ address: s.address, topics: Z.length > 0 && Z.some((te) => te.length > 0) ? Z : void 0 }); } }) ], className: "flex items-center justify-between bg-gray-50 px-3 py-2 rounded-md" }, E.toString() + "-" + R.toString())), className: "space-y-2" }) ], className: "border border-gray-200 rounded-md p-3" }, E.toString())), className: "space-y-3" }) ], className: "mb-6" }), e.jsxs("div", { children: [ e.jsx("label", { children: "English Description", className: "block text-sm font-medium text-gray-700 mb-2" }), e.jsx("div", { children: e.jsx("p", { children: K(), className: "text-sm text-blue-800" }), className: "bg-blue-50 border border-blue-200 rounded-md p-4 mb-4" }), e.jsx("label", { children: "Boolean Logic Hierarchy", className: "block text-sm font-medium text-gray-700 mb-2" }), e.jsx("pre", { children: Q(), className: "bg-gray-50 border border-gray-200 rounded-md p-4 text-sm font-mono mb-4 whitespace-pre overflow-x-auto" }), e.jsx("label", { children: "Generated Query Structure", className: "block text-sm font-medium text-gray-700 mb-2" }), e.jsx("pre", { children: j(), className: "bg-gray-100 border border-gray-300 rounded-md p-4 text-sm font-mono overflow-x-auto" }) ], className: "mt-6" }) ], className: "p-6" }) : null ], className: "bg-white rounded-lg shadow" }); } let as = rs; function is(r) { let a = r.onRemove, t = r.onFilterChange, s = r.filterState, u = W.useState(() => !0), o = u[1], g = u[0], b = W.useState(() => ""), y = b[1], l = b[0], h = W.useState(() => ""), i = h[1], d = h[0], f = { hash: void 0, miner: [