@mx-cartographer/experiences 6.26.18-alpha.mega4 → 6.26.18-alpha.sms2

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 (98) hide show
  1. package/dist/budgets/index.d.ts +1 -0
  2. package/dist/common/context/hooks.d.ts +13 -13
  3. package/dist/help/components/content/section/index.d.ts +15 -15
  4. package/dist/index.d.ts +22 -0
  5. package/dist/index.es.js +30336 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/package.json +3 -155
  8. package/dist/Account-DM32_5k9.mjs +0 -30
  9. package/dist/AccountDetailsContent-B_qRSB8l.mjs +0 -677
  10. package/dist/AccountDetailsHeader-CAm6ADMq.mjs +0 -119
  11. package/dist/AccountFields-Bb4pds0q.mjs +0 -135
  12. package/dist/AccountListItem-G7iAesaO.mjs +0 -90
  13. package/dist/AccountStore-RSanus_m.mjs +0 -230
  14. package/dist/Accounts-BfAQRG8R.mjs +0 -9
  15. package/dist/BeatApi-DLu87ijw.mjs +0 -21
  16. package/dist/BeatStore-By4aGoRM.mjs +0 -81
  17. package/dist/BudgetUtil-DcqclhiQ.mjs +0 -101
  18. package/dist/CashflowStore-D9Dpuz7X.mjs +0 -91
  19. package/dist/Category-5S6uwuXz.mjs +0 -301
  20. package/dist/CategorySelectorDrawer-DgrePTRg.mjs +0 -397
  21. package/dist/CategoryStore-B5EW6I1d.mjs +0 -183
  22. package/dist/CategoryUtil-DRyruNgi.mjs +0 -78
  23. package/dist/ConnectDrawer-DPnfeIfn.mjs +0 -508
  24. package/dist/ConnectionsDrawer-BCzpuNsK.mjs +0 -52
  25. package/dist/CurrencyInput-DzsPiUsU.mjs +0 -83
  26. package/dist/CurrencyText-YUhH2caW.mjs +0 -20
  27. package/dist/DateUtil-BcuH7ErC.mjs +0 -48
  28. package/dist/DebtsStore-C6VcBnpG.mjs +0 -60
  29. package/dist/Dialog-CWW597AF.mjs +0 -123
  30. package/dist/Donut-1UMNcG67.mjs +0 -57
  31. package/dist/Drawer-kEE73B87.mjs +0 -113
  32. package/dist/EmptyState-Dcb-o2tl.mjs +0 -55
  33. package/dist/Fetch-CkFKy79O.mjs +0 -116
  34. package/dist/FinstrongStore-mkALvztw.mjs +0 -101
  35. package/dist/GoalStore-DyCr4wNc.mjs +0 -263
  36. package/dist/HeaderCell-DjuifqHJ.mjs +0 -6
  37. package/dist/Help-DhcC-C05.mjs +0 -320
  38. package/dist/Help-toqAK5eD.mjs +0 -3173
  39. package/dist/IconBacking-B9oC6uL2.mjs +0 -39
  40. package/dist/InvestmentUtil-jOyOgzIB.mjs +0 -134
  41. package/dist/LineChart-CQWu5KoO.mjs +0 -403
  42. package/dist/ListItemAction-Df3OPMOW.mjs +0 -69
  43. package/dist/Loader-Dp1P2gNw.mjs +0 -14
  44. package/dist/Localization-2MODESHW.mjs +0 -30
  45. package/dist/ManageIncome-BVt_XQbo.mjs +0 -535
  46. package/dist/MerchantStore-DVH-QOf0.mjs +0 -37
  47. package/dist/MicroWidgetContainer-DaLW43tE.mjs +0 -45
  48. package/dist/MiniWidgetContainer-BcNPxZt2.mjs +0 -39
  49. package/dist/NetWorthStore-DE8CQBMM.mjs +0 -150
  50. package/dist/Notification-AMGWM1Al.mjs +0 -78
  51. package/dist/NotificationSettings-CPZN0l8X.mjs +0 -667
  52. package/dist/NotificationStore-DHtSGySy.mjs +0 -67
  53. package/dist/NumberFormatting-CtWHhyBX.mjs +0 -40
  54. package/dist/OriginalBalanceAction-s9sUxofR.mjs +0 -115
  55. package/dist/RecurringSettings-DIEsympT.mjs +0 -57
  56. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +0 -263
  57. package/dist/RepeatingTransaction-BPWfaB3f.mjs +0 -282
  58. package/dist/SearchBox-B2_zLv8-.mjs +0 -42
  59. package/dist/SettingsStore-CE7jDVFL.mjs +0 -265
  60. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +0 -69
  61. package/dist/SpendingData-ByFCw95X.mjs +0 -53
  62. package/dist/StatusBar-BK_uYHAB.mjs +0 -30
  63. package/dist/TabContentContainer-j01JYR_7.mjs +0 -21
  64. package/dist/Transaction-C-5-Iuab.mjs +0 -312
  65. package/dist/TransactionApi-DbbcjI2L.mjs +0 -86
  66. package/dist/TransactionDetails-B5qfs9Zh.mjs +0 -1283
  67. package/dist/TransactionStore-BWi6_2Ny.mjs +0 -669
  68. package/dist/TrendsStore-Borh98aN.mjs +0 -448
  69. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +0 -1959
  70. package/dist/WidgetContainer-CmGNZW0M.mjs +0 -548
  71. package/dist/accounts/index.es.js +0 -752
  72. package/dist/analytics/index.es.js +0 -171
  73. package/dist/budgets/index.es.js +0 -1070
  74. package/dist/cashflow/index.es.js +0 -1098
  75. package/dist/categories/index.es.js +0 -9
  76. package/dist/common/index.es.js +0 -1451
  77. package/dist/dashboard/index.es.js +0 -181
  78. package/dist/debts/index.es.js +0 -1460
  79. package/dist/exportTransactionsToCSV-j4g8bdVZ.mjs +0 -47
  80. package/dist/finstrong/index.es.js +0 -1455
  81. package/dist/goals/index.es.js +0 -1209
  82. package/dist/help/index.es.js +0 -14
  83. package/dist/hooks-ClhFlg78.mjs +0 -71
  84. package/dist/insights/index.d.ts +0 -1
  85. package/dist/insights/index.es.js +0 -4
  86. package/dist/investments/index.es.js +0 -1638
  87. package/dist/merchants/index.es.js +0 -79
  88. package/dist/microinsights/index.es.js +0 -16
  89. package/dist/networth/index.es.js +0 -542
  90. package/dist/notifications/index.es.js +0 -192
  91. package/dist/recurringtransactions/index.es.js +0 -879
  92. package/dist/settings/index.es.js +0 -879
  93. package/dist/spending/index.es.js +0 -570
  94. package/dist/transactions/index.es.js +0 -587
  95. package/dist/trends/index.es.js +0 -1103
  96. package/dist/useCombineEvents-DaDBSR_1.mjs +0 -92
  97. package/dist/useDimensions-27p2evRx.mjs +0 -36
  98. package/dist/useScreenSize-B6JyS_Lj.mjs +0 -36
