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

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,153 +1,129 @@
1
- import { jsx as e, jsxs as u, Fragment as Ge } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as d, Fragment as $e } from "react/jsx-runtime";
2
2
  import l from "react";
3
- import { observer as D } from "mobx-react-lite";
3
+ import { observer as I } from "mobx-react-lite";
4
4
  import { endOfMonth as de } from "date-fns/endOfMonth";
5
- import { startOfMonth as q } from "date-fns/startOfMonth";
6
- import F from "@mui/material/Box";
7
- import B from "@mui/material/Stack";
5
+ import { startOfMonth as J } from "date-fns/startOfMonth";
6
+ import W from "@mui/material/Box";
7
+ import b from "@mui/material/Stack";
8
8
  import Q from "@mui/material/styles/useTheme";
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";
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";
16
16
  import { E as ce } from "../EmptyState-C0lr9E5T.mjs";
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";
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";
20
20
  import { f as T } from "../NumberFormatting-CtWHhyBX.mjs";
21
- import xe from "@mui/material/Button";
21
+ import Ae from "@mui/material/Button";
22
22
  import oe from "@mui/material/Divider";
23
- import K from "@mui/material/ListItem";
23
+ import V from "@mui/material/ListItem";
24
24
  import ae from "@mui/material/ListItemAvatar";
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";
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";
43
43
  import { S as ue } from "../StatusBar-BK_uYHAB.mjs";
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;
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;
57
57
  };
58
- return O.drag().on("start", o).on("drag", i).on("end", r);
58
+ return E.drag().on("start", o).on("drag", i).on("end", s);
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, 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) || "");
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) || "");
64
64
  }, ct = (t) => {
65
- O.selectAll(".bubble").call(st(t));
65
+ E.selectAll(".bubble").call(st(t));
66
66
  }, lt = (t, o, i) => {
67
67
  t.alpha(1).restart().force(
68
68
  "x",
69
- O.forceX().x(i / 2).strength(0.01)
69
+ E.forceX().x(i / 2).strength(0.01)
70
70
  ).force(
71
71
  "y",
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);
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);
79
77
  return c > n ? c : n;
