@mx-cartographer/experiences 7.0.50-alpha.bb1 → 7.0.50-alpha.mega1

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,129 +1,153 @@
1
- import { jsx as e, jsxs as d, Fragment as $e } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as u, Fragment as Ge } from "react/jsx-runtime";
2
2
  import l from "react";
3
- import { observer as I } from "mobx-react-lite";
3
+ import { observer as D } from "mobx-react-lite";
4
4
  import { endOfMonth as de } from "date-fns/endOfMonth";
5
- import { startOfMonth as J } from "date-fns/startOfMonth";
6
- import W from "@mui/material/Box";
7
- import b from "@mui/material/Stack";
5
+ import { startOfMonth as q } from "date-fns/startOfMonth";
6
+ import F from "@mui/material/Box";
7
+ import B from "@mui/material/Stack";
8
8
  import Q from "@mui/material/styles/useTheme";
9
- import { Icon as $, Text as p, CategoryIcon as H, H1 as Ge, H3 as Be } from "@mxenabled/mxui";
10
- import { u as Pe } from "../BudgetUtil-2EncZLBQ.mjs";
11
- import { C as Ne } from "../ConnectionsDrawer-BprLSCBH.mjs";
12
- import * as E from "d3";
13
- import je from "@mui/material/Tooltip";
14
- import { i as w, m as j, u as D, g as X, b as ee, p as ze, j as te, h as ne, a as Ue, d as Se } from "../hooks-CE2TKk4a.mjs";
15
- import { L as P } from "../Loader-DUaFpDGv.mjs";
9
+ import { Icon as P, Text as f, CategoryIcon as W, H1 as je, H3 as Se } from "@mxenabled/mxui";
10
+ import { u as Ue } from "../BudgetUtil-2EncZLBQ.mjs";
11
+ import { C as ze } from "../ConnectionsDrawer-BprLSCBH.mjs";
12
+ import * as O from "d3";
13
+ import Fe from "@mui/material/Tooltip";
14
+ import { a as me, i as w, m as U, u as I, g as H, b as ee, p as We, j as te, h as ne, d as Ae } from "../hooks-CE2TKk4a.mjs";
15
+ import { L as G } from "../Loader-DUaFpDGv.mjs";
16
16
  import { E as ce } from "../EmptyState-C0lr9E5T.mjs";
17
- import { u as me } from "../useScreenSize-B6JyS_Lj.mjs";
18
- import { A as k, W as Fe } from "../WidgetContainer-hsbxZmZB.mjs";
19
- import K from "@mui/material/List";
17
+ import { u as ge } from "../useScreenSize-B6JyS_Lj.mjs";
18
+ import { A as L, W as He } from "../WidgetContainer-hsbxZmZB.mjs";
19
+ import X from "@mui/material/List";
20
20
  import { f as T } from "../NumberFormatting-CtWHhyBX.mjs";
21
- import Ae from "@mui/material/Button";
21
+ import xe from "@mui/material/Button";
22
22
  import oe from "@mui/material/Divider";
23
- import V from "@mui/material/ListItem";
23
+ import K from "@mui/material/ListItem";
24
24
  import ae from "@mui/material/ListItemAvatar";
25
- import Y from "@mui/material/ListItemButton";
26
- import Z from "@mui/material/ListItemText";
27
- import { b as L } from "../Localization-2MODESHW.mjs";
28
- import { D as M } from "../Drawer-kEE73B87.mjs";
29
- import We from "@mui/material/ListItemSecondaryAction";
30
- import { C as He } from "../CurrencyInput-CRtdzs3o.mjs";
31
- import { a as N } from "../Dialog-CWW597AF.mjs";
32
- import { M as Xe } from "../MiniWidgetContainer-CldJb_TI.mjs";
33
- import { isAfter as Ke } from "date-fns/isAfter";
34
- import { startOfToday as q } from "date-fns/startOfToday";
35
- import Ve from "@mui/material/Alert";
36
- import Ye from "@mui/material/Snackbar";
37
- import be from "@mui/material/Tab";
38
- import Ze from "@mui/material/Tabs";
39
- import { e as qe } from "../exportTransactionsToCSV-D8TTNrrE.mjs";
40
- import { T as xe, a as Je } from "../TransactionDetails-Cl8xcpbh.mjs";
41
- import ge from "@mui/material/Card";
42
- import pe from "@mui/material/CardContent";
25
+ import V from "@mui/material/ListItemButton";
26
+ import Y from "@mui/material/ListItemText";
27
+ import { b as R } from "../Localization-2MODESHW.mjs";
28
+ import { D as N } from "../Drawer-kEE73B87.mjs";
29
+ import Xe from "@mui/material/ListItemSecondaryAction";
30
+ import { C as Ke } from "../CurrencyInput-CRtdzs3o.mjs";
31
+ import { a as j } from "../Dialog-CWW597AF.mjs";
32
+ import { M as Ve } from "../MiniWidgetContainer-CldJb_TI.mjs";
33
+ import { isAfter as Ye } from "date-fns/isAfter";
34
+ import { startOfToday as Z } from "date-fns/startOfToday";
35
+ import Ze from "@mui/material/Alert";
36
+ import qe from "@mui/material/Snackbar";
37
+ import ye from "@mui/material/Tab";
38
+ import Je from "@mui/material/Tabs";
39
+ import { e as Qe } from "../exportTransactionsToCSV-D8TTNrrE.mjs";
40
+ import { T as ve, a as et } from "../TransactionDetails-Cl8xcpbh.mjs";
41
+ import pe from "@mui/material/Card";
42
+ import he from "@mui/material/CardContent";
43
43
  import { S as ue } from "../StatusBar-BK_uYHAB.mjs";