@@ -1,1460 +0,0 @@
1
- import { jsx as e, jsxs as s, Fragment as $ } from "react/jsx-runtime";
2
- import y from "react";
3
- import { observer as D } from "mobx-react-lite";
4
- import f from "@mui/material/Stack";
5
- import { useTheme as j, Card as pe, Stack as _, Box as O } from "@mui/material";
6
- import { Text as i, H3 as we, InstitutionLogo as Ce, Icon as ee } from "@mxenabled/mxui";
7
- import { intervalToDuration as De, formatDuration as Se } from "date-fns";
8
- import { D as L } from "../DebtsStore-C6VcBnpG.mjs";
9
- import { a as Sr } from "../DebtsStore-C6VcBnpG.mjs";
10
- import { f as B, a as ve } from "../NumberFormatting-CtWHhyBX.mjs";
11
- import { f as K, D as U } from "../Dialog-CWW597AF.mjs";
12
- import { G as Te, x as q, u as C, i as z, g as M, c as Z, a as Ae } from "../hooks-ClhFlg78.mjs";
13
- import { u as X } from "../useScreenSize-B6JyS_Lj.mjs";
14
- import { D as te } from "../Drawer-kEE73B87.mjs";
15
- import { b as T } from "../Localization-2MODESHW.mjs";
16
- import { A as Ee, u as Ie } from "../AccountDetailsHeader-CAm6ADMq.mjs";
17
- import Be from "@mui/material/Card";
18
- import Me from "@mui/material/CardContent";
19
- import ke from "@mui/material/CardHeader";
20
- import { LineChart as Ne } from "@mui/x-charts";
21
- import { useTheme as Pe } from "@mui/material/styles";
22
- import { A as v, W as Re } from "../WidgetContainer-CmGNZW0M.mjs";
23
- import ie from "@mui/material/Tab";
24
- import Le from "@mui/material/Tabs";
25
- import me from "@mui/material/List";
26
- import W from "@mui/material/Divider";
27
- import { M as $e, I as He, O as Fe } from "../OriginalBalanceAction-s9sUxofR.mjs";
28
- import Oe from "@mui/material/TextField";
29
- import { L as J } from "../ListItemAction-Df3OPMOW.mjs";
30
- import { C as re } from "../CurrencyInput-DzsPiUsU.mjs";
31
- import le from "@mui/material/Alert";
32
- import se from "@mui/material/AlertTitle";
33
- import he from "@mui/icons-material/CheckCircle";
34
- import We from "@mui/icons-material/Error";
35
- import ce from "@mui/material/Paper";
36
- import { T as de } from "../TabContentContainer-j01JYR_7.mjs";
37
- import { DataGridPro as Ge } from "@mui/x-data-grid-pro";
38
- import ue from "@mui/material/Box";
39
- import { H as G } from "../HeaderCell-DjuifqHJ.mjs";
40
- import { f as je } from "../ConnectDrawer-DPnfeIfn.mjs";
41
- import be from "@mui/material/Button";
42
- import ze from "@mui/material/IconButton";
43
- import Xe from "@mui/material/ListItem";
44
- import Ve from "@mui/material/Popover";
45
- import { L as Ye } from "../Loader-Dp1P2gNw.mjs";
46
- const _e = (a, o) => {
47
- const n = a.filter((t) => !t.is_paid_off && !t.is_impossible), r = a.filter((t) => t.is_paid_off || t.is_impossible);
48
- switch (o) {
49
- case L.HIGHEST_INTEREST:
50
- n.sort((t, l) => (l.interest_rate ?? 0) - (t.interest_rate ?? 0));
51
- break;
52
- case L.LOWEST_BALANCE:
53
- n.sort((t, l) => t.balance - l.balance);
54
- break;
55
- case L.HIGHEST_BALANCE:
56
- n.sort((t, l) => l.balance - t.balance);
57
- break;
58
- default:
59
- n.sort((t, l) => t.balance - l.balance);
60
- }
61
- a.splice(0, a.length, ...n, ...r);
62
- };
63
- function Ke(a, o, n = 0) {
64
- const r = a.map((p) => ({ ...p })).filter(
65
- (p) => p.interest_rate !== void 0 && p.monthly_payment !== void 0 && !p.is_paid_off
66
- );
67
- _e(r, o);
68
- let t = 0, l = 0;
69
- const d = /* @__PURE__ */ new Date(), m = /* @__PURE__ */ new Date();
70
- for (; r.some((p) => p.balance >= 0.01 && !p.is_impossible); ) {
71
- let p = !1;
72
- for (const [g, x] of r.entries()) {
73
- if (x.balance <= 0.01 || x.is_impossible) continue;
74
- const k = (x.interest_rate ?? 0) / 100 / 12, S = x.balance * k;
75
- let u = x.monthly_payment ?? 0;
76
- g === 0 && n && (u += n), x.balance += S;
77
- const A = Math.min(x.balance, u + l);
78
- if (A <= S) {
79
- x.is_impossible = !0;
80
- continue;
81
- }
82
- x.balance -= A, x.balance = x.balance < 0.01 ? 0 : x.balance, t += S, x.balance <= 0 && (l += u), A > 0 && (p = !0);
83
- }
84
- p && m.setMonth(m.getMonth() + 1);
85
- }
86
- const c = r.some((p) => p.is_impossible && p.balance > 0), h = De({ start: d, end: m });
87
- return {
88
- payoffSavings: c ? "N/A" : B(t, "0,0.00"),
89
- payoffDate: c ? "Never" : K(m, U.MONTH_YEAR),
90
- payoffDuration: c ? "Stagnant" : Se(h, { format: ["years", "months"] }) || "0 months"
91
- };
92
- }
93
- const R = () => {
94
- if (!y.useContext(Te))
95
- throw new Error("useCateUiStore() must be used within the GlobalDataContext");
96
- return q().uiStore;
97
- }, Ue = ({ debts: a, onClickCta: o, sx: n }) => {
98
- const r = j(), { isMobile: t } = X(), { debts: l } = C(), { selectedDebtPriority: d } = R(), { monthlyCashFlowProfile: m } = z(), { payoffDate: c, payoffSavings: h, payoffDuration: p } = y.useMemo(() => {
99
- const g = m?.extra_payment ?? 0;
100
- return Ke(a, d, g);
101
- }, [a, d, m]);
102
- return /* @__PURE__ */ e(
103
- pe,
104
- {
105
- sx: {
106
- boxShadow: r.shadows[2],
107
- width: t ? "100%" : "186px",
108
- minWidth: "186px",
109
- ...n
110
- },
111
- children: /* @__PURE__ */ s(_, { sx: { gap: "12px", p: "16px" }, children: [
112
- /* @__PURE__ */ s(
113
- _,
114
- {
115
- gap: t ? "4px" : "0",
116
- sx: {
117
- borderBottom: "1px solid",
118
- borderBottomColor: r.palette.grey[300],
119
- pb: "8px"
120
- },
121
- children: [
122
- /* @__PURE__ */ e(i, { variant: "XSmall", children: l.snowball_card_date_description }),
123
- /* @__PURE__ */ e(i, { bold: !0, color: r.palette.primary.main, variant: "Small", children: c })
124
- ]
125
- }
126
- ),
127
- /* @__PURE__ */ s(_, { gap: t ? "4px" : "0", children: [
128
- /* @__PURE__ */ e(i, { bold: !0, variant: "Small", children: h }),
129
- /* @__PURE__ */ e(i, { sx: { whiteSpace: "normal" }, variant: "XSmall", children: l.snowball_card_amount_description })
130
- ] }),
131
- /* @__PURE__ */ s(_, { gap: t ? "4px" : "0", children: [
132
- /* @__PURE__ */ e(i, { bold: !0, variant: "Small", children: p }),
133
- /* @__PURE__ */ e(i, { variant: "XSmall", children: l.snowball_card_duration_description })
134
- ] }),
135
- /* @__PURE__ */ e(
136
- i,
137
- {
138
- bold: !0,
139
- color: r.palette.primary.main,
140
- onClick: o,
141
- sx: { cursor: "pointer" },
142
- variant: "Small",
143
- children: l.snowball_card_cta
144
- }
145
- )
146
- ] })
147
- }
148
- );
149
- }, qe = D(Ue), Ze = ({ isOpen: a, onClose: o, sx: n }) => {
150
- const r = j(), { debts: t } = C(), [l, d] = y.useState(!1);
151
- return /* @__PURE__ */ e(
152
- te,
153
- {
154
- ariaLabelClose: "",
155
- isOpen: a,
156
- onClose: o,
157
- sx: { ...n },
158
- title: t.snowball_drawer_title,
159
- children: /* @__PURE__ */ s(_, { bgcolor: r.palette.background.default, height: "100%", children: [
160
- /* @__PURE__ */ s(_, { alignItems: "center", px: 24, py: 24, children: [
161
- /* @__PURE__ */ s(_, { alignItems: "center", pb: 24, children: [
162
- /* @__PURE__ */ e(i, { mb: 12, variant: "H3", children: t.snowball_drawer_subtitle }),
163
- /* @__PURE__ */ e(i, { color: r.palette.secondary.main, variant: "Small", children: t.snowball_drawer_amount_description }),
164
- /* @__PURE__ */ e(i, { variant: "H1", children: t.snowball_drawer_savings }),
165
- /* @__PURE__ */ e(i, { color: r.palette.secondary.main, variant: "Small", children: t.snowball_drawer_duration_description })
166
- ] }),
167
- /* @__PURE__ */ s(pe, { sx: { display: "grid", py: 16, px: 24 }, children: [
168
- /* @__PURE__ */ e(i, { mb: 4, variant: "H3", children: t.snowball_drawer_question }),
169
- /* @__PURE__ */ e(
170
- i,
171
- {
172
- color: r.palette.secondary.main,
173
- mb: 8,
174
- sx: { whiteSpace: l ? "normal" : "nowrap" },
175
- variant: "ParagraphSmall",
176
- children: t.snowball_drawer_answer
177
- }
178
- ),
179
- /* @__PURE__ */ e(
180
- i,
181
- {
182
- bold: !0,
183
- color: r.palette.primary.main,
184
- onClick: () => d(!l),
185
- sx: { cursor: "pointer" },
186
- variant: "Small",
187
- children: l ? t.snowball_drawer_less : t.snowball_drawer_more
188
- }
189
- )
190
- ] })
191
- ] }),
192
- /* @__PURE__ */ s(_, { children: [
193
- /* @__PURE__ */ e(
194
- i,
195
- {
196
- color: r.palette.secondary.main,
197
- px: 24,
198
- sx: { textAlign: "center", whiteSpace: "normal" },
199
- variant: "Small",
200
- children: t.snowball_drawer_disclaimer
201
- }
202
- ),
203
- /* @__PURE__ */ s(_, { flexDirection: "row", justifyContent: "space-between", sx: { pt: 12, px: 24, pb: 8 }, children: [
204
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: T(t.snowball_drawer_month_header, 1) }),
205
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: t.snowball_drawer_payment_header })
206
- ] }),
207
- /* @__PURE__ */ s(_, { bgcolor: r.palette.background.paper, mb: 24, children: [
208
- /* @__PURE__ */ s(_, { alignItems: "center", flexDirection: "row", pl: 24, children: [
209
- /* @__PURE__ */ e(
210
- O,
211
- {
212
- sx: {
213
- display: "flex",
214
- alignItems: "center",
215
- justifyContent: "center",
216
- width: 20,
217
- height: 20,
218
- borderRadius: "50%",
219
- backgroundColor: r.palette.success.main,
220
- marginRight: 12
221
- },
222
- children: /* @__PURE__ */ e(i, { color: "white", fontWeight: 700, variant: "Small", children: "✓" })
223
- }
224
- ),
225
- /* @__PURE__ */ s(
226
- _,
227
- {
228
- sx: {
229
- borderBottom: `1px solid ${r.palette.border.light}`,
230
- flexDirection: "row",
231
- flexGrow: 1,
232
- py: 14,
233
- pr: 24
234
- },
235
- children: [
236
- /* @__PURE__ */ s(_, { flexGrow: 1, children: [
237
- /* @__PURE__ */ e(i, { variant: "Body", children: T(t.snowball_drawer_debt_label, "A") }),
238
- /* @__PURE__ */ s(i, { color: r.palette.secondary.main, variant: "XSmall", children: [
239
- T(
240
- t.snowball_drawer_rollover_explainer_pt1,
241
- "$100"
242
- ),
243
- /* @__PURE__ */ e("strong", { children: T(t.snowball_drawer_debt_label, "B") }),
244
- t.snowball_drawer_rollover_explainer_pt2
245
- ] })
246
- ] }),
247
- /* @__PURE__ */ s(_, { children: [
248
- /* @__PURE__ */ e(i, { variant: "Body", children: "$100.00" }),
249
- /* @__PURE__ */ e(
250
- i,
251
- {
252
- bold: !0,
253
- color: r.palette.success.main,
254
- textAlign: "end",
255
- variant: "Tiny",
256
- children: t.snowball_drawer_paid_label
257
- }
258
- )
259
- ] })
260
- ]
261
- }
262
- )
263
- ] }),
264
- /* @__PURE__ */ s(_, { alignItems: "center", flexDirection: "row", pl: 24, children: [
265
- /* @__PURE__ */ e(
266
- O,
267
- {
268
- sx: {
269
- width: 20,
270
- height: 20,
271
- marginRight: 12,
272
- borderRadius: "50%",
273
- border: `3px solid ${r.palette.border.darker}`
274
- }
275
- }
276
- ),
277
- /* @__PURE__ */ s(
278
- _,
279
- {
280
- sx: {
281
- borderBottom: `1px solid ${r.palette.border.light}`,
282
- flexDirection: "row",
283
- flexGrow: 1,
284
- py: 14,
285
- pr: 24
286
- },
287
- children: [
288
- /* @__PURE__ */ e(i, { flexGrow: 1, variant: "Body", children: T(t.snowball_drawer_debt_label, "B") }),
289
- /* @__PURE__ */ e(i, { variant: "Body", children: "$400.00" })
290
- ]
291
- }
292
- )
293
- ] }),
294
- /* @__PURE__ */ s(_, { alignItems: "center", flexDirection: "row", pl: 24, py: 14, children: [
295
- /* @__PURE__ */ e(
296
- O,
297
- {
298
- sx: {
299
- width: 20,
300
- height: 20,
301
- marginRight: 12,
302
- borderRadius: "50%",
303
- border: `3px solid ${r.palette.border.darker}`
304
- }
305
- }
306
- ),
307
- /* @__PURE__ */ s(_, { flexDirection: "row", flexGrow: 1, pr: 24, children: [
308
- /* @__PURE__ */ e(i, { flexGrow: 1, variant: "Body", children: T(t.snowball_drawer_debt_label, "C") }),
309
- /* @__PURE__ */ e(i, { variant: "Body", children: "$1,000.00" })
310
- ] })
311
- ] }),
312
- /* @__PURE__ */ s(
313
- _,
314
- {
315
- sx: {
316
- py: 8,
317
- px: 24,
318
- flexDirection: "row",
319
- justifyContent: "space-between",
320
- borderTop: `1px solid ${r.palette.border.light}`,
321
- borderBottom: `1px solid ${r.palette.border.light}`
322
- },
323
- children: [
324
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: t.snowball_drawer_total_label }),
325
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: "$1,500.00" })
326
- ]
327
- }
328
- )
329
- ] }),
330
- /* @__PURE__ */ s(_, { flexDirection: "row", justifyContent: "space-between", sx: { pt: 12, px: 24, pb: 8 }, children: [
331
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: T(t.snowball_drawer_month_header, 2) }),
332
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: t.snowball_drawer_payment_header })
333
- ] }),
334
- /* @__PURE__ */ s(_, { bgcolor: r.palette.background.paper, mb: 24, children: [
335
- /* @__PURE__ */ s(_, { alignItems: "center", flexDirection: "row", pl: 24, children: [
336
- /* @__PURE__ */ e(
337
- O,
338
- {
339
- sx: {
340
- display: "flex",
341
- alignItems: "center",
342
- justifyContent: "center",
343
- width: 20,
344
- height: 20,
345
- borderRadius: "50%",
346
- backgroundColor: r.palette.success.main,
347
- marginRight: 12
348
- },
349
- children: /* @__PURE__ */ e(i, { color: "white", fontWeight: 700, variant: "Small", children: "✓" })
350
- }
351
- ),
352
- /* @__PURE__ */ s(
353
- _,
354
- {
355
- sx: {
356
- borderBottom: `1px solid ${r.palette.border.light}`,
357
- flexDirection: "row",
358
- flexGrow: 1,
359
- py: 14,
360
- pr: 24
361
- },
362
- children: [
363
- /* @__PURE__ */ s(_, { flexGrow: 1, children: [
364
- /* @__PURE__ */ e(i, { variant: "Body", children: T(t.snowball_drawer_debt_label, "B") }),
365
- /* @__PURE__ */ s(i, { color: r.palette.secondary.main, variant: "XSmall", children: [
366
- T(
367
- t.snowball_drawer_rollover_explainer_pt1,
368
- "$500"
369
- ),
370
- /* @__PURE__ */ e("strong", { children: T(t.snowball_drawer_debt_label, "C") }),
371
- t.snowball_drawer_rollover_explainer_pt2
372
- ] })
373
- ] }),
374
- /* @__PURE__ */ s(_, { children: [
375
- /* @__PURE__ */ e(i, { variant: "Body", children: "$500.00" }),
376
- /* @__PURE__ */ e(
377
- i,
378
- {
379
- bold: !0,
380
- color: r.palette.success.main,
381
- textAlign: "end",
382
- variant: "Tiny",
383
- children: t.snowball_drawer_paid_label
384
- }
385
- )
386
- ] })
387
- ]
388
- }
389
- )
390
- ] }),
391
- /* @__PURE__ */ s(_, { alignItems: "center", flexDirection: "row", pl: 24, children: [
392
- /* @__PURE__ */ e(
393
- O,
394
- {
395
- sx: {
396
- width: 20,
397
- height: 20,
398
- marginRight: 12,
399
- borderRadius: "50%",
400
- border: `3px solid ${r.palette.border.darker}`
401
- }
402
- }
403
- ),
404
- /* @__PURE__ */ s(
405
- _,
406
- {
407
- sx: {
408
- flexDirection: "row",
409
- flexGrow: 1,
410
- py: 14,
411
- pr: 24
412
- },
413
- children: [
414
- /* @__PURE__ */ e(i, { flexGrow: 1, variant: "Body", children: T(t.snowball_drawer_debt_label, "C") }),
415
- /* @__PURE__ */ e(i, { variant: "Body", children: "$1,000.00" })
416
- ]
417
- }
418
- )
419
- ] }),
420
- /* @__PURE__ */ s(
421
- _,
422
- {
423
- sx: {
424
- py: 8,
425
- px: 24,
426
- flexDirection: "row",
427
- justifyContent: "space-between",
428
- borderTop: `1px solid ${r.palette.border.light}`,
429
- borderBottom: `1px solid ${r.palette.border.light}`
430
- },
431
- children: [
432
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: t.snowball_drawer_total_label }),
433
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: "$1,500.00" })
434
- ]
435
- }
436
- )
437
- ] }),
438
- /* @__PURE__ */ s(_, { flexDirection: "row", justifyContent: "space-between", sx: { pt: 12, px: 24, pb: 8 }, children: [
439
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: T(t.snowball_drawer_month_header, 3) }),
440
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: t.snowball_drawer_payment_header })
441
- ] }),
442
- /* @__PURE__ */ s(_, { bgcolor: r.palette.background.paper, mb: 24, children: [
443
- /* @__PURE__ */ s(_, { alignItems: "center", flexDirection: "row", pl: 24, children: [
444
- /* @__PURE__ */ e(
445
- O,
446
- {
447
- sx: {
448
- display: "flex",
449
- alignItems: "center",
450
- justifyContent: "center",
451
- width: 20,
452
- height: 20,
453
- borderRadius: "50%",
454
- backgroundColor: r.palette.success.main,
455
- marginRight: 12
456
- },
457
- children: /* @__PURE__ */ e(i, { color: "white", fontWeight: 700, variant: "Small", children: "✓" })
458
- }
459
- ),
460
- /* @__PURE__ */ s(
461
- _,
462
- {
463
- sx: {
464
- alignItems: "center",
465
- flexDirection: "row",
466
- flexGrow: 1,
467
- py: 14,
468
- pr: 24
469
- },
470
- children: [
471
- /* @__PURE__ */ e(_, { flexGrow: 1, children: /* @__PURE__ */ e(i, { variant: "Body", children: T(t.snowball_drawer_debt_label, "C") }) }),
472
- /* @__PURE__ */ s(_, { children: [
473
- /* @__PURE__ */ e(i, { variant: "Body", children: "$1,500.00" }),
474
- /* @__PURE__ */ e(
475
- i,
476
- {
477
- bold: !0,
478
- color: r.palette.success.main,
479
- textAlign: "end",
480
- variant: "Tiny",
481
- children: t.snowball_drawer_paid_label
482
- }
483
- )
484
- ] })
485
- ]
486
- }
487
- )
488
- ] }),
489
- /* @__PURE__ */ s(
490
- _,
491
- {
492
- sx: {
493
- py: 8,
494
- px: 24,
495
- flexDirection: "row",
496
- justifyContent: "space-between",
497
- borderTop: `1px solid ${r.palette.border.light}`,
498
- borderBottom: `1px solid ${r.palette.border.light}`
499
- },
500
- children: [
501
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: t.snowball_drawer_total_label }),
502
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: "$1,500.00" })
503
- ]
504
- }
505
- )
506
- ] })
507
- ] })
508
- ] })
509
- }
510
- );
511
- }, Je = D(Ze), Qe = "#FF7B08";
512
- function et(a, o) {
513
- const [n, r, t] = a.replace(/^#/, "").match(/.{1,2}/g).map((d) => parseInt(d, 16)), l = [
514
- Math.max(0, Math.min(255, Math.round(n * o))),
515
- Math.max(0, Math.min(255, Math.round(r * o))),
516
- Math.max(0, Math.min(255, Math.round(t * o)))
517
- ];
518
- return `rgb(${l[0]}, ${l[1]}, ${l[2]})`;
519
- }
520
- const ye = ({
521
- sx: a,
522
- height: o = 500,
523
- width: n,
524
- debts: r,
525
- hoveredDebtGuid: t,
526
- onClickArea: l,
527
- onHoverArea: d
528
- }) => {
529
- const m = Pe(), { onEvent: c } = M(), h = r.filter((b) => !b.is_impossible), p = [
530
- ...new Set(
531
- h.flatMap((b) => b.dataset.map((w) => new Date(w.x).getTime()))
532
- )
533
- ].sort((b, w) => b - w).map((b) => new Date(b)), g = h.map((b) => {
534
- const w = new Map(b.dataset.map((P) => [new Date(P.x).getTime(), P.y]));
535
- let I = w.get(p[0].getTime()) ?? 0;
536
- const N = p.map((P) => {
537
- const H = w.get(P.getTime()) ?? I;
538
- return I = H, { x: P, y: H };
539
- });
540
- return { ...b, dataset: N };
541
- }), x = g.reduce(
542
- (b, w) => b + (w.dataset[0]?.y ?? 0),
543
- 0
544
- ), E = p.map((b, w) => {
545
- const I = w / (p.length - 1), N = x * (1 - I);
546
- return { x: b, y: N };
547
- }), k = Math.ceil(x / 100) * 100, S = p, u = g.map((b, w) => {
548
- const I = 1 - w / g.length * 0.5, N = et(Qe, I);
549
- return {
550
- id: `debt-${w}`,
551
- guid: b.guid,
552
- label: b.name,
553
- data: b.dataset.map((P) => P.y),
554
- color: N,
555
- curve: "linear",
556
- type: "line",
557
- area: !0,
558
- stack: "total",
559
- showMark: !1
560
- };
561
- });
562
- u.push({
563
- id: "payoff-line",
564
- label: "Payoff Line",
565
- data: E.map((b) => b.y),
566
- color: m.palette.grey[700],
567
- curve: "linear",
568
- type: "line",
569
- stack: void 0,
570
- showMark: !1,
571
- disableHighlight: !0
572
- });
573
- const A = (b) => u.findIndex((w) => w?.guid === b);
574
- return /* @__PURE__ */ e(
575
- Ne,
576
- {
577
- axisHighlight: { x: "none" },
578
- disableLineItemHighlight: !0,
579
- height: o,
580
- onAreaClick: (b, w) => {
581
- l?.();
582
- const I = u.find((N) => N.id === w.seriesId);
583
- c(v.DEBTS_CLICK_CHART_AREA, { account_guid: I?.guid });
584
- },
585
- onHighlightChange: (b) => {
586
- const w = u.find((I) => I.id === b?.seriesId)?.guid;
587
- d?.(w ?? "");
588
- },
589
- series: u,
590
- skipAnimation: !0,
591
- slotProps: {
592
- legend: {
593
- hidden: !0
594
- }
595
- },
596
- sx: {
597
- p: 4,
598
- "& .MuiBarLabel-root": {
599
- fontSize: 10,
600
- fontWeight: 600
601
- },
602
- "& .MuiAreaElement-root": {
603
- opacity: 0.4,
604
- transition: "opacity 0.3s ease"
605
- },
606
- "& .MuiAreaElement-root:hover": {
607
- opacity: 1
608
- },
609
- "& .MuiLineElement-series-payoff-line": {
610
- strokeDasharray: "10 5",
611
- strokeWidth: 1
612
- },
613
- [`& .MuiLineElement-series-debt-${A(t ?? "0")}`]: {
614
- opacity: 1
615
- },
616
- [`& .MuiAreaElement-series-debt-${A(t ?? "0")}`]: {
617
- opacity: 1
618
- },
619
- ...a
620
- },
621
- tooltip: { trigger: "none" },
622
- width: n,
623
- xAxis: [
624
- {
625
- data: S,
626
- scaleType: "time",
627
- min: p[0],
628
- disableTicks: !0,
629
- valueFormatter: (b) => K(b, U.MONTH_SHORT_YEAR)
630
- }
631
- ],
632
- yAxis: [
633
- {
634
- min: 0,
635
- max: k,
636
- disableTicks: !0,
637
- valueFormatter: (b) => B(b, "0a")
638
- }
639
- ]
640
- }
641
- );
642
- }, tt = () => {
643
- const a = j(), { debts: o } = C(), { selectedDebtChartData: n } = R();
644
- return /* @__PURE__ */ s($, { children: [
645
- /* @__PURE__ */ s(
646
- Be,
647
- {
648
- sx: {
649
- "& .MuiCardContent-root:last-child": {
650
- pb: 0
651
- }
652
- },
653
- children: [
654
- /* @__PURE__ */ e(ke, { sx: { pb: 0 }, title: /* @__PURE__ */ e(we, { sx: { pb: 4 }, children: o.details_chart_title }) }),
655
- /* @__PURE__ */ e(Me, { sx: { p: 0 }, children: /* @__PURE__ */ e(ye, { debts: [n], height: 250 }) })
656
- ]
657
- }
658
- ),
659
- /* @__PURE__ */ e(
660
- i,
661
- {
662
- color: a.palette.text.secondary,
663
- sx: { whiteSpace: "normal", textAlign: "center", px: 8, py: 12 },
664
- variant: "Small",
665
- children: o.details_chart_description
666
- }
667
- )
668
- ] });
669
- }, rt = D(tt), at = () => {
670
- const a = j(), { onEvent: o } = M(), { debts: n } = C(), { selectedDebtChartData: r, showCompleted: t, showError: l } = R();
671
- return y.useEffect(() => o(v.DEBT_SCHEDULE_VIEW), []), /* @__PURE__ */ e(me, { children: l || t ? /* @__PURE__ */ e(
672
- i,
673
- {
674
- color: a.palette.secondary.main,
675
- component: "div",
676
- sx: { p: 32, textAlign: "center", whiteSpace: "normal" },
677
- variant: "Small",
678
- children: l ? n.schedule_error_message : n.schedule_complete_message
679
- }
680
- ) : /* @__PURE__ */ s($, { children: [
681
- /* @__PURE__ */ s(f, { flexDirection: "row", justifyContent: "space-between", sx: { pt: 12, px: 24, pb: 8 }, children: [
682
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: n.schedule_month_heading }),
683
- /* @__PURE__ */ e(i, { bold: !0, variant: "XSmall", children: n.schedule_amount_heading })
684
- ] }),
685
- r.dataset.slice(1).map(({ x: d, y: m, payment: c }) => /* @__PURE__ */ e(f, { bgcolor: a.palette.background.paper, children: /* @__PURE__ */ e(f, { alignItems: "center", flexDirection: "row", pl: 24, children: /* @__PURE__ */ s(
686
- f,
687
- {
688
- sx: {
689
- borderBottom: `1px solid ${a.palette.border.light}`,
690
- flexDirection: "row",
691
- flexGrow: 1,
692
- py: 14,
693
- pr: 24
694
- },
695
- children: [
696
- /* @__PURE__ */ s(f, { flexGrow: 1, children: [
697
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: K(d, U.MONTH_YEAR) }),
698
- /* @__PURE__ */ e(i, { color: a.palette.secondary.main, variant: "XSmall", children: n.schedule_month_label })
699
- ] }),
700
- /* @__PURE__ */ s(f, { children: [
701
- /* @__PURE__ */ e(i, { bold: !0, variant: "Body", children: B(m, "0,0.00") }),
702
- /* @__PURE__ */ e(
703
- i,
704
- {
705
- bold: !0,
706
- color: a.palette.success.main,
707
- textAlign: "end",
708
- variant: "Tiny",
709
- children: `+${B(c, "0,0")}`
710
- }
711
- )
712
- ] })
713
- ]
714
- }
715
- ) }) }, String(d))),
716
- /* @__PURE__ */ e(f, { bgcolor: "background.paper", children: /* @__PURE__ */ s(
717
- f,
718
- {
719
- sx: {
720
- alignItems: "center",
721
- flexDirection: "row",
722
- flexGrow: 1,
723
- py: 14,
724
- px: 24
725
- },
726
- children: [
727
- /* @__PURE__ */ e(i, { flexGrow: 1, variant: "Body", children: n.schedule_payoff_label }),
728
- /* @__PURE__ */ e(i, { variant: "Body", children: "-" })
729
- ]
730
- }
731
- ) })
732
- ] }) });
733
- }, ot = D(at), nt = D(({ debt: a }) => {
734
- const { debts: o } = C(), { updateAccount: n } = Z(), { onEvent: r } = M(), [t, l] = y.useState(a.interest_rate ?? 0), d = t < 0, m = async () => {
735
- await n({ ...a.account, interest_rate: t }), a.interest_rate = t, r(v.DEBTS_SAVE_RATE_ACTION, { account_guid: a.guid });
736
- }, c = () => {
737
- setTimeout(() => {
738
- l(a.interest_rate ?? 0);
739
- }, 250);
740
- };
741
- return /* @__PURE__ */ e(
742
- J,
743
- {
744
- isSaveDisabled: d,
745
- label: `${o.details_interest_rate} (%)`,
746
- onCancel: c,
747
- onSave: m,
748
- primaryText: o.details_interest_rate,
749
- secondaryText: ve(Number(a.interest_rate) / 100),
750
- zeroStateText: a.interest_rate ? void 0 : o.add_interest_rate,
751
- children: /* @__PURE__ */ e(
752
- Oe,
753
- {
754
- error: d,
755
- fullWidth: !0,
756
- onChange: (h) => l(isNaN(parseFloat(h.target.value)) ? 0 : parseFloat(h.target.value)),
757
- type: "number",
758
- value: t
759
- }
760
- )
761
- }
762
- );
763
- }), it = D(({ debt: a }) => {
764
- const { debts: o } = C(), { updateAccount: n } = Z(), { onEvent: r } = M(), [t, l] = y.useState(a.monthly_payment ?? 0), d = t < 0 || t > 9999999999e-2, m = async () => {
765
- await n({ ...a.account, minimum_payment: t }), a.monthly_payment = t, r(v.DEBTS_SAVE_PAYMENT_ACTION, { account_guid: a.guid });
766
- }, c = () => {
767
- setTimeout(() => {
768
- l(a.monthly_payment ?? 0);
769
- }, 250);
770
- };
771
- return /* @__PURE__ */ e(
772
- J,
773
- {
774
- isSaveDisabled: d,
775
- label: o.details_monthly_payment,
776
- onCancel: c,
777
- onSave: m,
778
- primaryText: o.details_monthly_payment,
779
- secondaryText: B(a.monthly_payment, "0,0"),
780
- zeroStateText: a.monthly_payment ? void 0 : o.add_monthly_payment,
781
- children: /* @__PURE__ */ e(
782
- re,
783
- {
784
- amount: t,
785
- autoFocus: !0,
786
- error: d,
787
- fullWidth: !0,
788
- minAmount: 0,
789
- setAmount: (h) => l(isNaN(Number(h)) ? t : Number(h)),
790
- sx: { ".MuiTypography-Body": { p: 0 } }
791
- }
792
- )
793
- }
794
- );
795
- }), lt = D(({ debt: a }) => {
796
- const { debts: o } = C(), { updateAccount: n } = Z(), { onEvent: r } = M(), [t, l] = y.useState(a.original_balance ?? 0), d = t < 0 || t > 9999999999e-2, m = async () => {
797
- await n({ ...a.account, original_balance: t }), a.original_balance = t, r(v.DEBTS_SAVE_BALANCE_ACTION, { account_guid: a.guid });
798
- }, c = () => {
799
- setTimeout(() => {
800
- l(a.original_balance ?? 0);
801
- }, 250);
802
- };
803
- return /* @__PURE__ */ e(
804
- J,
805
- {
806
- isSaveDisabled: d,
807
- label: o.details_original_balance,
808
- onCancel: c,
809
- onSave: m,
810
- primaryText: o.details_original_balance,
811
- secondaryText: B(a.original_balance, "0,0"),
812
- zeroStateText: a.original_balance ? void 0 : o.add_original_balance,
813
- children: /* @__PURE__ */ e(
814
- re,
815
- {
816
- amount: t,
817
- autoFocus: !0,
818
- error: d,
819
- fullWidth: !0,
820
- minAmount: 0,
821
- setAmount: (h) => l(isNaN(Number(h)) ? t : Number(h)),
822
- sx: { ".MuiTypography-Body": { p: 0 } }
823
- }
824
- )
825
- }
826
- );
827
- }), st = () => {
828
- const { onEvent: a } = M(), { selectedDebtChartData: o } = R();
829
- return y.useEffect(() => a(v.DEBT_DETAILS_VIEW), []), /* @__PURE__ */ s(f, { bgcolor: "background.paper", children: [
830
- o?.goal && /* @__PURE__ */ s($, { children: [
831
- /* @__PURE__ */ e($e, { goal: o.goal }),
832
- /* @__PURE__ */ e(W, {}),
833
- /* @__PURE__ */ e(He, { goal: o.goal }),
834
- /* @__PURE__ */ e(W, {}),
835
- /* @__PURE__ */ e(Fe, { goal: o.goal }),
836
- /* @__PURE__ */ e(W, {})
837
- ] }),
838
- !o?.goal && o?.account && /* @__PURE__ */ s($, { children: [
839
- /* @__PURE__ */ e(it, { debt: o }),
840
- /* @__PURE__ */ e(W, {}),
841
- /* @__PURE__ */ e(nt, { debt: o }),
842
- /* @__PURE__ */ e(W, {}),
843
- /* @__PURE__ */ e(lt, { debt: o }),
844
- /* @__PURE__ */ e(W, {})
845
- ] })
846
- ] });
847
- }, ct = D(st), dt = ({ setTabValue: a, sx: o }) => {
848
- const { debts: n } = C(), { showError: r, showCompleted: t } = R();
849
- return y.useEffect(() => {
850
- r && a(1);
851
- }, [r]), !r && !t ? /* @__PURE__ */ e($, {}) : /* @__PURE__ */ s(_, { gap: 16, children: [
852
- /* @__PURE__ */ e(ce, { sx: { my: 16, mx: 24, ...o }, children: /* @__PURE__ */ s(
853
- le,
854
- {
855
- icon: r ? /* @__PURE__ */ e(We, {}) : /* @__PURE__ */ e(he, { color: "success" }),
856
- severity: "error",
857
- sx: {
858
- alignItems: "start",
859
- borderLeft: 5,
860
- borderRadius: 1,
861
- borderColor: r ? "error.main" : "success.main",
862
- color: "text.primary",
863
- "&.MuiPaper-root": {
864
- backgroundColor: "background.paper"
865
- }
866
- },
867
- children: [
868
- /* @__PURE__ */ e(se, { sx: { fontWeight: 600, marginTop: 2 }, variant: "Body", children: r ? n.status_error_title : n.status_complete_title }),
869
- /* @__PURE__ */ e(i, { component: "p", sx: { whiteSpace: "wrap" }, variant: "ParagraphSmall", children: r ? n.status_error_description : n.status_complete_description })
870
- ]
871
- }
872
- ) }),
873
- r && /* @__PURE__ */ e(ce, { sx: { mb: 16, mt: 100, mx: 24, ...o }, children: /* @__PURE__ */ s(
874
- le,
875
- {
876
- icon: /* @__PURE__ */ e($, {}),
877
- severity: "error",
878
- sx: {
879
- borderRadius: 2,
880
- color: "text.primary",
881
- "&.MuiPaper-root": {
882
- backgroundColor: "background.paper"
883
- }
884
- },
885
- children: [
886
- /* @__PURE__ */ e(se, { sx: { fontWeight: 600, marginTop: 2 }, variant: "Body", children: n.status_info_title }),
887
- /* @__PURE__ */ e(i, { component: "p", sx: { whiteSpace: "wrap" }, variant: "ParagraphSmall", children: n.status_info_description })
888
- ]
889
- }
890
- ) })
891
- ] });
892
- }, pt = D(dt), mt = () => {
893
- const { debts: a } = C(), { showError: o, showCompleted: n } = R(), [r, t] = y.useState(0);
894
- return /* @__PURE__ */ s($, { children: [
895
- (o || n) && /* @__PURE__ */ e(pt, { setTabValue: t, sx: { mt: -24 } }),
896
- /* @__PURE__ */ s(
897
- Le,
898
- {
899
- "aria-label": a.details_tabs_aria_label,
900
- centered: !0,
901
- onChange: (l, d) => t(d),
902
- textColor: "primary",
903
- value: r,
904
- variant: "fullWidth",
905
- children: [
906
- /* @__PURE__ */ e(
907
- ie,
908
- {
909
- "aria-controls": "debt-schedule-tabpanel-0",
910
- id: "debt-schedule-tab-0",
911
- label: a.schedule_tab_label
912
- }
913
- ),
914
- /* @__PURE__ */ e(
915
- ie,
916
- {
917
- "aria-controls": "debt-details-tabpanel-1",
918
- id: "debt-details-tab-1",
919
- label: a.details_tab_label
920
- }
921
- )
922
- ]
923
- }
924
- ),
925
- /* @__PURE__ */ e(de, { index: 0, name: "debt-schedule", value: r, children: /* @__PURE__ */ e(ot, {}) }),
926
- /* @__PURE__ */ e(de, { index: 1, name: "debt-details", value: r, children: /* @__PURE__ */ e(ct, {}) })
927
- ] });
928
- }, ht = D(mt), ut = ({ isOpen: a, onClose: o, sx: n }) => {
929
- const { debts: r } = C(), { showError: t, showCompleted: l } = R(), d = t || l ? /* @__PURE__ */ e($, {}) : /* @__PURE__ */ e(rt, {});
930
- return /* @__PURE__ */ e(
931
- te,
932
- {
933
- ariaLabelClose: r.details_close_aria,
934
- isOpen: a,
935
- onClose: o,
936
- sx: { ...n },
937
- title: r.details_title,
938
- children: /* @__PURE__ */ s(f, { bgcolor: "background.default", children: [
939
- /* @__PURE__ */ e(Ee, { customDetailsChart: d }),
940
- /* @__PURE__ */ e(ht, {})
941
- ] })
942
- }
943
- );
944
- }, bt = D(() => {
945
- const { debts: a } = C(), { monthlyCashFlowProfile: o, updateMonthlyCashFlowProfile: n } = z(), { onEvent: r } = M(), [t, l] = y.useState(o?.extra_payment ?? 0), d = t < 0 || t > 9999999999e-2, m = async () => {
946
- o && (await n({ ...o, extra_payment: t }), o.extra_payment = t, r(v.DEBTS_SAVE_PAYDOWN_ACTION, {
947
- user_guid: o?.user_guid
948
- }));
949
- }, c = () => {
950
- setTimeout(() => {
951
- l(o?.extra_payment ?? 0);
952
- }, 250);
953
- };
954
- return /* @__PURE__ */ e(
955
- J,
956
- {
957
- isSaveDisabled: d,
958
- label: a.paydown_drawer_extra_payment,
959
- onCancel: c,
960
- onSave: m,
961
- primaryText: a.paydown_drawer_extra_payment,
962
- secondaryText: B(o?.extra_payment, "0,0"),
963
- zeroStateText: o?.extra_payment ? void 0 : a.add_extra_payment,
964
- children: /* @__PURE__ */ e(
965
- re,
966
- {
967
- amount: t,
968
- autoFocus: !0,
969
- error: d,
970
- fullWidth: !0,
971
- minAmount: 0,
972
- setAmount: (h) => l(isNaN(Number(h)) ? t : Number(h)),
973
- sx: { ".MuiTypography-Body": { p: 0 } }
974
- }
975
- )
976
- }
977
- );
978
- }), _t = () => {
979
- const { debts: a } = C(), { totalMonthlyPayments: o } = q(), { monthlyCashFlowProfile: n } = z(), r = o + Number(n?.extra_payment);
980
- return /* @__PURE__ */ s(f, { sx: { backgroundColor: "background.default", height: "100%" }, children: [
981
- /* @__PURE__ */ s(f, { p: 24, children: [
982
- /* @__PURE__ */ s(f, { alignItems: "center", gap: 4, mb: 24, children: [
983
- /* @__PURE__ */ e(i, { variant: "Body", children: a.paydown_drawer_mimimum_label }),
984
- /* @__PURE__ */ e(i, { bold: !0, variant: "H1", children: B(o, "0,0") }),
985
- /* @__PURE__ */ e(i, { textAlign: "center", truncate: !1, variant: "Small", width: 208, children: a.paydown_drawer_minimum_info })
986
- ] }),
987
- /* @__PURE__ */ s(f, { children: [
988
- /* @__PURE__ */ e(i, { variant: "H3", children: a.paydown_drawer_subtitle }),
989
- /* @__PURE__ */ e(i, { truncate: !1, variant: "ParagraphSmall", children: a.paydown_drawer_description })
990
- ] })
991
- ] }),
992
- /* @__PURE__ */ e(f, { sx: { backgroundColor: "background.paper" }, children: /* @__PURE__ */ e(bt, {}) }),
993
- /* @__PURE__ */ e(f, { flexDirection: "row-reverse", px: 24, py: 12, children: /* @__PURE__ */ s(f, { gap: 4, children: [
994
- /* @__PURE__ */ e(i, { variant: "Small", children: a.paydown_drawer_total_payment }),
995
- /* @__PURE__ */ e(i, { bold: !0, textAlign: "right", variant: "Body", children: B(r, "0,0") })
996
- ] }) })
997
- ] });
998
- }, yt = D(_t), ft = ({ isOpen: a, onClose: o, sx: n }) => {
999
- const { debts: r } = C();
1000
- return /* @__PURE__ */ e(
1001
- te,
1002
- {
1003
- ariaLabelClose: r.paydown_drawer_close_aria,
1004
- isOpen: a,
1005
- onClose: o,
1006
- sx: { ...n },
1007
- title: r.paydown_drawer_title,
1008
- children: /* @__PURE__ */ e(yt, {})
1009
- }
1010
- );
1011
- };
1012
- function gt(a, o) {
1013
- const n = (r) => {
1014
- if (typeof r == "number") return r;
1015
- if (r === "!" || r === "✓") return 1 / 0;
1016
- throw new Error("Unsupported value");
1017
- };
1018
- return n(a) - n(o);
1019
- }
1020
- function xt(a) {
1021
- return a.is_paid_off ? "✓" : a.priority === void 0 || a.is_impossible ? "!" : a.priority;
1022
- }
1023
- const wt = (a) => {
1024
- const o = {
1025
- text: "#121417",
1026
- background: "#FFB252"
1027
- };
1028
- return a === "!" && (o.text = "#FFFFFF", o.background = "#DF320C"), a === "✓" && (o.text = "#FFFFFF", o.background = "#09A57F"), o;
1029
- }, Ct = (a) => {
1030
- const o = String(a.formattedValue), n = wt(o);
1031
- return /* @__PURE__ */ e(
1032
- ue,
1033
- {
1034
- sx: {
1035
- display: "flex",
1036
- alignItems: "center",
1037
- justifyContent: "center",
1038
- width: 20,
1039
- // Adjust the size as needed
1040
- height: 20,
1041
- borderRadius: "50%",
1042
- backgroundColor: n.background,
1043
- marginLeft: "10px"
1044
- },
1045
- children: /* @__PURE__ */ e(i, { color: n.text, fontWeight: 700, variant: "Small", children: o })
1046
- }
1047
- );
1048
- }, Dt = (a) => {
1049
- const o = a.row.account, n = je[o.account_type];
1050
- return /* @__PURE__ */ s(f, { alignItems: "center", flexDirection: "row", children: [
1051
- /* @__PURE__ */ e(
1052
- Ce,
1053
- {
1054
- alt: `${o.institutionName}`,
1055
- institutionGuid: o.institution_guid || ""
1056
- }
1057
- ),
1058
- /* @__PURE__ */ s(f, { ml: 12, children: [
1059
- /* @__PURE__ */ e(i, { variant: "Small", children: o.name }),
1060
- /* @__PURE__ */ e(i, { variant: "XSmall", children: n })
1061
- ] })
1062
- ] });
1063
- }, St = ({
1064
- sx: a = {},
1065
- debts: o,
1066
- hoveredDebtGuid: n,
1067
- onHoverRow: r,
1068
- onClickRow: t
1069
- }) => {
1070
- const l = j(), { onEvent: d } = M(), { isMobile: m } = X(), { debts: c } = C(), [h, p] = y.useState([
1071
- { field: "priority", sort: "asc" }
1072
- ]), g = [
1073
- {
1074
- field: "priority",
1075
- headerName: c.table_column_priority,
1076
- renderHeader: G,
1077
- renderCell: Ct,
1078
- sortComparator: gt,
1079
- sortable: !0,
1080
- hideSortIcons: !0,
1081
- type: "custom",
1082
- align: "left",
1083
- headerAlign: "left",
1084
- minWidth: m ? 67 : 72,
1085
- flex: m ? 0.2 : 0.4
1086
- },
1087
- {
1088
- field: "account",
1089
- headerName: c.table_column_account,
1090
- renderHeader: G,
1091
- renderCell: Dt,
1092
- sortable: !1,
1093
- type: "custom",
1094
- align: "left",
1095
- headerAlign: "left",
1096
- minWidth: m ? 180 : 225,
1097
- flex: 1
1098
- },
1099
- {
1100
- field: "balance",
1101
- headerName: c.table_column_balance,
1102
- renderHeader: G,
1103
- valueFormatter: (u) => B(u, "0,0"),
1104
- sortable: !0,
1105
- hideSortIcons: m,
1106
- type: "number",
1107
- align: m ? "right" : "left",
1108
- headerAlign: m ? "right" : "left",
1109
- minWidth: m ? 70 : 122,
1110
- flex: m ? 0.4 : 0.6
1111
- },
1112
- {
1113
- field: "interest_rate",
1114
- headerName: c.table_column_interest_rate,
1115
- renderHeader: G,
1116
- valueFormatter: (u) => isNaN(u) ? "---" : `${Number(u).toFixed(2)}%`,
1117
- sortable: !0,
1118
- hideSortIcons: m,
1119
- type: "number",
1120
- align: "left",
1121
- headerAlign: "left",
1122
- minWidth: 122,
1123
- flex: 0.6
1124
- },
1125
- {
1126
- field: "projected_payoff_date",
1127
- headerName: c.table_column_payoff_date,
1128
- renderHeader: G,
1129
- valueFormatter: (u) => u ? K(u, U.MONTH_SHORT_YEAR) : "---",
1130
- sortable: !0,
1131
- hideSortIcons: m,
1132
- type: "number",
1133
- align: "left",
1134
- headerAlign: "left",
1135
- minWidth: 122,
1136
- flex: 0.6
1137
- },
1138
- {
1139
- field: "monthly_payment",
1140
- headerName: c.table_column_amount_due,
1141
- renderHeader: G,
1142
- valueFormatter: (u) => typeof u == "number" ? B(u, "0,0") : "---",
1143
- sortable: !0,
1144
- hideSortIcons: m,
1145
- type: "number",
1146
- align: "left",
1147
- headerAlign: "left",
1148
- minWidth: 122,
1149
- flex: 0.6
1150
- }
1151
- ], x = [
1152
- ...g.slice(0, 3),
1153
- {
1154
- field: "chevron",
1155
- headerName: "",
1156
- renderHeader: void 0,
1157
- renderCell: () => /* @__PURE__ */ e(ee, { name: "chevron_right'" }),
1158
- sortable: !0,
1159
- hideSortIcons: !0,
1160
- type: "custom",
1161
- align: "right",
1162
- headerAlign: "right",
1163
- width: 20
1164
- }
1165
- ], E = y.useMemo(() => o.map((u, A) => ({
1166
- ...u,
1167
- id: A,
1168
- priority: xt(u)
1169
- })), [o]), k = (u) => {
1170
- const Y = u.target.closest("[data-id]")?.getAttribute("data-id"), b = o[Number(Y)];
1171
- r?.(b?.guid ?? "");
1172
- }, S = (u) => E.find((A) => A.guid === u)?.id;
1173
- return /* @__PURE__ */ e(
1174
- ue,
1175
- {
1176
- sx: {
1177
- height: "100dvh",
1178
- width: "100%",
1179
- mt: "15px",
1180
- overflowX: "auto",
1181
- boxShadow: "none",
1182
- ...a
1183
- },
1184
- children: /* @__PURE__ */ e(
1185
- Ge,
1186
- {
1187
- columns: m ? x : g,
1188
- disableColumnFilter: !0,
1189
- disableColumnMenu: !0,
1190
- hideFooter: !0,
1191
- initialState: { sorting: { sortModel: h } },
1192
- onRowClick: (u) => {
1193
- t(), d(v.TRENDS_CLICK_TABLE_ROW, { account_guid: u.row.guid });
1194
- },
1195
- onSortModelChange: (u) => {
1196
- p(u), d(v.TRENDS_CLICK_TABLE_SORT);
1197
- },
1198
- rows: E,
1199
- slotProps: {
1200
- baseIconButton: { color: "secondary", sx: { ml: 8 } },
1201
- row: {
1202
- onMouseEnter: k,
1203
- onMouseLeave: () => r?.("")
1204
- }
1205
- },
1206
- sortModel: h,
1207
- sortingOrder: ["asc", "desc"],
1208
- sx: {
1209
- [`& .MuiDataGrid-row[data-id="${S(n)}"]`]: {
1210
- backgroundColor: l.palette.mode === "light" ? "#f8f9fb" : "#1f2329",
1211
- filter: "brightness(98%)"
1212
- }
1213
- }
1214
- }
1215
- )
1216
- }
1217
- );
1218
- }, vt = ({ buttonText: a, isOpen: o, onClick: n }) => {
1219
- const { isDesktop: r, isTablet: t } = X(), l = o ? "unfold_less" : "unfold_more";
1220
- return r || t ? /* @__PURE__ */ e(
1221
- be,
1222
- {
1223
- "aria-controls": "prioritize-debts",
1224
- "aria-describedby": "prioritize-debts",
1225
- "aria-haspopup": !0,
1226
- "aria-label": "prioritize-debts",
1227
- onClick: n,
1228
- startIcon: /* @__PURE__ */ e(ee, { name: l }),
1229
- sx: { justifyContent: "start", minWidth: 214, mx: 4 },
1230
- children: a
1231
- }
1232
- ) : /* @__PURE__ */ e(
1233
- ze,
1234
- {
1235
- "aria-controls": "prioritize-debts",
1236
- "aria-describedby": "prioritize-debts",
1237
- "aria-haspopup": !0,
1238
- "aria-label": "prioritize-debts",
1239
- onClick: n,
1240
- children: /* @__PURE__ */ e(ee, { name: l })
1241
- }
1242
- );
1243
- }, Tt = D(({ buttonEl: a, onClose: o }) => {
1244
- const { onEvent: n } = M(), { debts: r } = C(), { selectedDebtPriority: t, setSelectedDebtPriority: l } = R(), d = !!a, m = [
1245
- {
1246
- priority: L.HIGHEST_INTEREST,
1247
- text: r.priority_sort_highest_interest
1248
- },
1249
- {
1250
- priority: L.LOWEST_BALANCE,
1251
- text: r.priority_sort_lowest_balance
1252
- },
1253
- {
1254
- priority: L.HIGHEST_BALANCE,
1255
- text: r.priority_sort_highest_balance
1256
- }
1257
- ], c = (h) => {
1258
- l(h), n(v.DEBTS_CLICK_PRIORITY, { debts_priority: h });
1259
- };
1260
- return /* @__PURE__ */ e(
1261
- Ve,
1262
- {
1263
- anchorEl: a,
1264
- anchorOrigin: {
1265
- vertical: "bottom",
1266
- horizontal: "left"
1267
- },
1268
- id: "prioritize-debts",
1269
- onClose: o,
1270
- open: d,
1271
- transformOrigin: {
1272
- vertical: "top",
1273
- horizontal: "left"
1274
- },
1275
- children: /* @__PURE__ */ e(me, { children: m.map(({ priority: h, text: p }) => /* @__PURE__ */ s(
1276
- Xe,
1277
- {
1278
- onClick: () => c(h),
1279
- sx: {
1280
- bgcolor: t === h ? "primary.main" : void 0,
1281
- color: t === h ? "#fff" : void 0,
1282
- justifyContent: "space-between",
1283
- minHeight: 44,
1284
- minWidth: 268,
1285
- px: 24,
1286
- py: 12,
1287
- "&:hover": {
1288
- bgcolor: "background.highlight",
1289
- cursor: "pointer",
1290
- color: "text.primary"
1291
- }
1292
- },
1293
- children: [
1294
- /* @__PURE__ */ e(i, { color: "inherit", variant: "Small", children: p }),
1295
- t === h && /* @__PURE__ */ e(he, { color: "inherit", fontSize: "small" })
1296
- ]
1297
- },
1298
- h
1299
- )) })
1300
- }
1301
- );
1302
- }), At = D(() => {
1303
- const { onEvent: a } = M(), { debts: o } = C(), { selectedDebtPriority: n } = R(), [r, t] = y.useState(null), l = (h) => {
1304
- t(h.currentTarget), a(v.DEBTS_CLICK_PRIORITIZE);
1305
- }, d = () => {
1306
- t(null);
1307
- }, m = !!r, c = y.useMemo(() => ({
1308
- [L.HIGHEST_INTEREST]: o.priority_sort_highest_interest,
1309
- [L.HIGHEST_BALANCE]: o.priority_sort_highest_balance,
1310
- [L.LOWEST_BALANCE]: o.priority_sort_lowest_balance
1311
- })[n] ?? o.priority_sort_lowest_balance, [n]);
1312
- return /* @__PURE__ */ s(_, { children: [
1313
- /* @__PURE__ */ e(vt, { buttonText: c, isOpen: m, onClick: l }),
1314
- /* @__PURE__ */ e(Tt, { buttonEl: r, onClose: d })
1315
- ] });
1316
- }), Et = (a, o, n = 0) => {
1317
- const r = a.map((c) => ({ ...c }));
1318
- _e(r, o);
1319
- const t = /* @__PURE__ */ new Date(), l = [];
1320
- let d = 0, m = 1;
1321
- for (const c of r)
1322
- l.push({
1323
- ...c,
1324
- // Start with the initial balance
1325
- dataset: [{ x: new Date(t), y: c.balance }]
1326
- });
1327
- for (; r.some((c) => c.balance >= 0.01 && !c.is_impossible); ) {
1328
- let c = !1;
1329
- for (const [h, p] of r.entries()) {
1330
- if (p.balance <= 0.01) continue;
1331
- const g = l[h].dataset, E = (p.interest_rate ?? 0) / 100 / 12, k = p.balance * E;
1332
- let S = p.monthly_payment ?? 0;
1333
- h === 0 && (S += n), p.balance += k;
1334
- const u = Math.min(p.balance, S + d);
1335
- if (u <= k) {
1336
- p.is_impossible = !0, l[h].is_impossible = !0, l[h].priority = void 0, g.push({ x: new Date(t), y: p.balance });
1337
- continue;
1338
- }
1339
- p.balance -= u, p.balance = p.balance < 0.01 ? 0 : p.balance, g.push({
1340
- x: new Date(t),
1341
- y: Math.max(0, p.balance),
1342
- payment: u,
1343
- extra: d
1344
- }), p.balance <= 0 && (d += S, l[h].projected_payoff_date = new Date(t)), u > 0 && (c = !0);
1345
- }
1346
- c && t.setMonth(t.getMonth() + 1);
1347
- }
1348
- return l.forEach((c) => {
1349
- (c.interest_rate === void 0 || c.interest_rate === void 0) && (c.projected_payoff_date = void 0);
1350
- }), l.forEach((c) => {
1351
- c.priority = !c.is_paid_off && !c.is_impossible ? m++ : void 0;
1352
- }), l;
1353
- }, It = D(({ onClick: a }) => {
1354
- const { debts: o } = C(), { isDesktop: n } = X(), { totalMonthlyPayments: r } = q(), { monthlyCashFlowProfile: t } = z(), l = r + Number(t?.extra_payment), d = n ? o.paydown_button_long : o.paydown_button_short;
1355
- return /* @__PURE__ */ e(
1356
- be,
1357
- {
1358
- "aria-controls": "extra-paydown",
1359
- "aria-describedby": "extra-paydown",
1360
- "aria-haspopup": !0,
1361
- "aria-label": "extra-paydown",
1362
- onClick: a,
1363
- sx: { justifyContent: "start", minWidth: 100, mx: 4 },
1364
- children: T(d, B(l, "0,0"))
1365
- }
1366
- );
1367
- }), Bt = ({ onBackClick: a, sx: o }) => {
1368
- const [n, r] = y.useState(!1), [t, l] = y.useState(!1), [d, m] = y.useState(!1), [c, h] = y.useState(""), { isDesktop: p, isMobile: g } = X(), { debts: x } = C(), { onEvent: E } = M(), { isCopyLoaded: k, isInitialized: S, setSelectedAccounts: u } = Ae(), { setSelectedAccount: A } = Ie(), { selectedDebtPriority: V, setSelectedDebtChartData: Y } = R(), { visibleDebtAccounts: b } = Z(), { goalsLoaded: w, loadGoals: I, monthlyCashFlowProfile: N } = z(), { debts: P } = q(), H = y.useMemo(() => {
1369
- const F = N?.extra_payment ?? 0;
1370
- return Et(P, V, F);
1371
- }, [P, V, N]);
1372
- y.useEffect(() => {
1373
- u(b), E(v.DEBTS_VIEW);
1374
- }, []), y.useEffect(() => {
1375
- u(b);
1376
- }, [b]), y.useEffect(() => {
1377
- S && I().finally();
1378
- }, [S]);
1379
- const ae = (F) => h(F), oe = () => {
1380
- const F = b.find((Q) => Q.guid === c), ne = H.find((Q) => Q.guid === c);
1381
- F && A(F), ne && Y(ne), r(!0);
1382
- }, fe = () => E(v.DEBTS_CLICK_FILTER), ge = () => {
1383
- m(!0), E(v.DEBTS_CLICK_SNOWBALL_CTA);
1384
- }, xe = () => {
1385
- l(!0), E(v.DEBTS_CLICK_PAYDOWN);
1386
- };
1387
- return !w || !k || !S ? /* @__PURE__ */ e(Ye, {}) : /* @__PURE__ */ s(
1388
- Re,
1389
- {
1390
- accountOptions: b,
1391
- actions: [
1392
- /* @__PURE__ */ e(At, {}, "prioritize-debts"),
1393
- /* @__PURE__ */ e(It, { onClick: xe }, "extra-paydown")
1394
- ],
1395
- onAccountsFilterClick: fe,
1396
- onBackClick: a,
1397
- sx: o,
1398
- title: x.title,
1399
- children: [
1400
- /* @__PURE__ */ s(f, { sx: { px: p ? "48px" : "24px" }, children: [
1401
- /* @__PURE__ */ s(
1402
- f,
1403
- {
1404
- sx: {
1405
- alignItems: g ? "flex-start" : "flex-end",
1406
- flexDirection: g ? "column" : "row",
1407
- mx: g ? "-12px" : 0
1408
- },
1409
- children: [
1410
- /* @__PURE__ */ e(
1411
- ye,
1412
- {
1413
- debts: H,
1414
- height: g ? 250 : void 0,
1415
- hoveredDebtGuid: c,
1416
- onClickArea: oe,
1417
- onHoverArea: ae,
1418
- sx: { mr: g ? "4px" : "-48px" }
1419
- }
1420
- ),
1421
- /* @__PURE__ */ e(
1422
- qe,
1423
- {
1424
- debts: H,
1425
- onClickCta: ge,
1426
- sx: { mb: g ? "0px" : "64px" }
1427
- }
1428
- )
1429
- ]
1430
- }
1431
- ),
1432
- /* @__PURE__ */ e(f, { sx: { mx: g ? "-24px" : 0 }, children: /* @__PURE__ */ e(
1433
- St,
1434
- {
1435
- debts: H,
1436
- hoveredDebtGuid: c,
1437
- onClickRow: oe,
1438
- onHoverRow: ae
1439
- }
1440
- ) })
1441
- ] }),
1442
- /* @__PURE__ */ e(
1443
- Je,
1444
- {
1445
- isOpen: d,
1446
- onClose: () => m(!1)
1447
- }
1448
- ),
1449
- /* @__PURE__ */ e(ut, { isOpen: n, onClose: () => r(!1) }),
1450
- /* @__PURE__ */ e(ft, { isOpen: t, onClose: () => l(!1) })
1451
- ]
1452
- }
1453
- );
1454
- }, wr = D(Bt);
1455
- export {
1456
- ye as DebtsChart,
1457
- Sr as DebtsStore,
1458
- St as DebtsTable,
1459
- wr as DebtsWidget
1460
- };