80
- }, 0), i = t.reduce((n, a) => {
81
- const c = Math.max(a.transaction_total, a.amount);
78
+ }, 0), i = t.reduce((n, r) => {
79
+ const c = Math.max(r.transaction_total, r.amount);
82
80
  return c < n ? c : n;
83
- }, o), r = De(i, o), s = t.map((n) => {
84
- const a = r(Math.max(n.transaction_total, n.amount)) || 25;
81
+ }, o), s = dt(i, o), a = t.map((n) => {
82
+ const r = s(Math.max(n.transaction_total, n.amount)) || 25;
85
83
  return {
86
84
  ...n,
87
- radius: a
85
+ radius: r
88
86
  };
89
87
  });
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 }) => {
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 }) {
105
93
  const o = Q(), {
106
- amount: i,
107
- guid: r,
94
+ guid: i,
108
95
  budgetColors: { mercury: s },
109
- radius: n,
110
- transaction_total: a
111
- } = t, c = `mercury-${r}`;
96
+ radius: a
97
+ } = t, n = `mercury-${i}`;
112
98
  l.useEffect(() => {
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(
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(
117
103
  "path",
118
104
  {
119
- d: _(n) || "",
105
+ d: r(a) || "",
120
106
  style: { fill: o.palette.common.white, fillOpacity: 0.35 }
121
107
  }
122
108
  ) });
123
- }, _t = l.memo(ht), $ = 75, le = 50;
124
- function ft({ bubble: t, isDraggable: o, isMiniWidget: i, onClick: r = () => {
109
+ }
110
+ const G = 75, le = 50;
111
+ function pt({ bubble: t, isDraggable: o, onClick: i = () => {
125
112
  } }) {
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]);
113
+ const [s, a] = l.useState(!1);
136
114
  if (!t) return;
137
115
  const {
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 = {
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 = {
151
127
  modifiers: [
152
128
  {
153
129
  name: "offset",
@@ -155,132 +131,101 @@ function ft({ bubble: t, isDraggable: o, isMiniWidget: i, onClick: r = () => {
155
131
  }
156
132
  ]
157
133
  };
158
- return /* @__PURE__ */ u(
134
+ return /* @__PURE__ */ d(
159
135
  "g",
160
136
  {
161
137
  className: "bubble",
162
- id: `bubble-${p}`,
163
- onClick: () => r(t),
164
- onMouseEnter: () => n(!0),
165
- onMouseLeave: () => n(!1),
138
+ id: `bubble-${g}`,
139
+ onClick: () => i(t),
140
+ onMouseEnter: () => a(!0),
141
+ onMouseLeave: () => a(!1),
166
142
  style: { cursor: o ? "pointer" : "default" },
167
143
  textAnchor: "middle",
168
- x: y,
169
- y: v,
144
+ x: C,
145
+ y: _,
170
146
  children: [
171
147
  /* @__PURE__ */ e(
172
- Fe,
148
+ je,
173
149
  {
174
150
  followCursor: !0,
175
151
  open: s,
176
- slotProps: { popper: k },
177
- title: M,
178
- children: /* @__PURE__ */ e("circle", { fill: d, id: `circle-${p}`, r: h })
152
+ slotProps: { popper: A },
153
+ title: f,
154
+ children: /* @__PURE__ */ e("circle", { fill: n, id: `circle-${g}`, r: m })
179
155
  }
180
156
  ),
181
- /* @__PURE__ */ e("svg", { x, y: C, children: /* @__PURE__ */ e(P, { name: S, size: E, sx: { fill: m } }) }),
182
- h > $ && /* @__PURE__ */ e(
183
- f,
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,
184
160
  {
185
161
  bold: !0,
186
162
  component: "text",
187
- id: `budget-category-${p}`,
188
- sx: { fill: m },
163
+ id: `budget-category-${g}`,
164
+ sx: { fill: r },
189
165
  variant: "Small",
190
166
  y: 4,
191
- children: b
167
+ children: y
192
168
  }
193
169
  ),
194
- h > le && /* @__PURE__ */ e(
195
- f,
170
+ m > le && /* @__PURE__ */ e(
171
+ p,
196
172
  {
197
173
  bold: !0,
198
174
  component: "text",
199
- id: `budget-description-${p}-1`,
200
- sx: { fill: m },
175
+ id: `budget-description-${g}-1`,
176
+ sx: { fill: r },
201
177
  variant: "Body",
202
- y: h <= $ ? 12 : 24,
203
- children: h <= $ ? g.split(" ")[0] : g
178
+ y: m <= G ? 12 : 24,
179
+ children: m <= G ? h.split(" ")[0] : h
204
180
  }
205
181
  ),
206
- h <= $ && h > le && /* @__PURE__ */ e(
207
- f,
182
+ m <= G && m > le && /* @__PURE__ */ e(
183
+ p,
208
184
  {
209
185
  component: "text",
210
- id: `budget-description-${p}-2`,
211
- sx: { fill: m },
186
+ id: `budget-description-${g}-2`,
187
+ sx: { fill: r },
212
188
  variant: "XSmall",
213
189
  y: 28,
214
- children: g.split(" ")[1]
190
+ children: h.split(" ")[1]
215
191
  }
216
192
  ),
217
- /* @__PURE__ */ e(_t, { bubble: _ })
193
+ /* @__PURE__ */ e(gt, { bubble: t })
218
194
  ]
219
195
  },
220
- p
196
+ g
221
197
  );
222
198
  }
223
- const yt = ({
199
+ let F;
200
+ const ht = ({
224
201
  height: t,
225
202
  width: o,
226
203
  isDraggable: i = !1,
227
- isMiniWidget: r = !1,
228
204
  onClick: s = () => {
229
205
  }
230
206
  }) => {
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 = ({
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 = ({
267
212
  isMiniWidget: t = !1,
268
213
  onConnectAccountsClick: o,
269
214
  createBudgetOnClick: i
270
215
  }) => {
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);
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);
275
220
  };
276
- return m ? /* @__PURE__ */ e(G, {}) : _ ? /* @__PURE__ */ e(
221
+ return h ? /* @__PURE__ */ e(P, {}) : y ? /* @__PURE__ */ e(
277
222
  ce,
278
223
  {
279
224
  header: n.autogenerate_budgets_error_header,
280
225
  icon: "error",
281
226
  iconColor: "#4D4D4D",
282
- onClick: (g) => {
283
- g === "primary" ? p() : i();
227
+ onClick: (u) => {
228
+ u === "primary" ? _() : i();
284
229
  },
285
230
  primaryButton: n.autogenerate_budgets_error_primary_button,
286
231
  secondaryButton: n.zero_state_generate_budgets_secondary_button,
@@ -292,14 +237,14 @@ const yt = ({
292
237
  }
293
238
  }
294
239
  }
295
- ) : /* @__PURE__ */ e(Ge, { children: a ? /* @__PURE__ */ e(
240
+ ) : /* @__PURE__ */ e($e, { children: r ? /* @__PURE__ */ e(
296
241
  ce,
297
242
  {
298
243
  header: n.zero_state_generate_budgets_header,
299
244
  icon: "error",
300
245
  iconColor: "#4D4D4D",
301
- onClick: (g) => {
302
- g === "primary" ? o() : i();
246
+ onClick: (u) => {
247
+ u === "primary" ? o() : i();
303
248
  },
304
249
  primaryButton: n.zero_state_generate_budgets_primary_button,
305
250
  secondaryButton: n.zero_state_generate_budgets_secondary_button,
@@ -321,8 +266,8 @@ const yt = ({
321
266
  header: n.create_budgets_title,
322
267
  icon: "bubble_chart",
323
268
  iconColor: "#1A1A1A",
324
- onClick: (g) => {
325
- g === "primary" ? p() : i();
269
+ onClick: (u) => {
270
+ u === "primary" ? _() : i();
326
271
  },
327
272
  primaryButton: n.empty_state_primary_button,
328
273
  secondaryButton: t ? void 0 : n.empty_state_secondary_button,
@@ -339,105 +284,104 @@ const yt = ({
339
284
  }
340
285
  }
341
286
  ) });
342
- }, Ee = D(
287
+ }, we = I(
343
288
  ({
344
289
  createBudgetOnClick: t = () => {
345
290
  },
346
291
  height: o,
347
292
  isDraggable: i = !1,
348
- isMiniWidget: r = !1,
349
- shouldShowZeroState: s,
293
+ isMiniWidget: s = !1,
294
+ shouldShowZeroState: a,
350
295
  unavailableWidth: n = 24
351
296
  }) => {
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,
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,
355
300
  click_type: "bubble"
356
301
  });
357
- }, v = () => {
358
- g(!0), a(L.ACCOUNTS_CLICK_CONNECT);
302
+ }, A = () => {
303
+ u(!0), r(k.ACCOUNTS_CLICK_CONNECT);
359
304
  };
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,
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,
363
308
  {
364
309
  createBudgetOnClick: t,
365
- isMiniWidget: r,
366
- onConnectAccountsClick: v
310
+ isMiniWidget: s,
311
+ onConnectAccountsClick: A
367
312
  }
368
313
  ) : /* @__PURE__ */ e(
369
- bt,
314
+ _t,
370
315
  {
371
316
  height: o,
372
317
  isDraggable: i,
373
- isMiniWidget: r,
374
- onClick: y,
375
- width: h
318
+ onClick: f,
319
+ width: B
376
320
  }
377
321
  ),
378
322
  /* @__PURE__ */ e(
379
- ze,
323
+ Ne,
380
324
  {
381
- onClose: () => g(!1),
382
- showConnectionsWidget: p,
383
- title: m.manage_connections
325
+ onClose: () => u(!1),
326
+ showConnectionsWidget: _,
327
+ title: h.manage_connections
384
328
  }
385
329
  )
386
330
  ] });
387
331
  }
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 })
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 })
394
338
  ] }),
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 })
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 })
399
343
  ] }),
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 })
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 })
404
348
  ] })
