@burdenoff/microfe-brainyrich 2026.828.1 → 2026.830.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 (39) hide show
  1. package/dist/brainyrich/BrainyRichRoot.d.ts.map +1 -1
  2. package/dist/brainyrich/BrainyRichRoot.js +59 -59
  3. package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
  4. package/dist/brainyrich/components/viz.d.ts.map +1 -1
  5. package/dist/brainyrich/components/viz.js +149 -148
  6. package/dist/brainyrich/components/viz.js.map +1 -1
  7. package/dist/brainyrich/hooks/useTr.d.ts +17 -0
  8. package/dist/brainyrich/hooks/useTr.d.ts.map +1 -0
  9. package/dist/brainyrich/hooks/useTr.js +14 -0
  10. package/dist/brainyrich/hooks/useTr.js.map +1 -0
  11. package/dist/brainyrich/pages/AiAssistantPage.js +192 -192
  12. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  13. package/dist/brainyrich/pages/AnalyticsPage.d.ts.map +1 -1
  14. package/dist/brainyrich/pages/AnalyticsPage.js +253 -252
  15. package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
  16. package/dist/brainyrich/pages/DashboardPage.js +115 -115
  17. package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
  18. package/dist/brainyrich/pages/FamilyPage.js +59 -59
  19. package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
  20. package/dist/brainyrich/pages/GoalsPage.js +285 -285
  21. package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
  22. package/dist/brainyrich/pages/InvestmentsPage.js +18 -18
  23. package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
  24. package/dist/brainyrich/pages/PortfoliosPage.d.ts.map +1 -1
  25. package/dist/brainyrich/pages/PortfoliosPage.js +477 -471
  26. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  27. package/dist/brainyrich/pages/ReportsPage.js +52 -52
  28. package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
  29. package/dist/brainyrich/pages/RiskPage.d.ts.map +1 -1
  30. package/dist/brainyrich/pages/RiskPage.js +272 -271
  31. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  32. package/dist/brainyrich/pages/TaxPage.d.ts.map +1 -1
  33. package/dist/brainyrich/pages/TaxPage.js +198 -197
  34. package/dist/brainyrich/pages/TaxPage.js.map +1 -1
  35. package/dist/brainyrich/pages/_shared.d.ts.map +1 -1
  36. package/dist/brainyrich/pages/_shared.js +84 -82
  37. package/dist/brainyrich/pages/_shared.js.map +1 -1
  38. package/dist/brainyrich/types/bra.d.ts.map +1 -1
  39. package/package.json +1 -1
@@ -1,20 +1,21 @@
1
1
  import { useAllHoldings as e, useArchivePortfolio as t, useCreateHolding as n, useCreatePortfolio as r, useDeleteHolding as i, useHouseholds as a, useModelPortfolios as o, usePagedPortfolios as s, usePortfolio as c, useUpdateHolding as l, useUpdatePortfolio as u } from "../hooks/useBrainyRichApi.js";
2
2
  import { LoadMore as d } from "../components/LoadMore.js";
3
3
  import { ConfirmDialog as f } from "../components/ConfirmDialog.js";
4
- import { DonutChart as p, FadeIn as m, GlassCard as h, StatTile as g } from "../components/viz.js";
5
- import { AccountPicker as _ } from "../components/pickers.js";
4
+ import { useTr as p } from "../hooks/useTr.js";
5
+ import { DonutChart as m, FadeIn as h, GlassCard as g, StatTile as _ } from "../components/viz.js";
6
+ import { AccountPicker as v } from "../components/pickers.js";
6
7
  import "../components/index.js";
7
- import { AllocationBars as ee, EmptyState as te, ErrorState as ne, LoadingState as re, SectionShell as ie, deltaToneClass as v, formatCompact as y, formatMoney as b, formatPct as x, statusBadgeVariant as S } from "./_shared.js";
8
+ import { AllocationBars as y, EmptyState as ee, ErrorState as te, LoadingState as ne, SectionShell as re, deltaToneClass as b, formatCompact as ie, formatMoney as x, formatPct as S, statusBadgeVariant as ae } from "./_shared.js";
8
9
  import { hapticSuccess as C, showToast as w } from "../utils/nativeControls.js";
9
10
  import { useTrackBrainyRichPageView as T } from "../hooks/useBrainyRichAnalytics.js";
10
- import { TagField as ae } from "../components/reuse/TagField.js";
11
+ import { TagField as E } from "../components/reuse/TagField.js";
11
12
  import { CommentThread as oe } from "../components/reuse/CommentThread.js";
12
- import { useMemo as E, useState as D } from "react";
13
- import { ArrowDownRight as O, ArrowUpRight as k, Briefcase as A, MoreHorizontal as se, Pencil as ce, Plus as le, Trash2 as ue } from "lucide-react";
14
- import { Fragment as de, jsx as j, jsxs as M } from "react/jsx-runtime";
15
- import { Badge as N, Button as P, Card as F, CardContent as I, CardDescription as L, CardHeader as R, CardTitle as z, Dialog as B, DialogContent as V, DialogDescription as fe, DialogFooter as H, DialogHeader as U, DialogTitle as W, DropdownMenu as pe, DropdownMenuContent as me, DropdownMenuItem as G, DropdownMenuLabel as he, DropdownMenuSeparator as ge, DropdownMenuTrigger as _e, Input as K, Label as q, Select as ve, SelectContent as ye, SelectItem as J, SelectTrigger as be, SelectValue as xe, Sheet as Se, SheetContent as Ce, SheetDescription as we, SheetHeader as Te, SheetTitle as Ee, Table as De, TableBody as Oe, TableCell as Y, TableHead as X, TableHeader as ke, TableRow as Ae, Textarea as je } from "@burdenoff/fe-libs/ui";
13
+ import { useMemo as D, useState as O } from "react";
14
+ import { ArrowDownRight as k, ArrowUpRight as A, Briefcase as j, MoreHorizontal as M, Pencil as se, Plus as ce, Trash2 as le } from "lucide-react";
15
+ import { Fragment as ue, jsx as N, jsxs as P } from "react/jsx-runtime";
16
+ import { Badge as F, Button as I, Card as L, CardContent as R, CardDescription as z, CardHeader as B, CardTitle as V, DropdownMenu as de, DropdownMenuContent as fe, DropdownMenuItem as H, DropdownMenuLabel as pe, DropdownMenuSeparator as me, DropdownMenuTrigger as he, Input as U, Label as W, ResponsiveDialog as G, ResponsiveDialogContent as K, ResponsiveDialogDescription as q, ResponsiveDialogFooter as ge, ResponsiveDialogHeader as _e, ResponsiveDialogTitle as ve, Select as ye, SelectContent as be, SelectItem as J, SelectTrigger as xe, SelectValue as Se, Sheet as Ce, SheetContent as we, SheetDescription as Te, SheetHeader as Ee, SheetTitle as De, Table as Oe, TableBody as ke, TableCell as Y, TableHead as X, TableHeader as Ae, TableRow as je, Textarea as Me } from "@burdenoff/fe-libs/ui";
16
17
  //#region src/brainyrich/pages/PortfoliosPage.tsx
