@mx-cartographer/experiences 7.13.6 → 7.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,270 +1,270 @@
1
- import { jsxs as m, jsx as e, Fragment as Ve } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as e, Fragment as Ke } from "react/jsx-runtime";
2
2
  import l from "react";
3
- import { observer as w } from "mobx-react-lite";
3
+ import { observer as I } from "mobx-react-lite";
4
4
  import { endOfMonth as Ce } from "date-fns/endOfMonth";
5
- import { isAfter as Ke } from "date-fns/isAfter";
6
- import { startOfMonth as re } from "date-fns/startOfMonth";
7
- import { startOfToday as ne } from "date-fns/startOfToday";
5
+ import { isAfter as Ye } from "date-fns/isAfter";
6
+ import { startOfMonth as ae } from "date-fns/startOfMonth";
7
+ import { startOfToday as oe } from "date-fns/startOfToday";
8
8
  import Se from "@mui/material/Alert";
9
9
  import xe from "@mui/material/Snackbar";
10
- import v from "@mui/material/Stack";
11
- import ie from "@mui/material/styles/useTheme";
12
- import K from "@mui/material/Box";
13
- import Y from "@mui/material/List";
14
- import { Text as B, CategoryIcon as W, Icon as j, H3 as Re } from "@mxenabled/mxui";
15
- import { u as D, m as E, i as ce, l as X, p as le, a as Le, g as Z, b as q, h as J, d as Ne } from "../hooks-BxkfR-Ff.mjs";
16
- import { f as T } from "../NumberFormatting-QCaNwbjv.mjs";
17
- import ke from "@mui/material/Button";
18
- import de from "@mui/material/Divider";
19
- import Q from "@mui/material/ListItem";
20
- import ue from "@mui/material/ListItemAvatar";
21
- import ee from "@mui/material/ListItemButton";
22
- import te from "@mui/material/ListItemText";
23
- import { b as N } from "../Localization-CPkpIwIx.mjs";
10
+ import A from "@mui/material/Stack";
11
+ import se from "@mui/material/styles/useTheme";
12
+ import V from "@mui/material/Box";
13
+ import K from "@mui/material/List";
14
+ import { Text as B, CategoryIcon as H, Icon as j, H3 as Le } from "@mxenabled/mxui";
15
+ import { u as E, m as w, i as ie, l as Y, p as ce, a as Ne, g as X, b as Z, h as q, d as ke } from "../hooks-BxkfR-Ff.mjs";
16
+ import { f as D } from "../NumberFormatting-QCaNwbjv.mjs";
17
+ import $e from "@mui/material/Button";
18
+ import le from "@mui/material/Divider";
19
+ import J from "@mui/material/ListItem";
20
+ import de from "@mui/material/ListItemAvatar";
21
+ import Q from "@mui/material/ListItemButton";
22
+ import ee from "@mui/material/ListItemText";
23
+ import { b as L } from "../Localization-CPkpIwIx.mjs";
24
24
  import { D as $ } from "../Drawer-Bbe4AMB1.mjs";
25
- import Ye from "@mui/material/ListItemSecondaryAction";
26
- import { C as Xe } from "../CurrencyInput-DuMktPu3.mjs";
27
- import { D as U } from "../Dialog-Ck34yr-d.mjs";
28
- import { C as Ze } from "../ConnectionsDrawer-IA7vnv1J.mjs";
29
- import * as R from "d3";
30
- import qe from "@mui/material/Tooltip";
31
- import { useTheme as $e, alpha as Je } from "@mui/material/styles";
32
- import { u as me } from "../useScreenSize-B6JyS_Lj.mjs";
33
- import { L as ge } from "../Loader-D3rjKx72.mjs";
25
+ import Xe from "@mui/material/ListItemSecondaryAction";
26
+ import { C as Ze } from "../CurrencyInput-DuMktPu3.mjs";
27
+ import { D as W } from "../Dialog-Ck34yr-d.mjs";
28
+ import { C as qe } from "../ConnectionsDrawer-IA7vnv1J.mjs";
29
+ import * as M from "d3";
30
+ import Je from "@mui/material/Tooltip";
31
+ import { useTheme as Ge, alpha as Qe } from "@mui/material/styles";
32
+ import { u as ue } from "../useScreenSize-B6JyS_Lj.mjs";
33
+ import { L as me } from "../Loader-D3rjKx72.mjs";
34
34
  import { E as ye } from "../EmptyState-DHAkGsjk.mjs";
35
35
  import { A as G } from "../Analytics-BYItVAe-.mjs";
36
- import De from "@mui/material/Tab";
37
- import Qe from "@mui/material/Tabs";
38
- import { e as et } from "../exportTransactionsToCSV-CdTF_RqL.mjs";
36
+ import Ee from "@mui/material/Tab";
37
+ import et from "@mui/material/Tabs";
38
+ import { e as tt } from "../exportTransactionsToCSV-CdTF_RqL.mjs";
39
39
  import { T as Ae } from "../StatusIndicator-CIKUOoN_.mjs";
40
- import { T as tt, c as ot } from "../TransactionDetails-C9DVd4nm.mjs";
40
+ import { T as ot, c as nt } from "../TransactionDetails-DgRWcoyX.mjs";
41
41
  import ve from "@mui/material/Card";
42
42
  import Te from "@mui/material/CardContent";
43
43
  import { S as Be } from "../StatusBar-BK_uYHAB.mjs";
44
- import { S as Ge } from "../SingleSegmentDonut-BgbLgwHi.mjs";
45
- import { u as nt, b as at } from "../CategorySelectorDrawer-gc41lfFZ.mjs";
46
- import Pe from "@mui/material/CardHeader";
47
- import { subDays as rt } from "date-fns/subDays";
48
- import st from "@mui/material/IconButton";
49
- import { M as it } from "../ManageIncome-CYQVQmjx.mjs";
50
- import { u as je } from "../useWidgetLoadTimer-DgN1bTyu.mjs";
51
- import { W as ct } from "../WidgetContainer-D_iaToWJ.mjs";
52
- import { u as lt, g as dt, C as ut } from "../BudgetUtil-CLhRnCoX.mjs";
53
- import { M as mt } from "../MiniWidgetContainer-xLWSV6Wz.mjs";
54
- import { b as Ee } from "../CategoryUtil-BVixr0d5.mjs";
55
- const gt = w(() => {
56
- const { budgets: t } = D(), { totalBudgeted: n } = E(), { incomeTotal: i } = ce(), s = i - n;
57
- return /* @__PURE__ */ m(v, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
58
- /* @__PURE__ */ m(v, { alignItems: "center", children: [
59
- /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: T(i, "0,0") }),
44
+ import { S as Pe } from "../SingleSegmentDonut-BgbLgwHi.mjs";
45
+ import { u as at, b as rt } from "../CategorySelectorDrawer-gc41lfFZ.mjs";
46
+ import je from "@mui/material/CardHeader";
47
+ import { subDays as st } from "date-fns/subDays";
48
+ import it from "@mui/material/IconButton";
49
+ import { M as ct } from "../ManageIncome-C2RsnWsK.mjs";
50
+ import { u as ze } from "../useWidgetLoadTimer-DgN1bTyu.mjs";
51
+ import { W as lt } from "../WidgetContainer-D_iaToWJ.mjs";
52
+ import { u as dt, g as ut, C as mt } from "../BudgetUtil-CLhRnCoX.mjs";
53
+ import { M as gt } from "../MiniWidgetContainer-xLWSV6Wz.mjs";
54
+ import { b as we } from "../CategoryUtil-BVixr0d5.mjs";
55
+ const pt = I(() => {
56
+ const { budgets: t } = E(), { totalBudgeted: n } = w(), { incomeTotal: c } = ie(), i = c - n;
57
+ return /* @__PURE__ */ m(A, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
58
+ /* @__PURE__ */ m(A, { alignItems: "center", children: [
59
+ /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: D(c, "0,0") }),
60
60
  /* @__PURE__ */ e(B, { color: "secondary", variant: "body2", children: t.projected_income })
61
61
  ] }),
62
62
  /* @__PURE__ */ e(B, { bold: !0, justifyContent: "center", variant: "body1", children: "-" }),
63
- /* @__PURE__ */ m(v, { alignItems: "center", children: [
64
- /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: T(n, "0,0") }),
63
+ /* @__PURE__ */ m(A, { alignItems: "center", children: [
64
+ /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: D(n, "0,0") }),
65
65
  /* @__PURE__ */ e(B, { color: "secondary", variant: "body2", children: t.budgeted })
66
66
  ] }),
67
67
  /* @__PURE__ */ e(B, { bold: !0, justifyContent: "center", variant: "body1", children: "=" }),
68
- /* @__PURE__ */ m(v, { alignItems: "center", children: [
69
- /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: T(s, "0,0") }),
68
+ /* @__PURE__ */ m(A, { alignItems: "center", children: [
69
+ /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: D(i, "0,0") }),
70
70
  /* @__PURE__ */ e(B, { color: "secondary", variant: "body2", children: t.remaining })
71
71
  ] })
72
72
  ] });
73
- }), pt = w(
73
+ }), ht = I(
74
74
  ({ category: t }) => {
75
- const { budgets: n } = D(), { budgets: i } = E(), s = l.useMemo(() => {
76
- const a = i.find((c) => c.category_guid === t.guid), r = T(t.totalAverageAmount, "0,0"), o = a ? N(n.recalculate_previous_budget, T(a.amount, "0,0")) : n.recalculate_new_budget;
77
- return `${r} - ${o}`;
78
- }, [n, i]);
75
+ const { budgets: n } = E(), { budgets: c } = w(), i = l.useMemo(() => {
76
+ const a = c.find((r) => r.category_guid === t.guid), s = D(t.totalAverageAmount, "0,0"), o = a ? L(n.recalculate_previous_budget, D(a.amount, "0,0")) : n.recalculate_new_budget;
77
+ return `${s} - ${o}`;
78
+ }, [n, c]);
79
79
  return /* @__PURE__ */ m(l.Fragment, { children: [
80
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ m(ee, { children: [
81
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(W, { categoryGuid: t.guid, variant: "filled" }) }),
82
- /* @__PURE__ */ e(te, { primary: t.name, secondary: s })
80
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ m(Q, { children: [
81
+ /* @__PURE__ */ e(de, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid, variant: "filled" }) }),
82
+ /* @__PURE__ */ e(ee, { primary: t.name, secondary: i })
83
83
  ] }) }),
84
- /* @__PURE__ */ e(de, {})
84
+ /* @__PURE__ */ e(le, {})
85
85
  ] }, t.guid);
86
86
  }
