dorian 2.6.8 → 3.0.0

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