17
- var Me = [
18
+ var Ne = [
18
19
  "EQUITY",
19
20
  "FIXED_INCOME",
20
21
  "CASH",
@@ -22,7 +23,7 @@ var Me = [
22
23
  "COMMODITY",
23
24
  "CRYPTO",
24
25
  "ALTERNATIVE"
25
- ], Ne = [
26
+ ], Pe = [
26
27
  "DRAFT",
27
28
  "ACTIVE",
28
29
  "ARCHIVED"
@@ -30,7 +31,7 @@ var Me = [
30
31
  if (e.trim() === "") return;
31
32
  let t = Number(e);
32
33
  return Number.isFinite(t) ? t : void 0;
33
- }, Pe = {
34
+ }, Fe = {
34
35
  EQUITY: "brand",
35
36
  FIXED_INCOME: "blue",
36
37
  CASH: "teal",
@@ -38,8 +39,8 @@ var Me = [
38
39
  COMMODITY: "warning",
39
40
  CRYPTO: "indigo",
40
41
  ALTERNATIVE: "info"
41
- }, Fe = (e) => Pe[e.toUpperCase()] ?? "neutral";
42
- function Ie(e) {
42
+ }, Ie = (e) => Fe[e.toUpperCase()] ?? "neutral";
43
+ function Le(e) {
43
44
  return Array.isArray(e) ? e.flatMap((e) => {
44
45
  if (!e || typeof e != "object") return [];
45
46
  let { assetClass: t, targetPct: n } = e;
@@ -57,21 +58,21 @@ function Ie(e) {
57
58
  }] : [];
58
59
  }) : [];
59
60
  }
60
- function Le(e) {
61
- return Ie(e).map((e) => ({
61
+ function Re(e) {
62
+ return Le(e).map((e) => ({
62
63
  label: Q(e.assetClass),
63
64
  value: e.targetPct,
64
65
  tone: "accent"
65
66
  }));
66
67
  }
67
- function Re(e) {
68
- return Ie(e).filter((e) => e.targetPct > 0).sort((e, t) => t.targetPct - e.targetPct).map((e) => ({
68
+ function ze(e) {
69
+ return Le(e).filter((e) => e.targetPct > 0).sort((e, t) => t.targetPct - e.targetPct).map((e) => ({
69
70
  label: Q(e.assetClass),
70
71
  value: e.targetPct,
71
- tone: Fe(e.assetClass)
72
+ tone: Ie(e.assetClass)
72
73
  }));
73
74
  }
74
- var ze = {
75
+ var Be = {
75
76
  marketValue: 0,
76
77
  costBasis: 0,
77
78
  unrealizedGain: 0,
@@ -80,11 +81,11 @@ var ze = {
80
81
  maxDriftPct: null,
81
82
  driftAssetClass: null
82
83
  };
83
- function Be(e, t) {
84
- if (e.length === 0) return ze;
84
+ function Ve(e, t) {
85
+ if (e.length === 0) return Be;
85
86
  let n = 0, r = 0, i = /* @__PURE__ */ new Map();
86
87
  for (let t of e) n += t.marketValue, r += t.costBasis, i.set(t.assetClass, (i.get(t.assetClass) ?? 0) + t.marketValue);
87
- let a = n - r, o = Ie(t), s = null, c = null;
88
+ let a = n - r, o = Le(t), s = null, c = null;
88
89
  if (o.length > 0 && n > 0) {
89
90
  let e = new Set([...i.keys(), ...o.map((e) => e.assetClass)]);
90
91
  for (let t of e) {
@@ -102,21 +103,21 @@ function Be(e, t) {
102
103
  driftAssetClass: c
103
104
  };
104
105
  }
105
- function Ve({ value: e, currency: t }) {
106
- let n = e > 0, r = e < 0, i = n ? "text-status-success-text" : r ? "text-status-error-text" : "text-text-secondary", a = n ? k : r ? O : null;
107
- return /* @__PURE__ */ M("span", {
106
+ function He({ value: e, currency: t }) {
107
+ let n = e > 0, r = e < 0, i = n ? "text-status-success-text" : r ? "text-status-error-text" : "text-text-secondary", a = n ? A : r ? k : null;
108
+ return /* @__PURE__ */ P("span", {
108
109
  className: `inline-flex items-center justify-end gap-1 font-medium ${i}`,
109
110
  children: [
110
- a ? /* @__PURE__ */ j(a, {
111
+ a ? /* @__PURE__ */ N(a, {
111
112
  className: "size-3.5",
112
113
  "aria-hidden": "true"
113
114
  }) : null,
114
115
  n ? "+" : "",
115
- b(e, t)
116
+ x(e, t)
116
117
  ]
117
118
  });
118
119
  }
119
- function He() {
120
+ function Ue() {
120
121
  return {
121
122
  name: "",
122
123
  baseCurrency: "USD",
@@ -127,9 +128,9 @@ function He() {
127
128
  householdId: Z
128
129
  };
129
130
  }
130
- function Ue({ open: e, onOpenChange: t, editing: n }) {
131
- let { data: i } = o(), { data: s } = a(), c = r(), l = u(), [d, f] = D(He), [p, m] = D(null), h = n?.id ?? "new";
132
- e && p !== h && (m(h), f(n ? {
131
+ function We({ open: e, onOpenChange: t, editing: n }) {
132
+ let i = p(), { data: s } = o(), { data: c } = a(), l = r(), d = u(), [f, m] = O(Ue), [h, g] = O(null), _ = n?.id ?? "new";
133
+ e && h !== _ && (g(_), m(n ? {
133
134
  name: n.name,
134
135
  baseCurrency: n.baseCurrency,
135
136
  description: n.description ?? "",
@@ -137,193 +138,193 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
137
138
  status: n.status,
138
139
  modelPortfolioId: n.modelPortfolioId ?? Z,
139
140
  householdId: n.householdId ?? Z
140
- } : He())), !e && p !== null && m(null);
141
- let g = c.isPending || l.isPending, _ = d.name.trim().length > 0;
142
- return /* @__PURE__ */ j(B, {
141
+ } : Ue())), !e && h !== null && g(null);
142
+ let v = l.isPending || d.isPending, y = f.name.trim().length > 0;
143
+ return /* @__PURE__ */ N(G, {
143
144
  open: e,
144
145
  onOpenChange: t,
145
- children: /* @__PURE__ */ M(V, {
146
+ children: /* @__PURE__ */ P(K, {
146
147
  className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
147
148
  children: [
148
- /* @__PURE__ */ M(U, { children: [/* @__PURE__ */ j(W, { children: n ? "Edit portfolio" : "New portfolio" }), /* @__PURE__ */ j(fe, { children: n ? "Update this portfolio’s strategy settings." : "Create an investment portfolio to organize and rebalance holdings." })] }),
149
- /* @__PURE__ */ M("div", {
149
+ /* @__PURE__ */ P(_e, { children: [/* @__PURE__ */ N(ve, { children: n ? i("brainyrich.portfolios.form.editTitle", "Edit portfolio") : i("brainyrich.portfolios.form.newTitle", "New portfolio") }), /* @__PURE__ */ N(q, { children: n ? i("brainyrich.portfolios.form.editDescription", "Update this portfolio's strategy settings.") : i("brainyrich.portfolios.form.newDescription", "Create an investment portfolio to organize and rebalance holdings.") })] }),
150
+ /* @__PURE__ */ P("div", {
150
151
  className: "space-y-4 py-2",
151
152
  children: [
152
- /* @__PURE__ */ M("div", {
153
+ /* @__PURE__ */ P("div", {
153
154
  className: "space-y-1.5",
154
- children: [/* @__PURE__ */ j(q, {
155
+ children: [/* @__PURE__ */ N(W, {
155
156
  htmlFor: "pf-name",
156
- children: "Name"
157
- }), /* @__PURE__ */ j(K, {
157
+ children: i("brainyrich.portfolios.form.name", "Name")
158
+ }), /* @__PURE__ */ N(U, {
158
159
  id: "pf-name",
159
- value: d.name,
160
- onChange: (e) => f((t) => ({
160
+ value: f.name,
161
+ onChange: (e) => m((t) => ({
161
162
  ...t,
162
163
  name: e.target.value
163
164
  })),
164
- placeholder: "Growth Portfolio",
165
- "aria-invalid": !_
165
+ placeholder: i("brainyrich.portfolios.form.namePlaceholder", "Growth Portfolio"),
166
+ "aria-invalid": !y
166
167
  })]
167
168
  }),
168
- /* @__PURE__ */ M("div", {
169
+ /* @__PURE__ */ P("div", {
169
170
  className: "grid grid-cols-2 gap-4",
170
- children: [/* @__PURE__ */ M("div", {
171
+ children: [/* @__PURE__ */ P("div", {
171
172
  className: "space-y-1.5",
172
- children: [/* @__PURE__ */ j(q, {
173
+ children: [/* @__PURE__ */ N(W, {
173
174
  htmlFor: "pf-currency",
174
- children: "Base currency"
175
- }), /* @__PURE__ */ j(K, {
175
+ children: i("brainyrich.portfolios.form.currency", "Base currency")
176
+ }), /* @__PURE__ */ N(U, {
176
177
  id: "pf-currency",
177
- value: d.baseCurrency,
178
- onChange: (e) => f((t) => ({
178
+ value: f.baseCurrency,
179
+ onChange: (e) => m((t) => ({
179
180
  ...t,
180
181
  baseCurrency: e.target.value.toUpperCase()
181
182
  })),
182
- placeholder: "USD",
183
+ placeholder: i("brainyrich.portfolios.form.currencyPlaceholder", "USD"),
183
184
  maxLength: 3
184
185
  })]
185
- }), /* @__PURE__ */ M("div", {
186
+ }), /* @__PURE__ */ P("div", {
186
187
  className: "space-y-1.5",
187
- children: [/* @__PURE__ */ j(q, {
188
+ children: [/* @__PURE__ */ N(W, {
188
189
  htmlFor: "pf-drift",
189
- children: "Drift threshold %"
190
- }), /* @__PURE__ */ j(K, {
190
+ children: i("brainyrich.portfolios.form.driftThreshold", "Drift threshold %")
191
+ }), /* @__PURE__ */ N(U, {
191
192
  id: "pf-drift",
192
193
  type: "number",
193
194
  min: 0,
194
195
  step: "0.5",
195
- value: d.driftThresholdPct,
196
- onChange: (e) => f((t) => ({
196
+ value: f.driftThresholdPct,
197
+ onChange: (e) => m((t) => ({
197
198
  ...t,
198
199
  driftThresholdPct: e.target.value
199
200
  }))
200
201
  })]
201
202
  })]
202
203
  }),
203
- n ? /* @__PURE__ */ M("div", {
204
+ n ? /* @__PURE__ */ P("div", {
204
205
  className: "space-y-1.5",
205
- children: [/* @__PURE__ */ j(q, {
206
+ children: [/* @__PURE__ */ N(W, {
206
207
  htmlFor: "pf-status",
207
- children: "Status"
208
- }), /* @__PURE__ */ M(ve, {
209
- value: d.status,
210
- onValueChange: (e) => f((t) => ({
208
+ children: i("brainyrich.portfolios.form.status", "Status")
209
+ }), /* @__PURE__ */ P(ye, {
210
+ value: f.status,
211
+ onValueChange: (e) => m((t) => ({
211
212
  ...t,
212
213
  status: e
213
214
  })),
214
- children: [/* @__PURE__ */ j(be, {
215
+ children: [/* @__PURE__ */ N(xe, {
215
216
  id: "pf-status",
216
- children: /* @__PURE__ */ j(xe, {})
217
- }), /* @__PURE__ */ j(ye, { children: Ne.map((e) => /* @__PURE__ */ j(J, {
217
+ children: /* @__PURE__ */ N(Se, {})
218
+ }), /* @__PURE__ */ N(be, { children: Pe.map((e) => /* @__PURE__ */ N(J, {
218
219
  value: e,
219
220
  children: Q(e)
220
221
  }, e)) })]
221
222
  })]
222
223
  }) : null,
223
- /* @__PURE__ */ M("div", {
224
+ /* @__PURE__ */ P("div", {
224
225
  className: "space-y-1.5",
225
- children: [/* @__PURE__ */ j(q, {
226
+ children: [/* @__PURE__ */ N(W, {
226
227
  htmlFor: "pf-model",
227
- children: "Model portfolio"
228
- }), /* @__PURE__ */ M(ve, {
229
- value: d.modelPortfolioId,
230
- onValueChange: (e) => f((t) => ({
228
+ children: i("brainyrich.portfolios.form.modelPortfolio", "Model portfolio")
229
+ }), /* @__PURE__ */ P(ye, {
230
+ value: f.modelPortfolioId,
231
+ onValueChange: (e) => m((t) => ({
231
232
  ...t,
232
233
  modelPortfolioId: e
233
234
  })),
234
- children: [/* @__PURE__ */ j(be, {
235
+ children: [/* @__PURE__ */ N(xe, {
235
236
  id: "pf-model",
236
- children: /* @__PURE__ */ j(xe, { placeholder: "None" })
237
- }), /* @__PURE__ */ M(ye, { children: [/* @__PURE__ */ j(J, {
237
+ children: /* @__PURE__ */ N(Se, { placeholder: i("brainyrich.common.none", "None") })
238
+ }), /* @__PURE__ */ P(be, { children: [/* @__PURE__ */ N(J, {
238
239
  value: Z,
239
- children: "None"
240
- }), i.map((e) => /* @__PURE__ */ j(J, {
240
+ children: i("brainyrich.common.none", "None")
241
+ }), s.map((e) => /* @__PURE__ */ N(J, {
241
242
  value: e.id,
242
243
  children: e.name
243
244
  }, e.id))] })]
244
245
  })]
245
246
  }),
246
- n ? null : /* @__PURE__ */ M("div", {
247
+ n ? null : /* @__PURE__ */ P("div", {
247
248
  className: "space-y-1.5",
248
- children: [/* @__PURE__ */ j(q, {
249
+ children: [/* @__PURE__ */ N(W, {
249
250
  htmlFor: "pf-household",
250
- children: "Household"
251
- }), /* @__PURE__ */ M(ve, {
252
- value: d.householdId,
253
- onValueChange: (e) => f((t) => ({
251
+ children: i("brainyrich.portfolios.form.household", "Household")
252
+ }), /* @__PURE__ */ P(ye, {
253
+ value: f.householdId,
254
+ onValueChange: (e) => m((t) => ({
254
255
  ...t,
255
256
  householdId: e
256
257
  })),
257
- children: [/* @__PURE__ */ j(be, {
258
+ children: [/* @__PURE__ */ N(xe, {
258
259
  id: "pf-household",
259
- children: /* @__PURE__ */ j(xe, { placeholder: "None" })
260
- }), /* @__PURE__ */ M(ye, { children: [/* @__PURE__ */ j(J, {
260
+ children: /* @__PURE__ */ N(Se, { placeholder: i("brainyrich.common.none", "None") })
261
+ }), /* @__PURE__ */ P(be, { children: [/* @__PURE__ */ N(J, {
261
262
  value: Z,
262
- children: "None"
263
- }), s.map((e) => /* @__PURE__ */ j(J, {
263
+ children: i("brainyrich.common.none", "None")
264
+ }), c.map((e) => /* @__PURE__ */ N(J, {
264
265
  value: e.id,
265
266
  children: e.name
266
267
  }, e.id))] })]
267
268
  })]
268
269
  }),
269
- /* @__PURE__ */ M("div", {
270
+ /* @__PURE__ */ P("div", {
270
271
  className: "space-y-1.5",
271
- children: [/* @__PURE__ */ j(q, {
272
+ children: [/* @__PURE__ */ N(W, {
272
273
  htmlFor: "pf-desc",
273
- children: "Description"
274
- }), /* @__PURE__ */ j(je, {
274
+ children: i("brainyrich.portfolios.form.description", "Description")
275
+ }), /* @__PURE__ */ N(Me, {
275
276
  id: "pf-desc",
276
- value: d.description,
277
- onChange: (e) => f((t) => ({
277
+ value: f.description,
278
+ onChange: (e) => m((t) => ({
278
279
  ...t,
279
280
  description: e.target.value
280
281
  })),
281
- placeholder: "Optional notes about this strategy",
282
+ placeholder: i("brainyrich.portfolios.form.descriptionPlaceholder", "Optional notes about this strategy"),
282
283
  rows: 3
283
284
  })]
284
285
  })
285
286
  ]
286
287
  }),
287
- /* @__PURE__ */ M(H, { children: [/* @__PURE__ */ j(P, {
288
+ /* @__PURE__ */ P(ge, { children: [/* @__PURE__ */ N(I, {
288
289
  variant: "outline",
289
290
  onClick: () => t(!1),
290
- disabled: g,
291
- children: "Cancel"
292
- }), /* @__PURE__ */ j(P, {
291
+ disabled: v,
292
+ children: i("brainyrich.common.cancel", "Cancel")
293
+ }), /* @__PURE__ */ N(I, {
293
294
  onClick: () => {
294
- if (!_) return;
295
- let e = $(d.driftThresholdPct), r = d.modelPortfolioId === Z ? null : d.modelPortfolioId, i = d.householdId === Z ? null : d.householdId;
296
- n ? l.mutate({
295
+ if (!y) return;
296
+ let e = $(f.driftThresholdPct), r = f.modelPortfolioId === Z ? null : f.modelPortfolioId, a = f.householdId === Z ? null : f.householdId;
297
+ n ? d.mutate({
297
298
  id: n.id,
298
299
  input: {
299
- name: d.name.trim(),
300
- baseCurrency: d.baseCurrency.trim() || "USD",
301
- description: d.description.trim() || null,
300
+ name: f.name.trim(),
301
+ baseCurrency: f.baseCurrency.trim() || "USD",
302
+ description: f.description.trim() || null,
302
303
  driftThresholdPct: e,
303
- status: d.status,
304
+ status: f.status,
304
305
  modelPortfolioId: r
305
306
  }
306
307
  }, { onSuccess: () => {
307
- C(), w("Portfolio saved"), t(!1);
308
- } }) : c.mutate({
309
- name: d.name.trim(),
310
- baseCurrency: d.baseCurrency.trim() || "USD",
311
- description: d.description.trim() || null,
308
+ C(), w(i("brainyrich.portfolios.form.saved", "Portfolio saved")), t(!1);
309
+ } }) : l.mutate({
310
+ name: f.name.trim(),
311
+ baseCurrency: f.baseCurrency.trim() || "USD",
312
+ description: f.description.trim() || null,
312
313
  driftThresholdPct: e,
313
314
  modelPortfolioId: r,
314
- householdId: i
315
+ householdId: a
315
316
  }, { onSuccess: () => {
316
- C(), w("Portfolio created"), t(!1);
317
+ C(), w(i("brainyrich.portfolios.form.created", "Portfolio created")), t(!1);
317
318
  } });
318
319
  },
319
- disabled: !_ || g,
320
- children: g ? "Saving…" : n ? "Save changes" : "Create portfolio"
320
+ disabled: !y || v,
321
+ children: v ? i("brainyrich.common.saving", "Saving…") : n ? i("brainyrich.portfolios.form.saveChanges", "Save changes") : i("brainyrich.portfolios.form.create", "Create portfolio")
321
322
  })] })
322
323
  ]
323
324
  })
324
325
  });
325
326
  }
326
- function We() {
327
+ function Ge() {
327
328
  return {
328
329
  accountId: "",
329
330
  symbol: "",
@@ -334,9 +335,9 @@ function We() {
334
335
  costBasis: "0"
335
336
  };
336
337
  }
337
- function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
338
- let a = n(), o = l(), [s, c] = D(We), [u, d] = D(null), f = i?.id ?? "new";
339
- e && u !== f && (d(f), c(i ? {
338
+ function Ke({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
339
+ let a = p(), o = n(), s = l(), [c, u] = O(Ge), [d, f] = O(null), m = i?.id ?? "new";
340
+ e && d !== m && (f(m), u(i ? {
340
341
  accountId: i.accountId,
341
342
  symbol: i.symbol,
342
343
  name: i.name ?? "",
@@ -344,127 +345,127 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
344
345
  quantity: String(i.quantity),
345
346
  lastPrice: String(i.lastPrice),
346
347
  costBasis: String(i.costBasis)
347
- } : We())), !e && u !== null && d(null);
348
- let p = a.isPending || o.isPending, m = s.symbol.trim().length > 0, h = i ? !0 : s.accountId.trim().length > 0, g = m && h && !p;
349
- return /* @__PURE__ */ j(B, {
348
+ } : Ge())), !e && d !== null && f(null);
349
+ let h = o.isPending || s.isPending, g = c.symbol.trim().length > 0, _ = i ? !0 : c.accountId.trim().length > 0, y = g && _ && !h;
350
+ return /* @__PURE__ */ N(G, {
350
351
  open: e,
351
352
  onOpenChange: t,
352
- children: /* @__PURE__ */ M(V, {
353
+ children: /* @__PURE__ */ P(K, {
353
354
  className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
354
355
  children: [
355
- /* @__PURE__ */ M(U, { children: [/* @__PURE__ */ j(W, { children: i ? "Edit holding" : "Add holding" }), /* @__PURE__ */ j(fe, { children: i ? "Update the position details for this holding." : "Add a position to this portfolio from one of your accounts." })] }),
356
- /* @__PURE__ */ M("div", {
356
+ /* @__PURE__ */ P(_e, { children: [/* @__PURE__ */ N(ve, { children: i ? a("brainyrich.portfolios.holding.editTitle", "Edit holding") : a("brainyrich.portfolios.holding.addTitle", "Add holding") }), /* @__PURE__ */ N(q, { children: i ? a("brainyrich.portfolios.holding.editDescription", "Update the position details for this holding.") : a("brainyrich.portfolios.holding.addDescription", "Add a position to this portfolio from one of your accounts.") })] }),
357
+ /* @__PURE__ */ P("div", {
357
358
  className: "space-y-4 py-2",
358
359
  children: [
359
- i ? null : /* @__PURE__ */ j(_, {
360
+ i ? null : /* @__PURE__ */ N(v, {
360
361
  id: "h-account",
361
- value: s.accountId,
362
- onChange: (e) => c((t) => ({
362
+ value: c.accountId,
363
+ onChange: (e) => u((t) => ({
363
364
  ...t,
364
365
  accountId: e
365
366
  })),
366
- placeholder: "Select account"
367
+ placeholder: a("brainyrich.portfolios.holding.accountPlaceholder", "Select account")
367
368
  }),
368
- /* @__PURE__ */ M("div", {
369
+ /* @__PURE__ */ P("div", {
369
370
  className: "grid grid-cols-2 gap-4",
370
- children: [/* @__PURE__ */ M("div", {
371
+ children: [/* @__PURE__ */ P("div", {
371
372
  className: "space-y-1.5",
372
- children: [/* @__PURE__ */ j(q, {
373
+ children: [/* @__PURE__ */ N(W, {
373
374
  htmlFor: "h-symbol",
374
- children: "Symbol"
375
- }), /* @__PURE__ */ j(K, {
375
+ children: a("brainyrich.portfolios.holding.symbol", "Symbol")
376
+ }), /* @__PURE__ */ N(U, {
376
377
  id: "h-symbol",
377
- value: s.symbol,
378
- onChange: (e) => c((t) => ({
378
+ value: c.symbol,
379
+ onChange: (e) => u((t) => ({
379
380
  ...t,
380
381
  symbol: e.target.value
381
382
  })),
382
- placeholder: "AAPL",
383
+ placeholder: a("brainyrich.portfolios.holding.symbolPlaceholder", "AAPL"),
383
384
  disabled: !!i,
384
- "aria-invalid": !m
385
+ "aria-invalid": !g
385
386
  })]
386
- }), /* @__PURE__ */ M("div", {
387
+ }), /* @__PURE__ */ P("div", {
387
388
  className: "space-y-1.5",
388
- children: [/* @__PURE__ */ j(q, {
389
+ children: [/* @__PURE__ */ N(W, {
389
390
  htmlFor: "h-class",
390
- children: "Asset class"
391
- }), /* @__PURE__ */ M(ve, {
392
- value: s.assetClass,
393
- onValueChange: (e) => c((t) => ({
391
+ children: a("brainyrich.portfolios.holding.assetClass", "Asset class")
392
+ }), /* @__PURE__ */ P(ye, {
393
+ value: c.assetClass,
394
+ onValueChange: (e) => u((t) => ({
394
395
  ...t,
395
396
  assetClass: e
396
397
  })),
397
- children: [/* @__PURE__ */ j(be, {
398
+ children: [/* @__PURE__ */ N(xe, {
398
399
  id: "h-class",
399
- children: /* @__PURE__ */ j(xe, {})
400
- }), /* @__PURE__ */ j(ye, { children: Me.map((e) => /* @__PURE__ */ j(J, {
400
+ children: /* @__PURE__ */ N(Se, {})
401
+ }), /* @__PURE__ */ N(be, { children: Ne.map((e) => /* @__PURE__ */ N(J, {
401
402
  value: e,
402
403
  children: Q(e)
403
404
  }, e)) })]
404
405
  })]
405
406
  })]
406
407
  }),
407
- /* @__PURE__ */ M("div", {
408
+ /* @__PURE__ */ P("div", {
408
409
  className: "space-y-1.5",
409
- children: [/* @__PURE__ */ j(q, {
410
+ children: [/* @__PURE__ */ N(W, {
410
411
  htmlFor: "h-name",
411
- children: "Name"
412
- }), /* @__PURE__ */ j(K, {
412
+ children: a("brainyrich.portfolios.holding.name", "Name")
413
+ }), /* @__PURE__ */ N(U, {
413
414
  id: "h-name",
414
- value: s.name,
415
- onChange: (e) => c((t) => ({
415
+ value: c.name,
416
+ onChange: (e) => u((t) => ({
416
417
  ...t,
417
418
  name: e.target.value
418
419
  })),
419
- placeholder: "Apple Inc."
420
+ placeholder: a("brainyrich.portfolios.holding.namePlaceholder", "Apple Inc.")
420
421
  })]
421
422
  }),
422
- /* @__PURE__ */ M("div", {
423
+ /* @__PURE__ */ P("div", {
423
424
  className: "grid grid-cols-3 gap-4",
424
425
  children: [
425
- /* @__PURE__ */ M("div", {
426
+ /* @__PURE__ */ P("div", {
426
427
  className: "space-y-1.5",
427
- children: [/* @__PURE__ */ j(q, {
428
+ children: [/* @__PURE__ */ N(W, {
428
429
  htmlFor: "h-qty",
429
- children: "Quantity"
430
- }), /* @__PURE__ */ j(K, {
430
+ children: a("brainyrich.portfolios.holding.quantity", "Quantity")
431
+ }), /* @__PURE__ */ N(U, {
431
432
  id: "h-qty",
432
433
  type: "number",
433
434
  step: "any",
434
- value: s.quantity,
435
- onChange: (e) => c((t) => ({
435
+ value: c.quantity,
436
+ onChange: (e) => u((t) => ({
436
437
  ...t,
437
438
  quantity: e.target.value
438
439
  }))
439
440
  })]
440
441
  }),
441
- /* @__PURE__ */ M("div", {
442
+ /* @__PURE__ */ P("div", {
442
443
  className: "space-y-1.5",
443
- children: [/* @__PURE__ */ j(q, {
444
+ children: [/* @__PURE__ */ N(W, {
444
445
  htmlFor: "h-price",
445
- children: "Last price"
446
- }), /* @__PURE__ */ j(K, {
446
+ children: a("brainyrich.portfolios.holding.lastPrice", "Last price")
447
+ }), /* @__PURE__ */ N(U, {
447
448
  id: "h-price",
448
449
  type: "number",
449
450
  step: "any",
450
- value: s.lastPrice,
451
- onChange: (e) => c((t) => ({
451
+ value: c.lastPrice,
452
+ onChange: (e) => u((t) => ({
452
453
  ...t,
453
454
  lastPrice: e.target.value
454
455
  }))
455
456
  })]
456
457
  }),
457
- /* @__PURE__ */ M("div", {
458
+ /* @__PURE__ */ P("div", {
458
459
  className: "space-y-1.5",
459
- children: [/* @__PURE__ */ j(q, {
460
+ children: [/* @__PURE__ */ N(W, {
460
461
  htmlFor: "h-cost",
461
- children: "Cost basis"
462
- }), /* @__PURE__ */ j(K, {
462
+ children: a("brainyrich.portfolios.holding.costBasis", "Cost basis")
463
+ }), /* @__PURE__ */ N(U, {
463
464
  id: "h-cost",
464
465
  type: "number",
465
466
  step: "any",
466
- value: s.costBasis,
467
- onChange: (e) => c((t) => ({
467
+ value: c.costBasis,
468
+ onChange: (e) => u((t) => ({
468
469
  ...t,
469
470
  costBasis: e.target.value
470
471
  }))
@@ -474,159 +475,159 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
474
475
  })
475
476
  ]
476
477
  }),
477
- /* @__PURE__ */ M(H, { children: [/* @__PURE__ */ j(P, {
478
+ /* @__PURE__ */ P(ge, { children: [/* @__PURE__ */ N(I, {
478
479
  variant: "outline",
479
480
  onClick: () => t(!1),
480
- disabled: p,
481
- children: "Cancel"
482
- }), /* @__PURE__ */ j(P, {
481
+ disabled: h,
482
+ children: a("brainyrich.common.cancel", "Cancel")
483
+ }), /* @__PURE__ */ N(I, {
483
484
  onClick: () => {
484
- !m || !h || (i ? o.mutate({
485
+ !g || !_ || (i ? s.mutate({
485
486
  id: i.id,
486
487
  input: {
487
- name: s.name.trim() || null,
488
- assetClass: s.assetClass,
489
- quantity: $(s.quantity),
490
- lastPrice: $(s.lastPrice),
491
- costBasis: $(s.costBasis)
488
+ name: c.name.trim() || null,
489
+ assetClass: c.assetClass,
490
+ quantity: $(c.quantity),
491
+ lastPrice: $(c.lastPrice),
492
+ costBasis: $(c.costBasis)
492
493
  }
493
494
  }, { onSuccess: () => {
494
- C(), w("Holding saved"), t(!1);
495
- } }) : a.mutate({
496
- accountId: s.accountId,
495
+ C(), w(a("brainyrich.portfolios.holding.saved", "Holding saved")), t(!1);
496
+ } }) : o.mutate({
497
+ accountId: c.accountId,
497
498
  portfolioId: r,
498
- symbol: s.symbol.trim().toUpperCase(),
499
- name: s.name.trim() || null,
500
- assetClass: s.assetClass,
501
- quantity: $(s.quantity),
502
- lastPrice: $(s.lastPrice),
503
- costBasis: $(s.costBasis)
499
+ symbol: c.symbol.trim().toUpperCase(),
500
+ name: c.name.trim() || null,
501
+ assetClass: c.assetClass,
502
+ quantity: $(c.quantity),
503
+ lastPrice: $(c.lastPrice),
504
+ costBasis: $(c.costBasis)
504
505
  }, { onSuccess: () => {
505
- C(), w("Holding added"), t(!1);
506
+ C(), w(a("brainyrich.portfolios.holding.added", "Holding added")), t(!1);
506
507
  } }));
507
508
  },
508
- disabled: !g,
509
- children: p ? "Saving…" : i ? "Save changes" : "Add holding"
509
+ disabled: !y,
510
+ children: h ? a("brainyrich.common.saving", "Saving…") : i ? a("brainyrich.portfolios.holding.saveChanges", "Save changes") : a("brainyrich.portfolios.holding.add", "Add holding")
510
511
  })] })
511
512
  ]
512
513
  })
513
514
  });
514
515
  }
515
- function Ke({ portfolioId: t, onOpenChange: n }) {
516
- let { data: r, isLoading: a, isError: o, refetch: s } = c(t ?? void 0), l = e({ portfolioId: t ?? void 0 }, { enabled: t !== null }), u = i(), [d, _] = D(!1), [ie, v] = D(null), [C, w] = D(null), T = t ? l.data : [], O = r?.baseCurrency ?? "USD", k = T.reduce((e, t) => e + t.marketValue, 0), B = T.reduce((e, t) => e + t.costBasis, 0), V = k - B, fe = B > 0 ? V / B * 100 : 0, H = E(() => {
517
- if (T.length === 0 || k <= 0) return [];
516
+ function qe({ portfolioId: t, onOpenChange: n }) {
517
+ let { data: r, isLoading: a, isError: o, refetch: s } = c(t ?? void 0), l = e({ portfolioId: t ?? void 0 }, { enabled: t !== null }), u = i(), [d, p] = O(!1), [v, re] = O(null), [b, C] = O(null), w = D(() => t ? l.data : [], [t, l.data]), T = r?.baseCurrency ?? "USD", k = w.reduce((e, t) => e + t.marketValue, 0), A = w.reduce((e, t) => e + t.costBasis, 0), U = k - A, W = A > 0 ? U / A * 100 : 0, G = D(() => {
518
+ if (w.length === 0 || k <= 0) return [];
518
519
  let e = /* @__PURE__ */ new Map();
519
- return T.forEach((t) => e.set(t.assetClass, (e.get(t.assetClass) ?? 0) + t.marketValue)), Array.from(e.entries()).map(([e, t]) => ({
520
+ return w.forEach((t) => e.set(t.assetClass, (e.get(t.assetClass) ?? 0) + t.marketValue)), Array.from(e.entries()).map(([e, t]) => ({
520
521
  label: Q(e),
521
522
  value: t,
522
- tone: Fe(e)
523
+ tone: Ie(e)
523
524
  })).sort((e, t) => t.value - e.value);
524
- }, [T, k]), U = E(() => {
525
+ }, [w, k]), K = D(() => {
525
526
  let e = /* @__PURE__ */ new Map();
526
- return k <= 0 || T.forEach((t) => e.set(Q(t.assetClass), (e.get(Q(t.assetClass)) ?? 0) + t.marketValue / k * 100)), e;
527
- }, [T, k]), W = E(() => Le(r?.targetAllocation).map((e) => {
528
- let t = U.get(e.label) ?? 0;
527
+ return k <= 0 || w.forEach((t) => e.set(Q(t.assetClass), (e.get(Q(t.assetClass)) ?? 0) + t.marketValue / k * 100)), e;
528
+ }, [w, k]), q = D(() => Re(r?.targetAllocation).map((e) => {
529
+ let t = K.get(e.label) ?? 0;
529
530
  return {
530
531
  label: e.label,
531
532
  value: e.value,
532
533
  tone: "accent",
533
- caption: `${x(e.value, 0)} target · ${x(t, 0)} actual`
534
+ caption: `${S(e.value, 0)} target · ${S(t, 0)} actual`
534
535
  };
535
- }), [r?.targetAllocation, U]), K = () => {
536
- v(null), _(!0);
537
- }, q = (e) => {
538
- v(e), _(!0);
536
+ }), [r?.targetAllocation, K]), ge = () => {
537
+ re(null), p(!0);
538
+ }, _e = (e) => {
539
+ re(e), p(!0);
539
540
  };
540
- return /* @__PURE__ */ j(Se, {
541
+ return /* @__PURE__ */ N(Ce, {
541
542
  open: t !== null,
542
543
  onOpenChange: n,
543
- children: /* @__PURE__ */ j(Ce, {
544
+ children: /* @__PURE__ */ N(we, {
544
545
  className: "flex w-full flex-col gap-0 overflow-y-auto p-0 sm:max-w-2xl",
545
- children: a || t !== null && l.isPending ? /* @__PURE__ */ j("div", {
546
+ children: a || t !== null && l.isPending ? /* @__PURE__ */ N("div", {
546
547
  className: "p-6",
547
- children: /* @__PURE__ */ j(re, { rows: 5 })
548
- }) : o || l.isError ? /* @__PURE__ */ j("div", {
548
+ children: /* @__PURE__ */ N(ne, { rows: 5 })
549
+ }) : o || l.isError ? /* @__PURE__ */ N("div", {
549
550
  className: "p-6",
550
- children: /* @__PURE__ */ j(ne, { onRetry: () => {
551
+ children: /* @__PURE__ */ N(te, { onRetry: () => {
551
552
  s(), l.refetch();
552
553
  } })
553
- }) : r ? /* @__PURE__ */ M(de, { children: [
554
- /* @__PURE__ */ M(Te, {
554
+ }) : r ? /* @__PURE__ */ P(ue, { children: [
555
+ /* @__PURE__ */ P(Ee, {
555
556
  className: "border-b border-border-subtle p-6",
556
- children: [/* @__PURE__ */ M("div", {
557
+ children: [/* @__PURE__ */ P("div", {
557
558
  className: "flex items-center gap-2",
558
- children: [/* @__PURE__ */ j(Ee, {
559
+ children: [/* @__PURE__ */ N(De, {
559
560
  className: "text-xl",
560
561
  children: r.name
561
- }), /* @__PURE__ */ j(N, {
562
- variant: S(r.status),
562
+ }), /* @__PURE__ */ N(F, {
563
+ variant: ae(r.status),
563
564
  children: Q(r.status)
564
565
  })]
565
- }), /* @__PURE__ */ j(we, { children: r.description?.trim() ? r.description : `${r.baseCurrency} · Drift threshold ${x(r.driftThresholdPct)}` })]
566
+ }), /* @__PURE__ */ N(Te, { children: r.description?.trim() ? r.description : `${r.baseCurrency} · Drift threshold ${S(r.driftThresholdPct)}` })]
566
567
  }),
567
- /* @__PURE__ */ M("div", {
568
+ /* @__PURE__ */ P("div", {
568
569
  className: "space-y-6 p-6",
569
570
  children: [
570
- /* @__PURE__ */ M(m, {
571
+ /* @__PURE__ */ P(h, {
571
572
  className: "grid grid-cols-2 gap-3 lg:grid-cols-4",
572
573
  children: [
573
- /* @__PURE__ */ j(g, {
574
+ /* @__PURE__ */ N(_, {
574
575
  label: "Market value",
575
- value: b(k, O),
576
+ value: x(k, T),
576
577
  glow: !0
577
578
  }),
578
- /* @__PURE__ */ j(g, {
579
+ /* @__PURE__ */ N(_, {
579
580
  label: "Unrealized gain",
580
- value: b(V, O),
581
- delta: B > 0 ? fe : void 0,
582
- deltaTone: V > 0 ? "positive" : V < 0 ? "negative" : "neutral"
581
+ value: x(U, T),
582
+ delta: A > 0 ? W : void 0,
583
+ deltaTone: U > 0 ? "positive" : U < 0 ? "negative" : "neutral"
583
584
  }),
584
- /* @__PURE__ */ j(g, {
585
+ /* @__PURE__ */ N(_, {
585
586
  label: "Holdings",
586
- value: String(T.length)
587
+ value: String(w.length)
587
588
  }),
588
- /* @__PURE__ */ j(g, {
589
+ /* @__PURE__ */ N(_, {
589
590
  label: "Drift threshold",
590
- value: x(r.driftThresholdPct)
591
+ value: S(r.driftThresholdPct)
591
592
  })
592
593
  ]
593
594
  }),
594
- /* @__PURE__ */ j(m, {
595
+ /* @__PURE__ */ N(h, {
595
596
  index: 1,
596
- children: /* @__PURE__ */ M(h, {
597
+ children: /* @__PURE__ */ P(g, {
597
598
  glow: !0,
598
599
  className: "space-y-5",
599
- children: [/* @__PURE__ */ M("div", {
600
+ children: [/* @__PURE__ */ P("div", {
600
601
  className: "flex items-center justify-between gap-2",
601
- children: [/* @__PURE__ */ j("h3", {
602
+ children: [/* @__PURE__ */ N("h3", {
602
603
  className: "text-sm font-semibold text-text-primary",
603
604
  children: "Target vs actual allocation"
604
- }), /* @__PURE__ */ j(N, {
605
+ }), /* @__PURE__ */ N(F, {
605
606
  variant: "outline",
606
- children: O
607
+ children: T
607
608
  })]
608
- }), /* @__PURE__ */ M("div", {
609
+ }), /* @__PURE__ */ P("div", {
609
610
  className: "grid gap-6 md:grid-cols-2",
610
- children: [/* @__PURE__ */ M("div", {
611
+ children: [/* @__PURE__ */ P("div", {
611
612
  className: "space-y-2",
612
- children: [/* @__PURE__ */ j("p", {
613
+ children: [/* @__PURE__ */ N("p", {
613
614
  className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
614
615
  children: "Actual — by market value"
615
- }), H.length > 0 ? /* @__PURE__ */ j(p, {
616
- data: H,
617
- centerValue: y(k, O),
616
+ }), G.length > 0 ? /* @__PURE__ */ N(m, {
617
+ data: G,
618
+ centerValue: ie(k, T),
618
619
  centerLabel: "Market value",
619
- valueFormatter: (e) => b(e, O)
620
- }) : /* @__PURE__ */ j("p", {
620
+ valueFormatter: (e) => x(e, T)
621
+ }) : /* @__PURE__ */ N("p", {
621
622
  className: "py-8 text-center text-sm text-text-secondary",
622
623
  children: "Add holdings to see the live allocation."
623
624
  })]
624
- }), /* @__PURE__ */ M("div", {
625
+ }), /* @__PURE__ */ P("div", {
625
626
  className: "space-y-2",
626
- children: [/* @__PURE__ */ j("p", {
627
+ children: [/* @__PURE__ */ N("p", {
627
628
  className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
628
629
  children: "Target — vs live actual"
629
- }), W.length > 0 ? /* @__PURE__ */ j(ee, { data: W }) : /* @__PURE__ */ j("p", {
630
+ }), q.length > 0 ? /* @__PURE__ */ N(y, { data: q }) : /* @__PURE__ */ N("p", {
630
631
  className: "py-8 text-center text-sm text-text-secondary",
631
632
  children: "No target allocation set for this portfolio."
632
633
  })]
@@ -634,132 +635,132 @@ function Ke({ portfolioId: t, onOpenChange: n }) {
634
635
  })]
635
636
  })
636
637
  }),
637
- /* @__PURE__ */ j(F, { children: /* @__PURE__ */ j(I, {
638
+ /* @__PURE__ */ N(L, { children: /* @__PURE__ */ N(R, {
638
639
  className: "p-4",
639
- children: /* @__PURE__ */ j(ae, {
640
+ children: /* @__PURE__ */ N(E, {
640
641
  entityType: "brainyrich-portfolio",
641
642
  entityId: r.id
642
643
  })
643
644
  }) }),
644
- /* @__PURE__ */ M(F, { children: [/* @__PURE__ */ M(R, {
645
+ /* @__PURE__ */ P(L, { children: [/* @__PURE__ */ P(B, {
645
646
  className: "flex flex-row items-center justify-between",
646
- children: [/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j(z, {
647
+ children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N(V, {
647
648
  className: "text-base",
648
649
  children: "Holdings"
649
- }), /* @__PURE__ */ j(L, { children: "Positions held in this portfolio" })] }), /* @__PURE__ */ M(P, {
650
+ }), /* @__PURE__ */ N(z, { children: "Positions held in this portfolio" })] }), /* @__PURE__ */ P(I, {
650
651
  size: "sm",
651
- onClick: K,
652
- children: [/* @__PURE__ */ j(le, {
652
+ onClick: ge,
653
+ children: [/* @__PURE__ */ N(ce, {
653
654
  className: "size-4",
654
655
  "aria-hidden": "true"
655
656
  }), "Add holding"]
656
657
  })]
657
- }), /* @__PURE__ */ j(I, { children: T.length === 0 ? /* @__PURE__ */ j(te, {
658
- icon: /* @__PURE__ */ j(A, {
658
+ }), /* @__PURE__ */ N(R, { children: w.length === 0 ? /* @__PURE__ */ N(ee, {
659
+ icon: /* @__PURE__ */ N(j, {
659
660
  className: "size-6",
660
661
  "aria-hidden": "true"
661
662
  }),
662
663
  title: "No holdings yet",
663
664
  description: "Add positions to start tracking this portfolio.",
664
- action: /* @__PURE__ */ M(P, {
665
+ action: /* @__PURE__ */ P(I, {
665
666
  size: "sm",
666
- onClick: K,
667
- children: [/* @__PURE__ */ j(le, {
667
+ onClick: ge,
668
+ children: [/* @__PURE__ */ N(ce, {
668
669
  className: "size-4",
669
670
  "aria-hidden": "true"
670
671
  }), "Add holding"]
671
672
  })
672
- }) : /* @__PURE__ */ j("div", {
673
+ }) : /* @__PURE__ */ N("div", {
673
674
  className: "overflow-x-auto",
674
- children: /* @__PURE__ */ M(De, { children: [/* @__PURE__ */ j(ke, { children: /* @__PURE__ */ M(Ae, { children: [
675
- /* @__PURE__ */ j(X, { children: "Symbol" }),
676
- /* @__PURE__ */ j(X, { children: "Class" }),
677
- /* @__PURE__ */ j(X, {
675
+ children: /* @__PURE__ */ P(Oe, { children: [/* @__PURE__ */ N(Ae, { children: /* @__PURE__ */ P(je, { children: [
676
+ /* @__PURE__ */ N(X, { children: "Symbol" }),
677
+ /* @__PURE__ */ N(X, { children: "Class" }),
678
+ /* @__PURE__ */ N(X, {
678
679
  className: "text-right",
679
680
  children: "Qty"
680
681
  }),
681
- /* @__PURE__ */ j(X, {
682
+ /* @__PURE__ */ N(X, {
682
683
  className: "text-right",
683
684
  children: "Price"
684
685
  }),
685
- /* @__PURE__ */ j(X, {
686
+ /* @__PURE__ */ N(X, {
686
687
  className: "text-right",
687
688
  children: "Market value"
688
689
  }),
689
- /* @__PURE__ */ j(X, {
690
+ /* @__PURE__ */ N(X, {
690
691
  className: "text-right",
691
692
  children: "Gain"
692
693
  }),
693
- /* @__PURE__ */ j(X, { className: "w-10" })
694
- ] }) }), /* @__PURE__ */ j(Oe, { children: T.map((e) => {
694
+ /* @__PURE__ */ N(X, { className: "w-10" })
695
+ ] }) }), /* @__PURE__ */ N(ke, { children: w.map((e) => {
695
696
  let t = e.marketValue - e.costBasis, n = e.costBasis > 0 ? t / e.costBasis * 100 : 0;
696
- return /* @__PURE__ */ M(Ae, {
697
+ return /* @__PURE__ */ P(je, {
697
698
  className: "transition-colors motion-safe:hover:bg-bg-sunken/60",
698
699
  children: [
699
- /* @__PURE__ */ M(Y, { children: [/* @__PURE__ */ j("div", {
700
+ /* @__PURE__ */ P(Y, { children: [/* @__PURE__ */ N("div", {
700
701
  className: "font-semibold text-text-primary",
701
702
  children: e.symbol
702
- }), e.name ? /* @__PURE__ */ j("div", {
703
+ }), e.name ? /* @__PURE__ */ N("div", {
703
704
  className: "text-xs text-text-secondary",
704
705
  children: e.name
705
706
  }) : null] }),
706
- /* @__PURE__ */ j(Y, { children: /* @__PURE__ */ j(N, {
707
+ /* @__PURE__ */ N(Y, { children: /* @__PURE__ */ N(F, {
707
708
  variant: "outline",
708
709
  children: Q(e.assetClass)
709
710
  }) }),
710
- /* @__PURE__ */ j(Y, {
711
+ /* @__PURE__ */ N(Y, {
711
712
  className: "text-right tabular-nums",
712
713
  children: e.quantity
713
714
  }),
714
- /* @__PURE__ */ j(Y, {
715
+ /* @__PURE__ */ N(Y, {
715
716
  className: "text-right tabular-nums",
716
- children: b(e.lastPrice, e.currency)
717
+ children: x(e.lastPrice, e.currency)
717
718
  }),
718
- /* @__PURE__ */ j(Y, {
719
+ /* @__PURE__ */ N(Y, {
719
720
  className: "text-right font-medium tabular-nums",
720
- children: b(e.marketValue, e.currency)
721
+ children: x(e.marketValue, e.currency)
721
722
  }),
722
- /* @__PURE__ */ M(Y, {
723
+ /* @__PURE__ */ P(Y, {
723
724
  className: "text-right tabular-nums",
724
- children: [/* @__PURE__ */ j(Ve, {
725
+ children: [/* @__PURE__ */ N(He, {
725
726
  value: t,
726
727
  currency: e.currency
727
- }), e.costBasis > 0 ? /* @__PURE__ */ M("div", {
728
+ }), e.costBasis > 0 ? /* @__PURE__ */ P("div", {
728
729
  className: "text-xs text-text-secondary",
729
- children: [t > 0 ? "+" : "", x(n)]
730
+ children: [t > 0 ? "+" : "", S(n)]
730
731
  }) : null]
731
732
  }),
732
- /* @__PURE__ */ j(Y, {
733
+ /* @__PURE__ */ N(Y, {
733
734
  className: "text-right",
734
- children: /* @__PURE__ */ M(pe, { children: [/* @__PURE__ */ j(_e, {
735
+ children: /* @__PURE__ */ P(de, { children: [/* @__PURE__ */ N(he, {
735
736
  asChild: !0,
736
- children: /* @__PURE__ */ j(P, {
737
+ children: /* @__PURE__ */ N(I, {
737
738
  variant: "ghost",
738
739
  size: "icon",
739
740
  className: "size-10",
740
741
  "aria-label": `Actions for ${e.symbol}`,
741
- children: /* @__PURE__ */ j(se, {
742
+ children: /* @__PURE__ */ N(M, {
742
743
  className: "size-4",
743
744
  "aria-hidden": "true"
744
745
  })
745
746
  })
746
- }), /* @__PURE__ */ M(me, {
747
+ }), /* @__PURE__ */ P(fe, {
747
748
  align: "end",
748
749
  children: [
749
- /* @__PURE__ */ j(he, { children: e.symbol }),
750
- /* @__PURE__ */ j(ge, {}),
751
- /* @__PURE__ */ M(G, {
750
+ /* @__PURE__ */ N(pe, { children: e.symbol }),
751
+ /* @__PURE__ */ N(me, {}),
752
+ /* @__PURE__ */ P(H, {
752
753
  className: "gap-2",
753
- onClick: () => q(e),
754
- children: [/* @__PURE__ */ j(ce, {
754
+ onClick: () => _e(e),
755
+ children: [/* @__PURE__ */ N(se, {
755
756
  className: "size-4",
756
757
  "aria-hidden": "true"
757
758
  }), "Edit"]
758
759
  }),
759
- /* @__PURE__ */ M(G, {
760
+ /* @__PURE__ */ P(H, {
760
761
  className: "gap-2 text-status-error-text focus:text-status-error-text",
761
- onClick: () => w(e),
762
- children: [/* @__PURE__ */ j(ue, {
762
+ onClick: () => C(e),
763
+ children: [/* @__PURE__ */ N(le, {
763
764
  className: "size-4",
764
765
  "aria-hidden": "true"
765
766
  }), "Delete"]
@@ -771,51 +772,51 @@ function Ke({ portfolioId: t, onOpenChange: n }) {
771
772
  }, e.id);
772
773
  }) })] })
773
774
  }) })] }),
774
- /* @__PURE__ */ M(F, { children: [/* @__PURE__ */ M(R, {
775
+ /* @__PURE__ */ P(L, { children: [/* @__PURE__ */ P(B, {
775
776
  className: "pb-3",
776
- children: [/* @__PURE__ */ j(z, {
777
+ children: [/* @__PURE__ */ N(V, {
777
778
  className: "text-sm",
778
779
  children: "Tags"
779
- }), /* @__PURE__ */ j(L, { children: "Organize and filter this portfolio." })]
780
- }), /* @__PURE__ */ j(I, { children: /* @__PURE__ */ j(ae, {
780
+ }), /* @__PURE__ */ N(z, { children: "Organize and filter this portfolio." })]
781
+ }), /* @__PURE__ */ N(R, { children: /* @__PURE__ */ N(E, {
781
782
  entityType: "brainyrich-portfolio",
782
783
  entityId: r.id,
783
784
  hideLabel: !0
784
785
  }) })] }),
785
- /* @__PURE__ */ j(F, { children: /* @__PURE__ */ j(I, {
786
+ /* @__PURE__ */ N(L, { children: /* @__PURE__ */ N(R, {
786
787
  className: "pt-6",
787
- children: /* @__PURE__ */ j(oe, {
788
+ children: /* @__PURE__ */ N(oe, {
788
789
  entityType: "brainyrich-portfolio",
789
790
  entityId: r.id
790
791
  })
791
792
  }) })
792
793
  ]
793
794
  }),
794
- /* @__PURE__ */ j(Ge, {
795
+ /* @__PURE__ */ N(Ke, {
795
796
  open: d,
796
- onOpenChange: _,
797
+ onOpenChange: p,
797
798
  portfolioId: r.id,
798
- editing: ie
799
+ editing: v
799
800
  }),
800
- /* @__PURE__ */ j(f, {
801
- open: C !== null,
801
+ /* @__PURE__ */ N(f, {
802
+ open: b !== null,
802
803
  onOpenChange: (e) => {
803
- e || w(null);
804
+ e || C(null);
804
805
  },
805
806
  title: "Delete holding?",
806
- description: C ? `Remove ${C.symbol} from this portfolio. This cannot be undone.` : void 0,
807
+ description: b ? `Remove ${b.symbol} from this portfolio. This cannot be undone.` : void 0,
807
808
  confirmLabel: "Delete",
808
809
  pendingLabel: "Deleting…",
809
810
  destructive: !0,
810
811
  pending: u.isPending,
811
812
  onConfirm: () => {
812
- C && u.mutate(C.id, { onSuccess: () => w(null) });
813
+ b && u.mutate(b.id, { onSuccess: () => C(null) });
813
814
  }
814
815
  })
815
- ] }) : /* @__PURE__ */ j("div", {
816
+ ] }) : /* @__PURE__ */ N("div", {
816
817
  className: "p-6",
817
- children: /* @__PURE__ */ j(te, {
818
- icon: /* @__PURE__ */ j(A, {
818
+ children: /* @__PURE__ */ N(ee, {
819
+ icon: /* @__PURE__ */ N(j, {
819
820
  className: "size-6",
820
821
  "aria-hidden": "true"
821
822
  }),
@@ -826,24 +827,24 @@ function Ke({ portfolioId: t, onOpenChange: n }) {
826
827
  })
827
828
  });
828
829
  }
829
- function qe({ driftPct: e, thresholdPct: t, assetClass: n }) {
830
- let r = Math.abs(e), i = t > 0 && r > t, a = !i && t > 0 && r >= t * .75, o = t > 0 ? Math.min(100, r / t * 100) : 0, s = i ? "bg-status-error-bg" : a ? "bg-status-warning-bg" : "bg-accent-teal", c = i ? "text-status-error-text" : a ? "text-status-warning-text" : "text-text-secondary", l = n ? `Widest drift: ${Q(n)} ${e > 0 ? "over" : "under"}-weight by ${x(r)}` : `Widest drift ${x(r)}`;
831
- return /* @__PURE__ */ M("div", {
830
+ function Je({ driftPct: e, thresholdPct: t, assetClass: n }) {
831
+ let r = Math.abs(e), i = t > 0 && r > t, a = !i && t > 0 && r >= t * .75, o = t > 0 ? Math.min(100, r / t * 100) : 0, s = i ? "bg-status-error-bg" : a ? "bg-status-warning-bg" : "bg-accent-teal", c = i ? "text-status-error-text" : a ? "text-status-warning-text" : "text-text-secondary", l = n ? `Widest drift: ${Q(n)} ${e > 0 ? "over" : "under"}-weight by ${S(r)}` : `Widest drift ${S(r)}`;
832
+ return /* @__PURE__ */ P("div", {
832
833
  className: "space-y-1",
833
- children: [/* @__PURE__ */ M("div", {
834
+ children: [/* @__PURE__ */ P("div", {
834
835
  className: "flex items-center justify-between gap-2 text-xs",
835
- children: [/* @__PURE__ */ j("span", {
836
+ children: [/* @__PURE__ */ N("span", {
836
837
  className: "text-text-secondary",
837
838
  children: "Drift"
838
- }), /* @__PURE__ */ M("span", {
839
+ }), /* @__PURE__ */ P("span", {
839
840
  className: `font-medium tabular-nums ${c}`,
840
841
  children: [
841
842
  i ? "⚠ " : "",
842
843
  e > 0 ? "+" : "",
843
- x(e)
844
+ S(e)
844
845
  ]
845
846
  })]
846
- }), /* @__PURE__ */ j("div", {
847
+ }), /* @__PURE__ */ N("div", {
847
848
  className: "h-1.5 w-full overflow-hidden rounded-full bg-bg-sunken",
848
849
  role: "progressbar",
849
850
  "aria-valuenow": Math.round(o),
@@ -851,114 +852,114 @@ function qe({ driftPct: e, thresholdPct: t, assetClass: n }) {
851
852
  "aria-valuemax": 100,
852
853
  "aria-label": l,
853
854
  title: l,
854
- children: /* @__PURE__ */ j("div", {
855
+ children: /* @__PURE__ */ N("div", {
855
856
  className: `h-full rounded-full ${s}`,
856
857
  style: { width: `${o}%` }
857
858
  })
858
859
  })]
859
860
  });
860
861
  }
861
- function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i, onEdit: a, onArchive: o }) {
862
- let s = E(() => Re(e.targetAllocation), [e.targetAllocation]), c = s[0], l = e.tags ?? [];
863
- return /* @__PURE__ */ j(m, {
862
+ function Ye({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i, onEdit: a, onArchive: o }) {
863
+ let s = D(() => ze(e.targetAllocation), [e.targetAllocation]), c = s[0], l = e.tags ?? [];
864
+ return /* @__PURE__ */ N(h, {
864
865
  index: r,
865
866
  as: "div",
866
867
  className: "h-full",
867
- children: /* @__PURE__ */ M(F, {
868
+ children: /* @__PURE__ */ P(L, {
868
869
  className: "flex h-full flex-col transition-shadow motion-safe:hover:shadow-[var(--shadow-pop-hover,var(--shadow-elevation-2))]",
869
- children: [/* @__PURE__ */ M(R, {
870
+ children: [/* @__PURE__ */ P(B, {
870
871
  className: "pb-3",
871
- children: [/* @__PURE__ */ M("div", {
872
+ children: [/* @__PURE__ */ P("div", {
872
873
  className: "flex items-start justify-between gap-2",
873
- children: [/* @__PURE__ */ M("div", {
874
+ children: [/* @__PURE__ */ P("div", {
874
875
  className: "flex min-w-0 items-center gap-2",
875
876
  children: [
876
- /* @__PURE__ */ j("span", {
877
+ /* @__PURE__ */ N("span", {
877
878
  className: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-action-primary-bg)]/12 text-[var(--color-action-primary-text)]",
878
- children: /* @__PURE__ */ j(A, {
879
+ children: /* @__PURE__ */ N(j, {
879
880
  className: "size-4",
880
881
  "aria-hidden": "true"
881
882
  })
882
883
  }),
883
- /* @__PURE__ */ j(z, {
884
+ /* @__PURE__ */ N(V, {
884
885
  className: "truncate text-base",
885
886
  children: e.name
886
887
  }),
887
- /* @__PURE__ */ j(N, {
888
- variant: S(e.status),
888
+ /* @__PURE__ */ N(F, {
889
+ variant: ae(e.status),
889
890
  children: Q(e.status)
890
891
  })
891
892
  ]
892
- }), /* @__PURE__ */ M(pe, { children: [/* @__PURE__ */ j(_e, {
893
+ }), /* @__PURE__ */ P(de, { children: [/* @__PURE__ */ N(he, {
893
894
  asChild: !0,
894
- children: /* @__PURE__ */ j(P, {
895
+ children: /* @__PURE__ */ N(I, {
895
896
  variant: "ghost",
896
897
  size: "icon",
897
898
  className: "size-9 shrink-0",
898
899
  "aria-label": `Actions for ${e.name}`,
899
- children: /* @__PURE__ */ j(se, {
900
+ children: /* @__PURE__ */ N(M, {
900
901
  className: "size-4",
901
902
  "aria-hidden": "true"
902
903
  })
903
904
  })
904
- }), /* @__PURE__ */ M(me, {
905
+ }), /* @__PURE__ */ P(fe, {
905
906
  align: "end",
906
907
  children: [
907
- /* @__PURE__ */ j(he, { children: e.name }),
908
- /* @__PURE__ */ j(ge, {}),
909
- /* @__PURE__ */ M(G, {
908
+ /* @__PURE__ */ N(pe, { children: e.name }),
909
+ /* @__PURE__ */ N(me, {}),
910
+ /* @__PURE__ */ P(H, {
910
911
  className: "gap-2",
911
912
  onClick: a,
912
- children: [/* @__PURE__ */ j(ce, {
913
+ children: [/* @__PURE__ */ N(se, {
913
914
  className: "size-4",
914
915
  "aria-hidden": "true"
915
916
  }), "Edit"]
916
917
  }),
917
- /* @__PURE__ */ M(G, {
918
+ /* @__PURE__ */ P(H, {
918
919
  className: "gap-2 text-status-error-text focus:text-status-error-text",
919
920
  disabled: e.status === "ARCHIVED",
920
921
  onClick: o,
921
- children: [/* @__PURE__ */ j(ue, {
922
+ children: [/* @__PURE__ */ N(le, {
922
923
  className: "size-4",
923
924
  "aria-hidden": "true"
924
925
  }), "Archive"]
925
926
  })
926
927
  ]
927
928
  })] })]
928
- }), e.description?.trim() ? /* @__PURE__ */ j(L, {
929
+ }), e.description?.trim() ? /* @__PURE__ */ N(z, {
929
930
  className: "line-clamp-2",
930
931
  children: e.description
931
932
  }) : null]
932
- }), /* @__PURE__ */ M(I, {
933
+ }), /* @__PURE__ */ P(R, {
933
934
  className: "flex flex-1 flex-col justify-between gap-4",
934
935
  children: [
935
- n ? /* @__PURE__ */ j("p", {
936
+ n ? /* @__PURE__ */ N("p", {
936
937
  className: "text-sm text-text-secondary",
937
938
  children: "Valuation unavailable — positions could not be loaded."
938
- }) : t ? t.holdingCount > 0 ? /* @__PURE__ */ M("div", {
939
+ }) : t ? t.holdingCount > 0 ? /* @__PURE__ */ P("div", {
939
940
  className: "space-y-2",
940
- children: [/* @__PURE__ */ M("div", {
941
+ children: [/* @__PURE__ */ P("div", {
941
942
  className: "flex flex-wrap items-baseline gap-x-3 gap-y-1",
942
943
  children: [
943
- /* @__PURE__ */ j("span", {
944
+ /* @__PURE__ */ N("span", {
944
945
  className: "text-2xl font-semibold tabular-nums text-text-primary",
945
- children: y(t.marketValue, e.baseCurrency)
946
+ children: ie(t.marketValue, e.baseCurrency)
946
947
  }),
947
- t.gainPct === null ? null : /* @__PURE__ */ M("span", {
948
- className: `inline-flex items-center gap-1 text-sm font-medium tabular-nums ${v(t.unrealizedGain)}`,
948
+ t.gainPct === null ? null : /* @__PURE__ */ P("span", {
949
+ className: `inline-flex items-center gap-1 text-sm font-medium tabular-nums ${b(t.unrealizedGain)}`,
949
950
  children: [
950
- t.unrealizedGain > 0 ? /* @__PURE__ */ j(k, {
951
+ t.unrealizedGain > 0 ? /* @__PURE__ */ N(A, {
951
952
  className: "size-3.5",
952
953
  "aria-hidden": "true"
953
- }) : t.unrealizedGain < 0 ? /* @__PURE__ */ j(O, {
954
+ }) : t.unrealizedGain < 0 ? /* @__PURE__ */ N(k, {
954
955
  className: "size-3.5",
955
956
  "aria-hidden": "true"
956
957
  }) : null,
957
958
  t.unrealizedGain > 0 ? "+" : "",
958
- x(t.gainPct)
959
+ S(t.gainPct)
959
960
  ]
960
961
  }),
961
- /* @__PURE__ */ M("span", {
962
+ /* @__PURE__ */ P("span", {
962
963
  className: "text-xs text-text-secondary",
963
964
  children: [
964
965
  t.holdingCount,
@@ -967,71 +968,71 @@ function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i
967
968
  ]
968
969
  })
969
970
  ]
970
- }), t.maxDriftPct === null ? /* @__PURE__ */ j("p", {
971
+ }), t.maxDriftPct === null ? /* @__PURE__ */ N("p", {
971
972
  className: "text-xs text-text-secondary",
972
973
  children: "Drift needs a target allocation on this portfolio."
973
- }) : /* @__PURE__ */ j(qe, {
974
+ }) : /* @__PURE__ */ N(Je, {
974
975
  driftPct: t.maxDriftPct,
975
976
  thresholdPct: e.driftThresholdPct,
976
977
  assetClass: t.driftAssetClass
977
978
  })]
978
- }) : /* @__PURE__ */ j("p", {
979
+ }) : /* @__PURE__ */ N("p", {
979
980
  className: "text-sm text-text-secondary",
980
981
  children: "No holdings yet — add positions to value this portfolio."
981
- }) : /* @__PURE__ */ M("div", {
982
+ }) : /* @__PURE__ */ P("div", {
982
983
  className: "space-y-2",
983
984
  "aria-busy": "true",
984
- children: [/* @__PURE__ */ j("div", { className: "h-7 w-32 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ j("div", { className: "h-1.5 w-full animate-pulse rounded-full bg-bg-sunken" })]
985
+ children: [/* @__PURE__ */ N("div", { className: "h-7 w-32 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ N("div", { className: "h-1.5 w-full animate-pulse rounded-full bg-bg-sunken" })]
985
986
  }),
986
- /* @__PURE__ */ M("div", {
987
+ /* @__PURE__ */ P("div", {
987
988
  className: "grid grid-cols-[auto_1fr] items-center gap-4",
988
- children: [s.length > 0 ? /* @__PURE__ */ j("div", {
989
+ children: [s.length > 0 ? /* @__PURE__ */ N("div", {
989
990
  className: "w-28 shrink-0",
990
- children: /* @__PURE__ */ j(p, {
991
+ children: /* @__PURE__ */ N(m, {
991
992
  data: s,
992
993
  legend: !1,
993
994
  height: 112,
994
- centerValue: c ? x(c.value, 0) : void 0,
995
+ centerValue: c ? S(c.value, 0) : void 0,
995
996
  centerLabel: c?.label,
996
- valueFormatter: (e) => x(e, 0)
997
+ valueFormatter: (e) => S(e, 0)
997
998
  })
998
- }) : /* @__PURE__ */ M("div", {
999
+ }) : /* @__PURE__ */ P("div", {
999
1000
  className: "flex size-28 shrink-0 items-center justify-center rounded-full border border-dashed border-border-subtle text-center text-[10px] leading-tight text-text-secondary",
1000
1001
  children: [
1001
1002
  "No target",
1002
- /* @__PURE__ */ j("br", {}),
1003
+ /* @__PURE__ */ N("br", {}),
1003
1004
  "allocation"
1004
1005
  ]
1005
- }), /* @__PURE__ */ M("div", {
1006
+ }), /* @__PURE__ */ P("div", {
1006
1007
  className: "min-w-0 space-y-2",
1007
1008
  children: [
1008
- /* @__PURE__ */ M("div", {
1009
+ /* @__PURE__ */ P("div", {
1009
1010
  className: "flex flex-wrap items-center gap-1.5",
1010
- children: [/* @__PURE__ */ j(N, {
1011
+ children: [/* @__PURE__ */ N(F, {
1011
1012
  variant: "outline",
1012
1013
  children: e.baseCurrency
1013
- }), /* @__PURE__ */ M(N, {
1014
+ }), /* @__PURE__ */ P(F, {
1014
1015
  variant: "secondary",
1015
- children: ["Drift ≤ ", x(e.driftThresholdPct)]
1016
+ children: ["Drift ≤ ", S(e.driftThresholdPct)]
1016
1017
  })]
1017
1018
  }),
1018
- s.length > 0 ? /* @__PURE__ */ j("ul", {
1019
+ s.length > 0 ? /* @__PURE__ */ N("ul", {
1019
1020
  className: "space-y-1",
1020
1021
  "aria-label": "Target allocation",
1021
- children: s.slice(0, 3).map((e) => /* @__PURE__ */ M("li", {
1022
+ children: s.slice(0, 3).map((e) => /* @__PURE__ */ P("li", {
1022
1023
  className: "flex items-center gap-1.5 text-xs",
1023
- children: [/* @__PURE__ */ j("span", {
1024
+ children: [/* @__PURE__ */ N("span", {
1024
1025
  className: "truncate text-text-secondary",
1025
1026
  children: e.label
1026
- }), /* @__PURE__ */ j("span", {
1027
+ }), /* @__PURE__ */ N("span", {
1027
1028
  className: "ml-auto font-medium tabular-nums text-text-primary",
1028
- children: x(e.value, 0)
1029
+ children: S(e.value, 0)
1029
1030
  })]
1030
1031
  }, e.label))
1031
1032
  }) : null,
1032
- l.length > 0 ? /* @__PURE__ */ j("div", {
1033
+ l.length > 0 ? /* @__PURE__ */ N("div", {
1033
1034
  className: "flex flex-wrap gap-1",
1034
- children: l.slice(0, 3).map((e) => /* @__PURE__ */ j(N, {
1035
+ children: l.slice(0, 3).map((e) => /* @__PURE__ */ N(F, {
1035
1036
  variant: "outline",
1036
1037
  className: "text-[10px]",
1037
1038
  children: e
@@ -1040,7 +1041,7 @@ function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i
1040
1041
  ]
1041
1042
  })]
1042
1043
  }),
1043
- /* @__PURE__ */ j(P, {
1044
+ /* @__PURE__ */ N(I, {
1044
1045
  variant: "outline",
1045
1046
  size: "sm",
1046
1047
  className: "w-full",
@@ -1052,154 +1053,159 @@ function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i
1052
1053
  })
1053
1054
  });
1054
1055
  }
1055
- function Ye() {
1056
+ function Xe() {
1056
1057
  T("brainyrich.portfolios.viewed");
1057
- let { items: n, hasMore: r, loadMore: i, isLoading: a, isFetchingNextPage: o, isError: c, refetch: l } = s(), u = t(), p = e(), h = E(() => {
1058
+ let n = p(), { items: r, hasMore: i, loadMore: a, isLoading: o, isFetchingNextPage: c, isError: l, refetch: u } = s(), m = t(), g = e(), v = D(() => {
1058
1059
  let e = /* @__PURE__ */ new Map();
1059
- for (let t of p.data) {
1060
+ for (let t of g.data) {
1060
1061
  if (!t.portfolioId) continue;
1061
1062
  let n = e.get(t.portfolioId);
1062
1063
  n ? n.push(t) : e.set(t.portfolioId, [t]);
1063
1064
  }
1064
1065
  return e;
1065
- }, [p.data]), _ = E(() => {
1066
+ }, [g.data]), y = D(() => {
1066
1067
  let e = /* @__PURE__ */ new Map();
1067
- for (let t of n) e.set(t.id, Be(h.get(t.id) ?? [], t.targetAllocation));
1068
+ for (let t of r) e.set(t.id, Ve(v.get(t.id) ?? [], t.targetAllocation));
1068
1069
  return e;
1069
- }, [n, h]), [ee, v] = D(!1), [b, S] = D(null), [ae, oe] = D(null), [O, k] = D(null), se = n.filter((e) => e.status === "ACTIVE").length, ce = n.filter((e) => e.status === "DRAFT").length, ue = n.length > 0 ? n.reduce((e, t) => e + t.driftThresholdPct, 0) / n.length : 0, N = E(() => {
1070
+ }, [r, v]), [b, x] = O(!1), [ae, E] = O(null), [oe, k] = O(null), [A, M] = O(null), se = r.filter((e) => e.status === "ACTIVE").length, le = r.filter((e) => e.status === "DRAFT").length, F = r.length > 0 ? r.reduce((e, t) => e + t.driftThresholdPct, 0) / r.length : 0, L = D(() => {
1070
1071
  let e = /* @__PURE__ */ new Map();
1071
- for (let t of n) {
1072
- let n = _.get(t.id);
1072
+ for (let t of r) {
1073
+ let n = y.get(t.id);
1073
1074
  !n || n.holdingCount === 0 || e.set(t.baseCurrency, (e.get(t.baseCurrency) ?? 0) + n.marketValue);
1074
1075
  }
1075
1076
  return e;
1076
- }, [n, _]), F = Array.from(N.keys()).sort(), I = F.length === 1 ? F[0] : void 0, L = n.filter((e) => {
1077
- let t = _.get(e.id)?.maxDriftPct;
1077
+ }, [r, y]), R = Array.from(L.keys()).sort(), z = R.length === 1 ? R[0] : void 0, B = r.filter((e) => {
1078
+ let t = y.get(e.id)?.maxDriftPct;
1078
1079
  return t == null || e.driftThresholdPct <= 0 ? !1 : Math.abs(t) > e.driftThresholdPct;
1079
- }).length, R = () => {
1080
- S(null), v(!0);
1081
- }, z = (e) => {
1082
- S(e), v(!0);
1080
+ }).length, V = () => {
1081
+ E(null), x(!0);
1082
+ }, de = (e) => {
1083
+ E(e), x(!0);
1083
1084
  };
1084
- return /* @__PURE__ */ j("div", {
1085
+ return /* @__PURE__ */ N("div", {
1085
1086
  "data-tour": "brainyrich-page-portfolios",
1086
1087
  className: "contents",
1087
- children: /* @__PURE__ */ M(ie, {
1088
- title: "Portfolios",
1089
- description: "Organize holdings into strategies and keep allocations on target.",
1090
- badges: n.length > 0 ? [`${n.length} total`] : [],
1091
- actions: /* @__PURE__ */ M(P, {
1088
+ children: /* @__PURE__ */ P(re, {
1089
+ title: n("brainyrich.portfolios.title", "Portfolios"),
1090
+ description: n("brainyrich.portfolios.description", "Organize holdings into strategies and keep allocations on target."),
1091
+ badges: r.length > 0 ? [`${r.length} ${n("brainyrich.portfolios.totalSuffix", "total")}`] : [],
1092
+ actions: /* @__PURE__ */ P(I, {
1092
1093
  size: "sm",
1093
- onClick: R,
1094
- children: [/* @__PURE__ */ j(le, {
1094
+ onClick: V,
1095
+ children: [/* @__PURE__ */ N(ce, {
1095
1096
  className: "size-4",
1096
1097
  "aria-hidden": "true"
1097
- }), "New portfolio"]
1098
+ }), n("brainyrich.portfolios.actions.newPortfolio", "New portfolio")]
1098
1099
  }),
1099
1100
  children: [
1100
- a ? /* @__PURE__ */ j(re, { rows: 4 }) : c ? /* @__PURE__ */ j(ne, { onRetry: () => l() }) : n.length === 0 ? /* @__PURE__ */ j(te, {
1101
- icon: /* @__PURE__ */ j(A, {
1101
+ o ? /* @__PURE__ */ N(ne, { rows: 4 }) : l ? /* @__PURE__ */ N(te, { onRetry: () => u() }) : r.length === 0 ? /* @__PURE__ */ N(ee, {
1102
+ icon: /* @__PURE__ */ N(j, {
1102
1103
  className: "size-6",
1103
1104
  "aria-hidden": "true"
1104
1105
  }),
1105
- title: "No portfolios yet",
1106
- description: "Create your first portfolio to start organizing holdings and tracking drift.",
1107
- action: /* @__PURE__ */ M(P, {
1106
+ title: n("brainyrich.portfolios.empty.title", "No portfolios yet"),
1107
+ description: n("brainyrich.portfolios.empty.description", "Create your first portfolio to start organizing holdings and tracking drift."),
1108
+ action: /* @__PURE__ */ P(I, {
1108
1109
  size: "sm",
1109
- onClick: R,
1110
- children: [/* @__PURE__ */ j(le, {
1110
+ onClick: V,
1111
+ children: [/* @__PURE__ */ N(ce, {
1111
1112
  className: "size-4",
1112
1113
  "aria-hidden": "true"
1113
- }), "New portfolio"]
1114
+ }), n("brainyrich.portfolios.actions.newPortfolio", "New portfolio")]
1114
1115
  })
1115
- }) : /* @__PURE__ */ M(de, { children: [
1116
- /* @__PURE__ */ M(m, {
1116
+ }) : /* @__PURE__ */ P(ue, { children: [
1117
+ /* @__PURE__ */ P(h, {
1117
1118
  className: "grid grid-cols-2 gap-3 lg:grid-cols-5",
1118
1119
  children: [
1119
- /* @__PURE__ */ j(g, {
1120
- label: "Portfolios",
1121
- value: String(n.length),
1120
+ /* @__PURE__ */ N(_, {
1121
+ label: n("brainyrich.portfolios.metrics.count", "Portfolios"),
1122
+ value: String(r.length),
1122
1123
  glow: !0
1123
1124
  }),
1124
- /* @__PURE__ */ j(g, {
1125
- label: I ? `Total value (${I})` : "Total value",
1126
- value: p.isPending ? "…" : p.isError ? "—" : I ? y(N.get(I) ?? 0, I) : F.length === 0 ? "—" : `${F.length} currencies`
1125
+ /* @__PURE__ */ N(_, {
1126
+ label: z ? `${n("brainyrich.portfolios.metrics.totalValue", "Total value")} (${z})` : n("brainyrich.portfolios.metrics.totalValue", "Total value"),
1127
+ value: g.isPending ? "…" : g.isError ? "—" : z ? ie(L.get(z) ?? 0, z) : R.length === 0 ? "—" : `${R.length} currencies`
1127
1128
  }),
1128
- /* @__PURE__ */ j(g, {
1129
- label: "Active",
1129
+ /* @__PURE__ */ N(_, {
1130
+ label: n("brainyrich.portfolios.metrics.active", "Active"),
1130
1131
  value: String(se)
1131
1132
  }),
1132
- /* @__PURE__ */ j(g, {
1133
- label: "Drafts",
1134
- value: String(ce)
1133
+ /* @__PURE__ */ N(_, {
1134
+ label: n("brainyrich.portfolios.metrics.drafts", "Drafts"),
1135
+ value: String(le)
1135
1136
  }),
1136
- /* @__PURE__ */ j(g, {
1137
- label: "Past drift threshold",
1138
- value: p.isPending ? "…" : p.isError ? "—" : String(L)
1137
+ /* @__PURE__ */ N(_, {
1138
+ label: n("brainyrich.portfolios.metrics.pastDriftThreshold", "Past drift threshold"),
1139
+ value: g.isPending ? "…" : g.isError ? "—" : String(B)
1139
1140
  })
1140
1141
  ]
1141
1142
  }),
1142
- !p.isPending && !p.isError && F.length > 1 ? /* @__PURE__ */ M("p", {
1143
+ !g.isPending && !g.isError && R.length > 1 ? /* @__PURE__ */ P("p", {
1143
1144
  className: "text-xs text-text-secondary",
1144
1145
  children: [
1145
- "Market value is not FX-converted:",
1146
+ n("brainyrich.portfolios.footnote.notFxConverted", "Market value is not FX-converted"),
1147
+ ":",
1148
+ " ",
1149
+ R.map((e) => ie(L.get(e) ?? 0, e)).join(" · "),
1150
+ ".",
1146
1151
  " ",
1147
- F.map((e) => y(N.get(e) ?? 0, e)).join(" · "),
1148
- ". Average drift threshold ",
1149
- x(ue),
1152
+ n("brainyrich.portfolios.footnote.averageDriftThreshold", "Average drift threshold"),
1153
+ " ",
1154
+ S(F),
1150
1155
  "."
1151
1156
  ]
1152
- }) : /* @__PURE__ */ M("p", {
1157
+ }) : /* @__PURE__ */ P("p", {
1153
1158
  className: "text-xs text-text-secondary",
1154
1159
  children: [
1155
- "Average drift threshold across these portfolios: ",
1156
- x(ue),
1160
+ n("brainyrich.portfolios.footnote.averageDriftThresholdAcross", "Average drift threshold across these portfolios"),
1161
+ ": ",
1162
+ S(F),
1157
1163
  "."
1158
1164
  ]
1159
1165
  }),
1160
- /* @__PURE__ */ j("div", {
1166
+ /* @__PURE__ */ N("div", {
1161
1167
  className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
1162
- children: n.map((e, t) => /* @__PURE__ */ j(Je, {
1168
+ children: r.map((e, t) => /* @__PURE__ */ N(Ye, {
1163
1169
  portfolio: e,
1164
- valuation: p.isPending ? void 0 : _.get(e.id),
1165
- valuationError: p.isError,
1170
+ valuation: g.isPending ? void 0 : y.get(e.id),
1171
+ valuationError: g.isError,
1166
1172
  index: t,
1167
- onView: () => oe(e.id),
1168
- onEdit: () => z(e),
1169
- onArchive: () => k(e)
1173
+ onView: () => k(e.id),
1174
+ onEdit: () => de(e),
1175
+ onArchive: () => M(e)
1170
1176
  }, e.id))
1171
1177
  }),
1172
- /* @__PURE__ */ j(d, {
1173
- hasMore: r,
1174
- onClick: i,
1175
- loading: o
1178
+ /* @__PURE__ */ N(d, {
1179
+ hasMore: i,
1180
+ onClick: a,
1181
+ loading: c
1176
1182
  })
1177
1183
  ] }),
1178
- /* @__PURE__ */ j(Ue, {
1179
- open: ee,
1180
- onOpenChange: v,
1181
- editing: b
1184
+ /* @__PURE__ */ N(We, {
1185
+ open: b,
1186
+ onOpenChange: x,
1187
+ editing: ae
1182
1188
  }),
1183
- /* @__PURE__ */ j(Ke, {
1184
- portfolioId: ae,
1189
+ /* @__PURE__ */ N(qe, {
1190
+ portfolioId: oe,
1185
1191
  onOpenChange: (e) => {
1186
- e || oe(null);
1192
+ e || k(null);
1187
1193
  }
1188
1194
  }),
1189
- /* @__PURE__ */ j(f, {
1190
- open: O !== null,
1195
+ /* @__PURE__ */ N(f, {
1196
+ open: A !== null,
1191
1197
  onOpenChange: (e) => {
1192
- e || k(null);
1198
+ e || M(null);
1193
1199
  },
1194
- title: "Archive portfolio?",
1195
- description: O ? `Archive “${O.name}”. It will move to archived status and stop appearing in active views.` : void 0,
1196
- confirmLabel: "Archive",
1197
- pendingLabel: "Archiving…",
1200
+ title: n("brainyrich.portfolios.archive.title", "Archive portfolio?"),
1201
+ description: A ? n("brainyrich.portfolios.archive.description", `Archive "${A.name}". It will move to archived status and stop appearing in active views.`, { name: A.name }) : void 0,
1202
+ confirmLabel: n("brainyrich.portfolios.archive.confirm", "Archive"),
1203
+ pendingLabel: n("brainyrich.portfolios.archive.pending", "Archiving…"),
1198
1204
  destructive: !0,
1199
- pending: u.isPending,
1205
+ pending: m.isPending,
1200
1206
  onConfirm: () => {
1201
- O && u.mutate(O.id, { onSuccess: () => {
1202
- C(), w("Portfolio archived"), k(null);
1207
+ A && m.mutate(A.id, { onSuccess: () => {
1208
+ C(), w(n("brainyrich.portfolios.archive.success", "Portfolio archived")), M(null);
1203
1209
  } });
1204
1210
  }
1205
1211
  })
@@ -1208,6 +1214,6 @@ function Ye() {
1208
1214
  });
1209
1215
  }
1210
1216
  //#endregion
1211
- export { Ye as PortfoliosPage };
1217
+ export { Xe as PortfoliosPage };
1212
1218
 
1213
1219
  //# sourceMappingURL=PortfoliosPage.js.map