87
- ), ht = ({ onRecalculateBudgets: t }) => {
88
- const { budgets: n, common: i } = D(), { spendCategories: s } = X(), { recalculateBudgets: a, setAlert: r } = E(), [o, c] = l.useState(!1), g = s.filter((u) => u.totalAverageAmount > 0), d = async () => {
89
- await a(g), c(!1), r(n.alert_recalculated_budgets), t?.();
87
+ ), bt = ({ onRecalculateBudgets: t }) => {
88
+ const { budgets: n, common: c } = E(), { spendCategories: i } = Y(), { recalculateBudgets: a, setAlert: s } = w(), [o, r] = l.useState(!1), g = i.filter((u) => u.totalAverageAmount > 0), d = async () => {
89
+ await a(g), r(!1), s(n.alert_recalculated_budgets), t?.();
90
90
  };
91
91
  return /* @__PURE__ */ m(l.Fragment, { children: [
92
- /* @__PURE__ */ e(ke, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: n.recalculate_button }),
92
+ /* @__PURE__ */ e($e, { onClick: () => r(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: n.recalculate_button }),
93
93
  /* @__PURE__ */ e(B, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "subtitle1", children: n.recalculate_help }),
94
94
  /* @__PURE__ */ e(
95
95
  $,
96
96
  {
97
- ariaLabelClose: i.close_aria,
97
+ ariaLabelClose: c.close_aria,
98
98
  isOpen: o,
99
- onClose: () => c(!1),
99
+ onClose: () => r(!1),
100
100
  onPrimaryAction: d,
101
101
  title: n.recalculate_title,
102
- children: /* @__PURE__ */ m(v, { children: [
103
- /* @__PURE__ */ m(v, { mx: 24, my: 16, children: [
102
+ children: /* @__PURE__ */ m(A, { children: [
103
+ /* @__PURE__ */ m(A, { mx: 24, my: 16, children: [
104
104
  /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: n.recalculate_description_top }),
105
105
  /* @__PURE__ */ e(B, { variant: "subtitle2", children: n.recalculate_description_bottom })
106
106
  ] }),
107
- /* @__PURE__ */ e(K, { bgcolor: "background.paper", children: /* @__PURE__ */ e(Y, { children: g.map((u) => /* @__PURE__ */ e(pt, { category: u }, u.guid)) }) })
107
+ /* @__PURE__ */ e(V, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: g.map((u) => /* @__PURE__ */ e(ht, { category: u }, u.guid)) }) })
108
108
  ] })
109
109
  }
110
110
  )
111
111
  ] });
112
- }, pe = ({
112
+ }, ge = ({
113
113
  amount: t,
114
114
  categoryName: n,
115
- onAmountChanged: i
115
+ onAmountChanged: c
116
116
  }) => {
117
- const { budgets: s } = D(), { totalBudgeted: a } = E(), { incomeTotal: r } = ce(), o = r - a;
118
- return /* @__PURE__ */ m(v, { gap: 16, children: [
119
- /* @__PURE__ */ m(v, { children: [
120
- /* @__PURE__ */ e(B, { children: N(
121
- s.add_description_top,
122
- T(o, "0,0")
117
+ const { budgets: i } = E(), { totalBudgeted: a } = w(), { incomeTotal: s } = ie(), o = s - a;
118
+ return /* @__PURE__ */ m(A, { gap: 16, children: [
119
+ /* @__PURE__ */ m(A, { children: [
120
+ /* @__PURE__ */ e(B, { children: L(
121
+ i.add_description_top,
122
+ D(o, "0,0")
123
123
  ) }),
124
- /* @__PURE__ */ e(B, { children: N(s.add_description_bottom, n) })
124
+ /* @__PURE__ */ e(B, { children: L(i.add_description_bottom, n) })
125
125
  ] }),
126
126
  /* @__PURE__ */ e(
127
- Xe,
127
+ Ze,
128
128
  {
129
129
  amount: t,
130
130
  autoFocus: !0,
131
- label: s.add_label,
131
+ label: i.add_label,
132
132
  minAmount: 0,
133
- setAmount: i,
133
+ setAmount: c,
134
134
  sx: { ".MuiTypography-body1": { p: 0 } }
135
135
  }
136
136
  )
137
137
  ] });
138
- }, bt = w(({ category: t, onAddBudget: n }) => {
139
- const { budgets: i, common: s } = D(), [a, r] = l.useState(!1), [o, c] = l.useState(
138
+ }, ft = I(({ category: t, onAddBudget: n }) => {
139
+ const { budgets: c, common: i } = E(), [a, s] = l.useState(!1), [o, r] = l.useState(
140
140
  `${t.totalAmount === 0 ? "" : t.totalAmount}`
141
141
  );
142
142
  return /* @__PURE__ */ m(l.Fragment, { children: [
143
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ m(ee, { onClick: () => r(!0), children: [
144
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(W, { categoryGuid: t.guid }) }),
143
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ m(Q, { onClick: () => s(!0), children: [
144
+ /* @__PURE__ */ e(de, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid }) }),
145
145
  /* @__PURE__ */ e(
146
- te,
146
+ ee,
147
147
  {
148
148
  primary: t.name,
149
- secondary: T(t.totalAmount, "0,0")
149
+ secondary: D(t.totalAmount, "0,0")
150
150
  }
151
151
  ),
152
- /* @__PURE__ */ e(Ye, { children: /* @__PURE__ */ e(j, { name: "add", size: 20 }) })
152
+ /* @__PURE__ */ e(Xe, { children: /* @__PURE__ */ e(j, { name: "add", size: 20 }) })
153
153
  ] }) }, t.guid),
154
154
  /* @__PURE__ */ e(
155
- U,
155
+ W,
156
156
  {
157
- copy: { close_aria: s.close_aria, title: i.add_title },
157
+ copy: { close_aria: i.close_aria, title: c.add_title },
158
158
  disablePrimaryButton: Number(o) <= 0,
159
159
  isOpen: a,
160
- onClose: () => r(!1),
160
+ onClose: () => s(!1),
161
161
  onPrimaryAction: () => n(t, Number(o)),
162
- primaryText: i.add_save_button,
163
- children: /* @__PURE__ */ e(pe, { amount: o, categoryName: t.name, onAmountChanged: c })
162
+ primaryText: c.add_save_button,
163
+ children: /* @__PURE__ */ e(ge, { amount: o, categoryName: t.name, onAmountChanged: r })
164
164
  }
165
165
  )
166
166
  ] });
167
- }), ze = w(({ onAddBudget: t, onRecalculateBudgets: n }) => {
168
- const { budgets: i } = D(), { addBudget: s, setAlert: a, unbudgetedCategories: r } = E(), o = async (c, g) => {
169
- await s(c, g), t?.(), a(N(i.alert_budget_created, c.name));
167
+ }), Fe = I(({ onAddBudget: t, onRecalculateBudgets: n }) => {
168
+ const { budgets: c } = E(), { addBudget: i, setAlert: a, unbudgetedCategories: s } = w(), o = async (r, g) => {
169
+ await i(r, g), t?.(), a(L(c.alert_budget_created, r.name));
170
170
  };
171
- return /* @__PURE__ */ m(v, { children: [
172
- /* @__PURE__ */ e(gt, {}),
173
- /* @__PURE__ */ e(K, { bgcolor: "background.paper", children: /* @__PURE__ */ e(Y, { children: r.map((c) => /* @__PURE__ */ e(
174
- bt,
171
+ return /* @__PURE__ */ m(A, { children: [
172
+ /* @__PURE__ */ e(pt, {}),
173
+ /* @__PURE__ */ e(V, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: s.map((r) => /* @__PURE__ */ e(
174
+ ft,
175
175
  {
176
- category: c,
176
+ category: r,
177
177
  onAddBudget: o
178
178
  },
179
- c.guid
179
+ r.guid
180
180
  )) }) }),
181
- /* @__PURE__ */ e(ht, { onRecalculateBudgets: n })
181
+ /* @__PURE__ */ e(bt, { onRecalculateBudgets: n })
182
182
  ] });
183
- }), we = 5, Fe = 100, se = 25, ft = (t) => {
183
+ }), Ie = 5, Ue = 100, re = 25, yt = (t) => {
184
184
  const n = (a) => {
185
185
  a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
186
- }, i = (a) => {
186
+ }, c = (a) => {
187
187
  a.subject.fx = a.x, a.subject.fy = a.y;
188
- }, s = (a) => {
188
+ }, i = (a) => {
189
189
  a.active || t.alphaTarget(0), a.subject.fx = null, a.subject.fy = null;
190
190
  };
191
- return R.drag().on("start", n).on("drag", i).on("end", s);
192
- }, yt = (t) => {
191
+ return M.drag().on("start", n).on("drag", c).on("end", i);
192
+ }, _t = (t) => {
193
193
  let n = t.transaction_total / t.amount;
194
194
  n < 0 ? n = 0 : n > 1 && (n = 1);
195
- const i = n * 2 * Math.PI, s = R.interpolate(0, i), a = R.arc().cornerRadius(5).innerRadius(t.radius - we * 2).outerRadius(t.radius - we).startAngle(0).endAngle(0);
196
- return (r) => (a.endAngle(s(r)), a(t) || "");
197
- }, _t = (t) => {
198
- R.selectAll(".bubble").call(ft(t));
199
- }, Ie = (t, n, i) => Math.min(Math.max(t, n), i), Ct = (t, n, i) => {
195
+ const c = n * 2 * Math.PI, i = M.interpolate(0, c), a = M.arc().cornerRadius(5).innerRadius(t.radius - Ie * 2).outerRadius(t.radius - Ie).startAngle(0).endAngle(0);
196
+ return (s) => (a.endAngle(i(s)), a(t) || "");
197
+ }, Ct = (t) => {
198
+ M.selectAll(".bubble").call(yt(t));
199
+ }, Oe = (t, n, c) => Math.min(Math.max(t, n), c), Bt = (t, n, c) => {
200
200
  t.alpha(1).restart().force(
201
201
  "x",
202
- R.forceX().x(i / 2).strength(0.01)
202
+ M.forceX().x(c / 2).strength(0.01)
203
203
  ).force(
204
204
  "y",
205
- R.forceY().y(n / 2).strength(0.02)
205
+ M.forceY().y(n / 2).strength(0.02)
206
206
  ).on("tick", () => {
207
- const s = t.nodes();
208
- s.forEach((a) => {
209
- const r = a.radius ?? se;
210
- a.x = Ie(a.x ?? 0, r, i - r), a.y = Ie(a.y ?? 0, r, n - r);
211
- }), R.selectAll(".bubble").data(s).attr("transform", (a) => `translate(${a.x},${a.y})`);
207
+ const i = t.nodes();
208
+ i.forEach((a) => {
209
+ const s = a.radius ?? re;
210
+ a.x = Oe(a.x ?? 0, s, c - s), a.y = Oe(a.y ?? 0, s, n - s);
211
+ }), M.selectAll(".bubble").data(i).attr("transform", (a) => `translate(${a.x},${a.y})`);
212
212
  });
213
- }, Ue = (t, n) => R.scaleLinear().domain([t, n]).range([se, Fe]), Bt = (t) => {
214
- const n = t.reduce((r, o) => {
215
- const c = Math.max(o.transaction_total, o.amount);
216
- return c > r ? c : r;
217
- }, 0), i = t.reduce((r, o) => {
218
- const c = Math.max(o.transaction_total, o.amount);
219
- return c < r ? c : r;
220
- }, n), s = Ue(i, n), a = t.map((r) => {
221
- const o = s(Math.max(r.transaction_total, r.amount)) || 25;
213
+ }, We = (t, n) => M.scaleLinear().domain([t, n]).range([re, Ue]), St = (t) => {
214
+ const n = t.reduce((s, o) => {
215
+ const r = Math.max(o.transaction_total, o.amount);
216
+ return r > s ? r : s;
217
+ }, 0), c = t.reduce((s, o) => {
218
+ const r = Math.max(o.transaction_total, o.amount);
219
+ return r < s ? r : s;
220
+ }, n), i = We(c, n), a = t.map((s) => {
221
+ const o = i(Math.max(s.transaction_total, s.amount)) || 25;
222
222
  return {
223
- ...r,
223
+ ...s,
224
224
  radius: o
225
225
  };
226
226
  });
227
- return R.forceSimulation(a).velocityDecay(0.05).force("collide", R.forceCollide((r) => r.radius + 2).strength(0.7));
228
- }, St = (t, n, i) => {
229
- const a = Math.PI * se ** 2 * t, r = i < 400 || n < 300, o = r ? 40 : 20, c = Math.max(100, i - o), g = Math.max(100, n - o), d = c * g;
230
- let u = se;
227
+ return M.forceSimulation(a).velocityDecay(0.05).force("collide", M.forceCollide((s) => s.radius + 2).strength(0.7));
228
+ }, xt = (t, n, c) => {
229
+ const a = Math.PI * re ** 2 * t, s = c < 400 || n < 300, o = s ? 40 : 20, r = Math.max(100, c - o), g = Math.max(100, n - o), d = r * g;
230
+ let u = re;
231
231
  if (a < d) {
232
- const h = Math.sqrt(d / (t * Math.PI)), _ = Math.min(c, g) / 4;
233
- u = Math.min(Fe, h, _);
232
+ const p = Math.sqrt(d / (t * Math.PI)), h = Math.min(r, g) / 4;
233
+ u = Math.min(Ue, p, h);
234
234
  }
235
- return r && t <= 3 && (u = Math.min(u, 45)), { minRadius: Math.max(20, u * 0.6), maxRadius: u };
236
- }, xt = (t, n, i, s, a) => {
237
- const { maxRadius: r, minRadius: o } = St(t, n, a);
238
- return R.scaleLinear().domain([s, i]).range([o, r]);
239
- }, At = (t, n, i = !1, s, a) => {
240
- const r = n.map((d) => Math.max(d.transaction_total, d.amount)), o = Math.min(...r), c = Math.max(...r), g = i ? xt(t.length, s, c, o, a) : Ue(o, c);
235
+ return s && t <= 3 && (u = Math.min(u, 45)), { minRadius: Math.max(20, u * 0.6), maxRadius: u };
236
+ }, At = (t, n, c, i, a) => {
237
+ const { maxRadius: s, minRadius: o } = xt(t, n, a);
238
+ return M.scaleLinear().domain([i, c]).range([o, s]);
239
+ }, vt = (t, n, c = !1, i, a) => {
240
+ const s = n.map((d) => Math.max(d.transaction_total, d.amount)), o = Math.min(...s), r = Math.max(...s), g = c ? At(t.length, i, r, o, a) : We(o, r);
241
241
  return t.map((d) => ({
242
242
  ...d,
243
243
  radius: g(Math.max(d.transaction_total, d.amount))
244
244
  }));
245
- }, Oe = 5, vt = 2e3, Tt = ({ bubble: t }) => {
246
- const n = ie(), {
247
- amount: i,
248
- guid: s,
245
+ }, Me = 5, Tt = 2e3, Dt = ({ bubble: t }) => {
246
+ const n = se(), {
247
+ amount: c,
248
+ guid: i,
249
249
  budgetColors: { mercury: a },
250
- radius: r,
250
+ radius: s,
251
251
  transaction_total: o
252
- } = t, c = `mercury-${s}`;
252
+ } = t, r = `mercury-${i}`;
253
253
  l.useEffect(() => {
254
- R.select(`.${c}`).selectAll(".status").remove(), R.select(`.${c}`).append("path").transition().duration(vt).delay(0).attr("class", "status").attr("style", `fill: ${a}; fill-opacity: 1;`).attrTween("d", () => yt(t));
255
- }, [i, r, o]);
256
- const g = R.arc().innerRadius((d) => d - 2 * Oe).outerRadius((d) => d - Oe).startAngle(0).endAngle(2 * Math.PI);
257
- return /* @__PURE__ */ e("g", { className: c, children: /* @__PURE__ */ e(
254
+ M.select(`.${r}`).selectAll(".status").remove(), M.select(`.${r}`).append("path").transition().duration(Tt).delay(0).attr("class", "status").attr("style", `fill: ${a}; fill-opacity: 1;`).attrTween("d", () => _t(t));
255
+ }, [c, s, o]);
256
+ const g = M.arc().innerRadius((d) => d - 2 * Me).outerRadius((d) => d - Me).startAngle(0).endAngle(2 * Math.PI);
257
+ return /* @__PURE__ */ e("g", { className: r, children: /* @__PURE__ */ e(
258
258
  "path",
259
259
  {
260
- d: g(r) || "",
260
+ d: g(s) || "",
261
261
  style: { fill: n.palette.common.white, fillOpacity: 0.35 }
262
262
  }
263
263
  ) });
264
- }, Dt = l.memo(Tt), F = 75, _e = 50;
265
- function Et({ bubble: t, isDraggable: n, onClick: i = () => {
264
+ }, Et = l.memo(Dt), U = 75, _e = 50;
265
+ function wt({ bubble: t, isDraggable: n, onClick: c = () => {
266
266
  } }) {
267
- const [s, a] = l.useState(!1), r = $e(), { availableWidth: o } = le(), c = l.useMemo(() => {
267
+ const [i, a] = l.useState(!1), s = Ge(), { availableWidth: o } = ce(), r = l.useMemo(() => {
268
268
  if (t)
269
269
  return {
270
270
  amount: t.amount,
@@ -277,26 +277,26 @@ function Et({ bubble: t, isDraggable: n, onClick: i = () => {
277
277
  if (!t) return;
278
278
  const {
279
279
  budgetColors: { background: g, text: d },
280
- category: { icon: u, name: p },
281
- guid: h,
282
- description: _,
283
- radius: f,
284
- x: y,
285
- y: A
286
- } = t, x = o < 400 ? -8 : -12;
287
- let C = x, b = x;
288
- f > F ? (C = -14, b = -45) : f > _e && (b = -32);
289
- let S = 32;
290
- f <= F && (S = o < 400 ? 16 : 24);
291
- const I = `${t.category.name}: ${_}`, L = {
280
+ category: { icon: u, name: y },
281
+ guid: p,
282
+ description: h,
283
+ radius: _,
284
+ x: C,
285
+ y: x
286
+ } = t, v = o < 400 ? -8 : -12;
287
+ let b = v, S = v;
288
+ _ > U ? (b = -14, S = -45) : _ > _e && (S = -32);
289
+ let f = 32;
290
+ _ <= U && (f = o < 400 ? 16 : 24);
291
+ const T = `${t.category.name}: ${h}`, N = {
292
292
  modifiers: [
293
293
  {
294
294
  name: "offset",
295
295
  options: { offset: [0, 15] }
296
296
  }
297
297
  ]
298
- }, M = (k) => {
299
- (k.key === "Enter" || k.key === " ") && (k.preventDefault(), i(t));
298
+ }, R = (k) => {
299
+ (k.key === "Enter" || k.key === " ") && (k.preventDefault(), c(t));
300
300
  }, O = () => {
301
301
  a(!0);
302
302
  }, z = () => {
@@ -305,21 +305,21 @@ function Et({ bubble: t, isDraggable: n, onClick: i = () => {
305
305
  return /* @__PURE__ */ m(
306
306
  "g",
307
307
  {
308
- "aria-label": `${p} - ${_}`,
308
+ "aria-label": `${y} - ${h}`,
309
309
  className: "bubble",
310
- id: `bubble-${h}`,
310
+ id: `bubble-${p}`,
311
311
  onBlur: z,
312
- onClick: () => i(t),
312
+ onClick: () => c(t),
313
313
  onFocus: O,
314
- onKeyDown: M,
314
+ onKeyDown: R,
315
315
  onMouseEnter: () => a(!0),
316
316
  onMouseLeave: () => a(!1),
317
317
  role: "button",
318
318
  style: { cursor: n ? "pointer" : "default" },
319
319
  tabIndex: 0,
320
320
  textAnchor: "middle",
321
- x: y,
322
- y: A,
321
+ x: C,
322
+ y: x,
323
323
  children: [
324
324
  /* @__PURE__ */ e("style", { children: `
325
325
  .bubble:focus,
@@ -328,76 +328,76 @@ function Et({ bubble: t, isDraggable: n, onClick: i = () => {
328
328
  }
329
329
  .bubble:focus circle,
330
330
  .bubble:focus-visible circle {
331
- stroke: ${r.palette.primary.main};
331
+ stroke: ${s.palette.primary.main};
332
332
  stroke-width: 3;
333
333
  stroke-opacity: 0.8;
334
334
  }
335
335
  ` }),
336
- /* @__PURE__ */ e(qe, { open: s, slotProps: { popper: L }, title: I, children: /* @__PURE__ */ e("circle", { fill: g, id: `circle-${h}`, r: f }) }),
337
- /* @__PURE__ */ e("svg", { x: C, y: b, children: /* @__PURE__ */ e(j, { name: u, size: S, sx: { fill: d } }) }),
338
- f > F && /* @__PURE__ */ e(
336
+ /* @__PURE__ */ e(Je, { open: i, slotProps: { popper: N }, title: T, children: /* @__PURE__ */ e("circle", { fill: g, id: `circle-${p}`, r: _ }) }),
337
+ /* @__PURE__ */ e("svg", { x: b, y: S, children: /* @__PURE__ */ e(j, { name: u, size: f, sx: { fill: d } }) }),
338
+ _ > U && /* @__PURE__ */ e(
339
339
  B,
340
340
  {
341
341
  bold: !0,
342
342
  component: "text",
343
- id: `budget-category-${h}`,
343
+ id: `budget-category-${p}`,
344
344
  sx: { fill: d },
345
345
  variant: "body2",
346
346
  y: 4,
347
- children: p
347
+ children: y
348
348
  }
349
349
  ),
350
- f > _e && /* @__PURE__ */ e(
350
+ _ > _e && /* @__PURE__ */ e(
351
351
  B,
352
352
  {
353
353
  bold: !0,
354
354
  component: "text",
355
- id: `budget-description-${h}-1`,
355
+ id: `budget-description-${p}-1`,
356
356
  sx: { fill: d },
357
357
  variant: "body1",
358
- y: f <= F ? 12 : 24,
359
- children: f <= F ? _.split(" ")[0] : _
358
+ y: _ <= U ? 12 : 24,
359
+ children: _ <= U ? h.split(" ")[0] : h
360
360
  }
361
361
  ),
362
- f <= F && f > _e && /* @__PURE__ */ e(
362
+ _ <= U && _ > _e && /* @__PURE__ */ e(
363
363
  B,
364
364
  {
365
365
  component: "text",
366
- id: `budget-description-${h}-2`,
366
+ id: `budget-description-${p}-2`,
367
367
  sx: { fill: d },
368
368
  variant: "caption",
369
369
  y: 28,
370
- children: _.split(" ")[1]
370
+ children: h.split(" ")[1]
371
371
  }
372
372
  ),
373
- /* @__PURE__ */ e(Dt, { bubble: c })
373
+ /* @__PURE__ */ e(Et, { bubble: r })
374
374
  ]
375
375
  },
376
- h
376
+ p
377
377
  );
378
378
  }
379
- const wt = ({
379
+ const It = ({
380
380
  height: t,
381
381
  width: n,
382
- isDraggable: i = !1,
383
- onClick: s = () => {
382
+ isDraggable: c = !1,
383
+ onClick: i = () => {
384
384
  }
385
385
  }) => {
386
- const [a, r] = l.useState([]), o = l.useRef(null), c = l.useRef(!1), { detailedBudgets: g } = E(), d = l.useCallback(() => {
387
- const u = o.current, p = Bt(g), h = p.nodes();
386
+ const [a, s] = l.useState([]), o = l.useRef(null), r = l.useRef(!1), { detailedBudgets: g } = w(), d = l.useCallback(() => {
387
+ const u = o.current, y = St(g), p = y.nodes();
388
388
  if (u) {
389
- const _ = u.nodes(), f = new Map(_.map((y) => [y.guid, y]));
390
- h.forEach((y) => {
391
- const A = f.get(y.guid);
392
- A && Object.assign(y, {
393
- vx: A.vx,
394
- vy: A.vy,
395
- x: A.x,
396
- y: A.y
389
+ const h = u.nodes(), _ = new Map(h.map((C) => [C.guid, C]));
390
+ p.forEach((C) => {
391
+ const x = _.get(C.guid);
392
+ x && Object.assign(C, {
393
+ vx: x.vx,
394
+ vy: x.vy,
395
+ x: x.x,
396
+ y: x.y
397
397
  });
398
398
  });
399
399
  }
400
- o.current = p, c.current = !1, r(h);
400
+ o.current = y, r.current = !1, s(p);
401
401
  }, [g]);
402
402
  return l.useEffect(() => {
403
403
  d();
@@ -406,29 +406,29 @@ const wt = ({
406
406
  }, []), l.useEffect(() => {
407
407
  const u = o.current;
408
408
  if (!u) return;
409
- const p = u.nodes(), h = n > 0 && n < 450 || t > 0 && t < 300, _ = At(p, g, h, t, n);
410
- u.nodes(_), Ct(u, t, n), i && setTimeout(() => {
411
- _t(u);
412
- }, 0), r([..._]);
413
- }, [t, n, i, g]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(n), children: a.map((u) => /* @__PURE__ */ e(Et, { bubble: u, isDraggable: i, onClick: s }, u.guid)) });
414
- }, It = w(wt), Ot = ({
409
+ const y = u.nodes(), p = n > 0 && n < 450 || t > 0 && t < 300, h = vt(y, g, p, t, n);
410
+ u.nodes(h), Bt(u, t, n), c && setTimeout(() => {
411
+ Ct(u);
412
+ }, 0), s([...h]);
413
+ }, [t, n, c, g]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(n), children: a.map((u) => /* @__PURE__ */ e(wt, { bubble: u, isDraggable: c, onClick: i }, u.guid)) });
414
+ }, Ot = I(It), Mt = ({
415
415
  isMiniWidget: t = !1,
416
416
  onConnectAccountsClick: n,
417
- createBudgetOnClick: i
417
+ createBudgetOnClick: c
418
418
  }) => {
419
- const { config: s } = Le(), { recalculateBudgets: a } = E(), { spendCategories: r } = X(), { budgets: o } = D(), { availableWidth: c } = le(), { isMobile: g } = me(c), d = t && g, [u, p] = l.useState(!1), [h, _] = l.useState(!1), [f, y] = l.useState(!1), A = l.useMemo(() => [...r.filter((C) => C.totalAverageAmount > 0)], [r]), x = async () => {
420
- y(!0);
421
- const { data: C, isSuccess: b } = await a(A);
422
- y(!1), b ? (C.length === 0 && _(!0), p(!1)) : p(!0);
419
+ const { config: i } = Ne(), { recalculateBudgets: a } = w(), { spendCategories: s } = Y(), { budgets: o } = E(), { availableWidth: r } = ce(), { isMobile: g } = ue(r), d = t && g, [u, y] = l.useState(!1), [p, h] = l.useState(!1), [_, C] = l.useState(!1), x = l.useMemo(() => [...s.filter((b) => b.totalAverageAmount > 0)], [s]), v = async () => {
420
+ C(!0);
421
+ const { data: b, isSuccess: S } = await a(x);
422
+ C(!1), S ? (b.length === 0 && h(!0), y(!1)) : y(!0);
423
423
  };
424
- return f ? /* @__PURE__ */ e(ge, {}) : u ? /* @__PURE__ */ e(
424
+ return _ ? /* @__PURE__ */ e(me, {}) : u ? /* @__PURE__ */ e(
425
425
  ye,
426
426
  {
427
427
  header: o.autogenerate_budgets_error_header,
428
428
  icon: "error",
429
429
  iconColor: "#4D4D4D",
430
- onClick: (C) => {
431
- C === "primary" ? x() : i();
430
+ onClick: (b) => {
431
+ b === "primary" ? v() : c();
432
432
  },
433
433
  primaryButton: o.autogenerate_budgets_error_primary_button,
434
434
  secondaryButton: o.zero_state_generate_budgets_secondary_button,
@@ -442,16 +442,16 @@ const wt = ({
442
442
  ...d && { justifyContent: "center", mt: 0, svg: { height: 32, width: 32 } }
443
443
  }
444
444
  }
445
- ) : /* @__PURE__ */ e(Ve, { children: h ? /* @__PURE__ */ e(
445
+ ) : /* @__PURE__ */ e(Ke, { children: p ? /* @__PURE__ */ e(
446
446
  ye,
447
447
  {
448
448
  header: o.zero_state_generate_budgets_header,
449
449
  icon: "error",
450
450
  iconColor: "#4D4D4D",
451
- onClick: (C) => {
452
- C === "primary" ? n() : i();
451
+ onClick: (b) => {
452
+ b === "primary" ? n() : c();
453
453
  },
454
- primaryButton: s.show_connections_widget_in_master ? o.zero_state_generate_budgets_primary_button : void 0,
454
+ primaryButton: i.show_connections_widget_in_master ? o.zero_state_generate_budgets_primary_button : void 0,
455
455
  secondaryButton: o.zero_state_generate_budgets_secondary_button,
456
456
  subText: o.zero_state_generate_budgets_subheader,
457
457
  sx: {
@@ -473,8 +473,8 @@ const wt = ({
473
473
  header: o.create_budgets_title,
474
474
  icon: "bubble_chart",
475
475
  iconColor: "#1A1A1A",
476
- onClick: (C) => {
477
- C === "primary" ? x() : i();
476
+ onClick: (b) => {
477
+ b === "primary" ? v() : c();
478
478
  },
479
479
  primaryButton: o.empty_state_primary_button,
480
480
  secondaryButton: t ? void 0 : o.empty_state_secondary_button,
@@ -493,51 +493,51 @@ const wt = ({
493
493
  }
494
494
  }
495
495
  ) });
496
- }, We = w(
496
+ }, He = I(
497
497
  ({
498
498
  createBudgetOnClick: t = () => {
499
499
  },
500
500
  height: n,
501
- isDraggable: i = !1,
502
- isMiniWidget: s = !1,
501
+ isDraggable: c = !1,
502
+ isMiniWidget: i = !1,
503
503
  shouldShowZeroState: a,
504
- unavailableWidth: r = 24
504
+ unavailableWidth: s = 24
505
505
  }) => {
506
- const { onEvent: o } = Z(), { setSelectedBudget: c } = E(), { isInitialized: g } = q(), { accounts: d } = D(), { availableWidth: u } = le(), { isMobile: p } = me(), [h, _] = l.useState(!1), f = l.useMemo(() => u - r, [u]), y = (x) => {
507
- c(x), o(G.BUDGETS_CLICK_BUDGET_CATEGORY, {
508
- budget_category: x.category.name,
506
+ const { onEvent: o } = X(), { setSelectedBudget: r } = w(), { isInitialized: g } = Z(), { accounts: d } = E(), { availableWidth: u } = ce(), { isMobile: y } = ue(), [p, h] = l.useState(!1), _ = l.useMemo(() => u - s, [u]), C = (v) => {
507
+ r(v), o(G.BUDGETS_CLICK_BUDGET_CATEGORY, {
508
+ budget_category: v.category.name,
509
509
  click_type: "bubble"
510
510
  });
511
- }, A = () => {
512
- _(!0), o(G.ACCOUNTS_CLICK_CONNECT);
511
+ }, x = () => {
512
+ h(!0), o(G.ACCOUNTS_CLICK_CONNECT);
513
513
  };
514
514
  return /* @__PURE__ */ m(
515
- K,
515
+ V,
516
516
  {
517
- ml: a || p ? 0 : 24,
518
- sx: { alignSelf: "center", ...s && { height: "100%" } },
517
+ ml: a || y ? 0 : 24,
518
+ sx: { alignSelf: "center", ...i && { height: "100%" } },
519
519
  children: [
520
520
  a || !g ? /* @__PURE__ */ e(
521
- Ot,
521
+ Mt,
522
522
  {
523
523
  createBudgetOnClick: t,
524
- isMiniWidget: s,
525
- onConnectAccountsClick: A
524
+ isMiniWidget: i,
525
+ onConnectAccountsClick: x
526
526
  }
527
527
  ) : /* @__PURE__ */ e(
528
- It,
528
+ Ot,
529
529
  {
530
530
  height: n,
531
- isDraggable: i,
532
- onClick: y,
533
- width: f
531
+ isDraggable: c,
532
+ onClick: C,
533
+ width: _
534
534
  }
535
535
  ),
536
536
  /* @__PURE__ */ e(
537
- Ze,
537
+ qe,
538
538
  {
539
- onClose: () => _(!1),
540
- showConnectionsWidget: h,
539
+ onClose: () => h(!1),
540
+ showConnectionsWidget: p,
541
541
  title: d.manage_connections
542
542
  }
543
543
  )
@@ -545,362 +545,362 @@ const wt = ({
545
545
  }
546
546
  );
547
547
  }
548
- ), He = ({ budget: t }) => {
548
+ ), Ve = ({ budget: t }) => {
549
549
  const {
550
550
  amount: n,
551
- budgetColors: { background: i },
552
- category: { name: s },
551
+ budgetColors: { background: c },
552
+ category: { name: i },
553
553
  category_guid: a,
554
- percentage: r,
554
+ percentage: s,
555
555
  transaction_total: o
556
- } = t, c = [
556
+ } = t, r = [
557
557
  {
558
- color: i,
559
- percentage: `${r}%`
558
+ color: c,
559
+ percentage: `${s}%`
560
560
  }
561
561
  ];
562
- return /* @__PURE__ */ e(ve, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ m(v, { alignItems: "center", gap: 16, children: [
563
- /* @__PURE__ */ e(W, { categoryGuid: a, size: 56 }),
564
- /* @__PURE__ */ e(B, { variant: "h1", children: `${T(o, "0,0")} / ${T(n, "0,0")}` }),
565
- /* @__PURE__ */ e(B, { bold: !0, variant: "caption", children: s }),
566
- /* @__PURE__ */ e(Be, { data: c, height: 10 })
562
+ return /* @__PURE__ */ e(ve, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ m(A, { alignItems: "center", gap: 16, children: [
563
+ /* @__PURE__ */ e(H, { categoryGuid: a, size: 56 }),
564
+ /* @__PURE__ */ e(B, { variant: "h1", children: `${D(o, "0,0")} / ${D(n, "0,0")}` }),
565
+ /* @__PURE__ */ e(B, { bold: !0, variant: "caption", children: i }),
566
+ /* @__PURE__ */ e(Be, { data: r, height: 10 })
567
567
  ] }) }) });
568
- }, Mt = w(() => {
569
- const { budgets: t } = D();
570
- return /* @__PURE__ */ m(v, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
568
+ }, Rt = I(() => {
569
+ const { budgets: t } = E();
570
+ return /* @__PURE__ */ m(A, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
571
571
  /* @__PURE__ */ e(j, { color: "action", name: "bubble_chart", sx: { fontSize: 32 } }),
572
572
  /* @__PURE__ */ e(B, { bold: !0, color: "text.secondary", variant: "body2", children: t.zero_state_no_sub_budgets }),
573
573
  /* @__PURE__ */ e(B, { color: "text.secondary", variant: "caption", children: t.zero_state_no_sub_budgets_description })
574
574
  ] });
575
- }), Rt = w(({ budget: t }) => {
575
+ }), Lt = I(({ budget: t }) => {
576
576
  const {
577
577
  amount: n,
578
- budgetColors: { background: i },
579
- category: s,
578
+ budgetColors: { background: c },
579
+ category: i,
580
580
  percentage: a,
581
- transaction_total: r
582
- } = t, { setSelectedSubBudget: o } = E();
583
- return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ m(ee, { onClick: () => o(t), children: [
584
- /* @__PURE__ */ e(ue, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ge, { color: i, percent: a, size: 40, children: /* @__PURE__ */ e(W, { categoryGuid: s.parent_guid, variant: "basic" }) }) }),
581
+ transaction_total: s
582
+ } = t, { setSelectedSubBudget: o } = w();
583
+ return /* @__PURE__ */ e(J, { children: /* @__PURE__ */ m(Q, { onClick: () => o(t), children: [
584
+ /* @__PURE__ */ e(de, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Pe, { color: c, percent: a, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: i.parent_guid, variant: "basic" }) }) }),
585
585
  /* @__PURE__ */ e(
586
- te,
586
+ ee,
587
587
  {
588
- primary: /* @__PURE__ */ e(v, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: t.category.name }) }),
589
- secondary: /* @__PURE__ */ e(v, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(B, { fontWeight: 400, variant: "body1", children: `
590
- ${T(r, "0,0")} /
591
- ${T(n, "0,0")}
588
+ primary: /* @__PURE__ */ e(A, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: t.category.name }) }),
589
+ secondary: /* @__PURE__ */ e(A, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(B, { fontWeight: 400, variant: "body1", children: `
590
+ ${D(s, "0,0")} /
591
+ ${D(n, "0,0")}
592
592
  ` }) })
593
593
  }
594
594
  )
595
595
  ] }) });
596
- }), Lt = w(({ category: t, parentBudget: n }) => {
597
- const { budgets: i, common: s } = D(), { setExpandedGuid: a, setOnSelect: r } = nt(), { addBudget: o } = E(), [c, g] = l.useState(!1), [d, u] = l.useState(!1), [p, h] = l.useState(""), [_, f] = l.useState(void 0);
596
+ }), Nt = I(({ category: t, parentBudget: n }) => {
597
+ const { budgets: c, common: i } = E(), { setExpandedGuid: a, setOnSelect: s } = at(), { addBudget: o } = w(), [r, g] = l.useState(!1), [d, u] = l.useState(!1), [y, p] = l.useState(""), [h, _] = l.useState(void 0);
598
598
  l.useEffect(() => {
599
- r((x) => {
600
- const C = t.subCategories.find((b) => b.guid === x);
601
- C && (f(C), h(`${C.currentAmount === 0 ? "" : C.currentAmount}`), u(!0));
599
+ s((v) => {
600
+ const b = t.subCategories.find((S) => S.guid === v);
601
+ b && (_(b), p(`${b.currentAmount === 0 ? "" : b.currentAmount}`), u(!0));
602
602
  });
603
603
  }, []);
604
- const y = () => {
604
+ const C = () => {
605
605
  a(t.guid), g(!0);
606
- }, A = async () => {
607
- _ && Number(p) > 0 && (await o(_, Number(p), n.guid), u(!1), g(!1), f(void 0));
606
+ }, x = async () => {
607
+ h && Number(y) > 0 && (await o(h, Number(y), n.guid), u(!1), g(!1), _(void 0));
608
608
  };
609
- return /* @__PURE__ */ m(K, { children: [
610
- /* @__PURE__ */ e(Q, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(ee, { onClick: y, children: /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(v, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
611
- /* @__PURE__ */ m(v, { alignItems: "center", direction: "row", gap: 8, children: [
609
+ return /* @__PURE__ */ m(V, { children: [
610
+ /* @__PURE__ */ e(J, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Q, { onClick: C, children: /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ m(A, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
611
+ /* @__PURE__ */ m(A, { alignItems: "center", direction: "row", gap: 8, children: [
612
612
  /* @__PURE__ */ e(j, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
613
- /* @__PURE__ */ e(B, { bold: !0, sx: { color: "primary.light" }, variant: "body1", children: i.add_sub_budget_button })
613
+ /* @__PURE__ */ e(B, { bold: !0, sx: { color: "primary.light" }, variant: "body1", children: c.add_sub_budget_button })
614
614
  ] }),
615
615
  /* @__PURE__ */ e(j, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
616
616
  ] }) }) }) }),
617
- /* @__PURE__ */ e(de, {}),
617
+ /* @__PURE__ */ e(le, {}),
618
618
  /* @__PURE__ */ e(
619
619
  $,
620
620
  {
621
- ariaLabelClose: s.close_aria,
622
- isOpen: c,
621
+ ariaLabelClose: i.close_aria,
622
+ isOpen: r,
623
623
  onClose: () => g(!1),
624
- title: i.add_sub_budget_title,
625
- children: /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(at, { category: t, subCategories: t.subCategories }) })
624
+ title: c.add_sub_budget_title,
625
+ children: /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(rt, { category: t, subCategories: t.subCategories }) })
626
626
  }
627
627
  ),
628
628
  /* @__PURE__ */ e(
629
- U,
629
+ W,
630
630
  {
631
- copy: { close_aria: s.close_aria, title: i.add_title },
632
- disablePrimaryButton: Number(p) <= 0,
631
+ copy: { close_aria: i.close_aria, title: c.add_title },
632
+ disablePrimaryButton: Number(y) <= 0,
633
633
  isOpen: d,
634
634
  onClose: () => u(!1),
635
- onPrimaryAction: A,
636
- primaryText: i.add_save_button,
635
+ onPrimaryAction: x,
636
+ primaryText: c.add_save_button,
637
637
  children: /* @__PURE__ */ e(
638
- pe,
638
+ ge,
639
639
  {
640
- amount: p,
641
- categoryName: _?.name || "",
642
- onAmountChanged: h
640
+ amount: y,
641
+ categoryName: h?.name || "",
642
+ onAmountChanged: p
643
643
  }
644
644
  )
645
645
  }
646
646
  )
647
647
  ] });
648
- }), Nt = w(({ budget: t }) => {
649
- const { category: n, subBudgets: i } = t, { budgets: s, common: a } = D(), { deleteBudget: r, selectedSubBudget: o, setSelectedSubBudget: c, updateBudget: g } = E(), { filter: d, setFilter: u } = J(), [p, h] = l.useState(!1), [_, f] = l.useState(!1), [y, A] = l.useState("");
648
+ }), kt = I(({ budget: t }) => {
649
+ const { category: n, subBudgets: c } = t, { budgets: i, common: a } = E(), { deleteBudget: s, selectedSubBudget: o, setSelectedSubBudget: r, updateBudget: g } = w(), { filter: d, setFilter: u } = q(), [y, p] = l.useState(!1), [h, _] = l.useState(!1), [C, x] = l.useState("");
650
650
  l.useEffect(() => {
651
- o && (A(`${o.amount}`), u({
651
+ o && (x(`${o.amount}`), u({
652
652
  ...d,
653
- custom: (S) => S.category_guid === o.category_guid
653
+ custom: (f) => f.category_guid === o.category_guid
654
654
  }));
655
655
  }, [o]);
656
- const x = async () => {
656
+ const v = async () => {
657
657
  o && await g({
658
658
  ...o,
659
- amount: Number(y)
659
+ amount: Number(C)
660
660
  });
661
- }, C = async () => {
662
- o && await r(o.guid), f(!1), b();
663
- }, b = () => {
661
+ }, b = async () => {
662
+ o && await s(o.guid), _(!1), S();
663
+ }, S = () => {
664
664
  u({
665
665
  ...d,
666
- custom: (S) => S.category_guid === t.category_guid || S.top_level_category_guid === t.category_guid
667
- }), c(void 0);
666
+ custom: (f) => f.category_guid === t.category_guid || f.top_level_category_guid === t.category_guid
667
+ }), r(void 0);
668
668
  };
669
669
  return /* @__PURE__ */ m(l.Fragment, { children: [
670
- /* @__PURE__ */ m(Y, { sx: { bgcolor: "background.paper" }, children: [
671
- i.length === 0 ? /* @__PURE__ */ e(Mt, {}) : i.map((S) => /* @__PURE__ */ m(l.Fragment, { children: [
672
- /* @__PURE__ */ e(Rt, { budget: S }),
673
- /* @__PURE__ */ e(de, {})
674
- ] }, S.guid)),
675
- /* @__PURE__ */ e(Lt, { category: n, parentBudget: t })
670
+ /* @__PURE__ */ m(K, { sx: { bgcolor: "background.paper" }, children: [
671
+ c.length === 0 ? /* @__PURE__ */ e(Rt, {}) : c.map((f) => /* @__PURE__ */ m(l.Fragment, { children: [
672
+ /* @__PURE__ */ e(Lt, { budget: f }),
673
+ /* @__PURE__ */ e(le, {})
674
+ ] }, f.guid)),
675
+ /* @__PURE__ */ e(Nt, { category: n, parentBudget: t })
676
676
  ] }),
677
677
  /* @__PURE__ */ e(
678
678
  $,
679
679
  {
680
680
  ariaLabelClose: a.close_aria,
681
681
  isOpen: !!o,
682
- onClose: b,
683
- onPrimaryAction: () => h(!0),
684
- onSecondaryAction: () => f(!0),
685
- primaryText: s.details_edit_button,
686
- secondaryText: s.details_delete_button,
687
- title: s.details_title,
688
- children: o && /* @__PURE__ */ m(v, { gap: 24, children: [
689
- /* @__PURE__ */ e(He, { budget: o }),
682
+ onClose: S,
683
+ onPrimaryAction: () => p(!0),
684
+ onSecondaryAction: () => _(!0),
685
+ primaryText: i.details_edit_button,
686
+ secondaryText: i.details_delete_button,
687
+ title: i.details_title,
688
+ children: o && /* @__PURE__ */ m(A, { gap: 24, children: [
689
+ /* @__PURE__ */ e(Ve, { budget: o }),
690
690
  /* @__PURE__ */ e(Ae, { height: "100%" })
691
691
  ] })
692
692
  }
693
693
  ),
694
694
  o && /* @__PURE__ */ m(l.Fragment, { children: [
695
695
  /* @__PURE__ */ e(
696
- U,
696
+ W,
697
697
  {
698
- copy: { close_aria: a.close_aria, title: s.details_edit_title },
699
- disablePrimaryButton: Number(y) <= 0,
700
- isOpen: p,
701
- onClose: () => h(!1),
702
- onPrimaryAction: x,
703
- primaryText: s.edit_save_button,
698
+ copy: { close_aria: a.close_aria, title: i.details_edit_title },
699
+ disablePrimaryButton: Number(C) <= 0,
700
+ isOpen: y,
701
+ onClose: () => p(!1),
702
+ onPrimaryAction: v,
703
+ primaryText: i.edit_save_button,
704
704
  children: /* @__PURE__ */ e(
705
- pe,
705
+ ge,
706
706
  {
707
- amount: y,
707
+ amount: C,
708
708
  categoryName: o.category.name,
709
- onAmountChanged: A
709
+ onAmountChanged: x
710
710
  }
711
711
  )
712
712
  }
713
713
  ),
714
714
  /* @__PURE__ */ e(
715
- U,
715
+ W,
716
716
  {
717
- copy: { close_aria: a.close_aria, title: s.delete_title },
718
- isOpen: _,
719
- onClose: () => f(!1),
720
- onPrimaryAction: C,
717
+ copy: { close_aria: a.close_aria, title: i.delete_title },
718
+ isOpen: h,
719
+ onClose: () => _(!1),
720
+ onPrimaryAction: b,
721
721
  primaryColor: "error",
722
722
  primaryText: "Delete",
723
723
  secondaryColor: "secondary",
724
- children: /* @__PURE__ */ e(B, { variant: "subtitle1", children: N(s.delete_description, o.category.name) })
724
+ children: /* @__PURE__ */ e(B, { variant: "subtitle1", children: L(i.delete_description, o.category.name) })
725
725
  }
726
726
  )
727
727
  ] })
728
728
  ] });
729
- }), kt = w(({ budget: t }) => {
730
- const { is_mobile_webview: n } = Le(), { setAlert: i } = E(), { budgets: s, common: a, transactions: r } = D(), { isDesktop: o, isSmallTablet: c, isTablet: g } = me(), {
729
+ }), $t = I(({ budget: t }) => {
730
+ const { is_mobile_webview: n } = Ne(), { setAlert: c } = w(), { budgets: i, common: a, transactions: s } = E(), { isDesktop: o, isSmallTablet: r, isTablet: g } = ue(), {
731
731
  sortedTransactions: d,
732
732
  sortedTransactionsWithSplits: u,
733
- tags: p
734
- } = J(), [h, _] = l.useState(0), [f, y] = l.useState(""), A = l.useMemo(
735
- () => d.find((S) => S.guid === f),
736
- [f, d]
737
- ), x = (S, I) => {
738
- _(I);
739
- }, C = () => {
740
- et(u, p), i(s.alert_csv_downloaded);
741
- }, b = d.length > 0 && !n && (o || g && !c);
742
- return /* @__PURE__ */ m(v, { gap: 24, children: [
743
- /* @__PURE__ */ e(He, { budget: t }),
744
- /* @__PURE__ */ m(v, { children: [
733
+ tags: y
734
+ } = q(), [p, h] = l.useState(0), [_, C] = l.useState(""), x = l.useMemo(
735
+ () => d.find((f) => f.guid === _),
736
+ [_, d]
737
+ ), v = (f, T) => {
738
+ h(T);
739
+ }, b = () => {
740
+ tt(u, y), c(i.alert_csv_downloaded);
741
+ }, S = d.length > 0 && !n && (o || g && !r);
742
+ return /* @__PURE__ */ m(A, { gap: 24, children: [
743
+ /* @__PURE__ */ e(Ve, { budget: t }),
744
+ /* @__PURE__ */ m(A, { children: [
745
745
  /* @__PURE__ */ m(
746
- Qe,
746
+ et,
747
747
  {
748
- onChange: x,
748
+ onChange: v,
749
749
  sx: { width: "100%" },
750
750
  textColor: "primary",
751
- value: h,
751
+ value: p,
752
752
  variant: "fullWidth",
753
753
  children: [
754
- /* @__PURE__ */ e(De, { label: s.details_transactions_tab }),
755
- /* @__PURE__ */ e(De, { label: s.details_subbudgets_tab })
754
+ /* @__PURE__ */ e(Ee, { label: i.details_transactions_tab }),
755
+ /* @__PURE__ */ e(Ee, { label: i.details_subbudgets_tab })
756
756
  ]
757
757
  }
758
758
  ),
759
- h === 0 && /* @__PURE__ */ m(v, { children: [
760
- b && /* @__PURE__ */ e(v, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
761
- ke,
759
+ p === 0 && /* @__PURE__ */ m(A, { children: [
760
+ S && /* @__PURE__ */ e(A, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
761
+ $e,
762
762
  {
763
- onClick: C,
763
+ onClick: b,
764
764
  startIcon: /* @__PURE__ */ e(j, { name: "ios_share" }),
765
765
  variant: "text",
766
- children: r.export_csv_btn
766
+ children: s.export_csv_btn
767
767
  }
768
768
  ) }),
769
- /* @__PURE__ */ e(Ae, { height: "100%", onClick: y })
769
+ /* @__PURE__ */ e(Ae, { height: "100%", onClick: C })
770
770
  ] }),
771
- h === 1 && /* @__PURE__ */ e(Nt, { budget: t }),
771
+ p === 1 && /* @__PURE__ */ e(kt, { budget: t }),
772
772
  /* @__PURE__ */ e(
773
773
  $,
774
774
  {
775
775
  ariaLabelClose: a.close_aria,
776
- isOpen: !!A,
777
- onClose: () => y(""),
778
- title: s.details_transaction_drawer,
779
- children: A && /* @__PURE__ */ e(tt, { transaction: A })
776
+ isOpen: !!x,
777
+ onClose: () => C(""),
778
+ title: i.details_transaction_drawer,
779
+ children: x && /* @__PURE__ */ e(ot, { transaction: x })
780
780
  }
781
781
  )
782
782
  ] })
783
783
  ] });
784
- }), $t = w(() => {
785
- const { selectedAccountGuids: t } = q(), { budgets: n, common: i } = D(), {
786
- alert: s,
784
+ }), Gt = I(() => {
785
+ const { selectedAccountGuids: t } = Z(), { budgets: n, common: c } = E(), {
786
+ alert: i,
787
787
  dateRange: a,
788
- deleteBudget: r,
788
+ deleteBudget: s,
789
789
  selectedBudget: o,
790
- selectedSubBudget: c,
790
+ selectedSubBudget: r,
791
791
  setAlert: g,
792
792
  setSelectedBudget: d,
793
793
  updateBudget: u
794
- } = E(), { setFilter: p } = J(), [h, _] = l.useState(!1), [f, y] = l.useState(!1), [A, x] = l.useState(!1), [C, b] = l.useState("");
794
+ } = w(), { setFilter: y } = q(), [p, h] = l.useState(!1), [_, C] = l.useState(!1), [x, v] = l.useState(!1), [b, S] = l.useState("");
795
795
  l.useEffect(() => {
796
- o && !c && (b(`${o.amount}`), _(!0), p({
796
+ o && !r && (S(`${o.amount}`), h(!0), y({
797
797
  accounts: t,
798
798
  dateRange: a,
799
799
  custom: (O) => O.category_guid === o.category_guid || O.top_level_category_guid === o.category_guid,
800
800
  showSplits: !0
801
801
  }));
802
802
  }, [o]);
803
- const S = async () => {
803
+ const f = async () => {
804
804
  o && (await u({
805
805
  ...o,
806
- amount: Number(C),
807
- percentage: o.category.totalAmount / Number(C) * 100
808
- }), y(!1), g(N(n.alert_budget_updated, o.category.name)));
809
- }, I = async () => {
810
- o && (await r(o.guid), g(N(n.alert_budget_deleted, o.category.name))), L();
811
- }, L = () => {
812
- _(!1), setTimeout(() => {
806
+ amount: Number(b),
807
+ percentage: o.category.totalAmount / Number(b) * 100
808
+ }), C(!1), g(L(n.alert_budget_updated, o.category.name)));
809
+ }, T = async () => {
810
+ o && (await s(o.guid), g(L(n.alert_budget_deleted, o.category.name))), N();
811
+ }, N = () => {
812
+ h(!1), setTimeout(() => {
813
813
  d(void 0);
814
814
  }, 250);
815
- }, M = () => {
816
- y(!1), b(`${o?.amount}`);
815
+ }, R = () => {
816
+ C(!1), S(`${o?.amount}`);
817
817
  };
818
818
  if (o)
819
819
  return /* @__PURE__ */ m(l.Fragment, { children: [
820
820
  /* @__PURE__ */ m(
821
821
  $,
822
822
  {
823
- ariaLabelClose: i.close_aria,
824
- isOpen: h,
825
- onClose: L,
826
- onPrimaryAction: () => y(!0),
827
- onSecondaryAction: () => x(!0),
823
+ ariaLabelClose: c.close_aria,
824
+ isOpen: p,
825
+ onClose: N,
826
+ onPrimaryAction: () => C(!0),
827
+ onSecondaryAction: () => v(!0),
828
828
  primaryText: n.details_edit_button,
829
829
  secondaryColor: "error",
830
830
  secondaryText: n.details_delete_button,
831
831
  title: n.details_title,
832
832
  children: [
833
- /* @__PURE__ */ e(kt, { budget: o }),
833
+ /* @__PURE__ */ e($t, { budget: o }),
834
834
  /* @__PURE__ */ e(
835
835
  xe,
836
836
  {
837
837
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
838
838
  autoHideDuration: 3500,
839
839
  onClose: () => g(""),
840
- open: !!s,
841
- children: /* @__PURE__ */ e(Se, { closeText: "", onClose: () => g(""), severity: "success", variant: "filled", children: s })
840
+ open: !!i,
841
+ children: /* @__PURE__ */ e(Se, { closeText: "", onClose: () => g(""), severity: "success", variant: "filled", children: i })
842
842
  }
843
843
  )
844
844
  ]
845
845
  }
846
846
  ),
847
847
  /* @__PURE__ */ e(
848
- U,
848
+ W,
849
849
  {
850
- copy: { close_aria: i.close_aria, title: n.details_edit_title },
851
- disablePrimaryButton: Number(C) <= 0,
852
- isOpen: f,
853
- onClose: M,
854
- onPrimaryAction: S,
855
- onSecondaryAction: M,
850
+ copy: { close_aria: c.close_aria, title: n.details_edit_title },
851
+ disablePrimaryButton: Number(b) <= 0,
852
+ isOpen: _,
853
+ onClose: R,
854
+ onPrimaryAction: f,
855
+ onSecondaryAction: R,
856
856
  primaryText: n.edit_save_button,
857
857
  children: /* @__PURE__ */ e(
858
- pe,
858
+ ge,
859
859
  {
860
- amount: C,
860
+ amount: b,
861
861
  categoryName: o.category.name,
862
- onAmountChanged: b
862
+ onAmountChanged: S
863
863
  }
864
864
  )
865
865
  }
866
866
  ),
867
867
  /* @__PURE__ */ e(
868
- U,
868
+ W,
869
869
  {
870
- copy: { close_aria: i.close_aria, title: n.delete_title },
871
- isOpen: A,
872
- onClose: () => x(!1),
873
- onPrimaryAction: I,
870
+ copy: { close_aria: c.close_aria, title: n.delete_title },
871
+ isOpen: x,
872
+ onClose: () => v(!1),
873
+ onPrimaryAction: T,
874
874
  primaryColor: "error",
875
875
  primaryText: n.details_delete_button,
876
876
  secondaryColor: "secondary",
877
- children: /* @__PURE__ */ e(B, { variant: "subtitle1", children: N(n.delete_description, o.category.name) })
877
+ children: /* @__PURE__ */ e(B, { variant: "subtitle1", children: L(n.delete_description, o.category.name) })
878
878
  }
879
879
  )
880
880
  ] });
881
- }), Gt = ({ budget: t, onClick: n }) => {
881
+ }), Pt = ({ budget: t, onClick: n }) => {
882
882
  const {
883
- amount: i,
884
- budgetColors: { background: s, description: a },
885
- category_guid: r,
883
+ amount: c,
884
+ budgetColors: { background: i, description: a },
885
+ category_guid: s,
886
886
  description: o,
887
- percentage: c,
887
+ percentage: r,
888
888
  subBudgets: g,
889
889
  transaction_total: d
890
- } = t, u = c > 100;
891
- return /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ m(ee, { onClick: () => n?.(t), children: [
892
- /* @__PURE__ */ e(ue, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Ge, { color: s, percent: c, size: 40, children: /* @__PURE__ */ e(W, { categoryGuid: r, variant: "basic" }) }) }),
890
+ } = t, u = r > 100;
891
+ return /* @__PURE__ */ e(J, { children: /* @__PURE__ */ m(Q, { onClick: () => n?.(t), children: [
892
+ /* @__PURE__ */ e(de, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Pe, { color: i, percent: r, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: s, variant: "basic" }) }) }),
893
893
  /* @__PURE__ */ e(
894
- te,
894
+ ee,
895
895
  {
896
- primary: /* @__PURE__ */ m(v, { component: "span", direction: "row", justifyContent: "space-between", children: [
896
+ primary: /* @__PURE__ */ m(A, { component: "span", direction: "row", justifyContent: "space-between", children: [
897
897
  /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: t.category.name }),
898
898
  /* @__PURE__ */ e(B, { fontWeight: 400, variant: "body1", children: `
899
- ${T(d, "0,0")} /
900
- ${T(i, "0,0")}
899
+ ${D(d, "0,0")} /
900
+ ${D(c, "0,0")}
901
901
  ` })
902
902
  ] }),
903
- secondary: /* @__PURE__ */ m(v, { component: "span", direction: "row", justifyContent: "space-between", children: [
903
+ secondary: /* @__PURE__ */ m(A, { component: "span", direction: "row", justifyContent: "space-between", children: [
904
904
  /* @__PURE__ */ e(B, { variant: "caption", children: `${g.length} Sub-budgets` }),
905
905
  /* @__PURE__ */ e(
906
906
  B,
@@ -922,86 +922,86 @@ const wt = ({
922
922
  }
923
923
  )
924
924
  ] }) });
925
- }, Pt = w(() => {
926
- const { onEvent: t } = Z(), { budgets: n } = D(), { detailedBudgets: i, setSelectedBudget: s } = E(), a = (r) => {
927
- s(r), t(G.BUDGETS_CLICK_BUDGET_CATEGORY, {
928
- budget_category: r.category.name,
925
+ }, jt = I(() => {
926
+ const { onEvent: t } = X(), { budgets: n } = E(), { detailedBudgets: c, setSelectedBudget: i } = w(), a = (s) => {
927
+ i(s), t(G.BUDGETS_CLICK_BUDGET_CATEGORY, {
928
+ budget_category: s.category.name,
929
929
  click_type: "list"
930
930
  });
931
931
  };
932
932
  return /* @__PURE__ */ m(ve, { elevation: 2, children: [
933
- /* @__PURE__ */ e(Pe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Re, { children: n.budget_categories_title }) }),
934
- /* @__PURE__ */ e(Te, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(Y, { children: i.map((r) => /* @__PURE__ */ m(l.Fragment, { children: [
935
- /* @__PURE__ */ e(Gt, { budget: r, onClick: a }),
936
- /* @__PURE__ */ e(de, {})
937
- ] }, r.guid)) }) })
933
+ /* @__PURE__ */ e(je, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Le, { children: n.budget_categories_title }) }),
934
+ /* @__PURE__ */ e(Te, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(K, { children: c.map((s) => /* @__PURE__ */ m(l.Fragment, { children: [
935
+ /* @__PURE__ */ e(Pt, { budget: s, onClick: a }),
936
+ /* @__PURE__ */ e(le, {})
937
+ ] }, s.guid)) }) })
938
938
  ] });
939
- }), jt = w(() => {
940
- const t = ie(), { onEvent: n } = Z(), { visibleAccounts: i } = Ne(), { budgets: s, common: a, recurring: r } = D(), { incomeCategories: o, spendCategories: c } = X(), { detailedBudgets: g, totalBudgeted: d } = E(), { incomeTotal: u } = ce(), { setFilter: p } = J(), [h, _] = l.useState(!1), [f, y] = l.useMemo(() => {
941
- const b = c.reduce((M, O) => M + O.totalAmount, 0);
942
- let S = b / d;
943
- S > 1 && (S = 1);
944
- let I = t.palette.success.main;
945
- S > 0.8 && S < 1 ? I = t.palette.warning.main : S >= 1 && (I = t.palette.error.main);
946
- const L = [
939
+ }), zt = I(() => {
940
+ const t = se(), { onEvent: n } = X(), { visibleAccounts: c } = ke(), { budgets: i, common: a, recurring: s } = E(), { incomeCategories: o, spendCategories: r } = Y(), { detailedBudgets: g, totalBudgeted: d } = w(), { incomeTotal: u } = ie(), { setFilter: y } = q(), [p, h] = l.useState(!1), [_, C] = l.useMemo(() => {
941
+ const S = r.reduce((R, O) => R + O.totalAmount, 0);
942
+ let f = S / d;
943
+ f > 1 && (f = 1);
944
+ let T = t.palette.success.main;
945
+ f > 0.8 && f < 1 ? T = t.palette.warning.main : f >= 1 && (T = t.palette.error.main);
946
+ const N = [
947
947
  {
948
- color: I,
949
- percentage: `${S}`
948
+ color: T,
949
+ percentage: `${f}`
950
950
  }
951
951
  ];
952
- return [b, L];
953
- }, [g, c]), [A, x] = l.useMemo(() => {
954
- const b = Math.abs(
955
- o.reduce((L, M) => L + M.totalAmount, 0)
952
+ return [S, N];
953
+ }, [g, r]), [x, v] = l.useMemo(() => {
954
+ const S = Math.abs(
955
+ o.reduce((N, R) => N + R.totalAmount, 0)
956
956
  );
957
- let S = b / u;
958
- S > 1 && (S = 1);
959
- const I = [
957
+ let f = S / u;
958
+ f > 1 && (f = 1);
959
+ const T = [
960
960
  {
961
961
  color: t.palette.secondary.main,
962
- percentage: `${S}`
962
+ percentage: `${f}`
963
963
  }
964
964
  ];
965
- return [b, I];
966
- }, [o, u]), C = () => {
967
- p({
968
- accounts: i.map((b) => b.guid),
965
+ return [S, T];
966
+ }, [o, u]), b = () => {
967
+ y({
968
+ accounts: c.map((S) => S.guid),
969
969
  dateRange: {
970
- start: rt(/* @__PURE__ */ new Date(), 90),
970
+ start: st(/* @__PURE__ */ new Date(), 90),
971
971
  end: /* @__PURE__ */ new Date()
972
972
  }
973
- }), _(!0), n(G.BUDGETS_CLICK_EDIT_INCOME);
973
+ }), h(!0), n(G.BUDGETS_CLICK_EDIT_INCOME);
974
974
  };
975
975
  return /* @__PURE__ */ m(ve, { elevation: 2, sx: { overflow: "visible" }, children: [
976
- /* @__PURE__ */ e(Pe, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Re, { children: s.overview_title }) }),
977
- /* @__PURE__ */ e(Te, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ m(v, { gap: 24, children: [
978
- /* @__PURE__ */ m(v, { gap: 8, children: [
979
- /* @__PURE__ */ e(B, { bold: !0, sx: { mb: 8 }, variant: "body1", children: s.spending_title }),
980
- /* @__PURE__ */ e(Be, { data: y, height: 16 }),
981
- /* @__PURE__ */ e(B, { variant: "body2", children: N(
982
- s.spending_description,
983
- T(f, "0,0"),
984
- T(d, "0,0")
976
+ /* @__PURE__ */ e(je, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Le, { children: i.overview_title }) }),
977
+ /* @__PURE__ */ e(Te, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ m(A, { gap: 24, children: [
978
+ /* @__PURE__ */ m(A, { gap: 8, children: [
979
+ /* @__PURE__ */ e(B, { bold: !0, sx: { mb: 8 }, variant: "body1", children: i.spending_title }),
980
+ /* @__PURE__ */ e(Be, { data: C, height: 16 }),
981
+ /* @__PURE__ */ e(B, { variant: "body2", children: L(
982
+ i.spending_description,
983
+ D(_, "0,0"),
984
+ D(d, "0,0")
985
985
  ) })
986
986
  ] }),
987
- /* @__PURE__ */ m(v, { gap: 8, children: [
988
- /* @__PURE__ */ m(v, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
989
- /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: s.income_title }),
987
+ /* @__PURE__ */ m(A, { gap: 8, children: [
988
+ /* @__PURE__ */ m(A, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
989
+ /* @__PURE__ */ e(B, { bold: !0, variant: "body1", children: i.income_title }),
990
990
  /* @__PURE__ */ e(
991
- st,
991
+ it,
992
992
  {
993
- "aria-label": r.manage_income,
994
- onClick: C,
993
+ "aria-label": s.manage_income,
994
+ onClick: b,
995
995
  sx: { p: 0 },
996
996
  children: /* @__PURE__ */ e(j, { color: "primary", name: "edit" })
997
997
  }
998
998
  )
999
999
  ] }),
1000
- /* @__PURE__ */ e(Be, { data: x, height: 16 }),
1001
- /* @__PURE__ */ e(B, { variant: "body2", children: N(
1002
- s.income_description,
1003
- T(A, "0,0"),
1004
- T(u, "0,0")
1000
+ /* @__PURE__ */ e(Be, { data: v, height: 16 }),
1001
+ /* @__PURE__ */ e(B, { variant: "body2", children: L(
1002
+ i.income_description,
1003
+ D(x, "0,0"),
1004
+ D(u, "0,0")
1005
1005
  ) })
1006
1006
  ] })
1007
1007
  ] }) }),
@@ -1009,114 +1009,114 @@ const wt = ({
1009
1009
  $,
1010
1010
  {
1011
1011
  ariaLabelClose: a.close_aria,
1012
- isOpen: h,
1013
- onClose: () => _(!1),
1014
- title: r.manage_income,
1015
- children: /* @__PURE__ */ e(it, { forOverview: !0 })
1012
+ isOpen: p,
1013
+ onClose: () => h(!1),
1014
+ title: s.manage_income,
1015
+ children: /* @__PURE__ */ e(ct, { forOverview: !0 })
1016
1016
  }
1017
1017
  )
1018
1018
  ] });
1019
- }), Me = 480, Wo = w(({ onBackClick: t, sx: n }) => {
1020
- const i = ie(), { onEvent: s } = Z(), { visibleAccounts: a } = Ne(), { budgets: r, common: o } = D(), { isInitialized: c, selectedAccounts: g, setDisplayedDate: d } = q(), {
1019
+ }), Re = 480, Ho = I(({ onBackClick: t, sx: n }) => {
1020
+ const c = se(), { onEvent: i } = X(), { visibleAccounts: a } = ke(), { budgets: s, common: o } = E(), { isInitialized: r, selectedAccounts: g, setDisplayedDate: d } = Z(), {
1021
1021
  alert: u,
1022
- dateRange: p,
1023
- isDataLoaded: h,
1024
- loadBudgetData: _,
1025
- setDateRange: f,
1026
- setAlert: y,
1027
- setTheme: A,
1028
- detailedBudgets: x
1029
- } = E(), { setDateRange: C } = ce(), { loadDateRangeCategoryTotals: b, loadMonthlyCategoryTotals: S } = X(), { isSmallTablet: I, isMobile: L, isSmallMobile: M } = me(), O = I || L || M, [z, k] = l.useState(!1);
1030
- je({
1022
+ dateRange: y,
1023
+ isDataLoaded: p,
1024
+ loadBudgetData: h,
1025
+ setDateRange: _,
1026
+ setAlert: C,
1027
+ setTheme: x,
1028
+ detailedBudgets: v
1029
+ } = w(), { setDateRange: b } = ie(), { loadDateRangeCategoryTotals: S, loadMonthlyCategoryTotals: f } = Y(), { isSmallTablet: T, isMobile: N, isSmallMobile: R } = ue(), O = T || N || R, [z, k] = l.useState(!1);
1030
+ ze({
1031
1031
  widgetName: "BubbleBudgetsWidget",
1032
- isLoaded: h
1032
+ isLoaded: p
1033
1033
  }), l.useEffect(() => {
1034
- A(i), h || _().finally(() => {
1035
- s(G.BUDGETS_VIEW);
1034
+ x(c), p || h().finally(() => {
1035
+ i(G.BUDGETS_VIEW);
1036
1036
  });
1037
- }, []), l.useEffect(() => (f({ start: re(ne()), end: Ce(ne()) }), () => {
1038
- f({ start: re(ne()), end: Ce(ne()) });
1037
+ }, []), l.useEffect(() => (_({ start: ae(oe()), end: Ce(oe()) }), () => {
1038
+ _({ start: ae(oe()), end: Ce(oe()) });
1039
1039
  }), [a]), l.useEffect(() => {
1040
- c && (d(p.start, p.end), b(g, p.start, p.end).finally(), S(g).finally(), C(p));
1041
- }, [c, g, p]);
1042
- const he = (V) => {
1043
- f({ start: V[0] || /* @__PURE__ */ new Date(), end: V[1] || /* @__PURE__ */ new Date() });
1040
+ r && (d(y.start, y.end), S(g, y.start, y.end).finally(), f(g).finally(), b(y));
1041
+ }, [r, g, y]);
1042
+ const pe = (F) => {
1043
+ _({ start: F[0] || /* @__PURE__ */ new Date(), end: F[1] || /* @__PURE__ */ new Date() });
1044
+ }, he = () => {
1045
+ i(G.BUDGETS_CLICK_FILTER);
1046
+ }, te = () => {
1047
+ k(!0), i(G.BUDGETS_CLICK_ADD);
1044
1048
  }, be = () => {
1045
- s(G.BUDGETS_CLICK_FILTER);
1046
- }, oe = () => {
1047
- k(!0), s(G.BUDGETS_CLICK_ADD);
1048
- }, fe = () => {
1049
1049
  k(!1);
1050
- }, P = () => {
1050
+ }, fe = () => {
1051
1051
  k(!1);
1052
- }, H = Ke(p.end, re(/* @__PURE__ */ new Date()));
1053
- return !c || !h ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ m(
1054
- ct,
1052
+ }, P = Ye(y.end, ae(/* @__PURE__ */ new Date()));
1053
+ return !r || !p ? /* @__PURE__ */ e(me, {}) : /* @__PURE__ */ m(
1054
+ lt,
1055
1055
  {
1056
1056
  actions: [
1057
1057
  {
1058
1058
  iconName: "add",
1059
- label: r.add_title,
1060
- onClick: oe
1059
+ label: s.add_title,
1060
+ onClick: te
1061
1061
  }
1062
1062
  ],
1063
1063
  calendarActions: {
1064
- onRangeChanged: he,
1065
- shouldDisableNext: H,
1064
+ onRangeChanged: pe,
1065
+ shouldDisableNext: P,
1066
1066
  shouldDisablePicker: !0
1067
1067
  },
1068
- onAccountsFilterClick: be,
1068
+ onAccountsFilterClick: he,
1069
1069
  onBackClick: t,
1070
1070
  sx: n,
1071
- title: r.budgets_title,
1071
+ title: s.budgets_title,
1072
1072
  children: [
1073
1073
  /* @__PURE__ */ m(
1074
- v,
1074
+ A,
1075
1075
  {
1076
1076
  direction: O ? "column" : "row",
1077
1077
  height: "100%",
1078
1078
  sx: { justifyContent: "center" },
1079
1079
  width: "100%",
1080
1080
  children: [
1081
- /* @__PURE__ */ e(v, { height: O ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1082
- We,
1081
+ /* @__PURE__ */ e(A, { height: O ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1082
+ He,
1083
1083
  {
1084
- createBudgetOnClick: oe,
1084
+ createBudgetOnClick: te,
1085
1085
  height: O ? 450 : 800,
1086
1086
  isDraggable: !0,
1087
- shouldShowZeroState: x.length === 0,
1088
- unavailableWidth: O ? 0 : Me
1087
+ shouldShowZeroState: v.length === 0,
1088
+ unavailableWidth: O ? 0 : Re
1089
1089
  }
1090
1090
  ) }),
1091
- x.length !== 0 && /* @__PURE__ */ m(
1092
- v,
1091
+ v.length !== 0 && /* @__PURE__ */ m(
1092
+ A,
1093
1093
  {
1094
1094
  gap: 24,
1095
1095
  height: "100%",
1096
1096
  sx: { mr: 24, mt: 48 },
1097
- width: O ? "100%" : Me,
1097
+ width: O ? "100%" : Re,
1098
1098
  children: [
1099
- /* @__PURE__ */ e(jt, {}),
1100
- /* @__PURE__ */ e(Pt, {})
1099
+ /* @__PURE__ */ e(zt, {}),
1100
+ /* @__PURE__ */ e(jt, {})
1101
1101
  ]
1102
1102
  }
1103
1103
  )
1104
1104
  ]
1105
1105
  }
1106
1106
  ),
1107
- /* @__PURE__ */ e($t, {}),
1107
+ /* @__PURE__ */ e(Gt, {}),
1108
1108
  /* @__PURE__ */ e(
1109
1109
  $,
1110
1110
  {
1111
1111
  ariaLabelClose: o.close_aria,
1112
1112
  isOpen: z,
1113
1113
  onClose: () => k(!1),
1114
- title: r.add_new_title,
1114
+ title: s.add_new_title,
1115
1115
  children: /* @__PURE__ */ e(
1116
- ze,
1116
+ Fe,
1117
1117
  {
1118
- onAddBudget: fe,
1119
- onRecalculateBudgets: P
1118
+ onAddBudget: be,
1119
+ onRecalculateBudgets: fe
1120
1120
  }
1121
1121
  )
1122
1122
  }
@@ -1127,7 +1127,7 @@ const wt = ({
1127
1127
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
1128
1128
  autoHideDuration: 3500,
1129
1129
  onClose: () => {
1130
- y("");
1130
+ C("");
1131
1131
  },
1132
1132
  open: !!u,
1133
1133
  children: /* @__PURE__ */ e(
@@ -1135,7 +1135,7 @@ const wt = ({
1135
1135
  {
1136
1136
  closeText: "",
1137
1137
  onClose: () => {
1138
- y("");
1138
+ C("");
1139
1139
  },
1140
1140
  severity: "success",
1141
1141
  variant: "filled",
@@ -1147,88 +1147,88 @@ const wt = ({
1147
1147
  ]
1148
1148
  }
1149
1149
  );
1150
- }), zt = ({
1150
+ }), Ft = ({
1151
1151
  budgetsCopy: t,
1152
1152
  difference: n,
1153
- handleAddClick: i,
1154
- shouldShowZeroState: s
1153
+ handleAddClick: c,
1154
+ shouldShowZeroState: i
1155
1155
  }) => {
1156
- const { availableHeight: a = 0 } = le(), r = l.useRef(null);
1156
+ const { availableHeight: a = 0 } = ce(), s = l.useRef(null);
1157
1157
  l.useEffect(() => {
1158
- a > 0 && r.current === null && (r.current = a);
1158
+ a > 0 && s.current === null && (s.current = a);
1159
1159
  }, [a]);
1160
1160
  const o = l.useMemo(() => {
1161
- const c = r.current ?? a;
1162
- return c > 0 ? Math.round(Math.max(120, Math.min(450, c * 0.8))) - 40 : 450;
1161
+ const r = s.current ?? a;
1162
+ return r > 0 ? Math.round(Math.max(120, Math.min(450, r * 0.8))) - 40 : 450;
1163
1163
  }, [a]);
1164
- return /* @__PURE__ */ m(v, { sx: { height: "100%", justifyContent: "space-between" }, children: [
1164
+ return /* @__PURE__ */ m(A, { sx: { height: "100%", justifyContent: "space-between" }, children: [
1165
1165
  /* @__PURE__ */ e(
1166
- We,
1166
+ He,
1167
1167
  {
1168
- createBudgetOnClick: i,
1168
+ createBudgetOnClick: c,
1169
1169
  height: o,
1170
1170
  isMiniWidget: !0,
1171
- shouldShowZeroState: s
1171
+ shouldShowZeroState: i
1172
1172
  }
1173
1173
  ),
1174
- !s && /* @__PURE__ */ m(K, { ml: 16, children: [
1175
- /* @__PURE__ */ e(B, { bold: !0, color: n < 0 ? "error.main" : "success.main", children: T(Math.abs(n), "0,0") }),
1174
+ !i && /* @__PURE__ */ m(V, { ml: 16, children: [
1175
+ /* @__PURE__ */ e(B, { bold: !0, color: n < 0 ? "error.main" : "success.main", children: D(Math.abs(n), "0,0") }),
1176
1176
  /* @__PURE__ */ e(B, { children: n < 0 ? t.overspent_in_budgets : t.left_in_budgets })
1177
1177
  ] })
1178
1178
  ] });
1179
- }, Ft = (t) => {
1180
- const n = ie(), { onEvent: i } = Z(), { detailedBudgets: s, isDataLoaded: a, loadBudgetData: r, setTheme: o } = E(), { budgets: c, common: g } = D(), { isInitialized: d, selectedAccounts: u } = q(), { loadDateRangeCategoryTotals: p, loadMonthlyCategoryTotals: h } = X(), _ = lt(), [f, y] = l.useState(!1);
1179
+ }, Ut = (t) => {
1180
+ const n = se(), { onEvent: c } = X(), { detailedBudgets: i, isDataLoaded: a, loadBudgetData: s, setTheme: o } = w(), { budgets: r, common: g } = E(), { isInitialized: d, selectedAccounts: u } = Z(), { loadDateRangeCategoryTotals: y, loadMonthlyCategoryTotals: p } = Y(), h = dt(), [_, C] = l.useState(!1);
1181
1181
  l.useEffect(() => {
1182
- a || r().finally();
1182
+ a || s().finally();
1183
1183
  }, []), l.useEffect(() => {
1184
1184
  o(n);
1185
1185
  }, [n]), l.useEffect(() => {
1186
- d && !a && (p(
1186
+ d && !a && (y(
1187
1187
  u,
1188
- re(/* @__PURE__ */ new Date()),
1188
+ ae(/* @__PURE__ */ new Date()),
1189
1189
  Ce(/* @__PURE__ */ new Date())
1190
- ).finally(), h(u).finally());
1190
+ ).finally(), p(u).finally());
1191
1191
  }, [d, u, a]);
1192
- const A = () => {
1193
- y(!0), i(G.BUDGETS_CLICK_ADD);
1194
- }, x = () => {
1195
- y(!1);
1196
- }, C = () => y(!1);
1197
- if (je({
1192
+ const x = () => {
1193
+ C(!0), c(G.BUDGETS_CLICK_ADD);
1194
+ }, v = () => {
1195
+ C(!1);
1196
+ }, b = () => C(!1);
1197
+ if (ze({
1198
1198
  widgetName: "BubbleBudgetsMiniWidget",
1199
1199
  isLoaded: a
1200
- }), !d || !a) return /* @__PURE__ */ e(ge, {});
1201
- const b = s.length === 0;
1200
+ }), !d || !a) return /* @__PURE__ */ e(me, {});
1201
+ const S = i.length === 0;
1202
1202
  return /* @__PURE__ */ m(
1203
- mt,
1203
+ gt,
1204
1204
  {
1205
1205
  contentStyles: { height: "calc(100% - 66px)", ":last-child": { pb: 0 } },
1206
- primaryCtaLabel: b ? c.get_started_cta : c.details_cta,
1206
+ primaryCtaLabel: S ? r.get_started_cta : r.details_cta,
1207
1207
  sx: { height: "100%" },
1208
- title: c.budgets_title,
1208
+ title: r.budgets_title,
1209
1209
  ...t,
1210
1210
  children: [
1211
1211
  /* @__PURE__ */ e(
1212
- zt,
1212
+ Ft,
1213
1213
  {
1214
- budgetsCopy: c,
1215
- difference: _,
1216
- handleAddClick: A,
1217
- shouldShowZeroState: b
1214
+ budgetsCopy: r,
1215
+ difference: h,
1216
+ handleAddClick: x,
1217
+ shouldShowZeroState: S
1218
1218
  }
1219
1219
  ),
1220
1220
  /* @__PURE__ */ e(
1221
1221
  $,
1222
1222
  {
1223
1223
  ariaLabelClose: g.close_aria,
1224
- isOpen: f,
1225
- onClose: () => y(!1),
1226
- title: c.add_new_title,
1224
+ isOpen: _,
1225
+ onClose: () => C(!1),
1226
+ title: r.add_new_title,
1227
1227
  children: /* @__PURE__ */ e(
1228
- ze,
1228
+ Fe,
1229
1229
  {
1230
- onAddBudget: x,
1231
- onRecalculateBudgets: C
1230
+ onAddBudget: v,
1231
+ onRecalculateBudgets: b
1232
1232
  }
1233
1233
  )
1234
1234
  }
@@ -1236,55 +1236,60 @@ const wt = ({
1236
1236
  ]
1237
1237
  }
1238
1238
  );
1239
- }, Ho = w(Ft), ae = {
1239
+ }, Vo = I(Ut), ne = {
1240
1240
  CANCEL_DELETE: "Cancel - Delete",
1241
1241
  END_SAVE: "End - Save",
1242
1242
  END_DELETE: "End - Delete",
1243
1243
  START_DELETE: "Start - Delete"
1244
- }, Ut = ({ onClose: t, onEvent: n, onViewHistory: i }) => {
1244
+ }, Wt = ({
1245
+ onClose: t,
1246
+ onEvent: n,
1247
+ onViewHistory: c,
1248
+ transactionListProps: i
1249
+ }) => {
1245
1250
  const {
1246
- alert: s,
1247
- dateRange: a,
1248
- deleteBudget: r,
1249
- selectedBudget: o,
1250
- selectedSubBudget: c,
1251
- setAlert: g,
1252
- setSelectedBudget: d,
1253
- updateBudget: u
1254
- } = E(), { budgets: p, common: h } = D(), { isCopyLoaded: _, selectedAccountGuids: f } = q(), y = $e(), { setFilter: A } = J(), [x, C] = l.useState(""), [b, S] = l.useState(null), [I, L] = l.useState(!1), M = l.useRef(!1);
1251
+ alert: a,
1252
+ dateRange: s,
1253
+ deleteBudget: o,
1254
+ selectedBudget: r,
1255
+ selectedSubBudget: g,
1256
+ setAlert: d,
1257
+ setSelectedBudget: u,
1258
+ updateBudget: y
1259
+ } = w(), { budgets: p, common: h } = E(), { isCopyLoaded: _, selectedAccountGuids: C } = Z(), x = Ge(), { setFilter: v } = q(), [b, S] = l.useState(""), [f, T] = l.useState(null), [N, R] = l.useState(!1), O = l.useRef(!1);
1255
1260
  if (l.useEffect(() => {
1256
- !o || c || (C(`${o.amount}`), A({
1257
- accounts: f,
1258
- dateRange: a,
1259
- custom: ({ category_guid: P, top_level_category_guid: H }) => {
1260
- const { category_guid: V } = o;
1261
- return P === V || H === V;
1261
+ !r || g || (S(`${r.amount}`), v({
1262
+ accounts: C,
1263
+ dateRange: s,
1264
+ custom: ({ category_guid: P, top_level_category_guid: F }) => {
1265
+ const { category_guid: De } = r;
1266
+ return P === De || F === De;
1262
1267
  },
1263
1268
  showSplits: !0
1264
- }), L(!0));
1265
- }, [o]), !_) return /* @__PURE__ */ e(ge, {});
1266
- if (!o) return null;
1267
- const O = () => {
1268
- C(""), S(null), L(!1), setTimeout(() => {
1269
- d(void 0), t?.();
1269
+ }), R(!0));
1270
+ }, [r]), !_) return /* @__PURE__ */ e(me, {});
1271
+ if (!r) return null;
1272
+ const z = () => {
1273
+ S(""), T(null), R(!1), setTimeout(() => {
1274
+ u(void 0), t?.();
1270
1275
  }, 250);
1271
- }, z = () => {
1272
- b === "delete" && n?.(ae.CANCEL_DELETE, x), C(o.amount ? `${o.amount}` : ""), S(null);
1273
- }, k = async () => {
1274
- if (b === "edit") {
1275
- if (M.current) return;
1276
- M.current = !0, await u({
1277
- ...o,
1278
- amount: Number(x)
1279
- }), n?.(ae.END_SAVE, x), g(
1280
- N(p.alert_budget_updated, o.category.name)
1281
- ), S(null), M.current = !1;
1276
+ }, k = () => {
1277
+ f === "delete" && n?.(ne.CANCEL_DELETE, b), S(r.amount ? `${r.amount}` : ""), T(null);
1278
+ }, pe = async () => {
1279
+ if (f === "edit") {
1280
+ if (O.current) return;
1281
+ O.current = !0, await y({
1282
+ ...r,
1283
+ amount: Number(b)
1284
+ }), n?.(ne.END_SAVE, b), d(
1285
+ L(p.alert_budget_updated, r.category.name)
1286
+ ), T(null), O.current = !1;
1282
1287
  }
1283
- b === "delete" && (await r(o.guid), n?.(ae.END_DELETE, x), O());
1284
- }, { remainingAmount: he, spentPercentage: be, iconColor: oe } = dt(
1285
- o.transaction_total ?? 0,
1286
- o.amount ?? 0
1287
- ), fe = (P, H) => N(P, /* @__PURE__ */ e("b", { children: H }));
1288
+ f === "delete" && (await o(r.guid), n?.(ne.END_DELETE, b), z());
1289
+ }, { remainingAmount: he, spentPercentage: te, iconColor: be } = ut(
1290
+ r.transaction_total ?? 0,
1291
+ r.amount ?? 0
1292
+ ), fe = (P, F) => L(P, /* @__PURE__ */ e("b", { children: F }));
1288
1293
  return /* @__PURE__ */ m(l.Fragment, { children: [
1289
1294
  /* @__PURE__ */ m(
1290
1295
  $,
@@ -1294,14 +1299,14 @@ const wt = ({
1294
1299
  px: 24,
1295
1300
  py: 16
1296
1301
  },
1297
- isOpen: I,
1298
- onClose: O,
1299
- onPrimaryAction: () => S(
1302
+ isOpen: N,
1303
+ onClose: z,
1304
+ onPrimaryAction: () => T(
1300
1305
  "edit"
1301
1306
  /* EDIT */
1302
1307
  ),
1303
1308
  onSecondaryAction: () => {
1304
- n?.(ae.START_DELETE, x), S(
1309
+ n?.(ne.START_DELETE, b), T(
1305
1310
  "delete"
1306
1311
  /* DELETE */
1307
1312
  );
@@ -1314,72 +1319,72 @@ const wt = ({
1314
1319
  pr: 24
1315
1320
  }
1316
1321
  },
1317
- title: N(p.details_type_title, o.category.name),
1322
+ title: L(p.details_type_title, r.category.name),
1318
1323
  children: [
1319
1324
  /* @__PURE__ */ e(
1320
- ot,
1325
+ nt,
1321
1326
  {
1322
- amount: o.amount,
1327
+ amount: r.amount,
1323
1328
  icon: /* @__PURE__ */ e(
1324
- W,
1329
+ H,
1325
1330
  {
1326
- categoryGuid: o.category.guid,
1331
+ categoryGuid: r.category.guid,
1327
1332
  size: 44,
1328
1333
  sx: {
1329
- bgcolor: Je(Ee(o.category.guid, y), 0.15),
1330
- border: `1px solid ${Ee(o.category.guid, y)}`,
1334
+ bgcolor: Qe(we(r.category.guid, x), 0.15),
1335
+ border: `1px solid ${we(r.category.guid, x)}`,
1331
1336
  color: "text.primary"
1332
1337
  }
1333
1338
  }
1334
1339
  ),
1335
- iconColor: oe,
1336
- onViewHistory: i,
1340
+ iconColor: be,
1341
+ onViewHistory: c,
1337
1342
  remainingAmount: he,
1338
- spentPercentage: be,
1339
- startDate: o.start_date,
1340
- totalTransaction: o.transaction_total
1343
+ spentPercentage: te,
1344
+ startDate: r.start_date,
1345
+ totalTransaction: r.transaction_total
1341
1346
  }
1342
1347
  ),
1343
- /* @__PURE__ */ e(Ae, {}),
1344
- s && /* @__PURE__ */ e(
1348
+ /* @__PURE__ */ e(Ae, { ...i }),
1349
+ a && /* @__PURE__ */ e(
1345
1350
  xe,
1346
1351
  {
1347
1352
  anchorOrigin: { horizontal: "right", vertical: "bottom" },
1348
1353
  autoHideDuration: 3500,
1349
- onClose: () => g(""),
1350
- open: !!s,
1351
- children: /* @__PURE__ */ e(Se, { closeText: "", onClose: () => g(""), severity: "success", variant: "filled", children: s })
1354
+ onClose: () => d(""),
1355
+ open: !!a,
1356
+ children: /* @__PURE__ */ e(Se, { closeText: "", onClose: () => d(""), severity: "success", variant: "filled", children: a })
1352
1357
  }
1353
1358
  )
1354
1359
  ]
1355
1360
  }
1356
1361
  ),
1357
- b && /* @__PURE__ */ e(
1358
- ut,
1362
+ f && /* @__PURE__ */ e(
1363
+ mt,
1359
1364
  {
1360
1365
  closeAriaLabel: h.close_aria,
1361
1366
  content: fe(
1362
- p[b === "edit" ? "edit_budget_content" : "delete_description"],
1363
- o.category.name
1367
+ p[f === "edit" ? "edit_budget_content" : "delete_description"],
1368
+ r.category.name
1364
1369
  ),
1365
- handleInputChange: (P) => C(P.toString()),
1366
- handleModalClose: z,
1367
- handlePrimaryAction: k,
1368
- handleSecondaryAction: z,
1369
- inputLabel: b === "edit" ? p.details_edit_title : "",
1370
- inputValue: x,
1370
+ handleInputChange: (P) => S(P.toString()),
1371
+ handleModalClose: k,
1372
+ handlePrimaryAction: pe,
1373
+ handleSecondaryAction: k,
1374
+ inputLabel: f === "edit" ? p.details_edit_title : "",
1375
+ inputValue: b,
1371
1376
  isOpen: !0,
1372
- primaryColor: b === "edit" ? "primary" : "error",
1373
- primaryText: p[b === "edit" ? "add_save_button" : "details_delete_button"],
1374
- secondaryColor: b === "edit" ? "primary" : "inherit",
1377
+ primaryColor: f === "edit" ? "primary" : "error",
1378
+ primaryText: p[f === "edit" ? "add_save_button" : "details_delete_button"],
1379
+ secondaryColor: f === "edit" ? "primary" : "inherit",
1375
1380
  secondaryText: h.cancel_button,
1376
- title: p[b === "edit" ? "details_edit_title" : "delete_title"]
1381
+ title: p[f === "edit" ? "details_edit_title" : "delete_title"]
1377
1382
  }
1378
1383
  )
1379
1384
  ] });
1380
- }, Vo = w(Ut);
1385
+ }, Ko = I(Wt);
1381
1386
  export {
1382
- Ho as BubbleBudgetsMiniWidget,
1383
- Wo as BubbleBudgetsWidget,
1384
- Vo as BudgetDetailsDrawerV2
1387
+ Vo as BubbleBudgetsMiniWidget,
1388
+ Ho as BubbleBudgetsWidget,
1389
+ Ko as BudgetDetailsDrawerV2
1385
1390
  };