@stonecrop/graphql-client 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/graphql-client.js +1115 -1349
- package/dist/graphql-client.js.map +1 -1
- package/dist/graphql-client.umd.cjs +40 -39
- package/dist/graphql-client.umd.cjs.map +1 -1
- package/package.json +16 -16
package/dist/graphql-client.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
for (var n = 0; n < t.length; n++) {
|
|
3
|
-
const i = t[n];
|
|
4
|
-
if (typeof i != "string" && !Array.isArray(i)) {
|
|
5
|
-
for (const r in i)
|
|
6
|
-
if (r !== "default" && !(r in e)) {
|
|
7
|
-
const s = Object.getOwnPropertyDescriptor(i, r);
|
|
8
|
-
s && Object.defineProperty(e, r, s.get ? s : {
|
|
9
|
-
enumerable: !0,
|
|
10
|
-
get: () => i[r]
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
|
|
16
|
-
}
|
|
17
|
-
var le = 9e15, ie = 1e9, $e = "0123456789abcdef", De = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Ce = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", He = {
|
|
1
|
+
var ee = 9e15, z = 1e9, be = "0123456789abcdef", Ne = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Te = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", Le = {
|
|
18
2
|
// These values must be integers within the stated ranges (inclusive).
|
|
19
3
|
// Most of these values can be changed at run-time using the `Decimal.config` method.
|
|
20
4
|
// The maximum number of significant digits of the result of a calculation or base conversion.
|
|
@@ -63,30 +47,30 @@ var le = 9e15, ie = 1e9, $e = "0123456789abcdef", De = "2.3025850929940456840179
|
|
|
63
47
|
// 0 to EXP_LIMIT
|
|
64
48
|
// The minimum exponent value, beneath which underflow to zero occurs.
|
|
65
49
|
// JavaScript numbers: -324 (5e-324)
|
|
66
|
-
minE: -
|
|
50
|
+
minE: -ee,
|
|
67
51
|
// -1 to -EXP_LIMIT
|
|
68
52
|
// The maximum exponent value, above which overflow to Infinity occurs.
|
|
69
53
|
// JavaScript numbers: 308 (1.7976931348623157e+308)
|
|
70
|
-
maxE:
|
|
54
|
+
maxE: ee,
|
|
71
55
|
// 1 to EXP_LIMIT
|
|
72
56
|
// Whether to use cryptographically-secure random number generation, if available.
|
|
73
57
|
crypto: !1
|
|
74
58
|
// true/false
|
|
75
|
-
},
|
|
76
|
-
|
|
59
|
+
}, ct, G, I = !0, ve = "[DecimalError] ", Q = ve + "Invalid argument: ", ut = ve + "Precision limit exceeded", lt = ve + "crypto unavailable", ft = "[object Decimal]", F = Math.floor, k = Math.pow, bt = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, Lt = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, Ft = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, ht = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, V = 1e7, v = 7, Mt = 9007199254740991, Pt = Ne.length - 1, Fe = Te.length - 1, p = { toStringTag: ft };
|
|
60
|
+
p.absoluteValue = p.abs = function() {
|
|
77
61
|
var e = new this.constructor(this);
|
|
78
|
-
return e.s < 0 && (e.s = 1),
|
|
62
|
+
return e.s < 0 && (e.s = 1), T(e);
|
|
79
63
|
};
|
|
80
|
-
|
|
81
|
-
return
|
|
64
|
+
p.ceil = function() {
|
|
65
|
+
return T(new this.constructor(this), this.e + 1, 2);
|
|
82
66
|
};
|
|
83
|
-
|
|
67
|
+
p.clampedTo = p.clamp = function(e, t) {
|
|
84
68
|
var n, i = this, r = i.constructor;
|
|
85
69
|
if (e = new r(e), t = new r(t), !e.s || !t.s) return new r(NaN);
|
|
86
|
-
if (e.gt(t)) throw Error(
|
|
70
|
+
if (e.gt(t)) throw Error(Q + t);
|
|
87
71
|
return n = i.cmp(e), n < 0 ? e : i.cmp(t) > 0 ? t : new r(i);
|
|
88
72
|
};
|
|
89
|
-
|
|
73
|
+
p.comparedTo = p.cmp = function(e) {
|
|
90
74
|
var t, n, i, r, s = this, o = s.d, a = (e = new s.constructor(e)).d, u = s.s, c = e.s;
|
|
91
75
|
if (!o || !a)
|
|
92
76
|
return !u || !c ? NaN : u !== c ? u : o === a ? 0 : !o ^ u < 0 ? 1 : -1;
|
|
@@ -97,143 +81,143 @@ g.comparedTo = g.cmp = function(e) {
|
|
|
97
81
|
if (o[t] !== a[t]) return o[t] > a[t] ^ u < 0 ? 1 : -1;
|
|
98
82
|
return i === r ? 0 : i > r ^ u < 0 ? 1 : -1;
|
|
99
83
|
};
|
|
100
|
-
|
|
84
|
+
p.cosine = p.cos = function() {
|
|
101
85
|
var e, t, n = this, i = n.constructor;
|
|
102
|
-
return n.d ? n.d[0] ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) +
|
|
86
|
+
return n.d ? n.d[0] ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + v, i.rounding = 1, n = qt(i, Et(i, n)), i.precision = e, i.rounding = t, T(G == 2 || G == 3 ? n.neg() : n, e, t, !0)) : new i(1) : new i(NaN);
|
|
103
87
|
};
|
|
104
|
-
|
|
88
|
+
p.cubeRoot = p.cbrt = function() {
|
|
105
89
|
var e, t, n, i, r, s, o, a, u, c, l = this, f = l.constructor;
|
|
106
90
|
if (!l.isFinite() || l.isZero()) return new f(l);
|
|
107
|
-
for (
|
|
108
|
-
if (a = i, u = a.times(a).times(a), c = u.plus(l), i =
|
|
91
|
+
for (I = !1, s = l.s * k(l.s * l, 1 / 3), !s || Math.abs(s) == 1 / 0 ? (n = b(l.d), e = l.e, (s = (e - n.length + 1) % 3) && (n += s == 1 || s == -2 ? "0" : "00"), s = k(n, 1 / 3), e = F((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)), s == 1 / 0 ? n = "5e" + e : (n = s.toExponential(), n = n.slice(0, n.indexOf("e") + 1) + e), i = new f(n), i.s = l.s) : i = new f(s.toString()), o = (e = f.precision) + 3; ; )
|
|
92
|
+
if (a = i, u = a.times(a).times(a), c = u.plus(l), i = x(c.plus(l).times(a), c.plus(u), o + 2, 1), b(a.d).slice(0, o) === (n = b(i.d)).slice(0, o))
|
|
109
93
|
if (n = n.slice(o - 3, o + 1), n == "9999" || !r && n == "4999") {
|
|
110
|
-
if (!r && (
|
|
94
|
+
if (!r && (T(a, e + 1, 0), a.times(a).times(a).eq(l))) {
|
|
111
95
|
i = a;
|
|
112
96
|
break;
|
|
113
97
|
}
|
|
114
98
|
o += 4, r = 1;
|
|
115
99
|
} else {
|
|
116
|
-
(!+n || !+n.slice(1) && n.charAt(0) == "5") && (
|
|
100
|
+
(!+n || !+n.slice(1) && n.charAt(0) == "5") && (T(i, e + 1, 1), t = !i.times(i).times(i).eq(l));
|
|
117
101
|
break;
|
|
118
102
|
}
|
|
119
|
-
return
|
|
103
|
+
return I = !0, T(i, e, f.rounding, t);
|
|
120
104
|
};
|
|
121
|
-
|
|
105
|
+
p.decimalPlaces = p.dp = function() {
|
|
122
106
|
var e, t = this.d, n = NaN;
|
|
123
107
|
if (t) {
|
|
124
|
-
if (e = t.length - 1, n = (e -
|
|
108
|
+
if (e = t.length - 1, n = (e - F(this.e / v)) * v, e = t[e], e) for (; e % 10 == 0; e /= 10) n--;
|
|
125
109
|
n < 0 && (n = 0);
|
|
126
110
|
}
|
|
127
111
|
return n;
|
|
128
112
|
};
|
|
129
|
-
|
|
130
|
-
return
|
|
113
|
+
p.dividedBy = p.div = function(e) {
|
|
114
|
+
return x(this, new this.constructor(e));
|
|
131
115
|
};
|
|
132
|
-
|
|
116
|
+
p.dividedToIntegerBy = p.divToInt = function(e) {
|
|
133
117
|
var t = this, n = t.constructor;
|
|
134
|
-
return
|
|
118
|
+
return T(x(t, new n(e), 0, 1, 1), n.precision, n.rounding);
|
|
135
119
|
};
|
|
136
|
-
|
|
120
|
+
p.equals = p.eq = function(e) {
|
|
137
121
|
return this.cmp(e) === 0;
|
|
138
122
|
};
|
|
139
|
-
|
|
140
|
-
return
|
|
123
|
+
p.floor = function() {
|
|
124
|
+
return T(new this.constructor(this), this.e + 1, 3);
|
|
141
125
|
};
|
|
142
|
-
|
|
126
|
+
p.greaterThan = p.gt = function(e) {
|
|
143
127
|
return this.cmp(e) > 0;
|
|
144
128
|
};
|
|
145
|
-
|
|
129
|
+
p.greaterThanOrEqualTo = p.gte = function(e) {
|
|
146
130
|
var t = this.cmp(e);
|
|
147
131
|
return t == 1 || t === 0;
|
|
148
132
|
};
|
|
149
|
-
|
|
133
|
+
p.hyperbolicCosine = p.cosh = function() {
|
|
150
134
|
var e, t, n, i, r, s = this, o = s.constructor, a = new o(1);
|
|
151
135
|
if (!s.isFinite()) return new o(s.s ? 1 / 0 : NaN);
|
|
152
136
|
if (s.isZero()) return a;
|
|
153
|
-
n = o.precision, i = o.rounding, o.precision = n + Math.max(s.e, s.sd()) + 4, o.rounding = 1, r = s.d.length, r < 32 ? (e = Math.ceil(r / 3), t = (1 /
|
|
137
|
+
n = o.precision, i = o.rounding, o.precision = n + Math.max(s.e, s.sd()) + 4, o.rounding = 1, r = s.d.length, r < 32 ? (e = Math.ceil(r / 3), t = (1 / Oe(4, e)).toString()) : (e = 16, t = "2.3283064365386962890625e-10"), s = ne(o, 1, s.times(t), new o(1), !0);
|
|
154
138
|
for (var u, c = e, l = new o(8); c--; )
|
|
155
139
|
u = s.times(s), s = a.minus(u.times(l.minus(u.times(l))));
|
|
156
|
-
return
|
|
140
|
+
return T(s, o.precision = n, o.rounding = i, !0);
|
|
157
141
|
};
|
|
158
|
-
|
|
142
|
+
p.hyperbolicSine = p.sinh = function() {
|
|
159
143
|
var e, t, n, i, r = this, s = r.constructor;
|
|
160
144
|
if (!r.isFinite() || r.isZero()) return new s(r);
|
|
161
145
|
if (t = s.precision, n = s.rounding, s.precision = t + Math.max(r.e, r.sd()) + 4, s.rounding = 1, i = r.d.length, i < 3)
|
|
162
|
-
r =
|
|
146
|
+
r = ne(s, 2, r, r, !0);
|
|
163
147
|
else {
|
|
164
|
-
e = 1.4 * Math.sqrt(i), e = e > 16 ? 16 : e | 0, r = r.times(1 /
|
|
148
|
+
e = 1.4 * Math.sqrt(i), e = e > 16 ? 16 : e | 0, r = r.times(1 / Oe(5, e)), r = ne(s, 2, r, r, !0);
|
|
165
149
|
for (var o, a = new s(5), u = new s(16), c = new s(20); e--; )
|
|
166
150
|
o = r.times(r), r = r.times(a.plus(o.times(u.times(o).plus(c))));
|
|
167
151
|
}
|
|
168
|
-
return s.precision = t, s.rounding = n,
|
|
152
|
+
return s.precision = t, s.rounding = n, T(r, t, n, !0);
|
|
169
153
|
};
|
|
170
|
-
|
|
154
|
+
p.hyperbolicTangent = p.tanh = function() {
|
|
171
155
|
var e, t, n = this, i = n.constructor;
|
|
172
|
-
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 7, i.rounding = 1,
|
|
156
|
+
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 7, i.rounding = 1, x(n.sinh(), n.cosh(), i.precision = e, i.rounding = t)) : new i(n.s);
|
|
173
157
|
};
|
|
174
|
-
|
|
175
|
-
var e
|
|
176
|
-
return
|
|
158
|
+
p.inverseCosine = p.acos = function() {
|
|
159
|
+
var e = this, t = e.constructor, n = e.abs().cmp(1), i = t.precision, r = t.rounding;
|
|
160
|
+
return n !== -1 ? n === 0 ? e.isNeg() ? j(t, i, r) : new t(0) : new t(NaN) : e.isZero() ? j(t, i + 4, r).times(0.5) : (t.precision = i + 6, t.rounding = 1, e = new t(1).minus(e).div(e.plus(1)).sqrt().atan(), t.precision = i, t.rounding = r, e.times(2));
|
|
177
161
|
};
|
|
178
|
-
|
|
162
|
+
p.inverseHyperbolicCosine = p.acosh = function() {
|
|
179
163
|
var e, t, n = this, i = n.constructor;
|
|
180
|
-
return n.lte(1) ? new i(n.eq(1) ? 0 : NaN) : n.isFinite() ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(Math.abs(n.e), n.sd()) + 4, i.rounding = 1,
|
|
164
|
+
return n.lte(1) ? new i(n.eq(1) ? 0 : NaN) : n.isFinite() ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(Math.abs(n.e), n.sd()) + 4, i.rounding = 1, I = !1, n = n.times(n).minus(1).sqrt().plus(n), I = !0, i.precision = e, i.rounding = t, n.ln()) : new i(n);
|
|
181
165
|
};
|
|
182
|
-
|
|
166
|
+
p.inverseHyperbolicSine = p.asinh = function() {
|
|
183
167
|
var e, t, n = this, i = n.constructor;
|
|
184
|
-
return !n.isFinite() || n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, i.rounding = 1,
|
|
168
|
+
return !n.isFinite() || n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, i.rounding = 1, I = !1, n = n.times(n).plus(1).sqrt().plus(n), I = !0, i.precision = e, i.rounding = t, n.ln());
|
|
185
169
|
};
|
|
186
|
-
|
|
170
|
+
p.inverseHyperbolicTangent = p.atanh = function() {
|
|
187
171
|
var e, t, n, i, r = this, s = r.constructor;
|
|
188
|
-
return r.isFinite() ? r.e >= 0 ? new s(r.abs().eq(1) ? r.s / 0 : r.isZero() ? r : NaN) : (e = s.precision, t = s.rounding, i = r.sd(), Math.max(i, e) < 2 * -r.e - 1 ?
|
|
172
|
+
return r.isFinite() ? r.e >= 0 ? new s(r.abs().eq(1) ? r.s / 0 : r.isZero() ? r : NaN) : (e = s.precision, t = s.rounding, i = r.sd(), Math.max(i, e) < 2 * -r.e - 1 ? T(new s(r), e, t, !0) : (s.precision = n = i - r.e, r = x(r.plus(1), new s(1).minus(r), n + e, 1), s.precision = e + 4, s.rounding = 1, r = r.ln(), s.precision = e, s.rounding = t, r.times(0.5))) : new s(NaN);
|
|
189
173
|
};
|
|
190
|
-
|
|
174
|
+
p.inverseSine = p.asin = function() {
|
|
191
175
|
var e, t, n, i, r = this, s = r.constructor;
|
|
192
|
-
return r.isZero() ? new s(r) : (t = r.abs().cmp(1), n = s.precision, i = s.rounding, t !== -1 ? t === 0 ? (e =
|
|
176
|
+
return r.isZero() ? new s(r) : (t = r.abs().cmp(1), n = s.precision, i = s.rounding, t !== -1 ? t === 0 ? (e = j(s, n + 4, i).times(0.5), e.s = r.s, e) : new s(NaN) : (s.precision = n + 6, s.rounding = 1, r = r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(), s.precision = n, s.rounding = i, r.times(2)));
|
|
193
177
|
};
|
|
194
|
-
|
|
195
|
-
var e, t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision,
|
|
178
|
+
p.inverseTangent = p.atan = function() {
|
|
179
|
+
var e, t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision, h = l.rounding;
|
|
196
180
|
if (c.isFinite()) {
|
|
197
181
|
if (c.isZero())
|
|
198
182
|
return new l(c);
|
|
199
|
-
if (c.abs().eq(1) && f + 4 <=
|
|
200
|
-
return o =
|
|
183
|
+
if (c.abs().eq(1) && f + 4 <= Fe)
|
|
184
|
+
return o = j(l, f + 4, h).times(0.25), o.s = c.s, o;
|
|
201
185
|
} else {
|
|
202
186
|
if (!c.s) return new l(NaN);
|
|
203
|
-
if (f + 4 <=
|
|
204
|
-
return o =
|
|
187
|
+
if (f + 4 <= Fe)
|
|
188
|
+
return o = j(l, f + 4, h).times(0.5), o.s = c.s, o;
|
|
205
189
|
}
|
|
206
|
-
for (l.precision = a = f + 10, l.rounding = 1, n = Math.min(28, a /
|
|
207
|
-
for (
|
|
190
|
+
for (l.precision = a = f + 10, l.rounding = 1, n = Math.min(28, a / v + 2 | 0), e = n; e; --e) c = c.div(c.times(c).plus(1).sqrt().plus(1));
|
|
191
|
+
for (I = !1, t = Math.ceil(a / v), i = 1, u = c.times(c), o = new l(c), r = c; e !== -1; )
|
|
208
192
|
if (r = r.times(u), s = o.minus(r.div(i += 2)), r = r.times(u), o = s.plus(r.div(i += 2)), o.d[t] !== void 0) for (e = t; o.d[e] === s.d[e] && e--; ) ;
|
|
209
|
-
return n && (o = o.times(2 << n - 1)),
|
|
193
|
+
return n && (o = o.times(2 << n - 1)), I = !0, T(o, l.precision = f, l.rounding = h, !0);
|
|
210
194
|
};
|
|
211
|
-
|
|
195
|
+
p.isFinite = function() {
|
|
212
196
|
return !!this.d;
|
|
213
197
|
};
|
|
214
|
-
|
|
215
|
-
return !!this.d &&
|
|
198
|
+
p.isInteger = p.isInt = function() {
|
|
199
|
+
return !!this.d && F(this.e / v) > this.d.length - 2;
|
|
216
200
|
};
|
|
217
|
-
|
|
201
|
+
p.isNaN = function() {
|
|
218
202
|
return !this.s;
|
|
219
203
|
};
|
|
220
|
-
|
|
204
|
+
p.isNegative = p.isNeg = function() {
|
|
221
205
|
return this.s < 0;
|
|
222
206
|
};
|
|
223
|
-
|
|
207
|
+
p.isPositive = p.isPos = function() {
|
|
224
208
|
return this.s > 0;
|
|
225
209
|
};
|
|
226
|
-
|
|
210
|
+
p.isZero = function() {
|
|
227
211
|
return !!this.d && this.d[0] === 0;
|
|
228
212
|
};
|
|
229
|
-
|
|
213
|
+
p.lessThan = p.lt = function(e) {
|
|
230
214
|
return this.cmp(e) < 0;
|
|
231
215
|
};
|
|
232
|
-
|
|
216
|
+
p.lessThanOrEqualTo = p.lte = function(e) {
|
|
233
217
|
return this.cmp(e) < 1;
|
|
234
218
|
};
|
|
235
|
-
|
|
236
|
-
var t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision,
|
|
219
|
+
p.logarithm = p.log = function(e) {
|
|
220
|
+
var t, n, i, r, s, o, a, u, c = this, l = c.constructor, f = l.precision, h = l.rounding, m = 5;
|
|
237
221
|
if (e == null)
|
|
238
222
|
e = new l(10), t = !0;
|
|
239
223
|
else {
|
|
@@ -249,235 +233,235 @@ g.logarithm = g.log = function(e) {
|
|
|
249
233
|
for (r = n[0]; r % 10 === 0; ) r /= 10;
|
|
250
234
|
s = r !== 1;
|
|
251
235
|
}
|
|
252
|
-
if (
|
|
236
|
+
if (I = !1, a = f + m, o = J(c, a), i = t ? we(l, a + 10) : J(e, a), u = x(o, i, a, 1), ae(u.d, r = f, h))
|
|
253
237
|
do
|
|
254
|
-
if (a += 10, o =
|
|
255
|
-
+
|
|
238
|
+
if (a += 10, o = J(c, a), i = t ? we(l, a + 10) : J(e, a), u = x(o, i, a, 1), !s) {
|
|
239
|
+
+b(u.d).slice(r + 1, r + 15) + 1 == 1e14 && (u = T(u, f + 1, 0));
|
|
256
240
|
break;
|
|
257
241
|
}
|
|
258
|
-
while (
|
|
259
|
-
return
|
|
242
|
+
while (ae(u.d, r += 10, h));
|
|
243
|
+
return I = !0, T(u, f, h);
|
|
260
244
|
};
|
|
261
|
-
|
|
262
|
-
var t, n, i, r, s, o, a, u, c, l, f,
|
|
263
|
-
if (e = new
|
|
264
|
-
return !
|
|
265
|
-
if (
|
|
266
|
-
return e.s = -e.s,
|
|
267
|
-
if (c =
|
|
268
|
-
if (
|
|
269
|
-
else if (c[0]) e = new
|
|
270
|
-
else return new
|
|
271
|
-
return
|
|
272
|
-
}
|
|
273
|
-
if (n =
|
|
274
|
-
for (f = s < 0, f ? (t = c, s = -s, o =
|
|
245
|
+
p.minus = p.sub = function(e) {
|
|
246
|
+
var t, n, i, r, s, o, a, u, c, l, f, h, m = this, N = m.constructor;
|
|
247
|
+
if (e = new N(e), !m.d || !e.d)
|
|
248
|
+
return !m.s || !e.s ? e = new N(NaN) : m.d ? e.s = -e.s : e = new N(e.d || m.s !== e.s ? m : NaN), e;
|
|
249
|
+
if (m.s != e.s)
|
|
250
|
+
return e.s = -e.s, m.plus(e);
|
|
251
|
+
if (c = m.d, h = e.d, a = N.precision, u = N.rounding, !c[0] || !h[0]) {
|
|
252
|
+
if (h[0]) e.s = -e.s;
|
|
253
|
+
else if (c[0]) e = new N(m);
|
|
254
|
+
else return new N(u === 3 ? -0 : 0);
|
|
255
|
+
return I ? T(e, a, u) : e;
|
|
256
|
+
}
|
|
257
|
+
if (n = F(e.e / v), l = F(m.e / v), c = c.slice(), s = l - n, s) {
|
|
258
|
+
for (f = s < 0, f ? (t = c, s = -s, o = h.length) : (t = h, n = l, o = c.length), i = Math.max(Math.ceil(a / v), o) + 2, s > i && (s = i, t.length = 1), t.reverse(), i = s; i--; ) t.push(0);
|
|
275
259
|
t.reverse();
|
|
276
260
|
} else {
|
|
277
|
-
for (i = c.length, o =
|
|
278
|
-
if (c[i] !=
|
|
279
|
-
f = c[i] <
|
|
261
|
+
for (i = c.length, o = h.length, f = i < o, f && (o = i), i = 0; i < o; i++)
|
|
262
|
+
if (c[i] != h[i]) {
|
|
263
|
+
f = c[i] < h[i];
|
|
280
264
|
break;
|
|
281
265
|
}
|
|
282
266
|
s = 0;
|
|
283
267
|
}
|
|
284
|
-
for (f && (t = c, c =
|
|
285
|
-
for (i =
|
|
286
|
-
if (c[--i] <
|
|
287
|
-
for (r = i; r && c[--r] === 0; ) c[r] =
|
|
288
|
-
--c[r], c[i] +=
|
|
268
|
+
for (f && (t = c, c = h, h = t, e.s = -e.s), o = c.length, i = h.length - o; i > 0; --i) c[o++] = 0;
|
|
269
|
+
for (i = h.length; i > s; ) {
|
|
270
|
+
if (c[--i] < h[i]) {
|
|
271
|
+
for (r = i; r && c[--r] === 0; ) c[r] = V - 1;
|
|
272
|
+
--c[r], c[i] += V;
|
|
289
273
|
}
|
|
290
|
-
c[i] -=
|
|
274
|
+
c[i] -= h[i];
|
|
291
275
|
}
|
|
292
276
|
for (; c[--o] === 0; ) c.pop();
|
|
293
277
|
for (; c[0] === 0; c.shift()) --n;
|
|
294
|
-
return c[0] ? (e.d = c, e.e =
|
|
278
|
+
return c[0] ? (e.d = c, e.e = Ie(c, n), I ? T(e, a, u) : e) : new N(u === 3 ? -0 : 0);
|
|
295
279
|
};
|
|
296
|
-
|
|
280
|
+
p.modulo = p.mod = function(e) {
|
|
297
281
|
var t, n = this, i = n.constructor;
|
|
298
|
-
return e = new i(e), !n.d || !e.s || e.d && !e.d[0] ? new i(NaN) : !e.d || n.d && !n.d[0] ?
|
|
282
|
+
return e = new i(e), !n.d || !e.s || e.d && !e.d[0] ? new i(NaN) : !e.d || n.d && !n.d[0] ? T(new i(n), i.precision, i.rounding) : (I = !1, i.modulo == 9 ? (t = x(n, e.abs(), 0, 3, 1), t.s *= e.s) : t = x(n, e, 0, i.modulo, 1), t = t.times(e), I = !0, n.minus(t));
|
|
299
283
|
};
|
|
300
|
-
|
|
301
|
-
return
|
|
284
|
+
p.naturalExponential = p.exp = function() {
|
|
285
|
+
return Me(this);
|
|
302
286
|
};
|
|
303
|
-
|
|
304
|
-
return
|
|
287
|
+
p.naturalLogarithm = p.ln = function() {
|
|
288
|
+
return J(this);
|
|
305
289
|
};
|
|
306
|
-
|
|
290
|
+
p.negated = p.neg = function() {
|
|
307
291
|
var e = new this.constructor(this);
|
|
308
|
-
return e.s = -e.s,
|
|
292
|
+
return e.s = -e.s, T(e);
|
|
309
293
|
};
|
|
310
|
-
|
|
311
|
-
var t, n, i, r, s, o, a, u, c, l, f = this,
|
|
312
|
-
if (e = new
|
|
313
|
-
return !f.s || !e.s ? e = new
|
|
294
|
+
p.plus = p.add = function(e) {
|
|
295
|
+
var t, n, i, r, s, o, a, u, c, l, f = this, h = f.constructor;
|
|
296
|
+
if (e = new h(e), !f.d || !e.d)
|
|
297
|
+
return !f.s || !e.s ? e = new h(NaN) : f.d || (e = new h(e.d || f.s === e.s ? f : NaN)), e;
|
|
314
298
|
if (f.s != e.s)
|
|
315
299
|
return e.s = -e.s, f.minus(e);
|
|
316
|
-
if (c = f.d, l = e.d, a =
|
|
317
|
-
return l[0] || (e = new
|
|
318
|
-
if (s =
|
|
319
|
-
for (r < 0 ? (n = c, r = -r, o = l.length) : (n = l, i = s, o = c.length), s = Math.ceil(a /
|
|
300
|
+
if (c = f.d, l = e.d, a = h.precision, u = h.rounding, !c[0] || !l[0])
|
|
301
|
+
return l[0] || (e = new h(f)), I ? T(e, a, u) : e;
|
|
302
|
+
if (s = F(f.e / v), i = F(e.e / v), c = c.slice(), r = s - i, r) {
|
|
303
|
+
for (r < 0 ? (n = c, r = -r, o = l.length) : (n = l, i = s, o = c.length), s = Math.ceil(a / v), o = s > o ? s + 1 : o + 1, r > o && (r = o, n.length = 1), n.reverse(); r--; ) n.push(0);
|
|
320
304
|
n.reverse();
|
|
321
305
|
}
|
|
322
306
|
for (o = c.length, r = l.length, o - r < 0 && (r = o, n = l, l = c, c = n), t = 0; r; )
|
|
323
|
-
t = (c[--r] = c[r] + l[r] + t) /
|
|
307
|
+
t = (c[--r] = c[r] + l[r] + t) / V | 0, c[r] %= V;
|
|
324
308
|
for (t && (c.unshift(t), ++i), o = c.length; c[--o] == 0; ) c.pop();
|
|
325
|
-
return e.d = c, e.e =
|
|
309
|
+
return e.d = c, e.e = Ie(c, i), I ? T(e, a, u) : e;
|
|
326
310
|
};
|
|
327
|
-
|
|
311
|
+
p.precision = p.sd = function(e) {
|
|
328
312
|
var t, n = this;
|
|
329
|
-
if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(
|
|
330
|
-
return n.d ? (t =
|
|
313
|
+
if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(Q + e);
|
|
314
|
+
return n.d ? (t = dt(n.d), e && n.e + 1 > t && (t = n.e + 1)) : t = NaN, t;
|
|
331
315
|
};
|
|
332
|
-
|
|
316
|
+
p.round = function() {
|
|
333
317
|
var e = this, t = e.constructor;
|
|
334
|
-
return
|
|
318
|
+
return T(new t(e), e.e + 1, t.rounding);
|
|
335
319
|
};
|
|
336
|
-
|
|
320
|
+
p.sine = p.sin = function() {
|
|
337
321
|
var e, t, n = this, i = n.constructor;
|
|
338
|
-
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) +
|
|
322
|
+
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + v, i.rounding = 1, n = Ut(i, Et(i, n)), i.precision = e, i.rounding = t, T(G > 2 ? n.neg() : n, e, t, !0)) : new i(NaN);
|
|
339
323
|
};
|
|
340
|
-
|
|
324
|
+
p.squareRoot = p.sqrt = function() {
|
|
341
325
|
var e, t, n, i, r, s, o = this, a = o.d, u = o.e, c = o.s, l = o.constructor;
|
|
342
326
|
if (c !== 1 || !a || !a[0])
|
|
343
327
|
return new l(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
|
|
344
|
-
for (
|
|
345
|
-
if (s = i, i = s.plus(
|
|
328
|
+
for (I = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (t = b(a), (t.length + u) % 2 == 0 && (t += "0"), c = Math.sqrt(t), u = F((u + 1) / 2) - (u < 0 || u % 2), c == 1 / 0 ? t = "5e" + u : (t = c.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + u), i = new l(t)) : i = new l(c.toString()), n = (u = l.precision) + 3; ; )
|
|
329
|
+
if (s = i, i = s.plus(x(o, s, n + 2, 1)).times(0.5), b(s.d).slice(0, n) === (t = b(i.d)).slice(0, n))
|
|
346
330
|
if (t = t.slice(n - 3, n + 1), t == "9999" || !r && t == "4999") {
|
|
347
|
-
if (!r && (
|
|
331
|
+
if (!r && (T(s, u + 1, 0), s.times(s).eq(o))) {
|
|
348
332
|
i = s;
|
|
349
333
|
break;
|
|
350
334
|
}
|
|
351
335
|
n += 4, r = 1;
|
|
352
336
|
} else {
|
|
353
|
-
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (
|
|
337
|
+
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (T(i, u + 1, 1), e = !i.times(i).eq(o));
|
|
354
338
|
break;
|
|
355
339
|
}
|
|
356
|
-
return
|
|
340
|
+
return I = !0, T(i, u, l.rounding, e);
|
|
357
341
|
};
|
|
358
|
-
|
|
342
|
+
p.tangent = p.tan = function() {
|
|
359
343
|
var e, t, n = this, i = n.constructor;
|
|
360
|
-
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 10, i.rounding = 1, n = n.sin(), n.s = 1, n =
|
|
344
|
+
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 10, i.rounding = 1, n = n.sin(), n.s = 1, n = x(n, new i(1).minus(n.times(n)).sqrt(), e + 10, 0), i.precision = e, i.rounding = t, T(G == 2 || G == 4 ? n.neg() : n, e, t, !0)) : new i(NaN);
|
|
361
345
|
};
|
|
362
|
-
|
|
363
|
-
var t, n, i, r, s, o, a, u, c, l = this, f = l.constructor,
|
|
364
|
-
if (e.s *= l.s, !
|
|
365
|
-
return new f(!e.s ||
|
|
366
|
-
for (n =
|
|
346
|
+
p.times = p.mul = function(e) {
|
|
347
|
+
var t, n, i, r, s, o, a, u, c, l = this, f = l.constructor, h = l.d, m = (e = new f(e)).d;
|
|
348
|
+
if (e.s *= l.s, !h || !h[0] || !m || !m[0])
|
|
349
|
+
return new f(!e.s || h && !h[0] && !m || m && !m[0] && !h ? NaN : !h || !m ? e.s / 0 : e.s * 0);
|
|
350
|
+
for (n = F(l.e / v) + F(e.e / v), u = h.length, c = m.length, u < c && (s = h, h = m, m = s, o = u, u = c, c = o), s = [], o = u + c, i = o; i--; ) s.push(0);
|
|
367
351
|
for (i = c; --i >= 0; ) {
|
|
368
352
|
for (t = 0, r = u + i; r > i; )
|
|
369
|
-
a = s[r] +
|
|
370
|
-
s[r] = (s[r] + t) %
|
|
353
|
+
a = s[r] + m[i] * h[r - i - 1] + t, s[r--] = a % V | 0, t = a / V | 0;
|
|
354
|
+
s[r] = (s[r] + t) % V | 0;
|
|
371
355
|
}
|
|
372
356
|
for (; !s[--o]; ) s.pop();
|
|
373
|
-
return t ? ++n : s.shift(), e.d = s, e.e =
|
|
357
|
+
return t ? ++n : s.shift(), e.d = s, e.e = Ie(s, n), I ? T(e, f.precision, f.rounding) : e;
|
|
374
358
|
};
|
|
375
|
-
|
|
376
|
-
return
|
|
359
|
+
p.toBinary = function(e, t) {
|
|
360
|
+
return je(this, 2, e, t);
|
|
377
361
|
};
|
|
378
|
-
|
|
362
|
+
p.toDecimalPlaces = p.toDP = function(e, t) {
|
|
379
363
|
var n = this, i = n.constructor;
|
|
380
|
-
return n = new i(n), e === void 0 ? n : (
|
|
364
|
+
return n = new i(n), e === void 0 ? n : (P(e, 0, z), t === void 0 ? t = i.rounding : P(t, 0, 8), T(n, e + n.e + 1, t));
|
|
381
365
|
};
|
|
382
|
-
|
|
366
|
+
p.toExponential = function(e, t) {
|
|
383
367
|
var n, i = this, r = i.constructor;
|
|
384
|
-
return e === void 0 ? n =
|
|
368
|
+
return e === void 0 ? n = $(i, !0) : (P(e, 0, z), t === void 0 ? t = r.rounding : P(t, 0, 8), i = T(new r(i), e + 1, t), n = $(i, !0, e + 1)), i.isNeg() && !i.isZero() ? "-" + n : n;
|
|
385
369
|
};
|
|
386
|
-
|
|
370
|
+
p.toFixed = function(e, t) {
|
|
387
371
|
var n, i, r = this, s = r.constructor;
|
|
388
|
-
return e === void 0 ? n =
|
|
372
|
+
return e === void 0 ? n = $(r) : (P(e, 0, z), t === void 0 ? t = s.rounding : P(t, 0, 8), i = T(new s(r), e + r.e + 1, t), n = $(i, !1, e + i.e + 1)), r.isNeg() && !r.isZero() ? "-" + n : n;
|
|
389
373
|
};
|
|
390
|
-
|
|
391
|
-
var t, n, i, r, s, o, a, u, c, l, f,
|
|
392
|
-
if (!
|
|
393
|
-
if (c = n = new E(1), i = u = new E(0), t = new E(i), s = t.e =
|
|
374
|
+
p.toFraction = function(e) {
|
|
375
|
+
var t, n, i, r, s, o, a, u, c, l, f, h, m = this, N = m.d, E = m.constructor;
|
|
376
|
+
if (!N) return new E(m);
|
|
377
|
+
if (c = n = new E(1), i = u = new E(0), t = new E(i), s = t.e = dt(N) - m.e - 1, o = s % v, t.d[0] = k(10, o < 0 ? v + o : o), e == null)
|
|
394
378
|
e = s > 0 ? t : c;
|
|
395
379
|
else {
|
|
396
|
-
if (a = new E(e), !a.isInt() || a.lt(c)) throw Error(
|
|
380
|
+
if (a = new E(e), !a.isInt() || a.lt(c)) throw Error(Q + a);
|
|
397
381
|
e = a.gt(t) ? s > 0 ? t : c : a;
|
|
398
382
|
}
|
|
399
|
-
for (
|
|
383
|
+
for (I = !1, a = new E(b(N)), l = E.precision, E.precision = s = N.length * v * 2; f = x(a, t, 0, 1, 1), r = n.plus(f.times(i)), r.cmp(e) != 1; )
|
|
400
384
|
n = i, i = r, r = c, c = u.plus(f.times(r)), u = r, r = t, t = a.minus(f.times(r)), a = r;
|
|
401
|
-
return r =
|
|
385
|
+
return r = x(e.minus(n), i, 0, 1, 1), u = u.plus(r.times(c)), n = n.plus(r.times(i)), u.s = c.s = m.s, h = x(c, i, s, 1).minus(m).abs().cmp(x(u, n, s, 1).minus(m).abs()) < 1 ? [c, i] : [u, n], E.precision = l, I = !0, h;
|
|
402
386
|
};
|
|
403
|
-
|
|
404
|
-
return
|
|
387
|
+
p.toHexadecimal = p.toHex = function(e, t) {
|
|
388
|
+
return je(this, 16, e, t);
|
|
405
389
|
};
|
|
406
|
-
|
|
390
|
+
p.toNearest = function(e, t) {
|
|
407
391
|
var n = this, i = n.constructor;
|
|
408
392
|
if (n = new i(n), e == null) {
|
|
409
393
|
if (!n.d) return n;
|
|
410
394
|
e = new i(1), t = i.rounding;
|
|
411
395
|
} else {
|
|
412
|
-
if (e = new i(e), t === void 0 ? t = i.rounding :
|
|
396
|
+
if (e = new i(e), t === void 0 ? t = i.rounding : P(t, 0, 8), !n.d) return e.s ? n : e;
|
|
413
397
|
if (!e.d)
|
|
414
398
|
return e.s && (e.s = n.s), e;
|
|
415
399
|
}
|
|
416
|
-
return e.d[0] ? (
|
|
400
|
+
return e.d[0] ? (I = !1, n = x(n, e, 0, t, 1).times(e), I = !0, T(n)) : (e.s = n.s, n = e), n;
|
|
417
401
|
};
|
|
418
|
-
|
|
402
|
+
p.toNumber = function() {
|
|
419
403
|
return +this;
|
|
420
404
|
};
|
|
421
|
-
|
|
422
|
-
return
|
|
405
|
+
p.toOctal = function(e, t) {
|
|
406
|
+
return je(this, 8, e, t);
|
|
423
407
|
};
|
|
424
|
-
|
|
408
|
+
p.toPower = p.pow = function(e) {
|
|
425
409
|
var t, n, i, r, s, o, a = this, u = a.constructor, c = +(e = new u(e));
|
|
426
|
-
if (!a.d || !e.d || !a.d[0] || !e.d[0]) return new u(
|
|
410
|
+
if (!a.d || !e.d || !a.d[0] || !e.d[0]) return new u(k(+a, c));
|
|
427
411
|
if (a = new u(a), a.eq(1)) return a;
|
|
428
|
-
if (i = u.precision, s = u.rounding, e.eq(1)) return
|
|
429
|
-
if (t =
|
|
430
|
-
return r =
|
|
412
|
+
if (i = u.precision, s = u.rounding, e.eq(1)) return T(a, i, s);
|
|
413
|
+
if (t = F(e.e / v), t >= e.d.length - 1 && (n = c < 0 ? -c : c) <= Mt)
|
|
414
|
+
return r = pt(u, a, n, i), e.s < 0 ? new u(1).div(r) : T(r, i, s);
|
|
431
415
|
if (o = a.s, o < 0) {
|
|
432
416
|
if (t < e.d.length - 1) return new u(NaN);
|
|
433
417
|
if ((e.d[t] & 1) == 0 && (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
|
|
434
418
|
return a.s = o, a;
|
|
435
419
|
}
|
|
436
|
-
return n =
|
|
420
|
+
return n = k(+a, c), t = n == 0 || !isFinite(n) ? F(c * (Math.log("0." + b(a.d)) / Math.LN10 + a.e + 1)) : new u(n + "").e, t > u.maxE + 1 || t < u.minE - 1 ? new u(t > 0 ? o / 0 : 0) : (I = !1, u.rounding = a.s = 1, n = Math.min(12, (t + "").length), r = Me(e.times(J(a, i + n)), i), r.d && (r = T(r, i + 5, 1), ae(r.d, i, s) && (t = i + 10, r = T(Me(e.times(J(a, t + n)), t), t + 5, 1), +b(r.d).slice(i + 1, i + 15) + 1 == 1e14 && (r = T(r, i + 1, 0)))), r.s = o, I = !0, u.rounding = s, T(r, i, s));
|
|
437
421
|
};
|
|
438
|
-
|
|
422
|
+
p.toPrecision = function(e, t) {
|
|
439
423
|
var n, i = this, r = i.constructor;
|
|
440
|
-
return e === void 0 ? n =
|
|
424
|
+
return e === void 0 ? n = $(i, i.e <= r.toExpNeg || i.e >= r.toExpPos) : (P(e, 1, z), t === void 0 ? t = r.rounding : P(t, 0, 8), i = T(new r(i), e, t), n = $(i, e <= i.e || i.e <= r.toExpNeg, e)), i.isNeg() && !i.isZero() ? "-" + n : n;
|
|
441
425
|
};
|
|
442
|
-
|
|
426
|
+
p.toSignificantDigits = p.toSD = function(e, t) {
|
|
443
427
|
var n = this, i = n.constructor;
|
|
444
|
-
return e === void 0 ? (e = i.precision, t = i.rounding) : (
|
|
428
|
+
return e === void 0 ? (e = i.precision, t = i.rounding) : (P(e, 1, z), t === void 0 ? t = i.rounding : P(t, 0, 8)), T(new i(n), e, t);
|
|
445
429
|
};
|
|
446
|
-
|
|
447
|
-
var e = this, t = e.constructor, n =
|
|
430
|
+
p.toString = function() {
|
|
431
|
+
var e = this, t = e.constructor, n = $(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
|
|
448
432
|
return e.isNeg() && !e.isZero() ? "-" + n : n;
|
|
449
433
|
};
|
|
450
|
-
|
|
451
|
-
return
|
|
434
|
+
p.truncated = p.trunc = function() {
|
|
435
|
+
return T(new this.constructor(this), this.e + 1, 1);
|
|
452
436
|
};
|
|
453
|
-
|
|
454
|
-
var e = this, t = e.constructor, n =
|
|
437
|
+
p.valueOf = p.toJSON = function() {
|
|
438
|
+
var e = this, t = e.constructor, n = $(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
|
|
455
439
|
return e.isNeg() ? "-" + n : n;
|
|
456
440
|
};
|
|
457
|
-
function
|
|
441
|
+
function b(e) {
|
|
458
442
|
var t, n, i, r = e.length - 1, s = "", o = e[0];
|
|
459
443
|
if (r > 0) {
|
|
460
444
|
for (s += o, t = 1; t < r; t++)
|
|
461
|
-
i = e[t] + "", n =
|
|
462
|
-
o = e[t], i = o + "", n =
|
|
445
|
+
i = e[t] + "", n = v - i.length, n && (s += H(n)), s += i;
|
|
446
|
+
o = e[t], i = o + "", n = v - i.length, n && (s += H(n));
|
|
463
447
|
} else if (o === 0)
|
|
464
448
|
return "0";
|
|
465
449
|
for (; o % 10 === 0; ) o /= 10;
|
|
466
450
|
return s + o;
|
|
467
451
|
}
|
|
468
|
-
function
|
|
452
|
+
function P(e, t, n) {
|
|
469
453
|
if (e !== ~~e || e < t || e > n)
|
|
470
|
-
throw Error(
|
|
454
|
+
throw Error(Q + e);
|
|
471
455
|
}
|
|
472
|
-
function
|
|
456
|
+
function ae(e, t, n, i) {
|
|
473
457
|
var r, s, o, a;
|
|
474
458
|
for (s = e[0]; s >= 10; s /= 10) --t;
|
|
475
|
-
return --t < 0 ? (t +=
|
|
459
|
+
return --t < 0 ? (t += v, r = 0) : (r = Math.ceil((t + 1) / v), t %= v), s = k(10, v - t), a = e[r] % s | 0, i == null ? t < 3 ? (t == 0 ? a = a / 100 | 0 : t == 1 && (a = a / 10 | 0), o = n < 4 && a == 99999 || n > 3 && a == 49999 || a == 5e4 || a == 0) : o = (n < 4 && a + 1 == s || n > 3 && a + 1 == s / 2) && (e[r + 1] / s / 100 | 0) == k(10, t - 2) - 1 || (a == s / 2 || a == 0) && (e[r + 1] / s / 100 | 0) == 0 : t < 4 ? (t == 0 ? a = a / 1e3 | 0 : t == 1 ? a = a / 100 | 0 : t == 2 && (a = a / 10 | 0), o = (i || n < 4) && a == 9999 || !i && n > 3 && a == 4999) : o = ((i || n < 4) && a + 1 == s || !i && n > 3 && a + 1 == s / 2) && (e[r + 1] / s / 1e3 | 0) == k(10, t - 3) - 1, o;
|
|
476
460
|
}
|
|
477
|
-
function
|
|
461
|
+
function de(e, t, n) {
|
|
478
462
|
for (var i, r = [0], s, o = 0, a = e.length; o < a; ) {
|
|
479
463
|
for (s = r.length; s--; ) r[s] *= t;
|
|
480
|
-
for (r[0] +=
|
|
464
|
+
for (r[0] += be.indexOf(e.charAt(o++)), i = 0; i < r.length; i++)
|
|
481
465
|
r[i] > n - 1 && (r[i + 1] === void 0 && (r[i + 1] = 0), r[i + 1] += r[i] / n | 0, r[i] %= n);
|
|
482
466
|
}
|
|
483
467
|
return r.reverse();
|
|
@@ -485,14 +469,14 @@ function Oe(e, t, n) {
|
|
|
485
469
|
function qt(e, t) {
|
|
486
470
|
var n, i, r;
|
|
487
471
|
if (t.isZero()) return t;
|
|
488
|
-
i = t.d.length, i < 32 ? (n = Math.ceil(i / 3), r = (1 /
|
|
472
|
+
i = t.d.length, i < 32 ? (n = Math.ceil(i / 3), r = (1 / Oe(4, n)).toString()) : (n = 16, r = "2.3283064365386962890625e-10"), e.precision += n, t = ne(e, 1, t.times(r), new e(1));
|
|
489
473
|
for (var s = n; s--; ) {
|
|
490
474
|
var o = t.times(t);
|
|
491
475
|
t = o.times(o).minus(o).times(8).plus(1);
|
|
492
476
|
}
|
|
493
477
|
return e.precision -= n, t;
|
|
494
478
|
}
|
|
495
|
-
var
|
|
479
|
+
var x = /* @__PURE__ */ (function() {
|
|
496
480
|
function e(i, r, s) {
|
|
497
481
|
var o, a = 0, u = i.length;
|
|
498
482
|
for (i = i.slice(); u--; )
|
|
@@ -517,267 +501,267 @@ var R = /* @__PURE__ */ (function() {
|
|
|
517
501
|
for (; !i[0] && i.length > 1; ) i.shift();
|
|
518
502
|
}
|
|
519
503
|
return function(i, r, s, o, a, u) {
|
|
520
|
-
var c, l, f,
|
|
521
|
-
if (!
|
|
522
|
-
return new
|
|
504
|
+
var c, l, f, h, m, N, E, C, y, M, A, _, Y, q, W, ue, se, xe, B, le, fe = i.constructor, De = i.s == r.s ? 1 : -1, L = i.d, D = r.d;
|
|
505
|
+
if (!L || !L[0] || !D || !D[0])
|
|
506
|
+
return new fe(
|
|
523
507
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
524
|
-
!i.s || !r.s || (
|
|
508
|
+
!i.s || !r.s || (L ? D && L[0] == D[0] : !D) ? NaN : (
|
|
525
509
|
// Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
|
|
526
|
-
|
|
510
|
+
L && L[0] == 0 || !D ? De * 0 : De / 0
|
|
527
511
|
)
|
|
528
512
|
);
|
|
529
|
-
for (u ? (
|
|
530
|
-
if (
|
|
531
|
-
|
|
513
|
+
for (u ? (m = 1, l = i.e - r.e) : (u = V, m = v, l = F(i.e / m) - F(r.e / m)), B = D.length, se = L.length, y = new fe(De), M = y.d = [], f = 0; D[f] == (L[f] || 0); f++) ;
|
|
514
|
+
if (D[f] > (L[f] || 0) && l--, s == null ? (q = s = fe.precision, o = fe.rounding) : a ? q = s + (i.e - r.e) + 1 : q = s, q < 0)
|
|
515
|
+
M.push(1), N = !0;
|
|
532
516
|
else {
|
|
533
|
-
if (
|
|
534
|
-
for (
|
|
535
|
-
|
|
536
|
-
|
|
517
|
+
if (q = q / m + 2 | 0, f = 0, B == 1) {
|
|
518
|
+
for (h = 0, D = D[0], q++; (f < se || h) && q--; f++)
|
|
519
|
+
W = h * u + (L[f] || 0), M[f] = W / D | 0, h = W % D | 0;
|
|
520
|
+
N = h || f < se;
|
|
537
521
|
} else {
|
|
538
|
-
for (
|
|
539
|
-
|
|
522
|
+
for (h = u / (D[0] + 1) | 0, h > 1 && (D = e(D, h, u), L = e(L, h, u), B = D.length, se = L.length), ue = B, A = L.slice(0, B), _ = A.length; _ < B; ) A[_++] = 0;
|
|
523
|
+
le = D.slice(), le.unshift(0), xe = D[0], D[1] >= u / 2 && ++xe;
|
|
540
524
|
do
|
|
541
|
-
|
|
542
|
-
while ((
|
|
543
|
-
|
|
525
|
+
h = 0, c = t(D, A, B, _), c < 0 ? (Y = A[0], B != _ && (Y = Y * u + (A[1] || 0)), h = Y / xe | 0, h > 1 ? (h >= u && (h = u - 1), E = e(D, h, u), C = E.length, _ = A.length, c = t(E, A, C, _), c == 1 && (h--, n(E, B < C ? le : D, C, u))) : (h == 0 && (c = h = 1), E = D.slice()), C = E.length, C < _ && E.unshift(0), n(A, E, _, u), c == -1 && (_ = A.length, c = t(D, A, B, _), c < 1 && (h++, n(A, B < _ ? le : D, _, u))), _ = A.length) : c === 0 && (h++, A = [0]), M[f++] = h, c && A[0] ? A[_++] = L[ue] || 0 : (A = [L[ue]], _ = 1);
|
|
526
|
+
while ((ue++ < se || A[0] !== void 0) && q--);
|
|
527
|
+
N = A[0] !== void 0;
|
|
544
528
|
}
|
|
545
|
-
|
|
529
|
+
M[0] || M.shift();
|
|
546
530
|
}
|
|
547
|
-
if (
|
|
548
|
-
|
|
531
|
+
if (m == 1)
|
|
532
|
+
y.e = l, ct = N;
|
|
549
533
|
else {
|
|
550
|
-
for (f = 1,
|
|
551
|
-
|
|
534
|
+
for (f = 1, h = M[0]; h >= 10; h /= 10) f++;
|
|
535
|
+
y.e = f + l * m - 1, T(y, a ? s + y.e + 1 : s, o, N);
|
|
552
536
|
}
|
|
553
|
-
return
|
|
537
|
+
return y;
|
|
554
538
|
};
|
|
555
539
|
})();
|
|
556
|
-
function
|
|
557
|
-
var r, s, o, a, u, c, l, f,
|
|
540
|
+
function T(e, t, n, i) {
|
|
541
|
+
var r, s, o, a, u, c, l, f, h, m = e.constructor;
|
|
558
542
|
e: if (t != null) {
|
|
559
543
|
if (f = e.d, !f) return e;
|
|
560
544
|
for (r = 1, a = f[0]; a >= 10; a /= 10) r++;
|
|
561
545
|
if (s = t - r, s < 0)
|
|
562
|
-
s +=
|
|
563
|
-
else if (
|
|
546
|
+
s += v, o = t, l = f[h = 0], u = l / k(10, r - o - 1) % 10 | 0;
|
|
547
|
+
else if (h = Math.ceil((s + 1) / v), a = f.length, h >= a)
|
|
564
548
|
if (i) {
|
|
565
|
-
for (; a++ <=
|
|
566
|
-
l = u = 0, r = 1, s %=
|
|
549
|
+
for (; a++ <= h; ) f.push(0);
|
|
550
|
+
l = u = 0, r = 1, s %= v, o = s - v + 1;
|
|
567
551
|
} else
|
|
568
552
|
break e;
|
|
569
553
|
else {
|
|
570
|
-
for (l = a = f[
|
|
571
|
-
s %=
|
|
554
|
+
for (l = a = f[h], r = 1; a >= 10; a /= 10) r++;
|
|
555
|
+
s %= v, o = s - v + r, u = o < 0 ? 0 : l / k(10, r - o - 1) % 10 | 0;
|
|
572
556
|
}
|
|
573
|
-
if (i = i || t < 0 || f[
|
|
574
|
-
(s > 0 ? o > 0 ? l /
|
|
575
|
-
return f.length = 0, c ? (t -= e.e + 1, f[0] =
|
|
576
|
-
if (s == 0 ? (f.length =
|
|
557
|
+
if (i = i || t < 0 || f[h + 1] !== void 0 || (o < 0 ? l : l % k(10, r - o - 1)), c = n < 4 ? (u || i) && (n == 0 || n == (e.s < 0 ? 3 : 2)) : u > 5 || u == 5 && (n == 4 || i || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
558
|
+
(s > 0 ? o > 0 ? l / k(10, r - o) : 0 : f[h - 1]) % 10 & 1 || n == (e.s < 0 ? 8 : 7)), t < 1 || !f[0])
|
|
559
|
+
return f.length = 0, c ? (t -= e.e + 1, f[0] = k(10, (v - t % v) % v), e.e = -t || 0) : f[0] = e.e = 0, e;
|
|
560
|
+
if (s == 0 ? (f.length = h, a = 1, h--) : (f.length = h + 1, a = k(10, v - s), f[h] = o > 0 ? (l / k(10, r - o) % k(10, o) | 0) * a : 0), c)
|
|
577
561
|
for (; ; )
|
|
578
|
-
if (
|
|
562
|
+
if (h == 0) {
|
|
579
563
|
for (s = 1, o = f[0]; o >= 10; o /= 10) s++;
|
|
580
564
|
for (o = f[0] += a, a = 1; o >= 10; o /= 10) a++;
|
|
581
|
-
s != a && (e.e++, f[0] ==
|
|
565
|
+
s != a && (e.e++, f[0] == V && (f[0] = 1));
|
|
582
566
|
break;
|
|
583
567
|
} else {
|
|
584
|
-
if (f[
|
|
585
|
-
f[
|
|
568
|
+
if (f[h] += a, f[h] != V) break;
|
|
569
|
+
f[h--] = 0, a = 1;
|
|
586
570
|
}
|
|
587
571
|
for (s = f.length; f[--s] === 0; ) f.pop();
|
|
588
572
|
}
|
|
589
|
-
return
|
|
573
|
+
return I && (e.e > m.maxE ? (e.d = null, e.e = NaN) : e.e < m.minE && (e.e = 0, e.d = [0])), e;
|
|
590
574
|
}
|
|
591
|
-
function
|
|
592
|
-
if (!e.isFinite()) return
|
|
593
|
-
var i, r = e.e, s =
|
|
594
|
-
return t ? (n && (i = n - o) > 0 ? s = s.charAt(0) + "." + s.slice(1) +
|
|
575
|
+
function $(e, t, n) {
|
|
576
|
+
if (!e.isFinite()) return gt(e);
|
|
577
|
+
var i, r = e.e, s = b(e.d), o = s.length;
|
|
578
|
+
return t ? (n && (i = n - o) > 0 ? s = s.charAt(0) + "." + s.slice(1) + H(i) : o > 1 && (s = s.charAt(0) + "." + s.slice(1)), s = s + (e.e < 0 ? "e" : "e+") + e.e) : r < 0 ? (s = "0." + H(-r - 1) + s, n && (i = n - o) > 0 && (s += H(i))) : r >= o ? (s += H(r + 1 - o), n && (i = n - r - 1) > 0 && (s = s + "." + H(i))) : ((i = r + 1) < o && (s = s.slice(0, i) + "." + s.slice(i)), n && (i = n - o) > 0 && (r + 1 === o && (s += "."), s += H(i))), s;
|
|
595
579
|
}
|
|
596
|
-
function
|
|
580
|
+
function Ie(e, t) {
|
|
597
581
|
var n = e[0];
|
|
598
|
-
for (t *=
|
|
582
|
+
for (t *= v; n >= 10; n /= 10) t++;
|
|
599
583
|
return t;
|
|
600
584
|
}
|
|
601
|
-
function
|
|
602
|
-
if (t >
|
|
603
|
-
throw
|
|
604
|
-
return
|
|
585
|
+
function we(e, t, n) {
|
|
586
|
+
if (t > Pt)
|
|
587
|
+
throw I = !0, n && (e.precision = n), Error(ut);
|
|
588
|
+
return T(new e(Ne), t, 1, !0);
|
|
605
589
|
}
|
|
606
|
-
function
|
|
607
|
-
if (t >
|
|
608
|
-
return
|
|
590
|
+
function j(e, t, n) {
|
|
591
|
+
if (t > Fe) throw Error(ut);
|
|
592
|
+
return T(new e(Te), t, n, !0);
|
|
609
593
|
}
|
|
610
|
-
function
|
|
611
|
-
var t = e.length - 1, n = t *
|
|
594
|
+
function dt(e) {
|
|
595
|
+
var t = e.length - 1, n = t * v + 1;
|
|
612
596
|
if (t = e[t], t) {
|
|
613
597
|
for (; t % 10 == 0; t /= 10) n--;
|
|
614
598
|
for (t = e[0]; t >= 10; t /= 10) n++;
|
|
615
599
|
}
|
|
616
600
|
return n;
|
|
617
601
|
}
|
|
618
|
-
function
|
|
602
|
+
function H(e) {
|
|
619
603
|
for (var t = ""; e--; ) t += "0";
|
|
620
604
|
return t;
|
|
621
605
|
}
|
|
622
|
-
function
|
|
623
|
-
var r, s = new e(1), o = Math.ceil(i /
|
|
624
|
-
for (
|
|
625
|
-
if (n % 2 && (s = s.times(t),
|
|
606
|
+
function pt(e, t, n, i) {
|
|
607
|
+
var r, s = new e(1), o = Math.ceil(i / v + 4);
|
|
608
|
+
for (I = !1; ; ) {
|
|
609
|
+
if (n % 2 && (s = s.times(t), Qe(s.d, o) && (r = !0)), n = F(n / 2), n === 0) {
|
|
626
610
|
n = s.d.length - 1, r && s.d[n] === 0 && ++s.d[n];
|
|
627
611
|
break;
|
|
628
612
|
}
|
|
629
|
-
t = t.times(t),
|
|
613
|
+
t = t.times(t), Qe(t.d, o);
|
|
630
614
|
}
|
|
631
|
-
return
|
|
615
|
+
return I = !0, s;
|
|
632
616
|
}
|
|
633
|
-
function
|
|
617
|
+
function Je(e) {
|
|
634
618
|
return e.d[e.d.length - 1] & 1;
|
|
635
619
|
}
|
|
636
|
-
function
|
|
637
|
-
for (var i, r = new e(t[0]),
|
|
638
|
-
if (
|
|
639
|
-
|
|
640
|
-
else {
|
|
641
|
-
r = i;
|
|
620
|
+
function mt(e, t, n) {
|
|
621
|
+
for (var i, r, s = new e(t[0]), o = 0; ++o < t.length; ) {
|
|
622
|
+
if (r = new e(t[o]), !r.s) {
|
|
623
|
+
s = r;
|
|
642
624
|
break;
|
|
643
625
|
}
|
|
644
|
-
|
|
626
|
+
i = s.cmp(r), (i === n || i === 0 && s.s === n) && (s = r);
|
|
627
|
+
}
|
|
628
|
+
return s;
|
|
645
629
|
}
|
|
646
|
-
function
|
|
647
|
-
var n, i, r, s, o, a, u, c = 0, l = 0, f = 0,
|
|
630
|
+
function Me(e, t) {
|
|
631
|
+
var n, i, r, s, o, a, u, c = 0, l = 0, f = 0, h = e.constructor, m = h.rounding, N = h.precision;
|
|
648
632
|
if (!e.d || !e.d[0] || e.e > 17)
|
|
649
|
-
return new
|
|
650
|
-
for (t == null ? (
|
|
633
|
+
return new h(e.d ? e.d[0] ? e.s < 0 ? 0 : 1 / 0 : 1 : e.s ? e.s < 0 ? 0 : e : NaN);
|
|
634
|
+
for (t == null ? (I = !1, u = N) : u = t, a = new h(0.03125); e.e > -2; )
|
|
651
635
|
e = e.times(a), f += 5;
|
|
652
|
-
for (i = Math.log(
|
|
653
|
-
if (s =
|
|
654
|
-
for (r = f; r--; ) o =
|
|
636
|
+
for (i = Math.log(k(2, f)) / Math.LN10 * 2 + 5 | 0, u += i, n = s = o = new h(1), h.precision = u; ; ) {
|
|
637
|
+
if (s = T(s.times(e), u, 1), n = n.times(++l), a = o.plus(x(s, n, u, 1)), b(a.d).slice(0, u) === b(o.d).slice(0, u)) {
|
|
638
|
+
for (r = f; r--; ) o = T(o.times(o), u, 1);
|
|
655
639
|
if (t == null)
|
|
656
|
-
if (c < 3 &&
|
|
657
|
-
|
|
640
|
+
if (c < 3 && ae(o.d, u - i, m, c))
|
|
641
|
+
h.precision = u += 10, n = s = a = new h(1), l = 0, c++;
|
|
658
642
|
else
|
|
659
|
-
return
|
|
643
|
+
return T(o, h.precision = N, m, I = !0);
|
|
660
644
|
else
|
|
661
|
-
return
|
|
645
|
+
return h.precision = N, o;
|
|
662
646
|
}
|
|
663
647
|
o = a;
|
|
664
648
|
}
|
|
665
649
|
}
|
|
666
|
-
function
|
|
667
|
-
var n, i, r, s, o, a, u, c, l, f,
|
|
668
|
-
if (E.s < 0 || !
|
|
669
|
-
return new
|
|
670
|
-
if (t == null ? (
|
|
650
|
+
function J(e, t) {
|
|
651
|
+
var n, i, r, s, o, a, u, c, l, f, h, m = 1, N = 10, E = e, C = E.d, y = E.constructor, M = y.rounding, A = y.precision;
|
|
652
|
+
if (E.s < 0 || !C || !C[0] || !E.e && C[0] == 1 && C.length == 1)
|
|
653
|
+
return new y(C && !C[0] ? -1 / 0 : E.s != 1 ? NaN : C ? 0 : E);
|
|
654
|
+
if (t == null ? (I = !1, l = A) : l = t, y.precision = l += N, n = b(C), i = n.charAt(0), Math.abs(s = E.e) < 15e14) {
|
|
671
655
|
for (; i < 7 && i != 1 || i == 1 && n.charAt(1) > 3; )
|
|
672
|
-
E = E.times(e), n =
|
|
673
|
-
s = E.e, i > 1 ? (E = new
|
|
656
|
+
E = E.times(e), n = b(E.d), i = n.charAt(0), m++;
|
|
657
|
+
s = E.e, i > 1 ? (E = new y("0." + n), s++) : E = new y(i + "." + n.slice(1));
|
|
674
658
|
} else
|
|
675
|
-
return c =
|
|
676
|
-
for (f = E, u = o = E =
|
|
677
|
-
if (o =
|
|
678
|
-
if (u = u.times(2), s !== 0 && (u = u.plus(
|
|
679
|
-
if (
|
|
680
|
-
|
|
659
|
+
return c = we(y, l + 2, A).times(s + ""), E = J(new y(i + "." + n.slice(1)), l - N).plus(c), y.precision = A, t == null ? T(E, A, M, I = !0) : E;
|
|
660
|
+
for (f = E, u = o = E = x(E.minus(1), E.plus(1), l, 1), h = T(E.times(E), l, 1), r = 3; ; ) {
|
|
661
|
+
if (o = T(o.times(h), l, 1), c = u.plus(x(o, new y(r), l, 1)), b(c.d).slice(0, l) === b(u.d).slice(0, l))
|
|
662
|
+
if (u = u.times(2), s !== 0 && (u = u.plus(we(y, l + 2, A).times(s + ""))), u = x(u, new y(m), l, 1), t == null)
|
|
663
|
+
if (ae(u.d, l - N, M, a))
|
|
664
|
+
y.precision = l += N, c = o = E = x(f.minus(1), f.plus(1), l, 1), h = T(E.times(E), l, 1), r = a = 1;
|
|
681
665
|
else
|
|
682
|
-
return
|
|
666
|
+
return T(u, y.precision = A, M, I = !0);
|
|
683
667
|
else
|
|
684
|
-
return
|
|
668
|
+
return y.precision = A, u;
|
|
685
669
|
u = c, r += 2;
|
|
686
670
|
}
|
|
687
671
|
}
|
|
688
|
-
function
|
|
672
|
+
function gt(e) {
|
|
689
673
|
return String(e.s * e.s / 0);
|
|
690
674
|
}
|
|
691
|
-
function
|
|
675
|
+
function pe(e, t) {
|
|
692
676
|
var n, i, r;
|
|
693
677
|
for ((n = t.indexOf(".")) > -1 && (t = t.replace(".", "")), (i = t.search(/e/i)) > 0 ? (n < 0 && (n = i), n += +t.slice(i + 1), t = t.substring(0, i)) : n < 0 && (n = t.length), i = 0; t.charCodeAt(i) === 48; i++) ;
|
|
694
678
|
for (r = t.length; t.charCodeAt(r - 1) === 48; --r) ;
|
|
695
679
|
if (t = t.slice(i, r), t) {
|
|
696
|
-
if (r -= i, e.e = n = n - i - 1, e.d = [], i = (n + 1) %
|
|
697
|
-
for (i && e.d.push(+t.slice(0, i)), r -=
|
|
698
|
-
t = t.slice(i), i =
|
|
680
|
+
if (r -= i, e.e = n = n - i - 1, e.d = [], i = (n + 1) % v, n < 0 && (i += v), i < r) {
|
|
681
|
+
for (i && e.d.push(+t.slice(0, i)), r -= v; i < r; ) e.d.push(+t.slice(i, i += v));
|
|
682
|
+
t = t.slice(i), i = v - t.length;
|
|
699
683
|
} else
|
|
700
684
|
i -= r;
|
|
701
685
|
for (; i--; ) t += "0";
|
|
702
|
-
e.d.push(+t),
|
|
686
|
+
e.d.push(+t), I && (e.e > e.constructor.maxE ? (e.d = null, e.e = NaN) : e.e < e.constructor.minE && (e.e = 0, e.d = [0]));
|
|
703
687
|
} else
|
|
704
688
|
e.e = 0, e.d = [0];
|
|
705
689
|
return e;
|
|
706
690
|
}
|
|
707
|
-
function
|
|
691
|
+
function Bt(e, t) {
|
|
708
692
|
var n, i, r, s, o, a, u, c, l;
|
|
709
693
|
if (t.indexOf("_") > -1) {
|
|
710
|
-
if (t = t.replace(/(\d)_(?=\d)/g, "$1"),
|
|
694
|
+
if (t = t.replace(/(\d)_(?=\d)/g, "$1"), ht.test(t)) return pe(e, t);
|
|
711
695
|
} else if (t === "Infinity" || t === "NaN")
|
|
712
696
|
return +t || (e.s = NaN), e.e = NaN, e.d = null, e;
|
|
713
|
-
if (
|
|
697
|
+
if (Lt.test(t))
|
|
714
698
|
n = 16, t = t.toLowerCase();
|
|
715
|
-
else if (
|
|
699
|
+
else if (bt.test(t))
|
|
716
700
|
n = 2;
|
|
717
|
-
else if (
|
|
701
|
+
else if (Ft.test(t))
|
|
718
702
|
n = 8;
|
|
719
703
|
else
|
|
720
|
-
throw Error(
|
|
721
|
-
for (s = t.search(/p/i), s > 0 ? (u = +t.slice(s + 1), t = t.substring(2, s)) : t = t.slice(2), s = t.indexOf("."), o = s >= 0, i = e.constructor, o && (t = t.replace(".", ""), a = t.length, s = a - s, r =
|
|
722
|
-
return s < 0 ? new i(e.s * 0) : (e.e =
|
|
704
|
+
throw Error(Q + t);
|
|
705
|
+
for (s = t.search(/p/i), s > 0 ? (u = +t.slice(s + 1), t = t.substring(2, s)) : t = t.slice(2), s = t.indexOf("."), o = s >= 0, i = e.constructor, o && (t = t.replace(".", ""), a = t.length, s = a - s, r = pt(i, new i(n), s, s * 2)), c = de(t, n, V), l = c.length - 1, s = l; c[s] === 0; --s) c.pop();
|
|
706
|
+
return s < 0 ? new i(e.s * 0) : (e.e = Ie(c, l), e.d = c, I = !1, o && (e = x(e, r, a * 4)), u && (e = e.times(Math.abs(u) < 54 ? k(2, u) : ie.pow(2, u))), I = !0, e);
|
|
723
707
|
}
|
|
724
|
-
function
|
|
708
|
+
function Ut(e, t) {
|
|
725
709
|
var n, i = t.d.length;
|
|
726
710
|
if (i < 3)
|
|
727
|
-
return t.isZero() ? t :
|
|
728
|
-
n = 1.4 * Math.sqrt(i), n = n > 16 ? 16 : n | 0, t = t.times(1 /
|
|
711
|
+
return t.isZero() ? t : ne(e, 2, t, t);
|
|
712
|
+
n = 1.4 * Math.sqrt(i), n = n > 16 ? 16 : n | 0, t = t.times(1 / Oe(5, n)), t = ne(e, 2, t, t);
|
|
729
713
|
for (var r, s = new e(5), o = new e(16), a = new e(20); n--; )
|
|
730
714
|
r = t.times(t), t = t.times(s.plus(r.times(o.times(r).minus(a))));
|
|
731
715
|
return t;
|
|
732
716
|
}
|
|
733
|
-
function
|
|
734
|
-
var s, o, a, u, c = e.precision, l = Math.ceil(c /
|
|
735
|
-
for (
|
|
736
|
-
if (o =
|
|
717
|
+
function ne(e, t, n, i, r) {
|
|
718
|
+
var s, o, a, u, c = e.precision, l = Math.ceil(c / v);
|
|
719
|
+
for (I = !1, u = n.times(n), a = new e(i); ; ) {
|
|
720
|
+
if (o = x(a.times(u), new e(t++ * t++), c, 1), a = r ? i.plus(o) : i.minus(o), i = x(o.times(u), new e(t++ * t++), c, 1), o = a.plus(i), o.d[l] !== void 0) {
|
|
737
721
|
for (s = l; o.d[s] === a.d[s] && s--; ) ;
|
|
738
722
|
if (s == -1) break;
|
|
739
723
|
}
|
|
740
724
|
s = a, a = i, i = o, o = s;
|
|
741
725
|
}
|
|
742
|
-
return
|
|
726
|
+
return I = !0, o.d.length = l + 1, o;
|
|
743
727
|
}
|
|
744
|
-
function
|
|
728
|
+
function Oe(e, t) {
|
|
745
729
|
for (var n = e; --t; ) n *= e;
|
|
746
730
|
return n;
|
|
747
731
|
}
|
|
748
|
-
function
|
|
749
|
-
var n, i = t.s < 0, r =
|
|
732
|
+
function Et(e, t) {
|
|
733
|
+
var n, i = t.s < 0, r = j(e, e.precision, 1), s = r.times(0.5);
|
|
750
734
|
if (t = t.abs(), t.lte(s))
|
|
751
|
-
return
|
|
735
|
+
return G = i ? 4 : 1, t;
|
|
752
736
|
if (n = t.divToInt(r), n.isZero())
|
|
753
|
-
|
|
737
|
+
G = i ? 3 : 2;
|
|
754
738
|
else {
|
|
755
739
|
if (t = t.minus(n.times(r)), t.lte(s))
|
|
756
|
-
return
|
|
757
|
-
|
|
740
|
+
return G = Je(n) ? i ? 2 : 3 : i ? 4 : 1, t;
|
|
741
|
+
G = Je(n) ? i ? 1 : 4 : i ? 3 : 2;
|
|
758
742
|
}
|
|
759
743
|
return t.minus(r).abs();
|
|
760
744
|
}
|
|
761
|
-
function
|
|
762
|
-
var r, s, o, a, u, c, l, f,
|
|
763
|
-
if (
|
|
764
|
-
l =
|
|
745
|
+
function je(e, t, n, i) {
|
|
746
|
+
var r, s, o, a, u, c, l, f, h, m = e.constructor, N = n !== void 0;
|
|
747
|
+
if (N ? (P(n, 1, z), i === void 0 ? i = m.rounding : P(i, 0, 8)) : (n = m.precision, i = m.rounding), !e.isFinite())
|
|
748
|
+
l = gt(e);
|
|
765
749
|
else {
|
|
766
|
-
for (l =
|
|
750
|
+
for (l = $(e), o = l.indexOf("."), N ? (r = 2, t == 16 ? n = n * 4 - 3 : t == 8 && (n = n * 3 - 2)) : r = t, o >= 0 && (l = l.replace(".", ""), h = new m(1), h.e = l.length - o, h.d = de($(h), 10, r), h.e = h.d.length), f = de(l, 10, r), s = u = f.length; f[--u] == 0; ) f.pop();
|
|
767
751
|
if (!f[0])
|
|
768
|
-
l =
|
|
752
|
+
l = N ? "0p+0" : "0";
|
|
769
753
|
else {
|
|
770
|
-
if (o < 0 ? s-- : (e = new
|
|
754
|
+
if (o < 0 ? s-- : (e = new m(e), e.d = f, e.e = s, e = x(e, h, n, i, 0, r), f = e.d, s = e.e, c = ct), o = f[n], a = r / 2, c = c || f[n + 1] !== void 0, c = i < 4 ? (o !== void 0 || c) && (i === 0 || i === (e.s < 0 ? 3 : 2)) : o > a || o === a && (i === 4 || c || i === 6 && f[n - 1] & 1 || i === (e.s < 0 ? 8 : 7)), f.length = n, c)
|
|
771
755
|
for (; ++f[--n] > r - 1; )
|
|
772
756
|
f[n] = 0, n || (++s, f.unshift(1));
|
|
773
757
|
for (u = f.length; !f[u - 1]; --u) ;
|
|
774
|
-
for (o = 0, l = ""; o < u; o++) l +=
|
|
775
|
-
if (
|
|
758
|
+
for (o = 0, l = ""; o < u; o++) l += be.charAt(f[o]);
|
|
759
|
+
if (N) {
|
|
776
760
|
if (u > 1)
|
|
777
761
|
if (t == 16 || t == 8) {
|
|
778
762
|
for (o = t == 16 ? 4 : 3, --u; u % o; u++) l += "0";
|
|
779
|
-
for (f =
|
|
780
|
-
for (o = 1, l = "1."; o < u; o++) l +=
|
|
763
|
+
for (f = de(l, r, t), u = f.length; !f[u - 1]; --u) ;
|
|
764
|
+
for (o = 1, l = "1."; o < u; o++) l += be.charAt(f[o]);
|
|
781
765
|
} else
|
|
782
766
|
l = l.charAt(0) + "." + l.slice(1);
|
|
783
767
|
l = l + (s < 0 ? "p" : "p+") + s;
|
|
@@ -791,103 +775,103 @@ function Ze(e, t, n, i) {
|
|
|
791
775
|
}
|
|
792
776
|
return e.s < 0 ? "-" + l : l;
|
|
793
777
|
}
|
|
794
|
-
function
|
|
778
|
+
function Qe(e, t) {
|
|
795
779
|
if (e.length > t)
|
|
796
780
|
return e.length = t, !0;
|
|
797
781
|
}
|
|
798
|
-
function
|
|
782
|
+
function Vt(e) {
|
|
799
783
|
return new this(e).abs();
|
|
800
784
|
}
|
|
801
|
-
function
|
|
785
|
+
function jt(e) {
|
|
802
786
|
return new this(e).acos();
|
|
803
787
|
}
|
|
804
|
-
function
|
|
788
|
+
function $t(e) {
|
|
805
789
|
return new this(e).acosh();
|
|
806
790
|
}
|
|
807
|
-
function
|
|
791
|
+
function Gt(e, t) {
|
|
808
792
|
return new this(e).plus(t);
|
|
809
793
|
}
|
|
810
|
-
function
|
|
794
|
+
function Yt(e) {
|
|
811
795
|
return new this(e).asin();
|
|
812
796
|
}
|
|
813
|
-
function
|
|
797
|
+
function Ht(e) {
|
|
814
798
|
return new this(e).asinh();
|
|
815
799
|
}
|
|
816
|
-
function
|
|
800
|
+
function Jt(e) {
|
|
817
801
|
return new this(e).atan();
|
|
818
802
|
}
|
|
819
|
-
function
|
|
803
|
+
function Qt(e) {
|
|
820
804
|
return new this(e).atanh();
|
|
821
805
|
}
|
|
822
|
-
function
|
|
806
|
+
function zt(e, t) {
|
|
823
807
|
e = new this(e), t = new this(t);
|
|
824
808
|
var n, i = this.precision, r = this.rounding, s = i + 4;
|
|
825
|
-
return !e.s || !t.s ? n = new this(NaN) : !e.d && !t.d ? (n =
|
|
809
|
+
return !e.s || !t.s ? n = new this(NaN) : !e.d && !t.d ? (n = j(this, s, 1).times(t.s > 0 ? 0.25 : 0.75), n.s = e.s) : !t.d || e.isZero() ? (n = t.s < 0 ? j(this, i, r) : new this(0), n.s = e.s) : !e.d || t.isZero() ? (n = j(this, s, 1).times(0.5), n.s = e.s) : t.s < 0 ? (this.precision = s, this.rounding = 1, n = this.atan(x(e, t, s, 1)), t = j(this, s, 1), this.precision = i, this.rounding = r, n = e.s < 0 ? n.minus(t) : n.plus(t)) : n = this.atan(x(e, t, s, 1)), n;
|
|
826
810
|
}
|
|
827
|
-
function
|
|
811
|
+
function Zt(e) {
|
|
828
812
|
return new this(e).cbrt();
|
|
829
813
|
}
|
|
830
|
-
function
|
|
831
|
-
return
|
|
814
|
+
function Xt(e) {
|
|
815
|
+
return T(e = new this(e), e.e + 1, 2);
|
|
832
816
|
}
|
|
833
|
-
function
|
|
817
|
+
function Wt(e, t, n) {
|
|
834
818
|
return new this(e).clamp(t, n);
|
|
835
819
|
}
|
|
836
|
-
function
|
|
837
|
-
if (!e || typeof e != "object") throw Error(
|
|
820
|
+
function Kt(e) {
|
|
821
|
+
if (!e || typeof e != "object") throw Error(ve + "Object expected");
|
|
838
822
|
var t, n, i, r = e.defaults === !0, s = [
|
|
839
823
|
"precision",
|
|
840
824
|
1,
|
|
841
|
-
|
|
825
|
+
z,
|
|
842
826
|
"rounding",
|
|
843
827
|
0,
|
|
844
828
|
8,
|
|
845
829
|
"toExpNeg",
|
|
846
|
-
-
|
|
830
|
+
-ee,
|
|
847
831
|
0,
|
|
848
832
|
"toExpPos",
|
|
849
833
|
0,
|
|
850
|
-
|
|
834
|
+
ee,
|
|
851
835
|
"maxE",
|
|
852
836
|
0,
|
|
853
|
-
|
|
837
|
+
ee,
|
|
854
838
|
"minE",
|
|
855
|
-
-
|
|
839
|
+
-ee,
|
|
856
840
|
0,
|
|
857
841
|
"modulo",
|
|
858
842
|
0,
|
|
859
843
|
9
|
|
860
844
|
];
|
|
861
845
|
for (t = 0; t < s.length; t += 3)
|
|
862
|
-
if (n = s[t], r && (this[n] =
|
|
863
|
-
if (
|
|
864
|
-
else throw Error(
|
|
865
|
-
if (n = "crypto", r && (this[n] =
|
|
846
|
+
if (n = s[t], r && (this[n] = Le[n]), (i = e[n]) !== void 0)
|
|
847
|
+
if (F(i) === i && i >= s[t + 1] && i <= s[t + 2]) this[n] = i;
|
|
848
|
+
else throw Error(Q + n + ": " + i);
|
|
849
|
+
if (n = "crypto", r && (this[n] = Le[n]), (i = e[n]) !== void 0)
|
|
866
850
|
if (i === !0 || i === !1 || i === 0 || i === 1)
|
|
867
851
|
if (i)
|
|
868
852
|
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
869
853
|
this[n] = !0;
|
|
870
854
|
else
|
|
871
|
-
throw Error(
|
|
855
|
+
throw Error(lt);
|
|
872
856
|
else
|
|
873
857
|
this[n] = !1;
|
|
874
858
|
else
|
|
875
|
-
throw Error(
|
|
859
|
+
throw Error(Q + n + ": " + i);
|
|
876
860
|
return this;
|
|
877
861
|
}
|
|
878
|
-
function
|
|
862
|
+
function en(e) {
|
|
879
863
|
return new this(e).cos();
|
|
880
864
|
}
|
|
881
|
-
function
|
|
865
|
+
function tn(e) {
|
|
882
866
|
return new this(e).cosh();
|
|
883
867
|
}
|
|
884
|
-
function
|
|
868
|
+
function Nt(e) {
|
|
885
869
|
var t, n, i;
|
|
886
870
|
function r(s) {
|
|
887
871
|
var o, a, u, c = this;
|
|
888
872
|
if (!(c instanceof r)) return new r(s);
|
|
889
|
-
if (c.constructor = r,
|
|
890
|
-
c.s = s.s,
|
|
873
|
+
if (c.constructor = r, ze(s)) {
|
|
874
|
+
c.s = s.s, I ? !s.d || s.e > r.maxE ? (c.e = NaN, c.d = null) : s.e < r.minE ? (c.e = 0, c.d = [0]) : (c.e = s.e, c.d = s.d.slice()) : (c.e = s.e, c.d = s.d ? s.d.slice() : s.d);
|
|
891
875
|
return;
|
|
892
876
|
}
|
|
893
877
|
if (u = typeof s, u === "number") {
|
|
@@ -897,75 +881,79 @@ function wt(e) {
|
|
|
897
881
|
}
|
|
898
882
|
if (s < 0 ? (s = -s, c.s = -1) : c.s = 1, s === ~~s && s < 1e7) {
|
|
899
883
|
for (o = 0, a = s; a >= 10; a /= 10) o++;
|
|
900
|
-
|
|
884
|
+
I ? o > r.maxE ? (c.e = NaN, c.d = null) : o < r.minE ? (c.e = 0, c.d = [0]) : (c.e = o, c.d = [s]) : (c.e = o, c.d = [s]);
|
|
901
885
|
return;
|
|
902
|
-
}
|
|
886
|
+
}
|
|
887
|
+
if (s * 0 !== 0) {
|
|
903
888
|
s || (c.s = NaN), c.e = NaN, c.d = null;
|
|
904
889
|
return;
|
|
905
890
|
}
|
|
906
|
-
return
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
|
|
891
|
+
return pe(c, s.toString());
|
|
892
|
+
}
|
|
893
|
+
if (u === "string")
|
|
894
|
+
return (a = s.charCodeAt(0)) === 45 ? (s = s.slice(1), c.s = -1) : (a === 43 && (s = s.slice(1)), c.s = 1), ht.test(s) ? pe(c, s) : Bt(c, s);
|
|
895
|
+
if (u === "bigint")
|
|
896
|
+
return s < 0 ? (s = -s, c.s = -1) : c.s = 1, pe(c, s.toString());
|
|
897
|
+
throw Error(Q + s);
|
|
910
898
|
}
|
|
911
|
-
if (r.prototype =
|
|
899
|
+
if (r.prototype = p, r.ROUND_UP = 0, r.ROUND_DOWN = 1, r.ROUND_CEIL = 2, r.ROUND_FLOOR = 3, r.ROUND_HALF_UP = 4, r.ROUND_HALF_DOWN = 5, r.ROUND_HALF_EVEN = 6, r.ROUND_HALF_CEIL = 7, r.ROUND_HALF_FLOOR = 8, r.EUCLID = 9, r.config = r.set = Kt, r.clone = Nt, r.isDecimal = ze, r.abs = Vt, r.acos = jt, r.acosh = $t, r.add = Gt, r.asin = Yt, r.asinh = Ht, r.atan = Jt, r.atanh = Qt, r.atan2 = zt, r.cbrt = Zt, r.ceil = Xt, r.clamp = Wt, r.cos = en, r.cosh = tn, r.div = nn, r.exp = rn, r.floor = sn, r.hypot = on, r.ln = an, r.log = cn, r.log10 = ln, r.log2 = un, r.max = fn, r.min = hn, r.mod = dn, r.mul = pn, r.pow = mn, r.random = gn, r.round = En, r.sign = Nn, r.sin = Tn, r.sinh = wn, r.sqrt = vn, r.sub = In, r.sum = On, r.tan = An, r.tanh = yn, r.trunc = xn, e === void 0 && (e = {}), e && e.defaults !== !0)
|
|
912
900
|
for (i = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], t = 0; t < i.length; ) e.hasOwnProperty(n = i[t++]) || (e[n] = this[n]);
|
|
913
901
|
return r.config(e), r;
|
|
914
902
|
}
|
|
915
|
-
function
|
|
903
|
+
function nn(e, t) {
|
|
916
904
|
return new this(e).div(t);
|
|
917
905
|
}
|
|
918
|
-
function
|
|
906
|
+
function rn(e) {
|
|
919
907
|
return new this(e).exp();
|
|
920
908
|
}
|
|
921
|
-
function
|
|
922
|
-
return
|
|
909
|
+
function sn(e) {
|
|
910
|
+
return T(e = new this(e), e.e + 1, 3);
|
|
923
911
|
}
|
|
924
|
-
function
|
|
912
|
+
function on() {
|
|
925
913
|
var e, t, n = new this(0);
|
|
926
|
-
for (
|
|
914
|
+
for (I = !1, e = 0; e < arguments.length; )
|
|
927
915
|
if (t = new this(arguments[e++]), t.d)
|
|
928
916
|
n.d && (n = n.plus(t.times(t)));
|
|
929
917
|
else {
|
|
930
918
|
if (t.s)
|
|
931
|
-
return
|
|
919
|
+
return I = !0, new this(1 / 0);
|
|
932
920
|
n = t;
|
|
933
921
|
}
|
|
934
|
-
return
|
|
922
|
+
return I = !0, n.sqrt();
|
|
935
923
|
}
|
|
936
|
-
function
|
|
937
|
-
return e instanceof
|
|
924
|
+
function ze(e) {
|
|
925
|
+
return e instanceof ie || e && e.toStringTag === ft || !1;
|
|
938
926
|
}
|
|
939
|
-
function
|
|
927
|
+
function an(e) {
|
|
940
928
|
return new this(e).ln();
|
|
941
929
|
}
|
|
942
|
-
function
|
|
930
|
+
function cn(e, t) {
|
|
943
931
|
return new this(e).log(t);
|
|
944
932
|
}
|
|
945
|
-
function
|
|
933
|
+
function un(e) {
|
|
946
934
|
return new this(e).log(2);
|
|
947
935
|
}
|
|
948
|
-
function
|
|
936
|
+
function ln(e) {
|
|
949
937
|
return new this(e).log(10);
|
|
950
938
|
}
|
|
951
|
-
function
|
|
952
|
-
return
|
|
939
|
+
function fn() {
|
|
940
|
+
return mt(this, arguments, -1);
|
|
953
941
|
}
|
|
954
|
-
function
|
|
955
|
-
return
|
|
942
|
+
function hn() {
|
|
943
|
+
return mt(this, arguments, 1);
|
|
956
944
|
}
|
|
957
|
-
function
|
|
945
|
+
function dn(e, t) {
|
|
958
946
|
return new this(e).mod(t);
|
|
959
947
|
}
|
|
960
|
-
function
|
|
948
|
+
function pn(e, t) {
|
|
961
949
|
return new this(e).mul(t);
|
|
962
950
|
}
|
|
963
|
-
function
|
|
951
|
+
function mn(e, t) {
|
|
964
952
|
return new this(e).pow(t);
|
|
965
953
|
}
|
|
966
|
-
function
|
|
954
|
+
function gn(e) {
|
|
967
955
|
var t, n, i, r, s = 0, o = new this(1), a = [];
|
|
968
|
-
if (e === void 0 ? e = this.precision :
|
|
956
|
+
if (e === void 0 ? e = this.precision : P(e, 1, z), i = Math.ceil(e / v), this.crypto)
|
|
969
957
|
if (crypto.getRandomValues)
|
|
970
958
|
for (t = crypto.getRandomValues(new Uint32Array(i)); s < i; )
|
|
971
959
|
r = t[s], r >= 429e7 ? t[s] = crypto.getRandomValues(new Uint32Array(1))[0] : a[s++] = r % 1e7;
|
|
@@ -974,93 +962,116 @@ function Nn(e) {
|
|
|
974
962
|
r = t[s] + (t[s + 1] << 8) + (t[s + 2] << 16) + ((t[s + 3] & 127) << 24), r >= 214e7 ? crypto.randomBytes(4).copy(t, s) : (a.push(r % 1e7), s += 4);
|
|
975
963
|
s = i / 4;
|
|
976
964
|
} else
|
|
977
|
-
throw Error(
|
|
965
|
+
throw Error(lt);
|
|
978
966
|
else for (; s < i; ) a[s++] = Math.random() * 1e7 | 0;
|
|
979
|
-
for (i = a[--s], e %=
|
|
967
|
+
for (i = a[--s], e %= v, i && e && (r = k(10, v - e), a[s] = (i / r | 0) * r); a[s] === 0; s--) a.pop();
|
|
980
968
|
if (s < 0)
|
|
981
969
|
n = 0, a = [0];
|
|
982
970
|
else {
|
|
983
|
-
for (n = -1; a[0] === 0; n -=
|
|
971
|
+
for (n = -1; a[0] === 0; n -= v) a.shift();
|
|
984
972
|
for (i = 1, r = a[0]; r >= 10; r /= 10) i++;
|
|
985
|
-
i <
|
|
973
|
+
i < v && (n -= v - i);
|
|
986
974
|
}
|
|
987
975
|
return o.e = n, o.d = a, o;
|
|
988
976
|
}
|
|
989
|
-
function
|
|
990
|
-
return
|
|
977
|
+
function En(e) {
|
|
978
|
+
return T(e = new this(e), e.e + 1, this.rounding);
|
|
991
979
|
}
|
|
992
|
-
function
|
|
980
|
+
function Nn(e) {
|
|
993
981
|
return e = new this(e), e.d ? e.d[0] ? e.s : 0 * e.s : e.s || NaN;
|
|
994
982
|
}
|
|
995
|
-
function
|
|
983
|
+
function Tn(e) {
|
|
996
984
|
return new this(e).sin();
|
|
997
985
|
}
|
|
998
986
|
function wn(e) {
|
|
999
987
|
return new this(e).sinh();
|
|
1000
988
|
}
|
|
1001
|
-
function
|
|
989
|
+
function vn(e) {
|
|
1002
990
|
return new this(e).sqrt();
|
|
1003
991
|
}
|
|
1004
|
-
function
|
|
992
|
+
function In(e, t) {
|
|
1005
993
|
return new this(e).sub(t);
|
|
1006
994
|
}
|
|
1007
|
-
function
|
|
995
|
+
function On() {
|
|
1008
996
|
var e = 0, t = arguments, n = new this(t[e]);
|
|
1009
|
-
for (
|
|
1010
|
-
return
|
|
997
|
+
for (I = !1; n.s && ++e < t.length; ) n = n.plus(t[e]);
|
|
998
|
+
return I = !0, T(n, this.precision, this.rounding);
|
|
1011
999
|
}
|
|
1012
|
-
function
|
|
1000
|
+
function An(e) {
|
|
1013
1001
|
return new this(e).tan();
|
|
1014
1002
|
}
|
|
1015
|
-
function
|
|
1003
|
+
function yn(e) {
|
|
1016
1004
|
return new this(e).tanh();
|
|
1017
1005
|
}
|
|
1018
|
-
function
|
|
1019
|
-
return
|
|
1006
|
+
function xn(e) {
|
|
1007
|
+
return T(e = new this(e), e.e + 1, 1);
|
|
1008
|
+
}
|
|
1009
|
+
p[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = p.toString;
|
|
1010
|
+
p[Symbol.toStringTag] = "Decimal";
|
|
1011
|
+
var ie = p.constructor = Nt(Le);
|
|
1012
|
+
Ne = new ie(Ne);
|
|
1013
|
+
Te = new ie(Te);
|
|
1014
|
+
class Z extends Error {
|
|
1015
|
+
response;
|
|
1016
|
+
request;
|
|
1017
|
+
constructor(t, n) {
|
|
1018
|
+
const i = `${Z.extractMessage(t)}: ${JSON.stringify({
|
|
1019
|
+
response: t,
|
|
1020
|
+
request: n
|
|
1021
|
+
})}`;
|
|
1022
|
+
super(i), Object.setPrototypeOf(this, Z.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, Z);
|
|
1023
|
+
}
|
|
1024
|
+
static extractMessage(t) {
|
|
1025
|
+
return t.errors?.[0]?.message ?? `GraphQL Error (Code: ${String(t.status)})`;
|
|
1026
|
+
}
|
|
1020
1027
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1028
|
+
const Ze = (e) => e.toUpperCase(), _e = (e) => typeof e == "function" ? e() : e, Tt = (e, t) => e.map((n, i) => [n, t[i]]), K = (e) => {
|
|
1029
|
+
let t = {};
|
|
1030
|
+
return e instanceof Headers ? t = Dn(e) : Array.isArray(e) ? e.forEach(([n, i]) => {
|
|
1031
|
+
n && i !== void 0 && (t[n] = i);
|
|
1032
|
+
}) : e && (t = e), t;
|
|
1033
|
+
}, Dn = (e) => {
|
|
1027
1034
|
const t = {};
|
|
1028
1035
|
return e.forEach((n, i) => {
|
|
1029
1036
|
t[i] = n;
|
|
1030
1037
|
}), t;
|
|
1031
|
-
},
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1038
|
+
}, _n = (e) => {
|
|
1039
|
+
try {
|
|
1040
|
+
const t = e();
|
|
1041
|
+
return Sn(t) ? t.catch((n) => Xe(n)) : t;
|
|
1042
|
+
} catch (t) {
|
|
1043
|
+
return Xe(t);
|
|
1044
|
+
}
|
|
1045
|
+
}, Xe = (e) => e instanceof Error ? e : new Error(String(e)), Sn = (e) => typeof e == "object" && e !== null && "then" in e && typeof e.then == "function" && "catch" in e && typeof e.catch == "function" && "finally" in e && typeof e.finally == "function", $e = (e) => {
|
|
1046
|
+
throw new Error(`Unhandled case: ${String(e)}`);
|
|
1047
|
+
}, me = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Cn = (e, t) => e.documents ? e : {
|
|
1048
|
+
documents: e,
|
|
1049
|
+
requestHeaders: t,
|
|
1035
1050
|
signal: void 0
|
|
1036
1051
|
}, kn = (e, t, n) => e.query ? e : {
|
|
1037
1052
|
query: e,
|
|
1038
1053
|
variables: t,
|
|
1039
1054
|
requestHeaders: n,
|
|
1040
1055
|
signal: void 0
|
|
1041
|
-
}, Rn = (e, t) => e.documents ? e : {
|
|
1042
|
-
documents: e,
|
|
1043
|
-
requestHeaders: t,
|
|
1044
|
-
signal: void 0
|
|
1045
1056
|
};
|
|
1046
|
-
function
|
|
1057
|
+
function ge(e, t) {
|
|
1047
1058
|
if (!!!e)
|
|
1048
1059
|
throw new Error(t);
|
|
1049
1060
|
}
|
|
1050
|
-
function
|
|
1061
|
+
function Rn(e) {
|
|
1051
1062
|
return typeof e == "object" && e !== null;
|
|
1052
1063
|
}
|
|
1053
|
-
function
|
|
1064
|
+
function bn(e, t) {
|
|
1054
1065
|
if (!!!e)
|
|
1055
1066
|
throw new Error(
|
|
1056
1067
|
"Unexpected invariant triggered."
|
|
1057
1068
|
);
|
|
1058
1069
|
}
|
|
1059
|
-
const
|
|
1060
|
-
function
|
|
1070
|
+
const Ln = /\r\n|[\n\r]/g;
|
|
1071
|
+
function Pe(e, t) {
|
|
1061
1072
|
let n = 0, i = 1;
|
|
1062
|
-
for (const r of e.body.matchAll(
|
|
1063
|
-
if (typeof r.index == "number" ||
|
|
1073
|
+
for (const r of e.body.matchAll(Ln)) {
|
|
1074
|
+
if (typeof r.index == "number" || bn(!1), r.index >= t)
|
|
1064
1075
|
break;
|
|
1065
1076
|
n = r.index + r[0].length, i += 1;
|
|
1066
1077
|
}
|
|
@@ -1069,27 +1080,27 @@ function ze(e, t) {
|
|
|
1069
1080
|
column: t + 1 - n
|
|
1070
1081
|
};
|
|
1071
1082
|
}
|
|
1072
|
-
function
|
|
1073
|
-
return
|
|
1083
|
+
function Fn(e) {
|
|
1084
|
+
return wt(
|
|
1074
1085
|
e.source,
|
|
1075
|
-
|
|
1086
|
+
Pe(e.source, e.start)
|
|
1076
1087
|
);
|
|
1077
1088
|
}
|
|
1078
|
-
function
|
|
1089
|
+
function wt(e, t) {
|
|
1079
1090
|
const n = e.locationOffset.column - 1, i = "".padStart(n) + e.body, r = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, a = t.line === 1 ? n : 0, u = t.column + a, c = `${e.name}:${o}:${u}
|
|
1080
1091
|
`, l = i.split(/\r\n|[\n\r]/g), f = l[r];
|
|
1081
1092
|
if (f.length > 120) {
|
|
1082
|
-
const
|
|
1093
|
+
const h = Math.floor(u / 80), m = u % 80, N = [];
|
|
1083
1094
|
for (let E = 0; E < f.length; E += 80)
|
|
1084
|
-
|
|
1085
|
-
return c +
|
|
1086
|
-
[`${o} |`,
|
|
1087
|
-
...
|
|
1088
|
-
["|", "^".padStart(
|
|
1089
|
-
["|",
|
|
1095
|
+
N.push(f.slice(E, E + 80));
|
|
1096
|
+
return c + We([
|
|
1097
|
+
[`${o} |`, N[0]],
|
|
1098
|
+
...N.slice(1, h + 1).map((E) => ["|", E]),
|
|
1099
|
+
["|", "^".padStart(m)],
|
|
1100
|
+
["|", N[h + 1]]
|
|
1090
1101
|
]);
|
|
1091
1102
|
}
|
|
1092
|
-
return c +
|
|
1103
|
+
return c + We([
|
|
1093
1104
|
// Lines specified like this: ["prefix", "string"],
|
|
1094
1105
|
[`${o - 1} |`, l[r - 1]],
|
|
1095
1106
|
[`${o} |`, f],
|
|
@@ -1097,12 +1108,12 @@ function At(e, t) {
|
|
|
1097
1108
|
[`${o + 1} |`, l[r + 1]]
|
|
1098
1109
|
]);
|
|
1099
1110
|
}
|
|
1100
|
-
function
|
|
1111
|
+
function We(e) {
|
|
1101
1112
|
const t = e.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
|
|
1102
1113
|
return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
|
|
1103
1114
|
`);
|
|
1104
1115
|
}
|
|
1105
|
-
function
|
|
1116
|
+
function Mn(e) {
|
|
1106
1117
|
const t = e[0];
|
|
1107
1118
|
return t == null || "kind" in t || "length" in t ? {
|
|
1108
1119
|
nodes: t,
|
|
@@ -1113,7 +1124,7 @@ function Bn(e) {
|
|
|
1113
1124
|
extensions: e[5]
|
|
1114
1125
|
} : t;
|
|
1115
1126
|
}
|
|
1116
|
-
class
|
|
1127
|
+
class Ge extends Error {
|
|
1117
1128
|
/**
|
|
1118
1129
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
1119
1130
|
* which correspond to this error.
|
|
@@ -1154,18 +1165,18 @@ class Ke extends Error {
|
|
|
1154
1165
|
*/
|
|
1155
1166
|
constructor(t, ...n) {
|
|
1156
1167
|
var i, r, s;
|
|
1157
|
-
const { nodes: o, source: a, positions: u, path: c, originalError: l, extensions: f } =
|
|
1158
|
-
super(t), this.name = "GraphQLError", this.path = c ?? void 0, this.originalError = l ?? void 0, this.nodes =
|
|
1168
|
+
const { nodes: o, source: a, positions: u, path: c, originalError: l, extensions: f } = Mn(n);
|
|
1169
|
+
super(t), this.name = "GraphQLError", this.path = c ?? void 0, this.originalError = l ?? void 0, this.nodes = Ke(
|
|
1159
1170
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
1160
1171
|
);
|
|
1161
|
-
const
|
|
1162
|
-
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((
|
|
1172
|
+
const h = Ke(
|
|
1173
|
+
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((N) => N.loc).filter((N) => N != null)
|
|
1163
1174
|
);
|
|
1164
|
-
this.source = a ?? (
|
|
1165
|
-
const
|
|
1175
|
+
this.source = a ?? (h == null || (r = h[0]) === null || r === void 0 ? void 0 : r.source), this.positions = u ?? h?.map((N) => N.start), this.locations = u && a ? u.map((N) => Pe(a, N)) : h?.map((N) => Pe(N.source, N.start));
|
|
1176
|
+
const m = Rn(
|
|
1166
1177
|
l?.extensions
|
|
1167
1178
|
) ? l?.extensions : void 0;
|
|
1168
|
-
this.extensions = (s = f ??
|
|
1179
|
+
this.extensions = (s = f ?? m) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
1169
1180
|
message: {
|
|
1170
1181
|
writable: !0,
|
|
1171
1182
|
enumerable: !0
|
|
@@ -1189,7 +1200,7 @@ class Ke extends Error {
|
|
|
1189
1200
|
value: l.stack,
|
|
1190
1201
|
writable: !0,
|
|
1191
1202
|
configurable: !0
|
|
1192
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
1203
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, Ge) : Object.defineProperty(this, "stack", {
|
|
1193
1204
|
value: Error().stack,
|
|
1194
1205
|
writable: !0,
|
|
1195
1206
|
configurable: !0
|
|
@@ -1204,12 +1215,12 @@ class Ke extends Error {
|
|
|
1204
1215
|
for (const n of this.nodes)
|
|
1205
1216
|
n.loc && (t += `
|
|
1206
1217
|
|
|
1207
|
-
` +
|
|
1218
|
+
` + Fn(n.loc));
|
|
1208
1219
|
else if (this.source && this.locations)
|
|
1209
1220
|
for (const n of this.locations)
|
|
1210
1221
|
t += `
|
|
1211
1222
|
|
|
1212
|
-
` +
|
|
1223
|
+
` + wt(this.source, n);
|
|
1213
1224
|
return t;
|
|
1214
1225
|
}
|
|
1215
1226
|
toJSON() {
|
|
@@ -1219,16 +1230,16 @@ class Ke extends Error {
|
|
|
1219
1230
|
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;
|
|
1220
1231
|
}
|
|
1221
1232
|
}
|
|
1222
|
-
function
|
|
1233
|
+
function Ke(e) {
|
|
1223
1234
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
1224
1235
|
}
|
|
1225
|
-
function
|
|
1226
|
-
return new
|
|
1236
|
+
function R(e, t, n) {
|
|
1237
|
+
return new Ge(`Syntax Error: ${n}`, {
|
|
1227
1238
|
source: e,
|
|
1228
1239
|
positions: [t]
|
|
1229
1240
|
});
|
|
1230
1241
|
}
|
|
1231
|
-
class
|
|
1242
|
+
class Pn {
|
|
1232
1243
|
/**
|
|
1233
1244
|
* The character offset at which this Node begins.
|
|
1234
1245
|
*/
|
|
@@ -1257,7 +1268,7 @@ class Un {
|
|
|
1257
1268
|
};
|
|
1258
1269
|
}
|
|
1259
1270
|
}
|
|
1260
|
-
class
|
|
1271
|
+
class vt {
|
|
1261
1272
|
/**
|
|
1262
1273
|
* The kind of Token.
|
|
1263
1274
|
*/
|
|
@@ -1387,44 +1398,44 @@ const It = {
|
|
|
1387
1398
|
DirectiveCoordinate: ["name"],
|
|
1388
1399
|
DirectiveArgumentCoordinate: ["name", "argumentName"]
|
|
1389
1400
|
}, qn = new Set(Object.keys(It));
|
|
1390
|
-
function
|
|
1401
|
+
function et(e) {
|
|
1391
1402
|
const t = e?.kind;
|
|
1392
1403
|
return typeof t == "string" && qn.has(t);
|
|
1393
1404
|
}
|
|
1394
|
-
var
|
|
1405
|
+
var te;
|
|
1395
1406
|
(function(e) {
|
|
1396
1407
|
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
1397
|
-
})(
|
|
1398
|
-
var
|
|
1408
|
+
})(te || (te = {}));
|
|
1409
|
+
var qe;
|
|
1399
1410
|
(function(e) {
|
|
1400
1411
|
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";
|
|
1401
|
-
})(
|
|
1412
|
+
})(qe || (qe = {}));
|
|
1402
1413
|
var w;
|
|
1403
1414
|
(function(e) {
|
|
1404
1415
|
e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", e.TYPE_COORDINATE = "TypeCoordinate", e.MEMBER_COORDINATE = "MemberCoordinate", e.ARGUMENT_COORDINATE = "ArgumentCoordinate", e.DIRECTIVE_COORDINATE = "DirectiveCoordinate", e.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
|
|
1405
1416
|
})(w || (w = {}));
|
|
1406
|
-
function
|
|
1417
|
+
function Be(e) {
|
|
1407
1418
|
return e === 9 || e === 32;
|
|
1408
1419
|
}
|
|
1409
|
-
function
|
|
1420
|
+
function ce(e) {
|
|
1410
1421
|
return e >= 48 && e <= 57;
|
|
1411
1422
|
}
|
|
1412
|
-
function
|
|
1423
|
+
function Ot(e) {
|
|
1413
1424
|
return e >= 97 && e <= 122 || // A-Z
|
|
1414
1425
|
e >= 65 && e <= 90;
|
|
1415
1426
|
}
|
|
1416
|
-
function
|
|
1417
|
-
return
|
|
1427
|
+
function At(e) {
|
|
1428
|
+
return Ot(e) || e === 95;
|
|
1418
1429
|
}
|
|
1419
|
-
function
|
|
1420
|
-
return
|
|
1430
|
+
function Bn(e) {
|
|
1431
|
+
return Ot(e) || ce(e) || e === 95;
|
|
1421
1432
|
}
|
|
1422
|
-
function
|
|
1433
|
+
function Un(e) {
|
|
1423
1434
|
var t;
|
|
1424
1435
|
let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
1425
1436
|
for (let o = 0; o < e.length; ++o) {
|
|
1426
1437
|
var s;
|
|
1427
|
-
const a = e[o], u =
|
|
1438
|
+
const a = e[o], u = Vn(a);
|
|
1428
1439
|
u !== a.length && (i = (s = i) !== null && s !== void 0 ? s : o, r = o, o !== 0 && u < n && (n = u));
|
|
1429
1440
|
}
|
|
1430
1441
|
return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
|
|
@@ -1432,28 +1443,28 @@ function jn(e) {
|
|
|
1432
1443
|
r + 1
|
|
1433
1444
|
);
|
|
1434
1445
|
}
|
|
1435
|
-
function
|
|
1446
|
+
function Vn(e) {
|
|
1436
1447
|
let t = 0;
|
|
1437
|
-
for (; t < e.length &&
|
|
1448
|
+
for (; t < e.length && Be(e.charCodeAt(t)); )
|
|
1438
1449
|
++t;
|
|
1439
1450
|
return t;
|
|
1440
1451
|
}
|
|
1441
|
-
function
|
|
1442
|
-
const n = e.replace(/"""/g, '\\"""'), i = n.split(/\r\n|[\n\r]/g), r = i.length === 1, s = i.length > 1 && i.slice(1).every((
|
|
1452
|
+
function jn(e, t) {
|
|
1453
|
+
const n = e.replace(/"""/g, '\\"""'), i = n.split(/\r\n|[\n\r]/g), r = i.length === 1, s = i.length > 1 && i.slice(1).every((m) => m.length === 0 || Be(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, u = e.endsWith("\\"), c = a || u, l = (
|
|
1443
1454
|
// add leading and trailing new lines only if it improves readability
|
|
1444
1455
|
!r || e.length > 70 || c || s || o
|
|
1445
1456
|
);
|
|
1446
1457
|
let f = "";
|
|
1447
|
-
const
|
|
1448
|
-
return (l && !
|
|
1458
|
+
const h = r && Be(e.charCodeAt(0));
|
|
1459
|
+
return (l && !h || s) && (f += `
|
|
1449
1460
|
`), f += n, (l || c) && (f += `
|
|
1450
1461
|
`), '"""' + f + '"""';
|
|
1451
1462
|
}
|
|
1452
|
-
var
|
|
1463
|
+
var d;
|
|
1453
1464
|
(function(e) {
|
|
1454
1465
|
e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.DOT = ".", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
|
|
1455
|
-
})(
|
|
1456
|
-
class
|
|
1466
|
+
})(d || (d = {}));
|
|
1467
|
+
class $n {
|
|
1457
1468
|
/**
|
|
1458
1469
|
* The previously focused non-ignored token.
|
|
1459
1470
|
*/
|
|
@@ -1467,7 +1478,7 @@ class Gn {
|
|
|
1467
1478
|
* The character offset at which the current line begins.
|
|
1468
1479
|
*/
|
|
1469
1480
|
constructor(t) {
|
|
1470
|
-
const n = new
|
|
1481
|
+
const n = new vt(d.SOF, 0, 0, 0, 0);
|
|
1471
1482
|
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
1472
1483
|
}
|
|
1473
1484
|
get [Symbol.toStringTag]() {
|
|
@@ -1485,48 +1496,48 @@ class Gn {
|
|
|
1485
1496
|
*/
|
|
1486
1497
|
lookahead() {
|
|
1487
1498
|
let t = this.token;
|
|
1488
|
-
if (t.kind !==
|
|
1499
|
+
if (t.kind !== d.EOF)
|
|
1489
1500
|
do
|
|
1490
1501
|
if (t.next)
|
|
1491
1502
|
t = t.next;
|
|
1492
1503
|
else {
|
|
1493
|
-
const n =
|
|
1504
|
+
const n = Yn(this, t.end);
|
|
1494
1505
|
t.next = n, n.prev = t, t = n;
|
|
1495
1506
|
}
|
|
1496
|
-
while (t.kind ===
|
|
1507
|
+
while (t.kind === d.COMMENT);
|
|
1497
1508
|
return t;
|
|
1498
1509
|
}
|
|
1499
1510
|
}
|
|
1500
|
-
function
|
|
1501
|
-
return e ===
|
|
1511
|
+
function Gn(e) {
|
|
1512
|
+
return e === d.BANG || e === d.DOLLAR || e === d.AMP || e === d.PAREN_L || e === d.PAREN_R || e === d.DOT || e === d.SPREAD || e === d.COLON || e === d.EQUALS || e === d.AT || e === d.BRACKET_L || e === d.BRACKET_R || e === d.BRACE_L || e === d.PIPE || e === d.BRACE_R;
|
|
1502
1513
|
}
|
|
1503
|
-
function
|
|
1514
|
+
function re(e) {
|
|
1504
1515
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
1505
1516
|
}
|
|
1506
|
-
function
|
|
1507
|
-
return
|
|
1517
|
+
function Ae(e, t) {
|
|
1518
|
+
return yt(e.charCodeAt(t)) && xt(e.charCodeAt(t + 1));
|
|
1508
1519
|
}
|
|
1509
|
-
function
|
|
1520
|
+
function yt(e) {
|
|
1510
1521
|
return e >= 55296 && e <= 56319;
|
|
1511
1522
|
}
|
|
1512
|
-
function
|
|
1523
|
+
function xt(e) {
|
|
1513
1524
|
return e >= 56320 && e <= 57343;
|
|
1514
1525
|
}
|
|
1515
|
-
function
|
|
1526
|
+
function X(e, t) {
|
|
1516
1527
|
const n = e.source.body.codePointAt(t);
|
|
1517
1528
|
if (n === void 0)
|
|
1518
|
-
return
|
|
1529
|
+
return d.EOF;
|
|
1519
1530
|
if (n >= 32 && n <= 126) {
|
|
1520
1531
|
const i = String.fromCodePoint(n);
|
|
1521
1532
|
return i === '"' ? `'"'` : `"${i}"`;
|
|
1522
1533
|
}
|
|
1523
1534
|
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
1524
1535
|
}
|
|
1525
|
-
function
|
|
1536
|
+
function S(e, t, n, i, r) {
|
|
1526
1537
|
const s = e.line, o = 1 + n - e.lineStart;
|
|
1527
|
-
return new
|
|
1538
|
+
return new vt(t, n, i, s, o, r);
|
|
1528
1539
|
}
|
|
1529
|
-
function
|
|
1540
|
+
function Yn(e, t) {
|
|
1530
1541
|
const n = e.source.body, i = n.length;
|
|
1531
1542
|
let r = t;
|
|
1532
1543
|
for (; r < i; ) {
|
|
@@ -1567,7 +1578,7 @@ function Jn(e, t) {
|
|
|
1567
1578
|
continue;
|
|
1568
1579
|
// Comment
|
|
1569
1580
|
case 35:
|
|
1570
|
-
return
|
|
1581
|
+
return Hn(e, r);
|
|
1571
1582
|
// Token ::
|
|
1572
1583
|
// - Punctuator
|
|
1573
1584
|
// - Name
|
|
@@ -1577,169 +1588,169 @@ function Jn(e, t) {
|
|
|
1577
1588
|
//
|
|
1578
1589
|
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
1579
1590
|
case 33:
|
|
1580
|
-
return
|
|
1591
|
+
return S(e, d.BANG, r, r + 1);
|
|
1581
1592
|
case 36:
|
|
1582
|
-
return
|
|
1593
|
+
return S(e, d.DOLLAR, r, r + 1);
|
|
1583
1594
|
case 38:
|
|
1584
|
-
return
|
|
1595
|
+
return S(e, d.AMP, r, r + 1);
|
|
1585
1596
|
case 40:
|
|
1586
|
-
return
|
|
1597
|
+
return S(e, d.PAREN_L, r, r + 1);
|
|
1587
1598
|
case 41:
|
|
1588
|
-
return
|
|
1599
|
+
return S(e, d.PAREN_R, r, r + 1);
|
|
1589
1600
|
case 46:
|
|
1590
1601
|
if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
|
|
1591
|
-
return
|
|
1602
|
+
return S(e, d.SPREAD, r, r + 3);
|
|
1592
1603
|
break;
|
|
1593
1604
|
case 58:
|
|
1594
|
-
return
|
|
1605
|
+
return S(e, d.COLON, r, r + 1);
|
|
1595
1606
|
case 61:
|
|
1596
|
-
return
|
|
1607
|
+
return S(e, d.EQUALS, r, r + 1);
|
|
1597
1608
|
case 64:
|
|
1598
|
-
return
|
|
1609
|
+
return S(e, d.AT, r, r + 1);
|
|
1599
1610
|
case 91:
|
|
1600
|
-
return
|
|
1611
|
+
return S(e, d.BRACKET_L, r, r + 1);
|
|
1601
1612
|
case 93:
|
|
1602
|
-
return
|
|
1613
|
+
return S(e, d.BRACKET_R, r, r + 1);
|
|
1603
1614
|
case 123:
|
|
1604
|
-
return
|
|
1615
|
+
return S(e, d.BRACE_L, r, r + 1);
|
|
1605
1616
|
case 124:
|
|
1606
|
-
return
|
|
1617
|
+
return S(e, d.PIPE, r, r + 1);
|
|
1607
1618
|
case 125:
|
|
1608
|
-
return
|
|
1619
|
+
return S(e, d.BRACE_R, r, r + 1);
|
|
1609
1620
|
// StringValue
|
|
1610
1621
|
case 34:
|
|
1611
|
-
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ?
|
|
1622
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Wn(e, r) : Qn(e, r);
|
|
1612
1623
|
}
|
|
1613
|
-
if (
|
|
1614
|
-
return
|
|
1615
|
-
if (
|
|
1616
|
-
return
|
|
1617
|
-
throw
|
|
1624
|
+
if (ce(s) || s === 45)
|
|
1625
|
+
return Jn(e, r, s);
|
|
1626
|
+
if (At(s))
|
|
1627
|
+
return Kn(e, r);
|
|
1628
|
+
throw R(
|
|
1618
1629
|
e.source,
|
|
1619
1630
|
r,
|
|
1620
|
-
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` :
|
|
1631
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(s) || Ae(n, r) ? `Unexpected character: ${X(e, r)}.` : `Invalid character: ${X(e, r)}.`
|
|
1621
1632
|
);
|
|
1622
1633
|
}
|
|
1623
|
-
return
|
|
1634
|
+
return S(e, d.EOF, i, i);
|
|
1624
1635
|
}
|
|
1625
|
-
function
|
|
1636
|
+
function Hn(e, t) {
|
|
1626
1637
|
const n = e.source.body, i = n.length;
|
|
1627
1638
|
let r = t + 1;
|
|
1628
1639
|
for (; r < i; ) {
|
|
1629
1640
|
const s = n.charCodeAt(r);
|
|
1630
1641
|
if (s === 10 || s === 13)
|
|
1631
1642
|
break;
|
|
1632
|
-
if (
|
|
1643
|
+
if (re(s))
|
|
1633
1644
|
++r;
|
|
1634
|
-
else if (
|
|
1645
|
+
else if (Ae(n, r))
|
|
1635
1646
|
r += 2;
|
|
1636
1647
|
else
|
|
1637
1648
|
break;
|
|
1638
1649
|
}
|
|
1639
|
-
return
|
|
1650
|
+
return S(
|
|
1640
1651
|
e,
|
|
1641
|
-
|
|
1652
|
+
d.COMMENT,
|
|
1642
1653
|
t,
|
|
1643
1654
|
r,
|
|
1644
1655
|
n.slice(t + 1, r)
|
|
1645
1656
|
);
|
|
1646
1657
|
}
|
|
1647
|
-
function
|
|
1658
|
+
function Jn(e, t, n) {
|
|
1648
1659
|
const i = e.source.body;
|
|
1649
1660
|
let r = t, s = n, o = !1;
|
|
1650
1661
|
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
1651
|
-
if (s = i.charCodeAt(++r),
|
|
1652
|
-
throw
|
|
1662
|
+
if (s = i.charCodeAt(++r), ce(s))
|
|
1663
|
+
throw R(
|
|
1653
1664
|
e.source,
|
|
1654
1665
|
r,
|
|
1655
|
-
`Invalid number, unexpected digit after 0: ${
|
|
1666
|
+
`Invalid number, unexpected digit after 0: ${X(
|
|
1656
1667
|
e,
|
|
1657
1668
|
r
|
|
1658
1669
|
)}.`
|
|
1659
1670
|
);
|
|
1660
1671
|
} else
|
|
1661
|
-
r =
|
|
1662
|
-
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r =
|
|
1663
|
-
throw
|
|
1672
|
+
r = Se(e, r, s), s = i.charCodeAt(r);
|
|
1673
|
+
if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = Se(e, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = Se(e, r, s), s = i.charCodeAt(r)), s === 46 || At(s))
|
|
1674
|
+
throw R(
|
|
1664
1675
|
e.source,
|
|
1665
1676
|
r,
|
|
1666
|
-
`Invalid number, expected digit but got: ${
|
|
1677
|
+
`Invalid number, expected digit but got: ${X(
|
|
1667
1678
|
e,
|
|
1668
1679
|
r
|
|
1669
1680
|
)}.`
|
|
1670
1681
|
);
|
|
1671
|
-
return
|
|
1682
|
+
return S(
|
|
1672
1683
|
e,
|
|
1673
|
-
o ?
|
|
1684
|
+
o ? d.FLOAT : d.INT,
|
|
1674
1685
|
t,
|
|
1675
1686
|
r,
|
|
1676
1687
|
i.slice(t, r)
|
|
1677
1688
|
);
|
|
1678
1689
|
}
|
|
1679
|
-
function
|
|
1680
|
-
if (!
|
|
1681
|
-
throw
|
|
1690
|
+
function Se(e, t, n) {
|
|
1691
|
+
if (!ce(n))
|
|
1692
|
+
throw R(
|
|
1682
1693
|
e.source,
|
|
1683
1694
|
t,
|
|
1684
|
-
`Invalid number, expected digit but got: ${
|
|
1695
|
+
`Invalid number, expected digit but got: ${X(
|
|
1685
1696
|
e,
|
|
1686
1697
|
t
|
|
1687
1698
|
)}.`
|
|
1688
1699
|
);
|
|
1689
1700
|
const i = e.source.body;
|
|
1690
1701
|
let r = t + 1;
|
|
1691
|
-
for (;
|
|
1702
|
+
for (; ce(i.charCodeAt(r)); )
|
|
1692
1703
|
++r;
|
|
1693
1704
|
return r;
|
|
1694
1705
|
}
|
|
1695
|
-
function
|
|
1706
|
+
function Qn(e, t) {
|
|
1696
1707
|
const n = e.source.body, i = n.length;
|
|
1697
1708
|
let r = t + 1, s = r, o = "";
|
|
1698
1709
|
for (; r < i; ) {
|
|
1699
1710
|
const a = n.charCodeAt(r);
|
|
1700
1711
|
if (a === 34)
|
|
1701
|
-
return o += n.slice(s, r),
|
|
1712
|
+
return o += n.slice(s, r), S(e, d.STRING, t, r + 1, o);
|
|
1702
1713
|
if (a === 92) {
|
|
1703
1714
|
o += n.slice(s, r);
|
|
1704
|
-
const u = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ?
|
|
1715
|
+
const u = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? zn(e, r) : Zn(e, r) : Xn(e, r);
|
|
1705
1716
|
o += u.value, r += u.size, s = r;
|
|
1706
1717
|
continue;
|
|
1707
1718
|
}
|
|
1708
1719
|
if (a === 10 || a === 13)
|
|
1709
1720
|
break;
|
|
1710
|
-
if (
|
|
1721
|
+
if (re(a))
|
|
1711
1722
|
++r;
|
|
1712
|
-
else if (
|
|
1723
|
+
else if (Ae(n, r))
|
|
1713
1724
|
r += 2;
|
|
1714
1725
|
else
|
|
1715
|
-
throw
|
|
1726
|
+
throw R(
|
|
1716
1727
|
e.source,
|
|
1717
1728
|
r,
|
|
1718
|
-
`Invalid character within String: ${
|
|
1729
|
+
`Invalid character within String: ${X(
|
|
1719
1730
|
e,
|
|
1720
1731
|
r
|
|
1721
1732
|
)}.`
|
|
1722
1733
|
);
|
|
1723
1734
|
}
|
|
1724
|
-
throw
|
|
1735
|
+
throw R(e.source, r, "Unterminated string.");
|
|
1725
1736
|
}
|
|
1726
|
-
function
|
|
1737
|
+
function zn(e, t) {
|
|
1727
1738
|
const n = e.source.body;
|
|
1728
1739
|
let i = 0, r = 3;
|
|
1729
1740
|
for (; r < 12; ) {
|
|
1730
1741
|
const s = n.charCodeAt(t + r++);
|
|
1731
1742
|
if (s === 125) {
|
|
1732
|
-
if (r < 5 || !
|
|
1743
|
+
if (r < 5 || !re(i))
|
|
1733
1744
|
break;
|
|
1734
1745
|
return {
|
|
1735
1746
|
value: String.fromCodePoint(i),
|
|
1736
1747
|
size: r
|
|
1737
1748
|
};
|
|
1738
1749
|
}
|
|
1739
|
-
if (i = i << 4 |
|
|
1750
|
+
if (i = i << 4 | oe(s), i < 0)
|
|
1740
1751
|
break;
|
|
1741
1752
|
}
|
|
1742
|
-
throw
|
|
1753
|
+
throw R(
|
|
1743
1754
|
e.source,
|
|
1744
1755
|
t,
|
|
1745
1756
|
`Invalid Unicode escape sequence: "${n.slice(
|
|
@@ -1748,34 +1759,34 @@ function Zn(e, t) {
|
|
|
1748
1759
|
)}".`
|
|
1749
1760
|
);
|
|
1750
1761
|
}
|
|
1751
|
-
function
|
|
1752
|
-
const n = e.source.body, i =
|
|
1753
|
-
if (
|
|
1762
|
+
function Zn(e, t) {
|
|
1763
|
+
const n = e.source.body, i = tt(n, t + 2);
|
|
1764
|
+
if (re(i))
|
|
1754
1765
|
return {
|
|
1755
1766
|
value: String.fromCodePoint(i),
|
|
1756
1767
|
size: 6
|
|
1757
1768
|
};
|
|
1758
|
-
if (
|
|
1759
|
-
const r =
|
|
1760
|
-
if (
|
|
1769
|
+
if (yt(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
1770
|
+
const r = tt(n, t + 8);
|
|
1771
|
+
if (xt(r))
|
|
1761
1772
|
return {
|
|
1762
1773
|
value: String.fromCodePoint(i, r),
|
|
1763
1774
|
size: 12
|
|
1764
1775
|
};
|
|
1765
1776
|
}
|
|
1766
|
-
throw
|
|
1777
|
+
throw R(
|
|
1767
1778
|
e.source,
|
|
1768
1779
|
t,
|
|
1769
1780
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
1770
1781
|
);
|
|
1771
1782
|
}
|
|
1772
|
-
function
|
|
1773
|
-
return
|
|
1783
|
+
function tt(e, t) {
|
|
1784
|
+
return oe(e.charCodeAt(t)) << 12 | oe(e.charCodeAt(t + 1)) << 8 | oe(e.charCodeAt(t + 2)) << 4 | oe(e.charCodeAt(t + 3));
|
|
1774
1785
|
}
|
|
1775
|
-
function
|
|
1786
|
+
function oe(e) {
|
|
1776
1787
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
1777
1788
|
}
|
|
1778
|
-
function
|
|
1789
|
+
function Xn(e, t) {
|
|
1779
1790
|
const n = e.source.body;
|
|
1780
1791
|
switch (n.charCodeAt(t + 1)) {
|
|
1781
1792
|
case 34:
|
|
@@ -1820,7 +1831,7 @@ function Kn(e, t) {
|
|
|
1820
1831
|
size: 2
|
|
1821
1832
|
};
|
|
1822
1833
|
}
|
|
1823
|
-
throw
|
|
1834
|
+
throw R(
|
|
1824
1835
|
e.source,
|
|
1825
1836
|
t,
|
|
1826
1837
|
`Invalid character escape sequence: "${n.slice(
|
|
@@ -1829,7 +1840,7 @@ function Kn(e, t) {
|
|
|
1829
1840
|
)}".`
|
|
1830
1841
|
);
|
|
1831
1842
|
}
|
|
1832
|
-
function
|
|
1843
|
+
function Wn(e, t) {
|
|
1833
1844
|
const n = e.source.body, i = n.length;
|
|
1834
1845
|
let r = e.lineStart, s = t + 3, o = s, a = "";
|
|
1835
1846
|
const u = [];
|
|
@@ -1837,13 +1848,13 @@ function ei(e, t) {
|
|
|
1837
1848
|
const c = n.charCodeAt(s);
|
|
1838
1849
|
if (c === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
1839
1850
|
a += n.slice(o, s), u.push(a);
|
|
1840
|
-
const l =
|
|
1851
|
+
const l = S(
|
|
1841
1852
|
e,
|
|
1842
|
-
|
|
1853
|
+
d.BLOCK_STRING,
|
|
1843
1854
|
t,
|
|
1844
1855
|
s + 3,
|
|
1845
1856
|
// Return a string of the lines joined with U+000A.
|
|
1846
|
-
|
|
1857
|
+
Un(u).join(`
|
|
1847
1858
|
`)
|
|
1848
1859
|
);
|
|
1849
1860
|
return e.line += u.length - 1, e.lineStart = r, l;
|
|
@@ -1856,90 +1867,90 @@ function ei(e, t) {
|
|
|
1856
1867
|
a += n.slice(o, s), u.push(a), c === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, a = "", o = s, r = s;
|
|
1857
1868
|
continue;
|
|
1858
1869
|
}
|
|
1859
|
-
if (
|
|
1870
|
+
if (re(c))
|
|
1860
1871
|
++s;
|
|
1861
|
-
else if (
|
|
1872
|
+
else if (Ae(n, s))
|
|
1862
1873
|
s += 2;
|
|
1863
1874
|
else
|
|
1864
|
-
throw
|
|
1875
|
+
throw R(
|
|
1865
1876
|
e.source,
|
|
1866
1877
|
s,
|
|
1867
|
-
`Invalid character within String: ${
|
|
1878
|
+
`Invalid character within String: ${X(
|
|
1868
1879
|
e,
|
|
1869
1880
|
s
|
|
1870
1881
|
)}.`
|
|
1871
1882
|
);
|
|
1872
1883
|
}
|
|
1873
|
-
throw
|
|
1884
|
+
throw R(e.source, s, "Unterminated string.");
|
|
1874
1885
|
}
|
|
1875
|
-
function
|
|
1886
|
+
function Kn(e, t) {
|
|
1876
1887
|
const n = e.source.body, i = n.length;
|
|
1877
1888
|
let r = t + 1;
|
|
1878
1889
|
for (; r < i; ) {
|
|
1879
1890
|
const s = n.charCodeAt(r);
|
|
1880
|
-
if (
|
|
1891
|
+
if (Bn(s))
|
|
1881
1892
|
++r;
|
|
1882
1893
|
else
|
|
1883
1894
|
break;
|
|
1884
1895
|
}
|
|
1885
|
-
return
|
|
1896
|
+
return S(
|
|
1886
1897
|
e,
|
|
1887
|
-
|
|
1898
|
+
d.NAME,
|
|
1888
1899
|
t,
|
|
1889
1900
|
r,
|
|
1890
1901
|
n.slice(t, r)
|
|
1891
1902
|
);
|
|
1892
1903
|
}
|
|
1893
|
-
const
|
|
1894
|
-
function
|
|
1895
|
-
return
|
|
1904
|
+
const ei = 10, Dt = 2;
|
|
1905
|
+
function Ye(e) {
|
|
1906
|
+
return ye(e, []);
|
|
1896
1907
|
}
|
|
1897
|
-
function
|
|
1908
|
+
function ye(e, t) {
|
|
1898
1909
|
switch (typeof e) {
|
|
1899
1910
|
case "string":
|
|
1900
1911
|
return JSON.stringify(e);
|
|
1901
1912
|
case "function":
|
|
1902
1913
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
1903
1914
|
case "object":
|
|
1904
|
-
return
|
|
1915
|
+
return ti(e, t);
|
|
1905
1916
|
default:
|
|
1906
1917
|
return String(e);
|
|
1907
1918
|
}
|
|
1908
1919
|
}
|
|
1909
|
-
function
|
|
1920
|
+
function ti(e, t) {
|
|
1910
1921
|
if (e === null)
|
|
1911
1922
|
return "null";
|
|
1912
1923
|
if (t.includes(e))
|
|
1913
1924
|
return "[Circular]";
|
|
1914
1925
|
const n = [...t, e];
|
|
1915
|
-
if (
|
|
1926
|
+
if (ni(e)) {
|
|
1916
1927
|
const i = e.toJSON();
|
|
1917
1928
|
if (i !== e)
|
|
1918
|
-
return typeof i == "string" ? i :
|
|
1929
|
+
return typeof i == "string" ? i : ye(i, n);
|
|
1919
1930
|
} else if (Array.isArray(e))
|
|
1920
|
-
return
|
|
1921
|
-
return
|
|
1931
|
+
return ri(e, n);
|
|
1932
|
+
return ii(e, n);
|
|
1922
1933
|
}
|
|
1923
|
-
function
|
|
1934
|
+
function ni(e) {
|
|
1924
1935
|
return typeof e.toJSON == "function";
|
|
1925
1936
|
}
|
|
1926
|
-
function
|
|
1937
|
+
function ii(e, t) {
|
|
1927
1938
|
const n = Object.entries(e);
|
|
1928
|
-
return n.length === 0 ? "{}" : t.length >
|
|
1929
|
-
([r, s]) => r + ": " +
|
|
1939
|
+
return n.length === 0 ? "{}" : t.length > Dt ? "[" + si(e) + "]" : "{ " + n.map(
|
|
1940
|
+
([r, s]) => r + ": " + ye(s, t)
|
|
1930
1941
|
).join(", ") + " }";
|
|
1931
1942
|
}
|
|
1932
|
-
function
|
|
1943
|
+
function ri(e, t) {
|
|
1933
1944
|
if (e.length === 0)
|
|
1934
1945
|
return "[]";
|
|
1935
|
-
if (t.length >
|
|
1946
|
+
if (t.length > Dt)
|
|
1936
1947
|
return "[Array]";
|
|
1937
|
-
const n = Math.min(
|
|
1948
|
+
const n = Math.min(ei, e.length), i = e.length - n, r = [];
|
|
1938
1949
|
for (let s = 0; s < n; ++s)
|
|
1939
|
-
r.push(
|
|
1950
|
+
r.push(ye(e[s], t));
|
|
1940
1951
|
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
|
|
1941
1952
|
}
|
|
1942
|
-
function
|
|
1953
|
+
function si(e) {
|
|
1943
1954
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
1944
1955
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
1945
1956
|
const n = e.constructor.name;
|
|
@@ -1948,11 +1959,11 @@ function ai(e) {
|
|
|
1948
1959
|
}
|
|
1949
1960
|
return t;
|
|
1950
1961
|
}
|
|
1951
|
-
const
|
|
1952
|
-
process.env.NODE_ENV === "production",
|
|
1962
|
+
const oi = globalThis.process && // eslint-disable-next-line no-undef
|
|
1963
|
+
process.env.NODE_ENV === "production", ai = (
|
|
1953
1964
|
/* c8 ignore next 6 */
|
|
1954
1965
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
1955
|
-
|
|
1966
|
+
oi ? function(t, n) {
|
|
1956
1967
|
return t instanceof n;
|
|
1957
1968
|
} : function(t, n) {
|
|
1958
1969
|
if (t instanceof n)
|
|
@@ -1964,7 +1975,7 @@ process.env.NODE_ENV === "production", ui = (
|
|
|
1964
1975
|
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name
|
|
1965
1976
|
);
|
|
1966
1977
|
if (r === s) {
|
|
1967
|
-
const o =
|
|
1978
|
+
const o = Ye(t);
|
|
1968
1979
|
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
1969
1980
|
|
|
1970
1981
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -1982,15 +1993,15 @@ spurious results.`);
|
|
|
1982
1993
|
return !1;
|
|
1983
1994
|
}
|
|
1984
1995
|
);
|
|
1985
|
-
class
|
|
1996
|
+
class _t {
|
|
1986
1997
|
constructor(t, n = "GraphQL request", i = {
|
|
1987
1998
|
line: 1,
|
|
1988
1999
|
column: 1
|
|
1989
2000
|
}) {
|
|
1990
|
-
typeof t == "string" ||
|
|
2001
|
+
typeof t == "string" || ge(!1, `Body must be a string. Received: ${Ye(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || ge(
|
|
1991
2002
|
!1,
|
|
1992
2003
|
"line in locationOffset is 1-indexed and must be positive."
|
|
1993
|
-
), this.locationOffset.column > 0 ||
|
|
2004
|
+
), this.locationOffset.column > 0 || ge(
|
|
1994
2005
|
!1,
|
|
1995
2006
|
"column in locationOffset is 1-indexed and must be positive."
|
|
1996
2007
|
);
|
|
@@ -1999,24 +2010,24 @@ class St {
|
|
|
1999
2010
|
return "Source";
|
|
2000
2011
|
}
|
|
2001
2012
|
}
|
|
2002
|
-
function
|
|
2003
|
-
return
|
|
2013
|
+
function ci(e) {
|
|
2014
|
+
return ai(e, _t);
|
|
2004
2015
|
}
|
|
2005
|
-
function
|
|
2006
|
-
const n = new
|
|
2016
|
+
function ui(e, t) {
|
|
2017
|
+
const n = new li(e, t), i = n.parseDocument();
|
|
2007
2018
|
return Object.defineProperty(i, "tokenCount", {
|
|
2008
2019
|
enumerable: !1,
|
|
2009
2020
|
value: n.tokenCount
|
|
2010
2021
|
}), i;
|
|
2011
2022
|
}
|
|
2012
|
-
class
|
|
2023
|
+
class li {
|
|
2013
2024
|
constructor(t, n = {}) {
|
|
2014
2025
|
const { lexer: i, ...r } = n;
|
|
2015
2026
|
if (i)
|
|
2016
2027
|
this._lexer = i;
|
|
2017
2028
|
else {
|
|
2018
|
-
const s =
|
|
2019
|
-
this._lexer = new
|
|
2029
|
+
const s = ci(t) ? t : new _t(t);
|
|
2030
|
+
this._lexer = new $n(s);
|
|
2020
2031
|
}
|
|
2021
2032
|
this._options = r, this._tokenCounter = 0;
|
|
2022
2033
|
}
|
|
@@ -2027,7 +2038,7 @@ class hi {
|
|
|
2027
2038
|
* Converts a name lex token into a name parse node.
|
|
2028
2039
|
*/
|
|
2029
2040
|
parseName() {
|
|
2030
|
-
const t = this.expectToken(
|
|
2041
|
+
const t = this.expectToken(d.NAME);
|
|
2031
2042
|
return this.node(t, {
|
|
2032
2043
|
kind: w.NAME,
|
|
2033
2044
|
value: t.value
|
|
@@ -2041,9 +2052,9 @@ class hi {
|
|
|
2041
2052
|
return this.node(this._lexer.token, {
|
|
2042
2053
|
kind: w.DOCUMENT,
|
|
2043
2054
|
definitions: this.many(
|
|
2044
|
-
|
|
2055
|
+
d.SOF,
|
|
2045
2056
|
this.parseDefinition,
|
|
2046
|
-
|
|
2057
|
+
d.EOF
|
|
2047
2058
|
)
|
|
2048
2059
|
});
|
|
2049
2060
|
}
|
|
@@ -2071,16 +2082,16 @@ class hi {
|
|
|
2071
2082
|
* - InputObjectTypeDefinition
|
|
2072
2083
|
*/
|
|
2073
2084
|
parseDefinition() {
|
|
2074
|
-
if (this.peek(
|
|
2085
|
+
if (this.peek(d.BRACE_L))
|
|
2075
2086
|
return this.parseOperationDefinition();
|
|
2076
2087
|
const t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
2077
|
-
if (t && n.kind ===
|
|
2078
|
-
throw
|
|
2088
|
+
if (t && n.kind === d.BRACE_L)
|
|
2089
|
+
throw R(
|
|
2079
2090
|
this._lexer.source,
|
|
2080
2091
|
this._lexer.token.start,
|
|
2081
2092
|
"Unexpected description, descriptions are not supported on shorthand queries."
|
|
2082
2093
|
);
|
|
2083
|
-
if (n.kind ===
|
|
2094
|
+
if (n.kind === d.NAME) {
|
|
2084
2095
|
switch (n.value) {
|
|
2085
2096
|
case "schema":
|
|
2086
2097
|
return this.parseSchemaDefinition();
|
|
@@ -2108,7 +2119,7 @@ class hi {
|
|
|
2108
2119
|
return this.parseFragmentDefinition();
|
|
2109
2120
|
}
|
|
2110
2121
|
if (t)
|
|
2111
|
-
throw
|
|
2122
|
+
throw R(
|
|
2112
2123
|
this._lexer.source,
|
|
2113
2124
|
this._lexer.token.start,
|
|
2114
2125
|
"Unexpected description, only GraphQL definitions support descriptions."
|
|
@@ -2126,10 +2137,10 @@ class hi {
|
|
|
2126
2137
|
*/
|
|
2127
2138
|
parseOperationDefinition() {
|
|
2128
2139
|
const t = this._lexer.token;
|
|
2129
|
-
if (this.peek(
|
|
2140
|
+
if (this.peek(d.BRACE_L))
|
|
2130
2141
|
return this.node(t, {
|
|
2131
2142
|
kind: w.OPERATION_DEFINITION,
|
|
2132
|
-
operation:
|
|
2143
|
+
operation: te.QUERY,
|
|
2133
2144
|
description: void 0,
|
|
2134
2145
|
name: void 0,
|
|
2135
2146
|
variableDefinitions: [],
|
|
@@ -2138,7 +2149,7 @@ class hi {
|
|
|
2138
2149
|
});
|
|
2139
2150
|
const n = this.parseDescription(), i = this.parseOperationType();
|
|
2140
2151
|
let r;
|
|
2141
|
-
return this.peek(
|
|
2152
|
+
return this.peek(d.NAME) && (r = this.parseName()), this.node(t, {
|
|
2142
2153
|
kind: w.OPERATION_DEFINITION,
|
|
2143
2154
|
operation: i,
|
|
2144
2155
|
description: n,
|
|
@@ -2152,14 +2163,14 @@ class hi {
|
|
|
2152
2163
|
* OperationType : one of query mutation subscription
|
|
2153
2164
|
*/
|
|
2154
2165
|
parseOperationType() {
|
|
2155
|
-
const t = this.expectToken(
|
|
2166
|
+
const t = this.expectToken(d.NAME);
|
|
2156
2167
|
switch (t.value) {
|
|
2157
2168
|
case "query":
|
|
2158
|
-
return
|
|
2169
|
+
return te.QUERY;
|
|
2159
2170
|
case "mutation":
|
|
2160
|
-
return
|
|
2171
|
+
return te.MUTATION;
|
|
2161
2172
|
case "subscription":
|
|
2162
|
-
return
|
|
2173
|
+
return te.SUBSCRIPTION;
|
|
2163
2174
|
}
|
|
2164
2175
|
throw this.unexpected(t);
|
|
2165
2176
|
}
|
|
@@ -2168,9 +2179,9 @@ class hi {
|
|
|
2168
2179
|
*/
|
|
2169
2180
|
parseVariableDefinitions() {
|
|
2170
2181
|
return this.optionalMany(
|
|
2171
|
-
|
|
2182
|
+
d.PAREN_L,
|
|
2172
2183
|
this.parseVariableDefinition,
|
|
2173
|
-
|
|
2184
|
+
d.PAREN_R
|
|
2174
2185
|
);
|
|
2175
2186
|
}
|
|
2176
2187
|
/**
|
|
@@ -2181,8 +2192,8 @@ class hi {
|
|
|
2181
2192
|
kind: w.VARIABLE_DEFINITION,
|
|
2182
2193
|
description: this.parseDescription(),
|
|
2183
2194
|
variable: this.parseVariable(),
|
|
2184
|
-
type: (this.expectToken(
|
|
2185
|
-
defaultValue: this.expectOptionalToken(
|
|
2195
|
+
type: (this.expectToken(d.COLON), this.parseTypeReference()),
|
|
2196
|
+
defaultValue: this.expectOptionalToken(d.EQUALS) ? this.parseConstValueLiteral() : void 0,
|
|
2186
2197
|
directives: this.parseConstDirectives()
|
|
2187
2198
|
});
|
|
2188
2199
|
}
|
|
@@ -2191,7 +2202,7 @@ class hi {
|
|
|
2191
2202
|
*/
|
|
2192
2203
|
parseVariable() {
|
|
2193
2204
|
const t = this._lexer.token;
|
|
2194
|
-
return this.expectToken(
|
|
2205
|
+
return this.expectToken(d.DOLLAR), this.node(t, {
|
|
2195
2206
|
kind: w.VARIABLE,
|
|
2196
2207
|
name: this.parseName()
|
|
2197
2208
|
});
|
|
@@ -2205,9 +2216,9 @@ class hi {
|
|
|
2205
2216
|
return this.node(this._lexer.token, {
|
|
2206
2217
|
kind: w.SELECTION_SET,
|
|
2207
2218
|
selections: this.many(
|
|
2208
|
-
|
|
2219
|
+
d.BRACE_L,
|
|
2209
2220
|
this.parseSelection,
|
|
2210
|
-
|
|
2221
|
+
d.BRACE_R
|
|
2211
2222
|
)
|
|
2212
2223
|
});
|
|
2213
2224
|
}
|
|
@@ -2218,7 +2229,7 @@ class hi {
|
|
|
2218
2229
|
* - InlineFragment
|
|
2219
2230
|
*/
|
|
2220
2231
|
parseSelection() {
|
|
2221
|
-
return this.peek(
|
|
2232
|
+
return this.peek(d.SPREAD) ? this.parseFragment() : this.parseField();
|
|
2222
2233
|
}
|
|
2223
2234
|
/**
|
|
2224
2235
|
* Field : Alias? Name Arguments? Directives? SelectionSet?
|
|
@@ -2228,13 +2239,13 @@ class hi {
|
|
|
2228
2239
|
parseField() {
|
|
2229
2240
|
const t = this._lexer.token, n = this.parseName();
|
|
2230
2241
|
let i, r;
|
|
2231
|
-
return this.expectOptionalToken(
|
|
2242
|
+
return this.expectOptionalToken(d.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, {
|
|
2232
2243
|
kind: w.FIELD,
|
|
2233
2244
|
alias: i,
|
|
2234
2245
|
name: r,
|
|
2235
2246
|
arguments: this.parseArguments(!1),
|
|
2236
2247
|
directives: this.parseDirectives(!1),
|
|
2237
|
-
selectionSet: this.peek(
|
|
2248
|
+
selectionSet: this.peek(d.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
2238
2249
|
});
|
|
2239
2250
|
}
|
|
2240
2251
|
/**
|
|
@@ -2242,14 +2253,14 @@ class hi {
|
|
|
2242
2253
|
*/
|
|
2243
2254
|
parseArguments(t) {
|
|
2244
2255
|
const n = t ? this.parseConstArgument : this.parseArgument;
|
|
2245
|
-
return this.optionalMany(
|
|
2256
|
+
return this.optionalMany(d.PAREN_L, n, d.PAREN_R);
|
|
2246
2257
|
}
|
|
2247
2258
|
/**
|
|
2248
2259
|
* Argument[Const] : Name : Value[?Const]
|
|
2249
2260
|
*/
|
|
2250
2261
|
parseArgument(t = !1) {
|
|
2251
2262
|
const n = this._lexer.token, i = this.parseName();
|
|
2252
|
-
return this.expectToken(
|
|
2263
|
+
return this.expectToken(d.COLON), this.node(n, {
|
|
2253
2264
|
kind: w.ARGUMENT,
|
|
2254
2265
|
name: i,
|
|
2255
2266
|
value: this.parseValueLiteral(t)
|
|
@@ -2268,9 +2279,9 @@ class hi {
|
|
|
2268
2279
|
*/
|
|
2269
2280
|
parseFragment() {
|
|
2270
2281
|
const t = this._lexer.token;
|
|
2271
|
-
this.expectToken(
|
|
2282
|
+
this.expectToken(d.SPREAD);
|
|
2272
2283
|
const n = this.expectOptionalKeyword("on");
|
|
2273
|
-
return !n && this.peek(
|
|
2284
|
+
return !n && this.peek(d.NAME) ? this.node(t, {
|
|
2274
2285
|
kind: w.FRAGMENT_SPREAD,
|
|
2275
2286
|
name: this.parseFragmentName(),
|
|
2276
2287
|
directives: this.parseDirectives(!1)
|
|
@@ -2336,24 +2347,24 @@ class hi {
|
|
|
2336
2347
|
parseValueLiteral(t) {
|
|
2337
2348
|
const n = this._lexer.token;
|
|
2338
2349
|
switch (n.kind) {
|
|
2339
|
-
case
|
|
2350
|
+
case d.BRACKET_L:
|
|
2340
2351
|
return this.parseList(t);
|
|
2341
|
-
case
|
|
2352
|
+
case d.BRACE_L:
|
|
2342
2353
|
return this.parseObject(t);
|
|
2343
|
-
case
|
|
2354
|
+
case d.INT:
|
|
2344
2355
|
return this.advanceLexer(), this.node(n, {
|
|
2345
2356
|
kind: w.INT,
|
|
2346
2357
|
value: n.value
|
|
2347
2358
|
});
|
|
2348
|
-
case
|
|
2359
|
+
case d.FLOAT:
|
|
2349
2360
|
return this.advanceLexer(), this.node(n, {
|
|
2350
2361
|
kind: w.FLOAT,
|
|
2351
2362
|
value: n.value
|
|
2352
2363
|
});
|
|
2353
|
-
case
|
|
2354
|
-
case
|
|
2364
|
+
case d.STRING:
|
|
2365
|
+
case d.BLOCK_STRING:
|
|
2355
2366
|
return this.parseStringLiteral();
|
|
2356
|
-
case
|
|
2367
|
+
case d.NAME:
|
|
2357
2368
|
switch (this.advanceLexer(), n.value) {
|
|
2358
2369
|
case "true":
|
|
2359
2370
|
return this.node(n, {
|
|
@@ -2375,11 +2386,11 @@ class hi {
|
|
|
2375
2386
|
value: n.value
|
|
2376
2387
|
});
|
|
2377
2388
|
}
|
|
2378
|
-
case
|
|
2389
|
+
case d.DOLLAR:
|
|
2379
2390
|
if (t)
|
|
2380
|
-
if (this.expectToken(
|
|
2391
|
+
if (this.expectToken(d.DOLLAR), this._lexer.token.kind === d.NAME) {
|
|
2381
2392
|
const i = this._lexer.token.value;
|
|
2382
|
-
throw
|
|
2393
|
+
throw R(
|
|
2383
2394
|
this._lexer.source,
|
|
2384
2395
|
n.start,
|
|
2385
2396
|
`Unexpected variable "$${i}" in constant value.`
|
|
@@ -2399,7 +2410,7 @@ class hi {
|
|
|
2399
2410
|
return this.advanceLexer(), this.node(t, {
|
|
2400
2411
|
kind: w.STRING,
|
|
2401
2412
|
value: t.value,
|
|
2402
|
-
block: t.kind ===
|
|
2413
|
+
block: t.kind === d.BLOCK_STRING
|
|
2403
2414
|
});
|
|
2404
2415
|
}
|
|
2405
2416
|
/**
|
|
@@ -2411,7 +2422,7 @@ class hi {
|
|
|
2411
2422
|
const n = () => this.parseValueLiteral(t);
|
|
2412
2423
|
return this.node(this._lexer.token, {
|
|
2413
2424
|
kind: w.LIST,
|
|
2414
|
-
values: this.any(
|
|
2425
|
+
values: this.any(d.BRACKET_L, n, d.BRACKET_R)
|
|
2415
2426
|
});
|
|
2416
2427
|
}
|
|
2417
2428
|
/**
|
|
@@ -2425,7 +2436,7 @@ class hi {
|
|
|
2425
2436
|
const n = () => this.parseObjectField(t);
|
|
2426
2437
|
return this.node(this._lexer.token, {
|
|
2427
2438
|
kind: w.OBJECT,
|
|
2428
|
-
fields: this.any(
|
|
2439
|
+
fields: this.any(d.BRACE_L, n, d.BRACE_R)
|
|
2429
2440
|
});
|
|
2430
2441
|
}
|
|
2431
2442
|
/**
|
|
@@ -2433,7 +2444,7 @@ class hi {
|
|
|
2433
2444
|
*/
|
|
2434
2445
|
parseObjectField(t) {
|
|
2435
2446
|
const n = this._lexer.token, i = this.parseName();
|
|
2436
|
-
return this.expectToken(
|
|
2447
|
+
return this.expectToken(d.COLON), this.node(n, {
|
|
2437
2448
|
kind: w.OBJECT_FIELD,
|
|
2438
2449
|
name: i,
|
|
2439
2450
|
value: this.parseValueLiteral(t)
|
|
@@ -2445,7 +2456,7 @@ class hi {
|
|
|
2445
2456
|
*/
|
|
2446
2457
|
parseDirectives(t) {
|
|
2447
2458
|
const n = [];
|
|
2448
|
-
for (; this.peek(
|
|
2459
|
+
for (; this.peek(d.AT); )
|
|
2449
2460
|
n.push(this.parseDirective(t));
|
|
2450
2461
|
return n;
|
|
2451
2462
|
}
|
|
@@ -2459,7 +2470,7 @@ class hi {
|
|
|
2459
2470
|
*/
|
|
2460
2471
|
parseDirective(t) {
|
|
2461
2472
|
const n = this._lexer.token;
|
|
2462
|
-
return this.expectToken(
|
|
2473
|
+
return this.expectToken(d.AT), this.node(n, {
|
|
2463
2474
|
kind: w.DIRECTIVE,
|
|
2464
2475
|
name: this.parseName(),
|
|
2465
2476
|
arguments: this.parseArguments(t)
|
|
@@ -2475,15 +2486,15 @@ class hi {
|
|
|
2475
2486
|
parseTypeReference() {
|
|
2476
2487
|
const t = this._lexer.token;
|
|
2477
2488
|
let n;
|
|
2478
|
-
if (this.expectOptionalToken(
|
|
2489
|
+
if (this.expectOptionalToken(d.BRACKET_L)) {
|
|
2479
2490
|
const i = this.parseTypeReference();
|
|
2480
|
-
this.expectToken(
|
|
2491
|
+
this.expectToken(d.BRACKET_R), n = this.node(t, {
|
|
2481
2492
|
kind: w.LIST_TYPE,
|
|
2482
2493
|
type: i
|
|
2483
2494
|
});
|
|
2484
2495
|
} else
|
|
2485
2496
|
n = this.parseNamedType();
|
|
2486
|
-
return this.expectOptionalToken(
|
|
2497
|
+
return this.expectOptionalToken(d.BANG) ? this.node(t, {
|
|
2487
2498
|
kind: w.NON_NULL_TYPE,
|
|
2488
2499
|
type: n
|
|
2489
2500
|
}) : n;
|
|
@@ -2499,7 +2510,7 @@ class hi {
|
|
|
2499
2510
|
}
|
|
2500
2511
|
// Implements the parsing rules in the Type Definition section.
|
|
2501
2512
|
peekDescription() {
|
|
2502
|
-
return this.peek(
|
|
2513
|
+
return this.peek(d.STRING) || this.peek(d.BLOCK_STRING);
|
|
2503
2514
|
}
|
|
2504
2515
|
/**
|
|
2505
2516
|
* Description : StringValue
|
|
@@ -2517,9 +2528,9 @@ class hi {
|
|
|
2517
2528
|
const t = this._lexer.token, n = this.parseDescription();
|
|
2518
2529
|
this.expectKeyword("schema");
|
|
2519
2530
|
const i = this.parseConstDirectives(), r = this.many(
|
|
2520
|
-
|
|
2531
|
+
d.BRACE_L,
|
|
2521
2532
|
this.parseOperationTypeDefinition,
|
|
2522
|
-
|
|
2533
|
+
d.BRACE_R
|
|
2523
2534
|
);
|
|
2524
2535
|
return this.node(t, {
|
|
2525
2536
|
kind: w.SCHEMA_DEFINITION,
|
|
@@ -2533,7 +2544,7 @@ class hi {
|
|
|
2533
2544
|
*/
|
|
2534
2545
|
parseOperationTypeDefinition() {
|
|
2535
2546
|
const t = this._lexer.token, n = this.parseOperationType();
|
|
2536
|
-
this.expectToken(
|
|
2547
|
+
this.expectToken(d.COLON);
|
|
2537
2548
|
const i = this.parseNamedType();
|
|
2538
2549
|
return this.node(t, {
|
|
2539
2550
|
kind: w.OPERATION_TYPE_DEFINITION,
|
|
@@ -2579,7 +2590,7 @@ class hi {
|
|
|
2579
2590
|
* - ImplementsInterfaces & NamedType
|
|
2580
2591
|
*/
|
|
2581
2592
|
parseImplementsInterfaces() {
|
|
2582
|
-
return this.expectOptionalKeyword("implements") ? this.delimitedMany(
|
|
2593
|
+
return this.expectOptionalKeyword("implements") ? this.delimitedMany(d.AMP, this.parseNamedType) : [];
|
|
2583
2594
|
}
|
|
2584
2595
|
/**
|
|
2585
2596
|
* ```
|
|
@@ -2588,9 +2599,9 @@ class hi {
|
|
|
2588
2599
|
*/
|
|
2589
2600
|
parseFieldsDefinition() {
|
|
2590
2601
|
return this.optionalMany(
|
|
2591
|
-
|
|
2602
|
+
d.BRACE_L,
|
|
2592
2603
|
this.parseFieldDefinition,
|
|
2593
|
-
|
|
2604
|
+
d.BRACE_R
|
|
2594
2605
|
);
|
|
2595
2606
|
}
|
|
2596
2607
|
/**
|
|
@@ -2599,7 +2610,7 @@ class hi {
|
|
|
2599
2610
|
*/
|
|
2600
2611
|
parseFieldDefinition() {
|
|
2601
2612
|
const t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
|
|
2602
|
-
this.expectToken(
|
|
2613
|
+
this.expectToken(d.COLON);
|
|
2603
2614
|
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
2604
2615
|
return this.node(t, {
|
|
2605
2616
|
kind: w.FIELD_DEFINITION,
|
|
@@ -2615,9 +2626,9 @@ class hi {
|
|
|
2615
2626
|
*/
|
|
2616
2627
|
parseArgumentDefs() {
|
|
2617
2628
|
return this.optionalMany(
|
|
2618
|
-
|
|
2629
|
+
d.PAREN_L,
|
|
2619
2630
|
this.parseInputValueDef,
|
|
2620
|
-
|
|
2631
|
+
d.PAREN_R
|
|
2621
2632
|
);
|
|
2622
2633
|
}
|
|
2623
2634
|
/**
|
|
@@ -2626,10 +2637,10 @@ class hi {
|
|
|
2626
2637
|
*/
|
|
2627
2638
|
parseInputValueDef() {
|
|
2628
2639
|
const t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
|
|
2629
|
-
this.expectToken(
|
|
2640
|
+
this.expectToken(d.COLON);
|
|
2630
2641
|
const r = this.parseTypeReference();
|
|
2631
2642
|
let s;
|
|
2632
|
-
this.expectOptionalToken(
|
|
2643
|
+
this.expectOptionalToken(d.EQUALS) && (s = this.parseConstValueLiteral());
|
|
2633
2644
|
const o = this.parseConstDirectives();
|
|
2634
2645
|
return this.node(t, {
|
|
2635
2646
|
kind: w.INPUT_VALUE_DEFINITION,
|
|
@@ -2679,7 +2690,7 @@ class hi {
|
|
|
2679
2690
|
* - UnionMemberTypes | NamedType
|
|
2680
2691
|
*/
|
|
2681
2692
|
parseUnionMemberTypes() {
|
|
2682
|
-
return this.expectOptionalToken(
|
|
2693
|
+
return this.expectOptionalToken(d.EQUALS) ? this.delimitedMany(d.PIPE, this.parseNamedType) : [];
|
|
2683
2694
|
}
|
|
2684
2695
|
/**
|
|
2685
2696
|
* EnumTypeDefinition :
|
|
@@ -2704,9 +2715,9 @@ class hi {
|
|
|
2704
2715
|
*/
|
|
2705
2716
|
parseEnumValuesDefinition() {
|
|
2706
2717
|
return this.optionalMany(
|
|
2707
|
-
|
|
2718
|
+
d.BRACE_L,
|
|
2708
2719
|
this.parseEnumValueDefinition,
|
|
2709
|
-
|
|
2720
|
+
d.BRACE_R
|
|
2710
2721
|
);
|
|
2711
2722
|
}
|
|
2712
2723
|
/**
|
|
@@ -2726,10 +2737,10 @@ class hi {
|
|
|
2726
2737
|
*/
|
|
2727
2738
|
parseEnumValueName() {
|
|
2728
2739
|
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
|
|
2729
|
-
throw
|
|
2740
|
+
throw R(
|
|
2730
2741
|
this._lexer.source,
|
|
2731
2742
|
this._lexer.token.start,
|
|
2732
|
-
`${
|
|
2743
|
+
`${he(
|
|
2733
2744
|
this._lexer.token
|
|
2734
2745
|
)} is reserved and cannot be used for an enum value.`
|
|
2735
2746
|
);
|
|
@@ -2758,9 +2769,9 @@ class hi {
|
|
|
2758
2769
|
*/
|
|
2759
2770
|
parseInputFieldsDefinition() {
|
|
2760
2771
|
return this.optionalMany(
|
|
2761
|
-
|
|
2772
|
+
d.BRACE_L,
|
|
2762
2773
|
this.parseInputValueDef,
|
|
2763
|
-
|
|
2774
|
+
d.BRACE_R
|
|
2764
2775
|
);
|
|
2765
2776
|
}
|
|
2766
2777
|
/**
|
|
@@ -2778,7 +2789,7 @@ class hi {
|
|
|
2778
2789
|
*/
|
|
2779
2790
|
parseTypeSystemExtension() {
|
|
2780
2791
|
const t = this._lexer.lookahead();
|
|
2781
|
-
if (t.kind ===
|
|
2792
|
+
if (t.kind === d.NAME)
|
|
2782
2793
|
switch (t.value) {
|
|
2783
2794
|
case "schema":
|
|
2784
2795
|
return this.parseSchemaExtension();
|
|
@@ -2808,9 +2819,9 @@ class hi {
|
|
|
2808
2819
|
const t = this._lexer.token;
|
|
2809
2820
|
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
2810
2821
|
const n = this.parseConstDirectives(), i = this.optionalMany(
|
|
2811
|
-
|
|
2822
|
+
d.BRACE_L,
|
|
2812
2823
|
this.parseOperationTypeDefinition,
|
|
2813
|
-
|
|
2824
|
+
d.BRACE_R
|
|
2814
2825
|
);
|
|
2815
2826
|
if (n.length === 0 && i.length === 0)
|
|
2816
2827
|
throw this.unexpected();
|
|
@@ -2938,7 +2949,7 @@ class hi {
|
|
|
2938
2949
|
*/
|
|
2939
2950
|
parseDirectiveDefinition() {
|
|
2940
2951
|
const t = this._lexer.token, n = this.parseDescription();
|
|
2941
|
-
this.expectKeyword("directive"), this.expectToken(
|
|
2952
|
+
this.expectKeyword("directive"), this.expectToken(d.AT);
|
|
2942
2953
|
const i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
2943
2954
|
this.expectKeyword("on");
|
|
2944
2955
|
const o = this.parseDirectiveLocations();
|
|
@@ -2957,7 +2968,7 @@ class hi {
|
|
|
2957
2968
|
* - DirectiveLocations | DirectiveLocation
|
|
2958
2969
|
*/
|
|
2959
2970
|
parseDirectiveLocations() {
|
|
2960
|
-
return this.delimitedMany(
|
|
2971
|
+
return this.delimitedMany(d.PIPE, this.parseDirectiveLocation);
|
|
2961
2972
|
}
|
|
2962
2973
|
/*
|
|
2963
2974
|
* DirectiveLocation :
|
|
@@ -2988,7 +2999,7 @@ class hi {
|
|
|
2988
2999
|
*/
|
|
2989
3000
|
parseDirectiveLocation() {
|
|
2990
3001
|
const t = this._lexer.token, n = this.parseName();
|
|
2991
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
3002
|
+
if (Object.prototype.hasOwnProperty.call(qe, n.value))
|
|
2992
3003
|
return n;
|
|
2993
3004
|
throw this.unexpected(t);
|
|
2994
3005
|
}
|
|
@@ -3002,11 +3013,11 @@ class hi {
|
|
|
3002
3013
|
* - \@ Name ( Name : )
|
|
3003
3014
|
*/
|
|
3004
3015
|
parseSchemaCoordinate() {
|
|
3005
|
-
const t = this._lexer.token, n = this.expectOptionalToken(
|
|
3016
|
+
const t = this._lexer.token, n = this.expectOptionalToken(d.AT), i = this.parseName();
|
|
3006
3017
|
let r;
|
|
3007
|
-
!n && this.expectOptionalToken(
|
|
3018
|
+
!n && this.expectOptionalToken(d.DOT) && (r = this.parseName());
|
|
3008
3019
|
let s;
|
|
3009
|
-
return (n || r) && this.expectOptionalToken(
|
|
3020
|
+
return (n || r) && this.expectOptionalToken(d.PAREN_L) && (s = this.parseName(), this.expectToken(d.COLON), this.expectToken(d.PAREN_R)), n ? s ? this.node(t, {
|
|
3010
3021
|
kind: w.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
3011
3022
|
name: i,
|
|
3012
3023
|
argumentName: s
|
|
@@ -3034,7 +3045,7 @@ class hi {
|
|
|
3034
3045
|
* given parsed object.
|
|
3035
3046
|
*/
|
|
3036
3047
|
node(t, n) {
|
|
3037
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
3048
|
+
return this._options.noLocation !== !0 && (n.loc = new Pn(
|
|
3038
3049
|
t,
|
|
3039
3050
|
this._lexer.lastToken,
|
|
3040
3051
|
this._lexer.source
|
|
@@ -3054,10 +3065,10 @@ class hi {
|
|
|
3054
3065
|
const n = this._lexer.token;
|
|
3055
3066
|
if (n.kind === t)
|
|
3056
3067
|
return this.advanceLexer(), n;
|
|
3057
|
-
throw
|
|
3068
|
+
throw R(
|
|
3058
3069
|
this._lexer.source,
|
|
3059
3070
|
n.start,
|
|
3060
|
-
`Expected ${
|
|
3071
|
+
`Expected ${St(t)}, found ${he(n)}.`
|
|
3061
3072
|
);
|
|
3062
3073
|
}
|
|
3063
3074
|
/**
|
|
@@ -3073,13 +3084,13 @@ class hi {
|
|
|
3073
3084
|
*/
|
|
3074
3085
|
expectKeyword(t) {
|
|
3075
3086
|
const n = this._lexer.token;
|
|
3076
|
-
if (n.kind ===
|
|
3087
|
+
if (n.kind === d.NAME && n.value === t)
|
|
3077
3088
|
this.advanceLexer();
|
|
3078
3089
|
else
|
|
3079
|
-
throw
|
|
3090
|
+
throw R(
|
|
3080
3091
|
this._lexer.source,
|
|
3081
3092
|
n.start,
|
|
3082
|
-
`Expected "${t}", found ${
|
|
3093
|
+
`Expected "${t}", found ${he(n)}.`
|
|
3083
3094
|
);
|
|
3084
3095
|
}
|
|
3085
3096
|
/**
|
|
@@ -3088,17 +3099,17 @@ class hi {
|
|
|
3088
3099
|
*/
|
|
3089
3100
|
expectOptionalKeyword(t) {
|
|
3090
3101
|
const n = this._lexer.token;
|
|
3091
|
-
return n.kind ===
|
|
3102
|
+
return n.kind === d.NAME && n.value === t ? (this.advanceLexer(), !0) : !1;
|
|
3092
3103
|
}
|
|
3093
3104
|
/**
|
|
3094
3105
|
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
3095
3106
|
*/
|
|
3096
3107
|
unexpected(t) {
|
|
3097
3108
|
const n = t ?? this._lexer.token;
|
|
3098
|
-
return
|
|
3109
|
+
return R(
|
|
3099
3110
|
this._lexer.source,
|
|
3100
3111
|
n.start,
|
|
3101
|
-
`Unexpected ${
|
|
3112
|
+
`Unexpected ${he(n)}.`
|
|
3102
3113
|
);
|
|
3103
3114
|
}
|
|
3104
3115
|
/**
|
|
@@ -3157,29 +3168,29 @@ class hi {
|
|
|
3157
3168
|
}
|
|
3158
3169
|
advanceLexer() {
|
|
3159
3170
|
const { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
3160
|
-
if (n.kind !==
|
|
3161
|
-
throw
|
|
3171
|
+
if (n.kind !== d.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t))
|
|
3172
|
+
throw R(
|
|
3162
3173
|
this._lexer.source,
|
|
3163
3174
|
n.start,
|
|
3164
3175
|
`Document contains more that ${t} tokens. Parsing aborted.`
|
|
3165
3176
|
);
|
|
3166
3177
|
}
|
|
3167
3178
|
}
|
|
3168
|
-
function
|
|
3179
|
+
function he(e) {
|
|
3169
3180
|
const t = e.value;
|
|
3170
|
-
return
|
|
3181
|
+
return St(e.kind) + (t != null ? ` "${t}"` : "");
|
|
3171
3182
|
}
|
|
3172
|
-
function
|
|
3173
|
-
return
|
|
3183
|
+
function St(e) {
|
|
3184
|
+
return Gn(e) ? `"${e}"` : e;
|
|
3174
3185
|
}
|
|
3175
|
-
function
|
|
3176
|
-
return `"${e.replace(
|
|
3186
|
+
function fi(e) {
|
|
3187
|
+
return `"${e.replace(hi, di)}"`;
|
|
3177
3188
|
}
|
|
3178
|
-
const
|
|
3179
|
-
function
|
|
3180
|
-
return
|
|
3189
|
+
const hi = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
3190
|
+
function di(e) {
|
|
3191
|
+
return pi[e.charCodeAt(0)];
|
|
3181
3192
|
}
|
|
3182
|
-
const
|
|
3193
|
+
const pi = [
|
|
3183
3194
|
"\\u0000",
|
|
3184
3195
|
"\\u0001",
|
|
3185
3196
|
"\\u0002",
|
|
@@ -3345,72 +3356,72 @@ const gi = [
|
|
|
3345
3356
|
"\\u009D",
|
|
3346
3357
|
"\\u009E",
|
|
3347
3358
|
"\\u009F"
|
|
3348
|
-
],
|
|
3349
|
-
function
|
|
3359
|
+
], mi = Object.freeze({});
|
|
3360
|
+
function gi(e, t, n = It) {
|
|
3350
3361
|
const i = /* @__PURE__ */ new Map();
|
|
3351
|
-
for (const
|
|
3352
|
-
i.set(
|
|
3362
|
+
for (const y of Object.values(w))
|
|
3363
|
+
i.set(y, Ei(t, y));
|
|
3353
3364
|
let r, s = Array.isArray(e), o = [e], a = -1, u = [], c = e, l, f;
|
|
3354
|
-
const
|
|
3365
|
+
const h = [], m = [];
|
|
3355
3366
|
do {
|
|
3356
3367
|
a++;
|
|
3357
|
-
const
|
|
3358
|
-
if (
|
|
3359
|
-
if (l =
|
|
3368
|
+
const y = a === o.length, M = y && u.length !== 0;
|
|
3369
|
+
if (y) {
|
|
3370
|
+
if (l = m.length === 0 ? void 0 : h[h.length - 1], c = f, f = m.pop(), M)
|
|
3360
3371
|
if (s) {
|
|
3361
3372
|
c = c.slice();
|
|
3362
|
-
let
|
|
3363
|
-
for (const [
|
|
3364
|
-
const
|
|
3365
|
-
|
|
3373
|
+
let _ = 0;
|
|
3374
|
+
for (const [Y, q] of u) {
|
|
3375
|
+
const W = Y - _;
|
|
3376
|
+
q === null ? (c.splice(W, 1), _++) : c[W] = q;
|
|
3366
3377
|
}
|
|
3367
3378
|
} else {
|
|
3368
3379
|
c = { ...c };
|
|
3369
|
-
for (const [
|
|
3370
|
-
c[
|
|
3380
|
+
for (const [_, Y] of u)
|
|
3381
|
+
c[_] = Y;
|
|
3371
3382
|
}
|
|
3372
3383
|
a = r.index, o = r.keys, u = r.edits, s = r.inArray, r = r.prev;
|
|
3373
3384
|
} else if (f) {
|
|
3374
3385
|
if (l = s ? a : o[a], c = f[l], c == null)
|
|
3375
3386
|
continue;
|
|
3376
|
-
|
|
3387
|
+
h.push(l);
|
|
3377
3388
|
}
|
|
3378
|
-
let
|
|
3389
|
+
let A;
|
|
3379
3390
|
if (!Array.isArray(c)) {
|
|
3380
|
-
var
|
|
3381
|
-
|
|
3382
|
-
const
|
|
3383
|
-
if (
|
|
3391
|
+
var N, E;
|
|
3392
|
+
et(c) || ge(!1, `Invalid AST Node: ${Ye(c)}.`);
|
|
3393
|
+
const _ = y ? (N = i.get(c.kind)) === null || N === void 0 ? void 0 : N.leave : (E = i.get(c.kind)) === null || E === void 0 ? void 0 : E.enter;
|
|
3394
|
+
if (A = _?.call(t, c, l, f, h, m), A === mi)
|
|
3384
3395
|
break;
|
|
3385
|
-
if (
|
|
3386
|
-
if (!
|
|
3387
|
-
|
|
3396
|
+
if (A === !1) {
|
|
3397
|
+
if (!y) {
|
|
3398
|
+
h.pop();
|
|
3388
3399
|
continue;
|
|
3389
3400
|
}
|
|
3390
|
-
} else if (
|
|
3391
|
-
if (
|
|
3392
|
-
c =
|
|
3401
|
+
} else if (A !== void 0 && (u.push([l, A]), !y))
|
|
3402
|
+
if (et(A))
|
|
3403
|
+
c = A;
|
|
3393
3404
|
else {
|
|
3394
|
-
|
|
3405
|
+
h.pop();
|
|
3395
3406
|
continue;
|
|
3396
3407
|
}
|
|
3397
3408
|
}
|
|
3398
|
-
if (
|
|
3399
|
-
|
|
3409
|
+
if (A === void 0 && M && u.push([l, c]), y)
|
|
3410
|
+
h.pop();
|
|
3400
3411
|
else {
|
|
3401
|
-
var
|
|
3412
|
+
var C;
|
|
3402
3413
|
r = {
|
|
3403
3414
|
inArray: s,
|
|
3404
3415
|
index: a,
|
|
3405
3416
|
keys: o,
|
|
3406
3417
|
edits: u,
|
|
3407
3418
|
prev: r
|
|
3408
|
-
}, s = Array.isArray(c), o = s ? c : (
|
|
3419
|
+
}, s = Array.isArray(c), o = s ? c : (C = n[c.kind]) !== null && C !== void 0 ? C : [], a = -1, u = [], f && m.push(f), f = c;
|
|
3409
3420
|
}
|
|
3410
3421
|
} while (r !== void 0);
|
|
3411
3422
|
return u.length !== 0 ? u[u.length - 1][1] : e;
|
|
3412
3423
|
}
|
|
3413
|
-
function
|
|
3424
|
+
function Ei(e, t) {
|
|
3414
3425
|
const n = e[t];
|
|
3415
3426
|
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
3416
3427
|
enter: n,
|
|
@@ -3420,10 +3431,10 @@ function yi(e, t) {
|
|
|
3420
3431
|
leave: e.leave
|
|
3421
3432
|
};
|
|
3422
3433
|
}
|
|
3423
|
-
function
|
|
3424
|
-
return
|
|
3434
|
+
function Ni(e) {
|
|
3435
|
+
return gi(e, wi);
|
|
3425
3436
|
}
|
|
3426
|
-
const
|
|
3437
|
+
const Ti = 80, wi = {
|
|
3427
3438
|
Name: {
|
|
3428
3439
|
leave: (e) => e.value
|
|
3429
3440
|
},
|
|
@@ -3432,21 +3443,21 @@ const vi = 80, wi = {
|
|
|
3432
3443
|
},
|
|
3433
3444
|
// Document
|
|
3434
3445
|
Document: {
|
|
3435
|
-
leave: (e) =>
|
|
3446
|
+
leave: (e) => g(e.definitions, `
|
|
3436
3447
|
|
|
3437
3448
|
`)
|
|
3438
3449
|
},
|
|
3439
3450
|
OperationDefinition: {
|
|
3440
3451
|
leave(e) {
|
|
3441
|
-
const t =
|
|
3442
|
-
`,
|
|
3452
|
+
const t = Ce(e.variableDefinitions) ? O(`(
|
|
3453
|
+
`, g(e.variableDefinitions, `
|
|
3443
3454
|
`), `
|
|
3444
|
-
)`) :
|
|
3445
|
-
`) +
|
|
3455
|
+
)`) : O("(", g(e.variableDefinitions, ", "), ")"), n = O("", e.description, `
|
|
3456
|
+
`) + g(
|
|
3446
3457
|
[
|
|
3447
3458
|
e.operation,
|
|
3448
|
-
|
|
3449
|
-
|
|
3459
|
+
g([e.name, t]),
|
|
3460
|
+
g(e.directives, " ")
|
|
3450
3461
|
],
|
|
3451
3462
|
" "
|
|
3452
3463
|
);
|
|
@@ -3454,20 +3465,20 @@ const vi = 80, wi = {
|
|
|
3454
3465
|
}
|
|
3455
3466
|
},
|
|
3456
3467
|
VariableDefinition: {
|
|
3457
|
-
leave: ({ variable: e, type: t, defaultValue: n, directives: i, description: r }) =>
|
|
3458
|
-
`) + e + ": " + t +
|
|
3468
|
+
leave: ({ variable: e, type: t, defaultValue: n, directives: i, description: r }) => O("", r, `
|
|
3469
|
+
`) + e + ": " + t + O(" = ", n) + O(" ", g(i, " "))
|
|
3459
3470
|
},
|
|
3460
3471
|
SelectionSet: {
|
|
3461
|
-
leave: ({ selections: e }) =>
|
|
3472
|
+
leave: ({ selections: e }) => U(e)
|
|
3462
3473
|
},
|
|
3463
3474
|
Field: {
|
|
3464
3475
|
leave({ alias: e, name: t, arguments: n, directives: i, selectionSet: r }) {
|
|
3465
|
-
const s =
|
|
3466
|
-
let o = s +
|
|
3467
|
-
return o.length >
|
|
3468
|
-
`,
|
|
3476
|
+
const s = O("", e, ": ") + t;
|
|
3477
|
+
let o = s + O("(", g(n, ", "), ")");
|
|
3478
|
+
return o.length > Ti && (o = s + O(`(
|
|
3479
|
+
`, Ee(g(n, `
|
|
3469
3480
|
`)), `
|
|
3470
|
-
)`)),
|
|
3481
|
+
)`)), g([o, g(i, " "), r], " ");
|
|
3471
3482
|
}
|
|
3472
3483
|
},
|
|
3473
3484
|
Argument: {
|
|
@@ -3475,14 +3486,14 @@ const vi = 80, wi = {
|
|
|
3475
3486
|
},
|
|
3476
3487
|
// Fragments
|
|
3477
3488
|
FragmentSpread: {
|
|
3478
|
-
leave: ({ name: e, directives: t }) => "..." + e +
|
|
3489
|
+
leave: ({ name: e, directives: t }) => "..." + e + O(" ", g(t, " "))
|
|
3479
3490
|
},
|
|
3480
3491
|
InlineFragment: {
|
|
3481
|
-
leave: ({ typeCondition: e, directives: t, selectionSet: n }) =>
|
|
3492
|
+
leave: ({ typeCondition: e, directives: t, selectionSet: n }) => g(
|
|
3482
3493
|
[
|
|
3483
3494
|
"...",
|
|
3484
|
-
|
|
3485
|
-
|
|
3495
|
+
O("on ", e),
|
|
3496
|
+
g(t, " "),
|
|
3486
3497
|
n
|
|
3487
3498
|
],
|
|
3488
3499
|
" "
|
|
@@ -3496,10 +3507,10 @@ const vi = 80, wi = {
|
|
|
3496
3507
|
directives: i,
|
|
3497
3508
|
selectionSet: r,
|
|
3498
3509
|
description: s
|
|
3499
|
-
}) =>
|
|
3510
|
+
}) => O("", s, `
|
|
3500
3511
|
`) + // Note: fragment variable definitions are experimental and may be changed
|
|
3501
3512
|
// or removed in the future.
|
|
3502
|
-
`fragment ${e}${
|
|
3513
|
+
`fragment ${e}${O("(", g(n, ", "), ")")} on ${t} ${O("", g(i, " "), " ")}` + r
|
|
3503
3514
|
},
|
|
3504
3515
|
// Value
|
|
3505
3516
|
IntValue: {
|
|
@@ -3509,7 +3520,7 @@ const vi = 80, wi = {
|
|
|
3509
3520
|
leave: ({ value: e }) => e
|
|
3510
3521
|
},
|
|
3511
3522
|
StringValue: {
|
|
3512
|
-
leave: ({ value: e, block: t }) => t ?
|
|
3523
|
+
leave: ({ value: e, block: t }) => t ? jn(e) : fi(e)
|
|
3513
3524
|
},
|
|
3514
3525
|
BooleanValue: {
|
|
3515
3526
|
leave: ({ value: e }) => e ? "true" : "false"
|
|
@@ -3521,17 +3532,17 @@ const vi = 80, wi = {
|
|
|
3521
3532
|
leave: ({ value: e }) => e
|
|
3522
3533
|
},
|
|
3523
3534
|
ListValue: {
|
|
3524
|
-
leave: ({ values: e }) => "[" +
|
|
3535
|
+
leave: ({ values: e }) => "[" + g(e, ", ") + "]"
|
|
3525
3536
|
},
|
|
3526
3537
|
ObjectValue: {
|
|
3527
|
-
leave: ({ fields: e }) => "{" +
|
|
3538
|
+
leave: ({ fields: e }) => "{" + g(e, ", ") + "}"
|
|
3528
3539
|
},
|
|
3529
3540
|
ObjectField: {
|
|
3530
3541
|
leave: ({ name: e, value: t }) => e + ": " + t
|
|
3531
3542
|
},
|
|
3532
3543
|
// Directive
|
|
3533
3544
|
Directive: {
|
|
3534
|
-
leave: ({ name: e, arguments: t }) => "@" + e +
|
|
3545
|
+
leave: ({ name: e, arguments: t }) => "@" + e + O("(", g(t, ", "), ")")
|
|
3535
3546
|
},
|
|
3536
3547
|
// Type
|
|
3537
3548
|
NamedType: {
|
|
@@ -3545,655 +3556,437 @@ const vi = 80, wi = {
|
|
|
3545
3556
|
},
|
|
3546
3557
|
// Type System Definitions
|
|
3547
3558
|
SchemaDefinition: {
|
|
3548
|
-
leave: ({ description: e, directives: t, operationTypes: n }) =>
|
|
3549
|
-
`) +
|
|
3559
|
+
leave: ({ description: e, directives: t, operationTypes: n }) => O("", e, `
|
|
3560
|
+
`) + g(["schema", g(t, " "), U(n)], " ")
|
|
3550
3561
|
},
|
|
3551
3562
|
OperationTypeDefinition: {
|
|
3552
3563
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
3553
3564
|
},
|
|
3554
3565
|
ScalarTypeDefinition: {
|
|
3555
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
3556
|
-
`) +
|
|
3566
|
+
leave: ({ description: e, name: t, directives: n }) => O("", e, `
|
|
3567
|
+
`) + g(["scalar", t, g(n, " ")], " ")
|
|
3557
3568
|
},
|
|
3558
3569
|
ObjectTypeDefinition: {
|
|
3559
|
-
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) =>
|
|
3560
|
-
`) +
|
|
3570
|
+
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => O("", e, `
|
|
3571
|
+
`) + g(
|
|
3561
3572
|
[
|
|
3562
3573
|
"type",
|
|
3563
3574
|
t,
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3575
|
+
O("implements ", g(n, " & ")),
|
|
3576
|
+
g(i, " "),
|
|
3577
|
+
U(r)
|
|
3567
3578
|
],
|
|
3568
3579
|
" "
|
|
3569
3580
|
)
|
|
3570
3581
|
},
|
|
3571
3582
|
FieldDefinition: {
|
|
3572
|
-
leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) =>
|
|
3573
|
-
`) + t + (
|
|
3574
|
-
`,
|
|
3583
|
+
leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) => O("", e, `
|
|
3584
|
+
`) + t + (Ce(n) ? O(`(
|
|
3585
|
+
`, Ee(g(n, `
|
|
3575
3586
|
`)), `
|
|
3576
|
-
)`) :
|
|
3587
|
+
)`) : O("(", g(n, ", "), ")")) + ": " + i + O(" ", g(r, " "))
|
|
3577
3588
|
},
|
|
3578
3589
|
InputValueDefinition: {
|
|
3579
|
-
leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) =>
|
|
3580
|
-
`) +
|
|
3581
|
-
[t + ": " + n,
|
|
3590
|
+
leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) => O("", e, `
|
|
3591
|
+
`) + g(
|
|
3592
|
+
[t + ": " + n, O("= ", i), g(r, " ")],
|
|
3582
3593
|
" "
|
|
3583
3594
|
)
|
|
3584
3595
|
},
|
|
3585
3596
|
InterfaceTypeDefinition: {
|
|
3586
|
-
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) =>
|
|
3587
|
-
`) +
|
|
3597
|
+
leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => O("", e, `
|
|
3598
|
+
`) + g(
|
|
3588
3599
|
[
|
|
3589
3600
|
"interface",
|
|
3590
3601
|
t,
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3602
|
+
O("implements ", g(n, " & ")),
|
|
3603
|
+
g(i, " "),
|
|
3604
|
+
U(r)
|
|
3594
3605
|
],
|
|
3595
3606
|
" "
|
|
3596
3607
|
)
|
|
3597
3608
|
},
|
|
3598
3609
|
UnionTypeDefinition: {
|
|
3599
|
-
leave: ({ description: e, name: t, directives: n, types: i }) =>
|
|
3600
|
-
`) +
|
|
3601
|
-
["union", t,
|
|
3610
|
+
leave: ({ description: e, name: t, directives: n, types: i }) => O("", e, `
|
|
3611
|
+
`) + g(
|
|
3612
|
+
["union", t, g(n, " "), O("= ", g(i, " | "))],
|
|
3602
3613
|
" "
|
|
3603
3614
|
)
|
|
3604
3615
|
},
|
|
3605
3616
|
EnumTypeDefinition: {
|
|
3606
|
-
leave: ({ description: e, name: t, directives: n, values: i }) =>
|
|
3607
|
-
`) +
|
|
3617
|
+
leave: ({ description: e, name: t, directives: n, values: i }) => O("", e, `
|
|
3618
|
+
`) + g(["enum", t, g(n, " "), U(i)], " ")
|
|
3608
3619
|
},
|
|
3609
3620
|
EnumValueDefinition: {
|
|
3610
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
3611
|
-
`) +
|
|
3621
|
+
leave: ({ description: e, name: t, directives: n }) => O("", e, `
|
|
3622
|
+
`) + g([t, g(n, " ")], " ")
|
|
3612
3623
|
},
|
|
3613
3624
|
InputObjectTypeDefinition: {
|
|
3614
|
-
leave: ({ description: e, name: t, directives: n, fields: i }) =>
|
|
3615
|
-
`) +
|
|
3625
|
+
leave: ({ description: e, name: t, directives: n, fields: i }) => O("", e, `
|
|
3626
|
+
`) + g(["input", t, g(n, " "), U(i)], " ")
|
|
3616
3627
|
},
|
|
3617
3628
|
DirectiveDefinition: {
|
|
3618
|
-
leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) =>
|
|
3619
|
-
`) + "directive @" + t + (
|
|
3620
|
-
`,
|
|
3629
|
+
leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => O("", e, `
|
|
3630
|
+
`) + "directive @" + t + (Ce(n) ? O(`(
|
|
3631
|
+
`, Ee(g(n, `
|
|
3621
3632
|
`)), `
|
|
3622
|
-
)`) :
|
|
3633
|
+
)`) : O("(", g(n, ", "), ")")) + (i ? " repeatable" : "") + " on " + g(r, " | ")
|
|
3623
3634
|
},
|
|
3624
3635
|
SchemaExtension: {
|
|
3625
|
-
leave: ({ directives: e, operationTypes: t }) =>
|
|
3626
|
-
["extend schema",
|
|
3636
|
+
leave: ({ directives: e, operationTypes: t }) => g(
|
|
3637
|
+
["extend schema", g(e, " "), U(t)],
|
|
3627
3638
|
" "
|
|
3628
3639
|
)
|
|
3629
3640
|
},
|
|
3630
3641
|
ScalarTypeExtension: {
|
|
3631
|
-
leave: ({ name: e, directives: t }) =>
|
|
3642
|
+
leave: ({ name: e, directives: t }) => g(["extend scalar", e, g(t, " ")], " ")
|
|
3632
3643
|
},
|
|
3633
3644
|
ObjectTypeExtension: {
|
|
3634
|
-
leave: ({ name: e, interfaces: t, directives: n, fields: i }) =>
|
|
3645
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: i }) => g(
|
|
3635
3646
|
[
|
|
3636
3647
|
"extend type",
|
|
3637
3648
|
e,
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3649
|
+
O("implements ", g(t, " & ")),
|
|
3650
|
+
g(n, " "),
|
|
3651
|
+
U(i)
|
|
3641
3652
|
],
|
|
3642
3653
|
" "
|
|
3643
3654
|
)
|
|
3644
3655
|
},
|
|
3645
3656
|
InterfaceTypeExtension: {
|
|
3646
|
-
leave: ({ name: e, interfaces: t, directives: n, fields: i }) =>
|
|
3657
|
+
leave: ({ name: e, interfaces: t, directives: n, fields: i }) => g(
|
|
3647
3658
|
[
|
|
3648
3659
|
"extend interface",
|
|
3649
3660
|
e,
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3661
|
+
O("implements ", g(t, " & ")),
|
|
3662
|
+
g(n, " "),
|
|
3663
|
+
U(i)
|
|
3653
3664
|
],
|
|
3654
3665
|
" "
|
|
3655
3666
|
)
|
|
3656
3667
|
},
|
|
3657
3668
|
UnionTypeExtension: {
|
|
3658
|
-
leave: ({ name: e, directives: t, types: n }) =>
|
|
3669
|
+
leave: ({ name: e, directives: t, types: n }) => g(
|
|
3659
3670
|
[
|
|
3660
3671
|
"extend union",
|
|
3661
3672
|
e,
|
|
3662
|
-
|
|
3663
|
-
|
|
3673
|
+
g(t, " "),
|
|
3674
|
+
O("= ", g(n, " | "))
|
|
3664
3675
|
],
|
|
3665
3676
|
" "
|
|
3666
3677
|
)
|
|
3667
3678
|
},
|
|
3668
3679
|
EnumTypeExtension: {
|
|
3669
|
-
leave: ({ name: e, directives: t, values: n }) =>
|
|
3680
|
+
leave: ({ name: e, directives: t, values: n }) => g(["extend enum", e, g(t, " "), U(n)], " ")
|
|
3670
3681
|
},
|
|
3671
3682
|
InputObjectTypeExtension: {
|
|
3672
|
-
leave: ({ name: e, directives: t, fields: n }) =>
|
|
3683
|
+
leave: ({ name: e, directives: t, fields: n }) => g(["extend input", e, g(t, " "), U(n)], " ")
|
|
3673
3684
|
},
|
|
3674
3685
|
// Schema Coordinates
|
|
3675
3686
|
TypeCoordinate: {
|
|
3676
3687
|
leave: ({ name: e }) => e
|
|
3677
3688
|
},
|
|
3678
3689
|
MemberCoordinate: {
|
|
3679
|
-
leave: ({ name: e, memberName: t }) =>
|
|
3690
|
+
leave: ({ name: e, memberName: t }) => g([e, O(".", t)])
|
|
3680
3691
|
},
|
|
3681
3692
|
ArgumentCoordinate: {
|
|
3682
|
-
leave: ({ name: e, fieldName: t, argumentName: n }) =>
|
|
3693
|
+
leave: ({ name: e, fieldName: t, argumentName: n }) => g([e, O(".", t), O("(", n, ":)")])
|
|
3683
3694
|
},
|
|
3684
3695
|
DirectiveCoordinate: {
|
|
3685
|
-
leave: ({ name: e }) =>
|
|
3696
|
+
leave: ({ name: e }) => g(["@", e])
|
|
3686
3697
|
},
|
|
3687
3698
|
DirectiveArgumentCoordinate: {
|
|
3688
|
-
leave: ({ name: e, argumentName: t }) =>
|
|
3699
|
+
leave: ({ name: e, argumentName: t }) => g(["@", e, O("(", t, ":)")])
|
|
3689
3700
|
}
|
|
3690
3701
|
};
|
|
3691
|
-
function
|
|
3702
|
+
function g(e, t = "") {
|
|
3692
3703
|
var n;
|
|
3693
3704
|
return (n = e?.filter((i) => i).join(t)) !== null && n !== void 0 ? n : "";
|
|
3694
3705
|
}
|
|
3695
|
-
function
|
|
3696
|
-
return
|
|
3697
|
-
`,
|
|
3706
|
+
function U(e) {
|
|
3707
|
+
return O(`{
|
|
3708
|
+
`, Ee(g(e, `
|
|
3698
3709
|
`)), `
|
|
3699
3710
|
}`);
|
|
3700
3711
|
}
|
|
3701
|
-
function
|
|
3712
|
+
function O(e, t, n = "") {
|
|
3702
3713
|
return t != null && t !== "" ? e + t + n : "";
|
|
3703
3714
|
}
|
|
3704
|
-
function
|
|
3705
|
-
return
|
|
3715
|
+
function Ee(e) {
|
|
3716
|
+
return O(" ", e.replace(/\n/g, `
|
|
3706
3717
|
`));
|
|
3707
3718
|
}
|
|
3708
|
-
function
|
|
3719
|
+
function Ce(e) {
|
|
3709
3720
|
var t;
|
|
3710
3721
|
return (t = e?.some((n) => n.includes(`
|
|
3711
3722
|
`))) !== null && t !== void 0 ? t : !1;
|
|
3712
3723
|
}
|
|
3713
|
-
const
|
|
3724
|
+
const nt = "Accept", Ue = "Content-Type", Ve = "application/json", Ct = "application/graphql-response+json", it = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), vi = (e) => {
|
|
3725
|
+
const t = e.toLowerCase();
|
|
3726
|
+
return t.includes(Ct) || t.includes(Ve);
|
|
3727
|
+
}, rt = (e) => {
|
|
3728
|
+
try {
|
|
3729
|
+
if (Array.isArray(e))
|
|
3730
|
+
return {
|
|
3731
|
+
_tag: "Batch",
|
|
3732
|
+
executionResults: e.map(st)
|
|
3733
|
+
};
|
|
3734
|
+
if (me(e))
|
|
3735
|
+
return {
|
|
3736
|
+
_tag: "Single",
|
|
3737
|
+
executionResult: st(e)
|
|
3738
|
+
};
|
|
3739
|
+
throw new Error(`Invalid execution result: result is not object or array.
|
|
3740
|
+
Got:
|
|
3741
|
+
${String(e)}`);
|
|
3742
|
+
} catch (t) {
|
|
3743
|
+
return t;
|
|
3744
|
+
}
|
|
3745
|
+
}, st = (e) => {
|
|
3746
|
+
if (typeof e != "object" || e === null)
|
|
3747
|
+
throw new Error("Invalid execution result: result is not object");
|
|
3748
|
+
let t, n, i;
|
|
3749
|
+
if ("errors" in e) {
|
|
3750
|
+
if (!me(e.errors) && !Array.isArray(e.errors))
|
|
3751
|
+
throw new Error("Invalid execution result: errors is not plain object OR array");
|
|
3752
|
+
t = e.errors;
|
|
3753
|
+
}
|
|
3754
|
+
if ("data" in e) {
|
|
3755
|
+
if (!me(e.data) && e.data !== null)
|
|
3756
|
+
throw new Error("Invalid execution result: data is not plain object");
|
|
3757
|
+
n = e.data;
|
|
3758
|
+
}
|
|
3759
|
+
if ("extensions" in e) {
|
|
3760
|
+
if (!me(e.extensions))
|
|
3761
|
+
throw new Error("Invalid execution result: extensions is not plain object");
|
|
3762
|
+
i = e.extensions;
|
|
3763
|
+
}
|
|
3764
|
+
return {
|
|
3765
|
+
data: n,
|
|
3766
|
+
errors: t,
|
|
3767
|
+
extensions: i
|
|
3768
|
+
};
|
|
3769
|
+
}, Ii = (e) => e._tag === "Batch" ? e.executionResults.some(ot) : ot(e.executionResult), ot = (e) => Array.isArray(e.errors) ? e.errors.length > 0 : !!e.errors, kt = (e) => typeof e == "object" && e !== null && "kind" in e && e.kind === w.OPERATION_DEFINITION, Oi = (e) => {
|
|
3714
3770
|
let t;
|
|
3715
|
-
const n = e.definitions.filter(
|
|
3716
|
-
return n.length === 1 && (t = n[0]
|
|
3717
|
-
},
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3771
|
+
const n = e.definitions.filter(kt);
|
|
3772
|
+
return n.length === 1 && (t = n[0].name?.value), t;
|
|
3773
|
+
}, Ai = (e) => {
|
|
3774
|
+
let t = !1;
|
|
3775
|
+
const n = e.definitions.filter(kt);
|
|
3776
|
+
return n.length === 1 && (t = n[0].operation === "mutation"), t;
|
|
3777
|
+
}, ke = (e, t) => {
|
|
3778
|
+
const n = typeof e == "string" || "kind" in e ? e : String(e), i = typeof n == "string" ? n : Ni(n);
|
|
3779
|
+
let r = !1, s;
|
|
3780
|
+
if (t)
|
|
3781
|
+
return { expression: i, isMutation: r, operationName: s };
|
|
3782
|
+
const o = _n(() => typeof n == "string" ? ui(n) : n);
|
|
3783
|
+
return o instanceof Error ? { expression: i, isMutation: r, operationName: s } : (s = Oi(o), r = Ai(o), { expression: i, operationName: s, isMutation: r });
|
|
3784
|
+
}, He = JSON, Re = async (e) => {
|
|
3785
|
+
const t = {
|
|
3786
|
+
...e,
|
|
3787
|
+
method: e.request._tag === "Single" ? e.request.document.isMutation ? "POST" : Ze(e.method ?? "post") : e.request.hasMutations ? "POST" : Ze(e.method ?? "post"),
|
|
3788
|
+
fetchOptions: {
|
|
3789
|
+
...e.fetchOptions,
|
|
3790
|
+
errorPolicy: e.fetchOptions.errorPolicy ?? "none"
|
|
3724
3791
|
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
}
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3792
|
+
}, i = await xi(t.method)(t), r = await i.text();
|
|
3793
|
+
let s;
|
|
3794
|
+
try {
|
|
3795
|
+
s = yi(r, i.headers.get(Ue), e.fetchOptions.jsonSerializer ?? He);
|
|
3796
|
+
} catch (a) {
|
|
3797
|
+
s = a;
|
|
3798
|
+
}
|
|
3799
|
+
const o = {
|
|
3800
|
+
status: i.status,
|
|
3801
|
+
headers: i.headers,
|
|
3802
|
+
body: r
|
|
3803
|
+
};
|
|
3804
|
+
if (!i.ok) {
|
|
3805
|
+
if (s instanceof Error)
|
|
3806
|
+
return new Z({ ...o }, {
|
|
3807
|
+
query: e.request._tag === "Single" ? e.request.document.expression : e.request.query,
|
|
3808
|
+
variables: e.request.variables
|
|
3809
|
+
});
|
|
3810
|
+
const a = s._tag === "Batch" ? { ...s.executionResults, ...o } : {
|
|
3811
|
+
...s.executionResult,
|
|
3812
|
+
...o
|
|
3813
|
+
};
|
|
3814
|
+
return new Z(a, {
|
|
3815
|
+
query: e.request._tag === "Single" ? e.request.document.expression : e.request.query,
|
|
3816
|
+
variables: e.request.variables
|
|
3817
|
+
});
|
|
3737
3818
|
}
|
|
3738
|
-
|
|
3739
|
-
|
|
3819
|
+
if (s instanceof Error)
|
|
3820
|
+
throw s;
|
|
3821
|
+
if (Ii(s) && t.fetchOptions.errorPolicy === "none") {
|
|
3822
|
+
const a = s._tag === "Batch" ? { ...s.executionResults, ...o } : {
|
|
3823
|
+
...s.executionResult,
|
|
3824
|
+
...o
|
|
3825
|
+
};
|
|
3826
|
+
return new Z(a, {
|
|
3827
|
+
query: e.request._tag === "Single" ? e.request.document.expression : e.request.query,
|
|
3828
|
+
variables: e.request.variables
|
|
3829
|
+
});
|
|
3740
3830
|
}
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
function E(h) {
|
|
3808
|
-
this.map = {}, h instanceof E ? h.forEach(function(m, D) {
|
|
3809
|
-
this.append(D, m);
|
|
3810
|
-
}, this) : Array.isArray(h) ? h.forEach(function(m) {
|
|
3811
|
-
if (m.length != 2)
|
|
3812
|
-
throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + m.length);
|
|
3813
|
-
this.append(m[0], m[1]);
|
|
3814
|
-
}, this) : h && Object.getOwnPropertyNames(h).forEach(function(m) {
|
|
3815
|
-
this.append(m, h[m]);
|
|
3816
|
-
}, this);
|
|
3817
|
-
}
|
|
3818
|
-
E.prototype.append = function(h, m) {
|
|
3819
|
-
h = d(h), m = N(m);
|
|
3820
|
-
var D = this.map[h];
|
|
3821
|
-
this.map[h] = D ? D + ", " + m : m;
|
|
3822
|
-
}, E.prototype.delete = function(h) {
|
|
3823
|
-
delete this.map[d(h)];
|
|
3824
|
-
}, E.prototype.get = function(h) {
|
|
3825
|
-
return h = d(h), this.has(h) ? this.map[h] : null;
|
|
3826
|
-
}, E.prototype.has = function(h) {
|
|
3827
|
-
return this.map.hasOwnProperty(d(h));
|
|
3828
|
-
}, E.prototype.set = function(h, m) {
|
|
3829
|
-
this.map[d(h)] = N(m);
|
|
3830
|
-
}, E.prototype.forEach = function(h, m) {
|
|
3831
|
-
for (var D in this.map)
|
|
3832
|
-
this.map.hasOwnProperty(D) && h.call(m, this.map[D], D, this);
|
|
3833
|
-
}, E.prototype.keys = function() {
|
|
3834
|
-
var h = [];
|
|
3835
|
-
return this.forEach(function(m, D) {
|
|
3836
|
-
h.push(D);
|
|
3837
|
-
}), T(h);
|
|
3838
|
-
}, E.prototype.values = function() {
|
|
3839
|
-
var h = [];
|
|
3840
|
-
return this.forEach(function(m) {
|
|
3841
|
-
h.push(m);
|
|
3842
|
-
}), T(h);
|
|
3843
|
-
}, E.prototype.entries = function() {
|
|
3844
|
-
var h = [];
|
|
3845
|
-
return this.forEach(function(m, D) {
|
|
3846
|
-
h.push([D, m]);
|
|
3847
|
-
}), T(h);
|
|
3848
|
-
}, u.iterable && (E.prototype[Symbol.iterator] = E.prototype.entries);
|
|
3849
|
-
function x(h) {
|
|
3850
|
-
if (!h._noBody) {
|
|
3851
|
-
if (h.bodyUsed)
|
|
3852
|
-
return Promise.reject(new TypeError("Already read"));
|
|
3853
|
-
h.bodyUsed = !0;
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
|
-
function _(h) {
|
|
3857
|
-
return new Promise(function(m, D) {
|
|
3858
|
-
h.onload = function() {
|
|
3859
|
-
m(h.result);
|
|
3860
|
-
}, h.onerror = function() {
|
|
3861
|
-
D(h.error);
|
|
3862
|
-
};
|
|
3863
|
-
});
|
|
3864
|
-
}
|
|
3865
|
-
function q(h) {
|
|
3866
|
-
var m = new FileReader(), D = _(m);
|
|
3867
|
-
return m.readAsArrayBuffer(h), D;
|
|
3868
|
-
}
|
|
3869
|
-
function b(h) {
|
|
3870
|
-
var m = new FileReader(), D = _(m), k = /charset=([A-Za-z0-9_-]+)/.exec(h.type), L = k ? k[1] : "utf-8";
|
|
3871
|
-
return m.readAsText(h, L), D;
|
|
3872
|
-
}
|
|
3873
|
-
function S(h) {
|
|
3874
|
-
for (var m = new Uint8Array(h), D = new Array(m.length), k = 0; k < m.length; k++)
|
|
3875
|
-
D[k] = String.fromCharCode(m[k]);
|
|
3876
|
-
return D.join("");
|
|
3877
|
-
}
|
|
3878
|
-
function J(h) {
|
|
3879
|
-
if (h.slice)
|
|
3880
|
-
return h.slice(0);
|
|
3881
|
-
var m = new Uint8Array(h.byteLength);
|
|
3882
|
-
return m.set(new Uint8Array(h)), m.buffer;
|
|
3883
|
-
}
|
|
3884
|
-
function $() {
|
|
3885
|
-
return this.bodyUsed = !1, this._initBody = function(h) {
|
|
3886
|
-
this.bodyUsed = this.bodyUsed, this._bodyInit = h, h ? typeof h == "string" ? this._bodyText = h : u.blob && Blob.prototype.isPrototypeOf(h) ? this._bodyBlob = h : u.formData && FormData.prototype.isPrototypeOf(h) ? this._bodyFormData = h : u.searchParams && URLSearchParams.prototype.isPrototypeOf(h) ? this._bodyText = h.toString() : u.arrayBuffer && u.blob && c(h) ? (this._bodyArrayBuffer = J(h.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : u.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(h) || f(h)) ? this._bodyArrayBuffer = J(h) : this._bodyText = h = Object.prototype.toString.call(h) : (this._noBody = !0, this._bodyText = ""), this.headers.get("content-type") || (typeof h == "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(h) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
3887
|
-
}, u.blob && (this.blob = function() {
|
|
3888
|
-
var h = x(this);
|
|
3889
|
-
if (h)
|
|
3890
|
-
return h;
|
|
3891
|
-
if (this._bodyBlob)
|
|
3892
|
-
return Promise.resolve(this._bodyBlob);
|
|
3893
|
-
if (this._bodyArrayBuffer)
|
|
3894
|
-
return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
|
3895
|
-
if (this._bodyFormData)
|
|
3896
|
-
throw new Error("could not read FormData body as blob");
|
|
3897
|
-
return Promise.resolve(new Blob([this._bodyText]));
|
|
3898
|
-
}), this.arrayBuffer = function() {
|
|
3899
|
-
if (this._bodyArrayBuffer) {
|
|
3900
|
-
var h = x(this);
|
|
3901
|
-
return h || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(
|
|
3902
|
-
this._bodyArrayBuffer.buffer.slice(
|
|
3903
|
-
this._bodyArrayBuffer.byteOffset,
|
|
3904
|
-
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
|
3905
|
-
)
|
|
3906
|
-
) : Promise.resolve(this._bodyArrayBuffer));
|
|
3907
|
-
} else {
|
|
3908
|
-
if (u.blob)
|
|
3909
|
-
return this.blob().then(q);
|
|
3910
|
-
throw new Error("could not read as ArrayBuffer");
|
|
3911
|
-
}
|
|
3912
|
-
}, this.text = function() {
|
|
3913
|
-
var h = x(this);
|
|
3914
|
-
if (h)
|
|
3915
|
-
return h;
|
|
3916
|
-
if (this._bodyBlob)
|
|
3917
|
-
return b(this._bodyBlob);
|
|
3918
|
-
if (this._bodyArrayBuffer)
|
|
3919
|
-
return Promise.resolve(S(this._bodyArrayBuffer));
|
|
3920
|
-
if (this._bodyFormData)
|
|
3921
|
-
throw new Error("could not read FormData body as text");
|
|
3922
|
-
return Promise.resolve(this._bodyText);
|
|
3923
|
-
}, u.formData && (this.formData = function() {
|
|
3924
|
-
return this.text().then(me);
|
|
3925
|
-
}), this.json = function() {
|
|
3926
|
-
return this.text().then(JSON.parse);
|
|
3927
|
-
}, this;
|
|
3928
|
-
}
|
|
3929
|
-
var K = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
3930
|
-
function ae(h) {
|
|
3931
|
-
var m = h.toUpperCase();
|
|
3932
|
-
return K.indexOf(m) > -1 ? m : h;
|
|
3933
|
-
}
|
|
3934
|
-
function H(h, m) {
|
|
3935
|
-
if (!(this instanceof H))
|
|
3936
|
-
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
3937
|
-
m = m || {};
|
|
3938
|
-
var D = m.body;
|
|
3939
|
-
if (h instanceof H) {
|
|
3940
|
-
if (h.bodyUsed)
|
|
3941
|
-
throw new TypeError("Already read");
|
|
3942
|
-
this.url = h.url, this.credentials = h.credentials, m.headers || (this.headers = new E(h.headers)), this.method = h.method, this.mode = h.mode, this.signal = h.signal, !D && h._bodyInit != null && (D = h._bodyInit, h.bodyUsed = !0);
|
|
3943
|
-
} else
|
|
3944
|
-
this.url = String(h);
|
|
3945
|
-
if (this.credentials = m.credentials || this.credentials || "same-origin", (m.headers || !this.headers) && (this.headers = new E(m.headers)), this.method = ae(m.method || this.method || "GET"), this.mode = m.mode || this.mode || null, this.signal = m.signal || this.signal || (function() {
|
|
3946
|
-
if ("AbortController" in a) {
|
|
3947
|
-
var C = new AbortController();
|
|
3948
|
-
return C.signal;
|
|
3949
|
-
}
|
|
3950
|
-
})(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && D)
|
|
3951
|
-
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
3952
|
-
if (this._initBody(D), (this.method === "GET" || this.method === "HEAD") && (m.cache === "no-store" || m.cache === "no-cache")) {
|
|
3953
|
-
var k = /([?&])_=[^&]*/;
|
|
3954
|
-
if (k.test(this.url))
|
|
3955
|
-
this.url = this.url.replace(k, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
|
|
3956
|
-
else {
|
|
3957
|
-
var L = /\?/;
|
|
3958
|
-
this.url += (L.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
|
|
3959
|
-
}
|
|
3960
|
-
}
|
|
3961
|
-
}
|
|
3962
|
-
H.prototype.clone = function() {
|
|
3963
|
-
return new H(this, { body: this._bodyInit });
|
|
3964
|
-
};
|
|
3965
|
-
function me(h) {
|
|
3966
|
-
var m = new FormData();
|
|
3967
|
-
return h.trim().split("&").forEach(function(D) {
|
|
3968
|
-
if (D) {
|
|
3969
|
-
var k = D.split("="), L = k.shift().replace(/\+/g, " "), C = k.join("=").replace(/\+/g, " ");
|
|
3970
|
-
m.append(decodeURIComponent(L), decodeURIComponent(C));
|
|
3971
|
-
}
|
|
3972
|
-
}), m;
|
|
3973
|
-
}
|
|
3974
|
-
function Y(h) {
|
|
3975
|
-
var m = new E(), D = h.replace(/\r?\n[\t ]+/g, " ");
|
|
3976
|
-
return D.split("\r").map(function(k) {
|
|
3977
|
-
return k.indexOf(`
|
|
3978
|
-
`) === 0 ? k.substr(1, k.length) : k;
|
|
3979
|
-
}).forEach(function(k) {
|
|
3980
|
-
var L = k.split(":"), C = L.shift().trim();
|
|
3981
|
-
if (C) {
|
|
3982
|
-
var Te = L.join(":").trim();
|
|
3983
|
-
try {
|
|
3984
|
-
m.append(C, Te);
|
|
3985
|
-
} catch (Me) {
|
|
3986
|
-
console.warn("Response " + Me.message);
|
|
3987
|
-
}
|
|
3988
|
-
}
|
|
3989
|
-
}), m;
|
|
3990
|
-
}
|
|
3991
|
-
$.call(H.prototype);
|
|
3992
|
-
function V(h, m) {
|
|
3993
|
-
if (!(this instanceof V))
|
|
3994
|
-
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
3995
|
-
if (m || (m = {}), this.type = "default", this.status = m.status === void 0 ? 200 : m.status, this.status < 200 || this.status > 599)
|
|
3996
|
-
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
|
|
3997
|
-
this.ok = this.status >= 200 && this.status < 300, this.statusText = m.statusText === void 0 ? "" : "" + m.statusText, this.headers = new E(m.headers), this.url = m.url || "", this._initBody(h);
|
|
3998
|
-
}
|
|
3999
|
-
$.call(V.prototype), V.prototype.clone = function() {
|
|
4000
|
-
return new V(this._bodyInit, {
|
|
4001
|
-
status: this.status,
|
|
4002
|
-
statusText: this.statusText,
|
|
4003
|
-
headers: new E(this.headers),
|
|
4004
|
-
url: this.url
|
|
4005
|
-
});
|
|
4006
|
-
}, V.error = function() {
|
|
4007
|
-
var h = new V(null, { status: 200, statusText: "" });
|
|
4008
|
-
return h.ok = !1, h.status = 0, h.type = "error", h;
|
|
4009
|
-
};
|
|
4010
|
-
var ce = [301, 302, 303, 307, 308];
|
|
4011
|
-
V.redirect = function(h, m) {
|
|
4012
|
-
if (ce.indexOf(m) === -1)
|
|
4013
|
-
throw new RangeError("Invalid status code");
|
|
4014
|
-
return new V(null, { status: m, headers: { location: h } });
|
|
4015
|
-
}, o.DOMException = a.DOMException;
|
|
4016
|
-
try {
|
|
4017
|
-
new o.DOMException();
|
|
4018
|
-
} catch {
|
|
4019
|
-
o.DOMException = function(m, D) {
|
|
4020
|
-
this.message = m, this.name = D;
|
|
4021
|
-
var k = Error(m);
|
|
4022
|
-
this.stack = k.stack;
|
|
4023
|
-
}, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
|
|
4024
|
-
}
|
|
4025
|
-
function re(h, m) {
|
|
4026
|
-
return new Promise(function(D, k) {
|
|
4027
|
-
var L = new H(h, m);
|
|
4028
|
-
if (L.signal && L.signal.aborted)
|
|
4029
|
-
return k(new o.DOMException("Aborted", "AbortError"));
|
|
4030
|
-
var C = new XMLHttpRequest();
|
|
4031
|
-
function Te() {
|
|
4032
|
-
C.abort();
|
|
4033
|
-
}
|
|
4034
|
-
C.onload = function() {
|
|
4035
|
-
var B = {
|
|
4036
|
-
statusText: C.statusText,
|
|
4037
|
-
headers: Y(C.getAllResponseHeaders() || "")
|
|
4038
|
-
};
|
|
4039
|
-
L.url.indexOf("file://") === 0 && (C.status < 200 || C.status > 599) ? B.status = 200 : B.status = C.status, B.url = "responseURL" in C ? C.responseURL : B.headers.get("X-Request-URL");
|
|
4040
|
-
var se = "response" in C ? C.response : C.responseText;
|
|
4041
|
-
setTimeout(function() {
|
|
4042
|
-
D(new V(se, B));
|
|
4043
|
-
}, 0);
|
|
4044
|
-
}, C.onerror = function() {
|
|
4045
|
-
setTimeout(function() {
|
|
4046
|
-
k(new TypeError("Network request failed"));
|
|
4047
|
-
}, 0);
|
|
4048
|
-
}, C.ontimeout = function() {
|
|
4049
|
-
setTimeout(function() {
|
|
4050
|
-
k(new TypeError("Network request timed out"));
|
|
4051
|
-
}, 0);
|
|
4052
|
-
}, C.onabort = function() {
|
|
4053
|
-
setTimeout(function() {
|
|
4054
|
-
k(new o.DOMException("Aborted", "AbortError"));
|
|
4055
|
-
}, 0);
|
|
4056
|
-
};
|
|
4057
|
-
function Me(B) {
|
|
4058
|
-
try {
|
|
4059
|
-
return B === "" && a.location.href ? a.location.href : B;
|
|
4060
|
-
} catch {
|
|
4061
|
-
return B;
|
|
4062
|
-
}
|
|
4063
|
-
}
|
|
4064
|
-
if (C.open(L.method, Me(L.url), !0), L.credentials === "include" ? C.withCredentials = !0 : L.credentials === "omit" && (C.withCredentials = !1), "responseType" in C && (u.blob ? C.responseType = "blob" : u.arrayBuffer && (C.responseType = "arraybuffer")), m && typeof m.headers == "object" && !(m.headers instanceof E || a.Headers && m.headers instanceof a.Headers)) {
|
|
4065
|
-
var tt = [];
|
|
4066
|
-
Object.getOwnPropertyNames(m.headers).forEach(function(B) {
|
|
4067
|
-
tt.push(d(B)), C.setRequestHeader(B, N(m.headers[B]));
|
|
4068
|
-
}), L.headers.forEach(function(B, se) {
|
|
4069
|
-
tt.indexOf(se) === -1 && C.setRequestHeader(se, B);
|
|
4070
|
-
});
|
|
4071
|
-
} else
|
|
4072
|
-
L.headers.forEach(function(B, se) {
|
|
4073
|
-
C.setRequestHeader(se, B);
|
|
4074
|
-
});
|
|
4075
|
-
L.signal && (L.signal.addEventListener("abort", Te), C.onreadystatechange = function() {
|
|
4076
|
-
C.readyState === 4 && L.signal.removeEventListener("abort", Te);
|
|
4077
|
-
}), C.send(typeof L._bodyInit > "u" ? null : L._bodyInit);
|
|
4078
|
-
});
|
|
4079
|
-
}
|
|
4080
|
-
return re.polyfill = !0, a.fetch || (a.fetch = re, a.Headers = E, a.Request = H, a.Response = V), o.Headers = E, o.Request = H, o.Response = V, o.fetch = re, Object.defineProperty(o, "__esModule", { value: !0 }), o;
|
|
4081
|
-
})({});
|
|
4082
|
-
})(i), i.fetch.ponyfill = !0, delete i.fetch.polyfill;
|
|
4083
|
-
var r = n.fetch ? n : i;
|
|
4084
|
-
t = r.fetch, t.default = r.fetch, t.fetch = r.fetch, t.Headers = r.Headers, t.Request = r.Request, t.Response = r.Response, e.exports = t;
|
|
4085
|
-
})(Ae, Ae.exports)), Ae.exports;
|
|
4086
|
-
}
|
|
4087
|
-
var Se = Oi();
|
|
4088
|
-
const be = /* @__PURE__ */ Ai(Se), Ii = /* @__PURE__ */ Lt({
|
|
4089
|
-
__proto__: null,
|
|
4090
|
-
default: be
|
|
4091
|
-
}, [Se]), ue = (e) => {
|
|
4092
|
-
let t = {};
|
|
4093
|
-
return e && (typeof Headers < "u" && e instanceof Headers || Ii && Se.Headers && e instanceof Se.Headers ? t = xn(e) : Array.isArray(e) ? e.forEach(([n, i]) => {
|
|
4094
|
-
n && i !== void 0 && (t[n] = i);
|
|
4095
|
-
}) : t = e), t;
|
|
4096
|
-
}, ft = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), _i = (e) => {
|
|
4097
|
-
if (!Array.isArray(e.query)) {
|
|
4098
|
-
const i = e, r = [`query=${encodeURIComponent(ft(i.query))}`];
|
|
4099
|
-
return e.variables && r.push(`variables=${encodeURIComponent(i.jsonSerializer.stringify(i.variables))}`), i.operationName && r.push(`operationName=${encodeURIComponent(i.operationName)}`), r.join("&");
|
|
4100
|
-
}
|
|
4101
|
-
if (typeof e.variables < "u" && !Array.isArray(e.variables))
|
|
4102
|
-
throw new Error("Cannot create query with given variable type, array expected");
|
|
4103
|
-
const t = e, n = e.query.reduce((i, r, s) => (i.push({
|
|
4104
|
-
query: ft(r),
|
|
4105
|
-
variables: t.variables ? t.jsonSerializer.stringify(t.variables[s]) : void 0
|
|
4106
|
-
}), i), []);
|
|
4107
|
-
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
4108
|
-
}, bi = (e) => async (t) => {
|
|
4109
|
-
const { url: n, query: i, variables: r, operationName: s, fetch: o, fetchOptions: a, middleware: u } = t, c = { ...t.headers };
|
|
4110
|
-
let l = "", f;
|
|
4111
|
-
e === "POST" ? (f = Ci(i, r, s, a.jsonSerializer), typeof f == "string" && (c["Content-Type"] = "application/json")) : l = _i({
|
|
4112
|
-
query: i,
|
|
4113
|
-
variables: r,
|
|
4114
|
-
operationName: s,
|
|
4115
|
-
jsonSerializer: a.jsonSerializer ?? We
|
|
4116
|
-
});
|
|
4117
|
-
const d = {
|
|
4118
|
-
method: e,
|
|
4119
|
-
headers: c,
|
|
4120
|
-
body: f,
|
|
4121
|
-
...a
|
|
4122
|
-
};
|
|
4123
|
-
let N = n, T = d;
|
|
4124
|
-
if (u) {
|
|
4125
|
-
const E = await Promise.resolve(u({ ...d, url: n, operationName: s, variables: r })), { url: x, ..._ } = E;
|
|
4126
|
-
N = x, T = _;
|
|
3831
|
+
switch (s._tag) {
|
|
3832
|
+
case "Single":
|
|
3833
|
+
return {
|
|
3834
|
+
...o,
|
|
3835
|
+
...at(t)(s.executionResult)
|
|
3836
|
+
};
|
|
3837
|
+
case "Batch":
|
|
3838
|
+
return {
|
|
3839
|
+
...o,
|
|
3840
|
+
data: s.executionResults.map(at(t))
|
|
3841
|
+
};
|
|
3842
|
+
default:
|
|
3843
|
+
$e(s);
|
|
3844
|
+
}
|
|
3845
|
+
}, at = (e) => (t) => ({
|
|
3846
|
+
extensions: t.extensions,
|
|
3847
|
+
data: t.data,
|
|
3848
|
+
errors: e.fetchOptions.errorPolicy === "all" ? t.errors : void 0
|
|
3849
|
+
}), yi = (e, t, n) => t && vi(t) ? rt(n.parse(e)) : rt(e), xi = (e) => async (t) => {
|
|
3850
|
+
const n = new Headers(t.headers);
|
|
3851
|
+
let i = null, r;
|
|
3852
|
+
n.has(nt) || n.set(nt, [Ct, Ve].join(", ")), e === "POST" ? (r = (t.fetchOptions.jsonSerializer ?? He).stringify(Di(t)), typeof r == "string" && !n.has(Ue) && n.set(Ue, Ve)) : i = _i(t);
|
|
3853
|
+
const s = { method: e, headers: n, body: r, ...t.fetchOptions };
|
|
3854
|
+
let o = new URL(t.url), a = s;
|
|
3855
|
+
if (t.middleware) {
|
|
3856
|
+
const c = await Promise.resolve(t.middleware({
|
|
3857
|
+
...s,
|
|
3858
|
+
url: t.url,
|
|
3859
|
+
operationName: t.request._tag === "Single" ? t.request.document.operationName : void 0,
|
|
3860
|
+
variables: t.request.variables
|
|
3861
|
+
})), { url: l, ...f } = c;
|
|
3862
|
+
o = new URL(l), a = f;
|
|
3863
|
+
}
|
|
3864
|
+
return i && i.forEach((c, l) => {
|
|
3865
|
+
o.searchParams.append(l, c);
|
|
3866
|
+
}), await (t.fetch ?? fetch)(o, a);
|
|
3867
|
+
}, Di = (e) => {
|
|
3868
|
+
switch (e.request._tag) {
|
|
3869
|
+
case "Single":
|
|
3870
|
+
return {
|
|
3871
|
+
query: e.request.document.expression,
|
|
3872
|
+
variables: e.request.variables,
|
|
3873
|
+
operationName: e.request.document.operationName
|
|
3874
|
+
};
|
|
3875
|
+
case "Batch":
|
|
3876
|
+
return Tt(e.request.query, e.request.variables ?? []).map(([t, n]) => ({
|
|
3877
|
+
query: t,
|
|
3878
|
+
variables: n
|
|
3879
|
+
}));
|
|
3880
|
+
default:
|
|
3881
|
+
throw $e(e.request);
|
|
3882
|
+
}
|
|
3883
|
+
}, _i = (e) => {
|
|
3884
|
+
const t = e.fetchOptions.jsonSerializer ?? He, n = new URLSearchParams();
|
|
3885
|
+
switch (e.request._tag) {
|
|
3886
|
+
case "Single":
|
|
3887
|
+
return n.append("query", it(e.request.document.expression)), e.request.variables && n.append("variables", t.stringify(e.request.variables)), e.request.document.operationName && n.append("operationName", e.request.document.operationName), n;
|
|
3888
|
+
case "Batch": {
|
|
3889
|
+
const i = e.request.variables?.map((o) => t.stringify(o)) ?? [], r = e.request.query.map(it), s = Tt(r, i).map(([o, a]) => ({
|
|
3890
|
+
query: o,
|
|
3891
|
+
variables: a
|
|
3892
|
+
}));
|
|
3893
|
+
return n.append("query", t.stringify(s)), n;
|
|
3894
|
+
}
|
|
3895
|
+
default:
|
|
3896
|
+
throw $e(e.request);
|
|
4127
3897
|
}
|
|
4128
|
-
return l && (N = `${N}?${l}`), await o(N, T);
|
|
4129
3898
|
};
|
|
4130
|
-
class
|
|
3899
|
+
class Si {
|
|
3900
|
+
url;
|
|
3901
|
+
requestConfig;
|
|
4131
3902
|
constructor(t, n = {}) {
|
|
4132
|
-
this.url = t, this.requestConfig = n
|
|
4133
|
-
const [r, s, o] = i, a = kn(r, s, o), { headers: u, fetch: c = be, method: l = "POST", requestMiddleware: f, responseMiddleware: d, ...N } = this.requestConfig, { url: T } = this;
|
|
4134
|
-
a.signal !== void 0 && (N.signal = a.signal);
|
|
4135
|
-
const { operationName: E } = qe(a.query);
|
|
4136
|
-
return Ve({
|
|
4137
|
-
url: T,
|
|
4138
|
-
query: a.query,
|
|
4139
|
-
variables: a.variables,
|
|
4140
|
-
headers: {
|
|
4141
|
-
...ue(je(u)),
|
|
4142
|
-
...ue(a.requestHeaders)
|
|
4143
|
-
},
|
|
4144
|
-
operationName: E,
|
|
4145
|
-
fetch: c,
|
|
4146
|
-
method: l,
|
|
4147
|
-
fetchOptions: N,
|
|
4148
|
-
middleware: f
|
|
4149
|
-
}).then((x) => (d && d(x), x)).catch((x) => {
|
|
4150
|
-
throw d && d(x), x;
|
|
4151
|
-
});
|
|
4152
|
-
};
|
|
3903
|
+
this.url = t, this.requestConfig = n;
|
|
4153
3904
|
}
|
|
3905
|
+
/**
|
|
3906
|
+
* Send a GraphQL query to the server.
|
|
3907
|
+
*/
|
|
3908
|
+
rawRequest = async (...t) => {
|
|
3909
|
+
const [n, i, r] = t, s = kn(n, i, r), { headers: o, fetch: a = globalThis.fetch, method: u = "POST", requestMiddleware: c, responseMiddleware: l, excludeOperationName: f, ...h } = this.requestConfig, { url: m } = this;
|
|
3910
|
+
s.signal !== void 0 && (h.signal = s.signal);
|
|
3911
|
+
const N = ke(s.query, f), E = await Re({
|
|
3912
|
+
url: m,
|
|
3913
|
+
request: {
|
|
3914
|
+
_tag: "Single",
|
|
3915
|
+
document: N,
|
|
3916
|
+
variables: s.variables
|
|
3917
|
+
},
|
|
3918
|
+
headers: {
|
|
3919
|
+
...K(_e(o)),
|
|
3920
|
+
...K(s.requestHeaders)
|
|
3921
|
+
},
|
|
3922
|
+
fetch: a,
|
|
3923
|
+
method: u,
|
|
3924
|
+
fetchOptions: h,
|
|
3925
|
+
middleware: c
|
|
3926
|
+
});
|
|
3927
|
+
if (l && await l(E, {
|
|
3928
|
+
operationName: N.operationName,
|
|
3929
|
+
variables: i,
|
|
3930
|
+
url: this.url
|
|
3931
|
+
}), E instanceof Error)
|
|
3932
|
+
throw E;
|
|
3933
|
+
return E;
|
|
3934
|
+
};
|
|
4154
3935
|
async request(t, ...n) {
|
|
4155
|
-
const [i, r] = n, s =
|
|
4156
|
-
s.signal !== void 0 && (
|
|
4157
|
-
const
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
3936
|
+
const [i, r] = n, s = Ci(t, i, r), { headers: o, fetch: a = globalThis.fetch, method: u = "POST", requestMiddleware: c, responseMiddleware: l, excludeOperationName: f, ...h } = this.requestConfig, { url: m } = this;
|
|
3937
|
+
s.signal !== void 0 && (h.signal = s.signal);
|
|
3938
|
+
const N = ke(s.document, f), E = await Re({
|
|
3939
|
+
url: m,
|
|
3940
|
+
request: {
|
|
3941
|
+
_tag: "Single",
|
|
3942
|
+
document: N,
|
|
3943
|
+
variables: s.variables
|
|
3944
|
+
},
|
|
4162
3945
|
headers: {
|
|
4163
|
-
...
|
|
4164
|
-
...
|
|
3946
|
+
...K(_e(o)),
|
|
3947
|
+
...K(s.requestHeaders)
|
|
4165
3948
|
},
|
|
4166
|
-
operationName: T,
|
|
4167
3949
|
fetch: a,
|
|
4168
3950
|
method: u,
|
|
4169
|
-
fetchOptions:
|
|
3951
|
+
fetchOptions: h,
|
|
4170
3952
|
middleware: c
|
|
4171
|
-
}).then((E) => (l && l(E), E.data)).catch((E) => {
|
|
4172
|
-
throw l && l(E), E;
|
|
4173
3953
|
});
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
return
|
|
3954
|
+
if (l && await l(E, {
|
|
3955
|
+
operationName: N.operationName,
|
|
3956
|
+
variables: s.variables,
|
|
3957
|
+
url: this.url
|
|
3958
|
+
}), E instanceof Error)
|
|
3959
|
+
throw E;
|
|
3960
|
+
return E.data;
|
|
3961
|
+
}
|
|
3962
|
+
async batchRequests(t, n) {
|
|
3963
|
+
const i = Cn(t, n), { headers: r, excludeOperationName: s, ...o } = this.requestConfig;
|
|
3964
|
+
i.signal !== void 0 && (o.signal = i.signal);
|
|
3965
|
+
const a = i.documents.map(({ document: h }) => ke(h, s)), u = a.map(({ expression: h }) => h), c = a.some(({ isMutation: h }) => h), l = i.documents.map(({ variables: h }) => h), f = await Re({
|
|
4181
3966
|
url: this.url,
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
3967
|
+
request: {
|
|
3968
|
+
_tag: "Batch",
|
|
3969
|
+
operationName: void 0,
|
|
3970
|
+
query: u,
|
|
3971
|
+
hasMutations: c,
|
|
3972
|
+
variables: l
|
|
3973
|
+
},
|
|
4185
3974
|
headers: {
|
|
4186
|
-
...
|
|
4187
|
-
...
|
|
3975
|
+
...K(_e(r)),
|
|
3976
|
+
...K(i.requestHeaders)
|
|
4188
3977
|
},
|
|
4189
|
-
|
|
4190
|
-
fetch: this.requestConfig.fetch ?? be,
|
|
3978
|
+
fetch: this.requestConfig.fetch ?? globalThis.fetch,
|
|
4191
3979
|
method: this.requestConfig.method || "POST",
|
|
4192
|
-
fetchOptions:
|
|
3980
|
+
fetchOptions: o,
|
|
4193
3981
|
middleware: this.requestConfig.requestMiddleware
|
|
4194
|
-
}).then((u) => (this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(u), u.data)).catch((u) => {
|
|
4195
|
-
throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(u), u;
|
|
4196
3982
|
});
|
|
3983
|
+
if (this.requestConfig.responseMiddleware && await this.requestConfig.responseMiddleware(f, {
|
|
3984
|
+
operationName: void 0,
|
|
3985
|
+
variables: l,
|
|
3986
|
+
url: this.url
|
|
3987
|
+
}), f instanceof Error)
|
|
3988
|
+
throw f;
|
|
3989
|
+
return f.data;
|
|
4197
3990
|
}
|
|
4198
3991
|
setHeaders(t) {
|
|
4199
3992
|
return this.requestConfig.headers = t, this;
|
|
@@ -4212,39 +4005,12 @@ class Di {
|
|
|
4212
4005
|
return this.url = t, this;
|
|
4213
4006
|
}
|
|
4214
4007
|
}
|
|
4215
|
-
const
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
headers: o.headers,
|
|
4222
|
-
status: o.status
|
|
4223
|
-
};
|
|
4224
|
-
} else {
|
|
4225
|
-
const l = typeof a == "string" ? {
|
|
4226
|
-
error: a
|
|
4227
|
-
} : a;
|
|
4228
|
-
throw new Ee(
|
|
4229
|
-
// @ts-expect-error TODO
|
|
4230
|
-
{ ...l, status: o.status, headers: o.headers },
|
|
4231
|
-
{ query: t, variables: n }
|
|
4232
|
-
);
|
|
4233
|
-
}
|
|
4234
|
-
}, Ci = (e, t, n, i) => {
|
|
4235
|
-
const r = i ?? We;
|
|
4236
|
-
if (!Array.isArray(e))
|
|
4237
|
-
return r.stringify({ query: e, variables: t, operationName: n });
|
|
4238
|
-
if (typeof t < "u" && !Array.isArray(t))
|
|
4239
|
-
throw new Error("Cannot create request body with given variable type, array expected");
|
|
4240
|
-
const s = e.reduce((o, a, u) => (o.push({ query: a, variables: t ? t[u] : void 0 }), o), []);
|
|
4241
|
-
return r.stringify(s);
|
|
4242
|
-
}, xi = async (e, t) => {
|
|
4243
|
-
let n;
|
|
4244
|
-
return e.headers.forEach((i, r) => {
|
|
4245
|
-
r.toLowerCase() === "content-type" && (n = i);
|
|
4246
|
-
}), 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();
|
|
4247
|
-
}, je = (e) => typeof e == "function" ? e() : e, Rt = (e, ...t) => e.reduce((n, i, r) => `${n}${i}${r in t ? String(t[r]) : ""}`, ""), Si = {
|
|
4008
|
+
const Ci = (e, t, n) => e.document ? e : {
|
|
4009
|
+
document: e,
|
|
4010
|
+
variables: t,
|
|
4011
|
+
requestHeaders: n,
|
|
4012
|
+
signal: void 0
|
|
4013
|
+
}, Rt = (e, ...t) => e.reduce((n, i, r) => `${n}${i}${r in t ? String(t[r]) : ""}`, ""), ki = {
|
|
4248
4014
|
getMeta: Rt`
|
|
4249
4015
|
query getDoctype($doctype: String!) {
|
|
4250
4016
|
getMeta(doctype: $doctype) {
|
|
@@ -4256,7 +4022,7 @@ const Ve = async (e) => {
|
|
|
4256
4022
|
}
|
|
4257
4023
|
}
|
|
4258
4024
|
`
|
|
4259
|
-
},
|
|
4025
|
+
}, bi = Rt`
|
|
4260
4026
|
type Doctype {
|
|
4261
4027
|
id: ID!
|
|
4262
4028
|
name: String!
|
|
@@ -4302,28 +4068,28 @@ const Ve = async (e) => {
|
|
|
4302
4068
|
query: Query
|
|
4303
4069
|
mutation: Mutation
|
|
4304
4070
|
}
|
|
4305
|
-
`,
|
|
4071
|
+
`, Ri = (e) => JSON.parse(e, (t, n) => {
|
|
4306
4072
|
if (typeof n == "string")
|
|
4307
4073
|
try {
|
|
4308
|
-
return JSON.parse(n, (i, r) => typeof r == "string" && !isNaN(Number(r)) ? new
|
|
4074
|
+
return JSON.parse(n, (i, r) => typeof r == "string" && !isNaN(Number(r)) ? new ie(r) : r);
|
|
4309
4075
|
} catch {
|
|
4310
4076
|
return n;
|
|
4311
4077
|
}
|
|
4312
4078
|
else if (!isNaN(Number(n)))
|
|
4313
|
-
return new
|
|
4079
|
+
return new ie(n);
|
|
4314
4080
|
return n;
|
|
4315
4081
|
}), Li = {
|
|
4316
4082
|
getMeta: async (e, t) => {
|
|
4317
|
-
const n = new
|
|
4083
|
+
const n = new Si(t || "/graphql", {
|
|
4318
4084
|
fetch: window.fetch,
|
|
4319
4085
|
jsonSerializer: {
|
|
4320
4086
|
stringify: (r) => JSON.stringify(r),
|
|
4321
4087
|
// process the request object before sending; leave as default JSON
|
|
4322
|
-
parse:
|
|
4088
|
+
parse: Ri
|
|
4323
4089
|
// process the response meta object
|
|
4324
4090
|
}
|
|
4325
4091
|
}), { getMeta: i } = await n.request({
|
|
4326
|
-
document:
|
|
4092
|
+
document: ki.getMeta,
|
|
4327
4093
|
variables: { doctype: e }
|
|
4328
4094
|
});
|
|
4329
4095
|
return i;
|
|
@@ -4331,7 +4097,7 @@ const Ve = async (e) => {
|
|
|
4331
4097
|
};
|
|
4332
4098
|
export {
|
|
4333
4099
|
Li as methods,
|
|
4334
|
-
|
|
4335
|
-
|
|
4100
|
+
ki as queries,
|
|
4101
|
+
bi as typeDefs
|
|
4336
4102
|
};
|
|
4337
4103
|
//# sourceMappingURL=graphql-client.js.map
|