@builtbystack/sq-shopify-theme-sdk 0.0.6 → 0.0.7
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.
- package/README.doc.md +1 -1
- package/README.md +35 -1
- package/dist/sq-shopify-theme-sdk.d.ts +10 -0
- package/dist/sq-shopify-theme-sdk.js +111 -93
- package/dist/sq-shopify-theme-sdk.umd.js +21 -12
- package/package.json +1 -1
package/README.doc.md
CHANGED
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
# @builtbystack/sq-shopify-theme-sdk
|
|
9
9
|
|
|
10
|
-
以下のScript
|
|
10
|
+
以下のScriptタグで読み込んでください。
|
|
11
11
|
|
|
12
12
|
`@x.x.x` で指定されているバージョンは適宜最新のものを利用してください。
|
|
13
13
|
|
|
@@ -251,6 +251,7 @@ getPurchasingCustomerMetafield は渡されたnamespaceとkeyに一致する現
|
|
|
251
251
|
- [PointChange](#type-aliasespointchangemd)
|
|
252
252
|
- [PointChangeActivities](#type-aliasespointchangeactivitiesmd)
|
|
253
253
|
- [PointChangeActivity](#type-aliasespointchangeactivitymd)
|
|
254
|
+
- [PointMultiplierCustomerRankRule](#type-aliasespointmultipliercustomerrankrulemd)
|
|
254
255
|
- [Points](#type-aliasespointsmd)
|
|
255
256
|
- [PurchasingCustomerDiscount](#type-aliasespurchasingcustomerdiscountmd)
|
|
256
257
|
- [PurchasingCustomerDiscounts](#type-aliasespurchasingcustomerdiscountsmd)
|
|
@@ -299,6 +300,10 @@ CustomerRank は会員ランクを表す。
|
|
|
299
300
|
|
|
300
301
|
> **name**: `string`
|
|
301
302
|
|
|
303
|
+
#### pointMultiplier?
|
|
304
|
+
|
|
305
|
+
> `optional` **pointMultiplier**: [`PointMultiplierCustomerRankRule`](#type-aliasespointmultipliercustomerrankrulemd)
|
|
306
|
+
|
|
302
307
|
#### purchasePriceToRankUp
|
|
303
308
|
|
|
304
309
|
> **purchasePriceToRankUp**: `number`
|
|
@@ -640,6 +645,35 @@ PointChangeActivity はポイントの変動の履歴を表す。
|
|
|
640
645
|
> **title**: `string`
|
|
641
646
|
|
|
642
647
|
|
|
648
|
+
<a name="type-aliasespointmultipliercustomerrankrulemd"></a>
|
|
649
|
+
|
|
650
|
+
[**@builtbystack/sq-shopify-theme-sdk**](#readmemd) • **Docs**
|
|
651
|
+
|
|
652
|
+
***
|
|
653
|
+
|
|
654
|
+
[@builtbystack/sq-shopify-theme-sdk](#globalsmd) / PointMultiplierCustomerRankRule
|
|
655
|
+
|
|
656
|
+
## Type Alias: PointMultiplierCustomerRankRule
|
|
657
|
+
|
|
658
|
+
> **PointMultiplierCustomerRankRule**: `object`
|
|
659
|
+
|
|
660
|
+
PointMultiplierCustomerRankRule はこの会員ランクの注文時ポイント倍率を表す。
|
|
661
|
+
|
|
662
|
+
### Type declaration
|
|
663
|
+
|
|
664
|
+
#### customerRankRule
|
|
665
|
+
|
|
666
|
+
> **customerRankRule**: [`CustomerRankRule`](#type-aliasescustomerrankrulemd)
|
|
667
|
+
|
|
668
|
+
#### id
|
|
669
|
+
|
|
670
|
+
> **id**: `string`
|
|
671
|
+
|
|
672
|
+
#### multiplier
|
|
673
|
+
|
|
674
|
+
> **multiplier**: `string`
|
|
675
|
+
|
|
676
|
+
|
|
643
677
|
<a name="type-aliasespointsmd"></a>
|
|
644
678
|
|
|
645
679
|
[**@builtbystack/sq-shopify-theme-sdk**](#readmemd) • **Docs**
|
|
@@ -10,6 +10,7 @@ export declare type CustomerRank = {
|
|
|
10
10
|
lowerRank?: CustomerRankRule;
|
|
11
11
|
purchasePriceToRankUp: number;
|
|
12
12
|
threshold: number;
|
|
13
|
+
pointMultiplier?: PointMultiplierCustomerRankRule;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -140,6 +141,15 @@ declare enum PointChangeActivitySortKey {
|
|
|
140
141
|
PointChangeCreatedAt = "POINT_CHANGE_CREATED_AT"
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
/**
|
|
145
|
+
* PointMultiplierCustomerRankRule はこの会員ランクの注文時ポイント倍率を表す。
|
|
146
|
+
*/
|
|
147
|
+
export declare type PointMultiplierCustomerRankRule = {
|
|
148
|
+
id: string;
|
|
149
|
+
customerRankRule: CustomerRankRule;
|
|
150
|
+
multiplier: string;
|
|
151
|
+
};
|
|
152
|
+
|
|
143
153
|
/**
|
|
144
154
|
* Points は SDK から取得できるポイントの情報を表す。
|
|
145
155
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var He = Object.defineProperty;
|
|
2
2
|
var Ye = (e, t, n) => t in e ? He(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
3
|
+
var Ce = (e, t, n) => (Ye(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
4
|
function ze(e, t) {
|
|
5
5
|
for (var n = 0; n < t.length; n++) {
|
|
6
6
|
const r = t[n];
|
|
@@ -73,17 +73,17 @@ function _e(e, t) {
|
|
|
73
73
|
const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, a = t.line + s, u = t.line === 1 ? n : 0, p = t.column + u, d = `${e.name}:${a}:${p}
|
|
74
74
|
`, m = r.split(/\r\n|[\n\r]/g), E = m[i];
|
|
75
75
|
if (E.length > 120) {
|
|
76
|
-
const g = Math.floor(p / 80),
|
|
77
|
-
for (let
|
|
78
|
-
y.push(E.slice(
|
|
79
|
-
return d +
|
|
76
|
+
const g = Math.floor(p / 80), A = p % 80, y = [];
|
|
77
|
+
for (let N = 0; N < E.length; N += 80)
|
|
78
|
+
y.push(E.slice(N, N + 80));
|
|
79
|
+
return d + Ae([
|
|
80
80
|
[`${a} |`, y[0]],
|
|
81
|
-
...y.slice(1, g + 1).map((
|
|
82
|
-
["|", "^".padStart(
|
|
81
|
+
...y.slice(1, g + 1).map((N) => ["|", N]),
|
|
82
|
+
["|", "^".padStart(A)],
|
|
83
83
|
["|", y[g + 1]]
|
|
84
84
|
]);
|
|
85
85
|
}
|
|
86
|
-
return d +
|
|
86
|
+
return d + Ae([
|
|
87
87
|
// Lines specified like this: ["prefix", "string"],
|
|
88
88
|
[`${a - 1} |`, m[i - 1]],
|
|
89
89
|
[`${a} |`, E],
|
|
@@ -91,7 +91,7 @@ function _e(e, t) {
|
|
|
91
91
|
[`${a + 1} |`, m[i + 1]]
|
|
92
92
|
]);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ae(e) {
|
|
95
95
|
const t = e.filter(([r, i]) => i !== void 0), n = Math.max(...t.map(([r]) => r.length));
|
|
96
96
|
return t.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(`
|
|
97
97
|
`);
|
|
@@ -149,17 +149,17 @@ class Te extends Error {
|
|
|
149
149
|
constructor(t, ...n) {
|
|
150
150
|
var r, i, s;
|
|
151
151
|
const { nodes: a, source: u, positions: p, path: d, originalError: m, extensions: E } = it(n);
|
|
152
|
-
super(t), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError = m ?? void 0, this.nodes =
|
|
152
|
+
super(t), this.name = "GraphQLError", this.path = d ?? void 0, this.originalError = m ?? void 0, this.nodes = Ne(
|
|
153
153
|
Array.isArray(a) ? a : a ? [a] : void 0
|
|
154
154
|
);
|
|
155
|
-
const g =
|
|
155
|
+
const g = Ne(
|
|
156
156
|
(r = this.nodes) === null || r === void 0 ? void 0 : r.map((y) => y.loc).filter((y) => y != null)
|
|
157
157
|
);
|
|
158
158
|
this.source = u ?? (g == null || (i = g[0]) === null || i === void 0 ? void 0 : i.source), this.positions = p ?? (g == null ? void 0 : g.map((y) => y.start)), this.locations = p && u ? p.map((y) => de(u, y)) : g == null ? void 0 : g.map((y) => de(y.source, y.start));
|
|
159
|
-
const
|
|
159
|
+
const A = Ke(
|
|
160
160
|
m == null ? void 0 : m.extensions
|
|
161
161
|
) ? m == null ? void 0 : m.extensions : void 0;
|
|
162
|
-
this.extensions = (s = E ??
|
|
162
|
+
this.extensions = (s = E ?? A) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
163
163
|
message: {
|
|
164
164
|
writable: !0,
|
|
165
165
|
enumerable: !0
|
|
@@ -213,7 +213,7 @@ class Te extends Error {
|
|
|
213
213
|
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;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function Ne(e) {
|
|
217
217
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
218
218
|
}
|
|
219
219
|
function b(e, t, n) {
|
|
@@ -372,10 +372,10 @@ function xe(e) {
|
|
|
372
372
|
const t = e == null ? void 0 : e.kind;
|
|
373
373
|
return typeof t == "string" && st.has(t);
|
|
374
374
|
}
|
|
375
|
-
var
|
|
375
|
+
var U;
|
|
376
376
|
(function(e) {
|
|
377
377
|
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
378
|
-
})(
|
|
378
|
+
})(U || (U = {}));
|
|
379
379
|
var fe;
|
|
380
380
|
(function(e) {
|
|
381
381
|
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";
|
|
@@ -420,7 +420,7 @@ function ct(e) {
|
|
|
420
420
|
return t;
|
|
421
421
|
}
|
|
422
422
|
function ut(e, t) {
|
|
423
|
-
const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((
|
|
423
|
+
const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((A) => A.length === 0 || me(A.charCodeAt(0))), a = n.endsWith('\\"""'), u = e.endsWith('"') && !a, p = e.endsWith("\\"), d = u || p, m = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
|
|
424
424
|
(!i || e.length > 70 || d || s || a);
|
|
425
425
|
let E = "";
|
|
426
426
|
const g = i && me(e.charCodeAt(0));
|
|
@@ -838,7 +838,7 @@ function vt(e, t) {
|
|
|
838
838
|
n.slice(t, i)
|
|
839
839
|
);
|
|
840
840
|
}
|
|
841
|
-
const
|
|
841
|
+
const Ct = 10, Fe = 2;
|
|
842
842
|
function ve(e) {
|
|
843
843
|
return oe(e, []);
|
|
844
844
|
}
|
|
@@ -849,18 +849,18 @@ function oe(e, t) {
|
|
|
849
849
|
case "function":
|
|
850
850
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
851
851
|
case "object":
|
|
852
|
-
return
|
|
852
|
+
return At(e, t);
|
|
853
853
|
default:
|
|
854
854
|
return String(e);
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function At(e, t) {
|
|
858
858
|
if (e === null)
|
|
859
859
|
return "null";
|
|
860
860
|
if (t.includes(e))
|
|
861
861
|
return "[Circular]";
|
|
862
862
|
const n = [...t, e];
|
|
863
|
-
if (
|
|
863
|
+
if (Nt(e)) {
|
|
864
864
|
const r = e.toJSON();
|
|
865
865
|
if (r !== e)
|
|
866
866
|
return typeof r == "string" ? r : oe(r, n);
|
|
@@ -868,7 +868,7 @@ function Nt(e, t) {
|
|
|
868
868
|
return bt(e, n);
|
|
869
869
|
return xt(e, n);
|
|
870
870
|
}
|
|
871
|
-
function
|
|
871
|
+
function Nt(e) {
|
|
872
872
|
return typeof e.toJSON == "function";
|
|
873
873
|
}
|
|
874
874
|
function xt(e, t) {
|
|
@@ -882,7 +882,7 @@ function bt(e, t) {
|
|
|
882
882
|
return "[]";
|
|
883
883
|
if (t.length > Fe)
|
|
884
884
|
return "[Array]";
|
|
885
|
-
const n = Math.min(
|
|
885
|
+
const n = Math.min(Ct, e.length), r = e.length - n, i = [];
|
|
886
886
|
for (let s = 0; s < n; ++s)
|
|
887
887
|
i.push(oe(e[s], t));
|
|
888
888
|
return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
|
|
@@ -949,7 +949,7 @@ class Be {
|
|
|
949
949
|
function Dt(e) {
|
|
950
950
|
return Ot(e, Be);
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function Me(e, t) {
|
|
953
953
|
return new _t(e, t).parseDocument();
|
|
954
954
|
}
|
|
955
955
|
class _t {
|
|
@@ -1057,7 +1057,7 @@ class _t {
|
|
|
1057
1057
|
if (this.peek(c.BRACE_L))
|
|
1058
1058
|
return this.node(t, {
|
|
1059
1059
|
kind: f.OPERATION_DEFINITION,
|
|
1060
|
-
operation:
|
|
1060
|
+
operation: U.QUERY,
|
|
1061
1061
|
name: void 0,
|
|
1062
1062
|
variableDefinitions: [],
|
|
1063
1063
|
directives: [],
|
|
@@ -1081,11 +1081,11 @@ class _t {
|
|
|
1081
1081
|
const t = this.expectToken(c.NAME);
|
|
1082
1082
|
switch (t.value) {
|
|
1083
1083
|
case "query":
|
|
1084
|
-
return
|
|
1084
|
+
return U.QUERY;
|
|
1085
1085
|
case "mutation":
|
|
1086
|
-
return
|
|
1086
|
+
return U.MUTATION;
|
|
1087
1087
|
case "subscription":
|
|
1088
|
-
return
|
|
1088
|
+
return U.SUBSCRIPTION;
|
|
1089
1089
|
}
|
|
1090
1090
|
throw this.unexpected(t);
|
|
1091
1091
|
}
|
|
@@ -1945,7 +1945,7 @@ class _t {
|
|
|
1945
1945
|
throw b(
|
|
1946
1946
|
this._lexer.source,
|
|
1947
1947
|
n.start,
|
|
1948
|
-
`Expected ${
|
|
1948
|
+
`Expected ${Ue(t)}, found ${W(n)}.`
|
|
1949
1949
|
);
|
|
1950
1950
|
}
|
|
1951
1951
|
/**
|
|
@@ -2055,9 +2055,9 @@ class _t {
|
|
|
2055
2055
|
}
|
|
2056
2056
|
function W(e) {
|
|
2057
2057
|
const t = e.value;
|
|
2058
|
-
return
|
|
2058
|
+
return Ue(e.kind) + (t != null ? ` "${t}"` : "");
|
|
2059
2059
|
}
|
|
2060
|
-
function
|
|
2060
|
+
function Ue(e) {
|
|
2061
2061
|
return ht(e) ? `"${e}"` : e;
|
|
2062
2062
|
}
|
|
2063
2063
|
function kt(e) {
|
|
@@ -2239,12 +2239,12 @@ function Lt(e, t, n = Re) {
|
|
|
2239
2239
|
for (const _ of Object.values(f))
|
|
2240
2240
|
r.set(_, Ft(t, _));
|
|
2241
2241
|
let i, s = Array.isArray(e), a = [e], u = -1, p = [], d = e, m, E;
|
|
2242
|
-
const g = [],
|
|
2242
|
+
const g = [], A = [];
|
|
2243
2243
|
do {
|
|
2244
2244
|
u++;
|
|
2245
2245
|
const _ = u === a.length, z = _ && p.length !== 0;
|
|
2246
2246
|
if (_) {
|
|
2247
|
-
if (m =
|
|
2247
|
+
if (m = A.length === 0 ? void 0 : g[g.length - 1], d = E, E = A.pop(), z)
|
|
2248
2248
|
if (s) {
|
|
2249
2249
|
d = d.slice();
|
|
2250
2250
|
let k = 0;
|
|
@@ -2268,10 +2268,10 @@ function Lt(e, t, n = Re) {
|
|
|
2268
2268
|
}
|
|
2269
2269
|
let S;
|
|
2270
2270
|
if (!Array.isArray(d)) {
|
|
2271
|
-
var y,
|
|
2271
|
+
var y, N;
|
|
2272
2272
|
xe(d) || Z(!1, `Invalid AST Node: ${ve(d)}.`);
|
|
2273
|
-
const k = _ ? (y = r.get(d.kind)) === null || y === void 0 ? void 0 : y.leave : (
|
|
2274
|
-
if (S = k == null ? void 0 : k.call(t, d, m, E, g,
|
|
2273
|
+
const k = _ ? (y = r.get(d.kind)) === null || y === void 0 ? void 0 : y.leave : (N = r.get(d.kind)) === null || N === void 0 ? void 0 : N.enter;
|
|
2274
|
+
if (S = k == null ? void 0 : k.call(t, d, m, E, g, A), S === Pt)
|
|
2275
2275
|
break;
|
|
2276
2276
|
if (S === !1) {
|
|
2277
2277
|
if (!_) {
|
|
@@ -2296,7 +2296,7 @@ function Lt(e, t, n = Re) {
|
|
|
2296
2296
|
keys: a,
|
|
2297
2297
|
edits: p,
|
|
2298
2298
|
prev: i
|
|
2299
|
-
}, s = Array.isArray(d), a = s ? d : (D = n[d.kind]) !== null && D !== void 0 ? D : [], u = -1, p = [], E &&
|
|
2299
|
+
}, s = Array.isArray(d), a = s ? d : (D = n[d.kind]) !== null && D !== void 0 ? D : [], u = -1, p = [], E && A.push(E), E = d;
|
|
2300
2300
|
}
|
|
2301
2301
|
} while (i !== void 0);
|
|
2302
2302
|
return p.length !== 0 ? p[p.length - 1][1] : e;
|
|
@@ -2312,9 +2312,9 @@ function Ft(e, t) {
|
|
|
2312
2312
|
};
|
|
2313
2313
|
}
|
|
2314
2314
|
function Bt(e) {
|
|
2315
|
-
return Lt(e,
|
|
2315
|
+
return Lt(e, Ut);
|
|
2316
2316
|
}
|
|
2317
|
-
const
|
|
2317
|
+
const Mt = 80, Ut = {
|
|
2318
2318
|
Name: {
|
|
2319
2319
|
leave: (e) => e.value
|
|
2320
2320
|
},
|
|
@@ -2350,7 +2350,7 @@ const Ut = 80, Mt = {
|
|
|
2350
2350
|
leave({ alias: e, name: t, arguments: n, directives: r, selectionSet: i }) {
|
|
2351
2351
|
const s = v("", e, ": ") + t;
|
|
2352
2352
|
let a = s + v("(", h(n, ", "), ")");
|
|
2353
|
-
return a.length >
|
|
2353
|
+
return a.length > Mt && (a = s + v(`(
|
|
2354
2354
|
`, K(h(n, `
|
|
2355
2355
|
`)), `
|
|
2356
2356
|
)`)), h([a, h(r, " "), i], " ");
|
|
@@ -2582,7 +2582,7 @@ const Oe = (e) => {
|
|
|
2582
2582
|
if (typeof e == "string") {
|
|
2583
2583
|
let n;
|
|
2584
2584
|
try {
|
|
2585
|
-
const r =
|
|
2585
|
+
const r = Me(e);
|
|
2586
2586
|
n = Oe(r);
|
|
2587
2587
|
} catch {
|
|
2588
2588
|
}
|
|
@@ -2656,7 +2656,7 @@ var ye = { exports: {} };
|
|
|
2656
2656
|
function g(o) {
|
|
2657
2657
|
return typeof o != "string" && (o = String(o)), o;
|
|
2658
2658
|
}
|
|
2659
|
-
function
|
|
2659
|
+
function A(o) {
|
|
2660
2660
|
var l = {
|
|
2661
2661
|
next: function() {
|
|
2662
2662
|
var T = o.shift();
|
|
@@ -2695,19 +2695,19 @@ var ye = { exports: {} };
|
|
|
2695
2695
|
var o = [];
|
|
2696
2696
|
return this.forEach(function(l, T) {
|
|
2697
2697
|
o.push(T);
|
|
2698
|
-
}),
|
|
2698
|
+
}), A(o);
|
|
2699
2699
|
}, y.prototype.values = function() {
|
|
2700
2700
|
var o = [];
|
|
2701
2701
|
return this.forEach(function(l) {
|
|
2702
2702
|
o.push(l);
|
|
2703
|
-
}),
|
|
2703
|
+
}), A(o);
|
|
2704
2704
|
}, y.prototype.entries = function() {
|
|
2705
2705
|
var o = [];
|
|
2706
2706
|
return this.forEach(function(l, T) {
|
|
2707
2707
|
o.push([T, l]);
|
|
2708
|
-
}),
|
|
2708
|
+
}), A(o);
|
|
2709
2709
|
}, u.iterable && (y.prototype[Symbol.iterator] = y.prototype.entries);
|
|
2710
|
-
function
|
|
2710
|
+
function N(o) {
|
|
2711
2711
|
if (o.bodyUsed)
|
|
2712
2712
|
return Promise.reject(new TypeError("Already read"));
|
|
2713
2713
|
o.bodyUsed = !0;
|
|
@@ -2744,7 +2744,7 @@ var ye = { exports: {} };
|
|
|
2744
2744
|
return this.bodyUsed = !1, this._initBody = function(o) {
|
|
2745
2745
|
this._bodyInit = o, o ? typeof o == "string" ? this._bodyText = o : u.blob && Blob.prototype.isPrototypeOf(o) ? this._bodyBlob = o : u.formData && FormData.prototype.isPrototypeOf(o) ? this._bodyFormData = o : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) ? this._bodyText = o.toString() : u.arrayBuffer && u.blob && p(o) ? (this._bodyArrayBuffer = k(o.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : u.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(o) || m(o)) ? this._bodyArrayBuffer = k(o) : this._bodyText = o = Object.prototype.toString.call(o) : this._bodyText = "", this.headers.get("content-type") || (typeof o == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : u.searchParams && URLSearchParams.prototype.isPrototypeOf(o) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
2746
2746
|
}, u.blob && (this.blob = function() {
|
|
2747
|
-
var o =
|
|
2747
|
+
var o = N(this);
|
|
2748
2748
|
if (o)
|
|
2749
2749
|
return o;
|
|
2750
2750
|
if (this._bodyBlob)
|
|
@@ -2755,9 +2755,9 @@ var ye = { exports: {} };
|
|
|
2755
2755
|
throw new Error("could not read FormData body as blob");
|
|
2756
2756
|
return Promise.resolve(new Blob([this._bodyText]));
|
|
2757
2757
|
}, this.arrayBuffer = function() {
|
|
2758
|
-
return this._bodyArrayBuffer ?
|
|
2758
|
+
return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(_);
|
|
2759
2759
|
}), this.text = function() {
|
|
2760
|
-
var o =
|
|
2760
|
+
var o = N(this);
|
|
2761
2761
|
if (o)
|
|
2762
2762
|
return o;
|
|
2763
2763
|
if (this._bodyBlob)
|
|
@@ -2798,18 +2798,18 @@ var ye = { exports: {} };
|
|
|
2798
2798
|
var l = new FormData();
|
|
2799
2799
|
return o.trim().split("&").forEach(function(T) {
|
|
2800
2800
|
if (T) {
|
|
2801
|
-
var O = T.split("="), I = O.shift().replace(/\+/g, " "),
|
|
2802
|
-
l.append(decodeURIComponent(I), decodeURIComponent(
|
|
2801
|
+
var O = T.split("="), I = O.shift().replace(/\+/g, " "), C = O.join("=").replace(/\+/g, " ");
|
|
2802
|
+
l.append(decodeURIComponent(I), decodeURIComponent(C));
|
|
2803
2803
|
}
|
|
2804
2804
|
}), l;
|
|
2805
2805
|
}
|
|
2806
2806
|
function $e(o) {
|
|
2807
2807
|
var l = new y(), T = o.replace(/\r?\n[\t ]+/g, " ");
|
|
2808
2808
|
return T.split(/\r?\n/).forEach(function(O) {
|
|
2809
|
-
var I = O.split(":"),
|
|
2810
|
-
if (
|
|
2809
|
+
var I = O.split(":"), C = I.shift().trim();
|
|
2810
|
+
if (C) {
|
|
2811
2811
|
var X = I.join(":").trim();
|
|
2812
|
-
l.append(
|
|
2812
|
+
l.append(C, X);
|
|
2813
2813
|
}
|
|
2814
2814
|
}), l;
|
|
2815
2815
|
}
|
|
@@ -2848,30 +2848,30 @@ var ye = { exports: {} };
|
|
|
2848
2848
|
var I = new L(o, l);
|
|
2849
2849
|
if (I.signal && I.signal.aborted)
|
|
2850
2850
|
return O(new a.DOMException("Aborted", "AbortError"));
|
|
2851
|
-
var
|
|
2851
|
+
var C = new XMLHttpRequest();
|
|
2852
2852
|
function X() {
|
|
2853
|
-
|
|
2853
|
+
C.abort();
|
|
2854
2854
|
}
|
|
2855
|
-
|
|
2855
|
+
C.onload = function() {
|
|
2856
2856
|
var j = {
|
|
2857
|
-
status:
|
|
2858
|
-
statusText:
|
|
2859
|
-
headers: $e(
|
|
2857
|
+
status: C.status,
|
|
2858
|
+
statusText: C.statusText,
|
|
2859
|
+
headers: $e(C.getAllResponseHeaders() || "")
|
|
2860
2860
|
};
|
|
2861
|
-
j.url = "responseURL" in
|
|
2862
|
-
var ce = "response" in
|
|
2861
|
+
j.url = "responseURL" in C ? C.responseURL : j.headers.get("X-Request-URL");
|
|
2862
|
+
var ce = "response" in C ? C.response : C.responseText;
|
|
2863
2863
|
T(new w(ce, j));
|
|
2864
|
-
},
|
|
2864
|
+
}, C.onerror = function() {
|
|
2865
2865
|
O(new TypeError("Network request failed"));
|
|
2866
|
-
},
|
|
2866
|
+
}, C.ontimeout = function() {
|
|
2867
2867
|
O(new TypeError("Network request failed"));
|
|
2868
|
-
},
|
|
2868
|
+
}, C.onabort = function() {
|
|
2869
2869
|
O(new a.DOMException("Aborted", "AbortError"));
|
|
2870
|
-
},
|
|
2871
|
-
|
|
2872
|
-
}), I.signal && (I.signal.addEventListener("abort", X),
|
|
2873
|
-
|
|
2874
|
-
}),
|
|
2870
|
+
}, C.open(I.method, I.url, !0), I.credentials === "include" ? C.withCredentials = !0 : I.credentials === "omit" && (C.withCredentials = !1), "responseType" in C && u.blob && (C.responseType = "blob"), I.headers.forEach(function(j, ce) {
|
|
2871
|
+
C.setRequestHeader(ce, j);
|
|
2872
|
+
}), I.signal && (I.signal.addEventListener("abort", X), C.onreadystatechange = function() {
|
|
2873
|
+
C.readyState === 4 && I.signal.removeEventListener("abort", X);
|
|
2874
|
+
}), C.send(typeof I._bodyInit > "u" ? null : I._bodyInit);
|
|
2875
2875
|
});
|
|
2876
2876
|
}
|
|
2877
2877
|
return ae.polyfill = !0, s.fetch || (s.fetch = ae, s.Headers = y, s.Request = L, s.Response = w), a.Headers = y, a.Request = L, a.Response = w, a.fetch = ae, Object.defineProperty(a, "__esModule", { value: !0 }), a;
|
|
@@ -2884,7 +2884,7 @@ var ne = ye.exports;
|
|
|
2884
2884
|
const ee = /* @__PURE__ */ Vt(ne), jt = /* @__PURE__ */ ze({
|
|
2885
2885
|
__proto__: null,
|
|
2886
2886
|
default: ee
|
|
2887
|
-
}, [ne]),
|
|
2887
|
+
}, [ne]), M = (e) => {
|
|
2888
2888
|
let t = {};
|
|
2889
2889
|
return e && (typeof Headers < "u" && e instanceof Headers || jt && ne.Headers && e instanceof ne.Headers ? t = Je(e) : Array.isArray(e) ? e.forEach(([n, r]) => {
|
|
2890
2890
|
n && r !== void 0 && (t[n] = r);
|
|
@@ -2916,31 +2916,31 @@ const ee = /* @__PURE__ */ Vt(ne), jt = /* @__PURE__ */ ze({
|
|
|
2916
2916
|
body: E,
|
|
2917
2917
|
...u
|
|
2918
2918
|
};
|
|
2919
|
-
let
|
|
2919
|
+
let A = n, y = g;
|
|
2920
2920
|
if (p) {
|
|
2921
|
-
const
|
|
2922
|
-
|
|
2921
|
+
const N = await Promise.resolve(p({ ...g, url: n, operationName: s, variables: i })), { url: D, ..._ } = N;
|
|
2922
|
+
A = D, y = _;
|
|
2923
2923
|
}
|
|
2924
|
-
return m && (
|
|
2924
|
+
return m && (A = `${A}?${m}`), await a(A, y);
|
|
2925
2925
|
};
|
|
2926
2926
|
class Ht {
|
|
2927
2927
|
constructor(t, n = {}) {
|
|
2928
2928
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...r) => {
|
|
2929
|
-
const [i, s, a] = r, u = We(i, s, a), { headers: p, fetch: d = ee, method: m = "POST", requestMiddleware: E, responseMiddleware: g, ...
|
|
2930
|
-
u.signal !== void 0 && (
|
|
2931
|
-
const { operationName:
|
|
2929
|
+
const [i, s, a] = r, u = We(i, s, a), { headers: p, fetch: d = ee, method: m = "POST", requestMiddleware: E, responseMiddleware: g, ...A } = this.requestConfig, { url: y } = this;
|
|
2930
|
+
u.signal !== void 0 && (A.signal = u.signal);
|
|
2931
|
+
const { operationName: N } = le(u.query);
|
|
2932
2932
|
return he({
|
|
2933
2933
|
url: y,
|
|
2934
2934
|
query: u.query,
|
|
2935
2935
|
variables: u.variables,
|
|
2936
2936
|
headers: {
|
|
2937
|
-
...
|
|
2938
|
-
...
|
|
2937
|
+
...M(pe(p)),
|
|
2938
|
+
...M(u.requestHeaders)
|
|
2939
2939
|
},
|
|
2940
|
-
operationName:
|
|
2940
|
+
operationName: N,
|
|
2941
2941
|
fetch: d,
|
|
2942
2942
|
method: m,
|
|
2943
|
-
fetchOptions:
|
|
2943
|
+
fetchOptions: A,
|
|
2944
2944
|
middleware: E
|
|
2945
2945
|
}).then((D) => (g && g(D), D)).catch((D) => {
|
|
2946
2946
|
throw g && g(D), D;
|
|
@@ -2950,22 +2950,22 @@ class Ht {
|
|
|
2950
2950
|
async request(t, ...n) {
|
|
2951
2951
|
const [r, i] = n, s = Xe(t, r, i), { headers: a, fetch: u = ee, method: p = "POST", requestMiddleware: d, responseMiddleware: m, ...E } = this.requestConfig, { url: g } = this;
|
|
2952
2952
|
s.signal !== void 0 && (E.signal = s.signal);
|
|
2953
|
-
const { query:
|
|
2953
|
+
const { query: A, operationName: y } = le(s.document);
|
|
2954
2954
|
return he({
|
|
2955
2955
|
url: g,
|
|
2956
|
-
query:
|
|
2956
|
+
query: A,
|
|
2957
2957
|
variables: s.variables,
|
|
2958
2958
|
headers: {
|
|
2959
|
-
...
|
|
2960
|
-
...
|
|
2959
|
+
...M(pe(a)),
|
|
2960
|
+
...M(s.requestHeaders)
|
|
2961
2961
|
},
|
|
2962
2962
|
operationName: y,
|
|
2963
2963
|
fetch: u,
|
|
2964
2964
|
method: p,
|
|
2965
2965
|
fetchOptions: E,
|
|
2966
2966
|
middleware: d
|
|
2967
|
-
}).then((
|
|
2968
|
-
throw m && m(
|
|
2967
|
+
}).then((N) => (m && m(N), N.data)).catch((N) => {
|
|
2968
|
+
throw m && m(N), N;
|
|
2969
2969
|
});
|
|
2970
2970
|
}
|
|
2971
2971
|
// prettier-ignore
|
|
@@ -2979,8 +2979,8 @@ class Ht {
|
|
|
2979
2979
|
// @ts-expect-error TODO reconcile batch variables into system.
|
|
2980
2980
|
variables: u,
|
|
2981
2981
|
headers: {
|
|
2982
|
-
...
|
|
2983
|
-
...
|
|
2982
|
+
...M(pe(i)),
|
|
2983
|
+
...M(r.requestHeaders)
|
|
2984
2984
|
},
|
|
2985
2985
|
operationName: void 0,
|
|
2986
2986
|
fetch: this.requestConfig.fetch ?? ee,
|
|
@@ -3084,7 +3084,7 @@ function Xt(e) {
|
|
|
3084
3084
|
function Wt(e) {
|
|
3085
3085
|
var t = Ve(e);
|
|
3086
3086
|
if (!te.has(t)) {
|
|
3087
|
-
var n =
|
|
3087
|
+
var n = Me(e, {
|
|
3088
3088
|
experimentalFragmentVariables: re,
|
|
3089
3089
|
allowLegacyFragmentVariables: re
|
|
3090
3090
|
});
|
|
@@ -3271,6 +3271,15 @@ const P = q, nn = P`
|
|
|
3271
3271
|
earnedPoint
|
|
3272
3272
|
purchasePrice
|
|
3273
3273
|
}
|
|
3274
|
+
pointMultiplier {
|
|
3275
|
+
id
|
|
3276
|
+
customerRankRule {
|
|
3277
|
+
id
|
|
3278
|
+
name
|
|
3279
|
+
threshold
|
|
3280
|
+
}
|
|
3281
|
+
multiplier
|
|
3282
|
+
}
|
|
3274
3283
|
}
|
|
3275
3284
|
}
|
|
3276
3285
|
}
|
|
@@ -3305,7 +3314,7 @@ function pn(e, t = hn) {
|
|
|
3305
3314
|
}
|
|
3306
3315
|
class fn {
|
|
3307
3316
|
constructor(t) {
|
|
3308
|
-
|
|
3317
|
+
Ce(this, "api");
|
|
3309
3318
|
this.api = pn(new Ht(`${t}/apps/sq-api`, {
|
|
3310
3319
|
headers: {
|
|
3311
3320
|
"X-SQ-CLIENT": "ShopifyAppProxy"
|
|
@@ -3462,7 +3471,16 @@ class fn {
|
|
|
3462
3471
|
threshold: t.purchasingCustomer.currentCustomerRank.lowerRank.threshold
|
|
3463
3472
|
} : void 0,
|
|
3464
3473
|
purchasePriceToRankUp: t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,
|
|
3465
|
-
threshold: t.purchasingCustomer.currentCustomerRank.threshold
|
|
3474
|
+
threshold: t.purchasingCustomer.currentCustomerRank.threshold,
|
|
3475
|
+
pointMultiplier: t.purchasingCustomer.currentCustomerRank.pointMultiplier ? {
|
|
3476
|
+
id: t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,
|
|
3477
|
+
customerRankRule: {
|
|
3478
|
+
id: t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,
|
|
3479
|
+
name: t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,
|
|
3480
|
+
threshold: t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold
|
|
3481
|
+
},
|
|
3482
|
+
multiplier: t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier
|
|
3483
|
+
} : void 0
|
|
3466
3484
|
} : null;
|
|
3467
3485
|
}
|
|
3468
3486
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(R,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(R=typeof globalThis<"u"?globalThis:R||self,_(R.SQ={}))})(this,function(R){"use strict";var dn=Object.defineProperty;var fn=(R,_,F)=>_ in R?dn(R,_,{enumerable:!0,configurable:!0,writable:!0,value:F}):R[_]=F;var $e=(R,_,F)=>(fn(R,typeof _!="symbol"?_+"":_,F),F);function _(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const F=JSON,Ge=e=>e.toUpperCase(),He=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Ye=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},ze=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},Qe=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function X(e,t){if(!!!e)throw new Error(t)}function Je(e){return typeof e=="object"&&e!==null}function Xe(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}const We=/\r\n|[\n\r]/g;function le(e,t){let n=0,r=1;for(const i of e.body.matchAll(We)){if(typeof i.index=="number"||Xe(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Ze(e){return
|
|
2
|
-
`,m=r.split(/\r\n|[\n\r]/g),E=m[i];if(E.length>120){const g=Math.floor(p/80),
|
|
3
|
-
`)}function Ke(e){const 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}class he extends Error{constructor(t,...n){var r,i,s;const{nodes:a,source:u,positions:p,path:d,originalError:m,extensions:E}=Ke(n);super(t),this.name="GraphQLError",this.path=d??void 0,this.originalError=m??void 0,this.nodes=be(Array.isArray(a)?a:a?[a]:void 0);const g=be((r=this.nodes)===null||r===void 0?void 0:r.map(y=>y.loc).filter(y=>y!=null));this.source=u??(g==null||(i=g[0])===null||i===void 0?void 0:i.source),this.positions=p??(g==null?void 0:g.map(y=>y.start)),this.locations=p&&u?p.map(y=>le(u,y)):g==null?void 0:g.map(y=>le(y.source,y.start));const
|
|
1
|
+
(function(R,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(R=typeof globalThis<"u"?globalThis:R||self,_(R.SQ={}))})(this,function(R){"use strict";var dn=Object.defineProperty;var fn=(R,_,F)=>_ in R?dn(R,_,{enumerable:!0,configurable:!0,writable:!0,value:F}):R[_]=F;var $e=(R,_,F)=>(fn(R,typeof _!="symbol"?_+"":_,F),F);function _(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const F=JSON,Ge=e=>e.toUpperCase(),He=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},Ye=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},ze=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},Qe=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0};function X(e,t){if(!!!e)throw new Error(t)}function Je(e){return typeof e=="object"&&e!==null}function Xe(e,t){if(!!!e)throw new Error(t??"Unexpected invariant triggered.")}const We=/\r\n|[\n\r]/g;function le(e,t){let n=0,r=1;for(const i of e.body.matchAll(We)){if(typeof i.index=="number"||Xe(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Ze(e){return Ne(e.source,le(e.source,e.start))}function Ne(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,u=t.line===1?n:0,p=t.column+u,d=`${e.name}:${a}:${p}
|
|
2
|
+
`,m=r.split(/\r\n|[\n\r]/g),E=m[i];if(E.length>120){const g=Math.floor(p/80),A=p%80,y=[];for(let N=0;N<E.length;N+=80)y.push(E.slice(N,N+80));return d+xe([[`${a} |`,y[0]],...y.slice(1,g+1).map(N=>["|",N]),["|","^".padStart(A)],["|",y[g+1]]])}return d+xe([[`${a-1} |`,m[i-1]],[`${a} |`,E],["|","^".padStart(p)],[`${a+1} |`,m[i+1]]])}function xe(e){const t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
3
|
+
`)}function Ke(e){const 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}class he extends Error{constructor(t,...n){var r,i,s;const{nodes:a,source:u,positions:p,path:d,originalError:m,extensions:E}=Ke(n);super(t),this.name="GraphQLError",this.path=d??void 0,this.originalError=m??void 0,this.nodes=be(Array.isArray(a)?a:a?[a]:void 0);const g=be((r=this.nodes)===null||r===void 0?void 0:r.map(y=>y.loc).filter(y=>y!=null));this.source=u??(g==null||(i=g[0])===null||i===void 0?void 0:i.source),this.positions=p??(g==null?void 0:g.map(y=>y.start)),this.locations=p&&u?p.map(y=>le(u,y)):g==null?void 0:g.map(y=>le(y.source,y.start));const A=Je(m==null?void 0:m.extensions)?m==null?void 0:m.extensions:void 0;this.extensions=(s=E??A)!==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}}),m!=null&&m.stack?Object.defineProperty(this,"stack",{value:m.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,he):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(const n of this.nodes)n.loc&&(t+=`
|
|
4
4
|
|
|
5
5
|
`+Ze(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
|
|
6
6
|
|
|
7
|
-
`+
|
|
7
|
+
`+Ne(this.source,n);return t}toJSON(){const 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 be(e){return e===void 0||e.length===0?void 0:e}function b(e,t,n){return new he(`Syntax Error: ${n}`,{source:e,positions:[t]})}class et{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Ie{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,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}}}const Oe={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},tt=new Set(Object.keys(Oe));function De(e){const t=e==null?void 0:e.kind;return typeof t=="string"&&tt.has(t)}var q;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(q||(q={}));var pe;(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"})(pe||(pe={}));var f;(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"})(f||(f={}));function de(e){return e===9||e===32}function H(e){return e>=48&&e<=57}function _e(e){return e>=97&&e<=122||e>=65&&e<=90}function ke(e){return _e(e)||e===95}function nt(e){return _e(e)||H(e)||e===95}function it(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<e.length;++a){var s;const u=e[a],p=rt(u);p!==u.length&&(r=(s=r)!==null&&s!==void 0?s:a,i=a,a!==0&&p<n&&(n=p))}return e.map((a,u)=>u===0?a:a.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function rt(e){let t=0;for(;t<e.length&&de(e.charCodeAt(t));)++t;return t}function st(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(A=>A.length===0||de(A.charCodeAt(0))),a=n.endsWith('\\"""'),u=e.endsWith('"')&&!a,p=e.endsWith("\\"),d=u||p,m=!(t!=null&&t.minimize)&&(!i||e.length>70||d||s||a);let E="";const g=i&&de(e.charCodeAt(0));return(m&&!g||s)&&(E+=`
|
|
8
8
|
`),E+=n,(m||d)&&(E+=`
|
|
9
|
-
`),'"""'+E+'"""'}var c;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",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"})(c||(c={}));class ot{constructor(t){const n=new Ie(c.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!==c.EOF)do if(t.next)t=t.next;else{const n=ct(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===c.COMMENT);return t}}function at(e){return e===c.BANG||e===c.DOLLAR||e===c.AMP||e===c.PAREN_L||e===c.PAREN_R||e===c.SPREAD||e===c.COLON||e===c.EQUALS||e===c.AT||e===c.BRACKET_L||e===c.BRACKET_R||e===c.BRACE_L||e===c.PIPE||e===c.BRACE_R}function V(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function W(e,t){return Re(e.charCodeAt(t))&&Se(e.charCodeAt(t+1))}function Re(e){return e>=55296&&e<=56319}function Se(e){return e>=56320&&e<=57343}function
|
|
9
|
+
`),'"""'+E+'"""'}var c;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",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"})(c||(c={}));class ot{constructor(t){const n=new Ie(c.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!==c.EOF)do if(t.next)t=t.next;else{const n=ct(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===c.COMMENT);return t}}function at(e){return e===c.BANG||e===c.DOLLAR||e===c.AMP||e===c.PAREN_L||e===c.PAREN_R||e===c.SPREAD||e===c.COLON||e===c.EQUALS||e===c.AT||e===c.BRACKET_L||e===c.BRACKET_R||e===c.BRACE_L||e===c.PIPE||e===c.BRACE_R}function V(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function W(e,t){return Re(e.charCodeAt(t))&&Se(e.charCodeAt(t+1))}function Re(e){return e>=55296&&e<=56319}function Se(e){return e>=56320&&e<=57343}function M(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return c.EOF;if(n>=32&&n<=126){const r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function x(e,t,n,r,i){const s=e.line,a=1+n-e.lineStart;return new Ie(t,n,r,s,a,i)}function ct(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return ut(e,i);case 33:return x(e,c.BANG,i,i+1);case 36:return x(e,c.DOLLAR,i,i+1);case 38:return x(e,c.AMP,i,i+1);case 40:return x(e,c.PAREN_L,i,i+1);case 41:return x(e,c.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return x(e,c.SPREAD,i,i+3);break;case 58:return x(e,c.COLON,i,i+1);case 61:return x(e,c.EQUALS,i,i+1);case 64:return x(e,c.AT,i,i+1);case 91:return x(e,c.BRACKET_L,i,i+1);case 93:return x(e,c.BRACKET_R,i,i+1);case 123:return x(e,c.BRACE_L,i,i+1);case 124:return x(e,c.PIPE,i,i+1);case 125:return x(e,c.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?mt(e,i):ht(e,i)}if(H(s)||s===45)return lt(e,i,s);if(ke(s))return yt(e,i);throw b(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:V(s)||W(n,i)?`Unexpected character: ${M(e,i)}.`:`Invalid character: ${M(e,i)}.`)}return x(e,c.EOF,r,r)}function ut(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(s===10||s===13)break;if(V(s))++i;else if(W(n,i))i+=2;else break}return x(e,c.COMMENT,t,i,n.slice(t+1,i))}function lt(e,t,n){const r=e.source.body;let i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),H(s))throw b(e.source,i,`Invalid number, unexpected digit after 0: ${M(e,i)}.`)}else i=fe(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=fe(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=fe(e,i,s),s=r.charCodeAt(i)),s===46||ke(s))throw b(e.source,i,`Invalid number, expected digit but got: ${M(e,i)}.`);return x(e,a?c.FLOAT:c.INT,t,i,r.slice(t,i))}function fe(e,t,n){if(!H(n))throw b(e.source,t,`Invalid number, expected digit but got: ${M(e,t)}.`);const r=e.source.body;let i=t+1;for(;H(r.charCodeAt(i));)++i;return i}function ht(e,t){const n=e.source.body,r=n.length;let i=t+1,s=i,a="";for(;i<r;){const u=n.charCodeAt(i);if(u===34)return a+=n.slice(s,i),x(e,c.STRING,t,i+1,a);if(u===92){a+=n.slice(s,i);const p=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?pt(e,i):dt(e,i):ft(e,i);a+=p.value,i+=p.size,s=i;continue}if(u===10||u===13)break;if(V(u))++i;else if(W(n,i))i+=2;else throw b(e.source,i,`Invalid character within String: ${M(e,i)}.`)}throw b(e.source,i,"Unterminated string.")}function pt(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const s=n.charCodeAt(t+i++);if(s===125){if(i<5||!V(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Y(s),r<0)break}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function dt(e,t){const n=e.source.body,r=we(n,t+2);if(V(r))return{value:String.fromCodePoint(r),size:6};if(Re(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const i=we(n,t+8);if(Se(i))return{value:String.fromCodePoint(r,i),size:12}}throw b(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function we(e,t){return Y(e.charCodeAt(t))<<12|Y(e.charCodeAt(t+1))<<8|Y(e.charCodeAt(t+2))<<4|Y(e.charCodeAt(t+3))}function Y(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ft(e,t){const 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:`
|
|
10
10
|
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw b(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function mt(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,s=t+3,a=s,u="";const p=[];for(;s<r;){const d=n.charCodeAt(s);if(d===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){u+=n.slice(a,s),p.push(u);const m=x(e,c.BLOCK_STRING,t,s+3,it(p).join(`
|
|
11
|
-
`));return e.line+=p.length-1,e.lineStart=i,m}if(d===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(d===10||d===13){u+=n.slice(a,s),p.push(u),d===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",a=s,i=s;continue}if(V(d))++s;else if(W(n,s))s+=2;else throw b(e.source,s,`Invalid character within String: ${
|
|
11
|
+
`));return e.line+=p.length-1,e.lineStart=i,m}if(d===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(d===10||d===13){u+=n.slice(a,s),p.push(u),d===13&&n.charCodeAt(s+1)===10?s+=2:++s,u="",a=s,i=s;continue}if(V(d))++s;else if(W(n,s))s+=2;else throw b(e.source,s,`Invalid character within String: ${M(e,s)}.`)}throw b(e.source,s,"Unterminated string.")}function yt(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const s=n.charCodeAt(i);if(nt(s))++i;else break}return x(e,c.NAME,t,i,n.slice(t,i))}const Et=10,Pe=2;function me(e){return Z(e,[])}function Z(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return gt(e,t);default:return String(e)}}function gt(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(Tt(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:Z(r,n)}else if(Array.isArray(e))return Ct(e,n);return vt(e,n)}function Tt(e){return typeof e.toJSON=="function"}function vt(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>Pe?"["+At(e)+"]":"{ "+n.map(([i,s])=>i+": "+Z(s,t)).join(", ")+" }"}function Ct(e,t){if(e.length===0)return"[]";if(t.length>Pe)return"[Array]";const n=Math.min(Et,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(Z(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function At(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){const n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}const Nt=globalThis.process&&globalThis.process.env.NODE_ENV==="production"?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t=="object"&&t!==null){var r;const i=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(r=t.constructor)===null||r===void 0?void 0:r.name;if(i===s){const a=me(t);throw new Error(`Cannot use ${i} "${a}" from another module or realm.
|
|
12
12
|
|
|
13
13
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
14
14
|
directory. If different versions of "graphql" are the dependencies of other
|
|
@@ -19,7 +19,7 @@ https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
|
19
19
|
Duplicate "graphql" modules cannot be used at the same time since different
|
|
20
20
|
versions may have different capabilities and behavior. The data from one
|
|
21
21
|
version used in the function from another could produce confusing and
|
|
22
|
-
spurious results.`)}}return!1};class Le{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||X(!1,`Body must be a string. Received: ${me(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||X(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||X(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function xt(e){return Ct(e,Le)}function Fe(e,t){return new bt(e,t).parseDocument()}class bt{constructor(t,n={}){const r=xt(t)?t:new Le(t);this._lexer=new ot(r),this._options=n,this._tokenCounter=0}parseName(){const t=this.expectToken(c.NAME);return this.node(t,{kind:f.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:f.DOCUMENT,definitions:this.many(c.SOF,this.parseDefinition,c.EOF)})}parseDefinition(){if(this.peek(c.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===c.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()}if(t)throw b(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(c.BRACE_L))return this.node(t,{kind:f.OPERATION_DEFINITION,operation:q.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(c.NAME)&&(r=this.parseName()),this.node(t,{kind:f.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(c.NAME);switch(t.value){case"query":return q.QUERY;case"mutation":return q.MUTATION;case"subscription":return q.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(c.PAREN_L,this.parseVariableDefinition,c.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:f.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(c.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(c.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(c.DOLLAR),this.node(t,{kind:f.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:f.SELECTION_SET,selections:this.many(c.BRACE_L,this.parseSelection,c.BRACE_R)})}parseSelection(){return this.peek(c.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(c.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:f.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(c.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(c.PAREN_L,n,c.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(c.COLON),this.node(n,{kind:f.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(c.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(c.NAME)?this.node(t,{kind:f.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:f.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:f.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:f.FRAGMENT_DEFINITION,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){const n=this._lexer.token;switch(n.kind){case c.BRACKET_L:return this.parseList(t);case c.BRACE_L:return this.parseObject(t);case c.INT:return this.advanceLexer(),this.node(n,{kind:f.INT,value:n.value});case c.FLOAT:return this.advanceLexer(),this.node(n,{kind:f.FLOAT,value:n.value});case c.STRING:case c.BLOCK_STRING:return this.parseStringLiteral();case c.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:f.BOOLEAN,value:!0});case"false":return this.node(n,{kind:f.BOOLEAN,value:!1});case"null":return this.node(n,{kind:f.NULL});default:return this.node(n,{kind:f.ENUM,value:n.value})}case c.DOLLAR:if(t)if(this.expectToken(c.DOLLAR),this._lexer.token.kind===c.NAME){const r=this._lexer.token.value;throw b(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:f.STRING,value:t.value,block:t.kind===c.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:f.LIST,values:this.any(c.BRACKET_L,n,c.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:f.OBJECT,fields:this.any(c.BRACE_L,n,c.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(c.COLON),this.node(n,{kind:f.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(c.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(c.AT),this.node(n,{kind:f.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(c.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(c.BRACKET_R),n=this.node(t,{kind:f.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(c.BANG)?this.node(t,{kind:f.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:f.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(c.STRING)||this.peek(c.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(c.BRACE_L,this.parseOperationTypeDefinition,c.BRACE_R);return this.node(t,{kind:f.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(c.COLON);const r=this.parseNamedType();return this.node(t,{kind:f.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:f.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:f.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(c.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(c.BRACE_L,this.parseFieldDefinition,c.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(c.COLON);const s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:f.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(c.PAREN_L,this.parseInputValueDef,c.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(c.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(c.EQUALS)&&(s=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(t,{kind:f.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:f.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:f.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(c.EQUALS)?this.delimitedMany(c.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:f.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(c.BRACE_L,this.parseEnumValueDefinition,c.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:f.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw b(this._lexer.source,this._lexer.token.start,`${K(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(c.BRACE_L,this.parseInputValueDef,c.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===c.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(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(c.BRACE_L,this.parseOperationTypeDefinition,c.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(c.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(t,{kind:f.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(c.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(pe,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new et(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw b(this._lexer.source,n.start,`Expected ${Be(t)}, found ${K(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===c.NAME&&n.value===t)this.advanceLexer();else throw b(this._lexer.source,n.start,`Expected "${t}", found ${K(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===c.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return b(this._lexer.source,n.start,`Unexpected ${K(n)}.`)}any(t,n,r){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==c.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw b(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function K(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return at(e)?`"${e}"`:e}function It(e){return`"${e.replace(Ot,Dt)}"`}const Ot=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Dt(e){return _t[e.charCodeAt(0)]}const _t=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],kt=Object.freeze({});function Rt(e,t,n=Oe){const r=new Map;for(const k of Object.values(f))r.set(k,St(t,k));let i,s=Array.isArray(e),a=[e],u=-1,p=[],d=e,m,E;const g=[],N=[];do{u++;const k=u===a.length,oe=k&&p.length!==0;if(k){if(m=N.length===0?void 0:g[g.length-1],d=E,E=N.pop(),oe)if(s){d=d.slice();let w=0;for(const[G,ae]of p){const ce=G-w;ae===null?(d.splice(ce,1),w++):d[ce]=ae}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[w,G]of p)d[w]=G}u=i.index,a=i.keys,p=i.edits,s=i.inArray,i=i.prev}else if(E){if(m=s?u:a[u],d=E[m],d==null)continue;g.push(m)}let P;if(!Array.isArray(d)){var y,C;De(d)||X(!1,`Invalid AST Node: ${me(d)}.`);const w=k?(y=r.get(d.kind))===null||y===void 0?void 0:y.leave:(C=r.get(d.kind))===null||C===void 0?void 0:C.enter;if(P=w==null?void 0:w.call(t,d,m,E,g,N),P===kt)break;if(P===!1){if(!k){g.pop();continue}}else if(P!==void 0&&(p.push([m,P]),!k))if(De(P))d=P;else{g.pop();continue}}if(P===void 0&&oe&&p.push([m,d]),k)g.pop();else{var D;i={inArray:s,index:u,keys:a,edits:p,prev:i},s=Array.isArray(d),a=s?d:(D=n[d.kind])!==null&&D!==void 0?D:[],u=-1,p=[],E&&N.push(E),E=d}}while(i!==void 0);return p.length!==0?p[p.length-1][1]:e}function St(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function wt(e){return Rt(e,Lt)}const Pt=80,Lt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>h(e.definitions,`
|
|
22
|
+
spurious results.`)}}return!1};class Le{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||X(!1,`Body must be a string. Received: ${me(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||X(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||X(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function xt(e){return Nt(e,Le)}function Fe(e,t){return new bt(e,t).parseDocument()}class bt{constructor(t,n={}){const r=xt(t)?t:new Le(t);this._lexer=new ot(r),this._options=n,this._tokenCounter=0}parseName(){const t=this.expectToken(c.NAME);return this.node(t,{kind:f.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:f.DOCUMENT,definitions:this.many(c.SOF,this.parseDefinition,c.EOF)})}parseDefinition(){if(this.peek(c.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===c.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()}if(t)throw b(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(c.BRACE_L))return this.node(t,{kind:f.OPERATION_DEFINITION,operation:q.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let r;return this.peek(c.NAME)&&(r=this.parseName()),this.node(t,{kind:f.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(c.NAME);switch(t.value){case"query":return q.QUERY;case"mutation":return q.MUTATION;case"subscription":return q.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(c.PAREN_L,this.parseVariableDefinition,c.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:f.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(c.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(c.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(c.DOLLAR),this.node(t,{kind:f.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:f.SELECTION_SET,selections:this.many(c.BRACE_L,this.parseSelection,c.BRACE_R)})}parseSelection(){return this.peek(c.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let r,i;return this.expectOptionalToken(c.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:f.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(c.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(c.PAREN_L,n,c.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,r=this.parseName();return this.expectToken(c.COLON),this.node(n,{kind:f.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(c.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(c.NAME)?this.node(t,{kind:f.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:f.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:f.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:f.FRAGMENT_DEFINITION,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){const n=this._lexer.token;switch(n.kind){case c.BRACKET_L:return this.parseList(t);case c.BRACE_L:return this.parseObject(t);case c.INT:return this.advanceLexer(),this.node(n,{kind:f.INT,value:n.value});case c.FLOAT:return this.advanceLexer(),this.node(n,{kind:f.FLOAT,value:n.value});case c.STRING:case c.BLOCK_STRING:return this.parseStringLiteral();case c.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:f.BOOLEAN,value:!0});case"false":return this.node(n,{kind:f.BOOLEAN,value:!1});case"null":return this.node(n,{kind:f.NULL});default:return this.node(n,{kind:f.ENUM,value:n.value})}case c.DOLLAR:if(t)if(this.expectToken(c.DOLLAR),this._lexer.token.kind===c.NAME){const r=this._lexer.token.value;throw b(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:f.STRING,value:t.value,block:t.kind===c.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:f.LIST,values:this.any(c.BRACKET_L,n,c.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:f.OBJECT,fields:this.any(c.BRACE_L,n,c.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,r=this.parseName();return this.expectToken(c.COLON),this.node(n,{kind:f.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(c.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(c.AT),this.node(n,{kind:f.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(c.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(c.BRACKET_R),n=this.node(t,{kind:f.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(c.BANG)?this.node(t,{kind:f.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:f.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(c.STRING)||this.peek(c.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(c.BRACE_L,this.parseOperationTypeDefinition,c.BRACE_R);return this.node(t,{kind:f.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(c.COLON);const r=this.parseNamedType();return this.node(t,{kind:f.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:f.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:f.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(c.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(c.BRACE_L,this.parseFieldDefinition,c.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(c.COLON);const s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:f.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(c.PAREN_L,this.parseInputValueDef,c.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(c.COLON);const i=this.parseTypeReference();let s;this.expectOptionalToken(c.EQUALS)&&(s=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(t,{kind:f.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:f.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:f.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(c.EQUALS)?this.delimitedMany(c.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:f.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(c.BRACE_L,this.parseEnumValueDefinition,c.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:f.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw b(this._lexer.source,this._lexer.token.start,`${K(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(c.BRACE_L,this.parseInputValueDef,c.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===c.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(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),r=this.optionalMany(c.BRACE_L,this.parseOperationTypeDefinition,c.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:f.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:f.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:f.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(c.AT);const r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(t,{kind:f.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(c.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(pe,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new et(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw b(this._lexer.source,n.start,`Expected ${Be(t)}, found ${K(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===c.NAME&&n.value===t)this.advanceLexer();else throw b(this._lexer.source,n.start,`Expected "${t}", found ${K(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===c.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return b(this._lexer.source,n.start,`Unexpected ${K(n)}.`)}any(t,n,r){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);const r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(t!==void 0&&n.kind!==c.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw b(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function K(e){const t=e.value;return Be(e.kind)+(t!=null?` "${t}"`:"")}function Be(e){return at(e)?`"${e}"`:e}function It(e){return`"${e.replace(Ot,Dt)}"`}const Ot=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Dt(e){return _t[e.charCodeAt(0)]}const _t=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],kt=Object.freeze({});function Rt(e,t,n=Oe){const r=new Map;for(const k of Object.values(f))r.set(k,St(t,k));let i,s=Array.isArray(e),a=[e],u=-1,p=[],d=e,m,E;const g=[],A=[];do{u++;const k=u===a.length,oe=k&&p.length!==0;if(k){if(m=A.length===0?void 0:g[g.length-1],d=E,E=A.pop(),oe)if(s){d=d.slice();let w=0;for(const[G,ae]of p){const ce=G-w;ae===null?(d.splice(ce,1),w++):d[ce]=ae}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[w,G]of p)d[w]=G}u=i.index,a=i.keys,p=i.edits,s=i.inArray,i=i.prev}else if(E){if(m=s?u:a[u],d=E[m],d==null)continue;g.push(m)}let P;if(!Array.isArray(d)){var y,N;De(d)||X(!1,`Invalid AST Node: ${me(d)}.`);const w=k?(y=r.get(d.kind))===null||y===void 0?void 0:y.leave:(N=r.get(d.kind))===null||N===void 0?void 0:N.enter;if(P=w==null?void 0:w.call(t,d,m,E,g,A),P===kt)break;if(P===!1){if(!k){g.pop();continue}}else if(P!==void 0&&(p.push([m,P]),!k))if(De(P))d=P;else{g.pop();continue}}if(P===void 0&&oe&&p.push([m,d]),k)g.pop();else{var D;i={inArray:s,index:u,keys:a,edits:p,prev:i},s=Array.isArray(d),a=s?d:(D=n[d.kind])!==null&&D!==void 0?D:[],u=-1,p=[],E&&A.push(E),E=d}}while(i!==void 0);return p.length!==0?p[p.length-1][1]:e}function St(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function wt(e){return Rt(e,Lt)}const Pt=80,Lt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>h(e.definitions,`
|
|
23
23
|
|
|
24
24
|
`)},OperationDefinition:{leave(e){const t=v("(",h(e.variableDefinitions,", "),")"),n=h([e.operation,h([e.name,t]),h(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+v(" = ",n)+v(" ",h(r," "))},SelectionSet:{leave:({selections:e})=>S(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const s=v("",e,": ")+t;let a=s+v("(",h(n,", "),")");return a.length>Pt&&(a=s+v(`(
|
|
25
25
|
`,ee(h(n,`
|
|
@@ -28,7 +28,7 @@ spurious results.`)}}return!1};class Le{constructor(t,n="GraphQL request",r={lin
|
|
|
28
28
|
`)+h(["schema",h(t," "),S(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
|
|
29
29
|
`)+h(["scalar",t,h(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>v("",e,`
|
|
30
30
|
`)+h(["type",t,v("implements ",h(n," & ")),h(r," "),S(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>v("",e,`
|
|
31
|
-
`)+t+(
|
|
31
|
+
`)+t+(Me(n)?v(`(
|
|
32
32
|
`,ee(h(n,`
|
|
33
33
|
`)),`
|
|
34
34
|
)`):v("(",h(n,", "),")"))+": "+r+v(" ",h(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>v("",e,`
|
|
@@ -38,15 +38,15 @@ spurious results.`)}}return!1};class Le{constructor(t,n="GraphQL request",r={lin
|
|
|
38
38
|
`)+h(["enum",t,h(n," "),S(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>v("",e,`
|
|
39
39
|
`)+h([t,h(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>v("",e,`
|
|
40
40
|
`)+h(["input",t,h(n," "),S(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>v("",e,`
|
|
41
|
-
`)+"directive @"+t+(
|
|
41
|
+
`)+"directive @"+t+(Me(n)?v(`(
|
|
42
42
|
`,ee(h(n,`
|
|
43
43
|
`)),`
|
|
44
44
|
)`):v("(",h(n,", "),")"))+(r?" repeatable":"")+" on "+h(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>h(["extend schema",h(e," "),S(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>h(["extend scalar",e,h(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>h(["extend type",e,v("implements ",h(t," & ")),h(n," "),S(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>h(["extend interface",e,v("implements ",h(t," & ")),h(n," "),S(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>h(["extend union",e,h(t," "),v("= ",h(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>h(["extend enum",e,h(t," "),S(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>h(["extend input",e,h(t," "),S(n)]," ")}};function h(e,t=""){var n;return(n=e==null?void 0:e.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function S(e){return v(`{
|
|
45
45
|
`,ee(h(e,`
|
|
46
46
|
`)),`
|
|
47
47
|
}`)}function v(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function ee(e){return v(" ",e.replace(/\n/g,`
|
|
48
|
-
`))}function
|
|
49
|
-
`)))!==null&&t!==void 0?t:!1}const Me=e=>{var r,i;let t;const n=e.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(t=(i=(r=n[0])==null?void 0:r.name)==null?void 0:i.value),t},ye=e=>{if(typeof e=="string"){let n;try{const r=Fe(e);n=Me(r)}catch{}return{query:e,operationName:n}}const t=Me(e);return{query:wt(e),operationName:t}};class z extends Error{constructor(t,n){const r=`${z.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,z.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}static extractMessage(t){var n,r;return((r=(n=t.errors)==null?void 0:n[0])==null?void 0:r.message)??`GraphQL Error (Code: ${t.status})`}}var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}};(function(e,t){var n=typeof self<"u"?self:Ft,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(a){var u={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function p(o){return o&&DataView.prototype.isPrototypeOf(o)}if(u.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(o){return o&&d.indexOf(Object.prototype.toString.call(o))>-1};function E(o){if(typeof o!="string"&&(o=String(o)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(o))throw new TypeError("Invalid character in header field name");return o.toLowerCase()}function g(o){return typeof o!="string"&&(o=String(o)),o}function N(o){var l={next:function(){var T=o.shift();return{done:T===void 0,value:T}}};return u.iterable&&(l[Symbol.iterator]=function(){return l}),l}function y(o){this.map={},o instanceof y?o.forEach(function(l,T){this.append(T,l)},this):Array.isArray(o)?o.forEach(function(l){this.append(l[0],l[1])},this):o&&Object.getOwnPropertyNames(o).forEach(function(l){this.append(l,o[l])},this)}y.prototype.append=function(o,l){o=E(o),l=g(l);var T=this.map[o];this.map[o]=T?T+", "+l:l},y.prototype.delete=function(o){delete this.map[E(o)]},y.prototype.get=function(o){return o=E(o),this.has(o)?this.map[o]:null},y.prototype.has=function(o){return this.map.hasOwnProperty(E(o))},y.prototype.set=function(o,l){this.map[E(o)]=g(l)},y.prototype.forEach=function(o,l){for(var T in this.map)this.map.hasOwnProperty(T)&&o.call(l,this.map[T],T,this)},y.prototype.keys=function(){var o=[];return this.forEach(function(l,T){o.push(T)}),N(o)},y.prototype.values=function(){var o=[];return this.forEach(function(l){o.push(l)}),N(o)},y.prototype.entries=function(){var o=[];return this.forEach(function(l,T){o.push([T,l])}),N(o)},u.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function C(o){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}function D(o){return new Promise(function(l,T){o.onload=function(){l(o.result)},o.onerror=function(){T(o.error)}})}function k(o){var l=new FileReader,T=D(l);return l.readAsArrayBuffer(o),T}function oe(o){var l=new FileReader,T=D(l);return l.readAsText(o),T}function P(o){for(var l=new Uint8Array(o),T=new Array(l.length),O=0;O<l.length;O++)T[O]=String.fromCharCode(l[O]);return T.join("")}function w(o){if(o.slice)return o.slice(0);var l=new Uint8Array(o.byteLength);return l.set(new Uint8Array(o)),l.buffer}function G(){return this.bodyUsed=!1,this._initBody=function(o){this._bodyInit=o,o?typeof o=="string"?this._bodyText=o:u.blob&&Blob.prototype.isPrototypeOf(o)?this._bodyBlob=o:u.formData&&FormData.prototype.isPrototypeOf(o)?this._bodyFormData=o:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)?this._bodyText=o.toString():u.arrayBuffer&&u.blob&&p(o)?(this._bodyArrayBuffer=w(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||m(o))?this._bodyArrayBuffer=w(o):this._bodyText=o=Object.prototype.toString.call(o):this._bodyText="",this.headers.get("content-type")||(typeof o=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var o=C(this);if(o)return o;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?C(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(k)}),this.text=function(){var o=C(this);if(o)return o;if(this._bodyBlob)return oe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(ln)}),this.json=function(){return this.text().then(JSON.parse)},this}var ae=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ce(o){var l=o.toUpperCase();return ae.indexOf(l)>-1?l:o}function M(o,l){l=l||{};var T=l.body;if(o instanceof M){if(o.bodyUsed)throw new TypeError("Already read");this.url=o.url,this.credentials=o.credentials,l.headers||(this.headers=new y(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!T&&o._bodyInit!=null&&(T=o._bodyInit,o.bodyUsed=!0)}else this.url=String(o);if(this.credentials=l.credentials||this.credentials||"same-origin",(l.headers||!this.headers)&&(this.headers=new y(l.headers)),this.method=ce(l.method||this.method||"GET"),this.mode=l.mode||this.mode||null,this.signal=l.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&T)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(T)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function ln(o){var l=new FormData;return o.trim().split("&").forEach(function(T){if(T){var O=T.split("="),I=O.shift().replace(/\+/g," "),A=O.join("=").replace(/\+/g," ");l.append(decodeURIComponent(I),decodeURIComponent(A))}}),l}function hn(o){var l=new y,T=o.replace(/\r?\n[\t ]+/g," ");return T.split(/\r?\n/).forEach(function(O){var I=O.split(":"),A=I.shift().trim();if(A){var ue=I.join(":").trim();l.append(A,ue)}}),l}G.call(M.prototype);function L(o,l){l||(l={}),this.type="default",this.status=l.status===void 0?200:l.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in l?l.statusText:"OK",this.headers=new y(l.headers),this.url=l.url||"",this._initBody(o)}G.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},L.error=function(){var o=new L(null,{status:0,statusText:""});return o.type="error",o};var pn=[301,302,303,307,308];L.redirect=function(o,l){if(pn.indexOf(l)===-1)throw new RangeError("Invalid status code");return new L(null,{status:l,headers:{location:o}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(l,T){this.message=l,this.name=T;var O=Error(l);this.stack=O.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function Ae(o,l){return new Promise(function(T,O){var I=new M(o,l);if(I.signal&&I.signal.aborted)return O(new a.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function ue(){A.abort()}A.onload=function(){var J={status:A.status,statusText:A.statusText,headers:hn(A.getAllResponseHeaders()||"")};J.url="responseURL"in A?A.responseURL:J.headers.get("X-Request-URL");var Ne="response"in A?A.response:A.responseText;T(new L(Ne,J))},A.onerror=function(){O(new TypeError("Network request failed"))},A.ontimeout=function(){O(new TypeError("Network request failed"))},A.onabort=function(){O(new a.DOMException("Aborted","AbortError"))},A.open(I.method,I.url,!0),I.credentials==="include"?A.withCredentials=!0:I.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&u.blob&&(A.responseType="blob"),I.headers.forEach(function(J,Ne){A.setRequestHeader(Ne,J)}),I.signal&&(I.signal.addEventListener("abort",ue),A.onreadystatechange=function(){A.readyState===4&&I.signal.removeEventListener("abort",ue)}),A.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return Ae.polyfill=!0,s.fetch||(s.fetch=Ae,s.Headers=y,s.Request=M,s.Response=L),a.Headers=y,a.Request=M,a.Response=L,a.fetch=Ae,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t})(Ee,Ee.exports);var te=Ee.exports;const ne=Bt(te),Ut=_({__proto__:null,default:ne},[te]),j=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Ut&&te.Headers&&e instanceof te.Headers?t=He(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},qe=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Mt=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(qe(r.query))}`];return e.variables&&i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&i.push(`operationName=${encodeURIComponent(r.operationName)}`),i.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((r,i,s)=>(r.push({query:qe(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},qt=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:a,fetchOptions:u,middleware:p}=t,d={...t.headers};let m="",E;e==="POST"?(E=jt(r,i,s,u.jsonSerializer),typeof E=="string"&&(d["Content-Type"]="application/json")):m=Mt({query:r,variables:i,operationName:s,jsonSerializer:u.jsonSerializer??F});const g={method:e,headers:d,body:E,...u};let N=n,y=g;if(p){const C=await Promise.resolve(p({...g,url:n,operationName:s,variables:i})),{url:D,...k}=C;N=D,y=k}return m&&(N=`${N}?${m}`),await a(N,y)};class Vt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,a]=r,u=ze(i,s,a),{headers:p,fetch:d=ne,method:m="POST",requestMiddleware:E,responseMiddleware:g,...N}=this.requestConfig,{url:y}=this;u.signal!==void 0&&(N.signal=u.signal);const{operationName:C}=ye(u.query);return ge({url:y,query:u.query,variables:u.variables,headers:{...j(Te(p)),...j(u.requestHeaders)},operationName:C,fetch:d,method:m,fetchOptions:N,middleware:E}).then(D=>(g&&g(D),D)).catch(D=>{throw g&&g(D),D})}}async request(t,...n){const[r,i]=n,s=Ye(t,r,i),{headers:a,fetch:u=ne,method:p="POST",requestMiddleware:d,responseMiddleware:m,...E}=this.requestConfig,{url:g}=this;s.signal!==void 0&&(E.signal=s.signal);const{query:N,operationName:y}=ye(s.document);return ge({url:g,query:N,variables:s.variables,headers:{...j(Te(a)),...j(s.requestHeaders)},operationName:y,fetch:u,method:p,fetchOptions:E,middleware:d}).then(C=>(m&&m(C),C.data)).catch(C=>{throw m&&m(C),C})}batchRequests(t,n){const r=Qe(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const a=r.documents.map(({document:p})=>ye(p).query),u=r.documents.map(({variables:p})=>p);return ge({url:this.url,query:a,variables:u,headers:{...j(Te(i)),...j(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ne,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(p=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(p),p.data)).catch(p=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(p),p})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const ge=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=qt(Ge(e.method??"post")),s=Array.isArray(e.query),a=await i(e),u=await $t(a,r.jsonSerializer??F),p=Array.isArray(u)?!u.some(({data:m})=>!m):!!u.data,d=Array.isArray(u)||!u.errors||Array.isArray(u.errors)&&!u.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(a.ok&&d&&p){const{errors:m,...E}=(Array.isArray(u),u),g=r.errorPolicy==="ignore"?E:u;return{...s?{data:g}:g,headers:a.headers,status:a.status}}else{const m=typeof u=="string"?{error:u}:u;throw new z({...m,status:a.status,headers:a.headers},{query:t,variables:n})}},jt=(e,t,n,r)=>{const i=r??F;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce((a,u,p)=>(a.push({query:u,variables:t?t[p]:void 0}),a),[]);return i.stringify(s)},$t=async(e,t)=>{let n;return e.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Te=e=>typeof e=="function"?e():e;var ie=function(){return ie=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ie.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var re=new Map,ve=new Map,Ve=!0,se=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function Gt(e){return je(e.source.body.substring(e.start,e.end))}function Ht(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=Gt(r.loc),a=ve.get(i);a&&!a.has(s)?Ve&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
48
|
+
`))}function Me(e){var t;return(t=e==null?void 0:e.some(n=>n.includes(`
|
|
49
|
+
`)))!==null&&t!==void 0?t:!1}const Ue=e=>{var r,i;let t;const n=e.definitions.filter(s=>s.kind==="OperationDefinition");return n.length===1&&(t=(i=(r=n[0])==null?void 0:r.name)==null?void 0:i.value),t},ye=e=>{if(typeof e=="string"){let n;try{const r=Fe(e);n=Ue(r)}catch{}return{query:e,operationName:n}}const t=Ue(e);return{query:wt(e),operationName:t}};class z extends Error{constructor(t,n){const r=`${z.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,z.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}static extractMessage(t){var n,r;return((r=(n=t.errors)==null?void 0:n[0])==null?void 0:r.message)??`GraphQL Error (Code: ${t.status})`}}var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}};(function(e,t){var n=typeof self<"u"?self:Ft,r=function(){function s(){this.fetch=!1,this.DOMException=n.DOMException}return s.prototype=n,new s}();(function(s){(function(a){var u={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function p(o){return o&&DataView.prototype.isPrototypeOf(o)}if(u.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(o){return o&&d.indexOf(Object.prototype.toString.call(o))>-1};function E(o){if(typeof o!="string"&&(o=String(o)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(o))throw new TypeError("Invalid character in header field name");return o.toLowerCase()}function g(o){return typeof o!="string"&&(o=String(o)),o}function A(o){var l={next:function(){var T=o.shift();return{done:T===void 0,value:T}}};return u.iterable&&(l[Symbol.iterator]=function(){return l}),l}function y(o){this.map={},o instanceof y?o.forEach(function(l,T){this.append(T,l)},this):Array.isArray(o)?o.forEach(function(l){this.append(l[0],l[1])},this):o&&Object.getOwnPropertyNames(o).forEach(function(l){this.append(l,o[l])},this)}y.prototype.append=function(o,l){o=E(o),l=g(l);var T=this.map[o];this.map[o]=T?T+", "+l:l},y.prototype.delete=function(o){delete this.map[E(o)]},y.prototype.get=function(o){return o=E(o),this.has(o)?this.map[o]:null},y.prototype.has=function(o){return this.map.hasOwnProperty(E(o))},y.prototype.set=function(o,l){this.map[E(o)]=g(l)},y.prototype.forEach=function(o,l){for(var T in this.map)this.map.hasOwnProperty(T)&&o.call(l,this.map[T],T,this)},y.prototype.keys=function(){var o=[];return this.forEach(function(l,T){o.push(T)}),A(o)},y.prototype.values=function(){var o=[];return this.forEach(function(l){o.push(l)}),A(o)},y.prototype.entries=function(){var o=[];return this.forEach(function(l,T){o.push([T,l])}),A(o)},u.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function N(o){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}function D(o){return new Promise(function(l,T){o.onload=function(){l(o.result)},o.onerror=function(){T(o.error)}})}function k(o){var l=new FileReader,T=D(l);return l.readAsArrayBuffer(o),T}function oe(o){var l=new FileReader,T=D(l);return l.readAsText(o),T}function P(o){for(var l=new Uint8Array(o),T=new Array(l.length),O=0;O<l.length;O++)T[O]=String.fromCharCode(l[O]);return T.join("")}function w(o){if(o.slice)return o.slice(0);var l=new Uint8Array(o.byteLength);return l.set(new Uint8Array(o)),l.buffer}function G(){return this.bodyUsed=!1,this._initBody=function(o){this._bodyInit=o,o?typeof o=="string"?this._bodyText=o:u.blob&&Blob.prototype.isPrototypeOf(o)?this._bodyBlob=o:u.formData&&FormData.prototype.isPrototypeOf(o)?this._bodyFormData=o:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)?this._bodyText=o.toString():u.arrayBuffer&&u.blob&&p(o)?(this._bodyArrayBuffer=w(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||m(o))?this._bodyArrayBuffer=w(o):this._bodyText=o=Object.prototype.toString.call(o):this._bodyText="",this.headers.get("content-type")||(typeof o=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var o=N(this);if(o)return o;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?N(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(k)}),this.text=function(){var o=N(this);if(o)return o;if(this._bodyBlob)return oe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(P(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(ln)}),this.json=function(){return this.text().then(JSON.parse)},this}var ae=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ce(o){var l=o.toUpperCase();return ae.indexOf(l)>-1?l:o}function U(o,l){l=l||{};var T=l.body;if(o instanceof U){if(o.bodyUsed)throw new TypeError("Already read");this.url=o.url,this.credentials=o.credentials,l.headers||(this.headers=new y(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!T&&o._bodyInit!=null&&(T=o._bodyInit,o.bodyUsed=!0)}else this.url=String(o);if(this.credentials=l.credentials||this.credentials||"same-origin",(l.headers||!this.headers)&&(this.headers=new y(l.headers)),this.method=ce(l.method||this.method||"GET"),this.mode=l.mode||this.mode||null,this.signal=l.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&T)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(T)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ln(o){var l=new FormData;return o.trim().split("&").forEach(function(T){if(T){var O=T.split("="),I=O.shift().replace(/\+/g," "),C=O.join("=").replace(/\+/g," ");l.append(decodeURIComponent(I),decodeURIComponent(C))}}),l}function hn(o){var l=new y,T=o.replace(/\r?\n[\t ]+/g," ");return T.split(/\r?\n/).forEach(function(O){var I=O.split(":"),C=I.shift().trim();if(C){var ue=I.join(":").trim();l.append(C,ue)}}),l}G.call(U.prototype);function L(o,l){l||(l={}),this.type="default",this.status=l.status===void 0?200:l.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in l?l.statusText:"OK",this.headers=new y(l.headers),this.url=l.url||"",this._initBody(o)}G.call(L.prototype),L.prototype.clone=function(){return new L(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},L.error=function(){var o=new L(null,{status:0,statusText:""});return o.type="error",o};var pn=[301,302,303,307,308];L.redirect=function(o,l){if(pn.indexOf(l)===-1)throw new RangeError("Invalid status code");return new L(null,{status:l,headers:{location:o}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(l,T){this.message=l,this.name=T;var O=Error(l);this.stack=O.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function Ce(o,l){return new Promise(function(T,O){var I=new U(o,l);if(I.signal&&I.signal.aborted)return O(new a.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function ue(){C.abort()}C.onload=function(){var J={status:C.status,statusText:C.statusText,headers:hn(C.getAllResponseHeaders()||"")};J.url="responseURL"in C?C.responseURL:J.headers.get("X-Request-URL");var Ae="response"in C?C.response:C.responseText;T(new L(Ae,J))},C.onerror=function(){O(new TypeError("Network request failed"))},C.ontimeout=function(){O(new TypeError("Network request failed"))},C.onabort=function(){O(new a.DOMException("Aborted","AbortError"))},C.open(I.method,I.url,!0),I.credentials==="include"?C.withCredentials=!0:I.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&u.blob&&(C.responseType="blob"),I.headers.forEach(function(J,Ae){C.setRequestHeader(Ae,J)}),I.signal&&(I.signal.addEventListener("abort",ue),C.onreadystatechange=function(){C.readyState===4&&I.signal.removeEventListener("abort",ue)}),C.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return Ce.polyfill=!0,s.fetch||(s.fetch=Ce,s.Headers=y,s.Request=U,s.Response=L),a.Headers=y,a.Request=U,a.Response=L,a.fetch=Ce,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t})(Ee,Ee.exports);var te=Ee.exports;const ne=Bt(te),Mt=_({__proto__:null,default:ne},[te]),j=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||Mt&&te.Headers&&e instanceof te.Headers?t=He(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},qe=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Ut=e=>{if(!Array.isArray(e.query)){const r=e,i=[`query=${encodeURIComponent(qe(r.query))}`];return e.variables&&i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&i.push(`operationName=${encodeURIComponent(r.operationName)}`),i.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((r,i,s)=>(r.push({query:qe(i),variables:t.variables?t.jsonSerializer.stringify(t.variables[s]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},qt=e=>async t=>{const{url:n,query:r,variables:i,operationName:s,fetch:a,fetchOptions:u,middleware:p}=t,d={...t.headers};let m="",E;e==="POST"?(E=jt(r,i,s,u.jsonSerializer),typeof E=="string"&&(d["Content-Type"]="application/json")):m=Ut({query:r,variables:i,operationName:s,jsonSerializer:u.jsonSerializer??F});const g={method:e,headers:d,body:E,...u};let A=n,y=g;if(p){const N=await Promise.resolve(p({...g,url:n,operationName:s,variables:i})),{url:D,...k}=N;A=D,y=k}return m&&(A=`${A}?${m}`),await a(A,y)};class Vt{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[i,s,a]=r,u=ze(i,s,a),{headers:p,fetch:d=ne,method:m="POST",requestMiddleware:E,responseMiddleware:g,...A}=this.requestConfig,{url:y}=this;u.signal!==void 0&&(A.signal=u.signal);const{operationName:N}=ye(u.query);return ge({url:y,query:u.query,variables:u.variables,headers:{...j(Te(p)),...j(u.requestHeaders)},operationName:N,fetch:d,method:m,fetchOptions:A,middleware:E}).then(D=>(g&&g(D),D)).catch(D=>{throw g&&g(D),D})}}async request(t,...n){const[r,i]=n,s=Ye(t,r,i),{headers:a,fetch:u=ne,method:p="POST",requestMiddleware:d,responseMiddleware:m,...E}=this.requestConfig,{url:g}=this;s.signal!==void 0&&(E.signal=s.signal);const{query:A,operationName:y}=ye(s.document);return ge({url:g,query:A,variables:s.variables,headers:{...j(Te(a)),...j(s.requestHeaders)},operationName:y,fetch:u,method:p,fetchOptions:E,middleware:d}).then(N=>(m&&m(N),N.data)).catch(N=>{throw m&&m(N),N})}batchRequests(t,n){const r=Qe(t,n),{headers:i,...s}=this.requestConfig;r.signal!==void 0&&(s.signal=r.signal);const a=r.documents.map(({document:p})=>ye(p).query),u=r.documents.map(({variables:p})=>p);return ge({url:this.url,query:a,variables:u,headers:{...j(Te(i)),...j(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??ne,method:this.requestConfig.method||"POST",fetchOptions:s,middleware:this.requestConfig.requestMiddleware}).then(p=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(p),p.data)).catch(p=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(p),p})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const ge=async e=>{const{query:t,variables:n,fetchOptions:r}=e,i=qt(Ge(e.method??"post")),s=Array.isArray(e.query),a=await i(e),u=await $t(a,r.jsonSerializer??F),p=Array.isArray(u)?!u.some(({data:m})=>!m):!!u.data,d=Array.isArray(u)||!u.errors||Array.isArray(u.errors)&&!u.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(a.ok&&d&&p){const{errors:m,...E}=(Array.isArray(u),u),g=r.errorPolicy==="ignore"?E:u;return{...s?{data:g}:g,headers:a.headers,status:a.status}}else{const m=typeof u=="string"?{error:u}:u;throw new z({...m,status:a.status,headers:a.headers},{query:t,variables:n})}},jt=(e,t,n,r)=>{const i=r??F;if(!Array.isArray(e))return i.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const s=e.reduce((a,u,p)=>(a.push({query:u,variables:t?t[p]:void 0}),a),[]);return i.stringify(s)},$t=async(e,t)=>{let n;return e.headers.forEach((r,i)=>{i.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},Te=e=>typeof e=="function"?e():e;var ie=function(){return ie=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ie.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var re=new Map,ve=new Map,Ve=!0,se=!1;function je(e){return e.replace(/[\s,]+/g," ").trim()}function Gt(e){return je(e.source.body.substring(e.start,e.end))}function Ht(e){var t=new Set,n=[];return e.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var i=r.name.value,s=Gt(r.loc),a=ve.get(i);a&&!a.has(s)?Ve&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
50
50
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
51
51
|
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||ve.set(i,a=new Set),a.add(s),t.has(s)||(t.add(s),n.push(r))}else n.push(r)}),ie(ie({},e),{definitions:n})}function Yt(e){var t=new Set(e.definitions);t.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(i){var s=r[i];s&&typeof s=="object"&&t.add(s)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}function zt(e){var t=je(e);if(!re.has(t)){var n=Fe(e,{experimentalFragmentVariables:se,allowLegacyFragmentVariables:se});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");re.set(t,Yt(Ht(n)))}return re.get(t)}function $(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];typeof e=="string"&&(e=[e]);var r=e[0];return t.forEach(function(i,s){i&&i.kind==="Document"?r+=i.loc.source.body:r+=i,r+=e[s+1]}),zt(r)}function Qt(){re.clear(),ve.clear()}function Jt(){Ve=!1}function Xt(){se=!0}function Wt(){se=!1}var Q={gql:$,resetCaches:Qt,disableFragmentWarnings:Jt,enableExperimentalFragmentVariables:Xt,disableExperimentalFragmentVariables:Wt};(function(e){e.gql=Q.gql,e.resetCaches=Q.resetCaches,e.disableFragmentWarnings=Q.disableFragmentWarnings,e.enableExperimentalFragmentVariables=Q.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=Q.disableExperimentalFragmentVariables})($||($={})),$.default=$;const B=$,Zt=B`
|
|
52
52
|
query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
|
|
@@ -193,7 +193,16 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a
|
|
|
193
193
|
earnedPoint
|
|
194
194
|
purchasePrice
|
|
195
195
|
}
|
|
196
|
+
pointMultiplier {
|
|
197
|
+
id
|
|
198
|
+
customerRankRule {
|
|
199
|
+
id
|
|
200
|
+
name
|
|
201
|
+
threshold
|
|
202
|
+
}
|
|
203
|
+
multiplier
|
|
204
|
+
}
|
|
196
205
|
}
|
|
197
206
|
}
|
|
198
207
|
}
|
|
199
|
-
`,an=(e,t,n,r)=>e();function cn(e,t=an){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerPointChangeActivities(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r){return t(i=>e.request(on,n,{...r,...i}),"GetPurchasingCustomerRank","query",n)}}}class un{constructor(t){$e(this,"api");this.api=cn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(a=>({location:{name:a.location.name},inventoryQuantity:a.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{name:r.locationAvailability.location.name},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,r){const i=await this.api.GetLocations({first:t,after:n,isReverse:r});return{nodes:i.locations.nodes.map(s=>({id:s.id,name:s.name}))??[],pageInfo:i.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,r){const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return i.purchasingCustomer?{id:i.purchasingCustomer.id,nodes:i.purchasingCustomer.discounts.nodes.map(s=>({id:s.id,title:s.title,description:s.description,code:s.code,createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:i.purchasingCustomer.discounts.pageInfo??null}:null}async getPointChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(a=>({id:a.id,title:a.title,pointChange:{id:a.pointChange.id,delta:a.pointChange.delta,availableAt:a.pointChange.availableAt?new Date(a.pointChange.availableAt):void 0,availableUntil:a.pointChange.availableUntil?new Date(a.pointChange.availableUntil):void 0,expiresDate:a.pointChange.expiresDate?new Date(a.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(a.pointChange.pointChangeCreatedAt),createdAt:new Date(a.pointChange.createdAt)}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold}:null}}R.SDK=un,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|
|
208
|
+
`,an=(e,t,n,r)=>e();function cn(e,t=an){return{GetLocationAvailabilities(n,r){return t(i=>e.request(Zt,n,{...r,...i}),"GetLocationAvailabilities","query",n)},GetLocationAvailability(n,r){return t(i=>e.request(Kt,n,{...r,...i}),"GetLocationAvailability","query",n)},GetPurchasingCustomerMetafield(n,r){return t(i=>e.request(en,n,{...r,...i}),"GetPurchasingCustomerMetafield","query",n)},GetPoints(n,r){return t(i=>e.request(tn,n,{...r,...i}),"GetPoints","query",n)},GetLocations(n,r){return t(i=>e.request(nn,n,{...r,...i}),"GetLocations","query",n)},GetPurchasingCustomerDiscounts(n,r){return t(i=>e.request(rn,n,{...r,...i}),"GetPurchasingCustomerDiscounts","query",n)},GetPurchasingCustomerPointChangeActivities(n,r){return t(i=>e.request(sn,n,{...r,...i}),"GetPurchasingCustomerPointChangeActivities","query",n)},GetPurchasingCustomerRank(n,r){return t(i=>e.request(on,n,{...r,...i}),"GetPurchasingCustomerRank","query",n)}}}class un{constructor(t){$e(this,"api");this.api=cn(new Vt(`${t}/apps/sq-api`,{headers:{"X-SQ-CLIENT":"ShopifyAppProxy"}}))}async getLocationAvailabilities(t,n,r,i){const s=await this.api.GetLocationAvailabilities({sku:t,first:n,after:r,isReverse:i});return{nodes:s.locationAvailabilities.nodes.map(a=>({location:{name:a.location.name},inventoryQuantity:a.inventoryQuantity}))??[],pageInfo:s.locationAvailabilities.pageInfo??null}}async getLocationAvailability(t,n){const r=await this.api.GetLocationAvailability({sku:t,locationID:n});return{location:{name:r.locationAvailability.location.name},inventoryQuantity:r.locationAvailability.inventoryQuantity}}async getPurchasingCustomerMetafield(t,n){return(await this.api.GetPurchasingCustomerMetafield({namespace:t,key:n})).purchasingCustomerMetafield??null}async getPoints(){const t=await this.api.GetPoints();return t.purchasingCustomer?{pointsApproved:t.purchasingCustomer.pointsApproved,pointsPending:t.purchasingCustomer.pointsPending}:null}async getLocations(t,n,r){const i=await this.api.GetLocations({first:t,after:n,isReverse:r});return{nodes:i.locations.nodes.map(s=>({id:s.id,name:s.name}))??[],pageInfo:i.locations.pageInfo??null}}async getPurchasingCustomerDiscounts(t,n,r){const i=await this.api.GetPurchasingCustomerDiscounts({first:t,after:n,isReverse:r});return i.purchasingCustomer?{id:i.purchasingCustomer.id,nodes:i.purchasingCustomer.discounts.nodes.map(s=>({id:s.id,title:s.title,description:s.description,code:s.code,createdAt:new Date(s.createdAt),updatedAt:new Date(s.updatedAt)}))??[],pageInfo:i.purchasingCustomer.discounts.pageInfo??null}:null}async getPointChangeActivities(t,n,r,i){const s=await this.api.GetPurchasingCustomerPointChangeActivities({first:t,after:n,isReverse:r,sortKeys:i});return s.purchasingCustomer?{nodes:s.purchasingCustomer.pointChangeActivities.nodes.map(a=>({id:a.id,title:a.title,pointChange:{id:a.pointChange.id,delta:a.pointChange.delta,availableAt:a.pointChange.availableAt?new Date(a.pointChange.availableAt):void 0,availableUntil:a.pointChange.availableUntil?new Date(a.pointChange.availableUntil):void 0,expiresDate:a.pointChange.expiresDate?new Date(a.pointChange.expiresDate):void 0,pointChangeCreatedAt:new Date(a.pointChange.pointChangeCreatedAt),createdAt:new Date(a.pointChange.createdAt)}})),pageInfo:s.purchasingCustomer.pointChangeActivities.pageInfo}:null}async getPurchasingCustomerCurrentRank(){var n;const t=await this.api.GetPurchasingCustomerRank();return(n=t.purchasingCustomer)!=null&&n.currentCustomerRank?{id:t.purchasingCustomer.currentCustomerRank.id,name:t.purchasingCustomer.currentCustomerRank.name,calculationCondition:{customerRankCalculationPeriod:t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod?{start:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.start),end:new Date(t.purchasingCustomer.currentCustomerRank.calculationCondition.customerRankCalculationPeriod.end)}:void 0,earnedPoint:t.purchasingCustomer.currentCustomerRank.calculationCondition.earnedPoint,purchasePrice:t.purchasingCustomer.currentCustomerRank.calculationCondition.purchasePrice},earnedPointToRankUp:t.purchasingCustomer.currentCustomerRank.earnedPointToRankUp,higherRank:t.purchasingCustomer.currentCustomerRank.higherRank?{id:t.purchasingCustomer.currentCustomerRank.higherRank.id,name:t.purchasingCustomer.currentCustomerRank.higherRank.name,threshold:t.purchasingCustomer.currentCustomerRank.higherRank.threshold}:void 0,lowerRank:t.purchasingCustomer.currentCustomerRank.lowerRank?{id:t.purchasingCustomer.currentCustomerRank.lowerRank.id,name:t.purchasingCustomer.currentCustomerRank.lowerRank.name,threshold:t.purchasingCustomer.currentCustomerRank.lowerRank.threshold}:void 0,purchasePriceToRankUp:t.purchasingCustomer.currentCustomerRank.purchasePriceToRankUp,threshold:t.purchasingCustomer.currentCustomerRank.threshold,pointMultiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier?{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.id,customerRankRule:{id:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.id,name:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.name,threshold:t.purchasingCustomer.currentCustomerRank.pointMultiplier.customerRankRule.threshold},multiplier:t.purchasingCustomer.currentCustomerRank.pointMultiplier.multiplier}:void 0}:null}}R.SDK=un,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|