@burdenoff/microfe-brainyrich 2026.705.1 → 2026.706.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/brainyrich/BrainyRichRoot.js +13 -13
  2. package/dist/brainyrich/components/ActorName.js +38 -0
  3. package/dist/brainyrich/components/ActorName.js.map +1 -0
  4. package/dist/brainyrich/components/ConfirmDialog.js +25 -0
  5. package/dist/brainyrich/components/ConfirmDialog.js.map +1 -0
  6. package/dist/brainyrich/components/LoadMore.js +24 -0
  7. package/dist/brainyrich/components/LoadMore.js.map +1 -0
  8. package/dist/brainyrich/components/index.js +5 -0
  9. package/dist/brainyrich/components/notify.js +38 -0
  10. package/dist/brainyrich/components/notify.js.map +1 -0
  11. package/dist/brainyrich/components/pickers.js +232 -0
  12. package/dist/brainyrich/components/pickers.js.map +1 -0
  13. package/dist/brainyrich/components/reuse/CommentThread.js +208 -0
  14. package/dist/brainyrich/components/reuse/CommentThread.js.map +1 -0
  15. package/dist/brainyrich/components/reuse/DocumentsPanel.js +237 -0
  16. package/dist/brainyrich/components/reuse/DocumentsPanel.js.map +1 -0
  17. package/dist/brainyrich/components/reuse/TagField.js +206 -0
  18. package/dist/brainyrich/components/reuse/TagField.js.map +1 -0
  19. package/dist/brainyrich/components/reuse/transport.js +24 -0
  20. package/dist/brainyrich/components/reuse/transport.js.map +1 -0
  21. package/dist/brainyrich/hooks/useBrainyRichApi.js +644 -372
  22. package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -1
  23. package/dist/brainyrich/pages/AccountsPage.js +346 -293
  24. package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
  25. package/dist/brainyrich/pages/AiAssistantPage.js +339 -320
  26. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  27. package/dist/brainyrich/pages/AnalyticsPage.js +178 -164
  28. package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
  29. package/dist/brainyrich/pages/DashboardPage.js +195 -169
  30. package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
  31. package/dist/brainyrich/pages/FamilyPage.js +247 -198
  32. package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
  33. package/dist/brainyrich/pages/GoalsPage.js +478 -442
  34. package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
  35. package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
  36. package/dist/brainyrich/pages/PortfoliosPage.js +438 -396
  37. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  38. package/dist/brainyrich/pages/ReportsPage.js +246 -213
  39. package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
  40. package/dist/brainyrich/pages/RiskPage.js +321 -173
  41. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  42. package/dist/brainyrich/pages/TaxPage.js +258 -225
  43. package/dist/brainyrich/pages/TaxPage.js.map +1 -1
  44. package/dist/brainyrich/pages/_shared.js.map +1 -1
  45. package/dist/node_modules/sonner/dist/index.js +163 -0
  46. package/dist/node_modules/sonner/dist/index.js.map +1 -0
  47. package/package.json +3 -2
@@ -1,13 +1,17 @@
1
1
  import { tWithFallback as e } from "../utils/i18n.js";
2
- import { useAccounts as t, useArchiveGoal as n, useCreateGoal as r, useGoal as i, useGoalFundings as a, useGoals as o, useHouseholds as s, useLinkGoalFunding as c, useRecalcGoalProjection as l, useUnlinkGoalFunding as u, useUpdateGoal as ee } from "../hooks/useBrainyRichApi.js";
3
- import { EmptyState as d, ErrorState as f, KpiGrid as te, LoadingState as ne, SectionShell as p, formatDate as re, formatMoney as m, statusBadgeVariant as h } from "./_shared.js";
2
+ import { useAccounts as t, useArchiveGoal as n, useCreateGoal as r, useGoal as i, useGoalFundings as a, useHouseholds as o, useLinkGoalFunding as s, usePagedGoals as c, useRecalcGoalProjection as l, useUnlinkGoalFunding as u, useUpdateGoal as ee } from "../hooks/useBrainyRichApi.js";
3
+ import { LoadMore as te } from "../components/LoadMore.js";
4
+ import { ConfirmDialog as ne } from "../components/ConfirmDialog.js";
5
+ import "../components/index.js";
6
+ import { EmptyState as re, ErrorState as ie, KpiGrid as d, LoadingState as ae, SectionShell as f, formatDate as oe, formatMoney as p, statusBadgeVariant as m } from "./_shared.js";
7
+ import { TagField as h } from "../components/reuse/TagField.js";
4
8
  import { useMemo as g, useState as _ } from "react";
5
- import { AlertTriangle as v, CalendarClock as y, Link2 as ie, MoreHorizontal as b, Plus as x, RefreshCw as ae, Target as S, Trash2 as C, TrendingDown as w, TrendingUp as T, Unlink as E } from "lucide-react";
6
- import { useI18n as D } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
- import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
8
- import { Badge as j, Button as M, Card as N, CardContent as P, CardDescription as F, CardHeader as oe, CardTitle as I, Dialog as L, DialogContent as R, DialogDescription as z, DialogFooter as B, DialogHeader as se, DialogTitle as V, DropdownMenu as ce, DropdownMenuContent as le, DropdownMenuItem as H, DropdownMenuSeparator as ue, DropdownMenuTrigger as de, Input as U, Label as W, Select as G, SelectContent as K, SelectItem as q, SelectTrigger as J, SelectValue as Y, Sheet as X, SheetContent as fe, SheetDescription as pe, SheetHeader as me, SheetTitle as he, Textarea as ge } from "@burdenoff/fe-libs/ui";
9
+ import { AlertTriangle as v, CalendarClock as y, Link2 as se, MoreHorizontal as b, Plus as ce, RefreshCw as le, Target as x, Trash2 as S, TrendingDown as C, TrendingUp as w, Unlink as ue } from "lucide-react";
10
+ import { useI18n as de } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
11
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
12
+ import { Badge as O, Button as k, Card as A, CardContent as j, CardDescription as M, CardHeader as N, CardTitle as fe, Dialog as P, DialogContent as F, DialogDescription as I, DialogFooter as L, DialogHeader as R, DialogTitle as z, DropdownMenu as pe, DropdownMenuContent as me, DropdownMenuItem as B, DropdownMenuSeparator as he, DropdownMenuTrigger as ge, Input as V, Label as H, Select as U, SelectContent as W, SelectItem as G, SelectTrigger as K, SelectValue as q, Sheet as J, SheetContent as Y, SheetDescription as X, SheetHeader as _e, SheetTitle as Z, Textarea as ve } from "@burdenoff/fe-libs/ui";
9
13
  //#region src/brainyrich/pages/GoalsPage.tsx