405
349
  ] });
406
- }), St = D(
350
+ }), ft = I(
407
351
  ({ category: t }) => {
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}`;
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}`;
411
355
  }, [o, i]);
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 })
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 })
416
360
  ] }) }),
417
361
  /* @__PURE__ */ e(oe, {})
418
362
  ] }, t.guid);
419
363
  }
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?.();
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?.();
423
367
  };
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 }),
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 }),
427
371
  /* @__PURE__ */ e(
428
- N,
372
+ M,
429
373
  {
430
374
  ariaLabelClose: i.close_aria,
431
- isOpen: a,
375
+ isOpen: r,
432
376
  onClose: () => c(!1),
433
- onPrimaryAction: d,
377
+ onPrimaryAction: g,
434
378
  title: o.recalculate_title,
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 })
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 })
439
383
  ] }),
440
- /* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: _.map((m) => /* @__PURE__ */ e(St, { category: m }, m.guid)) }) })
384
+ /* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: y.map((h) => /* @__PURE__ */ e(ft, { category: h }, h.guid)) }) })
441
385
  ] })
442
386
  }
443
387
  )
@@ -447,682 +391,673 @@ const yt = ({
447
391
  categoryName: o,
448
392
  onAmountChanged: i
449
393
  }) => {
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")
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")
456
400
  ) }),
457
- /* @__PURE__ */ e(f, { children: R(r.add_description_bottom, o) })
401
+ /* @__PURE__ */ e(p, { children: L(s.add_description_bottom, o) })
458
402
  ] }),
459
403
  /* @__PURE__ */ e(
460
- Ke,
404
+ He,
461
405
  {
462
406
  amount: t,
463
407
  autoFocus: !0,
464
- label: r.add_label,
408
+ label: s.add_label,
465
409
  minAmount: 0,
466
410
  setAmount: i,
467
411
  sx: { ".MuiTypography-Body": { p: 0 } }
468
412
  }
469
413
  )
470
414
  ] });
471
- }, xt = D(({ category: t, onAddBudget: o }) => {
472
- const { budgets: i, common: r } = I(), [s, n] = l.useState(!1), [a, c] = l.useState(
415
+ }, Bt = I(({ category: t, onAddBudget: o }) => {
416
+ const { budgets: i, common: s } = D(), [a, n] = l.useState(!1), [r, c] = l.useState(
473
417
  `${t.totalAmount === 0 ? "" : t.totalAmount}`
474
418
  );
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 }) }),
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 }) }),
478
422
  /* @__PURE__ */ e(
479
- Y,
423
+ Z,
480
424
  {
481
425
  primary: t.name,
482
426
  secondary: T(t.totalAmount, "0,0")
483
427
  }
484
428
  ),
