@clicktap/state 0.13.0 → 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.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,20 +119,20 @@ function Dn(e, t) {
119
119
  delay: v,
120
120
  id: S,
121
121
  startedAt: Date.now()
122
- }, R = at(h, S);
123
- l._snapshot._scheduledEvents[R] = A;
122
+ }, R = ct(h, S);
123
+ d._snapshot._scheduledEvents[R] = A;
124
124
  const D = a.setTimeout(() => {
125
- delete o[R], delete l._snapshot._scheduledEvents[R], l._relay(h, m, y);
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
- const y = at(h, m), v = o[y];
131
- delete o[y], delete l._snapshot._scheduledEvents[y], a.clearTimeout(v);
130
+ const y = ct(h, m), v = o[y];
131
+ delete o[y], delete d._snapshot._scheduledEvents[y], a.clearTimeout(v);
132
132
  },
133
133
  cancelAll: (h) => {
134
- for (const m in l._snapshot._scheduledEvents) {
135
- const y = l._snapshot._scheduledEvents[m];
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
- }, l = {
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
- l._sendInspectionEvent({
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
- ...l._snapshot._scheduledEvents
183
+ ...d._snapshot._scheduledEvents
184
184
  }
185
185
  }),
186
186
  start: () => {
187
- const h = l._snapshot._scheduledEvents;
188
- l._snapshot._scheduledEvents = {};
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,14 +200,14 @@ function Dn(e, t) {
200
200
  _clock: a,
201
201
  _logger: c
202
202
  };
203
- return l;
203
+ return d;
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 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];
@@ -253,31 +253,31 @@ 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
  }
@@ -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
@@ -341,20 +341,20 @@ class Pn {
341
341
  id: this.id,
342
342
  sessionId: this.sessionId,
343
343
  logger: this.logger,
344
- defer: (l) => {
345
- this._deferred.push(l);
344
+ defer: (d) => {
345
+ this._deferred.push(d);
346
346
  },
347
347
  system: this.system,
348
- stopChild: (l) => {
349
- if (l._parent !== this)
350
- throw new Error(`Cannot stop child actor ${l.id} of ${this.id} because it is not a child`);
351
- l._stop();
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: (l) => {
354
- const h = this.eventListeners.get(l.type);
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(l);
357
+ m(d);
358
358
  }
359
359
  }, this.send = this.send.bind(this), this.system._sendInspectionEvent({
360
360
  type: "@xstate.actor",
@@ -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,9 +708,9 @@ 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;
712
- let l;
713
- return u && (l = U(u, {
711
+ const u = typeof o == "string" ? Xe(t.machine, o) : o, f = typeof r == "function" ? r(n) : r;
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]: l
727
+ [f]: d
728
728
  }
729
729
  }), {
730
730
  id: r,
731
- actorRef: l
731
+ actorRef: d
732
732
  }];
733
733
  }
734
734
  function jn(e, {
@@ -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,36 +1186,36 @@ 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
- 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);
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((l, h) => h.order - l.order).flatMap((l) => l.exit), i));
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 (l) {
1205
- throw l;
1204
+ } catch (d) {
1205
+ throw d;
1206
1206
  }
1207
1207
  }
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;
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 l = /* @__PURE__ */ new Set();
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(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" && !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, {
@@ -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);
1298
- c.sort((f, l) => l.order - f.order);
1297
+ const c = Ue(s, r, i);
1298
+ c.sort((f, d) => d.order - f.order);
1299
1299
  let u;
1300
1300
  for (const f of c)
1301
- for (const l of Zn(f)) {
1301
+ for (const d 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
+ d.history === "deep" ? h = (m) => Ke(m) && B(m, f) : h = (m) => m.parent === f, u ?? (u = {
1304
1304
  ...i
1305
- }), u[l.id] = Array.from(r).filter(h);
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((l) => Bt(l.id))], o), r.delete(f);
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
- 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(d, h);
1329
1329
  } finally {
1330
- ft = !1;
1330
+ pt = !1;
1331
1331
  }
1332
1332
  };