10
- var _e = [
14
+ var ye = [
11
15
  "RETIREMENT",
12
16
  "EDUCATION",
13
17
  "HOME",
@@ -15,21 +19,21 @@ var _e = [
15
19
  "MAJOR_PURCHASE",
16
20
  "WEALTH_GROWTH",
17
21
  "CUSTOM"
18
- ], ve = [
22
+ ], be = [
19
23
  "ACTIVE",
20
24
  "ACHIEVED",
21
25
  "ON_HOLD",
22
26
  "ABANDONED"
23
27
  ];
24
- function ye(e) {
28
+ function xe(e) {
25
29
  switch (e) {
26
30
  case "AHEAD":
27
31
  case "ON_TRACK": return {
28
- icon: T,
32
+ icon: w,
29
33
  tone: "text-status-success-text"
30
34
  };
31
35
  case "BEHIND": return {
32
- icon: w,
36
+ icon: C,
33
37
  tone: "text-status-warning-text"
34
38
  };
35
39
  default: return {
@@ -38,15 +42,15 @@ function ye(e) {
38
42
  };
39
43
  }
40
44
  }
41
- function Z(e) {
45
+ function Q(e) {
42
46
  return e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
43
47
  }
44
- function be(e) {
48
+ function Se(e) {
45
49
  if (!e) return "";
46
50
  let t = new Date(e);
47
51
  return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
48
52
  }
49
- function xe() {
53
+ function Ce() {
50
54
  return {
51
55
  name: "",
52
56
  type: "CUSTOM",
@@ -57,590 +61,608 @@ function xe() {
57
61
  priority: "1",
58
62
  currency: "USD",
59
63
  householdId: "",
60
- notes: "",
61
- tags: ""
64
+ notes: ""
62
65
  };
63
66
  }
64
- function Se(e) {
67
+ function we(e) {
65
68
  return {
66
69
  name: e.name,
67
70
  type: e.type,
68
71
  status: e.status,
69
72
  targetAmount: String(e.targetAmount),
70
- targetDate: be(e.targetDate),
73
+ targetDate: Se(e.targetDate),
71
74
  monthlyContribution: String(e.monthlyContribution),
72
75
  priority: String(e.priority),
73
76
  currency: e.currency,
74
77
  householdId: e.householdId ?? "",
75
- notes: e.notes ?? "",
76
- tags: e.tags.join(", ")
78
+ notes: e.notes ?? ""
77
79
  };
78
80
  }
79
- function Ce(e) {
80
- return e.split(",").map((e) => e.trim()).filter(Boolean);
81
- }
82
- var Q = "__none__";
83
- function we() {
84
- let { t } = D(), i = (n, r, i) => e(t, n, r, i), { data: a, isLoading: c, isError: l, refetch: u } = o(), { data: v } = s(), w = r(), T = ee(), E = n(), [L, R] = _(!1), [z, B] = _(null), [se, V] = _(null), [U, W] = _(xe), G = (e, t) => W((n) => ({
81
+ var Te = "__none__";
82
+ function Ee() {
83
+ let { t } = de(), i = (n, r, i) => e(t, n, r, i), { items: a, hasMore: s, loadMore: l, isFetchingNextPage: u, isLoading: h, isError: v, refetch: C } = c(), { data: w } = o(), ue = r(), P = ee(), F = n(), [I, L] = _(!1), [R, z] = _(null), [V, H] = _(null), [U, W] = _(null), [G, K] = _(Ce), q = (e, t) => K((n) => ({
85
84
  ...n,
86
85
  [e]: t
87
- })), K = g(() => ({
86
+ })), J = g(() => ({
88
87
  totalTarget: a.reduce((e, t) => e + t.targetAmount, 0),
89
88
  totalMonthly: a.reduce((e, t) => e + t.monthlyContribution, 0),
90
89
  atRisk: a.filter((e) => e.projection === "AT_RISK" || e.projection === "BEHIND").length
91
- }), [a]), q = a[0]?.currency ?? "USD", J = () => {
92
- W(xe()), R(!0);
93
- }, Y = (e) => {
94
- W(Se(e)), B(e);
95
- }, X = U.name.trim().length > 0 && Number(U.targetAmount) > 0 && U.targetDate.length > 0;
96
- return /* @__PURE__ */ A(O, { children: [
97
- /* @__PURE__ */ k(p, {
90
+ }), [a]), Y = a[0]?.currency ?? "USD", X = () => {
91
+ K(Ce()), L(!0);
92
+ }, _e = (e) => {
93
+ K(we(e)), z(e);
94
+ }, Z = G.name.trim().length > 0 && Number(G.targetAmount) > 0 && G.targetDate.length > 0;
95
+ return /* @__PURE__ */ D(T, { children: [
96
+ /* @__PURE__ */ E(f, {
98
97
  title: i("brainyrich.goals.title", "Financial Goals"),
99
98
  description: i("brainyrich.goals.description", "Track progress toward your wealth milestones and life objectives"),
100
99
  actionLabel: i("brainyrich.goals.actions.createGoal", "New goal"),
101
- onAction: J,
102
- children: c ? /* @__PURE__ */ k(ne, { rows: 4 }) : l ? /* @__PURE__ */ k(f, {
100
+ onAction: X,
101
+ children: h ? /* @__PURE__ */ E(ae, { rows: 4 }) : v ? /* @__PURE__ */ E(ie, {
103
102
  title: i("brainyrich.goals.error.title", "Could not load goals"),
104
103
  description: i("brainyrich.goals.error.description", "We could not reach the goals service. Please try again."),
105
- onRetry: () => u()
106
- }) : a.length === 0 ? /* @__PURE__ */ k(d, {
107
- icon: /* @__PURE__ */ k(S, {
104
+ onRetry: () => C()
105
+ }) : a.length === 0 ? /* @__PURE__ */ E(re, {
106
+ icon: /* @__PURE__ */ E(x, {
108
107
  className: "size-6",
109
108
  "aria-hidden": "true"
110
109
  }),
111
110
  title: i("brainyrich.goals.empty.title", "No financial goals yet"),
112
111
  description: i("brainyrich.goals.empty.description", "Create your first goal to start tracking progress toward a milestone."),
113
- action: /* @__PURE__ */ A(M, {
112
+ action: /* @__PURE__ */ D(k, {
114
113
  size: "sm",
115
- onClick: J,
116
- children: [/* @__PURE__ */ k(x, {
114
+ onClick: X,
115
+ children: [/* @__PURE__ */ E(ce, {
117
116
  className: "size-4",
118
117
  "aria-hidden": "true"
119
118
  }), i("brainyrich.goals.actions.createGoal", "New goal")]
120
119
  })
121
- }) : /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(te, { items: [
122
- {
123
- label: i("brainyrich.goals.metrics.activeGoals", "Goals"),
124
- value: String(a.length),
125
- trend: i("brainyrich.goals.metrics.activeGoalsTrend", "Being tracked")
126
- },
127
- {
128
- label: i("brainyrich.goals.metrics.totalTarget", "Total target"),
129
- value: m(K.totalTarget, q)
130
- },
131
- {
132
- label: i("brainyrich.goals.metrics.monthly", "Monthly contributions"),
133
- value: m(K.totalMonthly, q),
134
- trend: i("brainyrich.goals.metrics.monthlyTrend", "Across all goals")
135
- },
136
- {
137
- label: i("brainyrich.goals.metrics.atRisk", "Needs attention"),
138
- value: String(K.atRisk),
139
- trend: i("brainyrich.goals.metrics.atRiskTrend", "Behind or at risk"),
140
- deltaTone: K.atRisk > 0 ? "negative" : "positive"
141
- }
142
- ] }), /* @__PURE__ */ k("div", {
143
- className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
144
- children: a.map((e) => {
145
- let t = ye(e.projection), n = t.icon;
146
- return /* @__PURE__ */ A(N, {
147
- className: "flex flex-col",
148
- children: [/* @__PURE__ */ k(oe, {
149
- className: "pb-3",
150
- children: /* @__PURE__ */ A("div", {
151
- className: "flex items-start justify-between gap-2",
152
- children: [/* @__PURE__ */ A("div", {
153
- className: "min-w-0",
154
- children: [/* @__PURE__ */ A(I, {
155
- className: "flex items-center gap-2 text-base",
156
- children: [/* @__PURE__ */ k(S, {
157
- className: "size-4 shrink-0 text-text-secondary",
158
- "aria-hidden": "true"
159
- }), /* @__PURE__ */ k("span", {
160
- className: "truncate",
161
- children: e.name
162
- })]
163
- }), /* @__PURE__ */ A(F, {
164
- className: "mt-1 flex flex-wrap items-center gap-2",
165
- children: [/* @__PURE__ */ k(j, {
166
- variant: "outline",
167
- children: Z(e.type)
168
- }), /* @__PURE__ */ k(j, {
169
- variant: h(e.status),
170
- children: Z(e.status)
120
+ }) : /* @__PURE__ */ D(T, { children: [
121
+ /* @__PURE__ */ E(d, { items: [
122
+ {
123
+ label: i("brainyrich.goals.metrics.activeGoals", "Goals"),
124
+ value: String(a.length),
125
+ trend: i("brainyrich.goals.metrics.activeGoalsTrend", "Being tracked")
126
+ },
127
+ {
128
+ label: i("brainyrich.goals.metrics.totalTarget", "Total target"),
129
+ value: p(J.totalTarget, Y)
130
+ },
131
+ {
132
+ label: i("brainyrich.goals.metrics.monthly", "Monthly contributions"),
133
+ value: p(J.totalMonthly, Y),
134
+ trend: i("brainyrich.goals.metrics.monthlyTrend", "Across all goals")
135
+ },
136
+ {
137
+ label: i("brainyrich.goals.metrics.atRisk", "Needs attention"),
138
+ value: String(J.atRisk),
139
+ trend: i("brainyrich.goals.metrics.atRiskTrend", "Behind or at risk"),
140
+ deltaTone: J.atRisk > 0 ? "negative" : "positive"
141
+ }
142
+ ] }),
143
+ /* @__PURE__ */ E("div", {
144
+ className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
145
+ children: a.map((e) => {
146
+ let t = xe(e.projection), n = t.icon;
147
+ return /* @__PURE__ */ D(A, {
148
+ className: "flex flex-col",
149
+ children: [/* @__PURE__ */ E(N, {
150
+ className: "pb-3",
151
+ children: /* @__PURE__ */ D("div", {
152
+ className: "flex items-start justify-between gap-2",
153
+ children: [/* @__PURE__ */ D("div", {
154
+ className: "min-w-0",
155
+ children: [/* @__PURE__ */ D(fe, {
156
+ className: "flex items-center gap-2 text-base",
157
+ children: [/* @__PURE__ */ E(x, {
158
+ className: "size-4 shrink-0 text-text-secondary",
159
+ "aria-hidden": "true"
160
+ }), /* @__PURE__ */ E("span", {
161
+ className: "truncate",
162
+ children: e.name
163
+ })]
164
+ }), /* @__PURE__ */ D(M, {
165
+ className: "mt-1 flex flex-wrap items-center gap-2",
166
+ children: [/* @__PURE__ */ E(O, {
167
+ variant: "outline",
168
+ children: Q(e.type)
169
+ }), /* @__PURE__ */ E(O, {
170
+ variant: m(e.status),
171
+ children: Q(e.status)
172
+ })]
171
173
  })]
172
- })]
173
- }), /* @__PURE__ */ A(ce, { children: [/* @__PURE__ */ k(de, {
174
- asChild: !0,
175
- children: /* @__PURE__ */ k(M, {
176
- variant: "ghost",
177
- size: "icon",
178
- "aria-label": i("brainyrich.goals.actions.menu", "Goal actions"),
179
- children: /* @__PURE__ */ k(b, {
180
- className: "size-4",
181
- "aria-hidden": "true"
182
- })
183
- })
184
- }), /* @__PURE__ */ A(le, {
185
- align: "end",
186
- children: [
187
- /* @__PURE__ */ A(H, {
188
- onSelect: () => V(e.id),
189
- children: [/* @__PURE__ */ k(ie, {
174
+ }), /* @__PURE__ */ D(pe, { children: [/* @__PURE__ */ E(ge, {
175
+ asChild: !0,
176
+ children: /* @__PURE__ */ E(k, {
177
+ variant: "ghost",
178
+ size: "icon",
179
+ "aria-label": i("brainyrich.goals.actions.menu", "Goal actions"),
180
+ children: /* @__PURE__ */ E(b, {
190
181
  className: "size-4",
191
182
  "aria-hidden": "true"
192
- }), i("brainyrich.goals.actions.manageFunding", "Manage funding")]
183
+ })
184
+ })
185
+ }), /* @__PURE__ */ D(me, {
186
+ align: "end",
187
+ children: [
188
+ /* @__PURE__ */ D(B, {
189
+ onSelect: () => H(e.id),
190
+ children: [/* @__PURE__ */ E(se, {
191
+ className: "size-4",
192
+ "aria-hidden": "true"
193
+ }), i("brainyrich.goals.actions.manageFunding", "Manage funding")]
194
+ }),
195
+ /* @__PURE__ */ D(B, {
196
+ onSelect: () => _e(e),
197
+ children: [/* @__PURE__ */ E(le, {
198
+ className: "size-4",
199
+ "aria-hidden": "true"
200
+ }), i("brainyrich.goals.actions.editGoal", "Edit goal")]
201
+ }),
202
+ /* @__PURE__ */ E(he, {}),
203
+ /* @__PURE__ */ D(B, {
204
+ className: "text-status-error-text focus:text-status-error-text",
205
+ onSelect: () => W(e),
206
+ children: [/* @__PURE__ */ E(S, {
207
+ className: "size-4",
208
+ "aria-hidden": "true"
209
+ }), i("brainyrich.goals.actions.archive", "Archive goal")]
210
+ })
211
+ ]
212
+ })] })]
213
+ })
214
+ }), /* @__PURE__ */ D(j, {
215
+ className: "flex flex-1 flex-col gap-4",
216
+ children: [
217
+ /* @__PURE__ */ D("div", { children: [
218
+ /* @__PURE__ */ E("p", {
219
+ className: "text-xs text-text-secondary",
220
+ children: i("brainyrich.goals.card.target", "Target amount")
193
221
  }),
194
- /* @__PURE__ */ A(H, {
195
- onSelect: () => Y(e),
196
- children: [/* @__PURE__ */ k(ae, {
197
- className: "size-4",
198
- "aria-hidden": "true"
199
- }), i("brainyrich.goals.actions.editGoal", "Edit goal")]
222
+ /* @__PURE__ */ E("p", {
223
+ className: "text-2xl font-semibold text-text-primary",
224
+ children: p(e.targetAmount, e.currency)
200
225
  }),
201
- /* @__PURE__ */ k(ue, {}),
202
- /* @__PURE__ */ A(H, {
203
- className: "text-status-error-text focus:text-status-error-text",
204
- disabled: E.isPending,
205
- onSelect: () => E.mutate(e.id),
206
- children: [/* @__PURE__ */ k(C, {
207
- className: "size-4",
226
+ /* @__PURE__ */ D("span", {
227
+ className: `mt-1 inline-flex items-center gap-1 text-xs font-medium ${t.tone}`,
228
+ children: [/* @__PURE__ */ E(n, {
229
+ className: "size-3.5",
208
230
  "aria-hidden": "true"
209
- }), i("brainyrich.goals.actions.archive", "Archive goal")]
231
+ }), Q(e.projection)]
210
232
  })
211
- ]
212
- })] })]
213
- })
214
- }), /* @__PURE__ */ A(P, {
215
- className: "flex flex-1 flex-col gap-4",
216
- children: [
217
- /* @__PURE__ */ A("div", { children: [
218
- /* @__PURE__ */ k("p", {
219
- className: "text-xs text-text-secondary",
220
- children: i("brainyrich.goals.card.target", "Target amount")
221
- }),
222
- /* @__PURE__ */ k("p", {
223
- className: "text-2xl font-semibold text-text-primary",
224
- children: m(e.targetAmount, e.currency)
233
+ ] }),
234
+ /* @__PURE__ */ D("dl", {
235
+ className: "grid grid-cols-2 gap-3 rounded-lg bg-bg-sunken p-3 text-sm",
236
+ children: [
237
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
238
+ className: "text-xs text-text-secondary",
239
+ children: i("brainyrich.goals.card.targetDate", "Target date")
240
+ }), /* @__PURE__ */ D("dd", {
241
+ className: "flex items-center gap-1 font-medium text-text-primary",
242
+ children: [/* @__PURE__ */ E(y, {
243
+ className: "size-3.5 text-text-secondary",
244
+ "aria-hidden": "true"
245
+ }), oe(e.targetDate)]
246
+ })] }),
247
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
248
+ className: "text-xs text-text-secondary",
249
+ children: i("brainyrich.goals.card.monthly", "Monthly")
250
+ }), /* @__PURE__ */ E("dd", {
251
+ className: "font-medium text-text-primary",
252
+ children: p(e.monthlyContribution, e.currency)
253
+ })] }),
254
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
255
+ className: "text-xs text-text-secondary",
256
+ children: i("brainyrich.goals.card.priority", "Priority")
257
+ }), /* @__PURE__ */ E("dd", {
258
+ className: "font-medium text-text-primary",
259
+ children: e.priority
260
+ })] }),
261
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
262
+ className: "text-xs text-text-secondary",
263
+ children: i("brainyrich.goals.card.fundings", "Funding links")
264
+ }), /* @__PURE__ */ E("dd", {
265
+ className: "font-medium text-text-primary",
266
+ children: e.fundings.length
267
+ })] })
268
+ ]
225
269
  }),
226
- /* @__PURE__ */ A("span", {
227
- className: `mt-1 inline-flex items-center gap-1 text-xs font-medium ${t.tone}`,
228
- children: [/* @__PURE__ */ k(n, {
229
- className: "size-3.5",
230
- "aria-hidden": "true"
231
- }), Z(e.projection)]
232
- })
233
- ] }),
234
- /* @__PURE__ */ A("dl", {
235
- className: "grid grid-cols-2 gap-3 rounded-lg bg-bg-sunken p-3 text-sm",
236
- children: [
237
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
238
- className: "text-xs text-text-secondary",
239
- children: i("brainyrich.goals.card.targetDate", "Target date")
240
- }), /* @__PURE__ */ A("dd", {
241
- className: "flex items-center gap-1 font-medium text-text-primary",
242
- children: [/* @__PURE__ */ k(y, {
243
- className: "size-3.5 text-text-secondary",
244
- "aria-hidden": "true"
245
- }), re(e.targetDate)]
246
- })] }),
247
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
248
- className: "text-xs text-text-secondary",
249
- children: i("brainyrich.goals.card.monthly", "Monthly")
250
- }), /* @__PURE__ */ k("dd", {
251
- className: "font-medium text-text-primary",
252
- children: m(e.monthlyContribution, e.currency)
253
- })] }),
254
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
255
- className: "text-xs text-text-secondary",
256
- children: i("brainyrich.goals.card.priority", "Priority")
257
- }), /* @__PURE__ */ k("dd", {
258
- className: "font-medium text-text-primary",
259
- children: e.priority
260
- })] }),
261
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
262
- className: "text-xs text-text-secondary",
263
- children: i("brainyrich.goals.card.fundings", "Funding links")
264
- }), /* @__PURE__ */ k("dd", {
265
- className: "font-medium text-text-primary",
266
- children: e.fundings.length
267
- })] })
268
- ]
269
- }),
270
- /* @__PURE__ */ k("div", {
271
- className: "mt-auto",
272
- children: /* @__PURE__ */ k(M, {
273
- variant: "outline",
274
- size: "sm",
275
- className: "w-full",
276
- onClick: () => V(e.id),
277
- children: i("brainyrich.goals.actions.viewDetails", "View details & funding")
270
+ /* @__PURE__ */ E("div", {
271
+ className: "mt-auto",
272
+ children: /* @__PURE__ */ E(k, {
273
+ variant: "outline",
274
+ size: "sm",
275
+ className: "w-full",
276
+ onClick: () => H(e.id),
277
+ children: i("brainyrich.goals.actions.viewDetails", "View details & funding")
278
+ })
278
279
  })
279
- })
280
- ]
281
- })]
282
- }, e.id);
280
+ ]
281
+ })]
282
+ }, e.id);
283
+ })
284
+ }),
285
+ /* @__PURE__ */ E(te, {
286
+ hasMore: s,
287
+ loading: u,
288
+ onClick: l,
289
+ label: i("brainyrich.goals.actions.loadMore", "Load more goals"),
290
+ loadingLabel: i("brainyrich.goals.actions.loadingMore", "Loading…")
283
291
  })
284
- })] })
292
+ ] })
285
293
  }),
