@mpen/rerouter 0.3.0 → 0.3.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.
Files changed (66) hide show
  1. package/README.md +4 -0
  2. package/{src → cli}/bin.test.ts +24 -2
  3. package/{src → cli}/bin.ts +27 -18
  4. package/cli/tsconfig.json +9 -0
  5. package/dist/acorn-k7ED_tOl.js +4968 -0
  6. package/dist/angular--Iqdw9UJ.js +4057 -0
  7. package/dist/babel-hfWAujRY.js +9878 -0
  8. package/dist/bin.d.ts +1 -1
  9. package/dist/bin.js +28 -23
  10. package/dist/estree-C1Zjnvlw.js +7266 -0
  11. package/dist/flow-BaD9LyIP.js +52912 -0
  12. package/dist/glimmer-CvCjW_1V.js +7541 -0
  13. package/dist/graphql-BdtzBuWh.js +1945 -0
  14. package/dist/html-DkZtUVbo.js +7137 -0
  15. package/dist/index.d.ts +19 -6
  16. package/dist/index.js +135 -27
  17. package/dist/markdown-Z8Vrc69e.js +6876 -0
  18. package/dist/meriyah-DeO4stuH.js +7590 -0
  19. package/dist/postcss-BmgGJ0E5.js +6777 -0
  20. package/dist/prettier-BT_F8kIx.js +15629 -0
  21. package/dist/typescript-DtIxStjy.js +22936 -0
  22. package/dist/yaml-CWOPBY0q.js +5281 -0
  23. package/examples/App.tsx +18 -49
  24. package/examples/dist/BlogPost-c10d9w2p.js +1 -0
  25. package/examples/dist/FetchLoading-534mdrgz.js +1 -0
  26. package/examples/dist/FetchLoading-sbxbdkre.js +1 -0
  27. package/examples/dist/Home-a1258p25.js +1 -0
  28. package/examples/dist/KitchenSink-821mjg0h.js +1 -0
  29. package/examples/dist/Login-wywx6bp7.js +1 -0
  30. package/examples/dist/Match-1e72jm5w.js +1 -0
  31. package/examples/dist/NotFound-smxj24jw.js +1 -0
  32. package/examples/dist/SlowLoading-59xxmbfk.js +1 -0
  33. package/examples/dist/index-0d4kj0rv.js +2 -0
  34. package/examples/dist/index-3x197sbt.js +9 -0
  35. package/examples/dist/index-a2hkfx1n.js +9 -0
  36. package/examples/dist/index-d21me1mc.js +9 -0
  37. package/examples/dist/index-ktqdknsn.js +2 -0
  38. package/examples/dist/index-p53qxxzd.js +2 -0
  39. package/examples/dist/index.html +67 -0
  40. package/examples/routes.gen.ts +66 -86
  41. package/examples/routes.ts +2 -2
  42. package/examples/server/serve-dist.ts +33 -0
  43. package/examples/server/tsconfig.json +9 -0
  44. package/package.json +11 -6
  45. package/src/components/Link.tsx +8 -6
  46. package/src/components/Router.test.tsx +183 -0
  47. package/src/components/Router.tsx +161 -29
  48. package/src/lib/routes.ts +2 -0
  49. package/tsconfig.json +3 -2
  50. package/tsdown.config.ts +3 -4
  51. package/dist/hooks-Dlwcb0sV.js +0 -20
  52. package/dist/hooks.d.ts +0 -2
  53. package/dist/hooks.js +0 -2
  54. package/dist/index-BYXpNitc.d.ts +0 -5
  55. /package/{src → cli}/fixtures/bin/kitchen-sink.tsx +0 -0
  56. /package/{src → cli}/fixtures/bin/optional.tsx +0 -0
  57. /package/{src → cli}/fixtures/bin/pages/Home.tsx +0 -0
  58. /package/{src → cli}/fixtures/bin/pages/KitchenSink.tsx +0 -0
  59. /package/{src → cli}/fixtures/bin/pages/Login.tsx +0 -0
  60. /package/{src → cli}/fixtures/bin/pages/Match.tsx +0 -0
  61. /package/{src → cli}/fixtures/bin/pages/NotFound.tsx +0 -0
  62. /package/{src → cli}/fixtures/bin/pages/Optional.tsx +0 -0
  63. /package/{src → cli}/fixtures/bin/regexp-groups.tsx +0 -0
  64. /package/{src → cli}/fixtures/bin/simple.tsx +0 -0
  65. /package/{src → cli}/fixtures/bin/unnamed.tsx +0 -0
  66. /package/dist/{routes-Hpf6cwcZ.js → routes-PW-bNm8e.js} +0 -0
