@mx-cartographer/experiences 8.0.0-alpha.bb3 → 8.0.0-alpha.bb4

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 (219) hide show
  1. package/CHANGELOG.md +128 -1
  2. package/dist/{Account-Bxw0_4FU.mjs → Account-B4CDD-zq.mjs} +1 -1
  3. package/dist/AccountDetailsContent-adZTkM52.mjs +683 -0
  4. package/dist/AccountDetailsHeader-DRjFuyJT.mjs +87 -0
  5. package/dist/{AccountFields-C9FlatNb.mjs → AccountFields-Cl4KHoSj.mjs} +14 -12
  6. package/dist/AccountListItem-wgmlex-_.mjs +90 -0
  7. package/dist/{AccountStore-BgNOyMdp.mjs → AccountStore-HbVblv86.mjs} +19 -8
  8. package/dist/{Accounts-BRf_YeTf.mjs → Accounts-CRUehOiy.mjs} +1 -1
  9. package/dist/{BeatApi-DhJpgCLz.mjs → BeatApi-De2IaqH2.mjs} +1 -1
  10. package/dist/{BeatStore-IBnXd4YK.mjs → BeatStore-D_NYuBSz.mjs} +1 -1
  11. package/dist/{BudgetUtil-B2ZXyw-g.mjs → BudgetUtil-Jv8h9H9l.mjs} +33 -33
  12. package/dist/{CashflowStore-D9Dpuz7X.mjs → CashflowStore-CA190BPF.mjs} +18 -25
  13. package/dist/{Category-CevNQ03n.mjs → Category-Ccoew_sA.mjs} +2 -2
  14. package/dist/{CategorySelectorDrawer-DUe4lH5-.mjs → CategorySelectorDrawer-Dl006GKy.mjs} +43 -41
  15. package/dist/{CategoryStore-yHI0hWmK.mjs → CategoryStore-MUwRWH9e.mjs} +13 -11
  16. package/dist/{CategoryUtil-pZRIYOgN.mjs → CategoryUtil-DfVKKkRf.mjs} +4 -4
  17. package/dist/{ConnectDrawer-BQNs-hjk.mjs → ConnectDrawer-DVp54lUH.mjs} +49 -48
  18. package/dist/{ConnectionsDrawer-ByGQE7D5.mjs → ConnectionsDrawer-Dsc04-4Z.mjs} +3 -3
  19. package/dist/CurrencyInput-D1cjbdCI.mjs +85 -0
  20. package/dist/{CurrencyText-kyC1aseI.mjs → CurrencyText-Dr0EZ7bp.mjs} +1 -1
  21. package/dist/{DateUtil-BcuH7ErC.mjs → DateUtil-CDPZw_-m.mjs} +3 -3
  22. package/dist/{DebtsStore-C9bblOgW.mjs → DebtsStore-pL63fmdT.mjs} +3 -3
  23. package/dist/{Dialog-CWW597AF.mjs → Dialog-CDV0kKxj.mjs} +24 -24
  24. package/dist/{Donut-oaQFlbit.mjs → Donut-Dmy3JTWd.mjs} +12 -12
  25. package/dist/Drawer-BF40nbsH.mjs +163 -0
  26. package/dist/{EmptyState-DA_lfRBv.mjs → EmptyState-DoxNUae-.mjs} +24 -22
  27. package/dist/{ExportCsvAction-sX8Rg4Ov.mjs → ExportCsvAction-QhQK4_FU.mjs} +4 -4
  28. package/dist/{Fetch-87LIQbEA.mjs → Fetch-DecPFeGU.mjs} +24 -22
  29. package/dist/FinstrongStore-BGf36b0z.mjs +451 -0
  30. package/dist/{GoalStore-D-aB35SY.mjs → GoalStore-C1-w3Y1E.mjs} +7 -7
  31. package/dist/HeaderCell-P8w6CmfO.mjs +6 -0
  32. package/dist/{Help-B6dIcujh.mjs → Help-DBfsTkAi.mjs} +125 -146
  33. package/dist/{Help-DhcC-C05.mjs → Help-c-zHlDbv.mjs} +8 -8
  34. package/dist/{IconBacking-B9oC6uL2.mjs → IconBacking-DgT8DCeh.mjs} +11 -11
  35. package/dist/LineChart-C1PxNf7P.mjs +581 -0
  36. package/dist/{ListItemAction-DHa3KJPs.mjs → ListItemAction-BNCWQAN_.mjs} +10 -10
  37. package/dist/Loader-Ckqi9Rx6.mjs +21 -0
  38. package/dist/{ManageIncome-1s_q5W4X.mjs → ManageIncome-8EsStyIQ.mjs} +195 -192
  39. package/dist/{MerchantStore-DrFvsUyy.mjs → MerchantStore-WvZ4gnQe.mjs} +1 -1
  40. package/dist/MicroWidgetContainer-BGpNl5ZS.mjs +45 -0
  41. package/dist/MiniWidgetContainer-CKzf_Ira.mjs +56 -0
  42. package/dist/{NetWorthStore-DCsTZpuS.mjs → NetWorthStore-Bti6u-d9.mjs} +4 -4
  43. package/dist/{NotificationSettings-DqrkNMod.mjs → NotificationSettings-B74rQVYC.mjs} +276 -273
  44. package/dist/{NotificationStore-BxP_P2dA.mjs → NotificationStore-Ck2KdNmT.mjs} +10 -10
  45. package/dist/{NumberFormatting-Buh7u8Oi.mjs → NumberFormatting-DjTD0t3W.mjs} +9 -9
  46. package/dist/{OriginalBalanceAction-CWuVvRq9.mjs → OriginalBalanceAction-2Y_3U_mg.mjs} +10 -10
  47. package/dist/{RecurringSettings-A_rAGCTP.mjs → RecurringSettings-DAncu--R.mjs} +17 -17
  48. package/dist/{RecurringTransactions-DK8dWldr.mjs → RecurringTransactions-CxcSL1dY.mjs} +106 -105
  49. package/dist/{RecurringTransactionsStore-C4YOD7_D.mjs → RecurringTransactionsStore-CNFxyGB6.mjs} +80 -73
  50. package/dist/{ResponsiveButton-DZFp78fJ.mjs → ResponsiveButton-Cn6-R7ue.mjs} +10 -10
  51. package/dist/SearchBox-B7km148n.mjs +39 -0
  52. package/dist/{SettingsStore-BcgS_Ohv.mjs → SettingsStore-BASMQSIp.mjs} +3 -3
  53. package/dist/{SingleSegmentDonut-BgbLgwHi.mjs → SingleSegmentDonut-7Uy6VEld.mjs} +6 -6
  54. package/dist/SkeletonLoader-BaNboJjD.mjs +38 -0
  55. package/dist/{SpendingData-D5vsfYKo.mjs → SpendingData-DPQ96k3x.mjs} +19 -19
  56. package/dist/SpendingLegend-6FqtMcBV.mjs +193 -0
  57. package/dist/{StatusBar-BK_uYHAB.mjs → StatusBar-CPfSXe80.mjs} +6 -6
  58. package/dist/{TabContentContainer-j01JYR_7.mjs → TabContentContainer-CnMXkVqr.mjs} +8 -8
  59. package/dist/{ToggleListItem-r0Kx56wF.mjs → ToggleListItem-ciFTiqRS.mjs} +19 -14
  60. package/dist/TransactionApi-CjBoLleL.mjs +86 -0
  61. package/dist/TransactionDetails-Bn0qY5Hw.mjs +1336 -0
  62. package/dist/{TransactionStore-ai3uII_r.mjs → TransactionStore-DbwAutwC.mjs} +146 -165
  63. package/dist/TrendsStore-_mRaFUdf.mjs +182 -0
  64. package/dist/{User-BQUxBeZV.mjs → User-BklmOUSd.mjs} +107 -107
  65. package/dist/{ViewMoreMicroCard-SCn2wt4i.mjs → ViewMoreMicroCard-DAkyNRlD.mjs} +706 -729
  66. package/dist/{WidgetContainer-BHWANqT4.mjs → WidgetContainer-CDh9fjpR.mjs} +36 -36
  67. package/dist/accounts/components/AccountsListCompact.d.ts +10 -0
  68. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +4 -1
  69. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.d.ts +2 -1
  70. package/dist/accounts/index.es.js +228 -221
  71. package/dist/accounts/stores/AccountStore.d.ts +2 -0
  72. package/dist/analytics/index.es.js +27 -27
  73. package/dist/budgets/index.es.js +459 -462
  74. package/dist/cashflow/index.es.js +419 -428
  75. package/dist/categories/index.es.js +2 -2
  76. package/dist/categories/stores/CategoryStore.d.ts +1 -1
  77. package/dist/common/components/ErrorBoundary.d.ts +1 -1
  78. package/dist/common/components/Loader.d.ts +1 -2
  79. package/dist/common/components/Select.d.ts +4 -2
  80. package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +1 -1
  81. package/dist/common/components/charts/LineChart.d.ts +12 -2
  82. package/dist/common/components/charts/index.d.ts +0 -3
  83. package/dist/common/components/charts/linechart/CustomLegend.d.ts +3 -1
  84. package/dist/common/components/charts/linechart/CustomMark.d.ts +5 -1
  85. package/dist/common/components/drawer/Drawer.d.ts +3 -0
  86. package/dist/common/components/drawer/Footer.d.ts +17 -0
  87. package/dist/common/components/index.d.ts +0 -1
  88. package/dist/common/hooks/index.d.ts +0 -1
  89. package/dist/common/hooks/useAriaLive.d.ts +1 -1
  90. package/dist/common/index.es.js +402 -668
  91. package/dist/common/stores/GlobalStore.d.ts +7 -1
  92. package/dist/common/types/Finstrong.d.ts +54 -0
  93. package/dist/common/types/Global.d.ts +1 -0
  94. package/dist/common/types/Widgets.d.ts +1 -0
  95. package/dist/common/types/index.d.ts +1 -1
  96. package/dist/common/types/localization/FinstrongCopy.d.ts +105 -2
  97. package/dist/common/types/localization/GoalsCopy.d.ts +1 -0
  98. package/dist/common/utils/Theme.d.ts +1 -3
  99. package/dist/dashboard/index.es.js +21 -21
  100. package/dist/debts/components/DebtsChart.d.ts +1 -2
  101. package/dist/debts/index.es.js +673 -665
  102. package/dist/exportTransactionsToCSV-BgV_wTLT.mjs +48 -0
  103. package/dist/finstrong/FinstrongWidget.d.ts +1 -1
  104. package/dist/finstrong/api/FinstrongApi.d.ts +5 -0
  105. package/dist/finstrong/components/ConnectMoreAccountsCard.d.ts +3 -1
  106. package/dist/finstrong/components/CreditScore/CreditScoreContent.d.ts +4 -0
  107. package/dist/finstrong/components/CreditScore/CreditScoreHeader.d.ts +4 -0
  108. package/dist/finstrong/components/FinancialStrengthGraph.d.ts +7 -1
  109. package/dist/finstrong/components/HaveManageableDebt/DebtPaymentTabContent.d.ts +3 -0
  110. package/dist/finstrong/components/HaveManageableDebt/HaveManageableDebtComponent.d.ts +3 -0
  111. package/dist/finstrong/components/HaveManageableDebt/HaveManageableDebtProgressBar.d.ts +4 -0
  112. package/dist/finstrong/components/HaveManageableDebt/IncomeTabContent.d.ts +3 -0
  113. package/dist/finstrong/components/KeyIndicatorsBorrowTab.d.ts +2 -2
  114. package/dist/finstrong/components/KeyIndicatorsDrawer.d.ts +4 -1
  115. package/dist/finstrong/components/KeyIndicatorsSaveTab.d.ts +2 -2
  116. package/dist/finstrong/components/KeyIndicatorsSpendTab.d.ts +2 -2
  117. package/dist/finstrong/components/KeyIndicatorsTabItem.d.ts +4 -3
  118. package/dist/finstrong/components/KeyIndicatorsTabItemDrawer.d.ts +10 -0
  119. package/dist/finstrong/components/KeyIndicatorsTabsWidget.d.ts +2 -2
  120. package/dist/finstrong/components/MaintainingEmergencySavings/EstimatedContributionCalculator.d.ts +6 -0
  121. package/dist/finstrong/components/MaintainingEmergencySavings/MaintainingEmergencySavingsContent.d.ts +4 -0
  122. package/dist/finstrong/components/MaintainingEmergencySavings/MaintainingEmergencySavingsSticky.d.ts +4 -0
  123. package/dist/finstrong/components/ProgressBar.d.ts +15 -0
  124. package/dist/finstrong/components/SaveEnoughToLiveOn/AvailableTabContent.d.ts +3 -0
  125. package/dist/finstrong/components/SaveEnoughToLiveOn/SaveEnoughToLiveOnDrawerContent.d.ts +3 -0
  126. package/dist/finstrong/components/SaveEnoughToLiveOn/SaveEnoughToLiveOnProgressBar.d.ts +4 -0
  127. package/dist/finstrong/components/SaveEnoughToLiveOn/SpendingTabContent.d.ts +3 -0
  128. package/dist/finstrong/components/SpendLessThanYouMake/SpendLessThanYouMakeComponent.d.ts +3 -0
  129. package/dist/finstrong/components/SpendLessThanYouMake/SpendLessThanYouMakeProgressBar.d.ts +4 -0
  130. package/dist/finstrong/components/StatusChip.d.ts +5 -0
  131. package/dist/finstrong/components/onboarding/Onboarding.d.ts +2 -0
  132. package/dist/finstrong/components/onboarding/OnboardingAddMonthlyIncome.d.ts +17 -0
  133. package/dist/finstrong/components/onboarding/OnboardingBirthday.d.ts +8 -0
  134. package/dist/finstrong/components/onboarding/OnboardingCreditScore.d.ts +8 -0
  135. package/dist/finstrong/components/onboarding/OnboardingStepsDrawer.d.ts +14 -0
  136. package/dist/finstrong/components/onboarding/OnboardingStepsHeader.d.ts +8 -0
  137. package/dist/finstrong/components/paybillsontime/PayBillsOnTimeDrawerComponent.d.ts +4 -0
  138. package/dist/finstrong/components/paybillsontime/PayBillsOnTimeStickyComponent.d.ts +4 -0
  139. package/dist/finstrong/components/shared/Accounts.d.ts +8 -0
  140. package/dist/finstrong/components/shared/CustomDoubleBarPlot.d.ts +25 -0
  141. package/dist/finstrong/components/shared/DialScoreCard.d.ts +7 -1
  142. package/dist/finstrong/components/shared/DoubleBarChart.d.ts +28 -0
  143. package/dist/finstrong/components/shared/LineGraph.d.ts +7 -0
  144. package/dist/finstrong/components/shared/TotalCard.d.ts +8 -0
  145. package/dist/finstrong/components/shared/Transactions.d.ts +11 -0
  146. package/dist/finstrong/constants/index.d.ts +9 -0
  147. package/dist/finstrong/index.es.js +3175 -1067
  148. package/dist/finstrong/stores/FinstrongStore.d.ts +25 -2
  149. package/dist/finstrong/util/finstrongUtils.d.ts +58 -1
  150. package/dist/goals/index.es.js +580 -570
  151. package/dist/help/components/content/BottomImageContent.d.ts +1 -1
  152. package/dist/help/components/content/LeftImageContent.d.ts +1 -1
  153. package/dist/help/components/content/RightImageContent.d.ts +1 -1
  154. package/dist/help/components/content/TopImageContent.d.ts +1 -1
  155. package/dist/help/index.es.js +6 -6
  156. package/dist/{hooks-D6XlXHf4.mjs → hooks-C41HAxM5.mjs} +3 -3
  157. package/dist/insights/index.es.js +1 -1
  158. package/dist/investments/index.es.js +537 -536
  159. package/dist/merchants/index.es.js +9 -9
  160. package/dist/microinsights/beaticons/BeatIcon.d.ts +2 -9
  161. package/dist/microinsights/beaticons/BeatMerchantLogo.d.ts +3 -2
  162. package/dist/microinsights/beaticons/MonthlySpendComparisonIcon.d.ts +2 -1
  163. package/dist/microinsights/cards/{MicroInsightCard.d.ts → BaseCard.d.ts} +1 -8
  164. package/dist/microinsights/cards/{BeatCard.d.ts → InsightCard.d.ts} +2 -2
  165. package/dist/microinsights/cards/NoRelevantInsightsCard.d.ts +2 -5
  166. package/dist/microinsights/cards/ZeroStateCard.d.ts +2 -5
  167. package/dist/microinsights/carousel/BeatList.d.ts +10 -0
  168. package/dist/microinsights/carousel/CarouselControls.d.ts +1 -3
  169. package/dist/microinsights/carousel/CarouselHeader.d.ts +1 -2
  170. package/dist/microinsights/constants/App.d.ts +0 -1
  171. package/dist/microinsights/index.d.ts +3 -3
  172. package/dist/microinsights/index.es.js +7 -7
  173. package/dist/microinsights/interfaces.d.ts +0 -6
  174. package/dist/networth/components/NetWorthChange.d.ts +3 -1
  175. package/dist/networth/index.es.js +262 -254
  176. package/dist/notifications/index.es.js +90 -91
  177. package/dist/recurringtransactions/components/MicroWidgetContent.d.ts +3 -0
  178. package/dist/recurringtransactions/index.es.js +586 -562
  179. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +1 -0
  180. package/dist/settings/index.es.js +371 -365
  181. package/dist/spending/index.es.js +267 -419
  182. package/dist/spending/utils/SpendingData.d.ts +2 -1
  183. package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -0
  184. package/dist/transactions/components/shared/TransactionList.d.ts +1 -0
  185. package/dist/transactions/index.es.js +231 -226
  186. package/dist/transactions/stores/TransactionStore.d.ts +1 -1
  187. package/dist/transactions/stores/UiStore.d.ts +0 -2
  188. package/dist/trends/index.es.js +988 -612
  189. package/dist/{useAccountDisplayName-BUAApBIb.mjs → useAccountDisplayName-CcIp09Xc.mjs} +2 -2
  190. package/dist/{useCombineEvents-BUDIR1ba.mjs → useCombineEvents-kNzLTWCp.mjs} +3 -3
  191. package/dist/{useInsightsEnabled-DBpwEq10.mjs → useInsightsEnabled-CNjP5cfR.mjs} +1 -1
  192. package/dist/{useScreenSize-B6JyS_Lj.mjs → useScreenSize-B5afALev.mjs} +1 -1
  193. package/package.json +51 -56
  194. package/dist/AccountDetailsContent-CAM9y39M.mjs +0 -679
  195. package/dist/AccountDetailsHeader-JtSX6Uf9.mjs +0 -120
  196. package/dist/AccountListItem-JFMZROh7.mjs +0 -90
  197. package/dist/CurrencyInput-DUsQbkXb.mjs +0 -85
  198. package/dist/Drawer-kEE73B87.mjs +0 -113
  199. package/dist/FinstrongStore-F2c607dj.mjs +0 -101
  200. package/dist/HeaderCell-DjuifqHJ.mjs +0 -6
  201. package/dist/LineChart-D4GI7nVh.mjs +0 -541
  202. package/dist/Loader-DUaFpDGv.mjs +0 -24
  203. package/dist/MicroWidgetContainer-DpeqN9n3.mjs +0 -45
  204. package/dist/MiniWidgetContainer-D0gfmbaF.mjs +0 -56
  205. package/dist/SearchBox-B2_zLv8-.mjs +0 -42
  206. package/dist/TransactionApi-B3Tksf7L.mjs +0 -86
  207. package/dist/TransactionDetails-oP1eSuiS.mjs +0 -1334
  208. package/dist/TrendsStore-DCYbpXPO.mjs +0 -559
  209. package/dist/common/components/barchart/Bar.d.ts +0 -25
  210. package/dist/common/components/barchart/BarChart.d.ts +0 -34
  211. package/dist/common/components/barchart/BarColumn.d.ts +0 -37
  212. package/dist/common/components/barchart/Legend.d.ts +0 -8
  213. package/dist/common/components/barchart/Util.d.ts +0 -42
  214. package/dist/common/components/barchart/index.d.ts +0 -1
  215. package/dist/common/hooks/usePrevious.d.ts +0 -2
  216. package/dist/exportTransactionsToCSV-7bVS7KXf.mjs +0 -47
  217. package/dist/finstrong/utils/Finstrong.d.ts +0 -6
  218. package/dist/transactions/components/shared/transactionlist/DateRow.d.ts +0 -7
  219. package/dist/useAriaLive-B3_pRUio.mjs +0 -35