286
- /* @__PURE__ */ k(Te, {
287
- open: L,
294
+ /* @__PURE__ */ E(De, {
295
+ open: I,
288
296
  mode: "create",
289
- form: U,
290
- setField: G,
291
- households: v.map((e) => ({
297
+ form: G,
298
+ setField: q,
299
+ households: w.map((e) => ({
292
300
  id: e.id,
293
301
  name: e.name
294
302
  })),
295
- valid: X,
296
- pending: w.isPending,
303
+ valid: Z,
304
+ pending: ue.isPending,
297
305
  onSubmit: () => {
298
- if (!X) return;
306
+ if (!Z) return;
299
307
  let e = {
300
- name: U.name.trim(),
301
- type: U.type,
302
- targetAmount: Number(U.targetAmount),
303
- targetDate: new Date(U.targetDate).toISOString(),
304
- monthlyContribution: Number(U.monthlyContribution) || 0,
305
- priority: Number(U.priority) || 1,
306
- currency: U.currency.trim() || "USD",
307
- notes: U.notes.trim() || null,
308
- tags: Ce(U.tags),
309
- ...U.householdId ? { householdId: U.householdId } : {}
308
+ name: G.name.trim(),
309
+ type: G.type,
310
+ targetAmount: Number(G.targetAmount),
311
+ targetDate: new Date(G.targetDate).toISOString(),
312
+ monthlyContribution: Number(G.monthlyContribution) || 0,
313
+ priority: Number(G.priority) || 1,
314
+ currency: G.currency.trim() || "USD",
315
+ notes: G.notes.trim() || null,
316
+ tags: [],
317
+ ...G.householdId ? { householdId: G.householdId } : {}
310
318
  };
311
- w.mutate(e, { onSuccess: () => R(!1) });
319
+ ue.mutate(e, { onSuccess: () => L(!1) });
312
320
  },
313
- onOpenChange: (e) => R(e),
321
+ onOpenChange: (e) => L(e),
314
322
  translate: i
315
323
  }),
316
- /* @__PURE__ */ k(Te, {
317
- open: !!z,
324
+ /* @__PURE__ */ E(De, {
325
+ open: !!R,
318
326
  mode: "edit",
319
- form: U,
320
- setField: G,
321
- households: v.map((e) => ({
327
+ goalId: R?.id,
328
+ form: G,
329
+ setField: q,
330
+ households: w.map((e) => ({
322
331
  id: e.id,
323
332
  name: e.name
324
333
  })),
325
- valid: X,
326
- pending: T.isPending,
334
+ valid: Z,
335
+ pending: P.isPending,
327
336
  onSubmit: () => {
328
- if (!z || !X) return;
337
+ if (!R || !Z) return;
329
338
  let e = {
330
- name: U.name.trim(),
331
- type: U.type,
332
- status: U.status,
333
- targetAmount: Number(U.targetAmount),
334
- targetDate: new Date(U.targetDate).toISOString(),
335
- monthlyContribution: Number(U.monthlyContribution) || 0,
336
- priority: Number(U.priority) || 1,
337
- currency: U.currency.trim() || "USD",
338
- notes: U.notes.trim() || null,
339
- tags: Ce(U.tags)
339
+ name: G.name.trim(),
340
+ type: G.type,
341
+ status: G.status,
342
+ targetAmount: Number(G.targetAmount),
343
+ targetDate: new Date(G.targetDate).toISOString(),
344
+ monthlyContribution: Number(G.monthlyContribution) || 0,
345
+ priority: Number(G.priority) || 1,
346
+ currency: G.currency.trim() || "USD",
347
+ notes: G.notes.trim() || null,
348
+ tags: R.tags
340
349
  };
341
- T.mutate({
342
- id: z.id,
350
+ P.mutate({
351
+ id: R.id,
343
352
  input: e
344
- }, { onSuccess: () => B(null) });
353
+ }, { onSuccess: () => z(null) });
345
354
  },
346
355
  onOpenChange: (e) => {
347
- e || B(null);
356
+ e || z(null);
348
357
  },
349
358
  translate: i
350
359
  }),
351
- /* @__PURE__ */ k(Ee, {
352
- goalId: se,
353
- onClose: () => V(null),
360
+ /* @__PURE__ */ E(Oe, {
361
+ goalId: V,
362
+ onClose: () => H(null),
354
363
  translate: i
364
+ }),
365
+ /* @__PURE__ */ E(ne, {
366
+ open: !!U,
367
+ onOpenChange: (e) => {
368
+ e || W(null);
369
+ },
370
+ title: i("brainyrich.goals.archive.title", "Archive goal?"),
371
+ description: i("brainyrich.goals.archive.description", "This removes “{name}” from your active goals. You can no longer track its progress.", { name: U?.name ?? "" }),
372
+ confirmLabel: i("brainyrich.goals.archive.confirm", "Archive goal"),
373
+ pendingLabel: i("brainyrich.goals.archive.pending", "Archiving…"),
374
+ destructive: !0,
375
+ pending: F.isPending,
376
+ onConfirm: () => {
377
+ U && F.mutate(U.id, { onSuccess: () => W(null) });
378
+ }
355
379
  })
356
380
  ] });
357
381
  }
358
- function Te({ open: e, mode: t, form: n, setField: r, households: i, valid: a, pending: o, onSubmit: s, onOpenChange: c, translate: l }) {
359
- return /* @__PURE__ */ k(L, {
382
+ function De({ open: e, mode: t, goalId: n, form: r, setField: i, households: a, valid: o, pending: s, onSubmit: c, onOpenChange: l, translate: u }) {
383
+ return /* @__PURE__ */ E(P, {
360
384
  open: e,
361
- onOpenChange: c,
362
- children: /* @__PURE__ */ A(R, {
385
+ onOpenChange: l,
386
+ children: /* @__PURE__ */ D(F, {
363
387
  className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
364
- children: [/* @__PURE__ */ A(se, { children: [/* @__PURE__ */ k(V, { children: t === "create" ? l("brainyrich.goals.form.createTitle", "New goal") : l("brainyrich.goals.form.editTitle", "Edit goal") }), /* @__PURE__ */ k(z, { children: l("brainyrich.goals.form.subtitle", "Define the milestone, target and contribution plan.") })] }), /* @__PURE__ */ A("form", {
388
+ children: [/* @__PURE__ */ D(R, { children: [/* @__PURE__ */ E(z, { children: t === "create" ? u("brainyrich.goals.form.createTitle", "New goal") : u("brainyrich.goals.form.editTitle", "Edit goal") }), /* @__PURE__ */ E(I, { children: u("brainyrich.goals.form.subtitle", "Define the milestone, target and contribution plan.") })] }), /* @__PURE__ */ D("form", {
365
389
  className: "space-y-4",
366
390
  onSubmit: (e) => {
367
- e.preventDefault(), s();
391
+ e.preventDefault(), c();
368
392
  },
369
393
  children: [
370
- /* @__PURE__ */ A("div", {
394
+ /* @__PURE__ */ D("div", {
371
395
  className: "space-y-1.5",
372
- children: [/* @__PURE__ */ k(W, {
396
+ children: [/* @__PURE__ */ E(H, {
373
397
  htmlFor: "goal-name",
374
- children: l("brainyrich.goals.form.name", "Name")
375
- }), /* @__PURE__ */ k(U, {
398
+ children: u("brainyrich.goals.form.name", "Name")
399
+ }), /* @__PURE__ */ E(V, {
376
400
  id: "goal-name",
377
- value: n.name,
378
- onChange: (e) => r("name", e.target.value),
379
- placeholder: l("brainyrich.goals.form.namePlaceholder", "e.g. Retirement fund"),
401
+ value: r.name,
402
+ onChange: (e) => i("name", e.target.value),
403
+ placeholder: u("brainyrich.goals.form.namePlaceholder", "e.g. Retirement fund"),
380
404
  required: !0
381
405
  })]
382
406
  }),
383
- /* @__PURE__ */ A("div", {
407
+ /* @__PURE__ */ D("div", {
384
408
  className: "grid grid-cols-2 gap-3",
385
- children: [/* @__PURE__ */ A("div", {
409
+ children: [/* @__PURE__ */ D("div", {
386
410
  className: "space-y-1.5",
387
- children: [/* @__PURE__ */ k(W, {
411
+ children: [/* @__PURE__ */ E(H, {
388
412
  htmlFor: "goal-type",
389
- children: l("brainyrich.goals.form.type", "Type")
390
- }), /* @__PURE__ */ A(G, {
391
- value: n.type,
392
- onValueChange: (e) => r("type", e),
393
- children: [/* @__PURE__ */ k(J, {
413
+ children: u("brainyrich.goals.form.type", "Type")
414
+ }), /* @__PURE__ */ D(U, {
415
+ value: r.type,
416
+ onValueChange: (e) => i("type", e),
417
+ children: [/* @__PURE__ */ E(K, {
394
418
  id: "goal-type",
395
- children: /* @__PURE__ */ k(Y, {})
396
- }), /* @__PURE__ */ k(K, { children: _e.map((e) => /* @__PURE__ */ k(q, {
419
+ children: /* @__PURE__ */ E(q, {})
420
+ }), /* @__PURE__ */ E(W, { children: ye.map((e) => /* @__PURE__ */ E(G, {
397
421
  value: e,
398
- children: Z(e)
422
+ children: Q(e)
399
423
  }, e)) })]
400
424
  })]
401
- }), t === "edit" ? /* @__PURE__ */ A("div", {
425
+ }), t === "edit" ? /* @__PURE__ */ D("div", {
402
426
  className: "space-y-1.5",
403
- children: [/* @__PURE__ */ k(W, {
427
+ children: [/* @__PURE__ */ E(H, {
404
428
  htmlFor: "goal-status",
405
- children: l("brainyrich.goals.form.status", "Status")
406
- }), /* @__PURE__ */ A(G, {
407
- value: n.status,
408
- onValueChange: (e) => r("status", e),
409
- children: [/* @__PURE__ */ k(J, {
429
+ children: u("brainyrich.goals.form.status", "Status")
430
+ }), /* @__PURE__ */ D(U, {
431
+ value: r.status,
432
+ onValueChange: (e) => i("status", e),
433
+ children: [/* @__PURE__ */ E(K, {
410
434
  id: "goal-status",
411
- children: /* @__PURE__ */ k(Y, {})
412
- }), /* @__PURE__ */ k(K, { children: ve.map((e) => /* @__PURE__ */ k(q, {
435
+ children: /* @__PURE__ */ E(q, {})
436
+ }), /* @__PURE__ */ E(W, { children: be.map((e) => /* @__PURE__ */ E(G, {
413
437
  value: e,
414
- children: Z(e)
438
+ children: Q(e)
415
439
  }, e)) })]
416
440
  })]
417
- }) : /* @__PURE__ */ A("div", {
441
+ }) : /* @__PURE__ */ D("div", {
418
442
  className: "space-y-1.5",
419
- children: [/* @__PURE__ */ k(W, {
443
+ children: [/* @__PURE__ */ E(H, {
420
444
  htmlFor: "goal-priority",
421
- children: l("brainyrich.goals.form.priority", "Priority")
422
- }), /* @__PURE__ */ k(U, {
445
+ children: u("brainyrich.goals.form.priority", "Priority")
446
+ }), /* @__PURE__ */ E(V, {
423
447
  id: "goal-priority",
424
448
  type: "number",
425
449
  min: 1,
426
- value: n.priority,
427
- onChange: (e) => r("priority", e.target.value)
450
+ value: r.priority,
451
+ onChange: (e) => i("priority", e.target.value)
428
452
  })]
429
453
  })]
430
454
  }),
431
- /* @__PURE__ */ A("div", {
455
+ /* @__PURE__ */ D("div", {
432
456
  className: "grid grid-cols-2 gap-3",
433
- children: [/* @__PURE__ */ A("div", {
457
+ children: [/* @__PURE__ */ D("div", {
434
458
  className: "space-y-1.5",
435
- children: [/* @__PURE__ */ k(W, {
459
+ children: [/* @__PURE__ */ E(H, {
436
460
  htmlFor: "goal-target",
437
- children: l("brainyrich.goals.form.targetAmount", "Target amount")
438
- }), /* @__PURE__ */ k(U, {
461
+ children: u("brainyrich.goals.form.targetAmount", "Target amount")
462
+ }), /* @__PURE__ */ E(V, {
439
463
  id: "goal-target",
440
464
  type: "number",
441
465
  min: 0,
442
466
  step: "0.01",
443
- value: n.targetAmount,
444
- onChange: (e) => r("targetAmount", e.target.value),
467
+ value: r.targetAmount,
468
+ onChange: (e) => i("targetAmount", e.target.value),
445
469
  required: !0
446
470
  })]
447
- }), /* @__PURE__ */ A("div", {
471
+ }), /* @__PURE__ */ D("div", {
448
472
  className: "space-y-1.5",
449
- children: [/* @__PURE__ */ k(W, {
473
+ children: [/* @__PURE__ */ E(H, {
450
474
  htmlFor: "goal-date",
451
- children: l("brainyrich.goals.form.targetDate", "Target date")
452
- }), /* @__PURE__ */ k(U, {
475
+ children: u("brainyrich.goals.form.targetDate", "Target date")
476
+ }), /* @__PURE__ */ E(V, {
453
477
  id: "goal-date",
454
478
  type: "date",
455
- value: n.targetDate,
456
- onChange: (e) => r("targetDate", e.target.value),
479
+ value: r.targetDate,
480
+ onChange: (e) => i("targetDate", e.target.value),
457
481
  required: !0
458
482
  })]
459
483
  })]
460
484
  }),
461
- /* @__PURE__ */ A("div", {
485
+ /* @__PURE__ */ D("div", {
462
486
  className: "grid grid-cols-2 gap-3",
463
- children: [/* @__PURE__ */ A("div", {
487
+ children: [/* @__PURE__ */ D("div", {
464
488
  className: "space-y-1.5",
465
- children: [/* @__PURE__ */ k(W, {
489
+ children: [/* @__PURE__ */ E(H, {
466
490
  htmlFor: "goal-monthly",
467
- children: l("brainyrich.goals.form.monthly", "Monthly contribution")
468
- }), /* @__PURE__ */ k(U, {
491
+ children: u("brainyrich.goals.form.monthly", "Monthly contribution")
492
+ }), /* @__PURE__ */ E(V, {
469
493
  id: "goal-monthly",
470
494
  type: "number",
471
495
  min: 0,
472
496
  step: "0.01",
473
- value: n.monthlyContribution,
474
- onChange: (e) => r("monthlyContribution", e.target.value)
497
+ value: r.monthlyContribution,
498
+ onChange: (e) => i("monthlyContribution", e.target.value)
475
499
  })]
476
- }), /* @__PURE__ */ A("div", {
500
+ }), /* @__PURE__ */ D("div", {
477
501
  className: "space-y-1.5",
478
- children: [/* @__PURE__ */ k(W, {
502
+ children: [/* @__PURE__ */ E(H, {
479
503
  htmlFor: "goal-currency",
480
- children: l("brainyrich.goals.form.currency", "Currency")
481
- }), /* @__PURE__ */ k(U, {
504
+ children: u("brainyrich.goals.form.currency", "Currency")
505
+ }), /* @__PURE__ */ E(V, {
482
506
  id: "goal-currency",
483
- value: n.currency,
484
- onChange: (e) => r("currency", e.target.value.toUpperCase()),
507
+ value: r.currency,
508
+ onChange: (e) => i("currency", e.target.value.toUpperCase()),
485
509
  maxLength: 3
486
510
  })]
487
511
  })]
488
512
  }),
489
- t === "edit" ? /* @__PURE__ */ A("div", {
513
+ t === "edit" ? /* @__PURE__ */ D("div", {
490
514
  className: "space-y-1.5",
491
- children: [/* @__PURE__ */ k(W, {
515
+ children: [/* @__PURE__ */ E(H, {
492
516
  htmlFor: "goal-priority-edit",
493
- children: l("brainyrich.goals.form.priority", "Priority")
494
- }), /* @__PURE__ */ k(U, {
517
+ children: u("brainyrich.goals.form.priority", "Priority")
518
+ }), /* @__PURE__ */ E(V, {
495
519
  id: "goal-priority-edit",
496
520
  type: "number",
497
521
  min: 1,
498
- value: n.priority,
499
- onChange: (e) => r("priority", e.target.value)
522
+ value: r.priority,
523
+ onChange: (e) => i("priority", e.target.value)
500
524
  })]
501
525
  }) : null,
502
- /* @__PURE__ */ A("div", {
526
+ /* @__PURE__ */ D("div", {
503
527
  className: "space-y-1.5",
504
- children: [/* @__PURE__ */ k(W, {
528
+ children: [/* @__PURE__ */ E(H, {
505
529
  htmlFor: "goal-household",
506
- children: l("brainyrich.goals.form.household", "Household (optional)")
507
- }), /* @__PURE__ */ A(G, {
508
- value: n.householdId || Q,
509
- onValueChange: (e) => r("householdId", e === Q ? "" : e),
510
- children: [/* @__PURE__ */ k(J, {
530
+ children: u("brainyrich.goals.form.household", "Household (optional)")
531
+ }), /* @__PURE__ */ D(U, {
532
+ value: r.householdId || Te,
533
+ onValueChange: (e) => i("householdId", e === Te ? "" : e),
534
+ children: [/* @__PURE__ */ E(K, {
511
535
  id: "goal-household",
512
- children: /* @__PURE__ */ k(Y, { placeholder: l("brainyrich.goals.form.householdNone", "None") })
513
- }), /* @__PURE__ */ A(K, { children: [/* @__PURE__ */ k(q, {
514
- value: Q,
515
- children: l("brainyrich.goals.form.householdNone", "None")
516
- }), i.map((e) => /* @__PURE__ */ k(q, {
536
+ children: /* @__PURE__ */ E(q, { placeholder: u("brainyrich.goals.form.householdNone", "None") })
537
+ }), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
538
+ value: Te,
539
+ children: u("brainyrich.goals.form.householdNone", "None")
540
+ }), a.map((e) => /* @__PURE__ */ E(G, {
517
541
  value: e.id,
518
542
  children: e.name
519
543
  }, e.id))] })]
520
544
  })]
521
545
  }),
522
- /* @__PURE__ */ A("div", {
546
+ t === "edit" && n ? /* @__PURE__ */ E(h, {
547
+ entityType: "brainyrich-goal",
548
+ entityId: n,
549
+ label: u("brainyrich.goals.form.tags", "Tags")
550
+ }) : /* @__PURE__ */ D("div", {
523
551
  className: "space-y-1.5",
524
- children: [/* @__PURE__ */ k(W, {
525
- htmlFor: "goal-tags",
526
- children: l("brainyrich.goals.form.tags", "Tags (comma separated)")
527
- }), /* @__PURE__ */ k(U, {
528
- id: "goal-tags",
529
- value: n.tags,
530
- onChange: (e) => r("tags", e.target.value),
531
- placeholder: l("brainyrich.goals.form.tagsPlaceholder", "e.g. long-term, family")
552
+ children: [/* @__PURE__ */ E(H, { children: u("brainyrich.goals.form.tags", "Tags") }), /* @__PURE__ */ E("p", {
553
+ className: "text-sm text-text-secondary",
554
+ children: u("brainyrich.goals.form.tagsAfterCreate", "You can add tags after creating the goal.")
532
555
  })]
533
556
  }),
534
- /* @__PURE__ */ A("div", {
557
+ /* @__PURE__ */ D("div", {
535
558
  className: "space-y-1.5",
536
- children: [/* @__PURE__ */ k(W, {
559
+ children: [/* @__PURE__ */ E(H, {
537
560
  htmlFor: "goal-notes",
538
- children: l("brainyrich.goals.form.notes", "Notes")
539
- }), /* @__PURE__ */ k(ge, {
561
+ children: u("brainyrich.goals.form.notes", "Notes")
562
+ }), /* @__PURE__ */ E(ve, {
540
563
  id: "goal-notes",
541
- value: n.notes,
542
- onChange: (e) => r("notes", e.target.value),
564
+ value: r.notes,
565
+ onChange: (e) => i("notes", e.target.value),
543
566
  rows: 3
544
567
  })]
545
568
  }),
546
- /* @__PURE__ */ A(B, { children: [/* @__PURE__ */ k(M, {
569
+ /* @__PURE__ */ D(L, { children: [/* @__PURE__ */ E(k, {
547
570
  type: "button",
548
571
  variant: "outline",
549
- onClick: () => c(!1),
550
- disabled: o,
551
- children: l("brainyrich.goals.form.cancel", "Cancel")
552
- }), /* @__PURE__ */ k(M, {
572
+ onClick: () => l(!1),
573
+ disabled: s,
574
+ children: u("brainyrich.goals.form.cancel", "Cancel")
575
+ }), /* @__PURE__ */ E(k, {
553
576
  type: "submit",
554
- disabled: !a || o,
555
- children: o ? l("brainyrich.goals.form.saving", "Saving…") : t === "create" ? l("brainyrich.goals.form.create", "Create goal") : l("brainyrich.goals.form.save", "Save changes")
577
+ disabled: !o || s,
578
+ children: s ? u("brainyrich.goals.form.saving", "Saving…") : t === "create" ? u("brainyrich.goals.form.create", "Create goal") : u("brainyrich.goals.form.save", "Save changes")
556
579
  })] })
557
580
  ]
558
581
  })]
559
582
  })
560
583
  });
561
584
  }
562
- function Ee({ goalId: e, onClose: n, translate: r }) {
563
- let { data: o, isLoading: s, isError: ee, refetch: te } = i(e ?? void 0), { data: p } = a(e ?? void 0), { data: h } = t(), g = c(), v = u(), y = l(), [b, x] = _(""), [C, w] = _("PERCENT"), [T, D] = _(""), [j, N] = _(""), P = p.reduce((e, t) => e + (t.fixedAmount ?? 0), 0), F = o?.currency ?? "USD", oe = (e) => h.find((t) => t.id === e)?.name ?? e, I = () => {
564
- if (!e || !b) return;
565
- let t = Number(T);
566
- !Number.isFinite(t) || t <= 0 || g.mutate({
585
+ function Oe({ goalId: e, onClose: n, translate: r }) {
586
+ let { data: o, isLoading: c, isError: ee, refetch: te } = i(e ?? void 0), { data: d } = a(e ?? void 0), { data: f } = t(), m = s(), h = u(), g = l(), [v, y] = _(""), [b, ce] = _("PERCENT"), [S, C] = _(""), [w, de] = _(""), [O, A] = _(null), j = d.reduce((e, t) => e + (t.fixedAmount ?? 0), 0), M = o?.currency ?? "USD", N = (e) => f.find((t) => t.id === e)?.name ?? e, fe = () => {
587
+ if (!e || !v) return;
588
+ let t = Number(S);
589
+ !Number.isFinite(t) || t <= 0 || m.mutate({
567
590
  goalId: e,
568
- accountId: b,
569
- ...C === "PERCENT" ? { allocationPct: t } : { fixedAmount: t }
591
+ accountId: v,
592
+ ...b === "PERCENT" ? { allocationPct: t } : { fixedAmount: t }
570
593
  }, { onSuccess: () => {
571
- x(""), D("");
594
+ y(""), C("");
572
595
  } });
573
- }, L = () => {
596
+ }, P = () => {
574
597
  if (!e) return;
575
- let t = j === "" ? P : Number(j);
576
- Number.isFinite(t) && y.mutate({
598
+ let t = w === "" ? j : Number(w);
599
+ Number.isFinite(t) && g.mutate({
577
600
  id: e,
578
601
  fundedAmount: t
579
602
  });
580
- }, R = !!b && Number(T) > 0;
581
- return /* @__PURE__ */ k(X, {
603
+ }, F = !!v && Number(S) > 0, I = O ? O.fixedAmount == null ? N(O.accountId) : p(O.fixedAmount, M) : "";
604
+ return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(J, {
582
605
  open: !!e,
583
606
  onOpenChange: (e) => {
584
607
  e || n();
585
608
  },
586
- children: /* @__PURE__ */ A(fe, {
609
+ children: /* @__PURE__ */ D(Y, {
587
610
  className: "flex w-full flex-col gap-0 overflow-y-auto sm:max-w-md",
588
- children: [/* @__PURE__ */ A(me, { children: [/* @__PURE__ */ k(he, { children: o?.name ?? r("brainyrich.goals.detail.title", "Goal") }), /* @__PURE__ */ k(pe, { children: r("brainyrich.goals.detail.subtitle", "Manage funding links and projection.") })] }), /* @__PURE__ */ k("div", {
611
+ children: [/* @__PURE__ */ D(_e, { children: [/* @__PURE__ */ E(Z, { children: o?.name ?? r("brainyrich.goals.detail.title", "Goal") }), /* @__PURE__ */ E(X, { children: r("brainyrich.goals.detail.subtitle", "Manage funding links and projection.") })] }), /* @__PURE__ */ E("div", {
589
612
  className: "space-y-6 p-4",
590
- children: s ? /* @__PURE__ */ k(ne, { rows: 3 }) : ee ? /* @__PURE__ */ k(f, {
613
+ children: c ? /* @__PURE__ */ E(ae, { rows: 3 }) : ee ? /* @__PURE__ */ E(ie, {
591
614
  title: r("brainyrich.goals.detail.error", "Could not load goal"),
592
615
  onRetry: () => te()
593
- }) : o ? /* @__PURE__ */ A(O, { children: [
594
- /* @__PURE__ */ A("div", {
616
+ }) : o ? /* @__PURE__ */ D(T, { children: [
617
+ /* @__PURE__ */ D("div", {
595
618
  className: "grid grid-cols-2 gap-3",
596
619
  children: [
597
- /* @__PURE__ */ k($, {
620
+ /* @__PURE__ */ E($, {
598
621
  label: r("brainyrich.goals.detail.target", "Target"),
599
- value: m(o.targetAmount, F)
622
+ value: p(o.targetAmount, M)
600
623
  }),
601
- /* @__PURE__ */ k($, {
624
+ /* @__PURE__ */ E($, {
602
625
  label: r("brainyrich.goals.detail.funded", "Funded (fixed)"),
603
- value: m(P, F)
626
+ value: p(j, M)
604
627
  }),
605
- /* @__PURE__ */ k($, {
628
+ /* @__PURE__ */ E($, {
606
629
  label: r("brainyrich.goals.detail.projection", "Projection"),
607
- value: Z(o.projection),
608
- tone: ye(o.projection).tone
630
+ value: Q(o.projection),
631
+ tone: xe(o.projection).tone
609
632
  }),
610
- /* @__PURE__ */ k($, {
633
+ /* @__PURE__ */ E($, {
611
634
  label: r("brainyrich.goals.detail.targetDate", "Target date"),
612
- value: re(o.targetDate)
635
+ value: oe(o.targetDate)
613
636
  })
614
637
  ]
615
638
  }),
616
- /* @__PURE__ */ A("section", {
639
+ /* @__PURE__ */ D("section", {
617
640
  className: "space-y-3",
618
- children: [/* @__PURE__ */ k("h3", {
641
+ children: [/* @__PURE__ */ E("h3", {
619
642
  className: "text-sm font-semibold text-text-primary",
620
643
  children: r("brainyrich.goals.detail.fundingLinks", "Funding links")
621
- }), p.length === 0 ? /* @__PURE__ */ k("p", {
644
+ }), d.length === 0 ? /* @__PURE__ */ E("p", {
622
645
  className: "rounded-lg border border-dashed border-border-subtle bg-bg-surface px-4 py-6 text-center text-sm text-text-secondary",
623
646
  children: r("brainyrich.goals.detail.noFundings", "No accounts linked to fund this goal yet.")
624
- }) : /* @__PURE__ */ k("ul", {
647
+ }) : /* @__PURE__ */ E("ul", {
625
648
  className: "space-y-2",
626
- children: p.map((e) => /* @__PURE__ */ A("li", {
649
+ children: d.map((e) => /* @__PURE__ */ D("li", {
627
650
  className: "flex items-center justify-between gap-2 rounded-lg border border-border-subtle bg-bg-surface px-3 py-2",
628
- children: [/* @__PURE__ */ A("div", {
651
+ children: [/* @__PURE__ */ D("div", {
629
652
  className: "min-w-0",
630
- children: [/* @__PURE__ */ k("p", {
653
+ children: [/* @__PURE__ */ E("p", {
631
654
  className: "truncate text-sm font-medium text-text-primary",
632
- children: oe(e.accountId)
633
- }), /* @__PURE__ */ k("p", {
655
+ children: N(e.accountId)
656
+ }), /* @__PURE__ */ E("p", {
634
657
  className: "text-xs text-text-secondary",
635
- children: e.fixedAmount == null ? r("brainyrich.goals.detail.pctOfAccount", "{pct}% of account", { pct: e.allocationPct }) : m(e.fixedAmount, F)
658
+ children: e.fixedAmount == null ? r("brainyrich.goals.detail.pctOfAccount", "{pct}% of account", { pct: e.allocationPct }) : p(e.fixedAmount, M)
636
659
  })]
637
- }), /* @__PURE__ */ k(M, {
660
+ }), /* @__PURE__ */ E(k, {
638
661
  variant: "ghost",
639
662
  size: "icon",
640
663
  "aria-label": r("brainyrich.goals.detail.unlink", "Unlink funding"),
641
- disabled: v.isPending,
642
- onClick: () => v.mutate(e.id),
643
- children: /* @__PURE__ */ k(E, {
664
+ onClick: () => A(e),
665
+ children: /* @__PURE__ */ E(ue, {
644
666
  className: "size-4",
645
667
  "aria-hidden": "true"
646
668
  })
@@ -648,124 +670,124 @@ function Ee({ goalId: e, onClose: n, translate: r }) {
648
670
  }, e.id))
649
671
  })]
650
672
  }),
651
- /* @__PURE__ */ A("section", {
673
+ /* @__PURE__ */ D("section", {
652
674
  className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
653
- children: [/* @__PURE__ */ k("h3", {
675
+ children: [/* @__PURE__ */ E("h3", {
654
676
  className: "text-sm font-semibold text-text-primary",
655
677
  children: r("brainyrich.goals.detail.linkTitle", "Link an account")
656
- }), h.length === 0 ? /* @__PURE__ */ k("p", {
678
+ }), f.length === 0 ? /* @__PURE__ */ E("p", {
657
679
  className: "text-sm text-text-secondary",
658
680
  children: r("brainyrich.goals.detail.noAccounts", "No accounts available to link.")
659
- }) : /* @__PURE__ */ A(O, { children: [
660
- /* @__PURE__ */ A("div", {
681
+ }) : /* @__PURE__ */ D(T, { children: [
682
+ /* @__PURE__ */ D("div", {
661
683
  className: "space-y-1.5",
662
- children: [/* @__PURE__ */ k(W, {
684
+ children: [/* @__PURE__ */ E(H, {
663
685
  htmlFor: "funding-account",
664
686
  children: r("brainyrich.goals.detail.account", "Account")
665
- }), /* @__PURE__ */ A(G, {
666
- value: b,
667
- onValueChange: x,
668
- children: [/* @__PURE__ */ k(J, {
687
+ }), /* @__PURE__ */ D(U, {
688
+ value: v,
689
+ onValueChange: y,
690
+ children: [/* @__PURE__ */ E(K, {
669
691
  id: "funding-account",
670
- children: /* @__PURE__ */ k(Y, { placeholder: r("brainyrich.goals.detail.selectAccount", "Select account") })
671
- }), /* @__PURE__ */ k(K, { children: h.map((e) => /* @__PURE__ */ k(q, {
692
+ children: /* @__PURE__ */ E(q, { placeholder: r("brainyrich.goals.detail.selectAccount", "Select account") })
693
+ }), /* @__PURE__ */ E(W, { children: f.map((e) => /* @__PURE__ */ E(G, {
672
694
  value: e.id,
673
695
  children: e.name
674
696
  }, e.id)) })]
675
697
  })]
676
698
  }),
677
- /* @__PURE__ */ A("div", {
699
+ /* @__PURE__ */ D("div", {
678
700
  className: "grid grid-cols-2 gap-3",
679
- children: [/* @__PURE__ */ A("div", {
701
+ children: [/* @__PURE__ */ D("div", {
680
702
  className: "space-y-1.5",
681
- children: [/* @__PURE__ */ k(W, {
703
+ children: [/* @__PURE__ */ E(H, {
682
704
  htmlFor: "funding-mode",
683
705
  children: r("brainyrich.goals.detail.mode", "Method")
684
- }), /* @__PURE__ */ A(G, {
685
- value: C,
686
- onValueChange: (e) => w(e),
687
- children: [/* @__PURE__ */ k(J, {
706
+ }), /* @__PURE__ */ D(U, {
707
+ value: b,
708
+ onValueChange: (e) => ce(e),
709
+ children: [/* @__PURE__ */ E(K, {
688
710
  id: "funding-mode",
689
- children: /* @__PURE__ */ k(Y, {})
690
- }), /* @__PURE__ */ A(K, { children: [/* @__PURE__ */ k(q, {
711
+ children: /* @__PURE__ */ E(q, {})
712
+ }), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
691
713
  value: "PERCENT",
692
714
  children: r("brainyrich.goals.detail.percent", "Percentage")
693
- }), /* @__PURE__ */ k(q, {
715
+ }), /* @__PURE__ */ E(G, {
694
716
  value: "FIXED",
695
717
  children: r("brainyrich.goals.detail.fixed", "Fixed amount")
696
718
  })] })]
697
719
  })]
698
- }), /* @__PURE__ */ A("div", {
720
+ }), /* @__PURE__ */ D("div", {
699
721
  className: "space-y-1.5",
700
- children: [/* @__PURE__ */ k(W, {
722
+ children: [/* @__PURE__ */ E(H, {
701
723
  htmlFor: "funding-value",
702
- children: C === "PERCENT" ? r("brainyrich.goals.detail.pct", "Percent") : r("brainyrich.goals.detail.amount", "Amount")
703
- }), /* @__PURE__ */ k(U, {
724
+ children: b === "PERCENT" ? r("brainyrich.goals.detail.pct", "Percent") : r("brainyrich.goals.detail.amount", "Amount")
725
+ }), /* @__PURE__ */ E(V, {
704
726
  id: "funding-value",
705
727
  type: "number",
706
728
  min: 0,
707
729
  step: "0.01",
708
- value: T,
709
- onChange: (e) => D(e.target.value)
730
+ value: S,
731
+ onChange: (e) => C(e.target.value)
710
732
  })]
711
733
  })]
712
734
  }),
713
- /* @__PURE__ */ A(M, {
735
+ /* @__PURE__ */ D(k, {
714
736
  size: "sm",
715
737
  className: "w-full",
716
- disabled: !R || g.isPending,
717
- onClick: I,
718
- children: [/* @__PURE__ */ k(ie, {
738
+ disabled: !F || m.isPending,
739
+ onClick: fe,
740
+ children: [/* @__PURE__ */ E(se, {
719
741
  className: "size-4",
720
742
  "aria-hidden": "true"
721
- }), g.isPending ? r("brainyrich.goals.detail.linking", "Linking…") : r("brainyrich.goals.detail.link", "Link funding")]
743
+ }), m.isPending ? r("brainyrich.goals.detail.linking", "Linking…") : r("brainyrich.goals.detail.link", "Link funding")]
722
744
  })
723
745
  ] })]
724
746
  }),
725
- /* @__PURE__ */ A("section", {
747
+ /* @__PURE__ */ D("section", {
726
748
  className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
727
749
  children: [
728
- /* @__PURE__ */ k("h3", {
750
+ /* @__PURE__ */ E("h3", {
729
751
  className: "text-sm font-semibold text-text-primary",
730
752
  children: r("brainyrich.goals.detail.recalcTitle", "Recalculate projection")
731
753
  }),
732
- /* @__PURE__ */ A("div", {
754
+ /* @__PURE__ */ D("div", {
733
755
  className: "space-y-1.5",
734
756
  children: [
735
- /* @__PURE__ */ k(W, {
757
+ /* @__PURE__ */ E(H, {
736
758
  htmlFor: "recalc-funded",
737
759
  children: r("brainyrich.goals.detail.fundedAmount", "Funded amount")
738
760
  }),
739
- /* @__PURE__ */ k(U, {
761
+ /* @__PURE__ */ E(V, {
740
762
  id: "recalc-funded",
741
763
  type: "number",
742
764
  min: 0,
743
765
  step: "0.01",
744
- value: j,
745
- placeholder: String(P),
746
- onChange: (e) => N(e.target.value)
766
+ value: w,
767
+ placeholder: String(j),
768
+ onChange: (e) => de(e.target.value)
747
769
  }),
748
- /* @__PURE__ */ k("p", {
770
+ /* @__PURE__ */ E("p", {
749
771
  className: "text-xs text-text-secondary",
750
772
  children: r("brainyrich.goals.detail.recalcHint", "Defaults to the sum of fixed fundings when left blank.")
751
773
  })
752
774
  ]
753
775
  }),
754
- /* @__PURE__ */ A(M, {
776
+ /* @__PURE__ */ D(k, {
755
777
  size: "sm",
756
778
  variant: "outline",
757
779
  className: "w-full",
758
- disabled: y.isPending,
759
- onClick: L,
760
- children: [/* @__PURE__ */ k(ae, {
780
+ disabled: g.isPending,
781
+ onClick: P,
782
+ children: [/* @__PURE__ */ E(le, {
761
783
  className: "size-4",
762
784
  "aria-hidden": "true"
763
- }), y.isPending ? r("brainyrich.goals.detail.recalculating", "Recalculating…") : r("brainyrich.goals.detail.recalc", "Recalculate")]
785
+ }), g.isPending ? r("brainyrich.goals.detail.recalculating", "Recalculating…") : r("brainyrich.goals.detail.recalc", "Recalculate")]
764
786
  })
765
787
  ]
766
788
  })
767
- ] }) : /* @__PURE__ */ k(d, {
768
- icon: /* @__PURE__ */ k(S, {
789
+ ] }) : /* @__PURE__ */ E(re, {
790
+ icon: /* @__PURE__ */ E(x, {
769
791
  className: "size-6",
770
792
  "aria-hidden": "true"
771
793
  }),
@@ -773,21 +795,35 @@ function Ee({ goalId: e, onClose: n, translate: r }) {
773
795
  })
774
796
  })]
775
797
  })
776
- });
798
+ }), /* @__PURE__ */ E(ne, {
799
+ open: !!O,
800
+ onOpenChange: (e) => {
801
+ e || A(null);
802
+ },
803
+ title: r("brainyrich.goals.detail.unlinkTitle", "Unlink funding?"),
804
+ description: r("brainyrich.goals.detail.unlinkConfirm", "This removes the “{name}” funding link from this goal.", { name: I }),
805
+ confirmLabel: r("brainyrich.goals.detail.unlink", "Unlink funding"),
806
+ pendingLabel: r("brainyrich.goals.detail.unlinking", "Unlinking…"),
807
+ destructive: !0,
808
+ pending: h.isPending,
809
+ onConfirm: () => {
810
+ O && h.mutate(O.id, { onSuccess: () => A(null) });
811
+ }
812
+ })] });
777
813
  }
778
814
  function $({ label: e, value: t, tone: n }) {
779
- return /* @__PURE__ */ A("div", {
815
+ return /* @__PURE__ */ D("div", {
780
816
  className: "rounded-lg bg-bg-sunken p-3",
781
- children: [/* @__PURE__ */ k("p", {
817
+ children: [/* @__PURE__ */ E("p", {
782
818
  className: "text-xs text-text-secondary",
783
819
  children: e
784
- }), /* @__PURE__ */ k("p", {
820
+ }), /* @__PURE__ */ E("p", {
785
821
  className: `text-sm font-semibold ${n ?? "text-text-primary"}`,
786
822
  children: t
787
823
  })]
788
824
  });
789
825
  }
790
826
  //#endregion
791
- export { we as GoalsPage };
827
+ export { Ee as GoalsPage };
792
828
 
793
829
  //# sourceMappingURL=GoalsPage.js.map