@clicktap/state 0.13.19 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/AuthProvider.d.ts +88 -184
- package/auth/actions/addError.d.ts +8 -0
- package/auth/actions/clearErrors.d.ts +5 -0
- package/auth/actions/index.d.ts +7 -0
- package/auth/actions/setAccessToken.d.ts +9 -0
- package/auth/actions/setIgnoreRefreshToken.d.ts +4 -0
- package/auth/actions/setUserContext.d.ts +9 -0
- package/auth/actions/unsetRefreshToken.d.ts +4 -0
- package/auth/actions/unsetUserContext.d.ts +8 -0
- package/auth/actors/authenticate.d.ts +16 -0
- package/auth/actors/index.d.ts +3 -0
- package/auth/actors/refreshAccessToken.d.ts +18 -0
- package/auth/actors/unauthenticate.d.ts +14 -0
- package/auth/auth.d.ts +45 -130
- package/auth/types.d.ts +42 -0
- package/helpers/request.d.ts +2 -0
- package/index.d.ts +2 -0
- package/index.js +33 -33
- package/index.mjs +1479 -1210
- package/package.json +2 -3
- package/quote/CheckoutProvider.d.ts +117 -0
- package/quote/QuoteProvider.d.ts +98 -97
- package/quote/checkout/actions/index.d.ts +1 -0
- package/quote/checkout/actions/nextStep.d.ts +8 -0
- package/quote/checkout/actors/index.d.ts +1 -0
- package/quote/checkout/actors/submitStepData.d.ts +19 -0
- package/quote/checkout/guards/index.d.ts +1 -0
- package/quote/checkout/guards/quoteExists.d.ts +10 -0
- package/quote/checkout/types.d.ts +36 -0
- package/quote/checkout.d.ts +32 -0
- package/quote/quote/actions/addItems.d.ts +211 -0
- package/quote/quote/actions/refresh.d.ts +210 -0
- package/quote/quote/actions/removeItems.d.ts +211 -0
- package/quote/quote/actions/updateItems.d.ts +211 -0
- package/quote/quote/types.d.ts +263 -0
- package/quote/quote.d.ts +34 -33
- package/quote/types.d.ts +1 -180
- package/toast/ToastProvider.d.ts +5 -81
- package/quote/actions/addItems.d.ts +0 -91
- package/quote/actions/refresh.d.ts +0 -90
- package/quote/actions/removeItems.d.ts +0 -91
- package/quote/actions/updateItems.d.ts +0 -91
- /package/quote/{actions → quote/actions}/index.d.ts +0 -0
- /package/quote/{actions → quote/actions}/notifyAddItems.d.ts +0 -0
- /package/quote/{actions → quote/actions}/notifyRemoveItems.d.ts +0 -0
- /package/quote/{actions → quote/actions}/notifyUpdateItems.d.ts +0 -0
- /package/quote/{actors → quote/actors}/addItems.d.ts +0 -0
- /package/quote/{actors → quote/actors}/index.d.ts +0 -0
- /package/quote/{actors → quote/actors}/refresh.d.ts +0 -0
- /package/quote/{actors → quote/actors}/removeItems.d.ts +0 -0
- /package/quote/{actors → quote/actors}/updateItems.d.ts +0 -0
- /package/quote/{guards → quote/guards}/canRefresh.d.ts +0 -0
- /package/quote/{guards → quote/guards}/hasItems.d.ts +0 -0
- /package/quote/{guards → quote/guards}/index.d.ts +0 -0
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
function
|
|
1
|
+
import { jsx as we } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as be, useContext as Ne, useState as Ke, useEffect as Ze, cloneElement as An } from "react";
|
|
3
|
+
function xn(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 In(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 Sn() {
|
|
|
26
26
|
if (typeof global < "u")
|
|
27
27
|
return global;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const e =
|
|
29
|
+
function bn() {
|
|
30
|
+
const e = wn();
|
|
31
31
|
if (e.__xstate__)
|
|
32
32
|
return e.__xstate__;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const Nn = (e) => {
|
|
35
35
|
if (typeof window > "u")
|
|
36
36
|
return;
|
|
37
|
-
const t =
|
|
37
|
+
const t = bn();
|
|
38
38
|
t && t.register(e);
|
|
39
39
|
};
|
|
40
|
-
class
|
|
40
|
+
class ft {
|
|
41
41
|
constructor(t) {
|
|
42
42
|
this._process = t, this._active = !1, this._current = null, this._last = null;
|
|
43
43
|
}
|
|
@@ -66,60 +66,60 @@ class lt {
|
|
|
66
66
|
this._last = null;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
function
|
|
69
|
+
const Ft = ".", On = "", Bt = "", Cn = "#", kn = "*", jt = "xstate.init", Dn = "xstate.error", ue = "xstate.stop";
|
|
70
|
+
function Rn(e, t) {
|
|
71
71
|
return {
|
|
72
72
|
type: `xstate.after.${e}.${t}`
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Ve(e, t) {
|
|
76
76
|
return {
|
|
77
77
|
type: `xstate.done.state.${e}`,
|
|
78
78
|
output: t
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function qn(e, t) {
|
|
82
82
|
return {
|
|
83
83
|
type: `xstate.done.actor.${e}`,
|
|
84
84
|
output: t
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function $t(e, t) {
|
|
88
88
|
return {
|
|
89
89
|
type: `xstate.error.actor.${e}`,
|
|
90
90
|
error: t
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Vt(e) {
|
|
94
94
|
return {
|
|
95
|
-
type:
|
|
95
|
+
type: jt,
|
|
96
96
|
input: e
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function B(e) {
|
|
100
100
|
setTimeout(() => {
|
|
101
101
|
throw e;
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
104
|
+
const Mn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
|
|
105
|
+
function pt(e, t) {
|
|
106
106
|
return `${e.sessionId}.${t}`;
|
|
107
107
|
}
|
|
108
|
-
let
|
|
109
|
-
function
|
|
108
|
+
let Ln = 0;
|
|
109
|
+
function Pn(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, I = Math.random().toString(36).slice(2)) => {
|
|
115
115
|
const x = {
|
|
116
116
|
source: f,
|
|
117
117
|
target: m,
|
|
118
118
|
event: y,
|
|
119
119
|
delay: v,
|
|
120
|
-
id:
|
|
120
|
+
id: I,
|
|
121
121
|
startedAt: Date.now()
|
|
122
|
-
}, R =
|
|
122
|
+
}, R = pt(f, I);
|
|
123
123
|
d._snapshot._scheduledEvents[R] = x;
|
|
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 Mn(e, t) {
|
|
|
127
127
|
o[R] = k;
|
|
128
128
|
},
|
|
129
129
|
cancel: (f, m) => {
|
|
130
|
-
const y =
|
|
130
|
+
const y = pt(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 Mn(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:${Ln++}`,
|
|
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 Mn(e, t) {
|
|
|
190
190
|
const {
|
|
191
191
|
source: y,
|
|
192
192
|
target: v,
|
|
193
|
-
event:
|
|
193
|
+
event: I,
|
|
194
194
|
delay: x,
|
|
195
195
|
id: R
|
|
196
196
|
} = f[m];
|
|
197
|
-
u.schedule(y, v,
|
|
197
|
+
u.schedule(y, v, I, x, R);
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
_clock: a,
|
|
@@ -202,11 +202,11 @@ function Mn(e, t) {
|
|
|
202
202
|
};
|
|
203
203
|
return d;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const n =
|
|
207
|
-
return typeof s == "string" ? typeof n == "string" ? s === n : !1 : typeof n == "string" ? n in s : Object.keys(n).every((r) => r in s ?
|
|
205
|
+
function Ht(e, t) {
|
|
206
|
+
const n = yt(e), s = yt(t);
|
|
207
|
+
return typeof s == "string" ? typeof n == "string" ? s === n : !1 : typeof n == "string" ? n in s : Object.keys(n).every((r) => r in s ? Ht(n[r], s[r]) : !1);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function et(e) {
|
|
210
210
|
if (Gt(e))
|
|
211
211
|
return e;
|
|
212
212
|
let t = [], n = "";
|
|
@@ -223,15 +223,15 @@ function We(e) {
|
|
|
223
223
|
}
|
|
224
224
|
return t.push(n), t;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
if (
|
|
226
|
+
function yt(e) {
|
|
227
|
+
if (ps(e))
|
|
228
228
|
return e.value;
|
|
229
229
|
if (typeof e != "string")
|
|
230
230
|
return e;
|
|
231
|
-
const t =
|
|
232
|
-
return
|
|
231
|
+
const t = et(e);
|
|
232
|
+
return Un(t);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function Un(e) {
|
|
235
235
|
if (e.length === 1)
|
|
236
236
|
return e[0];
|
|
237
237
|
const t = {};
|
|
@@ -245,7 +245,7 @@ function qn(e) {
|
|
|
245
245
|
}
|
|
246
246
|
return t;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function mt(e, t) {
|
|
249
249
|
const n = {}, s = Object.keys(e);
|
|
250
250
|
for (let r = 0; r < s.length; r++) {
|
|
251
251
|
const i = s[r];
|
|
@@ -253,13 +253,13 @@ function pt(e, t) {
|
|
|
253
253
|
}
|
|
254
254
|
return n;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function zt(e) {
|
|
257
257
|
return Gt(e) ? e : [e];
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
return e === void 0 ? [] :
|
|
259
|
+
function j(e) {
|
|
260
|
+
return e === void 0 ? [] : zt(e);
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function He(e, t, n, s) {
|
|
263
263
|
return typeof e == "function" ? e({
|
|
264
264
|
context: t,
|
|
265
265
|
event: n,
|
|
@@ -269,19 +269,19 @@ function je(e, t, n, s) {
|
|
|
269
269
|
function Gt(e) {
|
|
270
270
|
return Array.isArray(e);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Fn(e) {
|
|
273
273
|
return e.type.startsWith("xstate.error.actor");
|
|
274
274
|
}
|
|
275
275
|
function K(e) {
|
|
276
|
-
return
|
|
276
|
+
return zt(e).map((t) => typeof t > "u" || typeof t == "string" ? {
|
|
277
277
|
target: t
|
|
278
278
|
} : t);
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!(e === void 0 || e ===
|
|
282
|
-
return
|
|
280
|
+
function Jt(e) {
|
|
281
|
+
if (!(e === void 0 || e === On))
|
|
282
|
+
return j(e);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function gt(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 yt(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 Et(e, t) {
|
|
294
294
|
return `${t}.${e}`;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function tt(e, t) {
|
|
297
297
|
const n = t.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
298
298
|
if (!n)
|
|
299
299
|
return e.implementations.actors[t];
|
|
300
300
|
const [, s, r] = n, o = e.getStateNodeById(r).config.invoke;
|
|
301
301
|
return (Array.isArray(o) ? o[s] : o).src;
|
|
302
302
|
}
|
|
303
|
-
const
|
|
304
|
-
let
|
|
303
|
+
const nt = 1;
|
|
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 Bn = {
|
|
308
308
|
clock: {
|
|
309
309
|
setTimeout: (e, t) => setTimeout(e, t),
|
|
310
310
|
clearTimeout: (e) => clearTimeout(e)
|
|
@@ -312,7 +312,7 @@ const Un = {
|
|
|
312
312
|
logger: console.log.bind(console),
|
|
313
313
|
devTools: !1
|
|
314
314
|
};
|
|
315
|
-
class
|
|
315
|
+
class jn {
|
|
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 Pn {
|
|
|
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 ft(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
|
+
...Bn,
|
|
326
326
|
...n
|
|
327
327
|
}, {
|
|
328
328
|
clock: r,
|
|
@@ -333,10 +333,10 @@ class Pn {
|
|
|
333
333
|
systemId: u,
|
|
334
334
|
inspect: h
|
|
335
335
|
} = s;
|
|
336
|
-
this.system = o ? o.system :
|
|
336
|
+
this.system = o ? o.system : Pn(this, {
|
|
337
337
|
clock: r,
|
|
338
338
|
logger: i
|
|
339
|
-
}), h && !o && this.system.inspect(
|
|
339
|
+
}), h && !o && this.system.inspect(gt(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 Pn {
|
|
|
393
393
|
try {
|
|
394
394
|
(r = o.next) == null || r.call(o, t);
|
|
395
395
|
} catch (a) {
|
|
396
|
-
|
|
396
|
+
B(a);
|
|
397
397
|
}
|
|
398
398
|
break;
|
|
399
399
|
case "done":
|
|
@@ -401,9 +401,9 @@ class Pn {
|
|
|
401
401
|
try {
|
|
402
402
|
(i = o.next) == null || i.call(o, t);
|
|
403
403
|
} catch (a) {
|
|
404
|
-
|
|
404
|
+
B(a);
|
|
405
405
|
}
|
|
406
|
-
this._stopProcedure(), this._complete(), this._doneEvent =
|
|
406
|
+
this._stopProcedure(), this._complete(), this._doneEvent = qn(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
|
|
407
407
|
break;
|
|
408
408
|
case "error":
|
|
409
409
|
this._error(this._snapshot.error);
|
|
@@ -466,8 +466,8 @@ class Pn {
|
|
|
466
466
|
*/
|
|
467
467
|
subscribe(t, n, s) {
|
|
468
468
|
var i;
|
|
469
|
-
const r =
|
|
470
|
-
if (this._processingStatus !==
|
|
469
|
+
const r = gt(t, n, s);
|
|
470
|
+
if (this._processingStatus !== D.Stopped)
|
|
471
471
|
this.observers.add(r);
|
|
472
472
|
else
|
|
473
473
|
switch (this._snapshot.status) {
|
|
@@ -475,18 +475,18 @@ class Pn {
|
|
|
475
475
|
try {
|
|
476
476
|
(i = r.complete) == null || i.call(r);
|
|
477
477
|
} catch (o) {
|
|
478
|
-
|
|
478
|
+
B(o);
|
|
479
479
|
}
|
|
480
480
|
break;
|
|
481
481
|
case "error": {
|
|
482
482
|
const o = this._snapshot.error;
|
|
483
483
|
if (!r.error)
|
|
484
|
-
|
|
484
|
+
B(o);
|
|
485
485
|
else
|
|
486
486
|
try {
|
|
487
487
|
r.error(o);
|
|
488
488
|
} catch (a) {
|
|
489
|
-
|
|
489
|
+
B(a);
|
|
490
490
|
}
|
|
491
491
|
break;
|
|
492
492
|
}
|
|
@@ -511,7 +511,7 @@ class Pn {
|
|
|
511
511
|
* Starts the Actor from the initial state
|
|
512
512
|
*/
|
|
513
513
|
start() {
|
|
514
|
-
if (this._processingStatus ===
|
|
514
|
+
if (this._processingStatus === D.Running)
|
|
515
515
|
return this;
|
|
516
516
|
this._syncSnapshot && this.subscribe({
|
|
517
517
|
next: (s) => {
|
|
@@ -522,8 +522,8 @@ class Pn {
|
|
|
522
522
|
},
|
|
523
523
|
error: () => {
|
|
524
524
|
}
|
|
525
|
-
}), this.system._register(this.sessionId, this), this._systemId && this.system._set(this._systemId, this), this._processingStatus =
|
|
526
|
-
const t =
|
|
525
|
+
}), this.system._register(this.sessionId, this), this._systemId && this.system._set(this._systemId, this), this._processingStatus = D.Running;
|
|
526
|
+
const t = Vt(this.options.input);
|
|
527
527
|
switch (this.system._sendInspectionEvent({
|
|
528
528
|
type: "@xstate.event",
|
|
529
529
|
sourceRef: this._parent,
|
|
@@ -570,7 +570,7 @@ class Pn {
|
|
|
570
570
|
this.update(n, t), t.type === ue && (this._stopProcedure(), this._complete());
|
|
571
571
|
}
|
|
572
572
|
_stop() {
|
|
573
|
-
return this._processingStatus ===
|
|
573
|
+
return this._processingStatus === D.Stopped ? this : (this.mailbox.clear(), this._processingStatus === D.NotStarted ? (this._processingStatus = D.Stopped, this) : (this.mailbox.enqueue({
|
|
574
574
|
type: ue
|
|
575
575
|
}), this));
|
|
576
576
|
}
|
|
@@ -588,13 +588,13 @@ class Pn {
|
|
|
588
588
|
try {
|
|
589
589
|
(t = n.complete) == null || t.call(n);
|
|
590
590
|
} catch (s) {
|
|
591
|
-
|
|
591
|
+
B(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 || B(t);
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
600
|
let n = !1;
|
|
@@ -604,13 +604,13 @@ class Pn {
|
|
|
604
604
|
try {
|
|
605
605
|
r == null || r(t);
|
|
606
606
|
} catch (i) {
|
|
607
|
-
|
|
607
|
+
B(i);
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
this.observers.clear(), n &&
|
|
610
|
+
this.observers.clear(), n && B(t);
|
|
611
611
|
}
|
|
612
612
|
_error(t) {
|
|
613
|
-
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent,
|
|
613
|
+
this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, $t(this.id, t));
|
|
614
614
|
}
|
|
615
615
|
// TODO: atm children don't belong entirely to the actor so
|
|
616
616
|
// in a way - it's not even super aware of them
|
|
@@ -618,13 +618,13 @@ class Pn {
|
|
|
618
618
|
// right now, they are being stopped within the machine's transition
|
|
619
619
|
// but that could throw and leave us with "orphaned" active actors
|
|
620
620
|
_stopProcedure() {
|
|
621
|
-
return this._processingStatus !==
|
|
621
|
+
return this._processingStatus !== D.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new ft(this._process.bind(this)), this._processingStatus = D.Stopped, this.system._unregister(this), this);
|
|
622
622
|
}
|
|
623
623
|
/**
|
|
624
624
|
* @internal
|
|
625
625
|
*/
|
|
626
626
|
_send(t) {
|
|
627
|
-
this._processingStatus !==
|
|
627
|
+
this._processingStatus !== D.Stopped && this.mailbox.enqueue(t);
|
|
628
628
|
}
|
|
629
629
|
/**
|
|
630
630
|
* Sends an event to the running Actor to trigger a transition.
|
|
@@ -638,11 +638,11 @@ class Pn {
|
|
|
638
638
|
const {
|
|
639
639
|
devTools: t
|
|
640
640
|
} = this.options;
|
|
641
|
-
t && (typeof t == "function" ? t :
|
|
641
|
+
t && (typeof t == "function" ? t : Nn)(this);
|
|
642
642
|
}
|
|
643
643
|
toJSON() {
|
|
644
644
|
return {
|
|
645
|
-
xstate$$type:
|
|
645
|
+
xstate$$type: nt,
|
|
646
646
|
id: this.id
|
|
647
647
|
};
|
|
648
648
|
}
|
|
@@ -661,7 +661,7 @@ class Pn {
|
|
|
661
661
|
getPersistedSnapshot(t) {
|
|
662
662
|
return this.logic.getPersistedSnapshot(this._snapshot, t);
|
|
663
663
|
}
|
|
664
|
-
[
|
|
664
|
+
[Mn]() {
|
|
665
665
|
return this;
|
|
666
666
|
}
|
|
667
667
|
/**
|
|
@@ -682,35 +682,35 @@ class Pn {
|
|
|
682
682
|
return this._snapshot;
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
function
|
|
686
|
-
return new
|
|
685
|
+
function U(e, ...[t]) {
|
|
686
|
+
return new jn(e, t);
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function $n(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 Vn(e, t) {
|
|
695
695
|
e.defer(() => {
|
|
696
696
|
e.system.scheduler.cancel(e.self, t);
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function Hn(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 = $n, t.execute = Vn, t;
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function zn(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" ? tt(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
|
|
712
712
|
let d;
|
|
713
|
-
return u && (d =
|
|
713
|
+
return u && (d = U(u, {
|
|
714
714
|
id: h,
|
|
715
715
|
src: o,
|
|
716
716
|
parent: e.self,
|
|
@@ -731,15 +731,15 @@ function $n(e, t, n, s, {
|
|
|
731
731
|
actorRef: d
|
|
732
732
|
}];
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function Gn(e, {
|
|
735
735
|
id: t,
|
|
736
736
|
actorRef: n
|
|
737
737
|
}) {
|
|
738
738
|
n && e.defer(() => {
|
|
739
|
-
n._processingStatus !==
|
|
739
|
+
n._processingStatus !== D.Stopped && n.start();
|
|
740
740
|
});
|
|
741
741
|
}
|
|
742
|
-
function
|
|
742
|
+
function Jn(...[e, {
|
|
743
743
|
id: t,
|
|
744
744
|
systemId: n,
|
|
745
745
|
input: s,
|
|
@@ -747,9 +747,9 @@ function Hn(...[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 = zn, i.execute = Gn, i;
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function Yn(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,9 +760,9 @@ function Gn(e, t, n, s, {
|
|
|
760
760
|
children: a
|
|
761
761
|
}), o];
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function Xn(e, t) {
|
|
764
764
|
if (t) {
|
|
765
|
-
if (e.system._unregister(t), t._processingStatus !==
|
|
765
|
+
if (e.system._unregister(t), t._processingStatus !== D.Running) {
|
|
766
766
|
e.stopChild(t);
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
@@ -771,19 +771,19 @@ function zn(e, t) {
|
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
-
function
|
|
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 = Yn, t.execute = Xn, t;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function st(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 st(o, t, n, s);
|
|
787
787
|
const a = {
|
|
788
788
|
context: t,
|
|
789
789
|
event: n
|
|
@@ -798,7 +798,7 @@ function et(e, t, n, s) {
|
|
|
798
798
|
// this holds all params
|
|
799
799
|
) : o(a, c);
|
|
800
800
|
}
|
|
801
|
-
const
|
|
801
|
+
const rt = (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
|
|
815
|
-
const t = new Set(e), n =
|
|
814
|
+
function Se(e) {
|
|
815
|
+
const t = new Set(e), n = Qt(t);
|
|
816
816
|
for (const s of t)
|
|
817
817
|
if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
|
|
818
|
-
|
|
818
|
+
vt(s).forEach((r) => t.add(r));
|
|
819
819
|
else if (s.type === "parallel") {
|
|
820
820
|
for (const r of te(s))
|
|
821
821
|
if (r.type !== "history" && !t.has(r)) {
|
|
822
|
-
const i =
|
|
822
|
+
const i = vt(r);
|
|
823
823
|
for (const o of i)
|
|
824
824
|
t.add(o);
|
|
825
825
|
}
|
|
@@ -831,40 +831,40 @@ function _e(e) {
|
|
|
831
831
|
}
|
|
832
832
|
return t;
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function Xt(e, t) {
|
|
835
835
|
const n = t.get(e);
|
|
836
836
|
if (!n)
|
|
837
837
|
return {};
|
|
838
838
|
if (e.type === "compound") {
|
|
839
839
|
const r = n[0];
|
|
840
840
|
if (r) {
|
|
841
|
-
if (
|
|
841
|
+
if (rt(r))
|
|
842
842
|
return r.key;
|
|
843
843
|
} else
|
|
844
844
|
return {};
|
|
845
845
|
}
|
|
846
846
|
const s = {};
|
|
847
847
|
for (const r of n)
|
|
848
|
-
s[r.key] =
|
|
848
|
+
s[r.key] = Xt(r, t);
|
|
849
849
|
return s;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function Qt(e) {
|
|
852
852
|
const t = /* @__PURE__ */ new Map();
|
|
853
853
|
for (const n of e)
|
|
854
854
|
t.has(n) || t.set(n, []), n.parent && (t.has(n.parent) || t.set(n.parent, []), t.get(n.parent).push(n));
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
const n =
|
|
859
|
-
return
|
|
857
|
+
function Wt(e, t) {
|
|
858
|
+
const n = Se(t);
|
|
859
|
+
return Xt(e, Qt(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 it(e, t) {
|
|
862
|
+
return t.type === "compound" ? te(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? te(t).every((n) => it(e, n)) : t.type === "final";
|
|
863
863
|
}
|
|
864
|
-
const
|
|
865
|
-
function
|
|
864
|
+
const Oe = (e) => e[0] === Cn;
|
|
865
|
+
function Qn(e, t) {
|
|
866
866
|
return e.transitions.get(t) || [...e.transitions.keys()].filter((s) => {
|
|
867
|
-
if (s ===
|
|
867
|
+
if (s === kn)
|
|
868
868
|
return !0;
|
|
869
869
|
if (!s.endsWith(".*"))
|
|
870
870
|
return !1;
|
|
@@ -879,22 +879,22 @@ function Jn(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 Wn(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 = Rn(r, e.id), a = o.type;
|
|
888
|
+
return e.entry.push(Is(o, {
|
|
889
889
|
id: a,
|
|
890
890
|
delay: r
|
|
891
|
-
})), e.exit.push(
|
|
891
|
+
})), e.exit.push(Hn(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 j(a).map((h) => ({
|
|
898
898
|
...h,
|
|
899
899
|
event: u,
|
|
900
900
|
delay: c
|
|
@@ -910,9 +910,9 @@ function Yn(e) {
|
|
|
910
910
|
});
|
|
911
911
|
}
|
|
912
912
|
function G(e, t, n) {
|
|
913
|
-
const s =
|
|
913
|
+
const s = Jt(n.target), r = n.reenter ?? !1, i = es(e, s), o = {
|
|
914
914
|
...n,
|
|
915
|
-
actions:
|
|
915
|
+
actions: j(n.actions),
|
|
916
916
|
guard: n.guard,
|
|
917
917
|
target: i,
|
|
918
918
|
source: e,
|
|
@@ -926,11 +926,11 @@ function G(e, t, n) {
|
|
|
926
926
|
};
|
|
927
927
|
return o;
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function Kn(e) {
|
|
930
930
|
const t = /* @__PURE__ */ new Map();
|
|
931
931
|
if (e.config.on)
|
|
932
932
|
for (const n of Object.keys(e.config.on)) {
|
|
933
|
-
if (n ===
|
|
933
|
+
if (n === Bt)
|
|
934
934
|
throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
|
|
935
935
|
const s = e.config.on[n];
|
|
936
936
|
t.set(n, K(s).map((r) => G(e, n, r)));
|
|
@@ -959,13 +959,13 @@ function Xn(e) {
|
|
|
959
959
|
}
|
|
960
960
|
return t;
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function Zn(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" ? [] : j(t.actions),
|
|
969
969
|
eventType: null,
|
|
970
970
|
reenter: !1,
|
|
971
971
|
target: n ? [n] : [],
|
|
@@ -977,14 +977,14 @@ function Qn(e, t) {
|
|
|
977
977
|
};
|
|
978
978
|
return s;
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function es(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 (Oe(n))
|
|
986
986
|
return e.machine.getStateNodeById(n);
|
|
987
|
-
const s = n[0] ===
|
|
987
|
+
const s = n[0] === Ft;
|
|
988
988
|
if (s && !e.parent)
|
|
989
989
|
return Ie(e, n.slice(1));
|
|
990
990
|
const r = s ? e.key + n : n;
|
|
@@ -999,23 +999,23 @@ ${i.message}`);
|
|
|
999
999
|
throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`);
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
const t =
|
|
1002
|
+
function Kt(e) {
|
|
1003
|
+
const t = Jt(e.config.target);
|
|
1004
1004
|
return t ? {
|
|
1005
1005
|
target: t.map((n) => typeof n == "string" ? Ie(e.parent, n) : n)
|
|
1006
1006
|
} : e.parent.initial;
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function J(e) {
|
|
1009
1009
|
return e.type === "history";
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1012
|
-
const t =
|
|
1011
|
+
function vt(e) {
|
|
1012
|
+
const t = Zt(e);
|
|
1013
1013
|
for (const n of t)
|
|
1014
1014
|
for (const s of le(n, e))
|
|
1015
1015
|
t.add(s);
|
|
1016
1016
|
return t;
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function Zt(e) {
|
|
1019
1019
|
const t = /* @__PURE__ */ new Set();
|
|
1020
1020
|
function n(s) {
|
|
1021
1021
|
if (!t.has(s)) {
|
|
@@ -1029,7 +1029,7 @@ function Kt(e) {
|
|
|
1029
1029
|
return n(e), t;
|
|
1030
1030
|
}
|
|
1031
1031
|
function ne(e, t) {
|
|
1032
|
-
if (
|
|
1032
|
+
if (Oe(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.`);
|
|
@@ -1039,12 +1039,12 @@ function ne(e, t) {
|
|
|
1039
1039
|
return n;
|
|
1040
1040
|
}
|
|
1041
1041
|
function Ie(e, t) {
|
|
1042
|
-
if (typeof t == "string" &&
|
|
1042
|
+
if (typeof t == "string" && Oe(t))
|
|
1043
1043
|
try {
|
|
1044
1044
|
return e.machine.getStateNodeById(t);
|
|
1045
1045
|
} catch {
|
|
1046
1046
|
}
|
|
1047
|
-
const n =
|
|
1047
|
+
const n = et(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 Ae(e, t) {
|
|
1058
1058
|
if (typeof t == "string") {
|
|
1059
1059
|
const r = e.states[t];
|
|
1060
1060
|
if (!r)
|
|
@@ -1066,33 +1066,33 @@ function Se(e, t) {
|
|
|
1066
1066
|
const o = ne(e, i);
|
|
1067
1067
|
if (!o)
|
|
1068
1068
|
return r;
|
|
1069
|
-
const a =
|
|
1069
|
+
const a = Ae(o, t[i]);
|
|
1070
1070
|
return r.concat(a);
|
|
1071
1071
|
}, []));
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function ts(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 ns(e, t, n, s) {
|
|
1078
|
+
const r = Object.keys(t), i = ne(e, r[0]), o = ot(i, t[r[0]], n, s);
|
|
1079
1079
|
return !o || !o.length ? e.next(n, s) : o;
|
|
1080
1080
|
}
|
|
1081
|
-
function
|
|
1081
|
+
function ss(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 = ot(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 ot(e, t, n, s) {
|
|
1093
|
+
return typeof t == "string" ? ts(e, t, n, s) : Object.keys(t).length === 1 ? ns(e, t, n, s) : ss(e, t, n, s);
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function rs(e) {
|
|
1096
1096
|
return Object.keys(e.states).map((t) => e.states[t]).filter((t) => t.type === "history");
|
|
1097
1097
|
}
|
|
1098
1098
|
function $(e, t) {
|
|
@@ -1101,7 +1101,7 @@ function $(e, t) {
|
|
|
1101
1101
|
n = n.parent;
|
|
1102
1102
|
return n.parent === t;
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function is(e, t) {
|
|
1105
1105
|
const n = new Set(e), s = new Set(t);
|
|
1106
1106
|
for (const r of n)
|
|
1107
1107
|
if (s.has(r))
|
|
@@ -1111,13 +1111,13 @@ function ns(e, t) {
|
|
|
1111
1111
|
return !0;
|
|
1112
1112
|
return !1;
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function en(e, t, n) {
|
|
1115
1115
|
const s = /* @__PURE__ */ new Set();
|
|
1116
1116
|
for (const r of e) {
|
|
1117
1117
|
let i = !1;
|
|
1118
1118
|
const o = /* @__PURE__ */ new Set();
|
|
1119
1119
|
for (const a of s)
|
|
1120
|
-
if (
|
|
1120
|
+
if (is(ze([r], t, n), ze([a], t, n)))
|
|
1121
1121
|
if ($(r.source, a.source))
|
|
1122
1122
|
o.add(a);
|
|
1123
1123
|
else {
|
|
@@ -1132,53 +1132,53 @@ function Zt(e, t, n) {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
return Array.from(s);
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function os(e) {
|
|
1136
1136
|
const [t, ...n] = e;
|
|
1137
1137
|
for (const s of le(t, void 0))
|
|
1138
1138
|
if (n.every((r) => $(r, s)))
|
|
1139
1139
|
return s;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function at(e, t) {
|
|
1142
1142
|
if (!e.target)
|
|
1143
1143
|
return [];
|
|
1144
1144
|
const n = /* @__PURE__ */ new Set();
|
|
1145
1145
|
for (const s of e.target)
|
|
1146
|
-
if (
|
|
1146
|
+
if (J(s))
|
|
1147
1147
|
if (t[s.id])
|
|
1148
1148
|
for (const r of t[s.id])
|
|
1149
1149
|
n.add(r);
|
|
1150
1150
|
else
|
|
1151
|
-
for (const r of
|
|
1151
|
+
for (const r of at(Kt(s), t))
|
|
1152
1152
|
n.add(r);
|
|
1153
1153
|
else
|
|
1154
1154
|
n.add(s);
|
|
1155
1155
|
return [...n];
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const n =
|
|
1157
|
+
function tn(e, t) {
|
|
1158
|
+
const n = at(e, t);
|
|
1159
1159
|
if (!n)
|
|
1160
1160
|
return;
|
|
1161
1161
|
if (!e.reenter && n.every((r) => r === e.source || $(r, e.source)))
|
|
1162
1162
|
return e.source;
|
|
1163
|
-
const s =
|
|
1163
|
+
const s = os(n.concat(e.source));
|
|
1164
1164
|
if (s)
|
|
1165
1165
|
return s;
|
|
1166
1166
|
if (!e.reenter)
|
|
1167
1167
|
return e.source.machine.root;
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function ze(e, t, n) {
|
|
1170
1170
|
var r;
|
|
1171
1171
|
const s = /* @__PURE__ */ new Set();
|
|
1172
1172
|
for (const i of e)
|
|
1173
1173
|
if ((r = i.target) != null && r.length) {
|
|
1174
|
-
const o =
|
|
1174
|
+
const o = tn(i, n);
|
|
1175
1175
|
i.reenter && i.source === o && s.add(o);
|
|
1176
1176
|
for (const a of t)
|
|
1177
1177
|
$(a, o) && s.add(a);
|
|
1178
1178
|
}
|
|
1179
1179
|
return [...s];
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1181
|
+
function as(e, t) {
|
|
1182
1182
|
if (e.length !== t.size)
|
|
1183
1183
|
return !1;
|
|
1184
1184
|
for (const n of e)
|
|
@@ -1186,18 +1186,18 @@ function rs(e, t) {
|
|
|
1186
1186
|
return !1;
|
|
1187
1187
|
return !0;
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1189
|
+
function Ge(e, t, n, s, r, i) {
|
|
1190
1190
|
if (!e.length)
|
|
1191
1191
|
return t;
|
|
1192
1192
|
const o = new Set(t._nodes);
|
|
1193
1193
|
let a = t.historyValue;
|
|
1194
|
-
const c =
|
|
1194
|
+
const c = en(e, o, a);
|
|
1195
1195
|
let u = t;
|
|
1196
|
-
r || ([u, a] =
|
|
1196
|
+
r || ([u, a] = ls(u, s, n, c, o, a, i)), u = se(u, s, n, c.flatMap((d) => d.actions), i), u = us(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 && as(t._nodes, o) ? u : Y(u, {
|
|
1201
1201
|
_nodes: h,
|
|
1202
1202
|
historyValue: a
|
|
1203
1203
|
});
|
|
@@ -1205,23 +1205,23 @@ function Ve(e, t, n, s, r, i) {
|
|
|
1205
1205
|
throw d;
|
|
1206
1206
|
}
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function cs(e, t, n, s, r) {
|
|
1209
1209
|
if (s.output === void 0)
|
|
1210
1210
|
return;
|
|
1211
|
-
const i =
|
|
1212
|
-
return
|
|
1211
|
+
const i = Ve(r.id, r.output !== void 0 && r.parent ? He(r.output, e.context, t, n.self) : void 0);
|
|
1212
|
+
return He(s.output, e.context, i, n.self);
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1214
|
+
function us(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
|
+
ds(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(Jn(y.src, {
|
|
1225
1225
|
...y,
|
|
1226
1226
|
syncSnapshot: !!y.onSnapshot
|
|
1227
1227
|
}));
|
|
@@ -1231,85 +1231,85 @@ function os(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(
|
|
1236
|
-
d.add(v), i.push(
|
|
1234
|
+
let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, I = v || f;
|
|
1235
|
+
for ((y == null ? void 0 : y.type) === "compound" && i.push(Ve(y.id, f.output !== void 0 ? He(f.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !d.has(v) && it(r, v); )
|
|
1236
|
+
d.add(v), i.push(Ve(v.id)), I = v, v = v.parent;
|
|
1237
1237
|
if (v)
|
|
1238
1238
|
continue;
|
|
1239
1239
|
c = Y(c, {
|
|
1240
1240
|
status: "done",
|
|
1241
|
-
output:
|
|
1241
|
+
output: cs(c, t, n, c.machine.root, I)
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
return c;
|
|
1246
1246
|
}
|
|
1247
|
-
function
|
|
1247
|
+
function ds(e, t, n, s) {
|
|
1248
1248
|
for (const r of e) {
|
|
1249
|
-
const i =
|
|
1249
|
+
const i = tn(r, t);
|
|
1250
1250
|
for (const a of r.target || [])
|
|
1251
|
-
!
|
|
1251
|
+
!J(a) && // if the target is different than the source then it will *definitely* be entered
|
|
1252
1252
|
(r.source !== a || // we know that the domain can't lie within the source
|
|
1253
1253
|
// if it's different than the source then it's outside of it and it means that the target has to be entered as well
|
|
1254
1254
|
r.source !== i || // reentering transitions always enter the target, even if it's the source itself
|
|
1255
1255
|
r.reenter) && (s.add(a), n.add(a)), Z(a, t, n, s);
|
|
1256
|
-
const o =
|
|
1256
|
+
const o = at(r, t);
|
|
1257
1257
|
for (const a of o) {
|
|
1258
1258
|
const c = le(a, i);
|
|
1259
|
-
(i == null ? void 0 : i.type) === "parallel" && c.push(i),
|
|
1259
|
+
(i == null ? void 0 : i.type) === "parallel" && c.push(i), nn(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
1263
|
function Z(e, t, n, s) {
|
|
1264
1264
|
var r;
|
|
1265
|
-
if (
|
|
1265
|
+
if (J(e))
|
|
1266
1266
|
if (t[e.id]) {
|
|
1267
1267
|
const i = t[e.id];
|
|
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
|
+
Me(o, e.parent, s, t, n);
|
|
1272
1272
|
} else {
|
|
1273
|
-
const i =
|
|
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
|
+
Me(o, e.parent, s, t, n);
|
|
1278
1278
|
}
|
|
1279
1279
|
else if (e.type === "compound") {
|
|
1280
1280
|
const [i] = e.initial.target;
|
|
1281
|
-
|
|
1281
|
+
J(i) || (s.add(i), n.add(i)), Z(i, t, n, s), Me(i, e, s, t, n);
|
|
1282
1282
|
} else if (e.type === "parallel")
|
|
1283
|
-
for (const i of te(e).filter((o) => !
|
|
1284
|
-
[...s].some((o) => $(o, i)) || (
|
|
1283
|
+
for (const i of te(e).filter((o) => !J(o)))
|
|
1284
|
+
[...s].some((o) => $(o, i)) || (J(i) || (s.add(i), n.add(i)), Z(i, t, n, s));
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function nn(e, t, n, s, r) {
|
|
1287
1287
|
for (const i of s)
|
|
1288
1288
|
if ((!r || $(i, r)) && e.add(i), i.type === "parallel")
|
|
1289
|
-
for (const o of te(i).filter((a) => !
|
|
1289
|
+
for (const o of te(i).filter((a) => !J(a)))
|
|
1290
1290
|
[...e].some((a) => $(a, o)) || (e.add(o), Z(o, t, n, e));
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1293
|
-
|
|
1292
|
+
function Me(e, t, n, s, r) {
|
|
1293
|
+
nn(n, s, r, le(e, t));
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function ls(e, t, n, s, r, i, o) {
|
|
1296
1296
|
let a = e;
|
|
1297
|
-
const c =
|
|
1297
|
+
const c = ze(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 rs(h)) {
|
|
1302
1302
|
let f;
|
|
1303
|
-
d.history === "deep" ? f = (m) =>
|
|
1303
|
+
d.history === "deep" ? f = (m) => rt(m) && $(m, h) : f = (m) => m.parent === h, u ?? (u = {
|
|
1304
1304
|
...i
|
|
1305
1305
|
}), u[d.id] = Array.from(r).filter(f);
|
|
1306
1306
|
}
|
|
1307
1307
|
for (const h of c)
|
|
1308
|
-
a = se(a, t, n, [...h.exit, ...h.invoke.map((d) =>
|
|
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
|
|
1312
|
-
function
|
|
1311
|
+
let Tt = !1;
|
|
1312
|
+
function sn(e, t, n, s, r, i) {
|
|
1313
1313
|
const {
|
|
1314
1314
|
machine: o
|
|
1315
1315
|
} = e;
|
|
@@ -1325,9 +1325,9 @@ function nn(e, t, n, s, r, i) {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
try {
|
|
1328
|
-
|
|
1328
|
+
Tt = h, h(d, f);
|
|
1329
1329
|
} finally {
|
|
1330
|
-
|
|
1330
|
+
Tt = !1;
|
|
1331
1331
|
}
|
|
1332
1332
|
};
|
|
1333
1333
|
const u = typeof c == "function", h = u ? c : (
|
|
@@ -1348,12 +1348,12 @@ function nn(e, t, n, s, r, i) {
|
|
|
1348
1348
|
event: t
|
|
1349
1349
|
}) : c.params : void 0;
|
|
1350
1350
|
if (!("resolve" in h)) {
|
|
1351
|
-
n.self._processingStatus ===
|
|
1351
|
+
n.self._processingStatus === D.Running ? m() : n.defer(() => {
|
|
1352
1352
|
m();
|
|
1353
1353
|
});
|
|
1354
1354
|
continue;
|
|
1355
1355
|
}
|
|
1356
|
-
const y = h, [v,
|
|
1356
|
+
const y = h, [v, I, x] = y.resolve(
|
|
1357
1357
|
n,
|
|
1358
1358
|
a,
|
|
1359
1359
|
d,
|
|
@@ -1362,12 +1362,12 @@ function nn(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, I])), "execute" in y && (n.self._processingStatus === D.Running ? y.execute(n, I) : n.defer(y.execute.bind(null, n, I))), x && (a = sn(a, t, n, x, r, i));
|
|
1366
1366
|
}
|
|
1367
1367
|
return a;
|
|
1368
1368
|
}
|
|
1369
1369
|
function se(e, t, n, s, r, i) {
|
|
1370
|
-
const o = i ? [] : void 0, a =
|
|
1370
|
+
const o = i ? [] : void 0, a = sn(e, t, n, s, {
|
|
1371
1371
|
internalQueue: r,
|
|
1372
1372
|
deferredActorIds: i
|
|
1373
1373
|
}, o);
|
|
@@ -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 Le(e, t, n, s = []) {
|
|
1379
1379
|
let r = e;
|
|
1380
1380
|
const i = [];
|
|
1381
1381
|
function o(u, h, d) {
|
|
@@ -1388,15 +1388,15 @@ function De(e, t, n, s = []) {
|
|
|
1388
1388
|
}), i.push(u);
|
|
1389
1389
|
}
|
|
1390
1390
|
if (t.type === ue)
|
|
1391
|
-
return r = Y(
|
|
1391
|
+
return r = Y(_t(r, t, n), {
|
|
1392
1392
|
status: "stopped"
|
|
1393
1393
|
}), o(r, t, []), {
|
|
1394
1394
|
snapshot: r,
|
|
1395
1395
|
microstates: i
|
|
1396
1396
|
};
|
|
1397
1397
|
let a = t;
|
|
1398
|
-
if (a.type !==
|
|
1399
|
-
const u = a, h =
|
|
1398
|
+
if (a.type !== jt) {
|
|
1399
|
+
const u = a, h = Fn(u), d = St(u, r);
|
|
1400
1400
|
if (h && !d.length)
|
|
1401
1401
|
return r = Y(e, {
|
|
1402
1402
|
status: "error",
|
|
@@ -1405,7 +1405,7 @@ function De(e, t, n, s = []) {
|
|
|
1405
1405
|
snapshot: r,
|
|
1406
1406
|
microstates: i
|
|
1407
1407
|
};
|
|
1408
|
-
r =
|
|
1408
|
+
r = Ge(
|
|
1409
1409
|
d,
|
|
1410
1410
|
e,
|
|
1411
1411
|
n,
|
|
@@ -1417,56 +1417,56 @@ function De(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 ? hs(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 = St(a, r);
|
|
1426
1426
|
}
|
|
1427
|
-
r =
|
|
1427
|
+
r = Ge(u, r, n, a, !1, s), c = r !== h, o(r, a, u);
|
|
1428
1428
|
}
|
|
1429
|
-
return r.status !== "active" &&
|
|
1429
|
+
return r.status !== "active" && _t(r, a, n), {
|
|
1430
1430
|
snapshot: r,
|
|
1431
1431
|
microstates: i
|
|
1432
1432
|
};
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1435
|
-
return se(e, t, n, Object.values(e.children).map((s) =>
|
|
1434
|
+
function _t(e, t, n) {
|
|
1435
|
+
return se(e, t, n, Object.values(e.children).map((s) => Yt(s)), []);
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function St(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 hs(e, t) {
|
|
1441
|
+
const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(rt);
|
|
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 || st(o.guard, e.context, t, e)) {
|
|
1448
1448
|
n.add(o);
|
|
1449
1449
|
break e;
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
|
-
return
|
|
1452
|
+
return en(Array.from(n), new Set(e._nodes), e.historyValue);
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1455
|
-
const n =
|
|
1456
|
-
return
|
|
1454
|
+
function fs(e, t) {
|
|
1455
|
+
const n = Se(Ae(e, t));
|
|
1456
|
+
return Wt(e, [...n]);
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function ps(e) {
|
|
1459
1459
|
return !!e && typeof e == "object" && "machine" in e && "value" in e;
|
|
1460
1460
|
}
|
|
1461
|
-
const
|
|
1462
|
-
return
|
|
1463
|
-
},
|
|
1461
|
+
const ys = function(t) {
|
|
1462
|
+
return Ht(t, this.value);
|
|
1463
|
+
}, ms = function(t) {
|
|
1464
1464
|
return this.tags.has(t);
|
|
1465
|
-
},
|
|
1465
|
+
}, gs = 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
|
+
}, Es = function() {
|
|
1470
1470
|
const {
|
|
1471
1471
|
_nodes: t,
|
|
1472
1472
|
tags: n,
|
|
@@ -1482,10 +1482,10 @@ const hs = function(t) {
|
|
|
1482
1482
|
...u,
|
|
1483
1483
|
tags: Array.from(n)
|
|
1484
1484
|
};
|
|
1485
|
-
},
|
|
1485
|
+
}, vs = 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 Ee(e, t) {
|
|
1489
1489
|
return {
|
|
1490
1490
|
status: e.status,
|
|
1491
1491
|
output: e.output,
|
|
@@ -1493,24 +1493,24 @@ function ge(e, t) {
|
|
|
1493
1493
|
machine: t,
|
|
1494
1494
|
context: e.context,
|
|
1495
1495
|
_nodes: e._nodes,
|
|
1496
|
-
value:
|
|
1496
|
+
value: Wt(t.root, e._nodes),
|
|
1497
1497
|
tags: new Set(e._nodes.flatMap((n) => n.tags)),
|
|
1498
1498
|
children: e.children,
|
|
1499
1499
|
historyValue: e.historyValue || {},
|
|
1500
|
-
matches:
|
|
1501
|
-
hasTag:
|
|
1502
|
-
can:
|
|
1503
|
-
getMeta:
|
|
1504
|
-
toJSON:
|
|
1500
|
+
matches: ys,
|
|
1501
|
+
hasTag: ms,
|
|
1502
|
+
can: gs,
|
|
1503
|
+
getMeta: vs,
|
|
1504
|
+
toJSON: Es
|
|
1505
1505
|
};
|
|
1506
1506
|
}
|
|
1507
1507
|
function Y(e, t = {}) {
|
|
1508
|
-
return
|
|
1508
|
+
return Ee({
|
|
1509
1509
|
...e,
|
|
1510
1510
|
...t
|
|
1511
1511
|
}, e.machine);
|
|
1512
1512
|
}
|
|
1513
|
-
function
|
|
1513
|
+
function Ts(e, t) {
|
|
1514
1514
|
const {
|
|
1515
1515
|
_nodes: n,
|
|
1516
1516
|
tags: s,
|
|
@@ -1525,21 +1525,21 @@ function gs(e, t) {
|
|
|
1525
1525
|
...f
|
|
1526
1526
|
} = e, m = {};
|
|
1527
1527
|
for (const v in i) {
|
|
1528
|
-
const
|
|
1528
|
+
const I = i[v];
|
|
1529
1529
|
m[v] = {
|
|
1530
|
-
snapshot:
|
|
1531
|
-
src:
|
|
1532
|
-
systemId:
|
|
1533
|
-
syncSnapshot:
|
|
1530
|
+
snapshot: I.getPersistedSnapshot(t),
|
|
1531
|
+
src: I.src,
|
|
1532
|
+
systemId: I._systemId,
|
|
1533
|
+
syncSnapshot: I._syncSnapshot
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
1536
1536
|
return {
|
|
1537
1537
|
...f,
|
|
1538
|
-
context:
|
|
1538
|
+
context: rn(o),
|
|
1539
1539
|
children: m
|
|
1540
1540
|
};
|
|
1541
1541
|
}
|
|
1542
|
-
function
|
|
1542
|
+
function rn(e) {
|
|
1543
1543
|
let t;
|
|
1544
1544
|
for (const n in e) {
|
|
1545
1545
|
const s = e[n];
|
|
@@ -1548,11 +1548,11 @@ function sn(e) {
|
|
|
1548
1548
|
t ?? (t = Array.isArray(e) ? e.slice() : {
|
|
1549
1549
|
...e
|
|
1550
1550
|
}), t[n] = {
|
|
1551
|
-
xstate$$type:
|
|
1551
|
+
xstate$$type: nt,
|
|
1552
1552
|
id: s.id
|
|
1553
1553
|
};
|
|
1554
1554
|
else {
|
|
1555
|
-
const r =
|
|
1555
|
+
const r = rn(s);
|
|
1556
1556
|
r !== s && (t ?? (t = Array.isArray(e) ? e.slice() : {
|
|
1557
1557
|
...e
|
|
1558
1558
|
}), t[n] = r);
|
|
@@ -1560,7 +1560,7 @@ function sn(e) {
|
|
|
1560
1560
|
}
|
|
1561
1561
|
return t ?? e;
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function _s(e, t, n, s, {
|
|
1564
1564
|
event: r,
|
|
1565
1565
|
id: i,
|
|
1566
1566
|
delay: o
|
|
@@ -1583,7 +1583,7 @@ function Es(e, t, n, s, {
|
|
|
1583
1583
|
delay: h
|
|
1584
1584
|
}];
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1586
|
+
function Ss(e, t) {
|
|
1587
1587
|
const {
|
|
1588
1588
|
event: n,
|
|
1589
1589
|
delay: s,
|
|
@@ -1597,13 +1597,13 @@ function vs(e, t) {
|
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1600
|
+
function Is(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 = _s, n.execute = Ss, n;
|
|
1604
1604
|
}
|
|
1605
|
-
const
|
|
1606
|
-
function
|
|
1605
|
+
const It = /* @__PURE__ */ new WeakMap();
|
|
1606
|
+
function As(e) {
|
|
1607
1607
|
return {
|
|
1608
1608
|
config: e,
|
|
1609
1609
|
start: (n, s) => {
|
|
@@ -1614,7 +1614,7 @@ function _s(e) {
|
|
|
1614
1614
|
receivers: void 0,
|
|
1615
1615
|
dispose: void 0
|
|
1616
1616
|
};
|
|
1617
|
-
|
|
1617
|
+
It.set(r, o), o.dispose = e({
|
|
1618
1618
|
input: n.input,
|
|
1619
1619
|
system: i,
|
|
1620
1620
|
self: r,
|
|
@@ -1628,7 +1628,7 @@ function _s(e) {
|
|
|
1628
1628
|
},
|
|
1629
1629
|
transition: (n, s, r) => {
|
|
1630
1630
|
var o, a;
|
|
1631
|
-
const i =
|
|
1631
|
+
const i = It.get(r.self);
|
|
1632
1632
|
return s.type === ue ? (n = {
|
|
1633
1633
|
...n,
|
|
1634
1634
|
status: "stopped",
|
|
@@ -1645,8 +1645,8 @@ function _s(e) {
|
|
|
1645
1645
|
restoreSnapshot: (n) => n
|
|
1646
1646
|
};
|
|
1647
1647
|
}
|
|
1648
|
-
const
|
|
1649
|
-
function
|
|
1648
|
+
const At = "xstate.promise.resolve", xt = "xstate.promise.reject", me = /* @__PURE__ */ new WeakMap();
|
|
1649
|
+
function V(e) {
|
|
1650
1650
|
return {
|
|
1651
1651
|
config: e,
|
|
1652
1652
|
transition: (n, s, r) => {
|
|
@@ -1654,7 +1654,7 @@ function J(e) {
|
|
|
1654
1654
|
if (n.status !== "active")
|
|
1655
1655
|
return n;
|
|
1656
1656
|
switch (s.type) {
|
|
1657
|
-
case
|
|
1657
|
+
case At: {
|
|
1658
1658
|
const o = s.data;
|
|
1659
1659
|
return {
|
|
1660
1660
|
...n,
|
|
@@ -1663,7 +1663,7 @@ function J(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 J(e) {
|
|
|
1671
1671
|
input: void 0
|
|
1672
1672
|
};
|
|
1673
1673
|
case ue:
|
|
1674
|
-
return (i =
|
|
1674
|
+
return (i = me.get(r.self)) == null || i.abort(), {
|
|
1675
1675
|
...n,
|
|
1676
1676
|
status: "stopped",
|
|
1677
1677
|
input: void 0
|
|
@@ -1687,19 +1687,19 @@ function J(e) {
|
|
|
1687
1687
|
if (n.status !== "active")
|
|
1688
1688
|
return;
|
|
1689
1689
|
const i = new AbortController();
|
|
1690
|
-
|
|
1690
|
+
me.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" && (me.delete(s), r._relay(s, s, {
|
|
1697
|
+
type: At,
|
|
1698
1698
|
data: a
|
|
1699
1699
|
}));
|
|
1700
1700
|
}, (a) => {
|
|
1701
|
-
s.getSnapshot().status === "active" && (
|
|
1702
|
-
type:
|
|
1701
|
+
s.getSnapshot().status === "active" && (me.delete(s), r._relay(s, s, {
|
|
1702
|
+
type: xt,
|
|
1703
1703
|
data: a
|
|
1704
1704
|
}));
|
|
1705
1705
|
});
|
|
@@ -1714,7 +1714,7 @@ function J(e) {
|
|
|
1714
1714
|
restoreSnapshot: (n) => n
|
|
1715
1715
|
};
|
|
1716
1716
|
}
|
|
1717
|
-
function
|
|
1717
|
+
function xs(e, {
|
|
1718
1718
|
machine: t,
|
|
1719
1719
|
context: n
|
|
1720
1720
|
}, s, r) {
|
|
@@ -1724,10 +1724,10 @@ function Is(e, {
|
|
|
1724
1724
|
input: u
|
|
1725
1725
|
} = a;
|
|
1726
1726
|
if (typeof o == "string") {
|
|
1727
|
-
const h =
|
|
1727
|
+
const h = tt(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 = U(h, {
|
|
1731
1731
|
id: a.id,
|
|
1732
1732
|
parent: e.self,
|
|
1733
1733
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1741,7 +1741,7 @@ function Is(e, {
|
|
|
1741
1741
|
});
|
|
1742
1742
|
return r[d.id] = d, d;
|
|
1743
1743
|
} else
|
|
1744
|
-
return
|
|
1744
|
+
return U(o, {
|
|
1745
1745
|
id: a.id,
|
|
1746
1746
|
parent: e.self,
|
|
1747
1747
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1753,11 +1753,11 @@ function Is(e, {
|
|
|
1753
1753
|
return (o, a) => {
|
|
1754
1754
|
const c = i(o, a);
|
|
1755
1755
|
return r[c.id] = c, e.defer(() => {
|
|
1756
|
-
c._processingStatus !==
|
|
1756
|
+
c._processingStatus !== D.Stopped && c.start();
|
|
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 Ss(e, t, n, s, {
|
|
|
1765
1765
|
const i = {}, o = {
|
|
1766
1766
|
context: t.context,
|
|
1767
1767
|
event: n.event,
|
|
1768
|
-
spawn:
|
|
1768
|
+
spawn: xs(e, t, n.event, i),
|
|
1769
1769
|
self: e.self,
|
|
1770
1770
|
system: e.system
|
|
1771
1771
|
};
|
|
@@ -1786,12 +1786,12 @@ function Ss(e, t, n, s, {
|
|
|
1786
1786
|
} : t.children
|
|
1787
1787
|
})];
|
|
1788
1788
|
}
|
|
1789
|
-
function
|
|
1789
|
+
function C(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 bs(e, t, n, s, {
|
|
1795
1795
|
event: r
|
|
1796
1796
|
}) {
|
|
1797
1797
|
const i = typeof r == "function" ? r(n, s) : r;
|
|
@@ -1799,20 +1799,20 @@ function As(e, t, n, s, {
|
|
|
1799
1799
|
event: i
|
|
1800
1800
|
}];
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1802
|
+
function Ns(e, {
|
|
1803
1803
|
event: t
|
|
1804
1804
|
}) {
|
|
1805
1805
|
e.defer(() => e.emit(t));
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function Pe(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 = bs, t.execute = Ns, t;
|
|
1811
1811
|
}
|
|
1812
|
-
let
|
|
1812
|
+
let wt = /* @__PURE__ */ function(e) {
|
|
1813
1813
|
return e.Parent = "#_parent", e.Internal = "#_internal", e;
|
|
1814
1814
|
}({});
|
|
1815
|
-
function
|
|
1815
|
+
function Os(e, t, n, s, {
|
|
1816
1816
|
to: r,
|
|
1817
1817
|
event: i,
|
|
1818
1818
|
id: o,
|
|
@@ -1832,7 +1832,7 @@ function ws(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 === wt.Parent ? m = e.self._parent : f === wt.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;
|
|
@@ -1843,10 +1843,10 @@ function ws(e, t, n, s, {
|
|
|
1843
1843
|
delay: d
|
|
1844
1844
|
}];
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1846
|
+
function Cs(e, t, n) {
|
|
1847
1847
|
typeof n.to == "string" && (n.to = t.children[n.to]);
|
|
1848
1848
|
}
|
|
1849
|
-
function
|
|
1849
|
+
function ks(e, t) {
|
|
1850
1850
|
e.defer(() => {
|
|
1851
1851
|
const {
|
|
1852
1852
|
to: n,
|
|
@@ -1863,42 +1863,42 @@ function Os(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 === Dn ? $t(e.self.id, s.data) : s
|
|
1867
1867
|
);
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
1870
|
-
function
|
|
1870
|
+
function bt(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 =
|
|
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 = Os, s.retryResolve = Cs, s.execute = ks, s;
|
|
1874
1874
|
}
|
|
1875
|
-
const
|
|
1875
|
+
const Nt = /* @__PURE__ */ new WeakMap();
|
|
1876
1876
|
function Q(e, t, n) {
|
|
1877
|
-
let s =
|
|
1877
|
+
let s = Nt.get(e);
|
|
1878
1878
|
return s ? t in s || (s[t] = n()) : (s = {
|
|
1879
1879
|
[t]: n()
|
|
1880
|
-
},
|
|
1880
|
+
}, Nt.set(e, s)), s[t];
|
|
1881
1881
|
}
|
|
1882
|
-
const
|
|
1882
|
+
const Ds = {}, 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 ct {
|
|
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(
|
|
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 ? mt(this.config.states, (s, r) => new ct(s, {
|
|
1892
1892
|
_parent: this,
|
|
1893
1893
|
_key: r,
|
|
1894
1894
|
_machine: this.machine
|
|
1895
|
-
})) :
|
|
1895
|
+
})) : Ds, 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 = j(this.config.entry).slice(), this.exit = j(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = j(t.tags).slice();
|
|
1898
1898
|
}
|
|
1899
1899
|
/** @internal */
|
|
1900
1900
|
_initialize() {
|
|
1901
|
-
this.transitions =
|
|
1901
|
+
this.transitions = Kn(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 it {
|
|
|
1925
1925
|
})
|
|
1926
1926
|
} : void 0,
|
|
1927
1927
|
history: this.history,
|
|
1928
|
-
states:
|
|
1928
|
+
states: mt(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 it {
|
|
|
1949
1949
|
* The logic invoked as actors by this state node.
|
|
1950
1950
|
*/
|
|
1951
1951
|
get invoke() {
|
|
1952
|
-
return Q(this, "invoke", () =>
|
|
1952
|
+
return Q(this, "invoke", () => j(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 ?? Et(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${Et(this.id, n)}`;
|
|
1957
1957
|
return {
|
|
1958
1958
|
...t,
|
|
1959
1959
|
src: o,
|
|
@@ -1982,23 +1982,23 @@ class it {
|
|
|
1982
1982
|
return Q(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 Q(this, "delayedTransitions", () =>
|
|
1985
|
+
return Q(this, "delayedTransitions", () => Wn(this));
|
|
1986
1986
|
}
|
|
1987
1987
|
get initial() {
|
|
1988
|
-
return Q(this, "initial", () =>
|
|
1988
|
+
return Q(this, "initial", () => Zn(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 = Q(this, `candidates-${s}`, () =>
|
|
1994
|
+
const o = Q(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 || st(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 Rs = "#";
|
|
2043
|
+
class ut {
|
|
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 ct(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 ot {
|
|
|
2068
2068
|
actors: r,
|
|
2069
2069
|
delays: i
|
|
2070
2070
|
} = this.implementations;
|
|
2071
|
-
return new
|
|
2071
|
+
return new ut(this.config, {
|
|
2072
2072
|
actions: {
|
|
2073
2073
|
...n,
|
|
2074
2074
|
...t.actions
|
|
@@ -2088,12 +2088,12 @@ class ot {
|
|
|
2088
2088
|
});
|
|
2089
2089
|
}
|
|
2090
2090
|
resolveState(t) {
|
|
2091
|
-
const n =
|
|
2092
|
-
return
|
|
2091
|
+
const n = fs(this.root, t.value), s = Se(Ae(this.root, n));
|
|
2092
|
+
return Ee({
|
|
2093
2093
|
_nodes: [...s],
|
|
2094
2094
|
context: t.context || {},
|
|
2095
2095
|
children: {},
|
|
2096
|
-
status:
|
|
2096
|
+
status: it(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 ot {
|
|
|
2107
2107
|
* @param event The received event
|
|
2108
2108
|
*/
|
|
2109
2109
|
transition(t, n, s) {
|
|
2110
|
-
return
|
|
2110
|
+
return Le(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 ot {
|
|
|
2117
2117
|
* @param event The received event
|
|
2118
2118
|
*/
|
|
2119
2119
|
microstep(t, n, s) {
|
|
2120
|
-
return
|
|
2120
|
+
return Le(t, n, s).microstates;
|
|
2121
2121
|
}
|
|
2122
2122
|
getTransitionData(t, n) {
|
|
2123
|
-
return
|
|
2123
|
+
return ot(this.root, t.value, t, n) || [];
|
|
2124
2124
|
}
|
|
2125
2125
|
/**
|
|
2126
2126
|
* The initial state _before_ evaluating any microsteps.
|
|
@@ -2129,13 +2129,13 @@ class ot {
|
|
|
2129
2129
|
getPreInitialState(t, n, s) {
|
|
2130
2130
|
const {
|
|
2131
2131
|
context: r
|
|
2132
|
-
} = this.config, i =
|
|
2132
|
+
} = this.config, i = Ee({
|
|
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, [C(({
|
|
2139
2139
|
spawn: a,
|
|
2140
2140
|
event: c,
|
|
2141
2141
|
self: u
|
|
@@ -2149,8 +2149,8 @@ class ot {
|
|
|
2149
2149
|
* Returns the initial `State` instance, with reference to `self` as an `ActorRef`.
|
|
2150
2150
|
*/
|
|
2151
2151
|
getInitialSnapshot(t, n) {
|
|
2152
|
-
const s =
|
|
2153
|
-
target: [...
|
|
2152
|
+
const s = Vt(n), r = [], i = this.getPreInitialState(t, s, r), o = Ge([{
|
|
2153
|
+
target: [...Zt(this.root)],
|
|
2154
2154
|
source: this.root,
|
|
2155
2155
|
reenter: !0,
|
|
2156
2156
|
actions: [],
|
|
@@ -2159,7 +2159,7 @@ class ot {
|
|
|
2159
2159
|
// TODO: fix
|
|
2160
2160
|
}], i, t, s, !0, r), {
|
|
2161
2161
|
snapshot: a
|
|
2162
|
-
} =
|
|
2162
|
+
} = Le(o, s, t, r);
|
|
2163
2163
|
return a;
|
|
2164
2164
|
}
|
|
2165
2165
|
start(t) {
|
|
@@ -2168,7 +2168,7 @@ class ot {
|
|
|
2168
2168
|
});
|
|
2169
2169
|
}
|
|
2170
2170
|
getStateNodeById(t) {
|
|
2171
|
-
const n =
|
|
2171
|
+
const n = et(t), s = n.slice(1), r = Oe(n[0]) ? n[0].slice(Rs.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
2174
|
return Ie(i, s);
|
|
@@ -2180,15 +2180,15 @@ class ot {
|
|
|
2180
2180
|
return this.definition;
|
|
2181
2181
|
}
|
|
2182
2182
|
getPersistedSnapshot(t, n) {
|
|
2183
|
-
return
|
|
2183
|
+
return Ts(t, n);
|
|
2184
2184
|
}
|
|
2185
2185
|
restoreSnapshot(t, n) {
|
|
2186
2186
|
const s = {}, r = t.children;
|
|
2187
2187
|
Object.keys(r).forEach((c) => {
|
|
2188
|
-
const u = r[c], 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" ? tt(this, d) : d;
|
|
2189
2189
|
if (!f)
|
|
2190
2190
|
return;
|
|
2191
|
-
const m =
|
|
2191
|
+
const m = U(f, {
|
|
2192
2192
|
id: c,
|
|
2193
2193
|
parent: n.self,
|
|
2194
2194
|
syncSnapshot: u.syncSnapshot,
|
|
@@ -2198,10 +2198,10 @@ class ot {
|
|
|
2198
2198
|
});
|
|
2199
2199
|
s[c] = m;
|
|
2200
2200
|
});
|
|
2201
|
-
const i =
|
|
2201
|
+
const i = Ee({
|
|
2202
2202
|
...t,
|
|
2203
2203
|
children: s,
|
|
2204
|
-
_nodes: Array.from(
|
|
2204
|
+
_nodes: Array.from(Se(Ae(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 ot {
|
|
|
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 === nt) {
|
|
2214
2214
|
c[h] = u[d.id];
|
|
2215
2215
|
continue;
|
|
2216
2216
|
}
|
|
@@ -2222,10 +2222,10 @@ class ot {
|
|
|
2222
2222
|
return a(i.context, s), i;
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
|
-
function
|
|
2226
|
-
return new
|
|
2225
|
+
function qs(e, t) {
|
|
2226
|
+
return new ut(e, t);
|
|
2227
2227
|
}
|
|
2228
|
-
function
|
|
2228
|
+
function he({
|
|
2229
2229
|
schemas: e,
|
|
2230
2230
|
actors: t,
|
|
2231
2231
|
actions: n,
|
|
@@ -2233,7 +2233,7 @@ function we({
|
|
|
2233
2233
|
delays: r
|
|
2234
2234
|
}) {
|
|
2235
2235
|
return {
|
|
2236
|
-
createMachine: (i) =>
|
|
2236
|
+
createMachine: (i) => qs({
|
|
2237
2237
|
...i,
|
|
2238
2238
|
schemas: e
|
|
2239
2239
|
}, {
|
|
@@ -2244,181 +2244,187 @@ function we({
|
|
|
2244
2244
|
})
|
|
2245
2245
|
};
|
|
2246
2246
|
}
|
|
2247
|
-
|
|
2247
|
+
function on(e, t) {
|
|
2248
|
+
const n = j(t);
|
|
2249
|
+
if (!n.includes(e.type)) {
|
|
2250
|
+
const s = n.length === 1 ? `type "${n[0]}"` : `one of types "${n.join('", "')}"`;
|
|
2251
|
+
throw new Error(`Expected event ${JSON.stringify(e)} to have ${s}`);
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
function Ms({
|
|
2255
|
+
context: e,
|
|
2256
|
+
event: t
|
|
2257
|
+
}) {
|
|
2258
|
+
if (!t.type.includes("xstate.error.actor"))
|
|
2259
|
+
return e;
|
|
2260
|
+
const n = t;
|
|
2261
|
+
return {
|
|
2262
|
+
errors: [...e.errors, String(n.error).replace("Error: ", "")]
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
function Ls() {
|
|
2266
|
+
return {
|
|
2267
|
+
errors: []
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
function Ps({
|
|
2271
|
+
context: e,
|
|
2272
|
+
event: t
|
|
2273
|
+
}) {
|
|
2274
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
2275
|
+
return e;
|
|
2276
|
+
const n = t;
|
|
2277
|
+
return n.output.type !== "REFRESH_TOKEN_SUCCESS" ? e : {
|
|
2278
|
+
accessToken: n.output.accessToken,
|
|
2279
|
+
ignoreRefreshToken: !1
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
function Us() {
|
|
2283
|
+
return {
|
|
2284
|
+
ignoreRefreshToken: !0
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
function Fs({
|
|
2288
|
+
context: e,
|
|
2289
|
+
event: t
|
|
2290
|
+
}) {
|
|
2291
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
2292
|
+
return e;
|
|
2293
|
+
const n = t;
|
|
2294
|
+
return n.output.type !== "AUTHENTICATE_SUCCESS" ? e : {
|
|
2295
|
+
accessToken: n.output.accessToken,
|
|
2296
|
+
ignoreRefreshToken: !1
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
function Bs() {
|
|
2300
|
+
return {
|
|
2301
|
+
refreshToken: ""
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
function js() {
|
|
2305
|
+
return {
|
|
2306
|
+
user: null,
|
|
2307
|
+
accessToken: "",
|
|
2308
|
+
refreshToken: "",
|
|
2309
|
+
ignoreRefreshToken: !1
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
async function Je(e, t) {
|
|
2248
2313
|
const n = await fetch(e, t);
|
|
2249
2314
|
return n.status === 200 ? n.json() : Promise.resolve({
|
|
2250
2315
|
message: n.statusText,
|
|
2251
2316
|
success: !1
|
|
2252
2317
|
});
|
|
2253
2318
|
}
|
|
2254
|
-
const
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
}),
|
|
2299
|
-
clearErrors: D(() => ({
|
|
2300
|
-
errors: []
|
|
2301
|
-
}))
|
|
2302
|
-
// onLogin: ({ event, self }) => {
|
|
2303
|
-
// console.log('onLogin', event, self);
|
|
2304
|
-
// return raise({ type: 'AFTER_LOGGED_IN' });
|
|
2305
|
-
// if (!event.type.includes('xstate.done.actor')) return;
|
|
2306
|
-
// const e = event as DoneActorEvent<AuthenticateSuccessEvent>;
|
|
2307
|
-
// if (
|
|
2308
|
-
// e.output.type !== 'AUTHENTICATE_SUCCESS' ||
|
|
2309
|
-
// self.getSnapshot().value !== 'loggedIn'
|
|
2310
|
-
// )
|
|
2311
|
-
// return;
|
|
2312
|
-
// // eslint-disable-next-line consistent-return
|
|
2313
|
-
// return raise({ type: 'AFTER_LOGGED_IN' });
|
|
2314
|
-
// // if (!params) return context;
|
|
2315
|
-
// // if (!('callback' in params) || typeof params.callback !== 'function')
|
|
2316
|
-
// // return context;
|
|
2317
|
-
// // params.callback();
|
|
2318
|
-
// // return context;
|
|
2319
|
-
// },
|
|
2320
|
-
},
|
|
2321
|
-
actors: {
|
|
2322
|
-
refreshAccessToken: J(async ({ input: e }) => {
|
|
2323
|
-
let t;
|
|
2324
|
-
if (typeof window > "u") {
|
|
2325
|
-
if (e.context.refreshToken === "")
|
|
2326
|
-
throw new Error("Unauthorized.");
|
|
2327
|
-
try {
|
|
2328
|
-
const s = await Me(
|
|
2329
|
-
e.context.endpoints.ssrRefresh,
|
|
2330
|
-
{
|
|
2331
|
-
method: "POST",
|
|
2332
|
-
mode: "cors",
|
|
2333
|
-
credentials: "include",
|
|
2334
|
-
headers: {
|
|
2335
|
-
Cookie: `refresh_token=${e.context.refreshToken}`,
|
|
2336
|
-
"Content-Type": "application/json",
|
|
2337
|
-
"clicktap-scope": "view",
|
|
2338
|
-
"clicktap-scope-id": "default"
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
);
|
|
2342
|
-
if (typeof s.accessToken > "u")
|
|
2343
|
-
throw new Error("Unauthorized.");
|
|
2344
|
-
return {
|
|
2345
|
-
type: "REFRESH_TOKEN_SUCCESS",
|
|
2346
|
-
accessToken: s.accessToken
|
|
2347
|
-
};
|
|
2348
|
-
} catch (n) {
|
|
2349
|
-
throw console.log(n), new Error("Could not complete refresh request (server)");
|
|
2350
|
-
}
|
|
2351
|
-
} else {
|
|
2352
|
-
t = await Me(
|
|
2353
|
-
e.context.endpoints.refresh,
|
|
2354
|
-
{
|
|
2355
|
-
method: "POST",
|
|
2356
|
-
mode: "cors",
|
|
2357
|
-
credentials: "include",
|
|
2358
|
-
headers: {
|
|
2359
|
-
"Content-Type": "application/json",
|
|
2360
|
-
"clicktap-scope": "view",
|
|
2361
|
-
"clicktap-scope-id": "default"
|
|
2362
|
-
},
|
|
2363
|
-
body: JSON.stringify({
|
|
2364
|
-
grant_type: "refresh_token"
|
|
2365
|
-
// client_id: 'default',
|
|
2366
|
-
// client_secret: 'Password123!',
|
|
2367
|
-
// scope: 'default',
|
|
2368
|
-
}).toString()
|
|
2369
|
-
}
|
|
2370
|
-
);
|
|
2371
|
-
const n = t;
|
|
2372
|
-
if (typeof n.accessToken > "u")
|
|
2373
|
-
throw new Error("Unauthorized.");
|
|
2374
|
-
return {
|
|
2375
|
-
type: "REFRESH_TOKEN_SUCCESS",
|
|
2376
|
-
accessToken: n.accessToken
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
}),
|
|
2380
|
-
authenticate: J(async ({ input: e }) => {
|
|
2381
|
-
var s;
|
|
2382
|
-
const n = await Me(
|
|
2383
|
-
e.context.endpoints.login,
|
|
2384
|
-
{
|
|
2385
|
-
method: "POST",
|
|
2386
|
-
mode: "cors",
|
|
2387
|
-
credentials: "include",
|
|
2388
|
-
headers: {
|
|
2389
|
-
"Content-Type": "application/json",
|
|
2390
|
-
"clicktap-scope": "view",
|
|
2391
|
-
"clicktap-scope-id": "default"
|
|
2392
|
-
},
|
|
2393
|
-
body: JSON.stringify({
|
|
2394
|
-
username: e.username,
|
|
2395
|
-
password: e.password
|
|
2396
|
-
}).toString()
|
|
2319
|
+
const $s = V(async ({ input: e }) => {
|
|
2320
|
+
var n;
|
|
2321
|
+
const t = await Je(e.endpoint.client, {
|
|
2322
|
+
method: "POST",
|
|
2323
|
+
mode: "cors",
|
|
2324
|
+
credentials: "include",
|
|
2325
|
+
headers: {
|
|
2326
|
+
"Content-Type": "application/json",
|
|
2327
|
+
"clicktap-scope": "view",
|
|
2328
|
+
"clicktap-scope-id": "default"
|
|
2329
|
+
},
|
|
2330
|
+
body: JSON.stringify({
|
|
2331
|
+
username: e.username,
|
|
2332
|
+
password: e.password
|
|
2333
|
+
}).toString()
|
|
2334
|
+
});
|
|
2335
|
+
if (!t.success)
|
|
2336
|
+
throw new Error(
|
|
2337
|
+
((n = t.message) == null ? void 0 : n.toString()) ?? "Sign in failed. Please try again."
|
|
2338
|
+
);
|
|
2339
|
+
return {
|
|
2340
|
+
type: "AUTHENTICATE_SUCCESS",
|
|
2341
|
+
user: null,
|
|
2342
|
+
accessToken: t.accessToken ?? ""
|
|
2343
|
+
};
|
|
2344
|
+
}), Vs = V(async ({ input: e }) => {
|
|
2345
|
+
if (!e.endpoint.client || e.endpoint.client === "")
|
|
2346
|
+
throw new Error("No client endpoint provided.");
|
|
2347
|
+
if (!e.endpoint.server || e.endpoint.server === "")
|
|
2348
|
+
throw new Error("No server endpoint provided.");
|
|
2349
|
+
let t;
|
|
2350
|
+
if (typeof window > "u") {
|
|
2351
|
+
if (e.refreshToken === "")
|
|
2352
|
+
throw new Error("Unauthorized.");
|
|
2353
|
+
try {
|
|
2354
|
+
if (t = await Je(e.endpoint.server, {
|
|
2355
|
+
method: "POST",
|
|
2356
|
+
mode: "cors",
|
|
2357
|
+
credentials: "include",
|
|
2358
|
+
headers: {
|
|
2359
|
+
Cookie: `refresh_token=${e.refreshToken}`,
|
|
2360
|
+
"Content-Type": "application/json",
|
|
2361
|
+
"clicktap-scope": "view",
|
|
2362
|
+
"clicktap-scope-id": "default"
|
|
2397
2363
|
}
|
|
2398
|
-
)
|
|
2399
|
-
|
|
2400
|
-
throw new Error(
|
|
2401
|
-
((s = n.message) == null ? void 0 : s.toString()) ?? "Sign in failed. Please try again."
|
|
2402
|
-
);
|
|
2364
|
+
}), typeof t.accessToken > "u")
|
|
2365
|
+
throw new Error("Unauthorized.");
|
|
2403
2366
|
return {
|
|
2404
|
-
type: "
|
|
2405
|
-
|
|
2406
|
-
accessToken: n.accessToken
|
|
2367
|
+
type: "REFRESH_TOKEN_SUCCESS",
|
|
2368
|
+
accessToken: t.accessToken
|
|
2407
2369
|
};
|
|
2408
|
-
})
|
|
2409
|
-
|
|
2370
|
+
} catch (n) {
|
|
2371
|
+
throw console.log(n), new Error("Could not complete refresh request (server)");
|
|
2372
|
+
}
|
|
2373
|
+
} else {
|
|
2374
|
+
if (t = await Je(e.endpoint.client, {
|
|
2410
2375
|
method: "POST",
|
|
2411
2376
|
mode: "cors",
|
|
2412
2377
|
credentials: "include",
|
|
2413
2378
|
headers: {
|
|
2379
|
+
"Content-Type": "application/json",
|
|
2414
2380
|
"clicktap-scope": "view",
|
|
2415
2381
|
"clicktap-scope-id": "default"
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2382
|
+
},
|
|
2383
|
+
/** @todo is this necessary anymore? */
|
|
2384
|
+
body: JSON.stringify({
|
|
2385
|
+
grant_type: "refresh_token"
|
|
2386
|
+
// client_id: 'default',
|
|
2387
|
+
// client_secret: 'Password123!',
|
|
2388
|
+
// scope: 'default',
|
|
2389
|
+
}).toString()
|
|
2390
|
+
}), typeof t.accessToken > "u")
|
|
2391
|
+
throw new Error("Unauthorized.");
|
|
2392
|
+
return {
|
|
2393
|
+
type: "REFRESH_TOKEN_SUCCESS",
|
|
2394
|
+
accessToken: t.accessToken
|
|
2395
|
+
};
|
|
2396
|
+
}
|
|
2397
|
+
}), Hs = V(async ({ input: e }) => (await fetch(e.endpoint.client, {
|
|
2398
|
+
method: "POST",
|
|
2399
|
+
mode: "cors",
|
|
2400
|
+
credentials: "include",
|
|
2401
|
+
headers: {
|
|
2402
|
+
"clicktap-scope": "view",
|
|
2403
|
+
"clicktap-scope-id": "default"
|
|
2404
|
+
}
|
|
2405
|
+
// headers: {
|
|
2406
|
+
// 'Access-Control-Allow-Origin': 'https://middleware-clicktap.local-rmgmedia.com',
|
|
2407
|
+
// 'Access-Control-Allow-Credentials': 'true',
|
|
2408
|
+
// },
|
|
2409
|
+
}), { type: "UNAUTHENTICATE_SUCCESS" })), Ot = he({
|
|
2410
|
+
types: {
|
|
2411
|
+
context: {},
|
|
2412
|
+
events: {},
|
|
2413
|
+
input: {}
|
|
2414
|
+
},
|
|
2415
|
+
actions: {
|
|
2416
|
+
addError: C(Ms),
|
|
2417
|
+
clearErrors: C(Ls),
|
|
2418
|
+
setAccessToken: C(Ps),
|
|
2419
|
+
setIgnoreRefreshToken: C(Us),
|
|
2420
|
+
setUserContext: C(Fs),
|
|
2421
|
+
unsetRefreshToken: C(Bs),
|
|
2422
|
+
unsetUserContext: C(js)
|
|
2423
|
+
},
|
|
2424
|
+
actors: {
|
|
2425
|
+
authenticate: $s,
|
|
2426
|
+
refreshAccessToken: Vs,
|
|
2427
|
+
unauthenticate: Hs
|
|
2422
2428
|
}
|
|
2423
2429
|
}).createMachine({
|
|
2424
2430
|
id: "auth",
|
|
@@ -2448,11 +2454,13 @@ const bt = we({
|
|
|
2448
2454
|
authenticating: {
|
|
2449
2455
|
invoke: {
|
|
2450
2456
|
src: "authenticate",
|
|
2451
|
-
input: ({ context: e, event: t }) => t
|
|
2452
|
-
|
|
2457
|
+
input: ({ context: e, event: t }) => (on(t, "LOGIN"), {
|
|
2458
|
+
endpoint: {
|
|
2459
|
+
client: e.endpoints.login
|
|
2460
|
+
},
|
|
2453
2461
|
username: t.username,
|
|
2454
2462
|
password: t.password
|
|
2455
|
-
},
|
|
2463
|
+
}),
|
|
2456
2464
|
onDone: [
|
|
2457
2465
|
{
|
|
2458
2466
|
actions: "setUserContext",
|
|
@@ -2471,7 +2479,9 @@ const bt = we({
|
|
|
2471
2479
|
invoke: {
|
|
2472
2480
|
src: "unauthenticate",
|
|
2473
2481
|
input: ({ context: e }) => ({
|
|
2474
|
-
|
|
2482
|
+
endpoint: {
|
|
2483
|
+
client: e.endpoints.logout
|
|
2484
|
+
}
|
|
2475
2485
|
}),
|
|
2476
2486
|
onDone: [
|
|
2477
2487
|
{
|
|
@@ -2491,7 +2501,12 @@ const bt = we({
|
|
|
2491
2501
|
invoke: {
|
|
2492
2502
|
src: "refreshAccessToken",
|
|
2493
2503
|
input: ({ context: e }) => ({
|
|
2494
|
-
|
|
2504
|
+
accessToken: e.accessToken,
|
|
2505
|
+
endpoint: {
|
|
2506
|
+
client: e.endpoints.refresh,
|
|
2507
|
+
server: e.endpoints.ssrRefresh
|
|
2508
|
+
},
|
|
2509
|
+
refreshToken: e.refreshToken
|
|
2495
2510
|
}),
|
|
2496
2511
|
onDone: [
|
|
2497
2512
|
{
|
|
@@ -2548,13 +2563,13 @@ const bt = we({
|
|
|
2548
2563
|
// },
|
|
2549
2564
|
// },
|
|
2550
2565
|
}
|
|
2551
|
-
}),
|
|
2566
|
+
}), an = be(
|
|
2552
2567
|
{}
|
|
2553
|
-
),
|
|
2554
|
-
const e =
|
|
2568
|
+
), di = () => {
|
|
2569
|
+
const e = Ne(an), [t, n] = Ke(
|
|
2555
2570
|
typeof window < "u" && e.getSnapshot().value === "loggedIn"
|
|
2556
2571
|
);
|
|
2557
|
-
return
|
|
2572
|
+
return Ze(() => {
|
|
2558
2573
|
if (typeof window > "u")
|
|
2559
2574
|
return;
|
|
2560
2575
|
const s = e.subscribe((r) => {
|
|
@@ -2564,19 +2579,19 @@ const bt = we({
|
|
|
2564
2579
|
s.unsubscribe();
|
|
2565
2580
|
};
|
|
2566
2581
|
}, [e]), { authActor: e, isLoggedIn: t };
|
|
2567
|
-
},
|
|
2582
|
+
}, li = async (e = "", t = {
|
|
2568
2583
|
inspect: void 0,
|
|
2569
2584
|
endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
|
|
2570
2585
|
}) => typeof window < "u" ? (console.warn(
|
|
2571
2586
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
2572
|
-
),
|
|
2587
|
+
), U(Ot, {
|
|
2573
2588
|
inspect: t.inspect,
|
|
2574
2589
|
input: {
|
|
2575
2590
|
initialContext: {
|
|
2576
2591
|
endpoints: t.endpoints
|
|
2577
2592
|
}
|
|
2578
2593
|
}
|
|
2579
|
-
}).start()) :
|
|
2594
|
+
}).start()) : U(Ot, {
|
|
2580
2595
|
input: {
|
|
2581
2596
|
initialContext: {
|
|
2582
2597
|
endpoints: t.endpoints,
|
|
@@ -2585,387 +2600,99 @@ const bt = we({
|
|
|
2585
2600
|
},
|
|
2586
2601
|
inspect: t.inspect
|
|
2587
2602
|
}).start();
|
|
2588
|
-
function
|
|
2589
|
-
return /* @__PURE__ */
|
|
2603
|
+
function hi({ actor: e, children: t }) {
|
|
2604
|
+
return /* @__PURE__ */ we(an.Provider, { value: e, children: t });
|
|
2590
2605
|
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
}
|
|
2610
|
-
}).
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
guard: ({ context: e }) => e.elapsed >= e.duration
|
|
2655
|
-
}
|
|
2656
|
-
],
|
|
2657
|
-
on: {
|
|
2658
|
-
TICK: {
|
|
2659
|
-
actions: D(({ context: e, event: t }) => t.type !== "TICK" ? e : {
|
|
2660
|
-
elapsed: e.elapsed + e.interval
|
|
2661
|
-
})
|
|
2662
|
-
},
|
|
2663
|
-
PAUSE_TIMER: { target: "paused" }
|
|
2664
|
-
}
|
|
2665
|
-
},
|
|
2666
|
-
completed: {
|
|
2667
|
-
type: "final"
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
}), Kr = we({
|
|
2671
|
-
actors: {
|
|
2672
|
-
timer: Rs
|
|
2673
|
-
},
|
|
2674
|
-
types: {
|
|
2675
|
-
context: {},
|
|
2676
|
-
events: {},
|
|
2677
|
-
input: {}
|
|
2678
|
-
},
|
|
2679
|
-
actions: {
|
|
2680
|
-
addItem: D(({ context: e, event: t }) => {
|
|
2681
|
-
if (t.type !== "ADD_ITEM")
|
|
2682
|
-
return e;
|
|
2683
|
-
const n = `notification-${Ds()}`, s = t.duration ?? e.duration, r = _n(t.item, {
|
|
2684
|
-
duration: s,
|
|
2685
|
-
id: n,
|
|
2686
|
-
key: t.item.key ?? n,
|
|
2687
|
-
...t.item.props
|
|
2688
|
-
}), i = {
|
|
2689
|
-
duration: s,
|
|
2690
|
-
id: n,
|
|
2691
|
-
element: r
|
|
2692
|
-
}, o = e.items;
|
|
2693
|
-
return e.order === "desc" ? o.push(i) : o.unshift(i), {
|
|
2694
|
-
items: o,
|
|
2695
|
-
activeItem: n
|
|
2696
|
-
};
|
|
2697
|
-
}),
|
|
2698
|
-
removeItem: D(({ context: e, event: t }) => {
|
|
2699
|
-
if (t.type !== "REMOVE_ITEM" && t.type !== "xstate.done.actor.timer")
|
|
2700
|
-
return e;
|
|
2701
|
-
const n = e.items;
|
|
2702
|
-
return e.order === "desc" ? (n.pop(), {
|
|
2703
|
-
items: n,
|
|
2704
|
-
activeItem: n.length > 0 ? n[n.length - 1].id : null
|
|
2705
|
-
}) : (n.shift(), {
|
|
2706
|
-
items: n,
|
|
2707
|
-
activeItem: n.length > 0 ? n[0].id : null
|
|
2708
|
-
});
|
|
2709
|
-
})
|
|
2710
|
-
},
|
|
2711
|
-
delays: {
|
|
2712
|
-
ITEM_TIMEOUT: ({ context: e }) => e.items[e.items.length - 1].duration ?? e.duration
|
|
2713
|
-
},
|
|
2714
|
-
guards: {
|
|
2715
|
-
itemHasTimeout: ({ context: e }) => e.items[e.items.length - 1].duration > 0 || e.duration > 0
|
|
2716
|
-
}
|
|
2717
|
-
}).createMachine({
|
|
2718
|
-
id: "toast",
|
|
2719
|
-
context: { items: [], order: "desc", duration: 0, activeItem: null },
|
|
2720
|
-
initial: "idle",
|
|
2721
|
-
states: {
|
|
2722
|
-
idle: {
|
|
2723
|
-
on: {
|
|
2724
|
-
ADD_ITEM: {
|
|
2725
|
-
target: "adding"
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
},
|
|
2729
|
-
active: {
|
|
2730
|
-
invoke: {
|
|
2731
|
-
// id required to send events to
|
|
2732
|
-
id: "timer",
|
|
2733
|
-
src: "timer",
|
|
2734
|
-
input: ({ context: e }) => ({
|
|
2735
|
-
initialContext: {
|
|
2736
|
-
duration: e.items[e.items.length - 1].duration ?? e.duration
|
|
2737
|
-
}
|
|
2738
|
-
}),
|
|
2739
|
-
onDone: {
|
|
2740
|
-
target: "removing",
|
|
2741
|
-
guard: "itemHasTimeout"
|
|
2742
|
-
}
|
|
2743
|
-
// data: Object.assign(timerMachine.context, {
|
|
2744
|
-
// duration: (context: ToastMachineContext) =>
|
|
2745
|
-
// // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
2746
|
-
// context.items[context.items.length - 1].duration ??
|
|
2747
|
-
// context.duration,
|
|
2748
|
-
// }),
|
|
2749
|
-
},
|
|
2750
|
-
on: {
|
|
2751
|
-
ADD_ITEM: {
|
|
2752
|
-
// actions: sendTo('timer', 'PAUSE_TIMER'),
|
|
2753
|
-
target: "adding"
|
|
2754
|
-
},
|
|
2755
|
-
REMOVE_ITEM: {
|
|
2756
|
-
target: "removing"
|
|
2757
|
-
},
|
|
2758
|
-
SET_IDLE: {
|
|
2759
|
-
target: "idle"
|
|
2760
|
-
},
|
|
2761
|
-
RESUME_TIMER: {
|
|
2762
|
-
actions: xt("timer", { type: "RESUME_TIMER" })
|
|
2763
|
-
// cond: (context) => context.duration > 0,
|
|
2764
|
-
},
|
|
2765
|
-
PAUSE_TIMER: {
|
|
2766
|
-
actions: xt("timer", { type: "PAUSE_TIMER" })
|
|
2767
|
-
// cond: (context) => context.duration > 0,
|
|
2768
|
-
}
|
|
2769
|
-
}
|
|
2770
|
-
// after: {
|
|
2771
|
-
// ITEM_TIMEOUT: {
|
|
2772
|
-
// target: 'removing',
|
|
2773
|
-
// cond: 'itemHasTimeout',
|
|
2774
|
-
// },
|
|
2775
|
-
// },
|
|
2776
|
-
},
|
|
2777
|
-
adding: {
|
|
2778
|
-
entry: ["addItem"],
|
|
2779
|
-
on: {
|
|
2780
|
-
SET_IDLE: {
|
|
2781
|
-
target: "idle"
|
|
2782
|
-
},
|
|
2783
|
-
SET_ACTIVE: {
|
|
2784
|
-
target: "active"
|
|
2785
|
-
}
|
|
2786
|
-
}
|
|
2787
|
-
},
|
|
2788
|
-
removing: {
|
|
2789
|
-
entry: "removeItem",
|
|
2790
|
-
on: {
|
|
2791
|
-
SET_IDLE: {
|
|
2792
|
-
target: "idle"
|
|
2793
|
-
},
|
|
2794
|
-
SET_ACTIVE: {
|
|
2795
|
-
target: "active"
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
|
-
}), on = Xe({}), Zr = () => Qe(on);
|
|
2801
|
-
function ei({
|
|
2802
|
-
children: e,
|
|
2803
|
-
actor: t
|
|
2804
|
-
}) {
|
|
2805
|
-
return /* @__PURE__ */ Ye(on.Provider, { value: t, children: e });
|
|
2806
|
-
}
|
|
2807
|
-
function Ms({
|
|
2808
|
-
context: e,
|
|
2809
|
-
event: t
|
|
2810
|
-
}) {
|
|
2811
|
-
if (!t.type.includes("xstate.done.actor"))
|
|
2812
|
-
return e;
|
|
2813
|
-
const n = t;
|
|
2814
|
-
return n.output.type !== "ADD_ITEMS_SUCCESS" ? e : {
|
|
2815
|
-
quote: { ...e.quote, ...n.output.quote },
|
|
2816
|
-
itemsAdded: n.output.itemsAdded
|
|
2817
|
-
};
|
|
2818
|
-
}
|
|
2819
|
-
function qs({
|
|
2820
|
-
event: e
|
|
2821
|
-
}) {
|
|
2822
|
-
if (!e.type.includes("xstate.done.actor"))
|
|
2823
|
-
return { type: "EMIT_ADD_ITEMS", itemsAdded: [] };
|
|
2824
|
-
const t = e;
|
|
2825
|
-
return t.output.type !== "ADD_ITEMS_SUCCESS" ? { type: "EMIT_ADD_ITEMS", itemsAdded: [] } : {
|
|
2826
|
-
type: "EMIT_ADD_ITEMS",
|
|
2827
|
-
itemsAdded: t.output.itemsAdded
|
|
2828
|
-
};
|
|
2829
|
-
}
|
|
2830
|
-
function Ls({
|
|
2831
|
-
event: e
|
|
2832
|
-
}) {
|
|
2833
|
-
if (!e.type.includes("xstate.done.actor"))
|
|
2834
|
-
return { type: "EMIT_REMOVE_ITEMS", itemsRemoved: [] };
|
|
2835
|
-
const t = e;
|
|
2836
|
-
return t.output.type !== "REMOVE_ITEMS_SUCCESS" ? { type: "EMIT_REMOVE_ITEMS", itemsRemoved: [] } : {
|
|
2837
|
-
type: "EMIT_REMOVE_ITEMS",
|
|
2838
|
-
itemsRemoved: t.output.itemsRemoved
|
|
2839
|
-
};
|
|
2840
|
-
}
|
|
2841
|
-
function Us({
|
|
2842
|
-
event: e
|
|
2843
|
-
}) {
|
|
2844
|
-
if (!e.type.includes("xstate.done.actor"))
|
|
2845
|
-
return {
|
|
2846
|
-
type: "EMIT_UPDATE_ITEMS",
|
|
2847
|
-
itemsUpdated: []
|
|
2848
|
-
};
|
|
2849
|
-
const t = e;
|
|
2850
|
-
return t.output.type !== "UPDATE_ITEMS_SUCCESS" ? {
|
|
2851
|
-
type: "EMIT_UPDATE_ITEMS",
|
|
2852
|
-
itemsUpdated: []
|
|
2853
|
-
} : {
|
|
2854
|
-
type: "EMIT_UPDATE_ITEMS",
|
|
2855
|
-
itemsUpdated: t.output.itemsUpdated
|
|
2856
|
-
};
|
|
2857
|
-
}
|
|
2858
|
-
function Ps({
|
|
2859
|
-
context: e,
|
|
2860
|
-
event: t
|
|
2861
|
-
}) {
|
|
2862
|
-
if (!t.type.includes("xstate.done.actor"))
|
|
2863
|
-
return e;
|
|
2864
|
-
const n = t;
|
|
2865
|
-
return n.output.type !== "REMOVE_ITEMS_SUCCESS" ? e : {
|
|
2866
|
-
quote: { ...e.quote, ...n.output.quote },
|
|
2867
|
-
itemsRemoved: n.output.itemsRemoved
|
|
2868
|
-
};
|
|
2869
|
-
}
|
|
2870
|
-
function Fs({
|
|
2871
|
-
context: e,
|
|
2872
|
-
event: t
|
|
2873
|
-
}) {
|
|
2874
|
-
if (!t.type.includes("xstate.done.actor"))
|
|
2875
|
-
return e;
|
|
2876
|
-
const n = t;
|
|
2877
|
-
return n.output.type !== "REFRESH_SUCCESS" ? e : {
|
|
2878
|
-
quote: { ...e.quote, ...n.output.quote }
|
|
2879
|
-
};
|
|
2880
|
-
}
|
|
2881
|
-
function Bs({
|
|
2882
|
-
context: e,
|
|
2883
|
-
event: t
|
|
2884
|
-
}) {
|
|
2885
|
-
if (!t.type.includes("xstate.done.actor"))
|
|
2886
|
-
return e;
|
|
2887
|
-
const n = t;
|
|
2888
|
-
return n.output.type !== "UPDATE_ITEMS_SUCCESS" ? e : {
|
|
2889
|
-
quote: { ...e.quote, ...n.output.quote },
|
|
2890
|
-
itemsUpdated: n.output.itemsUpdated
|
|
2891
|
-
};
|
|
2892
|
-
}
|
|
2893
|
-
const at = JSON, js = (e) => e.toUpperCase(), $s = (e) => {
|
|
2894
|
-
const t = {};
|
|
2895
|
-
return e.forEach((n, s) => {
|
|
2896
|
-
t[s] = n;
|
|
2897
|
-
}), t;
|
|
2898
|
-
}, Vs = (e, t, n) => e.document ? e : {
|
|
2899
|
-
document: e,
|
|
2900
|
-
variables: t,
|
|
2901
|
-
requestHeaders: n,
|
|
2902
|
-
signal: void 0
|
|
2903
|
-
}, Hs = (e, t, n) => e.query ? e : {
|
|
2904
|
-
query: e,
|
|
2905
|
-
variables: t,
|
|
2906
|
-
requestHeaders: n,
|
|
2907
|
-
signal: void 0
|
|
2908
|
-
}, Gs = (e, t) => e.documents ? e : {
|
|
2909
|
-
documents: e,
|
|
2910
|
-
requestHeaders: t,
|
|
2911
|
-
signal: void 0
|
|
2912
|
-
}, zs = (e, t, ...n) => {
|
|
2913
|
-
const [s, r] = n;
|
|
2914
|
-
return e.document ? e : {
|
|
2915
|
-
url: e,
|
|
2916
|
-
document: t,
|
|
2917
|
-
variables: s,
|
|
2918
|
-
requestHeaders: r,
|
|
2919
|
-
signal: void 0
|
|
2920
|
-
};
|
|
2921
|
-
};
|
|
2922
|
-
function Ee(e, t) {
|
|
2923
|
-
if (!!!e)
|
|
2924
|
-
throw new Error(t);
|
|
2925
|
-
}
|
|
2926
|
-
function Js(e) {
|
|
2927
|
-
return typeof e == "object" && e !== null;
|
|
2928
|
-
}
|
|
2929
|
-
function Ys(e, t) {
|
|
2930
|
-
if (!!!e)
|
|
2931
|
-
throw new Error(
|
|
2932
|
-
t ?? "Unexpected invariant triggered."
|
|
2933
|
-
);
|
|
2934
|
-
}
|
|
2935
|
-
const Xs = /\r\n|[\n\r]/g;
|
|
2936
|
-
function He(e, t) {
|
|
2937
|
-
let n = 0, s = 1;
|
|
2938
|
-
for (const r of e.body.matchAll(Xs)) {
|
|
2939
|
-
if (typeof r.index == "number" || Ys(!1), r.index >= t)
|
|
2940
|
-
break;
|
|
2941
|
-
n = r.index + r[0].length, s += 1;
|
|
2606
|
+
function zs({
|
|
2607
|
+
context: e,
|
|
2608
|
+
event: t
|
|
2609
|
+
}) {
|
|
2610
|
+
var r, i;
|
|
2611
|
+
if (!t.type.includes("xstate.done.actor") || t.output.type !== "SUBMIT_STEP_DATA_SUCCESS")
|
|
2612
|
+
return e;
|
|
2613
|
+
const s = (i = (r = e.steps) == null ? void 0 : r.find(
|
|
2614
|
+
(o) => o.name === e.currentStep
|
|
2615
|
+
)) == null ? void 0 : i.next;
|
|
2616
|
+
return s ? (console.log("nextStep currentStep", e.currentStep), console.log("nextStep next", s), {
|
|
2617
|
+
currentStep: s ?? e.currentStep
|
|
2618
|
+
}) : e;
|
|
2619
|
+
}
|
|
2620
|
+
const dt = JSON, Gs = (e) => e.toUpperCase(), Js = (e) => {
|
|
2621
|
+
const t = {};
|
|
2622
|
+
return e.forEach((n, s) => {
|
|
2623
|
+
t[s] = n;
|
|
2624
|
+
}), t;
|
|
2625
|
+
}, Ys = (e, t, n) => e.document ? e : {
|
|
2626
|
+
document: e,
|
|
2627
|
+
variables: t,
|
|
2628
|
+
requestHeaders: n,
|
|
2629
|
+
signal: void 0
|
|
2630
|
+
}, Xs = (e, t, n) => e.query ? e : {
|
|
2631
|
+
query: e,
|
|
2632
|
+
variables: t,
|
|
2633
|
+
requestHeaders: n,
|
|
2634
|
+
signal: void 0
|
|
2635
|
+
}, Qs = (e, t) => e.documents ? e : {
|
|
2636
|
+
documents: e,
|
|
2637
|
+
requestHeaders: t,
|
|
2638
|
+
signal: void 0
|
|
2639
|
+
}, Ws = (e, t, ...n) => {
|
|
2640
|
+
const [s, r] = n;
|
|
2641
|
+
return e.document ? e : {
|
|
2642
|
+
url: e,
|
|
2643
|
+
document: t,
|
|
2644
|
+
variables: s,
|
|
2645
|
+
requestHeaders: r,
|
|
2646
|
+
signal: void 0
|
|
2647
|
+
};
|
|
2648
|
+
};
|
|
2649
|
+
function ve(e, t) {
|
|
2650
|
+
if (!!!e)
|
|
2651
|
+
throw new Error(t);
|
|
2652
|
+
}
|
|
2653
|
+
function Ks(e) {
|
|
2654
|
+
return typeof e == "object" && e !== null;
|
|
2655
|
+
}
|
|
2656
|
+
function Zs(e, t) {
|
|
2657
|
+
if (!!!e)
|
|
2658
|
+
throw new Error(
|
|
2659
|
+
t ?? "Unexpected invariant triggered."
|
|
2660
|
+
);
|
|
2661
|
+
}
|
|
2662
|
+
const er = /\r\n|[\n\r]/g;
|
|
2663
|
+
function Ye(e, t) {
|
|
2664
|
+
let n = 0, s = 1;
|
|
2665
|
+
for (const r of e.body.matchAll(er)) {
|
|
2666
|
+
if (typeof r.index == "number" || Zs(!1), r.index >= t)
|
|
2667
|
+
break;
|
|
2668
|
+
n = r.index + r[0].length, s += 1;
|
|
2942
2669
|
}
|
|
2943
2670
|
return {
|
|
2944
2671
|
line: s,
|
|
2945
2672
|
column: t + 1 - n
|
|
2946
2673
|
};
|
|
2947
2674
|
}
|
|
2948
|
-
function
|
|
2949
|
-
return
|
|
2675
|
+
function tr(e) {
|
|
2676
|
+
return cn(
|
|
2950
2677
|
e.source,
|
|
2951
|
-
|
|
2678
|
+
Ye(e.source, e.start)
|
|
2952
2679
|
);
|
|
2953
2680
|
}
|
|
2954
|
-
function
|
|
2681
|
+
function cn(e, t) {
|
|
2955
2682
|
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}
|
|
2956
2683
|
`, h = s.split(/\r\n|[\n\r]/g), d = h[r];
|
|
2957
2684
|
if (d.length > 120) {
|
|
2958
2685
|
const f = Math.floor(c / 80), m = c % 80, y = [];
|
|
2959
2686
|
for (let v = 0; v < d.length; v += 80)
|
|
2960
2687
|
y.push(d.slice(v, v + 80));
|
|
2961
|
-
return u +
|
|
2688
|
+
return u + Ct([
|
|
2962
2689
|
[`${o} |`, y[0]],
|
|
2963
2690
|
...y.slice(1, f + 1).map((v) => ["|", v]),
|
|
2964
2691
|
["|", "^".padStart(m)],
|
|
2965
2692
|
["|", y[f + 1]]
|
|
2966
2693
|
]);
|
|
2967
2694
|
}
|
|
2968
|
-
return u +
|
|
2695
|
+
return u + Ct([
|
|
2969
2696
|
// Lines specified like this: ["prefix", "string"],
|
|
2970
2697
|
[`${o - 1} |`, h[r - 1]],
|
|
2971
2698
|
[`${o} |`, d],
|
|
@@ -2973,12 +2700,12 @@ function an(e, t) {
|
|
|
2973
2700
|
[`${o + 1} |`, h[r + 1]]
|
|
2974
2701
|
]);
|
|
2975
2702
|
}
|
|
2976
|
-
function
|
|
2703
|
+
function Ct(e) {
|
|
2977
2704
|
const t = e.filter(([s, r]) => r !== void 0), n = Math.max(...t.map(([s]) => s.length));
|
|
2978
2705
|
return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
|
|
2979
2706
|
`);
|
|
2980
2707
|
}
|
|
2981
|
-
function
|
|
2708
|
+
function nr(e) {
|
|
2982
2709
|
const t = e[0];
|
|
2983
2710
|
return t == null || "kind" in t || "length" in t ? {
|
|
2984
2711
|
nodes: t,
|
|
@@ -2989,7 +2716,7 @@ function Ws(e) {
|
|
|
2989
2716
|
extensions: e[5]
|
|
2990
2717
|
} : t;
|
|
2991
2718
|
}
|
|
2992
|
-
class
|
|
2719
|
+
class lt extends Error {
|
|
2993
2720
|
/**
|
|
2994
2721
|
* An array of `{ line, column }` locations within the source GraphQL document
|
|
2995
2722
|
* which correspond to this error.
|
|
@@ -3030,15 +2757,15 @@ class ct extends Error {
|
|
|
3030
2757
|
*/
|
|
3031
2758
|
constructor(t, ...n) {
|
|
3032
2759
|
var s, r, i;
|
|
3033
|
-
const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } =
|
|
3034
|
-
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes =
|
|
2760
|
+
const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = nr(n);
|
|
2761
|
+
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = kt(
|
|
3035
2762
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
3036
2763
|
);
|
|
3037
|
-
const f =
|
|
2764
|
+
const f = kt(
|
|
3038
2765
|
(s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
|
|
3039
2766
|
);
|
|
3040
|
-
this.source = a ?? (f == null || (r = f[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (f == null ? void 0 : f.map((y) => y.start)), this.locations = c && a ? c.map((y) =>
|
|
3041
|
-
const m =
|
|
2767
|
+
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) => Ye(a, y)) : f == null ? void 0 : f.map((y) => Ye(y.source, y.start));
|
|
2768
|
+
const m = Ks(
|
|
3042
2769
|
h == null ? void 0 : h.extensions
|
|
3043
2770
|
) ? h == null ? void 0 : h.extensions : void 0;
|
|
3044
2771
|
this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
@@ -3065,7 +2792,7 @@ class ct extends Error {
|
|
|
3065
2792
|
value: h.stack,
|
|
3066
2793
|
writable: !0,
|
|
3067
2794
|
configurable: !0
|
|
3068
|
-
}) : Error.captureStackTrace ? Error.captureStackTrace(this,
|
|
2795
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, lt) : Object.defineProperty(this, "stack", {
|
|
3069
2796
|
value: Error().stack,
|
|
3070
2797
|
writable: !0,
|
|
3071
2798
|
configurable: !0
|
|
@@ -3080,12 +2807,12 @@ class ct extends Error {
|
|
|
3080
2807
|
for (const n of this.nodes)
|
|
3081
2808
|
n.loc && (t += `
|
|
3082
2809
|
|
|
3083
|
-
` +
|
|
2810
|
+
` + tr(n.loc));
|
|
3084
2811
|
else if (this.source && this.locations)
|
|
3085
2812
|
for (const n of this.locations)
|
|
3086
2813
|
t += `
|
|
3087
2814
|
|
|
3088
|
-
` +
|
|
2815
|
+
` + cn(this.source, n);
|
|
3089
2816
|
return t;
|
|
3090
2817
|
}
|
|
3091
2818
|
toJSON() {
|
|
@@ -3095,16 +2822,16 @@ class ct extends Error {
|
|
|
3095
2822
|
return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
|
|
3096
2823
|
}
|
|
3097
2824
|
}
|
|
3098
|
-
function
|
|
2825
|
+
function kt(e) {
|
|
3099
2826
|
return e === void 0 || e.length === 0 ? void 0 : e;
|
|
3100
2827
|
}
|
|
3101
2828
|
function b(e, t, n) {
|
|
3102
|
-
return new
|
|
2829
|
+
return new lt(`Syntax Error: ${n}`, {
|
|
3103
2830
|
source: e,
|
|
3104
2831
|
positions: [t]
|
|
3105
2832
|
});
|
|
3106
2833
|
}
|
|
3107
|
-
class
|
|
2834
|
+
class sr {
|
|
3108
2835
|
/**
|
|
3109
2836
|
* The character offset at which this Node begins.
|
|
3110
2837
|
*/
|
|
@@ -3133,7 +2860,7 @@ class Ks {
|
|
|
3133
2860
|
};
|
|
3134
2861
|
}
|
|
3135
2862
|
}
|
|
3136
|
-
class
|
|
2863
|
+
class un {
|
|
3137
2864
|
/**
|
|
3138
2865
|
* The kind of Token.
|
|
3139
2866
|
*/
|
|
@@ -3175,7 +2902,7 @@ class cn {
|
|
|
3175
2902
|
};
|
|
3176
2903
|
}
|
|
3177
2904
|
}
|
|
3178
|
-
const
|
|
2905
|
+
const dn = {
|
|
3179
2906
|
Name: [],
|
|
3180
2907
|
Document: ["definitions"],
|
|
3181
2908
|
OperationDefinition: [
|
|
@@ -3249,45 +2976,45 @@ const un = {
|
|
|
3249
2976
|
UnionTypeExtension: ["name", "directives", "types"],
|
|
3250
2977
|
EnumTypeExtension: ["name", "directives", "values"],
|
|
3251
2978
|
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
3252
|
-
},
|
|
3253
|
-
function
|
|
2979
|
+
}, rr = new Set(Object.keys(dn));
|
|
2980
|
+
function Dt(e) {
|
|
3254
2981
|
const t = e == null ? void 0 : e.kind;
|
|
3255
|
-
return typeof t == "string" &&
|
|
2982
|
+
return typeof t == "string" && rr.has(t);
|
|
3256
2983
|
}
|
|
3257
2984
|
var ee;
|
|
3258
2985
|
(function(e) {
|
|
3259
2986
|
e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
|
|
3260
2987
|
})(ee || (ee = {}));
|
|
3261
|
-
var
|
|
2988
|
+
var Xe;
|
|
3262
2989
|
(function(e) {
|
|
3263
2990
|
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";
|
|
3264
|
-
})(
|
|
2991
|
+
})(Xe || (Xe = {}));
|
|
3265
2992
|
var T;
|
|
3266
2993
|
(function(e) {
|
|
3267
2994
|
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";
|
|
3268
2995
|
})(T || (T = {}));
|
|
3269
|
-
function
|
|
2996
|
+
function Qe(e) {
|
|
3270
2997
|
return e === 9 || e === 32;
|
|
3271
2998
|
}
|
|
3272
2999
|
function de(e) {
|
|
3273
3000
|
return e >= 48 && e <= 57;
|
|
3274
3001
|
}
|
|
3275
|
-
function
|
|
3002
|
+
function ln(e) {
|
|
3276
3003
|
return e >= 97 && e <= 122 || // A-Z
|
|
3277
3004
|
e >= 65 && e <= 90;
|
|
3278
3005
|
}
|
|
3279
|
-
function
|
|
3280
|
-
return
|
|
3006
|
+
function hn(e) {
|
|
3007
|
+
return ln(e) || e === 95;
|
|
3281
3008
|
}
|
|
3282
|
-
function
|
|
3283
|
-
return
|
|
3009
|
+
function ir(e) {
|
|
3010
|
+
return ln(e) || de(e) || e === 95;
|
|
3284
3011
|
}
|
|
3285
|
-
function
|
|
3012
|
+
function or(e) {
|
|
3286
3013
|
var t;
|
|
3287
3014
|
let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
|
|
3288
3015
|
for (let o = 0; o < e.length; ++o) {
|
|
3289
3016
|
var i;
|
|
3290
|
-
const a = e[o], c =
|
|
3017
|
+
const a = e[o], c = ar(a);
|
|
3291
3018
|
c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
|
|
3292
3019
|
}
|
|
3293
3020
|
return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
|
|
@@ -3295,17 +3022,17 @@ function tr(e) {
|
|
|
3295
3022
|
r + 1
|
|
3296
3023
|
);
|
|
3297
3024
|
}
|
|
3298
|
-
function
|
|
3025
|
+
function ar(e) {
|
|
3299
3026
|
let t = 0;
|
|
3300
|
-
for (; t < e.length &&
|
|
3027
|
+
for (; t < e.length && Qe(e.charCodeAt(t)); )
|
|
3301
3028
|
++t;
|
|
3302
3029
|
return t;
|
|
3303
3030
|
}
|
|
3304
|
-
function
|
|
3305
|
-
const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 ||
|
|
3031
|
+
function cr(e, t) {
|
|
3032
|
+
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 || Qe(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
|
|
3306
3033
|
(!r || e.length > 70 || u || i || o);
|
|
3307
3034
|
let d = "";
|
|
3308
|
-
const f = r &&
|
|
3035
|
+
const f = r && Qe(e.charCodeAt(0));
|
|
3309
3036
|
return (h && !f || i) && (d += `
|
|
3310
3037
|
`), d += n, (h || u) && (d += `
|
|
3311
3038
|
`), '"""' + d + '"""';
|
|
@@ -3314,7 +3041,7 @@ var p;
|
|
|
3314
3041
|
(function(e) {
|
|
3315
3042
|
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";
|
|
3316
3043
|
})(p || (p = {}));
|
|
3317
|
-
class
|
|
3044
|
+
class ur {
|
|
3318
3045
|
/**
|
|
3319
3046
|
* The previously focused non-ignored token.
|
|
3320
3047
|
*/
|
|
@@ -3328,7 +3055,7 @@ class rr {
|
|
|
3328
3055
|
* The character offset at which the current line begins.
|
|
3329
3056
|
*/
|
|
3330
3057
|
constructor(t) {
|
|
3331
|
-
const n = new
|
|
3058
|
+
const n = new un(p.SOF, 0, 0, 0, 0);
|
|
3332
3059
|
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
3333
3060
|
}
|
|
3334
3061
|
get [Symbol.toStringTag]() {
|
|
@@ -3351,26 +3078,26 @@ class rr {
|
|
|
3351
3078
|
if (t.next)
|
|
3352
3079
|
t = t.next;
|
|
3353
3080
|
else {
|
|
3354
|
-
const n =
|
|
3081
|
+
const n = lr(this, t.end);
|
|
3355
3082
|
t.next = n, n.prev = t, t = n;
|
|
3356
3083
|
}
|
|
3357
3084
|
while (t.kind === p.COMMENT);
|
|
3358
3085
|
return t;
|
|
3359
3086
|
}
|
|
3360
3087
|
}
|
|
3361
|
-
function
|
|
3088
|
+
function dr(e) {
|
|
3362
3089
|
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;
|
|
3363
3090
|
}
|
|
3364
3091
|
function re(e) {
|
|
3365
3092
|
return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
|
|
3366
3093
|
}
|
|
3367
|
-
function
|
|
3368
|
-
return
|
|
3094
|
+
function Ce(e, t) {
|
|
3095
|
+
return fn(e.charCodeAt(t)) && pn(e.charCodeAt(t + 1));
|
|
3369
3096
|
}
|
|
3370
|
-
function
|
|
3097
|
+
function fn(e) {
|
|
3371
3098
|
return e >= 55296 && e <= 56319;
|
|
3372
3099
|
}
|
|
3373
|
-
function
|
|
3100
|
+
function pn(e) {
|
|
3374
3101
|
return e >= 56320 && e <= 57343;
|
|
3375
3102
|
}
|
|
3376
3103
|
function X(e, t) {
|
|
@@ -3385,9 +3112,9 @@ function X(e, t) {
|
|
|
3385
3112
|
}
|
|
3386
3113
|
function w(e, t, n, s, r) {
|
|
3387
3114
|
const i = e.line, o = 1 + n - e.lineStart;
|
|
3388
|
-
return new
|
|
3115
|
+
return new un(t, n, s, i, o, r);
|
|
3389
3116
|
}
|
|
3390
|
-
function
|
|
3117
|
+
function lr(e, t) {
|
|
3391
3118
|
const n = e.source.body, s = n.length;
|
|
3392
3119
|
let r = t;
|
|
3393
3120
|
for (; r < s; ) {
|
|
@@ -3406,7 +3133,7 @@ function or(e, t) {
|
|
|
3406
3133
|
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
|
|
3407
3134
|
continue;
|
|
3408
3135
|
case 35:
|
|
3409
|
-
return
|
|
3136
|
+
return hr(e, r);
|
|
3410
3137
|
case 33:
|
|
3411
3138
|
return w(e, p.BANG, r, r + 1);
|
|
3412
3139
|
case 36:
|
|
@@ -3438,21 +3165,21 @@ function or(e, t) {
|
|
|
3438
3165
|
case 125:
|
|
3439
3166
|
return w(e, p.BRACE_R, r, r + 1);
|
|
3440
3167
|
case 34:
|
|
3441
|
-
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ?
|
|
3168
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Er(e, r) : pr(e, r);
|
|
3442
3169
|
}
|
|
3443
3170
|
if (de(i) || i === 45)
|
|
3444
|
-
return
|
|
3445
|
-
if (
|
|
3446
|
-
return
|
|
3171
|
+
return fr(e, r, i);
|
|
3172
|
+
if (hn(i))
|
|
3173
|
+
return vr(e, r);
|
|
3447
3174
|
throw b(
|
|
3448
3175
|
e.source,
|
|
3449
3176
|
r,
|
|
3450
|
-
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) ||
|
|
3177
|
+
i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || Ce(n, r) ? `Unexpected character: ${X(e, r)}.` : `Invalid character: ${X(e, r)}.`
|
|
3451
3178
|
);
|
|
3452
3179
|
}
|
|
3453
3180
|
return w(e, p.EOF, s, s);
|
|
3454
3181
|
}
|
|
3455
|
-
function
|
|
3182
|
+
function hr(e, t) {
|
|
3456
3183
|
const n = e.source.body, s = n.length;
|
|
3457
3184
|
let r = t + 1;
|
|
3458
3185
|
for (; r < s; ) {
|
|
@@ -3461,7 +3188,7 @@ function ar(e, t) {
|
|
|
3461
3188
|
break;
|
|
3462
3189
|
if (re(i))
|
|
3463
3190
|
++r;
|
|
3464
|
-
else if (
|
|
3191
|
+
else if (Ce(n, r))
|
|
3465
3192
|
r += 2;
|
|
3466
3193
|
else
|
|
3467
3194
|
break;
|
|
@@ -3474,7 +3201,7 @@ function ar(e, t) {
|
|
|
3474
3201
|
n.slice(t + 1, r)
|
|
3475
3202
|
);
|
|
3476
3203
|
}
|
|
3477
|
-
function
|
|
3204
|
+
function fr(e, t, n) {
|
|
3478
3205
|
const s = e.source.body;
|
|
3479
3206
|
let r = t, i = n, o = !1;
|
|
3480
3207
|
if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
|
|
@@ -3488,8 +3215,8 @@ function cr(e, t, n) {
|
|
|
3488
3215
|
)}.`
|
|
3489
3216
|
);
|
|
3490
3217
|
} else
|
|
3491
|
-
r =
|
|
3492
|
-
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r =
|
|
3218
|
+
r = Ue(e, r, i), i = s.charCodeAt(r);
|
|
3219
|
+
if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = Ue(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 = Ue(e, r, i), i = s.charCodeAt(r)), i === 46 || hn(i))
|
|
3493
3220
|
throw b(
|
|
3494
3221
|
e.source,
|
|
3495
3222
|
r,
|
|
@@ -3506,7 +3233,7 @@ function cr(e, t, n) {
|
|
|
3506
3233
|
s.slice(t, r)
|
|
3507
3234
|
);
|
|
3508
3235
|
}
|
|
3509
|
-
function
|
|
3236
|
+
function Ue(e, t, n) {
|
|
3510
3237
|
if (!de(n))
|
|
3511
3238
|
throw b(
|
|
3512
3239
|
e.source,
|
|
@@ -3522,7 +3249,7 @@ function qe(e, t, n) {
|
|
|
3522
3249
|
++r;
|
|
3523
3250
|
return r;
|
|
3524
3251
|
}
|
|
3525
|
-
function
|
|
3252
|
+
function pr(e, t) {
|
|
3526
3253
|
const n = e.source.body, s = n.length;
|
|
3527
3254
|
let r = t + 1, i = r, o = "";
|
|
3528
3255
|
for (; r < s; ) {
|
|
@@ -3531,7 +3258,7 @@ function ur(e, t) {
|
|
|
3531
3258
|
return o += n.slice(i, r), w(e, p.STRING, t, r + 1, o);
|
|
3532
3259
|
if (a === 92) {
|
|
3533
3260
|
o += n.slice(i, r);
|
|
3534
|
-
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ?
|
|
3261
|
+
const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? yr(e, r) : mr(e, r) : gr(e, r);
|
|
3535
3262
|
o += c.value, r += c.size, i = r;
|
|
3536
3263
|
continue;
|
|
3537
3264
|
}
|
|
@@ -3539,7 +3266,7 @@ function ur(e, t) {
|
|
|
3539
3266
|
break;
|
|
3540
3267
|
if (re(a))
|
|
3541
3268
|
++r;
|
|
3542
|
-
else if (
|
|
3269
|
+
else if (Ce(n, r))
|
|
3543
3270
|
r += 2;
|
|
3544
3271
|
else
|
|
3545
3272
|
throw b(
|
|
@@ -3553,7 +3280,7 @@ function ur(e, t) {
|
|
|
3553
3280
|
}
|
|
3554
3281
|
throw b(e.source, r, "Unterminated string.");
|
|
3555
3282
|
}
|
|
3556
|
-
function
|
|
3283
|
+
function yr(e, t) {
|
|
3557
3284
|
const n = e.source.body;
|
|
3558
3285
|
let s = 0, r = 3;
|
|
3559
3286
|
for (; r < 12; ) {
|
|
@@ -3578,16 +3305,16 @@ function dr(e, t) {
|
|
|
3578
3305
|
)}".`
|
|
3579
3306
|
);
|
|
3580
3307
|
}
|
|
3581
|
-
function
|
|
3582
|
-
const n = e.source.body, s =
|
|
3308
|
+
function mr(e, t) {
|
|
3309
|
+
const n = e.source.body, s = Rt(n, t + 2);
|
|
3583
3310
|
if (re(s))
|
|
3584
3311
|
return {
|
|
3585
3312
|
value: String.fromCodePoint(s),
|
|
3586
3313
|
size: 6
|
|
3587
3314
|
};
|
|
3588
|
-
if (
|
|
3589
|
-
const r =
|
|
3590
|
-
if (
|
|
3315
|
+
if (fn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
3316
|
+
const r = Rt(n, t + 8);
|
|
3317
|
+
if (pn(r))
|
|
3591
3318
|
return {
|
|
3592
3319
|
value: String.fromCodePoint(s, r),
|
|
3593
3320
|
size: 12
|
|
@@ -3599,13 +3326,13 @@ function lr(e, t) {
|
|
|
3599
3326
|
`Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
|
|
3600
3327
|
);
|
|
3601
3328
|
}
|
|
3602
|
-
function
|
|
3329
|
+
function Rt(e, t) {
|
|
3603
3330
|
return ae(e.charCodeAt(t)) << 12 | ae(e.charCodeAt(t + 1)) << 8 | ae(e.charCodeAt(t + 2)) << 4 | ae(e.charCodeAt(t + 3));
|
|
3604
3331
|
}
|
|
3605
3332
|
function ae(e) {
|
|
3606
3333
|
return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
|
|
3607
3334
|
}
|
|
3608
|
-
function
|
|
3335
|
+
function gr(e, t) {
|
|
3609
3336
|
const n = e.source.body;
|
|
3610
3337
|
switch (n.charCodeAt(t + 1)) {
|
|
3611
3338
|
case 34:
|
|
@@ -3659,7 +3386,7 @@ function hr(e, t) {
|
|
|
3659
3386
|
)}".`
|
|
3660
3387
|
);
|
|
3661
3388
|
}
|
|
3662
|
-
function
|
|
3389
|
+
function Er(e, t) {
|
|
3663
3390
|
const n = e.source.body, s = n.length;
|
|
3664
3391
|
let r = e.lineStart, i = t + 3, o = i, a = "";
|
|
3665
3392
|
const c = [];
|
|
@@ -3673,7 +3400,7 @@ function fr(e, t) {
|
|
|
3673
3400
|
t,
|
|
3674
3401
|
i + 3,
|
|
3675
3402
|
// Return a string of the lines joined with U+000A.
|
|
3676
|
-
|
|
3403
|
+
or(c).join(`
|
|
3677
3404
|
`)
|
|
3678
3405
|
);
|
|
3679
3406
|
return e.line += c.length - 1, e.lineStart = r, h;
|
|
@@ -3688,7 +3415,7 @@ function fr(e, t) {
|
|
|
3688
3415
|
}
|
|
3689
3416
|
if (re(u))
|
|
3690
3417
|
++i;
|
|
3691
|
-
else if (
|
|
3418
|
+
else if (Ce(n, i))
|
|
3692
3419
|
i += 2;
|
|
3693
3420
|
else
|
|
3694
3421
|
throw b(
|
|
@@ -3702,12 +3429,12 @@ function fr(e, t) {
|
|
|
3702
3429
|
}
|
|
3703
3430
|
throw b(e.source, i, "Unterminated string.");
|
|
3704
3431
|
}
|
|
3705
|
-
function
|
|
3432
|
+
function vr(e, t) {
|
|
3706
3433
|
const n = e.source.body, s = n.length;
|
|
3707
3434
|
let r = t + 1;
|
|
3708
3435
|
for (; r < s; ) {
|
|
3709
3436
|
const i = n.charCodeAt(r);
|
|
3710
|
-
if (
|
|
3437
|
+
if (ir(i))
|
|
3711
3438
|
++r;
|
|
3712
3439
|
else
|
|
3713
3440
|
break;
|
|
@@ -3720,56 +3447,56 @@ function pr(e, t) {
|
|
|
3720
3447
|
n.slice(t, r)
|
|
3721
3448
|
);
|
|
3722
3449
|
}
|
|
3723
|
-
const
|
|
3724
|
-
function
|
|
3725
|
-
return
|
|
3450
|
+
const Tr = 10, yn = 2;
|
|
3451
|
+
function ht(e) {
|
|
3452
|
+
return ke(e, []);
|
|
3726
3453
|
}
|
|
3727
|
-
function
|
|
3454
|
+
function ke(e, t) {
|
|
3728
3455
|
switch (typeof e) {
|
|
3729
3456
|
case "string":
|
|
3730
3457
|
return JSON.stringify(e);
|
|
3731
3458
|
case "function":
|
|
3732
3459
|
return e.name ? `[function ${e.name}]` : "[function]";
|
|
3733
3460
|
case "object":
|
|
3734
|
-
return
|
|
3461
|
+
return _r(e, t);
|
|
3735
3462
|
default:
|
|
3736
3463
|
return String(e);
|
|
3737
3464
|
}
|
|
3738
3465
|
}
|
|
3739
|
-
function
|
|
3466
|
+
function _r(e, t) {
|
|
3740
3467
|
if (e === null)
|
|
3741
3468
|
return "null";
|
|
3742
3469
|
if (t.includes(e))
|
|
3743
3470
|
return "[Circular]";
|
|
3744
3471
|
const n = [...t, e];
|
|
3745
|
-
if (
|
|
3472
|
+
if (Sr(e)) {
|
|
3746
3473
|
const s = e.toJSON();
|
|
3747
3474
|
if (s !== e)
|
|
3748
|
-
return typeof s == "string" ? s :
|
|
3475
|
+
return typeof s == "string" ? s : ke(s, n);
|
|
3749
3476
|
} else if (Array.isArray(e))
|
|
3750
|
-
return
|
|
3751
|
-
return
|
|
3477
|
+
return Ar(e, n);
|
|
3478
|
+
return Ir(e, n);
|
|
3752
3479
|
}
|
|
3753
|
-
function
|
|
3480
|
+
function Sr(e) {
|
|
3754
3481
|
return typeof e.toJSON == "function";
|
|
3755
3482
|
}
|
|
3756
|
-
function
|
|
3483
|
+
function Ir(e, t) {
|
|
3757
3484
|
const n = Object.entries(e);
|
|
3758
|
-
return n.length === 0 ? "{}" : t.length >
|
|
3759
|
-
([r, i]) => r + ": " +
|
|
3485
|
+
return n.length === 0 ? "{}" : t.length > yn ? "[" + xr(e) + "]" : "{ " + n.map(
|
|
3486
|
+
([r, i]) => r + ": " + ke(i, t)
|
|
3760
3487
|
).join(", ") + " }";
|
|
3761
3488
|
}
|
|
3762
|
-
function
|
|
3489
|
+
function Ar(e, t) {
|
|
3763
3490
|
if (e.length === 0)
|
|
3764
3491
|
return "[]";
|
|
3765
|
-
if (t.length >
|
|
3492
|
+
if (t.length > yn)
|
|
3766
3493
|
return "[Array]";
|
|
3767
|
-
const n = Math.min(
|
|
3494
|
+
const n = Math.min(Tr, e.length), s = e.length - n, r = [];
|
|
3768
3495
|
for (let i = 0; i < n; ++i)
|
|
3769
|
-
r.push(
|
|
3496
|
+
r.push(ke(e[i], t));
|
|
3770
3497
|
return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
|
|
3771
3498
|
}
|
|
3772
|
-
function
|
|
3499
|
+
function xr(e) {
|
|
3773
3500
|
const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
|
|
3774
3501
|
if (t === "Object" && typeof e.constructor == "function") {
|
|
3775
3502
|
const n = e.constructor.name;
|
|
@@ -3778,7 +3505,7 @@ function Tr(e) {
|
|
|
3778
3505
|
}
|
|
3779
3506
|
return t;
|
|
3780
3507
|
}
|
|
3781
|
-
const
|
|
3508
|
+
const wr = (
|
|
3782
3509
|
/* c8 ignore next 6 */
|
|
3783
3510
|
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
3784
3511
|
globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function(t, n) {
|
|
@@ -3793,7 +3520,7 @@ const _r = (
|
|
|
3793
3520
|
Symbol.toStringTag in t ? t[Symbol.toStringTag] : (s = t.constructor) === null || s === void 0 ? void 0 : s.name
|
|
3794
3521
|
);
|
|
3795
3522
|
if (r === i) {
|
|
3796
|
-
const o =
|
|
3523
|
+
const o = ht(t);
|
|
3797
3524
|
throw new Error(`Cannot use ${r} "${o}" from another module or realm.
|
|
3798
3525
|
|
|
3799
3526
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -3811,15 +3538,15 @@ spurious results.`);
|
|
|
3811
3538
|
return !1;
|
|
3812
3539
|
}
|
|
3813
3540
|
);
|
|
3814
|
-
class
|
|
3541
|
+
class mn {
|
|
3815
3542
|
constructor(t, n = "GraphQL request", s = {
|
|
3816
3543
|
line: 1,
|
|
3817
3544
|
column: 1
|
|
3818
3545
|
}) {
|
|
3819
|
-
typeof t == "string" ||
|
|
3546
|
+
typeof t == "string" || ve(!1, `Body must be a string. Received: ${ht(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || ve(
|
|
3820
3547
|
!1,
|
|
3821
3548
|
"line in locationOffset is 1-indexed and must be positive."
|
|
3822
|
-
), this.locationOffset.column > 0 ||
|
|
3549
|
+
), this.locationOffset.column > 0 || ve(
|
|
3823
3550
|
!1,
|
|
3824
3551
|
"column in locationOffset is 1-indexed and must be positive."
|
|
3825
3552
|
);
|
|
@@ -3828,16 +3555,16 @@ class yn {
|
|
|
3828
3555
|
return "Source";
|
|
3829
3556
|
}
|
|
3830
3557
|
}
|
|
3831
|
-
function
|
|
3832
|
-
return
|
|
3558
|
+
function br(e) {
|
|
3559
|
+
return wr(e, mn);
|
|
3833
3560
|
}
|
|
3834
|
-
function
|
|
3835
|
-
return new
|
|
3561
|
+
function Nr(e, t) {
|
|
3562
|
+
return new Or(e, t).parseDocument();
|
|
3836
3563
|
}
|
|
3837
|
-
class
|
|
3564
|
+
class Or {
|
|
3838
3565
|
constructor(t, n = {}) {
|
|
3839
|
-
const s =
|
|
3840
|
-
this._lexer = new
|
|
3566
|
+
const s = br(t) ? t : new mn(t);
|
|
3567
|
+
this._lexer = new ur(s), this._options = n, this._tokenCounter = 0;
|
|
3841
3568
|
}
|
|
3842
3569
|
/**
|
|
3843
3570
|
* Converts a name lex token into a name parse node.
|
|
@@ -4534,7 +4261,7 @@ class Ar {
|
|
|
4534
4261
|
throw b(
|
|
4535
4262
|
this._lexer.source,
|
|
4536
4263
|
this._lexer.token.start,
|
|
4537
|
-
`${
|
|
4264
|
+
`${ge(
|
|
4538
4265
|
this._lexer.token
|
|
4539
4266
|
)} is reserved and cannot be used for an enum value.`
|
|
4540
4267
|
);
|
|
@@ -4793,7 +4520,7 @@ class Ar {
|
|
|
4793
4520
|
*/
|
|
4794
4521
|
parseDirectiveLocation() {
|
|
4795
4522
|
const t = this._lexer.token, n = this.parseName();
|
|
4796
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
4523
|
+
if (Object.prototype.hasOwnProperty.call(Xe, n.value))
|
|
4797
4524
|
return n;
|
|
4798
4525
|
throw this.unexpected(t);
|
|
4799
4526
|
}
|
|
@@ -4804,7 +4531,7 @@ class Ar {
|
|
|
4804
4531
|
* given parsed object.
|
|
4805
4532
|
*/
|
|
4806
4533
|
node(t, n) {
|
|
4807
|
-
return this._options.noLocation !== !0 && (n.loc = new
|
|
4534
|
+
return this._options.noLocation !== !0 && (n.loc = new sr(
|
|
4808
4535
|
t,
|
|
4809
4536
|
this._lexer.lastToken,
|
|
4810
4537
|
this._lexer.source
|
|
@@ -4827,7 +4554,7 @@ class Ar {
|
|
|
4827
4554
|
throw b(
|
|
4828
4555
|
this._lexer.source,
|
|
4829
4556
|
n.start,
|
|
4830
|
-
`Expected ${
|
|
4557
|
+
`Expected ${gn(t)}, found ${ge(n)}.`
|
|
4831
4558
|
);
|
|
4832
4559
|
}
|
|
4833
4560
|
/**
|
|
@@ -4849,7 +4576,7 @@ class Ar {
|
|
|
4849
4576
|
throw b(
|
|
4850
4577
|
this._lexer.source,
|
|
4851
4578
|
n.start,
|
|
4852
|
-
`Expected "${t}", found ${
|
|
4579
|
+
`Expected "${t}", found ${ge(n)}.`
|
|
4853
4580
|
);
|
|
4854
4581
|
}
|
|
4855
4582
|
/**
|
|
@@ -4868,7 +4595,7 @@ class Ar {
|
|
|
4868
4595
|
return b(
|
|
4869
4596
|
this._lexer.source,
|
|
4870
4597
|
n.start,
|
|
4871
|
-
`Unexpected ${
|
|
4598
|
+
`Unexpected ${ge(n)}.`
|
|
4872
4599
|
);
|
|
4873
4600
|
}
|
|
4874
4601
|
/**
|
|
@@ -4935,21 +4662,21 @@ class Ar {
|
|
|
4935
4662
|
);
|
|
4936
4663
|
}
|
|
4937
4664
|
}
|
|
4938
|
-
function
|
|
4665
|
+
function ge(e) {
|
|
4939
4666
|
const t = e.value;
|
|
4940
|
-
return
|
|
4667
|
+
return gn(e.kind) + (t != null ? ` "${t}"` : "");
|
|
4941
4668
|
}
|
|
4942
|
-
function
|
|
4943
|
-
return
|
|
4669
|
+
function gn(e) {
|
|
4670
|
+
return dr(e) ? `"${e}"` : e;
|
|
4944
4671
|
}
|
|
4945
|
-
function
|
|
4946
|
-
return `"${e.replace(
|
|
4672
|
+
function Cr(e) {
|
|
4673
|
+
return `"${e.replace(kr, Dr)}"`;
|
|
4947
4674
|
}
|
|
4948
|
-
const
|
|
4949
|
-
function
|
|
4950
|
-
return
|
|
4675
|
+
const kr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
|
|
4676
|
+
function Dr(e) {
|
|
4677
|
+
return Rr[e.charCodeAt(0)];
|
|
4951
4678
|
}
|
|
4952
|
-
const
|
|
4679
|
+
const Rr = [
|
|
4953
4680
|
"\\u0000",
|
|
4954
4681
|
"\\u0001",
|
|
4955
4682
|
"\\u0002",
|
|
@@ -5115,11 +4842,11 @@ const Or = [
|
|
|
5115
4842
|
"\\u009D",
|
|
5116
4843
|
"\\u009E",
|
|
5117
4844
|
"\\u009F"
|
|
5118
|
-
],
|
|
5119
|
-
function
|
|
4845
|
+
], qr = Object.freeze({});
|
|
4846
|
+
function Mr(e, t, n = dn) {
|
|
5120
4847
|
const s = /* @__PURE__ */ new Map();
|
|
5121
4848
|
for (const x of Object.values(T))
|
|
5122
|
-
s.set(x,
|
|
4849
|
+
s.set(x, Lr(t, x));
|
|
5123
4850
|
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
|
|
5124
4851
|
const f = [], m = [];
|
|
5125
4852
|
do {
|
|
@@ -5129,18 +4856,18 @@ function kr(e, t, n = un) {
|
|
|
5129
4856
|
if (h = m.length === 0 ? void 0 : f[f.length - 1], u = d, d = m.pop(), R)
|
|
5130
4857
|
if (i) {
|
|
5131
4858
|
u = u.slice();
|
|
5132
|
-
let
|
|
5133
|
-
for (const [
|
|
5134
|
-
const
|
|
5135
|
-
|
|
4859
|
+
let q = 0;
|
|
4860
|
+
for (const [F, H] of c) {
|
|
4861
|
+
const z = F - q;
|
|
4862
|
+
H === null ? (u.splice(z, 1), q++) : u[z] = H;
|
|
5136
4863
|
}
|
|
5137
4864
|
} else {
|
|
5138
4865
|
u = Object.defineProperties(
|
|
5139
4866
|
{},
|
|
5140
4867
|
Object.getOwnPropertyDescriptors(u)
|
|
5141
4868
|
);
|
|
5142
|
-
for (const [
|
|
5143
|
-
u[
|
|
4869
|
+
for (const [q, F] of c)
|
|
4870
|
+
u[q] = F;
|
|
5144
4871
|
}
|
|
5145
4872
|
a = r.index, o = r.keys, c = r.edits, i = r.inArray, r = r.prev;
|
|
5146
4873
|
} else if (d) {
|
|
@@ -5151,9 +4878,9 @@ function kr(e, t, n = un) {
|
|
|
5151
4878
|
let k;
|
|
5152
4879
|
if (!Array.isArray(u)) {
|
|
5153
4880
|
var y, v;
|
|
5154
|
-
|
|
5155
|
-
const
|
|
5156
|
-
if (k =
|
|
4881
|
+
Dt(u) || ve(!1, `Invalid AST Node: ${ht(u)}.`);
|
|
4882
|
+
const q = x ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (v = s.get(u.kind)) === null || v === void 0 ? void 0 : v.enter;
|
|
4883
|
+
if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === qr)
|
|
5157
4884
|
break;
|
|
5158
4885
|
if (k === !1) {
|
|
5159
4886
|
if (!x) {
|
|
@@ -5161,7 +4888,7 @@ function kr(e, t, n = un) {
|
|
|
5161
4888
|
continue;
|
|
5162
4889
|
}
|
|
5163
4890
|
} else if (k !== void 0 && (c.push([h, k]), !x))
|
|
5164
|
-
if (
|
|
4891
|
+
if (Dt(k))
|
|
5165
4892
|
u = k;
|
|
5166
4893
|
else {
|
|
5167
4894
|
f.pop();
|
|
@@ -5171,19 +4898,19 @@ function kr(e, t, n = un) {
|
|
|
5171
4898
|
if (k === void 0 && R && c.push([h, u]), x)
|
|
5172
4899
|
f.pop();
|
|
5173
4900
|
else {
|
|
5174
|
-
var
|
|
4901
|
+
var I;
|
|
5175
4902
|
r = {
|
|
5176
4903
|
inArray: i,
|
|
5177
4904
|
index: a,
|
|
5178
4905
|
keys: o,
|
|
5179
4906
|
edits: c,
|
|
5180
4907
|
prev: r
|
|
5181
|
-
}, i = Array.isArray(u), o = i ? u : (
|
|
4908
|
+
}, i = Array.isArray(u), o = i ? u : (I = n[u.kind]) !== null && I !== void 0 ? I : [], a = -1, c = [], d && m.push(d), d = u;
|
|
5182
4909
|
}
|
|
5183
4910
|
} while (r !== void 0);
|
|
5184
4911
|
return c.length !== 0 ? c[c.length - 1][1] : e;
|
|
5185
4912
|
}
|
|
5186
|
-
function
|
|
4913
|
+
function Lr(e, t) {
|
|
5187
4914
|
const n = e[t];
|
|
5188
4915
|
return typeof n == "object" ? n : typeof n == "function" ? {
|
|
5189
4916
|
enter: n,
|
|
@@ -5193,10 +4920,10 @@ function Cr(e, t) {
|
|
|
5193
4920
|
leave: e.leave
|
|
5194
4921
|
};
|
|
5195
4922
|
}
|
|
5196
|
-
function
|
|
5197
|
-
return
|
|
4923
|
+
function En(e) {
|
|
4924
|
+
return Mr(e, Ur);
|
|
5198
4925
|
}
|
|
5199
|
-
const
|
|
4926
|
+
const Pr = 80, Ur = {
|
|
5200
4927
|
Name: {
|
|
5201
4928
|
leave: (e) => e.value
|
|
5202
4929
|
},
|
|
@@ -5211,7 +4938,7 @@ const Dr = 80, Rr = {
|
|
|
5211
4938
|
},
|
|
5212
4939
|
OperationDefinition: {
|
|
5213
4940
|
leave(e) {
|
|
5214
|
-
const t =
|
|
4941
|
+
const t = S("(", E(e.variableDefinitions, ", "), ")"), n = E(
|
|
5215
4942
|
[
|
|
5216
4943
|
e.operation,
|
|
5217
4944
|
E([e.name, t]),
|
|
@@ -5223,17 +4950,17 @@ const Dr = 80, Rr = {
|
|
|
5223
4950
|
}
|
|
5224
4951
|
},
|
|
5225
4952
|
VariableDefinition: {
|
|
5226
|
-
leave: ({ variable: e, type: t, defaultValue: n, directives: s }) => e + ": " + t +
|
|
4953
|
+
leave: ({ variable: e, type: t, defaultValue: n, directives: s }) => e + ": " + t + S(" = ", n) + S(" ", E(s, " "))
|
|
5227
4954
|
},
|
|
5228
4955
|
SelectionSet: {
|
|
5229
|
-
leave: ({ selections: e }) =>
|
|
4956
|
+
leave: ({ selections: e }) => M(e)
|
|
5230
4957
|
},
|
|
5231
4958
|
Field: {
|
|
5232
4959
|
leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
|
|
5233
|
-
const i =
|
|
5234
|
-
let o = i +
|
|
5235
|
-
return o.length >
|
|
5236
|
-
`,
|
|
4960
|
+
const i = S("", e, ": ") + t;
|
|
4961
|
+
let o = i + S("(", E(n, ", "), ")");
|
|
4962
|
+
return o.length > Pr && (o = i + S(`(
|
|
4963
|
+
`, Te(E(n, `
|
|
5237
4964
|
`)), `
|
|
5238
4965
|
)`)), E([o, E(s, " "), r], " ");
|
|
5239
4966
|
}
|
|
@@ -5243,13 +4970,13 @@ const Dr = 80, Rr = {
|
|
|
5243
4970
|
},
|
|
5244
4971
|
// Fragments
|
|
5245
4972
|
FragmentSpread: {
|
|
5246
|
-
leave: ({ name: e, directives: t }) => "..." + e +
|
|
4973
|
+
leave: ({ name: e, directives: t }) => "..." + e + S(" ", E(t, " "))
|
|
5247
4974
|
},
|
|
5248
4975
|
InlineFragment: {
|
|
5249
4976
|
leave: ({ typeCondition: e, directives: t, selectionSet: n }) => E(
|
|
5250
4977
|
[
|
|
5251
4978
|
"...",
|
|
5252
|
-
|
|
4979
|
+
S("on ", e),
|
|
5253
4980
|
E(t, " "),
|
|
5254
4981
|
n
|
|
5255
4982
|
],
|
|
@@ -5259,7 +4986,7 @@ const Dr = 80, Rr = {
|
|
|
5259
4986
|
FragmentDefinition: {
|
|
5260
4987
|
leave: ({ name: e, typeCondition: t, variableDefinitions: n, directives: s, selectionSet: r }) => (
|
|
5261
4988
|
// or removed in the future.
|
|
5262
|
-
`fragment ${e}${
|
|
4989
|
+
`fragment ${e}${S("(", E(n, ", "), ")")} on ${t} ${S("", E(s, " "), " ")}` + r
|
|
5263
4990
|
)
|
|
5264
4991
|
},
|
|
5265
4992
|
// Value
|
|
@@ -5270,7 +4997,7 @@ const Dr = 80, Rr = {
|
|
|
5270
4997
|
leave: ({ value: e }) => e
|
|
5271
4998
|
},
|
|
5272
4999
|
StringValue: {
|
|
5273
|
-
leave: ({ value: e, block: t }) => t ?
|
|
5000
|
+
leave: ({ value: e, block: t }) => t ? cr(e) : Cr(e)
|
|
5274
5001
|
},
|
|
5275
5002
|
BooleanValue: {
|
|
5276
5003
|
leave: ({ value: e }) => e ? "true" : "false"
|
|
@@ -5292,7 +5019,7 @@ const Dr = 80, Rr = {
|
|
|
5292
5019
|
},
|
|
5293
5020
|
// Directive
|
|
5294
5021
|
Directive: {
|
|
5295
|
-
leave: ({ name: e, arguments: t }) => "@" + e +
|
|
5022
|
+
leave: ({ name: e, arguments: t }) => "@" + e + S("(", E(t, ", "), ")")
|
|
5296
5023
|
},
|
|
5297
5024
|
// Type
|
|
5298
5025
|
NamedType: {
|
|
@@ -5306,85 +5033,85 @@ const Dr = 80, Rr = {
|
|
|
5306
5033
|
},
|
|
5307
5034
|
// Type System Definitions
|
|
5308
5035
|
SchemaDefinition: {
|
|
5309
|
-
leave: ({ description: e, directives: t, operationTypes: n }) =>
|
|
5310
|
-
`) + E(["schema", E(t, " "),
|
|
5036
|
+
leave: ({ description: e, directives: t, operationTypes: n }) => S("", e, `
|
|
5037
|
+
`) + E(["schema", E(t, " "), M(n)], " ")
|
|
5311
5038
|
},
|
|
5312
5039
|
OperationTypeDefinition: {
|
|
5313
5040
|
leave: ({ operation: e, type: t }) => e + ": " + t
|
|
5314
5041
|
},
|
|
5315
5042
|
ScalarTypeDefinition: {
|
|
5316
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
5043
|
+
leave: ({ description: e, name: t, directives: n }) => S("", e, `
|
|
5317
5044
|
`) + E(["scalar", t, E(n, " ")], " ")
|
|
5318
5045
|
},
|
|
5319
5046
|
ObjectTypeDefinition: {
|
|
5320
|
-
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) =>
|
|
5047
|
+
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => S("", e, `
|
|
5321
5048
|
`) + E(
|
|
5322
5049
|
[
|
|
5323
5050
|
"type",
|
|
5324
5051
|
t,
|
|
5325
|
-
|
|
5052
|
+
S("implements ", E(n, " & ")),
|
|
5326
5053
|
E(s, " "),
|
|
5327
|
-
|
|
5054
|
+
M(r)
|
|
5328
5055
|
],
|
|
5329
5056
|
" "
|
|
5330
5057
|
)
|
|
5331
5058
|
},
|
|
5332
5059
|
FieldDefinition: {
|
|
5333
|
-
leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) =>
|
|
5334
|
-
`) + t + (
|
|
5335
|
-
`,
|
|
5060
|
+
leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => S("", e, `
|
|
5061
|
+
`) + t + (qt(n) ? S(`(
|
|
5062
|
+
`, Te(E(n, `
|
|
5336
5063
|
`)), `
|
|
5337
|
-
)`) :
|
|
5064
|
+
)`) : S("(", E(n, ", "), ")")) + ": " + s + S(" ", E(r, " "))
|
|
5338
5065
|
},
|
|
5339
5066
|
InputValueDefinition: {
|
|
5340
|
-
leave: ({ description: e, name: t, type: n, defaultValue: s, directives: r }) =>
|
|
5067
|
+
leave: ({ description: e, name: t, type: n, defaultValue: s, directives: r }) => S("", e, `
|
|
5341
5068
|
`) + E(
|
|
5342
|
-
[t + ": " + n,
|
|
5069
|
+
[t + ": " + n, S("= ", s), E(r, " ")],
|
|
5343
5070
|
" "
|
|
5344
5071
|
)
|
|
5345
5072
|
},
|
|
5346
5073
|
InterfaceTypeDefinition: {
|
|
5347
|
-
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) =>
|
|
5074
|
+
leave: ({ description: e, name: t, interfaces: n, directives: s, fields: r }) => S("", e, `
|
|
5348
5075
|
`) + E(
|
|
5349
5076
|
[
|
|
5350
5077
|
"interface",
|
|
5351
5078
|
t,
|
|
5352
|
-
|
|
5079
|
+
S("implements ", E(n, " & ")),
|
|
5353
5080
|
E(s, " "),
|
|
5354
|
-
|
|
5081
|
+
M(r)
|
|
5355
5082
|
],
|
|
5356
5083
|
" "
|
|
5357
5084
|
)
|
|
5358
5085
|
},
|
|
5359
5086
|
UnionTypeDefinition: {
|
|
5360
|
-
leave: ({ description: e, name: t, directives: n, types: s }) =>
|
|
5087
|
+
leave: ({ description: e, name: t, directives: n, types: s }) => S("", e, `
|
|
5361
5088
|
`) + E(
|
|
5362
|
-
["union", t, E(n, " "),
|
|
5089
|
+
["union", t, E(n, " "), S("= ", E(s, " | "))],
|
|
5363
5090
|
" "
|
|
5364
5091
|
)
|
|
5365
5092
|
},
|
|
5366
5093
|
EnumTypeDefinition: {
|
|
5367
|
-
leave: ({ description: e, name: t, directives: n, values: s }) =>
|
|
5368
|
-
`) + E(["enum", t, E(n, " "),
|
|
5094
|
+
leave: ({ description: e, name: t, directives: n, values: s }) => S("", e, `
|
|
5095
|
+
`) + E(["enum", t, E(n, " "), M(s)], " ")
|
|
5369
5096
|
},
|
|
5370
5097
|
EnumValueDefinition: {
|
|
5371
|
-
leave: ({ description: e, name: t, directives: n }) =>
|
|
5098
|
+
leave: ({ description: e, name: t, directives: n }) => S("", e, `
|
|
5372
5099
|
`) + E([t, E(n, " ")], " ")
|
|
5373
5100
|
},
|
|
5374
5101
|
InputObjectTypeDefinition: {
|
|
5375
|
-
leave: ({ description: e, name: t, directives: n, fields: s }) =>
|
|
5376
|
-
`) + E(["input", t, E(n, " "),
|
|
5102
|
+
leave: ({ description: e, name: t, directives: n, fields: s }) => S("", e, `
|
|
5103
|
+
`) + E(["input", t, E(n, " "), M(s)], " ")
|
|
5377
5104
|
},
|
|
5378
5105
|
DirectiveDefinition: {
|
|
5379
|
-
leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) =>
|
|
5380
|
-
`) + "directive @" + t + (
|
|
5381
|
-
`,
|
|
5106
|
+
leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => S("", e, `
|
|
5107
|
+
`) + "directive @" + t + (qt(n) ? S(`(
|
|
5108
|
+
`, Te(E(n, `
|
|
5382
5109
|
`)), `
|
|
5383
|
-
)`) :
|
|
5110
|
+
)`) : S("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
|
|
5384
5111
|
},
|
|
5385
5112
|
SchemaExtension: {
|
|
5386
5113
|
leave: ({ directives: e, operationTypes: t }) => E(
|
|
5387
|
-
["extend schema", E(e, " "),
|
|
5114
|
+
["extend schema", E(e, " "), M(t)],
|
|
5388
5115
|
" "
|
|
5389
5116
|
)
|
|
5390
5117
|
},
|
|
@@ -5396,9 +5123,9 @@ const Dr = 80, Rr = {
|
|
|
5396
5123
|
[
|
|
5397
5124
|
"extend type",
|
|
5398
5125
|
e,
|
|
5399
|
-
|
|
5126
|
+
S("implements ", E(t, " & ")),
|
|
5400
5127
|
E(n, " "),
|
|
5401
|
-
|
|
5128
|
+
M(s)
|
|
5402
5129
|
],
|
|
5403
5130
|
" "
|
|
5404
5131
|
)
|
|
@@ -5408,9 +5135,9 @@ const Dr = 80, Rr = {
|
|
|
5408
5135
|
[
|
|
5409
5136
|
"extend interface",
|
|
5410
5137
|
e,
|
|
5411
|
-
|
|
5138
|
+
S("implements ", E(t, " & ")),
|
|
5412
5139
|
E(n, " "),
|
|
5413
|
-
|
|
5140
|
+
M(s)
|
|
5414
5141
|
],
|
|
5415
5142
|
" "
|
|
5416
5143
|
)
|
|
@@ -5421,57 +5148,57 @@ const Dr = 80, Rr = {
|
|
|
5421
5148
|
"extend union",
|
|
5422
5149
|
e,
|
|
5423
5150
|
E(t, " "),
|
|
5424
|
-
|
|
5151
|
+
S("= ", E(n, " | "))
|
|
5425
5152
|
],
|
|
5426
5153
|
" "
|
|
5427
5154
|
)
|
|
5428
5155
|
},
|
|
5429
5156
|
EnumTypeExtension: {
|
|
5430
|
-
leave: ({ name: e, directives: t, values: n }) => E(["extend enum", e, E(t, " "),
|
|
5157
|
+
leave: ({ name: e, directives: t, values: n }) => E(["extend enum", e, E(t, " "), M(n)], " ")
|
|
5431
5158
|
},
|
|
5432
5159
|
InputObjectTypeExtension: {
|
|
5433
|
-
leave: ({ name: e, directives: t, fields: n }) => E(["extend input", e, E(t, " "),
|
|
5160
|
+
leave: ({ name: e, directives: t, fields: n }) => E(["extend input", e, E(t, " "), M(n)], " ")
|
|
5434
5161
|
}
|
|
5435
5162
|
};
|
|
5436
5163
|
function E(e, t = "") {
|
|
5437
5164
|
var n;
|
|
5438
5165
|
return (n = e == null ? void 0 : e.filter((s) => s).join(t)) !== null && n !== void 0 ? n : "";
|
|
5439
5166
|
}
|
|
5440
|
-
function
|
|
5441
|
-
return
|
|
5442
|
-
`,
|
|
5167
|
+
function M(e) {
|
|
5168
|
+
return S(`{
|
|
5169
|
+
`, Te(E(e, `
|
|
5443
5170
|
`)), `
|
|
5444
5171
|
}`);
|
|
5445
5172
|
}
|
|
5446
|
-
function
|
|
5173
|
+
function S(e, t, n = "") {
|
|
5447
5174
|
return t != null && t !== "" ? e + t + n : "";
|
|
5448
5175
|
}
|
|
5449
|
-
function
|
|
5450
|
-
return
|
|
5176
|
+
function Te(e) {
|
|
5177
|
+
return S(" ", e.replace(/\n/g, `
|
|
5451
5178
|
`));
|
|
5452
5179
|
}
|
|
5453
|
-
function
|
|
5180
|
+
function qt(e) {
|
|
5454
5181
|
var t;
|
|
5455
5182
|
return (t = e == null ? void 0 : e.some((n) => n.includes(`
|
|
5456
5183
|
`))) !== null && t !== void 0 ? t : !1;
|
|
5457
5184
|
}
|
|
5458
|
-
const
|
|
5185
|
+
const Mt = (e) => {
|
|
5459
5186
|
var s, r;
|
|
5460
5187
|
let t;
|
|
5461
5188
|
const n = e.definitions.filter((i) => i.kind === "OperationDefinition");
|
|
5462
5189
|
return n.length === 1 && (t = (r = (s = n[0]) == null ? void 0 : s.name) == null ? void 0 : r.value), t;
|
|
5463
|
-
},
|
|
5190
|
+
}, Fe = (e) => {
|
|
5464
5191
|
if (typeof e == "string") {
|
|
5465
5192
|
let n;
|
|
5466
5193
|
try {
|
|
5467
|
-
const s =
|
|
5468
|
-
n =
|
|
5194
|
+
const s = Nr(e);
|
|
5195
|
+
n = Mt(s);
|
|
5469
5196
|
} catch {
|
|
5470
5197
|
}
|
|
5471
5198
|
return { query: e, operationName: n };
|
|
5472
5199
|
}
|
|
5473
|
-
const t =
|
|
5474
|
-
return { query:
|
|
5200
|
+
const t = Mt(e);
|
|
5201
|
+
return { query: En(e), operationName: t };
|
|
5475
5202
|
};
|
|
5476
5203
|
class ce extends Error {
|
|
5477
5204
|
constructor(t, n) {
|
|
@@ -5486,13 +5213,13 @@ class ce extends Error {
|
|
|
5486
5213
|
return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
|
|
5487
5214
|
}
|
|
5488
5215
|
}
|
|
5489
|
-
var
|
|
5490
|
-
function
|
|
5216
|
+
var Fr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5217
|
+
function Br(e) {
|
|
5491
5218
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
5492
5219
|
}
|
|
5493
|
-
var
|
|
5220
|
+
var We = { exports: {} };
|
|
5494
5221
|
(function(e, t) {
|
|
5495
|
-
var n = typeof self < "u" ? self :
|
|
5222
|
+
var n = typeof self < "u" ? self : Fr, s = function() {
|
|
5496
5223
|
function i() {
|
|
5497
5224
|
this.fetch = !1, this.DOMException = n.DOMException;
|
|
5498
5225
|
}
|
|
@@ -5594,7 +5321,7 @@ var Je = { exports: {} };
|
|
|
5594
5321
|
return Promise.reject(new TypeError("Already read"));
|
|
5595
5322
|
l.bodyUsed = !0;
|
|
5596
5323
|
}
|
|
5597
|
-
function
|
|
5324
|
+
function I(l) {
|
|
5598
5325
|
return new Promise(function(g, _) {
|
|
5599
5326
|
l.onload = function() {
|
|
5600
5327
|
g(l.result);
|
|
@@ -5604,27 +5331,27 @@ var Je = { exports: {} };
|
|
|
5604
5331
|
});
|
|
5605
5332
|
}
|
|
5606
5333
|
function x(l) {
|
|
5607
|
-
var g = new FileReader(), _ =
|
|
5334
|
+
var g = new FileReader(), _ = I(g);
|
|
5608
5335
|
return g.readAsArrayBuffer(l), _;
|
|
5609
5336
|
}
|
|
5610
5337
|
function R(l) {
|
|
5611
|
-
var g = new FileReader(), _ =
|
|
5338
|
+
var g = new FileReader(), _ = I(g);
|
|
5612
5339
|
return g.readAsText(l), _;
|
|
5613
5340
|
}
|
|
5614
5341
|
function k(l) {
|
|
5615
|
-
for (var g = new Uint8Array(l), _ = new Array(g.length),
|
|
5616
|
-
_[
|
|
5342
|
+
for (var g = new Uint8Array(l), _ = new Array(g.length), O = 0; O < g.length; O++)
|
|
5343
|
+
_[O] = String.fromCharCode(g[O]);
|
|
5617
5344
|
return _.join("");
|
|
5618
5345
|
}
|
|
5619
|
-
function
|
|
5346
|
+
function q(l) {
|
|
5620
5347
|
if (l.slice)
|
|
5621
5348
|
return l.slice(0);
|
|
5622
5349
|
var g = new Uint8Array(l.byteLength);
|
|
5623
5350
|
return g.set(new Uint8Array(l)), g.buffer;
|
|
5624
5351
|
}
|
|
5625
|
-
function
|
|
5352
|
+
function F() {
|
|
5626
5353
|
return this.bodyUsed = !1, this._initBody = function(l) {
|
|
5627
|
-
this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && c(l) ? (this._bodyArrayBuffer =
|
|
5354
|
+
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"));
|
|
5628
5355
|
}, a.blob && (this.blob = function() {
|
|
5629
5356
|
var l = v(this);
|
|
5630
5357
|
if (l)
|
|
@@ -5650,15 +5377,15 @@ var Je = { exports: {} };
|
|
|
5650
5377
|
throw new Error("could not read FormData body as text");
|
|
5651
5378
|
return Promise.resolve(this._bodyText);
|
|
5652
5379
|
}, a.formData && (this.formData = function() {
|
|
5653
|
-
return this.text().then(
|
|
5380
|
+
return this.text().then(fe);
|
|
5654
5381
|
}), this.json = function() {
|
|
5655
5382
|
return this.text().then(JSON.parse);
|
|
5656
5383
|
}, this;
|
|
5657
5384
|
}
|
|
5658
|
-
var
|
|
5659
|
-
function
|
|
5385
|
+
var H = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
|
5386
|
+
function z(l) {
|
|
5660
5387
|
var g = l.toUpperCase();
|
|
5661
|
-
return
|
|
5388
|
+
return H.indexOf(g) > -1 ? g : l;
|
|
5662
5389
|
}
|
|
5663
5390
|
function L(l, g) {
|
|
5664
5391
|
g = g || {};
|
|
@@ -5669,128 +5396,128 @@ var Je = { exports: {} };
|
|
|
5669
5396
|
this.url = l.url, this.credentials = l.credentials, g.headers || (this.headers = new y(l.headers)), this.method = l.method, this.mode = l.mode, this.signal = l.signal, !_ && l._bodyInit != null && (_ = l._bodyInit, l.bodyUsed = !0);
|
|
5670
5397
|
} else
|
|
5671
5398
|
this.url = String(l);
|
|
5672
|
-
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method =
|
|
5399
|
+
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") && _)
|
|
5673
5400
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
5674
5401
|
this._initBody(_);
|
|
5675
5402
|
}
|
|
5676
5403
|
L.prototype.clone = function() {
|
|
5677
5404
|
return new L(this, { body: this._bodyInit });
|
|
5678
5405
|
};
|
|
5679
|
-
function
|
|
5406
|
+
function fe(l) {
|
|
5680
5407
|
var g = new FormData();
|
|
5681
5408
|
return l.trim().split("&").forEach(function(_) {
|
|
5682
5409
|
if (_) {
|
|
5683
|
-
var
|
|
5684
|
-
g.append(decodeURIComponent(
|
|
5410
|
+
var O = _.split("="), N = O.shift().replace(/\+/g, " "), A = O.join("=").replace(/\+/g, " ");
|
|
5411
|
+
g.append(decodeURIComponent(N), decodeURIComponent(A));
|
|
5685
5412
|
}
|
|
5686
5413
|
}), g;
|
|
5687
5414
|
}
|
|
5688
|
-
function
|
|
5415
|
+
function pe(l) {
|
|
5689
5416
|
var g = new y(), _ = l.replace(/\r?\n[\t ]+/g, " ");
|
|
5690
|
-
return _.split(/\r?\n/).forEach(function(
|
|
5691
|
-
var
|
|
5417
|
+
return _.split(/\r?\n/).forEach(function(O) {
|
|
5418
|
+
var N = O.split(":"), A = N.shift().trim();
|
|
5692
5419
|
if (A) {
|
|
5693
|
-
var
|
|
5694
|
-
g.append(A,
|
|
5420
|
+
var ye = N.join(":").trim();
|
|
5421
|
+
g.append(A, ye);
|
|
5695
5422
|
}
|
|
5696
5423
|
}), g;
|
|
5697
5424
|
}
|
|
5698
|
-
|
|
5699
|
-
function
|
|
5425
|
+
F.call(L.prototype);
|
|
5426
|
+
function P(l, g) {
|
|
5700
5427
|
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);
|
|
5701
5428
|
}
|
|
5702
|
-
|
|
5703
|
-
return new
|
|
5429
|
+
F.call(P.prototype), P.prototype.clone = function() {
|
|
5430
|
+
return new P(this._bodyInit, {
|
|
5704
5431
|
status: this.status,
|
|
5705
5432
|
statusText: this.statusText,
|
|
5706
5433
|
headers: new y(this.headers),
|
|
5707
5434
|
url: this.url
|
|
5708
5435
|
});
|
|
5709
|
-
},
|
|
5710
|
-
var l = new
|
|
5436
|
+
}, P.error = function() {
|
|
5437
|
+
var l = new P(null, { status: 0, statusText: "" });
|
|
5711
5438
|
return l.type = "error", l;
|
|
5712
5439
|
};
|
|
5713
|
-
var
|
|
5714
|
-
|
|
5715
|
-
if (
|
|
5440
|
+
var In = [301, 302, 303, 307, 308];
|
|
5441
|
+
P.redirect = function(l, g) {
|
|
5442
|
+
if (In.indexOf(g) === -1)
|
|
5716
5443
|
throw new RangeError("Invalid status code");
|
|
5717
|
-
return new
|
|
5444
|
+
return new P(null, { status: g, headers: { location: l } });
|
|
5718
5445
|
}, o.DOMException = i.DOMException;
|
|
5719
5446
|
try {
|
|
5720
5447
|
new o.DOMException();
|
|
5721
5448
|
} catch {
|
|
5722
5449
|
o.DOMException = function(g, _) {
|
|
5723
5450
|
this.message = g, this.name = _;
|
|
5724
|
-
var
|
|
5725
|
-
this.stack =
|
|
5451
|
+
var O = Error(g);
|
|
5452
|
+
this.stack = O.stack;
|
|
5726
5453
|
}, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
|
|
5727
5454
|
}
|
|
5728
|
-
function
|
|
5729
|
-
return new Promise(function(_,
|
|
5730
|
-
var
|
|
5731
|
-
if (
|
|
5732
|
-
return
|
|
5455
|
+
function Re(l, g) {
|
|
5456
|
+
return new Promise(function(_, O) {
|
|
5457
|
+
var N = new L(l, g);
|
|
5458
|
+
if (N.signal && N.signal.aborted)
|
|
5459
|
+
return O(new o.DOMException("Aborted", "AbortError"));
|
|
5733
5460
|
var A = new XMLHttpRequest();
|
|
5734
|
-
function
|
|
5461
|
+
function ye() {
|
|
5735
5462
|
A.abort();
|
|
5736
5463
|
}
|
|
5737
5464
|
A.onload = function() {
|
|
5738
5465
|
var ie = {
|
|
5739
5466
|
status: A.status,
|
|
5740
5467
|
statusText: A.statusText,
|
|
5741
|
-
headers:
|
|
5468
|
+
headers: pe(A.getAllResponseHeaders() || "")
|
|
5742
5469
|
};
|
|
5743
5470
|
ie.url = "responseURL" in A ? A.responseURL : ie.headers.get("X-Request-URL");
|
|
5744
|
-
var
|
|
5745
|
-
_(new
|
|
5471
|
+
var qe = "response" in A ? A.response : A.responseText;
|
|
5472
|
+
_(new P(qe, ie));
|
|
5746
5473
|
}, A.onerror = function() {
|
|
5747
|
-
|
|
5474
|
+
O(new TypeError("Network request failed"));
|
|
5748
5475
|
}, A.ontimeout = function() {
|
|
5749
|
-
|
|
5476
|
+
O(new TypeError("Network request failed"));
|
|
5750
5477
|
}, A.onabort = function() {
|
|
5751
|
-
|
|
5752
|
-
}, A.open(
|
|
5753
|
-
A.setRequestHeader(
|
|
5754
|
-
}),
|
|
5755
|
-
A.readyState === 4 &&
|
|
5756
|
-
}), A.send(typeof
|
|
5478
|
+
O(new o.DOMException("Aborted", "AbortError"));
|
|
5479
|
+
}, A.open(N.method, N.url, !0), N.credentials === "include" ? A.withCredentials = !0 : N.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), N.headers.forEach(function(ie, qe) {
|
|
5480
|
+
A.setRequestHeader(qe, ie);
|
|
5481
|
+
}), N.signal && (N.signal.addEventListener("abort", ye), A.onreadystatechange = function() {
|
|
5482
|
+
A.readyState === 4 && N.signal.removeEventListener("abort", ye);
|
|
5483
|
+
}), A.send(typeof N._bodyInit > "u" ? null : N._bodyInit);
|
|
5757
5484
|
});
|
|
5758
5485
|
}
|
|
5759
|
-
return
|
|
5486
|
+
return Re.polyfill = !0, i.fetch || (i.fetch = Re, i.Headers = y, i.Request = L, i.Response = P), o.Headers = y, o.Request = L, o.Response = P, o.fetch = Re, Object.defineProperty(o, "__esModule", { value: !0 }), o;
|
|
5760
5487
|
})({});
|
|
5761
5488
|
})(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
|
|
5762
5489
|
var r = s;
|
|
5763
5490
|
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;
|
|
5764
|
-
})(
|
|
5765
|
-
var
|
|
5766
|
-
const
|
|
5491
|
+
})(We, We.exports);
|
|
5492
|
+
var xe = We.exports;
|
|
5493
|
+
const _e = /* @__PURE__ */ Br(xe), jr = /* @__PURE__ */ xn({
|
|
5767
5494
|
__proto__: null,
|
|
5768
|
-
default:
|
|
5769
|
-
}, [
|
|
5495
|
+
default: _e
|
|
5496
|
+
}, [xe]), W = (e) => {
|
|
5770
5497
|
let t = {};
|
|
5771
|
-
return e && (typeof Headers < "u" && e instanceof Headers ||
|
|
5498
|
+
return e && (typeof Headers < "u" && e instanceof Headers || jr && xe.Headers && e instanceof xe.Headers ? t = Js(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
|
|
5772
5499
|
n && s !== void 0 && (t[n] = s);
|
|
5773
5500
|
}) : t = e), t;
|
|
5774
|
-
},
|
|
5501
|
+
}, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), $r = (e) => {
|
|
5775
5502
|
if (!Array.isArray(e.query)) {
|
|
5776
|
-
const s = e, r = [`query=${encodeURIComponent(
|
|
5503
|
+
const s = e, r = [`query=${encodeURIComponent(Lt(s.query))}`];
|
|
5777
5504
|
return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
|
|
5778
5505
|
}
|
|
5779
5506
|
if (typeof e.variables < "u" && !Array.isArray(e.variables))
|
|
5780
5507
|
throw new Error("Cannot create query with given variable type, array expected");
|
|
5781
5508
|
const t = e, n = e.query.reduce((s, r, i) => (s.push({
|
|
5782
|
-
query:
|
|
5509
|
+
query: Lt(r),
|
|
5783
5510
|
variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
|
|
5784
5511
|
}), s), []);
|
|
5785
5512
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
5786
|
-
},
|
|
5513
|
+
}, Vr = (e) => async (t) => {
|
|
5787
5514
|
const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
|
|
5788
5515
|
let h = "", d;
|
|
5789
|
-
e === "POST" ? (d =
|
|
5516
|
+
e === "POST" ? (d = Hr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = $r({
|
|
5790
5517
|
query: s,
|
|
5791
5518
|
variables: r,
|
|
5792
5519
|
operationName: i,
|
|
5793
|
-
jsonSerializer: a.jsonSerializer ??
|
|
5520
|
+
jsonSerializer: a.jsonSerializer ?? dt
|
|
5794
5521
|
});
|
|
5795
5522
|
const f = {
|
|
5796
5523
|
method: e,
|
|
@@ -5800,23 +5527,23 @@ const Te = /* @__PURE__ */ qr(Ae), Lr = /* @__PURE__ */ In({
|
|
|
5800
5527
|
};
|
|
5801
5528
|
let m = n, y = f;
|
|
5802
5529
|
if (c) {
|
|
5803
|
-
const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url:
|
|
5804
|
-
m =
|
|
5530
|
+
const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: I, ...x } = v;
|
|
5531
|
+
m = I, y = x;
|
|
5805
5532
|
}
|
|
5806
5533
|
return h && (m = `${m}?${h}`), await o(m, y);
|
|
5807
5534
|
};
|
|
5808
|
-
class
|
|
5535
|
+
class vn {
|
|
5809
5536
|
constructor(t, n = {}) {
|
|
5810
5537
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
|
|
5811
|
-
const [r, i, o] = s, a =
|
|
5538
|
+
const [r, i, o] = s, a = Xs(r, i, o), { headers: c, fetch: u = _e, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
|
|
5812
5539
|
a.signal !== void 0 && (m.signal = a.signal);
|
|
5813
|
-
const { operationName: v } =
|
|
5814
|
-
return
|
|
5540
|
+
const { operationName: v } = Fe(a.query);
|
|
5541
|
+
return Be({
|
|
5815
5542
|
url: y,
|
|
5816
5543
|
query: a.query,
|
|
5817
5544
|
variables: a.variables,
|
|
5818
5545
|
headers: {
|
|
5819
|
-
...W(
|
|
5546
|
+
...W(je(c)),
|
|
5820
5547
|
...W(a.requestHeaders)
|
|
5821
5548
|
},
|
|
5822
5549
|
operationName: v,
|
|
@@ -5824,21 +5551,21 @@ class En {
|
|
|
5824
5551
|
method: h,
|
|
5825
5552
|
fetchOptions: m,
|
|
5826
5553
|
middleware: d
|
|
5827
|
-
}).then((
|
|
5828
|
-
throw f && f(
|
|
5554
|
+
}).then((I) => (f && f(I), I)).catch((I) => {
|
|
5555
|
+
throw f && f(I), I;
|
|
5829
5556
|
});
|
|
5830
5557
|
};
|
|
5831
5558
|
}
|
|
5832
5559
|
async request(t, ...n) {
|
|
5833
|
-
const [s, r] = n, i =
|
|
5560
|
+
const [s, r] = n, i = Ys(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
|
|
5834
5561
|
i.signal !== void 0 && (d.signal = i.signal);
|
|
5835
|
-
const { query: m, operationName: y } =
|
|
5836
|
-
return
|
|
5562
|
+
const { query: m, operationName: y } = Fe(i.document);
|
|
5563
|
+
return Be({
|
|
5837
5564
|
url: f,
|
|
5838
5565
|
query: m,
|
|
5839
5566
|
variables: i.variables,
|
|
5840
5567
|
headers: {
|
|
5841
|
-
...W(
|
|
5568
|
+
...W(je(o)),
|
|
5842
5569
|
...W(i.requestHeaders)
|
|
5843
5570
|
},
|
|
5844
5571
|
operationName: y,
|
|
@@ -5852,20 +5579,20 @@ class En {
|
|
|
5852
5579
|
}
|
|
5853
5580
|
// prettier-ignore
|
|
5854
5581
|
batchRequests(t, n) {
|
|
5855
|
-
const s =
|
|
5582
|
+
const s = Qs(t, n), { headers: r, ...i } = this.requestConfig;
|
|
5856
5583
|
s.signal !== void 0 && (i.signal = s.signal);
|
|
5857
|
-
const o = s.documents.map(({ document: c }) =>
|
|
5858
|
-
return
|
|
5584
|
+
const o = s.documents.map(({ document: c }) => Fe(c).query), a = s.documents.map(({ variables: c }) => c);
|
|
5585
|
+
return Be({
|
|
5859
5586
|
url: this.url,
|
|
5860
5587
|
query: o,
|
|
5861
5588
|
// @ts-expect-error TODO reconcile batch variables into system.
|
|
5862
5589
|
variables: a,
|
|
5863
5590
|
headers: {
|
|
5864
|
-
...W(
|
|
5591
|
+
...W(je(r)),
|
|
5865
5592
|
...W(s.requestHeaders)
|
|
5866
5593
|
},
|
|
5867
5594
|
operationName: void 0,
|
|
5868
|
-
fetch: this.requestConfig.fetch ??
|
|
5595
|
+
fetch: this.requestConfig.fetch ?? _e,
|
|
5869
5596
|
method: this.requestConfig.method || "POST",
|
|
5870
5597
|
fetchOptions: i,
|
|
5871
5598
|
middleware: this.requestConfig.requestMiddleware
|
|
@@ -5890,8 +5617,8 @@ class En {
|
|
|
5890
5617
|
return this.url = t, this;
|
|
5891
5618
|
}
|
|
5892
5619
|
}
|
|
5893
|
-
const
|
|
5894
|
-
const { query: t, variables: n, fetchOptions: s } = e, r =
|
|
5620
|
+
const Be = async (e) => {
|
|
5621
|
+
const { query: t, variables: n, fetchOptions: s } = e, r = Vr(Gs(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await zr(o, s.jsonSerializer ?? dt), 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";
|
|
5895
5622
|
if (o.ok && u && c) {
|
|
5896
5623
|
const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
|
|
5897
5624
|
return {
|
|
@@ -5910,26 +5637,560 @@ const Ue = async (e) => {
|
|
|
5910
5637
|
);
|
|
5911
5638
|
}
|
|
5912
5639
|
};
|
|
5913
|
-
async function
|
|
5914
|
-
const s =
|
|
5915
|
-
return new
|
|
5640
|
+
async function De(e, t, ...n) {
|
|
5641
|
+
const s = Ws(e, t, ...n);
|
|
5642
|
+
return new vn(s.url).request({
|
|
5916
5643
|
...s
|
|
5917
5644
|
});
|
|
5918
5645
|
}
|
|
5919
|
-
const
|
|
5920
|
-
const r = s ??
|
|
5646
|
+
const Hr = (e, t, n, s) => {
|
|
5647
|
+
const r = s ?? dt;
|
|
5921
5648
|
if (!Array.isArray(e))
|
|
5922
5649
|
return r.stringify({ query: e, variables: t, operationName: n });
|
|
5923
5650
|
if (typeof t < "u" && !Array.isArray(t))
|
|
5924
5651
|
throw new Error("Cannot create request body with given variable type, array expected");
|
|
5925
5652
|
const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
|
|
5926
5653
|
return r.stringify(i);
|
|
5927
|
-
},
|
|
5654
|
+
}, zr = async (e, t) => {
|
|
5928
5655
|
let n;
|
|
5929
5656
|
return e.headers.forEach((s, r) => {
|
|
5930
5657
|
r.toLowerCase() === "content-type" && (n = s);
|
|
5931
5658
|
}), 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();
|
|
5932
|
-
},
|
|
5659
|
+
}, je = (e) => typeof e == "function" ? e() : e, Gr = V(async ({ input: e }) => {
|
|
5660
|
+
var t;
|
|
5661
|
+
if (!e.endpoint || e.endpoint === "")
|
|
5662
|
+
throw new Error("No endpoint provided.");
|
|
5663
|
+
if (!e.data)
|
|
5664
|
+
throw new Error("No data provided.");
|
|
5665
|
+
if (!e.document)
|
|
5666
|
+
throw new Error("No request document provided.");
|
|
5667
|
+
if (!e.requestHeaders)
|
|
5668
|
+
throw new Error("No request headers provided.");
|
|
5669
|
+
try {
|
|
5670
|
+
const n = await De(
|
|
5671
|
+
e.endpoint,
|
|
5672
|
+
e.document,
|
|
5673
|
+
{
|
|
5674
|
+
step: e.data.step,
|
|
5675
|
+
data: {
|
|
5676
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
5677
|
+
[e.data.step]: e.data.data
|
|
5678
|
+
}
|
|
5679
|
+
},
|
|
5680
|
+
e.requestHeaders
|
|
5681
|
+
);
|
|
5682
|
+
if (!((t = n.checkoutStep) != null && t.quote))
|
|
5683
|
+
throw console.log("Could not add items to quote."), new Error("Could not add items to quote.");
|
|
5684
|
+
return {
|
|
5685
|
+
type: "SUBMIT_STEP_DATA_SUCCESS",
|
|
5686
|
+
quote: n.checkoutStep.quote
|
|
5687
|
+
};
|
|
5688
|
+
} catch {
|
|
5689
|
+
throw console.log("Request to add submit step data failed."), new Error("Request to add submit step data failed.");
|
|
5690
|
+
}
|
|
5691
|
+
}), Jr = ({ context: e }) => Object.keys(e.quote).length > 0, Pt = he({
|
|
5692
|
+
types: {
|
|
5693
|
+
context: {},
|
|
5694
|
+
events: {},
|
|
5695
|
+
input: {}
|
|
5696
|
+
},
|
|
5697
|
+
actions: { nextStep: C(zs) },
|
|
5698
|
+
actors: { submitStepData: Gr },
|
|
5699
|
+
guards: { quoteExists: Jr }
|
|
5700
|
+
}).createMachine({
|
|
5701
|
+
/** @todo do we need to add the view to the id? (e.g. checkout_en-us) */
|
|
5702
|
+
id: "checkout",
|
|
5703
|
+
initial: "uninitialized",
|
|
5704
|
+
context: ({ input: e }) => {
|
|
5705
|
+
var t, n, s, r, i, o, a, c, u, h, d;
|
|
5706
|
+
return {
|
|
5707
|
+
currentStep: (t = e == null ? void 0 : e.initialContext) != null && t.isLoggedIn ? "shipping_address" : "contact_information",
|
|
5708
|
+
errors: [],
|
|
5709
|
+
isLoggedIn: ((n = e == null ? void 0 : e.initialContext) == null ? void 0 : n.isLoggedIn) ?? !1,
|
|
5710
|
+
// sync with auth machine
|
|
5711
|
+
steps: ((s = e == null ? void 0 : e.initialContext) == null ? void 0 : s.steps) ?? [
|
|
5712
|
+
{ name: "contact_information", prev: null, next: "shipping_address" },
|
|
5713
|
+
{
|
|
5714
|
+
name: "shipping_address",
|
|
5715
|
+
prev: "contact_information",
|
|
5716
|
+
next: "payment_method"
|
|
5717
|
+
},
|
|
5718
|
+
{
|
|
5719
|
+
name: "payment_method",
|
|
5720
|
+
prev: "shipping_address",
|
|
5721
|
+
next: "shipping_method"
|
|
5722
|
+
},
|
|
5723
|
+
{ name: "shipping_method", prev: "payment_method", next: null }
|
|
5724
|
+
// 'createAccount',
|
|
5725
|
+
// 'shippingAddress',
|
|
5726
|
+
// 'paymentMethod',
|
|
5727
|
+
// 'shippingMethod',
|
|
5728
|
+
],
|
|
5729
|
+
quote: ((r = e == null ? void 0 : e.initialContext) == null ? void 0 : r.quote) ?? {},
|
|
5730
|
+
// sync with quote machine
|
|
5731
|
+
endpoints: {
|
|
5732
|
+
client: "",
|
|
5733
|
+
server: "",
|
|
5734
|
+
...(i = e == null ? void 0 : e.initialContext) == null ? void 0 : i.endpoints
|
|
5735
|
+
},
|
|
5736
|
+
graphql: {
|
|
5737
|
+
submitStepData: {
|
|
5738
|
+
document: ((c = (a = (o = e == null ? void 0 : e.initialContext) == null ? void 0 : o.graphql) == null ? void 0 : a.submitStepData) == null ? void 0 : c.document) ?? "",
|
|
5739
|
+
requestHeaders: ((d = (h = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : h.submitStepData) == null ? void 0 : d.requestHeaders) ?? void 0
|
|
5740
|
+
}
|
|
5741
|
+
}
|
|
5742
|
+
};
|
|
5743
|
+
},
|
|
5744
|
+
states: {
|
|
5745
|
+
/**
|
|
5746
|
+
* Checkout always starts in an uninitialized state to check
|
|
5747
|
+
* whether it has a quote object or not
|
|
5748
|
+
*/
|
|
5749
|
+
uninitialized: {
|
|
5750
|
+
always: {
|
|
5751
|
+
guard: "quoteExists",
|
|
5752
|
+
target: "initializing"
|
|
5753
|
+
}
|
|
5754
|
+
},
|
|
5755
|
+
/**
|
|
5756
|
+
* Initializing checks the quote object to determine which
|
|
5757
|
+
* step of checkout to target
|
|
5758
|
+
*/
|
|
5759
|
+
initializing: {
|
|
5760
|
+
always: [
|
|
5761
|
+
// { guard: ({ context }) => !!context.quote, target: 'showStep' },
|
|
5762
|
+
// { guard: ({ context }) => !!context.quote, target: 'showStep' },
|
|
5763
|
+
// {
|
|
5764
|
+
// guard: ({ context }) => !!context.quote && !!context.isLoggedIn,
|
|
5765
|
+
// target: 'showStep',
|
|
5766
|
+
// },
|
|
5767
|
+
{ target: "showStep" }
|
|
5768
|
+
]
|
|
5769
|
+
},
|
|
5770
|
+
showStep: {
|
|
5771
|
+
// always guard to make sure we can show the step we're on
|
|
5772
|
+
on: {
|
|
5773
|
+
SUBMIT_STEP_DATA: "submittingStepData",
|
|
5774
|
+
CHANGE_STEP: "changingStep"
|
|
5775
|
+
}
|
|
5776
|
+
},
|
|
5777
|
+
submittingStepData: {
|
|
5778
|
+
invoke: {
|
|
5779
|
+
input: ({ context: e, event: t }) => (on(t, "SUBMIT_STEP_DATA"), {
|
|
5780
|
+
// quoteId: context.quote.id,
|
|
5781
|
+
// locale: context.quote.locale,
|
|
5782
|
+
endpoint: e.endpoints.client,
|
|
5783
|
+
data: t.data,
|
|
5784
|
+
document: e.graphql.submitStepData.document,
|
|
5785
|
+
requestHeaders: e.graphql.submitStepData.requestHeaders
|
|
5786
|
+
}),
|
|
5787
|
+
src: "submitStepData",
|
|
5788
|
+
onDone: [
|
|
5789
|
+
{
|
|
5790
|
+
/**
|
|
5791
|
+
* @todo
|
|
5792
|
+
* how to handle quote and checkout being synced here?
|
|
5793
|
+
*/
|
|
5794
|
+
// actions: ['updateQuote', 'updateCheckout', 'nextStep'],
|
|
5795
|
+
actions: ["nextStep"],
|
|
5796
|
+
target: "showStep"
|
|
5797
|
+
}
|
|
5798
|
+
],
|
|
5799
|
+
onError: {
|
|
5800
|
+
/** @todo add action to emit checkout error */
|
|
5801
|
+
target: "showStep"
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5804
|
+
},
|
|
5805
|
+
changingStep: {}
|
|
5806
|
+
// syncIsLoggedIn: {},
|
|
5807
|
+
// syncQuote: {},
|
|
5808
|
+
// createAccount: {
|
|
5809
|
+
// on: {
|
|
5810
|
+
// SUBMIT_CREATE_ACCOUNT: 'submittingCreateAccount',
|
|
5811
|
+
// },
|
|
5812
|
+
// },
|
|
5813
|
+
// submittingCreateAccount: {
|
|
5814
|
+
// /** @todo when submitting step, need to unset quote data from future steps */
|
|
5815
|
+
// // invoke create account
|
|
5816
|
+
// },
|
|
5817
|
+
// shippingAddress: {
|
|
5818
|
+
// on: {
|
|
5819
|
+
// CHANGE_STEP: 'changingStep',
|
|
5820
|
+
// SUBMIT_SHIPPING_ADDRESS: 'submittingShippingAddress',
|
|
5821
|
+
// },
|
|
5822
|
+
// },
|
|
5823
|
+
// submittingShippingAddress: {},
|
|
5824
|
+
// paymentMethod: {},
|
|
5825
|
+
// submittingPaymentMethod: {},
|
|
5826
|
+
// shippingMethod: {},
|
|
5827
|
+
// submittingShippingMethod: {},
|
|
5828
|
+
// placingOrder: {},
|
|
5829
|
+
// orderSuccess: {},
|
|
5830
|
+
}
|
|
5831
|
+
// on: {
|
|
5832
|
+
// SYNC_IS_LOGGED_IN: '.syncIsLoggedIn',
|
|
5833
|
+
// SYNC_QUOTE: '.syncQuote',
|
|
5834
|
+
// },
|
|
5835
|
+
}), Tn = be({}), fi = () => {
|
|
5836
|
+
const e = Ne(Tn);
|
|
5837
|
+
if (!e || !e.getSnapshot)
|
|
5838
|
+
throw new Error("checkoutActor is not properly initialized");
|
|
5839
|
+
const [t, n] = Ke(() => e.getSnapshot());
|
|
5840
|
+
Ze(() => {
|
|
5841
|
+
if (!e || !e.getSnapshot) {
|
|
5842
|
+
console.error("checkoutActor is not properly initialized");
|
|
5843
|
+
return;
|
|
5844
|
+
}
|
|
5845
|
+
(() => {
|
|
5846
|
+
n(e.getSnapshot());
|
|
5847
|
+
})();
|
|
5848
|
+
const i = e.subscribe((o) => {
|
|
5849
|
+
n(o);
|
|
5850
|
+
});
|
|
5851
|
+
return () => {
|
|
5852
|
+
i.unsubscribe();
|
|
5853
|
+
};
|
|
5854
|
+
}, [e]);
|
|
5855
|
+
const s = t.context.currentStep ?? "";
|
|
5856
|
+
return {
|
|
5857
|
+
checkoutActor: e,
|
|
5858
|
+
currentStep: s
|
|
5859
|
+
};
|
|
5860
|
+
}, pi = async (e = {
|
|
5861
|
+
inspect: void 0,
|
|
5862
|
+
currentStep: "",
|
|
5863
|
+
steps: [],
|
|
5864
|
+
quote: { id: "", locale: "" },
|
|
5865
|
+
endpoints: { client: "", server: "" },
|
|
5866
|
+
graphql: {}
|
|
5867
|
+
}) => typeof window < "u" ? (console.warn(
|
|
5868
|
+
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
5869
|
+
), U(Pt, {
|
|
5870
|
+
inspect: e.inspect,
|
|
5871
|
+
input: {
|
|
5872
|
+
initialContext: {
|
|
5873
|
+
endpoints: e.endpoints
|
|
5874
|
+
}
|
|
5875
|
+
}
|
|
5876
|
+
}).start()) : U(Pt, {
|
|
5877
|
+
input: {
|
|
5878
|
+
initialContext: {
|
|
5879
|
+
currentStep: e.currentStep,
|
|
5880
|
+
steps: e.steps,
|
|
5881
|
+
endpoints: e.endpoints,
|
|
5882
|
+
graphql: e.graphql,
|
|
5883
|
+
quote: {
|
|
5884
|
+
...e.quote
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
},
|
|
5888
|
+
inspect: e.inspect
|
|
5889
|
+
}).start();
|
|
5890
|
+
function yi({ actor: e, children: t }) {
|
|
5891
|
+
return /* @__PURE__ */ we(Tn.Provider, { value: e, children: t });
|
|
5892
|
+
}
|
|
5893
|
+
const Yr = he({
|
|
5894
|
+
actors: {
|
|
5895
|
+
tick: As(
|
|
5896
|
+
({ sendBack: e, input: t }) => {
|
|
5897
|
+
const n = setInterval(() => {
|
|
5898
|
+
e({ type: "TICK" });
|
|
5899
|
+
}, t.interval);
|
|
5900
|
+
return () => {
|
|
5901
|
+
clearInterval(n);
|
|
5902
|
+
};
|
|
5903
|
+
}
|
|
5904
|
+
)
|
|
5905
|
+
},
|
|
5906
|
+
types: {
|
|
5907
|
+
context: {},
|
|
5908
|
+
events: {},
|
|
5909
|
+
input: {}
|
|
5910
|
+
}
|
|
5911
|
+
}).createMachine({
|
|
5912
|
+
id: "timer",
|
|
5913
|
+
initial: "running",
|
|
5914
|
+
context: ({ input: e }) => ({
|
|
5915
|
+
elapsed: 0,
|
|
5916
|
+
duration: e.initialContext.duration ?? 3e3,
|
|
5917
|
+
interval: 100,
|
|
5918
|
+
intervalId: null
|
|
5919
|
+
}),
|
|
5920
|
+
states: {
|
|
5921
|
+
paused: {
|
|
5922
|
+
on: {
|
|
5923
|
+
// START_TIMER: {
|
|
5924
|
+
// target: 'running',
|
|
5925
|
+
// cond: (context) => context.elapsed < context.duration,
|
|
5926
|
+
// },
|
|
5927
|
+
RESUME_TIMER: {
|
|
5928
|
+
target: "running",
|
|
5929
|
+
guard: ({ context: e }) => e.elapsed < e.duration
|
|
5930
|
+
}
|
|
5931
|
+
}
|
|
5932
|
+
},
|
|
5933
|
+
running: {
|
|
5934
|
+
// invoke: {
|
|
5935
|
+
// src:
|
|
5936
|
+
// ({ context }) =>
|
|
5937
|
+
// (send) => {
|
|
5938
|
+
// // eslint-disable-next-line no-console
|
|
5939
|
+
// // console.log('context.interval: ', context.interval);
|
|
5940
|
+
// const interval = setInterval(() => {
|
|
5941
|
+
// send('TICK');
|
|
5942
|
+
// }, context.interval);
|
|
5943
|
+
// return () => {
|
|
5944
|
+
// clearInterval(interval);
|
|
5945
|
+
// };
|
|
5946
|
+
// },
|
|
5947
|
+
// },
|
|
5948
|
+
invoke: {
|
|
5949
|
+
input: ({ context: e }) => ({ interval: e.interval }),
|
|
5950
|
+
src: "tick"
|
|
5951
|
+
},
|
|
5952
|
+
always: [
|
|
5953
|
+
{
|
|
5954
|
+
target: "completed",
|
|
5955
|
+
guard: ({ context: e }) => e.elapsed >= e.duration
|
|
5956
|
+
}
|
|
5957
|
+
],
|
|
5958
|
+
on: {
|
|
5959
|
+
TICK: {
|
|
5960
|
+
actions: C(({ context: e, event: t }) => t.type !== "TICK" ? e : {
|
|
5961
|
+
elapsed: e.elapsed + e.interval
|
|
5962
|
+
})
|
|
5963
|
+
},
|
|
5964
|
+
PAUSE_TIMER: { target: "paused" }
|
|
5965
|
+
}
|
|
5966
|
+
},
|
|
5967
|
+
completed: {
|
|
5968
|
+
type: "final"
|
|
5969
|
+
}
|
|
5970
|
+
}
|
|
5971
|
+
}), mi = he({
|
|
5972
|
+
actors: {
|
|
5973
|
+
timer: Yr
|
|
5974
|
+
},
|
|
5975
|
+
types: {
|
|
5976
|
+
context: {},
|
|
5977
|
+
events: {},
|
|
5978
|
+
input: {}
|
|
5979
|
+
},
|
|
5980
|
+
actions: {
|
|
5981
|
+
addItem: C(({ context: e, event: t }) => {
|
|
5982
|
+
if (t.type !== "ADD_ITEM")
|
|
5983
|
+
return e;
|
|
5984
|
+
const n = `notification-${Math.random().toString(36).slice(2, 11)}-${Date.now().toString(36)}`, s = t.duration ?? e.duration, r = An(t.item, {
|
|
5985
|
+
duration: s,
|
|
5986
|
+
id: n,
|
|
5987
|
+
key: t.item.key ?? n,
|
|
5988
|
+
...t.item.props
|
|
5989
|
+
}), i = {
|
|
5990
|
+
duration: s,
|
|
5991
|
+
id: n,
|
|
5992
|
+
element: r
|
|
5993
|
+
}, o = e.items;
|
|
5994
|
+
return e.order === "desc" ? o.push(i) : o.unshift(i), {
|
|
5995
|
+
items: o,
|
|
5996
|
+
activeItem: n
|
|
5997
|
+
};
|
|
5998
|
+
}),
|
|
5999
|
+
removeItem: C(({ context: e, event: t }) => {
|
|
6000
|
+
if (t.type !== "REMOVE_ITEM" && t.type !== "xstate.done.actor.timer")
|
|
6001
|
+
return e;
|
|
6002
|
+
const n = e.items;
|
|
6003
|
+
return e.order === "desc" ? (n.pop(), {
|
|
6004
|
+
items: n,
|
|
6005
|
+
activeItem: n.length > 0 ? n[n.length - 1].id : null
|
|
6006
|
+
}) : (n.shift(), {
|
|
6007
|
+
items: n,
|
|
6008
|
+
activeItem: n.length > 0 ? n[0].id : null
|
|
6009
|
+
});
|
|
6010
|
+
})
|
|
6011
|
+
},
|
|
6012
|
+
delays: {
|
|
6013
|
+
ITEM_TIMEOUT: ({ context: e }) => e.items[e.items.length - 1].duration ?? e.duration
|
|
6014
|
+
},
|
|
6015
|
+
guards: {
|
|
6016
|
+
itemHasTimeout: ({ context: e }) => e.items[e.items.length - 1].duration > 0 || e.duration > 0
|
|
6017
|
+
}
|
|
6018
|
+
}).createMachine({
|
|
6019
|
+
id: "toast",
|
|
6020
|
+
context: { items: [], order: "desc", duration: 0, activeItem: null },
|
|
6021
|
+
initial: "idle",
|
|
6022
|
+
states: {
|
|
6023
|
+
idle: {
|
|
6024
|
+
on: {
|
|
6025
|
+
ADD_ITEM: {
|
|
6026
|
+
target: "adding"
|
|
6027
|
+
}
|
|
6028
|
+
}
|
|
6029
|
+
},
|
|
6030
|
+
active: {
|
|
6031
|
+
invoke: {
|
|
6032
|
+
// id required to send events to
|
|
6033
|
+
id: "timer",
|
|
6034
|
+
src: "timer",
|
|
6035
|
+
input: ({ context: e }) => ({
|
|
6036
|
+
initialContext: {
|
|
6037
|
+
duration: e.items[e.items.length - 1].duration ?? e.duration
|
|
6038
|
+
}
|
|
6039
|
+
}),
|
|
6040
|
+
onDone: {
|
|
6041
|
+
target: "removing",
|
|
6042
|
+
guard: "itemHasTimeout"
|
|
6043
|
+
}
|
|
6044
|
+
// data: Object.assign(timerMachine.context, {
|
|
6045
|
+
// duration: (context: ToastMachineContext) =>
|
|
6046
|
+
// // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
6047
|
+
// context.items[context.items.length - 1].duration ??
|
|
6048
|
+
// context.duration,
|
|
6049
|
+
// }),
|
|
6050
|
+
},
|
|
6051
|
+
on: {
|
|
6052
|
+
ADD_ITEM: {
|
|
6053
|
+
// actions: sendTo('timer', 'PAUSE_TIMER'),
|
|
6054
|
+
target: "adding"
|
|
6055
|
+
},
|
|
6056
|
+
REMOVE_ITEM: {
|
|
6057
|
+
target: "removing"
|
|
6058
|
+
},
|
|
6059
|
+
SET_IDLE: {
|
|
6060
|
+
target: "idle"
|
|
6061
|
+
},
|
|
6062
|
+
RESUME_TIMER: {
|
|
6063
|
+
actions: bt("timer", { type: "RESUME_TIMER" })
|
|
6064
|
+
// cond: (context) => context.duration > 0,
|
|
6065
|
+
},
|
|
6066
|
+
PAUSE_TIMER: {
|
|
6067
|
+
actions: bt("timer", { type: "PAUSE_TIMER" })
|
|
6068
|
+
// cond: (context) => context.duration > 0,
|
|
6069
|
+
}
|
|
6070
|
+
}
|
|
6071
|
+
// after: {
|
|
6072
|
+
// ITEM_TIMEOUT: {
|
|
6073
|
+
// target: 'removing',
|
|
6074
|
+
// cond: 'itemHasTimeout',
|
|
6075
|
+
// },
|
|
6076
|
+
// },
|
|
6077
|
+
},
|
|
6078
|
+
adding: {
|
|
6079
|
+
entry: ["addItem"],
|
|
6080
|
+
on: {
|
|
6081
|
+
SET_IDLE: {
|
|
6082
|
+
target: "idle"
|
|
6083
|
+
},
|
|
6084
|
+
SET_ACTIVE: {
|
|
6085
|
+
target: "active"
|
|
6086
|
+
}
|
|
6087
|
+
}
|
|
6088
|
+
},
|
|
6089
|
+
removing: {
|
|
6090
|
+
entry: "removeItem",
|
|
6091
|
+
on: {
|
|
6092
|
+
SET_IDLE: {
|
|
6093
|
+
target: "idle"
|
|
6094
|
+
},
|
|
6095
|
+
SET_ACTIVE: {
|
|
6096
|
+
target: "active"
|
|
6097
|
+
}
|
|
6098
|
+
}
|
|
6099
|
+
}
|
|
6100
|
+
}
|
|
6101
|
+
}), _n = be(
|
|
6102
|
+
{}
|
|
6103
|
+
), gi = () => ({ toastActor: Ne(_n) });
|
|
6104
|
+
function Ei({ children: e, actor: t }) {
|
|
6105
|
+
return /* @__PURE__ */ we(_n.Provider, { value: t, children: e });
|
|
6106
|
+
}
|
|
6107
|
+
function Xr({
|
|
6108
|
+
context: e,
|
|
6109
|
+
event: t
|
|
6110
|
+
}) {
|
|
6111
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
6112
|
+
return e;
|
|
6113
|
+
const n = t;
|
|
6114
|
+
return n.output.type !== "ADD_ITEMS_SUCCESS" ? e : {
|
|
6115
|
+
quote: { ...e.quote, ...n.output.quote },
|
|
6116
|
+
itemsAdded: n.output.itemsAdded
|
|
6117
|
+
};
|
|
6118
|
+
}
|
|
6119
|
+
function Qr({
|
|
6120
|
+
event: e
|
|
6121
|
+
}) {
|
|
6122
|
+
if (!e.type.includes("xstate.done.actor"))
|
|
6123
|
+
return { type: "EMIT_ADD_ITEMS", itemsAdded: [] };
|
|
6124
|
+
const t = e;
|
|
6125
|
+
return t.output.type !== "ADD_ITEMS_SUCCESS" ? { type: "EMIT_ADD_ITEMS", itemsAdded: [] } : {
|
|
6126
|
+
type: "EMIT_ADD_ITEMS",
|
|
6127
|
+
itemsAdded: t.output.itemsAdded
|
|
6128
|
+
};
|
|
6129
|
+
}
|
|
6130
|
+
function Wr({
|
|
6131
|
+
event: e
|
|
6132
|
+
}) {
|
|
6133
|
+
if (!e.type.includes("xstate.done.actor"))
|
|
6134
|
+
return { type: "EMIT_REMOVE_ITEMS", itemsRemoved: [] };
|
|
6135
|
+
const t = e;
|
|
6136
|
+
return t.output.type !== "REMOVE_ITEMS_SUCCESS" ? { type: "EMIT_REMOVE_ITEMS", itemsRemoved: [] } : {
|
|
6137
|
+
type: "EMIT_REMOVE_ITEMS",
|
|
6138
|
+
itemsRemoved: t.output.itemsRemoved
|
|
6139
|
+
};
|
|
6140
|
+
}
|
|
6141
|
+
function Kr({
|
|
6142
|
+
event: e
|
|
6143
|
+
}) {
|
|
6144
|
+
if (!e.type.includes("xstate.done.actor"))
|
|
6145
|
+
return {
|
|
6146
|
+
type: "EMIT_UPDATE_ITEMS",
|
|
6147
|
+
itemsUpdated: []
|
|
6148
|
+
};
|
|
6149
|
+
const t = e;
|
|
6150
|
+
return t.output.type !== "UPDATE_ITEMS_SUCCESS" ? {
|
|
6151
|
+
type: "EMIT_UPDATE_ITEMS",
|
|
6152
|
+
itemsUpdated: []
|
|
6153
|
+
} : {
|
|
6154
|
+
type: "EMIT_UPDATE_ITEMS",
|
|
6155
|
+
itemsUpdated: t.output.itemsUpdated
|
|
6156
|
+
};
|
|
6157
|
+
}
|
|
6158
|
+
function Zr({
|
|
6159
|
+
context: e,
|
|
6160
|
+
event: t
|
|
6161
|
+
}) {
|
|
6162
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
6163
|
+
return e;
|
|
6164
|
+
const n = t;
|
|
6165
|
+
return n.output.type !== "REMOVE_ITEMS_SUCCESS" ? e : {
|
|
6166
|
+
quote: { ...e.quote, ...n.output.quote },
|
|
6167
|
+
itemsRemoved: n.output.itemsRemoved
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
function ei({
|
|
6171
|
+
context: e,
|
|
6172
|
+
event: t
|
|
6173
|
+
}) {
|
|
6174
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
6175
|
+
return e;
|
|
6176
|
+
const n = t;
|
|
6177
|
+
return n.output.type !== "REFRESH_SUCCESS" ? e : {
|
|
6178
|
+
quote: { ...e.quote, ...n.output.quote }
|
|
6179
|
+
};
|
|
6180
|
+
}
|
|
6181
|
+
function ti({
|
|
6182
|
+
context: e,
|
|
6183
|
+
event: t
|
|
6184
|
+
}) {
|
|
6185
|
+
if (!t.type.includes("xstate.done.actor"))
|
|
6186
|
+
return e;
|
|
6187
|
+
const n = t;
|
|
6188
|
+
return n.output.type !== "UPDATE_ITEMS_SUCCESS" ? e : {
|
|
6189
|
+
quote: { ...e.quote, ...n.output.quote },
|
|
6190
|
+
itemsUpdated: n.output.itemsUpdated
|
|
6191
|
+
};
|
|
6192
|
+
}
|
|
6193
|
+
const ni = V(
|
|
5933
6194
|
async ({ input: e }) => {
|
|
5934
6195
|
var t;
|
|
5935
6196
|
if (!e.endpoint || e.endpoint === "")
|
|
@@ -5941,7 +6202,7 @@ const Fr = (e, t, n, s) => {
|
|
|
5941
6202
|
if (!e.requestHeaders)
|
|
5942
6203
|
throw new Error("No request headers provided.");
|
|
5943
6204
|
try {
|
|
5944
|
-
const n = await
|
|
6205
|
+
const n = await De(
|
|
5945
6206
|
e.endpoint,
|
|
5946
6207
|
e.document,
|
|
5947
6208
|
{ items: e.items },
|
|
@@ -5958,14 +6219,14 @@ const Fr = (e, t, n, s) => {
|
|
|
5958
6219
|
throw new Error("Request to add item(s) failed.");
|
|
5959
6220
|
}
|
|
5960
6221
|
}
|
|
5961
|
-
),
|
|
6222
|
+
), si = V(async ({ input: e }) => {
|
|
5962
6223
|
var t;
|
|
5963
6224
|
if (!e.endpoint || e.endpoint === "")
|
|
5964
6225
|
throw new Error("No endpoint provided.");
|
|
5965
6226
|
if (e.items.length < 1)
|
|
5966
6227
|
throw new Error("No items provided.");
|
|
5967
6228
|
try {
|
|
5968
|
-
const n = await
|
|
6229
|
+
const n = await De(
|
|
5969
6230
|
e.endpoint,
|
|
5970
6231
|
""
|
|
5971
6232
|
// input.document,
|
|
@@ -5982,7 +6243,7 @@ const Fr = (e, t, n, s) => {
|
|
|
5982
6243
|
} catch {
|
|
5983
6244
|
throw new Error("Request to remove item(s) failed.");
|
|
5984
6245
|
}
|
|
5985
|
-
}),
|
|
6246
|
+
}), $e = typeof window > "u", ri = V(
|
|
5986
6247
|
async ({ input: e }) => {
|
|
5987
6248
|
var n, s, r, i;
|
|
5988
6249
|
if (!e.endpoint)
|
|
@@ -5995,9 +6256,9 @@ const Fr = (e, t, n, s) => {
|
|
|
5995
6256
|
throw console.log("no request document"), new Error("No request document provided.");
|
|
5996
6257
|
if (!e.requestHeaders)
|
|
5997
6258
|
throw console.log("no headers"), new Error("No request headers provided.");
|
|
5998
|
-
const t = new
|
|
5999
|
-
|
|
6000
|
-
|
|
6259
|
+
const t = new vn(
|
|
6260
|
+
$e ? e.endpointSsr : e.endpoint,
|
|
6261
|
+
$e ? { fetch, method: "POST" } : {
|
|
6001
6262
|
credentials: "include",
|
|
6002
6263
|
method: "POST",
|
|
6003
6264
|
mode: "cors"
|
|
@@ -6005,9 +6266,9 @@ const Fr = (e, t, n, s) => {
|
|
|
6005
6266
|
);
|
|
6006
6267
|
try {
|
|
6007
6268
|
const { data: o, headers: a, status: c, errors: u, extensions: h } = await t.rawRequest(
|
|
6008
|
-
|
|
6269
|
+
En(e.document),
|
|
6009
6270
|
{},
|
|
6010
|
-
|
|
6271
|
+
$e ? {
|
|
6011
6272
|
...e.requestHeaders,
|
|
6012
6273
|
Cookie: `quote_${e.locale}=${e.quoteId ?? ""}`
|
|
6013
6274
|
} : e.requestHeaders
|
|
@@ -6024,7 +6285,7 @@ const Fr = (e, t, n, s) => {
|
|
|
6024
6285
|
throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
|
|
6025
6286
|
}
|
|
6026
6287
|
}
|
|
6027
|
-
),
|
|
6288
|
+
), ii = V(async ({ input: e }) => {
|
|
6028
6289
|
var t;
|
|
6029
6290
|
if (!e.endpoint || e.endpoint === "")
|
|
6030
6291
|
throw new Error("No endpoint provided.");
|
|
@@ -6035,7 +6296,7 @@ const Fr = (e, t, n, s) => {
|
|
|
6035
6296
|
if (!e.requestHeaders)
|
|
6036
6297
|
throw new Error("No request headers provided.");
|
|
6037
6298
|
try {
|
|
6038
|
-
const n = await
|
|
6299
|
+
const n = await De(
|
|
6039
6300
|
e.endpoint,
|
|
6040
6301
|
e.document,
|
|
6041
6302
|
{ items: e.items },
|
|
@@ -6051,7 +6312,7 @@ const Fr = (e, t, n, s) => {
|
|
|
6051
6312
|
} catch {
|
|
6052
6313
|
throw new Error("Request to add item(s) failed.");
|
|
6053
6314
|
}
|
|
6054
|
-
}),
|
|
6315
|
+
}), oi = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", ai = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Ut = he({
|
|
6055
6316
|
types: {
|
|
6056
6317
|
context: {},
|
|
6057
6318
|
emitted: {},
|
|
@@ -6059,30 +6320,30 @@ const Fr = (e, t, n, s) => {
|
|
|
6059
6320
|
input: {}
|
|
6060
6321
|
},
|
|
6061
6322
|
actions: {
|
|
6062
|
-
addItems:
|
|
6063
|
-
notifyAddItems:
|
|
6064
|
-
notifyRemoveItems:
|
|
6065
|
-
notifyUpdateItems:
|
|
6066
|
-
removeItems:
|
|
6067
|
-
refresh:
|
|
6068
|
-
updateItems:
|
|
6323
|
+
addItems: C(Xr),
|
|
6324
|
+
notifyAddItems: Pe(Qr),
|
|
6325
|
+
notifyRemoveItems: Pe(Wr),
|
|
6326
|
+
notifyUpdateItems: Pe(Kr),
|
|
6327
|
+
removeItems: C(Zr),
|
|
6328
|
+
refresh: C(ei),
|
|
6329
|
+
updateItems: C(ti)
|
|
6069
6330
|
},
|
|
6070
6331
|
actors: {
|
|
6071
|
-
addItems:
|
|
6072
|
-
removeItems:
|
|
6073
|
-
refresh:
|
|
6074
|
-
updateItems:
|
|
6332
|
+
addItems: ni,
|
|
6333
|
+
removeItems: si,
|
|
6334
|
+
refresh: ri,
|
|
6335
|
+
updateItems: ii
|
|
6075
6336
|
},
|
|
6076
6337
|
guards: {
|
|
6077
|
-
canRefresh:
|
|
6078
|
-
hasItems:
|
|
6338
|
+
canRefresh: oi,
|
|
6339
|
+
hasItems: ai
|
|
6079
6340
|
}
|
|
6080
6341
|
}).createMachine({
|
|
6081
6342
|
/** @todo do we need to add the view to the id? (e.g. quote_en-us) */
|
|
6082
6343
|
id: "quote",
|
|
6083
6344
|
initial: "initializing",
|
|
6084
6345
|
context: ({ input: e }) => {
|
|
6085
|
-
var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v,
|
|
6346
|
+
var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, I, x, R, k, q, F, H, z, L, fe, pe;
|
|
6086
6347
|
return {
|
|
6087
6348
|
quote: {
|
|
6088
6349
|
id: "",
|
|
@@ -6096,7 +6357,11 @@ const Fr = (e, t, n, s) => {
|
|
|
6096
6357
|
promotions: [],
|
|
6097
6358
|
shippingAddresses: {
|
|
6098
6359
|
available: [],
|
|
6099
|
-
|
|
6360
|
+
applied: []
|
|
6361
|
+
},
|
|
6362
|
+
paymentMethods: {
|
|
6363
|
+
available: [],
|
|
6364
|
+
applied: []
|
|
6100
6365
|
},
|
|
6101
6366
|
totals: {
|
|
6102
6367
|
discount: 0,
|
|
@@ -6109,7 +6374,6 @@ const Fr = (e, t, n, s) => {
|
|
|
6109
6374
|
appliedPriceRules: [],
|
|
6110
6375
|
appliedPromotions: [],
|
|
6111
6376
|
shippingMethods: [],
|
|
6112
|
-
paymentMethods: [],
|
|
6113
6377
|
storeCredit: [],
|
|
6114
6378
|
rewards: [],
|
|
6115
6379
|
giftCards: [],
|
|
@@ -6150,12 +6414,12 @@ const Fr = (e, t, n, s) => {
|
|
|
6150
6414
|
requestHeaders: ((y = (m = (f = e == null ? void 0 : e.initialContext) == null ? void 0 : f.graphql) == null ? void 0 : m.addItems) == null ? void 0 : y.requestHeaders) ?? void 0
|
|
6151
6415
|
},
|
|
6152
6416
|
removeItems: {
|
|
6153
|
-
document: ((x = (
|
|
6154
|
-
requestHeaders: ((
|
|
6417
|
+
document: ((x = (I = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : I.removeItems) == null ? void 0 : x.document) ?? "",
|
|
6418
|
+
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
|
|
6155
6419
|
},
|
|
6156
6420
|
updateItems: {
|
|
6157
|
-
document: ((
|
|
6158
|
-
requestHeaders: ((
|
|
6421
|
+
document: ((z = (H = (F = e == null ? void 0 : e.initialContext) == null ? void 0 : F.graphql) == null ? void 0 : H.updateItems) == null ? void 0 : z.document) ?? "",
|
|
6422
|
+
requestHeaders: ((pe = (fe = (L = e == null ? void 0 : e.initialContext) == null ? void 0 : L.graphql) == null ? void 0 : fe.updateItems) == null ? void 0 : pe.requestHeaders) ?? void 0
|
|
6159
6423
|
}
|
|
6160
6424
|
}
|
|
6161
6425
|
};
|
|
@@ -6425,15 +6689,15 @@ const Fr = (e, t, n, s) => {
|
|
|
6425
6689
|
// removingGiftCard: {},
|
|
6426
6690
|
// applyingSettings: {},
|
|
6427
6691
|
}
|
|
6428
|
-
}),
|
|
6692
|
+
}), Sn = be(
|
|
6429
6693
|
{}
|
|
6430
|
-
),
|
|
6694
|
+
), vi = () => {
|
|
6431
6695
|
var c;
|
|
6432
|
-
const e =
|
|
6696
|
+
const e = Ne(Sn);
|
|
6433
6697
|
if (!e || !e.getSnapshot)
|
|
6434
6698
|
throw new Error("quoteActor is not properly initialized");
|
|
6435
|
-
const [t, n] =
|
|
6436
|
-
|
|
6699
|
+
const [t, n] = Ke(() => e.getSnapshot());
|
|
6700
|
+
Ze(() => {
|
|
6437
6701
|
if (!e || !e.getSnapshot) {
|
|
6438
6702
|
console.error("quoteActor is not properly initialized");
|
|
6439
6703
|
return;
|
|
@@ -6457,21 +6721,21 @@ const Fr = (e, t, n, s) => {
|
|
|
6457
6721
|
isRemovingItems: o,
|
|
6458
6722
|
isUpdatingItems: a
|
|
6459
6723
|
};
|
|
6460
|
-
},
|
|
6724
|
+
}, Ti = async (e = {
|
|
6461
6725
|
inspect: void 0,
|
|
6462
6726
|
quote: { id: "", locale: "" },
|
|
6463
6727
|
endpoints: { client: "", server: "" },
|
|
6464
6728
|
graphql: {}
|
|
6465
6729
|
}) => typeof window < "u" ? (console.warn(
|
|
6466
6730
|
"App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
|
|
6467
|
-
),
|
|
6731
|
+
), U(Ut, {
|
|
6468
6732
|
inspect: e.inspect,
|
|
6469
6733
|
input: {
|
|
6470
6734
|
initialContext: {
|
|
6471
6735
|
endpoints: e.endpoints
|
|
6472
6736
|
}
|
|
6473
6737
|
}
|
|
6474
|
-
}).start()) :
|
|
6738
|
+
}).start()) : U(Ut, {
|
|
6475
6739
|
input: {
|
|
6476
6740
|
initialContext: {
|
|
6477
6741
|
endpoints: e.endpoints,
|
|
@@ -6484,23 +6748,28 @@ const Fr = (e, t, n, s) => {
|
|
|
6484
6748
|
},
|
|
6485
6749
|
inspect: e.inspect
|
|
6486
6750
|
}).start();
|
|
6487
|
-
function
|
|
6488
|
-
return /* @__PURE__ */
|
|
6751
|
+
function _i({ actor: e, children: t }) {
|
|
6752
|
+
return /* @__PURE__ */ we(Sn.Provider, { value: e, children: t });
|
|
6489
6753
|
}
|
|
6490
6754
|
export {
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6755
|
+
an as AuthContext,
|
|
6756
|
+
hi as AuthProvider,
|
|
6757
|
+
Tn as CheckoutContext,
|
|
6758
|
+
yi as CheckoutProvider,
|
|
6759
|
+
Sn as QuoteContext,
|
|
6760
|
+
_i as QuoteProvider,
|
|
6761
|
+
_n as ToastContext,
|
|
6762
|
+
Ei as ToastProvider,
|
|
6763
|
+
Ot as authMachine,
|
|
6764
|
+
Pt as checkoutMachine,
|
|
6765
|
+
li as getAuth,
|
|
6766
|
+
pi as getCheckout,
|
|
6767
|
+
Ti as getQuote,
|
|
6768
|
+
Ut as quoteMachine,
|
|
6769
|
+
Yr as timerMachine,
|
|
6770
|
+
mi as toastMachine,
|
|
6771
|
+
di as useAuth,
|
|
6772
|
+
fi as useCheckout,
|
|
6773
|
+
vi as useQuote,
|
|
6774
|
+
gi as useToast
|
|
6506
6775
|
};
|