dorian 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +15 -0
  3. data/.github/workflows/ci.yml +38 -0
  4. data/.gitignore +30 -0
  5. data/.node-version +1 -0
  6. data/.prettierignore +2 -0
  7. data/.rubocop.yml +129 -0
  8. data/.ruby-version +1 -0
  9. data/.tool-versions +3 -0
  10. data/Gemfile +20 -0
  11. data/Gemfile.lock +186 -0
  12. data/LICENSE +19 -0
  13. data/README.md +24 -0
  14. data/VERSION +1 -1
  15. data/bin/bundle +123 -0
  16. data/bin/bundle-audit +31 -0
  17. data/bin/bundler-audit +31 -0
  18. data/bin/rspec +31 -0
  19. data/bin/rubocop +31 -0
  20. data/dorian.gemspec +35 -0
  21. data/lib/dorian/bin.rb +739 -81
  22. data/package-lock.json +39 -0
  23. data/package.json +11 -0
  24. data/samples/books.json +33 -0
  25. data/samples/books.jsonl +3 -0
  26. data/samples/config.yml +27 -0
  27. data/samples/config_2.yml +22 -0
  28. data/samples/maths.js +1 -0
  29. data/samples/numbers.raw +10 -0
  30. data/samples/people.csv +6 -0
  31. data/samples/people.yml +28 -0
  32. data/samples/query.sql +7 -0
  33. data/samples/user.json +31 -0
  34. data/spec/dorian_spec.rb +276 -0
  35. data/spec/spec_helper.rb +3 -0
  36. data/vendor/groovy-beautify/LICENSE.MD +21 -0
  37. data/vendor/groovy-beautify/README.md +65 -0
  38. data/vendor/groovy-beautify/dist/__tests__/index.test.d.ts +1 -0
  39. data/vendor/groovy-beautify/dist/cjs/index.js +573 -0
  40. data/vendor/groovy-beautify/dist/cjs/package.json +3 -0
  41. data/vendor/groovy-beautify/dist/es/index.js +682 -0
  42. data/vendor/groovy-beautify/dist/es/package.json +3 -0
  43. data/vendor/groovy-beautify/dist/formatter/FormatRule.d.ts +14 -0
  44. data/vendor/groovy-beautify/dist/formatter/Formatter.d.ts +11 -0
  45. data/vendor/groovy-beautify/dist/formatter/GroovyFormatRules.d.ts +3 -0
  46. data/vendor/groovy-beautify/dist/formatter/__tests__/formatter.test.d.ts +1 -0
  47. data/vendor/groovy-beautify/dist/index.d.ts +5 -0
  48. data/vendor/groovy-beautify/dist/parser/GroovyParseRules.d.ts +3 -0
  49. data/vendor/groovy-beautify/dist/parser/ParseRule.d.ts +23 -0
  50. data/vendor/groovy-beautify/dist/parser/Parser.d.ts +29 -0
  51. data/vendor/groovy-beautify/dist/parser/__tests__/parser.test.d.ts +1 -0
  52. data/vendor/groovy-beautify/dist/parser/types.d.ts +6 -0
  53. data/vendor/groovy-beautify/dist/utils/text.d.ts +4 -0
  54. data/vendor/groovy-beautify/package.json +55 -0
  55. data/vendor/prettier/LICENSE +4379 -0
  56. data/vendor/prettier/README.md +109 -0
  57. data/vendor/prettier/bin/prettier.cjs +71 -0
  58. data/vendor/prettier/doc.d.ts +243 -0
  59. data/vendor/prettier/doc.js +1545 -0
  60. data/vendor/prettier/doc.mjs +1503 -0
  61. data/vendor/prettier/index.cjs +825 -0
  62. data/vendor/prettier/index.d.ts +941 -0
  63. data/vendor/prettier/index.mjs +25899 -0
  64. data/vendor/prettier/internal/cli.mjs +4366 -0
  65. data/vendor/prettier/package.json +198 -0
  66. data/vendor/prettier/plugins/acorn.d.ts +6 -0
  67. data/vendor/prettier/plugins/acorn.js +6618 -0
  68. data/vendor/prettier/plugins/acorn.mjs +6456 -0
  69. data/vendor/prettier/plugins/angular.d.ts +8 -0
  70. data/vendor/prettier/plugins/angular.js +2435 -0
  71. data/vendor/prettier/plugins/angular.mjs +2375 -0
  72. data/vendor/prettier/plugins/babel.d.ts +18 -0
  73. data/vendor/prettier/plugins/babel.js +14271 -0
  74. data/vendor/prettier/plugins/babel.mjs +13986 -0
  75. data/vendor/prettier/plugins/estree.d.ts +1 -0
  76. data/vendor/prettier/plugins/estree.js +9487 -0
  77. data/vendor/prettier/plugins/estree.mjs +9279 -0
  78. data/vendor/prettier/plugins/flow.d.ts +5 -0
  79. data/vendor/prettier/plugins/flow.js +51477 -0
  80. data/vendor/prettier/plugins/flow.mjs +51219 -0
  81. data/vendor/prettier/plugins/glimmer.d.ts +5 -0
  82. data/vendor/prettier/plugins/glimmer.js +8534 -0
  83. data/vendor/prettier/plugins/glimmer.mjs +8421 -0
  84. data/vendor/prettier/plugins/graphql.d.ts +5 -0
  85. data/vendor/prettier/plugins/graphql.js +2421 -0
  86. data/vendor/prettier/plugins/graphql.mjs +2347 -0
  87. data/vendor/prettier/plugins/html.d.ts +8 -0
  88. data/vendor/prettier/plugins/html.js +8182 -0
  89. data/vendor/prettier/plugins/html.mjs +8077 -0
  90. data/vendor/prettier/plugins/markdown.d.ts +7 -0
  91. data/vendor/prettier/plugins/markdown.js +9068 -0
  92. data/vendor/prettier/plugins/markdown.mjs +8977 -0
  93. data/vendor/prettier/plugins/meriyah.d.ts +5 -0
  94. data/vendor/prettier/plugins/meriyah.js +5953 -0
  95. data/vendor/prettier/plugins/meriyah.mjs +5800 -0
  96. data/vendor/prettier/plugins/postcss.d.ts +7 -0
  97. data/vendor/prettier/plugins/postcss.js +9244 -0
  98. data/vendor/prettier/plugins/postcss.mjs +9046 -0
  99. data/vendor/prettier/plugins/typescript.d.ts +5 -0
  100. data/vendor/prettier/plugins/typescript.js +38058 -0
  101. data/vendor/prettier/plugins/typescript.mjs +37732 -0
  102. data/vendor/prettier/plugins/yaml.d.ts +5 -0
  103. data/vendor/prettier/plugins/yaml.js +7425 -0
  104. data/vendor/prettier/plugins/yaml.mjs +7329 -0
  105. data/vendor/prettier/standalone.d.ts +33 -0
  106. data/vendor/prettier/standalone.js +3984 -0
  107. data/vendor/prettier/standalone.mjs +3938 -0
  108. data/vendor/sql-formatter.js +18762 -0
  109. metadata +205 -2
