@mx-cartographer/experiences 7.0.34 → 7.0.36

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,74 +1,75 @@
1
- import { jsx as e, jsxs as f, Fragment as Fe } from "react/jsx-runtime";
2
- import i from "react";
3
- import { observer as M } from "mobx-react-lite";
4
- import { Icon as se, Text as X, CategoryIcon as Te, P as Y, H3 as De, ChevronRightIcon as Pe } from "@mxenabled/mxui";
5
- import O from "@mui/material/Box";
1
+ import { jsx as e, jsxs as f, Fragment as je } from "react/jsx-runtime";
2
+ import a from "react";
3
+ import { observer as v } from "mobx-react-lite";
4
+ import { Icon as re, Text as Q, CategoryIcon as fe, P as X, H3 as De, ChevronRightIcon as Ye } from "@mxenabled/mxui";
5
+ import W from "@mui/material/Box";
6
6
  import _ from "@mui/material/Stack";
7
- import pe from "@mui/material/Button";
7
+ import ge from "@mui/material/Button";
8
8
  import { addSeconds as Ie } from "date-fns/addSeconds";
9
- import { differenceInCalendarMonths as Ce } from "date-fns/differenceInCalendarMonths";
10
- import { a as Ke, g as $e, S as je, L as Ee } from "../TrendsStore-BM-JjAs5.mjs";
11
- import { T as to } from "../TrendsStore-BM-JjAs5.mjs";
12
- import { i as Ye, c as Ue, d as Xe, e as Ze, f as Qe, h as qe, b as Le, g as xe, j as _e } from "../SpendingData-D5vsfYKo.mjs";
13
- import Je from "@mui/material/ToggleButton";
14
- import et from "@mui/material/ToggleButtonGroup";
15
- import { u as R, l as F, f as H, a as P, g as re, c as ae, v as q, e as ve, p as tt, m as nt } from "../hooks-BhSK6dal.mjs";
9
+ import { differenceInCalendarMonths as pe } from "date-fns/differenceInCalendarMonths";
10
+ import { a as Ue, g as Xe, S as Ze, L as Ee } from "../TrendsStore-BM-JjAs5.mjs";
11
+ import { T as io } from "../TrendsStore-BM-JjAs5.mjs";
12
+ import { i as Qe, c as qe, d as Je, e as et, f as tt, h as nt, b as Le, g as xe, j as _e } from "../SpendingData-D5vsfYKo.mjs";
13
+ import ot from "@mui/material/ToggleButton";
14
+ import st from "@mui/material/ToggleButtonGroup";
15
+ import { u as R, l as F, f as N, a as P, g as ae, c as ie, v as ee, e as ve, p as rt, m as at } from "../hooks-BhSK6dal.mjs";
16
16
  import { u as K } from "../useScreenSize-B6JyS_Lj.mjs";
17
- import { f as Z, D as B } from "../Dialog-CWW597AF.mjs";
18
- import { DataGridPro as ot } from "@mui/x-data-grid-pro";
19
- import { C as st } from "../CurrencyText-YUhH2caW.mjs";
17
+ import { f as q, D as B } from "../Dialog-CWW597AF.mjs";
18
+ import { DataGridPro as it } from "@mui/x-data-grid-pro";
19
+ import { C as ct } from "../CurrencyText-YUhH2caW.mjs";
20
20
  import { c as Me } from "../Category-CevNQ03n.mjs";
21
- import { b as rt } from "../Localization-2MODESHW.mjs";
21
+ import { b as lt } from "../Localization-2MODESHW.mjs";
22
22
  import { H as be } from "../HeaderCell-DjuifqHJ.mjs";
23
- import { T as A, b as at } from "../ViewMoreMicroCard-B-3SFewe.mjs";
24
- import { A as y, W as Ae } from "../WidgetContainer-CPBhSP3k.mjs";
25
- import { a as Re, T as ke } from "../TransactionDetails-BafSm7_T.mjs";
26
- import { D as fe } from "../Drawer-kEE73B87.mjs";
27
- import { L as Q } from "../Loader-DUaFpDGv.mjs";
28
- import { useTheme as He } from "@mui/material/styles";
29
- import { L as ye } from "../LineChart-DNC5UEt4.mjs";
30
- import { M as it } from "../MiniWidgetContainer-C_N1u9ad.mjs";
31
- import { subMonths as ct } from "date-fns";
32
- import { TrendingUp as lt, TrendingDown as dt, MultilineChart as ht, ExpandLess as ut, ExpandMore as mt } from "@mxenabled/mx-icons";
33
- import { a as gt, f as U } from "../NumberFormatting-CtWHhyBX.mjs";
34
- import { M as pt } from "../MicroWidgetContainer-DVRe-MJs.mjs";
35
- import Ct from "@mui/material/Collapse";
36
- import ft from "@mui/material/List";
37
- import Tt from "@mui/material/ListItem";
38
- import yt from "@mui/material/ListItemButton";
39
- import _t from "@mui/material/ListItemIcon";
40
- import bt from "@mui/material/ListItemText";
41
- import Ne from "@mui/material/styles/useTheme";
42
- import St from "@mui/material/Divider";
43
- import { useTheme as wt, Stack as Dt } from "@mui/material";
44
- import It from "@mui/material/Paper";
45
- import { b as Et } from "../CategoryUtil-BR3H5i6n.mjs";
46
- import { E as Lt } from "../ExportCsvAction-BlKpQTTL.mjs";
47
- import { u as xt } from "../useInsightsEnabled-DqM4sFO1.mjs";
48
- import { E as vt } from "../EmptyState-C0lr9E5T.mjs";
23
+ import { T as A, b as dt } from "../ViewMoreMicroCard-BAz2NyEO.mjs";
24
+ import { A as y, W as Ae } from "../WidgetContainer-C6H2vwT9.mjs";
25
+ import { a as Re, T as ke } from "../TransactionDetails-Fdf0sKuB.mjs";
26
+ import { D as Ce } from "../Drawer-kEE73B87.mjs";
27
+ import { L as J } from "../Loader-DUaFpDGv.mjs";
28
+ import { useTheme as Ne } from "@mui/material/styles";
29
+ import { L as Te } from "../LineChart-DNC5UEt4.mjs";
30
+ import { M as ht } from "../MiniWidgetContainer-C_N1u9ad.mjs";
31
+ import { subMonths as ut } from "date-fns";
32
+ import { TrendingUp as mt, TrendingDown as gt, MultilineChart as pt, ExpandLess as Ct, ExpandMore as ft } from "@mxenabled/mx-icons";
33
+ import { a as Tt, f as Z } from "../NumberFormatting-CtWHhyBX.mjs";
34
+ import { M as yt } from "../MicroWidgetContainer-DVRe-MJs.mjs";
35
+ import _t from "@mui/material/Collapse";
36
+ import bt from "@mui/material/List";
37
+ import St from "@mui/material/ListItem";
38
+ import wt from "@mui/material/ListItemButton";
39
+ import Dt from "@mui/material/ListItemIcon";
40
+ import It from "@mui/material/ListItemText";
41
+ import He from "@mui/material/styles/useTheme";
42
+ import Et from "@mui/material/Divider";
43
+ import { useTheme as Lt, Stack as xt } from "@mui/material";
44
+ import vt from "@mui/material/Paper";
45
+ import { b as Mt } from "../CategoryUtil-BR3H5i6n.mjs";
46
+ import { E as At } from "../ExportCsvAction-BlKpQTTL.mjs";
47
+ import { u as Rt } from "../useInsightsEnabled-DqM4sFO1.mjs";
48
+ import { E as kt } from "../EmptyState-C0lr9E5T.mjs";
49
+ import { j as Nt } from "../ConnectDrawer-jeSmGg38.mjs";
49
50
  const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
50
- et,
51
+ st,
51
52
  {
52
53
  exclusive: !0,
53
54
  onChange: o,
54
55
  orientation: "horizontal",
55
56
  value: n,
56
- children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(Je, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(se, { name: "table_chart_view" }) : /* @__PURE__ */ e(se, { name: "format_list_bulleted" }) }, t))
57
+ children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(ot, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(re, { name: "table_chart_view" }) : /* @__PURE__ */ e(re, { name: "format_list_bulleted" }) }, t))
57
58
  }
