@clicktap/state 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +21 -21
- package/index.mjs +215 -211
- package/package.json +3 -2
- package/quote/guards/index.d.ts +1 -0
package/index.mjs
CHANGED
|
@@ -120,19 +120,19 @@ function Dn(e, t) {
|
|
|
120
120
|
id: S,
|
|
121
121
|
startedAt: Date.now()
|
|
122
122
|
}, R = ct(h, S);
|
|
123
|
-
|
|
123
|
+
d._snapshot._scheduledEvents[R] = A;
|
|
124
124
|
const D = a.setTimeout(() => {
|
|
125
|
-
delete o[R], delete
|
|
125
|
+
delete o[R], delete d._snapshot._scheduledEvents[R], d._relay(h, m, y);
|
|
126
126
|
}, v);
|
|
127
127
|
o[R] = D;
|
|
128
128
|
},
|
|
129
129
|
cancel: (h, m) => {
|
|
130
130
|
const y = ct(h, m), v = o[y];
|
|
131
|
-
delete o[y], delete
|
|
131
|
+
delete o[y], delete d._snapshot._scheduledEvents[y], a.clearTimeout(v);
|
|
132
132
|
},
|
|
133
133
|
cancelAll: (h) => {
|
|
134
|
-
for (const m in
|
|
135
|
-
const y =
|
|
134
|
+
for (const m in d._snapshot._scheduledEvents) {
|
|
135
|
+
const y = d._snapshot._scheduledEvents[m];
|
|
136
136
|
y.source === h && u.cancel(h, y.id);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -147,7 +147,7 @@ function Dn(e, t) {
|
|
|
147
147
|
var v;
|
|
148
148
|
return (v = y.next) == null ? void 0 : v.call(y, m);
|
|
149
149
|
});
|
|
150
|
-
},
|
|
150
|
+
}, d = {
|
|
151
151
|
_snapshot: {
|
|
152
152
|
_scheduledEvents: ((t == null ? void 0 : t.snapshot) && t.snapshot.scheduler) ?? {}
|
|
153
153
|
},
|
|
@@ -170,7 +170,7 @@ function Dn(e, t) {
|
|
|
170
170
|
},
|
|
171
171
|
_sendInspectionEvent: f,
|
|
172
172
|
_relay: (h, m, y) => {
|
|
173
|
-
|
|
173
|
+
d._sendInspectionEvent({
|
|
174
174
|
type: "@xstate.event",
|
|
175
175
|
sourceRef: h,
|
|
176
176
|
actorRef: m,
|
|
@@ -180,12 +180,12 @@ function Dn(e, t) {
|
|
|
180
180
|
scheduler: u,
|
|
181
181
|
getSnapshot: () => ({
|
|
182
182
|
_scheduledEvents: {
|
|
183
|
-
...
|
|
183
|
+
...d._snapshot._scheduledEvents
|
|
184
184
|
}
|
|
185
185
|
}),
|
|
186
186
|
start: () => {
|
|
187
|
-
const h =
|
|
188
|
-
|
|
187
|
+
const h = d._snapshot._scheduledEvents;
|
|
188
|
+
d._snapshot._scheduledEvents = {};
|
|
189
189
|
for (const m in h) {
|
|
190
190
|
const {
|
|
191
191
|
source: y,
|
|
@@ -200,7 +200,7 @@ function Dn(e, t) {
|
|
|
200
200
|
_clock: a,
|
|
201
201
|
_logger: c
|
|
202
202
|
};
|
|
203
|
-
return
|
|
203
|
+
return d;
|
|
204
204
|
}
|
|
205
205
|
function Ft(e, t) {
|
|
206
206
|
const n = ut(e), s = ut(t);
|
|
@@ -245,7 +245,7 @@ function Rn(e) {
|
|
|
245
245
|
}
|
|
246
246
|
return t;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function lt(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];
|
|
@@ -281,7 +281,7 @@ function jt(e) {
|
|
|
281
281
|
if (!(e === void 0 || e === xn))
|
|
282
282
|
return F(e);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function dt(e, t, n) {
|
|
285
285
|
var i, o, a;
|
|
286
286
|
const s = typeof e == "object", r = s ? e : void 0;
|
|
287
287
|
return {
|
|
@@ -336,25 +336,25 @@ class Pn {
|
|
|
336
336
|
this.system = o ? o.system : Dn(this, {
|
|
337
337
|
clock: r,
|
|
338
338
|
logger: i
|
|
339
|
-
}), f && !o && this.system.inspect(
|
|
339
|
+
}), f && !o && this.system.inspect(dt(f)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (n == null ? void 0 : n.logger) ?? this.system._logger, this.clock = (n == null ? void 0 : n.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = s, this.src = s.src ?? t, this.ref = this, this._actorScope = {
|
|
340
340
|
self: this,
|
|
341
341
|
id: this.id,
|
|
342
342
|
sessionId: this.sessionId,
|
|
343
343
|
logger: this.logger,
|
|
344
|
-
defer: (
|
|
345
|
-
this._deferred.push(
|
|
344
|
+
defer: (d) => {
|
|
345
|
+
this._deferred.push(d);
|
|
346
346
|
},
|
|
347
347
|
system: this.system,
|
|
348
|
-
stopChild: (
|
|
349
|
-
if (
|
|
350
|
-
throw new Error(`Cannot stop child actor ${
|
|
351
|
-
|
|
348
|
+
stopChild: (d) => {
|
|
349
|
+
if (d._parent !== this)
|
|
350
|
+
throw new Error(`Cannot stop child actor ${d.id} of ${this.id} because it is not a child`);
|
|
351
|
+
d._stop();
|
|
352
352
|
},
|
|
353
|
-
emit: (
|
|
354
|
-
const h = this.eventListeners.get(
|
|
353
|
+
emit: (d) => {
|
|
354
|
+
const h = this.eventListeners.get(d.type);
|
|
355
355
|
if (h)
|
|
356
356
|
for (const m of Array.from(h))
|
|
357
|
-
m(
|
|
357
|
+
m(d);
|
|
358
358
|
}
|
|
359
359
|
}, this.send = this.send.bind(this), this.system._sendInspectionEvent({
|
|
360
360
|
type: "@xstate.actor",
|
|
@@ -466,7 +466,7 @@ class Pn {
|
|
|
466
466
|
*/
|
|
467
467
|
subscribe(t, n, s) {
|
|
468
468
|
var i;
|
|
469
|
-
const r =
|
|
469
|
+
const r = dt(t, n, s);
|
|
470
470
|
if (this._processingStatus !== k.Stopped)
|
|
471
471
|
this.observers.add(r);
|
|
472
472
|
else
|
|
@@ -709,8 +709,8 @@ function Bn(e, t, n, s, {
|
|
|
709
709
|
syncSnapshot: c
|
|
710
710
|
}) {
|
|
711
711
|
const u = typeof o == "string" ? Xe(t.machine, o) : o, f = typeof r == "function" ? r(n) : r;
|
|
712
|
-
let
|
|
713
|
-
return u && (
|
|
712
|
+
let d;
|
|
713
|
+
return u && (d = U(u, {
|
|
714
714
|
id: f,
|
|
715
715
|
src: o,
|
|
716
716
|
parent: e.self,
|
|
@@ -724,11 +724,11 @@ function Bn(e, t, n, s, {
|
|
|
724
724
|
})), [H(t, {
|
|
725
725
|
children: {
|
|
726
726
|
...t.children,
|
|
727
|
-
[f]:
|
|
727
|
+
[f]: d
|
|
728
728
|
}
|
|
729
729
|
}), {
|
|
730
730
|
id: r,
|
|
731
|
-
actorRef:
|
|
731
|
+
actorRef: d
|
|
732
732
|
}];
|
|
733
733
|
}
|
|
734
734
|
function jn(e, {
|
|
@@ -1193,16 +1193,16 @@ function Be(e, t, n, s, r, i) {
|
|
|
1193
1193
|
let a = t.historyValue;
|
|
1194
1194
|
const c = Yt(e, o, a);
|
|
1195
1195
|
let u = t;
|
|
1196
|
-
r || ([u, a] = os(u, s, n, c, o, a, i)), u = te(u, s, n, c.flatMap((
|
|
1196
|
+
r || ([u, a] = os(u, s, n, c, o, a, i)), u = te(u, s, n, c.flatMap((d) => d.actions), i), u = rs(u, s, n, c, o, i, a, r);
|
|
1197
1197
|
const f = [...o];
|
|
1198
|
-
u.status === "done" && (u = te(u, s, n, f.sort((
|
|
1198
|
+
u.status === "done" && (u = te(u, s, n, f.sort((d, h) => h.order - d.order).flatMap((d) => d.exit), i));
|
|
1199
1199
|
try {
|
|
1200
1200
|
return a === t.historyValue && ns(t._nodes, o) ? u : H(u, {
|
|
1201
1201
|
_nodes: f,
|
|
1202
1202
|
historyValue: a
|
|
1203
1203
|
});
|
|
1204
|
-
} catch (
|
|
1205
|
-
throw
|
|
1204
|
+
} catch (d) {
|
|
1205
|
+
throw d;
|
|
1206
1206
|
}
|
|
1207
1207
|
}
|
|
1208
1208
|
function ss(e, t, n, s, r) {
|
|
@@ -1215,7 +1215,7 @@ function rs(e, t, n, s, r, i, o, a) {
|
|
|
1215
1215
|
let c = e;
|
|
1216
1216
|
const u = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
|
|
1217
1217
|
is(s, o, f, u), a && f.add(e.machine.root);
|
|
1218
|
-
const
|
|
1218
|
+
const d = /* @__PURE__ */ new Set();
|
|
1219
1219
|
for (const h of [...u].sort((m, y) => m.order - y.order)) {
|
|
1220
1220
|
r.add(h);
|
|
1221
1221
|
const m = [];
|
|
@@ -1232,8 +1232,8 @@ function rs(e, t, n, s, r, i, o, a) {
|
|
|
1232
1232
|
if (c = te(c, t, n, m, i, h.invoke.map((y) => y.id)), h.type === "final") {
|
|
1233
1233
|
const y = h.parent;
|
|
1234
1234
|
let v = (y == null ? void 0 : y.type) === "parallel" ? y : y == null ? void 0 : y.parent, S = v || h;
|
|
1235
|
-
for ((y == null ? void 0 : y.type) === "compound" && i.push(qe(y.id, h.output !== void 0 ? Fe(h.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !
|
|
1236
|
-
|
|
1235
|
+
for ((y == null ? void 0 : y.type) === "compound" && i.push(qe(y.id, h.output !== void 0 ? Fe(h.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !d.has(v) && Ze(r, v); )
|
|
1236
|
+
d.add(v), i.push(qe(v.id)), S = v, v = v.parent;
|
|
1237
1237
|
if (v)
|
|
1238
1238
|
continue;
|
|
1239
1239
|
c = H(c, {
|
|
@@ -1295,17 +1295,17 @@ function Ne(e, t, n, s, r) {
|
|
|
1295
1295
|
function os(e, t, n, s, r, i, o) {
|
|
1296
1296
|
let a = e;
|
|
1297
1297
|
const c = Ue(s, r, i);
|
|
1298
|
-
c.sort((f,
|
|
1298
|
+
c.sort((f, d) => d.order - f.order);
|
|
1299
1299
|
let u;
|
|
1300
1300
|
for (const f of c)
|
|
1301
|
-
for (const
|
|
1301
|
+
for (const d of Zn(f)) {
|
|
1302
1302
|
let h;
|
|
1303
|
-
|
|
1303
|
+
d.history === "deep" ? h = (m) => Ke(m) && B(m, f) : h = (m) => m.parent === f, u ?? (u = {
|
|
1304
1304
|
...i
|
|
1305
|
-
}), u[
|
|
1305
|
+
}), u[d.id] = Array.from(r).filter(h);
|
|
1306
1306
|
}
|
|
1307
1307
|
for (const f of c)
|
|
1308
|
-
a = te(a, t, n, [...f.exit, ...f.invoke.map((
|
|
1308
|
+
a = te(a, t, n, [...f.exit, ...f.invoke.map((d) => $t(d.id))], o), r.delete(f);
|
|
1309
1309
|
return [a, u || i];
|
|
1310
1310
|
}
|
|
1311
1311
|
let pt = !1;
|
|
@@ -1325,7 +1325,7 @@ function Wt(e, t, n, s, r, i) {
|
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
try {
|
|
1328
|
-
pt = f, f(
|
|
1328
|
+
pt = f, f(d, h);
|
|
1329
1329
|
} finally {
|
|
1330
1330
|
pt = !1;
|
|
1331
1331
|
}
|
|
@@ -1338,7 +1338,7 @@ function Wt(e, t, n, s, r, i) {
|
|
|
1338
1338
|
);
|
|
1339
1339
|
if (!f)
|
|
1340
1340
|
continue;
|
|
1341
|
-
const
|
|
1341
|
+
const d = {
|
|
1342
1342
|
context: a.context,
|
|
1343
1343
|
event: t,
|
|
1344
1344
|
self: n.self,
|
|
@@ -1356,7 +1356,7 @@ function Wt(e, t, n, s, r, i) {
|
|
|
1356
1356
|
const y = f, [v, S, A] = y.resolve(
|
|
1357
1357
|
n,
|
|
1358
1358
|
a,
|
|
1359
|
-
|
|
1359
|
+
d,
|
|
1360
1360
|
h,
|
|
1361
1361
|
f,
|
|
1362
1362
|
// this holds all params
|
|
@@ -1378,13 +1378,13 @@ function te(e, t, n, s, r, i) {
|
|
|
1378
1378
|
function ke(e, t, n, s = []) {
|
|
1379
1379
|
let r = e;
|
|
1380
1380
|
const i = [];
|
|
1381
|
-
function o(u, f,
|
|
1381
|
+
function o(u, f, d) {
|
|
1382
1382
|
n.system._sendInspectionEvent({
|
|
1383
1383
|
type: "@xstate.microstep",
|
|
1384
1384
|
actorRef: n.self,
|
|
1385
1385
|
event: f,
|
|
1386
1386
|
snapshot: u,
|
|
1387
|
-
_transitions:
|
|
1387
|
+
_transitions: d
|
|
1388
1388
|
}), i.push(u);
|
|
1389
1389
|
}
|
|
1390
1390
|
if (t.type === ae)
|
|
@@ -1396,8 +1396,8 @@ function ke(e, t, n, s = []) {
|
|
|
1396
1396
|
};
|
|
1397
1397
|
let a = t;
|
|
1398
1398
|
if (a.type !== Mt) {
|
|
1399
|
-
const u = a, f = Ln(u),
|
|
1400
|
-
if (f && !
|
|
1399
|
+
const u = a, f = Ln(u), d = mt(u, r);
|
|
1400
|
+
if (f && !d.length)
|
|
1401
1401
|
return r = H(e, {
|
|
1402
1402
|
status: "error",
|
|
1403
1403
|
error: u.error
|
|
@@ -1406,14 +1406,14 @@ function ke(e, t, n, s = []) {
|
|
|
1406
1406
|
microstates: i
|
|
1407
1407
|
};
|
|
1408
1408
|
r = Be(
|
|
1409
|
-
|
|
1409
|
+
d,
|
|
1410
1410
|
e,
|
|
1411
1411
|
n,
|
|
1412
1412
|
a,
|
|
1413
1413
|
!1,
|
|
1414
1414
|
// isInitial
|
|
1415
1415
|
s
|
|
1416
|
-
), o(r, u,
|
|
1416
|
+
), o(r, u, d);
|
|
1417
1417
|
}
|
|
1418
1418
|
let c = !0;
|
|
1419
1419
|
for (; r.status === "active"; ) {
|
|
@@ -1458,9 +1458,9 @@ function cs(e, t) {
|
|
|
1458
1458
|
function us(e) {
|
|
1459
1459
|
return !!e && typeof e == "object" && "machine" in e && "value" in e;
|
|
1460
1460
|
}
|
|
1461
|
-
const
|
|
1461
|
+
const ls = function(t) {
|
|
1462
1462
|
return Ft(t, this.value);
|
|
1463
|
-
},
|
|
1463
|
+
}, ds = function(t) {
|
|
1464
1464
|
return this.tags.has(t);
|
|
1465
1465
|
}, hs = function(t) {
|
|
1466
1466
|
const n = this.machine.getTransitionData(this, t);
|
|
@@ -1497,8 +1497,8 @@ function ye(e, t) {
|
|
|
1497
1497
|
tags: new Set(e._nodes.flatMap((n) => n.tags)),
|
|
1498
1498
|
children: e.children,
|
|
1499
1499
|
historyValue: e.historyValue || {},
|
|
1500
|
-
matches:
|
|
1501
|
-
hasTag:
|
|
1500
|
+
matches: ls,
|
|
1501
|
+
hasTag: ds,
|
|
1502
1502
|
can: hs,
|
|
1503
1503
|
getMeta: ps,
|
|
1504
1504
|
toJSON: fs
|
|
@@ -1521,7 +1521,7 @@ function ys(e, t) {
|
|
|
1521
1521
|
hasTag: c,
|
|
1522
1522
|
matches: u,
|
|
1523
1523
|
getMeta: f,
|
|
1524
|
-
toJSON:
|
|
1524
|
+
toJSON: d,
|
|
1525
1525
|
...h
|
|
1526
1526
|
} = e, m = {};
|
|
1527
1527
|
for (const v in i) {
|
|
@@ -1573,8 +1573,8 @@ function ms(e, t, n, s, {
|
|
|
1573
1573
|
const u = typeof r == "function" ? r(n, s) : r;
|
|
1574
1574
|
let f;
|
|
1575
1575
|
if (typeof o == "string") {
|
|
1576
|
-
const
|
|
1577
|
-
f = typeof
|
|
1576
|
+
const d = c && c[o];
|
|
1577
|
+
f = typeof d == "function" ? d(n, s) : d;
|
|
1578
1578
|
} else
|
|
1579
1579
|
f = typeof o == "function" ? o(n, s) : o;
|
|
1580
1580
|
return typeof f != "number" && a.push(u), [t, {
|
|
@@ -1727,7 +1727,7 @@ function Ts(e, {
|
|
|
1727
1727
|
const f = Xe(t, o);
|
|
1728
1728
|
if (!f)
|
|
1729
1729
|
throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
|
|
1730
|
-
const
|
|
1730
|
+
const d = U(f, {
|
|
1731
1731
|
id: a.id,
|
|
1732
1732
|
parent: e.self,
|
|
1733
1733
|
syncSnapshot: a.syncSnapshot,
|
|
@@ -1739,7 +1739,7 @@ function Ts(e, {
|
|
|
1739
1739
|
src: o,
|
|
1740
1740
|
systemId: c
|
|
1741
1741
|
});
|
|
1742
|
-
return r[
|
|
1742
|
+
return r[d.id] = d, d;
|
|
1743
1743
|
} else
|
|
1744
1744
|
return U(o, {
|
|
1745
1745
|
id: a.id,
|
|
@@ -1805,12 +1805,12 @@ function Is(e, t, n, s, {
|
|
|
1805
1805
|
if (typeof i == "string")
|
|
1806
1806
|
throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);
|
|
1807
1807
|
const f = typeof i == "function" ? i(n, s) : i;
|
|
1808
|
-
let
|
|
1808
|
+
let d;
|
|
1809
1809
|
if (typeof a == "string") {
|
|
1810
1810
|
const v = u && u[a];
|
|
1811
|
-
|
|
1811
|
+
d = typeof v == "function" ? v(n, s) : v;
|
|
1812
1812
|
} else
|
|
1813
|
-
|
|
1813
|
+
d = typeof a == "function" ? a(n, s) : a;
|
|
1814
1814
|
const h = typeof r == "function" ? r(n, s) : r;
|
|
1815
1815
|
let m;
|
|
1816
1816
|
if (typeof h == "string") {
|
|
@@ -1822,7 +1822,7 @@ function Is(e, t, n, s, {
|
|
|
1822
1822
|
to: m,
|
|
1823
1823
|
event: f,
|
|
1824
1824
|
id: o,
|
|
1825
|
-
delay:
|
|
1825
|
+
delay: d
|
|
1826
1826
|
}];
|
|
1827
1827
|
}
|
|
1828
1828
|
function Ss(e, t, n) {
|
|
@@ -1870,7 +1870,7 @@ const As = {}, re = (e) => typeof e == "string" ? {
|
|
|
1870
1870
|
} : e;
|
|
1871
1871
|
class nt {
|
|
1872
1872
|
constructor(t, n) {
|
|
1873
|
-
if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Rt), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ?
|
|
1873
|
+
if (this.config = t, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = n._parent, this.key = n._key, this.machine = n._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(Rt), 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 ? lt(this.config.states, (s, r) => new nt(s, {
|
|
1874
1874
|
_parent: this,
|
|
1875
1875
|
_key: r,
|
|
1876
1876
|
_machine: this.machine
|
|
@@ -1907,7 +1907,7 @@ class nt {
|
|
|
1907
1907
|
})
|
|
1908
1908
|
} : void 0,
|
|
1909
1909
|
history: this.history,
|
|
1910
|
-
states:
|
|
1910
|
+
states: lt(this.states, (t) => t.definition),
|
|
1911
1911
|
on: this.on,
|
|
1912
1912
|
transitions: [...this.transitions.values()].flat().map((t) => ({
|
|
1913
1913
|
...t,
|
|
@@ -1981,10 +1981,10 @@ class nt {
|
|
|
1981
1981
|
let f = !1;
|
|
1982
1982
|
try {
|
|
1983
1983
|
f = !c || We(c, u, n, t);
|
|
1984
|
-
} catch (
|
|
1984
|
+
} catch (d) {
|
|
1985
1985
|
const h = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
|
|
1986
1986
|
throw new Error(`Unable to evaluate guard ${h ? `'${h}' ` : ""}in transition for event '${s}' in state node '${this.id}':
|
|
1987
|
-
${
|
|
1987
|
+
${d.message}`);
|
|
1988
1988
|
}
|
|
1989
1989
|
if (f) {
|
|
1990
1990
|
r.push(...a.actions), i = a;
|
|
@@ -2167,7 +2167,7 @@ class st {
|
|
|
2167
2167
|
restoreSnapshot(t, n) {
|
|
2168
2168
|
const s = {}, r = t.children;
|
|
2169
2169
|
Object.keys(r).forEach((c) => {
|
|
2170
|
-
const u = r[c], f = u.snapshot,
|
|
2170
|
+
const u = r[c], f = u.snapshot, d = u.src, h = typeof d == "string" ? Xe(this, d) : d;
|
|
2171
2171
|
if (!h)
|
|
2172
2172
|
return;
|
|
2173
2173
|
const m = U(h, {
|
|
@@ -2175,7 +2175,7 @@ class st {
|
|
|
2175
2175
|
parent: n.self,
|
|
2176
2176
|
syncSnapshot: u.syncSnapshot,
|
|
2177
2177
|
snapshot: f,
|
|
2178
|
-
src:
|
|
2178
|
+
src: d,
|
|
2179
2179
|
systemId: u.systemId
|
|
2180
2180
|
});
|
|
2181
2181
|
s[c] = m;
|
|
@@ -2190,13 +2190,13 @@ class st {
|
|
|
2190
2190
|
if (!o.has(c)) {
|
|
2191
2191
|
o.add(c);
|
|
2192
2192
|
for (let f in c) {
|
|
2193
|
-
const
|
|
2194
|
-
if (
|
|
2195
|
-
if ("xstate$$type" in
|
|
2196
|
-
c[f] = u[
|
|
2193
|
+
const d = c[f];
|
|
2194
|
+
if (d && typeof d == "object") {
|
|
2195
|
+
if ("xstate$$type" in d && d.xstate$$type === Qe) {
|
|
2196
|
+
c[f] = u[d.id];
|
|
2197
2197
|
continue;
|
|
2198
2198
|
}
|
|
2199
|
-
a(
|
|
2199
|
+
a(d, u);
|
|
2200
2200
|
}
|
|
2201
2201
|
}
|
|
2202
2202
|
}
|
|
@@ -2884,11 +2884,11 @@ function $s(e) {
|
|
|
2884
2884
|
}
|
|
2885
2885
|
function tn(e, t) {
|
|
2886
2886
|
const n = e.locationOffset.column - 1, s = "".padStart(n) + e.body, r = t.line - 1, i = e.locationOffset.line - 1, o = t.line + i, a = t.line === 1 ? n : 0, c = t.column + a, u = `${e.name}:${o}:${c}
|
|
2887
|
-
`, f = s.split(/\r\n|[\n\r]/g),
|
|
2888
|
-
if (
|
|
2887
|
+
`, f = s.split(/\r\n|[\n\r]/g), d = f[r];
|
|
2888
|
+
if (d.length > 120) {
|
|
2889
2889
|
const h = Math.floor(c / 80), m = c % 80, y = [];
|
|
2890
|
-
for (let v = 0; v <
|
|
2891
|
-
y.push(
|
|
2890
|
+
for (let v = 0; v < d.length; v += 80)
|
|
2891
|
+
y.push(d.slice(v, v + 80));
|
|
2892
2892
|
return u + xt([
|
|
2893
2893
|
[`${o} |`, y[0]],
|
|
2894
2894
|
...y.slice(1, h + 1).map((v) => ["|", v]),
|
|
@@ -2899,7 +2899,7 @@ function tn(e, t) {
|
|
|
2899
2899
|
return u + xt([
|
|
2900
2900
|
// Lines specified like this: ["prefix", "string"],
|
|
2901
2901
|
[`${o - 1} |`, f[r - 1]],
|
|
2902
|
-
[`${o} |`,
|
|
2902
|
+
[`${o} |`, d],
|
|
2903
2903
|
["|", "^".padStart(c)],
|
|
2904
2904
|
[`${o + 1} |`, f[r + 1]]
|
|
2905
2905
|
]);
|
|
@@ -2961,7 +2961,7 @@ class it extends Error {
|
|
|
2961
2961
|
*/
|
|
2962
2962
|
constructor(t, ...n) {
|
|
2963
2963
|
var s, r, i;
|
|
2964
|
-
const { nodes: o, source: a, positions: c, path: u, originalError: f, extensions:
|
|
2964
|
+
const { nodes: o, source: a, positions: c, path: u, originalError: f, extensions: d } = Vs(n);
|
|
2965
2965
|
super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = f ?? void 0, this.nodes = At(
|
|
2966
2966
|
Array.isArray(o) ? o : o ? [o] : void 0
|
|
2967
2967
|
);
|
|
@@ -2972,7 +2972,7 @@ class it extends Error {
|
|
|
2972
2972
|
const m = Us(
|
|
2973
2973
|
f == null ? void 0 : f.extensions
|
|
2974
2974
|
) ? f == null ? void 0 : f.extensions : void 0;
|
|
2975
|
-
this.extensions = (i =
|
|
2975
|
+
this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
2976
2976
|
message: {
|
|
2977
2977
|
writable: !0,
|
|
2978
2978
|
enumerable: !0
|
|
@@ -3235,11 +3235,11 @@ function Ys(e) {
|
|
|
3235
3235
|
function Xs(e, t) {
|
|
3236
3236
|
const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 || Ve(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c, f = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
|
|
3237
3237
|
(!r || e.length > 70 || u || i || o);
|
|
3238
|
-
let
|
|
3238
|
+
let d = "";
|
|
3239
3239
|
const h = r && Ve(e.charCodeAt(0));
|
|
3240
|
-
return (f && !h || i) && (
|
|
3241
|
-
`),
|
|
3242
|
-
`), '"""' +
|
|
3240
|
+
return (f && !h || i) && (d += `
|
|
3241
|
+
`), d += n, (f || u) && (d += `
|
|
3242
|
+
`), '"""' + d + '"""';
|
|
3243
3243
|
}
|
|
3244
3244
|
var p;
|
|
3245
3245
|
(function(e) {
|
|
@@ -3678,19 +3678,19 @@ function cr(e, t) {
|
|
|
3678
3678
|
if (s !== e)
|
|
3679
3679
|
return typeof s == "string" ? s : we(s, n);
|
|
3680
3680
|
} else if (Array.isArray(e))
|
|
3681
|
-
return
|
|
3682
|
-
return
|
|
3681
|
+
return dr(e, n);
|
|
3682
|
+
return lr(e, n);
|
|
3683
3683
|
}
|
|
3684
3684
|
function ur(e) {
|
|
3685
3685
|
return typeof e.toJSON == "function";
|
|
3686
3686
|
}
|
|
3687
|
-
function
|
|
3687
|
+
function lr(e, t) {
|
|
3688
3688
|
const n = Object.entries(e);
|
|
3689
3689
|
return n.length === 0 ? "{}" : t.length > un ? "[" + hr(e) + "]" : "{ " + n.map(
|
|
3690
3690
|
([r, i]) => r + ": " + we(i, t)
|
|
3691
3691
|
).join(", ") + " }";
|
|
3692
3692
|
}
|
|
3693
|
-
function
|
|
3693
|
+
function dr(e, t) {
|
|
3694
3694
|
if (e.length === 0)
|
|
3695
3695
|
return "[]";
|
|
3696
3696
|
if (t.length > un)
|
|
@@ -3742,7 +3742,7 @@ spurious results.`);
|
|
|
3742
3742
|
return !1;
|
|
3743
3743
|
}
|
|
3744
3744
|
);
|
|
3745
|
-
class
|
|
3745
|
+
class ln {
|
|
3746
3746
|
constructor(t, n = "GraphQL request", s = {
|
|
3747
3747
|
line: 1,
|
|
3748
3748
|
column: 1
|
|
@@ -3760,14 +3760,14 @@ class dn {
|
|
|
3760
3760
|
}
|
|
3761
3761
|
}
|
|
3762
3762
|
function pr(e) {
|
|
3763
|
-
return fr(e,
|
|
3763
|
+
return fr(e, ln);
|
|
3764
3764
|
}
|
|
3765
3765
|
function yr(e, t) {
|
|
3766
3766
|
return new mr(e, t).parseDocument();
|
|
3767
3767
|
}
|
|
3768
3768
|
class mr {
|
|
3769
3769
|
constructor(t, n = {}) {
|
|
3770
|
-
const s = pr(t) ? t : new
|
|
3770
|
+
const s = pr(t) ? t : new ln(t);
|
|
3771
3771
|
this._lexer = new Qs(s), this._options = n, this._tokenCounter = 0;
|
|
3772
3772
|
}
|
|
3773
3773
|
/**
|
|
@@ -4758,7 +4758,7 @@ class mr {
|
|
|
4758
4758
|
throw b(
|
|
4759
4759
|
this._lexer.source,
|
|
4760
4760
|
n.start,
|
|
4761
|
-
`Expected ${
|
|
4761
|
+
`Expected ${dn(t)}, found ${pe(n)}.`
|
|
4762
4762
|
);
|
|
4763
4763
|
}
|
|
4764
4764
|
/**
|
|
@@ -4868,9 +4868,9 @@ class mr {
|
|
|
4868
4868
|
}
|
|
4869
4869
|
function pe(e) {
|
|
4870
4870
|
const t = e.value;
|
|
4871
|
-
return
|
|
4871
|
+
return dn(e.kind) + (t != null ? ` "${t}"` : "");
|
|
4872
4872
|
}
|
|
4873
|
-
function
|
|
4873
|
+
function dn(e) {
|
|
4874
4874
|
return Ws(e) ? `"${e}"` : e;
|
|
4875
4875
|
}
|
|
4876
4876
|
function gr(e) {
|
|
@@ -5051,19 +5051,19 @@ function Ir(e, t, n = sn) {
|
|
|
5051
5051
|
const s = /* @__PURE__ */ new Map();
|
|
5052
5052
|
for (const A of Object.values(T))
|
|
5053
5053
|
s.set(A, Sr(t, A));
|
|
5054
|
-
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, f,
|
|
5054
|
+
let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, f, d;
|
|
5055
5055
|
const h = [], m = [];
|
|
5056
5056
|
do {
|
|
5057
5057
|
a++;
|
|
5058
5058
|
const A = a === o.length, R = A && c.length !== 0;
|
|
5059
5059
|
if (A) {
|
|
5060
|
-
if (f = m.length === 0 ? void 0 : h[h.length - 1], u =
|
|
5060
|
+
if (f = m.length === 0 ? void 0 : h[h.length - 1], u = d, d = m.pop(), R)
|
|
5061
5061
|
if (i) {
|
|
5062
5062
|
u = u.slice();
|
|
5063
5063
|
let L = 0;
|
|
5064
|
-
for (const [z,
|
|
5065
|
-
const
|
|
5066
|
-
|
|
5064
|
+
for (const [z, le] of c) {
|
|
5065
|
+
const de = z - L;
|
|
5066
|
+
le === null ? (u.splice(de, 1), L++) : u[de] = le;
|
|
5067
5067
|
}
|
|
5068
5068
|
} else {
|
|
5069
5069
|
u = Object.defineProperties(
|
|
@@ -5074,8 +5074,8 @@ function Ir(e, t, n = sn) {
|
|
|
5074
5074
|
u[L] = z;
|
|
5075
5075
|
}
|
|
5076
5076
|
a = r.index, o = r.keys, c = r.edits, i = r.inArray, r = r.prev;
|
|
5077
|
-
} else if (
|
|
5078
|
-
if (f = i ? a : o[a], u =
|
|
5077
|
+
} else if (d) {
|
|
5078
|
+
if (f = i ? a : o[a], u = d[f], u == null)
|
|
5079
5079
|
continue;
|
|
5080
5080
|
h.push(f);
|
|
5081
5081
|
}
|
|
@@ -5084,7 +5084,7 @@ function Ir(e, t, n = sn) {
|
|
|
5084
5084
|
var y, v;
|
|
5085
5085
|
wt(u) || me(!1, `Invalid AST Node: ${ot(u)}.`);
|
|
5086
5086
|
const L = A ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (v = s.get(u.kind)) === null || v === void 0 ? void 0 : v.enter;
|
|
5087
|
-
if (D = L == null ? void 0 : L.call(t, u, f,
|
|
5087
|
+
if (D = L == null ? void 0 : L.call(t, u, f, d, h, m), D === _r)
|
|
5088
5088
|
break;
|
|
5089
5089
|
if (D === !1) {
|
|
5090
5090
|
if (!A) {
|
|
@@ -5109,7 +5109,7 @@ function Ir(e, t, n = sn) {
|
|
|
5109
5109
|
keys: o,
|
|
5110
5110
|
edits: c,
|
|
5111
5111
|
prev: r
|
|
5112
|
-
}, i = Array.isArray(u), o = i ? u : (S = n[u.kind]) !== null && S !== void 0 ? S : [], a = -1, c = [],
|
|
5112
|
+
}, i = Array.isArray(u), o = i ? u : (S = n[u.kind]) !== null && S !== void 0 ? S : [], a = -1, c = [], d && m.push(d), d = u;
|
|
5113
5113
|
}
|
|
5114
5114
|
} while (r !== void 0);
|
|
5115
5115
|
return c.length !== 0 ? c[c.length - 1][1] : e;
|
|
@@ -5444,8 +5444,8 @@ var He = { exports: {} };
|
|
|
5444
5444
|
formData: "FormData" in i,
|
|
5445
5445
|
arrayBuffer: "ArrayBuffer" in i
|
|
5446
5446
|
};
|
|
5447
|
-
function c(
|
|
5448
|
-
return
|
|
5447
|
+
function c(l) {
|
|
5448
|
+
return l && DataView.prototype.isPrototypeOf(l);
|
|
5449
5449
|
}
|
|
5450
5450
|
if (a.arrayBuffer)
|
|
5451
5451
|
var u = [
|
|
@@ -5458,21 +5458,21 @@ var He = { exports: {} };
|
|
|
5458
5458
|
"[object Uint32Array]",
|
|
5459
5459
|
"[object Float32Array]",
|
|
5460
5460
|
"[object Float64Array]"
|
|
5461
|
-
], f = ArrayBuffer.isView || function(
|
|
5462
|
-
return
|
|
5461
|
+
], f = ArrayBuffer.isView || function(l) {
|
|
5462
|
+
return l && u.indexOf(Object.prototype.toString.call(l)) > -1;
|
|
5463
5463
|
};
|
|
5464
|
-
function l
|
|
5465
|
-
if (typeof
|
|
5464
|
+
function d(l) {
|
|
5465
|
+
if (typeof l != "string" && (l = String(l)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(l))
|
|
5466
5466
|
throw new TypeError("Invalid character in header field name");
|
|
5467
|
-
return
|
|
5467
|
+
return l.toLowerCase();
|
|
5468
5468
|
}
|
|
5469
|
-
function h(
|
|
5470
|
-
return typeof
|
|
5469
|
+
function h(l) {
|
|
5470
|
+
return typeof l != "string" && (l = String(l)), l;
|
|
5471
5471
|
}
|
|
5472
|
-
function m(
|
|
5472
|
+
function m(l) {
|
|
5473
5473
|
var g = {
|
|
5474
5474
|
next: function() {
|
|
5475
|
-
var _ =
|
|
5475
|
+
var _ = l.shift();
|
|
5476
5476
|
return { done: _ === void 0, value: _ };
|
|
5477
5477
|
}
|
|
5478
5478
|
};
|
|
@@ -5480,86 +5480,86 @@ var He = { exports: {} };
|
|
|
5480
5480
|
return g;
|
|
5481
5481
|
}), g;
|
|
5482
5482
|
}
|
|
5483
|
-
function y(
|
|
5484
|
-
this.map = {},
|
|
5483
|
+
function y(l) {
|
|
5484
|
+
this.map = {}, l instanceof y ? l.forEach(function(g, _) {
|
|
5485
5485
|
this.append(_, g);
|
|
5486
|
-
}, this) : Array.isArray(
|
|
5486
|
+
}, this) : Array.isArray(l) ? l.forEach(function(g) {
|
|
5487
5487
|
this.append(g[0], g[1]);
|
|
5488
|
-
}, this) :
|
|
5489
|
-
this.append(g,
|
|
5488
|
+
}, this) : l && Object.getOwnPropertyNames(l).forEach(function(g) {
|
|
5489
|
+
this.append(g, l[g]);
|
|
5490
5490
|
}, this);
|
|
5491
5491
|
}
|
|
5492
|
-
y.prototype.append = function(
|
|
5493
|
-
|
|
5494
|
-
var _ = this.map[
|
|
5495
|
-
this.map[
|
|
5496
|
-
}, y.prototype.delete = function(
|
|
5497
|
-
delete this.map[l
|
|
5498
|
-
}, y.prototype.get = function(
|
|
5499
|
-
return
|
|
5500
|
-
}, y.prototype.has = function(
|
|
5501
|
-
return this.map.hasOwnProperty(l
|
|
5502
|
-
}, y.prototype.set = function(
|
|
5503
|
-
this.map[l
|
|
5504
|
-
}, y.prototype.forEach = function(
|
|
5492
|
+
y.prototype.append = function(l, g) {
|
|
5493
|
+
l = d(l), g = h(g);
|
|
5494
|
+
var _ = this.map[l];
|
|
5495
|
+
this.map[l] = _ ? _ + ", " + g : g;
|
|
5496
|
+
}, y.prototype.delete = function(l) {
|
|
5497
|
+
delete this.map[d(l)];
|
|
5498
|
+
}, y.prototype.get = function(l) {
|
|
5499
|
+
return l = d(l), this.has(l) ? this.map[l] : null;
|
|
5500
|
+
}, y.prototype.has = function(l) {
|
|
5501
|
+
return this.map.hasOwnProperty(d(l));
|
|
5502
|
+
}, y.prototype.set = function(l, g) {
|
|
5503
|
+
this.map[d(l)] = h(g);
|
|
5504
|
+
}, y.prototype.forEach = function(l, g) {
|
|
5505
5505
|
for (var _ in this.map)
|
|
5506
|
-
this.map.hasOwnProperty(_) &&
|
|
5506
|
+
this.map.hasOwnProperty(_) && l.call(g, this.map[_], _, this);
|
|
5507
5507
|
}, y.prototype.keys = function() {
|
|
5508
|
-
var
|
|
5508
|
+
var l = [];
|
|
5509
5509
|
return this.forEach(function(g, _) {
|
|
5510
|
-
|
|
5511
|
-
}), m(
|
|
5510
|
+
l.push(_);
|
|
5511
|
+
}), m(l);
|
|
5512
5512
|
}, y.prototype.values = function() {
|
|
5513
|
-
var
|
|
5513
|
+
var l = [];
|
|
5514
5514
|
return this.forEach(function(g) {
|
|
5515
|
-
|
|
5516
|
-
}), m(
|
|
5515
|
+
l.push(g);
|
|
5516
|
+
}), m(l);
|
|
5517
5517
|
}, y.prototype.entries = function() {
|
|
5518
|
-
var
|
|
5518
|
+
var l = [];
|
|
5519
5519
|
return this.forEach(function(g, _) {
|
|
5520
|
-
|
|
5521
|
-
}), m(
|
|
5520
|
+
l.push([_, g]);
|
|
5521
|
+
}), m(l);
|
|
5522
5522
|
}, a.iterable && (y.prototype[Symbol.iterator] = y.prototype.entries);
|
|
5523
|
-
function v(
|
|
5524
|
-
if (
|
|
5523
|
+
function v(l) {
|
|
5524
|
+
if (l.bodyUsed)
|
|
5525
5525
|
return Promise.reject(new TypeError("Already read"));
|
|
5526
|
-
|
|
5526
|
+
l.bodyUsed = !0;
|
|
5527
5527
|
}
|
|
5528
|
-
function S(
|
|
5528
|
+
function S(l) {
|
|
5529
5529
|
return new Promise(function(g, _) {
|
|
5530
|
-
|
|
5531
|
-
g(
|
|
5532
|
-
},
|
|
5533
|
-
_(
|
|
5530
|
+
l.onload = function() {
|
|
5531
|
+
g(l.result);
|
|
5532
|
+
}, l.onerror = function() {
|
|
5533
|
+
_(l.error);
|
|
5534
5534
|
};
|
|
5535
5535
|
});
|
|
5536
5536
|
}
|
|
5537
|
-
function A(
|
|
5537
|
+
function A(l) {
|
|
5538
5538
|
var g = new FileReader(), _ = S(g);
|
|
5539
|
-
return g.readAsArrayBuffer(
|
|
5539
|
+
return g.readAsArrayBuffer(l), _;
|
|
5540
5540
|
}
|
|
5541
|
-
function R(
|
|
5541
|
+
function R(l) {
|
|
5542
5542
|
var g = new FileReader(), _ = S(g);
|
|
5543
|
-
return g.readAsText(
|
|
5543
|
+
return g.readAsText(l), _;
|
|
5544
5544
|
}
|
|
5545
|
-
function D(
|
|
5546
|
-
for (var g = new Uint8Array(
|
|
5545
|
+
function D(l) {
|
|
5546
|
+
for (var g = new Uint8Array(l), _ = new Array(g.length), N = 0; N < g.length; N++)
|
|
5547
5547
|
_[N] = String.fromCharCode(g[N]);
|
|
5548
5548
|
return _.join("");
|
|
5549
5549
|
}
|
|
5550
|
-
function L(
|
|
5551
|
-
if (
|
|
5552
|
-
return
|
|
5553
|
-
var g = new Uint8Array(
|
|
5554
|
-
return g.set(new Uint8Array(
|
|
5550
|
+
function L(l) {
|
|
5551
|
+
if (l.slice)
|
|
5552
|
+
return l.slice(0);
|
|
5553
|
+
var g = new Uint8Array(l.byteLength);
|
|
5554
|
+
return g.set(new Uint8Array(l)), g.buffer;
|
|
5555
5555
|
}
|
|
5556
5556
|
function z() {
|
|
5557
|
-
return this.bodyUsed = !1, this._initBody = function(
|
|
5558
|
-
this._bodyInit =
|
|
5557
|
+
return this.bodyUsed = !1, this._initBody = function(l) {
|
|
5558
|
+
this._bodyInit = l, l ? typeof l == "string" ? this._bodyText = l : a.blob && Blob.prototype.isPrototypeOf(l) ? this._bodyBlob = l : a.formData && FormData.prototype.isPrototypeOf(l) ? this._bodyFormData = l : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) ? this._bodyText = l.toString() : a.arrayBuffer && a.blob && c(l) ? (this._bodyArrayBuffer = L(l.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(l) || f(l)) ? this._bodyArrayBuffer = L(l) : this._bodyText = l = Object.prototype.toString.call(l) : this._bodyText = "", this.headers.get("content-type") || (typeof l == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : a.searchParams && URLSearchParams.prototype.isPrototypeOf(l) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
5559
5559
|
}, a.blob && (this.blob = function() {
|
|
5560
|
-
var
|
|
5561
|
-
if (
|
|
5562
|
-
return
|
|
5560
|
+
var l = v(this);
|
|
5561
|
+
if (l)
|
|
5562
|
+
return l;
|
|
5563
5563
|
if (this._bodyBlob)
|
|
5564
5564
|
return Promise.resolve(this._bodyBlob);
|
|
5565
5565
|
if (this._bodyArrayBuffer)
|
|
@@ -5570,9 +5570,9 @@ var He = { exports: {} };
|
|
|
5570
5570
|
}, this.arrayBuffer = function() {
|
|
5571
5571
|
return this._bodyArrayBuffer ? v(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(A);
|
|
5572
5572
|
}), this.text = function() {
|
|
5573
|
-
var
|
|
5574
|
-
if (
|
|
5575
|
-
return
|
|
5573
|
+
var l = v(this);
|
|
5574
|
+
if (l)
|
|
5575
|
+
return l;
|
|
5576
5576
|
if (this._bodyBlob)
|
|
5577
5577
|
return R(this._bodyBlob);
|
|
5578
5578
|
if (this._bodyArrayBuffer)
|
|
@@ -5586,38 +5586,38 @@ var He = { exports: {} };
|
|
|
5586
5586
|
return this.text().then(JSON.parse);
|
|
5587
5587
|
}, this;
|
|
5588
5588
|
}
|
|
5589
|
-
var
|
|
5590
|
-
function
|
|
5591
|
-
var g =
|
|
5592
|
-
return
|
|
5589
|
+
var le = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
|
|
5590
|
+
function de(l) {
|
|
5591
|
+
var g = l.toUpperCase();
|
|
5592
|
+
return le.indexOf(g) > -1 ? g : l;
|
|
5593
5593
|
}
|
|
5594
|
-
function j(
|
|
5594
|
+
function j(l, g) {
|
|
5595
5595
|
g = g || {};
|
|
5596
5596
|
var _ = g.body;
|
|
5597
|
-
if (
|
|
5598
|
-
if (
|
|
5597
|
+
if (l instanceof j) {
|
|
5598
|
+
if (l.bodyUsed)
|
|
5599
5599
|
throw new TypeError("Already read");
|
|
5600
|
-
this.url =
|
|
5600
|
+
this.url = l.url, this.credentials = l.credentials, g.headers || (this.headers = new y(l.headers)), this.method = l.method, this.mode = l.mode, this.signal = l.signal, !_ && l._bodyInit != null && (_ = l._bodyInit, l.bodyUsed = !0);
|
|
5601
5601
|
} else
|
|
5602
|
-
this.url = String(
|
|
5603
|
-
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method =
|
|
5602
|
+
this.url = String(l);
|
|
5603
|
+
if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = de(g.method || this.method || "GET"), this.mode = g.mode || this.mode || null, this.signal = g.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && _)
|
|
5604
5604
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
5605
5605
|
this._initBody(_);
|
|
5606
5606
|
}
|
|
5607
5607
|
j.prototype.clone = function() {
|
|
5608
5608
|
return new j(this, { body: this._bodyInit });
|
|
5609
5609
|
};
|
|
5610
|
-
function mn(
|
|
5610
|
+
function mn(l) {
|
|
5611
5611
|
var g = new FormData();
|
|
5612
|
-
return
|
|
5612
|
+
return l.trim().split("&").forEach(function(_) {
|
|
5613
5613
|
if (_) {
|
|
5614
5614
|
var N = _.split("="), O = N.shift().replace(/\+/g, " "), x = N.join("=").replace(/\+/g, " ");
|
|
5615
5615
|
g.append(decodeURIComponent(O), decodeURIComponent(x));
|
|
5616
5616
|
}
|
|
5617
5617
|
}), g;
|
|
5618
5618
|
}
|
|
5619
|
-
function gn(
|
|
5620
|
-
var g = new y(), _ =
|
|
5619
|
+
function gn(l) {
|
|
5620
|
+
var g = new y(), _ = l.replace(/\r?\n[\t ]+/g, " ");
|
|
5621
5621
|
return _.split(/\r?\n/).forEach(function(N) {
|
|
5622
5622
|
var O = N.split(":"), x = O.shift().trim();
|
|
5623
5623
|
if (x) {
|
|
@@ -5627,8 +5627,8 @@ var He = { exports: {} };
|
|
|
5627
5627
|
}), g;
|
|
5628
5628
|
}
|
|
5629
5629
|
z.call(j.prototype);
|
|
5630
|
-
function P(
|
|
5631
|
-
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(
|
|
5630
|
+
function P(l, g) {
|
|
5631
|
+
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);
|
|
5632
5632
|
}
|
|
5633
5633
|
z.call(P.prototype), P.prototype.clone = function() {
|
|
5634
5634
|
return new P(this._bodyInit, {
|
|
@@ -5638,14 +5638,14 @@ var He = { exports: {} };
|
|
|
5638
5638
|
url: this.url
|
|
5639
5639
|
});
|
|
5640
5640
|
}, P.error = function() {
|
|
5641
|
-
var
|
|
5642
|
-
return
|
|
5641
|
+
var l = new P(null, { status: 0, statusText: "" });
|
|
5642
|
+
return l.type = "error", l;
|
|
5643
5643
|
};
|
|
5644
5644
|
var En = [301, 302, 303, 307, 308];
|
|
5645
|
-
P.redirect = function(
|
|
5645
|
+
P.redirect = function(l, g) {
|
|
5646
5646
|
if (En.indexOf(g) === -1)
|
|
5647
5647
|
throw new RangeError("Invalid status code");
|
|
5648
|
-
return new P(null, { status: g, headers: { location:
|
|
5648
|
+
return new P(null, { status: g, headers: { location: l } });
|
|
5649
5649
|
}, o.DOMException = i.DOMException;
|
|
5650
5650
|
try {
|
|
5651
5651
|
new o.DOMException();
|
|
@@ -5656,9 +5656,9 @@ var He = { exports: {} };
|
|
|
5656
5656
|
this.stack = N.stack;
|
|
5657
5657
|
}, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
|
|
5658
5658
|
}
|
|
5659
|
-
function be(
|
|
5659
|
+
function be(l, g) {
|
|
5660
5660
|
return new Promise(function(_, N) {
|
|
5661
|
-
var O = new j(
|
|
5661
|
+
var O = new j(l, g);
|
|
5662
5662
|
if (O.signal && O.signal.aborted)
|
|
5663
5663
|
return N(new o.DOMException("Aborted", "AbortError"));
|
|
5664
5664
|
var x = new XMLHttpRequest();
|
|
@@ -5716,8 +5716,8 @@ const Ee = /* @__PURE__ */ br(Ie), Or = /* @__PURE__ */ Tn({
|
|
|
5716
5716
|
return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
|
|
5717
5717
|
}, kr = (e) => async (t) => {
|
|
5718
5718
|
const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
|
|
5719
|
-
let f = "",
|
|
5720
|
-
e === "POST" ? (
|
|
5719
|
+
let f = "", d;
|
|
5720
|
+
e === "POST" ? (d = Cr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : f = Nr({
|
|
5721
5721
|
query: s,
|
|
5722
5722
|
variables: r,
|
|
5723
5723
|
operationName: i,
|
|
@@ -5726,7 +5726,7 @@ const Ee = /* @__PURE__ */ br(Ie), Or = /* @__PURE__ */ Tn({
|
|
|
5726
5726
|
const h = {
|
|
5727
5727
|
method: e,
|
|
5728
5728
|
headers: u,
|
|
5729
|
-
body:
|
|
5729
|
+
body: d,
|
|
5730
5730
|
...a
|
|
5731
5731
|
};
|
|
5732
5732
|
let m = n, y = h;
|
|
@@ -5739,7 +5739,7 @@ const Ee = /* @__PURE__ */ br(Ie), Or = /* @__PURE__ */ Tn({
|
|
|
5739
5739
|
class fn {
|
|
5740
5740
|
constructor(t, n = {}) {
|
|
5741
5741
|
this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
|
|
5742
|
-
const [r, i, o] = s, a = Ps(r, i, o), { headers: c, fetch: u = Ee, method: f = "POST", requestMiddleware:
|
|
5742
|
+
const [r, i, o] = s, a = Ps(r, i, o), { headers: c, fetch: u = Ee, method: f = "POST", requestMiddleware: d, responseMiddleware: h, ...m } = this.requestConfig, { url: y } = this;
|
|
5743
5743
|
a.signal !== void 0 && (m.signal = a.signal);
|
|
5744
5744
|
const { operationName: v } = Re(a.query);
|
|
5745
5745
|
return Le({
|
|
@@ -5754,15 +5754,15 @@ class fn {
|
|
|
5754
5754
|
fetch: u,
|
|
5755
5755
|
method: f,
|
|
5756
5756
|
fetchOptions: m,
|
|
5757
|
-
middleware:
|
|
5757
|
+
middleware: d
|
|
5758
5758
|
}).then((S) => (h && h(S), S)).catch((S) => {
|
|
5759
5759
|
throw h && h(S), S;
|
|
5760
5760
|
});
|
|
5761
5761
|
};
|
|
5762
5762
|
}
|
|
5763
5763
|
async request(t, ...n) {
|
|
5764
|
-
const [s, r] = n, i = Ms(t, s, r), { headers: o, fetch: a = Ee, method: c = "POST", requestMiddleware: u, responseMiddleware: f, ...
|
|
5765
|
-
i.signal !== void 0 && (
|
|
5764
|
+
const [s, r] = n, i = Ms(t, s, r), { headers: o, fetch: a = Ee, method: c = "POST", requestMiddleware: u, responseMiddleware: f, ...d } = this.requestConfig, { url: h } = this;
|
|
5765
|
+
i.signal !== void 0 && (d.signal = i.signal);
|
|
5766
5766
|
const { query: m, operationName: y } = Re(i.document);
|
|
5767
5767
|
return Le({
|
|
5768
5768
|
url: h,
|
|
@@ -5775,7 +5775,7 @@ class fn {
|
|
|
5775
5775
|
operationName: y,
|
|
5776
5776
|
fetch: a,
|
|
5777
5777
|
method: c,
|
|
5778
|
-
fetchOptions:
|
|
5778
|
+
fetchOptions: d,
|
|
5779
5779
|
middleware: u
|
|
5780
5780
|
}).then((v) => (f && f(v), v.data)).catch((v) => {
|
|
5781
5781
|
throw f && f(v), v;
|
|
@@ -5824,7 +5824,7 @@ class fn {
|
|
|
5824
5824
|
const Le = async (e) => {
|
|
5825
5825
|
const { query: t, variables: n, fetchOptions: s } = e, r = kr(Rs(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Dr(o, s.jsonSerializer ?? rt), c = Array.isArray(a) ? !a.some(({ data: f }) => !f) : !!a.data, u = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || s.errorPolicy === "all" || s.errorPolicy === "ignore";
|
|
5826
5826
|
if (o.ok && u && c) {
|
|
5827
|
-
const { errors: f, ...
|
|
5827
|
+
const { errors: f, ...d } = (Array.isArray(a), a), h = s.errorPolicy === "ignore" ? d : a;
|
|
5828
5828
|
return {
|
|
5829
5829
|
...i ? { data: h } : h,
|
|
5830
5830
|
headers: o.headers,
|
|
@@ -5929,6 +5929,10 @@ const Cr = (e, t, n, s) => {
|
|
|
5929
5929
|
method: "POST"
|
|
5930
5930
|
}
|
|
5931
5931
|
);
|
|
5932
|
+
console.log("input", e), console.log(
|
|
5933
|
+
"input cookie name",
|
|
5934
|
+
`quote_${e.locale}=${e.quoteId ?? ""}`
|
|
5935
|
+
);
|
|
5932
5936
|
try {
|
|
5933
5937
|
const { data: o, headers: a, status: c, errors: u, extensions: f } = await t.rawRequest(
|
|
5934
5938
|
hn(e.document),
|
|
@@ -5937,20 +5941,20 @@ const Cr = (e, t, n, s) => {
|
|
|
5937
5941
|
...e.requestHeaders,
|
|
5938
5942
|
Cookie: `quote_${e.locale}=${e.quoteId ?? ""}`
|
|
5939
5943
|
} : e.requestHeaders
|
|
5940
|
-
),
|
|
5941
|
-
if (!((n =
|
|
5944
|
+
), d = o;
|
|
5945
|
+
if (!((n = d.refreshQuote) != null && n.quote))
|
|
5942
5946
|
throw console.log(
|
|
5943
5947
|
"userError: ",
|
|
5944
|
-
(s =
|
|
5945
|
-
(r =
|
|
5946
|
-
(i =
|
|
5948
|
+
(s = d.refreshQuote) == null ? void 0 : s.userErrors[0].code,
|
|
5949
|
+
(r = d.refreshQuote) == null ? void 0 : r.userErrors[0].field,
|
|
5950
|
+
(i = d.refreshQuote) == null ? void 0 : i.userErrors[0].message
|
|
5947
5951
|
), new Error("Could not add items to quote.");
|
|
5948
|
-
return { type: "REFRESH_SUCCESS", quote:
|
|
5952
|
+
return console.log("refreshQuote response: ", d.refreshQuote.quote), { type: "REFRESH_SUCCESS", quote: d.refreshQuote.quote };
|
|
5949
5953
|
} catch (o) {
|
|
5950
5954
|
throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
|
|
5951
5955
|
}
|
|
5952
5956
|
}
|
|
5953
|
-
), qr = ({ context: e }) =>
|
|
5957
|
+
), qr = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", Fr = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Ct = xe({
|
|
5954
5958
|
types: {
|
|
5955
5959
|
context: {},
|
|
5956
5960
|
events: {},
|
|
@@ -5967,15 +5971,15 @@ const Cr = (e, t, n, s) => {
|
|
|
5967
5971
|
refresh: Pr
|
|
5968
5972
|
},
|
|
5969
5973
|
guards: {
|
|
5970
|
-
canRefresh:
|
|
5971
|
-
hasItems:
|
|
5974
|
+
canRefresh: qr,
|
|
5975
|
+
hasItems: Fr
|
|
5972
5976
|
}
|
|
5973
5977
|
}).createMachine({
|
|
5974
5978
|
/** @todo do we need to add the view to the id? (e.g. quote_en-us) */
|
|
5975
5979
|
id: "quote",
|
|
5976
5980
|
initial: "initializing",
|
|
5977
5981
|
context: ({ input: e }) => {
|
|
5978
|
-
var t, n, s, r, i, o, a, c, u, f,
|
|
5982
|
+
var t, n, s, r, i, o, a, c, u, f, d, h, m, y;
|
|
5979
5983
|
return {
|
|
5980
5984
|
quote: {
|
|
5981
5985
|
id: "",
|
|
@@ -6036,7 +6040,7 @@ const Cr = (e, t, n, s) => {
|
|
|
6036
6040
|
requestHeaders: ((c = (a = (o = e == null ? void 0 : e.initialContext) == null ? void 0 : o.graphql) == null ? void 0 : a.refresh) == null ? void 0 : c.requestHeaders) ?? void 0
|
|
6037
6041
|
},
|
|
6038
6042
|
addItems: {
|
|
6039
|
-
document: ((
|
|
6043
|
+
document: ((d = (f = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : f.addItems) == null ? void 0 : d.document) ?? "",
|
|
6040
6044
|
requestHeaders: ((y = (m = (h = e == null ? void 0 : e.initialContext) == null ? void 0 : h.graphql) == null ? void 0 : m.addItems) == null ? void 0 : y.requestHeaders) ?? void 0
|
|
6041
6045
|
}
|
|
6042
6046
|
// removeItems: {
|