485
- /* @__PURE__ */ e(Xe, { children: /* @__PURE__ */ e(P, { name: "add", size: 20 }) })
429
+ /* @__PURE__ */ e(We, { children: /* @__PURE__ */ e($, { name: "add", size: 20 }) })
486
430
  ] }) }, t.guid),
487
431
  /* @__PURE__ */ e(
488
- j,
432
+ N,
489
433
  {
490
- copy: { close_aria: r.close_aria, title: i.add_title },
491
- disablePrimaryButton: Number(a) <= 0,
492
- isOpen: s,
434
+ copy: { close_aria: s.close_aria, title: i.add_title },
435
+ disablePrimaryButton: Number(r) <= 0,
436
+ isOpen: a,
493
437
  onClose: () => n(!1),
494
- onPrimaryAction: () => o(t, Number(a)),
438
+ onPrimaryAction: () => o(t, Number(r)),
495
439
  primaryText: i.add_save_button,
496
- children: /* @__PURE__ */ e(re, { amount: a, categoryName: t.name, onAmountChanged: c })
440
+ children: /* @__PURE__ */ e(re, { amount: r, categoryName: t.name, onAmountChanged: c })
497
441
  }
498
442
  )
499
443
  ] });
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));
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));
503
447
  };
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,
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,
508
452
  {
509
- category: a,
453
+ category: r,
510
454
  onAddBudget: n
511
455
  },
512
- a.guid
456
+ r.guid
513
457
  )) }) }),
514
- /* @__PURE__ */ e(At, { onRecalculateBudgets: t })
458
+ /* @__PURE__ */ e(Ct, { onRecalculateBudgets: t })
515
459
  ] });
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);
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);
521
465
  };
522
466
  return l.useEffect(() => {
523
- _(o);
467
+ r(o);
524
468
  }, [o]), l.useEffect(() => {
525
- b && !a && g(p, q(/* @__PURE__ */ new Date()), de(/* @__PURE__ */ new Date())).then(
469
+ h && !a && C(m, J(/* @__PURE__ */ new Date()), de(/* @__PURE__ */ new Date())).then(
526
470
  () => {
527
- c().finally();
471
+ n().finally();
528
472
  }
529
473
  );
530
- }, [b, p]), S ? /* @__PURE__ */ u(
531
- Ve,
474
+ }, [h, m]), g ? /* @__PURE__ */ d(
475
+ Xe,
532
476
  {
533
- primaryCtaLabel: y ? d.get_started_cta : d.details_cta,
534
- title: d.budgets_title,
477
+ primaryCtaLabel: u ? c.get_started_cta : c.details_cta,
478
+ title: c.budgets_title,
535
479
  ...t,
536
480
  children: [
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, {}),
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, {}),
561
496
  /* @__PURE__ */ e(
562
- N,
497
+ M,
563
498
  {
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 })
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 })
569
504
  }
570
505
  )
571
506
  ]
572
507
  }
573
- ) : /* @__PURE__ */ e(G, {});
574
- }, En = D(vt), Me = ({ budget: t }) => {
508
+ ) : /* @__PURE__ */ e(P, {});
509
+ }, wn = I(St), Ie = ({ budget: t }) => {
575
510
  const {
576
511
  amount: o,
577
512
  budgetColors: { background: i },
578
- category: { name: r },
579
- category_guid: s,
513
+ category: { name: s },
514
+ category_guid: a,
580
515
  percentage: n,
581
- transaction_total: a
516
+ transaction_total: r
582
517
  } = t, c = [
583
518
  {
584
519
  color: i,
585
520
  percentage: `${n}%`
586
521
  }
587
522
  ];
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 }),
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 }),
592
527
  /* @__PURE__ */ e(ue, { data: c, height: 10 })
593
528
  ] }) }) });
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 })
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 })
600
535
  ] });
