@mx-cartographer/experiences 7.2.16-alpha.mm0 → 7.2.16

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.
@@ -1,142 +1,142 @@
1
- import { jsxs as h, jsx as t, Fragment as ht } from "react/jsx-runtime";
1
+ import { jsxs as h, jsx as t, Fragment as mt } from "react/jsx-runtime";
2
2
  import p from "react";
3
- import { observer as I } from "mobx-react-lite";
4
- import { startOfMonth as ot } from "date-fns/startOfMonth";
5
- import { endOfMonth as at } from "date-fns/endOfMonth";
6
- import w from "@mui/material/Box";
3
+ import { observer as v } from "mobx-react-lite";
4
+ import { startOfMonth as nt } from "date-fns/startOfMonth";
5
+ import { endOfMonth as ot } from "date-fns/endOfMonth";
6
+ import x from "@mui/material/Box";
7
7
  import C from "@mui/material/Stack";
8
- import L from "@mui/material/Tab";
9
- import it from "@mui/material/Tabs";
10
- import ft from "@mui/material/styles/useTheme";
8
+ import N from "@mui/material/Tab";
9
+ import at from "@mui/material/Tabs";
10
+ import ht from "@mui/material/styles/useTheme";
11
11
  import { b as V } from "../CategoryUtil-BR3H5i6n.mjs";
12
- import { b as _ } from "../Category-CevNQ03n.mjs";
13
- import { Text as y, CategoryIcon as yt, CategoryIconVariants as bt } from "@mxenabled/mxui";
14
- import { f as v } from "../NumberFormatting-Buh7u8Oi.mjs";
15
- import { u as Ct } from "../useAriaLive-B3_pRUio.mjs";
16
- import _t from "@mui/material/Button";
17
- import { useTheme as rt } from "@mui/material";
18
- import { u as E, b as O, m as z, d as st, n as St, a as lt, h as Tt, g as Mt } from "../hooks-D6XlXHf4.mjs";
19
- import { u as ct } from "../useScreenSize-B6JyS_Lj.mjs";
20
- import { D as Dt } from "../Donut-oaQFlbit.mjs";
12
+ import { b as S } from "../Category-CevNQ03n.mjs";
13
+ import { Text as y, CategoryIcon as ft, CategoryIconVariants as yt } from "@mxenabled/mxui";
14
+ import { f as w } from "../NumberFormatting-Buh7u8Oi.mjs";
15
+ import { u as bt } from "../useAriaLive-B3_pRUio.mjs";
16
+ import Ct from "@mui/material/Button";
17
+ import { useTheme as it } from "@mui/material";
18
+ import { u as I, b as R, m as z, d as rt, a as st, h as _t, g as St } from "../hooks-D6XlXHf4.mjs";
19
+ import { u as lt } from "../useScreenSize-B6JyS_Lj.mjs";
20
+ import { D as Tt } from "../Donut-oaQFlbit.mjs";
21
21
  import { L as F } from "../Loader-DUaFpDGv.mjs";
22
- import { M as xt } from "../MiniWidgetContainer-D0gfmbaF.mjs";
23
- import { startOfToday as q } from "date-fns/startOfToday";
24
- import { T as wt, a as vt } from "../TransactionDetails-CDtya0KS.mjs";
25
- import It from "@mui/material/Collapse";
22
+ import { M as Mt } from "../MiniWidgetContainer-D0gfmbaF.mjs";
23
+ import { startOfToday as U } from "date-fns/startOfToday";
24
+ import { T as Dt, a as xt } from "../TransactionDetails-CDtya0KS.mjs";
25
+ import wt from "@mui/material/Collapse";
26
26
  import B from "@mui/material/Divider";
