@clicktap/state 0.14.6 → 0.14.8
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 +31 -31
- package/index.mjs +888 -751
- package/package.json +1 -1
- package/quote/CheckoutProvider.d.ts +135 -36
- package/quote/QuoteProvider.d.ts +33 -9
- package/quote/checkout/actions/index.d.ts +2 -0
- package/quote/checkout/actions/resetCheckout.d.ts +103 -0
- package/quote/checkout/actions/updateQuote.d.ts +2 -2
- package/quote/checkout/actions/updateSuccessId.d.ts +8 -0
- package/quote/checkout/actors/index.d.ts +1 -0
- package/quote/checkout/actors/placeOrder.d.ts +20 -0
- package/quote/checkout/types.d.ts +21 -1
- package/quote/checkout.d.ts +45 -12
- package/quote/quote/actions/addItems.d.ts +2 -2
- package/quote/quote/actions/index.d.ts +1 -0
- package/quote/quote/actions/refresh.d.ts +2 -2
- package/quote/quote/actions/removeItems.d.ts +2 -2
- package/quote/quote/actions/reset.d.ts +40 -0
- package/quote/quote/actions/updateItems.d.ts +2 -2
- package/quote/quote/types.d.ts +10 -3
- package/quote/quote.d.ts +11 -3
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
function
|
|
1
|
+
import { jsx as be } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Ce, useContext as Oe, useState as Ne, useEffect as ke, cloneElement as In } from "react";
|
|
3
|
+
function An(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 wn(e, t) {
|
|
|
16
16
|
}
|
|
17
17
|
return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function wn() {
|
|
20
20
|
if (typeof globalThis < "u")
|
|
21
21
|
return globalThis;
|
|
22
22
|
if (typeof self < "u")
|
|
@@ -26,18 +26,18 @@ function xn() {
|
|
|
26
26
|
if (typeof global < "u")
|
|
27
27
|
return global;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const e =
|
|
29
|
+
function xn() {
|
|
30
|
+
const e = wn();
|
|
31
31
|
if (e.__xstate__)
|
|
32
32
|
return e.__xstate__;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const bn = (e) => {
|
|
35
35
|
if (typeof window > "u")
|
|
36
36
|
return;
|
|
37
|
-
const t =
|
|
37
|
+
const t = xn();
|
|
38
38
|
t && t.register(e);
|
|
39
39
|
};
|
|
40
|
-
class
|
|
40
|
+
class pt {
|
|
41
41
|
constructor(t) {
|
|
42
42
|
this._process = t, this._active = !1, this._current = null, this._last = null;
|
|
43
43
|
}
|
|
@@ -66,8 +66,8 @@ class ft {
|
|
|
66
66
|
this._last = null;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const Ft = ".", Cn = "", Bt = "", On = "#",
|
|
70
|
-
function
|
|
69
|
+
const Ft = ".", Cn = "", Bt = "", On = "#", Nn = "*", jt = "xstate.init", kn = "xstate.error", ue = "xstate.stop";
|
|
70
|
+
function Dn(e, t) {
|
|
71
71
|
return {
|
|
72
72
|
type: `xstate.after.${e}.${t}`
|
|
73
73
|
};
|
|
@@ -78,7 +78,7 @@ function ze(e, t) {
|
|
|
78
78
|
output: t
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Rn(e, t) {
|
|
82
82
|
return {
|
|
83
83
|
type: `xstate.done.actor.${e}`,
|
|
84
84
|
output: t
|
|
@@ -96,30 +96,30 @@ function Vt(e) {
|
|
|
96
96
|
input: e
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function F(e) {
|
|
100
100
|
setTimeout(() => {
|
|
101
101
|
throw e;
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
104
|
+
const qn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
|
|
105
|
+
function yt(e, t) {
|
|
106
106
|
return `${e.sessionId}.${t}`;
|
|
107
107
|
}
|
|
108
|
-
let
|
|
109
|
-
function
|
|
108
|
+
let Mn = 0;
|
|
109
|
+
function Ln(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
|
-
schedule: (f, m, y, v,
|
|
114
|
+
schedule: (f, m, y, v, _ = Math.random().toString(36).slice(2)) => {
|
|
115
115
|
const w = {
|
|
116
116
|
source: f,
|
|
117
117
|
target: m,
|
|
118
118
|
event: y,
|
|
119
119
|
delay: v,
|
|
120
|
-
id:
|
|
120
|
+
id: _,
|
|
121
121
|
startedAt: Date.now()
|
|
122
|
-
}, R =
|
|
122
|
+
}, R = yt(f, _);
|
|
123
123
|
d._snapshot._scheduledEvents[R] = w;
|
|
124
124
|
const k = a.setTimeout(() => {
|
|
125
125
|
delete o[R], delete d._snapshot._scheduledEvents[R], d._relay(f, m, y);
|
|
@@ -127,7 +127,7 @@ function Pn(e, t) {
|
|
|
127
127
|
o[R] = k;
|
|
128
128
|
},
|
|
129
129
|
cancel: (f, m) => {
|
|
130
|
-
const y =
|
|
130
|
+
const y = yt(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 Pn(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:${Mn++}`,
|
|
155
155
|
_register: (f, m) => (n.set(f, m), f),
|
|
156
156
|
_unregister: (f) => {
|
|
157
157
|
n.delete(f.sessionId);
|
|
@@ -190,11 +190,11 @@ function Pn(e, t) {
|
|
|
190
190
|
const {
|
|
191
191
|
source: y,
|
|
192
192
|
target: v,
|
|
193
|
-
event:
|
|
193
|
+
event: _,
|
|
194
194
|
delay: w,
|
|
195
195
|
id: R
|
|
196
196
|
} = f[m];
|
|
197
|
-
u.schedule(y, v,
|
|
197
|
+
u.schedule(y, v, _, w, R);
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
_clock: a,
|
|
@@ -203,10 +203,10 @@ function Pn(e, t) {
|
|
|
203
203
|
return d;
|
|
204
204
|
}
|
|
205
205
|
function Ht(e, t) {
|
|
206
|
-
const n =
|
|
206
|
+
const n = mt(e), s = mt(t);
|
|
207
207
|
return typeof s == "string" ? typeof n == "string" ? s === n : !1 : typeof n == "string" ? n in s : Object.keys(n).every((r) => r in s ? Ht(n[r], s[r]) : !1);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function tt(e) {
|
|
210
210
|
if (Gt(e))
|
|
211
211
|
return e;
|
|
212
212
|
let t = [], n = "";
|
|
@@ -223,12 +223,12 @@ function et(e) {
|
|
|
223
223
|
}
|
|
224
224
|
return t.push(n), t;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
if (
|
|
226
|
+
function mt(e) {
|
|
227
|
+
if (fs(e))
|
|
228
228
|
return e.value;
|
|
229
229
|
if (typeof e != "string")
|
|
230
230
|
return e;
|
|
231
|
-
const t =
|
|
231
|
+
const t = tt(e);
|
|
232
232
|
return Un(t);
|
|
233
233
|
}
|
|
234
234
|
function Un(e) {
|
|
@@ -245,7 +245,7 @@ function Un(e) {
|
|
|
245
245
|
}
|
|
246
246
|
return t;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function gt(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];
|
|
@@ -256,7 +256,7 @@ function mt(e, t) {
|
|
|
256
256
|
function zt(e) {
|
|
257
257
|
return Gt(e) ? e : [e];
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function B(e) {
|
|
260
260
|
return e === void 0 ? [] : zt(e);
|
|
261
261
|
}
|
|
262
262
|
function Ge(e, t, n, s) {
|
|
@@ -269,7 +269,7 @@ function Ge(e, t, n, s) {
|
|
|
269
269
|
function Gt(e) {
|
|
270
270
|
return Array.isArray(e);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Pn(e) {
|
|
273
273
|
return e.type.startsWith("xstate.error.actor");
|
|
274
274
|
}
|
|
275
275
|
function K(e) {
|
|
@@ -279,9 +279,9 @@ function K(e) {
|
|
|
279
279
|
}
|
|
280
280
|
function Jt(e) {
|
|
281
281
|
if (!(e === void 0 || e === Cn))
|
|
282
|
-
return
|
|
282
|
+
return B(e);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function Et(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 gt(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 vt(e, t) {
|
|
294
294
|
return `${t}.${e}`;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function nt(e, t) {
|
|
297
297
|
const n = t.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
298
298
|
if (!n)
|
|
299
299
|
return e.implementations.actors[t];
|
|
300
300
|
const [, s, r] = n, o = e.getStateNodeById(r).config.invoke;
|
|
301
301
|
return (Array.isArray(o) ? o[s] : o).src;
|
|
302
302
|
}
|
|
303
|
-
const
|
|
303
|
+
const st = 1;
|
|
304
304
|
let D = /* @__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 Fn = {
|
|
308
308
|
clock: {
|
|
309
309
|
setTimeout: (e, t) => setTimeout(e, t),
|
|
310
310
|
clearTimeout: (e) => clearTimeout(e)
|
|
@@ -312,7 +312,7 @@ const Bn = {
|
|
|
312
312
|
logger: console.log.bind(console),
|
|
313
313
|
devTools: !1
|
|
314
314
|
};
|
|
315
|
-
class
|
|
315
|
+
class Bn {
|
|
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 jn {
|
|
|
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 pt(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = D.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
|
+
...Fn,
|
|
326
326
|
...n
|
|
327
327
|
}, {
|
|
328
328
|
clock: r,
|
|
@@ -333,10 +333,10 @@ class jn {
|
|
|
333
333
|
systemId: u,
|
|
334
334
|
inspect: h
|
|
335
335
|
} = s;
|
|
336
|
-
this.system = o ? o.system :
|
|
336
|
+
this.system = o ? o.system : Ln(this, {
|
|
337
337
|
clock: r,
|
|
338
338
|
logger: i
|
|
339
|
-
}), h && !o && this.system.inspect(
|
|
339
|
+
}), h && !o && this.system.inspect(Et(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 jn {
|
|
|
393
393
|
try {
|
|
394
394
|
(r = o.next) == null || r.call(o, t);
|
|
395
395
|
} catch (a) {
|
|
396
|
-
|
|
396
|
+
F(a);
|
|
397
397
|
}
|
|
398
398
|
break;
|
|
399
399
|
case "done":
|
|
@@ -401,9 +401,9 @@ class jn {
|
|
|
401
401
|
try {
|
|
402
402
|
(i = o.next) == null || i.call(o, t);
|
|
403
403
|
} catch (a) {
|
|
404
|
-
|
|
404
|
+
F(a);
|
|
405
405
|
}
|
|
406
|
-
this._stopProcedure(), this._complete(), this._doneEvent =
|
|
406
|
+
this._stopProcedure(), this._complete(), this._doneEvent = Rn(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,7 +466,7 @@ class jn {
|
|
|
466
466
|
*/
|
|
467
467
|
subscribe(t, n, s) {
|
|
468
468
|
var i;
|
|
469
|
-
const r =
|
|
469
|
+
const r = Et(t, n, s);
|
|
470
470
|
if (this._processingStatus !== D.Stopped)
|
|
471
471
|
this.observers.add(r);
|
|
472
472
|
else
|
|
@@ -475,18 +475,18 @@ class jn {
|
|
|
475
475
|
try {
|
|
476
476
|
(i = r.complete) == null || i.call(r);
|
|
477
477
|
} catch (o) {
|
|
478
|
-
|
|
478
|
+
F(o);
|
|
479
479
|
}
|
|
480
480
|
break;
|
|
481
481
|
case "error": {
|
|
482
482
|
const o = this._snapshot.error;
|
|
483
483
|
if (!r.error)
|
|
484
|
-
|
|
484
|
+
F(o);
|
|
485
485
|
else
|
|
486
486
|
try {
|
|
487
487
|
r.error(o);
|
|
488
488
|
} catch (a) {
|
|
489
|
-
|
|
489
|
+
F(a);
|
|
490
490
|
}
|
|
491
491
|
break;
|
|
492
492
|
}
|
|
@@ -588,13 +588,13 @@ class jn {
|
|
|
588
588
|
try {
|
|
589
589
|
(t = n.complete) == null || t.call(n);
|
|
590
590
|
} catch (s) {
|
|
591
|
-
|
|
591
|
+
F(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 || F(t);
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
600
|
let n = !1;
|
|
@@ -604,10 +604,10 @@ class jn {
|
|
|
604
604
|
try {
|
|
605
605
|
r == null || r(t);
|
|
606
606
|
} catch (i) {
|
|
607
|
-
|
|
607
|
+
F(i);
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
this.observers.clear(), n &&
|
|
610
|
+
this.observers.clear(), n && F(t);
|
|
611
611
|
}
|
|
612
612
|
_error(t) {
|
|
613
613
|
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, $t(this.id, t));
|
|
@@ -618,7 +618,7 @@ class jn {
|
|
|
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 !== D.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new
|
|
621
|
+
return this._processingStatus !== D.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new pt(this._process.bind(this)), this._processingStatus = D.Stopped, this.system._unregister(this), this);
|
|
622
622
|
}
|
|
623
623
|
/**
|
|
624
624
|
* @internal
|
|
@@ -638,11 +638,11 @@ class jn {
|
|
|
638
638
|
const {
|
|
639
639
|
devTools: t
|
|
640
640
|
} = this.options;
|
|
641
|
-
t && (typeof t == "function" ? t :
|
|
641
|
+
t && (typeof t == "function" ? t : bn)(this);
|
|
642
642
|
}
|
|
643
643
|
toJSON() {
|
|
644
644
|
return {
|
|
645
|
-
xstate$$type:
|
|
645
|
+
xstate$$type: st,
|
|
646
646
|
id: this.id
|
|
647
647
|
};
|
|
648
648
|
}
|
|
@@ -661,7 +661,7 @@ class jn {
|
|
|
661
661
|
getPersistedSnapshot(t) {
|
|
662
662
|
return this.logic.getPersistedSnapshot(this._snapshot, t);
|
|
663
663
|
}
|
|
664
|
-
[
|
|
664
|
+
[qn]() {
|
|
665
665
|
return this;
|
|
666
666
|
}
|
|
667
667
|
/**
|
|
@@ -682,35 +682,35 @@ class jn {
|
|
|
682
682
|
return this._snapshot;
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
function
|
|
686
|
-
return new
|
|
685
|
+
function j(e, ...[t]) {
|
|
686
|
+
return new Bn(e, t);
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function jn(e, t, n, s, {
|
|
689
689
|
sendId: r
|
|
690
690
|
}) {
|
|
691
691
|
const i = typeof r == "function" ? r(n, s) : r;
|
|
692
692
|
return [t, i];
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function $n(e, t) {
|
|
695
695
|
e.defer(() => {
|
|
696
696
|
e.system.scheduler.cancel(e.self, t);
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function Vn(e) {
|
|
700
700
|
function t(n, s) {
|
|
701
701
|
}
|
|
702
|
-
return t.type = "xstate.cancel", t.sendId = e, t.resolve =
|
|
702
|
+
return t.type = "xstate.cancel", t.sendId = e, t.resolve = jn, t.execute = $n, t;
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function Hn(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" ? nt(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
|
|
712
712
|
let d;
|
|
713
|
-
return u && (d =
|
|
713
|
+
return u && (d = j(u, {
|
|
714
714
|
id: h,
|
|
715
715
|
src: o,
|
|
716
716
|
parent: e.self,
|
|
@@ -731,7 +731,7 @@ function zn(e, t, n, s, {
|
|
|
731
731
|
actorRef: d
|
|
732
732
|
}];
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function zn(e, {
|
|
735
735
|
id: t,
|
|
736
736
|
actorRef: n
|
|
737
737
|
}) {
|
|
@@ -739,7 +739,7 @@ function Gn(e, {
|
|
|
739
739
|
n._processingStatus !== D.Stopped && n.start();
|
|
740
740
|
});
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function Gn(...[e, {
|
|
743
743
|
id: t,
|
|
744
744
|
systemId: n,
|
|
745
745
|
input: s,
|
|
@@ -747,9 +747,9 @@ function Jn(...[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 = Hn, i.execute = zn, i;
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function Jn(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;
|
|
@@ -760,7 +760,7 @@ function Yn(e, t, n, s, {
|
|
|
760
760
|
children: a
|
|
761
761
|
}), o];
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function Yn(e, t) {
|
|
764
764
|
if (t) {
|
|
765
765
|
if (e.system._unregister(t), t._processingStatus !== D.Running) {
|
|
766
766
|
e.stopChild(t);
|
|
@@ -774,16 +774,16 @@ function Qn(e, t) {
|
|
|
774
774
|
function Yt(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 = Jn, t.execute = Yn, t;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function rt(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 rt(o, t, n, s);
|
|
787
787
|
const a = {
|
|
788
788
|
context: t,
|
|
789
789
|
event: n
|
|
@@ -798,7 +798,7 @@ function st(e, t, n, s) {
|
|
|
798
798
|
// this holds all params
|
|
799
799
|
) : o(a, c);
|
|
800
800
|
}
|
|
801
|
-
const
|
|
801
|
+
const it = (e) => e.type === "atomic" || e.type === "final";
|
|
802
802
|
function te(e) {
|
|
803
803
|
return Object.values(e.states).filter((t) => t.type !== "history");
|
|
804
804
|
}
|
|
@@ -811,15 +811,15 @@ function le(e, t) {
|
|
|
811
811
|
n.push(s), s = s.parent;
|
|
812
812
|
return n;
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function Ie(e) {
|
|
815
815
|
const t = new Set(e), n = Xt(t);
|
|
816
816
|
for (const s of t)
|
|
817
817
|
if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
|
|
818
|
-
|
|
818
|
+
Tt(s).forEach((r) => t.add(r));
|
|
819
819
|
else if (s.type === "parallel") {
|
|
820
820
|
for (const r of te(s))
|
|
821
821
|
if (r.type !== "history" && !t.has(r)) {
|
|
822
|
-
const i =
|
|
822
|
+
const i = Tt(r);
|
|
823
823
|
for (const o of i)
|
|
824
824
|
t.add(o);
|
|
825
825
|
}
|
|
@@ -838,7 +838,7 @@ function Qt(e, t) {
|
|
|
838
838
|
if (e.type === "compound") {
|
|
839
839
|
const r = n[0];
|
|
840
840
|
if (r) {
|
|
841
|
-
if (
|
|
841
|
+
if (it(r))
|
|
842
842
|
return r.key;
|
|
843
843
|
} else
|
|
844
844
|
return {};
|
|
@@ -855,16 +855,16 @@ function Xt(e) {
|
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
857
|
function Wt(e, t) {
|
|
858
|
-
const n =
|
|
858
|
+
const n = Ie(t);
|
|
859
859
|
return Qt(e, Xt(n));
|
|
860
860
|
}
|
|
861
|
-
function
|
|
862
|
-
return t.type === "compound" ? te(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? te(t).every((n) =>
|
|
861
|
+
function ot(e, t) {
|
|
862
|
+
return t.type === "compound" ? te(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? te(t).every((n) => ot(e, n)) : t.type === "final";
|
|
863
863
|
}
|
|
864
|
-
const
|
|
865
|
-
function
|
|
864
|
+
const De = (e) => e[0] === On;
|
|
865
|
+
function Qn(e, t) {
|
|
866
866
|
return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
|
|
867
|
-
if (s ===
|
|
867
|
+
if (s === Nn)
|
|
868
868
|
return !0;
|
|
869
869
|
if (!s.endsWith(".*"))
|
|
870
870
|
return !1;
|
|
@@ -879,22 +879,22 @@ function Xn(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 Xn(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 = Dn(r, e.id), a = o.type;
|
|
888
|
+
return e.entry.push(_s(o, {
|
|
889
889
|
id: a,
|
|
890
890
|
delay: r
|
|
891
|
-
})), e.exit.push(
|
|
891
|
+
})), e.exit.push(Vn(a)), a;
|
|
892
892
|
};
|
|
893
893
|
return Object.keys(t).flatMap((r, i) => {
|
|
894
894
|
const o = t[r], a = typeof o == "string" ? {
|
|
895
895
|
target: o
|
|
896
896
|
} : o, c = Number.isNaN(+r) ? r : +r, u = n(c);
|
|
897
|
-
return
|
|
897
|
+
return B(a).map((h) => ({
|
|
898
898
|
...h,
|
|
899
899
|
event: u,
|
|
900
900
|
delay: c
|
|
@@ -910,9 +910,9 @@ function Wn(e) {
|
|
|
910
910
|
});
|
|
911
911
|
}
|
|
912
912
|
function G(e, t, n) {
|
|
913
|
-
const s = Jt(n.target), r = n.reenter ?? !1, i =
|
|
913
|
+
const s = Jt(n.target), r = n.reenter ?? !1, i = Zn(e, s), o = {
|
|
914
914
|
...n,
|
|
915
|
-
actions:
|
|
915
|
+
actions: B(n.actions),
|
|
916
916
|
guard: n.guard,
|
|
917
917
|
target: i,
|
|
918
918
|
source: e,
|
|
@@ -926,7 +926,7 @@ function G(e, t, n) {
|
|
|
926
926
|
};
|
|
927
927
|
return o;
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function Wn(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)) {
|
|
@@ -959,13 +959,13 @@ function Kn(e) {
|
|
|
959
959
|
}
|
|
960
960
|
return t;
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function Kn(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}`);
|
|
966
966
|
const s = {
|
|
967
967
|
source: e,
|
|
968
|
-
actions: !t || typeof t == "string" ? [] :
|
|
968
|
+
actions: !t || typeof t == "string" ? [] : B(t.actions),
|
|
969
969
|
eventType: null,
|
|
970
970
|
reenter: !1,
|
|
971
971
|
target: n ? [n] : [],
|
|
@@ -977,20 +977,20 @@ function Zn(e, t) {
|
|
|
977
977
|
};
|
|
978
978
|
return s;
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function Zn(e, t) {
|
|
981
981
|
if (t !== void 0)
|
|
982
982
|
return t.map((n) => {
|
|
983
983
|
if (typeof n != "string")
|
|
984
984
|
return n;
|
|
985
|
-
if (
|
|
985
|
+
if (De(n))
|
|
986
986
|
return e.machine.getStateNodeById(n);
|
|
987
987
|
const s = n[0] === Ft;
|
|
988
988
|
if (s && !e.parent)
|
|
989
|
-
return
|
|
989
|
+
return Ae(e, n.slice(1));
|
|
990
990
|
const r = s ? e.key + n : n;
|
|
991
991
|
if (e.parent)
|
|
992
992
|
try {
|
|
993
|
-
return
|
|
993
|
+
return Ae(e.parent, r);
|
|
994
994
|
} catch (i) {
|
|
995
995
|
throw new Error(`Invalid transition definition for state node '${e.id}':
|
|
996
996
|
${i.message}`);
|
|
@@ -1002,13 +1002,13 @@ ${i.message}`);
|
|
|
1002
1002
|
function Kt(e) {
|
|
1003
1003
|
const t = Jt(e.config.target);
|
|
1004
1004
|
return t ? {
|
|
1005
|
-
target: t.map((n) => typeof n == "string" ?
|
|
1005
|
+
target: t.map((n) => typeof n == "string" ? Ae(e.parent, n) : n)
|
|
1006
1006
|
} : e.parent.initial;
|
|
1007
1007
|
}
|
|
1008
1008
|
function J(e) {
|
|
1009
1009
|
return e.type === "history";
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function Tt(e) {
|
|
1012
1012
|
const t = Zt(e);
|
|
1013
1013
|
for (const n of t)
|
|
1014
1014
|
for (const s of le(n, e))
|
|
@@ -1029,7 +1029,7 @@ function Zt(e) {
|
|
|
1029
1029
|
return n(e), t;
|
|
1030
1030
|
}
|
|
1031
1031
|
function ne(e, t) {
|
|
1032
|
-
if (
|
|
1032
|
+
if (De(t))
|
|
1033
1033
|
return e.machine.getStateNodeById(t);
|
|
1034
1034
|
if (!e.states)
|
|
1035
1035
|
throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);
|
|
@@ -1038,13 +1038,13 @@ function ne(e, t) {
|
|
|
1038
1038
|
throw new Error(`Child state '${t}' does not exist on '${e.id}'`);
|
|
1039
1039
|
return n;
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1042
|
-
if (typeof t == "string" &&
|
|
1041
|
+
function Ae(e, t) {
|
|
1042
|
+
if (typeof t == "string" && De(t))
|
|
1043
1043
|
try {
|
|
1044
1044
|
return e.machine.getStateNodeById(t);
|
|
1045
1045
|
} catch {
|
|
1046
1046
|
}
|
|
1047
|
-
const n =
|
|
1047
|
+
const n = tt(t).slice();
|
|
1048
1048
|
let s = e;
|
|
1049
1049
|
for (; n.length; ) {
|
|
1050
1050
|
const r = n.shift();
|
|
@@ -1054,7 +1054,7 @@ function Ie(e, t) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
return s;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function we(e, t) {
|
|
1058
1058
|
if (typeof t == "string") {
|
|
1059
1059
|
const r = e.states[t];
|
|
1060
1060
|
if (!r)
|
|
@@ -1066,42 +1066,42 @@ function Ae(e, t) {
|
|
|
1066
1066
|
const o = ne(e, i);
|
|
1067
1067
|
if (!o)
|
|
1068
1068
|
return r;
|
|
1069
|
-
const a =
|
|
1069
|
+
const a = we(o, t[i]);
|
|
1070
1070
|
return r.concat(a);
|
|
1071
1071
|
}, []));
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function es(e, t, n, s) {
|
|
1074
1074
|
const i = ne(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 = ne(e, r[0]), o =
|
|
1077
|
+
function ts(e, t, n, s) {
|
|
1078
|
+
const r = Object.keys(t), i = ne(e, r[0]), o = at(i, t[r[0]], n, s);
|
|
1079
1079
|
return !o || !o.length ? e.next(n, s) : o;
|
|
1080
1080
|
}
|
|
1081
|
-
function
|
|
1081
|
+
function ns(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 = ne(e, i), c =
|
|
1087
|
+
const a = ne(e, i), c = at(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 at(e, t, n, s) {
|
|
1093
|
+
return typeof t == "string" ? es(e, t, n, s) : Object.keys(t).length === 1 ? ts(e, t, n, s) : ns(e, t, n, s);
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function ss(e) {
|
|
1096
1096
|
return Object.keys(e.states).map((t) => e.states[t]).filter((t) => t.type === "history");
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1098
|
+
function V(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 rs(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))
|
|
@@ -1117,8 +1117,8 @@ function en(e, t, n) {
|
|
|
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 (rs(Je([r], t, n), Je([a], t, n)))
|
|
1121
|
+
if (V(r.source, a.source))
|
|
1122
1122
|
o.add(a);
|
|
1123
1123
|
else {
|
|
1124
1124
|
i = !0;
|
|
@@ -1132,13 +1132,13 @@ function en(e, t, n) {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
return Array.from(s);
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function is(e) {
|
|
1136
1136
|
const [t, ...n] = e;
|
|
1137
1137
|
for (const s of le(t, void 0))
|
|
1138
|
-
if (n.every((r) =>
|
|
1138
|
+
if (n.every((r) => V(r, s)))
|
|
1139
1139
|
return s;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function ct(e, t) {
|
|
1142
1142
|
if (!e.target)
|
|
1143
1143
|
return [];
|
|
1144
1144
|
const n = /* @__PURE__ */ new Set();
|
|
@@ -1148,19 +1148,19 @@ function at(e, t) {
|
|
|
1148
1148
|
for (const r of t[s.id])
|
|
1149
1149
|
n.add(r);
|
|
1150
1150
|
else
|
|
1151
|
-
for (const r of
|
|
1151
|
+
for (const r of ct(Kt(s), t))
|
|
1152
1152
|
n.add(r);
|
|
1153
1153
|
else
|
|
1154
1154
|
n.add(s);
|
|
1155
1155
|
return [...n];
|
|
1156
1156
|
}
|
|
1157
1157
|
function tn(e, t) {
|
|
1158
|
-
const n =
|
|
1158
|
+
const n = ct(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 || V(r, e.source)))
|
|
1162
1162
|
return e.source;
|
|
1163
|
-
const s =
|
|
1163
|
+
const s = is(n.concat(e.source));
|
|
1164
1164
|
if (s)
|
|
1165
1165
|
return s;
|
|
1166
1166
|
if (!e.reenter)
|
|
@@ -1174,11 +1174,11 @@ function Je(e, t, n) {
|
|
|
1174
1174
|
const o = tn(i, n);
|
|
1175
1175
|
i.reenter && i.source === o && s.add(o);
|
|
1176
1176
|
for (const a of t)
|
|
1177
|
-
|
|
1177
|
+
V(a, o) && s.add(a);
|
|
1178
1178
|
}
|
|
1179
1179
|
return [...s];
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1181
|
+
function os(e, t) {
|
|
1182
1182
|
if (e.length !== t.size)
|
|
1183
1183
|
return !1;
|
|
1184
1184
|
for (const n of e)
|
|
@@ -1193,11 +1193,11 @@ function Ye(e, t, n, s, r, i) {
|
|
|
1193
1193
|
let a = t.historyValue;
|
|
1194
1194
|
const c = en(e, o, a);
|
|
1195
1195
|
let u = t;
|
|
1196
|
-
r || ([u, a] =
|
|
1196
|
+
r || ([u, a] = ds(u, s, n, c, o, a, i)), u = se(u, s, n, c.flatMap((d) => d.actions), i), u = cs(u, s, n, c, o, i, a, r);
|
|
1197
1197
|
const h = [...o];
|
|
1198
1198
|
u.status === "done" && (u = se(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 && os(t._nodes, o) ? u : Y(u, {
|
|
1201
1201
|
_nodes: h,
|
|
1202
1202
|
historyValue: a
|
|
1203
1203
|
});
|
|
@@ -1205,23 +1205,23 @@ function Ye(e, t, n, s, r, i) {
|
|
|
1205
1205
|
throw d;
|
|
1206
1206
|
}
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function as(e, t, n, s, r) {
|
|
1209
1209
|
if (s.output === void 0)
|
|
1210
1210
|
return;
|
|
1211
1211
|
const i = ze(r.id, r.output !== void 0 && r.parent ? Ge(r.output, e.context, t, n.self) : void 0);
|
|
1212
1212
|
return Ge(s.output, e.context, i, n.self);
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1214
|
+
function cs(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
|
+
us(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(Gn(y.src, {
|
|
1225
1225
|
...y,
|
|
1226
1226
|
syncSnapshot: !!y.onSnapshot
|
|
1227
1227
|
}));
|
|
@@ -1231,20 +1231,20 @@ function us(e, t, n, s, r, i, o, a) {
|
|
|
1231
1231
|
}
|
|
1232
1232
|
if (c = se(c, t, n, m, i, f.invoke.map((y) => y.id)), f.type === "final") {
|
|
1233
1233
|
const y = f.parent;
|
|
1234
|
-
let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent,
|
|
1235
|
-
for ((y == null ? void 0 : y.type) === "compound" && i.push(ze(y.id, f.output !== void 0 ? Ge(f.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !d.has(v) &&
|
|
1236
|
-
d.add(v), i.push(ze(v.id)),
|
|
1234
|
+
let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, _ = v || f;
|
|
1235
|
+
for ((y == null ? void 0 : y.type) === "compound" && i.push(ze(y.id, f.output !== void 0 ? Ge(f.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !d.has(v) && ot(r, v); )
|
|
1236
|
+
d.add(v), i.push(ze(v.id)), _ = v, v = v.parent;
|
|
1237
1237
|
if (v)
|
|
1238
1238
|
continue;
|
|
1239
1239
|
c = Y(c, {
|
|
1240
1240
|
status: "done",
|
|
1241
|
-
output:
|
|
1241
|
+
output: as(c, t, n, c.machine.root, _)
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
return c;
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function us(e, t, n, s) {
|
|
1248
1248
|
for (const r of e) {
|
|
1249
1249
|
const i = tn(r, t);
|
|
1250
1250
|
for (const a of r.target || [])
|
|
@@ -1253,7 +1253,7 @@ function ds(e, t, n, s) {
|
|
|
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
1255
|
r.reenter) && (s.add(a), n.add(a)), Z(a, t, n, s);
|
|
1256
|
-
const o =
|
|
1256
|
+
const o = ct(r, t);
|
|
1257
1257
|
for (const a of o) {
|
|
1258
1258
|
const c = le(a, i);
|
|
1259
1259
|
(i == null ? void 0 : i.type) === "parallel" && c.push(i), nn(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
|
|
@@ -1268,39 +1268,39 @@ function Z(e, t, n, s) {
|
|
|
1268
1268
|
for (const o of i)
|
|
1269
1269
|
s.add(o), Z(o, t, n, s);
|
|
1270
1270
|
for (const o of i)
|
|
1271
|
-
|
|
1271
|
+
Ue(o, e.parent, s, t, n);
|
|
1272
1272
|
} else {
|
|
1273
1273
|
const i = Kt(e);
|
|
1274
1274
|
for (const o of i.target)
|
|
1275
1275
|
s.add(o), i === ((r = e.parent) == null ? void 0 : r.initial) && n.add(e.parent), Z(o, t, n, s);
|
|
1276
1276
|
for (const o of i.target)
|
|
1277
|
-
|
|
1277
|
+
Ue(o, e.parent, s, t, n);
|
|
1278
1278
|
}
|
|
1279
1279
|
else if (e.type === "compound") {
|
|
1280
1280
|
const [i] = e.initial.target;
|
|
1281
|
-
J(i) || (s.add(i), n.add(i)), Z(i, t, n, s),
|
|
1281
|
+
J(i) || (s.add(i), n.add(i)), Z(i, t, n, s), Ue(i, e, s, t, n);
|
|
1282
1282
|
} else if (e.type === "parallel")
|
|
1283
1283
|
for (const i of te(e).filter((o) => !J(o)))
|
|
1284
|
-
[...s].some((o) =>
|
|
1284
|
+
[...s].some((o) => V(o, i)) || (J(i) || (s.add(i), n.add(i)), Z(i, t, n, s));
|
|
1285
1285
|
}
|
|
1286
1286
|
function nn(e, t, n, s, r) {
|
|
1287
1287
|
for (const i of s)
|
|
1288
|
-
if ((!r ||
|
|
1288
|
+
if ((!r || V(i, r)) && e.add(i), i.type === "parallel")
|
|
1289
1289
|
for (const o of te(i).filter((a) => !J(a)))
|
|
1290
|
-
[...e].some((a) =>
|
|
1290
|
+
[...e].some((a) => V(a, o)) || (e.add(o), Z(o, t, n, e));
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1292
|
+
function Ue(e, t, n, s, r) {
|
|
1293
1293
|
nn(n, s, r, le(e, t));
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function ds(e, t, n, s, r, i, o) {
|
|
1296
1296
|
let a = e;
|
|
1297
1297
|
const c = Je(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 ss(h)) {
|
|
1302
1302
|
let f;
|
|
1303
|
-
d.history === "deep" ? f = (m) =>
|
|
1303
|
+
d.history === "deep" ? f = (m) => it(m) && V(m, h) : f = (m) => m.parent === h, u ?? (u = {
|
|
1304
1304
|
...i
|
|
1305
1305
|
}), u[d.id] = Array.from(r).filter(f);
|
|
1306
1306
|
}
|
|
@@ -1308,7 +1308,7 @@ function ls(e, t, n, s, r, i, o) {
|
|
|
1308
1308
|
a = se(a, t, n, [...h.exit, ...h.invoke.map((d) => Yt(d.id))], o), r.delete(h);
|
|
1309
1309
|
return [a, u || i];
|
|
1310
1310
|
}
|
|
1311
|
-
let
|
|
1311
|
+
let St = !1;
|
|
1312
1312
|
function sn(e, t, n, s, r, i) {
|
|
1313
1313
|
const {
|
|
1314
1314
|
machine: o
|
|
@@ -1325,9 +1325,9 @@ function sn(e, t, n, s, r, i) {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
try {
|
|
1328
|
-
|
|
1328
|
+
St = h, h(d, f);
|
|
1329
1329
|
} finally {
|
|
1330
|
-
|
|
1330
|
+
St = !1;
|
|
1331
1331
|
}
|
|
1332
1332
|
};
|
|
1333
1333
|
const u = typeof c == "function", h = u ? c : (
|
|
@@ -1353,7 +1353,7 @@ function sn(e, t, n, s, r, i) {
|
|
|
1353
1353
|
});
|
|
1354
1354
|
continue;
|
|
1355
1355
|
}
|
|
1356
|
-
const y = h, [v,
|
|
1356
|
+
const y = h, [v, _, w] = y.resolve(
|
|
1357
1357
|
n,
|
|
1358
1358
|
a,
|
|
1359
1359
|
d,
|
|
@@ -1362,7 +1362,7 @@ function sn(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,
|
|
1365
|
+
a = v, "retryResolve" in y && (i == null || i.push([y, _])), "execute" in y && (n.self._processingStatus === D.Running ? y.execute(n, _) : n.defer(y.execute.bind(null, n, _))), w && (a = sn(a, t, n, w, r, i));
|
|
1366
1366
|
}
|
|
1367
1367
|
return a;
|
|
1368
1368
|
}
|
|
@@ -1375,7 +1375,7 @@ function se(e, t, n, s, r, i) {
|
|
|
1375
1375
|
c.retryResolve(n, a, u);
|
|
1376
1376
|
}), a;
|
|
1377
1377
|
}
|
|
1378
|
-
function
|
|
1378
|
+
function Pe(e, t, n, s = []) {
|
|
1379
1379
|
let r = e;
|
|
1380
1380
|
const i = [];
|
|
1381
1381
|
function o(u, h, d) {
|
|
@@ -1396,7 +1396,7 @@ function Ue(e, t, n, s = []) {
|
|
|
1396
1396
|
};
|
|
1397
1397
|
let a = t;
|
|
1398
1398
|
if (a.type !== jt) {
|
|
1399
|
-
const u = a, h =
|
|
1399
|
+
const u = a, h = Pn(u), d = It(u, r);
|
|
1400
1400
|
if (h && !d.length)
|
|
1401
1401
|
return r = Y(e, {
|
|
1402
1402
|
status: "error",
|
|
@@ -1417,12 +1417,12 @@ function Ue(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 ? ls(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 = It(a, r);
|
|
1426
1426
|
}
|
|
1427
1427
|
r = Ye(u, r, n, a, !1, s), c = r !== h, o(r, a, u);
|
|
1428
1428
|
}
|
|
@@ -1434,39 +1434,39 @@ function Ue(e, t, n, s = []) {
|
|
|
1434
1434
|
function _t(e, t, n) {
|
|
1435
1435
|
return se(e, t, n, Object.values(e.children).map((s) => Yt(s)), []);
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function It(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 ls(e, t) {
|
|
1441
|
+
const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(it);
|
|
1442
1442
|
for (const r of s)
|
|
1443
1443
|
e:
|
|
1444
1444
|
for (const i of [r].concat(le(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 || rt(o.guard, e.context, t, e)) {
|
|
1448
1448
|
n.add(o);
|
|
1449
1449
|
break e;
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
1452
|
return en(Array.from(n), new Set(e._nodes), e.historyValue);
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1455
|
-
const n =
|
|
1454
|
+
function hs(e, t) {
|
|
1455
|
+
const n = Ie(we(e, t));
|
|
1456
1456
|
return Wt(e, [...n]);
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function fs(e) {
|
|
1459
1459
|
return !!e && typeof e == "object" && "machine" in e && "value" in e;
|
|
1460
1460
|
}
|
|
1461
|
-
const
|
|
1461
|
+
const ps = function(t) {
|
|
1462
1462
|
return Ht(t, this.value);
|
|
1463
|
-
},
|
|
1463
|
+
}, ys = function(t) {
|
|
1464
1464
|
return this.tags.has(t);
|
|
1465
|
-
},
|
|
1465
|
+
}, ms = 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
|
+
}, gs = function() {
|
|
1470
1470
|
const {
|
|
1471
1471
|
_nodes: t,
|
|
1472
1472
|
tags: n,
|
|
@@ -1482,10 +1482,10 @@ const ys = function(t) {
|
|
|
1482
1482
|
...u,
|
|
1483
1483
|
tags: Array.from(n)
|
|
1484
1484
|
};
|
|
1485
|
-
},
|
|
1485
|
+
}, Es = function() {
|
|
1486
1486
|
return this._nodes.reduce((t, n) => (n.meta !== void 0 && (t[n.id] = n.meta), t), {});
|
|
1487
1487
|
};
|
|
1488
|
-
function
|
|
1488
|
+
function ve(e, t) {
|
|
1489
1489
|
return {
|
|
1490
1490
|
status: e.status,
|
|
1491
1491
|
output: e.output,
|
|
@@ -1497,20 +1497,20 @@ function Ee(e, t) {
|
|
|
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: ps,
|
|
1501
|
+
hasTag: ys,
|
|
1502
|
+
can: ms,
|
|
1503
|
+
getMeta: Es,
|
|
1504
|
+
toJSON: gs
|
|
1505
1505
|
};
|
|
1506
1506
|
}
|
|
1507
1507
|
function Y(e, t = {}) {
|
|
1508
|
-
return
|
|
1508
|
+
return ve({
|
|
1509
1509
|
...e,
|
|
1510
1510
|
...t
|
|
1511
1511
|
}, e.machine);
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function vs(e, t) {
|
|
1514
1514
|
const {
|
|
1515
1515
|
_nodes: n,
|
|
1516
1516
|
tags: s,
|
|
@@ -1525,12 +1525,12 @@ function Ts(e, t) {
|
|
|
1525
1525
|
...f
|
|
1526
1526
|
} = e, m = {};
|
|
1527
1527
|
for (const v in i) {
|
|
1528
|
-
const
|
|
1528
|
+
const _ = i[v];
|
|
1529
1529
|
m[v] = {
|
|
1530
|
-
snapshot:
|
|
1531
|
-
src:
|
|
1532
|
-
systemId:
|
|
1533
|
-
syncSnapshot:
|
|
1530
|
+
snapshot: _.getPersistedSnapshot(t),
|
|
1531
|
+
src: _.src,
|
|
1532
|
+
systemId: _._systemId,
|
|
1533
|
+
syncSnapshot: _._syncSnapshot
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
1536
1536
|
return {
|
|
@@ -1548,7 +1548,7 @@ function rn(e) {
|
|
|
1548
1548
|
t ?? (t = Array.isArray(e) ? e.slice() : {
|
|
1549
1549
|
...e
|
|
1550
1550
|
}), t[n] = {
|
|
1551
|
-
xstate$$type:
|
|
1551
|
+
xstate$$type: st,
|
|
1552
1552
|
id: s.id
|
|
1553
1553
|
};
|
|
1554
1554
|
else {
|
|
@@ -1560,7 +1560,7 @@ function rn(e) {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
return t ?? e;
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function Ts(e, t, n, s, {
|
|
1564
1564
|
event: r,
|
|
1565
1565
|
id: i,
|
|
1566
1566
|
delay: o
|
|
@@ -1597,13 +1597,13 @@ function Ss(e, t) {
|
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1600
|
+
function _s(e, t) {
|
|
1601
1601
|
function n(s, r) {
|
|
1602
1602
|
}
|
|
1603
|
-
return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve =
|
|
1603
|
+
return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve = Ts, n.execute = Ss, n;
|
|
1604
1604
|
}
|
|
1605
|
-
const
|
|
1606
|
-
function
|
|
1605
|
+
const At = /* @__PURE__ */ new WeakMap();
|
|
1606
|
+
function Is(e) {
|
|
1607
1607
|
return {
|
|
1608
1608
|
config: e,
|
|
1609
1609
|
start: (n, s) => {
|
|
@@ -1614,7 +1614,7 @@ function As(e) {
|
|
|
1614
1614
|
receivers: void 0,
|
|
1615
1615
|
dispose: void 0
|
|
1616
1616
|
};
|
|
1617
|
-
|
|
1617
|
+
At.set(r, o), o.dispose = e({
|
|
1618
1618
|
input: n.input,
|
|
1619
1619
|
system: i,
|
|
1620
1620
|
self: r,
|
|
@@ -1628,7 +1628,7 @@ function As(e) {
|
|
|
1628
1628
|
},
|
|
1629
1629
|
transition: (n, s, r) => {
|
|
1630
1630
|
var o, a;
|
|
1631
|
-
const i =
|
|
1631
|
+
const i = At.get(r.self);
|
|
1632
1632
|
return s.type === ue ? (n = {
|
|
1633
1633
|
...n,
|
|
1634
1634
|
status: "stopped",
|
|
@@ -1645,8 +1645,8 @@ function As(e) {
|
|
|
1645
1645
|
restoreSnapshot: (n) => n
|
|
1646
1646
|
};
|
|
1647
1647
|
}
|
|
1648
|
-
const
|
|
1649
|
-
function
|
|
1648
|
+
const wt = "xstate.promise.resolve", xt = "xstate.promise.reject", ge = /* @__PURE__ */ new WeakMap();
|
|
1649
|
+
function $(e) {
|
|
1650
1650
|
return {
|
|
1651
1651
|
config: e,
|
|
1652
1652
|
transition: (n, s, r) => {
|
|
@@ -1654,7 +1654,7 @@ function V(e) {
|
|
|
1654
1654
|
if (n.status !== "active")
|
|
1655
1655
|
return n;
|
|
1656
1656
|
switch (s.type) {
|
|
1657
|
-
case
|
|
1657
|
+
case wt: {
|
|
1658
1658
|
const o = s.data;
|
|
1659
1659
|
return {
|
|
1660
1660
|
...n,
|
|
@@ -1663,7 +1663,7 @@ function V(e) {
|
|
|
1663
1663
|
input: void 0
|
|
1664
1664
|
};
|
|
1665
1665
|
}
|
|
1666
|
-
case
|
|
1666
|
+
case xt:
|
|
1667
1667
|
return {
|
|
1668
1668
|
...n,
|
|
1669
1669
|
status: "error",
|
|
@@ -1671,7 +1671,7 @@ function V(e) {
|
|
|
1671
1671
|
input: void 0
|
|
1672
1672
|
};
|
|
1673
1673
|
case ue:
|
|
1674
|
-
return (i =
|
|
1674
|
+
return (i = ge.get(r.self)) == null || i.abort(), {
|
|
1675
1675
|
...n,
|
|
1676
1676
|
status: "stopped",
|
|
1677
1677
|
input: void 0
|
|
@@ -1687,19 +1687,19 @@ function V(e) {
|
|
|
1687
1687
|
if (n.status !== "active")
|
|
1688
1688
|
return;
|
|
1689
1689
|
const i = new AbortController();
|
|
1690
|
-
|
|
1690
|
+
ge.set(s, i), Promise.resolve(e({
|
|
1691
1691
|
input: n.input,
|
|
1692
1692
|
system: r,
|
|
1693
1693
|
self: s,
|
|
1694
1694
|
signal: i.signal
|
|
1695
1695
|
})).then((a) => {
|
|
1696
|
-
s.getSnapshot().status === "active" && (
|
|
1697
|
-
type:
|
|
1696
|
+
s.getSnapshot().status === "active" && (ge.delete(s), r._relay(s, s, {
|
|
1697
|
+
type: wt,
|
|
1698
1698
|
data: a
|
|
1699
1699
|
}));
|
|
1700
1700
|
}, (a) => {
|
|
1701
|
-
s.getSnapshot().status === "active" && (
|
|
1702
|
-
type:
|
|
1701
|
+
s.getSnapshot().status === "active" && (ge.delete(s), r._relay(s, s, {
|
|
1702
|
+
type: xt,
|
|
1703
1703
|
data: a
|
|
1704
1704
|
}));
|
|
1705
1705
|
});
|
|
@@ -1714,7 +1714,7 @@ function V(e) {
|
|
|
1714
1714
|
restoreSnapshot: (n) => n
|
|
1715
1715
|
};
|
|
1716
1716
|
}
|
|
1717
|
-
function
|
|
1717
|
+
function As(e, {
|
|
1718
1718
|
machine: t,
|
|
1719
1719
|
context: n
|
|
1720
1720
|
}, s, r) {
|
|
@@ -1724,10 +1724,10 @@ function ws(e, {
|
|
|
1724
1724
|
input: u
|
|
1725
1725
|
} = a;
|
|
1726
1726
|
if (typeof o == "string") {
|
|
1727
|
-
const h =
|
|
1727
|
+
const h = nt(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 = j(h, {
|
|
1731
1731
|
id: a.id,
|
|
1732
1732
|
parent: e.self,
|
|
1733
1733
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1741,7 +1741,7 @@ function ws(e, {
|
|
|
1741
1741
|
});
|
|
1742
1742
|
return r[d.id] = d, d;
|
|
1743
1743
|
} else
|
|
1744
|
-
return
|
|
1744
|
+
return j(o, {
|
|
1745
1745
|
id: a.id,
|
|
1746
1746
|
parent: e.self,
|
|
1747
1747
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1757,7 +1757,7 @@ function ws(e, {
|
|
|
1757
1757
|
}), c;
|
|
1758
1758
|
};
|
|
1759
1759
|
}
|
|
1760
|
-
function
|
|
1760
|
+
function ws(e, t, n, s, {
|
|
1761
1761
|
assignment: r
|
|
1762
1762
|
}) {
|
|
1763
1763
|
if (!t.context)
|
|
@@ -1765,7 +1765,7 @@ function xs(e, t, n, s, {
|
|
|
1765
1765
|
const i = {}, o = {
|
|
1766
1766
|
context: t.context,
|
|
1767
1767
|
event: n.event,
|
|
1768
|
-
spawn:
|
|
1768
|
+
spawn: As(e, t, n.event, i),
|
|
1769
1769
|
self: e.self,
|
|
1770
1770
|
system: e.system
|
|
1771
1771
|
};
|
|
@@ -1786,12 +1786,12 @@ function xs(e, t, n, s, {
|
|
|
1786
1786
|
} : t.children
|
|
1787
1787
|
})];
|
|
1788
1788
|
}
|
|
1789
|
-
function
|
|
1789
|
+
function x(e) {
|
|
1790
1790
|
function t(n, s) {
|
|
1791
1791
|
}
|
|
1792
|
-
return t.type = "xstate.assign", t.assignment = e, t.resolve =
|
|
1792
|
+
return t.type = "xstate.assign", t.assignment = e, t.resolve = ws, t;
|
|
1793
1793
|
}
|
|
1794
|
-
function
|
|
1794
|
+
function xs(e, t, n, s, {
|
|
1795
1795
|
event: r
|
|
1796
1796
|
}) {
|
|
1797
1797
|
const i = typeof r == "function" ? r(n, s) : r;
|
|
@@ -1799,7 +1799,7 @@ function bs(e, t, n, s, {
|
|
|
1799
1799
|
event: i
|
|
1800
1800
|
}];
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1802
|
+
function bs(e, {
|
|
1803
1803
|
event: t
|
|
1804
1804
|
}) {
|
|
1805
1805
|
e.defer(() => e.emit(t));
|
|
@@ -1807,9 +1807,9 @@ function Ns(e, {
|
|
|
1807
1807
|
function Fe(e) {
|
|
1808
1808
|
function t(n, s) {
|
|
1809
1809
|
}
|
|
1810
|
-
return t.type = "xstate.emit", t.event = e, t.resolve =
|
|
1810
|
+
return t.type = "xstate.emit", t.event = e, t.resolve = xs, t.execute = bs, t;
|
|
1811
1811
|
}
|
|
1812
|
-
let
|
|
1812
|
+
let bt = /* @__PURE__ */ function(e) {
|
|
1813
1813
|
return e.Parent = "#_parent", e.Internal = "#_internal", e;
|
|
1814
1814
|
}({});
|
|
1815
1815
|
function Cs(e, t, n, s, {
|
|
@@ -1832,7 +1832,7 @@ function Cs(e, t, n, s, {
|
|
|
1832
1832
|
const f = typeof r == "function" ? r(n, s) : r;
|
|
1833
1833
|
let m;
|
|
1834
1834
|
if (typeof f == "string") {
|
|
1835
|
-
if (f ===
|
|
1835
|
+
if (f === bt.Parent ? m = e.self._parent : f === bt.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)
|
|
1836
1836
|
throw new Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`);
|
|
1837
1837
|
} else
|
|
1838
1838
|
m = f || e.self;
|
|
@@ -1846,7 +1846,7 @@ function Cs(e, t, n, s, {
|
|
|
1846
1846
|
function Os(e, t, n) {
|
|
1847
1847
|
typeof n.to == "string" && (n.to = t.children[n.to]);
|
|
1848
1848
|
}
|
|
1849
|
-
function
|
|
1849
|
+
function Ns(e, t) {
|
|
1850
1850
|
e.defer(() => {
|
|
1851
1851
|
const {
|
|
1852
1852
|
to: n,
|
|
@@ -1863,42 +1863,42 @@ function ks(e, t) {
|
|
|
1863
1863
|
// at this point, in a deferred task, it should already be mutated by retryResolveSendTo
|
|
1864
1864
|
// if it initially started as a string
|
|
1865
1865
|
n,
|
|
1866
|
-
s.type ===
|
|
1866
|
+
s.type === kn ? $t(e.self.id, s.data) : s
|
|
1867
1867
|
);
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1870
|
+
function Ct(e, t, n) {
|
|
1871
1871
|
function s(r, i) {
|
|
1872
1872
|
}
|
|
1873
|
-
return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = Cs, s.retryResolve = Os, s.execute =
|
|
1873
|
+
return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = Cs, s.retryResolve = Os, s.execute = Ns, s;
|
|
1874
1874
|
}
|
|
1875
|
-
const
|
|
1875
|
+
const Ot = /* @__PURE__ */ new WeakMap();
|
|
1876
1876
|
function X(e, t, n) {
|
|
1877
|
-
let s =
|
|
1877
|
+
let s = Ot.get(e);
|
|
1878
1878
|
return s ? t in s || (s[t] = n()) : (s = {
|
|
1879
1879
|
[t]: n()
|
|
1880
|
-
},
|
|
1880
|
+
}, Ot.set(e, s)), s[t];
|
|
1881
1881
|
}
|
|
1882
|
-
const
|
|
1882
|
+
const ks = {}, oe = (e) => typeof e == "string" ? {
|
|
1883
1883
|
type: e
|
|
1884
1884
|
} : typeof e == "function" ? "resolve" in e ? {
|
|
1885
1885
|
type: e.type
|
|
1886
1886
|
} : {
|
|
1887
1887
|
type: e.name
|
|
1888
1888
|
} : e;
|
|
1889
|
-
class
|
|
1889
|
+
class ut {
|
|
1890
1890
|
constructor(t, n) {
|
|
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(Ft), 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(Ft), 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 ? gt(this.config.states, (s, r) => new ut(s, {
|
|
1892
1892
|
_parent: this,
|
|
1893
1893
|
_key: r,
|
|
1894
1894
|
_machine: this.machine
|
|
1895
|
-
})) :
|
|
1895
|
+
})) : ks, this.type === "compound" && !this.config.initial)
|
|
1896
1896
|
throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
|
|
1897
|
-
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry =
|
|
1897
|
+
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = B(this.config.entry).slice(), this.exit = B(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = B(t.tags).slice();
|
|
1898
1898
|
}
|
|
1899
1899
|
/** @internal */
|
|
1900
1900
|
_initialize() {
|
|
1901
|
-
this.transitions =
|
|
1901
|
+
this.transitions = Wn(this), this.config.always && (this.always = K(this.config.always).map((t) => G(this, Bt, t))), Object.keys(this.states).forEach((t) => {
|
|
1902
1902
|
this.states[t]._initialize();
|
|
1903
1903
|
});
|
|
1904
1904
|
}
|
|
@@ -1925,7 +1925,7 @@ class ct {
|
|
|
1925
1925
|
})
|
|
1926
1926
|
} : void 0,
|
|
1927
1927
|
history: this.history,
|
|
1928
|
-
states:
|
|
1928
|
+
states: gt(this.states, (t) => t.definition),
|
|
1929
1929
|
on: this.on,
|
|
1930
1930
|
transitions: [...this.transitions.values()].flat().map((t) => ({
|
|
1931
1931
|
...t,
|
|
@@ -1949,11 +1949,11 @@ class ct {
|
|
|
1949
1949
|
* The logic invoked as actors by this state node.
|
|
1950
1950
|
*/
|
|
1951
1951
|
get invoke() {
|
|
1952
|
-
return X(this, "invoke", () =>
|
|
1952
|
+
return X(this, "invoke", () => B(this.config.invoke).map((t, n) => {
|
|
1953
1953
|
const {
|
|
1954
1954
|
src: s,
|
|
1955
1955
|
systemId: r
|
|
1956
|
-
} = t, i = t.id ??
|
|
1956
|
+
} = t, i = t.id ?? vt(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${vt(this.id, n)}`;
|
|
1957
1957
|
return {
|
|
1958
1958
|
...t,
|
|
1959
1959
|
src: o,
|
|
@@ -1982,23 +1982,23 @@ class ct {
|
|
|
1982
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), {}));
|
|
1983
1983
|
}
|
|
1984
1984
|
get after() {
|
|
1985
|
-
return X(this, "delayedTransitions", () =>
|
|
1985
|
+
return X(this, "delayedTransitions", () => Xn(this));
|
|
1986
1986
|
}
|
|
1987
1987
|
get initial() {
|
|
1988
|
-
return X(this, "initial", () =>
|
|
1988
|
+
return X(this, "initial", () => Kn(this, this.config.initial));
|
|
1989
1989
|
}
|
|
1990
1990
|
/** @internal */
|
|
1991
1991
|
next(t, n) {
|
|
1992
1992
|
const s = n.type, r = [];
|
|
1993
1993
|
let i;
|
|
1994
|
-
const o = X(this, `candidates-${s}`, () =>
|
|
1994
|
+
const o = X(this, `candidates-${s}`, () => Qn(this, s));
|
|
1995
1995
|
for (const a of o) {
|
|
1996
1996
|
const {
|
|
1997
1997
|
guard: c
|
|
1998
1998
|
} = a, u = t.context;
|
|
1999
1999
|
let h = !1;
|
|
2000
2000
|
try {
|
|
2001
|
-
h = !c ||
|
|
2001
|
+
h = !c || rt(c, u, n, t);
|
|
2002
2002
|
} catch (d) {
|
|
2003
2003
|
const f = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
|
|
2004
2004
|
throw new Error(`Unable to evaluate guard ${f ? `'${f}' ` : ""}in transition for event '${s}' in state node '${this.id}':
|
|
@@ -2039,15 +2039,15 @@ ${d.message}`);
|
|
|
2039
2039
|
return Array.from(t);
|
|
2040
2040
|
}
|
|
2041
2041
|
}
|
|
2042
|
-
const
|
|
2043
|
-
class
|
|
2042
|
+
const Ds = "#";
|
|
2043
|
+
class dt {
|
|
2044
2044
|
constructor(t, n) {
|
|
2045
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 = {
|
|
2046
2046
|
actors: (n == null ? void 0 : n.actors) ?? {},
|
|
2047
2047
|
actions: (n == null ? void 0 : n.actions) ?? {},
|
|
2048
2048
|
delays: (n == null ? void 0 : n.delays) ?? {},
|
|
2049
2049
|
guards: (n == null ? void 0 : n.guards) ?? {}
|
|
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
|
|
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 ut(t, {
|
|
2051
2051
|
_key: this.id,
|
|
2052
2052
|
_machine: this
|
|
2053
2053
|
}), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
|
|
@@ -2068,7 +2068,7 @@ class ut {
|
|
|
2068
2068
|
actors: r,
|
|
2069
2069
|
delays: i
|
|
2070
2070
|
} = this.implementations;
|
|
2071
|
-
return new
|
|
2071
|
+
return new dt(this.config, {
|
|
2072
2072
|
actions: {
|
|
2073
2073
|
...n,
|
|
2074
2074
|
...t.actions
|
|
@@ -2088,12 +2088,12 @@ class ut {
|
|
|
2088
2088
|
});
|
|
2089
2089
|
}
|
|
2090
2090
|
resolveState(t) {
|
|
2091
|
-
const n =
|
|
2092
|
-
return
|
|
2091
|
+
const n = hs(this.root, t.value), s = Ie(we(this.root, n));
|
|
2092
|
+
return ve({
|
|
2093
2093
|
_nodes: [...s],
|
|
2094
2094
|
context: t.context || {},
|
|
2095
2095
|
children: {},
|
|
2096
|
-
status:
|
|
2096
|
+
status: ot(s, this.root) ? "done" : t.status || "active",
|
|
2097
2097
|
output: t.output,
|
|
2098
2098
|
error: t.error,
|
|
2099
2099
|
historyValue: t.historyValue
|
|
@@ -2107,7 +2107,7 @@ class ut {
|
|
|
2107
2107
|
* @param event The received event
|
|
2108
2108
|
*/
|
|
2109
2109
|
transition(t, n, s) {
|
|
2110
|
-
return
|
|
2110
|
+
return Pe(t, n, s).snapshot;
|
|
2111
2111
|
}
|
|
2112
2112
|
/**
|
|
2113
2113
|
* Determines the next state given the current `state` and `event`.
|
|
@@ -2117,10 +2117,10 @@ class ut {
|
|
|
2117
2117
|
* @param event The received event
|
|
2118
2118
|
*/
|
|
2119
2119
|
microstep(t, n, s) {
|
|
2120
|
-
return
|
|
2120
|
+
return Pe(t, n, s).microstates;
|
|
2121
2121
|
}
|
|
2122
2122
|
getTransitionData(t, n) {
|
|
2123
|
-
return
|
|
2123
|
+
return at(this.root, t.value, t, n) || [];
|
|
2124
2124
|
}
|
|
2125
2125
|
/**
|
|
2126
2126
|
* The initial state _before_ evaluating any microsteps.
|
|
@@ -2129,13 +2129,13 @@ class ut {
|
|
|
2129
2129
|
getPreInitialState(t, n, s) {
|
|
2130
2130
|
const {
|
|
2131
2131
|
context: r
|
|
2132
|
-
} = this.config, i =
|
|
2132
|
+
} = this.config, i = ve({
|
|
2133
2133
|
context: typeof r != "function" && r ? r : {},
|
|
2134
2134
|
_nodes: [this.root],
|
|
2135
2135
|
children: {},
|
|
2136
2136
|
status: "active"
|
|
2137
2137
|
}, this);
|
|
2138
|
-
return typeof r == "function" ? se(i, n, t, [
|
|
2138
|
+
return typeof r == "function" ? se(i, n, t, [x(({
|
|
2139
2139
|
spawn: a,
|
|
2140
2140
|
event: c,
|
|
2141
2141
|
self: u
|
|
@@ -2159,7 +2159,7 @@ class ut {
|
|
|
2159
2159
|
// TODO: fix
|
|
2160
2160
|
}], i, t, s, !0, r), {
|
|
2161
2161
|
snapshot: a
|
|
2162
|
-
} =
|
|
2162
|
+
} = Pe(o, s, t, r);
|
|
2163
2163
|
return a;
|
|
2164
2164
|
}
|
|
2165
2165
|
start(t) {
|
|
@@ -2168,10 +2168,10 @@ class ut {
|
|
|
2168
2168
|
});
|
|
2169
2169
|
}
|
|
2170
2170
|
getStateNodeById(t) {
|
|
2171
|
-
const n =
|
|
2171
|
+
const n = tt(t), s = n.slice(1), r = De(n[0]) ? n[0].slice(Ds.length) : n[0], i = this.idMap.get(r);
|
|
2172
2172
|
if (!i)
|
|
2173
2173
|
throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
|
|
2174
|
-
return
|
|
2174
|
+
return Ae(i, s);
|
|
2175
2175
|
}
|
|
2176
2176
|
get definition() {
|
|
2177
2177
|
return this.root.definition;
|
|
@@ -2180,15 +2180,15 @@ class ut {
|
|
|
2180
2180
|
return this.definition;
|
|
2181
2181
|
}
|
|
2182
2182
|
getPersistedSnapshot(t, n) {
|
|
2183
|
-
return
|
|
2183
|
+
return vs(t, n);
|
|
2184
2184
|
}
|
|
2185
2185
|
restoreSnapshot(t, n) {
|
|
2186
2186
|
const s = {}, r = t.children;
|
|
2187
2187
|
Object.keys(r).forEach((c) => {
|
|
2188
|
-
const u = r[c], 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" ? nt(this, d) : d;
|
|
2189
2189
|
if (!f)
|
|
2190
2190
|
return;
|
|
2191
|
-
const m =
|
|
2191
|
+
const m = j(f, {
|
|
2192
2192
|
id: c,
|
|
2193
2193
|
parent: n.self,
|
|
2194
2194
|
syncSnapshot: u.syncSnapshot,
|
|
@@ -2198,10 +2198,10 @@ class ut {
|
|
|
2198
2198
|
});
|
|
2199
2199
|
s[c] = m;
|
|
2200
2200
|
});
|
|
2201
|
-
const i =
|
|
2201
|
+
const i = ve({
|
|
2202
2202
|
...t,
|
|
2203
2203
|
children: s,
|
|
2204
|
-
_nodes: Array.from(
|
|
2204
|
+
_nodes: Array.from(Ie(we(this.root, t.value)))
|
|
2205
2205
|
}, this);
|
|
2206
2206
|
let o = /* @__PURE__ */ new Set();
|
|
2207
2207
|
function a(c, u) {
|
|
@@ -2210,7 +2210,7 @@ class ut {
|
|
|
2210
2210
|
for (let h in c) {
|
|
2211
2211
|
const d = c[h];
|
|
2212
2212
|
if (d && typeof d == "object") {
|
|
2213
|
-
if ("xstate$$type" in d && d.xstate$$type ===
|
|
2213
|
+
if ("xstate$$type" in d && d.xstate$$type === st) {
|
|
2214
2214
|
c[h] = u[d.id];
|
|
2215
2215
|
continue;
|
|
2216
2216
|
}
|
|
@@ -2222,8 +2222,8 @@ class ut {
|
|
|
2222
2222
|
return a(i.context, s), i;
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
function
|
|
2226
|
-
return new
|
|
2225
|
+
function Rs(e, t) {
|
|
2226
|
+
return new dt(e, t);
|
|
2227
2227
|
}
|
|
2228
2228
|
function he({
|
|
2229
2229
|
schemas: e,
|
|
@@ -2233,7 +2233,7 @@ function he({
|
|
|
2233
2233
|
delays: r
|
|
2234
2234
|
}) {
|
|
2235
2235
|
return {
|
|
2236
|
-
createMachine: (i) =>
|
|
2236
|
+
createMachine: (i) => Rs({
|
|
2237
2237
|
...i,
|
|
2238
2238
|
schemas: e
|
|
2239
2239
|
}, {
|
|
@@ -2244,14 +2244,14 @@ function he({
|
|
|
2244
2244
|
})
|
|
2245
2245
|
};
|
|
2246
2246
|
}
|
|
2247
|
-
function
|
|
2248
|
-
const n =
|
|
2247
|
+
function Qe(e, t) {
|
|
2248
|
+
const n = B(t);
|
|
2249
2249
|
if (!n.includes(e.type)) {
|
|
2250
2250
|
const s = n.length === 1 ? `type "${n[0]}"` : `one of types "${n.join('", "')}"`;
|
|
2251
2251
|
throw new Error(`Expected event ${JSON.stringify(e)} to have ${s}`);
|
|
2252
2252
|
}
|
|
2253
2253
|
}
|
|
2254
|
-
function
|
|
2254
|
+
function qs({
|
|
2255
2255
|
context: e,
|
|
2256
2256
|
event: t
|
|
2257
2257
|
}) {
|
|
@@ -2262,12 +2262,12 @@ function Ms({
|
|
|
2262
2262
|
errors: [...e.errors, String(n.error).replace("Error: ", "")]
|
|
2263
2263
|
};
|
|
2264
2264
|
}
|
|
2265
|
-
function
|
|
2265
|
+
function Ms() {
|
|
2266
2266
|
return {
|
|
2267
2267
|
errors: []
|
|
2268
2268
|
};
|
|
2269
2269
|
}
|
|
2270
|
-
function
|
|
2270
|
+
function Ls({
|
|
2271
2271
|
context: e,
|
|
2272
2272
|
event: t
|
|
2273
2273
|
}) {
|
|
@@ -2284,7 +2284,7 @@ function Us() {
|
|
|
2284
2284
|
ignoreRefreshToken: !0
|
|
2285
2285
|
};
|
|
2286
2286
|
}
|
|
2287
|
-
function
|
|
2287
|
+
function Ps({
|
|
2288
2288
|
context: e,
|
|
2289
2289
|
event: t
|
|
2290
2290
|
}) {
|
|
@@ -2296,12 +2296,12 @@ function Fs({
|
|
|
2296
2296
|
ignoreRefreshToken: !1
|
|
2297
2297
|
};
|
|
2298
2298
|
}
|
|
2299
|
-
function
|
|
2299
|
+
function Fs() {
|
|
2300
2300
|
return {
|
|
2301
2301
|
refreshToken: ""
|
|
2302
2302
|
};
|
|
2303
2303
|
}
|
|
2304
|
-
function
|
|
2304
|
+
function Bs() {
|
|
2305
2305
|
return {
|
|
2306
2306
|
user: null,
|
|
2307
2307
|
accessToken: "",
|
|
@@ -2309,19 +2309,19 @@ function js() {
|
|
|
2309
2309
|
ignoreRefreshToken: !1
|
|
2310
2310
|
};
|
|
2311
2311
|
}
|
|
2312
|
-
async function
|
|
2312
|
+
async function Xe(e, t) {
|
|
2313
2313
|
const n = await fetch(e, t);
|
|
2314
2314
|
return n.status === 200 ? n.json() : Promise.resolve({
|
|
2315
2315
|
message: n.statusText,
|
|
2316
2316
|
success: !1
|
|
2317
2317
|
});
|
|
2318
2318
|
}
|
|
2319
|
-
const
|
|
2319
|
+
const js = $(async ({ input: e }) => {
|
|
2320
2320
|
var t;
|
|
2321
2321
|
if (!e.endpoint.client || e.endpoint.client === "")
|
|
2322
2322
|
throw console.log("refreshAccessToken: No client endpoint provided."), new Error("No client endpoint provided.");
|
|
2323
2323
|
try {
|
|
2324
|
-
const n = await
|
|
2324
|
+
const n = await Xe(e.endpoint.client, {
|
|
2325
2325
|
method: "POST",
|
|
2326
2326
|
mode: "cors",
|
|
2327
2327
|
credentials: "include",
|
|
@@ -2347,17 +2347,17 @@ const $s = V(async ({ input: e }) => {
|
|
|
2347
2347
|
} catch (n) {
|
|
2348
2348
|
throw console.log(n), new Error("Could not complete authenticate request (server)");
|
|
2349
2349
|
}
|
|
2350
|
-
}), Vs =
|
|
2350
|
+
}), $s = typeof window > "u", Vs = $(async ({ input: e }) => {
|
|
2351
2351
|
if (!e.endpoint.client || e.endpoint.client === "")
|
|
2352
2352
|
throw console.log("refreshAccessToken: No client endpoint provided."), new Error("No client endpoint provided.");
|
|
2353
2353
|
if (!e.endpoint.server || e.endpoint.server === "")
|
|
2354
2354
|
throw console.log("refreshAccessToken: No server endpoint provided."), new Error("No server endpoint provided.");
|
|
2355
2355
|
let t;
|
|
2356
|
-
if (
|
|
2356
|
+
if ($s) {
|
|
2357
2357
|
if (e.refreshToken === "")
|
|
2358
2358
|
throw new Error("Unauthorized.");
|
|
2359
2359
|
try {
|
|
2360
|
-
if (t = await
|
|
2360
|
+
if (t = await Xe(e.endpoint.server, {
|
|
2361
2361
|
method: "POST",
|
|
2362
2362
|
mode: "cors",
|
|
2363
2363
|
credentials: "include",
|
|
@@ -2377,7 +2377,7 @@ const $s = V(async ({ input: e }) => {
|
|
|
2377
2377
|
throw console.log(n), new Error("Could not complete refresh request (server)");
|
|
2378
2378
|
}
|
|
2379
2379
|
} else {
|
|
2380
|
-
if (t = await
|
|
2380
|
+
if (t = await Xe(e.endpoint.client, {
|
|
2381
2381
|
method: "POST",
|
|
2382
2382
|
mode: "cors",
|
|
2383
2383
|
credentials: "include",
|
|
@@ -2400,7 +2400,7 @@ const $s = V(async ({ input: e }) => {
|
|
|
2400
2400
|
accessToken: t.accessToken
|
|
2401
2401
|
};
|
|
2402
2402
|
}
|
|
2403
|
-
}), Hs =
|
|
2403
|
+
}), Hs = $(async ({ input: e }) => {
|
|
2404
2404
|
if (!e.endpoint.client || e.endpoint.client === "")
|
|
2405
2405
|
throw console.log("unauthenticate: No client endpoint provided."), new Error("No client endpoint provided.");
|
|
2406
2406
|
try {
|
|
@@ -2420,23 +2420,23 @@ const $s = V(async ({ input: e }) => {
|
|
|
2420
2420
|
} catch (t) {
|
|
2421
2421
|
throw console.log(t), new Error("Could not complete unauthenticate request (server)");
|
|
2422
2422
|
}
|
|
2423
|
-
}),
|
|
2423
|
+
}), zs = he({
|
|
2424
2424
|
types: {
|
|
2425
2425
|
context: {},
|
|
2426
2426
|
events: {},
|
|
2427
2427
|
input: {}
|
|
2428
2428
|
},
|
|
2429
2429
|
actions: {
|
|
2430
|
-
addError:
|
|
2431
|
-
clearErrors:
|
|
2432
|
-
setAccessToken:
|
|
2433
|
-
setIgnoreRefreshToken:
|
|
2434
|
-
setUserContext:
|
|
2435
|
-
unsetRefreshToken:
|
|
2436
|
-
unsetUserContext:
|
|
2430
|
+
addError: x(qs),
|
|
2431
|
+
clearErrors: x(Ms),
|
|
2432
|
+
setAccessToken: x(Ls),
|
|
2433
|
+
setIgnoreRefreshToken: x(Us),
|
|
2434
|
+
setUserContext: x(Ps),
|
|
2435
|
+
unsetRefreshToken: x(Fs),
|
|
2436
|
+
unsetUserContext: x(Bs)
|
|
2437
2437
|
},
|
|
2438
2438
|
actors: {
|
|
2439
|
-
authenticate:
|
|
2439
|
+
authenticate: js,
|
|
2440
2440
|
refreshAccessToken: Vs,
|
|
2441
2441
|
unauthenticate: Hs
|
|
2442
2442
|
}
|
|
@@ -2468,7 +2468,7 @@ const $s = V(async ({ input: e }) => {
|
|
|
2468
2468
|
authenticating: {
|
|
2469
2469
|
invoke: {
|
|
2470
2470
|
src: "authenticate",
|
|
2471
|
-
input: ({ context: e, event: t }) => (
|
|
2471
|
+
input: ({ context: e, event: t }) => (Qe(t, "LOGIN"), {
|
|
2472
2472
|
endpoint: {
|
|
2473
2473
|
client: e.endpoints.login
|
|
2474
2474
|
},
|
|
@@ -2528,10 +2528,23 @@ const $s = V(async ({ input: e }) => {
|
|
|
2528
2528
|
target: "loggedIn"
|
|
2529
2529
|
}
|
|
2530
2530
|
],
|
|
2531
|
+
/**
|
|
2532
|
+
* @todo
|
|
2533
|
+
* confirm this logic, does it make sense to unset refresh token
|
|
2534
|
+
* if the request fails for some reason on server side?
|
|
2535
|
+
*/
|
|
2531
2536
|
onError: [
|
|
2537
|
+
// logout can only happen on the client side, so we
|
|
2538
|
+
// guard the action to prevent it from happening on the server
|
|
2539
|
+
// and fall back to loggedOut state server-side
|
|
2540
|
+
{
|
|
2541
|
+
actions: "unsetRefreshToken",
|
|
2542
|
+
target: "unauthenticating",
|
|
2543
|
+
guard: () => typeof window < "u"
|
|
2544
|
+
},
|
|
2532
2545
|
{
|
|
2533
2546
|
actions: "unsetRefreshToken",
|
|
2534
|
-
target: "
|
|
2547
|
+
target: "loggedOut"
|
|
2535
2548
|
}
|
|
2536
2549
|
]
|
|
2537
2550
|
}
|
|
@@ -2577,13 +2590,13 @@ const $s = V(async ({ input: e }) => {
|
|
|
2577
2590
|
// },
|
|
2578
2591
|
// },
|
|
2579
2592
|
}
|
|
2580
|
-
}),
|
|
2593
|
+
}), on = Ce(
|
|
2581
2594
|
{}
|
|
2582
|
-
),
|
|
2583
|
-
const e =
|
|
2595
|
+
), vi = () => {
|
|
2596
|
+
const e = Oe(on), [t, n] = Ne(
|
|
2584
2597
|
typeof window < "u" && e.getSnapshot().value === "loggedIn"
|
|
2585
2598
|
);
|
|
2586
|
-
return
|
|
2599
|
+
return ke(() => {
|
|
2587
2600
|
if (typeof window > "u")
|
|
2588
2601
|
return;
|
|
2589
2602
|
const s = e.subscribe((r) => {
|
|
@@ -2593,19 +2606,10 @@ const $s = V(async ({ input: e }) => {
|
|
|
2593
2606
|
s.unsubscribe();
|
|
2594
2607
|
};
|
|
2595
2608
|
}, [e]), { authActor: e, isLoggedIn: t };
|
|
2596
|
-
},
|
|
2609
|
+
}, Ti = async (e = "", t = {
|
|
2597
2610
|
inspect: void 0,
|
|
2598
2611
|
endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
|
|
2599
|
-
}) =>
|
|
2600
|
-
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
2601
|
-
), U(Ct, {
|
|
2602
|
-
inspect: t.inspect,
|
|
2603
|
-
input: {
|
|
2604
|
-
initialContext: {
|
|
2605
|
-
endpoints: t.endpoints
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
}).start()) : U(Ct, {
|
|
2612
|
+
}) => j(zs, {
|
|
2609
2613
|
input: {
|
|
2610
2614
|
initialContext: {
|
|
2611
2615
|
endpoints: t.endpoints,
|
|
@@ -2614,23 +2618,21 @@ const $s = V(async ({ input: e }) => {
|
|
|
2614
2618
|
},
|
|
2615
2619
|
inspect: t.inspect
|
|
2616
2620
|
}).start();
|
|
2617
|
-
function
|
|
2618
|
-
return /* @__PURE__ */
|
|
2621
|
+
function Si({ actor: e, children: t }) {
|
|
2622
|
+
return /* @__PURE__ */ be(on.Provider, { value: e, children: t });
|
|
2619
2623
|
}
|
|
2620
|
-
function
|
|
2624
|
+
function Gs({
|
|
2621
2625
|
context: e,
|
|
2622
2626
|
event: t
|
|
2623
2627
|
}) {
|
|
2624
|
-
var s;
|
|
2625
2628
|
if (t.type !== "CHANGE_STEP")
|
|
2626
2629
|
return e;
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
});
|
|
2630
|
+
const n = e.quote.checkoutSteps, s = n == null ? void 0 : n.find((r) => r.code === t.step);
|
|
2631
|
+
return !s || !s.isAvailable ? e : {
|
|
2632
|
+
currentStep: s.code ?? e.currentStep
|
|
2633
|
+
};
|
|
2632
2634
|
}
|
|
2633
|
-
function
|
|
2635
|
+
function Js({
|
|
2634
2636
|
context: e,
|
|
2635
2637
|
event: t
|
|
2636
2638
|
}) {
|
|
@@ -2644,7 +2646,19 @@ function Gs({
|
|
|
2644
2646
|
currentStep: s ?? e.currentStep
|
|
2645
2647
|
} : e;
|
|
2646
2648
|
}
|
|
2647
|
-
function
|
|
2649
|
+
function Ys({
|
|
2650
|
+
context: e,
|
|
2651
|
+
event: t
|
|
2652
|
+
}) {
|
|
2653
|
+
return t.type !== "RESET_CHECKOUT" ? e : {
|
|
2654
|
+
currentStep: t.data.currentStep,
|
|
2655
|
+
errors: [],
|
|
2656
|
+
steps: t.data.steps,
|
|
2657
|
+
successId: "",
|
|
2658
|
+
quote: t.data.quote
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
function Qs({
|
|
2648
2662
|
context: e,
|
|
2649
2663
|
event: t
|
|
2650
2664
|
}) {
|
|
@@ -2655,26 +2669,37 @@ function Js({
|
|
|
2655
2669
|
quote: { ...e.quote, ...n.output.quote }
|
|
2656
2670
|
};
|
|
2657
2671
|
}
|
|
2658
|
-
|
|
2672
|
+
function Xs({
|
|
2673
|
+
context: e,
|
|
2674
|
+
event: t
|
|
2675
|
+
}) {
|
|
2676
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
2677
|
+
return e;
|
|
2678
|
+
const n = t;
|
|
2679
|
+
return n.output.type !== "PLACE_ORDER_SUCCESS" ? e : {
|
|
2680
|
+
successId: n.output.successId
|
|
2681
|
+
};
|
|
2682
|
+
}
|
|
2683
|
+
const lt = JSON, Ws = (e) => e.toUpperCase(), Ks = (e) => {
|
|
2659
2684
|
const t = {};
|
|
2660
2685
|
return e.forEach((n, s) => {
|
|
2661
2686
|
t[s] = n;
|
|
2662
2687
|
}), t;
|
|
2663
|
-
},
|
|
2688
|
+
}, Zs = (e, t, n) => e.document ? e : {
|
|
2664
2689
|
document: e,
|
|
2665
2690
|
variables: t,
|
|
2666
2691
|
requestHeaders: n,
|
|
2667
2692
|
signal: void 0
|
|
2668
|
-
},
|
|
2693
|
+
}, er = (e, t, n) => e.query ? e : {
|
|
2669
2694
|
query: e,
|
|
2670
2695
|
variables: t,
|
|
2671
2696
|
requestHeaders: n,
|
|
2672
2697
|
signal: void 0
|
|
2673
|
-
},
|
|
2698
|
+
}, tr = (e, t) => e.documents ? e : {
|
|
2674
2699
|
documents: e,
|
|
2675
2700
|
requestHeaders: t,
|
|
2676
2701
|
signal: void 0
|
|
2677
|
-
},
|
|
2702
|
+
}, nr = (e, t, ...n) => {
|
|
2678
2703
|
const [s, r] = n;
|
|
2679
2704
|
return e.document ? e : {
|
|
2680
2705
|
url: e,
|
|
@@ -2684,24 +2709,24 @@ const dt = JSON, Ys = (e) => e.toUpperCase(), Qs = (e) => {
|
|
|
2684
2709
|
signal: void 0
|
|
2685
2710
|
};
|
|
2686
2711
|
};
|
|
2687
|
-
function
|
|
2712
|
+
function Te(e, t) {
|
|
2688
2713
|
if (!!!e)
|
|
2689
2714
|
throw new Error(t);
|
|
2690
2715
|
}
|
|
2691
|
-
function
|
|
2716
|
+
function sr(e) {
|
|
2692
2717
|
return typeof e == "object" && e !== null;
|
|
2693
2718
|
}
|
|
2694
|
-
function
|
|
2719
|
+
function rr(e, t) {
|
|
2695
2720
|
if (!!!e)
|
|
2696
2721
|
throw new Error(
|
|
2697
2722
|
t ?? "Unexpected invariant triggered."
|
|
2698
2723
|
);
|
|
2699
2724
|
}
|
|
2700
|
-
const
|
|
2701
|
-
function
|
|
2725
|
+
const ir = /\r\n|[\n\r]/g;
|
|
2726
|
+
function We(e, t) {
|
|
2702
2727
|
let n = 0, s = 1;
|
|
2703
|
-
for (const r of e.body.matchAll(
|
|
2704
|
-
if (typeof r.index == "number" ||
|
|
2728
|
+
for (const r of e.body.matchAll(ir)) {
|
|
2729
|
+
if (typeof r.index == "number" || rr(!1), r.index >= t)
|
|
2705
2730
|
break;
|
|
2706
2731
|
n = r.index + r[0].length, s += 1;
|
|
2707
2732
|
}
|
|
@@ -2710,27 +2735,27 @@ function Xe(e, t) {
|
|
|
2710
2735
|
column: t + 1 - n
|
|
2711
2736
|
};
|
|
2712
2737
|
}
|
|
2713
|
-
function
|
|
2714
|
-
return
|
|
2738
|
+
function or(e) {
|
|
2739
|
+
return an(
|
|
2715
2740
|
e.source,
|
|
2716
|
-
|
|
2741
|
+
We(e.source, e.start)
|
|
2717
2742
|
);
|
|
2718
2743
|
}
|
|
2719
|
-
function
|
|
2744
|
+
function an(e, t) {
|
|
2720
2745
|
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}
|
|
2721
2746
|
`, h = s.split(/\r\n|[\n\r]/g), d = h[r];
|
|
2722
2747
|
if (d.length > 120) {
|
|
2723
2748
|
const f = Math.floor(c / 80), m = c % 80, y = [];
|
|
2724
2749
|
for (let v = 0; v < d.length; v += 80)
|
|
2725
2750
|
y.push(d.slice(v, v + 80));
|
|
2726
|
-
return u +
|
|
2751
|
+
return u + Nt([
|
|
2727
2752
|
[`${o} |`, y[0]],
|
|
2728
2753
|
...y.slice(1, f + 1).map((v) => ["|", v]),
|
|
2729
2754
|
["|", "^".padStart(m)],
|
|
2730
2755
|
["|", y[f + 1]]
|
|
2731
2756
|
]);
|
|
2732
2757
|
}
|
|
2733
|
-
return u +
|
|
2758
|
+
return u + Nt([
|
|
2734
2759
|
// Lines specified like this: ["prefix", "string"],
|
|
2735
2760
|
[`${o - 1} |`, h[r - 1]],
|
|
2736
2761
|
[`${o} |`, d],
|
|
@@ -2738,12 +2763,12 @@ function cn(e, t) {
|
|
|
2738
2763
|
[`${o + 1} |`, h[r + 1]]
|
|
2739
2764
|
]);
|
|
2740
2765
|
}
|
|
2741
|
-
function
|
|
2766
|
+
function Nt(e) {
|
|
2742
2767
|
const t = e.filter(([s, r]) => r !== void 0), n = Math.max(...t.map(([s]) => s.length));
|
|
2743
2768
|
return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
|
|
2744
2769
|
`);
|
|
2745
2770
|
}
|
|
2746
|
-
function
|
|
2771
|
+
function ar(e) {
|
|
2747
2772
|
const t = e[0];
|
|
2748
2773
|
return t == null || "kind" in t || "length" in t ? {
|
|
2749
2774
|
nodes: t,
|
|
@@ -2754,7 +2779,7 @@ function rr(e) {
|
|
|
2754
2779
|
extensions: e[5]
|
|
2755
2780
|
} : t;
|
|
2756
2781
|
}
|
|
2757
|
-
class
|
|
2782
|
+
class ht extends Error {
|
|
2758
2783
|
/**
|
|
2759
2784
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
2760
2785
|
* which correspond to this error.
|
|
@@ -2795,15 +2820,15 @@ class lt extends Error {
|
|
|
2795
2820
|
*/
|
|
2796
2821
|
constructor(t, ...n) {
|
|
2797
2822
|
var s, r, i;
|
|
2798
|
-
const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } =
|
|
2823
|
+
const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = ar(n);
|
|
2799
2824
|
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = kt(
|
|
2800
2825
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
2801
2826
|
);
|
|
2802
2827
|
const f = kt(
|
|
2803
2828
|
(s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
|
|
2804
2829
|
);
|
|
2805
|
-
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) =>
|
|
2806
|
-
const m =
|
|
2830
|
+
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) => We(a, y)) : f == null ? void 0 : f.map((y) => We(y.source, y.start));
|
|
2831
|
+
const m = sr(
|
|
2807
2832
|
h == null ? void 0 : h.extensions
|
|
2808
2833
|
) ? h == null ? void 0 : h.extensions : void 0;
|
|
2809
2834
|
this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
@@ -2830,7 +2855,7 @@ class lt extends Error {
|
|
|
2830
2855
|
value: h.stack,
|
|
2831
2856
|
writable: !0,
|
|
2832
2857
|
configurable: !0
|
|
2833
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
2858
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, ht) : Object.defineProperty(this, "stack", {
|
|
2834
2859
|
value: Error().stack,
|
|
2835
2860
|
writable: !0,
|
|
2836
2861
|
configurable: !0
|
|
@@ -2845,12 +2870,12 @@ class lt extends Error {
|
|
|
2845
2870
|
for (const n of this.nodes)
|
|
2846
2871
|
n.loc && (t += `
|
|
2847
2872
|
|
|
2848
|
-
` +
|
|
2873
|
+
` + or(n.loc));
|
|
2849
2874
|
else if (this.source && this.locations)
|
|
2850
2875
|
for (const n of this.locations)
|
|
2851
2876
|
t += `
|
|
2852
2877
|
|
|
2853
|
-
` +
|
|
2878
|
+
` + an(this.source, n);
|
|
2854
2879
|
return t;
|
|
2855
2880
|
}
|
|
2856
2881
|
toJSON() {
|
|
@@ -2863,13 +2888,13 @@ class lt extends Error {
|
|
|
2863
2888
|
function kt(e) {
|
|
2864
2889
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
2865
2890
|
}
|
|
2866
|
-
function
|
|
2867
|
-
return new
|
|
2891
|
+
function C(e, t, n) {
|
|
2892
|
+
return new ht(`Syntax Error: ${n}`, {
|
|
2868
2893
|
source: e,
|
|
2869
2894
|
positions: [t]
|
|
2870
2895
|
});
|
|
2871
2896
|
}
|
|
2872
|
-
class
|
|
2897
|
+
class cr {
|
|
2873
2898
|
/**
|
|
2874
2899
|
* The character offset at which this Node begins.
|
|
2875
2900
|
*/
|
|
@@ -2898,7 +2923,7 @@ class ir {
|
|
|
2898
2923
|
};
|
|
2899
2924
|
}
|
|
2900
2925
|
}
|
|
2901
|
-
class
|
|
2926
|
+
class cn {
|
|
2902
2927
|
/**
|
|
2903
2928
|
* The kind of Token.
|
|
2904
2929
|
*/
|
|
@@ -2940,7 +2965,7 @@ class un {
|
|
|
2940
2965
|
};
|
|
2941
2966
|
}
|
|
2942
2967
|
}
|
|
2943
|
-
const
|
|
2968
|
+
const un = {
|
|
2944
2969
|
Name: [],
|
|
2945
2970
|
Document: ["definitions"],
|
|
2946
2971
|
OperationDefinition: [
|
|
@@ -3014,45 +3039,45 @@ const dn = {
|
|
|
3014
3039
|
UnionTypeExtension: ["name", "directives", "types"],
|
|
3015
3040
|
EnumTypeExtension: ["name", "directives", "values"],
|
|
3016
3041
|
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
3017
|
-
},
|
|
3042
|
+
}, ur = new Set(Object.keys(un));
|
|
3018
3043
|
function Dt(e) {
|
|
3019
3044
|
const t = e == null ? void 0 : e.kind;
|
|
3020
|
-
return typeof t == "string" &&
|
|
3045
|
+
return typeof t == "string" && ur.has(t);
|
|
3021
3046
|
}
|
|
3022
3047
|
var ee;
|
|
3023
3048
|
(function(e) {
|
|
3024
3049
|
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
3025
3050
|
})(ee || (ee = {}));
|
|
3026
|
-
var
|
|
3051
|
+
var Ke;
|
|
3027
3052
|
(function(e) {
|
|
3028
3053
|
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";
|
|
3029
|
-
})(
|
|
3054
|
+
})(Ke || (Ke = {}));
|
|
3030
3055
|
var T;
|
|
3031
3056
|
(function(e) {
|
|
3032
3057
|
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";
|
|
3033
3058
|
})(T || (T = {}));
|
|
3034
|
-
function
|
|
3059
|
+
function Ze(e) {
|
|
3035
3060
|
return e === 9 || e === 32;
|
|
3036
3061
|
}
|
|
3037
3062
|
function de(e) {
|
|
3038
3063
|
return e >= 48 && e <= 57;
|
|
3039
3064
|
}
|
|
3040
|
-
function
|
|
3065
|
+
function dn(e) {
|
|
3041
3066
|
return e >= 97 && e <= 122 || // A-Z
|
|
3042
3067
|
e >= 65 && e <= 90;
|
|
3043
3068
|
}
|
|
3044
|
-
function
|
|
3045
|
-
return
|
|
3069
|
+
function ln(e) {
|
|
3070
|
+
return dn(e) || e === 95;
|
|
3046
3071
|
}
|
|
3047
|
-
function
|
|
3048
|
-
return
|
|
3072
|
+
function dr(e) {
|
|
3073
|
+
return dn(e) || de(e) || e === 95;
|
|
3049
3074
|
}
|
|
3050
|
-
function
|
|
3075
|
+
function lr(e) {
|
|
3051
3076
|
var t;
|
|
3052
3077
|
let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
|
|
3053
3078
|
for (let o = 0; o < e.length; ++o) {
|
|
3054
3079
|
var i;
|
|
3055
|
-
const a = e[o], c =
|
|
3080
|
+
const a = e[o], c = hr(a);
|
|
3056
3081
|
c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
|
|
3057
3082
|
}
|
|
3058
3083
|
return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
|
|
@@ -3060,17 +3085,17 @@ function cr(e) {
|
|
|
3060
3085
|
r + 1
|
|
3061
3086
|
);
|
|
3062
3087
|
}
|
|
3063
|
-
function
|
|
3088
|
+
function hr(e) {
|
|
3064
3089
|
let t = 0;
|
|
3065
|
-
for (; t < e.length &&
|
|
3090
|
+
for (; t < e.length && Ze(e.charCodeAt(t)); )
|
|
3066
3091
|
++t;
|
|
3067
3092
|
return t;
|
|
3068
3093
|
}
|
|
3069
|
-
function
|
|
3070
|
-
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 ||
|
|
3094
|
+
function fr(e, t) {
|
|
3095
|
+
const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 || Ze(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c, h = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
|
|
3071
3096
|
(!r || e.length > 70 || u || i || o);
|
|
3072
3097
|
let d = "";
|
|
3073
|
-
const f = r &&
|
|
3098
|
+
const f = r && Ze(e.charCodeAt(0));
|
|
3074
3099
|
return (h && !f || i) && (d += `
|
|
3075
3100
|
`), d += n, (h || u) && (d += `
|
|
3076
3101
|
`), '"""' + d + '"""';
|
|
@@ -3079,7 +3104,7 @@ var p;
|
|
|
3079
3104
|
(function(e) {
|
|
3080
3105
|
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";
|
|
3081
3106
|
})(p || (p = {}));
|
|
3082
|
-
class
|
|
3107
|
+
class pr {
|
|
3083
3108
|
/**
|
|
3084
3109
|
* The previously focused non-ignored token.
|
|
3085
3110
|
*/
|
|
@@ -3093,7 +3118,7 @@ class lr {
|
|
|
3093
3118
|
* The character offset at which the current line begins.
|
|
3094
3119
|
*/
|
|
3095
3120
|
constructor(t) {
|
|
3096
|
-
const n = new
|
|
3121
|
+
const n = new cn(p.SOF, 0, 0, 0, 0);
|
|
3097
3122
|
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
3098
3123
|
}
|
|
3099
3124
|
get [Symbol.toStringTag]() {
|
|
@@ -3116,26 +3141,26 @@ class lr {
|
|
|
3116
3141
|
if (t.next)
|
|
3117
3142
|
t = t.next;
|
|
3118
3143
|
else {
|
|
3119
|
-
const n =
|
|
3144
|
+
const n = mr(this, t.end);
|
|
3120
3145
|
t.next = n, n.prev = t, t = n;
|
|
3121
3146
|
}
|
|
3122
3147
|
while (t.kind === p.COMMENT);
|
|
3123
3148
|
return t;
|
|
3124
3149
|
}
|
|
3125
3150
|
}
|
|
3126
|
-
function
|
|
3151
|
+
function yr(e) {
|
|
3127
3152
|
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;
|
|
3128
3153
|
}
|
|
3129
3154
|
function re(e) {
|
|
3130
3155
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
3131
3156
|
}
|
|
3132
|
-
function
|
|
3133
|
-
return
|
|
3157
|
+
function Re(e, t) {
|
|
3158
|
+
return hn(e.charCodeAt(t)) && fn(e.charCodeAt(t + 1));
|
|
3134
3159
|
}
|
|
3135
|
-
function
|
|
3160
|
+
function hn(e) {
|
|
3136
3161
|
return e >= 55296 && e <= 56319;
|
|
3137
3162
|
}
|
|
3138
|
-
function
|
|
3163
|
+
function fn(e) {
|
|
3139
3164
|
return e >= 56320 && e <= 57343;
|
|
3140
3165
|
}
|
|
3141
3166
|
function Q(e, t) {
|
|
@@ -3148,11 +3173,11 @@ function Q(e, t) {
|
|
|
3148
3173
|
}
|
|
3149
3174
|
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
3150
3175
|
}
|
|
3151
|
-
function
|
|
3176
|
+
function b(e, t, n, s, r) {
|
|
3152
3177
|
const i = e.line, o = 1 + n - e.lineStart;
|
|
3153
|
-
return new
|
|
3178
|
+
return new cn(t, n, s, i, o, r);
|
|
3154
3179
|
}
|
|
3155
|
-
function
|
|
3180
|
+
function mr(e, t) {
|
|
3156
3181
|
const n = e.source.body, s = n.length;
|
|
3157
3182
|
let r = t;
|
|
3158
3183
|
for (; r < s; ) {
|
|
@@ -3171,53 +3196,53 @@ function fr(e, t) {
|
|
|
3171
3196
|
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
|
|
3172
3197
|
continue;
|
|
3173
3198
|
case 35:
|
|
3174
|
-
return
|
|
3199
|
+
return gr(e, r);
|
|
3175
3200
|
case 33:
|
|
3176
|
-
return
|
|
3201
|
+
return b(e, p.BANG, r, r + 1);
|
|
3177
3202
|
case 36:
|
|
3178
|
-
return
|
|
3203
|
+
return b(e, p.DOLLAR, r, r + 1);
|
|
3179
3204
|
case 38:
|
|
3180
|
-
return
|
|
3205
|
+
return b(e, p.AMP, r, r + 1);
|
|
3181
3206
|
case 40:
|
|
3182
|
-
return
|
|
3207
|
+
return b(e, p.PAREN_L, r, r + 1);
|
|
3183
3208
|
case 41:
|
|
3184
|
-
return
|
|
3209
|
+
return b(e, p.PAREN_R, r, r + 1);
|
|
3185
3210
|
case 46:
|
|
3186
3211
|
if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
|
|
3187
|
-
return
|
|
3212
|
+
return b(e, p.SPREAD, r, r + 3);
|
|
3188
3213
|
break;
|
|
3189
3214
|
case 58:
|
|
3190
|
-
return
|
|
3215
|
+
return b(e, p.COLON, r, r + 1);
|
|
3191
3216
|
case 61:
|
|
3192
|
-
return
|
|
3217
|
+
return b(e, p.EQUALS, r, r + 1);
|
|
3193
3218
|
case 64:
|
|
3194
|
-
return
|
|
3219
|
+
return b(e, p.AT, r, r + 1);
|
|
3195
3220
|
case 91:
|
|
3196
|
-
return
|
|
3221
|
+
return b(e, p.BRACKET_L, r, r + 1);
|
|
3197
3222
|
case 93:
|
|
3198
|
-
return
|
|
3223
|
+
return b(e, p.BRACKET_R, r, r + 1);
|
|
3199
3224
|
case 123:
|
|
3200
|
-
return
|
|
3225
|
+
return b(e, p.BRACE_L, r, r + 1);
|
|
3201
3226
|
case 124:
|
|
3202
|
-
return
|
|
3227
|
+
return b(e, p.PIPE, r, r + 1);
|
|
3203
3228
|
case 125:
|
|
3204
|
-
return
|
|
3229
|
+
return b(e, p.BRACE_R, r, r + 1);
|
|
3205
3230
|
case 34:
|
|
3206
|
-
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ?
|
|
3231
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Ir(e, r) : vr(e, r);
|
|
3207
3232
|
}
|
|
3208
3233
|
if (de(i) || i === 45)
|
|
3209
|
-
return
|
|
3210
|
-
if (
|
|
3211
|
-
return
|
|
3212
|
-
throw
|
|
3234
|
+
return Er(e, r, i);
|
|
3235
|
+
if (ln(i))
|
|
3236
|
+
return Ar(e, r);
|
|
3237
|
+
throw C(
|
|
3213
3238
|
e.source,
|
|
3214
3239
|
r,
|
|
3215
|
-
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) ||
|
|
3240
|
+
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || Re(n, r) ? `Unexpected character: ${Q(e, r)}.` : `Invalid character: ${Q(e, r)}.`
|
|
3216
3241
|
);
|
|
3217
3242
|
}
|
|
3218
|
-
return
|
|
3243
|
+
return b(e, p.EOF, s, s);
|
|
3219
3244
|
}
|
|
3220
|
-
function
|
|
3245
|
+
function gr(e, t) {
|
|
3221
3246
|
const n = e.source.body, s = n.length;
|
|
3222
3247
|
let r = t + 1;
|
|
3223
3248
|
for (; r < s; ) {
|
|
@@ -3226,12 +3251,12 @@ function pr(e, t) {
|
|
|
3226
3251
|
break;
|
|
3227
3252
|
if (re(i))
|
|
3228
3253
|
++r;
|
|
3229
|
-
else if (
|
|
3254
|
+
else if (Re(n, r))
|
|
3230
3255
|
r += 2;
|
|
3231
3256
|
else
|
|
3232
3257
|
break;
|
|
3233
3258
|
}
|
|
3234
|
-
return
|
|
3259
|
+
return b(
|
|
3235
3260
|
e,
|
|
3236
3261
|
p.COMMENT,
|
|
3237
3262
|
t,
|
|
@@ -3239,12 +3264,12 @@ function pr(e, t) {
|
|
|
3239
3264
|
n.slice(t + 1, r)
|
|
3240
3265
|
);
|
|
3241
3266
|
}
|
|
3242
|
-
function
|
|
3267
|
+
function Er(e, t, n) {
|
|
3243
3268
|
const s = e.source.body;
|
|
3244
3269
|
let r = t, i = n, o = !1;
|
|
3245
3270
|
if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
|
|
3246
3271
|
if (i = s.charCodeAt(++r), de(i))
|
|
3247
|
-
throw
|
|
3272
|
+
throw C(
|
|
3248
3273
|
e.source,
|
|
3249
3274
|
r,
|
|
3250
3275
|
`Invalid number, unexpected digit after 0: ${Q(
|
|
@@ -3254,8 +3279,8 @@ function yr(e, t, n) {
|
|
|
3254
3279
|
);
|
|
3255
3280
|
} else
|
|
3256
3281
|
r = Be(e, r, i), i = s.charCodeAt(r);
|
|
3257
|
-
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = Be(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 = Be(e, r, i), i = s.charCodeAt(r)), i === 46 ||
|
|
3258
|
-
throw
|
|
3282
|
+
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = Be(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 = Be(e, r, i), i = s.charCodeAt(r)), i === 46 || ln(i))
|
|
3283
|
+
throw C(
|
|
3259
3284
|
e.source,
|
|
3260
3285
|
r,
|
|
3261
3286
|
`Invalid number, expected digit but got: ${Q(
|
|
@@ -3263,7 +3288,7 @@ function yr(e, t, n) {
|
|
|
3263
3288
|
r
|
|
3264
3289
|
)}.`
|
|
3265
3290
|
);
|
|
3266
|
-
return
|
|
3291
|
+
return b(
|
|
3267
3292
|
e,
|
|
3268
3293
|
o ? p.FLOAT : p.INT,
|
|
3269
3294
|
t,
|
|
@@ -3273,7 +3298,7 @@ function yr(e, t, n) {
|
|
|
3273
3298
|
}
|
|
3274
3299
|
function Be(e, t, n) {
|
|
3275
3300
|
if (!de(n))
|
|
3276
|
-
throw
|
|
3301
|
+
throw C(
|
|
3277
3302
|
e.source,
|
|
3278
3303
|
t,
|
|
3279
3304
|
`Invalid number, expected digit but got: ${Q(
|
|
@@ -3287,16 +3312,16 @@ function Be(e, t, n) {
|
|
|
3287
3312
|
++r;
|
|
3288
3313
|
return r;
|
|
3289
3314
|
}
|
|
3290
|
-
function
|
|
3315
|
+
function vr(e, t) {
|
|
3291
3316
|
const n = e.source.body, s = n.length;
|
|
3292
3317
|
let r = t + 1, i = r, o = "";
|
|
3293
3318
|
for (; r < s; ) {
|
|
3294
3319
|
const a = n.charCodeAt(r);
|
|
3295
3320
|
if (a === 34)
|
|
3296
|
-
return o += n.slice(i, r),
|
|
3321
|
+
return o += n.slice(i, r), b(e, p.STRING, t, r + 1, o);
|
|
3297
3322
|
if (a === 92) {
|
|
3298
3323
|
o += n.slice(i, r);
|
|
3299
|
-
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ?
|
|
3324
|
+
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Tr(e, r) : Sr(e, r) : _r(e, r);
|
|
3300
3325
|
o += c.value, r += c.size, i = r;
|
|
3301
3326
|
continue;
|
|
3302
3327
|
}
|
|
@@ -3304,10 +3329,10 @@ function mr(e, t) {
|
|
|
3304
3329
|
break;
|
|
3305
3330
|
if (re(a))
|
|
3306
3331
|
++r;
|
|
3307
|
-
else if (
|
|
3332
|
+
else if (Re(n, r))
|
|
3308
3333
|
r += 2;
|
|
3309
3334
|
else
|
|
3310
|
-
throw
|
|
3335
|
+
throw C(
|
|
3311
3336
|
e.source,
|
|
3312
3337
|
r,
|
|
3313
3338
|
`Invalid character within String: ${Q(
|
|
@@ -3316,9 +3341,9 @@ function mr(e, t) {
|
|
|
3316
3341
|
)}.`
|
|
3317
3342
|
);
|
|
3318
3343
|
}
|
|
3319
|
-
throw
|
|
3344
|
+
throw C(e.source, r, "Unterminated string.");
|
|
3320
3345
|
}
|
|
3321
|
-
function
|
|
3346
|
+
function Tr(e, t) {
|
|
3322
3347
|
const n = e.source.body;
|
|
3323
3348
|
let s = 0, r = 3;
|
|
3324
3349
|
for (; r < 12; ) {
|
|
@@ -3334,7 +3359,7 @@ function gr(e, t) {
|
|
|
3334
3359
|
if (s = s << 4 | ae(i), s < 0)
|
|
3335
3360
|
break;
|
|
3336
3361
|
}
|
|
3337
|
-
throw
|
|
3362
|
+
throw C(
|
|
3338
3363
|
e.source,
|
|
3339
3364
|
t,
|
|
3340
3365
|
`Invalid Unicode escape sequence: "${n.slice(
|
|
@@ -3343,22 +3368,22 @@ function gr(e, t) {
|
|
|
3343
3368
|
)}".`
|
|
3344
3369
|
);
|
|
3345
3370
|
}
|
|
3346
|
-
function
|
|
3371
|
+
function Sr(e, t) {
|
|
3347
3372
|
const n = e.source.body, s = Rt(n, t + 2);
|
|
3348
3373
|
if (re(s))
|
|
3349
3374
|
return {
|
|
3350
3375
|
value: String.fromCodePoint(s),
|
|
3351
3376
|
size: 6
|
|
3352
3377
|
};
|
|
3353
|
-
if (
|
|
3378
|
+
if (hn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
3354
3379
|
const r = Rt(n, t + 8);
|
|
3355
|
-
if (
|
|
3380
|
+
if (fn(r))
|
|
3356
3381
|
return {
|
|
3357
3382
|
value: String.fromCodePoint(s, r),
|
|
3358
3383
|
size: 12
|
|
3359
3384
|
};
|
|
3360
3385
|
}
|
|
3361
|
-
throw
|
|
3386
|
+
throw C(
|
|
3362
3387
|
e.source,
|
|
3363
3388
|
t,
|
|
3364
3389
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
@@ -3370,7 +3395,7 @@ function Rt(e, t) {
|
|
|
3370
3395
|
function ae(e) {
|
|
3371
3396
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
3372
3397
|
}
|
|
3373
|
-
function
|
|
3398
|
+
function _r(e, t) {
|
|
3374
3399
|
const n = e.source.body;
|
|
3375
3400
|
switch (n.charCodeAt(t + 1)) {
|
|
3376
3401
|
case 34:
|
|
@@ -3415,7 +3440,7 @@ function vr(e, t) {
|
|
|
3415
3440
|
size: 2
|
|
3416
3441
|
};
|
|
3417
3442
|
}
|
|
3418
|
-
throw
|
|
3443
|
+
throw C(
|
|
3419
3444
|
e.source,
|
|
3420
3445
|
t,
|
|
3421
3446
|
`Invalid character escape sequence: "${n.slice(
|
|
@@ -3424,7 +3449,7 @@ function vr(e, t) {
|
|
|
3424
3449
|
)}".`
|
|
3425
3450
|
);
|
|
3426
3451
|
}
|
|
3427
|
-
function
|
|
3452
|
+
function Ir(e, t) {
|
|
3428
3453
|
const n = e.source.body, s = n.length;
|
|
3429
3454
|
let r = e.lineStart, i = t + 3, o = i, a = "";
|
|
3430
3455
|
const c = [];
|
|
@@ -3432,13 +3457,13 @@ function Tr(e, t) {
|
|
|
3432
3457
|
const u = n.charCodeAt(i);
|
|
3433
3458
|
if (u === 34 && n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34) {
|
|
3434
3459
|
a += n.slice(o, i), c.push(a);
|
|
3435
|
-
const h =
|
|
3460
|
+
const h = b(
|
|
3436
3461
|
e,
|
|
3437
3462
|
p.BLOCK_STRING,
|
|
3438
3463
|
t,
|
|
3439
3464
|
i + 3,
|
|
3440
3465
|
// Return a string of the lines joined with U+000A.
|
|
3441
|
-
|
|
3466
|
+
lr(c).join(`
|
|
3442
3467
|
`)
|
|
3443
3468
|
);
|
|
3444
3469
|
return e.line += c.length - 1, e.lineStart = r, h;
|
|
@@ -3453,10 +3478,10 @@ function Tr(e, t) {
|
|
|
3453
3478
|
}
|
|
3454
3479
|
if (re(u))
|
|
3455
3480
|
++i;
|
|
3456
|
-
else if (
|
|
3481
|
+
else if (Re(n, i))
|
|
3457
3482
|
i += 2;
|
|
3458
3483
|
else
|
|
3459
|
-
throw
|
|
3484
|
+
throw C(
|
|
3460
3485
|
e.source,
|
|
3461
3486
|
i,
|
|
3462
3487
|
`Invalid character within String: ${Q(
|
|
@@ -3465,19 +3490,19 @@ function Tr(e, t) {
|
|
|
3465
3490
|
)}.`
|
|
3466
3491
|
);
|
|
3467
3492
|
}
|
|
3468
|
-
throw
|
|
3493
|
+
throw C(e.source, i, "Unterminated string.");
|
|
3469
3494
|
}
|
|
3470
|
-
function
|
|
3495
|
+
function Ar(e, t) {
|
|
3471
3496
|
const n = e.source.body, s = n.length;
|
|
3472
3497
|
let r = t + 1;
|
|
3473
3498
|
for (; r < s; ) {
|
|
3474
3499
|
const i = n.charCodeAt(r);
|
|
3475
|
-
if (
|
|
3500
|
+
if (dr(i))
|
|
3476
3501
|
++r;
|
|
3477
3502
|
else
|
|
3478
3503
|
break;
|
|
3479
3504
|
}
|
|
3480
|
-
return
|
|
3505
|
+
return b(
|
|
3481
3506
|
e,
|
|
3482
3507
|
p.NAME,
|
|
3483
3508
|
t,
|
|
@@ -3485,56 +3510,56 @@ function _r(e, t) {
|
|
|
3485
3510
|
n.slice(t, r)
|
|
3486
3511
|
);
|
|
3487
3512
|
}
|
|
3488
|
-
const
|
|
3489
|
-
function
|
|
3490
|
-
return
|
|
3513
|
+
const wr = 10, pn = 2;
|
|
3514
|
+
function ft(e) {
|
|
3515
|
+
return qe(e, []);
|
|
3491
3516
|
}
|
|
3492
|
-
function
|
|
3517
|
+
function qe(e, t) {
|
|
3493
3518
|
switch (typeof e) {
|
|
3494
3519
|
case "string":
|
|
3495
3520
|
return JSON.stringify(e);
|
|
3496
3521
|
case "function":
|
|
3497
3522
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
3498
3523
|
case "object":
|
|
3499
|
-
return
|
|
3524
|
+
return xr(e, t);
|
|
3500
3525
|
default:
|
|
3501
3526
|
return String(e);
|
|
3502
3527
|
}
|
|
3503
3528
|
}
|
|
3504
|
-
function
|
|
3529
|
+
function xr(e, t) {
|
|
3505
3530
|
if (e === null)
|
|
3506
3531
|
return "null";
|
|
3507
3532
|
if (t.includes(e))
|
|
3508
3533
|
return "[Circular]";
|
|
3509
3534
|
const n = [...t, e];
|
|
3510
|
-
if (
|
|
3535
|
+
if (br(e)) {
|
|
3511
3536
|
const s = e.toJSON();
|
|
3512
3537
|
if (s !== e)
|
|
3513
|
-
return typeof s == "string" ? s :
|
|
3538
|
+
return typeof s == "string" ? s : qe(s, n);
|
|
3514
3539
|
} else if (Array.isArray(e))
|
|
3515
|
-
return
|
|
3516
|
-
return
|
|
3540
|
+
return Or(e, n);
|
|
3541
|
+
return Cr(e, n);
|
|
3517
3542
|
}
|
|
3518
|
-
function
|
|
3543
|
+
function br(e) {
|
|
3519
3544
|
return typeof e.toJSON == "function";
|
|
3520
3545
|
}
|
|
3521
|
-
function
|
|
3546
|
+
function Cr(e, t) {
|
|
3522
3547
|
const n = Object.entries(e);
|
|
3523
|
-
return n.length === 0 ? "{}" : t.length >
|
|
3524
|
-
([r, i]) => r + ": " +
|
|
3548
|
+
return n.length === 0 ? "{}" : t.length > pn ? "[" + Nr(e) + "]" : "{ " + n.map(
|
|
3549
|
+
([r, i]) => r + ": " + qe(i, t)
|
|
3525
3550
|
).join(", ") + " }";
|
|
3526
3551
|
}
|
|
3527
|
-
function
|
|
3552
|
+
function Or(e, t) {
|
|
3528
3553
|
if (e.length === 0)
|
|
3529
3554
|
return "[]";
|
|
3530
|
-
if (t.length >
|
|
3555
|
+
if (t.length > pn)
|
|
3531
3556
|
return "[Array]";
|
|
3532
|
-
const n = Math.min(
|
|
3557
|
+
const n = Math.min(wr, e.length), s = e.length - n, r = [];
|
|
3533
3558
|
for (let i = 0; i < n; ++i)
|
|
3534
|
-
r.push(
|
|
3559
|
+
r.push(qe(e[i], t));
|
|
3535
3560
|
return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
|
|
3536
3561
|
}
|
|
3537
|
-
function
|
|
3562
|
+
function Nr(e) {
|
|
3538
3563
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
3539
3564
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
3540
3565
|
const n = e.constructor.name;
|
|
@@ -3543,11 +3568,11 @@ function br(e) {
|
|
|
3543
3568
|
}
|
|
3544
3569
|
return t;
|
|
3545
3570
|
}
|
|
3546
|
-
const
|
|
3547
|
-
process.env.NODE_ENV === "production",
|
|
3571
|
+
const kr = globalThis.process && // eslint-disable-next-line no-undef
|
|
3572
|
+
process.env.NODE_ENV === "production", Dr = (
|
|
3548
3573
|
/* c8 ignore next 6 */
|
|
3549
3574
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
3550
|
-
|
|
3575
|
+
kr ? function(t, n) {
|
|
3551
3576
|
return t instanceof n;
|
|
3552
3577
|
} : function(t, n) {
|
|
3553
3578
|
if (t instanceof n)
|
|
@@ -3559,7 +3584,7 @@ process.env.NODE_ENV === "production", Cr = (
|
|
|
3559
3584
|
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (s = t.constructor) === null || s === void 0 ? void 0 : s.name
|
|
3560
3585
|
);
|
|
3561
3586
|
if (r === i) {
|
|
3562
|
-
const o =
|
|
3587
|
+
const o = ft(t);
|
|
3563
3588
|
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
3564
3589
|
|
|
3565
3590
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -3577,15 +3602,15 @@ spurious results.`);
|
|
|
3577
3602
|
return !1;
|
|
3578
3603
|
}
|
|
3579
3604
|
);
|
|
3580
|
-
class
|
|
3605
|
+
class yn {
|
|
3581
3606
|
constructor(t, n = "GraphQL request", s = {
|
|
3582
3607
|
line: 1,
|
|
3583
3608
|
column: 1
|
|
3584
3609
|
}) {
|
|
3585
|
-
typeof t == "string" ||
|
|
3610
|
+
typeof t == "string" || Te(!1, `Body must be a string. Received: ${ft(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || Te(
|
|
3586
3611
|
!1,
|
|
3587
3612
|
"line in locationOffset is 1-indexed and must be positive."
|
|
3588
|
-
), this.locationOffset.column > 0 ||
|
|
3613
|
+
), this.locationOffset.column > 0 || Te(
|
|
3589
3614
|
!1,
|
|
3590
3615
|
"column in locationOffset is 1-indexed and must be positive."
|
|
3591
3616
|
);
|
|
@@ -3594,16 +3619,16 @@ class mn {
|
|
|
3594
3619
|
return "Source";
|
|
3595
3620
|
}
|
|
3596
3621
|
}
|
|
3597
|
-
function
|
|
3598
|
-
return
|
|
3622
|
+
function Rr(e) {
|
|
3623
|
+
return Dr(e, yn);
|
|
3599
3624
|
}
|
|
3600
|
-
function
|
|
3601
|
-
return new
|
|
3625
|
+
function qr(e, t) {
|
|
3626
|
+
return new Mr(e, t).parseDocument();
|
|
3602
3627
|
}
|
|
3603
|
-
class
|
|
3628
|
+
class Mr {
|
|
3604
3629
|
constructor(t, n = {}) {
|
|
3605
|
-
const s =
|
|
3606
|
-
this._lexer = new
|
|
3630
|
+
const s = Rr(t) ? t : new yn(t);
|
|
3631
|
+
this._lexer = new pr(s), this._options = n, this._tokenCounter = 0;
|
|
3607
3632
|
}
|
|
3608
3633
|
/**
|
|
3609
3634
|
* Converts a name lex token into a name parse node.
|
|
@@ -3676,7 +3701,7 @@ class Dr {
|
|
|
3676
3701
|
return this.parseDirectiveDefinition();
|
|
3677
3702
|
}
|
|
3678
3703
|
if (t)
|
|
3679
|
-
throw
|
|
3704
|
+
throw C(
|
|
3680
3705
|
this._lexer.source,
|
|
3681
3706
|
this._lexer.token.start,
|
|
3682
3707
|
"Unexpected description, descriptions are supported only on type definitions."
|
|
@@ -3950,7 +3975,7 @@ class Dr {
|
|
|
3950
3975
|
if (t)
|
|
3951
3976
|
if (this.expectToken(p.DOLLAR), this._lexer.token.kind === p.NAME) {
|
|
3952
3977
|
const s = this._lexer.token.value;
|
|
3953
|
-
throw
|
|
3978
|
+
throw C(
|
|
3954
3979
|
this._lexer.source,
|
|
3955
3980
|
n.start,
|
|
3956
3981
|
`Unexpected variable "$${s}" in constant value.`
|
|
@@ -4297,10 +4322,10 @@ class Dr {
|
|
|
4297
4322
|
*/
|
|
4298
4323
|
parseEnumValueName() {
|
|
4299
4324
|
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
|
|
4300
|
-
throw
|
|
4325
|
+
throw C(
|
|
4301
4326
|
this._lexer.source,
|
|
4302
4327
|
this._lexer.token.start,
|
|
4303
|
-
`${
|
|
4328
|
+
`${Ee(
|
|
4304
4329
|
this._lexer.token
|
|
4305
4330
|
)} is reserved and cannot be used for an enum value.`
|
|
4306
4331
|
);
|
|
@@ -4559,7 +4584,7 @@ class Dr {
|
|
|
4559
4584
|
*/
|
|
4560
4585
|
parseDirectiveLocation() {
|
|
4561
4586
|
const t = this._lexer.token, n = this.parseName();
|
|
4562
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
4587
|
+
if (Object.prototype.hasOwnProperty.call(Ke, n.value))
|
|
4563
4588
|
return n;
|
|
4564
4589
|
throw this.unexpected(t);
|
|
4565
4590
|
}
|
|
@@ -4570,7 +4595,7 @@ class Dr {
|
|
|
4570
4595
|
* given parsed object.
|
|
4571
4596
|
*/
|
|
4572
4597
|
node(t, n) {
|
|
4573
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
4598
|
+
return this._options.noLocation !== !0 && (n.loc = new cr(
|
|
4574
4599
|
t,
|
|
4575
4600
|
this._lexer.lastToken,
|
|
4576
4601
|
this._lexer.source
|
|
@@ -4590,10 +4615,10 @@ class Dr {
|
|
|
4590
4615
|
const n = this._lexer.token;
|
|
4591
4616
|
if (n.kind === t)
|
|
4592
4617
|
return this.advanceLexer(), n;
|
|
4593
|
-
throw
|
|
4618
|
+
throw C(
|
|
4594
4619
|
this._lexer.source,
|
|
4595
4620
|
n.start,
|
|
4596
|
-
`Expected ${
|
|
4621
|
+
`Expected ${mn(t)}, found ${Ee(n)}.`
|
|
4597
4622
|
);
|
|
4598
4623
|
}
|
|
4599
4624
|
/**
|
|
@@ -4612,10 +4637,10 @@ class Dr {
|
|
|
4612
4637
|
if (n.kind === p.NAME && n.value === t)
|
|
4613
4638
|
this.advanceLexer();
|
|
4614
4639
|
else
|
|
4615
|
-
throw
|
|
4640
|
+
throw C(
|
|
4616
4641
|
this._lexer.source,
|
|
4617
4642
|
n.start,
|
|
4618
|
-
`Expected "${t}", found ${
|
|
4643
|
+
`Expected "${t}", found ${Ee(n)}.`
|
|
4619
4644
|
);
|
|
4620
4645
|
}
|
|
4621
4646
|
/**
|
|
@@ -4631,10 +4656,10 @@ class Dr {
|
|
|
4631
4656
|
*/
|
|
4632
4657
|
unexpected(t) {
|
|
4633
4658
|
const n = t ?? this._lexer.token;
|
|
4634
|
-
return
|
|
4659
|
+
return C(
|
|
4635
4660
|
this._lexer.source,
|
|
4636
4661
|
n.start,
|
|
4637
|
-
`Unexpected ${
|
|
4662
|
+
`Unexpected ${Ee(n)}.`
|
|
4638
4663
|
);
|
|
4639
4664
|
}
|
|
4640
4665
|
/**
|
|
@@ -4694,28 +4719,28 @@ class Dr {
|
|
|
4694
4719
|
advanceLexer() {
|
|
4695
4720
|
const { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
4696
4721
|
if (t !== void 0 && n.kind !== p.EOF && (++this._tokenCounter, this._tokenCounter > t))
|
|
4697
|
-
throw
|
|
4722
|
+
throw C(
|
|
4698
4723
|
this._lexer.source,
|
|
4699
4724
|
n.start,
|
|
4700
4725
|
`Document contains more that ${t} tokens. Parsing aborted.`
|
|
4701
4726
|
);
|
|
4702
4727
|
}
|
|
4703
4728
|
}
|
|
4704
|
-
function
|
|
4729
|
+
function Ee(e) {
|
|
4705
4730
|
const t = e.value;
|
|
4706
|
-
return
|
|
4731
|
+
return mn(e.kind) + (t != null ? ` "${t}"` : "");
|
|
4707
4732
|
}
|
|
4708
|
-
function
|
|
4709
|
-
return
|
|
4733
|
+
function mn(e) {
|
|
4734
|
+
return yr(e) ? `"${e}"` : e;
|
|
4710
4735
|
}
|
|
4711
|
-
function
|
|
4712
|
-
return `"${e.replace(
|
|
4736
|
+
function Lr(e) {
|
|
4737
|
+
return `"${e.replace(Ur, Pr)}"`;
|
|
4713
4738
|
}
|
|
4714
|
-
const
|
|
4715
|
-
function
|
|
4716
|
-
return
|
|
4739
|
+
const Ur = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
4740
|
+
function Pr(e) {
|
|
4741
|
+
return Fr[e.charCodeAt(0)];
|
|
4717
4742
|
}
|
|
4718
|
-
const
|
|
4743
|
+
const Fr = [
|
|
4719
4744
|
"\\u0000",
|
|
4720
4745
|
"\\u0001",
|
|
4721
4746
|
"\\u0002",
|
|
@@ -4881,11 +4906,11 @@ const Lr = [
|
|
|
4881
4906
|
"\\u009D",
|
|
4882
4907
|
"\\u009E",
|
|
4883
4908
|
"\\u009F"
|
|
4884
|
-
],
|
|
4885
|
-
function
|
|
4909
|
+
], Br = Object.freeze({});
|
|
4910
|
+
function jr(e, t, n = un) {
|
|
4886
4911
|
const s = /* @__PURE__ */ new Map();
|
|
4887
4912
|
for (const w of Object.values(T))
|
|
4888
|
-
s.set(w,
|
|
4913
|
+
s.set(w, $r(t, w));
|
|
4889
4914
|
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
|
|
4890
4915
|
const f = [], m = [];
|
|
4891
4916
|
do {
|
|
@@ -4896,8 +4921,8 @@ function Ur(e, t, n = dn) {
|
|
|
4896
4921
|
if (i) {
|
|
4897
4922
|
u = u.slice();
|
|
4898
4923
|
let q = 0;
|
|
4899
|
-
for (const [
|
|
4900
|
-
const z =
|
|
4924
|
+
for (const [P, H] of c) {
|
|
4925
|
+
const z = P - q;
|
|
4901
4926
|
H === null ? (u.splice(z, 1), q++) : u[z] = H;
|
|
4902
4927
|
}
|
|
4903
4928
|
} else {
|
|
@@ -4905,8 +4930,8 @@ function Ur(e, t, n = dn) {
|
|
|
4905
4930
|
{},
|
|
4906
4931
|
Object.getOwnPropertyDescriptors(u)
|
|
4907
4932
|
);
|
|
4908
|
-
for (const [q,
|
|
4909
|
-
u[q] =
|
|
4933
|
+
for (const [q, P] of c)
|
|
4934
|
+
u[q] = P;
|
|
4910
4935
|
}
|
|
4911
4936
|
a = r.index, o = r.keys, c = r.edits, i = r.inArray, r = r.prev;
|
|
4912
4937
|
} else if (d) {
|
|
@@ -4917,9 +4942,9 @@ function Ur(e, t, n = dn) {
|
|
|
4917
4942
|
let k;
|
|
4918
4943
|
if (!Array.isArray(u)) {
|
|
4919
4944
|
var y, v;
|
|
4920
|
-
Dt(u) ||
|
|
4945
|
+
Dt(u) || Te(!1, `Invalid AST Node: ${ft(u)}.`);
|
|
4921
4946
|
const q = w ? (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;
|
|
4922
|
-
if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k ===
|
|
4947
|
+
if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === Br)
|
|
4923
4948
|
break;
|
|
4924
4949
|
if (k === !1) {
|
|
4925
4950
|
if (!w) {
|
|
@@ -4937,19 +4962,19 @@ function Ur(e, t, n = dn) {
|
|
|
4937
4962
|
if (k === void 0 && R && c.push([h, u]), w)
|
|
4938
4963
|
f.pop();
|
|
4939
4964
|
else {
|
|
4940
|
-
var
|
|
4965
|
+
var _;
|
|
4941
4966
|
r = {
|
|
4942
4967
|
inArray: i,
|
|
4943
4968
|
index: a,
|
|
4944
4969
|
keys: o,
|
|
4945
4970
|
edits: c,
|
|
4946
4971
|
prev: r
|
|
4947
|
-
}, i = Array.isArray(u), o = i ? u : (
|
|
4972
|
+
}, i = Array.isArray(u), o = i ? u : (_ = n[u.kind]) !== null && _ !== void 0 ? _ : [], a = -1, c = [], d && m.push(d), d = u;
|
|
4948
4973
|
}
|
|
4949
4974
|
} while (r !== void 0);
|
|
4950
4975
|
return c.length !== 0 ? c[c.length - 1][1] : e;
|
|
4951
4976
|
}
|
|
4952
|
-
function
|
|
4977
|
+
function $r(e, t) {
|
|
4953
4978
|
const n = e[t];
|
|
4954
4979
|
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
4955
4980
|
enter: n,
|
|
@@ -4959,10 +4984,10 @@ function Fr(e, t) {
|
|
|
4959
4984
|
leave: e.leave
|
|
4960
4985
|
};
|
|
4961
4986
|
}
|
|
4962
|
-
function
|
|
4963
|
-
return
|
|
4987
|
+
function gn(e) {
|
|
4988
|
+
return jr(e, Hr);
|
|
4964
4989
|
}
|
|
4965
|
-
const
|
|
4990
|
+
const Vr = 80, Hr = {
|
|
4966
4991
|
Name: {
|
|
4967
4992
|
leave: (e) => e.value
|
|
4968
4993
|
},
|
|
@@ -4977,7 +5002,7 @@ const Br = 80, jr = {
|
|
|
4977
5002
|
},
|
|
4978
5003
|
OperationDefinition: {
|
|
4979
5004
|
leave(e) {
|
|
4980
|
-
const t =
|
|
5005
|
+
const t = I("(", E(e.variableDefinitions, ", "), ")"), n = E(
|
|
4981
5006
|
[
|
|
4982
5007
|
e.operation,
|
|
4983
5008
|
E([e.name, t]),
|
|
@@ -4989,17 +5014,17 @@ const Br = 80, jr = {
|
|
|
4989
5014
|
}
|
|
4990
5015
|
},
|
|
4991
5016
|
VariableDefinition: {
|
|
4992
|
-
leave: ({ variable: e, type: t, defaultValue: n, directives: s }) => e + ": " + t +
|
|
5017
|
+
leave: ({ variable: e, type: t, defaultValue: n, directives: s }) => e + ": " + t + I(" = ", n) + I(" ", E(s, " "))
|
|
4993
5018
|
},
|
|
4994
5019
|
SelectionSet: {
|
|
4995
5020
|
leave: ({ selections: e }) => M(e)
|
|
4996
5021
|
},
|
|
4997
5022
|
Field: {
|
|
4998
5023
|
leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
|
|
4999
|
-
const i =
|
|
5000
|
-
let o = i +
|
|
5001
|
-
return o.length >
|
|
5002
|
-
`,
|
|
5024
|
+
const i = I("", e, ": ") + t;
|
|
5025
|
+
let o = i + I("(", E(n, ", "), ")");
|
|
5026
|
+
return o.length > Vr && (o = i + I(`(
|
|
5027
|
+
`, Se(E(n, `
|
|
5003
5028
|
`)), `
|
|
5004
5029
|
)`)), E([o, E(s, " "), r], " ");
|
|
5005
5030
|
}
|
|
@@ -5009,13 +5034,13 @@ const Br = 80, jr = {
|
|
|
5009
5034
|
},
|
|
5010
5035
|
// Fragments
|
|
5011
5036
|
FragmentSpread: {
|
|
5012
|
-
leave: ({ name: e, directives: t }) => "..." + e +
|
|
5037
|
+
leave: ({ name: e, directives: t }) => "..." + e + I(" ", E(t, " "))
|
|
5013
5038
|
},
|
|
5014
5039
|
InlineFragment: {
|
|
5015
5040
|
leave: ({ typeCondition: e, directives: t, selectionSet: n }) => E(
|
|
5016
5041
|
[
|
|
5017
5042
|
"...",
|
|
5018
|
-
|
|
5043
|
+
I("on ", e),
|
|
5019
5044
|
E(t, " "),
|
|
5020
5045
|
n
|
|
5021
5046
|
],
|
|
@@ -5025,7 +5050,7 @@ const Br = 80, jr = {
|
|
|
5025
5050
|
FragmentDefinition: {
|
|
5026
5051
|
leave: ({ name: e, typeCondition: t, variableDefinitions: n, directives: s, selectionSet: r }) => (
|
|
5027
5052
|
// or removed in the future.
|
|
5028
|
-
`fragment ${e}${
|
|
5053
|
+
`fragment ${e}${I("(", E(n, ", "), ")")} on ${t} ${I("", E(s, " "), " ")}` + r
|
|
5029
5054
|
)
|
|
5030
5055
|
},
|
|
5031
5056
|
// Value
|
|
@@ -5036,7 +5061,7 @@ const Br = 80, jr = {
|
|
|
5036
5061
|
leave: ({ value: e }) => e
|
|
5037
5062
|
},
|
|
5038
5063
|
StringValue: {
|
|
5039
|
-
leave: ({ value: e, block: t }) => t ?
|
|
5064
|
+
leave: ({ value: e, block: t }) => t ? fr(e) : Lr(e)
|
|
5040
5065
|
},
|
|
5041
5066
|
BooleanValue: {
|
|
5042
5067
|
leave: ({ value: e }) => e ? "true" : "false"
|
|
@@ -5058,7 +5083,7 @@ const Br = 80, jr = {
|
|
|
5058
5083
|
},
|
|
5059
5084
|
// Directive
|
|
5060
5085
|
Directive: {
|
|
5061
|
-
leave: ({ name: e, arguments: t }) => "@" + e +
|
|
5086
|
+
leave: ({ name: e, arguments: t }) => "@" + e + I("(", E(t, ", "), ")")
|
|
5062
5087
|
},
|
|
5063
5088
|
// Type
|
|
5064
5089
|
NamedType: {
|
|
@@ -5072,23 +5097,23 @@ const Br = 80, jr = {
|
|
|
5072
5097
|
},
|
|
5073
5098
|
// Type System Definitions
|
|
5074
5099
|
SchemaDefinition: {
|
|
5075
|
-
leave: ({ description: e, directives: t, operationTypes: n }) =>
|
|
5100
|
+
leave: ({ description: e, directives: t, operationTypes: n }) => I("", e, `
|
|
5076
5101
|
`) + E(["schema", E(t, " "), M(n)], " ")
|
|
5077
5102
|
},
|
|
5078
5103
|
OperationTypeDefinition: {
|
|
5079
5104
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
5080
5105
|
},
|
|
5081
5106
|
ScalarTypeDefinition: {
|
|
5082
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
5107
|
+
leave: ({ description: e, name: t, directives: n }) => I("", e, `
|
|
5083
5108
|
`) + E(["scalar", t, E(n, " ")], " ")
|
|
5084
5109
|
},
|
|
5085
5110
|
ObjectTypeDefinition: {
|
|
5086
|
-
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) =>
|
|
5111
|
+
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => I("", e, `
|
|
5087
5112
|
`) + E(
|
|
5088
5113
|
[
|
|
5089
5114
|
"type",
|
|
5090
5115
|
t,
|
|
5091
|
-
|
|
5116
|
+
I("implements ", E(n, " & ")),
|
|
5092
5117
|
E(s, " "),
|
|
5093
5118
|
M(r)
|
|
5094
5119
|
],
|
|
@@ -5096,26 +5121,26 @@ const Br = 80, jr = {
|
|
|
5096
5121
|
)
|
|
5097
5122
|
},
|
|
5098
5123
|
FieldDefinition: {
|
|
5099
|
-
leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) =>
|
|
5100
|
-
`) + t + (qt(n) ?
|
|
5101
|
-
`,
|
|
5124
|
+
leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => I("", e, `
|
|
5125
|
+
`) + t + (qt(n) ? I(`(
|
|
5126
|
+
`, Se(E(n, `
|
|
5102
5127
|
`)), `
|
|
5103
|
-
)`) :
|
|
5128
|
+
)`) : I("(", E(n, ", "), ")")) + ": " + s + I(" ", E(r, " "))
|
|
5104
5129
|
},
|
|
5105
5130
|
InputValueDefinition: {
|
|
5106
|
-
leave: ({ description: e, name: t, type: n, defaultValue: s, directives: r }) =>
|
|
5131
|
+
leave: ({ description: e, name: t, type: n, defaultValue: s, directives: r }) => I("", e, `
|
|
5107
5132
|
`) + E(
|
|
5108
|
-
[t + ": " + n,
|
|
5133
|
+
[t + ": " + n, I("= ", s), E(r, " ")],
|
|
5109
5134
|
" "
|
|
5110
5135
|
)
|
|
5111
5136
|
},
|
|
5112
5137
|
InterfaceTypeDefinition: {
|
|
5113
|
-
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) =>
|
|
5138
|
+
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => I("", e, `
|
|
5114
5139
|
`) + E(
|
|
5115
5140
|
[
|
|
5116
5141
|
"interface",
|
|
5117
5142
|
t,
|
|
5118
|
-
|
|
5143
|
+
I("implements ", E(n, " & ")),
|
|
5119
5144
|
E(s, " "),
|
|
5120
5145
|
M(r)
|
|
5121
5146
|
],
|
|
@@ -5123,30 +5148,30 @@ const Br = 80, jr = {
|
|
|
5123
5148
|
)
|
|
5124
5149
|
},
|
|
5125
5150
|
UnionTypeDefinition: {
|
|
5126
|
-
leave: ({ description: e, name: t, directives: n, types: s }) =>
|
|
5151
|
+
leave: ({ description: e, name: t, directives: n, types: s }) => I("", e, `
|
|
5127
5152
|
`) + E(
|
|
5128
|
-
["union", t, E(n, " "),
|
|
5153
|
+
["union", t, E(n, " "), I("= ", E(s, " | "))],
|
|
5129
5154
|
" "
|
|
5130
5155
|
)
|
|
5131
5156
|
},
|
|
5132
5157
|
EnumTypeDefinition: {
|
|
5133
|
-
leave: ({ description: e, name: t, directives: n, values: s }) =>
|
|
5158
|
+
leave: ({ description: e, name: t, directives: n, values: s }) => I("", e, `
|
|
5134
5159
|
`) + E(["enum", t, E(n, " "), M(s)], " ")
|
|
5135
5160
|
},
|
|
5136
5161
|
EnumValueDefinition: {
|
|
5137
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
5162
|
+
leave: ({ description: e, name: t, directives: n }) => I("", e, `
|
|
5138
5163
|
`) + E([t, E(n, " ")], " ")
|
|
5139
5164
|
},
|
|
5140
5165
|
InputObjectTypeDefinition: {
|
|
5141
|
-
leave: ({ description: e, name: t, directives: n, fields: s }) =>
|
|
5166
|
+
leave: ({ description: e, name: t, directives: n, fields: s }) => I("", e, `
|
|
5142
5167
|
`) + E(["input", t, E(n, " "), M(s)], " ")
|
|
5143
5168
|
},
|
|
5144
5169
|
DirectiveDefinition: {
|
|
5145
|
-
leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) =>
|
|
5146
|
-
`) + "directive @" + t + (qt(n) ?
|
|
5147
|
-
`,
|
|
5170
|
+
leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => I("", e, `
|
|
5171
|
+
`) + "directive @" + t + (qt(n) ? I(`(
|
|
5172
|
+
`, Se(E(n, `
|
|
5148
5173
|
`)), `
|
|
5149
|
-
)`) :
|
|
5174
|
+
)`) : I("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
|
|
5150
5175
|
},
|
|
5151
5176
|
SchemaExtension: {
|
|
5152
5177
|
leave: ({ directives: e, operationTypes: t }) => E(
|
|
@@ -5162,7 +5187,7 @@ const Br = 80, jr = {
|
|
|
5162
5187
|
[
|
|
5163
5188
|
"extend type",
|
|
5164
5189
|
e,
|
|
5165
|
-
|
|
5190
|
+
I("implements ", E(t, " & ")),
|
|
5166
5191
|
E(n, " "),
|
|
5167
5192
|
M(s)
|
|
5168
5193
|
],
|
|
@@ -5174,7 +5199,7 @@ const Br = 80, jr = {
|
|
|
5174
5199
|
[
|
|
5175
5200
|
"extend interface",
|
|
5176
5201
|
e,
|
|
5177
|
-
|
|
5202
|
+
I("implements ", E(t, " & ")),
|
|
5178
5203
|
E(n, " "),
|
|
5179
5204
|
M(s)
|
|
5180
5205
|
],
|
|
@@ -5187,7 +5212,7 @@ const Br = 80, jr = {
|
|
|
5187
5212
|
"extend union",
|
|
5188
5213
|
e,
|
|
5189
5214
|
E(t, " "),
|
|
5190
|
-
|
|
5215
|
+
I("= ", E(n, " | "))
|
|
5191
5216
|
],
|
|
5192
5217
|
" "
|
|
5193
5218
|
)
|
|
@@ -5204,16 +5229,16 @@ function E(e, t = "") {
|
|
|
5204
5229
|
return (n = e == null ? void 0 : e.filter((s) => s).join(t)) !== null && n !== void 0 ? n : "";
|
|
5205
5230
|
}
|
|
5206
5231
|
function M(e) {
|
|
5207
|
-
return
|
|
5208
|
-
`,
|
|
5232
|
+
return I(`{
|
|
5233
|
+
`, Se(E(e, `
|
|
5209
5234
|
`)), `
|
|
5210
5235
|
}`);
|
|
5211
5236
|
}
|
|
5212
|
-
function
|
|
5237
|
+
function I(e, t, n = "") {
|
|
5213
5238
|
return t != null && t !== "" ? e + t + n : "";
|
|
5214
5239
|
}
|
|
5215
|
-
function
|
|
5216
|
-
return
|
|
5240
|
+
function Se(e) {
|
|
5241
|
+
return I(" ", e.replace(/\n/g, `
|
|
5217
5242
|
`));
|
|
5218
5243
|
}
|
|
5219
5244
|
function qt(e) {
|
|
@@ -5230,14 +5255,14 @@ const Mt = (e) => {
|
|
|
5230
5255
|
if (typeof e == "string") {
|
|
5231
5256
|
let n;
|
|
5232
5257
|
try {
|
|
5233
|
-
const s =
|
|
5258
|
+
const s = qr(e);
|
|
5234
5259
|
n = Mt(s);
|
|
5235
5260
|
} catch {
|
|
5236
5261
|
}
|
|
5237
5262
|
return { query: e, operationName: n };
|
|
5238
5263
|
}
|
|
5239
5264
|
const t = Mt(e);
|
|
5240
|
-
return { query:
|
|
5265
|
+
return { query: gn(e), operationName: t };
|
|
5241
5266
|
};
|
|
5242
5267
|
class ce extends Error {
|
|
5243
5268
|
constructor(t, n) {
|
|
@@ -5252,13 +5277,13 @@ class ce extends Error {
|
|
|
5252
5277
|
return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
|
|
5253
5278
|
}
|
|
5254
5279
|
}
|
|
5255
|
-
var
|
|
5256
|
-
function
|
|
5280
|
+
var zr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5281
|
+
function Gr(e) {
|
|
5257
5282
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
5258
5283
|
}
|
|
5259
|
-
var
|
|
5284
|
+
var et = { exports: {} };
|
|
5260
5285
|
(function(e, t) {
|
|
5261
|
-
var n = typeof self < "u" ? self :
|
|
5286
|
+
var n = typeof self < "u" ? self : zr, s = function() {
|
|
5262
5287
|
function i() {
|
|
5263
5288
|
this.fetch = !1, this.DOMException = n.DOMException;
|
|
5264
5289
|
}
|
|
@@ -5307,8 +5332,8 @@ var Ze = { exports: {} };
|
|
|
5307
5332
|
function m(l) {
|
|
5308
5333
|
var g = {
|
|
5309
5334
|
next: function() {
|
|
5310
|
-
var
|
|
5311
|
-
return { done:
|
|
5335
|
+
var S = l.shift();
|
|
5336
|
+
return { done: S === void 0, value: S };
|
|
5312
5337
|
}
|
|
5313
5338
|
};
|
|
5314
5339
|
return a.iterable && (g[Symbol.iterator] = function() {
|
|
@@ -5316,8 +5341,8 @@ var Ze = { exports: {} };
|
|
|
5316
5341
|
}), g;
|
|
5317
5342
|
}
|
|
5318
5343
|
function y(l) {
|
|
5319
|
-
this.map = {}, l instanceof y ? l.forEach(function(g,
|
|
5320
|
-
this.append(
|
|
5344
|
+
this.map = {}, l instanceof y ? l.forEach(function(g, S) {
|
|
5345
|
+
this.append(S, g);
|
|
5321
5346
|
}, this) : Array.isArray(l) ? l.forEach(function(g) {
|
|
5322
5347
|
this.append(g[0], g[1]);
|
|
5323
5348
|
}, this) : l && Object.getOwnPropertyNames(l).forEach(function(g) {
|
|
@@ -5326,8 +5351,8 @@ var Ze = { exports: {} };
|
|
|
5326
5351
|
}
|
|
5327
5352
|
y.prototype.append = function(l, g) {
|
|
5328
5353
|
l = d(l), g = f(g);
|
|
5329
|
-
var
|
|
5330
|
-
this.map[l] =
|
|
5354
|
+
var S = this.map[l];
|
|
5355
|
+
this.map[l] = S ? S + ", " + g : g;
|
|
5331
5356
|
}, y.prototype.delete = function(l) {
|
|
5332
5357
|
delete this.map[d(l)];
|
|
5333
5358
|
}, y.prototype.get = function(l) {
|
|
@@ -5337,12 +5362,12 @@ var Ze = { exports: {} };
|
|
|
5337
5362
|
}, y.prototype.set = function(l, g) {
|
|
5338
5363
|
this.map[d(l)] = f(g);
|
|
5339
5364
|
}, y.prototype.forEach = function(l, g) {
|
|
5340
|
-
for (var
|
|
5341
|
-
this.map.hasOwnProperty(
|
|
5365
|
+
for (var S in this.map)
|
|
5366
|
+
this.map.hasOwnProperty(S) && l.call(g, this.map[S], S, this);
|
|
5342
5367
|
}, y.prototype.keys = function() {
|
|
5343
5368
|
var l = [];
|
|
5344
|
-
return this.forEach(function(g,
|
|
5345
|
-
l.push(
|
|
5369
|
+
return this.forEach(function(g, S) {
|
|
5370
|
+
l.push(S);
|
|
5346
5371
|
}), m(l);
|
|
5347
5372
|
}, y.prototype.values = function() {
|
|
5348
5373
|
var l = [];
|
|
@@ -5351,8 +5376,8 @@ var Ze = { exports: {} };
|
|
|
5351
5376
|
}), m(l);
|
|
5352
5377
|
}, y.prototype.entries = function() {
|
|
5353
5378
|
var l = [];
|
|
5354
|
-
return this.forEach(function(g,
|
|
5355
|
-
l.push([
|
|
5379
|
+
return this.forEach(function(g, S) {
|
|
5380
|
+
l.push([S, g]);
|
|
5356
5381
|
}), m(l);
|
|
5357
5382
|
}, a.iterable && (y.prototype[Symbol.iterator] = y.prototype.entries);
|
|
5358
5383
|
function v(l) {
|
|
@@ -5360,27 +5385,27 @@ var Ze = { exports: {} };
|
|
|
5360
5385
|
return Promise.reject(new TypeError("Already read"));
|
|
5361
5386
|
l.bodyUsed = !0;
|
|
5362
5387
|
}
|
|
5363
|
-
function
|
|
5364
|
-
return new Promise(function(g,
|
|
5388
|
+
function _(l) {
|
|
5389
|
+
return new Promise(function(g, S) {
|
|
5365
5390
|
l.onload = function() {
|
|
5366
5391
|
g(l.result);
|
|
5367
5392
|
}, l.onerror = function() {
|
|
5368
|
-
|
|
5393
|
+
S(l.error);
|
|
5369
5394
|
};
|
|
5370
5395
|
});
|
|
5371
5396
|
}
|
|
5372
5397
|
function w(l) {
|
|
5373
|
-
var g = new FileReader(),
|
|
5374
|
-
return g.readAsArrayBuffer(l),
|
|
5398
|
+
var g = new FileReader(), S = _(g);
|
|
5399
|
+
return g.readAsArrayBuffer(l), S;
|
|
5375
5400
|
}
|
|
5376
5401
|
function R(l) {
|
|
5377
|
-
var g = new FileReader(),
|
|
5378
|
-
return g.readAsText(l),
|
|
5402
|
+
var g = new FileReader(), S = _(g);
|
|
5403
|
+
return g.readAsText(l), S;
|
|
5379
5404
|
}
|
|
5380
5405
|
function k(l) {
|
|
5381
|
-
for (var g = new Uint8Array(l),
|
|
5382
|
-
|
|
5383
|
-
return
|
|
5406
|
+
for (var g = new Uint8Array(l), S = new Array(g.length), N = 0; N < g.length; N++)
|
|
5407
|
+
S[N] = String.fromCharCode(g[N]);
|
|
5408
|
+
return S.join("");
|
|
5384
5409
|
}
|
|
5385
5410
|
function q(l) {
|
|
5386
5411
|
if (l.slice)
|
|
@@ -5388,7 +5413,7 @@ var Ze = { exports: {} };
|
|
|
5388
5413
|
var g = new Uint8Array(l.byteLength);
|
|
5389
5414
|
return g.set(new Uint8Array(l)), g.buffer;
|
|
5390
5415
|
}
|
|
5391
|
-
function
|
|
5416
|
+
function P() {
|
|
5392
5417
|
return this.bodyUsed = !1, this._initBody = function(l) {
|
|
5393
5418
|
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 = q(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || h(l)) ? this._bodyArrayBuffer = q(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"));
|
|
5394
5419
|
}, a.blob && (this.blob = function() {
|
|
@@ -5416,7 +5441,7 @@ var Ze = { exports: {} };
|
|
|
5416
5441
|
throw new Error("could not read FormData body as text");
|
|
5417
5442
|
return Promise.resolve(this._bodyText);
|
|
5418
5443
|
}, a.formData && (this.formData = function() {
|
|
5419
|
-
return this.text().then(
|
|
5444
|
+
return this.text().then(pe);
|
|
5420
5445
|
}), this.json = function() {
|
|
5421
5446
|
return this.text().then(JSON.parse);
|
|
5422
5447
|
}, this;
|
|
@@ -5428,116 +5453,116 @@ var Ze = { exports: {} };
|
|
|
5428
5453
|
}
|
|
5429
5454
|
function L(l, g) {
|
|
5430
5455
|
g = g || {};
|
|
5431
|
-
var
|
|
5456
|
+
var S = g.body;
|
|
5432
5457
|
if (l instanceof L) {
|
|
5433
5458
|
if (l.bodyUsed)
|
|
5434
5459
|
throw new TypeError("Already read");
|
|
5435
|
-
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, !
|
|
5460
|
+
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, !S && l._bodyInit != null && (S = l._bodyInit, l.bodyUsed = !0);
|
|
5436
5461
|
} else
|
|
5437
5462
|
this.url = String(l);
|
|
5438
|
-
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = z(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") &&
|
|
5463
|
+
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = z(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && S)
|
|
5439
5464
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
5440
|
-
this._initBody(
|
|
5465
|
+
this._initBody(S);
|
|
5441
5466
|
}
|
|
5442
5467
|
L.prototype.clone = function() {
|
|
5443
5468
|
return new L(this, { body: this._bodyInit });
|
|
5444
5469
|
};
|
|
5445
|
-
function
|
|
5470
|
+
function pe(l) {
|
|
5446
5471
|
var g = new FormData();
|
|
5447
|
-
return l.trim().split("&").forEach(function(
|
|
5448
|
-
if (
|
|
5449
|
-
var
|
|
5450
|
-
g.append(decodeURIComponent(
|
|
5472
|
+
return l.trim().split("&").forEach(function(S) {
|
|
5473
|
+
if (S) {
|
|
5474
|
+
var N = S.split("="), O = N.shift().replace(/\+/g, " "), A = N.join("=").replace(/\+/g, " ");
|
|
5475
|
+
g.append(decodeURIComponent(O), decodeURIComponent(A));
|
|
5451
5476
|
}
|
|
5452
5477
|
}), g;
|
|
5453
5478
|
}
|
|
5454
|
-
function
|
|
5455
|
-
var g = new y(),
|
|
5456
|
-
return
|
|
5457
|
-
var
|
|
5479
|
+
function ye(l) {
|
|
5480
|
+
var g = new y(), S = l.replace(/\r?\n[\t ]+/g, " ");
|
|
5481
|
+
return S.split(/\r?\n/).forEach(function(N) {
|
|
5482
|
+
var O = N.split(":"), A = O.shift().trim();
|
|
5458
5483
|
if (A) {
|
|
5459
|
-
var
|
|
5460
|
-
g.append(A,
|
|
5484
|
+
var me = O.join(":").trim();
|
|
5485
|
+
g.append(A, me);
|
|
5461
5486
|
}
|
|
5462
5487
|
}), g;
|
|
5463
5488
|
}
|
|
5464
|
-
|
|
5465
|
-
function
|
|
5489
|
+
P.call(L.prototype);
|
|
5490
|
+
function U(l, g) {
|
|
5466
5491
|
g || (g = {}), this.type = "default", this.status = g.status === void 0 ? 200 : g.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in g ? g.statusText : "OK", this.headers = new y(g.headers), this.url = g.url || "", this._initBody(l);
|
|
5467
5492
|
}
|
|
5468
|
-
|
|
5469
|
-
return new
|
|
5493
|
+
P.call(U.prototype), U.prototype.clone = function() {
|
|
5494
|
+
return new U(this._bodyInit, {
|
|
5470
5495
|
status: this.status,
|
|
5471
5496
|
statusText: this.statusText,
|
|
5472
5497
|
headers: new y(this.headers),
|
|
5473
5498
|
url: this.url
|
|
5474
5499
|
});
|
|
5475
|
-
},
|
|
5476
|
-
var l = new
|
|
5500
|
+
}, U.error = function() {
|
|
5501
|
+
var l = new U(null, { status: 0, statusText: "" });
|
|
5477
5502
|
return l.type = "error", l;
|
|
5478
5503
|
};
|
|
5479
|
-
var
|
|
5480
|
-
|
|
5481
|
-
if (
|
|
5504
|
+
var _n = [301, 302, 303, 307, 308];
|
|
5505
|
+
U.redirect = function(l, g) {
|
|
5506
|
+
if (_n.indexOf(g) === -1)
|
|
5482
5507
|
throw new RangeError("Invalid status code");
|
|
5483
|
-
return new
|
|
5508
|
+
return new U(null, { status: g, headers: { location: l } });
|
|
5484
5509
|
}, o.DOMException = i.DOMException;
|
|
5485
5510
|
try {
|
|
5486
5511
|
new o.DOMException();
|
|
5487
5512
|
} catch {
|
|
5488
|
-
o.DOMException = function(g,
|
|
5489
|
-
this.message = g, this.name =
|
|
5490
|
-
var
|
|
5491
|
-
this.stack =
|
|
5513
|
+
o.DOMException = function(g, S) {
|
|
5514
|
+
this.message = g, this.name = S;
|
|
5515
|
+
var N = Error(g);
|
|
5516
|
+
this.stack = N.stack;
|
|
5492
5517
|
}, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
|
|
5493
5518
|
}
|
|
5494
5519
|
function Me(l, g) {
|
|
5495
|
-
return new Promise(function(
|
|
5496
|
-
var
|
|
5497
|
-
if (
|
|
5498
|
-
return
|
|
5520
|
+
return new Promise(function(S, N) {
|
|
5521
|
+
var O = new L(l, g);
|
|
5522
|
+
if (O.signal && O.signal.aborted)
|
|
5523
|
+
return N(new o.DOMException("Aborted", "AbortError"));
|
|
5499
5524
|
var A = new XMLHttpRequest();
|
|
5500
|
-
function
|
|
5525
|
+
function me() {
|
|
5501
5526
|
A.abort();
|
|
5502
5527
|
}
|
|
5503
5528
|
A.onload = function() {
|
|
5504
5529
|
var ie = {
|
|
5505
5530
|
status: A.status,
|
|
5506
5531
|
statusText: A.statusText,
|
|
5507
|
-
headers:
|
|
5532
|
+
headers: ye(A.getAllResponseHeaders() || "")
|
|
5508
5533
|
};
|
|
5509
5534
|
ie.url = "responseURL" in A ? A.responseURL : ie.headers.get("X-Request-URL");
|
|
5510
5535
|
var Le = "response" in A ? A.response : A.responseText;
|
|
5511
|
-
|
|
5536
|
+
S(new U(Le, ie));
|
|
5512
5537
|
}, A.onerror = function() {
|
|
5513
|
-
|
|
5538
|
+
N(new TypeError("Network request failed"));
|
|
5514
5539
|
}, A.ontimeout = function() {
|
|
5515
|
-
|
|
5540
|
+
N(new TypeError("Network request failed"));
|
|
5516
5541
|
}, A.onabort = function() {
|
|
5517
|
-
|
|
5518
|
-
}, A.open(
|
|
5542
|
+
N(new o.DOMException("Aborted", "AbortError"));
|
|
5543
|
+
}, 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(ie, Le) {
|
|
5519
5544
|
A.setRequestHeader(Le, ie);
|
|
5520
|
-
}),
|
|
5521
|
-
A.readyState === 4 &&
|
|
5522
|
-
}), A.send(typeof
|
|
5545
|
+
}), O.signal && (O.signal.addEventListener("abort", me), A.onreadystatechange = function() {
|
|
5546
|
+
A.readyState === 4 && O.signal.removeEventListener("abort", me);
|
|
5547
|
+
}), A.send(typeof O._bodyInit > "u" ? null : O._bodyInit);
|
|
5523
5548
|
});
|
|
5524
5549
|
}
|
|
5525
|
-
return Me.polyfill = !0, i.fetch || (i.fetch = Me, i.Headers = y, i.Request = L, i.Response =
|
|
5550
|
+
return Me.polyfill = !0, i.fetch || (i.fetch = Me, i.Headers = y, i.Request = L, i.Response = U), o.Headers = y, o.Request = L, o.Response = U, o.fetch = Me, Object.defineProperty(o, "__esModule", { value: !0 }), o;
|
|
5526
5551
|
})({});
|
|
5527
5552
|
})(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
|
|
5528
5553
|
var r = s;
|
|
5529
5554
|
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;
|
|
5530
|
-
})(
|
|
5531
|
-
var
|
|
5532
|
-
const _e = /* @__PURE__ */
|
|
5555
|
+
})(et, et.exports);
|
|
5556
|
+
var xe = et.exports;
|
|
5557
|
+
const _e = /* @__PURE__ */ Gr(xe), Jr = /* @__PURE__ */ An({
|
|
5533
5558
|
__proto__: null,
|
|
5534
5559
|
default: _e
|
|
5535
|
-
}, [
|
|
5560
|
+
}, [xe]), W = (e) => {
|
|
5536
5561
|
let t = {};
|
|
5537
|
-
return e && (typeof Headers < "u" && e instanceof Headers ||
|
|
5562
|
+
return e && (typeof Headers < "u" && e instanceof Headers || Jr && xe.Headers && e instanceof xe.Headers ? t = Ks(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
|
|
5538
5563
|
n && s !== void 0 && (t[n] = s);
|
|
5539
5564
|
}) : t = e), t;
|
|
5540
|
-
}, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(),
|
|
5565
|
+
}, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Yr = (e) => {
|
|
5541
5566
|
if (!Array.isArray(e.query)) {
|
|
5542
5567
|
const s = e, r = [`query=${encodeURIComponent(Lt(s.query))}`];
|
|
5543
5568
|
return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
|
|
@@ -5549,14 +5574,14 @@ const _e = /* @__PURE__ */ Vr(we), Hr = /* @__PURE__ */ wn({
|
|
|
5549
5574
|
variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
|
|
5550
5575
|
}), s), []);
|
|
5551
5576
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
5552
|
-
},
|
|
5577
|
+
}, Qr = (e) => async (t) => {
|
|
5553
5578
|
const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
|
|
5554
5579
|
let h = "", d;
|
|
5555
|
-
e === "POST" ? (d =
|
|
5580
|
+
e === "POST" ? (d = Xr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = Yr({
|
|
5556
5581
|
query: s,
|
|
5557
5582
|
variables: r,
|
|
5558
5583
|
operationName: i,
|
|
5559
|
-
jsonSerializer: a.jsonSerializer ??
|
|
5584
|
+
jsonSerializer: a.jsonSerializer ?? lt
|
|
5560
5585
|
});
|
|
5561
5586
|
const f = {
|
|
5562
5587
|
method: e,
|
|
@@ -5566,15 +5591,15 @@ const _e = /* @__PURE__ */ Vr(we), Hr = /* @__PURE__ */ wn({
|
|
|
5566
5591
|
};
|
|
5567
5592
|
let m = n, y = f;
|
|
5568
5593
|
if (c) {
|
|
5569
|
-
const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url:
|
|
5570
|
-
m =
|
|
5594
|
+
const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: _, ...w } = v;
|
|
5595
|
+
m = _, y = w;
|
|
5571
5596
|
}
|
|
5572
5597
|
return h && (m = `${m}?${h}`), await o(m, y);
|
|
5573
5598
|
};
|
|
5574
|
-
class
|
|
5599
|
+
class En {
|
|
5575
5600
|
constructor(t, n = {}) {
|
|
5576
5601
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
|
|
5577
|
-
const [r, i, o] = s, a =
|
|
5602
|
+
const [r, i, o] = s, a = er(r, i, o), { headers: c, fetch: u = _e, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
|
|
5578
5603
|
a.signal !== void 0 && (m.signal = a.signal);
|
|
5579
5604
|
const { operationName: v } = je(a.query);
|
|
5580
5605
|
return $e({
|
|
@@ -5590,13 +5615,13 @@ class vn {
|
|
|
5590
5615
|
method: h,
|
|
5591
5616
|
fetchOptions: m,
|
|
5592
5617
|
middleware: d
|
|
5593
|
-
}).then((
|
|
5594
|
-
throw f && f(
|
|
5618
|
+
}).then((_) => (f && f(_), _)).catch((_) => {
|
|
5619
|
+
throw f && f(_), _;
|
|
5595
5620
|
});
|
|
5596
5621
|
};
|
|
5597
5622
|
}
|
|
5598
5623
|
async request(t, ...n) {
|
|
5599
|
-
const [s, r] = n, i =
|
|
5624
|
+
const [s, r] = n, i = Zs(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
|
|
5600
5625
|
i.signal !== void 0 && (d.signal = i.signal);
|
|
5601
5626
|
const { query: m, operationName: y } = je(i.document);
|
|
5602
5627
|
return $e({
|
|
@@ -5618,7 +5643,7 @@ class vn {
|
|
|
5618
5643
|
}
|
|
5619
5644
|
// prettier-ignore
|
|
5620
5645
|
batchRequests(t, n) {
|
|
5621
|
-
const s =
|
|
5646
|
+
const s = tr(t, n), { headers: r, ...i } = this.requestConfig;
|
|
5622
5647
|
s.signal !== void 0 && (i.signal = s.signal);
|
|
5623
5648
|
const o = s.documents.map(({ document: c }) => je(c).query), a = s.documents.map(({ variables: c }) => c);
|
|
5624
5649
|
return $e({
|
|
@@ -5657,7 +5682,7 @@ class vn {
|
|
|
5657
5682
|
}
|
|
5658
5683
|
}
|
|
5659
5684
|
const $e = async (e) => {
|
|
5660
|
-
const { query: t, variables: n, fetchOptions: s } = e, r =
|
|
5685
|
+
const { query: t, variables: n, fetchOptions: s } = e, r = Qr(Ws(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Wr(o, s.jsonSerializer ?? lt), 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";
|
|
5661
5686
|
if (o.ok && u && c) {
|
|
5662
5687
|
const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
|
|
5663
5688
|
return {
|
|
@@ -5676,26 +5701,50 @@ const $e = async (e) => {
|
|
|
5676
5701
|
);
|
|
5677
5702
|
}
|
|
5678
5703
|
};
|
|
5679
|
-
async function
|
|
5680
|
-
const s =
|
|
5681
|
-
return new
|
|
5704
|
+
async function fe(e, t, ...n) {
|
|
5705
|
+
const s = nr(e, t, ...n);
|
|
5706
|
+
return new En(s.url).request({
|
|
5682
5707
|
...s
|
|
5683
5708
|
});
|
|
5684
5709
|
}
|
|
5685
|
-
const
|
|
5686
|
-
const r = s ??
|
|
5710
|
+
const Xr = (e, t, n, s) => {
|
|
5711
|
+
const r = s ?? lt;
|
|
5687
5712
|
if (!Array.isArray(e))
|
|
5688
5713
|
return r.stringify({ query: e, variables: t, operationName: n });
|
|
5689
5714
|
if (typeof t < "u" && !Array.isArray(t))
|
|
5690
5715
|
throw new Error("Cannot create request body with given variable type, array expected");
|
|
5691
5716
|
const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
|
|
5692
5717
|
return r.stringify(i);
|
|
5693
|
-
},
|
|
5718
|
+
}, Wr = async (e, t) => {
|
|
5694
5719
|
let n;
|
|
5695
5720
|
return e.headers.forEach((s, r) => {
|
|
5696
5721
|
r.toLowerCase() === "content-type" && (n = s);
|
|
5697
5722
|
}), 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();
|
|
5698
|
-
}, Ve = (e) => typeof e == "function" ? e() : e,
|
|
5723
|
+
}, Ve = (e) => typeof e == "function" ? e() : e, Kr = $(async ({ input: e }) => {
|
|
5724
|
+
var t, n;
|
|
5725
|
+
if (!e.endpoint || e.endpoint === "")
|
|
5726
|
+
throw new Error("No endpoint provided.");
|
|
5727
|
+
if (!e.document)
|
|
5728
|
+
throw new Error("No request document provided.");
|
|
5729
|
+
if (!e.requestHeaders)
|
|
5730
|
+
throw new Error("No request headers provided.");
|
|
5731
|
+
try {
|
|
5732
|
+
const s = await fe(
|
|
5733
|
+
e.endpoint,
|
|
5734
|
+
e.document,
|
|
5735
|
+
{},
|
|
5736
|
+
e.requestHeaders
|
|
5737
|
+
);
|
|
5738
|
+
if (!((n = (t = s.placeOrder) == null ? void 0 : t.checkoutSuccess) != null && n.id))
|
|
5739
|
+
throw console.log("Could not place order."), new Error("Could not place order.");
|
|
5740
|
+
return {
|
|
5741
|
+
type: "PLACE_ORDER_SUCCESS",
|
|
5742
|
+
successId: s.placeOrder.checkoutSuccess.id
|
|
5743
|
+
};
|
|
5744
|
+
} catch (s) {
|
|
5745
|
+
throw console.log("Request to place order failed."), console.log(s), new Error("Request to place order failed.");
|
|
5746
|
+
}
|
|
5747
|
+
}), Zr = $(async ({ input: e }) => {
|
|
5699
5748
|
var t;
|
|
5700
5749
|
if (!e.endpoint || e.endpoint === "")
|
|
5701
5750
|
throw new Error("No endpoint provided.");
|
|
@@ -5706,7 +5755,7 @@ const Jr = (e, t, n, s) => {
|
|
|
5706
5755
|
if (!e.requestHeaders)
|
|
5707
5756
|
throw new Error("No request headers provided.");
|
|
5708
5757
|
try {
|
|
5709
|
-
const n = await
|
|
5758
|
+
const n = await fe(
|
|
5710
5759
|
e.endpoint,
|
|
5711
5760
|
e.document,
|
|
5712
5761
|
{
|
|
@@ -5727,25 +5776,27 @@ const Jr = (e, t, n, s) => {
|
|
|
5727
5776
|
} catch {
|
|
5728
5777
|
throw console.log("Request to add submit step data failed."), new Error("Request to add submit step data failed.");
|
|
5729
5778
|
}
|
|
5730
|
-
}),
|
|
5779
|
+
}), ei = ({ context: e }) => Object.keys(e.quote).length > 0, Ut = he({
|
|
5731
5780
|
types: {
|
|
5732
5781
|
context: {},
|
|
5733
5782
|
events: {},
|
|
5734
5783
|
input: {}
|
|
5735
5784
|
},
|
|
5736
5785
|
actions: {
|
|
5737
|
-
changeStep:
|
|
5738
|
-
nextStep:
|
|
5739
|
-
|
|
5786
|
+
changeStep: x(Gs),
|
|
5787
|
+
nextStep: x(Js),
|
|
5788
|
+
resetCheckout: x(Ys),
|
|
5789
|
+
updateQuote: x(Qs),
|
|
5790
|
+
updateSuccessId: x(Xs)
|
|
5740
5791
|
},
|
|
5741
|
-
actors: { submitStepData:
|
|
5742
|
-
guards: { quoteExists:
|
|
5792
|
+
actors: { placeOrder: Kr, submitStepData: Zr },
|
|
5793
|
+
guards: { quoteExists: ei }
|
|
5743
5794
|
}).createMachine({
|
|
5744
5795
|
/** @todo do we need to add the view to the id? (e.g. checkout_en-us) */
|
|
5745
5796
|
id: "checkout",
|
|
5746
5797
|
initial: "uninitialized",
|
|
5747
5798
|
context: ({ input: e }) => {
|
|
5748
|
-
var t, n, s, r, i, o, a, c, u, h, d;
|
|
5799
|
+
var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, _, w;
|
|
5749
5800
|
return {
|
|
5750
5801
|
currentStep: ((t = e == null ? void 0 : e.initialContext) == null ? void 0 : t.currentStep) ?? "",
|
|
5751
5802
|
errors: [],
|
|
@@ -5769,6 +5820,7 @@ const Jr = (e, t, n, s) => {
|
|
|
5769
5820
|
// 'paymentMethod',
|
|
5770
5821
|
// 'shippingMethod',
|
|
5771
5822
|
],
|
|
5823
|
+
successId: "",
|
|
5772
5824
|
quote: ((r = e == null ? void 0 : e.initialContext) == null ? void 0 : r.quote) ?? {},
|
|
5773
5825
|
// sync with quote machine
|
|
5774
5826
|
endpoints: {
|
|
@@ -5777,9 +5829,13 @@ const Jr = (e, t, n, s) => {
|
|
|
5777
5829
|
...(i = e == null ? void 0 : e.initialContext) == null ? void 0 : i.endpoints
|
|
5778
5830
|
},
|
|
5779
5831
|
graphql: {
|
|
5832
|
+
placeOrder: {
|
|
5833
|
+
document: ((c = (a = (o = e == null ? void 0 : e.initialContext) == null ? void 0 : o.graphql) == null ? void 0 : a.placeOrder) == null ? void 0 : c.document) ?? "",
|
|
5834
|
+
requestHeaders: ((d = (h = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : h.placeOrder) == null ? void 0 : d.requestHeaders) ?? void 0
|
|
5835
|
+
},
|
|
5780
5836
|
submitStepData: {
|
|
5781
|
-
document: ((
|
|
5782
|
-
requestHeaders: ((
|
|
5837
|
+
document: ((y = (m = (f = e == null ? void 0 : e.initialContext) == null ? void 0 : f.graphql) == null ? void 0 : m.submitStepData) == null ? void 0 : y.document) ?? "",
|
|
5838
|
+
requestHeaders: ((w = (_ = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : _.submitStepData) == null ? void 0 : w.requestHeaders) ?? void 0
|
|
5783
5839
|
}
|
|
5784
5840
|
}
|
|
5785
5841
|
};
|
|
@@ -5814,12 +5870,13 @@ const Jr = (e, t, n, s) => {
|
|
|
5814
5870
|
// always guard to make sure we can show the step we're on
|
|
5815
5871
|
on: {
|
|
5816
5872
|
SUBMIT_STEP_DATA: "submittingStepData",
|
|
5817
|
-
CHANGE_STEP: "changingStep"
|
|
5873
|
+
CHANGE_STEP: "changingStep",
|
|
5874
|
+
PLACE_ORDER: "placingOrder"
|
|
5818
5875
|
}
|
|
5819
5876
|
},
|
|
5820
5877
|
submittingStepData: {
|
|
5821
5878
|
invoke: {
|
|
5822
|
-
input: ({ context: e, event: t }) => (
|
|
5879
|
+
input: ({ context: e, event: t }) => (Qe(t, "SUBMIT_STEP_DATA"), {
|
|
5823
5880
|
// quoteId: context.quote.id,
|
|
5824
5881
|
// locale: context.quote.locale,
|
|
5825
5882
|
endpoint: e.endpoints.client,
|
|
@@ -5850,6 +5907,35 @@ const Jr = (e, t, n, s) => {
|
|
|
5850
5907
|
actions: ["changeStep"],
|
|
5851
5908
|
target: "showStep"
|
|
5852
5909
|
}
|
|
5910
|
+
},
|
|
5911
|
+
placingOrder: {
|
|
5912
|
+
invoke: {
|
|
5913
|
+
input: ({ context: e, event: t }) => (Qe(t, "PLACE_ORDER"), {
|
|
5914
|
+
endpoint: e.endpoints.client,
|
|
5915
|
+
document: e.graphql.placeOrder.document,
|
|
5916
|
+
requestHeaders: e.graphql.placeOrder.requestHeaders
|
|
5917
|
+
}),
|
|
5918
|
+
src: "placeOrder",
|
|
5919
|
+
onDone: [
|
|
5920
|
+
{
|
|
5921
|
+
/**
|
|
5922
|
+
* @todo
|
|
5923
|
+
* how to handle quote and checkout being synced here?
|
|
5924
|
+
*/
|
|
5925
|
+
// actions: ['updateQuote', 'updateCheckout', 'nextStep'],
|
|
5926
|
+
// actions: ['resetCheckout'],
|
|
5927
|
+
actions: ["updateSuccessId"],
|
|
5928
|
+
target: "success"
|
|
5929
|
+
}
|
|
5930
|
+
],
|
|
5931
|
+
onError: {
|
|
5932
|
+
/** @todo add action to emit checkout error */
|
|
5933
|
+
target: "showStep"
|
|
5934
|
+
}
|
|
5935
|
+
}
|
|
5936
|
+
},
|
|
5937
|
+
success: {
|
|
5938
|
+
type: "final"
|
|
5853
5939
|
}
|
|
5854
5940
|
// syncIsLoggedIn: {},
|
|
5855
5941
|
// syncQuote: {},
|
|
@@ -5873,39 +5959,33 @@ const Jr = (e, t, n, s) => {
|
|
|
5873
5959
|
// submittingPaymentMethod: {},
|
|
5874
5960
|
// shippingMethod: {},
|
|
5875
5961
|
// submittingShippingMethod: {},
|
|
5876
|
-
// placingOrder: {},
|
|
5877
5962
|
// orderSuccess: {},
|
|
5878
5963
|
}
|
|
5879
5964
|
// on: {
|
|
5880
5965
|
// SYNC_IS_LOGGED_IN: '.syncIsLoggedIn',
|
|
5881
5966
|
// SYNC_QUOTE: '.syncQuote',
|
|
5882
5967
|
// },
|
|
5883
|
-
}),
|
|
5884
|
-
const e =
|
|
5968
|
+
}), vn = Ce({}), _i = () => {
|
|
5969
|
+
const e = Oe(vn);
|
|
5885
5970
|
if (!e || !e.getSnapshot)
|
|
5886
5971
|
throw new Error("checkoutActor is not properly initialized");
|
|
5887
|
-
const [t, n] =
|
|
5888
|
-
|
|
5972
|
+
const [t, n] = Ne(e.getSnapshot());
|
|
5973
|
+
return ke(() => {
|
|
5889
5974
|
if (!e || !e.getSnapshot) {
|
|
5890
5975
|
console.error("checkoutActor is not properly initialized");
|
|
5891
5976
|
return;
|
|
5892
5977
|
}
|
|
5893
|
-
(() => {
|
|
5894
|
-
n(
|
|
5895
|
-
})();
|
|
5896
|
-
const i = e.subscribe((o) => {
|
|
5897
|
-
n(o);
|
|
5978
|
+
const s = e.subscribe((r) => {
|
|
5979
|
+
n(r);
|
|
5898
5980
|
});
|
|
5899
5981
|
return () => {
|
|
5900
|
-
|
|
5982
|
+
s.unsubscribe();
|
|
5901
5983
|
};
|
|
5902
|
-
}, [e])
|
|
5903
|
-
const s = t.context.currentStep ?? "";
|
|
5904
|
-
return {
|
|
5984
|
+
}, [e]), {
|
|
5905
5985
|
checkoutActor: e,
|
|
5906
|
-
currentStep:
|
|
5986
|
+
currentStep: t.context.currentStep
|
|
5907
5987
|
};
|
|
5908
|
-
},
|
|
5988
|
+
}, Ii = async (e = {
|
|
5909
5989
|
inspect: void 0,
|
|
5910
5990
|
currentStep: "",
|
|
5911
5991
|
steps: [],
|
|
@@ -5914,14 +5994,14 @@ const Jr = (e, t, n, s) => {
|
|
|
5914
5994
|
graphql: {}
|
|
5915
5995
|
}) => typeof window < "u" ? (console.warn(
|
|
5916
5996
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
5917
|
-
),
|
|
5997
|
+
), j(Ut, {
|
|
5918
5998
|
inspect: e.inspect,
|
|
5919
5999
|
input: {
|
|
5920
6000
|
initialContext: {
|
|
5921
6001
|
endpoints: e.endpoints
|
|
5922
6002
|
}
|
|
5923
6003
|
}
|
|
5924
|
-
}).start()) :
|
|
6004
|
+
}).start()) : j(Ut, {
|
|
5925
6005
|
input: {
|
|
5926
6006
|
initialContext: {
|
|
5927
6007
|
currentStep: e.currentStep,
|
|
@@ -5935,13 +6015,13 @@ const Jr = (e, t, n, s) => {
|
|
|
5935
6015
|
},
|
|
5936
6016
|
inspect: e.inspect
|
|
5937
6017
|
}).start();
|
|
5938
|
-
function
|
|
5939
|
-
return /* @__PURE__ */
|
|
6018
|
+
function Ai({ actor: e, children: t }) {
|
|
6019
|
+
return /* @__PURE__ */ be(vn.Provider, { value: e, children: t });
|
|
5940
6020
|
}
|
|
5941
|
-
let
|
|
5942
|
-
const
|
|
6021
|
+
let ti = (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), "");
|
|
6022
|
+
const ni = he({
|
|
5943
6023
|
actors: {
|
|
5944
|
-
tick:
|
|
6024
|
+
tick: Is(
|
|
5945
6025
|
({ sendBack: e, input: t }) => {
|
|
5946
6026
|
const n = setInterval(() => {
|
|
5947
6027
|
e({ type: "TICK" });
|
|
@@ -6006,7 +6086,7 @@ const Kr = he({
|
|
|
6006
6086
|
],
|
|
6007
6087
|
on: {
|
|
6008
6088
|
TICK: {
|
|
6009
|
-
actions:
|
|
6089
|
+
actions: x(({ context: e, event: t }) => t.type !== "TICK" ? e : {
|
|
6010
6090
|
elapsed: e.elapsed + e.interval
|
|
6011
6091
|
})
|
|
6012
6092
|
},
|
|
@@ -6017,9 +6097,9 @@ const Kr = he({
|
|
|
6017
6097
|
type: "final"
|
|
6018
6098
|
}
|
|
6019
6099
|
}
|
|
6020
|
-
}),
|
|
6100
|
+
}), wi = he({
|
|
6021
6101
|
actors: {
|
|
6022
|
-
timer:
|
|
6102
|
+
timer: ni
|
|
6023
6103
|
},
|
|
6024
6104
|
types: {
|
|
6025
6105
|
context: {},
|
|
@@ -6027,10 +6107,10 @@ const Kr = he({
|
|
|
6027
6107
|
input: {}
|
|
6028
6108
|
},
|
|
6029
6109
|
actions: {
|
|
6030
|
-
addItem:
|
|
6110
|
+
addItem: x(({ context: e, event: t }) => {
|
|
6031
6111
|
if (t.type !== "ADD_ITEM")
|
|
6032
6112
|
return e;
|
|
6033
|
-
const n = `notification-${
|
|
6113
|
+
const n = `notification-${ti()}`, s = t.duration ?? e.duration, r = In(t.item, {
|
|
6034
6114
|
duration: s,
|
|
6035
6115
|
id: n,
|
|
6036
6116
|
key: t.item.key ?? n,
|
|
@@ -6045,7 +6125,7 @@ const Kr = he({
|
|
|
6045
6125
|
activeItem: n
|
|
6046
6126
|
};
|
|
6047
6127
|
}),
|
|
6048
|
-
removeItem:
|
|
6128
|
+
removeItem: x(({ context: e, event: t }) => {
|
|
6049
6129
|
if (t.type !== "REMOVE_ITEM" && t.type !== "xstate.done.actor.timer")
|
|
6050
6130
|
return e;
|
|
6051
6131
|
const n = e.items;
|
|
@@ -6110,10 +6190,10 @@ const Kr = he({
|
|
|
6110
6190
|
target: "idle"
|
|
6111
6191
|
},
|
|
6112
6192
|
RESUME_TIMER: {
|
|
6113
|
-
actions:
|
|
6193
|
+
actions: Ct("timer", { type: "RESUME_TIMER" })
|
|
6114
6194
|
},
|
|
6115
6195
|
PAUSE_TIMER: {
|
|
6116
|
-
actions:
|
|
6196
|
+
actions: Ct("timer", { type: "PAUSE_TIMER" })
|
|
6117
6197
|
}
|
|
6118
6198
|
}
|
|
6119
6199
|
},
|
|
@@ -6140,14 +6220,14 @@ const Kr = he({
|
|
|
6140
6220
|
}
|
|
6141
6221
|
}
|
|
6142
6222
|
}
|
|
6143
|
-
}),
|
|
6223
|
+
}), Tn = Ce(
|
|
6144
6224
|
{}
|
|
6145
|
-
),
|
|
6146
|
-
const e =
|
|
6225
|
+
), xi = () => {
|
|
6226
|
+
const e = Oe(Tn);
|
|
6147
6227
|
if (!e || !e.getSnapshot)
|
|
6148
6228
|
throw new Error("toastActor is not properly initialized");
|
|
6149
|
-
const [t, n] =
|
|
6150
|
-
return
|
|
6229
|
+
const [t, n] = Ne(() => e.getSnapshot());
|
|
6230
|
+
return ke(() => {
|
|
6151
6231
|
if (!e || !e.getSnapshot) {
|
|
6152
6232
|
console.error("toastActor is not properly initialized");
|
|
6153
6233
|
return;
|
|
@@ -6163,10 +6243,10 @@ const Kr = he({
|
|
|
6163
6243
|
};
|
|
6164
6244
|
}, [e]), { toastActor: e };
|
|
6165
6245
|
};
|
|
6166
|
-
function
|
|
6167
|
-
return /* @__PURE__ */
|
|
6246
|
+
function bi({ children: e, actor: t }) {
|
|
6247
|
+
return /* @__PURE__ */ be(Tn.Provider, { value: t, children: e });
|
|
6168
6248
|
}
|
|
6169
|
-
function
|
|
6249
|
+
function si({
|
|
6170
6250
|
context: e,
|
|
6171
6251
|
event: t
|
|
6172
6252
|
}) {
|
|
@@ -6178,7 +6258,7 @@ function Zr({
|
|
|
6178
6258
|
itemsAdded: n.output.itemsAdded
|
|
6179
6259
|
};
|
|
6180
6260
|
}
|
|
6181
|
-
function
|
|
6261
|
+
function ri({
|
|
6182
6262
|
event: e
|
|
6183
6263
|
}) {
|
|
6184
6264
|
if (!e.type.includes("xstate.done.actor"))
|
|
@@ -6189,7 +6269,7 @@ function ei({
|
|
|
6189
6269
|
itemsAdded: t.output.itemsAdded
|
|
6190
6270
|
};
|
|
6191
6271
|
}
|
|
6192
|
-
function
|
|
6272
|
+
function ii({
|
|
6193
6273
|
event: e
|
|
6194
6274
|
}) {
|
|
6195
6275
|
if (!e.type.includes("xstate.done.actor"))
|
|
@@ -6200,7 +6280,7 @@ function ti({
|
|
|
6200
6280
|
itemsRemoved: t.output.itemsRemoved
|
|
6201
6281
|
};
|
|
6202
6282
|
}
|
|
6203
|
-
function
|
|
6283
|
+
function oi({
|
|
6204
6284
|
event: e
|
|
6205
6285
|
}) {
|
|
6206
6286
|
if (!e.type.includes("xstate.done.actor"))
|
|
@@ -6217,7 +6297,7 @@ function ni({
|
|
|
6217
6297
|
itemsUpdated: t.output.itemsUpdated
|
|
6218
6298
|
};
|
|
6219
6299
|
}
|
|
6220
|
-
function
|
|
6300
|
+
function ai({
|
|
6221
6301
|
context: e,
|
|
6222
6302
|
event: t
|
|
6223
6303
|
}) {
|
|
@@ -6229,7 +6309,7 @@ function si({
|
|
|
6229
6309
|
itemsRemoved: n.output.itemsRemoved
|
|
6230
6310
|
};
|
|
6231
6311
|
}
|
|
6232
|
-
function
|
|
6312
|
+
function ci({
|
|
6233
6313
|
context: e,
|
|
6234
6314
|
event: t
|
|
6235
6315
|
}) {
|
|
@@ -6240,7 +6320,51 @@ function ri({
|
|
|
6240
6320
|
quote: { ...e.quote, ...n.output.quote }
|
|
6241
6321
|
};
|
|
6242
6322
|
}
|
|
6243
|
-
function
|
|
6323
|
+
function ui({
|
|
6324
|
+
context: e,
|
|
6325
|
+
event: t
|
|
6326
|
+
}) {
|
|
6327
|
+
const n = t;
|
|
6328
|
+
if (n.type !== "RESET")
|
|
6329
|
+
return e;
|
|
6330
|
+
const { locale: s } = n.data;
|
|
6331
|
+
return {
|
|
6332
|
+
quote: {
|
|
6333
|
+
id: "",
|
|
6334
|
+
locale: s,
|
|
6335
|
+
baseCurrency: "USD",
|
|
6336
|
+
currencyConversionRate: 1,
|
|
6337
|
+
dateCreated: null,
|
|
6338
|
+
dateLastUpdated: null,
|
|
6339
|
+
currency: "USD",
|
|
6340
|
+
items: [],
|
|
6341
|
+
promotions: [],
|
|
6342
|
+
shippingAddresses: {
|
|
6343
|
+
available: [],
|
|
6344
|
+
applied: []
|
|
6345
|
+
},
|
|
6346
|
+
paymentMethods: {
|
|
6347
|
+
available: [],
|
|
6348
|
+
applied: []
|
|
6349
|
+
},
|
|
6350
|
+
totals: {
|
|
6351
|
+
discount: 0,
|
|
6352
|
+
taxAmount: 0,
|
|
6353
|
+
shippingAmount: 0,
|
|
6354
|
+
shippingTaxAmount: 0,
|
|
6355
|
+
subtotal: 0,
|
|
6356
|
+
grandTotal: 0
|
|
6357
|
+
},
|
|
6358
|
+
appliedPriceRules: [],
|
|
6359
|
+
appliedPromotions: [],
|
|
6360
|
+
shippingMethods: [],
|
|
6361
|
+
storeCredit: [],
|
|
6362
|
+
rewards: [],
|
|
6363
|
+
giftCards: []
|
|
6364
|
+
}
|
|
6365
|
+
};
|
|
6366
|
+
}
|
|
6367
|
+
function di({
|
|
6244
6368
|
context: e,
|
|
6245
6369
|
event: t
|
|
6246
6370
|
}) {
|
|
@@ -6252,7 +6376,7 @@ function ii({
|
|
|
6252
6376
|
itemsUpdated: n.output.itemsUpdated
|
|
6253
6377
|
};
|
|
6254
6378
|
}
|
|
6255
|
-
const
|
|
6379
|
+
const li = $(
|
|
6256
6380
|
async ({ input: e }) => {
|
|
6257
6381
|
var t;
|
|
6258
6382
|
if (!e.endpoint || e.endpoint === "")
|
|
@@ -6264,7 +6388,7 @@ const oi = V(
|
|
|
6264
6388
|
if (!e.requestHeaders)
|
|
6265
6389
|
throw new Error("No request headers provided.");
|
|
6266
6390
|
try {
|
|
6267
|
-
const n = await
|
|
6391
|
+
const n = await fe(
|
|
6268
6392
|
e.endpoint,
|
|
6269
6393
|
e.document,
|
|
6270
6394
|
{ items: e.items },
|
|
@@ -6281,14 +6405,14 @@ const oi = V(
|
|
|
6281
6405
|
throw new Error("Request to add item(s) failed.");
|
|
6282
6406
|
}
|
|
6283
6407
|
}
|
|
6284
|
-
),
|
|
6408
|
+
), hi = $(async ({ input: e }) => {
|
|
6285
6409
|
var t;
|
|
6286
6410
|
if (!e.endpoint || e.endpoint === "")
|
|
6287
6411
|
throw new Error("No endpoint provided.");
|
|
6288
6412
|
if (e.items.length < 1)
|
|
6289
6413
|
throw new Error("No items provided.");
|
|
6290
6414
|
try {
|
|
6291
|
-
const n = await
|
|
6415
|
+
const n = await fe(
|
|
6292
6416
|
e.endpoint,
|
|
6293
6417
|
""
|
|
6294
6418
|
// input.document,
|
|
@@ -6305,7 +6429,7 @@ const oi = V(
|
|
|
6305
6429
|
} catch {
|
|
6306
6430
|
throw new Error("Request to remove item(s) failed.");
|
|
6307
6431
|
}
|
|
6308
|
-
}), He = typeof window > "u",
|
|
6432
|
+
}), He = typeof window > "u", fi = $(
|
|
6309
6433
|
async ({ input: e }) => {
|
|
6310
6434
|
var n, s, r, i;
|
|
6311
6435
|
if (!e.endpoint)
|
|
@@ -6318,7 +6442,7 @@ const oi = V(
|
|
|
6318
6442
|
throw console.log("no request document"), new Error("No request document provided.");
|
|
6319
6443
|
if (!e.requestHeaders)
|
|
6320
6444
|
throw console.log("no headers"), new Error("No request headers provided.");
|
|
6321
|
-
const t = new
|
|
6445
|
+
const t = new En(
|
|
6322
6446
|
He ? e.endpointSsr : e.endpoint,
|
|
6323
6447
|
He ? { fetch, method: "POST" } : {
|
|
6324
6448
|
credentials: "include",
|
|
@@ -6328,7 +6452,7 @@ const oi = V(
|
|
|
6328
6452
|
);
|
|
6329
6453
|
try {
|
|
6330
6454
|
const { data: o, headers: a, status: c, errors: u, extensions: h } = await t.rawRequest(
|
|
6331
|
-
|
|
6455
|
+
gn(e.document),
|
|
6332
6456
|
{},
|
|
6333
6457
|
He ? {
|
|
6334
6458
|
...e.requestHeaders,
|
|
@@ -6347,7 +6471,7 @@ const oi = V(
|
|
|
6347
6471
|
throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
|
|
6348
6472
|
}
|
|
6349
6473
|
}
|
|
6350
|
-
),
|
|
6474
|
+
), pi = $(async ({ input: e }) => {
|
|
6351
6475
|
var t;
|
|
6352
6476
|
if (!e.endpoint || e.endpoint === "")
|
|
6353
6477
|
throw new Error("No endpoint provided.");
|
|
@@ -6358,7 +6482,7 @@ const oi = V(
|
|
|
6358
6482
|
if (!e.requestHeaders)
|
|
6359
6483
|
throw new Error("No request headers provided.");
|
|
6360
6484
|
try {
|
|
6361
|
-
const n = await
|
|
6485
|
+
const n = await fe(
|
|
6362
6486
|
e.endpoint,
|
|
6363
6487
|
e.document,
|
|
6364
6488
|
{ items: e.items },
|
|
@@ -6374,7 +6498,7 @@ const oi = V(
|
|
|
6374
6498
|
} catch {
|
|
6375
6499
|
throw new Error("Request to add item(s) failed.");
|
|
6376
6500
|
}
|
|
6377
|
-
}),
|
|
6501
|
+
}), yi = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", mi = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Pt = he({
|
|
6378
6502
|
types: {
|
|
6379
6503
|
context: {},
|
|
6380
6504
|
emitted: {},
|
|
@@ -6382,30 +6506,31 @@ const oi = V(
|
|
|
6382
6506
|
input: {}
|
|
6383
6507
|
},
|
|
6384
6508
|
actions: {
|
|
6385
|
-
addItems:
|
|
6386
|
-
notifyAddItems: Fe(
|
|
6387
|
-
notifyRemoveItems: Fe(
|
|
6388
|
-
notifyUpdateItems: Fe(
|
|
6389
|
-
removeItems:
|
|
6390
|
-
refresh:
|
|
6391
|
-
|
|
6509
|
+
addItems: x(si),
|
|
6510
|
+
notifyAddItems: Fe(ri),
|
|
6511
|
+
notifyRemoveItems: Fe(ii),
|
|
6512
|
+
notifyUpdateItems: Fe(oi),
|
|
6513
|
+
removeItems: x(ai),
|
|
6514
|
+
refresh: x(ci),
|
|
6515
|
+
reset: x(ui),
|
|
6516
|
+
updateItems: x(di)
|
|
6392
6517
|
},
|
|
6393
6518
|
actors: {
|
|
6394
|
-
addItems:
|
|
6395
|
-
removeItems:
|
|
6396
|
-
refresh:
|
|
6397
|
-
updateItems:
|
|
6519
|
+
addItems: li,
|
|
6520
|
+
removeItems: hi,
|
|
6521
|
+
refresh: fi,
|
|
6522
|
+
updateItems: pi
|
|
6398
6523
|
},
|
|
6399
6524
|
guards: {
|
|
6400
|
-
canRefresh:
|
|
6401
|
-
hasItems:
|
|
6525
|
+
canRefresh: yi,
|
|
6526
|
+
hasItems: mi
|
|
6402
6527
|
}
|
|
6403
6528
|
}).createMachine({
|
|
6404
6529
|
/** @todo do we need to add the view to the id? (e.g. quote_en-us) */
|
|
6405
6530
|
id: "quote",
|
|
6406
6531
|
initial: "initializing",
|
|
6407
6532
|
context: ({ input: e }) => {
|
|
6408
|
-
var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v,
|
|
6533
|
+
var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, _, w, R, k, q, P, H, z, L, pe, ye;
|
|
6409
6534
|
return {
|
|
6410
6535
|
quote: {
|
|
6411
6536
|
id: "",
|
|
@@ -6476,12 +6601,12 @@ const oi = V(
|
|
|
6476
6601
|
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
|
|
6477
6602
|
},
|
|
6478
6603
|
removeItems: {
|
|
6479
|
-
document: ((w = (
|
|
6604
|
+
document: ((w = (_ = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : _.removeItems) == null ? void 0 : w.document) ?? "",
|
|
6480
6605
|
requestHeaders: ((q = (k = (R = e == null ? void 0 : e.initialContext) == null ? void 0 : R.graphql) == null ? void 0 : k.removeItems) == null ? void 0 : q.requestHeaders) ?? void 0
|
|
6481
6606
|
},
|
|
6482
6607
|
updateItems: {
|
|
6483
|
-
document: ((z = (H = (
|
|
6484
|
-
requestHeaders: ((
|
|
6608
|
+
document: ((z = (H = (P = e == null ? void 0 : e.initialContext) == null ? void 0 : P.graphql) == null ? void 0 : H.updateItems) == null ? void 0 : z.document) ?? "",
|
|
6609
|
+
requestHeaders: ((ye = (pe = (L = e == null ? void 0 : e.initialContext) == null ? void 0 : L.graphql) == null ? void 0 : pe.updateItems) == null ? void 0 : ye.requestHeaders) ?? void 0
|
|
6485
6610
|
}
|
|
6486
6611
|
}
|
|
6487
6612
|
};
|
|
@@ -6512,7 +6637,8 @@ const oi = V(
|
|
|
6512
6637
|
ADD_ITEMS: "addingItems",
|
|
6513
6638
|
REMOVE_ITEMS: "removingItems",
|
|
6514
6639
|
REFRESH: "refreshing",
|
|
6515
|
-
UPDATE_ITEMS: "updatingItems"
|
|
6640
|
+
UPDATE_ITEMS: "updatingItems",
|
|
6641
|
+
RESET: "resetting"
|
|
6516
6642
|
// CLEAR_ITEMS: 'clearing',
|
|
6517
6643
|
// APPLY_PROMOTION: 'applyingPromotion',
|
|
6518
6644
|
// REMOVE_PROMOTION: 'removingPromotion',
|
|
@@ -6690,6 +6816,17 @@ const oi = V(
|
|
|
6690
6816
|
}
|
|
6691
6817
|
]
|
|
6692
6818
|
}
|
|
6819
|
+
},
|
|
6820
|
+
/**
|
|
6821
|
+
* Reset quote to empty state, usually after order is placed
|
|
6822
|
+
*/
|
|
6823
|
+
resetting: {
|
|
6824
|
+
always: [
|
|
6825
|
+
{
|
|
6826
|
+
actions: ["reset"],
|
|
6827
|
+
target: "uninitialized"
|
|
6828
|
+
}
|
|
6829
|
+
]
|
|
6693
6830
|
}
|
|
6694
6831
|
// invoke: {
|
|
6695
6832
|
// /** @todo is there any way to limit the event to be a known event? */
|
|
@@ -6751,15 +6888,15 @@ const oi = V(
|
|
|
6751
6888
|
// removingGiftCard: {},
|
|
6752
6889
|
// applyingSettings: {},
|
|
6753
6890
|
}
|
|
6754
|
-
}), Sn =
|
|
6891
|
+
}), Sn = Ce(
|
|
6755
6892
|
{}
|
|
6756
|
-
),
|
|
6893
|
+
), Ci = () => {
|
|
6757
6894
|
var c;
|
|
6758
|
-
const e =
|
|
6895
|
+
const e = Oe(Sn);
|
|
6759
6896
|
if (!e || !e.getSnapshot)
|
|
6760
6897
|
throw new Error("quoteActor is not properly initialized");
|
|
6761
|
-
const [t, n] =
|
|
6762
|
-
|
|
6898
|
+
const [t, n] = Ne(() => e.getSnapshot());
|
|
6899
|
+
ke(() => {
|
|
6763
6900
|
if (!e || !e.getSnapshot) {
|
|
6764
6901
|
console.error("quoteActor is not properly initialized");
|
|
6765
6902
|
return;
|
|
@@ -6783,21 +6920,21 @@ const oi = V(
|
|
|
6783
6920
|
isRemovingItems: o,
|
|
6784
6921
|
isUpdatingItems: a
|
|
6785
6922
|
};
|
|
6786
|
-
},
|
|
6923
|
+
}, Oi = async (e = {
|
|
6787
6924
|
inspect: void 0,
|
|
6788
6925
|
quote: { id: "", locale: "" },
|
|
6789
6926
|
endpoints: { client: "", server: "" },
|
|
6790
6927
|
graphql: {}
|
|
6791
6928
|
}) => typeof window < "u" ? (console.warn(
|
|
6792
6929
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
6793
|
-
),
|
|
6930
|
+
), j(Pt, {
|
|
6794
6931
|
inspect: e.inspect,
|
|
6795
6932
|
input: {
|
|
6796
6933
|
initialContext: {
|
|
6797
6934
|
endpoints: e.endpoints
|
|
6798
6935
|
}
|
|
6799
6936
|
}
|
|
6800
|
-
}).start()) :
|
|
6937
|
+
}).start()) : j(Pt, {
|
|
6801
6938
|
input: {
|
|
6802
6939
|
initialContext: {
|
|
6803
6940
|
endpoints: e.endpoints,
|
|
@@ -6810,28 +6947,28 @@ const oi = V(
|
|
|
6810
6947
|
},
|
|
6811
6948
|
inspect: e.inspect
|
|
6812
6949
|
}).start();
|
|
6813
|
-
function
|
|
6814
|
-
return /* @__PURE__ */
|
|
6950
|
+
function Ni({ actor: e, children: t }) {
|
|
6951
|
+
return /* @__PURE__ */ be(Sn.Provider, { value: e, children: t });
|
|
6815
6952
|
}
|
|
6816
6953
|
export {
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6954
|
+
on as AuthContext,
|
|
6955
|
+
Si as AuthProvider,
|
|
6956
|
+
vn as CheckoutContext,
|
|
6957
|
+
Ai as CheckoutProvider,
|
|
6821
6958
|
Sn as QuoteContext,
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6959
|
+
Ni as QuoteProvider,
|
|
6960
|
+
Tn as ToastContext,
|
|
6961
|
+
bi as ToastProvider,
|
|
6962
|
+
zs as authMachine,
|
|
6963
|
+
Ut as checkoutMachine,
|
|
6964
|
+
Ti as getAuth,
|
|
6965
|
+
Ii as getCheckout,
|
|
6966
|
+
Oi as getQuote,
|
|
6967
|
+
Pt as quoteMachine,
|
|
6968
|
+
ni as timerMachine,
|
|
6969
|
+
wi as toastMachine,
|
|
6970
|
+
vi as useAuth,
|
|
6971
|
+
_i as useCheckout,
|
|
6972
|
+
Ci as useQuote,
|
|
6973
|
+
xi as useToast
|
|
6837
6974
|
};
|