@mx-cartographer/experiences 4.0.14-alpha.JB0 → 4.0.14-alpha.JB2

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 (75) hide show
  1. package/dist/AccountStore-B23-oV1B.mjs +244 -0
  2. package/dist/AccountStore-B23-oV1B.mjs.map +1 -0
  3. package/dist/BeatApi-BxXgbSJY.mjs +99 -0
  4. package/dist/BeatApi-BxXgbSJY.mjs.map +1 -0
  5. package/dist/BudgetUtil-BSn9Zr71.mjs +208 -0
  6. package/dist/BudgetUtil-BSn9Zr71.mjs.map +1 -0
  7. package/dist/CashflowApi-zcebgnO1.mjs +103 -0
  8. package/dist/CashflowApi-zcebgnO1.mjs.map +1 -0
  9. package/dist/CashflowStore-gPEEBiXo.mjs +53 -0
  10. package/dist/CashflowStore-gPEEBiXo.mjs.map +1 -0
  11. package/dist/Categories-XVFviD23.mjs +117 -0
  12. package/dist/Categories-XVFviD23.mjs.map +1 -0
  13. package/dist/CategoryStore-CSNSMNA6.mjs +298 -0
  14. package/dist/CategoryStore-CSNSMNA6.mjs.map +1 -0
  15. package/dist/ConnectMiniWidget-Ep65CtHH.mjs +10854 -0
  16. package/dist/ConnectMiniWidget-Ep65CtHH.mjs.map +1 -0
  17. package/dist/DebtsStore-Duf3n1vZ.mjs +127 -0
  18. package/dist/DebtsStore-Duf3n1vZ.mjs.map +1 -0
  19. package/dist/Donut-DgMeKScZ.mjs +53 -0
  20. package/dist/Donut-DgMeKScZ.mjs.map +1 -0
  21. package/dist/Fetch-DpUi1_Dx.mjs +99 -0
  22. package/dist/Fetch-DpUi1_Dx.mjs.map +1 -0
  23. package/dist/GoalStore-BYoRLx99.mjs +128 -0
  24. package/dist/GoalStore-BYoRLx99.mjs.map +1 -0
  25. package/dist/MerchantStore-RhLvDvX-.mjs +118 -0
  26. package/dist/MerchantStore-RhLvDvX-.mjs.map +1 -0
  27. package/dist/NetWorthStore-syD1VnxE.mjs +66 -0
  28. package/dist/NetWorthStore-syD1VnxE.mjs.map +1 -0
  29. package/dist/NotificationStore-CqTYHfJC.mjs +141 -0
  30. package/dist/NotificationStore-CqTYHfJC.mjs.map +1 -0
  31. package/dist/RecurringActivityStore-B_COvGWG.mjs +304 -0
  32. package/dist/RecurringActivityStore-B_COvGWG.mjs.map +1 -0
  33. package/dist/StackedLineChart-CCqGRwvs.mjs +342 -0
  34. package/dist/StackedLineChart-CCqGRwvs.mjs.map +1 -0
  35. package/dist/TransactionStore-BUrjBWkk.mjs +478 -0
  36. package/dist/TransactionStore-BUrjBWkk.mjs.map +1 -0
  37. package/dist/index.es.js +12 -17869
  38. package/dist/index.es.js.map +1 -1
  39. package/dist/index.es10.js +107 -0
  40. package/dist/index.es10.js.map +1 -0
  41. package/dist/index.es11.js +159 -0
  42. package/dist/index.es11.js.map +1 -0
  43. package/dist/index.es12.js +483 -0
  44. package/dist/index.es12.js.map +1 -0
  45. package/dist/index.es13.js +620 -0
  46. package/dist/index.es13.js.map +1 -0
  47. package/dist/index.es14.js +788 -0
  48. package/dist/index.es14.js.map +1 -0
  49. package/dist/index.es15.js +891 -0
  50. package/dist/index.es15.js.map +1 -0
  51. package/dist/index.es16.js +962 -0
  52. package/dist/index.es16.js.map +1 -0
  53. package/dist/index.es17.js +1904 -0
  54. package/dist/index.es17.js.map +1 -0
  55. package/dist/index.es2.js +11 -0
  56. package/dist/index.es2.js.map +1 -0
  57. package/dist/index.es3.js +10 -0
  58. package/dist/index.es3.js.map +1 -0
  59. package/dist/index.es4.js +9 -0
  60. package/dist/index.es4.js.map +1 -0
  61. package/dist/index.es5.js +7 -0
  62. package/dist/index.es5.js.map +1 -0
  63. package/dist/index.es6.js +7 -0
  64. package/dist/index.es6.js.map +1 -0
  65. package/dist/index.es7.js +10 -0
  66. package/dist/index.es7.js.map +1 -0
  67. package/dist/index.es8.js +10 -0
  68. package/dist/index.es8.js.map +1 -0
  69. package/dist/index.es9.js +18 -0
  70. package/dist/index.es9.js.map +1 -0
  71. package/dist/useCombineEvents-CZUDHE96.mjs +170 -0
  72. package/dist/useCombineEvents-CZUDHE96.mjs.map +1 -0
  73. package/dist/usePrevious-BLb3umpI.mjs +11 -0
  74. package/dist/usePrevious-BLb3umpI.mjs.map +1 -0
  75. package/package.json +1 -1
