@mx-cartographer/experiences 6.26.0-alpha.sms7 → 6.26.1-alpha.mega1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -1
- package/dist/AccountStore-DkL93tXL.mjs +317 -0
- package/dist/AccountStore-DkL93tXL.mjs.map +1 -0
- package/dist/BudgetUtil-CVqAdv-j.mjs +187 -0
- package/dist/BudgetUtil-CVqAdv-j.mjs.map +1 -0
- package/dist/CashflowStore-gPEEBiXo.mjs +53 -0
- package/dist/CashflowStore-gPEEBiXo.mjs.map +1 -0
- package/dist/CategoryStore-m7oieLzP.mjs +260 -0
- package/dist/CategoryStore-m7oieLzP.mjs.map +1 -0
- package/dist/ConnectMiniWidget-CQWafYtQ.mjs +22966 -0
- package/dist/ConnectMiniWidget-CQWafYtQ.mjs.map +1 -0
- package/dist/DebtsStore-cUhIgJx6.mjs +145 -0
- package/dist/DebtsStore-cUhIgJx6.mjs.map +1 -0
- package/dist/Donut-CGNFni9y.mjs +58 -0
- package/dist/Donut-CGNFni9y.mjs.map +1 -0
- package/dist/FinstrongStore-BDG7l0nI.mjs +183 -0
- package/dist/FinstrongStore-BDG7l0nI.mjs.map +1 -0
- package/dist/GoalStore-o2waGeyf.mjs +293 -0
- package/dist/GoalStore-o2waGeyf.mjs.map +1 -0
- package/dist/Loader-CwdK8lfx.mjs +147 -0
- package/dist/Loader-CwdK8lfx.mjs.map +1 -0
- package/dist/MerchantStore-Cck9IGIH.mjs +125 -0
- package/dist/MerchantStore-Cck9IGIH.mjs.map +1 -0
- package/dist/NetWorthStore-D5eUfGQt.mjs +66 -0
- package/dist/NetWorthStore-D5eUfGQt.mjs.map +1 -0
- package/dist/NotificationStore-DCxw8W7u.mjs +141 -0
- package/dist/NotificationStore-DCxw8W7u.mjs.map +1 -0
- package/dist/RecurringTransactionsStore-Bijrgllq.mjs +337 -0
- package/dist/RecurringTransactionsStore-Bijrgllq.mjs.map +1 -0
- package/dist/SettingsStore-BhOYgUOa.mjs +352 -0
- package/dist/SettingsStore-BhOYgUOa.mjs.map +1 -0
- package/dist/TransactionApi-Dnbyi1JL.mjs +175 -0
- package/dist/TransactionApi-Dnbyi1JL.mjs.map +1 -0
- package/dist/TransactionStore-CiEtt5XJ.mjs +417 -0
- package/dist/TransactionStore-CiEtt5XJ.mjs.map +1 -0
- package/dist/TrendsStore-Idq3QfoA.mjs +131 -0
- package/dist/TrendsStore-Idq3QfoA.mjs.map +1 -0
- package/dist/accounts/index.es.js +18 -0
- package/dist/accounts/index.es.js.map +1 -0
- package/dist/analytics/index.es.js +170 -0
- package/dist/analytics/index.es.js.map +1 -0
- package/dist/budgets/index.es.js +1116 -0
- package/dist/budgets/index.es.js.map +1 -0
- package/dist/cashflow/index.es.js +118 -0
- package/dist/cashflow/index.es.js.map +1 -0
- package/dist/categories/index.es.js +10 -0
- package/dist/categories/index.es.js.map +1 -0
- package/dist/categories/util/CategoryUtil.d.ts +3 -2
- package/dist/common/components/charts/StackedLineChart.d.ts +2 -2
- package/dist/common/components/charts/stackedlinechart/CustomLegend.d.ts +1 -0
- package/dist/common/context/hooks.d.ts +13 -13
- package/dist/common/index.es.js +1549 -0
- package/dist/common/index.es.js.map +1 -0
- package/dist/common/types/AppData.d.ts +2 -0
- package/dist/common/types/Category.d.ts +2 -8
- package/dist/common/types/index.d.ts +1 -1
- package/dist/dashboard/index.es.js +257 -0
- package/dist/dashboard/index.es.js.map +1 -0
- package/dist/debts/index.es.js +9 -0
- package/dist/debts/index.es.js.map +1 -0
- package/dist/finstrong/index.es.js +11 -0
- package/dist/finstrong/index.es.js.map +1 -0
- package/dist/goals/index.es.js +9 -0
- package/dist/goals/index.es.js.map +1 -0
- package/dist/help/components/content/section/index.d.ts +15 -15
- package/dist/help/index.es.js +6 -0
- package/dist/help/index.es.js.map +1 -0
- package/dist/investments/index.es.js +1694 -0
- package/dist/investments/index.es.js.map +1 -0
- package/dist/merchants/index.es.js +7 -0
- package/dist/merchants/index.es.js.map +1 -0
- package/dist/microinsights/index.es.js +21 -0
- package/dist/microinsights/index.es.js.map +1 -0
- package/dist/networth/index.es.js +11 -0
- package/dist/networth/index.es.js.map +1 -0
- package/dist/notifications/index.es.js +116 -0
- package/dist/notifications/index.es.js.map +1 -0
- package/dist/recurringtransactions/index.es.js +14 -0
- package/dist/recurringtransactions/index.es.js.map +1 -0
- package/dist/settings/index.es.js +112 -0
- package/dist/settings/index.es.js.map +1 -0
- package/dist/spending/index.es.js +632 -0
- package/dist/spending/index.es.js.map +1 -0
- package/dist/transactions/index.es.js +19 -0
- package/dist/transactions/index.es.js.map +1 -0
- package/dist/trends/components/CategoriesList.d.ts +5 -5
- package/dist/trends/components/CategoriesListItem.d.ts +7 -4
- package/dist/trends/components/CategoryDetailChart.d.ts +5 -1
- package/dist/trends/index.es.js +10 -0
- package/dist/trends/index.es.js.map +1 -0
- package/dist/trends/stores/TrendsStore.d.ts +11 -16
- package/package.json +91 -3
- package/dist/index.d.ts +0 -22
- package/dist/index.es.js +0 -29873
- package/dist/index.es.js.map +0 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { makeAutoObservable as l } from "mobx";
|
|
2
|
+
import { getDate as a, fromUnixTime as n, startOfMonth as s } from "date-fns";
|
|
3
|
+
import "bowser";
|
|
4
|
+
import "date-fns/getUnixTime";
|
|
5
|
+
import "date-fns/intlFormat";
|
|
6
|
+
import { aS as b, aZ as u } from "./ConnectMiniWidget-CQWafYtQ.mjs";
|
|
7
|
+
import "date-fns/addMonths";
|
|
8
|
+
import "date-fns/addQuarters";
|
|
9
|
+
import "date-fns/addWeeks";
|
|
10
|
+
import "date-fns/addYears";
|
|
11
|
+
import "date-fns/getDay";
|
|
12
|
+
import "date-fns/isBefore";
|
|
13
|
+
import "date-fns/nextDay";
|
|
14
|
+
import "date-fns/setDate";
|
|
15
|
+
import "date-fns/startOfToday";
|
|
16
|
+
import "date-fns/fromUnixTime";
|
|
17
|
+
import "react";
|
|
18
|
+
import "numeral";
|
|
19
|
+
import "@mui/material";
|
|
20
|
+
import "react/jsx-runtime";
|
|
21
|
+
import "@mui/material/Button";
|
|
22
|
+
import "@mxenabled/mxui";
|
|
23
|
+
import "@mui/material/Tooltip";
|
|
24
|
+
import "@mui/material/Box";
|
|
25
|
+
import "@mui/material/IconButton";
|
|
26
|
+
import "./Loader-CwdK8lfx.mjs";
|
|
27
|
+
import "@mui/material/styles/useTheme";
|
|
28
|
+
import "@mui/material/useMediaQuery";
|
|
29
|
+
import "@mxenabled/cssinjs";
|
|
30
|
+
import "date-fns/addDays";
|
|
31
|
+
import "date-fns/eachDayOfInterval";
|
|
32
|
+
import "date-fns/eachWeekOfInterval";
|
|
33
|
+
import "date-fns/endOfMonth";
|
|
34
|
+
import "date-fns/format";
|
|
35
|
+
import "date-fns/isSameMonth";
|
|
36
|
+
import "date-fns/startOfMonth";
|
|
37
|
+
import "date-fns/subMonths";
|
|
38
|
+
import "@mui/material/Paper";
|
|
39
|
+
import "@mxenabled/mx-icons";
|
|
40
|
+
import "date-fns/isSameDay";
|
|
41
|
+
import "date-fns/isWithinInterval";
|
|
42
|
+
import "d3";
|
|
43
|
+
import "@mui/material/styles";
|
|
44
|
+
import "@mui/x-charts";
|
|
45
|
+
import "@mui/x-charts/ChartsTooltip";
|
|
46
|
+
import "@mui/material/Stack";
|
|
47
|
+
import "date-fns/differenceInCalendarDays";
|
|
48
|
+
import "date-fns/endOfToday";
|
|
49
|
+
import "date-fns/endOfYear";
|
|
50
|
+
import "date-fns/startOfYear";
|
|
51
|
+
import "date-fns/subDays";
|
|
52
|
+
import "date-fns/subYears";
|
|
53
|
+
import "@mui/material/ButtonGroup";
|
|
54
|
+
import "@mui/material/Tab";
|
|
55
|
+
import "@mui/material/Tabs";
|
|
56
|
+
import "@mui/material/ToggleButton";
|
|
57
|
+
import "@mui/material/ToggleButtonGroup";
|
|
58
|
+
import "@mui/material/Dialog";
|
|
59
|
+
import "@mui/material/DialogContent";
|
|
60
|
+
import "@mui/material/Card";
|
|
61
|
+
import "@mui/material/CardContent";
|
|
62
|
+
import "@mui/material/CardHeader";
|
|
63
|
+
import "uuid";
|
|
64
|
+
import "@mui/material/CircularProgress";
|
|
65
|
+
import "@mui/material/FormControlLabel";
|
|
66
|
+
import "@mui/material/Radio";
|
|
67
|
+
import "@mui/material/Avatar";
|
|
68
|
+
import "@mui/material/ListItem";
|
|
69
|
+
import "@mui/material/ListItemAvatar";
|
|
70
|
+
import "@mui/material/ListItemButton";
|
|
71
|
+
import "@mui/material/ListItemText";
|
|
72
|
+
import "@mui/material/ListItemIcon";
|
|
73
|
+
import "@mui/material/MenuItem";
|
|
74
|
+
import "@mui/material/TextField";
|
|
75
|
+
import "@mui/material/Switch";
|
|
76
|
+
import "posthog-js";
|
|
77
|
+
import "date-fns/differenceInDays";
|
|
78
|
+
import "@mui/x-data-grid-pro";
|
|
79
|
+
import "@mui/material/Divider";
|
|
80
|
+
import "@mui/material/List";
|
|
81
|
+
import "date-fns/formatISO";
|
|
82
|
+
import "date-fns/isAfter";
|
|
83
|
+
import "date-fns/parseISO";
|
|
84
|
+
import "date-fns/subQuarters";
|
|
85
|
+
import "date-fns/lastDayOfMonth";
|
|
86
|
+
import "date-fns/setDayOfYear";
|
|
87
|
+
import "date-fns/addSeconds";
|
|
88
|
+
import "date-fns/differenceInCalendarMonths";
|
|
89
|
+
import "date-fns/getMonth";
|
|
90
|
+
const c = {
|
|
91
|
+
unnamed_label: "Unnamed Debt"
|
|
92
|
+
};
|
|
93
|
+
function y(i, e) {
|
|
94
|
+
const t = i.filter((r) => r.account_type === b.CHECKING_LINE_OF_CREDIT ? Number(r.balance) <= 0 : r.is_excluded_from_debts !== !0), o = e.filter((r) => t.some((m) => m.guid === r.account_guid)).map(
|
|
95
|
+
(r) => d(t.find((m) => m.guid === r.account_guid), r)
|
|
96
|
+
), p = t.filter((r) => !o.some((m) => m.account.guid === r.guid)).map((r) => d(r));
|
|
97
|
+
return [...o, ...p];
|
|
98
|
+
}
|
|
99
|
+
function d(i, e) {
|
|
100
|
+
const t = { account: i, goal: e, guid: i.guid };
|
|
101
|
+
if (e) {
|
|
102
|
+
const o = e.payment_due_at ? a(n(e.payment_due_at)) : 1, p = s(/* @__PURE__ */ new Date()).setDate(o);
|
|
103
|
+
t.balance = Math.abs(e.amount - e.current_amount), t.interest_rate = e.interest_rate, t.is_paid_off = e.is_complete, t.monthly_payment = e.monthly_payment, t.name = e.name, t.original_balance = e.initial_amount, t.payment_due_date = p;
|
|
104
|
+
} else {
|
|
105
|
+
const o = i.payment_due_at ? a(n(i.payment_due_at)) : 1, p = s(/* @__PURE__ */ new Date()).setDate(o), r = i.balance ?? 0, m = i.minimum_payment ?? void 0, _ = i.interest_rate ?? i.apr ?? i.apy;
|
|
106
|
+
t.balance = Math.max(r, 0), t.interest_rate = _, t.is_paid_off = r === 0, t.monthly_payment = m, t.name = i?.name ?? c.unnamed_label, t.original_balance = i.original_balance, t.payment_due_date = p;
|
|
107
|
+
}
|
|
108
|
+
return t.is_impossible = !1, t.priority = void 0, t.projected_payoff_date = void 0, t;
|
|
109
|
+
}
|
|
110
|
+
class D {
|
|
111
|
+
isLoading = !1;
|
|
112
|
+
selectedDebtChartData = {};
|
|
113
|
+
selectedDebtPriority = u.LOWEST_BALANCE;
|
|
114
|
+
constructor() {
|
|
115
|
+
l(this);
|
|
116
|
+
}
|
|
117
|
+
get showError() {
|
|
118
|
+
const { interest_rate: e, monthly_payment: t } = this.selectedDebtChartData;
|
|
119
|
+
return e === void 0 || t === void 0;
|
|
120
|
+
}
|
|
121
|
+
get showCompleted() {
|
|
122
|
+
return this.selectedDebtChartData.is_paid_off;
|
|
123
|
+
}
|
|
124
|
+
setIsLoading = (e) => this.isLoading = e;
|
|
125
|
+
setSelectedDebtChartData = (e) => this.selectedDebtChartData = e;
|
|
126
|
+
setSelectedDebtPriority = (e) => this.selectedDebtPriority = e;
|
|
127
|
+
}
|
|
128
|
+
class $t {
|
|
129
|
+
globalStore;
|
|
130
|
+
uiStore;
|
|
131
|
+
constructor(e) {
|
|
132
|
+
this.globalStore = e, this.uiStore = new D(), l(this);
|
|
133
|
+
}
|
|
134
|
+
get debts() {
|
|
135
|
+
const { visibleDebtAccounts: e } = this.globalStore.accountStore, { debtGoals: t } = this.globalStore.goalStore;
|
|
136
|
+
return y(e, t);
|
|
137
|
+
}
|
|
138
|
+
get totalMonthlyPayments() {
|
|
139
|
+
return this.debts.map((t) => Number(t.monthly_payment)).filter((t) => !isNaN(t)).reduce((t, o) => t + o, 0);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
$t as D
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=DebtsStore-cUhIgJx6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DebtsStore-cUhIgJx6.mjs","sources":["../src/debts/utils/DebtStore.ts","../src/debts/store/DebtsUiStore.ts","../src/debts/store/DebtsStore.ts"],"sourcesContent":["import { fromUnixTime, getDate, startOfMonth } from 'date-fns'\nimport { AccountType, type Account, type Debt, type Goal } from '../../common'\n\nconst copy = {\n unnamed_label: 'Unnamed Debt',\n}\n\nfunction loadDebts(accounts: Account[], goals: Goal[]): Debt[] {\n const debtAccounts = accounts.filter((acc) => {\n // Exclude checking line of credit accounts with positive balance\n // Q: Because CLOC spending is represented by negative? (this logic is from raja)\n if (acc.account_type === AccountType.CHECKING_LINE_OF_CREDIT) {\n return Number(acc.balance) <= 0\n }\n // Exclude explicity excluded acccounts\n return acc.is_excluded_from_debts !== true\n })\n\n // Creat debts with associated goals\n const goalDebts = goals\n .filter((goal) => debtAccounts.some((acc) => acc.guid === goal.account_guid))\n .map((goal) =>\n createDebt(debtAccounts.find((acc) => acc.guid === goal.account_guid) as Account, goal),\n )\n\n // Create debts without associated goals, but are based on liabity accounts\n const liabilityDebts = debtAccounts\n .filter((acc) => !goalDebts.some((debt) => debt.account.guid === acc.guid))\n .map((account) => createDebt(account))\n\n return [...goalDebts, ...liabilityDebts]\n}\n\nfunction createDebt(account: Account, goal?: Goal): Debt {\n const debt = { account, goal, guid: account.guid } as Debt\n\n if (goal) {\n // Derive next payment date; default to 1st of month\n const paymentDay = goal.payment_due_at ? getDate(fromUnixTime(goal.payment_due_at)) : 1\n const paymentDueDate = startOfMonth(new Date()).setDate(paymentDay)\n\n debt.balance = Math.abs(goal.amount - goal.current_amount)\n debt.interest_rate = goal.interest_rate\n debt.is_paid_off = goal.is_complete\n debt.monthly_payment = goal.monthly_payment\n debt.name = goal.name\n debt.original_balance = goal.initial_amount // TODO: Does a debt need this?\n debt.payment_due_date = paymentDueDate\n } else {\n // Derive next payment date; default to 1st of month\n const paymentDay = account.payment_due_at ? getDate(fromUnixTime(account.payment_due_at)) : 1\n const paymentDueDate = startOfMonth(new Date()).setDate(paymentDay)\n const balance = account.balance ?? 0\n const monthlyPayment = account.minimum_payment ?? undefined\n const rate = account.interest_rate ?? account.apr ?? account.apy\n\n debt.balance = Math.max(balance, 0) // Don't use overpaid/negative balances for debt calculations\n debt.interest_rate = rate\n debt.is_paid_off = balance === 0\n debt.monthly_payment = monthlyPayment\n debt.name = account?.name ?? copy.unnamed_label\n debt.original_balance = account.original_balance // TODO: Does a debt need this?\n debt.payment_due_date = paymentDueDate\n }\n\n debt.is_impossible = false\n debt.priority = undefined\n debt.projected_payoff_date = undefined\n\n return debt\n}\n\nexport { createDebt, loadDebts }\n","import { makeAutoObservable } from 'mobx'\nimport { DebtPrioriy } from '../constants'\nimport { type DebtChartData } from '../utils/DebtsWidget'\n\nexport class DebtsUiStore {\n isLoading = false\n selectedDebtChartData: DebtChartData = {} as DebtChartData\n selectedDebtPriority: DebtPrioriy = DebtPrioriy.LOWEST_BALANCE\n\n constructor() {\n makeAutoObservable(this)\n }\n\n get showError() {\n const { interest_rate, monthly_payment } = this.selectedDebtChartData\n return interest_rate === undefined || monthly_payment === undefined\n }\n\n get showCompleted() {\n return this.selectedDebtChartData.is_paid_off\n }\n\n setIsLoading = (isLoading: boolean) => (this.isLoading = isLoading)\n\n setSelectedDebtChartData = (data: DebtChartData) => (this.selectedDebtChartData = data)\n\n setSelectedDebtPriority = (priority: DebtPrioriy) => (this.selectedDebtPriority = priority)\n}\n","import { makeAutoObservable } from 'mobx'\n\nimport { type GlobalStore, type Debt } from '../../common'\nimport { loadDebts } from '../utils/DebtStore'\nimport { DebtsUiStore } from './DebtsUiStore'\n\nexport class DebtsStore {\n globalStore: GlobalStore\n uiStore: DebtsUiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new DebtsUiStore()\n makeAutoObservable(this)\n }\n\n get debts(): Debt[] {\n const { visibleDebtAccounts: debtAccounts } = this.globalStore.accountStore\n const { debtGoals } = this.globalStore.goalStore\n\n return loadDebts(debtAccounts, debtGoals)\n }\n\n get totalMonthlyPayments(): number {\n const payments = this.debts.map((d) => Number(d.monthly_payment)).filter((p) => !isNaN(p))\n return payments.reduce((total, payment) => total + payment, 0)\n }\n}\n"],"names":["copy","loadDebts","accounts","goals","debtAccounts","acc","AccountType","goalDebts","goal","createDebt","liabilityDebts","debt","account","paymentDay","getDate","fromUnixTime","paymentDueDate","startOfMonth","balance","monthlyPayment","rate","DebtsUiStore","DebtPrioriy","makeAutoObservable","interest_rate","monthly_payment","isLoading","data","priority","DebtsStore","globalStore","debtGoals","d","p","total","payment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,IAAO;AAAA,EACX,eAAe;AACjB;AAEA,SAASC,EAAUC,GAAqBC,GAAuB;AAC7D,QAAMC,IAAeF,EAAS,OAAO,CAACG,MAGhCA,EAAI,iBAAiBC,EAAY,0BAC5B,OAAOD,EAAI,OAAO,KAAK,IAGzBA,EAAI,2BAA2B,EACvC,GAGKE,IAAYJ,EACf,OAAO,CAACK,MAASJ,EAAa,KAAK,CAACC,MAA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
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs as g, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import R from "react";
|
|
3
|
+
import { selectAll as A, interpolateString as I, arc as m } from "d3";
|
|
4
|
+
import n from "@mui/material/Box";
|
|
5
|
+
const v = 100, w = 140, x = 10, U = ({
|
|
6
|
+
data: s,
|
|
7
|
+
hoveredId: a,
|
|
8
|
+
onClick: i,
|
|
9
|
+
onMouseEnter: l,
|
|
10
|
+
onMouseLeave: c,
|
|
11
|
+
selectedId: d,
|
|
12
|
+
size: o = 300,
|
|
13
|
+
children: u
|
|
14
|
+
}) => {
|
|
15
|
+
let r = 0;
|
|
16
|
+
return R.useEffect(() => {
|
|
17
|
+
A(".arc-outer").transition("roll").duration(500).attrTween("transform", () => I("rotate(0)", "rotate(360)"));
|
|
18
|
+
}, []), /* @__PURE__ */ g(n, { height: o, position: "relative", width: o, children: [
|
|
19
|
+
/* @__PURE__ */ e(n, { height: "100%", padding: o / 3.75, width: "100%", children: u }),
|
|
20
|
+
/* @__PURE__ */ e(
|
|
21
|
+
"svg",
|
|
22
|
+
{
|
|
23
|
+
height: o,
|
|
24
|
+
style: { position: "absolute", top: 0, left: 0 },
|
|
25
|
+
viewBox: "-150 -150 300 300",
|
|
26
|
+
width: o,
|
|
27
|
+
children: /* @__PURE__ */ e("g", { children: s.map((t) => {
|
|
28
|
+
const h = r;
|
|
29
|
+
r = r + 2 * Math.PI * (t.value / 100);
|
|
30
|
+
const p = r, f = m().cornerRadius(4)({
|
|
31
|
+
innerRadius: v,
|
|
32
|
+
outerRadius: w + (t.id === d || t.id === a ? x : 0),
|
|
33
|
+
startAngle: h,
|
|
34
|
+
endAngle: p,
|
|
35
|
+
padAngle: 0.025
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ e(
|
|
38
|
+
"path",
|
|
39
|
+
{
|
|
40
|
+
className: "arc-outer",
|
|
41
|
+
d: f,
|
|
42
|
+
fill: t.color,
|
|
43
|
+
onClick: () => i?.(t.id),
|
|
44
|
+
onMouseEnter: () => l?.(t.id),
|
|
45
|
+
onMouseLeave: () => c?.(t.id),
|
|
46
|
+
style: { cursor: "pointer" }
|
|
47
|
+
},
|
|
48
|
+
t.id
|
|
49
|
+
);
|
|
50
|
+
}) })
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
U as D
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=Donut-CGNFni9y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Donut-CGNFni9y.mjs","sources":["../src/common/components/charts/Donut.tsx"],"sourcesContent":["import React from 'react'\nimport { arc, selectAll, interpolateString } from 'd3'\n\nimport Box from '@mui/material/Box'\n\nconst INNER_RADIUS = 100\nconst OUT_RADIUS = 140\nconst SELECTION_RADIUS = 10\n\nexport interface DonutData {\n id: string\n label?: string\n color: string\n value: number\n}\n\nexport interface DonutProps {\n data: DonutData[]\n hoveredId?: string\n onClick?: (id: string) => void\n onMouseEnter?: (id: string) => void\n onMouseLeave?: (id: string) => void\n selectedId?: string\n size?: number\n}\n\nconst Donut: React.FC<React.PropsWithChildren<DonutProps>> = ({\n data,\n hoveredId,\n onClick,\n onMouseEnter,\n onMouseLeave,\n selectedId,\n size = 300,\n children,\n}) => {\n let offset = 0\n\n React.useEffect(() => {\n selectAll('.arc-outer')\n .transition('roll')\n .duration(500)\n .attrTween('transform', () => interpolateString('rotate(0)', 'rotate(360)'))\n }, [])\n\n return (\n <Box height={size} position=\"relative\" width={size}>\n <Box height=\"100%\" padding={size / 3.75} width=\"100%\">\n {children}\n </Box>\n <svg\n height={size}\n style={{ position: 'absolute', top: 0, left: 0 }}\n viewBox={`-150 -150 300 300`}\n width={size}\n >\n <g>\n {data.map((item) => {\n const startAngle = offset\n offset = offset + 2 * Math.PI * (item.value / 100)\n const endAngle = offset\n\n const segment = arc().cornerRadius(4)({\n innerRadius: INNER_RADIUS,\n outerRadius:\n OUT_RADIUS +\n (item.id === selectedId || item.id === hoveredId ? SELECTION_RADIUS : 0),\n startAngle,\n endAngle,\n padAngle: 0.025,\n }) as string\n\n return (\n <path\n className=\"arc-outer\"\n d={segment}\n fill={item.color}\n key={item.id}\n onClick={() => onClick?.(item.id)}\n onMouseEnter={() => onMouseEnter?.(item.id)}\n onMouseLeave={() => onMouseLeave?.(item.id)}\n style={{ cursor: 'pointer' }}\n />\n )\n })}\n </g>\n </svg>\n </Box>\n )\n}\n\nexport default Donut\n"],"names":["INNER_RADIUS","OUT_RADIUS","SELECTION_RADIUS","Donut","data","hoveredId","onClick","onMouseEnter","onMouseLeave","selectedId","size","children","offset","React","selectAll","interpolateString","Box","jsx","item","startAngle","endAngle","segment","arc"],"mappings":";;;;AAKA,MAAMA,IAAe,KACfC,IAAa,KACbC,IAAmB,IAmBnBC,IAAuD,CAAC;AAAA,EAC5D,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AACF,MAAM;AACJ,MAAIC,IAAS;AAEb,SAAAC,EAAM,UAAU,MAAM;AACpB,IAAAC,EAAU,YAAY,EACnB,WAAW,MAAM,EACjB,SAAS,GAAG,EACZ,UAAU,aAAa,MAAMC,EAAkB,aAAa,aAAa,CAAC;AAAA,EAC/E,GAAG,CAAE,CAAA,qBAGFC,GAAI,EAAA,QAAQN,GAAM,UAAS,YAAW,OAAOA,GAC5C,UAAA;AAAA,IAAC,gBAAAO,EAAAD,GAAA,EAAI,QAAO,QAAO,SAASN,IAAO,MAAM,OAAM,QAC5C,UAAAC,EACH,CAAA;AAAA,IACA,gBAAAM;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,QAAQP;AAAA,QACR,OAAO,EAAE,UAAU,YAAY,KAAK,GAAG,MAAM,EAAE;AAAA,QAC/C,SAAS;AAAA,QACT,OAAOA;AAAA,QAEP,UAAC,gBAAAO,EAAA,KAAA,EACE,UAAKb,EAAA,IAAI,CAACc,MAAS;AAClB,gBAAMC,IAAaP;AACnB,UAAAA,IAASA,IAAS,IAAI,KAAK,MAAMM,EAAK,QAAQ;AAC9C,gBAAME,IAAWR,GAEXS,IAAUC,EAAA,EAAM,aAAa,CAAC,EAAE;AAAA,YACpC,aAAatB;AAAA,YACb,aACEC,KACCiB,EAAK,OAAOT,KAAcS,EAAK,OAAOb,IAAYH,IAAmB;AAAA,YACxE,YAAAiB;AAAA,YACA,UAAAC;AAAA,YACA,UAAU;AAAA,UAAA,CACX;AAGC,iBAAA,gBAAAH;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,GAAGI;AAAA,cACH,MAAMH,EAAK;AAAA,cAEX,SAAS,MAAMZ,IAAUY,EAAK,EAAE;AAAA,cAChC,cAAc,MAAMX,IAAeW,EAAK,EAAE;AAAA,cAC1C,cAAc,MAAMV,IAAeU,EAAK,EAAE;AAAA,cAC1C,OAAO,EAAE,QAAQ,UAAU;AAAA,YAAA;AAAA,YAJtBA,EAAK;AAAA,UAAA;AAAA,QAOf,CAAA,GACH;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { makeAutoObservable as c, runInAction as o } from "mobx";
|
|
2
|
+
import { format as h } from "date-fns/format";
|
|
3
|
+
import { fromUnixTime as s } from "date-fns/fromUnixTime";
|
|
4
|
+
import { getUnixTime as m } from "date-fns/getUnixTime";
|
|
5
|
+
import { subMonths as n } from "date-fns/subMonths";
|
|
6
|
+
import "bowser";
|
|
7
|
+
import { ae as l, af as a, aI as g, aJ as S } from "./ConnectMiniWidget-CQWafYtQ.mjs";
|
|
8
|
+
import "date-fns/intlFormat";
|
|
9
|
+
import "date-fns/addMonths";
|
|
10
|
+
import "date-fns/addQuarters";
|
|
11
|
+
import "date-fns/addWeeks";
|
|
12
|
+
import "date-fns/addYears";
|
|
13
|
+
import "date-fns/getDay";
|
|
14
|
+
import "date-fns/isBefore";
|
|
15
|
+
import "date-fns/nextDay";
|
|
16
|
+
import "date-fns/setDate";
|
|
17
|
+
import "date-fns/startOfToday";
|
|
18
|
+
import "react";
|
|
19
|
+
import "numeral";
|
|
20
|
+
import "@mui/material";
|
|
21
|
+
import "react/jsx-runtime";
|
|
22
|
+
import "@mui/material/Button";
|
|
23
|
+
import "@mxenabled/mxui";
|
|
24
|
+
import "@mui/material/Tooltip";
|
|
25
|
+
import "@mui/material/Box";
|
|
26
|
+
import "@mui/material/IconButton";
|
|
27
|
+
import "./Loader-CwdK8lfx.mjs";
|
|
28
|
+
import "@mui/material/styles/useTheme";
|
|
29
|
+
import "@mui/material/useMediaQuery";
|
|
30
|
+
import "@mxenabled/cssinjs";
|
|
31
|
+
import "date-fns/addDays";
|
|
32
|
+
import "date-fns/eachDayOfInterval";
|
|
33
|
+
import "date-fns/eachWeekOfInterval";
|
|
34
|
+
import "date-fns/endOfMonth";
|
|
35
|
+
import "date-fns/isSameMonth";
|
|
36
|
+
import "date-fns/startOfMonth";
|
|
37
|
+
import "@mui/material/Paper";
|
|
38
|
+
import "@mxenabled/mx-icons";
|
|
39
|
+
import "date-fns/isSameDay";
|
|
40
|
+
import "date-fns/isWithinInterval";
|
|
41
|
+
import "d3";
|
|
42
|
+
import "@mui/material/styles";
|
|
43
|
+
import "@mui/x-charts";
|
|
44
|
+
import "@mui/x-charts/ChartsTooltip";
|
|
45
|
+
import "@mui/material/Stack";
|
|
46
|
+
import "date-fns/differenceInCalendarDays";
|
|
47
|
+
import "date-fns/endOfToday";
|
|
48
|
+
import "date-fns/endOfYear";
|
|
49
|
+
import "date-fns/startOfYear";
|
|
50
|
+
import "date-fns/subDays";
|
|
51
|
+
import "date-fns/subYears";
|
|
52
|
+
import "@mui/material/ButtonGroup";
|
|
53
|
+
import "@mui/material/Tab";
|
|
54
|
+
import "@mui/material/Tabs";
|
|
55
|
+
import "@mui/material/ToggleButton";
|
|
56
|
+
import "@mui/material/ToggleButtonGroup";
|
|
57
|
+
import "@mui/material/Dialog";
|
|
58
|
+
import "@mui/material/DialogContent";
|
|
59
|
+
import "@mui/material/Card";
|
|
60
|
+
import "@mui/material/CardContent";
|
|
61
|
+
import "@mui/material/CardHeader";
|
|
62
|
+
import "uuid";
|
|
63
|
+
import "@mui/material/CircularProgress";
|
|
64
|
+
import "@mui/material/FormControlLabel";
|
|
65
|
+
import "@mui/material/Radio";
|
|
66
|
+
import "@mui/material/Avatar";
|
|
67
|
+
import "@mui/material/ListItem";
|
|
68
|
+
import "@mui/material/ListItemAvatar";
|
|
69
|
+
import "@mui/material/ListItemButton";
|
|
70
|
+
import "@mui/material/ListItemText";
|
|
71
|
+
import "@mui/material/ListItemIcon";
|
|
72
|
+
import "@mui/material/MenuItem";
|
|
73
|
+
import "@mui/material/TextField";
|
|
74
|
+
import "@mui/material/Switch";
|
|
75
|
+
import "posthog-js";
|
|
76
|
+
import "date-fns/differenceInDays";
|
|
77
|
+
import "@mui/x-data-grid-pro";
|
|
78
|
+
import "date-fns";
|
|
79
|
+
import "@mui/material/Divider";
|
|
80
|
+
import "@mui/material/List";
|
|
81
|
+
import "date-fns/formatISO";
|
|
82
|
+
import "date-fns/isAfter";
|
|
83
|
+
import "date-fns/parseISO";
|
|
84
|
+
import "date-fns/subQuarters";
|
|
85
|
+
import "date-fns/lastDayOfMonth";
|
|
86
|
+
import "date-fns/setDayOfYear";
|
|
87
|
+
import "date-fns/addSeconds";
|
|
88
|
+
import "date-fns/differenceInCalendarMonths";
|
|
89
|
+
import "date-fns/getMonth";
|
|
90
|
+
class p {
|
|
91
|
+
fetchInstance;
|
|
92
|
+
constructor(t, r) {
|
|
93
|
+
this.fetchInstance = new l(t, r);
|
|
94
|
+
}
|
|
95
|
+
calculateHealthScore = async () => this.fetchInstance.post(`${a.HEALTH_SCORES}/calculate`).then((t) => t.health_score);
|
|
96
|
+
getAverageHealthScores = async () => this.fetchInstance.get(`${a.HEALTH_SCORES}/monthly_averages`).then((t) => t);
|
|
97
|
+
getHealthScoreChangeReports = async (t, r) => this.fetchInstance.get(`${a.HEALTH_SCORES}/change_report/from/${t}/to/${r}`).then((e) => e);
|
|
98
|
+
getPeerScore = async (t) => this.fetchInstance.get(`${a.HEALTH_SCORES}/average/${t}`).then((r) => r.average_health_score);
|
|
99
|
+
}
|
|
100
|
+
const u = (i) => i?.health_scores.map((t) => {
|
|
101
|
+
const r = t.monthly_health_score_average, e = new Date(0, r.month - 1, 1);
|
|
102
|
+
return {
|
|
103
|
+
x: g(e, S.MONTH_SHORT),
|
|
104
|
+
y: r.average_health_score,
|
|
105
|
+
month: r.month
|
|
106
|
+
// Keep original month for sorting
|
|
107
|
+
};
|
|
108
|
+
}).sort((t, r) => t.month - r.month).map((t) => ({ x: t.x, y: t.y }));
|
|
109
|
+
class Xt {
|
|
110
|
+
api = new p("/", "");
|
|
111
|
+
augmentedChartData = [];
|
|
112
|
+
averageHealthScores = [];
|
|
113
|
+
globalStore;
|
|
114
|
+
healthScore = {};
|
|
115
|
+
healthScoreChangeReports = [];
|
|
116
|
+
peerScore = null;
|
|
117
|
+
constructor(t) {
|
|
118
|
+
this.globalStore = t, this.api = new p(t.endpoint, t.sessionToken), c(this);
|
|
119
|
+
}
|
|
120
|
+
get getHealthScore() {
|
|
121
|
+
return this.healthScore;
|
|
122
|
+
}
|
|
123
|
+
calculateHealthScore = async () => {
|
|
124
|
+
try {
|
|
125
|
+
const t = await this.api.calculateHealthScore();
|
|
126
|
+
o(() => {
|
|
127
|
+
this.healthScore = t;
|
|
128
|
+
});
|
|
129
|
+
} catch (t) {
|
|
130
|
+
console.error("Error calculating health score:", t);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
loadAverageHealthScores = async () => {
|
|
134
|
+
try {
|
|
135
|
+
const t = await this.api.getAverageHealthScores();
|
|
136
|
+
o(() => {
|
|
137
|
+
this.averageHealthScores = t;
|
|
138
|
+
});
|
|
139
|
+
} catch (t) {
|
|
140
|
+
console.error("Error loading average health scores:", t);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
loadHealthScoreChangeReports = async () => {
|
|
144
|
+
const t = m(n(/* @__PURE__ */ new Date(), 2)), r = m(/* @__PURE__ */ new Date());
|
|
145
|
+
try {
|
|
146
|
+
const e = await this.api.getHealthScoreChangeReports(
|
|
147
|
+
t,
|
|
148
|
+
r
|
|
149
|
+
);
|
|
150
|
+
o(() => {
|
|
151
|
+
this.healthScoreChangeReports = e;
|
|
152
|
+
});
|
|
153
|
+
} catch (e) {
|
|
154
|
+
console.error("Error loading health score change reports:", e);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
loadPeerScore = async () => {
|
|
158
|
+
const t = h(s(this.globalStore.appDataStore.user.birthday), "yyyy");
|
|
159
|
+
try {
|
|
160
|
+
const r = await this.api.getPeerScore(t);
|
|
161
|
+
o(() => {
|
|
162
|
+
this.peerScore = r;
|
|
163
|
+
});
|
|
164
|
+
} catch (r) {
|
|
165
|
+
console.error("Error loading peer score:", r);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
loadAugmentedChartData = async () => {
|
|
169
|
+
try {
|
|
170
|
+
const t = await this.api.getAverageHealthScores();
|
|
171
|
+
o(() => {
|
|
172
|
+
this.augmentedChartData = u(t);
|
|
173
|
+
});
|
|
174
|
+
} catch (t) {
|
|
175
|
+
console.error(`Error occurred while getting augmented chart data: ${t}`);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
p as F,
|
|
181
|
+
Xt as a
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=FinstrongStore-BDG7l0nI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FinstrongStore-BDG7l0nI.mjs","sources":["../src/finstrong/api/FinstrongApi.ts","../src/finstrong/utils/Finstrong.ts","../src/finstrong/stores/FinstrongStore.ts"],"sourcesContent":["import { ApiEndpoints, Fetch } from '../../common'\n\nexport class FinstrongApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n calculateHealthScore = async () => {\n return this.fetchInstance\n .post(`${ApiEndpoints.HEALTH_SCORES}/calculate`)\n .then((data) => data.health_score)\n }\n\n getAverageHealthScores = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/monthly_averages`)\n .then((data) => data)\n }\n\n getHealthScoreChangeReports = async (startDate: number, endDate: number) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/change_report/from/${startDate}/to/${endDate}`)\n .then((data) => data)\n }\n\n getPeerScore = async (birthYear: string) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/average/${birthYear}`)\n .then((data) => data.average_health_score)\n }\n}\n","import { formatDate, DATE_FORMATS_INTL } from '../../common/constants'\n\nexport const augmentChartData = (averageHealthScores: { health_scores: any[] }) => {\n return averageHealthScores?.health_scores\n .map((item) => {\n const score = item.monthly_health_score_average\n const date = new Date(0, score.month - 1, 1)\n const monthName = formatDate(date, DATE_FORMATS_INTL.MONTH_SHORT)\n\n return {\n x: monthName,\n y: score.average_health_score,\n month: score.month, // Keep original month for sorting\n }\n })\n .sort((a, b) => a.month - b.month) // Sort by original month number\n .map((item) => ({ x: item.x, y: item.y }))\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { format } from 'date-fns/format'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport {\n GlobalStore,\n type HealthScore,\n type HealthScoreReport,\n type MonthlyHealthScore,\n} from '../../common'\n\nimport { FinstrongApi } from '../api/FinstrongApi'\nimport { augmentChartData } from '../utils/Finstrong'\n\nexport class FinstrongStore {\n api = new FinstrongApi('/', '')\n augmentedChartData: { x: string; y: number }[] = []\n averageHealthScores: MonthlyHealthScore[] = []\n globalStore: GlobalStore\n healthScore: HealthScore = {} as HealthScore\n healthScoreChangeReports: HealthScoreReport[] = []\n peerScore: number | null = null\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new FinstrongApi(globalStore.endpoint, globalStore.sessionToken)\n makeAutoObservable(this)\n }\n\n get getHealthScore() {\n return this.healthScore\n }\n\n calculateHealthScore = async () => {\n try {\n const healthScore = await this.api.calculateHealthScore()\n runInAction(() => {\n this.healthScore = healthScore\n })\n } catch (e) {\n console.error('Error calculating health score:', e)\n }\n }\n\n loadAverageHealthScores = async () => {\n try {\n const averageHealthScores = await this.api.getAverageHealthScores()\n runInAction(() => {\n this.averageHealthScores = averageHealthScores\n })\n } catch (e) {\n console.error('Error loading average health scores:', e)\n }\n }\n\n loadHealthScoreChangeReports = async () => {\n const startDate = getUnixTime(subMonths(new Date(), 2))\n const endDate = getUnixTime(new Date())\n\n try {\n const healthScoreChangeReports = await this.api.getHealthScoreChangeReports(\n startDate,\n endDate,\n )\n runInAction(() => {\n this.healthScoreChangeReports = healthScoreChangeReports\n })\n } catch (e) {\n console.error('Error loading health score change reports:', e)\n }\n }\n\n loadPeerScore = async () => {\n const birthYear = format(fromUnixTime(this.globalStore.appDataStore.user.birthday!), 'yyyy')\n\n try {\n const peerScore = await this.api.getPeerScore(birthYear)\n runInAction(() => {\n this.peerScore = peerScore\n })\n } catch (e) {\n console.error('Error loading peer score:', e)\n }\n }\n\n loadAugmentedChartData = async () => {\n try {\n const augmentedChartData = await this.api.getAverageHealthScores()\n\n runInAction(() => {\n this.augmentedChartData = augmentChartData(augmentedChartData)\n })\n } catch (error) {\n console.error(`Error occurred while getting augmented chart data: ${error}`)\n }\n }\n}\n"],"names":["FinstrongApi","endpoint","token","Fetch","ApiEndpoints","data","startDate","endDate","birthYear","augmentChartData","averageHealthScores","item","score","date","formatDate","DATE_FORMATS_INTL","a","b","FinstrongStore","globalStore","makeAutoObservable","healthScore","runInAction","e","getUnixTime","subMonths","healthScoreChangeReports","format","fromUnixTime","peerScore","augmentedChartData","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,EAAa;AAAA,EACxB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,uBAAuB,YACd,KAAK,cACT,KAAK,GAAGE,EAAa,aAAa,YAAY,EAC9C,KAAK,CAACC,MAASA,EAAK,YAAY;AAAA,EAGrC,yBAAyB,YAChB,KAAK,cACT,IAAI,GAAGD,EAAa,aAAa,mBAAmB,EACpD,KAAK,CAACC,MAASA,CAAI;AAAA,EAGxB,8BAA8B,OAAOC,GAAmBC,MAC/C,KAAK,cACT,IAAI,GAAGH,EAAa,aAAa,uBAAuBE,CAAS,OAAOC,CAAO,EAAE,EACjF,KAAK,CAACF,MAASA,CAAI;AAAA,EAGxB,eAAe,OAAOG,MACb,KAAK,cACT,IAAI,GAAGJ,EAAa,aAAa,YAAYI,CAAS,EAAE,EACxD,KAAK,CAACH,MAASA,EAAK,oBAAoB;AAE/C;AC9Ba,MAAAI,IAAmB,CAACC,MACxBA,GAAqB,cACzB,IAAI,CAACC,MAAS;AACb,QAAMC,IAAQD,EAAK,8BACbE,IAAO,IAAI,KAAK,GAAGD,EAAM,QAAQ,GAAG,CAAC;AAGpC,SAAA;AAAA,IACL,GAHgBE,EAAWD,GAAME,EAAkB,WAAW;AAAA,IAI9D,GAAGH,EAAM;AAAA,IACT,OAAOA,EAAM;AAAA;AAAA,EAAA;AACf,CACD,EACA,KAAK,CAACI,GAAGC,MAAMD,EAAE,QAAQC,EAAE,KAAK,EAChC,IAAI,CAACN,OAAU,EAAE,GAAGA,EAAK,GAAG,GAAGA,EAAK,EAAI,EAAA;ACC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