@stonecrop/graphql-client 0.8.9 → 0.8.11

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.
@@ -56,7 +56,7 @@ var ee = 9e15, z = 1e9, be = "0123456789abcdef", Ne = "2.30258509299404568401799
56
56
  // Whether to use cryptographically-secure random number generation, if available.
57
57
  crypto: !1
58
58
  // true/false
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 };
59
+ }, ct, G, y = !0, ve = "[DecimalError] ", Q = ve + "Invalid argument: ", ut = ve + "Precision limit exceeded", lt = ve + "crypto unavailable", ft = "[object Decimal]", M = 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, Mt = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, ht = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, V = 1e7, v = 7, Ft = 9007199254740991, Pt = Ne.length - 1, Me = Te.length - 1, p = { toStringTag: ft };
60
60
  p.absoluteValue = p.abs = function() {
61
61
  var e = new this.constructor(this);
62
62
  return e.s < 0 && (e.s = 1), T(e);
@@ -88,8 +88,8 @@ p.cosine = p.cos = function() {
88
88
  p.cubeRoot = p.cbrt = function() {
89
89
  var e, t, n, i, r, s, o, a, u, c, l = this, f = l.constructor;
90
90
  if (!l.isFinite() || l.isZero()) return new f(l);
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))
91
+ for (y = !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 = M((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 = S(c.plus(l).times(a), c.plus(u), o + 2, 1), b(a.d).slice(0, o) === (n = b(i.d)).slice(0, o))
93
93
  if (n = n.slice(o - 3, o + 1), n == "9999" || !r && n == "4999") {
94
94
  if (!r && (T(a, e + 1, 0), a.times(a).times(a).eq(l))) {
95
95
  i = a;
@@ -100,22 +100,22 @@ p.cubeRoot = p.cbrt = function() {
100
100
  (!+n || !+n.slice(1) && n.charAt(0) == "5") && (T(i, e + 1, 1), t = !i.times(i).times(i).eq(l));
101
101
  break;
102
102
  }
103
- return I = !0, T(i, e, f.rounding, t);
103
+ return y = !0, T(i, e, f.rounding, t);
104
104
  };
105
105
  p.decimalPlaces = p.dp = function() {
106
106
  var e, t = this.d, n = NaN;
107
107
  if (t) {
108
- if (e = t.length - 1, n = (e - F(this.e / v)) * v, e = t[e], e) for (; e % 10 == 0; e /= 10) n--;
108
+ if (e = t.length - 1, n = (e - M(this.e / v)) * v, e = t[e], e) for (; e % 10 == 0; e /= 10) n--;
109
109
  n < 0 && (n = 0);
110
110
  }
111
111
  return n;
112
112
  };
113
113
  p.dividedBy = p.div = function(e) {
114
- return x(this, new this.constructor(e));
114
+ return S(this, new this.constructor(e));
115
115
  };
116
116
  p.dividedToIntegerBy = p.divToInt = function(e) {
117
117
  var t = this, n = t.constructor;
118
- return T(x(t, new n(e), 0, 1, 1), n.precision, n.rounding);
118
+ return T(S(t, new n(e), 0, 1, 1), n.precision, n.rounding);
119
119
  };
120
120
  p.equals = p.eq = function(e) {
121
121
  return this.cmp(e) === 0;
@@ -134,7 +134,7 @@ p.hyperbolicCosine = p.cosh = function() {
134
134
  var e, t, n, i, r, s = this, o = s.constructor, a = new o(1);
135
135
  if (!s.isFinite()) return new o(s.s ? 1 / 0 : NaN);
136
136
  if (s.isZero()) return a;
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);
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 / Ie(4, e)).toString()) : (e = 16, t = "2.3283064365386962890625e-10"), s = ne(o, 1, s.times(t), new o(1), !0);
138
138
  for (var u, c = e, l = new o(8); c--; )
139
139
  u = s.times(s), s = a.minus(u.times(l.minus(u.times(l))));
140
140
  return T(s, o.precision = n, o.rounding = i, !0);
@@ -145,7 +145,7 @@ p.hyperbolicSine = p.sinh = function() {
145
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)
146
146
  r = ne(s, 2, r, r, !0);
147
147
  else {
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);
148
+ e = 1.4 * Math.sqrt(i), e = e > 16 ? 16 : e | 0, r = r.times(1 / Ie(5, e)), r = ne(s, 2, r, r, !0);
149
149
  for (var o, a = new s(5), u = new s(16), c = new s(20); e--; )
150
150
  o = r.times(r), r = r.times(a.plus(o.times(u.times(o).plus(c))));
151
151
  }
@@ -153,7 +153,7 @@ p.hyperbolicSine = p.sinh = function() {
153
153
  };
154
154
  p.hyperbolicTangent = p.tanh = function() {
155
155
  var e, t, n = this, i = n.constructor;
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);
156
+ return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 7, i.rounding = 1, S(n.sinh(), n.cosh(), i.precision = e, i.rounding = t)) : new i(n.s);
157
157
  };
158
158
  p.inverseCosine = p.acos = function() {
159
159
  var e = this, t = e.constructor, n = e.abs().cmp(1), i = t.precision, r = t.rounding;
@@ -161,15 +161,15 @@ p.inverseCosine = p.acos = function() {
161
161
  };
162
162
  p.inverseHyperbolicCosine = p.acosh = function() {
163
163
  var e, t, n = this, i = n.constructor;
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);
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, y = !1, n = n.times(n).minus(1).sqrt().plus(n), y = !0, i.precision = e, i.rounding = t, n.ln()) : new i(n);
165
165
  };
166
166
  p.inverseHyperbolicSine = p.asinh = function() {
167
167
  var e, t, n = this, i = n.constructor;
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());
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, y = !1, n = n.times(n).plus(1).sqrt().plus(n), y = !0, i.precision = e, i.rounding = t, n.ln());
169
169
  };
170
170
  p.inverseHyperbolicTangent = p.atanh = function() {
171
171
  var e, t, n, i, r = this, s = r.constructor;
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);
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 = S(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);
173
173
  };
174
174
  p.inverseSine = p.asin = function() {
175
175
  var e, t, n, i, r = this, s = r.constructor;
@@ -180,23 +180,23 @@ p.inverseTangent = p.atan = function() {
180
180
  if (c.isFinite()) {
181
181
  if (c.isZero())
182
182
  return new l(c);
183
- if (c.abs().eq(1) && f + 4 <= Fe)
183
+ if (c.abs().eq(1) && f + 4 <= Me)
184
184
  return o = j(l, f + 4, h).times(0.25), o.s = c.s, o;
185
185
  } else {
186
186
  if (!c.s) return new l(NaN);
187
- if (f + 4 <= Fe)
187
+ if (f + 4 <= Me)
188
188
  return o = j(l, f + 4, h).times(0.5), o.s = c.s, o;
189
189
  }
190
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; )
191
+ for (y = !1, t = Math.ceil(a / v), i = 1, u = c.times(c), o = new l(c), r = c; e !== -1; )
192
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--; ) ;
193
- return n && (o = o.times(2 << n - 1)), I = !0, T(o, l.precision = f, l.rounding = h, !0);
193
+ return n && (o = o.times(2 << n - 1)), y = !0, T(o, l.precision = f, l.rounding = h, !0);
194
194
  };
195
195
  p.isFinite = function() {
196
196
  return !!this.d;
197
197
  };
198
198
  p.isInteger = p.isInt = function() {
199
- return !!this.d && F(this.e / v) > this.d.length - 2;
199
+ return !!this.d && M(this.e / v) > this.d.length - 2;
200
200
  };
201
201
  p.isNaN = function() {
202
202
  return !this.s;
@@ -233,14 +233,14 @@ p.logarithm = p.log = function(e) {
233
233
  for (r = n[0]; r % 10 === 0; ) r /= 10;
234
234
  s = r !== 1;
235
235
  }
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))
236
+ if (y = !1, a = f + m, o = J(c, a), i = t ? we(l, a + 10) : J(e, a), u = S(o, i, a, 1), ae(u.d, r = f, h))
237
237
  do
238
- if (a += 10, o = J(c, a), i = t ? we(l, a + 10) : J(e, a), u = x(o, i, a, 1), !s) {
238
+ if (a += 10, o = J(c, a), i = t ? we(l, a + 10) : J(e, a), u = S(o, i, a, 1), !s) {
239
239
  +b(u.d).slice(r + 1, r + 15) + 1 == 1e14 && (u = T(u, f + 1, 0));
240
240
  break;
241
241
  }
242
242
  while (ae(u.d, r += 10, h));
243
- return I = !0, T(u, f, h);
243
+ return y = !0, T(u, f, h);
244
244
  };