58
59
  ), Oe = ({ selectedDateRange: n, selectedCategoryGuid: o }) => {
59
- const { trends: t } = R(), { isMobile: s, isDesktop: a } = K(), { getCategoryName: h } = F(), l = i.useMemo(() => {
60
- const c = Z(
60
+ const { trends: t } = R(), { isMobile: s, isDesktop: i } = K(), { getCategoryName: h } = F(), d = a.useMemo(() => {
61
+ const l = q(
61
62
  n.start,
62
63
  s ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
63
- ), d = Z(
64
+ ), c = q(
64
65
  n.end,
65
66
  s ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
66
67
  );
67
- return `${c} - ${d}`;
68
+ return `${l} - ${c}`;
68
69
  }, [n, s]);
69
- return /* @__PURE__ */ f(O, { sx: { mr: 10, minWidth: "60%" }, children: [
70
+ return /* @__PURE__ */ f(W, { sx: { mr: 10, minWidth: "60%" }, children: [
70
71
  /* @__PURE__ */ e(
71
- X,
72
+ Q,
72
73
  {
73
74
  display: "block",
74
75
  fontWeight: 700,
@@ -77,39 +78,39 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
77
78
  overflow: "visible",
78
79
  textOverflow: "unset"
79
80
  },
80
- variant: a ? "H3" : "Body",
81
+ variant: i ? "H3" : "Body",
81
82
  children: h(o) || t.sub_title
82
83
  }
83
84
  ),
84
- /* @__PURE__ */ e(X, { variant: a ? "Body" : "Small", children: l })
85
+ /* @__PURE__ */ e(Q, { variant: i ? "Body" : "Small", children: d })
85
86
  ] });
86
- }, Mt = (n) => {
87
+ }, Ht = (n) => {
87
88
  const o = n.row[n.field];
88
- return /* @__PURE__ */ e(_, { alignItems: "flex-end", tabIndex: n.tabIndex, children: /* @__PURE__ */ e(st, { amount: o, variant: "Small" }) });
89
- }, At = ({ categoryGuid: n, topLevelCategoryGuid: o }) => {
89
+ return /* @__PURE__ */ e(_, { alignItems: "flex-end", tabIndex: n.tabIndex, children: /* @__PURE__ */ e(ct, { amount: o, variant: "Small" }) });
90
+ }, Wt = ({ categoryGuid: n, topLevelCategoryGuid: o }) => {
90
91
  const { categories: t } = R(), s = t.default_categories[n]?.replace(/&/g, "&") ?? Me[n];
91
92
  return /* @__PURE__ */ f(_, { alignItems: "center", direction: "row", justifyContent: "center", children: [
92
93
  /* @__PURE__ */ e(
93
- O,
94
+ W,
94
95
  {
95
- "aria-label": rt(t.category_icon_label_aria, s),
96
+ "aria-label": lt(t.category_icon_label_aria, s),
96
97
  role: "img",
97
- children: /* @__PURE__ */ e(Te, { categoryGuid: o })
98
+ children: /* @__PURE__ */ e(fe, { categoryGuid: o })
98
99
  }
99
100
  ),
100
- /* @__PURE__ */ e(X, { sx: { ml: 12, pb: 6 }, variant: "Small", children: s })
101
+ /* @__PURE__ */ e(Q, { sx: { ml: 12, pb: 6 }, variant: "Small", children: s })
101
102
  ] });
102
- }, Rt = (n) => /* @__PURE__ */ e(_, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
103
- At,
103
+ }, Ot = (n) => /* @__PURE__ */ e(_, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
104
+ Wt,
104
105
  {
105
106
  categoryGuid: n.row.category,
106
107
  topLevelCategoryGuid: n.row.top_level_category_guid
107
108
  }
108
- ) }), kt = (n, o) => {
109
+ ) }), Vt = (n, o) => {
109
110
  const t = [], s = new Date(n);
110
111
  for (; s <= o; ) {
111
- const a = Z(s, B.MONTH);
112
- t.push(a), s.setMonth(s.getMonth() + 1);
112
+ const i = q(s, B.MONTH);
113
+ t.push(i), s.setMonth(s.getMonth() + 1);
113
114
  }
114
115
  return t;
115
116
  }, Ve = ({
@@ -117,19 +118,19 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
117
118
  selectedDateRange: o,
118
119
  selectedCategory: t,
119
120
  onClickRow: s,
120
- height: a = "100dvh",
121
+ height: i = "100dvh",
121
122
  sx: h = {}
122
123
  }) => {
123
- const { onEvent: l } = H(), c = Z(/* @__PURE__ */ new Date(), B.MONTH_SHORT), [d, m] = i.useState([
124
- { field: c, sort: "desc" }
125
- ]), C = i.useMemo(() => kt(o.start, o.end), [o]), u = [
124
+ const { onEvent: d } = N(), l = q(/* @__PURE__ */ new Date(), B.MONTH_SHORT), [c, m] = a.useState([
125
+ { field: l, sort: "desc" }
126
+ ]), C = a.useMemo(() => Vt(o.start, o.end), [o]), u = [
126
127
  {
127
128
  field: "category",
128
129
  flex: 1,
129
130
  headerName: "Category",
130
131
  minWidth: 175,
131
132
  renderHeader: be,
132
- renderCell: Rt,
133
+ renderCell: Ot,
133
134
  sortable: !0,
134
135
  type: "string"
135
136
  },
@@ -140,162 +141,162 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
140
141
  headerName: r,
141
142
  minWidth: 100,
142
143
  renderHeader: be,
143
- renderCell: Mt,
144
+ renderCell: Ht,
144
145
  align: "right",
145
146
  headerAlign: "right",
146
147
  sortable: !0,
147
148
  hideSortIcons: !1,
148
149
  type: "number",
149
- sortComparator: Ke
150
+ sortComparator: Ue
150
151
  })
151
152
  )
152
- ], b = i.useMemo(() => {
153
+ ], b = a.useMemo(() => {
153
154
  const r = n.filter(
154
- (p) => !Ye(p) && !Ue(p)
155
+ (p) => !Qe(p) && !qe(p)
155
156
  ), T = (t ? r.filter(
156
157
  (p) => p.category_guid === t || p.top_level_category_guid === t
157
158
  ) : r).reduce(
158
- (p, E) => {
159
- const { category_guid: w, top_level_category_guid: I, month: k, total: D, year: N } = E, x = t ? w : I;
160
- p[x] || (p[x] = {
161
- id: x,
162
- category: x,
159
+ (p, L) => {
160
+ const { category_guid: w, top_level_category_guid: E, month: k, total: D, year: O } = L, M = t ? w : E;
161
+ p[M] || (p[M] = {
162
+ id: M,
163
+ category: M,
163
164
  category_guid: w,
164
- top_level_category_guid: I
165
+ top_level_category_guid: E
165
166
  });
166
- const L = Z(new Date(N, k - 1), B.MONTH_SHORT);
167
- return p[x][L] || (p[x][L] = 0), p[x][L] = p[x][L] + Math.abs(D), p;
167
+ const I = q(new Date(O, k - 1), B.MONTH_SHORT);
168
+ return p[M][I] || (p[M][I] = 0), p[M][I] = p[M][I] + Math.abs(D), p;
168
169
  },
169
170
  {}
170
171
  );
171
172
  return Object.values(T);
172
173
  }, [n, t]);
173
- return /* @__PURE__ */ e(O, { sx: { height: a, width: "100%", overflowX: "auto", boxShadow: "none", ...h }, children: /* @__PURE__ */ e(
174
- ot,
174
+ return /* @__PURE__ */ e(W, { sx: { height: i, width: "100%", overflowX: "auto", boxShadow: "none", ...h }, children: /* @__PURE__ */ e(
175
+ it,
175
176
  {
176
177
  columns: u,
177
178
  disableColumnFilter: !0,
178
179
  disableColumnMenu: !0,
179
180
  hideFooter: !0,
180
- initialState: { sorting: { sortModel: d } },
181
+ initialState: { sorting: { sortModel: c } },
181
182
  onRowClick: (r) => {
182
- s?.(r.row.category), l(y.TRENDS_CLICK_LIST_ITEM, {
183
+ s?.(r.row.category), d(y.TRENDS_CLICK_LIST_ITEM, {
183
184
  ...A,
184
185
  listItem: Me[r.row.category]
185
186
  });
186
187
  },
187
188
  onSortModelChange: (r) => {
188
- m(r), l(y.TRENDS_CLICK_TABLE_SORT, A);
189
+ m(r), d(y.TRENDS_CLICK_TABLE_SORT, A);
189
190
  },
190
191
  rows: b,
191
192
  slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
192
- sortModel: d,
193
+ sortModel: c,
193
194
  sortingOrder: ["asc", "desc"]
194
195
  }
195
196
  ) });
196
- }, Ht = {
197
+ }, Gt = {
197
198
  title: "Transaction List"
198
- }, Nt = ({
199
+ }, Bt = ({
199
200
  categoryGuid: n,
200
201
  dateRange: o,
201
202
  isOpen: t,
202
203
  onClose: s
203
204
  }) => {
204
- const { onEvent: a } = H(), { selectedAccountGuids: h } = P(), { common: l } = R(), { setFilter: c, sortedTransactions: d } = re(), [m, C] = i.useState(""), u = i.useMemo(
205
- () => d.find((r) => r.guid === m),
206
- [m, d]
205
+ const { onEvent: i } = N(), { selectedAccountGuids: h } = P(), { common: d } = R(), { setFilter: l, sortedTransactions: c } = ae(), [m, C] = a.useState(""), u = a.useMemo(
206
+ () => c.find((r) => r.guid === m),
207
+ [m, c]
207
208
  );
208
- i.useEffect(() => {
209
- c({
209
+ a.useEffect(() => {
210
+ l({
210
211
  accounts: h,
211
212
  dateRange: o,
212
213
  custom: (r) => n === "" || n === r.category_guid || n === r.top_level_category_guid,
213
214
  showSplits: !!n
214
215
  });
215
- }, [h, n, o]), i.useEffect(() => a(y.TRENDS_VIEW_TRANSACTIONS), []);
216
+ }, [h, n, o]), a.useEffect(() => i(y.TRENDS_VIEW_TRANSACTIONS), []);
216
217
  const b = () => {
217
218
  C(""), s();
218
219
  };
219
220
  return /* @__PURE__ */ f(
220
- fe,
221
+ Ce,
221
222
  {
222
- ariaLabelClose: l.close_aria,
223
+ ariaLabelClose: d.close_aria,
223
224
  isOpen: t,
224
225
  onClose: b,
225
- title: Ht.title,
226
+ title: Gt.title,
226
227
  children: [
227
228
  u && /* @__PURE__ */ e(Re, { transaction: u }),
228
229
  !u && /* @__PURE__ */ e(ke, { onClick: C })
229
230
  ]
230
231
  }
231
232
  );
232
- }, Wt = M(Nt), Ot = ({ onBackClick: n, sx: o }) => {
233
- const { onEvent: t } = H(), { isDesktop: s, isTablet: a, isMobile: h } = K(), { visibleAccounts: l } = ae(), { loadMonthlyCategoryTotals: c, monthlyCategoryTotals: d, getCategoryName: m } = F(), { sortedTransactions: C } = re(), { selectedDateRange: u, setSelectedDateRange: b } = q(), { isCopyLoaded: r, isInitialized: g, selectedAccounts: T, setSelectedAccounts: p } = P(), { trends: E } = R(), [w, I] = i.useState(!1), [k, D] = i.useState(!1), [N, x] = i.useState("Chart"), [L, $] = i.useState(""), [z, ie] = i.useState(window.innerHeight), ee = z - (h ? 315 : 345);
234
- i.useEffect(() => {
235
- const S = () => ie(window.innerHeight);
233
+ }, zt = v(Bt), Ft = ({ onBackClick: n, sx: o }) => {
234
+ const { onEvent: t } = N(), { isDesktop: s, isTablet: i, isMobile: h } = K(), { visibleAccounts: d } = ie(), { loadMonthlyCategoryTotals: l, monthlyCategoryTotals: c, getCategoryName: m } = F(), { sortedTransactions: C } = ae(), { selectedDateRange: u, setSelectedDateRange: b } = ee(), { isCopyLoaded: r, isInitialized: g, selectedAccounts: T, setSelectedAccounts: p } = P(), { trends: L } = R(), [w, E] = a.useState(!1), [k, D] = a.useState(!1), [O, M] = a.useState("Chart"), [I, $] = a.useState(""), [ce, z] = a.useState(window.innerHeight), j = ce - (h ? 315 : 345);
235
+ a.useEffect(() => {
236
+ const S = () => z(window.innerHeight);
236
237
  return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
237
- }, []), i.useEffect(() => {
238
- p(l);
239
- }, [l]), i.useEffect(() => {
240
- g && c(
238
+ }, []), a.useEffect(() => {
239
+ p(d);
240
+ }, [d]), a.useEffect(() => {
241
+ g && l(
241
242
  T,
242
243
  u.start,
243
244
  u.end
244
245
  ).finally(() => {
245
- I(!0);
246
+ E(!0);
246
247
  });
247
248
  }, [g, T, u]);
248
- const te = i.useMemo(() => {
249
+ const Y = a.useMemo(() => {
249
250
  if (!w) return { stackedDatasets: [], unstackedDatasets: [] };
250
- const S = $e(
251
- d,
251
+ const S = Xe(
252
+ c,
252
253
  u.start,
253
254
  u.end
254
- ), W = L.length ? S.filter(
255
- (G) => G.top_level_category_guid === L || G.category_guid === L
256
- ) : Xe(S);
255
+ ), H = I.length ? S.filter(
256
+ (G) => G.top_level_category_guid === I || G.category_guid === I
257
+ ) : Je(S);
257
258
  return {
258
- stackedDatasets: W.filter(Ze),
259
- unstackedDatasets: W.filter(Qe)
259
+ stackedDatasets: H.filter(et),
260
+ unstackedDatasets: H.filter(tt)
260
261
  };
261
- }, [d, L, u]), ne = (S, W) => {
262
- x(W ?? N), t(y.TRENDS_CLICK_TOGGLE_VIEW);
263
- }, oe = (S) => {
264
- const W = Ie(S?.[0], 1), G = S?.[1], ge = Ce(G, W);
265
- b({ start: W, end: G }), t(y.TRENDS_CLICK_TIME_WINDOW, {
266
- time_period: ge + "M"
262
+ }, [c, I, u]), le = (S, H) => {
263
+ M(H ?? O), t(y.TRENDS_CLICK_TOGGLE_VIEW);
264
+ }, te = (S) => {
265
+ const H = Ie(S?.[0], 1), G = S?.[1], me = pe(G, H);
266
+ b({ start: H, end: G }), t(y.TRENDS_CLICK_TIME_WINDOW, {
267
+ time_period: me + "M"
267
268
  });
268
- }, ce = () => {
269
+ }, ne = () => {
269
270
  t(y.TRENDS_CLICK_FILTER);
270
- }, le = (S) => {
271
- $(S);
272
271
  }, de = (S) => {
272
+ $(S);
273
+ }, oe = (S) => {
273
274
  $(S), t(y.TRENDS_CLICK_LEGEND, { category: m(S) });
274
275
  }, he = (S) => {
275
276
  t(y.TRENDS_HOVER_LEGEND, { category: m(S) });
276
277
  }, ue = (S) => {
277
278
  t(y.TRENDS_HOVER_AREA, { category: S });
278
- }, me = (S) => {
279
+ }, se = (S) => {
279
280
  t(y.TRENDS_HOVER_POINT, { category: S });
280
281
  };
281
- return !r || !g || !w ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ f(
282
+ return !r || !g || !w ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ f(
282
283
  Ae,
283
284
  {
284
- accountOptions: l,
285
- calendarActions: { onRangeChanged: oe },
285
+ accountOptions: d,
286
+ calendarActions: { onRangeChanged: te },
286
287
  dateRange: u,
287
288
  dateRangeVariant: "timeframebuttons",
288
- onAccountsFilterClick: ce,
289
+ onAccountsFilterClick: ne,
289
290
  onBackClick: n,
290
291
  sx: o,
291
- title: E.title,
292
+ title: L.title,
292
293
  children: [
293
294
  /* @__PURE__ */ f(
294
295
  _,
295
296
  {
296
297
  sx: {
297
298
  // eslint-disable-next-line no-nested-ternary
298
- px: s ? 48 : a ? 24 : 12
299
+ px: s ? 48 : i ? 24 : 12
299
300
  },
300
301
  children: [
301
302
  /* @__PURE__ */ f(
@@ -308,40 +309,40 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
308
309
  /* @__PURE__ */ e(
309
310
  Oe,
310
311
  {
311
- selectedCategoryGuid: L,
312
+ selectedCategoryGuid: I,
312
313
  selectedDateRange: u
313
314
  }
314
315
  ),
315
- /* @__PURE__ */ e(We, { onTabChange: ne, selectedTab: N })
316
+ /* @__PURE__ */ e(We, { onTabChange: le, selectedTab: O })
316
317
  ]
317
318
  }
318
319
  ),
319
320
  /* @__PURE__ */ f(_, { alignItems: "center", flexDirection: "row", width: "100%", children: [
320
- /* @__PURE__ */ e(O, { flexGrow: 1, children: L && /* @__PURE__ */ f(pe, { onClick: () => $(""), sx: { p: 0, pr: 5 }, children: [
321
- /* @__PURE__ */ e(se, { name: "arrow_back" }),
322
- E.all_categories
321
+ /* @__PURE__ */ e(W, { flexGrow: 1, children: I && /* @__PURE__ */ f(ge, { onClick: () => $(""), sx: { p: 0, pr: 5 }, children: [
322
+ /* @__PURE__ */ e(re, { name: "arrow_back" }),
323
+ L.all_categories
323
324
  ] }) }),
324
- /* @__PURE__ */ e(pe, { onClick: () => D(!0), sx: { px: 5 }, children: `${E.view_transactions} (${C.length})` })
325
+ /* @__PURE__ */ e(ge, { onClick: () => D(!0), sx: { px: 5 }, children: `${L.view_transactions} (${C.length})` })
325
326
  ] }),
326
- /* @__PURE__ */ f(O, { children: [
327
- N === "Chart" && /* @__PURE__ */ e(
328
- je,
327
+ /* @__PURE__ */ f(W, { children: [
328
+ O === "Chart" && /* @__PURE__ */ e(
329
+ Ze,
329
330
  {
330
- availableHeight: ee,
331
- onClickLegend: de,
331
+ availableHeight: j,
332
+ onClickLegend: oe,
332
333
  onHoverArea: ue,
333
334
  onHoverLegend: he,
334
- onHoverPoint: me,
335
- stackedDatasets: te.stackedDatasets,
336
- unstackedDatasets: te.unstackedDatasets
335
+ onHoverPoint: se,
336
+ stackedDatasets: Y.stackedDatasets,
337
+ unstackedDatasets: Y.unstackedDatasets
337
338
  }
338
339
  ),
339
- N === "Table" && /* @__PURE__ */ e(
340
+ O === "Table" && /* @__PURE__ */ e(
340
341
  Ve,
341
342
  {
342
- monthlyCategoryTotals: d,
343
- onClickRow: le,
344
- selectedCategory: L,
343
+ monthlyCategoryTotals: c,
344
+ onClickRow: de,
345
+ selectedCategory: I,
345
346
  selectedDateRange: u
346
347
  }
347
348
  )
@@ -350,9 +351,9 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
350
351
  }
351
352
  ),
352
353
  /* @__PURE__ */ e(
353
- Wt,
354
+ zt,
354
355
  {
355
- categoryGuid: L,
356
+ categoryGuid: I,
356
357
  dateRange: u,
357
358
  isOpen: k,
358
359
  onClose: () => D(!1)
@@ -361,10 +362,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
361
362
  ]
362
363
  }
363
364
  );
364
- }, Xn = M(Ot), Vt = () => {
365
- const n = He(), { monthlyCategoryTotals: o } = F(), { trends: t } = R(), s = qe(o);
365
+ }, to = v(Ft), Pt = () => {
366
+ const n = Ne(), { monthlyCategoryTotals: o } = F(), { trends: t } = R(), s = nt(o);
366
367
  return /* @__PURE__ */ e(
367
- ye,
368
+ Te,
368
369
  {
369
370
  baseline: "min",
370
371
  colors: [n.palette.primary.main],
@@ -379,35 +380,35 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
379
380
  valueFormatterString: "0,0"
380
381
  }
381
382
  );
382
- }, Gt = M(Vt), Bt = ({ onPrimaryCtaClick: n, sx: o }) => {
383
- const { visibleAccounts: t } = ae(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: a } = F(), { isInitialized: h } = ve(), { trends: l } = R(), { isCopyLoaded: c, selectedAccounts: d, setSelectedAccounts: m } = P();
384
- return i.useEffect(() => {
383
+ }, Kt = v(Pt), $t = ({ onPrimaryCtaClick: n, sx: o }) => {
384
+ const { visibleAccounts: t } = ie(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: i } = F(), { isInitialized: h } = ve(), { trends: d } = R(), { isCopyLoaded: l, selectedAccounts: c, setSelectedAccounts: m } = P();
385
+ return a.useEffect(() => {
385
386
  m(t);
386
- }, [t]), i.useEffect(() => {
387
- h && s(d).finally();
388
- }, [h, d]), !c || !h ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ e(
389
- it,
387
+ }, [t]), a.useEffect(() => {
388
+ h && s(c).finally();
389
+ }, [h, c]), !l || !h ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
390
+ ht,
390
391
  {
391
392
  onPrimaryCtaClick: n,
392
- primaryCtaLabel: l.primary_cta,
393
- subTitle: l.sub_title,
393
+ primaryCtaLabel: d.primary_cta,
394
+ subTitle: d.sub_title,
394
395
  sx: o,
395
- title: l.mini_title,
396
- children: a ? /* @__PURE__ */ e(Gt, {}) : /* @__PURE__ */ e(Q, {})
396
+ title: d.mini_title,
397
+ children: i ? /* @__PURE__ */ e(Kt, {}) : /* @__PURE__ */ e(J, {})
397
398
  }
398
399
  );
399
- }, Zn = M(Bt), zt = 70, Se = ({
400
+ }, no = v($t), jt = 70, Se = ({
400
401
  title: n,
401
402
  totalAmount: o,
402
403
  transactionType: t,
403
404
  percentage: s,
404
- secondaryLabel: a,
405
+ secondaryLabel: i,
405
406
  shouldDisplayPercentage: h
406
407
  }) => {
407
- const { availableWidth: l } = tt(), c = i.useRef(null), d = i.useRef(null), m = gt(Number(Math.abs(s)), {
408
+ const { availableWidth: d } = rt(), l = a.useRef(null), c = a.useRef(null), m = Tt(Number(Math.abs(s)), {
408
409
  style: "percent",
409
410
  minimumIntegerDigits: 1
410
- }), C = l === 288 && U(o, "0,0.00").length > 10 ? U(o, "0,0") : U(o, "0,0.00"), u = t === "spending" ? s > 0 : s >= 0, b = t === "spending" ? "error.main" : "success.main", r = t === "spending" ? "success.main" : "text.secondary", g = c?.current, T = d?.current, p = g && T ? g.scrollWidth > T.clientWidth - zt : !1;
411
+ }), C = d === 288 && Z(o, "0,0.00").length > 10 ? Z(o, "0,0") : Z(o, "0,0.00"), u = t === "spending" ? s > 0 : s >= 0, b = t === "spending" ? "error.main" : "success.main", r = t === "spending" ? "success.main" : "text.secondary", g = l?.current, T = c?.current, p = g && T ? g.scrollWidth > T.clientWidth - jt : !1;
411
412
  return /* @__PURE__ */ f(
412
413
  _,
413
414
  {
@@ -430,11 +431,11 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
430
431
  justifyContent: "space-between"
431
432
  },
432
433
  children: [
433
- /* @__PURE__ */ e(Y, { color: "text.secondary", variant: "caption", children: n }),
434
+ /* @__PURE__ */ e(X, { color: "text.secondary", variant: "caption", children: n }),
434
435
  h && /* @__PURE__ */ f(_, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
435
- u ? /* @__PURE__ */ e(lt, { size: 20, sx: { color: b } }) : /* @__PURE__ */ e(dt, { size: 20, sx: { color: r } }),
436
+ u ? /* @__PURE__ */ e(mt, { size: 20, sx: { color: b } }) : /* @__PURE__ */ e(gt, { size: 20, sx: { color: r } }),
436
437
  /* @__PURE__ */ e(
437
- Y,
438
+ X,
438
439
  {
439
440
  sx: {
440
441
  color: u ? b : r,
@@ -451,7 +452,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
451
452
  /* @__PURE__ */ f(
452
453
  _,
453
454
  {
454
- ref: d,
455
+ ref: c,
455
456
  sx: {
456
457
  alignItems: "center",
457
458
  flexDirection: "row",
@@ -459,19 +460,19 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
459
460
  },
460
461
  children: [
461
462
  /* @__PURE__ */ e(
462
- O,
463
+ W,
463
464
  {
464
- ref: c,
465
+ ref: l,
465
466
  sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
466
467
  children: /* @__PURE__ */ e(De, { children: C })
467
468
  }
468
469
  ),
469
- h && l >= 450 && !p && /* @__PURE__ */ e(
470
- Y,
470
+ h && d >= 450 && !p && /* @__PURE__ */ e(
471
+ X,
471
472
  {
472
473
  color: u ? b : r,
473
474
  variant: "caption",
474
- children: a
475
+ children: i
475
476
  }
476
477
  )
477
478
  ]
@@ -480,49 +481,49 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
480
481
  ]
481
482
  }
482
483
  );
483
- }, Ft = M(() => {
484
+ }, Yt = v(() => {
484
485
  const { trends: n } = R();
485
486
  return /* @__PURE__ */ f(_, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
486
- /* @__PURE__ */ e(ht, { size: 32 }),
487
+ /* @__PURE__ */ e(pt, { size: 32 }),
487
488
  /* @__PURE__ */ f(_, { children: [
488
- /* @__PURE__ */ e(Y, { fontWeight: 600, variant: "body1", children: n.zero_state_content_header }),
489
- /* @__PURE__ */ e(Y, { color: "text.secondary", variant: "subtitle2", children: n.zero_state_content_description })
489
+ /* @__PURE__ */ e(X, { fontWeight: 600, variant: "body1", children: n.zero_state_content_header }),
490
+ /* @__PURE__ */ e(X, { color: "text.secondary", variant: "subtitle2", children: n.zero_state_content_description })
490
491
  ] })
491
492
  ] });
492
- }), Qn = M(({ onCtaClick: n }) => {
493
- const { visibleAccounts: o } = ae(), { onEvent: t } = H(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: a, monthlyTotalsLoaded: h } = F(), l = {
494
- start: ct(/* @__PURE__ */ new Date(), 1),
493
+ }), oo = v(({ onCtaClick: n }) => {
494
+ const { visibleAccounts: o } = ie(), { onEvent: t } = N(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: i, monthlyTotalsLoaded: h } = F(), d = {
495
+ start: ut(/* @__PURE__ */ new Date(), 1),
495
496
  end: /* @__PURE__ */ new Date()
496
- }, { trends: c } = R(), { selectedAccounts: d, setSelectedAccounts: m, isInitialized: C } = P();
497
- i.useEffect(() => {
497
+ }, { trends: l } = R(), { selectedAccounts: c, setSelectedAccounts: m, isInitialized: C } = P();
498
+ a.useEffect(() => {
498
499
  m(o);
499
- }, [o]), i.useEffect(() => {
500
- C && a(d, l.start).then(() => {
500
+ }, [o]), a.useEffect(() => {
501
+ C && i(c, d.start).then(() => {
501
502
  t(y.TRENDS_LOAD_WIDGET, {
502
503
  state: o?.length ? "default" : "zeroState"
503
504
  });
504
505
  });
505
- }, [C, d]);
506
- const { spendingData: u, incomeData: b } = i.useMemo(
506
+ }, [C, c]);
507
+ const { spendingData: u, incomeData: b } = a.useMemo(
507
508
  () => ({
508
- spendingData: Le(s, l),
509
- incomeData: xe(s, l)
509
+ spendingData: Le(s, d),
510
+ incomeData: xe(s, d)
510
511
  }),
511
- [s, l]
512
- ), [r, g] = u, [T, p] = b, E = _e(g.y, r.y), w = _e(p.y, T.y), I = C && !o?.length, k = () => {
512
+ [s, d]
513
+ ), [r, g] = u, [T, p] = b, L = _e(g.y, r.y), w = _e(p.y, T.y), E = C && !o?.length, k = () => {
513
514
  t(
514
- I ? y.TRENDS_CLICK_GET_STARTED : y.TRENDS_CLICK_VIEW_MORE
515
+ E ? y.TRENDS_CLICK_GET_STARTED : y.TRENDS_CLICK_VIEW_MORE
515
516
  ), n();
516
517
  };
517
- return !h || !C ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ e(
518
- pt,
518
+ return !h || !C ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ e(
519
+ yt,
519
520
  {
520
521
  className: "mx-trends-microwidget",
521
- ctaLabel: c.micro_primary_cta_label,
522
+ ctaLabel: l.micro_primary_cta_label,
522
523
  onCTAClick: k,
523
- subHeader: I ? void 0 : c.micro_subheader,
524
- title: c.title,
525
- children: I ? /* @__PURE__ */ e(Ft, {}) : /* @__PURE__ */ f(
524
+ subHeader: E ? void 0 : l.micro_subheader,
525
+ title: l.title,
526
+ children: E ? /* @__PURE__ */ e(Yt, {}) : /* @__PURE__ */ f(
526
527
  _,
527
528
  {
528
529
  sx: {
@@ -534,10 +535,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
534
535
  /* @__PURE__ */ e(
535
536
  Se,
536
537
  {
537
- percentage: E,
538
- secondaryLabel: c.micro_secondary_label,
538
+ percentage: L,
539
+ secondaryLabel: l.micro_secondary_label,
539
540
  shouldDisplayPercentage: g.y !== 0 && r.y !== 0,
540
- title: c.spending_label,
541
+ title: l.spending_label,
541
542
  totalAmount: g.y,
542
543
  transactionType: "spending"
543
544
  }
@@ -546,9 +547,9 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
546
547
  Se,
547
548
  {
548
549
  percentage: w,
549
- secondaryLabel: c.micro_secondary_label,
550
+ secondaryLabel: l.micro_secondary_label,
550
551
  shouldDisplayPercentage: p.y !== 0 && T.y !== 0,
551
- title: c.income_label,
552
+ title: l.income_label,
552
553
  totalAmount: p.y,
553
554
  transactionType: "income"
554
555
  }
@@ -558,17 +559,17 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
558
559
  )
559
560
  }
560
561
  );
561
- }), Pt = M(
562
+ }), Ut = v(
562
563
  ({ isExpanded: n, onClick: o }) => {
563
- const t = Ne();
564
- return /* @__PURE__ */ e(Tt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(yt, { onClick: o, sx: { justifyContent: "center" }, children: /* @__PURE__ */ f(
564
+ const t = He();
565
+ return /* @__PURE__ */ e(St, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(wt, { onClick: o, sx: { justifyContent: "center" }, children: /* @__PURE__ */ f(
565
566
  _,
566
567
  {
567
568
  sx: { color: t.palette.primary.main, flexDirection: "row", alignItems: "center" },
568
569
  children: [
569
- /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ e(X, { bold: !0, variant: "body2", children: n ? "View less" : "View more" }) }),
570
- /* @__PURE__ */ e(_t, { sx: { color: t.palette.primary.main }, children: n ? /* @__PURE__ */ e(ut, {}) : /* @__PURE__ */ e(
571
- mt,
570
+ /* @__PURE__ */ e(It, { children: /* @__PURE__ */ e(Q, { bold: !0, variant: "body2", children: n ? "View less" : "View more" }) }),
571
+ /* @__PURE__ */ e(Dt, { sx: { color: t.palette.primary.main }, children: n ? /* @__PURE__ */ e(Ct, {}) : /* @__PURE__ */ e(
572
+ ft,
572
573
  {
573
574
  sx: {
574
575
  transition: "transform 0.3s ease-in-out",
@@ -580,51 +581,51 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
580
581
  }
581
582
  ) }) });
582
583
  }
583
- ), we = M(
584
+ ), we = v(
584
585
  ({
585
586
  totalAmount: n,
586
587
  guid: o,
587
588
  name: t,
588
589
  transactions: s,
589
- onClick: a,
590
+ onClick: i,
590
591
  isLastItem: h = !1,
591
- showDivider: l = !0
592
+ showDivider: d = !0
592
593
  }) => {
593
- const { trends: c } = R(), { onEvent: d } = H(), m = `${s.length} ${s.length === 1 ? c.transaction : c.transactions}`, C = () => {
594
- a?.(), d(y.TRENDS_CLICK_LIST_ITEM, {
594
+ const { trends: l } = R(), { onEvent: c } = N(), m = `${s.length} ${s.length === 1 ? l.transaction : l.transactions}`, C = () => {
595
+ i?.(), c(y.TRENDS_CLICK_LIST_ITEM, {
595
596
  ...A,
596
597
  listItem: t
597
598
  });
598
599
  };
599
- return /* @__PURE__ */ f(i.Fragment, { children: [
600
+ return /* @__PURE__ */ f(a.Fragment, { children: [
600
601
  /* @__PURE__ */ e(
601
602
  Ee,
602
603
  {
603
- leftIcon: o ? /* @__PURE__ */ e(Te, { categoryGuid: o }) : void 0,
604
+ leftIcon: o ? /* @__PURE__ */ e(fe, { categoryGuid: o }) : void 0,
604
605
  onClick: C,
605
- rightContent: U(Math.abs(n), "0,0.00"),
606
- rightIcon: a ? /* @__PURE__ */ e(Pe, {}) : void 0,
606
+ rightContent: Z(Math.abs(n), "0,0.00"),
607
+ rightIcon: i ? /* @__PURE__ */ e(Ye, {}) : void 0,
607
608
  subtitle: m,
608
609
  title: t
609
610
  }
610
611
  ),
611
- l && /* @__PURE__ */ e(St, { sx: { ml: h ? 24 : 68 } })
612
+ d && /* @__PURE__ */ e(Et, { sx: { ml: h ? 24 : 68 } })
612
613
  ] }, o);
613
614
  }
614
- ), Kt = M(
615
+ ), Xt = v(
615
616
  ({ availableHeight: n = 0, onCategoryClick: o }) => {
616
- const { collapsedCategories: t, visibleCategories: s, setVisibleListLength: a } = q(), { isLargeDesktop: h, isDesktop: l } = K(), { trends: c } = R(), { onEvent: d } = H(), [m, C] = i.useState(!1), u = l || h;
617
- i.useEffect(() => {
617
+ const { collapsedCategories: t, visibleCategories: s, setVisibleListLength: i } = ee(), { isLargeDesktop: h, isDesktop: d } = K(), { trends: l } = R(), { onEvent: c } = N(), [m, C] = a.useState(!1), u = d || h;
618
+ a.useEffect(() => {
618
619
  const g = Math.floor(n / 64) - 1, T = s.length + t.length;
619
- g !== s.length && (a(u ? Math.max(g, 5) : 5), C(g >= T));
620
+ g !== s.length && (i(u ? Math.max(g, 5) : 5), C(g >= T));
620
621
  }, [n]);
621
622
  const b = () => {
622
- C(!m), d(y.TRENDS_CLICK_VIEW_MORE, {
623
+ C(!m), c(y.TRENDS_CLICK_VIEW_MORE, {
623
624
  ...A
624
625
  });
625
626
  }, r = s.length + (m ? t.length : 0);
626
- return /* @__PURE__ */ e(_, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f(ft, { children: [
627
- /* @__PURE__ */ e(_, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(De, { children: c.categories }) }),
627
+ return /* @__PURE__ */ e(_, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f(bt, { children: [
628
+ /* @__PURE__ */ e(_, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(De, { children: l.categories }) }),
628
629
  s.map((g, T) => /* @__PURE__ */ e(
629
630
  we,
630
631
  {
@@ -636,7 +637,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
636
637
  g.guid
637
638
  )),
638
639
  /* @__PURE__ */ e(
639
- Ct,
640
+ _t,
640
641
  {
641
642
  in: m,
642
643
  sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
@@ -655,10 +656,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
655
656
  })
656
657
  }
657
658
  ),
658
- t.length > 0 && /* @__PURE__ */ e(Pt, { isExpanded: m, onClick: b })
659
+ t.length > 0 && /* @__PURE__ */ e(Ut, { isExpanded: m, onClick: b })
659
660
  ] }) });
660
661
  }
661
- ), $t = [
662
+ ), Zt = [
662
663
  "BillAmountNotStandard",
663
664
  "CategorySpendingV2",
664
665
  "CostOfLivingToIncome",
@@ -692,46 +693,46 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
692
693
  "WeeklyNewMerchantsV2",
693
694
  "WeeklyNoSpendDays",
694
695
  "WeeklySmallPurchasesSummary"
695
- ], jt = ({ onInsightCardClick: n }) => {
696
- const o = wt(), { onEvent: t } = H(), { isMobile: s, isDesktop: a, isLargeDesktop: h } = K(), { beatStore: l, endpoint: c, sessionToken: d } = ve(), { isInitialized: m } = P(), [C, u] = i.useState(!1), b = o.palette.mode === "dark", r = a || h, g = r || s ? 1 : 2;
697
- i.useEffect(() => {
698
- m && l.loadBeats().finally(() => u(!0));
696
+ ], Qt = ({ onInsightCardClick: n }) => {
697
+ const o = Lt(), { onEvent: t } = N(), { isMobile: s, isDesktop: i, isLargeDesktop: h } = K(), { beatStore: d, endpoint: l, sessionToken: c } = ve(), { isInitialized: m } = P(), [C, u] = a.useState(!1), b = o.palette.mode === "dark", r = i || h, g = r || s ? 1 : 2;
698
+ a.useEffect(() => {
699
+ m && d.loadBeats().finally(() => u(!0));
699
700
  }, [m]);
700
- const T = i.useMemo(() => C ? l.getFilteredBeats({ templates: $t }) : [], [C]), p = () => null, E = (D) => {
701
+ const T = a.useMemo(() => C ? d.getFilteredBeats({ templates: Zt }) : [], [C]), p = () => null, L = (D) => {
701
702
  n?.(D), t(y.TRENDS_CLICK_INSIGHT, A);
702
- }, w = r ? 200 : 170, I = r ? 170 : 124, k = T.length > 0 ? w : I;
703
- return /* @__PURE__ */ e(Dt, { sx: { height: k }, children: /* @__PURE__ */ e(
704
- at,
703
+ }, w = r ? 200 : 170, E = r ? 170 : 124, k = T.length > 0 ? w : E;
704
+ return /* @__PURE__ */ e(xt, { sx: { height: k }, children: /* @__PURE__ */ e(
705
+ dt,
705
706
  {
706
- areBeatsLoading: l.isLoading,
707
+ areBeatsLoading: d.isLoading,
707
708
  beats: T,
708
- endpoint: c,
709
+ endpoint: l,
709
710
  logOutUser: p,
710
- onCardClick: E,
711
+ onCardClick: L,
711
712
  showBorder: !0,
712
713
  showCTAColocatedWithText: !1,
713
714
  showCarouselControls: !0,
714
715
  showHeader: r,
715
716
  showIcon: !0,
716
717
  showWithMargin: !1,
717
- token: d,
718
+ token: c,
718
719
  useDarkMode: b,
719
720
  userHasFullInsightFeedBeats: !1,
720
721
  variant: "outlined",
721
722
  visibleCardsCount: g
722
723
  }
723
724
  ) });
724
- }, Yt = M(jt), Ut = M(({ chartLabel: n, chartColor: o }) => {
725
- const { onEvent: t } = H(), {
726
- categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels: a }
727
- } = q();
725
+ }, qt = v(Qt), Jt = v(({ chartLabel: n, chartColor: o }) => {
726
+ const { onEvent: t } = N(), {
727
+ categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels: i }
728
+ } = ee();
728
729
  return /* @__PURE__ */ e(_, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
729
- ye,
730
+ Te,
730
731
  {
731
732
  baseline: "min",
732
733
  colors: [o],
733
734
  curveType: "bump",
734
- customTooltipLabels: a,
735
+ customTooltipLabels: i,
735
736
  datasets: [s],
736
737
  height: 265,
737
738
  labels: [n],
@@ -754,97 +755,97 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
754
755
  valueFormatterString: "0,0"
755
756
  }
756
757
  ) });
757
- }), Xt = M(({ onClose: n }) => {
758
- const o = Ne(), { onEvent: t } = H(), { common: s, trends: a } = R(), { selectedCategoryData: h, selectedDateRangeMonthRange: l } = q(), { sortedTransactions: c } = re(), [d, m] = i.useState(null);
758
+ }), en = v(({ onClose: n }) => {
759
+ const o = He(), { onEvent: t } = N(), { common: s, trends: i } = R(), { selectedCategoryData: h, selectedDateRangeMonthRange: d } = ee(), { sortedTransactions: l } = ae(), [c, m] = a.useState(null);
759
760
  if (!h)
760
761
  return null;
761
- const { guid: C, name: u, is_income: b, totalAmount: r } = h, g = b ? a.category_income : a.category_spending, T = Et(C, o), p = b ? a.income_label : a.spending_label, E = ` ${h.transactions.length === 1 ? a.transaction : a.transactions} (${h.transactions.length})`, w = i.useMemo(
762
- () => c.find((D) => D.guid === d),
763
- [d, c]
764
- ), I = (D) => D.category_guid === C || D.top_level_category_guid === C, k = () => {
762
+ const { guid: C, name: u, is_income: b, totalAmount: r } = h, g = b ? i.category_income : i.category_spending, T = Mt(C, o), p = b ? i.income_label : i.spending_label, L = ` ${h.transactions.length === 1 ? i.transaction : i.transactions} (${h.transactions.length})`, w = a.useMemo(
763
+ () => l.find((D) => D.guid === c),
764
+ [c, l]
765
+ ), E = (D) => D.category_guid === C || D.top_level_category_guid === C, k = () => {
765
766
  n?.(), t(y.TRENDS_CLICK_BACK, A);
766
767
  };
767
768
  return /* @__PURE__ */ f(
768
- fe,
769
+ Ce,
769
770
  {
770
- ariaLabelClose: a.close_category_details,
771
+ ariaLabelClose: i.close_category_details,
771
772
  isOpen: !0,
772
773
  onClose: k,
773
774
  shouldShowHeaderShadow: !0,
774
775
  title: g,
775
776
  children: [
776
777
  /* @__PURE__ */ f(_, { sx: { alignItems: "center", height: "100%" }, children: [
777
- /* @__PURE__ */ f(It, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
778
+ /* @__PURE__ */ f(vt, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
778
779
  /* @__PURE__ */ e(
779
780
  Ee,
780
781
  {
781
- leftIcon: /* @__PURE__ */ e(Te, { categoryGuid: C }),
782
- rightContent: U(Math.abs(r), "0,0.00"),
783
- subtitle: l,
782
+ leftIcon: /* @__PURE__ */ e(fe, { categoryGuid: C }),
783
+ rightContent: Z(Math.abs(r), "0,0.00"),
784
+ subtitle: d,
784
785
  title: u
785
786
  }
786
787
  ),
787
- /* @__PURE__ */ e(Ut, { chartColor: T, chartLabel: p }),
788
+ /* @__PURE__ */ e(Jt, { chartColor: T, chartLabel: p }),
788
789
  /* @__PURE__ */ f(_, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
789
- /* @__PURE__ */ e(X, { bold: !0, variant: "body1", children: E }),
790
- /* @__PURE__ */ e(Lt, { filter: I })
790
+ /* @__PURE__ */ e(Q, { bold: !0, variant: "body1", children: L }),
791
+ /* @__PURE__ */ e(At, { filter: E })
791
792
  ] })
792
793
  ] }),
793
794
  /* @__PURE__ */ e(
794
795
  ke,
795
796
  {
796
797
  bgcolor: "transparent",
797
- filter: I,
798
+ filter: E,
798
799
  height: "calc(100vh - 475px)",
799
800
  onClick: m
800
801
  }
801
802
  )
802
803
  ] }),
803
804
  /* @__PURE__ */ e(
804
- fe,
805
+ Ce,
805
806
  {
806
807
  ariaLabelClose: s.close_aria,
807
808
  isOpen: !!w,
808
809
  onClose: () => m(""),
809
- title: a.transaction,
810
+ title: i.transaction,
810
811
  children: w && /* @__PURE__ */ e(Re, { transaction: w })
811
812
  }
812
813
  )
813
814
  ]
814
815
  }
815
816
  );
816
- }), Zt = (n, o) => {
817
+ }), tn = (n, o) => {
817
818
  const t = xe(n, o), s = Le(n, o);
818
- return [t, s].filter((a) => a.length > 0);
819
- }, Qt = (n, o) => {
820
- const [t, s] = n, a = t, h = s ?? t, l = [];
821
- if (a) {
822
- const c = a.reduce((d, m) => d + m.y, 0);
823
- l.push({ label: o.income_label, amount: c });
819
+ return [t, s].filter((i) => i.length > 0);
820
+ }, nn = (n, o) => {
821
+ const [t, s] = n, i = t, h = s ?? t, d = [];
822
+ if (i) {
823
+ const l = i.reduce((c, m) => c + m.y, 0);
824
+ d.push({ label: o.income_label, amount: l });
824
825
  }
825
826
  if (h) {
826
- const c = h.reduce((d, m) => d + m.y, 0);
827
- l.push({ label: o.spending_label, amount: c });
827
+ const l = h.reduce((c, m) => c + m.y, 0);
828
+ d.push({ label: o.spending_label, amount: l });
828
829
  }
829
- return l;
830
- }, qt = ({
830
+ return d;
831
+ }, on = ({
831
832
  availableHeight: n = 0,
832
833
  minHeight: o = 500,
833
834
  selectedDateRange: t,
834
835
  totals: s
835
836
  }) => {
836
- const a = He(), { onEvent: h } = H(), { trends: l } = R(), { isSmallMobile: c, isMobile: d, isSmallTablet: m, isTablet: C } = K(), u = [a.palette.chart?.chart1, a.palette.chart?.chart2], b = Zt(s, t), r = Qt(b, l), [g, T] = i.useState(0), p = 458, E = 195, w = 56, I = d || c ? E : m || C ? p : g;
837
- return i.useEffect(() => {
837
+ const i = Ne(), { onEvent: h } = N(), { trends: d } = R(), { isSmallMobile: l, isMobile: c, isSmallTablet: m, isTablet: C } = K(), u = [i.palette.chart?.chart1, i.palette.chart?.chart2], b = tn(s, t), r = nn(b, d), [g, T] = a.useState(0), p = 458, L = 195, w = 56, E = c || l ? L : m || C ? p : g;
838
+ return a.useEffect(() => {
838
839
  const D = Math.max(n - w, o);
839
840
  T(D);
840
841
  }, [n]), /* @__PURE__ */ e(
841
- ye,
842
+ Te,
842
843
  {
843
844
  baseline: "min",
844
845
  colors: u,
845
846
  curveType: "bump",
846
847
  datasets: b,
847
- height: I,
848
+ height: E,
848
849
  labels: r,
849
850
  onItemClick: () => {
850
851
  h(y.TRENDS_CLICK_CHART, A);
@@ -860,90 +861,105 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
860
861
  valueFormatterString: "0.0a"
861
862
  }
862
863
  );
863
- }, Jt = M(qt), en = ({ onBackClick: n, onInsightCardClick: o, sx: t }) => {
864
- const { onEvent: s } = H(), { config: a } = nt(), { isLargeDesktop: h, isDesktop: l, isMobile: c } = K(), { visibleAccounts: d } = ae(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: C, monthlyCategoryTotals: u } = F(), { setFilter: b } = re(), { selectedDateRange: r, setSelectedCategoryData: g, setSelectedDateRange: T } = q(), {
864
+ }, sn = v(on), rn = ({ onBackClick: n, onInsightCardClick: o, sx: t }) => {
865
+ const { onEvent: s } = N(), { config: i } = at(), { isLargeDesktop: h, isDesktop: d, isMobile: l } = K(), { visibleAccounts: c } = ie(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: C, monthlyCategoryTotals: u } = F(), { setFilter: b } = ae(), { selectedDateRange: r, setSelectedCategoryData: g, setSelectedDateRange: T } = ee(), {
865
866
  isCopyLoaded: p,
866
- isInitialized: E,
867
+ isInitialized: L,
867
868
  selectedAccounts: w,
868
- selectedAccountGuids: I,
869
+ selectedAccountGuids: E,
869
870
  setSelectedAccounts: k
870
- } = P(), { trends: D } = R(), N = xt(), x = l || h, [L, $] = i.useState(!1), [z, ie] = i.useState("Chart"), [J, ee] = i.useState(""), [te, ne] = i.useState(!1), [oe, ce] = i.useState(window.innerHeight), le = oe - 208, de = oe - (N ? 494 : 266);
871
- i.useEffect(() => {
872
- const v = () => ce(window.innerHeight);
873
- return window.addEventListener("resize", v), () => window.removeEventListener("resize", v);
874
- }, []), i.useEffect(() => {
875
- k(d);
876
- }, [d]), i.useEffect(() => {
877
- E && m(w, r.start, r.end).then(() => {
871
+ } = P(), { trends: D, connect: O } = R(), M = Rt(), I = d || h, [$, ce] = a.useState(!1), [z, ye] = a.useState("Chart"), [j, Y] = a.useState(""), [le, te] = a.useState(!1), [ne, de] = a.useState(window.innerHeight), oe = ne - 208, he = ne - (M ? 494 : 266), [ue, se] = a.useState(!1), S = i.show_connections_widget_in_master ? "buttons" : "no-buttons", H = a.useMemo(
872
+ () => c && c.length === 0 || u.length === 0,
873
+ [c, u]
874
+ );
875
+ a.useEffect(() => {
876
+ const x = () => de(window.innerHeight);
877
+ return window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
878
+ }, []), a.useEffect(() => {
879
+ k(c);
880
+ }, [c]), a.useEffect(() => {
881
+ L && m(w, r.start, r.end).then(() => {
878
882
  C(
879
883
  w,
880
884
  r.start,
881
885
  r.end
882
886
  );
883
887
  }).finally(() => {
884
- $(!0), s(y.TRENDS_LOAD_WIDGET, {
888
+ ce(!0), s(y.TRENDS_LOAD_WIDGET, {
885
889
  ...A,
886
- time_period: `${Ce(r.end, r.start)}M`
890
+ time_period: `${pe(r.end, r.start)}M`
887
891
  });
888
892
  });
889
- }, [E, w, r]), i.useEffect(() => {
893
+ }, [L, w, r]), a.useEffect(() => {
890
894
  if (u.length !== 0) {
891
- const v = {
892
- accounts: I,
895
+ const x = {
896
+ accounts: E,
893
897
  dateRange: { start: r.start, end: r.end }
894
898
  };
895
899
  b({
896
- ...v,
900
+ ...x,
897
901
  custom: (V) => !!u.find(
898
- (j) => j.top_level_category_guid === V.top_level_category_guid || j.category_guid === V.category_guid
902
+ (U) => U.top_level_category_guid === V.top_level_category_guid || U.category_guid === V.category_guid
899
903
  )
900
904
  });
901
905
  }
902
906
  }, [u]);
903
- const he = (v) => {
904
- g(v), ne(!0);
905
- }, ue = () => {
906
- g(null), ne(!1);
907
- }, me = (v, V) => {
908
- ie(V ?? z), s(y.TRENDS_CLICK_TOGGLE_VIEW, {
907
+ const G = (x) => {
908
+ g(x), te(!0);
909
+ }, me = () => {
910
+ g(null), te(!1);
911
+ }, Ge = () => {
912
+ se(!0), s(y.TRENDS_CLICK_CONNECT_ACCOUNTS);
913
+ }, Be = (x, V) => {
914
+ ye(V ?? z), s(y.TRENDS_CLICK_TOGGLE_VIEW, {
909
915
  ...A,
910
916
  toggleView: V
911
917
  });
912
- }, S = (v) => {
913
- const V = Ie(v?.[0], 1), j = v?.[1], ze = Ce(j, V);
914
- T({ start: V, end: j }), s(y.TRENDS_CLICK_TIME_WINDOW, {
918
+ }, ze = (x) => {
919
+ const V = Ie(x?.[0], 1), U = x?.[1], $e = pe(U, V);
920
+ T({ start: V, end: U }), s(y.TRENDS_CLICK_TIME_WINDOW, {
915
921
  ...A,
916
- time_period: ze + "M"
922
+ time_period: $e + "M"
917
923
  });
918
- }, W = (v) => {
924
+ }, Fe = (x) => {
919
925
  s(y.TRENDS_CLICK_FILTER, {
920
926
  ...A,
921
- filterValue: v
927
+ filterValue: x
922
928
  });
923
- }, G = (v) => {
924
- ee(v);
925
- }, ge = () => {
926
- ee(""), s(y.TRENDS_CLICK_ALL_CATEGORIES, A);
929
+ }, Pe = (x) => {
930
+ Y(x);
931
+ }, Ke = () => {
932
+ Y(""), s(y.TRENDS_CLICK_ALL_CATEGORIES, A);
927
933
  };
928
- if (!p || !L) return /* @__PURE__ */ e(Q, {});
929
- const Ge = a.show_connections_widget_in_master ? "buttons" : "no-buttons", Be = L && d.length === 0;
930
- return /* @__PURE__ */ f(
934
+ return !p || !$ ? /* @__PURE__ */ e(J, {}) : /* @__PURE__ */ f(
931
935
  Ae,
932
936
  {
933
- accountOptions: d,
934
- calendarActions: { onRangeChanged: S },
937
+ accountOptions: c,
938
+ calendarActions: { onRangeChanged: ze },
935
939
  dateRange: r,
936
- dateRangeVariant: c ? "timeframetabs" : "timeframebuttons",
937
- onAccountsFilterClick: W,
940
+ dateRangeVariant: l ? "timeframetabs" : "timeframebuttons",
941
+ onAccountsFilterClick: Fe,
938
942
  onBackClick: n,
939
943
  sx: t,
940
944
  title: D.title,
941
945
  children: [
942
- /* @__PURE__ */ f(
946
+ H && /* @__PURE__ */ e(
947
+ kt,
948
+ {
949
+ header: D.zero_state_content_header,
950
+ icon: "",
951
+ onClick: Ge,
952
+ primaryButton: D.empty_state_primary,
953
+ subText: D.empty_state_sub_text,
954
+ sx: { height: oe },
955
+ variant: S
956
+ }
957
+ ),
958
+ !H && /* @__PURE__ */ f(
943
959
  _,
944
960
  {
945
961
  sx: {
946
- px: c ? 0 : 48
962
+ px: l ? 0 : 48
947
963
  },
948
964
  children: [
949
965
  /* @__PURE__ */ f(
@@ -951,80 +967,76 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
951
967
  {
952
968
  flexDirection: "row",
953
969
  justifyContent: "space-between",
954
- sx: { pb: c ? 12 : 24, pt: c ? 24 : 48 },
970
+ sx: { pb: l ? 12 : 24, pt: l ? 24 : 48 },
955
971
  children: [
956
972
  /* @__PURE__ */ e(
957
973
  Oe,
958
974
  {
959
- selectedCategoryGuid: J,
975
+ selectedCategoryGuid: j,
960
976
  selectedDateRange: r
961
977
  }
962
978
  ),
963
- /* @__PURE__ */ e(We, { onTabChange: me, selectedTab: z })
979
+ /* @__PURE__ */ e(We, { onTabChange: Be, selectedTab: z })
964
980
  ]
965
981
  }
966
982
  ),
967
- Be && /* @__PURE__ */ e(
968
- vt,
969
- {
970
- header: "",
971
- icon: "",
972
- onClick: () => {
973
- },
974
- primaryButton: D.empty_state_primary,
975
- subText: D.empty_state_sub_text,
976
- variant: Ge
977
- }
978
- ),
979
- /* @__PURE__ */ e(_, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(O, { flexGrow: 1, children: J && /* @__PURE__ */ f(pe, { onClick: ge, sx: { p: 0, pr: 5 }, children: [
980
- /* @__PURE__ */ e(se, { name: "arrow_back" }),
983
+ /* @__PURE__ */ e(_, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(W, { flexGrow: 1, children: j && /* @__PURE__ */ f(ge, { onClick: Ke, sx: { p: 0, pr: 5 }, children: [
984
+ /* @__PURE__ */ e(re, { name: "arrow_back" }),
981
985
  D.all_categories
982
986
  ] }) }) }),
983
- /* @__PURE__ */ f(_, { flexDirection: x ? "row" : "column", gap: x ? 48 : 16, children: [
984
- z === "Chart" && /* @__PURE__ */ f(Fe, { children: [
985
- /* @__PURE__ */ e(O, { sx: { width: x ? "68%" : "100%" }, children: /* @__PURE__ */ e(
986
- Jt,
987
+ /* @__PURE__ */ f(_, { flexDirection: I ? "row" : "column", gap: I ? 48 : 16, children: [
988
+ z === "Chart" && /* @__PURE__ */ f(je, { children: [
989
+ /* @__PURE__ */ e(W, { sx: { width: I ? "68%" : "100%" }, children: /* @__PURE__ */ e(
990
+ sn,
987
991
  {
988
- availableHeight: le,
992
+ availableHeight: oe,
989
993
  minHeight: 450,
990
994
  selectedDateRange: r,
991
995
  totals: u
992
996
  }
993
997
  ) }),
994
- /* @__PURE__ */ f(_, { gap: 16, sx: { width: x ? "32%" : "100%" }, children: [
995
- N && /* @__PURE__ */ e(Yt, { onInsightCardClick: o }),
998
+ /* @__PURE__ */ f(_, { gap: 16, sx: { width: I ? "32%" : "100%" }, children: [
999
+ M && /* @__PURE__ */ e(qt, { onInsightCardClick: o }),
996
1000
  /* @__PURE__ */ e(
997
- Kt,
1001
+ Xt,
998
1002
  {
999
- availableHeight: de,
1000
- onCategoryClick: he
1003
+ availableHeight: he,
1004
+ onCategoryClick: G
1001
1005
  }
1002
1006
  )
1003
1007
  ] })
1004
1008
  ] }),
1005
- z === "Table" && /* @__PURE__ */ e(O, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1009
+ z === "Table" && /* @__PURE__ */ e(W, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1006
1010
  Ve,
1007
1011
  {
1008
1012
  height: "unset",
1009
1013
  monthlyCategoryTotals: u,
1010
- onClickRow: G,
1011
- selectedCategory: J,
1014
+ onClickRow: Pe,
1015
+ selectedCategory: j,
1012
1016
  selectedDateRange: r
1013
1017
  }
1014
1018
  ) })
1015
- ] })
1019
+ ] }),
1020
+ le && /* @__PURE__ */ e(en, { onClose: me })
1016
1021
  ]
1017
1022
  }
1018
1023
  ),
1019
- te && /* @__PURE__ */ e(Xt, { onClose: ue })
1024
+ /* @__PURE__ */ e(
1025
+ Nt,
1026
+ {
1027
+ onClose: () => se(!1),
1028
+ showConnectWidget: ue,
1029
+ title: O.mini_title
1030
+ }
1031
+ )
1020
1032
  ]
1021
1033
  }
1022
1034
  );
1023
- }, qn = M(en);
1035
+ }, so = v(rn);
1024
1036
  export {
1025
- Xn as TrendsFullWidget,
1026
- Qn as TrendsMicroWidget,
1027
- Zn as TrendsMiniWidget,
1028
- to as TrendsStore,
1029
- qn as TrendsWidget
1037
+ to as TrendsFullWidget,
1038
+ oo as TrendsMicroWidget,
1039
+ no as TrendsMiniWidget,
1040
+ io as TrendsStore,
1041
+ so as TrendsWidget
1030
1042
  };