@@ -0,0 +1,2421 @@
1
+ (function (f) {
2
+ function e() {
3
+ var i = f();
4
+ return i.default || i;
5
+ }
6
+ if (typeof exports == "object" && typeof module == "object")
7
+ module.exports = e();
8
+ else if (typeof define == "function" && define.amd) define(e);
9
+ else {
10
+ var t =
11
+ typeof globalThis < "u"
12
+ ? globalThis
13
+ : typeof global < "u"
14
+ ? global
15
+ : typeof self < "u"
16
+ ? self
17
+ : this || {};
18
+ (t.prettierPlugins = t.prettierPlugins || {}),
19
+ (t.prettierPlugins.graphql = e());
20
+ }
21
+ })(function () {
22
+ "use strict";
23
+ var re = Object.defineProperty;
24
+ var tt = Object.getOwnPropertyDescriptor;
25
+ var nt = Object.getOwnPropertyNames;
26
+ var it = Object.prototype.hasOwnProperty;
27
+ var Ne = (e, t) => {
28
+ for (var n in t) re(e, n, { get: t[n], enumerable: !0 });
29
+ },
30
+ rt = (e, t, n, r) => {
31
+ if ((t && typeof t == "object") || typeof t == "function")
32
+ for (let i of nt(t))
33
+ !it.call(e, i) &&
34
+ i !== n &&
35
+ re(e, i, {
36
+ get: () => t[i],
37
+ enumerable: !(r = tt(t, i)) || r.enumerable,
38
+ });
39
+ return e;
40
+ };
41
+ var st = (e) => rt(re({}, "__esModule", { value: !0 }), e);
42
+ var ln = {};
43
+ Ne(ln, {
44
+ languages: () => Pe,
45
+ options: () => we,
46
+ parsers: () => Te,
47
+ printers: () => un,
48
+ });
49
+ var ot = (e, t, n, r) => {
50
+ if (!(e && t == null))
51
+ return t.replaceAll
52
+ ? t.replaceAll(n, r)
53
+ : n.global
54
+ ? t.replace(n, r)
55
+ : t.split(n).join(r);
56
+ },
57
+ Y = ot;
58
+ var se = "indent";
59
+ var oe = "group";
60
+ var ae = "if-break";
61
+ var P = "line";
62
+ var ce = "break-parent";
63
+ var xe = () => {},
64
+ b = xe,
65
+ ue = xe;
66
+ function x(e) {
67
+ return b(e), { type: se, contents: e };
68
+ }
69
+ function y(e, t = {}) {
70
+ return (
71
+ b(e),
72
+ ue(t.expandedStates, !0),
73
+ {
74
+ type: oe,
75
+ id: t.id,
76
+ contents: e,
77
+ break: !!t.shouldBreak,
78
+ expandedStates: t.expandedStates,
79
+ }
80
+ );
81
+ }
82
+ function O(e, t = "", n = {}) {
83
+ return (
84
+ b(e),
85
+ t !== "" && b(t),
86
+ { type: ae, breakContents: e, flatContents: t, groupId: n.groupId }
87
+ );
88
+ }
89
+ var xt = { type: ce };
90
+ var _t = { type: P, hard: !0 };
91
+ var k = { type: P },
92
+ p = { type: P, soft: !0 },
93
+ f = [_t, xt];
94
+ function E(e, t) {
95
+ b(e), ue(t);
96
+ let n = [];
97
+ for (let r = 0; r < t.length; r++) r !== 0 && n.push(e), n.push(t[r]);
98
+ return n;
99
+ }
100
+ function j(e) {
101
+ return (t, n, r) => {
102
+ let i = !!(r != null && r.backwards);
103
+ if (n === !1) return !1;
104
+ let { length: s } = t,
105
+ a = n;
106
+ for (; a >= 0 && a < s; ) {
107
+ let u = t.charAt(a);
108
+ if (e instanceof RegExp) {
109
+ if (!e.test(u)) return a;
110
+ } else if (!e.includes(u)) return a;
111
+ i ? a-- : a++;
112
+ }
113
+ return a === -1 || a === s ? a : !1;
114
+ };
115
+ }
116
+ var vn = j(/\s/u),
117
+ G = j(" "),
118
+ _e = j(",; "),
119
+ ye = j(/[^\n\r]/u);
120
+ function yt(e, t, n) {
121
+ let r = !!(n != null && n.backwards);
122
+ if (t === !1) return !1;
123
+ let i = e.charAt(t);
124
+ if (r) {
125
+ if (
126
+ e.charAt(t - 1) === "\r" &&
127
+ i ===
128
+ `
129
+ `
130
+ )
131
+ return t - 2;
132
+ if (
133
+ i ===
134
+ `
135
+ ` ||
136
+ i === "\r" ||
137
+ i === "\u2028" ||
138
+ i === "\u2029"
139
+ )
140
+ return t - 1;
141
+ } else {
142
+ if (
143
+ i === "\r" &&
144
+ e.charAt(t + 1) ===
145
+ `
146
+ `
147
+ )
148
+ return t + 2;
149
+ if (
150
+ i ===
151
+ `
152
+ ` ||
153
+ i === "\r" ||
154
+ i === "\u2028" ||
155
+ i === "\u2029"
156
+ )
157
+ return t + 1;
158
+ }
159
+ return t;
160
+ }
161
+ var $ = yt;
162
+ function It(e, t, n = {}) {
163
+ let r = G(e, n.backwards ? t - 1 : t, n),
164
+ i = $(e, r, n);
165
+ return r !== i;
166
+ }
167
+ var Ie = It;
168
+ function Ot(e, t) {
169
+ if (t === !1) return !1;
170
+ if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
171
+ for (let n = t + 2; n < e.length; ++n)
172
+ if (e.charAt(n) === "*" && e.charAt(n + 1) === "/") return n + 2;
173
+ }
174
+ return t;
175
+ }
176
+ var Oe = Ot;
177
+ function Dt(e, t) {
178
+ return t === !1
179
+ ? !1
180
+ : e.charAt(t) === "/" && e.charAt(t + 1) === "/"
181
+ ? ye(e, t)
182
+ : t;
183
+ }
184
+ var De = Dt;
185
+ function At(e, t) {
186
+ let n = null,
187
+ r = t;
188
+ for (; r !== n; ) (n = r), (r = _e(e, r)), (r = Oe(e, r)), (r = G(e, r));
189
+ return (r = De(e, r)), (r = $(e, r)), r !== !1 && Ie(e, r);
190
+ }
191
+ var Ae = At;
192
+ function gt(e) {
193
+ return Array.isArray(e) && e.length > 0;
194
+ }
195
+ var le = gt;
196
+ var pe = class extends Error {
197
+ name = "UnexpectedNodeError";
198
+ constructor(t, n, r = "type") {
199
+ super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`),
200
+ (this.node = t);
201
+ }
202
+ },
203
+ ge = pe;
204
+ var F = null;
205
+ function w(e) {
206
+ if (F !== null && typeof F.property) {
207
+ let t = F;
208
+ return (F = w.prototype = null), t;
209
+ }
210
+ return (F = w.prototype = e ?? Object.create(null)), new w();
211
+ }
212
+ var kt = 10;
213
+ for (let e = 0; e <= kt; e++) w();
214
+ function fe(e) {
215
+ return w(e);
216
+ }
217
+ function St(e, t = "type") {
218
+ fe(e);
219
+ function n(r) {
220
+ let i = r[t],
221
+ s = e[i];
222
+ if (!Array.isArray(s))
223
+ throw Object.assign(new Error(`Missing visitor keys for '${i}'.`), {
224
+ node: r,
225
+ });
226
+ return s;
227
+ }
228
+ return n;
229
+ }
230
+ var ke = St;
231
+ var J = class {
232
+ constructor(t, n, r) {
233
+ (this.start = t.start),
234
+ (this.end = n.end),
235
+ (this.startToken = t),
236
+ (this.endToken = n),
237
+ (this.source = r);
238
+ }
239
+ get [Symbol.toStringTag]() {
240
+ return "Location";
241
+ }
242
+ toJSON() {
243
+ return { start: this.start, end: this.end };
244
+ }
245
+ },
246
+ V = class {
247
+ constructor(t, n, r, i, s, a) {
248
+ (this.kind = t),
249
+ (this.start = n),
250
+ (this.end = r),
251
+ (this.line = i),
252
+ (this.column = s),
253
+ (this.value = a),
254
+ (this.prev = null),
255
+ (this.next = null);
256
+ }
257
+ get [Symbol.toStringTag]() {
258
+ return "Token";
259
+ }
260
+ toJSON() {
261
+ return {
262
+ kind: this.kind,
263
+ value: this.value,
264
+ line: this.line,
265
+ column: this.column,
266
+ };
267
+ }
268
+ },
269
+ X = {
270
+ Name: [],
271
+ Document: ["definitions"],
272
+ OperationDefinition: [
273
+ "name",
274
+ "variableDefinitions",
275
+ "directives",
276
+ "selectionSet",
277
+ ],
278
+ VariableDefinition: ["variable", "type", "defaultValue", "directives"],
279
+ Variable: ["name"],
280
+ SelectionSet: ["selections"],
281
+ Field: ["alias", "name", "arguments", "directives", "selectionSet"],
282
+ Argument: ["name", "value"],
283
+ FragmentSpread: ["name", "directives"],
284
+ InlineFragment: ["typeCondition", "directives", "selectionSet"],
285
+ FragmentDefinition: [
286
+ "name",
287
+ "variableDefinitions",
288
+ "typeCondition",
289
+ "directives",
290
+ "selectionSet",
291
+ ],
292
+ IntValue: [],
293
+ FloatValue: [],
294
+ StringValue: [],
295
+ BooleanValue: [],
296
+ NullValue: [],
297
+ EnumValue: [],
298
+ ListValue: ["values"],
299
+ ObjectValue: ["fields"],
300
+ ObjectField: ["name", "value"],
301
+ Directive: ["name", "arguments"],
302
+ NamedType: ["name"],
303
+ ListType: ["type"],
304
+ NonNullType: ["type"],
305
+ SchemaDefinition: ["description", "directives", "operationTypes"],
306
+ OperationTypeDefinition: ["type"],
307
+ ScalarTypeDefinition: ["description", "name", "directives"],
308
+ ObjectTypeDefinition: [
309
+ "description",
310
+ "name",
311
+ "interfaces",
312
+ "directives",
313
+ "fields",
314
+ ],
315
+ FieldDefinition: [
316
+ "description",
317
+ "name",
318
+ "arguments",
319
+ "type",
320
+ "directives",
321
+ ],
322
+ InputValueDefinition: [
323
+ "description",
324
+ "name",
325
+ "type",
326
+ "defaultValue",
327
+ "directives",
328
+ ],
329
+ InterfaceTypeDefinition: [
330
+ "description",
331
+ "name",
332
+ "interfaces",
333
+ "directives",
334
+ "fields",
335
+ ],
336
+ UnionTypeDefinition: ["description", "name", "directives", "types"],
337
+ EnumTypeDefinition: ["description", "name", "directives", "values"],
338
+ EnumValueDefinition: ["description", "name", "directives"],
339
+ InputObjectTypeDefinition: [
340
+ "description",
341
+ "name",
342
+ "directives",
343
+ "fields",
344
+ ],
345
+ DirectiveDefinition: ["description", "name", "arguments", "locations"],
346
+ SchemaExtension: ["directives", "operationTypes"],
347
+ ScalarTypeExtension: ["name", "directives"],
348
+ ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
349
+ InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
350
+ UnionTypeExtension: ["name", "directives", "types"],
351
+ EnumTypeExtension: ["name", "directives", "values"],
352
+ InputObjectTypeExtension: ["name", "directives", "fields"],
353
+ },
354
+ Hn = new Set(Object.keys(X));
355
+ var S;
356
+ (function (e) {
357
+ (e.QUERY = "query"),
358
+ (e.MUTATION = "mutation"),
359
+ (e.SUBSCRIPTION = "subscription");
360
+ })(S || (S = {}));
361
+ var Ct = ke(X, "kind"),
362
+ Se = Ct;
363
+ function q(e) {
364
+ return e.loc.start;
365
+ }
366
+ function Q(e) {
367
+ return e.loc.end;
368
+ }
369
+ function Ce(e) {
370
+ return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u.test(e);
371
+ }
372
+ function ve(e) {
373
+ return (
374
+ `# @format
375
+
376
+ ` + e
377
+ );
378
+ }
379
+ function vt(e, t, n) {
380
+ let { node: r } = e;
381
+ if (!r.description) return "";
382
+ let i = [n("description")];
383
+ return (
384
+ r.kind === "InputValueDefinition" && !r.description.block
385
+ ? i.push(k)
386
+ : i.push(f),
387
+ i
388
+ );
389
+ }
390
+ var A = vt;
391
+ function bt(e, t, n) {
392
+ let { node: r } = e;
393
+ switch (r.kind) {
394
+ case "Document":
395
+ return [...E(f, g(e, t, n, "definitions")), f];
396
+ case "OperationDefinition": {
397
+ let i = t.originalText[q(r)] !== "{",
398
+ s = !!r.name;
399
+ return [
400
+ i ? r.operation : "",
401
+ i && s ? [" ", n("name")] : "",
402
+ i && !s && le(r.variableDefinitions) ? " " : "",
403
+ be(e, n),
404
+ _(e, n, r),
405
+ !i && !s ? "" : " ",
406
+ n("selectionSet"),
407
+ ];
408
+ }
409
+ case "FragmentDefinition":
410
+ return [
411
+ "fragment ",
412
+ n("name"),
413
+ be(e, n),
414
+ " on ",
415
+ n("typeCondition"),
416
+ _(e, n, r),
417
+ " ",
418
+ n("selectionSet"),
419
+ ];
420
+ case "SelectionSet":
421
+ return ["{", x([f, E(f, g(e, t, n, "selections"))]), f, "}"];
422
+ case "Field":
423
+ return y([
424
+ r.alias ? [n("alias"), ": "] : "",
425
+ n("name"),
426
+ r.arguments.length > 0
427
+ ? y([
428
+ "(",
429
+ x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
430
+ p,
431
+ ")",
432
+ ])
433
+ : "",
434
+ _(e, n, r),
435
+ r.selectionSet ? " " : "",
436
+ n("selectionSet"),
437
+ ]);
438
+ case "Name":
439
+ return r.value;
440
+ case "StringValue":
441
+ if (r.block) {
442
+ let i = Y(!1, r.value, '"""', String.raw`\"""`).split(`
443
+ `);
444
+ return (
445
+ i.length === 1 && (i[0] = i[0].trim()),
446
+ i.every((s) => s === "") && (i.length = 0),
447
+ E(f, ['"""', ...i, '"""'])
448
+ );
449
+ }
450
+ return [
451
+ '"',
452
+ Y(
453
+ !1,
454
+ Y(!1, r.value, /["\\]/gu, String.raw`\$&`),
455
+ `
456
+ `,
457
+ String.raw`\n`,
458
+ ),
459
+ '"',
460
+ ];
461
+ case "IntValue":
462
+ case "FloatValue":
463
+ case "EnumValue":
464
+ return r.value;
465
+ case "BooleanValue":
466
+ return r.value ? "true" : "false";
467
+ case "NullValue":
468
+ return "null";
469
+ case "Variable":
470
+ return ["$", n("name")];
471
+ case "ListValue":
472
+ return y([
473
+ "[",
474
+ x([p, E([O("", ", "), p], e.map(n, "values"))]),
475
+ p,
476
+ "]",
477
+ ]);
478
+ case "ObjectValue": {
479
+ let i = t.bracketSpacing && r.fields.length > 0 ? " " : "";
480
+ return y([
481
+ "{",
482
+ i,
483
+ x([p, E([O("", ", "), p], e.map(n, "fields"))]),
484
+ p,
485
+ O("", i),
486
+ "}",
487
+ ]);
488
+ }
489
+ case "ObjectField":
490
+ case "Argument":
491
+ return [n("name"), ": ", n("value")];
492
+ case "Directive":
493
+ return [
494
+ "@",
495
+ n("name"),
496
+ r.arguments.length > 0
497
+ ? y([
498
+ "(",
499
+ x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
500
+ p,
501
+ ")",
502
+ ])
503
+ : "",
504
+ ];
505
+ case "NamedType":
506
+ return n("name");
507
+ case "VariableDefinition":
508
+ return [
509
+ n("variable"),
510
+ ": ",
511
+ n("type"),
512
+ r.defaultValue ? [" = ", n("defaultValue")] : "",
513
+ _(e, n, r),
514
+ ];
515
+ case "ObjectTypeExtension":
516
+ case "ObjectTypeDefinition":
517
+ case "InputObjectTypeExtension":
518
+ case "InputObjectTypeDefinition":
519
+ case "InterfaceTypeExtension":
520
+ case "InterfaceTypeDefinition": {
521
+ let { kind: i } = r,
522
+ s = [];
523
+ return (
524
+ i.endsWith("TypeDefinition") ? s.push(A(e, t, n)) : s.push("extend "),
525
+ i.startsWith("ObjectType")
526
+ ? s.push("type")
527
+ : i.startsWith("InputObjectType")
528
+ ? s.push("input")
529
+ : s.push("interface"),
530
+ s.push(" ", n("name")),
531
+ !i.startsWith("InputObjectType") &&
532
+ r.interfaces.length > 0 &&
533
+ s.push(" implements ", ...Pt(e, t, n)),
534
+ s.push(_(e, n, r)),
535
+ r.fields.length > 0 &&
536
+ s.push([" {", x([f, E(f, g(e, t, n, "fields"))]), f, "}"]),
537
+ s
538
+ );
539
+ }
540
+ case "FieldDefinition":
541
+ return [
542
+ A(e, t, n),
543
+ n("name"),
544
+ r.arguments.length > 0
545
+ ? y([
546
+ "(",
547
+ x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
548
+ p,
549
+ ")",
550
+ ])
551
+ : "",
552
+ ": ",
553
+ n("type"),
554
+ _(e, n, r),
555
+ ];
556
+ case "DirectiveDefinition":
557
+ return [
558
+ A(e, t, n),
559
+ "directive ",
560
+ "@",
561
+ n("name"),
562
+ r.arguments.length > 0
563
+ ? y([
564
+ "(",
565
+ x([p, E([O("", ", "), p], g(e, t, n, "arguments"))]),
566
+ p,
567
+ ")",
568
+ ])
569
+ : "",
570
+ r.repeatable ? " repeatable" : "",
571
+ " on ",
572
+ ...E(" | ", e.map(n, "locations")),
573
+ ];
574
+ case "EnumTypeExtension":
575
+ case "EnumTypeDefinition":
576
+ return [
577
+ A(e, t, n),
578
+ r.kind === "EnumTypeExtension" ? "extend " : "",
579
+ "enum ",
580
+ n("name"),
581
+ _(e, n, r),
582
+ r.values.length > 0
583
+ ? [" {", x([f, E(f, g(e, t, n, "values"))]), f, "}"]
584
+ : "",
585
+ ];
586
+ case "EnumValueDefinition":
587
+ return [A(e, t, n), n("name"), _(e, n, r)];
588
+ case "InputValueDefinition":
589
+ return [
590
+ A(e, t, n),
591
+ n("name"),
592
+ ": ",
593
+ n("type"),
594
+ r.defaultValue ? [" = ", n("defaultValue")] : "",
595
+ _(e, n, r),
596
+ ];
597
+ case "SchemaExtension":
598
+ return [
599
+ "extend schema",
600
+ _(e, n, r),
601
+ ...(r.operationTypes.length > 0
602
+ ? [" {", x([f, E(f, g(e, t, n, "operationTypes"))]), f, "}"]
603
+ : []),
604
+ ];
605
+ case "SchemaDefinition":
606
+ return [
607
+ A(e, t, n),
608
+ "schema",
609
+ _(e, n, r),
610
+ " {",
611
+ r.operationTypes.length > 0
612
+ ? x([f, E(f, g(e, t, n, "operationTypes"))])
613
+ : "",
614
+ f,
615
+ "}",
616
+ ];
617
+ case "OperationTypeDefinition":
618
+ return [r.operation, ": ", n("type")];
619
+ case "FragmentSpread":
620
+ return ["...", n("name"), _(e, n, r)];
621
+ case "InlineFragment":
622
+ return [
623
+ "...",
624
+ r.typeCondition ? [" on ", n("typeCondition")] : "",
625
+ _(e, n, r),
626
+ " ",
627
+ n("selectionSet"),
628
+ ];
629
+ case "UnionTypeExtension":
630
+ case "UnionTypeDefinition":
631
+ return y([
632
+ A(e, t, n),
633
+ y([
634
+ r.kind === "UnionTypeExtension" ? "extend " : "",
635
+ "union ",
636
+ n("name"),
637
+ _(e, n, r),
638
+ r.types.length > 0
639
+ ? [
640
+ " =",
641
+ O("", " "),
642
+ x([O([k, "| "]), E([k, "| "], e.map(n, "types"))]),
643
+ ]
644
+ : "",
645
+ ]),
646
+ ]);
647
+ case "ScalarTypeExtension":
648
+ case "ScalarTypeDefinition":
649
+ return [
650
+ A(e, t, n),
651
+ r.kind === "ScalarTypeExtension" ? "extend " : "",
652
+ "scalar ",
653
+ n("name"),
654
+ _(e, n, r),
655
+ ];
656
+ case "NonNullType":
657
+ return [n("type"), "!"];
658
+ case "ListType":
659
+ return ["[", n("type"), "]"];
660
+ default:
661
+ throw new ge(r, "Graphql", "kind");
662
+ }
663
+ }
664
+ function _(e, t, n) {
665
+ if (n.directives.length === 0) return "";
666
+ let r = E(k, e.map(t, "directives"));
667
+ return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition"
668
+ ? y([k, r])
669
+ : [" ", y(x([p, r]))];
670
+ }
671
+ function g(e, t, n, r) {
672
+ return e.map(({ isLast: i, node: s }) => {
673
+ let a = n();
674
+ return !i && Ae(t.originalText, Q(s)) ? [a, f] : a;
675
+ }, r);
676
+ }
677
+ function Lt(e) {
678
+ return e.kind !== "Comment";
679
+ }
680
+ function Rt(e) {
681
+ let t = e.node;
682
+ if (t.kind === "Comment") return "#" + t.value.trimEnd();
683
+ throw new Error("Not a comment: " + JSON.stringify(t));
684
+ }
685
+ function Pt(e, t, n) {
686
+ let { node: r } = e,
687
+ i = [],
688
+ { interfaces: s } = r,
689
+ a = e.map(n, "interfaces");
690
+ for (let u = 0; u < s.length; u++) {
691
+ let l = s[u];
692
+ i.push(a[u]);
693
+ let T = s[u + 1];
694
+ if (T) {
695
+ let D = t.originalText.slice(l.loc.end, T.loc.start).includes("#");
696
+ i.push(" &", D ? k : " ");
697
+ }
698
+ }
699
+ return i;
700
+ }
701
+ function be(e, t) {
702
+ let { node: n } = e;
703
+ return le(n.variableDefinitions)
704
+ ? y([
705
+ "(",
706
+ x([p, E([O("", ", "), p], e.map(t, "variableDefinitions"))]),
707
+ p,
708
+ ")",
709
+ ])
710
+ : "";
711
+ }
712
+ function Le(e, t) {
713
+ e.kind === "StringValue" &&
714
+ e.block &&
715
+ !e.value.includes(`
716
+ `) &&
717
+ (t.value = e.value.trim());
718
+ }
719
+ Le.ignoredProperties = new Set(["loc", "comments"]);
720
+ function Ft(e) {
721
+ var n;
722
+ let { node: t } = e;
723
+ return (n = t == null ? void 0 : t.comments) == null
724
+ ? void 0
725
+ : n.some((r) => r.value.trim() === "prettier-ignore");
726
+ }
727
+ var wt = {
728
+ print: bt,
729
+ massageAstNode: Le,
730
+ hasPrettierIgnore: Ft,
731
+ insertPragma: ve,
732
+ printComment: Rt,
733
+ canAttachComment: Lt,
734
+ getVisitorKeys: Se,
735
+ },
736
+ Re = wt;
737
+ var Pe = [
738
+ {
739
+ linguistLanguageId: 139,
740
+ name: "GraphQL",
741
+ type: "data",
742
+ color: "#e10098",
743
+ extensions: [".graphql", ".gql", ".graphqls"],
744
+ tmScope: "source.graphql",
745
+ aceMode: "text",
746
+ parsers: ["graphql"],
747
+ vscodeLanguageIds: ["graphql"],
748
+ },
749
+ ];
750
+ var Fe = {
751
+ bracketSpacing: {
752
+ category: "Common",
753
+ type: "boolean",
754
+ default: !0,
755
+ description: "Print spaces between brackets.",
756
+ oppositeDescription: "Do not print spaces between brackets.",
757
+ },
758
+ singleQuote: {
759
+ category: "Common",
760
+ type: "boolean",
761
+ default: !1,
762
+ description: "Use single quotes instead of double quotes.",
763
+ },
764
+ proseWrap: {
765
+ category: "Common",
766
+ type: "choice",
767
+ default: "preserve",
768
+ description: "How to wrap prose.",
769
+ choices: [
770
+ {
771
+ value: "always",
772
+ description: "Wrap prose if it exceeds the print width.",
773
+ },
774
+ { value: "never", description: "Do not wrap prose." },
775
+ { value: "preserve", description: "Wrap prose as-is." },
776
+ ],
777
+ },
778
+ bracketSameLine: {
779
+ category: "Common",
780
+ type: "boolean",
781
+ default: !1,
782
+ description:
783
+ "Put > of opening tags on the last line instead of on a new line.",
784
+ },
785
+ singleAttributePerLine: {
786
+ category: "Common",
787
+ type: "boolean",
788
+ default: !1,
789
+ description: "Enforce single attribute per line in HTML, Vue and JSX.",
790
+ },
791
+ };
792
+ var Vt = { bracketSpacing: Fe.bracketSpacing },
793
+ we = Vt;
794
+ var Te = {};
795
+ Ne(Te, { graphql: () => cn });
796
+ function Ve(e) {
797
+ return typeof e == "object" && e !== null;
798
+ }
799
+ function Be(e, t) {
800
+ if (!!!e) throw new Error(t ?? "Unexpected invariant triggered.");
801
+ }
802
+ var Bt = /\r\n|[\n\r]/g;
803
+ function B(e, t) {
804
+ let n = 0,
805
+ r = 1;
806
+ for (let i of e.body.matchAll(Bt)) {
807
+ if ((typeof i.index == "number" || Be(!1), i.index >= t)) break;
808
+ (n = i.index + i[0].length), (r += 1);
809
+ }
810
+ return { line: r, column: t + 1 - n };
811
+ }
812
+ function Me(e) {
813
+ return he(e.source, B(e.source, e.start));
814
+ }
815
+ function he(e, t) {
816
+ let n = e.locationOffset.column - 1,
817
+ r = "".padStart(n) + e.body,
818
+ i = t.line - 1,
819
+ s = e.locationOffset.line - 1,
820
+ a = t.line + s,
821
+ u = t.line === 1 ? n : 0,
822
+ l = t.column + u,
823
+ T = `${e.name}:${a}:${l}
824
+ `,
825
+ h = r.split(/\r\n|[\n\r]/g),
826
+ D = h[i];
827
+ if (D.length > 120) {
828
+ let I = Math.floor(l / 80),
829
+ ie = l % 80,
830
+ N = [];
831
+ for (let v = 0; v < D.length; v += 80) N.push(D.slice(v, v + 80));
832
+ return (
833
+ T +
834
+ Ue([
835
+ [`${a} |`, N[0]],
836
+ ...N.slice(1, I + 1).map((v) => ["|", v]),
837
+ ["|", "^".padStart(ie)],
838
+ ["|", N[I + 1]],
839
+ ])
840
+ );
841
+ }
842
+ return (
843
+ T +
844
+ Ue([
845
+ [`${a - 1} |`, h[i - 1]],
846
+ [`${a} |`, D],
847
+ ["|", "^".padStart(l)],
848
+ [`${a + 1} |`, h[i + 1]],
849
+ ])
850
+ );
851
+ }
852
+ function Ue(e) {
853
+ let t = e.filter(([r, i]) => i !== void 0),
854
+ n = Math.max(...t.map(([r]) => r.length));
855
+ return t.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(`
856
+ `);
857
+ }
858
+ function Ut(e) {
859
+ let t = e[0];
860
+ return t == null || "kind" in t || "length" in t
861
+ ? {
862
+ nodes: t,
863
+ source: e[1],
864
+ positions: e[2],
865
+ path: e[3],
866
+ originalError: e[4],
867
+ extensions: e[5],
868
+ }
869
+ : t;
870
+ }
871
+ var W = class e extends Error {
872
+ constructor(t, ...n) {
873
+ var r, i, s;
874
+ let {
875
+ nodes: a,
876
+ source: u,
877
+ positions: l,
878
+ path: T,
879
+ originalError: h,
880
+ extensions: D,
881
+ } = Ut(n);
882
+ super(t),
883
+ (this.name = "GraphQLError"),
884
+ (this.path = T ?? void 0),
885
+ (this.originalError = h ?? void 0),
886
+ (this.nodes = Ye(Array.isArray(a) ? a : a ? [a] : void 0));
887
+ let I = Ye(
888
+ (r = this.nodes) === null || r === void 0
889
+ ? void 0
890
+ : r.map((N) => N.loc).filter((N) => N != null),
891
+ );
892
+ (this.source =
893
+ u ??
894
+ (I == null || (i = I[0]) === null || i === void 0 ? void 0 : i.source)),
895
+ (this.positions = l ?? (I == null ? void 0 : I.map((N) => N.start))),
896
+ (this.locations =
897
+ l && u
898
+ ? l.map((N) => B(u, N))
899
+ : I == null
900
+ ? void 0
901
+ : I.map((N) => B(N.source, N.start)));
902
+ let ie = Ve(h == null ? void 0 : h.extensions)
903
+ ? h == null
904
+ ? void 0
905
+ : h.extensions
906
+ : void 0;
907
+ (this.extensions =
908
+ (s = D ?? ie) !== null && s !== void 0 ? s : Object.create(null)),
909
+ Object.defineProperties(this, {
910
+ message: { writable: !0, enumerable: !0 },
911
+ name: { enumerable: !1 },
912
+ nodes: { enumerable: !1 },
913
+ source: { enumerable: !1 },
914
+ positions: { enumerable: !1 },
915
+ originalError: { enumerable: !1 },
916
+ }),
917
+ h != null && h.stack
918
+ ? Object.defineProperty(this, "stack", {
919
+ value: h.stack,
920
+ writable: !0,
921
+ configurable: !0,
922
+ })
923
+ : Error.captureStackTrace
924
+ ? Error.captureStackTrace(this, e)
925
+ : Object.defineProperty(this, "stack", {
926
+ value: Error().stack,
927
+ writable: !0,
928
+ configurable: !0,
929
+ });
930
+ }
931
+ get [Symbol.toStringTag]() {
932
+ return "GraphQLError";
933
+ }
934
+ toString() {
935
+ let t = this.message;
936
+ if (this.nodes)
937
+ for (let n of this.nodes)
938
+ n.loc &&
939
+ (t +=
940
+ `
941
+
942
+ ` + Me(n.loc));
943
+ else if (this.source && this.locations)
944
+ for (let n of this.locations)
945
+ t +=
946
+ `
947
+
948
+ ` + he(this.source, n);
949
+ return t;
950
+ }
951
+ toJSON() {
952
+ let t = { message: this.message };
953
+ return (
954
+ this.locations != null && (t.locations = this.locations),
955
+ this.path != null && (t.path = this.path),
956
+ this.extensions != null &&
957
+ Object.keys(this.extensions).length > 0 &&
958
+ (t.extensions = this.extensions),
959
+ t
960
+ );
961
+ }
962
+ };
963
+ function Ye(e) {
964
+ return e === void 0 || e.length === 0 ? void 0 : e;
965
+ }
966
+ function d(e, t, n) {
967
+ return new W(`Syntax Error: ${n}`, { source: e, positions: [t] });
968
+ }
969
+ var H;
970
+ (function (e) {
971
+ (e.QUERY = "QUERY"),
972
+ (e.MUTATION = "MUTATION"),
973
+ (e.SUBSCRIPTION = "SUBSCRIPTION"),
974
+ (e.FIELD = "FIELD"),
975
+ (e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION"),
976
+ (e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD"),
977
+ (e.INLINE_FRAGMENT = "INLINE_FRAGMENT"),
978
+ (e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION"),
979
+ (e.SCHEMA = "SCHEMA"),
980
+ (e.SCALAR = "SCALAR"),
981
+ (e.OBJECT = "OBJECT"),
982
+ (e.FIELD_DEFINITION = "FIELD_DEFINITION"),
983
+ (e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION"),
984
+ (e.INTERFACE = "INTERFACE"),
985
+ (e.UNION = "UNION"),
986
+ (e.ENUM = "ENUM"),
987
+ (e.ENUM_VALUE = "ENUM_VALUE"),
988
+ (e.INPUT_OBJECT = "INPUT_OBJECT"),
989
+ (e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION");
990
+ })(H || (H = {}));
991
+ var c;
992
+ (function (e) {
993
+ (e.NAME = "Name"),
994
+ (e.DOCUMENT = "Document"),
995
+ (e.OPERATION_DEFINITION = "OperationDefinition"),
996
+ (e.VARIABLE_DEFINITION = "VariableDefinition"),
997
+ (e.SELECTION_SET = "SelectionSet"),
998
+ (e.FIELD = "Field"),
999
+ (e.ARGUMENT = "Argument"),
1000
+ (e.FRAGMENT_SPREAD = "FragmentSpread"),
1001
+ (e.INLINE_FRAGMENT = "InlineFragment"),
1002
+ (e.FRAGMENT_DEFINITION = "FragmentDefinition"),
1003
+ (e.VARIABLE = "Variable"),
1004
+ (e.INT = "IntValue"),
1005
+ (e.FLOAT = "FloatValue"),
1006
+ (e.STRING = "StringValue"),
1007
+ (e.BOOLEAN = "BooleanValue"),
1008
+ (e.NULL = "NullValue"),
1009
+ (e.ENUM = "EnumValue"),
1010
+ (e.LIST = "ListValue"),
1011
+ (e.OBJECT = "ObjectValue"),
1012
+ (e.OBJECT_FIELD = "ObjectField"),
1013
+ (e.DIRECTIVE = "Directive"),
1014
+ (e.NAMED_TYPE = "NamedType"),
1015
+ (e.LIST_TYPE = "ListType"),
1016
+ (e.NON_NULL_TYPE = "NonNullType"),
1017
+ (e.SCHEMA_DEFINITION = "SchemaDefinition"),
1018
+ (e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition"),
1019
+ (e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition"),
1020
+ (e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition"),
1021
+ (e.FIELD_DEFINITION = "FieldDefinition"),
1022
+ (e.INPUT_VALUE_DEFINITION = "InputValueDefinition"),
1023
+ (e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition"),
1024
+ (e.UNION_TYPE_DEFINITION = "UnionTypeDefinition"),
1025
+ (e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition"),
1026
+ (e.ENUM_VALUE_DEFINITION = "EnumValueDefinition"),
1027
+ (e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition"),
1028
+ (e.DIRECTIVE_DEFINITION = "DirectiveDefinition"),
1029
+ (e.SCHEMA_EXTENSION = "SchemaExtension"),
1030
+ (e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension"),
1031
+ (e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension"),
1032
+ (e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension"),
1033
+ (e.UNION_TYPE_EXTENSION = "UnionTypeExtension"),
1034
+ (e.ENUM_TYPE_EXTENSION = "EnumTypeExtension"),
1035
+ (e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension");
1036
+ })(c || (c = {}));
1037
+ function je(e) {
1038
+ return e === 9 || e === 32;
1039
+ }
1040
+ function L(e) {
1041
+ return e >= 48 && e <= 57;
1042
+ }
1043
+ function Ge(e) {
1044
+ return (e >= 97 && e <= 122) || (e >= 65 && e <= 90);
1045
+ }
1046
+ function de(e) {
1047
+ return Ge(e) || e === 95;
1048
+ }
1049
+ function $e(e) {
1050
+ return Ge(e) || L(e) || e === 95;
1051
+ }
1052
+ function Je(e) {
1053
+ var t;
1054
+ let n = Number.MAX_SAFE_INTEGER,
1055
+ r = null,
1056
+ i = -1;
1057
+ for (let a = 0; a < e.length; ++a) {
1058
+ var s;
1059
+ let u = e[a],
1060
+ l = Mt(u);
1061
+ l !== u.length &&
1062
+ ((r = (s = r) !== null && s !== void 0 ? s : a),
1063
+ (i = a),
1064
+ a !== 0 && l < n && (n = l));
1065
+ }
1066
+ return e
1067
+ .map((a, u) => (u === 0 ? a : a.slice(n)))
1068
+ .slice((t = r) !== null && t !== void 0 ? t : 0, i + 1);
1069
+ }
1070
+ function Mt(e) {
1071
+ let t = 0;
1072
+ for (; t < e.length && je(e.charCodeAt(t)); ) ++t;
1073
+ return t;
1074
+ }
1075
+ var o;
1076
+ (function (e) {
1077
+ (e.SOF = "<SOF>"),
1078
+ (e.EOF = "<EOF>"),
1079
+ (e.BANG = "!"),
1080
+ (e.DOLLAR = "$"),
1081
+ (e.AMP = "&"),
1082
+ (e.PAREN_L = "("),
1083
+ (e.PAREN_R = ")"),
1084
+ (e.SPREAD = "..."),
1085
+ (e.COLON = ":"),
1086
+ (e.EQUALS = "="),
1087
+ (e.AT = "@"),
1088
+ (e.BRACKET_L = "["),
1089
+ (e.BRACKET_R = "]"),
1090
+ (e.BRACE_L = "{"),
1091
+ (e.PIPE = "|"),
1092
+ (e.BRACE_R = "}"),
1093
+ (e.NAME = "Name"),
1094
+ (e.INT = "Int"),
1095
+ (e.FLOAT = "Float"),
1096
+ (e.STRING = "String"),
1097
+ (e.BLOCK_STRING = "BlockString"),
1098
+ (e.COMMENT = "Comment");
1099
+ })(o || (o = {}));
1100
+ var z = class {
1101
+ constructor(t) {
1102
+ let n = new V(o.SOF, 0, 0, 0, 0);
1103
+ (this.source = t),
1104
+ (this.lastToken = n),
1105
+ (this.token = n),
1106
+ (this.line = 1),
1107
+ (this.lineStart = 0);
1108
+ }
1109
+ get [Symbol.toStringTag]() {
1110
+ return "Lexer";
1111
+ }
1112
+ advance() {
1113
+ return (this.lastToken = this.token), (this.token = this.lookahead());
1114
+ }
1115
+ lookahead() {
1116
+ let t = this.token;
1117
+ if (t.kind !== o.EOF)
1118
+ do
1119
+ if (t.next) t = t.next;
1120
+ else {
1121
+ let n = Yt(this, t.end);
1122
+ (t.next = n), (n.prev = t), (t = n);
1123
+ }
1124
+ while (t.kind === o.COMMENT);
1125
+ return t;
1126
+ }
1127
+ };
1128
+ function qe(e) {
1129
+ return (
1130
+ e === o.BANG ||
1131
+ e === o.DOLLAR ||
1132
+ e === o.AMP ||
1133
+ e === o.PAREN_L ||
1134
+ e === o.PAREN_R ||
1135
+ e === o.SPREAD ||
1136
+ e === o.COLON ||
1137
+ e === o.EQUALS ||
1138
+ e === o.AT ||
1139
+ e === o.BRACKET_L ||
1140
+ e === o.BRACKET_R ||
1141
+ e === o.BRACE_L ||
1142
+ e === o.PIPE ||
1143
+ e === o.BRACE_R
1144
+ );
1145
+ }
1146
+ function R(e) {
1147
+ return (e >= 0 && e <= 55295) || (e >= 57344 && e <= 1114111);
1148
+ }
1149
+ function K(e, t) {
1150
+ return Qe(e.charCodeAt(t)) && We(e.charCodeAt(t + 1));
1151
+ }
1152
+ function Qe(e) {
1153
+ return e >= 55296 && e <= 56319;
1154
+ }
1155
+ function We(e) {
1156
+ return e >= 56320 && e <= 57343;
1157
+ }
1158
+ function C(e, t) {
1159
+ let n = e.source.body.codePointAt(t);
1160
+ if (n === void 0) return o.EOF;
1161
+ if (n >= 32 && n <= 126) {
1162
+ let r = String.fromCodePoint(n);
1163
+ return r === '"' ? `'"'` : `"${r}"`;
1164
+ }
1165
+ return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
1166
+ }
1167
+ function m(e, t, n, r, i) {
1168
+ let s = e.line,
1169
+ a = 1 + n - e.lineStart;
1170
+ return new V(t, n, r, s, a, i);
1171
+ }
1172
+ function Yt(e, t) {
1173
+ let n = e.source.body,
1174
+ r = n.length,
1175
+ i = t;
1176
+ for (; i < r; ) {
1177
+ let s = n.charCodeAt(i);
1178
+ switch (s) {
1179
+ case 65279:
1180
+ case 9:
1181
+ case 32:
1182
+ case 44:
1183
+ ++i;
1184
+ continue;
1185
+ case 10:
1186
+ ++i, ++e.line, (e.lineStart = i);
1187
+ continue;
1188
+ case 13:
1189
+ n.charCodeAt(i + 1) === 10 ? (i += 2) : ++i,
1190
+ ++e.line,
1191
+ (e.lineStart = i);
1192
+ continue;
1193
+ case 35:
1194
+ return jt(e, i);
1195
+ case 33:
1196
+ return m(e, o.BANG, i, i + 1);
1197
+ case 36:
1198
+ return m(e, o.DOLLAR, i, i + 1);
1199
+ case 38:
1200
+ return m(e, o.AMP, i, i + 1);
1201
+ case 40:
1202
+ return m(e, o.PAREN_L, i, i + 1);
1203
+ case 41:
1204
+ return m(e, o.PAREN_R, i, i + 1);
1205
+ case 46:
1206
+ if (n.charCodeAt(i + 1) === 46 && n.charCodeAt(i + 2) === 46)
1207
+ return m(e, o.SPREAD, i, i + 3);
1208
+ break;
1209
+ case 58:
1210
+ return m(e, o.COLON, i, i + 1);
1211
+ case 61:
1212
+ return m(e, o.EQUALS, i, i + 1);
1213
+ case 64:
1214
+ return m(e, o.AT, i, i + 1);
1215
+ case 91:
1216
+ return m(e, o.BRACKET_L, i, i + 1);
1217
+ case 93:
1218
+ return m(e, o.BRACKET_R, i, i + 1);
1219
+ case 123:
1220
+ return m(e, o.BRACE_L, i, i + 1);
1221
+ case 124:
1222
+ return m(e, o.PIPE, i, i + 1);
1223
+ case 125:
1224
+ return m(e, o.BRACE_R, i, i + 1);
1225
+ case 34:
1226
+ return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34
1227
+ ? Qt(e, i)
1228
+ : $t(e, i);
1229
+ }
1230
+ if (L(s) || s === 45) return Gt(e, i, s);
1231
+ if (de(s)) return Wt(e, i);
1232
+ throw d(
1233
+ e.source,
1234
+ i,
1235
+ s === 39
1236
+ ? `Unexpected single quote character ('), did you mean to use a double quote (")?`
1237
+ : R(s) || K(n, i)
1238
+ ? `Unexpected character: ${C(e, i)}.`
1239
+ : `Invalid character: ${C(e, i)}.`,
1240
+ );
1241
+ }
1242
+ return m(e, o.EOF, r, r);
1243
+ }
1244
+ function jt(e, t) {
1245
+ let n = e.source.body,
1246
+ r = n.length,
1247
+ i = t + 1;
1248
+ for (; i < r; ) {
1249
+ let s = n.charCodeAt(i);
1250
+ if (s === 10 || s === 13) break;
1251
+ if (R(s)) ++i;
1252
+ else if (K(n, i)) i += 2;
1253
+ else break;
1254
+ }
1255
+ return m(e, o.COMMENT, t, i, n.slice(t + 1, i));
1256
+ }
1257
+ function Gt(e, t, n) {
1258
+ let r = e.source.body,
1259
+ i = t,
1260
+ s = n,
1261
+ a = !1;
1262
+ if ((s === 45 && (s = r.charCodeAt(++i)), s === 48)) {
1263
+ if (((s = r.charCodeAt(++i)), L(s)))
1264
+ throw d(
1265
+ e.source,
1266
+ i,
1267
+ `Invalid number, unexpected digit after 0: ${C(e, i)}.`,
1268
+ );
1269
+ } else (i = me(e, i, s)), (s = r.charCodeAt(i));
1270
+ if (
1271
+ (s === 46 &&
1272
+ ((a = !0),
1273
+ (s = r.charCodeAt(++i)),
1274
+ (i = me(e, i, s)),
1275
+ (s = r.charCodeAt(i))),
1276
+ (s === 69 || s === 101) &&
1277
+ ((a = !0),
1278
+ (s = r.charCodeAt(++i)),
1279
+ (s === 43 || s === 45) && (s = r.charCodeAt(++i)),
1280
+ (i = me(e, i, s)),
1281
+ (s = r.charCodeAt(i))),
1282
+ s === 46 || de(s))
1283
+ )
1284
+ throw d(
1285
+ e.source,
1286
+ i,
1287
+ `Invalid number, expected digit but got: ${C(e, i)}.`,
1288
+ );
1289
+ return m(e, a ? o.FLOAT : o.INT, t, i, r.slice(t, i));
1290
+ }
1291
+ function me(e, t, n) {
1292
+ if (!L(n))
1293
+ throw d(
1294
+ e.source,
1295
+ t,
1296
+ `Invalid number, expected digit but got: ${C(e, t)}.`,
1297
+ );
1298
+ let r = e.source.body,
1299
+ i = t + 1;
1300
+ for (; L(r.charCodeAt(i)); ) ++i;
1301
+ return i;
1302
+ }
1303
+ function $t(e, t) {
1304
+ let n = e.source.body,
1305
+ r = n.length,
1306
+ i = t + 1,
1307
+ s = i,
1308
+ a = "";
1309
+ for (; i < r; ) {
1310
+ let u = n.charCodeAt(i);
1311
+ if (u === 34) return (a += n.slice(s, i)), m(e, o.STRING, t, i + 1, a);
1312
+ if (u === 92) {
1313
+ a += n.slice(s, i);
1314
+ let l =
1315
+ n.charCodeAt(i + 1) === 117
1316
+ ? n.charCodeAt(i + 2) === 123
1317
+ ? Jt(e, i)
1318
+ : Xt(e, i)
1319
+ : qt(e, i);
1320
+ (a += l.value), (i += l.size), (s = i);
1321
+ continue;
1322
+ }
1323
+ if (u === 10 || u === 13) break;
1324
+ if (R(u)) ++i;
1325
+ else if (K(n, i)) i += 2;
1326
+ else throw d(e.source, i, `Invalid character within String: ${C(e, i)}.`);
1327
+ }
1328
+ throw d(e.source, i, "Unterminated string.");
1329
+ }
1330
+ function Jt(e, t) {
1331
+ let n = e.source.body,
1332
+ r = 0,
1333
+ i = 3;
1334
+ for (; i < 12; ) {
1335
+ let s = n.charCodeAt(t + i++);
1336
+ if (s === 125) {
1337
+ if (i < 5 || !R(r)) break;
1338
+ return { value: String.fromCodePoint(r), size: i };
1339
+ }
1340
+ if (((r = (r << 4) | U(s)), r < 0)) break;
1341
+ }
1342
+ throw d(
1343
+ e.source,
1344
+ t,
1345
+ `Invalid Unicode escape sequence: "${n.slice(t, t + i)}".`,
1346
+ );
1347
+ }
1348
+ function Xt(e, t) {
1349
+ let n = e.source.body,
1350
+ r = Xe(n, t + 2);
1351
+ if (R(r)) return { value: String.fromCodePoint(r), size: 6 };
1352
+ if (Qe(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
1353
+ let i = Xe(n, t + 8);
1354
+ if (We(i)) return { value: String.fromCodePoint(r, i), size: 12 };
1355
+ }
1356
+ throw d(
1357
+ e.source,
1358
+ t,
1359
+ `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`,
1360
+ );
1361
+ }
1362
+ function Xe(e, t) {
1363
+ return (
1364
+ (U(e.charCodeAt(t)) << 12) |
1365
+ (U(e.charCodeAt(t + 1)) << 8) |
1366
+ (U(e.charCodeAt(t + 2)) << 4) |
1367
+ U(e.charCodeAt(t + 3))
1368
+ );
1369
+ }
1370
+ function U(e) {
1371
+ return e >= 48 && e <= 57
1372
+ ? e - 48
1373
+ : e >= 65 && e <= 70
1374
+ ? e - 55
1375
+ : e >= 97 && e <= 102
1376
+ ? e - 87
1377
+ : -1;
1378
+ }
1379
+ function qt(e, t) {
1380
+ let n = e.source.body;
1381
+ switch (n.charCodeAt(t + 1)) {
1382
+ case 34:
1383
+ return { value: '"', size: 2 };
1384
+ case 92:
1385
+ return { value: "\\", size: 2 };
1386
+ case 47:
1387
+ return { value: "/", size: 2 };
1388
+ case 98:
1389
+ return { value: "\b", size: 2 };
1390
+ case 102:
1391
+ return { value: "\f", size: 2 };
1392
+ case 110:
1393
+ return {
1394
+ value: `
1395
+ `,
1396
+ size: 2,
1397
+ };
1398
+ case 114:
1399
+ return { value: "\r", size: 2 };
1400
+ case 116:
1401
+ return { value: " ", size: 2 };
1402
+ }
1403
+ throw d(
1404
+ e.source,
1405
+ t,
1406
+ `Invalid character escape sequence: "${n.slice(t, t + 2)}".`,
1407
+ );
1408
+ }
1409
+ function Qt(e, t) {
1410
+ let n = e.source.body,
1411
+ r = n.length,
1412
+ i = e.lineStart,
1413
+ s = t + 3,
1414
+ a = s,
1415
+ u = "",
1416
+ l = [];
1417
+ for (; s < r; ) {
1418
+ let T = n.charCodeAt(s);
1419
+ if (
1420
+ T === 34 &&
1421
+ n.charCodeAt(s + 1) === 34 &&
1422
+ n.charCodeAt(s + 2) === 34
1423
+ ) {
1424
+ (u += n.slice(a, s)), l.push(u);
1425
+ let h = m(
1426
+ e,
1427
+ o.BLOCK_STRING,
1428
+ t,
1429
+ s + 3,
1430
+ Je(l).join(`
1431
+ `),
1432
+ );
1433
+ return (e.line += l.length - 1), (e.lineStart = i), h;
1434
+ }
1435
+ if (
1436
+ T === 92 &&
1437
+ n.charCodeAt(s + 1) === 34 &&
1438
+ n.charCodeAt(s + 2) === 34 &&
1439
+ n.charCodeAt(s + 3) === 34
1440
+ ) {
1441
+ (u += n.slice(a, s)), (a = s + 1), (s += 4);
1442
+ continue;
1443
+ }
1444
+ if (T === 10 || T === 13) {
1445
+ (u += n.slice(a, s)),
1446
+ l.push(u),
1447
+ T === 13 && n.charCodeAt(s + 1) === 10 ? (s += 2) : ++s,
1448
+ (u = ""),
1449
+ (a = s),
1450
+ (i = s);
1451
+ continue;
1452
+ }
1453
+ if (R(T)) ++s;
1454
+ else if (K(n, s)) s += 2;
1455
+ else throw d(e.source, s, `Invalid character within String: ${C(e, s)}.`);
1456
+ }
1457
+ throw d(e.source, s, "Unterminated string.");
1458
+ }
1459
+ function Wt(e, t) {
1460
+ let n = e.source.body,
1461
+ r = n.length,
1462
+ i = t + 1;
1463
+ for (; i < r; ) {
1464
+ let s = n.charCodeAt(i);
1465
+ if ($e(s)) ++i;
1466
+ else break;
1467
+ }
1468
+ return m(e, o.NAME, t, i, n.slice(t, i));
1469
+ }
1470
+ function Z(e, t) {
1471
+ if (!!!e) throw new Error(t);
1472
+ }
1473
+ function ee(e) {
1474
+ return te(e, []);
1475
+ }
1476
+ function te(e, t) {
1477
+ switch (typeof e) {
1478
+ case "string":
1479
+ return JSON.stringify(e);
1480
+ case "function":
1481
+ return e.name ? `[function ${e.name}]` : "[function]";
1482
+ case "object":
1483
+ return Ht(e, t);
1484
+ default:
1485
+ return String(e);
1486
+ }
1487
+ }
1488
+ function Ht(e, t) {
1489
+ if (e === null) return "null";
1490
+ if (t.includes(e)) return "[Circular]";
1491
+ let n = [...t, e];
1492
+ if (zt(e)) {
1493
+ let r = e.toJSON();
1494
+ if (r !== e) return typeof r == "string" ? r : te(r, n);
1495
+ } else if (Array.isArray(e)) return Zt(e, n);
1496
+ return Kt(e, n);
1497
+ }
1498
+ function zt(e) {
1499
+ return typeof e.toJSON == "function";
1500
+ }
1501
+ function Kt(e, t) {
1502
+ let n = Object.entries(e);
1503
+ return n.length === 0
1504
+ ? "{}"
1505
+ : t.length > 2
1506
+ ? "[" + en(e) + "]"
1507
+ : "{ " + n.map(([i, s]) => i + ": " + te(s, t)).join(", ") + " }";
1508
+ }
1509
+ function Zt(e, t) {
1510
+ if (e.length === 0) return "[]";
1511
+ if (t.length > 2) return "[Array]";
1512
+ let n = Math.min(10, e.length),
1513
+ r = e.length - n,
1514
+ i = [];
1515
+ for (let s = 0; s < n; ++s) i.push(te(e[s], t));
1516
+ return (
1517
+ r === 1
1518
+ ? i.push("... 1 more item")
1519
+ : r > 1 && i.push(`... ${r} more items`),
1520
+ "[" + i.join(", ") + "]"
1521
+ );
1522
+ }
1523
+ function en(e) {
1524
+ let t = Object.prototype.toString
1525
+ .call(e)
1526
+ .replace(/^\[object /, "")
1527
+ .replace(/]$/, "");
1528
+ if (t === "Object" && typeof e.constructor == "function") {
1529
+ let n = e.constructor.name;
1530
+ if (typeof n == "string" && n !== "") return n;
1531
+ }
1532
+ return t;
1533
+ }
1534
+ var tn = globalThis.process && !0,
1535
+ He = tn
1536
+ ? function (t, n) {
1537
+ return t instanceof n;
1538
+ }
1539
+ : function (t, n) {
1540
+ if (t instanceof n) return !0;
1541
+ if (typeof t == "object" && t !== null) {
1542
+ var r;
1543
+ let i = n.prototype[Symbol.toStringTag],
1544
+ s =
1545
+ Symbol.toStringTag in t
1546
+ ? t[Symbol.toStringTag]
1547
+ : (r = t.constructor) === null || r === void 0
1548
+ ? void 0
1549
+ : r.name;
1550
+ if (i === s) {
1551
+ let a = ee(t);
1552
+ throw new Error(`Cannot use ${i} "${a}" from another module or realm.
1553
+
1554
+ Ensure that there is only one instance of "graphql" in the node_modules
1555
+ directory. If different versions of "graphql" are the dependencies of other
1556
+ relied on modules, use "resolutions" to ensure only one version is installed.
1557
+
1558
+ https://yarnpkg.com/en/docs/selective-version-resolutions
1559
+
1560
+ Duplicate "graphql" modules cannot be used at the same time since different
1561
+ versions may have different capabilities and behavior. The data from one
1562
+ version used in the function from another could produce confusing and
1563
+ spurious results.`);
1564
+ }
1565
+ }
1566
+ return !1;
1567
+ };
1568
+ var M = class {
1569
+ constructor(t, n = "GraphQL request", r = { line: 1, column: 1 }) {
1570
+ typeof t == "string" ||
1571
+ Z(!1, `Body must be a string. Received: ${ee(t)}.`),
1572
+ (this.body = t),
1573
+ (this.name = n),
1574
+ (this.locationOffset = r),
1575
+ this.locationOffset.line > 0 ||
1576
+ Z(!1, "line in locationOffset is 1-indexed and must be positive."),
1577
+ this.locationOffset.column > 0 ||
1578
+ Z(!1, "column in locationOffset is 1-indexed and must be positive.");
1579
+ }
1580
+ get [Symbol.toStringTag]() {
1581
+ return "Source";
1582
+ }
1583
+ };
1584
+ function ze(e) {
1585
+ return He(e, M);
1586
+ }
1587
+ function Ke(e, t) {
1588
+ return new Ee(e, t).parseDocument();
1589
+ }
1590
+ var Ee = class {
1591
+ constructor(t, n = {}) {
1592
+ let r = ze(t) ? t : new M(t);
1593
+ (this._lexer = new z(r)), (this._options = n), (this._tokenCounter = 0);
1594
+ }
1595
+ parseName() {
1596
+ let t = this.expectToken(o.NAME);
1597
+ return this.node(t, { kind: c.NAME, value: t.value });
1598
+ }
1599
+ parseDocument() {
1600
+ return this.node(this._lexer.token, {
1601
+ kind: c.DOCUMENT,
1602
+ definitions: this.many(o.SOF, this.parseDefinition, o.EOF),
1603
+ });
1604
+ }
1605
+ parseDefinition() {
1606
+ if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
1607
+ let t = this.peekDescription(),
1608
+ n = t ? this._lexer.lookahead() : this._lexer.token;
1609
+ if (n.kind === o.NAME) {
1610
+ switch (n.value) {
1611
+ case "schema":
1612
+ return this.parseSchemaDefinition();
1613
+ case "scalar":
1614
+ return this.parseScalarTypeDefinition();
1615
+ case "type":
1616
+ return this.parseObjectTypeDefinition();
1617
+ case "interface":
1618
+ return this.parseInterfaceTypeDefinition();
1619
+ case "union":
1620
+ return this.parseUnionTypeDefinition();
1621
+ case "enum":
1622
+ return this.parseEnumTypeDefinition();
1623
+ case "input":
1624
+ return this.parseInputObjectTypeDefinition();
1625
+ case "directive":
1626
+ return this.parseDirectiveDefinition();
1627
+ }
1628
+ if (t)
1629
+ throw d(
1630
+ this._lexer.source,
1631
+ this._lexer.token.start,
1632
+ "Unexpected description, descriptions are supported only on type definitions.",
1633
+ );
1634
+ switch (n.value) {
1635
+ case "query":
1636
+ case "mutation":
1637
+ case "subscription":
1638
+ return this.parseOperationDefinition();
1639
+ case "fragment":
1640
+ return this.parseFragmentDefinition();
1641
+ case "extend":
1642
+ return this.parseTypeSystemExtension();
1643
+ }
1644
+ }
1645
+ throw this.unexpected(n);
1646
+ }
1647
+ parseOperationDefinition() {
1648
+ let t = this._lexer.token;
1649
+ if (this.peek(o.BRACE_L))
1650
+ return this.node(t, {
1651
+ kind: c.OPERATION_DEFINITION,
1652
+ operation: S.QUERY,
1653
+ name: void 0,
1654
+ variableDefinitions: [],
1655
+ directives: [],
1656
+ selectionSet: this.parseSelectionSet(),
1657
+ });
1658
+ let n = this.parseOperationType(),
1659
+ r;
1660
+ return (
1661
+ this.peek(o.NAME) && (r = this.parseName()),
1662
+ this.node(t, {
1663
+ kind: c.OPERATION_DEFINITION,
1664
+ operation: n,
1665
+ name: r,
1666
+ variableDefinitions: this.parseVariableDefinitions(),
1667
+ directives: this.parseDirectives(!1),
1668
+ selectionSet: this.parseSelectionSet(),
1669
+ })
1670
+ );
1671
+ }
1672
+ parseOperationType() {
1673
+ let t = this.expectToken(o.NAME);
1674
+ switch (t.value) {
1675
+ case "query":
1676
+ return S.QUERY;
1677
+ case "mutation":
1678
+ return S.MUTATION;
1679
+ case "subscription":
1680
+ return S.SUBSCRIPTION;
1681
+ }
1682
+ throw this.unexpected(t);
1683
+ }
1684
+ parseVariableDefinitions() {
1685
+ return this.optionalMany(
1686
+ o.PAREN_L,
1687
+ this.parseVariableDefinition,
1688
+ o.PAREN_R,
1689
+ );
1690
+ }
1691
+ parseVariableDefinition() {
1692
+ return this.node(this._lexer.token, {
1693
+ kind: c.VARIABLE_DEFINITION,
1694
+ variable: this.parseVariable(),
1695
+ type: (this.expectToken(o.COLON), this.parseTypeReference()),
1696
+ defaultValue: this.expectOptionalToken(o.EQUALS)
1697
+ ? this.parseConstValueLiteral()
1698
+ : void 0,
1699
+ directives: this.parseConstDirectives(),
1700
+ });
1701
+ }
1702
+ parseVariable() {
1703
+ let t = this._lexer.token;
1704
+ return (
1705
+ this.expectToken(o.DOLLAR),
1706
+ this.node(t, { kind: c.VARIABLE, name: this.parseName() })
1707
+ );
1708
+ }
1709
+ parseSelectionSet() {
1710
+ return this.node(this._lexer.token, {
1711
+ kind: c.SELECTION_SET,
1712
+ selections: this.many(o.BRACE_L, this.parseSelection, o.BRACE_R),
1713
+ });
1714
+ }
1715
+ parseSelection() {
1716
+ return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
1717
+ }
1718
+ parseField() {
1719
+ let t = this._lexer.token,
1720
+ n = this.parseName(),
1721
+ r,
1722
+ i;
1723
+ return (
1724
+ this.expectOptionalToken(o.COLON)
1725
+ ? ((r = n), (i = this.parseName()))
1726
+ : (i = n),
1727
+ this.node(t, {
1728
+ kind: c.FIELD,
1729
+ alias: r,
1730
+ name: i,
1731
+ arguments: this.parseArguments(!1),
1732
+ directives: this.parseDirectives(!1),
1733
+ selectionSet: this.peek(o.BRACE_L)
1734
+ ? this.parseSelectionSet()
1735
+ : void 0,
1736
+ })
1737
+ );
1738
+ }
1739
+ parseArguments(t) {
1740
+ let n = t ? this.parseConstArgument : this.parseArgument;
1741
+ return this.optionalMany(o.PAREN_L, n, o.PAREN_R);
1742
+ }
1743
+ parseArgument(t = !1) {
1744
+ let n = this._lexer.token,
1745
+ r = this.parseName();
1746
+ return (
1747
+ this.expectToken(o.COLON),
1748
+ this.node(n, {
1749
+ kind: c.ARGUMENT,
1750
+ name: r,
1751
+ value: this.parseValueLiteral(t),
1752
+ })
1753
+ );
1754
+ }
1755
+ parseConstArgument() {
1756
+ return this.parseArgument(!0);
1757
+ }
1758
+ parseFragment() {
1759
+ let t = this._lexer.token;
1760
+ this.expectToken(o.SPREAD);
1761
+ let n = this.expectOptionalKeyword("on");
1762
+ return !n && this.peek(o.NAME)
1763
+ ? this.node(t, {
1764
+ kind: c.FRAGMENT_SPREAD,
1765
+ name: this.parseFragmentName(),
1766
+ directives: this.parseDirectives(!1),
1767
+ })
1768
+ : this.node(t, {
1769
+ kind: c.INLINE_FRAGMENT,
1770
+ typeCondition: n ? this.parseNamedType() : void 0,
1771
+ directives: this.parseDirectives(!1),
1772
+ selectionSet: this.parseSelectionSet(),
1773
+ });
1774
+ }
1775
+ parseFragmentDefinition() {
1776
+ let t = this._lexer.token;
1777
+ return (
1778
+ this.expectKeyword("fragment"),
1779
+ this._options.allowLegacyFragmentVariables === !0
1780
+ ? this.node(t, {
1781
+ kind: c.FRAGMENT_DEFINITION,
1782
+ name: this.parseFragmentName(),
1783
+ variableDefinitions: this.parseVariableDefinitions(),
1784
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1785
+ directives: this.parseDirectives(!1),
1786
+ selectionSet: this.parseSelectionSet(),
1787
+ })
1788
+ : this.node(t, {
1789
+ kind: c.FRAGMENT_DEFINITION,
1790
+ name: this.parseFragmentName(),
1791
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1792
+ directives: this.parseDirectives(!1),
1793
+ selectionSet: this.parseSelectionSet(),
1794
+ })
1795
+ );
1796
+ }
1797
+ parseFragmentName() {
1798
+ if (this._lexer.token.value === "on") throw this.unexpected();
1799
+ return this.parseName();
1800
+ }
1801
+ parseValueLiteral(t) {
1802
+ let n = this._lexer.token;
1803
+ switch (n.kind) {
1804
+ case o.BRACKET_L:
1805
+ return this.parseList(t);
1806
+ case o.BRACE_L:
1807
+ return this.parseObject(t);
1808
+ case o.INT:
1809
+ return (
1810
+ this.advanceLexer(), this.node(n, { kind: c.INT, value: n.value })
1811
+ );
1812
+ case o.FLOAT:
1813
+ return (
1814
+ this.advanceLexer(), this.node(n, { kind: c.FLOAT, value: n.value })
1815
+ );
1816
+ case o.STRING:
1817
+ case o.BLOCK_STRING:
1818
+ return this.parseStringLiteral();
1819
+ case o.NAME:
1820
+ switch ((this.advanceLexer(), n.value)) {
1821
+ case "true":
1822
+ return this.node(n, { kind: c.BOOLEAN, value: !0 });
1823
+ case "false":
1824
+ return this.node(n, { kind: c.BOOLEAN, value: !1 });
1825
+ case "null":
1826
+ return this.node(n, { kind: c.NULL });
1827
+ default:
1828
+ return this.node(n, { kind: c.ENUM, value: n.value });
1829
+ }
1830
+ case o.DOLLAR:
1831
+ if (t)
1832
+ if (
1833
+ (this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME)
1834
+ ) {
1835
+ let r = this._lexer.token.value;
1836
+ throw d(
1837
+ this._lexer.source,
1838
+ n.start,
1839
+ `Unexpected variable "$${r}" in constant value.`,
1840
+ );
1841
+ } else throw this.unexpected(n);
1842
+ return this.parseVariable();
1843
+ default:
1844
+ throw this.unexpected();
1845
+ }
1846
+ }
1847
+ parseConstValueLiteral() {
1848
+ return this.parseValueLiteral(!0);
1849
+ }
1850
+ parseStringLiteral() {
1851
+ let t = this._lexer.token;
1852
+ return (
1853
+ this.advanceLexer(),
1854
+ this.node(t, {
1855
+ kind: c.STRING,
1856
+ value: t.value,
1857
+ block: t.kind === o.BLOCK_STRING,
1858
+ })
1859
+ );
1860
+ }
1861
+ parseList(t) {
1862
+ let n = () => this.parseValueLiteral(t);
1863
+ return this.node(this._lexer.token, {
1864
+ kind: c.LIST,
1865
+ values: this.any(o.BRACKET_L, n, o.BRACKET_R),
1866
+ });
1867
+ }
1868
+ parseObject(t) {
1869
+ let n = () => this.parseObjectField(t);
1870
+ return this.node(this._lexer.token, {
1871
+ kind: c.OBJECT,
1872
+ fields: this.any(o.BRACE_L, n, o.BRACE_R),
1873
+ });
1874
+ }
1875
+ parseObjectField(t) {
1876
+ let n = this._lexer.token,
1877
+ r = this.parseName();
1878
+ return (
1879
+ this.expectToken(o.COLON),
1880
+ this.node(n, {
1881
+ kind: c.OBJECT_FIELD,
1882
+ name: r,
1883
+ value: this.parseValueLiteral(t),
1884
+ })
1885
+ );
1886
+ }
1887
+ parseDirectives(t) {
1888
+ let n = [];
1889
+ for (; this.peek(o.AT); ) n.push(this.parseDirective(t));
1890
+ return n;
1891
+ }
1892
+ parseConstDirectives() {
1893
+ return this.parseDirectives(!0);
1894
+ }
1895
+ parseDirective(t) {
1896
+ let n = this._lexer.token;
1897
+ return (
1898
+ this.expectToken(o.AT),
1899
+ this.node(n, {
1900
+ kind: c.DIRECTIVE,
1901
+ name: this.parseName(),
1902
+ arguments: this.parseArguments(t),
1903
+ })
1904
+ );
1905
+ }
1906
+ parseTypeReference() {
1907
+ let t = this._lexer.token,
1908
+ n;
1909
+ if (this.expectOptionalToken(o.BRACKET_L)) {
1910
+ let r = this.parseTypeReference();
1911
+ this.expectToken(o.BRACKET_R),
1912
+ (n = this.node(t, { kind: c.LIST_TYPE, type: r }));
1913
+ } else n = this.parseNamedType();
1914
+ return this.expectOptionalToken(o.BANG)
1915
+ ? this.node(t, { kind: c.NON_NULL_TYPE, type: n })
1916
+ : n;
1917
+ }
1918
+ parseNamedType() {
1919
+ return this.node(this._lexer.token, {
1920
+ kind: c.NAMED_TYPE,
1921
+ name: this.parseName(),
1922
+ });
1923
+ }
1924
+ peekDescription() {
1925
+ return this.peek(o.STRING) || this.peek(o.BLOCK_STRING);
1926
+ }
1927
+ parseDescription() {
1928
+ if (this.peekDescription()) return this.parseStringLiteral();
1929
+ }
1930
+ parseSchemaDefinition() {
1931
+ let t = this._lexer.token,
1932
+ n = this.parseDescription();
1933
+ this.expectKeyword("schema");
1934
+ let r = this.parseConstDirectives(),
1935
+ i = this.many(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
1936
+ return this.node(t, {
1937
+ kind: c.SCHEMA_DEFINITION,
1938
+ description: n,
1939
+ directives: r,
1940
+ operationTypes: i,
1941
+ });
1942
+ }
1943
+ parseOperationTypeDefinition() {
1944
+ let t = this._lexer.token,
1945
+ n = this.parseOperationType();
1946
+ this.expectToken(o.COLON);
1947
+ let r = this.parseNamedType();
1948
+ return this.node(t, {
1949
+ kind: c.OPERATION_TYPE_DEFINITION,
1950
+ operation: n,
1951
+ type: r,
1952
+ });
1953
+ }
1954
+ parseScalarTypeDefinition() {
1955
+ let t = this._lexer.token,
1956
+ n = this.parseDescription();
1957
+ this.expectKeyword("scalar");
1958
+ let r = this.parseName(),
1959
+ i = this.parseConstDirectives();
1960
+ return this.node(t, {
1961
+ kind: c.SCALAR_TYPE_DEFINITION,
1962
+ description: n,
1963
+ name: r,
1964
+ directives: i,
1965
+ });
1966
+ }
1967
+ parseObjectTypeDefinition() {
1968
+ let t = this._lexer.token,
1969
+ n = this.parseDescription();
1970
+ this.expectKeyword("type");
1971
+ let r = this.parseName(),
1972
+ i = this.parseImplementsInterfaces(),
1973
+ s = this.parseConstDirectives(),
1974
+ a = this.parseFieldsDefinition();
1975
+ return this.node(t, {
1976
+ kind: c.OBJECT_TYPE_DEFINITION,
1977
+ description: n,
1978
+ name: r,
1979
+ interfaces: i,
1980
+ directives: s,
1981
+ fields: a,
1982
+ });
1983
+ }
1984
+ parseImplementsInterfaces() {
1985
+ return this.expectOptionalKeyword("implements")
1986
+ ? this.delimitedMany(o.AMP, this.parseNamedType)
1987
+ : [];
1988
+ }
1989
+ parseFieldsDefinition() {
1990
+ return this.optionalMany(o.BRACE_L, this.parseFieldDefinition, o.BRACE_R);
1991
+ }
1992
+ parseFieldDefinition() {
1993
+ let t = this._lexer.token,
1994
+ n = this.parseDescription(),
1995
+ r = this.parseName(),
1996
+ i = this.parseArgumentDefs();
1997
+ this.expectToken(o.COLON);
1998
+ let s = this.parseTypeReference(),
1999
+ a = this.parseConstDirectives();
2000
+ return this.node(t, {
2001
+ kind: c.FIELD_DEFINITION,
2002
+ description: n,
2003
+ name: r,
2004
+ arguments: i,
2005
+ type: s,
2006
+ directives: a,
2007
+ });
2008
+ }
2009
+ parseArgumentDefs() {
2010
+ return this.optionalMany(o.PAREN_L, this.parseInputValueDef, o.PAREN_R);
2011
+ }
2012
+ parseInputValueDef() {
2013
+ let t = this._lexer.token,
2014
+ n = this.parseDescription(),
2015
+ r = this.parseName();
2016
+ this.expectToken(o.COLON);
2017
+ let i = this.parseTypeReference(),
2018
+ s;
2019
+ this.expectOptionalToken(o.EQUALS) && (s = this.parseConstValueLiteral());
2020
+ let a = this.parseConstDirectives();
2021
+ return this.node(t, {
2022
+ kind: c.INPUT_VALUE_DEFINITION,
2023
+ description: n,
2024
+ name: r,
2025
+ type: i,
2026
+ defaultValue: s,
2027
+ directives: a,
2028
+ });
2029
+ }
2030
+ parseInterfaceTypeDefinition() {
2031
+ let t = this._lexer.token,
2032
+ n = this.parseDescription();
2033
+ this.expectKeyword("interface");
2034
+ let r = this.parseName(),
2035
+ i = this.parseImplementsInterfaces(),
2036
+ s = this.parseConstDirectives(),
2037
+ a = this.parseFieldsDefinition();
2038
+ return this.node(t, {
2039
+ kind: c.INTERFACE_TYPE_DEFINITION,
2040
+ description: n,
2041
+ name: r,
2042
+ interfaces: i,
2043
+ directives: s,
2044
+ fields: a,
2045
+ });
2046
+ }
2047
+ parseUnionTypeDefinition() {
2048
+ let t = this._lexer.token,
2049
+ n = this.parseDescription();
2050
+ this.expectKeyword("union");
2051
+ let r = this.parseName(),
2052
+ i = this.parseConstDirectives(),
2053
+ s = this.parseUnionMemberTypes();
2054
+ return this.node(t, {
2055
+ kind: c.UNION_TYPE_DEFINITION,
2056
+ description: n,
2057
+ name: r,
2058
+ directives: i,
2059
+ types: s,
2060
+ });
2061
+ }
2062
+ parseUnionMemberTypes() {
2063
+ return this.expectOptionalToken(o.EQUALS)
2064
+ ? this.delimitedMany(o.PIPE, this.parseNamedType)
2065
+ : [];
2066
+ }
2067
+ parseEnumTypeDefinition() {
2068
+ let t = this._lexer.token,
2069
+ n = this.parseDescription();
2070
+ this.expectKeyword("enum");
2071
+ let r = this.parseName(),
2072
+ i = this.parseConstDirectives(),
2073
+ s = this.parseEnumValuesDefinition();
2074
+ return this.node(t, {
2075
+ kind: c.ENUM_TYPE_DEFINITION,
2076
+ description: n,
2077
+ name: r,
2078
+ directives: i,
2079
+ values: s,
2080
+ });
2081
+ }
2082
+ parseEnumValuesDefinition() {
2083
+ return this.optionalMany(
2084
+ o.BRACE_L,
2085
+ this.parseEnumValueDefinition,
2086
+ o.BRACE_R,
2087
+ );
2088
+ }
2089
+ parseEnumValueDefinition() {
2090
+ let t = this._lexer.token,
2091
+ n = this.parseDescription(),
2092
+ r = this.parseEnumValueName(),
2093
+ i = this.parseConstDirectives();
2094
+ return this.node(t, {
2095
+ kind: c.ENUM_VALUE_DEFINITION,
2096
+ description: n,
2097
+ name: r,
2098
+ directives: i,
2099
+ });
2100
+ }
2101
+ parseEnumValueName() {
2102
+ if (
2103
+ this._lexer.token.value === "true" ||
2104
+ this._lexer.token.value === "false" ||
2105
+ this._lexer.token.value === "null"
2106
+ )
2107
+ throw d(
2108
+ this._lexer.source,
2109
+ this._lexer.token.start,
2110
+ `${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`,
2111
+ );
2112
+ return this.parseName();
2113
+ }
2114
+ parseInputObjectTypeDefinition() {
2115
+ let t = this._lexer.token,
2116
+ n = this.parseDescription();
2117
+ this.expectKeyword("input");
2118
+ let r = this.parseName(),
2119
+ i = this.parseConstDirectives(),
2120
+ s = this.parseInputFieldsDefinition();
2121
+ return this.node(t, {
2122
+ kind: c.INPUT_OBJECT_TYPE_DEFINITION,
2123
+ description: n,
2124
+ name: r,
2125
+ directives: i,
2126
+ fields: s,
2127
+ });
2128
+ }
2129
+ parseInputFieldsDefinition() {
2130
+ return this.optionalMany(o.BRACE_L, this.parseInputValueDef, o.BRACE_R);
2131
+ }
2132
+ parseTypeSystemExtension() {
2133
+ let t = this._lexer.lookahead();
2134
+ if (t.kind === o.NAME)
2135
+ switch (t.value) {
2136
+ case "schema":
2137
+ return this.parseSchemaExtension();
2138
+ case "scalar":
2139
+ return this.parseScalarTypeExtension();
2140
+ case "type":
2141
+ return this.parseObjectTypeExtension();
2142
+ case "interface":
2143
+ return this.parseInterfaceTypeExtension();
2144
+ case "union":
2145
+ return this.parseUnionTypeExtension();
2146
+ case "enum":
2147
+ return this.parseEnumTypeExtension();
2148
+ case "input":
2149
+ return this.parseInputObjectTypeExtension();
2150
+ }
2151
+ throw this.unexpected(t);
2152
+ }
2153
+ parseSchemaExtension() {
2154
+ let t = this._lexer.token;
2155
+ this.expectKeyword("extend"), this.expectKeyword("schema");
2156
+ let n = this.parseConstDirectives(),
2157
+ r = this.optionalMany(
2158
+ o.BRACE_L,
2159
+ this.parseOperationTypeDefinition,
2160
+ o.BRACE_R,
2161
+ );
2162
+ if (n.length === 0 && r.length === 0) throw this.unexpected();
2163
+ return this.node(t, {
2164
+ kind: c.SCHEMA_EXTENSION,
2165
+ directives: n,
2166
+ operationTypes: r,
2167
+ });
2168
+ }
2169
+ parseScalarTypeExtension() {
2170
+ let t = this._lexer.token;
2171
+ this.expectKeyword("extend"), this.expectKeyword("scalar");
2172
+ let n = this.parseName(),
2173
+ r = this.parseConstDirectives();
2174
+ if (r.length === 0) throw this.unexpected();
2175
+ return this.node(t, {
2176
+ kind: c.SCALAR_TYPE_EXTENSION,
2177
+ name: n,
2178
+ directives: r,
2179
+ });
2180
+ }
2181
+ parseObjectTypeExtension() {
2182
+ let t = this._lexer.token;
2183
+ this.expectKeyword("extend"), this.expectKeyword("type");
2184
+ let n = this.parseName(),
2185
+ r = this.parseImplementsInterfaces(),
2186
+ i = this.parseConstDirectives(),
2187
+ s = this.parseFieldsDefinition();
2188
+ if (r.length === 0 && i.length === 0 && s.length === 0)
2189
+ throw this.unexpected();
2190
+ return this.node(t, {
2191
+ kind: c.OBJECT_TYPE_EXTENSION,
2192
+ name: n,
2193
+ interfaces: r,
2194
+ directives: i,
2195
+ fields: s,
2196
+ });
2197
+ }
2198
+ parseInterfaceTypeExtension() {
2199
+ let t = this._lexer.token;
2200
+ this.expectKeyword("extend"), this.expectKeyword("interface");
2201
+ let n = this.parseName(),
2202
+ r = this.parseImplementsInterfaces(),
2203
+ i = this.parseConstDirectives(),
2204
+ s = this.parseFieldsDefinition();
2205
+ if (r.length === 0 && i.length === 0 && s.length === 0)
2206
+ throw this.unexpected();
2207
+ return this.node(t, {
2208
+ kind: c.INTERFACE_TYPE_EXTENSION,
2209
+ name: n,
2210
+ interfaces: r,
2211
+ directives: i,
2212
+ fields: s,
2213
+ });
2214
+ }
2215
+ parseUnionTypeExtension() {
2216
+ let t = this._lexer.token;
2217
+ this.expectKeyword("extend"), this.expectKeyword("union");
2218
+ let n = this.parseName(),
2219
+ r = this.parseConstDirectives(),
2220
+ i = this.parseUnionMemberTypes();
2221
+ if (r.length === 0 && i.length === 0) throw this.unexpected();
2222
+ return this.node(t, {
2223
+ kind: c.UNION_TYPE_EXTENSION,
2224
+ name: n,
2225
+ directives: r,
2226
+ types: i,
2227
+ });
2228
+ }
2229
+ parseEnumTypeExtension() {
2230
+ let t = this._lexer.token;
2231
+ this.expectKeyword("extend"), this.expectKeyword("enum");
2232
+ let n = this.parseName(),
2233
+ r = this.parseConstDirectives(),
2234
+ i = this.parseEnumValuesDefinition();
2235
+ if (r.length === 0 && i.length === 0) throw this.unexpected();
2236
+ return this.node(t, {
2237
+ kind: c.ENUM_TYPE_EXTENSION,
2238
+ name: n,
2239
+ directives: r,
2240
+ values: i,
2241
+ });
2242
+ }
2243
+ parseInputObjectTypeExtension() {
2244
+ let t = this._lexer.token;
2245
+ this.expectKeyword("extend"), this.expectKeyword("input");
2246
+ let n = this.parseName(),
2247
+ r = this.parseConstDirectives(),
2248
+ i = this.parseInputFieldsDefinition();
2249
+ if (r.length === 0 && i.length === 0) throw this.unexpected();
2250
+ return this.node(t, {
2251
+ kind: c.INPUT_OBJECT_TYPE_EXTENSION,
2252
+ name: n,
2253
+ directives: r,
2254
+ fields: i,
2255
+ });
2256
+ }
2257
+ parseDirectiveDefinition() {
2258
+ let t = this._lexer.token,
2259
+ n = this.parseDescription();
2260
+ this.expectKeyword("directive"), this.expectToken(o.AT);
2261
+ let r = this.parseName(),
2262
+ i = this.parseArgumentDefs(),
2263
+ s = this.expectOptionalKeyword("repeatable");
2264
+ this.expectKeyword("on");
2265
+ let a = this.parseDirectiveLocations();
2266
+ return this.node(t, {
2267
+ kind: c.DIRECTIVE_DEFINITION,
2268
+ description: n,
2269
+ name: r,
2270
+ arguments: i,
2271
+ repeatable: s,
2272
+ locations: a,
2273
+ });
2274
+ }
2275
+ parseDirectiveLocations() {
2276
+ return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
2277
+ }
2278
+ parseDirectiveLocation() {
2279
+ let t = this._lexer.token,
2280
+ n = this.parseName();
2281
+ if (Object.prototype.hasOwnProperty.call(H, n.value)) return n;
2282
+ throw this.unexpected(t);
2283
+ }
2284
+ node(t, n) {
2285
+ return (
2286
+ this._options.noLocation !== !0 &&
2287
+ (n.loc = new J(t, this._lexer.lastToken, this._lexer.source)),
2288
+ n
2289
+ );
2290
+ }
2291
+ peek(t) {
2292
+ return this._lexer.token.kind === t;
2293
+ }
2294
+ expectToken(t) {
2295
+ let n = this._lexer.token;
2296
+ if (n.kind === t) return this.advanceLexer(), n;
2297
+ throw d(
2298
+ this._lexer.source,
2299
+ n.start,
2300
+ `Expected ${Ze(t)}, found ${ne(n)}.`,
2301
+ );
2302
+ }
2303
+ expectOptionalToken(t) {
2304
+ return this._lexer.token.kind === t ? (this.advanceLexer(), !0) : !1;
2305
+ }
2306
+ expectKeyword(t) {
2307
+ let n = this._lexer.token;
2308
+ if (n.kind === o.NAME && n.value === t) this.advanceLexer();
2309
+ else
2310
+ throw d(
2311
+ this._lexer.source,
2312
+ n.start,
2313
+ `Expected "${t}", found ${ne(n)}.`,
2314
+ );
2315
+ }
2316
+ expectOptionalKeyword(t) {
2317
+ let n = this._lexer.token;
2318
+ return n.kind === o.NAME && n.value === t
2319
+ ? (this.advanceLexer(), !0)
2320
+ : !1;
2321
+ }
2322
+ unexpected(t) {
2323
+ let n = t ?? this._lexer.token;
2324
+ return d(this._lexer.source, n.start, `Unexpected ${ne(n)}.`);
2325
+ }
2326
+ any(t, n, r) {
2327
+ this.expectToken(t);
2328
+ let i = [];
2329
+ for (; !this.expectOptionalToken(r); ) i.push(n.call(this));
2330
+ return i;
2331
+ }
2332
+ optionalMany(t, n, r) {
2333
+ if (this.expectOptionalToken(t)) {
2334
+ let i = [];
2335
+ do i.push(n.call(this));
2336
+ while (!this.expectOptionalToken(r));
2337
+ return i;
2338
+ }
2339
+ return [];
2340
+ }
2341
+ many(t, n, r) {
2342
+ this.expectToken(t);
2343
+ let i = [];
2344
+ do i.push(n.call(this));
2345
+ while (!this.expectOptionalToken(r));
2346
+ return i;
2347
+ }
2348
+ delimitedMany(t, n) {
2349
+ this.expectOptionalToken(t);
2350
+ let r = [];
2351
+ do r.push(n.call(this));
2352
+ while (this.expectOptionalToken(t));
2353
+ return r;
2354
+ }
2355
+ advanceLexer() {
2356
+ let { maxTokens: t } = this._options,
2357
+ n = this._lexer.advance();
2358
+ if (
2359
+ t !== void 0 &&
2360
+ n.kind !== o.EOF &&
2361
+ (++this._tokenCounter, this._tokenCounter > t)
2362
+ )
2363
+ throw d(
2364
+ this._lexer.source,
2365
+ n.start,
2366
+ `Document contains more that ${t} tokens. Parsing aborted.`,
2367
+ );
2368
+ }
2369
+ };
2370
+ function ne(e) {
2371
+ let t = e.value;
2372
+ return Ze(e.kind) + (t != null ? ` "${t}"` : "");
2373
+ }
2374
+ function Ze(e) {
2375
+ return qe(e) ? `"${e}"` : e;
2376
+ }
2377
+ function nn(e, t) {
2378
+ let n = new SyntaxError(
2379
+ e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")",
2380
+ );
2381
+ return Object.assign(n, t);
2382
+ }
2383
+ var et = nn;
2384
+ function rn(e) {
2385
+ let t = [],
2386
+ { startToken: n, endToken: r } = e.loc;
2387
+ for (let i = n; i !== r; i = i.next)
2388
+ i.kind === "Comment" &&
2389
+ t.push({ ...i, loc: { start: i.start, end: i.end } });
2390
+ return t;
2391
+ }
2392
+ var sn = { allowLegacyFragmentVariables: !0 };
2393
+ function on(e) {
2394
+ if ((e == null ? void 0 : e.name) === "GraphQLError") {
2395
+ let {
2396
+ message: t,
2397
+ locations: [n],
2398
+ } = e;
2399
+ return et(t, { loc: { start: n }, cause: e });
2400
+ }
2401
+ return e;
2402
+ }
2403
+ function an(e) {
2404
+ let t;
2405
+ try {
2406
+ t = Ke(e, sn);
2407
+ } catch (n) {
2408
+ throw on(n);
2409
+ }
2410
+ return (t.comments = rn(t)), t;
2411
+ }
2412
+ var cn = {
2413
+ parse: an,
2414
+ astFormat: "graphql",
2415
+ hasPragma: Ce,
2416
+ locStart: q,
2417
+ locEnd: Q,
2418
+ };
2419
+ var un = { graphql: Re };
2420
+ return st(ln);
2421
+ });