601
- }), wt = D(({ budget: t }) => {
536
+ }), xt = I(({ budget: t }) => {
602
537
  const {
603
538
  amount: o,
604
539
  budgetColors: { background: i },
605
- category: r,
606
- percentage: s,
540
+ category: s,
541
+ percentage: a,
607
542
  transaction_total: n
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" }) }) }),
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" }) }) }),
611
546
  /* @__PURE__ */ e(
612
- Y,
547
+ Z,
613
548
  {
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: `
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: `
616
551
  ${T(n, "0,0")} /
617
552
  ${T(o, "0,0")}
618
553
  ` }) })
619
554
  }
620
555
  )
621
556
  ] }) });
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);
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);
624
559
  l.useEffect(() => {
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));
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));
628
563
  });
629
564
  }, []);
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));
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));
634
569
  };
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 })
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 })
640
575
  ] }),
641
- /* @__PURE__ */ e(P, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
576
+ /* @__PURE__ */ e($, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
642
577
  ] }) }) }) }),
643
578
  /* @__PURE__ */ e(oe, {}),
644
579
  /* @__PURE__ */ e(
645
- N,
580
+ M,
646
581
  {
647
- ariaLabelClose: r.close_aria,
582
+ ariaLabelClose: s.close_aria,
648
583
  isOpen: c,
649
- onClose: () => _(!1),
584
+ onClose: () => y(!1),
650
585
  title: i.add_sub_budget_title,
651
- children: /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(nt, { category: t, subCategories: t.subCategories }) })
586
+ children: /* @__PURE__ */ e(K, { children: /* @__PURE__ */ e(et, { category: t, subCategories: t.subCategories }) })
652
587
  }
653
588
  ),
654
589
  /* @__PURE__ */ e(
655
- j,
590
+ N,
656
591
  {
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,
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,
662
597
  primaryText: i.add_save_button,
663
598
  children: /* @__PURE__ */ e(
664
599
  re,
665
600
  {
666
- amount: S,
667
- categoryName: p?.name || "",
668
- onAmountChanged: b
601
+ amount: m,
602
+ categoryName: _?.name || "",
603
+ onAmountChanged: C
669
604
  }
670
605
  )
671
606
  }
672
607
  )
673
608
  ] });
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("");
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("");
676
611
  l.useEffect(() => {
677
- a && (y(`${a.amount}`), m({
678
- ...d,
679
- custom: (C) => C.category_guid === a.category_guid
612
+ r && (f(`${r.amount}`), h({
613
+ ...g,
614
+ custom: (S) => S.category_guid === r.category_guid
680
615
  }));
681
- }, [a]);
682
- const v = async () => {
683
- a && await _({
684
- ...a,
685
- amount: Number(h)
616
+ }, [r]);
617
+ const A = async () => {
618
+ r && await y({
619
+ ...r,
620
+ amount: Number(B)
686
621
  });
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
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
693
628
  }), c(void 0);
694
629
  };
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 }),
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 }),
699
634
  /* @__PURE__ */ e(oe, {})
700
- ] }, C.guid)),
701
- /* @__PURE__ */ e(It, { category: o, parentBudget: t })
635
+ ] }, S.guid)),
636
+ /* @__PURE__ */ e(vt, { category: o, parentBudget: t })
702
637
  ] }),
703
638
  /* @__PURE__ */ e(
704
- N,
639
+ M,
705
640
  {
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%" })
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%" })
717
652
  ] })
718
653
  }
719
654
  ),
720
- a && /* @__PURE__ */ u(l.Fragment, { children: [
655
+ r && /* @__PURE__ */ d(l.Fragment, { children: [
721
656
  /* @__PURE__ */ e(
722
- j,
657
+ N,
723
658
  {
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,
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,
730
665
  children: /* @__PURE__ */ e(
731
666
  re,
732
667
  {
733
- amount: h,
734
- categoryName: a.category.name,
735
- onAmountChanged: y
668
+ amount: B,
669
+ categoryName: r.category.name,
670
+ onAmountChanged: f
736
671
  }
737
672
  )
738
673
  }
739
674
  ),
740
675
  /* @__PURE__ */ e(
741
- j,
676
+ N,
742
677
  {
743
- copy: { close_aria: s.close_aria, title: r.delete_title },
744
- isOpen: p,
745
- onClose: () => g(!1),
746
- onPrimaryAction: A,
678
+ copy: { close_aria: a.close_aria, title: s.delete_title },
679
+ isOpen: _,
680
+ onClose: () => u(!1),
681
+ onPrimaryAction: x,
747
682
  primaryColor: "error",
748
683
  primaryText: "Delete",
749
684
  secondaryColor: "secondary",
750
- children: /* @__PURE__ */ e(f, { variant: "Paragraph", children: R(r.delete_description, a.category.name) })
685
+ children: /* @__PURE__ */ e(p, { variant: "Paragraph", children: L(s.delete_description, r.category.name) })
751
686
  }
752
687
  )
753
688
  ] })
754
689
  ] });
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,
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,
773
708
  {
774
- onChange: v,
709
+ onChange: A,
775
710
  sx: { width: "100%" },
776
711
  textColor: "primary",
777
- value: b,
712
+ value: C,
778
713
  variant: "fullWidth",
779
714
  children: [
780
- /* @__PURE__ */ e(ye, { label: r.details_transactions_tab }),
781
- /* @__PURE__ */ e(ye, { label: r.details_subbudgets_tab })
715
+ /* @__PURE__ */ e(be, { label: s.details_transactions_tab }),
716
+ /* @__PURE__ */ e(be, { label: s.details_subbudgets_tab })
782
717
  ]
783
718
  }
784
719
  ),
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,
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,
788
723
  {
789
- onClick: A,
790
- startIcon: /* @__PURE__ */ e(P, { name: "ios_share" }),
724
+ onClick: x,
725
+ startIcon: /* @__PURE__ */ e($, { name: "ios_share" }),
791
726
  variant: "text",
792
727
  children: n.export_csv_btn
793
728
  }
794
729
  ) }),
795
- /* @__PURE__ */ e(ve, { height: "100%", onClick: h })
730
+ /* @__PURE__ */ e(xe, { height: "100%", onClick: B })
796
731
  ] }),
797
- b === 1 && /* @__PURE__ */ e(Dt, { budget: t }),
732
+ C === 1 && /* @__PURE__ */ e(Tt, { budget: t }),
798
733
  /* @__PURE__ */ e(
799
- N,
734
+ M,
800
735
  {
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 })
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 })
806
741
  }
807
742
  )
808
743
  ] })
809
744
  ] });
810
- }), Ot = D(() => {
811
- const { selectedAccountGuids: t } = ee(), { budgets: o, common: i } = I(), {
812
- dateRange: r,
813
- deleteBudget: s,
745
+ }), Dt = I(() => {
746
+ const { selectedAccountGuids: t } = ee(), { budgets: o, common: i } = D(), {
747
+ dateRange: s,
748
+ deleteBudget: a,
814
749
  selectedBudget: n,
815
- selectedSubBudget: a,
750
+ selectedSubBudget: r,
816
751
  setAlert: c,
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("");
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("");
820
755
  l.useEffect(() => {
821
- n && !a && (A(`${n.amount}`), b(!0), m({
756
+ n && !r && (x(`${n.amount}`), C(!0), h({
822
757
  accounts: t,
823
- dateRange: r,
824
- custom: (M) => M.category_guid === n.category_guid || M.top_level_category_guid === n.category_guid,
758
+ dateRange: s,
759
+ custom: (R) => R.category_guid === n.category_guid || R.top_level_category_guid === n.category_guid,
825
760
  showSplits: !0
826
761
  }));
827
762
  }, [n]);
828
- const x = async () => {
829
- n && (await d({
763
+ const v = async () => {
764
+ n && (await g({
830
765
  ...n,
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);
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);
839
774
  }, 250);
840
775
  };
841
776
  if (n)
842
- return /* @__PURE__ */ u(l.Fragment, { children: [
777
+ return /* @__PURE__ */ d(l.Fragment, { children: [
843
778
  /* @__PURE__ */ e(
844
- N,
779
+ M,
845
780
  {
846
781
  ariaLabelClose: i.close_aria,
847
- isOpen: S,
848
- onClose: E,
849
- onPrimaryAction: () => g(!0),
850
- onSecondaryAction: () => y(!0),
782
+ isOpen: m,
783
+ onClose: O,
784
+ onPrimaryAction: () => u(!0),
785
+ onSecondaryAction: () => f(!0),
851
786
  primaryText: o.details_edit_button,
852
787
  secondaryColor: "error",
853
788
  secondaryText: o.details_delete_button,
854
789
  title: o.details_title,
855
- children: /* @__PURE__ */ e(Et, { budget: n })
790
+ children: /* @__PURE__ */ e(wt, { budget: n })
856
791
  }
857
792
  ),
858
793
  /* @__PURE__ */ e(
859
- j,
794
+ N,
860
795
  {
861
796
  copy: { close_aria: i.close_aria, title: o.details_edit_title },
862
- disablePrimaryButton: Number(v) <= 0,
863
- isOpen: p,
864
- onClose: () => g(!1),
865
- onPrimaryAction: x,
797
+ disablePrimaryButton: Number(A) <= 0,
798
+ isOpen: _,
799
+ onClose: () => u(!1),
800
+ onPrimaryAction: v,
866
801
  primaryText: o.edit_save_button,
867
802
  children: /* @__PURE__ */ e(
868
803
  re,
869
804
  {
870
- amount: v,
805
+ amount: A,
871
806
  categoryName: n.category.name,
872
- onAmountChanged: A
807
+ onAmountChanged: x
873
808
  }
874
809
  )
875
810
  }
876
811
  ),
877
812
  /* @__PURE__ */ e(
878
- j,
813
+ N,
879
814
  {
880
815
  copy: { close_aria: i.close_aria, title: o.delete_title },
881
- isOpen: h,
882
- onClose: () => y(!1),
883
- onPrimaryAction: C,
816
+ isOpen: B,
817
+ onClose: () => f(!1),
818
+ onPrimaryAction: S,
884
819
  primaryColor: "error",
885
820
  primaryText: o.details_delete_button,
886
821
  secondaryColor: "secondary",
887
- children: /* @__PURE__ */ e(f, { variant: "Paragraph", children: R(o.delete_description, n.category.name) })
822
+ children: /* @__PURE__ */ e(p, { variant: "Paragraph", children: L(o.delete_description, n.category.name) })
888
823
  }
889
824
  )
890
825
  ] });
891
- }), Mt = ({ budget: t, onClick: o }) => {
826
+ }), It = ({ budget: t, onClick: o }) => {
892
827
  const {
893
828
  amount: i,
894
- budgetColors: { background: r, description: s },
829
+ budgetColors: { background: s, description: a },
895
830
  category_guid: n,
896
- description: a,
831
+ description: r,
897
832
  percentage: c,
898
- subBudgets: _,
899
- transaction_total: d
833
+ subBudgets: y,
834
+ transaction_total: g
900
835
  } = t;
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" }) }) }),
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" }) }) }),
903
838
  /* @__PURE__ */ e(
904
- Y,
839
+ Z,
905
840
  {
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")} /
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")} /
910
845
  ${T(i, "0,0")}
911
846
  ` })
912
847
  ] }),
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 })
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 })
916
851
  ] })
