@mx-cartographer/experiences 7.7.2 → 7.8.0-alpha-ram-goal-bug

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/Account-BiB1F8lL.mjs +118 -0
  3. package/dist/{Account-BfkKlfsW.mjs → Account-DuOz1a27.mjs} +1 -1
  4. package/dist/AccountApi-DgZ8ILj1.mjs +19 -0
  5. package/dist/{AccountDetailsHeader-DqYIuhOs.mjs → AccountDetailsHeader-Cf2TUJnM.mjs} +4 -4
  6. package/dist/AccountDisplayName-CO7z3v99.mjs +11 -0
  7. package/dist/{AccountFields-yP8QdgPd.mjs → AccountFields-UdOvbQ5H.mjs} +7 -6
  8. package/dist/{AccountListItem-DMbu9ehd.mjs → AccountListItem-BPVxmNT_.mjs} +7 -7
  9. package/dist/AccountStore-BbPWe2C9.mjs +244 -0
  10. package/dist/Accounts-M-LTzStv.mjs +27 -0
  11. package/dist/{CategoryStore-Cnw9yUys.mjs → CategoryStore-BYICdb9m.mjs} +73 -73
  12. package/dist/CategoryUtil-meuejJqP.mjs +80 -0
  13. package/dist/{ConnectionsDrawer-BqR6FWJO.mjs → ConnectionsDrawer-BDpVTTSe.mjs} +1 -1
  14. package/dist/{DebtsStore-DuSdXM1k.mjs → DebtsStore-BIbOVCPe.mjs} +12 -12
  15. package/dist/{ExportCsvAction-HK5CeZWR.mjs → ExportCsvAction-CDuzTva1.mjs} +2 -2
  16. package/dist/GlobalAccountFilter-DQCPNc95.mjs +316 -0
  17. package/dist/GoalStore-B4LVt_kH.mjs +422 -0
  18. package/dist/{ManageIncome-BrTrlplL.mjs → ManageIncome-CL3hv8i9.mjs} +44 -44
  19. package/dist/NetWorthStore-yV43kJro.mjs +168 -0
  20. package/dist/{NotificationSettings-D4Vh3z8I.mjs → NotificationSettings-SPg3pwbX.mjs} +171 -169
  21. package/dist/{NotificationStore-CDX_kqHa.mjs → NotificationStore-Ck2KdNmT.mjs} +22 -14
  22. package/dist/{RecurringSettings-D2V6l77l.mjs → RecurringSettings-Bmnnpb48.mjs} +16 -16
  23. package/dist/{RecurringTransactionsStore-Caf1cq4v.mjs → RecurringTransactionsStore-BQBEJOPP.mjs} +91 -81
  24. package/dist/{RecurringTransactions-Bf4lX0Cn.mjs → RepeatingTransaction-miZVnk_A.mjs} +4 -4
  25. package/dist/{SettingsStore-krIRNwHK.mjs → SettingsStore-BHpuyujx.mjs} +1 -1
  26. package/dist/SkeletonLoader-BaNboJjD.mjs +38 -0
  27. package/dist/{SpendingLegend-gTCJLLkV.mjs → SpendingLegend-CD60HCYS.mjs} +33 -33
  28. package/dist/{TransactionDetails-7MHOshKQ.mjs → TransactionDetails-BDhz3DLT.mjs} +2 -2
  29. package/dist/TransactionStore-BSp5bOKg.mjs +705 -0
  30. package/dist/{User-LJpEwPtn.mjs → User-B0LnmiKO.mjs} +21 -20
  31. package/dist/WidgetContainer-BbPS3Yxz.mjs +555 -0
  32. package/dist/accounts/index.es.js +421 -391
  33. package/dist/accounts/stores/AccountStore.d.ts +30 -23
  34. package/dist/accounts/utils/Accounts.d.ts +2 -1
  35. package/dist/budgets/index.es.js +546 -540
  36. package/dist/budgets/store/BudgetsStore.d.ts +1 -0
  37. package/dist/cashflow/index.es.js +444 -457
  38. package/dist/categories/index.es.js +1 -1
  39. package/dist/categories/stores/CategoryStore.d.ts +10 -5
  40. package/dist/categories/util/CategoryUtil.d.ts +3 -2
  41. package/dist/common/components/GlobalAccountFilter.d.ts +11 -0
  42. package/dist/common/components/SkeletonLoader.d.ts +7 -0
  43. package/dist/common/components/WidgetContainer.d.ts +7 -6
  44. package/dist/common/components/globalaccountfilter/GlobalAccountFilterList.d.ts +7 -0
  45. package/dist/common/components/index.d.ts +2 -2
  46. package/dist/common/hooks/useAriaLive.d.ts +1 -1
  47. package/dist/common/index.es.js +459 -445
  48. package/dist/common/stores/AppDataStore.d.ts +3 -1
  49. package/dist/common/stores/GlobalCopyStore.d.ts +0 -1
  50. package/dist/common/stores/GlobalStore.d.ts +3 -3
  51. package/dist/common/stores/GlobalUiStore.d.ts +10 -6
  52. package/dist/common/stores/UserStore.d.ts +3 -2
  53. package/dist/common/types/Account.d.ts +9 -6
  54. package/dist/dashboard/index.es.js +84 -116
  55. package/dist/debts/index.es.js +417 -413
  56. package/dist/{exportTransactionsToCSV-BrTYdSgJ.mjs → exportTransactionsToCSV-DtQ7ovAR.mjs} +1 -1
  57. package/dist/finstrong/index.es.js +1167 -1110
  58. package/dist/goals/index.es.js +618 -598
  59. package/dist/goals/stores/GoalStore.d.ts +19 -4
  60. package/dist/help/index.es.js +13 -13
  61. package/dist/investments/index.es.js +330 -325
  62. package/dist/investments/stores/HoldingStore.d.ts +1 -0
  63. package/dist/networth/components/NetWorthChart.d.ts +3 -2
  64. package/dist/networth/components/NetWorthList.d.ts +3 -3
  65. package/dist/networth/index.es.js +423 -433
  66. package/dist/networth/stores/NetWorthStore.d.ts +20 -9
  67. package/dist/networth/utils/NetWorthUtils.d.ts +2 -2
  68. package/dist/notifications/index.es.js +90 -91
  69. package/dist/notifications/stores/NotificationStore.d.ts +3 -1
  70. package/dist/recurringtransactions/components/MicroWidgetContent.d.ts +3 -0
  71. package/dist/recurringtransactions/index.es.js +543 -562
  72. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +4 -2
  73. package/dist/settings/index.es.js +253 -248
  74. package/dist/spending/index.es.js +282 -301
  75. package/dist/transactions/index.es.js +269 -263
  76. package/dist/transactions/stores/TransactionStore.d.ts +26 -77
  77. package/dist/transactions/stores/UiStore.d.ts +0 -2
  78. package/dist/trends/index.es.js +708 -699
  79. package/dist/{useAccountDisplayName-BTvP_pw6.mjs → useAccountDisplayName-Bot2tb4n.mjs} +1 -1
  80. package/package.json +3 -3
  81. package/dist/AccountStore-CWFzg8-E.mjs +0 -260
  82. package/dist/Accounts-CWt-NRq8.mjs +0 -9
  83. package/dist/CategoryUtil-DZflYFam.mjs +0 -78
  84. package/dist/ConnectDrawer-BOjfI6rz.mjs +0 -563
  85. package/dist/GoalStore-C7ahxxLi.mjs +0 -364
  86. package/dist/NetWorthStore-xWIo9CYU.mjs +0 -150
  87. package/dist/TransactionStore-DJwPaZuM.mjs +0 -677
  88. package/dist/WidgetContainer-CrK6tyHr.mjs +0 -572
  89. package/dist/common/components/accountfilter/AccountFilter.d.ts +0 -20
  90. package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +0 -31
  91. package/dist/common/components/accountfilter/index.d.ts +0 -1
  92. package/dist/{ToggleListItem-ciFTiqRS.mjs → Notification-Bs1fdbzI.mjs} +1 -1
@@ -1,139 +1,139 @@
1
- import { jsxs as C, jsx as e, Fragment as mt } from "react/jsx-runtime";
2
- import m, { useRef as pt, useState as ft, useEffect as Ct } from "react";
1
+ import { jsxs as C, jsx as e, Fragment as _t } from "react/jsx-runtime";
2
+ import u, { useRef as Tt, useState as bt, useEffect as St } from "react";
3
3
  import { observer as R } from "mobx-react-lite";
4
- import { CategoryIcon as Se, Text as z, Icon as _e, P as ge, H3 as je, ChevronRightIcon as yt } from "@mxenabled/mxui";
4
+ import { CategoryIcon as we, Text as X, Icon as Te, P as fe, H3 as Ue, ChevronRightIcon as xt } from "@mxenabled/mxui";
5
5
  import A from "@mui/material/Box";
6
- import S from "@mui/material/Stack";
6
+ import x from "@mui/material/Stack";
7
7
  import be from "@mui/material/Button";
8
- import { addSeconds as Ue } from "date-fns/addSeconds";
9
- import { differenceInCalendarMonths as ke } from "date-fns/differenceInCalendarMonths";
10
- import _t from "numeral";
11
- import { useTheme as ce } from "@mui/material/styles";
12
- import { useItemTooltip as bt, ChartsTooltipContainer as Tt } from "@mui/x-charts/ChartsTooltip";
13
- import { LineChart as St } from "@mui/x-charts/LineChart";
14
- import { u as X } from "../useScreenSize-B6JyS_Lj.mjs";
15
- import { u as xt } from "../useDimensions-27p2evRx.mjs";
16
- import Xe from "@mui/material/Card";
17
- import Ze from "@mui/material/CardContent";
8
+ import { addSeconds as Xe } from "date-fns/addSeconds";
9
+ import { differenceInCalendarMonths as Se } from "date-fns/differenceInCalendarMonths";
10
+ import wt from "numeral";
11
+ import { useTheme as le } from "@mui/material/styles";
12
+ import { useItemTooltip as vt, ChartsTooltipContainer as Dt } from "@mui/x-charts/ChartsTooltip";
13
+ import { LineChart as Lt } from "@mui/x-charts/LineChart";
14
+ import { u as q } from "../useScreenSize-B6JyS_Lj.mjs";
15
+ import { u as It } from "../useDimensions-27p2evRx.mjs";
16
+ import Ze from "@mui/material/Card";
17
+ import Qe from "@mui/material/CardContent";
18
18
  import He from "@mui/material/Divider";
19
- import Ge from "@mui/material/Grid";
20
- import { u as k, m as Z, g as F, b as pe, h as xe, d as we, v as fe, p as Qe, f as We, a as qe } from "../hooks-ZMp65DFz.mjs";
21
- import { b as Je } from "../Localization-2MODESHW.mjs";
22
- import { C as Te } from "../CurrencyText-C-85TnUF.mjs";
23
- import { C as Ae, b as Be, c as wt } from "../Category-CevNQ03n.mjs";
24
- import { f as U, D as B } from "../Dialog-B4PI-_bL.mjs";
25
- import { f as se, a as vt } from "../NumberFormatting-DjTD0t3W.mjs";
26
- import { c as It, a as Ve, g as Lt, L as et } from "../TrendsStore-DXQnmdc8.mjs";
27
- import { T as Kn } from "../TrendsStore-DXQnmdc8.mjs";
28
- import { c as Et, i as Dt, d as Mt, e as At, b as tt, g as ot, f as Pe } from "../SpendingData-BmL0bwnS.mjs";
29
- import Rt from "@mui/material/ToggleButton";
30
- import kt from "@mui/material/ToggleButtonGroup";
31
- import { DataGridPro as Ht } from "@mui/x-data-grid-pro";
32
- import { T as V, b as Nt } from "../ViewMoreMicroCard-qXK-0-Rl.mjs";
33
- import { parseISO as nt } from "date-fns/parseISO";
34
- import { H as Re } from "../HeaderCell-DjuifqHJ.mjs";
35
- import { A as w, W as st } from "../WidgetContainer-CrK6tyHr.mjs";
36
- import { a as rt, T as at } from "../TransactionDetails-7MHOshKQ.mjs";
19
+ import Be from "@mui/material/Grid";
20
+ import { u as k, m as J, g as $, b as ye, h as ve, d as De, v as Ce, p as qe, f as We, a as Je } from "../hooks-ZMp65DFz.mjs";
21
+ import { b as et } from "../Localization-2MODESHW.mjs";
22
+ import { C as xe } from "../CurrencyText-C-85TnUF.mjs";
23
+ import { C as Re, b as Ve, c as Et } from "../Category-CevNQ03n.mjs";
24
+ import { f as Q, D as B } from "../Dialog-B4PI-_bL.mjs";
25
+ import { f as oe, a as Mt } from "../NumberFormatting-DjTD0t3W.mjs";
26
+ import { c as At, a as Fe, g as Rt, L as tt } from "../TrendsStore-DXQnmdc8.mjs";
27
+ import { T as Zn } from "../TrendsStore-DXQnmdc8.mjs";
28
+ import { c as kt, i as Ht, d as Nt, e as Wt, b as ot, g as nt, f as Pe } from "../SpendingData-BmL0bwnS.mjs";
29
+ import Ot from "@mui/material/ToggleButton";
30
+ import Gt from "@mui/material/ToggleButtonGroup";
31
+ import { DataGridPro as Bt } from "@mui/x-data-grid-pro";
32
+ import { T as G, b as Vt } from "../ViewMoreMicroCard-qXK-0-Rl.mjs";
33
+ import { parseISO as st } from "date-fns/parseISO";
34
+ import { H as ke } from "../HeaderCell-DjuifqHJ.mjs";
35
+ import { A as v, W as rt } from "../WidgetContainer-BbPS3Yxz.mjs";
36
+ import { a as at, T as it } from "../TransactionDetails-BDhz3DLT.mjs";
37
37
  import { D as Ne } from "../Drawer-DV4NTsFg.mjs";
38
- import { u as ve } from "../useWidgetLoadTimer-hIOioiKx.mjs";
39
- import { L as me } from "../Loader-DUaFpDGv.mjs";
38
+ import { u as Le } from "../useWidgetLoadTimer-hIOioiKx.mjs";
39
+ import { L as Ie } from "../Loader-DUaFpDGv.mjs";
40
40
  import { L as Oe } from "../LineChart-kFoTu9Pi.mjs";