@@ -0,0 +1,1945 @@
1
+ //#region ../../node_modules/.bun/prettier@3.8.3/node_modules/prettier/plugins/graphql.mjs
2
+ var pt = Object.defineProperty;
3
+ var de = (e, t) => {
4
+ for (var n in t) pt(e, n, {
5
+ get: t[n],
6
+ enumerable: !0
7
+ });
8
+ };
9
+ var ut = {};
10
+ de(ut, {
11
+ languages: () => Ye,
12
+ options: () => $e,
13
+ parsers: () => he,
14
+ printers: () => nn
15
+ });
16
+ var me = (e, t) => (n, i, ...r) => n | 1 && i == null ? void 0 : (t.call(i) ?? i[e]).apply(i, r);
17
+ var lt = String.prototype.replaceAll ?? function(e, t) {
18
+ return e.global ? this.replace(e, t) : this.split(e).join(t);
19
+ }, U = me("replaceAll", function() {
20
+ if (typeof this == "string") return lt;
21
+ });
22
+ var ht = () => {}, ie = ht;
23
+ var Ee = "indent";
24
+ var Te = "group";
25
+ var Ne = "if-break";
26
+ var G = "line";
27
+ var xe = "break-parent";
28
+ var S = ie, Y = ie;
29
+ function x(e) {
30
+ return S(e), {
31
+ type: Ee,
32
+ contents: e
33
+ };
34
+ }
35
+ var _e = { type: xe };
36
+ function y(e, t = {}) {
37
+ return S(e), Y(t.expandedStates, !0), {
38
+ type: Te,
39
+ id: t.id,
40
+ contents: e,
41
+ break: !!t.shouldBreak,
42
+ expandedStates: t.expandedStates
43
+ };
44
+ }
45
+ function I(e, t = "", n = {}) {
46
+ return S(e), t !== "" && S(t), {
47
+ type: Ne,
48
+ breakContents: e,
49
+ flatContents: t,
50
+ groupId: n.groupId
51
+ };
52
+ }
53
+ function E(e, t) {
54
+ S(e), Y(t);
55
+ let n = [];
56
+ for (let i = 0; i < t.length; i++) i !== 0 && n.push(e), n.push(t[i]);
57
+ return n;
58
+ }
59
+ var k = { type: G }, l = {
60
+ type: G,
61
+ soft: !0
62
+ }, f = [{
63
+ type: G,
64
+ hard: !0
65
+ }, _e];
66
+ function j(e) {
67
+ return (t, n, i) => {
68
+ let r = !!i?.backwards;
69
+ if (n === !1) return !1;
70
+ let { length: s } = t, a = n;
71
+ for (; a >= 0 && a < s;) {
72
+ let u = t.charAt(a);
73
+ if (e instanceof RegExp) {
74
+ if (!e.test(u)) return a;
75
+ } else if (!e.includes(u)) return a;
76
+ r ? a-- : a++;
77
+ }
78
+ return a === -1 || a === s ? a : !1;
79
+ };
80
+ }
81
+ j(/\s/u);
82
+ var $ = j(" "), ye = j(",; "), Ae = j(/[^\n\r]/u);
83
+ var Oe = (e) => e === `
84
+ ` || e === "\r" || e === "\u2028" || e === "\u2029";
85
+ function mt(e, t, n) {
86
+ let i = !!n?.backwards;
87
+ if (t === !1) return !1;
88
+ let r = e.charAt(t);
89
+ if (i) {
90
+ if (e.charAt(t - 1) === "\r" && r === `
91
+ `) return t - 2;
92
+ if (Oe(r)) return t - 1;
93
+ } else {
94
+ if (r === "\r" && e.charAt(t + 1) === `
95
+ `) return t + 2;
96
+ if (Oe(r)) return t + 1;
97
+ }
98
+ return t;
99
+ }
100
+ var X = mt;
101
+ function Et(e, t, n = {}) {
102
+ let i = $(e, n.backwards ? t - 1 : t, n);
103
+ return i !== X(e, i, n);
104
+ }
105
+ var Ie = Et;
106
+ function Tt(e, t) {
107
+ if (t === !1) return !1;
108
+ if (e.charAt(t) === "/" && e.charAt(t + 1) === "*") {
109
+ for (let n = t + 2; n < e.length; ++n) if (e.charAt(n) === "*" && e.charAt(n + 1) === "/") return n + 2;
110
+ }
111
+ return t;
112
+ }
113
+ var De = Tt;
114
+ function Nt(e, t) {
115
+ return t === !1 ? !1 : e.charAt(t) === "/" && e.charAt(t + 1) === "/" ? Ae(e, t) : t;
116
+ }
117
+ var ge = Nt;
118
+ function xt(e, t) {
119
+ let n = null, i = t;
120
+ for (; i !== n;) n = i, i = ye(e, i), i = De(e, i), i = $(e, i);
121
+ return i = ge(e, i), i = X(e, i), i !== !1 && Ie(e, i);
122
+ }
123
+ var Se = xt;
124
+ function _t(e) {
125
+ return Array.isArray(e) && e.length > 0;
126
+ }
127
+ var se = _t;
128
+ var oe = class extends Error {
129
+ name = "UnexpectedNodeError";
130
+ constructor(t, n, i = "type") {
131
+ super(`Unexpected ${n} node ${i}: ${JSON.stringify(t[i])}.`), this.node = t;
132
+ }
133
+ }, ke = oe;
134
+ var P = null;
135
+ function w(e) {
136
+ if (P !== null && typeof P.property) {
137
+ let t = P;
138
+ return P = w.prototype = null, t;
139
+ }
140
+ return P = w.prototype = e ?? Object.create(null), new w();
141
+ }
142
+ var yt = 10;
143
+ for (let e = 0; e <= yt; e++) w();
144
+ function ae(e) {
145
+ return w(e);
146
+ }
147
+ function At(e, t = "type") {
148
+ ae(e);
149
+ function n(i) {
150
+ let r = i[t], s = e[r];
151
+ if (!Array.isArray(s)) throw Object.assign(/* @__PURE__ */ new Error(`Missing visitor keys for '${r}'.`), { node: i });
152
+ return s;
153
+ }
154
+ return n;
155
+ }
156
+ var Ce = At, H = class {
157
+ constructor(t, n, i) {
158
+ this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
159
+ }
160
+ get [Symbol.toStringTag]() {
161
+ return "Location";
162
+ }
163
+ toJSON() {
164
+ return {
165
+ start: this.start,
166
+ end: this.end
167
+ };
168
+ }
169
+ }, F = class {
170
+ constructor(t, n, i, r, s, a) {
171
+ this.kind = t, this.start = n, this.end = i, this.line = r, this.column = s, this.value = a, this.prev = null, this.next = null;
172
+ }
173
+ get [Symbol.toStringTag]() {
174
+ return "Token";
175
+ }
176
+ toJSON() {
177
+ return {
178
+ kind: this.kind,
179
+ value: this.value,
180
+ line: this.line,
181
+ column: this.column
182
+ };
183
+ }
184
+ }, ce = {
185
+ Name: [],
186
+ Document: ["definitions"],
187
+ OperationDefinition: [
188
+ "description",
189
+ "name",
190
+ "variableDefinitions",
191
+ "directives",
192
+ "selectionSet"
193
+ ],
194
+ VariableDefinition: [
195
+ "description",
196
+ "variable",
197
+ "type",
198
+ "defaultValue",
199
+ "directives"
200
+ ],
201
+ Variable: ["name"],
202
+ SelectionSet: ["selections"],
203
+ Field: [
204
+ "alias",
205
+ "name",
206
+ "arguments",
207
+ "directives",
208
+ "selectionSet"
209
+ ],
210
+ Argument: ["name", "value"],
211
+ FragmentSpread: ["name", "directives"],
212
+ InlineFragment: [
213
+ "typeCondition",
214
+ "directives",
215
+ "selectionSet"
216
+ ],
217
+ FragmentDefinition: [
218
+ "description",
219
+ "name",
220
+ "variableDefinitions",
221
+ "typeCondition",
222
+ "directives",
223
+ "selectionSet"
224
+ ],
225
+ IntValue: [],
226
+ FloatValue: [],
227
+ StringValue: [],
228
+ BooleanValue: [],
229
+ NullValue: [],
230
+ EnumValue: [],
231
+ ListValue: ["values"],
232
+ ObjectValue: ["fields"],
233
+ ObjectField: ["name", "value"],
234
+ Directive: ["name", "arguments"],
235
+ NamedType: ["name"],
236
+ ListType: ["type"],
237
+ NonNullType: ["type"],
238
+ SchemaDefinition: [
239
+ "description",
240
+ "directives",
241
+ "operationTypes"
242
+ ],
243
+ OperationTypeDefinition: ["type"],
244
+ ScalarTypeDefinition: [
245
+ "description",
246
+ "name",
247
+ "directives"
248
+ ],
249
+ ObjectTypeDefinition: [
250
+ "description",
251
+ "name",
252
+ "interfaces",
253
+ "directives",
254
+ "fields"
255
+ ],
256
+ FieldDefinition: [
257
+ "description",
258
+ "name",
259
+ "arguments",
260
+ "type",
261
+ "directives"
262
+ ],
263
+ InputValueDefinition: [
264
+ "description",
265
+ "name",
266
+ "type",
267
+ "defaultValue",
268
+ "directives"
269
+ ],
270
+ InterfaceTypeDefinition: [
271
+ "description",
272
+ "name",
273
+ "interfaces",
274
+ "directives",
275
+ "fields"
276
+ ],
277
+ UnionTypeDefinition: [
278
+ "description",
279
+ "name",
280
+ "directives",
281
+ "types"
282
+ ],
283
+ EnumTypeDefinition: [
284
+ "description",
285
+ "name",
286
+ "directives",
287
+ "values"
288
+ ],
289
+ EnumValueDefinition: [
290
+ "description",
291
+ "name",
292
+ "directives"
293
+ ],
294
+ InputObjectTypeDefinition: [
295
+ "description",
296
+ "name",
297
+ "directives",
298
+ "fields"
299
+ ],
300
+ DirectiveDefinition: [
301
+ "description",
302
+ "name",
303
+ "arguments",
304
+ "locations"
305
+ ],
306
+ SchemaExtension: ["directives", "operationTypes"],
307
+ ScalarTypeExtension: ["name", "directives"],
308
+ ObjectTypeExtension: [
309
+ "name",
310
+ "interfaces",
311
+ "directives",
312
+ "fields"
313
+ ],
314
+ InterfaceTypeExtension: [
315
+ "name",
316
+ "interfaces",
317
+ "directives",
318
+ "fields"
319
+ ],
320
+ UnionTypeExtension: [
321
+ "name",
322
+ "directives",
323
+ "types"
324
+ ],
325
+ EnumTypeExtension: [
326
+ "name",
327
+ "directives",
328
+ "values"
329
+ ],
330
+ InputObjectTypeExtension: [
331
+ "name",
332
+ "directives",
333
+ "fields"
334
+ ],
335
+ TypeCoordinate: ["name"],
336
+ MemberCoordinate: ["name", "memberName"],
337
+ ArgumentCoordinate: [
338
+ "name",
339
+ "fieldName",
340
+ "argumentName"
341
+ ],
342
+ DirectiveCoordinate: ["name"],
343
+ DirectiveArgumentCoordinate: ["name", "argumentName"]
344
+ };
345
+ new Set(Object.keys(ce));
346
+ var C;
347
+ (function(e) {
348
+ e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
349
+ })(C || (C = {}));
350
+ var Re = { ...ce };
351
+ for (let e of [
352
+ "ArgumentCoordinate",
353
+ "DirectiveArgumentCoordinate",
354
+ "DirectiveCoordinate",
355
+ "MemberCoordinate",
356
+ "TypeCoordinate"
357
+ ]) delete Re[e];
358
+ var be = Ce(Re, "kind");
359
+ var J = (e) => e.loc.start, q = (e) => e.loc.end;
360
+ var Le = "format", Pe = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u, we = /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u;
361
+ var Fe = (e) => we.test(e), Me = (e) => Pe.test(e), Ve = (e) => `# @${Le}
362
+
363
+ ${e}`;
364
+ function It(e, t, n) {
365
+ let { node: i } = e;
366
+ if (!i.description) return "";
367
+ let r = [n("description")];
368
+ return i.kind === "InputValueDefinition" && !i.description.block ? r.push(k) : r.push(f), r;
369
+ }
370
+ var A = It;
371
+ function Dt(e, t, n) {
372
+ let { node: i } = e;
373
+ switch (i.kind) {
374
+ case "Document": return [...E(f, g(e, t, n, "definitions")), f];
375
+ case "OperationDefinition": {
376
+ let r = t.originalText[J(i)] !== "{", s = !!i.name;
377
+ return [
378
+ A(e, t, n),
379
+ r ? i.operation : "",
380
+ r && s ? [" ", n("name")] : "",
381
+ r && !s && se(i.variableDefinitions) ? " " : "",
382
+ Be(e, n),
383
+ _(e, n, i),
384
+ !r && !s ? "" : " ",
385
+ n("selectionSet")
386
+ ];
387
+ }
388
+ case "FragmentDefinition": return [
389
+ A(e, t, n),
390
+ "fragment ",
391
+ n("name"),
392
+ Be(e, n),
393
+ " on ",
394
+ n("typeCondition"),
395
+ _(e, n, i),
396
+ " ",
397
+ n("selectionSet")
398
+ ];
399
+ case "SelectionSet": return [
400
+ "{",
401
+ x([f, E(f, g(e, t, n, "selections"))]),
402
+ f,
403
+ "}"
404
+ ];
405
+ case "Field": return y([
406
+ i.alias ? [n("alias"), ": "] : "",
407
+ n("name"),
408
+ i.arguments.length > 0 ? y([
409
+ "(",
410
+ x([l, E([I("", ", "), l], g(e, t, n, "arguments"))]),
411
+ l,
412
+ ")"
413
+ ]) : "",
414
+ _(e, n, i),
415
+ i.selectionSet ? " " : "",
416
+ n("selectionSet")
417
+ ]);
418
+ case "Name": return i.value;
419
+ case "StringValue":
420
+ if (i.block) {
421
+ let r = U(0, i.value, "\"\"\"", "\\\"\"\"").split(`
422
+ `);
423
+ return r.length === 1 && (r[0] = r[0].trim()), r.every((s) => s === "") && (r.length = 0), E(f, [
424
+ "\"\"\"",
425
+ ...r,
426
+ "\"\"\""
427
+ ]);
428
+ }
429
+ return [
430
+ "\"",
431
+ U(0, U(0, i.value, /["\\]/gu, "\\$&"), `
432
+ `, "\\n"),
433
+ "\""
434
+ ];
435
+ case "IntValue":
436
+ case "FloatValue":
437
+ case "EnumValue": return i.value;
438
+ case "BooleanValue": return i.value ? "true" : "false";
439
+ case "NullValue": return "null";
440
+ case "Variable": return ["$", n("name")];
441
+ case "ListValue": return y([
442
+ "[",
443
+ x([l, E([I("", ", "), l], e.map(n, "values"))]),
444
+ l,
445
+ "]"
446
+ ]);
447
+ case "ObjectValue": {
448
+ let r = t.bracketSpacing && i.fields.length > 0 ? " " : "";
449
+ return y([
450
+ "{",
451
+ r,
452
+ x([l, E([I("", ", "), l], e.map(n, "fields"))]),
453
+ l,
454
+ I("", r),
455
+ "}"
456
+ ]);
457
+ }
458
+ case "ObjectField":
459
+ case "Argument": return [
460
+ n("name"),
461
+ ": ",
462
+ n("value")
463
+ ];
464
+ case "Directive": return [
465
+ "@",
466
+ n("name"),
467
+ i.arguments.length > 0 ? y([
468
+ "(",
469
+ x([l, E([I("", ", "), l], g(e, t, n, "arguments"))]),
470
+ l,
471
+ ")"
472
+ ]) : ""
473
+ ];
474
+ case "NamedType": return n("name");
475
+ case "VariableDefinition": return [
476
+ A(e, t, n),
477
+ n("variable"),
478
+ ": ",
479
+ n("type"),
480
+ i.defaultValue ? [" = ", n("defaultValue")] : "",
481
+ _(e, n, i)
482
+ ];
483
+ case "ObjectTypeExtension":
484
+ case "ObjectTypeDefinition":
485
+ case "InputObjectTypeExtension":
486
+ case "InputObjectTypeDefinition":
487
+ case "InterfaceTypeExtension":
488
+ case "InterfaceTypeDefinition": {
489
+ let { kind: r } = i, s = [];
490
+ return r.endsWith("TypeDefinition") ? s.push(A(e, 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 ", ...kt(e, t, n)), s.push(_(e, n, i)), i.fields.length > 0 && s.push([
491
+ " {",
492
+ x([f, E(f, g(e, t, n, "fields"))]),
493
+ f,
494
+ "}"
495
+ ]), s;
496
+ }
497
+ case "FieldDefinition": return [
498
+ A(e, t, n),
499
+ n("name"),
500
+ i.arguments.length > 0 ? y([
501
+ "(",
502
+ x([l, E([I("", ", "), l], g(e, t, n, "arguments"))]),
503
+ l,
504
+ ")"
505
+ ]) : "",
506
+ ": ",
507
+ n("type"),
508
+ _(e, n, i)
509
+ ];
510
+ case "DirectiveDefinition": return [
511
+ A(e, t, n),
512
+ "directive ",
513
+ "@",
514
+ n("name"),
515
+ i.arguments.length > 0 ? y([
516
+ "(",
517
+ x([l, E([I("", ", "), l], g(e, t, n, "arguments"))]),
518
+ l,
519
+ ")"
520
+ ]) : "",
521
+ i.repeatable ? " repeatable" : "",
522
+ " on ",
523
+ ...E(" | ", e.map(n, "locations"))
524
+ ];
525
+ case "EnumTypeExtension":
526
+ case "EnumTypeDefinition": return [
527
+ A(e, t, n),
528
+ i.kind === "EnumTypeExtension" ? "extend " : "",
529
+ "enum ",
530
+ n("name"),
531
+ _(e, n, i),
532
+ i.values.length > 0 ? [
533
+ " {",
534
+ x([f, E(f, g(e, t, n, "values"))]),
535
+ f,
536
+ "}"
537
+ ] : ""
538
+ ];
539
+ case "EnumValueDefinition": return [
540
+ A(e, t, n),
541
+ n("name"),
542
+ _(e, n, i)
543
+ ];
544
+ case "InputValueDefinition": return [
545
+ A(e, t, n),
546
+ n("name"),
547
+ ": ",
548
+ n("type"),
549
+ i.defaultValue ? [" = ", n("defaultValue")] : "",
550
+ _(e, n, i)
551
+ ];
552
+ case "SchemaExtension": return [
553
+ "extend schema",
554
+ _(e, n, i),
555
+ ...i.operationTypes.length > 0 ? [
556
+ " {",
557
+ x([f, E(f, g(e, t, n, "operationTypes"))]),
558
+ f,
559
+ "}"
560
+ ] : []
561
+ ];
562
+ case "SchemaDefinition": return [
563
+ A(e, t, n),
564
+ "schema",
565
+ _(e, n, i),
566
+ " {",
567
+ i.operationTypes.length > 0 ? x([f, E(f, g(e, t, n, "operationTypes"))]) : "",
568
+ f,
569
+ "}"
570
+ ];
571
+ case "OperationTypeDefinition": return [
572
+ i.operation,
573
+ ": ",
574
+ n("type")
575
+ ];
576
+ case "FragmentSpread": return [
577
+ "...",
578
+ n("name"),
579
+ _(e, n, i)
580
+ ];
581
+ case "InlineFragment": return [
582
+ "...",
583
+ i.typeCondition ? [" on ", n("typeCondition")] : "",
584
+ _(e, n, i),
585
+ " ",
586
+ n("selectionSet")
587
+ ];
588
+ case "UnionTypeExtension":
589
+ case "UnionTypeDefinition": return y([A(e, t, n), y([
590
+ i.kind === "UnionTypeExtension" ? "extend " : "",
591
+ "union ",
592
+ n("name"),
593
+ _(e, n, i),
594
+ i.types.length > 0 ? [
595
+ " =",
596
+ I("", " "),
597
+ x([I([k, "| "]), E([k, "| "], e.map(n, "types"))])
598
+ ] : ""
599
+ ])]);
600
+ case "ScalarTypeExtension":
601
+ case "ScalarTypeDefinition": return [
602
+ A(e, t, n),
603
+ i.kind === "ScalarTypeExtension" ? "extend " : "",
604
+ "scalar ",
605
+ n("name"),
606
+ _(e, n, i)
607
+ ];
608
+ case "NonNullType": return [n("type"), "!"];
609
+ case "ListType": return [
610
+ "[",
611
+ n("type"),
612
+ "]"
613
+ ];
614
+ default: throw new ke(i, "Graphql", "kind");
615
+ }
616
+ }
617
+ function _(e, t, n) {
618
+ if (n.directives.length === 0) return "";
619
+ let i = E(k, e.map(t, "directives"));
620
+ return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition" ? y([k, i]) : [" ", y(x([l, i]))];
621
+ }
622
+ function g(e, t, n, i) {
623
+ return e.map(({ isLast: r, node: s }) => {
624
+ let a = n();
625
+ return !r && Se(t.originalText, q(s)) ? [a, f] : a;
626
+ }, i);
627
+ }
628
+ function gt(e) {
629
+ return e.kind !== "Comment";
630
+ }
631
+ function St({ node: e }) {
632
+ if (e.kind === "Comment") return "#" + e.value.trimEnd();
633
+ throw new Error("Not a comment: " + JSON.stringify(e));
634
+ }
635
+ function kt(e, t, n) {
636
+ let { node: i } = e, r = [], { interfaces: s } = i, a = e.map(n, "interfaces");
637
+ for (let u = 0; u < s.length; u++) {
638
+ let p = s[u];
639
+ r.push(a[u]);
640
+ let T = s[u + 1];
641
+ if (T) {
642
+ let D = t.originalText.slice(p.loc.end, T.loc.start).includes("#");
643
+ r.push(" &", D ? k : " ");
644
+ }
645
+ }
646
+ return r;
647
+ }
648
+ function Be(e, t) {
649
+ let { node: n } = e;
650
+ return se(n.variableDefinitions) ? y([
651
+ "(",
652
+ x([l, E([I("", ", "), l], e.map(t, "variableDefinitions"))]),
653
+ l,
654
+ ")"
655
+ ]) : "";
656
+ }
657
+ function Ue(e, t) {
658
+ e.kind === "StringValue" && e.block && !e.value.includes(`
659
+ `) && (t.value = e.value.trim());
660
+ }
661
+ Ue.ignoredProperties = new Set(["loc", "comments"]);
662
+ function Ct(e) {
663
+ let { node: t } = e;
664
+ return t?.comments?.some((n) => n.value.trim() === "prettier-ignore");
665
+ }
666
+ var Ge = {
667
+ print: Dt,
668
+ massageAstNode: Ue,
669
+ hasPrettierIgnore: Ct,
670
+ insertPragma: Ve,
671
+ printComment: St,
672
+ canAttachComment: gt,
673
+ getVisitorKeys: be
674
+ };
675
+ var Ye = [{
676
+ name: "GraphQL",
677
+ type: "data",
678
+ aceMode: "graphqlschema",
679
+ extensions: [
680
+ ".graphql",
681
+ ".gql",
682
+ ".graphqls"
683
+ ],
684
+ tmScope: "source.graphql",
685
+ parsers: ["graphql"],
686
+ vscodeLanguageIds: ["graphql"],
687
+ linguistLanguageId: 139
688
+ }];
689
+ var $e = { bracketSpacing: {
690
+ bracketSpacing: {
691
+ category: "Common",
692
+ type: "boolean",
693
+ default: !0,
694
+ description: "Print spaces between brackets.",
695
+ oppositeDescription: "Do not print spaces between brackets."
696
+ },
697
+ objectWrap: {
698
+ category: "Common",
699
+ type: "choice",
700
+ default: "preserve",
701
+ description: "How to wrap object literals.",
702
+ choices: [{
703
+ value: "preserve",
704
+ description: "Keep as multi-line, if there is a newline between the opening brace and first property."
705
+ }, {
706
+ value: "collapse",
707
+ description: "Fit to a single line when possible."
708
+ }]
709
+ },
710
+ singleQuote: {
711
+ category: "Common",
712
+ type: "boolean",
713
+ default: !1,
714
+ description: "Use single quotes instead of double quotes."
715
+ },
716
+ proseWrap: {
717
+ category: "Common",
718
+ type: "choice",
719
+ default: "preserve",
720
+ description: "How to wrap prose.",
721
+ choices: [
722
+ {
723
+ value: "always",
724
+ description: "Wrap prose if it exceeds the print width."
725
+ },
726
+ {
727
+ value: "never",
728
+ description: "Do not wrap prose."
729
+ },
730
+ {
731
+ value: "preserve",
732
+ description: "Wrap prose as-is."
733
+ }
734
+ ]
735
+ },
736
+ bracketSameLine: {
737
+ category: "Common",
738
+ type: "boolean",
739
+ default: !1,
740
+ description: "Put > of opening tags on the last line instead of on a new line."
741
+ },
742
+ singleAttributePerLine: {
743
+ category: "Common",
744
+ type: "boolean",
745
+ default: !1,
746
+ description: "Enforce single attribute per line in HTML, Vue and JSX."
747
+ }
748
+ }.bracketSpacing };
749
+ var he = {};
750
+ de(he, { graphql: () => tn });
751
+ function Xe(e) {
752
+ return typeof e == "object" && e !== null;
753
+ }
754
+ function He(e, t) {
755
+ if (!!!e) throw new Error(t ?? "Unexpected invariant triggered.");
756
+ }
757
+ var bt = /\r\n|[\n\r]/g;
758
+ function M(e, t) {
759
+ let n = 0, i = 1;
760
+ for (let r of e.body.matchAll(bt)) {
761
+ if (typeof r.index == "number" || He(!1), r.index >= t) break;
762
+ n = r.index + r[0].length, i += 1;
763
+ }
764
+ return {
765
+ line: i,
766
+ column: t + 1 - n
767
+ };
768
+ }
769
+ function qe(e) {
770
+ return ue(e.source, M(e.source, e.start));
771
+ }
772
+ function ue(e, t) {
773
+ let n = e.locationOffset.column - 1, i = "".padStart(n) + e.body, r = t.line - 1, s = e.locationOffset.line - 1, a = t.line + s, u = t.line === 1 ? n : 0, p = t.column + u, T = `${e.name}:${a}:${p}
774
+ `, d = i.split(/\r\n|[\n\r]/g), D = d[r];
775
+ if (D.length > 120) {
776
+ let O = Math.floor(p / 80), re = p % 80, N = [];
777
+ for (let v = 0; v < D.length; v += 80) N.push(D.slice(v, v + 80));
778
+ return T + Je([
779
+ [`${a} |`, N[0]],
780
+ ...N.slice(1, O + 1).map((v) => ["|", v]),
781
+ ["|", "^".padStart(re)],
782
+ ["|", N[O + 1]]
783
+ ]);
784
+ }
785
+ return T + Je([
786
+ [`${a - 1} |`, d[r - 1]],
787
+ [`${a} |`, D],
788
+ ["|", "^".padStart(p)],
789
+ [`${a + 1} |`, d[r + 1]]
790
+ ]);
791
+ }
792
+ function Je(e) {
793
+ let t = e.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
794
+ return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
795
+ `);
796
+ }
797
+ function Lt(e) {
798
+ let t = e[0];
799
+ return t == null || "kind" in t || "length" in t ? {
800
+ nodes: t,
801
+ source: e[1],
802
+ positions: e[2],
803
+ path: e[3],
804
+ originalError: e[4],
805
+ extensions: e[5]
806
+ } : t;
807
+ }
808
+ var Q = class e extends Error {
809
+ constructor(t, ...n) {
810
+ var i, r, s;
811
+ let { nodes: a, source: u, positions: p, path: T, originalError: d, extensions: D } = Lt(n);
812
+ super(t), this.name = "GraphQLError", this.path = T ?? void 0, this.originalError = d ?? void 0, this.nodes = Qe(Array.isArray(a) ? a : a ? [a] : void 0);
813
+ let O = Qe((i = this.nodes) === null || i === void 0 ? void 0 : i.map((N) => N.loc).filter((N) => N != null));
814
+ this.source = u ?? (O == null || (r = O[0]) === null || r === void 0 ? void 0 : r.source), this.positions = p ?? O?.map((N) => N.start), this.locations = p && u ? p.map((N) => M(u, N)) : O?.map((N) => M(N.source, N.start));
815
+ let re = Xe(d?.extensions) ? d?.extensions : void 0;
816
+ this.extensions = (s = D ?? re) !== null && s !== void 0 ? s : Object.create(null), Object.defineProperties(this, {
817
+ message: {
818
+ writable: !0,
819
+ enumerable: !0
820
+ },
821
+ name: { enumerable: !1 },
822
+ nodes: { enumerable: !1 },
823
+ source: { enumerable: !1 },
824
+ positions: { enumerable: !1 },
825
+ originalError: { enumerable: !1 }
826
+ }), d != null && d.stack ? Object.defineProperty(this, "stack", {
827
+ value: d.stack,
828
+ writable: !0,
829
+ configurable: !0
830
+ }) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", {
831
+ value: Error().stack,
832
+ writable: !0,
833
+ configurable: !0
834
+ });
835
+ }
836
+ get [Symbol.toStringTag]() {
837
+ return "GraphQLError";
838
+ }
839
+ toString() {
840
+ let t = this.message;
841
+ if (this.nodes) for (let n of this.nodes) n.loc && (t += `
842
+
843
+ ` + qe(n.loc));
844
+ else if (this.source && this.locations) for (let n of this.locations) t += `
845
+
846
+ ` + ue(this.source, n);
847
+ return t;
848
+ }
849
+ toJSON() {
850
+ let t = { message: this.message };
851
+ 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;
852
+ }
853
+ };
854
+ function Qe(e) {
855
+ return e === void 0 || e.length === 0 ? void 0 : e;
856
+ }
857
+ function h(e, t, n) {
858
+ return new Q(`Syntax Error: ${n}`, {
859
+ source: e,
860
+ positions: [t]
861
+ });
862
+ }
863
+ var W;
864
+ (function(e) {
865
+ e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
866
+ })(W || (W = {}));
867
+ var c;
868
+ (function(e) {
869
+ e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", e.TYPE_COORDINATE = "TypeCoordinate", e.MEMBER_COORDINATE = "MemberCoordinate", e.ARGUMENT_COORDINATE = "ArgumentCoordinate", e.DIRECTIVE_COORDINATE = "DirectiveCoordinate", e.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
870
+ })(c || (c = {}));
871
+ function We(e) {
872
+ return e === 9 || e === 32;
873
+ }
874
+ function b(e) {
875
+ return e >= 48 && e <= 57;
876
+ }
877
+ function ze(e) {
878
+ return e >= 97 && e <= 122 || e >= 65 && e <= 90;
879
+ }
880
+ function pe(e) {
881
+ return ze(e) || e === 95;
882
+ }
883
+ function Ke(e) {
884
+ return ze(e) || b(e) || e === 95;
885
+ }
886
+ function Ze(e) {
887
+ var t;
888
+ let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
889
+ for (let a = 0; a < e.length; ++a) {
890
+ var s;
891
+ let u = e[a], p = Pt(u);
892
+ p !== u.length && (i = (s = i) !== null && s !== void 0 ? s : a, r = a, a !== 0 && p < n && (n = p));
893
+ }
894
+ return e.map((a, u) => u === 0 ? a : a.slice(n)).slice((t = i) !== null && t !== void 0 ? t : 0, r + 1);
895
+ }
896
+ function Pt(e) {
897
+ let t = 0;
898
+ for (; t < e.length && We(e.charCodeAt(t));) ++t;
899
+ return t;
900
+ }
901
+ var o;
902
+ (function(e) {
903
+ e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.DOT = ".", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
904
+ })(o || (o = {}));
905
+ var z = class {
906
+ constructor(t) {
907
+ let n = new F(o.SOF, 0, 0, 0, 0);
908
+ this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
909
+ }
910
+ get [Symbol.toStringTag]() {
911
+ return "Lexer";
912
+ }
913
+ advance() {
914
+ return this.lastToken = this.token, this.token = this.lookahead();
915
+ }
916
+ lookahead() {
917
+ let t = this.token;
918
+ if (t.kind !== o.EOF) do
919
+ if (t.next) t = t.next;
920
+ else {
921
+ let n = wt(this, t.end);
922
+ t.next = n, n.prev = t, t = n;
923
+ }
924
+ while (t.kind === o.COMMENT);
925
+ return t;
926
+ }
927
+ };
928
+ function tt(e) {
929
+ return e === o.BANG || e === o.DOLLAR || e === o.AMP || e === o.PAREN_L || e === o.PAREN_R || e === o.DOT || e === o.SPREAD || e === o.COLON || e === o.EQUALS || e === o.AT || e === o.BRACKET_L || e === o.BRACKET_R || e === o.BRACE_L || e === o.PIPE || e === o.BRACE_R;
930
+ }
931
+ function L(e) {
932
+ return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
933
+ }
934
+ function K(e, t) {
935
+ return nt(e.charCodeAt(t)) && rt(e.charCodeAt(t + 1));
936
+ }
937
+ function nt(e) {
938
+ return e >= 55296 && e <= 56319;
939
+ }
940
+ function rt(e) {
941
+ return e >= 56320 && e <= 57343;
942
+ }
943
+ function R(e, t) {
944
+ let n = e.source.body.codePointAt(t);
945
+ if (n === void 0) return o.EOF;
946
+ if (n >= 32 && n <= 126) {
947
+ let i = String.fromCodePoint(n);
948
+ return i === "\"" ? `'"'` : `"${i}"`;
949
+ }
950
+ return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
951
+ }
952
+ function m(e, t, n, i, r) {
953
+ let s = e.line;
954
+ return new F(t, n, i, s, 1 + n - e.lineStart, r);
955
+ }
956
+ function wt(e, t) {
957
+ let n = e.source.body, i = n.length, r = t;
958
+ for (; r < i;) {
959
+ let s = n.charCodeAt(r);
960
+ switch (s) {
961
+ case 65279:
962
+ case 9:
963
+ case 32:
964
+ case 44:
965
+ ++r;
966
+ continue;
967
+ case 10:
968
+ ++r, ++e.line, e.lineStart = r;
969
+ continue;
970
+ case 13:
971
+ n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
972
+ continue;
973
+ case 35: return Ft(e, r);
974
+ case 33: return m(e, o.BANG, r, r + 1);
975
+ case 36: return m(e, o.DOLLAR, r, r + 1);
976
+ case 38: return m(e, o.AMP, r, r + 1);
977
+ case 40: return m(e, o.PAREN_L, r, r + 1);
978
+ case 41: return m(e, o.PAREN_R, r, r + 1);
979
+ case 46:
980
+ if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46) return m(e, o.SPREAD, r, r + 3);
981
+ break;
982
+ case 58: return m(e, o.COLON, r, r + 1);
983
+ case 61: return m(e, o.EQUALS, r, r + 1);
984
+ case 64: return m(e, o.AT, r, r + 1);
985
+ case 91: return m(e, o.BRACKET_L, r, r + 1);
986
+ case 93: return m(e, o.BRACKET_R, r, r + 1);
987
+ case 123: return m(e, o.BRACE_L, r, r + 1);
988
+ case 124: return m(e, o.PIPE, r, r + 1);
989
+ case 125: return m(e, o.BRACE_R, r, r + 1);
990
+ case 34: return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Yt(e, r) : Vt(e, r);
991
+ }
992
+ if (b(s) || s === 45) return Mt(e, r, s);
993
+ if (pe(s)) return jt(e, r);
994
+ throw h(e.source, r, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : L(s) || K(n, r) ? `Unexpected character: ${R(e, r)}.` : `Invalid character: ${R(e, r)}.`);
995
+ }
996
+ return m(e, o.EOF, i, i);
997
+ }
998
+ function Ft(e, t) {
999
+ let n = e.source.body, i = n.length, r = t + 1;
1000
+ for (; r < i;) {
1001
+ let s = n.charCodeAt(r);
1002
+ if (s === 10 || s === 13) break;
1003
+ if (L(s)) ++r;
1004
+ else if (K(n, r)) r += 2;
1005
+ else break;
1006
+ }
1007
+ return m(e, o.COMMENT, t, r, n.slice(t + 1, r));
1008
+ }
1009
+ function Mt(e, t, n) {
1010
+ let i = e.source.body, r = t, s = n, a = !1;
1011
+ if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
1012
+ if (s = i.charCodeAt(++r), b(s)) throw h(e.source, r, `Invalid number, unexpected digit after 0: ${R(e, r)}.`);
1013
+ } else r = le(e, r, s), s = i.charCodeAt(r);
1014
+ if (s === 46 && (a = !0, s = i.charCodeAt(++r), r = le(e, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (a = !0, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = le(e, r, s), s = i.charCodeAt(r)), s === 46 || pe(s)) throw h(e.source, r, `Invalid number, expected digit but got: ${R(e, r)}.`);
1015
+ return m(e, a ? o.FLOAT : o.INT, t, r, i.slice(t, r));
1016
+ }
1017
+ function le(e, t, n) {
1018
+ if (!b(n)) throw h(e.source, t, `Invalid number, expected digit but got: ${R(e, t)}.`);
1019
+ let i = e.source.body, r = t + 1;
1020
+ for (; b(i.charCodeAt(r));) ++r;
1021
+ return r;
1022
+ }
1023
+ function Vt(e, t) {
1024
+ let n = e.source.body, i = n.length, r = t + 1, s = r, a = "";
1025
+ for (; r < i;) {
1026
+ let u = n.charCodeAt(r);
1027
+ if (u === 34) return a += n.slice(s, r), m(e, o.STRING, t, r + 1, a);
1028
+ if (u === 92) {
1029
+ a += n.slice(s, r);
1030
+ let p = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Bt(e, r) : Ut(e, r) : Gt(e, r);
1031
+ a += p.value, r += p.size, s = r;
1032
+ continue;
1033
+ }
1034
+ if (u === 10 || u === 13) break;
1035
+ if (L(u)) ++r;
1036
+ else if (K(n, r)) r += 2;
1037
+ else throw h(e.source, r, `Invalid character within String: ${R(e, r)}.`);
1038
+ }
1039
+ throw h(e.source, r, "Unterminated string.");
1040
+ }
1041
+ function Bt(e, t) {
1042
+ let n = e.source.body, i = 0, r = 3;
1043
+ for (; r < 12;) {
1044
+ let s = n.charCodeAt(t + r++);
1045
+ if (s === 125) {
1046
+ if (r < 5 || !L(i)) break;
1047
+ return {
1048
+ value: String.fromCodePoint(i),
1049
+ size: r
1050
+ };
1051
+ }
1052
+ if (i = i << 4 | V(s), i < 0) break;
1053
+ }
1054
+ throw h(e.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + r)}".`);
1055
+ }
1056
+ function Ut(e, t) {
1057
+ let n = e.source.body, i = et(n, t + 2);
1058
+ if (L(i)) return {
1059
+ value: String.fromCodePoint(i),
1060
+ size: 6
1061
+ };
1062
+ if (nt(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
1063
+ let r = et(n, t + 8);
1064
+ if (rt(r)) return {
1065
+ value: String.fromCodePoint(i, r),
1066
+ size: 12
1067
+ };
1068
+ }
1069
+ throw h(e.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`);
1070
+ }
1071
+ function et(e, t) {
1072
+ return V(e.charCodeAt(t)) << 12 | V(e.charCodeAt(t + 1)) << 8 | V(e.charCodeAt(t + 2)) << 4 | V(e.charCodeAt(t + 3));
1073
+ }
1074
+ function V(e) {
1075
+ return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
1076
+ }
1077
+ function Gt(e, t) {
1078
+ let n = e.source.body;
1079
+ switch (n.charCodeAt(t + 1)) {
1080
+ case 34: return {
1081
+ value: "\"",
1082
+ size: 2
1083
+ };
1084
+ case 92: return {
1085
+ value: "\\",
1086
+ size: 2
1087
+ };
1088
+ case 47: return {
1089
+ value: "/",
1090
+ size: 2
1091
+ };
1092
+ case 98: return {
1093
+ value: "\b",
1094
+ size: 2
1095
+ };
1096
+ case 102: return {
1097
+ value: "\f",
1098
+ size: 2
1099
+ };
1100
+ case 110: return {
1101
+ value: `
1102
+ `,
1103
+ size: 2
1104
+ };
1105
+ case 114: return {
1106
+ value: "\r",
1107
+ size: 2
1108
+ };
1109
+ case 116: return {
1110
+ value: " ",
1111
+ size: 2
1112
+ };
1113
+ }
1114
+ throw h(e.source, t, `Invalid character escape sequence: "${n.slice(t, t + 2)}".`);
1115
+ }
1116
+ function Yt(e, t) {
1117
+ let n = e.source.body, i = n.length, r = e.lineStart, s = t + 3, a = s, u = "", p = [];
1118
+ for (; s < i;) {
1119
+ let T = n.charCodeAt(s);
1120
+ if (T === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
1121
+ u += n.slice(a, s), p.push(u);
1122
+ let d = m(e, o.BLOCK_STRING, t, s + 3, Ze(p).join(`
1123
+ `));
1124
+ return e.line += p.length - 1, e.lineStart = r, d;
1125
+ }
1126
+ if (T === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
1127
+ u += n.slice(a, s), a = s + 1, s += 4;
1128
+ continue;
1129
+ }
1130
+ if (T === 10 || T === 13) {
1131
+ u += n.slice(a, s), p.push(u), T === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", a = s, r = s;
1132
+ continue;
1133
+ }
1134
+ if (L(T)) ++s;
1135
+ else if (K(n, s)) s += 2;
1136
+ else throw h(e.source, s, `Invalid character within String: ${R(e, s)}.`);
1137
+ }
1138
+ throw h(e.source, s, "Unterminated string.");
1139
+ }
1140
+ function jt(e, t) {
1141
+ let n = e.source.body, i = n.length, r = t + 1;
1142
+ for (; r < i;) if (Ke(n.charCodeAt(r))) ++r;
1143
+ else break;
1144
+ return m(e, o.NAME, t, r, n.slice(t, r));
1145
+ }
1146
+ function Z(e, t) {
1147
+ if (!!!e) throw new Error(t);
1148
+ }
1149
+ function ee(e) {
1150
+ return te(e, []);
1151
+ }
1152
+ function te(e, t) {
1153
+ switch (typeof e) {
1154
+ case "string": return JSON.stringify(e);
1155
+ case "function": return e.name ? `[function ${e.name}]` : "[function]";
1156
+ case "object": return $t(e, t);
1157
+ default: return String(e);
1158
+ }
1159
+ }
1160
+ function $t(e, t) {
1161
+ if (e === null) return "null";
1162
+ if (t.includes(e)) return "[Circular]";
1163
+ let n = [...t, e];
1164
+ if (Xt(e)) {
1165
+ let i = e.toJSON();
1166
+ if (i !== e) return typeof i == "string" ? i : te(i, n);
1167
+ } else if (Array.isArray(e)) return Jt(e, n);
1168
+ return Ht(e, n);
1169
+ }
1170
+ function Xt(e) {
1171
+ return typeof e.toJSON == "function";
1172
+ }
1173
+ function Ht(e, t) {
1174
+ let n = Object.entries(e);
1175
+ return n.length === 0 ? "{}" : t.length > 2 ? "[" + qt(e) + "]" : "{ " + n.map(([r, s]) => r + ": " + te(s, t)).join(", ") + " }";
1176
+ }
1177
+ function Jt(e, t) {
1178
+ if (e.length === 0) return "[]";
1179
+ if (t.length > 2) return "[Array]";
1180
+ let n = Math.min(10, e.length), i = e.length - n, r = [];
1181
+ for (let s = 0; s < n; ++s) r.push(te(e[s], t));
1182
+ return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
1183
+ }
1184
+ function qt(e) {
1185
+ let t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
1186
+ if (t === "Object" && typeof e.constructor == "function") {
1187
+ let n = e.constructor.name;
1188
+ if (typeof n == "string" && n !== "") return n;
1189
+ }
1190
+ return t;
1191
+ }
1192
+ var it = globalThis.process && !0 ? function(t, n) {
1193
+ return t instanceof n;
1194
+ } : function(t, n) {
1195
+ if (t instanceof n) return !0;
1196
+ if (typeof t == "object" && t !== null) {
1197
+ var i;
1198
+ let r = n.prototype[Symbol.toStringTag];
1199
+ if (r === (Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name)) {
1200
+ let a = ee(t);
1201
+ throw new Error(`Cannot use ${r} "${a}" from another module or realm.
1202
+
1203
+ Ensure that there is only one instance of "graphql" in the node_modules
1204
+ directory. If different versions of "graphql" are the dependencies of other
1205
+ relied on modules, use "resolutions" to ensure only one version is installed.
1206
+
1207
+ https://yarnpkg.com/en/docs/selective-version-resolutions
1208
+
1209
+ Duplicate "graphql" modules cannot be used at the same time since different
1210
+ versions may have different capabilities and behavior. The data from one
1211
+ version used in the function from another could produce confusing and
1212
+ spurious results.`);
1213
+ }
1214
+ }
1215
+ return !1;
1216
+ };
1217
+ var B = class {
1218
+ constructor(t, n = "GraphQL request", i = {
1219
+ line: 1,
1220
+ column: 1
1221
+ }) {
1222
+ typeof t == "string" || Z(!1, `Body must be a string. Received: ${ee(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || Z(!1, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || Z(!1, "column in locationOffset is 1-indexed and must be positive.");
1223
+ }
1224
+ get [Symbol.toStringTag]() {
1225
+ return "Source";
1226
+ }
1227
+ };
1228
+ function st(e) {
1229
+ return it(e, B);
1230
+ }
1231
+ function ot(e, t) {
1232
+ let n = new fe(e, t), i = n.parseDocument();
1233
+ return Object.defineProperty(i, "tokenCount", {
1234
+ enumerable: !1,
1235
+ value: n.tokenCount
1236
+ }), i;
1237
+ }
1238
+ var fe = class {
1239
+ constructor(t, n = {}) {
1240
+ let { lexer: i, ...r } = n;
1241
+ if (i) this._lexer = i;
1242
+ else {
1243
+ let s = st(t) ? t : new B(t);
1244
+ this._lexer = new z(s);
1245
+ }
1246
+ this._options = r, this._tokenCounter = 0;
1247
+ }
1248
+ get tokenCount() {
1249
+ return this._tokenCounter;
1250
+ }
1251
+ parseName() {
1252
+ let t = this.expectToken(o.NAME);
1253
+ return this.node(t, {
1254
+ kind: c.NAME,
1255
+ value: t.value
1256
+ });
1257
+ }
1258
+ parseDocument() {
1259
+ return this.node(this._lexer.token, {
1260
+ kind: c.DOCUMENT,
1261
+ definitions: this.many(o.SOF, this.parseDefinition, o.EOF)
1262
+ });
1263
+ }
1264
+ parseDefinition() {
1265
+ if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
1266
+ let t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
1267
+ if (t && n.kind === o.BRACE_L) throw h(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are not supported on shorthand queries.");
1268
+ if (n.kind === o.NAME) {
1269
+ switch (n.value) {
1270
+ case "schema": return this.parseSchemaDefinition();
1271
+ case "scalar": return this.parseScalarTypeDefinition();
1272
+ case "type": return this.parseObjectTypeDefinition();
1273
+ case "interface": return this.parseInterfaceTypeDefinition();
1274
+ case "union": return this.parseUnionTypeDefinition();
1275
+ case "enum": return this.parseEnumTypeDefinition();
1276
+ case "input": return this.parseInputObjectTypeDefinition();
1277
+ case "directive": return this.parseDirectiveDefinition();
1278
+ }
1279
+ switch (n.value) {
1280
+ case "query":
1281
+ case "mutation":
1282
+ case "subscription": return this.parseOperationDefinition();
1283
+ case "fragment": return this.parseFragmentDefinition();
1284
+ }
1285
+ if (t) throw h(this._lexer.source, this._lexer.token.start, "Unexpected description, only GraphQL definitions support descriptions.");
1286
+ switch (n.value) {
1287
+ case "extend": return this.parseTypeSystemExtension();
1288
+ }
1289
+ }
1290
+ throw this.unexpected(n);
1291
+ }
1292
+ parseOperationDefinition() {
1293
+ let t = this._lexer.token;
1294
+ if (this.peek(o.BRACE_L)) return this.node(t, {
1295
+ kind: c.OPERATION_DEFINITION,
1296
+ operation: C.QUERY,
1297
+ description: void 0,
1298
+ name: void 0,
1299
+ variableDefinitions: [],
1300
+ directives: [],
1301
+ selectionSet: this.parseSelectionSet()
1302
+ });
1303
+ let n = this.parseDescription(), i = this.parseOperationType(), r;
1304
+ return this.peek(o.NAME) && (r = this.parseName()), this.node(t, {
1305
+ kind: c.OPERATION_DEFINITION,
1306
+ operation: i,
1307
+ description: n,
1308
+ name: r,
1309
+ variableDefinitions: this.parseVariableDefinitions(),
1310
+ directives: this.parseDirectives(!1),
1311
+ selectionSet: this.parseSelectionSet()
1312
+ });
1313
+ }
1314
+ parseOperationType() {
1315
+ let t = this.expectToken(o.NAME);
1316
+ switch (t.value) {
1317
+ case "query": return C.QUERY;
1318
+ case "mutation": return C.MUTATION;
1319
+ case "subscription": return C.SUBSCRIPTION;
1320
+ }
1321
+ throw this.unexpected(t);
1322
+ }
1323
+ parseVariableDefinitions() {
1324
+ return this.optionalMany(o.PAREN_L, this.parseVariableDefinition, o.PAREN_R);
1325
+ }
1326
+ parseVariableDefinition() {
1327
+ return this.node(this._lexer.token, {
1328
+ kind: c.VARIABLE_DEFINITION,
1329
+ description: this.parseDescription(),
1330
+ variable: this.parseVariable(),
1331
+ type: (this.expectToken(o.COLON), this.parseTypeReference()),
1332
+ defaultValue: this.expectOptionalToken(o.EQUALS) ? this.parseConstValueLiteral() : void 0,
1333
+ directives: this.parseConstDirectives()
1334
+ });
1335
+ }
1336
+ parseVariable() {
1337
+ let t = this._lexer.token;
1338
+ return this.expectToken(o.DOLLAR), this.node(t, {
1339
+ kind: c.VARIABLE,
1340
+ name: this.parseName()
1341
+ });
1342
+ }
1343
+ parseSelectionSet() {
1344
+ return this.node(this._lexer.token, {
1345
+ kind: c.SELECTION_SET,
1346
+ selections: this.many(o.BRACE_L, this.parseSelection, o.BRACE_R)
1347
+ });
1348
+ }
1349
+ parseSelection() {
1350
+ return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
1351
+ }
1352
+ parseField() {
1353
+ let t = this._lexer.token, n = this.parseName(), i, r;
1354
+ return this.expectOptionalToken(o.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, {
1355
+ kind: c.FIELD,
1356
+ alias: i,
1357
+ name: r,
1358
+ arguments: this.parseArguments(!1),
1359
+ directives: this.parseDirectives(!1),
1360
+ selectionSet: this.peek(o.BRACE_L) ? this.parseSelectionSet() : void 0
1361
+ });
1362
+ }
1363
+ parseArguments(t) {
1364
+ let n = t ? this.parseConstArgument : this.parseArgument;
1365
+ return this.optionalMany(o.PAREN_L, n, o.PAREN_R);
1366
+ }
1367
+ parseArgument(t = !1) {
1368
+ let n = this._lexer.token, i = this.parseName();
1369
+ return this.expectToken(o.COLON), this.node(n, {
1370
+ kind: c.ARGUMENT,
1371
+ name: i,
1372
+ value: this.parseValueLiteral(t)
1373
+ });
1374
+ }
1375
+ parseConstArgument() {
1376
+ return this.parseArgument(!0);
1377
+ }
1378
+ parseFragment() {
1379
+ let t = this._lexer.token;
1380
+ this.expectToken(o.SPREAD);
1381
+ let n = this.expectOptionalKeyword("on");
1382
+ return !n && this.peek(o.NAME) ? this.node(t, {
1383
+ kind: c.FRAGMENT_SPREAD,
1384
+ name: this.parseFragmentName(),
1385
+ directives: this.parseDirectives(!1)
1386
+ }) : this.node(t, {
1387
+ kind: c.INLINE_FRAGMENT,
1388
+ typeCondition: n ? this.parseNamedType() : void 0,
1389
+ directives: this.parseDirectives(!1),
1390
+ selectionSet: this.parseSelectionSet()
1391
+ });
1392
+ }
1393
+ parseFragmentDefinition() {
1394
+ let t = this._lexer.token, n = this.parseDescription();
1395
+ return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
1396
+ kind: c.FRAGMENT_DEFINITION,
1397
+ description: n,
1398
+ name: this.parseFragmentName(),
1399
+ variableDefinitions: this.parseVariableDefinitions(),
1400
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1401
+ directives: this.parseDirectives(!1),
1402
+ selectionSet: this.parseSelectionSet()
1403
+ }) : this.node(t, {
1404
+ kind: c.FRAGMENT_DEFINITION,
1405
+ description: n,
1406
+ name: this.parseFragmentName(),
1407
+ typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
1408
+ directives: this.parseDirectives(!1),
1409
+ selectionSet: this.parseSelectionSet()
1410
+ });
1411
+ }
1412
+ parseFragmentName() {
1413
+ if (this._lexer.token.value === "on") throw this.unexpected();
1414
+ return this.parseName();
1415
+ }
1416
+ parseValueLiteral(t) {
1417
+ let n = this._lexer.token;
1418
+ switch (n.kind) {
1419
+ case o.BRACKET_L: return this.parseList(t);
1420
+ case o.BRACE_L: return this.parseObject(t);
1421
+ case o.INT: return this.advanceLexer(), this.node(n, {
1422
+ kind: c.INT,
1423
+ value: n.value
1424
+ });
1425
+ case o.FLOAT: return this.advanceLexer(), this.node(n, {
1426
+ kind: c.FLOAT,
1427
+ value: n.value
1428
+ });
1429
+ case o.STRING:
1430
+ case o.BLOCK_STRING: return this.parseStringLiteral();
1431
+ case o.NAME: switch (this.advanceLexer(), n.value) {
1432
+ case "true": return this.node(n, {
1433
+ kind: c.BOOLEAN,
1434
+ value: !0
1435
+ });
1436
+ case "false": return this.node(n, {
1437
+ kind: c.BOOLEAN,
1438
+ value: !1
1439
+ });
1440
+ case "null": return this.node(n, { kind: c.NULL });
1441
+ default: return this.node(n, {
1442
+ kind: c.ENUM,
1443
+ value: n.value
1444
+ });
1445
+ }
1446
+ case o.DOLLAR:
1447
+ if (t) if (this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME) {
1448
+ let i = this._lexer.token.value;
1449
+ throw h(this._lexer.source, n.start, `Unexpected variable "$${i}" in constant value.`);
1450
+ } else throw this.unexpected(n);
1451
+ return this.parseVariable();
1452
+ default: throw this.unexpected();
1453
+ }
1454
+ }
1455
+ parseConstValueLiteral() {
1456
+ return this.parseValueLiteral(!0);
1457
+ }
1458
+ parseStringLiteral() {
1459
+ let t = this._lexer.token;
1460
+ return this.advanceLexer(), this.node(t, {
1461
+ kind: c.STRING,
1462
+ value: t.value,
1463
+ block: t.kind === o.BLOCK_STRING
1464
+ });
1465
+ }
1466
+ parseList(t) {
1467
+ let n = () => this.parseValueLiteral(t);
1468
+ return this.node(this._lexer.token, {
1469
+ kind: c.LIST,
1470
+ values: this.any(o.BRACKET_L, n, o.BRACKET_R)
1471
+ });
1472
+ }
1473
+ parseObject(t) {
1474
+ let n = () => this.parseObjectField(t);
1475
+ return this.node(this._lexer.token, {
1476
+ kind: c.OBJECT,
1477
+ fields: this.any(o.BRACE_L, n, o.BRACE_R)
1478
+ });
1479
+ }
1480
+ parseObjectField(t) {
1481
+ let n = this._lexer.token, i = this.parseName();
1482
+ return this.expectToken(o.COLON), this.node(n, {
1483
+ kind: c.OBJECT_FIELD,
1484
+ name: i,
1485
+ value: this.parseValueLiteral(t)
1486
+ });
1487
+ }
1488
+ parseDirectives(t) {
1489
+ let n = [];
1490
+ for (; this.peek(o.AT);) n.push(this.parseDirective(t));
1491
+ return n;
1492
+ }
1493
+ parseConstDirectives() {
1494
+ return this.parseDirectives(!0);
1495
+ }
1496
+ parseDirective(t) {
1497
+ let n = this._lexer.token;
1498
+ return this.expectToken(o.AT), this.node(n, {
1499
+ kind: c.DIRECTIVE,
1500
+ name: this.parseName(),
1501
+ arguments: this.parseArguments(t)
1502
+ });
1503
+ }
1504
+ parseTypeReference() {
1505
+ let t = this._lexer.token, n;
1506
+ if (this.expectOptionalToken(o.BRACKET_L)) {
1507
+ let i = this.parseTypeReference();
1508
+ this.expectToken(o.BRACKET_R), n = this.node(t, {
1509
+ kind: c.LIST_TYPE,
1510
+ type: i
1511
+ });
1512
+ } else n = this.parseNamedType();
1513
+ return this.expectOptionalToken(o.BANG) ? this.node(t, {
1514
+ kind: c.NON_NULL_TYPE,
1515
+ type: n
1516
+ }) : n;
1517
+ }
1518
+ parseNamedType() {
1519
+ return this.node(this._lexer.token, {
1520
+ kind: c.NAMED_TYPE,
1521
+ name: this.parseName()
1522
+ });
1523
+ }
1524
+ peekDescription() {
1525
+ return this.peek(o.STRING) || this.peek(o.BLOCK_STRING);
1526
+ }
1527
+ parseDescription() {
1528
+ if (this.peekDescription()) return this.parseStringLiteral();
1529
+ }
1530
+ parseSchemaDefinition() {
1531
+ let t = this._lexer.token, n = this.parseDescription();
1532
+ this.expectKeyword("schema");
1533
+ let i = this.parseConstDirectives(), r = this.many(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
1534
+ return this.node(t, {
1535
+ kind: c.SCHEMA_DEFINITION,
1536
+ description: n,
1537
+ directives: i,
1538
+ operationTypes: r
1539
+ });
1540
+ }
1541
+ parseOperationTypeDefinition() {
1542
+ let t = this._lexer.token, n = this.parseOperationType();
1543
+ this.expectToken(o.COLON);
1544
+ let i = this.parseNamedType();
1545
+ return this.node(t, {
1546
+ kind: c.OPERATION_TYPE_DEFINITION,
1547
+ operation: n,
1548
+ type: i
1549
+ });
1550
+ }
1551
+ parseScalarTypeDefinition() {
1552
+ let t = this._lexer.token, n = this.parseDescription();
1553
+ this.expectKeyword("scalar");
1554
+ let i = this.parseName(), r = this.parseConstDirectives();
1555
+ return this.node(t, {
1556
+ kind: c.SCALAR_TYPE_DEFINITION,
1557
+ description: n,
1558
+ name: i,
1559
+ directives: r
1560
+ });
1561
+ }
1562
+ parseObjectTypeDefinition() {
1563
+ let t = this._lexer.token, n = this.parseDescription();
1564
+ this.expectKeyword("type");
1565
+ let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1566
+ return this.node(t, {
1567
+ kind: c.OBJECT_TYPE_DEFINITION,
1568
+ description: n,
1569
+ name: i,
1570
+ interfaces: r,
1571
+ directives: s,
1572
+ fields: a
1573
+ });
1574
+ }
1575
+ parseImplementsInterfaces() {
1576
+ return this.expectOptionalKeyword("implements") ? this.delimitedMany(o.AMP, this.parseNamedType) : [];
1577
+ }
1578
+ parseFieldsDefinition() {
1579
+ return this.optionalMany(o.BRACE_L, this.parseFieldDefinition, o.BRACE_R);
1580
+ }
1581
+ parseFieldDefinition() {
1582
+ let t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
1583
+ this.expectToken(o.COLON);
1584
+ let s = this.parseTypeReference(), a = this.parseConstDirectives();
1585
+ return this.node(t, {
1586
+ kind: c.FIELD_DEFINITION,
1587
+ description: n,
1588
+ name: i,
1589
+ arguments: r,
1590
+ type: s,
1591
+ directives: a
1592
+ });
1593
+ }
1594
+ parseArgumentDefs() {
1595
+ return this.optionalMany(o.PAREN_L, this.parseInputValueDef, o.PAREN_R);
1596
+ }
1597
+ parseInputValueDef() {
1598
+ let t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
1599
+ this.expectToken(o.COLON);
1600
+ let r = this.parseTypeReference(), s;
1601
+ this.expectOptionalToken(o.EQUALS) && (s = this.parseConstValueLiteral());
1602
+ let a = this.parseConstDirectives();
1603
+ return this.node(t, {
1604
+ kind: c.INPUT_VALUE_DEFINITION,
1605
+ description: n,
1606
+ name: i,
1607
+ type: r,
1608
+ defaultValue: s,
1609
+ directives: a
1610
+ });
1611
+ }
1612
+ parseInterfaceTypeDefinition() {
1613
+ let t = this._lexer.token, n = this.parseDescription();
1614
+ this.expectKeyword("interface");
1615
+ let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
1616
+ return this.node(t, {
1617
+ kind: c.INTERFACE_TYPE_DEFINITION,
1618
+ description: n,
1619
+ name: i,
1620
+ interfaces: r,
1621
+ directives: s,
1622
+ fields: a
1623
+ });
1624
+ }
1625
+ parseUnionTypeDefinition() {
1626
+ let t = this._lexer.token, n = this.parseDescription();
1627
+ this.expectKeyword("union");
1628
+ let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
1629
+ return this.node(t, {
1630
+ kind: c.UNION_TYPE_DEFINITION,
1631
+ description: n,
1632
+ name: i,
1633
+ directives: r,
1634
+ types: s
1635
+ });
1636
+ }
1637
+ parseUnionMemberTypes() {
1638
+ return this.expectOptionalToken(o.EQUALS) ? this.delimitedMany(o.PIPE, this.parseNamedType) : [];
1639
+ }
1640
+ parseEnumTypeDefinition() {
1641
+ let t = this._lexer.token, n = this.parseDescription();
1642
+ this.expectKeyword("enum");
1643
+ let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
1644
+ return this.node(t, {
1645
+ kind: c.ENUM_TYPE_DEFINITION,
1646
+ description: n,
1647
+ name: i,
1648
+ directives: r,
1649
+ values: s
1650
+ });
1651
+ }
1652
+ parseEnumValuesDefinition() {
1653
+ return this.optionalMany(o.BRACE_L, this.parseEnumValueDefinition, o.BRACE_R);
1654
+ }
1655
+ parseEnumValueDefinition() {
1656
+ let t = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
1657
+ return this.node(t, {
1658
+ kind: c.ENUM_VALUE_DEFINITION,
1659
+ description: n,
1660
+ name: i,
1661
+ directives: r
1662
+ });
1663
+ }
1664
+ parseEnumValueName() {
1665
+ if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw h(this._lexer.source, this._lexer.token.start, `${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);
1666
+ return this.parseName();
1667
+ }
1668
+ parseInputObjectTypeDefinition() {
1669
+ let t = this._lexer.token, n = this.parseDescription();
1670
+ this.expectKeyword("input");
1671
+ let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
1672
+ return this.node(t, {
1673
+ kind: c.INPUT_OBJECT_TYPE_DEFINITION,
1674
+ description: n,
1675
+ name: i,
1676
+ directives: r,
1677
+ fields: s
1678
+ });
1679
+ }
1680
+ parseInputFieldsDefinition() {
1681
+ return this.optionalMany(o.BRACE_L, this.parseInputValueDef, o.BRACE_R);
1682
+ }
1683
+ parseTypeSystemExtension() {
1684
+ let t = this._lexer.lookahead();
1685
+ if (t.kind === o.NAME) switch (t.value) {
1686
+ case "schema": return this.parseSchemaExtension();
1687
+ case "scalar": return this.parseScalarTypeExtension();
1688
+ case "type": return this.parseObjectTypeExtension();
1689
+ case "interface": return this.parseInterfaceTypeExtension();
1690
+ case "union": return this.parseUnionTypeExtension();
1691
+ case "enum": return this.parseEnumTypeExtension();
1692
+ case "input": return this.parseInputObjectTypeExtension();
1693
+ }
1694
+ throw this.unexpected(t);
1695
+ }
1696
+ parseSchemaExtension() {
1697
+ let t = this._lexer.token;
1698
+ this.expectKeyword("extend"), this.expectKeyword("schema");
1699
+ let n = this.parseConstDirectives(), i = this.optionalMany(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
1700
+ if (n.length === 0 && i.length === 0) throw this.unexpected();
1701
+ return this.node(t, {
1702
+ kind: c.SCHEMA_EXTENSION,
1703
+ directives: n,
1704
+ operationTypes: i
1705
+ });
1706
+ }
1707
+ parseScalarTypeExtension() {
1708
+ let t = this._lexer.token;
1709
+ this.expectKeyword("extend"), this.expectKeyword("scalar");
1710
+ let n = this.parseName(), i = this.parseConstDirectives();
1711
+ if (i.length === 0) throw this.unexpected();
1712
+ return this.node(t, {
1713
+ kind: c.SCALAR_TYPE_EXTENSION,
1714
+ name: n,
1715
+ directives: i
1716
+ });
1717
+ }
1718
+ parseObjectTypeExtension() {
1719
+ let t = this._lexer.token;
1720
+ this.expectKeyword("extend"), this.expectKeyword("type");
1721
+ let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1722
+ if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
1723
+ return this.node(t, {
1724
+ kind: c.OBJECT_TYPE_EXTENSION,
1725
+ name: n,
1726
+ interfaces: i,
1727
+ directives: r,
1728
+ fields: s
1729
+ });
1730
+ }
1731
+ parseInterfaceTypeExtension() {
1732
+ let t = this._lexer.token;
1733
+ this.expectKeyword("extend"), this.expectKeyword("interface");
1734
+ let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
1735
+ if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
1736
+ return this.node(t, {
1737
+ kind: c.INTERFACE_TYPE_EXTENSION,
1738
+ name: n,
1739
+ interfaces: i,
1740
+ directives: r,
1741
+ fields: s
1742
+ });
1743
+ }
1744
+ parseUnionTypeExtension() {
1745
+ let t = this._lexer.token;
1746
+ this.expectKeyword("extend"), this.expectKeyword("union");
1747
+ let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
1748
+ if (i.length === 0 && r.length === 0) throw this.unexpected();
1749
+ return this.node(t, {
1750
+ kind: c.UNION_TYPE_EXTENSION,
1751
+ name: n,
1752
+ directives: i,
1753
+ types: r
1754
+ });
1755
+ }
1756
+ parseEnumTypeExtension() {
1757
+ let t = this._lexer.token;
1758
+ this.expectKeyword("extend"), this.expectKeyword("enum");
1759
+ let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
1760
+ if (i.length === 0 && r.length === 0) throw this.unexpected();
1761
+ return this.node(t, {
1762
+ kind: c.ENUM_TYPE_EXTENSION,
1763
+ name: n,
1764
+ directives: i,
1765
+ values: r
1766
+ });
1767
+ }
1768
+ parseInputObjectTypeExtension() {
1769
+ let t = this._lexer.token;
1770
+ this.expectKeyword("extend"), this.expectKeyword("input");
1771
+ let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
1772
+ if (i.length === 0 && r.length === 0) throw this.unexpected();
1773
+ return this.node(t, {
1774
+ kind: c.INPUT_OBJECT_TYPE_EXTENSION,
1775
+ name: n,
1776
+ directives: i,
1777
+ fields: r
1778
+ });
1779
+ }
1780
+ parseDirectiveDefinition() {
1781
+ let t = this._lexer.token, n = this.parseDescription();
1782
+ this.expectKeyword("directive"), this.expectToken(o.AT);
1783
+ let i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
1784
+ this.expectKeyword("on");
1785
+ let a = this.parseDirectiveLocations();
1786
+ return this.node(t, {
1787
+ kind: c.DIRECTIVE_DEFINITION,
1788
+ description: n,
1789
+ name: i,
1790
+ arguments: r,
1791
+ repeatable: s,
1792
+ locations: a
1793
+ });
1794
+ }
1795
+ parseDirectiveLocations() {
1796
+ return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
1797
+ }
1798
+ parseDirectiveLocation() {
1799
+ let t = this._lexer.token, n = this.parseName();
1800
+ if (Object.prototype.hasOwnProperty.call(W, n.value)) return n;
1801
+ throw this.unexpected(t);
1802
+ }
1803
+ parseSchemaCoordinate() {
1804
+ let t = this._lexer.token, n = this.expectOptionalToken(o.AT), i = this.parseName(), r;
1805
+ !n && this.expectOptionalToken(o.DOT) && (r = this.parseName());
1806
+ let s;
1807
+ return (n || r) && this.expectOptionalToken(o.PAREN_L) && (s = this.parseName(), this.expectToken(o.COLON), this.expectToken(o.PAREN_R)), n ? s ? this.node(t, {
1808
+ kind: c.DIRECTIVE_ARGUMENT_COORDINATE,
1809
+ name: i,
1810
+ argumentName: s
1811
+ }) : this.node(t, {
1812
+ kind: c.DIRECTIVE_COORDINATE,
1813
+ name: i
1814
+ }) : r ? s ? this.node(t, {
1815
+ kind: c.ARGUMENT_COORDINATE,
1816
+ name: i,
1817
+ fieldName: r,
1818
+ argumentName: s
1819
+ }) : this.node(t, {
1820
+ kind: c.MEMBER_COORDINATE,
1821
+ name: i,
1822
+ memberName: r
1823
+ }) : this.node(t, {
1824
+ kind: c.TYPE_COORDINATE,
1825
+ name: i
1826
+ });
1827
+ }
1828
+ node(t, n) {
1829
+ return this._options.noLocation !== !0 && (n.loc = new H(t, this._lexer.lastToken, this._lexer.source)), n;
1830
+ }
1831
+ peek(t) {
1832
+ return this._lexer.token.kind === t;
1833
+ }
1834
+ expectToken(t) {
1835
+ let n = this._lexer.token;
1836
+ if (n.kind === t) return this.advanceLexer(), n;
1837
+ throw h(this._lexer.source, n.start, `Expected ${at(t)}, found ${ne(n)}.`);
1838
+ }
1839
+ expectOptionalToken(t) {
1840
+ return this._lexer.token.kind === t ? (this.advanceLexer(), !0) : !1;
1841
+ }
1842
+ expectKeyword(t) {
1843
+ let n = this._lexer.token;
1844
+ if (n.kind === o.NAME && n.value === t) this.advanceLexer();
1845
+ else throw h(this._lexer.source, n.start, `Expected "${t}", found ${ne(n)}.`);
1846
+ }
1847
+ expectOptionalKeyword(t) {
1848
+ let n = this._lexer.token;
1849
+ return n.kind === o.NAME && n.value === t ? (this.advanceLexer(), !0) : !1;
1850
+ }
1851
+ unexpected(t) {
1852
+ let n = t ?? this._lexer.token;
1853
+ return h(this._lexer.source, n.start, `Unexpected ${ne(n)}.`);
1854
+ }
1855
+ any(t, n, i) {
1856
+ this.expectToken(t);
1857
+ let r = [];
1858
+ for (; !this.expectOptionalToken(i);) r.push(n.call(this));
1859
+ return r;
1860
+ }
1861
+ optionalMany(t, n, i) {
1862
+ if (this.expectOptionalToken(t)) {
1863
+ let r = [];
1864
+ do
1865
+ r.push(n.call(this));
1866
+ while (!this.expectOptionalToken(i));
1867
+ return r;
1868
+ }
1869
+ return [];
1870
+ }
1871
+ many(t, n, i) {
1872
+ this.expectToken(t);
1873
+ let r = [];
1874
+ do
1875
+ r.push(n.call(this));
1876
+ while (!this.expectOptionalToken(i));
1877
+ return r;
1878
+ }
1879
+ delimitedMany(t, n) {
1880
+ this.expectOptionalToken(t);
1881
+ let i = [];
1882
+ do
1883
+ i.push(n.call(this));
1884
+ while (this.expectOptionalToken(t));
1885
+ return i;
1886
+ }
1887
+ advanceLexer() {
1888
+ let { maxTokens: t } = this._options, n = this._lexer.advance();
1889
+ if (n.kind !== o.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t)) throw h(this._lexer.source, n.start, `Document contains more that ${t} tokens. Parsing aborted.`);
1890
+ }
1891
+ };
1892
+ function ne(e) {
1893
+ let t = e.value;
1894
+ return at(e.kind) + (t != null ? ` "${t}"` : "");
1895
+ }
1896
+ function at(e) {
1897
+ return tt(e) ? `"${e}"` : e;
1898
+ }
1899
+ function Wt(e, t) {
1900
+ let n = /* @__PURE__ */ new SyntaxError(e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
1901
+ return Object.assign(n, t);
1902
+ }
1903
+ var ct = Wt;
1904
+ function zt(e) {
1905
+ let t = [], { startToken: n, endToken: i } = e.loc;
1906
+ for (let r = n; r !== i; r = r.next) r.kind === "Comment" && t.push({
1907
+ ...r,
1908
+ loc: {
1909
+ start: r.start,
1910
+ end: r.end
1911
+ }
1912
+ });
1913
+ return t;
1914
+ }
1915
+ var Kt = { allowLegacyFragmentVariables: !0 };
1916
+ function Zt(e) {
1917
+ if (e?.name === "GraphQLError") {
1918
+ let { message: t, locations: [n] } = e;
1919
+ return ct(t, {
1920
+ loc: { start: n },
1921
+ cause: e
1922
+ });
1923
+ }
1924
+ return e;
1925
+ }
1926
+ function en(e) {
1927
+ let t;
1928
+ try {
1929
+ t = ot(e, Kt);
1930
+ } catch (n) {
1931
+ throw Zt(n);
1932
+ }
1933
+ return t.comments = zt(t), t;
1934
+ }
1935
+ var tn = {
1936
+ parse: en,
1937
+ astFormat: "graphql",
1938
+ hasPragma: Fe,
1939
+ hasIgnorePragma: Me,
1940
+ locStart: J,
1941
+ locEnd: q
1942
+ };
1943
+ var nn = { graphql: Ge };
1944
+ //#endregion
1945
+ export { ut as default, Ye as languages, $e as options, he as parsers, nn as printers };