UNPKG

playermap_graph

Version:

A React library for intuition visualization using force-directed graphs

1,584 lines (1,579 loc) 2.08 MB
var gN = Object.defineProperty; var yN = (r, e, n) => e in r ? gN(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n; var ja = (r, e, n) => yN(r, typeof e != "symbol" ? e + "" : e, n); import wi, { useState as dt, useEffect as $i, useRef as ii, forwardRef as _N, useMemo as vN, useCallback as zi, useImperativeHandle as xN, useLayoutEffect as bN } from "react"; import cM from "3d-force-graph-vr"; function sv(r) { return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; } var G0 = { exports: {} }, Vc = {}; /** * @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 nb; function SN() { if (nb) return Vc; nb = 1; var r = wi, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 }; function a(l, c, u) { var h, d = {}, f = null, p = null; u !== void 0 && (f = "" + u), c.key !== void 0 && (f = "" + c.key), c.ref !== void 0 && (p = c.ref); for (h in c) i.call(c, h) && !o.hasOwnProperty(h) && (d[h] = c[h]); if (l && l.defaultProps) for (h in c = l.defaultProps, c) d[h] === void 0 && (d[h] = c[h]); return { $$typeof: e, type: l, key: f, ref: p, props: d, _owner: s.current }; } return Vc.Fragment = n, Vc.jsx = a, Vc.jsxs = a, Vc; } var $c = {}; /** * @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 ib; function TN() { return ib || (ib = 1, process.env.NODE_ENV !== "production" && function() { var r = wi, e = Symbol.for("react.element"), n = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), l = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), p = Symbol.for("react.offscreen"), m = Symbol.iterator, _ = "@@iterator"; function y(z) { if (z === null || typeof z != "object") return null; var Te = m && z[m] || z[_]; return typeof Te == "function" ? Te : null; } var g = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function x(z) { { for (var Te = arguments.length, Fe = new Array(Te > 1 ? Te - 1 : 0), at = 1; at < Te; at++) Fe[at - 1] = arguments[at]; b("error", z, Fe); } } function b(z, Te, Fe) { { var at = g.ReactDebugCurrentFrame, Pt = at.getStackAddendum(); Pt !== "" && (Te += "%s", Fe = Fe.concat([Pt])); var qt = Fe.map(function(Et) { return String(Et); }); qt.unshift("Warning: " + Te), Function.prototype.apply.call(console[z], console, qt); } } var v = !1, T = !1, M = !1, E = !1, A = !1, w; w = Symbol.for("react.module.reference"); function S(z) { return !!(typeof z == "string" || typeof z == "function" || z === i || z === o || A || z === s || z === u || z === h || E || z === p || v || T || M || typeof z == "object" && z !== null && (z.$$typeof === f || z.$$typeof === d || z.$$typeof === a || z.$$typeof === l || z.$$typeof === c || // 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. z.$$typeof === w || z.getModuleId !== void 0)); } function R(z, Te, Fe) { var at = z.displayName; if (at) return at; var Pt = Te.displayName || Te.name || ""; return Pt !== "" ? Fe + "(" + Pt + ")" : Fe; } function O(z) { return z.displayName || "Context"; } function P(z) { if (z == null) return null; if (typeof z.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof z == "function") return z.displayName || z.name || null; if (typeof z == "string") return z; switch (z) { case i: return "Fragment"; case n: return "Portal"; case o: return "Profiler"; case s: return "StrictMode"; case u: return "Suspense"; case h: return "SuspenseList"; } if (typeof z == "object") switch (z.$$typeof) { case l: var Te = z; return O(Te) + ".Consumer"; case a: var Fe = z; return O(Fe._context) + ".Provider"; case c: return R(z, z.render, "ForwardRef"); case d: var at = z.displayName || null; return at !== null ? at : P(z.type) || "Memo"; case f: { var Pt = z, qt = Pt._payload, Et = Pt._init; try { return P(Et(qt)); } catch { return null; } } } return null; } var C = Object.assign, I = 0, L, W, $, ne, U, k, re; function he() { } he.__reactDisabledLog = !0; function F() { { if (I === 0) { L = console.log, W = console.info, $ = console.warn, ne = console.error, U = console.group, k = console.groupCollapsed, re = console.groupEnd; var z = { configurable: !0, enumerable: !0, value: he, writable: !0 }; Object.defineProperties(console, { info: z, log: z, warn: z, error: z, group: z, groupCollapsed: z, groupEnd: z }); } I++; } } function G() { { if (I--, I === 0) { var z = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: C({}, z, { value: L }), info: C({}, z, { value: W }), warn: C({}, z, { value: $ }), error: C({}, z, { value: ne }), group: C({}, z, { value: U }), groupCollapsed: C({}, z, { value: k }), groupEnd: C({}, z, { value: re }) }); } I < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var ee = g.ReactCurrentDispatcher, Q; function ue(z, Te, Fe) { { if (Q === void 0) try { throw Error(); } catch (Pt) { var at = Pt.stack.trim().match(/\n( *(at )?)/); Q = at && at[1] || ""; } return ` ` + Q + z; } } var xe = !1, Se; { var $e = typeof WeakMap == "function" ? WeakMap : Map; Se = new $e(); } function fe(z, Te) { if (!z || xe) return ""; { var Fe = Se.get(z); if (Fe !== void 0) return Fe; } var at; xe = !0; var Pt = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var qt; qt = ee.current, ee.current = null, F(); try { if (Te) { var Et = function() { throw Error(); }; if (Object.defineProperty(Et.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(Et, []); } catch (Ce) { at = Ce; } Reflect.construct(z, [], Et); } else { try { Et.call(); } catch (Ce) { at = Ce; } z.call(Et.prototype); } } else { try { throw Error(); } catch (Ce) { at = Ce; } z(); } } catch (Ce) { if (Ce && at && typeof Ce.stack == "string") { for (var Tt = Ce.stack.split(` `), D = at.stack.split(` `), H = Tt.length - 1, te = D.length - 1; H >= 1 && te >= 0 && Tt[H] !== D[te]; ) te--; for (; H >= 1 && te >= 0; H--, te--) if (Tt[H] !== D[te]) { if (H !== 1 || te !== 1) do if (H--, te--, te < 0 || Tt[H] !== D[te]) { var oe = ` ` + Tt[H].replace(" at new ", " at "); return z.displayName && oe.includes("<anonymous>") && (oe = oe.replace("<anonymous>", z.displayName)), typeof z == "function" && Se.set(z, oe), oe; } while (H >= 1 && te >= 0); break; } } } finally { xe = !1, ee.current = qt, G(), Error.prepareStackTrace = Pt; } var Z = z ? z.displayName || z.name : "", Me = Z ? ue(Z) : ""; return typeof z == "function" && Se.set(z, Me), Me; } function st(z, Te, Fe) { return fe(z, !1); } function q(z) { var Te = z.prototype; return !!(Te && Te.isReactComponent); } function Mt(z, Te, Fe) { if (z == null) return ""; if (typeof z == "function") return fe(z, q(z)); if (typeof z == "string") return ue(z); switch (z) { case u: return ue("Suspense"); case h: return ue("SuspenseList"); } if (typeof z == "object") switch (z.$$typeof) { case c: return st(z.render); case d: return Mt(z.type, Te, Fe); case f: { var at = z, Pt = at._payload, qt = at._init; try { return Mt(qt(Pt), Te, Fe); } catch { } } } return ""; } var ot = Object.prototype.hasOwnProperty, ht = {}, Qe = g.ReactDebugCurrentFrame; function It(z) { if (z) { var Te = z._owner, Fe = Mt(z.type, z._source, Te ? Te.type : null); Qe.setExtraStackFrame(Fe); } else Qe.setExtraStackFrame(null); } function Ze(z, Te, Fe, at, Pt) { { var qt = Function.call.bind(ot); for (var Et in z) if (qt(z, Et)) { var Tt = void 0; try { if (typeof z[Et] != "function") { var D = Error((at || "React class") + ": " + Fe + " type `" + Et + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof z[Et] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw D.name = "Invariant Violation", D; } Tt = z[Et](Te, Et, at, Fe, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (H) { Tt = H; } Tt && !(Tt instanceof Error) && (It(Pt), x("%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).", at || "React class", Fe, Et, typeof Tt), It(null)), Tt instanceof Error && !(Tt.message in ht) && (ht[Tt.message] = !0, It(Pt), x("Failed %s type: %s", Fe, Tt.message), It(null)); } } } var B = Array.isArray; function N(z) { return B(z); } function se(z) { { var Te = typeof Symbol == "function" && Symbol.toStringTag, Fe = Te && z[Symbol.toStringTag] || z.constructor.name || "Object"; return Fe; } } function _e(z) { try { return be(z), !1; } catch { return !0; } } function be(z) { return "" + z; } function me(z) { if (_e(z)) return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", se(z)), be(z); } var ze = g.ReactCurrentOwner, Ie = { key: !0, ref: !0, __self: !0, __source: !0 }, ke, et; function we(z) { if (ot.call(z, "ref")) { var Te = Object.getOwnPropertyDescriptor(z, "ref").get; if (Te && Te.isReactWarning) return !1; } return z.ref !== void 0; } function Ge(z) { if (ot.call(z, "key")) { var Te = Object.getOwnPropertyDescriptor(z, "key").get; if (Te && Te.isReactWarning) return !1; } return z.key !== void 0; } function Je(z, Te) { typeof z.ref == "string" && ze.current; } function nt(z, Te) { { var Fe = function() { ke || (ke = !0, x("%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)", Te)); }; Fe.isReactWarning = !0, Object.defineProperty(z, "key", { get: Fe, configurable: !0 }); } } function Ve(z, Te) { { var Fe = function() { et || (et = !0, x("%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)", Te)); }; Fe.isReactWarning = !0, Object.defineProperty(z, "ref", { get: Fe, configurable: !0 }); } } var bt = function(z, Te, Fe, at, Pt, qt, Et) { var Tt = { // This tag allows us to uniquely identify this as a React Element $$typeof: e, // Built-in properties that belong on the element type: z, key: Te, ref: Fe, props: Et, // Record the component responsible for creating this element. _owner: qt }; return Tt._store = {}, Object.defineProperty(Tt._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(Tt, "_self", { configurable: !1, enumerable: !1, writable: !1, value: at }), Object.defineProperty(Tt, "_source", { configurable: !1, enumerable: !1, writable: !1, value: Pt }), Object.freeze && (Object.freeze(Tt.props), Object.freeze(Tt)), Tt; }; function mt(z, Te, Fe, at, Pt) { { var qt, Et = {}, Tt = null, D = null; Fe !== void 0 && (me(Fe), Tt = "" + Fe), Ge(Te) && (me(Te.key), Tt = "" + Te.key), we(Te) && (D = Te.ref, Je(Te, Pt)); for (qt in Te) ot.call(Te, qt) && !Ie.hasOwnProperty(qt) && (Et[qt] = Te[qt]); if (z && z.defaultProps) { var H = z.defaultProps; for (qt in H) Et[qt] === void 0 && (Et[qt] = H[qt]); } if (Tt || D) { var te = typeof z == "function" ? z.displayName || z.name || "Unknown" : z; Tt && nt(Et, te), D && Ve(Et, te); } return bt(z, Tt, D, Pt, at, ze.current, Et); } } var kt = g.ReactCurrentOwner, Y = g.ReactDebugCurrentFrame; function Pe(z) { if (z) { var Te = z._owner, Fe = Mt(z.type, z._source, Te ? Te.type : null); Y.setExtraStackFrame(Fe); } else Y.setExtraStackFrame(null); } var le; le = !1; function ve(z) { return typeof z == "object" && z !== null && z.$$typeof === e; } function Ue() { { if (kt.current) { var z = P(kt.current.type); if (z) return ` Check the render method of \`` + z + "`."; } return ""; } } function Be(z) { return ""; } var ut = {}; function an(z) { { var Te = Ue(); if (!Te) { var Fe = typeof z == "string" ? z : z.displayName || z.name; Fe && (Te = ` Check the top-level render call using <` + Fe + ">."); } return Te; } } function Pn(z, Te) { { if (!z._store || z._store.validated || z.key != null) return; z._store.validated = !0; var Fe = an(Te); if (ut[Fe]) return; ut[Fe] = !0; var at = ""; z && z._owner && z._owner !== kt.current && (at = " It was passed a child from " + P(z._owner.type) + "."), Pe(z), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Fe, at), Pe(null); } } function Lt(z, Te) { { if (typeof z != "object") return; if (N(z)) for (var Fe = 0; Fe < z.length; Fe++) { var at = z[Fe]; ve(at) && Pn(at, Te); } else if (ve(z)) z._store && (z._store.validated = !0); else if (z) { var Pt = y(z); if (typeof Pt == "function" && Pt !== z.entries) for (var qt = Pt.call(z), Et; !(Et = qt.next()).done; ) ve(Et.value) && Pn(Et.value, Te); } } } function Ni(z) { { var Te = z.type; if (Te == null || typeof Te == "string") return; var Fe; if (typeof Te == "function") Fe = Te.propTypes; else if (typeof Te == "object" && (Te.$$typeof === c || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. Te.$$typeof === d)) Fe = Te.propTypes; else return; if (Fe) { var at = P(Te); Ze(Fe, z.props, "prop", at, z); } else if (Te.PropTypes !== void 0 && !le) { le = !0; var Pt = P(Te); x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Pt || "Unknown"); } typeof Te.getDefaultProps == "function" && !Te.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function lr(z) { { for (var Te = Object.keys(z.props), Fe = 0; Fe < Te.length; Fe++) { var at = Te[Fe]; if (at !== "children" && at !== "key") { Pe(z), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", at), Pe(null); break; } } z.ref !== null && (Pe(z), x("Invalid attribute `ref` supplied to `React.Fragment`."), Pe(null)); } } var Uc = {}; function Bc(z, Te, Fe, at, Pt, qt) { { var Et = S(z); if (!Et) { var Tt = ""; (z === void 0 || typeof z == "object" && z !== null && Object.keys(z).length === 0) && (Tt += " 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 D = Be(); D ? Tt += D : Tt += Ue(); var H; z === null ? H = "null" : N(z) ? H = "array" : z !== void 0 && z.$$typeof === e ? (H = "<" + (P(z.type) || "Unknown") + " />", Tt = " Did you accidentally export a JSX literal instead of a component?") : H = typeof z, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", H, Tt); } var te = mt(z, Te, Fe, Pt, qt); if (te == null) return te; if (Et) { var oe = Te.children; if (oe !== void 0) if (at) if (N(oe)) { for (var Z = 0; Z < oe.length; Z++) Lt(oe[Z], z); Object.freeze && Object.freeze(oe); } else x("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 Lt(oe, z); } if (ot.call(Te, "key")) { var Me = P(z), Ce = Object.keys(Te).filter(function(lt) { return lt !== "key"; }), He = Ce.length > 0 ? "{key: someKey, " + Ce.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Uc[Me + He]) { var qe = Ce.length > 0 ? "{" + Ce.join(": ..., ") + ": ...}" : "{}"; x(`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} />`, He, Me, qe, Me), Uc[Me + He] = !0; } } return z === i ? lr(te) : Ni(te), te; } } function es(z, Te, Fe) { return Bc(z, Te, Fe, !0); } function kc(z, Te, Fe) { return Bc(z, Te, Fe, !1); } var kh = kc, zh = es; $c.Fragment = i, $c.jsx = kh, $c.jsxs = zh; }()), $c; } process.env.NODE_ENV === "production" ? G0.exports = SN() : G0.exports = TN(); var X = G0.exports; const gn = { SUBJECT: "#FFB300", // Jaune/orangé accessible PREDICATE: "#1976D2", // Bleu profond accessible OBJECT: "#43A047" // Vert foncé accessible }, Fl = (r) => { switch (r) { case "subject": return gn.SUBJECT; case "predicate": return gn.PREDICATE; case "object": return gn.OBJECT; default: return "#444"; } }, rb = () => /* @__PURE__ */ X.jsxs( "div", { style: { position: "absolute", bottom: 10, right: 5, zIndex: 1e3 }, children: [ /* @__PURE__ */ X.jsx( "h4", { style: { margin: "0 0 4px 0", fontSize: "18px", color: "#ffd32a", fontWeight: "bold", letterSpacing: "0.5px", textTransform: "uppercase" }, children: "LEGEND" } ), /* @__PURE__ */ X.jsxs( "ul", { style: { listStyle: "none", margin: 0, display: "flex", flexDirection: "column", gap: "12px", borderRadius: "10px", padding: "16px 16px" }, children: [ /* @__PURE__ */ X.jsxs( "li", { style: { display: "flex", alignItems: "center", gap: "12px", color: "#fff" }, children: [ /* @__PURE__ */ X.jsx( "span", { style: { width: "20px", height: "20px", backgroundColor: gn.SUBJECT, borderRadius: "50%", display: "inline-block", boxShadow: "0 2px 8px rgba(0,0,0,0.18)" } } ), /* @__PURE__ */ X.jsx("span", { style: { fontSize: "15px" }, children: "Subject" }) ] } ), /* @__PURE__ */ X.jsxs( "li", { style: { display: "flex", alignItems: "center", gap: "12px", color: "#fff" }, children: [ /* @__PURE__ */ X.jsx( "span", { style: { width: "20px", height: "20px", backgroundColor: gn.OBJECT, borderRadius: "4px", display: "inline-block", boxShadow: "0 2px 8px rgba(0,0,0,0.18)" } } ), /* @__PURE__ */ X.jsx("span", { style: { fontSize: "15px" }, children: "Object" }) ] } ), /* @__PURE__ */ X.jsxs( "li", { style: { display: "flex", alignItems: "center", gap: "12px", color: "#fff" }, children: [ /* @__PURE__ */ X.jsx( "span", { style: { width: "20px", height: "8px", backgroundColor: gn.PREDICATE, borderRadius: "4px", display: "inline-block", boxShadow: "0 2px 8px rgba(0,0,0,0.18)" } } ), /* @__PURE__ */ X.jsx("span", { style: { fontSize: "15px" }, children: "Predicate" }) ] } ) ] } ) ] } ); class ql extends Error { constructor(n, i) { const s = `${ql.extractMessage(n)}: ${JSON.stringify({ response: n, request: i })}`; super(s); ja(this, "response"); ja(this, "request"); Object.setPrototypeOf(this, ql.prototype), this.response = n, this.request = i, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, ql); } static extractMessage(n) { var i, s; return ((s = (i = n.errors) == null ? void 0 : i[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${String(n.status)})`; } } const sb = (r) => r.toUpperCase(), _m = (r) => typeof r == "function" ? r() : r, uM = (r, e) => r.map((n, i) => [n, e[i]]), Ha = (r) => { let e = {}; return r instanceof Headers ? e = wN(r) : Array.isArray(r) ? r.forEach(([n, i]) => { n && i !== void 0 && (e[n] = i); }) : r && (e = r), e; }, wN = (r) => { const e = {}; return r.forEach((n, i) => { e[i] = n; }), e; }, MN = (r) => { try { const e = r(); return EN(e) ? e.catch((n) => ob(n)) : e; } catch (e) { return ob(e); } }, ob = (r) => r instanceof Error ? r : new Error(String(r)), EN = (r) => typeof r == "object" && r !== null && "then" in r && typeof r.then == "function" && "catch" in r && typeof r.catch == "function" && "finally" in r && typeof r.finally == "function", ov = (r) => { throw new Error(`Unhandled case: ${String(r)}`); }, yf = (r) => typeof r == "object" && r !== null && !Array.isArray(r), AN = (r, e) => r.documents ? r : { documents: r, requestHeaders: e, signal: void 0 }, CN = (r, e, n) => r.query ? r : { query: r, variables: e, requestHeaders: n, signal: void 0 }; function _f(r, e) { if (!!!r) throw new Error(e); } function RN(r) { return typeof r == "object" && r !== null; } function NN(r, e) { if (!!!r) throw new Error( "Unexpected invariant triggered." ); } const PN = /\r\n|[\n\r]/g; function V0(r, e) { let n = 0, i = 1; for (const s of r.body.matchAll(PN)) { if (typeof s.index == "number" || NN(!1), s.index >= e) break; n = s.index + s[0].length, i += 1; } return { line: i, column: e + 1 - n }; } function DN(r) { return hM( r.source, V0(r.source, r.start) ); } function hM(r, e) { const n = r.locationOffset.column - 1, i = "".padStart(n) + r.body, s = e.line - 1, o = r.locationOffset.line - 1, a = e.line + o, l = e.line === 1 ? n : 0, c = e.column + l, u = `${r.name}:${a}:${c} `, h = i.split(/\r\n|[\n\r]/g), d = h[s]; if (d.length > 120) { const f = Math.floor(c / 80), p = c % 80, m = []; for (let _ = 0; _ < d.length; _ += 80) m.push(d.slice(_, _ + 80)); return u + ab([ [`${a} |`, m[0]], ...m.slice(1, f + 1).map((_) => ["|", _]), ["|", "^".padStart(p)], ["|", m[f + 1]] ]); } return u + ab([ // Lines specified like this: ["prefix", "string"], [`${a - 1} |`, h[s - 1]], [`${a} |`, d], ["|", "^".padStart(c)], [`${a + 1} |`, h[s + 1]] ]); } function ab(r) { const e = r.filter(([i, s]) => s !== void 0), n = Math.max(...e.map(([i]) => i.length)); return e.map(([i, s]) => i.padStart(n) + (s ? " " + s : "")).join(` `); } function IN(r) { const e = r[0]; return e == null || "kind" in e || "length" in e ? { nodes: e, source: r[1], positions: r[2], path: r[3], originalError: r[4], extensions: r[5] } : e; } class av extends Error { /** * An array of `{ line, column }` locations within the source GraphQL document * which correspond to this error. * * Errors during validation often contain multiple locations, for example to * point out two things with the same name. Errors during execution include a * single location, the field which produced the error. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array describing the JSON-path into the execution response which * corresponds to this error. Only included for errors during execution. * * Enumerable, and appears in the result of JSON.stringify(). */ /** * An array of GraphQL AST Nodes corresponding to this error. */ /** * The source GraphQL document for the first location of this error. * * Note that if this Error represents more than one node, the source may not * represent nodes after the first node. */ /** * An array of character offsets within the source GraphQL document * which correspond to this error. */ /** * The original error thrown from a field resolver during execution. */ /** * Extension fields to add to the formatted error. */ /** * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead. */ constructor(e, ...n) { var i, s, o; const { nodes: a, source: l, positions: c, path: u, originalError: h, extensions: d } = IN(n); super(e), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = lb( Array.isArray(a) ? a : a ? [a] : void 0 ); const f = lb( (i = this.nodes) === null || i === void 0 ? void 0 : i.map((m) => m.loc).filter((m) => m != null) ); this.source = l ?? (f == null || (s = f[0]) === null || s === void 0 ? void 0 : s.source), this.positions = c ?? (f == null ? void 0 : f.map((m) => m.start)), this.locations = c && l ? c.map((m) => V0(l, m)) : f == null ? void 0 : f.map((m) => V0(m.source, m.start)); const p = RN( h == null ? void 0 : h.extensions ) ? h == null ? void 0 : h.extensions : void 0; this.extensions = (o = d ?? p) !== null && o !== void 0 ? o : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, { message: { writable: !0, enumerable: !0 }, name: { enumerable: !1 }, nodes: { enumerable: !1 }, source: { enumerable: !1 }, positions: { enumerable: !1 }, originalError: { enumerable: !1 } }), h != null && h.stack ? Object.defineProperty(this, "stack", { value: h.stack, writable: !0, configurable: !0 }) : Error.captureStackTrace ? Error.captureStackTrace(this, av) : Object.defineProperty(this, "stack", { value: Error().stack, writable: !0, configurable: !0 }); } get [Symbol.toStringTag]() { return "GraphQLError"; } toString() { let e = this.message; if (this.nodes) for (const n of this.nodes) n.loc && (e += ` ` + DN(n.loc)); else if (this.source && this.locations) for (const n of this.locations) e += ` ` + hM(this.source, n); return e; } toJSON() { const e = { message: this.message }; return this.locations != null && (e.locations = this.locations), this.path != null && (e.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (e.extensions = this.extensions), e; } } function lb(r) { return r === void 0 || r.length === 0 ? void 0 : r; } function Un(r, e, n) { return new av(`Syntax Error: ${n}`, { source: r, positions: [e] }); } class LN { /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The Token at which this Node begins. */ /** * The Token at which this Node ends. */ /** * The Source document the AST represents. */ constructor(e, n, i) { this.start = e.start, this.end = n.end, this.startToken = e, this.endToken = n, this.source = i; } get [Symbol.toStringTag]() { return "Location"; } toJSON() { return { start: this.start, end: this.end }; } } class dM { /** * The kind of Token. */ /** * The character offset at which this Node begins. */ /** * The character offset at which this Node ends. */ /** * The 1-indexed line number on which this Token appears. */ /** * The 1-indexed column number at which this Token begins. */ /** * For non-punctuation tokens, represents the interpreted value of the token. * * Note: is undefined for punctuation tokens, but typed as string for * convenience in the parser. */ /** * Tokens exist as nodes in a double-linked-list amongst all tokens * including ignored tokens. <SOF> is always the first node and <EOF> * the last. */ constructor(e, n, i, s, o, a) { this.kind = e, this.start = n, this.end = i, this.line = s, this.column = o, this.value = a, this.prev = null, this.next = null; } get [Symbol.toStringTag]() { return "Token"; } toJSON() { return { kind: this.kind, value: this.value, line: this.line, column: this.column }; } } const fM = { Name: [], Document: ["definitions"], OperationDefinition: [ "name", "variableDefinitions", "directives", "selectionSet" ], VariableDefinition: ["variable", "type", "defaultValue", "directives"], Variable: ["name"], SelectionSet: ["selections"], Field: ["alias", "name", "arguments", "directives", "selectionSet"], Argument: ["name", "value"], FragmentSpread: ["name", "directives"], InlineFragment: ["typeCondition", "directives", "selectionSet"], FragmentDefinition: [ "name", // Note: fragment variable definitions are deprecated and will removed in v17.0.0 "variableDefinitions", "typeCondition", "directives", "selectionSet" ], IntValue: [], FloatValue: [], StringValue: [], BooleanValue: [], NullValue: [], EnumValue: [], ListValue: ["values"], ObjectValue: ["fields"], ObjectField: ["name", "value"], Directive: ["name", "arguments"], NamedType: ["name"], ListType: ["type"], NonNullType: ["type"], SchemaDefinition: ["description", "directives", "operationTypes"], OperationTypeDefinition: ["type"], ScalarTypeDefinition: ["description", "name", "directives"], ObjectTypeDefinition: [ "description", "name", "interfaces", "directives", "fields" ], FieldDefinition: ["description", "name", "arguments", "type", "directives"], InputValueDefinition: [ "description", "name", "type", "defaultValue", "directives" ], InterfaceTypeDefinition: [ "description", "name", "interfaces", "directives", "fields" ], UnionTypeDefinition: ["description", "name", "directives", "types"], EnumTypeDefinition: ["description", "name", "directives", "values"], EnumValueDefinition: ["description", "name", "directives"], InputObjectTypeDefinition: ["description", "name", "directives", "fields"], DirectiveDefinition: ["description", "name", "arguments", "locations"], SchemaExtension: ["directives", "operationTypes"], ScalarTypeExtension: ["name", "directives"], ObjectTypeExtension: ["name", "interfaces", "directives", "fields"], InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"], UnionTypeExtension: ["name", "directives", "types"], EnumTypeExtension: ["name", "directives", "values"], InputObjectTypeExtension: ["name", "directives", "fields"] }, ON = new Set(Object.keys(fM)); function cb(r) { const e = r == null ? void 0 : r.kind; return typeof e == "string" && ON.has(e); } var ga; (function(r) { r.QUERY = "query", r.MUTATION = "mutation", r.SUBSCRIPTION = "subscription"; })(ga || (ga = {})); var $0; (function(r) { r.QUERY = "QUERY", r.MUTATION = "MUTATION", r.SUBSCRIPTION = "SUBSCRIPTION", r.FIELD = "FIELD", r.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", r.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", r.INLINE_FRAGMENT = "INLINE_FRAGMENT", r.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", r.SCHEMA = "SCHEMA", r.SCALAR = "SCALAR", r.OBJECT = "OBJECT", r.FIELD_DEFINITION = "FIELD_DEFINITION", r.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", r.INTERFACE = "INTERFACE", r.UNION = "UNION", r.ENUM = "ENUM", r.ENUM_VALUE = "ENUM_VALUE", r.INPUT_OBJECT = "INPUT_OBJECT", r.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION"; })($0 || ($0 = {})); var rt; (function(r) { r.NAME = "Name", r.DOCUMENT = "Document", r.OPERATION_DEFINITION = "OperationDefinition", r.VARIABLE_DEFINITION = "VariableDefinition", r.SELECTION_SET = "SelectionSet", r.FIELD = "Field", r.ARGUMENT = "Argument", r.FRAGMENT_SPREAD = "FragmentSpread", r.INLINE_FRAGMENT = "InlineFragment", r.FRAGMENT_DEFINITION = "FragmentDefinition", r.VARIABLE = "Variable", r.INT = "IntValue", r.FLOAT = "FloatValue", r.STRING = "StringValue", r.BOOLEAN = "BooleanValue", r.NULL = "NullValue", r.ENUM = "EnumValue", r.LIST = "ListValue", r.OBJECT = "ObjectValue", r.OBJECT_FIELD = "ObjectField", r.DIRECTIVE = "Directive", r.NAMED_TYPE = "NamedType", r.LIST_TYPE = "ListType", r.NON_NULL_TYPE = "NonNullType", r.SCHEMA_DEFINITION = "SchemaDefinition", r.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", r.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", r.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", r.FIELD_DEFINITION = "FieldDefinition", r.INPUT_VALUE_DEFINITION = "InputValueDefinition", r.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", r.UNION_TYPE_DEFINITION = "UnionTypeDefinition", r.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", r.ENUM_VALUE_DEFINITION = "EnumValueDefinition", r.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", r.DIRECTIVE_DEFINITION = "DirectiveDefinition", r.SCHEMA_EXTENSION = "SchemaExtension", r.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", r.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", r.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", r.UNION_TYPE_EXTENSION = "UnionTypeExtension", r.ENUM_TYPE_EXTENSION = "EnumTypeExtension", r.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension"; })(rt || (rt = {})); function j0(r) { return r === 9 || r === 32; } function Ku(r) { return r >= 48 && r <= 57; } function pM(r) { return r >= 97 && r <= 122 || // A-Z r >= 65 && r <= 90; } function mM(r) { return pM(r) || r === 95; } function FN(r) { return pM(r) || Ku(r) || r === 95; } function UN(r) { var e; let n = Number.MAX_SAFE_INTEGER, i = null, s = -1; for (let a = 0; a < r.length; ++a) { var o; const l = r[a], c = BN(l); c !== l.length && (i = (o = i) !== null && o !== void 0 ? o : a, s = a, a !== 0 && c < n && (n = c)); } return r.map((a, l) => l === 0 ? a : a.slice(n)).slice( (e = i) !== null && e !== void 0 ? e : 0, s + 1 ); } function BN(r) { let e = 0; for (; e < r.length && j0(r.charCodeAt(e)); ) ++e; return e; } function kN(r, e) { const n = r.replace(/"""/g, '\\"""'), i = n.split(/\r\n|[\n\r]/g), s = i.length === 1, o = i.length > 1 && i.slice(1).every((p) => p.length === 0 || j0(p.charCodeAt(0))), a = n.endsWith('\\"""'), l = r.endsWith('"') && !a, c = r.endsWith("\\"), u = l || c, h = ( // add leading and trailing new lines only if it improves readability !s || r.length > 70 || u || o || a ); let d = ""; const f = s && j0(r.charCodeAt(0)); return (h && !f || o) && (d += ` `), d += n, (h || u) && (d += ` `), '"""' + d + '"""'; } var ye; (function(r) { r.SOF = "<SOF>", r.EOF = "<EOF>", r.BANG = "!", r.DOLLAR = "$", r.AMP = "&", r.PAREN_L = "(", r.PAREN_R = ")", r.SPREAD = "...", r.COLON = ":", r.EQUALS = "=", r.AT = "@", r.BRACKET_L = "[", r.BRACKET_R = "]", r.BRACE_L = "{", r.PIPE = "|", r.BRACE_R = "}", r.NAME = "Name", r.INT = "Int", r.FLOAT = "Float", r.STRING = "String", r.BLOCK_STRING = "BlockString", r.COMMENT = "Comment"; })(ye || (ye = {})); class zN { /** * The previously focused non-ignored token. */ /** * The currently focused non-ignored token. */ /** * The (1-indexed) line containing the current token. */ /** * The character offset at which the current line begins. */ constructor(e) { const n = new dM(ye.SOF, 0, 0, 0, 0); this.source = e, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0; } get [Symbol.toStringTag]() { return "Lexer"; } /** * Advances the token stream to the next non-ignored token. */ advance() { return this.lastToken = this.token, this.token = this.lookahead(); } /** * Looks ahead and returns the next non-ignored token, but does not change * the state of Lexer. */ lookahead() { let e = this.token; if (e.kind !== ye.EOF) do if (e.next) e = e.next; else { const n = VN(this, e.end); e.next = n, n.prev = e, e = n; } while (e.kind === ye.COMMENT); return e; } } function GN(r) { return r === ye.BANG || r === ye.DOLLAR || r === ye.AMP || r === ye.PAREN_L || r === ye.PAREN_R || r === ye.SPREAD || r === ye.COLON || r === ye.EQUALS || r === ye.AT || r === ye.BRACKET_L || r === ye.BRACKET_R || r === ye.BRACE_L || r === ye.PIPE || r === ye.BRACE_R; } function Mc(r) { return r >= 0 && r <= 55295 || r >= 57344 && r <= 1114111; } function Dp(r, e) { return gM(r.charCodeAt(e)) && yM(r.charCodeAt(e + 1)); } function gM(r) { return r >= 55296 && r <= 56319; } function yM(r) { return r >= 56320 && r <= 57343; } function wa(r, e) { const n = r.source.body.codePointAt(e); if (n === void 0) return ye.EOF; if (n >= 32 && n <= 126) { const i = String.fromCodePoint(n); return i === '"' ? `'"'` : `"${i}"`; } return "U+" + n.toString(16).toUpperCase().padStart(4, "0"); } function Tn(r, e, n, i, s) { const o = r.line, a = 1 + n - r.lineStart; return new dM(e, n, i, o, a, s); } function VN(r, e) { const n = r.source.body, i = n.length; let s = e; for (; s < i; ) { const o = n.charCodeAt(s); switch (o) { case 65279: case 9: case 32: case 44: ++s; continue; case 10: ++s, ++r.line, r.lineStart = s; continue; case 13: n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, ++r.line, r.lineStart = s; continue; case 35: return $N(r, s); case 33: return Tn(r, ye.BANG, s, s + 1); case 36: return Tn(r, ye.DOLLAR, s, s + 1); case 38: return Tn(r, ye.AMP, s, s + 1); case 40: return Tn(r, ye.PAREN_L, s, s + 1); case 41: return Tn(r, ye.PAREN_R, s, s + 1); case 46: if (n.charCodeAt(s + 1) === 46 && n.charCodeAt(s + 2) === 46) return Tn(r, ye.SPREAD, s, s + 3); break; case 58: return Tn(r, ye.COLON, s, s + 1); case 61: return Tn(r, ye.EQUALS, s, s + 1); case 64: return Tn(r, ye.AT, s, s + 1); case 91: return Tn(r, ye.BRACKET_L, s, s + 1); case 93: return Tn(r, ye.BRACKET_R, s, s + 1); case 123: return Tn(r, ye.BRACE_L, s, s + 1); case 124: return Tn(r, ye.PIPE, s, s + 1); case 125: return Tn(r, ye.BRACE_R, s, s + 1); case 34: return n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 ? YN(r, s) : HN(r, s); } if (Ku(o) || o === 45) return jN(r, s, o); if (mM(o)) return ZN(r, s); throw Un( r.source, s, o === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : Mc(o) || Dp(n, s) ? `Unexpected character: ${wa(r, s)}.` : `Invalid character: ${wa(r, s)}.` ); } return Tn(r, ye.EOF, i, i); } function $N(r, e) { const n = r.source.body, i = n.length; let s = e + 1; for (; s < i; ) { const o = n.charCodeAt(s); if (o === 10 || o === 13) break; if (Mc(o)) ++s; else if (Dp(n, s)) s += 2; else break; } return Tn( r, ye.COMMENT, e, s, n.slice(e + 1, s) ); } function jN(r, e, n) { const i = r.source.body; let s = e, o = n, a = !1; if (o === 45 && (o = i.charCodeAt(++s)), o === 48) { if (o = i.charCodeAt(++s), Ku(o)) throw Un( r.source, s, `Invalid number, unexpected digit after 0: ${wa( r, s )}.` ); } else s = vm(r, s, o), o = i.charCodeAt(s); if (o === 46 && (a = !0, o = i.charCodeAt(++s), s = vm(r, s, o), o = i.charCodeAt(s)), (o === 69 || o === 101) && (a = !0, o = i.charCodeAt(++s), (o === 43 || o === 45) && (o = i.charCodeAt(++s)), s = vm(r, s, o), o = i.charCodeAt(s)), o === 46 || mM(o)) throw Un( r.source, s, `Invalid number, expected digit but got: ${wa( r, s )}.` ); return Tn( r, a ? ye.FLOAT : ye.INT, e, s, i.slice(e, s) ); } function vm(r, e, n) { if (!Ku(n)) throw Un( r.source, e, `Invalid number, expected digit but got: ${wa( r, e )}.` ); const i = r.source.body; let s = e + 1; for (; Ku(i.charCodeAt(s)); ) ++s; return s; } function HN(r, e) { const n = r.source.body, i = n.length; let s = e + 1, o = s, a = ""; for (; s < i; ) { const l = n.charCodeAt(s); if (l === 34) return a += n.slice(o, s), Tn(r, ye.STRING, e, s + 1, a); if (l === 92) { a += n.slice(o, s); const c = n.charCodeAt(s + 1) === 117 ? n.charCodeAt(s + 2) === 123 ? WN(r, s) : qN(r, s) : XN(r, s); a += c.value, s += c.size, o = s; continue; } if (l === 10 || l === 13) break; if (Mc(l)) ++s; else if (Dp(n, s)) s += 2; else throw Un( r.source, s, `Invalid character within String: ${wa( r, s )}.` ); } throw Un(r.source, s, "Unterminated string."); } function WN(r, e) { const n = r.source.body; let i = 0, s = 3; for (; s < 12; ) { const o = n.charCodeAt(e + s++); if (o === 125) { if (s < 5 || !Mc(i)) break; return { value: String.fromCodePoint(i), size: s }; } if (i = i << 4 | Mu(o), i < 0) break; } throw Un( r.source, e, `Invalid Unicode escape sequence: "${n.slice( e, e + s )}".` ); } function qN(r, e) { const n = r.source.body, i = ub(n, e + 2); if (Mc(i)) return { value: String.fromCodePoint(i), size: 6 }; if (gM(i) && n.charCodeAt(e + 6) === 92 && n.charCodeAt(e + 7) === 117) { const s = ub(n, e + 8); if (yM(s)) return { value: String.fromCodePoint(i, s), size: 12 }; } throw Un( r.source, e, `Invalid Unicode escape sequence: "${n.slice(e, e + 6)}".` ); } function ub(r, e) { return Mu(r.charCodeAt(e)) << 12 | Mu(r.charCodeAt(e + 1)) << 8 | Mu(r.charCodeAt(e + 2)) << 4 | Mu(r.charCodeAt(e + 3)); } function Mu(r) { return r >= 48 && r <= 57 ? r - 48 : r >= 65 && r <= 70 ? r - 55 : r >= 97 && r <= 102 ? r - 87 : -1; } function XN(r, e) { const n = r.source.body; switch (n.charCodeAt(e + 1)) { case 34: return { value: '"', size: 2 }; case 92: return { value: "\\", size: 2 }; case 47: return { value: "/", size: 2 }; case 98: return { value: "\b", size: 2 }; case 102: return { value: "\f", size: 2 }; case 110: return { value: ` `, size: 2 }; case 114: return { value: "\r", size: 2 }; case 116: return { value: " ", size: 2 }; } throw Un( r.source, e, `Invalid character escape sequence: "${n.slice( e, e + 2 )}".` ); } function YN(r, e) { const n = r.source.body, i = n.length; let s = r.lineStart, o = e + 3, a = o, l = ""; const c = []; for (; o < i; ) { const u = n.charCodeAt(o); if (u === 34 && n.charCodeAt(o + 1) === 34 && n.charCodeAt(o + 2) === 34) { l += n.slice(a, o), c.push(l); const h = Tn( r, ye.BLOCK_STRING, e, o + 3, // Return a string of the lines joined with U+000A. UN(c).join(` `) ); return r.line += c.length - 1, r.lineStart = s, h; } if (u === 92 && n.charCodeAt(o + 1) === 34 && n.charCodeAt(o + 2) === 34 && n.charCodeAt(o + 3) === 34) {