@restura/core 0.1.0-alpha.6 → 0.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1253 @@
1
+ import {
2
+ __publicField,
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "./chunk-TL4KRYOF.mjs";
6
+
7
+ // ../../node_modules/.pnpm/prettier@3.3.3/node_modules/prettier/plugins/graphql.mjs
8
+ var tt = Object.defineProperty;
9
+ var Ne = (e2, t) => {
10
+ for (var n in t) tt(e2, n, { get: t[n], enumerable: true });
11
+ };
12
+ var Te = {};
13
+ Ne(Te, { languages: () => Pe, options: () => we, parsers: () => Ee, printers: () => sn });
14
+ var nt = (e2, t, n, r) => {
15
+ if (!(e2 && t == null)) return t.replaceAll ? t.replaceAll(n, r) : n.global ? t.replace(n, r) : t.split(n).join(r);
16
+ };
17
+ var Y = nt;
18
+ var re = "indent";
19
+ var se = "group";
20
+ var oe = "if-break";
21
+ var P = "line";
22
+ var ae = "break-parent";
23
+ var xe = () => {
24
+ };
25
+ var b = xe;
26
+ var ce = xe;
27
+ function x(e2) {
28
+ return b(e2), { type: re, contents: e2 };
29
+ }
30
+ function y(e2, t = {}) {
31
+ return b(e2), ce(t.expandedStates, true), { type: se, id: t.id, contents: e2, break: !!t.shouldBreak, expandedStates: t.expandedStates };
32
+ }
33
+ function O(e2, t = "", n = {}) {
34
+ return b(e2), t !== "" && b(t), { type: oe, breakContents: e2, flatContents: t, groupId: n.groupId };
35
+ }
36
+ var mt = { type: ae };
37
+ var Et = { type: P, hard: true };
38
+ var k = { type: P };
39
+ var p = { type: P, soft: true };
40
+ var f = [Et, mt];
41
+ function E(e2, t) {
42
+ b(e2), ce(t);
43
+ let n = [];
44
+ for (let r = 0; r < t.length; r++) r !== 0 && n.push(e2), n.push(t[r]);
45
+ return n;
46
+ }
47
+ function j(e2) {
48
+ return (t, n, r) => {
49
+ let i = !!(r != null && r.backwards);
50
+ if (n === false) return false;
51
+ let { length: s } = t, a = n;
52
+ for (; a >= 0 && a < s; ) {
53
+ let u = t.charAt(a);
54
+ if (e2 instanceof RegExp) {
55
+ if (!e2.test(u)) return a;
56
+ } else if (!e2.includes(u)) return a;
57
+ i ? a-- : a++;
58
+ }
59
+ return a === -1 || a === s ? a : false;
60
+ };
61
+ }
62
+ var An = j(/\s/u);
63
+ var G = j(" ");
64
+ var _e = j(",; ");
65
+ var ye = j(/[^\n\r]/u);
66
+ function Tt(e2, t, n) {
67
+ let r = !!(n != null && n.backwards);
68
+ if (t === false) return false;
69
+ let i = e2.charAt(t);
70
+ if (r) {
71
+ if (e2.charAt(t - 1) === "\r" && i === `
72
+ `) return t - 2;
73
+ if (i === `
74
+ ` || i === "\r" || i === "\u2028" || i === "\u2029") return t - 1;
75
+ } else {
76
+ if (i === "\r" && e2.charAt(t + 1) === `
77
+ `) return t + 2;
78
+ if (i === `
79
+ ` || i === "\r" || i === "\u2028" || i === "\u2029") return t + 1;
80
+ }
81
+ return t;
82
+ }
83
+ var $ = Tt;
84
+ function Nt(e2, t, n = {}) {
85
+ let r = G(e2, n.backwards ? t - 1 : t, n), i = $(e2, r, n);
86
+ return r !== i;
87
+ }
88
+ var Ie = Nt;
89
+ function xt(e2, t) {
90
+ if (t === false) return false;
91
+ if (e2.charAt(t) === "/" && e2.charAt(t + 1) === "*") {
92
+ for (let n = t + 2; n < e2.length; ++n) if (e2.charAt(n) === "*" && e2.charAt(n + 1) === "/") return n + 2;
93
+ }
94
+ return t;
95
+ }
96
+ var Oe = xt;
97
+ function _t(e2, t) {
98
+ return t === false ? false : e2.charAt(t) === "/" && e2.charAt(t + 1) === "/" ? ye(e2, t) : t;
99
+ }
100
+ var De = _t;
101
+ function yt(e2, t) {
102
+ let n = null, r = t;
103
+ for (; r !== n; ) n = r, r = _e(e2, r), r = Oe(e2, r), r = G(e2, r);
104
+ return r = De(e2, r), r = $(e2, r), r !== false && Ie(e2, r);
105
+ }
106
+ var Ae = yt;
107
+ function It(e2) {
108
+ return Array.isArray(e2) && e2.length > 0;
109
+ }
110
+ var ue = It;
111
+ var le = class extends Error {
112
+ constructor(t, n, r = "type") {
113
+ super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`);
114
+ __publicField(this, "name", "UnexpectedNodeError");
115
+ this.node = t;
116
+ }
117
+ };
118
+ var ge = le;
119
+ var F = null;
120
+ function w(e2) {
121
+ if (F !== null && typeof F.property) {
122
+ let t = F;
123
+ return F = w.prototype = null, t;
124
+ }
125
+ return F = w.prototype = e2 != null ? e2 : /* @__PURE__ */ Object.create(null), new w();
126
+ }
127
+ var Ot = 10;
128
+ for (let e2 = 0; e2 <= Ot; e2++) w();
129
+ function pe(e2) {
130
+ return w(e2);
131
+ }
132
+ function Dt(e2, t = "type") {
133
+ pe(e2);
134
+ function n(r) {
135
+ let i = r[t], s = e2[i];
136
+ if (!Array.isArray(s)) throw Object.assign(new Error(`Missing visitor keys for '${i}'.`), { node: r });
137
+ return s;
138
+ }
139
+ return n;
140
+ }
141
+ var ke = Dt;
142
+ var J = class {
143
+ constructor(t, n, r) {
144
+ this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = r;
145
+ }
146
+ get [Symbol.toStringTag]() {
147
+ return "Location";
148
+ }
149
+ toJSON() {
150
+ return { start: this.start, end: this.end };
151
+ }
152
+ };
153
+ var V = class {
154
+ constructor(t, n, r, i, s, a) {
155
+ this.kind = t, this.start = n, this.end = r, this.line = i, this.column = s, this.value = a, this.prev = null, this.next = null;
156
+ }
157
+ get [Symbol.toStringTag]() {
158
+ return "Token";
159
+ }
160
+ toJSON() {
161
+ return { kind: this.kind, value: this.value, line: this.line, column: this.column };
162
+ }
163
+ };
164
+ var X = { 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", "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"] };
165
+ var Jn = new Set(Object.keys(X));
166
+ var S;
167
+ (function(e2) {
168
+ e2.QUERY = "query", e2.MUTATION = "mutation", e2.SUBSCRIPTION = "subscription";
169
+ })(S || (S = {}));
170
+ var At = ke(X, "kind");
171
+ var Se = At;
172
+ function q(e2) {
173
+ return e2.loc.start;
174
+ }
175
+ function Q(e2) {
176
+ return e2.loc.end;
177
+ }
178
+ function Ce(e2) {
179
+ return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u.test(e2);
180
+ }
181
+ function ve(e2) {
182
+ return `# @format
183
+
184
+ ` + e2;
185
+ }
186
+ function gt(e2, t, n) {
187
+ let { node: r } = e2;
188
+ if (!r.description) return "";
189
+ let i = [n("description")];
190
+ return r.kind === "InputValueDefinition" && !r.description.block ? i.push(k) : i.push(f), i;
191
+ }
192
+ var A = gt;
193
+ function kt(e2, t, n) {
194
+ let { node: r } = e2;
195
+ switch (r.kind) {
196
+ case "Document":
197
+ return [...E(f, g(e2, t, n, "definitions")), f];
198
+ case "OperationDefinition": {
199
+ let i = t.originalText[q(r)] !== "{", s = !!r.name;
200
+ return [i ? r.operation : "", i && s ? [" ", n("name")] : "", i && !s && ue(r.variableDefinitions) ? " " : "", be(e2, n), _(e2, n, r), !i && !s ? "" : " ", n("selectionSet")];
201
+ }
202
+ case "FragmentDefinition":
203
+ return ["fragment ", n("name"), be(e2, n), " on ", n("typeCondition"), _(e2, n, r), " ", n("selectionSet")];
204
+ case "SelectionSet":
205
+ return ["{", x([f, E(f, g(e2, t, n, "selections"))]), f, "}"];
206
+ case "Field":
207
+ return y([r.alias ? [n("alias"), ": "] : "", n("name"), r.arguments.length > 0 ? y(["(", x([p, E([O("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", _(e2, n, r), r.selectionSet ? " " : "", n("selectionSet")]);
208
+ case "Name":
209
+ return r.value;
210
+ case "StringValue":
211
+ if (r.block) {
212
+ let i = Y(false, r.value, '"""', String.raw`\"""`).split(`
213
+ `);
214
+ return i.length === 1 && (i[0] = i[0].trim()), i.every((s) => s === "") && (i.length = 0), E(f, ['"""', ...i, '"""']);
215
+ }
216
+ return ['"', Y(false, Y(false, r.value, /["\\]/gu, String.raw`\$&`), `
217
+ `, String.raw`\n`), '"'];
218
+ case "IntValue":
219
+ case "FloatValue":
220
+ case "EnumValue":
221
+ return r.value;
222
+ case "BooleanValue":
223
+ return r.value ? "true" : "false";
224
+ case "NullValue":
225
+ return "null";
226
+ case "Variable":
227
+ return ["$", n("name")];
228
+ case "ListValue":
229
+ return y(["[", x([p, E([O("", ", "), p], e2.map(n, "values"))]), p, "]"]);
230
+ case "ObjectValue": {
231
+ let i = t.bracketSpacing && r.fields.length > 0 ? " " : "";
232
+ return y(["{", i, x([p, E([O("", ", "), p], e2.map(n, "fields"))]), p, O("", i), "}"]);
233
+ }
234
+ case "ObjectField":
235
+ case "Argument":
236
+ return [n("name"), ": ", n("value")];
237
+ case "Directive":
238
+ return ["@", n("name"), r.arguments.length > 0 ? y(["(", x([p, E([O("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : ""];
239
+ case "NamedType":
240
+ return n("name");
241
+ case "VariableDefinition":
242
+ return [n("variable"), ": ", n("type"), r.defaultValue ? [" = ", n("defaultValue")] : "", _(e2, n, r)];
243
+ case "ObjectTypeExtension":
244
+ case "ObjectTypeDefinition":
245
+ case "InputObjectTypeExtension":
246
+ case "InputObjectTypeDefinition":
247
+ case "InterfaceTypeExtension":
248
+ case "InterfaceTypeDefinition": {
249
+ let { kind: i } = r, s = [];
250
+ return i.endsWith("TypeDefinition") ? s.push(A(e2, t, n)) : s.push("extend "), i.startsWith("ObjectType") ? s.push("type") : i.startsWith("InputObjectType") ? s.push("input") : s.push("interface"), s.push(" ", n("name")), !i.startsWith("InputObjectType") && r.interfaces.length > 0 && s.push(" implements ", ...vt(e2, t, n)), s.push(_(e2, n, r)), r.fields.length > 0 && s.push([" {", x([f, E(f, g(e2, t, n, "fields"))]), f, "}"]), s;
251
+ }
252
+ case "FieldDefinition":
253
+ return [A(e2, t, n), n("name"), r.arguments.length > 0 ? y(["(", x([p, E([O("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", ": ", n("type"), _(e2, n, r)];
254
+ case "DirectiveDefinition":
255
+ return [A(e2, t, n), "directive ", "@", n("name"), r.arguments.length > 0 ? y(["(", x([p, E([O("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", r.repeatable ? " repeatable" : "", " on ", ...E(" | ", e2.map(n, "locations"))];
256
+ case "EnumTypeExtension":
257
+ case "EnumTypeDefinition":
258
+ return [A(e2, t, n), r.kind === "EnumTypeExtension" ? "extend " : "", "enum ", n("name"), _(e2, n, r), r.values.length > 0 ? [" {", x([f, E(f, g(e2, t, n, "values"))]), f, "}"] : ""];
259
+ case "EnumValueDefinition":
260
+ return [A(e2, t, n), n("name"), _(e2, n, r)];
261
+ case "InputValueDefinition":
262
+ return [A(e2, t, n), n("name"), ": ", n("type"), r.defaultValue ? [" = ", n("defaultValue")] : "", _(e2, n, r)];
263
+ case "SchemaExtension":
264
+ return ["extend schema", _(e2, n, r), ...r.operationTypes.length > 0 ? [" {", x([f, E(f, g(e2, t, n, "operationTypes"))]), f, "}"] : []];
265
+ case "SchemaDefinition":
266
+ return [A(e2, t, n), "schema", _(e2, n, r), " {", r.operationTypes.length > 0 ? x([f, E(f, g(e2, t, n, "operationTypes"))]) : "", f, "}"];
267
+ case "OperationTypeDefinition":
268
+ return [r.operation, ": ", n("type")];
269
+ case "FragmentSpread":
270
+ return ["...", n("name"), _(e2, n, r)];
271
+ case "InlineFragment":
272
+ return ["...", r.typeCondition ? [" on ", n("typeCondition")] : "", _(e2, n, r), " ", n("selectionSet")];
273
+ case "UnionTypeExtension":
274
+ case "UnionTypeDefinition":
275
+ return y([A(e2, t, n), y([r.kind === "UnionTypeExtension" ? "extend " : "", "union ", n("name"), _(e2, n, r), r.types.length > 0 ? [" =", O("", " "), x([O([k, "| "]), E([k, "| "], e2.map(n, "types"))])] : ""])]);
276
+ case "ScalarTypeExtension":
277
+ case "ScalarTypeDefinition":
278
+ return [A(e2, t, n), r.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", n("name"), _(e2, n, r)];
279
+ case "NonNullType":
280
+ return [n("type"), "!"];
281
+ case "ListType":
282
+ return ["[", n("type"), "]"];
283
+ default:
284
+ throw new ge(r, "Graphql", "kind");
285
+ }
286
+ }
287
+ function _(e2, t, n) {
288
+ if (n.directives.length === 0) return "";
289
+ let r = E(k, e2.map(t, "directives"));
290
+ return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition" ? y([k, r]) : [" ", y(x([p, r]))];
291
+ }
292
+ function g(e2, t, n, r) {
293
+ return e2.map(({ isLast: i, node: s }) => {
294
+ let a = n();
295
+ return !i && Ae(t.originalText, Q(s)) ? [a, f] : a;
296
+ }, r);
297
+ }
298
+ function St(e2) {
299
+ return e2.kind !== "Comment";
300
+ }
301
+ function Ct(e2) {
302
+ let t = e2.node;
303
+ if (t.kind === "Comment") return "#" + t.value.trimEnd();
304
+ throw new Error("Not a comment: " + JSON.stringify(t));
305
+ }
306
+ function vt(e2, t, n) {
307
+ let { node: r } = e2, i = [], { interfaces: s } = r, a = e2.map(n, "interfaces");
308
+ for (let u = 0; u < s.length; u++) {
309
+ let l = s[u];
310
+ i.push(a[u]);
311
+ let T = s[u + 1];
312
+ if (T) {
313
+ let D = t.originalText.slice(l.loc.end, T.loc.start).includes("#");
314
+ i.push(" &", D ? k : " ");
315
+ }
316
+ }
317
+ return i;
318
+ }
319
+ function be(e2, t) {
320
+ let { node: n } = e2;
321
+ return ue(n.variableDefinitions) ? y(["(", x([p, E([O("", ", "), p], e2.map(t, "variableDefinitions"))]), p, ")"]) : "";
322
+ }
323
+ function Le(e2, t) {
324
+ e2.kind === "StringValue" && e2.block && !e2.value.includes(`
325
+ `) && (t.value = e2.value.trim());
326
+ }
327
+ Le.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
328
+ function bt(e2) {
329
+ var n;
330
+ let { node: t } = e2;
331
+ return (n = t == null ? void 0 : t.comments) == null ? void 0 : n.some((r) => r.value.trim() === "prettier-ignore");
332
+ }
333
+ var Lt = { print: kt, massageAstNode: Le, hasPrettierIgnore: bt, insertPragma: ve, printComment: Ct, canAttachComment: St, getVisitorKeys: Se };
334
+ var Re = Lt;
335
+ var Pe = [{ linguistLanguageId: 139, name: "GraphQL", type: "data", color: "#e10098", extensions: [".graphql", ".gql", ".graphqls"], tmScope: "source.graphql", aceMode: "text", parsers: ["graphql"], vscodeLanguageIds: ["graphql"] }];
336
+ var Fe = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
337
+ var Rt = { bracketSpacing: Fe.bracketSpacing };
338
+ var we = Rt;
339
+ var Ee = {};
340
+ Ne(Ee, { graphql: () => rn });
341
+ function Ve(e2) {
342
+ return typeof e2 == "object" && e2 !== null;
343
+ }
344
+ function Be(e2, t) {
345
+ if (!!!e2) throw new Error(t != null ? t : "Unexpected invariant triggered.");
346
+ }
347
+ var Pt = /\r\n|[\n\r]/g;
348
+ function B(e2, t) {
349
+ let n = 0, r = 1;
350
+ for (let i of e2.body.matchAll(Pt)) {
351
+ if (typeof i.index == "number" || Be(false), i.index >= t) break;
352
+ n = i.index + i[0].length, r += 1;
353
+ }
354
+ return { line: r, column: t + 1 - n };
355
+ }
356
+ function Me(e2) {
357
+ return fe(e2.source, B(e2.source, e2.start));
358
+ }
359
+ function fe(e2, t) {
360
+ let n = e2.locationOffset.column - 1, r = "".padStart(n) + e2.body, i = t.line - 1, s = e2.locationOffset.line - 1, a = t.line + s, u = t.line === 1 ? n : 0, l = t.column + u, T = `${e2.name}:${a}:${l}
361
+ `, h = r.split(/\r\n|[\n\r]/g), D = h[i];
362
+ if (D.length > 120) {
363
+ let I = Math.floor(l / 80), ie = l % 80, N = [];
364
+ for (let v = 0; v < D.length; v += 80) N.push(D.slice(v, v + 80));
365
+ return T + Ue([[`${a} |`, N[0]], ...N.slice(1, I + 1).map((v) => ["|", v]), ["|", "^".padStart(ie)], ["|", N[I + 1]]]);
366
+ }
367
+ return T + Ue([[`${a - 1} |`, h[i - 1]], [`${a} |`, D], ["|", "^".padStart(l)], [`${a + 1} |`, h[i + 1]]]);
368
+ }
369
+ function Ue(e2) {
370
+ let t = e2.filter(([r, i]) => i !== void 0), n = Math.max(...t.map(([r]) => r.length));
371
+ return t.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(`
372
+ `);
373
+ }
374
+ function Ft(e2) {
375
+ let t = e2[0];
376
+ return t == null || "kind" in t || "length" in t ? { nodes: t, source: e2[1], positions: e2[2], path: e2[3], originalError: e2[4], extensions: e2[5] } : t;
377
+ }
378
+ var W = class e extends Error {
379
+ constructor(t, ...n) {
380
+ var r, i, s;
381
+ let { nodes: a, source: u, positions: l, path: T, originalError: h, extensions: D } = Ft(n);
382
+ super(t), this.name = "GraphQLError", this.path = T != null ? T : void 0, this.originalError = h != null ? h : void 0, this.nodes = Ye(Array.isArray(a) ? a : a ? [a] : void 0);
383
+ let I = Ye((r = this.nodes) === null || r === void 0 ? void 0 : r.map((N) => N.loc).filter((N) => N != null));
384
+ this.source = u != null ? u : I == null || (i = I[0]) === null || i === void 0 ? void 0 : i.source, this.positions = l != null ? l : I == null ? void 0 : I.map((N) => N.start), this.locations = l && u ? l.map((N) => B(u, N)) : I == null ? void 0 : I.map((N) => B(N.source, N.start));
385
+ let ie = Ve(h == null ? void 0 : h.extensions) ? h == null ? void 0 : h.extensions : void 0;
386
+ this.extensions = (s = D != null ? D : ie) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, { message: { writable: true, enumerable: true }, name: { enumerable: false }, nodes: { enumerable: false }, source: { enumerable: false }, positions: { enumerable: false }, originalError: { enumerable: false } }), h != null && h.stack ? Object.defineProperty(this, "stack", { value: h.stack, writable: true, configurable: true }) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", { value: Error().stack, writable: true, configurable: true });
387
+ }
388
+ get [Symbol.toStringTag]() {
389
+ return "GraphQLError";
390
+ }
391
+ toString() {
392
+ let t = this.message;
393
+ if (this.nodes) for (let n of this.nodes) n.loc && (t += `
394
+
395
+ ` + Me(n.loc));
396
+ else if (this.source && this.locations) for (let n of this.locations) t += `
397
+
398
+ ` + fe(this.source, n);
399
+ return t;
400
+ }
401
+ toJSON() {
402
+ let t = { message: this.message };
403
+ return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
404
+ }
405
+ };
406
+ function Ye(e2) {
407
+ return e2 === void 0 || e2.length === 0 ? void 0 : e2;
408
+ }
409
+ function d(e2, t, n) {
410
+ return new W(`Syntax Error: ${n}`, { source: e2, positions: [t] });
411
+ }
412
+ var H;
413
+ (function(e2) {
414
+ e2.QUERY = "QUERY", e2.MUTATION = "MUTATION", e2.SUBSCRIPTION = "SUBSCRIPTION", e2.FIELD = "FIELD", e2.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e2.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e2.INLINE_FRAGMENT = "INLINE_FRAGMENT", e2.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e2.SCHEMA = "SCHEMA", e2.SCALAR = "SCALAR", e2.OBJECT = "OBJECT", e2.FIELD_DEFINITION = "FIELD_DEFINITION", e2.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e2.INTERFACE = "INTERFACE", e2.UNION = "UNION", e2.ENUM = "ENUM", e2.ENUM_VALUE = "ENUM_VALUE", e2.INPUT_OBJECT = "INPUT_OBJECT", e2.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
415
+ })(H || (H = {}));
416
+ var c;
417
+ (function(e2) {
418
+ e2.NAME = "Name", e2.DOCUMENT = "Document", e2.OPERATION_DEFINITION = "OperationDefinition", e2.VARIABLE_DEFINITION = "VariableDefinition", e2.SELECTION_SET = "SelectionSet", e2.FIELD = "Field", e2.ARGUMENT = "Argument", e2.FRAGMENT_SPREAD = "FragmentSpread", e2.INLINE_FRAGMENT = "InlineFragment", e2.FRAGMENT_DEFINITION = "FragmentDefinition", e2.VARIABLE = "Variable", e2.INT = "IntValue", e2.FLOAT = "FloatValue", e2.STRING = "StringValue", e2.BOOLEAN = "BooleanValue", e2.NULL = "NullValue", e2.ENUM = "EnumValue", e2.LIST = "ListValue", e2.OBJECT = "ObjectValue", e2.OBJECT_FIELD = "ObjectField", e2.DIRECTIVE = "Directive", e2.NAMED_TYPE = "NamedType", e2.LIST_TYPE = "ListType", e2.NON_NULL_TYPE = "NonNullType", e2.SCHEMA_DEFINITION = "SchemaDefinition", e2.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e2.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e2.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e2.FIELD_DEFINITION = "FieldDefinition", e2.INPUT_VALUE_DEFINITION = "InputValueDefinition", e2.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e2.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e2.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e2.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e2.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e2.DIRECTIVE_DEFINITION = "DirectiveDefinition", e2.SCHEMA_EXTENSION = "SchemaExtension", e2.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e2.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e2.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e2.UNION_TYPE_EXTENSION = "UnionTypeExtension", e2.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e2.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
419
+ })(c || (c = {}));
420
+ function je(e2) {
421
+ return e2 === 9 || e2 === 32;
422
+ }
423
+ function L(e2) {
424
+ return e2 >= 48 && e2 <= 57;
425
+ }
426
+ function Ge(e2) {
427
+ return e2 >= 97 && e2 <= 122 || e2 >= 65 && e2 <= 90;
428
+ }
429
+ function he(e2) {
430
+ return Ge(e2) || e2 === 95;
431
+ }
432
+ function $e(e2) {
433
+ return Ge(e2) || L(e2) || e2 === 95;
434
+ }
435
+ function Je(e2) {
436
+ var t;
437
+ let n = Number.MAX_SAFE_INTEGER, r = null, i = -1;
438
+ for (let a = 0; a < e2.length; ++a) {
439
+ var s;
440
+ let u = e2[a], l = wt(u);
441
+ l !== u.length && (r = (s = r) !== null && s !== void 0 ? s : a, i = a, a !== 0 && l < n && (n = l));
442
+ }
443
+ return e2.map((a, u) => u === 0 ? a : a.slice(n)).slice((t = r) !== null && t !== void 0 ? t : 0, i + 1);
444
+ }
445
+ function wt(e2) {
446
+ let t = 0;
447
+ for (; t < e2.length && je(e2.charCodeAt(t)); ) ++t;
448
+ return t;
449
+ }
450
+ var o;
451
+ (function(e2) {
452
+ e2.SOF = "<SOF>", e2.EOF = "<EOF>", e2.BANG = "!", e2.DOLLAR = "$", e2.AMP = "&", e2.PAREN_L = "(", e2.PAREN_R = ")", e2.SPREAD = "...", e2.COLON = ":", e2.EQUALS = "=", e2.AT = "@", e2.BRACKET_L = "[", e2.BRACKET_R = "]", e2.BRACE_L = "{", e2.PIPE = "|", e2.BRACE_R = "}", e2.NAME = "Name", e2.INT = "Int", e2.FLOAT = "Float", e2.STRING = "String", e2.BLOCK_STRING = "BlockString", e2.COMMENT = "Comment";
453
+ })(o || (o = {}));
454
+ var z = class {
455
+ constructor(t) {
456
+ let n = new V(o.SOF, 0, 0, 0, 0);
457
+ this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
458
+ }
459
+ get [Symbol.toStringTag]() {
460
+ return "Lexer";
461
+ }
462
+ advance() {
463
+ return this.lastToken = this.token, this.token = this.lookahead();
464
+ }
465
+ lookahead() {
466
+ let t = this.token;
467
+ if (t.kind !== o.EOF) do
468
+ if (t.next) t = t.next;
469
+ else {
470
+ let n = Vt(this, t.end);
471
+ t.next = n, n.prev = t, t = n;
472
+ }
473
+ while (t.kind === o.COMMENT);
474
+ return t;
475
+ }
476
+ };
477
+ function qe(e2) {
478
+ return e2 === o.BANG || e2 === o.DOLLAR || e2 === o.AMP || e2 === o.PAREN_L || e2 === o.PAREN_R || e2 === o.SPREAD || e2 === o.COLON || e2 === o.EQUALS || e2 === o.AT || e2 === o.BRACKET_L || e2 === o.BRACKET_R || e2 === o.BRACE_L || e2 === o.PIPE || e2 === o.BRACE_R;
479
+ }
480
+ function R(e2) {
481
+ return e2 >= 0 && e2 <= 55295 || e2 >= 57344 && e2 <= 1114111;
482
+ }
483
+ function K(e2, t) {
484
+ return Qe(e2.charCodeAt(t)) && We(e2.charCodeAt(t + 1));
485
+ }
486
+ function Qe(e2) {
487
+ return e2 >= 55296 && e2 <= 56319;
488
+ }
489
+ function We(e2) {
490
+ return e2 >= 56320 && e2 <= 57343;
491
+ }
492
+ function C(e2, t) {
493
+ let n = e2.source.body.codePointAt(t);
494
+ if (n === void 0) return o.EOF;
495
+ if (n >= 32 && n <= 126) {
496
+ let r = String.fromCodePoint(n);
497
+ return r === '"' ? `'"'` : `"${r}"`;
498
+ }
499
+ return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
500
+ }
501
+ function m(e2, t, n, r, i) {
502
+ let s = e2.line, a = 1 + n - e2.lineStart;
503
+ return new V(t, n, r, s, a, i);
504
+ }
505
+ function Vt(e2, t) {
506
+ let n = e2.source.body, r = n.length, i = t;
507
+ for (; i < r; ) {
508
+ let s = n.charCodeAt(i);
509
+ switch (s) {
510
+ case 65279:
511
+ case 9:
512
+ case 32:
513
+ case 44:
514
+ ++i;
515
+ continue;
516
+ case 10:
517
+ ++i, ++e2.line, e2.lineStart = i;
518
+ continue;
519
+ case 13:
520
+ n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, ++e2.line, e2.lineStart = i;
521
+ continue;
522
+ case 35:
523
+ return Bt(e2, i);
524
+ case 33:
525
+ return m(e2, o.BANG, i, i + 1);
526
+ case 36:
527
+ return m(e2, o.DOLLAR, i, i + 1);
528
+ case 38:
529
+ return m(e2, o.AMP, i, i + 1);
530
+ case 40:
531
+ return m(e2, o.PAREN_L, i, i + 1);
532
+ case 41:
533
+ return m(e2, o.PAREN_R, i, i + 1);
534
+ case 46:
535
+ if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46) return m(e2, o.SPREAD, i, i + 3);
536
+ break;
537
+ case 58:
538
+ return m(e2, o.COLON, i, i + 1);
539
+ case 61:
540
+ return m(e2, o.EQUALS, i, i + 1);
541
+ case 64:
542
+ return m(e2, o.AT, i, i + 1);
543
+ case 91:
544
+ return m(e2, o.BRACKET_L, i, i + 1);
545
+ case 93:
546
+ return m(e2, o.BRACKET_R, i, i + 1);
547
+ case 123:
548
+ return m(e2, o.BRACE_L, i, i + 1);
549
+ case 124:
550
+ return m(e2, o.PIPE, i, i + 1);
551
+ case 125:
552
+ return m(e2, o.BRACE_R, i, i + 1);
553
+ case 34:
554
+ return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? $t(e2, i) : Mt(e2, i);
555
+ }
556
+ if (L(s) || s === 45) return Ut(e2, i, s);
557
+ if (he(s)) return Jt(e2, i);
558
+ throw d(e2.source, i, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : R(s) || K(n, i) ? `Unexpected character: ${C(e2, i)}.` : `Invalid character: ${C(e2, i)}.`);
559
+ }
560
+ return m(e2, o.EOF, r, r);
561
+ }
562
+ function Bt(e2, t) {
563
+ let n = e2.source.body, r = n.length, i = t + 1;
564
+ for (; i < r; ) {
565
+ let s = n.charCodeAt(i);
566
+ if (s === 10 || s === 13) break;
567
+ if (R(s)) ++i;
568
+ else if (K(n, i)) i += 2;
569
+ else break;
570
+ }
571
+ return m(e2, o.COMMENT, t, i, n.slice(t + 1, i));
572
+ }
573
+ function Ut(e2, t, n) {
574
+ let r = e2.source.body, i = t, s = n, a = false;
575
+ if (s === 45 && (s = r.charCodeAt(++i)), s === 48) {
576
+ if (s = r.charCodeAt(++i), L(s)) throw d(e2.source, i, `Invalid number, unexpected digit after 0: ${C(e2, i)}.`);
577
+ } else i = de(e2, i, s), s = r.charCodeAt(i);
578
+ if (s === 46 && (a = true, s = r.charCodeAt(++i), i = de(e2, i, s), s = r.charCodeAt(i)), (s === 69 || s === 101) && (a = true, s = r.charCodeAt(++i), (s === 43 || s === 45) && (s = r.charCodeAt(++i)), i = de(e2, i, s), s = r.charCodeAt(i)), s === 46 || he(s)) throw d(e2.source, i, `Invalid number, expected digit but got: ${C(e2, i)}.`);
579
+ return m(e2, a ? o.FLOAT : o.INT, t, i, r.slice(t, i));
580
+ }
581
+ function de(e2, t, n) {
582
+ if (!L(n)) throw d(e2.source, t, `Invalid number, expected digit but got: ${C(e2, t)}.`);
583
+ let r = e2.source.body, i = t + 1;
584
+ for (; L(r.charCodeAt(i)); ) ++i;
585
+ return i;
586
+ }
587
+ function Mt(e2, t) {
588
+ let n = e2.source.body, r = n.length, i = t + 1, s = i, a = "";
589
+ for (; i < r; ) {
590
+ let u = n.charCodeAt(i);
591
+ if (u === 34) return a += n.slice(s, i), m(e2, o.STRING, t, i + 1, a);
592
+ if (u === 92) {
593
+ a += n.slice(s, i);
594
+ let l = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? Yt(e2, i) : jt(e2, i) : Gt(e2, i);
595
+ a += l.value, i += l.size, s = i;
596
+ continue;
597
+ }
598
+ if (u === 10 || u === 13) break;
599
+ if (R(u)) ++i;
600
+ else if (K(n, i)) i += 2;
601
+ else throw d(e2.source, i, `Invalid character within String: ${C(e2, i)}.`);
602
+ }
603
+ throw d(e2.source, i, "Unterminated string.");
604
+ }
605
+ function Yt(e2, t) {
606
+ let n = e2.source.body, r = 0, i = 3;
607
+ for (; i < 12; ) {
608
+ let s = n.charCodeAt(t + i++);
609
+ if (s === 125) {
610
+ if (i < 5 || !R(r)) break;
611
+ return { value: String.fromCodePoint(r), size: i };
612
+ }
613
+ if (r = r << 4 | U(s), r < 0) break;
614
+ }
615
+ throw d(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + i)}".`);
616
+ }
617
+ function jt(e2, t) {
618
+ let n = e2.source.body, r = Xe(n, t + 2);
619
+ if (R(r)) return { value: String.fromCodePoint(r), size: 6 };
620
+ if (Qe(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
621
+ let i = Xe(n, t + 8);
622
+ if (We(i)) return { value: String.fromCodePoint(r, i), size: 12 };
623
+ }
624
+ throw d(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`);
625
+ }
626
+ function Xe(e2, t) {
627
+ return U(e2.charCodeAt(t)) << 12 | U(e2.charCodeAt(t + 1)) << 8 | U(e2.charCodeAt(t + 2)) << 4 | U(e2.charCodeAt(t + 3));
628
+ }
629
+ function U(e2) {
630
+ return e2 >= 48 && e2 <= 57 ? e2 - 48 : e2 >= 65 && e2 <= 70 ? e2 - 55 : e2 >= 97 && e2 <= 102 ? e2 - 87 : -1;
631
+ }
632
+ function Gt(e2, t) {
633
+ let n = e2.source.body;
634
+ switch (n.charCodeAt(t + 1)) {
635
+ case 34:
636
+ return { value: '"', size: 2 };
637
+ case 92:
638
+ return { value: "\\", size: 2 };
639
+ case 47:
640
+ return { value: "/", size: 2 };
641
+ case 98:
642
+ return { value: "\b", size: 2 };
643
+ case 102:
644
+ return { value: "\f", size: 2 };
645
+ case 110:
646
+ return { value: `
647
+ `, size: 2 };
648
+ case 114:
649
+ return { value: "\r", size: 2 };
650
+ case 116:
651
+ return { value: " ", size: 2 };
652
+ }
653
+ throw d(e2.source, t, `Invalid character escape sequence: "${n.slice(t, t + 2)}".`);
654
+ }
655
+ function $t(e2, t) {
656
+ let n = e2.source.body, r = n.length, i = e2.lineStart, s = t + 3, a = s, u = "", l = [];
657
+ for (; s < r; ) {
658
+ let T = n.charCodeAt(s);
659
+ if (T === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
660
+ u += n.slice(a, s), l.push(u);
661
+ let h = m(e2, o.BLOCK_STRING, t, s + 3, Je(l).join(`
662
+ `));
663
+ return e2.line += l.length - 1, e2.lineStart = i, h;
664
+ }
665
+ if (T === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
666
+ u += n.slice(a, s), a = s + 1, s += 4;
667
+ continue;
668
+ }
669
+ if (T === 10 || T === 13) {
670
+ u += n.slice(a, s), l.push(u), T === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", a = s, i = s;
671
+ continue;
672
+ }
673
+ if (R(T)) ++s;
674
+ else if (K(n, s)) s += 2;
675
+ else throw d(e2.source, s, `Invalid character within String: ${C(e2, s)}.`);
676
+ }
677
+ throw d(e2.source, s, "Unterminated string.");
678
+ }
679
+ function Jt(e2, t) {
680
+ let n = e2.source.body, r = n.length, i = t + 1;
681
+ for (; i < r; ) {
682
+ let s = n.charCodeAt(i);
683
+ if ($e(s)) ++i;
684
+ else break;
685
+ }
686
+ return m(e2, o.NAME, t, i, n.slice(t, i));
687
+ }
688
+ function Z(e2, t) {
689
+ if (!!!e2) throw new Error(t);
690
+ }
691
+ function ee(e2) {
692
+ return te(e2, []);
693
+ }
694
+ function te(e2, t) {
695
+ switch (typeof e2) {
696
+ case "string":
697
+ return JSON.stringify(e2);
698
+ case "function":
699
+ return e2.name ? `[function ${e2.name}]` : "[function]";
700
+ case "object":
701
+ return Xt(e2, t);
702
+ default:
703
+ return String(e2);
704
+ }
705
+ }
706
+ function Xt(e2, t) {
707
+ if (e2 === null) return "null";
708
+ if (t.includes(e2)) return "[Circular]";
709
+ let n = [...t, e2];
710
+ if (qt(e2)) {
711
+ let r = e2.toJSON();
712
+ if (r !== e2) return typeof r == "string" ? r : te(r, n);
713
+ } else if (Array.isArray(e2)) return Wt(e2, n);
714
+ return Qt(e2, n);
715
+ }
716
+ function qt(e2) {
717
+ return typeof e2.toJSON == "function";
718
+ }
719
+ function Qt(e2, t) {
720
+ let n = Object.entries(e2);
721
+ return n.length === 0 ? "{}" : t.length > 2 ? "[" + Ht(e2) + "]" : "{ " + n.map(([i, s]) => i + ": " + te(s, t)).join(", ") + " }";
722
+ }
723
+ function Wt(e2, t) {
724
+ if (e2.length === 0) return "[]";
725
+ if (t.length > 2) return "[Array]";
726
+ let n = Math.min(10, e2.length), r = e2.length - n, i = [];
727
+ for (let s = 0; s < n; ++s) i.push(te(e2[s], t));
728
+ return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
729
+ }
730
+ function Ht(e2) {
731
+ let t = Object.prototype.toString.call(e2).replace(/^\[object /, "").replace(/]$/, "");
732
+ if (t === "Object" && typeof e2.constructor == "function") {
733
+ let n = e2.constructor.name;
734
+ if (typeof n == "string" && n !== "") return n;
735
+ }
736
+ return t;
737
+ }
738
+ var zt = globalThis.process && true;
739
+ var He = zt ? function(t, n) {
740
+ return t instanceof n;
741
+ } : function(t, n) {
742
+ if (t instanceof n) return true;
743
+ if (typeof t == "object" && t !== null) {
744
+ var r;
745
+ let i = n.prototype[Symbol.toStringTag], s = Symbol.toStringTag in t ? t[Symbol.toStringTag] : (r = t.constructor) === null || r === void 0 ? void 0 : r.name;
746
+ if (i === s) {
747
+ let a = ee(t);
748
+ throw new Error(`Cannot use ${i} "${a}" from another module or realm.
749
+
750
+ Ensure that there is only one instance of "graphql" in the node_modules
751
+ directory. If different versions of "graphql" are the dependencies of other
752
+ relied on modules, use "resolutions" to ensure only one version is installed.
753
+
754
+ https://yarnpkg.com/en/docs/selective-version-resolutions
755
+
756
+ Duplicate "graphql" modules cannot be used at the same time since different
757
+ versions may have different capabilities and behavior. The data from one
758
+ version used in the function from another could produce confusing and
759
+ spurious results.`);
760
+ }
761
+ }
762
+ return false;
763
+ };
764
+ var M = class {
765
+ constructor(t, n = "GraphQL request", r = { line: 1, column: 1 }) {
766
+ typeof t == "string" || Z(false, `Body must be a string. Received: ${ee(t)}.`), this.body = t, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || Z(false, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || Z(false, "column in locationOffset is 1-indexed and must be positive.");
767
+ }
768
+ get [Symbol.toStringTag]() {
769
+ return "Source";
770
+ }
771
+ };
772
+ function ze(e2) {
773
+ return He(e2, M);
774
+ }
775
+ function Ke(e2, t) {
776
+ return new me(e2, t).parseDocument();
777
+ }
778
+ var me = class {
779
+ constructor(t, n = {}) {
780
+ let r = ze(t) ? t : new M(t);
781
+ this._lexer = new z(r), this._options = n, this._tokenCounter = 0;
782
+ }
783
+ parseName() {
784
+ let t = this.expectToken(o.NAME);
785
+ return this.node(t, { kind: c.NAME, value: t.value });
786
+ }
787
+ parseDocument() {
788
+ return this.node(this._lexer.token, { kind: c.DOCUMENT, definitions: this.many(o.SOF, this.parseDefinition, o.EOF) });
789
+ }
790
+ parseDefinition() {
791
+ if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
792
+ let t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
793
+ if (n.kind === o.NAME) {
794
+ switch (n.value) {
795
+ case "schema":
796
+ return this.parseSchemaDefinition();
797
+ case "scalar":
798
+ return this.parseScalarTypeDefinition();
799
+ case "type":
800
+ return this.parseObjectTypeDefinition();
801
+ case "interface":
802
+ return this.parseInterfaceTypeDefinition();
803
+ case "union":
804
+ return this.parseUnionTypeDefinition();
805
+ case "enum":
806
+ return this.parseEnumTypeDefinition();
807
+ case "input":
808
+ return this.parseInputObjectTypeDefinition();
809
+ case "directive":
810
+ return this.parseDirectiveDefinition();
811
+ }
812
+ if (t) throw d(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are supported only on type definitions.");
813
+ switch (n.value) {
814
+ case "query":
815
+ case "mutation":
816
+ case "subscription":
817
+ return this.parseOperationDefinition();
818
+ case "fragment":
819
+ return this.parseFragmentDefinition();
820
+ case "extend":
821
+ return this.parseTypeSystemExtension();
822
+ }
823
+ }
824
+ throw this.unexpected(n);
825
+ }
826
+ parseOperationDefinition() {
827
+ let t = this._lexer.token;
828
+ if (this.peek(o.BRACE_L)) return this.node(t, { kind: c.OPERATION_DEFINITION, operation: S.QUERY, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() });
829
+ let n = this.parseOperationType(), r;
830
+ return this.peek(o.NAME) && (r = this.parseName()), this.node(t, { kind: c.OPERATION_DEFINITION, operation: n, name: r, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
831
+ }
832
+ parseOperationType() {
833
+ let t = this.expectToken(o.NAME);
834
+ switch (t.value) {
835
+ case "query":
836
+ return S.QUERY;
837
+ case "mutation":
838
+ return S.MUTATION;
839
+ case "subscription":
840
+ return S.SUBSCRIPTION;
841
+ }
842
+ throw this.unexpected(t);
843
+ }
844
+ parseVariableDefinitions() {
845
+ return this.optionalMany(o.PAREN_L, this.parseVariableDefinition, o.PAREN_R);
846
+ }
847
+ parseVariableDefinition() {
848
+ return this.node(this._lexer.token, { kind: c.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(o.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(o.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() });
849
+ }
850
+ parseVariable() {
851
+ let t = this._lexer.token;
852
+ return this.expectToken(o.DOLLAR), this.node(t, { kind: c.VARIABLE, name: this.parseName() });
853
+ }
854
+ parseSelectionSet() {
855
+ return this.node(this._lexer.token, { kind: c.SELECTION_SET, selections: this.many(o.BRACE_L, this.parseSelection, o.BRACE_R) });
856
+ }
857
+ parseSelection() {
858
+ return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
859
+ }
860
+ parseField() {
861
+ let t = this._lexer.token, n = this.parseName(), r, i;
862
+ return this.expectOptionalToken(o.COLON) ? (r = n, i = this.parseName()) : i = n, this.node(t, { kind: c.FIELD, alias: r, name: i, arguments: this.parseArguments(false), directives: this.parseDirectives(false), selectionSet: this.peek(o.BRACE_L) ? this.parseSelectionSet() : void 0 });
863
+ }
864
+ parseArguments(t) {
865
+ let n = t ? this.parseConstArgument : this.parseArgument;
866
+ return this.optionalMany(o.PAREN_L, n, o.PAREN_R);
867
+ }
868
+ parseArgument(t = false) {
869
+ let n = this._lexer.token, r = this.parseName();
870
+ return this.expectToken(o.COLON), this.node(n, { kind: c.ARGUMENT, name: r, value: this.parseValueLiteral(t) });
871
+ }
872
+ parseConstArgument() {
873
+ return this.parseArgument(true);
874
+ }
875
+ parseFragment() {
876
+ let t = this._lexer.token;
877
+ this.expectToken(o.SPREAD);
878
+ let n = this.expectOptionalKeyword("on");
879
+ return !n && this.peek(o.NAME) ? this.node(t, { kind: c.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(false) }) : this.node(t, { kind: c.INLINE_FRAGMENT, typeCondition: n ? this.parseNamedType() : void 0, directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
880
+ }
881
+ parseFragmentDefinition() {
882
+ let t = this._lexer.token;
883
+ return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === true ? this.node(t, { kind: c.FRAGMENT_DEFINITION, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() }) : this.node(t, { kind: c.FRAGMENT_DEFINITION, name: this.parseFragmentName(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
884
+ }
885
+ parseFragmentName() {
886
+ if (this._lexer.token.value === "on") throw this.unexpected();
887
+ return this.parseName();
888
+ }
889
+ parseValueLiteral(t) {
890
+ let n = this._lexer.token;
891
+ switch (n.kind) {
892
+ case o.BRACKET_L:
893
+ return this.parseList(t);
894
+ case o.BRACE_L:
895
+ return this.parseObject(t);
896
+ case o.INT:
897
+ return this.advanceLexer(), this.node(n, { kind: c.INT, value: n.value });
898
+ case o.FLOAT:
899
+ return this.advanceLexer(), this.node(n, { kind: c.FLOAT, value: n.value });
900
+ case o.STRING:
901
+ case o.BLOCK_STRING:
902
+ return this.parseStringLiteral();
903
+ case o.NAME:
904
+ switch (this.advanceLexer(), n.value) {
905
+ case "true":
906
+ return this.node(n, { kind: c.BOOLEAN, value: true });
907
+ case "false":
908
+ return this.node(n, { kind: c.BOOLEAN, value: false });
909
+ case "null":
910
+ return this.node(n, { kind: c.NULL });
911
+ default:
912
+ return this.node(n, { kind: c.ENUM, value: n.value });
913
+ }
914
+ case o.DOLLAR:
915
+ if (t) if (this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME) {
916
+ let r = this._lexer.token.value;
917
+ throw d(this._lexer.source, n.start, `Unexpected variable "$${r}" in constant value.`);
918
+ } else throw this.unexpected(n);
919
+ return this.parseVariable();
920
+ default:
921
+ throw this.unexpected();
922
+ }
923
+ }
924
+ parseConstValueLiteral() {
925
+ return this.parseValueLiteral(true);
926
+ }
927
+ parseStringLiteral() {
928
+ let t = this._lexer.token;
929
+ return this.advanceLexer(), this.node(t, { kind: c.STRING, value: t.value, block: t.kind === o.BLOCK_STRING });
930
+ }
931
+ parseList(t) {
932
+ let n = () => this.parseValueLiteral(t);
933
+ return this.node(this._lexer.token, { kind: c.LIST, values: this.any(o.BRACKET_L, n, o.BRACKET_R) });
934
+ }
935
+ parseObject(t) {
936
+ let n = () => this.parseObjectField(t);
937
+ return this.node(this._lexer.token, { kind: c.OBJECT, fields: this.any(o.BRACE_L, n, o.BRACE_R) });
938
+ }
939
+ parseObjectField(t) {
940
+ let n = this._lexer.token, r = this.parseName();
941
+ return this.expectToken(o.COLON), this.node(n, { kind: c.OBJECT_FIELD, name: r, value: this.parseValueLiteral(t) });
942
+ }
943
+ parseDirectives(t) {
944
+ let n = [];
945
+ for (; this.peek(o.AT); ) n.push(this.parseDirective(t));
946
+ return n;
947
+ }
948
+ parseConstDirectives() {
949
+ return this.parseDirectives(true);
950
+ }
951
+ parseDirective(t) {
952
+ let n = this._lexer.token;
953
+ return this.expectToken(o.AT), this.node(n, { kind: c.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(t) });
954
+ }
955
+ parseTypeReference() {
956
+ let t = this._lexer.token, n;
957
+ if (this.expectOptionalToken(o.BRACKET_L)) {
958
+ let r = this.parseTypeReference();
959
+ this.expectToken(o.BRACKET_R), n = this.node(t, { kind: c.LIST_TYPE, type: r });
960
+ } else n = this.parseNamedType();
961
+ return this.expectOptionalToken(o.BANG) ? this.node(t, { kind: c.NON_NULL_TYPE, type: n }) : n;
962
+ }
963
+ parseNamedType() {
964
+ return this.node(this._lexer.token, { kind: c.NAMED_TYPE, name: this.parseName() });
965
+ }
966
+ peekDescription() {
967
+ return this.peek(o.STRING) || this.peek(o.BLOCK_STRING);
968
+ }
969
+ parseDescription() {
970
+ if (this.peekDescription()) return this.parseStringLiteral();
971
+ }
972
+ parseSchemaDefinition() {
973
+ let t = this._lexer.token, n = this.parseDescription();
974
+ this.expectKeyword("schema");
975
+ let r = this.parseConstDirectives(), i = this.many(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
976
+ return this.node(t, { kind: c.SCHEMA_DEFINITION, description: n, directives: r, operationTypes: i });
977
+ }
978
+ parseOperationTypeDefinition() {
979
+ let t = this._lexer.token, n = this.parseOperationType();
980
+ this.expectToken(o.COLON);
981
+ let r = this.parseNamedType();
982
+ return this.node(t, { kind: c.OPERATION_TYPE_DEFINITION, operation: n, type: r });
983
+ }
984
+ parseScalarTypeDefinition() {
985
+ let t = this._lexer.token, n = this.parseDescription();
986
+ this.expectKeyword("scalar");
987
+ let r = this.parseName(), i = this.parseConstDirectives();
988
+ return this.node(t, { kind: c.SCALAR_TYPE_DEFINITION, description: n, name: r, directives: i });
989
+ }
990
+ parseObjectTypeDefinition() {
991
+ let t = this._lexer.token, n = this.parseDescription();
992
+ this.expectKeyword("type");
993
+ let r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
994
+ return this.node(t, { kind: c.OBJECT_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: s, fields: a });
995
+ }
996
+ parseImplementsInterfaces() {
997
+ return this.expectOptionalKeyword("implements") ? this.delimitedMany(o.AMP, this.parseNamedType) : [];
998
+ }
999
+ parseFieldsDefinition() {
1000
+ return this.optionalMany(o.BRACE_L, this.parseFieldDefinition, o.BRACE_R);
1001
+ }
1002
+ parseFieldDefinition() {
1003
+ let t = this._lexer.token, n = this.parseDescription(), r = this.parseName(), i = this.parseArgumentDefs();
1004
+ this.expectToken(o.COLON);
1005
+ let s = this.parseTypeReference(), a = this.parseConstDirectives();
1006
+ return this.node(t, { kind: c.FIELD_DEFINITION, description: n, name: r, arguments: i, type: s, directives: a });
1007
+ }
1008
+ parseArgumentDefs() {
1009
+ return this.optionalMany(o.PAREN_L, this.parseInputValueDef, o.PAREN_R);
1010
+ }
1011
+ parseInputValueDef() {
1012
+ let t = this._lexer.token, n = this.parseDescription(), r = this.parseName();
1013
+ this.expectToken(o.COLON);
1014
+ let i = this.parseTypeReference(), s;
1015
+ this.expectOptionalToken(o.EQUALS) && (s = this.parseConstValueLiteral());
1016
+ let a = this.parseConstDirectives();
1017
+ return this.node(t, { kind: c.INPUT_VALUE_DEFINITION, description: n, name: r, type: i, defaultValue: s, directives: a });
1018
+ }
1019
+ parseInterfaceTypeDefinition() {
1020
+ let t = this._lexer.token, n = this.parseDescription();
1021
+ this.expectKeyword("interface");
1022
+ let r = this.parseName(), i = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1023
+ return this.node(t, { kind: c.INTERFACE_TYPE_DEFINITION, description: n, name: r, interfaces: i, directives: s, fields: a });
1024
+ }
1025
+ parseUnionTypeDefinition() {
1026
+ let t = this._lexer.token, n = this.parseDescription();
1027
+ this.expectKeyword("union");
1028
+ let r = this.parseName(), i = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
1029
+ return this.node(t, { kind: c.UNION_TYPE_DEFINITION, description: n, name: r, directives: i, types: s });
1030
+ }
1031
+ parseUnionMemberTypes() {
1032
+ return this.expectOptionalToken(o.EQUALS) ? this.delimitedMany(o.PIPE, this.parseNamedType) : [];
1033
+ }
1034
+ parseEnumTypeDefinition() {
1035
+ let t = this._lexer.token, n = this.parseDescription();
1036
+ this.expectKeyword("enum");
1037
+ let r = this.parseName(), i = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
1038
+ return this.node(t, { kind: c.ENUM_TYPE_DEFINITION, description: n, name: r, directives: i, values: s });
1039
+ }
1040
+ parseEnumValuesDefinition() {
1041
+ return this.optionalMany(o.BRACE_L, this.parseEnumValueDefinition, o.BRACE_R);
1042
+ }
1043
+ parseEnumValueDefinition() {
1044
+ let t = this._lexer.token, n = this.parseDescription(), r = this.parseEnumValueName(), i = this.parseConstDirectives();
1045
+ return this.node(t, { kind: c.ENUM_VALUE_DEFINITION, description: n, name: r, directives: i });
1046
+ }
1047
+ parseEnumValueName() {
1048
+ if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw d(this._lexer.source, this._lexer.token.start, `${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);
1049
+ return this.parseName();
1050
+ }
1051
+ parseInputObjectTypeDefinition() {
1052
+ let t = this._lexer.token, n = this.parseDescription();
1053
+ this.expectKeyword("input");
1054
+ let r = this.parseName(), i = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
1055
+ return this.node(t, { kind: c.INPUT_OBJECT_TYPE_DEFINITION, description: n, name: r, directives: i, fields: s });
1056
+ }
1057
+ parseInputFieldsDefinition() {
1058
+ return this.optionalMany(o.BRACE_L, this.parseInputValueDef, o.BRACE_R);
1059
+ }
1060
+ parseTypeSystemExtension() {
1061
+ let t = this._lexer.lookahead();
1062
+ if (t.kind === o.NAME) switch (t.value) {
1063
+ case "schema":
1064
+ return this.parseSchemaExtension();
1065
+ case "scalar":
1066
+ return this.parseScalarTypeExtension();
1067
+ case "type":
1068
+ return this.parseObjectTypeExtension();
1069
+ case "interface":
1070
+ return this.parseInterfaceTypeExtension();
1071
+ case "union":
1072
+ return this.parseUnionTypeExtension();
1073
+ case "enum":
1074
+ return this.parseEnumTypeExtension();
1075
+ case "input":
1076
+ return this.parseInputObjectTypeExtension();
1077
+ }
1078
+ throw this.unexpected(t);
1079
+ }
1080
+ parseSchemaExtension() {
1081
+ let t = this._lexer.token;
1082
+ this.expectKeyword("extend"), this.expectKeyword("schema");
1083
+ let n = this.parseConstDirectives(), r = this.optionalMany(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
1084
+ if (n.length === 0 && r.length === 0) throw this.unexpected();
1085
+ return this.node(t, { kind: c.SCHEMA_EXTENSION, directives: n, operationTypes: r });
1086
+ }
1087
+ parseScalarTypeExtension() {
1088
+ let t = this._lexer.token;
1089
+ this.expectKeyword("extend"), this.expectKeyword("scalar");
1090
+ let n = this.parseName(), r = this.parseConstDirectives();
1091
+ if (r.length === 0) throw this.unexpected();
1092
+ return this.node(t, { kind: c.SCALAR_TYPE_EXTENSION, name: n, directives: r });
1093
+ }
1094
+ parseObjectTypeExtension() {
1095
+ let t = this._lexer.token;
1096
+ this.expectKeyword("extend"), this.expectKeyword("type");
1097
+ let n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1098
+ if (r.length === 0 && i.length === 0 && s.length === 0) throw this.unexpected();
1099
+ return this.node(t, { kind: c.OBJECT_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: s });
1100
+ }
1101
+ parseInterfaceTypeExtension() {
1102
+ let t = this._lexer.token;
1103
+ this.expectKeyword("extend"), this.expectKeyword("interface");
1104
+ let n = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1105
+ if (r.length === 0 && i.length === 0 && s.length === 0) throw this.unexpected();
1106
+ return this.node(t, { kind: c.INTERFACE_TYPE_EXTENSION, name: n, interfaces: r, directives: i, fields: s });
1107
+ }
1108
+ parseUnionTypeExtension() {
1109
+ let t = this._lexer.token;
1110
+ this.expectKeyword("extend"), this.expectKeyword("union");
1111
+ let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseUnionMemberTypes();
1112
+ if (r.length === 0 && i.length === 0) throw this.unexpected();
1113
+ return this.node(t, { kind: c.UNION_TYPE_EXTENSION, name: n, directives: r, types: i });
1114
+ }
1115
+ parseEnumTypeExtension() {
1116
+ let t = this._lexer.token;
1117
+ this.expectKeyword("extend"), this.expectKeyword("enum");
1118
+ let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseEnumValuesDefinition();
1119
+ if (r.length === 0 && i.length === 0) throw this.unexpected();
1120
+ return this.node(t, { kind: c.ENUM_TYPE_EXTENSION, name: n, directives: r, values: i });
1121
+ }
1122
+ parseInputObjectTypeExtension() {
1123
+ let t = this._lexer.token;
1124
+ this.expectKeyword("extend"), this.expectKeyword("input");
1125
+ let n = this.parseName(), r = this.parseConstDirectives(), i = this.parseInputFieldsDefinition();
1126
+ if (r.length === 0 && i.length === 0) throw this.unexpected();
1127
+ return this.node(t, { kind: c.INPUT_OBJECT_TYPE_EXTENSION, name: n, directives: r, fields: i });
1128
+ }
1129
+ parseDirectiveDefinition() {
1130
+ let t = this._lexer.token, n = this.parseDescription();
1131
+ this.expectKeyword("directive"), this.expectToken(o.AT);
1132
+ let r = this.parseName(), i = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
1133
+ this.expectKeyword("on");
1134
+ let a = this.parseDirectiveLocations();
1135
+ return this.node(t, { kind: c.DIRECTIVE_DEFINITION, description: n, name: r, arguments: i, repeatable: s, locations: a });
1136
+ }
1137
+ parseDirectiveLocations() {
1138
+ return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
1139
+ }
1140
+ parseDirectiveLocation() {
1141
+ let t = this._lexer.token, n = this.parseName();
1142
+ if (Object.prototype.hasOwnProperty.call(H, n.value)) return n;
1143
+ throw this.unexpected(t);
1144
+ }
1145
+ node(t, n) {
1146
+ return this._options.noLocation !== true && (n.loc = new J(t, this._lexer.lastToken, this._lexer.source)), n;
1147
+ }
1148
+ peek(t) {
1149
+ return this._lexer.token.kind === t;
1150
+ }
1151
+ expectToken(t) {
1152
+ let n = this._lexer.token;
1153
+ if (n.kind === t) return this.advanceLexer(), n;
1154
+ throw d(this._lexer.source, n.start, `Expected ${Ze(t)}, found ${ne(n)}.`);
1155
+ }
1156
+ expectOptionalToken(t) {
1157
+ return this._lexer.token.kind === t ? (this.advanceLexer(), true) : false;
1158
+ }
1159
+ expectKeyword(t) {
1160
+ let n = this._lexer.token;
1161
+ if (n.kind === o.NAME && n.value === t) this.advanceLexer();
1162
+ else throw d(this._lexer.source, n.start, `Expected "${t}", found ${ne(n)}.`);
1163
+ }
1164
+ expectOptionalKeyword(t) {
1165
+ let n = this._lexer.token;
1166
+ return n.kind === o.NAME && n.value === t ? (this.advanceLexer(), true) : false;
1167
+ }
1168
+ unexpected(t) {
1169
+ let n = t != null ? t : this._lexer.token;
1170
+ return d(this._lexer.source, n.start, `Unexpected ${ne(n)}.`);
1171
+ }
1172
+ any(t, n, r) {
1173
+ this.expectToken(t);
1174
+ let i = [];
1175
+ for (; !this.expectOptionalToken(r); ) i.push(n.call(this));
1176
+ return i;
1177
+ }
1178
+ optionalMany(t, n, r) {
1179
+ if (this.expectOptionalToken(t)) {
1180
+ let i = [];
1181
+ do
1182
+ i.push(n.call(this));
1183
+ while (!this.expectOptionalToken(r));
1184
+ return i;
1185
+ }
1186
+ return [];
1187
+ }
1188
+ many(t, n, r) {
1189
+ this.expectToken(t);
1190
+ let i = [];
1191
+ do
1192
+ i.push(n.call(this));
1193
+ while (!this.expectOptionalToken(r));
1194
+ return i;
1195
+ }
1196
+ delimitedMany(t, n) {
1197
+ this.expectOptionalToken(t);
1198
+ let r = [];
1199
+ do
1200
+ r.push(n.call(this));
1201
+ while (this.expectOptionalToken(t));
1202
+ return r;
1203
+ }
1204
+ advanceLexer() {
1205
+ let { maxTokens: t } = this._options, n = this._lexer.advance();
1206
+ if (t !== void 0 && n.kind !== o.EOF && (++this._tokenCounter, this._tokenCounter > t)) throw d(this._lexer.source, n.start, `Document contains more that ${t} tokens. Parsing aborted.`);
1207
+ }
1208
+ };
1209
+ function ne(e2) {
1210
+ let t = e2.value;
1211
+ return Ze(e2.kind) + (t != null ? ` "${t}"` : "");
1212
+ }
1213
+ function Ze(e2) {
1214
+ return qe(e2) ? `"${e2}"` : e2;
1215
+ }
1216
+ function Kt(e2, t) {
1217
+ let n = new SyntaxError(e2 + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
1218
+ return Object.assign(n, t);
1219
+ }
1220
+ var et = Kt;
1221
+ function Zt(e2) {
1222
+ let t = [], { startToken: n, endToken: r } = e2.loc;
1223
+ for (let i = n; i !== r; i = i.next) i.kind === "Comment" && t.push(__spreadProps(__spreadValues({}, i), { loc: { start: i.start, end: i.end } }));
1224
+ return t;
1225
+ }
1226
+ var en = { allowLegacyFragmentVariables: true };
1227
+ function tn(e2) {
1228
+ if ((e2 == null ? void 0 : e2.name) === "GraphQLError") {
1229
+ let { message: t, locations: [n] } = e2;
1230
+ return et(t, { loc: { start: n }, cause: e2 });
1231
+ }
1232
+ return e2;
1233
+ }
1234
+ function nn(e2) {
1235
+ let t;
1236
+ try {
1237
+ t = Ke(e2, en);
1238
+ } catch (n) {
1239
+ throw tn(n);
1240
+ }
1241
+ return t.comments = Zt(t), t;
1242
+ }
1243
+ var rn = { parse: nn, astFormat: "graphql", hasPragma: Ce, locStart: q, locEnd: Q };
1244
+ var sn = { graphql: Re };
1245
+ var fr = Te;
1246
+ export {
1247
+ fr as default,
1248
+ Pe as languages,
1249
+ we as options,
1250
+ Ee as parsers,
1251
+ sn as printers
1252
+ };
1253
+ //# sourceMappingURL=graphql-NOJ5HX7K.mjs.map