@clicktap/state 0.14.3 → 0.14.5

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,6 +1,6 @@
1
- import { jsx as we } from "react/jsx-runtime";
1
+ import { jsx as xe } from "react/jsx-runtime";
2
2
  import { createContext as be, useContext as Ne, useState as Oe, useEffect as Ce, cloneElement as An } from "react";
3
- function xn(e, t) {
3
+ function wn(e, t) {
4
4
  for (var n = 0; n < t.length; n++) {
5
5
  const s = t[n];
6
6
  if (typeof s != "string" && !Array.isArray(s)) {
@@ -16,7 +16,7 @@ function xn(e, t) {
16
16
  }
17
17
  return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
18
18
  }
19
- function wn() {
19
+ function xn() {
20
20
  if (typeof globalThis < "u")
21
21
  return globalThis;
22
22
  if (typeof self < "u")
@@ -27,7 +27,7 @@ function wn() {
27
27
  return global;
28
28
  }
29
29
  function bn() {
30
- const e = wn();
30
+ const e = xn();
31
31
  if (e.__xstate__)
32
32
  return e.__xstate__;
33
33
  }
@@ -106,13 +106,13 @@ function pt(e, t) {
106
106
  return `${e.sessionId}.${t}`;
107
107
  }
108
108
  let Ln = 0;
109
- function Un(e, t) {
109
+ function Pn(e, t) {
110
110
  const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Set(), o = {}, {
111
111
  clock: a,
112
112
  logger: c
113
113
  } = t, u = {
114
114
  schedule: (f, m, y, v, I = Math.random().toString(36).slice(2)) => {
115
- const x = {
115
+ const w = {
116
116
  source: f,
117
117
  target: m,
118
118
  event: y,
@@ -120,7 +120,7 @@ function Un(e, t) {
120
120
  id: I,
121
121
  startedAt: Date.now()
122
122
  }, R = pt(f, I);
123
- d._snapshot._scheduledEvents[R] = x;
123
+ d._snapshot._scheduledEvents[R] = w;
124
124
  const k = a.setTimeout(() => {
125
125
  delete o[R], delete d._snapshot._scheduledEvents[R], d._relay(f, m, y);
126
126
  }, v);
@@ -191,10 +191,10 @@ function Un(e, t) {
191
191
  source: y,
192
192
  target: v,
193
193
  event: I,
194
- delay: x,
194
+ delay: w,
195
195
  id: R
196
196
  } = f[m];
197
- u.schedule(y, v, I, x, R);
197
+ u.schedule(y, v, I, w, R);
198
198
  }
199
199
  },
200
200
  _clock: a,
@@ -229,9 +229,9 @@ function yt(e) {
229
229
  if (typeof e != "string")
230
230
  return e;
231
231
  const t = et(e);
232
- return Pn(t);
232
+ return Un(t);
233
233
  }
234
- function Pn(e) {
234
+ function Un(e) {
235
235
  if (e.length === 1)
236
236
  return e[0];
237
237
  const t = {};
@@ -333,7 +333,7 @@ class jn {
333
333
  systemId: u,
334
334
  inspect: h
335
335
  } = s;
336
- this.system = o ? o.system : Un(this, {
336
+ this.system = o ? o.system : Pn(this, {
337
337
  clock: r,
338
338
  logger: i
339
339
  }), h && !o && this.system.inspect(gt(h)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (n == null ? void 0 : n.logger) ?? this.system._logger, this.clock = (n == null ? void 0 : n.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = s, this.src = s.src ?? t, this.ref = this, this._actorScope = {
@@ -682,7 +682,7 @@ class jn {
682
682
  return this._snapshot;
683
683
  }
684
684
  }
685
- function P(e, ...[t]) {
685
+ function U(e, ...[t]) {
686
686
  return new jn(e, t);
687
687
  }
688
688
  function $n(e, t, n, s, {
@@ -710,7 +710,7 @@ function zn(e, t, n, s, {
710
710
  }) {
711
711
  const u = typeof o == "string" ? tt(t.machine, o) : o, h = typeof r == "function" ? r(n) : r;
712
712
  let d;
713
- return u && (d = P(u, {
713
+ return u && (d = U(u, {
714
714
  id: h,
715
715
  src: o,
716
716
  parent: e.self,
@@ -1268,17 +1268,17 @@ function Z(e, t, n, s) {
1268
1268
  for (const o of i)
1269
1269
  s.add(o), Z(o, t, n, s);
1270
1270
  for (const o of i)
1271
- Ue(o, e.parent, s, t, n);
1271
+ Pe(o, e.parent, s, t, n);
1272
1272
  } else {
1273
1273
  const i = Kt(e);
1274
1274
  for (const o of i.target)
1275
1275
  s.add(o), i === ((r = e.parent) == null ? void 0 : r.initial) && n.add(e.parent), Z(o, t, n, s);
1276
1276
  for (const o of i.target)
1277
- Ue(o, e.parent, s, t, n);
1277
+ Pe(o, e.parent, s, t, n);
1278
1278
  }
1279
1279
  else if (e.type === "compound") {
1280
1280
  const [i] = e.initial.target;
1281
- J(i) || (s.add(i), n.add(i)), Z(i, t, n, s), Ue(i, e, s, t, n);
1281
+ J(i) || (s.add(i), n.add(i)), Z(i, t, n, s), Pe(i, e, s, t, n);
1282
1282
  } else if (e.type === "parallel")
1283
1283
  for (const i of te(e).filter((o) => !J(o)))
1284
1284
  [...s].some((o) => $(o, i)) || (J(i) || (s.add(i), n.add(i)), Z(i, t, n, s));
@@ -1289,7 +1289,7 @@ function nn(e, t, n, s, r) {
1289
1289
  for (const o of te(i).filter((a) => !J(a)))
1290
1290
  [...e].some((a) => $(a, o)) || (e.add(o), Z(o, t, n, e));
1291
1291
  }
1292
- function Ue(e, t, n, s, r) {
1292
+ function Pe(e, t, n, s, r) {
1293
1293
  nn(n, s, r, le(e, t));
1294
1294
  }
1295
1295
  function ls(e, t, n, s, r, i, o) {
@@ -1353,7 +1353,7 @@ function sn(e, t, n, s, r, i) {
1353
1353
  });
1354
1354
  continue;
1355
1355
  }
1356
- const y = h, [v, I, x] = y.resolve(
1356
+ const y = h, [v, I, w] = y.resolve(
1357
1357
  n,
1358
1358
  a,
1359
1359
  d,
@@ -1362,7 +1362,7 @@ function sn(e, t, n, s, r, i) {
1362
1362
  // this holds all params
1363
1363
  r
1364
1364
  );
1365
- a = v, "retryResolve" in y && (i == null || i.push([y, I])), "execute" in y && (n.self._processingStatus === D.Running ? y.execute(n, I) : n.defer(y.execute.bind(null, n, I))), x && (a = sn(a, t, n, x, r, i));
1365
+ a = v, "retryResolve" in y && (i == null || i.push([y, I])), "execute" in y && (n.self._processingStatus === D.Running ? y.execute(n, I) : n.defer(y.execute.bind(null, n, I))), w && (a = sn(a, t, n, w, r, i));
1366
1366
  }
1367
1367
  return a;
1368
1368
  }
@@ -1375,7 +1375,7 @@ function se(e, t, n, s, r, i) {
1375
1375
  c.retryResolve(n, a, u);
1376
1376
  }), a;
1377
1377
  }
1378
- function Pe(e, t, n, s = []) {
1378
+ function Ue(e, t, n, s = []) {
1379
1379
  let r = e;
1380
1380
  const i = [];
1381
1381
  function o(u, h, d) {
@@ -1645,7 +1645,7 @@ function As(e) {
1645
1645
  restoreSnapshot: (n) => n
1646
1646
  };
1647
1647
  }
1648
- const At = "xstate.promise.resolve", xt = "xstate.promise.reject", me = /* @__PURE__ */ new WeakMap();
1648
+ const At = "xstate.promise.resolve", wt = "xstate.promise.reject", me = /* @__PURE__ */ new WeakMap();
1649
1649
  function V(e) {
1650
1650
  return {
1651
1651
  config: e,
@@ -1663,7 +1663,7 @@ function V(e) {
1663
1663
  input: void 0
1664
1664
  };
1665
1665
  }
1666
- case xt:
1666
+ case wt:
1667
1667
  return {
1668
1668
  ...n,
1669
1669
  status: "error",
@@ -1699,7 +1699,7 @@ function V(e) {
1699
1699
  }));
1700
1700
  }, (a) => {
1701
1701
  s.getSnapshot().status === "active" && (me.delete(s), r._relay(s, s, {
1702
- type: xt,
1702
+ type: wt,
1703
1703
  data: a
1704
1704
  }));
1705
1705
  });
@@ -1714,7 +1714,7 @@ function V(e) {
1714
1714
  restoreSnapshot: (n) => n
1715
1715
  };
1716
1716
  }
1717
- function xs(e, {
1717
+ function ws(e, {
1718
1718
  machine: t,
1719
1719
  context: n
1720
1720
  }, s, r) {
@@ -1727,7 +1727,7 @@ function xs(e, {
1727
1727
  const h = tt(t, o);
1728
1728
  if (!h)
1729
1729
  throw new Error(`Actor logic '${o}' not implemented in machine '${t.id}'`);
1730
- const d = P(h, {
1730
+ const d = U(h, {
1731
1731
  id: a.id,
1732
1732
  parent: e.self,
1733
1733
  syncSnapshot: a.syncSnapshot,
@@ -1741,7 +1741,7 @@ function xs(e, {
1741
1741
  });
1742
1742
  return r[d.id] = d, d;
1743
1743
  } else
1744
- return P(o, {
1744
+ return U(o, {
1745
1745
  id: a.id,
1746
1746
  parent: e.self,
1747
1747
  syncSnapshot: a.syncSnapshot,
@@ -1757,7 +1757,7 @@ function xs(e, {
1757
1757
  }), c;
1758
1758
  };
1759
1759
  }
1760
- function ws(e, t, n, s, {
1760
+ function xs(e, t, n, s, {
1761
1761
  assignment: r
1762
1762
  }) {
1763
1763
  if (!t.context)
@@ -1765,7 +1765,7 @@ function ws(e, t, n, s, {
1765
1765
  const i = {}, o = {
1766
1766
  context: t.context,
1767
1767
  event: n.event,
1768
- spawn: xs(e, t, n.event, i),
1768
+ spawn: ws(e, t, n.event, i),
1769
1769
  self: e.self,
1770
1770
  system: e.system
1771
1771
  };
@@ -1786,10 +1786,10 @@ function ws(e, t, n, s, {
1786
1786
  } : t.children
1787
1787
  })];
1788
1788
  }
1789
- function O(e) {
1789
+ function b(e) {
1790
1790
  function t(n, s) {
1791
1791
  }
1792
- return t.type = "xstate.assign", t.assignment = e, t.resolve = ws, t;
1792
+ return t.type = "xstate.assign", t.assignment = e, t.resolve = xs, t;
1793
1793
  }
1794
1794
  function bs(e, t, n, s, {
1795
1795
  event: r
@@ -1809,7 +1809,7 @@ function Fe(e) {
1809
1809
  }
1810
1810
  return t.type = "xstate.emit", t.event = e, t.resolve = bs, t.execute = Ns, t;
1811
1811
  }
1812
- let wt = /* @__PURE__ */ function(e) {
1812
+ let xt = /* @__PURE__ */ function(e) {
1813
1813
  return e.Parent = "#_parent", e.Internal = "#_internal", e;
1814
1814
  }({});
1815
1815
  function Os(e, t, n, s, {
@@ -1832,7 +1832,7 @@ function Os(e, t, n, s, {
1832
1832
  const f = typeof r == "function" ? r(n, s) : r;
1833
1833
  let m;
1834
1834
  if (typeof f == "string") {
1835
- if (f === wt.Parent ? m = e.self._parent : f === wt.Internal ? m = e.self : f.startsWith("#_") ? m = t.children[f.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(f) ? f : t.children[f], !m)
1835
+ if (f === xt.Parent ? m = e.self._parent : f === xt.Internal ? m = e.self : f.startsWith("#_") ? m = t.children[f.slice(2)] : m = (y = c.deferredActorIds) != null && y.includes(f) ? f : t.children[f], !m)
1836
1836
  throw new Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`);
1837
1837
  } else
1838
1838
  m = f || e.self;
@@ -2107,7 +2107,7 @@ class ut {
2107
2107
  * @param event The received event
2108
2108
  */
2109
2109
  transition(t, n, s) {
2110
- return Pe(t, n, s).snapshot;
2110
+ return Ue(t, n, s).snapshot;
2111
2111
  }
2112
2112
  /**
2113
2113
  * Determines the next state given the current `state` and `event`.
@@ -2117,7 +2117,7 @@ class ut {
2117
2117
  * @param event The received event
2118
2118
  */
2119
2119
  microstep(t, n, s) {
2120
- return Pe(t, n, s).microstates;
2120
+ return Ue(t, n, s).microstates;
2121
2121
  }
2122
2122
  getTransitionData(t, n) {
2123
2123
  return ot(this.root, t.value, t, n) || [];
@@ -2135,7 +2135,7 @@ class ut {
2135
2135
  children: {},
2136
2136
  status: "active"
2137
2137
  }, this);
2138
- return typeof r == "function" ? se(i, n, t, [O(({
2138
+ return typeof r == "function" ? se(i, n, t, [b(({
2139
2139
  spawn: a,
2140
2140
  event: c,
2141
2141
  self: u
@@ -2159,7 +2159,7 @@ class ut {
2159
2159
  // TODO: fix
2160
2160
  }], i, t, s, !0, r), {
2161
2161
  snapshot: a
2162
- } = Pe(o, s, t, r);
2162
+ } = Ue(o, s, t, r);
2163
2163
  return a;
2164
2164
  }
2165
2165
  start(t) {
@@ -2188,7 +2188,7 @@ class ut {
2188
2188
  const u = r[c], h = u.snapshot, d = u.src, f = typeof d == "string" ? tt(this, d) : d;
2189
2189
  if (!f)
2190
2190
  return;
2191
- const m = P(f, {
2191
+ const m = U(f, {
2192
2192
  id: c,
2193
2193
  parent: n.self,
2194
2194
  syncSnapshot: u.syncSnapshot,
@@ -2267,7 +2267,7 @@ function Ls() {
2267
2267
  errors: []
2268
2268
  };
2269
2269
  }
2270
- function Us({
2270
+ function Ps({
2271
2271
  context: e,
2272
2272
  event: t
2273
2273
  }) {
@@ -2279,7 +2279,7 @@ function Us({
2279
2279
  ignoreRefreshToken: !1
2280
2280
  };
2281
2281
  }
2282
- function Ps() {
2282
+ function Us() {
2283
2283
  return {
2284
2284
  ignoreRefreshToken: !0
2285
2285
  };
@@ -2413,13 +2413,13 @@ const $s = V(async ({ input: e }) => {
2413
2413
  input: {}
2414
2414
  },
2415
2415
  actions: {
2416
- addError: O(Ms),
2417
- clearErrors: O(Ls),
2418
- setAccessToken: O(Us),
2419
- setIgnoreRefreshToken: O(Ps),
2420
- setUserContext: O(Fs),
2421
- unsetRefreshToken: O(Bs),
2422
- unsetUserContext: O(js)
2416
+ addError: b(Ms),
2417
+ clearErrors: b(Ls),
2418
+ setAccessToken: b(Ps),
2419
+ setIgnoreRefreshToken: b(Us),
2420
+ setUserContext: b(Fs),
2421
+ unsetRefreshToken: b(Bs),
2422
+ unsetUserContext: b(js)
2423
2423
  },
2424
2424
  actors: {
2425
2425
  authenticate: $s,
@@ -2565,7 +2565,7 @@ const $s = V(async ({ input: e }) => {
2565
2565
  }
2566
2566
  }), an = be(
2567
2567
  {}
2568
- ), fi = () => {
2568
+ ), pi = () => {
2569
2569
  const e = Ne(an), [t, n] = Oe(
2570
2570
  typeof window < "u" && e.getSnapshot().value === "loggedIn"
2571
2571
  );
@@ -2579,19 +2579,19 @@ const $s = V(async ({ input: e }) => {
2579
2579
  s.unsubscribe();
2580
2580
  };
2581
2581
  }, [e]), { authActor: e, isLoggedIn: t };
2582
- }, pi = async (e = "", t = {
2582
+ }, yi = async (e = "", t = {
2583
2583
  inspect: void 0,
2584
2584
  endpoints: { login: "", logout: "", refresh: "", ssrRefresh: "" }
2585
2585
  }) => typeof window < "u" ? (console.warn(
2586
2586
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
2587
- ), P(Ot, {
2587
+ ), U(Ot, {
2588
2588
  inspect: t.inspect,
2589
2589
  input: {
2590
2590
  initialContext: {
2591
2591
  endpoints: t.endpoints
2592
2592
  }
2593
2593
  }
2594
- }).start()) : P(Ot, {
2594
+ }).start()) : U(Ot, {
2595
2595
  input: {
2596
2596
  initialContext: {
2597
2597
  endpoints: t.endpoints,
@@ -2600,24 +2600,37 @@ const $s = V(async ({ input: e }) => {
2600
2600
  },
2601
2601
  inspect: t.inspect
2602
2602
  }).start();
2603
- function yi({ actor: e, children: t }) {
2604
- return /* @__PURE__ */ we(an.Provider, { value: e, children: t });
2603
+ function mi({ actor: e, children: t }) {
2604
+ return /* @__PURE__ */ xe(an.Provider, { value: e, children: t });
2605
2605
  }
2606
2606
  function zs({
2607
2607
  context: e,
2608
2608
  event: t
2609
+ }) {
2610
+ var s;
2611
+ if (t.type !== "CHANGE_STEP")
2612
+ return e;
2613
+ console.log("changeStep steps", e.steps);
2614
+ const n = (s = e.steps) == null ? void 0 : s.find((r) => r.code === t.step);
2615
+ return !n || !n.isAvailable ? e : (console.log("changeStep", n.code), {
2616
+ currentStep: n.code ?? e.currentStep
2617
+ });
2618
+ }
2619
+ function Gs({
2620
+ context: e,
2621
+ event: t
2609
2622
  }) {
2610
2623
  var r, i;
2611
2624
  if (!t.type.includes("xstate.done.actor") || t.output.type !== "SUBMIT_STEP_DATA_SUCCESS")
2612
2625
  return e;
2613
2626
  const s = (i = (r = e.steps) == null ? void 0 : r.find(
2614
- (o) => o.name === e.currentStep
2627
+ (o) => o.code === e.currentStep
2615
2628
  )) == null ? void 0 : i.next;
2616
2629
  return s ? {
2617
2630
  currentStep: s ?? e.currentStep
2618
2631
  } : e;
2619
2632
  }
2620
- function Gs({
2633
+ function Js({
2621
2634
  context: e,
2622
2635
  event: t
2623
2636
  }) {
@@ -2628,26 +2641,26 @@ function Gs({
2628
2641
  quote: { ...e.quote, ...n.output.quote }
2629
2642
  };
2630
2643
  }
2631
- const dt = JSON, Js = (e) => e.toUpperCase(), Ys = (e) => {
2644
+ const dt = JSON, Ys = (e) => e.toUpperCase(), Qs = (e) => {
2632
2645
  const t = {};
2633
2646
  return e.forEach((n, s) => {
2634
2647
  t[s] = n;
2635
2648
  }), t;
2636
- }, Qs = (e, t, n) => e.document ? e : {
2649
+ }, Xs = (e, t, n) => e.document ? e : {
2637
2650
  document: e,
2638
2651
  variables: t,
2639
2652
  requestHeaders: n,
2640
2653
  signal: void 0
2641
- }, Xs = (e, t, n) => e.query ? e : {
2654
+ }, Ws = (e, t, n) => e.query ? e : {
2642
2655
  query: e,
2643
2656
  variables: t,
2644
2657
  requestHeaders: n,
2645
2658
  signal: void 0
2646
- }, Ws = (e, t) => e.documents ? e : {
2659
+ }, Ks = (e, t) => e.documents ? e : {
2647
2660
  documents: e,
2648
2661
  requestHeaders: t,
2649
2662
  signal: void 0
2650
- }, Ks = (e, t, ...n) => {
2663
+ }, Zs = (e, t, ...n) => {
2651
2664
  const [s, r] = n;
2652
2665
  return e.document ? e : {
2653
2666
  url: e,
@@ -2661,20 +2674,20 @@ function ve(e, t) {
2661
2674
  if (!!!e)
2662
2675
  throw new Error(t);
2663
2676
  }
2664
- function Zs(e) {
2677
+ function er(e) {
2665
2678
  return typeof e == "object" && e !== null;
2666
2679
  }
2667
- function er(e, t) {
2680
+ function tr(e, t) {
2668
2681
  if (!!!e)
2669
2682
  throw new Error(
2670
2683
  t ?? "Unexpected invariant triggered."
2671
2684
  );
2672
2685
  }
2673
- const tr = /\r\n|[\n\r]/g;
2686
+ const nr = /\r\n|[\n\r]/g;
2674
2687
  function Xe(e, t) {
2675
2688
  let n = 0, s = 1;
2676
- for (const r of e.body.matchAll(tr)) {
2677
- if (typeof r.index == "number" || er(!1), r.index >= t)
2689
+ for (const r of e.body.matchAll(nr)) {
2690
+ if (typeof r.index == "number" || tr(!1), r.index >= t)
2678
2691
  break;
2679
2692
  n = r.index + r[0].length, s += 1;
2680
2693
  }
@@ -2683,7 +2696,7 @@ function Xe(e, t) {
2683
2696
  column: t + 1 - n
2684
2697
  };
2685
2698
  }
2686
- function nr(e) {
2699
+ function sr(e) {
2687
2700
  return cn(
2688
2701
  e.source,
2689
2702
  Xe(e.source, e.start)
@@ -2716,7 +2729,7 @@ function Ct(e) {
2716
2729
  return t.map(([s, r]) => s.padStart(n) + (r ? " " + r : "")).join(`
2717
2730
  `);
2718
2731
  }
2719
- function sr(e) {
2732
+ function rr(e) {
2720
2733
  const t = e[0];
2721
2734
  return t == null || "kind" in t || "length" in t ? {
2722
2735
  nodes: t,
@@ -2768,7 +2781,7 @@ class lt extends Error {
2768
2781
  */
2769
2782
  constructor(t, ...n) {
2770
2783
  var s, r, i;
2771
- const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = sr(n);
2784
+ const { nodes: o, source: a, positions: c, path: u, originalError: h, extensions: d } = rr(n);
2772
2785
  super(t), this.name = "GraphQLError", this.path = u ?? void 0, this.originalError = h ?? void 0, this.nodes = kt(
2773
2786
  Array.isArray(o) ? o : o ? [o] : void 0
2774
2787
  );
@@ -2776,7 +2789,7 @@ class lt extends Error {
2776
2789
  (s = this.nodes) === null || s === void 0 ? void 0 : s.map((y) => y.loc).filter((y) => y != null)
2777
2790
  );
2778
2791
  this.source = a ?? (f == null || (r = f[0]) === null || r === void 0 ? void 0 : r.source), this.positions = c ?? (f == null ? void 0 : f.map((y) => y.start)), this.locations = c && a ? c.map((y) => Xe(a, y)) : f == null ? void 0 : f.map((y) => Xe(y.source, y.start));
2779
- const m = Zs(
2792
+ const m = er(
2780
2793
  h == null ? void 0 : h.extensions
2781
2794
  ) ? h == null ? void 0 : h.extensions : void 0;
2782
2795
  this.extensions = (i = d ?? m) !== null && i !== void 0 ? i : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
@@ -2818,7 +2831,7 @@ class lt extends Error {
2818
2831
  for (const n of this.nodes)
2819
2832
  n.loc && (t += `
2820
2833
 
2821
- ` + nr(n.loc));
2834
+ ` + sr(n.loc));
2822
2835
  else if (this.source && this.locations)
2823
2836
  for (const n of this.locations)
2824
2837
  t += `
@@ -2836,13 +2849,13 @@ class lt extends Error {
2836
2849
  function kt(e) {
2837
2850
  return e === void 0 || e.length === 0 ? void 0 : e;
2838
2851
  }
2839
- function b(e, t, n) {
2852
+ function N(e, t, n) {
2840
2853
  return new lt(`Syntax Error: ${n}`, {
2841
2854
  source: e,
2842
2855
  positions: [t]
2843
2856
  });
2844
2857
  }
2845
- class rr {
2858
+ class ir {
2846
2859
  /**
2847
2860
  * The character offset at which this Node begins.
2848
2861
  */
@@ -2987,10 +3000,10 @@ const dn = {
2987
3000
  UnionTypeExtension: ["name", "directives", "types"],
2988
3001
  EnumTypeExtension: ["name", "directives", "values"],
2989
3002
  InputObjectTypeExtension: ["name", "directives", "fields"]
2990
- }, ir = new Set(Object.keys(dn));
3003
+ }, or = new Set(Object.keys(dn));
2991
3004
  function Dt(e) {
2992
3005
  const t = e == null ? void 0 : e.kind;
2993
- return typeof t == "string" && ir.has(t);
3006
+ return typeof t == "string" && or.has(t);
2994
3007
  }
2995
3008
  var ee;
2996
3009
  (function(e) {
@@ -3017,15 +3030,15 @@ function ln(e) {
3017
3030
  function hn(e) {
3018
3031
  return ln(e) || e === 95;
3019
3032
  }
3020
- function or(e) {
3033
+ function ar(e) {
3021
3034
  return ln(e) || de(e) || e === 95;
3022
3035
  }
3023
- function ar(e) {
3036
+ function cr(e) {
3024
3037
  var t;
3025
3038
  let n = Number.MAX_SAFE_INTEGER, s = null, r = -1;
3026
3039
  for (let o = 0; o < e.length; ++o) {
3027
3040
  var i;
3028
- const a = e[o], c = cr(a);
3041
+ const a = e[o], c = ur(a);
3029
3042
  c !== a.length && (s = (i = s) !== null && i !== void 0 ? i : o, r = o, o !== 0 && c < n && (n = c));
3030
3043
  }
3031
3044
  return e.map((o, a) => a === 0 ? o : o.slice(n)).slice(
@@ -3033,13 +3046,13 @@ function ar(e) {
3033
3046
  r + 1
3034
3047
  );
3035
3048
  }
3036
- function cr(e) {
3049
+ function ur(e) {
3037
3050
  let t = 0;
3038
3051
  for (; t < e.length && Ke(e.charCodeAt(t)); )
3039
3052
  ++t;
3040
3053
  return t;
3041
3054
  }
3042
- function ur(e, t) {
3055
+ function dr(e, t) {
3043
3056
  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 || Ke(m.charCodeAt(0))), o = n.endsWith('\\"""'), a = e.endsWith('"') && !o, c = e.endsWith("\\"), u = a || c, h = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
3044
3057
  (!r || e.length > 70 || u || i || o);
3045
3058
  let d = "";
@@ -3052,7 +3065,7 @@ var p;
3052
3065
  (function(e) {
3053
3066
  e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
3054
3067
  })(p || (p = {}));
3055
- class dr {
3068
+ class lr {
3056
3069
  /**
3057
3070
  * The previously focused non-ignored token.
3058
3071
  */
@@ -3089,14 +3102,14 @@ class dr {
3089
3102
  if (t.next)
3090
3103
  t = t.next;
3091
3104
  else {
3092
- const n = hr(this, t.end);
3105
+ const n = fr(this, t.end);
3093
3106
  t.next = n, n.prev = t, t = n;
3094
3107
  }
3095
3108
  while (t.kind === p.COMMENT);
3096
3109
  return t;
3097
3110
  }
3098
3111
  }
3099
- function lr(e) {
3112
+ function hr(e) {
3100
3113
  return e === p.BANG || e === p.DOLLAR || e === p.AMP || e === p.PAREN_L || e === p.PAREN_R || e === p.SPREAD || e === p.COLON || e === p.EQUALS || e === p.AT || e === p.BRACKET_L || e === p.BRACKET_R || e === p.BRACE_L || e === p.PIPE || e === p.BRACE_R;
3101
3114
  }
3102
3115
  function re(e) {
@@ -3121,11 +3134,11 @@ function Q(e, t) {
3121
3134
  }
3122
3135
  return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
3123
3136
  }
3124
- function w(e, t, n, s, r) {
3137
+ function x(e, t, n, s, r) {
3125
3138
  const i = e.line, o = 1 + n - e.lineStart;
3126
3139
  return new un(t, n, s, i, o, r);
3127
3140
  }
3128
- function hr(e, t) {
3141
+ function fr(e, t) {
3129
3142
  const n = e.source.body, s = n.length;
3130
3143
  let r = t;
3131
3144
  for (; r < s; ) {
@@ -3144,53 +3157,53 @@ function hr(e, t) {
3144
3157
  n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e.line, e.lineStart = r;
3145
3158
  continue;
3146
3159
  case 35:
3147
- return fr(e, r);
3160
+ return pr(e, r);
3148
3161
  case 33:
3149
- return w(e, p.BANG, r, r + 1);
3162
+ return x(e, p.BANG, r, r + 1);
3150
3163
  case 36:
3151
- return w(e, p.DOLLAR, r, r + 1);
3164
+ return x(e, p.DOLLAR, r, r + 1);
3152
3165
  case 38:
3153
- return w(e, p.AMP, r, r + 1);
3166
+ return x(e, p.AMP, r, r + 1);
3154
3167
  case 40:
3155
- return w(e, p.PAREN_L, r, r + 1);
3168
+ return x(e, p.PAREN_L, r, r + 1);
3156
3169
  case 41:
3157
- return w(e, p.PAREN_R, r, r + 1);
3170
+ return x(e, p.PAREN_R, r, r + 1);
3158
3171
  case 46:
3159
3172
  if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46)
3160
- return w(e, p.SPREAD, r, r + 3);
3173
+ return x(e, p.SPREAD, r, r + 3);
3161
3174
  break;
3162
3175
  case 58:
3163
- return w(e, p.COLON, r, r + 1);
3176
+ return x(e, p.COLON, r, r + 1);
3164
3177
  case 61:
3165
- return w(e, p.EQUALS, r, r + 1);
3178
+ return x(e, p.EQUALS, r, r + 1);
3166
3179
  case 64:
3167
- return w(e, p.AT, r, r + 1);
3180
+ return x(e, p.AT, r, r + 1);
3168
3181
  case 91:
3169
- return w(e, p.BRACKET_L, r, r + 1);
3182
+ return x(e, p.BRACKET_L, r, r + 1);
3170
3183
  case 93:
3171
- return w(e, p.BRACKET_R, r, r + 1);
3184
+ return x(e, p.BRACKET_R, r, r + 1);
3172
3185
  case 123:
3173
- return w(e, p.BRACE_L, r, r + 1);
3186
+ return x(e, p.BRACE_L, r, r + 1);
3174
3187
  case 124:
3175
- return w(e, p.PIPE, r, r + 1);
3188
+ return x(e, p.PIPE, r, r + 1);
3176
3189
  case 125:
3177
- return w(e, p.BRACE_R, r, r + 1);
3190
+ return x(e, p.BRACE_R, r, r + 1);
3178
3191
  case 34:
3179
- return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? vr(e, r) : yr(e, r);
3192
+ return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Tr(e, r) : mr(e, r);
3180
3193
  }
3181
3194
  if (de(i) || i === 45)
3182
- return pr(e, r, i);
3195
+ return yr(e, r, i);
3183
3196
  if (hn(i))
3184
- return Tr(e, r);
3185
- throw b(
3197
+ return _r(e, r);
3198
+ throw N(
3186
3199
  e.source,
3187
3200
  r,
3188
3201
  i === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : re(i) || De(n, r) ? `Unexpected character: ${Q(e, r)}.` : `Invalid character: ${Q(e, r)}.`
3189
3202
  );
3190
3203
  }
3191
- return w(e, p.EOF, s, s);
3204
+ return x(e, p.EOF, s, s);
3192
3205
  }
3193
- function fr(e, t) {
3206
+ function pr(e, t) {
3194
3207
  const n = e.source.body, s = n.length;
3195
3208
  let r = t + 1;
3196
3209
  for (; r < s; ) {
@@ -3204,7 +3217,7 @@ function fr(e, t) {
3204
3217
  else
3205
3218
  break;
3206
3219
  }
3207
- return w(
3220
+ return x(
3208
3221
  e,
3209
3222
  p.COMMENT,
3210
3223
  t,
@@ -3212,12 +3225,12 @@ function fr(e, t) {
3212
3225
  n.slice(t + 1, r)
3213
3226
  );
3214
3227
  }
3215
- function pr(e, t, n) {
3228
+ function yr(e, t, n) {
3216
3229
  const s = e.source.body;
3217
3230
  let r = t, i = n, o = !1;
3218
3231
  if (i === 45 && (i = s.charCodeAt(++r)), i === 48) {
3219
3232
  if (i = s.charCodeAt(++r), de(i))
3220
- throw b(
3233
+ throw N(
3221
3234
  e.source,
3222
3235
  r,
3223
3236
  `Invalid number, unexpected digit after 0: ${Q(
@@ -3228,7 +3241,7 @@ function pr(e, t, n) {
3228
3241
  } else
3229
3242
  r = Be(e, r, i), i = s.charCodeAt(r);
3230
3243
  if (i === 46 && (o = !0, i = s.charCodeAt(++r), r = Be(e, r, i), i = s.charCodeAt(r)), (i === 69 || i === 101) && (o = !0, i = s.charCodeAt(++r), (i === 43 || i === 45) && (i = s.charCodeAt(++r)), r = Be(e, r, i), i = s.charCodeAt(r)), i === 46 || hn(i))
3231
- throw b(
3244
+ throw N(
3232
3245
  e.source,
3233
3246
  r,
3234
3247
  `Invalid number, expected digit but got: ${Q(
@@ -3236,7 +3249,7 @@ function pr(e, t, n) {
3236
3249
  r
3237
3250
  )}.`
3238
3251
  );
3239
- return w(
3252
+ return x(
3240
3253
  e,
3241
3254
  o ? p.FLOAT : p.INT,
3242
3255
  t,
@@ -3246,7 +3259,7 @@ function pr(e, t, n) {
3246
3259
  }
3247
3260
  function Be(e, t, n) {
3248
3261
  if (!de(n))
3249
- throw b(
3262
+ throw N(
3250
3263
  e.source,
3251
3264
  t,
3252
3265
  `Invalid number, expected digit but got: ${Q(
@@ -3260,16 +3273,16 @@ function Be(e, t, n) {
3260
3273
  ++r;
3261
3274
  return r;
3262
3275
  }
3263
- function yr(e, t) {
3276
+ function mr(e, t) {
3264
3277
  const n = e.source.body, s = n.length;
3265
3278
  let r = t + 1, i = r, o = "";
3266
3279
  for (; r < s; ) {
3267
3280
  const a = n.charCodeAt(r);
3268
3281
  if (a === 34)
3269
- return o += n.slice(i, r), w(e, p.STRING, t, r + 1, o);
3282
+ return o += n.slice(i, r), x(e, p.STRING, t, r + 1, o);
3270
3283
  if (a === 92) {
3271
3284
  o += n.slice(i, r);
3272
- const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? mr(e, r) : gr(e, r) : Er(e, r);
3285
+ const c = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? gr(e, r) : Er(e, r) : vr(e, r);
3273
3286
  o += c.value, r += c.size, i = r;
3274
3287
  continue;
3275
3288
  }
@@ -3280,7 +3293,7 @@ function yr(e, t) {
3280
3293
  else if (De(n, r))
3281
3294
  r += 2;
3282
3295
  else
3283
- throw b(
3296
+ throw N(
3284
3297
  e.source,
3285
3298
  r,
3286
3299
  `Invalid character within String: ${Q(
@@ -3289,9 +3302,9 @@ function yr(e, t) {
3289
3302
  )}.`
3290
3303
  );
3291
3304
  }
3292
- throw b(e.source, r, "Unterminated string.");
3305
+ throw N(e.source, r, "Unterminated string.");
3293
3306
  }
3294
- function mr(e, t) {
3307
+ function gr(e, t) {
3295
3308
  const n = e.source.body;
3296
3309
  let s = 0, r = 3;
3297
3310
  for (; r < 12; ) {
@@ -3307,7 +3320,7 @@ function mr(e, t) {
3307
3320
  if (s = s << 4 | ae(i), s < 0)
3308
3321
  break;
3309
3322
  }
3310
- throw b(
3323
+ throw N(
3311
3324
  e.source,
3312
3325
  t,
3313
3326
  `Invalid Unicode escape sequence: "${n.slice(
@@ -3316,7 +3329,7 @@ function mr(e, t) {
3316
3329
  )}".`
3317
3330
  );
3318
3331
  }
3319
- function gr(e, t) {
3332
+ function Er(e, t) {
3320
3333
  const n = e.source.body, s = Rt(n, t + 2);
3321
3334
  if (re(s))
3322
3335
  return {
@@ -3331,7 +3344,7 @@ function gr(e, t) {
3331
3344
  size: 12
3332
3345
  };
3333
3346
  }
3334
- throw b(
3347
+ throw N(
3335
3348
  e.source,
3336
3349
  t,
3337
3350
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
@@ -3343,7 +3356,7 @@ function Rt(e, t) {
3343
3356
  function ae(e) {
3344
3357
  return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
3345
3358
  }
3346
- function Er(e, t) {
3359
+ function vr(e, t) {
3347
3360
  const n = e.source.body;
3348
3361
  switch (n.charCodeAt(t + 1)) {
3349
3362
  case 34:
@@ -3388,7 +3401,7 @@ function Er(e, t) {
3388
3401
  size: 2
3389
3402
  };
3390
3403
  }
3391
- throw b(
3404
+ throw N(
3392
3405
  e.source,
3393
3406
  t,
3394
3407
  `Invalid character escape sequence: "${n.slice(
@@ -3397,7 +3410,7 @@ function Er(e, t) {
3397
3410
  )}".`
3398
3411
  );
3399
3412
  }
3400
- function vr(e, t) {
3413
+ function Tr(e, t) {
3401
3414
  const n = e.source.body, s = n.length;
3402
3415
  let r = e.lineStart, i = t + 3, o = i, a = "";
3403
3416
  const c = [];
@@ -3405,13 +3418,13 @@ function vr(e, t) {
3405
3418
  const u = n.charCodeAt(i);
3406
3419
  if (u === 34 && n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34) {
3407
3420
  a += n.slice(o, i), c.push(a);
3408
- const h = w(
3421
+ const h = x(
3409
3422
  e,
3410
3423
  p.BLOCK_STRING,
3411
3424
  t,
3412
3425
  i + 3,
3413
3426
  // Return a string of the lines joined with U+000A.
3414
- ar(c).join(`
3427
+ cr(c).join(`
3415
3428
  `)
3416
3429
  );
3417
3430
  return e.line += c.length - 1, e.lineStart = r, h;
@@ -3429,7 +3442,7 @@ function vr(e, t) {
3429
3442
  else if (De(n, i))
3430
3443
  i += 2;
3431
3444
  else
3432
- throw b(
3445
+ throw N(
3433
3446
  e.source,
3434
3447
  i,
3435
3448
  `Invalid character within String: ${Q(
@@ -3438,19 +3451,19 @@ function vr(e, t) {
3438
3451
  )}.`
3439
3452
  );
3440
3453
  }
3441
- throw b(e.source, i, "Unterminated string.");
3454
+ throw N(e.source, i, "Unterminated string.");
3442
3455
  }
3443
- function Tr(e, t) {
3456
+ function _r(e, t) {
3444
3457
  const n = e.source.body, s = n.length;
3445
3458
  let r = t + 1;
3446
3459
  for (; r < s; ) {
3447
3460
  const i = n.charCodeAt(r);
3448
- if (or(i))
3461
+ if (ar(i))
3449
3462
  ++r;
3450
3463
  else
3451
3464
  break;
3452
3465
  }
3453
- return w(
3466
+ return x(
3454
3467
  e,
3455
3468
  p.NAME,
3456
3469
  t,
@@ -3458,7 +3471,7 @@ function Tr(e, t) {
3458
3471
  n.slice(t, r)
3459
3472
  );
3460
3473
  }
3461
- const _r = 10, yn = 2;
3474
+ const Sr = 10, yn = 2;
3462
3475
  function ht(e) {
3463
3476
  return Re(e, []);
3464
3477
  }
@@ -3469,31 +3482,31 @@ function Re(e, t) {
3469
3482
  case "function":
3470
3483
  return e.name ? `[function ${e.name}]` : "[function]";
3471
3484
  case "object":
3472
- return Sr(e, t);
3485
+ return Ir(e, t);
3473
3486
  default:
3474
3487
  return String(e);
3475
3488
  }
3476
3489
  }
3477
- function Sr(e, t) {
3490
+ function Ir(e, t) {
3478
3491
  if (e === null)
3479
3492
  return "null";
3480
3493
  if (t.includes(e))
3481
3494
  return "[Circular]";
3482
3495
  const n = [...t, e];
3483
- if (Ir(e)) {
3496
+ if (Ar(e)) {
3484
3497
  const s = e.toJSON();
3485
3498
  if (s !== e)
3486
3499
  return typeof s == "string" ? s : Re(s, n);
3487
3500
  } else if (Array.isArray(e))
3488
3501
  return xr(e, n);
3489
- return Ar(e, n);
3502
+ return wr(e, n);
3490
3503
  }
3491
- function Ir(e) {
3504
+ function Ar(e) {
3492
3505
  return typeof e.toJSON == "function";
3493
3506
  }
3494
- function Ar(e, t) {
3507
+ function wr(e, t) {
3495
3508
  const n = Object.entries(e);
3496
- return n.length === 0 ? "{}" : t.length > yn ? "[" + wr(e) + "]" : "{ " + n.map(
3509
+ return n.length === 0 ? "{}" : t.length > yn ? "[" + br(e) + "]" : "{ " + n.map(
3497
3510
  ([r, i]) => r + ": " + Re(i, t)
3498
3511
  ).join(", ") + " }";
3499
3512
  }
@@ -3502,12 +3515,12 @@ function xr(e, t) {
3502
3515
  return "[]";
3503
3516
  if (t.length > yn)
3504
3517
  return "[Array]";
3505
- const n = Math.min(_r, e.length), s = e.length - n, r = [];
3518
+ const n = Math.min(Sr, e.length), s = e.length - n, r = [];
3506
3519
  for (let i = 0; i < n; ++i)
3507
3520
  r.push(Re(e[i], t));
3508
3521
  return s === 1 ? r.push("... 1 more item") : s > 1 && r.push(`... ${s} more items`), "[" + r.join(", ") + "]";
3509
3522
  }
3510
- function wr(e) {
3523
+ function br(e) {
3511
3524
  const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
3512
3525
  if (t === "Object" && typeof e.constructor == "function") {
3513
3526
  const n = e.constructor.name;
@@ -3516,11 +3529,11 @@ function wr(e) {
3516
3529
  }
3517
3530
  return t;
3518
3531
  }
3519
- const br = globalThis.process && // eslint-disable-next-line no-undef
3520
- process.env.NODE_ENV === "production", Nr = (
3532
+ const Nr = globalThis.process && // eslint-disable-next-line no-undef
3533
+ process.env.NODE_ENV === "production", Or = (
3521
3534
  /* c8 ignore next 6 */
3522
3535
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
3523
- br ? function(t, n) {
3536
+ Nr ? function(t, n) {
3524
3537
  return t instanceof n;
3525
3538
  } : function(t, n) {
3526
3539
  if (t instanceof n)
@@ -3567,16 +3580,16 @@ class mn {
3567
3580
  return "Source";
3568
3581
  }
3569
3582
  }
3570
- function Or(e) {
3571
- return Nr(e, mn);
3583
+ function Cr(e) {
3584
+ return Or(e, mn);
3572
3585
  }
3573
- function Cr(e, t) {
3574
- return new kr(e, t).parseDocument();
3586
+ function kr(e, t) {
3587
+ return new Dr(e, t).parseDocument();
3575
3588
  }
3576
- class kr {
3589
+ class Dr {
3577
3590
  constructor(t, n = {}) {
3578
- const s = Or(t) ? t : new mn(t);
3579
- this._lexer = new dr(s), this._options = n, this._tokenCounter = 0;
3591
+ const s = Cr(t) ? t : new mn(t);
3592
+ this._lexer = new lr(s), this._options = n, this._tokenCounter = 0;
3580
3593
  }
3581
3594
  /**
3582
3595
  * Converts a name lex token into a name parse node.
@@ -3649,7 +3662,7 @@ class kr {
3649
3662
  return this.parseDirectiveDefinition();
3650
3663
  }
3651
3664
  if (t)
3652
- throw b(
3665
+ throw N(
3653
3666
  this._lexer.source,
3654
3667
  this._lexer.token.start,
3655
3668
  "Unexpected description, descriptions are supported only on type definitions."
@@ -3923,7 +3936,7 @@ class kr {
3923
3936
  if (t)
3924
3937
  if (this.expectToken(p.DOLLAR), this._lexer.token.kind === p.NAME) {
3925
3938
  const s = this._lexer.token.value;
3926
- throw b(
3939
+ throw N(
3927
3940
  this._lexer.source,
3928
3941
  n.start,
3929
3942
  `Unexpected variable "$${s}" in constant value.`
@@ -4270,7 +4283,7 @@ class kr {
4270
4283
  */
4271
4284
  parseEnumValueName() {
4272
4285
  if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
4273
- throw b(
4286
+ throw N(
4274
4287
  this._lexer.source,
4275
4288
  this._lexer.token.start,
4276
4289
  `${ge(
@@ -4543,7 +4556,7 @@ class kr {
4543
4556
  * given parsed object.
4544
4557
  */
4545
4558
  node(t, n) {
4546
- return this._options.noLocation !== !0 && (n.loc = new rr(
4559
+ return this._options.noLocation !== !0 && (n.loc = new ir(
4547
4560
  t,
4548
4561
  this._lexer.lastToken,
4549
4562
  this._lexer.source
@@ -4563,7 +4576,7 @@ class kr {
4563
4576
  const n = this._lexer.token;
4564
4577
  if (n.kind === t)
4565
4578
  return this.advanceLexer(), n;
4566
- throw b(
4579
+ throw N(
4567
4580
  this._lexer.source,
4568
4581
  n.start,
4569
4582
  `Expected ${gn(t)}, found ${ge(n)}.`
@@ -4585,7 +4598,7 @@ class kr {
4585
4598
  if (n.kind === p.NAME && n.value === t)
4586
4599
  this.advanceLexer();
4587
4600
  else
4588
- throw b(
4601
+ throw N(
4589
4602
  this._lexer.source,
4590
4603
  n.start,
4591
4604
  `Expected "${t}", found ${ge(n)}.`
@@ -4604,7 +4617,7 @@ class kr {
4604
4617
  */
4605
4618
  unexpected(t) {
4606
4619
  const n = t ?? this._lexer.token;
4607
- return b(
4620
+ return N(
4608
4621
  this._lexer.source,
4609
4622
  n.start,
4610
4623
  `Unexpected ${ge(n)}.`
@@ -4667,7 +4680,7 @@ class kr {
4667
4680
  advanceLexer() {
4668
4681
  const { maxTokens: t } = this._options, n = this._lexer.advance();
4669
4682
  if (t !== void 0 && n.kind !== p.EOF && (++this._tokenCounter, this._tokenCounter > t))
4670
- throw b(
4683
+ throw N(
4671
4684
  this._lexer.source,
4672
4685
  n.start,
4673
4686
  `Document contains more that ${t} tokens. Parsing aborted.`
@@ -4679,16 +4692,16 @@ function ge(e) {
4679
4692
  return gn(e.kind) + (t != null ? ` "${t}"` : "");
4680
4693
  }
4681
4694
  function gn(e) {
4682
- return lr(e) ? `"${e}"` : e;
4695
+ return hr(e) ? `"${e}"` : e;
4683
4696
  }
4684
- function Dr(e) {
4685
- return `"${e.replace(Rr, qr)}"`;
4697
+ function Rr(e) {
4698
+ return `"${e.replace(qr, Mr)}"`;
4686
4699
  }
4687
- const Rr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4688
- function qr(e) {
4689
- return Mr[e.charCodeAt(0)];
4700
+ const qr = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
4701
+ function Mr(e) {
4702
+ return Lr[e.charCodeAt(0)];
4690
4703
  }
4691
- const Mr = [
4704
+ const Lr = [
4692
4705
  "\\u0000",
4693
4706
  "\\u0001",
4694
4707
  "\\u0002",
@@ -4854,17 +4867,17 @@ const Mr = [
4854
4867
  "\\u009D",
4855
4868
  "\\u009E",
4856
4869
  "\\u009F"
4857
- ], Lr = Object.freeze({});
4870
+ ], Pr = Object.freeze({});
4858
4871
  function Ur(e, t, n = dn) {
4859
4872
  const s = /* @__PURE__ */ new Map();
4860
- for (const x of Object.values(T))
4861
- s.set(x, Pr(t, x));
4873
+ for (const w of Object.values(T))
4874
+ s.set(w, Fr(t, w));
4862
4875
  let r, i = Array.isArray(e), o = [e], a = -1, c = [], u = e, h, d;
4863
4876
  const f = [], m = [];
4864
4877
  do {
4865
4878
  a++;
4866
- const x = a === o.length, R = x && c.length !== 0;
4867
- if (x) {
4879
+ const w = a === o.length, R = w && c.length !== 0;
4880
+ if (w) {
4868
4881
  if (h = m.length === 0 ? void 0 : f[f.length - 1], u = d, d = m.pop(), R)
4869
4882
  if (i) {
4870
4883
  u = u.slice();
@@ -4891,15 +4904,15 @@ function Ur(e, t, n = dn) {
4891
4904
  if (!Array.isArray(u)) {
4892
4905
  var y, v;
4893
4906
  Dt(u) || ve(!1, `Invalid AST Node: ${ht(u)}.`);
4894
- const q = x ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (v = s.get(u.kind)) === null || v === void 0 ? void 0 : v.enter;
4895
- if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === Lr)
4907
+ const q = w ? (y = s.get(u.kind)) === null || y === void 0 ? void 0 : y.leave : (v = s.get(u.kind)) === null || v === void 0 ? void 0 : v.enter;
4908
+ if (k = q == null ? void 0 : q.call(t, u, h, d, f, m), k === Pr)
4896
4909
  break;
4897
4910
  if (k === !1) {
4898
- if (!x) {
4911
+ if (!w) {
4899
4912
  f.pop();
4900
4913
  continue;
4901
4914
  }
4902
- } else if (k !== void 0 && (c.push([h, k]), !x))
4915
+ } else if (k !== void 0 && (c.push([h, k]), !w))
4903
4916
  if (Dt(k))
4904
4917
  u = k;
4905
4918
  else {
@@ -4907,7 +4920,7 @@ function Ur(e, t, n = dn) {
4907
4920
  continue;
4908
4921
  }
4909
4922
  }
4910
- if (k === void 0 && R && c.push([h, u]), x)
4923
+ if (k === void 0 && R && c.push([h, u]), w)
4911
4924
  f.pop();
4912
4925
  else {
4913
4926
  var I;
@@ -4922,7 +4935,7 @@ function Ur(e, t, n = dn) {
4922
4935
  } while (r !== void 0);
4923
4936
  return c.length !== 0 ? c[c.length - 1][1] : e;
4924
4937
  }
4925
- function Pr(e, t) {
4938
+ function Fr(e, t) {
4926
4939
  const n = e[t];
4927
4940
  return typeof n == "object" ? n : typeof n == "function" ? {
4928
4941
  enter: n,
@@ -4933,9 +4946,9 @@ function Pr(e, t) {
4933
4946
  };
4934
4947
  }
4935
4948
  function En(e) {
4936
- return Ur(e, Br);
4949
+ return Ur(e, jr);
4937
4950
  }
4938
- const Fr = 80, Br = {
4951
+ const Br = 80, jr = {
4939
4952
  Name: {
4940
4953
  leave: (e) => e.value
4941
4954
  },
@@ -4971,7 +4984,7 @@ const Fr = 80, Br = {
4971
4984
  leave({ alias: e, name: t, arguments: n, directives: s, selectionSet: r }) {
4972
4985
  const i = S("", e, ": ") + t;
4973
4986
  let o = i + S("(", E(n, ", "), ")");
4974
- return o.length > Fr && (o = i + S(`(
4987
+ return o.length > Br && (o = i + S(`(
4975
4988
  `, Te(E(n, `
4976
4989
  `)), `
4977
4990
  )`)), E([o, E(s, " "), r], " ");
@@ -5009,7 +5022,7 @@ const Fr = 80, Br = {
5009
5022
  leave: ({ value: e }) => e
5010
5023
  },
5011
5024
  StringValue: {
5012
- leave: ({ value: e, block: t }) => t ? ur(e) : Dr(e)
5025
+ leave: ({ value: e, block: t }) => t ? dr(e) : Rr(e)
5013
5026
  },
5014
5027
  BooleanValue: {
5015
5028
  leave: ({ value: e }) => e ? "true" : "false"
@@ -5203,7 +5216,7 @@ const Mt = (e) => {
5203
5216
  if (typeof e == "string") {
5204
5217
  let n;
5205
5218
  try {
5206
- const s = Cr(e);
5219
+ const s = kr(e);
5207
5220
  n = Mt(s);
5208
5221
  } catch {
5209
5222
  }
@@ -5225,13 +5238,13 @@ class ce extends Error {
5225
5238
  return ((s = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : s.message) ?? `GraphQL Error (Code: ${t.status})`;
5226
5239
  }
5227
5240
  }
5228
- var jr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5229
- function $r(e) {
5241
+ var $r = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5242
+ function Vr(e) {
5230
5243
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
5231
5244
  }
5232
5245
  var Ze = { exports: {} };
5233
5246
  (function(e, t) {
5234
- var n = typeof self < "u" ? self : jr, s = function() {
5247
+ var n = typeof self < "u" ? self : $r, s = function() {
5235
5248
  function i() {
5236
5249
  this.fetch = !1, this.DOMException = n.DOMException;
5237
5250
  }
@@ -5342,7 +5355,7 @@ var Ze = { exports: {} };
5342
5355
  };
5343
5356
  });
5344
5357
  }
5345
- function x(l) {
5358
+ function w(l) {
5346
5359
  var g = new FileReader(), _ = I(g);
5347
5360
  return g.readAsArrayBuffer(l), _;
5348
5361
  }
@@ -5376,7 +5389,7 @@ var Ze = { exports: {} };
5376
5389
  throw new Error("could not read FormData body as blob");
5377
5390
  return Promise.resolve(new Blob([this._bodyText]));
5378
5391
  }, this.arrayBuffer = function() {
5379
- return this._bodyArrayBuffer ? v(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(x);
5392
+ return this._bodyArrayBuffer ? v(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(w);
5380
5393
  }), this.text = function() {
5381
5394
  var l = v(this);
5382
5395
  if (l)
@@ -5419,41 +5432,41 @@ var Ze = { exports: {} };
5419
5432
  var g = new FormData();
5420
5433
  return l.trim().split("&").forEach(function(_) {
5421
5434
  if (_) {
5422
- var C = _.split("="), N = C.shift().replace(/\+/g, " "), A = C.join("=").replace(/\+/g, " ");
5423
- g.append(decodeURIComponent(N), decodeURIComponent(A));
5435
+ var C = _.split("="), O = C.shift().replace(/\+/g, " "), A = C.join("=").replace(/\+/g, " ");
5436
+ g.append(decodeURIComponent(O), decodeURIComponent(A));
5424
5437
  }
5425
5438
  }), g;
5426
5439
  }
5427
5440
  function pe(l) {
5428
5441
  var g = new y(), _ = l.replace(/\r?\n[\t ]+/g, " ");
5429
5442
  return _.split(/\r?\n/).forEach(function(C) {
5430
- var N = C.split(":"), A = N.shift().trim();
5443
+ var O = C.split(":"), A = O.shift().trim();
5431
5444
  if (A) {
5432
- var ye = N.join(":").trim();
5445
+ var ye = O.join(":").trim();
5433
5446
  g.append(A, ye);
5434
5447
  }
5435
5448
  }), g;
5436
5449
  }
5437
5450
  F.call(L.prototype);
5438
- function U(l, g) {
5451
+ function P(l, g) {
5439
5452
  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);
5440
5453
  }
5441
- F.call(U.prototype), U.prototype.clone = function() {
5442
- return new U(this._bodyInit, {
5454
+ F.call(P.prototype), P.prototype.clone = function() {
5455
+ return new P(this._bodyInit, {
5443
5456
  status: this.status,
5444
5457
  statusText: this.statusText,
5445
5458
  headers: new y(this.headers),
5446
5459
  url: this.url
5447
5460
  });
5448
- }, U.error = function() {
5449
- var l = new U(null, { status: 0, statusText: "" });
5461
+ }, P.error = function() {
5462
+ var l = new P(null, { status: 0, statusText: "" });
5450
5463
  return l.type = "error", l;
5451
5464
  };
5452
5465
  var In = [301, 302, 303, 307, 308];
5453
- U.redirect = function(l, g) {
5466
+ P.redirect = function(l, g) {
5454
5467
  if (In.indexOf(g) === -1)
5455
5468
  throw new RangeError("Invalid status code");
5456
- return new U(null, { status: g, headers: { location: l } });
5469
+ return new P(null, { status: g, headers: { location: l } });
5457
5470
  }, o.DOMException = i.DOMException;
5458
5471
  try {
5459
5472
  new o.DOMException();
@@ -5466,8 +5479,8 @@ var Ze = { exports: {} };
5466
5479
  }
5467
5480
  function Me(l, g) {
5468
5481
  return new Promise(function(_, C) {
5469
- var N = new L(l, g);
5470
- if (N.signal && N.signal.aborted)
5482
+ var O = new L(l, g);
5483
+ if (O.signal && O.signal.aborted)
5471
5484
  return C(new o.DOMException("Aborted", "AbortError"));
5472
5485
  var A = new XMLHttpRequest();
5473
5486
  function ye() {
@@ -5481,36 +5494,36 @@ var Ze = { exports: {} };
5481
5494
  };
5482
5495
  ie.url = "responseURL" in A ? A.responseURL : ie.headers.get("X-Request-URL");
5483
5496
  var Le = "response" in A ? A.response : A.responseText;
5484
- _(new U(Le, ie));
5497
+ _(new P(Le, ie));
5485
5498
  }, A.onerror = function() {
5486
5499
  C(new TypeError("Network request failed"));
5487
5500
  }, A.ontimeout = function() {
5488
5501
  C(new TypeError("Network request failed"));
5489
5502
  }, A.onabort = function() {
5490
5503
  C(new o.DOMException("Aborted", "AbortError"));
5491
- }, A.open(N.method, N.url, !0), N.credentials === "include" ? A.withCredentials = !0 : N.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), N.headers.forEach(function(ie, Le) {
5504
+ }, A.open(O.method, O.url, !0), O.credentials === "include" ? A.withCredentials = !0 : O.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && a.blob && (A.responseType = "blob"), O.headers.forEach(function(ie, Le) {
5492
5505
  A.setRequestHeader(Le, ie);
5493
- }), N.signal && (N.signal.addEventListener("abort", ye), A.onreadystatechange = function() {
5494
- A.readyState === 4 && N.signal.removeEventListener("abort", ye);
5495
- }), A.send(typeof N._bodyInit > "u" ? null : N._bodyInit);
5506
+ }), O.signal && (O.signal.addEventListener("abort", ye), A.onreadystatechange = function() {
5507
+ A.readyState === 4 && O.signal.removeEventListener("abort", ye);
5508
+ }), A.send(typeof O._bodyInit > "u" ? null : O._bodyInit);
5496
5509
  });
5497
5510
  }
5498
- return Me.polyfill = !0, i.fetch || (i.fetch = Me, i.Headers = y, i.Request = L, i.Response = U), o.Headers = y, o.Request = L, o.Response = U, o.fetch = Me, Object.defineProperty(o, "__esModule", { value: !0 }), o;
5511
+ return Me.polyfill = !0, i.fetch || (i.fetch = Me, i.Headers = y, i.Request = L, i.Response = P), o.Headers = y, o.Request = L, o.Response = P, o.fetch = Me, Object.defineProperty(o, "__esModule", { value: !0 }), o;
5499
5512
  })({});
5500
5513
  })(s), s.fetch.ponyfill = !0, delete s.fetch.polyfill;
5501
5514
  var r = s;
5502
5515
  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;
5503
5516
  })(Ze, Ze.exports);
5504
- var xe = Ze.exports;
5505
- const _e = /* @__PURE__ */ $r(xe), Vr = /* @__PURE__ */ xn({
5517
+ var we = Ze.exports;
5518
+ const _e = /* @__PURE__ */ Vr(we), Hr = /* @__PURE__ */ wn({
5506
5519
  __proto__: null,
5507
5520
  default: _e
5508
- }, [xe]), W = (e) => {
5521
+ }, [we]), W = (e) => {
5509
5522
  let t = {};
5510
- return e && (typeof Headers < "u" && e instanceof Headers || Vr && xe.Headers && e instanceof xe.Headers ? t = Ys(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
5523
+ return e && (typeof Headers < "u" && e instanceof Headers || Hr && we.Headers && e instanceof we.Headers ? t = Qs(e) : Array.isArray(e) ? e.forEach(([n, s]) => {
5511
5524
  n && s !== void 0 && (t[n] = s);
5512
5525
  }) : t = e), t;
5513
- }, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), Hr = (e) => {
5526
+ }, Lt = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), zr = (e) => {
5514
5527
  if (!Array.isArray(e.query)) {
5515
5528
  const s = e, r = [`query=${encodeURIComponent(Lt(s.query))}`];
5516
5529
  return e.variables && r.push(`variables=${encodeURIComponent(s.jsonSerializer.stringify(s.variables))}`), s.operationName && r.push(`operationName=${encodeURIComponent(s.operationName)}`), r.join("&");
@@ -5522,10 +5535,10 @@ const _e = /* @__PURE__ */ $r(xe), Vr = /* @__PURE__ */ xn({
5522
5535
  variables: t.variables ? t.jsonSerializer.stringify(t.variables[i]) : void 0
5523
5536
  }), s), []);
5524
5537
  return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
5525
- }, zr = (e) => async (t) => {
5538
+ }, Gr = (e) => async (t) => {
5526
5539
  const { url: n, query: s, variables: r, operationName: i, fetch: o, fetchOptions: a, middleware: c } = t, u = { ...t.headers };
5527
5540
  let h = "", d;
5528
- e === "POST" ? (d = Gr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = Hr({
5541
+ e === "POST" ? (d = Jr(s, r, i, a.jsonSerializer), typeof d == "string" && (u["Content-Type"] = "application/json")) : h = zr({
5529
5542
  query: s,
5530
5543
  variables: r,
5531
5544
  operationName: i,
@@ -5539,15 +5552,15 @@ const _e = /* @__PURE__ */ $r(xe), Vr = /* @__PURE__ */ xn({
5539
5552
  };
5540
5553
  let m = n, y = f;
5541
5554
  if (c) {
5542
- const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: I, ...x } = v;
5543
- m = I, y = x;
5555
+ const v = await Promise.resolve(c({ ...f, url: n, operationName: i, variables: r })), { url: I, ...w } = v;
5556
+ m = I, y = w;
5544
5557
  }
5545
5558
  return h && (m = `${m}?${h}`), await o(m, y);
5546
5559
  };
5547
5560
  class vn {
5548
5561
  constructor(t, n = {}) {
5549
5562
  this.url = t, this.requestConfig = n, this.rawRequest = async (...s) => {
5550
- const [r, i, o] = s, a = Xs(r, i, o), { headers: c, fetch: u = _e, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
5563
+ const [r, i, o] = s, a = Ws(r, i, o), { headers: c, fetch: u = _e, method: h = "POST", requestMiddleware: d, responseMiddleware: f, ...m } = this.requestConfig, { url: y } = this;
5551
5564
  a.signal !== void 0 && (m.signal = a.signal);
5552
5565
  const { operationName: v } = je(a.query);
5553
5566
  return $e({
@@ -5569,7 +5582,7 @@ class vn {
5569
5582
  };
5570
5583
  }
5571
5584
  async request(t, ...n) {
5572
- const [s, r] = n, i = Qs(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
5585
+ const [s, r] = n, i = Xs(t, s, r), { headers: o, fetch: a = _e, method: c = "POST", requestMiddleware: u, responseMiddleware: h, ...d } = this.requestConfig, { url: f } = this;
5573
5586
  i.signal !== void 0 && (d.signal = i.signal);
5574
5587
  const { query: m, operationName: y } = je(i.document);
5575
5588
  return $e({
@@ -5591,7 +5604,7 @@ class vn {
5591
5604
  }
5592
5605
  // prettier-ignore
5593
5606
  batchRequests(t, n) {
5594
- const s = Ws(t, n), { headers: r, ...i } = this.requestConfig;
5607
+ const s = Ks(t, n), { headers: r, ...i } = this.requestConfig;
5595
5608
  s.signal !== void 0 && (i.signal = s.signal);
5596
5609
  const o = s.documents.map(({ document: c }) => je(c).query), a = s.documents.map(({ variables: c }) => c);
5597
5610
  return $e({
@@ -5630,7 +5643,7 @@ class vn {
5630
5643
  }
5631
5644
  }
5632
5645
  const $e = async (e) => {
5633
- const { query: t, variables: n, fetchOptions: s } = e, r = zr(Js(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Jr(o, s.jsonSerializer ?? dt), c = Array.isArray(a) ? !a.some(({ data: h }) => !h) : !!a.data, u = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || s.errorPolicy === "all" || s.errorPolicy === "ignore";
5646
+ const { query: t, variables: n, fetchOptions: s } = e, r = Gr(Ys(e.method ?? "post")), i = Array.isArray(e.query), o = await r(e), a = await Yr(o, s.jsonSerializer ?? dt), c = Array.isArray(a) ? !a.some(({ data: h }) => !h) : !!a.data, u = Array.isArray(a) || !a.errors || Array.isArray(a.errors) && !a.errors.length || s.errorPolicy === "all" || s.errorPolicy === "ignore";
5634
5647
  if (o.ok && u && c) {
5635
5648
  const { errors: h, ...d } = (Array.isArray(a), a), f = s.errorPolicy === "ignore" ? d : a;
5636
5649
  return {
@@ -5650,12 +5663,12 @@ const $e = async (e) => {
5650
5663
  }
5651
5664
  };
5652
5665
  async function qe(e, t, ...n) {
5653
- const s = Ks(e, t, ...n);
5666
+ const s = Zs(e, t, ...n);
5654
5667
  return new vn(s.url).request({
5655
5668
  ...s
5656
5669
  });
5657
5670
  }
5658
- const Gr = (e, t, n, s) => {
5671
+ const Jr = (e, t, n, s) => {
5659
5672
  const r = s ?? dt;
5660
5673
  if (!Array.isArray(e))
5661
5674
  return r.stringify({ query: e, variables: t, operationName: n });
@@ -5663,12 +5676,12 @@ const Gr = (e, t, n, s) => {
5663
5676
  throw new Error("Cannot create request body with given variable type, array expected");
5664
5677
  const i = e.reduce((o, a, c) => (o.push({ query: a, variables: t ? t[c] : void 0 }), o), []);
5665
5678
  return r.stringify(i);
5666
- }, Jr = async (e, t) => {
5679
+ }, Yr = async (e, t) => {
5667
5680
  let n;
5668
5681
  return e.headers.forEach((s, r) => {
5669
5682
  r.toLowerCase() === "content-type" && (n = s);
5670
5683
  }), n && (n.toLowerCase().startsWith("application/json") || n.toLowerCase().startsWith("application/graphql+json") || n.toLowerCase().startsWith("application/graphql-response+json")) ? t.parse(await e.text()) : e.text();
5671
- }, Ve = (e) => typeof e == "function" ? e() : e, Yr = V(async ({ input: e }) => {
5684
+ }, Ve = (e) => typeof e == "function" ? e() : e, Qr = V(async ({ input: e }) => {
5672
5685
  var t;
5673
5686
  if (!e.endpoint || e.endpoint === "")
5674
5687
  throw new Error("No endpoint provided.");
@@ -5700,18 +5713,19 @@ const Gr = (e, t, n, s) => {
5700
5713
  } catch {
5701
5714
  throw console.log("Request to add submit step data failed."), new Error("Request to add submit step data failed.");
5702
5715
  }
5703
- }), Qr = ({ context: e }) => Object.keys(e.quote).length > 0, Ut = he({
5716
+ }), Xr = ({ context: e }) => Object.keys(e.quote).length > 0, Pt = he({
5704
5717
  types: {
5705
5718
  context: {},
5706
5719
  events: {},
5707
5720
  input: {}
5708
5721
  },
5709
5722
  actions: {
5710
- nextStep: O(zs),
5711
- updateQuote: O(Gs)
5723
+ changeStep: b(zs),
5724
+ nextStep: b(Gs),
5725
+ updateQuote: b(Js)
5712
5726
  },
5713
- actors: { submitStepData: Yr },
5714
- guards: { quoteExists: Qr }
5727
+ actors: { submitStepData: Qr },
5728
+ guards: { quoteExists: Xr }
5715
5729
  }).createMachine({
5716
5730
  /** @todo do we need to add the view to the id? (e.g. checkout_en-us) */
5717
5731
  id: "checkout",
@@ -5719,23 +5733,23 @@ const Gr = (e, t, n, s) => {
5719
5733
  context: ({ input: e }) => {
5720
5734
  var t, n, s, r, i, o, a, c, u, h, d;
5721
5735
  return {
5722
- currentStep: (t = e == null ? void 0 : e.initialContext) != null && t.isLoggedIn ? "shipping_address" : "contact_information",
5736
+ currentStep: ((t = e == null ? void 0 : e.initialContext) == null ? void 0 : t.currentStep) ?? "",
5723
5737
  errors: [],
5724
5738
  isLoggedIn: ((n = e == null ? void 0 : e.initialContext) == null ? void 0 : n.isLoggedIn) ?? !1,
5725
5739
  // sync with auth machine
5726
5740
  steps: ((s = e == null ? void 0 : e.initialContext) == null ? void 0 : s.steps) ?? [
5727
- { name: "contact_information", prev: null, next: "shipping_address" },
5728
- {
5729
- name: "shipping_address",
5730
- prev: "contact_information",
5731
- next: "payment_method"
5732
- },
5733
- {
5734
- name: "payment_method",
5735
- prev: "shipping_address",
5736
- next: "shipping_method"
5737
- },
5738
- { name: "shipping_method", prev: "payment_method", next: null }
5741
+ // { name: 'contact_information', prev: null, next: 'shipping_address' },
5742
+ // {
5743
+ // name: 'shipping_address',
5744
+ // prev: 'contact_information',
5745
+ // next: 'payment_method',
5746
+ // },
5747
+ // {
5748
+ // name: 'payment_method',
5749
+ // prev: 'shipping_address',
5750
+ // next: 'shipping_method',
5751
+ // },
5752
+ // { name: 'shipping_method', prev: 'payment_method', next: null },
5739
5753
  // 'createAccount',
5740
5754
  // 'shippingAddress',
5741
5755
  // 'paymentMethod',
@@ -5817,7 +5831,12 @@ const Gr = (e, t, n, s) => {
5817
5831
  }
5818
5832
  }
5819
5833
  },
5820
- changingStep: {}
5834
+ changingStep: {
5835
+ always: {
5836
+ actions: ["changeStep"],
5837
+ target: "showStep"
5838
+ }
5839
+ }
5821
5840
  // syncIsLoggedIn: {},
5822
5841
  // syncQuote: {},
5823
5842
  // createAccount: {
@@ -5847,7 +5866,7 @@ const Gr = (e, t, n, s) => {
5847
5866
  // SYNC_IS_LOGGED_IN: '.syncIsLoggedIn',
5848
5867
  // SYNC_QUOTE: '.syncQuote',
5849
5868
  // },
5850
- }), Tn = be({}), mi = () => {
5869
+ }), Tn = be({}), gi = () => {
5851
5870
  const e = Ne(Tn);
5852
5871
  if (!e || !e.getSnapshot)
5853
5872
  throw new Error("checkoutActor is not properly initialized");
@@ -5872,7 +5891,7 @@ const Gr = (e, t, n, s) => {
5872
5891
  checkoutActor: e,
5873
5892
  currentStep: s
5874
5893
  };
5875
- }, gi = async (e = {
5894
+ }, Ei = async (e = {
5876
5895
  inspect: void 0,
5877
5896
  currentStep: "",
5878
5897
  steps: [],
@@ -5881,14 +5900,14 @@ const Gr = (e, t, n, s) => {
5881
5900
  graphql: {}
5882
5901
  }) => typeof window < "u" ? (console.warn(
5883
5902
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
5884
- ), P(Ut, {
5903
+ ), U(Pt, {
5885
5904
  inspect: e.inspect,
5886
5905
  input: {
5887
5906
  initialContext: {
5888
5907
  endpoints: e.endpoints
5889
5908
  }
5890
5909
  }
5891
- }).start()) : P(Ut, {
5910
+ }).start()) : U(Pt, {
5892
5911
  input: {
5893
5912
  initialContext: {
5894
5913
  currentStep: e.currentStep,
@@ -5902,11 +5921,11 @@ const Gr = (e, t, n, s) => {
5902
5921
  },
5903
5922
  inspect: e.inspect
5904
5923
  }).start();
5905
- function Ei({ actor: e, children: t }) {
5906
- return /* @__PURE__ */ we(Tn.Provider, { value: e, children: t });
5924
+ function vi({ actor: e, children: t }) {
5925
+ return /* @__PURE__ */ xe(Tn.Provider, { value: e, children: t });
5907
5926
  }
5908
- let Xr = (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), "");
5909
- const Wr = he({
5927
+ let Wr = (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), "");
5928
+ const Kr = he({
5910
5929
  actors: {
5911
5930
  tick: As(
5912
5931
  ({ sendBack: e, input: t }) => {
@@ -5973,7 +5992,7 @@ const Wr = he({
5973
5992
  ],
5974
5993
  on: {
5975
5994
  TICK: {
5976
- actions: O(({ context: e, event: t }) => t.type !== "TICK" ? e : {
5995
+ actions: b(({ context: e, event: t }) => t.type !== "TICK" ? e : {
5977
5996
  elapsed: e.elapsed + e.interval
5978
5997
  })
5979
5998
  },
@@ -5984,9 +6003,9 @@ const Wr = he({
5984
6003
  type: "final"
5985
6004
  }
5986
6005
  }
5987
- }), vi = he({
6006
+ }), Ti = he({
5988
6007
  actors: {
5989
- timer: Wr
6008
+ timer: Kr
5990
6009
  },
5991
6010
  types: {
5992
6011
  context: {},
@@ -5994,10 +6013,10 @@ const Wr = he({
5994
6013
  input: {}
5995
6014
  },
5996
6015
  actions: {
5997
- addItem: O(({ context: e, event: t }) => {
6016
+ addItem: b(({ context: e, event: t }) => {
5998
6017
  if (t.type !== "ADD_ITEM")
5999
6018
  return e;
6000
- const n = `notification-${Xr()}`, s = t.duration ?? e.duration, r = An(t.item, {
6019
+ const n = `notification-${Wr()}`, s = t.duration ?? e.duration, r = An(t.item, {
6001
6020
  duration: s,
6002
6021
  id: n,
6003
6022
  key: t.item.key ?? n,
@@ -6012,7 +6031,7 @@ const Wr = he({
6012
6031
  activeItem: n
6013
6032
  };
6014
6033
  }),
6015
- removeItem: O(({ context: e, event: t }) => {
6034
+ removeItem: b(({ context: e, event: t }) => {
6016
6035
  if (t.type !== "REMOVE_ITEM" && t.type !== "xstate.done.actor.timer")
6017
6036
  return e;
6018
6037
  const n = e.items;
@@ -6109,7 +6128,7 @@ const Wr = he({
6109
6128
  }
6110
6129
  }), _n = be(
6111
6130
  {}
6112
- ), Ti = () => {
6131
+ ), _i = () => {
6113
6132
  const e = Ne(_n);
6114
6133
  if (!e || !e.getSnapshot)
6115
6134
  throw new Error("toastActor is not properly initialized");
@@ -6130,10 +6149,10 @@ const Wr = he({
6130
6149
  };
6131
6150
  }, [e]), { toastActor: e };
6132
6151
  };
6133
- function _i({ children: e, actor: t }) {
6134
- return /* @__PURE__ */ we(_n.Provider, { value: t, children: e });
6152
+ function Si({ children: e, actor: t }) {
6153
+ return /* @__PURE__ */ xe(_n.Provider, { value: t, children: e });
6135
6154
  }
6136
- function Kr({
6155
+ function Zr({
6137
6156
  context: e,
6138
6157
  event: t
6139
6158
  }) {
@@ -6145,7 +6164,7 @@ function Kr({
6145
6164
  itemsAdded: n.output.itemsAdded
6146
6165
  };
6147
6166
  }
6148
- function Zr({
6167
+ function ei({
6149
6168
  event: e
6150
6169
  }) {
6151
6170
  if (!e.type.includes("xstate.done.actor"))
@@ -6156,7 +6175,7 @@ function Zr({
6156
6175
  itemsAdded: t.output.itemsAdded
6157
6176
  };
6158
6177
  }
6159
- function ei({
6178
+ function ti({
6160
6179
  event: e
6161
6180
  }) {
6162
6181
  if (!e.type.includes("xstate.done.actor"))
@@ -6167,7 +6186,7 @@ function ei({
6167
6186
  itemsRemoved: t.output.itemsRemoved
6168
6187
  };
6169
6188
  }
6170
- function ti({
6189
+ function ni({
6171
6190
  event: e
6172
6191
  }) {
6173
6192
  if (!e.type.includes("xstate.done.actor"))
@@ -6184,7 +6203,7 @@ function ti({
6184
6203
  itemsUpdated: t.output.itemsUpdated
6185
6204
  };
6186
6205
  }
6187
- function ni({
6206
+ function si({
6188
6207
  context: e,
6189
6208
  event: t
6190
6209
  }) {
@@ -6196,7 +6215,7 @@ function ni({
6196
6215
  itemsRemoved: n.output.itemsRemoved
6197
6216
  };
6198
6217
  }
6199
- function si({
6218
+ function ri({
6200
6219
  context: e,
6201
6220
  event: t
6202
6221
  }) {
@@ -6207,7 +6226,7 @@ function si({
6207
6226
  quote: { ...e.quote, ...n.output.quote }
6208
6227
  };
6209
6228
  }
6210
- function ri({
6229
+ function ii({
6211
6230
  context: e,
6212
6231
  event: t
6213
6232
  }) {
@@ -6219,7 +6238,7 @@ function ri({
6219
6238
  itemsUpdated: n.output.itemsUpdated
6220
6239
  };
6221
6240
  }
6222
- const ii = V(
6241
+ const oi = V(
6223
6242
  async ({ input: e }) => {
6224
6243
  var t;
6225
6244
  if (!e.endpoint || e.endpoint === "")
@@ -6248,7 +6267,7 @@ const ii = V(
6248
6267
  throw new Error("Request to add item(s) failed.");
6249
6268
  }
6250
6269
  }
6251
- ), oi = V(async ({ input: e }) => {
6270
+ ), ai = V(async ({ input: e }) => {
6252
6271
  var t;
6253
6272
  if (!e.endpoint || e.endpoint === "")
6254
6273
  throw new Error("No endpoint provided.");
@@ -6272,7 +6291,7 @@ const ii = V(
6272
6291
  } catch {
6273
6292
  throw new Error("Request to remove item(s) failed.");
6274
6293
  }
6275
- }), He = typeof window > "u", ai = V(
6294
+ }), He = typeof window > "u", ci = V(
6276
6295
  async ({ input: e }) => {
6277
6296
  var n, s, r, i;
6278
6297
  if (!e.endpoint)
@@ -6314,7 +6333,7 @@ const ii = V(
6314
6333
  throw console.log("refresh error", o), new Error("Request to add item(s) failed.");
6315
6334
  }
6316
6335
  }
6317
- ), ci = V(async ({ input: e }) => {
6336
+ ), ui = V(async ({ input: e }) => {
6318
6337
  var t;
6319
6338
  if (!e.endpoint || e.endpoint === "")
6320
6339
  throw new Error("No endpoint provided.");
@@ -6341,7 +6360,7 @@ const ii = V(
6341
6360
  } catch {
6342
6361
  throw new Error("Request to add item(s) failed.");
6343
6362
  }
6344
- }), ui = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", di = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Pt = he({
6363
+ }), di = ({ context: e }) => typeof window > "u" && e.quote.id !== "" || typeof window < "u", li = ({ context: e }) => !!e.quote.items && e.quote.items.length > 0, Ut = he({
6345
6364
  types: {
6346
6365
  context: {},
6347
6366
  emitted: {},
@@ -6349,30 +6368,30 @@ const ii = V(
6349
6368
  input: {}
6350
6369
  },
6351
6370
  actions: {
6352
- addItems: O(Kr),
6353
- notifyAddItems: Fe(Zr),
6354
- notifyRemoveItems: Fe(ei),
6355
- notifyUpdateItems: Fe(ti),
6356
- removeItems: O(ni),
6357
- refresh: O(si),
6358
- updateItems: O(ri)
6371
+ addItems: b(Zr),
6372
+ notifyAddItems: Fe(ei),
6373
+ notifyRemoveItems: Fe(ti),
6374
+ notifyUpdateItems: Fe(ni),
6375
+ removeItems: b(si),
6376
+ refresh: b(ri),
6377
+ updateItems: b(ii)
6359
6378
  },
6360
6379
  actors: {
6361
- addItems: ii,
6362
- removeItems: oi,
6363
- refresh: ai,
6364
- updateItems: ci
6380
+ addItems: oi,
6381
+ removeItems: ai,
6382
+ refresh: ci,
6383
+ updateItems: ui
6365
6384
  },
6366
6385
  guards: {
6367
- canRefresh: ui,
6368
- hasItems: di
6386
+ canRefresh: di,
6387
+ hasItems: li
6369
6388
  }
6370
6389
  }).createMachine({
6371
6390
  /** @todo do we need to add the view to the id? (e.g. quote_en-us) */
6372
6391
  id: "quote",
6373
6392
  initial: "initializing",
6374
6393
  context: ({ input: e }) => {
6375
- var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, I, x, R, k, q, F, H, z, L, fe, pe;
6394
+ var t, n, s, r, i, o, a, c, u, h, d, f, m, y, v, I, w, R, k, q, F, H, z, L, fe, pe;
6376
6395
  return {
6377
6396
  quote: {
6378
6397
  id: "",
@@ -6394,9 +6413,9 @@ const ii = V(
6394
6413
  },
6395
6414
  totals: {
6396
6415
  discount: 0,
6397
- tax: 0,
6398
- shipping: 0,
6399
- shippingTax: 0,
6416
+ taxAmount: 0,
6417
+ shippingAmount: 0,
6418
+ shippingTaxAmount: 0,
6400
6419
  subtotal: 0,
6401
6420
  grandTotal: 0
6402
6421
  },
@@ -6443,7 +6462,7 @@ const ii = V(
6443
6462
  requestHeaders: ((y = (m = (f = e == null ? void 0 : e.initialContext) == null ? void 0 : f.graphql) == null ? void 0 : m.addItems) == null ? void 0 : y.requestHeaders) ?? void 0
6444
6463
  },
6445
6464
  removeItems: {
6446
- document: ((x = (I = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : I.removeItems) == null ? void 0 : x.document) ?? "",
6465
+ document: ((w = (I = (v = e == null ? void 0 : e.initialContext) == null ? void 0 : v.graphql) == null ? void 0 : I.removeItems) == null ? void 0 : w.document) ?? "",
6447
6466
  requestHeaders: ((q = (k = (R = e == null ? void 0 : e.initialContext) == null ? void 0 : R.graphql) == null ? void 0 : k.removeItems) == null ? void 0 : q.requestHeaders) ?? void 0
6448
6467
  },
6449
6468
  updateItems: {
@@ -6720,7 +6739,7 @@ const ii = V(
6720
6739
  }
6721
6740
  }), Sn = be(
6722
6741
  {}
6723
- ), Si = () => {
6742
+ ), Ii = () => {
6724
6743
  var c;
6725
6744
  const e = Ne(Sn);
6726
6745
  if (!e || !e.getSnapshot)
@@ -6750,21 +6769,21 @@ const ii = V(
6750
6769
  isRemovingItems: o,
6751
6770
  isUpdatingItems: a
6752
6771
  };
6753
- }, Ii = async (e = {
6772
+ }, Ai = async (e = {
6754
6773
  inspect: void 0,
6755
6774
  quote: { id: "", locale: "" },
6756
6775
  endpoints: { client: "", server: "" },
6757
6776
  graphql: {}
6758
6777
  }) => typeof window < "u" ? (console.warn(
6759
6778
  "App.getInitialProps::getAuth should not be run on the frontend. You are probably missing getServerSideProps in your page."
6760
- ), P(Pt, {
6779
+ ), U(Ut, {
6761
6780
  inspect: e.inspect,
6762
6781
  input: {
6763
6782
  initialContext: {
6764
6783
  endpoints: e.endpoints
6765
6784
  }
6766
6785
  }
6767
- }).start()) : P(Pt, {
6786
+ }).start()) : U(Ut, {
6768
6787
  input: {
6769
6788
  initialContext: {
6770
6789
  endpoints: e.endpoints,
@@ -6777,28 +6796,28 @@ const ii = V(
6777
6796
  },
6778
6797
  inspect: e.inspect
6779
6798
  }).start();
6780
- function Ai({ actor: e, children: t }) {
6781
- return /* @__PURE__ */ we(Sn.Provider, { value: e, children: t });
6799
+ function wi({ actor: e, children: t }) {
6800
+ return /* @__PURE__ */ xe(Sn.Provider, { value: e, children: t });
6782
6801
  }
6783
6802
  export {
6784
6803
  an as AuthContext,
6785
- yi as AuthProvider,
6804
+ mi as AuthProvider,
6786
6805
  Tn as CheckoutContext,
6787
- Ei as CheckoutProvider,
6806
+ vi as CheckoutProvider,
6788
6807
  Sn as QuoteContext,
6789
- Ai as QuoteProvider,
6808
+ wi as QuoteProvider,
6790
6809
  _n as ToastContext,
6791
- _i as ToastProvider,
6810
+ Si as ToastProvider,
6792
6811
  Ot as authMachine,
6793
- Ut as checkoutMachine,
6794
- pi as getAuth,
6795
- gi as getCheckout,
6796
- Ii as getQuote,
6797
- Pt as quoteMachine,
6798
- Wr as timerMachine,
6799
- vi as toastMachine,
6800
- fi as useAuth,
6801
- mi as useCheckout,
6802
- Si as useQuote,
6803
- Ti as useToast
6812
+ Pt as checkoutMachine,
6813
+ yi as getAuth,
6814
+ Ei as getCheckout,
6815
+ Ai as getQuote,
6816
+ Ut as quoteMachine,
6817
+ Kr as timerMachine,
6818
+ Ti as toastMachine,
6819
+ pi as useAuth,
6820
+ gi as useCheckout,
6821
+ Ii as useQuote,
6822
+ _i as useToast
6804
6823
  };