245
245
  p.minus = p.sub = function(e) {
246
246
  var t, n, i, r, s, o, a, u, c, l, f, h, m = this, N = m.constructor;
@@ -252,9 +252,9 @@ p.minus = p.sub = function(e) {
252
252
  if (h[0]) e.s = -e.s;
253
253
  else if (c[0]) e = new N(m);
254
254
  else return new N(u === 3 ? -0 : 0);
255
- return I ? T(e, a, u) : e;
255
+ return y ? T(e, a, u) : e;
256
256
  }
257
- if (n = F(e.e / v), l = F(m.e / v), c = c.slice(), s = l - n, s) {
257
+ if (n = M(e.e / v), l = M(m.e / v), c = c.slice(), s = l - n, s) {
258
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);
259
259
  t.reverse();
260
260
  } else {
@@ -275,14 +275,14 @@ p.minus = p.sub = function(e) {
275
275
  }
276
276
  for (; c[--o] === 0; ) c.pop();
277
277
  for (; c[0] === 0; c.shift()) --n;
278
- return c[0] ? (e.d = c, e.e = Ie(c, n), I ? T(e, a, u) : e) : new N(u === 3 ? -0 : 0);
278
+ return c[0] ? (e.d = c, e.e = ye(c, n), y ? T(e, a, u) : e) : new N(u === 3 ? -0 : 0);
279
279
  };
280
280
  p.modulo = p.mod = function(e) {
281
281
  var t, n = this, i = n.constructor;
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));
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) : (y = !1, i.modulo == 9 ? (t = S(n, e.abs(), 0, 3, 1), t.s *= e.s) : t = S(n, e, 0, i.modulo, 1), t = t.times(e), y = !0, n.minus(t));
283
283
  };
284
284
  p.naturalExponential = p.exp = function() {
285
- return Me(this);
285
+ return Fe(this);
286
286
  };
287
287
  p.naturalLogarithm = p.ln = function() {
288
288
  return J(this);
@@ -298,15 +298,15 @@ p.plus = p.add = function(e) {
298
298
  if (f.s != e.s)
299
299
  return e.s = -e.s, f.minus(e);
300
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) {
301
+ return l[0] || (e = new h(f)), y ? T(e, a, u) : e;
302
+ if (s = M(f.e / v), i = M(e.e / v), c = c.slice(), r = s - i, r) {
303
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);
304
304
  n.reverse();
305
305
  }
306
306
  for (o = c.length, r = l.length, o - r < 0 && (r = o, n = l, l = c, c = n), t = 0; r; )
307
307
  t = (c[--r] = c[r] + l[r] + t) / V | 0, c[r] %= V;
308
308
  for (t && (c.unshift(t), ++i), o = c.length; c[--o] == 0; ) c.pop();
309
- return e.d = c, e.e = Ie(c, i), I ? T(e, a, u) : e;
309
+ return e.d = c, e.e = ye(c, i), y ? T(e, a, u) : e;
310
310
  };