@@ -0,0 +1,962 @@
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ import d from "react";
3
+ import { observer as A } from "mobx-react-lite";
4
+ import U from "@mui/material/Box";
5
+ import m from "@mui/material/Stack";
6
+ import V from "@mui/material/styles/useTheme";
7
+ import { Icon as $, Text as u, CategoryIcon as F, H3 as pe, H1 as Te } from "@kyper/mui";
8
+ import "bowser";
9
+ import "date-fns/getUnixTime";
10
+ import "date-fns/intlFormat";
11
+ import { a5 as I, ab as T, ar as Y, ai as Z, a9 as re, b9 as we, aa as ge, az as ne, at as M, aD as De, a7 as B, a8 as he, b7 as q, au as Q, aQ as oe, a6 as R, av as k, r as Oe, aG as Ee, aE as G, j as Re, i as Le, x as be, z as $e, v as ke, aA as Pe } from "./ConnectMiniWidget-Ep65CtHH.mjs";
12
+ import "@honeybadger-io/react";
13
+ import "date-fns/addMonths";
14
+ import "date-fns/addQuarters";
15
+ import "date-fns/addWeeks";
16
+ import "date-fns/addYears";
17
+ import "date-fns/getDay";
18
+ import "date-fns/isBefore";
19
+ import "date-fns/nextDay";
20
+ import "date-fns/setDate";
21
+ import "date-fns/startOfToday";
22
+ import "date-fns/fromUnixTime";
23
+ import ye from "@mui/material/Button";
24
+ import Me from "@mui/material/Tooltip";
25
+ import Ge from "@mui/material/IconButton";
26
+ import "@mui/material/useMediaQuery";
27
+ import "@mxenabled/cssinjs";
28
+ import "date-fns/addDays";
29
+ import "date-fns/eachDayOfInterval";
30
+ import "date-fns/eachWeekOfInterval";
31
+ import "date-fns/endOfMonth";
32
+ import "date-fns/format";
33
+ import "date-fns/isSameMonth";
34
+ import { startOfMonth as Ne } from "date-fns/startOfMonth";
35
+ import "date-fns/subMonths";
36
+ import "@mui/material/Paper";
37
+ import "@mui/icons-material/KeyboardArrowLeftRounded";
38
+ import "@mui/icons-material/KeyboardArrowRightRounded";
39
+ import "date-fns/isSameDay";
40
+ import "date-fns/isWithinInterval";
41
+ import * as O from "d3";
42
+ import "@mui/material/styles";
43
+ import "@mui/x-charts";
44
+ import "@mui/material";
45
+ import "date-fns/differenceInCalendarDays";
46
+ import "date-fns/endOfToday";
47
+ import "date-fns/endOfYear";
48
+ import "date-fns/startOfYear";
49
+ import { subDays as je } from "date-fns/subDays";
50
+ import "date-fns/subYears";
51
+ import "@mui/material/ButtonGroup";
52
+ import ce from "@mui/material/Tab";
53
+ import ze from "@mui/material/Tabs";
54
+ import "@mui/material/ToggleButton";
55
+ import "@mui/material/ToggleButtonGroup";
56
+ import "@mui/material/Dialog";
57
+ import "@mui/material/DialogContent";
58
+ import "@mui/icons-material/ArrowBackOutlined";
59
+ import "uuid";
60
+ import "@mui/material/CircularProgress";
61
+ import "@mui/material/FormControlLabel";
62
+ import "@mui/material/Radio";
63
+ import "@mui/material/Avatar";
64
+ import W from "@mui/material/ListItem";
65
+ import J from "@mui/material/ListItemAvatar";
66
+ import H from "@mui/material/ListItemButton";
67
+ import X from "@mui/material/ListItemText";
68
+ import "@mui/material/ListItemIcon";
69
+ import "mobx";
70
+ import { u as Ue, S as _e } from "./BudgetUtil-BSn9Zr71.mjs";
71
+ import "date-fns/differenceInDays";
72
+ import "@mui/x-data-grid-pro";
73
+ import "date-fns";
74
+ import "date-fns/getMonth";
75
+ import { isAfter as Fe } from "date-fns/isAfter";
76
+ import "date-fns/parseISO";
77
+ import "date-fns/subWeeks";
78
+ import "date-fns/formatISO";
79
+ import "numeral";
80
+ import ae from "@mui/material/Card";
81
+ import fe from "@mui/material/CardHeader";
82
+ import ie from "@mui/material/CardContent";
83
+ import We from "@mui/material/Alert";
84
+ import He from "@mui/material/Snackbar";
85
+ import ee from "@mui/material/Divider";
86
+ import K from "@mui/material/List";
87
+ import Xe from "@mui/material/ListItemSecondaryAction";
88
+ const le = 5, Ke = 100, Ve = 25, Ye = (t) => {
89
+ const o = (a) => {
90
+ a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
91
+ }, s = (a) => {
92
+ a.subject.fx = a.x, a.subject.fy = a.y;
93
+ }, i = (a) => {
94
+ a.active || t.alphaTarget(0), a.subject.fx = null, a.subject.fy = null;
95
+ };
96
+ return O.drag().on("start", o).on("drag", s).on("end", i);
97
+ }, Ze = (t) => {
98
+ let o = t.transaction_total / t.amount;
99
+ o < 0 ? o = 0 : o > 1 && (o = 1);
100
+ const s = o * 2 * Math.PI, i = O.interpolate(0, s), a = O.arc().cornerRadius(5).innerRadius(t.radius - le * 2).outerRadius(t.radius - le).startAngle(0).endAngle(0);
101
+ return (n) => (a.endAngle(i(n)), a(t) || "");
102
+ }, qe = (t) => {
103
+ O.selectAll(".bubble").call(Ye(t));
104
+ }, Qe = (t, o, s) => {
105
+ t.alpha(1).restart().force(
106
+ "x",
107
+ O.forceX().x(s / 2).strength(0.01)
108
+ ).force(
109
+ "y",
110
+ O.forceY().y(o / 2).strength(0.01)
111
+ );
112
+ }, Je = (t, o) => O.scaleLinear().domain([t, o]).range([Ve, Ke]), et = (t) => {
113
+ const o = t.reduce((n, r) => {
114
+ const c = Math.max(r.transaction_total, r.amount);
115
+ return c > n ? c : n;
116
+ }, 0), s = t.reduce((n, r) => {
117
+ const c = Math.max(r.transaction_total, r.amount);
118
+ return c < n ? c : n;
119
+ }, o), i = Je(s, o), a = t.map((n) => {
120
+ const r = i(Math.max(n.transaction_total, n.amount)) || 25;
121
+ return {
122
+ ...n,
123
+ radius: r
124
+ };
125
+ });
126
+ return O.forceSimulation(a).velocityDecay(0.05).force("collide", O.forceCollide((n) => n.radius + 2).strength(0.5)).on("tick", () => {
127
+ O.selectAll(".bubble").data(a).attr("transform", (n) => `translate(${n.x},${n.y})`);
128
+ });
129
+ }, de = 5, tt = 2e3;
130
+ function nt({ bubble: t }) {
131
+ const o = V(), {
132
+ guid: s,
133
+ budgetColors: { mercury: i },
134
+ radius: a
135
+ } = t, n = `mercury-${s}`;
136
+ d.useEffect(() => {
137
+ O.select(`.${n}`).selectAll(".status").remove(), O.select(`.${n}`).append("path").transition().duration(tt).delay(0).attr("class", "status").attr("style", `fill: ${i}; fill-opacity: 1;`).attrTween("d", () => Ze(t));
138
+ }, [t]);
139
+ const r = O.arc().innerRadius((c) => c - 2 * de).outerRadius((c) => c - de).startAngle(0).endAngle(2 * Math.PI);
140
+ return /* @__PURE__ */ e("g", { className: n, children: /* @__PURE__ */ e(
141
+ "path",
142
+ {
143
+ d: r(a) || "",
144
+ style: { fill: o.palette.common.white, fillOpacity: 0.35 }
145
+ }
146
+ ) });
147
+ }
148
+ const P = 75, ue = 50;
149
+ function ot({ bubble: t, isDraggable: o, onClick: s = () => {
150
+ } }) {
151
+ const [i, a] = d.useState(!1);
152
+ if (d.useEffect(() => {
153
+ document.fonts.ready.then(() => {
154
+ const w = O.select(`.icon-${c}`), _ = w.node()?.getComputedTextLength();
155
+ w.attr("x", () => p < P ? _ ? _ / 2 - 12 : 12 : _ ? _ / 2 - 16 : 16);
156
+ });
157
+ }, []), !t) return;
158
+ const {
159
+ budgetColors: { background: n, text: r },
160
+ category: { icon: c, name: b },
161
+ guid: h,
162
+ description: g,
163
+ radius: p,
164
+ x: y,
165
+ y: x
166
+ } = t;
167
+ let C = 13;
168
+ p > 75 ? C = -20 : p > 50 && (C = -6);
169
+ const v = `${t.category.name}: ${g}`, D = {
170
+ modifiers: [
171
+ {
172
+ name: "offset",
173
+ options: { offset: [0, 15] }
174
+ }
175
+ ]
176
+ };
177
+ return /* @__PURE__ */ l(
178
+ "g",
179
+ {
180
+ className: "bubble",
181
+ id: `bubble-${h}`,
182
+ onClick: () => s(t),
183
+ onMouseEnter: () => a(!0),
184
+ onMouseLeave: () => a(!1),
185
+ style: { cursor: o ? "pointer" : "default" },
186
+ textAnchor: "middle",
187
+ x: y,
188
+ y: x,
189
+ children: [
190
+ /* @__PURE__ */ e(
191
+ Me,
192
+ {
193
+ followCursor: !0,
194
+ open: i,
195
+ slotProps: { popper: D },
196
+ title: v,
197
+ children: /* @__PURE__ */ e("circle", { fill: n, id: `circle-${h}`, r: p })
198
+ }
199
+ ),
200
+ /* @__PURE__ */ e(
201
+ $,
202
+ {
203
+ className: `icon-${c}`,
204
+ component: "text",
205
+ name: c,
206
+ size: p <= P ? 24 : 32,
207
+ sx: {
208
+ fill: r
209
+ },
210
+ y: C
211
+ }
212
+ ),
213
+ p > P && /* @__PURE__ */ e(
214
+ u,
215
+ {
216
+ bold: !0,
217
+ component: "text",
218
+ id: `budget-category-${h}`,
219
+ sx: { fill: r },
220
+ variant: "Small",
221
+ y: 4,
222
+ children: b
223
+ }
224
+ ),
225
+ p > ue && /* @__PURE__ */ e(
226
+ u,
227
+ {
228
+ bold: !0,
229
+ component: "text",
230
+ id: `budget-description-${h}-1`,
231
+ sx: { fill: r },
232
+ variant: "Body",
233
+ y: p <= P ? 12 : 24,
234
+ children: p <= P ? g.split(" ")[0] : g
235
+ }
236
+ ),
237
+ p <= P && p > ue && /* @__PURE__ */ e(
238
+ u,
239
+ {
240
+ component: "text",
241
+ id: `budget-description-${h}-2`,
242
+ sx: { fill: r },
243
+ variant: "XSmall",
244
+ y: 28,
245
+ children: g.split(" ")[1]
246
+ }
247
+ ),
248
+ /* @__PURE__ */ e(nt, { bubble: t })
249
+ ]
250
+ },
251
+ h
252
+ );
253
+ }
254
+ let z;
255
+ const rt = ({
256
+ height: t,
257
+ width: o,
258
+ isDraggable: s = !1,
259
+ onClick: i = () => {
260
+ }
261
+ }) => {
262
+ const { detailedBudgets: a } = I();
263
+ return z = d.useMemo(() => et(a), [a]), d.useEffect(() => {
264
+ Qe(z, t, o), s && qe(z);
265
+ }, [z, t, o]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(o), children: z.nodes().map((n) => /* @__PURE__ */ e(ot, { bubble: n, isDraggable: s, onClick: i }, n.guid)) });
266
+ }, at = A(rt), it = () => {
267
+ const { budgets: t } = T();
268
+ return /* @__PURE__ */ l(m, { alignItems: "center", gap: 12, sx: { mx: 24, textAlign: "center" }, children: [
269
+ /* @__PURE__ */ e($, { name: "bubble_chart", size: 48 }),
270
+ /* @__PURE__ */ e(u, { bold: !0, variant: "Paragraph", children: t.zero_state_title }),
271
+ /* @__PURE__ */ e(u, { sx: { whiteSpace: "wrap" }, variant: "Paragraph", children: t.zero_state_description })
272
+ ] });
273
+ }, Ce = A(
274
+ ({ height: t, isDraggable: o = !1, shouldShowZeroState: s, unavailableWidth: i = 24 }) => {
275
+ const { onEvent: a } = Y(), { setSelectedBudget: n } = I(), { isLoadingCategoryTotals: r } = Z(), { isInitialized: c } = re(), { availableWidth: b } = we(), { isMobile: h } = ge(), g = d.useMemo(() => b - i, [b]), p = (y) => {
276
+ n(y), a(M.BUDGETS_CLICK_BUDGET_CATEGORY, {
277
+ budget_category: y.category.name,
278
+ click_type: "bubble"
279
+ });
280
+ };
281
+ return r ? /* @__PURE__ */ e(m, { alignItems: "center", height: t, justifyContent: "center", width: Math.abs(g), children: /* @__PURE__ */ e(ne, {}) }) : /* @__PURE__ */ e(U, { ml: s || h ? 0 : 24, children: s || !c ? /* @__PURE__ */ e(it, {}) : /* @__PURE__ */ e(
282
+ at,
283
+ {
284
+ height: t,
285
+ isDraggable: o,
286
+ onClick: p,
287
+ width: g
288
+ }
289
+ ) });
290
+ }
291
+ ), st = (t) => {
292
+ const o = V(), { budgets: s, loadBudgets: i, setTheme: a } = I(), { budgets: n } = T(), r = Ue(), c = s.length === 0;
293
+ return d.useEffect(() => {
294
+ a(o), i().finally();
295
+ }, []), /* @__PURE__ */ e(
296
+ De,
297
+ {
298
+ primaryCtaLabel: c ? n.get_started_cta : n.details_cta,
299
+ title: n.budgets_title,
300
+ ...t,
301
+ children: /* @__PURE__ */ l(m, { height: 450, mt: 32, children: [
302
+ /* @__PURE__ */ e(Ce, { height: 370, shouldShowZeroState: c }),
303
+ !c && /* @__PURE__ */ l(U, { ml: 16, children: [
304
+ /* @__PURE__ */ e(u, { bold: !0, color: r < 0 ? "error.main" : "success.main", children: B(Math.abs(r), "0,0") }),
305
+ /* @__PURE__ */ e(u, { children: r < 0 ? n.overspent_in_budgets : n.left_in_budgets })
306
+ ] })
307
+ ] })
308
+ }
309
+ );
310
+ }, to = A(st), ct = ({ budget: t, onClick: o }) => {
311
+ const {
312
+ amount: s,
313
+ budgetColors: { background: i, description: a },
314
+ category_guid: n,
315
+ description: r,
316
+ percentage: c,
317
+ subBudgets: b,
318
+ transaction_total: h
319
+ } = t;
320
+ return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(H, { onClick: () => o?.(t), children: [
321
+ /* @__PURE__ */ e(J, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(_e, { color: i, percent: c, size: 40, children: /* @__PURE__ */ e(F, { categoryGuid: n, variant: "basic" }) }) }),
322
+ /* @__PURE__ */ e(
323
+ X,
324
+ {
325
+ primary: /* @__PURE__ */ l(m, { component: "span", direction: "row", justifyContent: "space-between", children: [
326
+ /* @__PURE__ */ e(u, { bold: !0, variant: "Body", children: t.category.name }),
327
+ /* @__PURE__ */ e(u, { fontWeight: 400, variant: "Body", children: `
328
+ ${B(h, "0,0")} /
329
+ ${B(s, "0,0")}
330
+ ` })
331
+ ] }),
332
+ secondary: /* @__PURE__ */ l(m, { component: "span", direction: "row", justifyContent: "space-between", children: [
333
+ /* @__PURE__ */ e(u, { variant: "XSmall", children: `${b.length} Sub-budgets` }),
334
+ /* @__PURE__ */ e(u, { bold: c > 100, color: a, variant: "XSmall", children: r })
335
+ ] })
336
+ }
337
+ )
338
+ ] }) });
339
+ }, lt = A(() => {
340
+ const { onEvent: t } = Y(), { budgets: o } = T(), { detailedBudgets: s, setSelectedBudget: i } = I(), a = (n) => {
341
+ i(n), t(M.BUDGETS_CLICK_BUDGET_CATEGORY, {
342
+ budget_category: n.category.name,
343
+ click_type: "list"
344
+ });
345
+ };
346
+ return /* @__PURE__ */ l(ae, { elevation: 2, sx: { borderRadius: 2 }, children: [
347
+ /* @__PURE__ */ e(fe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(pe, { children: o.budget_categories_title }) }),
348
+ /* @__PURE__ */ e(ie, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(K, { children: s.map((n) => /* @__PURE__ */ l(d.Fragment, { children: [
349
+ /* @__PURE__ */ e(ct, { budget: n, onClick: a }),
350
+ /* @__PURE__ */ e(ee, {})
351
+ ] }, n.guid)) }) })
352
+ ] });
353
+ }), dt = A(() => {
354
+ const t = V(), { onEvent: o } = Y(), { accounts: s } = he(), { budgets: i, common: a, recurring: n } = T(), { incomeCategories: r, spendCategories: c } = Z(), { detailedBudgets: b, totalBudgeted: h } = I(), { projectedIncome: g } = q(), { setFilter: p } = Q(), [y, x] = d.useState(!1), [C, v] = d.useMemo(() => {
355
+ const S = c.reduce((N, j) => N + j.totalAmount, 0);
356
+ let f = S / h;
357
+ f > 1 && (f = 1);
358
+ let E = t.palette.success.main;
359
+ f > 0.8 && f < 1 ? E = t.palette.warning.main : f >= 1 && (E = t.palette.error.main);
360
+ const L = [
361
+ {
362
+ color: E,
363
+ percentage: `${f}`
364
+ }
365
+ ];
366
+ return [S, L];
367
+ }, [b, c]), [D, w] = d.useMemo(() => {
368
+ const S = Math.abs(
369
+ r.reduce((L, N) => L + N.totalAmount, 0)
370
+ );
371
+ let f = S / g;
372
+ f > 1 && (f = 1);
373
+ const E = [
374
+ {
375
+ color: t.palette.secondary.main,
376
+ percentage: `${f}`
377
+ }
378
+ ];
379
+ return [S, E];
380
+ }, [r, g]), _ = () => {
381
+ p({
382
+ accounts: s.map((S) => S.guid),
383
+ dateRange: {
384
+ start: je(/* @__PURE__ */ new Date(), 90),
385
+ end: /* @__PURE__ */ new Date()
386
+ }
387
+ }), x(!0), o(M.BUDGETS_CLICK_EDIT_INCOME);
388
+ };
389
+ return /* @__PURE__ */ l(ae, { elevation: 2, sx: { overflow: "visible", borderRadius: 2 }, children: [
390
+ /* @__PURE__ */ e(fe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(pe, { children: i.overview_title }) }),
391
+ /* @__PURE__ */ e(ie, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ l(m, { gap: 24, children: [
392
+ /* @__PURE__ */ l(m, { gap: 8, children: [
393
+ /* @__PURE__ */ e(u, { bold: !0, sx: { mb: 8 }, variant: "Body", children: i.spending_title }),
394
+ /* @__PURE__ */ e(oe, { data: v, height: 16 }),
395
+ /* @__PURE__ */ e(u, { variant: "Small", children: R(
396
+ i.spending_description,
397
+ B(C, "0,0"),
398
+ B(h, "0,0")
399
+ ) })
400
+ ] }),
401
+ /* @__PURE__ */ l(m, { gap: 8, children: [
402
+ /* @__PURE__ */ l(m, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
403
+ /* @__PURE__ */ e(u, { bold: !0, variant: "Body", children: i.income_title }),
404
+ /* @__PURE__ */ e(
405
+ Ge,
406
+ {
407
+ "aria-label": n.manage_income,
408
+ onClick: _,
409
+ sx: { p: 0 },
410
+ children: /* @__PURE__ */ e($, { name: "edit" })
411
+ }
412
+ )
413
+ ] }),
414
+ /* @__PURE__ */ e(oe, { data: w, height: 16 }),
415
+ /* @__PURE__ */ e(u, { variant: "Small", children: R(
416
+ i.income_description,
417
+ B(D, "0,0"),
418
+ B(g, "0,0")
419
+ ) })
420
+ ] })
421
+ ] }) }),
422
+ /* @__PURE__ */ e(
423
+ k,
424
+ {
425
+ ariaLabelClose: a.close_aria,
426
+ isOpen: y,
427
+ onClose: () => x(!1),
428
+ title: n.manage_income,
429
+ children: /* @__PURE__ */ l(m, { gap: 4, children: [
430
+ /* @__PURE__ */ e(u, { bold: !0, sx: { mt: 12, mx: 24 }, variant: "Small", children: i.income_title }),
431
+ /* @__PURE__ */ e(Oe, {})
432
+ ] })
433
+ }
434
+ )
435
+ ] });
436
+ }), ut = A(() => {
437
+ const { budgets: t } = T(), { totalBudgeted: o } = I(), { projectedIncome: s } = q(), i = s - o;
438
+ return /* @__PURE__ */ l(m, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
439
+ /* @__PURE__ */ l(m, { alignItems: "center", children: [
440
+ /* @__PURE__ */ e(u, { bold: !0, variant: "Body", children: B(s, "0,0") }),
441
+ /* @__PURE__ */ e(u, { color: "secondary", variant: "Small", children: t.projected_income })
442
+ ] }),
443
+ /* @__PURE__ */ e(u, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
444
+ /* @__PURE__ */ l(m, { alignItems: "center", children: [
445
+ /* @__PURE__ */ e(u, { bold: !0, variant: "Body", children: B(o, "0,0") }),
446
+ /* @__PURE__ */ e(u, { color: "secondary", variant: "Small", children: t.budgeted })
447
+ ] }),
448
+ /* @__PURE__ */ e(u, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
449
+ /* @__PURE__ */ l(m, { alignItems: "center", children: [
450
+ /* @__PURE__ */ e(u, { bold: !0, variant: "Body", children: B(i, "0,0") }),
451
+ /* @__PURE__ */ e(u, { color: "secondary", variant: "Small", children: t.remaining })
452
+ ] })
453
+ ] });
454
+ }), mt = A(
455
+ ({ category: t }) => {
456
+ const { budgets: o } = T(), { budgets: s } = I(), i = d.useMemo(() => {
457
+ const a = s.find((c) => c.category_guid === t.guid), n = B(t.totalAverageAmount, "0,0"), r = a ? R(o.recalculate_previous_budget, B(a.amount, "0,0")) : o.recalculate_new_budget;
458
+ return `${n} - ${r}`;
459
+ }, [o, s]);
460
+ return /* @__PURE__ */ l(d.Fragment, { children: [
461
+ /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(H, { children: [
462
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(F, { categoryGuid: t.guid, variant: "filled" }) }),
463
+ /* @__PURE__ */ e(X, { primary: t.name, secondary: i })
464
+ ] }) }),
465
+ /* @__PURE__ */ e(ee, {})
466
+ ] }, t.guid);
467
+ }
468
+ ), pt = ({ onRecalculateBudgets: t }) => {
469
+ const { budgets: o, common: s } = T(), { spendCategories: i } = Z(), { recalculateBudgets: a, setAlert: n } = I(), [r, c] = d.useState(!1), b = i.filter((g) => g.totalAverageAmount > 0), h = async () => {
470
+ await a(b), c(!1), n(o.alert_recalculated_budgets), t?.();
471
+ };
472
+ return /* @__PURE__ */ l(d.Fragment, { children: [
473
+ /* @__PURE__ */ e(ye, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: o.recalculate_button }),
474
+ /* @__PURE__ */ e(u, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "Paragraph", children: o.recalculate_help }),
475
+ /* @__PURE__ */ e(
476
+ k,
477
+ {
478
+ ariaLabelClose: s.close_aria,
479
+ isOpen: r,
480
+ onClose: () => c(!1),
481
+ onPrimaryAction: h,
482
+ title: o.recalculate_title,
483
+ children: /* @__PURE__ */ l(m, { children: [
484
+ /* @__PURE__ */ l(m, { mx: 24, my: 16, children: [
485
+ /* @__PURE__ */ e(u, { bold: !0, variant: "Body", children: o.recalculate_description_top }),
486
+ /* @__PURE__ */ e(u, { variant: "ParagraphSmall", children: o.recalculate_description_bottom })
487
+ ] }),
488
+ /* @__PURE__ */ e(U, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: b.map((g) => /* @__PURE__ */ e(mt, { category: g }, g.guid)) }) })
489
+ ] })
490
+ }
491
+ )
492
+ ] });
493
+ }, te = ({
494
+ amount: t,
495
+ categoryName: o,
496
+ onAmountChanged: s
497
+ }) => {
498
+ const { budgets: i } = T(), { totalBudgeted: a } = I(), { projectedIncome: n } = q(), r = n - a;
499
+ return /* @__PURE__ */ l(m, { gap: 16, children: [
500
+ /* @__PURE__ */ l(m, { children: [
501
+ /* @__PURE__ */ e(u, { children: R(
502
+ i.add_description_top,
503
+ B(r, "0,0")
504
+ ) }),
505
+ /* @__PURE__ */ e(u, { children: R(i.add_description_bottom, o) })
506
+ ] }),
507
+ /* @__PURE__ */ e(
508
+ Ee,
509
+ {
510
+ amount: t,
511
+ autoFocus: !0,
512
+ label: i.add_label,
513
+ minAmount: 0,
514
+ setAmount: s,
515
+ sx: { ".MuiTypography-Body": { p: 0 } }
516
+ }
517
+ )
518
+ ] });
519
+ }, gt = A(({ category: t, onAddBudget: o }) => {
520
+ const { budgets: s, common: i } = T(), [a, n] = d.useState(!1), [r, c] = d.useState(
521
+ `${t.totalAmount === 0 ? "" : t.totalAmount}`
522
+ );
523
+ return /* @__PURE__ */ l(d.Fragment, { children: [
524
+ /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(H, { onClick: () => n(!0), children: [
525
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(F, { categoryGuid: t.guid }) }),
526
+ /* @__PURE__ */ e(
527
+ X,
528
+ {
529
+ primary: t.name,
530
+ secondary: B(t.totalAmount, "0,0")
531
+ }
532
+ ),
533
+ /* @__PURE__ */ e(Xe, { children: /* @__PURE__ */ e($, { name: "add", size: 20 }) })
534
+ ] }) }, t.guid),
535
+ /* @__PURE__ */ e(
536
+ G,
537
+ {
538
+ copy: { close_aria: i.close_aria, title: s.add_title },
539
+ disablePrimaryButton: Number(r) <= 0,
540
+ isOpen: a,
541
+ onClose: () => n(!1),
542
+ onPrimaryAction: () => o(t, Number(r)),
543
+ primaryText: s.add_save_button,
544
+ children: /* @__PURE__ */ e(te, { amount: r, categoryName: t.name, onAmountChanged: c })
545
+ }
546
+ )
547
+ ] });
548
+ }), ht = A(({ onRecalculateBudgets: t }) => {
549
+ const { budgets: o } = T(), { addBudget: s, setAlert: i, unbudgetedCategories: a } = I(), n = async (r, c) => {
550
+ await s(r, c), i(R(o.alert_budget_created, r.name));
551
+ };
552
+ return /* @__PURE__ */ l(m, { children: [
553
+ /* @__PURE__ */ e(ut, {}),
554
+ /* @__PURE__ */ e(U, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: a.map((r) => /* @__PURE__ */ e(
555
+ gt,
556
+ {
557
+ category: r,
558
+ onAddBudget: n
559
+ },
560
+ r.guid
561
+ )) }) }),
562
+ /* @__PURE__ */ e(pt, { onRecalculateBudgets: t })
563
+ ] });
564
+ }), Se = ({ budget: t }) => {
565
+ const {
566
+ amount: o,
567
+ budgetColors: { background: s },
568
+ category: { name: i },
569
+ category_guid: a,
570
+ percentage: n,
571
+ transaction_total: r
572
+ } = t, c = [
573
+ {
574
+ color: s,
575
+ percentage: `${n}%`
576
+ }
577
+ ];
578
+ return /* @__PURE__ */ e(ae, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(ie, { children: /* @__PURE__ */ l(m, { alignItems: "center", gap: 16, children: [
579
+ /* @__PURE__ */ e(F, { categoryGuid: a, size: 56 }),
580
+ /* @__PURE__ */ e(Te, { children: `${B(r, "0,0")} / ${B(o, "0,0")}` }),
581
+ /* @__PURE__ */ e(u, { bold: !0, variant: "XSmall", children: i }),
582
+ /* @__PURE__ */ e(oe, { data: c, height: 10 })
583
+ ] }) }) });
584
+ }, bt = A(() => {
585
+ const { budgets: t } = T();
586
+ return /* @__PURE__ */ l(m, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
587
+ /* @__PURE__ */ e($, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
588
+ /* @__PURE__ */ e(u, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
589
+ /* @__PURE__ */ e(u, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
590
+ ] });
591
+ }), yt = A(({ budget: t }) => {
592
+ const {
593
+ amount: o,
594
+ budgetColors: { background: s },
595
+ category: i,
596
+ percentage: a,
597
+ transaction_total: n
598
+ } = t, { setSelectedSubBudget: r } = I();
599
+ return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(H, { onClick: () => r(t), children: [
600
+ /* @__PURE__ */ e(J, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(_e, { color: s, percent: a, size: 40, children: /* @__PURE__ */ e(F, { categoryGuid: i.parent_guid, variant: "basic" }) }) }),
601
+ /* @__PURE__ */ e(
602
+ X,
603
+ {
604
+ primary: /* @__PURE__ */ e(m, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(u, { bold: !0, variant: "Body", children: t.category.name }) }),
605
+ secondary: /* @__PURE__ */ e(m, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(u, { fontWeight: 400, variant: "Body", children: `
606
+ ${B(n, "0,0")} /
607
+ ${B(o, "0,0")}
608
+ ` }) })
609
+ }
610
+ )
611
+ ] }) });
612
+ }), _t = A(({ category: t, parentBudget: o }) => {
613
+ const { budgets: s, common: i } = T(), { setExpandedGuid: a, setOnSelect: n } = Re(), { addBudget: r } = I(), [c, b] = d.useState(!1), [h, g] = d.useState(!1), [p, y] = d.useState(""), [x, C] = d.useState(void 0);
614
+ d.useEffect(() => {
615
+ n((w) => {
616
+ const _ = t.subCategories.find((S) => S.guid === w);
617
+ _ && (C(_), y(`${_.currentAmount === 0 ? "" : _.currentAmount}`), g(!0));
618
+ });
619
+ }, []);
620
+ const v = () => {
621
+ a(t.guid), b(!0);
622
+ }, D = async () => {
623
+ x && Number(p) > 0 && (await r(x, Number(p), o.guid), g(!1), b(!1), C(void 0));
624
+ };
625
+ return /* @__PURE__ */ l(U, { children: [
626
+ /* @__PURE__ */ e(W, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(H, { onClick: v, children: /* @__PURE__ */ e(X, { children: /* @__PURE__ */ l(m, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
627
+ /* @__PURE__ */ l(m, { alignItems: "center", direction: "row", gap: 8, children: [
628
+ /* @__PURE__ */ e($, { fill: !0, name: "add_box", size: 24, sx: { color: "action.active" } }),
629
+ /* @__PURE__ */ e(u, { bold: !0, sx: { color: "action.active" }, variant: "Body", children: s.add_sub_budget_button })
630
+ ] }),
631
+ /* @__PURE__ */ e($, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
632
+ ] }) }) }) }),
633
+ /* @__PURE__ */ e(ee, {}),
634
+ /* @__PURE__ */ e(
635
+ k,
636
+ {
637
+ ariaLabelClose: i.close_aria,
638
+ isOpen: c,
639
+ onClose: () => b(!1),
640
+ title: s.add_sub_budget_title,
641
+ children: /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(Le, { category: t, subCategories: t.subCategories }) })
642
+ }
643
+ ),
644
+ /* @__PURE__ */ e(
645
+ G,
646
+ {
647
+ copy: { close_aria: i.close_aria, title: s.add_title },
648
+ disablePrimaryButton: Number(p) <= 0,
649
+ isOpen: h,
650
+ onClose: () => g(!1),
651
+ onPrimaryAction: D,
652
+ primaryText: s.add_save_button,
653
+ children: /* @__PURE__ */ e(
654
+ te,
655
+ {
656
+ amount: p,
657
+ categoryName: x?.name || "",
658
+ onAmountChanged: y
659
+ }
660
+ )
661
+ }
662
+ )
663
+ ] });
664
+ }), ft = A(({ budget: t }) => {
665
+ const { category: o, subBudgets: s } = t, { budgets: i, common: a } = T(), { deleteBudget: n, selectedSubBudget: r, setSelectedSubBudget: c, updateBudget: b } = I(), { filter: h, setFilter: g } = Q(), [p, y] = d.useState(!1), [x, C] = d.useState(!1), [v, D] = d.useState("");
666
+ d.useEffect(() => {
667
+ r && (D(`${r.amount}`), g({
668
+ ...h,
669
+ custom: (f) => f.category_guid === r.category_guid
670
+ }));
671
+ }, [r]);
672
+ const w = async () => {
673
+ r && await b({
674
+ ...r,
675
+ amount: Number(v)
676
+ });
677
+ }, _ = async () => {
678
+ r && await n(r.guid), C(!1), S();
679
+ }, S = () => {
680
+ g({
681
+ ...h,
682
+ custom: (f) => f.category_guid === t.category_guid || f.top_level_category_guid === t.category_guid
683
+ }), c(void 0);
684
+ };
685
+ return /* @__PURE__ */ l(d.Fragment, { children: [
686
+ /* @__PURE__ */ l(K, { sx: { bgcolor: "background.paper" }, children: [
687
+ s.length === 0 ? /* @__PURE__ */ e(bt, {}) : s.map((f) => /* @__PURE__ */ l(d.Fragment, { children: [
688
+ /* @__PURE__ */ e(yt, { budget: f }),
689
+ /* @__PURE__ */ e(ee, {})
690
+ ] }, f.guid)),
691
+ /* @__PURE__ */ e(_t, { category: o, parentBudget: t })
692
+ ] }),
693
+ /* @__PURE__ */ e(
694
+ k,
695
+ {
696
+ ariaLabelClose: a.close_aria,
697
+ isOpen: !!r,
698
+ onClose: S,
699
+ onPrimaryAction: () => y(!0),
700
+ onSecondaryAction: () => C(!0),
701
+ primaryText: i.details_edit_button,
702
+ secondaryText: i.details_delete_button,
703
+ title: i.details_title,
704
+ children: r && /* @__PURE__ */ l(m, { gap: 24, children: [
705
+ /* @__PURE__ */ e(Se, { budget: r }),
706
+ /* @__PURE__ */ e(be, { height: "100%" })
707
+ ] })
708
+ }
709
+ ),
710
+ r && /* @__PURE__ */ l(d.Fragment, { children: [
711
+ /* @__PURE__ */ e(
712
+ G,
713
+ {
714
+ copy: { close_aria: a.close_aria, title: i.details_edit_title },
715
+ disablePrimaryButton: Number(v) <= 0,
716
+ isOpen: p,
717
+ onClose: () => y(!1),
718
+ onPrimaryAction: w,
719
+ primaryText: i.edit_save_button,
720
+ children: /* @__PURE__ */ e(
721
+ te,
722
+ {
723
+ amount: v,
724
+ categoryName: r.category.name,
725
+ onAmountChanged: D
726
+ }
727
+ )
728
+ }
729
+ ),
730
+ /* @__PURE__ */ e(
731
+ G,
732
+ {
733
+ copy: { close_aria: a.close_aria, title: i.delete_title },
734
+ isOpen: x,
735
+ onClose: () => C(!1),
736
+ onPrimaryAction: _,
737
+ primaryColor: "error",
738
+ primaryText: "Delete",
739
+ secondaryColor: "secondary",
740
+ children: /* @__PURE__ */ e(u, { variant: "Paragraph", children: R(i.delete_description, r.category.name) })
741
+ }
742
+ )
743
+ ] })
744
+ ] });
745
+ }), Ct = A(({ budget: t }) => {
746
+ const { budgets: o, common: s, transactions: i } = T(), { setAlert: a } = I(), { sortedTransactions: n, tags: r } = Q(), [c, b] = d.useState(0), [h, g] = d.useState(""), p = d.useMemo(
747
+ () => n.find((C) => C.guid === h),
748
+ [h]
749
+ ), y = (C, v) => {
750
+ b(v);
751
+ }, x = () => {
752
+ ke(n, r), a(o.alert_csv_downloaded);
753
+ };
754
+ return /* @__PURE__ */ l(m, { gap: 24, children: [
755
+ /* @__PURE__ */ e(Se, { budget: t }),
756
+ /* @__PURE__ */ l(m, { children: [
757
+ /* @__PURE__ */ l(
758
+ ze,
759
+ {
760
+ onChange: y,
761
+ sx: { width: "100%" },
762
+ value: c,
763
+ variant: "fullWidth",
764
+ children: [
765
+ /* @__PURE__ */ e(ce, { label: o.details_transactions_tab }),
766
+ /* @__PURE__ */ e(ce, { label: o.details_subbudgets_tab })
767
+ ]
768
+ }
769
+ ),
770
+ c === 0 && /* @__PURE__ */ l(m, { children: [
771
+ n.length > 0 && /* @__PURE__ */ e(m, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
772
+ ye,
773
+ {
774
+ onClick: x,
775
+ startIcon: /* @__PURE__ */ e($, { name: "ios_share" }),
776
+ variant: "text",
777
+ children: i.export_csv_btn
778
+ }
779
+ ) }),
780
+ /* @__PURE__ */ e(be, { height: "100%", onClick: g })
781
+ ] }),
782
+ c === 1 && /* @__PURE__ */ e(ft, { budget: t }),
783
+ /* @__PURE__ */ e(
784
+ k,
785
+ {
786
+ ariaLabelClose: s.close_aria,
787
+ isOpen: !!p,
788
+ onClose: () => g(""),
789
+ title: o.details_transaction_drawer,
790
+ children: p && /* @__PURE__ */ e($e, { transaction: p })
791
+ }
792
+ )
793
+ ] })
794
+ ] });
795
+ }), St = A(() => {
796
+ const { selectedAccountGuids: t } = re(), { budgets: o, common: s } = T(), {
797
+ dateRange: i,
798
+ deleteBudget: a,
799
+ selectedBudget: n,
800
+ selectedSubBudget: r,
801
+ setAlert: c,
802
+ setSelectedBudget: b,
803
+ updateBudget: h
804
+ } = I(), { setFilter: g } = Q(), [p, y] = d.useState(!1), [x, C] = d.useState(!1), [v, D] = d.useState(!1), [w, _] = d.useState("");
805
+ d.useEffect(() => {
806
+ n && !r && (_(`${n.amount}`), y(!0), g({
807
+ accounts: t,
808
+ dateRange: i,
809
+ custom: (L) => L.category_guid === n.category_guid || L.top_level_category_guid === n.category_guid
810
+ }));
811
+ }, [n]);
812
+ const S = async () => {
813
+ n && (await h({
814
+ ...n,
815
+ amount: Number(w),
816
+ percentage: n.category.totalAmount / Number(w) * 100
817
+ }), c(R(o.alert_budget_updated, n.category.name)));
818
+ }, f = async () => {
819
+ n && (await a(n.guid), c(R(o.alert_budget_deleted, n.category.name))), D(!1), E();
820
+ }, E = () => {
821
+ y(!1), setTimeout(() => {
822
+ b(void 0);
823
+ }, 250);
824
+ };
825
+ if (n)
826
+ return /* @__PURE__ */ l(d.Fragment, { children: [
827
+ /* @__PURE__ */ e(
828
+ k,
829
+ {
830
+ ariaLabelClose: s.close_aria,
831
+ isOpen: p,
832
+ onClose: E,
833
+ onPrimaryAction: () => C(!0),
834
+ onSecondaryAction: () => D(!0),
835
+ primaryText: o.details_edit_button,
836
+ secondaryColor: "error",
837
+ secondaryText: o.details_delete_button,
838
+ title: o.details_title,
839
+ children: /* @__PURE__ */ e(Ct, { budget: n })
840
+ }
841
+ ),
842
+ /* @__PURE__ */ e(
843
+ G,
844
+ {
845
+ copy: { close_aria: s.close_aria, title: o.details_edit_title },
846
+ disablePrimaryButton: Number(w) <= 0,
847
+ isOpen: x,
848
+ onClose: () => C(!1),
849
+ onPrimaryAction: S,
850
+ primaryText: o.edit_save_button,
851
+ children: /* @__PURE__ */ e(
852
+ te,
853
+ {
854
+ amount: w,
855
+ categoryName: n.category.name,
856
+ onAmountChanged: _
857
+ }
858
+ )
859
+ }
860
+ ),
861
+ /* @__PURE__ */ e(
862
+ G,
863
+ {
864
+ copy: { close_aria: s.close_aria, title: o.delete_title },
865
+ isOpen: v,
866
+ onClose: () => D(!1),
867
+ onPrimaryAction: f,
868
+ primaryColor: "error",
869
+ primaryText: o.details_delete_button,
870
+ secondaryColor: "secondary",
871
+ children: /* @__PURE__ */ e(u, { variant: "Paragraph", children: R(o.delete_description, n.category.name) })
872
+ }
873
+ )
874
+ ] });
875
+ }), me = 480, no = A(({ onBackClick: t, sx: o }) => {
876
+ const s = V(), { onEvent: i } = Y(), { accounts: a } = he(), { budgets: n, common: r } = T(), { isInitialized: c, selectedAccounts: b, setDisplayedDate: h, setSelectedAccounts: g } = re(), { alert: p, dateRange: y, loadBudgets: x, setDateRange: C, setAlert: v, setTheme: D } = I(), { loadCashflowSequences: w } = q(), { isDesktop: _, isTablet: S } = ge(), { reloadCategoryTotals: f } = Z(), [E, L] = d.useState(!1), [N, j] = d.useState(!1);
877
+ d.useEffect(() => {
878
+ D(s), g(a), h(y.start, y.end), i(M.BUDGETS_VIEW);
879
+ }, []), d.useEffect(() => {
880
+ c && (f(b, y.start, y.end).finally(), E || (w().finally(), x().finally(() => L(!0))));
881
+ }, [c, b, y]);
882
+ const Be = (se) => {
883
+ C({ start: se[0] || /* @__PURE__ */ new Date(), end: se[1] || /* @__PURE__ */ new Date() });
884
+ }, xe = () => {
885
+ i(M.BUDGETS_CLICK_FILTER);
886
+ }, ve = () => {
887
+ j(!0), i(M.BUDGETS_CLICK_ADD);
888
+ }, Ae = () => {
889
+ j(!1);
890
+ }, Ie = Fe(y.end, Ne(/* @__PURE__ */ new Date()));
891
+ return !c || !E ? /* @__PURE__ */ e(ne, {}) : /* @__PURE__ */ l(
892
+ Pe,
893
+ {
894
+ accountOptions: a,
895
+ actions: [
896
+ {
897
+ iconName: "add",
898
+ label: n.add_title,
899
+ onClick: ve
900
+ }
901
+ ],
902
+ calendarActions: { onRangeChanged: Be, shouldDisableNext: Ie },
903
+ onAccountsFilterClick: xe,
904
+ onBackClick: t,
905
+ sx: o,
906
+ title: n.budgets_title,
907
+ children: [
908
+ (!c || !E) && /* @__PURE__ */ e(ne, {}),
909
+ c && E && /* @__PURE__ */ l(m, { direction: _ || S ? "row" : "column", height: "100%", width: "100%", children: [
910
+ /* @__PURE__ */ e(m, { height: _ || S ? "calc(100dvh - 150px)" : 450, children: /* @__PURE__ */ e(
911
+ Ce,
912
+ {
913
+ height: _ || S ? 800 : 450,
914
+ isDraggable: !0,
915
+ shouldShowZeroState: !1,
916
+ unavailableWidth: _ || S ? me : 0
917
+ }
918
+ ) }),
919
+ /* @__PURE__ */ l(
920
+ m,
921
+ {
922
+ gap: 24,
923
+ height: "100%",
924
+ sx: { mr: 24 },
925
+ width: _ || S ? me : "100%",
926
+ children: [
927
+ /* @__PURE__ */ e(dt, {}),
928
+ /* @__PURE__ */ e(lt, {})
929
+ ]
930
+ }
931
+ )
932
+ ] }),
933
+ /* @__PURE__ */ e(St, {}),
934
+ /* @__PURE__ */ e(
935
+ k,
936
+ {
937
+ ariaLabelClose: r.close_aria,
938
+ isOpen: N,
939
+ onClose: () => j(!1),
940
+ title: n.add_new_title,
941
+ children: /* @__PURE__ */ e(ht, { onRecalculateBudgets: Ae })
942
+ }
943
+ ),
944
+ /* @__PURE__ */ e(
945
+ He,
946
+ {
947
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
948
+ autoHideDuration: 3500,
949
+ onClose: () => v(""),
950
+ open: !!p,
951
+ children: /* @__PURE__ */ e(We, { onClose: () => v(""), severity: "success", variant: "filled", children: p })
952
+ }
953
+ )
954
+ ]
955
+ }
956
+ );
957
+ });
958
+ export {
959
+ to as BubbleBudgetsMiniWidget,
960
+ no as BubbleBudgetsWidget
961
+ };
962
+ //# sourceMappingURL=index.es16.js.map