41
- import { M as Wt } from "../MiniWidgetContainer-98-hKFqm.mjs";
42
- import { subMonths as Ot } from "date-fns";
43
- import { TrendingUp as Gt, TrendingDown as Bt, MultilineChart as Vt, ExpandLess as Pt, ExpandMore as Ft } from "@mxenabled/mx-icons";
44
- import { M as zt } from "../MicroWidgetContainer-B2hO9rOG.mjs";
45
- import $t from "@mui/material/Collapse";
46
- import Kt from "@mui/material/List";
47
- import Yt from "@mui/material/ListItem";
48
- import jt from "@mui/material/ListItemButton";
49
- import Ut from "@mui/material/ListItemIcon";
50
- import Xt from "@mui/material/ListItemText";
51
- import it from "@mui/material/styles/useTheme";
52
- import { Stack as Zt } from "@mui/material";
53
- import Qt from "@mui/material/Paper";
54
- import { b as qt } from "../CategoryUtil-DZflYFam.mjs";
55
- import { E as Jt } from "../ExportCsvAction-HK5CeZWR.mjs";
56
- import { u as eo } from "../useInsightsEnabled-B7dxpDrX.mjs";
57
- import { E as to } from "../EmptyState-DoxNUae-.mjs";
58
- import { l as oo } from "../ConnectDrawer-BOjfI6rz.mjs";
59
- const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
60
- const { categories: n } = k(), { getCategoryName: t } = Z(), r = t(o);
61
- return /* @__PURE__ */ C(S, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
41
+ import { M as Ft } from "../MiniWidgetContainer-98-hKFqm.mjs";
42
+ import { subMonths as Pt } from "date-fns";
43
+ import { TrendingUp as $t, TrendingDown as zt, MultilineChart as Kt, ExpandLess as Yt, ExpandMore as jt } from "@mxenabled/mx-icons";
44
+ import { M as Ut } from "../MicroWidgetContainer-B2hO9rOG.mjs";
45
+ import Xt from "@mui/material/Collapse";
46
+ import Zt from "@mui/material/List";
47
+ import Qt from "@mui/material/ListItem";
48
+ import qt from "@mui/material/ListItemButton";
49
+ import Jt from "@mui/material/ListItemIcon";
50
+ import eo from "@mui/material/ListItemText";
51
+ import ct from "@mui/material/styles/useTheme";
52
+ import { Stack as to } from "@mui/material";
53
+ import oo from "@mui/material/Paper";
54
+ import { b as no } from "../CategoryUtil-meuejJqP.mjs";
55
+ import { E as so } from "../ExportCsvAction-CDuzTva1.mjs";
56
+ import { u as ro } from "../useInsightsEnabled-B7dxpDrX.mjs";
57
+ import { E as ao } from "../EmptyState-DoxNUae-.mjs";
58
+ import { b as io } from "../GlobalAccountFilter-DQCPNc95.mjs";
59
+ const lt = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
60
+ const { categories: n } = k(), { getCategoryName: t } = J(), r = t(o);
61
+ return /* @__PURE__ */ C(x, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
62
62
  /* @__PURE__ */ e(
63
63
  A,
64
64
  {
65
- "aria-label": Je(n.category_icon_label_aria, r),
65
+ "aria-label": et(n.category_icon_label_aria, r),
66
66
  mb: 4,
67
67
  role: "img",
68
- children: /* @__PURE__ */ e(Se, { categoryGuid: s })
68
+ children: /* @__PURE__ */ e(we, { categoryGuid: s })
69
69
  }
70
70
  ),
71
- /* @__PURE__ */ e(z, { variant: "Body", children: r })
71
+ /* @__PURE__ */ e(X, { variant: "Body", children: r })
72
72
  ] });