311
311
  p.precision = p.sd = function(e) {
312
312
  var t, n = this;
@@ -325,8 +325,8 @@ p.squareRoot = p.sqrt = function() {
325
325
  var e, t, n, i, r, s, o = this, a = o.d, u = o.e, c = o.s, l = o.constructor;
326
326
  if (c !== 1 || !a || !a[0])
327
327
  return new l(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
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))
328
+ for (y = !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 = M((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(S(o, s, n + 2, 1)).times(0.5), b(s.d).slice(0, n) === (t = b(i.d)).slice(0, n))
330
330
  if (t = t.slice(n - 3, n + 1), t == "9999" || !r && t == "4999") {
331
331
  if (!r && (T(s, u + 1, 0), s.times(s).eq(o))) {
332
332
  i = s;
@@ -337,24 +337,24 @@ p.squareRoot = p.sqrt = function() {
337
337
  (!+t || !+t.slice(1) && t.charAt(0) == "5") && (T(i, u + 1, 1), e = !i.times(i).eq(o));
338
338
  break;
339
339
  }
340
- return I = !0, T(i, u, l.rounding, e);
340
+ return y = !0, T(i, u, l.rounding, e);
341
341
  };
342
342
  p.tangent = p.tan = function() {
343
343
  var e, t, n = this, i = n.constructor;
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);
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 = S(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);
345
345
  };
346
346
  p.times = p.mul = function(e) {
347
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
348
  if (e.s *= l.s, !h || !h[0] || !m || !m[0])
349
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);
350
+ for (n = M(l.e / v) + M(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);
351
351
  for (i = c; --i >= 0; ) {
352
352
  for (t = 0, r = u + i; r > i; )
353
353
  a = s[r] + m[i] * h[r - i - 1] + t, s[r--] = a % V | 0, t = a / V | 0;
354
354
  s[r] = (s[r] + t) % V | 0;
355
355
  }
356
356
  for (; !s[--o]; ) s.pop();
357
- return t ? ++n : s.shift(), e.d = s, e.e = Ie(s, n), I ? T(e, f.precision, f.rounding) : e;
357
+ return t ? ++n : s.shift(), e.d = s, e.e = ye(s, n), y ? T(e, f.precision, f.rounding) : e;
358
358
  };
359
359
  p.toBinary = function(e, t) {
360
360
  return je(this, 2, e, t);
@@ -380,9 +380,9 @@ p.toFraction = function(e) {
380
380
  if (a = new E(e), !a.isInt() || a.lt(c)) throw Error(Q + a);
381
381
  e = a.gt(t) ? s > 0 ? t : c : a;
382
382
  }
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; )
383
+ for (y = !1, a = new E(b(N)), l = E.precision, E.precision = s = N.length * v * 2; f = S(a, t, 0, 1, 1), r = n.plus(f.times(i)), r.cmp(e) != 1; )
384
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;
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;
385
+ return r = S(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 = S(c, i, s, 1).minus(m).abs().cmp(S(u, n, s, 1).minus(m).abs()) < 1 ? [c, i] : [u, n], E.precision = l, y = !0, h;
386
386
  };
387
387
  p.toHexadecimal = p.toHex = function(e, t) {
388
388
  return je(this, 16, e, t);
@@ -397,7 +397,7 @@ p.toNearest = function(e, t) {
397
397
  if (!e.d)
398
398
  return e.s && (e.s = n.s), e;
399
399
  }
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;
400
+ return e.d[0] ? (y = !1, n = S(n, e, 0, t, 1).times(e), y = !0, T(n)) : (e.s = n.s, n = e), n;
401
401
  };
402
402
  p.toNumber = function() {
403
403
  return +this;
@@ -410,14 +410,14 @@ p.toPower = p.pow = function(e) {
410
410
  if (!a.d || !e.d || !a.d[0] || !e.d[0]) return new u(k(+a, c));
411
411
  if (a = new u(a), a.eq(1)) return a;
412
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)
413
+ if (t = M(e.e / v), t >= e.d.length - 1 && (n = c < 0 ? -c : c) <= Ft)
414
414
  return r = pt(u, a, n, i), e.s < 0 ? new u(1).div(r) : T(r, i, s);
415
415
  if (o = a.s, o < 0) {
416
416
  if (t < e.d.length - 1) return new u(NaN);
417
417
  if ((e.d[t] & 1) == 0 && (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
418
418
  return a.s = o, a;
419
419
  }
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));
420
+ return n = k(+a, c), t = n == 0 || !isFinite(n) ? M(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) : (y = !1, u.rounding = a.s = 1, n = Math.min(12, (t + "").length), r = Fe(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(Fe(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, y = !0, u.rounding = s, T(r, i, s));
421
421
  };
422
422
  p.toPrecision = function(e, t) {
423
423
  var n, i = this, r = i.constructor;
@@ -469,14 +469,14 @@ function de(e, t, n) {
469
469
  function qt(e, t) {
470
470
  var n, i, r;
471
471
  if (t.isZero()) return t;
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));
472
+ i = t.d.length, i < 32 ? (n = Math.ceil(i / 3), r = (1 / Ie(4, n)).toString()) : (n = 16, r = "2.3283064365386962890625e-10"), e.precision += n, t = ne(e, 1, t.times(r), new e(1));
473
473
  for (var s = n; s--; ) {
474
474
  var o = t.times(t);
475
475
  t = o.times(o).minus(o).times(8).plus(1);
476
476
  }
477
477
  return e.precision -= n, t;
478
478
  }
479
- var x = /* @__PURE__ */ (function() {
479
+ var S = /* @__PURE__ */ (function() {
480
480
  function e(i, r, s) {
481
481
  var o, a = 0, u = i.length;
482
482
  for (i = i.slice(); u--; )
@@ -501,7 +501,7 @@ var x = /* @__PURE__ */ (function() {
501
501
  for (; !i[0] && i.length > 1; ) i.shift();
502
502
  }
503
503
  return function(i, r, s, o, a, u) {
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;
504
+ var c, l, f, h, m, N, E, C, A, F, O, _, Y, q, W, ue, se, Se, B, le, fe = i.constructor, De = i.s == r.s ? 1 : -1, L = i.d, D = r.d;
505
505
  if (!L || !L[0] || !D || !D[0])
506
506
  return new fe(
507
507
  // Return NaN if either NaN, or both Infinity or 0.
@@ -510,31 +510,31 @@ var x = /* @__PURE__ */ (function() {
510
510
  L && L[0] == 0 || !D ? De * 0 : De / 0
511
511
  )
512
512
  );
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++) ;
513
+ for (u ? (m = 1, l = i.e - r.e) : (u = V, m = v, l = M(i.e / m) - M(r.e / m)), B = D.length, se = L.length, A = new fe(De), F = A.d = [], f = 0; D[f] == (L[f] || 0); f++) ;
514
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;
515
+ F.push(1), N = !0;
516
516
  else {
517
517
  if (q = q / m + 2 | 0, f = 0, B == 1) {
518
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;
519
+ W = h * u + (L[f] || 0), F[f] = W / D | 0, h = W % D | 0;
520
520
  N = h || f < se;
521
521
  } else {
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;
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, O = L.slice(0, B), _ = O.length; _ < B; ) O[_++] = 0;
523
+ le = D.slice(), le.unshift(0), Se = D[0], D[1] >= u / 2 && ++Se;
524
524
  do
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;
525
+ h = 0, c = t(D, O, B, _), c < 0 ? (Y = O[0], B != _ && (Y = Y * u + (O[1] || 0)), h = Y / Se | 0, h > 1 ? (h >= u && (h = u - 1), E = e(D, h, u), C = E.length, _ = O.length, c = t(E, O, 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(O, E, _, u), c == -1 && (_ = O.length, c = t(D, O, B, _), c < 1 && (h++, n(O, B < _ ? le : D, _, u))), _ = O.length) : c === 0 && (h++, O = [0]), F[f++] = h, c && O[0] ? O[_++] = L[ue] || 0 : (O = [L[ue]], _ = 1);
526
+ while ((ue++ < se || O[0] !== void 0) && q--);
527
+ N = O[0] !== void 0;
528
528
  }
529
- M[0] || M.shift();
529
+ F[0] || F.shift();
530
530
  }
531
531
  if (m == 1)
532
- y.e = l, ct = N;
532
+ A.e = l, ct = N;
533
533
  else {
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);
534
+ for (f = 1, h = F[0]; h >= 10; h /= 10) f++;
535
+ A.e = f + l * m - 1, T(A, a ? s + A.e + 1 : s, o, N);
536
536
  }
537
- return y;
537
+ return A;
538
538
  };
539
539
  })();
540
540
  function T(e, t, n, i) {
@@ -570,25 +570,25 @@ function T(e, t, n, i) {
570
570
  }
571
571
  for (s = f.length; f[--s] === 0; ) f.pop();
572
572
  }
573
- return I && (e.e > m.maxE ? (e.d = null, e.e = NaN) : e.e < m.minE && (e.e = 0, e.d = [0])), e;
573
+ return y && (e.e > m.maxE ? (e.d = null, e.e = NaN) : e.e < m.minE && (e.e = 0, e.d = [0])), e;
574
574
  }
575
575
  function $(e, t, n) {
576
576
  if (!e.isFinite()) return gt(e);
577
577
  var i, r = e.e, s = b(e.d), o = s.length;
578
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;
579
579
  }
580
- function Ie(e, t) {
580
+ function ye(e, t) {
581
581
  var n = e[0];
582
582
  for (t *= v; n >= 10; n /= 10) t++;
583
583
  return t;
584
584
  }
585
585
  function we(e, t, n) {
586
586
  if (t > Pt)
587
- throw I = !0, n && (e.precision = n), Error(ut);
587
+ throw y = !0, n && (e.precision = n), Error(ut);
588
588
  return T(new e(Ne), t, 1, !0);
589
589
  }
590
590
  function j(e, t, n) {
591
- if (t > Fe) throw Error(ut);
591
+ if (t > Me) throw Error(ut);
592
592
  return T(new e(Te), t, n, !0);
593
593
  }
594
594
  function dt(e) {
@@ -605,14 +605,14 @@ function H(e) {
605
605
  }
606
606
  function pt(e, t, n, i) {
607
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) {
608
+ for (y = !1; ; ) {
609
+ if (n % 2 && (s = s.times(t), Qe(s.d, o) && (r = !0)), n = M(n / 2), n === 0) {
610
610
  n = s.d.length - 1, r && s.d[n] === 0 && ++s.d[n];
611
611
  break;
612
612
  }
613
613
  t = t.times(t), Qe(t.d, o);
614
614
  }
615
- return I = !0, s;
615
+ return y = !0, s;
616
616
  }
617
617
  function Je(e) {
618
618
  return e.d[e.d.length - 1] & 1;
@@ -627,20 +627,20 @@ function mt(e, t, n) {
627
627
  }
628
628
  return s;
629
629
  }
630
- function Me(e, t) {
630
+ function Fe(e, t) {
631
631
  var n, i, r, s, o, a, u, c = 0, l = 0, f = 0, h = e.constructor, m = h.rounding, N = h.precision;
632
632
  if (!e.d || !e.d[0] || e.e > 17)
633
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; )
634
+ for (t == null ? (y = !1, u = N) : u = t, a = new h(0.03125); e.e > -2; )
635
635
  e = e.times(a), f += 5;
636
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)) {
637
+ if (s = T(s.times(e), u, 1), n = n.times(++l), a = o.plus(S(s, n, u, 1)), b(a.d).slice(0, u) === b(o.d).slice(0, u)) {
638
638
  for (r = f; r--; ) o = T(o.times(o), u, 1);
639
639
  if (t == null)
640
640
  if (c < 3 && ae(o.d, u - i, m, c))
641
641
  h.precision = u += 10, n = s = a = new h(1), l = 0, c++;
642
642
  else
643
- return T(o, h.precision = N, m, I = !0);
643
+ return T(o, h.precision = N, m, y = !0);
644
644
  else
645
645
  return h.precision = N, o;
646
646
  }
@@ -648,24 +648,24 @@ function Me(e, t) {
648
648
  }
649
649
  }
650
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;
651
+ var n, i, r, s, o, a, u, c, l, f, h, m = 1, N = 10, E = e, C = E.d, A = E.constructor, F = A.rounding, O = A.precision;
652
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) {
653
+ return new A(C && !C[0] ? -1 / 0 : E.s != 1 ? NaN : C ? 0 : E);
654
+ if (t == null ? (y = !1, l = O) : l = t, A.precision = l += N, n = b(C), i = n.charAt(0), Math.abs(s = E.e) < 15e14) {
655
655
  for (; i < 7 && i != 1 || i == 1 && n.charAt(1) > 3; )
656
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));
657
+ s = E.e, i > 1 ? (E = new A("0." + n), s++) : E = new A(i + "." + n.slice(1));
658
658
  } else
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;
659
+ return c = we(A, l + 2, O).times(s + ""), E = J(new A(i + "." + n.slice(1)), l - N).plus(c), A.precision = O, t == null ? T(E, O, F, y = !0) : E;
660
+ for (f = E, u = o = E = S(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(S(o, new A(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(A, l + 2, O).times(s + ""))), u = S(u, new A(m), l, 1), t == null)
663
+ if (ae(u.d, l - N, F, a))
664
+ A.precision = l += N, c = o = E = S(f.minus(1), f.plus(1), l, 1), h = T(E.times(E), l, 1), r = a = 1;
665
665
  else
666
- return T(u, y.precision = A, M, I = !0);
666
+ return T(u, A.precision = O, F, y = !0);
667
667
  else
668
- return y.precision = A, u;
668
+ return A.precision = O, u;
669
669
  u = c, r += 2;
670
670
  }
671
671
  }
@@ -683,7 +683,7 @@ function pe(e, t) {
683
683
  } else
684
684
  i -= r;
685
685
  for (; i--; ) t += "0";
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]));
686
+ e.d.push(+t), y && (e.e > e.constructor.maxE ? (e.d = null, e.e = NaN) : e.e < e.constructor.minE && (e.e = 0, e.d = [0]));
687
687
  } else
688
688
  e.e = 0, e.d = [0];
689
689
  return e;
@@ -698,34 +698,34 @@ function Bt(e, t) {
698
698
  n = 16, t = t.toLowerCase();
699
699
  else if (bt.test(t))
700
700
  n = 2;
701
- else if (Ft.test(t))
701
+ else if (Mt.test(t))
702
702
  n = 8;
703
703
  else
704
704
  throw Error(Q + t);
705
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);
706
+ return s < 0 ? new i(e.s * 0) : (e.e = ye(c, l), e.d = c, y = !1, o && (e = S(e, r, a * 4)), u && (e = e.times(Math.abs(u) < 54 ? k(2, u) : ie.pow(2, u))), y = !0, e);
707
707
  }
708
708
  function Ut(e, t) {
709
709
  var n, i = t.d.length;
710
710
  if (i < 3)
711
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);
712
+ n = 1.4 * Math.sqrt(i), n = n > 16 ? 16 : n | 0, t = t.times(1 / Ie(5, n)), t = ne(e, 2, t, t);
713
713
  for (var r, s = new e(5), o = new e(16), a = new e(20); n--; )
714
714
  r = t.times(t), t = t.times(s.plus(r.times(o.times(r).minus(a))));
715
715
  return t;
716
716
  }
717
717
  function ne(e, t, n, i, r) {
718
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) {
719
+ for (y = !1, u = n.times(n), a = new e(i); ; ) {
720
+ if (o = S(a.times(u), new e(t++ * t++), c, 1), a = r ? i.plus(o) : i.minus(o), i = S(o.times(u), new e(t++ * t++), c, 1), o = a.plus(i), o.d[l] !== void 0) {
721
721
  for (s = l; o.d[s] === a.d[s] && s--; ) ;
722
722
  if (s == -1) break;
723
723
  }
724
724
  s = a, a = i, i = o, o = s;
725
725
  }
726
- return I = !0, o.d.length = l + 1, o;
726
+ return y = !0, o.d.length = l + 1, o;
727
727
  }
728
- function Oe(e, t) {
728
+ function Ie(e, t) {
729
729
  for (var n = e; --t; ) n *= e;
730
730
  return n;
731
731
  }
@@ -751,7 +751,7 @@ function je(e, t, n, i) {
751
751
  if (!f[0])
752
752
  l = N ? "0p+0" : "0";
753
753
  else {
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)
754
+ if (o < 0 ? s-- : (e = new m(e), e.d = f, e.e = s, e = S(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)
755
755
  for (; ++f[--n] > r - 1; )
756
756
  f[n] = 0, n || (++s, f.unshift(1));
757
757
  for (u = f.length; !f[u - 1]; --u) ;
@@ -806,7 +806,7 @@ function Qt(e) {
806
806
  function zt(e, t) {
807
807
  e = new this(e), t = new this(t);
808
808
  var n, i = this.precision, r = this.rounding, s = i + 4;
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;
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(S(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(S(e, t, s, 1)), n;
810
810
  }
811
811
  function Zt(e) {
812
812
  return new this(e).cbrt();
@@ -844,7 +844,7 @@ function Kt(e) {
844
844
  ];
845
845
  for (t = 0; t < s.length; t += 3)
846
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;
847
+ if (M(i) === i && i >= s[t + 1] && i <= s[t + 2]) this[n] = i;
848
848
  else throw Error(Q + n + ": " + i);
849
849
  if (n = "crypto", r && (this[n] = Le[n]), (i = e[n]) !== void 0)
850
850
  if (i === !0 || i === !1 || i === 0 || i === 1)
@@ -871,7 +871,7 @@ function Nt(e) {
871
871
  var o, a, u, c = this;
872
872
  if (!(c instanceof r)) return new r(s);
873
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);
874
+ c.s = s.s, y ? !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);
875
875
  return;
876
876
  }
877
877
  if (u = typeof s, u === "number") {
@@ -881,7 +881,7 @@ function Nt(e) {
881
881
  }
882
882
  if (s < 0 ? (s = -s, c.s = -1) : c.s = 1, s === ~~s && s < 1e7) {
883
883
  for (o = 0, a = s; a >= 10; a /= 10) o++;
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]);
884
+ y ? 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]);
885
885
  return;
886
886
  }
887
887
  if (s * 0 !== 0) {
@@ -896,7 +896,7 @@ function Nt(e) {
896
896
  return s < 0 ? (s = -s, c.s = -1) : c.s = 1, pe(c, s.toString());
897
897
  throw Error(Q + s);
898
898
  }
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)
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 = yn, r.sum = In, r.tan = On, r.tanh = An, r.trunc = Sn, e === void 0 && (e = {}), e && e.defaults !== !0)
900
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]);
901
901
  return r.config(e), r;
902
902
  }
@@ -911,15 +911,15 @@ function sn(e) {
911
911
  }
912
912
  function on() {
913
913
  var e, t, n = new this(0);
914
- for (I = !1, e = 0; e < arguments.length; )
914
+ for (y = !1, e = 0; e < arguments.length; )
915
915
  if (t = new this(arguments[e++]), t.d)
916
916
  n.d && (n = n.plus(t.times(t)));
917
917
  else {
918
918
  if (t.s)
919
- return I = !0, new this(1 / 0);
919
+ return y = !0, new this(1 / 0);
920
920
  n = t;
921
921
  }
922
- return I = !0, n.sqrt();
922
+ return y = !0, n.sqrt();
923
923
  }
924
924
  function ze(e) {
925
925
  return e instanceof ie || e && e.toStringTag === ft || !1;
@@ -989,21 +989,21 @@ function wn(e) {
989
989
  function vn(e) {
990
990
  return new this(e).sqrt();
991
991
  }
992
- function In(e, t) {
992
+ function yn(e, t) {
993
993
  return new this(e).sub(t);
994
994
  }
995
- function On() {
995
+ function In() {
996
996
  var e = 0, t = arguments, n = new this(t[e]);
997
- for (I = !1; n.s && ++e < t.length; ) n = n.plus(t[e]);
998
- return I = !0, T(n, this.precision, this.rounding);
997
+ for (y = !1; n.s && ++e < t.length; ) n = n.plus(t[e]);
998
+ return y = !0, T(n, this.precision, this.rounding);
999
999
  }
1000
- function An(e) {
1000
+ function On(e) {
1001
1001
  return new this(e).tan();
1002
1002
  }
1003
- function yn(e) {
1003
+ function An(e) {
1004
1004
  return new this(e).tanh();
1005
1005
  }
1006
- function xn(e) {
1006
+ function Sn(e) {
1007
1007
  return T(e = new this(e), e.e + 1, 1);
1008
1008
  }
1009
1009
  p[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = p.toString;
@@ -1038,11 +1038,11 @@ const Ze = (e) => e.toUpperCase(), _e = (e) => typeof e == "function" ? e() : e,
1038
1038
  }, _n = (e) => {
1039
1039
  try {
1040
1040
  const t = e();
1041
- return Sn(t) ? t.catch((n) => Xe(n)) : t;
1041
+ return xn(t) ? t.catch((n) => Xe(n)) : t;
1042
1042
  } catch (t) {
1043
1043
  return Xe(t);
1044
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) => {
1045
+ }, Xe = (e) => e instanceof Error ? e : new Error(String(e)), xn = (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
1046
  throw new Error(`Unhandled case: ${String(e)}`);
1047
1047
  }, me = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Cn = (e, t) => e.documents ? e : {
1048
1048
  documents: e,
@@ -1080,7 +1080,7 @@ function Pe(e, t) {
1080
1080
  column: t + 1 - n
1081
1081
  };
1082
1082
  }
1083
- function Fn(e) {
1083
+ function Mn(e) {
1084
1084
  return wt(
1085
1085
  e.source,
1086
1086
  Pe(e.source, e.start)
@@ -1113,7 +1113,7 @@ function We(e) {
1113
1113
  return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
1114
1114
  `);
1115
1115
  }
1116
- function Mn(e) {
1116
+ function Fn(e) {
1117
1117
  const t = e[0];
1118
1118
  return t == null || "kind" in t || "length" in t ? {
1119
1119
  nodes: t,
@@ -1165,7 +1165,7 @@ class Ge extends Error {
1165
1165
  */
1166
1166
  constructor(t, ...n) {
1167
1167
  var i, r, s;
1168
- const { nodes: o, source: a, positions: u, path: c, originalError: l, extensions: f } = Mn(n);
1168
+ const { nodes: o, source: a, positions: u, path: c, originalError: l, extensions: f } = Fn(n);
1169
1169
  super(t), this.name = "GraphQLError", this.path = c ?? void 0, this.originalError = l ?? void 0, this.nodes = Ke(
1170
1170
  Array.isArray(o) ? o : o ? [o] : void 0
1171
1171
  );
@@ -1215,7 +1215,7 @@ class Ge extends Error {
1215
1215
  for (const n of this.nodes)
1216
1216
  n.loc && (t += `
1217
1217
 
1218
- ` + Fn(n.loc));
1218
+ ` + Mn(n.loc));
1219
1219
  else if (this.source && this.locations)
1220
1220
  for (const n of this.locations)
1221
1221
  t += `
@@ -1310,7 +1310,7 @@ class vt {
1310
1310
  };
1311
1311
  }
1312
1312
  }
1313
- const It = {
1313
+ const yt = {
1314
1314
  Name: [],
1315
1315
  Document: ["definitions"],
1316
1316
  OperationDefinition: [
@@ -1397,7 +1397,7 @@ const It = {
1397
1397
  ArgumentCoordinate: ["name", "fieldName", "argumentName"],
1398
1398
  DirectiveCoordinate: ["name"],
1399
1399
  DirectiveArgumentCoordinate: ["name", "argumentName"]
1400
- }, qn = new Set(Object.keys(It));
1400
+ }, qn = new Set(Object.keys(yt));
1401
1401
  function et(e) {
1402
1402
  const t = e?.kind;
1403
1403
  return typeof t == "string" && qn.has(t);
@@ -1420,15 +1420,15 @@ function Be(e) {
1420
1420
  function ce(e) {
1421
1421
  return e >= 48 && e <= 57;
1422
1422
  }
1423
- function Ot(e) {
1423
+ function It(e) {
1424
1424
  return e >= 97 && e <= 122 || // A-Z
1425
1425
  e >= 65 && e <= 90;
1426
1426
  }
1427
- function At(e) {
1428
- return Ot(e) || e === 95;
1427
+ function Ot(e) {
1428
+ return It(e) || e === 95;
1429
1429
  }
1430
1430
  function Bn(e) {
1431
- return Ot(e) || ce(e) || e === 95;
1431
+ return It(e) || ce(e) || e === 95;
1432
1432
  }
1433
1433
  function Un(e) {
1434
1434
  var t;
@@ -1514,13 +1514,13 @@ function Gn(e) {
1514
1514
  function re(e) {
1515
1515
  return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
1516
1516
  }
1517
- function Ae(e, t) {
1518
- return yt(e.charCodeAt(t)) && xt(e.charCodeAt(t + 1));
1517
+ function Oe(e, t) {
1518
+ return At(e.charCodeAt(t)) && St(e.charCodeAt(t + 1));
1519
1519
  }
1520
- function yt(e) {
1520
+ function At(e) {
1521
1521
  return e >= 55296 && e <= 56319;
1522
1522
  }
1523
- function xt(e) {
1523
+ function St(e) {
1524
1524
  return e >= 56320 && e <= 57343;
1525
1525
  }
1526
1526
  function X(e, t) {
@@ -1533,7 +1533,7 @@ function X(e, t) {
1533
1533
  }
1534
1534
  return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
1535
1535
  }
1536
- function S(e, t, n, i, r) {
1536
+ function x(e, t, n, i, r) {
1537
1537
  const s = e.line, o = 1 + n - e.lineStart;
1538
1538
  return new vt(t, n, i, s, o, r);
1539
1539
  }
@@ -1588,50 +1588,50 @@ function Yn(e, t) {
1588
1588
  //
1589
1589
  // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
1590
1590
  case 33:
1591
- return S(e, d.BANG, r, r + 1);
1591
+ return x(e, d.BANG, r, r + 1);
1592
1592
  case 36:
1593
- return S(e, d.DOLLAR, r, r + 1);
1593
+ return x(e, d.DOLLAR, r, r + 1);
1594
1594
  case 38:
1595
- return S(e, d.AMP, r, r + 1);
1595
+ return x(e, d.AMP, r, r + 1);
1596
1596
  case 40:
1597
- return S(e, d.PAREN_L, r, r + 1);
1597
+ return x(e, d.PAREN_L, r, r + 1);
1598
1598
  case 41:
1599
- return S(e, d.PAREN_R, r, r + 1);
1599
+ return x(e, d.PAREN_R, r, r + 1);
1600
1600
  case 46:
1601
1601
  if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
1602
- return S(e, d.SPREAD, r, r + 3);
1602
+ return x(e, d.SPREAD, r, r + 3);
1603
1603
  break;
1604
1604
  case 58:
1605
- return S(e, d.COLON, r, r + 1);
1605
+ return x(e, d.COLON, r, r + 1);
1606
1606
  case 61:
1607
- return S(e, d.EQUALS, r, r + 1);
1607
+ return x(e, d.EQUALS, r, r + 1);
1608
1608
  case 64:
1609
- return S(e, d.AT, r, r + 1);
1609
+ return x(e, d.AT, r, r + 1);
1610
1610
  case 91:
1611
- return S(e, d.BRACKET_L, r, r + 1);
1611
+ return x(e, d.BRACKET_L, r, r + 1);
1612
1612
  case 93:
1613
- return S(e, d.BRACKET_R, r, r + 1);
1613
+ return x(e, d.BRACKET_R, r, r + 1);
1614
1614
  case 123:
1615
- return S(e, d.BRACE_L, r, r + 1);
1615
+ return x(e, d.BRACE_L, r, r + 1);
1616
1616
  case 124:
1617
- return S(e, d.PIPE, r, r + 1);
1617
+ return x(e, d.PIPE, r, r + 1);
1618
1618
  case 125:
1619
- return S(e, d.BRACE_R, r, r + 1);
1619
+ return x(e, d.BRACE_R, r, r + 1);
1620
1620
  // StringValue
1621
1621
  case 34:
1622
1622
  return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Wn(e, r) : Qn(e, r);
1623
1623
  }
1624
1624
  if (ce(s) || s === 45)
1625
1625
  return Jn(e, r, s);
1626
- if (At(s))
1626
+ if (Ot(s))
1627
1627
  return Kn(e, r);
1628
1628
  throw R(
1629
1629
  e.source,
1630
1630
  r,
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)}.`
1631
+ s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(s) || Oe(n, r) ? `Unexpected character: ${X(e, r)}.` : `Invalid character: ${X(e, r)}.`
1632
1632
  );
1633
1633
  }
1634
- return S(e, d.EOF, i, i);
1634
+ return x(e, d.EOF, i, i);
1635
1635
  }
1636
1636
  function Hn(e, t) {
1637
1637
  const n = e.source.body, i = n.length;
@@ -1642,12 +1642,12 @@ function Hn(e, t) {
1642
1642
  break;
1643
1643
  if (re(s))
1644
1644
  ++r;
1645
- else if (Ae(n, r))
1645
+ else if (Oe(n, r))
1646
1646
  r += 2;
1647
1647
  else
1648
1648
  break;
1649
1649
  }
1650
- return S(
1650
+ return x(
1651
1651
  e,
1652
1652
  d.COMMENT,
1653
1653
  t,
@@ -1669,8 +1669,8 @@ function Jn(e, t, n) {
1669
1669
  )}.`
1670
1670
  );
1671
1671
  } else
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))
1672
+ r = xe(e, r, s), s = i.charCodeAt(r);
1673
+ if (s === 46 && (o = !0, s = i.charCodeAt(++r), r = xe(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 = xe(e, r, s), s = i.charCodeAt(r)), s === 46 || Ot(s))
1674
1674
  throw R(
1675
1675
  e.source,
1676
1676
  r,
@@ -1679,7 +1679,7 @@ function Jn(e, t, n) {
1679
1679
  r
1680
1680
  )}.`
1681
1681
  );
1682
- return S(
1682
+ return x(
1683
1683
  e,
1684
1684
  o ? d.FLOAT : d.INT,
1685
1685
  t,
@@ -1687,7 +1687,7 @@ function Jn(e, t, n) {
1687
1687
  i.slice(t, r)
1688
1688
  );
1689
1689
  }
1690
- function Se(e, t, n) {
1690
+ function xe(e, t, n) {
1691
1691
  if (!ce(n))
1692
1692
  throw R(
1693
1693
  e.source,
@@ -1709,7 +1709,7 @@ function Qn(e, t) {
1709
1709
  for (; r < i; ) {
1710
1710
  const a = n.charCodeAt(r);
1711
1711
  if (a === 34)
1712
- return o += n.slice(s, r), S(e, d.STRING, t, r + 1, o);
1712
+ return o += n.slice(s, r), x(e, d.STRING, t, r + 1, o);
1713
1713
  if (a === 92) {
1714
1714
  o += n.slice(s, r);
1715
1715
  const u = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? zn(e, r) : Zn(e, r) : Xn(e, r);
@@ -1720,7 +1720,7 @@ function Qn(e, t) {
1720
1720
  break;
1721
1721
  if (re(a))
1722
1722
  ++r;
1723
- else if (Ae(n, r))
1723
+ else if (Oe(n, r))
1724
1724
  r += 2;
1725
1725
  else
1726
1726
  throw R(
@@ -1766,9 +1766,9 @@ function Zn(e, t) {
1766
1766
  value: String.fromCodePoint(i),
1767
1767
  size: 6
1768
1768
  };
1769
- if (yt(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
1769
+ if (At(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
1770
1770
  const r = tt(n, t + 8);
1771
- if (xt(r))
1771
+ if (St(r))
1772
1772
  return {
1773
1773
  value: String.fromCodePoint(i, r),
1774
1774
  size: 12
@@ -1848,7 +1848,7 @@ function Wn(e, t) {
1848
1848
  const c = n.charCodeAt(s);
1849
1849
  if (c === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
1850
1850
  a += n.slice(o, s), u.push(a);
1851
- const l = S(
1851
+ const l = x(
1852
1852
  e,
1853
1853
  d.BLOCK_STRING,
1854
1854
  t,
@@ -1869,7 +1869,7 @@ function Wn(e, t) {
1869
1869
  }
1870
1870
  if (re(c))
1871
1871
  ++s;
1872
- else if (Ae(n, s))
1872
+ else if (Oe(n, s))
1873
1873
  s += 2;
1874
1874
  else
1875
1875
  throw R(
@@ -1893,7 +1893,7 @@ function Kn(e, t) {
1893
1893
  else
1894
1894
  break;
1895
1895
  }
1896
- return S(
1896
+ return x(
1897
1897
  e,
1898
1898
  d.NAME,
1899
1899
  t,
@@ -1903,9 +1903,9 @@ function Kn(e, t) {
1903
1903
  }
1904
1904
  const ei = 10, Dt = 2;
1905
1905
  function Ye(e) {
1906
- return ye(e, []);
1906
+ return Ae(e, []);
1907
1907
  }
1908
- function ye(e, t) {
1908
+ function Ae(e, t) {
1909
1909
  switch (typeof e) {
1910
1910
  case "string":
1911
1911
  return JSON.stringify(e);
@@ -1926,7 +1926,7 @@ function ti(e, t) {
1926
1926
  if (ni(e)) {
1927
1927
  const i = e.toJSON();
1928
1928
  if (i !== e)
1929
- return typeof i == "string" ? i : ye(i, n);
1929
+ return typeof i == "string" ? i : Ae(i, n);
1930
1930
  } else if (Array.isArray(e))
1931
1931
  return ri(e, n);
1932
1932
  return ii(e, n);
@@ -1937,7 +1937,7 @@ function ni(e) {
1937
1937
  function ii(e, t) {
1938
1938
  const n = Object.entries(e);
1939
1939
  return n.length === 0 ? "{}" : t.length > Dt ? "[" + si(e) + "]" : "{ " + n.map(
1940
- ([r, s]) => r + ": " + ye(s, t)
1940
+ ([r, s]) => r + ": " + Ae(s, t)
1941
1941
  ).join(", ") + " }";
1942
1942
  }
1943
1943
  function ri(e, t) {
@@ -1947,7 +1947,7 @@ function ri(e, t) {
1947
1947
  return "[Array]";
1948
1948
  const n = Math.min(ei, e.length), i = e.length - n, r = [];
1949
1949
  for (let s = 0; s < n; ++s)
1950
- r.push(ye(e[s], t));
1950
+ r.push(Ae(e[s], t));
1951
1951
  return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
1952
1952
  }
1953
1953
  function si(e) {
@@ -3068,7 +3068,7 @@ class li {
3068
3068
  throw R(
3069
3069
  this._lexer.source,
3070
3070
  n.start,
3071
- `Expected ${St(t)}, found ${he(n)}.`
3071
+ `Expected ${xt(t)}, found ${he(n)}.`
3072
3072
  );
3073
3073
  }
3074
3074
  /**
@@ -3178,9 +3178,9 @@ class li {
3178
3178
  }
3179
3179
  function he(e) {
3180
3180
  const t = e.value;
3181
- return St(e.kind) + (t != null ? ` "${t}"` : "");
3181
+ return xt(e.kind) + (t != null ? ` "${t}"` : "");
3182
3182
  }
3183
- function St(e) {
3183
+ function xt(e) {
3184
3184
  return Gn(e) ? `"${e}"` : e;
3185
3185
  }
3186
3186
  function fi(e) {
@@ -3357,17 +3357,17 @@ const pi = [
3357
3357
  "\\u009E",
3358
3358
  "\\u009F"
3359
3359
  ], mi = Object.freeze({});
3360
- function gi(e, t, n = It) {
3360
+ function gi(e, t, n = yt) {
3361
3361
  const i = /* @__PURE__ */ new Map();
3362
- for (const y of Object.values(w))
3363
- i.set(y, Ei(t, y));
3362
+ for (const A of Object.values(w))
3363
+ i.set(A, Ei(t, A));
3364
3364
  let r, s = Array.isArray(e), o = [e], a = -1, u = [], c = e, l, f;
3365
3365
  const h = [], m = [];
3366
3366
  do {
3367
3367
  a++;
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)
3368
+ const A = a === o.length, F = A && u.length !== 0;
3369
+ if (A) {
3370
+ if (l = m.length === 0 ? void 0 : h[h.length - 1], c = f, f = m.pop(), F)
3371
3371
  if (s) {
3372
3372
  c = c.slice();
3373
3373
  let _ = 0;
@@ -3386,27 +3386,27 @@ function gi(e, t, n = It) {
3386
3386
  continue;
3387
3387
  h.push(l);
3388
3388
  }
3389
- let A;
3389
+ let O;
3390
3390
  if (!Array.isArray(c)) {
3391
3391
  var N, E;
3392
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)
3393
+ const _ = A ? (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 (O = _?.call(t, c, l, f, h, m), O === mi)
3395
3395
  break;
3396
- if (A === !1) {
3397
- if (!y) {
3396
+ if (O === !1) {
3397
+ if (!A) {
3398
3398
  h.pop();
3399
3399
  continue;
3400
3400
  }
3401
- } else if (A !== void 0 && (u.push([l, A]), !y))
3402
- if (et(A))
3403
- c = A;
3401
+ } else if (O !== void 0 && (u.push([l, O]), !A))
3402
+ if (et(O))
3403
+ c = O;
3404
3404
  else {
3405
3405
  h.pop();
3406
3406
  continue;
3407
3407
  }
3408
3408
  }
3409
- if (A === void 0 && M && u.push([l, c]), y)
3409
+ if (O === void 0 && F && u.push([l, c]), A)
3410
3410
  h.pop();
3411
3411
  else {
3412
3412
  var C;
@@ -3449,10 +3449,10 @@ const Ti = 80, wi = {
3449
3449
  },
3450
3450
  OperationDefinition: {
3451
3451
  leave(e) {
3452
- const t = Ce(e.variableDefinitions) ? O(`(
3452
+ const t = Ce(e.variableDefinitions) ? I(`(
3453
3453
  `, g(e.variableDefinitions, `
3454
3454
  `), `
3455
- )`) : O("(", g(e.variableDefinitions, ", "), ")"), n = O("", e.description, `
3455
+ )`) : I("(", g(e.variableDefinitions, ", "), ")"), n = I("", e.description, `
3456
3456
  `) + g(
3457
3457
  [
3458
3458
  e.operation,
@@ -3465,17 +3465,17 @@ const Ti = 80, wi = {
3465
3465
  }
3466
3466
  },
3467
3467
  VariableDefinition: {
3468
- leave: ({ variable: e, type: t, defaultValue: n, directives: i, description: r }) => O("", r, `
3469
- `) + e + ": " + t + O(" = ", n) + O(" ", g(i, " "))
3468
+ leave: ({ variable: e, type: t, defaultValue: n, directives: i, description: r }) => I("", r, `
3469
+ `) + e + ": " + t + I(" = ", n) + I(" ", g(i, " "))
3470
3470
  },
3471
3471
  SelectionSet: {
3472
3472
  leave: ({ selections: e }) => U(e)
3473
3473
  },
3474
3474
  Field: {
3475
3475
  leave({ alias: e, name: t, arguments: n, directives: i, selectionSet: r }) {
3476
- const s = O("", e, ": ") + t;
3477
- let o = s + O("(", g(n, ", "), ")");
3478
- return o.length > Ti && (o = s + O(`(
3476
+ const s = I("", e, ": ") + t;
3477
+ let o = s + I("(", g(n, ", "), ")");
3478
+ return o.length > Ti && (o = s + I(`(
3479
3479
  `, Ee(g(n, `
3480
3480
  `)), `
3481
3481
  )`)), g([o, g(i, " "), r], " ");
@@ -3486,13 +3486,13 @@ const Ti = 80, wi = {
3486
3486
  },
3487
3487
  // Fragments
3488
3488
  FragmentSpread: {
3489
- leave: ({ name: e, directives: t }) => "..." + e + O(" ", g(t, " "))
3489
+ leave: ({ name: e, directives: t }) => "..." + e + I(" ", g(t, " "))
3490
3490
  },
3491
3491
  InlineFragment: {
3492
3492
  leave: ({ typeCondition: e, directives: t, selectionSet: n }) => g(
3493
3493
  [
3494
3494
  "...",
3495
- O("on ", e),
3495
+ I("on ", e),
3496
3496
  g(t, " "),
3497
3497
  n
3498
3498
  ],
@@ -3507,10 +3507,10 @@ const Ti = 80, wi = {
3507
3507
  directives: i,
3508
3508
  selectionSet: r,
3509
3509
  description: s
3510
- }) => O("", s, `
3510
+ }) => I("", s, `
3511
3511
  `) + // Note: fragment variable definitions are experimental and may be changed
3512
3512
  // or removed in the future.
3513
- `fragment ${e}${O("(", g(n, ", "), ")")} on ${t} ${O("", g(i, " "), " ")}` + r
3513
+ `fragment ${e}${I("(", g(n, ", "), ")")} on ${t} ${I("", g(i, " "), " ")}` + r
3514
3514
  },
3515
3515
  // Value
3516
3516
  IntValue: {
@@ -3542,7 +3542,7 @@ const Ti = 80, wi = {
3542
3542
  },
3543
3543
  // Directive
3544
3544
  Directive: {
3545
- leave: ({ name: e, arguments: t }) => "@" + e + O("(", g(t, ", "), ")")
3545
+ leave: ({ name: e, arguments: t }) => "@" + e + I("(", g(t, ", "), ")")
3546
3546
  },
3547
3547
  // Type
3548
3548
  NamedType: {
@@ -3556,23 +3556,23 @@ const Ti = 80, wi = {
3556
3556
  },
3557
3557
  // Type System Definitions
3558
3558
  SchemaDefinition: {
3559
- leave: ({ description: e, directives: t, operationTypes: n }) => O("", e, `
3559
+ leave: ({ description: e, directives: t, operationTypes: n }) => I("", e, `
3560
3560
  `) + g(["schema", g(t, " "), U(n)], " ")
3561
3561
  },
3562
3562
  OperationTypeDefinition: {
3563
3563
  leave: ({ operation: e, type: t }) => e + ": " + t
3564
3564
  },
3565
3565
  ScalarTypeDefinition: {
3566
- leave: ({ description: e, name: t, directives: n }) => O("", e, `
3566
+ leave: ({ description: e, name: t, directives: n }) => I("", e, `
3567
3567
  `) + g(["scalar", t, g(n, " ")], " ")
3568
3568
  },
3569
3569
  ObjectTypeDefinition: {
3570
- leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => O("", e, `
3570
+ leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => I("", e, `
3571
3571
  `) + g(
3572
3572
  [
3573
3573
  "type",
3574
3574
  t,
3575
- O("implements ", g(n, " & ")),
3575
+ I("implements ", g(n, " & ")),
3576
3576
  g(i, " "),
3577
3577
  U(r)
3578
3578
  ],
@@ -3580,26 +3580,26 @@ const Ti = 80, wi = {
3580
3580
  )
3581
3581
  },
3582
3582
  FieldDefinition: {
3583
- leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) => O("", e, `
3584
- `) + t + (Ce(n) ? O(`(
3583
+ leave: ({ description: e, name: t, arguments: n, type: i, directives: r }) => I("", e, `
3584
+ `) + t + (Ce(n) ? I(`(
3585
3585
  `, Ee(g(n, `
3586
3586
  `)), `
3587
- )`) : O("(", g(n, ", "), ")")) + ": " + i + O(" ", g(r, " "))
3587
+ )`) : I("(", g(n, ", "), ")")) + ": " + i + I(" ", g(r, " "))
3588
3588
  },
3589
3589
  InputValueDefinition: {
3590
- leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) => O("", e, `
3590
+ leave: ({ description: e, name: t, type: n, defaultValue: i, directives: r }) => I("", e, `
3591
3591
  `) + g(
3592
- [t + ": " + n, O("= ", i), g(r, " ")],
3592
+ [t + ": " + n, I("= ", i), g(r, " ")],
3593
3593
  " "
3594
3594
  )
3595
3595
  },
3596
3596
  InterfaceTypeDefinition: {
3597
- leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => O("", e, `
3597
+ leave: ({ description: e, name: t, interfaces: n, directives: i, fields: r }) => I("", e, `
3598
3598
  `) + g(
3599
3599
  [
3600
3600
  "interface",
3601
3601
  t,
3602
- O("implements ", g(n, " & ")),
3602
+ I("implements ", g(n, " & ")),
3603
3603
  g(i, " "),
3604
3604
  U(r)
3605
3605
  ],
@@ -3607,30 +3607,30 @@ const Ti = 80, wi = {
3607
3607
  )
3608
3608
  },
3609
3609
  UnionTypeDefinition: {
3610
- leave: ({ description: e, name: t, directives: n, types: i }) => O("", e, `
3610
+ leave: ({ description: e, name: t, directives: n, types: i }) => I("", e, `
3611
3611
  `) + g(
3612
- ["union", t, g(n, " "), O("= ", g(i, " | "))],
3612
+ ["union", t, g(n, " "), I("= ", g(i, " | "))],
3613
3613
  " "
3614
3614
  )
3615
3615
  },
3616
3616
  EnumTypeDefinition: {
3617
- leave: ({ description: e, name: t, directives: n, values: i }) => O("", e, `
3617
+ leave: ({ description: e, name: t, directives: n, values: i }) => I("", e, `
3618
3618
  `) + g(["enum", t, g(n, " "), U(i)], " ")
3619
3619
  },
3620
3620
  EnumValueDefinition: {
3621
- leave: ({ description: e, name: t, directives: n }) => O("", e, `
3621
+ leave: ({ description: e, name: t, directives: n }) => I("", e, `
3622
3622
  `) + g([t, g(n, " ")], " ")
3623
3623
  },
3624
3624
  InputObjectTypeDefinition: {
3625
- leave: ({ description: e, name: t, directives: n, fields: i }) => O("", e, `
3625
+ leave: ({ description: e, name: t, directives: n, fields: i }) => I("", e, `
3626
3626
  `) + g(["input", t, g(n, " "), U(i)], " ")
3627
3627
  },
3628
3628
  DirectiveDefinition: {
3629
- leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => O("", e, `
3630
- `) + "directive @" + t + (Ce(n) ? O(`(
3629
+ leave: ({ description: e, name: t, arguments: n, repeatable: i, locations: r }) => I("", e, `
3630
+ `) + "directive @" + t + (Ce(n) ? I(`(
3631
3631
  `, Ee(g(n, `
3632
3632
  `)), `
3633
- )`) : O("(", g(n, ", "), ")")) + (i ? " repeatable" : "") + " on " + g(r, " | ")
3633
+ )`) : I("(", g(n, ", "), ")")) + (i ? " repeatable" : "") + " on " + g(r, " | ")
3634
3634
  },
3635
3635
  SchemaExtension: {
3636
3636
  leave: ({ directives: e, operationTypes: t }) => g(
@@ -3646,7 +3646,7 @@ const Ti = 80, wi = {
3646
3646
  [
3647
3647
  "extend type",
3648
3648
  e,
3649
- O("implements ", g(t, " & ")),
3649
+ I("implements ", g(t, " & ")),
3650
3650
  g(n, " "),
3651
3651
  U(i)
3652
3652
  ],
@@ -3658,7 +3658,7 @@ const Ti = 80, wi = {
3658
3658
  [
3659
3659
  "extend interface",
3660
3660
  e,
3661
- O("implements ", g(t, " & ")),
3661
+ I("implements ", g(t, " & ")),
3662
3662
  g(n, " "),
3663
3663
  U(i)
3664
3664
  ],
@@ -3671,7 +3671,7 @@ const Ti = 80, wi = {
3671
3671
  "extend union",
3672
3672
  e,
3673
3673
  g(t, " "),
3674
- O("= ", g(n, " | "))
3674
+ I("= ", g(n, " | "))
3675
3675
  ],
3676
3676
  " "
3677
3677
  )
@@ -3687,16 +3687,16 @@ const Ti = 80, wi = {
3687
3687
  leave: ({ name: e }) => e
3688
3688
  },
3689
3689
  MemberCoordinate: {
3690
- leave: ({ name: e, memberName: t }) => g([e, O(".", t)])
3690
+ leave: ({ name: e, memberName: t }) => g([e, I(".", t)])
3691
3691
  },
3692
3692
  ArgumentCoordinate: {
3693
- leave: ({ name: e, fieldName: t, argumentName: n }) => g([e, O(".", t), O("(", n, ":)")])
3693
+ leave: ({ name: e, fieldName: t, argumentName: n }) => g([e, I(".", t), I("(", n, ":)")])
3694
3694
  },
3695
3695
  DirectiveCoordinate: {
3696
3696
  leave: ({ name: e }) => g(["@", e])
3697
3697
  },
3698
3698
  DirectiveArgumentCoordinate: {
3699
- leave: ({ name: e, argumentName: t }) => g(["@", e, O("(", t, ":)")])
3699
+ leave: ({ name: e, argumentName: t }) => g(["@", e, I("(", t, ":)")])
3700
3700
  }
3701
3701
  };
3702
3702
  function g(e, t = "") {
@@ -3704,16 +3704,16 @@ function g(e, t = "") {
3704
3704
  return (n = e?.filter((i) => i).join(t)) !== null && n !== void 0 ? n : "";
3705
3705
  }
3706
3706
  function U(e) {
3707
- return O(`{
3707
+ return I(`{
3708
3708
  `, Ee(g(e, `
3709
3709
  `)), `
3710
3710
  }`);
3711
3711
  }
3712
- function O(e, t, n = "") {
3712
+ function I(e, t, n = "") {
3713
3713
  return t != null && t !== "" ? e + t + n : "";
3714
3714
  }
3715
3715
  function Ee(e) {
3716
- return O(" ", e.replace(/\n/g, `
3716
+ return I(" ", e.replace(/\n/g, `
3717
3717
  `));
3718
3718
  }
3719
3719
  function Ce(e) {
@@ -3766,11 +3766,11 @@ ${String(e)}`);
3766
3766
  errors: t,
3767
3767
  extensions: i
3768
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) => {
3769
+ }, yi = (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, Ii = (e) => {
3770
3770
  let t;
3771
3771
  const n = e.definitions.filter(kt);
3772
3772
  return n.length === 1 && (t = n[0].name?.value), t;
3773
- }, Ai = (e) => {
3773
+ }, Oi = (e) => {
3774
3774
  let t = !1;
3775
3775
  const n = e.definitions.filter(kt);
3776
3776
  return n.length === 1 && (t = n[0].operation === "mutation"), t;
@@ -3780,7 +3780,7 @@ ${String(e)}`);
3780
3780
  if (t)
3781
3781
  return { expression: i, isMutation: r, operationName: s };
3782
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 });
3783
+ return o instanceof Error ? { expression: i, isMutation: r, operationName: s } : (s = Ii(o), r = Oi(o), { expression: i, operationName: s, isMutation: r });
3784
3784
  }, He = JSON, Re = async (e) => {
3785
3785
  const t = {
3786
3786
  ...e,
@@ -3789,10 +3789,10 @@ ${String(e)}`);
3789
3789
  ...e.fetchOptions,
3790
3790
  errorPolicy: e.fetchOptions.errorPolicy ?? "none"
3791
3791
  }
3792
- }, i = await xi(t.method)(t), r = await i.text();
3792
+ }, i = await Si(t.method)(t), r = await i.text();
3793
3793
  let s;
3794
3794
  try {
3795
- s = yi(r, i.headers.get(Ue), e.fetchOptions.jsonSerializer ?? He);
3795
+ s = Ai(r, i.headers.get(Ue), e.fetchOptions.jsonSerializer ?? He);
3796
3796
  } catch (a) {
3797
3797
  s = a;
3798
3798
  }
@@ -3818,7 +3818,7 @@ ${String(e)}`);
3818
3818
  }
3819
3819
  if (s instanceof Error)
3820
3820
  throw s;
3821
- if (Ii(s) && t.fetchOptions.errorPolicy === "none") {
3821
+ if (yi(s) && t.fetchOptions.errorPolicy === "none") {
3822
3822
  const a = s._tag === "Batch" ? { ...s.executionResults, ...o } : {
3823
3823
  ...s.executionResult,
3824
3824
  ...o
@@ -3846,7 +3846,7 @@ ${String(e)}`);
3846
3846
  extensions: t.extensions,
3847
3847
  data: t.data,
3848
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) => {
3849
+ }), Ai = (e, t, n) => t && vi(t) ? rt(n.parse(e)) : rt(e), Si = (e) => async (t) => {
3850
3850
  const n = new Headers(t.headers);
3851
3851
  let i = null, r;
3852
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);
@@ -3896,7 +3896,7 @@ ${String(e)}`);
3896
3896
  throw $e(e.request);
3897
3897
  }
3898
3898
  };
3899
- class Si {
3899
+ class xi {
3900
3900
  url;
3901
3901
  requestConfig;
3902
3902
  constructor(t, n = {}) {
@@ -4068,7 +4068,198 @@ const Ci = (e, t, n) => e.document ? e : {
4068
4068
  query: Query
4069
4069
  mutation: Mutation
4070
4070
  }
4071
- `, Ri = (e) => JSON.parse(e, (t, n) => {
4071
+ `;
4072
+ class Li {
4073
+ endpoint;
4074
+ headers;
4075
+ metaCache = /* @__PURE__ */ new Map();
4076
+ constructor(t) {
4077
+ this.endpoint = t.endpoint, this.headers = {
4078
+ "Content-Type": "application/json",
4079
+ ...t.headers
4080
+ };
4081
+ }
4082
+ /**
4083
+ * Execute a GraphQL query
4084
+ * @param query - GraphQL query string
4085
+ * @param variables - Query variables
4086
+ */
4087
+ async query(t, n) {
4088
+ const r = await (await fetch(this.endpoint, {
4089
+ method: "POST",
4090
+ headers: this.headers,
4091
+ body: JSON.stringify({ query: t, variables: n })
4092
+ })).json();
4093
+ if (r.errors?.length)
4094
+ throw new Error(r.errors[0].message);
4095
+ return r.data;
4096
+ }
4097
+ /**
4098
+ * Execute a GraphQL mutation
4099
+ * @param mutation - GraphQL mutation string
4100
+ * @param variables - Mutation variables
4101
+ */
4102
+ async mutate(t, n) {
4103
+ return this.query(t, n);
4104
+ }
4105
+ /**
4106
+ * Get doctype metadata
4107
+ * @param context - Route context containing doctype name
4108
+ */
4109
+ async getMeta(t) {
4110
+ const n = this.metaCache.get(t.doctype);
4111
+ if (n) return n;
4112
+ const i = await this.query(
4113
+ `
4114
+ query GetMeta($doctype: String!) {
4115
+ stonecropMeta(doctype: $doctype) {
4116
+ name
4117
+ slug
4118
+ tableName
4119
+ fields {
4120
+ fieldname
4121
+ fieldtype
4122
+ component
4123
+ label
4124
+ required
4125
+ readOnly
4126
+ options
4127
+ precision
4128
+ scale
4129
+ }
4130
+ workflow {
4131
+ states
4132
+ actions
4133
+ }
4134
+ inherits
4135
+ listDoctype
4136
+ parentDoctype
4137
+ }
4138
+ }
4139
+ `,
4140
+ { doctype: t.doctype }
4141
+ );
4142
+ return i.stonecropMeta && this.metaCache.set(t.doctype, i.stonecropMeta), i.stonecropMeta;
4143
+ }
4144
+ /**
4145
+ * Get all doctype metadata
4146
+ */
4147
+ async getAllMeta() {
4148
+ const t = await this.query(
4149
+ `
4150
+ query GetAllMeta {
4151
+ stonecropAllMeta {
4152
+ name
4153
+ slug
4154
+ tableName
4155
+ fields {
4156
+ fieldname
4157
+ fieldtype
4158
+ component
4159
+ label
4160
+ required
4161
+ readOnly
4162
+ options
4163
+ precision
4164
+ scale
4165
+ }
4166
+ workflow {
4167
+ states
4168
+ actions
4169
+ }
4170
+ inherits
4171
+ listDoctype
4172
+ parentDoctype
4173
+ }
4174
+ }
4175
+ `
4176
+ );
4177
+ for (const n of t.stonecropAllMeta)
4178
+ this.metaCache.set(n.name, n);
4179
+ return t.stonecropAllMeta;
4180
+ }
4181
+ /**
4182
+ * Get a single record by ID
4183
+ * @param doctype - Doctype metadata
4184
+ * @param recordId - Record ID to fetch
4185
+ */
4186
+ async getRecord(t, n) {
4187
+ return (await this.query(
4188
+ `
4189
+ query GetRecord($doctype: String!, $id: String!) {
4190
+ stonecropRecord(doctype: $doctype, id: $id) {
4191
+ data
4192
+ }
4193
+ }
4194
+ `,
4195
+ { doctype: t.name, id: n }
4196
+ )).stonecropRecord.data;
4197
+ }
4198
+ /**
4199
+ * Get multiple records with optional filtering and pagination
4200
+ * @param doctype - Doctype metadata
4201
+ * @param options - Query options (filters, orderBy, limit, offset)
4202
+ */
4203
+ async getRecords(t, n) {
4204
+ return (await this.query(
4205
+ `
4206
+ query GetRecords(
4207
+ $doctype: String!
4208
+ $filters: JSON
4209
+ $orderBy: String
4210
+ $limit: Int
4211
+ $offset: Int
4212
+ ) {
4213
+ stonecropRecords(
4214
+ doctype: $doctype
4215
+ filters: $filters
4216
+ orderBy: $orderBy
4217
+ limit: $limit
4218
+ offset: $offset
4219
+ ) {
4220
+ data
4221
+ count
4222
+ }
4223
+ }
4224
+ `,
4225
+ {
4226
+ doctype: t.name,
4227
+ ...n
4228
+ }
4229
+ )).stonecropRecords.data;
4230
+ }
4231
+ /**
4232
+ * Execute a doctype action
4233
+ * @param doctype - Doctype metadata
4234
+ * @param action - Action name to execute
4235
+ * @param args - Action arguments
4236
+ */
4237
+ async runAction(t, n, i) {
4238
+ return (await this.query(
4239
+ `
4240
+ mutation RunAction($doctype: String!, $action: String!, $args: JSON) {
4241
+ stonecropAction(doctype: $doctype, action: $action, args: $args) {
4242
+ success
4243
+ data
4244
+ error
4245
+ }
4246
+ }
4247
+ `,
4248
+ {
4249
+ doctype: t.name,
4250
+ action: n,
4251
+ args: i
4252
+ }
4253
+ )).stonecropAction;
4254
+ }
4255
+ /**
4256
+ * Clear the cached doctype metadata
4257
+ */
4258
+ clearMetaCache() {
4259
+ this.metaCache.clear();
4260
+ }
4261
+ }
4262
+ const Ri = (e) => JSON.parse(e, (t, n) => {
4072
4263
  if (typeof n == "string")
4073
4264
  try {
4074
4265
  return JSON.parse(n, (i, r) => typeof r == "string" && !isNaN(Number(r)) ? new ie(r) : r);
@@ -4078,9 +4269,9 @@ const Ci = (e, t, n) => e.document ? e : {
4078
4269
  else if (!isNaN(Number(n)))
4079
4270
  return new ie(n);
4080
4271
  return n;
4081
- }), Li = {
4272
+ }), Mi = {
4082
4273
  getMeta: async (e, t) => {
4083
- const n = new Si(t || "/graphql", {
4274
+ const n = new xi(t || "/graphql", {
4084
4275
  fetch: window.fetch,
4085
4276
  jsonSerializer: {
4086
4277
  stringify: (r) => JSON.stringify(r),
@@ -4096,7 +4287,8 @@ const Ci = (e, t, n) => e.document ? e : {
4096
4287
  }
4097
4288
  };
4098
4289
  export {
4099
- Li as methods,
4290
+ Li as StonecropClient,
4291
+ Mi as methods,
4100
4292
  ki as queries,
4101
4293
  bi as typeDefs
4102
4294
  };