@clicktap/state 0.13.0 → 0.13.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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { jsx as He } from "react/jsx-runtime";
2
- import { createContext as Ge, useContext as ze, useState as gn, useEffect as En, cloneElement as vn } from "react";
1
+ import { jsx as Ge } from "react/jsx-runtime";
2
+ import { createContext as ze, useContext as Je, useState as Pe, useEffect as Dt, cloneElement as vn } from "react";
3
3
  function Tn(e, t) {
4
4
  for (var n = 0; n < t.length; n++) {
5
5
  const s = t[n];
@@ -37,7 +37,7 @@ const Sn = (e) => {
37
37
  const t = In();
38
38
  t && t.register(e);
39
39
  };
40
- class ot {
40
+ class at {
41
41
  constructor(t) {
42
42
  this._process = t, this._active = !1, this._current = null, this._last = null;
43
43
  }
@@ -66,13 +66,13 @@ class ot {
66
66
  this._last = null;
67
67
  }
68
68
  }
69
- const Ct = ".", xn = "", Dt = "", An = "#", wn = "*", Rt = "xstate.init", bn = "xstate.error", ae = "xstate.stop";
69
+ const Rt = ".", xn = "", Lt = "", An = "#", wn = "*", Mt = "xstate.init", bn = "xstate.error", ae = "xstate.stop";
70
70
  function On(e, t) {
71
71
  return {
72
72
  type: `xstate.after.${e}.${t}`
73
73
  };
74
74
  }
75
- function Pe(e, t) {
75
+ function qe(e, t) {
76
76
  return {
77
77
  type: `xstate.done.state.${e}`,
78
78
  output: t
@@ -84,15 +84,15 @@ function Nn(e, t) {
84
84
  output: t
85
85
  };
86
86
  }
87
- function Lt(e, t) {
87
+ function Pt(e, t) {
88
88
  return {
89
89
  type: `xstate.error.actor.${e}`,
90
90
  error: t
91
91
  };
92
92
  }
93
- function Mt(e) {
93
+ function qt(e) {
94
94
  return {
95
- type: Rt,
95
+ type: Mt,
96
96
  input: e
97
97
  };
98
98
  }
@@ -102,7 +102,7 @@ function q(e) {
102
102
  });
103
103
  }
104
104
  const kn = (() => typeof Symbol == "function" && Symbol.observable || "@@observable")();
105
- function at(e, t) {
105
+ function ct(e, t) {
106
106
  return `${e.sessionId}.${t}`;
107
107
  }
108
108
  let Cn = 0;
@@ -119,7 +119,7 @@ function Dn(e, t) {
119
119
  delay: v,
120
120
  id: S,
121
121
  startedAt: Date.now()
122
- }, R = at(h, S);
122
+ }, R = ct(h, S);
123
123
  l._snapshot._scheduledEvents[R] = A;
124
124
  const D = a.setTimeout(() => {
125
125
  delete o[R], delete l._snapshot._scheduledEvents[R], l._relay(h, m, y);
@@ -127,7 +127,7 @@ function Dn(e, t) {
127
127
  o[R] = D;
128
128
  },
129
129
  cancel: (h, m) => {
130
- const y = at(h, m), v = o[y];
130
+ const y = ct(h, m), v = o[y];
131
131
  delete o[y], delete l._snapshot._scheduledEvents[y], a.clearTimeout(v);
132
132
  },
133
133
  cancelAll: (h) => {
@@ -202,12 +202,12 @@ function Dn(e, t) {
202
202
  };
203
203
  return l;
204
204
  }
205
- function Pt(e, t) {
206
- const n = ct(e), s = ct(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 ? Pt(n[r], s[r]) : !1);
205
+ function Ft(e, t) {
206
+ const n = ut(e), s = ut(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 ? Ft(n[r], s[r]) : !1);
208
208
  }
209
- function Je(e) {
210
- if (Ft(e))
209
+ function Ye(e) {
210
+ if (Bt(e))
211
211
  return e;
212
212
  let t = [], n = "";
213
213
  for (let s = 0; s < e.length; s++) {
@@ -223,12 +223,12 @@ function Je(e) {
223
223
  }
224
224
  return t.push(n), t;
225
225
  }
226
- function ct(e) {
226
+ function ut(e) {
227
227
  if (us(e))
228
228
  return e.value;
229
229
  if (typeof e != "string")
230
230
  return e;
231
- const t = Je(e);
231
+ const t = Ye(e);
232
232
  return Rn(t);
233
233
  }
234
234
  function Rn(e) {
@@ -245,7 +245,7 @@ function Rn(e) {
245
245
  }
246
246
  return t;
247
247
  }
248
- function ut(e, t) {
248
+ function dt(e, t) {
249
249
  const n = {}, s = Object.keys(e);
250
250
  for (let r = 0; r < s.length; r++) {
251
251
  const i = s[r];
@@ -253,35 +253,35 @@ function ut(e, t) {
253
253
  }
254
254
  return n;
255
255
  }
256
- function qt(e) {
257
- return Ft(e) ? e : [e];
256
+ function Ut(e) {
257
+ return Bt(e) ? e : [e];
258
258
  }
259
259
  function F(e) {
260
- return e === void 0 ? [] : qt(e);
260
+ return e === void 0 ? [] : Ut(e);
261
261
  }
262
- function qe(e, t, n, s) {
262
+ function Fe(e, t, n, s) {
263
263
  return typeof e == "function" ? e({
264
264
  context: t,
265
265
  event: n,
266
266
  self: s
267
267
  }) : e;
268
268
  }
269
- function Ft(e) {
269
+ function Bt(e) {
270
270
  return Array.isArray(e);
271
271
  }
272
272
  function Ln(e) {
273
273
  return e.type.startsWith("xstate.error.actor");
274
274
  }
275
275
  function X(e) {
276
- return qt(e).map((t) => typeof t > "u" || typeof t == "string" ? {
276
+ return Ut(e).map((t) => typeof t > "u" || typeof t == "string" ? {
277
277
  target: t
278
278
  } : t);
279
279
  }
280
- function Ut(e) {
280
+ function jt(e) {
281
281
  if (!(e === void 0 || e === xn))
282
282
  return F(e);
283
283
  }
284
- function dt(e, t, n) {
284
+ function lt(e, t, n) {
285
285
  var i, o, a;
286
286
  const s = typeof e == "object", r = s ? e : void 0;
287
287
  return {
@@ -290,17 +290,17 @@ function dt(e, t, n) {
290
290
  complete: (a = s ? e.complete : n) == null ? void 0 : a.bind(r)
291
291
  };
292
292
  }
293
- function lt(e, t) {
293
+ function ht(e, t) {
294
294
  return `${t}.${e}`;
295
295
  }
296
- function Ye(e, t) {
296
+ function Xe(e, t) {
297
297
  const n = t.match(/^xstate\.invoke\.(\d+)\.(.*)/);
298
298
  if (!n)
299
299
  return e.implementations.actors[t];
300
300
  const [, s, r] = n, o = e.getStateNodeById(r).config.invoke;
301
301
  return (Array.isArray(o) ? o[s] : o).src;
302
302
  }
303
- const Xe = 1;
303
+ const Qe = 1;
304
304
  let k = /* @__PURE__ */ function(e) {
305
305
  return e[e.NotStarted = 0] = "NotStarted", e[e.Running = 1] = "Running", e[e.Stopped = 2] = "Stopped", e;
306
306
  }({});
@@ -320,7 +320,7 @@ class 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 ot(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = k.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
323
+ this.logic = t, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new at(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = k.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
324
324
  const s = {
325
325
  ...Mn,
326
326
  ...n
@@ -336,7 +336,7 @@ 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(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 = {
339
+ }), f && !o && this.system.inspect(lt(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,
@@ -466,7 +466,7 @@ class Pn {
466
466
  */
467
467
  subscribe(t, n, s) {
468
468
  var i;
469
- const r = dt(t, n, s);
469
+ const r = lt(t, n, s);
470
470
  if (this._processingStatus !== k.Stopped)
471
471
  this.observers.add(r);
472
472
  else
@@ -523,7 +523,7 @@ class Pn {
523
523
  error: () => {
524
524
  }
525
525
  }), this.system._register(this.sessionId, this), this._systemId && this.system._set(this._systemId, this), this._processingStatus = k.Running;
526
- const t = Mt(this.options.input);
526
+ const t = qt(this.options.input);
527
527
  switch (this.system._sendInspectionEvent({
528
528
  type: "@xstate.event",
529
529
  sourceRef: this._parent,
@@ -610,7 +610,7 @@ class Pn {
610
610
  this.observers.clear(), n && q(t);
611
611
  }
612
612
  _error(t) {
613
- this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, Lt(this.id, t));
613
+ this._stopProcedure(), this._reportError(t), this._parent && this.system._relay(this, this._parent, Pt(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,7 +618,7 @@ 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 !== k.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new ot(this._process.bind(this)), this._processingStatus = k.Stopped, this.system._unregister(this), this);
621
+ return this._processingStatus !== k.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new at(this._process.bind(this)), this._processingStatus = k.Stopped, this.system._unregister(this), this);
622
622
  }
623
623
  /**
624
624
  * @internal
@@ -642,7 +642,7 @@ class Pn {
642
642
  }
643
643
  toJSON() {
644
644
  return {
645
- xstate$$type: Xe,
645
+ xstate$$type: Qe,
646
646
  id: this.id
647
647
  };
648
648
  }
@@ -708,7 +708,7 @@ function Bn(e, t, n, s, {
708
708
  input: a,
709
709
  syncSnapshot: c
710
710
  }) {
711
- const u = typeof o == "string" ? Ye(t.machine, o) : o, f = typeof r == "function" ? r(n) : r;
711
+ const u = typeof o == "string" ? Xe(t.machine, o) : o, f = typeof r == "function" ? r(n) : r;
712
712
  let l;
713
713
  return u && (l = U(u, {
714
714
  id: f,
@@ -771,19 +771,19 @@ function Hn(e, t) {
771
771
  });
772
772
  }
773
773
  }
774
- function Bt(e) {
774
+ function $t(e) {
775
775
  function t(n, s) {
776
776
  }
777
777
  return t.type = "xstate.stopChild", t.actorRef = e, t.resolve = Vn, t.execute = Hn, t;
778
778
  }
779
- function Qe(e, t, n, s) {
779
+ function We(e, t, n, s) {
780
780
  const {
781
781
  machine: r
782
782
  } = s, i = typeof e == "function", o = i ? e : r.implementations.guards[typeof e == "string" ? e : e.type];
783
783
  if (!i && !o)
784
784
  throw new Error(`Guard '${typeof e == "string" ? e : e.type}' is not implemented.'.`);
785
785
  if (typeof o != "function")
786
- return Qe(o, t, n, s);
786
+ return We(o, t, n, s);
787
787
  const a = {
788
788
  context: t,
789
789
  event: n
@@ -798,7 +798,7 @@ function Qe(e, t, n, s) {
798
798
  // this holds all params
799
799
  ) : o(a, c);
800
800
  }
801
- const We = (e) => e.type === "atomic" || e.type === "final";
801
+ const Ke = (e) => e.type === "atomic" || e.type === "final";
802
802
  function Z(e) {
803
803
  return Object.values(e.states).filter((t) => t.type !== "history");
804
804
  }
@@ -812,14 +812,14 @@ function ue(e, t) {
812
812
  return n;
813
813
  }
814
814
  function ve(e) {
815
- const t = new Set(e), n = $t(t);
815
+ const t = new Set(e), n = Ht(t);
816
816
  for (const s of t)
817
817
  if (s.type === "compound" && (!n.get(s) || !n.get(s).length))
818
- ht(s).forEach((r) => t.add(r));
818
+ ft(s).forEach((r) => t.add(r));
819
819
  else if (s.type === "parallel") {
820
820
  for (const r of Z(s))
821
821
  if (r.type !== "history" && !t.has(r)) {
822
- const i = ht(r);
822
+ const i = ft(r);
823
823
  for (const o of i)
824
824
  t.add(o);
825
825
  }
@@ -831,35 +831,35 @@ function ve(e) {
831
831
  }
832
832
  return t;
833
833
  }
834
- function jt(e, t) {
834
+ function Vt(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 (We(r))
841
+ if (Ke(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] = jt(r, t);
848
+ s[r.key] = Vt(r, t);
849
849
  return s;
850
850
  }
851
- function $t(e) {
851
+ function Ht(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 Vt(e, t) {
857
+ function Gt(e, t) {
858
858
  const n = ve(t);
859
- return jt(e, $t(n));
859
+ return Vt(e, Ht(n));
860
860
  }
861
- function Ke(e, t) {
862
- return t.type === "compound" ? Z(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? Z(t).every((n) => Ke(e, n)) : t.type === "final";
861
+ function Ze(e, t) {
862
+ return t.type === "compound" ? Z(t).some((n) => n.type === "final" && e.has(n)) : t.type === "parallel" ? Z(t).every((n) => Ze(e, n)) : t.type === "final";
863
863
  }
864
864
  const Se = (e) => e[0] === An;
865
865
  function Gn(e, t) {
@@ -910,7 +910,7 @@ function zn(e) {
910
910
  });
911
911
  }
912
912
  function $(e, t, n) {
913
- const s = Ut(n.target), r = n.reenter ?? !1, i = Xn(e, s), o = {
913
+ const s = jt(n.target), r = n.reenter ?? !1, i = Xn(e, s), o = {
914
914
  ...n,
915
915
  actions: F(n.actions),
916
916
  guard: n.guard,
@@ -930,7 +930,7 @@ function Jn(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 === Dt)
933
+ if (n === Lt)
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, X(s).map((r) => $(e, n, r)));
@@ -984,7 +984,7 @@ function Xn(e, t) {
984
984
  return n;
985
985
  if (Se(n))
986
986
  return e.machine.getStateNodeById(n);
987
- const s = n[0] === Ct;
987
+ const s = n[0] === Rt;
988
988
  if (s && !e.parent)
989
989
  return Te(e, n.slice(1));
990
990
  const r = s ? e.key + n : n;
@@ -999,8 +999,8 @@ ${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 Ht(e) {
1003
- const t = Ut(e.config.target);
1002
+ function zt(e) {
1003
+ const t = jt(e.config.target);
1004
1004
  return t ? {
1005
1005
  target: t.map((n) => typeof n == "string" ? Te(e.parent, n) : n)
1006
1006
  } : e.parent.initial;
@@ -1008,14 +1008,14 @@ function Ht(e) {
1008
1008
  function V(e) {
1009
1009
  return e.type === "history";
1010
1010
  }
1011
- function ht(e) {
1012
- const t = Gt(e);
1011
+ function ft(e) {
1012
+ const t = Jt(e);
1013
1013
  for (const n of t)
1014
1014
  for (const s of ue(n, e))
1015
1015
  t.add(s);
1016
1016
  return t;
1017
1017
  }
1018
- function Gt(e) {
1018
+ function Jt(e) {
1019
1019
  const t = /* @__PURE__ */ new Set();
1020
1020
  function n(s) {
1021
1021
  if (!t.has(s)) {
@@ -1044,7 +1044,7 @@ function Te(e, t) {
1044
1044
  return e.machine.getStateNodeById(t);
1045
1045
  } catch {
1046
1046
  }
1047
- const n = Je(t).slice();
1047
+ const n = Ye(t).slice();
1048
1048
  let s = e;
1049
1049
  for (; n.length; ) {
1050
1050
  const r = n.shift();
@@ -1075,7 +1075,7 @@ function Qn(e, t, n, s) {
1075
1075
  return !i || !i.length ? e.next(n, s) : i;
1076
1076
  }
1077
1077
  function Wn(e, t, n, s) {
1078
- const r = Object.keys(t), i = ee(e, r[0]), o = Ze(i, t[r[0]], n, s);
1078
+ const r = Object.keys(t), i = ee(e, r[0]), o = et(i, t[r[0]], n, s);
1079
1079
  return !o || !o.length ? e.next(n, s) : o;
1080
1080
  }
1081
1081
  function Kn(e, t, n, s) {
@@ -1084,12 +1084,12 @@ function Kn(e, t, n, s) {
1084
1084
  const o = t[i];
1085
1085
  if (!o)
1086
1086
  continue;
1087
- const a = ee(e, i), c = Ze(a, o, n, s);
1087
+ const a = ee(e, i), c = et(a, o, n, s);
1088
1088
  c && r.push(...c);
1089
1089
  }
1090
1090
  return r.length ? r : e.next(n, s);
1091
1091
  }
1092
- function Ze(e, t, n, s) {
1092
+ function et(e, t, n, s) {
1093
1093
  return typeof t == "string" ? Qn(e, t, n, s) : Object.keys(t).length === 1 ? Wn(e, t, n, s) : Kn(e, t, n, s);
1094
1094
  }
1095
1095
  function Zn(e) {
@@ -1111,13 +1111,13 @@ function es(e, t) {
1111
1111
  return !0;
1112
1112
  return !1;
1113
1113
  }
1114
- function zt(e, t, n) {
1114
+ function Yt(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 (es(Fe([r], t, n), Fe([a], t, n)))
1120
+ if (es(Ue([r], t, n), Ue([a], t, n)))
1121
1121
  if (B(r.source, a.source))
1122
1122
  o.add(a);
1123
1123
  else {
@@ -1138,7 +1138,7 @@ function ts(e) {
1138
1138
  if (n.every((r) => B(r, s)))
1139
1139
  return s;
1140
1140
  }
1141
- function et(e, t) {
1141
+ function tt(e, t) {
1142
1142
  if (!e.target)
1143
1143
  return [];
1144
1144
  const n = /* @__PURE__ */ new Set();
@@ -1148,14 +1148,14 @@ function et(e, t) {
1148
1148
  for (const r of t[s.id])
1149
1149
  n.add(r);
1150
1150
  else
1151
- for (const r of et(Ht(s), t))
1151
+ for (const r of tt(zt(s), t))
1152
1152
  n.add(r);
1153
1153
  else
1154
1154
  n.add(s);
1155
1155
  return [...n];
1156
1156
  }
1157
- function Jt(e, t) {
1158
- const n = et(e, t);
1157
+ function Xt(e, t) {
1158
+ const n = tt(e, t);
1159
1159
  if (!n)
1160
1160
  return;
1161
1161
  if (!e.reenter && n.every((r) => r === e.source || B(r, e.source)))
@@ -1166,12 +1166,12 @@ function Jt(e, t) {
1166
1166
  if (!e.reenter)
1167
1167
  return e.source.machine.root;
1168
1168
  }
1169
- function Fe(e, t, n) {
1169
+ function Ue(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 = Jt(i, n);
1174
+ const o = Xt(i, n);
1175
1175
  i.reenter && i.source === o && s.add(o);
1176
1176
  for (const a of t)
1177
1177
  B(a, o) && s.add(a);
@@ -1186,12 +1186,12 @@ function ns(e, t) {
1186
1186
  return !1;
1187
1187
  return !0;
1188
1188
  }
1189
- function Ue(e, t, n, s, r, i) {
1189
+ function Be(e, t, n, s, r, i) {
1190
1190
  if (!e.length)
1191
1191
  return t;
1192
1192
  const o = new Set(t._nodes);
1193
1193
  let a = t.historyValue;
1194
- const c = zt(e, o, a);
1194
+ const c = Yt(e, o, a);
1195
1195
  let u = t;
1196
1196
  r || ([u, a] = os(u, s, n, c, o, a, i)), u = te(u, s, n, c.flatMap((l) => l.actions), i), u = rs(u, s, n, c, o, i, a, r);
1197
1197
  const f = [...o];
@@ -1208,8 +1208,8 @@ function Ue(e, t, n, s, r, i) {
1208
1208
  function ss(e, t, n, s, r) {
1209
1209
  if (s.output === void 0)
1210
1210
  return;
1211
- const i = Pe(r.id, r.output !== void 0 && r.parent ? qe(r.output, e.context, t, n.self) : void 0);
1212
- return qe(s.output, e.context, i, n.self);
1211
+ const i = qe(r.id, r.output !== void 0 && r.parent ? Fe(r.output, e.context, t, n.self) : void 0);
1212
+ return Fe(s.output, e.context, i, n.self);
1213
1213
  }
1214
1214
  function rs(e, t, n, s, r, i, o, a) {
1215
1215
  let c = e;
@@ -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(Pe(y.id, h.output !== void 0 ? qe(h.output, c.context, t, n.self) : void 0)); (v == null ? void 0 : v.type) === "parallel" && !l.has(v) && Ke(r, v); )
1236
- l.add(v), i.push(Pe(v.id)), S = v, v = v.parent;
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" && !l.has(v) && Ze(r, v); )
1236
+ l.add(v), i.push(qe(v.id)), S = v, v = v.parent;
1237
1237
  if (v)
1238
1238
  continue;
1239
1239
  c = H(c, {
@@ -1246,17 +1246,17 @@ function rs(e, t, n, s, r, i, o, a) {
1246
1246
  }
1247
1247
  function is(e, t, n, s) {
1248
1248
  for (const r of e) {
1249
- const i = Jt(r, t);
1249
+ const i = Xt(r, t);
1250
1250
  for (const a of r.target || [])
1251
1251
  !V(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)), Q(a, t, n, s);
1256
- const o = et(r, t);
1256
+ const o = tt(r, t);
1257
1257
  for (const a of o) {
1258
1258
  const c = ue(a, i);
1259
- (i == null ? void 0 : i.type) === "parallel" && c.push(i), Yt(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
1259
+ (i == null ? void 0 : i.type) === "parallel" && c.push(i), Qt(s, t, n, c, !r.source.parent && r.reenter ? void 0 : i);
1260
1260
  }
1261
1261
  }
1262
1262
  }
@@ -1270,7 +1270,7 @@ function Q(e, t, n, s) {
1270
1270
  for (const o of i)
1271
1271
  Ne(o, e.parent, s, t, n);
1272
1272
  } else {
1273
- const i = Ht(e);
1273
+ const i = zt(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), Q(o, t, n, s);
1276
1276
  for (const o of i.target)
@@ -1283,33 +1283,33 @@ function Q(e, t, n, s) {
1283
1283
  for (const i of Z(e).filter((o) => !V(o)))
1284
1284
  [...s].some((o) => B(o, i)) || (V(i) || (s.add(i), n.add(i)), Q(i, t, n, s));
1285
1285
  }
1286
- function Yt(e, t, n, s, r) {
1286
+ function Qt(e, t, n, s, r) {
1287
1287
  for (const i of s)
1288
1288
  if ((!r || B(i, r)) && e.add(i), i.type === "parallel")
1289
1289
  for (const o of Z(i).filter((a) => !V(a)))
1290
1290
  [...e].some((a) => B(a, o)) || (e.add(o), Q(o, t, n, e));
1291
1291
  }
1292
1292
  function Ne(e, t, n, s, r) {
1293
- Yt(n, s, r, ue(e, t));
1293
+ Qt(n, s, r, ue(e, t));
1294
1294
  }
1295
1295
  function os(e, t, n, s, r, i, o) {
1296
1296
  let a = e;
1297
- const c = Fe(s, r, i);
1297
+ const c = Ue(s, r, i);
1298
1298
  c.sort((f, l) => l.order - f.order);
1299
1299
  let u;
1300
1300
  for (const f of c)
1301
1301
  for (const l of Zn(f)) {
1302
1302
  let h;
1303
- l.history === "deep" ? h = (m) => We(m) && B(m, f) : h = (m) => m.parent === f, u ?? (u = {
1303
+ l.history === "deep" ? h = (m) => Ke(m) && B(m, f) : h = (m) => m.parent === f, u ?? (u = {
1304
1304
  ...i
1305
1305
  }), u[l.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((l) => Bt(l.id))], o), r.delete(f);
1308
+ a = te(a, t, n, [...f.exit, ...f.invoke.map((l) => $t(l.id))], o), r.delete(f);
1309
1309
  return [a, u || i];
1310
1310
  }
1311
- let ft = !1;
1312
- function Xt(e, t, n, s, r, i) {
1311
+ let pt = !1;
1312
+ function Wt(e, t, n, s, r, i) {
1313
1313
  const {
1314
1314
  machine: o
1315
1315
  } = e;
@@ -1325,9 +1325,9 @@ function Xt(e, t, n, s, r, i) {
1325
1325
  }
1326
1326
  });
1327
1327
  try {
1328
- ft = f, f(l, h);
1328
+ pt = f, f(l, h);
1329
1329
  } finally {
1330
- ft = !1;
1330
+ pt = !1;
1331
1331
  }
1332
1332
  };
1333
1333
  const u = typeof c == "function", f = u ? c : (
@@ -1362,12 +1362,12 @@ function Xt(e, t, n, s, r, i) {
1362
1362
  // this holds all params
1363
1363
  r
1364
1364
  );
1365
- a = v, "retryResolve" in y && (i == null || i.push([y, S])), "execute" in y && (n.self._processingStatus === k.Running ? y.execute(n, S) : n.defer(y.execute.bind(null, n, S))), A && (a = Xt(a, t, n, A, r, i));
1365
+ a = v, "retryResolve" in y && (i == null || i.push([y, S])), "execute" in y && (n.self._processingStatus === k.Running ? y.execute(n, S) : n.defer(y.execute.bind(null, n, S))), A && (a = Wt(a, t, n, A, r, i));
1366
1366
  }
1367
1367
  return a;
1368
1368
  }
1369
1369
  function te(e, t, n, s, r, i) {
1370
- const o = i ? [] : void 0, a = Xt(e, t, n, s, {
1370
+ const o = i ? [] : void 0, a = Wt(e, t, n, s, {
1371
1371
  internalQueue: r,
1372
1372
  deferredActorIds: i
1373
1373
  }, o);
@@ -1388,15 +1388,15 @@ function ke(e, t, n, s = []) {
1388
1388
  }), i.push(u);
1389
1389
  }
1390
1390
  if (t.type === ae)
1391
- return r = H(pt(r, t, n), {
1391
+ return r = H(yt(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 !== Rt) {
1399
- const u = a, f = Ln(u), l = yt(u, r);
1398
+ if (a.type !== Mt) {
1399
+ const u = a, f = Ln(u), l = mt(u, r);
1400
1400
  if (f && !l.length)
1401
1401
  return r = H(e, {
1402
1402
  status: "error",
@@ -1405,7 +1405,7 @@ function ke(e, t, n, s = []) {
1405
1405
  snapshot: r,
1406
1406
  microstates: i
1407
1407
  };
1408
- r = Ue(
1408
+ r = Be(
1409
1409
  l,
1410
1410
  e,
1411
1411
  n,
@@ -1422,44 +1422,44 @@ function ke(e, t, n, s = []) {
1422
1422
  if (!u.length) {
1423
1423
  if (!s.length)
1424
1424
  break;
1425
- a = s.shift(), u = yt(a, r);
1425
+ a = s.shift(), u = mt(a, r);
1426
1426
  }
1427
- r = Ue(u, r, n, a, !1, s), c = r !== f, o(r, a, u);
1427
+ r = Be(u, r, n, a, !1, s), c = r !== f, o(r, a, u);
1428
1428
  }
1429
- return r.status !== "active" && pt(r, a, n), {
1429
+ return r.status !== "active" && yt(r, a, n), {
1430
1430
  snapshot: r,
1431
1431
  microstates: i
1432
1432
  };
1433
1433
  }
1434
- function pt(e, t, n) {
1435
- return te(e, t, n, Object.values(e.children).map((s) => Bt(s)), []);
1434
+ function yt(e, t, n) {
1435
+ return te(e, t, n, Object.values(e.children).map((s) => $t(s)), []);
1436
1436
  }
1437
- function yt(e, t) {
1437
+ function mt(e, t) {
1438
1438
  return t.machine.getTransitionData(t, e);
1439
1439
  }
1440
1440
  function as(e, t) {
1441
- const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(We);
1441
+ const n = /* @__PURE__ */ new Set(), s = e._nodes.filter(Ke);
1442
1442
  for (const r of s)
1443
1443
  e:
1444
1444
  for (const i of [r].concat(ue(r, void 0)))
1445
1445
  if (i.always) {
1446
1446
  for (const o of i.always)
1447
- if (o.guard === void 0 || Qe(o.guard, e.context, t, e)) {
1447
+ if (o.guard === void 0 || We(o.guard, e.context, t, e)) {
1448
1448
  n.add(o);
1449
1449
  break e;
1450
1450
  }
1451
1451
  }
1452
- return zt(Array.from(n), new Set(e._nodes), e.historyValue);
1452
+ return Yt(Array.from(n), new Set(e._nodes), e.historyValue);
1453
1453
  }
1454
1454
  function cs(e, t) {
1455
1455
  const n = ve(_e(e, t));
1456
- return Vt(e, [...n]);
1456
+ return Gt(e, [...n]);
1457
1457
  }
1458
1458
  function us(e) {
1459
1459
  return !!e && typeof e == "object" && "machine" in e && "value" in e;
1460
1460
  }
1461
1461
  const ds = function(t) {
1462
- return Pt(t, this.value);
1462
+ return Ft(t, this.value);
1463
1463
  }, ls = function(t) {
1464
1464
  return this.tags.has(t);
1465
1465
  }, hs = function(t) {
@@ -1493,7 +1493,7 @@ function ye(e, t) {
1493
1493
  machine: t,
1494
1494
  context: e.context,
1495
1495
  _nodes: e._nodes,
1496
- value: Vt(t.root, e._nodes),
1496
+ value: Gt(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 || {},
@@ -1535,11 +1535,11 @@ function ys(e, t) {
1535
1535
  }
1536
1536
  return {
1537
1537
  ...h,
1538
- context: Qt(o),
1538
+ context: Kt(o),
1539
1539
  children: m
1540
1540
  };
1541
1541
  }
1542
- function Qt(e) {
1542
+ function Kt(e) {
1543
1543
  let t;
1544
1544
  for (const n in e) {
1545
1545
  const s = e[n];
@@ -1548,11 +1548,11 @@ function Qt(e) {
1548
1548
  t ?? (t = Array.isArray(e) ? e.slice() : {
1549
1549
  ...e
1550
1550
  }), t[n] = {
1551
- xstate$$type: Xe,
1551
+ xstate$$type: Qe,
1552
1552
  id: s.id
1553
1553
  };
1554
1554
  else {
1555
- const r = Qt(s);
1555
+ const r = Kt(s);
1556
1556
  r !== s && (t ?? (t = Array.isArray(e) ? e.slice() : {
1557
1557
  ...e
1558
1558
  }), t[n] = r);
@@ -1602,7 +1602,7 @@ function Es(e, t) {
1602
1602
  }
1603
1603
  return n.type = "xstate.raise", n.event = e, n.id = t == null ? void 0 : t.id, n.delay = t == null ? void 0 : t.delay, n.resolve = ms, n.execute = gs, n;
1604
1604
  }
1605
- const mt = /* @__PURE__ */ new WeakMap();
1605
+ const gt = /* @__PURE__ */ new WeakMap();
1606
1606
  function vs(e) {
1607
1607
  return {
1608
1608
  config: e,
@@ -1614,7 +1614,7 @@ function vs(e) {
1614
1614
  receivers: void 0,
1615
1615
  dispose: void 0
1616
1616
  };
1617
- mt.set(r, o), o.dispose = e({
1617
+ gt.set(r, o), o.dispose = e({
1618
1618
  input: n.input,
1619
1619
  system: i,
1620
1620
  self: r,
@@ -1628,7 +1628,7 @@ function vs(e) {
1628
1628
  },
1629
1629
  transition: (n, s, r) => {
1630
1630
  var o, a;
1631
- const i = mt.get(r.self);
1631
+ const i = gt.get(r.self);
1632
1632
  return s.type === ae ? (n = {
1633
1633
  ...n,
1634
1634
  status: "stopped",
@@ -1645,7 +1645,7 @@ function vs(e) {
1645
1645
  restoreSnapshot: (n) => n
1646
1646
  };
1647
1647
  }
1648
- const gt = "xstate.promise.resolve", Et = "xstate.promise.reject", fe = /* @__PURE__ */ new WeakMap();
1648
+ const Et = "xstate.promise.resolve", vt = "xstate.promise.reject", fe = /* @__PURE__ */ new WeakMap();
1649
1649
  function K(e) {
1650
1650
  return {
1651
1651
  config: e,
@@ -1654,7 +1654,7 @@ function K(e) {
1654
1654
  if (n.status !== "active")
1655
1655
  return n;
1656
1656
  switch (s.type) {
1657
- case gt: {
1657
+ case Et: {
1658
1658
  const o = s.data;
1659
1659
  return {
1660
1660
  ...n,
@@ -1663,7 +1663,7 @@ function K(e) {
1663
1663
  input: void 0
1664
1664
  };
1665
1665
  }
1666
- case Et:
1666
+ case vt:
1667
1667
  return {
1668
1668
  ...n,
1669
1669
  status: "error",
@@ -1694,12 +1694,12 @@ function K(e) {
1694
1694
  signal: i.signal
1695
1695
  })).then((a) => {
1696
1696
  s.getSnapshot().status === "active" && (fe.delete(s), r._relay(s, s, {
1697
- type: gt,
1697
+ type: Et,
1698
1698
  data: a
1699
1699
  }));
1700
1700
  }, (a) => {
1701
1701
  s.getSnapshot().status === "active" && (fe.delete(s), r._relay(s, s, {
1702
- type: Et,
1702
+ type: vt,
1703
1703
  data: a
1704
1704
  }));
1705
1705
  });
@@ -1724,7 +1724,7 @@ function Ts(e, {
1724
1724
  input: u
1725
1725
  } = a;
1726
1726
  if (typeof o == "string") {
1727
- const f = Ye(t, o);
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
1730
  const l = U(f, {
@@ -1791,7 +1791,7 @@ function C(e) {
1791
1791
  }
1792
1792
  return t.type = "xstate.assign", t.assignment = e, t.resolve = _s, t;
1793
1793
  }
1794
- let vt = /* @__PURE__ */ function(e) {
1794
+ let Tt = /* @__PURE__ */ function(e) {
1795
1795
  return e.Parent = "#_parent", e.Internal = "#_internal", e;
1796
1796
  }({});
1797
1797
  function Is(e, t, n, s, {
@@ -1814,7 +1814,7 @@ function Is(e, t, n, s, {
1814
1814
  const h = typeof r == "function" ? r(n, s) : r;
1815
1815
  let m;
1816
1816
  if (typeof h == "string") {
1817
- if (h === vt.Parent ? m = e.self._parent : h === vt.Internal ? m = e.self : h.startsWith("#_") ? m = t.children[h.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(h) ? h : t.children[h], !m)
1817
+ if (h === Tt.Parent ? m = e.self._parent : h === Tt.Internal ? m = e.self : h.startsWith("#_") ? m = t.children[h.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(h) ? h : t.children[h], !m)
1818
1818
  throw new Error(`Unable to send event to actor '${h}' from machine '${t.machine.id}'.`);
1819
1819
  } else
1820
1820
  m = h || e.self;
@@ -1845,21 +1845,21 @@ function xs(e, t) {
1845
1845
  // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
1846
1846
  // if it initially started as a string
1847
1847
  n,
1848
- s.type === bn ? Lt(e.self.id, s.data) : s
1848
+ s.type === bn ? Pt(e.self.id, s.data) : s
1849
1849
  );
1850
1850
  });
1851
1851
  }
1852
- function Tt(e, t, n) {
1852
+ function _t(e, t, n) {
1853
1853
  function s(r, i) {
1854
1854
  }
1855
1855
  return s.type = "xsnapshot.sendTo", s.to = e, s.event = t, s.id = n == null ? void 0 : n.id, s.delay = n == null ? void 0 : n.delay, s.resolve = Is, s.retryResolve = Ss, s.execute = xs, s;
1856
1856
  }
1857
- const _t = /* @__PURE__ */ new WeakMap();
1857
+ const It = /* @__PURE__ */ new WeakMap();
1858
1858
  function J(e, t, n) {
1859
- let s = _t.get(e);
1859
+ let s = It.get(e);
1860
1860
  return s ? t in s || (s[t] = n()) : (s = {
1861
1861
  [t]: n()
1862
- }, _t.set(e, s)), s[t];
1862
+ }, It.set(e, s)), s[t];
1863
1863
  }
1864
1864
  const As = {}, re = (e) => typeof e == "string" ? {
1865
1865
  type: e
@@ -1868,9 +1868,9 @@ const As = {}, re = (e) => typeof e == "string" ? {
1868
1868
  } : {
1869
1869
  type: e.name
1870
1870
  } : e;
1871
- class tt {
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(Ct), 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 ? ut(this.config.states, (s, r) => new tt(s, {
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 ? dt(this.config.states, (s, r) => new nt(s, {
1874
1874
  _parent: this,
1875
1875
  _key: r,
1876
1876
  _machine: this.machine
@@ -1880,7 +1880,7 @@ class tt {
1880
1880
  }
1881
1881
  /** @internal */
1882
1882
  _initialize() {
1883
- this.transitions = Jn(this), this.config.always && (this.always = X(this.config.always).map((t) => $(this, Dt, t))), Object.keys(this.states).forEach((t) => {
1883
+ this.transitions = Jn(this), this.config.always && (this.always = X(this.config.always).map((t) => $(this, Lt, t))), Object.keys(this.states).forEach((t) => {
1884
1884
  this.states[t]._initialize();
1885
1885
  });
1886
1886
  }
@@ -1907,7 +1907,7 @@ class tt {
1907
1907
  })
1908
1908
  } : void 0,
1909
1909
  history: this.history,
1910
- states: ut(this.states, (t) => t.definition),
1910
+ states: dt(this.states, (t) => t.definition),
1911
1911
  on: this.on,
1912
1912
  transitions: [...this.transitions.values()].flat().map((t) => ({
1913
1913
  ...t,
@@ -1935,7 +1935,7 @@ class tt {
1935
1935
  const {
1936
1936
  src: s,
1937
1937
  systemId: r
1938
- } = t, i = t.id ?? lt(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${lt(this.id, n)}`;
1938
+ } = t, i = t.id ?? ht(this.id, n), o = typeof s == "string" ? s : `xstate.invoke.${ht(this.id, n)}`;
1939
1939
  return {
1940
1940
  ...t,
1941
1941
  src: o,
@@ -1980,7 +1980,7 @@ class tt {
1980
1980
  } = a, u = t.context;
1981
1981
  let f = !1;
1982
1982
  try {
1983
- f = !c || Qe(c, u, n, t);
1983
+ f = !c || We(c, u, n, t);
1984
1984
  } catch (l) {
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}':
@@ -2022,14 +2022,14 @@ ${l.message}`);
2022
2022
  }
2023
2023
  }
2024
2024
  const ws = "#";
2025
- class nt {
2025
+ class st {
2026
2026
  constructor(t, n) {
2027
2027
  this.config = t, this.version = void 0, this.schemas = void 0, this.implementations = void 0, this.__xstatenode = !0, this.idMap = /* @__PURE__ */ new Map(), this.root = void 0, this.id = void 0, this.states = void 0, this.events = void 0, this.__TResolvedTypesMeta = void 0, this.id = t.id || "(machine)", this.implementations = {
2028
2028
  actors: (n == null ? void 0 : n.actors) ?? {},
2029
2029
  actions: (n == null ? void 0 : n.actions) ?? {},
2030
2030
  delays: (n == null ? void 0 : n.delays) ?? {},
2031
2031
  guards: (n == null ? void 0 : n.guards) ?? {}
2032
- }, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new tt(t, {
2032
+ }, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new nt(t, {
2033
2033
  _key: this.id,
2034
2034
  _machine: this
2035
2035
  }), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
@@ -2050,7 +2050,7 @@ class nt {
2050
2050
  actors: r,
2051
2051
  delays: i
2052
2052
  } = this.implementations;
2053
- return new nt(this.config, {
2053
+ return new st(this.config, {
2054
2054
  actions: {
2055
2055
  ...n,
2056
2056
  ...t.actions
@@ -2075,7 +2075,7 @@ class nt {
2075
2075
  _nodes: [...s],
2076
2076
  context: t.context || {},
2077
2077
  children: {},
2078
- status: Ke(s, this.root) ? "done" : t.status || "active",
2078
+ status: Ze(s, this.root) ? "done" : t.status || "active",
2079
2079
  output: t.output,
2080
2080
  error: t.error,
2081
2081
  historyValue: t.historyValue
@@ -2102,7 +2102,7 @@ class nt {
2102
2102
  return ke(t, n, s).microstates;
2103
2103
  }
2104
2104
  getTransitionData(t, n) {
2105
- return Ze(this.root, t.value, t, n) || [];
2105
+ return et(this.root, t.value, t, n) || [];
2106
2106
  }
2107
2107
  /**
2108
2108
  * The initial state _before_ evaluating any microsteps.
@@ -2131,8 +2131,8 @@ class nt {
2131
2131
  * Returns the initial `State` instance, with reference to `self` as an `ActorRef`.
2132
2132
  */
2133
2133
  getInitialSnapshot(t, n) {
2134
- const s = Mt(n), r = [], i = this.getPreInitialState(t, s, r), o = Ue([{
2135
- target: [...Gt(this.root)],
2134
+ const s = qt(n), r = [], i = this.getPreInitialState(t, s, r), o = Be([{
2135
+ target: [...Jt(this.root)],
2136
2136
  source: this.root,
2137
2137
  reenter: !0,
2138
2138
  actions: [],
@@ -2150,7 +2150,7 @@ class nt {
2150
2150
  });
2151
2151
  }
2152
2152
  getStateNodeById(t) {
2153
- const n = Je(t), s = n.slice(1), r = Se(n[0]) ? n[0].slice(ws.length) : n[0], i = this.idMap.get(r);
2153
+ const n = Ye(t), s = n.slice(1), r = Se(n[0]) ? n[0].slice(ws.length) : n[0], i = this.idMap.get(r);
2154
2154
  if (!i)
2155
2155
  throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);
2156
2156
  return Te(i, s);
@@ -2167,7 +2167,7 @@ class nt {
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, l = u.src, h = typeof l == "string" ? Ye(this, l) : l;
2170
+ const u = r[c], f = u.snapshot, l = u.src, h = typeof l == "string" ? Xe(this, l) : l;
2171
2171
  if (!h)
2172
2172
  return;
2173
2173
  const m = U(h, {
@@ -2192,7 +2192,7 @@ class nt {
2192
2192
  for (let f in c) {
2193
2193
  const l = c[f];
2194
2194
  if (l && typeof l == "object") {
2195
- if ("xstate$$type" in l && l.xstate$$type === Xe) {
2195
+ if ("xstate$$type" in l && l.xstate$$type === Qe) {
2196
2196
  c[f] = u[l.id];
2197
2197
  continue;
2198
2198
  }
@@ -2205,7 +2205,7 @@ class nt {
2205
2205
  }
2206
2206
  }
2207
2207
  function bs(e, t) {
2208
- return new nt(e, t);
2208
+ return new st(e, t);
2209
2209
  }
2210
2210
  function xe({
2211
2211
  schemas: e,
@@ -2233,7 +2233,7 @@ async function Ce(e, t) {
2233
2233
  success: !1
2234
2234
  });
2235
2235
  }
2236
- const It = xe({
2236
+ const St = xe({
2237
2237
  types: {
2238
2238
  context: {},
2239
2239
  events: {},
@@ -2530,13 +2530,13 @@ const It = xe({
2530
2530
  // },
2531
2531
  // },
2532
2532
  }
2533
- }), Wt = Ge(
2533
+ }), Zt = ze(
2534
2534
  {}
2535
2535
  ), jr = () => {
2536
- const e = ze(Wt), [t, n] = gn(
2536
+ const e = Je(Zt), [t, n] = Pe(
2537
2537
  typeof window < "u" && e.getSnapshot().value === "loggedIn"
2538
2538
  );
2539
- return En(() => {
2539
+ return Dt(() => {
2540
2540
  if (typeof window > "u")
2541
2541
  return;
2542
2542
  const s = e.subscribe((r) => {
@@ -2551,14 +2551,14 @@ const It = xe({
2551
2551
  endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
2552
2552
  }) => typeof window < "u" ? (console.warn(
2553
2553
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
2554
- ), U(It, {
2554
+ ), U(St, {
2555
2555
  inspect: t.inspect,
2556
2556
  input: {
2557
2557
  initialContext: {
2558
2558
  endpoints: t.endpoints
2559
2559
  }
2560
2560
  }
2561
- }).start()) : U(It, {
2561
+ }).start()) : U(St, {
2562
2562
  input: {
2563
2563
  initialContext: {
2564
2564
  endpoints: t.endpoints,
@@ -2568,7 +2568,7 @@ const It = xe({
2568
2568
  inspect: t.inspect
2569
2569
  }).start();
2570
2570
  function Vr({ actor: e, children: t }) {
2571
- return /* @__PURE__ */ He(Wt.Provider, { value: e, children: t });
2571
+ return /* @__PURE__ */ Ge(Zt.Provider, { value: e, children: t });
2572
2572
  }
2573
2573
  let Os = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
2574
2574
  const Ns = xe({
@@ -2741,11 +2741,11 @@ const Ns = xe({
2741
2741
  target: "idle"
2742
2742
  },
2743
2743
  RESUME_TIMER: {
2744
- actions: Tt("timer", { type: "RESUME_TIMER" })
2744
+ actions: _t("timer", { type: "RESUME_TIMER" })
2745
2745
  // cond: (context) => context.duration > 0,
2746
2746
  },
2747
2747
  PAUSE_TIMER: {
2748
- actions: Tt("timer", { type: "PAUSE_TIMER" })
2748
+ actions: _t("timer", { type: "PAUSE_TIMER" })
2749
2749
  // cond: (context) => context.duration > 0,
2750
2750
  }
2751
2751
  }
@@ -2779,12 +2779,12 @@ const Ns = xe({
2779
2779
  }
2780
2780
  }
2781
2781
  }
2782
- }), Kt = Ge({}), Gr = () => ze(Kt);
2782
+ }), en = ze({}), Gr = () => Je(en);
2783
2783
  function zr({
2784
2784
  children: e,
2785
2785
  actor: t
2786
2786
  }) {
2787
- return /* @__PURE__ */ He(Kt.Provider, { value: t, children: e });
2787
+ return /* @__PURE__ */ Ge(en.Provider, { value: t, children: e });
2788
2788
  }
2789
2789
  function ks({
2790
2790
  context: e,
@@ -2821,7 +2821,7 @@ function Ds({
2821
2821
  }
2822
2822
  };
2823
2823
  }
2824
- const st = JSON, Rs = (e) => e.toUpperCase(), Ls = (e) => {
2824
+ const rt = JSON, Rs = (e) => e.toUpperCase(), Ls = (e) => {
2825
2825
  const t = {};
2826
2826
  return e.forEach((n, s) => {
2827
2827
  t[s] = n;
@@ -2864,7 +2864,7 @@ function Bs(e, t) {
2864
2864
  );
2865
2865
  }
2866
2866
  const js = /\r\n|[\n\r]/g;
2867
- function Be(e, t) {
2867
+ function je(e, t) {
2868
2868
  let n = 0, s = 1;
2869
2869
  for (const r of e.body.matchAll(js)) {
2870
2870
  if (typeof r.index == "number" || Bs(!1), r.index >= t)
@@ -2877,26 +2877,26 @@ function Be(e, t) {
2877
2877
  };
2878
2878
  }
2879
2879
  function $s(e) {
2880
- return Zt(
2880
+ return tn(
2881
2881
  e.source,
2882
- Be(e.source, e.start)
2882
+ je(e.source, e.start)
2883
2883
  );
2884
2884
  }
2885
- function Zt(e, t) {
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
2887
  `, f = s.split(/\r\n|[\n\r]/g), l = f[r];
2888
2888
  if (l.length > 120) {
2889
2889
  const h = Math.floor(c / 80), m = c % 80, y = [];
2890
2890
  for (let v = 0; v < l.length; v += 80)
2891
2891
  y.push(l.slice(v, v + 80));
2892
- return u + St([
2892
+ return u + xt([
2893
2893
  [`${o} |`, y[0]],
2894
2894
  ...y.slice(1, h + 1).map((v) => ["|", v]),
2895
2895
  ["|", "^".padStart(m)],
2896
2896
  ["|", y[h + 1]]
2897
2897
  ]);
2898
2898
  }
2899
- return u + St([
2899
+ return u + xt([
2900
2900
  // Lines specified like this: ["prefix", "string"],
2901
2901
  [`${o - 1} |`, f[r - 1]],
2902
2902
  [`${o} |`, l],
@@ -2904,7 +2904,7 @@ function Zt(e, t) {
2904
2904
  [`${o + 1} |`, f[r + 1]]
2905
2905
  ]);
2906
2906
  }
2907
- function St(e) {
2907
+ function xt(e) {
2908
2908
  const t = e.filter(([s, r]) => r !== void 0), n = Math.max(...t.map(([s]) => s.length));
2909
2909
  return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
2910
2910
  `);
@@ -2920,7 +2920,7 @@ function Vs(e) {
2920
2920
  extensions: e[5]
2921
2921
  } : t;
2922
2922
  }
2923
- class rt extends Error {
2923
+ class it extends Error {
2924
2924
  /**
2925
2925
  * An array of `{ line, column }` locations within the source GraphQL document
2926
2926
  * which correspond to this error.
@@ -2962,13 +2962,13 @@ class rt extends Error {
2962
2962
  constructor(t, ...n) {
2963
2963
  var s, r, i;
2964
2964
  const { nodes: o, source: a, positions: c, path: u, originalError: f, extensions: l } = Vs(n);
2965
- super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = f ?? void 0, this.nodes = xt(
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
  );
2968
- const h = xt(
2968
+ const h = At(
2969
2969
  (s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
2970
2970
  );
2971
- this.source = a ?? (h == null || (r = h[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (h == null ? void 0 : h.map((y) => y.start)), this.locations = c && a ? c.map((y) => Be(a, y)) : h == null ? void 0 : h.map((y) => Be(y.source, y.start));
2971
+ this.source = a ?? (h == null || (r = h[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (h == null ? void 0 : h.map((y) => y.start)), this.locations = c && a ? c.map((y) => je(a, y)) : h == null ? void 0 : h.map((y) => je(y.source, y.start));
2972
2972
  const m = Us(
2973
2973
  f == null ? void 0 : f.extensions
2974
2974
  ) ? f == null ? void 0 : f.extensions : void 0;
@@ -2996,7 +2996,7 @@ class rt extends Error {
2996
2996
  value: f.stack,
2997
2997
  writable: !0,
2998
2998
  configurable: !0
2999
- }) : Error.captureStackTrace ? Error.captureStackTrace(this, rt) : Object.defineProperty(this, "stack", {
2999
+ }) : Error.captureStackTrace ? Error.captureStackTrace(this, it) : Object.defineProperty(this, "stack", {
3000
3000
  value: Error().stack,
3001
3001
  writable: !0,
3002
3002
  configurable: !0
@@ -3016,7 +3016,7 @@ class rt extends Error {
3016
3016
  for (const n of this.locations)
3017
3017
  t += `
3018
3018
 
3019
- ` + Zt(this.source, n);
3019
+ ` + tn(this.source, n);
3020
3020
  return t;
3021
3021
  }
3022
3022
  toJSON() {
@@ -3026,11 +3026,11 @@ class rt extends Error {
3026
3026
  return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
3027
3027
  }
3028
3028
  }
3029
- function xt(e) {
3029
+ function At(e) {
3030
3030
  return e === void 0 || e.length === 0 ? void 0 : e;
3031
3031
  }
3032
3032
  function b(e, t, n) {
3033
- return new rt(`Syntax Error: ${n}`, {
3033
+ return new it(`Syntax Error: ${n}`, {
3034
3034
  source: e,
3035
3035
  positions: [t]
3036
3036
  });
@@ -3064,7 +3064,7 @@ class Hs {
3064
3064
  };
3065
3065
  }
3066
3066
  }
3067
- class en {
3067
+ class nn {
3068
3068
  /**
3069
3069
  * The kind of Token.
3070
3070
  */
@@ -3106,7 +3106,7 @@ class en {
3106
3106
  };
3107
3107
  }
3108
3108
  }
3109
- const tn = {
3109
+ const sn = {
3110
3110
  Name: [],
3111
3111
  Document: ["definitions"],
3112
3112
  OperationDefinition: [
@@ -3180,8 +3180,8 @@ const tn = {
3180
3180
  UnionTypeExtension: ["name", "directives", "types"],
3181
3181
  EnumTypeExtension: ["name", "directives", "values"],
3182
3182
  InputObjectTypeExtension: ["name", "directives", "fields"]
3183
- }, Gs = new Set(Object.keys(tn));
3184
- function At(e) {
3183
+ }, Gs = new Set(Object.keys(sn));
3184
+ function wt(e) {
3185
3185
  const t = e == null ? void 0 : e.kind;
3186
3186
  return typeof t == "string" && Gs.has(t);
3187
3187
  }
@@ -3189,29 +3189,29 @@ var W;
3189
3189
  (function(e) {
3190
3190
  e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
3191
3191
  })(W || (W = {}));
3192
- var je;
3192
+ var $e;
3193
3193
  (function(e) {
3194
3194
  e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
3195
- })(je || (je = {}));
3195
+ })($e || ($e = {}));
3196
3196
  var T;
3197
3197
  (function(e) {
3198
3198
  e.NAME = "Name", e.DOCUMENT = "Document", e.OPERATION_DEFINITION = "OperationDefinition", e.VARIABLE_DEFINITION = "VariableDefinition", e.SELECTION_SET = "SelectionSet", e.FIELD = "Field", e.ARGUMENT = "Argument", e.FRAGMENT_SPREAD = "FragmentSpread", e.INLINE_FRAGMENT = "InlineFragment", e.FRAGMENT_DEFINITION = "FragmentDefinition", e.VARIABLE = "Variable", e.INT = "IntValue", e.FLOAT = "FloatValue", e.STRING = "StringValue", e.BOOLEAN = "BooleanValue", e.NULL = "NullValue", e.ENUM = "EnumValue", e.LIST = "ListValue", e.OBJECT = "ObjectValue", e.OBJECT_FIELD = "ObjectField", e.DIRECTIVE = "Directive", e.NAMED_TYPE = "NamedType", e.LIST_TYPE = "ListType", e.NON_NULL_TYPE = "NonNullType", e.SCHEMA_DEFINITION = "SchemaDefinition", e.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e.FIELD_DEFINITION = "FieldDefinition", e.INPUT_VALUE_DEFINITION = "InputValueDefinition", e.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e.DIRECTIVE_DEFINITION = "DirectiveDefinition", e.SCHEMA_EXTENSION = "SchemaExtension", e.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e.UNION_TYPE_EXTENSION = "UnionTypeExtension", e.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
3199
3199
  })(T || (T = {}));
3200
- function $e(e) {
3200
+ function Ve(e) {
3201
3201
  return e === 9 || e === 32;
3202
3202
  }
3203
3203
  function ce(e) {
3204
3204
  return e >= 48 && e <= 57;
3205
3205
  }
3206
- function nn(e) {
3206
+ function rn(e) {
3207
3207
  return e >= 97 && e <= 122 || // A-Z
3208
3208
  e >= 65 && e <= 90;
3209
3209
  }
3210
- function sn(e) {
3211
- return nn(e) || e === 95;
3210
+ function on(e) {
3211
+ return rn(e) || e === 95;
3212
3212
  }
3213
3213
  function zs(e) {
3214
- return nn(e) || ce(e) || e === 95;
3214
+ return rn(e) || ce(e) || e === 95;
3215
3215
  }
3216
3216
  function Js(e) {
3217
3217
  var t;
@@ -3228,15 +3228,15 @@ function Js(e) {
3228
3228
  }
3229
3229
  function Ys(e) {
3230
3230
  let t = 0;
3231
- for (; t < e.length && $e(e.charCodeAt(t)); )
3231
+ for (; t < e.length && Ve(e.charCodeAt(t)); )
3232
3232
  ++t;
3233
3233
  return t;
3234
3234
  }
3235
3235
  function Xs(e, t) {
3236
- const n = e.replace(/"""/g, '\\"""'), s = n.split(/\r\n|[\n\r]/g), r = s.length === 1, i = s.length > 1 && s.slice(1).every((m) => m.length === 0 || $e(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
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
3238
  let l = "";
3239
- const h = r && $e(e.charCodeAt(0));
3239
+ const h = r && Ve(e.charCodeAt(0));
3240
3240
  return (f && !h || i) && (l += `
3241
3241
  `), l += n, (f || u) && (l += `
3242
3242
  `), '"""' + l + '"""';
@@ -3259,7 +3259,7 @@ class Qs {
3259
3259
  * The character offset at which the current line begins.
3260
3260
  */
3261
3261
  constructor(t) {
3262
- const n = new en(p.SOF, 0, 0, 0, 0);
3262
+ const n = new nn(p.SOF, 0, 0, 0, 0);
3263
3263
  this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
3264
3264
  }
3265
3265
  get [Symbol.toStringTag]() {
@@ -3296,12 +3296,12 @@ function ne(e) {
3296
3296
  return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
3297
3297
  }
3298
3298
  function Ae(e, t) {
3299
- return rn(e.charCodeAt(t)) && on(e.charCodeAt(t + 1));
3299
+ return an(e.charCodeAt(t)) && cn(e.charCodeAt(t + 1));
3300
3300
  }
3301
- function rn(e) {
3301
+ function an(e) {
3302
3302
  return e >= 55296 && e <= 56319;
3303
3303
  }
3304
- function on(e) {
3304
+ function cn(e) {
3305
3305
  return e >= 56320 && e <= 57343;
3306
3306
  }
3307
3307
  function G(e, t) {
@@ -3316,7 +3316,7 @@ function G(e, t) {
3316
3316
  }
3317
3317
  function w(e, t, n, s, r) {
3318
3318
  const i = e.line, o = 1 + n - e.lineStart;
3319
- return new en(t, n, s, i, o, r);
3319
+ return new nn(t, n, s, i, o, r);
3320
3320
  }
3321
3321
  function Ks(e, t) {
3322
3322
  const n = e.source.body, s = n.length;
@@ -3373,7 +3373,7 @@ function Ks(e, t) {
3373
3373
  }
3374
3374
  if (ce(i) || i === 45)
3375
3375
  return er(e, r, i);
3376
- if (sn(i))
3376
+ if (on(i))
3377
3377
  return or(e, r);
3378
3378
  throw b(
3379
3379
  e.source,
@@ -3420,7 +3420,7 @@ function er(e, t, n) {
3420
3420
  );
3421
3421
  } else
3422
3422
  r = De(e, r, i), i = s.charCodeAt(r);
3423
- if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = De(e, r, i), i = s.charCodeAt(r)), (i === 69 || i === 101) && (o = !0, i = s.charCodeAt(++r), (i === 43 || i === 45) && (i = s.charCodeAt(++r)), r = De(e, r, i), i = s.charCodeAt(r)), i === 46 || sn(i))
3423
+ if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = De(e, r, i), i = s.charCodeAt(r)), (i === 69 || i === 101) && (o = !0, i = s.charCodeAt(++r), (i === 43 || i === 45) && (i = s.charCodeAt(++r)), r = De(e, r, i), i = s.charCodeAt(r)), i === 46 || on(i))
3424
3424
  throw b(
3425
3425
  e.source,
3426
3426
  r,
@@ -3510,15 +3510,15 @@ function nr(e, t) {
3510
3510
  );
3511
3511
  }
3512
3512
  function sr(e, t) {
3513
- const n = e.source.body, s = wt(n, t + 2);
3513
+ const n = e.source.body, s = bt(n, t + 2);
3514
3514
  if (ne(s))
3515
3515
  return {
3516
3516
  value: String.fromCodePoint(s),
3517
3517
  size: 6
3518
3518
  };
3519
- if (rn(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
3520
- const r = wt(n, t + 8);
3521
- if (on(r))
3519
+ if (an(s) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
3520
+ const r = bt(n, t + 8);
3521
+ if (cn(r))
3522
3522
  return {
3523
3523
  value: String.fromCodePoint(s, r),
3524
3524
  size: 12
@@ -3530,7 +3530,7 @@ function sr(e, t) {
3530
3530
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
3531
3531
  );
3532
3532
  }
3533
- function wt(e, t) {
3533
+ function bt(e, t) {
3534
3534
  return ie(e.charCodeAt(t)) << 12 | ie(e.charCodeAt(t + 1)) << 8 | ie(e.charCodeAt(t + 2)) << 4 | ie(e.charCodeAt(t + 3));
3535
3535
  }
3536
3536
  function ie(e) {
@@ -3651,8 +3651,8 @@ function or(e, t) {
3651
3651
  n.slice(t, r)
3652
3652
  );
3653
3653
  }
3654
- const ar = 10, an = 2;
3655
- function it(e) {
3654
+ const ar = 10, un = 2;
3655
+ function ot(e) {
3656
3656
  return we(e, []);
3657
3657
  }
3658
3658
  function we(e, t) {
@@ -3686,14 +3686,14 @@ function ur(e) {
3686
3686
  }
3687
3687
  function dr(e, t) {
3688
3688
  const n = Object.entries(e);
3689
- return n.length === 0 ? "{}" : t.length > an ? "[" + hr(e) + "]" : "{ " + n.map(
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
3693
  function lr(e, t) {
3694
3694
  if (e.length === 0)
3695
3695
  return "[]";
3696
- if (t.length > an)
3696
+ if (t.length > un)
3697
3697
  return "[Array]";
3698
3698
  const n = Math.min(ar, e.length), s = e.length - n, r = [];
3699
3699
  for (let i = 0; i < n; ++i)
@@ -3724,7 +3724,7 @@ const fr = (
3724
3724
  Symbol.toStringTag in t ? t[Symbol.toStringTag] : (s = t.constructor) === null || s === void 0 ? void 0 : s.name
3725
3725
  );
3726
3726
  if (r === i) {
3727
- const o = it(t);
3727
+ const o = ot(t);
3728
3728
  throw new Error(`Cannot use ${r} "${o}" from another module or realm.
3729
3729
 
3730
3730
  Ensure that there is only one instance of "graphql" in the node_modules
@@ -3742,12 +3742,12 @@ spurious results.`);
3742
3742
  return !1;
3743
3743
  }
3744
3744
  );
3745
- class cn {
3745
+ class dn {
3746
3746
  constructor(t, n = "GraphQL request", s = {
3747
3747
  line: 1,
3748
3748
  column: 1
3749
3749
  }) {
3750
- typeof t == "string" || me(!1, `Body must be a string. Received: ${it(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || me(
3750
+ typeof t == "string" || me(!1, `Body must be a string. Received: ${ot(t)}.`), this.body = t, this.name = n, this.locationOffset = s, this.locationOffset.line > 0 || me(
3751
3751
  !1,
3752
3752
  "line in locationOffset is 1-indexed and must be positive."
3753
3753
  ), this.locationOffset.column > 0 || me(
@@ -3760,14 +3760,14 @@ class cn {
3760
3760
  }
3761
3761
  }
3762
3762
  function pr(e) {
3763
- return fr(e, cn);
3763
+ return fr(e, dn);
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 cn(t);
3770
+ const s = pr(t) ? t : new dn(t);
3771
3771
  this._lexer = new Qs(s), this._options = n, this._tokenCounter = 0;
3772
3772
  }
3773
3773
  /**
@@ -4724,7 +4724,7 @@ class mr {
4724
4724
  */
4725
4725
  parseDirectiveLocation() {
4726
4726
  const t = this._lexer.token, n = this.parseName();
4727
- if (Object.prototype.hasOwnProperty.call(je, n.value))
4727
+ if (Object.prototype.hasOwnProperty.call($e, n.value))
4728
4728
  return n;
4729
4729
  throw this.unexpected(t);
4730
4730
  }
@@ -4758,7 +4758,7 @@ class mr {
4758
4758
  throw b(
4759
4759
  this._lexer.source,
4760
4760
  n.start,
4761
- `Expected ${un(t)}, found ${pe(n)}.`
4761
+ `Expected ${ln(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 un(e.kind) + (t != null ? ` "${t}"` : "");
4871
+ return ln(e.kind) + (t != null ? ` "${t}"` : "");
4872
4872
  }
4873
- function un(e) {
4873
+ function ln(e) {
4874
4874
  return Ws(e) ? `"${e}"` : e;
4875
4875
  }
4876
4876
  function gr(e) {
@@ -5047,7 +5047,7 @@ const Tr = [
5047
5047
  "\\u009E",
5048
5048
  "\\u009F"
5049
5049
  ], _r = Object.freeze({});
5050
- function Ir(e, t, n = tn) {
5050
+ 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));
@@ -5082,7 +5082,7 @@ function Ir(e, t, n = tn) {
5082
5082
  let D;
5083
5083
  if (!Array.isArray(u)) {
5084
5084
  var y, v;
5085
- At(u) || me(!1, `Invalid AST Node: ${it(u)}.`);
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
5087
  if (D = L == null ? void 0 : L.call(t, u, f, l, h, m), D === _r)
5088
5088
  break;
@@ -5092,7 +5092,7 @@ function Ir(e, t, n = tn) {
5092
5092
  continue;
5093
5093
  }
5094
5094
  } else if (D !== void 0 && (c.push([f, D]), !A))
5095
- if (At(D))
5095
+ if (wt(D))
5096
5096
  u = D;
5097
5097
  else {
5098
5098
  h.pop();
@@ -5124,7 +5124,7 @@ function Sr(e, t) {
5124
5124
  leave: e.leave
5125
5125
  };
5126
5126
  }
5127
- function dn(e) {
5127
+ function hn(e) {
5128
5128
  return Ir(e, Ar);
5129
5129
  }
5130
5130
  const xr = 80, Ar = {
@@ -5262,7 +5262,7 @@ const xr = 80, Ar = {
5262
5262
  },
5263
5263
  FieldDefinition: {
5264
5264
  leave: ({ description: e, name: t, arguments: n, type: s, directives: r }) => I("", e, `
5265
- `) + t + (bt(n) ? I(`(
5265
+ `) + t + (Ot(n) ? I(`(
5266
5266
  `, ge(E(n, `
5267
5267
  `)), `
5268
5268
  )`) : I("(", E(n, ", "), ")")) + ": " + s + I(" ", E(r, " "))
@@ -5308,7 +5308,7 @@ const xr = 80, Ar = {
5308
5308
  },
5309
5309
  DirectiveDefinition: {
5310
5310
  leave: ({ description: e, name: t, arguments: n, repeatable: s, locations: r }) => I("", e, `
5311
- `) + "directive @" + t + (bt(n) ? I(`(
5311
+ `) + "directive @" + t + (Ot(n) ? I(`(
5312
5312
  `, ge(E(n, `
5313
5313
  `)), `
5314
5314
  )`) : I("(", E(n, ", "), ")")) + (s ? " repeatable" : "") + " on " + E(r, " | ")
@@ -5381,12 +5381,12 @@ function ge(e) {
5381
5381
  return I(" ", e.replace(/\n/g, `
5382
5382
  `));
5383
5383
  }
5384
- function bt(e) {
5384
+ function Ot(e) {
5385
5385
  var t;
5386
5386
  return (t = e == null ? void 0 : e.some((n) => n.includes(`
5387
5387
  `))) !== null && t !== void 0 ? t : !1;
5388
5388
  }
5389
- const Ot = (e) => {
5389
+ const Nt = (e) => {
5390
5390
  var s, r;
5391
5391
  let t;
5392
5392
  const n = e.definitions.filter((i) => i.kind === "OperationDefinition");
@@ -5396,13 +5396,13 @@ const Ot = (e) => {
5396
5396
  let n;
5397
5397
  try {
5398
5398
  const s = yr(e);
5399
- n = Ot(s);
5399
+ n = Nt(s);
5400
5400
  } catch {
5401
5401
  }
5402
5402
  return { query: e, operationName: n };
5403
5403
  }
5404
- const t = Ot(e);
5405
- return { query: dn(e), operationName: t };
5404
+ const t = Nt(e);
5405
+ return { query: hn(e), operationName: t };
5406
5406
  };
5407
5407
  class oe extends Error {
5408
5408
  constructor(t, n) {
@@ -5421,7 +5421,7 @@ var wr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
5421
5421
  function br(e) {
5422
5422
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
5423
5423
  }
5424
- var Ve = { exports: {} };
5424
+ var He = { exports: {} };
5425
5425
  (function(e, t) {
5426
5426
  var n = typeof self < "u" ? self : wr, s = function() {
5427
5427
  function i() {
@@ -5581,7 +5581,7 @@ var Ve = { exports: {} };
5581
5581
  throw new Error("could not read FormData body as text");
5582
5582
  return Promise.resolve(this._bodyText);
5583
5583
  }, a.formData && (this.formData = function() {
5584
- return this.text().then(pn);
5584
+ return this.text().then(mn);
5585
5585
  }), this.json = function() {
5586
5586
  return this.text().then(JSON.parse);
5587
5587
  }, this;
@@ -5607,7 +5607,7 @@ var Ve = { exports: {} };
5607
5607
  j.prototype.clone = function() {
5608
5608
  return new j(this, { body: this._bodyInit });
5609
5609
  };
5610
- function pn(d) {
5610
+ function mn(d) {
5611
5611
  var g = new FormData();
5612
5612
  return d.trim().split("&").forEach(function(_) {
5613
5613
  if (_) {
@@ -5616,7 +5616,7 @@ var Ve = { exports: {} };
5616
5616
  }
5617
5617
  }), g;
5618
5618
  }
5619
- function yn(d) {
5619
+ function gn(d) {
5620
5620
  var g = new y(), _ = d.replace(/\r?\n[\t ]+/g, " ");
5621
5621
  return _.split(/\r?\n/).forEach(function(N) {
5622
5622
  var O = N.split(":"), x = O.shift().trim();
@@ -5641,9 +5641,9 @@ var Ve = { exports: {} };
5641
5641
  var d = new P(null, { status: 0, statusText: "" });
5642
5642
  return d.type = "error", d;
5643
5643
  };
5644
- var mn = [301, 302, 303, 307, 308];
5644
+ var En = [301, 302, 303, 307, 308];
5645
5645
  P.redirect = function(d, g) {
5646
- if (mn.indexOf(g) === -1)
5646
+ if (En.indexOf(g) === -1)
5647
5647
  throw new RangeError("Invalid status code");
5648
5648
  return new P(null, { status: g, headers: { location: d } });
5649
5649
  }, o.DOMException = i.DOMException;
@@ -5669,7 +5669,7 @@ var Ve = { exports: {} };
5669
5669
  var se = {
5670
5670
  status: x.status,
5671
5671
  statusText: x.statusText,
5672
- headers: yn(x.getAllResponseHeaders() || "")
5672
+ headers: gn(x.getAllResponseHeaders() || "")
5673
5673
  };
5674
5674
  se.url = "responseURL" in x ? x.responseURL : se.headers.get("X-Request-URL");
5675
5675
  var Oe = "response" in x ? x.response : x.responseText;
@@ -5692,8 +5692,8 @@ var Ve = { exports: {} };
5692
5692
  })(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
5693
5693
  var r = s;
5694
5694
  t = r.fetch, t.default = r.fetch, t.fetch = r.fetch, t.Headers = r.Headers, t.Request = r.Request, t.Response = r.Response, e.exports = t;
5695
- })(Ve, Ve.exports);
5696
- var Ie = Ve.exports;
5695
+ })(He, He.exports);
5696
+ var Ie = He.exports;
5697
5697
  const Ee = /* @__PURE__ */ br(Ie), Or = /* @__PURE__ */ Tn({
5698
5698
  __proto__: null,
5699
5699
  default: Ee
@@ -5702,15 +5702,15 @@ const Ee = /* @__PURE__ */ br(Ie), Or = /* @__PURE__ */ Tn({
5702
5702
  return e && (typeof Headers < "u" && e instanceof Headers || Or && Ie.Headers && e instanceof Ie.Headers ? t = Ls(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
5703
5703
  n && s !== void 0 && (t[n] = s);
5704
5704
  }) : t = e), t;
5705
- }, Nt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Nr = (e) => {
5705
+ }, kt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Nr = (e) => {
5706
5706
  if (!Array.isArray(e.query)) {
5707
- const s = e, r = [`query=${encodeURIComponent(Nt(s.query))}`];
5707
+ const s = e, r = [`query=${encodeURIComponent(kt(s.query))}`];
5708
5708
  return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
5709
5709
  }
5710
5710
  if (typeof e.variables < "u" && !Array.isArray(e.variables))
5711
5711
  throw new Error("Cannot create query with given variable type, array expected");
5712
5712
  const t = e, n = e.query.reduce((s, r, i) => (s.push({
5713
- query: Nt(r),
5713
+ query: kt(r),
5714
5714
  variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
5715
5715
  }), s), []);
5716
5716
  return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
@@ -5721,7 +5721,7 @@ const Ee = /* @__PURE__ */ br(Ie), Or = /* @__PURE__ */ Tn({
5721
5721
  query: s,
5722
5722
  variables: r,
5723
5723
  operationName: i,
5724
- jsonSerializer: a.jsonSerializer ?? st
5724
+ jsonSerializer: a.jsonSerializer ?? rt
5725
5725
  });
5726
5726
  const h = {
5727
5727
  method: e,
@@ -5736,7 +5736,7 @@ const Ee = /* @__PURE__ */ br(Ie), Or = /* @__PURE__ */ Tn({
5736
5736
  }
5737
5737
  return f && (m = `${m}?${f}`), await o(m, y);
5738
5738
  };
5739
- class ln {
5739
+ class fn {
5740
5740
  constructor(t, n = {}) {
5741
5741
  this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
5742
5742
  const [r, i, o] = s, a = Ps(r, i, o), { headers: c, fetch: u = Ee, method: f = "POST", requestMiddleware: l, responseMiddleware: h, ...m } = this.requestConfig, { url: y } = this;
@@ -5822,7 +5822,7 @@ class ln {
5822
5822
  }
5823
5823
  }
5824
5824
  const Le = async (e) => {
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 ?? st), 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";
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
5827
  const { errors: f, ...l } = (Array.isArray(a), a), h = s.errorPolicy === "ignore" ? l : a;
5828
5828
  return {
@@ -5841,14 +5841,14 @@ const Le = async (e) => {
5841
5841
  );
5842
5842
  }
5843
5843
  };
5844
- async function hn(e, t, ...n) {
5844
+ async function pn(e, t, ...n) {
5845
5845
  const s = Fs(e, t, ...n);
5846
- return new ln(s.url).request({
5846
+ return new fn(s.url).request({
5847
5847
  ...s
5848
5848
  });
5849
5849
  }
5850
5850
  const Cr = (e, t, n, s) => {
5851
- const r = s ?? st;
5851
+ const r = s ?? rt;
5852
5852
  if (!Array.isArray(e))
5853
5853
  return r.stringify({ query: e, variables: t, operationName: n });
5854
5854
  if (typeof t < "u" && !Array.isArray(t))
@@ -5872,7 +5872,7 @@ const Cr = (e, t, n, s) => {
5872
5872
  if (!e.requestHeaders)
5873
5873
  throw new Error("No request headers provided.");
5874
5874
  try {
5875
- const n = await hn(
5875
+ const n = await pn(
5876
5876
  e.endpoint,
5877
5877
  e.document,
5878
5878
  { items: e.items },
@@ -5892,7 +5892,7 @@ const Cr = (e, t, n, s) => {
5892
5892
  if (e.items.length < 1)
5893
5893
  throw new Error("No items provided.");
5894
5894
  try {
5895
- const n = await hn(
5895
+ const n = await pn(
5896
5896
  e.endpoint,
5897
5897
  ""
5898
5898
  // input.document,
@@ -5921,7 +5921,7 @@ const Cr = (e, t, n, s) => {
5921
5921
  throw console.log("no request document"), new Error("No request document provided.");
5922
5922
  if (!e.requestHeaders)
5923
5923
  throw console.log("no headers"), new Error("No request headers provided.");
5924
- const t = new ln(
5924
+ const t = new fn(
5925
5925
  Mr ? e.endpointSsr : e.endpoint,
5926
5926
  {
5927
5927
  credentials: "include",
@@ -5931,7 +5931,7 @@ const Cr = (e, t, n, s) => {
5931
5931
  );
5932
5932
  try {
5933
5933
  const { data: o, headers: a, status: c, errors: u, extensions: f } = await t.rawRequest(
5934
- dn(e.document),
5934
+ hn(e.document),
5935
5935
  {},
5936
5936
  typeof window > "u" ? {
5937
5937
  ...e.requestHeaders,
@@ -5950,7 +5950,7 @@ const Cr = (e, t, n, s) => {
5950
5950
  throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
5951
5951
  }
5952
5952
  }
5953
- ), qr = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Fr = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", kt = xe({
5953
+ ), qr = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Fr = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", Ct = xe({
5954
5954
  types: {
5955
5955
  context: {},
5956
5956
  events: {},
@@ -6231,23 +6231,34 @@ const Cr = (e, t, n, s) => {
6231
6231
  // removingGiftCard: {},
6232
6232
  // applyingSettings: {},
6233
6233
  }
6234
- }), fn = Ge(
6234
+ }), yn = ze(
6235
6235
  {}
6236
- ), Jr = () => ({ quoteActor: ze(fn) }), Yr = async (e = {
6236
+ ), Jr = () => {
6237
+ var i;
6238
+ const e = Je(yn), [t, n] = Pe(
6239
+ e.getSnapshot().context.quote.items ?? []
6240
+ ), [s, r] = Pe(
6241
+ ((i = e.getSnapshot().context.quote.items) == null ? void 0 : i.length) ?? 0
6242
+ );
6243
+ return Dt(() => {
6244
+ const o = e.getSnapshot().context.quote.items ?? [];
6245
+ n(o), r(o.length);
6246
+ }, [e]), { quoteActor: e, items: t, itemsCount: s };
6247
+ }, Yr = async (e = {
6237
6248
  inspect: void 0,
6238
6249
  quote: { id: "", locale: "" },
6239
6250
  endpoints: { client: "", server: "" },
6240
6251
  graphql: {}
6241
6252
  }) => typeof window < "u" ? (console.warn(
6242
6253
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
6243
- ), U(kt, {
6254
+ ), U(Ct, {
6244
6255
  inspect: e.inspect,
6245
6256
  input: {
6246
6257
  initialContext: {
6247
6258
  endpoints: e.endpoints
6248
6259
  }
6249
6260
  }
6250
- }).start()) : U(kt, {
6261
+ }).start()) : U(Ct, {
6251
6262
  input: {
6252
6263
  initialContext: {
6253
6264
  endpoints: e.endpoints,
@@ -6261,19 +6272,19 @@ const Cr = (e, t, n, s) => {
6261
6272
  inspect: e.inspect
6262
6273
  }).start();
6263
6274
  function Xr({ actor: e, children: t }) {
6264
- return /* @__PURE__ */ He(fn.Provider, { value: e, children: t });
6275
+ return /* @__PURE__ */ Ge(yn.Provider, { value: e, children: t });
6265
6276
  }
6266
6277
  export {
6267
- Wt as AuthContext,
6278
+ Zt as AuthContext,
6268
6279
  Vr as AuthProvider,
6269
- fn as QuoteContext,
6280
+ yn as QuoteContext,
6270
6281
  Xr as QuoteProvider,
6271
- Kt as ToastContext,
6282
+ en as ToastContext,
6272
6283
  zr as ToastProvider,
6273
- It as authMachine,
6284
+ St as authMachine,
6274
6285
  $r as getAuth,
6275
6286
  Yr as getQuote,
6276
- kt as quoteMachine,
6287
+ Ct as quoteMachine,
6277
6288
  Ns as timerMachine,
6278
6289
  Hr as toastMachine,
6279
6290
  jr as useAuth,