73
- }, no = ({
73
+ }, co = ({
74
74
  categoryGuids: { guid: o, topLevelGuid: s },
75
75
  hoveredAreaData: n,
76
76
  cursorPosition: t,
77
77
  chartContainerRef: r
78
78
  }) => {
79
- const a = ce(), d = pt(null), [p, i] = ft({ x: t.x, y: t.y });
80
- if (Ct(() => {
79
+ const i = le(), d = Tt(null), [h, c] = bt({ x: t.x, y: t.y });
80
+ if (St(() => {
81
81
  (() => {
82
- const l = d.current, y = r.current;
83
- if (!l || !y) return;
84
- const h = l.getBoundingClientRect(), g = y.getBoundingClientRect();
85
- let _ = t.x, T = t.y;
86
- _ + h.width * 2 > g.right ? _ = t.x - h.width : _ - h.width < g.left && (_ = t.x), T + h.height * 2 > g.bottom && (T = t.y - h.height), i({ x: _, y: T });
82
+ const m = d.current, _ = r.current;
83
+ if (!m || !_) return;
84
+ const f = m.getBoundingClientRect(), g = _.getBoundingClientRect();
85
+ let y = t.x, w = t.y;
86
+ y + f.width * 2 > g.right ? y = t.x - f.width : y - f.width < g.left && (y = t.x), w + f.height * 2 > g.bottom && (w = t.y - f.height), c({ x: y, y: w });
87
87
  })();
88
88
  }, [t, r]), !n) return null;
89
- const u = n.reduce((f, l) => f + l.y, 0);
89
+ const l = n.reduce((p, m) => p + m.y, 0);
90
90
  return /* @__PURE__ */ e(
91
- Xe,
91
+ Ze,
92
92
  {
93
93
  ref: d,
94
94
  sx: {
95
95
  position: "absolute",
96
- top: p.y,
97
- left: p.x,
96
+ top: h.y,
97
+ left: h.x,
98
98
  width: 250,
99
99
  pointerEvents: "none"
100
100
  },
101
- children: /* @__PURE__ */ C(Ze, { children: [
101
+ children: /* @__PURE__ */ C(Qe, { children: [
102
102
  /* @__PURE__ */ C(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
103
- /* @__PURE__ */ e(ct, { categoryGuid: o, topLevelCategoryGuid: s }),
104
- /* @__PURE__ */ e(z, { variant: "Small", children: `${n.length}-month total` }),
105
- /* @__PURE__ */ e(Te, { amount: u, bold: !0, formatString: "0,0", variant: "body2" })
103
+ /* @__PURE__ */ e(lt, { categoryGuid: o, topLevelCategoryGuid: s }),
104
+ /* @__PURE__ */ e(X, { variant: "Small", children: `${n.length}-month total` }),
105
+ /* @__PURE__ */ e(xe, { amount: l, bold: !0, formatString: "0,0", variant: "body2" })
106
106
  ] }),
107
107
  /* @__PURE__ */ e(He, { sx: { my: 16, width: "100%" } }),
108
- /* @__PURE__ */ e(Ge, { container: !0, children: n.map((f, l) => /* @__PURE__ */ C(m.Fragment, { children: [
109
- l > 0 && l % 3 === 0 && /* @__PURE__ */ e(He, { sx: { my: 16, width: "100%" } }),
110
- /* @__PURE__ */ e(Ge, { item: !0, xs: 4, children: /* @__PURE__ */ C(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
111
- /* @__PURE__ */ e(z, { color: a.palette.text.secondary, variant: "XSmall", children: f.x }),
108
+ /* @__PURE__ */ e(Be, { container: !0, children: n.map((p, m) => /* @__PURE__ */ C(u.Fragment, { children: [
109
+ m > 0 && m % 3 === 0 && /* @__PURE__ */ e(He, { sx: { my: 16, width: "100%" } }),
110
+ /* @__PURE__ */ e(Be, { item: !0, xs: 4, children: /* @__PURE__ */ C(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
111
+ /* @__PURE__ */ e(X, { color: i.palette.text.secondary, variant: "XSmall", children: p.x }),
112
112
  /* @__PURE__ */ e(
113
- Te,
113
+ xe,
114
114
  {
115
- amount: f.y,
115
+ amount: p.y,
116
116
  bold: !0,
117
117
  formatString: "0,0",
118
118
  variant: "Body"
119
119
  }
120
120
  )
121
121
  ] }) })
122
- ] }, l)) })
122
+ ] }, m)) })
123
123
  ] })
124
124
  }
125
125
  );
126
- }, so = R(no), ro = ({
126
+ }, lo = R(co), uo = ({
127
127
  sx: o,
128
128
  categoryGuids: s,
129
129
  hoveredLegend: n,
130
130
  legendRef: t,
131
131
  onHoverLegend: r,
132
- onClickLegend: a
132
+ onClickLegend: i
133
133
  }) => {
134
- const { isMobile: d } = X(), { getCategoryName: p } = Z();
134
+ const { isMobile: d } = q(), { getCategoryName: h } = J();
135
135
  return /* @__PURE__ */ e(
136
- S,
136
+ x,
137
137
  {
138
138
  direction: "row",
139
139
  flexWrap: "wrap",
@@ -141,13 +141,13 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
141
141
  justifyContent: "start",
142
142
  ref: t,
143
143
  sx: o,
144
- children: s.map(({ guid: i, top_level_guid: u }) => {
145
- const f = n === i, l = Ae[i], y = Ae[u], h = l ?? y ?? Ae.default, g = h + "33";
144
+ children: s.map(({ guid: c, top_level_guid: l }) => {
145
+ const p = n === c, m = Re[c], _ = Re[l], f = m ?? _ ?? Re.default, g = f + "33";
146
146
  return /* @__PURE__ */ C(
147
147
  be,
148
148
  {
149
- onClick: () => a(i),
150
- onMouseEnter: () => r(i),
149
+ onClick: () => i(c),
150
+ onMouseEnter: () => r(c),
151
151
  onMouseLeave: () => r(null),
152
152
  sx: {
153
153
  color: "text.primary",
@@ -158,7 +158,7 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
158
158
  paddingX: 8,
159
159
  paddingY: 4,
160
160
  borderRadius: 1,
161
- opacity: f ? 1 : 0.7
161
+ opacity: p ? 1 : 0.7
162
162
  },
163
163
  children: [
164
164
  /* @__PURE__ */ e(
@@ -169,140 +169,140 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
169
169
  height: 16,
170
170
  marginRight: d ? 5 : 10,
171
171
  borderRadius: "2px",
172
- backgroundColor: n ? f ? h : g : h
172
+ backgroundColor: n ? p ? f : g : f
173
173
  }
174
174
  }
175
175
  ),
176
- /* @__PURE__ */ e(z, { variant: "Body", children: p(i) })
176
+ /* @__PURE__ */ e(X, { variant: "Body", children: h(c) })
177
177
  ]
178
178
  },
179
- i
179
+ c
180
180
  );
181
181
  })
182
182
  }
183
183
  );
184
- }, ao = ({
184
+ }, ho = ({
185
185
  categoryGuids: { guid: o, topLevelGuid: s },
186
186
  series: n,
187
187
  xData: t
188
188
  }) => {
189
- const r = bt(), a = ce();
189
+ const r = vt(), i = le();
190
190
  if (!r?.identifier) return null;
191
- const { dataIndex: d, seriesId: p } = r.identifier;
192
- if (d == null || !p) return null;
193
- const u = n.find((l) => l.id === p)?.data?.[d], f = t?.[d];
194
- return u === void 0 || !f ? null : /* @__PURE__ */ e(Xe, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(Ze, { children: /* @__PURE__ */ C(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
195
- /* @__PURE__ */ e(ct, { categoryGuid: o, topLevelCategoryGuid: s }),
196
- /* @__PURE__ */ e(z, { color: a.palette.text.secondary, variant: "Small", children: U(f, B.MONTH_SHORT_YEAR) }),
197
- /* @__PURE__ */ e(Te, { amount: String(u), bold: !0, formatString: "0,0", variant: "Body" })
191
+ const { dataIndex: d, seriesId: h } = r.identifier;
192
+ if (d == null || !h) return null;
193
+ const l = n.find((m) => m.id === h)?.data?.[d], p = t?.[d];
194
+ return l === void 0 || !p ? null : /* @__PURE__ */ e(Ze, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ C(A, { alignItems: "center", display: "flex", flexDirection: "column", children: [
195
+ /* @__PURE__ */ e(lt, { categoryGuid: o, topLevelCategoryGuid: s }),
196
+ /* @__PURE__ */ e(X, { color: i.palette.text.secondary, variant: "Small", children: Q(p, B.MONTH_SHORT_YEAR) }),
197
+ /* @__PURE__ */ e(xe, { amount: String(l), bold: !0, formatString: "0,0", variant: "Body" })
198
198
  ] }) }) });
199
- }, io = ({
199
+ }, go = ({
200
200
  onHoverArea: o,
201
201
  onHoverPoint: s,
202
202
  onHoverLegend: n,
203
203
  onClickLegend: t,
204
204
  stackedDatasets: r,
205
- unstackedDatasets: a = [],
205
+ unstackedDatasets: i = [],
206
206
  availableHeight: d = 0,
207
- minimumHeight: p = 350
207
+ minimumHeight: h = 350
208
208
  }) => {
209
- const i = ce(), { isMobile: u } = X(), [f, { height: l }] = xt(), y = m.useRef(null), [h, g] = m.useState(0);
210
- m.useEffect(() => {
211
- const c = Math.max(d - l, p);
212
- g(c);
213
- }, [d, l]);
214
- const [_, T] = m.useState(null), [L, I] = m.useState({
209
+ const c = le(), { isMobile: l } = q(), [p, { height: m }] = It(), _ = u.useRef(null), [f, g] = u.useState(0);
210
+ u.useEffect(() => {
211
+ const a = Math.max(d - m, h);
212
+ g(a);
213
+ }, [d, m]);
214
+ const [y, w] = u.useState(null), [b, M] = u.useState({
215
215
  hoveredSeriesId: null,
216
216
  hoveredAreaData: null,
217
217
  isAreaHovered: !1,
218
218
  cursorPos: { x: 0, y: 0 }
219
- }), { hoveredSeriesId: E, hoveredAreaData: P, isAreaHovered: H, cursorPos: D } = L, $ = H && E && P, M = !$, O = [...r, ...a], N = O[0]?.dataset.length ?? 0, Q = O.flatMap((c) => c.dataset.map((b) => b.x)), Ce = O.flatMap((c) => c.dataset.map((b) => b.y)), oe = r[0]?.dataset?.map(
220
- (c, b) => r.reduce((v, j) => v + j.dataset[b]?.y || 0, 0)
221
- ) ?? [0], re = Math.max(...oe), q = Math.max(
222
- ...a.flatMap((c) => c.dataset.map((b) => b.y))
223
- ), le = Math.floor(Math.min(...Ce) / 100) * 100, ne = Math.ceil(Math.max(re, q) / 100) * 100, K = r.map((c, b) => ({
224
- id: `stacked-${b}`,
225
- guid: c.category_guid,
226
- top_level_guid: c.top_level_category_guid,
219
+ }), { hoveredSeriesId: I, hoveredAreaData: S, isAreaHovered: H, cursorPos: N } = b, z = H && I && S, V = !z, K = [...r, ...i], E = K[0]?.dataset.length ?? 0, te = K.flatMap((a) => a.dataset.map((T) => T.x)), O = K.flatMap((a) => a.dataset.map((T) => T.y)), ne = r[0]?.dataset?.map(
220
+ (a, T) => r.reduce((L, U) => L + U.dataset[T]?.y || 0, 0)
221
+ ) ?? [0], se = Math.max(...ne), Z = Math.max(
222
+ ...i.flatMap((a) => a.dataset.map((T) => T.y))
223
+ ), de = Math.floor(Math.min(...O) / 100) * 100, ue = Math.ceil(Math.max(se, Z) / 100) * 100, F = r.map((a, T) => ({
224
+ id: `stacked-${T}`,
225
+ guid: a.category_guid,
226
+ top_level_guid: a.top_level_category_guid,
227
227
  area: !0,
228
- color: r[b].category_color ?? i.palette.primary.main,
229
- data: c.dataset.map((v) => v.y),
230
- label: r[b].category_name,
228
+ color: r[T].category_color ?? c.palette.primary.main,
229
+ data: a.dataset.map((L) => L.y),
230
+ label: r[T].category_name,
231
231
  stack: "total",
232
232
  type: "line",
233
233
  highlightScope: { highlight: "item" },
234
- valueFormatter: (v) => se(v, "0,0")
235
- })), ae = a.map((c, b) => ({
236
- id: `unstacked-${b}`,
237
- guid: c.category_guid,
238
- top_level_guid: c.top_level_category_guid,
234
+ valueFormatter: (L) => oe(L, "0,0")
235
+ })), re = i.map((a, T) => ({
236
+ id: `unstacked-${T}`,
237
+ guid: a.category_guid,
238
+ top_level_guid: a.top_level_category_guid,
239
239
  area: !1,
240
- color: c.category_color,
241
- data: c.dataset.map((v) => v.y),
242
- label: c.category_name,
240
+ color: a.category_color,
241
+ data: a.dataset.map((L) => L.y),
242
+ label: a.category_name,
243
243
  type: "line",
244
- valueFormatter: (v) => se(v, "0,0")
245
- })), J = [...K, ...ae], ie = [
246
- ...K.map(({ guid: c, top_level_guid: b }) => ({
247
- guid: c,
248
- top_level_guid: b
244
+ valueFormatter: (L) => oe(L, "0,0")
245
+ })), Y = [...F, ...re], he = [
246
+ ...F.map(({ guid: a, top_level_guid: T }) => ({
247
+ guid: a,
248
+ top_level_guid: T
249
249
  })),
250
- ...ae.map(({ guid: c, top_level_guid: b }) => ({
251
- guid: c,
252
- top_level_guid: b
250
+ ...re.map(({ guid: a, top_level_guid: T }) => ({
251
+ guid: a,
252
+ top_level_guid: T
253
253
  }))
254
- ], ee = (c) => {
255
- const v = c.startsWith("stacked-") ? r[parseInt(c.split("-")[1])] : a[parseInt(c.split("-")[1])];
254
+ ], j = (a) => {
255
+ const L = a.startsWith("stacked-") ? r[parseInt(a.split("-")[1])] : i[parseInt(a.split("-")[1])];
256
256
  return {
257
- guid: v?.category_guid,
258
- topLevelGuid: v?.top_level_category_guid
257
+ guid: L?.category_guid,
258
+ topLevelGuid: L?.top_level_category_guid
259
259
  };
260
- }, x = (c) => {
261
- T(c), n?.(c ?? "");
262
- }, G = (c) => {
263
- t?.(c ?? "");
264
- }, Y = () => {
265
- const c = ee(String(E)).guid;
266
- c && t?.(c);
267
- }, de = (c) => {
268
- const b = String(c?.seriesId), v = ee(b).guid, j = J.find((ue) => ue.id === b), Le = j && c?.dataIndex !== void 0, Ee = j && c?.dataIndex === void 0;
269
- if (Le)
270
- I({
271
- hoveredSeriesId: b,
260
+ }, ae = (a) => {
261
+ w(a), n?.(a ?? "");
262
+ }, ge = (a) => {
263
+ t?.(a ?? "");
264
+ }, ie = () => {
265
+ const a = j(String(I)).guid;
266
+ a && t?.(a);
267
+ }, ce = (a) => {
268
+ const T = String(a?.seriesId), L = j(T).guid, U = Y.find((me) => me.id === T), Ee = U && a?.dataIndex !== void 0, _e = U && a?.dataIndex === void 0;
269
+ if (Ee)
270
+ M({
271
+ hoveredSeriesId: T,
272
272
  hoveredAreaData: null,
273
273
  isAreaHovered: !1,
274
- cursorPos: D
275
- }), s?.(v);
276
- else if (Ee) {
277
- const ue = j?.data.map((De, Me) => ({
278
- x: Q[Me],
279
- y: De
274
+ cursorPos: N
275
+ }), s?.(L);
276
+ else if (_e) {
277
+ const me = U?.data.map((Me, Ae) => ({
278
+ x: te[Ae],
279
+ y: Me
280
280
  })) ?? [];
281
- I({
282
- hoveredSeriesId: b,
283
- hoveredAreaData: ue,
281
+ M({
282
+ hoveredSeriesId: T,
283
+ hoveredAreaData: me,
284
284
  isAreaHovered: !0,
285
- cursorPos: D
286
- }), o?.(v);
285
+ cursorPos: N
286
+ }), o?.(L);
287
287
  } else
288
- I({
288
+ M({
289
289
  hoveredSeriesId: null,
290
290
  hoveredAreaData: null,
291
291
  isAreaHovered: !1,
292
- cursorPos: D
292
+ cursorPos: N
293
293
  });
294
- }, ye = (c) => {
295
- if (c.target instanceof Element && c.target.classList[0]?.includes("MuiMarkElement-root"))
294
+ }, D = (a) => {
295
+ if (a.target instanceof Element && a.target.classList[0]?.includes("MuiMarkElement-root"))
296
296
  return;
297
- const b = c.currentTarget.getBoundingClientRect();
298
- I((v) => ({
299
- ...v,
297
+ const T = a.currentTarget.getBoundingClientRect();
298
+ M((L) => ({
299
+ ...L,
300
300
  cursorPos: {
301
- x: c.clientX - b.left,
302
- y: c.clientY - b.top
301
+ x: a.clientX - T.left,
302
+ y: a.clientY - T.top
303
303
  }
304
304
  }));
305
- }, Ie = {
305
+ }, P = {
306
306
  p: 4,
307
307
  "& .MuiBarLabel-root": {
308
308
  fontSize: 10,
@@ -318,18 +318,18 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
318
318
  '& [class*="MuiLineElement-series-unstacked-"]': {
319
319
  strokeWidth: 3
320
320
  },
321
- ..._ && K.reduce((c, b, v) => {
322
- const j = `.MuiAreaElement-series-stacked-${v}`;
323
- return c[j] = {
324
- opacity: K[v].guid === _ ? 0.9 : 0.2
325
- }, c;
321
+ ...y && F.reduce((a, T, L) => {
322
+ const U = `.MuiAreaElement-series-stacked-${L}`;
323
+ return a[U] = {
324
+ opacity: F[L].guid === y ? 0.9 : 0.2
325
+ }, a;
326
326
  }, {})
327
327
  };
328
328
  return /* @__PURE__ */ e(
329
329
  A,
330
330
  {
331
- onMouseMove: ye,
332
- ref: y,
331
+ onMouseMove: D,
332
+ ref: _,
333
333
  sx: {
334
334
  position: "relative",
335
335
  touchAction: "pan-y",
@@ -342,75 +342,75 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
342
342
  }
343
343
  },
344
344
  children: /* @__PURE__ */ C(
345
- S,
345
+ x,
346
346
  {
347
347
  direction: { xs: "column", md: "column" },
348
348
  spacing: { xs: 0, md: 4 },
349
349
  sx: { width: "100%", position: "relative" },
350
350
  children: [
351
351
  /* @__PURE__ */ e(
352
- St,
352
+ Lt,
353
353
  {
354
- height: h,
354
+ height: f,
355
355
  hideLegend: !0,
356
356
  margin: { bottom: 24, left: 12, right: 54, top: 48 },
357
- onAreaClick: Y,
358
- onHighlightChange: de,
359
- series: J,
357
+ onAreaClick: ie,
358
+ onHighlightChange: ce,
359
+ series: Y,
360
360
  skipAnimation: !0,
361
361
  slotProps: {
362
- tooltip: { trigger: M ? "item" : "none" }
362
+ tooltip: { trigger: V ? "item" : "none" }
363
363
  },
364
364
  slots: {
365
- tooltip: M && E ? (c) => /* @__PURE__ */ e(Tt, { children: /* @__PURE__ */ e(
366
- ao,
365
+ tooltip: V && I ? (a) => /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(
366
+ ho,
367
367
  {
368
- ...c,
369
- categoryGuids: ee(E),
370
- series: J,
371
- xData: Q
368
+ ...a,
369
+ categoryGuids: j(I),
370
+ series: Y,
371
+ xData: te
372
372
  }
373
373
  ) }) : void 0
374
374
  },
375
- sx: Ie,
375
+ sx: P,
376
376
  xAxis: [
377
377
  {
378
- data: Q,
378
+ data: te,
379
379
  scaleType: "time",
380
- valueFormatter: (c) => U(c, B.MONTH_SHORT_YEAR),
381
- tickNumber: N
380
+ valueFormatter: (a) => Q(a, B.MONTH_SHORT_YEAR),
381
+ tickNumber: E
382
382
  // How many ticks to show on the x-axis
383
383
  }
384
384
  ],
385
385
  yAxis: [
386
386
  {
387
- min: le,
388
- max: ne || 100,
389
- valueFormatter: (c) => _t(c).format("0a")
387
+ min: de,
388
+ max: ue || 100,
389
+ valueFormatter: (a) => wt(a).format("0a")
390
390
  }
391
391
  ]
392
392
  }
393
393
  ),
394
394
  /* @__PURE__ */ e(
395
- ro,
395
+ uo,
396
396
  {
397
- categoryGuids: ie,
398
- hoveredLegend: _,
399
- legendRef: f,
400
- onClickLegend: G,
401
- onHoverLegend: x,
402
- sx: { px: u ? 0 : 24 }
397
+ categoryGuids: he,
398
+ hoveredLegend: y,
399
+ legendRef: p,
400
+ onClickLegend: ge,
401
+ onHoverLegend: ae,
402
+ sx: { px: l ? 0 : 24 }
403
403
  }
404
404
  ),
405
- $ && /* @__PURE__ */ e(
406
- so,
405
+ z && /* @__PURE__ */ e(
406
+ lo,
407
407
  {
408
- categoryGuids: ee(E),
409
- chartContainerRef: y,
410
- cursorPosition: D,
411
- hoveredAreaData: P.map((c) => ({
412
- ...c,
413
- x: U(c.x, B.MONTH_SHORT_YEAR)
408
+ categoryGuids: j(I),
409
+ chartContainerRef: _,
410
+ cursorPosition: N,
411
+ hoveredAreaData: S.map((a) => ({
412
+ ...a,
413
+ x: Q(a.x, B.MONTH_SHORT_YEAR)
414
414
  }))
415
415
  }
416
416
  )
@@ -419,10 +419,10 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
419
419
  )
420
420
  }
421
421
  );
422
- }, lt = ({ selectedTab: o, onTabChange: s }) => {
422
+ }, dt = ({ selectedTab: o, onTabChange: s }) => {
423
423
  const { common: n } = k();
424
424
  return /* @__PURE__ */ e(
425
- kt,
425
+ Gt,
426
426
  {
427
427
  "aria-label": n.view_toggle,
428
428
  exclusive: !0,
@@ -430,36 +430,36 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
430
430
  orientation: "horizontal",
431
431
  value: o,
432
432
  children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(
433
- Rt,
433
+ Ot,
434
434
  {
435
435
  "aria-label": t === "Chart" ? n.view_chart : n.view_table,
436
436
  "aria-pressed": o === t,
437
437
  color: "primary",
438
438
  sx: { width: 56 },
439
439
  value: t,
440
- children: t === "Chart" ? /* @__PURE__ */ e(_e, { name: "table_chart_view" }) : /* @__PURE__ */ e(_e, { name: "format_list_bulleted" })
440
+ children: t === "Chart" ? /* @__PURE__ */ e(Te, { name: "table_chart_view" }) : /* @__PURE__ */ e(Te, { name: "format_list_bulleted" })
441
441
  },
442
442
  t
443
443
  ))
444
444
  }
445
445
  );
446
- }, dt = ({ selectedDateRange: o, selectedCategoryGuid: s }) => {
447
- const { trends: n } = k(), { isMobile: t, isDesktop: r } = X(), { getCategoryName: a } = Z(), d = m.useMemo(() => {
448
- const u = o.start.getFullYear() === o.end.getFullYear() ? U(
446
+ }, ut = ({ selectedDateRange: o, selectedCategoryGuid: s }) => {
447
+ const { trends: n } = k(), { isMobile: t, isDesktop: r } = q(), { getCategoryName: i } = J(), d = u.useMemo(() => {
448
+ const l = o.start.getFullYear() === o.end.getFullYear() ? Q(
449
449
  o.start,
450
450
  t ? B.MONTH_SHORT : B.MONTH_LONG
451
- ) : U(
451
+ ) : Q(
452
452
  o.start,
453
453
  t ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
454
- ), f = U(
454
+ ), p = Q(
455
455
  o.end,
456
456
  t ? B.MONTH_SHORT_YEAR : B.MONTH_YEAR
457
457
  );
458
- return `${u} - ${f}`;
459
- }, [o, t]), i = a(s) || (t ? n.sub_title : n.sub_title_by_category);
458
+ return `${l} - ${p}`;
459
+ }, [o, t]), c = i(s) || (t ? n.sub_title : n.sub_title_by_category);
460
460
  return /* @__PURE__ */ C(A, { children: [
461
461
  /* @__PURE__ */ e(
462
- z,
462
+ X,
463
463
  {
464
464
  display: "block",
465
465
  fontWeight: 700,
@@ -469,24 +469,24 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
469
469
  textOverflow: "unset"
470
470
  },
471
471
  variant: r ? "H3" : "Body",
472
- children: i
472
+ children: c
473
473
  }
474
474
  ),
475
- /* @__PURE__ */ e(z, { variant: r ? "subtitle1" : "body2", children: d })
475
+ /* @__PURE__ */ e(X, { variant: r ? "subtitle1" : "body2", children: d })
476
476
  ] });
477
- }, co = ({ name: o, topLevelCategoryGuid: s }) => /* @__PURE__ */ C(S, { alignItems: "center", direction: "row", justifyContent: "center", children: [
478
- /* @__PURE__ */ e(A, { "aria-hidden": !0, children: /* @__PURE__ */ e(Se, { categoryGuid: s, variant: "twotone" }) }),
479
- /* @__PURE__ */ e(z, { sx: { ml: 12 }, variant: "body2", children: o })
480
- ] }), lo = (o) => /* @__PURE__ */ e(S, { alignItems: "center", direction: "row", role: "rowheader", tabIndex: o.tabIndex, children: /* @__PURE__ */ e(
481
- co,
477
+ }, mo = ({ name: o, topLevelCategoryGuid: s }) => /* @__PURE__ */ C(x, { alignItems: "center", direction: "row", justifyContent: "center", children: [
478
+ /* @__PURE__ */ e(A, { "aria-hidden": !0, children: /* @__PURE__ */ e(we, { categoryGuid: s, variant: "twotone" }) }),
479
+ /* @__PURE__ */ e(X, { sx: { ml: 12 }, variant: "body2", children: o })
480
+ ] }), po = (o) => /* @__PURE__ */ e(x, { alignItems: "center", direction: "row", role: "rowheader", tabIndex: o.tabIndex, children: /* @__PURE__ */ e(
481
+ mo,
482
482
  {
483
483
  name: o.row.category,
484
484
  topLevelCategoryGuid: o.row.top_level_category_guid
485
485
  }
486
- ) }), Fe = (o) => {
487
- const s = o.row.category_guid, n = o.row.top_level_category_guid, t = s === Be.INCOME || n === Be.INCOME, r = o.row[o.field];
488
- return /* @__PURE__ */ e(S, { alignItems: "flex-end", direction: "row", tabIndex: o.tabIndex, children: /* @__PURE__ */ e(
489
- Te,
486
+ ) }), $e = (o) => {
487
+ const s = o.row.category_guid, n = o.row.top_level_category_guid, t = s === Ve.INCOME || n === Ve.INCOME, r = o.row[o.field];
488
+ return /* @__PURE__ */ e(x, { alignItems: "flex-end", direction: "row", tabIndex: o.tabIndex, children: /* @__PURE__ */ e(
489
+ xe,
490
490
  {
491
491
  amount: t ? Math.abs(r) : r,
492
492
  isIncome: t,
@@ -496,118 +496,118 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
496
496
  }
497
497
  ) });
498
498
  }, ze = (o, s) => {
499
- const n = U(nt(s.isoDate), B.MONTH_LONG);
499
+ const n = Q(st(s.isoDate), B.MONTH_LONG);
500
500
  return o[n] = s.amount, o;
501
- }, $e = (o) => (s, n) => {
502
- const t = U(nt(n.isoDate), B.MONTH_LONG);
501
+ }, Ke = (o) => (s, n) => {
502
+ const t = Q(st(n.isoDate), B.MONTH_LONG);
503
503
  return s + (o.includes(t) ? n.amount : 0);
504
- }, uo = (o, s) => {
504
+ }, fo = (o, s) => {
505
505
  const n = [], t = new Date(o);
506
506
  for (; t <= s; ) {
507
- const r = U(t, B.MONTH_LONG);
507
+ const r = Q(t, B.MONTH_LONG);
508
508
  n.push(r), t.setMonth(t.getMonth() + 1);
509
509
  }
510
510
  return n;
511
- }, ho = (o, s) => {
511
+ }, yo = (o, s) => {
512
512
  const n = {
513
513
  field: "category",
514
514
  flex: 1,
515
515
  headerClassName: "trends-table-header",
516
516
  headerName: s.category_title,
517
517
  minWidth: 210,
518
- renderHeader: Re,
519
- renderCell: lo,
518
+ renderHeader: ke,
519
+ renderCell: po,
520
520
  sortable: !0,
521
- sortComparator: It,
521
+ sortComparator: At,
522
522
  type: "string"
523
- }, t = o.map((a) => ({
524
- field: a,
523
+ }, t = o.map((i) => ({
524
+ field: i,
525
525
  flex: 1,
526
526
  headerClassName: "trends-table-header",
527
- headerName: a,
527
+ headerName: i,
528
528
  minWidth: 100,
529
- renderHeader: Re,
530
- renderCell: Fe,
529
+ renderHeader: ke,
530
+ renderCell: $e,
531
531
  align: "right",
532
532
  headerAlign: "right",
533
533
  sortable: !0,
534
534
  hideSortIcons: !1,
535
535
  type: "number",
536
- sortComparator: Ve
536
+ sortComparator: Fe
537
537
  })), r = {
538
538
  field: "total",
539
539
  flex: 1,
540
540
  headerClassName: "trends-table-header",
541
541
  headerName: s.table_column_total,
542
542
  minWidth: 100,
543
- renderHeader: Re,
544
- renderCell: Fe,
543
+ renderHeader: ke,
544
+ renderCell: $e,
545
545
  align: "right",
546
546
  headerAlign: "right",
547
547
  sortable: !0,
548
548
  hideSortIcons: !1,
549
549
  type: "number",
550
- sortComparator: Ve
550
+ sortComparator: Fe
551
551
  };
552
552
  return [n, ...t, r];
553
- }, go = (o, s, n, t) => {
554
- const r = o.map((a) => {
555
- let d = a.totalMonthlyAmounts;
556
- return t && (d = a.monthlyAmounts), {
557
- id: a.guid,
558
- category: a.name,
559
- category_guid: a.guid,
553
+ }, Co = (o, s, n, t) => {
554
+ const r = o.map((i) => {
555
+ let d = i.totalMonthlyAmounts;
556
+ return t && (d = i.monthlyAmounts), {
557
+ id: i.guid,
558
+ category: i.name,
559
+ category_guid: i.guid,
560
560
  isParent: !1,
561
- top_level_category_guid: a.parent_guid || a.guid,
562
- total: d.reduce($e(n), 0),
561
+ top_level_category_guid: i.parent_guid || i.guid,
562
+ total: d.reduce(Ke(n), 0),
563
563
  ...d.reduce(ze, {})
564
564
  };
565
565
  });
566
566
  if (t) {
567
- const a = t.monthlyAmounts.reduce($e(n), 0);
568
- a !== 0 && r.push({
567
+ const i = t.monthlyAmounts.reduce(Ke(n), 0);
568
+ i !== 0 && r.push({
569
569
  id: `sub-${t.guid}`,
570
- category: Je(s.category_general, t.name),
570
+ category: et(s.category_general, t.name),
571
571
  category_guid: t.guid,
572
572
  isParent: !0,
573
573
  top_level_category_guid: t.guid,
574
- total: a,
574
+ total: i,
575
575
  ...t.monthlyAmounts.reduce(ze, {})
576
576
  });
577
577
  }
578
578
  return r;
579
- }, ut = ({
579
+ }, ht = ({
580
580
  selectedDateRange: o,
581
581
  selectedCategory: s,
582
582
  onClickRow: n,
583
583
  height: t = "100%",
584
584
  sx: r = {}
585
585
  }) => {
586
- const a = ce(), { onEvent: d } = F(), { trends: p } = k(), { trendsCategories: i } = Z(), u = m.useMemo(() => uo(o.start, o.end), [o]), f = a.palette.mode === "light", l = m.useMemo(() => ho(u, p), [u, p]), y = m.useMemo(() => {
586
+ const i = le(), { onEvent: d } = $(), { trends: h } = k(), { trendsCategories: c } = J(), l = u.useMemo(() => fo(o.start, o.end), [o]), p = i.palette.mode === "light", m = u.useMemo(() => yo(l, h), [l, h]), _ = u.useMemo(() => {
587
587
  if (s)
588
- return i.find((g) => g.guid === s);
589
- }, [s, i]), h = m.useMemo(() => {
590
- let g = i;
591
- return y && (g = y.subCategories.filter(
592
- (_) => _.monthlyAmounts.some((T) => T.amount !== 0)
593
- )), go(g, p, u, y);
594
- }, [i, u, y, p]);
588
+ return c.find((g) => g.guid === s);
589
+ }, [s, c]), f = u.useMemo(() => {
590
+ let g = c;
591
+ return _ && (g = _.subCategories.filter(
592
+ (y) => y.monthlyAmounts.some((w) => w.amount !== 0)
593
+ )), Co(g, h, l, _);
594
+ }, [c, l, _, h]);
595
595
  return /* @__PURE__ */ e(A, { sx: { height: t, width: "100%", overflowX: "auto", boxShadow: "none", ...r }, children: /* @__PURE__ */ e(
596
- Ht,
596
+ Bt,
597
597
  {
598
- columns: l,
598
+ columns: m,
599
599
  disableColumnFilter: !0,
600
600
  disableColumnMenu: !0,
601
601
  hideFooter: !0,
602
602
  initialState: { sorting: { sortModel: [{ field: "category", sort: "asc" }] } },
603
603
  onRowClick: (g) => {
604
- y || n?.(g.row.category_guid), d(w.TRENDS_CLICK_LIST_ITEM, {
605
- ...V,
606
- listItem: wt[g.row.category_guid]
604
+ _ || n?.(g.row.category_guid), d(v.TRENDS_CLICK_LIST_ITEM, {
605
+ ...G,
606
+ listItem: Et[g.row.category_guid]
607
607
  });
608
608
  },
609
609
  rowHeight: 64,
610
- rows: h,
610
+ rows: f,
611
611
  slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
612
612
  sortingOrder: ["asc", "desc"],
613
613
  sx: {
@@ -616,117 +616,130 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
616
616
  borderStyle: "solid",
617
617
  borderRadius: 2,
618
618
  "& .MuiDataGrid-columnHeaders": {
619
- bgcolor: f ? "neutral.50" : "neutral.800",
619
+ bgcolor: p ? "neutral.50" : "neutral.800",
620
620
  borderBottom: "none"
621
621
  },
622
622
  "& .trends-table-header": {
623
- bgcolor: f ? "neutral.50" : "neutral.800"
623
+ bgcolor: p ? "neutral.50" : "neutral.800"
624
624
  }
625
625
  }
626
626
  }
627
627
  ) });
628
- }, mo = {
628
+ }, _o = {
629
629
  title: "Transaction List"
630
- }, po = ({
630
+ }, To = ({
631
631
  categoryGuid: o,
632
632
  dateRange: s,
633
633
  isOpen: n,
634
634
  onClose: t
635
635
  }) => {
636
- const { onEvent: r } = F(), { selectedAccountGuids: a } = pe(), { common: d } = k(), { setFilter: p, sortedTransactions: i } = xe(), [u, f] = m.useState(""), l = m.useMemo(
637
- () => i.find((h) => h.guid === u),
638
- [u, i]
636
+ const { onEvent: r } = $(), { selectedAccountGuids: i } = ye(), { common: d } = k(), { setFilter: h, sortedTransactions: c } = ve(), [l, p] = u.useState(""), m = u.useMemo(
637
+ () => c.find((f) => f.guid === l),
638
+ [l, c]
639
639
  );
640
- m.useEffect(() => {
641
- p({
642
- accounts: a,
640
+ u.useEffect(() => {
641
+ h({
642
+ accounts: i,
643
643
  dateRange: s,
644
- custom: (h) => o === "" || o === h.category_guid || o === h.top_level_category_guid,
644
+ custom: (f) => o === "" || o === f.category_guid || o === f.top_level_category_guid,
645
645
  showSplits: !!o
646
646
  });
647
- }, [a, o, s]), m.useEffect(() => r(w.TRENDS_VIEW_TRANSACTIONS), []);
648
- const y = () => {
649
- f(""), t();
647
+ }, [i, o, s]), u.useEffect(() => r(v.TRENDS_VIEW_TRANSACTIONS), []);
648
+ const _ = () => {
649
+ p(""), t();
650
650
  };
651
651
  return /* @__PURE__ */ C(
652
652
  Ne,
653
653
  {
654
654
  ariaLabelClose: d.close_aria,
655
655
  isOpen: n,
656
- onClose: y,
657
- title: mo.title,
656
+ onClose: _,
657
+ title: _o.title,
658
658
  children: [
659
- l && /* @__PURE__ */ e(rt, { transaction: l }),
660
- !l && /* @__PURE__ */ e(at, { onClick: f })
659
+ m && /* @__PURE__ */ e(at, { transaction: m }),
660
+ !m && /* @__PURE__ */ e(it, { onClick: p })
661
661
  ]
662
662
  }
663
663
  );
664
- }, fo = R(po), Co = ({ onBackClick: o, sx: s }) => {
665
- const { onEvent: n } = F(), { isDesktop: t, isTablet: r, isMobile: a } = X(), { visibleAccounts: d } = we(), { loadMonthlyCategoryTotals: p, monthlyCategoryTotals: i, getCategoryName: u } = Z(), { sortedTransactions: f } = xe(), { selectedDateRange: l, setSelectedDateRange: y } = fe(), { isCopyLoaded: h, isInitialized: g, selectedAccounts: _, setSelectedAccounts: T } = pe(), { trends: L } = k(), [I, E] = m.useState(!1), [P, H] = m.useState(!1), [D, $] = m.useState("Chart"), [M, O] = m.useState(""), [N, Q] = m.useState(window.innerHeight), oe = N - (a ? 315 : 345);
666
- ve({
664
+ }, bo = R(To), So = ({ onBackClick: o, sx: s }) => {
665
+ const { onEvent: n } = $(), { isDesktop: t, isTablet: r, isMobile: i } = q(), { isAccountDataLoaded: d, loadAccountData: h } = De(), {
666
+ categoriesLoaded: c,
667
+ loadCategories: l,
668
+ loadDateRangeCategoryTotals: p,
669
+ loadMonthlyCategoryTotals: m,
670
+ monthlyCategoryTotals: _,
671
+ getCategoryName: f
672
+ } = J(), {
673
+ isTransactionDataLoaded: g,
674
+ loadTransactionData: y,
675
+ sortedTransactions: w
676
+ } = ve(), { selectedDateRange: b, setSelectedDateRange: M } = Ce(), { isInitialized: I, selectedAccounts: S } = ye(), { trends: H } = k(), [N, z] = u.useState(!1), [V, K] = u.useState(!1), [E, te] = u.useState("Chart"), [O, ne] = u.useState(""), [se, Z] = u.useState(window.innerHeight), ue = se - (i ? 315 : 345);
677
+ Le({
667
678
  widgetName: "TrendsFullWidget",
668
- isLoaded: I
669
- }), m.useEffect(() => {
670
- const x = () => Q(window.innerHeight);
671
- return window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
672
- }, []), m.useEffect(() => {
673
- T(d);
674
- }, [d]), m.useEffect(() => {
675
- g && p(
676
- _,
677
- l.start,
678
- l.end
679
- ).finally(() => {
680
- E(!0);
679
+ isLoaded: N
680
+ }), u.useEffect(() => {
681
+ const D = () => Z(window.innerHeight);
682
+ return window.addEventListener("resize", D), d || h().finally(), c || l().finally(), g || y().finally(), () => window.removeEventListener("resize", D);
683
+ }, []), u.useEffect(() => {
684
+ I && p(S, b.start, b.end).then(() => {
685
+ m(
686
+ S,
687
+ b.start,
688
+ b.end
689
+ );
690
+ }).finally(() => {
691
+ z(!0), n(v.TRENDS_LOAD_WIDGET, {
692
+ ...G,
693
+ time_period: `${Se(b.end, b.start)}M`
694
+ });
681
695
  });
682
- }, [g, _, l]);
683
- const re = m.useMemo(() => {
684
- if (!I) return { stackedDatasets: [], unstackedDatasets: [] };
685
- const x = Lt(
686
- i,
687
- l.start,
688
- l.end
689
- ), G = M.length ? x.filter(
690
- (Y) => Y.top_level_category_guid === M || Y.category_guid === M
691
- ) : Et(x);
696
+ }, [I, S, b]);
697
+ const F = u.useMemo(() => {
698
+ if (!N) return { stackedDatasets: [], unstackedDatasets: [] };
699
+ const D = Rt(
700
+ _,
701
+ b.start,
702
+ b.end
703
+ ), P = O.length ? D.filter(
704
+ (a) => a.top_level_category_guid === O || a.category_guid === O
705
+ ) : kt(D);
692
706
  return {
693
- stackedDatasets: G.filter(Dt),
694
- unstackedDatasets: G.filter(Mt)
707
+ stackedDatasets: P.filter(Ht),
708
+ unstackedDatasets: P.filter(Nt)
695
709
  };
696
- }, [i, M, l]), q = (x, G) => {
697
- $(G ?? D), n(w.TRENDS_CLICK_TOGGLE_VIEW);
698
- }, le = (x) => {
699
- const G = Ue(x?.[0], 1), Y = x?.[1], de = ke(Y, G);
700
- y({ start: G, end: Y }), n(w.TRENDS_CLICK_TIME_WINDOW, {
701
- time_period: de + "M"
710
+ }, [_, O, b]), re = (D, P) => {
711
+ te(P ?? E), n(v.TRENDS_CLICK_TOGGLE_VIEW);
712
+ }, Y = (D) => {
713
+ const P = Xe(D?.[0], 1), a = D?.[1], T = Se(a, P);
714
+ M({ start: P, end: a }), n(v.TRENDS_CLICK_TIME_WINDOW, {
715
+ time_period: T + "M"
702
716
  });
703
- }, ne = () => {
704
- n(w.TRENDS_CLICK_FILTER);
705
- }, K = (x) => {
706
- O(x);
707
- }, ae = (x) => {
708
- O(x), n(w.TRENDS_CLICK_LEGEND, { category: u(x) });
709
- }, J = (x) => {
710
- n(w.TRENDS_HOVER_LEGEND, { category: u(x) });
711
- }, ie = (x) => {
712
- n(w.TRENDS_HOVER_AREA, { category: x });
713
- }, ee = (x) => {
714
- n(w.TRENDS_HOVER_POINT, { category: x });
717
+ }, he = () => {
718
+ n(v.TRENDS_CLICK_FILTER);
719
+ }, j = (D) => {
720
+ ne(D);
721
+ }, ae = (D) => {
722
+ ne(D), n(v.TRENDS_CLICK_LEGEND, { category: f(D) });
723
+ }, ge = (D) => {
724
+ n(v.TRENDS_HOVER_LEGEND, { category: f(D) });
725
+ }, ie = (D) => {
726
+ n(v.TRENDS_HOVER_AREA, { category: D });
727
+ }, ce = (D) => {
728
+ n(v.TRENDS_HOVER_POINT, { category: D });
715
729
  };
716
- return !h || !g || !I ? /* @__PURE__ */ e(me, {}) : /* @__PURE__ */ C(
717
- st,
730
+ return !I || !N ? /* @__PURE__ */ e(Ie, {}) : /* @__PURE__ */ C(
731
+ rt,
718
732
  {
719
- accountOptions: d,
720
- calendarActions: { onRangeChanged: le },
721
- dateRange: l,
733
+ calendarActions: { onRangeChanged: Y },
734
+ dateRange: b,
722
735
  dateRangeVariant: "timeframebuttons",
723
- onAccountsFilterClick: ne,
736
+ onAccountsFilterClick: he,
724
737
  onBackClick: o,
725
738
  sx: s,
726
- title: L.title,
739
+ title: H.title,
727
740
  children: [
728
741
  /* @__PURE__ */ C(
729
- S,
742
+ x,
730
743
  {
731
744
  sx: {
732
745
  // eslint-disable-next-line no-nested-ternary
@@ -734,49 +747,49 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
734
747
  },
735
748
  children: [
736
749
  /* @__PURE__ */ C(
737
- S,
750
+ x,
738
751
  {
739
752
  flexDirection: "row",
740
753
  justifyContent: "space-between",
741
- sx: { pb: a ? 12 : 24, pt: a ? 24 : 48 },
754
+ sx: { pb: i ? 12 : 24, pt: i ? 24 : 48 },
742
755
  children: [
743
756
  /* @__PURE__ */ e(
744
- dt,
757
+ ut,
745
758
  {
746
- selectedCategoryGuid: M,
747
- selectedDateRange: l
759
+ selectedCategoryGuid: O,
760
+ selectedDateRange: b
748
761
  }
749
762
  ),
750
- /* @__PURE__ */ e(lt, { onTabChange: q, selectedTab: D })
763
+ /* @__PURE__ */ e(dt, { onTabChange: re, selectedTab: E })
751
764
  ]
752
765
  }
753
766
  ),
754
- /* @__PURE__ */ C(S, { alignItems: "center", flexDirection: "row", width: "100%", children: [
755
- /* @__PURE__ */ e(A, { flexGrow: 1, children: M && /* @__PURE__ */ C(be, { onClick: () => O(""), sx: { p: 0, pr: 5 }, children: [
756
- /* @__PURE__ */ e(_e, { name: "arrow_back" }),
757
- L.all_categories
767
+ /* @__PURE__ */ C(x, { alignItems: "center", flexDirection: "row", width: "100%", children: [
768
+ /* @__PURE__ */ e(A, { flexGrow: 1, children: O && /* @__PURE__ */ C(be, { onClick: () => ne(""), sx: { p: 0, pr: 5 }, children: [
769
+ /* @__PURE__ */ e(Te, { name: "arrow_back" }),
770
+ H.all_categories
758
771
  ] }) }),
759
- /* @__PURE__ */ e(be, { onClick: () => H(!0), sx: { px: 5 }, children: `${L.view_transactions} (${f.length})` })
772
+ /* @__PURE__ */ e(be, { onClick: () => K(!0), sx: { px: 5 }, children: `${H.view_transactions} (${w.length})` })
760
773
  ] }),
761
774
  /* @__PURE__ */ C(A, { children: [
762
- D === "Chart" && /* @__PURE__ */ e(
763
- io,
775
+ E === "Chart" && /* @__PURE__ */ e(
776
+ go,
764
777
  {
765
- availableHeight: oe,
778
+ availableHeight: ue,
766
779
  onClickLegend: ae,
767
780
  onHoverArea: ie,
768
- onHoverLegend: J,
769
- onHoverPoint: ee,
770
- stackedDatasets: re.stackedDatasets,
771
- unstackedDatasets: re.unstackedDatasets
781
+ onHoverLegend: ge,
782
+ onHoverPoint: ce,
783
+ stackedDatasets: F.stackedDatasets,
784
+ unstackedDatasets: F.unstackedDatasets
772
785
  }
773
786
  ),
774
- D === "Table" && /* @__PURE__ */ e(
775
- ut,
787
+ E === "Table" && /* @__PURE__ */ e(
788
+ ht,
776
789
  {
777
- onClickRow: K,
778
- selectedCategory: M,
779
- selectedDateRange: l
790
+ onClickRow: j,
791
+ selectedCategory: O,
792
+ selectedDateRange: b
780
793
  }
781
794
  )
782
795
  ] })
@@ -784,19 +797,19 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
784
797
  }
785
798
  ),
786
799
  /* @__PURE__ */ e(
787
- fo,
800
+ bo,
788
801
  {
789
- categoryGuid: M,
790
- dateRange: l,
791
- isOpen: P,
792
- onClose: () => H(!1)
802
+ categoryGuid: O,
803
+ dateRange: b,
804
+ isOpen: V,
805
+ onClose: () => K(!1)
793
806
  }
794
807
  )
795
808
  ]
796
809
  }
797
810
  );
798
- }, Bn = R(Co), yo = () => {
799
- const { monthlyCategoryTotals: o } = Z(), { trends: s } = k(), n = ce(), { availableHeight: t = 300 } = Qe(), r = At(o);
811
+ }, zn = R(So), xo = () => {
812
+ const { monthlyCategoryTotals: o } = J(), { trends: s } = k(), n = le(), { availableHeight: t = 300 } = qe(), r = u.useMemo(() => Wt(o), [o]);
800
813
  return /* @__PURE__ */ e(
801
814
  Oe,
802
815
  {
@@ -813,41 +826,41 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
813
826
  valueFormatterString: "0,0"
814
827
  }
815
828
  );
816
- }, _o = R(yo), bo = ({ onPrimaryCtaClick: o, sx: s }) => {
817
- const { visibleAccounts: n } = we(), { loadMonthlyCategoryTotals: t, monthlyTotalsLoaded: r } = Z(), { isInitialized: a } = We(), { trends: d } = k(), { isCopyLoaded: p, selectedAccounts: i, setSelectedAccounts: u } = pe();
818
- return ve({
829
+ }, wo = R(xo), vo = ({ onPrimaryCtaClick: o, sx: s }) => {
830
+ const { isAccountDataLoaded: n, loadAccountData: t } = De(), { loadMonthlyCategoryTotals: r, monthlyTotalsLoaded: i } = J(), { isInitialized: d } = We(), { trends: h } = k(), { selectedAccounts: c } = ye();
831
+ return u.useEffect(() => {
832
+ n || t().finally();
833
+ }, []), Le({
819
834
  widgetName: "TrendsMiniWidget",
820
- isLoaded: r
821
- }), m.useEffect(() => {
822
- u(n);
823
- }, [n]), m.useEffect(() => {
824
- a && t(i).finally();
825
- }, [a, i]), !p || !a ? /* @__PURE__ */ e(me, {}) : /* @__PURE__ */ e(
826
- Wt,
835
+ isLoaded: i
836
+ }), u.useEffect(() => {
837
+ d && n && r(c).finally();
838
+ }, [n, d, c]), !n || !d || !i ? /* @__PURE__ */ e(Ie, {}) : /* @__PURE__ */ e(
839
+ Ft,
827
840
  {
828
- contentStyles: { height: "calc(100% - 72px)", ":last-child": { pb: 0 } },
841
+ contentStyles: { height: "calc(100% - 72px)", minHeight: 300, ":last-child": { pb: 0 } },
829
842
  onPrimaryCtaClick: o,
830
- primaryCtaLabel: d.primary_cta,
831
- subTitle: d.sub_title,
843
+ primaryCtaLabel: h.primary_cta,
844
+ subTitle: h.sub_title,
832
845
  sx: { height: "100%", ...s },
833
- title: d.mini_title,
834
- children: r ? /* @__PURE__ */ e(_o, {}) : /* @__PURE__ */ e(me, {})
846
+ title: h.mini_title,
847
+ children: /* @__PURE__ */ e(wo, {})
835
848
  }
836
849
  );
837
- }, Vn = R(bo), To = 70, Ke = ({
850
+ }, Kn = R(vo), Do = 70, Ye = ({
838
851
  title: o,
839
852
  totalAmount: s,
840
853
  transactionType: n,
841
854
  percentage: t,
842
855
  secondaryLabel: r,
843
- shouldDisplayPercentage: a
856
+ shouldDisplayPercentage: i
844
857
  }) => {
845
- const { availableWidth: d } = Qe(), p = m.useRef(null), i = m.useRef(null), u = vt(Number(Math.abs(t)), {
858
+ const { availableWidth: d } = qe(), h = u.useRef(null), c = u.useRef(null), l = Mt(Number(Math.abs(t)), {
846
859
  style: "percent",
847
860
  minimumIntegerDigits: 1
848
- }), f = d === 288 && se(s, "0,0.00").length > 10 ? se(s, "0,0") : se(s, "0,0.00"), l = n === "spending" ? t > 0 : t >= 0, y = n === "spending" ? "error.main" : "success.main", h = n === "spending" ? "success.main" : "text.secondary", g = p?.current, _ = i?.current, T = g && _ ? g.scrollWidth > _.clientWidth - To : !1;
861
+ }), p = d === 288 && oe(s, "0,0.00").length > 10 ? oe(s, "0,0") : oe(s, "0,0.00"), m = n === "spending" ? t > 0 : t >= 0, _ = n === "spending" ? "error.main" : "success.main", f = n === "spending" ? "success.main" : "text.secondary", g = h?.current, y = c?.current, w = g && y ? g.scrollWidth > y.clientWidth - Do : !1;
849
862
  return /* @__PURE__ */ C(
850
- S,
863
+ x,
851
864
  {
852
865
  sx: {
853
866
  border: 1,
@@ -860,7 +873,7 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
860
873
  },
861
874
  children: [
862
875
  /* @__PURE__ */ C(
863
- S,
876
+ x,
864
877
  {
865
878
  sx: {
866
879
  alignItems: "center",
@@ -868,18 +881,18 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
868
881
  justifyContent: "space-between"
869
882
  },
870
883
  children: [
871
- /* @__PURE__ */ e(ge, { color: "text.secondary", variant: "caption", children: o }),
872
- a && /* @__PURE__ */ C(S, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
873
- l ? /* @__PURE__ */ e(Gt, { size: 20, sx: { color: y } }) : /* @__PURE__ */ e(Bt, { size: 20, sx: { color: h } }),
884
+ /* @__PURE__ */ e(fe, { color: "text.secondary", variant: "caption", children: o }),
885
+ i && /* @__PURE__ */ C(x, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
886
+ m ? /* @__PURE__ */ e($t, { size: 20, sx: { color: _ } }) : /* @__PURE__ */ e(zt, { size: 20, sx: { color: f } }),
874
887
  /* @__PURE__ */ e(
875
- ge,
888
+ fe,
876
889
  {
877
890
  sx: {
878
- color: l ? y : h,
891
+ color: m ? _ : f,
879
892
  fontWeight: 600
880
893
  },
881
894
  variant: "body2",
882
- children: u
895
+ children: l
883
896
  }
884
897
  )
885
898
  ] })
@@ -887,9 +900,9 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
887
900
  }
888
901
  ),
889
902
  /* @__PURE__ */ C(
890
- S,
903
+ x,
891
904
  {
892
- ref: i,
905
+ ref: c,
893
906
  sx: {
894
907
  alignItems: "center",
895
908
  flexDirection: "row",
@@ -899,15 +912,15 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
899
912
  /* @__PURE__ */ e(
900
913
  A,
901
914
  {
902
- ref: p,
915
+ ref: h,
903
916
  sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
904
- children: /* @__PURE__ */ e(je, { children: f })
917
+ children: /* @__PURE__ */ e(Ue, { children: p })
905
918
  }
906
919
  ),
907
- a && d >= 450 && !T && /* @__PURE__ */ e(
908
- ge,
920
+ i && d >= 450 && !w && /* @__PURE__ */ e(
921
+ fe,
909
922
  {
910
- color: l ? y : h,
923
+ color: m ? _ : f,
911
924
  variant: "caption",
912
925
  children: r
913
926
  }
@@ -918,53 +931,55 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
918
931
  ]
919
932
  }
920
933
  );
921
- }, So = R(() => {
934
+ }, Lo = R(() => {
922
935
  const { trends: o } = k();
923
- return /* @__PURE__ */ C(S, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
924
- /* @__PURE__ */ e(Vt, { size: 32 }),
925
- /* @__PURE__ */ C(S, { children: [
926
- /* @__PURE__ */ e(ge, { fontWeight: 600, variant: "body1", children: o.zero_state_content_header }),
927
- /* @__PURE__ */ e(ge, { color: "text.secondary", variant: "subtitle2", children: o.zero_state_content_description })
936
+ return /* @__PURE__ */ C(x, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
937
+ /* @__PURE__ */ e(Kt, { size: 32 }),
938
+ /* @__PURE__ */ C(x, { children: [
939
+ /* @__PURE__ */ e(fe, { fontWeight: 600, variant: "body1", children: o.zero_state_content_header }),
940
+ /* @__PURE__ */ e(fe, { color: "text.secondary", variant: "subtitle2", children: o.zero_state_content_description })
928
941
  ] })
929
942
  ] });
930
- }), Pn = R(({ onCtaClick: o }) => {
931
- const { visibleAccounts: s } = we(), { onEvent: n } = F(), { monthlyCategoryTotals: t, loadMonthlyCategoryTotals: r, monthlyTotalsLoaded: a } = Z(), d = {
932
- start: Ot(/* @__PURE__ */ new Date(), 1),
943
+ }), Yn = R(({ onCtaClick: o }) => {
944
+ const { isAccountDataLoaded: s, loadAccountData: n, visibleAccounts: t } = De();
945
+ u.useEffect(() => {
946
+ s || n().finally();
947
+ }, []);
948
+ const { onEvent: r } = $(), { monthlyCategoryTotals: i, loadMonthlyCategoryTotals: d, monthlyTotalsLoaded: h } = J(), c = {
949
+ start: Pt(/* @__PURE__ */ new Date(), 1),
933
950
  end: /* @__PURE__ */ new Date()
934
- }, { trends: p } = k(), { selectedAccounts: i, setSelectedAccounts: u, isInitialized: f } = pe();
935
- ve({
951
+ }, { trends: l } = k(), { selectedAccounts: p, isInitialized: m } = ye();
952
+ Le({
936
953
  widgetName: "TrendsMicroWidget",
937
- isLoaded: a
938
- }), m.useEffect(() => {
939
- u(s);
940
- }, [s]), m.useEffect(() => {
941
- f && r(i, d.start).then(() => {
942
- n(w.TRENDS_LOAD_WIDGET, {
943
- state: s?.length ? "default" : "zeroState"
954
+ isLoaded: h
955
+ }), u.useEffect(() => {
956
+ m && d(p, c.start).then(() => {
957
+ r(v.TRENDS_LOAD_WIDGET, {
958
+ state: t?.length ? "default" : "zeroState"
944
959
  });
945
960
  });
946
- }, [f, i]);
947
- const { spendingData: l, incomeData: y } = m.useMemo(
961
+ }, [m, p]);
962
+ const { spendingData: _, incomeData: f } = u.useMemo(
948
963
  () => ({
949
- spendingData: tt(t, d),
950
- incomeData: ot(t, d)
964
+ spendingData: ot(i, c),
965
+ incomeData: nt(i, c)
951
966
  }),
952
- [t, d]
953
- ), [h, g] = l, [_, T] = y, L = Pe(g.y, h.y), I = Pe(T.y, _.y), E = f && !s?.length, P = () => {
954
- n(
955
- E ? w.TRENDS_CLICK_GET_STARTED : w.TRENDS_CLICK_VIEW_MORE
967
+ [i, c]
968
+ ), [g, y] = _, [w, b] = f, M = Pe(y.y, g.y), I = Pe(b.y, w.y), S = m && !t?.length, H = () => {
969
+ r(
970
+ S ? v.TRENDS_CLICK_GET_STARTED : v.TRENDS_CLICK_VIEW_MORE
956
971
  ), o();
957
972
  };
958
- return !a || !f ? /* @__PURE__ */ e(me, {}) : /* @__PURE__ */ e(
959
- zt,
973
+ return !h || !m ? /* @__PURE__ */ e(Ie, {}) : /* @__PURE__ */ e(
974
+ Ut,
960
975
  {
961
976
  className: "mx-trends-microwidget",
962
- ctaLabel: p.micro_primary_cta_label,
963
- onCTAClick: P,
964
- subHeader: E ? void 0 : p.micro_subheader,
965
- title: p.title,
966
- children: E ? /* @__PURE__ */ e(So, {}) : /* @__PURE__ */ C(
967
- S,
977
+ ctaLabel: l.micro_primary_cta_label,
978
+ onCTAClick: H,
979
+ subHeader: S ? void 0 : l.micro_subheader,
980
+ title: l.title,
981
+ children: S ? /* @__PURE__ */ e(Lo, {}) : /* @__PURE__ */ C(
982
+ x,
968
983
  {
969
984
  sx: {
970
985
  alignItems: "stretch",
@@ -973,24 +988,24 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
973
988
  },
974
989
  children: [
975
990
  /* @__PURE__ */ e(
976
- Ke,
991
+ Ye,
977
992
  {
978
- percentage: L,
979
- secondaryLabel: p.micro_secondary_label,
980
- shouldDisplayPercentage: g.y !== 0 && h.y !== 0,
981
- title: p.spending_label,
982
- totalAmount: g.y,
993
+ percentage: M,
994
+ secondaryLabel: l.micro_secondary_label,
995
+ shouldDisplayPercentage: y.y !== 0 && g.y !== 0,
996
+ title: l.spending_label,
997
+ totalAmount: y.y,
983
998
  transactionType: "spending"
984
999
  }
985
1000
  ),
986
1001
  /* @__PURE__ */ e(
987
- Ke,
1002
+ Ye,
988
1003
  {
989
1004
  percentage: I,
990
- secondaryLabel: p.micro_secondary_label,
991
- shouldDisplayPercentage: T.y !== 0 && _.y !== 0,
992
- title: p.income_label,
993
- totalAmount: T.y,
1005
+ secondaryLabel: l.micro_secondary_label,
1006
+ shouldDisplayPercentage: b.y !== 0 && w.y !== 0,
1007
+ title: l.income_label,
1008
+ totalAmount: b.y,
994
1009
  transactionType: "income"
995
1010
  }
996
1011
  )
@@ -999,17 +1014,17 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
999
1014
  )
1000
1015
  }
1001
1016
  );
1002
- }), xo = R(
1017
+ }), Io = R(
1003
1018
  ({ isExpanded: o, onClick: s }) => {
1004
- const n = it();
1005
- return /* @__PURE__ */ e(Yt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(jt, { onClick: s, sx: { justifyContent: "center" }, children: /* @__PURE__ */ C(
1006
- S,
1019
+ const n = ct();
1020
+ return /* @__PURE__ */ e(Qt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(qt, { onClick: s, sx: { justifyContent: "center" }, children: /* @__PURE__ */ C(
1021
+ x,
1007
1022
  {
1008
1023
  sx: { color: n.palette.primary.main, flexDirection: "row", alignItems: "center" },
1009
1024
  children: [
1010
- /* @__PURE__ */ e(Xt, { children: /* @__PURE__ */ e(z, { bold: !0, variant: "body2", children: o ? "View less" : "View more" }) }),
1011
- /* @__PURE__ */ e(Ut, { sx: { color: n.palette.primary.main }, children: o ? /* @__PURE__ */ e(Pt, {}) : /* @__PURE__ */ e(
1012
- Ft,
1025
+ /* @__PURE__ */ e(eo, { children: /* @__PURE__ */ e(X, { bold: !0, variant: "body2", children: o ? "View less" : "View more" }) }),
1026
+ /* @__PURE__ */ e(Jt, { sx: { color: n.palette.primary.main }, children: o ? /* @__PURE__ */ e(Yt, {}) : /* @__PURE__ */ e(
1027
+ jt,
1013
1028
  {
1014
1029
  sx: {
1015
1030
  transition: "transform 0.3s ease-in-out",
@@ -1021,73 +1036,73 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
1021
1036
  }
1022
1037
  ) }) });
1023
1038
  }
1024
- ), Ye = R(
1039
+ ), je = R(
1025
1040
  ({
1026
1041
  totalAmount: o,
1027
1042
  guid: s,
1028
1043
  name: n,
1029
1044
  transactions: t,
1030
1045
  onClick: r,
1031
- isLastItem: a = !1,
1046
+ isLastItem: i = !1,
1032
1047
  showDivider: d = !0
1033
1048
  }) => {
1034
- const { trends: p } = k(), { onEvent: i } = F(), u = `${t.length} ${t.length === 1 ? p.transaction : p.transactions}`, f = () => {
1035
- r?.(), i(w.TRENDS_CLICK_LIST_ITEM, {
1036
- ...V,
1049
+ const { trends: h } = k(), { onEvent: c } = $(), l = `${t.length} ${t.length === 1 ? h.transaction : h.transactions}`, p = () => {
1050
+ r?.(), c(v.TRENDS_CLICK_LIST_ITEM, {
1051
+ ...G,
1037
1052
  listItem: n
1038
1053
  });
1039
1054
  };
1040
- return /* @__PURE__ */ C(m.Fragment, { children: [
1055
+ return /* @__PURE__ */ C(u.Fragment, { children: [
1041
1056
  /* @__PURE__ */ e(
1042
- et,
1057
+ tt,
1043
1058
  {
1044
- leftIcon: s ? /* @__PURE__ */ e(Se, { categoryGuid: s }) : void 0,
1045
- onClick: f,
1046
- rightContent: se(Math.abs(o), "0,0.00"),
1047
- rightIcon: r ? /* @__PURE__ */ e(yt, {}) : void 0,
1048
- subtitle: u,
1059
+ leftIcon: s ? /* @__PURE__ */ e(we, { categoryGuid: s }) : void 0,
1060
+ onClick: p,
1061
+ rightContent: oe(Math.abs(o), "0,0.00"),
1062
+ rightIcon: r ? /* @__PURE__ */ e(xt, {}) : void 0,
1063
+ subtitle: l,
1049
1064
  title: n
1050
1065
  }
1051
1066
  ),
1052
- d && /* @__PURE__ */ e(He, { sx: { ml: a ? 24 : 68 } })
1067
+ d && /* @__PURE__ */ e(He, { sx: { ml: i ? 24 : 68 } })
1053
1068
  ] }, s);
1054
1069
  }
1055
- ), wo = R(
1070
+ ), Eo = R(
1056
1071
  ({ availableHeight: o = 0, onCategoryClick: s }) => {
1057
- const { collapsedCategories: n, visibleCategories: t, setVisibleListLength: r } = fe(), { isLargeDesktop: a, isDesktop: d } = X(), { trends: p } = k(), { onEvent: i } = F(), [u, f] = m.useState(!1), l = d || a;
1058
- m.useEffect(() => {
1059
- const g = Math.floor(o / 64) - 1, _ = t.length + n.length;
1060
- g !== t.length && (r(l ? Math.max(g, 5) : 5), f(g >= _));
1072
+ const { collapsedCategories: n, visibleCategories: t, setVisibleListLength: r } = Ce(), { isLargeDesktop: i, isDesktop: d } = q(), { trends: h } = k(), { onEvent: c } = $(), [l, p] = u.useState(!1), m = d || i;
1073
+ u.useEffect(() => {
1074
+ const g = Math.floor(o / 64) - 1, y = t.length + n.length;
1075
+ g !== t.length && (r(m ? Math.max(g, 5) : 5), p(g >= y));
1061
1076
  }, [o]);
1062
- const y = () => {
1063
- f(!u), i(w.TRENDS_CLICK_VIEW_MORE, {
1064
- ...V
1077
+ const _ = () => {
1078
+ p(!l), c(v.TRENDS_CLICK_VIEW_MORE, {
1079
+ ...G
1065
1080
  });
1066
- }, h = t.length + (u ? n.length : 0);
1067
- return /* @__PURE__ */ e(S, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ C(Kt, { children: [
1068
- /* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(je, { children: p.categories }) }),
1069
- t.map((g, _) => /* @__PURE__ */ e(
1070
- Ye,
1081
+ }, f = t.length + (l ? n.length : 0);
1082
+ return /* @__PURE__ */ e(x, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ C(Zt, { children: [
1083
+ /* @__PURE__ */ e(x, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Ue, { children: h.categories }) }),
1084
+ t.map((g, y) => /* @__PURE__ */ e(
1085
+ je,
1071
1086
  {
1072
1087
  ...g,
1073
- isLastItem: _ === h - 1,
1088
+ isLastItem: y === f - 1,
1074
1089
  onClick: g.transactions.length > 0 ? () => s(g) : void 0,
1075
1090
  showDivider: !0
1076
1091
  },
1077
1092
  g.guid
1078
1093
  )),
1079
1094
  /* @__PURE__ */ e(
1080
- $t,
1095
+ Xt,
1081
1096
  {
1082
- in: u,
1097
+ in: l,
1083
1098
  sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
1084
- children: n.map((g, _) => {
1085
- const T = t.length + _;
1099
+ children: n.map((g, y) => {
1100
+ const w = t.length + y;
1086
1101
  return /* @__PURE__ */ e(
1087
- Ye,
1102
+ je,
1088
1103
  {
1089
1104
  ...g,
1090
- isLastItem: T === h - 1,
1105
+ isLastItem: w === f - 1,
1091
1106
  onClick: g.transactions.length > 0 ? () => s(g) : void 0,
1092
1107
  showDivider: !0
1093
1108
  },
@@ -1096,39 +1111,39 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
1096
1111
  })
1097
1112
  }
1098
1113
  ),
1099
- n.length > 0 && /* @__PURE__ */ e(xo, { isExpanded: u, onClick: y })
1114
+ n.length > 0 && /* @__PURE__ */ e(Io, { isExpanded: l, onClick: _ })
1100
1115
  ] }) });
1101
1116
  }
1102
- ), vo = ({ beats: o, onInsightCardClick: s }) => {
1103
- const { onEvent: n } = F(), { isMobile: t, isDesktop: r, isLargeDesktop: a } = X(), { beatStore: d, endpoint: p, sessionToken: i } = We(), u = r || a, f = u || t ? 1 : 2, l = () => null, y = (I) => {
1104
- s?.(I), n(w.TRENDS_CLICK_INSIGHT, V);
1105
- }, h = u ? 200 : 170, g = u ? 170 : 124, _ = u ? 56 : 0, T = o.length > 0 ? h + _ : g, L = u && o.length > 0 ? h : void 0;
1106
- return /* @__PURE__ */ e(Zt, { sx: { height: T }, children: /* @__PURE__ */ e(
1107
- Nt,
1117
+ ), Mo = ({ beats: o, onInsightCardClick: s }) => {
1118
+ const { onEvent: n } = $(), { isMobile: t, isDesktop: r, isLargeDesktop: i } = q(), { beatStore: d, endpoint: h, sessionToken: c } = We(), l = r || i, p = l || t ? 1 : 2, m = () => null, _ = (M) => {
1119
+ s?.(M), n(v.TRENDS_CLICK_INSIGHT, G);
1120
+ }, f = l ? 200 : 170, g = l ? 170 : 124, y = l ? 56 : 0, w = o.length > 0 ? f + y : g, b = l && o.length > 0 ? f : void 0;
1121
+ return /* @__PURE__ */ e(to, { sx: { height: w }, children: /* @__PURE__ */ e(
1122
+ Vt,
1108
1123
  {
1109
1124
  areBeatsLoading: d.isLoading,
1110
1125
  beats: o,
1111
- endpoint: p,
1112
- heightOverrides: L,
1113
- logOutUser: l,
1114
- onCardClick: y,
1126
+ endpoint: h,
1127
+ heightOverrides: b,
1128
+ logOutUser: m,
1129
+ onCardClick: _,
1115
1130
  showBorder: !0,
1116
1131
  showCTAColocatedWithText: !1,
1117
1132
  showCarouselControls: !0,
1118
- showHeader: u,
1133
+ showHeader: l,
1119
1134
  showIcon: !0,
1120
1135
  showWithMargin: !1,
1121
- token: i,
1136
+ token: c,
1122
1137
  userHasFullInsightFeedBeats: !1,
1123
1138
  variant: "outlined",
1124
- visibleCardsCount: f
1139
+ visibleCardsCount: p
1125
1140
  }
1126
1141
  ) });
1127
- }, Io = R(vo), Lo = R(({ chartLabel: o, chartColor: s }) => {
1128
- const { onEvent: n } = F(), {
1142
+ }, Ao = R(Mo), Ro = R(({ chartLabel: o, chartColor: s }) => {
1143
+ const { onEvent: n } = $(), {
1129
1144
  categoryDetailsChartData: { monthlyAmounts: t, tooltipLabels: r }
1130
- } = fe();
1131
- return /* @__PURE__ */ e(S, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
1145
+ } = Ce();
1146
+ return /* @__PURE__ */ e(x, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
1132
1147
  Oe,
1133
1148
  {
1134
1149
  baseline: "min",
@@ -1142,7 +1157,7 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
1142
1157
  stroke: s
1143
1158
  }),
1144
1159
  onItemClick: () => {
1145
- n(w.TRENDS_CLICK_CHART, V);
1160
+ n(v.TRENDS_CLICK_CHART, G);
1146
1161
  },
1147
1162
  showArea: !0,
1148
1163
  showAverage: !0,
@@ -1157,100 +1172,100 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
1157
1172
  valueFormatterString: "0,0"
1158
1173
  }
1159
1174
  ) });
1160
- }), Eo = R(({ onClose: o }) => {
1161
- const s = it(), { is_mobile_webview: n } = qe(), { isDesktop: t, isSmallTablet: r, isTablet: a } = X(), { onEvent: d } = F(), { common: p, trends: i } = k(), { selectedCategoryData: u, selectedDateRangeMonthRange: f } = fe(), { sortedTransactions: l } = xe(), [y, h] = m.useState(null);
1162
- if (!u)
1175
+ }), ko = R(({ onClose: o }) => {
1176
+ const s = ct(), { is_mobile_webview: n } = Je(), { isDesktop: t, isSmallTablet: r, isTablet: i } = q(), { onEvent: d } = $(), { common: h, trends: c } = k(), { selectedCategoryData: l, selectedDateRangeMonthRange: p } = Ce(), { sortedTransactions: m } = ve(), [_, f] = u.useState(null);
1177
+ if (!l)
1163
1178
  return null;
1164
- const { guid: g, name: _, is_income: T, totalAmount: L } = u, I = T ? i.category_income : i.category_spending, E = qt(g, s), P = T ? i.income_label : i.spending_label, H = ` ${u.transactions.length === 1 ? i.transaction : i.transactions} (${u.transactions.length})`, D = m.useMemo(
1165
- () => l.find((N) => N.guid === y),
1166
- [y, l]
1167
- ), $ = l.length > 0 && !n && (t || a && !r), M = (N) => N.category_guid === g || N.top_level_category_guid === g, O = () => {
1168
- o?.(), d(w.TRENDS_CLICK_BACK, V);
1179
+ const { guid: g, name: y, is_income: w, totalAmount: b } = l, M = w ? c.category_income : c.category_spending, I = no(g, s), S = w ? c.income_label : c.spending_label, H = ` ${l.transactions.length === 1 ? c.transaction : c.transactions} (${l.transactions.length})`, N = u.useMemo(
1180
+ () => m.find((E) => E.guid === _),
1181
+ [_, m]
1182
+ ), z = m.length > 0 && !n && (t || i && !r), V = (E) => E.category_guid === g || E.top_level_category_guid === g, K = () => {
1183
+ o?.(), d(v.TRENDS_CLICK_BACK, G);
1169
1184
  };
1170
1185
  return /* @__PURE__ */ C(
1171
1186
  Ne,
1172
1187
  {
1173
- ariaLabelClose: i.close_category_details,
1188
+ ariaLabelClose: c.close_category_details,
1174
1189
  isOpen: !0,
1175
- onClose: O,
1190
+ onClose: K,
1176
1191
  shouldShowHeaderShadow: !0,
1177
- title: I,
1192
+ title: M,
1178
1193
  children: [
1179
- /* @__PURE__ */ C(S, { sx: { alignItems: "center", height: "100%" }, children: [
1180
- /* @__PURE__ */ C(Qt, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
1194
+ /* @__PURE__ */ C(x, { sx: { alignItems: "center", height: "100%" }, children: [
1195
+ /* @__PURE__ */ C(oo, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
1181
1196
  /* @__PURE__ */ e(
1182
- et,
1197
+ tt,
1183
1198
  {
1184
- leftIcon: /* @__PURE__ */ e(Se, { categoryGuid: g }),
1185
- rightContent: se(Math.abs(L), "0,0.00"),
1186
- subtitle: f,
1187
- title: _
1199
+ leftIcon: /* @__PURE__ */ e(we, { categoryGuid: g }),
1200
+ rightContent: oe(Math.abs(b), "0,0.00"),
1201
+ subtitle: p,
1202
+ title: y
1188
1203
  }
1189
1204
  ),
1190
- /* @__PURE__ */ e(Lo, { chartColor: E, chartLabel: P }),
1191
- /* @__PURE__ */ C(S, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
1192
- /* @__PURE__ */ e(z, { bold: !0, variant: "body1", children: H }),
1193
- $ && /* @__PURE__ */ e(Jt, { filter: M })
1205
+ /* @__PURE__ */ e(Ro, { chartColor: I, chartLabel: S }),
1206
+ /* @__PURE__ */ C(x, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
1207
+ /* @__PURE__ */ e(X, { bold: !0, variant: "body1", children: H }),
1208
+ z && /* @__PURE__ */ e(so, { filter: V })
1194
1209
  ] })
1195
1210
  ] }),
1196
1211
  /* @__PURE__ */ e(
1197
- at,
1212
+ it,
1198
1213
  {
1199
1214
  bgcolor: "transparent",
1200
- filter: M,
1215
+ filter: V,
1201
1216
  height: "calc(100vh - 475px)",
1202
- onClick: h
1217
+ onClick: f
1203
1218
  }
1204
1219
  )
1205
1220
  ] }),
1206
1221
  /* @__PURE__ */ e(
1207
1222
  Ne,
1208
1223
  {
1209
- ariaLabelClose: p.close_aria,
1210
- isOpen: !!D,
1211
- onClose: () => h(""),
1212
- title: i.transaction,
1213
- children: D && /* @__PURE__ */ e(rt, { transaction: D })
1224
+ ariaLabelClose: h.close_aria,
1225
+ isOpen: !!N,
1226
+ onClose: () => f(""),
1227
+ title: c.transaction,
1228
+ children: N && /* @__PURE__ */ e(at, { transaction: N })
1214
1229
  }
1215
1230
  )
1216
1231
  ]
1217
1232
  }
1218
1233
  );
1219
- }), Do = (o, s) => {
1220
- const n = ot(o, s), t = tt(o, s);
1234
+ }), Ho = (o, s) => {
1235
+ const n = nt(o, s), t = ot(o, s);
1221
1236
  return [n, t].filter((r) => r.length > 0);
1222
- }, Mo = (o, s) => {
1223
- const [n, t] = o, r = n, a = t ?? n, d = [];
1237
+ }, No = (o, s) => {
1238
+ const [n, t] = o, r = n, i = t ?? n, d = [];
1224
1239
  if (r) {
1225
- const p = r.reduce((i, u) => i + u.y, 0);
1226
- d.push({ label: s.income_label, amount: p });
1240
+ const h = r.reduce((c, l) => c + l.y, 0);
1241
+ d.push({ label: s.income_label, amount: h });
1227
1242
  }
1228
- if (a) {
1229
- const p = a.reduce((i, u) => i + u.y, 0);
1230
- d.push({ label: s.spending_label, amount: p });
1243
+ if (i) {
1244
+ const h = i.reduce((c, l) => c + l.y, 0);
1245
+ d.push({ label: s.spending_label, amount: h });
1231
1246
  }
1232
1247
  return d;
1233
- }, Ao = ({
1248
+ }, Wo = ({
1234
1249
  availableHeight: o = 0,
1235
1250
  minHeight: s = 500,
1236
1251
  selectedDateRange: n,
1237
1252
  totals: t
1238
1253
  }) => {
1239
- const r = ce(), { onEvent: a } = F(), { trends: d } = k(), { isSmallMobile: p, isMobile: i, isSmallTablet: u, isTablet: f } = X(), l = [r.palette.chart?.chart1, r.palette.chart?.chart2], y = Do(t, n), h = Mo(y, d), [g, _] = m.useState(0), T = 458, L = 195, I = 56, E = i || p ? L : u || f ? T : g;
1240
- return m.useEffect(() => {
1241
- const H = Math.max(o - I, s);
1242
- _(H);
1254
+ const r = le(), { onEvent: i } = $(), { trends: d } = k(), { isSmallMobile: h, isMobile: c, isSmallTablet: l, isTablet: p } = q(), m = [r.palette.chart?.chart1, r.palette.chart?.chart2], _ = Ho(t, n), f = No(_, d), [g, y] = u.useState(0), w = 458, b = 195, M = 56, I = c || h ? b : l || p ? w : g;
1255
+ return u.useEffect(() => {
1256
+ const H = Math.max(o - M, s);
1257
+ y(H);
1243
1258
  }, [o]), /* @__PURE__ */ e(
1244
1259
  Oe,
1245
1260
  {
1246
1261
  baseline: "min",
1247
- colors: l,
1262
+ colors: m,
1248
1263
  curveType: "bump",
1249
- datasets: y,
1250
- height: E,
1251
- labels: h,
1264
+ datasets: _,
1265
+ height: I,
1266
+ labels: f,
1252
1267
  onItemClick: () => {
1253
- a(w.TRENDS_CLICK_CHART, V);
1268
+ i(v.TRENDS_CLICK_CHART, G);
1254
1269
  },
1255
1270
  showArea: !0,
1256
1271
  showAxisHighlight: !0,
@@ -1263,7 +1278,7 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
1263
1278
  valueFormatterString: "0.0a"
1264
1279
  }
1265
1280
  );
1266
- }, Ro = R(Ao), ko = [
1281
+ }, Oo = R(Wo), Go = [
1267
1282
  "BillAmountNotStandard",
1268
1283
  "CategorySpendingV2",
1269
1284
  "CostOfLivingToIncome",
@@ -1297,195 +1312,189 @@ const ct = ({ categoryGuid: o, topLevelCategoryGuid: s }) => {
1297
1312
  "WeeklyNewMerchantsV2",
1298
1313
  "WeeklyNoSpendDays",
1299
1314
  "WeeklySmallPurchasesSummary"
1300
- ], Ho = ({ onBackClick: o, onInsightCardClick: s, sx: n }) => {
1301
- const { onEvent: t } = F(), { config: r } = qe(), { isDesktop: a, isLargeDesktop: d, isMobile: p } = X(), { visibleAccounts: i } = we(), { loadDateRangeCategoryTotals: u, loadMonthlyCategoryTotals: f, monthlyCategoryTotals: l } = Z(), { setFilter: y } = xe(), { selectedDateRange: h, setSelectedCategoryData: g, setSelectedDateRange: _ } = fe(), {
1302
- isCopyLoaded: T,
1303
- isInitialized: L,
1304
- selectedAccounts: I,
1305
- selectedAccountGuids: E,
1306
- setSelectedAccounts: P
1307
- } = pe(), { trends: H, connect: D } = k(), { beatStore: $ } = We(), O = eo() && r.show_insights_widget_in_master, N = a || d, [Q, Ce] = m.useState(!1), [oe, re] = m.useState(!1), [q, le] = m.useState("Chart"), [ne, K] = m.useState(""), [ae, J] = m.useState(!1), [ie, ee] = m.useState(window.innerHeight), x = N ? 56 : 0, G = ie - 208, Y = ie - (O ? 550 + x : 266), [de, ye] = m.useState(!1), Ie = r.show_connections_widget_in_master ? "buttons" : "no-buttons", c = m.useMemo(
1308
- () => i && i.length === 0 || l.length === 0,
1309
- [i, l]
1310
- );
1311
- ve({
1315
+ ], Bo = ({ onBackClick: o, onInsightCardClick: s, sx: n }) => {
1316
+ const { onEvent: t } = $(), { config: r } = Je(), { isDesktop: i, isLargeDesktop: d, isMobile: h } = q(), { isAccountDataLoaded: c, loadAccountData: l, visibleAccounts: p } = De(), {
1317
+ categoriesLoaded: m,
1318
+ loadCategories: _,
1319
+ loadDateRangeCategoryTotals: f,
1320
+ loadMonthlyCategoryTotals: g,
1321
+ monthlyCategoryTotals: y,
1322
+ monthlyTotalsLoaded: w
1323
+ } = J(), { isTransactionDataLoaded: b, loadTransactionData: M, setFilter: I } = ve(), { selectedDateRange: S, setSelectedCategoryData: H, setSelectedDateRange: N } = Ce(), { isInitialized: z, selectedAccounts: V, selectedAccountGuids: K } = ye(), { trends: E, connect: te } = k(), { beatStore: O } = We(), se = ro() && r.show_insights_widget_in_master, Z = i || d, [de, ue] = u.useState(!1), [F, re] = u.useState(!1), [Y, he] = u.useState("Chart"), [j, ae] = u.useState(""), [ge, ie] = u.useState(!1), [ce, D] = u.useState(window.innerHeight), P = Z ? 56 : 0, a = ce - 208, T = ce - (se ? 550 + P : 266), [L, U] = u.useState(!1), Ee = r.show_connections_widget_in_master ? "buttons" : "no-buttons";
1324
+ Le({
1312
1325
  widgetName: "TrendsWidget",
1313
- isLoaded: Q
1314
- }), m.useEffect(() => {
1315
- L && $.loadBeats().finally(() => re(!0));
1316
- }, [L]);
1317
- const b = m.useMemo(() => oe ? $.getFilteredBeats({ templates: ko }) : [], [oe]);
1318
- m.useEffect(() => {
1319
- const W = () => ee(window.innerHeight);
1320
- return window.addEventListener("resize", W), () => window.removeEventListener("resize", W);
1321
- }, []), m.useEffect(() => {
1322
- P(i);
1323
- }, [i]), m.useEffect(() => {
1324
- L && Promise.all([
1325
- u(
1326
- I,
1327
- h.start,
1328
- h.end
1329
- ),
1330
- f(I, h.start, h.end)
1331
- ]).finally(() => {
1332
- Ce(!0), t(w.TRENDS_LOAD_WIDGET, {
1333
- ...V,
1334
- time_period: `${ke(h.end, h.start)}M`
1326
+ isLoaded: de
1327
+ });
1328
+ const _e = u.useMemo(() => F ? O.getFilteredBeats({ templates: Go }) : [], [F]);
1329
+ u.useEffect(() => {
1330
+ const W = () => D(window.innerHeight);
1331
+ return window.addEventListener("resize", W), c || l().finally(), m || _().finally(), b || M().finally(), () => window.removeEventListener("resize", W);
1332
+ }, []), u.useEffect(() => {
1333
+ z && (O.loadBeats().finally(() => re(!0)), f(V, S.start, S.end).then(() => {
1334
+ g(
1335
+ V,
1336
+ S.start,
1337
+ S.end
1338
+ );
1339
+ }).finally(() => {
1340
+ ue(!0), t(v.TRENDS_LOAD_WIDGET, {
1341
+ ...G,
1342
+ time_period: `${Se(S.end, S.start)}M`
1335
1343
  });
1336
- });
1337
- }, [L, I, h]), m.useEffect(() => {
1338
- if (l.length !== 0) {
1344
+ }));
1345
+ }, [z, V, S]), u.useEffect(() => {
1346
+ if (y.length !== 0) {
1339
1347
  const W = {
1340
- accounts: E,
1341
- dateRange: { start: h.start, end: h.end }
1348
+ accounts: K,
1349
+ dateRange: { start: S.start, end: S.end }
1342
1350
  };
1343
- y({
1351
+ I({
1344
1352
  ...W,
1345
- custom: (te) => !!l.find(
1346
- (he) => he.top_level_category_guid === te.top_level_category_guid || he.category_guid === te.category_guid
1353
+ custom: (ee) => !!y.find(
1354
+ (pe) => pe.top_level_category_guid === ee.top_level_category_guid || pe.category_guid === ee.category_guid
1347
1355
  )
1348
1356
  });
1349
1357
  }
1350
- }, [l]);
1351
- const v = (W) => {
1352
- g(W), J(!0);
1353
- }, j = () => {
1354
- g(null), J(!1);
1355
- }, Le = () => {
1356
- ye(!0), t(w.TRENDS_CLICK_CONNECT_ACCOUNTS);
1357
- }, Ee = (W, te) => {
1358
- le(te ?? q), t(w.TRENDS_CLICK_TOGGLE_VIEW, {
1359
- ...V,
1360
- toggleView: te
1358
+ }, [y]);
1359
+ const me = (W) => {
1360
+ H(W), ie(!0);
1361
+ }, Me = () => {
1362
+ H(null), ie(!1);
1363
+ }, Ae = () => {
1364
+ U(!0), t(v.TRENDS_CLICK_CONNECT_ACCOUNTS);
1365
+ }, gt = (W, ee) => {
1366
+ he(ee ?? Y), t(v.TRENDS_CLICK_TOGGLE_VIEW, {
1367
+ ...G,
1368
+ toggleView: ee
1361
1369
  });
1362
- }, ue = (W) => {
1363
- const te = Ue(W?.[0], 1), he = W?.[1], gt = ke(he, te);
1364
- _({ start: te, end: he }), t(w.TRENDS_CLICK_TIME_WINDOW, {
1365
- ...V,
1366
- time_period: gt + "M"
1370
+ }, mt = (W) => {
1371
+ const ee = Xe(W?.[0], 1), pe = W?.[1], Ct = Se(pe, ee);
1372
+ N({ start: ee, end: pe }), t(v.TRENDS_CLICK_TIME_WINDOW, {
1373
+ ...G,
1374
+ time_period: Ct + "M"
1367
1375
  });
1368
- }, De = (W) => {
1369
- t(w.TRENDS_CLICK_FILTER, {
1370
- ...V,
1376
+ }, pt = (W) => {
1377
+ t(v.TRENDS_CLICK_FILTER, {
1378
+ ...G,
1371
1379
  filterValue: W
1372
1380
  });
1373
- }, Me = (W) => {
1374
- K(W);
1375
- }, ht = () => {
1376
- K(""), t(w.TRENDS_CLICK_ALL_CATEGORIES, V);
1381
+ }, ft = (W) => {
1382
+ ae(W);
1383
+ }, yt = () => {
1384
+ ae(""), t(v.TRENDS_CLICK_ALL_CATEGORIES, G);
1377
1385
  };
1378
- return !T || !Q ? /* @__PURE__ */ e(me, {}) : /* @__PURE__ */ C(
1379
- st,
1386
+ if (!z || !de || !w) return /* @__PURE__ */ e(Ie, {});
1387
+ const Ge = p && p.length === 0 || y.length === 0;
1388
+ return /* @__PURE__ */ C(
1389
+ rt,
1380
1390
  {
1381
- accountOptions: i,
1382
- calendarActions: { onRangeChanged: ue },
1383
- dateRange: h,
1384
- dateRangeVariant: p ? "timeframetabs" : "timeframebuttons",
1385
- onAccountsFilterClick: De,
1391
+ calendarActions: { onRangeChanged: mt },
1392
+ dateRange: S,
1393
+ dateRangeVariant: h ? "timeframetabs" : "timeframebuttons",
1394
+ onAccountsFilterClick: pt,
1386
1395
  onBackClick: o,
1387
1396
  sx: n,
1388
- title: H.title,
1397
+ title: E.title,
1389
1398
  children: [
1390
- c && /* @__PURE__ */ e(
1391
- to,
1399
+ Ge && /* @__PURE__ */ e(
1400
+ ao,
1392
1401
  {
1393
- header: H.zero_state_content_header,
1402
+ header: E.zero_state_content_header,
1394
1403
  icon: "",
1395
- onClick: Le,
1396
- primaryButton: H.empty_state_primary,
1397
- subText: H.empty_state_sub_text,
1398
- sx: { height: G },
1399
- variant: Ie
1404
+ onClick: Ae,
1405
+ primaryButton: E.empty_state_primary,
1406
+ subText: E.empty_state_sub_text,
1407
+ sx: { height: a },
1408
+ variant: Ee
1400
1409
  }
1401
1410
  ),
1402
- !c && /* @__PURE__ */ C(
1403
- S,
1411
+ !Ge && /* @__PURE__ */ C(
1412
+ x,
1404
1413
  {
1405
1414
  sx: {
1406
- px: p ? 0 : 48
1415
+ px: h ? 0 : 48
1407
1416
  },
1408
1417
  children: [
1409
1418
  /* @__PURE__ */ C(
1410
- S,
1419
+ x,
1411
1420
  {
1412
1421
  flexDirection: "row",
1413
1422
  justifyContent: "space-between",
1414
- sx: { gap: 8, px: p ? 24 : 0, py: 16 },
1423
+ sx: { gap: 8, px: h ? 24 : 0, py: 16 },
1415
1424
  children: [
1416
1425
  /* @__PURE__ */ e(
1417
- dt,
1426
+ ut,
1418
1427
  {
1419
- selectedCategoryGuid: ne,
1420
- selectedDateRange: h
1428
+ selectedCategoryGuid: j,
1429
+ selectedDateRange: S
1421
1430
  }
1422
1431
  ),
1423
- /* @__PURE__ */ e(lt, { onTabChange: Ee, selectedTab: q })
1432
+ /* @__PURE__ */ e(dt, { onTabChange: gt, selectedTab: Y })
1424
1433
  ]
1425
1434
  }
1426
1435
  ),
1427
- /* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", sx: { pb: 8 }, width: "100%", children: /* @__PURE__ */ e(A, { flexGrow: 1, children: ne && /* @__PURE__ */ C(be, { onClick: ht, sx: { p: 0, pr: 5 }, children: [
1428
- /* @__PURE__ */ e(_e, { name: "arrow_back" }),
1429
- H.all_categories
1436
+ /* @__PURE__ */ e(x, { alignItems: "center", flexDirection: "row", sx: { pb: 8 }, width: "100%", children: /* @__PURE__ */ e(A, { flexGrow: 1, children: j && /* @__PURE__ */ C(be, { onClick: yt, sx: { p: 0, pr: 5 }, children: [
1437
+ /* @__PURE__ */ e(Te, { name: "arrow_back" }),
1438
+ E.all_categories
1430
1439
  ] }) }) }),
1431
- /* @__PURE__ */ C(S, { flexDirection: N ? "row" : "column", gap: N ? 48 : 16, children: [
1432
- q === "Chart" && /* @__PURE__ */ C(mt, { children: [
1433
- /* @__PURE__ */ e(A, { sx: { width: N ? "68%" : "100%" }, children: /* @__PURE__ */ e(
1434
- Ro,
1440
+ /* @__PURE__ */ C(x, { flexDirection: Z ? "row" : "column", gap: Z ? 48 : 16, children: [
1441
+ Y === "Chart" && /* @__PURE__ */ C(_t, { children: [
1442
+ /* @__PURE__ */ e(A, { sx: { width: Z ? "68%" : "100%" }, children: /* @__PURE__ */ e(
1443
+ Oo,
1435
1444
  {
1436
- availableHeight: G,
1445
+ availableHeight: a,
1437
1446
  minHeight: 450,
1438
- selectedDateRange: h,
1439
- totals: l
1447
+ selectedDateRange: S,
1448
+ totals: y
1440
1449
  }
1441
1450
  ) }),
1442
- /* @__PURE__ */ C(S, { gap: 16, sx: { width: N ? "32%" : "100%" }, children: [
1443
- O && oe && b.length > 0 && /* @__PURE__ */ e(
1444
- Io,
1451
+ /* @__PURE__ */ C(x, { gap: 16, sx: { width: Z ? "32%" : "100%" }, children: [
1452
+ se && F && _e.length > 0 && /* @__PURE__ */ e(
1453
+ Ao,
1445
1454
  {
1446
- beats: b,
1455
+ beats: _e,
1447
1456
  onInsightCardClick: s
1448
1457
  }
1449
1458
  ),
1450
1459
  /* @__PURE__ */ e(
1451
- wo,
1460
+ Eo,
1452
1461
  {
1453
- availableHeight: Y,
1454
- onCategoryClick: v
1462
+ availableHeight: T,
1463
+ onCategoryClick: me
1455
1464
  }
1456
1465
  )
1457
1466
  ] })
1458
1467
  ] }),
1459
- q === "Table" && /* @__PURE__ */ e(A, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1460
- ut,
1468
+ Y === "Table" && /* @__PURE__ */ e(A, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1469
+ ht,
1461
1470
  {
1462
1471
  height: "unset",
1463
- onClickRow: Me,
1464
- selectedCategory: ne,
1465
- selectedDateRange: h
1472
+ onClickRow: ft,
1473
+ selectedCategory: j,
1474
+ selectedDateRange: S
1466
1475
  }
1467
1476
  ) })
1468
1477
  ] }),
1469
- ae && /* @__PURE__ */ e(Eo, { onClose: j })
1478
+ ge && /* @__PURE__ */ e(ko, { onClose: Me })
1470
1479
  ]
1471
1480
  }
1472
1481
  ),
1473
1482
  /* @__PURE__ */ e(
1474
- oo,
1483
+ io,
1475
1484
  {
1476
- onClose: () => ye(!1),
1477
- showConnectWidget: de,
1478
- title: D.mini_title
1485
+ onClose: () => U(!1),
1486
+ showConnectWidget: L,
1487
+ title: te.mini_title
1479
1488
  }
1480
1489
  )
1481
1490
  ]
1482
1491
  }
1483
1492
  );
1484
- }, Fn = R(Ho);
1493
+ }, jn = R(Bo);
1485
1494
  export {
1486
- Bn as TrendsFullWidget,
1487
- Pn as TrendsMicroWidget,
1488
- Vn as TrendsMiniWidget,
1489
- Kn as TrendsStore,
1490
- Fn as TrendsWidget
1495
+ zn as TrendsFullWidget,
1496
+ Yn as TrendsMicroWidget,
1497
+ Kn as TrendsMiniWidget,
1498
+ Zn as TrendsStore,
1499
+ jn as TrendsWidget
1491
1500
  };