917
852
  }
918
853
  )
919
854
  ] }) });
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, {
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, {
923
858
  budget_category: n.category.name,
924
859
  click_type: "list"
925
860
  });
926
861
  };
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 }),
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 }),
931
866
  /* @__PURE__ */ e(oe, {})
932
867
  ] }, n.guid)) }) })
933
868
  ] });
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 = [
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 = [
942
877
  {
943
- color: E,
944
- percentage: `${C}`
878
+ color: O,
879
+ percentage: `${S}`
945
880
  }
946
881
  ];
947
- return [x, M];
948
- }, [_, c]), [y, v] = l.useMemo(() => {
949
- const x = Math.abs(
950
- a.reduce((M, k) => M + k.totalAmount, 0)
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)
951
886
  );
952
- let C = x / m;
953
- C > 1 && (C = 1);
954
- const E = [
887
+ let S = v / h;
888
+ S > 1 && (S = 1);
889
+ const O = [
955
890
  {
956
891
  color: t.palette.secondary.main,
957
- percentage: `${C}`
892
+ percentage: `${S}`
958
893
  }
959
894
  ];
960
- return [x, E];
961
- }, [a, m]), A = () => {
962
- S({
963
- accounts: i.map((x) => x.guid),
895
+ return [v, O];
896
+ }, [r, h]), x = () => {
897
+ m({
898
+ accounts: i.map((v) => v.guid),
964
899
  dateRange: {
965
- start: ot(/* @__PURE__ */ new Date(), 90),
900
+ start: tt(/* @__PURE__ */ new Date(), 90),
966
901
  end: /* @__PURE__ */ new Date()
967
902
  }
968
- }), p(!0), o(L.BUDGETS_CLICK_EDIT_INCOME);
903
+ }), _(!0), o(k.BUDGETS_CLICK_EDIT_INCOME);
969
904
  };
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")
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")
980
915
  ) })
