@clicktap/state 0.14.8 → 0.15.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/auth/AuthProvider.d.ts +24 -8
- package/auth/actions/index.d.ts +1 -0
- package/auth/actions/notifyAuthenticated.d.ts +6 -0
- package/auth/auth.d.ts +12 -4
- package/auth/types.d.ts +9 -1
- package/index.js +23 -23
- package/index.mjs +825 -732
- package/package.json +1 -1
- package/quote/QuoteProvider.d.ts +30 -6
- package/quote/checkout/actions/resetCheckout.d.ts +1 -0
- package/quote/checkout/actions/updateQuote.d.ts +2 -0
- package/quote/quote/actions/addItems.d.ts +2 -0
- package/quote/quote/actions/index.d.ts +1 -0
- package/quote/quote/actions/refresh.d.ts +2 -0
- package/quote/quote/actions/removeItems.d.ts +2 -0
- package/quote/quote/actions/syncAccessToken.d.ts +100 -0
- package/quote/quote/actions/updateItems.d.ts +2 -0
- package/quote/quote/actors/addItems.d.ts +1 -0
- package/quote/quote/actors/refresh.d.ts +1 -0
- package/quote/quote/actors/removeItems.d.ts +3 -0
- package/quote/quote/actors/updateItems.d.ts +1 -0
- package/quote/quote/types.d.ts +13 -1
- package/quote/quote.d.ts +10 -2
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as Ce } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ke, useContext as Ne, useState as Oe, useEffect as De, cloneElement as In } from "react";
|
|
3
3
|
function An(e, t) {
|
|
4
4
|
for (var n = 0; n < t.length; n++) {
|
|
5
5
|
const s = t[n];
|
|
@@ -66,7 +66,7 @@ class pt {
|
|
|
66
66
|
this._last = null;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const Ft = ".", Cn = "", Bt = "",
|
|
69
|
+
const Ft = ".", Cn = "", Bt = "", kn = "#", Nn = "*", jt = "xstate.init", On = "xstate.error", ue = "xstate.stop";
|
|
70
70
|
function Dn(e, t) {
|
|
71
71
|
return {
|
|
72
72
|
type: `xstate.after.${e}.${t}`
|
|
@@ -111,68 +111,68 @@ function Ln(e, t) {
|
|
|
111
111
|
clock: a,
|
|
112
112
|
logger: c
|
|
113
113
|
} = t, u = {
|
|
114
|
-
schedule: (
|
|
114
|
+
schedule: (h, m, y, T, _ = Math.random().toString(36).slice(2)) => {
|
|
115
115
|
const w = {
|
|
116
|
-
source:
|
|
116
|
+
source: h,
|
|
117
117
|
target: m,
|
|
118
118
|
event: y,
|
|
119
|
-
delay:
|
|
119
|
+
delay: T,
|
|
120
120
|
id: _,
|
|
121
121
|
startedAt: Date.now()
|
|
122
|
-
}, R = yt(
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
delete o[R], delete
|
|
126
|
-
},
|
|
127
|
-
o[R] =
|
|
122
|
+
}, R = yt(h, _);
|
|
123
|
+
l._snapshot._scheduledEvents[R] = w;
|
|
124
|
+
const O = a.setTimeout(() => {
|
|
125
|
+
delete o[R], delete l._snapshot._scheduledEvents[R], l._relay(h, m, y);
|
|
126
|
+
}, T);
|
|
127
|
+
o[R] = O;
|
|
128
128
|
},
|
|
129
|
-
cancel: (
|
|
130
|
-
const y = yt(
|
|
131
|
-
delete o[y], delete
|
|
129
|
+
cancel: (h, m) => {
|
|
130
|
+
const y = yt(h, m), T = o[y];
|
|
131
|
+
delete o[y], delete l._snapshot._scheduledEvents[y], a.clearTimeout(T);
|
|
132
132
|
},
|
|
133
|
-
cancelAll: (
|
|
134
|
-
for (const m in
|
|
135
|
-
const y =
|
|
136
|
-
y.source ===
|
|
133
|
+
cancelAll: (h) => {
|
|
134
|
+
for (const m in l._snapshot._scheduledEvents) {
|
|
135
|
+
const y = l._snapshot._scheduledEvents[m];
|
|
136
|
+
y.source === h && u.cancel(h, y.id);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
},
|
|
139
|
+
}, f = (h) => {
|
|
140
140
|
if (!i.size)
|
|
141
141
|
return;
|
|
142
142
|
const m = {
|
|
143
|
-
...
|
|
143
|
+
...h,
|
|
144
144
|
rootId: e.sessionId
|
|
145
145
|
};
|
|
146
146
|
i.forEach((y) => {
|
|
147
|
-
var
|
|
148
|
-
return (
|
|
147
|
+
var T;
|
|
148
|
+
return (T = y.next) == null ? void 0 : T.call(y, m);
|
|
149
149
|
});
|
|
150
|
-
},
|
|
150
|
+
}, l = {
|
|
151
151
|
_snapshot: {
|
|
152
152
|
_scheduledEvents: ((t == null ? void 0 : t.snapshot) && t.snapshot.scheduler) ?? {}
|
|
153
153
|
},
|
|
154
154
|
_bookId: () => `x:${Mn++}`,
|
|
155
|
-
_register: (
|
|
156
|
-
_unregister: (
|
|
157
|
-
n.delete(
|
|
158
|
-
const m = r.get(
|
|
159
|
-
m !== void 0 && (s.delete(m), r.delete(
|
|
155
|
+
_register: (h, m) => (n.set(h, m), h),
|
|
156
|
+
_unregister: (h) => {
|
|
157
|
+
n.delete(h.sessionId);
|
|
158
|
+
const m = r.get(h);
|
|
159
|
+
m !== void 0 && (s.delete(m), r.delete(h));
|
|
160
160
|
},
|
|
161
|
-
get: (
|
|
162
|
-
_set: (
|
|
163
|
-
const y = s.get(
|
|
161
|
+
get: (h) => s.get(h),
|
|
162
|
+
_set: (h, m) => {
|
|
163
|
+
const y = s.get(h);
|
|
164
164
|
if (y && y !== m)
|
|
165
|
-
throw new Error(`Actor with system ID '${
|
|
166
|
-
s.set(
|
|
165
|
+
throw new Error(`Actor with system ID '${h}' already exists.`);
|
|
166
|
+
s.set(h, m), r.set(m, h);
|
|
167
167
|
},
|
|
168
|
-
inspect: (
|
|
169
|
-
i.add(
|
|
168
|
+
inspect: (h) => {
|
|
169
|
+
i.add(h);
|
|
170
170
|
},
|
|
171
|
-
_sendInspectionEvent:
|
|
172
|
-
_relay: (
|
|
173
|
-
|
|
171
|
+
_sendInspectionEvent: f,
|
|
172
|
+
_relay: (h, m, y) => {
|
|
173
|
+
l._sendInspectionEvent({
|
|
174
174
|
type: "@xstate.event",
|
|
175
|
-
sourceRef:
|
|
175
|
+
sourceRef: h,
|
|
176
176
|
actorRef: m,
|
|
177
177
|
event: y
|
|
178
178
|
}), m._send(y);
|
|
@@ -180,27 +180,27 @@ function Ln(e, t) {
|
|
|
180
180
|
scheduler: u,
|
|
181
181
|
getSnapshot: () => ({
|
|
182
182
|
_scheduledEvents: {
|
|
183
|
-
...
|
|
183
|
+
...l._snapshot._scheduledEvents
|
|
184
184
|
}
|
|
185
185
|
}),
|
|
186
186
|
start: () => {
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
for (const m in
|
|
187
|
+
const h = l._snapshot._scheduledEvents;
|
|
188
|
+
l._snapshot._scheduledEvents = {};
|
|
189
|
+
for (const m in h) {
|
|
190
190
|
const {
|
|
191
191
|
source: y,
|
|
192
|
-
target:
|
|
192
|
+
target: T,
|
|
193
193
|
event: _,
|
|
194
194
|
delay: w,
|
|
195
195
|
id: R
|
|
196
|
-
} =
|
|
197
|
-
u.schedule(y,
|
|
196
|
+
} = h[m];
|
|
197
|
+
u.schedule(y, T, _, w, R);
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
_clock: a,
|
|
201
201
|
_logger: c
|
|
202
202
|
};
|
|
203
|
-
return
|
|
203
|
+
return l;
|
|
204
204
|
}
|
|
205
205
|
function Ht(e, t) {
|
|
206
206
|
const n = mt(e), s = mt(t);
|
|
@@ -290,7 +290,7 @@ function Et(e, t, n) {
|
|
|
290
290
|
complete: (a = s ? e.complete : n) == null ? void 0 : a.bind(r)
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Tt(e, t) {
|
|
294
294
|
return `${t}.${e}`;
|
|
295
295
|
}
|
|
296
296
|
function nt(e, t) {
|
|
@@ -331,30 +331,30 @@ class Bn {
|
|
|
331
331
|
syncSnapshot: a,
|
|
332
332
|
id: c,
|
|
333
333
|
systemId: u,
|
|
334
|
-
inspect:
|
|
334
|
+
inspect: f
|
|
335
335
|
} = s;
|
|
336
336
|
this.system = o ? o.system : Ln(this, {
|
|
337
337
|
clock: r,
|
|
338
338
|
logger: i
|
|
339
|
-
}),
|
|
339
|
+
}), f && !o && this.system.inspect(Et(f)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (n == null ? void 0 : n.logger) ?? this.system._logger, this.clock = (n == null ? void 0 : n.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = s, this.src = s.src ?? t, this.ref = this, this._actorScope = {
|
|
340
340
|
self: this,
|
|
341
341
|
id: this.id,
|
|
342
342
|
sessionId: this.sessionId,
|
|
343
343
|
logger: this.logger,
|
|
344
|
-
defer: (
|
|
345
|
-
this._deferred.push(
|
|
344
|
+
defer: (l) => {
|
|
345
|
+
this._deferred.push(l);
|
|
346
346
|
},
|
|
347
347
|
system: this.system,
|
|
348
|
-
stopChild: (
|
|
349
|
-
if (
|
|
350
|
-
throw new Error(`Cannot stop child actor ${
|
|
351
|
-
|
|
348
|
+
stopChild: (l) => {
|
|
349
|
+
if (l._parent !== this)
|
|
350
|
+
throw new Error(`Cannot stop child actor ${l.id} of ${this.id} because it is not a child`);
|
|
351
|
+
l._stop();
|
|
352
352
|
},
|
|
353
|
-
emit: (
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
for (const m of Array.from(
|
|
357
|
-
m(
|
|
353
|
+
emit: (l) => {
|
|
354
|
+
const h = this.eventListeners.get(l.type);
|
|
355
|
+
if (h)
|
|
356
|
+
for (const m of Array.from(h))
|
|
357
|
+
m(l);
|
|
358
358
|
}
|
|
359
359
|
}, this.send = this.send.bind(this), this.system._sendInspectionEvent({
|
|
360
360
|
type: "@xstate.actor",
|
|
@@ -708,10 +708,10 @@ function Hn(e, t, n, s, {
|
|
|
708
708
|
input: a,
|
|
709
709
|
syncSnapshot: c
|
|
710
710
|
}) {
|
|
711
|
-
const u = typeof o == "string" ? nt(t.machine, o) : o,
|
|
712
|
-
let
|
|
713
|
-
return u && (
|
|
714
|
-
id:
|
|
711
|
+
const u = typeof o == "string" ? nt(t.machine, o) : o, f = typeof r == "function" ? r(n) : r;
|
|
712
|
+
let l;
|
|
713
|
+
return u && (l = j(u, {
|
|
714
|
+
id: f,
|
|
715
715
|
src: o,
|
|
716
716
|
parent: e.self,
|
|
717
717
|
syncSnapshot: c,
|
|
@@ -724,11 +724,11 @@ function Hn(e, t, n, s, {
|
|
|
724
724
|
})), [Y(t, {
|
|
725
725
|
children: {
|
|
726
726
|
...t.children,
|
|
727
|
-
[
|
|
727
|
+
[f]: l
|
|
728
728
|
}
|
|
729
729
|
}), {
|
|
730
730
|
id: r,
|
|
731
|
-
actorRef:
|
|
731
|
+
actorRef: l
|
|
732
732
|
}];
|
|
733
733
|
}
|
|
734
734
|
function zn(e, {
|
|
@@ -811,15 +811,15 @@ function le(e, t) {
|
|
|
811
811
|
n.push(s), s = s.parent;
|
|
812
812
|
return n;
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function Ae(e) {
|
|
815
815
|
const t = new Set(e), n = Xt(t);
|
|
816
816
|
for (const s of t)
|
|
817
817
|
if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
|
|
818
|
-
|
|
818
|
+
vt(s).forEach((r) => t.add(r));
|
|
819
819
|
else if (s.type === "parallel") {
|
|
820
820
|
for (const r of te(s))
|
|
821
821
|
if (r.type !== "history" && !t.has(r)) {
|
|
822
|
-
const i =
|
|
822
|
+
const i = vt(r);
|
|
823
823
|
for (const o of i)
|
|
824
824
|
t.add(o);
|
|
825
825
|
}
|
|
@@ -855,13 +855,13 @@ function Xt(e) {
|
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
857
|
function Wt(e, t) {
|
|
858
|
-
const n =
|
|
858
|
+
const n = Ae(t);
|
|
859
859
|
return Qt(e, Xt(n));
|
|
860
860
|
}
|
|
861
861
|
function ot(e, t) {
|
|
862
862
|
return t.type === "compound" ? te(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? te(t).every((n) => ot(e, n)) : t.type === "final";
|
|
863
863
|
}
|
|
864
|
-
const
|
|
864
|
+
const Re = (e) => e[0] === kn;
|
|
865
865
|
function Qn(e, t) {
|
|
866
866
|
return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
|
|
867
867
|
if (s === Nn)
|
|
@@ -894,8 +894,8 @@ function Xn(e) {
|
|
|
894
894
|
const o = t[r], a = typeof o == "string" ? {
|
|
895
895
|
target: o
|
|
896
896
|
} : o, c = Number.isNaN(+r) ? r : +r, u = n(c);
|
|
897
|
-
return B(a).map((
|
|
898
|
-
...
|
|
897
|
+
return B(a).map((f) => ({
|
|
898
|
+
...f,
|
|
899
899
|
event: u,
|
|
900
900
|
delay: c
|
|
901
901
|
}));
|
|
@@ -982,15 +982,15 @@ function Zn(e, t) {
|
|
|
982
982
|
return t.map((n) => {
|
|
983
983
|
if (typeof n != "string")
|
|
984
984
|
return n;
|
|
985
|
-
if (
|
|
985
|
+
if (Re(n))
|
|
986
986
|
return e.machine.getStateNodeById(n);
|
|
987
987
|
const s = n[0] === Ft;
|
|
988
988
|
if (s && !e.parent)
|
|
989
|
-
return
|
|
989
|
+
return we(e, n.slice(1));
|
|
990
990
|
const r = s ? e.key + n : n;
|
|
991
991
|
if (e.parent)
|
|
992
992
|
try {
|
|
993
|
-
return
|
|
993
|
+
return we(e.parent, r);
|
|
994
994
|
} catch (i) {
|
|
995
995
|
throw new Error(`Invalid transition definition for state node '${e.id}':
|
|
996
996
|
${i.message}`);
|
|
@@ -1002,13 +1002,13 @@ ${i.message}`);
|
|
|
1002
1002
|
function Kt(e) {
|
|
1003
1003
|
const t = Jt(e.config.target);
|
|
1004
1004
|
return t ? {
|
|
1005
|
-
target: t.map((n) => typeof n == "string" ?
|
|
1005
|
+
target: t.map((n) => typeof n == "string" ? we(e.parent, n) : n)
|
|
1006
1006
|
} : e.parent.initial;
|
|
1007
1007
|
}
|
|
1008
1008
|
function J(e) {
|
|
1009
1009
|
return e.type === "history";
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function vt(e) {
|
|
1012
1012
|
const t = Zt(e);
|
|
1013
1013
|
for (const n of t)
|
|
1014
1014
|
for (const s of le(n, e))
|
|
@@ -1029,7 +1029,7 @@ function Zt(e) {
|
|
|
1029
1029
|
return n(e), t;
|
|
1030
1030
|
}
|
|
1031
1031
|
function ne(e, t) {
|
|
1032
|
-
if (
|
|
1032
|
+
if (Re(t))
|
|
1033
1033
|
return e.machine.getStateNodeById(t);
|
|
1034
1034
|
if (!e.states)
|
|
1035
1035
|
throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);
|
|
@@ -1038,8 +1038,8 @@ function ne(e, t) {
|
|
|
1038
1038
|
throw new Error(`Child state '${t}' does not exist on '${e.id}'`);
|
|
1039
1039
|
return n;
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1042
|
-
if (typeof t == "string" &&
|
|
1041
|
+
function we(e, t) {
|
|
1042
|
+
if (typeof t == "string" && Re(t))
|
|
1043
1043
|
try {
|
|
1044
1044
|
return e.machine.getStateNodeById(t);
|
|
1045
1045
|
} catch {
|
|
@@ -1054,7 +1054,7 @@ function Ae(e, t) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
return s;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function xe(e, t) {
|
|
1058
1058
|
if (typeof t == "string") {
|
|
1059
1059
|
const r = e.states[t];
|
|
1060
1060
|
if (!r)
|
|
@@ -1066,7 +1066,7 @@ function we(e, t) {
|
|
|
1066
1066
|
const o = ne(e, i);
|
|
1067
1067
|
if (!o)
|
|
1068
1068
|
return r;
|
|
1069
|
-
const a =
|
|
1069
|
+
const a = xe(o, t[i]);
|
|
1070
1070
|
return r.concat(a);
|
|
1071
1071
|
}, []));
|
|
1072
1072
|
}
|
|
@@ -1193,16 +1193,16 @@ function Ye(e, t, n, s, r, i) {
|
|
|
1193
1193
|
let a = t.historyValue;
|
|
1194
1194
|
const c = en(e, o, a);
|
|
1195
1195
|
let u = t;
|
|
1196
|
-
r || ([u, a] = ds(u, s, n, c, o, a, i)), u = se(u, s, n, c.flatMap((
|
|
1197
|
-
const
|
|
1198
|
-
u.status === "done" && (u = se(u, s, n,
|
|
1196
|
+
r || ([u, a] = ds(u, s, n, c, o, a, i)), u = se(u, s, n, c.flatMap((l) => l.actions), i), u = cs(u, s, n, c, o, i, a, r);
|
|
1197
|
+
const f = [...o];
|
|
1198
|
+
u.status === "done" && (u = se(u, s, n, f.sort((l, h) => h.order - l.order).flatMap((l) => l.exit), i));
|
|
1199
1199
|
try {
|
|
1200
1200
|
return a === t.historyValue && os(t._nodes, o) ? u : Y(u, {
|
|
1201
|
-
_nodes:
|
|
1201
|
+
_nodes: f,
|
|
1202
1202
|
historyValue: a
|
|
1203
1203
|
});
|
|
1204
|
-
} catch (
|
|
1205
|
-
throw
|
|
1204
|
+
} catch (l) {
|
|
1205
|
+
throw l;
|
|
1206
1206
|
}
|
|
1207
1207
|
}
|
|
1208
1208
|
function as(e, t, n, s, r) {
|
|
@@ -1213,28 +1213,28 @@ function as(e, t, n, s, r) {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
function cs(e, t, n, s, r, i, o, a) {
|
|
1215
1215
|
let c = e;
|
|
1216
|
-
const u = /* @__PURE__ */ new Set(),
|
|
1217
|
-
us(s, o,
|
|
1218
|
-
const
|
|
1219
|
-
for (const
|
|
1220
|
-
r.add(
|
|
1216
|
+
const u = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
|
|
1217
|
+
us(s, o, f, u), a && f.add(e.machine.root);
|
|
1218
|
+
const l = /* @__PURE__ */ new Set();
|
|
1219
|
+
for (const h of [...u].sort((m, y) => m.order - y.order)) {
|
|
1220
|
+
r.add(h);
|
|
1221
1221
|
const m = [];
|
|
1222
|
-
m.push(...
|
|
1223
|
-
for (const y of
|
|
1222
|
+
m.push(...h.entry);
|
|
1223
|
+
for (const y of h.invoke)
|
|
1224
1224
|
m.push(Gn(y.src, {
|
|
1225
1225
|
...y,
|
|
1226
1226
|
syncSnapshot: !!y.onSnapshot
|
|
1227
1227
|
}));
|
|
1228
|
-
if (
|
|
1229
|
-
const y =
|
|
1228
|
+
if (f.has(h)) {
|
|
1229
|
+
const y = h.initial.actions;
|
|
1230
1230
|
m.push(...y);
|
|
1231
1231
|
}
|
|
1232
|
-
if (c = se(c, t, n, m, i,
|
|
1233
|
-
const y =
|
|
1234
|
-
let
|
|
1235
|
-
for ((y == null ? void 0 : y.type) === "compound" && i.push(ze(y.id,
|
|
1236
|
-
|
|
1237
|
-
if (
|
|
1232
|
+
if (c = se(c, t, n, m, i, h.invoke.map((y) => y.id)), h.type === "final") {
|
|
1233
|
+
const y = h.parent;
|
|
1234
|
+
let T = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, _ = T || h;
|
|
1235
|
+
for ((y == null ? void 0 : y.type) === "compound" && i.push(ze(y.id, h.output !== void 0 ? Ge(h.output, c.context, t, n.self) : void 0)); (T == null ? void 0 : T.type) === "parallel" && !l.has(T) && ot(r, T); )
|
|
1236
|
+
l.add(T), i.push(ze(T.id)), _ = T, T = T.parent;
|
|
1237
|
+
if (T)
|
|
1238
1238
|
continue;
|
|
1239
1239
|
c = Y(c, {
|
|
1240
1240
|
status: "done",
|
|
@@ -1268,17 +1268,17 @@ function Z(e, t, n, s) {
|
|
|
1268
1268
|
for (const o of i)
|
|
1269
1269
|
s.add(o), Z(o, t, n, s);
|
|
1270
1270
|
for (const o of i)
|
|
1271
|
-
|
|
1271
|
+
Pe(o, e.parent, s, t, n);
|
|
1272
1272
|
} else {
|
|
1273
1273
|
const i = Kt(e);
|
|
1274
1274
|
for (const o of i.target)
|
|
1275
1275
|
s.add(o), i === ((r = e.parent) == null ? void 0 : r.initial) && n.add(e.parent), Z(o, t, n, s);
|
|
1276
1276
|
for (const o of i.target)
|
|
1277
|
-
|
|
1277
|
+
Pe(o, e.parent, s, t, n);
|
|
1278
1278
|
}
|
|
1279
1279
|
else if (e.type === "compound") {
|
|
1280
1280
|
const [i] = e.initial.target;
|
|
1281
|
-
J(i) || (s.add(i), n.add(i)), Z(i, t, n, s),
|
|
1281
|
+
J(i) || (s.add(i), n.add(i)), Z(i, t, n, s), Pe(i, e, s, t, n);
|
|
1282
1282
|
} else if (e.type === "parallel")
|
|
1283
1283
|
for (const i of te(e).filter((o) => !J(o)))
|
|
1284
1284
|
[...s].some((o) => V(o, i)) || (J(i) || (s.add(i), n.add(i)), Z(i, t, n, s));
|
|
@@ -1289,23 +1289,23 @@ function nn(e, t, n, s, r) {
|
|
|
1289
1289
|
for (const o of te(i).filter((a) => !J(a)))
|
|
1290
1290
|
[...e].some((a) => V(a, o)) || (e.add(o), Z(o, t, n, e));
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1292
|
+
function Pe(e, t, n, s, r) {
|
|
1293
1293
|
nn(n, s, r, le(e, t));
|
|
1294
1294
|
}
|
|
1295
1295
|
function ds(e, t, n, s, r, i, o) {
|
|
1296
1296
|
let a = e;
|
|
1297
1297
|
const c = Je(s, r, i);
|
|
1298
|
-
c.sort((
|
|
1298
|
+
c.sort((f, l) => l.order - f.order);
|
|
1299
1299
|
let u;
|
|
1300
|
-
for (const
|
|
1301
|
-
for (const
|
|
1302
|
-
let
|
|
1303
|
-
|
|
1300
|
+
for (const f of c)
|
|
1301
|
+
for (const l of ss(f)) {
|
|
1302
|
+
let h;
|
|
1303
|
+
l.history === "deep" ? h = (m) => it(m) && V(m, f) : h = (m) => m.parent === f, u ?? (u = {
|
|
1304
1304
|
...i
|
|
1305
|
-
}), u[
|
|
1305
|
+
}), u[l.id] = Array.from(r).filter(h);
|
|
1306
1306
|
}
|
|
1307
|
-
for (const
|
|
1308
|
-
a = se(a, t, n, [...
|
|
1307
|
+
for (const f of c)
|
|
1308
|
+
a = se(a, t, n, [...f.exit, ...f.invoke.map((l) => Yt(l.id))], o), r.delete(f);
|
|
1309
1309
|
return [a, u || i];
|
|
1310
1310
|
}
|
|
1311
1311
|
let St = !1;
|
|
@@ -1321,48 +1321,48 @@ function sn(e, t, n, s, r, i) {
|
|
|
1321
1321
|
actorRef: n.self,
|
|
1322
1322
|
action: {
|
|
1323
1323
|
type: typeof c == "string" ? c : typeof c == "object" ? c.type : c.name || "(anonymous)",
|
|
1324
|
-
params:
|
|
1324
|
+
params: h
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
try {
|
|
1328
|
-
St =
|
|
1328
|
+
St = f, f(l, h);
|
|
1329
1329
|
} finally {
|
|
1330
1330
|
St = !1;
|
|
1331
1331
|
}
|
|
1332
1332
|
};
|
|
1333
|
-
const u = typeof c == "function",
|
|
1333
|
+
const u = typeof c == "function", f = u ? c : (
|
|
1334
1334
|
// the existing type of `.actions` assumes non-nullable `TExpressionAction`
|
|
1335
1335
|
// it's fine to cast this here to get a common type and lack of errors in the rest of the code
|
|
1336
1336
|
// our logic below makes sure that we call those 2 "variants" correctly
|
|
1337
1337
|
o.implementations.actions[typeof c == "string" ? c : c.type]
|
|
1338
1338
|
);
|
|
1339
|
-
if (!
|
|
1339
|
+
if (!f)
|
|
1340
1340
|
continue;
|
|
1341
|
-
const
|
|
1341
|
+
const l = {
|
|
1342
1342
|
context: a.context,
|
|
1343
1343
|
event: t,
|
|
1344
1344
|
self: n.self,
|
|
1345
1345
|
system: n.system
|
|
1346
|
-
},
|
|
1346
|
+
}, h = u || typeof c == "string" ? void 0 : "params" in c ? typeof c.params == "function" ? c.params({
|
|
1347
1347
|
context: a.context,
|
|
1348
1348
|
event: t
|
|
1349
1349
|
}) : c.params : void 0;
|
|
1350
|
-
if (!("resolve" in
|
|
1350
|
+
if (!("resolve" in f)) {
|
|
1351
1351
|
n.self._processingStatus === D.Running ? m() : n.defer(() => {
|
|
1352
1352
|
m();
|
|
1353
1353
|
});
|
|
1354
1354
|
continue;
|
|
1355
1355
|
}
|
|
1356
|
-
const y =
|
|
1356
|
+
const y = f, [T, _, w] = y.resolve(
|
|
1357
1357
|
n,
|
|
1358
1358
|
a,
|
|
1359
|
-
|
|
1360
|
-
f,
|
|
1359
|
+
l,
|
|
1361
1360
|
h,
|
|
1361
|
+
f,
|
|
1362
1362
|
// this holds all params
|
|
1363
1363
|
r
|
|
1364
1364
|
);
|
|
1365
|
-
a =
|
|
1365
|
+
a = T, "retryResolve" in y && (i == null || i.push([y, _])), "execute" in y && (n.self._processingStatus === D.Running ? y.execute(n, _) : n.defer(y.execute.bind(null, n, _))), w && (a = sn(a, t, n, w, r, i));
|
|
1366
1366
|
}
|
|
1367
1367
|
return a;
|
|
1368
1368
|
}
|
|
@@ -1375,16 +1375,16 @@ function se(e, t, n, s, r, i) {
|
|
|
1375
1375
|
c.retryResolve(n, a, u);
|
|
1376
1376
|
}), a;
|
|
1377
1377
|
}
|
|
1378
|
-
function
|
|
1378
|
+
function Fe(e, t, n, s = []) {
|
|
1379
1379
|
let r = e;
|
|
1380
1380
|
const i = [];
|
|
1381
|
-
function o(u,
|
|
1381
|
+
function o(u, f, l) {
|
|
1382
1382
|
n.system._sendInspectionEvent({
|
|
1383
1383
|
type: "@xstate.microstep",
|
|
1384
1384
|
actorRef: n.self,
|
|
1385
|
-
event:
|
|
1385
|
+
event: f,
|
|
1386
1386
|
snapshot: u,
|
|
1387
|
-
_transitions:
|
|
1387
|
+
_transitions: l
|
|
1388
1388
|
}), i.push(u);
|
|
1389
1389
|
}
|
|
1390
1390
|
if (t.type === ue)
|
|
@@ -1396,8 +1396,8 @@ function Pe(e, t, n, s = []) {
|
|
|
1396
1396
|
};
|
|
1397
1397
|
let a = t;
|
|
1398
1398
|
if (a.type !== jt) {
|
|
1399
|
-
const u = a,
|
|
1400
|
-
if (
|
|
1399
|
+
const u = a, f = Pn(u), l = It(u, r);
|
|
1400
|
+
if (f && !l.length)
|
|
1401
1401
|
return r = Y(e, {
|
|
1402
1402
|
status: "error",
|
|
1403
1403
|
error: u.error
|
|
@@ -1406,25 +1406,25 @@ function Pe(e, t, n, s = []) {
|
|
|
1406
1406
|
microstates: i
|
|
1407
1407
|
};
|
|
1408
1408
|
r = Ye(
|
|
1409
|
-
|
|
1409
|
+
l,
|
|
1410
1410
|
e,
|
|
1411
1411
|
n,
|
|
1412
1412
|
a,
|
|
1413
1413
|
!1,
|
|
1414
1414
|
// isInitial
|
|
1415
1415
|
s
|
|
1416
|
-
), o(r, u,
|
|
1416
|
+
), o(r, u, l);
|
|
1417
1417
|
}
|
|
1418
1418
|
let c = !0;
|
|
1419
1419
|
for (; r.status === "active"; ) {
|
|
1420
1420
|
let u = c ? ls(r, a) : [];
|
|
1421
|
-
const
|
|
1421
|
+
const f = u.length ? r : void 0;
|
|
1422
1422
|
if (!u.length) {
|
|
1423
1423
|
if (!s.length)
|
|
1424
1424
|
break;
|
|
1425
1425
|
a = s.shift(), u = It(a, r);
|
|
1426
1426
|
}
|
|
1427
|
-
r = Ye(u, r, n, a, !1, s), c = r !==
|
|
1427
|
+
r = Ye(u, r, n, a, !1, s), c = r !== f, o(r, a, u);
|
|
1428
1428
|
}
|
|
1429
1429
|
return r.status !== "active" && _t(r, a, n), {
|
|
1430
1430
|
snapshot: r,
|
|
@@ -1452,7 +1452,7 @@ function ls(e, t) {
|
|
|
1452
1452
|
return en(Array.from(n), new Set(e._nodes), e.historyValue);
|
|
1453
1453
|
}
|
|
1454
1454
|
function hs(e, t) {
|
|
1455
|
-
const n =
|
|
1455
|
+
const n = Ae(xe(e, t));
|
|
1456
1456
|
return Wt(e, [...n]);
|
|
1457
1457
|
}
|
|
1458
1458
|
function fs(e) {
|
|
@@ -1485,7 +1485,7 @@ const ps = function(t) {
|
|
|
1485
1485
|
}, Es = function() {
|
|
1486
1486
|
return this._nodes.reduce((t, n) => (n.meta !== void 0 && (t[n.id] = n.meta), t), {});
|
|
1487
1487
|
};
|
|
1488
|
-
function
|
|
1488
|
+
function Te(e, t) {
|
|
1489
1489
|
return {
|
|
1490
1490
|
status: e.status,
|
|
1491
1491
|
output: e.output,
|
|
@@ -1505,12 +1505,12 @@ function ve(e, t) {
|
|
|
1505
1505
|
};
|
|
1506
1506
|
}
|
|
1507
1507
|
function Y(e, t = {}) {
|
|
1508
|
-
return
|
|
1508
|
+
return Te({
|
|
1509
1509
|
...e,
|
|
1510
1510
|
...t
|
|
1511
1511
|
}, e.machine);
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function Ts(e, t) {
|
|
1514
1514
|
const {
|
|
1515
1515
|
_nodes: n,
|
|
1516
1516
|
tags: s,
|
|
@@ -1520,13 +1520,13 @@ function vs(e, t) {
|
|
|
1520
1520
|
can: a,
|
|
1521
1521
|
hasTag: c,
|
|
1522
1522
|
matches: u,
|
|
1523
|
-
getMeta:
|
|
1524
|
-
toJSON:
|
|
1525
|
-
...
|
|
1523
|
+
getMeta: f,
|
|
1524
|
+
toJSON: l,
|
|
1525
|
+
...h
|
|
1526
1526
|
} = e, m = {};
|
|
1527
|
-
for (const
|
|
1528
|
-
const _ = i[
|
|
1529
|
-
m[
|
|
1527
|
+
for (const T in i) {
|
|
1528
|
+
const _ = i[T];
|
|
1529
|
+
m[T] = {
|
|
1530
1530
|
snapshot: _.getPersistedSnapshot(t),
|
|
1531
1531
|
src: _.src,
|
|
1532
1532
|
systemId: _._systemId,
|
|
@@ -1534,7 +1534,7 @@ function vs(e, t) {
|
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
1536
1536
|
return {
|
|
1537
|
-
...
|
|
1537
|
+
...h,
|
|
1538
1538
|
context: rn(o),
|
|
1539
1539
|
children: m
|
|
1540
1540
|
};
|
|
@@ -1560,7 +1560,7 @@ function rn(e) {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
return t ?? e;
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function vs(e, t, n, s, {
|
|
1564
1564
|
event: r,
|
|
1565
1565
|
id: i,
|
|
1566
1566
|
delay: o
|
|
@@ -1571,16 +1571,16 @@ function Ts(e, t, n, s, {
|
|
|
1571
1571
|
if (typeof r == "string")
|
|
1572
1572
|
throw new Error(`Only event objects may be used with raise; use raise({ type: "${r}" }) instead`);
|
|
1573
1573
|
const u = typeof r == "function" ? r(n, s) : r;
|
|
1574
|
-
let
|
|
1574
|
+
let f;
|
|
1575
1575
|
if (typeof o == "string") {
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1576
|
+
const l = c && c[o];
|
|
1577
|
+
f = typeof l == "function" ? l(n, s) : l;
|
|
1578
1578
|
} else
|
|
1579
|
-
|
|
1580
|
-
return typeof
|
|
1579
|
+
f = typeof o == "function" ? o(n, s) : o;
|
|
1580
|
+
return typeof f != "number" && a.push(u), [t, {
|
|
1581
1581
|
event: u,
|
|
1582
1582
|
id: i,
|
|
1583
|
-
delay:
|
|
1583
|
+
delay: f
|
|
1584
1584
|
}];
|
|
1585
1585
|
}
|
|
1586
1586
|
function Ss(e, t) {
|
|
@@ -1600,7 +1600,7 @@ function Ss(e, t) {
|
|
|
1600
1600
|
function _s(e, t) {
|
|
1601
1601
|
function n(s, r) {
|
|
1602
1602
|
}
|
|
1603
|
-
return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve =
|
|
1603
|
+
return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve = vs, n.execute = Ss, n;
|
|
1604
1604
|
}
|
|
1605
1605
|
const At = /* @__PURE__ */ new WeakMap();
|
|
1606
1606
|
function Is(e) {
|
|
@@ -1724,10 +1724,10 @@ function As(e, {
|
|
|
1724
1724
|
input: u
|
|
1725
1725
|
} = a;
|
|
1726
1726
|
if (typeof o == "string") {
|
|
1727
|
-
const
|
|
1728
|
-
if (!
|
|
1727
|
+
const f = nt(t, o);
|
|
1728
|
+
if (!f)
|
|
1729
1729
|
throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
|
|
1730
|
-
const
|
|
1730
|
+
const l = j(f, {
|
|
1731
1731
|
id: a.id,
|
|
1732
1732
|
parent: e.self,
|
|
1733
1733
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1739,7 +1739,7 @@ function As(e, {
|
|
|
1739
1739
|
src: o,
|
|
1740
1740
|
systemId: c
|
|
1741
1741
|
});
|
|
1742
|
-
return r[
|
|
1742
|
+
return r[l.id] = l, l;
|
|
1743
1743
|
} else
|
|
1744
1744
|
return j(o, {
|
|
1745
1745
|
id: a.id,
|
|
@@ -1774,8 +1774,8 @@ function ws(e, t, n, s, {
|
|
|
1774
1774
|
a = r(o, s);
|
|
1775
1775
|
else
|
|
1776
1776
|
for (const u of Object.keys(r)) {
|
|
1777
|
-
const
|
|
1778
|
-
a[u] = typeof
|
|
1777
|
+
const f = r[u];
|
|
1778
|
+
a[u] = typeof f == "function" ? f(o, s) : f;
|
|
1779
1779
|
}
|
|
1780
1780
|
const c = Object.assign({}, t.context, a);
|
|
1781
1781
|
return [Y(t, {
|
|
@@ -1804,7 +1804,7 @@ function bs(e, {
|
|
|
1804
1804
|
}) {
|
|
1805
1805
|
e.defer(() => e.emit(t));
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function ve(e) {
|
|
1808
1808
|
function t(n, s) {
|
|
1809
1809
|
}
|
|
1810
1810
|
return t.type = "xstate.emit", t.event = e, t.resolve = xs, t.execute = bs, t;
|
|
@@ -1822,28 +1822,28 @@ function Cs(e, t, n, s, {
|
|
|
1822
1822
|
const u = t.machine.implementations.delays;
|
|
1823
1823
|
if (typeof i == "string")
|
|
1824
1824
|
throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);
|
|
1825
|
-
const
|
|
1826
|
-
let
|
|
1825
|
+
const f = typeof i == "function" ? i(n, s) : i;
|
|
1826
|
+
let l;
|
|
1827
1827
|
if (typeof a == "string") {
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1828
|
+
const T = u && u[a];
|
|
1829
|
+
l = typeof T == "function" ? T(n, s) : T;
|
|
1830
1830
|
} else
|
|
1831
|
-
|
|
1832
|
-
const
|
|
1831
|
+
l = typeof a == "function" ? a(n, s) : a;
|
|
1832
|
+
const h = typeof r == "function" ? r(n, s) : r;
|
|
1833
1833
|
let m;
|
|
1834
|
-
if (typeof
|
|
1835
|
-
if (
|
|
1836
|
-
throw new Error(`Unable to send event to actor '${
|
|
1834
|
+
if (typeof h == "string") {
|
|
1835
|
+
if (h === bt.Parent ? m = e.self._parent : h === bt.Internal ? m = e.self : h.startsWith("#_") ? m = t.children[h.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(h) ? h : t.children[h], !m)
|
|
1836
|
+
throw new Error(`Unable to send event to actor '${h}' from machine '${t.machine.id}'.`);
|
|
1837
1837
|
} else
|
|
1838
|
-
m =
|
|
1838
|
+
m = h || e.self;
|
|
1839
1839
|
return [t, {
|
|
1840
1840
|
to: m,
|
|
1841
|
-
event:
|
|
1841
|
+
event: f,
|
|
1842
1842
|
id: o,
|
|
1843
|
-
delay:
|
|
1843
|
+
delay: l
|
|
1844
1844
|
}];
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1846
|
+
function ks(e, t, n) {
|
|
1847
1847
|
typeof n.to == "string" && (n.to = t.children[n.to]);
|
|
1848
1848
|
}
|
|
1849
1849
|
function Ns(e, t) {
|
|
@@ -1863,23 +1863,23 @@ function Ns(e, t) {
|
|
|
1863
1863
|
// at this point, in a deferred task, it should already be mutated by retryResolveSendTo
|
|
1864
1864
|
// if it initially started as a string
|
|
1865
1865
|
n,
|
|
1866
|
-
s.type ===
|
|
1866
|
+
s.type === On ? $t(e.self.id, s.data) : s
|
|
1867
1867
|
);
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
1870
1870
|
function Ct(e, t, n) {
|
|
1871
1871
|
function s(r, i) {
|
|
1872
1872
|
}
|
|
1873
|
-
return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = Cs, s.retryResolve =
|
|
1873
|
+
return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = Cs, s.retryResolve = ks, s.execute = Ns, s;
|
|
1874
1874
|
}
|
|
1875
|
-
const
|
|
1875
|
+
const kt = /* @__PURE__ */ new WeakMap();
|
|
1876
1876
|
function X(e, t, n) {
|
|
1877
|
-
let s =
|
|
1877
|
+
let s = kt.get(e);
|
|
1878
1878
|
return s ? t in s || (s[t] = n()) : (s = {
|
|
1879
1879
|
[t]: n()
|
|
1880
|
-
},
|
|
1880
|
+
}, kt.set(e, s)), s[t];
|
|
1881
1881
|
}
|
|
1882
|
-
const
|
|
1882
|
+
const Os = {}, oe = (e) => typeof e == "string" ? {
|
|
1883
1883
|
type: e
|
|
1884
1884
|
} : typeof e == "function" ? "resolve" in e ? {
|
|
1885
1885
|
type: e.type
|
|
@@ -1892,7 +1892,7 @@ class ut {
|
|
|
1892
1892
|
_parent: this,
|
|
1893
1893
|
_key: r,
|
|
1894
1894
|
_machine: this.machine
|
|
1895
|
-
})) :
|
|
1895
|
+
})) : Os, this.type === "compound" && !this.config.initial)
|
|
1896
1896
|
throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
|
|
1897
1897
|
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = B(this.config.entry).slice(), this.exit = B(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = B(t.tags).slice();
|
|
1898
1898
|
}
|
|
@@ -1953,7 +1953,7 @@ class ut {
|
|
|
1953
1953
|
const {
|
|
1954
1954
|
src: s,
|
|
1955
1955
|
systemId: r
|
|
1956
|
-
} = t, i = t.id ??
|
|
1956
|
+
} = t, i = t.id ?? Tt(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${Tt(this.id, n)}`;
|
|
1957
1957
|
return {
|
|
1958
1958
|
...t,
|
|
1959
1959
|
src: o,
|
|
@@ -1996,15 +1996,15 @@ class ut {
|
|
|
1996
1996
|
const {
|
|
1997
1997
|
guard: c
|
|
1998
1998
|
} = a, u = t.context;
|
|
1999
|
-
let
|
|
1999
|
+
let f = !1;
|
|
2000
2000
|
try {
|
|
2001
|
-
|
|
2002
|
-
} catch (
|
|
2003
|
-
const
|
|
2004
|
-
throw new Error(`Unable to evaluate guard ${
|
|
2005
|
-
${
|
|
2001
|
+
f = !c || rt(c, u, n, t);
|
|
2002
|
+
} catch (l) {
|
|
2003
|
+
const h = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
|
|
2004
|
+
throw new Error(`Unable to evaluate guard ${h ? `'${h}' ` : ""}in transition for event '${s}' in state node '${this.id}':
|
|
2005
|
+
${l.message}`);
|
|
2006
2006
|
}
|
|
2007
|
-
if (
|
|
2007
|
+
if (f) {
|
|
2008
2008
|
r.push(...a.actions), i = a;
|
|
2009
2009
|
break;
|
|
2010
2010
|
}
|
|
@@ -2088,8 +2088,8 @@ class dt {
|
|
|
2088
2088
|
});
|
|
2089
2089
|
}
|
|
2090
2090
|
resolveState(t) {
|
|
2091
|
-
const n = hs(this.root, t.value), s =
|
|
2092
|
-
return
|
|
2091
|
+
const n = hs(this.root, t.value), s = Ae(xe(this.root, n));
|
|
2092
|
+
return Te({
|
|
2093
2093
|
_nodes: [...s],
|
|
2094
2094
|
context: t.context || {},
|
|
2095
2095
|
children: {},
|
|
@@ -2107,7 +2107,7 @@ class dt {
|
|
|
2107
2107
|
* @param event The received event
|
|
2108
2108
|
*/
|
|
2109
2109
|
transition(t, n, s) {
|
|
2110
|
-
return
|
|
2110
|
+
return Fe(t, n, s).snapshot;
|
|
2111
2111
|
}
|
|
2112
2112
|
/**
|
|
2113
2113
|
* Determines the next state given the current `state` and `event`.
|
|
@@ -2117,7 +2117,7 @@ class dt {
|
|
|
2117
2117
|
* @param event The received event
|
|
2118
2118
|
*/
|
|
2119
2119
|
microstep(t, n, s) {
|
|
2120
|
-
return
|
|
2120
|
+
return Fe(t, n, s).microstates;
|
|
2121
2121
|
}
|
|
2122
2122
|
getTransitionData(t, n) {
|
|
2123
2123
|
return at(this.root, t.value, t, n) || [];
|
|
@@ -2129,7 +2129,7 @@ class dt {
|
|
|
2129
2129
|
getPreInitialState(t, n, s) {
|
|
2130
2130
|
const {
|
|
2131
2131
|
context: r
|
|
2132
|
-
} = this.config, i =
|
|
2132
|
+
} = this.config, i = Te({
|
|
2133
2133
|
context: typeof r != "function" && r ? r : {},
|
|
2134
2134
|
_nodes: [this.root],
|
|
2135
2135
|
children: {},
|
|
@@ -2159,7 +2159,7 @@ class dt {
|
|
|
2159
2159
|
// TODO: fix
|
|
2160
2160
|
}], i, t, s, !0, r), {
|
|
2161
2161
|
snapshot: a
|
|
2162
|
-
} =
|
|
2162
|
+
} = Fe(o, s, t, r);
|
|
2163
2163
|
return a;
|
|
2164
2164
|
}
|
|
2165
2165
|
start(t) {
|
|
@@ -2168,10 +2168,10 @@ class dt {
|
|
|
2168
2168
|
});
|
|
2169
2169
|
}
|
|
2170
2170
|
getStateNodeById(t) {
|
|
2171
|
-
const n = tt(t), s = n.slice(1), r =
|
|
2171
|
+
const n = tt(t), s = n.slice(1), r = Re(n[0]) ? n[0].slice(Ds.length) : n[0], i = this.idMap.get(r);
|
|
2172
2172
|
if (!i)
|
|
2173
2173
|
throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
|
|
2174
|
-
return
|
|
2174
|
+
return we(i, s);
|
|
2175
2175
|
}
|
|
2176
2176
|
get definition() {
|
|
2177
2177
|
return this.root.definition;
|
|
@@ -2180,41 +2180,41 @@ class dt {
|
|
|
2180
2180
|
return this.definition;
|
|
2181
2181
|
}
|
|
2182
2182
|
getPersistedSnapshot(t, n) {
|
|
2183
|
-
return
|
|
2183
|
+
return Ts(t, n);
|
|
2184
2184
|
}
|
|
2185
2185
|
restoreSnapshot(t, n) {
|
|
2186
2186
|
const s = {}, r = t.children;
|
|
2187
2187
|
Object.keys(r).forEach((c) => {
|
|
2188
|
-
const u = r[c],
|
|
2189
|
-
if (!
|
|
2188
|
+
const u = r[c], f = u.snapshot, l = u.src, h = typeof l == "string" ? nt(this, l) : l;
|
|
2189
|
+
if (!h)
|
|
2190
2190
|
return;
|
|
2191
|
-
const m = j(
|
|
2191
|
+
const m = j(h, {
|
|
2192
2192
|
id: c,
|
|
2193
2193
|
parent: n.self,
|
|
2194
2194
|
syncSnapshot: u.syncSnapshot,
|
|
2195
|
-
snapshot:
|
|
2196
|
-
src:
|
|
2195
|
+
snapshot: f,
|
|
2196
|
+
src: l,
|
|
2197
2197
|
systemId: u.systemId
|
|
2198
2198
|
});
|
|
2199
2199
|
s[c] = m;
|
|
2200
2200
|
});
|
|
2201
|
-
const i =
|
|
2201
|
+
const i = Te({
|
|
2202
2202
|
...t,
|
|
2203
2203
|
children: s,
|
|
2204
|
-
_nodes: Array.from(
|
|
2204
|
+
_nodes: Array.from(Ae(xe(this.root, t.value)))
|
|
2205
2205
|
}, this);
|
|
2206
2206
|
let o = /* @__PURE__ */ new Set();
|
|
2207
2207
|
function a(c, u) {
|
|
2208
2208
|
if (!o.has(c)) {
|
|
2209
2209
|
o.add(c);
|
|
2210
|
-
for (let
|
|
2211
|
-
const
|
|
2212
|
-
if (
|
|
2213
|
-
if ("xstate$$type" in
|
|
2214
|
-
c[
|
|
2210
|
+
for (let f in c) {
|
|
2211
|
+
const l = c[f];
|
|
2212
|
+
if (l && typeof l == "object") {
|
|
2213
|
+
if ("xstate$$type" in l && l.xstate$$type === st) {
|
|
2214
|
+
c[f] = u[l.id];
|
|
2215
2215
|
continue;
|
|
2216
2216
|
}
|
|
2217
|
-
a(
|
|
2217
|
+
a(l, u);
|
|
2218
2218
|
}
|
|
2219
2219
|
}
|
|
2220
2220
|
}
|
|
@@ -2268,6 +2268,17 @@ function Ms() {
|
|
|
2268
2268
|
};
|
|
2269
2269
|
}
|
|
2270
2270
|
function Ls({
|
|
2271
|
+
event: e
|
|
2272
|
+
}) {
|
|
2273
|
+
if (!e.type.includes("xstate.done.actor"))
|
|
2274
|
+
return { type: "EMIT_AUTHENTICATED", accessToken: "" };
|
|
2275
|
+
const t = e;
|
|
2276
|
+
return t.output.type !== "REFRESH_TOKEN_SUCCESS" ? { type: "EMIT_AUTHENTICATED", accessToken: "" } : {
|
|
2277
|
+
type: "EMIT_AUTHENTICATED",
|
|
2278
|
+
accessToken: t.output.accessToken
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
function Us({
|
|
2271
2282
|
context: e,
|
|
2272
2283
|
event: t
|
|
2273
2284
|
}) {
|
|
@@ -2279,12 +2290,12 @@ function Ls({
|
|
|
2279
2290
|
ignoreRefreshToken: !1
|
|
2280
2291
|
};
|
|
2281
2292
|
}
|
|
2282
|
-
function
|
|
2293
|
+
function Ps() {
|
|
2283
2294
|
return {
|
|
2284
2295
|
ignoreRefreshToken: !0
|
|
2285
2296
|
};
|
|
2286
2297
|
}
|
|
2287
|
-
function
|
|
2298
|
+
function Fs({
|
|
2288
2299
|
context: e,
|
|
2289
2300
|
event: t
|
|
2290
2301
|
}) {
|
|
@@ -2296,12 +2307,12 @@ function Ps({
|
|
|
2296
2307
|
ignoreRefreshToken: !1
|
|
2297
2308
|
};
|
|
2298
2309
|
}
|
|
2299
|
-
function
|
|
2310
|
+
function Bs() {
|
|
2300
2311
|
return {
|
|
2301
2312
|
refreshToken: ""
|
|
2302
2313
|
};
|
|
2303
2314
|
}
|
|
2304
|
-
function
|
|
2315
|
+
function js() {
|
|
2305
2316
|
return {
|
|
2306
2317
|
user: null,
|
|
2307
2318
|
accessToken: "",
|
|
@@ -2316,7 +2327,7 @@ async function Xe(e, t) {
|
|
|
2316
2327
|
success: !1
|
|
2317
2328
|
});
|
|
2318
2329
|
}
|
|
2319
|
-
const
|
|
2330
|
+
const $s = $(async ({ input: e }) => {
|
|
2320
2331
|
var t;
|
|
2321
2332
|
if (!e.endpoint.client || e.endpoint.client === "")
|
|
2322
2333
|
throw console.log("refreshAccessToken: No client endpoint provided."), new Error("No client endpoint provided.");
|
|
@@ -2347,13 +2358,13 @@ const js = $(async ({ input: e }) => {
|
|
|
2347
2358
|
} catch (n) {
|
|
2348
2359
|
throw console.log(n), new Error("Could not complete authenticate request (server)");
|
|
2349
2360
|
}
|
|
2350
|
-
}),
|
|
2361
|
+
}), Vs = typeof window > "u", Hs = $(async ({ input: e }) => {
|
|
2351
2362
|
if (!e.endpoint.client || e.endpoint.client === "")
|
|
2352
2363
|
throw console.log("refreshAccessToken: No client endpoint provided."), new Error("No client endpoint provided.");
|
|
2353
2364
|
if (!e.endpoint.server || e.endpoint.server === "")
|
|
2354
2365
|
throw console.log("refreshAccessToken: No server endpoint provided."), new Error("No server endpoint provided.");
|
|
2355
2366
|
let t;
|
|
2356
|
-
if (
|
|
2367
|
+
if (Vs) {
|
|
2357
2368
|
if (e.refreshToken === "")
|
|
2358
2369
|
throw new Error("Unauthorized.");
|
|
2359
2370
|
try {
|
|
@@ -2400,7 +2411,7 @@ const js = $(async ({ input: e }) => {
|
|
|
2400
2411
|
accessToken: t.accessToken
|
|
2401
2412
|
};
|
|
2402
2413
|
}
|
|
2403
|
-
}),
|
|
2414
|
+
}), zs = $(async ({ input: e }) => {
|
|
2404
2415
|
if (!e.endpoint.client || e.endpoint.client === "")
|
|
2405
2416
|
throw console.log("unauthenticate: No client endpoint provided."), new Error("No client endpoint provided.");
|
|
2406
2417
|
try {
|
|
@@ -2420,49 +2431,52 @@ const js = $(async ({ input: e }) => {
|
|
|
2420
2431
|
} catch (t) {
|
|
2421
2432
|
throw console.log(t), new Error("Could not complete unauthenticate request (server)");
|
|
2422
2433
|
}
|
|
2423
|
-
}),
|
|
2434
|
+
}), Gs = he({
|
|
2424
2435
|
types: {
|
|
2425
2436
|
context: {},
|
|
2437
|
+
emitted: {},
|
|
2426
2438
|
events: {},
|
|
2427
2439
|
input: {}
|
|
2428
2440
|
},
|
|
2429
2441
|
actions: {
|
|
2430
2442
|
addError: x(qs),
|
|
2431
2443
|
clearErrors: x(Ms),
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2444
|
+
notifyAuthenticated: ve(Ls),
|
|
2445
|
+
setAccessToken: x(Us),
|
|
2446
|
+
setIgnoreRefreshToken: x(Ps),
|
|
2447
|
+
setUserContext: x(Fs),
|
|
2448
|
+
unsetRefreshToken: x(Bs),
|
|
2449
|
+
unsetUserContext: x(js)
|
|
2437
2450
|
},
|
|
2438
2451
|
actors: {
|
|
2439
|
-
authenticate:
|
|
2440
|
-
refreshAccessToken:
|
|
2441
|
-
unauthenticate:
|
|
2452
|
+
authenticate: $s,
|
|
2453
|
+
refreshAccessToken: Hs,
|
|
2454
|
+
unauthenticate: zs
|
|
2455
|
+
},
|
|
2456
|
+
delays: {
|
|
2457
|
+
refresh: 84e4
|
|
2442
2458
|
}
|
|
2443
2459
|
}).createMachine({
|
|
2444
2460
|
id: "auth",
|
|
2445
|
-
context: ({ input: e }) => {
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
};
|
|
2465
|
-
},
|
|
2461
|
+
context: ({ input: e }) => ({
|
|
2462
|
+
user: null,
|
|
2463
|
+
accessToken: "",
|
|
2464
|
+
refreshToken: "",
|
|
2465
|
+
// will only be on the request from the server side for initial check, does not get passed to the client
|
|
2466
|
+
/**
|
|
2467
|
+
* If unauthenticating fails, we need a way to ignore the refresh token on subsequent access token refresh.
|
|
2468
|
+
* This would be set to true done/error of unauthenticate service, and false on done of authenticate service
|
|
2469
|
+
*/
|
|
2470
|
+
ignoreRefreshToken: !1,
|
|
2471
|
+
endpoints: {
|
|
2472
|
+
login: "",
|
|
2473
|
+
logout: "",
|
|
2474
|
+
refresh: "",
|
|
2475
|
+
ssrRefresh: ""
|
|
2476
|
+
},
|
|
2477
|
+
errors: [],
|
|
2478
|
+
...e == null ? void 0 : e.initialContext
|
|
2479
|
+
}),
|
|
2466
2480
|
initial: "refreshing",
|
|
2467
2481
|
states: {
|
|
2468
2482
|
authenticating: {
|
|
@@ -2477,7 +2491,7 @@ const js = $(async ({ input: e }) => {
|
|
|
2477
2491
|
}),
|
|
2478
2492
|
onDone: [
|
|
2479
2493
|
{
|
|
2480
|
-
actions: "setUserContext",
|
|
2494
|
+
actions: ["setUserContext"],
|
|
2481
2495
|
target: "loggedIn"
|
|
2482
2496
|
}
|
|
2483
2497
|
],
|
|
@@ -2524,8 +2538,22 @@ const js = $(async ({ input: e }) => {
|
|
|
2524
2538
|
}),
|
|
2525
2539
|
onDone: [
|
|
2526
2540
|
{
|
|
2527
|
-
actions: [
|
|
2541
|
+
actions: [
|
|
2542
|
+
"unsetRefreshToken",
|
|
2543
|
+
"setAccessToken",
|
|
2544
|
+
"notifyAuthenticated"
|
|
2545
|
+
],
|
|
2546
|
+
guard: () => typeof window < "u",
|
|
2528
2547
|
target: "loggedIn"
|
|
2548
|
+
},
|
|
2549
|
+
/**
|
|
2550
|
+
* We must transition to transient loggedInReady state from server-side refresh
|
|
2551
|
+
* so the frontend can send RESTORE event. Otherwise actions and timers from
|
|
2552
|
+
* loggedIn state won't fire properly from client (known issue in xstate)
|
|
2553
|
+
*/
|
|
2554
|
+
{
|
|
2555
|
+
actions: ["unsetRefreshToken", "setAccessToken"],
|
|
2556
|
+
target: "loggedInReady"
|
|
2529
2557
|
}
|
|
2530
2558
|
],
|
|
2531
2559
|
/**
|
|
@@ -2559,10 +2587,24 @@ const js = $(async ({ input: e }) => {
|
|
|
2559
2587
|
}
|
|
2560
2588
|
}
|
|
2561
2589
|
},
|
|
2590
|
+
/**
|
|
2591
|
+
* loggedInReady transient state is a workaround to restoring the snapshot on client side,
|
|
2592
|
+
* since actions won't run (they are assumed to have run already) and timers are stopped (they
|
|
2593
|
+
* have no clock mechanism to determine at what point to restart)
|
|
2594
|
+
*/
|
|
2595
|
+
loggedInReady: {
|
|
2596
|
+
on: {
|
|
2597
|
+
RESTORE: {
|
|
2598
|
+
guard: () => typeof window < "u",
|
|
2599
|
+
target: "loggedIn"
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
},
|
|
2562
2603
|
loggedIn: {
|
|
2563
2604
|
after: {
|
|
2564
2605
|
// 14min (840000ms), jwt access token expires in 15min
|
|
2565
|
-
|
|
2606
|
+
// 840000: {
|
|
2607
|
+
refresh: {
|
|
2566
2608
|
guard: () => typeof window < "u",
|
|
2567
2609
|
target: "refreshing"
|
|
2568
2610
|
}
|
|
@@ -2590,26 +2632,32 @@ const js = $(async ({ input: e }) => {
|
|
|
2590
2632
|
// },
|
|
2591
2633
|
// },
|
|
2592
2634
|
}
|
|
2593
|
-
}), on =
|
|
2635
|
+
}), on = ke(
|
|
2594
2636
|
{}
|
|
2595
|
-
),
|
|
2596
|
-
const e =
|
|
2597
|
-
|
|
2637
|
+
), Si = () => {
|
|
2638
|
+
const e = Ne(on), [t, n] = Oe(
|
|
2639
|
+
["loggedIn", "loggedInReady"].includes(e.getSnapshot().value)
|
|
2598
2640
|
);
|
|
2599
|
-
return
|
|
2600
|
-
if (typeof window > "u")
|
|
2601
|
-
return;
|
|
2641
|
+
return De(() => {
|
|
2602
2642
|
const s = e.subscribe((r) => {
|
|
2603
|
-
(r.value
|
|
2643
|
+
switch (r.value) {
|
|
2644
|
+
case "loggedIn":
|
|
2645
|
+
case "loggedInReady":
|
|
2646
|
+
n(!0);
|
|
2647
|
+
break;
|
|
2648
|
+
case "loggedOut":
|
|
2649
|
+
n(!1);
|
|
2650
|
+
break;
|
|
2651
|
+
}
|
|
2604
2652
|
});
|
|
2605
2653
|
return () => {
|
|
2606
2654
|
s.unsubscribe();
|
|
2607
2655
|
};
|
|
2608
2656
|
}, [e]), { authActor: e, isLoggedIn: t };
|
|
2609
|
-
},
|
|
2657
|
+
}, _i = async (e = "", t = {
|
|
2610
2658
|
inspect: void 0,
|
|
2611
2659
|
endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
|
|
2612
|
-
}) => j(
|
|
2660
|
+
}) => j(Gs, {
|
|
2613
2661
|
input: {
|
|
2614
2662
|
initialContext: {
|
|
2615
2663
|
endpoints: t.endpoints,
|
|
@@ -2618,10 +2666,10 @@ const js = $(async ({ input: e }) => {
|
|
|
2618
2666
|
},
|
|
2619
2667
|
inspect: t.inspect
|
|
2620
2668
|
}).start();
|
|
2621
|
-
function
|
|
2622
|
-
return /* @__PURE__ */
|
|
2669
|
+
function Ii({ actor: e, children: t }) {
|
|
2670
|
+
return /* @__PURE__ */ Ce(on.Provider, { value: e, children: t });
|
|
2623
2671
|
}
|
|
2624
|
-
function
|
|
2672
|
+
function Js({
|
|
2625
2673
|
context: e,
|
|
2626
2674
|
event: t
|
|
2627
2675
|
}) {
|
|
@@ -2632,7 +2680,7 @@ function Gs({
|
|
|
2632
2680
|
currentStep: s.code ?? e.currentStep
|
|
2633
2681
|
};
|
|
2634
2682
|
}
|
|
2635
|
-
function
|
|
2683
|
+
function Ys({
|
|
2636
2684
|
context: e,
|
|
2637
2685
|
event: t
|
|
2638
2686
|
}) {
|
|
@@ -2646,7 +2694,7 @@ function Js({
|
|
|
2646
2694
|
currentStep: s ?? e.currentStep
|
|
2647
2695
|
} : e;
|
|
2648
2696
|
}
|
|
2649
|
-
function
|
|
2697
|
+
function Qs({
|
|
2650
2698
|
context: e,
|
|
2651
2699
|
event: t
|
|
2652
2700
|
}) {
|
|
@@ -2658,7 +2706,7 @@ function Ys({
|
|
|
2658
2706
|
quote: t.data.quote
|
|
2659
2707
|
};
|
|
2660
2708
|
}
|
|
2661
|
-
function
|
|
2709
|
+
function Xs({
|
|
2662
2710
|
context: e,
|
|
2663
2711
|
event: t
|
|
2664
2712
|
}) {
|
|
@@ -2669,7 +2717,7 @@ function Qs({
|
|
|
2669
2717
|
quote: { ...e.quote, ...n.output.quote }
|
|
2670
2718
|
};
|
|
2671
2719
|
}
|
|
2672
|
-
function
|
|
2720
|
+
function Ws({
|
|
2673
2721
|
context: e,
|
|
2674
2722
|
event: t
|
|
2675
2723
|
}) {
|
|
@@ -2680,26 +2728,26 @@ function Xs({
|
|
|
2680
2728
|
successId: n.output.successId
|
|
2681
2729
|
};
|
|
2682
2730
|
}
|
|
2683
|
-
const lt = JSON,
|
|
2731
|
+
const lt = JSON, Ks = (e) => e.toUpperCase(), Zs = (e) => {
|
|
2684
2732
|
const t = {};
|
|
2685
2733
|
return e.forEach((n, s) => {
|
|
2686
2734
|
t[s] = n;
|
|
2687
2735
|
}), t;
|
|
2688
|
-
},
|
|
2736
|
+
}, er = (e, t, n) => e.document ? e : {
|
|
2689
2737
|
document: e,
|
|
2690
2738
|
variables: t,
|
|
2691
2739
|
requestHeaders: n,
|
|
2692
2740
|
signal: void 0
|
|
2693
|
-
},
|
|
2741
|
+
}, tr = (e, t, n) => e.query ? e : {
|
|
2694
2742
|
query: e,
|
|
2695
2743
|
variables: t,
|
|
2696
2744
|
requestHeaders: n,
|
|
2697
2745
|
signal: void 0
|
|
2698
|
-
},
|
|
2746
|
+
}, nr = (e, t) => e.documents ? e : {
|
|
2699
2747
|
documents: e,
|
|
2700
2748
|
requestHeaders: t,
|
|
2701
2749
|
signal: void 0
|
|
2702
|
-
},
|
|
2750
|
+
}, sr = (e, t, ...n) => {
|
|
2703
2751
|
const [s, r] = n;
|
|
2704
2752
|
return e.document ? e : {
|
|
2705
2753
|
url: e,
|
|
@@ -2709,24 +2757,24 @@ const lt = JSON, Ws = (e) => e.toUpperCase(), Ks = (e) => {
|
|
|
2709
2757
|
signal: void 0
|
|
2710
2758
|
};
|
|
2711
2759
|
};
|
|
2712
|
-
function
|
|
2760
|
+
function Se(e, t) {
|
|
2713
2761
|
if (!!!e)
|
|
2714
2762
|
throw new Error(t);
|
|
2715
2763
|
}
|
|
2716
|
-
function
|
|
2764
|
+
function rr(e) {
|
|
2717
2765
|
return typeof e == "object" && e !== null;
|
|
2718
2766
|
}
|
|
2719
|
-
function
|
|
2767
|
+
function ir(e, t) {
|
|
2720
2768
|
if (!!!e)
|
|
2721
2769
|
throw new Error(
|
|
2722
2770
|
t ?? "Unexpected invariant triggered."
|
|
2723
2771
|
);
|
|
2724
2772
|
}
|
|
2725
|
-
const
|
|
2773
|
+
const or = /\r\n|[\n\r]/g;
|
|
2726
2774
|
function We(e, t) {
|
|
2727
2775
|
let n = 0, s = 1;
|
|
2728
|
-
for (const r of e.body.matchAll(
|
|
2729
|
-
if (typeof r.index == "number" ||
|
|
2776
|
+
for (const r of e.body.matchAll(or)) {
|
|
2777
|
+
if (typeof r.index == "number" || ir(!1), r.index >= t)
|
|
2730
2778
|
break;
|
|
2731
2779
|
n = r.index + r[0].length, s += 1;
|
|
2732
2780
|
}
|
|
@@ -2735,7 +2783,7 @@ function We(e, t) {
|
|
|
2735
2783
|
column: t + 1 - n
|
|
2736
2784
|
};
|
|
2737
2785
|
}
|
|
2738
|
-
function
|
|
2786
|
+
function ar(e) {
|
|
2739
2787
|
return an(
|
|
2740
2788
|
e.source,
|
|
2741
2789
|
We(e.source, e.start)
|
|
@@ -2743,24 +2791,24 @@ function or(e) {
|
|
|
2743
2791
|
}
|
|
2744
2792
|
function an(e, t) {
|
|
2745
2793
|
const n = e.locationOffset.column - 1, s = "".padStart(n) + e.body, r = t.line - 1, i = e.locationOffset.line - 1, o = t.line + i, a = t.line === 1 ? n : 0, c = t.column + a, u = `${e.name}:${o}:${c}
|
|
2746
|
-
`,
|
|
2747
|
-
if (
|
|
2748
|
-
const
|
|
2749
|
-
for (let
|
|
2750
|
-
y.push(
|
|
2794
|
+
`, f = s.split(/\r\n|[\n\r]/g), l = f[r];
|
|
2795
|
+
if (l.length > 120) {
|
|
2796
|
+
const h = Math.floor(c / 80), m = c % 80, y = [];
|
|
2797
|
+
for (let T = 0; T < l.length; T += 80)
|
|
2798
|
+
y.push(l.slice(T, T + 80));
|
|
2751
2799
|
return u + Nt([
|
|
2752
2800
|
[`${o} |`, y[0]],
|
|
2753
|
-
...y.slice(1,
|
|
2801
|
+
...y.slice(1, h + 1).map((T) => ["|", T]),
|
|
2754
2802
|
["|", "^".padStart(m)],
|
|
2755
|
-
["|", y[
|
|
2803
|
+
["|", y[h + 1]]
|
|
2756
2804
|
]);
|
|
2757
2805
|
}
|
|
2758
2806
|
return u + Nt([
|
|
2759
2807
|
// Lines specified like this: ["prefix", "string"],
|
|
2760
|
-
[`${o - 1} |`,
|
|
2761
|
-
[`${o} |`,
|
|
2808
|
+
[`${o - 1} |`, f[r - 1]],
|
|
2809
|
+
[`${o} |`, l],
|
|
2762
2810
|
["|", "^".padStart(c)],
|
|
2763
|
-
[`${o + 1} |`,
|
|
2811
|
+
[`${o + 1} |`, f[r + 1]]
|
|
2764
2812
|
]);
|
|
2765
2813
|
}
|
|
2766
2814
|
function Nt(e) {
|
|
@@ -2768,7 +2816,7 @@ function Nt(e) {
|
|
|
2768
2816
|
return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
|
|
2769
2817
|
`);
|
|
2770
2818
|
}
|
|
2771
|
-
function
|
|
2819
|
+
function cr(e) {
|
|
2772
2820
|
const t = e[0];
|
|
2773
2821
|
return t == null || "kind" in t || "length" in t ? {
|
|
2774
2822
|
nodes: t,
|
|
@@ -2820,18 +2868,18 @@ class ht extends Error {
|
|
|
2820
2868
|
*/
|
|
2821
2869
|
constructor(t, ...n) {
|
|
2822
2870
|
var s, r, i;
|
|
2823
|
-
const { nodes: o, source: a, positions: c, path: u, originalError:
|
|
2824
|
-
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError =
|
|
2871
|
+
const { nodes: o, source: a, positions: c, path: u, originalError: f, extensions: l } = cr(n);
|
|
2872
|
+
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = f ?? void 0, this.nodes = Ot(
|
|
2825
2873
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
2826
2874
|
);
|
|
2827
|
-
const
|
|
2875
|
+
const h = Ot(
|
|
2828
2876
|
(s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
|
|
2829
2877
|
);
|
|
2830
|
-
this.source = a ?? (
|
|
2831
|
-
const m =
|
|
2832
|
-
|
|
2833
|
-
) ?
|
|
2834
|
-
this.extensions = (i =
|
|
2878
|
+
this.source = a ?? (h == null || (r = h[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (h == null ? void 0 : h.map((y) => y.start)), this.locations = c && a ? c.map((y) => We(a, y)) : h == null ? void 0 : h.map((y) => We(y.source, y.start));
|
|
2879
|
+
const m = rr(
|
|
2880
|
+
f == null ? void 0 : f.extensions
|
|
2881
|
+
) ? f == null ? void 0 : f.extensions : void 0;
|
|
2882
|
+
this.extensions = (i = l ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
2835
2883
|
message: {
|
|
2836
2884
|
writable: !0,
|
|
2837
2885
|
enumerable: !0
|
|
@@ -2851,8 +2899,8 @@ class ht extends Error {
|
|
|
2851
2899
|
originalError: {
|
|
2852
2900
|
enumerable: !1
|
|
2853
2901
|
}
|
|
2854
|
-
}),
|
|
2855
|
-
value:
|
|
2902
|
+
}), f != null && f.stack ? Object.defineProperty(this, "stack", {
|
|
2903
|
+
value: f.stack,
|
|
2856
2904
|
writable: !0,
|
|
2857
2905
|
configurable: !0
|
|
2858
2906
|
}) : Error.captureStackTrace ? Error.captureStackTrace(this, ht) : Object.defineProperty(this, "stack", {
|
|
@@ -2870,7 +2918,7 @@ class ht extends Error {
|
|
|
2870
2918
|
for (const n of this.nodes)
|
|
2871
2919
|
n.loc && (t += `
|
|
2872
2920
|
|
|
2873
|
-
` +
|
|
2921
|
+
` + ar(n.loc));
|
|
2874
2922
|
else if (this.source && this.locations)
|
|
2875
2923
|
for (const n of this.locations)
|
|
2876
2924
|
t += `
|
|
@@ -2885,7 +2933,7 @@ class ht extends Error {
|
|
|
2885
2933
|
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;
|
|
2886
2934
|
}
|
|
2887
2935
|
}
|
|
2888
|
-
function
|
|
2936
|
+
function Ot(e) {
|
|
2889
2937
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
2890
2938
|
}
|
|
2891
2939
|
function C(e, t, n) {
|
|
@@ -2894,7 +2942,7 @@ function C(e, t, n) {
|
|
|
2894
2942
|
positions: [t]
|
|
2895
2943
|
});
|
|
2896
2944
|
}
|
|
2897
|
-
class
|
|
2945
|
+
class ur {
|
|
2898
2946
|
/**
|
|
2899
2947
|
* The character offset at which this Node begins.
|
|
2900
2948
|
*/
|
|
@@ -3039,10 +3087,10 @@ const un = {
|
|
|
3039
3087
|
UnionTypeExtension: ["name", "directives", "types"],
|
|
3040
3088
|
EnumTypeExtension: ["name", "directives", "values"],
|
|
3041
3089
|
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
3042
|
-
},
|
|
3090
|
+
}, dr = new Set(Object.keys(un));
|
|
3043
3091
|
function Dt(e) {
|
|
3044
3092
|
const t = e == null ? void 0 : e.kind;
|
|
3045
|
-
return typeof t == "string" &&
|
|
3093
|
+
return typeof t == "string" && dr.has(t);
|
|
3046
3094
|
}
|
|
3047
3095
|
var ee;
|
|
3048
3096
|
(function(e) {
|
|
@@ -3052,10 +3100,10 @@ var Ke;
|
|
|
3052
3100
|
(function(e) {
|
|
3053
3101
|
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";
|
|
3054
3102
|
})(Ke || (Ke = {}));
|
|
3055
|
-
var
|
|
3103
|
+
var v;
|
|
3056
3104
|
(function(e) {
|
|
3057
3105
|
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";
|
|
3058
|
-
})(
|
|
3106
|
+
})(v || (v = {}));
|
|
3059
3107
|
function Ze(e) {
|
|
3060
3108
|
return e === 9 || e === 32;
|
|
3061
3109
|
}
|
|
@@ -3069,15 +3117,15 @@ function dn(e) {
|
|
|
3069
3117
|
function ln(e) {
|
|
3070
3118
|
return dn(e) || e === 95;
|
|
3071
3119
|
}
|
|
3072
|
-
function
|
|
3120
|
+
function lr(e) {
|
|
3073
3121
|
return dn(e) || de(e) || e === 95;
|
|
3074
3122
|
}
|
|
3075
|
-
function
|
|
3123
|
+
function hr(e) {
|
|
3076
3124
|
var t;
|
|
3077
3125
|
let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
|
|
3078
3126
|
for (let o = 0; o < e.length; ++o) {
|
|
3079
3127
|
var i;
|
|
3080
|
-
const a = e[o], c =
|
|
3128
|
+
const a = e[o], c = fr(a);
|
|
3081
3129
|
c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
|
|
3082
3130
|
}
|
|
3083
3131
|
return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
|
|
@@ -3085,26 +3133,26 @@ function lr(e) {
|
|
|
3085
3133
|
r + 1
|
|
3086
3134
|
);
|
|
3087
3135
|
}
|
|
3088
|
-
function
|
|
3136
|
+
function fr(e) {
|
|
3089
3137
|
let t = 0;
|
|
3090
3138
|
for (; t < e.length && Ze(e.charCodeAt(t)); )
|
|
3091
3139
|
++t;
|
|
3092
3140
|
return t;
|
|
3093
3141
|
}
|
|
3094
|
-
function
|
|
3095
|
-
const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 || Ze(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c,
|
|
3142
|
+
function pr(e, t) {
|
|
3143
|
+
const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 || Ze(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c, f = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
|
|
3096
3144
|
(!r || e.length > 70 || u || i || o);
|
|
3097
|
-
let
|
|
3098
|
-
const
|
|
3099
|
-
return (
|
|
3100
|
-
`),
|
|
3101
|
-
`), '"""' +
|
|
3145
|
+
let l = "";
|
|
3146
|
+
const h = r && Ze(e.charCodeAt(0));
|
|
3147
|
+
return (f && !h || i) && (l += `
|
|
3148
|
+
`), l += n, (f || u) && (l += `
|
|
3149
|
+
`), '"""' + l + '"""';
|
|
3102
3150
|
}
|
|
3103
3151
|
var p;
|
|
3104
3152
|
(function(e) {
|
|
3105
3153
|
e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
|
|
3106
3154
|
})(p || (p = {}));
|
|
3107
|
-
class
|
|
3155
|
+
class yr {
|
|
3108
3156
|
/**
|
|
3109
3157
|
* The previously focused non-ignored token.
|
|
3110
3158
|
*/
|
|
@@ -3141,20 +3189,20 @@ class pr {
|
|
|
3141
3189
|
if (t.next)
|
|
3142
3190
|
t = t.next;
|
|
3143
3191
|
else {
|
|
3144
|
-
const n =
|
|
3192
|
+
const n = gr(this, t.end);
|
|
3145
3193
|
t.next = n, n.prev = t, t = n;
|
|
3146
3194
|
}
|
|
3147
3195
|
while (t.kind === p.COMMENT);
|
|
3148
3196
|
return t;
|
|
3149
3197
|
}
|
|
3150
3198
|
}
|
|
3151
|
-
function
|
|
3199
|
+
function mr(e) {
|
|
3152
3200
|
return e === p.BANG || e === p.DOLLAR || e === p.AMP || e === p.PAREN_L || e === p.PAREN_R || e === p.SPREAD || e === p.COLON || e === p.EQUALS || e === p.AT || e === p.BRACKET_L || e === p.BRACKET_R || e === p.BRACE_L || e === p.PIPE || e === p.BRACE_R;
|
|
3153
3201
|
}
|
|
3154
3202
|
function re(e) {
|
|
3155
3203
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
3156
3204
|
}
|
|
3157
|
-
function
|
|
3205
|
+
function qe(e, t) {
|
|
3158
3206
|
return hn(e.charCodeAt(t)) && fn(e.charCodeAt(t + 1));
|
|
3159
3207
|
}
|
|
3160
3208
|
function hn(e) {
|
|
@@ -3177,7 +3225,7 @@ function b(e, t, n, s, r) {
|
|
|
3177
3225
|
const i = e.line, o = 1 + n - e.lineStart;
|
|
3178
3226
|
return new cn(t, n, s, i, o, r);
|
|
3179
3227
|
}
|
|
3180
|
-
function
|
|
3228
|
+
function gr(e, t) {
|
|
3181
3229
|
const n = e.source.body, s = n.length;
|
|
3182
3230
|
let r = t;
|
|
3183
3231
|
for (; r < s; ) {
|
|
@@ -3196,7 +3244,7 @@ function mr(e, t) {
|
|
|
3196
3244
|
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
|
|
3197
3245
|
continue;
|
|
3198
3246
|
case 35:
|
|
3199
|
-
return
|
|
3247
|
+
return Er(e, r);
|
|
3200
3248
|
case 33:
|
|
3201
3249
|
return b(e, p.BANG, r, r + 1);
|
|
3202
3250
|
case 36:
|
|
@@ -3228,21 +3276,21 @@ function mr(e, t) {
|
|
|
3228
3276
|
case 125:
|
|
3229
3277
|
return b(e, p.BRACE_R, r, r + 1);
|
|
3230
3278
|
case 34:
|
|
3231
|
-
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ?
|
|
3279
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Ar(e, r) : vr(e, r);
|
|
3232
3280
|
}
|
|
3233
3281
|
if (de(i) || i === 45)
|
|
3234
|
-
return
|
|
3282
|
+
return Tr(e, r, i);
|
|
3235
3283
|
if (ln(i))
|
|
3236
|
-
return
|
|
3284
|
+
return wr(e, r);
|
|
3237
3285
|
throw C(
|
|
3238
3286
|
e.source,
|
|
3239
3287
|
r,
|
|
3240
|
-
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) ||
|
|
3288
|
+
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || qe(n, r) ? `Unexpected character: ${Q(e, r)}.` : `Invalid character: ${Q(e, r)}.`
|
|
3241
3289
|
);
|
|
3242
3290
|
}
|
|
3243
3291
|
return b(e, p.EOF, s, s);
|
|
3244
3292
|
}
|
|
3245
|
-
function
|
|
3293
|
+
function Er(e, t) {
|
|
3246
3294
|
const n = e.source.body, s = n.length;
|
|
3247
3295
|
let r = t + 1;
|
|
3248
3296
|
for (; r < s; ) {
|
|
@@ -3251,7 +3299,7 @@ function gr(e, t) {
|
|
|
3251
3299
|
break;
|
|
3252
3300
|
if (re(i))
|
|
3253
3301
|
++r;
|
|
3254
|
-
else if (
|
|
3302
|
+
else if (qe(n, r))
|
|
3255
3303
|
r += 2;
|
|
3256
3304
|
else
|
|
3257
3305
|
break;
|
|
@@ -3264,7 +3312,7 @@ function gr(e, t) {
|
|
|
3264
3312
|
n.slice(t + 1, r)
|
|
3265
3313
|
);
|
|
3266
3314
|
}
|
|
3267
|
-
function
|
|
3315
|
+
function Tr(e, t, n) {
|
|
3268
3316
|
const s = e.source.body;
|
|
3269
3317
|
let r = t, i = n, o = !1;
|
|
3270
3318
|
if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
|
|
@@ -3321,7 +3369,7 @@ function vr(e, t) {
|
|
|
3321
3369
|
return o += n.slice(i, r), b(e, p.STRING, t, r + 1, o);
|
|
3322
3370
|
if (a === 92) {
|
|
3323
3371
|
o += n.slice(i, r);
|
|
3324
|
-
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ?
|
|
3372
|
+
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Sr(e, r) : _r(e, r) : Ir(e, r);
|
|
3325
3373
|
o += c.value, r += c.size, i = r;
|
|
3326
3374
|
continue;
|
|
3327
3375
|
}
|
|
@@ -3329,7 +3377,7 @@ function vr(e, t) {
|
|
|
3329
3377
|
break;
|
|
3330
3378
|
if (re(a))
|
|
3331
3379
|
++r;
|
|
3332
|
-
else if (
|
|
3380
|
+
else if (qe(n, r))
|
|
3333
3381
|
r += 2;
|
|
3334
3382
|
else
|
|
3335
3383
|
throw C(
|
|
@@ -3343,7 +3391,7 @@ function vr(e, t) {
|
|
|
3343
3391
|
}
|
|
3344
3392
|
throw C(e.source, r, "Unterminated string.");
|
|
3345
3393
|
}
|
|
3346
|
-
function
|
|
3394
|
+
function Sr(e, t) {
|
|
3347
3395
|
const n = e.source.body;
|
|
3348
3396
|
let s = 0, r = 3;
|
|
3349
3397
|
for (; r < 12; ) {
|
|
@@ -3368,7 +3416,7 @@ function Tr(e, t) {
|
|
|
3368
3416
|
)}".`
|
|
3369
3417
|
);
|
|
3370
3418
|
}
|
|
3371
|
-
function
|
|
3419
|
+
function _r(e, t) {
|
|
3372
3420
|
const n = e.source.body, s = Rt(n, t + 2);
|
|
3373
3421
|
if (re(s))
|
|
3374
3422
|
return {
|
|
@@ -3395,7 +3443,7 @@ function Rt(e, t) {
|
|
|
3395
3443
|
function ae(e) {
|
|
3396
3444
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
3397
3445
|
}
|
|
3398
|
-
function
|
|
3446
|
+
function Ir(e, t) {
|
|
3399
3447
|
const n = e.source.body;
|
|
3400
3448
|
switch (n.charCodeAt(t + 1)) {
|
|
3401
3449
|
case 34:
|
|
@@ -3449,7 +3497,7 @@ function _r(e, t) {
|
|
|
3449
3497
|
)}".`
|
|
3450
3498
|
);
|
|
3451
3499
|
}
|
|
3452
|
-
function
|
|
3500
|
+
function Ar(e, t) {
|
|
3453
3501
|
const n = e.source.body, s = n.length;
|
|
3454
3502
|
let r = e.lineStart, i = t + 3, o = i, a = "";
|
|
3455
3503
|
const c = [];
|
|
@@ -3457,16 +3505,16 @@ function Ir(e, t) {
|
|
|
3457
3505
|
const u = n.charCodeAt(i);
|
|
3458
3506
|
if (u === 34 && n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34) {
|
|
3459
3507
|
a += n.slice(o, i), c.push(a);
|
|
3460
|
-
const
|
|
3508
|
+
const f = b(
|
|
3461
3509
|
e,
|
|
3462
3510
|
p.BLOCK_STRING,
|
|
3463
3511
|
t,
|
|
3464
3512
|
i + 3,
|
|
3465
3513
|
// Return a string of the lines joined with U+000A.
|
|
3466
|
-
|
|
3514
|
+
hr(c).join(`
|
|
3467
3515
|
`)
|
|
3468
3516
|
);
|
|
3469
|
-
return e.line += c.length - 1, e.lineStart = r,
|
|
3517
|
+
return e.line += c.length - 1, e.lineStart = r, f;
|
|
3470
3518
|
}
|
|
3471
3519
|
if (u === 92 && n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 && n.charCodeAt(i + 3) === 34) {
|
|
3472
3520
|
a += n.slice(o, i), o = i + 1, i += 4;
|
|
@@ -3478,7 +3526,7 @@ function Ir(e, t) {
|
|
|
3478
3526
|
}
|
|
3479
3527
|
if (re(u))
|
|
3480
3528
|
++i;
|
|
3481
|
-
else if (
|
|
3529
|
+
else if (qe(n, i))
|
|
3482
3530
|
i += 2;
|
|
3483
3531
|
else
|
|
3484
3532
|
throw C(
|
|
@@ -3492,12 +3540,12 @@ function Ir(e, t) {
|
|
|
3492
3540
|
}
|
|
3493
3541
|
throw C(e.source, i, "Unterminated string.");
|
|
3494
3542
|
}
|
|
3495
|
-
function
|
|
3543
|
+
function wr(e, t) {
|
|
3496
3544
|
const n = e.source.body, s = n.length;
|
|
3497
3545
|
let r = t + 1;
|
|
3498
3546
|
for (; r < s; ) {
|
|
3499
3547
|
const i = n.charCodeAt(r);
|
|
3500
|
-
if (
|
|
3548
|
+
if (lr(i))
|
|
3501
3549
|
++r;
|
|
3502
3550
|
else
|
|
3503
3551
|
break;
|
|
@@ -3510,56 +3558,56 @@ function Ar(e, t) {
|
|
|
3510
3558
|
n.slice(t, r)
|
|
3511
3559
|
);
|
|
3512
3560
|
}
|
|
3513
|
-
const
|
|
3561
|
+
const xr = 10, pn = 2;
|
|
3514
3562
|
function ft(e) {
|
|
3515
|
-
return
|
|
3563
|
+
return Me(e, []);
|
|
3516
3564
|
}
|
|
3517
|
-
function
|
|
3565
|
+
function Me(e, t) {
|
|
3518
3566
|
switch (typeof e) {
|
|
3519
3567
|
case "string":
|
|
3520
3568
|
return JSON.stringify(e);
|
|
3521
3569
|
case "function":
|
|
3522
3570
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
3523
3571
|
case "object":
|
|
3524
|
-
return
|
|
3572
|
+
return br(e, t);
|
|
3525
3573
|
default:
|
|
3526
3574
|
return String(e);
|
|
3527
3575
|
}
|
|
3528
3576
|
}
|
|
3529
|
-
function
|
|
3577
|
+
function br(e, t) {
|
|
3530
3578
|
if (e === null)
|
|
3531
3579
|
return "null";
|
|
3532
3580
|
if (t.includes(e))
|
|
3533
3581
|
return "[Circular]";
|
|
3534
3582
|
const n = [...t, e];
|
|
3535
|
-
if (
|
|
3583
|
+
if (Cr(e)) {
|
|
3536
3584
|
const s = e.toJSON();
|
|
3537
3585
|
if (s !== e)
|
|
3538
|
-
return typeof s == "string" ? s :
|
|
3586
|
+
return typeof s == "string" ? s : Me(s, n);
|
|
3539
3587
|
} else if (Array.isArray(e))
|
|
3540
|
-
return
|
|
3541
|
-
return
|
|
3588
|
+
return Nr(e, n);
|
|
3589
|
+
return kr(e, n);
|
|
3542
3590
|
}
|
|
3543
|
-
function
|
|
3591
|
+
function Cr(e) {
|
|
3544
3592
|
return typeof e.toJSON == "function";
|
|
3545
3593
|
}
|
|
3546
|
-
function
|
|
3594
|
+
function kr(e, t) {
|
|
3547
3595
|
const n = Object.entries(e);
|
|
3548
|
-
return n.length === 0 ? "{}" : t.length > pn ? "[" +
|
|
3549
|
-
([r, i]) => r + ": " +
|
|
3596
|
+
return n.length === 0 ? "{}" : t.length > pn ? "[" + Or(e) + "]" : "{ " + n.map(
|
|
3597
|
+
([r, i]) => r + ": " + Me(i, t)
|
|
3550
3598
|
).join(", ") + " }";
|
|
3551
3599
|
}
|
|
3552
|
-
function
|
|
3600
|
+
function Nr(e, t) {
|
|
3553
3601
|
if (e.length === 0)
|
|
3554
3602
|
return "[]";
|
|
3555
3603
|
if (t.length > pn)
|
|
3556
3604
|
return "[Array]";
|
|
3557
|
-
const n = Math.min(
|
|
3605
|
+
const n = Math.min(xr, e.length), s = e.length - n, r = [];
|
|
3558
3606
|
for (let i = 0; i < n; ++i)
|
|
3559
|
-
r.push(
|
|
3607
|
+
r.push(Me(e[i], t));
|
|
3560
3608
|
return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
|
|
3561
3609
|
}
|
|
3562
|
-
function
|
|
3610
|
+
function Or(e) {
|
|
3563
3611
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
3564
3612
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
3565
3613
|
const n = e.constructor.name;
|
|
@@ -3568,11 +3616,11 @@ function Nr(e) {
|
|
|
3568
3616
|
}
|
|
3569
3617
|
return t;
|
|
3570
3618
|
}
|
|
3571
|
-
const
|
|
3572
|
-
process.env.NODE_ENV === "production",
|
|
3619
|
+
const Dr = globalThis.process && // eslint-disable-next-line no-undef
|
|
3620
|
+
process.env.NODE_ENV === "production", Rr = (
|
|
3573
3621
|
/* c8 ignore next 6 */
|
|
3574
3622
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
3575
|
-
|
|
3623
|
+
Dr ? function(t, n) {
|
|
3576
3624
|
return t instanceof n;
|
|
3577
3625
|
} : function(t, n) {
|
|
3578
3626
|
if (t instanceof n)
|
|
@@ -3607,10 +3655,10 @@ class yn {
|
|
|
3607
3655
|
line: 1,
|
|
3608
3656
|
column: 1
|
|
3609
3657
|
}) {
|
|
3610
|
-
typeof t == "string" ||
|
|
3658
|
+
typeof t == "string" || Se(!1, `Body must be a string. Received: ${ft(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || Se(
|
|
3611
3659
|
!1,
|
|
3612
3660
|
"line in locationOffset is 1-indexed and must be positive."
|
|
3613
|
-
), this.locationOffset.column > 0 ||
|
|
3661
|
+
), this.locationOffset.column > 0 || Se(
|
|
3614
3662
|
!1,
|
|
3615
3663
|
"column in locationOffset is 1-indexed and must be positive."
|
|
3616
3664
|
);
|
|
@@ -3619,16 +3667,16 @@ class yn {
|
|
|
3619
3667
|
return "Source";
|
|
3620
3668
|
}
|
|
3621
3669
|
}
|
|
3622
|
-
function
|
|
3623
|
-
return
|
|
3670
|
+
function qr(e) {
|
|
3671
|
+
return Rr(e, yn);
|
|
3624
3672
|
}
|
|
3625
|
-
function
|
|
3626
|
-
return new
|
|
3673
|
+
function Mr(e, t) {
|
|
3674
|
+
return new Lr(e, t).parseDocument();
|
|
3627
3675
|
}
|
|
3628
|
-
class
|
|
3676
|
+
class Lr {
|
|
3629
3677
|
constructor(t, n = {}) {
|
|
3630
|
-
const s =
|
|
3631
|
-
this._lexer = new
|
|
3678
|
+
const s = qr(t) ? t : new yn(t);
|
|
3679
|
+
this._lexer = new yr(s), this._options = n, this._tokenCounter = 0;
|
|
3632
3680
|
}
|
|
3633
3681
|
/**
|
|
3634
3682
|
* Converts a name lex token into a name parse node.
|
|
@@ -3636,7 +3684,7 @@ class Mr {
|
|
|
3636
3684
|
parseName() {
|
|
3637
3685
|
const t = this.expectToken(p.NAME);
|
|
3638
3686
|
return this.node(t, {
|
|
3639
|
-
kind:
|
|
3687
|
+
kind: v.NAME,
|
|
3640
3688
|
value: t.value
|
|
3641
3689
|
});
|
|
3642
3690
|
}
|
|
@@ -3646,7 +3694,7 @@ class Mr {
|
|
|
3646
3694
|
*/
|
|
3647
3695
|
parseDocument() {
|
|
3648
3696
|
return this.node(this._lexer.token, {
|
|
3649
|
-
kind:
|
|
3697
|
+
kind: v.DOCUMENT,
|
|
3650
3698
|
definitions: this.many(
|
|
3651
3699
|
p.SOF,
|
|
3652
3700
|
this.parseDefinition,
|
|
@@ -3729,7 +3777,7 @@ class Mr {
|
|
|
3729
3777
|
const t = this._lexer.token;
|
|
3730
3778
|
if (this.peek(p.BRACE_L))
|
|
3731
3779
|
return this.node(t, {
|
|
3732
|
-
kind:
|
|
3780
|
+
kind: v.OPERATION_DEFINITION,
|
|
3733
3781
|
operation: ee.QUERY,
|
|
3734
3782
|
name: void 0,
|
|
3735
3783
|
variableDefinitions: [],
|
|
@@ -3739,7 +3787,7 @@ class Mr {
|
|
|
3739
3787
|
const n = this.parseOperationType();
|
|
3740
3788
|
let s;
|
|
3741
3789
|
return this.peek(p.NAME) && (s = this.parseName()), this.node(t, {
|
|
3742
|
-
kind:
|
|
3790
|
+
kind: v.OPERATION_DEFINITION,
|
|
3743
3791
|
operation: n,
|
|
3744
3792
|
name: s,
|
|
3745
3793
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
@@ -3777,7 +3825,7 @@ class Mr {
|
|
|
3777
3825
|
*/
|
|
3778
3826
|
parseVariableDefinition() {
|
|
3779
3827
|
return this.node(this._lexer.token, {
|
|
3780
|
-
kind:
|
|
3828
|
+
kind: v.VARIABLE_DEFINITION,
|
|
3781
3829
|
variable: this.parseVariable(),
|
|
3782
3830
|
type: (this.expectToken(p.COLON), this.parseTypeReference()),
|
|
3783
3831
|
defaultValue: this.expectOptionalToken(p.EQUALS) ? this.parseConstValueLiteral() : void 0,
|
|
@@ -3790,7 +3838,7 @@ class Mr {
|
|
|
3790
3838
|
parseVariable() {
|
|
3791
3839
|
const t = this._lexer.token;
|
|
3792
3840
|
return this.expectToken(p.DOLLAR), this.node(t, {
|
|
3793
|
-
kind:
|
|
3841
|
+
kind: v.VARIABLE,
|
|
3794
3842
|
name: this.parseName()
|
|
3795
3843
|
});
|
|
3796
3844
|
}
|
|
@@ -3801,7 +3849,7 @@ class Mr {
|
|
|
3801
3849
|
*/
|
|
3802
3850
|
parseSelectionSet() {
|
|
3803
3851
|
return this.node(this._lexer.token, {
|
|
3804
|
-
kind:
|
|
3852
|
+
kind: v.SELECTION_SET,
|
|
3805
3853
|
selections: this.many(
|
|
3806
3854
|
p.BRACE_L,
|
|
3807
3855
|
this.parseSelection,
|
|
@@ -3827,7 +3875,7 @@ class Mr {
|
|
|
3827
3875
|
const t = this._lexer.token, n = this.parseName();
|
|
3828
3876
|
let s, r;
|
|
3829
3877
|
return this.expectOptionalToken(p.COLON) ? (s = n, r = this.parseName()) : r = n, this.node(t, {
|
|
3830
|
-
kind:
|
|
3878
|
+
kind: v.FIELD,
|
|
3831
3879
|
alias: s,
|
|
3832
3880
|
name: r,
|
|
3833
3881
|
arguments: this.parseArguments(!1),
|
|
@@ -3848,7 +3896,7 @@ class Mr {
|
|
|
3848
3896
|
parseArgument(t = !1) {
|
|
3849
3897
|
const n = this._lexer.token, s = this.parseName();
|
|
3850
3898
|
return this.expectToken(p.COLON), this.node(n, {
|
|
3851
|
-
kind:
|
|
3899
|
+
kind: v.ARGUMENT,
|
|
3852
3900
|
name: s,
|
|
3853
3901
|
value: this.parseValueLiteral(t)
|
|
3854
3902
|
});
|
|
@@ -3869,11 +3917,11 @@ class Mr {
|
|
|
3869
3917
|
this.expectToken(p.SPREAD);
|
|
3870
3918
|
const n = this.expectOptionalKeyword("on");
|
|
3871
3919
|
return !n && this.peek(p.NAME) ? this.node(t, {
|
|
3872
|
-
kind:
|
|
3920
|
+
kind: v.FRAGMENT_SPREAD,
|
|
3873
3921
|
name: this.parseFragmentName(),
|
|
3874
3922
|
directives: this.parseDirectives(!1)
|
|
3875
3923
|
}) : this.node(t, {
|
|
3876
|
-
kind:
|
|
3924
|
+
kind: v.INLINE_FRAGMENT,
|
|
3877
3925
|
typeCondition: n ? this.parseNamedType() : void 0,
|
|
3878
3926
|
directives: this.parseDirectives(!1),
|
|
3879
3927
|
selectionSet: this.parseSelectionSet()
|
|
@@ -3888,14 +3936,14 @@ class Mr {
|
|
|
3888
3936
|
parseFragmentDefinition() {
|
|
3889
3937
|
const t = this._lexer.token;
|
|
3890
3938
|
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(t, {
|
|
3891
|
-
kind:
|
|
3939
|
+
kind: v.FRAGMENT_DEFINITION,
|
|
3892
3940
|
name: this.parseFragmentName(),
|
|
3893
3941
|
variableDefinitions: this.parseVariableDefinitions(),
|
|
3894
3942
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
3895
3943
|
directives: this.parseDirectives(!1),
|
|
3896
3944
|
selectionSet: this.parseSelectionSet()
|
|
3897
3945
|
}) : this.node(t, {
|
|
3898
|
-
kind:
|
|
3946
|
+
kind: v.FRAGMENT_DEFINITION,
|
|
3899
3947
|
name: this.parseFragmentName(),
|
|
3900
3948
|
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
3901
3949
|
directives: this.parseDirectives(!1),
|
|
@@ -3938,12 +3986,12 @@ class Mr {
|
|
|
3938
3986
|
return this.parseObject(t);
|
|
3939
3987
|
case p.INT:
|
|
3940
3988
|
return this.advanceLexer(), this.node(n, {
|
|
3941
|
-
kind:
|
|
3989
|
+
kind: v.INT,
|
|
3942
3990
|
value: n.value
|
|
3943
3991
|
});
|
|
3944
3992
|
case p.FLOAT:
|
|
3945
3993
|
return this.advanceLexer(), this.node(n, {
|
|
3946
|
-
kind:
|
|
3994
|
+
kind: v.FLOAT,
|
|
3947
3995
|
value: n.value
|
|
3948
3996
|
});
|
|
3949
3997
|
case p.STRING:
|
|
@@ -3953,21 +4001,21 @@ class Mr {
|
|
|
3953
4001
|
switch (this.advanceLexer(), n.value) {
|
|
3954
4002
|
case "true":
|
|
3955
4003
|
return this.node(n, {
|
|
3956
|
-
kind:
|
|
4004
|
+
kind: v.BOOLEAN,
|
|
3957
4005
|
value: !0
|
|
3958
4006
|
});
|
|
3959
4007
|
case "false":
|
|
3960
4008
|
return this.node(n, {
|
|
3961
|
-
kind:
|
|
4009
|
+
kind: v.BOOLEAN,
|
|
3962
4010
|
value: !1
|
|
3963
4011
|
});
|
|
3964
4012
|
case "null":
|
|
3965
4013
|
return this.node(n, {
|
|
3966
|
-
kind:
|
|
4014
|
+
kind: v.NULL
|
|
3967
4015
|
});
|
|
3968
4016
|
default:
|
|
3969
4017
|
return this.node(n, {
|
|
3970
|
-
kind:
|
|
4018
|
+
kind: v.ENUM,
|
|
3971
4019
|
value: n.value
|
|
3972
4020
|
});
|
|
3973
4021
|
}
|
|
@@ -3993,7 +4041,7 @@ class Mr {
|
|
|
3993
4041
|
parseStringLiteral() {
|
|
3994
4042
|
const t = this._lexer.token;
|
|
3995
4043
|
return this.advanceLexer(), this.node(t, {
|
|
3996
|
-
kind:
|
|
4044
|
+
kind: v.STRING,
|
|
3997
4045
|
value: t.value,
|
|
3998
4046
|
block: t.kind === p.BLOCK_STRING
|
|
3999
4047
|
});
|
|
@@ -4006,7 +4054,7 @@ class Mr {
|
|
|
4006
4054
|
parseList(t) {
|
|
4007
4055
|
const n = () => this.parseValueLiteral(t);
|
|
4008
4056
|
return this.node(this._lexer.token, {
|
|
4009
|
-
kind:
|
|
4057
|
+
kind: v.LIST,
|
|
4010
4058
|
values: this.any(p.BRACKET_L, n, p.BRACKET_R)
|
|
4011
4059
|
});
|
|
4012
4060
|
}
|
|
@@ -4020,7 +4068,7 @@ class Mr {
|
|
|
4020
4068
|
parseObject(t) {
|
|
4021
4069
|
const n = () => this.parseObjectField(t);
|
|
4022
4070
|
return this.node(this._lexer.token, {
|
|
4023
|
-
kind:
|
|
4071
|
+
kind: v.OBJECT,
|
|
4024
4072
|
fields: this.any(p.BRACE_L, n, p.BRACE_R)
|
|
4025
4073
|
});
|
|
4026
4074
|
}
|
|
@@ -4030,7 +4078,7 @@ class Mr {
|
|
|
4030
4078
|
parseObjectField(t) {
|
|
4031
4079
|
const n = this._lexer.token, s = this.parseName();
|
|
4032
4080
|
return this.expectToken(p.COLON), this.node(n, {
|
|
4033
|
-
kind:
|
|
4081
|
+
kind: v.OBJECT_FIELD,
|
|
4034
4082
|
name: s,
|
|
4035
4083
|
value: this.parseValueLiteral(t)
|
|
4036
4084
|
});
|
|
@@ -4056,7 +4104,7 @@ class Mr {
|
|
|
4056
4104
|
parseDirective(t) {
|
|
4057
4105
|
const n = this._lexer.token;
|
|
4058
4106
|
return this.expectToken(p.AT), this.node(n, {
|
|
4059
|
-
kind:
|
|
4107
|
+
kind: v.DIRECTIVE,
|
|
4060
4108
|
name: this.parseName(),
|
|
4061
4109
|
arguments: this.parseArguments(t)
|
|
4062
4110
|
});
|
|
@@ -4074,13 +4122,13 @@ class Mr {
|
|
|
4074
4122
|
if (this.expectOptionalToken(p.BRACKET_L)) {
|
|
4075
4123
|
const s = this.parseTypeReference();
|
|
4076
4124
|
this.expectToken(p.BRACKET_R), n = this.node(t, {
|
|
4077
|
-
kind:
|
|
4125
|
+
kind: v.LIST_TYPE,
|
|
4078
4126
|
type: s
|
|
4079
4127
|
});
|
|
4080
4128
|
} else
|
|
4081
4129
|
n = this.parseNamedType();
|
|
4082
4130
|
return this.expectOptionalToken(p.BANG) ? this.node(t, {
|
|
4083
|
-
kind:
|
|
4131
|
+
kind: v.NON_NULL_TYPE,
|
|
4084
4132
|
type: n
|
|
4085
4133
|
}) : n;
|
|
4086
4134
|
}
|
|
@@ -4089,7 +4137,7 @@ class Mr {
|
|
|
4089
4137
|
*/
|
|
4090
4138
|
parseNamedType() {
|
|
4091
4139
|
return this.node(this._lexer.token, {
|
|
4092
|
-
kind:
|
|
4140
|
+
kind: v.NAMED_TYPE,
|
|
4093
4141
|
name: this.parseName()
|
|
4094
4142
|
});
|
|
4095
4143
|
}
|
|
@@ -4118,7 +4166,7 @@ class Mr {
|
|
|
4118
4166
|
p.BRACE_R
|
|
4119
4167
|
);
|
|
4120
4168
|
return this.node(t, {
|
|
4121
|
-
kind:
|
|
4169
|
+
kind: v.SCHEMA_DEFINITION,
|
|
4122
4170
|
description: n,
|
|
4123
4171
|
directives: s,
|
|
4124
4172
|
operationTypes: r
|
|
@@ -4132,7 +4180,7 @@ class Mr {
|
|
|
4132
4180
|
this.expectToken(p.COLON);
|
|
4133
4181
|
const s = this.parseNamedType();
|
|
4134
4182
|
return this.node(t, {
|
|
4135
|
-
kind:
|
|
4183
|
+
kind: v.OPERATION_TYPE_DEFINITION,
|
|
4136
4184
|
operation: n,
|
|
4137
4185
|
type: s
|
|
4138
4186
|
});
|
|
@@ -4145,7 +4193,7 @@ class Mr {
|
|
|
4145
4193
|
this.expectKeyword("scalar");
|
|
4146
4194
|
const s = this.parseName(), r = this.parseConstDirectives();
|
|
4147
4195
|
return this.node(t, {
|
|
4148
|
-
kind:
|
|
4196
|
+
kind: v.SCALAR_TYPE_DEFINITION,
|
|
4149
4197
|
description: n,
|
|
4150
4198
|
name: s,
|
|
4151
4199
|
directives: r
|
|
@@ -4161,7 +4209,7 @@ class Mr {
|
|
|
4161
4209
|
this.expectKeyword("type");
|
|
4162
4210
|
const s = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
4163
4211
|
return this.node(t, {
|
|
4164
|
-
kind:
|
|
4212
|
+
kind: v.OBJECT_TYPE_DEFINITION,
|
|
4165
4213
|
description: n,
|
|
4166
4214
|
name: s,
|
|
4167
4215
|
interfaces: r,
|
|
@@ -4198,7 +4246,7 @@ class Mr {
|
|
|
4198
4246
|
this.expectToken(p.COLON);
|
|
4199
4247
|
const i = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
4200
4248
|
return this.node(t, {
|
|
4201
|
-
kind:
|
|
4249
|
+
kind: v.FIELD_DEFINITION,
|
|
4202
4250
|
description: n,
|
|
4203
4251
|
name: s,
|
|
4204
4252
|
arguments: r,
|
|
@@ -4228,7 +4276,7 @@ class Mr {
|
|
|
4228
4276
|
this.expectOptionalToken(p.EQUALS) && (i = this.parseConstValueLiteral());
|
|
4229
4277
|
const o = this.parseConstDirectives();
|
|
4230
4278
|
return this.node(t, {
|
|
4231
|
-
kind:
|
|
4279
|
+
kind: v.INPUT_VALUE_DEFINITION,
|
|
4232
4280
|
description: n,
|
|
4233
4281
|
name: s,
|
|
4234
4282
|
type: r,
|
|
@@ -4245,7 +4293,7 @@ class Mr {
|
|
|
4245
4293
|
this.expectKeyword("interface");
|
|
4246
4294
|
const s = this.parseName(), r = this.parseImplementsInterfaces(), i = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
4247
4295
|
return this.node(t, {
|
|
4248
|
-
kind:
|
|
4296
|
+
kind: v.INTERFACE_TYPE_DEFINITION,
|
|
4249
4297
|
description: n,
|
|
4250
4298
|
name: s,
|
|
4251
4299
|
interfaces: r,
|
|
@@ -4262,7 +4310,7 @@ class Mr {
|
|
|
4262
4310
|
this.expectKeyword("union");
|
|
4263
4311
|
const s = this.parseName(), r = this.parseConstDirectives(), i = this.parseUnionMemberTypes();
|
|
4264
4312
|
return this.node(t, {
|
|
4265
|
-
kind:
|
|
4313
|
+
kind: v.UNION_TYPE_DEFINITION,
|
|
4266
4314
|
description: n,
|
|
4267
4315
|
name: s,
|
|
4268
4316
|
directives: r,
|
|
@@ -4286,7 +4334,7 @@ class Mr {
|
|
|
4286
4334
|
this.expectKeyword("enum");
|
|
4287
4335
|
const s = this.parseName(), r = this.parseConstDirectives(), i = this.parseEnumValuesDefinition();
|
|
4288
4336
|
return this.node(t, {
|
|
4289
|
-
kind:
|
|
4337
|
+
kind: v.ENUM_TYPE_DEFINITION,
|
|
4290
4338
|
description: n,
|
|
4291
4339
|
name: s,
|
|
4292
4340
|
directives: r,
|
|
@@ -4311,7 +4359,7 @@ class Mr {
|
|
|
4311
4359
|
parseEnumValueDefinition() {
|
|
4312
4360
|
const t = this._lexer.token, n = this.parseDescription(), s = this.parseEnumValueName(), r = this.parseConstDirectives();
|
|
4313
4361
|
return this.node(t, {
|
|
4314
|
-
kind:
|
|
4362
|
+
kind: v.ENUM_VALUE_DEFINITION,
|
|
4315
4363
|
description: n,
|
|
4316
4364
|
name: s,
|
|
4317
4365
|
directives: r
|
|
@@ -4340,7 +4388,7 @@ class Mr {
|
|
|
4340
4388
|
this.expectKeyword("input");
|
|
4341
4389
|
const s = this.parseName(), r = this.parseConstDirectives(), i = this.parseInputFieldsDefinition();
|
|
4342
4390
|
return this.node(t, {
|
|
4343
|
-
kind:
|
|
4391
|
+
kind: v.INPUT_OBJECT_TYPE_DEFINITION,
|
|
4344
4392
|
description: n,
|
|
4345
4393
|
name: s,
|
|
4346
4394
|
directives: r,
|
|
@@ -4411,7 +4459,7 @@ class Mr {
|
|
|
4411
4459
|
if (n.length === 0 && s.length === 0)
|
|
4412
4460
|
throw this.unexpected();
|
|
4413
4461
|
return this.node(t, {
|
|
4414
|
-
kind:
|
|
4462
|
+
kind: v.SCHEMA_EXTENSION,
|
|
4415
4463
|
directives: n,
|
|
4416
4464
|
operationTypes: s
|
|
4417
4465
|
});
|
|
@@ -4427,7 +4475,7 @@ class Mr {
|
|
|
4427
4475
|
if (s.length === 0)
|
|
4428
4476
|
throw this.unexpected();
|
|
4429
4477
|
return this.node(t, {
|
|
4430
|
-
kind:
|
|
4478
|
+
kind: v.SCALAR_TYPE_EXTENSION,
|
|
4431
4479
|
name: n,
|
|
4432
4480
|
directives: s
|
|
4433
4481
|
});
|
|
@@ -4445,7 +4493,7 @@ class Mr {
|
|
|
4445
4493
|
if (s.length === 0 && r.length === 0 && i.length === 0)
|
|
4446
4494
|
throw this.unexpected();
|
|
4447
4495
|
return this.node(t, {
|
|
4448
|
-
kind:
|
|
4496
|
+
kind: v.OBJECT_TYPE_EXTENSION,
|
|
4449
4497
|
name: n,
|
|
4450
4498
|
interfaces: s,
|
|
4451
4499
|
directives: r,
|
|
@@ -4465,7 +4513,7 @@ class Mr {
|
|
|
4465
4513
|
if (s.length === 0 && r.length === 0 && i.length === 0)
|
|
4466
4514
|
throw this.unexpected();
|
|
4467
4515
|
return this.node(t, {
|
|
4468
|
-
kind:
|
|
4516
|
+
kind: v.INTERFACE_TYPE_EXTENSION,
|
|
4469
4517
|
name: n,
|
|
4470
4518
|
interfaces: s,
|
|
4471
4519
|
directives: r,
|
|
@@ -4484,7 +4532,7 @@ class Mr {
|
|
|
4484
4532
|
if (s.length === 0 && r.length === 0)
|
|
4485
4533
|
throw this.unexpected();
|
|
4486
4534
|
return this.node(t, {
|
|
4487
|
-
kind:
|
|
4535
|
+
kind: v.UNION_TYPE_EXTENSION,
|
|
4488
4536
|
name: n,
|
|
4489
4537
|
directives: s,
|
|
4490
4538
|
types: r
|
|
@@ -4502,7 +4550,7 @@ class Mr {
|
|
|
4502
4550
|
if (s.length === 0 && r.length === 0)
|
|
4503
4551
|
throw this.unexpected();
|
|
4504
4552
|
return this.node(t, {
|
|
4505
|
-
kind:
|
|
4553
|
+
kind: v.ENUM_TYPE_EXTENSION,
|
|
4506
4554
|
name: n,
|
|
4507
4555
|
directives: s,
|
|
4508
4556
|
values: r
|
|
@@ -4520,7 +4568,7 @@ class Mr {
|
|
|
4520
4568
|
if (s.length === 0 && r.length === 0)
|
|
4521
4569
|
throw this.unexpected();
|
|
4522
4570
|
return this.node(t, {
|
|
4523
|
-
kind:
|
|
4571
|
+
kind: v.INPUT_OBJECT_TYPE_EXTENSION,
|
|
4524
4572
|
name: n,
|
|
4525
4573
|
directives: s,
|
|
4526
4574
|
fields: r
|
|
@@ -4539,7 +4587,7 @@ class Mr {
|
|
|
4539
4587
|
this.expectKeyword("on");
|
|
4540
4588
|
const o = this.parseDirectiveLocations();
|
|
4541
4589
|
return this.node(t, {
|
|
4542
|
-
kind:
|
|
4590
|
+
kind: v.DIRECTIVE_DEFINITION,
|
|
4543
4591
|
description: n,
|
|
4544
4592
|
name: s,
|
|
4545
4593
|
arguments: r,
|
|
@@ -4595,7 +4643,7 @@ class Mr {
|
|
|
4595
4643
|
* given parsed object.
|
|
4596
4644
|
*/
|
|
4597
4645
|
node(t, n) {
|
|
4598
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
4646
|
+
return this._options.noLocation !== !0 && (n.loc = new ur(
|
|
4599
4647
|
t,
|
|
4600
4648
|
this._lexer.lastToken,
|
|
4601
4649
|
this._lexer.source
|
|
@@ -4731,16 +4779,16 @@ function Ee(e) {
|
|
|
4731
4779
|
return mn(e.kind) + (t != null ? ` "${t}"` : "");
|
|
4732
4780
|
}
|
|
4733
4781
|
function mn(e) {
|
|
4734
|
-
return
|
|
4782
|
+
return mr(e) ? `"${e}"` : e;
|
|
4735
4783
|
}
|
|
4736
|
-
function
|
|
4737
|
-
return `"${e.replace(
|
|
4784
|
+
function Ur(e) {
|
|
4785
|
+
return `"${e.replace(Pr, Fr)}"`;
|
|
4738
4786
|
}
|
|
4739
|
-
const
|
|
4740
|
-
function
|
|
4741
|
-
return
|
|
4787
|
+
const Pr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
4788
|
+
function Fr(e) {
|
|
4789
|
+
return Br[e.charCodeAt(0)];
|
|
4742
4790
|
}
|
|
4743
|
-
const
|
|
4791
|
+
const Br = [
|
|
4744
4792
|
"\\u0000",
|
|
4745
4793
|
"\\u0001",
|
|
4746
4794
|
"\\u0002",
|
|
@@ -4906,18 +4954,18 @@ const Fr = [
|
|
|
4906
4954
|
"\\u009D",
|
|
4907
4955
|
"\\u009E",
|
|
4908
4956
|
"\\u009F"
|
|
4909
|
-
],
|
|
4910
|
-
function
|
|
4957
|
+
], jr = Object.freeze({});
|
|
4958
|
+
function $r(e, t, n = un) {
|
|
4911
4959
|
const s = /* @__PURE__ */ new Map();
|
|
4912
|
-
for (const w of Object.values(
|
|
4913
|
-
s.set(w,
|
|
4914
|
-
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e,
|
|
4915
|
-
const
|
|
4960
|
+
for (const w of Object.values(v))
|
|
4961
|
+
s.set(w, Vr(t, w));
|
|
4962
|
+
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, f, l;
|
|
4963
|
+
const h = [], m = [];
|
|
4916
4964
|
do {
|
|
4917
4965
|
a++;
|
|
4918
4966
|
const w = a === o.length, R = w && c.length !== 0;
|
|
4919
4967
|
if (w) {
|
|
4920
|
-
if (
|
|
4968
|
+
if (f = m.length === 0 ? void 0 : h[h.length - 1], u = l, l = m.pop(), R)
|
|
4921
4969
|
if (i) {
|
|
4922
4970
|
u = u.slice();
|
|
4923
4971
|
let q = 0;
|
|
@@ -4934,33 +4982,33 @@ function jr(e, t, n = un) {
|
|
|
4934
4982
|
u[q] = P;
|
|
4935
4983
|
}
|
|
4936
4984
|
a = r.index, o = r.keys, c = r.edits, i = r.inArray, r = r.prev;
|
|
4937
|
-
} else if (
|
|
4938
|
-
if (
|
|
4985
|
+
} else if (l) {
|
|
4986
|
+
if (f = i ? a : o[a], u = l[f], u == null)
|
|
4939
4987
|
continue;
|
|
4940
|
-
|
|
4988
|
+
h.push(f);
|
|
4941
4989
|
}
|
|
4942
|
-
let
|
|
4990
|
+
let O;
|
|
4943
4991
|
if (!Array.isArray(u)) {
|
|
4944
|
-
var y,
|
|
4945
|
-
Dt(u) ||
|
|
4946
|
-
const q = w ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (
|
|
4947
|
-
if (
|
|
4992
|
+
var y, T;
|
|
4993
|
+
Dt(u) || Se(!1, `Invalid AST Node: ${ft(u)}.`);
|
|
4994
|
+
const q = w ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (T = s.get(u.kind)) === null || T === void 0 ? void 0 : T.enter;
|
|
4995
|
+
if (O = q == null ? void 0 : q.call(t, u, f, l, h, m), O === jr)
|
|
4948
4996
|
break;
|
|
4949
|
-
if (
|
|
4997
|
+
if (O === !1) {
|
|
4950
4998
|
if (!w) {
|
|
4951
|
-
|
|
4999
|
+
h.pop();
|
|
4952
5000
|
continue;
|
|
4953
5001
|
}
|
|
4954
|
-
} else if (
|
|
4955
|
-
if (Dt(
|
|
4956
|
-
u =
|
|
5002
|
+
} else if (O !== void 0 && (c.push([f, O]), !w))
|
|
5003
|
+
if (Dt(O))
|
|
5004
|
+
u = O;
|
|
4957
5005
|
else {
|
|
4958
|
-
|
|
5006
|
+
h.pop();
|
|
4959
5007
|
continue;
|
|
4960
5008
|
}
|
|
4961
5009
|
}
|
|
4962
|
-
if (
|
|
4963
|
-
|
|
5010
|
+
if (O === void 0 && R && c.push([f, u]), w)
|
|
5011
|
+
h.pop();
|
|
4964
5012
|
else {
|
|
4965
5013
|
var _;
|
|
4966
5014
|
r = {
|
|
@@ -4969,12 +5017,12 @@ function jr(e, t, n = un) {
|
|
|
4969
5017
|
keys: o,
|
|
4970
5018
|
edits: c,
|
|
4971
5019
|
prev: r
|
|
4972
|
-
}, i = Array.isArray(u), o = i ? u : (_ = n[u.kind]) !== null && _ !== void 0 ? _ : [], a = -1, c = [],
|
|
5020
|
+
}, i = Array.isArray(u), o = i ? u : (_ = n[u.kind]) !== null && _ !== void 0 ? _ : [], a = -1, c = [], l && m.push(l), l = u;
|
|
4973
5021
|
}
|
|
4974
5022
|
} while (r !== void 0);
|
|
4975
5023
|
return c.length !== 0 ? c[c.length - 1][1] : e;
|
|
4976
5024
|
}
|
|
4977
|
-
function
|
|
5025
|
+
function Vr(e, t) {
|
|
4978
5026
|
const n = e[t];
|
|
4979
5027
|
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
4980
5028
|
enter: n,
|
|
@@ -4985,9 +5033,9 @@ function $r(e, t) {
|
|
|
4985
5033
|
};
|
|
4986
5034
|
}
|
|
4987
5035
|
function gn(e) {
|
|
4988
|
-
return
|
|
5036
|
+
return $r(e, zr);
|
|
4989
5037
|
}
|
|
4990
|
-
const
|
|
5038
|
+
const Hr = 80, zr = {
|
|
4991
5039
|
Name: {
|
|
4992
5040
|
leave: (e) => e.value
|
|
4993
5041
|
},
|
|
@@ -5023,8 +5071,8 @@ const Vr = 80, Hr = {
|
|
|
5023
5071
|
leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
|
|
5024
5072
|
const i = I("", e, ": ") + t;
|
|
5025
5073
|
let o = i + I("(", E(n, ", "), ")");
|
|
5026
|
-
return o.length >
|
|
5027
|
-
`,
|
|
5074
|
+
return o.length > Hr && (o = i + I(`(
|
|
5075
|
+
`, _e(E(n, `
|
|
5028
5076
|
`)), `
|
|
5029
5077
|
)`)), E([o, E(s, " "), r], " ");
|
|
5030
5078
|
}
|
|
@@ -5061,7 +5109,7 @@ const Vr = 80, Hr = {
|
|
|
5061
5109
|
leave: ({ value: e }) => e
|
|
5062
5110
|
},
|
|
5063
5111
|
StringValue: {
|
|
5064
|
-
leave: ({ value: e, block: t }) => t ?
|
|
5112
|
+
leave: ({ value: e, block: t }) => t ? pr(e) : Ur(e)
|
|
5065
5113
|
},
|
|
5066
5114
|
BooleanValue: {
|
|
5067
5115
|
leave: ({ value: e }) => e ? "true" : "false"
|
|
@@ -5123,7 +5171,7 @@ const Vr = 80, Hr = {
|
|
|
5123
5171
|
FieldDefinition: {
|
|
5124
5172
|
leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => I("", e, `
|
|
5125
5173
|
`) + t + (qt(n) ? I(`(
|
|
5126
|
-
`,
|
|
5174
|
+
`, _e(E(n, `
|
|
5127
5175
|
`)), `
|
|
5128
5176
|
)`) : I("(", E(n, ", "), ")")) + ": " + s + I(" ", E(r, " "))
|
|
5129
5177
|
},
|
|
@@ -5169,7 +5217,7 @@ const Vr = 80, Hr = {
|
|
|
5169
5217
|
DirectiveDefinition: {
|
|
5170
5218
|
leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => I("", e, `
|
|
5171
5219
|
`) + "directive @" + t + (qt(n) ? I(`(
|
|
5172
|
-
`,
|
|
5220
|
+
`, _e(E(n, `
|
|
5173
5221
|
`)), `
|
|
5174
5222
|
)`) : I("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
|
|
5175
5223
|
},
|
|
@@ -5230,14 +5278,14 @@ function E(e, t = "") {
|
|
|
5230
5278
|
}
|
|
5231
5279
|
function M(e) {
|
|
5232
5280
|
return I(`{
|
|
5233
|
-
`,
|
|
5281
|
+
`, _e(E(e, `
|
|
5234
5282
|
`)), `
|
|
5235
5283
|
}`);
|
|
5236
5284
|
}
|
|
5237
5285
|
function I(e, t, n = "") {
|
|
5238
5286
|
return t != null && t !== "" ? e + t + n : "";
|
|
5239
5287
|
}
|
|
5240
|
-
function
|
|
5288
|
+
function _e(e) {
|
|
5241
5289
|
return I(" ", e.replace(/\n/g, `
|
|
5242
5290
|
`));
|
|
5243
5291
|
}
|
|
@@ -5255,7 +5303,7 @@ const Mt = (e) => {
|
|
|
5255
5303
|
if (typeof e == "string") {
|
|
5256
5304
|
let n;
|
|
5257
5305
|
try {
|
|
5258
|
-
const s =
|
|
5306
|
+
const s = Mr(e);
|
|
5259
5307
|
n = Mt(s);
|
|
5260
5308
|
} catch {
|
|
5261
5309
|
}
|
|
@@ -5277,13 +5325,13 @@ class ce extends Error {
|
|
|
5277
5325
|
return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
|
|
5278
5326
|
}
|
|
5279
5327
|
}
|
|
5280
|
-
var
|
|
5281
|
-
function
|
|
5328
|
+
var Gr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5329
|
+
function Jr(e) {
|
|
5282
5330
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
5283
5331
|
}
|
|
5284
5332
|
var et = { exports: {} };
|
|
5285
5333
|
(function(e, t) {
|
|
5286
|
-
var n = typeof self < "u" ? self :
|
|
5334
|
+
var n = typeof self < "u" ? self : Gr, s = function() {
|
|
5287
5335
|
function i() {
|
|
5288
5336
|
this.fetch = !1, this.DOMException = n.DOMException;
|
|
5289
5337
|
}
|
|
@@ -5304,8 +5352,8 @@ var et = { exports: {} };
|
|
|
5304
5352
|
formData: "FormData" in i,
|
|
5305
5353
|
arrayBuffer: "ArrayBuffer" in i
|
|
5306
5354
|
};
|
|
5307
|
-
function c(
|
|
5308
|
-
return
|
|
5355
|
+
function c(d) {
|
|
5356
|
+
return d && DataView.prototype.isPrototypeOf(d);
|
|
5309
5357
|
}
|
|
5310
5358
|
if (a.arrayBuffer)
|
|
5311
5359
|
var u = [
|
|
@@ -5318,21 +5366,21 @@ var et = { exports: {} };
|
|
|
5318
5366
|
"[object Uint32Array]",
|
|
5319
5367
|
"[object Float32Array]",
|
|
5320
5368
|
"[object Float64Array]"
|
|
5321
|
-
],
|
|
5322
|
-
return
|
|
5369
|
+
], f = ArrayBuffer.isView || function(d) {
|
|
5370
|
+
return d && u.indexOf(Object.prototype.toString.call(d)) > -1;
|
|
5323
5371
|
};
|
|
5324
|
-
function d
|
|
5325
|
-
if (typeof
|
|
5372
|
+
function l(d) {
|
|
5373
|
+
if (typeof d != "string" && (d = String(d)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(d))
|
|
5326
5374
|
throw new TypeError("Invalid character in header field name");
|
|
5327
|
-
return
|
|
5375
|
+
return d.toLowerCase();
|
|
5328
5376
|
}
|
|
5329
|
-
function
|
|
5330
|
-
return typeof
|
|
5377
|
+
function h(d) {
|
|
5378
|
+
return typeof d != "string" && (d = String(d)), d;
|
|
5331
5379
|
}
|
|
5332
|
-
function m(
|
|
5380
|
+
function m(d) {
|
|
5333
5381
|
var g = {
|
|
5334
5382
|
next: function() {
|
|
5335
|
-
var S =
|
|
5383
|
+
var S = d.shift();
|
|
5336
5384
|
return { done: S === void 0, value: S };
|
|
5337
5385
|
}
|
|
5338
5386
|
};
|
|
@@ -5340,86 +5388,86 @@ var et = { exports: {} };
|
|
|
5340
5388
|
return g;
|
|
5341
5389
|
}), g;
|
|
5342
5390
|
}
|
|
5343
|
-
function y(
|
|
5344
|
-
this.map = {},
|
|
5391
|
+
function y(d) {
|
|
5392
|
+
this.map = {}, d instanceof y ? d.forEach(function(g, S) {
|
|
5345
5393
|
this.append(S, g);
|
|
5346
|
-
}, this) : Array.isArray(
|
|
5394
|
+
}, this) : Array.isArray(d) ? d.forEach(function(g) {
|
|
5347
5395
|
this.append(g[0], g[1]);
|
|
5348
|
-
}, this) :
|
|
5349
|
-
this.append(g,
|
|
5396
|
+
}, this) : d && Object.getOwnPropertyNames(d).forEach(function(g) {
|
|
5397
|
+
this.append(g, d[g]);
|
|
5350
5398
|
}, this);
|
|
5351
5399
|
}
|
|
5352
|
-
y.prototype.append = function(
|
|
5353
|
-
|
|
5354
|
-
var S = this.map[
|
|
5355
|
-
this.map[
|
|
5356
|
-
}, y.prototype.delete = function(
|
|
5357
|
-
delete this.map[d
|
|
5358
|
-
}, y.prototype.get = function(
|
|
5359
|
-
return
|
|
5360
|
-
}, y.prototype.has = function(
|
|
5361
|
-
return this.map.hasOwnProperty(d
|
|
5362
|
-
}, y.prototype.set = function(
|
|
5363
|
-
this.map[d
|
|
5364
|
-
}, y.prototype.forEach = function(
|
|
5400
|
+
y.prototype.append = function(d, g) {
|
|
5401
|
+
d = l(d), g = h(g);
|
|
5402
|
+
var S = this.map[d];
|
|
5403
|
+
this.map[d] = S ? S + ", " + g : g;
|
|
5404
|
+
}, y.prototype.delete = function(d) {
|
|
5405
|
+
delete this.map[l(d)];
|
|
5406
|
+
}, y.prototype.get = function(d) {
|
|
5407
|
+
return d = l(d), this.has(d) ? this.map[d] : null;
|
|
5408
|
+
}, y.prototype.has = function(d) {
|
|
5409
|
+
return this.map.hasOwnProperty(l(d));
|
|
5410
|
+
}, y.prototype.set = function(d, g) {
|
|
5411
|
+
this.map[l(d)] = h(g);
|
|
5412
|
+
}, y.prototype.forEach = function(d, g) {
|
|
5365
5413
|
for (var S in this.map)
|
|
5366
|
-
this.map.hasOwnProperty(S) &&
|
|
5414
|
+
this.map.hasOwnProperty(S) && d.call(g, this.map[S], S, this);
|
|
5367
5415
|
}, y.prototype.keys = function() {
|
|
5368
|
-
var
|
|
5416
|
+
var d = [];
|
|
5369
5417
|
return this.forEach(function(g, S) {
|
|
5370
|
-
|
|
5371
|
-
}), m(
|
|
5418
|
+
d.push(S);
|
|
5419
|
+
}), m(d);
|
|
5372
5420
|
}, y.prototype.values = function() {
|
|
5373
|
-
var
|
|
5421
|
+
var d = [];
|
|
5374
5422
|
return this.forEach(function(g) {
|
|
5375
|
-
|
|
5376
|
-
}), m(
|
|
5423
|
+
d.push(g);
|
|
5424
|
+
}), m(d);
|
|
5377
5425
|
}, y.prototype.entries = function() {
|
|
5378
|
-
var
|
|
5426
|
+
var d = [];
|
|
5379
5427
|
return this.forEach(function(g, S) {
|
|
5380
|
-
|
|
5381
|
-
}), m(
|
|
5428
|
+
d.push([S, g]);
|
|
5429
|
+
}), m(d);
|
|
5382
5430
|
}, a.iterable && (y.prototype[Symbol.iterator] = y.prototype.entries);
|
|
5383
|
-
function
|
|
5384
|
-
if (
|
|
5431
|
+
function T(d) {
|
|
5432
|
+
if (d.bodyUsed)
|
|
5385
5433
|
return Promise.reject(new TypeError("Already read"));
|
|
5386
|
-
|
|
5434
|
+
d.bodyUsed = !0;
|
|
5387
5435
|
}
|
|
5388
|
-
function _(
|
|
5436
|
+
function _(d) {
|
|
5389
5437
|
return new Promise(function(g, S) {
|
|
5390
|
-
|
|
5391
|
-
g(
|
|
5392
|
-
},
|
|
5393
|
-
S(
|
|
5438
|
+
d.onload = function() {
|
|
5439
|
+
g(d.result);
|
|
5440
|
+
}, d.onerror = function() {
|
|
5441
|
+
S(d.error);
|
|
5394
5442
|
};
|
|
5395
5443
|
});
|
|
5396
5444
|
}
|
|
5397
|
-
function w(
|
|
5445
|
+
function w(d) {
|
|
5398
5446
|
var g = new FileReader(), S = _(g);
|
|
5399
|
-
return g.readAsArrayBuffer(
|
|
5447
|
+
return g.readAsArrayBuffer(d), S;
|
|
5400
5448
|
}
|
|
5401
|
-
function R(
|
|
5449
|
+
function R(d) {
|
|
5402
5450
|
var g = new FileReader(), S = _(g);
|
|
5403
|
-
return g.readAsText(
|
|
5451
|
+
return g.readAsText(d), S;
|
|
5404
5452
|
}
|
|
5405
|
-
function
|
|
5406
|
-
for (var g = new Uint8Array(
|
|
5453
|
+
function O(d) {
|
|
5454
|
+
for (var g = new Uint8Array(d), S = new Array(g.length), N = 0; N < g.length; N++)
|
|
5407
5455
|
S[N] = String.fromCharCode(g[N]);
|
|
5408
5456
|
return S.join("");
|
|
5409
5457
|
}
|
|
5410
|
-
function q(
|
|
5411
|
-
if (
|
|
5412
|
-
return
|
|
5413
|
-
var g = new Uint8Array(
|
|
5414
|
-
return g.set(new Uint8Array(
|
|
5458
|
+
function q(d) {
|
|
5459
|
+
if (d.slice)
|
|
5460
|
+
return d.slice(0);
|
|
5461
|
+
var g = new Uint8Array(d.byteLength);
|
|
5462
|
+
return g.set(new Uint8Array(d)), g.buffer;
|
|
5415
5463
|
}
|
|
5416
5464
|
function P() {
|
|
5417
|
-
return this.bodyUsed = !1, this._initBody = function(
|
|
5418
|
-
this._bodyInit =
|
|
5465
|
+
return this.bodyUsed = !1, this._initBody = function(d) {
|
|
5466
|
+
this._bodyInit = d, d ? typeof d == "string" ? this._bodyText = d : a.blob && Blob.prototype.isPrototypeOf(d) ? this._bodyBlob = d : a.formData && FormData.prototype.isPrototypeOf(d) ? this._bodyFormData = d : a.searchParams && URLSearchParams.prototype.isPrototypeOf(d) ? this._bodyText = d.toString() : a.arrayBuffer && a.blob && c(d) ? (this._bodyArrayBuffer = q(d.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(d) || f(d)) ? this._bodyArrayBuffer = q(d) : this._bodyText = d = Object.prototype.toString.call(d) : this._bodyText = "", this.headers.get("content-type") || (typeof d == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(d) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
5419
5467
|
}, a.blob && (this.blob = function() {
|
|
5420
|
-
var
|
|
5421
|
-
if (
|
|
5422
|
-
return
|
|
5468
|
+
var d = T(this);
|
|
5469
|
+
if (d)
|
|
5470
|
+
return d;
|
|
5423
5471
|
if (this._bodyBlob)
|
|
5424
5472
|
return Promise.resolve(this._bodyBlob);
|
|
5425
5473
|
if (this._bodyArrayBuffer)
|
|
@@ -5428,15 +5476,15 @@ var et = { exports: {} };
|
|
|
5428
5476
|
throw new Error("could not read FormData body as blob");
|
|
5429
5477
|
return Promise.resolve(new Blob([this._bodyText]));
|
|
5430
5478
|
}, this.arrayBuffer = function() {
|
|
5431
|
-
return this._bodyArrayBuffer ?
|
|
5479
|
+
return this._bodyArrayBuffer ? T(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(w);
|
|
5432
5480
|
}), this.text = function() {
|
|
5433
|
-
var
|
|
5434
|
-
if (
|
|
5435
|
-
return
|
|
5481
|
+
var d = T(this);
|
|
5482
|
+
if (d)
|
|
5483
|
+
return d;
|
|
5436
5484
|
if (this._bodyBlob)
|
|
5437
5485
|
return R(this._bodyBlob);
|
|
5438
5486
|
if (this._bodyArrayBuffer)
|
|
5439
|
-
return Promise.resolve(
|
|
5487
|
+
return Promise.resolve(O(this._bodyArrayBuffer));
|
|
5440
5488
|
if (this._bodyFormData)
|
|
5441
5489
|
throw new Error("could not read FormData body as text");
|
|
5442
5490
|
return Promise.resolve(this._bodyText);
|
|
@@ -5447,19 +5495,19 @@ var et = { exports: {} };
|
|
|
5447
5495
|
}, this;
|
|
5448
5496
|
}
|
|
5449
5497
|
var H = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
|
5450
|
-
function z(
|
|
5451
|
-
var g =
|
|
5452
|
-
return H.indexOf(g) > -1 ? g :
|
|
5498
|
+
function z(d) {
|
|
5499
|
+
var g = d.toUpperCase();
|
|
5500
|
+
return H.indexOf(g) > -1 ? g : d;
|
|
5453
5501
|
}
|
|
5454
|
-
function L(
|
|
5502
|
+
function L(d, g) {
|
|
5455
5503
|
g = g || {};
|
|
5456
5504
|
var S = g.body;
|
|
5457
|
-
if (
|
|
5458
|
-
if (
|
|
5505
|
+
if (d instanceof L) {
|
|
5506
|
+
if (d.bodyUsed)
|
|
5459
5507
|
throw new TypeError("Already read");
|
|
5460
|
-
this.url =
|
|
5508
|
+
this.url = d.url, this.credentials = d.credentials, g.headers || (this.headers = new y(d.headers)), this.method = d.method, this.mode = d.mode, this.signal = d.signal, !S && d._bodyInit != null && (S = d._bodyInit, d.bodyUsed = !0);
|
|
5461
5509
|
} else
|
|
5462
|
-
this.url = String(
|
|
5510
|
+
this.url = String(d);
|
|
5463
5511
|
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = z(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && S)
|
|
5464
5512
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
5465
5513
|
this._initBody(S);
|
|
@@ -5467,28 +5515,28 @@ var et = { exports: {} };
|
|
|
5467
5515
|
L.prototype.clone = function() {
|
|
5468
5516
|
return new L(this, { body: this._bodyInit });
|
|
5469
5517
|
};
|
|
5470
|
-
function pe(
|
|
5518
|
+
function pe(d) {
|
|
5471
5519
|
var g = new FormData();
|
|
5472
|
-
return
|
|
5520
|
+
return d.trim().split("&").forEach(function(S) {
|
|
5473
5521
|
if (S) {
|
|
5474
|
-
var N = S.split("="),
|
|
5475
|
-
g.append(decodeURIComponent(
|
|
5522
|
+
var N = S.split("="), k = N.shift().replace(/\+/g, " "), A = N.join("=").replace(/\+/g, " ");
|
|
5523
|
+
g.append(decodeURIComponent(k), decodeURIComponent(A));
|
|
5476
5524
|
}
|
|
5477
5525
|
}), g;
|
|
5478
5526
|
}
|
|
5479
|
-
function ye(
|
|
5480
|
-
var g = new y(), S =
|
|
5527
|
+
function ye(d) {
|
|
5528
|
+
var g = new y(), S = d.replace(/\r?\n[\t ]+/g, " ");
|
|
5481
5529
|
return S.split(/\r?\n/).forEach(function(N) {
|
|
5482
|
-
var
|
|
5530
|
+
var k = N.split(":"), A = k.shift().trim();
|
|
5483
5531
|
if (A) {
|
|
5484
|
-
var me =
|
|
5532
|
+
var me = k.join(":").trim();
|
|
5485
5533
|
g.append(A, me);
|
|
5486
5534
|
}
|
|
5487
5535
|
}), g;
|
|
5488
5536
|
}
|
|
5489
5537
|
P.call(L.prototype);
|
|
5490
|
-
function U(
|
|
5491
|
-
g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new y(g.headers), this.url = g.url || "", this._initBody(
|
|
5538
|
+
function U(d, g) {
|
|
5539
|
+
g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new y(g.headers), this.url = g.url || "", this._initBody(d);
|
|
5492
5540
|
}
|
|
5493
5541
|
P.call(U.prototype), U.prototype.clone = function() {
|
|
5494
5542
|
return new U(this._bodyInit, {
|
|
@@ -5498,14 +5546,14 @@ var et = { exports: {} };
|
|
|
5498
5546
|
url: this.url
|
|
5499
5547
|
});
|
|
5500
5548
|
}, U.error = function() {
|
|
5501
|
-
var
|
|
5502
|
-
return
|
|
5549
|
+
var d = new U(null, { status: 0, statusText: "" });
|
|
5550
|
+
return d.type = "error", d;
|
|
5503
5551
|
};
|
|
5504
5552
|
var _n = [301, 302, 303, 307, 308];
|
|
5505
|
-
U.redirect = function(
|
|
5553
|
+
U.redirect = function(d, g) {
|
|
5506
5554
|
if (_n.indexOf(g) === -1)
|
|
5507
5555
|
throw new RangeError("Invalid status code");
|
|
5508
|
-
return new U(null, { status: g, headers: { location:
|
|
5556
|
+
return new U(null, { status: g, headers: { location: d } });
|
|
5509
5557
|
}, o.DOMException = i.DOMException;
|
|
5510
5558
|
try {
|
|
5511
5559
|
new o.DOMException();
|
|
@@ -5516,10 +5564,10 @@ var et = { exports: {} };
|
|
|
5516
5564
|
this.stack = N.stack;
|
|
5517
5565
|
}, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
|
|
5518
5566
|
}
|
|
5519
|
-
function
|
|
5567
|
+
function Le(d, g) {
|
|
5520
5568
|
return new Promise(function(S, N) {
|
|
5521
|
-
var
|
|
5522
|
-
if (
|
|
5569
|
+
var k = new L(d, g);
|
|
5570
|
+
if (k.signal && k.signal.aborted)
|
|
5523
5571
|
return N(new o.DOMException("Aborted", "AbortError"));
|
|
5524
5572
|
var A = new XMLHttpRequest();
|
|
5525
5573
|
function me() {
|
|
@@ -5532,37 +5580,37 @@ var et = { exports: {} };
|
|
|
5532
5580
|
headers: ye(A.getAllResponseHeaders() || "")
|
|
5533
5581
|
};
|
|
5534
5582
|
ie.url = "responseURL" in A ? A.responseURL : ie.headers.get("X-Request-URL");
|
|
5535
|
-
var
|
|
5536
|
-
S(new U(
|
|
5583
|
+
var Ue = "response" in A ? A.response : A.responseText;
|
|
5584
|
+
S(new U(Ue, ie));
|
|
5537
5585
|
}, A.onerror = function() {
|
|
5538
5586
|
N(new TypeError("Network request failed"));
|
|
5539
5587
|
}, A.ontimeout = function() {
|
|
5540
5588
|
N(new TypeError("Network request failed"));
|
|
5541
5589
|
}, A.onabort = function() {
|
|
5542
5590
|
N(new o.DOMException("Aborted", "AbortError"));
|
|
5543
|
-
}, A.open(
|
|
5544
|
-
A.setRequestHeader(
|
|
5545
|
-
}),
|
|
5546
|
-
A.readyState === 4 &&
|
|
5547
|
-
}), A.send(typeof
|
|
5591
|
+
}, A.open(k.method, k.url, !0), k.credentials === "include" ? A.withCredentials = !0 : k.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), k.headers.forEach(function(ie, Ue) {
|
|
5592
|
+
A.setRequestHeader(Ue, ie);
|
|
5593
|
+
}), k.signal && (k.signal.addEventListener("abort", me), A.onreadystatechange = function() {
|
|
5594
|
+
A.readyState === 4 && k.signal.removeEventListener("abort", me);
|
|
5595
|
+
}), A.send(typeof k._bodyInit > "u" ? null : k._bodyInit);
|
|
5548
5596
|
});
|
|
5549
5597
|
}
|
|
5550
|
-
return
|
|
5598
|
+
return Le.polyfill = !0, i.fetch || (i.fetch = Le, i.Headers = y, i.Request = L, i.Response = U), o.Headers = y, o.Request = L, o.Response = U, o.fetch = Le, Object.defineProperty(o, "__esModule", { value: !0 }), o;
|
|
5551
5599
|
})({});
|
|
5552
5600
|
})(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
|
|
5553
5601
|
var r = s;
|
|
5554
5602
|
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;
|
|
5555
5603
|
})(et, et.exports);
|
|
5556
|
-
var
|
|
5557
|
-
const
|
|
5604
|
+
var be = et.exports;
|
|
5605
|
+
const Ie = /* @__PURE__ */ Jr(be), Yr = /* @__PURE__ */ An({
|
|
5558
5606
|
__proto__: null,
|
|
5559
|
-
default:
|
|
5560
|
-
}, [
|
|
5607
|
+
default: Ie
|
|
5608
|
+
}, [be]), W = (e) => {
|
|
5561
5609
|
let t = {};
|
|
5562
|
-
return e && (typeof Headers < "u" && e instanceof Headers ||
|
|
5610
|
+
return e && (typeof Headers < "u" && e instanceof Headers || Yr && be.Headers && e instanceof be.Headers ? t = Zs(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
|
|
5563
5611
|
n && s !== void 0 && (t[n] = s);
|
|
5564
5612
|
}) : t = e), t;
|
|
5565
|
-
}, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(),
|
|
5613
|
+
}, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Qr = (e) => {
|
|
5566
5614
|
if (!Array.isArray(e.query)) {
|
|
5567
5615
|
const s = e, r = [`query=${encodeURIComponent(Lt(s.query))}`];
|
|
5568
5616
|
return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
|
|
@@ -5574,34 +5622,34 @@ const _e = /* @__PURE__ */ Gr(xe), Jr = /* @__PURE__ */ An({
|
|
|
5574
5622
|
variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
|
|
5575
5623
|
}), s), []);
|
|
5576
5624
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
5577
|
-
},
|
|
5625
|
+
}, Xr = (e) => async (t) => {
|
|
5578
5626
|
const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
|
|
5579
|
-
let
|
|
5580
|
-
e === "POST" ? (
|
|
5627
|
+
let f = "", l;
|
|
5628
|
+
e === "POST" ? (l = Wr(s, r, i, a.jsonSerializer), typeof l == "string" && (u["Content-Type"] = "application/json")) : f = Qr({
|
|
5581
5629
|
query: s,
|
|
5582
5630
|
variables: r,
|
|
5583
5631
|
operationName: i,
|
|
5584
5632
|
jsonSerializer: a.jsonSerializer ?? lt
|
|
5585
5633
|
});
|
|
5586
|
-
const
|
|
5634
|
+
const h = {
|
|
5587
5635
|
method: e,
|
|
5588
5636
|
headers: u,
|
|
5589
|
-
body:
|
|
5637
|
+
body: l,
|
|
5590
5638
|
...a
|
|
5591
5639
|
};
|
|
5592
|
-
let m = n, y =
|
|
5640
|
+
let m = n, y = h;
|
|
5593
5641
|
if (c) {
|
|
5594
|
-
const
|
|
5642
|
+
const T = await Promise.resolve(c({ ...h, url: n, operationName: i, variables: r })), { url: _, ...w } = T;
|
|
5595
5643
|
m = _, y = w;
|
|
5596
5644
|
}
|
|
5597
|
-
return
|
|
5645
|
+
return f && (m = `${m}?${f}`), await o(m, y);
|
|
5598
5646
|
};
|
|
5599
5647
|
class En {
|
|
5600
5648
|
constructor(t, n = {}) {
|
|
5601
5649
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
|
|
5602
|
-
const [r, i, o] = s, a =
|
|
5650
|
+
const [r, i, o] = s, a = tr(r, i, o), { headers: c, fetch: u = Ie, method: f = "POST", requestMiddleware: l, responseMiddleware: h, ...m } = this.requestConfig, { url: y } = this;
|
|
5603
5651
|
a.signal !== void 0 && (m.signal = a.signal);
|
|
5604
|
-
const { operationName:
|
|
5652
|
+
const { operationName: T } = je(a.query);
|
|
5605
5653
|
return $e({
|
|
5606
5654
|
url: y,
|
|
5607
5655
|
query: a.query,
|
|
@@ -5610,22 +5658,22 @@ class En {
|
|
|
5610
5658
|
...W(Ve(c)),
|
|
5611
5659
|
...W(a.requestHeaders)
|
|
5612
5660
|
},
|
|
5613
|
-
operationName:
|
|
5661
|
+
operationName: T,
|
|
5614
5662
|
fetch: u,
|
|
5615
|
-
method:
|
|
5663
|
+
method: f,
|
|
5616
5664
|
fetchOptions: m,
|
|
5617
|
-
middleware:
|
|
5618
|
-
}).then((_) => (
|
|
5619
|
-
throw
|
|
5665
|
+
middleware: l
|
|
5666
|
+
}).then((_) => (h && h(_), _)).catch((_) => {
|
|
5667
|
+
throw h && h(_), _;
|
|
5620
5668
|
});
|
|
5621
5669
|
};
|
|
5622
5670
|
}
|
|
5623
5671
|
async request(t, ...n) {
|
|
5624
|
-
const [s, r] = n, i =
|
|
5625
|
-
i.signal !== void 0 && (
|
|
5672
|
+
const [s, r] = n, i = er(t, s, r), { headers: o, fetch: a = Ie, method: c = "POST", requestMiddleware: u, responseMiddleware: f, ...l } = this.requestConfig, { url: h } = this;
|
|
5673
|
+
i.signal !== void 0 && (l.signal = i.signal);
|
|
5626
5674
|
const { query: m, operationName: y } = je(i.document);
|
|
5627
5675
|
return $e({
|
|
5628
|
-
url:
|
|
5676
|
+
url: h,
|
|
5629
5677
|
query: m,
|
|
5630
5678
|
variables: i.variables,
|
|
5631
5679
|
headers: {
|
|
@@ -5635,15 +5683,15 @@ class En {
|
|
|
5635
5683
|
operationName: y,
|
|
5636
5684
|
fetch: a,
|
|
5637
5685
|
method: c,
|
|
5638
|
-
fetchOptions:
|
|
5686
|
+
fetchOptions: l,
|
|
5639
5687
|
middleware: u
|
|
5640
|
-
}).then((
|
|
5641
|
-
throw
|
|
5688
|
+
}).then((T) => (f && f(T), T.data)).catch((T) => {
|
|
5689
|
+
throw f && f(T), T;
|
|
5642
5690
|
});
|
|
5643
5691
|
}
|
|
5644
5692
|
// prettier-ignore
|
|
5645
5693
|
batchRequests(t, n) {
|
|
5646
|
-
const s =
|
|
5694
|
+
const s = nr(t, n), { headers: r, ...i } = this.requestConfig;
|
|
5647
5695
|
s.signal !== void 0 && (i.signal = s.signal);
|
|
5648
5696
|
const o = s.documents.map(({ document: c }) => je(c).query), a = s.documents.map(({ variables: c }) => c);
|
|
5649
5697
|
return $e({
|
|
@@ -5656,7 +5704,7 @@ class En {
|
|
|
5656
5704
|
...W(s.requestHeaders)
|
|
5657
5705
|
},
|
|
5658
5706
|
operationName: void 0,
|
|
5659
|
-
fetch: this.requestConfig.fetch ??
|
|
5707
|
+
fetch: this.requestConfig.fetch ?? Ie,
|
|
5660
5708
|
method: this.requestConfig.method || "POST",
|
|
5661
5709
|
fetchOptions: i,
|
|
5662
5710
|
middleware: this.requestConfig.requestMiddleware
|
|
@@ -5682,32 +5730,32 @@ class En {
|
|
|
5682
5730
|
}
|
|
5683
5731
|
}
|
|
5684
5732
|
const $e = async (e) => {
|
|
5685
|
-
const { query: t, variables: n, fetchOptions: s } = e, r =
|
|
5733
|
+
const { query: t, variables: n, fetchOptions: s } = e, r = Xr(Ks(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Kr(o, s.jsonSerializer ?? lt), c = Array.isArray(a) ? !a.some(({ data: f }) => !f) : !!a.data, u = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || s.errorPolicy === "all" || s.errorPolicy === "ignore";
|
|
5686
5734
|
if (o.ok && u && c) {
|
|
5687
|
-
const { errors:
|
|
5735
|
+
const { errors: f, ...l } = (Array.isArray(a), a), h = s.errorPolicy === "ignore" ? l : a;
|
|
5688
5736
|
return {
|
|
5689
|
-
...i ? { data:
|
|
5737
|
+
...i ? { data: h } : h,
|
|
5690
5738
|
headers: o.headers,
|
|
5691
5739
|
status: o.status
|
|
5692
5740
|
};
|
|
5693
5741
|
} else {
|
|
5694
|
-
const
|
|
5742
|
+
const f = typeof a == "string" ? {
|
|
5695
5743
|
error: a
|
|
5696
5744
|
} : a;
|
|
5697
5745
|
throw new ce(
|
|
5698
5746
|
// @ts-expect-error TODO
|
|
5699
|
-
{ ...
|
|
5747
|
+
{ ...f, status: o.status, headers: o.headers },
|
|
5700
5748
|
{ query: t, variables: n }
|
|
5701
5749
|
);
|
|
5702
5750
|
}
|
|
5703
5751
|
};
|
|
5704
5752
|
async function fe(e, t, ...n) {
|
|
5705
|
-
const s =
|
|
5753
|
+
const s = sr(e, t, ...n);
|
|
5706
5754
|
return new En(s.url).request({
|
|
5707
5755
|
...s
|
|
5708
5756
|
});
|
|
5709
5757
|
}
|
|
5710
|
-
const
|
|
5758
|
+
const Wr = (e, t, n, s) => {
|
|
5711
5759
|
const r = s ?? lt;
|
|
5712
5760
|
if (!Array.isArray(e))
|
|
5713
5761
|
return r.stringify({ query: e, variables: t, operationName: n });
|
|
@@ -5715,12 +5763,12 @@ const Xr = (e, t, n, s) => {
|
|
|
5715
5763
|
throw new Error("Cannot create request body with given variable type, array expected");
|
|
5716
5764
|
const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
|
|
5717
5765
|
return r.stringify(i);
|
|
5718
|
-
},
|
|
5766
|
+
}, Kr = async (e, t) => {
|
|
5719
5767
|
let n;
|
|
5720
5768
|
return e.headers.forEach((s, r) => {
|
|
5721
5769
|
r.toLowerCase() === "content-type" && (n = s);
|
|
5722
5770
|
}), 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();
|
|
5723
|
-
}, Ve = (e) => typeof e == "function" ? e() : e,
|
|
5771
|
+
}, Ve = (e) => typeof e == "function" ? e() : e, Zr = $(async ({ input: e }) => {
|
|
5724
5772
|
var t, n;
|
|
5725
5773
|
if (!e.endpoint || e.endpoint === "")
|
|
5726
5774
|
throw new Error("No endpoint provided.");
|
|
@@ -5744,7 +5792,7 @@ const Xr = (e, t, n, s) => {
|
|
|
5744
5792
|
} catch (s) {
|
|
5745
5793
|
throw console.log("Request to place order failed."), console.log(s), new Error("Request to place order failed.");
|
|
5746
5794
|
}
|
|
5747
|
-
}),
|
|
5795
|
+
}), ei = $(async ({ input: e }) => {
|
|
5748
5796
|
var t;
|
|
5749
5797
|
if (!e.endpoint || e.endpoint === "")
|
|
5750
5798
|
throw new Error("No endpoint provided.");
|
|
@@ -5776,27 +5824,27 @@ const Xr = (e, t, n, s) => {
|
|
|
5776
5824
|
} catch {
|
|
5777
5825
|
throw console.log("Request to add submit step data failed."), new Error("Request to add submit step data failed.");
|
|
5778
5826
|
}
|
|
5779
|
-
}),
|
|
5827
|
+
}), ti = ({ context: e }) => Object.keys(e.quote).length > 0, Ut = he({
|
|
5780
5828
|
types: {
|
|
5781
5829
|
context: {},
|
|
5782
5830
|
events: {},
|
|
5783
5831
|
input: {}
|
|
5784
5832
|
},
|
|
5785
5833
|
actions: {
|
|
5786
|
-
changeStep: x(
|
|
5787
|
-
nextStep: x(
|
|
5788
|
-
resetCheckout: x(
|
|
5789
|
-
updateQuote: x(
|
|
5790
|
-
updateSuccessId: x(
|
|
5834
|
+
changeStep: x(Js),
|
|
5835
|
+
nextStep: x(Ys),
|
|
5836
|
+
resetCheckout: x(Qs),
|
|
5837
|
+
updateQuote: x(Xs),
|
|
5838
|
+
updateSuccessId: x(Ws)
|
|
5791
5839
|
},
|
|
5792
|
-
actors: { placeOrder:
|
|
5793
|
-
guards: { quoteExists:
|
|
5840
|
+
actors: { placeOrder: Zr, submitStepData: ei },
|
|
5841
|
+
guards: { quoteExists: ti }
|
|
5794
5842
|
}).createMachine({
|
|
5795
5843
|
/** @todo do we need to add the view to the id? (e.g. checkout_en-us) */
|
|
5796
5844
|
id: "checkout",
|
|
5797
5845
|
initial: "uninitialized",
|
|
5798
5846
|
context: ({ input: e }) => {
|
|
5799
|
-
var t, n, s, r, i, o, a, c, u,
|
|
5847
|
+
var t, n, s, r, i, o, a, c, u, f, l, h, m, y, T, _, w;
|
|
5800
5848
|
return {
|
|
5801
5849
|
currentStep: ((t = e == null ? void 0 : e.initialContext) == null ? void 0 : t.currentStep) ?? "",
|
|
5802
5850
|
errors: [],
|
|
@@ -5831,11 +5879,11 @@ const Xr = (e, t, n, s) => {
|
|
|
5831
5879
|
graphql: {
|
|
5832
5880
|
placeOrder: {
|
|
5833
5881
|
document: ((c = (a = (o = e == null ? void 0 : e.initialContext) == null ? void 0 : o.graphql) == null ? void 0 : a.placeOrder) == null ? void 0 : c.document) ?? "",
|
|
5834
|
-
requestHeaders: ((
|
|
5882
|
+
requestHeaders: ((l = (f = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : f.placeOrder) == null ? void 0 : l.requestHeaders) ?? void 0
|
|
5835
5883
|
},
|
|
5836
5884
|
submitStepData: {
|
|
5837
|
-
document: ((y = (m = (
|
|
5838
|
-
requestHeaders: ((w = (_ = (
|
|
5885
|
+
document: ((y = (m = (h = e == null ? void 0 : e.initialContext) == null ? void 0 : h.graphql) == null ? void 0 : m.submitStepData) == null ? void 0 : y.document) ?? "",
|
|
5886
|
+
requestHeaders: ((w = (_ = (T = e == null ? void 0 : e.initialContext) == null ? void 0 : T.graphql) == null ? void 0 : _.submitStepData) == null ? void 0 : w.requestHeaders) ?? void 0
|
|
5839
5887
|
}
|
|
5840
5888
|
}
|
|
5841
5889
|
};
|
|
@@ -5965,12 +6013,12 @@ const Xr = (e, t, n, s) => {
|
|
|
5965
6013
|
// SYNC_IS_LOGGED_IN: '.syncIsLoggedIn',
|
|
5966
6014
|
// SYNC_QUOTE: '.syncQuote',
|
|
5967
6015
|
// },
|
|
5968
|
-
}),
|
|
5969
|
-
const e =
|
|
6016
|
+
}), Tn = ke({}), Ai = () => {
|
|
6017
|
+
const e = Ne(Tn);
|
|
5970
6018
|
if (!e || !e.getSnapshot)
|
|
5971
6019
|
throw new Error("checkoutActor is not properly initialized");
|
|
5972
|
-
const [t, n] =
|
|
5973
|
-
return
|
|
6020
|
+
const [t, n] = Oe(e.getSnapshot());
|
|
6021
|
+
return De(() => {
|
|
5974
6022
|
if (!e || !e.getSnapshot) {
|
|
5975
6023
|
console.error("checkoutActor is not properly initialized");
|
|
5976
6024
|
return;
|
|
@@ -5985,7 +6033,7 @@ const Xr = (e, t, n, s) => {
|
|
|
5985
6033
|
checkoutActor: e,
|
|
5986
6034
|
currentStep: t.context.currentStep
|
|
5987
6035
|
};
|
|
5988
|
-
},
|
|
6036
|
+
}, wi = async (e = {
|
|
5989
6037
|
inspect: void 0,
|
|
5990
6038
|
currentStep: "",
|
|
5991
6039
|
steps: [],
|
|
@@ -6015,11 +6063,11 @@ const Xr = (e, t, n, s) => {
|
|
|
6015
6063
|
},
|
|
6016
6064
|
inspect: e.inspect
|
|
6017
6065
|
}).start();
|
|
6018
|
-
function
|
|
6019
|
-
return /* @__PURE__ */
|
|
6066
|
+
function xi({ actor: e, children: t }) {
|
|
6067
|
+
return /* @__PURE__ */ Ce(Tn.Provider, { value: e, children: t });
|
|
6020
6068
|
}
|
|
6021
|
-
let
|
|
6022
|
-
const
|
|
6069
|
+
let ni = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
|
|
6070
|
+
const si = he({
|
|
6023
6071
|
actors: {
|
|
6024
6072
|
tick: Is(
|
|
6025
6073
|
({ sendBack: e, input: t }) => {
|
|
@@ -6097,9 +6145,9 @@ const ni = he({
|
|
|
6097
6145
|
type: "final"
|
|
6098
6146
|
}
|
|
6099
6147
|
}
|
|
6100
|
-
}),
|
|
6148
|
+
}), bi = he({
|
|
6101
6149
|
actors: {
|
|
6102
|
-
timer:
|
|
6150
|
+
timer: si
|
|
6103
6151
|
},
|
|
6104
6152
|
types: {
|
|
6105
6153
|
context: {},
|
|
@@ -6110,7 +6158,7 @@ const ni = he({
|
|
|
6110
6158
|
addItem: x(({ context: e, event: t }) => {
|
|
6111
6159
|
if (t.type !== "ADD_ITEM")
|
|
6112
6160
|
return e;
|
|
6113
|
-
const n = `notification-${
|
|
6161
|
+
const n = `notification-${ni()}`, s = t.duration ?? e.duration, r = In(t.item, {
|
|
6114
6162
|
duration: s,
|
|
6115
6163
|
id: n,
|
|
6116
6164
|
key: t.item.key ?? n,
|
|
@@ -6220,14 +6268,14 @@ const ni = he({
|
|
|
6220
6268
|
}
|
|
6221
6269
|
}
|
|
6222
6270
|
}
|
|
6223
|
-
}),
|
|
6271
|
+
}), vn = ke(
|
|
6224
6272
|
{}
|
|
6225
|
-
),
|
|
6226
|
-
const e =
|
|
6273
|
+
), Ci = () => {
|
|
6274
|
+
const e = Ne(vn);
|
|
6227
6275
|
if (!e || !e.getSnapshot)
|
|
6228
6276
|
throw new Error("toastActor is not properly initialized");
|
|
6229
|
-
const [t, n] =
|
|
6230
|
-
return
|
|
6277
|
+
const [t, n] = Oe(() => e.getSnapshot());
|
|
6278
|
+
return De(() => {
|
|
6231
6279
|
if (!e || !e.getSnapshot) {
|
|
6232
6280
|
console.error("toastActor is not properly initialized");
|
|
6233
6281
|
return;
|
|
@@ -6243,10 +6291,10 @@ const ni = he({
|
|
|
6243
6291
|
};
|
|
6244
6292
|
}, [e]), { toastActor: e };
|
|
6245
6293
|
};
|
|
6246
|
-
function
|
|
6247
|
-
return /* @__PURE__ */
|
|
6294
|
+
function ki({ children: e, actor: t }) {
|
|
6295
|
+
return /* @__PURE__ */ Ce(vn.Provider, { value: t, children: e });
|
|
6248
6296
|
}
|
|
6249
|
-
function
|
|
6297
|
+
function ri({
|
|
6250
6298
|
context: e,
|
|
6251
6299
|
event: t
|
|
6252
6300
|
}) {
|
|
@@ -6258,7 +6306,7 @@ function si({
|
|
|
6258
6306
|
itemsAdded: n.output.itemsAdded
|
|
6259
6307
|
};
|
|
6260
6308
|
}
|
|
6261
|
-
function
|
|
6309
|
+
function ii({
|
|
6262
6310
|
event: e
|
|
6263
6311
|
}) {
|
|
6264
6312
|
if (!e.type.includes("xstate.done.actor"))
|
|
@@ -6269,7 +6317,7 @@ function ri({
|
|
|
6269
6317
|
itemsAdded: t.output.itemsAdded
|
|
6270
6318
|
};
|
|
6271
6319
|
}
|
|
6272
|
-
function
|
|
6320
|
+
function oi({
|
|
6273
6321
|
event: e
|
|
6274
6322
|
}) {
|
|
6275
6323
|
if (!e.type.includes("xstate.done.actor"))
|
|
@@ -6280,7 +6328,7 @@ function ii({
|
|
|
6280
6328
|
itemsRemoved: t.output.itemsRemoved
|
|
6281
6329
|
};
|
|
6282
6330
|
}
|
|
6283
|
-
function
|
|
6331
|
+
function ai({
|
|
6284
6332
|
event: e
|
|
6285
6333
|
}) {
|
|
6286
6334
|
if (!e.type.includes("xstate.done.actor"))
|
|
@@ -6297,7 +6345,7 @@ function oi({
|
|
|
6297
6345
|
itemsUpdated: t.output.itemsUpdated
|
|
6298
6346
|
};
|
|
6299
6347
|
}
|
|
6300
|
-
function
|
|
6348
|
+
function ci({
|
|
6301
6349
|
context: e,
|
|
6302
6350
|
event: t
|
|
6303
6351
|
}) {
|
|
@@ -6309,7 +6357,7 @@ function ai({
|
|
|
6309
6357
|
itemsRemoved: n.output.itemsRemoved
|
|
6310
6358
|
};
|
|
6311
6359
|
}
|
|
6312
|
-
function
|
|
6360
|
+
function ui({
|
|
6313
6361
|
context: e,
|
|
6314
6362
|
event: t
|
|
6315
6363
|
}) {
|
|
@@ -6320,7 +6368,7 @@ function ci({
|
|
|
6320
6368
|
quote: { ...e.quote, ...n.output.quote }
|
|
6321
6369
|
};
|
|
6322
6370
|
}
|
|
6323
|
-
function
|
|
6371
|
+
function di({
|
|
6324
6372
|
context: e,
|
|
6325
6373
|
event: t
|
|
6326
6374
|
}) {
|
|
@@ -6364,7 +6412,19 @@ function ui({
|
|
|
6364
6412
|
}
|
|
6365
6413
|
};
|
|
6366
6414
|
}
|
|
6367
|
-
function
|
|
6415
|
+
function li({
|
|
6416
|
+
context: e,
|
|
6417
|
+
event: t
|
|
6418
|
+
}) {
|
|
6419
|
+
const n = t;
|
|
6420
|
+
return n.type !== "SYNC_ACCESS_TOKEN" ? e : {
|
|
6421
|
+
quote: {
|
|
6422
|
+
...e.quote,
|
|
6423
|
+
accessToken: n.accessToken
|
|
6424
|
+
}
|
|
6425
|
+
};
|
|
6426
|
+
}
|
|
6427
|
+
function hi({
|
|
6368
6428
|
context: e,
|
|
6369
6429
|
event: t
|
|
6370
6430
|
}) {
|
|
@@ -6376,9 +6436,9 @@ function di({
|
|
|
6376
6436
|
itemsUpdated: n.output.itemsUpdated
|
|
6377
6437
|
};
|
|
6378
6438
|
}
|
|
6379
|
-
const
|
|
6439
|
+
const fi = $(
|
|
6380
6440
|
async ({ input: e }) => {
|
|
6381
|
-
var
|
|
6441
|
+
var n;
|
|
6382
6442
|
if (!e.endpoint || e.endpoint === "")
|
|
6383
6443
|
throw new Error("No endpoint provided.");
|
|
6384
6444
|
if (e.items.length < 1)
|
|
@@ -6387,51 +6447,64 @@ const li = $(
|
|
|
6387
6447
|
throw new Error("No request document provided.");
|
|
6388
6448
|
if (!e.requestHeaders)
|
|
6389
6449
|
throw new Error("No request headers provided.");
|
|
6450
|
+
let { requestHeaders: t } = e;
|
|
6451
|
+
e.accessToken && (t = {
|
|
6452
|
+
...t,
|
|
6453
|
+
Authorization: `Bearer ${e.accessToken}`
|
|
6454
|
+
});
|
|
6390
6455
|
try {
|
|
6391
|
-
const
|
|
6456
|
+
const s = await fe(
|
|
6392
6457
|
e.endpoint,
|
|
6393
6458
|
e.document,
|
|
6394
6459
|
{ items: e.items },
|
|
6395
|
-
|
|
6460
|
+
t
|
|
6396
6461
|
);
|
|
6397
|
-
if (!((
|
|
6462
|
+
if (!((n = s.quoteAddItem) != null && n.quote))
|
|
6398
6463
|
throw new Error("Could not add items to quote.");
|
|
6399
6464
|
return {
|
|
6400
6465
|
type: "ADD_ITEMS_SUCCESS",
|
|
6401
|
-
quote:
|
|
6402
|
-
itemsAdded:
|
|
6466
|
+
quote: s.quoteAddItem.quote,
|
|
6467
|
+
itemsAdded: s.quoteAddItem.itemsAdded
|
|
6403
6468
|
};
|
|
6404
6469
|
} catch {
|
|
6405
6470
|
throw new Error("Request to add item(s) failed.");
|
|
6406
6471
|
}
|
|
6407
6472
|
}
|
|
6408
|
-
),
|
|
6409
|
-
var
|
|
6473
|
+
), pi = $(async ({ input: e }) => {
|
|
6474
|
+
var n;
|
|
6410
6475
|
if (!e.endpoint || e.endpoint === "")
|
|
6411
6476
|
throw new Error("No endpoint provided.");
|
|
6412
6477
|
if (e.items.length < 1)
|
|
6413
6478
|
throw new Error("No items provided.");
|
|
6479
|
+
let { requestHeaders: t } = e;
|
|
6480
|
+
e.accessToken && (t = {
|
|
6481
|
+
...t,
|
|
6482
|
+
Authorization: `Bearer ${e.accessToken}`
|
|
6483
|
+
});
|
|
6414
6484
|
try {
|
|
6415
|
-
const
|
|
6485
|
+
const s = await fe(
|
|
6416
6486
|
e.endpoint,
|
|
6417
|
-
|
|
6487
|
+
e.document,
|
|
6488
|
+
{ items: e.items },
|
|
6489
|
+
t
|
|
6490
|
+
// ''
|
|
6418
6491
|
// input.document,
|
|
6419
6492
|
// { items: input.items },
|
|
6420
6493
|
// input.requestHeaders
|
|
6421
6494
|
);
|
|
6422
|
-
if (!((
|
|
6495
|
+
if (!((n = s.quoteRemoveItem) != null && n.quote))
|
|
6423
6496
|
throw new Error("Could not remove items from quote.");
|
|
6424
6497
|
return {
|
|
6425
6498
|
type: "REMOVE_ITEMS_SUCCESS",
|
|
6426
|
-
quote:
|
|
6427
|
-
itemsRemoved:
|
|
6499
|
+
quote: s.quoteRemoveItem.quote,
|
|
6500
|
+
itemsRemoved: s.quoteRemoveItem.itemsRemoved
|
|
6428
6501
|
};
|
|
6429
6502
|
} catch {
|
|
6430
6503
|
throw new Error("Request to remove item(s) failed.");
|
|
6431
6504
|
}
|
|
6432
|
-
}), He = typeof window > "u",
|
|
6505
|
+
}), He = typeof window > "u", yi = $(
|
|
6433
6506
|
async ({ input: e }) => {
|
|
6434
|
-
var
|
|
6507
|
+
var s, r, i, o;
|
|
6435
6508
|
if (!e.endpoint)
|
|
6436
6509
|
throw console.log("no endpoint"), new Error("No endpoint provided.");
|
|
6437
6510
|
if (!e.endpointSsr)
|
|
@@ -6450,29 +6523,34 @@ const li = $(
|
|
|
6450
6523
|
mode: "cors"
|
|
6451
6524
|
}
|
|
6452
6525
|
);
|
|
6526
|
+
let n = He ? {
|
|
6527
|
+
...e.requestHeaders,
|
|
6528
|
+
Cookie: `quote_${e.locale}=${e.quoteId ?? ""}`
|
|
6529
|
+
} : e.requestHeaders;
|
|
6530
|
+
e.accessToken && (n = {
|
|
6531
|
+
...n,
|
|
6532
|
+
Authorization: `Bearer ${e.accessToken}`
|
|
6533
|
+
});
|
|
6453
6534
|
try {
|
|
6454
|
-
const { data:
|
|
6535
|
+
const { data: a, headers: c, status: u, errors: f, extensions: l } = await t.rawRequest(
|
|
6455
6536
|
gn(e.document),
|
|
6456
6537
|
{},
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
} : e.requestHeaders
|
|
6461
|
-
), d = o;
|
|
6462
|
-
if (!((n = d.refreshQuote) != null && n.quote))
|
|
6538
|
+
n
|
|
6539
|
+
), h = a;
|
|
6540
|
+
if (!((s = h.refreshQuote) != null && s.quote))
|
|
6463
6541
|
throw console.log(
|
|
6464
6542
|
"userError: ",
|
|
6465
|
-
(
|
|
6466
|
-
(
|
|
6467
|
-
(
|
|
6543
|
+
(r = h.refreshQuote) == null ? void 0 : r.userErrors[0].code,
|
|
6544
|
+
(i = h.refreshQuote) == null ? void 0 : i.userErrors[0].field,
|
|
6545
|
+
(o = h.refreshQuote) == null ? void 0 : o.userErrors[0].message
|
|
6468
6546
|
), new Error("Could not add items to quote.");
|
|
6469
|
-
return { type: "REFRESH_SUCCESS", quote:
|
|
6470
|
-
} catch (
|
|
6471
|
-
throw console.log("refresh error",
|
|
6547
|
+
return { type: "REFRESH_SUCCESS", quote: h.refreshQuote.quote };
|
|
6548
|
+
} catch (a) {
|
|
6549
|
+
throw console.log("refresh error", a), new Error("Request to add item(s) failed.");
|
|
6472
6550
|
}
|
|
6473
6551
|
}
|
|
6474
|
-
),
|
|
6475
|
-
var
|
|
6552
|
+
), mi = $(async ({ input: e }) => {
|
|
6553
|
+
var n;
|
|
6476
6554
|
if (!e.endpoint || e.endpoint === "")
|
|
6477
6555
|
throw new Error("No endpoint provided.");
|
|
6478
6556
|
if (e.items.length < 1)
|
|
@@ -6481,24 +6559,29 @@ const li = $(
|
|
|
6481
6559
|
throw new Error("No request document provided.");
|
|
6482
6560
|
if (!e.requestHeaders)
|
|
6483
6561
|
throw new Error("No request headers provided.");
|
|
6562
|
+
let { requestHeaders: t } = e;
|
|
6563
|
+
e.accessToken && (t = {
|
|
6564
|
+
...t,
|
|
6565
|
+
Authorization: `Bearer ${e.accessToken}`
|
|
6566
|
+
});
|
|
6484
6567
|
try {
|
|
6485
|
-
const
|
|
6568
|
+
const s = await fe(
|
|
6486
6569
|
e.endpoint,
|
|
6487
6570
|
e.document,
|
|
6488
6571
|
{ items: e.items },
|
|
6489
|
-
|
|
6572
|
+
t
|
|
6490
6573
|
);
|
|
6491
|
-
if (!((
|
|
6574
|
+
if (!((n = s.quoteUpdateItem) != null && n.quote))
|
|
6492
6575
|
throw new Error("Could not add items to quote.");
|
|
6493
6576
|
return {
|
|
6494
6577
|
type: "UPDATE_ITEMS_SUCCESS",
|
|
6495
|
-
quote:
|
|
6496
|
-
itemsUpdated:
|
|
6578
|
+
quote: s.quoteUpdateItem.quote,
|
|
6579
|
+
itemsUpdated: s.quoteUpdateItem.itemsUpdated
|
|
6497
6580
|
};
|
|
6498
6581
|
} catch {
|
|
6499
6582
|
throw new Error("Request to add item(s) failed.");
|
|
6500
6583
|
}
|
|
6501
|
-
}),
|
|
6584
|
+
}), gi = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", Ei = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Pt = he({
|
|
6502
6585
|
types: {
|
|
6503
6586
|
context: {},
|
|
6504
6587
|
emitted: {},
|
|
@@ -6506,34 +6589,36 @@ const li = $(
|
|
|
6506
6589
|
input: {}
|
|
6507
6590
|
},
|
|
6508
6591
|
actions: {
|
|
6509
|
-
addItems: x(
|
|
6510
|
-
notifyAddItems:
|
|
6511
|
-
notifyRemoveItems:
|
|
6512
|
-
notifyUpdateItems:
|
|
6513
|
-
removeItems: x(
|
|
6514
|
-
refresh: x(
|
|
6515
|
-
reset: x(
|
|
6516
|
-
|
|
6592
|
+
addItems: x(ri),
|
|
6593
|
+
notifyAddItems: ve(ii),
|
|
6594
|
+
notifyRemoveItems: ve(oi),
|
|
6595
|
+
notifyUpdateItems: ve(ai),
|
|
6596
|
+
removeItems: x(ci),
|
|
6597
|
+
refresh: x(ui),
|
|
6598
|
+
reset: x(di),
|
|
6599
|
+
syncAccessToken: x(li),
|
|
6600
|
+
updateItems: x(hi)
|
|
6517
6601
|
},
|
|
6518
6602
|
actors: {
|
|
6519
|
-
addItems:
|
|
6520
|
-
removeItems:
|
|
6521
|
-
refresh:
|
|
6522
|
-
updateItems:
|
|
6603
|
+
addItems: fi,
|
|
6604
|
+
removeItems: pi,
|
|
6605
|
+
refresh: yi,
|
|
6606
|
+
updateItems: mi
|
|
6523
6607
|
},
|
|
6524
6608
|
guards: {
|
|
6525
|
-
canRefresh:
|
|
6526
|
-
hasItems:
|
|
6609
|
+
canRefresh: gi,
|
|
6610
|
+
hasItems: Ei
|
|
6527
6611
|
}
|
|
6528
6612
|
}).createMachine({
|
|
6529
6613
|
/** @todo do we need to add the view to the id? (e.g. quote_en-us) */
|
|
6530
6614
|
id: "quote",
|
|
6531
6615
|
initial: "initializing",
|
|
6532
6616
|
context: ({ input: e }) => {
|
|
6533
|
-
var t, n, s, r, i, o, a, c, u,
|
|
6617
|
+
var t, n, s, r, i, o, a, c, u, f, l, h, m, y, T, _, w, R, O, q, P, H, z, L, pe, ye;
|
|
6534
6618
|
return {
|
|
6535
6619
|
quote: {
|
|
6536
6620
|
id: "",
|
|
6621
|
+
accessToken: "",
|
|
6537
6622
|
locale: "",
|
|
6538
6623
|
baseCurrency: "USD",
|
|
6539
6624
|
currencyConversionRate: 1,
|
|
@@ -6597,12 +6682,12 @@ const li = $(
|
|
|
6597
6682
|
requestHeaders: ((c = (a = (o = e == null ? void 0 : e.initialContext) == null ? void 0 : o.graphql) == null ? void 0 : a.refresh) == null ? void 0 : c.requestHeaders) ?? void 0
|
|
6598
6683
|
},
|
|
6599
6684
|
addItems: {
|
|
6600
|
-
document: ((
|
|
6601
|
-
requestHeaders: ((y = (m = (
|
|
6685
|
+
document: ((l = (f = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : f.addItems) == null ? void 0 : l.document) ?? "",
|
|
6686
|
+
requestHeaders: ((y = (m = (h = e == null ? void 0 : e.initialContext) == null ? void 0 : h.graphql) == null ? void 0 : m.addItems) == null ? void 0 : y.requestHeaders) ?? void 0
|
|
6602
6687
|
},
|
|
6603
6688
|
removeItems: {
|
|
6604
|
-
document: ((w = (_ = (
|
|
6605
|
-
requestHeaders: ((q = (
|
|
6689
|
+
document: ((w = (_ = (T = e == null ? void 0 : e.initialContext) == null ? void 0 : T.graphql) == null ? void 0 : _.removeItems) == null ? void 0 : w.document) ?? "",
|
|
6690
|
+
requestHeaders: ((q = (O = (R = e == null ? void 0 : e.initialContext) == null ? void 0 : R.graphql) == null ? void 0 : O.removeItems) == null ? void 0 : q.requestHeaders) ?? void 0
|
|
6606
6691
|
},
|
|
6607
6692
|
updateItems: {
|
|
6608
6693
|
document: ((z = (H = (P = e == null ? void 0 : e.initialContext) == null ? void 0 : P.graphql) == null ? void 0 : H.updateItems) == null ? void 0 : z.document) ?? "",
|
|
@@ -6673,6 +6758,7 @@ const li = $(
|
|
|
6673
6758
|
invoke: {
|
|
6674
6759
|
/** @todo is there any way to limit the event to be a known event? */
|
|
6675
6760
|
input: ({ context: e }) => ({
|
|
6761
|
+
accessToken: e.quote.accessToken,
|
|
6676
6762
|
endpoint: e.endpoints.client,
|
|
6677
6763
|
endpointSsr: e.endpoints.server,
|
|
6678
6764
|
quoteId: e.quote.id,
|
|
@@ -6715,6 +6801,7 @@ const li = $(
|
|
|
6715
6801
|
input: ({ context: e, event: t }) => {
|
|
6716
6802
|
var n, s;
|
|
6717
6803
|
return {
|
|
6804
|
+
accessToken: e.quote.accessToken,
|
|
6718
6805
|
endpoint: e.endpoints.client,
|
|
6719
6806
|
items: t.type === "ADD_ITEMS" ? t.items : [],
|
|
6720
6807
|
document: (n = e.graphql.addItems) == null ? void 0 : n.document,
|
|
@@ -6750,6 +6837,7 @@ const li = $(
|
|
|
6750
6837
|
input: ({ context: e, event: t }) => {
|
|
6751
6838
|
var n, s;
|
|
6752
6839
|
return {
|
|
6840
|
+
accessToken: e.quote.accessToken,
|
|
6753
6841
|
endpoint: e.endpoints.client,
|
|
6754
6842
|
items: t.type === "REMOVE_ITEMS" ? t.items : [],
|
|
6755
6843
|
document: (n = e.graphql.removeItems) == null ? void 0 : n.document,
|
|
@@ -6791,6 +6879,7 @@ const li = $(
|
|
|
6791
6879
|
input: ({ context: e, event: t }) => {
|
|
6792
6880
|
var n, s;
|
|
6793
6881
|
return {
|
|
6882
|
+
accessToken: e.quote.accessToken,
|
|
6794
6883
|
endpoint: e.endpoints.client,
|
|
6795
6884
|
items: t.type === "UPDATE_ITEMS" ? t.items : [],
|
|
6796
6885
|
document: (n = e.graphql.updateItems) == null ? void 0 : n.document,
|
|
@@ -6887,16 +6976,21 @@ const li = $(
|
|
|
6887
6976
|
// addingGiftCard: {},
|
|
6888
6977
|
// removingGiftCard: {},
|
|
6889
6978
|
// applyingSettings: {},
|
|
6979
|
+
},
|
|
6980
|
+
on: {
|
|
6981
|
+
SYNC_ACCESS_TOKEN: {
|
|
6982
|
+
actions: ["syncAccessToken"]
|
|
6983
|
+
}
|
|
6890
6984
|
}
|
|
6891
|
-
}), Sn =
|
|
6985
|
+
}), Sn = ke(
|
|
6892
6986
|
{}
|
|
6893
|
-
),
|
|
6987
|
+
), Ni = () => {
|
|
6894
6988
|
var c;
|
|
6895
|
-
const e =
|
|
6989
|
+
const e = Ne(Sn);
|
|
6896
6990
|
if (!e || !e.getSnapshot)
|
|
6897
6991
|
throw new Error("quoteActor is not properly initialized");
|
|
6898
|
-
const [t, n] =
|
|
6899
|
-
|
|
6992
|
+
const [t, n] = Oe(() => e.getSnapshot());
|
|
6993
|
+
De(() => {
|
|
6900
6994
|
if (!e || !e.getSnapshot) {
|
|
6901
6995
|
console.error("quoteActor is not properly initialized");
|
|
6902
6996
|
return;
|
|
@@ -6904,11 +6998,11 @@ const li = $(
|
|
|
6904
6998
|
(() => {
|
|
6905
6999
|
n(e.getSnapshot());
|
|
6906
7000
|
})();
|
|
6907
|
-
const
|
|
6908
|
-
n(
|
|
7001
|
+
const f = e.subscribe((l) => {
|
|
7002
|
+
n(l);
|
|
6909
7003
|
});
|
|
6910
7004
|
return () => {
|
|
6911
|
-
|
|
7005
|
+
f.unsubscribe();
|
|
6912
7006
|
};
|
|
6913
7007
|
}, [e]);
|
|
6914
7008
|
const s = t.context.quote.items ?? [], r = ((c = t.context.quote.items) == null ? void 0 : c.length) ?? 0, i = t.matches("addingItems"), o = t.matches("removingItems"), a = t.matches("addingItems") || t.matches("removingItems");
|
|
@@ -6940,35 +7034,34 @@ const li = $(
|
|
|
6940
7034
|
endpoints: e.endpoints,
|
|
6941
7035
|
graphql: e.graphql,
|
|
6942
7036
|
quote: {
|
|
6943
|
-
|
|
6944
|
-
locale: e.quote.locale ?? ""
|
|
7037
|
+
...e.quote
|
|
6945
7038
|
}
|
|
6946
7039
|
}
|
|
6947
7040
|
},
|
|
6948
7041
|
inspect: e.inspect
|
|
6949
7042
|
}).start();
|
|
6950
|
-
function
|
|
6951
|
-
return /* @__PURE__ */
|
|
7043
|
+
function Di({ actor: e, children: t }) {
|
|
7044
|
+
return /* @__PURE__ */ Ce(Sn.Provider, { value: e, children: t });
|
|
6952
7045
|
}
|
|
6953
7046
|
export {
|
|
6954
7047
|
on as AuthContext,
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
7048
|
+
Ii as AuthProvider,
|
|
7049
|
+
Tn as CheckoutContext,
|
|
7050
|
+
xi as CheckoutProvider,
|
|
6958
7051
|
Sn as QuoteContext,
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
7052
|
+
Di as QuoteProvider,
|
|
7053
|
+
vn as ToastContext,
|
|
7054
|
+
ki as ToastProvider,
|
|
7055
|
+
Gs as authMachine,
|
|
6963
7056
|
Ut as checkoutMachine,
|
|
6964
|
-
|
|
6965
|
-
|
|
7057
|
+
_i as getAuth,
|
|
7058
|
+
wi as getCheckout,
|
|
6966
7059
|
Oi as getQuote,
|
|
6967
7060
|
Pt as quoteMachine,
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
7061
|
+
si as timerMachine,
|
|
7062
|
+
bi as toastMachine,
|
|
7063
|
+
Si as useAuth,
|
|
7064
|
+
Ai as useCheckout,
|
|
7065
|
+
Ni as useQuote,
|
|
7066
|
+
Ci as useToast
|
|
6974
7067
|
};
|