27
- import J from "@mui/material/List";
28
- import Q from "@mui/material/ListItem";
29
- import Et from "@mui/material/ListItemButton";
30
- import { D as Z } from "../Drawer-kEE73B87.mjs";
31
- import { A as tt, W as At } from "../WidgetContainer-EbrN1oIo.mjs";
32
- const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
33
- if (n.total > 0) {
34
- const a = o.find((s) => s.guid === n.category_guid);
35
- if (!a) return l;
36
- const i = a.parent_guid ?? a.guid, e = o.find((s) => s.guid === i);
27
+ import q from "@mui/material/List";
28
+ import J from "@mui/material/ListItem";
29
+ import vt from "@mui/material/ListItemButton";
30
+ import { D as Q } from "../Drawer-kEE73B87.mjs";
31
+ import { A as Z, W as It } from "../WidgetContainer-EbrN1oIo.mjs";
32
+ const j = 5, Et = (n, c, r) => r.reduce((l, a) => {
33
+ if (a.total > 0) {
34
+ const i = n.find((s) => s.guid === a.category_guid);
35
+ if (!i) return l;
36
+ const o = i.parent_guid ?? i.guid, e = n.find((s) => s.guid === o);
37
37
  if (!e) return l;
38
- const c = {
39
- guid: a.guid,
40
- name: a.guid === i ? `General ${a.name}` : a.name,
41
- color: V(e.guid, d),
42
- amount: n.total
43
- }, u = l.find((s) => s.guid === i);
44
- u ? (u.amount += n.total, u.categoryTotals?.push(c)) : l.push({
45
- guid: i,
38
+ const d = {
39
+ guid: i.guid,
40
+ name: i.guid === o ? `General ${i.name}` : i.name,
41
+ color: V(e.guid, c),
42
+ amount: a.total
43
+ }, u = l.find((s) => s.guid === o);
44
+ u ? (u.amount += a.total, u.categoryTotals?.push(d)) : l.push({
45
+ guid: o,
46
46
  name: e.name,
47
- color: V(e.guid, d),
48
- categoryTotals: [c],
49
- amount: n.total
47
+ color: V(e.guid, c),
48
+ categoryTotals: [d],
49
+ amount: a.total
50
50
  });
51
51
  }
52
52
  return l;
53
- }, []), dt = (o, d, r, l) => {
54
- const n = Lt(o, r, l), a = n.filter(
55
- (s) => s.guid !== _.INCOME && s.guid !== _.INVESTMENTS && s.guid !== _.TRANSFER
56
- ).sort((s, m) => m.amount - s.amount), i = a.reduce(
53
+ }, []), ct = (n, c, r, l) => {
54
+ const a = Et(n, r, l), i = a.filter(
55
+ (s) => s.guid !== S.INCOME && s.guid !== S.INVESTMENTS && s.guid !== S.TRANSFER
56
+ ).sort((s, m) => m.amount - s.amount), o = i.reduce(
57
57
  (s, m) => s + m.amount,
58
58
  0
59
- ), e = a.length > j ? j : a.length, c = a.slice(0, e), u = c.map((s) => ({
59
+ ), e = i.length > j ? j : i.length, d = i.slice(0, e), u = d.map((s) => ({
60
60
  id: s.guid,
61
61
  color: V(s.guid, r),
62
62
  label: s.name,
63
- value: s.amount / i * 100
63
+ value: s.amount / o * 100
64
64
  }));
65
- if (a.length > 5) {
66
- const s = a.slice(j, n.length), m = s.reduce(
67
- (S, g) => S + g.amount,
65
+ if (i.length > 5) {
66
+ const s = i.slice(j, a.length), m = s.reduce(
67
+ (T, g) => T + g.amount,
68
68
  0
69
69
  );
70
- c.push({
70
+ d.push({
71
71
  guid: "other",
72
72
  color: r.palette.categories.others || "",
73
- name: d.saving_goal_other,
73
+ name: c.saving_goal_other,
74
74
  categoryTotals: s,
75
75
  amount: m
76
76
  }), u.push({
77
77
  id: "other",
78
78
  color: r.palette.categories.others || "",
79
- label: d.saving_goal_other,
80
- value: m / i * 100
79
+ label: c.saving_goal_other,
80
+ value: m / o * 100
81
81
  });
82
82
  }
83
83
  return {
84
- categoryData: c,
84
+ categoryData: d,
85
85
  donutData: u,
86
- totalAmount: i
86
+ totalAmount: o
87
87
  };
88
- }, gt = (o, d, r) => {
89
- const l = o.filter(
90
- (e) => e.guid === _.INCOME || e.parent_guid === _.INCOME
91
- ), n = d.filter((e) => l.some((c) => c.guid === e.category_guid)).sort((e, c) => e.total - c.total).map((e, c) => ({
88
+ }, dt = (n, c, r) => {
89
+ const l = n.filter(
90
+ (e) => e.guid === S.INCOME || e.parent_guid === S.INCOME
91
+ ), a = c.filter((e) => l.some((d) => d.guid === e.category_guid)).sort((e, d) => e.total - d.total).map((e, d) => ({
92
92
  guid: e.category_guid,
93
- name: o.find((u) => u.guid === e.category_guid)?.name,
94
- color: r[c],
93
+ name: n.find((u) => u.guid === e.category_guid)?.name,
94
+ color: r[d],
95
95
  categoryTotals: [],
96
96
  amount: Math.abs(e.total)
97
- })), a = n.reduce(
98
- (e, c) => e + c.amount,
97
+ })), i = a.reduce(
98
+ (e, d) => e + d.amount,
99
99
  0
100
- ), i = n.map((e) => ({
100
+ ), o = a.map((e) => ({
101
101
  id: e.guid,
102
102
  color: e.color,
103
103
  label: e.name,
104
- value: e.amount / a * 100
104
+ value: e.amount / i * 100
105
105
  }));
106
106
  return {
107
- categoryData: n,
108
- donutData: i,
109
- totalAmount: a
107
+ categoryData: a,
108
+ donutData: o,
109
+ totalAmount: i
110
110
  };
111
- }, N = ({ amount: o, label: d }) => /* @__PURE__ */ h(C, { direction: "column", children: [
112
- /* @__PURE__ */ t(y, { bold: !0, sx: { textTransform: "none" }, variant: "Body", children: d }),
113
- /* @__PURE__ */ t(y, { variant: "XSmall", children: v(o, "0,0") })
114
- ] }), Nt = ({
115
- data: o,
116
- isIncome: d = !1,
111
+ }, W = ({ amount: n, label: c }) => /* @__PURE__ */ h(C, { direction: "column", children: [
112
+ /* @__PURE__ */ t(y, { bold: !0, sx: { textTransform: "none" }, variant: "Body", children: c }),
113
+ /* @__PURE__ */ t(y, { variant: "XSmall", children: w(n, "0,0") })
114
+ ] }), At = ({
115
+ data: n,
116
+ isIncome: c = !1,
117
117
  onSelected: r,
118
118
  onViewTransactions: l,
119
- selectedId: n,
120
- size: a = 150,
121
- totalLabel: i,
119
+ selectedId: a,
120
+ size: i = 150,
121
+ totalLabel: o,
122
122
  variant: e = "mini"
123
123
  }) => {
124
- const { spending: c } = E(), u = rt(), { isTablet: s } = ct(), { announce: m, ariaLive: S } = Ct(), g = p.useMemo(
125
- () => n ? o.categoryData.find((b) => b.guid === n) : void 0,
126
- [n]
124
+ const { spending: d } = I(), u = it(), { isTablet: s } = lt(), { announce: m, ariaLive: T } = bt(), g = p.useMemo(
125
+ () => a ? n.categoryData.find((D) => D.guid === a) : void 0,
126
+ [a]
127
127
  );
128
128
  p.useEffect(() => {
129
129
  if (g) {
130
- const b = v(g.amount, "0,0");
131
- m(`${g.name}: ${b}`);
130
+ const D = w(g.amount, "0,0");
131
+ m(`${g.name}: ${D}`);
132
132
  }
133
133
  }, [g, m]);
134
- const T = p.useMemo(() => o.donutData.length > 0 ? o.donutData : [{ id: "0", color: u.palette.divider, value: 100 }], [o, u]), x = () => {
135
- l?.(n);
136
- }, D = s ? 32 : 48;
137
- return /* @__PURE__ */ h(ht, { children: [
138
- S,
139
- /* @__PURE__ */ t(Dt, { data: T, onClick: r, selectedId: n, size: a, children: /* @__PURE__ */ t(C, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ h(C, { alignItems: "center", justifyContent: "center", minHeight: a, minWidth: a, children: [
134
+ const b = p.useMemo(() => n.donutData.length > 0 ? n.donutData : [{ id: "0", color: u.palette.divider, value: 100 }], [n, u]), E = () => {
135
+ l?.(a);
136
+ }, _ = s ? 32 : 48;
137
+ return /* @__PURE__ */ h(mt, { children: [
138
+ T,
139
+ /* @__PURE__ */ t(Tt, { data: b, onClick: r, selectedId: a, size: i, children: /* @__PURE__ */ t(C, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ h(C, { alignItems: "center", justifyContent: "center", minHeight: i, minWidth: i, children: [
140
140
  g && /* @__PURE__ */ h(
141
141
  C,
142
142
  {
@@ -147,11 +147,11 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
147
147
  sx: e === "mini" ? { gap: 0, mb: 0 } : { gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } },
148
148
  children: [
149
149
  /* @__PURE__ */ t(
150
- yt,
150
+ ft,
151
151
  {
152
- categoryGuid: d ? _.INCOME : g.guid,
153
- size: e === "mini" ? 24 : D,
154
- variant: bt.Transparent
152
+ categoryGuid: c ? S.INCOME : g.guid,
153
+ size: e === "mini" ? 24 : _,
154
+ variant: yt.Transparent
155
155
  }
156
156
  ),
157
157
  /* @__PURE__ */ t(
@@ -160,103 +160,103 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
160
160
  color: "secondary",
161
161
  noWrap: !0,
162
162
  variant: e === "mini" ? "Tiny" : "Body",
163
- children: g ? g.name : i
163
+ children: g ? g.name : o
164
164
  }
165
165
  )
166
166
  ]
167
167
  }
168
168
  ),
169
- !g && e === "full" && /* @__PURE__ */ t(y, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: i }),
170
- /* @__PURE__ */ t(y, { variant: e === "mini" ? "H2" : "H1", children: g ? v(g.amount, "0,0") : v(o.totalAmount, "0,0") }),
171
- !g && e === "mini" && /* @__PURE__ */ t(y, { color: "secondary", noWrap: !0, variant: "Tiny", children: i }),
169
+ !g && e === "full" && /* @__PURE__ */ t(y, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: o }),
170
+ /* @__PURE__ */ t(y, { variant: e === "mini" ? "H2" : "H1", children: g ? w(g.amount, "0,0") : w(n.totalAmount, "0,0") }),
171
+ !g && e === "mini" && /* @__PURE__ */ t(y, { color: "secondary", noWrap: !0, variant: "Tiny", children: o }),
172
172
  e === "full" && /* @__PURE__ */ t(
173
- _t,
173
+ Ct,
174
174
  {
175
175
  "aria-label": `View ${g?.name || ""} Transactions`,
176
- disabled: o.categoryData.length === 0,
177
- onClick: x,
176
+ disabled: n.categoryData.length === 0,
177
+ onClick: E,
178
178
  sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
179
179
  variant: "text",
180
- children: c.view_transactions
180
+ children: d.view_transactions
181
181
  }
182
182
  )
183
183
  ] }) }) })
184
184
  ] });
185
- }, W = I(Nt), et = ({ data: o, onSelected: d, selectedId: r }) => {
186
- const l = (n, a) => {
187
- (n.key === "Enter" || n.key === " ") && (n.preventDefault(), d(a));
185
+ }, O = v(At), tt = ({ data: n, onSelected: c, selectedId: r }) => {
186
+ const l = (a, i) => {
187
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), c(i));
188
188
  };
189
- return /* @__PURE__ */ t(C, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: o.categoryData.map((n) => /* @__PURE__ */ h(
189
+ return /* @__PURE__ */ t(C, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: n.categoryData.map((a) => /* @__PURE__ */ h(
190
190
  C,
191
191
  {
192
192
  alignItems: "center",
193
- "aria-label": n.name,
194
- "aria-pressed": n.guid === r,
193
+ "aria-label": a.name,
194
+ "aria-pressed": a.guid === r,
195
195
  direction: "row",
196
196
  gap: 8,
197
- onClick: () => d(n.guid),
198
- onKeyDown: (a) => l(a, n.guid),
197
+ onClick: () => c(a.guid),
198
+ onKeyDown: (i) => l(i, a.guid),
199
199
  role: "button",
200
200
  sx: { cursor: "pointer" },
201
201
  tabIndex: 0,
202
202
  children: [
203
- /* @__PURE__ */ t(w, { borderRadius: 4, height: 8, sx: { backgroundColor: n.color }, width: 8 }),
204
- /* @__PURE__ */ t(y, { bold: n.guid === r, variant: "XSmall", children: n.name })
203
+ /* @__PURE__ */ t(x, { borderRadius: 4, height: 8, sx: { backgroundColor: a.color }, width: 8 }),
204
+ /* @__PURE__ */ t(y, { bold: a.guid === r, variant: "XSmall", children: a.name })
205
205
  ]
206
206
  },
207
- n.guid
207
+ a.guid
208
208
  )) });
209
- }, Wt = () => {
210
- const o = ft(), { goals: d, spending: r } = E(), { selectedAccounts: l } = O(), {
211
- categories: n,
212
- dateRangeCategoryTotals: a,
213
- dataRangeTotalsLoaded: i,
209
+ }, Lt = () => {
210
+ const n = ht(), { goals: c, spending: r } = I(), { selectedAccounts: l } = R(), {
211
+ categories: a,
212
+ dateRangeCategoryTotals: i,
213
+ dataRangeTotalsLoaded: o,
214
214
  loadDateRangeCategoryTotals: e
215
- } = z(), c = p.useMemo(
215
+ } = z(), d = p.useMemo(
216
216
  () => [
217
- o.palette.chartMono.chartMono5,
218
- o.palette.chartMono.chartMono4,
219
- o.palette.chartMono.chartMono3,
220
- o.palette.chartMono.chartMono2,
221
- o.palette.chartMono.chartMono1,
222
- o.palette.chartMono.chartMono6
217
+ n.palette.chartMono.chartMono5,
218
+ n.palette.chartMono.chartMono4,
219
+ n.palette.chartMono.chartMono3,
220
+ n.palette.chartMono.chartMono2,
221
+ n.palette.chartMono.chartMono1,
222
+ n.palette.chartMono.chartMono6
223
223
  ],
224
- [o]
224
+ [n]
225
225
  );
226
226
  p.useEffect(() => {
227
227
  e(
228
228
  l,
229
- ot(/* @__PURE__ */ new Date()),
230
- at(/* @__PURE__ */ new Date())
229
+ nt(/* @__PURE__ */ new Date()),
230
+ ot(/* @__PURE__ */ new Date())
231
231
  ).finally();
232
232
  }, [l]);
233
- const [u, s] = p.useState(""), [m, S] = p.useState(0), g = p.useMemo(
234
- () => dt(n, d, o, a),
235
- [n, a]
236
- ), T = p.useMemo(
237
- () => gt(n, a, c),
238
- [n, a, c]
239
- ), x = (b, R) => {
240
- S(R), s("");
241
- }, D = (b) => {
242
- s(u === b ? "" : b);
233
+ const [u, s] = p.useState(""), [m, T] = p.useState(0), g = p.useMemo(
234
+ () => ct(a, c, n, i),
235
+ [a, i]
236
+ ), b = p.useMemo(
237
+ () => dt(a, i, d),
238
+ [a, i, d]
239
+ ), E = (D, L) => {
240
+ T(L), s("");
241
+ }, _ = (D) => {
242
+ s(u === D ? "" : D);
243
243
  };
244
- return i ? /* @__PURE__ */ h(w, { width: "100%", children: [
244
+ return o ? /* @__PURE__ */ h(x, { width: "100%", children: [
245
245
  /* @__PURE__ */ h(
246
- it,
246
+ at,
247
247
  {
248
248
  "aria-label": r.mini_title,
249
- onChange: x,
249
+ onChange: E,
250
250
  value: m,
251
251
  variant: "fullWidth",
252
252
  children: [
253
253
  /* @__PURE__ */ t(
254
- L,
254
+ N,
255
255
  {
256
256
  "aria-controls": "spending-tabpanel",
257
257
  id: "spending-tab",
258
258
  label: /* @__PURE__ */ t(
259
- N,
259
+ W,
260
260
  {
261
261
  amount: g.totalAmount,
262
262
  label: r.spend_tab_title
@@ -266,14 +266,14 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
266
266
  }
267
267
  ),
268
268
  /* @__PURE__ */ t(
269
- L,
269
+ N,
270
270
  {
271
271
  "aria-controls": "income-tabpanel",
272
272
  id: "income-tab",
273
273
  label: /* @__PURE__ */ t(
274
- N,
274
+ W,
275
275
  {
276
- amount: T.totalAmount,
276
+ amount: b.totalAmount,
277
277
  label: r.income_tab_title
278
278
  }
279
279
  ),
@@ -284,7 +284,7 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
284
284
  }
285
285
  ),
286
286
  /* @__PURE__ */ t(
287
- w,
287
+ x,
288
288
  {
289
289
  "aria-labelledby": "spending-tab",
290
290
  hidden: m !== 0,
@@ -292,20 +292,20 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
292
292
  role: "tabpanel",
293
293
  children: /* @__PURE__ */ h(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
294
294
  /* @__PURE__ */ t(
295
- W,
295
+ O,
296
296
  {
297
297
  data: g,
298
- onSelected: D,
298
+ onSelected: _,
299
299
  selectedId: u,
300
300
  totalLabel: r.total_spending
301
301
  }
302
302
  ),
303
- /* @__PURE__ */ t(et, { data: g, onSelected: D, selectedId: u })
303
+ /* @__PURE__ */ t(tt, { data: g, onSelected: _, selectedId: u })
304
304
  ] })
305
305
  }
306
306
  ),
307
307
  /* @__PURE__ */ t(
308
- w,
308
+ x,
309
309
  {
310
310
  "aria-labelledby": "income-tab",
311
311
  hidden: m !== 1,
@@ -313,48 +313,48 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
313
313
  role: "tabpanel",
314
314
  children: /* @__PURE__ */ h(C, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
315
315
  /* @__PURE__ */ t(
316
- W,
316
+ O,
317
317
  {
318
- data: T,
318
+ data: b,
319
319
  isIncome: !0,
320
- onSelected: D,
320
+ onSelected: _,
321
321
  selectedId: u,
322
322
  totalLabel: r.total_income
323
323
  }
324
324
  ),
325
- /* @__PURE__ */ t(et, { data: T, onSelected: D, selectedId: u })
325
+ /* @__PURE__ */ t(tt, { data: b, onSelected: _, selectedId: u })
326
326
  ] })
327
327
  }
328
328
  )
329
329
  ] }) : /* @__PURE__ */ t(F, { height: 250 });
330
- }, Ot = I(Wt), Rt = ({ onPrimaryCtaClick: o, sx: d = {} }) => {
331
- const { visibleAccounts: r } = st(), { spending: l } = E(), { isCopyLoaded: n, isInitialized: a, setSelectedAccounts: i } = O();
330
+ }, Nt = v(Lt), Wt = ({ onPrimaryCtaClick: n, sx: c = {} }) => {
331
+ const { visibleAccounts: r } = rt(), { spending: l } = I(), { isCopyLoaded: a, isInitialized: i, setSelectedAccounts: o } = R();
332
332
  return p.useEffect(() => {
333
- i(r);
334
- }, [r]), !n || !a ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
335
- xt,
333
+ o(r);
334
+ }, [r]), !a || !i ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
335
+ Mt,
336
336
  {
337
337
  className: "mx-exp-spending-miniwidget",
338
- onPrimaryCtaClick: o,
338
+ onPrimaryCtaClick: n,
339
339
  primaryCtaLabel: l.primary_cta,
340
- sx: d,
340
+ sx: c,
341
341
  title: l.mini_title,
342
- children: /* @__PURE__ */ t(Ot, {})
342
+ children: /* @__PURE__ */ t(Nt, {})
343
343
  }
344
344
  );
345
- }, _e = I(Rt), kt = ({
346
- data: o,
347
- onSelected: d,
345
+ }, be = v(Wt), Ot = ({
346
+ data: n,
347
+ onSelected: c,
348
348
  selectedId: r = "",
349
349
  title: l
350
350
  }) => {
351
- const { spending: n } = E(), a = o.categoryData.find((i) => i.guid === r);
351
+ const { spending: a } = I(), i = n.categoryData.find((o) => o.guid === r);
352
352
  return /* @__PURE__ */ h(C, { direction: "column", justifyContent: "center", maxWidth: 400, minWidth: 275, width: "100%", children: [
353
- /* @__PURE__ */ t(y, { bold: !0, sx: { py: 12 }, children: `${l} ${n.by_category}` }),
353
+ /* @__PURE__ */ t(y, { bold: !0, sx: { py: 12 }, children: `${l} ${a.by_category}` }),
354
354
  /* @__PURE__ */ t(B, { "aria-hidden": "true" }),
355
- /* @__PURE__ */ t(J, { children: o.categoryData.map((i) => /* @__PURE__ */ h(p.Fragment, { children: [
355
+ /* @__PURE__ */ t(q, { children: n.categoryData.map((o) => /* @__PURE__ */ h(p.Fragment, { children: [
356
356
  /* @__PURE__ */ t(
357
- Q,
357
+ J,
358
358
  {
359
359
  disableGutters: !0,
360
360
  disablePadding: !0,
@@ -362,19 +362,19 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
362
362
  minHeight: 44
363
363
  },
364
364
  children: /* @__PURE__ */ h(
365
- Et,
365
+ vt,
366
366
  {
367
- "aria-expanded": a?.guid === i.guid,
368
- onClick: () => d(i.guid),
367
+ "aria-expanded": i?.guid === o.guid,
368
+ onClick: () => c(o.guid),
369
369
  sx: { minHeight: 44, px: 8, py: 0 },
370
370
  children: [
371
371
  /* @__PURE__ */ t(
372
- w,
372
+ x,
373
373
  {
374
374
  borderRadius: 4,
375
375
  flexShrink: 0,
376
376
  height: 8,
377
- sx: { backgroundColor: i.color, mr: 8 },
377
+ sx: { backgroundColor: o.color, mr: 8 },
378
378
  width: 8
379
379
  }
380
380
  ),
@@ -386,8 +386,8 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
386
386
  justifyContent: "space-between",
387
387
  width: "100%",
388
388
  children: [
389
- /* @__PURE__ */ t(y, { bold: r === i.guid, children: i.name }),
390
- /* @__PURE__ */ t(y, { bold: r === i.guid, variant: "Body", children: v(i.amount, "0,0") })
389
+ /* @__PURE__ */ t(y, { bold: r === o.guid, children: o.name }),
390
+ /* @__PURE__ */ t(y, { bold: r === o.guid, variant: "Body", children: w(o.amount, "0,0") })
391
391
  ]
392
392
  }
393
393
  )
@@ -397,9 +397,9 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
397
397
  }
398
398
  ),
399
399
  /* @__PURE__ */ t(B, {}),
400
- i.categoryTotals && i.categoryTotals.length > 0 && /* @__PURE__ */ t(It, { in: a?.guid === i.guid, unmountOnExit: !0, children: /* @__PURE__ */ h(J, { children: [
401
- a?.categoryTotals?.map((e) => /* @__PURE__ */ t(
402
- Q,
400
+ o.categoryTotals && o.categoryTotals.length > 0 && /* @__PURE__ */ t(wt, { in: i?.guid === o.guid, unmountOnExit: !0, children: /* @__PURE__ */ h(q, { children: [
401
+ i?.categoryTotals?.map((e) => /* @__PURE__ */ t(
402
+ J,
403
403
  {
404
404
  sx: {
405
405
  pl: 24,
@@ -411,36 +411,36 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
411
411
  e.name,
412
412
  " "
413
413
  ] }),
414
- /* @__PURE__ */ t(y, { children: v(e.amount, "0,0") })
414
+ /* @__PURE__ */ t(y, { children: w(e.amount, "0,0") })
415
415
  ] })
416
416
  },
417
417
  e.guid
418
418
  )),
419
419
  /* @__PURE__ */ t(B, {})
420
420
  ] }) })
421
- ] }, i.guid)) }),
422
- /* @__PURE__ */ t(y, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${n.total}: ${v(o.totalAmount, "0,0")}` })
421
+ ] }, o.guid)) }),
422
+ /* @__PURE__ */ t(y, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${a.total}: ${w(n.totalAmount, "0,0")}` })
423
423
  ] });
424
- }, $t = I(kt), Gt = ({
425
- data: o,
426
- onSelected: d,
424
+ }, Rt = v(Ot), kt = ({
425
+ data: n,
426
+ onSelected: c,
427
427
  onViewTransactions: r,
428
428
  selectedId: l,
429
- title: n
429
+ title: a
430
430
  }) => {
431
- const { isDesktop: a, isMobile: i } = ct(), { isLoadingCategoryTotals: e } = z(), { spending: c } = E();
431
+ const { isDesktop: i, isMobile: o } = lt(), { isLoadingCategoryTotals: e } = z(), { spending: d } = I();
432
432
  return /* @__PURE__ */ h(
433
433
  C,
434
434
  {
435
- alignItems: i ? "center" : "flex-start",
436
- direction: i ? "column" : "row",
435
+ alignItems: o ? "center" : "flex-start",
436
+ direction: o ? "column" : "row",
437
437
  gap: { xs: 16, md: 64, xl: 100 },
438
438
  justifyContent: "center",
439
439
  pt: 50,
440
440
  px: 8,
441
441
  children: [
442
442
  e && /* @__PURE__ */ t(
443
- W,
443
+ O,
444
444
  {
445
445
  data: {
446
446
  categoryData: [],
@@ -450,175 +450,173 @@ const j = 5, Lt = (o, d, r) => r.reduce((l, n) => {
450
450
  onSelected: () => {
451
451
  },
452
452
  selectedId: "",
453
- size: a ? 400 : 300,
453
+ size: i ? 400 : 300,
454
454
  totalLabel: "Loading ...",
455
455
  variant: "full"
456
456
  }
457
457
  ),
458
458
  !e && /* @__PURE__ */ t(
459
- W,
459
+ O,
460
460
  {
461
- data: o,
462
- onSelected: d,
461
+ data: n,
462
+ onSelected: c,
463
463
  onViewTransactions: r,
464
464
  selectedId: l,
465
- size: a ? 400 : 300,
466
- totalLabel: c.total_amount,
465
+ size: i ? 400 : 300,
466
+ totalLabel: d.total_amount,
467
467
  variant: "full"
468
468
  }
469
469
  ),
470
- /* @__PURE__ */ t($t, { data: o, onSelected: d, selectedId: l, title: n })
470
+ /* @__PURE__ */ t(Rt, { data: n, onSelected: c, selectedId: l, title: a })
471
471
  ]
472
472
  }
473
473
  );
474
- }, nt = I(Gt), Bt = (o) => [
475
- o.palette.chartMono.chartMono5,
476
- o.palette.chartMono.chartMono4,
477
- o.palette.chartMono.chartMono3,
478
- o.palette.chartMono.chartMono2,
479
- o.palette.chartMono.chartMono1,
480
- o.palette.chartMono.chartMono6
481
- ], jt = () => {
482
- const o = rt(), { onLoad: d } = St(), { clientConfig: r } = lt(), { categories: l, dateRangeCategoryTotals: n, loadDateRangeCategoryTotals: a } = z(), { goals: i, spending: e } = E(), { displayedDateRange: c, selectedAccounts: u, selectedAccountGuids: s } = O(), { setFilter: m, sortedTransactions: S } = Tt(), g = r?.master?.deep_link_params?.account_guids, T = r?.master?.deep_link_params?.view, [x, D] = p.useState(""), [b, R] = p.useState(T === "income" ? 1 : 0), [H, P] = p.useState(""), [ut, K] = p.useState(!1);
474
+ }, et = v(kt), $t = (n) => [
475
+ n.palette.chartMono.chartMono5,
476
+ n.palette.chartMono.chartMono4,
477
+ n.palette.chartMono.chartMono3,
478
+ n.palette.chartMono.chartMono2,
479
+ n.palette.chartMono.chartMono1,
480
+ n.palette.chartMono.chartMono6
481
+ ], Gt = () => {
482
+ const n = it(), { clientConfig: c } = st(), { categories: r, dateRangeCategoryTotals: l, loadDateRangeCategoryTotals: a } = z(), { goals: i, spending: o } = I(), { displayedDateRange: e, selectedAccounts: d, selectedAccountGuids: u } = R(), { setFilter: s, sortedTransactions: m } = _t(), T = c?.master?.deep_link_params?.account_guids, g = c?.master?.deep_link_params?.view, [b, E] = p.useState(""), [_, D] = p.useState(g === "income" ? 1 : 0), [L, H] = p.useState(""), [gt, P] = p.useState(!1);
483
483
  p.useEffect(() => {
484
484
  a(
485
- u,
486
- c.start,
487
- c.end
488
- ).finally(() => {
489
- d?.("SpendingWidget");
490
- });
491
- }, [u, c]);
485
+ d,
486
+ e.start,
487
+ e.end
488
+ ).finally();
489
+ }, [d, e]);
492
490
  const k = p.useMemo(
493
- () => dt(l, i, o, n),
494
- [l, n]
495
- ), X = p.useMemo(
496
- () => gt(l, n, Bt(o)),
497
- [l, n]
491
+ () => ct(r, i, n, l),
492
+ [r, l]
493
+ ), K = p.useMemo(
494
+ () => dt(r, l, $t(n)),
495
+ [r, l]
498
496
  ), $ = p.useMemo(
499
- () => S.find((f) => f.guid === H),
500
- [H, S]
501
- ), pt = (f, A) => {
502
- R(A), D("");
497
+ () => m.find((f) => f.guid === L),
498
+ [L, m]
499
+ ), ut = (f, A) => {
500
+ D(A), E("");
501
+ }, X = (f) => {
502
+ E(b === f || f === "0" ? "" : f);
503
503
  }, Y = (f) => {
504
- D(x === f || f === "0" ? "" : f);
505
- }, U = (f) => {
506
504
  const A = {
507
- accounts: g || s,
508
- dateRange: c
505
+ accounts: T || u,
506
+ dateRange: e
509
507
  };
510
- if (b === 0)
508
+ if (_ === 0)
511
509
  if (f === "other") {
512
510
  const M = k.categoryData.find((G) => G.guid === "other");
513
- m({
511
+ s({
514
512
  ...A,
515
- custom: (G) => !!M?.categoryTotals?.find((mt) => mt.guid === G.top_level_category_guid)
513
+ custom: (G) => !!M?.categoryTotals?.find((pt) => pt.guid === G.top_level_category_guid)
516
514
  });
517
515
  } else
518
- m({
516
+ s({
519
517
  ...A,
520
- custom: (M) => f ? M.top_level_category_guid === f : M.top_level_category_guid !== _.INCOME && M.top_level_category_guid !== _.INVESTMENTS && M.top_level_category_guid !== _.TRANSFER,
518
+ custom: (M) => f ? M.top_level_category_guid === f : M.top_level_category_guid !== S.INCOME && M.top_level_category_guid !== S.INVESTMENTS && M.top_level_category_guid !== S.TRANSFER,
521
519
  showSplits: !!f
522
520
  });
523
521
  else
524
- m({
522
+ s({
525
523
  ...A,
526
- custom: (M) => f ? M.category_guid === f : M.category_guid === _.INCOME || M.top_level_category_guid === _.INCOME
524
+ custom: (M) => f ? M.category_guid === f : M.category_guid === S.INCOME || M.top_level_category_guid === S.INCOME
527
525
  });
528
- K(!0);
526
+ P(!0);
529
527
  };
530
- return /* @__PURE__ */ h(w, { children: [
531
- /* @__PURE__ */ h(it, { onChange: pt, value: b, variant: "fullWidth", children: [
528
+ return /* @__PURE__ */ h(x, { children: [
529
+ /* @__PURE__ */ h(at, { onChange: ut, value: _, variant: "fullWidth", children: [
532
530
  /* @__PURE__ */ t(
533
- L,
531
+ N,
534
532
  {
535
533
  label: /* @__PURE__ */ t(
536
- N,
534
+ W,
537
535
  {
538
536
  amount: k.totalAmount,
539
- label: e.spend_tab_title
537
+ label: o.spend_tab_title
540
538
  }
541
539
  )
542
540
  }
543
541
  ),
544
542
  /* @__PURE__ */ t(
545
- L,
543
+ N,
546
544
  {
547
545
  label: /* @__PURE__ */ t(
548
- N,
546
+ W,
549
547
  {
550
- amount: X.totalAmount,
551
- label: e.income_tab_title
548
+ amount: K.totalAmount,
549
+ label: o.income_tab_title
552
550
  }
553
551
  )
554
552
  }
555
553
  )
556
554
  ] }),
557
- b === 0 && /* @__PURE__ */ t(
558
- nt,
555
+ _ === 0 && /* @__PURE__ */ t(
556
+ et,
559
557
  {
560
558
  data: k,
561
- onSelected: Y,
562
- onViewTransactions: U,
563
- selectedId: x,
564
- title: e.spend_tab_title
559
+ onSelected: X,
560
+ onViewTransactions: Y,
561
+ selectedId: b,
562
+ title: o.spend_tab_title
565
563
  }
566
564
  ),
567
- b === 1 && /* @__PURE__ */ t(
568
- nt,
565
+ _ === 1 && /* @__PURE__ */ t(
566
+ et,
569
567
  {
570
- data: X,
571
- onSelected: Y,
572
- onViewTransactions: U,
573
- selectedId: x,
574
- title: e.income_tab_title
568
+ data: K,
569
+ onSelected: X,
570
+ onViewTransactions: Y,
571
+ selectedId: b,
572
+ title: o.income_tab_title
575
573
  }
576
574
  ),
577
575
  /* @__PURE__ */ t(
578
- Z,
576
+ Q,
579
577
  {
580
- ariaLabelClose: e.close_drawer_aria,
581
- isOpen: ut,
582
- onClose: () => K(!1),
583
- title: e.transactions_drawer_title,
584
- children: /* @__PURE__ */ t(wt, { onClick: P })
578
+ ariaLabelClose: o.close_drawer_aria,
579
+ isOpen: gt,
580
+ onClose: () => P(!1),
581
+ title: o.transactions_drawer_title,
582
+ children: /* @__PURE__ */ t(Dt, { onClick: H })
585
583
  }
586
584
  ),
587
585
  /* @__PURE__ */ t(
588
- Z,
586
+ Q,
589
587
  {
590
- ariaLabelClose: e.close_drawer_aria,
588
+ ariaLabelClose: o.close_drawer_aria,
591
589
  isOpen: !!$,
592
- onClose: () => P(""),
593
- title: e.transaction_details_drawer_title,
594
- children: $ && /* @__PURE__ */ t(vt, { transaction: $ })
590
+ onClose: () => H(""),
591
+ title: o.transaction_details_drawer_title,
592
+ children: $ && /* @__PURE__ */ t(xt, { transaction: $ })
595
593
  }
596
594
  )
597
595
  ] });
598
- }, Vt = I(jt), zt = ({ onBackClick: o, sx: d = {} }) => {
599
- const { visibleAccounts: r } = st(), { spending: l } = E(), { isCopyLoaded: n, isInitialized: a, setDisplayedDate: i, setSelectedAccounts: e } = O(), { onEvent: c } = Mt(), { clientConfig: u } = lt(), s = u?.master?.deep_link_params?.date_range, [m, S] = p.useState(!1);
596
+ }, Bt = v(Gt), jt = ({ onBackClick: n, sx: c = {} }) => {
597
+ const { visibleAccounts: r } = rt(), { spending: l } = I(), { isCopyLoaded: a, isInitialized: i, setDisplayedDate: o, setSelectedAccounts: e } = R(), { onEvent: d } = St(), { clientConfig: u } = st(), s = u?.master?.deep_link_params?.date_range, [m, T] = p.useState(!1);
600
598
  p.useEffect(() => {
601
599
  e(r);
602
600
  }, [r]), p.useEffect(() => {
603
- s && Array.isArray(s) && s.length === 2 ? i(s[0], s[1]) : i(ot(q()), at(q())), S(!0), c(tt.SPENDING_VIEW);
601
+ s && Array.isArray(s) && s.length === 2 ? o(s[0], s[1]) : o(nt(U()), ot(U())), T(!0), d(Z.SPENDING_VIEW);
604
602
  }, []);
605
- const g = (T) => {
606
- i(T[0], T[1]);
603
+ const g = (b) => {
604
+ o(b[0], b[1]);
607
605
  };
608
- return !n || !a || !m ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
609
- At,
606
+ return !a || !i || !m ? /* @__PURE__ */ t(F, {}) : /* @__PURE__ */ t(
607
+ It,
610
608
  {
611
609
  accountOptions: r,
612
610
  calendarActions: { onRangeChanged: g },
613
- onAccountsFilterClick: () => c(tt.SPENDING_CLICK_FILTER),
614
- onBackClick: o,
615
- sx: d,
611
+ onAccountsFilterClick: () => d(Z.SPENDING_CLICK_FILTER),
612
+ onBackClick: n,
613
+ sx: c,
616
614
  title: l.title,
617
- children: /* @__PURE__ */ t(w, { height: "calc(100dvh - 150px)", overflow: "scroll", width: "100%", children: /* @__PURE__ */ t(Vt, {}) })
615
+ children: /* @__PURE__ */ t(x, { height: "calc(100dvh - 150px)", overflow: "scroll", width: "100%", children: /* @__PURE__ */ t(Bt, {}) })
618
616
  }
619
617
  );
620
- }, Se = I(zt);
618
+ }, Ce = v(jt);
621
619
  export {
622
- _e as SpendingMiniWidget,
623
- Se as SpendingWidget
620
+ be as SpendingMiniWidget,
621
+ Ce as SpendingWidget
624
622
  };