@@ -1,75 +1,439 @@
1
- import { jsx as e, jsxs as C, Fragment as Qe } from "react/jsx-runtime";
2
- import i from "react";
3
- import { observer as x } from "mobx-react-lite";
4
- import { Icon as ae, Text as Z, CategoryIcon as fe, P as U, H3 as xe, ChevronRightIcon as Je } from "@mxenabled/mxui";
5
- import O from "@mui/material/Box";
6
- import b from "@mui/material/Stack";
7
- import me from "@mui/material/Button";
8
- import { addSeconds as ve } from "date-fns/addSeconds";
9
- import { differenceInCalendarMonths as pe } from "date-fns/differenceInCalendarMonths";
10
- import { a as et, g as tt, S as nt, L as Me } from "../TrendsStore-DCYbpXPO.mjs";
11
- import { T as Co } from "../TrendsStore-DCYbpXPO.mjs";
12
- import { i as ot, c as st, d as rt, e as at, f as it, h as ct, b as Ae, g as Re, j as De } from "../SpendingData-D5vsfYKo.mjs";
13
- import lt from "@mui/material/ToggleButton";
14
- import dt from "@mui/material/ToggleButtonGroup";
15
- import { u as A, m as P, g as H, b as J, h as ie, d as ce, w as ee, f as Te, q as ht, n as ut, a as gt } from "../hooks-D6XlXHf4.mjs";
16
- import { u as $ } from "../useScreenSize-B6JyS_Lj.mjs";
17
- import { f as q, D as z } from "../Dialog-CWW597AF.mjs";
18
- import { DataGridPro as mt } from "@mui/x-data-grid-pro";
19
- import { C as pt } from "../CurrencyText-kyC1aseI.mjs";
20
- import { b as Ct } from "../Localization-2MODESHW.mjs";
21
- import { H as Ie } from "../HeaderCell-DjuifqHJ.mjs";
22
- import { T as M, b as ft } from "../ViewMoreMicroCard-SCn2wt4i.mjs";
23
- import { A as _, W as ke } from "../WidgetContainer-BHWANqT4.mjs";
24
- import { c as Tt } from "../Category-CevNQ03n.mjs";
25
- import { a as Ne, T as He } from "../TransactionDetails-oP1eSuiS.mjs";
26
- import { D as Ce } from "../Drawer-kEE73B87.mjs";
27
- import { L as Q } from "../Loader-DUaFpDGv.mjs";
28
- import { useTheme as We } from "@mui/material/styles";
29
- import { L as ye } from "../LineChart-D4GI7nVh.mjs";
30
- import { M as yt } from "../MiniWidgetContainer-D0gfmbaF.mjs";
31
- import { subMonths as _t } from "date-fns";
32
- import { TrendingUp as bt, TrendingDown as St, MultilineChart as wt, ExpandLess as Dt, ExpandMore as It } from "@mxenabled/mx-icons";
33
- import { a as Et, f as X } from "../NumberFormatting-Buh7u8Oi.mjs";
34
- import { M as Lt } from "../MicroWidgetContainer-DpeqN9n3.mjs";
35
- import xt from "@mui/material/Collapse";
36
- import vt from "@mui/material/List";
37
- import Mt from "@mui/material/ListItem";
38
- import At from "@mui/material/ListItemButton";
39
- import Rt from "@mui/material/ListItemIcon";
40
- import kt from "@mui/material/ListItemText";
41
- import Oe from "@mui/material/styles/useTheme";
42
- import Nt from "@mui/material/Divider";
43
- import { useTheme as Ht, Stack as Wt } from "@mui/material";
44
- import Ot from "@mui/material/Paper";
45
- import { b as Vt } from "../CategoryUtil-pZRIYOgN.mjs";
46
- import { E as Gt } from "../ExportCsvAction-sX8Rg4Ov.mjs";
47
- import { u as Bt } from "../useInsightsEnabled-DBpwEq10.mjs";
48
- import { E as zt } from "../EmptyState-DA_lfRBv.mjs";
49
- import { l as Pt } from "../ConnectDrawer-BQNs-hjk.mjs";
50
- const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
51
- dt,
1
+ import { jsxs as y, jsx as e, Fragment as lt } from "react/jsx-runtime";
2
+ import c, { useRef as dt, useState as ut, useEffect as ht } from "react";
3
+ import { observer as R } from "mobx-react-lite";
4
+ import { CategoryIcon as we, Text as z, Icon as Se, P as pe, H3 as Pe } from "@mxenabled/mxui";
5
+ import W from "@mui/material/Box";
6
+ import S from "@mui/material/Stack";
7
+ import xe from "@mui/material/Button";
8
+ import { addSeconds as Fe } from "date-fns/addSeconds";
9
+ import { differenceInCalendarMonths as Ae } from "date-fns/differenceInCalendarMonths";
10
+ import { useTheme as ue } from "@mui/material/styles";
11
+ import { LineChart as gt } from "@mui/x-charts";
12
+ import { u as J } from "../useScreenSize-B5afALev.mjs";
13
+ import { u as mt } from "../useDimensions-27p2evRx.mjs";
14
+ import pt from "@mui/material/Card";
15
+ import ft from "@mui/material/CardContent";
16
+ import Re from "@mui/material/Divider";
17
+ import We from "@mui/material/Grid";
18
+ import { u as O, m as Y, g as P, b as ye, h as De, d as Le, w as Ce, q as ze, f as He, n as yt, a as Ct } from "../hooks-C41HAxM5.mjs";
19
+ import { b as $e } from "../Localization-2MODESHW.mjs";
20
+ import { C as ve } from "../CurrencyText-Dr0EZ7bp.mjs";
21
+ import { useTheme as _t, Card as Tt, CardContent as bt, Box as St, Stack as xt } from "@mui/material";
22
+ import { f as Q, a as F } from "../Dialog-CDV0kKxj.mjs";
23
+ import { a as Me, c as vt } from "../Category-Ccoew_sA.mjs";
24
+ import { f as oe, a as wt } from "../NumberFormatting-DjTD0t3W.mjs";
25
+ import { a as Dt, g as Lt, L as Ke } from "../TrendsStore-_mRaFUdf.mjs";
26
+ import { T as Pn } from "../TrendsStore-_mRaFUdf.mjs";
27
+ import { i as Et, c as It, d as Mt, e as At, f as Rt, h as kt, g as je, b as Ye, j as Oe } from "../SpendingData-DPQ96k3x.mjs";
28
+ import Ht from "@mui/material/ToggleButton";
29
+ import Nt from "@mui/material/ToggleButtonGroup";
30
+ import { DataGridPro as Wt } from "@mui/x-data-grid-pro";
31
+ import { H as Ge } from "../HeaderCell-P8w6CmfO.mjs";
32
+ import { T as V, b as Ot } from "../ViewMoreMicroCard-DAkyNRlD.mjs";
33
+ import { A as w, W as Ue } from "../WidgetContainer-CDh9fjpR.mjs";
34
+ import { a as Xe, T as Ze } from "../TransactionDetails-Bn0qY5Hw.mjs";
35
+ import { D as ke } from "../Drawer-BF40nbsH.mjs";
36
+ import { L as fe } from "../Loader-Ckqi9Rx6.mjs";
37
+ import { L as Ne } from "../LineChart-C1PxNf7P.mjs";
38
+ import { M as Gt } from "../MiniWidgetContainer-CKzf_Ira.mjs";
39
+ import { subMonths as Bt } from "date-fns";
40
+ import { TrendingUp as Vt, TrendingDown as Pt, MultilineChart as Ft, ExpandLess as zt, ExpandMore as $t, ChevronRight as Kt } from "@mxenabled/mx-icons";
41
+ import { M as jt } from "../MicroWidgetContainer-BGpNl5ZS.mjs";
42
+ import Yt from "@mui/material/Collapse";
43
+ import Ut from "@mui/material/List";
44
+ import Xt from "@mui/material/ListItem";
45
+ import Zt from "@mui/material/ListItemButton";
46
+ import qt from "@mui/material/ListItemIcon";
47
+ import Qt from "@mui/material/ListItemText";
48
+ import Jt from "@mui/material/Paper";
49
+ import { b as eo } from "../CategoryUtil-DfVKKkRf.mjs";
50
+ import { E as to } from "../ExportCsvAction-QhQK4_FU.mjs";
51
+ import { u as oo } from "../useInsightsEnabled-CNjP5cfR.mjs";
52
+ import { E as no } from "../EmptyState-DoxNUae-.mjs";
53
+ import { l as so } from "../ConnectDrawer-DVp54lUH.mjs";
54
+ const qe = ({ categoryGuid: o, topLevelCategoryGuid: a }) => {
55
+ const { categories: t } = O(), { getCategoryName: n } = Y(), s = n(o);
56
+ return /* @__PURE__ */ y(S, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
57
+ /* @__PURE__ */ e(
58
+ W,
59
+ {
60
+ "aria-label": $e(t.category_icon_label_aria, s),
61
+ mb: 4,
62
+ role: "img",
63
+ children: /* @__PURE__ */ e(we, { categoryGuid: a })
64
+ }
65
+ ),
66
+ /* @__PURE__ */ e(z, { variant: "body1", children: s })
67
+ ] });
68
+ }, ao = ({
69
+ categoryGuids: { guid: o, topLevelGuid: a },
70
+ hoveredAreaData: t,
71
+ cursorPosition: n,
72
+ chartContainerRef: s
73
+ }) => {
74
+ const l = ue(), m = dt(null), [h, i] = ut({ x: n.x, y: n.y });
75
+ if (ht(() => {
76
+ (() => {
77
+ const p = m.current, _ = s.current;
78
+ if (!p || !_) return;
79
+ const u = p.getBoundingClientRect(), C = _.getBoundingClientRect();
80
+ let b = n.x, g = n.y;
81
+ b + u.width * 2 > C.right ? b = n.x - u.width : b - u.width < C.left && (b = n.x), g + u.height * 2 > C.bottom && (g = n.y - u.height), i({ x: b, y: g });
82
+ })();
83
+ }, [n, s]), !t) return null;
84
+ const d = t.reduce((f, p) => f + p.y, 0);
85
+ return /* @__PURE__ */ e(
86
+ pt,
87
+ {
88
+ ref: m,
89
+ sx: {
90
+ position: "absolute",
91
+ top: h.y,
92
+ left: h.x,
93
+ width: 250,
94
+ pointerEvents: "none"
95
+ },
96
+ children: /* @__PURE__ */ y(ft, { children: [
97
+ /* @__PURE__ */ y(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
98
+ /* @__PURE__ */ e(qe, { categoryGuid: o, topLevelCategoryGuid: a }),
99
+ /* @__PURE__ */ e(z, { variant: "body2", children: `${t.length}-month total` }),
100
+ /* @__PURE__ */ e(ve, { amount: d, bold: !0, formatString: "0,0", variant: "body2" })
101
+ ] }),
102
+ /* @__PURE__ */ e(Re, { sx: { my: 16, width: "100%" } }),
103
+ /* @__PURE__ */ e(We, { container: !0, children: t.map((f, p) => /* @__PURE__ */ y(c.Fragment, { children: [
104
+ p > 0 && p % 3 === 0 && /* @__PURE__ */ e(Re, { sx: { my: 16, width: "100%" } }),
105
+ /* @__PURE__ */ e(We, { size: { xs: 4 }, children: /* @__PURE__ */ y(W, { alignItems: "center", display: "flex", flexDirection: "column", children: [
106
+ /* @__PURE__ */ e(z, { color: l.palette.text.secondary, variant: "caption", children: f.x }),
107
+ /* @__PURE__ */ e(
108
+ ve,
109
+ {
110
+ amount: f.y,
111
+ bold: !0,
112
+ formatString: "0,0",
113
+ variant: "body1"
114
+ }
115
+ )
116
+ ] }) })
117
+ ] }, p)) })
118
+ ] })
119
+ }
120
+ );
121
+ }, ro = R(ao), io = ({
122
+ categoryGuids: { guid: o, topLevelGuid: a },
123
+ itemData: { dataIndex: t },
124
+ series: n,
125
+ xData: s
126
+ }) => {
127
+ const l = _t(), m = n.data[t], h = s[t];
128
+ return m === void 0 || !h ? null : /* @__PURE__ */ e(Tt, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ y(St, { alignItems: "center", display: "flex", flexDirection: "column", children: [
129
+ /* @__PURE__ */ e(qe, { categoryGuid: o, topLevelCategoryGuid: a }),
130
+ /* @__PURE__ */ e(z, { color: l.palette.text.secondary, variant: "body2", children: Q(h, F.MONTH_SHORT_YEAR) }),
131
+ /* @__PURE__ */ e(ve, { amount: String(m), bold: !0, formatString: "0,0", variant: "body1" })
132
+ ] }) }) });
133
+ }, co = ({
134
+ sx: o,
135
+ categoryGuids: a,
136
+ hoveredLegend: t,
137
+ legendRef: n,
138
+ onHoverLegend: s,
139
+ onClickLegend: l
140
+ }) => {
141
+ const { isMobile: m } = J(), { getCategoryName: h } = Y();
142
+ return /* @__PURE__ */ e(
143
+ S,
144
+ {
145
+ direction: "row",
146
+ flexWrap: "wrap",
147
+ gap: m ? 2 : 6,
148
+ justifyContent: "start",
149
+ ref: n,
150
+ sx: o,
151
+ children: a.map(({ guid: i, top_level_guid: d }) => {
152
+ const f = t === i, p = Me[i], _ = Me[d], u = p ?? _ ?? Me.default, C = u + "33";
153
+ return /* @__PURE__ */ y(
154
+ xe,
155
+ {
156
+ onClick: () => l(i),
157
+ onMouseEnter: () => s(i),
158
+ onMouseLeave: () => s(null),
159
+ sx: {
160
+ color: "text.primary",
161
+ fontWeight: "normal",
162
+ display: "flex",
163
+ justifyContent: "center",
164
+ alignItems: "center",
165
+ paddingX: 8,
166
+ paddingY: 4,
167
+ borderRadius: 1,
168
+ opacity: f ? 1 : 0.7
169
+ },
170
+ children: [
171
+ /* @__PURE__ */ e(
172
+ W,
173
+ {
174
+ sx: {
175
+ width: 16,
176
+ height: 16,
177
+ marginRight: m ? 5 : 10,
178
+ borderRadius: "2px",
179
+ backgroundColor: t ? f ? u : C : u
180
+ }
181
+ }
182
+ ),
183
+ /* @__PURE__ */ e(z, { variant: "body1", children: h(i) })
184
+ ]
185
+ },
186
+ i
187
+ );
188
+ })
189
+ }
190
+ );
191
+ }, lo = ({
192
+ onHoverArea: o,
193
+ onHoverPoint: a,
194
+ onHoverLegend: t,
195
+ onClickLegend: n,
196
+ stackedDatasets: s,
197
+ unstackedDatasets: l = [],
198
+ availableHeight: m = 0,
199
+ minimumHeight: h = 350
200
+ }) => {
201
+ const i = ue(), { isMobile: d } = J(), [f, { height: p }] = mt(), _ = c.useRef(null), [u, C] = c.useState(0);
202
+ c.useEffect(() => {
203
+ const r = Math.max(m - p, h);
204
+ C(r);
205
+ }, [m, p]);
206
+ const [b, g] = c.useState(null), [v, E] = c.useState({
207
+ hoveredSeriesId: null,
208
+ hoveredAreaData: null,
209
+ isAreaHovered: !1,
210
+ cursorPos: { x: 0, y: 0 }
211
+ }), { hoveredSeriesId: I, hoveredAreaData: x, isAreaHovered: M, cursorPos: k } = v, A = M && I && x, G = !A, ee = [...s, ...l], ne = ee[0]?.dataset.length ?? 0, H = ee.flatMap((r) => r.dataset.map((T) => T.x)), he = ee.flatMap((r) => r.dataset.map((T) => T.y)), B = s[0]?.dataset?.map(
212
+ (r, T) => s.reduce((L, j) => L + j.dataset[T]?.y || 0, 0)
213
+ ) ?? [0], se = Math.max(...B), ae = Math.max(
214
+ ...l.flatMap((r) => r.dataset.map((T) => T.y))
215
+ ), $ = Math.floor(Math.min(...he) / 100) * 100, _e = Math.ceil(Math.max(se, ae) / 100) * 100, U = s.map((r, T) => ({
216
+ id: `stacked-${T}`,
217
+ guid: r.category_guid,
218
+ top_level_guid: r.top_level_category_guid,
219
+ area: !0,
220
+ color: s[T].category_color ?? i.palette.primary.main,
221
+ data: r.dataset.map((L) => L.y),
222
+ label: s[T].category_name,
223
+ stack: "total",
224
+ type: "line",
225
+ highlightScope: { highlight: "item" },
226
+ valueFormatter: (L) => oe(L, "0,0")
227
+ })), K = l.map((r, T) => ({
228
+ id: `unstacked-${T}`,
229
+ guid: r.category_guid,
230
+ top_level_guid: r.top_level_category_guid,
231
+ area: !1,
232
+ color: r.category_color,
233
+ data: r.dataset.map((L) => L.y),
234
+ label: r.category_name,
235
+ type: "line",
236
+ valueFormatter: (L) => oe(L, "0,0")
237
+ })), re = [...U, ...K], X = [
238
+ ...U.map(({ guid: r, top_level_guid: T }) => ({
239
+ guid: r,
240
+ top_level_guid: T
241
+ })),
242
+ ...K.map(({ guid: r, top_level_guid: T }) => ({
243
+ guid: r,
244
+ top_level_guid: T
245
+ }))
246
+ ], Z = (r) => {
247
+ const L = r.startsWith("stacked-") ? s[parseInt(r.split("-")[1])] : l[parseInt(r.split("-")[1])];
248
+ return {
249
+ guid: L?.category_guid,
250
+ topLevelGuid: L?.top_level_category_guid
251
+ };
252
+ }, te = (r) => {
253
+ g(r), t?.(r ?? "");
254
+ }, ie = (r) => {
255
+ n?.(r ?? "");
256
+ }, ge = () => {
257
+ const r = Z(String(I)).guid;
258
+ r && n?.(r);
259
+ }, ce = (r) => {
260
+ const T = String(r?.seriesId), L = Z(T).guid, j = re.find((de) => de.id === T), Te = j && r?.dataIndex !== void 0, Ee = j && r?.dataIndex === void 0;
261
+ if (Te)
262
+ E({
263
+ hoveredSeriesId: T,
264
+ hoveredAreaData: null,
265
+ isAreaHovered: !1,
266
+ cursorPos: k
267
+ }), a?.(L);
268
+ else if (Ee) {
269
+ const de = j?.data.map((be, Ie) => ({
270
+ x: H[Ie],
271
+ y: be
272
+ })) ?? [];
273
+ E({
274
+ hoveredSeriesId: T,
275
+ hoveredAreaData: de,
276
+ isAreaHovered: !0,
277
+ cursorPos: k
278
+ }), o?.(L);
279
+ } else
280
+ E({
281
+ hoveredSeriesId: null,
282
+ hoveredAreaData: null,
283
+ isAreaHovered: !1,
284
+ cursorPos: k
285
+ });
286
+ }, le = (r) => {
287
+ const T = r.currentTarget.getBoundingClientRect();
288
+ E((L) => ({
289
+ ...L,
290
+ cursorPos: {
291
+ x: r.clientX - T.left,
292
+ y: r.clientY - T.top
293
+ }
294
+ }));
295
+ }, D = {
296
+ p: 4,
297
+ "& .MuiBarLabel-root": {
298
+ fontSize: 10,
299
+ fontWeight: 600
300
+ },
301
+ "& .MuiAreaElement-root": {
302
+ opacity: 0.4,
303
+ transition: "opacity 0.3s ease"
304
+ },
305
+ "& .MuiAreaElement-root:hover": {
306
+ opacity: 1
307
+ },
308
+ '& [class*="MuiLineElement-series-unstacked-"]': {
309
+ strokeWidth: 3
310
+ },
311
+ ...b && U.reduce((r, T, L) => {
312
+ const j = `.MuiAreaElement-series-stacked-${L}`;
313
+ return r[j] = {
314
+ opacity: U[L].guid === b ? 0.9 : 0.2
315
+ }, r;
316
+ }, {})
317
+ };
318
+ return /* @__PURE__ */ e(
319
+ W,
320
+ {
321
+ onMouseMove: le,
322
+ ref: _,
323
+ sx: {
324
+ position: "relative",
325
+ touchAction: "pan-y",
326
+ "& svg": {
327
+ touchAction: "pan-y",
328
+ userSelect: "none"
329
+ },
330
+ "& .recharts-wrapper": {
331
+ touchAction: "pan-y"
332
+ }
333
+ },
334
+ children: /* @__PURE__ */ y(
335
+ S,
336
+ {
337
+ direction: { xs: "column", md: "column" },
338
+ spacing: { xs: 0, md: 4 },
339
+ sx: { width: "100%", position: "relative" },
340
+ children: [
341
+ /* @__PURE__ */ e(
342
+ gt,
343
+ {
344
+ height: u,
345
+ margin: { bottom: 50 },
346
+ onAreaClick: ge,
347
+ onHighlightChange: ce,
348
+ series: re,
349
+ skipAnimation: !0,
350
+ slotProps: {
351
+ legend: {
352
+ hidden: !0
353
+ }
354
+ },
355
+ slots: {
356
+ itemContent: (r) => G && I ? /* @__PURE__ */ e(
357
+ io,
358
+ {
359
+ categoryGuids: Z(I),
360
+ xData: H,
361
+ ...r
362
+ }
363
+ ) : null
364
+ },
365
+ sx: D,
366
+ tooltip: {
367
+ trigger: G ? "item" : "none"
368
+ },
369
+ xAxis: [
370
+ {
371
+ data: H,
372
+ scaleType: "time",
373
+ valueFormatter: (r) => Q(r, F.MONTH_SHORT_YEAR),
374
+ tickNumber: ne
375
+ // How many ticks to show on the x-axis
376
+ }
377
+ ],
378
+ yAxis: [
379
+ {
380
+ min: $,
381
+ max: _e || 100
382
+ }
383
+ ]
384
+ }
385
+ ),
386
+ /* @__PURE__ */ e(
387
+ co,
388
+ {
389
+ categoryGuids: X,
390
+ hoveredLegend: b,
391
+ legendRef: f,
392
+ onClickLegend: ie,
393
+ onHoverLegend: te,
394
+ sx: { px: d ? 0 : 24 }
395
+ }
396
+ ),
397
+ A && /* @__PURE__ */ e(
398
+ ro,
399
+ {
400
+ categoryGuids: Z(I),
401
+ chartContainerRef: _,
402
+ cursorPosition: k,
403
+ hoveredAreaData: x.map((r) => ({
404
+ ...r,
405
+ x: Q(r.x, F.MONTH_SHORT_YEAR)
406
+ }))
407
+ }
408
+ )
409
+ ]
410
+ }
411
+ )
412
+ }
413
+ );
414
+ }, Qe = ({ selectedTab: o, onTabChange: a }) => /* @__PURE__ */ e(
415
+ Nt,
52
416
  {
53
417
  exclusive: !0,
54
- onChange: o,
418
+ onChange: a,
55
419
  orientation: "horizontal",
56
- value: t,
57
- children: ["Chart", "Table"].map((n) => /* @__PURE__ */ e(lt, { color: "primary", sx: { width: 56 }, value: n, children: n === "Chart" ? /* @__PURE__ */ e(ae, { name: "table_chart_view" }) : /* @__PURE__ */ e(ae, { name: "format_list_bulleted" }) }, n))
420
+ value: o,
421
+ children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(Ht, { 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))
58
422
  }
59
- ), Ge = ({ selectedDateRange: t, selectedCategoryGuid: o }) => {
60
- const { trends: n } = A(), { isMobile: s, isDesktop: r } = $(), { getCategoryName: l } = P(), d = i.useMemo(() => {
61
- const h = q(
62
- t.start,
63
- s ? z.MONTH_SHORT_YEAR : z.MONTH_YEAR
64
- ), c = q(
65
- t.end,
66
- s ? z.MONTH_SHORT_YEAR : z.MONTH_YEAR
423
+ ), Je = ({ selectedDateRange: o, selectedCategoryGuid: a }) => {
424
+ const { trends: t } = O(), { isMobile: n, isDesktop: s } = J(), { getCategoryName: l } = Y(), m = c.useMemo(() => {
425
+ const h = Q(
426
+ o.start,
427
+ n ? F.MONTH_SHORT_YEAR : F.MONTH_YEAR
428
+ ), i = Q(
429
+ o.end,
430
+ n ? F.MONTH_SHORT_YEAR : F.MONTH_YEAR
67
431
  );
68
- return `${h} - ${c}`;
69
- }, [t, s]);
70
- return /* @__PURE__ */ C(O, { sx: { mr: 10, minWidth: "60%" }, children: [
432
+ return `${h} - ${i}`;
433
+ }, [o, n]);
434
+ return /* @__PURE__ */ y(W, { sx: { mr: 10, minWidth: "60%" }, children: [
71
435
  /* @__PURE__ */ e(
72
- Z,
436
+ z,
73
437
  {
74
438
  display: "block",
75
439
  fontWeight: 700,
@@ -78,272 +442,282 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
78
442
  overflow: "visible",
79
443
  textOverflow: "unset"
80
444
  },
81
- variant: r ? "H3" : "Body",
82
- children: l(o) || n.sub_title
445
+ variant: s ? "h3" : "body1",
446
+ children: l(a) || t.sub_title
83
447
  }
84
448
  ),
85
- /* @__PURE__ */ e(Z, { variant: r ? "Body" : "Small", children: d })
449
+ /* @__PURE__ */ e(z, { variant: s ? "body1" : "body2", children: m })
86
450
  ] });
87
- }, Ft = (t) => {
88
- const o = t.row[t.field];
89
- return /* @__PURE__ */ e(b, { alignItems: "flex-end", tabIndex: t.tabIndex, children: /* @__PURE__ */ e(pt, { amount: o, variant: "Small" }) });
90
- }, Kt = ({ categoryGuid: t, topLevelCategoryGuid: o }) => {
91
- const { getCategoryName: n } = P(), { categories: s } = A(), r = s.default_categories[t]?.replace(/&amp;/g, "&") ?? n(t);
92
- return /* @__PURE__ */ C(b, { alignItems: "center", direction: "row", justifyContent: "center", children: [
451
+ }, uo = (o) => {
452
+ const a = o.row[o.field];
453
+ return /* @__PURE__ */ e(S, { alignItems: "flex-end", tabIndex: o.tabIndex, children: /* @__PURE__ */ e(ve, { amount: a, variant: "body2" }) });
454
+ }, ho = ({ categoryGuid: o, topLevelCategoryGuid: a }) => {
455
+ const { getCategoryName: t } = Y(), { categories: n } = O(), s = n.default_categories[o]?.replace(/&amp;/g, "&") ?? t(o);
456
+ return /* @__PURE__ */ y(S, { alignItems: "center", direction: "row", justifyContent: "center", children: [
93
457
  /* @__PURE__ */ e(
94
- O,
458
+ W,
95
459
  {
96
- "aria-label": Ct(s.category_icon_label_aria, r),
460
+ "aria-label": $e(n.category_icon_label_aria, s),
97
461
  role: "img",
98
- children: /* @__PURE__ */ e(fe, { categoryGuid: o })
462
+ children: /* @__PURE__ */ e(we, { categoryGuid: a })
99
463
  }
100
464
  ),
101
- /* @__PURE__ */ e(Z, { sx: { ml: 12, pb: 6 }, variant: "Small", children: r })
465
+ /* @__PURE__ */ e(z, { sx: { ml: 12, pb: 6 }, variant: "body2", children: s })
102
466
  ] });
103
- }, $t = (t) => /* @__PURE__ */ e(b, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
104
- Kt,
467
+ }, go = (o) => /* @__PURE__ */ e(S, { alignItems: "center", direction: "row", height: "100%", width: "100%", children: /* @__PURE__ */ e(
468
+ ho,
105
469
  {
106
- categoryGuid: t.row.category,
107
- topLevelCategoryGuid: t.row.top_level_category_guid
470
+ categoryGuid: o.row.category,
471
+ topLevelCategoryGuid: o.row.top_level_category_guid
108
472
  }
109
- ) }), jt = (t, o) => {
110
- const n = [], s = new Date(t);
111
- for (; s <= o; ) {
112
- const r = q(s, z.MONTH);
113
- n.push(r), s.setMonth(s.getMonth() + 1);
473
+ ) }), mo = (o, a) => {
474
+ const t = [], n = new Date(o);
475
+ for (; n <= a; ) {
476
+ const s = Q(n, F.MONTH);
477
+ t.push(s), n.setMonth(n.getMonth() + 1);
114
478
  }
115
- return n;
116
- }, Be = ({
117
- monthlyCategoryTotals: t,
118
- selectedDateRange: o,
119
- selectedCategory: n,
120
- onClickRow: s,
121
- height: r = "100dvh",
479
+ return t;
480
+ }, et = ({
481
+ monthlyCategoryTotals: o,
482
+ selectedDateRange: a,
483
+ selectedCategory: t,
484
+ onClickRow: n,
485
+ height: s = "100dvh",
122
486
  sx: l = {}
123
487
  }) => {
124
- const { onEvent: d } = H(), h = q(/* @__PURE__ */ new Date(), z.MONTH_SHORT), [c, u] = i.useState([
488
+ const { onEvent: m } = P(), h = Q(/* @__PURE__ */ new Date(), F.MONTH_SHORT), [i, d] = c.useState([
125
489
  { field: h, sort: "desc" }
126
- ]), f = i.useMemo(() => jt(o.start, o.end), [o]), g = [
490
+ ]), f = c.useMemo(() => mo(a.start, a.end), [a]), p = [
127
491
  {
128
492
  field: "category",
129
493
  flex: 1,
130
494
  headerName: "Category",
131
495
  minWidth: 175,
132
- renderHeader: Ie,
133
- renderCell: $t,
496
+ renderHeader: Ge,
497
+ renderCell: go,
134
498
  sortable: !0,
135
499
  type: "string"
136
500
  },
137
501
  ...f.map(
138
- (m) => ({
139
- field: m,
502
+ (u) => ({
503
+ field: u,
140
504
  flex: 1,
141
- headerName: m,
505
+ headerName: u,
142
506
  minWidth: 100,
143
- renderHeader: Ie,
144
- renderCell: Ft,
507
+ renderHeader: Ge,
508
+ renderCell: uo,
145
509
  align: "right",
146
510
  headerAlign: "right",
147
511
  sortable: !0,
148
512
  hideSortIcons: !1,
149
513
  type: "number",
150
- sortComparator: et
514
+ sortComparator: Dt
151
515
  })
152
516
  )
153
- ], T = i.useMemo(() => {
154
- const m = t.filter(
155
- (p) => !ot(p) && !st(p)
156
- ), y = (n ? m.filter(
157
- (p) => p.category_guid === n || p.top_level_category_guid === n
158
- ) : m).reduce(
159
- (p, E) => {
160
- const { category_guid: w, top_level_category_guid: D, month: R, total: v, year: k } = E, N = n ? w : D;
161
- p[N] || (p[N] = {
162
- id: N,
163
- category: N,
164
- category_guid: w,
165
- top_level_category_guid: D
517
+ ], _ = c.useMemo(() => {
518
+ const u = o.filter(
519
+ (g) => !Et(g) && !It(g)
520
+ ), b = (t ? u.filter(
521
+ (g) => g.category_guid === t || g.top_level_category_guid === t
522
+ ) : u).reduce(
523
+ (g, v) => {
524
+ const { category_guid: E, top_level_category_guid: I, month: x, total: M, year: k } = v, A = t ? E : I;
525
+ g[A] || (g[A] = {
526
+ id: A,
527
+ category: A,
528
+ category_guid: E,
529
+ top_level_category_guid: I
166
530
  });
167
- const I = q(new Date(k, R - 1), z.MONTH_SHORT);
168
- return p[N][I] || (p[N][I] = 0), p[N][I] = p[N][I] + Math.abs(v), p;
531
+ const G = Q(new Date(k, x - 1), F.MONTH_SHORT);
532
+ return g[A][G] || (g[A][G] = 0), g[A][G] = g[A][G] + Math.abs(M), g;
169
533
  },
170
534
  {}
171
535
  );
172
- return Object.values(y);
173
- }, [t, n]);
174
- return /* @__PURE__ */ e(O, { sx: { height: r, width: "100%", overflowX: "auto", boxShadow: "none", ...l }, children: /* @__PURE__ */ e(
175
- mt,
536
+ return Object.values(b);
537
+ }, [o, t]);
538
+ return /* @__PURE__ */ e(W, { sx: { height: s, width: "100%", overflowX: "auto", boxShadow: "none", ...l }, children: /* @__PURE__ */ e(
539
+ Wt,
176
540
  {
177
- columns: g,
541
+ columns: p,
178
542
  disableColumnFilter: !0,
179
543
  disableColumnMenu: !0,
180
544
  hideFooter: !0,
181
- initialState: { sorting: { sortModel: c } },
182
- onRowClick: (m) => {
183
- s?.(m.row.category), d(_.TRENDS_CLICK_LIST_ITEM, {
184
- ...M,
185
- listItem: Tt[m.row.category]
545
+ initialState: { sorting: { sortModel: i } },
546
+ onRowClick: (u) => {
547
+ n?.(u.row.category), m(w.TRENDS_CLICK_LIST_ITEM, {
548
+ ...V,
549
+ listItem: vt[u.row.category]
186
550
  });
187
551
  },
188
- onSortModelChange: (m) => {
189
- u(m), d(_.TRENDS_CLICK_TABLE_SORT, M);
552
+ onSortModelChange: (u) => {
553
+ d(u), m(w.TRENDS_CLICK_TABLE_SORT, V);
190
554
  },
191
- rows: T,
555
+ rows: _,
192
556
  slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
193
- sortModel: c,
557
+ sortModel: i,
194
558
  sortingOrder: ["asc", "desc"]
195
559
  }
196
560
  ) });
197
- }, Yt = {
561
+ }, po = {
198
562
  title: "Transaction List"
199
- }, Ut = ({
200
- categoryGuid: t,
201
- dateRange: o,
202
- isOpen: n,
203
- onClose: s
563
+ }, fo = ({
564
+ categoryGuid: o,
565
+ dateRange: a,
566
+ isOpen: t,
567
+ onClose: n
204
568
  }) => {
205
- const { onEvent: r } = H(), { selectedAccountGuids: l } = J(), { common: d } = A(), { setFilter: h, sortedTransactions: c } = ie(), [u, f] = i.useState(""), g = i.useMemo(
206
- () => c.find((m) => m.guid === u),
207
- [u, c]
569
+ const { onEvent: s } = P(), { selectedAccountGuids: l } = ye(), { common: m } = O(), { setFilter: h, sortedTransactions: i } = De(), [d, f] = c.useState(""), p = c.useMemo(
570
+ () => i.find((u) => u.guid === d),
571
+ [d, i]
208
572
  );
209
- i.useEffect(() => {
573
+ c.useEffect(() => {
210
574
  h({
211
575
  accounts: l,
212
- dateRange: o,
213
- custom: (m) => t === "" || t === m.category_guid || t === m.top_level_category_guid,
214
- showSplits: !!t
576
+ dateRange: a,
577
+ custom: (u) => o === "" || o === u.category_guid || o === u.top_level_category_guid,
578
+ showSplits: !!o
215
579
  });
216
- }, [l, t, o]), i.useEffect(() => r(_.TRENDS_VIEW_TRANSACTIONS), []);
217
- const T = () => {
218
- f(""), s();
580
+ }, [l, o, a]), c.useEffect(() => s(w.TRENDS_VIEW_TRANSACTIONS), []);
581
+ const _ = () => {
582
+ f(""), n();
219
583
  };
220
- return /* @__PURE__ */ C(
221
- Ce,
584
+ return /* @__PURE__ */ y(
585
+ ke,
222
586
  {
223
- ariaLabelClose: d.close_aria,
224
- isOpen: n,
225
- onClose: T,
226
- title: Yt.title,
587
+ ariaLabelClose: m.close_aria,
588
+ isOpen: t,
589
+ onClose: _,
590
+ title: po.title,
227
591
  children: [
228
- g && /* @__PURE__ */ e(Ne, { transaction: g }),
229
- !g && /* @__PURE__ */ e(He, { onClick: f })
592
+ p && /* @__PURE__ */ e(Xe, { transaction: p }),
593
+ !p && /* @__PURE__ */ e(Ze, { onClick: f })
230
594
  ]
231
595
  }
232
596
  );
233
- }, Xt = x(Ut), Zt = ({ onBackClick: t, sx: o }) => {
234
- const { onEvent: n } = H(), { isDesktop: s, isTablet: r, isMobile: l } = $(), { visibleAccounts: d } = ce(), { loadMonthlyCategoryTotals: h, monthlyCategoryTotals: c, getCategoryName: u } = P(), { sortedTransactions: f } = ie(), { selectedDateRange: g, setSelectedDateRange: T } = ee(), { isCopyLoaded: m, isInitialized: a, selectedAccounts: y, setSelectedAccounts: p } = J(), { trends: E } = A(), [w, D] = i.useState(!1), [R, v] = i.useState(!1), [k, N] = i.useState("Chart"), [I, te] = i.useState(""), [ne, B] = i.useState(window.innerHeight), le = ne - (l ? 315 : 345);
235
- i.useEffect(() => {
236
- const S = () => B(window.innerHeight);
237
- return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
238
- }, []), i.useEffect(() => {
239
- p(d);
240
- }, [d]), i.useEffect(() => {
241
- a && h(
242
- y,
243
- g.start,
244
- g.end
597
+ }, yo = R(fo), Co = ({ onBackClick: o, sx: a }) => {
598
+ const { onEvent: t } = P(), { isDesktop: n, isTablet: s, isMobile: l } = J(), { isAccountDataLoaded: m, loadAccountData: h, visibleAccounts: i } = Le(), {
599
+ categoriesLoaded: d,
600
+ loadCategories: f,
601
+ loadMonthlyCategoryTotals: p,
602
+ monthlyCategoryTotals: _,
603
+ getCategoryName: u
604
+ } = Y(), {
605
+ isTransactionDataLoaded: C,
606
+ loadTransactionData: b,
607
+ sortedTransactions: g
608
+ } = De(), { selectedDateRange: v, setSelectedDateRange: E } = Ce(), { isInitialized: I, selectedAccounts: x, setSelectedAccounts: M } = ye(), { trends: k } = O(), [A, G] = c.useState(!1), [ee, ne] = c.useState(!1), [H, he] = c.useState("Chart"), [B, se] = c.useState(""), [ae, $] = c.useState(window.innerHeight), U = ae - (l ? 315 : 345);
609
+ c.useEffect(() => {
610
+ const D = () => $(window.innerHeight);
611
+ return window.addEventListener("resize", D), m || h().finally(), d || f().finally(), C || b().finally(), () => window.removeEventListener("resize", D);
612
+ }, []), c.useEffect(() => {
613
+ M(i);
614
+ }, [i]), c.useEffect(() => {
615
+ I && p(
616
+ x,
617
+ v.start,
618
+ v.end
245
619
  ).finally(() => {
246
- D(!0);
620
+ G(!0);
247
621
  });
248
- }, [a, y, g]);
249
- const F = i.useMemo(() => {
250
- if (!w) return { stackedDatasets: [], unstackedDatasets: [] };
251
- const S = tt(
252
- c,
253
- g.start,
254
- g.end
255
- ), W = I.length ? S.filter(
256
- (V) => V.top_level_category_guid === I || V.category_guid === I
257
- ) : rt(S);
622
+ }, [I, x, v]);
623
+ const K = c.useMemo(() => {
624
+ if (!A) return { stackedDatasets: [], unstackedDatasets: [] };
625
+ const D = Lt(
626
+ _,
627
+ v.start,
628
+ v.end
629
+ ), r = B.length ? D.filter(
630
+ (T) => T.top_level_category_guid === B || T.category_guid === B
631
+ ) : Mt(D);
258
632
  return {
259
- stackedDatasets: W.filter(at),
260
- unstackedDatasets: W.filter(it)
633
+ stackedDatasets: r.filter(Rt),
634
+ unstackedDatasets: r.filter(At)
261
635
  };
262
- }, [c, I, g]), de = (S, W) => {
263
- N(W ?? k), n(_.TRENDS_CLICK_TOGGLE_VIEW);
264
- }, K = (S) => {
265
- const W = ve(S?.[0], 1), V = S?.[1], ge = pe(V, W);
266
- T({ start: W, end: V }), n(_.TRENDS_CLICK_TIME_WINDOW, {
267
- time_period: ge + "M"
636
+ }, [_, B, v]), re = (D, r) => {
637
+ he(r ?? H), t(w.TRENDS_CLICK_TOGGLE_VIEW);
638
+ }, X = (D) => {
639
+ const r = Fe(D?.[0], 1), T = D?.[1], L = Ae(T, r);
640
+ E({ start: r, end: T }), t(w.TRENDS_CLICK_TIME_WINDOW, {
641
+ time_period: L + "M"
268
642
  });
269
- }, he = () => {
270
- n(_.TRENDS_CLICK_FILTER);
271
- }, j = (S) => {
272
- te(S);
273
- }, oe = (S) => {
274
- te(S), n(_.TRENDS_CLICK_LEGEND, { category: u(S) });
275
- }, ue = (S) => {
276
- n(_.TRENDS_HOVER_LEGEND, { category: u(S) });
277
- }, se = (S) => {
278
- n(_.TRENDS_HOVER_AREA, { category: S });
279
- }, re = (S) => {
280
- n(_.TRENDS_HOVER_POINT, { category: S });
643
+ }, Z = () => {
644
+ t(w.TRENDS_CLICK_FILTER);
645
+ }, te = (D) => {
646
+ se(D);
647
+ }, ie = (D) => {
648
+ se(D), t(w.TRENDS_CLICK_LEGEND, { category: u(D) });
649
+ }, ge = (D) => {
650
+ t(w.TRENDS_HOVER_LEGEND, { category: u(D) });
651
+ }, ce = (D) => {
652
+ t(w.TRENDS_HOVER_AREA, { category: D });
653
+ }, le = (D) => {
654
+ t(w.TRENDS_HOVER_POINT, { category: D });
281
655
  };
282
- return !m || !a || !w ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ C(
283
- ke,
656
+ return !I || !A ? /* @__PURE__ */ e(fe, {}) : /* @__PURE__ */ y(
657
+ Ue,
284
658
  {
285
- accountOptions: d,
286
- calendarActions: { onRangeChanged: K },
287
- dateRange: g,
659
+ accountOptions: i,
660
+ calendarActions: { onRangeChanged: X },
661
+ dateRange: v,
288
662
  dateRangeVariant: "timeframebuttons",
289
- onAccountsFilterClick: he,
290
- onBackClick: t,
291
- sx: o,
292
- title: E.title,
663
+ onAccountsFilterClick: Z,
664
+ onBackClick: o,
665
+ sx: a,
666
+ title: k.title,
293
667
  children: [
294
- /* @__PURE__ */ C(
295
- b,
668
+ /* @__PURE__ */ y(
669
+ S,
296
670
  {
297
671
  sx: {
298
672
  // eslint-disable-next-line no-nested-ternary
299
- px: s ? 48 : r ? 24 : 12
673
+ px: n ? 48 : s ? 24 : 12
300
674
  },
301
675
  children: [
302
- /* @__PURE__ */ C(
303
- b,
676
+ /* @__PURE__ */ y(
677
+ S,
304
678
  {
305
679
  flexDirection: "row",
306
680
  justifyContent: "space-between",
307
681
  sx: { pb: l ? 12 : 24, pt: l ? 24 : 48 },
308
682
  children: [
309
683
  /* @__PURE__ */ e(
310
- Ge,
684
+ Je,
311
685
  {
312
- selectedCategoryGuid: I,
313
- selectedDateRange: g
686
+ selectedCategoryGuid: B,
687
+ selectedDateRange: v
314
688
  }
315
689
  ),
316
- /* @__PURE__ */ e(Ve, { onTabChange: de, selectedTab: k })
690
+ /* @__PURE__ */ e(Qe, { onTabChange: re, selectedTab: H })
317
691
  ]
318
692
  }
319
693
  ),
320
- /* @__PURE__ */ C(b, { alignItems: "center", flexDirection: "row", width: "100%", children: [
321
- /* @__PURE__ */ e(O, { flexGrow: 1, children: I && /* @__PURE__ */ C(me, { onClick: () => te(""), sx: { p: 0, pr: 5 }, children: [
322
- /* @__PURE__ */ e(ae, { name: "arrow_back" }),
323
- E.all_categories
694
+ /* @__PURE__ */ y(S, { alignItems: "center", flexDirection: "row", width: "100%", children: [
695
+ /* @__PURE__ */ e(W, { flexGrow: 1, children: B && /* @__PURE__ */ y(xe, { onClick: () => se(""), sx: { p: 0, pr: 5 }, children: [
696
+ /* @__PURE__ */ e(Se, { name: "arrow_back" }),
697
+ k.all_categories
324
698
  ] }) }),
325
- /* @__PURE__ */ e(me, { onClick: () => v(!0), sx: { px: 5 }, children: `${E.view_transactions} (${f.length})` })
699
+ /* @__PURE__ */ e(xe, { onClick: () => ne(!0), sx: { px: 5 }, children: `${k.view_transactions} (${g.length})` })
326
700
  ] }),
327
- /* @__PURE__ */ C(O, { children: [
328
- k === "Chart" && /* @__PURE__ */ e(
329
- nt,
701
+ /* @__PURE__ */ y(W, { children: [
702
+ H === "Chart" && /* @__PURE__ */ e(
703
+ lo,
330
704
  {
331
- availableHeight: le,
332
- onClickLegend: oe,
333
- onHoverArea: se,
334
- onHoverLegend: ue,
335
- onHoverPoint: re,
336
- stackedDatasets: F.stackedDatasets,
337
- unstackedDatasets: F.unstackedDatasets
705
+ availableHeight: U,
706
+ onClickLegend: ie,
707
+ onHoverArea: ce,
708
+ onHoverLegend: ge,
709
+ onHoverPoint: le,
710
+ stackedDatasets: K.stackedDatasets,
711
+ unstackedDatasets: K.unstackedDatasets
338
712
  }
339
713
  ),
340
- k === "Table" && /* @__PURE__ */ e(
341
- Be,
714
+ H === "Table" && /* @__PURE__ */ e(
715
+ et,
342
716
  {
343
- monthlyCategoryTotals: c,
344
- onClickRow: j,
345
- selectedCategory: I,
346
- selectedDateRange: g
717
+ monthlyCategoryTotals: _,
718
+ onClickRow: te,
719
+ selectedCategory: B,
720
+ selectedDateRange: v
347
721
  }
348
722
  )
349
723
  ] })
@@ -351,27 +725,27 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
351
725
  }
352
726
  ),
353
727
  /* @__PURE__ */ e(
354
- Xt,
728
+ yo,
355
729
  {
356
- categoryGuid: I,
357
- dateRange: g,
358
- isOpen: R,
359
- onClose: () => v(!1)
730
+ categoryGuid: B,
731
+ dateRange: v,
732
+ isOpen: ee,
733
+ onClose: () => ne(!1)
360
734
  }
361
735
  )
362
736
  ]
363
737
  }
364
738
  );
365
- }, lo = x(Zt), qt = () => {
366
- const t = We(), { monthlyCategoryTotals: o } = P(), { trends: n } = A(), s = ct(o);
739
+ }, Nn = R(Co), _o = () => {
740
+ const { monthlyCategoryTotals: o } = Y(), { trends: a } = O(), t = ue(), { availableHeight: n = 300 } = ze(), s = kt(o);
367
741
  return /* @__PURE__ */ e(
368
- ye,
742
+ Ne,
369
743
  {
370
744
  baseline: "min",
371
745
  colors: [t.palette.primary.main],
372
746
  datasets: [s],
373
- height: 300,
374
- labels: [n.spending_label],
747
+ height: n,
748
+ labels: [a.spending_label],
375
749
  showArea: !0,
376
750
  showAverage: !0,
377
751
  showLegend: !0,
@@ -380,37 +754,40 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
380
754
  valueFormatterString: "0,0"
381
755
  }
382
756
  );
383
- }, Qt = x(qt), Jt = ({ onPrimaryCtaClick: t, sx: o }) => {
384
- const { visibleAccounts: n } = ce(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: r } = P(), { isInitialized: l } = Te(), { trends: d } = A(), { isCopyLoaded: h, selectedAccounts: c, setSelectedAccounts: u } = J();
385
- return i.useEffect(() => {
386
- u(n);
387
- }, [n]), i.useEffect(() => {
388
- l && s(c).finally();
389
- }, [l, c]), !h || !l ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ e(
390
- yt,
757
+ }, To = R(_o), bo = ({ onPrimaryCtaClick: o, sx: a }) => {
758
+ const { isAccountDataLoaded: t, loadAccountData: n, visibleAccounts: s } = Le(), { loadMonthlyCategoryTotals: l, monthlyTotalsLoaded: m } = Y(), { isInitialized: h } = He(), { trends: i } = O(), { selectedAccounts: d, setSelectedAccounts: f } = ye();
759
+ return c.useEffect(() => {
760
+ t || n().finally();
761
+ }, []), c.useEffect(() => {
762
+ f(s);
763
+ }, [s]), c.useEffect(() => {
764
+ h && l(d).finally();
765
+ }, [h, d]), h ? /* @__PURE__ */ e(
766
+ Gt,
391
767
  {
392
- onPrimaryCtaClick: t,
393
- primaryCtaLabel: d.primary_cta,
394
- subTitle: d.sub_title,
395
- sx: o,
396
- title: d.mini_title,
397
- children: r ? /* @__PURE__ */ e(Qt, {}) : /* @__PURE__ */ e(Q, {})
768
+ contentStyles: { height: "calc(100% - 72px)", ":last-child": { pb: 0 } },
769
+ onPrimaryCtaClick: o,
770
+ primaryCtaLabel: i.primary_cta,
771
+ subTitle: i.sub_title,
772
+ sx: { height: "100%", ...a },
773
+ title: i.mini_title,
774
+ children: m ? /* @__PURE__ */ e(To, {}) : /* @__PURE__ */ e(fe, {})
398
775
  }
399
- );
400
- }, ho = x(Jt), en = 70, Ee = ({
401
- title: t,
402
- totalAmount: o,
403
- transactionType: n,
404
- percentage: s,
405
- secondaryLabel: r,
776
+ ) : /* @__PURE__ */ e(fe, {});
777
+ }, Wn = R(bo), So = 70, Be = ({
778
+ title: o,
779
+ totalAmount: a,
780
+ transactionType: t,
781
+ percentage: n,
782
+ secondaryLabel: s,
406
783
  shouldDisplayPercentage: l
407
784
  }) => {
408
- const { availableWidth: d } = ht(), h = i.useRef(null), c = i.useRef(null), u = Et(Number(Math.abs(s)), {
785
+ const { availableWidth: m } = ze(), h = c.useRef(null), i = c.useRef(null), d = wt(Number(Math.abs(n)), {
409
786
  style: "percent",
410
787
  minimumIntegerDigits: 1
411
- }), f = d === 288 && X(o, "0,0.00").length > 10 ? X(o, "0,0") : X(o, "0,0.00"), g = n === "spending" ? s > 0 : s >= 0, T = n === "spending" ? "error.main" : "success.main", m = n === "spending" ? "success.main" : "text.secondary", a = h?.current, y = c?.current, p = a && y ? a.scrollWidth > y.clientWidth - en : !1;
412
- return /* @__PURE__ */ C(
413
- b,
788
+ }), f = m === 288 && oe(a, "0,0.00").length > 10 ? oe(a, "0,0") : oe(a, "0,0.00"), p = t === "spending" ? n > 0 : n >= 0, _ = t === "spending" ? "error.main" : "success.main", u = t === "spending" ? "success.main" : "text.secondary", C = h?.current, b = i?.current, g = C && b ? C.scrollWidth > b.clientWidth - So : !1;
789
+ return /* @__PURE__ */ y(
790
+ S,
414
791
  {
415
792
  sx: {
416
793
  border: 1,
@@ -422,8 +799,8 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
422
799
  py: 8
423
800
  },
424
801
  children: [
425
- /* @__PURE__ */ C(
426
- b,
802
+ /* @__PURE__ */ y(
803
+ S,
427
804
  {
428
805
  sx: {
429
806
  alignItems: "center",
@@ -431,28 +808,28 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
431
808
  justifyContent: "space-between"
432
809
  },
433
810
  children: [
434
- /* @__PURE__ */ e(U, { color: "text.secondary", variant: "caption", children: t }),
435
- l && /* @__PURE__ */ C(b, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
436
- g ? /* @__PURE__ */ e(bt, { size: 20, sx: { color: T } }) : /* @__PURE__ */ e(St, { size: 20, sx: { color: m } }),
811
+ /* @__PURE__ */ e(pe, { color: "text.secondary", variant: "caption", children: o }),
812
+ l && /* @__PURE__ */ y(S, { sx: { alignItems: "center", flexDirection: "row", gap: 4 }, children: [
813
+ p ? /* @__PURE__ */ e(Vt, { size: 20, sx: { color: _ } }) : /* @__PURE__ */ e(Pt, { size: 20, sx: { color: u } }),
437
814
  /* @__PURE__ */ e(
438
- U,
815
+ pe,
439
816
  {
440
817
  sx: {
441
- color: g ? T : m,
818
+ color: p ? _ : u,
442
819
  fontWeight: 600
443
820
  },
444
821
  variant: "body2",
445
- children: u
822
+ children: d
446
823
  }
447
824
  )
448
825
  ] })
449
826
  ]
450
827
  }
451
828
  ),
452
- /* @__PURE__ */ C(
453
- b,
829
+ /* @__PURE__ */ y(
830
+ S,
454
831
  {
455
- ref: c,
832
+ ref: i,
456
833
  sx: {
457
834
  alignItems: "center",
458
835
  flexDirection: "row",
@@ -460,19 +837,19 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
460
837
  },
461
838
  children: [
462
839
  /* @__PURE__ */ e(
463
- O,
840
+ W,
464
841
  {
465
842
  ref: h,
466
843
  sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
467
- children: /* @__PURE__ */ e(xe, { children: f })
844
+ children: /* @__PURE__ */ e(Pe, { children: f })
468
845
  }
469
846
  ),
470
- l && d >= 450 && !p && /* @__PURE__ */ e(
471
- U,
847
+ l && m >= 450 && !g && /* @__PURE__ */ e(
848
+ pe,
472
849
  {
473
- color: g ? T : m,
850
+ color: p ? _ : u,
474
851
  variant: "caption",
475
- children: r
852
+ children: s
476
853
  }
477
854
  )
478
855
  ]
@@ -481,50 +858,54 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
481
858
  ]
482
859
  }
483
860
  );
484
- }, tn = x(() => {
485
- const { trends: t } = A();
486
- return /* @__PURE__ */ C(b, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
487
- /* @__PURE__ */ e(wt, { size: 32 }),
488
- /* @__PURE__ */ C(b, { children: [
489
- /* @__PURE__ */ e(U, { fontWeight: 600, variant: "body1", children: t.zero_state_content_header }),
490
- /* @__PURE__ */ e(U, { color: "text.secondary", variant: "subtitle2", children: t.zero_state_content_description })
861
+ }, xo = R(() => {
862
+ const { trends: o } = O();
863
+ return /* @__PURE__ */ y(S, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
864
+ /* @__PURE__ */ e(Ft, { size: 32 }),
865
+ /* @__PURE__ */ y(S, { children: [
866
+ /* @__PURE__ */ e(pe, { fontWeight: 600, variant: "body1", children: o.zero_state_content_header }),
867
+ /* @__PURE__ */ e(pe, { color: "text.secondary", variant: "subtitle2", children: o.zero_state_content_description })
491
868
  ] })
492
869
  ] });
493
- }), uo = x(({ onCtaClick: t }) => {
494
- const { visibleAccounts: o } = ce(), { onEvent: n } = H(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: r, monthlyTotalsLoaded: l } = P(), d = {
495
- start: _t(/* @__PURE__ */ new Date(), 1),
870
+ }), On = R(({ onCtaClick: o }) => {
871
+ const { isAccountDataLoaded: a, loadAccountData: t, visibleAccounts: n } = Le();
872
+ c.useEffect(() => {
873
+ a || t().finally();
874
+ }, []);
875
+ const { onEvent: s } = P(), { monthlyCategoryTotals: l, loadMonthlyCategoryTotals: m, monthlyTotalsLoaded: h } = Y(), i = {
876
+ start: Bt(/* @__PURE__ */ new Date(), 1),
496
877
  end: /* @__PURE__ */ new Date()
497
- }, { trends: h } = A(), { selectedAccounts: c, setSelectedAccounts: u, isInitialized: f } = J();
498
- i.useEffect(() => {
499
- u(o);
500
- }, [o]), i.useEffect(() => {
501
- f && r(c, d.start).then(() => {
502
- n(_.TRENDS_LOAD_WIDGET, {
503
- state: o?.length ? "default" : "zeroState"
878
+ }, { trends: d } = O(), { selectedAccounts: f, setSelectedAccounts: p, isInitialized: _ } = ye();
879
+ c.useEffect(() => {
880
+ p(n);
881
+ }, [n]), c.useEffect(() => {
882
+ _ && m(f, i.start).then(() => {
883
+ s(w.TRENDS_LOAD_WIDGET, {
884
+ state: n?.length ? "default" : "zeroState"
504
885
  });
505
886
  });
506
- }, [f, c]);
507
- const { spendingData: g, incomeData: T } = i.useMemo(
887
+ }, [_, f]);
888
+ const { spendingData: u, incomeData: C } = c.useMemo(
508
889
  () => ({
509
- spendingData: Ae(s, d),
510
- incomeData: Re(s, d)
890
+ spendingData: Ye(l, i),
891
+ incomeData: je(l, i)
511
892
  }),
512
- [s, d]
513
- ), [m, a] = g, [y, p] = T, E = De(a.y, m.y), w = De(p.y, y.y), D = f && !o?.length, R = () => {
514
- n(
515
- D ? _.TRENDS_CLICK_GET_STARTED : _.TRENDS_CLICK_VIEW_MORE
516
- ), t();
893
+ [l, i]
894
+ ), [b, g] = u, [v, E] = C, I = Oe(g.y, b.y), x = Oe(E.y, v.y), M = _ && !n?.length, k = () => {
895
+ s(
896
+ M ? w.TRENDS_CLICK_GET_STARTED : w.TRENDS_CLICK_VIEW_MORE
897
+ ), o();
517
898
  };
518
- return !l || !f ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ e(
519
- Lt,
899
+ return !h || !_ ? /* @__PURE__ */ e(fe, {}) : /* @__PURE__ */ e(
900
+ jt,
520
901
  {
521
902
  className: "mx-trends-microwidget",
522
- ctaLabel: h.micro_primary_cta_label,
523
- onCTAClick: R,
524
- subHeader: D ? void 0 : h.micro_subheader,
525
- title: h.title,
526
- children: D ? /* @__PURE__ */ e(tn, {}) : /* @__PURE__ */ C(
527
- b,
903
+ ctaLabel: d.micro_primary_cta_label,
904
+ onCTAClick: k,
905
+ subHeader: M ? void 0 : d.micro_subheader,
906
+ title: d.title,
907
+ children: M ? /* @__PURE__ */ e(xo, {}) : /* @__PURE__ */ y(
908
+ S,
528
909
  {
529
910
  sx: {
530
911
  alignItems: "stretch",
@@ -533,24 +914,24 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
533
914
  },
534
915
  children: [
535
916
  /* @__PURE__ */ e(
536
- Ee,
917
+ Be,
537
918
  {
538
- percentage: E,
539
- secondaryLabel: h.micro_secondary_label,
540
- shouldDisplayPercentage: a.y !== 0 && m.y !== 0,
541
- title: h.spending_label,
542
- totalAmount: a.y,
919
+ percentage: I,
920
+ secondaryLabel: d.micro_secondary_label,
921
+ shouldDisplayPercentage: g.y !== 0 && b.y !== 0,
922
+ title: d.spending_label,
923
+ totalAmount: g.y,
543
924
  transactionType: "spending"
544
925
  }
545
926
  ),
546
927
  /* @__PURE__ */ e(
547
- Ee,
928
+ Be,
548
929
  {
549
- percentage: w,
550
- secondaryLabel: h.micro_secondary_label,
551
- shouldDisplayPercentage: p.y !== 0 && y.y !== 0,
552
- title: h.income_label,
553
- totalAmount: p.y,
930
+ percentage: x,
931
+ secondaryLabel: d.micro_secondary_label,
932
+ shouldDisplayPercentage: E.y !== 0 && v.y !== 0,
933
+ title: d.income_label,
934
+ totalAmount: E.y,
554
935
  transactionType: "income"
555
936
  }
556
937
  )
@@ -559,21 +940,21 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
559
940
  )
560
941
  }
561
942
  );
562
- }), nn = x(
563
- ({ isExpanded: t, onClick: o }) => {
564
- const n = Oe();
565
- return /* @__PURE__ */ e(Mt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(At, { onClick: o, sx: { justifyContent: "center" }, children: /* @__PURE__ */ C(
566
- b,
943
+ }), vo = R(
944
+ ({ isExpanded: o, onClick: a }) => {
945
+ const t = ue();
946
+ return /* @__PURE__ */ e(Xt, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Zt, { onClick: a, sx: { justifyContent: "center" }, children: /* @__PURE__ */ y(
947
+ S,
567
948
  {
568
- sx: { color: n.palette.primary.main, flexDirection: "row", alignItems: "center" },
949
+ sx: { color: t.palette.primary.main, flexDirection: "row", alignItems: "center" },
569
950
  children: [
570
- /* @__PURE__ */ e(kt, { children: /* @__PURE__ */ e(Z, { bold: !0, variant: "body2", children: t ? "View less" : "View more" }) }),
571
- /* @__PURE__ */ e(Rt, { sx: { color: n.palette.primary.main }, children: t ? /* @__PURE__ */ e(Dt, {}) : /* @__PURE__ */ e(
572
- It,
951
+ /* @__PURE__ */ e(Qt, { children: /* @__PURE__ */ e(z, { bold: !0, variant: "body2", children: o ? "View less" : "View more" }) }),
952
+ /* @__PURE__ */ e(qt, { sx: { color: t.palette.primary.main }, children: o ? /* @__PURE__ */ e(zt, {}) : /* @__PURE__ */ e(
953
+ $t,
573
954
  {
574
955
  sx: {
575
956
  transition: "transform 0.3s ease-in-out",
576
- transform: t ? "rotate(180deg)" : "rotate(0deg)"
957
+ transform: o ? "rotate(180deg)" : "rotate(0deg)"
577
958
  }
578
959
  }
579
960
  ) })
@@ -581,129 +962,128 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
581
962
  }
582
963
  ) }) });
583
964
  }
584
- ), Le = x(
965
+ ), Ve = R(
585
966
  ({
586
- totalAmount: t,
587
- guid: o,
588
- name: n,
589
- transactions: s,
590
- onClick: r,
967
+ totalAmount: o,
968
+ guid: a,
969
+ name: t,
970
+ transactions: n,
971
+ onClick: s,
591
972
  isLastItem: l = !1,
592
- showDivider: d = !0
973
+ showDivider: m = !0
593
974
  }) => {
594
- const { trends: h } = A(), { onEvent: c } = H(), u = `${s.length} ${s.length === 1 ? h.transaction : h.transactions}`, f = () => {
595
- r?.(), c(_.TRENDS_CLICK_LIST_ITEM, {
596
- ...M,
597
- listItem: n
975
+ const { trends: h } = O(), { onEvent: i } = P(), d = `${n.length} ${n.length === 1 ? h.transaction : h.transactions}`, f = () => {
976
+ s?.(), i(w.TRENDS_CLICK_LIST_ITEM, {
977
+ ...V,
978
+ listItem: t
598
979
  });
599
980
  };
600
- return /* @__PURE__ */ C(i.Fragment, { children: [
981
+ return /* @__PURE__ */ y(c.Fragment, { children: [
601
982
  /* @__PURE__ */ e(
602
- Me,
983
+ Ke,
603
984
  {
604
- leftIcon: o ? /* @__PURE__ */ e(fe, { categoryGuid: o }) : void 0,
985
+ leftIcon: a ? /* @__PURE__ */ e(we, { categoryGuid: a }) : void 0,
605
986
  onClick: f,
606
- rightContent: X(Math.abs(t), "0,0.00"),
607
- rightIcon: r ? /* @__PURE__ */ e(Je, {}) : void 0,
608
- subtitle: u,
609
- title: n
987
+ rightContent: oe(Math.abs(o), "0,0.00"),
988
+ rightIcon: s ? /* @__PURE__ */ e(Kt, {}) : void 0,
989
+ subtitle: d,
990
+ title: t
610
991
  }
611
992
  ),
612
- d && /* @__PURE__ */ e(Nt, { sx: { ml: l ? 24 : 68 } })
613
- ] }, o);
993
+ m && /* @__PURE__ */ e(Re, { sx: { ml: l ? 24 : 68 } })
994
+ ] }, a);
614
995
  }
615
- ), on = x(
616
- ({ availableHeight: t = 0, onCategoryClick: o }) => {
617
- const { collapsedCategories: n, visibleCategories: s, setVisibleListLength: r } = ee(), { isLargeDesktop: l, isDesktop: d } = $(), { trends: h } = A(), { onEvent: c } = H(), [u, f] = i.useState(!1), g = d || l;
618
- i.useEffect(() => {
619
- const a = Math.floor(t / 64) - 1, y = s.length + n.length;
620
- a !== s.length && (r(g ? Math.max(a, 5) : 5), f(a >= y));
621
- }, [t]);
622
- const T = () => {
623
- f(!u), c(_.TRENDS_CLICK_VIEW_MORE, {
624
- ...M
996
+ ), wo = R(
997
+ ({ availableHeight: o = 0, onCategoryClick: a }) => {
998
+ const { collapsedCategories: t, visibleCategories: n, setVisibleListLength: s } = Ce(), { isLargeDesktop: l, isDesktop: m } = J(), { trends: h } = O(), { onEvent: i } = P(), [d, f] = c.useState(!1), p = m || l;
999
+ c.useEffect(() => {
1000
+ const C = Math.floor(o / 64) - 1, b = n.length + t.length;
1001
+ C !== n.length && (s(p ? Math.max(C, 5) : 5), f(C >= b));
1002
+ }, [o]);
1003
+ const _ = () => {
1004
+ f(!d), i(w.TRENDS_CLICK_VIEW_MORE, {
1005
+ ...V
625
1006
  });
626
- }, m = s.length + (u ? n.length : 0);
627
- return /* @__PURE__ */ e(b, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ C(vt, { children: [
628
- /* @__PURE__ */ e(b, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(xe, { children: h.categories }) }),
629
- s.map((a, y) => /* @__PURE__ */ e(
630
- Le,
1007
+ }, u = n.length + (d ? t.length : 0);
1008
+ return /* @__PURE__ */ e(S, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ y(Ut, { children: [
1009
+ /* @__PURE__ */ e(S, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(Pe, { children: h.categories }) }),
1010
+ n.map((C, b) => /* @__PURE__ */ e(
1011
+ Ve,
631
1012
  {
632
- ...a,
633
- isLastItem: y === m - 1,
634
- onClick: a.transactions.length > 0 ? () => o(a) : void 0,
1013
+ ...C,
1014
+ isLastItem: b === u - 1,
1015
+ onClick: C.transactions.length > 0 ? () => a(C) : void 0,
635
1016
  showDivider: !0
636
1017
  },
637
- a.guid
1018
+ C.guid
638
1019
  )),
639
1020
  /* @__PURE__ */ e(
640
- xt,
1021
+ Yt,
641
1022
  {
642
- in: u,
1023
+ in: d,
643
1024
  sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
644
- children: n.map((a, y) => {
645
- const p = s.length + y;
1025
+ children: t.map((C, b) => {
1026
+ const g = n.length + b;
646
1027
  return /* @__PURE__ */ e(
647
- Le,
1028
+ Ve,
648
1029
  {
649
- ...a,
650
- isLastItem: p === m - 1,
651
- onClick: a.transactions.length > 0 ? () => o(a) : void 0,
1030
+ ...C,
1031
+ isLastItem: g === u - 1,
1032
+ onClick: C.transactions.length > 0 ? () => a(C) : void 0,
652
1033
  showDivider: !0
653
1034
  },
654
- a.guid
1035
+ C.guid
655
1036
  );
656
1037
  })
657
1038
  }
658
1039
  ),
659
- n.length > 0 && /* @__PURE__ */ e(nn, { isExpanded: u, onClick: T })
1040
+ t.length > 0 && /* @__PURE__ */ e(vo, { isExpanded: d, onClick: _ })
660
1041
  ] }) });
661
1042
  }
662
- ), sn = ({ beats: t, onInsightCardClick: o }) => {
663
- const n = Ht(), { onEvent: s } = H(), { isMobile: r, isDesktop: l, isLargeDesktop: d } = $(), { beatStore: h, endpoint: c, sessionToken: u } = Te(), f = n.palette.mode === "dark", g = l || d, T = g || r ? 1 : 2, m = () => null, a = (R) => {
664
- o?.(R), s(_.TRENDS_CLICK_INSIGHT, M);
665
- }, y = g ? 200 : 170, p = g ? 170 : 124, E = g ? 56 : 0, w = t.length > 0 ? y + E : p, D = g && t.length > 0 ? y : void 0;
666
- return /* @__PURE__ */ e(Wt, { sx: { height: w }, children: /* @__PURE__ */ e(
667
- ft,
1043
+ ), Do = ({ beats: o, onInsightCardClick: a }) => {
1044
+ const { onEvent: t } = P(), { isMobile: n, isDesktop: s, isLargeDesktop: l } = J(), { beatStore: m, endpoint: h, sessionToken: i } = He(), d = s || l, f = d || n ? 1 : 2, p = () => null, _ = (E) => {
1045
+ a?.(E), t(w.TRENDS_CLICK_INSIGHT, V);
1046
+ }, u = d ? 200 : 170, C = d ? 170 : 124, b = d ? 56 : 0, g = o.length > 0 ? u + b : C, v = d && o.length > 0 ? u : void 0;
1047
+ return /* @__PURE__ */ e(xt, { sx: { height: g }, children: /* @__PURE__ */ e(
1048
+ Ot,
668
1049
  {
669
- areBeatsLoading: h.isLoading,
670
- beats: t,
671
- endpoint: c,
672
- heightOverrides: D,
673
- logOutUser: m,
674
- onCardClick: a,
1050
+ areBeatsLoading: m.isLoading,
1051
+ beats: o,
1052
+ endpoint: h,
1053
+ heightOverrides: v,
1054
+ logOutUser: p,
1055
+ onCardClick: _,
675
1056
  showBorder: !0,
676
1057
  showCTAColocatedWithText: !1,
677
1058
  showCarouselControls: !0,
678
- showHeader: g,
1059
+ showHeader: d,
679
1060
  showIcon: !0,
680
1061
  showWithMargin: !1,
681
- token: u,
682
- useDarkMode: f,
1062
+ token: i,
683
1063
  userHasFullInsightFeedBeats: !1,
684
1064
  variant: "outlined",
685
- visibleCardsCount: T
1065
+ visibleCardsCount: f
686
1066
  }
687
1067
  ) });
688
- }, rn = x(sn), an = x(({ chartLabel: t, chartColor: o }) => {
689
- const { onEvent: n } = H(), {
690
- categoryDetailsChartData: { monthlyAmounts: s, tooltipLabels: r }
691
- } = ee();
692
- return /* @__PURE__ */ e(b, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
693
- ye,
1068
+ }, Lo = R(Do), Eo = R(({ chartLabel: o, chartColor: a }) => {
1069
+ const { onEvent: t } = P(), {
1070
+ categoryDetailsChartData: { monthlyAmounts: n, tooltipLabels: s }
1071
+ } = Ce();
1072
+ return /* @__PURE__ */ e(S, { sx: { pt: 12, width: "100%" }, children: /* @__PURE__ */ e(
1073
+ Ne,
694
1074
  {
695
1075
  baseline: "min",
696
- colors: [o],
1076
+ colors: [a],
697
1077
  curveType: "bump",
698
- customTooltipLabels: r,
699
- datasets: [s],
1078
+ customTooltipLabels: s,
1079
+ datasets: [n],
700
1080
  height: 265,
701
- labels: [t],
1081
+ labels: [o],
702
1082
  markStyles: () => ({
703
- stroke: o
1083
+ stroke: a
704
1084
  }),
705
1085
  onItemClick: () => {
706
- n(_.TRENDS_CLICK_CHART, M);
1086
+ t(w.TRENDS_CLICK_CHART, V);
707
1087
  },
708
1088
  showArea: !0,
709
1089
  showAverage: !0,
@@ -718,100 +1098,100 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
718
1098
  valueFormatterString: "0,0"
719
1099
  }
720
1100
  ) });
721
- }), cn = x(({ onClose: t }) => {
722
- const o = Oe(), { onEvent: n } = H(), { common: s, trends: r } = A(), { selectedCategoryData: l, selectedDateRangeMonthRange: d } = ee(), { sortedTransactions: h } = ie(), [c, u] = i.useState(null);
1101
+ }), Io = R(({ onClose: o }) => {
1102
+ const a = ue(), { onEvent: t } = P(), { common: n, trends: s } = O(), { selectedCategoryData: l, selectedDateRangeMonthRange: m } = Ce(), { sortedTransactions: h } = De(), [i, d] = c.useState(null);
723
1103
  if (!l)
724
1104
  return null;
725
- const { guid: f, name: g, is_income: T, totalAmount: m } = l, a = T ? r.category_income : r.category_spending, y = Vt(f, o), p = T ? r.income_label : r.spending_label, E = ` ${l.transactions.length === 1 ? r.transaction : r.transactions} (${l.transactions.length})`, w = i.useMemo(
726
- () => h.find((v) => v.guid === c),
727
- [c, h]
728
- ), D = (v) => v.category_guid === f || v.top_level_category_guid === f, R = () => {
729
- t?.(), n(_.TRENDS_CLICK_BACK, M);
1105
+ const { guid: f, name: p, is_income: _, totalAmount: u } = l, C = _ ? s.category_income : s.category_spending, b = eo(f, a), g = _ ? s.income_label : s.spending_label, v = ` ${l.transactions.length === 1 ? s.transaction : s.transactions} (${l.transactions.length})`, E = c.useMemo(
1106
+ () => h.find((M) => M.guid === i),
1107
+ [i, h]
1108
+ ), I = (M) => M.category_guid === f || M.top_level_category_guid === f, x = () => {
1109
+ o?.(), t(w.TRENDS_CLICK_BACK, V);
730
1110
  };
731
- return /* @__PURE__ */ C(
732
- Ce,
1111
+ return /* @__PURE__ */ y(
1112
+ ke,
733
1113
  {
734
- ariaLabelClose: r.close_category_details,
1114
+ ariaLabelClose: s.close_category_details,
735
1115
  isOpen: !0,
736
- onClose: R,
1116
+ onClose: x,
737
1117
  shouldShowHeaderShadow: !0,
738
- title: a,
1118
+ title: C,
739
1119
  children: [
740
- /* @__PURE__ */ C(b, { sx: { alignItems: "center", height: "100%" }, children: [
741
- /* @__PURE__ */ C(Ot, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
1120
+ /* @__PURE__ */ y(S, { sx: { alignItems: "center", height: "100%" }, children: [
1121
+ /* @__PURE__ */ y(Jt, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
742
1122
  /* @__PURE__ */ e(
743
- Me,
1123
+ Ke,
744
1124
  {
745
- leftIcon: /* @__PURE__ */ e(fe, { categoryGuid: f }),
746
- rightContent: X(Math.abs(m), "0,0.00"),
747
- subtitle: d,
748
- title: g
1125
+ leftIcon: /* @__PURE__ */ e(we, { categoryGuid: f }),
1126
+ rightContent: oe(Math.abs(u), "0,0.00"),
1127
+ subtitle: m,
1128
+ title: p
749
1129
  }
750
1130
  ),
751
- /* @__PURE__ */ e(an, { chartColor: y, chartLabel: p }),
752
- /* @__PURE__ */ C(b, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
753
- /* @__PURE__ */ e(Z, { bold: !0, variant: "body1", children: E }),
754
- /* @__PURE__ */ e(Gt, { filter: D })
1131
+ /* @__PURE__ */ e(Eo, { chartColor: b, chartLabel: g }),
1132
+ /* @__PURE__ */ y(S, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
1133
+ /* @__PURE__ */ e(z, { bold: !0, variant: "body1", children: v }),
1134
+ /* @__PURE__ */ e(to, { filter: I })
755
1135
  ] })
756
1136
  ] }),
757
1137
  /* @__PURE__ */ e(
758
- He,
1138
+ Ze,
759
1139
  {
760
1140
  bgcolor: "transparent",
761
- filter: D,
1141
+ filter: I,
762
1142
  height: "calc(100vh - 475px)",
763
- onClick: u
1143
+ onClick: d
764
1144
  }
765
1145
  )
766
1146
  ] }),
767
1147
  /* @__PURE__ */ e(
768
- Ce,
1148
+ ke,
769
1149
  {
770
- ariaLabelClose: s.close_aria,
771
- isOpen: !!w,
772
- onClose: () => u(""),
773
- title: r.transaction,
774
- children: w && /* @__PURE__ */ e(Ne, { transaction: w })
1150
+ ariaLabelClose: n.close_aria,
1151
+ isOpen: !!E,
1152
+ onClose: () => d(""),
1153
+ title: s.transaction,
1154
+ children: E && /* @__PURE__ */ e(Xe, { transaction: E })
775
1155
  }
776
1156
  )
777
1157
  ]
778
1158
  }
779
1159
  );
780
- }), ln = (t, o) => {
781
- const n = Re(t, o), s = Ae(t, o);
782
- return [n, s].filter((r) => r.length > 0);
783
- }, dn = (t, o) => {
784
- const [n, s] = t, r = n, l = s ?? n, d = [];
785
- if (r) {
786
- const h = r.reduce((c, u) => c + u.y, 0);
787
- d.push({ label: o.income_label, amount: h });
1160
+ }), Mo = (o, a) => {
1161
+ const t = je(o, a), n = Ye(o, a);
1162
+ return [t, n].filter((s) => s.length > 0);
1163
+ }, Ao = (o, a) => {
1164
+ const [t, n] = o, s = t, l = n ?? t, m = [];
1165
+ if (s) {
1166
+ const h = s.reduce((i, d) => i + d.y, 0);
1167
+ m.push({ label: a.income_label, amount: h });
788
1168
  }
789
1169
  if (l) {
790
- const h = l.reduce((c, u) => c + u.y, 0);
791
- d.push({ label: o.spending_label, amount: h });
1170
+ const h = l.reduce((i, d) => i + d.y, 0);
1171
+ m.push({ label: a.spending_label, amount: h });
792
1172
  }
793
- return d;
794
- }, hn = ({
795
- availableHeight: t = 0,
796
- minHeight: o = 500,
797
- selectedDateRange: n,
798
- totals: s
1173
+ return m;
1174
+ }, Ro = ({
1175
+ availableHeight: o = 0,
1176
+ minHeight: a = 500,
1177
+ selectedDateRange: t,
1178
+ totals: n
799
1179
  }) => {
800
- const r = We(), { onEvent: l } = H(), { trends: d } = A(), { isSmallMobile: h, isMobile: c, isSmallTablet: u, isTablet: f } = $(), g = [r.palette.chart?.chart1, r.palette.chart?.chart2], T = ln(s, n), m = dn(T, d), [a, y] = i.useState(0), p = 458, E = 195, w = 56, D = c || h ? E : u || f ? p : a;
801
- return i.useEffect(() => {
802
- const v = Math.max(t - w, o);
803
- y(v);
804
- }, [t]), /* @__PURE__ */ e(
805
- ye,
1180
+ const s = ue(), { onEvent: l } = P(), { trends: m } = O(), { isSmallMobile: h, isMobile: i, isSmallTablet: d, isTablet: f } = J(), p = [s.palette.chart?.chart1, s.palette.chart?.chart2], _ = Mo(n, t), u = Ao(_, m), [C, b] = c.useState(0), g = 458, v = 195, E = 56, I = i || h ? v : d || f ? g : C;
1181
+ return c.useEffect(() => {
1182
+ const M = Math.max(o - E, a);
1183
+ b(M);
1184
+ }, [o]), /* @__PURE__ */ e(
1185
+ Ne,
806
1186
  {
807
1187
  baseline: "min",
808
- colors: g,
1188
+ colors: p,
809
1189
  curveType: "bump",
810
- datasets: T,
811
- height: D,
812
- labels: m,
1190
+ datasets: _,
1191
+ height: I,
1192
+ labels: u,
813
1193
  onItemClick: () => {
814
- l(_.TRENDS_CLICK_CHART, M);
1194
+ l(w.TRENDS_CLICK_CHART, V);
815
1195
  },
816
1196
  showArea: !0,
817
1197
  showAxisHighlight: !0,
@@ -824,7 +1204,7 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
824
1204
  valueFormatterString: "0.0a"
825
1205
  }
826
1206
  );
827
- }, un = x(hn), gn = [
1207
+ }, ko = R(Ro), Ho = [
828
1208
  "BillAmountNotStandard",
829
1209
  "CategorySpendingV2",
830
1210
  "CostOfLivingToIncome",
@@ -858,192 +1238,188 @@ const Ve = ({ selectedTab: t, onTabChange: o }) => /* @__PURE__ */ e(
858
1238
  "WeeklyNewMerchantsV2",
859
1239
  "WeeklyNoSpendDays",
860
1240
  "WeeklySmallPurchasesSummary"
861
- ], mn = ({ onBackClick: t, onInsightCardClick: o, sx: n }) => {
862
- const { onEvent: s } = H(), { onLoad: r } = ut(), { config: l } = gt(), { isLargeDesktop: d, isDesktop: h, isMobile: c } = $(), { visibleAccounts: u } = ce(), { loadDateRangeCategoryTotals: f, loadMonthlyCategoryTotals: g, monthlyCategoryTotals: T } = P(), { setFilter: m } = ie(), { selectedDateRange: a, setSelectedCategoryData: y, setSelectedDateRange: p } = ee(), {
863
- isCopyLoaded: E,
864
- isInitialized: w,
865
- selectedAccounts: D,
866
- selectedAccountGuids: R,
867
- setSelectedAccounts: v
868
- } = J(), { trends: k, connect: N } = A(), { beatStore: I } = Te(), ne = Bt() && l.show_insights_widget_in_master, B = h || d, [_e, le] = i.useState(!1), [F, de] = i.useState(!1), [K, he] = i.useState("Chart"), [j, oe] = i.useState(""), [ue, se] = i.useState(!1), [re, S] = i.useState(window.innerHeight), W = B ? 56 : 0, V = re - 208, ge = re - (ne ? 550 + W : 266), [ze, be] = i.useState(!1), Pe = l.show_connections_widget_in_master ? "buttons" : "no-buttons", Se = i.useMemo(
869
- () => u && u.length === 0 || T.length === 0,
870
- [u, T]
871
- );
872
- i.useEffect(() => {
873
- w && I.loadBeats().finally(() => de(!0));
874
- }, [w]);
875
- const we = i.useMemo(() => F ? I.getFilteredBeats({ templates: gn }) : [], [F]);
876
- i.useEffect(() => {
877
- const L = () => S(window.innerHeight);
878
- return window.addEventListener("resize", L), () => window.removeEventListener("resize", L);
879
- }, []), i.useEffect(() => {
880
- v(u);
881
- }, [u]), i.useEffect(() => {
882
- w && f(D, a.start, a.end).then(() => {
883
- g(
884
- D,
885
- a.start,
886
- a.end
1241
+ ], No = ({ onBackClick: o, onInsightCardClick: a, sx: t }) => {
1242
+ const { onEvent: n } = P(), { onLoad: s } = yt(), { config: l } = Ct(), { isLargeDesktop: m, isDesktop: h, isMobile: i } = J(), { isAccountDataLoaded: d, loadAccountData: f, visibleAccounts: p } = Le(), {
1243
+ categoriesLoaded: _,
1244
+ loadCategories: u,
1245
+ loadDateRangeCategoryTotals: C,
1246
+ loadMonthlyCategoryTotals: b,
1247
+ monthlyCategoryTotals: g
1248
+ } = Y(), { isTransactionDataLoaded: v, loadTransactionData: E, setFilter: I } = De(), { selectedDateRange: x, setSelectedCategoryData: M, setSelectedDateRange: k } = Ce(), { isInitialized: A, selectedAccounts: G, selectedAccountGuids: ee, setSelectedAccounts: ne } = ye(), { trends: H, connect: he } = O(), { beatStore: B } = He(), ae = oo() && l.show_insights_widget_in_master, $ = h || m, [_e, U] = c.useState(!1), [K, re] = c.useState(!1), [X, Z] = c.useState("Chart"), [te, ie] = c.useState(""), [ge, ce] = c.useState(!1), [le, D] = c.useState(window.innerHeight), r = $ ? 56 : 0, T = le - 208, L = le - (ae ? 550 + r : 266), [j, Te] = c.useState(!1), Ee = l.show_connections_widget_in_master ? "buttons" : "no-buttons", de = c.useMemo(
1249
+ () => p && p.length === 0 || g.length === 0,
1250
+ [p, g]
1251
+ ), be = c.useMemo(() => K ? B.getFilteredBeats({ templates: Ho }) : [], [K]);
1252
+ c.useEffect(() => {
1253
+ const N = () => D(window.innerHeight);
1254
+ return window.addEventListener("resize", N), d || f().finally(), _ || u().finally(), v || E().finally(), () => window.removeEventListener("resize", N);
1255
+ }, []), c.useEffect(() => {
1256
+ ne(p);
1257
+ }, [p]), c.useEffect(() => {
1258
+ A && (B.loadBeats().finally(() => re(!0)), C(G, x.start, x.end).then(() => {
1259
+ b(
1260
+ G,
1261
+ x.start,
1262
+ x.end
887
1263
  );
888
1264
  }).finally(() => {
889
- le(!0), s(_.TRENDS_LOAD_WIDGET, {
890
- ...M,
891
- time_period: `${pe(a.end, a.start)}M`
892
- }), r?.("TrendsWidget");
893
- });
894
- }, [w, D, a]), i.useEffect(() => {
895
- if (T.length !== 0) {
896
- const L = {
897
- accounts: R,
898
- dateRange: { start: a.start, end: a.end }
1265
+ U(!0), n(w.TRENDS_LOAD_WIDGET, {
1266
+ ...V,
1267
+ time_period: `${Ae(x.end, x.start)}M`
1268
+ }), s?.("TrendsWidget");
1269
+ }));
1270
+ }, [A, G, x]), c.useEffect(() => {
1271
+ if (g.length !== 0) {
1272
+ const N = {
1273
+ accounts: ee,
1274
+ dateRange: { start: x.start, end: x.end }
899
1275
  };
900
- m({
901
- ...L,
902
- custom: (G) => !!T.find(
903
- (Y) => Y.top_level_category_guid === G.top_level_category_guid || Y.category_guid === G.category_guid
1276
+ I({
1277
+ ...N,
1278
+ custom: (q) => !!g.find(
1279
+ (me) => me.top_level_category_guid === q.top_level_category_guid || me.category_guid === q.category_guid
904
1280
  )
905
1281
  });
906
1282
  }
907
- }, [T]);
908
- const Fe = (L) => {
909
- y(L), se(!0);
910
- }, Ke = () => {
911
- y(null), se(!1);
912
- }, $e = () => {
913
- be(!0), s(_.TRENDS_CLICK_CONNECT_ACCOUNTS);
914
- }, je = (L, G) => {
915
- he(G ?? K), s(_.TRENDS_CLICK_TOGGLE_VIEW, {
916
- ...M,
917
- toggleView: G
1283
+ }, [g]);
1284
+ const Ie = (N) => {
1285
+ M(N), ce(!0);
1286
+ }, tt = () => {
1287
+ M(null), ce(!1);
1288
+ }, ot = () => {
1289
+ Te(!0), n(w.TRENDS_CLICK_CONNECT_ACCOUNTS);
1290
+ }, nt = (N, q) => {
1291
+ Z(q ?? X), n(w.TRENDS_CLICK_TOGGLE_VIEW, {
1292
+ ...V,
1293
+ toggleView: q
918
1294
  });
919
- }, Ye = (L) => {
920
- const G = ve(L?.[0], 1), Y = L?.[1], qe = pe(Y, G);
921
- p({ start: G, end: Y }), s(_.TRENDS_CLICK_TIME_WINDOW, {
922
- ...M,
923
- time_period: qe + "M"
1295
+ }, st = (N) => {
1296
+ const q = Fe(N?.[0], 1), me = N?.[1], ct = Ae(me, q);
1297
+ k({ start: q, end: me }), n(w.TRENDS_CLICK_TIME_WINDOW, {
1298
+ ...V,
1299
+ time_period: ct + "M"
924
1300
  });
925
- }, Ue = (L) => {
926
- s(_.TRENDS_CLICK_FILTER, {
927
- ...M,
928
- filterValue: L
1301
+ }, at = (N) => {
1302
+ n(w.TRENDS_CLICK_FILTER, {
1303
+ ...V,
1304
+ filterValue: N
929
1305
  });
930
- }, Xe = (L) => {
931
- oe(L);
932
- }, Ze = () => {
933
- oe(""), s(_.TRENDS_CLICK_ALL_CATEGORIES, M);
1306
+ }, rt = (N) => {
1307
+ ie(N);
1308
+ }, it = () => {
1309
+ ie(""), n(w.TRENDS_CLICK_ALL_CATEGORIES, V);
934
1310
  };
935
- return !E || !_e ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ C(
936
- ke,
1311
+ return !A || !_e ? /* @__PURE__ */ e(fe, {}) : /* @__PURE__ */ y(
1312
+ Ue,
937
1313
  {
938
- accountOptions: u,
939
- calendarActions: { onRangeChanged: Ye },
940
- dateRange: a,
941
- dateRangeVariant: c ? "timeframetabs" : "timeframebuttons",
942
- onAccountsFilterClick: Ue,
943
- onBackClick: t,
944
- sx: n,
945
- title: k.title,
1314
+ accountOptions: p,
1315
+ calendarActions: { onRangeChanged: st },
1316
+ dateRange: x,
1317
+ dateRangeVariant: i ? "timeframetabs" : "timeframebuttons",
1318
+ onAccountsFilterClick: at,
1319
+ onBackClick: o,
1320
+ sx: t,
1321
+ title: H.title,
946
1322
  children: [
947
- Se && /* @__PURE__ */ e(
948
- zt,
1323
+ de && /* @__PURE__ */ e(
1324
+ no,
949
1325
  {
950
- header: k.zero_state_content_header,
1326
+ header: H.zero_state_content_header,
951
1327
  icon: "",
952
- onClick: $e,
953
- primaryButton: k.empty_state_primary,
954
- subText: k.empty_state_sub_text,
955
- sx: { height: V },
956
- variant: Pe
1328
+ onClick: ot,
1329
+ primaryButton: H.empty_state_primary,
1330
+ subText: H.empty_state_sub_text,
1331
+ sx: { height: T },
1332
+ variant: Ee
957
1333
  }
958
1334
  ),
959
- !Se && /* @__PURE__ */ C(
960
- b,
1335
+ !de && /* @__PURE__ */ y(
1336
+ S,
961
1337
  {
962
1338
  sx: {
963
- px: c ? 0 : 48
1339
+ px: i ? 0 : 48
964
1340
  },
965
1341
  children: [
966
- /* @__PURE__ */ C(
967
- b,
1342
+ /* @__PURE__ */ y(
1343
+ S,
968
1344
  {
969
1345
  flexDirection: "row",
970
1346
  justifyContent: "space-between",
971
- sx: { pb: c ? 12 : 24, pt: c ? 24 : 48 },
1347
+ sx: { pb: i ? 12 : 24, pt: i ? 24 : 48 },
972
1348
  children: [
973
1349
  /* @__PURE__ */ e(
974
- Ge,
1350
+ Je,
975
1351
  {
976
- selectedCategoryGuid: j,
977
- selectedDateRange: a
1352
+ selectedCategoryGuid: te,
1353
+ selectedDateRange: x
978
1354
  }
979
1355
  ),
980
- /* @__PURE__ */ e(Ve, { onTabChange: je, selectedTab: K })
1356
+ /* @__PURE__ */ e(Qe, { onTabChange: nt, selectedTab: X })
981
1357
  ]
982
1358
  }
983
1359
  ),
984
- /* @__PURE__ */ e(b, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(O, { flexGrow: 1, children: j && /* @__PURE__ */ C(me, { onClick: Ze, sx: { p: 0, pr: 5 }, children: [
985
- /* @__PURE__ */ e(ae, { name: "arrow_back" }),
986
- k.all_categories
1360
+ /* @__PURE__ */ e(S, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(W, { flexGrow: 1, children: te && /* @__PURE__ */ y(xe, { onClick: it, sx: { p: 0, pr: 5 }, children: [
1361
+ /* @__PURE__ */ e(Se, { name: "arrow_back" }),
1362
+ H.all_categories
987
1363
  ] }) }) }),
988
- /* @__PURE__ */ C(b, { flexDirection: B ? "row" : "column", gap: B ? 48 : 16, children: [
989
- K === "Chart" && /* @__PURE__ */ C(Qe, { children: [
990
- /* @__PURE__ */ e(O, { sx: { width: B ? "68%" : "100%" }, children: /* @__PURE__ */ e(
991
- un,
1364
+ /* @__PURE__ */ y(S, { flexDirection: $ ? "row" : "column", gap: $ ? 48 : 16, children: [
1365
+ X === "Chart" && /* @__PURE__ */ y(lt, { children: [
1366
+ /* @__PURE__ */ e(W, { sx: { width: $ ? "68%" : "100%" }, children: /* @__PURE__ */ e(
1367
+ ko,
992
1368
  {
993
- availableHeight: V,
1369
+ availableHeight: T,
994
1370
  minHeight: 450,
995
- selectedDateRange: a,
996
- totals: T
1371
+ selectedDateRange: x,
1372
+ totals: g
997
1373
  }
998
1374
  ) }),
999
- /* @__PURE__ */ C(b, { gap: 16, sx: { width: B ? "32%" : "100%" }, children: [
1000
- ne && F && we.length > 0 && /* @__PURE__ */ e(
1001
- rn,
1375
+ /* @__PURE__ */ y(S, { gap: 16, sx: { width: $ ? "32%" : "100%" }, children: [
1376
+ ae && K && be.length > 0 && /* @__PURE__ */ e(
1377
+ Lo,
1002
1378
  {
1003
- beats: we,
1004
- onInsightCardClick: o
1379
+ beats: be,
1380
+ onInsightCardClick: a
1005
1381
  }
1006
1382
  ),
1007
1383
  /* @__PURE__ */ e(
1008
- on,
1384
+ wo,
1009
1385
  {
1010
- availableHeight: ge,
1011
- onCategoryClick: Fe
1386
+ availableHeight: L,
1387
+ onCategoryClick: Ie
1012
1388
  }
1013
1389
  )
1014
1390
  ] })
1015
1391
  ] }),
1016
- K === "Table" && /* @__PURE__ */ e(O, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1017
- Be,
1392
+ X === "Table" && /* @__PURE__ */ e(W, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1393
+ et,
1018
1394
  {
1019
1395
  height: "unset",
1020
- monthlyCategoryTotals: T,
1021
- onClickRow: Xe,
1022
- selectedCategory: j,
1023
- selectedDateRange: a
1396
+ monthlyCategoryTotals: g,
1397
+ onClickRow: rt,
1398
+ selectedCategory: te,
1399
+ selectedDateRange: x
1024
1400
  }
1025
1401
  ) })
1026
1402
  ] }),
1027
- ue && /* @__PURE__ */ e(cn, { onClose: Ke })
1403
+ ge && /* @__PURE__ */ e(Io, { onClose: tt })
1028
1404
  ]
1029
1405
  }
1030
1406
  ),
1031
1407
  /* @__PURE__ */ e(
1032
- Pt,
1408
+ so,
1033
1409
  {
1034
- onClose: () => be(!1),
1035
- showConnectWidget: ze,
1036
- title: N.mini_title
1410
+ onClose: () => Te(!1),
1411
+ showConnectWidget: j,
1412
+ title: he.mini_title
1037
1413
  }
1038
1414
  )
1039
1415
  ]
1040
1416
  }
1041
1417
  );
1042
- }, go = x(mn);
1418
+ }, Gn = R(No);
1043
1419
  export {
1044
- lo as TrendsFullWidget,
1045
- uo as TrendsMicroWidget,
1046
- ho as TrendsMiniWidget,
1047
- Co as TrendsStore,
1048
- go as TrendsWidget
1420
+ Nn as TrendsFullWidget,
1421
+ On as TrendsMicroWidget,
1422
+ Wn as TrendsMiniWidget,
1423
+ Pn as TrendsStore,
1424
+ Gn as TrendsWidget
1049
1425
  };