@drzl/validation-core 3.0.0 → 3.2.0

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