@clicktap/state 0.13.12 → 0.13.14
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/index.js +18 -18
- package/index.mjs +518 -526
- package/package.json +3 -3
- package/quote/QuoteProvider.d.ts +100 -3
- package/quote/actions/addItems.d.ts +47 -45
- package/quote/actions/removeItems.d.ts +47 -45
- package/quote/quote.d.ts +1 -1
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as Ge } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ze, useContext as Je, useState as Dt, useEffect as Rt, cloneElement as Tn } from "react";
|
|
3
3
|
function _n(e, t) {
|
|
4
4
|
for (var n = 0; n < t.length; n++) {
|
|
5
5
|
const s = t[n];
|
|
@@ -37,7 +37,7 @@ const xn = (e) => {
|
|
|
37
37
|
const t = Sn();
|
|
38
38
|
t && t.register(e);
|
|
39
39
|
};
|
|
40
|
-
class
|
|
40
|
+
class at {
|
|
41
41
|
constructor(t) {
|
|
42
42
|
this._process = t, this._active = !1, this._current = null, this._last = null;
|
|
43
43
|
}
|
|
@@ -66,13 +66,13 @@ class ct {
|
|
|
66
66
|
this._last = null;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const Lt = ".", An = "", Mt = "", wn = "#", bn = "*", Pt = "xstate.init", On = "xstate.error",
|
|
69
|
+
const Lt = ".", An = "", Mt = "", wn = "#", bn = "*", Pt = "xstate.init", On = "xstate.error", ae = "xstate.stop";
|
|
70
70
|
function Nn(e, t) {
|
|
71
71
|
return {
|
|
72
72
|
type: `xstate.after.${e}.${t}`
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function qe(e, t) {
|
|
76
76
|
return {
|
|
77
77
|
type: `xstate.done.state.${e}`,
|
|
78
78
|
output: t
|
|
@@ -102,7 +102,7 @@ function q(e) {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
const Cn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
|
|
105
|
-
function
|
|
105
|
+
function ct(e, t) {
|
|
106
106
|
return `${e.sessionId}.${t}`;
|
|
107
107
|
}
|
|
108
108
|
let Dn = 0;
|
|
@@ -111,36 +111,36 @@ function Rn(e, t) {
|
|
|
111
111
|
clock: a,
|
|
112
112
|
logger: c
|
|
113
113
|
} = t, u = {
|
|
114
|
-
schedule: (
|
|
114
|
+
schedule: (f, m, y, v, S = Math.random().toString(36).slice(2)) => {
|
|
115
115
|
const A = {
|
|
116
|
-
source:
|
|
116
|
+
source: f,
|
|
117
117
|
target: m,
|
|
118
118
|
event: y,
|
|
119
119
|
delay: v,
|
|
120
120
|
id: S,
|
|
121
121
|
startedAt: Date.now()
|
|
122
|
-
}, R =
|
|
122
|
+
}, R = ct(f, S);
|
|
123
123
|
d._snapshot._scheduledEvents[R] = A;
|
|
124
124
|
const D = a.setTimeout(() => {
|
|
125
|
-
delete o[R], delete d._snapshot._scheduledEvents[R], d._relay(
|
|
125
|
+
delete o[R], delete d._snapshot._scheduledEvents[R], d._relay(f, m, y);
|
|
126
126
|
}, v);
|
|
127
127
|
o[R] = D;
|
|
128
128
|
},
|
|
129
|
-
cancel: (
|
|
130
|
-
const y =
|
|
129
|
+
cancel: (f, m) => {
|
|
130
|
+
const y = ct(f, m), v = o[y];
|
|
131
131
|
delete o[y], delete d._snapshot._scheduledEvents[y], a.clearTimeout(v);
|
|
132
132
|
},
|
|
133
|
-
cancelAll: (
|
|
133
|
+
cancelAll: (f) => {
|
|
134
134
|
for (const m in d._snapshot._scheduledEvents) {
|
|
135
135
|
const y = d._snapshot._scheduledEvents[m];
|
|
136
|
-
y.source ===
|
|
136
|
+
y.source === f && u.cancel(f, y.id);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
},
|
|
139
|
+
}, h = (f) => {
|
|
140
140
|
if (!i.size)
|
|
141
141
|
return;
|
|
142
142
|
const m = {
|
|
143
|
-
...
|
|
143
|
+
...f,
|
|
144
144
|
rootId: e.sessionId
|
|
145
145
|
};
|
|
146
146
|
i.forEach((y) => {
|
|
@@ -152,27 +152,27 @@ function Rn(e, t) {
|
|
|
152
152
|
_scheduledEvents: ((t == null ? void 0 : t.snapshot) && t.snapshot.scheduler) ?? {}
|
|
153
153
|
},
|
|
154
154
|
_bookId: () => `x:${Dn++}`,
|
|
155
|
-
_register: (
|
|
156
|
-
_unregister: (
|
|
157
|
-
n.delete(
|
|
158
|
-
const m = r.get(
|
|
159
|
-
m !== void 0 && (s.delete(m), r.delete(
|
|
155
|
+
_register: (f, m) => (n.set(f, m), f),
|
|
156
|
+
_unregister: (f) => {
|
|
157
|
+
n.delete(f.sessionId);
|
|
158
|
+
const m = r.get(f);
|
|
159
|
+
m !== void 0 && (s.delete(m), r.delete(f));
|
|
160
160
|
},
|
|
161
|
-
get: (
|
|
162
|
-
_set: (
|
|
163
|
-
const y = s.get(
|
|
161
|
+
get: (f) => s.get(f),
|
|
162
|
+
_set: (f, m) => {
|
|
163
|
+
const y = s.get(f);
|
|
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 '${f}' already exists.`);
|
|
166
|
+
s.set(f, m), r.set(m, f);
|
|
167
167
|
},
|
|
168
|
-
inspect: (
|
|
169
|
-
i.add(
|
|
168
|
+
inspect: (f) => {
|
|
169
|
+
i.add(f);
|
|
170
170
|
},
|
|
171
|
-
_sendInspectionEvent:
|
|
172
|
-
_relay: (
|
|
171
|
+
_sendInspectionEvent: h,
|
|
172
|
+
_relay: (f, m, y) => {
|
|
173
173
|
d._sendInspectionEvent({
|
|
174
174
|
type: "@xstate.event",
|
|
175
|
-
sourceRef:
|
|
175
|
+
sourceRef: f,
|
|
176
176
|
actorRef: m,
|
|
177
177
|
event: y
|
|
178
178
|
}), m._send(y);
|
|
@@ -184,16 +184,16 @@ function Rn(e, t) {
|
|
|
184
184
|
}
|
|
185
185
|
}),
|
|
186
186
|
start: () => {
|
|
187
|
-
const
|
|
187
|
+
const f = d._snapshot._scheduledEvents;
|
|
188
188
|
d._snapshot._scheduledEvents = {};
|
|
189
|
-
for (const m in
|
|
189
|
+
for (const m in f) {
|
|
190
190
|
const {
|
|
191
191
|
source: y,
|
|
192
192
|
target: v,
|
|
193
193
|
event: S,
|
|
194
194
|
delay: A,
|
|
195
195
|
id: R
|
|
196
|
-
} =
|
|
196
|
+
} = f[m];
|
|
197
197
|
u.schedule(y, v, S, A, R);
|
|
198
198
|
}
|
|
199
199
|
},
|
|
@@ -203,10 +203,10 @@ function Rn(e, t) {
|
|
|
203
203
|
return d;
|
|
204
204
|
}
|
|
205
205
|
function Ut(e, t) {
|
|
206
|
-
const n =
|
|
206
|
+
const n = ut(e), s = ut(t);
|
|
207
207
|
return typeof s == "string" ? typeof n == "string" ? s === n : !1 : typeof n == "string" ? n in s : Object.keys(n).every((r) => r in s ? Ut(n[r], s[r]) : !1);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function Ye(e) {
|
|
210
210
|
if (jt(e))
|
|
211
211
|
return e;
|
|
212
212
|
let t = [], n = "";
|
|
@@ -223,12 +223,12 @@ function Xe(e) {
|
|
|
223
223
|
}
|
|
224
224
|
return t.push(n), t;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ut(e) {
|
|
227
227
|
if (ds(e))
|
|
228
228
|
return e.value;
|
|
229
229
|
if (typeof e != "string")
|
|
230
230
|
return e;
|
|
231
|
-
const t =
|
|
231
|
+
const t = Ye(e);
|
|
232
232
|
return Ln(t);
|
|
233
233
|
}
|
|
234
234
|
function Ln(e) {
|
|
@@ -245,7 +245,7 @@ function Ln(e) {
|
|
|
245
245
|
}
|
|
246
246
|
return t;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function dt(e, t) {
|
|
249
249
|
const n = {}, s = Object.keys(e);
|
|
250
250
|
for (let r = 0; r < s.length; r++) {
|
|
251
251
|
const i = s[r];
|
|
@@ -259,7 +259,7 @@ function Bt(e) {
|
|
|
259
259
|
function F(e) {
|
|
260
260
|
return e === void 0 ? [] : Bt(e);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function Fe(e, t, n, s) {
|
|
263
263
|
return typeof e == "function" ? e({
|
|
264
264
|
context: t,
|
|
265
265
|
event: n,
|
|
@@ -272,7 +272,7 @@ function jt(e) {
|
|
|
272
272
|
function Mn(e) {
|
|
273
273
|
return e.type.startsWith("xstate.error.actor");
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function X(e) {
|
|
276
276
|
return Bt(e).map((t) => typeof t > "u" || typeof t == "string" ? {
|
|
277
277
|
target: t
|
|
278
278
|
} : t);
|
|
@@ -281,7 +281,7 @@ function $t(e) {
|
|
|
281
281
|
if (!(e === void 0 || e === An))
|
|
282
282
|
return F(e);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function lt(e, t, n) {
|
|
285
285
|
var i, o, a;
|
|
286
286
|
const s = typeof e == "object", r = s ? e : void 0;
|
|
287
287
|
return {
|
|
@@ -290,17 +290,17 @@ function ht(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 ht(e, t) {
|
|
294
294
|
return `${t}.${e}`;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Xe(e, t) {
|
|
297
297
|
const n = t.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
298
298
|
if (!n)
|
|
299
299
|
return e.implementations.actors[t];
|
|
300
300
|
const [, s, r] = n, o = e.getStateNodeById(r).config.invoke;
|
|
301
301
|
return (Array.isArray(o) ? o[s] : o).src;
|
|
302
302
|
}
|
|
303
|
-
const
|
|
303
|
+
const Qe = 1;
|
|
304
304
|
let k = /* @__PURE__ */ function(e) {
|
|
305
305
|
return e[e.NotStarted = 0] = "NotStarted", e[e.Running = 1] = "Running", e[e.Stopped = 2] = "Stopped", e;
|
|
306
306
|
}({});
|
|
@@ -320,7 +320,7 @@ class qn {
|
|
|
320
320
|
* @param options Actor options
|
|
321
321
|
*/
|
|
322
322
|
constructor(t, n) {
|
|
323
|
-
this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new
|
|
323
|
+
this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new at(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = k.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
|
|
324
324
|
const s = {
|
|
325
325
|
...Pn,
|
|
326
326
|
...n
|
|
@@ -331,12 +331,12 @@ class qn {
|
|
|
331
331
|
syncSnapshot: a,
|
|
332
332
|
id: c,
|
|
333
333
|
systemId: u,
|
|
334
|
-
inspect:
|
|
334
|
+
inspect: h
|
|
335
335
|
} = s;
|
|
336
336
|
this.system = o ? o.system : Rn(this, {
|
|
337
337
|
clock: r,
|
|
338
338
|
logger: i
|
|
339
|
-
}),
|
|
339
|
+
}), h && !o && this.system.inspect(lt(h)), 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,
|
|
@@ -351,9 +351,9 @@ class qn {
|
|
|
351
351
|
d._stop();
|
|
352
352
|
},
|
|
353
353
|
emit: (d) => {
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
for (const m of Array.from(
|
|
354
|
+
const f = this.eventListeners.get(d.type);
|
|
355
|
+
if (f)
|
|
356
|
+
for (const m of Array.from(f))
|
|
357
357
|
m(d);
|
|
358
358
|
}
|
|
359
359
|
}, this.send = this.send.bind(this), this.system._sendInspectionEvent({
|
|
@@ -466,7 +466,7 @@ class qn {
|
|
|
466
466
|
*/
|
|
467
467
|
subscribe(t, n, s) {
|
|
468
468
|
var i;
|
|
469
|
-
const r =
|
|
469
|
+
const r = lt(t, n, s);
|
|
470
470
|
if (this._processingStatus !== k.Stopped)
|
|
471
471
|
this.observers.add(r);
|
|
472
472
|
else
|
|
@@ -567,11 +567,11 @@ class qn {
|
|
|
567
567
|
}, this._error(r);
|
|
568
568
|
return;
|
|
569
569
|
}
|
|
570
|
-
this.update(n, t), t.type ===
|
|
570
|
+
this.update(n, t), t.type === ae && (this._stopProcedure(), this._complete());
|
|
571
571
|
}
|
|
572
572
|
_stop() {
|
|
573
573
|
return this._processingStatus === k.Stopped ? this : (this.mailbox.clear(), this._processingStatus === k.NotStarted ? (this._processingStatus = k.Stopped, this) : (this.mailbox.enqueue({
|
|
574
|
-
type:
|
|
574
|
+
type: ae
|
|
575
575
|
}), this));
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
@@ -618,7 +618,7 @@ class qn {
|
|
|
618
618
|
// right now, they are being stopped within the machine's transition
|
|
619
619
|
// but that could throw and leave us with "orphaned" active actors
|
|
620
620
|
_stopProcedure() {
|
|
621
|
-
return this._processingStatus !== k.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new
|
|
621
|
+
return this._processingStatus !== k.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new at(this._process.bind(this)), this._processingStatus = k.Stopped, this.system._unregister(this), this);
|
|
622
622
|
}
|
|
623
623
|
/**
|
|
624
624
|
* @internal
|
|
@@ -642,7 +642,7 @@ class qn {
|
|
|
642
642
|
}
|
|
643
643
|
toJSON() {
|
|
644
644
|
return {
|
|
645
|
-
xstate$$type:
|
|
645
|
+
xstate$$type: Qe,
|
|
646
646
|
id: this.id
|
|
647
647
|
};
|
|
648
648
|
}
|
|
@@ -708,10 +708,10 @@ function jn(e, t, n, s, {
|
|
|
708
708
|
input: a,
|
|
709
709
|
syncSnapshot: c
|
|
710
710
|
}) {
|
|
711
|
-
const u = typeof o == "string" ?
|
|
711
|
+
const u = typeof o == "string" ? Xe(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
|
|
712
712
|
let d;
|
|
713
713
|
return u && (d = U(u, {
|
|
714
|
-
id:
|
|
714
|
+
id: h,
|
|
715
715
|
src: o,
|
|
716
716
|
parent: e.self,
|
|
717
717
|
syncSnapshot: c,
|
|
@@ -724,7 +724,7 @@ function jn(e, t, n, s, {
|
|
|
724
724
|
})), [H(t, {
|
|
725
725
|
children: {
|
|
726
726
|
...t.children,
|
|
727
|
-
[
|
|
727
|
+
[h]: d
|
|
728
728
|
}
|
|
729
729
|
}), {
|
|
730
730
|
id: r,
|
|
@@ -776,14 +776,14 @@ function Vt(e) {
|
|
|
776
776
|
}
|
|
777
777
|
return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Hn, t.execute = Gn, t;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function We(e, t, n, s) {
|
|
780
780
|
const {
|
|
781
781
|
machine: r
|
|
782
782
|
} = s, i = typeof e == "function", o = i ? e : r.implementations.guards[typeof e == "string" ? e : e.type];
|
|
783
783
|
if (!i && !o)
|
|
784
784
|
throw new Error(`Guard '${typeof e == "string" ? e : e.type}' is not implemented.'.`);
|
|
785
785
|
if (typeof o != "function")
|
|
786
|
-
return
|
|
786
|
+
return We(o, t, n, s);
|
|
787
787
|
const a = {
|
|
788
788
|
context: t,
|
|
789
789
|
event: n
|
|
@@ -798,11 +798,11 @@ function Ke(e, t, n, s) {
|
|
|
798
798
|
// this holds all params
|
|
799
799
|
) : o(a, c);
|
|
800
800
|
}
|
|
801
|
-
const
|
|
802
|
-
function
|
|
801
|
+
const Ke = (e) => e.type === "atomic" || e.type === "final";
|
|
802
|
+
function Z(e) {
|
|
803
803
|
return Object.values(e.states).filter((t) => t.type !== "history");
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function ue(e, t) {
|
|
806
806
|
const n = [];
|
|
807
807
|
if (t === e)
|
|
808
808
|
return n;
|
|
@@ -811,15 +811,15 @@ function de(e, t) {
|
|
|
811
811
|
n.push(s), s = s.parent;
|
|
812
812
|
return n;
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function ve(e) {
|
|
815
815
|
const t = new Set(e), n = Gt(t);
|
|
816
816
|
for (const s of t)
|
|
817
817
|
if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
|
|
818
|
-
|
|
818
|
+
ft(s).forEach((r) => t.add(r));
|
|
819
819
|
else if (s.type === "parallel") {
|
|
820
|
-
for (const r of
|
|
820
|
+
for (const r of Z(s))
|
|
821
821
|
if (r.type !== "history" && !t.has(r)) {
|
|
822
|
-
const i =
|
|
822
|
+
const i = ft(r);
|
|
823
823
|
for (const o of i)
|
|
824
824
|
t.add(o);
|
|
825
825
|
}
|
|
@@ -838,7 +838,7 @@ function Ht(e, t) {
|
|
|
838
838
|
if (e.type === "compound") {
|
|
839
839
|
const r = n[0];
|
|
840
840
|
if (r) {
|
|
841
|
-
if (
|
|
841
|
+
if (Ke(r))
|
|
842
842
|
return r.key;
|
|
843
843
|
} else
|
|
844
844
|
return {};
|
|
@@ -855,13 +855,13 @@ function Gt(e) {
|
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
857
|
function zt(e, t) {
|
|
858
|
-
const n =
|
|
858
|
+
const n = ve(t);
|
|
859
859
|
return Ht(e, Gt(n));
|
|
860
860
|
}
|
|
861
|
-
function
|
|
862
|
-
return t.type === "compound" ?
|
|
861
|
+
function Ze(e, t) {
|
|
862
|
+
return t.type === "compound" ? Z(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? Z(t).every((n) => Ze(e, n)) : t.type === "final";
|
|
863
863
|
}
|
|
864
|
-
const
|
|
864
|
+
const Se = (e) => e[0] === wn;
|
|
865
865
|
function zn(e, t) {
|
|
866
866
|
return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
|
|
867
867
|
if (s === bn)
|
|
@@ -894,8 +894,8 @@ function Jn(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 F(a).map((
|
|
898
|
-
...
|
|
897
|
+
return F(a).map((h) => ({
|
|
898
|
+
...h,
|
|
899
899
|
event: u,
|
|
900
900
|
delay: c
|
|
901
901
|
}));
|
|
@@ -933,24 +933,24 @@ function Yn(e) {
|
|
|
933
933
|
if (n === Mt)
|
|
934
934
|
throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
|
|
935
935
|
const s = e.config.on[n];
|
|
936
|
-
t.set(n,
|
|
936
|
+
t.set(n, X(s).map((r) => $(e, n, r)));
|
|
937
937
|
}
|
|
938
938
|
if (e.config.onDone) {
|
|
939
939
|
const n = `xstate.done.state.${e.id}`;
|
|
940
|
-
t.set(n,
|
|
940
|
+
t.set(n, X(e.config.onDone).map((s) => $(e, n, s)));
|
|
941
941
|
}
|
|
942
942
|
for (const n of e.invoke) {
|
|
943
943
|
if (n.onDone) {
|
|
944
944
|
const s = `xstate.done.actor.${n.id}`;
|
|
945
|
-
t.set(s,
|
|
945
|
+
t.set(s, X(n.onDone).map((r) => $(e, s, r)));
|
|
946
946
|
}
|
|
947
947
|
if (n.onError) {
|
|
948
948
|
const s = `xstate.error.actor.${n.id}`;
|
|
949
|
-
t.set(s,
|
|
949
|
+
t.set(s, X(n.onError).map((r) => $(e, s, r)));
|
|
950
950
|
}
|
|
951
951
|
if (n.onSnapshot) {
|
|
952
952
|
const s = `xstate.snapshot.${n.id}`;
|
|
953
|
-
t.set(s,
|
|
953
|
+
t.set(s, X(n.onSnapshot).map((r) => $(e, s, r)));
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
956
|
for (const n of e.after) {
|
|
@@ -982,15 +982,15 @@ function Qn(e, t) {
|
|
|
982
982
|
return t.map((n) => {
|
|
983
983
|
if (typeof n != "string")
|
|
984
984
|
return n;
|
|
985
|
-
if (
|
|
985
|
+
if (Se(n))
|
|
986
986
|
return e.machine.getStateNodeById(n);
|
|
987
987
|
const s = n[0] === Lt;
|
|
988
988
|
if (s && !e.parent)
|
|
989
|
-
return
|
|
989
|
+
return Te(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 Te(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,16 +1002,16 @@ ${i.message}`);
|
|
|
1002
1002
|
function Jt(e) {
|
|
1003
1003
|
const t = $t(e.config.target);
|
|
1004
1004
|
return t ? {
|
|
1005
|
-
target: t.map((n) => typeof n == "string" ?
|
|
1005
|
+
target: t.map((n) => typeof n == "string" ? Te(e.parent, n) : n)
|
|
1006
1006
|
} : e.parent.initial;
|
|
1007
1007
|
}
|
|
1008
1008
|
function V(e) {
|
|
1009
1009
|
return e.type === "history";
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function ft(e) {
|
|
1012
1012
|
const t = Yt(e);
|
|
1013
1013
|
for (const n of t)
|
|
1014
|
-
for (const s of
|
|
1014
|
+
for (const s of ue(n, e))
|
|
1015
1015
|
t.add(s);
|
|
1016
1016
|
return t;
|
|
1017
1017
|
}
|
|
@@ -1022,14 +1022,14 @@ function Yt(e) {
|
|
|
1022
1022
|
if (t.add(s), s.type === "compound")
|
|
1023
1023
|
n(s.initial.target[0]);
|
|
1024
1024
|
else if (s.type === "parallel")
|
|
1025
|
-
for (const r of
|
|
1025
|
+
for (const r of Z(s))
|
|
1026
1026
|
n(r);
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
1029
|
return n(e), t;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1032
|
-
if (
|
|
1031
|
+
function ee(e, t) {
|
|
1032
|
+
if (Se(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,44 +1038,44 @@ function te(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 Te(e, t) {
|
|
1042
|
+
if (typeof t == "string" && Se(t))
|
|
1043
1043
|
try {
|
|
1044
1044
|
return e.machine.getStateNodeById(t);
|
|
1045
1045
|
} catch {
|
|
1046
1046
|
}
|
|
1047
|
-
const n =
|
|
1047
|
+
const n = Ye(t).slice();
|
|
1048
1048
|
let s = e;
|
|
1049
1049
|
for (; n.length; ) {
|
|
1050
1050
|
const r = n.shift();
|
|
1051
1051
|
if (!r.length)
|
|
1052
1052
|
break;
|
|
1053
|
-
s =
|
|
1053
|
+
s = ee(s, r);
|
|
1054
1054
|
}
|
|
1055
1055
|
return s;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function _e(e, t) {
|
|
1058
1058
|
if (typeof t == "string") {
|
|
1059
1059
|
const r = e.states[t];
|
|
1060
1060
|
if (!r)
|
|
1061
1061
|
throw new Error(`State '${t}' does not exist on '${e.id}'`);
|
|
1062
1062
|
return [e, r];
|
|
1063
1063
|
}
|
|
1064
|
-
const n = Object.keys(t), s = n.map((r) =>
|
|
1064
|
+
const n = Object.keys(t), s = n.map((r) => ee(e, r)).filter(Boolean);
|
|
1065
1065
|
return [e.machine.root, e].concat(s, n.reduce((r, i) => {
|
|
1066
|
-
const o =
|
|
1066
|
+
const o = ee(e, i);
|
|
1067
1067
|
if (!o)
|
|
1068
1068
|
return r;
|
|
1069
|
-
const a =
|
|
1069
|
+
const a = _e(o, t[i]);
|
|
1070
1070
|
return r.concat(a);
|
|
1071
1071
|
}, []));
|
|
1072
1072
|
}
|
|
1073
1073
|
function Wn(e, t, n, s) {
|
|
1074
|
-
const i =
|
|
1074
|
+
const i = ee(e, t).next(n, s);
|
|
1075
1075
|
return !i || !i.length ? e.next(n, s) : i;
|
|
1076
1076
|
}
|
|
1077
1077
|
function Kn(e, t, n, s) {
|
|
1078
|
-
const r = Object.keys(t), i =
|
|
1078
|
+
const r = Object.keys(t), i = ee(e, r[0]), o = et(i, t[r[0]], n, s);
|
|
1079
1079
|
return !o || !o.length ? e.next(n, s) : o;
|
|
1080
1080
|
}
|
|
1081
1081
|
function Zn(e, t, n, s) {
|
|
@@ -1084,12 +1084,12 @@ function Zn(e, t, n, s) {
|
|
|
1084
1084
|
const o = t[i];
|
|
1085
1085
|
if (!o)
|
|
1086
1086
|
continue;
|
|
1087
|
-
const a =
|
|
1087
|
+
const a = ee(e, i), c = et(a, o, n, s);
|
|
1088
1088
|
c && r.push(...c);
|
|
1089
1089
|
}
|
|
1090
1090
|
return r.length ? r : e.next(n, s);
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function et(e, t, n, s) {
|
|
1093
1093
|
return typeof t == "string" ? Wn(e, t, n, s) : Object.keys(t).length === 1 ? Kn(e, t, n, s) : Zn(e, t, n, s);
|
|
1094
1094
|
}
|
|
1095
1095
|
function es(e) {
|
|
@@ -1117,7 +1117,7 @@ function Xt(e, t, n) {
|
|
|
1117
1117
|
let i = !1;
|
|
1118
1118
|
const o = /* @__PURE__ */ new Set();
|
|
1119
1119
|
for (const a of s)
|
|
1120
|
-
if (ts(
|
|
1120
|
+
if (ts(Ue([r], t, n), Ue([a], t, n)))
|
|
1121
1121
|
if (B(r.source, a.source))
|
|
1122
1122
|
o.add(a);
|
|
1123
1123
|
else {
|
|
@@ -1134,11 +1134,11 @@ function Xt(e, t, n) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
function ns(e) {
|
|
1136
1136
|
const [t, ...n] = e;
|
|
1137
|
-
for (const s of
|
|
1137
|
+
for (const s of ue(t, void 0))
|
|
1138
1138
|
if (n.every((r) => B(r, s)))
|
|
1139
1139
|
return s;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function tt(e, t) {
|
|
1142
1142
|
if (!e.target)
|
|
1143
1143
|
return [];
|
|
1144
1144
|
const n = /* @__PURE__ */ new Set();
|
|
@@ -1148,14 +1148,14 @@ function nt(e, t) {
|
|
|
1148
1148
|
for (const r of t[s.id])
|
|
1149
1149
|
n.add(r);
|
|
1150
1150
|
else
|
|
1151
|
-
for (const r of
|
|
1151
|
+
for (const r of tt(Jt(s), t))
|
|
1152
1152
|
n.add(r);
|
|
1153
1153
|
else
|
|
1154
1154
|
n.add(s);
|
|
1155
1155
|
return [...n];
|
|
1156
1156
|
}
|
|
1157
1157
|
function Qt(e, t) {
|
|
1158
|
-
const n =
|
|
1158
|
+
const n = tt(e, t);
|
|
1159
1159
|
if (!n)
|
|
1160
1160
|
return;
|
|
1161
1161
|
if (!e.reenter && n.every((r) => r === e.source || B(r, e.source)))
|
|
@@ -1166,7 +1166,7 @@ function Qt(e, t) {
|
|
|
1166
1166
|
if (!e.reenter)
|
|
1167
1167
|
return e.source.machine.root;
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function Ue(e, t, n) {
|
|
1170
1170
|
var r;
|
|
1171
1171
|
const s = /* @__PURE__ */ new Set();
|
|
1172
1172
|
for (const i of e)
|
|
@@ -1186,19 +1186,19 @@ function ss(e, t) {
|
|
|
1186
1186
|
return !1;
|
|
1187
1187
|
return !0;
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1189
|
+
function Be(e, t, n, s, r, i) {
|
|
1190
1190
|
if (!e.length)
|
|
1191
1191
|
return t;
|
|
1192
1192
|
const o = new Set(t._nodes);
|
|
1193
1193
|
let a = t.historyValue;
|
|
1194
1194
|
const c = Xt(e, o, a);
|
|
1195
1195
|
let u = t;
|
|
1196
|
-
r || ([u, a] = as(u, s, n, c, o, a, i)), u =
|
|
1197
|
-
const
|
|
1198
|
-
u.status === "done" && (u =
|
|
1196
|
+
r || ([u, a] = as(u, s, n, c, o, a, i)), u = te(u, s, n, c.flatMap((d) => d.actions), i), u = is(u, s, n, c, o, i, a, r);
|
|
1197
|
+
const h = [...o];
|
|
1198
|
+
u.status === "done" && (u = te(u, s, n, h.sort((d, f) => f.order - d.order).flatMap((d) => d.exit), i));
|
|
1199
1199
|
try {
|
|
1200
1200
|
return a === t.historyValue && ss(t._nodes, o) ? u : H(u, {
|
|
1201
|
-
_nodes:
|
|
1201
|
+
_nodes: h,
|
|
1202
1202
|
historyValue: a
|
|
1203
1203
|
});
|
|
1204
1204
|
} catch (d) {
|
|
@@ -1208,32 +1208,32 @@ function je(e, t, n, s, r, i) {
|
|
|
1208
1208
|
function rs(e, t, n, s, r) {
|
|
1209
1209
|
if (s.output === void 0)
|
|
1210
1210
|
return;
|
|
1211
|
-
const i =
|
|
1212
|
-
return
|
|
1211
|
+
const i = qe(r.id, r.output !== void 0 && r.parent ? Fe(r.output, e.context, t, n.self) : void 0);
|
|
1212
|
+
return Fe(s.output, e.context, i, n.self);
|
|
1213
1213
|
}
|
|
1214
1214
|
function is(e, t, n, s, r, i, o, a) {
|
|
1215
1215
|
let c = e;
|
|
1216
|
-
const u = /* @__PURE__ */ new Set(),
|
|
1217
|
-
os(s, o,
|
|
1216
|
+
const u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
|
|
1217
|
+
os(s, o, h, u), a && h.add(e.machine.root);
|
|
1218
1218
|
const d = /* @__PURE__ */ new Set();
|
|
1219
|
-
for (const
|
|
1220
|
-
r.add(
|
|
1219
|
+
for (const f of [...u].sort((m, y) => m.order - y.order)) {
|
|
1220
|
+
r.add(f);
|
|
1221
1221
|
const m = [];
|
|
1222
|
-
m.push(...
|
|
1223
|
-
for (const y of
|
|
1222
|
+
m.push(...f.entry);
|
|
1223
|
+
for (const y of f.invoke)
|
|
1224
1224
|
m.push(Vn(y.src, {
|
|
1225
1225
|
...y,
|
|
1226
1226
|
syncSnapshot: !!y.onSnapshot
|
|
1227
1227
|
}));
|
|
1228
|
-
if (
|
|
1229
|
-
const y =
|
|
1228
|
+
if (h.has(f)) {
|
|
1229
|
+
const y = f.initial.actions;
|
|
1230
1230
|
m.push(...y);
|
|
1231
1231
|
}
|
|
1232
|
-
if (c =
|
|
1233
|
-
const y =
|
|
1234
|
-
let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, S = v ||
|
|
1235
|
-
for ((y == null ? void 0 : y.type) === "compound" && i.push(
|
|
1236
|
-
d.add(v), i.push(
|
|
1232
|
+
if (c = te(c, t, n, m, i, f.invoke.map((y) => y.id)), f.type === "final") {
|
|
1233
|
+
const y = f.parent;
|
|
1234
|
+
let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, S = v || f;
|
|
1235
|
+
for ((y == null ? void 0 : y.type) === "compound" && i.push(qe(y.id, f.output !== void 0 ? Fe(f.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !d.has(v) && Ze(r, v); )
|
|
1236
|
+
d.add(v), i.push(qe(v.id)), S = v, v = v.parent;
|
|
1237
1237
|
if (v)
|
|
1238
1238
|
continue;
|
|
1239
1239
|
c = H(c, {
|
|
@@ -1252,63 +1252,63 @@ function os(e, t, n, s) {
|
|
|
1252
1252
|
(r.source !== a || // we know that the domain can't lie within the source
|
|
1253
1253
|
// if it's different than the source then it's outside of it and it means that the target has to be entered as well
|
|
1254
1254
|
r.source !== i || // reentering transitions always enter the target, even if it's the source itself
|
|
1255
|
-
r.reenter) && (s.add(a), n.add(a)),
|
|
1256
|
-
const o =
|
|
1255
|
+
r.reenter) && (s.add(a), n.add(a)), Q(a, t, n, s);
|
|
1256
|
+
const o = tt(r, t);
|
|
1257
1257
|
for (const a of o) {
|
|
1258
|
-
const c =
|
|
1258
|
+
const c = ue(a, i);
|
|
1259
1259
|
(i == null ? void 0 : i.type) === "parallel" && c.push(i), Wt(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function Q(e, t, n, s) {
|
|
1264
1264
|
var r;
|
|
1265
1265
|
if (V(e))
|
|
1266
1266
|
if (t[e.id]) {
|
|
1267
1267
|
const i = t[e.id];
|
|
1268
1268
|
for (const o of i)
|
|
1269
|
-
s.add(o),
|
|
1269
|
+
s.add(o), Q(o, t, n, s);
|
|
1270
1270
|
for (const o of i)
|
|
1271
|
-
|
|
1271
|
+
Ne(o, e.parent, s, t, n);
|
|
1272
1272
|
} else {
|
|
1273
1273
|
const i = Jt(e);
|
|
1274
1274
|
for (const o of i.target)
|
|
1275
|
-
s.add(o), i === ((r = e.parent) == null ? void 0 : r.initial) && n.add(e.parent),
|
|
1275
|
+
s.add(o), i === ((r = e.parent) == null ? void 0 : r.initial) && n.add(e.parent), Q(o, t, n, s);
|
|
1276
1276
|
for (const o of i.target)
|
|
1277
|
-
|
|
1277
|
+
Ne(o, e.parent, s, t, n);
|
|
1278
1278
|
}
|
|
1279
1279
|
else if (e.type === "compound") {
|
|
1280
1280
|
const [i] = e.initial.target;
|
|
1281
|
-
V(i) || (s.add(i), n.add(i)),
|
|
1281
|
+
V(i) || (s.add(i), n.add(i)), Q(i, t, n, s), Ne(i, e, s, t, n);
|
|
1282
1282
|
} else if (e.type === "parallel")
|
|
1283
|
-
for (const i of
|
|
1284
|
-
[...s].some((o) => B(o, i)) || (V(i) || (s.add(i), n.add(i)),
|
|
1283
|
+
for (const i of Z(e).filter((o) => !V(o)))
|
|
1284
|
+
[...s].some((o) => B(o, i)) || (V(i) || (s.add(i), n.add(i)), Q(i, t, n, s));
|
|
1285
1285
|
}
|
|
1286
1286
|
function Wt(e, t, n, s, r) {
|
|
1287
1287
|
for (const i of s)
|
|
1288
1288
|
if ((!r || B(i, r)) && e.add(i), i.type === "parallel")
|
|
1289
|
-
for (const o of
|
|
1290
|
-
[...e].some((a) => B(a, o)) || (e.add(o),
|
|
1289
|
+
for (const o of Z(i).filter((a) => !V(a)))
|
|
1290
|
+
[...e].some((a) => B(a, o)) || (e.add(o), Q(o, t, n, e));
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1293
|
-
Wt(n, s, r,
|
|
1292
|
+
function Ne(e, t, n, s, r) {
|
|
1293
|
+
Wt(n, s, r, ue(e, t));
|
|
1294
1294
|
}
|
|
1295
1295
|
function as(e, t, n, s, r, i, o) {
|
|
1296
1296
|
let a = e;
|
|
1297
|
-
const c =
|
|
1298
|
-
c.sort((
|
|
1297
|
+
const c = Ue(s, r, i);
|
|
1298
|
+
c.sort((h, d) => d.order - h.order);
|
|
1299
1299
|
let u;
|
|
1300
|
-
for (const
|
|
1301
|
-
for (const d of es(
|
|
1302
|
-
let
|
|
1303
|
-
d.history === "deep" ?
|
|
1300
|
+
for (const h of c)
|
|
1301
|
+
for (const d of es(h)) {
|
|
1302
|
+
let f;
|
|
1303
|
+
d.history === "deep" ? f = (m) => Ke(m) && B(m, h) : f = (m) => m.parent === h, u ?? (u = {
|
|
1304
1304
|
...i
|
|
1305
|
-
}), u[d.id] = Array.from(r).filter(
|
|
1305
|
+
}), u[d.id] = Array.from(r).filter(f);
|
|
1306
1306
|
}
|
|
1307
|
-
for (const
|
|
1308
|
-
a =
|
|
1307
|
+
for (const h of c)
|
|
1308
|
+
a = te(a, t, n, [...h.exit, ...h.invoke.map((d) => Vt(d.id))], o), r.delete(h);
|
|
1309
1309
|
return [a, u || i];
|
|
1310
1310
|
}
|
|
1311
|
-
let
|
|
1311
|
+
let pt = !1;
|
|
1312
1312
|
function Kt(e, t, n, s, r, i) {
|
|
1313
1313
|
const {
|
|
1314
1314
|
machine: o
|
|
@@ -1321,44 +1321,44 @@ function Kt(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: f
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
try {
|
|
1328
|
-
|
|
1328
|
+
pt = h, h(d, f);
|
|
1329
1329
|
} finally {
|
|
1330
|
-
|
|
1330
|
+
pt = !1;
|
|
1331
1331
|
}
|
|
1332
1332
|
};
|
|
1333
|
-
const u = typeof c == "function",
|
|
1333
|
+
const u = typeof c == "function", h = 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 (!h)
|
|
1340
1340
|
continue;
|
|
1341
1341
|
const d = {
|
|
1342
1342
|
context: a.context,
|
|
1343
1343
|
event: t,
|
|
1344
1344
|
self: n.self,
|
|
1345
1345
|
system: n.system
|
|
1346
|
-
},
|
|
1346
|
+
}, f = 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 h)) {
|
|
1351
1351
|
n.self._processingStatus === k.Running ? m() : n.defer(() => {
|
|
1352
1352
|
m();
|
|
1353
1353
|
});
|
|
1354
1354
|
continue;
|
|
1355
1355
|
}
|
|
1356
|
-
const y =
|
|
1356
|
+
const y = h, [v, S, A] = y.resolve(
|
|
1357
1357
|
n,
|
|
1358
1358
|
a,
|
|
1359
1359
|
d,
|
|
1360
|
-
h,
|
|
1361
1360
|
f,
|
|
1361
|
+
h,
|
|
1362
1362
|
// this holds all params
|
|
1363
1363
|
r
|
|
1364
1364
|
);
|
|
@@ -1366,7 +1366,7 @@ function Kt(e, t, n, s, r, i) {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
return a;
|
|
1368
1368
|
}
|
|
1369
|
-
function
|
|
1369
|
+
function te(e, t, n, s, r, i) {
|
|
1370
1370
|
const o = i ? [] : void 0, a = Kt(e, t, n, s, {
|
|
1371
1371
|
internalQueue: r,
|
|
1372
1372
|
deferredActorIds: i
|
|
@@ -1375,20 +1375,20 @@ function ne(e, t, n, s, r, i) {
|
|
|
1375
1375
|
c.retryResolve(n, a, u);
|
|
1376
1376
|
}), a;
|
|
1377
1377
|
}
|
|
1378
|
-
function
|
|
1378
|
+
function ke(e, t, n, s = []) {
|
|
1379
1379
|
let r = e;
|
|
1380
1380
|
const i = [];
|
|
1381
|
-
function o(u,
|
|
1381
|
+
function o(u, h, d) {
|
|
1382
1382
|
n.system._sendInspectionEvent({
|
|
1383
1383
|
type: "@xstate.microstep",
|
|
1384
1384
|
actorRef: n.self,
|
|
1385
|
-
event:
|
|
1385
|
+
event: h,
|
|
1386
1386
|
snapshot: u,
|
|
1387
1387
|
_transitions: d
|
|
1388
1388
|
}), i.push(u);
|
|
1389
1389
|
}
|
|
1390
|
-
if (t.type ===
|
|
1391
|
-
return r = H(
|
|
1390
|
+
if (t.type === ae)
|
|
1391
|
+
return r = H(yt(r, t, n), {
|
|
1392
1392
|
status: "stopped"
|
|
1393
1393
|
}), o(r, t, []), {
|
|
1394
1394
|
snapshot: r,
|
|
@@ -1396,8 +1396,8 @@ function Ce(e, t, n, s = []) {
|
|
|
1396
1396
|
};
|
|
1397
1397
|
let a = t;
|
|
1398
1398
|
if (a.type !== Pt) {
|
|
1399
|
-
const u = a,
|
|
1400
|
-
if (
|
|
1399
|
+
const u = a, h = Mn(u), d = mt(u, r);
|
|
1400
|
+
if (h && !d.length)
|
|
1401
1401
|
return r = H(e, {
|
|
1402
1402
|
status: "error",
|
|
1403
1403
|
error: u.error
|
|
@@ -1405,7 +1405,7 @@ function Ce(e, t, n, s = []) {
|
|
|
1405
1405
|
snapshot: r,
|
|
1406
1406
|
microstates: i
|
|
1407
1407
|
};
|
|
1408
|
-
r =
|
|
1408
|
+
r = Be(
|
|
1409
1409
|
d,
|
|
1410
1410
|
e,
|
|
1411
1411
|
n,
|
|
@@ -1418,33 +1418,33 @@ function Ce(e, t, n, s = []) {
|
|
|
1418
1418
|
let c = !0;
|
|
1419
1419
|
for (; r.status === "active"; ) {
|
|
1420
1420
|
let u = c ? cs(r, a) : [];
|
|
1421
|
-
const
|
|
1421
|
+
const h = u.length ? r : void 0;
|
|
1422
1422
|
if (!u.length) {
|
|
1423
1423
|
if (!s.length)
|
|
1424
1424
|
break;
|
|
1425
|
-
a = s.shift(), u =
|
|
1425
|
+
a = s.shift(), u = mt(a, r);
|
|
1426
1426
|
}
|
|
1427
|
-
r =
|
|
1427
|
+
r = Be(u, r, n, a, !1, s), c = r !== h, o(r, a, u);
|
|
1428
1428
|
}
|
|
1429
|
-
return r.status !== "active" &&
|
|
1429
|
+
return r.status !== "active" && yt(r, a, n), {
|
|
1430
1430
|
snapshot: r,
|
|
1431
1431
|
microstates: i
|
|
1432
1432
|
};
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1435
|
-
return
|
|
1434
|
+
function yt(e, t, n) {
|
|
1435
|
+
return te(e, t, n, Object.values(e.children).map((s) => Vt(s)), []);
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function mt(e, t) {
|
|
1438
1438
|
return t.machine.getTransitionData(t, e);
|
|
1439
1439
|
}
|
|
1440
1440
|
function cs(e, t) {
|
|
1441
|
-
const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(
|
|
1441
|
+
const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(Ke);
|
|
1442
1442
|
for (const r of s)
|
|
1443
1443
|
e:
|
|
1444
|
-
for (const i of [r].concat(
|
|
1444
|
+
for (const i of [r].concat(ue(r, void 0)))
|
|
1445
1445
|
if (i.always) {
|
|
1446
1446
|
for (const o of i.always)
|
|
1447
|
-
if (o.guard === void 0 ||
|
|
1447
|
+
if (o.guard === void 0 || We(o.guard, e.context, t, e)) {
|
|
1448
1448
|
n.add(o);
|
|
1449
1449
|
break e;
|
|
1450
1450
|
}
|
|
@@ -1452,7 +1452,7 @@ function cs(e, t) {
|
|
|
1452
1452
|
return Xt(Array.from(n), new Set(e._nodes), e.historyValue);
|
|
1453
1453
|
}
|
|
1454
1454
|
function us(e, t) {
|
|
1455
|
-
const n =
|
|
1455
|
+
const n = ve(_e(e, t));
|
|
1456
1456
|
return zt(e, [...n]);
|
|
1457
1457
|
}
|
|
1458
1458
|
function ds(e) {
|
|
@@ -1485,7 +1485,7 @@ const ls = function(t) {
|
|
|
1485
1485
|
}, ys = 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 ye(e, t) {
|
|
1489
1489
|
return {
|
|
1490
1490
|
status: e.status,
|
|
1491
1491
|
output: e.output,
|
|
@@ -1505,7 +1505,7 @@ function me(e, t) {
|
|
|
1505
1505
|
};
|
|
1506
1506
|
}
|
|
1507
1507
|
function H(e, t = {}) {
|
|
1508
|
-
return
|
|
1508
|
+
return ye({
|
|
1509
1509
|
...e,
|
|
1510
1510
|
...t
|
|
1511
1511
|
}, e.machine);
|
|
@@ -1520,9 +1520,9 @@ function ms(e, t) {
|
|
|
1520
1520
|
can: a,
|
|
1521
1521
|
hasTag: c,
|
|
1522
1522
|
matches: u,
|
|
1523
|
-
getMeta:
|
|
1523
|
+
getMeta: h,
|
|
1524
1524
|
toJSON: d,
|
|
1525
|
-
...
|
|
1525
|
+
...f
|
|
1526
1526
|
} = e, m = {};
|
|
1527
1527
|
for (const v in i) {
|
|
1528
1528
|
const S = i[v];
|
|
@@ -1534,7 +1534,7 @@ function ms(e, t) {
|
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
1536
1536
|
return {
|
|
1537
|
-
...
|
|
1537
|
+
...f,
|
|
1538
1538
|
context: Zt(o),
|
|
1539
1539
|
children: m
|
|
1540
1540
|
};
|
|
@@ -1548,7 +1548,7 @@ function Zt(e) {
|
|
|
1548
1548
|
t ?? (t = Array.isArray(e) ? e.slice() : {
|
|
1549
1549
|
...e
|
|
1550
1550
|
}), t[n] = {
|
|
1551
|
-
xstate$$type:
|
|
1551
|
+
xstate$$type: Qe,
|
|
1552
1552
|
id: s.id
|
|
1553
1553
|
};
|
|
1554
1554
|
else {
|
|
@@ -1571,16 +1571,16 @@ function gs(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 h;
|
|
1575
1575
|
if (typeof o == "string") {
|
|
1576
1576
|
const d = c && c[o];
|
|
1577
|
-
|
|
1577
|
+
h = typeof d == "function" ? d(n, s) : d;
|
|
1578
1578
|
} else
|
|
1579
|
-
|
|
1580
|
-
return typeof
|
|
1579
|
+
h = typeof o == "function" ? o(n, s) : o;
|
|
1580
|
+
return typeof h != "number" && a.push(u), [t, {
|
|
1581
1581
|
event: u,
|
|
1582
1582
|
id: i,
|
|
1583
|
-
delay:
|
|
1583
|
+
delay: h
|
|
1584
1584
|
}];
|
|
1585
1585
|
}
|
|
1586
1586
|
function Es(e, t) {
|
|
@@ -1602,7 +1602,7 @@ function vs(e, t) {
|
|
|
1602
1602
|
}
|
|
1603
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 = gs, n.execute = Es, n;
|
|
1604
1604
|
}
|
|
1605
|
-
const
|
|
1605
|
+
const gt = /* @__PURE__ */ new WeakMap();
|
|
1606
1606
|
function Ts(e) {
|
|
1607
1607
|
return {
|
|
1608
1608
|
config: e,
|
|
@@ -1614,7 +1614,7 @@ function Ts(e) {
|
|
|
1614
1614
|
receivers: void 0,
|
|
1615
1615
|
dispose: void 0
|
|
1616
1616
|
};
|
|
1617
|
-
|
|
1617
|
+
gt.set(r, o), o.dispose = e({
|
|
1618
1618
|
input: n.input,
|
|
1619
1619
|
system: i,
|
|
1620
1620
|
self: r,
|
|
@@ -1628,8 +1628,8 @@ function Ts(e) {
|
|
|
1628
1628
|
},
|
|
1629
1629
|
transition: (n, s, r) => {
|
|
1630
1630
|
var o, a;
|
|
1631
|
-
const i =
|
|
1632
|
-
return s.type ===
|
|
1631
|
+
const i = gt.get(r.self);
|
|
1632
|
+
return s.type === ae ? (n = {
|
|
1633
1633
|
...n,
|
|
1634
1634
|
status: "stopped",
|
|
1635
1635
|
error: void 0
|
|
@@ -1645,8 +1645,8 @@ function Ts(e) {
|
|
|
1645
1645
|
restoreSnapshot: (n) => n
|
|
1646
1646
|
};
|
|
1647
1647
|
}
|
|
1648
|
-
const
|
|
1649
|
-
function
|
|
1648
|
+
const Et = "xstate.promise.resolve", vt = "xstate.promise.reject", fe = /* @__PURE__ */ new WeakMap();
|
|
1649
|
+
function K(e) {
|
|
1650
1650
|
return {
|
|
1651
1651
|
config: e,
|
|
1652
1652
|
transition: (n, s, r) => {
|
|
@@ -1654,7 +1654,7 @@ function Z(e) {
|
|
|
1654
1654
|
if (n.status !== "active")
|
|
1655
1655
|
return n;
|
|
1656
1656
|
switch (s.type) {
|
|
1657
|
-
case
|
|
1657
|
+
case Et: {
|
|
1658
1658
|
const o = s.data;
|
|
1659
1659
|
return {
|
|
1660
1660
|
...n,
|
|
@@ -1663,15 +1663,15 @@ function Z(e) {
|
|
|
1663
1663
|
input: void 0
|
|
1664
1664
|
};
|
|
1665
1665
|
}
|
|
1666
|
-
case
|
|
1666
|
+
case vt:
|
|
1667
1667
|
return {
|
|
1668
1668
|
...n,
|
|
1669
1669
|
status: "error",
|
|
1670
1670
|
error: s.data,
|
|
1671
1671
|
input: void 0
|
|
1672
1672
|
};
|
|
1673
|
-
case
|
|
1674
|
-
return (i =
|
|
1673
|
+
case ae:
|
|
1674
|
+
return (i = fe.get(r.self)) == null || i.abort(), {
|
|
1675
1675
|
...n,
|
|
1676
1676
|
status: "stopped",
|
|
1677
1677
|
input: void 0
|
|
@@ -1687,19 +1687,19 @@ function Z(e) {
|
|
|
1687
1687
|
if (n.status !== "active")
|
|
1688
1688
|
return;
|
|
1689
1689
|
const i = new AbortController();
|
|
1690
|
-
|
|
1690
|
+
fe.set(s, i), Promise.resolve(e({
|
|
1691
1691
|
input: n.input,
|
|
1692
1692
|
system: r,
|
|
1693
1693
|
self: s,
|
|
1694
1694
|
signal: i.signal
|
|
1695
1695
|
})).then((a) => {
|
|
1696
|
-
s.getSnapshot().status === "active" && (
|
|
1697
|
-
type:
|
|
1696
|
+
s.getSnapshot().status === "active" && (fe.delete(s), r._relay(s, s, {
|
|
1697
|
+
type: Et,
|
|
1698
1698
|
data: a
|
|
1699
1699
|
}));
|
|
1700
1700
|
}, (a) => {
|
|
1701
|
-
s.getSnapshot().status === "active" && (
|
|
1702
|
-
type:
|
|
1701
|
+
s.getSnapshot().status === "active" && (fe.delete(s), r._relay(s, s, {
|
|
1702
|
+
type: vt,
|
|
1703
1703
|
data: a
|
|
1704
1704
|
}));
|
|
1705
1705
|
});
|
|
@@ -1724,10 +1724,10 @@ function _s(e, {
|
|
|
1724
1724
|
input: u
|
|
1725
1725
|
} = a;
|
|
1726
1726
|
if (typeof o == "string") {
|
|
1727
|
-
const
|
|
1728
|
-
if (!
|
|
1727
|
+
const h = Xe(t, o);
|
|
1728
|
+
if (!h)
|
|
1729
1729
|
throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
|
|
1730
|
-
const d = U(
|
|
1730
|
+
const d = U(h, {
|
|
1731
1731
|
id: a.id,
|
|
1732
1732
|
parent: e.self,
|
|
1733
1733
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1774,8 +1774,8 @@ function Is(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 h = r[u];
|
|
1778
|
+
a[u] = typeof h == "function" ? h(o, s) : h;
|
|
1779
1779
|
}
|
|
1780
1780
|
const c = Object.assign({}, t.context, a);
|
|
1781
1781
|
return [H(t, {
|
|
@@ -1791,7 +1791,7 @@ function C(e) {
|
|
|
1791
1791
|
}
|
|
1792
1792
|
return t.type = "xstate.assign", t.assignment = e, t.resolve = Is, t;
|
|
1793
1793
|
}
|
|
1794
|
-
let
|
|
1794
|
+
let Tt = /* @__PURE__ */ function(e) {
|
|
1795
1795
|
return e.Parent = "#_parent", e.Internal = "#_internal", e;
|
|
1796
1796
|
}({});
|
|
1797
1797
|
function Ss(e, t, n, s, {
|
|
@@ -1804,23 +1804,23 @@ function Ss(e, t, n, s, {
|
|
|
1804
1804
|
const u = t.machine.implementations.delays;
|
|
1805
1805
|
if (typeof i == "string")
|
|
1806
1806
|
throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);
|
|
1807
|
-
const
|
|
1807
|
+
const h = typeof i == "function" ? i(n, s) : i;
|
|
1808
1808
|
let d;
|
|
1809
1809
|
if (typeof a == "string") {
|
|
1810
1810
|
const v = u && u[a];
|
|
1811
1811
|
d = typeof v == "function" ? v(n, s) : v;
|
|
1812
1812
|
} else
|
|
1813
1813
|
d = typeof a == "function" ? a(n, s) : a;
|
|
1814
|
-
const
|
|
1814
|
+
const f = typeof r == "function" ? r(n, s) : r;
|
|
1815
1815
|
let m;
|
|
1816
|
-
if (typeof
|
|
1817
|
-
if (
|
|
1818
|
-
throw new Error(`Unable to send event to actor '${
|
|
1816
|
+
if (typeof f == "string") {
|
|
1817
|
+
if (f === Tt.Parent ? m = e.self._parent : f === Tt.Internal ? m = e.self : f.startsWith("#_") ? m = t.children[f.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(f) ? f : t.children[f], !m)
|
|
1818
|
+
throw new Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`);
|
|
1819
1819
|
} else
|
|
1820
|
-
m =
|
|
1820
|
+
m = f || e.self;
|
|
1821
1821
|
return [t, {
|
|
1822
1822
|
to: m,
|
|
1823
|
-
event:
|
|
1823
|
+
event: h,
|
|
1824
1824
|
id: o,
|
|
1825
1825
|
delay: d
|
|
1826
1826
|
}];
|
|
@@ -1849,28 +1849,28 @@ function As(e, t) {
|
|
|
1849
1849
|
);
|
|
1850
1850
|
});
|
|
1851
1851
|
}
|
|
1852
|
-
function
|
|
1852
|
+
function _t(e, t, n) {
|
|
1853
1853
|
function s(r, i) {
|
|
1854
1854
|
}
|
|
1855
1855
|
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 = Ss, s.retryResolve = xs, s.execute = As, s;
|
|
1856
1856
|
}
|
|
1857
|
-
const
|
|
1857
|
+
const It = /* @__PURE__ */ new WeakMap();
|
|
1858
1858
|
function J(e, t, n) {
|
|
1859
|
-
let s =
|
|
1859
|
+
let s = It.get(e);
|
|
1860
1860
|
return s ? t in s || (s[t] = n()) : (s = {
|
|
1861
1861
|
[t]: n()
|
|
1862
|
-
},
|
|
1862
|
+
}, It.set(e, s)), s[t];
|
|
1863
1863
|
}
|
|
1864
|
-
const ws = {},
|
|
1864
|
+
const ws = {}, re = (e) => typeof e == "string" ? {
|
|
1865
1865
|
type: e
|
|
1866
1866
|
} : typeof e == "function" ? "resolve" in e ? {
|
|
1867
1867
|
type: e.type
|
|
1868
1868
|
} : {
|
|
1869
1869
|
type: e.name
|
|
1870
1870
|
} : e;
|
|
1871
|
-
class
|
|
1871
|
+
class nt {
|
|
1872
1872
|
constructor(t, n) {
|
|
1873
|
-
if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Lt), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ?
|
|
1873
|
+
if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Lt), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? dt(this.config.states, (s, r) => new nt(s, {
|
|
1874
1874
|
_parent: this,
|
|
1875
1875
|
_key: r,
|
|
1876
1876
|
_machine: this.machine
|
|
@@ -1880,7 +1880,7 @@ class st {
|
|
|
1880
1880
|
}
|
|
1881
1881
|
/** @internal */
|
|
1882
1882
|
_initialize() {
|
|
1883
|
-
this.transitions = Yn(this), this.config.always && (this.always =
|
|
1883
|
+
this.transitions = Yn(this), this.config.always && (this.always = X(this.config.always).map((t) => $(this, Mt, t))), Object.keys(this.states).forEach((t) => {
|
|
1884
1884
|
this.states[t]._initialize();
|
|
1885
1885
|
});
|
|
1886
1886
|
}
|
|
@@ -1896,25 +1896,25 @@ class st {
|
|
|
1896
1896
|
initial: this.initial ? {
|
|
1897
1897
|
target: this.initial.target,
|
|
1898
1898
|
source: this,
|
|
1899
|
-
actions: this.initial.actions.map(
|
|
1899
|
+
actions: this.initial.actions.map(re),
|
|
1900
1900
|
eventType: null,
|
|
1901
1901
|
reenter: !1,
|
|
1902
1902
|
toJSON: () => ({
|
|
1903
1903
|
target: this.initial.target.map((t) => `#${t.id}`),
|
|
1904
1904
|
source: `#${this.id}`,
|
|
1905
|
-
actions: this.initial.actions.map(
|
|
1905
|
+
actions: this.initial.actions.map(re),
|
|
1906
1906
|
eventType: null
|
|
1907
1907
|
})
|
|
1908
1908
|
} : void 0,
|
|
1909
1909
|
history: this.history,
|
|
1910
|
-
states:
|
|
1910
|
+
states: dt(this.states, (t) => t.definition),
|
|
1911
1911
|
on: this.on,
|
|
1912
1912
|
transitions: [...this.transitions.values()].flat().map((t) => ({
|
|
1913
1913
|
...t,
|
|
1914
|
-
actions: t.actions.map(
|
|
1914
|
+
actions: t.actions.map(re)
|
|
1915
1915
|
})),
|
|
1916
|
-
entry: this.entry.map(
|
|
1917
|
-
exit: this.exit.map(
|
|
1916
|
+
entry: this.entry.map(re),
|
|
1917
|
+
exit: this.exit.map(re),
|
|
1918
1918
|
meta: this.meta,
|
|
1919
1919
|
order: this.order || -1,
|
|
1920
1920
|
output: this.output,
|
|
@@ -1935,7 +1935,7 @@ class st {
|
|
|
1935
1935
|
const {
|
|
1936
1936
|
src: s,
|
|
1937
1937
|
systemId: r
|
|
1938
|
-
} = t, i = t.id ??
|
|
1938
|
+
} = t, i = t.id ?? ht(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${ht(this.id, n)}`;
|
|
1939
1939
|
return {
|
|
1940
1940
|
...t,
|
|
1941
1941
|
src: o,
|
|
@@ -1978,15 +1978,15 @@ class st {
|
|
|
1978
1978
|
const {
|
|
1979
1979
|
guard: c
|
|
1980
1980
|
} = a, u = t.context;
|
|
1981
|
-
let
|
|
1981
|
+
let h = !1;
|
|
1982
1982
|
try {
|
|
1983
|
-
|
|
1983
|
+
h = !c || We(c, u, n, t);
|
|
1984
1984
|
} catch (d) {
|
|
1985
|
-
const
|
|
1986
|
-
throw new Error(`Unable to evaluate guard ${
|
|
1985
|
+
const f = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
|
|
1986
|
+
throw new Error(`Unable to evaluate guard ${f ? `'${f}' ` : ""}in transition for event '${s}' in state node '${this.id}':
|
|
1987
1987
|
${d.message}`);
|
|
1988
1988
|
}
|
|
1989
|
-
if (
|
|
1989
|
+
if (h) {
|
|
1990
1990
|
r.push(...a.actions), i = a;
|
|
1991
1991
|
break;
|
|
1992
1992
|
}
|
|
@@ -2022,14 +2022,14 @@ ${d.message}`);
|
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
2024
|
const bs = "#";
|
|
2025
|
-
class
|
|
2025
|
+
class st {
|
|
2026
2026
|
constructor(t, n) {
|
|
2027
2027
|
this.config = t, this.version = void 0, this.schemas = void 0, this.implementations = void 0, this.__xstatenode = !0, this.idMap = /* @__PURE__ */ new Map(), this.root = void 0, this.id = void 0, this.states = void 0, this.events = void 0, this.__TResolvedTypesMeta = void 0, this.id = t.id || "(machine)", this.implementations = {
|
|
2028
2028
|
actors: (n == null ? void 0 : n.actors) ?? {},
|
|
2029
2029
|
actions: (n == null ? void 0 : n.actions) ?? {},
|
|
2030
2030
|
delays: (n == null ? void 0 : n.delays) ?? {},
|
|
2031
2031
|
guards: (n == null ? void 0 : n.guards) ?? {}
|
|
2032
|
-
}, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new
|
|
2032
|
+
}, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new nt(t, {
|
|
2033
2033
|
_key: this.id,
|
|
2034
2034
|
_machine: this
|
|
2035
2035
|
}), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
|
|
@@ -2050,7 +2050,7 @@ class rt {
|
|
|
2050
2050
|
actors: r,
|
|
2051
2051
|
delays: i
|
|
2052
2052
|
} = this.implementations;
|
|
2053
|
-
return new
|
|
2053
|
+
return new st(this.config, {
|
|
2054
2054
|
actions: {
|
|
2055
2055
|
...n,
|
|
2056
2056
|
...t.actions
|
|
@@ -2070,12 +2070,12 @@ class rt {
|
|
|
2070
2070
|
});
|
|
2071
2071
|
}
|
|
2072
2072
|
resolveState(t) {
|
|
2073
|
-
const n = us(this.root, t.value), s =
|
|
2074
|
-
return
|
|
2073
|
+
const n = us(this.root, t.value), s = ve(_e(this.root, n));
|
|
2074
|
+
return ye({
|
|
2075
2075
|
_nodes: [...s],
|
|
2076
2076
|
context: t.context || {},
|
|
2077
2077
|
children: {},
|
|
2078
|
-
status:
|
|
2078
|
+
status: Ze(s, this.root) ? "done" : t.status || "active",
|
|
2079
2079
|
output: t.output,
|
|
2080
2080
|
error: t.error,
|
|
2081
2081
|
historyValue: t.historyValue
|
|
@@ -2089,7 +2089,7 @@ class rt {
|
|
|
2089
2089
|
* @param event The received event
|
|
2090
2090
|
*/
|
|
2091
2091
|
transition(t, n, s) {
|
|
2092
|
-
return
|
|
2092
|
+
return ke(t, n, s).snapshot;
|
|
2093
2093
|
}
|
|
2094
2094
|
/**
|
|
2095
2095
|
* Determines the next state given the current `state` and `event`.
|
|
@@ -2099,10 +2099,10 @@ class rt {
|
|
|
2099
2099
|
* @param event The received event
|
|
2100
2100
|
*/
|
|
2101
2101
|
microstep(t, n, s) {
|
|
2102
|
-
return
|
|
2102
|
+
return ke(t, n, s).microstates;
|
|
2103
2103
|
}
|
|
2104
2104
|
getTransitionData(t, n) {
|
|
2105
|
-
return
|
|
2105
|
+
return et(this.root, t.value, t, n) || [];
|
|
2106
2106
|
}
|
|
2107
2107
|
/**
|
|
2108
2108
|
* The initial state _before_ evaluating any microsteps.
|
|
@@ -2111,13 +2111,13 @@ class rt {
|
|
|
2111
2111
|
getPreInitialState(t, n, s) {
|
|
2112
2112
|
const {
|
|
2113
2113
|
context: r
|
|
2114
|
-
} = this.config, i =
|
|
2114
|
+
} = this.config, i = ye({
|
|
2115
2115
|
context: typeof r != "function" && r ? r : {},
|
|
2116
2116
|
_nodes: [this.root],
|
|
2117
2117
|
children: {},
|
|
2118
2118
|
status: "active"
|
|
2119
2119
|
}, this);
|
|
2120
|
-
return typeof r == "function" ?
|
|
2120
|
+
return typeof r == "function" ? te(i, n, t, [C(({
|
|
2121
2121
|
spawn: a,
|
|
2122
2122
|
event: c,
|
|
2123
2123
|
self: u
|
|
@@ -2131,7 +2131,7 @@ class rt {
|
|
|
2131
2131
|
* Returns the initial `State` instance, with reference to `self` as an `ActorRef`.
|
|
2132
2132
|
*/
|
|
2133
2133
|
getInitialSnapshot(t, n) {
|
|
2134
|
-
const s = Ft(n), r = [], i = this.getPreInitialState(t, s, r), o =
|
|
2134
|
+
const s = Ft(n), r = [], i = this.getPreInitialState(t, s, r), o = Be([{
|
|
2135
2135
|
target: [...Yt(this.root)],
|
|
2136
2136
|
source: this.root,
|
|
2137
2137
|
reenter: !0,
|
|
@@ -2141,7 +2141,7 @@ class rt {
|
|
|
2141
2141
|
// TODO: fix
|
|
2142
2142
|
}], i, t, s, !0, r), {
|
|
2143
2143
|
snapshot: a
|
|
2144
|
-
} =
|
|
2144
|
+
} = ke(o, s, t, r);
|
|
2145
2145
|
return a;
|
|
2146
2146
|
}
|
|
2147
2147
|
start(t) {
|
|
@@ -2150,10 +2150,10 @@ class rt {
|
|
|
2150
2150
|
});
|
|
2151
2151
|
}
|
|
2152
2152
|
getStateNodeById(t) {
|
|
2153
|
-
const n =
|
|
2153
|
+
const n = Ye(t), s = n.slice(1), r = Se(n[0]) ? n[0].slice(bs.length) : n[0], i = this.idMap.get(r);
|
|
2154
2154
|
if (!i)
|
|
2155
2155
|
throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
|
|
2156
|
-
return
|
|
2156
|
+
return Te(i, s);
|
|
2157
2157
|
}
|
|
2158
2158
|
get definition() {
|
|
2159
2159
|
return this.root.definition;
|
|
@@ -2167,33 +2167,33 @@ class rt {
|
|
|
2167
2167
|
restoreSnapshot(t, n) {
|
|
2168
2168
|
const s = {}, r = t.children;
|
|
2169
2169
|
Object.keys(r).forEach((c) => {
|
|
2170
|
-
const u = r[c],
|
|
2171
|
-
if (!
|
|
2170
|
+
const u = r[c], h = u.snapshot, d = u.src, f = typeof d == "string" ? Xe(this, d) : d;
|
|
2171
|
+
if (!f)
|
|
2172
2172
|
return;
|
|
2173
|
-
const m = U(
|
|
2173
|
+
const m = U(f, {
|
|
2174
2174
|
id: c,
|
|
2175
2175
|
parent: n.self,
|
|
2176
2176
|
syncSnapshot: u.syncSnapshot,
|
|
2177
|
-
snapshot:
|
|
2177
|
+
snapshot: h,
|
|
2178
2178
|
src: d,
|
|
2179
2179
|
systemId: u.systemId
|
|
2180
2180
|
});
|
|
2181
2181
|
s[c] = m;
|
|
2182
2182
|
});
|
|
2183
|
-
const i =
|
|
2183
|
+
const i = ye({
|
|
2184
2184
|
...t,
|
|
2185
2185
|
children: s,
|
|
2186
|
-
_nodes: Array.from(
|
|
2186
|
+
_nodes: Array.from(ve(_e(this.root, t.value)))
|
|
2187
2187
|
}, this);
|
|
2188
2188
|
let o = /* @__PURE__ */ new Set();
|
|
2189
2189
|
function a(c, u) {
|
|
2190
2190
|
if (!o.has(c)) {
|
|
2191
2191
|
o.add(c);
|
|
2192
|
-
for (let
|
|
2193
|
-
const d = c[
|
|
2192
|
+
for (let h in c) {
|
|
2193
|
+
const d = c[h];
|
|
2194
2194
|
if (d && typeof d == "object") {
|
|
2195
|
-
if ("xstate$$type" in d && d.xstate$$type ===
|
|
2196
|
-
c[
|
|
2195
|
+
if ("xstate$$type" in d && d.xstate$$type === Qe) {
|
|
2196
|
+
c[h] = u[d.id];
|
|
2197
2197
|
continue;
|
|
2198
2198
|
}
|
|
2199
2199
|
a(d, u);
|
|
@@ -2205,9 +2205,9 @@ class rt {
|
|
|
2205
2205
|
}
|
|
2206
2206
|
}
|
|
2207
2207
|
function Os(e, t) {
|
|
2208
|
-
return new
|
|
2208
|
+
return new st(e, t);
|
|
2209
2209
|
}
|
|
2210
|
-
function
|
|
2210
|
+
function xe({
|
|
2211
2211
|
schemas: e,
|
|
2212
2212
|
actors: t,
|
|
2213
2213
|
actions: n,
|
|
@@ -2226,14 +2226,14 @@ function Ae({
|
|
|
2226
2226
|
})
|
|
2227
2227
|
};
|
|
2228
2228
|
}
|
|
2229
|
-
async function
|
|
2229
|
+
async function Ce(e, t) {
|
|
2230
2230
|
const n = await fetch(e, t);
|
|
2231
2231
|
return n.status === 200 ? n.json() : Promise.resolve({
|
|
2232
2232
|
message: n.statusText,
|
|
2233
2233
|
success: !1
|
|
2234
2234
|
});
|
|
2235
2235
|
}
|
|
2236
|
-
const
|
|
2236
|
+
const St = xe({
|
|
2237
2237
|
types: {
|
|
2238
2238
|
context: {},
|
|
2239
2239
|
events: {},
|
|
@@ -2301,13 +2301,13 @@ const xt = Ae({
|
|
|
2301
2301
|
// },
|
|
2302
2302
|
},
|
|
2303
2303
|
actors: {
|
|
2304
|
-
refreshAccessToken:
|
|
2304
|
+
refreshAccessToken: K(async ({ input: e }) => {
|
|
2305
2305
|
let t;
|
|
2306
2306
|
if (typeof window > "u") {
|
|
2307
2307
|
if (e.context.refreshToken === "")
|
|
2308
2308
|
throw new Error("Unauthorized.");
|
|
2309
2309
|
try {
|
|
2310
|
-
const s = await
|
|
2310
|
+
const s = await Ce(
|
|
2311
2311
|
e.context.endpoints.ssrRefresh,
|
|
2312
2312
|
{
|
|
2313
2313
|
method: "POST",
|
|
@@ -2331,7 +2331,7 @@ const xt = Ae({
|
|
|
2331
2331
|
throw console.log(n), new Error("Could not complete refresh request (server)");
|
|
2332
2332
|
}
|
|
2333
2333
|
} else {
|
|
2334
|
-
t = await
|
|
2334
|
+
t = await Ce(
|
|
2335
2335
|
e.context.endpoints.refresh,
|
|
2336
2336
|
{
|
|
2337
2337
|
method: "POST",
|
|
@@ -2359,9 +2359,9 @@ const xt = Ae({
|
|
|
2359
2359
|
};
|
|
2360
2360
|
}
|
|
2361
2361
|
}),
|
|
2362
|
-
authenticate:
|
|
2362
|
+
authenticate: K(async ({ input: e }) => {
|
|
2363
2363
|
var s;
|
|
2364
|
-
const n = await
|
|
2364
|
+
const n = await Ce(
|
|
2365
2365
|
e.context.endpoints.login,
|
|
2366
2366
|
{
|
|
2367
2367
|
method: "POST",
|
|
@@ -2388,7 +2388,7 @@ const xt = Ae({
|
|
|
2388
2388
|
accessToken: n.accessToken
|
|
2389
2389
|
};
|
|
2390
2390
|
}),
|
|
2391
|
-
unauthenticate:
|
|
2391
|
+
unauthenticate: K(async ({ input: e }) => (await fetch(e.context.endpoints.logout, {
|
|
2392
2392
|
method: "POST",
|
|
2393
2393
|
mode: "cors",
|
|
2394
2394
|
credentials: "include",
|
|
@@ -2530,10 +2530,10 @@ const xt = Ae({
|
|
|
2530
2530
|
// },
|
|
2531
2531
|
// },
|
|
2532
2532
|
}
|
|
2533
|
-
}), en =
|
|
2533
|
+
}), en = ze(
|
|
2534
2534
|
{}
|
|
2535
2535
|
), jr = () => {
|
|
2536
|
-
const e =
|
|
2536
|
+
const e = Je(en), [t, n] = Dt(
|
|
2537
2537
|
typeof window < "u" && e.getSnapshot().value === "loggedIn"
|
|
2538
2538
|
);
|
|
2539
2539
|
return Rt(() => {
|
|
@@ -2551,14 +2551,14 @@ const xt = Ae({
|
|
|
2551
2551
|
endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
|
|
2552
2552
|
}) => typeof window < "u" ? (console.warn(
|
|
2553
2553
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
2554
|
-
), U(
|
|
2554
|
+
), U(St, {
|
|
2555
2555
|
inspect: t.inspect,
|
|
2556
2556
|
input: {
|
|
2557
2557
|
initialContext: {
|
|
2558
2558
|
endpoints: t.endpoints
|
|
2559
2559
|
}
|
|
2560
2560
|
}
|
|
2561
|
-
}).start()) : U(
|
|
2561
|
+
}).start()) : U(St, {
|
|
2562
2562
|
input: {
|
|
2563
2563
|
initialContext: {
|
|
2564
2564
|
endpoints: t.endpoints,
|
|
@@ -2568,10 +2568,10 @@ const xt = Ae({
|
|
|
2568
2568
|
inspect: t.inspect
|
|
2569
2569
|
}).start();
|
|
2570
2570
|
function Vr({ actor: e, children: t }) {
|
|
2571
|
-
return /* @__PURE__ */
|
|
2571
|
+
return /* @__PURE__ */ Ge(en.Provider, { value: e, children: t });
|
|
2572
2572
|
}
|
|
2573
2573
|
let Ns = (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), "");
|
|
2574
|
-
const ks =
|
|
2574
|
+
const ks = xe({
|
|
2575
2575
|
actors: {
|
|
2576
2576
|
tick: Ts(
|
|
2577
2577
|
({ sendBack: e, input: t }) => {
|
|
@@ -2649,7 +2649,7 @@ const ks = Ae({
|
|
|
2649
2649
|
type: "final"
|
|
2650
2650
|
}
|
|
2651
2651
|
}
|
|
2652
|
-
}), Hr =
|
|
2652
|
+
}), Hr = xe({
|
|
2653
2653
|
actors: {
|
|
2654
2654
|
timer: ks
|
|
2655
2655
|
},
|
|
@@ -2741,11 +2741,11 @@ const ks = Ae({
|
|
|
2741
2741
|
target: "idle"
|
|
2742
2742
|
},
|
|
2743
2743
|
RESUME_TIMER: {
|
|
2744
|
-
actions:
|
|
2744
|
+
actions: _t("timer", { type: "RESUME_TIMER" })
|
|
2745
2745
|
// cond: (context) => context.duration > 0,
|
|
2746
2746
|
},
|
|
2747
2747
|
PAUSE_TIMER: {
|
|
2748
|
-
actions:
|
|
2748
|
+
actions: _t("timer", { type: "PAUSE_TIMER" })
|
|
2749
2749
|
// cond: (context) => context.duration > 0,
|
|
2750
2750
|
}
|
|
2751
2751
|
}
|
|
@@ -2779,12 +2779,12 @@ const ks = Ae({
|
|
|
2779
2779
|
}
|
|
2780
2780
|
}
|
|
2781
2781
|
}
|
|
2782
|
-
}), tn =
|
|
2782
|
+
}), tn = ze({}), Gr = () => Je(tn);
|
|
2783
2783
|
function zr({
|
|
2784
2784
|
children: e,
|
|
2785
2785
|
actor: t
|
|
2786
2786
|
}) {
|
|
2787
|
-
return /* @__PURE__ */
|
|
2787
|
+
return /* @__PURE__ */ Ge(tn.Provider, { value: t, children: e });
|
|
2788
2788
|
}
|
|
2789
2789
|
function Cs({
|
|
2790
2790
|
context: e,
|
|
@@ -2794,8 +2794,7 @@ function Cs({
|
|
|
2794
2794
|
return e;
|
|
2795
2795
|
const n = t;
|
|
2796
2796
|
return n.output.type !== "ADD_ITEMS_SUCCESS" ? e : {
|
|
2797
|
-
...e.quote,
|
|
2798
|
-
...n.output.quote
|
|
2797
|
+
quote: { ...e.quote, ...n.output.quote }
|
|
2799
2798
|
};
|
|
2800
2799
|
}
|
|
2801
2800
|
function Ds({
|
|
@@ -2805,7 +2804,9 @@ function Ds({
|
|
|
2805
2804
|
if (!t.type.includes("xstate.done.actor"))
|
|
2806
2805
|
return e;
|
|
2807
2806
|
const n = t;
|
|
2808
|
-
return n.output.type !== "REMOVE_ITEMS_SUCCESS" ? e : {
|
|
2807
|
+
return n.output.type !== "REMOVE_ITEMS_SUCCESS" ? e : {
|
|
2808
|
+
quote: { ...e.quote, ...n.output.quote }
|
|
2809
|
+
};
|
|
2809
2810
|
}
|
|
2810
2811
|
function Rs({
|
|
2811
2812
|
context: e,
|
|
@@ -2815,13 +2816,10 @@ function Rs({
|
|
|
2815
2816
|
return e;
|
|
2816
2817
|
const n = t;
|
|
2817
2818
|
return n.output.type !== "REFRESH_SUCCESS" ? e : {
|
|
2818
|
-
quote: {
|
|
2819
|
-
...e.quote,
|
|
2820
|
-
...n.output.quote
|
|
2821
|
-
}
|
|
2819
|
+
quote: { ...e.quote, ...n.output.quote }
|
|
2822
2820
|
};
|
|
2823
2821
|
}
|
|
2824
|
-
const
|
|
2822
|
+
const rt = JSON, Ls = (e) => e.toUpperCase(), Ms = (e) => {
|
|
2825
2823
|
const t = {};
|
|
2826
2824
|
return e.forEach((n, s) => {
|
|
2827
2825
|
t[s] = n;
|
|
@@ -2850,7 +2848,7 @@ const it = JSON, Ls = (e) => e.toUpperCase(), Ms = (e) => {
|
|
|
2850
2848
|
signal: void 0
|
|
2851
2849
|
};
|
|
2852
2850
|
};
|
|
2853
|
-
function
|
|
2851
|
+
function me(e, t) {
|
|
2854
2852
|
if (!!!e)
|
|
2855
2853
|
throw new Error(t);
|
|
2856
2854
|
}
|
|
@@ -2864,7 +2862,7 @@ function js(e, t) {
|
|
|
2864
2862
|
);
|
|
2865
2863
|
}
|
|
2866
2864
|
const $s = /\r\n|[\n\r]/g;
|
|
2867
|
-
function
|
|
2865
|
+
function je(e, t) {
|
|
2868
2866
|
let n = 0, s = 1;
|
|
2869
2867
|
for (const r of e.body.matchAll($s)) {
|
|
2870
2868
|
if (typeof r.index == "number" || js(!1), r.index >= t)
|
|
@@ -2879,32 +2877,32 @@ function $e(e, t) {
|
|
|
2879
2877
|
function Vs(e) {
|
|
2880
2878
|
return nn(
|
|
2881
2879
|
e.source,
|
|
2882
|
-
|
|
2880
|
+
je(e.source, e.start)
|
|
2883
2881
|
);
|
|
2884
2882
|
}
|
|
2885
2883
|
function nn(e, t) {
|
|
2886
2884
|
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}
|
|
2887
|
-
`,
|
|
2885
|
+
`, h = s.split(/\r\n|[\n\r]/g), d = h[r];
|
|
2888
2886
|
if (d.length > 120) {
|
|
2889
|
-
const
|
|
2887
|
+
const f = Math.floor(c / 80), m = c % 80, y = [];
|
|
2890
2888
|
for (let v = 0; v < d.length; v += 80)
|
|
2891
2889
|
y.push(d.slice(v, v + 80));
|
|
2892
|
-
return u +
|
|
2890
|
+
return u + xt([
|
|
2893
2891
|
[`${o} |`, y[0]],
|
|
2894
|
-
...y.slice(1,
|
|
2892
|
+
...y.slice(1, f + 1).map((v) => ["|", v]),
|
|
2895
2893
|
["|", "^".padStart(m)],
|
|
2896
|
-
["|", y[
|
|
2894
|
+
["|", y[f + 1]]
|
|
2897
2895
|
]);
|
|
2898
2896
|
}
|
|
2899
|
-
return u +
|
|
2897
|
+
return u + xt([
|
|
2900
2898
|
// Lines specified like this: ["prefix", "string"],
|
|
2901
|
-
[`${o - 1} |`,
|
|
2899
|
+
[`${o - 1} |`, h[r - 1]],
|
|
2902
2900
|
[`${o} |`, d],
|
|
2903
2901
|
["|", "^".padStart(c)],
|
|
2904
|
-
[`${o + 1} |`,
|
|
2902
|
+
[`${o + 1} |`, h[r + 1]]
|
|
2905
2903
|
]);
|
|
2906
2904
|
}
|
|
2907
|
-
function
|
|
2905
|
+
function xt(e) {
|
|
2908
2906
|
const t = e.filter(([s, r]) => r !== void 0), n = Math.max(...t.map(([s]) => s.length));
|
|
2909
2907
|
return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
|
|
2910
2908
|
`);
|
|
@@ -2920,7 +2918,7 @@ function Hs(e) {
|
|
|
2920
2918
|
extensions: e[5]
|
|
2921
2919
|
} : t;
|
|
2922
2920
|
}
|
|
2923
|
-
class
|
|
2921
|
+
class it extends Error {
|
|
2924
2922
|
/**
|
|
2925
2923
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
2926
2924
|
* which correspond to this error.
|
|
@@ -2961,17 +2959,17 @@ class ot extends Error {
|
|
|
2961
2959
|
*/
|
|
2962
2960
|
constructor(t, ...n) {
|
|
2963
2961
|
var s, r, i;
|
|
2964
|
-
const { nodes: o, source: a, positions: c, path: u, originalError:
|
|
2965
|
-
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError =
|
|
2962
|
+
const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = Hs(n);
|
|
2963
|
+
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = At(
|
|
2966
2964
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
2967
2965
|
);
|
|
2968
|
-
const
|
|
2966
|
+
const f = At(
|
|
2969
2967
|
(s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
|
|
2970
2968
|
);
|
|
2971
|
-
this.source = a ?? (
|
|
2969
|
+
this.source = a ?? (f == null || (r = f[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (f == null ? void 0 : f.map((y) => y.start)), this.locations = c && a ? c.map((y) => je(a, y)) : f == null ? void 0 : f.map((y) => je(y.source, y.start));
|
|
2972
2970
|
const m = Bs(
|
|
2973
|
-
|
|
2974
|
-
) ?
|
|
2971
|
+
h == null ? void 0 : h.extensions
|
|
2972
|
+
) ? h == null ? void 0 : h.extensions : void 0;
|
|
2975
2973
|
this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
2976
2974
|
message: {
|
|
2977
2975
|
writable: !0,
|
|
@@ -2992,11 +2990,11 @@ class ot extends Error {
|
|
|
2992
2990
|
originalError: {
|
|
2993
2991
|
enumerable: !1
|
|
2994
2992
|
}
|
|
2995
|
-
}),
|
|
2996
|
-
value:
|
|
2993
|
+
}), h != null && h.stack ? Object.defineProperty(this, "stack", {
|
|
2994
|
+
value: h.stack,
|
|
2997
2995
|
writable: !0,
|
|
2998
2996
|
configurable: !0
|
|
2999
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
2997
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, it) : Object.defineProperty(this, "stack", {
|
|
3000
2998
|
value: Error().stack,
|
|
3001
2999
|
writable: !0,
|
|
3002
3000
|
configurable: !0
|
|
@@ -3026,11 +3024,11 @@ class ot extends Error {
|
|
|
3026
3024
|
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;
|
|
3027
3025
|
}
|
|
3028
3026
|
}
|
|
3029
|
-
function
|
|
3027
|
+
function At(e) {
|
|
3030
3028
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
3031
3029
|
}
|
|
3032
3030
|
function b(e, t, n) {
|
|
3033
|
-
return new
|
|
3031
|
+
return new it(`Syntax Error: ${n}`, {
|
|
3034
3032
|
source: e,
|
|
3035
3033
|
positions: [t]
|
|
3036
3034
|
});
|
|
@@ -3181,26 +3179,26 @@ const rn = {
|
|
|
3181
3179
|
EnumTypeExtension: ["name", "directives", "values"],
|
|
3182
3180
|
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
3183
3181
|
}, zs = new Set(Object.keys(rn));
|
|
3184
|
-
function
|
|
3182
|
+
function wt(e) {
|
|
3185
3183
|
const t = e == null ? void 0 : e.kind;
|
|
3186
3184
|
return typeof t == "string" && zs.has(t);
|
|
3187
3185
|
}
|
|
3188
|
-
var
|
|
3186
|
+
var W;
|
|
3189
3187
|
(function(e) {
|
|
3190
3188
|
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
3191
|
-
})(
|
|
3192
|
-
var
|
|
3189
|
+
})(W || (W = {}));
|
|
3190
|
+
var $e;
|
|
3193
3191
|
(function(e) {
|
|
3194
3192
|
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";
|
|
3195
|
-
})(
|
|
3193
|
+
})($e || ($e = {}));
|
|
3196
3194
|
var T;
|
|
3197
3195
|
(function(e) {
|
|
3198
3196
|
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";
|
|
3199
3197
|
})(T || (T = {}));
|
|
3200
|
-
function
|
|
3198
|
+
function Ve(e) {
|
|
3201
3199
|
return e === 9 || e === 32;
|
|
3202
3200
|
}
|
|
3203
|
-
function
|
|
3201
|
+
function ce(e) {
|
|
3204
3202
|
return e >= 48 && e <= 57;
|
|
3205
3203
|
}
|
|
3206
3204
|
function on(e) {
|
|
@@ -3211,7 +3209,7 @@ function an(e) {
|
|
|
3211
3209
|
return on(e) || e === 95;
|
|
3212
3210
|
}
|
|
3213
3211
|
function Js(e) {
|
|
3214
|
-
return on(e) ||
|
|
3212
|
+
return on(e) || ce(e) || e === 95;
|
|
3215
3213
|
}
|
|
3216
3214
|
function Ys(e) {
|
|
3217
3215
|
var t;
|
|
@@ -3228,17 +3226,17 @@ function Ys(e) {
|
|
|
3228
3226
|
}
|
|
3229
3227
|
function Xs(e) {
|
|
3230
3228
|
let t = 0;
|
|
3231
|
-
for (; t < e.length &&
|
|
3229
|
+
for (; t < e.length && Ve(e.charCodeAt(t)); )
|
|
3232
3230
|
++t;
|
|
3233
3231
|
return t;
|
|
3234
3232
|
}
|
|
3235
3233
|
function Qs(e, t) {
|
|
3236
|
-
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 ||
|
|
3234
|
+
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 || Ve(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c, h = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
|
|
3237
3235
|
(!r || e.length > 70 || u || i || o);
|
|
3238
3236
|
let d = "";
|
|
3239
|
-
const
|
|
3240
|
-
return (
|
|
3241
|
-
`), d += n, (
|
|
3237
|
+
const f = r && Ve(e.charCodeAt(0));
|
|
3238
|
+
return (h && !f || i) && (d += `
|
|
3239
|
+
`), d += n, (h || u) && (d += `
|
|
3242
3240
|
`), '"""' + d + '"""';
|
|
3243
3241
|
}
|
|
3244
3242
|
var p;
|
|
@@ -3292,10 +3290,10 @@ class Ws {
|
|
|
3292
3290
|
function Ks(e) {
|
|
3293
3291
|
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;
|
|
3294
3292
|
}
|
|
3295
|
-
function
|
|
3293
|
+
function ne(e) {
|
|
3296
3294
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
3297
3295
|
}
|
|
3298
|
-
function
|
|
3296
|
+
function Ae(e, t) {
|
|
3299
3297
|
return cn(e.charCodeAt(t)) && un(e.charCodeAt(t + 1));
|
|
3300
3298
|
}
|
|
3301
3299
|
function cn(e) {
|
|
@@ -3371,14 +3369,14 @@ function Zs(e, t) {
|
|
|
3371
3369
|
case 34:
|
|
3372
3370
|
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? or(e, r) : nr(e, r);
|
|
3373
3371
|
}
|
|
3374
|
-
if (
|
|
3372
|
+
if (ce(i) || i === 45)
|
|
3375
3373
|
return tr(e, r, i);
|
|
3376
3374
|
if (an(i))
|
|
3377
3375
|
return ar(e, r);
|
|
3378
3376
|
throw b(
|
|
3379
3377
|
e.source,
|
|
3380
3378
|
r,
|
|
3381
|
-
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` :
|
|
3379
|
+
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : ne(i) || Ae(n, r) ? `Unexpected character: ${G(e, r)}.` : `Invalid character: ${G(e, r)}.`
|
|
3382
3380
|
);
|
|
3383
3381
|
}
|
|
3384
3382
|
return w(e, p.EOF, s, s);
|
|
@@ -3390,9 +3388,9 @@ function er(e, t) {
|
|
|
3390
3388
|
const i = n.charCodeAt(r);
|
|
3391
3389
|
if (i === 10 || i === 13)
|
|
3392
3390
|
break;
|
|
3393
|
-
if (
|
|
3391
|
+
if (ne(i))
|
|
3394
3392
|
++r;
|
|
3395
|
-
else if (
|
|
3393
|
+
else if (Ae(n, r))
|
|
3396
3394
|
r += 2;
|
|
3397
3395
|
else
|
|
3398
3396
|
break;
|
|
@@ -3409,7 +3407,7 @@ function tr(e, t, n) {
|
|
|
3409
3407
|
const s = e.source.body;
|
|
3410
3408
|
let r = t, i = n, o = !1;
|
|
3411
3409
|
if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
|
|
3412
|
-
if (i = s.charCodeAt(++r),
|
|
3410
|
+
if (i = s.charCodeAt(++r), ce(i))
|
|
3413
3411
|
throw b(
|
|
3414
3412
|
e.source,
|
|
3415
3413
|
r,
|
|
@@ -3419,8 +3417,8 @@ function tr(e, t, n) {
|
|
|
3419
3417
|
)}.`
|
|
3420
3418
|
);
|
|
3421
3419
|
} else
|
|
3422
|
-
r =
|
|
3423
|
-
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r =
|
|
3420
|
+
r = De(e, r, i), i = s.charCodeAt(r);
|
|
3421
|
+
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = De(e, r, i), i = s.charCodeAt(r)), (i === 69 || i === 101) && (o = !0, i = s.charCodeAt(++r), (i === 43 || i === 45) && (i = s.charCodeAt(++r)), r = De(e, r, i), i = s.charCodeAt(r)), i === 46 || an(i))
|
|
3424
3422
|
throw b(
|
|
3425
3423
|
e.source,
|
|
3426
3424
|
r,
|
|
@@ -3437,8 +3435,8 @@ function tr(e, t, n) {
|
|
|
3437
3435
|
s.slice(t, r)
|
|
3438
3436
|
);
|
|
3439
3437
|
}
|
|
3440
|
-
function
|
|
3441
|
-
if (!
|
|
3438
|
+
function De(e, t, n) {
|
|
3439
|
+
if (!ce(n))
|
|
3442
3440
|
throw b(
|
|
3443
3441
|
e.source,
|
|
3444
3442
|
t,
|
|
@@ -3449,7 +3447,7 @@ function Re(e, t, n) {
|
|
|
3449
3447
|
);
|
|
3450
3448
|
const s = e.source.body;
|
|
3451
3449
|
let r = t + 1;
|
|
3452
|
-
for (;
|
|
3450
|
+
for (; ce(s.charCodeAt(r)); )
|
|
3453
3451
|
++r;
|
|
3454
3452
|
return r;
|
|
3455
3453
|
}
|
|
@@ -3468,9 +3466,9 @@ function nr(e, t) {
|
|
|
3468
3466
|
}
|
|
3469
3467
|
if (a === 10 || a === 13)
|
|
3470
3468
|
break;
|
|
3471
|
-
if (
|
|
3469
|
+
if (ne(a))
|
|
3472
3470
|
++r;
|
|
3473
|
-
else if (
|
|
3471
|
+
else if (Ae(n, r))
|
|
3474
3472
|
r += 2;
|
|
3475
3473
|
else
|
|
3476
3474
|
throw b(
|
|
@@ -3490,14 +3488,14 @@ function sr(e, t) {
|
|
|
3490
3488
|
for (; r < 12; ) {
|
|
3491
3489
|
const i = n.charCodeAt(t + r++);
|
|
3492
3490
|
if (i === 125) {
|
|
3493
|
-
if (r < 5 || !
|
|
3491
|
+
if (r < 5 || !ne(s))
|
|
3494
3492
|
break;
|
|
3495
3493
|
return {
|
|
3496
3494
|
value: String.fromCodePoint(s),
|
|
3497
3495
|
size: r
|
|
3498
3496
|
};
|
|
3499
3497
|
}
|
|
3500
|
-
if (s = s << 4 |
|
|
3498
|
+
if (s = s << 4 | ie(i), s < 0)
|
|
3501
3499
|
break;
|
|
3502
3500
|
}
|
|
3503
3501
|
throw b(
|
|
@@ -3510,14 +3508,14 @@ function sr(e, t) {
|
|
|
3510
3508
|
);
|
|
3511
3509
|
}
|
|
3512
3510
|
function rr(e, t) {
|
|
3513
|
-
const n = e.source.body, s =
|
|
3514
|
-
if (
|
|
3511
|
+
const n = e.source.body, s = bt(n, t + 2);
|
|
3512
|
+
if (ne(s))
|
|
3515
3513
|
return {
|
|
3516
3514
|
value: String.fromCodePoint(s),
|
|
3517
3515
|
size: 6
|
|
3518
3516
|
};
|
|
3519
3517
|
if (cn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
3520
|
-
const r =
|
|
3518
|
+
const r = bt(n, t + 8);
|
|
3521
3519
|
if (un(r))
|
|
3522
3520
|
return {
|
|
3523
3521
|
value: String.fromCodePoint(s, r),
|
|
@@ -3530,10 +3528,10 @@ function rr(e, t) {
|
|
|
3530
3528
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
3531
3529
|
);
|
|
3532
3530
|
}
|
|
3533
|
-
function
|
|
3534
|
-
return
|
|
3531
|
+
function bt(e, t) {
|
|
3532
|
+
return ie(e.charCodeAt(t)) << 12 | ie(e.charCodeAt(t + 1)) << 8 | ie(e.charCodeAt(t + 2)) << 4 | ie(e.charCodeAt(t + 3));
|
|
3535
3533
|
}
|
|
3536
|
-
function
|
|
3534
|
+
function ie(e) {
|
|
3537
3535
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
3538
3536
|
}
|
|
3539
3537
|
function ir(e, t) {
|
|
@@ -3598,7 +3596,7 @@ function or(e, t) {
|
|
|
3598
3596
|
const u = n.charCodeAt(i);
|
|
3599
3597
|
if (u === 34 && n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34) {
|
|
3600
3598
|
a += n.slice(o, i), c.push(a);
|
|
3601
|
-
const
|
|
3599
|
+
const h = w(
|
|
3602
3600
|
e,
|
|
3603
3601
|
p.BLOCK_STRING,
|
|
3604
3602
|
t,
|
|
@@ -3607,7 +3605,7 @@ function or(e, t) {
|
|
|
3607
3605
|
Ys(c).join(`
|
|
3608
3606
|
`)
|
|
3609
3607
|
);
|
|
3610
|
-
return e.line += c.length - 1, e.lineStart = r,
|
|
3608
|
+
return e.line += c.length - 1, e.lineStart = r, h;
|
|
3611
3609
|
}
|
|
3612
3610
|
if (u === 92 && n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 && n.charCodeAt(i + 3) === 34) {
|
|
3613
3611
|
a += n.slice(o, i), o = i + 1, i += 4;
|
|
@@ -3617,9 +3615,9 @@ function or(e, t) {
|
|
|
3617
3615
|
a += n.slice(o, i), c.push(a), u === 13 && n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, a = "", o = i, r = i;
|
|
3618
3616
|
continue;
|
|
3619
3617
|
}
|
|
3620
|
-
if (
|
|
3618
|
+
if (ne(u))
|
|
3621
3619
|
++i;
|
|
3622
|
-
else if (
|
|
3620
|
+
else if (Ae(n, i))
|
|
3623
3621
|
i += 2;
|
|
3624
3622
|
else
|
|
3625
3623
|
throw b(
|
|
@@ -3652,10 +3650,10 @@ function ar(e, t) {
|
|
|
3652
3650
|
);
|
|
3653
3651
|
}
|
|
3654
3652
|
const cr = 10, dn = 2;
|
|
3655
|
-
function
|
|
3656
|
-
return
|
|
3653
|
+
function ot(e) {
|
|
3654
|
+
return we(e, []);
|
|
3657
3655
|
}
|
|
3658
|
-
function
|
|
3656
|
+
function we(e, t) {
|
|
3659
3657
|
switch (typeof e) {
|
|
3660
3658
|
case "string":
|
|
3661
3659
|
return JSON.stringify(e);
|
|
@@ -3676,7 +3674,7 @@ function ur(e, t) {
|
|
|
3676
3674
|
if (dr(e)) {
|
|
3677
3675
|
const s = e.toJSON();
|
|
3678
3676
|
if (s !== e)
|
|
3679
|
-
return typeof s == "string" ? s :
|
|
3677
|
+
return typeof s == "string" ? s : we(s, n);
|
|
3680
3678
|
} else if (Array.isArray(e))
|
|
3681
3679
|
return hr(e, n);
|
|
3682
3680
|
return lr(e, n);
|
|
@@ -3687,7 +3685,7 @@ function dr(e) {
|
|
|
3687
3685
|
function lr(e, t) {
|
|
3688
3686
|
const n = Object.entries(e);
|
|
3689
3687
|
return n.length === 0 ? "{}" : t.length > dn ? "[" + fr(e) + "]" : "{ " + n.map(
|
|
3690
|
-
([r, i]) => r + ": " +
|
|
3688
|
+
([r, i]) => r + ": " + we(i, t)
|
|
3691
3689
|
).join(", ") + " }";
|
|
3692
3690
|
}
|
|
3693
3691
|
function hr(e, t) {
|
|
@@ -3697,7 +3695,7 @@ function hr(e, t) {
|
|
|
3697
3695
|
return "[Array]";
|
|
3698
3696
|
const n = Math.min(cr, e.length), s = e.length - n, r = [];
|
|
3699
3697
|
for (let i = 0; i < n; ++i)
|
|
3700
|
-
r.push(
|
|
3698
|
+
r.push(we(e[i], t));
|
|
3701
3699
|
return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
|
|
3702
3700
|
}
|
|
3703
3701
|
function fr(e) {
|
|
@@ -3724,7 +3722,7 @@ const pr = (
|
|
|
3724
3722
|
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (s = t.constructor) === null || s === void 0 ? void 0 : s.name
|
|
3725
3723
|
);
|
|
3726
3724
|
if (r === i) {
|
|
3727
|
-
const o =
|
|
3725
|
+
const o = ot(t);
|
|
3728
3726
|
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
3729
3727
|
|
|
3730
3728
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -3747,10 +3745,10 @@ class ln {
|
|
|
3747
3745
|
line: 1,
|
|
3748
3746
|
column: 1
|
|
3749
3747
|
}) {
|
|
3750
|
-
typeof t == "string" ||
|
|
3748
|
+
typeof t == "string" || me(!1, `Body must be a string. Received: ${ot(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || me(
|
|
3751
3749
|
!1,
|
|
3752
3750
|
"line in locationOffset is 1-indexed and must be positive."
|
|
3753
|
-
), this.locationOffset.column > 0 ||
|
|
3751
|
+
), this.locationOffset.column > 0 || me(
|
|
3754
3752
|
!1,
|
|
3755
3753
|
"column in locationOffset is 1-indexed and must be positive."
|
|
3756
3754
|
);
|
|
@@ -3870,7 +3868,7 @@ class gr {
|
|
|
3870
3868
|
if (this.peek(p.BRACE_L))
|
|
3871
3869
|
return this.node(t, {
|
|
3872
3870
|
kind: T.OPERATION_DEFINITION,
|
|
3873
|
-
operation:
|
|
3871
|
+
operation: W.QUERY,
|
|
3874
3872
|
name: void 0,
|
|
3875
3873
|
variableDefinitions: [],
|
|
3876
3874
|
directives: [],
|
|
@@ -3894,11 +3892,11 @@ class gr {
|
|
|
3894
3892
|
const t = this.expectToken(p.NAME);
|
|
3895
3893
|
switch (t.value) {
|
|
3896
3894
|
case "query":
|
|
3897
|
-
return
|
|
3895
|
+
return W.QUERY;
|
|
3898
3896
|
case "mutation":
|
|
3899
|
-
return
|
|
3897
|
+
return W.MUTATION;
|
|
3900
3898
|
case "subscription":
|
|
3901
|
-
return
|
|
3899
|
+
return W.SUBSCRIPTION;
|
|
3902
3900
|
}
|
|
3903
3901
|
throw this.unexpected(t);
|
|
3904
3902
|
}
|
|
@@ -4465,7 +4463,7 @@ class gr {
|
|
|
4465
4463
|
throw b(
|
|
4466
4464
|
this._lexer.source,
|
|
4467
4465
|
this._lexer.token.start,
|
|
4468
|
-
`${
|
|
4466
|
+
`${pe(
|
|
4469
4467
|
this._lexer.token
|
|
4470
4468
|
)} is reserved and cannot be used for an enum value.`
|
|
4471
4469
|
);
|
|
@@ -4724,7 +4722,7 @@ class gr {
|
|
|
4724
4722
|
*/
|
|
4725
4723
|
parseDirectiveLocation() {
|
|
4726
4724
|
const t = this._lexer.token, n = this.parseName();
|
|
4727
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
4725
|
+
if (Object.prototype.hasOwnProperty.call($e, n.value))
|
|
4728
4726
|
return n;
|
|
4729
4727
|
throw this.unexpected(t);
|
|
4730
4728
|
}
|
|
@@ -4758,7 +4756,7 @@ class gr {
|
|
|
4758
4756
|
throw b(
|
|
4759
4757
|
this._lexer.source,
|
|
4760
4758
|
n.start,
|
|
4761
|
-
`Expected ${hn(t)}, found ${
|
|
4759
|
+
`Expected ${hn(t)}, found ${pe(n)}.`
|
|
4762
4760
|
);
|
|
4763
4761
|
}
|
|
4764
4762
|
/**
|
|
@@ -4780,7 +4778,7 @@ class gr {
|
|
|
4780
4778
|
throw b(
|
|
4781
4779
|
this._lexer.source,
|
|
4782
4780
|
n.start,
|
|
4783
|
-
`Expected "${t}", found ${
|
|
4781
|
+
`Expected "${t}", found ${pe(n)}.`
|
|
4784
4782
|
);
|
|
4785
4783
|
}
|
|
4786
4784
|
/**
|
|
@@ -4799,7 +4797,7 @@ class gr {
|
|
|
4799
4797
|
return b(
|
|
4800
4798
|
this._lexer.source,
|
|
4801
4799
|
n.start,
|
|
4802
|
-
`Unexpected ${
|
|
4800
|
+
`Unexpected ${pe(n)}.`
|
|
4803
4801
|
);
|
|
4804
4802
|
}
|
|
4805
4803
|
/**
|
|
@@ -4866,7 +4864,7 @@ class gr {
|
|
|
4866
4864
|
);
|
|
4867
4865
|
}
|
|
4868
4866
|
}
|
|
4869
|
-
function
|
|
4867
|
+
function pe(e) {
|
|
4870
4868
|
const t = e.value;
|
|
4871
4869
|
return hn(e.kind) + (t != null ? ` "${t}"` : "");
|
|
4872
4870
|
}
|
|
@@ -5051,19 +5049,19 @@ function Sr(e, t, n = rn) {
|
|
|
5051
5049
|
const s = /* @__PURE__ */ new Map();
|
|
5052
5050
|
for (const A of Object.values(T))
|
|
5053
5051
|
s.set(A, xr(t, A));
|
|
5054
|
-
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e,
|
|
5055
|
-
const
|
|
5052
|
+
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
|
|
5053
|
+
const f = [], m = [];
|
|
5056
5054
|
do {
|
|
5057
5055
|
a++;
|
|
5058
5056
|
const A = a === o.length, R = A && c.length !== 0;
|
|
5059
5057
|
if (A) {
|
|
5060
|
-
if (
|
|
5058
|
+
if (h = m.length === 0 ? void 0 : f[f.length - 1], u = d, d = m.pop(), R)
|
|
5061
5059
|
if (i) {
|
|
5062
5060
|
u = u.slice();
|
|
5063
5061
|
let L = 0;
|
|
5064
|
-
for (const [z,
|
|
5065
|
-
const
|
|
5066
|
-
|
|
5062
|
+
for (const [z, de] of c) {
|
|
5063
|
+
const le = z - L;
|
|
5064
|
+
de === null ? (u.splice(le, 1), L++) : u[le] = de;
|
|
5067
5065
|
}
|
|
5068
5066
|
} else {
|
|
5069
5067
|
u = Object.defineProperties(
|
|
@@ -5075,32 +5073,32 @@ function Sr(e, t, n = rn) {
|
|
|
5075
5073
|
}
|
|
5076
5074
|
a = r.index, o = r.keys, c = r.edits, i = r.inArray, r = r.prev;
|
|
5077
5075
|
} else if (d) {
|
|
5078
|
-
if (
|
|
5076
|
+
if (h = i ? a : o[a], u = d[h], u == null)
|
|
5079
5077
|
continue;
|
|
5080
|
-
|
|
5078
|
+
f.push(h);
|
|
5081
5079
|
}
|
|
5082
5080
|
let D;
|
|
5083
5081
|
if (!Array.isArray(u)) {
|
|
5084
5082
|
var y, v;
|
|
5085
|
-
|
|
5083
|
+
wt(u) || me(!1, `Invalid AST Node: ${ot(u)}.`);
|
|
5086
5084
|
const L = A ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (v = s.get(u.kind)) === null || v === void 0 ? void 0 : v.enter;
|
|
5087
|
-
if (D = L == null ? void 0 : L.call(t, u,
|
|
5085
|
+
if (D = L == null ? void 0 : L.call(t, u, h, d, f, m), D === Ir)
|
|
5088
5086
|
break;
|
|
5089
5087
|
if (D === !1) {
|
|
5090
5088
|
if (!A) {
|
|
5091
|
-
|
|
5089
|
+
f.pop();
|
|
5092
5090
|
continue;
|
|
5093
5091
|
}
|
|
5094
|
-
} else if (D !== void 0 && (c.push([
|
|
5095
|
-
if (
|
|
5092
|
+
} else if (D !== void 0 && (c.push([h, D]), !A))
|
|
5093
|
+
if (wt(D))
|
|
5096
5094
|
u = D;
|
|
5097
5095
|
else {
|
|
5098
|
-
|
|
5096
|
+
f.pop();
|
|
5099
5097
|
continue;
|
|
5100
5098
|
}
|
|
5101
5099
|
}
|
|
5102
|
-
if (D === void 0 && R && c.push([
|
|
5103
|
-
|
|
5100
|
+
if (D === void 0 && R && c.push([h, u]), A)
|
|
5101
|
+
f.pop();
|
|
5104
5102
|
else {
|
|
5105
5103
|
var S;
|
|
5106
5104
|
r = {
|
|
@@ -5164,7 +5162,7 @@ const Ar = 80, wr = {
|
|
|
5164
5162
|
const i = I("", e, ": ") + t;
|
|
5165
5163
|
let o = i + I("(", E(n, ", "), ")");
|
|
5166
5164
|
return o.length > Ar && (o = i + I(`(
|
|
5167
|
-
`,
|
|
5165
|
+
`, ge(E(n, `
|
|
5168
5166
|
`)), `
|
|
5169
5167
|
)`)), E([o, E(s, " "), r], " ");
|
|
5170
5168
|
}
|
|
@@ -5262,8 +5260,8 @@ const Ar = 80, wr = {
|
|
|
5262
5260
|
},
|
|
5263
5261
|
FieldDefinition: {
|
|
5264
5262
|
leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => I("", e, `
|
|
5265
|
-
`) + t + (
|
|
5266
|
-
`,
|
|
5263
|
+
`) + t + (Ot(n) ? I(`(
|
|
5264
|
+
`, ge(E(n, `
|
|
5267
5265
|
`)), `
|
|
5268
5266
|
)`) : I("(", E(n, ", "), ")")) + ": " + s + I(" ", E(r, " "))
|
|
5269
5267
|
},
|
|
@@ -5308,8 +5306,8 @@ const Ar = 80, wr = {
|
|
|
5308
5306
|
},
|
|
5309
5307
|
DirectiveDefinition: {
|
|
5310
5308
|
leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => I("", e, `
|
|
5311
|
-
`) + "directive @" + t + (
|
|
5312
|
-
`,
|
|
5309
|
+
`) + "directive @" + t + (Ot(n) ? I(`(
|
|
5310
|
+
`, ge(E(n, `
|
|
5313
5311
|
`)), `
|
|
5314
5312
|
)`) : I("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
|
|
5315
5313
|
},
|
|
@@ -5370,47 +5368,47 @@ function E(e, t = "") {
|
|
|
5370
5368
|
}
|
|
5371
5369
|
function M(e) {
|
|
5372
5370
|
return I(`{
|
|
5373
|
-
`,
|
|
5371
|
+
`, ge(E(e, `
|
|
5374
5372
|
`)), `
|
|
5375
5373
|
}`);
|
|
5376
5374
|
}
|
|
5377
5375
|
function I(e, t, n = "") {
|
|
5378
5376
|
return t != null && t !== "" ? e + t + n : "";
|
|
5379
5377
|
}
|
|
5380
|
-
function
|
|
5378
|
+
function ge(e) {
|
|
5381
5379
|
return I(" ", e.replace(/\n/g, `
|
|
5382
5380
|
`));
|
|
5383
5381
|
}
|
|
5384
|
-
function
|
|
5382
|
+
function Ot(e) {
|
|
5385
5383
|
var t;
|
|
5386
5384
|
return (t = e == null ? void 0 : e.some((n) => n.includes(`
|
|
5387
5385
|
`))) !== null && t !== void 0 ? t : !1;
|
|
5388
5386
|
}
|
|
5389
|
-
const
|
|
5387
|
+
const Nt = (e) => {
|
|
5390
5388
|
var s, r;
|
|
5391
5389
|
let t;
|
|
5392
5390
|
const n = e.definitions.filter((i) => i.kind === "OperationDefinition");
|
|
5393
5391
|
return n.length === 1 && (t = (r = (s = n[0]) == null ? void 0 : s.name) == null ? void 0 : r.value), t;
|
|
5394
|
-
},
|
|
5392
|
+
}, Re = (e) => {
|
|
5395
5393
|
if (typeof e == "string") {
|
|
5396
5394
|
let n;
|
|
5397
5395
|
try {
|
|
5398
5396
|
const s = mr(e);
|
|
5399
|
-
n =
|
|
5397
|
+
n = Nt(s);
|
|
5400
5398
|
} catch {
|
|
5401
5399
|
}
|
|
5402
5400
|
return { query: e, operationName: n };
|
|
5403
5401
|
}
|
|
5404
|
-
const t =
|
|
5402
|
+
const t = Nt(e);
|
|
5405
5403
|
return { query: fn(e), operationName: t };
|
|
5406
5404
|
};
|
|
5407
|
-
class
|
|
5405
|
+
class oe extends Error {
|
|
5408
5406
|
constructor(t, n) {
|
|
5409
|
-
const s = `${
|
|
5407
|
+
const s = `${oe.extractMessage(t)}: ${JSON.stringify({
|
|
5410
5408
|
response: t,
|
|
5411
5409
|
request: n
|
|
5412
5410
|
})}`;
|
|
5413
|
-
super(s), Object.setPrototypeOf(this,
|
|
5411
|
+
super(s), Object.setPrototypeOf(this, oe.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, oe);
|
|
5414
5412
|
}
|
|
5415
5413
|
static extractMessage(t) {
|
|
5416
5414
|
var n, s;
|
|
@@ -5421,7 +5419,7 @@ var br = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
5421
5419
|
function Or(e) {
|
|
5422
5420
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
5423
5421
|
}
|
|
5424
|
-
var
|
|
5422
|
+
var He = { exports: {} };
|
|
5425
5423
|
(function(e, t) {
|
|
5426
5424
|
var n = typeof self < "u" ? self : br, s = function() {
|
|
5427
5425
|
function i() {
|
|
@@ -5458,7 +5456,7 @@ var Ge = { exports: {} };
|
|
|
5458
5456
|
"[object Uint32Array]",
|
|
5459
5457
|
"[object Float32Array]",
|
|
5460
5458
|
"[object Float64Array]"
|
|
5461
|
-
],
|
|
5459
|
+
], h = ArrayBuffer.isView || function(l) {
|
|
5462
5460
|
return l && u.indexOf(Object.prototype.toString.call(l)) > -1;
|
|
5463
5461
|
};
|
|
5464
5462
|
function d(l) {
|
|
@@ -5466,7 +5464,7 @@ var Ge = { exports: {} };
|
|
|
5466
5464
|
throw new TypeError("Invalid character in header field name");
|
|
5467
5465
|
return l.toLowerCase();
|
|
5468
5466
|
}
|
|
5469
|
-
function
|
|
5467
|
+
function f(l) {
|
|
5470
5468
|
return typeof l != "string" && (l = String(l)), l;
|
|
5471
5469
|
}
|
|
5472
5470
|
function m(l) {
|
|
@@ -5490,7 +5488,7 @@ var Ge = { exports: {} };
|
|
|
5490
5488
|
}, this);
|
|
5491
5489
|
}
|
|
5492
5490
|
y.prototype.append = function(l, g) {
|
|
5493
|
-
l = d(l), g =
|
|
5491
|
+
l = d(l), g = f(g);
|
|
5494
5492
|
var _ = this.map[l];
|
|
5495
5493
|
this.map[l] = _ ? _ + ", " + g : g;
|
|
5496
5494
|
}, y.prototype.delete = function(l) {
|
|
@@ -5500,7 +5498,7 @@ var Ge = { exports: {} };
|
|
|
5500
5498
|
}, y.prototype.has = function(l) {
|
|
5501
5499
|
return this.map.hasOwnProperty(d(l));
|
|
5502
5500
|
}, y.prototype.set = function(l, g) {
|
|
5503
|
-
this.map[d(l)] =
|
|
5501
|
+
this.map[d(l)] = f(g);
|
|
5504
5502
|
}, y.prototype.forEach = function(l, g) {
|
|
5505
5503
|
for (var _ in this.map)
|
|
5506
5504
|
this.map.hasOwnProperty(_) && l.call(g, this.map[_], _, this);
|
|
@@ -5555,7 +5553,7 @@ var Ge = { exports: {} };
|
|
|
5555
5553
|
}
|
|
5556
5554
|
function z() {
|
|
5557
5555
|
return this.bodyUsed = !1, this._initBody = function(l) {
|
|
5558
|
-
this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && c(l) ? (this._bodyArrayBuffer = L(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) ||
|
|
5556
|
+
this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && c(l) ? (this._bodyArrayBuffer = L(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = L(l) : this._bodyText = l = Object.prototype.toString.call(l) : this._bodyText = "", this.headers.get("content-type") || (typeof l == "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(l) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
5559
5557
|
}, a.blob && (this.blob = function() {
|
|
5560
5558
|
var l = v(this);
|
|
5561
5559
|
if (l)
|
|
@@ -5586,10 +5584,10 @@ var Ge = { exports: {} };
|
|
|
5586
5584
|
return this.text().then(JSON.parse);
|
|
5587
5585
|
}, this;
|
|
5588
5586
|
}
|
|
5589
|
-
var
|
|
5590
|
-
function
|
|
5587
|
+
var de = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
|
5588
|
+
function le(l) {
|
|
5591
5589
|
var g = l.toUpperCase();
|
|
5592
|
-
return
|
|
5590
|
+
return de.indexOf(g) > -1 ? g : l;
|
|
5593
5591
|
}
|
|
5594
5592
|
function j(l, g) {
|
|
5595
5593
|
g = g || {};
|
|
@@ -5600,7 +5598,7 @@ var Ge = { exports: {} };
|
|
|
5600
5598
|
this.url = l.url, this.credentials = l.credentials, g.headers || (this.headers = new y(l.headers)), this.method = l.method, this.mode = l.mode, this.signal = l.signal, !_ && l._bodyInit != null && (_ = l._bodyInit, l.bodyUsed = !0);
|
|
5601
5599
|
} else
|
|
5602
5600
|
this.url = String(l);
|
|
5603
|
-
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method =
|
|
5601
|
+
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = le(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") && _)
|
|
5604
5602
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
5605
5603
|
this._initBody(_);
|
|
5606
5604
|
}
|
|
@@ -5621,8 +5619,8 @@ var Ge = { exports: {} };
|
|
|
5621
5619
|
return _.split(/\r?\n/).forEach(function(N) {
|
|
5622
5620
|
var O = N.split(":"), x = O.shift().trim();
|
|
5623
5621
|
if (x) {
|
|
5624
|
-
var
|
|
5625
|
-
g.append(x,
|
|
5622
|
+
var he = O.join(":").trim();
|
|
5623
|
+
g.append(x, he);
|
|
5626
5624
|
}
|
|
5627
5625
|
}), g;
|
|
5628
5626
|
}
|
|
@@ -5656,120 +5654,120 @@ var Ge = { exports: {} };
|
|
|
5656
5654
|
this.stack = N.stack;
|
|
5657
5655
|
}, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
|
|
5658
5656
|
}
|
|
5659
|
-
function
|
|
5657
|
+
function be(l, g) {
|
|
5660
5658
|
return new Promise(function(_, N) {
|
|
5661
5659
|
var O = new j(l, g);
|
|
5662
5660
|
if (O.signal && O.signal.aborted)
|
|
5663
5661
|
return N(new o.DOMException("Aborted", "AbortError"));
|
|
5664
5662
|
var x = new XMLHttpRequest();
|
|
5665
|
-
function
|
|
5663
|
+
function he() {
|
|
5666
5664
|
x.abort();
|
|
5667
5665
|
}
|
|
5668
5666
|
x.onload = function() {
|
|
5669
|
-
var
|
|
5667
|
+
var se = {
|
|
5670
5668
|
status: x.status,
|
|
5671
5669
|
statusText: x.statusText,
|
|
5672
5670
|
headers: En(x.getAllResponseHeaders() || "")
|
|
5673
5671
|
};
|
|
5674
|
-
|
|
5675
|
-
var
|
|
5676
|
-
_(new P(
|
|
5672
|
+
se.url = "responseURL" in x ? x.responseURL : se.headers.get("X-Request-URL");
|
|
5673
|
+
var Oe = "response" in x ? x.response : x.responseText;
|
|
5674
|
+
_(new P(Oe, se));
|
|
5677
5675
|
}, x.onerror = function() {
|
|
5678
5676
|
N(new TypeError("Network request failed"));
|
|
5679
5677
|
}, x.ontimeout = function() {
|
|
5680
5678
|
N(new TypeError("Network request failed"));
|
|
5681
5679
|
}, x.onabort = function() {
|
|
5682
5680
|
N(new o.DOMException("Aborted", "AbortError"));
|
|
5683
|
-
}, x.open(O.method, O.url, !0), O.credentials === "include" ? x.withCredentials = !0 : O.credentials === "omit" && (x.withCredentials = !1), "responseType" in x && a.blob && (x.responseType = "blob"), O.headers.forEach(function(
|
|
5684
|
-
x.setRequestHeader(
|
|
5685
|
-
}), O.signal && (O.signal.addEventListener("abort",
|
|
5686
|
-
x.readyState === 4 && O.signal.removeEventListener("abort",
|
|
5681
|
+
}, x.open(O.method, O.url, !0), O.credentials === "include" ? x.withCredentials = !0 : O.credentials === "omit" && (x.withCredentials = !1), "responseType" in x && a.blob && (x.responseType = "blob"), O.headers.forEach(function(se, Oe) {
|
|
5682
|
+
x.setRequestHeader(Oe, se);
|
|
5683
|
+
}), O.signal && (O.signal.addEventListener("abort", he), x.onreadystatechange = function() {
|
|
5684
|
+
x.readyState === 4 && O.signal.removeEventListener("abort", he);
|
|
5687
5685
|
}), x.send(typeof O._bodyInit > "u" ? null : O._bodyInit);
|
|
5688
5686
|
});
|
|
5689
5687
|
}
|
|
5690
|
-
return
|
|
5688
|
+
return be.polyfill = !0, i.fetch || (i.fetch = be, i.Headers = y, i.Request = j, i.Response = P), o.Headers = y, o.Request = j, o.Response = P, o.fetch = be, Object.defineProperty(o, "__esModule", { value: !0 }), o;
|
|
5691
5689
|
})({});
|
|
5692
5690
|
})(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
|
|
5693
5691
|
var r = s;
|
|
5694
5692
|
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;
|
|
5695
|
-
})(
|
|
5696
|
-
var
|
|
5697
|
-
const
|
|
5693
|
+
})(He, He.exports);
|
|
5694
|
+
var Ie = He.exports;
|
|
5695
|
+
const Ee = /* @__PURE__ */ Or(Ie), Nr = /* @__PURE__ */ _n({
|
|
5698
5696
|
__proto__: null,
|
|
5699
|
-
default:
|
|
5700
|
-
}, [
|
|
5697
|
+
default: Ee
|
|
5698
|
+
}, [Ie]), Y = (e) => {
|
|
5701
5699
|
let t = {};
|
|
5702
|
-
return e && (typeof Headers < "u" && e instanceof Headers || Nr &&
|
|
5700
|
+
return e && (typeof Headers < "u" && e instanceof Headers || Nr && Ie.Headers && e instanceof Ie.Headers ? t = Ms(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
|
|
5703
5701
|
n && s !== void 0 && (t[n] = s);
|
|
5704
5702
|
}) : t = e), t;
|
|
5705
|
-
},
|
|
5703
|
+
}, kt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), kr = (e) => {
|
|
5706
5704
|
if (!Array.isArray(e.query)) {
|
|
5707
|
-
const s = e, r = [`query=${encodeURIComponent(
|
|
5705
|
+
const s = e, r = [`query=${encodeURIComponent(kt(s.query))}`];
|
|
5708
5706
|
return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
|
|
5709
5707
|
}
|
|
5710
5708
|
if (typeof e.variables < "u" && !Array.isArray(e.variables))
|
|
5711
5709
|
throw new Error("Cannot create query with given variable type, array expected");
|
|
5712
5710
|
const t = e, n = e.query.reduce((s, r, i) => (s.push({
|
|
5713
|
-
query:
|
|
5711
|
+
query: kt(r),
|
|
5714
5712
|
variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
|
|
5715
5713
|
}), s), []);
|
|
5716
5714
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
5717
5715
|
}, Cr = (e) => async (t) => {
|
|
5718
5716
|
const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
|
|
5719
|
-
let
|
|
5720
|
-
e === "POST" ? (d = Dr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) :
|
|
5717
|
+
let h = "", d;
|
|
5718
|
+
e === "POST" ? (d = Dr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = kr({
|
|
5721
5719
|
query: s,
|
|
5722
5720
|
variables: r,
|
|
5723
5721
|
operationName: i,
|
|
5724
|
-
jsonSerializer: a.jsonSerializer ??
|
|
5722
|
+
jsonSerializer: a.jsonSerializer ?? rt
|
|
5725
5723
|
});
|
|
5726
|
-
const
|
|
5724
|
+
const f = {
|
|
5727
5725
|
method: e,
|
|
5728
5726
|
headers: u,
|
|
5729
5727
|
body: d,
|
|
5730
5728
|
...a
|
|
5731
5729
|
};
|
|
5732
|
-
let m = n, y =
|
|
5730
|
+
let m = n, y = f;
|
|
5733
5731
|
if (c) {
|
|
5734
|
-
const v = await Promise.resolve(c({ ...
|
|
5732
|
+
const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: S, ...A } = v;
|
|
5735
5733
|
m = S, y = A;
|
|
5736
5734
|
}
|
|
5737
|
-
return
|
|
5735
|
+
return h && (m = `${m}?${h}`), await o(m, y);
|
|
5738
5736
|
};
|
|
5739
5737
|
class pn {
|
|
5740
5738
|
constructor(t, n = {}) {
|
|
5741
5739
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
|
|
5742
|
-
const [r, i, o] = s, a = qs(r, i, o), { headers: c, fetch: u =
|
|
5740
|
+
const [r, i, o] = s, a = qs(r, i, o), { headers: c, fetch: u = Ee, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
|
|
5743
5741
|
a.signal !== void 0 && (m.signal = a.signal);
|
|
5744
|
-
const { operationName: v } =
|
|
5745
|
-
return
|
|
5742
|
+
const { operationName: v } = Re(a.query);
|
|
5743
|
+
return Le({
|
|
5746
5744
|
url: y,
|
|
5747
5745
|
query: a.query,
|
|
5748
5746
|
variables: a.variables,
|
|
5749
5747
|
headers: {
|
|
5750
|
-
...Y(
|
|
5748
|
+
...Y(Me(c)),
|
|
5751
5749
|
...Y(a.requestHeaders)
|
|
5752
5750
|
},
|
|
5753
5751
|
operationName: v,
|
|
5754
5752
|
fetch: u,
|
|
5755
|
-
method:
|
|
5753
|
+
method: h,
|
|
5756
5754
|
fetchOptions: m,
|
|
5757
5755
|
middleware: d
|
|
5758
|
-
}).then((S) => (
|
|
5759
|
-
throw
|
|
5756
|
+
}).then((S) => (f && f(S), S)).catch((S) => {
|
|
5757
|
+
throw f && f(S), S;
|
|
5760
5758
|
});
|
|
5761
5759
|
};
|
|
5762
5760
|
}
|
|
5763
5761
|
async request(t, ...n) {
|
|
5764
|
-
const [s, r] = n, i = Ps(t, s, r), { headers: o, fetch: a =
|
|
5762
|
+
const [s, r] = n, i = Ps(t, s, r), { headers: o, fetch: a = Ee, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
|
|
5765
5763
|
i.signal !== void 0 && (d.signal = i.signal);
|
|
5766
|
-
const { query: m, operationName: y } =
|
|
5767
|
-
return
|
|
5768
|
-
url:
|
|
5764
|
+
const { query: m, operationName: y } = Re(i.document);
|
|
5765
|
+
return Le({
|
|
5766
|
+
url: f,
|
|
5769
5767
|
query: m,
|
|
5770
5768
|
variables: i.variables,
|
|
5771
5769
|
headers: {
|
|
5772
|
-
...Y(
|
|
5770
|
+
...Y(Me(o)),
|
|
5773
5771
|
...Y(i.requestHeaders)
|
|
5774
5772
|
},
|
|
5775
5773
|
operationName: y,
|
|
@@ -5777,26 +5775,26 @@ class pn {
|
|
|
5777
5775
|
method: c,
|
|
5778
5776
|
fetchOptions: d,
|
|
5779
5777
|
middleware: u
|
|
5780
|
-
}).then((v) => (
|
|
5781
|
-
throw
|
|
5778
|
+
}).then((v) => (h && h(v), v.data)).catch((v) => {
|
|
5779
|
+
throw h && h(v), v;
|
|
5782
5780
|
});
|
|
5783
5781
|
}
|
|
5784
5782
|
// prettier-ignore
|
|
5785
5783
|
batchRequests(t, n) {
|
|
5786
5784
|
const s = Fs(t, n), { headers: r, ...i } = this.requestConfig;
|
|
5787
5785
|
s.signal !== void 0 && (i.signal = s.signal);
|
|
5788
|
-
const o = s.documents.map(({ document: c }) =>
|
|
5789
|
-
return
|
|
5786
|
+
const o = s.documents.map(({ document: c }) => Re(c).query), a = s.documents.map(({ variables: c }) => c);
|
|
5787
|
+
return Le({
|
|
5790
5788
|
url: this.url,
|
|
5791
5789
|
query: o,
|
|
5792
5790
|
// @ts-expect-error TODO reconcile batch variables into system.
|
|
5793
5791
|
variables: a,
|
|
5794
5792
|
headers: {
|
|
5795
|
-
...Y(
|
|
5793
|
+
...Y(Me(r)),
|
|
5796
5794
|
...Y(s.requestHeaders)
|
|
5797
5795
|
},
|
|
5798
5796
|
operationName: void 0,
|
|
5799
|
-
fetch: this.requestConfig.fetch ??
|
|
5797
|
+
fetch: this.requestConfig.fetch ?? Ee,
|
|
5800
5798
|
method: this.requestConfig.method || "POST",
|
|
5801
5799
|
fetchOptions: i,
|
|
5802
5800
|
middleware: this.requestConfig.requestMiddleware
|
|
@@ -5821,22 +5819,22 @@ class pn {
|
|
|
5821
5819
|
return this.url = t, this;
|
|
5822
5820
|
}
|
|
5823
5821
|
}
|
|
5824
|
-
const
|
|
5825
|
-
const { query: t, variables: n, fetchOptions: s } = e, r = Cr(Ls(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Rr(o, s.jsonSerializer ??
|
|
5822
|
+
const Le = async (e) => {
|
|
5823
|
+
const { query: t, variables: n, fetchOptions: s } = e, r = Cr(Ls(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Rr(o, s.jsonSerializer ?? rt), c = Array.isArray(a) ? !a.some(({ data: h }) => !h) : !!a.data, u = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || s.errorPolicy === "all" || s.errorPolicy === "ignore";
|
|
5826
5824
|
if (o.ok && u && c) {
|
|
5827
|
-
const { errors:
|
|
5825
|
+
const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
|
|
5828
5826
|
return {
|
|
5829
|
-
...i ? { data:
|
|
5827
|
+
...i ? { data: f } : f,
|
|
5830
5828
|
headers: o.headers,
|
|
5831
5829
|
status: o.status
|
|
5832
5830
|
};
|
|
5833
5831
|
} else {
|
|
5834
|
-
const
|
|
5832
|
+
const h = typeof a == "string" ? {
|
|
5835
5833
|
error: a
|
|
5836
5834
|
} : a;
|
|
5837
|
-
throw new
|
|
5835
|
+
throw new oe(
|
|
5838
5836
|
// @ts-expect-error TODO
|
|
5839
|
-
{ ...
|
|
5837
|
+
{ ...h, status: o.status, headers: o.headers },
|
|
5840
5838
|
{ query: t, variables: n }
|
|
5841
5839
|
);
|
|
5842
5840
|
}
|
|
@@ -5848,7 +5846,7 @@ async function yn(e, t, ...n) {
|
|
|
5848
5846
|
});
|
|
5849
5847
|
}
|
|
5850
5848
|
const Dr = (e, t, n, s) => {
|
|
5851
|
-
const r = s ??
|
|
5849
|
+
const r = s ?? rt;
|
|
5852
5850
|
if (!Array.isArray(e))
|
|
5853
5851
|
return r.stringify({ query: e, variables: t, operationName: n });
|
|
5854
5852
|
if (typeof t < "u" && !Array.isArray(t))
|
|
@@ -5860,7 +5858,7 @@ const Dr = (e, t, n, s) => {
|
|
|
5860
5858
|
return e.headers.forEach((s, r) => {
|
|
5861
5859
|
r.toLowerCase() === "content-type" && (n = s);
|
|
5862
5860
|
}), 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();
|
|
5863
|
-
},
|
|
5861
|
+
}, Me = (e) => typeof e == "function" ? e() : e, Lr = K(
|
|
5864
5862
|
async ({ input: e }) => {
|
|
5865
5863
|
var t;
|
|
5866
5864
|
if (!e.endpoint || e.endpoint === "")
|
|
@@ -5885,7 +5883,7 @@ const Dr = (e, t, n, s) => {
|
|
|
5885
5883
|
throw new Error("Request to add item(s) failed.");
|
|
5886
5884
|
}
|
|
5887
5885
|
}
|
|
5888
|
-
), Mr =
|
|
5886
|
+
), Mr = K(async ({ input: e }) => {
|
|
5889
5887
|
var t;
|
|
5890
5888
|
if (!e.endpoint || e.endpoint === "")
|
|
5891
5889
|
throw new Error("No endpoint provided.");
|
|
@@ -5908,7 +5906,7 @@ const Dr = (e, t, n, s) => {
|
|
|
5908
5906
|
} catch {
|
|
5909
5907
|
throw new Error("Request to remove item(s) failed.");
|
|
5910
5908
|
}
|
|
5911
|
-
}),
|
|
5909
|
+
}), Pe = typeof window > "u", Pr = K(
|
|
5912
5910
|
async ({ input: e }) => {
|
|
5913
5911
|
var n, s, r, i;
|
|
5914
5912
|
if (!e.endpoint)
|
|
@@ -5922,18 +5920,18 @@ const Dr = (e, t, n, s) => {
|
|
|
5922
5920
|
if (!e.requestHeaders)
|
|
5923
5921
|
throw console.log("no headers"), new Error("No request headers provided.");
|
|
5924
5922
|
const t = new pn(
|
|
5925
|
-
|
|
5926
|
-
|
|
5923
|
+
Pe ? e.endpointSsr : e.endpoint,
|
|
5924
|
+
Pe ? { fetch, method: "POST" } : {
|
|
5927
5925
|
credentials: "include",
|
|
5928
5926
|
method: "POST",
|
|
5929
5927
|
mode: "cors"
|
|
5930
5928
|
}
|
|
5931
5929
|
);
|
|
5932
5930
|
try {
|
|
5933
|
-
const { data: o, headers: a, status: c, errors: u, extensions:
|
|
5931
|
+
const { data: o, headers: a, status: c, errors: u, extensions: h } = await t.rawRequest(
|
|
5934
5932
|
fn(e.document),
|
|
5935
5933
|
{},
|
|
5936
|
-
|
|
5934
|
+
Pe ? {
|
|
5937
5935
|
...e.requestHeaders,
|
|
5938
5936
|
Cookie: `quote_${e.locale}=${e.quoteId ?? ""}`
|
|
5939
5937
|
} : e.requestHeaders
|
|
@@ -5950,7 +5948,7 @@ const Dr = (e, t, n, s) => {
|
|
|
5950
5948
|
throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
|
|
5951
5949
|
}
|
|
5952
5950
|
}
|
|
5953
|
-
), qr = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", Fr = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0,
|
|
5951
|
+
), qr = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", Fr = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Ct = xe({
|
|
5954
5952
|
types: {
|
|
5955
5953
|
context: {},
|
|
5956
5954
|
events: {},
|
|
@@ -5975,7 +5973,7 @@ const Dr = (e, t, n, s) => {
|
|
|
5975
5973
|
id: "quote",
|
|
5976
5974
|
initial: "initializing",
|
|
5977
5975
|
context: ({ input: e }) => {
|
|
5978
|
-
var t, n, s, r, i, o, a, c, u,
|
|
5976
|
+
var t, n, s, r, i, o, a, c, u, h, d, f, m, y;
|
|
5979
5977
|
return {
|
|
5980
5978
|
quote: {
|
|
5981
5979
|
id: "",
|
|
@@ -6036,8 +6034,8 @@ const Dr = (e, t, n, s) => {
|
|
|
6036
6034
|
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
|
|
6037
6035
|
},
|
|
6038
6036
|
addItems: {
|
|
6039
|
-
document: ((d = (
|
|
6040
|
-
requestHeaders: ((y = (m = (
|
|
6037
|
+
document: ((d = (h = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : h.addItems) == null ? void 0 : d.document) ?? "",
|
|
6038
|
+
requestHeaders: ((y = (m = (f = e == null ? void 0 : e.initialContext) == null ? void 0 : f.graphql) == null ? void 0 : m.addItems) == null ? void 0 : y.requestHeaders) ?? void 0
|
|
6041
6039
|
}
|
|
6042
6040
|
// removeItems: {
|
|
6043
6041
|
// document: input.initialContext.graphql?.removeItems?.document ?? '',
|
|
@@ -6119,12 +6117,7 @@ const Dr = (e, t, n, s) => {
|
|
|
6119
6117
|
onDone: [
|
|
6120
6118
|
{
|
|
6121
6119
|
actions: ["refresh"],
|
|
6122
|
-
|
|
6123
|
-
target: "active"
|
|
6124
|
-
},
|
|
6125
|
-
{
|
|
6126
|
-
actions: ["refresh"],
|
|
6127
|
-
target: "empty"
|
|
6120
|
+
target: "checkingItems"
|
|
6128
6121
|
}
|
|
6129
6122
|
],
|
|
6130
6123
|
onError: {
|
|
@@ -6132,6 +6125,20 @@ const Dr = (e, t, n, s) => {
|
|
|
6132
6125
|
}
|
|
6133
6126
|
}
|
|
6134
6127
|
},
|
|
6128
|
+
/**
|
|
6129
|
+
* Transient state after refresh to transition to active or empty state
|
|
6130
|
+
*/
|
|
6131
|
+
checkingItems: {
|
|
6132
|
+
always: [
|
|
6133
|
+
{
|
|
6134
|
+
guard: "hasItems",
|
|
6135
|
+
target: "active"
|
|
6136
|
+
},
|
|
6137
|
+
{
|
|
6138
|
+
target: "empty"
|
|
6139
|
+
}
|
|
6140
|
+
]
|
|
6141
|
+
},
|
|
6135
6142
|
/**
|
|
6136
6143
|
* Adding item(s) to quote
|
|
6137
6144
|
*/
|
|
@@ -6231,52 +6238,37 @@ const Dr = (e, t, n, s) => {
|
|
|
6231
6238
|
// removingGiftCard: {},
|
|
6232
6239
|
// applyingSettings: {},
|
|
6233
6240
|
}
|
|
6234
|
-
}), mn =
|
|
6241
|
+
}), mn = ze(
|
|
6235
6242
|
{}
|
|
6236
6243
|
), Jr = () => {
|
|
6237
|
-
|
|
6244
|
+
var c;
|
|
6245
|
+
const e = Je(mn);
|
|
6238
6246
|
if (!e || !e.getSnapshot)
|
|
6239
6247
|
throw new Error("quoteActor is not properly initialized");
|
|
6240
|
-
const [t, n] =
|
|
6241
|
-
|
|
6242
|
-
), [s, r] = X(
|
|
6243
|
-
() => {
|
|
6244
|
-
var d;
|
|
6245
|
-
return ((d = e.getSnapshot().context.quote.items) == null ? void 0 : d.length) ?? 0;
|
|
6246
|
-
}
|
|
6247
|
-
), [i, o] = X(
|
|
6248
|
-
() => e.getSnapshot().matches("addingItems")
|
|
6249
|
-
), [a, c] = X(
|
|
6250
|
-
() => e.getSnapshot().matches("removingItems")
|
|
6251
|
-
), [u, f] = X(
|
|
6252
|
-
() => e.getSnapshot().matches("addingItems") || e.getSnapshot().matches("removingItems")
|
|
6253
|
-
);
|
|
6254
|
-
return Rt(() => {
|
|
6248
|
+
const [t, n] = Dt(() => e.getSnapshot());
|
|
6249
|
+
Rt(() => {
|
|
6255
6250
|
if (!e || !e.getSnapshot) {
|
|
6256
6251
|
console.error("quoteActor is not properly initialized");
|
|
6257
6252
|
return;
|
|
6258
6253
|
}
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
);
|
|
6265
|
-
};
|
|
6266
|
-
d();
|
|
6267
|
-
const h = e.subscribe(() => {
|
|
6268
|
-
d();
|
|
6254
|
+
(() => {
|
|
6255
|
+
n(e.getSnapshot());
|
|
6256
|
+
})();
|
|
6257
|
+
const h = e.subscribe((d) => {
|
|
6258
|
+
n(d);
|
|
6269
6259
|
});
|
|
6270
6260
|
return () => {
|
|
6271
6261
|
h.unsubscribe();
|
|
6272
6262
|
};
|
|
6273
|
-
}, [e])
|
|
6263
|
+
}, [e]);
|
|
6264
|
+
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");
|
|
6265
|
+
return {
|
|
6274
6266
|
quoteActor: e,
|
|
6275
|
-
items:
|
|
6276
|
-
itemsCount:
|
|
6267
|
+
items: s,
|
|
6268
|
+
itemsCount: r,
|
|
6277
6269
|
isAddingItems: i,
|
|
6278
|
-
isRemovingItems:
|
|
6279
|
-
isUpdatingItems:
|
|
6270
|
+
isRemovingItems: o,
|
|
6271
|
+
isUpdatingItems: a
|
|
6280
6272
|
};
|
|
6281
6273
|
}, Yr = async (e = {
|
|
6282
6274
|
inspect: void 0,
|
|
@@ -6285,14 +6277,14 @@ const Dr = (e, t, n, s) => {
|
|
|
6285
6277
|
graphql: {}
|
|
6286
6278
|
}) => typeof window < "u" ? (console.warn(
|
|
6287
6279
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
6288
|
-
), U(
|
|
6280
|
+
), U(Ct, {
|
|
6289
6281
|
inspect: e.inspect,
|
|
6290
6282
|
input: {
|
|
6291
6283
|
initialContext: {
|
|
6292
6284
|
endpoints: e.endpoints
|
|
6293
6285
|
}
|
|
6294
6286
|
}
|
|
6295
|
-
}).start()) : U(
|
|
6287
|
+
}).start()) : U(Ct, {
|
|
6296
6288
|
input: {
|
|
6297
6289
|
initialContext: {
|
|
6298
6290
|
endpoints: e.endpoints,
|
|
@@ -6306,7 +6298,7 @@ const Dr = (e, t, n, s) => {
|
|
|
6306
6298
|
inspect: e.inspect
|
|
6307
6299
|
}).start();
|
|
6308
6300
|
function Xr({ actor: e, children: t }) {
|
|
6309
|
-
return /* @__PURE__ */
|
|
6301
|
+
return /* @__PURE__ */ Ge(mn.Provider, { value: e, children: t });
|
|
6310
6302
|
}
|
|
6311
6303
|
export {
|
|
6312
6304
|
en as AuthContext,
|
|
@@ -6315,10 +6307,10 @@ export {
|
|
|
6315
6307
|
Xr as QuoteProvider,
|
|
6316
6308
|
tn as ToastContext,
|
|
6317
6309
|
zr as ToastProvider,
|
|
6318
|
-
|
|
6310
|
+
St as authMachine,
|
|
6319
6311
|
$r as getAuth,
|
|
6320
6312
|
Yr as getQuote,
|
|
6321
|
-
|
|
6313
|
+
Ct as quoteMachine,
|
|
6322
6314
|
ks as timerMachine,
|
|
6323
6315
|
Hr as toastMachine,
|
|
6324
6316
|
jr as useAuth,
|