@clicktap/state 0.13.15 → 0.13.17
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 +23 -23
- package/index.mjs +953 -766
- package/package.json +1 -1
- package/quote/QuoteProvider.d.ts +147 -12
- package/quote/actions/addItems.d.ts +10 -1
- package/quote/actions/index.d.ts +4 -0
- package/quote/actions/notifyAddItems.d.ts +6 -0
- package/quote/actions/notifyRemoveItems.d.ts +6 -0
- package/quote/actions/notifyUpdateItems.d.ts +6 -0
- package/quote/actions/refresh.d.ts +9 -1
- package/quote/actions/removeItems.d.ts +10 -1
- package/quote/actions/updateItems.d.ts +91 -0
- package/quote/actors/addItems.d.ts +4 -0
- package/quote/actors/index.d.ts +1 -0
- package/quote/actors/removeItems.d.ts +4 -0
- package/quote/actors/updateItems.d.ts +23 -0
- package/quote/quote.d.ts +49 -4
- package/quote/types.d.ts +39 -2
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
function
|
|
1
|
+
import { jsx as ze } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Je, useContext as Ye, useState as Mt, useEffect as qt, cloneElement as _n } from "react";
|
|
3
|
+
function In(e, t) {
|
|
4
4
|
for (var n = 0; n < t.length; n++) {
|
|
5
5
|
const s = t[n];
|
|
6
6
|
if (typeof s != "string" && !Array.isArray(s)) {
|
|
@@ -16,7 +16,7 @@ function _n(e, t) {
|
|
|
16
16
|
}
|
|
17
17
|
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Sn() {
|
|
20
20
|
if (typeof globalThis < "u")
|
|
21
21
|
return globalThis;
|
|
22
22
|
if (typeof self < "u")
|
|
@@ -26,18 +26,18 @@ function In() {
|
|
|
26
26
|
if (typeof global < "u")
|
|
27
27
|
return global;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const e =
|
|
29
|
+
function An() {
|
|
30
|
+
const e = Sn();
|
|
31
31
|
if (e.__xstate__)
|
|
32
32
|
return e.__xstate__;
|
|
33
33
|
}
|
|
34
34
|
const xn = (e) => {
|
|
35
35
|
if (typeof window > "u")
|
|
36
36
|
return;
|
|
37
|
-
const t =
|
|
37
|
+
const t = An();
|
|
38
38
|
t && t.register(e);
|
|
39
39
|
};
|
|
40
|
-
class
|
|
40
|
+
class ut {
|
|
41
41
|
constructor(t) {
|
|
42
42
|
this._process = t, this._active = !1, this._current = null, this._last = null;
|
|
43
43
|
}
|
|
@@ -66,68 +66,68 @@ class at {
|
|
|
66
66
|
this._last = null;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const Lt = ".",
|
|
70
|
-
function
|
|
69
|
+
const Lt = ".", wn = "", Ut = "", bn = "#", On = "*", Pt = "xstate.init", Nn = "xstate.error", ce = "xstate.stop";
|
|
70
|
+
function kn(e, t) {
|
|
71
71
|
return {
|
|
72
72
|
type: `xstate.after.${e}.${t}`
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Pe(e, t) {
|
|
76
76
|
return {
|
|
77
77
|
type: `xstate.done.state.${e}`,
|
|
78
78
|
output: t
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Cn(e, t) {
|
|
82
82
|
return {
|
|
83
83
|
type: `xstate.done.actor.${e}`,
|
|
84
84
|
output: t
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function Ft(e, t) {
|
|
88
88
|
return {
|
|
89
89
|
type: `xstate.error.actor.${e}`,
|
|
90
90
|
error: t
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Bt(e) {
|
|
94
94
|
return {
|
|
95
95
|
type: Pt,
|
|
96
96
|
input: e
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function P(e) {
|
|
100
100
|
setTimeout(() => {
|
|
101
101
|
throw e;
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
104
|
+
const Dn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
|
|
105
|
+
function dt(e, t) {
|
|
106
106
|
return `${e.sessionId}.${t}`;
|
|
107
107
|
}
|
|
108
|
-
let
|
|
109
|
-
function
|
|
108
|
+
let Rn = 0;
|
|
109
|
+
function Mn(e, t) {
|
|
110
110
|
const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Set(), o = {}, {
|
|
111
111
|
clock: a,
|
|
112
112
|
logger: c
|
|
113
113
|
} = t, u = {
|
|
114
114
|
schedule: (f, m, y, v, S = Math.random().toString(36).slice(2)) => {
|
|
115
|
-
const
|
|
115
|
+
const x = {
|
|
116
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 =
|
|
123
|
-
d._snapshot._scheduledEvents[R] =
|
|
124
|
-
const
|
|
122
|
+
}, R = dt(f, S);
|
|
123
|
+
d._snapshot._scheduledEvents[R] = x;
|
|
124
|
+
const k = a.setTimeout(() => {
|
|
125
125
|
delete o[R], delete d._snapshot._scheduledEvents[R], d._relay(f, m, y);
|
|
126
126
|
}, v);
|
|
127
|
-
o[R] =
|
|
127
|
+
o[R] = k;
|
|
128
128
|
},
|
|
129
129
|
cancel: (f, m) => {
|
|
130
|
-
const y =
|
|
130
|
+
const y = dt(f, m), v = o[y];
|
|
131
131
|
delete o[y], delete d._snapshot._scheduledEvents[y], a.clearTimeout(v);
|
|
132
132
|
},
|
|
133
133
|
cancelAll: (f) => {
|
|
@@ -151,7 +151,7 @@ function Rn(e, t) {
|
|
|
151
151
|
_snapshot: {
|
|
152
152
|
_scheduledEvents: ((t == null ? void 0 : t.snapshot) && t.snapshot.scheduler) ?? {}
|
|
153
153
|
},
|
|
154
|
-
_bookId: () => `x:${
|
|
154
|
+
_bookId: () => `x:${Rn++}`,
|
|
155
155
|
_register: (f, m) => (n.set(f, m), f),
|
|
156
156
|
_unregister: (f) => {
|
|
157
157
|
n.delete(f.sessionId);
|
|
@@ -191,10 +191,10 @@ function Rn(e, t) {
|
|
|
191
191
|
source: y,
|
|
192
192
|
target: v,
|
|
193
193
|
event: S,
|
|
194
|
-
delay:
|
|
194
|
+
delay: x,
|
|
195
195
|
id: R
|
|
196
196
|
} = f[m];
|
|
197
|
-
u.schedule(y, v, S,
|
|
197
|
+
u.schedule(y, v, S, x, R);
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
_clock: a,
|
|
@@ -202,12 +202,12 @@ function Rn(e, t) {
|
|
|
202
202
|
};
|
|
203
203
|
return d;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const n =
|
|
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 ?
|
|
205
|
+
function jt(e, t) {
|
|
206
|
+
const n = lt(e), s = lt(t);
|
|
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 ? jt(n[r], s[r]) : !1);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
if (
|
|
209
|
+
function Xe(e) {
|
|
210
|
+
if (Vt(e))
|
|
211
211
|
return e;
|
|
212
212
|
let t = [], n = "";
|
|
213
213
|
for (let s = 0; s < e.length; s++) {
|
|
@@ -223,15 +223,15 @@ function Ye(e) {
|
|
|
223
223
|
}
|
|
224
224
|
return t.push(n), t;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
if (
|
|
226
|
+
function lt(e) {
|
|
227
|
+
if (ls(e))
|
|
228
228
|
return e.value;
|
|
229
229
|
if (typeof e != "string")
|
|
230
230
|
return e;
|
|
231
|
-
const t =
|
|
232
|
-
return
|
|
231
|
+
const t = Xe(e);
|
|
232
|
+
return qn(t);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function qn(e) {
|
|
235
235
|
if (e.length === 1)
|
|
236
236
|
return e[0];
|
|
237
237
|
const t = {};
|
|
@@ -245,7 +245,7 @@ function Ln(e) {
|
|
|
245
245
|
}
|
|
246
246
|
return t;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function ht(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];
|
|
@@ -253,11 +253,11 @@ function dt(e, t) {
|
|
|
253
253
|
}
|
|
254
254
|
return n;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
return
|
|
256
|
+
function $t(e) {
|
|
257
|
+
return Vt(e) ? e : [e];
|
|
258
258
|
}
|
|
259
259
|
function F(e) {
|
|
260
|
-
return e === void 0 ? [] :
|
|
260
|
+
return e === void 0 ? [] : $t(e);
|
|
261
261
|
}
|
|
262
262
|
function Fe(e, t, n, s) {
|
|
263
263
|
return typeof e == "function" ? e({
|
|
@@ -266,22 +266,22 @@ function Fe(e, t, n, s) {
|
|
|
266
266
|
self: s
|
|
267
267
|
}) : e;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Vt(e) {
|
|
270
270
|
return Array.isArray(e);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Ln(e) {
|
|
273
273
|
return e.type.startsWith("xstate.error.actor");
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
275
|
+
function W(e) {
|
|
276
|
+
return $t(e).map((t) => typeof t > "u" || typeof t == "string" ? {
|
|
277
277
|
target: t
|
|
278
278
|
} : t);
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!(e === void 0 || e ===
|
|
280
|
+
function Ht(e) {
|
|
281
|
+
if (!(e === void 0 || e === wn))
|
|
282
282
|
return F(e);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function ft(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,21 +290,21 @@ function lt(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 pt(e, t) {
|
|
294
294
|
return `${t}.${e}`;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Qe(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
|
|
304
|
-
let
|
|
303
|
+
const We = 1;
|
|
304
|
+
let C = /* @__PURE__ */ function(e) {
|
|
305
305
|
return e[e.NotStarted = 0] = "NotStarted", e[e.Running = 1] = "Running", e[e.Stopped = 2] = "Stopped", e;
|
|
306
306
|
}({});
|
|
307
|
-
const
|
|
307
|
+
const Un = {
|
|
308
308
|
clock: {
|
|
309
309
|
setTimeout: (e, t) => setTimeout(e, t),
|
|
310
310
|
clearTimeout: (e) => clearTimeout(e)
|
|
@@ -312,7 +312,7 @@ const Pn = {
|
|
|
312
312
|
logger: console.log.bind(console),
|
|
313
313
|
devTools: !1
|
|
314
314
|
};
|
|
315
|
-
class
|
|
315
|
+
class Pn {
|
|
316
316
|
/**
|
|
317
317
|
* Creates a new actor instance for the given logic with the provided options, if any.
|
|
318
318
|
*
|
|
@@ -320,9 +320,9 @@ 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 ut(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = C.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
|
+
...Un,
|
|
326
326
|
...n
|
|
327
327
|
}, {
|
|
328
328
|
clock: r,
|
|
@@ -333,10 +333,10 @@ class qn {
|
|
|
333
333
|
systemId: u,
|
|
334
334
|
inspect: h
|
|
335
335
|
} = s;
|
|
336
|
-
this.system = o ? o.system :
|
|
336
|
+
this.system = o ? o.system : Mn(this, {
|
|
337
337
|
clock: r,
|
|
338
338
|
logger: i
|
|
339
|
-
}), h && !o && this.system.inspect(
|
|
339
|
+
}), h && !o && this.system.inspect(ft(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,
|
|
@@ -393,7 +393,7 @@ class qn {
|
|
|
393
393
|
try {
|
|
394
394
|
(r = o.next) == null || r.call(o, t);
|
|
395
395
|
} catch (a) {
|
|
396
|
-
|
|
396
|
+
P(a);
|
|
397
397
|
}
|
|
398
398
|
break;
|
|
399
399
|
case "done":
|
|
@@ -401,9 +401,9 @@ class qn {
|
|
|
401
401
|
try {
|
|
402
402
|
(i = o.next) == null || i.call(o, t);
|
|
403
403
|
} catch (a) {
|
|
404
|
-
|
|
404
|
+
P(a);
|
|
405
405
|
}
|
|
406
|
-
this._stopProcedure(), this._complete(), this._doneEvent =
|
|
406
|
+
this._stopProcedure(), this._complete(), this._doneEvent = Cn(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
|
|
407
407
|
break;
|
|
408
408
|
case "error":
|
|
409
409
|
this._error(this._snapshot.error);
|
|
@@ -466,8 +466,8 @@ class qn {
|
|
|
466
466
|
*/
|
|
467
467
|
subscribe(t, n, s) {
|
|
468
468
|
var i;
|
|
469
|
-
const r =
|
|
470
|
-
if (this._processingStatus !==
|
|
469
|
+
const r = ft(t, n, s);
|
|
470
|
+
if (this._processingStatus !== C.Stopped)
|
|
471
471
|
this.observers.add(r);
|
|
472
472
|
else
|
|
473
473
|
switch (this._snapshot.status) {
|
|
@@ -475,18 +475,18 @@ class qn {
|
|
|
475
475
|
try {
|
|
476
476
|
(i = r.complete) == null || i.call(r);
|
|
477
477
|
} catch (o) {
|
|
478
|
-
|
|
478
|
+
P(o);
|
|
479
479
|
}
|
|
480
480
|
break;
|
|
481
481
|
case "error": {
|
|
482
482
|
const o = this._snapshot.error;
|
|
483
483
|
if (!r.error)
|
|
484
|
-
|
|
484
|
+
P(o);
|
|
485
485
|
else
|
|
486
486
|
try {
|
|
487
487
|
r.error(o);
|
|
488
488
|
} catch (a) {
|
|
489
|
-
|
|
489
|
+
P(a);
|
|
490
490
|
}
|
|
491
491
|
break;
|
|
492
492
|
}
|
|
@@ -511,7 +511,7 @@ class qn {
|
|
|
511
511
|
* Starts the Actor from the initial state
|
|
512
512
|
*/
|
|
513
513
|
start() {
|
|
514
|
-
if (this._processingStatus ===
|
|
514
|
+
if (this._processingStatus === C.Running)
|
|
515
515
|
return this;
|
|
516
516
|
this._syncSnapshot && this.subscribe({
|
|
517
517
|
next: (s) => {
|
|
@@ -522,8 +522,8 @@ class qn {
|
|
|
522
522
|
},
|
|
523
523
|
error: () => {
|
|
524
524
|
}
|
|
525
|
-
}), this.system._register(this.sessionId, this), this._systemId && this.system._set(this._systemId, this), this._processingStatus =
|
|
526
|
-
const t =
|
|
525
|
+
}), this.system._register(this.sessionId, this), this._systemId && this.system._set(this._systemId, this), this._processingStatus = C.Running;
|
|
526
|
+
const t = Bt(this.options.input);
|
|
527
527
|
switch (this.system._sendInspectionEvent({
|
|
528
528
|
type: "@xstate.event",
|
|
529
529
|
sourceRef: this._parent,
|
|
@@ -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 === ce && (this._stopProcedure(), this._complete());
|
|
571
571
|
}
|
|
572
572
|
_stop() {
|
|
573
|
-
return this._processingStatus ===
|
|
574
|
-
type:
|
|
573
|
+
return this._processingStatus === C.Stopped ? this : (this.mailbox.clear(), this._processingStatus === C.NotStarted ? (this._processingStatus = C.Stopped, this) : (this.mailbox.enqueue({
|
|
574
|
+
type: ce
|
|
575
575
|
}), this));
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
@@ -588,13 +588,13 @@ class qn {
|
|
|
588
588
|
try {
|
|
589
589
|
(t = n.complete) == null || t.call(n);
|
|
590
590
|
} catch (s) {
|
|
591
|
-
|
|
591
|
+
P(s);
|
|
592
592
|
}
|
|
593
593
|
this.observers.clear();
|
|
594
594
|
}
|
|
595
595
|
_reportError(t) {
|
|
596
596
|
if (!this.observers.size) {
|
|
597
|
-
this._parent ||
|
|
597
|
+
this._parent || P(t);
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
600
|
let n = !1;
|
|
@@ -604,13 +604,13 @@ class qn {
|
|
|
604
604
|
try {
|
|
605
605
|
r == null || r(t);
|
|
606
606
|
} catch (i) {
|
|
607
|
-
|
|
607
|
+
P(i);
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
this.observers.clear(), n &&
|
|
610
|
+
this.observers.clear(), n && P(t);
|
|
611
611
|
}
|
|
612
612
|
_error(t) {
|
|
613
|
-
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent,
|
|
613
|
+
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, Ft(this.id, t));
|
|
614
614
|
}
|
|
615
615
|
// TODO: atm children don't belong entirely to the actor so
|
|
616
616
|
// in a way - it's not even super aware of them
|
|
@@ -618,13 +618,13 @@ 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 !==
|
|
621
|
+
return this._processingStatus !== C.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new ut(this._process.bind(this)), this._processingStatus = C.Stopped, this.system._unregister(this), this);
|
|
622
622
|
}
|
|
623
623
|
/**
|
|
624
624
|
* @internal
|
|
625
625
|
*/
|
|
626
626
|
_send(t) {
|
|
627
|
-
this._processingStatus !==
|
|
627
|
+
this._processingStatus !== C.Stopped && this.mailbox.enqueue(t);
|
|
628
628
|
}
|
|
629
629
|
/**
|
|
630
630
|
* Sends an event to the running Actor to trigger a transition.
|
|
@@ -642,7 +642,7 @@ class qn {
|
|
|
642
642
|
}
|
|
643
643
|
toJSON() {
|
|
644
644
|
return {
|
|
645
|
-
xstate$$type:
|
|
645
|
+
xstate$$type: We,
|
|
646
646
|
id: this.id
|
|
647
647
|
};
|
|
648
648
|
}
|
|
@@ -661,7 +661,7 @@ class qn {
|
|
|
661
661
|
getPersistedSnapshot(t) {
|
|
662
662
|
return this.logic.getPersistedSnapshot(this._snapshot, t);
|
|
663
663
|
}
|
|
664
|
-
[
|
|
664
|
+
[Dn]() {
|
|
665
665
|
return this;
|
|
666
666
|
}
|
|
667
667
|
/**
|
|
@@ -682,8 +682,8 @@ class qn {
|
|
|
682
682
|
return this._snapshot;
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
function
|
|
686
|
-
return new
|
|
685
|
+
function B(e, ...[t]) {
|
|
686
|
+
return new Pn(e, t);
|
|
687
687
|
}
|
|
688
688
|
function Fn(e, t, n, s, {
|
|
689
689
|
sendId: r
|
|
@@ -691,26 +691,26 @@ function Fn(e, t, n, s, {
|
|
|
691
691
|
const i = typeof r == "function" ? r(n, s) : r;
|
|
692
692
|
return [t, i];
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function Bn(e, t) {
|
|
695
695
|
e.defer(() => {
|
|
696
696
|
e.system.scheduler.cancel(e.self, t);
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function jn(e) {
|
|
700
700
|
function t(n, s) {
|
|
701
701
|
}
|
|
702
|
-
return t.type = "xstate.cancel", t.sendId = e, t.resolve = Fn, t.execute =
|
|
702
|
+
return t.type = "xstate.cancel", t.sendId = e, t.resolve = Fn, t.execute = Bn, t;
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function $n(e, t, n, s, {
|
|
705
705
|
id: r,
|
|
706
706
|
systemId: i,
|
|
707
707
|
src: o,
|
|
708
708
|
input: a,
|
|
709
709
|
syncSnapshot: c
|
|
710
710
|
}) {
|
|
711
|
-
const u = typeof o == "string" ?
|
|
711
|
+
const u = typeof o == "string" ? Qe(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
|
|
712
712
|
let d;
|
|
713
|
-
return u && (d =
|
|
713
|
+
return u && (d = B(u, {
|
|
714
714
|
id: h,
|
|
715
715
|
src: o,
|
|
716
716
|
parent: e.self,
|
|
@@ -721,7 +721,7 @@ function jn(e, t, n, s, {
|
|
|
721
721
|
event: n.event,
|
|
722
722
|
self: e.self
|
|
723
723
|
}) : a
|
|
724
|
-
})), [
|
|
724
|
+
})), [J(t, {
|
|
725
725
|
children: {
|
|
726
726
|
...t.children,
|
|
727
727
|
[h]: d
|
|
@@ -731,15 +731,15 @@ function jn(e, t, n, s, {
|
|
|
731
731
|
actorRef: d
|
|
732
732
|
}];
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function Vn(e, {
|
|
735
735
|
id: t,
|
|
736
736
|
actorRef: n
|
|
737
737
|
}) {
|
|
738
738
|
n && e.defer(() => {
|
|
739
|
-
n._processingStatus !==
|
|
739
|
+
n._processingStatus !== C.Stopped && n.start();
|
|
740
740
|
});
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function Hn(...[e, {
|
|
743
743
|
id: t,
|
|
744
744
|
systemId: n,
|
|
745
745
|
input: s,
|
|
@@ -747,22 +747,22 @@ function Vn(...[e, {
|
|
|
747
747
|
} = {}]) {
|
|
748
748
|
function i(o, a) {
|
|
749
749
|
}
|
|
750
|
-
return i.type = "snapshot.spawnChild", i.id = t, i.systemId = n, i.src = e, i.input = s, i.syncSnapshot = r, i.resolve =
|
|
750
|
+
return i.type = "snapshot.spawnChild", i.id = t, i.systemId = n, i.src = e, i.input = s, i.syncSnapshot = r, i.resolve = $n, i.execute = Vn, i;
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function Gn(e, t, n, s, {
|
|
753
753
|
actorRef: r
|
|
754
754
|
}) {
|
|
755
755
|
const i = typeof r == "function" ? r(n, s) : r, o = typeof i == "string" ? t.children[i] : i;
|
|
756
756
|
let a = t.children;
|
|
757
757
|
return o && (a = {
|
|
758
758
|
...a
|
|
759
|
-
}, delete a[o.id]), [
|
|
759
|
+
}, delete a[o.id]), [J(t, {
|
|
760
760
|
children: a
|
|
761
761
|
}), o];
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function zn(e, t) {
|
|
764
764
|
if (t) {
|
|
765
|
-
if (e.system._unregister(t), t._processingStatus !==
|
|
765
|
+
if (e.system._unregister(t), t._processingStatus !== C.Running) {
|
|
766
766
|
e.stopChild(t);
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
@@ -771,19 +771,19 @@ function Gn(e, t) {
|
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function Gt(e) {
|
|
775
775
|
function t(n, s) {
|
|
776
776
|
}
|
|
777
|
-
return t.type = "xstate.stopChild", t.actorRef = e, t.resolve =
|
|
777
|
+
return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Gn, t.execute = zn, t;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Ke(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 Ke(o, t, n, s);
|
|
787
787
|
const a = {
|
|
788
788
|
context: t,
|
|
789
789
|
event: n
|
|
@@ -798,11 +798,11 @@ function We(e, t, n, s) {
|
|
|
798
798
|
// this holds all params
|
|
799
799
|
) : o(a, c);
|
|
800
800
|
}
|
|
801
|
-
const
|
|
802
|
-
function
|
|
801
|
+
const Ze = (e) => e.type === "atomic" || e.type === "final";
|
|
802
|
+
function ee(e) {
|
|
803
803
|
return Object.values(e.states).filter((t) => t.type !== "history");
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function de(e, t) {
|
|
806
806
|
const n = [];
|
|
807
807
|
if (t === e)
|
|
808
808
|
return n;
|
|
@@ -812,14 +812,14 @@ function ue(e, t) {
|
|
|
812
812
|
return n;
|
|
813
813
|
}
|
|
814
814
|
function ve(e) {
|
|
815
|
-
const t = new Set(e), n =
|
|
815
|
+
const t = new Set(e), n = Jt(t);
|
|
816
816
|
for (const s of t)
|
|
817
817
|
if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
|
|
818
|
-
|
|
818
|
+
yt(s).forEach((r) => t.add(r));
|
|
819
819
|
else if (s.type === "parallel") {
|
|
820
|
-
for (const r of
|
|
820
|
+
for (const r of ee(s))
|
|
821
821
|
if (r.type !== "history" && !t.has(r)) {
|
|
822
|
-
const i =
|
|
822
|
+
const i = yt(r);
|
|
823
823
|
for (const o of i)
|
|
824
824
|
t.add(o);
|
|
825
825
|
}
|
|
@@ -831,40 +831,40 @@ function ve(e) {
|
|
|
831
831
|
}
|
|
832
832
|
return t;
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function zt(e, t) {
|
|
835
835
|
const n = t.get(e);
|
|
836
836
|
if (!n)
|
|
837
837
|
return {};
|
|
838
838
|
if (e.type === "compound") {
|
|
839
839
|
const r = n[0];
|
|
840
840
|
if (r) {
|
|
841
|
-
if (
|
|
841
|
+
if (Ze(r))
|
|
842
842
|
return r.key;
|
|
843
843
|
} else
|
|
844
844
|
return {};
|
|
845
845
|
}
|
|
846
846
|
const s = {};
|
|
847
847
|
for (const r of n)
|
|
848
|
-
s[r.key] =
|
|
848
|
+
s[r.key] = zt(r, t);
|
|
849
849
|
return s;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function Jt(e) {
|
|
852
852
|
const t = /* @__PURE__ */ new Map();
|
|
853
853
|
for (const n of e)
|
|
854
854
|
t.has(n) || t.set(n, []), n.parent && (t.has(n.parent) || t.set(n.parent, []), t.get(n.parent).push(n));
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function Yt(e, t) {
|
|
858
858
|
const n = ve(t);
|
|
859
|
-
return
|
|
859
|
+
return zt(e, Jt(n));
|
|
860
860
|
}
|
|
861
|
-
function
|
|
862
|
-
return t.type === "compound" ?
|
|
861
|
+
function et(e, t) {
|
|
862
|
+
return t.type === "compound" ? ee(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? ee(t).every((n) => et(e, n)) : t.type === "final";
|
|
863
863
|
}
|
|
864
|
-
const Se = (e) => e[0] ===
|
|
865
|
-
function
|
|
864
|
+
const Se = (e) => e[0] === bn;
|
|
865
|
+
function Jn(e, t) {
|
|
866
866
|
return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
|
|
867
|
-
if (s ===
|
|
867
|
+
if (s === On)
|
|
868
868
|
return !0;
|
|
869
869
|
if (!s.endsWith(".*"))
|
|
870
870
|
return !1;
|
|
@@ -879,16 +879,16 @@ function zn(e, t) {
|
|
|
879
879
|
return !0;
|
|
880
880
|
}).sort((s, r) => r.length - s.length).flatMap((s) => e.transitions.get(s));
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function Yn(e) {
|
|
883
883
|
const t = e.config.after;
|
|
884
884
|
if (!t)
|
|
885
885
|
return [];
|
|
886
886
|
const n = (r, i) => {
|
|
887
|
-
const o =
|
|
888
|
-
return e.entry.push(
|
|
887
|
+
const o = kn(r, e.id), a = o.type;
|
|
888
|
+
return e.entry.push(Ts(o, {
|
|
889
889
|
id: a,
|
|
890
890
|
delay: r
|
|
891
|
-
})), e.exit.push(
|
|
891
|
+
})), e.exit.push(jn(a)), a;
|
|
892
892
|
};
|
|
893
893
|
return Object.keys(t).flatMap((r, i) => {
|
|
894
894
|
const o = t[r], a = typeof o == "string" ? {
|
|
@@ -904,13 +904,13 @@ function Jn(e) {
|
|
|
904
904
|
delay: i
|
|
905
905
|
} = r;
|
|
906
906
|
return {
|
|
907
|
-
|
|
907
|
+
...H(e, r.event, r),
|
|
908
908
|
delay: i
|
|
909
909
|
};
|
|
910
910
|
});
|
|
911
911
|
}
|
|
912
|
-
function
|
|
913
|
-
const s =
|
|
912
|
+
function H(e, t, n) {
|
|
913
|
+
const s = Ht(n.target), r = n.reenter ?? !1, i = Wn(e, s), o = {
|
|
914
914
|
...n,
|
|
915
915
|
actions: F(n.actions),
|
|
916
916
|
guard: n.guard,
|
|
@@ -926,31 +926,31 @@ function $(e, t, n) {
|
|
|
926
926
|
};
|
|
927
927
|
return o;
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function Xn(e) {
|
|
930
930
|
const t = /* @__PURE__ */ new Map();
|
|
931
931
|
if (e.config.on)
|
|
932
932
|
for (const n of Object.keys(e.config.on)) {
|
|
933
|
-
if (n ===
|
|
933
|
+
if (n === Ut)
|
|
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, W(s).map((r) => H(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, W(e.config.onDone).map((s) => H(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, W(n.onDone).map((r) => H(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, W(n.onError).map((r) => H(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, W(n.onSnapshot).map((r) => H(e, s, r)));
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
956
|
for (const n of e.after) {
|
|
@@ -959,7 +959,7 @@ function Yn(e) {
|
|
|
959
959
|
}
|
|
960
960
|
return t;
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function Qn(e, t) {
|
|
963
963
|
const n = typeof t == "string" ? e.states[t] : t ? e.states[t.target] : void 0;
|
|
964
964
|
if (!n && t)
|
|
965
965
|
throw new Error(`Initial state node "${t}" not found on parent state node #${e.id}`);
|
|
@@ -977,7 +977,7 @@ function Xn(e, t) {
|
|
|
977
977
|
};
|
|
978
978
|
return s;
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function Wn(e, t) {
|
|
981
981
|
if (t !== void 0)
|
|
982
982
|
return t.map((n) => {
|
|
983
983
|
if (typeof n != "string")
|
|
@@ -999,36 +999,36 @@ ${i.message}`);
|
|
|
999
999
|
throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`);
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
const t =
|
|
1002
|
+
function Xt(e) {
|
|
1003
|
+
const t = Ht(e.config.target);
|
|
1004
1004
|
return t ? {
|
|
1005
1005
|
target: t.map((n) => typeof n == "string" ? Te(e.parent, n) : n)
|
|
1006
1006
|
} : e.parent.initial;
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function G(e) {
|
|
1009
1009
|
return e.type === "history";
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1012
|
-
const t =
|
|
1011
|
+
function yt(e) {
|
|
1012
|
+
const t = Qt(e);
|
|
1013
1013
|
for (const n of t)
|
|
1014
|
-
for (const s of
|
|
1014
|
+
for (const s of de(n, e))
|
|
1015
1015
|
t.add(s);
|
|
1016
1016
|
return t;
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function Qt(e) {
|
|
1019
1019
|
const t = /* @__PURE__ */ new Set();
|
|
1020
1020
|
function n(s) {
|
|
1021
1021
|
if (!t.has(s)) {
|
|
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 ee(s))
|
|
1026
1026
|
n(r);
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
1029
|
return n(e), t;
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function te(e, t) {
|
|
1032
1032
|
if (Se(t))
|
|
1033
1033
|
return e.machine.getStateNodeById(t);
|
|
1034
1034
|
if (!e.states)
|
|
@@ -1044,13 +1044,13 @@ function Te(e, t) {
|
|
|
1044
1044
|
return e.machine.getStateNodeById(t);
|
|
1045
1045
|
} catch {
|
|
1046
1046
|
}
|
|
1047
|
-
const n =
|
|
1047
|
+
const n = Xe(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 = te(s, r);
|
|
1054
1054
|
}
|
|
1055
1055
|
return s;
|
|
1056
1056
|
}
|
|
@@ -1061,47 +1061,47 @@ function _e(e, t) {
|
|
|
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) => te(e, r)).filter(Boolean);
|
|
1065
1065
|
return [e.machine.root, e].concat(s, n.reduce((r, i) => {
|
|
1066
|
-
const o =
|
|
1066
|
+
const o = te(e, i);
|
|
1067
1067
|
if (!o)
|
|
1068
1068
|
return r;
|
|
1069
1069
|
const a = _e(o, t[i]);
|
|
1070
1070
|
return r.concat(a);
|
|
1071
1071
|
}, []));
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const i =
|
|
1073
|
+
function Kn(e, t, n, s) {
|
|
1074
|
+
const i = te(e, t).next(n, s);
|
|
1075
1075
|
return !i || !i.length ? e.next(n, s) : i;
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1078
|
-
const r = Object.keys(t), i =
|
|
1077
|
+
function Zn(e, t, n, s) {
|
|
1078
|
+
const r = Object.keys(t), i = te(e, r[0]), o = tt(i, t[r[0]], n, s);
|
|
1079
1079
|
return !o || !o.length ? e.next(n, s) : o;
|
|
1080
1080
|
}
|
|
1081
|
-
function
|
|
1081
|
+
function es(e, t, n, s) {
|
|
1082
1082
|
const r = [];
|
|
1083
1083
|
for (const i of Object.keys(t)) {
|
|
1084
1084
|
const o = t[i];
|
|
1085
1085
|
if (!o)
|
|
1086
1086
|
continue;
|
|
1087
|
-
const a =
|
|
1087
|
+
const a = te(e, i), c = tt(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
|
|
1093
|
-
return typeof t == "string" ?
|
|
1092
|
+
function tt(e, t, n, s) {
|
|
1093
|
+
return typeof t == "string" ? Kn(e, t, n, s) : Object.keys(t).length === 1 ? Zn(e, t, n, s) : es(e, t, n, s);
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function ts(e) {
|
|
1096
1096
|
return Object.keys(e.states).map((t) => e.states[t]).filter((t) => t.type === "history");
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1098
|
+
function j(e, t) {
|
|
1099
1099
|
let n = e;
|
|
1100
1100
|
for (; n.parent && n.parent !== t; )
|
|
1101
1101
|
n = n.parent;
|
|
1102
1102
|
return n.parent === t;
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function ns(e, t) {
|
|
1105
1105
|
const n = new Set(e), s = new Set(t);
|
|
1106
1106
|
for (const r of n)
|
|
1107
1107
|
if (s.has(r))
|
|
@@ -1111,14 +1111,14 @@ function ts(e, t) {
|
|
|
1111
1111
|
return !0;
|
|
1112
1112
|
return !1;
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function Wt(e, t, n) {
|
|
1115
1115
|
const s = /* @__PURE__ */ new Set();
|
|
1116
1116
|
for (const r of e) {
|
|
1117
1117
|
let i = !1;
|
|
1118
1118
|
const o = /* @__PURE__ */ new Set();
|
|
1119
1119
|
for (const a of s)
|
|
1120
|
-
if (
|
|
1121
|
-
if (
|
|
1120
|
+
if (ns(Be([r], t, n), Be([a], t, n)))
|
|
1121
|
+
if (j(r.source, a.source))
|
|
1122
1122
|
o.add(a);
|
|
1123
1123
|
else {
|
|
1124
1124
|
i = !0;
|
|
@@ -1132,53 +1132,53 @@ function Xt(e, t, n) {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
return Array.from(s);
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function ss(e) {
|
|
1136
1136
|
const [t, ...n] = e;
|
|
1137
|
-
for (const s of
|
|
1138
|
-
if (n.every((r) =>
|
|
1137
|
+
for (const s of de(t, void 0))
|
|
1138
|
+
if (n.every((r) => j(r, s)))
|
|
1139
1139
|
return s;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function nt(e, t) {
|
|
1142
1142
|
if (!e.target)
|
|
1143
1143
|
return [];
|
|
1144
1144
|
const n = /* @__PURE__ */ new Set();
|
|
1145
1145
|
for (const s of e.target)
|
|
1146
|
-
if (
|
|
1146
|
+
if (G(s))
|
|
1147
1147
|
if (t[s.id])
|
|
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 nt(Xt(s), t))
|
|
1152
1152
|
n.add(r);
|
|
1153
1153
|
else
|
|
1154
1154
|
n.add(s);
|
|
1155
1155
|
return [...n];
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const n =
|
|
1157
|
+
function Kt(e, t) {
|
|
1158
|
+
const n = nt(e, t);
|
|
1159
1159
|
if (!n)
|
|
1160
1160
|
return;
|
|
1161
|
-
if (!e.reenter && n.every((r) => r === e.source ||
|
|
1161
|
+
if (!e.reenter && n.every((r) => r === e.source || j(r, e.source)))
|
|
1162
1162
|
return e.source;
|
|
1163
|
-
const s =
|
|
1163
|
+
const s = ss(n.concat(e.source));
|
|
1164
1164
|
if (s)
|
|
1165
1165
|
return s;
|
|
1166
1166
|
if (!e.reenter)
|
|
1167
1167
|
return e.source.machine.root;
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function Be(e, t, n) {
|
|
1170
1170
|
var r;
|
|
1171
1171
|
const s = /* @__PURE__ */ new Set();
|
|
1172
1172
|
for (const i of e)
|
|
1173
1173
|
if ((r = i.target) != null && r.length) {
|
|
1174
|
-
const o =
|
|
1174
|
+
const o = Kt(i, n);
|
|
1175
1175
|
i.reenter && i.source === o && s.add(o);
|
|
1176
1176
|
for (const a of t)
|
|
1177
|
-
|
|
1177
|
+
j(a, o) && s.add(a);
|
|
1178
1178
|
}
|
|
1179
1179
|
return [...s];
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1181
|
+
function rs(e, t) {
|
|
1182
1182
|
if (e.length !== t.size)
|
|
1183
1183
|
return !1;
|
|
1184
1184
|
for (const n of e)
|
|
@@ -1186,18 +1186,18 @@ function ss(e, t) {
|
|
|
1186
1186
|
return !1;
|
|
1187
1187
|
return !0;
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1189
|
+
function je(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
|
-
const c =
|
|
1194
|
+
const c = Wt(e, o, a);
|
|
1195
1195
|
let u = t;
|
|
1196
|
-
r || ([u, a] =
|
|
1196
|
+
r || ([u, a] = cs(u, s, n, c, o, a, i)), u = ne(u, s, n, c.flatMap((d) => d.actions), i), u = os(u, s, n, c, o, i, a, r);
|
|
1197
1197
|
const h = [...o];
|
|
1198
|
-
u.status === "done" && (u =
|
|
1198
|
+
u.status === "done" && (u = ne(u, s, n, h.sort((d, f) => f.order - d.order).flatMap((d) => d.exit), i));
|
|
1199
1199
|
try {
|
|
1200
|
-
return a === t.historyValue &&
|
|
1200
|
+
return a === t.historyValue && rs(t._nodes, o) ? u : J(u, {
|
|
1201
1201
|
_nodes: h,
|
|
1202
1202
|
historyValue: a
|
|
1203
1203
|
});
|
|
@@ -1205,23 +1205,23 @@ function Be(e, t, n, s, r, i) {
|
|
|
1205
1205
|
throw d;
|
|
1206
1206
|
}
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function is(e, t, n, s, r) {
|
|
1209
1209
|
if (s.output === void 0)
|
|
1210
1210
|
return;
|
|
1211
|
-
const i =
|
|
1211
|
+
const i = Pe(r.id, r.output !== void 0 && r.parent ? Fe(r.output, e.context, t, n.self) : void 0);
|
|
1212
1212
|
return Fe(s.output, e.context, i, n.self);
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1214
|
+
function os(e, t, n, s, r, i, o, a) {
|
|
1215
1215
|
let c = e;
|
|
1216
1216
|
const u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
|
|
1217
|
-
|
|
1217
|
+
as(s, o, h, u), a && h.add(e.machine.root);
|
|
1218
1218
|
const d = /* @__PURE__ */ new Set();
|
|
1219
1219
|
for (const f of [...u].sort((m, y) => m.order - y.order)) {
|
|
1220
1220
|
r.add(f);
|
|
1221
1221
|
const m = [];
|
|
1222
1222
|
m.push(...f.entry);
|
|
1223
1223
|
for (const y of f.invoke)
|
|
1224
|
-
m.push(
|
|
1224
|
+
m.push(Hn(y.src, {
|
|
1225
1225
|
...y,
|
|
1226
1226
|
syncSnapshot: !!y.onSnapshot
|
|
1227
1227
|
}));
|
|
@@ -1229,87 +1229,87 @@ function is(e, t, n, s, r, i, o, a) {
|
|
|
1229
1229
|
const y = f.initial.actions;
|
|
1230
1230
|
m.push(...y);
|
|
1231
1231
|
}
|
|
1232
|
-
if (c =
|
|
1232
|
+
if (c = ne(c, t, n, m, i, f.invoke.map((y) => y.id)), f.type === "final") {
|
|
1233
1233
|
const y = f.parent;
|
|
1234
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(
|
|
1236
|
-
d.add(v), i.push(
|
|
1235
|
+
for ((y == null ? void 0 : y.type) === "compound" && i.push(Pe(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) && et(r, v); )
|
|
1236
|
+
d.add(v), i.push(Pe(v.id)), S = v, v = v.parent;
|
|
1237
1237
|
if (v)
|
|
1238
1238
|
continue;
|
|
1239
|
-
c =
|
|
1239
|
+
c = J(c, {
|
|
1240
1240
|
status: "done",
|
|
1241
|
-
output:
|
|
1241
|
+
output: is(c, t, n, c.machine.root, S)
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
return c;
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function as(e, t, n, s) {
|
|
1248
1248
|
for (const r of e) {
|
|
1249
|
-
const i =
|
|
1249
|
+
const i = Kt(r, t);
|
|
1250
1250
|
for (const a of r.target || [])
|
|
1251
|
-
!
|
|
1251
|
+
!G(a) && // if the target is different than the source then it will *definitely* be entered
|
|
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)), K(a, t, n, s);
|
|
1256
|
+
const o = nt(r, t);
|
|
1257
1257
|
for (const a of o) {
|
|
1258
|
-
const c =
|
|
1259
|
-
(i == null ? void 0 : i.type) === "parallel" && c.push(i),
|
|
1258
|
+
const c = de(a, i);
|
|
1259
|
+
(i == null ? void 0 : i.type) === "parallel" && c.push(i), Zt(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function K(e, t, n, s) {
|
|
1264
1264
|
var r;
|
|
1265
|
-
if (
|
|
1265
|
+
if (G(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), K(o, t, n, s);
|
|
1270
1270
|
for (const o of i)
|
|
1271
1271
|
Ne(o, e.parent, s, t, n);
|
|
1272
1272
|
} else {
|
|
1273
|
-
const i =
|
|
1273
|
+
const i = Xt(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), K(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
|
-
|
|
1281
|
+
G(i) || (s.add(i), n.add(i)), K(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) =>
|
|
1283
|
+
for (const i of ee(e).filter((o) => !G(o)))
|
|
1284
|
+
[...s].some((o) => j(o, i)) || (G(i) || (s.add(i), n.add(i)), K(i, t, n, s));
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function Zt(e, t, n, s, r) {
|
|
1287
1287
|
for (const i of s)
|
|
1288
|
-
if ((!r ||
|
|
1289
|
-
for (const o of
|
|
1290
|
-
[...e].some((a) =>
|
|
1288
|
+
if ((!r || j(i, r)) && e.add(i), i.type === "parallel")
|
|
1289
|
+
for (const o of ee(i).filter((a) => !G(a)))
|
|
1290
|
+
[...e].some((a) => j(a, o)) || (e.add(o), K(o, t, n, e));
|
|
1291
1291
|
}
|
|
1292
1292
|
function Ne(e, t, n, s, r) {
|
|
1293
|
-
|
|
1293
|
+
Zt(n, s, r, de(e, t));
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function cs(e, t, n, s, r, i, o) {
|
|
1296
1296
|
let a = e;
|
|
1297
|
-
const c =
|
|
1297
|
+
const c = Be(s, r, i);
|
|
1298
1298
|
c.sort((h, d) => d.order - h.order);
|
|
1299
1299
|
let u;
|
|
1300
1300
|
for (const h of c)
|
|
1301
|
-
for (const d of
|
|
1301
|
+
for (const d of ts(h)) {
|
|
1302
1302
|
let f;
|
|
1303
|
-
d.history === "deep" ? f = (m) =>
|
|
1303
|
+
d.history === "deep" ? f = (m) => Ze(m) && j(m, h) : f = (m) => m.parent === h, u ?? (u = {
|
|
1304
1304
|
...i
|
|
1305
1305
|
}), u[d.id] = Array.from(r).filter(f);
|
|
1306
1306
|
}
|
|
1307
1307
|
for (const h of c)
|
|
1308
|
-
a =
|
|
1308
|
+
a = ne(a, t, n, [...h.exit, ...h.invoke.map((d) => Gt(d.id))], o), r.delete(h);
|
|
1309
1309
|
return [a, u || i];
|
|
1310
1310
|
}
|
|
1311
|
-
let
|
|
1312
|
-
function
|
|
1311
|
+
let mt = !1;
|
|
1312
|
+
function en(e, t, n, s, r, i) {
|
|
1313
1313
|
const {
|
|
1314
1314
|
machine: o
|
|
1315
1315
|
} = e;
|
|
@@ -1325,9 +1325,9 @@ function Kt(e, t, n, s, r, i) {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
try {
|
|
1328
|
-
|
|
1328
|
+
mt = h, h(d, f);
|
|
1329
1329
|
} finally {
|
|
1330
|
-
|
|
1330
|
+
mt = !1;
|
|
1331
1331
|
}
|
|
1332
1332
|
};
|
|
1333
1333
|
const u = typeof c == "function", h = u ? c : (
|
|
@@ -1348,12 +1348,12 @@ function Kt(e, t, n, s, r, i) {
|
|
|
1348
1348
|
event: t
|
|
1349
1349
|
}) : c.params : void 0;
|
|
1350
1350
|
if (!("resolve" in h)) {
|
|
1351
|
-
n.self._processingStatus ===
|
|
1351
|
+
n.self._processingStatus === C.Running ? m() : n.defer(() => {
|
|
1352
1352
|
m();
|
|
1353
1353
|
});
|
|
1354
1354
|
continue;
|
|
1355
1355
|
}
|
|
1356
|
-
const y = h, [v, S,
|
|
1356
|
+
const y = h, [v, S, x] = y.resolve(
|
|
1357
1357
|
n,
|
|
1358
1358
|
a,
|
|
1359
1359
|
d,
|
|
@@ -1362,12 +1362,12 @@ function Kt(e, t, n, s, r, i) {
|
|
|
1362
1362
|
// this holds all params
|
|
1363
1363
|
r
|
|
1364
1364
|
);
|
|
1365
|
-
a = v, "retryResolve" in y && (i == null || i.push([y, S])), "execute" in y && (n.self._processingStatus ===
|
|
1365
|
+
a = v, "retryResolve" in y && (i == null || i.push([y, S])), "execute" in y && (n.self._processingStatus === C.Running ? y.execute(n, S) : n.defer(y.execute.bind(null, n, S))), x && (a = en(a, t, n, x, r, i));
|
|
1366
1366
|
}
|
|
1367
1367
|
return a;
|
|
1368
1368
|
}
|
|
1369
|
-
function
|
|
1370
|
-
const o = i ? [] : void 0, a =
|
|
1369
|
+
function ne(e, t, n, s, r, i) {
|
|
1370
|
+
const o = i ? [] : void 0, a = en(e, t, n, s, {
|
|
1371
1371
|
internalQueue: r,
|
|
1372
1372
|
deferredActorIds: i
|
|
1373
1373
|
}, o);
|
|
@@ -1387,8 +1387,8 @@ function ke(e, t, n, s = []) {
|
|
|
1387
1387
|
_transitions: d
|
|
1388
1388
|
}), i.push(u);
|
|
1389
1389
|
}
|
|
1390
|
-
if (t.type ===
|
|
1391
|
-
return r =
|
|
1390
|
+
if (t.type === ce)
|
|
1391
|
+
return r = J(gt(r, t, n), {
|
|
1392
1392
|
status: "stopped"
|
|
1393
1393
|
}), o(r, t, []), {
|
|
1394
1394
|
snapshot: r,
|
|
@@ -1396,16 +1396,16 @@ function ke(e, t, n, s = []) {
|
|
|
1396
1396
|
};
|
|
1397
1397
|
let a = t;
|
|
1398
1398
|
if (a.type !== Pt) {
|
|
1399
|
-
const u = a, h =
|
|
1399
|
+
const u = a, h = Ln(u), d = Et(u, r);
|
|
1400
1400
|
if (h && !d.length)
|
|
1401
|
-
return r =
|
|
1401
|
+
return r = J(e, {
|
|
1402
1402
|
status: "error",
|
|
1403
1403
|
error: u.error
|
|
1404
1404
|
}), o(r, u, []), {
|
|
1405
1405
|
snapshot: r,
|
|
1406
1406
|
microstates: i
|
|
1407
1407
|
};
|
|
1408
|
-
r =
|
|
1408
|
+
r = je(
|
|
1409
1409
|
d,
|
|
1410
1410
|
e,
|
|
1411
1411
|
n,
|
|
@@ -1417,56 +1417,56 @@ function ke(e, t, n, s = []) {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
let c = !0;
|
|
1419
1419
|
for (; r.status === "active"; ) {
|
|
1420
|
-
let u = c ?
|
|
1420
|
+
let u = c ? us(r, a) : [];
|
|
1421
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 = Et(a, r);
|
|
1426
1426
|
}
|
|
1427
|
-
r =
|
|
1427
|
+
r = je(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" && gt(r, a, n), {
|
|
1430
1430
|
snapshot: r,
|
|
1431
1431
|
microstates: i
|
|
1432
1432
|
};
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1435
|
-
return
|
|
1434
|
+
function gt(e, t, n) {
|
|
1435
|
+
return ne(e, t, n, Object.values(e.children).map((s) => Gt(s)), []);
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function Et(e, t) {
|
|
1438
1438
|
return t.machine.getTransitionData(t, e);
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1441
|
-
const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(
|
|
1440
|
+
function us(e, t) {
|
|
1441
|
+
const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(Ze);
|
|
1442
1442
|
for (const r of s)
|
|
1443
1443
|
e:
|
|
1444
|
-
for (const i of [r].concat(
|
|
1444
|
+
for (const i of [r].concat(de(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 || Ke(o.guard, e.context, t, e)) {
|
|
1448
1448
|
n.add(o);
|
|
1449
1449
|
break e;
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
|
-
return
|
|
1452
|
+
return Wt(Array.from(n), new Set(e._nodes), e.historyValue);
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1454
|
+
function ds(e, t) {
|
|
1455
1455
|
const n = ve(_e(e, t));
|
|
1456
|
-
return
|
|
1456
|
+
return Yt(e, [...n]);
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function ls(e) {
|
|
1459
1459
|
return !!e && typeof e == "object" && "machine" in e && "value" in e;
|
|
1460
1460
|
}
|
|
1461
|
-
const
|
|
1462
|
-
return
|
|
1463
|
-
}, hs = function(t) {
|
|
1464
|
-
return this.tags.has(t);
|
|
1461
|
+
const hs = function(t) {
|
|
1462
|
+
return jt(t, this.value);
|
|
1465
1463
|
}, fs = function(t) {
|
|
1464
|
+
return this.tags.has(t);
|
|
1465
|
+
}, ps = function(t) {
|
|
1466
1466
|
const n = this.machine.getTransitionData(this, t);
|
|
1467
1467
|
return !!(n != null && n.length) && // Check that at least one transition is not forbidden
|
|
1468
1468
|
n.some((s) => s.target !== void 0 || s.actions.length);
|
|
1469
|
-
},
|
|
1469
|
+
}, ys = function() {
|
|
1470
1470
|
const {
|
|
1471
1471
|
_nodes: t,
|
|
1472
1472
|
tags: n,
|
|
@@ -1482,7 +1482,7 @@ const ls = function(t) {
|
|
|
1482
1482
|
...u,
|
|
1483
1483
|
tags: Array.from(n)
|
|
1484
1484
|
};
|
|
1485
|
-
},
|
|
1485
|
+
}, ms = function() {
|
|
1486
1486
|
return this._nodes.reduce((t, n) => (n.meta !== void 0 && (t[n.id] = n.meta), t), {});
|
|
1487
1487
|
};
|
|
1488
1488
|
function ye(e, t) {
|
|
@@ -1493,24 +1493,24 @@ function ye(e, t) {
|
|
|
1493
1493
|
machine: t,
|
|
1494
1494
|
context: e.context,
|
|
1495
1495
|
_nodes: e._nodes,
|
|
1496
|
-
value:
|
|
1496
|
+
value: Yt(t.root, e._nodes),
|
|
1497
1497
|
tags: new Set(e._nodes.flatMap((n) => n.tags)),
|
|
1498
1498
|
children: e.children,
|
|
1499
1499
|
historyValue: e.historyValue || {},
|
|
1500
|
-
matches:
|
|
1501
|
-
hasTag:
|
|
1502
|
-
can:
|
|
1503
|
-
getMeta:
|
|
1504
|
-
toJSON:
|
|
1500
|
+
matches: hs,
|
|
1501
|
+
hasTag: fs,
|
|
1502
|
+
can: ps,
|
|
1503
|
+
getMeta: ms,
|
|
1504
|
+
toJSON: ys
|
|
1505
1505
|
};
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1507
|
+
function J(e, t = {}) {
|
|
1508
1508
|
return ye({
|
|
1509
1509
|
...e,
|
|
1510
1510
|
...t
|
|
1511
1511
|
}, e.machine);
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function gs(e, t) {
|
|
1514
1514
|
const {
|
|
1515
1515
|
_nodes: n,
|
|
1516
1516
|
tags: s,
|
|
@@ -1535,11 +1535,11 @@ function ms(e, t) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
return {
|
|
1537
1537
|
...f,
|
|
1538
|
-
context:
|
|
1538
|
+
context: tn(o),
|
|
1539
1539
|
children: m
|
|
1540
1540
|
};
|
|
1541
1541
|
}
|
|
1542
|
-
function
|
|
1542
|
+
function tn(e) {
|
|
1543
1543
|
let t;
|
|
1544
1544
|
for (const n in e) {
|
|
1545
1545
|
const s = e[n];
|
|
@@ -1548,11 +1548,11 @@ 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: We,
|
|
1552
1552
|
id: s.id
|
|
1553
1553
|
};
|
|
1554
1554
|
else {
|
|
1555
|
-
const r =
|
|
1555
|
+
const r = tn(s);
|
|
1556
1556
|
r !== s && (t ?? (t = Array.isArray(e) ? e.slice() : {
|
|
1557
1557
|
...e
|
|
1558
1558
|
}), t[n] = r);
|
|
@@ -1560,7 +1560,7 @@ function Zt(e) {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
return t ?? e;
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function Es(e, t, n, s, {
|
|
1564
1564
|
event: r,
|
|
1565
1565
|
id: i,
|
|
1566
1566
|
delay: o
|
|
@@ -1583,7 +1583,7 @@ function gs(e, t, n, s, {
|
|
|
1583
1583
|
delay: h
|
|
1584
1584
|
}];
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1586
|
+
function vs(e, t) {
|
|
1587
1587
|
const {
|
|
1588
1588
|
event: n,
|
|
1589
1589
|
delay: s,
|
|
@@ -1597,13 +1597,13 @@ function Es(e, t) {
|
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1600
|
+
function Ts(e, t) {
|
|
1601
1601
|
function n(s, r) {
|
|
1602
1602
|
}
|
|
1603
|
-
return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve =
|
|
1603
|
+
return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve = Es, n.execute = vs, n;
|
|
1604
1604
|
}
|
|
1605
|
-
const
|
|
1606
|
-
function
|
|
1605
|
+
const vt = /* @__PURE__ */ new WeakMap();
|
|
1606
|
+
function _s(e) {
|
|
1607
1607
|
return {
|
|
1608
1608
|
config: e,
|
|
1609
1609
|
start: (n, s) => {
|
|
@@ -1614,7 +1614,7 @@ function Ts(e) {
|
|
|
1614
1614
|
receivers: void 0,
|
|
1615
1615
|
dispose: void 0
|
|
1616
1616
|
};
|
|
1617
|
-
|
|
1617
|
+
vt.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 = vt.get(r.self);
|
|
1632
|
+
return s.type === ce ? (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 Tt = "xstate.promise.resolve", _t = "xstate.promise.reject", fe = /* @__PURE__ */ new WeakMap();
|
|
1649
|
+
function z(e) {
|
|
1650
1650
|
return {
|
|
1651
1651
|
config: e,
|
|
1652
1652
|
transition: (n, s, r) => {
|
|
@@ -1654,7 +1654,7 @@ function K(e) {
|
|
|
1654
1654
|
if (n.status !== "active")
|
|
1655
1655
|
return n;
|
|
1656
1656
|
switch (s.type) {
|
|
1657
|
-
case
|
|
1657
|
+
case Tt: {
|
|
1658
1658
|
const o = s.data;
|
|
1659
1659
|
return {
|
|
1660
1660
|
...n,
|
|
@@ -1663,14 +1663,14 @@ function K(e) {
|
|
|
1663
1663
|
input: void 0
|
|
1664
1664
|
};
|
|
1665
1665
|
}
|
|
1666
|
-
case
|
|
1666
|
+
case _t:
|
|
1667
1667
|
return {
|
|
1668
1668
|
...n,
|
|
1669
1669
|
status: "error",
|
|
1670
1670
|
error: s.data,
|
|
1671
1671
|
input: void 0
|
|
1672
1672
|
};
|
|
1673
|
-
case
|
|
1673
|
+
case ce:
|
|
1674
1674
|
return (i = fe.get(r.self)) == null || i.abort(), {
|
|
1675
1675
|
...n,
|
|
1676
1676
|
status: "stopped",
|
|
@@ -1694,12 +1694,12 @@ function K(e) {
|
|
|
1694
1694
|
signal: i.signal
|
|
1695
1695
|
})).then((a) => {
|
|
1696
1696
|
s.getSnapshot().status === "active" && (fe.delete(s), r._relay(s, s, {
|
|
1697
|
-
type:
|
|
1697
|
+
type: Tt,
|
|
1698
1698
|
data: a
|
|
1699
1699
|
}));
|
|
1700
1700
|
}, (a) => {
|
|
1701
1701
|
s.getSnapshot().status === "active" && (fe.delete(s), r._relay(s, s, {
|
|
1702
|
-
type:
|
|
1702
|
+
type: _t,
|
|
1703
1703
|
data: a
|
|
1704
1704
|
}));
|
|
1705
1705
|
});
|
|
@@ -1714,7 +1714,7 @@ function K(e) {
|
|
|
1714
1714
|
restoreSnapshot: (n) => n
|
|
1715
1715
|
};
|
|
1716
1716
|
}
|
|
1717
|
-
function
|
|
1717
|
+
function Is(e, {
|
|
1718
1718
|
machine: t,
|
|
1719
1719
|
context: n
|
|
1720
1720
|
}, s, r) {
|
|
@@ -1724,10 +1724,10 @@ function _s(e, {
|
|
|
1724
1724
|
input: u
|
|
1725
1725
|
} = a;
|
|
1726
1726
|
if (typeof o == "string") {
|
|
1727
|
-
const h =
|
|
1727
|
+
const h = Qe(t, o);
|
|
1728
1728
|
if (!h)
|
|
1729
1729
|
throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
|
|
1730
|
-
const d =
|
|
1730
|
+
const d = B(h, {
|
|
1731
1731
|
id: a.id,
|
|
1732
1732
|
parent: e.self,
|
|
1733
1733
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1741,7 +1741,7 @@ function _s(e, {
|
|
|
1741
1741
|
});
|
|
1742
1742
|
return r[d.id] = d, d;
|
|
1743
1743
|
} else
|
|
1744
|
-
return
|
|
1744
|
+
return B(o, {
|
|
1745
1745
|
id: a.id,
|
|
1746
1746
|
parent: e.self,
|
|
1747
1747
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1753,11 +1753,11 @@ function _s(e, {
|
|
|
1753
1753
|
return (o, a) => {
|
|
1754
1754
|
const c = i(o, a);
|
|
1755
1755
|
return r[c.id] = c, e.defer(() => {
|
|
1756
|
-
c._processingStatus !==
|
|
1756
|
+
c._processingStatus !== C.Stopped && c.start();
|
|
1757
1757
|
}), c;
|
|
1758
1758
|
};
|
|
1759
1759
|
}
|
|
1760
|
-
function
|
|
1760
|
+
function Ss(e, t, n, s, {
|
|
1761
1761
|
assignment: r
|
|
1762
1762
|
}) {
|
|
1763
1763
|
if (!t.context)
|
|
@@ -1765,7 +1765,7 @@ function Is(e, t, n, s, {
|
|
|
1765
1765
|
const i = {}, o = {
|
|
1766
1766
|
context: t.context,
|
|
1767
1767
|
event: n.event,
|
|
1768
|
-
spawn:
|
|
1768
|
+
spawn: Is(e, t, n.event, i),
|
|
1769
1769
|
self: e.self,
|
|
1770
1770
|
system: e.system
|
|
1771
1771
|
};
|
|
@@ -1778,7 +1778,7 @@ function Is(e, t, n, s, {
|
|
|
1778
1778
|
a[u] = typeof h == "function" ? h(o, s) : h;
|
|
1779
1779
|
}
|
|
1780
1780
|
const c = Object.assign({}, t.context, a);
|
|
1781
|
-
return [
|
|
1781
|
+
return [J(t, {
|
|
1782
1782
|
context: c,
|
|
1783
1783
|
children: Object.keys(i).length ? {
|
|
1784
1784
|
...t.children,
|
|
@@ -1786,15 +1786,33 @@ function Is(e, t, n, s, {
|
|
|
1786
1786
|
} : t.children
|
|
1787
1787
|
})];
|
|
1788
1788
|
}
|
|
1789
|
-
function
|
|
1789
|
+
function D(e) {
|
|
1790
|
+
function t(n, s) {
|
|
1791
|
+
}
|
|
1792
|
+
return t.type = "xstate.assign", t.assignment = e, t.resolve = Ss, t;
|
|
1793
|
+
}
|
|
1794
|
+
function As(e, t, n, s, {
|
|
1795
|
+
event: r
|
|
1796
|
+
}) {
|
|
1797
|
+
const i = typeof r == "function" ? r(n, s) : r;
|
|
1798
|
+
return [t, {
|
|
1799
|
+
event: i
|
|
1800
|
+
}];
|
|
1801
|
+
}
|
|
1802
|
+
function xs(e, {
|
|
1803
|
+
event: t
|
|
1804
|
+
}) {
|
|
1805
|
+
e.defer(() => e.emit(t));
|
|
1806
|
+
}
|
|
1807
|
+
function Ce(e) {
|
|
1790
1808
|
function t(n, s) {
|
|
1791
1809
|
}
|
|
1792
|
-
return t.type = "xstate.
|
|
1810
|
+
return t.type = "xstate.emit", t.event = e, t.resolve = As, t.execute = xs, t;
|
|
1793
1811
|
}
|
|
1794
|
-
let
|
|
1812
|
+
let It = /* @__PURE__ */ function(e) {
|
|
1795
1813
|
return e.Parent = "#_parent", e.Internal = "#_internal", e;
|
|
1796
1814
|
}({});
|
|
1797
|
-
function
|
|
1815
|
+
function ws(e, t, n, s, {
|
|
1798
1816
|
to: r,
|
|
1799
1817
|
event: i,
|
|
1800
1818
|
id: o,
|
|
@@ -1814,7 +1832,7 @@ function Ss(e, t, n, s, {
|
|
|
1814
1832
|
const f = typeof r == "function" ? r(n, s) : r;
|
|
1815
1833
|
let m;
|
|
1816
1834
|
if (typeof f == "string") {
|
|
1817
|
-
if (f ===
|
|
1835
|
+
if (f === It.Parent ? m = e.self._parent : f === It.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
1836
|
throw new Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`);
|
|
1819
1837
|
} else
|
|
1820
1838
|
m = f || e.self;
|
|
@@ -1825,10 +1843,10 @@ function Ss(e, t, n, s, {
|
|
|
1825
1843
|
delay: d
|
|
1826
1844
|
}];
|
|
1827
1845
|
}
|
|
1828
|
-
function
|
|
1846
|
+
function bs(e, t, n) {
|
|
1829
1847
|
typeof n.to == "string" && (n.to = t.children[n.to]);
|
|
1830
1848
|
}
|
|
1831
|
-
function
|
|
1849
|
+
function Os(e, t) {
|
|
1832
1850
|
e.defer(() => {
|
|
1833
1851
|
const {
|
|
1834
1852
|
to: n,
|
|
@@ -1845,42 +1863,42 @@ function As(e, t) {
|
|
|
1845
1863
|
// at this point, in a deferred task, it should already be mutated by retryResolveSendTo
|
|
1846
1864
|
// if it initially started as a string
|
|
1847
1865
|
n,
|
|
1848
|
-
s.type ===
|
|
1866
|
+
s.type === Nn ? Ft(e.self.id, s.data) : s
|
|
1849
1867
|
);
|
|
1850
1868
|
});
|
|
1851
1869
|
}
|
|
1852
|
-
function
|
|
1870
|
+
function St(e, t, n) {
|
|
1853
1871
|
function s(r, i) {
|
|
1854
1872
|
}
|
|
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 =
|
|
1873
|
+
return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = ws, s.retryResolve = bs, s.execute = Os, s;
|
|
1856
1874
|
}
|
|
1857
|
-
const
|
|
1858
|
-
function
|
|
1859
|
-
let s =
|
|
1875
|
+
const At = /* @__PURE__ */ new WeakMap();
|
|
1876
|
+
function X(e, t, n) {
|
|
1877
|
+
let s = At.get(e);
|
|
1860
1878
|
return s ? t in s || (s[t] = n()) : (s = {
|
|
1861
1879
|
[t]: n()
|
|
1862
|
-
},
|
|
1880
|
+
}, At.set(e, s)), s[t];
|
|
1863
1881
|
}
|
|
1864
|
-
const
|
|
1882
|
+
const Ns = {}, ie = (e) => typeof e == "string" ? {
|
|
1865
1883
|
type: e
|
|
1866
1884
|
} : typeof e == "function" ? "resolve" in e ? {
|
|
1867
1885
|
type: e.type
|
|
1868
1886
|
} : {
|
|
1869
1887
|
type: e.name
|
|
1870
1888
|
} : e;
|
|
1871
|
-
class
|
|
1889
|
+
class st {
|
|
1872
1890
|
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 ?
|
|
1891
|
+
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 ? ht(this.config.states, (s, r) => new st(s, {
|
|
1874
1892
|
_parent: this,
|
|
1875
1893
|
_key: r,
|
|
1876
1894
|
_machine: this.machine
|
|
1877
|
-
})) :
|
|
1895
|
+
})) : Ns, this.type === "compound" && !this.config.initial)
|
|
1878
1896
|
throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
|
|
1879
1897
|
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = F(this.config.entry).slice(), this.exit = F(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = F(t.tags).slice();
|
|
1880
1898
|
}
|
|
1881
1899
|
/** @internal */
|
|
1882
1900
|
_initialize() {
|
|
1883
|
-
this.transitions =
|
|
1901
|
+
this.transitions = Xn(this), this.config.always && (this.always = W(this.config.always).map((t) => H(this, Ut, t))), Object.keys(this.states).forEach((t) => {
|
|
1884
1902
|
this.states[t]._initialize();
|
|
1885
1903
|
});
|
|
1886
1904
|
}
|
|
@@ -1896,25 +1914,25 @@ class nt {
|
|
|
1896
1914
|
initial: this.initial ? {
|
|
1897
1915
|
target: this.initial.target,
|
|
1898
1916
|
source: this,
|
|
1899
|
-
actions: this.initial.actions.map(
|
|
1917
|
+
actions: this.initial.actions.map(ie),
|
|
1900
1918
|
eventType: null,
|
|
1901
1919
|
reenter: !1,
|
|
1902
1920
|
toJSON: () => ({
|
|
1903
1921
|
target: this.initial.target.map((t) => `#${t.id}`),
|
|
1904
1922
|
source: `#${this.id}`,
|
|
1905
|
-
actions: this.initial.actions.map(
|
|
1923
|
+
actions: this.initial.actions.map(ie),
|
|
1906
1924
|
eventType: null
|
|
1907
1925
|
})
|
|
1908
1926
|
} : void 0,
|
|
1909
1927
|
history: this.history,
|
|
1910
|
-
states:
|
|
1928
|
+
states: ht(this.states, (t) => t.definition),
|
|
1911
1929
|
on: this.on,
|
|
1912
1930
|
transitions: [...this.transitions.values()].flat().map((t) => ({
|
|
1913
1931
|
...t,
|
|
1914
|
-
actions: t.actions.map(
|
|
1932
|
+
actions: t.actions.map(ie)
|
|
1915
1933
|
})),
|
|
1916
|
-
entry: this.entry.map(
|
|
1917
|
-
exit: this.exit.map(
|
|
1934
|
+
entry: this.entry.map(ie),
|
|
1935
|
+
exit: this.exit.map(ie),
|
|
1918
1936
|
meta: this.meta,
|
|
1919
1937
|
order: this.order || -1,
|
|
1920
1938
|
output: this.output,
|
|
@@ -1931,11 +1949,11 @@ class nt {
|
|
|
1931
1949
|
* The logic invoked as actors by this state node.
|
|
1932
1950
|
*/
|
|
1933
1951
|
get invoke() {
|
|
1934
|
-
return
|
|
1952
|
+
return X(this, "invoke", () => F(this.config.invoke).map((t, n) => {
|
|
1935
1953
|
const {
|
|
1936
1954
|
src: s,
|
|
1937
1955
|
systemId: r
|
|
1938
|
-
} = t, i = t.id ??
|
|
1956
|
+
} = t, i = t.id ?? pt(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${pt(this.id, n)}`;
|
|
1939
1957
|
return {
|
|
1940
1958
|
...t,
|
|
1941
1959
|
src: o,
|
|
@@ -1961,26 +1979,26 @@ class nt {
|
|
|
1961
1979
|
* The mapping of events to transitions.
|
|
1962
1980
|
*/
|
|
1963
1981
|
get on() {
|
|
1964
|
-
return
|
|
1982
|
+
return X(this, "on", () => [...this.transitions].flatMap(([n, s]) => s.map((r) => [n, r])).reduce((n, [s, r]) => (n[s] = n[s] || [], n[s].push(r), n), {}));
|
|
1965
1983
|
}
|
|
1966
1984
|
get after() {
|
|
1967
|
-
return
|
|
1985
|
+
return X(this, "delayedTransitions", () => Yn(this));
|
|
1968
1986
|
}
|
|
1969
1987
|
get initial() {
|
|
1970
|
-
return
|
|
1988
|
+
return X(this, "initial", () => Qn(this, this.config.initial));
|
|
1971
1989
|
}
|
|
1972
1990
|
/** @internal */
|
|
1973
1991
|
next(t, n) {
|
|
1974
1992
|
const s = n.type, r = [];
|
|
1975
1993
|
let i;
|
|
1976
|
-
const o =
|
|
1994
|
+
const o = X(this, `candidates-${s}`, () => Jn(this, s));
|
|
1977
1995
|
for (const a of o) {
|
|
1978
1996
|
const {
|
|
1979
1997
|
guard: c
|
|
1980
1998
|
} = a, u = t.context;
|
|
1981
1999
|
let h = !1;
|
|
1982
2000
|
try {
|
|
1983
|
-
h = !c ||
|
|
2001
|
+
h = !c || Ke(c, u, n, t);
|
|
1984
2002
|
} catch (d) {
|
|
1985
2003
|
const f = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
|
|
1986
2004
|
throw new Error(`Unable to evaluate guard ${f ? `'${f}' ` : ""}in transition for event '${s}' in state node '${this.id}':
|
|
@@ -1997,7 +2015,7 @@ ${d.message}`);
|
|
|
1997
2015
|
* All the event types accepted by this state node and its descendants.
|
|
1998
2016
|
*/
|
|
1999
2017
|
get events() {
|
|
2000
|
-
return
|
|
2018
|
+
return X(this, "events", () => {
|
|
2001
2019
|
const {
|
|
2002
2020
|
states: t
|
|
2003
2021
|
} = this, n = new Set(this.ownEvents);
|
|
@@ -2021,15 +2039,15 @@ ${d.message}`);
|
|
|
2021
2039
|
return Array.from(t);
|
|
2022
2040
|
}
|
|
2023
2041
|
}
|
|
2024
|
-
const
|
|
2025
|
-
class
|
|
2042
|
+
const ks = "#";
|
|
2043
|
+
class rt {
|
|
2026
2044
|
constructor(t, n) {
|
|
2027
2045
|
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
2046
|
actors: (n == null ? void 0 : n.actors) ?? {},
|
|
2029
2047
|
actions: (n == null ? void 0 : n.actions) ?? {},
|
|
2030
2048
|
delays: (n == null ? void 0 : n.delays) ?? {},
|
|
2031
2049
|
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
|
|
2050
|
+
}, 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 st(t, {
|
|
2033
2051
|
_key: this.id,
|
|
2034
2052
|
_machine: this
|
|
2035
2053
|
}), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
|
|
@@ -2050,7 +2068,7 @@ class st {
|
|
|
2050
2068
|
actors: r,
|
|
2051
2069
|
delays: i
|
|
2052
2070
|
} = this.implementations;
|
|
2053
|
-
return new
|
|
2071
|
+
return new rt(this.config, {
|
|
2054
2072
|
actions: {
|
|
2055
2073
|
...n,
|
|
2056
2074
|
...t.actions
|
|
@@ -2070,12 +2088,12 @@ class st {
|
|
|
2070
2088
|
});
|
|
2071
2089
|
}
|
|
2072
2090
|
resolveState(t) {
|
|
2073
|
-
const n =
|
|
2091
|
+
const n = ds(this.root, t.value), s = ve(_e(this.root, n));
|
|
2074
2092
|
return ye({
|
|
2075
2093
|
_nodes: [...s],
|
|
2076
2094
|
context: t.context || {},
|
|
2077
2095
|
children: {},
|
|
2078
|
-
status:
|
|
2096
|
+
status: et(s, this.root) ? "done" : t.status || "active",
|
|
2079
2097
|
output: t.output,
|
|
2080
2098
|
error: t.error,
|
|
2081
2099
|
historyValue: t.historyValue
|
|
@@ -2102,7 +2120,7 @@ class st {
|
|
|
2102
2120
|
return ke(t, n, s).microstates;
|
|
2103
2121
|
}
|
|
2104
2122
|
getTransitionData(t, n) {
|
|
2105
|
-
return
|
|
2123
|
+
return tt(this.root, t.value, t, n) || [];
|
|
2106
2124
|
}
|
|
2107
2125
|
/**
|
|
2108
2126
|
* The initial state _before_ evaluating any microsteps.
|
|
@@ -2117,7 +2135,7 @@ class st {
|
|
|
2117
2135
|
children: {},
|
|
2118
2136
|
status: "active"
|
|
2119
2137
|
}, this);
|
|
2120
|
-
return typeof r == "function" ?
|
|
2138
|
+
return typeof r == "function" ? ne(i, n, t, [D(({
|
|
2121
2139
|
spawn: a,
|
|
2122
2140
|
event: c,
|
|
2123
2141
|
self: u
|
|
@@ -2131,8 +2149,8 @@ class st {
|
|
|
2131
2149
|
* Returns the initial `State` instance, with reference to `self` as an `ActorRef`.
|
|
2132
2150
|
*/
|
|
2133
2151
|
getInitialSnapshot(t, n) {
|
|
2134
|
-
const s =
|
|
2135
|
-
target: [...
|
|
2152
|
+
const s = Bt(n), r = [], i = this.getPreInitialState(t, s, r), o = je([{
|
|
2153
|
+
target: [...Qt(this.root)],
|
|
2136
2154
|
source: this.root,
|
|
2137
2155
|
reenter: !0,
|
|
2138
2156
|
actions: [],
|
|
@@ -2150,7 +2168,7 @@ class st {
|
|
|
2150
2168
|
});
|
|
2151
2169
|
}
|
|
2152
2170
|
getStateNodeById(t) {
|
|
2153
|
-
const n =
|
|
2171
|
+
const n = Xe(t), s = n.slice(1), r = Se(n[0]) ? n[0].slice(ks.length) : n[0], i = this.idMap.get(r);
|
|
2154
2172
|
if (!i)
|
|
2155
2173
|
throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
|
|
2156
2174
|
return Te(i, s);
|
|
@@ -2162,15 +2180,15 @@ class st {
|
|
|
2162
2180
|
return this.definition;
|
|
2163
2181
|
}
|
|
2164
2182
|
getPersistedSnapshot(t, n) {
|
|
2165
|
-
return
|
|
2183
|
+
return gs(t, n);
|
|
2166
2184
|
}
|
|
2167
2185
|
restoreSnapshot(t, n) {
|
|
2168
2186
|
const s = {}, r = t.children;
|
|
2169
2187
|
Object.keys(r).forEach((c) => {
|
|
2170
|
-
const u = r[c], h = u.snapshot, d = u.src, f = typeof d == "string" ?
|
|
2188
|
+
const u = r[c], h = u.snapshot, d = u.src, f = typeof d == "string" ? Qe(this, d) : d;
|
|
2171
2189
|
if (!f)
|
|
2172
2190
|
return;
|
|
2173
|
-
const m =
|
|
2191
|
+
const m = B(f, {
|
|
2174
2192
|
id: c,
|
|
2175
2193
|
parent: n.self,
|
|
2176
2194
|
syncSnapshot: u.syncSnapshot,
|
|
@@ -2192,7 +2210,7 @@ class st {
|
|
|
2192
2210
|
for (let h in c) {
|
|
2193
2211
|
const d = c[h];
|
|
2194
2212
|
if (d && typeof d == "object") {
|
|
2195
|
-
if ("xstate$$type" in d && d.xstate$$type ===
|
|
2213
|
+
if ("xstate$$type" in d && d.xstate$$type === We) {
|
|
2196
2214
|
c[h] = u[d.id];
|
|
2197
2215
|
continue;
|
|
2198
2216
|
}
|
|
@@ -2204,10 +2222,10 @@ class st {
|
|
|
2204
2222
|
return a(i.context, s), i;
|
|
2205
2223
|
}
|
|
2206
2224
|
}
|
|
2207
|
-
function
|
|
2208
|
-
return new
|
|
2225
|
+
function Cs(e, t) {
|
|
2226
|
+
return new rt(e, t);
|
|
2209
2227
|
}
|
|
2210
|
-
function
|
|
2228
|
+
function Ae({
|
|
2211
2229
|
schemas: e,
|
|
2212
2230
|
actors: t,
|
|
2213
2231
|
actions: n,
|
|
@@ -2215,7 +2233,7 @@ function xe({
|
|
|
2215
2233
|
delays: r
|
|
2216
2234
|
}) {
|
|
2217
2235
|
return {
|
|
2218
|
-
createMachine: (i) =>
|
|
2236
|
+
createMachine: (i) => Cs({
|
|
2219
2237
|
...i,
|
|
2220
2238
|
schemas: e
|
|
2221
2239
|
}, {
|
|
@@ -2226,21 +2244,21 @@ function xe({
|
|
|
2226
2244
|
})
|
|
2227
2245
|
};
|
|
2228
2246
|
}
|
|
2229
|
-
async function
|
|
2247
|
+
async function De(e, t) {
|
|
2230
2248
|
const n = await fetch(e, t);
|
|
2231
2249
|
return n.status === 200 ? n.json() : Promise.resolve({
|
|
2232
2250
|
message: n.statusText,
|
|
2233
2251
|
success: !1
|
|
2234
2252
|
});
|
|
2235
2253
|
}
|
|
2236
|
-
const
|
|
2254
|
+
const xt = Ae({
|
|
2237
2255
|
types: {
|
|
2238
2256
|
context: {},
|
|
2239
2257
|
events: {},
|
|
2240
2258
|
input: {}
|
|
2241
2259
|
},
|
|
2242
2260
|
actions: {
|
|
2243
|
-
setUserContext:
|
|
2261
|
+
setUserContext: D(({ context: e, event: t }) => {
|
|
2244
2262
|
if (!t.type.includes("xstate.done.actor"))
|
|
2245
2263
|
return e;
|
|
2246
2264
|
const n = t;
|
|
@@ -2249,13 +2267,13 @@ const St = xe({
|
|
|
2249
2267
|
ignoreRefreshToken: !1
|
|
2250
2268
|
};
|
|
2251
2269
|
}),
|
|
2252
|
-
unsetUserContext:
|
|
2270
|
+
unsetUserContext: D(() => ({
|
|
2253
2271
|
user: null,
|
|
2254
2272
|
accessToken: "",
|
|
2255
2273
|
refreshToken: "",
|
|
2256
2274
|
ignoreRefreshToken: !1
|
|
2257
2275
|
})),
|
|
2258
|
-
setAccessToken:
|
|
2276
|
+
setAccessToken: D(({ context: e, event: t }) => {
|
|
2259
2277
|
if (!t.type.includes("xstate.done.actor"))
|
|
2260
2278
|
return e;
|
|
2261
2279
|
const n = t;
|
|
@@ -2264,13 +2282,13 @@ const St = xe({
|
|
|
2264
2282
|
ignoreRefreshToken: !1
|
|
2265
2283
|
};
|
|
2266
2284
|
}),
|
|
2267
|
-
unsetRefreshToken:
|
|
2285
|
+
unsetRefreshToken: D(() => ({
|
|
2268
2286
|
refreshToken: ""
|
|
2269
2287
|
})),
|
|
2270
|
-
setIgnoreRefreshToken:
|
|
2288
|
+
setIgnoreRefreshToken: D(() => ({
|
|
2271
2289
|
ignoreRefreshToken: !0
|
|
2272
2290
|
})),
|
|
2273
|
-
addError:
|
|
2291
|
+
addError: D(({ context: e, event: t }) => {
|
|
2274
2292
|
if (!t.type.includes("xstate.error.actor"))
|
|
2275
2293
|
return e;
|
|
2276
2294
|
const n = t;
|
|
@@ -2278,7 +2296,7 @@ const St = xe({
|
|
|
2278
2296
|
errors: [...e.errors, String(n.error).replace("Error: ", "")]
|
|
2279
2297
|
};
|
|
2280
2298
|
}),
|
|
2281
|
-
clearErrors:
|
|
2299
|
+
clearErrors: D(() => ({
|
|
2282
2300
|
errors: []
|
|
2283
2301
|
}))
|
|
2284
2302
|
// onLogin: ({ event, self }) => {
|
|
@@ -2301,13 +2319,13 @@ const St = xe({
|
|
|
2301
2319
|
// },
|
|
2302
2320
|
},
|
|
2303
2321
|
actors: {
|
|
2304
|
-
refreshAccessToken:
|
|
2322
|
+
refreshAccessToken: z(async ({ input: e }) => {
|
|
2305
2323
|
let t;
|
|
2306
2324
|
if (typeof window > "u") {
|
|
2307
2325
|
if (e.context.refreshToken === "")
|
|
2308
2326
|
throw new Error("Unauthorized.");
|
|
2309
2327
|
try {
|
|
2310
|
-
const s = await
|
|
2328
|
+
const s = await De(
|
|
2311
2329
|
e.context.endpoints.ssrRefresh,
|
|
2312
2330
|
{
|
|
2313
2331
|
method: "POST",
|
|
@@ -2331,7 +2349,7 @@ const St = xe({
|
|
|
2331
2349
|
throw console.log(n), new Error("Could not complete refresh request (server)");
|
|
2332
2350
|
}
|
|
2333
2351
|
} else {
|
|
2334
|
-
t = await
|
|
2352
|
+
t = await De(
|
|
2335
2353
|
e.context.endpoints.refresh,
|
|
2336
2354
|
{
|
|
2337
2355
|
method: "POST",
|
|
@@ -2359,9 +2377,9 @@ const St = xe({
|
|
|
2359
2377
|
};
|
|
2360
2378
|
}
|
|
2361
2379
|
}),
|
|
2362
|
-
authenticate:
|
|
2380
|
+
authenticate: z(async ({ input: e }) => {
|
|
2363
2381
|
var s;
|
|
2364
|
-
const n = await
|
|
2382
|
+
const n = await De(
|
|
2365
2383
|
e.context.endpoints.login,
|
|
2366
2384
|
{
|
|
2367
2385
|
method: "POST",
|
|
@@ -2388,7 +2406,7 @@ const St = xe({
|
|
|
2388
2406
|
accessToken: n.accessToken
|
|
2389
2407
|
};
|
|
2390
2408
|
}),
|
|
2391
|
-
unauthenticate:
|
|
2409
|
+
unauthenticate: z(async ({ input: e }) => (await fetch(e.context.endpoints.logout, {
|
|
2392
2410
|
method: "POST",
|
|
2393
2411
|
mode: "cors",
|
|
2394
2412
|
credentials: "include",
|
|
@@ -2530,13 +2548,13 @@ const St = xe({
|
|
|
2530
2548
|
// },
|
|
2531
2549
|
// },
|
|
2532
2550
|
}
|
|
2533
|
-
}),
|
|
2551
|
+
}), nn = Je(
|
|
2534
2552
|
{}
|
|
2535
|
-
),
|
|
2536
|
-
const e =
|
|
2553
|
+
), Xr = () => {
|
|
2554
|
+
const e = Ye(nn), [t, n] = Mt(
|
|
2537
2555
|
typeof window < "u" && e.getSnapshot().value === "loggedIn"
|
|
2538
2556
|
);
|
|
2539
|
-
return
|
|
2557
|
+
return qt(() => {
|
|
2540
2558
|
if (typeof window > "u")
|
|
2541
2559
|
return;
|
|
2542
2560
|
const s = e.subscribe((r) => {
|
|
@@ -2546,19 +2564,19 @@ const St = xe({
|
|
|
2546
2564
|
s.unsubscribe();
|
|
2547
2565
|
};
|
|
2548
2566
|
}, [e]), { authActor: e, isLoggedIn: t };
|
|
2549
|
-
},
|
|
2567
|
+
}, Qr = async (e = "", t = {
|
|
2550
2568
|
inspect: void 0,
|
|
2551
2569
|
endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
|
|
2552
2570
|
}) => typeof window < "u" ? (console.warn(
|
|
2553
2571
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
2554
|
-
),
|
|
2572
|
+
), B(xt, {
|
|
2555
2573
|
inspect: t.inspect,
|
|
2556
2574
|
input: {
|
|
2557
2575
|
initialContext: {
|
|
2558
2576
|
endpoints: t.endpoints
|
|
2559
2577
|
}
|
|
2560
2578
|
}
|
|
2561
|
-
}).start()) :
|
|
2579
|
+
}).start()) : B(xt, {
|
|
2562
2580
|
input: {
|
|
2563
2581
|
initialContext: {
|
|
2564
2582
|
endpoints: t.endpoints,
|
|
@@ -2567,13 +2585,13 @@ const St = xe({
|
|
|
2567
2585
|
},
|
|
2568
2586
|
inspect: t.inspect
|
|
2569
2587
|
}).start();
|
|
2570
|
-
function
|
|
2571
|
-
return /* @__PURE__ */
|
|
2588
|
+
function Wr({ actor: e, children: t }) {
|
|
2589
|
+
return /* @__PURE__ */ ze(nn.Provider, { value: e, children: t });
|
|
2572
2590
|
}
|
|
2573
|
-
let
|
|
2574
|
-
const
|
|
2591
|
+
let Ds = (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), "");
|
|
2592
|
+
const Rs = Ae({
|
|
2575
2593
|
actors: {
|
|
2576
|
-
tick:
|
|
2594
|
+
tick: _s(
|
|
2577
2595
|
({ sendBack: e, input: t }) => {
|
|
2578
2596
|
const n = setInterval(() => {
|
|
2579
2597
|
e({ type: "TICK" });
|
|
@@ -2638,7 +2656,7 @@ const ks = xe({
|
|
|
2638
2656
|
],
|
|
2639
2657
|
on: {
|
|
2640
2658
|
TICK: {
|
|
2641
|
-
actions:
|
|
2659
|
+
actions: D(({ context: e, event: t }) => t.type !== "TICK" ? e : {
|
|
2642
2660
|
elapsed: e.elapsed + e.interval
|
|
2643
2661
|
})
|
|
2644
2662
|
},
|
|
@@ -2649,9 +2667,9 @@ const ks = xe({
|
|
|
2649
2667
|
type: "final"
|
|
2650
2668
|
}
|
|
2651
2669
|
}
|
|
2652
|
-
}),
|
|
2670
|
+
}), Kr = Ae({
|
|
2653
2671
|
actors: {
|
|
2654
|
-
timer:
|
|
2672
|
+
timer: Rs
|
|
2655
2673
|
},
|
|
2656
2674
|
types: {
|
|
2657
2675
|
context: {},
|
|
@@ -2659,10 +2677,10 @@ const ks = xe({
|
|
|
2659
2677
|
input: {}
|
|
2660
2678
|
},
|
|
2661
2679
|
actions: {
|
|
2662
|
-
addItem:
|
|
2680
|
+
addItem: D(({ context: e, event: t }) => {
|
|
2663
2681
|
if (t.type !== "ADD_ITEM")
|
|
2664
2682
|
return e;
|
|
2665
|
-
const n = `notification-${
|
|
2683
|
+
const n = `notification-${Ds()}`, s = t.duration ?? e.duration, r = _n(t.item, {
|
|
2666
2684
|
duration: s,
|
|
2667
2685
|
id: n,
|
|
2668
2686
|
key: t.item.key ?? n,
|
|
@@ -2677,7 +2695,7 @@ const ks = xe({
|
|
|
2677
2695
|
activeItem: n
|
|
2678
2696
|
};
|
|
2679
2697
|
}),
|
|
2680
|
-
removeItem:
|
|
2698
|
+
removeItem: D(({ context: e, event: t }) => {
|
|
2681
2699
|
if (t.type !== "REMOVE_ITEM" && t.type !== "xstate.done.actor.timer")
|
|
2682
2700
|
return e;
|
|
2683
2701
|
const n = e.items;
|
|
@@ -2741,11 +2759,11 @@ const ks = xe({
|
|
|
2741
2759
|
target: "idle"
|
|
2742
2760
|
},
|
|
2743
2761
|
RESUME_TIMER: {
|
|
2744
|
-
actions:
|
|
2762
|
+
actions: St("timer", { type: "RESUME_TIMER" })
|
|
2745
2763
|
// cond: (context) => context.duration > 0,
|
|
2746
2764
|
},
|
|
2747
2765
|
PAUSE_TIMER: {
|
|
2748
|
-
actions:
|
|
2766
|
+
actions: St("timer", { type: "PAUSE_TIMER" })
|
|
2749
2767
|
// cond: (context) => context.duration > 0,
|
|
2750
2768
|
}
|
|
2751
2769
|
}
|
|
@@ -2779,14 +2797,14 @@ const ks = xe({
|
|
|
2779
2797
|
}
|
|
2780
2798
|
}
|
|
2781
2799
|
}
|
|
2782
|
-
}),
|
|
2783
|
-
function
|
|
2800
|
+
}), sn = Je({}), Zr = () => Ye(sn);
|
|
2801
|
+
function ei({
|
|
2784
2802
|
children: e,
|
|
2785
2803
|
actor: t
|
|
2786
2804
|
}) {
|
|
2787
|
-
return /* @__PURE__ */
|
|
2805
|
+
return /* @__PURE__ */ ze(sn.Provider, { value: t, children: e });
|
|
2788
2806
|
}
|
|
2789
|
-
function
|
|
2807
|
+
function Ms({
|
|
2790
2808
|
context: e,
|
|
2791
2809
|
event: t
|
|
2792
2810
|
}) {
|
|
@@ -2794,10 +2812,50 @@ function Cs({
|
|
|
2794
2812
|
return e;
|
|
2795
2813
|
const n = t;
|
|
2796
2814
|
return n.output.type !== "ADD_ITEMS_SUCCESS" ? e : {
|
|
2797
|
-
quote: { ...e.quote, ...n.output.quote }
|
|
2815
|
+
quote: { ...e.quote, ...n.output.quote },
|
|
2816
|
+
itemsAdded: n.output.itemsAdded
|
|
2817
|
+
};
|
|
2818
|
+
}
|
|
2819
|
+
function qs({
|
|
2820
|
+
event: e
|
|
2821
|
+
}) {
|
|
2822
|
+
if (!e.type.includes("xstate.done.actor"))
|
|
2823
|
+
return { type: "EMIT_ADD_ITEMS", itemsAdded: [] };
|
|
2824
|
+
const t = e;
|
|
2825
|
+
return t.output.type !== "ADD_ITEMS_SUCCESS" ? { type: "EMIT_ADD_ITEMS", itemsAdded: [] } : {
|
|
2826
|
+
type: "EMIT_ADD_ITEMS",
|
|
2827
|
+
itemsAdded: t.output.itemsAdded
|
|
2828
|
+
};
|
|
2829
|
+
}
|
|
2830
|
+
function Ls({
|
|
2831
|
+
event: e
|
|
2832
|
+
}) {
|
|
2833
|
+
if (!e.type.includes("xstate.done.actor"))
|
|
2834
|
+
return { type: "EMIT_REMOVE_ITEMS", itemsRemoved: [] };
|
|
2835
|
+
const t = e;
|
|
2836
|
+
return t.output.type !== "REMOVE_ITEMS_SUCCESS" ? { type: "EMIT_REMOVE_ITEMS", itemsRemoved: [] } : {
|
|
2837
|
+
type: "EMIT_REMOVE_ITEMS",
|
|
2838
|
+
itemsRemoved: t.output.itemsRemoved
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2841
|
+
function Us({
|
|
2842
|
+
event: e
|
|
2843
|
+
}) {
|
|
2844
|
+
if (!e.type.includes("xstate.done.actor"))
|
|
2845
|
+
return {
|
|
2846
|
+
type: "EMIT_UPDATE_ITEMS",
|
|
2847
|
+
itemsUpdated: []
|
|
2848
|
+
};
|
|
2849
|
+
const t = e;
|
|
2850
|
+
return t.output.type !== "UPDATE_ITEMS_SUCCESS" ? {
|
|
2851
|
+
type: "EMIT_UPDATE_ITEMS",
|
|
2852
|
+
itemsUpdated: []
|
|
2853
|
+
} : {
|
|
2854
|
+
type: "EMIT_UPDATE_ITEMS",
|
|
2855
|
+
itemsUpdated: t.output.itemsUpdated
|
|
2798
2856
|
};
|
|
2799
2857
|
}
|
|
2800
|
-
function
|
|
2858
|
+
function Ps({
|
|
2801
2859
|
context: e,
|
|
2802
2860
|
event: t
|
|
2803
2861
|
}) {
|
|
@@ -2805,10 +2863,11 @@ function Ds({
|
|
|
2805
2863
|
return e;
|
|
2806
2864
|
const n = t;
|
|
2807
2865
|
return n.output.type !== "REMOVE_ITEMS_SUCCESS" ? e : {
|
|
2808
|
-
quote: { ...e.quote, ...n.output.quote }
|
|
2866
|
+
quote: { ...e.quote, ...n.output.quote },
|
|
2867
|
+
itemsRemoved: n.output.itemsRemoved
|
|
2809
2868
|
};
|
|
2810
2869
|
}
|
|
2811
|
-
function
|
|
2870
|
+
function Fs({
|
|
2812
2871
|
context: e,
|
|
2813
2872
|
event: t
|
|
2814
2873
|
}) {
|
|
@@ -2819,26 +2878,38 @@ function Rs({
|
|
|
2819
2878
|
quote: { ...e.quote, ...n.output.quote }
|
|
2820
2879
|
};
|
|
2821
2880
|
}
|
|
2822
|
-
|
|
2881
|
+
function Bs({
|
|
2882
|
+
context: e,
|
|
2883
|
+
event: t
|
|
2884
|
+
}) {
|
|
2885
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
2886
|
+
return e;
|
|
2887
|
+
const n = t;
|
|
2888
|
+
return n.output.type !== "UPDATE_ITEMS_SUCCESS" ? e : {
|
|
2889
|
+
quote: { ...e.quote, ...n.output.quote },
|
|
2890
|
+
itemsUpdated: n.output.itemsUpdated
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
const it = JSON, js = (e) => e.toUpperCase(), $s = (e) => {
|
|
2823
2894
|
const t = {};
|
|
2824
2895
|
return e.forEach((n, s) => {
|
|
2825
2896
|
t[s] = n;
|
|
2826
2897
|
}), t;
|
|
2827
|
-
},
|
|
2898
|
+
}, Vs = (e, t, n) => e.document ? e : {
|
|
2828
2899
|
document: e,
|
|
2829
2900
|
variables: t,
|
|
2830
2901
|
requestHeaders: n,
|
|
2831
2902
|
signal: void 0
|
|
2832
|
-
},
|
|
2903
|
+
}, Hs = (e, t, n) => e.query ? e : {
|
|
2833
2904
|
query: e,
|
|
2834
2905
|
variables: t,
|
|
2835
2906
|
requestHeaders: n,
|
|
2836
2907
|
signal: void 0
|
|
2837
|
-
},
|
|
2908
|
+
}, Gs = (e, t) => e.documents ? e : {
|
|
2838
2909
|
documents: e,
|
|
2839
2910
|
requestHeaders: t,
|
|
2840
2911
|
signal: void 0
|
|
2841
|
-
},
|
|
2912
|
+
}, zs = (e, t, ...n) => {
|
|
2842
2913
|
const [s, r] = n;
|
|
2843
2914
|
return e.document ? e : {
|
|
2844
2915
|
url: e,
|
|
@@ -2852,20 +2923,20 @@ function me(e, t) {
|
|
|
2852
2923
|
if (!!!e)
|
|
2853
2924
|
throw new Error(t);
|
|
2854
2925
|
}
|
|
2855
|
-
function
|
|
2926
|
+
function Js(e) {
|
|
2856
2927
|
return typeof e == "object" && e !== null;
|
|
2857
2928
|
}
|
|
2858
|
-
function
|
|
2929
|
+
function Ys(e, t) {
|
|
2859
2930
|
if (!!!e)
|
|
2860
2931
|
throw new Error(
|
|
2861
2932
|
t ?? "Unexpected invariant triggered."
|
|
2862
2933
|
);
|
|
2863
2934
|
}
|
|
2864
|
-
const
|
|
2865
|
-
function
|
|
2935
|
+
const Xs = /\r\n|[\n\r]/g;
|
|
2936
|
+
function $e(e, t) {
|
|
2866
2937
|
let n = 0, s = 1;
|
|
2867
|
-
for (const r of e.body.matchAll(
|
|
2868
|
-
if (typeof r.index == "number" ||
|
|
2938
|
+
for (const r of e.body.matchAll(Xs)) {
|
|
2939
|
+
if (typeof r.index == "number" || Ys(!1), r.index >= t)
|
|
2869
2940
|
break;
|
|
2870
2941
|
n = r.index + r[0].length, s += 1;
|
|
2871
2942
|
}
|
|
@@ -2874,27 +2945,27 @@ function je(e, t) {
|
|
|
2874
2945
|
column: t + 1 - n
|
|
2875
2946
|
};
|
|
2876
2947
|
}
|
|
2877
|
-
function
|
|
2878
|
-
return
|
|
2948
|
+
function Qs(e) {
|
|
2949
|
+
return rn(
|
|
2879
2950
|
e.source,
|
|
2880
|
-
|
|
2951
|
+
$e(e.source, e.start)
|
|
2881
2952
|
);
|
|
2882
2953
|
}
|
|
2883
|
-
function
|
|
2954
|
+
function rn(e, t) {
|
|
2884
2955
|
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}
|
|
2885
2956
|
`, h = s.split(/\r\n|[\n\r]/g), d = h[r];
|
|
2886
2957
|
if (d.length > 120) {
|
|
2887
2958
|
const f = Math.floor(c / 80), m = c % 80, y = [];
|
|
2888
2959
|
for (let v = 0; v < d.length; v += 80)
|
|
2889
2960
|
y.push(d.slice(v, v + 80));
|
|
2890
|
-
return u +
|
|
2961
|
+
return u + wt([
|
|
2891
2962
|
[`${o} |`, y[0]],
|
|
2892
2963
|
...y.slice(1, f + 1).map((v) => ["|", v]),
|
|
2893
2964
|
["|", "^".padStart(m)],
|
|
2894
2965
|
["|", y[f + 1]]
|
|
2895
2966
|
]);
|
|
2896
2967
|
}
|
|
2897
|
-
return u +
|
|
2968
|
+
return u + wt([
|
|
2898
2969
|
// Lines specified like this: ["prefix", "string"],
|
|
2899
2970
|
[`${o - 1} |`, h[r - 1]],
|
|
2900
2971
|
[`${o} |`, d],
|
|
@@ -2902,12 +2973,12 @@ function nn(e, t) {
|
|
|
2902
2973
|
[`${o + 1} |`, h[r + 1]]
|
|
2903
2974
|
]);
|
|
2904
2975
|
}
|
|
2905
|
-
function
|
|
2976
|
+
function wt(e) {
|
|
2906
2977
|
const t = e.filter(([s, r]) => r !== void 0), n = Math.max(...t.map(([s]) => s.length));
|
|
2907
2978
|
return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
|
|
2908
2979
|
`);
|
|
2909
2980
|
}
|
|
2910
|
-
function
|
|
2981
|
+
function Ws(e) {
|
|
2911
2982
|
const t = e[0];
|
|
2912
2983
|
return t == null || "kind" in t || "length" in t ? {
|
|
2913
2984
|
nodes: t,
|
|
@@ -2918,7 +2989,7 @@ function Hs(e) {
|
|
|
2918
2989
|
extensions: e[5]
|
|
2919
2990
|
} : t;
|
|
2920
2991
|
}
|
|
2921
|
-
class
|
|
2992
|
+
class ot extends Error {
|
|
2922
2993
|
/**
|
|
2923
2994
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
2924
2995
|
* which correspond to this error.
|
|
@@ -2959,15 +3030,15 @@ class it extends Error {
|
|
|
2959
3030
|
*/
|
|
2960
3031
|
constructor(t, ...n) {
|
|
2961
3032
|
var s, r, i;
|
|
2962
|
-
const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } =
|
|
2963
|
-
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes =
|
|
3033
|
+
const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = Ws(n);
|
|
3034
|
+
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = bt(
|
|
2964
3035
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
2965
3036
|
);
|
|
2966
|
-
const f =
|
|
3037
|
+
const f = bt(
|
|
2967
3038
|
(s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
|
|
2968
3039
|
);
|
|
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) =>
|
|
2970
|
-
const m =
|
|
3040
|
+
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) => $e(a, y)) : f == null ? void 0 : f.map((y) => $e(y.source, y.start));
|
|
3041
|
+
const m = Js(
|
|
2971
3042
|
h == null ? void 0 : h.extensions
|
|
2972
3043
|
) ? h == null ? void 0 : h.extensions : void 0;
|
|
2973
3044
|
this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
@@ -2994,7 +3065,7 @@ class it extends Error {
|
|
|
2994
3065
|
value: h.stack,
|
|
2995
3066
|
writable: !0,
|
|
2996
3067
|
configurable: !0
|
|
2997
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
3068
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, ot) : Object.defineProperty(this, "stack", {
|
|
2998
3069
|
value: Error().stack,
|
|
2999
3070
|
writable: !0,
|
|
3000
3071
|
configurable: !0
|
|
@@ -3009,12 +3080,12 @@ class it extends Error {
|
|
|
3009
3080
|
for (const n of this.nodes)
|
|
3010
3081
|
n.loc && (t += `
|
|
3011
3082
|
|
|
3012
|
-
` +
|
|
3083
|
+
` + Qs(n.loc));
|
|
3013
3084
|
else if (this.source && this.locations)
|
|
3014
3085
|
for (const n of this.locations)
|
|
3015
3086
|
t += `
|
|
3016
3087
|
|
|
3017
|
-
` +
|
|
3088
|
+
` + rn(this.source, n);
|
|
3018
3089
|
return t;
|
|
3019
3090
|
}
|
|
3020
3091
|
toJSON() {
|
|
@@ -3024,16 +3095,16 @@ class it extends Error {
|
|
|
3024
3095
|
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;
|
|
3025
3096
|
}
|
|
3026
3097
|
}
|
|
3027
|
-
function
|
|
3098
|
+
function bt(e) {
|
|
3028
3099
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
3029
3100
|
}
|
|
3030
3101
|
function b(e, t, n) {
|
|
3031
|
-
return new
|
|
3102
|
+
return new ot(`Syntax Error: ${n}`, {
|
|
3032
3103
|
source: e,
|
|
3033
3104
|
positions: [t]
|
|
3034
3105
|
});
|
|
3035
3106
|
}
|
|
3036
|
-
class
|
|
3107
|
+
class Ks {
|
|
3037
3108
|
/**
|
|
3038
3109
|
* The character offset at which this Node begins.
|
|
3039
3110
|
*/
|
|
@@ -3062,7 +3133,7 @@ class Gs {
|
|
|
3062
3133
|
};
|
|
3063
3134
|
}
|
|
3064
3135
|
}
|
|
3065
|
-
class
|
|
3136
|
+
class on {
|
|
3066
3137
|
/**
|
|
3067
3138
|
* The kind of Token.
|
|
3068
3139
|
*/
|
|
@@ -3104,7 +3175,7 @@ class sn {
|
|
|
3104
3175
|
};
|
|
3105
3176
|
}
|
|
3106
3177
|
}
|
|
3107
|
-
const
|
|
3178
|
+
const an = {
|
|
3108
3179
|
Name: [],
|
|
3109
3180
|
Document: ["definitions"],
|
|
3110
3181
|
OperationDefinition: [
|
|
@@ -3178,45 +3249,45 @@ const rn = {
|
|
|
3178
3249
|
UnionTypeExtension: ["name", "directives", "types"],
|
|
3179
3250
|
EnumTypeExtension: ["name", "directives", "values"],
|
|
3180
3251
|
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
3181
|
-
},
|
|
3182
|
-
function
|
|
3252
|
+
}, Zs = new Set(Object.keys(an));
|
|
3253
|
+
function Ot(e) {
|
|
3183
3254
|
const t = e == null ? void 0 : e.kind;
|
|
3184
|
-
return typeof t == "string" &&
|
|
3255
|
+
return typeof t == "string" && Zs.has(t);
|
|
3185
3256
|
}
|
|
3186
|
-
var
|
|
3257
|
+
var Z;
|
|
3187
3258
|
(function(e) {
|
|
3188
3259
|
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
3189
|
-
})(
|
|
3190
|
-
var
|
|
3260
|
+
})(Z || (Z = {}));
|
|
3261
|
+
var Ve;
|
|
3191
3262
|
(function(e) {
|
|
3192
3263
|
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";
|
|
3193
|
-
})(
|
|
3264
|
+
})(Ve || (Ve = {}));
|
|
3194
3265
|
var T;
|
|
3195
3266
|
(function(e) {
|
|
3196
3267
|
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";
|
|
3197
3268
|
})(T || (T = {}));
|
|
3198
|
-
function
|
|
3269
|
+
function He(e) {
|
|
3199
3270
|
return e === 9 || e === 32;
|
|
3200
3271
|
}
|
|
3201
|
-
function
|
|
3272
|
+
function ue(e) {
|
|
3202
3273
|
return e >= 48 && e <= 57;
|
|
3203
3274
|
}
|
|
3204
|
-
function
|
|
3275
|
+
function cn(e) {
|
|
3205
3276
|
return e >= 97 && e <= 122 || // A-Z
|
|
3206
3277
|
e >= 65 && e <= 90;
|
|
3207
3278
|
}
|
|
3208
|
-
function
|
|
3209
|
-
return
|
|
3279
|
+
function un(e) {
|
|
3280
|
+
return cn(e) || e === 95;
|
|
3210
3281
|
}
|
|
3211
|
-
function
|
|
3212
|
-
return
|
|
3282
|
+
function er(e) {
|
|
3283
|
+
return cn(e) || ue(e) || e === 95;
|
|
3213
3284
|
}
|
|
3214
|
-
function
|
|
3285
|
+
function tr(e) {
|
|
3215
3286
|
var t;
|
|
3216
3287
|
let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
|
|
3217
3288
|
for (let o = 0; o < e.length; ++o) {
|
|
3218
3289
|
var i;
|
|
3219
|
-
const a = e[o], c =
|
|
3290
|
+
const a = e[o], c = nr(a);
|
|
3220
3291
|
c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
|
|
3221
3292
|
}
|
|
3222
3293
|
return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
|
|
@@ -3224,17 +3295,17 @@ function Ys(e) {
|
|
|
3224
3295
|
r + 1
|
|
3225
3296
|
);
|
|
3226
3297
|
}
|
|
3227
|
-
function
|
|
3298
|
+
function nr(e) {
|
|
3228
3299
|
let t = 0;
|
|
3229
|
-
for (; t < e.length &&
|
|
3300
|
+
for (; t < e.length && He(e.charCodeAt(t)); )
|
|
3230
3301
|
++t;
|
|
3231
3302
|
return t;
|
|
3232
3303
|
}
|
|
3233
|
-
function
|
|
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 ||
|
|
3304
|
+
function sr(e, t) {
|
|
3305
|
+
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 || He(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
|
|
3235
3306
|
(!r || e.length > 70 || u || i || o);
|
|
3236
3307
|
let d = "";
|
|
3237
|
-
const f = r &&
|
|
3308
|
+
const f = r && He(e.charCodeAt(0));
|
|
3238
3309
|
return (h && !f || i) && (d += `
|
|
3239
3310
|
`), d += n, (h || u) && (d += `
|
|
3240
3311
|
`), '"""' + d + '"""';
|
|
@@ -3243,7 +3314,7 @@ var p;
|
|
|
3243
3314
|
(function(e) {
|
|
3244
3315
|
e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
|
|
3245
3316
|
})(p || (p = {}));
|
|
3246
|
-
class
|
|
3317
|
+
class rr {
|
|
3247
3318
|
/**
|
|
3248
3319
|
* The previously focused non-ignored token.
|
|
3249
3320
|
*/
|
|
@@ -3257,7 +3328,7 @@ class Ws {
|
|
|
3257
3328
|
* The character offset at which the current line begins.
|
|
3258
3329
|
*/
|
|
3259
3330
|
constructor(t) {
|
|
3260
|
-
const n = new
|
|
3331
|
+
const n = new on(p.SOF, 0, 0, 0, 0);
|
|
3261
3332
|
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
3262
3333
|
}
|
|
3263
3334
|
get [Symbol.toStringTag]() {
|
|
@@ -3280,29 +3351,29 @@ class Ws {
|
|
|
3280
3351
|
if (t.next)
|
|
3281
3352
|
t = t.next;
|
|
3282
3353
|
else {
|
|
3283
|
-
const n =
|
|
3354
|
+
const n = or(this, t.end);
|
|
3284
3355
|
t.next = n, n.prev = t, t = n;
|
|
3285
3356
|
}
|
|
3286
3357
|
while (t.kind === p.COMMENT);
|
|
3287
3358
|
return t;
|
|
3288
3359
|
}
|
|
3289
3360
|
}
|
|
3290
|
-
function
|
|
3361
|
+
function ir(e) {
|
|
3291
3362
|
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;
|
|
3292
3363
|
}
|
|
3293
|
-
function
|
|
3364
|
+
function se(e) {
|
|
3294
3365
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
3295
3366
|
}
|
|
3296
|
-
function
|
|
3297
|
-
return
|
|
3367
|
+
function xe(e, t) {
|
|
3368
|
+
return dn(e.charCodeAt(t)) && ln(e.charCodeAt(t + 1));
|
|
3298
3369
|
}
|
|
3299
|
-
function
|
|
3370
|
+
function dn(e) {
|
|
3300
3371
|
return e >= 55296 && e <= 56319;
|
|
3301
3372
|
}
|
|
3302
|
-
function
|
|
3373
|
+
function ln(e) {
|
|
3303
3374
|
return e >= 56320 && e <= 57343;
|
|
3304
3375
|
}
|
|
3305
|
-
function
|
|
3376
|
+
function Y(e, t) {
|
|
3306
3377
|
const n = e.source.body.codePointAt(t);
|
|
3307
3378
|
if (n === void 0)
|
|
3308
3379
|
return p.EOF;
|
|
@@ -3314,9 +3385,9 @@ function G(e, t) {
|
|
|
3314
3385
|
}
|
|
3315
3386
|
function w(e, t, n, s, r) {
|
|
3316
3387
|
const i = e.line, o = 1 + n - e.lineStart;
|
|
3317
|
-
return new
|
|
3388
|
+
return new on(t, n, s, i, o, r);
|
|
3318
3389
|
}
|
|
3319
|
-
function
|
|
3390
|
+
function or(e, t) {
|
|
3320
3391
|
const n = e.source.body, s = n.length;
|
|
3321
3392
|
let r = t;
|
|
3322
3393
|
for (; r < s; ) {
|
|
@@ -3335,7 +3406,7 @@ function Zs(e, t) {
|
|
|
3335
3406
|
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
|
|
3336
3407
|
continue;
|
|
3337
3408
|
case 35:
|
|
3338
|
-
return
|
|
3409
|
+
return ar(e, r);
|
|
3339
3410
|
case 33:
|
|
3340
3411
|
return w(e, p.BANG, r, r + 1);
|
|
3341
3412
|
case 36:
|
|
@@ -3367,30 +3438,30 @@ function Zs(e, t) {
|
|
|
3367
3438
|
case 125:
|
|
3368
3439
|
return w(e, p.BRACE_R, r, r + 1);
|
|
3369
3440
|
case 34:
|
|
3370
|
-
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ?
|
|
3441
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? fr(e, r) : ur(e, r);
|
|
3371
3442
|
}
|
|
3372
|
-
if (
|
|
3373
|
-
return
|
|
3374
|
-
if (
|
|
3375
|
-
return
|
|
3443
|
+
if (ue(i) || i === 45)
|
|
3444
|
+
return cr(e, r, i);
|
|
3445
|
+
if (un(i))
|
|
3446
|
+
return pr(e, r);
|
|
3376
3447
|
throw b(
|
|
3377
3448
|
e.source,
|
|
3378
3449
|
r,
|
|
3379
|
-
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` :
|
|
3450
|
+
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : se(i) || xe(n, r) ? `Unexpected character: ${Y(e, r)}.` : `Invalid character: ${Y(e, r)}.`
|
|
3380
3451
|
);
|
|
3381
3452
|
}
|
|
3382
3453
|
return w(e, p.EOF, s, s);
|
|
3383
3454
|
}
|
|
3384
|
-
function
|
|
3455
|
+
function ar(e, t) {
|
|
3385
3456
|
const n = e.source.body, s = n.length;
|
|
3386
3457
|
let r = t + 1;
|
|
3387
3458
|
for (; r < s; ) {
|
|
3388
3459
|
const i = n.charCodeAt(r);
|
|
3389
3460
|
if (i === 10 || i === 13)
|
|
3390
3461
|
break;
|
|
3391
|
-
if (
|
|
3462
|
+
if (se(i))
|
|
3392
3463
|
++r;
|
|
3393
|
-
else if (
|
|
3464
|
+
else if (xe(n, r))
|
|
3394
3465
|
r += 2;
|
|
3395
3466
|
else
|
|
3396
3467
|
break;
|
|
@@ -3403,26 +3474,26 @@ function er(e, t) {
|
|
|
3403
3474
|
n.slice(t + 1, r)
|
|
3404
3475
|
);
|
|
3405
3476
|
}
|
|
3406
|
-
function
|
|
3477
|
+
function cr(e, t, n) {
|
|
3407
3478
|
const s = e.source.body;
|
|
3408
3479
|
let r = t, i = n, o = !1;
|
|
3409
3480
|
if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
|
|
3410
|
-
if (i = s.charCodeAt(++r),
|
|
3481
|
+
if (i = s.charCodeAt(++r), ue(i))
|
|
3411
3482
|
throw b(
|
|
3412
3483
|
e.source,
|
|
3413
3484
|
r,
|
|
3414
|
-
`Invalid number, unexpected digit after 0: ${
|
|
3485
|
+
`Invalid number, unexpected digit after 0: ${Y(
|
|
3415
3486
|
e,
|
|
3416
3487
|
r
|
|
3417
3488
|
)}.`
|
|
3418
3489
|
);
|
|
3419
3490
|
} else
|
|
3420
|
-
r =
|
|
3421
|
-
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r =
|
|
3491
|
+
r = Re(e, r, i), i = s.charCodeAt(r);
|
|
3492
|
+
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = Re(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 = Re(e, r, i), i = s.charCodeAt(r)), i === 46 || un(i))
|
|
3422
3493
|
throw b(
|
|
3423
3494
|
e.source,
|
|
3424
3495
|
r,
|
|
3425
|
-
`Invalid number, expected digit but got: ${
|
|
3496
|
+
`Invalid number, expected digit but got: ${Y(
|
|
3426
3497
|
e,
|
|
3427
3498
|
r
|
|
3428
3499
|
)}.`
|
|
@@ -3435,23 +3506,23 @@ function tr(e, t, n) {
|
|
|
3435
3506
|
s.slice(t, r)
|
|
3436
3507
|
);
|
|
3437
3508
|
}
|
|
3438
|
-
function
|
|
3439
|
-
if (!
|
|
3509
|
+
function Re(e, t, n) {
|
|
3510
|
+
if (!ue(n))
|
|
3440
3511
|
throw b(
|
|
3441
3512
|
e.source,
|
|
3442
3513
|
t,
|
|
3443
|
-
`Invalid number, expected digit but got: ${
|
|
3514
|
+
`Invalid number, expected digit but got: ${Y(
|
|
3444
3515
|
e,
|
|
3445
3516
|
t
|
|
3446
3517
|
)}.`
|
|
3447
3518
|
);
|
|
3448
3519
|
const s = e.source.body;
|
|
3449
3520
|
let r = t + 1;
|
|
3450
|
-
for (;
|
|
3521
|
+
for (; ue(s.charCodeAt(r)); )
|
|
3451
3522
|
++r;
|
|
3452
3523
|
return r;
|
|
3453
3524
|
}
|
|
3454
|
-
function
|
|
3525
|
+
function ur(e, t) {
|
|
3455
3526
|
const n = e.source.body, s = n.length;
|
|
3456
3527
|
let r = t + 1, i = r, o = "";
|
|
3457
3528
|
for (; r < s; ) {
|
|
@@ -3460,21 +3531,21 @@ function nr(e, t) {
|
|
|
3460
3531
|
return o += n.slice(i, r), w(e, p.STRING, t, r + 1, o);
|
|
3461
3532
|
if (a === 92) {
|
|
3462
3533
|
o += n.slice(i, r);
|
|
3463
|
-
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ?
|
|
3534
|
+
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? dr(e, r) : lr(e, r) : hr(e, r);
|
|
3464
3535
|
o += c.value, r += c.size, i = r;
|
|
3465
3536
|
continue;
|
|
3466
3537
|
}
|
|
3467
3538
|
if (a === 10 || a === 13)
|
|
3468
3539
|
break;
|
|
3469
|
-
if (
|
|
3540
|
+
if (se(a))
|
|
3470
3541
|
++r;
|
|
3471
|
-
else if (
|
|
3542
|
+
else if (xe(n, r))
|
|
3472
3543
|
r += 2;
|
|
3473
3544
|
else
|
|
3474
3545
|
throw b(
|
|
3475
3546
|
e.source,
|
|
3476
3547
|
r,
|
|
3477
|
-
`Invalid character within String: ${
|
|
3548
|
+
`Invalid character within String: ${Y(
|
|
3478
3549
|
e,
|
|
3479
3550
|
r
|
|
3480
3551
|
)}.`
|
|
@@ -3482,20 +3553,20 @@ function nr(e, t) {
|
|
|
3482
3553
|
}
|
|
3483
3554
|
throw b(e.source, r, "Unterminated string.");
|
|
3484
3555
|
}
|
|
3485
|
-
function
|
|
3556
|
+
function dr(e, t) {
|
|
3486
3557
|
const n = e.source.body;
|
|
3487
3558
|
let s = 0, r = 3;
|
|
3488
3559
|
for (; r < 12; ) {
|
|
3489
3560
|
const i = n.charCodeAt(t + r++);
|
|
3490
3561
|
if (i === 125) {
|
|
3491
|
-
if (r < 5 || !
|
|
3562
|
+
if (r < 5 || !se(s))
|
|
3492
3563
|
break;
|
|
3493
3564
|
return {
|
|
3494
3565
|
value: String.fromCodePoint(s),
|
|
3495
3566
|
size: r
|
|
3496
3567
|
};
|
|
3497
3568
|
}
|
|
3498
|
-
if (s = s << 4 |
|
|
3569
|
+
if (s = s << 4 | oe(i), s < 0)
|
|
3499
3570
|
break;
|
|
3500
3571
|
}
|
|
3501
3572
|
throw b(
|
|
@@ -3507,16 +3578,16 @@ function sr(e, t) {
|
|
|
3507
3578
|
)}".`
|
|
3508
3579
|
);
|
|
3509
3580
|
}
|
|
3510
|
-
function
|
|
3511
|
-
const n = e.source.body, s =
|
|
3512
|
-
if (
|
|
3581
|
+
function lr(e, t) {
|
|
3582
|
+
const n = e.source.body, s = Nt(n, t + 2);
|
|
3583
|
+
if (se(s))
|
|
3513
3584
|
return {
|
|
3514
3585
|
value: String.fromCodePoint(s),
|
|
3515
3586
|
size: 6
|
|
3516
3587
|
};
|
|
3517
|
-
if (
|
|
3518
|
-
const r =
|
|
3519
|
-
if (
|
|
3588
|
+
if (dn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
3589
|
+
const r = Nt(n, t + 8);
|
|
3590
|
+
if (ln(r))
|
|
3520
3591
|
return {
|
|
3521
3592
|
value: String.fromCodePoint(s, r),
|
|
3522
3593
|
size: 12
|
|
@@ -3528,13 +3599,13 @@ function rr(e, t) {
|
|
|
3528
3599
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
3529
3600
|
);
|
|
3530
3601
|
}
|
|
3531
|
-
function
|
|
3532
|
-
return
|
|
3602
|
+
function Nt(e, t) {
|
|
3603
|
+
return oe(e.charCodeAt(t)) << 12 | oe(e.charCodeAt(t + 1)) << 8 | oe(e.charCodeAt(t + 2)) << 4 | oe(e.charCodeAt(t + 3));
|
|
3533
3604
|
}
|
|
3534
|
-
function
|
|
3605
|
+
function oe(e) {
|
|
3535
3606
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
3536
3607
|
}
|
|
3537
|
-
function
|
|
3608
|
+
function hr(e, t) {
|
|
3538
3609
|
const n = e.source.body;
|
|
3539
3610
|
switch (n.charCodeAt(t + 1)) {
|
|
3540
3611
|
case 34:
|
|
@@ -3588,7 +3659,7 @@ function ir(e, t) {
|
|
|
3588
3659
|
)}".`
|
|
3589
3660
|
);
|
|
3590
3661
|
}
|
|
3591
|
-
function
|
|
3662
|
+
function fr(e, t) {
|
|
3592
3663
|
const n = e.source.body, s = n.length;
|
|
3593
3664
|
let r = e.lineStart, i = t + 3, o = i, a = "";
|
|
3594
3665
|
const c = [];
|
|
@@ -3602,7 +3673,7 @@ function or(e, t) {
|
|
|
3602
3673
|
t,
|
|
3603
3674
|
i + 3,
|
|
3604
3675
|
// Return a string of the lines joined with U+000A.
|
|
3605
|
-
|
|
3676
|
+
tr(c).join(`
|
|
3606
3677
|
`)
|
|
3607
3678
|
);
|
|
3608
3679
|
return e.line += c.length - 1, e.lineStart = r, h;
|
|
@@ -3615,15 +3686,15 @@ function or(e, t) {
|
|
|
3615
3686
|
a += n.slice(o, i), c.push(a), u === 13 && n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, a = "", o = i, r = i;
|
|
3616
3687
|
continue;
|
|
3617
3688
|
}
|
|
3618
|
-
if (
|
|
3689
|
+
if (se(u))
|
|
3619
3690
|
++i;
|
|
3620
|
-
else if (
|
|
3691
|
+
else if (xe(n, i))
|
|
3621
3692
|
i += 2;
|
|
3622
3693
|
else
|
|
3623
3694
|
throw b(
|
|
3624
3695
|
e.source,
|
|
3625
3696
|
i,
|
|
3626
|
-
`Invalid character within String: ${
|
|
3697
|
+
`Invalid character within String: ${Y(
|
|
3627
3698
|
e,
|
|
3628
3699
|
i
|
|
3629
3700
|
)}.`
|
|
@@ -3631,12 +3702,12 @@ function or(e, t) {
|
|
|
3631
3702
|
}
|
|
3632
3703
|
throw b(e.source, i, "Unterminated string.");
|
|
3633
3704
|
}
|
|
3634
|
-
function
|
|
3705
|
+
function pr(e, t) {
|
|
3635
3706
|
const n = e.source.body, s = n.length;
|
|
3636
3707
|
let r = t + 1;
|
|
3637
3708
|
for (; r < s; ) {
|
|
3638
3709
|
const i = n.charCodeAt(r);
|
|
3639
|
-
if (
|
|
3710
|
+
if (er(i))
|
|
3640
3711
|
++r;
|
|
3641
3712
|
else
|
|
3642
3713
|
break;
|
|
@@ -3649,8 +3720,8 @@ function ar(e, t) {
|
|
|
3649
3720
|
n.slice(t, r)
|
|
3650
3721
|
);
|
|
3651
3722
|
}
|
|
3652
|
-
const
|
|
3653
|
-
function
|
|
3723
|
+
const yr = 10, hn = 2;
|
|
3724
|
+
function at(e) {
|
|
3654
3725
|
return we(e, []);
|
|
3655
3726
|
}
|
|
3656
3727
|
function we(e, t) {
|
|
@@ -3660,45 +3731,45 @@ function we(e, t) {
|
|
|
3660
3731
|
case "function":
|
|
3661
3732
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
3662
3733
|
case "object":
|
|
3663
|
-
return
|
|
3734
|
+
return mr(e, t);
|
|
3664
3735
|
default:
|
|
3665
3736
|
return String(e);
|
|
3666
3737
|
}
|
|
3667
3738
|
}
|
|
3668
|
-
function
|
|
3739
|
+
function mr(e, t) {
|
|
3669
3740
|
if (e === null)
|
|
3670
3741
|
return "null";
|
|
3671
3742
|
if (t.includes(e))
|
|
3672
3743
|
return "[Circular]";
|
|
3673
3744
|
const n = [...t, e];
|
|
3674
|
-
if (
|
|
3745
|
+
if (gr(e)) {
|
|
3675
3746
|
const s = e.toJSON();
|
|
3676
3747
|
if (s !== e)
|
|
3677
3748
|
return typeof s == "string" ? s : we(s, n);
|
|
3678
3749
|
} else if (Array.isArray(e))
|
|
3679
|
-
return
|
|
3680
|
-
return
|
|
3750
|
+
return vr(e, n);
|
|
3751
|
+
return Er(e, n);
|
|
3681
3752
|
}
|
|
3682
|
-
function
|
|
3753
|
+
function gr(e) {
|
|
3683
3754
|
return typeof e.toJSON == "function";
|
|
3684
3755
|
}
|
|
3685
|
-
function
|
|
3756
|
+
function Er(e, t) {
|
|
3686
3757
|
const n = Object.entries(e);
|
|
3687
|
-
return n.length === 0 ? "{}" : t.length >
|
|
3758
|
+
return n.length === 0 ? "{}" : t.length > hn ? "[" + Tr(e) + "]" : "{ " + n.map(
|
|
3688
3759
|
([r, i]) => r + ": " + we(i, t)
|
|
3689
3760
|
).join(", ") + " }";
|
|
3690
3761
|
}
|
|
3691
|
-
function
|
|
3762
|
+
function vr(e, t) {
|
|
3692
3763
|
if (e.length === 0)
|
|
3693
3764
|
return "[]";
|
|
3694
|
-
if (t.length >
|
|
3765
|
+
if (t.length > hn)
|
|
3695
3766
|
return "[Array]";
|
|
3696
|
-
const n = Math.min(
|
|
3767
|
+
const n = Math.min(yr, e.length), s = e.length - n, r = [];
|
|
3697
3768
|
for (let i = 0; i < n; ++i)
|
|
3698
3769
|
r.push(we(e[i], t));
|
|
3699
3770
|
return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
|
|
3700
3771
|
}
|
|
3701
|
-
function
|
|
3772
|
+
function Tr(e) {
|
|
3702
3773
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
3703
3774
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
3704
3775
|
const n = e.constructor.name;
|
|
@@ -3707,7 +3778,7 @@ function fr(e) {
|
|
|
3707
3778
|
}
|
|
3708
3779
|
return t;
|
|
3709
3780
|
}
|
|
3710
|
-
const
|
|
3781
|
+
const _r = (
|
|
3711
3782
|
/* c8 ignore next 6 */
|
|
3712
3783
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
3713
3784
|
globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function(t, n) {
|
|
@@ -3722,7 +3793,7 @@ const pr = (
|
|
|
3722
3793
|
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (s = t.constructor) === null || s === void 0 ? void 0 : s.name
|
|
3723
3794
|
);
|
|
3724
3795
|
if (r === i) {
|
|
3725
|
-
const o =
|
|
3796
|
+
const o = at(t);
|
|
3726
3797
|
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
3727
3798
|
|
|
3728
3799
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -3740,12 +3811,12 @@ spurious results.`);
|
|
|
3740
3811
|
return !1;
|
|
3741
3812
|
}
|
|
3742
3813
|
);
|
|
3743
|
-
class
|
|
3814
|
+
class fn {
|
|
3744
3815
|
constructor(t, n = "GraphQL request", s = {
|
|
3745
3816
|
line: 1,
|
|
3746
3817
|
column: 1
|
|
3747
3818
|
}) {
|
|
3748
|
-
typeof t == "string" || me(!1, `Body must be a string. Received: ${
|
|
3819
|
+
typeof t == "string" || me(!1, `Body must be a string. Received: ${at(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || me(
|
|
3749
3820
|
!1,
|
|
3750
3821
|
"line in locationOffset is 1-indexed and must be positive."
|
|
3751
3822
|
), this.locationOffset.column > 0 || me(
|
|
@@ -3757,16 +3828,16 @@ class ln {
|
|
|
3757
3828
|
return "Source";
|
|
3758
3829
|
}
|
|
3759
3830
|
}
|
|
3760
|
-
function
|
|
3761
|
-
return
|
|
3831
|
+
function Ir(e) {
|
|
3832
|
+
return _r(e, fn);
|
|
3762
3833
|
}
|
|
3763
|
-
function
|
|
3764
|
-
return new
|
|
3834
|
+
function Sr(e, t) {
|
|
3835
|
+
return new Ar(e, t).parseDocument();
|
|
3765
3836
|
}
|
|
3766
|
-
class
|
|
3837
|
+
class Ar {
|
|
3767
3838
|
constructor(t, n = {}) {
|
|
3768
|
-
const s =
|
|
3769
|
-
this._lexer = new
|
|
3839
|
+
const s = Ir(t) ? t : new fn(t);
|
|
3840
|
+
this._lexer = new rr(s), this._options = n, this._tokenCounter = 0;
|
|
3770
3841
|
}
|
|
3771
3842
|
/**
|
|
3772
3843
|
* Converts a name lex token into a name parse node.
|
|
@@ -3868,7 +3939,7 @@ class gr {
|
|
|
3868
3939
|
if (this.peek(p.BRACE_L))
|
|
3869
3940
|
return this.node(t, {
|
|
3870
3941
|
kind: T.OPERATION_DEFINITION,
|
|
3871
|
-
operation:
|
|
3942
|
+
operation: Z.QUERY,
|
|
3872
3943
|
name: void 0,
|
|
3873
3944
|
variableDefinitions: [],
|
|
3874
3945
|
directives: [],
|
|
@@ -3892,11 +3963,11 @@ class gr {
|
|
|
3892
3963
|
const t = this.expectToken(p.NAME);
|
|
3893
3964
|
switch (t.value) {
|
|
3894
3965
|
case "query":
|
|
3895
|
-
return
|
|
3966
|
+
return Z.QUERY;
|
|
3896
3967
|
case "mutation":
|
|
3897
|
-
return
|
|
3968
|
+
return Z.MUTATION;
|
|
3898
3969
|
case "subscription":
|
|
3899
|
-
return
|
|
3970
|
+
return Z.SUBSCRIPTION;
|
|
3900
3971
|
}
|
|
3901
3972
|
throw this.unexpected(t);
|
|
3902
3973
|
}
|
|
@@ -4722,7 +4793,7 @@ class gr {
|
|
|
4722
4793
|
*/
|
|
4723
4794
|
parseDirectiveLocation() {
|
|
4724
4795
|
const t = this._lexer.token, n = this.parseName();
|
|
4725
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
4796
|
+
if (Object.prototype.hasOwnProperty.call(Ve, n.value))
|
|
4726
4797
|
return n;
|
|
4727
4798
|
throw this.unexpected(t);
|
|
4728
4799
|
}
|
|
@@ -4733,7 +4804,7 @@ class gr {
|
|
|
4733
4804
|
* given parsed object.
|
|
4734
4805
|
*/
|
|
4735
4806
|
node(t, n) {
|
|
4736
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
4807
|
+
return this._options.noLocation !== !0 && (n.loc = new Ks(
|
|
4737
4808
|
t,
|
|
4738
4809
|
this._lexer.lastToken,
|
|
4739
4810
|
this._lexer.source
|
|
@@ -4756,7 +4827,7 @@ class gr {
|
|
|
4756
4827
|
throw b(
|
|
4757
4828
|
this._lexer.source,
|
|
4758
4829
|
n.start,
|
|
4759
|
-
`Expected ${
|
|
4830
|
+
`Expected ${pn(t)}, found ${pe(n)}.`
|
|
4760
4831
|
);
|
|
4761
4832
|
}
|
|
4762
4833
|
/**
|
|
@@ -4866,19 +4937,19 @@ class gr {
|
|
|
4866
4937
|
}
|
|
4867
4938
|
function pe(e) {
|
|
4868
4939
|
const t = e.value;
|
|
4869
|
-
return
|
|
4940
|
+
return pn(e.kind) + (t != null ? ` "${t}"` : "");
|
|
4870
4941
|
}
|
|
4871
|
-
function
|
|
4872
|
-
return
|
|
4942
|
+
function pn(e) {
|
|
4943
|
+
return ir(e) ? `"${e}"` : e;
|
|
4873
4944
|
}
|
|
4874
|
-
function
|
|
4875
|
-
return `"${e.replace(
|
|
4945
|
+
function xr(e) {
|
|
4946
|
+
return `"${e.replace(wr, br)}"`;
|
|
4876
4947
|
}
|
|
4877
|
-
const
|
|
4878
|
-
function
|
|
4879
|
-
return
|
|
4948
|
+
const wr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
4949
|
+
function br(e) {
|
|
4950
|
+
return Or[e.charCodeAt(0)];
|
|
4880
4951
|
}
|
|
4881
|
-
const
|
|
4952
|
+
const Or = [
|
|
4882
4953
|
"\\u0000",
|
|
4883
4954
|
"\\u0001",
|
|
4884
4955
|
"\\u0002",
|
|
@@ -5044,32 +5115,32 @@ const _r = [
|
|
|
5044
5115
|
"\\u009D",
|
|
5045
5116
|
"\\u009E",
|
|
5046
5117
|
"\\u009F"
|
|
5047
|
-
],
|
|
5048
|
-
function
|
|
5118
|
+
], Nr = Object.freeze({});
|
|
5119
|
+
function kr(e, t, n = an) {
|
|
5049
5120
|
const s = /* @__PURE__ */ new Map();
|
|
5050
|
-
for (const
|
|
5051
|
-
s.set(
|
|
5121
|
+
for (const x of Object.values(T))
|
|
5122
|
+
s.set(x, Cr(t, x));
|
|
5052
5123
|
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
|
|
5053
5124
|
const f = [], m = [];
|
|
5054
5125
|
do {
|
|
5055
5126
|
a++;
|
|
5056
|
-
const
|
|
5057
|
-
if (
|
|
5127
|
+
const x = a === o.length, R = x && c.length !== 0;
|
|
5128
|
+
if (x) {
|
|
5058
5129
|
if (h = m.length === 0 ? void 0 : f[f.length - 1], u = d, d = m.pop(), R)
|
|
5059
5130
|
if (i) {
|
|
5060
5131
|
u = u.slice();
|
|
5061
|
-
let
|
|
5062
|
-
for (const [
|
|
5063
|
-
const le =
|
|
5064
|
-
|
|
5132
|
+
let M = 0;
|
|
5133
|
+
for (const [U, $] of c) {
|
|
5134
|
+
const le = U - M;
|
|
5135
|
+
$ === null ? (u.splice(le, 1), M++) : u[le] = $;
|
|
5065
5136
|
}
|
|
5066
5137
|
} else {
|
|
5067
5138
|
u = Object.defineProperties(
|
|
5068
5139
|
{},
|
|
5069
5140
|
Object.getOwnPropertyDescriptors(u)
|
|
5070
5141
|
);
|
|
5071
|
-
for (const [
|
|
5072
|
-
u[
|
|
5142
|
+
for (const [M, U] of c)
|
|
5143
|
+
u[M] = U;
|
|
5073
5144
|
}
|
|
5074
5145
|
a = r.index, o = r.keys, c = r.edits, i = r.inArray, r = r.prev;
|
|
5075
5146
|
} else if (d) {
|
|
@@ -5077,27 +5148,27 @@ function Sr(e, t, n = rn) {
|
|
|
5077
5148
|
continue;
|
|
5078
5149
|
f.push(h);
|
|
5079
5150
|
}
|
|
5080
|
-
let
|
|
5151
|
+
let k;
|
|
5081
5152
|
if (!Array.isArray(u)) {
|
|
5082
5153
|
var y, v;
|
|
5083
|
-
|
|
5084
|
-
const
|
|
5085
|
-
if (
|
|
5154
|
+
Ot(u) || me(!1, `Invalid AST Node: ${at(u)}.`);
|
|
5155
|
+
const M = x ? (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;
|
|
5156
|
+
if (k = M == null ? void 0 : M.call(t, u, h, d, f, m), k === Nr)
|
|
5086
5157
|
break;
|
|
5087
|
-
if (
|
|
5088
|
-
if (!
|
|
5158
|
+
if (k === !1) {
|
|
5159
|
+
if (!x) {
|
|
5089
5160
|
f.pop();
|
|
5090
5161
|
continue;
|
|
5091
5162
|
}
|
|
5092
|
-
} else if (
|
|
5093
|
-
if (
|
|
5094
|
-
u =
|
|
5163
|
+
} else if (k !== void 0 && (c.push([h, k]), !x))
|
|
5164
|
+
if (Ot(k))
|
|
5165
|
+
u = k;
|
|
5095
5166
|
else {
|
|
5096
5167
|
f.pop();
|
|
5097
5168
|
continue;
|
|
5098
5169
|
}
|
|
5099
5170
|
}
|
|
5100
|
-
if (
|
|
5171
|
+
if (k === void 0 && R && c.push([h, u]), x)
|
|
5101
5172
|
f.pop();
|
|
5102
5173
|
else {
|
|
5103
5174
|
var S;
|
|
@@ -5112,7 +5183,7 @@ function Sr(e, t, n = rn) {
|
|
|
5112
5183
|
} while (r !== void 0);
|
|
5113
5184
|
return c.length !== 0 ? c[c.length - 1][1] : e;
|
|
5114
5185
|
}
|
|
5115
|
-
function
|
|
5186
|
+
function Cr(e, t) {
|
|
5116
5187
|
const n = e[t];
|
|
5117
5188
|
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
5118
5189
|
enter: n,
|
|
@@ -5122,10 +5193,10 @@ function xr(e, t) {
|
|
|
5122
5193
|
leave: e.leave
|
|
5123
5194
|
};
|
|
5124
5195
|
}
|
|
5125
|
-
function
|
|
5126
|
-
return
|
|
5196
|
+
function yn(e) {
|
|
5197
|
+
return kr(e, Rr);
|
|
5127
5198
|
}
|
|
5128
|
-
const
|
|
5199
|
+
const Dr = 80, Rr = {
|
|
5129
5200
|
Name: {
|
|
5130
5201
|
leave: (e) => e.value
|
|
5131
5202
|
},
|
|
@@ -5155,13 +5226,13 @@ const Ar = 80, wr = {
|
|
|
5155
5226
|
leave: ({ variable: e, type: t, defaultValue: n, directives: s }) => e + ": " + t + I(" = ", n) + I(" ", E(s, " "))
|
|
5156
5227
|
},
|
|
5157
5228
|
SelectionSet: {
|
|
5158
|
-
leave: ({ selections: e }) =>
|
|
5229
|
+
leave: ({ selections: e }) => q(e)
|
|
5159
5230
|
},
|
|
5160
5231
|
Field: {
|
|
5161
5232
|
leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
|
|
5162
5233
|
const i = I("", e, ": ") + t;
|
|
5163
5234
|
let o = i + I("(", E(n, ", "), ")");
|
|
5164
|
-
return o.length >
|
|
5235
|
+
return o.length > Dr && (o = i + I(`(
|
|
5165
5236
|
`, ge(E(n, `
|
|
5166
5237
|
`)), `
|
|
5167
5238
|
)`)), E([o, E(s, " "), r], " ");
|
|
@@ -5199,7 +5270,7 @@ const Ar = 80, wr = {
|
|
|
5199
5270
|
leave: ({ value: e }) => e
|
|
5200
5271
|
},
|
|
5201
5272
|
StringValue: {
|
|
5202
|
-
leave: ({ value: e, block: t }) => t ?
|
|
5273
|
+
leave: ({ value: e, block: t }) => t ? sr(e) : xr(e)
|
|
5203
5274
|
},
|
|
5204
5275
|
BooleanValue: {
|
|
5205
5276
|
leave: ({ value: e }) => e ? "true" : "false"
|
|
@@ -5236,7 +5307,7 @@ const Ar = 80, wr = {
|
|
|
5236
5307
|
// Type System Definitions
|
|
5237
5308
|
SchemaDefinition: {
|
|
5238
5309
|
leave: ({ description: e, directives: t, operationTypes: n }) => I("", e, `
|
|
5239
|
-
`) + E(["schema", E(t, " "),
|
|
5310
|
+
`) + E(["schema", E(t, " "), q(n)], " ")
|
|
5240
5311
|
},
|
|
5241
5312
|
OperationTypeDefinition: {
|
|
5242
5313
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
@@ -5253,14 +5324,14 @@ const Ar = 80, wr = {
|
|
|
5253
5324
|
t,
|
|
5254
5325
|
I("implements ", E(n, " & ")),
|
|
5255
5326
|
E(s, " "),
|
|
5256
|
-
|
|
5327
|
+
q(r)
|
|
5257
5328
|
],
|
|
5258
5329
|
" "
|
|
5259
5330
|
)
|
|
5260
5331
|
},
|
|
5261
5332
|
FieldDefinition: {
|
|
5262
5333
|
leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => I("", e, `
|
|
5263
|
-
`) + t + (
|
|
5334
|
+
`) + t + (kt(n) ? I(`(
|
|
5264
5335
|
`, ge(E(n, `
|
|
5265
5336
|
`)), `
|
|
5266
5337
|
)`) : I("(", E(n, ", "), ")")) + ": " + s + I(" ", E(r, " "))
|
|
@@ -5280,7 +5351,7 @@ const Ar = 80, wr = {
|
|
|
5280
5351
|
t,
|
|
5281
5352
|
I("implements ", E(n, " & ")),
|
|
5282
5353
|
E(s, " "),
|
|
5283
|
-
|
|
5354
|
+
q(r)
|
|
5284
5355
|
],
|
|
5285
5356
|
" "
|
|
5286
5357
|
)
|
|
@@ -5294,7 +5365,7 @@ const Ar = 80, wr = {
|
|
|
5294
5365
|
},
|
|
5295
5366
|
EnumTypeDefinition: {
|
|
5296
5367
|
leave: ({ description: e, name: t, directives: n, values: s }) => I("", e, `
|
|
5297
|
-
`) + E(["enum", t, E(n, " "),
|
|
5368
|
+
`) + E(["enum", t, E(n, " "), q(s)], " ")
|
|
5298
5369
|
},
|
|
5299
5370
|
EnumValueDefinition: {
|
|
5300
5371
|
leave: ({ description: e, name: t, directives: n }) => I("", e, `
|
|
@@ -5302,18 +5373,18 @@ const Ar = 80, wr = {
|
|
|
5302
5373
|
},
|
|
5303
5374
|
InputObjectTypeDefinition: {
|
|
5304
5375
|
leave: ({ description: e, name: t, directives: n, fields: s }) => I("", e, `
|
|
5305
|
-
`) + E(["input", t, E(n, " "),
|
|
5376
|
+
`) + E(["input", t, E(n, " "), q(s)], " ")
|
|
5306
5377
|
},
|
|
5307
5378
|
DirectiveDefinition: {
|
|
5308
5379
|
leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => I("", e, `
|
|
5309
|
-
`) + "directive @" + t + (
|
|
5380
|
+
`) + "directive @" + t + (kt(n) ? I(`(
|
|
5310
5381
|
`, ge(E(n, `
|
|
5311
5382
|
`)), `
|
|
5312
5383
|
)`) : I("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
|
|
5313
5384
|
},
|
|
5314
5385
|
SchemaExtension: {
|
|
5315
5386
|
leave: ({ directives: e, operationTypes: t }) => E(
|
|
5316
|
-
["extend schema", E(e, " "),
|
|
5387
|
+
["extend schema", E(e, " "), q(t)],
|
|
5317
5388
|
" "
|
|
5318
5389
|
)
|
|
5319
5390
|
},
|
|
@@ -5327,7 +5398,7 @@ const Ar = 80, wr = {
|
|
|
5327
5398
|
e,
|
|
5328
5399
|
I("implements ", E(t, " & ")),
|
|
5329
5400
|
E(n, " "),
|
|
5330
|
-
|
|
5401
|
+
q(s)
|
|
5331
5402
|
],
|
|
5332
5403
|
" "
|
|
5333
5404
|
)
|
|
@@ -5339,7 +5410,7 @@ const Ar = 80, wr = {
|
|
|
5339
5410
|
e,
|
|
5340
5411
|
I("implements ", E(t, " & ")),
|
|
5341
5412
|
E(n, " "),
|
|
5342
|
-
|
|
5413
|
+
q(s)
|
|
5343
5414
|
],
|
|
5344
5415
|
" "
|
|
5345
5416
|
)
|
|
@@ -5356,17 +5427,17 @@ const Ar = 80, wr = {
|
|
|
5356
5427
|
)
|
|
5357
5428
|
},
|
|
5358
5429
|
EnumTypeExtension: {
|
|
5359
|
-
leave: ({ name: e, directives: t, values: n }) => E(["extend enum", e, E(t, " "),
|
|
5430
|
+
leave: ({ name: e, directives: t, values: n }) => E(["extend enum", e, E(t, " "), q(n)], " ")
|
|
5360
5431
|
},
|
|
5361
5432
|
InputObjectTypeExtension: {
|
|
5362
|
-
leave: ({ name: e, directives: t, fields: n }) => E(["extend input", e, E(t, " "),
|
|
5433
|
+
leave: ({ name: e, directives: t, fields: n }) => E(["extend input", e, E(t, " "), q(n)], " ")
|
|
5363
5434
|
}
|
|
5364
5435
|
};
|
|
5365
5436
|
function E(e, t = "") {
|
|
5366
5437
|
var n;
|
|
5367
5438
|
return (n = e == null ? void 0 : e.filter((s) => s).join(t)) !== null && n !== void 0 ? n : "";
|
|
5368
5439
|
}
|
|
5369
|
-
function
|
|
5440
|
+
function q(e) {
|
|
5370
5441
|
return I(`{
|
|
5371
5442
|
`, ge(E(e, `
|
|
5372
5443
|
`)), `
|
|
@@ -5379,49 +5450,49 @@ function ge(e) {
|
|
|
5379
5450
|
return I(" ", e.replace(/\n/g, `
|
|
5380
5451
|
`));
|
|
5381
5452
|
}
|
|
5382
|
-
function
|
|
5453
|
+
function kt(e) {
|
|
5383
5454
|
var t;
|
|
5384
5455
|
return (t = e == null ? void 0 : e.some((n) => n.includes(`
|
|
5385
5456
|
`))) !== null && t !== void 0 ? t : !1;
|
|
5386
5457
|
}
|
|
5387
|
-
const
|
|
5458
|
+
const Ct = (e) => {
|
|
5388
5459
|
var s, r;
|
|
5389
5460
|
let t;
|
|
5390
5461
|
const n = e.definitions.filter((i) => i.kind === "OperationDefinition");
|
|
5391
5462
|
return n.length === 1 && (t = (r = (s = n[0]) == null ? void 0 : s.name) == null ? void 0 : r.value), t;
|
|
5392
|
-
},
|
|
5463
|
+
}, Me = (e) => {
|
|
5393
5464
|
if (typeof e == "string") {
|
|
5394
5465
|
let n;
|
|
5395
5466
|
try {
|
|
5396
|
-
const s =
|
|
5397
|
-
n =
|
|
5467
|
+
const s = Sr(e);
|
|
5468
|
+
n = Ct(s);
|
|
5398
5469
|
} catch {
|
|
5399
5470
|
}
|
|
5400
5471
|
return { query: e, operationName: n };
|
|
5401
5472
|
}
|
|
5402
|
-
const t =
|
|
5403
|
-
return { query:
|
|
5473
|
+
const t = Ct(e);
|
|
5474
|
+
return { query: yn(e), operationName: t };
|
|
5404
5475
|
};
|
|
5405
|
-
class
|
|
5476
|
+
class ae extends Error {
|
|
5406
5477
|
constructor(t, n) {
|
|
5407
|
-
const s = `${
|
|
5478
|
+
const s = `${ae.extractMessage(t)}: ${JSON.stringify({
|
|
5408
5479
|
response: t,
|
|
5409
5480
|
request: n
|
|
5410
5481
|
})}`;
|
|
5411
|
-
super(s), Object.setPrototypeOf(this,
|
|
5482
|
+
super(s), Object.setPrototypeOf(this, ae.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, ae);
|
|
5412
5483
|
}
|
|
5413
5484
|
static extractMessage(t) {
|
|
5414
5485
|
var n, s;
|
|
5415
5486
|
return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
|
|
5416
5487
|
}
|
|
5417
5488
|
}
|
|
5418
|
-
var
|
|
5419
|
-
function
|
|
5489
|
+
var Mr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5490
|
+
function qr(e) {
|
|
5420
5491
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
5421
5492
|
}
|
|
5422
|
-
var
|
|
5493
|
+
var Ge = { exports: {} };
|
|
5423
5494
|
(function(e, t) {
|
|
5424
|
-
var n = typeof self < "u" ? self :
|
|
5495
|
+
var n = typeof self < "u" ? self : Mr, s = function() {
|
|
5425
5496
|
function i() {
|
|
5426
5497
|
this.fetch = !1, this.DOMException = n.DOMException;
|
|
5427
5498
|
}
|
|
@@ -5532,7 +5603,7 @@ var He = { exports: {} };
|
|
|
5532
5603
|
};
|
|
5533
5604
|
});
|
|
5534
5605
|
}
|
|
5535
|
-
function
|
|
5606
|
+
function x(l) {
|
|
5536
5607
|
var g = new FileReader(), _ = S(g);
|
|
5537
5608
|
return g.readAsArrayBuffer(l), _;
|
|
5538
5609
|
}
|
|
@@ -5540,20 +5611,20 @@ var He = { exports: {} };
|
|
|
5540
5611
|
var g = new FileReader(), _ = S(g);
|
|
5541
5612
|
return g.readAsText(l), _;
|
|
5542
5613
|
}
|
|
5543
|
-
function
|
|
5614
|
+
function k(l) {
|
|
5544
5615
|
for (var g = new Uint8Array(l), _ = new Array(g.length), N = 0; N < g.length; N++)
|
|
5545
5616
|
_[N] = String.fromCharCode(g[N]);
|
|
5546
5617
|
return _.join("");
|
|
5547
5618
|
}
|
|
5548
|
-
function
|
|
5619
|
+
function M(l) {
|
|
5549
5620
|
if (l.slice)
|
|
5550
5621
|
return l.slice(0);
|
|
5551
5622
|
var g = new Uint8Array(l.byteLength);
|
|
5552
5623
|
return g.set(new Uint8Array(l)), g.buffer;
|
|
5553
5624
|
}
|
|
5554
|
-
function
|
|
5625
|
+
function U() {
|
|
5555
5626
|
return this.bodyUsed = !1, this._initBody = function(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 =
|
|
5627
|
+
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 = M(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = M(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"));
|
|
5557
5628
|
}, a.blob && (this.blob = function() {
|
|
5558
5629
|
var l = v(this);
|
|
5559
5630
|
if (l)
|
|
@@ -5566,7 +5637,7 @@ var He = { exports: {} };
|
|
|
5566
5637
|
throw new Error("could not read FormData body as blob");
|
|
5567
5638
|
return Promise.resolve(new Blob([this._bodyText]));
|
|
5568
5639
|
}, this.arrayBuffer = function() {
|
|
5569
|
-
return this._bodyArrayBuffer ? v(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(
|
|
5640
|
+
return this._bodyArrayBuffer ? v(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(x);
|
|
5570
5641
|
}), this.text = function() {
|
|
5571
5642
|
var l = v(this);
|
|
5572
5643
|
if (l)
|
|
@@ -5574,25 +5645,25 @@ var He = { exports: {} };
|
|
|
5574
5645
|
if (this._bodyBlob)
|
|
5575
5646
|
return R(this._bodyBlob);
|
|
5576
5647
|
if (this._bodyArrayBuffer)
|
|
5577
|
-
return Promise.resolve(
|
|
5648
|
+
return Promise.resolve(k(this._bodyArrayBuffer));
|
|
5578
5649
|
if (this._bodyFormData)
|
|
5579
5650
|
throw new Error("could not read FormData body as text");
|
|
5580
5651
|
return Promise.resolve(this._bodyText);
|
|
5581
5652
|
}, a.formData && (this.formData = function() {
|
|
5582
|
-
return this.text().then(
|
|
5653
|
+
return this.text().then(En);
|
|
5583
5654
|
}), this.json = function() {
|
|
5584
5655
|
return this.text().then(JSON.parse);
|
|
5585
5656
|
}, this;
|
|
5586
5657
|
}
|
|
5587
|
-
var
|
|
5658
|
+
var $ = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
|
5588
5659
|
function le(l) {
|
|
5589
5660
|
var g = l.toUpperCase();
|
|
5590
|
-
return
|
|
5661
|
+
return $.indexOf(g) > -1 ? g : l;
|
|
5591
5662
|
}
|
|
5592
|
-
function
|
|
5663
|
+
function V(l, g) {
|
|
5593
5664
|
g = g || {};
|
|
5594
5665
|
var _ = g.body;
|
|
5595
|
-
if (l instanceof
|
|
5666
|
+
if (l instanceof V) {
|
|
5596
5667
|
if (l.bodyUsed)
|
|
5597
5668
|
throw new TypeError("Already read");
|
|
5598
5669
|
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);
|
|
@@ -5602,48 +5673,48 @@ var He = { exports: {} };
|
|
|
5602
5673
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
5603
5674
|
this._initBody(_);
|
|
5604
5675
|
}
|
|
5605
|
-
|
|
5606
|
-
return new
|
|
5676
|
+
V.prototype.clone = function() {
|
|
5677
|
+
return new V(this, { body: this._bodyInit });
|
|
5607
5678
|
};
|
|
5608
|
-
function
|
|
5679
|
+
function En(l) {
|
|
5609
5680
|
var g = new FormData();
|
|
5610
5681
|
return l.trim().split("&").forEach(function(_) {
|
|
5611
5682
|
if (_) {
|
|
5612
|
-
var N = _.split("="), O = N.shift().replace(/\+/g, " "),
|
|
5613
|
-
g.append(decodeURIComponent(O), decodeURIComponent(
|
|
5683
|
+
var N = _.split("="), O = N.shift().replace(/\+/g, " "), A = N.join("=").replace(/\+/g, " ");
|
|
5684
|
+
g.append(decodeURIComponent(O), decodeURIComponent(A));
|
|
5614
5685
|
}
|
|
5615
5686
|
}), g;
|
|
5616
5687
|
}
|
|
5617
|
-
function
|
|
5688
|
+
function vn(l) {
|
|
5618
5689
|
var g = new y(), _ = l.replace(/\r?\n[\t ]+/g, " ");
|
|
5619
5690
|
return _.split(/\r?\n/).forEach(function(N) {
|
|
5620
|
-
var O = N.split(":"),
|
|
5621
|
-
if (
|
|
5691
|
+
var O = N.split(":"), A = O.shift().trim();
|
|
5692
|
+
if (A) {
|
|
5622
5693
|
var he = O.join(":").trim();
|
|
5623
|
-
g.append(
|
|
5694
|
+
g.append(A, he);
|
|
5624
5695
|
}
|
|
5625
5696
|
}), g;
|
|
5626
5697
|
}
|
|
5627
|
-
|
|
5628
|
-
function
|
|
5698
|
+
U.call(V.prototype);
|
|
5699
|
+
function L(l, g) {
|
|
5629
5700
|
g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new y(g.headers), this.url = g.url || "", this._initBody(l);
|
|
5630
5701
|
}
|
|
5631
|
-
|
|
5632
|
-
return new
|
|
5702
|
+
U.call(L.prototype), L.prototype.clone = function() {
|
|
5703
|
+
return new L(this._bodyInit, {
|
|
5633
5704
|
status: this.status,
|
|
5634
5705
|
statusText: this.statusText,
|
|
5635
5706
|
headers: new y(this.headers),
|
|
5636
5707
|
url: this.url
|
|
5637
5708
|
});
|
|
5638
|
-
},
|
|
5639
|
-
var l = new
|
|
5709
|
+
}, L.error = function() {
|
|
5710
|
+
var l = new L(null, { status: 0, statusText: "" });
|
|
5640
5711
|
return l.type = "error", l;
|
|
5641
5712
|
};
|
|
5642
|
-
var
|
|
5643
|
-
|
|
5644
|
-
if (
|
|
5713
|
+
var Tn = [301, 302, 303, 307, 308];
|
|
5714
|
+
L.redirect = function(l, g) {
|
|
5715
|
+
if (Tn.indexOf(g) === -1)
|
|
5645
5716
|
throw new RangeError("Invalid status code");
|
|
5646
|
-
return new
|
|
5717
|
+
return new L(null, { status: g, headers: { location: l } });
|
|
5647
5718
|
}, o.DOMException = i.DOMException;
|
|
5648
5719
|
try {
|
|
5649
5720
|
new o.DOMException();
|
|
@@ -5656,70 +5727,70 @@ var He = { exports: {} };
|
|
|
5656
5727
|
}
|
|
5657
5728
|
function be(l, g) {
|
|
5658
5729
|
return new Promise(function(_, N) {
|
|
5659
|
-
var O = new
|
|
5730
|
+
var O = new V(l, g);
|
|
5660
5731
|
if (O.signal && O.signal.aborted)
|
|
5661
5732
|
return N(new o.DOMException("Aborted", "AbortError"));
|
|
5662
|
-
var
|
|
5733
|
+
var A = new XMLHttpRequest();
|
|
5663
5734
|
function he() {
|
|
5664
|
-
|
|
5735
|
+
A.abort();
|
|
5665
5736
|
}
|
|
5666
|
-
|
|
5667
|
-
var
|
|
5668
|
-
status:
|
|
5669
|
-
statusText:
|
|
5670
|
-
headers:
|
|
5737
|
+
A.onload = function() {
|
|
5738
|
+
var re = {
|
|
5739
|
+
status: A.status,
|
|
5740
|
+
statusText: A.statusText,
|
|
5741
|
+
headers: vn(A.getAllResponseHeaders() || "")
|
|
5671
5742
|
};
|
|
5672
|
-
|
|
5673
|
-
var Oe = "response" in
|
|
5674
|
-
_(new
|
|
5675
|
-
},
|
|
5743
|
+
re.url = "responseURL" in A ? A.responseURL : re.headers.get("X-Request-URL");
|
|
5744
|
+
var Oe = "response" in A ? A.response : A.responseText;
|
|
5745
|
+
_(new L(Oe, re));
|
|
5746
|
+
}, A.onerror = function() {
|
|
5676
5747
|
N(new TypeError("Network request failed"));
|
|
5677
|
-
},
|
|
5748
|
+
}, A.ontimeout = function() {
|
|
5678
5749
|
N(new TypeError("Network request failed"));
|
|
5679
|
-
},
|
|
5750
|
+
}, A.onabort = function() {
|
|
5680
5751
|
N(new o.DOMException("Aborted", "AbortError"));
|
|
5681
|
-
},
|
|
5682
|
-
|
|
5683
|
-
}), O.signal && (O.signal.addEventListener("abort", he),
|
|
5684
|
-
|
|
5685
|
-
}),
|
|
5752
|
+
}, A.open(O.method, O.url, !0), O.credentials === "include" ? A.withCredentials = !0 : O.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), O.headers.forEach(function(re, Oe) {
|
|
5753
|
+
A.setRequestHeader(Oe, re);
|
|
5754
|
+
}), O.signal && (O.signal.addEventListener("abort", he), A.onreadystatechange = function() {
|
|
5755
|
+
A.readyState === 4 && O.signal.removeEventListener("abort", he);
|
|
5756
|
+
}), A.send(typeof O._bodyInit > "u" ? null : O._bodyInit);
|
|
5686
5757
|
});
|
|
5687
5758
|
}
|
|
5688
|
-
return be.polyfill = !0, i.fetch || (i.fetch = be, i.Headers = y, i.Request =
|
|
5759
|
+
return be.polyfill = !0, i.fetch || (i.fetch = be, i.Headers = y, i.Request = V, i.Response = L), o.Headers = y, o.Request = V, o.Response = L, o.fetch = be, Object.defineProperty(o, "__esModule", { value: !0 }), o;
|
|
5689
5760
|
})({});
|
|
5690
5761
|
})(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
|
|
5691
5762
|
var r = s;
|
|
5692
5763
|
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;
|
|
5693
|
-
})(
|
|
5694
|
-
var Ie =
|
|
5695
|
-
const Ee = /* @__PURE__ */
|
|
5764
|
+
})(Ge, Ge.exports);
|
|
5765
|
+
var Ie = Ge.exports;
|
|
5766
|
+
const Ee = /* @__PURE__ */ qr(Ie), Lr = /* @__PURE__ */ In({
|
|
5696
5767
|
__proto__: null,
|
|
5697
5768
|
default: Ee
|
|
5698
|
-
}, [Ie]),
|
|
5769
|
+
}, [Ie]), Q = (e) => {
|
|
5699
5770
|
let t = {};
|
|
5700
|
-
return e && (typeof Headers < "u" && e instanceof Headers ||
|
|
5771
|
+
return e && (typeof Headers < "u" && e instanceof Headers || Lr && Ie.Headers && e instanceof Ie.Headers ? t = $s(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
|
|
5701
5772
|
n && s !== void 0 && (t[n] = s);
|
|
5702
5773
|
}) : t = e), t;
|
|
5703
|
-
},
|
|
5774
|
+
}, Dt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Ur = (e) => {
|
|
5704
5775
|
if (!Array.isArray(e.query)) {
|
|
5705
|
-
const s = e, r = [`query=${encodeURIComponent(
|
|
5776
|
+
const s = e, r = [`query=${encodeURIComponent(Dt(s.query))}`];
|
|
5706
5777
|
return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
|
|
5707
5778
|
}
|
|
5708
5779
|
if (typeof e.variables < "u" && !Array.isArray(e.variables))
|
|
5709
5780
|
throw new Error("Cannot create query with given variable type, array expected");
|
|
5710
5781
|
const t = e, n = e.query.reduce((s, r, i) => (s.push({
|
|
5711
|
-
query:
|
|
5782
|
+
query: Dt(r),
|
|
5712
5783
|
variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
|
|
5713
5784
|
}), s), []);
|
|
5714
5785
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
5715
|
-
},
|
|
5786
|
+
}, Pr = (e) => async (t) => {
|
|
5716
5787
|
const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
|
|
5717
5788
|
let h = "", d;
|
|
5718
|
-
e === "POST" ? (d =
|
|
5789
|
+
e === "POST" ? (d = Fr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = Ur({
|
|
5719
5790
|
query: s,
|
|
5720
5791
|
variables: r,
|
|
5721
5792
|
operationName: i,
|
|
5722
|
-
jsonSerializer: a.jsonSerializer ??
|
|
5793
|
+
jsonSerializer: a.jsonSerializer ?? it
|
|
5723
5794
|
});
|
|
5724
5795
|
const f = {
|
|
5725
5796
|
method: e,
|
|
@@ -5729,24 +5800,24 @@ const Ee = /* @__PURE__ */ Or(Ie), Nr = /* @__PURE__ */ _n({
|
|
|
5729
5800
|
};
|
|
5730
5801
|
let m = n, y = f;
|
|
5731
5802
|
if (c) {
|
|
5732
|
-
const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: S, ...
|
|
5733
|
-
m = S, y =
|
|
5803
|
+
const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: S, ...x } = v;
|
|
5804
|
+
m = S, y = x;
|
|
5734
5805
|
}
|
|
5735
5806
|
return h && (m = `${m}?${h}`), await o(m, y);
|
|
5736
5807
|
};
|
|
5737
|
-
class
|
|
5808
|
+
class mn {
|
|
5738
5809
|
constructor(t, n = {}) {
|
|
5739
5810
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
|
|
5740
|
-
const [r, i, o] = s, a =
|
|
5811
|
+
const [r, i, o] = s, a = Hs(r, i, o), { headers: c, fetch: u = Ee, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
|
|
5741
5812
|
a.signal !== void 0 && (m.signal = a.signal);
|
|
5742
|
-
const { operationName: v } =
|
|
5743
|
-
return
|
|
5813
|
+
const { operationName: v } = Me(a.query);
|
|
5814
|
+
return qe({
|
|
5744
5815
|
url: y,
|
|
5745
5816
|
query: a.query,
|
|
5746
5817
|
variables: a.variables,
|
|
5747
5818
|
headers: {
|
|
5748
|
-
...
|
|
5749
|
-
...
|
|
5819
|
+
...Q(Le(c)),
|
|
5820
|
+
...Q(a.requestHeaders)
|
|
5750
5821
|
},
|
|
5751
5822
|
operationName: v,
|
|
5752
5823
|
fetch: u,
|
|
@@ -5759,16 +5830,16 @@ class pn {
|
|
|
5759
5830
|
};
|
|
5760
5831
|
}
|
|
5761
5832
|
async request(t, ...n) {
|
|
5762
|
-
const [s, r] = n, i =
|
|
5833
|
+
const [s, r] = n, i = Vs(t, s, r), { headers: o, fetch: a = Ee, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
|
|
5763
5834
|
i.signal !== void 0 && (d.signal = i.signal);
|
|
5764
|
-
const { query: m, operationName: y } =
|
|
5765
|
-
return
|
|
5835
|
+
const { query: m, operationName: y } = Me(i.document);
|
|
5836
|
+
return qe({
|
|
5766
5837
|
url: f,
|
|
5767
5838
|
query: m,
|
|
5768
5839
|
variables: i.variables,
|
|
5769
5840
|
headers: {
|
|
5770
|
-
...
|
|
5771
|
-
...
|
|
5841
|
+
...Q(Le(o)),
|
|
5842
|
+
...Q(i.requestHeaders)
|
|
5772
5843
|
},
|
|
5773
5844
|
operationName: y,
|
|
5774
5845
|
fetch: a,
|
|
@@ -5781,17 +5852,17 @@ class pn {
|
|
|
5781
5852
|
}
|
|
5782
5853
|
// prettier-ignore
|
|
5783
5854
|
batchRequests(t, n) {
|
|
5784
|
-
const s =
|
|
5855
|
+
const s = Gs(t, n), { headers: r, ...i } = this.requestConfig;
|
|
5785
5856
|
s.signal !== void 0 && (i.signal = s.signal);
|
|
5786
|
-
const o = s.documents.map(({ document: c }) =>
|
|
5787
|
-
return
|
|
5857
|
+
const o = s.documents.map(({ document: c }) => Me(c).query), a = s.documents.map(({ variables: c }) => c);
|
|
5858
|
+
return qe({
|
|
5788
5859
|
url: this.url,
|
|
5789
5860
|
query: o,
|
|
5790
5861
|
// @ts-expect-error TODO reconcile batch variables into system.
|
|
5791
5862
|
variables: a,
|
|
5792
5863
|
headers: {
|
|
5793
|
-
...
|
|
5794
|
-
...
|
|
5864
|
+
...Q(Le(r)),
|
|
5865
|
+
...Q(s.requestHeaders)
|
|
5795
5866
|
},
|
|
5796
5867
|
operationName: void 0,
|
|
5797
5868
|
fetch: this.requestConfig.fetch ?? Ee,
|
|
@@ -5819,8 +5890,8 @@ class pn {
|
|
|
5819
5890
|
return this.url = t, this;
|
|
5820
5891
|
}
|
|
5821
5892
|
}
|
|
5822
|
-
const
|
|
5823
|
-
const { query: t, variables: n, fetchOptions: s } = e, r =
|
|
5893
|
+
const qe = async (e) => {
|
|
5894
|
+
const { query: t, variables: n, fetchOptions: s } = e, r = Pr(js(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Br(o, s.jsonSerializer ?? it), 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";
|
|
5824
5895
|
if (o.ok && u && c) {
|
|
5825
5896
|
const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
|
|
5826
5897
|
return {
|
|
@@ -5832,33 +5903,33 @@ const Le = async (e) => {
|
|
|
5832
5903
|
const h = typeof a == "string" ? {
|
|
5833
5904
|
error: a
|
|
5834
5905
|
} : a;
|
|
5835
|
-
throw new
|
|
5906
|
+
throw new ae(
|
|
5836
5907
|
// @ts-expect-error TODO
|
|
5837
5908
|
{ ...h, status: o.status, headers: o.headers },
|
|
5838
5909
|
{ query: t, variables: n }
|
|
5839
5910
|
);
|
|
5840
5911
|
}
|
|
5841
5912
|
};
|
|
5842
|
-
async function
|
|
5843
|
-
const s =
|
|
5844
|
-
return new
|
|
5913
|
+
async function ct(e, t, ...n) {
|
|
5914
|
+
const s = zs(e, t, ...n);
|
|
5915
|
+
return new mn(s.url).request({
|
|
5845
5916
|
...s
|
|
5846
5917
|
});
|
|
5847
5918
|
}
|
|
5848
|
-
const
|
|
5849
|
-
const r = s ??
|
|
5919
|
+
const Fr = (e, t, n, s) => {
|
|
5920
|
+
const r = s ?? it;
|
|
5850
5921
|
if (!Array.isArray(e))
|
|
5851
5922
|
return r.stringify({ query: e, variables: t, operationName: n });
|
|
5852
5923
|
if (typeof t < "u" && !Array.isArray(t))
|
|
5853
5924
|
throw new Error("Cannot create request body with given variable type, array expected");
|
|
5854
5925
|
const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
|
|
5855
5926
|
return r.stringify(i);
|
|
5856
|
-
},
|
|
5927
|
+
}, Br = async (e, t) => {
|
|
5857
5928
|
let n;
|
|
5858
5929
|
return e.headers.forEach((s, r) => {
|
|
5859
5930
|
r.toLowerCase() === "content-type" && (n = s);
|
|
5860
5931
|
}), 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();
|
|
5861
|
-
},
|
|
5932
|
+
}, Le = (e) => typeof e == "function" ? e() : e, jr = z(
|
|
5862
5933
|
async ({ input: e }) => {
|
|
5863
5934
|
var t;
|
|
5864
5935
|
if (!e.endpoint || e.endpoint === "")
|
|
@@ -5870,7 +5941,7 @@ const Dr = (e, t, n, s) => {
|
|
|
5870
5941
|
if (!e.requestHeaders)
|
|
5871
5942
|
throw new Error("No request headers provided.");
|
|
5872
5943
|
try {
|
|
5873
|
-
const n = await
|
|
5944
|
+
const n = await ct(
|
|
5874
5945
|
e.endpoint,
|
|
5875
5946
|
e.document,
|
|
5876
5947
|
{ items: e.items },
|
|
@@ -5878,19 +5949,23 @@ const Dr = (e, t, n, s) => {
|
|
|
5878
5949
|
);
|
|
5879
5950
|
if (!((t = n.quoteAddItem) != null && t.quote))
|
|
5880
5951
|
throw new Error("Could not add items to quote.");
|
|
5881
|
-
return {
|
|
5952
|
+
return {
|
|
5953
|
+
type: "ADD_ITEMS_SUCCESS",
|
|
5954
|
+
quote: n.quoteAddItem.quote,
|
|
5955
|
+
itemsAdded: n.quoteAddItem.itemsAdded
|
|
5956
|
+
};
|
|
5882
5957
|
} catch {
|
|
5883
5958
|
throw new Error("Request to add item(s) failed.");
|
|
5884
5959
|
}
|
|
5885
5960
|
}
|
|
5886
|
-
),
|
|
5961
|
+
), $r = z(async ({ input: e }) => {
|
|
5887
5962
|
var t;
|
|
5888
5963
|
if (!e.endpoint || e.endpoint === "")
|
|
5889
5964
|
throw new Error("No endpoint provided.");
|
|
5890
5965
|
if (e.items.length < 1)
|
|
5891
5966
|
throw new Error("No items provided.");
|
|
5892
5967
|
try {
|
|
5893
|
-
const n = await
|
|
5968
|
+
const n = await ct(
|
|
5894
5969
|
e.endpoint,
|
|
5895
5970
|
""
|
|
5896
5971
|
// input.document,
|
|
@@ -5901,12 +5976,13 @@ const Dr = (e, t, n, s) => {
|
|
|
5901
5976
|
throw new Error("Could not remove items from quote.");
|
|
5902
5977
|
return {
|
|
5903
5978
|
type: "REMOVE_ITEMS_SUCCESS",
|
|
5904
|
-
quote: n.quoteRemoveItem.quote
|
|
5979
|
+
quote: n.quoteRemoveItem.quote,
|
|
5980
|
+
itemsRemoved: n.quoteRemoveItem.itemsRemoved
|
|
5905
5981
|
};
|
|
5906
5982
|
} catch {
|
|
5907
5983
|
throw new Error("Request to remove item(s) failed.");
|
|
5908
5984
|
}
|
|
5909
|
-
}),
|
|
5985
|
+
}), Ue = typeof window > "u", Vr = z(
|
|
5910
5986
|
async ({ input: e }) => {
|
|
5911
5987
|
var n, s, r, i;
|
|
5912
5988
|
if (!e.endpoint)
|
|
@@ -5919,9 +5995,9 @@ const Dr = (e, t, n, s) => {
|
|
|
5919
5995
|
throw console.log("no request document"), new Error("No request document provided.");
|
|
5920
5996
|
if (!e.requestHeaders)
|
|
5921
5997
|
throw console.log("no headers"), new Error("No request headers provided.");
|
|
5922
|
-
const t = new
|
|
5923
|
-
|
|
5924
|
-
|
|
5998
|
+
const t = new mn(
|
|
5999
|
+
Ue ? e.endpointSsr : e.endpoint,
|
|
6000
|
+
Ue ? { fetch, method: "POST" } : {
|
|
5925
6001
|
credentials: "include",
|
|
5926
6002
|
method: "POST",
|
|
5927
6003
|
mode: "cors"
|
|
@@ -5929,9 +6005,9 @@ const Dr = (e, t, n, s) => {
|
|
|
5929
6005
|
);
|
|
5930
6006
|
try {
|
|
5931
6007
|
const { data: o, headers: a, status: c, errors: u, extensions: h } = await t.rawRequest(
|
|
5932
|
-
|
|
6008
|
+
yn(e.document),
|
|
5933
6009
|
{},
|
|
5934
|
-
|
|
6010
|
+
Ue ? {
|
|
5935
6011
|
...e.requestHeaders,
|
|
5936
6012
|
Cookie: `quote_${e.locale}=${e.quoteId ?? ""}`
|
|
5937
6013
|
} : e.requestHeaders
|
|
@@ -5948,32 +6024,65 @@ const Dr = (e, t, n, s) => {
|
|
|
5948
6024
|
throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
|
|
5949
6025
|
}
|
|
5950
6026
|
}
|
|
5951
|
-
),
|
|
6027
|
+
), Hr = z(async ({ input: e }) => {
|
|
6028
|
+
var t;
|
|
6029
|
+
if (!e.endpoint || e.endpoint === "")
|
|
6030
|
+
throw new Error("No endpoint provided.");
|
|
6031
|
+
if (e.items.length < 1)
|
|
6032
|
+
throw new Error("No items provided.");
|
|
6033
|
+
if (!e.document)
|
|
6034
|
+
throw new Error("No request document provided.");
|
|
6035
|
+
if (!e.requestHeaders)
|
|
6036
|
+
throw new Error("No request headers provided.");
|
|
6037
|
+
try {
|
|
6038
|
+
const n = await ct(
|
|
6039
|
+
e.endpoint,
|
|
6040
|
+
e.document,
|
|
6041
|
+
{ items: e.items },
|
|
6042
|
+
e.requestHeaders
|
|
6043
|
+
);
|
|
6044
|
+
if (!((t = n.quoteUpdateItem) != null && t.quote))
|
|
6045
|
+
throw new Error("Could not add items to quote.");
|
|
6046
|
+
return {
|
|
6047
|
+
type: "UPDATE_ITEMS_SUCCESS",
|
|
6048
|
+
quote: n.quoteUpdateItem.quote,
|
|
6049
|
+
itemsUpdated: n.quoteUpdateItem.itemsUpdated
|
|
6050
|
+
};
|
|
6051
|
+
} catch {
|
|
6052
|
+
throw new Error("Request to add item(s) failed.");
|
|
6053
|
+
}
|
|
6054
|
+
}), Gr = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", zr = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Rt = Ae({
|
|
5952
6055
|
types: {
|
|
5953
6056
|
context: {},
|
|
6057
|
+
emitted: {},
|
|
5954
6058
|
events: {},
|
|
5955
6059
|
input: {}
|
|
5956
6060
|
},
|
|
5957
6061
|
actions: {
|
|
5958
|
-
addItems:
|
|
5959
|
-
|
|
5960
|
-
|
|
6062
|
+
addItems: D(Ms),
|
|
6063
|
+
notifyAddItems: Ce(qs),
|
|
6064
|
+
notifyRemoveItems: Ce(Ls),
|
|
6065
|
+
notifyUpdateItems: Ce(Us),
|
|
6066
|
+
removeItems: D(Ps),
|
|
6067
|
+
refresh: D(Fs),
|
|
6068
|
+
updateItems: D(Bs)
|
|
5961
6069
|
},
|
|
5962
6070
|
actors: {
|
|
5963
|
-
addItems:
|
|
5964
|
-
removeItems:
|
|
5965
|
-
refresh:
|
|
6071
|
+
addItems: jr,
|
|
6072
|
+
removeItems: $r,
|
|
6073
|
+
refresh: Vr,
|
|
6074
|
+
updateItems: Hr
|
|
5966
6075
|
},
|
|
5967
6076
|
guards: {
|
|
5968
|
-
canRefresh:
|
|
5969
|
-
hasItems:
|
|
6077
|
+
canRefresh: Gr,
|
|
6078
|
+
hasItems: zr
|
|
5970
6079
|
}
|
|
5971
6080
|
}).createMachine({
|
|
5972
6081
|
/** @todo do we need to add the view to the id? (e.g. quote_en-us) */
|
|
5973
6082
|
id: "quote",
|
|
5974
6083
|
initial: "initializing",
|
|
5975
6084
|
context: ({ input: e }) => {
|
|
5976
|
-
var t, n, s, r, i, o, a, c, u, h, d, f, m, y
|
|
6085
|
+
var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, S, x, R, k, M, U, $;
|
|
5977
6086
|
return {
|
|
5978
6087
|
quote: {
|
|
5979
6088
|
id: "",
|
|
@@ -6007,6 +6116,8 @@ const Dr = (e, t, n, s) => {
|
|
|
6007
6116
|
// settings: [],
|
|
6008
6117
|
...(t = e == null ? void 0 : e.initialContext) == null ? void 0 : t.quote
|
|
6009
6118
|
},
|
|
6119
|
+
// itemsAdded: [],
|
|
6120
|
+
// itemsRemoved: [],
|
|
6010
6121
|
errors: [],
|
|
6011
6122
|
endpoints: {
|
|
6012
6123
|
client: "",
|
|
@@ -6037,13 +6148,15 @@ const Dr = (e, t, n, s) => {
|
|
|
6037
6148
|
addItems: {
|
|
6038
6149
|
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) ?? "",
|
|
6039
6150
|
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
|
|
6151
|
+
},
|
|
6152
|
+
removeItems: {
|
|
6153
|
+
document: ((S = (v = e.initialContext.graphql) == null ? void 0 : v.removeItems) == null ? void 0 : S.document) ?? "",
|
|
6154
|
+
requestHeaders: ((R = (x = e.initialContext.graphql) == null ? void 0 : x.removeItems) == null ? void 0 : R.requestHeaders) ?? void 0
|
|
6155
|
+
},
|
|
6156
|
+
updateItems: {
|
|
6157
|
+
document: ((M = (k = e.initialContext.graphql) == null ? void 0 : k.updateItems) == null ? void 0 : M.document) ?? "",
|
|
6158
|
+
requestHeaders: (($ = (U = e.initialContext.graphql) == null ? void 0 : U.updateItems) == null ? void 0 : $.requestHeaders) ?? void 0
|
|
6040
6159
|
}
|
|
6041
|
-
// removeItems: {
|
|
6042
|
-
// document: input.initialContext.graphql?.removeItems?.document ?? '',
|
|
6043
|
-
// requestHeaders:
|
|
6044
|
-
// input.initialContext.graphql?.removeItems?.requestHeaders ??
|
|
6045
|
-
// undefined,
|
|
6046
|
-
// },
|
|
6047
6160
|
}
|
|
6048
6161
|
};
|
|
6049
6162
|
},
|
|
@@ -6061,7 +6174,8 @@ const Dr = (e, t, n, s) => {
|
|
|
6061
6174
|
*/
|
|
6062
6175
|
empty: {
|
|
6063
6176
|
on: {
|
|
6064
|
-
ADD_ITEMS: "addingItems"
|
|
6177
|
+
ADD_ITEMS: "addingItems",
|
|
6178
|
+
UPDATE_ITEMS: "updatingItems"
|
|
6065
6179
|
}
|
|
6066
6180
|
},
|
|
6067
6181
|
/**
|
|
@@ -6071,7 +6185,8 @@ const Dr = (e, t, n, s) => {
|
|
|
6071
6185
|
on: {
|
|
6072
6186
|
ADD_ITEMS: "addingItems",
|
|
6073
6187
|
REMOVE_ITEMS: "removingItems",
|
|
6074
|
-
REFRESH: "refreshing"
|
|
6188
|
+
REFRESH: "refreshing",
|
|
6189
|
+
UPDATE_ITEMS: "updatingItems"
|
|
6075
6190
|
// CLEAR_ITEMS: 'clearing',
|
|
6076
6191
|
// APPLY_PROMOTION: 'applyingPromotion',
|
|
6077
6192
|
// REMOVE_PROMOTION: 'removingPromotion',
|
|
@@ -6157,7 +6272,7 @@ const Dr = (e, t, n, s) => {
|
|
|
6157
6272
|
src: "addItems",
|
|
6158
6273
|
onDone: [
|
|
6159
6274
|
{
|
|
6160
|
-
actions: ["addItems"],
|
|
6275
|
+
actions: ["addItems", "notifyAddItems"],
|
|
6161
6276
|
target: "active"
|
|
6162
6277
|
}
|
|
6163
6278
|
],
|
|
@@ -6178,36 +6293,108 @@ const Dr = (e, t, n, s) => {
|
|
|
6178
6293
|
* Removing item(s) from quote
|
|
6179
6294
|
*/
|
|
6180
6295
|
removingItems: {
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6296
|
+
invoke: {
|
|
6297
|
+
/** @todo is there any way to limit the event to be a known event? */
|
|
6298
|
+
input: ({ context: e, event: t }) => {
|
|
6299
|
+
var n, s;
|
|
6300
|
+
return {
|
|
6301
|
+
endpoint: e.endpoints.client,
|
|
6302
|
+
items: t.type === "REMOVE_ITEMS" ? t.items : [],
|
|
6303
|
+
document: (n = e.graphql.removeItems) == null ? void 0 : n.document,
|
|
6304
|
+
requestHeaders: (s = e.graphql.removeItems) == null ? void 0 : s.requestHeaders
|
|
6305
|
+
};
|
|
6306
|
+
},
|
|
6307
|
+
src: "removeItems",
|
|
6308
|
+
onDone: [
|
|
6309
|
+
{
|
|
6310
|
+
actions: ["removeItems", "notifyRemoveItems"],
|
|
6311
|
+
target: "checkingItems"
|
|
6312
|
+
}
|
|
6313
|
+
],
|
|
6314
|
+
onError: [
|
|
6315
|
+
{
|
|
6316
|
+
/** @todo log error? */
|
|
6317
|
+
// actions: ['addItems'],
|
|
6318
|
+
guard: "hasItems",
|
|
6319
|
+
target: "active"
|
|
6320
|
+
},
|
|
6321
|
+
{
|
|
6322
|
+
target: "empty"
|
|
6323
|
+
}
|
|
6324
|
+
]
|
|
6325
|
+
}
|
|
6326
|
+
},
|
|
6327
|
+
/**
|
|
6328
|
+
* Updating quote item(s):
|
|
6329
|
+
* Used for stateful updates to quote like number input on cart
|
|
6330
|
+
* or B2B grids where we are passing actual quantity instead of
|
|
6331
|
+
* incrementing or decrementing by N
|
|
6332
|
+
*
|
|
6333
|
+
* For example: { sku: "ABC", quantity: 5 } we want to update the
|
|
6334
|
+
* quantity from N -> 5 instead of incrementing/decrementing by 5
|
|
6335
|
+
*/
|
|
6336
|
+
updatingItems: {
|
|
6337
|
+
invoke: {
|
|
6338
|
+
/** @todo is there any way to limit the event to be a known event? */
|
|
6339
|
+
input: ({ context: e, event: t }) => {
|
|
6340
|
+
var n, s;
|
|
6341
|
+
return {
|
|
6342
|
+
endpoint: e.endpoints.client,
|
|
6343
|
+
items: t.type === "UPDATE_ITEMS" ? t.items : [],
|
|
6344
|
+
document: (n = e.graphql.updateItems) == null ? void 0 : n.document,
|
|
6345
|
+
requestHeaders: (s = e.graphql.updateItems) == null ? void 0 : s.requestHeaders
|
|
6346
|
+
};
|
|
6347
|
+
},
|
|
6348
|
+
src: "updateItems",
|
|
6349
|
+
onDone: [
|
|
6350
|
+
{
|
|
6351
|
+
actions: ["updateItems", "notifyUpdateItems"],
|
|
6352
|
+
target: "checkingItems"
|
|
6353
|
+
}
|
|
6354
|
+
],
|
|
6355
|
+
onError: [
|
|
6356
|
+
{
|
|
6357
|
+
/** @todo log error? */
|
|
6358
|
+
// actions: ['addItems'],
|
|
6359
|
+
guard: "hasItems",
|
|
6360
|
+
target: "active"
|
|
6361
|
+
},
|
|
6362
|
+
{
|
|
6363
|
+
target: "empty"
|
|
6364
|
+
}
|
|
6365
|
+
]
|
|
6366
|
+
}
|
|
6210
6367
|
}
|
|
6368
|
+
// invoke: {
|
|
6369
|
+
// /** @todo is there any way to limit the event to be a known event? */
|
|
6370
|
+
// input: ({ context, event }) => ({
|
|
6371
|
+
// endpoint: context.endpoints.client,
|
|
6372
|
+
// items: event.type === 'REMOVE_ITEMS' ? event.items : [],
|
|
6373
|
+
// document: context.graphql.removeItems?.document,
|
|
6374
|
+
// requestHeaders: context.graphql.removeItems?.requestHeaders,
|
|
6375
|
+
// }),
|
|
6376
|
+
// src: 'removeItems',
|
|
6377
|
+
// onDone: [
|
|
6378
|
+
// {
|
|
6379
|
+
// actions: ['removeItems'],
|
|
6380
|
+
// guard: 'hasItems',
|
|
6381
|
+
// target: 'active',
|
|
6382
|
+
// },
|
|
6383
|
+
// { target: 'empty' },
|
|
6384
|
+
// ],
|
|
6385
|
+
// onError: [
|
|
6386
|
+
// {
|
|
6387
|
+
// /** @todo log error? */
|
|
6388
|
+
// // actions: ['addItems'],
|
|
6389
|
+
// guard: 'hasItems',
|
|
6390
|
+
// target: 'active',
|
|
6391
|
+
// },
|
|
6392
|
+
// {
|
|
6393
|
+
// target: 'empty',
|
|
6394
|
+
// },
|
|
6395
|
+
// ],
|
|
6396
|
+
// },
|
|
6397
|
+
// },
|
|
6211
6398
|
/**
|
|
6212
6399
|
* Clear all items from quote and reset to empty, generate a new quoteId
|
|
6213
6400
|
*/
|
|
@@ -6238,15 +6425,15 @@ const Dr = (e, t, n, s) => {
|
|
|
6238
6425
|
// removingGiftCard: {},
|
|
6239
6426
|
// applyingSettings: {},
|
|
6240
6427
|
}
|
|
6241
|
-
}),
|
|
6428
|
+
}), gn = Je(
|
|
6242
6429
|
{}
|
|
6243
|
-
),
|
|
6430
|
+
), ti = () => {
|
|
6244
6431
|
var c;
|
|
6245
|
-
const e =
|
|
6432
|
+
const e = Ye(gn);
|
|
6246
6433
|
if (!e || !e.getSnapshot)
|
|
6247
6434
|
throw new Error("quoteActor is not properly initialized");
|
|
6248
|
-
const [t, n] =
|
|
6249
|
-
|
|
6435
|
+
const [t, n] = Mt(() => e.getSnapshot());
|
|
6436
|
+
qt(() => {
|
|
6250
6437
|
if (!e || !e.getSnapshot) {
|
|
6251
6438
|
console.error("quoteActor is not properly initialized");
|
|
6252
6439
|
return;
|
|
@@ -6270,21 +6457,21 @@ const Dr = (e, t, n, s) => {
|
|
|
6270
6457
|
isRemovingItems: o,
|
|
6271
6458
|
isUpdatingItems: a
|
|
6272
6459
|
};
|
|
6273
|
-
},
|
|
6460
|
+
}, ni = async (e = {
|
|
6274
6461
|
inspect: void 0,
|
|
6275
6462
|
quote: { id: "", locale: "" },
|
|
6276
6463
|
endpoints: { client: "", server: "" },
|
|
6277
6464
|
graphql: {}
|
|
6278
6465
|
}) => typeof window < "u" ? (console.warn(
|
|
6279
6466
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
6280
|
-
),
|
|
6467
|
+
), B(Rt, {
|
|
6281
6468
|
inspect: e.inspect,
|
|
6282
6469
|
input: {
|
|
6283
6470
|
initialContext: {
|
|
6284
6471
|
endpoints: e.endpoints
|
|
6285
6472
|
}
|
|
6286
6473
|
}
|
|
6287
|
-
}).start()) :
|
|
6474
|
+
}).start()) : B(Rt, {
|
|
6288
6475
|
input: {
|
|
6289
6476
|
initialContext: {
|
|
6290
6477
|
endpoints: e.endpoints,
|
|
@@ -6297,23 +6484,23 @@ const Dr = (e, t, n, s) => {
|
|
|
6297
6484
|
},
|
|
6298
6485
|
inspect: e.inspect
|
|
6299
6486
|
}).start();
|
|
6300
|
-
function
|
|
6301
|
-
return /* @__PURE__ */
|
|
6487
|
+
function si({ actor: e, children: t }) {
|
|
6488
|
+
return /* @__PURE__ */ ze(gn.Provider, { value: e, children: t });
|
|
6302
6489
|
}
|
|
6303
6490
|
export {
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6491
|
+
nn as AuthContext,
|
|
6492
|
+
Wr as AuthProvider,
|
|
6493
|
+
gn as QuoteContext,
|
|
6494
|
+
si as QuoteProvider,
|
|
6495
|
+
sn as ToastContext,
|
|
6496
|
+
ei as ToastProvider,
|
|
6497
|
+
xt as authMachine,
|
|
6498
|
+
Qr as getAuth,
|
|
6499
|
+
ni as getQuote,
|
|
6500
|
+
Rt as quoteMachine,
|
|
6501
|
+
Rs as timerMachine,
|
|
6502
|
+
Kr as toastMachine,
|
|
6503
|
+
Xr as useAuth,
|
|
6504
|
+
ti as useQuote,
|
|
6505
|
+
Zr as useToast
|
|
6319
6506
|
};
|