@rexeus/typeweaver 0.0.1

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