1333
1333
  const u = typeof c == "function", f = u ? c : (
@@ -1338,7 +1338,7 @@ function Xt(e, t, n, s, r, i) {
1338
1338
  );
1339
1339
  if (!f)
1340
1340
  continue;
1341
- const l = {
1341
+ const d = {
1342
1342
  context: a.context,
1343
1343
  event: t,
1344
1344
  self: n.self,
@@ -1356,18 +1356,18 @@ function Xt(e, t, n, s, r, i) {
1356
1356
  const y = f, [v, S, A] = y.resolve(
1357
1357
  n,
1358
1358
  a,
1359
- l,
1359
+ d,
1360
1360
  h,
1361
1361
  f,
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);
@@ -1378,26 +1378,26 @@ 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, l) {
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: l
1387
+ _transitions: d
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);
1400
- if (f && !l.length)
1398
+ if (a.type !== Mt) {
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
@@ -1405,15 +1405,15 @@ function ke(e, t, n, s = []) {
1405
1405
  snapshot: r,
1406
1406
  microstates: i
1407
1407
  };
1408
- r = Ue(
1409
- l,
1408
+ r = Be(
1409
+ d,
1410
1410
  e,
1411
1411
  n,
1412
1412
  a,
1413
1413
  !1,
1414
1414
  // isInitial
1415
1415
  s
1416
- ), o(r, u, l);
1416
+ ), o(r, u, d);
1417
1417
  }
1418
1418
  let c = !0;
1419
1419
  for (; r.status === "active"; ) {
@@ -1422,45 +1422,45 @@ 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
- const ds = function(t) {
1462
- return Pt(t, this.value);
1463
- }, ls = function(t) {
1461
+ const ls = function(t) {
1462
+ return Ft(t, this.value);
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);
@@ -1493,12 +1493,12 @@ 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 || {},
1500
- matches: ds,
1501
- hasTag: ls,
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: l,
1524
+ toJSON: d,
1525
1525
  ...h
1526
1526
  } = e, m = {};
1527
1527
  for (const v in i) {
@@ -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);
@@ -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 l = c && c[o];
1577
- f = typeof l == "function" ? l(n, s) : l;
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, {
@@ -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,10 +1724,10 @@ 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
- const l = U(f, {
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[l.id] = l, l;
1742
+ return r[d.id] = d, d;
1743
1743
  } else
1744
1744
  return U(o, {
1745
1745
  id: a.id,
@@ -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, {
@@ -1805,16 +1805,16 @@ 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 l;
1808
+ let d;
1809
1809
  if (typeof a == "string") {
1810
1810
  const v = u && u[a];
1811
- l = typeof v == "function" ? v(n, s) : v;
1811
+ d = typeof v == "function" ? v(n, s) : v;
1812
1812
  } else
1813
- l = typeof a == "function" ? a(n, s) : a;
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") {
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;
@@ -1822,7 +1822,7 @@ function Is(e, t, n, s, {
1822
1822
  to: m,
1823
1823
  event: f,
1824
1824
  id: o,
1825
- delay: l
1825
+ delay: d
1826
1826
  }];
1827
1827
  }
1828
1828
  function Ss(e, t, n) {
@@ -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 ? lt(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: lt(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,11 +1980,11 @@ class tt {
1980
1980
  } = a, u = t.context;
1981
1981
  let f = !1;
1982
1982
  try {
1983
- f = !c || Qe(c, u, n, t);
1984
- } catch (l) {
1983
+ f = !c || We(c, u, n, t);
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
- ${l.message}`);
1987
+ ${d.message}`);
1988
1988
  }
1989
1989
  if (f) {
1990
1990
  r.push(...a.actions), i = a;
@@ -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, 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 nt {
2175
2175
  parent: n.self,
2176
2176
  syncSnapshot: u.syncSnapshot,
2177
2177
  snapshot: f,
2178
- src: l,
2178
+ src: d,
2179
2179
  systemId: u.systemId
2180
2180
  });
2181
2181
  s[c] = m;
@@ -2190,13 +2190,13 @@ class nt {
2190
2190
  if (!o.has(c)) {
2191
2191
  o.add(c);
2192
2192
  for (let f in c) {
2193
- const l = c[f];
2194
- if (l && typeof l == "object") {
2195
- if ("xstate$$type" in l && l.xstate$$type === Xe) {
2196
- c[f] = u[l.id];
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(l, u);
2199
+ a(d, u);
2200
2200
  }
2201
2201
  }
2202
2202
  }
@@ -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,34 +2877,34 @@ 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
- `, f = s.split(/\r\n|[\n\r]/g), l = f[r];
2888
- if (l.length > 120) {
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 < l.length; v += 80)
2891
- y.push(l.slice(v, v + 80));
2892
- return u + St([
2890
+ for (let v = 0; v < d.length; v += 80)
2891
+ y.push(d.slice(v, v + 80));
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
- [`${o} |`, l],
2902
+ [`${o} |`, d],
2903
2903
  ["|", "^".padStart(c)],
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.
@@ -2961,18 +2961,18 @@ class rt 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: l } = Vs(n);
2965
- super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = f ?? void 0, this.nodes = xt(
2964
+ const { nodes: o, source: a, positions: c, path: u, originalError: f, extensions: d } = Vs(n);
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;
2975
- this.extensions = (i = l ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
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
@@ -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,18 +3228,18 @@ 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
- let l = "";
3239
- const h = r && $e(e.charCodeAt(0));
3240
- return (f && !h || i) && (l += `
3241
- `), l += n, (f || u) && (l += `
3242
- `), '"""' + l + '"""';
3238
+ let d = "";
3239
+ const h = r && Ve(e.charCodeAt(0));
3240
+ return (f && !h || i) && (d += `
3241
+ `), d += n, (f || u) && (d += `
3242
+ `), '"""' + d + '"""';
3243
3243
  }
3244
3244
  var p;
3245
3245
  (function(e) {
@@ -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) {
@@ -3678,22 +3678,22 @@ 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 lr(e, n);
3682
- return dr(e, n);
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 dr(e, t) {
3687
+ function lr(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
- function lr(e, t) {
3693
+ function dr(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 ln {
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, 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 cn(t);
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
  /**
@@ -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 ${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 un(e.kind) + (t != null ? ` "${t}"` : "");
4871
+ return dn(e.kind) + (t != null ? ` "${t}"` : "");
4872
4872
  }
4873
- function un(e) {
4873
+ function dn(e) {
4874
4874
  return Ws(e) ? `"${e}"` : e;
4875
4875
  }
4876
4876
  function gr(e) {
@@ -5047,23 +5047,23 @@ 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));
5054
- let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, f, l;
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 = l, l = m.pop(), R)
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, de] of c) {
5065
- const le = z - L;
5066
- de === null ? (u.splice(le, 1), L++) : u[le] = de;
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,17 +5074,17 @@ function Ir(e, t, n = tn) {
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 (l) {
5078
- if (f = i ? a : o[a], u = l[f], u == null)
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
  }
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
- if (D = L == null ? void 0 : L.call(t, u, f, l, h, m), D === _r)
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) {
@@ -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();
@@ -5109,7 +5109,7 @@ function Ir(e, t, n = tn) {
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 = [], l && m.push(l), l = u;
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;
@@ -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() {
@@ -5444,8 +5444,8 @@ var Ve = { exports: {} };
5444
5444
  formData: "FormData" in i,
5445
5445
  arrayBuffer: "ArrayBuffer" in i
5446
5446
  };
5447
- function c(d) {
5448
- return d && DataView.prototype.isPrototypeOf(d);
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 Ve = { exports: {} };
5458
5458
  "[object Uint32Array]",
5459
5459
  "[object Float32Array]",
5460
5460
  "[object Float64Array]"
5461
- ], f = ArrayBuffer.isView || function(d) {
5462
- return d && u.indexOf(Object.prototype.toString.call(d)) > -1;
5461
+ ], f = ArrayBuffer.isView || function(l) {
5462
+ return l && u.indexOf(Object.prototype.toString.call(l)) > -1;
5463
5463
  };
5464
- function l(d) {
5465
- if (typeof d != "string" && (d = String(d)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(d))
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 d.toLowerCase();
5467
+ return l.toLowerCase();
5468
5468
  }
5469
- function h(d) {
5470
- return typeof d != "string" && (d = String(d)), d;
5469
+ function h(l) {
5470
+ return typeof l != "string" && (l = String(l)), l;
5471
5471
  }
5472
- function m(d) {
5472
+ function m(l) {
5473
5473
  var g = {
5474
5474
  next: function() {
5475
- var _ = d.shift();
5475
+ var _ = l.shift();
5476
5476
  return { done: _ === void 0, value: _ };
5477
5477
  }
5478
5478
  };
@@ -5480,86 +5480,86 @@ var Ve = { exports: {} };
5480
5480
  return g;
5481
5481
  }), g;
5482
5482
  }
5483
- function y(d) {
5484
- this.map = {}, d instanceof y ? d.forEach(function(g, _) {
5483
+ function y(l) {
5484
+ this.map = {}, l instanceof y ? l.forEach(function(g, _) {
5485
5485
  this.append(_, g);
5486
- }, this) : Array.isArray(d) ? d.forEach(function(g) {
5486
+ }, this) : Array.isArray(l) ? l.forEach(function(g) {
5487
5487
  this.append(g[0], g[1]);
5488
- }, this) : d && Object.getOwnPropertyNames(d).forEach(function(g) {
5489
- this.append(g, d[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(d, g) {
5493
- d = l(d), g = h(g);
5494
- var _ = this.map[d];
5495
- this.map[d] = _ ? _ + ", " + g : g;
5496
- }, y.prototype.delete = function(d) {
5497
- delete this.map[l(d)];
5498
- }, y.prototype.get = function(d) {
5499
- return d = l(d), this.has(d) ? this.map[d] : null;
5500
- }, y.prototype.has = function(d) {
5501
- return this.map.hasOwnProperty(l(d));
5502
- }, y.prototype.set = function(d, g) {
5503
- this.map[l(d)] = h(g);
5504
- }, y.prototype.forEach = function(d, g) {
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(_) && d.call(g, this.map[_], _, this);
5506
+ this.map.hasOwnProperty(_) && l.call(g, this.map[_], _, this);
5507
5507
  }, y.prototype.keys = function() {
5508
- var d = [];
5508
+ var l = [];
5509
5509
  return this.forEach(function(g, _) {
5510
- d.push(_);
5511
- }), m(d);
5510
+ l.push(_);
5511
+ }), m(l);
5512
5512
  }, y.prototype.values = function() {
5513
- var d = [];
5513
+ var l = [];
5514
5514
  return this.forEach(function(g) {
5515
- d.push(g);
5516
- }), m(d);
5515
+ l.push(g);
5516
+ }), m(l);
5517
5517
  }, y.prototype.entries = function() {
5518
- var d = [];
5518
+ var l = [];
5519
5519
  return this.forEach(function(g, _) {
5520
- d.push([_, g]);
5521
- }), m(d);
5520
+ l.push([_, g]);
5521
+ }), m(l);
5522
5522
  }, a.iterable && (y.prototype[Symbol.iterator] = y.prototype.entries);
5523
- function v(d) {
5524
- if (d.bodyUsed)
5523
+ function v(l) {
5524
+ if (l.bodyUsed)
5525
5525
  return Promise.reject(new TypeError("Already read"));
5526
- d.bodyUsed = !0;
5526
+ l.bodyUsed = !0;
5527
5527
  }
5528
- function S(d) {
5528
+ function S(l) {
5529
5529
  return new Promise(function(g, _) {
5530
- d.onload = function() {
5531
- g(d.result);
5532
- }, d.onerror = function() {
5533
- _(d.error);
5530
+ l.onload = function() {
5531
+ g(l.result);
5532
+ }, l.onerror = function() {
5533
+ _(l.error);
5534
5534
  };
5535
5535
  });
5536
5536
  }
5537
- function A(d) {
5537
+ function A(l) {
5538
5538
  var g = new FileReader(), _ = S(g);
5539
- return g.readAsArrayBuffer(d), _;
5539
+ return g.readAsArrayBuffer(l), _;
5540
5540
  }
5541
- function R(d) {
5541
+ function R(l) {
5542
5542
  var g = new FileReader(), _ = S(g);
5543
- return g.readAsText(d), _;
5543
+ return g.readAsText(l), _;
5544
5544
  }
5545
- function D(d) {
5546
- for (var g = new Uint8Array(d), _ = new Array(g.length), N = 0; N < g.length; N++)
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(d) {
5551
- if (d.slice)
5552
- return d.slice(0);
5553
- var g = new Uint8Array(d.byteLength);
5554
- return g.set(new Uint8Array(d)), g.buffer;
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(d) {
5558
- this._bodyInit = d, d ? typeof d == "string" ? this._bodyText = d : a.blob && Blob.prototype.isPrototypeOf(d) ? this._bodyBlob = d : a.formData && FormData.prototype.isPrototypeOf(d) ? this._bodyFormData = d : a.searchParams && URLSearchParams.prototype.isPrototypeOf(d) ? this._bodyText = d.toString() : a.arrayBuffer && a.blob && c(d) ? (this._bodyArrayBuffer = L(d.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : a.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(d) || f(d)) ? this._bodyArrayBuffer = L(d) : this._bodyText = d = Object.prototype.toString.call(d) : this._bodyText = "", this.headers.get("content-type") || (typeof d == "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(d) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
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 d = v(this);
5561
- if (d)
5562
- return d;
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 Ve = { 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 d = v(this);
5574
- if (d)
5575
- return d;
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)
@@ -5581,43 +5581,43 @@ 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;
5588
5588
  }
5589
- var de = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
5590
- function le(d) {
5591
- var g = d.toUpperCase();
5592
- return de.indexOf(g) > -1 ? g : d;
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(d, g) {
5594
+ function j(l, g) {
5595
5595
  g = g || {};
5596
5596
  var _ = g.body;
5597
- if (d instanceof j) {
5598
- if (d.bodyUsed)
5597
+ if (l instanceof j) {
5598
+ if (l.bodyUsed)
5599
5599
  throw new TypeError("Already read");
5600
- this.url = d.url, this.credentials = d.credentials, g.headers || (this.headers = new y(d.headers)), this.method = d.method, this.mode = d.mode, this.signal = d.signal, !_ && d._bodyInit != null && (_ = d._bodyInit, d.bodyUsed = !0);
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(d);
5603
- if (this.credentials = g.credentials || this.credentials || "same-origin", (g.headers || !this.headers) && (this.headers = new y(g.headers)), this.method = le(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") && _)
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 pn(d) {
5610
+ function mn(l) {
5611
5611
  var g = new FormData();
5612
- return d.trim().split("&").forEach(function(_) {
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 yn(d) {
5620
- var g = new y(), _ = d.replace(/\r?\n[\t ]+/g, " ");
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 Ve = { exports: {} };
5627
5627
  }), g;
5628
5628
  }
5629
5629
  z.call(j.prototype);
5630
- function P(d, 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(d);
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 Ve = { exports: {} };
5638
5638
  url: this.url
5639
5639
  });
5640
5640
  }, P.error = function() {
5641
- var d = new P(null, { status: 0, statusText: "" });
5642
- return d.type = "error", d;
5641
+ var l = new P(null, { status: 0, statusText: "" });
5642
+ return l.type = "error", l;
5643
5643
  };
5644
- var mn = [301, 302, 303, 307, 308];
5645
- P.redirect = function(d, g) {
5646
- if (mn.indexOf(g) === -1)
5644
+ var En = [301, 302, 303, 307, 308];
5645
+ P.redirect = function(l, g) {
5646
+ if (En.indexOf(g) === -1)
5647
5647
  throw new RangeError("Invalid status code");
5648
- return new P(null, { status: g, headers: { location: d } });
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 Ve = { 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(d, g) {
5659
+ function be(l, g) {
5660
5660
  return new Promise(function(_, N) {
5661
- var O = new j(d, g);
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();
@@ -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,31 +5702,31 @@ 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))}`;
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 = "", l;
5720
- e === "POST" ? (l = Cr(s, r, i, a.jsonSerializer), typeof l == "string" && (u["Content-Type"] = "application/json")) : f = Nr({
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,
5724
- jsonSerializer: a.jsonSerializer ?? st
5724
+ jsonSerializer: a.jsonSerializer ?? rt
5725
5725
  });
5726
5726
  const h = {
5727
5727
  method: e,
5728
5728
  headers: u,
5729
- body: l,
5729
+ body: d,
5730
5730
  ...a
5731
5731
  };
5732
5732
  let m = n, y = h;
@@ -5736,10 +5736,10 @@ 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
- 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;
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 ln {
5754
5754
  fetch: u,
5755
5755
  method: f,
5756
5756
  fetchOptions: m,
5757
- middleware: l
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, ...l } = this.requestConfig, { url: h } = this;
5765
- i.signal !== void 0 && (l.signal = i.signal);
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 ln {
5775
5775
  operationName: y,
5776
5776
  fetch: a,
5777
5777
  method: c,
5778
- fetchOptions: l,
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;
@@ -5822,9 +5822,9 @@ 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
- const { errors: f, ...l } = (Array.isArray(a), a), h = s.errorPolicy === "ignore" ? l : a;
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,
@@ -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",
@@ -5929,28 +5929,32 @@ 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
- dn(e.document),
5938
+ hn(e.document),
5935
5939
  {},
5936
5940
  typeof window > "u" ? {
5937
5941
  ...e.requestHeaders,
5938
5942
  Cookie: `quote_${e.locale}=${e.quoteId ?? ""}`
5939
5943
  } : e.requestHeaders
5940
- ), l = o;
5941
- if (!((n = l.refreshQuote) != null && n.quote))
5944
+ ), d = o;
5945
+ if (!((n = d.refreshQuote) != null && n.quote))
5942
5946
  throw console.log(
5943
5947
  "userError: ",
5944
- (s = l.refreshQuote) == null ? void 0 : s.userErrors[0].code,
5945
- (r = l.refreshQuote) == null ? void 0 : r.userErrors[0].field,
5946
- (i = l.refreshQuote) == null ? void 0 : i.userErrors[0].message
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: l.refreshQuote.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 }) => !!e.quote.items && e.quote.items.length > 0, Fr = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", kt = xe({
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: Fr,
5971
- hasItems: qr
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, l, h, m, y;
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: ((l = (f = (u = e == null ? void 0 : e.initialContext) == null ? void 0 : u.graphql) == null ? void 0 : f.addItems) == null ? void 0 : l.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: {
@@ -6231,23 +6235,34 @@ const Cr = (e, t, n, s) => {
6231
6235
  // removingGiftCard: {},
6232
6236
  // applyingSettings: {},
6233
6237
  }
6234
- }), fn = Ge(
6238
+ }), yn = ze(
6235
6239
  {}
6236
- ), Jr = () => ({ quoteActor: ze(fn) }), Yr = async (e = {
6240
+ ), Jr = () => {
6241
+ var i;
6242
+ const e = Je(yn), [t, n] = Pe(
6243
+ e.getSnapshot().context.quote.items ?? []
6244
+ ), [s, r] = Pe(
6245
+ ((i = e.getSnapshot().context.quote.items) == null ? void 0 : i.length) ?? 0
6246
+ );
6247
+ return Dt(() => {
6248
+ const o = e.getSnapshot().context.quote.items ?? [];
6249
+ n(o), r(o.length);
6250
+ }, [e]), { quoteActor: e, items: t, itemsCount: s };
6251
+ }, Yr = async (e = {
6237
6252
  inspect: void 0,
6238
6253
  quote: { id: "", locale: "" },
6239
6254
  endpoints: { client: "", server: "" },
6240
6255
  graphql: {}
6241
6256
  }) => typeof window < "u" ? (console.warn(
6242
6257
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
6243
- ), U(kt, {
6258
+ ), U(Ct, {
6244
6259
  inspect: e.inspect,
6245
6260
  input: {
6246
6261
  initialContext: {
6247
6262
  endpoints: e.endpoints
6248
6263
  }
6249
6264
  }
6250
- }).start()) : U(kt, {
6265
+ }).start()) : U(Ct, {
6251
6266
  input: {
6252
6267
  initialContext: {
6253
6268
  endpoints: e.endpoints,
@@ -6261,19 +6276,19 @@ const Cr = (e, t, n, s) => {
6261
6276
  inspect: e.inspect
6262
6277
  }).start();
6263
6278
  function Xr({ actor: e, children: t }) {
6264
- return /* @__PURE__ */ He(fn.Provider, { value: e, children: t });
6279
+ return /* @__PURE__ */ Ge(yn.Provider, { value: e, children: t });
6265
6280
  }
6266
6281
  export {
6267
- Wt as AuthContext,
6282
+ Zt as AuthContext,
6268
6283
  Vr as AuthProvider,
6269
- fn as QuoteContext,
6284
+ yn as QuoteContext,
6270
6285
  Xr as QuoteProvider,
6271
- Kt as ToastContext,
6286
+ en as ToastContext,
6272
6287
  zr as ToastProvider,
6273
- It as authMachine,
6288
+ St as authMachine,
6274
6289
  $r as getAuth,
6275
6290
  Yr as getQuote,
6276
- kt as quoteMachine,
6291
+ Ct as quoteMachine,
6277
6292
  Ns as timerMachine,
6278
6293
  Hr as toastMachine,
6279
6294
  jr as useAuth,