44
- import { S as ve } from "../SingleSegmentDonut-BgbLgwHi.mjs";
45
- import { u as Qe, b as et } from "../CategorySelectorDrawer-BmenK5bu.mjs";
46
- import Te from "@mui/material/CardHeader";
47
- import { subDays as tt } from "date-fns/subDays";
48
- import nt from "@mui/material/IconButton";
49
- import { M as ot } from "../ManageIncome-clecqBHm.mjs";
50
- const ye = 5, at = 100, rt = 25, st = (t) => {
51
- const o = (a) => {
52
- a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
53
- }, i = (a) => {
54
- a.subject.fx = a.x, a.subject.fy = a.y;
55
- }, s = (a) => {
56
- a.active || t.alphaTarget(0), a.subject.fx = null, a.subject.fy = null;
44
+ import { S as Te } from "../SingleSegmentDonut-BgbLgwHi.mjs";
45
+ import { u as tt, b as nt } from "../CategorySelectorDrawer-BmenK5bu.mjs";
46
+ import we from "@mui/material/CardHeader";
47
+ import { subDays as ot } from "date-fns/subDays";
48
+ import at from "@mui/material/IconButton";
49
+ import { M as rt } from "../ManageIncome-clecqBHm.mjs";
50
+ const be = 5, Ie = 100, J = 25, st = (t) => {
51
+ const o = (s) => {
52
+ s.active || t.alphaTarget(0.3).restart(), s.subject.fx = s.subject.x, s.subject.fy = s.subject.y;
53
+ }, i = (s) => {
54
+ s.subject.fx = s.x, s.subject.fy = s.y;
55
+ }, r = (s) => {
56
+ s.active || t.alphaTarget(0), s.subject.fx = null, s.subject.fy = null;
57
57
  };
58
- return E.drag().on("start", o).on("drag", i).on("end", s);
58
+ return O.drag().on("start", o).on("drag", i).on("end", r);
59
59
  }, it = (t) => {
60
60
  let o = t.transaction_total / t.amount;
61
61
  o < 0 ? o = 0 : o > 1 && (o = 1);
62
- const i = o * 2 * Math.PI, s = E.interpolate(0, i), a = E.arc().cornerRadius(5).innerRadius(t.radius - ye * 2).outerRadius(t.radius - ye).startAngle(0).endAngle(0);
63
- return (n) => (a.endAngle(s(n)), a(t) || "");
62
+ const i = o * 2 * Math.PI, r = O.interpolate(0, i), s = O.arc().cornerRadius(5).innerRadius(t.radius - be * 2).outerRadius(t.radius - be).startAngle(0).endAngle(0);
63
+ return (n) => (s.endAngle(r(n)), s(t) || "");
64
64
  }, ct = (t) => {
65
- E.selectAll(".bubble").call(st(t));
65
+ O.selectAll(".bubble").call(st(t));
66
66
  }, lt = (t, o, i) => {
67
67
  t.alpha(1).restart().force(
68
68
  "x",
69
- E.forceX().x(i / 2).strength(0.01)
69
+ O.forceX().x(i / 2).strength(0.01)
70
70
  ).force(
71
71
  "y",
72
- E.forceY().y(o / 2).strength(0.01)
73
- );
74
- }, dt = (t, o) => E.scaleLinear().domain([t, o]).range([rt, at]), ut = (t) => {
75
- const o = t.reduce((n, r) => {
76
- const c = Math.max(r.transaction_total, r.amount);
72
+ O.forceY().y(o / 2).strength(0.01)
73
+ ).on("tick", () => {
74
+ O.selectAll(".bubble").data(t.nodes()).attr("transform", (r) => `translate(${r.x},${r.y})`);
75
+ });
76
+ }, De = (t, o) => O.scaleLinear().domain([t, o]).range([J, Ie]), dt = (t) => {
77
+ const o = t.reduce((n, a) => {
78
+ const c = Math.max(a.transaction_total, a.amount);
77
79
  return c > n ? c : n;
78
- }, 0), i = t.reduce((n, r) => {
79
- const c = Math.max(r.transaction_total, r.amount);
80
+ }, 0), i = t.reduce((n, a) => {
81
+ const c = Math.max(a.transaction_total, a.amount);
80
82
  return c < n ? c : n;
81
- }, o), s = dt(i, o), a = t.map((n) => {
82
- const r = s(Math.max(n.transaction_total, n.amount)) || 25;
83
+ }, o), r = De(i, o), s = t.map((n) => {
84
+ const a = r(Math.max(n.transaction_total, n.amount)) || 25;
83
85
  return {
84
86
  ...n,
85
- radius: r
87
+ radius: a
86
88
  };
87
89
  });
88
- return E.forceSimulation(a).velocityDecay(0.05).force("collide", E.forceCollide((n) => n.radius + 2).strength(0.5)).on("tick", () => {
89
- E.selectAll(".bubble").data(a).attr("transform", (n) => `translate(${n.x},${n.y})`);
90
- });
91
- }, fe = 5, mt = 2e3;
92
- function gt({ bubble: t }) {
90
+ return O.forceSimulation(s).velocityDecay(0.05).force("collide", O.forceCollide((n) => n.radius + 2).strength(0.5));
91
+ }, ut = (t, o, i) => {
92
+ const s = Math.PI * J * J * t, n = i * o;
93
+ let a = J;
94
+ return s < n && (a = Math.min(Ie, Math.sqrt(n / t / Math.PI))), { targetMinRadius: Math.max(20, a * 0.6), targetMaxRadius: a };
95
+ }, mt = (t, o, i, r, s) => {
96
+ const { targetMinRadius: n, targetMaxRadius: a } = ut(t, o, s);
97
+ return O.scaleLinear().domain([r, i]).range([n, a]);
98
+ }, gt = (t, o, i = !1, r, s) => {
99
+ const n = o.map((d) => Math.max(d.transaction_total, d.amount)), a = Math.min(...n), c = Math.max(...n), _ = i ? mt(t.length, r, c, a, s) : De(a, c);
100
+ return t.map((d) => ({
101
+ ...d,
102
+ radius: _(Math.max(d.transaction_total, d.amount))
103
+ }));
104
+ }, Ce = 5, pt = 2e3, ht = ({ bubble: t }) => {
93
105
  const o = Q(), {
94
- guid: i,
106
+ amount: i,
107
+ guid: r,
95
108
  budgetColors: { mercury: s },
96
- radius: a
97
- } = t, n = `mercury-${i}`;
109
+ radius: n,
110
+ transaction_total: a
111
+ } = t, c = `mercury-${r}`;
98
112
  l.useEffect(() => {
99
- E.select(`.${n}`).selectAll(".status").remove(), E.select(`.${n}`).append("path").transition().duration(mt).delay(0).attr("class", "status").attr("style", `fill: ${s}; fill-opacity: 1;`).attrTween("d", () => it(t));
100
- }, [t]);
101
- const r = E.arc().innerRadius((c) => c - 2 * fe).outerRadius((c) => c - fe).startAngle(0).endAngle(2 * Math.PI);
102
- return /* @__PURE__ */ e("g", { className: n, children: /* @__PURE__ */ e(
113
+ O.select(`.${c}`).selectAll(".status").remove(), O.select(`.${c}`).append("path").transition().duration(pt).delay(0).attr("class", "status").attr("style", `fill: ${s}; fill-opacity: 1;`).attrTween("d", () => it(t));
114
+ }, [i, n, a]);
115
+ const _ = O.arc().innerRadius((d) => d - 2 * Ce).outerRadius((d) => d - Ce).startAngle(0).endAngle(2 * Math.PI);
116
+ return /* @__PURE__ */ e("g", { className: c, children: /* @__PURE__ */ e(
103
117
  "path",
104
118
  {
105
- d: r(a) || "",
119
+ d: _(n) || "",
106
120
  style: { fill: o.palette.common.white, fillOpacity: 0.35 }
107
121
  }
108
122
  ) });
109
- }
110
- const G = 75, le = 50;
111
- function pt({ bubble: t, isDraggable: o, onClick: i = () => {
123
+ }, _t = l.memo(ht), $ = 75, le = 50;
124
+ function ft({ bubble: t, isDraggable: o, isMiniWidget: i, onClick: r = () => {
112
125
  } }) {
113
- const [s, a] = l.useState(!1);
126
+ const [s, n] = l.useState(!1), { clientConfig: a } = me(), c = a?.is_mx_mobile && i, _ = l.useMemo(() => {
127
+ if (t)
128
+ return {
129
+ amount: t.amount,
130
+ budgetColors: t.budgetColors,
131
+ guid: t.guid,
132
+ radius: t.radius,
133
+ transaction_total: t.transaction_total
134
+ };
135
+ }, [t.amount, t.budgetColors, t.guid, t.radius, t.transaction_total]);
114
136
  if (!t) return;
115
137
  const {
116
- budgetColors: { background: n, text: r },
117
- category: { icon: c, name: y },
118
- guid: g,
119
- description: h,
120
- radius: m,
121
- x: C,
122
- y: _
123
- } = t;
124
- let u = -12, B = -12;
125
- m > G ? (u = -14, B = -45) : m > le && (B = -32);
126
- const f = `${t.category.name}: ${h}`, A = {
138
+ budgetColors: { background: d, text: m },
139
+ category: { icon: S, name: b },
140
+ guid: p,
141
+ description: g,
142
+ radius: h,
143
+ x: y,
144
+ y: v
145
+ } = t, A = c ? -8 : -12;
146
+ let x = A, C = A;
147
+ h > $ ? (x = -14, C = -45) : h > le && (C = -32);
148
+ let E = 32;
149
+ h <= $ && (E = c ? 16 : 24);
150
+ const M = `${t.category.name}: ${g}`, k = {
127
151
  modifiers: [
128
152
  {
129
153
  name: "offset",
@@ -131,101 +155,132 @@ function pt({ bubble: t, isDraggable: o, onClick: i = () => {
131
155
  }
132
156
  ]
133
157
  };
134
- return /* @__PURE__ */ d(
158
+ return /* @__PURE__ */ u(
135
159
  "g",
136
160
  {
137
161
  className: "bubble",
138
- id: `bubble-${g}`,
139
- onClick: () => i(t),
140
- onMouseEnter: () => a(!0),
141
- onMouseLeave: () => a(!1),
162
+ id: `bubble-${p}`,
163
+ onClick: () => r(t),
164
+ onMouseEnter: () => n(!0),
165
+ onMouseLeave: () => n(!1),
142
166
  style: { cursor: o ? "pointer" : "default" },
143
167
  textAnchor: "middle",
144
- x: C,
145
- y: _,
168
+ x: y,
169
+ y: v,
146
170
  children: [
147
171
  /* @__PURE__ */ e(
148
- je,
172
+ Fe,
149
173
  {
150
174
  followCursor: !0,
151
175
  open: s,
152
- slotProps: { popper: A },
153
- title: f,
154
- children: /* @__PURE__ */ e("circle", { fill: n, id: `circle-${g}`, r: m })
176
+ slotProps: { popper: k },
177
+ title: M,
178
+ children: /* @__PURE__ */ e("circle", { fill: d, id: `circle-${p}`, r: h })
155
179
  }
156
180
  ),
157
- /* @__PURE__ */ e("svg", { x: u, y: B, children: /* @__PURE__ */ e($, { name: c, size: m <= G ? 24 : 32, sx: { fill: r } }) }),
158
- m > G && /* @__PURE__ */ e(
159
- p,
181
+ /* @__PURE__ */ e("svg", { x, y: C, children: /* @__PURE__ */ e(P, { name: S, size: E, sx: { fill: m } }) }),
182
+ h > $ && /* @__PURE__ */ e(
183
+ f,
160
184
  {
161
185
  bold: !0,
162
186
  component: "text",
163
- id: `budget-category-${g}`,
164
- sx: { fill: r },
187
+ id: `budget-category-${p}`,
188
+ sx: { fill: m },
165
189
  variant: "Small",
166
190
  y: 4,
167
- children: y
191
+ children: b
168
192
  }
169
193
  ),
170
- m > le && /* @__PURE__ */ e(
171
- p,
194
+ h > le && /* @__PURE__ */ e(
195
+ f,
172
196
  {
173
197
  bold: !0,
174
198
  component: "text",
175
- id: `budget-description-${g}-1`,
176
- sx: { fill: r },
199
+ id: `budget-description-${p}-1`,
200
+ sx: { fill: m },
177
201
  variant: "Body",
178
- y: m <= G ? 12 : 24,
179
- children: m <= G ? h.split(" ")[0] : h
202
+ y: h <= $ ? 12 : 24,
203
+ children: h <= $ ? g.split(" ")[0] : g
180
204
  }
181
205
  ),
182
- m <= G && m > le && /* @__PURE__ */ e(
183
- p,
206
+ h <= $ && h > le && /* @__PURE__ */ e(
207
+ f,
184
208
  {
185
209
  component: "text",
186
- id: `budget-description-${g}-2`,
187
- sx: { fill: r },
210
+ id: `budget-description-${p}-2`,
211
+ sx: { fill: m },
188
212
  variant: "XSmall",
189
213
  y: 28,
190
- children: h.split(" ")[1]
214
+ children: g.split(" ")[1]
191
215
  }
192
216
  ),
193
- /* @__PURE__ */ e(gt, { bubble: t })
217
+ /* @__PURE__ */ e(_t, { bubble: _ })
194
218
  ]
195
219
  },
196
- g
220
+ p
197
221
  );
198
222
  }
199
- let F;
200
- const ht = ({
223
+ const yt = ({
201
224
  height: t,
202
225
  width: o,
203
226
  isDraggable: i = !1,
227
+ isMiniWidget: r = !1,
204
228
  onClick: s = () => {
205
229
  }
206
230
  }) => {
207
- const { detailedBudgets: a } = w();
208
- return F = l.useMemo(() => ut(a), [a]), l.useEffect(() => {
209
- lt(F, t, o), i && ct(F);
210
- }, [F, t, o]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(o), children: F.nodes().map((n) => /* @__PURE__ */ e(pt, { bubble: n, isDraggable: i, onClick: s }, n.guid)) });
211
- }, _t = I(ht), bt = ({
231
+ const [n, a] = l.useState([]), c = l.useRef(null), { detailedBudgets: _ } = w(), d = l.useCallback(() => {
232
+ const m = c.current, S = dt(_), b = S.nodes();
233
+ if (m) {
234
+ const p = m.nodes(), g = new Map(p.map((h) => [h.guid, h]));
235
+ b.forEach((h) => {
236
+ const y = g.get(h.guid);
237
+ y && Object.assign(h, {
238
+ vx: y.vx,
239
+ vy: y.vy,
240
+ x: y.x,
241
+ y: y.y
242
+ });
243
+ });
244
+ }
245
+ c.current = S, a(b);
246
+ }, [_]);
247
+ return l.useEffect(() => {
248
+ d();
249
+ }, [d]), l.useEffect(() => () => {
250
+ c.current && (c.current.stop(), c.current = null);
251
+ }, []), l.useEffect(() => {
252
+ const m = c.current;
253
+ if (!m) return;
254
+ const S = m.nodes(), b = o > 0 && o < 450, p = gt(S, _, b, t, o);
255
+ m.nodes(p), lt(m, t, o), i && ct(m), a([...p]);
256
+ }, [t, o, i, _]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(o), children: n.map((m) => /* @__PURE__ */ e(
257
+ ft,
258
+ {
259
+ bubble: m,
260
+ isDraggable: i,
261
+ isMiniWidget: r,
262
+ onClick: s
263
+ },
264
+ m.guid
265
+ )) });
266
+ }, bt = D(yt), Ct = ({
212
267
  isMiniWidget: t = !1,
213
268
  onConnectAccountsClick: o,
214
269
  createBudgetOnClick: i
215
270
  }) => {
216
- const { recalculateBudgets: s } = w(), { spendCategories: a } = j(), { budgets: n } = D(), [r, c] = l.useState(!1), [y, g] = l.useState(!1), [h, m] = l.useState(!1), C = l.useMemo(() => [...a.filter((u) => u.totalAverageAmount > 0)], [a]), _ = async () => {
217
- m(!0);
218
- const { data: u, isSuccess: B } = await s(C);
219
- m(!1), B ? (u.length === 0 && c(!0), g(!1)) : g(!0);
271
+ const { recalculateBudgets: r } = w(), { spendCategories: s } = U(), { budgets: n } = I(), [a, c] = l.useState(!1), [_, d] = l.useState(!1), [m, S] = l.useState(!1), b = l.useMemo(() => [...s.filter((g) => g.totalAverageAmount > 0)], [s]), p = async () => {
272
+ S(!0);
273
+ const { data: g, isSuccess: h } = await r(b);
274
+ S(!1), h ? (g.length === 0 && c(!0), d(!1)) : d(!0);
220
275
  };
221
- return h ? /* @__PURE__ */ e(P, {}) : y ? /* @__PURE__ */ e(
276
+ return m ? /* @__PURE__ */ e(G, {}) : _ ? /* @__PURE__ */ e(
222
277
  ce,
223
278
  {
224
279
  header: n.autogenerate_budgets_error_header,
225
280
  icon: "error",
226
281
  iconColor: "#4D4D4D",
227
- onClick: (u) => {
228
- u === "primary" ? _() : i();
282
+ onClick: (g) => {
283
+ g === "primary" ? p() : i();
229
284
  },
230
285
  primaryButton: n.autogenerate_budgets_error_primary_button,
231
286
  secondaryButton: n.zero_state_generate_budgets_secondary_button,
@@ -237,14 +292,14 @@ const ht = ({
237
292
  }
238
293
  }
239
294
  }
240
- ) : /* @__PURE__ */ e($e, { children: r ? /* @__PURE__ */ e(
295
+ ) : /* @__PURE__ */ e(Ge, { children: a ? /* @__PURE__ */ e(
241
296
  ce,
242
297
  {
243
298
  header: n.zero_state_generate_budgets_header,
244
299
  icon: "error",
245
300
  iconColor: "#4D4D4D",
246
- onClick: (u) => {
247
- u === "primary" ? o() : i();
301
+ onClick: (g) => {
302
+ g === "primary" ? o() : i();
248
303
  },
249
304
  primaryButton: n.zero_state_generate_budgets_primary_button,
250
305
  secondaryButton: n.zero_state_generate_budgets_secondary_button,
@@ -266,8 +321,8 @@ const ht = ({
266
321
  header: n.create_budgets_title,
267
322
  icon: "bubble_chart",
268
323
  iconColor: "#1A1A1A",
269
- onClick: (u) => {
270
- u === "primary" ? _() : i();
324
+ onClick: (g) => {
325
+ g === "primary" ? p() : i();
271
326
  },
272
327
  primaryButton: n.empty_state_primary_button,
273
328
  secondaryButton: t ? void 0 : n.empty_state_secondary_button,
@@ -284,104 +339,105 @@ const ht = ({
284
339
  }
285
340
  }
286
341
  ) });
287
- }, we = I(
342
+ }, Ee = D(
288
343
  ({
289
344
  createBudgetOnClick: t = () => {
290
345
  },
291
346
  height: o,
292
347
  isDraggable: i = !1,
293
- isMiniWidget: s = !1,
294
- shouldShowZeroState: a,
348
+ isMiniWidget: r = !1,
349
+ shouldShowZeroState: s,
295
350
  unavailableWidth: n = 24
296
351
  }) => {
297
- const { onEvent: r } = X(), { setSelectedBudget: c } = w(), { isLoadingCategoryTotals: y } = j(), { isInitialized: g } = ee(), { accounts: h } = D(), { availableWidth: m } = ze(), { isMobile: C } = me(), [_, u] = l.useState(!1), B = l.useMemo(() => m - n, [m]), f = (x) => {
298
- c(x), r(k.BUDGETS_CLICK_BUDGET_CATEGORY, {
299
- budget_category: x.category.name,
352
+ const { onEvent: a } = H(), { setSelectedBudget: c } = w(), { isLoadingCategoryTotals: _ } = U(), { isInitialized: d } = ee(), { accounts: m } = I(), { availableWidth: S } = We(), { isMobile: b } = ge(), [p, g] = l.useState(!1), h = l.useMemo(() => S - n, [S]), y = (A) => {
353
+ c(A), a(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
354
+ budget_category: A.category.name,
300
355
  click_type: "bubble"
301
356
  });
302
- }, A = () => {
303
- u(!0), r(k.ACCOUNTS_CLICK_CONNECT);
357
+ }, v = () => {
358
+ g(!0), a(L.ACCOUNTS_CLICK_CONNECT);
304
359
  };
305
- return y ? /* @__PURE__ */ e(b, { alignItems: "center", height: o, justifyContent: "center", width: Math.abs(B), children: /* @__PURE__ */ e(P, {}) }) : /* @__PURE__ */ d(W, { ml: a || C ? 0 : 24, sx: { alignSelf: "center" }, children: [
306
- a || !g ? /* @__PURE__ */ e(
307
- bt,
360
+ return _ ? /* @__PURE__ */ e(B, { alignItems: "center", height: o, justifyContent: "center", width: Math.abs(h), children: /* @__PURE__ */ e(G, {}) }) : /* @__PURE__ */ u(F, { ml: s || b ? 0 : 24, sx: { alignSelf: "center" }, children: [
361
+ s || !d ? /* @__PURE__ */ e(
362
+ Ct,
308
363
  {
309
364
  createBudgetOnClick: t,
310
- isMiniWidget: s,
311
- onConnectAccountsClick: A
365
+ isMiniWidget: r,
366
+ onConnectAccountsClick: v
312
367
  }
313
368
  ) : /* @__PURE__ */ e(
314
- _t,
369
+ bt,
315
370
  {
316
371
  height: o,
317
372
  isDraggable: i,
318
- onClick: f,
319
- width: B
373
+ isMiniWidget: r,
374
+ onClick: y,
375
+ width: h
320
376
  }
321
377
  ),
322
378
  /* @__PURE__ */ e(
323
- Ne,
379
+ ze,
324
380
  {
325
- onClose: () => u(!1),
326
- showConnectionsWidget: _,
327
- title: h.manage_connections
381
+ onClose: () => g(!1),
382
+ showConnectionsWidget: p,
383
+ title: m.manage_connections
328
384
  }
329
385
  )
330
386
  ] });
331
387
  }
332
- ), yt = I(() => {
333
- const { budgets: t } = D(), { totalBudgeted: o } = w(), { incomeTotal: i } = te(), s = i - o;
334
- return /* @__PURE__ */ d(b, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
335
- /* @__PURE__ */ d(b, { alignItems: "center", children: [
336
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: T(i, "0,0") }),
337
- /* @__PURE__ */ e(p, { color: "secondary", variant: "Small", children: t.projected_income })
388
+ ), Bt = D(() => {
389
+ const { budgets: t } = I(), { totalBudgeted: o } = w(), { incomeTotal: i } = te(), r = i - o;
390
+ return /* @__PURE__ */ u(B, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
391
+ /* @__PURE__ */ u(B, { alignItems: "center", children: [
392
+ /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: T(i, "0,0") }),
393
+ /* @__PURE__ */ e(f, { color: "secondary", variant: "Small", children: t.projected_income })
338
394
  ] }),
339
- /* @__PURE__ */ e(p, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
340
- /* @__PURE__ */ d(b, { alignItems: "center", children: [
341
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: T(o, "0,0") }),
342
- /* @__PURE__ */ e(p, { color: "secondary", variant: "Small", children: t.budgeted })
395
+ /* @__PURE__ */ e(f, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
396
+ /* @__PURE__ */ u(B, { alignItems: "center", children: [
397
+ /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: T(o, "0,0") }),
398
+ /* @__PURE__ */ e(f, { color: "secondary", variant: "Small", children: t.budgeted })
343
399
  ] }),
344
- /* @__PURE__ */ e(p, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
345
- /* @__PURE__ */ d(b, { alignItems: "center", children: [
346
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: T(s, "0,0") }),
347
- /* @__PURE__ */ e(p, { color: "secondary", variant: "Small", children: t.remaining })
400
+ /* @__PURE__ */ e(f, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
401
+ /* @__PURE__ */ u(B, { alignItems: "center", children: [
402
+ /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: T(r, "0,0") }),
403
+ /* @__PURE__ */ e(f, { color: "secondary", variant: "Small", children: t.remaining })
348
404
  ] })
349
405
  ] });
350
- }), ft = I(
406
+ }), St = D(
351
407
  ({ category: t }) => {
352
- const { budgets: o } = D(), { budgets: i } = w(), s = l.useMemo(() => {
353
- const a = i.find((c) => c.category_guid === t.guid), n = T(t.totalAverageAmount, "0,0"), r = a ? L(o.recalculate_previous_budget, T(a.amount, "0,0")) : o.recalculate_new_budget;
354
- return `${n} - ${r}`;
408
+ const { budgets: o } = I(), { budgets: i } = w(), r = l.useMemo(() => {
409
+ const s = i.find((c) => c.category_guid === t.guid), n = T(t.totalAverageAmount, "0,0"), a = s ? R(o.recalculate_previous_budget, T(s.amount, "0,0")) : o.recalculate_new_budget;
410
+ return `${n} - ${a}`;
355
411
  }, [o, i]);
356
- return /* @__PURE__ */ d(l.Fragment, { children: [
357
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { children: [
358
- /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid, variant: "filled" }) }),
359
- /* @__PURE__ */ e(Z, { primary: t.name, secondary: s })
412
+ return /* @__PURE__ */ u(l.Fragment, { children: [
413
+ /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { children: [
414
+ /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(W, { categoryGuid: t.guid, variant: "filled" }) }),
415
+ /* @__PURE__ */ e(Y, { primary: t.name, secondary: r })
360
416
  ] }) }),
361
417
  /* @__PURE__ */ e(oe, {})
362
418
  ] }, t.guid);
363
419
  }
364
- ), Ct = ({ onRecalculateBudgets: t }) => {
365
- const { budgets: o, common: i } = D(), { spendCategories: s } = j(), { recalculateBudgets: a, setAlert: n } = w(), [r, c] = l.useState(!1), y = s.filter((h) => h.totalAverageAmount > 0), g = async () => {
366
- await a(y), c(!1), n(o.alert_recalculated_budgets), t?.();
420
+ ), At = ({ onRecalculateBudgets: t }) => {
421
+ const { budgets: o, common: i } = I(), { spendCategories: r } = U(), { recalculateBudgets: s, setAlert: n } = w(), [a, c] = l.useState(!1), _ = r.filter((m) => m.totalAverageAmount > 0), d = async () => {
422
+ await s(_), c(!1), n(o.alert_recalculated_budgets), t?.();
367
423
  };
368
- return /* @__PURE__ */ d(l.Fragment, { children: [
369
- /* @__PURE__ */ e(Ae, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: o.recalculate_button }),
370
- /* @__PURE__ */ e(p, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "Paragraph", children: o.recalculate_help }),
424
+ return /* @__PURE__ */ u(l.Fragment, { children: [
425
+ /* @__PURE__ */ e(xe, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: o.recalculate_button }),
426
+ /* @__PURE__ */ e(f, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "Paragraph", children: o.recalculate_help }),
371
427
  /* @__PURE__ */ e(
372
- M,
428
+ N,
373
429
  {
374
430
  ariaLabelClose: i.close_aria,
375
- isOpen: r,
431
+ isOpen: a,
376
432
  onClose: () => c(!1),
377
- onPrimaryAction: g,
433
+ onPrimaryAction: d,
378
434
  title: o.recalculate_title,
379
- children: /* @__PURE__ */ d(b, { children: [
380
- /* @__PURE__ */ d(b, { mx: 24, my: 16, children: [
381
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: o.recalculate_description_top }),
382
- /* @__PURE__ */ e(p, { variant: "ParagraphSmall", children: o.recalculate_description_bottom })
435
+ children: /* @__PURE__ */ u(B, { children: [
436
+ /* @__PURE__ */ u(B, { mx: 24, my: 16, children: [
437
+ /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: o.recalculate_description_top }),
438
+ /* @__PURE__ */ e(f, { variant: "ParagraphSmall", children: o.recalculate_description_bottom })
383
439
  ] }),
384
- /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: y.map((h) => /* @__PURE__ */ e(ft, { category: h }, h.guid)) }) })
440
+ /* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: _.map((m) => /* @__PURE__ */ e(St, { category: m }, m.guid)) }) })
385
441
  ] })
386
442
  }
387
443
  )
@@ -391,673 +447,682 @@ const ht = ({
391
447
  categoryName: o,
392
448
  onAmountChanged: i
393
449
  }) => {
394
- const { budgets: s } = D(), { totalBudgeted: a } = w(), { incomeTotal: n } = te(), r = n - a;
395
- return /* @__PURE__ */ d(b, { gap: 16, children: [
396
- /* @__PURE__ */ d(b, { children: [
397
- /* @__PURE__ */ e(p, { children: L(
398
- s.add_description_top,
399
- T(r, "0,0")
450
+ const { budgets: r } = I(), { totalBudgeted: s } = w(), { incomeTotal: n } = te(), a = n - s;
451
+ return /* @__PURE__ */ u(B, { gap: 16, children: [
452
+ /* @__PURE__ */ u(B, { children: [
453
+ /* @__PURE__ */ e(f, { children: R(
454
+ r.add_description_top,
455
+ T(a, "0,0")
400
456
  ) }),
401
- /* @__PURE__ */ e(p, { children: L(s.add_description_bottom, o) })
457
+ /* @__PURE__ */ e(f, { children: R(r.add_description_bottom, o) })
402
458
  ] }),
403
459
  /* @__PURE__ */ e(
404
- He,
460
+ Ke,
405
461
  {
406
462
  amount: t,
407
463
  autoFocus: !0,
408
- label: s.add_label,
464
+ label: r.add_label,
409
465
  minAmount: 0,
410
466
  setAmount: i,
411
467
  sx: { ".MuiTypography-Body": { p: 0 } }
412
468
  }
413
469
  )
414
470
  ] });
415
- }, Bt = I(({ category: t, onAddBudget: o }) => {
416
- const { budgets: i, common: s } = D(), [a, n] = l.useState(!1), [r, c] = l.useState(
471
+ }, xt = D(({ category: t, onAddBudget: o }) => {
472
+ const { budgets: i, common: r } = I(), [s, n] = l.useState(!1), [a, c] = l.useState(
417
473
  `${t.totalAmount === 0 ? "" : t.totalAmount}`
418
474
  );
419
- return /* @__PURE__ */ d(l.Fragment, { children: [
420
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { onClick: () => n(!0), children: [
421
- /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid }) }),
475
+ return /* @__PURE__ */ u(l.Fragment, { children: [
476
+ /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => n(!0), children: [
477
+ /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(W, { categoryGuid: t.guid }) }),
422
478
  /* @__PURE__ */ e(
423
- Z,
479
+ Y,
424
480
  {
425
481
  primary: t.name,
426
482
  secondary: T(t.totalAmount, "0,0")
427
483
  }
428
484
  ),
429
- /* @__PURE__ */ e(We, { children: /* @__PURE__ */ e($, { name: "add", size: 20 }) })
485
+ /* @__PURE__ */ e(Xe, { children: /* @__PURE__ */ e(P, { name: "add", size: 20 }) })
430
486
  ] }) }, t.guid),
431
487
  /* @__PURE__ */ e(
432
- N,
488
+ j,
433
489
  {
434
- copy: { close_aria: s.close_aria, title: i.add_title },
435
- disablePrimaryButton: Number(r) <= 0,
436
- isOpen: a,
490
+ copy: { close_aria: r.close_aria, title: i.add_title },
491
+ disablePrimaryButton: Number(a) <= 0,
492
+ isOpen: s,
437
493
  onClose: () => n(!1),
438
- onPrimaryAction: () => o(t, Number(r)),
494
+ onPrimaryAction: () => o(t, Number(a)),
439
495
  primaryText: i.add_save_button,
440
- children: /* @__PURE__ */ e(re, { amount: r, categoryName: t.name, onAmountChanged: c })
496
+ children: /* @__PURE__ */ e(re, { amount: a, categoryName: t.name, onAmountChanged: c })
441
497
  }
442
498
  )
443
499
  ] });
444
- }), De = I(({ onRecalculateBudgets: t }) => {
445
- const { budgets: o } = D(), { addBudget: i, setAlert: s, unbudgetedCategories: a } = w(), n = async (r, c) => {
446
- await i(r, c), s(L(o.alert_budget_created, r.name));
500
+ }), Oe = D(({ onRecalculateBudgets: t }) => {
501
+ const { budgets: o } = I(), { addBudget: i, setAlert: r, unbudgetedCategories: s } = w(), n = async (a, c) => {
502
+ await i(a, c), r(R(o.alert_budget_created, a.name));
447
503
  };
448
- return /* @__PURE__ */ d(b, { children: [
449
- /* @__PURE__ */ e(yt, {}),
450
- /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: a.map((r) => /* @__PURE__ */ e(
451
- Bt,
504
+ return /* @__PURE__ */ u(B, { children: [
505
+ /* @__PURE__ */ e(Bt, {}),
506
+ /* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: s.map((a) => /* @__PURE__ */ e(
507
+ xt,
452
508
  {
453
- category: r,
509
+ category: a,
454
510
  onAddBudget: n
455
511
  },
456
- r.guid
512
+ a.guid
457
513
  )) }) }),
458
- /* @__PURE__ */ e(Ct, { onRecalculateBudgets: t })
514
+ /* @__PURE__ */ e(At, { onRecalculateBudgets: t })
459
515
  ] });
460
- }), St = (t) => {
461
- const o = Q(), { onEvent: i } = X(), { detailedBudgets: s, isDataLoaded: a, loadBudgetData: n, setTheme: r } = w(), { budgets: c, common: y } = D(), { isCopyLoaded: g, isInitialized: h, selectedAccounts: m } = ee(), { reloadCategoryTotals: C } = j(), _ = Pe(), u = s.length === 0, [B, f] = l.useState(!1), A = () => {
462
- f(!0), i(k.BUDGETS_CLICK_ADD);
463
- }, x = () => {
464
- f(!1);
516
+ }), vt = (t) => {
517
+ const o = Q(), { clientConfig: i } = me(), r = i?.is_mx_mobile, { onEvent: s } = H(), { detailedBudgets: n, isDataLoaded: a, loadBudgetData: c, setTheme: _ } = w(), { budgets: d, common: m } = I(), { isCopyLoaded: S, isInitialized: b, selectedAccounts: p } = ee(), { reloadCategoryTotals: g } = U(), h = Ue(), y = n.length === 0, [v, A] = l.useState(!1), x = () => {
518
+ A(!0), s(L.BUDGETS_CLICK_ADD);
519
+ }, C = () => {
520
+ A(!1);
465
521
  };
466
522
  return l.useEffect(() => {
467
- r(o);
523
+ _(o);
468
524
  }, [o]), l.useEffect(() => {
469
- h && !a && C(m, J(/* @__PURE__ */ new Date()), de(/* @__PURE__ */ new Date())).then(
525
+ b && !a && g(p, q(/* @__PURE__ */ new Date()), de(/* @__PURE__ */ new Date())).then(
470
526
  () => {
471
- n().finally();
527
+ c().finally();
472
528
  }
473
529
  );
474
- }, [h, m]), g ? /* @__PURE__ */ d(
475
- Xe,
530
+ }, [b, p]), S ? /* @__PURE__ */ u(
531
+ Ve,
476
532
  {
477
- primaryCtaLabel: u ? c.get_started_cta : c.details_cta,
478
- title: c.budgets_title,
533
+ primaryCtaLabel: y ? d.get_started_cta : d.details_cta,
534
+ title: d.budgets_title,
479
535
  ...t,
480
536
  children: [
481
- a ? /* @__PURE__ */ d(b, { height: 450, mt: 32, children: [
482
- /* @__PURE__ */ e(
483
- we,
484
- {
485
- createBudgetOnClick: A,
486
- height: 370,
487
- isMiniWidget: !0,
488
- shouldShowZeroState: u
489
- }
490
- ),
491
- !u && /* @__PURE__ */ d(W, { ml: 16, children: [
492
- /* @__PURE__ */ e(p, { bold: !0, color: _ < 0 ? "error.main" : "success.main", children: T(Math.abs(_), "0,0") }),
493
- /* @__PURE__ */ e(p, { children: _ < 0 ? c.overspent_in_budgets : c.left_in_budgets })
494
- ] })
495
- ] }) : /* @__PURE__ */ e(P, {}),
537
+ a ? /* @__PURE__ */ u(
538
+ B,
539
+ {
540
+ sx: {
541
+ height: r ? "100%" : 450,
542
+ mt: r ? 8 : 32
543
+ },
544
+ children: [
545
+ /* @__PURE__ */ e(
546
+ Ee,
547
+ {
548
+ createBudgetOnClick: x,
549
+ height: r ? 220 : 370,
550
+ isMiniWidget: !0,
551
+ shouldShowZeroState: y
552
+ }
553
+ ),
554
+ !y && /* @__PURE__ */ u(F, { ml: 16, children: [
555
+ /* @__PURE__ */ e(f, { bold: !0, color: h < 0 ? "error.main" : "success.main", children: T(Math.abs(h), "0,0") }),
556
+ /* @__PURE__ */ e(f, { children: h < 0 ? d.overspent_in_budgets : d.left_in_budgets })
557
+ ] })
558
+ ]
559
+ }
560
+ ) : /* @__PURE__ */ e(G, {}),
496
561
  /* @__PURE__ */ e(
497
- M,
562
+ N,
498
563
  {
499
- ariaLabelClose: y.close_aria,
500
- isOpen: B,
501
- onClose: () => f(!1),
502
- title: c.add_new_title,
503
- children: /* @__PURE__ */ e(De, { onRecalculateBudgets: x })
564
+ ariaLabelClose: m.close_aria,
565
+ isOpen: v,
566
+ onClose: () => A(!1),
567
+ title: d.add_new_title,
568
+ children: /* @__PURE__ */ e(Oe, { onRecalculateBudgets: C })
504
569
  }
505
570
  )
506
571
  ]
507
572
  }
508
- ) : /* @__PURE__ */ e(P, {});
509
- }, wn = I(St), Ie = ({ budget: t }) => {
573
+ ) : /* @__PURE__ */ e(G, {});
574
+ }, En = D(vt), Me = ({ budget: t }) => {
510
575
  const {
511
576
  amount: o,
512
577
  budgetColors: { background: i },
513
- category: { name: s },
514
- category_guid: a,
578
+ category: { name: r },
579
+ category_guid: s,
515
580
  percentage: n,
516
- transaction_total: r
581
+ transaction_total: a
517
582
  } = t, c = [
518
583
  {
519
584
  color: i,
520
585
  percentage: `${n}%`
521
586
  }
522
587
  ];
523
- return /* @__PURE__ */ e(ge, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ d(b, { alignItems: "center", gap: 16, children: [
524
- /* @__PURE__ */ e(H, { categoryGuid: a, size: 56 }),
525
- /* @__PURE__ */ e(Ge, { children: `${T(r, "0,0")} / ${T(o, "0,0")}` }),
526
- /* @__PURE__ */ e(p, { bold: !0, variant: "XSmall", children: s }),
588
+ return /* @__PURE__ */ e(pe, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(he, { children: /* @__PURE__ */ u(B, { alignItems: "center", gap: 16, children: [
589
+ /* @__PURE__ */ e(W, { categoryGuid: s, size: 56 }),
590
+ /* @__PURE__ */ e(je, { children: `${T(a, "0,0")} / ${T(o, "0,0")}` }),
591
+ /* @__PURE__ */ e(f, { bold: !0, variant: "XSmall", children: r }),
527
592
  /* @__PURE__ */ e(ue, { data: c, height: 10 })
528
593
  ] }) }) });
529
- }, At = I(() => {
530
- const { budgets: t } = D();
531
- return /* @__PURE__ */ d(b, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
532
- /* @__PURE__ */ e($, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
533
- /* @__PURE__ */ e(p, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
534
- /* @__PURE__ */ e(p, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
594
+ }, Tt = D(() => {
595
+ const { budgets: t } = I();
596
+ return /* @__PURE__ */ u(B, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
597
+ /* @__PURE__ */ e(P, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
598
+ /* @__PURE__ */ e(f, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
599
+ /* @__PURE__ */ e(f, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
535
600
  ] });
536
- }), xt = I(({ budget: t }) => {
601
+ }), wt = D(({ budget: t }) => {
537
602
  const {
538
603
  amount: o,
539
604
  budgetColors: { background: i },
540
- category: s,
541
- percentage: a,
605
+ category: r,
606
+ percentage: s,
542
607
  transaction_total: n
543
- } = t, { setSelectedSubBudget: r } = w();
544
- return /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { onClick: () => r(t), children: [
545
- /* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(ve, { color: i, percent: a, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: s.parent_guid, variant: "basic" }) }) }),
608
+ } = t, { setSelectedSubBudget: a } = w();
609
+ return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => a(t), children: [
610
+ /* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Te, { color: i, percent: s, size: 40, children: /* @__PURE__ */ e(W, { categoryGuid: r.parent_guid, variant: "basic" }) }) }),
546
611
  /* @__PURE__ */ e(
547
- Z,
612
+ Y,
548
613
  {
549
- primary: /* @__PURE__ */ e(b, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: t.category.name }) }),
550
- secondary: /* @__PURE__ */ e(b, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(p, { fontWeight: 400, variant: "Body", children: `
614
+ primary: /* @__PURE__ */ e(B, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: t.category.name }) }),
615
+ secondary: /* @__PURE__ */ e(B, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(f, { fontWeight: 400, variant: "Body", children: `
551
616
  ${T(n, "0,0")} /
552
617
  ${T(o, "0,0")}
553
618
  ` }) })
554
619
  }
555
620
  )
556
621
  ] }) });
557
- }), vt = I(({ category: t, parentBudget: o }) => {
558
- const { budgets: i, common: s } = D(), { setExpandedGuid: a, setOnSelect: n } = Qe(), { addBudget: r } = w(), [c, y] = l.useState(!1), [g, h] = l.useState(!1), [m, C] = l.useState(""), [_, u] = l.useState(void 0);
622
+ }), It = D(({ category: t, parentBudget: o }) => {
623
+ const { budgets: i, common: r } = I(), { setExpandedGuid: s, setOnSelect: n } = tt(), { addBudget: a } = w(), [c, _] = l.useState(!1), [d, m] = l.useState(!1), [S, b] = l.useState(""), [p, g] = l.useState(void 0);
559
624
  l.useEffect(() => {
560
- n((A) => {
561
- const x = t.subCategories.find((v) => v.guid === A);
562
- x && (u(x), C(`${x.currentAmount === 0 ? "" : x.currentAmount}`), h(!0));
625
+ n((v) => {
626
+ const A = t.subCategories.find((x) => x.guid === v);
627
+ A && (g(A), b(`${A.currentAmount === 0 ? "" : A.currentAmount}`), m(!0));
563
628
  });
564
629
  }, []);
565
- const B = () => {
566
- a(t.guid), y(!0);
567
- }, f = async () => {
568
- _ && Number(m) > 0 && (await r(_, Number(m), o.guid), h(!1), y(!1), u(void 0));
630
+ const h = () => {
631
+ s(t.guid), _(!0);
632
+ }, y = async () => {
633
+ p && Number(S) > 0 && (await a(p, Number(S), o.guid), m(!1), _(!1), g(void 0));
569
634
  };
570
- return /* @__PURE__ */ d(W, { children: [
571
- /* @__PURE__ */ e(V, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Y, { onClick: B, children: /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ d(b, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
572
- /* @__PURE__ */ d(b, { alignItems: "center", direction: "row", gap: 8, children: [
573
- /* @__PURE__ */ e($, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
574
- /* @__PURE__ */ e(p, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
635
+ return /* @__PURE__ */ u(F, { children: [
636
+ /* @__PURE__ */ e(K, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(V, { onClick: h, children: /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ u(B, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
637
+ /* @__PURE__ */ u(B, { alignItems: "center", direction: "row", gap: 8, children: [
638
+ /* @__PURE__ */ e(P, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
639
+ /* @__PURE__ */ e(f, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
575
640
  ] }),
576
- /* @__PURE__ */ e($, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
641
+ /* @__PURE__ */ e(P, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
577
642
  ] }) }) }) }),
578
643
  /* @__PURE__ */ e(oe, {}),
579
644
  /* @__PURE__ */ e(
580
- M,
645
+ N,
581
646
  {
582
- ariaLabelClose: s.close_aria,
647
+ ariaLabelClose: r.close_aria,
583
648
  isOpen: c,
584
- onClose: () => y(!1),
649
+ onClose: () => _(!1),
585
650
  title: i.add_sub_budget_title,
586
- children: /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(et, { category: t, subCategories: t.subCategories }) })
651
+ children: /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(nt, { category: t, subCategories: t.subCategories }) })
587
652
  }
588
653
  ),
589
654
  /* @__PURE__ */ e(
590
- N,
655
+ j,
591
656
  {
592
- copy: { close_aria: s.close_aria, title: i.add_title },
593
- disablePrimaryButton: Number(m) <= 0,
594
- isOpen: g,
595
- onClose: () => h(!1),
596
- onPrimaryAction: f,
657
+ copy: { close_aria: r.close_aria, title: i.add_title },
658
+ disablePrimaryButton: Number(S) <= 0,
659
+ isOpen: d,
660
+ onClose: () => m(!1),
661
+ onPrimaryAction: y,
597
662
  primaryText: i.add_save_button,
598
663
  children: /* @__PURE__ */ e(
599
664
  re,
600
665
  {
601
- amount: m,
602
- categoryName: _?.name || "",
603
- onAmountChanged: C
666
+ amount: S,
667
+ categoryName: p?.name || "",
668
+ onAmountChanged: b
604
669
  }
605
670
  )
606
671
  }
607
672
  )
608
673
  ] });
609
- }), Tt = I(({ budget: t }) => {
610
- const { category: o, subBudgets: i } = t, { budgets: s, common: a } = D(), { deleteBudget: n, selectedSubBudget: r, setSelectedSubBudget: c, updateBudget: y } = w(), { filter: g, setFilter: h } = ne(), [m, C] = l.useState(!1), [_, u] = l.useState(!1), [B, f] = l.useState("");
674
+ }), Dt = D(({ budget: t }) => {
675
+ const { category: o, subBudgets: i } = t, { budgets: r, common: s } = I(), { deleteBudget: n, selectedSubBudget: a, setSelectedSubBudget: c, updateBudget: _ } = w(), { filter: d, setFilter: m } = ne(), [S, b] = l.useState(!1), [p, g] = l.useState(!1), [h, y] = l.useState("");
611
676
  l.useEffect(() => {
612
- r && (f(`${r.amount}`), h({
613
- ...g,
614
- custom: (S) => S.category_guid === r.category_guid
677
+ a && (y(`${a.amount}`), m({
678
+ ...d,
679
+ custom: (C) => C.category_guid === a.category_guid
615
680
  }));
616
- }, [r]);
617
- const A = async () => {
618
- r && await y({
619
- ...r,
620
- amount: Number(B)
681
+ }, [a]);
682
+ const v = async () => {
683
+ a && await _({
684
+ ...a,
685
+ amount: Number(h)
621
686
  });
622
- }, x = async () => {
623
- r && await n(r.guid), u(!1), v();
624
- }, v = () => {
625
- h({
626
- ...g,
627
- custom: (S) => S.category_guid === t.category_guid || S.top_level_category_guid === t.category_guid
687
+ }, A = async () => {
688
+ a && await n(a.guid), g(!1), x();
689
+ }, x = () => {
690
+ m({
691
+ ...d,
692
+ custom: (C) => C.category_guid === t.category_guid || C.top_level_category_guid === t.category_guid
628
693
  }), c(void 0);
629
694
  };
630
- return /* @__PURE__ */ d(l.Fragment, { children: [
631
- /* @__PURE__ */ d(K, { sx: { bgcolor: "background.paper" }, children: [
632
- i.length === 0 ? /* @__PURE__ */ e(At, {}) : i.map((S) => /* @__PURE__ */ d(l.Fragment, { children: [
633
- /* @__PURE__ */ e(xt, { budget: S }),
695
+ return /* @__PURE__ */ u(l.Fragment, { children: [
696
+ /* @__PURE__ */ u(X, { sx: { bgcolor: "background.paper" }, children: [
697
+ i.length === 0 ? /* @__PURE__ */ e(Tt, {}) : i.map((C) => /* @__PURE__ */ u(l.Fragment, { children: [
698
+ /* @__PURE__ */ e(wt, { budget: C }),
634
699
  /* @__PURE__ */ e(oe, {})
635
- ] }, S.guid)),
636
- /* @__PURE__ */ e(vt, { category: o, parentBudget: t })
700
+ ] }, C.guid)),
701
+ /* @__PURE__ */ e(It, { category: o, parentBudget: t })
637
702
  ] }),
638
703
  /* @__PURE__ */ e(
639
- M,
704
+ N,
640
705
  {
641
- ariaLabelClose: a.close_aria,
642
- isOpen: !!r,
643
- onClose: v,
644
- onPrimaryAction: () => C(!0),
645
- onSecondaryAction: () => u(!0),
646
- primaryText: s.details_edit_button,
647
- secondaryText: s.details_delete_button,
648
- title: s.details_title,
649
- children: r && /* @__PURE__ */ d(b, { gap: 24, children: [
650
- /* @__PURE__ */ e(Ie, { budget: r }),
651
- /* @__PURE__ */ e(xe, { height: "100%" })
706
+ ariaLabelClose: s.close_aria,
707
+ isOpen: !!a,
708
+ onClose: x,
709
+ onPrimaryAction: () => b(!0),
710
+ onSecondaryAction: () => g(!0),
711
+ primaryText: r.details_edit_button,
712
+ secondaryText: r.details_delete_button,
713
+ title: r.details_title,
714
+ children: a && /* @__PURE__ */ u(B, { gap: 24, children: [
715
+ /* @__PURE__ */ e(Me, { budget: a }),
716
+ /* @__PURE__ */ e(ve, { height: "100%" })
652
717
  ] })
653
718
  }
654
719
  ),
655
- r && /* @__PURE__ */ d(l.Fragment, { children: [
720
+ a && /* @__PURE__ */ u(l.Fragment, { children: [
656
721
  /* @__PURE__ */ e(
657
- N,
722
+ j,
658
723
  {
659
- copy: { close_aria: a.close_aria, title: s.details_edit_title },
660
- disablePrimaryButton: Number(B) <= 0,
661
- isOpen: m,
662
- onClose: () => C(!1),
663
- onPrimaryAction: A,
664
- primaryText: s.edit_save_button,
724
+ copy: { close_aria: s.close_aria, title: r.details_edit_title },
725
+ disablePrimaryButton: Number(h) <= 0,
726
+ isOpen: S,
727
+ onClose: () => b(!1),
728
+ onPrimaryAction: v,
729
+ primaryText: r.edit_save_button,
665
730
  children: /* @__PURE__ */ e(
666
731
  re,
667
732
  {
668
- amount: B,
669
- categoryName: r.category.name,
670
- onAmountChanged: f
733
+ amount: h,
734
+ categoryName: a.category.name,
735
+ onAmountChanged: y
671
736
  }
672
737
  )
673
738
  }
674
739
  ),
675
740
  /* @__PURE__ */ e(
676
- N,
741
+ j,
677
742
  {
678
- copy: { close_aria: a.close_aria, title: s.delete_title },
679
- isOpen: _,
680
- onClose: () => u(!1),
681
- onPrimaryAction: x,
743
+ copy: { close_aria: s.close_aria, title: r.delete_title },
744
+ isOpen: p,
745
+ onClose: () => g(!1),
746
+ onPrimaryAction: A,
682
747
  primaryColor: "error",
683
748
  primaryText: "Delete",
684
749
  secondaryColor: "secondary",
685
- children: /* @__PURE__ */ e(p, { variant: "Paragraph", children: L(s.delete_description, r.category.name) })
750
+ children: /* @__PURE__ */ e(f, { variant: "Paragraph", children: R(r.delete_description, a.category.name) })
686
751
  }
687
752
  )
688
753
  ] })
689
754
  ] });
690
- }), wt = I(({ budget: t }) => {
691
- const { is_mobile_webview: o } = Ue(), { setAlert: i } = w(), { budgets: s, common: a, transactions: n } = D(), { isDesktop: r, isSmallTablet: c, isTablet: y } = me(), {
692
- sortedTransactions: g,
693
- sortedTransactionsWithSplits: h,
694
- tags: m
695
- } = ne(), [C, _] = l.useState(0), [u, B] = l.useState(""), f = l.useMemo(
696
- () => g.find((S) => S.guid === u),
697
- [u, g]
698
- ), A = (S, O) => {
699
- _(O);
700
- }, x = () => {
701
- qe(h, m), i(s.alert_csv_downloaded);
702
- }, v = g.length > 0 && !o && (r || y && !c);
703
- return /* @__PURE__ */ d(b, { gap: 24, children: [
704
- /* @__PURE__ */ e(Ie, { budget: t }),
705
- /* @__PURE__ */ d(b, { children: [
706
- /* @__PURE__ */ d(
707
- Ze,
755
+ }), Et = D(({ budget: t }) => {
756
+ const { is_mobile_webview: o } = me(), { setAlert: i } = w(), { budgets: r, common: s, transactions: n } = I(), { isDesktop: a, isSmallTablet: c, isTablet: _ } = ge(), {
757
+ sortedTransactions: d,
758
+ sortedTransactionsWithSplits: m,
759
+ tags: S
760
+ } = ne(), [b, p] = l.useState(0), [g, h] = l.useState(""), y = l.useMemo(
761
+ () => d.find((C) => C.guid === g),
762
+ [g, d]
763
+ ), v = (C, E) => {
764
+ p(E);
765
+ }, A = () => {
766
+ Qe(m, S), i(r.alert_csv_downloaded);
767
+ }, x = d.length > 0 && !o && (a || _ && !c);
768
+ return /* @__PURE__ */ u(B, { gap: 24, children: [
769
+ /* @__PURE__ */ e(Me, { budget: t }),
770
+ /* @__PURE__ */ u(B, { children: [
771
+ /* @__PURE__ */ u(
772
+ Je,
708
773
  {
709
- onChange: A,
774
+ onChange: v,
710
775
  sx: { width: "100%" },
711
776
  textColor: "primary",
712
- value: C,
777
+ value: b,
713
778
  variant: "fullWidth",
714
779
  children: [
715
- /* @__PURE__ */ e(be, { label: s.details_transactions_tab }),
716
- /* @__PURE__ */ e(be, { label: s.details_subbudgets_tab })
780
+ /* @__PURE__ */ e(ye, { label: r.details_transactions_tab }),
781
+ /* @__PURE__ */ e(ye, { label: r.details_subbudgets_tab })
717
782
  ]
718
783
  }
719
784
  ),
720
- C === 0 && /* @__PURE__ */ d(b, { children: [
721
- v && /* @__PURE__ */ e(b, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
722
- Ae,
785
+ b === 0 && /* @__PURE__ */ u(B, { children: [
786
+ x && /* @__PURE__ */ e(B, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
787
+ xe,
723
788
  {
724
- onClick: x,
725
- startIcon: /* @__PURE__ */ e($, { name: "ios_share" }),
789
+ onClick: A,
790
+ startIcon: /* @__PURE__ */ e(P, { name: "ios_share" }),
726
791
  variant: "text",
727
792
  children: n.export_csv_btn
728
793
  }
729
794
  ) }),
730
- /* @__PURE__ */ e(xe, { height: "100%", onClick: B })
795
+ /* @__PURE__ */ e(ve, { height: "100%", onClick: h })
731
796
  ] }),
732
- C === 1 && /* @__PURE__ */ e(Tt, { budget: t }),
797
+ b === 1 && /* @__PURE__ */ e(Dt, { budget: t }),
733
798
  /* @__PURE__ */ e(
734
- M,
799
+ N,
735
800
  {
736
- ariaLabelClose: a.close_aria,
737
- isOpen: !!f,
738
- onClose: () => B(""),
739
- title: s.details_transaction_drawer,
740
- children: f && /* @__PURE__ */ e(Je, { transaction: f })
801
+ ariaLabelClose: s.close_aria,
802
+ isOpen: !!y,
803
+ onClose: () => h(""),
804
+ title: r.details_transaction_drawer,
805
+ children: y && /* @__PURE__ */ e(et, { transaction: y })
741
806
  }
742
807
  )
743
808
  ] })
744
809
  ] });
745
- }), Dt = I(() => {
746
- const { selectedAccountGuids: t } = ee(), { budgets: o, common: i } = D(), {
747
- dateRange: s,
748
- deleteBudget: a,
810
+ }), Ot = D(() => {
811
+ const { selectedAccountGuids: t } = ee(), { budgets: o, common: i } = I(), {
812
+ dateRange: r,
813
+ deleteBudget: s,
749
814
  selectedBudget: n,
750
- selectedSubBudget: r,
815
+ selectedSubBudget: a,
751
816
  setAlert: c,
752
- setSelectedBudget: y,
753
- updateBudget: g
754
- } = w(), { setFilter: h } = ne(), [m, C] = l.useState(!1), [_, u] = l.useState(!1), [B, f] = l.useState(!1), [A, x] = l.useState("");
817
+ setSelectedBudget: _,
818
+ updateBudget: d
819
+ } = w(), { setFilter: m } = ne(), [S, b] = l.useState(!1), [p, g] = l.useState(!1), [h, y] = l.useState(!1), [v, A] = l.useState("");
755
820
  l.useEffect(() => {
756
- n && !r && (x(`${n.amount}`), C(!0), h({
821
+ n && !a && (A(`${n.amount}`), b(!0), m({
757
822
  accounts: t,
758
- dateRange: s,
759
- custom: (R) => R.category_guid === n.category_guid || R.top_level_category_guid === n.category_guid,
823
+ dateRange: r,
824
+ custom: (M) => M.category_guid === n.category_guid || M.top_level_category_guid === n.category_guid,
760
825
  showSplits: !0
761
826
  }));
762
827
  }, [n]);
763
- const v = async () => {
764
- n && (await g({
828
+ const x = async () => {
829
+ n && (await d({
765
830
  ...n,
766
- amount: Number(A),
767
- percentage: n.category.totalAmount / Number(A) * 100
768
- }), c(L(o.alert_budget_updated, n.category.name)));
769
- }, S = async () => {
770
- n && (await a(n.guid), c(L(o.alert_budget_deleted, n.category.name))), f(!1), O();
771
- }, O = () => {
772
- C(!1), setTimeout(() => {
773
- y(void 0);
831
+ amount: Number(v),
832
+ percentage: n.category.totalAmount / Number(v) * 100
833
+ }), c(R(o.alert_budget_updated, n.category.name)));
834
+ }, C = async () => {
835
+ n && (await s(n.guid), c(R(o.alert_budget_deleted, n.category.name))), y(!1), E();
836
+ }, E = () => {
837
+ b(!1), setTimeout(() => {
838
+ _(void 0);
774
839
  }, 250);
775
840
  };
776
841
  if (n)
777
- return /* @__PURE__ */ d(l.Fragment, { children: [
842
+ return /* @__PURE__ */ u(l.Fragment, { children: [
778
843
  /* @__PURE__ */ e(
779
- M,
844
+ N,
780
845
  {
781
846
  ariaLabelClose: i.close_aria,
782
- isOpen: m,
783
- onClose: O,
784
- onPrimaryAction: () => u(!0),
785
- onSecondaryAction: () => f(!0),
847
+ isOpen: S,
848
+ onClose: E,
849
+ onPrimaryAction: () => g(!0),
850
+ onSecondaryAction: () => y(!0),
786
851
  primaryText: o.details_edit_button,
787
852
  secondaryColor: "error",
788
853
  secondaryText: o.details_delete_button,
789
854
  title: o.details_title,
790
- children: /* @__PURE__ */ e(wt, { budget: n })
855
+ children: /* @__PURE__ */ e(Et, { budget: n })
791
856
  }
792
857
  ),
793
858
  /* @__PURE__ */ e(
794
- N,
859
+ j,
795
860
  {
796
861
  copy: { close_aria: i.close_aria, title: o.details_edit_title },
797
- disablePrimaryButton: Number(A) <= 0,
798
- isOpen: _,
799
- onClose: () => u(!1),
800
- onPrimaryAction: v,
862
+ disablePrimaryButton: Number(v) <= 0,
863
+ isOpen: p,
864
+ onClose: () => g(!1),
865
+ onPrimaryAction: x,
801
866
  primaryText: o.edit_save_button,
802
867
  children: /* @__PURE__ */ e(
803
868
  re,
804
869
  {
805
- amount: A,
870
+ amount: v,
806
871
  categoryName: n.category.name,
807
- onAmountChanged: x
872
+ onAmountChanged: A
808
873
  }
809
874
  )
810
875
  }
811
876
  ),
812
877
  /* @__PURE__ */ e(
813
- N,
878
+ j,
814
879
  {
815
880
  copy: { close_aria: i.close_aria, title: o.delete_title },
816
- isOpen: B,
817
- onClose: () => f(!1),
818
- onPrimaryAction: S,
881
+ isOpen: h,
882
+ onClose: () => y(!1),
883
+ onPrimaryAction: C,
819
884
  primaryColor: "error",
820
885
  primaryText: o.details_delete_button,
821
886
  secondaryColor: "secondary",
822
- children: /* @__PURE__ */ e(p, { variant: "Paragraph", children: L(o.delete_description, n.category.name) })
887
+ children: /* @__PURE__ */ e(f, { variant: "Paragraph", children: R(o.delete_description, n.category.name) })
823
888
  }
824
889
  )
825
890
  ] });
826
- }), It = ({ budget: t, onClick: o }) => {
891
+ }), Mt = ({ budget: t, onClick: o }) => {
827
892
  const {
828
893
  amount: i,
829
- budgetColors: { background: s, description: a },
894
+ budgetColors: { background: r, description: s },
830
895
  category_guid: n,
831
- description: r,
896
+ description: a,
832
897
  percentage: c,
833
- subBudgets: y,
834
- transaction_total: g
898
+ subBudgets: _,
899
+ transaction_total: d
835
900
  } = t;
836
- return /* @__PURE__ */ e(V, { children: /* @__PURE__ */ d(Y, { onClick: () => o?.(t), children: [
837
- /* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(ve, { color: s, percent: c, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: n, variant: "basic" }) }) }),
901
+ return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => o?.(t), children: [
902
+ /* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Te, { color: r, percent: c, size: 40, children: /* @__PURE__ */ e(W, { categoryGuid: n, variant: "basic" }) }) }),
838
903
  /* @__PURE__ */ e(
839
- Z,
904
+ Y,
840
905
  {
841
- primary: /* @__PURE__ */ d(b, { component: "span", direction: "row", justifyContent: "space-between", children: [
842
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: t.category.name }),
843
- /* @__PURE__ */ e(p, { fontWeight: 400, variant: "Body", children: `
844
- ${T(g, "0,0")} /
906
+ primary: /* @__PURE__ */ u(B, { component: "span", direction: "row", justifyContent: "space-between", children: [
907
+ /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: t.category.name }),
908
+ /* @__PURE__ */ e(f, { fontWeight: 400, variant: "Body", children: `
909
+ ${T(d, "0,0")} /
845
910
  ${T(i, "0,0")}
846
911
  ` })
847
912
  ] }),
848
- secondary: /* @__PURE__ */ d(b, { component: "span", direction: "row", justifyContent: "space-between", children: [
849
- /* @__PURE__ */ e(p, { variant: "XSmall", children: `${y.length} Sub-budgets` }),
850
- /* @__PURE__ */ e(p, { bold: c > 100, color: a, variant: "XSmall", children: r })
913
+ secondary: /* @__PURE__ */ u(B, { component: "span", direction: "row", justifyContent: "space-between", children: [
914
+ /* @__PURE__ */ e(f, { variant: "XSmall", children: `${_.length} Sub-budgets` }),
915
+ /* @__PURE__ */ e(f, { bold: c > 100, color: s, variant: "XSmall", children: a })
851
916
  ] })
852
917
  }
853
918
  )
854
919
  ] }) });
855
- }, Et = I(() => {
856
- const { onEvent: t } = X(), { budgets: o } = D(), { detailedBudgets: i, setSelectedBudget: s } = w(), a = (n) => {
857
- s(n), t(k.BUDGETS_CLICK_BUDGET_CATEGORY, {
920
+ }, Rt = D(() => {
921
+ const { onEvent: t } = H(), { budgets: o } = I(), { detailedBudgets: i, setSelectedBudget: r } = w(), s = (n) => {
922
+ r(n), t(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
858
923
  budget_category: n.category.name,
859
924
  click_type: "list"
860
925
  });
861
926
  };
862
- return /* @__PURE__ */ d(ge, { elevation: 2, children: [
863
- /* @__PURE__ */ e(Te, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Be, { children: o.budget_categories_title }) }),
864
- /* @__PURE__ */ e(pe, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(K, { children: i.map((n) => /* @__PURE__ */ d(l.Fragment, { children: [
865
- /* @__PURE__ */ e(It, { budget: n, onClick: a }),
927
+ return /* @__PURE__ */ u(pe, { elevation: 2, children: [
928
+ /* @__PURE__ */ e(we, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Se, { children: o.budget_categories_title }) }),
929
+ /* @__PURE__ */ e(he, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(X, { children: i.map((n) => /* @__PURE__ */ u(l.Fragment, { children: [
930
+ /* @__PURE__ */ e(Mt, { budget: n, onClick: s }),
866
931
  /* @__PURE__ */ e(oe, {})
867
932
  ] }, n.guid)) }) })
868
933
  ] });
869
- }), Ot = I(() => {
870
- const t = Q(), { onEvent: o } = X(), { visibleAccounts: i } = Se(), { budgets: s, common: a, recurring: n } = D(), { incomeCategories: r, spendCategories: c } = j(), { detailedBudgets: y, totalBudgeted: g } = w(), { incomeTotal: h } = te(), { setFilter: m } = ne(), [C, _] = l.useState(!1), [u, B] = l.useMemo(() => {
871
- const v = c.reduce((z, se) => z + se.totalAmount, 0);
872
- let S = v / g;
873
- S > 1 && (S = 1);
874
- let O = t.palette.success.main;
875
- S > 0.8 && S < 1 ? O = t.palette.warning.main : S >= 1 && (O = t.palette.error.main);
876
- const R = [
934
+ }), Lt = D(() => {
935
+ const t = Q(), { onEvent: o } = H(), { visibleAccounts: i } = Ae(), { budgets: r, common: s, recurring: n } = I(), { incomeCategories: a, spendCategories: c } = U(), { detailedBudgets: _, totalBudgeted: d } = w(), { incomeTotal: m } = te(), { setFilter: S } = ne(), [b, p] = l.useState(!1), [g, h] = l.useMemo(() => {
936
+ const x = c.reduce((k, se) => k + se.totalAmount, 0);
937
+ let C = x / d;
938
+ C > 1 && (C = 1);
939
+ let E = t.palette.success.main;
940
+ C > 0.8 && C < 1 ? E = t.palette.warning.main : C >= 1 && (E = t.palette.error.main);
941
+ const M = [
877
942
  {
878
- color: O,
879
- percentage: `${S}`
943
+ color: E,
944
+ percentage: `${C}`
880
945
  }
881
946
  ];
882
- return [v, R];
883
- }, [y, c]), [f, A] = l.useMemo(() => {
884
- const v = Math.abs(
885
- r.reduce((R, z) => R + z.totalAmount, 0)
947
+ return [x, M];
948
+ }, [_, c]), [y, v] = l.useMemo(() => {
949
+ const x = Math.abs(
950
+ a.reduce((M, k) => M + k.totalAmount, 0)
886
951
  );
887
- let S = v / h;
888
- S > 1 && (S = 1);
889
- const O = [
952
+ let C = x / m;
953
+ C > 1 && (C = 1);
954
+ const E = [
890
955
  {
891
956
  color: t.palette.secondary.main,
892
- percentage: `${S}`
957
+ percentage: `${C}`
893
958
  }
894
959
  ];
895
- return [v, O];
896
- }, [r, h]), x = () => {
897
- m({
898
- accounts: i.map((v) => v.guid),
960
+ return [x, E];
961
+ }, [a, m]), A = () => {
962
+ S({
963
+ accounts: i.map((x) => x.guid),
899
964
  dateRange: {
900
- start: tt(/* @__PURE__ */ new Date(), 90),
965
+ start: ot(/* @__PURE__ */ new Date(), 90),
901
966
  end: /* @__PURE__ */ new Date()
902
967
  }
903
- }), _(!0), o(k.BUDGETS_CLICK_EDIT_INCOME);
968
+ }), p(!0), o(L.BUDGETS_CLICK_EDIT_INCOME);
904
969
  };
905
- return /* @__PURE__ */ d(ge, { elevation: 2, sx: { overflow: "visible" }, children: [
906
- /* @__PURE__ */ e(Te, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Be, { children: s.overview_title }) }),
907
- /* @__PURE__ */ e(pe, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ d(b, { gap: 24, children: [
908
- /* @__PURE__ */ d(b, { gap: 8, children: [
909
- /* @__PURE__ */ e(p, { bold: !0, sx: { mb: 8 }, variant: "Body", children: s.spending_title }),
910
- /* @__PURE__ */ e(ue, { data: B, height: 16 }),
911
- /* @__PURE__ */ e(p, { variant: "Small", children: L(
912
- s.spending_description,
913
- T(u, "0,0"),
914
- T(g, "0,0")
970
+ return /* @__PURE__ */ u(pe, { elevation: 2, sx: { overflow: "visible" }, children: [
971
+ /* @__PURE__ */ e(we, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Se, { children: r.overview_title }) }),
972
+ /* @__PURE__ */ e(he, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ u(B, { gap: 24, children: [
973
+ /* @__PURE__ */ u(B, { gap: 8, children: [
974
+ /* @__PURE__ */ e(f, { bold: !0, sx: { mb: 8 }, variant: "Body", children: r.spending_title }),
975
+ /* @__PURE__ */ e(ue, { data: h, height: 16 }),
976
+ /* @__PURE__ */ e(f, { variant: "Small", children: R(
977
+ r.spending_description,
978
+ T(g, "0,0"),
979
+ T(d, "0,0")
915
980
  ) })
916
981
  ] }),
917
- /* @__PURE__ */ d(b, { gap: 8, children: [
918
- /* @__PURE__ */ d(b, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
919
- /* @__PURE__ */ e(p, { bold: !0, variant: "Body", children: s.income_title }),
982
+ /* @__PURE__ */ u(B, { gap: 8, children: [
983
+ /* @__PURE__ */ u(B, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
984
+ /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: r.income_title }),
920
985
  /* @__PURE__ */ e(
921
- nt,
986
+ at,
922
987
  {
923
988
  "aria-label": n.manage_income,
924
- onClick: x,
989
+ onClick: A,
925
990
  sx: { p: 0 },
926
- children: /* @__PURE__ */ e($, { color: "primary", name: "edit" })
991
+ children: /* @__PURE__ */ e(P, { color: "primary", name: "edit" })
927
992
  }
928
993
  )
929
994
  ] }),
930
- /* @__PURE__ */ e(ue, { data: A, height: 16 }),
931
- /* @__PURE__ */ e(p, { variant: "Small", children: L(
932
- s.income_description,
933
- T(f, "0,0"),
934
- T(h, "0,0")
995
+ /* @__PURE__ */ e(ue, { data: v, height: 16 }),
996
+ /* @__PURE__ */ e(f, { variant: "Small", children: R(
997
+ r.income_description,
998
+ T(y, "0,0"),
999
+ T(m, "0,0")
935
1000
  ) })
936
1001
  ] })
937
1002
  ] }) }),
938
1003
  /* @__PURE__ */ e(
939
- M,
1004
+ N,
940
1005
  {
941
- ariaLabelClose: a.close_aria,
942
- isOpen: C,
943
- onClose: () => _(!1),
1006
+ ariaLabelClose: s.close_aria,
1007
+ isOpen: b,
1008
+ onClose: () => p(!1),
944
1009
  title: n.manage_income,
945
- children: /* @__PURE__ */ e(ot, { forOverview: !0 })
1010
+ children: /* @__PURE__ */ e(rt, { forOverview: !0 })
946
1011
  }
947
1012
  )
948
1013
  ] });
949
- }), Ce = 480, Dn = I(({ onBackClick: t, sx: o }) => {
950
- const i = Q(), { onEvent: s } = X(), { visibleAccounts: a } = Se(), { budgets: n, common: r } = D(), { isCopyLoaded: c, isInitialized: y, selectedAccounts: g, setDisplayedDate: h, setSelectedAccounts: m } = ee(), {
951
- alert: C,
952
- dateRange: _,
953
- isDataLoaded: u,
954
- loadBudgetData: B,
955
- setDateRange: f,
956
- setAlert: A,
957
- setTheme: x,
958
- detailedBudgets: v
959
- } = w(), { loadRepeatingTransactions: S, setDateRange: O } = te(), { reloadCategoryTotals: R } = j(), { isSmallTablet: z, isMobile: se, isSmallMobile: Ee } = me(), U = z || se || Ee, [Oe, ie] = l.useState(!1);
960
- l.useEffect(() => (x(i), m(a), f({ start: J(q()), end: de(q()) }), s(k.BUDGETS_VIEW), () => {
961
- f({ start: J(q()), end: de(q()) });
1014
+ }), Be = 480, On = D(({ onBackClick: t, sx: o }) => {
1015
+ const i = Q(), { onEvent: r } = H(), { visibleAccounts: s } = Ae(), { budgets: n, common: a } = I(), { isCopyLoaded: c, isInitialized: _, selectedAccounts: d, setDisplayedDate: m, setSelectedAccounts: S } = ee(), {
1016
+ alert: b,
1017
+ dateRange: p,
1018
+ isDataLoaded: g,
1019
+ loadBudgetData: h,
1020
+ setDateRange: y,
1021
+ setAlert: v,
1022
+ setTheme: A,
1023
+ detailedBudgets: x
1024
+ } = w(), { loadRepeatingTransactions: C, setDateRange: E } = te(), { reloadCategoryTotals: M } = U(), { isSmallTablet: k, isMobile: se, isSmallMobile: Re } = ge(), z = k || se || Re, [Le, ie] = l.useState(!1);
1025
+ l.useEffect(() => (A(i), S(s), y({ start: q(Z()), end: de(Z()) }), r(L.BUDGETS_VIEW), () => {
1026
+ y({ start: q(Z()), end: de(Z()) });
962
1027
  }), []), l.useEffect(() => {
963
- m(a);
964
- }, [a]), l.useEffect(() => {
965
- y && (h(_.start, _.end), R(g, _.start, _.end).finally(), O(_), u || (S().finally(), B().finally()));
966
- }, [y, g, _]);
967
- const Le = (_e) => {
968
- f({ start: _e[0] || /* @__PURE__ */ new Date(), end: _e[1] || /* @__PURE__ */ new Date() });
969
- }, Re = () => {
970
- s(k.BUDGETS_CLICK_FILTER);
971
- }, he = () => {
972
- ie(!0), s(k.BUDGETS_CLICK_ADD);
1028
+ S(s);
1029
+ }, [s]), l.useEffect(() => {
1030
+ _ && (m(p.start, p.end), M(d, p.start, p.end).finally(), E(p), g || (C().finally(), h().finally()));
1031
+ }, [_, d, p]);
1032
+ const Ne = (fe) => {
1033
+ y({ start: fe[0] || /* @__PURE__ */ new Date(), end: fe[1] || /* @__PURE__ */ new Date() });
973
1034
  }, ke = () => {
1035
+ r(L.BUDGETS_CLICK_FILTER);
1036
+ }, _e = () => {
1037
+ ie(!0), r(L.BUDGETS_CLICK_ADD);
1038
+ }, Pe = () => {
974
1039
  ie(!1);
975
- }, Me = Ke(_.end, J(/* @__PURE__ */ new Date()));
976
- return !c || !y || !u ? /* @__PURE__ */ e(P, {}) : /* @__PURE__ */ d(
977
- Fe,
1040
+ }, $e = Ye(p.end, q(/* @__PURE__ */ new Date()));
1041
+ return !c || !_ || !g ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ u(
1042
+ He,
978
1043
  {
979
- accountOptions: a,
1044
+ accountOptions: s,
980
1045
  actions: [
981
1046
  {
982
1047
  iconName: "add",
983
1048
  label: n.add_title,
984
- onClick: he
1049
+ onClick: _e
985
1050
  }
986
1051
  ],
987
1052
  calendarActions: {
988
- onRangeChanged: Le,
989
- shouldDisableNext: Me,
1053
+ onRangeChanged: Ne,
1054
+ shouldDisableNext: $e,
990
1055
  shouldDisablePicker: !0
991
1056
  },
992
- onAccountsFilterClick: Re,
1057
+ onAccountsFilterClick: ke,
993
1058
  onBackClick: t,
994
1059
  sx: o,
995
1060
  title: n.budgets_title,
996
1061
  children: [
997
- (!y || !u) && /* @__PURE__ */ e(P, {}),
998
- y && u && /* @__PURE__ */ d(
999
- b,
1062
+ (!_ || !g) && /* @__PURE__ */ e(G, {}),
1063
+ _ && g && /* @__PURE__ */ u(
1064
+ B,
1000
1065
  {
1001
- direction: U ? "column" : "row",
1066
+ direction: z ? "column" : "row",
1002
1067
  height: "100%",
1003
1068
  sx: { justifyContent: "center" },
1004
1069
  width: "100%",
1005
1070
  children: [
1006
- /* @__PURE__ */ e(b, { height: U ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1007
- we,
1071
+ /* @__PURE__ */ e(B, { height: z ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1072
+ Ee,
1008
1073
  {
1009
- createBudgetOnClick: he,
1010
- height: U ? 450 : 800,
1074
+ createBudgetOnClick: _e,
1075
+ height: z ? 450 : 800,
1011
1076
  isDraggable: !0,
1012
- shouldShowZeroState: v.length === 0,
1013
- unavailableWidth: U ? 0 : Ce
1077
+ shouldShowZeroState: x.length === 0,
1078
+ unavailableWidth: z ? 0 : Be
1014
1079
  }
1015
1080
  ) }),
1016
- v.length !== 0 && /* @__PURE__ */ d(
1017
- b,
1081
+ x.length !== 0 && /* @__PURE__ */ u(
1082
+ B,
1018
1083
  {
1019
1084
  gap: 24,
1020
1085
  height: "100%",
1021
1086
  sx: { mr: 24, mt: 48 },
1022
- width: U ? "100%" : Ce,
1087
+ width: z ? "100%" : Be,
1023
1088
  children: [
1024
- /* @__PURE__ */ e(Ot, {}),
1025
- /* @__PURE__ */ e(Et, {})
1089
+ /* @__PURE__ */ e(Lt, {}),
1090
+ /* @__PURE__ */ e(Rt, {})
1026
1091
  ]
1027
1092
  }
1028
1093
  )
1029
1094
  ]
1030
1095
  }
1031
1096
  ),
1032
- /* @__PURE__ */ e(Dt, {}),
1097
+ /* @__PURE__ */ e(Ot, {}),
1033
1098
  /* @__PURE__ */ e(
1034
- M,
1099
+ N,
1035
1100
  {
1036
- ariaLabelClose: r.close_aria,
1037
- isOpen: Oe,
1101
+ ariaLabelClose: a.close_aria,
1102
+ isOpen: Le,
1038
1103
  onClose: () => ie(!1),
1039
1104
  title: n.add_new_title,
1040
- children: /* @__PURE__ */ e(De, { onRecalculateBudgets: ke })
1105
+ children: /* @__PURE__ */ e(Oe, { onRecalculateBudgets: Pe })
1041
1106
  }
1042
1107
  ),
1043
1108
  /* @__PURE__ */ e(
1044
- Ye,
1109
+ qe,
1045
1110
  {
1046
1111
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
1047
1112
  autoHideDuration: 3500,
1048
1113
  onClose: () => {
1049
- A("");
1114
+ v("");
1050
1115
  },
1051
- open: !!C,
1116
+ open: !!b,
1052
1117
  children: /* @__PURE__ */ e(
1053
- Ve,
1118
+ Ze,
1054
1119
  {
1055
1120
  onClose: () => {
1056
- A("");
1121
+ v("");
1057
1122
  },
1058
1123
  severity: "success",
1059
1124
  variant: "filled",
1060
- children: C
1125
+ children: b
1061
1126
  }
1062
1127
  )
1063
1128
  }
@@ -1067,6 +1132,6 @@ const ht = ({
1067
1132
  );
1068
1133
  });
1069
1134
  export {
1070
- wn as BubbleBudgetsMiniWidget,
1071
- Dn as BubbleBudgetsWidget
1135
+ En as BubbleBudgetsMiniWidget,
1136
+ On as BubbleBudgetsWidget
1072
1137
  };