981
916
  ] }),
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 }),
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 }),
985
920
  /* @__PURE__ */ e(
986
- at,
921
+ nt,
987
922
  {
988
923
  "aria-label": n.manage_income,
989
- onClick: A,
924
+ onClick: x,
990
925
  sx: { p: 0 },
991
- children: /* @__PURE__ */ e(P, { color: "primary", name: "edit" })
926
+ children: /* @__PURE__ */ e($, { color: "primary", name: "edit" })
992
927
  }
993
928
  )
994
929
  ] }),
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")
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")
1000
935
  ) })
1001
936
  ] })
1002
937
  ] }) }),
1003
938
  /* @__PURE__ */ e(
1004
- N,
939
+ M,
1005
940
  {
1006
- ariaLabelClose: s.close_aria,
1007
- isOpen: b,
1008
- onClose: () => p(!1),
941
+ ariaLabelClose: a.close_aria,
942
+ isOpen: C,
943
+ onClose: () => _(!1),
1009
944
  title: n.manage_income,
1010
- children: /* @__PURE__ */ e(rt, { forOverview: !0 })
945
+ children: /* @__PURE__ */ e(ot, { forOverview: !0 })
1011
946
  }
1012
947
  )
1013
948
  ] });
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()) });
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()) });
1027
962
  }), []), l.useEffect(() => {
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() });
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);
1034
973
  }, ke = () => {
1035
- r(L.BUDGETS_CLICK_FILTER);
1036
- }, _e = () => {
1037
- ie(!0), r(L.BUDGETS_CLICK_ADD);
1038
- }, Pe = () => {
1039
974
  ie(!1);
1040
- }, $e = Ye(p.end, q(/* @__PURE__ */ new Date()));
1041
- return !c || !_ || !g ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ u(
1042
- He,
975
+ }, Me = Ke(_.end, J(/* @__PURE__ */ new Date()));
976
+ return !c || !y || !u ? /* @__PURE__ */ e(P, {}) : /* @__PURE__ */ d(
977
+ Fe,
1043
978
  {
1044
- accountOptions: s,
979
+ accountOptions: a,
1045
980
  actions: [
1046
981
  {
1047
982
  iconName: "add",
1048
983
  label: n.add_title,
1049
- onClick: _e
984
+ onClick: he
1050
985
  }
1051
986
  ],
1052
987
  calendarActions: {
1053
- onRangeChanged: Ne,
1054
- shouldDisableNext: $e,
988
+ onRangeChanged: Le,
989
+ shouldDisableNext: Me,
1055
990
  shouldDisablePicker: !0
1056
991
  },
1057
- onAccountsFilterClick: ke,
992
+ onAccountsFilterClick: Re,
1058
993
  onBackClick: t,
1059
994
  sx: o,
1060
995
  title: n.budgets_title,
1061
996
  children: [
1062
- (!_ || !g) && /* @__PURE__ */ e(G, {}),
1063
- _ && g && /* @__PURE__ */ u(
1064
- B,
997
+ (!y || !u) && /* @__PURE__ */ e(P, {}),
998
+ y && u && /* @__PURE__ */ d(
999
+ b,
1065
1000
  {
1066
- direction: z ? "column" : "row",
1001
+ direction: U ? "column" : "row",
1067
1002
  height: "100%",
1068
1003
  sx: { justifyContent: "center" },
1069
1004
  width: "100%",
1070
1005
  children: [
1071
- /* @__PURE__ */ e(B, { height: z ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1072
- Ee,
1006
+ /* @__PURE__ */ e(b, { height: U ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
1007
+ we,
1073
1008
  {
1074
- createBudgetOnClick: _e,
1075
- height: z ? 450 : 800,
1009
+ createBudgetOnClick: he,
1010
+ height: U ? 450 : 800,
1076
1011
  isDraggable: !0,
1077
- shouldShowZeroState: x.length === 0,
1078
- unavailableWidth: z ? 0 : Be
1012
+ shouldShowZeroState: v.length === 0,
1013
+ unavailableWidth: U ? 0 : Ce
1079
1014
  }
1080
1015
  ) }),
1081
- x.length !== 0 && /* @__PURE__ */ u(
1082
- B,
1016
+ v.length !== 0 && /* @__PURE__ */ d(
1017
+ b,
1083
1018
  {
1084
1019
  gap: 24,
1085
1020
  height: "100%",
1086
1021
  sx: { mr: 24, mt: 48 },
1087
- width: z ? "100%" : Be,
1022
+ width: U ? "100%" : Ce,
1088
1023
  children: [
1089
- /* @__PURE__ */ e(Lt, {}),
1090
- /* @__PURE__ */ e(Rt, {})
1024
+ /* @__PURE__ */ e(Ot, {}),
1025
+ /* @__PURE__ */ e(Et, {})
1091
1026
  ]
1092
1027
  }
1093
1028
  )
1094
1029
  ]
1095
1030
  }
1096
1031
  ),
1097
- /* @__PURE__ */ e(Ot, {}),
1032
+ /* @__PURE__ */ e(Dt, {}),
1098
1033
  /* @__PURE__ */ e(
1099
- N,
1034
+ M,
1100
1035
  {
1101
- ariaLabelClose: a.close_aria,
1102
- isOpen: Le,
1036
+ ariaLabelClose: r.close_aria,
1037
+ isOpen: Oe,
1103
1038
  onClose: () => ie(!1),
1104
1039
  title: n.add_new_title,
1105
- children: /* @__PURE__ */ e(Oe, { onRecalculateBudgets: Pe })
1040
+ children: /* @__PURE__ */ e(De, { onRecalculateBudgets: ke })
1106
1041
  }
1107
1042
  ),
1108
1043
  /* @__PURE__ */ e(
1109
- qe,
1044
+ Ye,
1110
1045
  {
1111
1046
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
1112
1047
  autoHideDuration: 3500,
1113
1048
  onClose: () => {
1114
- v("");
1049
+ A("");
1115
1050
  },
1116
- open: !!b,
1051
+ open: !!C,
1117
1052
  children: /* @__PURE__ */ e(
1118
- Ze,
1053
+ Ve,
1119
1054
  {
1120
1055
  onClose: () => {
1121
- v("");
1056
+ A("");
1122
1057
  },
1123
1058
  severity: "success",
1124
1059
  variant: "filled",
1125
- children: b
1060
+ children: C
1126
1061
  }
1127
1062
  )
1128
1063
  }
@@ -1132,6 +1067,6 @@ const yt = ({
1132
1067
  );
1133
1068
  });
1134
1069
  export {
1135
- En as BubbleBudgetsMiniWidget,
1136
- On as BubbleBudgetsWidget
1070
+ wn as BubbleBudgetsMiniWidget,
1071
+ Dn as BubbleBudgetsWidget
1137
1072
  };