@nice2dev/templates 1.2.1 → 1.3.0
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/dist/index.cjs +1 -1
- package/dist/index.mjs +1463 -1400
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
var ne = Object.defineProperty;
|
|
2
|
+
var re = (s, e, t) => e in s ? ne(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var k = (s, e, t) => re(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
import { useNiceTranslation as w, clickOnActivationKey as A } from "@nice2dev/ui-core";
|
|
6
|
+
import { useContext as L, useState as T, useCallback as N, createContext as H, useMemo as W, useEffect as ae } from "react";
|
|
7
|
+
import { NtdArrowUp as j, NtdArrowDown as E, NtdDownload as oe, NtdUpload as ie } from "@nice2dev/icons";
|
|
8
|
+
const se = [
|
|
8
9
|
{
|
|
9
10
|
id: "apple",
|
|
10
11
|
name: "Apple",
|
|
@@ -112,28 +113,28 @@ const re = [
|
|
|
112
113
|
fiber: 3.5
|
|
113
114
|
}
|
|
114
115
|
];
|
|
115
|
-
class
|
|
116
|
+
class le {
|
|
116
117
|
constructor() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
k(this, "workouts", /* @__PURE__ */ new Map());
|
|
119
|
+
k(this, "meals", /* @__PURE__ */ new Map());
|
|
120
|
+
k(this, "sleep", /* @__PURE__ */ new Map());
|
|
121
|
+
k(this, "medicalRecords", /* @__PURE__ */ new Map());
|
|
122
|
+
k(this, "medications", /* @__PURE__ */ new Map());
|
|
123
|
+
k(this, "medicationLogs", []);
|
|
124
|
+
k(this, "vitals", []);
|
|
125
|
+
k(this, "goals", []);
|
|
126
|
+
k(this, "foodDatabase", [...se]);
|
|
126
127
|
}
|
|
127
128
|
/* ─────────────────────────────────────────────────────────────
|
|
128
129
|
WORKOUTS
|
|
129
130
|
───────────────────────────────────────────────────────────── */
|
|
130
131
|
addWorkout(e) {
|
|
131
|
-
const t = this.generateId(),
|
|
132
|
-
return this.workouts.set(t,
|
|
132
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
133
|
+
return this.workouts.set(t, n), n;
|
|
133
134
|
}
|
|
134
135
|
updateWorkout(e, t) {
|
|
135
|
-
const
|
|
136
|
-
|
|
136
|
+
const n = this.workouts.get(e);
|
|
137
|
+
n && this.workouts.set(e, { ...n, ...t, id: e });
|
|
137
138
|
}
|
|
138
139
|
deleteWorkout(e) {
|
|
139
140
|
this.workouts.delete(e);
|
|
@@ -144,37 +145,37 @@ class ne {
|
|
|
144
145
|
);
|
|
145
146
|
}
|
|
146
147
|
getWorkoutsForPeriod(e, t) {
|
|
147
|
-
return this.getAllWorkouts().filter((
|
|
148
|
-
const
|
|
149
|
-
return
|
|
148
|
+
return this.getAllWorkouts().filter((n) => {
|
|
149
|
+
const o = new Date(n.date);
|
|
150
|
+
return o >= e && o <= t;
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
153
|
getWorkoutStats(e = 7) {
|
|
153
|
-
const t = new Date(Date.now() - e * 864e5),
|
|
154
|
-
for (const
|
|
155
|
-
|
|
154
|
+
const t = new Date(Date.now() - e * 864e5), n = this.getWorkoutsForPeriod(t, /* @__PURE__ */ new Date()), o = /* @__PURE__ */ new Map();
|
|
155
|
+
for (const r of n)
|
|
156
|
+
o.set(r.type, (o.get(r.type) || 0) + 1);
|
|
156
157
|
return {
|
|
157
|
-
totalWorkouts:
|
|
158
|
-
totalDuration:
|
|
159
|
-
totalCalories:
|
|
160
|
-
avgDuration:
|
|
161
|
-
byType: Array.from(
|
|
158
|
+
totalWorkouts: n.length,
|
|
159
|
+
totalDuration: n.reduce((r, i) => r + i.duration, 0),
|
|
160
|
+
totalCalories: n.reduce((r, i) => r + i.caloriesBurned, 0),
|
|
161
|
+
avgDuration: n.length > 0 ? n.reduce((r, i) => r + i.duration, 0) / n.length : 0,
|
|
162
|
+
byType: Array.from(o.entries()).map(([r, i]) => ({ type: r, count: i }))
|
|
162
163
|
};
|
|
163
164
|
}
|
|
164
165
|
/* ─────────────────────────────────────────────────────────────
|
|
165
166
|
NUTRITION
|
|
166
167
|
───────────────────────────────────────────────────────────── */
|
|
167
168
|
addMeal(e) {
|
|
168
|
-
const t = this.generateId(),
|
|
169
|
-
return this.meals.set(t,
|
|
169
|
+
const t = this.generateId(), n = this.calculateMealTotals(e.foods), o = { ...e, id: t, ...n };
|
|
170
|
+
return this.meals.set(t, o), o;
|
|
170
171
|
}
|
|
171
172
|
calculateMealTotals(e) {
|
|
172
173
|
return e.reduce(
|
|
173
|
-
(t, { item:
|
|
174
|
-
totalCalories: t.totalCalories +
|
|
175
|
-
totalProtein: t.totalProtein +
|
|
176
|
-
totalCarbs: t.totalCarbs +
|
|
177
|
-
totalFat: t.totalFat +
|
|
174
|
+
(t, { item: n, servings: o }) => ({
|
|
175
|
+
totalCalories: t.totalCalories + n.calories * o,
|
|
176
|
+
totalProtein: t.totalProtein + n.protein * o,
|
|
177
|
+
totalCarbs: t.totalCarbs + n.carbs * o,
|
|
178
|
+
totalFat: t.totalFat + n.fat * o
|
|
178
179
|
}),
|
|
179
180
|
{ totalCalories: 0, totalProtein: 0, totalCarbs: 0, totalFat: 0 }
|
|
180
181
|
);
|
|
@@ -190,46 +191,46 @@ class ne {
|
|
|
190
191
|
getMealsForDate(e) {
|
|
191
192
|
const t = new Date(e);
|
|
192
193
|
t.setHours(0, 0, 0, 0);
|
|
193
|
-
const
|
|
194
|
-
return this.getAllMeals().filter((
|
|
195
|
-
const
|
|
196
|
-
return
|
|
194
|
+
const n = new Date(t.getTime() + 864e5);
|
|
195
|
+
return this.getAllMeals().filter((o) => {
|
|
196
|
+
const r = new Date(o.date);
|
|
197
|
+
return r >= t && r < n;
|
|
197
198
|
});
|
|
198
199
|
}
|
|
199
200
|
getDailyNutrition(e) {
|
|
200
201
|
const t = this.getMealsForDate(e);
|
|
201
202
|
return {
|
|
202
|
-
calories: t.reduce((
|
|
203
|
-
protein: t.reduce((
|
|
204
|
-
carbs: t.reduce((
|
|
205
|
-
fat: t.reduce((
|
|
203
|
+
calories: t.reduce((n, o) => n + o.totalCalories, 0),
|
|
204
|
+
protein: t.reduce((n, o) => n + o.totalProtein, 0),
|
|
205
|
+
carbs: t.reduce((n, o) => n + o.totalCarbs, 0),
|
|
206
|
+
fat: t.reduce((n, o) => n + o.totalFat, 0),
|
|
206
207
|
meals: t.length
|
|
207
208
|
};
|
|
208
209
|
}
|
|
209
210
|
searchFoods(e) {
|
|
210
211
|
const t = e.toLowerCase();
|
|
211
|
-
return this.foodDatabase.filter((
|
|
212
|
+
return this.foodDatabase.filter((n) => n.name.toLowerCase().includes(t));
|
|
212
213
|
}
|
|
213
214
|
addCustomFood(e) {
|
|
214
|
-
const t = this.generateId(),
|
|
215
|
-
return this.foodDatabase.push(
|
|
215
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
216
|
+
return this.foodDatabase.push(n), n;
|
|
216
217
|
}
|
|
217
218
|
/* ─────────────────────────────────────────────────────────────
|
|
218
219
|
SLEEP
|
|
219
220
|
───────────────────────────────────────────────────────────── */
|
|
220
221
|
addSleepEntry(e) {
|
|
221
|
-
const t = this.generateId(),
|
|
222
|
-
return this.sleep.set(t,
|
|
222
|
+
const t = this.generateId(), n = (new Date(e.wakeTime).getTime() - new Date(e.bedtime).getTime()) / 36e5, o = { ...e, id: t, duration: n };
|
|
223
|
+
return this.sleep.set(t, o), o;
|
|
223
224
|
}
|
|
224
225
|
updateSleepEntry(e, t) {
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
let
|
|
226
|
+
const n = this.sleep.get(e);
|
|
227
|
+
if (n) {
|
|
228
|
+
let o = n.duration;
|
|
228
229
|
if (t.bedtime || t.wakeTime) {
|
|
229
|
-
const
|
|
230
|
-
|
|
230
|
+
const r = t.bedtime || n.bedtime, i = t.wakeTime || n.wakeTime;
|
|
231
|
+
o = (new Date(i).getTime() - new Date(r).getTime()) / 36e5;
|
|
231
232
|
}
|
|
232
|
-
this.sleep.set(e, { ...
|
|
233
|
+
this.sleep.set(e, { ...n, ...t, id: e, duration: o });
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
deleteSleepEntry(e) {
|
|
@@ -241,20 +242,20 @@ class ne {
|
|
|
241
242
|
);
|
|
242
243
|
}
|
|
243
244
|
getSleepStats(e = 7) {
|
|
244
|
-
const t = new Date(Date.now() - e * 864e5),
|
|
245
|
+
const t = new Date(Date.now() - e * 864e5), n = this.getAllSleepEntries().filter((i) => new Date(i.date) >= t), o = {
|
|
245
246
|
poor: 1,
|
|
246
247
|
fair: 2,
|
|
247
248
|
good: 3,
|
|
248
249
|
excellent: 4
|
|
249
|
-
},
|
|
250
|
-
for (const
|
|
251
|
-
|
|
250
|
+
}, r = /* @__PURE__ */ new Map();
|
|
251
|
+
for (const i of n)
|
|
252
|
+
r.set(i.quality, (r.get(i.quality) || 0) + 1);
|
|
252
253
|
return {
|
|
253
|
-
avgDuration:
|
|
254
|
-
avgQuality:
|
|
255
|
-
totalEntries:
|
|
256
|
-
qualityDistribution: Array.from(
|
|
257
|
-
quality:
|
|
254
|
+
avgDuration: n.length > 0 ? n.reduce((i, d) => i + d.duration, 0) / n.length : 0,
|
|
255
|
+
avgQuality: n.length > 0 ? n.reduce((i, d) => i + o[d.quality], 0) / n.length : 0,
|
|
256
|
+
totalEntries: n.length,
|
|
257
|
+
qualityDistribution: Array.from(r.entries()).map(([i, d]) => ({
|
|
258
|
+
quality: i,
|
|
258
259
|
count: d
|
|
259
260
|
}))
|
|
260
261
|
};
|
|
@@ -263,12 +264,12 @@ class ne {
|
|
|
263
264
|
MEDICAL RECORDS
|
|
264
265
|
───────────────────────────────────────────────────────────── */
|
|
265
266
|
addMedicalRecord(e) {
|
|
266
|
-
const t = this.generateId(),
|
|
267
|
-
return this.medicalRecords.set(t,
|
|
267
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
268
|
+
return this.medicalRecords.set(t, n), n;
|
|
268
269
|
}
|
|
269
270
|
updateMedicalRecord(e, t) {
|
|
270
|
-
const
|
|
271
|
-
|
|
271
|
+
const n = this.medicalRecords.get(e);
|
|
272
|
+
n && this.medicalRecords.set(e, { ...n, ...t, id: e });
|
|
272
273
|
}
|
|
273
274
|
deleteMedicalRecord(e) {
|
|
274
275
|
this.medicalRecords.delete(e);
|
|
@@ -282,21 +283,21 @@ class ne {
|
|
|
282
283
|
return this.getAllMedicalRecords().filter((t) => t.type === e);
|
|
283
284
|
}
|
|
284
285
|
getUpcomingFollowUps(e = 30) {
|
|
285
|
-
const t = /* @__PURE__ */ new Date(),
|
|
286
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() + e * 864e5);
|
|
286
287
|
return this.getAllMedicalRecords().filter(
|
|
287
|
-
(
|
|
288
|
+
(o) => o.followUp && new Date(o.followUp) >= t && new Date(o.followUp) <= n
|
|
288
289
|
);
|
|
289
290
|
}
|
|
290
291
|
/* ─────────────────────────────────────────────────────────────
|
|
291
292
|
MEDICATIONS
|
|
292
293
|
───────────────────────────────────────────────────────────── */
|
|
293
294
|
addMedication(e) {
|
|
294
|
-
const t = this.generateId(),
|
|
295
|
-
return this.medications.set(t,
|
|
295
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
296
|
+
return this.medications.set(t, n), n;
|
|
296
297
|
}
|
|
297
298
|
updateMedication(e, t) {
|
|
298
|
-
const
|
|
299
|
-
|
|
299
|
+
const n = this.medications.get(e);
|
|
300
|
+
n && this.medications.set(e, { ...n, ...t, id: e });
|
|
300
301
|
}
|
|
301
302
|
deleteMedication(e) {
|
|
302
303
|
this.medications.delete(e), this.medicationLogs = this.medicationLogs.filter((t) => t.medicationId !== e);
|
|
@@ -307,46 +308,46 @@ class ne {
|
|
|
307
308
|
getActiveMedications() {
|
|
308
309
|
return this.getAllMedications().filter((e) => e.isActive);
|
|
309
310
|
}
|
|
310
|
-
logMedication(e, t,
|
|
311
|
-
const
|
|
311
|
+
logMedication(e, t, n, o) {
|
|
312
|
+
const r = {
|
|
312
313
|
id: this.generateId(),
|
|
313
314
|
medicationId: e,
|
|
314
315
|
scheduledTime: t,
|
|
315
|
-
takenTime:
|
|
316
|
-
skipped: !
|
|
317
|
-
notes:
|
|
316
|
+
takenTime: n ? /* @__PURE__ */ new Date() : void 0,
|
|
317
|
+
skipped: !n,
|
|
318
|
+
notes: o
|
|
318
319
|
};
|
|
319
|
-
this.medicationLogs.push(
|
|
320
|
+
this.medicationLogs.push(r);
|
|
320
321
|
}
|
|
321
322
|
getMedicationLogsForDate(e) {
|
|
322
323
|
const t = new Date(e);
|
|
323
324
|
t.setHours(0, 0, 0, 0);
|
|
324
|
-
const
|
|
325
|
-
return this.medicationLogs.filter((
|
|
326
|
-
const
|
|
327
|
-
return
|
|
325
|
+
const n = new Date(t.getTime() + 864e5);
|
|
326
|
+
return this.medicationLogs.filter((o) => {
|
|
327
|
+
const r = new Date(o.scheduledTime);
|
|
328
|
+
return r >= t && r < n;
|
|
328
329
|
});
|
|
329
330
|
}
|
|
330
331
|
getTodayMedicationSchedule() {
|
|
331
|
-
const e = /* @__PURE__ */ new Date(), t = this.getMedicationLogsForDate(e),
|
|
332
|
-
for (const
|
|
333
|
-
for (const
|
|
334
|
-
const
|
|
335
|
-
(d) => d.medicationId ===
|
|
332
|
+
const e = /* @__PURE__ */ new Date(), t = this.getMedicationLogsForDate(e), n = [];
|
|
333
|
+
for (const o of this.getActiveMedications())
|
|
334
|
+
for (const r of o.times) {
|
|
335
|
+
const i = t.find(
|
|
336
|
+
(d) => d.medicationId === o.id && new Date(d.scheduledTime).toTimeString().startsWith(r)
|
|
336
337
|
);
|
|
337
|
-
|
|
338
|
-
medication:
|
|
339
|
-
time:
|
|
340
|
-
taken: (
|
|
338
|
+
n.push({
|
|
339
|
+
medication: o,
|
|
340
|
+
time: r,
|
|
341
|
+
taken: (i == null ? void 0 : i.takenTime) !== void 0
|
|
341
342
|
});
|
|
342
343
|
}
|
|
343
|
-
return
|
|
344
|
+
return n.sort((o, r) => o.time.localeCompare(r.time));
|
|
344
345
|
}
|
|
345
346
|
/* ─────────────────────────────────────────────────────────────
|
|
346
347
|
VITALS
|
|
347
348
|
───────────────────────────────────────────────────────────── */
|
|
348
349
|
recordVitals(e) {
|
|
349
|
-
this.vitals.push(e), this.vitals.sort((t,
|
|
350
|
+
this.vitals.push(e), this.vitals.sort((t, n) => new Date(n.date).getTime() - new Date(t.date).getTime());
|
|
350
351
|
}
|
|
351
352
|
getVitalsHistory() {
|
|
352
353
|
return [...this.vitals];
|
|
@@ -356,21 +357,21 @@ class ne {
|
|
|
356
357
|
}
|
|
357
358
|
getWeightHistory(e = 30) {
|
|
358
359
|
const t = new Date(Date.now() - e * 864e5);
|
|
359
|
-
return this.vitals.filter((
|
|
360
|
+
return this.vitals.filter((n) => n.weight !== void 0 && new Date(n.date) >= t).map((n) => ({ date: n.date, weight: n.weight }));
|
|
360
361
|
}
|
|
361
362
|
/* ─────────────────────────────────────────────────────────────
|
|
362
363
|
GOALS
|
|
363
364
|
───────────────────────────────────────────────────────────── */
|
|
364
365
|
setGoal(e) {
|
|
365
|
-
const t = this.goals.findIndex((
|
|
366
|
+
const t = this.goals.findIndex((n) => n.id === e.id);
|
|
366
367
|
t >= 0 ? this.goals[t] = e : this.goals.push(e);
|
|
367
368
|
}
|
|
368
369
|
getGoals() {
|
|
369
370
|
return [...this.goals];
|
|
370
371
|
}
|
|
371
372
|
updateGoalProgress(e, t) {
|
|
372
|
-
const
|
|
373
|
-
|
|
373
|
+
const n = this.goals.find((o) => o.id === e);
|
|
374
|
+
n && (n.current = t);
|
|
374
375
|
}
|
|
375
376
|
/* ─────────────────────────────────────────────────────────────
|
|
376
377
|
UTILITIES
|
|
@@ -382,17 +383,17 @@ class ne {
|
|
|
382
383
|
this.workouts.clear(), this.meals.clear(), this.sleep.clear(), this.medicalRecords.clear(), this.medications.clear(), this.medicationLogs = [], this.vitals = [], this.goals = [];
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
|
-
function
|
|
386
|
-
return new
|
|
386
|
+
function qe() {
|
|
387
|
+
return new le();
|
|
387
388
|
}
|
|
388
|
-
const
|
|
389
|
-
function
|
|
390
|
-
const s =
|
|
389
|
+
const K = /* @__PURE__ */ H(null);
|
|
390
|
+
function Qe() {
|
|
391
|
+
const s = L(K);
|
|
391
392
|
if (!s)
|
|
392
393
|
throw new Error("useHealth must be used within HealthProvider");
|
|
393
394
|
return s;
|
|
394
395
|
}
|
|
395
|
-
const
|
|
396
|
+
const f = {
|
|
396
397
|
container: {
|
|
397
398
|
display: "flex",
|
|
398
399
|
height: "100%",
|
|
@@ -463,185 +464,179 @@ const h = {
|
|
|
463
464
|
borderBottom: "1px solid #f0f0f0"
|
|
464
465
|
}
|
|
465
466
|
};
|
|
466
|
-
function
|
|
467
|
-
const [,
|
|
468
|
-
{ id: "overview", label: "Overview" },
|
|
469
|
-
{ id: "workouts", label: "Workouts" },
|
|
470
|
-
{ id: "nutrition", label: "Nutrition" },
|
|
471
|
-
{ id: "sleep", label: "Sleep" },
|
|
472
|
-
{ id: "medical", label: "Medical" },
|
|
473
|
-
{ id: "medications", label: "Medications" }
|
|
467
|
+
function Ye({ service: s, className: e, style: t }) {
|
|
468
|
+
const { t: n } = w(), [, o] = T(0), [r, i] = T("overview"), d = N(() => o((u) => u + 1), []), c = { service: s, refresh: d }, g = [
|
|
469
|
+
{ id: "overview", label: n("health.overview", "Overview") },
|
|
470
|
+
{ id: "workouts", label: n("health.workouts", "Workouts") },
|
|
471
|
+
{ id: "nutrition", label: n("health.nutrition", "Nutrition") },
|
|
472
|
+
{ id: "sleep", label: n("health.sleep", "Sleep") },
|
|
473
|
+
{ id: "medical", label: n("health.medical", "Medical") },
|
|
474
|
+
{ id: "medications", label: n("health.medications", "Medications") }
|
|
474
475
|
];
|
|
475
|
-
return /* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
476
|
+
return /* @__PURE__ */ a(K.Provider, { value: c, children: /* @__PURE__ */ l("div", { className: e, style: { ...f.container, ...t }, children: [
|
|
477
|
+
/* @__PURE__ */ a("div", { style: f.sidebar, children: g.map((u) => /* @__PURE__ */ a(
|
|
477
478
|
"div",
|
|
478
479
|
{
|
|
479
|
-
|
|
480
|
+
role: "button",
|
|
481
|
+
tabIndex: 0,
|
|
482
|
+
onKeyDown: A,
|
|
483
|
+
onClick: () => i(u.id),
|
|
480
484
|
style: {
|
|
481
|
-
...
|
|
482
|
-
backgroundColor:
|
|
483
|
-
borderLeftColor:
|
|
484
|
-
fontWeight:
|
|
485
|
+
...f.navItem,
|
|
486
|
+
backgroundColor: r === u.id ? "#e3f2fd" : "transparent",
|
|
487
|
+
borderLeftColor: r === u.id ? "#1976d2" : "transparent",
|
|
488
|
+
fontWeight: r === u.id ? 600 : 400
|
|
485
489
|
},
|
|
486
|
-
children: /* @__PURE__ */
|
|
490
|
+
children: /* @__PURE__ */ a("span", { children: u.label })
|
|
487
491
|
},
|
|
488
|
-
|
|
492
|
+
u.id
|
|
489
493
|
)) }),
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
494
|
+
/* @__PURE__ */ l("div", { style: f.main, children: [
|
|
495
|
+
r === "overview" && /* @__PURE__ */ a(de, { service: s }),
|
|
496
|
+
r === "workouts" && /* @__PURE__ */ a(ce, { service: s, refresh: d }),
|
|
497
|
+
r === "nutrition" && /* @__PURE__ */ a(he, { service: s }),
|
|
498
|
+
r === "sleep" && /* @__PURE__ */ a(ue, { service: s }),
|
|
499
|
+
r === "medical" && /* @__PURE__ */ a(ge, { service: s }),
|
|
500
|
+
r === "medications" && /* @__PURE__ */ a(pe, { service: s, refresh: d })
|
|
497
501
|
] })
|
|
498
502
|
] }) });
|
|
499
503
|
}
|
|
500
|
-
function
|
|
501
|
-
const e = s.getWorkoutStats(7),
|
|
502
|
-
return /* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
512
|
-
/* @__PURE__ */
|
|
504
|
+
function de({ service: s }) {
|
|
505
|
+
const { t: e } = w(), t = s.getWorkoutStats(7), n = s.getSleepStats(7), o = s.getDailyNutrition(/* @__PURE__ */ new Date()), r = s.getLatestVitals(), i = s.getTodayMedicationSchedule();
|
|
506
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
507
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.healthOverview", "Health Overview") }),
|
|
508
|
+
/* @__PURE__ */ l("div", { style: f.grid, children: [
|
|
509
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
510
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.thisWeeksWorkouts", "This Week's Workouts") }),
|
|
511
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: t.totalWorkouts }),
|
|
512
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.workouts", "Workouts") }),
|
|
513
|
+
/* @__PURE__ */ l("div", { style: { marginTop: "12px", display: "flex", gap: "20px" }, children: [
|
|
514
|
+
/* @__PURE__ */ l("div", { children: [
|
|
515
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: t.totalDuration }),
|
|
516
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.minutes", "Minutes") })
|
|
513
517
|
] }),
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ l("div", { children: [
|
|
519
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: t.totalCalories }),
|
|
520
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.calories", "Calories") })
|
|
517
521
|
] })
|
|
518
522
|
] })
|
|
519
523
|
] }),
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
523
|
-
|
|
524
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
525
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.sleep7DayAverage", "Sleep (7-Day Average)") }),
|
|
526
|
+
/* @__PURE__ */ l("div", { style: f.statValue, children: [
|
|
527
|
+
n.avgDuration.toFixed(1),
|
|
524
528
|
"h"
|
|
525
529
|
] }),
|
|
526
|
-
/* @__PURE__ */
|
|
527
|
-
/* @__PURE__ */
|
|
528
|
-
"
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
] }) })
|
|
530
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.perNight", "Per Night") }),
|
|
531
|
+
/* @__PURE__ */ a("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children: e("health.quality4", "Quality: {avgQuality}/4").replace(
|
|
532
|
+
"{avgQuality}",
|
|
533
|
+
String(n.avgQuality.toFixed(1))
|
|
534
|
+
) }) })
|
|
532
535
|
] }),
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
536
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
537
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.todaysNutrition", "Today's Nutrition") }),
|
|
538
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.calories }),
|
|
539
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.calories", "Calories") }),
|
|
540
|
+
/* @__PURE__ */ l("div", { style: { marginTop: "12px", display: "flex", gap: "16px", fontSize: "14px" }, children: [
|
|
541
|
+
/* @__PURE__ */ l("div", { children: [
|
|
539
542
|
"P: ",
|
|
540
|
-
|
|
543
|
+
o.protein,
|
|
541
544
|
"g"
|
|
542
545
|
] }),
|
|
543
|
-
/* @__PURE__ */
|
|
546
|
+
/* @__PURE__ */ l("div", { children: [
|
|
544
547
|
"C: ",
|
|
545
|
-
|
|
548
|
+
o.carbs,
|
|
546
549
|
"g"
|
|
547
550
|
] }),
|
|
548
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ l("div", { children: [
|
|
549
552
|
"F: ",
|
|
550
|
-
|
|
553
|
+
o.fat,
|
|
551
554
|
"g"
|
|
552
555
|
] })
|
|
553
556
|
] })
|
|
554
557
|
] }),
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
|
|
558
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
559
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.latestVitals", "Latest Vitals") }),
|
|
560
|
+
r ? /* @__PURE__ */ l("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "12px" }, children: [
|
|
561
|
+
r.weight && /* @__PURE__ */ l("div", { children: [
|
|
562
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "18px", fontWeight: 600 }, children: [
|
|
563
|
+
r.weight,
|
|
561
564
|
" ",
|
|
562
|
-
|
|
565
|
+
r.weightUnit || e("health.kg", "kg")
|
|
563
566
|
] }),
|
|
564
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.weight", "Weight") })
|
|
565
568
|
] }),
|
|
566
|
-
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
|
|
569
|
+
r.bloodPressureSystolic && /* @__PURE__ */ l("div", { children: [
|
|
570
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "18px", fontWeight: 600 }, children: [
|
|
571
|
+
r.bloodPressureSystolic,
|
|
569
572
|
"/",
|
|
570
|
-
|
|
573
|
+
r.bloodPressureDiastolic
|
|
571
574
|
] }),
|
|
572
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.bloodPressure", "Blood Pressure") })
|
|
573
576
|
] }),
|
|
574
|
-
|
|
575
|
-
/* @__PURE__ */
|
|
576
|
-
/* @__PURE__ */
|
|
577
|
+
r.heartRate && /* @__PURE__ */ l("div", { children: [
|
|
578
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: r.heartRate }),
|
|
579
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("health.heartRate", "Heart Rate") })
|
|
577
580
|
] })
|
|
578
|
-
] }) : /* @__PURE__ */
|
|
581
|
+
] }) : /* @__PURE__ */ a("div", { style: { color: "#999" }, children: e("health.noVitalsRecorded", "No vitals recorded") })
|
|
579
582
|
] })
|
|
580
583
|
] }),
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */
|
|
586
|
-
|
|
584
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
585
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.todaysMedications", "Today's Medications") }),
|
|
586
|
+
i.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: e("health.noMedicationsScheduled", "No medications scheduled") }) : i.map((d, c) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
587
|
+
/* @__PURE__ */ a("span", { style: { width: "60px", fontWeight: 500 }, children: d.time }),
|
|
588
|
+
/* @__PURE__ */ l("span", { style: { flex: 1 }, children: [
|
|
589
|
+
d.medication.name,
|
|
587
590
|
" (",
|
|
588
|
-
|
|
591
|
+
d.medication.dosage,
|
|
589
592
|
")"
|
|
590
593
|
] }),
|
|
591
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ a(
|
|
592
595
|
"span",
|
|
593
596
|
{
|
|
594
597
|
style: {
|
|
595
598
|
padding: "4px 12px",
|
|
596
599
|
borderRadius: "12px",
|
|
597
600
|
fontSize: "12px",
|
|
598
|
-
backgroundColor:
|
|
599
|
-
color:
|
|
601
|
+
backgroundColor: d.taken ? "#e8f5e9" : "#fff3e0",
|
|
602
|
+
color: d.taken ? "#2e7d32" : "#ef6c00"
|
|
600
603
|
},
|
|
601
|
-
children:
|
|
604
|
+
children: d.taken ? e("health.taken", "Taken") : e("health.pending", "Pending")
|
|
602
605
|
}
|
|
603
606
|
)
|
|
604
|
-
] },
|
|
607
|
+
] }, c))
|
|
605
608
|
] })
|
|
606
609
|
] });
|
|
607
610
|
}
|
|
608
|
-
function
|
|
611
|
+
function ce({
|
|
609
612
|
service: s,
|
|
610
613
|
refresh: e
|
|
611
614
|
}) {
|
|
612
|
-
const t = s.getAllWorkouts(),
|
|
613
|
-
return /* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
/* @__PURE__ */
|
|
615
|
+
const { t } = w(), n = s.getAllWorkouts(), o = s.getWorkoutStats(30);
|
|
616
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
617
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: t("health.workouts", "Workouts") }),
|
|
618
|
+
/* @__PURE__ */ l("div", { style: f.grid, children: [
|
|
619
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
620
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.totalWorkouts }),
|
|
621
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: t("health.workouts30Days", "Workouts (30 days)") })
|
|
619
622
|
] }),
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
624
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.totalDuration }),
|
|
625
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: t("health.totalMinutes", "Total Minutes") })
|
|
623
626
|
] }),
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
628
|
+
/* @__PURE__ */ a("div", { style: f.statValue, children: o.totalCalories }),
|
|
629
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: t("health.caloriesBurned", "Calories Burned") })
|
|
627
630
|
] })
|
|
628
631
|
] }),
|
|
629
|
-
/* @__PURE__ */
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
635
|
-
new Date(n.date).toLocaleDateString(),
|
|
636
|
-
" • ",
|
|
637
|
-
n.duration,
|
|
638
|
-
" min •",
|
|
639
|
-
" ",
|
|
640
|
-
n.caloriesBurned,
|
|
641
|
-
" cal"
|
|
642
|
-
] })
|
|
632
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
633
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: t("health.recentWorkouts", "Recent Workouts") }),
|
|
634
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: t("health.noWorkoutsLoggedYet", "No workouts logged yet") }) : n.slice(0, 10).map((r) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
635
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
636
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: r.name }),
|
|
637
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: t("health.minCal", "{date} • {duration} min • {caloriesBurned} cal").replace("{date}", String(new Date(r.date).toLocaleDateString())).replace("{duration}", String(r.duration)).replace("{caloriesBurned}", String(r.caloriesBurned)) })
|
|
643
638
|
] }),
|
|
644
|
-
/* @__PURE__ */
|
|
639
|
+
/* @__PURE__ */ a(
|
|
645
640
|
"span",
|
|
646
641
|
{
|
|
647
642
|
style: {
|
|
@@ -649,188 +644,201 @@ function oe({
|
|
|
649
644
|
borderRadius: "4px",
|
|
650
645
|
fontSize: "12px",
|
|
651
646
|
backgroundColor: "#e3f2fd",
|
|
652
|
-
color: "#1565c0"
|
|
653
|
-
textTransform: "capitalize"
|
|
647
|
+
color: "#1565c0"
|
|
654
648
|
},
|
|
655
|
-
children:
|
|
649
|
+
children: t(`health.exerciseType.${r.type}`, r.type)
|
|
656
650
|
}
|
|
657
651
|
)
|
|
658
|
-
] },
|
|
652
|
+
] }, r.id))
|
|
659
653
|
] })
|
|
660
654
|
] });
|
|
661
655
|
}
|
|
662
|
-
function
|
|
663
|
-
const e = s.getDailyNutrition(/* @__PURE__ */ new Date()),
|
|
664
|
-
return /* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
{
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
656
|
+
function he({ service: s }) {
|
|
657
|
+
const { t: e } = w(), t = s.getDailyNutrition(/* @__PURE__ */ new Date()), n = s.getMealsForDate(/* @__PURE__ */ new Date()), o = { calories: 2e3, protein: 150, carbs: 250, fat: 65 };
|
|
658
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
659
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.nutrition", "Nutrition") }),
|
|
660
|
+
/* @__PURE__ */ a("div", { style: f.grid, children: [
|
|
661
|
+
{
|
|
662
|
+
label: e("health.calories", "Calories"),
|
|
663
|
+
value: t.calories,
|
|
664
|
+
target: o.calories,
|
|
665
|
+
unit: ""
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
label: e("health.protein", "Protein"),
|
|
669
|
+
value: t.protein,
|
|
670
|
+
target: o.protein,
|
|
671
|
+
unit: "g"
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
label: e("health.carbs", "Carbs"),
|
|
675
|
+
value: t.carbs,
|
|
676
|
+
target: o.carbs,
|
|
677
|
+
unit: "g"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
label: e("health.fat", "Fat"),
|
|
681
|
+
value: t.fat,
|
|
682
|
+
target: o.fat,
|
|
683
|
+
unit: "g"
|
|
684
|
+
}
|
|
685
|
+
].map((r) => /* @__PURE__ */ l("div", { style: f.card, children: [
|
|
686
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" }, children: [
|
|
687
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: r.label }),
|
|
688
|
+
/* @__PURE__ */ l("span", { children: [
|
|
689
|
+
r.value,
|
|
690
|
+
r.unit,
|
|
677
691
|
" / ",
|
|
678
|
-
|
|
679
|
-
|
|
692
|
+
r.target,
|
|
693
|
+
r.unit
|
|
680
694
|
] })
|
|
681
695
|
] }),
|
|
682
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ a("div", { style: f.progressBar, children: /* @__PURE__ */ a(
|
|
683
697
|
"div",
|
|
684
698
|
{
|
|
685
699
|
style: {
|
|
686
|
-
width: `${Math.min(100,
|
|
700
|
+
width: `${Math.min(100, r.value / r.target * 100)}%`,
|
|
687
701
|
height: "100%",
|
|
688
|
-
backgroundColor:
|
|
702
|
+
backgroundColor: r.value > r.target ? "#f44336" : "#4caf50",
|
|
689
703
|
borderRadius: "4px"
|
|
690
704
|
}
|
|
691
705
|
}
|
|
692
706
|
) })
|
|
693
|
-
] },
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
696
|
-
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
701
|
-
|
|
702
|
-
" cal • P:"
|
|
703
|
-
|
|
704
|
-
"g C:",
|
|
705
|
-
n.totalCarbs,
|
|
706
|
-
"g F:",
|
|
707
|
-
n.totalFat,
|
|
708
|
-
"g"
|
|
709
|
-
] })
|
|
707
|
+
] }, r.label)) }),
|
|
708
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
709
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.todaysMeals", "Today's Meals") }),
|
|
710
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: e("health.noMealsLoggedToday", "No meals logged today") }) : n.map((r) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
711
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500, width: "80px" }, children: e(`health.mealType.${r.type}`, r.type) }),
|
|
712
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
713
|
+
/* @__PURE__ */ a("div", { children: r.foods.map((i) => i.item.name).join(", ") }),
|
|
714
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e(
|
|
715
|
+
"health.calPGCG",
|
|
716
|
+
"{totalCalories} cal • P:{totalProtein}g C:{totalCarbs}g F:{totalFat}g"
|
|
717
|
+
).replace("{totalCalories}", String(r.totalCalories)).replace("{totalProtein}", String(r.totalProtein)).replace("{totalCarbs}", String(r.totalCarbs)).replace("{totalFat}", String(r.totalFat)) })
|
|
710
718
|
] })
|
|
711
|
-
] },
|
|
719
|
+
] }, r.id))
|
|
712
720
|
] })
|
|
713
721
|
] });
|
|
714
722
|
}
|
|
715
|
-
function
|
|
716
|
-
const e = s.getSleepStats(7),
|
|
723
|
+
function ue({ service: s }) {
|
|
724
|
+
const { t: e } = w(), t = s.getSleepStats(7), n = s.getAllSleepEntries(), o = {
|
|
717
725
|
poor: "#f44336",
|
|
718
726
|
fair: "#ff9800",
|
|
719
727
|
good: "#4caf50",
|
|
720
728
|
excellent: "#2196f3"
|
|
721
729
|
};
|
|
722
|
-
return /* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
|
|
730
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
731
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.sleepTracking", "Sleep Tracking") }),
|
|
732
|
+
/* @__PURE__ */ l("div", { style: f.grid, children: [
|
|
733
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
734
|
+
/* @__PURE__ */ l("div", { style: f.statValue, children: [
|
|
735
|
+
t.avgDuration.toFixed(1),
|
|
728
736
|
"h"
|
|
729
737
|
] }),
|
|
730
|
-
/* @__PURE__ */
|
|
738
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.avgSleep7Days", "Avg Sleep (7 days)") })
|
|
731
739
|
] }),
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
|
|
740
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
741
|
+
/* @__PURE__ */ l("div", { style: f.statValue, children: [
|
|
742
|
+
t.avgQuality.toFixed(1),
|
|
735
743
|
"/4"
|
|
736
744
|
] }),
|
|
737
|
-
/* @__PURE__ */
|
|
745
|
+
/* @__PURE__ */ a("div", { style: f.statLabel, children: e("health.avgQuality", "Avg Quality") })
|
|
738
746
|
] })
|
|
739
747
|
] }),
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */ a("span", { style: { flex: 1 }, children:
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
/* @__PURE__ */
|
|
748
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
749
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.sleepHistory", "Sleep History") }),
|
|
750
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: e("health.noSleepDataLogged", "No sleep data logged") }) : n.slice(0, 10).map((r) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
751
|
+
/* @__PURE__ */ a("span", { style: { width: "100px" }, children: new Date(r.date).toLocaleDateString() }),
|
|
752
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: e("health.hours", "{duration} hours").replace(
|
|
753
|
+
"{duration}",
|
|
754
|
+
String(r.duration.toFixed(1))
|
|
755
|
+
) }),
|
|
756
|
+
/* @__PURE__ */ a(
|
|
749
757
|
"span",
|
|
750
758
|
{
|
|
751
759
|
style: {
|
|
752
760
|
padding: "4px 12px",
|
|
753
761
|
borderRadius: "12px",
|
|
754
762
|
fontSize: "12px",
|
|
755
|
-
backgroundColor: r
|
|
756
|
-
color: r
|
|
757
|
-
textTransform: "capitalize"
|
|
763
|
+
backgroundColor: o[r.quality] + "20",
|
|
764
|
+
color: o[r.quality]
|
|
758
765
|
},
|
|
759
|
-
children:
|
|
766
|
+
children: e(`health.sleepQuality.${r.quality}`, r.quality)
|
|
760
767
|
}
|
|
761
768
|
)
|
|
762
|
-
] },
|
|
769
|
+
] }, r.id))
|
|
763
770
|
] })
|
|
764
771
|
] });
|
|
765
772
|
}
|
|
766
|
-
function
|
|
767
|
-
const e = s.getAllMedicalRecords(),
|
|
768
|
-
appointment: "Appt",
|
|
769
|
-
"lab-result": "Lab",
|
|
770
|
-
vaccination: "Vacc",
|
|
771
|
-
prescription: "Rx",
|
|
772
|
-
procedure: "Proc",
|
|
773
|
-
diagnosis: "Dx",
|
|
774
|
-
note: "Note"
|
|
775
|
-
},
|
|
773
|
+
function ge({ service: s }) {
|
|
774
|
+
const { t: e } = w(), t = s.getAllMedicalRecords(), n = s.getUpcomingFollowUps(), o = {
|
|
775
|
+
appointment: e("health.appt", "Appt"),
|
|
776
|
+
"lab-result": e("health.lab", "Lab"),
|
|
777
|
+
vaccination: e("health.vacc", "Vacc"),
|
|
778
|
+
prescription: e("health.rx", "Rx"),
|
|
779
|
+
procedure: e("health.proc", "Proc"),
|
|
780
|
+
diagnosis: e("health.dx", "Dx"),
|
|
781
|
+
note: e("health.note", "Note")
|
|
782
|
+
}, r = {
|
|
776
783
|
minWidth: "40px",
|
|
777
784
|
fontSize: "11px",
|
|
778
785
|
fontWeight: 600,
|
|
779
786
|
textTransform: "uppercase",
|
|
780
787
|
color: "#666"
|
|
781
788
|
};
|
|
782
|
-
return /* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
|
|
785
|
-
/* @__PURE__ */
|
|
786
|
-
|
|
787
|
-
/* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
-
] },
|
|
789
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
790
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("health.medicalRecords", "Medical Records") }),
|
|
791
|
+
n.length > 0 && /* @__PURE__ */ l("div", { style: { ...f.card, marginBottom: "20px", backgroundColor: "#fff3e0" }, children: [
|
|
792
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.upcomingFollowUps", "Upcoming Follow-ups") }),
|
|
793
|
+
n.map((i) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
794
|
+
/* @__PURE__ */ a("span", { style: r, children: o[i.type] }),
|
|
795
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: i.title }),
|
|
796
|
+
/* @__PURE__ */ a("span", { style: { color: "#ef6c00" }, children: new Date(i.followUp).toLocaleDateString() })
|
|
797
|
+
] }, i.id))
|
|
791
798
|
] }),
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
new Date(
|
|
800
|
-
|
|
799
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
800
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: e("health.allRecords", "All Records") }),
|
|
801
|
+
t.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: e("health.noMedicalRecords", "No medical records") }) : t.slice(0, 15).map((i) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
802
|
+
/* @__PURE__ */ a("span", { style: r, children: o[i.type] }),
|
|
803
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
804
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.title }),
|
|
805
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
806
|
+
new Date(i.date).toLocaleDateString(),
|
|
807
|
+
i.provider && ` • ${i.provider}`
|
|
801
808
|
] })
|
|
802
809
|
] })
|
|
803
|
-
] },
|
|
810
|
+
] }, i.id))
|
|
804
811
|
] })
|
|
805
812
|
] });
|
|
806
813
|
}
|
|
807
|
-
function
|
|
814
|
+
function pe({
|
|
808
815
|
service: s,
|
|
809
816
|
refresh: e
|
|
810
817
|
}) {
|
|
818
|
+
const { t } = w();
|
|
811
819
|
s.getAllMedications();
|
|
812
|
-
const
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
parseInt(
|
|
816
|
-
parseInt(
|
|
820
|
+
const n = s.getActiveMedications(), o = s.getTodayMedicationSchedule(), r = (i) => {
|
|
821
|
+
const d = /* @__PURE__ */ new Date();
|
|
822
|
+
d.setHours(
|
|
823
|
+
parseInt(i.times[0].split(":")[0]),
|
|
824
|
+
parseInt(i.times[0].split(":")[1]),
|
|
817
825
|
0
|
|
818
|
-
), s.logMedication(
|
|
826
|
+
), s.logMedication(i.id, d, !0), e();
|
|
819
827
|
};
|
|
820
|
-
return /* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
/* @__PURE__ */
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
|
|
825
|
-
/* @__PURE__ */
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
/* @__PURE__ */
|
|
828
|
-
/* @__PURE__ */
|
|
828
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
829
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: t("health.medications", "Medications") }),
|
|
830
|
+
/* @__PURE__ */ l("div", { style: { ...f.card, marginBottom: "20px" }, children: [
|
|
831
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: t("health.todaysSchedule", "Today's Schedule") }),
|
|
832
|
+
o.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: t("health.noMedicationsScheduled", "No medications scheduled") }) : o.map((i, d) => /* @__PURE__ */ l("div", { style: f.listItem, children: [
|
|
833
|
+
/* @__PURE__ */ a("span", { style: { width: "60px", fontWeight: 500 }, children: i.time }),
|
|
834
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
835
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.medication.name }),
|
|
836
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: i.medication.dosage })
|
|
829
837
|
] }),
|
|
830
|
-
!
|
|
838
|
+
!i.taken && /* @__PURE__ */ a(
|
|
831
839
|
"button",
|
|
832
840
|
{
|
|
833
|
-
onClick: () =>
|
|
841
|
+
onClick: () => r(i.medication),
|
|
834
842
|
style: {
|
|
835
843
|
padding: "6px 16px",
|
|
836
844
|
border: "none",
|
|
@@ -840,28 +848,28 @@ function de({
|
|
|
840
848
|
cursor: "pointer",
|
|
841
849
|
fontSize: "12px"
|
|
842
850
|
},
|
|
843
|
-
children: "Mark Taken"
|
|
851
|
+
children: t("health.markTaken", "Mark Taken")
|
|
844
852
|
}
|
|
845
853
|
),
|
|
846
|
-
|
|
847
|
-
] },
|
|
854
|
+
i.taken && /* @__PURE__ */ a("span", { style: { color: "#4caf50", fontSize: "12px" }, children: t("health.taken", "Taken") })
|
|
855
|
+
] }, d))
|
|
848
856
|
] }),
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
-
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
|
|
857
|
+
/* @__PURE__ */ l("div", { style: f.card, children: [
|
|
858
|
+
/* @__PURE__ */ a("div", { style: f.cardTitle, children: t("health.activeMedications", "Active Medications") }),
|
|
859
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: t("health.noActiveMedications", "No active medications") }) : n.map((i) => /* @__PURE__ */ a("div", { style: f.listItem, children: /* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
860
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.name }),
|
|
861
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
862
|
+
i.dosage,
|
|
855
863
|
" • ",
|
|
856
|
-
|
|
864
|
+
i.frequency,
|
|
857
865
|
" • ",
|
|
858
|
-
|
|
866
|
+
i.times.join(", ")
|
|
859
867
|
] })
|
|
860
|
-
] }) },
|
|
868
|
+
] }) }, i.id))
|
|
861
869
|
] })
|
|
862
870
|
] });
|
|
863
871
|
}
|
|
864
|
-
const
|
|
872
|
+
const fe = [
|
|
865
873
|
{ id: "income", name: "Income", icon: "dollar", color: "#4caf50" },
|
|
866
874
|
{ id: "salary", name: "Salary", icon: "briefcase", color: "#4caf50", parent: "income" },
|
|
867
875
|
{ id: "interest", name: "Interest", icon: "building", color: "#4caf50", parent: "income" },
|
|
@@ -884,31 +892,31 @@ const ce = [
|
|
|
884
892
|
{ id: "transfer", name: "Transfer", icon: "shuffle", color: "#9e9e9e" },
|
|
885
893
|
{ id: "other", name: "Other", icon: "box", color: "#9e9e9e" }
|
|
886
894
|
];
|
|
887
|
-
class
|
|
895
|
+
class me {
|
|
888
896
|
constructor() {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
897
|
+
k(this, "accounts", /* @__PURE__ */ new Map());
|
|
898
|
+
k(this, "transactions", /* @__PURE__ */ new Map());
|
|
899
|
+
k(this, "budgets", /* @__PURE__ */ new Map());
|
|
900
|
+
k(this, "bills", /* @__PURE__ */ new Map());
|
|
901
|
+
k(this, "investments", /* @__PURE__ */ new Map());
|
|
902
|
+
k(this, "categories", [...fe]);
|
|
903
|
+
k(this, "netWorthHistory", []);
|
|
896
904
|
}
|
|
897
905
|
/* ─────────────────────────────────────────────────────────────
|
|
898
906
|
ACCOUNTS
|
|
899
907
|
───────────────────────────────────────────────────────────── */
|
|
900
908
|
addAccount(e) {
|
|
901
|
-
const t = this.generateId(),
|
|
902
|
-
return this.accounts.set(t,
|
|
909
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
910
|
+
return this.accounts.set(t, n), n;
|
|
903
911
|
}
|
|
904
912
|
updateAccount(e, t) {
|
|
905
|
-
const
|
|
906
|
-
|
|
913
|
+
const n = this.accounts.get(e);
|
|
914
|
+
n && this.accounts.set(e, { ...n, ...t, id: e });
|
|
907
915
|
}
|
|
908
916
|
deleteAccount(e) {
|
|
909
917
|
this.accounts.delete(e);
|
|
910
|
-
for (const [t,
|
|
911
|
-
|
|
918
|
+
for (const [t, n] of this.transactions)
|
|
919
|
+
n.accountId === e && this.transactions.delete(t);
|
|
912
920
|
}
|
|
913
921
|
getAllAccounts() {
|
|
914
922
|
return Array.from(this.accounts.values());
|
|
@@ -941,30 +949,30 @@ class ue {
|
|
|
941
949
|
TRANSACTIONS
|
|
942
950
|
───────────────────────────────────────────────────────────── */
|
|
943
951
|
addTransaction(e) {
|
|
944
|
-
const t = this.generateId(),
|
|
945
|
-
this.transactions.set(t,
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
const
|
|
949
|
-
|
|
952
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
953
|
+
this.transactions.set(t, n);
|
|
954
|
+
const o = this.accounts.get(e.accountId);
|
|
955
|
+
if (o) {
|
|
956
|
+
const r = e.type === "income" ? e.amount : -e.amount;
|
|
957
|
+
o.balance += r, this.accounts.set(o.id, o);
|
|
950
958
|
}
|
|
951
959
|
if (e.categoryId && e.type === "expense") {
|
|
952
|
-
const
|
|
953
|
-
|
|
960
|
+
const r = this.getBudgetByCategory(e.categoryId);
|
|
961
|
+
r && (r.spent += e.amount, this.budgets.set(r.id, r));
|
|
954
962
|
}
|
|
955
|
-
return
|
|
963
|
+
return n;
|
|
956
964
|
}
|
|
957
965
|
updateTransaction(e, t) {
|
|
958
|
-
const
|
|
959
|
-
|
|
966
|
+
const n = this.transactions.get(e);
|
|
967
|
+
n && this.transactions.set(e, { ...n, ...t, id: e });
|
|
960
968
|
}
|
|
961
969
|
deleteTransaction(e) {
|
|
962
970
|
const t = this.transactions.get(e);
|
|
963
971
|
if (t) {
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
966
|
-
const
|
|
967
|
-
|
|
972
|
+
const n = this.accounts.get(t.accountId);
|
|
973
|
+
if (n) {
|
|
974
|
+
const o = t.type === "income" ? -t.amount : t.amount;
|
|
975
|
+
n.balance += o, this.accounts.set(n.id, n);
|
|
968
976
|
}
|
|
969
977
|
this.transactions.delete(e);
|
|
970
978
|
}
|
|
@@ -978,9 +986,9 @@ class ue {
|
|
|
978
986
|
return this.getAllTransactions().filter((t) => t.accountId === e);
|
|
979
987
|
}
|
|
980
988
|
getTransactionsForPeriod(e, t) {
|
|
981
|
-
return this.getAllTransactions().filter((
|
|
982
|
-
const
|
|
983
|
-
return
|
|
989
|
+
return this.getAllTransactions().filter((n) => {
|
|
990
|
+
const o = new Date(n.date);
|
|
991
|
+
return o >= e && o <= t;
|
|
984
992
|
});
|
|
985
993
|
}
|
|
986
994
|
getTransactionsByCategory(e) {
|
|
@@ -1000,9 +1008,9 @@ class ue {
|
|
|
1000
1008
|
{ pattern: /doctor|pharmacy|hospital|medical/i, categoryId: "health" },
|
|
1001
1009
|
{ pattern: /payroll|salary|paycheck|deposit/i, categoryId: "salary" }
|
|
1002
1010
|
];
|
|
1003
|
-
for (const
|
|
1004
|
-
if (
|
|
1005
|
-
return
|
|
1011
|
+
for (const n of t)
|
|
1012
|
+
if (n.pattern.test(e))
|
|
1013
|
+
return n.categoryId;
|
|
1006
1014
|
}
|
|
1007
1015
|
/* ─────────────────────────────────────────────────────────────
|
|
1008
1016
|
CATEGORIES
|
|
@@ -1023,12 +1031,12 @@ class ue {
|
|
|
1023
1031
|
BUDGETS
|
|
1024
1032
|
───────────────────────────────────────────────────────────── */
|
|
1025
1033
|
addBudget(e) {
|
|
1026
|
-
const t = this.generateId(),
|
|
1027
|
-
return this.budgets.set(t,
|
|
1034
|
+
const t = this.generateId(), n = { ...e, id: t, spent: 0 };
|
|
1035
|
+
return this.budgets.set(t, n), n;
|
|
1028
1036
|
}
|
|
1029
1037
|
updateBudget(e, t) {
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1038
|
+
const n = this.budgets.get(e);
|
|
1039
|
+
n && this.budgets.set(e, { ...n, ...t, id: e });
|
|
1032
1040
|
}
|
|
1033
1041
|
deleteBudget(e) {
|
|
1034
1042
|
this.budgets.delete(e);
|
|
@@ -1044,19 +1052,19 @@ class ue {
|
|
|
1044
1052
|
t.rollover || (t.spent = 0), this.budgets.set(e, t);
|
|
1045
1053
|
}
|
|
1046
1054
|
calculateBudgetStatus() {
|
|
1047
|
-
const e = this.getAllBudgets(), t = e.reduce((
|
|
1048
|
-
return { total: t, used:
|
|
1055
|
+
const e = this.getAllBudgets(), t = e.reduce((r, i) => r + i.amount, 0), n = e.reduce((r, i) => r + i.spent, 0), o = e.filter((r) => r.spent > r.amount);
|
|
1056
|
+
return { total: t, used: n, remaining: t - n, overBudget: o };
|
|
1049
1057
|
}
|
|
1050
1058
|
/* ─────────────────────────────────────────────────────────────
|
|
1051
1059
|
BILLS
|
|
1052
1060
|
───────────────────────────────────────────────────────────── */
|
|
1053
1061
|
addBill(e) {
|
|
1054
|
-
const t = this.generateId(),
|
|
1055
|
-
return this.bills.set(t,
|
|
1062
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
1063
|
+
return this.bills.set(t, n), n;
|
|
1056
1064
|
}
|
|
1057
1065
|
updateBill(e, t) {
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1066
|
+
const n = this.bills.get(e);
|
|
1067
|
+
n && this.bills.set(e, { ...n, ...t, id: e });
|
|
1060
1068
|
}
|
|
1061
1069
|
deleteBill(e) {
|
|
1062
1070
|
this.bills.delete(e);
|
|
@@ -1069,11 +1077,11 @@ class ue {
|
|
|
1069
1077
|
return Array.from(this.bills.values());
|
|
1070
1078
|
}
|
|
1071
1079
|
getUpcomingBills(e = 30) {
|
|
1072
|
-
const
|
|
1073
|
-
return this.getAllBills().filter((
|
|
1074
|
-
let
|
|
1075
|
-
return
|
|
1076
|
-
}).sort((
|
|
1080
|
+
const n = (/* @__PURE__ */ new Date()).getDate();
|
|
1081
|
+
return this.getAllBills().filter((o) => {
|
|
1082
|
+
let r = o.dueDate - n;
|
|
1083
|
+
return r < 0 && (r += 30), r <= e;
|
|
1084
|
+
}).sort((o, r) => o.dueDate - r.dueDate);
|
|
1077
1085
|
}
|
|
1078
1086
|
calculateMonthlyBillTotal() {
|
|
1079
1087
|
return this.getAllBills().filter((e) => e.frequency === "monthly").reduce((e, t) => e + t.amount, 0);
|
|
@@ -1082,12 +1090,12 @@ class ue {
|
|
|
1082
1090
|
INVESTMENTS
|
|
1083
1091
|
───────────────────────────────────────────────────────────── */
|
|
1084
1092
|
addInvestment(e) {
|
|
1085
|
-
const t = this.generateId(),
|
|
1086
|
-
return this.investments.set(t,
|
|
1093
|
+
const t = this.generateId(), n = e.shares * e.currentPrice, o = n - e.costBasis, r = e.costBasis > 0 ? o / e.costBasis * 100 : 0, i = { ...e, id: t, currentValue: n, gain: o, gainPercent: r };
|
|
1094
|
+
return this.investments.set(t, i), i;
|
|
1087
1095
|
}
|
|
1088
1096
|
updateInvestmentPrice(e, t) {
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1097
|
+
const n = this.investments.get(e);
|
|
1098
|
+
n && (n.currentPrice = t, n.currentValue = n.shares * t, n.gain = n.currentValue - n.costBasis, n.gainPercent = n.costBasis > 0 ? n.gain / n.costBasis * 100 : 0, this.investments.set(e, n));
|
|
1091
1099
|
}
|
|
1092
1100
|
deleteInvestment(e) {
|
|
1093
1101
|
this.investments.delete(e);
|
|
@@ -1105,47 +1113,47 @@ class ue {
|
|
|
1105
1113
|
return this.getAllInvestments().reduce((e, t) => e + t.gain, 0);
|
|
1106
1114
|
}
|
|
1107
1115
|
getPortfolioAllocation() {
|
|
1108
|
-
const e = this.getAllInvestments(), t = this.calculateTotalInvestmentValue(),
|
|
1109
|
-
for (const
|
|
1110
|
-
|
|
1111
|
-
return Array.from(
|
|
1112
|
-
type:
|
|
1113
|
-
value:
|
|
1114
|
-
percentage: t > 0 ?
|
|
1116
|
+
const e = this.getAllInvestments(), t = this.calculateTotalInvestmentValue(), n = /* @__PURE__ */ new Map();
|
|
1117
|
+
for (const o of e)
|
|
1118
|
+
n.set(o.type, (n.get(o.type) || 0) + o.currentValue);
|
|
1119
|
+
return Array.from(n.entries()).map(([o, r]) => ({
|
|
1120
|
+
type: o,
|
|
1121
|
+
value: r,
|
|
1122
|
+
percentage: t > 0 ? r / t * 100 : 0
|
|
1115
1123
|
}));
|
|
1116
1124
|
}
|
|
1117
1125
|
/* ─────────────────────────────────────────────────────────────
|
|
1118
1126
|
ANALYTICS
|
|
1119
1127
|
───────────────────────────────────────────────────────────── */
|
|
1120
1128
|
getSpendingSummary(e, t) {
|
|
1121
|
-
const
|
|
1122
|
-
(
|
|
1123
|
-
),
|
|
1124
|
-
let
|
|
1125
|
-
for (const
|
|
1126
|
-
const d =
|
|
1127
|
-
c.amount +=
|
|
1129
|
+
const n = this.getTransactionsForPeriod(e, t).filter(
|
|
1130
|
+
(i) => i.type === "expense"
|
|
1131
|
+
), o = /* @__PURE__ */ new Map();
|
|
1132
|
+
let r = 0;
|
|
1133
|
+
for (const i of n) {
|
|
1134
|
+
const d = i.categoryId || "other", c = o.get(d) || { amount: 0, count: 0 };
|
|
1135
|
+
c.amount += i.amount, c.count++, o.set(d, c), r += i.amount;
|
|
1128
1136
|
}
|
|
1129
|
-
return Array.from(
|
|
1130
|
-
const c = this.categories.find((g) => g.id ===
|
|
1137
|
+
return Array.from(o.entries()).map(([i, d]) => {
|
|
1138
|
+
const c = this.categories.find((g) => g.id === i);
|
|
1131
1139
|
return {
|
|
1132
|
-
categoryId:
|
|
1140
|
+
categoryId: i,
|
|
1133
1141
|
categoryName: (c == null ? void 0 : c.name) || "Other",
|
|
1134
1142
|
amount: d.amount,
|
|
1135
|
-
percentage:
|
|
1143
|
+
percentage: r > 0 ? d.amount / r * 100 : 0,
|
|
1136
1144
|
transactions: d.count,
|
|
1137
1145
|
trend: "stable"
|
|
1138
1146
|
// Would compare with previous period
|
|
1139
1147
|
};
|
|
1140
|
-
}).sort((
|
|
1148
|
+
}).sort((i, d) => d.amount - i.amount);
|
|
1141
1149
|
}
|
|
1142
1150
|
getMonthlyIncome() {
|
|
1143
1151
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
1144
|
-
return this.getTransactionsForPeriod(t, e).filter((
|
|
1152
|
+
return this.getTransactionsForPeriod(t, e).filter((o) => o.type === "income").reduce((o, r) => o + r.amount, 0);
|
|
1145
1153
|
}
|
|
1146
1154
|
getMonthlyExpenses() {
|
|
1147
1155
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
1148
|
-
return this.getTransactionsForPeriod(t, e).filter((
|
|
1156
|
+
return this.getTransactionsForPeriod(t, e).filter((o) => o.type === "expense").reduce((o, r) => o + r.amount, 0);
|
|
1149
1157
|
}
|
|
1150
1158
|
getSavingsRate() {
|
|
1151
1159
|
const e = this.getMonthlyIncome(), t = this.getMonthlyExpenses();
|
|
@@ -1179,17 +1187,17 @@ class ue {
|
|
|
1179
1187
|
);
|
|
1180
1188
|
}
|
|
1181
1189
|
}
|
|
1182
|
-
function
|
|
1183
|
-
return new
|
|
1190
|
+
function _e() {
|
|
1191
|
+
return new me();
|
|
1184
1192
|
}
|
|
1185
|
-
const
|
|
1186
|
-
function
|
|
1187
|
-
const s =
|
|
1193
|
+
const q = /* @__PURE__ */ H(null);
|
|
1194
|
+
function Xe() {
|
|
1195
|
+
const s = L(q);
|
|
1188
1196
|
if (!s)
|
|
1189
1197
|
throw new Error("usePersonalFinance must be used within PersonalFinanceProvider");
|
|
1190
1198
|
return s;
|
|
1191
1199
|
}
|
|
1192
|
-
const
|
|
1200
|
+
const y = {
|
|
1193
1201
|
container: {
|
|
1194
1202
|
display: "flex",
|
|
1195
1203
|
height: "100%",
|
|
@@ -1271,43 +1279,45 @@ const m = {
|
|
|
1271
1279
|
marginTop: "8px"
|
|
1272
1280
|
}
|
|
1273
1281
|
};
|
|
1274
|
-
function
|
|
1282
|
+
function Je({
|
|
1275
1283
|
service: s,
|
|
1276
1284
|
className: e,
|
|
1277
1285
|
style: t
|
|
1278
1286
|
}) {
|
|
1279
|
-
const [,
|
|
1280
|
-
return /* @__PURE__ */
|
|
1281
|
-
/* @__PURE__ */
|
|
1282
|
-
/* @__PURE__ */
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1287
|
+
const { t: n } = w(), [, o] = T(0), [r, i] = T("overview"), d = N(() => o((p) => p + 1), []), c = { service: s, refresh: d }, g = (p) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(p), u = s.getAllAccounts(), h = s.calculateNetWorth();
|
|
1288
|
+
return /* @__PURE__ */ a(q.Provider, { value: c, children: /* @__PURE__ */ l("div", { className: e, style: { ...y.container, ...t }, children: [
|
|
1289
|
+
/* @__PURE__ */ l("div", { style: y.sidebar, children: [
|
|
1290
|
+
/* @__PURE__ */ l("div", { style: y.netWorth, children: [
|
|
1291
|
+
/* @__PURE__ */ a("div", { style: y.netWorthLabel, children: n("personalFinance.netWorth", "Net Worth") }),
|
|
1292
|
+
/* @__PURE__ */ a("div", { style: { ...y.netWorthValue, color: h >= 0 ? "#4caf50" : "#f44336" }, children: g(h) })
|
|
1285
1293
|
] }),
|
|
1286
|
-
/* @__PURE__ */
|
|
1294
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1287
1295
|
"overview",
|
|
1288
1296
|
"accounts",
|
|
1289
1297
|
"transactions",
|
|
1290
1298
|
"budgets",
|
|
1291
1299
|
"bills",
|
|
1292
1300
|
"investments"
|
|
1293
|
-
].map((p) => /* @__PURE__ */
|
|
1301
|
+
].map((p) => /* @__PURE__ */ a(
|
|
1294
1302
|
"div",
|
|
1295
1303
|
{
|
|
1296
|
-
|
|
1304
|
+
role: "button",
|
|
1305
|
+
tabIndex: 0,
|
|
1306
|
+
onKeyDown: A,
|
|
1307
|
+
onClick: () => i(p),
|
|
1297
1308
|
style: {
|
|
1298
1309
|
padding: "12px 16px",
|
|
1299
1310
|
borderRadius: "8px",
|
|
1300
1311
|
cursor: "pointer",
|
|
1301
1312
|
marginBottom: "4px",
|
|
1302
|
-
backgroundColor:
|
|
1303
|
-
textTransform: "capitalize"
|
|
1313
|
+
backgroundColor: r === p ? "rgba(255,255,255,0.1)" : "transparent"
|
|
1304
1314
|
},
|
|
1305
|
-
children: p
|
|
1315
|
+
children: n(`personalFinance.tab.${p}`, p.charAt(0).toUpperCase() + p.slice(1))
|
|
1306
1316
|
},
|
|
1307
1317
|
p
|
|
1308
1318
|
)) }),
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1319
|
+
/* @__PURE__ */ l("div", { style: y.accountList, children: [
|
|
1320
|
+
/* @__PURE__ */ a(
|
|
1311
1321
|
"div",
|
|
1312
1322
|
{
|
|
1313
1323
|
style: {
|
|
@@ -1316,41 +1326,41 @@ function Ke({
|
|
|
1316
1326
|
marginBottom: "12px",
|
|
1317
1327
|
textTransform: "uppercase"
|
|
1318
1328
|
},
|
|
1319
|
-
children: "Accounts"
|
|
1329
|
+
children: n("personalFinance.accounts", "Accounts")
|
|
1320
1330
|
}
|
|
1321
1331
|
),
|
|
1322
|
-
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1332
|
+
u.slice(0, 5).map((p) => /* @__PURE__ */ l("div", { style: y.accountItem, children: [
|
|
1333
|
+
/* @__PURE__ */ a("span", { children: p.name }),
|
|
1334
|
+
/* @__PURE__ */ a("span", { style: { color: p.balance >= 0 ? "#4caf50" : "#f44336" }, children: g(p.balance) })
|
|
1325
1335
|
] }, p.id))
|
|
1326
1336
|
] })
|
|
1327
1337
|
] }),
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1338
|
+
/* @__PURE__ */ l("div", { style: y.main, children: [
|
|
1339
|
+
r === "overview" && /* @__PURE__ */ a(ye, { service: s }),
|
|
1340
|
+
r === "accounts" && /* @__PURE__ */ a(xe, { service: s, refresh: d }),
|
|
1341
|
+
r === "transactions" && /* @__PURE__ */ a(be, { service: s }),
|
|
1342
|
+
r === "budgets" && /* @__PURE__ */ a(ve, { service: s }),
|
|
1343
|
+
r === "bills" && /* @__PURE__ */ a(we, { service: s }),
|
|
1344
|
+
r === "investments" && /* @__PURE__ */ a(ke, { service: s })
|
|
1335
1345
|
] })
|
|
1336
1346
|
] }) });
|
|
1337
1347
|
}
|
|
1338
|
-
function
|
|
1339
|
-
const e = (
|
|
1340
|
-
return /* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
+
function ye({ service: s }) {
|
|
1349
|
+
const { t: e, lang: t } = w(), n = (h) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(h), o = s.getMonthlyIncome(), r = s.getMonthlyExpenses(), i = s.getSavingsRate(), d = s.calculateBudgetStatus(), c = s.getUpcomingBills(14), g = /* @__PURE__ */ new Date(), u = s.getSpendingSummary(new Date(g.getFullYear(), g.getMonth(), 1), g);
|
|
1350
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1351
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.financialOverview", "Financial Overview") }),
|
|
1352
|
+
/* @__PURE__ */ l("div", { style: y.grid, children: [
|
|
1353
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1354
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.thisMonth", "This Month") }),
|
|
1355
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "12px" }, children: [
|
|
1356
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.income", "Income") }),
|
|
1357
|
+
/* @__PURE__ */ a("span", { style: { color: "#4caf50", fontWeight: 600 }, children: n(o) })
|
|
1348
1358
|
] }),
|
|
1349
|
-
/* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
/* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "12px" }, children: [
|
|
1360
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.expenses", "Expenses") }),
|
|
1361
|
+
/* @__PURE__ */ a("span", { style: { color: "#f44336", fontWeight: 600 }, children: n(r) })
|
|
1352
1362
|
] }),
|
|
1353
|
-
/* @__PURE__ */
|
|
1363
|
+
/* @__PURE__ */ l(
|
|
1354
1364
|
"div",
|
|
1355
1365
|
{
|
|
1356
1366
|
style: {
|
|
@@ -1360,44 +1370,44 @@ function ge({ service: s }) {
|
|
|
1360
1370
|
paddingTop: "12px"
|
|
1361
1371
|
},
|
|
1362
1372
|
children: [
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
|
|
1373
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.savingsRate", "Savings Rate") }),
|
|
1374
|
+
/* @__PURE__ */ l("span", { style: { fontWeight: 600 }, children: [
|
|
1375
|
+
i.toFixed(1),
|
|
1366
1376
|
"%"
|
|
1367
1377
|
] })
|
|
1368
1378
|
]
|
|
1369
1379
|
}
|
|
1370
1380
|
)
|
|
1371
1381
|
] }),
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1376
|
-
/* @__PURE__ */
|
|
1377
|
-
|
|
1382
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1383
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.budgetStatus", "Budget Status") }),
|
|
1384
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" }, children: [
|
|
1385
|
+
/* @__PURE__ */ a("span", { children: e("personalFinance.used", "Used") }),
|
|
1386
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1387
|
+
n(d.used),
|
|
1378
1388
|
" / ",
|
|
1379
|
-
|
|
1389
|
+
n(d.total)
|
|
1380
1390
|
] })
|
|
1381
1391
|
] }),
|
|
1382
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1383
1393
|
"div",
|
|
1384
1394
|
{
|
|
1385
1395
|
style: {
|
|
1386
|
-
width: `${Math.min(100,
|
|
1396
|
+
width: `${Math.min(100, d.used / d.total * 100)}%`,
|
|
1387
1397
|
height: "100%",
|
|
1388
|
-
backgroundColor:
|
|
1398
|
+
backgroundColor: d.used > d.total ? "#f44336" : "#4caf50",
|
|
1389
1399
|
borderRadius: "4px"
|
|
1390
1400
|
}
|
|
1391
1401
|
}
|
|
1392
1402
|
) }),
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
" categories over budget"
|
|
1396
|
-
|
|
1403
|
+
d.overBudget.length > 0 && /* @__PURE__ */ a("div", { style: { color: "#f44336", fontSize: "12px", marginTop: "8px" }, children: e(
|
|
1404
|
+
"personalFinance.categoriesOverBudget",
|
|
1405
|
+
"{overBudget} categories over budget"
|
|
1406
|
+
).replace("{overBudget}", String(d.overBudget.length)) })
|
|
1397
1407
|
] }),
|
|
1398
|
-
/* @__PURE__ */
|
|
1399
|
-
/* @__PURE__ */
|
|
1400
|
-
|
|
1408
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1409
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.upcomingBills14Days", "Upcoming Bills (14 days)") }),
|
|
1410
|
+
c.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: e("personalFinance.noUpcomingBills", "No upcoming bills") }) : c.slice(0, 4).map((h) => /* @__PURE__ */ l(
|
|
1401
1411
|
"div",
|
|
1402
1412
|
{
|
|
1403
1413
|
style: {
|
|
@@ -1407,61 +1417,60 @@ function ge({ service: s }) {
|
|
|
1407
1417
|
borderBottom: "1px solid #f0f0f0"
|
|
1408
1418
|
},
|
|
1409
1419
|
children: [
|
|
1410
|
-
/* @__PURE__ */
|
|
1411
|
-
/* @__PURE__ */
|
|
1412
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
1413
|
-
"
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
] })
|
|
1420
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1421
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: h.name }),
|
|
1422
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("personalFinance.dueOn", "Due: {day}").replace(
|
|
1423
|
+
"{day}",
|
|
1424
|
+
Q(h.dueDate, t)
|
|
1425
|
+
) })
|
|
1417
1426
|
] }),
|
|
1418
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: n(h.amount) })
|
|
1419
1428
|
]
|
|
1420
1429
|
},
|
|
1421
|
-
|
|
1430
|
+
h.id
|
|
1422
1431
|
))
|
|
1423
1432
|
] }),
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
|
|
1427
|
-
/* @__PURE__ */
|
|
1433
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1434
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.spendingByCategory", "Spending by Category") }),
|
|
1435
|
+
u.slice(0, 5).map((h) => /* @__PURE__ */ l("div", { style: { marginBottom: "12px" }, children: [
|
|
1436
|
+
/* @__PURE__ */ l(
|
|
1428
1437
|
"div",
|
|
1429
1438
|
{
|
|
1430
1439
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "4px" },
|
|
1431
1440
|
children: [
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
|
|
1441
|
+
/* @__PURE__ */ a("span", { children: h.categoryName }),
|
|
1442
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1443
|
+
n(h.amount),
|
|
1435
1444
|
" (",
|
|
1436
|
-
|
|
1445
|
+
h.percentage.toFixed(0),
|
|
1437
1446
|
"%)"
|
|
1438
1447
|
] })
|
|
1439
1448
|
]
|
|
1440
1449
|
}
|
|
1441
1450
|
),
|
|
1442
|
-
/* @__PURE__ */
|
|
1451
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1443
1452
|
"div",
|
|
1444
1453
|
{
|
|
1445
1454
|
style: {
|
|
1446
|
-
width: `${
|
|
1455
|
+
width: `${h.percentage}%`,
|
|
1447
1456
|
height: "100%",
|
|
1448
1457
|
backgroundColor: "#1976d2",
|
|
1449
1458
|
borderRadius: "4px"
|
|
1450
1459
|
}
|
|
1451
1460
|
}
|
|
1452
1461
|
) })
|
|
1453
|
-
] },
|
|
1462
|
+
] }, h.categoryId))
|
|
1454
1463
|
] })
|
|
1455
1464
|
] })
|
|
1456
1465
|
] });
|
|
1457
1466
|
}
|
|
1458
|
-
function
|
|
1467
|
+
function xe({
|
|
1459
1468
|
service: s,
|
|
1460
1469
|
refresh: e
|
|
1461
1470
|
}) {
|
|
1462
|
-
const t = (
|
|
1471
|
+
const { t } = w(), n = (d) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(d);
|
|
1463
1472
|
s.getAllAccounts();
|
|
1464
|
-
const
|
|
1473
|
+
const o = s.calculateTotalAssets(), r = s.calculateTotalLiabilities(), i = [
|
|
1465
1474
|
"checking",
|
|
1466
1475
|
"savings",
|
|
1467
1476
|
"credit-card",
|
|
@@ -1469,72 +1478,72 @@ function he({
|
|
|
1469
1478
|
"loan",
|
|
1470
1479
|
"cash"
|
|
1471
1480
|
];
|
|
1472
|
-
return /* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1476
|
-
/* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1481
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1482
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: t("personalFinance.accounts", "Accounts") }),
|
|
1483
|
+
/* @__PURE__ */ l("div", { style: y.grid, children: [
|
|
1484
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1485
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: t("personalFinance.assets", "Assets") }),
|
|
1486
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600, color: "#4caf50" }, children: n(o) })
|
|
1478
1487
|
] }),
|
|
1479
|
-
/* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1489
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: t("personalFinance.liabilities", "Liabilities") }),
|
|
1490
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600, color: "#f44336" }, children: n(r) })
|
|
1482
1491
|
] })
|
|
1483
1492
|
] }),
|
|
1484
|
-
|
|
1485
|
-
const
|
|
1486
|
-
return
|
|
1487
|
-
/* @__PURE__ */
|
|
1488
|
-
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1493
|
+
i.map((d) => {
|
|
1494
|
+
const c = s.getAccountsByType(d);
|
|
1495
|
+
return c.length === 0 ? null : /* @__PURE__ */ l("div", { style: { ...y.card, marginBottom: "20px" }, children: [
|
|
1496
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: d.replace("-", " ").replace(/\b\w/g, (g) => g.toUpperCase()) }),
|
|
1497
|
+
c.map((g) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1498
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1499
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: g.name }),
|
|
1500
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: g.institution })
|
|
1492
1501
|
] }),
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
] },
|
|
1495
|
-
] },
|
|
1502
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600, color: g.balance >= 0 ? "#333" : "#f44336" }, children: n(g.balance) })
|
|
1503
|
+
] }, g.id))
|
|
1504
|
+
] }, d);
|
|
1496
1505
|
})
|
|
1497
1506
|
] });
|
|
1498
1507
|
}
|
|
1499
|
-
function
|
|
1500
|
-
const e = (
|
|
1501
|
-
var
|
|
1502
|
-
return ((
|
|
1508
|
+
function be({ service: s }) {
|
|
1509
|
+
const { t: e } = w(), t = (i) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(i), n = s.getAllTransactions(), o = s.getAllCategories(), r = (i) => {
|
|
1510
|
+
var d;
|
|
1511
|
+
return ((d = o.find((c) => c.id === i)) == null ? void 0 : d.name) || "Uncategorized";
|
|
1503
1512
|
};
|
|
1504
|
-
return /* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
/* @__PURE__ */
|
|
1510
|
-
new Date(
|
|
1513
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1514
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.transactions", "Transactions") }),
|
|
1515
|
+
/* @__PURE__ */ a("div", { style: y.card, children: n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noTransactions", "No transactions") }) : n.slice(0, 20).map((i) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1516
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1517
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.description }),
|
|
1518
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1519
|
+
new Date(i.date).toLocaleDateString(),
|
|
1511
1520
|
" • ",
|
|
1512
|
-
|
|
1521
|
+
r(i.categoryId)
|
|
1513
1522
|
] })
|
|
1514
1523
|
] }),
|
|
1515
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ l(
|
|
1516
1525
|
"span",
|
|
1517
1526
|
{
|
|
1518
|
-
style: { fontWeight: 600, color:
|
|
1527
|
+
style: { fontWeight: 600, color: i.type === "income" ? "#4caf50" : "#f44336" },
|
|
1519
1528
|
children: [
|
|
1520
|
-
|
|
1521
|
-
|
|
1529
|
+
i.type === "income" ? "+" : "-",
|
|
1530
|
+
t(i.amount)
|
|
1522
1531
|
]
|
|
1523
1532
|
}
|
|
1524
1533
|
)
|
|
1525
|
-
] },
|
|
1534
|
+
] }, i.id)) })
|
|
1526
1535
|
] });
|
|
1527
1536
|
}
|
|
1528
|
-
function
|
|
1529
|
-
const e = (
|
|
1530
|
-
var
|
|
1531
|
-
return ((
|
|
1537
|
+
function ve({ service: s }) {
|
|
1538
|
+
const { t: e } = w(), t = (i) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(i), n = s.getAllBudgets(), o = s.getAllCategories(), r = (i) => {
|
|
1539
|
+
var d;
|
|
1540
|
+
return ((d = o.find((c) => c.id === i)) == null ? void 0 : d.name) || "Unknown";
|
|
1532
1541
|
};
|
|
1533
|
-
return /* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
const
|
|
1537
|
-
return /* @__PURE__ */
|
|
1542
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1543
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.budgets", "Budgets") }),
|
|
1544
|
+
/* @__PURE__ */ a("div", { style: y.card, children: n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noBudgetsSet", "No budgets set") }) : n.map((i) => {
|
|
1545
|
+
const d = i.spent / i.amount * 100, c = i.spent > i.amount;
|
|
1546
|
+
return /* @__PURE__ */ l(
|
|
1538
1547
|
"div",
|
|
1539
1548
|
{
|
|
1540
1549
|
style: {
|
|
@@ -1543,181 +1552,188 @@ function fe({ service: s }) {
|
|
|
1543
1552
|
borderBottom: "1px solid #f0f0f0"
|
|
1544
1553
|
},
|
|
1545
1554
|
children: [
|
|
1546
|
-
/* @__PURE__ */
|
|
1555
|
+
/* @__PURE__ */ l(
|
|
1547
1556
|
"div",
|
|
1548
1557
|
{
|
|
1549
1558
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" },
|
|
1550
1559
|
children: [
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
|
|
1560
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: r(i.categoryId) }),
|
|
1561
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1562
|
+
t(i.spent),
|
|
1554
1563
|
" / ",
|
|
1555
|
-
|
|
1564
|
+
t(i.amount)
|
|
1556
1565
|
] })
|
|
1557
1566
|
]
|
|
1558
1567
|
}
|
|
1559
1568
|
),
|
|
1560
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1561
1570
|
"div",
|
|
1562
1571
|
{
|
|
1563
1572
|
style: {
|
|
1564
|
-
width: `${Math.min(100,
|
|
1573
|
+
width: `${Math.min(100, d)}%`,
|
|
1565
1574
|
height: "100%",
|
|
1566
|
-
backgroundColor:
|
|
1575
|
+
backgroundColor: c ? "#f44336" : d > 80 ? "#ff9800" : "#4caf50",
|
|
1567
1576
|
borderRadius: "4px"
|
|
1568
1577
|
}
|
|
1569
1578
|
}
|
|
1570
1579
|
) }),
|
|
1571
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ a(
|
|
1572
1581
|
"div",
|
|
1573
1582
|
{
|
|
1574
|
-
style: { fontSize: "12px", color:
|
|
1575
|
-
children:
|
|
1583
|
+
style: { fontSize: "12px", color: c ? "#f44336" : "#666", marginTop: "4px" },
|
|
1584
|
+
children: c ? e("personalFinance.overBy", "Over by {amount}").replace(
|
|
1585
|
+
"{amount}",
|
|
1586
|
+
String(t(i.spent - i.amount))
|
|
1587
|
+
) : e("personalFinance.remaining", "{spent} remaining").replace(
|
|
1588
|
+
"{spent}",
|
|
1589
|
+
String(t(i.amount - i.spent))
|
|
1590
|
+
)
|
|
1576
1591
|
}
|
|
1577
1592
|
)
|
|
1578
1593
|
]
|
|
1579
1594
|
},
|
|
1580
|
-
|
|
1595
|
+
i.id
|
|
1581
1596
|
);
|
|
1582
1597
|
}) })
|
|
1583
1598
|
] });
|
|
1584
1599
|
}
|
|
1585
|
-
function
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1600
|
+
function Q(s, e) {
|
|
1601
|
+
return e !== "en" ? String(s) : `${s}${{ one: "st", two: "nd", few: "rd", other: "th" }[new Intl.PluralRules("en", { type: "ordinal" }).select(s)] ?? "th"}`;
|
|
1602
|
+
}
|
|
1603
|
+
function we({ service: s }) {
|
|
1604
|
+
const { t: e, lang: t } = w(), n = (i) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(i), o = s.getAllBills(), r = s.calculateMonthlyBillTotal();
|
|
1605
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1606
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.billsSubscriptions", "Bills & Subscriptions") }),
|
|
1607
|
+
/* @__PURE__ */ l("div", { style: { ...y.card, marginBottom: "20px" }, children: [
|
|
1608
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.monthlyBillsTotal", "Monthly Bills Total") }),
|
|
1609
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600 }, children: n(r) })
|
|
1592
1610
|
] }),
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
"Due: "
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1611
|
+
/* @__PURE__ */ a("div", { style: y.card, children: o.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noBillsTracked", "No bills tracked") }) : o.map((i) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1612
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1613
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: i.name }),
|
|
1614
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1615
|
+
e("personalFinance.dueOn", "Due: {day}").replace(
|
|
1616
|
+
"{day}",
|
|
1617
|
+
Q(i.dueDate, t)
|
|
1618
|
+
),
|
|
1619
|
+
" • ",
|
|
1620
|
+
e(`personalFinance.frequency.${i.frequency}`, i.frequency),
|
|
1621
|
+
i.autoPay && e("personalFinance.autoPay", " • Auto-pay")
|
|
1602
1622
|
] })
|
|
1603
1623
|
] }),
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
] },
|
|
1624
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: n(i.amount) })
|
|
1625
|
+
] }, i.id)) })
|
|
1606
1626
|
] });
|
|
1607
1627
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const e = (
|
|
1610
|
-
return /* @__PURE__ */
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
/* @__PURE__ */
|
|
1613
|
-
/* @__PURE__ */
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
/* @__PURE__ */
|
|
1628
|
+
function ke({ service: s }) {
|
|
1629
|
+
const { t: e } = w(), t = (d) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(d), n = s.getAllInvestments(), o = s.calculateTotalInvestmentValue(), r = s.calculateTotalGain(), i = s.getPortfolioAllocation();
|
|
1630
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
1631
|
+
/* @__PURE__ */ a("h2", { style: { marginBottom: "20px" }, children: e("personalFinance.investments", "Investments") }),
|
|
1632
|
+
/* @__PURE__ */ l("div", { style: y.grid, children: [
|
|
1633
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1634
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.portfolioValue", "Portfolio Value") }),
|
|
1635
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "24px", fontWeight: 600 }, children: t(o) })
|
|
1616
1636
|
] }),
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1619
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1638
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.totalGainLoss", "Total Gain/Loss") }),
|
|
1639
|
+
/* @__PURE__ */ l(
|
|
1620
1640
|
"div",
|
|
1621
1641
|
{
|
|
1622
1642
|
style: {
|
|
1623
1643
|
fontSize: "24px",
|
|
1624
1644
|
fontWeight: 600,
|
|
1625
|
-
color:
|
|
1645
|
+
color: r >= 0 ? "#4caf50" : "#f44336"
|
|
1626
1646
|
},
|
|
1627
1647
|
children: [
|
|
1628
|
-
|
|
1629
|
-
|
|
1648
|
+
r >= 0 ? "+" : "",
|
|
1649
|
+
t(r)
|
|
1630
1650
|
]
|
|
1631
1651
|
}
|
|
1632
1652
|
)
|
|
1633
1653
|
] })
|
|
1634
1654
|
] }),
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
1637
|
-
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
|
|
1655
|
+
/* @__PURE__ */ l("div", { style: { ...y.card, marginBottom: "20px" }, children: [
|
|
1656
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.assetAllocation", "Asset Allocation") }),
|
|
1657
|
+
i.map((d) => /* @__PURE__ */ l("div", { style: { marginBottom: "12px" }, children: [
|
|
1658
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "4px" }, children: [
|
|
1659
|
+
/* @__PURE__ */ a("span", { children: e(`personalFinance.assetType.${d.type}`, d.type) }),
|
|
1660
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1661
|
+
d.percentage.toFixed(1),
|
|
1642
1662
|
"%"
|
|
1643
1663
|
] })
|
|
1644
1664
|
] }),
|
|
1645
|
-
/* @__PURE__ */
|
|
1665
|
+
/* @__PURE__ */ a("div", { style: y.progressBar, children: /* @__PURE__ */ a(
|
|
1646
1666
|
"div",
|
|
1647
1667
|
{
|
|
1648
1668
|
style: {
|
|
1649
|
-
width: `${
|
|
1669
|
+
width: `${d.percentage}%`,
|
|
1650
1670
|
height: "100%",
|
|
1651
1671
|
backgroundColor: "#1976d2",
|
|
1652
1672
|
borderRadius: "4px"
|
|
1653
1673
|
}
|
|
1654
1674
|
}
|
|
1655
1675
|
) })
|
|
1656
|
-
] },
|
|
1676
|
+
] }, d.type))
|
|
1657
1677
|
] }),
|
|
1658
|
-
/* @__PURE__ */
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
1664
|
-
l.shares,
|
|
1665
|
-
" shares @ ",
|
|
1666
|
-
e(l.currentPrice)
|
|
1667
|
-
] })
|
|
1678
|
+
/* @__PURE__ */ l("div", { style: y.card, children: [
|
|
1679
|
+
/* @__PURE__ */ a("div", { style: y.cardTitle, children: e("personalFinance.holdings", "Holdings") }),
|
|
1680
|
+
n.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: e("personalFinance.noInvestmentsTracked", "No investments tracked") }) : n.map((d) => /* @__PURE__ */ l("div", { style: y.transactionRow, children: [
|
|
1681
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1682
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: d.symbol }),
|
|
1683
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: e("personalFinance.shares", "{shares} shares @ {currentPrice}").replace("{shares}", String(d.shares)).replace("{currentPrice}", String(t(d.currentPrice))) })
|
|
1668
1684
|
] }),
|
|
1669
|
-
/* @__PURE__ */
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
|
|
1673
|
-
|
|
1685
|
+
/* @__PURE__ */ l("div", { style: { textAlign: "right" }, children: [
|
|
1686
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 600 }, children: t(d.currentValue) }),
|
|
1687
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "12px", color: d.gain >= 0 ? "#4caf50" : "#f44336" }, children: [
|
|
1688
|
+
d.gain >= 0 ? "+" : "",
|
|
1689
|
+
t(d.gain),
|
|
1674
1690
|
" (",
|
|
1675
|
-
|
|
1691
|
+
d.gainPercent.toFixed(1),
|
|
1676
1692
|
"%)"
|
|
1677
1693
|
] })
|
|
1678
1694
|
] })
|
|
1679
|
-
] },
|
|
1695
|
+
] }, d.id))
|
|
1680
1696
|
] })
|
|
1681
1697
|
] });
|
|
1682
1698
|
}
|
|
1683
|
-
const
|
|
1699
|
+
const V = {
|
|
1684
1700
|
urgent: 0,
|
|
1685
1701
|
high: 1,
|
|
1686
1702
|
medium: 2,
|
|
1687
1703
|
low: 3,
|
|
1688
1704
|
none: 4
|
|
1689
1705
|
};
|
|
1690
|
-
class
|
|
1706
|
+
class Se {
|
|
1691
1707
|
constructor() {
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1708
|
+
k(this, "tasks", /* @__PURE__ */ new Map());
|
|
1709
|
+
k(this, "projects", /* @__PURE__ */ new Map());
|
|
1710
|
+
k(this, "tags", /* @__PURE__ */ new Map());
|
|
1711
|
+
k(this, "timeBlocks", /* @__PURE__ */ new Map());
|
|
1696
1712
|
}
|
|
1697
1713
|
/* ─────────────────────────────────────────────────────────────
|
|
1698
1714
|
TASKS
|
|
1699
1715
|
───────────────────────────────────────────────────────────── */
|
|
1700
1716
|
addTask(e) {
|
|
1701
|
-
const t = this.generateId(),
|
|
1717
|
+
const t = this.generateId(), n = /* @__PURE__ */ new Date(), o = {
|
|
1702
1718
|
...e,
|
|
1703
1719
|
id: t,
|
|
1704
1720
|
subtasks: [],
|
|
1705
|
-
createdAt:
|
|
1706
|
-
updatedAt:
|
|
1721
|
+
createdAt: n,
|
|
1722
|
+
updatedAt: n
|
|
1707
1723
|
};
|
|
1708
|
-
return this.tasks.set(t,
|
|
1724
|
+
return this.tasks.set(t, o), o;
|
|
1709
1725
|
}
|
|
1710
1726
|
updateTask(e, t) {
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1727
|
+
const n = this.tasks.get(e);
|
|
1728
|
+
n && this.tasks.set(e, { ...n, ...t, id: e, updatedAt: /* @__PURE__ */ new Date() });
|
|
1713
1729
|
}
|
|
1714
1730
|
deleteTask(e) {
|
|
1715
1731
|
const t = this.tasks.get(e);
|
|
1716
1732
|
if (t) {
|
|
1717
|
-
for (const
|
|
1718
|
-
this.deleteTask(
|
|
1719
|
-
for (const
|
|
1720
|
-
this.timeBlocks.delete(
|
|
1733
|
+
for (const n of t.subtasks)
|
|
1734
|
+
this.deleteTask(n.id);
|
|
1735
|
+
for (const n of t.timeBlocks)
|
|
1736
|
+
this.timeBlocks.delete(n.id);
|
|
1721
1737
|
this.tasks.delete(e);
|
|
1722
1738
|
}
|
|
1723
1739
|
}
|
|
@@ -1743,23 +1759,23 @@ class xe {
|
|
|
1743
1759
|
});
|
|
1744
1760
|
}
|
|
1745
1761
|
parseQuickAdd(e) {
|
|
1746
|
-
let t = e,
|
|
1747
|
-
const
|
|
1748
|
-
let
|
|
1749
|
-
e.includes("!!!") ? (
|
|
1762
|
+
let t = e, n = "none", o;
|
|
1763
|
+
const r = [];
|
|
1764
|
+
let i;
|
|
1765
|
+
e.includes("!!!") ? (n = "urgent", t = t.replace("!!!", "")) : e.includes("!!") ? (n = "high", t = t.replace("!!", "")) : e.includes("!") && (n = "medium", t = t.replace("!", ""));
|
|
1750
1766
|
const d = e.match(/#(\w+)/);
|
|
1751
1767
|
if (d) {
|
|
1752
1768
|
const u = Array.from(this.projects.values()).find(
|
|
1753
|
-
(
|
|
1769
|
+
(h) => h.name.toLowerCase() === d[1].toLowerCase()
|
|
1754
1770
|
);
|
|
1755
|
-
u && (
|
|
1771
|
+
u && (o = u.id, t = t.replace(d[0], ""));
|
|
1756
1772
|
}
|
|
1757
1773
|
const c = e.matchAll(/@(\w+)/g);
|
|
1758
1774
|
for (const u of c) {
|
|
1759
|
-
const
|
|
1760
|
-
(
|
|
1775
|
+
const h = Array.from(this.tags.values()).find(
|
|
1776
|
+
(p) => p.name.toLowerCase() === u[1].toLowerCase()
|
|
1761
1777
|
);
|
|
1762
|
-
|
|
1778
|
+
h && (r.push(h.id), t = t.replace(u[0], ""));
|
|
1763
1779
|
}
|
|
1764
1780
|
const g = [
|
|
1765
1781
|
{ pattern: /\btoday\b/i, offset: () => /* @__PURE__ */ new Date() },
|
|
@@ -1773,17 +1789,17 @@ class xe {
|
|
|
1773
1789
|
}
|
|
1774
1790
|
}
|
|
1775
1791
|
];
|
|
1776
|
-
for (const { pattern: u, offset:
|
|
1792
|
+
for (const { pattern: u, offset: h } of g)
|
|
1777
1793
|
if (u.test(e)) {
|
|
1778
|
-
|
|
1794
|
+
i = h(), i.setHours(23, 59, 59, 999), t = t.replace(u, "");
|
|
1779
1795
|
break;
|
|
1780
1796
|
}
|
|
1781
1797
|
return {
|
|
1782
1798
|
title: t.trim(),
|
|
1783
|
-
priority:
|
|
1784
|
-
projectId:
|
|
1785
|
-
tags:
|
|
1786
|
-
dueDate:
|
|
1799
|
+
priority: n,
|
|
1800
|
+
projectId: o,
|
|
1801
|
+
tags: r,
|
|
1802
|
+
dueDate: i
|
|
1787
1803
|
};
|
|
1788
1804
|
}
|
|
1789
1805
|
/** Complete a task */
|
|
@@ -1812,87 +1828,87 @@ class xe {
|
|
|
1812
1828
|
return null;
|
|
1813
1829
|
const {
|
|
1814
1830
|
pattern: t,
|
|
1815
|
-
interval:
|
|
1816
|
-
endDate:
|
|
1817
|
-
endAfterOccurrences:
|
|
1818
|
-
} = e.recurrence,
|
|
1831
|
+
interval: n,
|
|
1832
|
+
endDate: o,
|
|
1833
|
+
endAfterOccurrences: r
|
|
1834
|
+
} = e.recurrence, i = new Date(e.dueDate);
|
|
1819
1835
|
let d;
|
|
1820
1836
|
switch (t) {
|
|
1821
1837
|
case "daily":
|
|
1822
|
-
d = new Date(
|
|
1838
|
+
d = new Date(i.getTime() + n * 864e5);
|
|
1823
1839
|
break;
|
|
1824
1840
|
case "weekdays":
|
|
1825
|
-
d = new Date(
|
|
1841
|
+
d = new Date(i);
|
|
1826
1842
|
do
|
|
1827
1843
|
d.setDate(d.getDate() + 1);
|
|
1828
1844
|
while (d.getDay() === 0 || d.getDay() === 6);
|
|
1829
1845
|
break;
|
|
1830
1846
|
case "weekly":
|
|
1831
|
-
d = new Date(
|
|
1847
|
+
d = new Date(i.getTime() + n * 7 * 864e5);
|
|
1832
1848
|
break;
|
|
1833
1849
|
case "bi-weekly":
|
|
1834
|
-
d = new Date(
|
|
1850
|
+
d = new Date(i.getTime() + 14 * 864e5);
|
|
1835
1851
|
break;
|
|
1836
1852
|
case "monthly":
|
|
1837
|
-
d = new Date(
|
|
1853
|
+
d = new Date(i), d.setMonth(d.getMonth() + n);
|
|
1838
1854
|
break;
|
|
1839
1855
|
case "yearly":
|
|
1840
|
-
d = new Date(
|
|
1856
|
+
d = new Date(i), d.setFullYear(d.getFullYear() + n);
|
|
1841
1857
|
break;
|
|
1842
1858
|
default:
|
|
1843
1859
|
return null;
|
|
1844
1860
|
}
|
|
1845
|
-
return
|
|
1861
|
+
return o && d > o ? null : d;
|
|
1846
1862
|
}
|
|
1847
1863
|
/* ─────────────────────────────────────────────────────────────
|
|
1848
1864
|
FILTERING & SORTING
|
|
1849
1865
|
───────────────────────────────────────────────────────────── */
|
|
1850
1866
|
filterTasks(e) {
|
|
1851
|
-
var
|
|
1867
|
+
var n, o, r;
|
|
1852
1868
|
let t = this.getAllTasks();
|
|
1853
|
-
if ((
|
|
1854
|
-
const { start:
|
|
1869
|
+
if ((n = e.status) != null && n.length && (t = t.filter((i) => e.status.includes(i.status))), (o = e.priority) != null && o.length && (t = t.filter((i) => e.priority.includes(i.priority))), e.projectId !== void 0 && (t = t.filter((i) => i.projectId === e.projectId)), (r = e.tags) != null && r.length && (t = t.filter((i) => e.tags.some((d) => i.tags.includes(d)))), e.dueDateRange) {
|
|
1870
|
+
const { start: i, end: d } = e.dueDateRange;
|
|
1855
1871
|
t = t.filter((c) => {
|
|
1856
1872
|
if (!c.dueDate)
|
|
1857
1873
|
return !1;
|
|
1858
1874
|
const g = new Date(c.dueDate);
|
|
1859
|
-
return !(
|
|
1875
|
+
return !(i && g < i || d && g > d);
|
|
1860
1876
|
});
|
|
1861
1877
|
}
|
|
1862
1878
|
if (e.search) {
|
|
1863
|
-
const
|
|
1879
|
+
const i = e.search.toLowerCase();
|
|
1864
1880
|
t = t.filter(
|
|
1865
1881
|
(d) => {
|
|
1866
1882
|
var c;
|
|
1867
|
-
return d.title.toLowerCase().includes(
|
|
1883
|
+
return d.title.toLowerCase().includes(i) || ((c = d.description) == null ? void 0 : c.toLowerCase().includes(i)) || d.notes.toLowerCase().includes(i);
|
|
1868
1884
|
}
|
|
1869
1885
|
);
|
|
1870
1886
|
}
|
|
1871
1887
|
return t;
|
|
1872
1888
|
}
|
|
1873
|
-
sortTasks(e, t = "dueDate",
|
|
1874
|
-
return [...e].sort((
|
|
1889
|
+
sortTasks(e, t = "dueDate", n = "asc") {
|
|
1890
|
+
return [...e].sort((r, i) => {
|
|
1875
1891
|
let d = 0;
|
|
1876
1892
|
switch (t) {
|
|
1877
1893
|
case "dueDate": {
|
|
1878
|
-
const c =
|
|
1894
|
+
const c = r.dueDate ? new Date(r.dueDate).getTime() : 1 / 0, g = i.dueDate ? new Date(i.dueDate).getTime() : 1 / 0;
|
|
1879
1895
|
d = c - g;
|
|
1880
1896
|
break;
|
|
1881
1897
|
}
|
|
1882
1898
|
case "priority":
|
|
1883
|
-
d =
|
|
1899
|
+
d = V[r.priority] - V[i.priority];
|
|
1884
1900
|
break;
|
|
1885
1901
|
case "createdAt":
|
|
1886
|
-
d = new Date(
|
|
1902
|
+
d = new Date(r.createdAt).getTime() - new Date(i.createdAt).getTime();
|
|
1887
1903
|
break;
|
|
1888
1904
|
case "title":
|
|
1889
|
-
d =
|
|
1905
|
+
d = r.title.localeCompare(i.title);
|
|
1890
1906
|
break;
|
|
1891
1907
|
case "status":
|
|
1892
|
-
d =
|
|
1908
|
+
d = r.status.localeCompare(i.status);
|
|
1893
1909
|
break;
|
|
1894
1910
|
}
|
|
1895
|
-
return
|
|
1911
|
+
return n === "asc" ? d : -d;
|
|
1896
1912
|
});
|
|
1897
1913
|
}
|
|
1898
1914
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -1913,10 +1929,10 @@ class xe {
|
|
|
1913
1929
|
getUpcoming(e = 7) {
|
|
1914
1930
|
const t = /* @__PURE__ */ new Date();
|
|
1915
1931
|
t.setHours(0, 0, 0, 0);
|
|
1916
|
-
const
|
|
1932
|
+
const n = new Date(t.getTime() + e * 864e5);
|
|
1917
1933
|
return this.filterTasks({
|
|
1918
1934
|
status: ["todo", "in-progress"],
|
|
1919
|
-
dueDateRange: { start: t, end:
|
|
1935
|
+
dueDateRange: { start: t, end: n }
|
|
1920
1936
|
});
|
|
1921
1937
|
}
|
|
1922
1938
|
getOverdue() {
|
|
@@ -1929,27 +1945,27 @@ class xe {
|
|
|
1929
1945
|
PRIORITY MATRIX
|
|
1930
1946
|
───────────────────────────────────────────────────────────── */
|
|
1931
1947
|
getPriorityMatrix() {
|
|
1932
|
-
const e = this.filterTasks({ status: ["todo", "in-progress"] }), t = (
|
|
1948
|
+
const e = this.filterTasks({ status: ["todo", "in-progress"] }), t = (o) => o.dueDate ? Math.ceil((new Date(o.dueDate).getTime() - Date.now()) / 864e5) <= 2 : !1, n = (o) => ["urgent", "high"].includes(o.priority);
|
|
1933
1949
|
return {
|
|
1934
1950
|
doFirst: {
|
|
1935
1951
|
name: "Do First",
|
|
1936
1952
|
description: "Urgent and Important",
|
|
1937
|
-
tasks: e.filter((
|
|
1953
|
+
tasks: e.filter((o) => t(o) && n(o))
|
|
1938
1954
|
},
|
|
1939
1955
|
schedule: {
|
|
1940
1956
|
name: "Schedule",
|
|
1941
1957
|
description: "Important but Not Urgent",
|
|
1942
|
-
tasks: e.filter((
|
|
1958
|
+
tasks: e.filter((o) => !t(o) && n(o))
|
|
1943
1959
|
},
|
|
1944
1960
|
delegate: {
|
|
1945
1961
|
name: "Delegate",
|
|
1946
1962
|
description: "Urgent but Not Important",
|
|
1947
|
-
tasks: e.filter((
|
|
1963
|
+
tasks: e.filter((o) => t(o) && !n(o))
|
|
1948
1964
|
},
|
|
1949
1965
|
eliminate: {
|
|
1950
1966
|
name: "Eliminate",
|
|
1951
1967
|
description: "Neither Urgent nor Important",
|
|
1952
|
-
tasks: e.filter((
|
|
1968
|
+
tasks: e.filter((o) => !t(o) && !n(o))
|
|
1953
1969
|
}
|
|
1954
1970
|
};
|
|
1955
1971
|
}
|
|
@@ -1957,54 +1973,54 @@ class xe {
|
|
|
1957
1973
|
TIME BLOCKING
|
|
1958
1974
|
───────────────────────────────────────────────────────────── */
|
|
1959
1975
|
addTimeBlock(e) {
|
|
1960
|
-
const t = this.generateId(),
|
|
1961
|
-
if (this.timeBlocks.set(t,
|
|
1962
|
-
const
|
|
1963
|
-
|
|
1976
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
1977
|
+
if (this.timeBlocks.set(t, n), e.taskId) {
|
|
1978
|
+
const o = this.tasks.get(e.taskId);
|
|
1979
|
+
o && (o.timeBlocks.push(n), this.tasks.set(e.taskId, o));
|
|
1964
1980
|
}
|
|
1965
|
-
return
|
|
1981
|
+
return n;
|
|
1966
1982
|
}
|
|
1967
1983
|
updateTimeBlock(e, t) {
|
|
1968
|
-
const
|
|
1969
|
-
|
|
1984
|
+
const n = this.timeBlocks.get(e);
|
|
1985
|
+
n && this.timeBlocks.set(e, { ...n, ...t, id: e });
|
|
1970
1986
|
}
|
|
1971
1987
|
deleteTimeBlock(e) {
|
|
1972
1988
|
const t = this.timeBlocks.get(e);
|
|
1973
1989
|
if (t != null && t.taskId) {
|
|
1974
|
-
const
|
|
1975
|
-
|
|
1990
|
+
const n = this.tasks.get(t.taskId);
|
|
1991
|
+
n && (n.timeBlocks = n.timeBlocks.filter((o) => o.id !== e), this.tasks.set(n.id, n));
|
|
1976
1992
|
}
|
|
1977
1993
|
this.timeBlocks.delete(e);
|
|
1978
1994
|
}
|
|
1979
1995
|
getTimeBlocksForDate(e) {
|
|
1980
1996
|
const t = new Date(e);
|
|
1981
1997
|
t.setHours(0, 0, 0, 0);
|
|
1982
|
-
const
|
|
1983
|
-
return Array.from(this.timeBlocks.values()).filter((
|
|
1984
|
-
const
|
|
1985
|
-
return
|
|
1998
|
+
const n = new Date(t.getTime() + 864e5);
|
|
1999
|
+
return Array.from(this.timeBlocks.values()).filter((o) => {
|
|
2000
|
+
const r = new Date(o.start);
|
|
2001
|
+
return r >= t && r < n;
|
|
1986
2002
|
});
|
|
1987
2003
|
}
|
|
1988
2004
|
/* ─────────────────────────────────────────────────────────────
|
|
1989
2005
|
PROJECTS
|
|
1990
2006
|
───────────────────────────────────────────────────────────── */
|
|
1991
2007
|
addProject(e) {
|
|
1992
|
-
const t = this.generateId(),
|
|
2008
|
+
const t = this.generateId(), n = {
|
|
1993
2009
|
...e,
|
|
1994
2010
|
id: t,
|
|
1995
2011
|
order: this.projects.size,
|
|
1996
2012
|
createdAt: /* @__PURE__ */ new Date()
|
|
1997
2013
|
};
|
|
1998
|
-
return this.projects.set(t,
|
|
2014
|
+
return this.projects.set(t, n), n;
|
|
1999
2015
|
}
|
|
2000
2016
|
updateProject(e, t) {
|
|
2001
|
-
const
|
|
2002
|
-
|
|
2017
|
+
const n = this.projects.get(e);
|
|
2018
|
+
n && this.projects.set(e, { ...n, ...t, id: e });
|
|
2003
2019
|
}
|
|
2004
2020
|
deleteProject(e) {
|
|
2005
2021
|
this.projects.delete(e);
|
|
2006
|
-
for (const [t,
|
|
2007
|
-
|
|
2022
|
+
for (const [t, n] of this.tasks)
|
|
2023
|
+
n.projectId === e && (n.projectId = void 0, this.tasks.set(t, n));
|
|
2008
2024
|
}
|
|
2009
2025
|
getAllProjects() {
|
|
2010
2026
|
return Array.from(this.projects.values()).sort((e, t) => e.order - t.order);
|
|
@@ -2013,24 +2029,24 @@ class xe {
|
|
|
2013
2029
|
return this.filterTasks({ projectId: e });
|
|
2014
2030
|
}
|
|
2015
2031
|
getProjectProgress(e) {
|
|
2016
|
-
const t = this.getProjectTasks(e),
|
|
2032
|
+
const t = this.getProjectTasks(e), n = t.filter((o) => o.status === "done").length;
|
|
2017
2033
|
return {
|
|
2018
2034
|
total: t.length,
|
|
2019
|
-
completed:
|
|
2020
|
-
percentage: t.length > 0 ? Math.round(
|
|
2035
|
+
completed: n,
|
|
2036
|
+
percentage: t.length > 0 ? Math.round(n / t.length * 100) : 0
|
|
2021
2037
|
};
|
|
2022
2038
|
}
|
|
2023
2039
|
/* ─────────────────────────────────────────────────────────────
|
|
2024
2040
|
TAGS
|
|
2025
2041
|
───────────────────────────────────────────────────────────── */
|
|
2026
2042
|
addTag(e) {
|
|
2027
|
-
const t = this.generateId(),
|
|
2028
|
-
return this.tags.set(t,
|
|
2043
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2044
|
+
return this.tags.set(t, n), n;
|
|
2029
2045
|
}
|
|
2030
2046
|
deleteTag(e) {
|
|
2031
2047
|
this.tags.delete(e);
|
|
2032
|
-
for (const [t,
|
|
2033
|
-
|
|
2048
|
+
for (const [t, n] of this.tasks)
|
|
2049
|
+
n.tags.includes(e) && (n.tags = n.tags.filter((o) => o !== e), this.tasks.set(t, n));
|
|
2034
2050
|
}
|
|
2035
2051
|
getAllTags() {
|
|
2036
2052
|
return Array.from(this.tags.values());
|
|
@@ -2041,16 +2057,16 @@ class xe {
|
|
|
2041
2057
|
getStatistics() {
|
|
2042
2058
|
const e = this.getAllTasks(), t = /* @__PURE__ */ new Date();
|
|
2043
2059
|
t.setHours(0, 0, 0, 0);
|
|
2044
|
-
const
|
|
2045
|
-
(c) => c.dueDate && new Date(c.dueDate) >= t && new Date(c.dueDate) <
|
|
2060
|
+
const n = new Date(t.getTime() + 864e5), o = e.filter((c) => c.status === "done").length, r = this.getOverdue().length, i = e.filter(
|
|
2061
|
+
(c) => c.dueDate && new Date(c.dueDate) >= t && new Date(c.dueDate) < n && c.status !== "done"
|
|
2046
2062
|
).length, d = e.filter((c) => c.status === "in-progress").length;
|
|
2047
2063
|
return {
|
|
2048
2064
|
total: e.length,
|
|
2049
|
-
completed:
|
|
2050
|
-
overdue:
|
|
2051
|
-
dueToday:
|
|
2065
|
+
completed: o,
|
|
2066
|
+
overdue: r,
|
|
2067
|
+
dueToday: i,
|
|
2052
2068
|
inProgress: d,
|
|
2053
|
-
completionRate: e.length > 0 ? Math.round(
|
|
2069
|
+
completionRate: e.length > 0 ? Math.round(o / e.length * 100) : 0
|
|
2054
2070
|
};
|
|
2055
2071
|
}
|
|
2056
2072
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -2063,17 +2079,17 @@ class xe {
|
|
|
2063
2079
|
this.tasks.clear(), this.projects.clear(), this.tags.clear(), this.timeBlocks.clear();
|
|
2064
2080
|
}
|
|
2065
2081
|
}
|
|
2066
|
-
function
|
|
2067
|
-
return new
|
|
2082
|
+
function Ze() {
|
|
2083
|
+
return new Se();
|
|
2068
2084
|
}
|
|
2069
|
-
const
|
|
2070
|
-
function
|
|
2071
|
-
const s =
|
|
2085
|
+
const Y = /* @__PURE__ */ H(null);
|
|
2086
|
+
function et() {
|
|
2087
|
+
const s = L(Y);
|
|
2072
2088
|
if (!s)
|
|
2073
2089
|
throw new Error("useTaskManager must be used within TaskManagerProvider");
|
|
2074
2090
|
return s;
|
|
2075
2091
|
}
|
|
2076
|
-
const
|
|
2092
|
+
const S = {
|
|
2077
2093
|
container: {
|
|
2078
2094
|
display: "flex",
|
|
2079
2095
|
height: "100%",
|
|
@@ -2137,8 +2153,7 @@ const k = {
|
|
|
2137
2153
|
border: "1px solid #e0e0e0",
|
|
2138
2154
|
borderRadius: "8px",
|
|
2139
2155
|
fontSize: "14px",
|
|
2140
|
-
marginBottom: "20px"
|
|
2141
|
-
outline: "none"
|
|
2156
|
+
marginBottom: "20px"
|
|
2142
2157
|
},
|
|
2143
2158
|
taskItem: {
|
|
2144
2159
|
display: "flex",
|
|
@@ -2195,172 +2210,188 @@ const k = {
|
|
|
2195
2210
|
padding: "16px",
|
|
2196
2211
|
overflow: "auto"
|
|
2197
2212
|
}
|
|
2198
|
-
},
|
|
2213
|
+
}, O = {
|
|
2199
2214
|
urgent: "#f44336",
|
|
2200
2215
|
high: "#ff9800",
|
|
2201
2216
|
medium: "#2196f3",
|
|
2202
2217
|
low: "#4caf50",
|
|
2203
2218
|
none: "#e0e0e0"
|
|
2204
2219
|
};
|
|
2205
|
-
function
|
|
2220
|
+
function tt({
|
|
2206
2221
|
service: s,
|
|
2207
2222
|
className: e,
|
|
2208
2223
|
style: t
|
|
2209
2224
|
}) {
|
|
2210
|
-
var
|
|
2211
|
-
const [,
|
|
2212
|
-
|
|
2213
|
-
},
|
|
2214
|
-
|
|
2225
|
+
var U;
|
|
2226
|
+
const { t: n } = w(), [, o] = T(0), [r, i] = T("inbox"), [d, c] = T(null), [g, u] = T(""), h = N(() => o((I) => I + 1), []), p = { service: s, refresh: h }, D = s.getStatistics(), m = s.getAllProjects(), b = () => {
|
|
2227
|
+
g.trim() && (s.quickAddTask(g), u(""), h());
|
|
2228
|
+
}, C = (I, z) => {
|
|
2229
|
+
i(I), c(z ?? null);
|
|
2215
2230
|
};
|
|
2216
|
-
return /* @__PURE__ */
|
|
2217
|
-
/* @__PURE__ */
|
|
2218
|
-
/* @__PURE__ */
|
|
2231
|
+
return /* @__PURE__ */ a(Y.Provider, { value: p, children: /* @__PURE__ */ l("div", { className: e, style: { ...S.container, ...t }, children: [
|
|
2232
|
+
/* @__PURE__ */ l("div", { style: S.sidebar, children: [
|
|
2233
|
+
/* @__PURE__ */ l(
|
|
2219
2234
|
"div",
|
|
2220
2235
|
{
|
|
2221
|
-
|
|
2236
|
+
role: "button",
|
|
2237
|
+
tabIndex: 0,
|
|
2238
|
+
onKeyDown: A,
|
|
2239
|
+
onClick: () => C("inbox"),
|
|
2222
2240
|
style: {
|
|
2223
|
-
...
|
|
2224
|
-
backgroundColor:
|
|
2241
|
+
...S.menuItem,
|
|
2242
|
+
backgroundColor: r === "inbox" ? "#e3f2fd" : "transparent"
|
|
2225
2243
|
},
|
|
2226
2244
|
children: [
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
|
|
2245
|
+
/* @__PURE__ */ a("span", { children: n("taskManager.inbox", "Inbox") }),
|
|
2246
|
+
D.total - D.completed > 0 && /* @__PURE__ */ a("span", { style: S.badge, children: s.getInbox().length })
|
|
2229
2247
|
]
|
|
2230
2248
|
}
|
|
2231
2249
|
),
|
|
2232
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ l(
|
|
2233
2251
|
"div",
|
|
2234
2252
|
{
|
|
2235
|
-
|
|
2253
|
+
role: "button",
|
|
2254
|
+
tabIndex: 0,
|
|
2255
|
+
onKeyDown: A,
|
|
2256
|
+
onClick: () => C("today"),
|
|
2236
2257
|
style: {
|
|
2237
|
-
...
|
|
2238
|
-
backgroundColor:
|
|
2258
|
+
...S.menuItem,
|
|
2259
|
+
backgroundColor: r === "today" ? "#e3f2fd" : "transparent"
|
|
2239
2260
|
},
|
|
2240
2261
|
children: [
|
|
2241
|
-
/* @__PURE__ */
|
|
2242
|
-
|
|
2262
|
+
/* @__PURE__ */ a("span", { children: n("taskManager.today", "Today") }),
|
|
2263
|
+
D.dueToday > 0 && /* @__PURE__ */ a("span", { style: S.badge, children: D.dueToday })
|
|
2243
2264
|
]
|
|
2244
2265
|
}
|
|
2245
2266
|
),
|
|
2246
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ a(
|
|
2247
2268
|
"div",
|
|
2248
2269
|
{
|
|
2249
|
-
|
|
2270
|
+
role: "button",
|
|
2271
|
+
tabIndex: 0,
|
|
2272
|
+
onKeyDown: A,
|
|
2273
|
+
onClick: () => C("upcoming"),
|
|
2250
2274
|
style: {
|
|
2251
|
-
...
|
|
2252
|
-
backgroundColor:
|
|
2275
|
+
...S.menuItem,
|
|
2276
|
+
backgroundColor: r === "upcoming" ? "#e3f2fd" : "transparent"
|
|
2253
2277
|
},
|
|
2254
|
-
children: /* @__PURE__ */
|
|
2278
|
+
children: /* @__PURE__ */ a("span", { children: n("taskManager.upcoming", "Upcoming") })
|
|
2255
2279
|
}
|
|
2256
2280
|
),
|
|
2257
|
-
/* @__PURE__ */
|
|
2281
|
+
/* @__PURE__ */ a(
|
|
2258
2282
|
"div",
|
|
2259
2283
|
{
|
|
2260
|
-
|
|
2284
|
+
role: "button",
|
|
2285
|
+
tabIndex: 0,
|
|
2286
|
+
onKeyDown: A,
|
|
2287
|
+
onClick: () => C("matrix"),
|
|
2261
2288
|
style: {
|
|
2262
|
-
...
|
|
2263
|
-
backgroundColor:
|
|
2289
|
+
...S.menuItem,
|
|
2290
|
+
backgroundColor: r === "matrix" ? "#e3f2fd" : "transparent"
|
|
2264
2291
|
},
|
|
2265
|
-
children: /* @__PURE__ */
|
|
2292
|
+
children: /* @__PURE__ */ a("span", { children: n("taskManager.priorityMatrix", "Priority Matrix") })
|
|
2266
2293
|
}
|
|
2267
2294
|
),
|
|
2268
|
-
/* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ a(
|
|
2269
2296
|
"div",
|
|
2270
2297
|
{
|
|
2271
|
-
|
|
2298
|
+
role: "button",
|
|
2299
|
+
tabIndex: 0,
|
|
2300
|
+
onKeyDown: A,
|
|
2301
|
+
onClick: () => C("all"),
|
|
2272
2302
|
style: {
|
|
2273
|
-
...
|
|
2274
|
-
backgroundColor:
|
|
2303
|
+
...S.menuItem,
|
|
2304
|
+
backgroundColor: r === "all" ? "#e3f2fd" : "transparent"
|
|
2275
2305
|
},
|
|
2276
|
-
children: /* @__PURE__ */
|
|
2306
|
+
children: /* @__PURE__ */ a("span", { children: n("taskManager.allTasks", "All Tasks") })
|
|
2277
2307
|
}
|
|
2278
2308
|
),
|
|
2279
|
-
|
|
2280
|
-
/* @__PURE__ */
|
|
2281
|
-
/* @__PURE__ */
|
|
2309
|
+
D.overdue > 0 && /* @__PURE__ */ l("div", { style: { ...S.menuItem, color: "#f44336" }, children: [
|
|
2310
|
+
/* @__PURE__ */ a("span", { children: n("taskManager.overdue", "Overdue") }),
|
|
2311
|
+
/* @__PURE__ */ a("span", { style: { ...S.badge, backgroundColor: "#f44336" }, children: D.overdue })
|
|
2282
2312
|
] }),
|
|
2283
|
-
/* @__PURE__ */
|
|
2284
|
-
|
|
2285
|
-
const
|
|
2286
|
-
return /* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ a("div", { style: S.sectionTitle, children: n("taskManager.projects", "Projects") }),
|
|
2314
|
+
m.map((I) => {
|
|
2315
|
+
const z = s.getProjectProgress(I.id);
|
|
2316
|
+
return /* @__PURE__ */ l(
|
|
2287
2317
|
"div",
|
|
2288
2318
|
{
|
|
2289
|
-
|
|
2319
|
+
role: "button",
|
|
2320
|
+
tabIndex: 0,
|
|
2321
|
+
onKeyDown: A,
|
|
2322
|
+
onClick: () => C("project", I.id),
|
|
2290
2323
|
style: {
|
|
2291
|
-
...
|
|
2292
|
-
backgroundColor:
|
|
2324
|
+
...S.menuItem,
|
|
2325
|
+
backgroundColor: r === "project" && d === I.id ? "#e3f2fd" : "transparent"
|
|
2293
2326
|
},
|
|
2294
2327
|
children: [
|
|
2295
|
-
/* @__PURE__ */
|
|
2328
|
+
/* @__PURE__ */ a(
|
|
2296
2329
|
"span",
|
|
2297
2330
|
{
|
|
2298
2331
|
style: {
|
|
2299
2332
|
width: "10px",
|
|
2300
2333
|
height: "10px",
|
|
2301
2334
|
borderRadius: "50%",
|
|
2302
|
-
backgroundColor:
|
|
2335
|
+
backgroundColor: I.color
|
|
2303
2336
|
}
|
|
2304
2337
|
}
|
|
2305
2338
|
),
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
|
|
2339
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: I.name }),
|
|
2340
|
+
/* @__PURE__ */ l("span", { style: { fontSize: "12px", color: "#999" }, children: [
|
|
2341
|
+
z.percentage,
|
|
2309
2342
|
"%"
|
|
2310
2343
|
] })
|
|
2311
2344
|
]
|
|
2312
2345
|
},
|
|
2313
|
-
|
|
2346
|
+
I.id
|
|
2314
2347
|
);
|
|
2315
2348
|
})
|
|
2316
2349
|
] }),
|
|
2317
|
-
/* @__PURE__ */
|
|
2318
|
-
/* @__PURE__ */
|
|
2319
|
-
/* @__PURE__ */
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2350
|
+
/* @__PURE__ */ l("div", { style: S.main, children: [
|
|
2351
|
+
/* @__PURE__ */ l("div", { style: S.header, children: [
|
|
2352
|
+
/* @__PURE__ */ l("div", { style: S.title, children: [
|
|
2353
|
+
r === "inbox" && n("taskManager.inbox", "Inbox"),
|
|
2354
|
+
r === "today" && n("taskManager.today", "Today"),
|
|
2355
|
+
r === "upcoming" && n("taskManager.upcoming", "Upcoming"),
|
|
2356
|
+
r === "matrix" && n("taskManager.priorityMatrix", "Priority Matrix"),
|
|
2357
|
+
r === "all" && n("taskManager.allTasks", "All Tasks"),
|
|
2358
|
+
r === "project" && ((U = m.find((I) => I.id === d)) == null ? void 0 : U.name)
|
|
2326
2359
|
] }),
|
|
2327
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children:
|
|
2328
|
-
y.completed,
|
|
2329
|
-
"/",
|
|
2330
|
-
y.total,
|
|
2331
|
-
" completed"
|
|
2332
|
-
] })
|
|
2360
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children: n("taskManager.completed", "{completed}/{total} completed").replace("{completed}", String(D.completed)).replace("{total}", String(D.total)) })
|
|
2333
2361
|
] }),
|
|
2334
|
-
|
|
2362
|
+
r !== "matrix" && /* @__PURE__ */ a(
|
|
2335
2363
|
"input",
|
|
2336
2364
|
{
|
|
2337
2365
|
type: "text",
|
|
2338
|
-
placeholder:
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2366
|
+
placeholder: n(
|
|
2367
|
+
"taskManager.quickAddTaskEG",
|
|
2368
|
+
"Quick add task (e.g., 'Buy groceries tomorrow #shopping !')"
|
|
2369
|
+
),
|
|
2370
|
+
value: g,
|
|
2371
|
+
onChange: (I) => u(I.target.value),
|
|
2372
|
+
onKeyDown: (I) => I.key === "Enter" && b(),
|
|
2373
|
+
style: S.taskInput
|
|
2343
2374
|
}
|
|
2344
2375
|
),
|
|
2345
|
-
|
|
2346
|
-
|
|
2376
|
+
r === "matrix" ? /* @__PURE__ */ a(Te, { service: s, onComplete: h }) : /* @__PURE__ */ a(
|
|
2377
|
+
De,
|
|
2347
2378
|
{
|
|
2348
2379
|
service: s,
|
|
2349
|
-
view:
|
|
2350
|
-
projectId:
|
|
2351
|
-
onComplete:
|
|
2380
|
+
view: r,
|
|
2381
|
+
projectId: d,
|
|
2382
|
+
onComplete: h
|
|
2352
2383
|
}
|
|
2353
2384
|
)
|
|
2354
2385
|
] })
|
|
2355
2386
|
] }) });
|
|
2356
2387
|
}
|
|
2357
|
-
function
|
|
2388
|
+
function De({
|
|
2358
2389
|
service: s,
|
|
2359
2390
|
view: e,
|
|
2360
2391
|
projectId: t,
|
|
2361
|
-
onComplete:
|
|
2392
|
+
onComplete: n
|
|
2362
2393
|
}) {
|
|
2363
|
-
const
|
|
2394
|
+
const { t: o } = w(), r = W(() => {
|
|
2364
2395
|
switch (e) {
|
|
2365
2396
|
case "inbox":
|
|
2366
2397
|
return s.getInbox();
|
|
@@ -2379,89 +2410,94 @@ function be({
|
|
|
2379
2410
|
return [];
|
|
2380
2411
|
}
|
|
2381
2412
|
}, [s, e, t]);
|
|
2382
|
-
return
|
|
2413
|
+
return r.length === 0 ? /* @__PURE__ */ a("div", { style: { textAlign: "center", padding: "60px", color: "#999" }, children: /* @__PURE__ */ a("div", { children: o("taskManager.noTasksHere", "No tasks here!") }) }) : /* @__PURE__ */ a("div", { children: r.map((i) => /* @__PURE__ */ a(_, { task: i, service: s, onComplete: n }, i.id)) });
|
|
2383
2414
|
}
|
|
2384
|
-
function
|
|
2415
|
+
function _({
|
|
2385
2416
|
task: s,
|
|
2386
2417
|
service: e,
|
|
2387
2418
|
onComplete: t
|
|
2388
2419
|
}) {
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2391
|
-
},
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2394
|
-
const
|
|
2395
|
-
return
|
|
2396
|
-
},
|
|
2397
|
-
return /* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2420
|
+
const { t: n } = w(), o = (d) => {
|
|
2421
|
+
d.stopPropagation(), e.completeTask(s.id), t();
|
|
2422
|
+
}, r = (d) => {
|
|
2423
|
+
const c = new Date(d), g = /* @__PURE__ */ new Date();
|
|
2424
|
+
g.setHours(0, 0, 0, 0);
|
|
2425
|
+
const u = new Date(g.getTime() + 864e5);
|
|
2426
|
+
return c < g ? n("taskManager.overdue", "Overdue") : c.toDateString() === g.toDateString() ? n("taskManager.today", "Today") : c.toDateString() === u.toDateString() ? n("taskManager.tomorrow", "Tomorrow") : c.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
2427
|
+
}, i = s.dueDate && new Date(s.dueDate) < /* @__PURE__ */ new Date() && s.status !== "done";
|
|
2428
|
+
return /* @__PURE__ */ l("div", { style: S.taskItem, children: [
|
|
2429
|
+
/* @__PURE__ */ a(
|
|
2399
2430
|
"div",
|
|
2400
2431
|
{
|
|
2401
|
-
style: { ...
|
|
2432
|
+
style: { ...S.priorityIndicator, backgroundColor: O[s.priority] }
|
|
2402
2433
|
}
|
|
2403
2434
|
),
|
|
2404
|
-
/* @__PURE__ */
|
|
2435
|
+
/* @__PURE__ */ a(
|
|
2405
2436
|
"div",
|
|
2406
2437
|
{
|
|
2407
|
-
|
|
2438
|
+
role: "checkbox",
|
|
2439
|
+
"aria-checked": s.status === "done",
|
|
2440
|
+
"aria-label": s.title,
|
|
2441
|
+
tabIndex: 0,
|
|
2442
|
+
onKeyDown: A,
|
|
2443
|
+
onClick: o,
|
|
2408
2444
|
style: {
|
|
2409
|
-
...
|
|
2410
|
-
borderColor:
|
|
2445
|
+
...S.checkbox,
|
|
2446
|
+
borderColor: O[s.priority]
|
|
2411
2447
|
}
|
|
2412
2448
|
}
|
|
2413
2449
|
),
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2416
|
-
/* @__PURE__ */
|
|
2417
|
-
s.dueDate && /* @__PURE__ */
|
|
2418
|
-
s.estimatedMinutes && /* @__PURE__ */ a("span", { children:
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
s.recurrence && /* @__PURE__ */
|
|
2450
|
+
/* @__PURE__ */ l("div", { style: S.taskContent, children: [
|
|
2451
|
+
/* @__PURE__ */ a("div", { style: S.taskTitle, children: s.title }),
|
|
2452
|
+
/* @__PURE__ */ l("div", { style: S.taskMeta, children: [
|
|
2453
|
+
s.dueDate && /* @__PURE__ */ a("span", { style: { color: i ? "#f44336" : "#666" }, children: r(s.dueDate) }),
|
|
2454
|
+
s.estimatedMinutes && /* @__PURE__ */ a("span", { children: n("taskManager.min", "{estimatedMinutes} min").replace(
|
|
2455
|
+
"{estimatedMinutes}",
|
|
2456
|
+
String(s.estimatedMinutes)
|
|
2457
|
+
) }),
|
|
2458
|
+
s.recurrence && /* @__PURE__ */ a("span", { children: n("taskManager.repeats", "Repeats") })
|
|
2423
2459
|
] })
|
|
2424
2460
|
] })
|
|
2425
2461
|
] });
|
|
2426
2462
|
}
|
|
2427
|
-
function
|
|
2463
|
+
function Te({
|
|
2428
2464
|
service: s,
|
|
2429
2465
|
onComplete: e
|
|
2430
2466
|
}) {
|
|
2431
|
-
const t = s.getPriorityMatrix(),
|
|
2467
|
+
const { t } = w(), n = s.getPriorityMatrix(), o = {
|
|
2432
2468
|
doFirst: { bg: "#ffebee", border: "#f44336" },
|
|
2433
2469
|
schedule: { bg: "#fff3e0", border: "#ff9800" },
|
|
2434
2470
|
delegate: { bg: "#e3f2fd", border: "#2196f3" },
|
|
2435
2471
|
eliminate: { bg: "#f5f5f5", border: "#9e9e9e" }
|
|
2436
2472
|
};
|
|
2437
|
-
return /* @__PURE__ */
|
|
2438
|
-
const
|
|
2439
|
-
return /* @__PURE__ */
|
|
2473
|
+
return /* @__PURE__ */ a("div", { style: S.matrixGrid, children: ["doFirst", "schedule", "delegate", "eliminate"].map((r) => {
|
|
2474
|
+
const i = n[r], d = o[r];
|
|
2475
|
+
return /* @__PURE__ */ l(
|
|
2440
2476
|
"div",
|
|
2441
2477
|
{
|
|
2442
2478
|
style: {
|
|
2443
|
-
...
|
|
2444
|
-
backgroundColor:
|
|
2445
|
-
borderLeft: `4px solid ${
|
|
2479
|
+
...S.matrixQuadrant,
|
|
2480
|
+
backgroundColor: d.bg,
|
|
2481
|
+
borderLeft: `4px solid ${d.border}`
|
|
2446
2482
|
},
|
|
2447
2483
|
children: [
|
|
2448
|
-
/* @__PURE__ */
|
|
2449
|
-
/* @__PURE__ */
|
|
2450
|
-
|
|
2451
|
-
|
|
2484
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 600, marginBottom: "8px" }, children: t(`taskManager.quadrant.${r}.name`, i.name) }),
|
|
2485
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666", marginBottom: "12px" }, children: t(`taskManager.quadrant.${r}.description`, i.description) }),
|
|
2486
|
+
i.tasks.map((c) => /* @__PURE__ */ a(_, { task: c, service: s, onComplete: e }, c.id)),
|
|
2487
|
+
i.tasks.length === 0 && /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: t("taskManager.empty", "Empty") })
|
|
2452
2488
|
]
|
|
2453
2489
|
},
|
|
2454
|
-
|
|
2490
|
+
r
|
|
2455
2491
|
);
|
|
2456
2492
|
}) });
|
|
2457
2493
|
}
|
|
2458
|
-
class
|
|
2494
|
+
class Ie {
|
|
2459
2495
|
constructor() {
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2496
|
+
k(this, "kpis", /* @__PURE__ */ new Map());
|
|
2497
|
+
k(this, "goals", /* @__PURE__ */ new Map());
|
|
2498
|
+
k(this, "habits", /* @__PURE__ */ new Map());
|
|
2499
|
+
k(this, "moodEntries", /* @__PURE__ */ new Map());
|
|
2500
|
+
k(this, "financeSummary", {
|
|
2465
2501
|
netWorth: 0,
|
|
2466
2502
|
monthlyIncome: 0,
|
|
2467
2503
|
monthlyExpenses: 0,
|
|
@@ -2478,18 +2514,18 @@ class we {
|
|
|
2478
2514
|
KPIs
|
|
2479
2515
|
───────────────────────────────────────────────────────────── */
|
|
2480
2516
|
addKPI(e) {
|
|
2481
|
-
const t = this.generateId(),
|
|
2482
|
-
return this.kpis.set(t,
|
|
2517
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2518
|
+
return this.kpis.set(t, n), n;
|
|
2483
2519
|
}
|
|
2484
2520
|
updateKPI(e, t) {
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2521
|
+
const n = this.kpis.get(e);
|
|
2522
|
+
n && this.kpis.set(e, { ...n, ...t, id: e });
|
|
2487
2523
|
}
|
|
2488
2524
|
recordKPIValue(e, t) {
|
|
2489
|
-
const
|
|
2490
|
-
if (
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2525
|
+
const n = this.kpis.get(e);
|
|
2526
|
+
if (n) {
|
|
2527
|
+
const o = n.currentValue;
|
|
2528
|
+
n.currentValue = t, n.history.push({ date: /* @__PURE__ */ new Date(), value: t }), n.trend = t > o ? "up" : t < o ? "down" : "stable", this.kpis.set(e, n);
|
|
2493
2529
|
}
|
|
2494
2530
|
}
|
|
2495
2531
|
getAllKPIs() {
|
|
@@ -2505,24 +2541,24 @@ class we {
|
|
|
2505
2541
|
GOALS
|
|
2506
2542
|
───────────────────────────────────────────────────────────── */
|
|
2507
2543
|
addGoal(e) {
|
|
2508
|
-
const t = this.generateId(),
|
|
2509
|
-
return this.goals.set(t,
|
|
2544
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2545
|
+
return this.goals.set(t, n), n;
|
|
2510
2546
|
}
|
|
2511
2547
|
updateGoal(e, t) {
|
|
2512
|
-
const
|
|
2513
|
-
|
|
2548
|
+
const n = this.goals.get(e);
|
|
2549
|
+
n && this.goals.set(e, { ...n, ...t, id: e });
|
|
2514
2550
|
}
|
|
2515
2551
|
completeGoalMilestone(e, t) {
|
|
2516
|
-
const
|
|
2517
|
-
if (
|
|
2518
|
-
const
|
|
2519
|
-
|
|
2552
|
+
const n = this.goals.get(e);
|
|
2553
|
+
if (n) {
|
|
2554
|
+
const o = n.milestones.find((r) => r.id === t);
|
|
2555
|
+
o && (o.completed = !0, o.completedDate = /* @__PURE__ */ new Date(), n.progress = this.calculateGoalProgress(n), this.goals.set(e, n));
|
|
2520
2556
|
}
|
|
2521
2557
|
}
|
|
2522
2558
|
calculateGoalProgress(e) {
|
|
2523
2559
|
if (e.milestones.length === 0)
|
|
2524
2560
|
return e.progress;
|
|
2525
|
-
const t = e.milestones.filter((
|
|
2561
|
+
const t = e.milestones.filter((n) => n.completed).length;
|
|
2526
2562
|
return Math.round(t / e.milestones.length * 100);
|
|
2527
2563
|
}
|
|
2528
2564
|
getAllGoals() {
|
|
@@ -2535,14 +2571,14 @@ class we {
|
|
|
2535
2571
|
return this.getAllGoals().filter((t) => t.category === e);
|
|
2536
2572
|
}
|
|
2537
2573
|
getUpcomingDeadlines(e = 30) {
|
|
2538
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2539
|
-
return this.getActiveGoals().filter((
|
|
2574
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() + e * 24 * 60 * 60 * 1e3);
|
|
2575
|
+
return this.getActiveGoals().filter((o) => o.targetDate <= n).sort((o, r) => o.targetDate.getTime() - r.targetDate.getTime());
|
|
2540
2576
|
}
|
|
2541
2577
|
/* ─────────────────────────────────────────────────────────────
|
|
2542
2578
|
HABITS
|
|
2543
2579
|
───────────────────────────────────────────────────────────── */
|
|
2544
2580
|
addHabit(e) {
|
|
2545
|
-
const t = this.generateId(),
|
|
2581
|
+
const t = this.generateId(), n = {
|
|
2546
2582
|
...e,
|
|
2547
2583
|
id: t,
|
|
2548
2584
|
streak: 0,
|
|
@@ -2550,64 +2586,64 @@ class we {
|
|
|
2550
2586
|
completions: [],
|
|
2551
2587
|
createdAt: /* @__PURE__ */ new Date()
|
|
2552
2588
|
};
|
|
2553
|
-
return this.habits.set(t,
|
|
2554
|
-
}
|
|
2555
|
-
completeHabit(e, t = 1,
|
|
2556
|
-
const
|
|
2557
|
-
if (
|
|
2558
|
-
const
|
|
2559
|
-
|
|
2560
|
-
const
|
|
2561
|
-
(d) => new Date(d.date).toDateString() ===
|
|
2589
|
+
return this.habits.set(t, n), n;
|
|
2590
|
+
}
|
|
2591
|
+
completeHabit(e, t = 1, n) {
|
|
2592
|
+
const o = this.habits.get(e);
|
|
2593
|
+
if (o) {
|
|
2594
|
+
const r = /* @__PURE__ */ new Date();
|
|
2595
|
+
r.setHours(0, 0, 0, 0);
|
|
2596
|
+
const i = o.completions.find(
|
|
2597
|
+
(d) => new Date(d.date).toDateString() === r.toDateString()
|
|
2562
2598
|
);
|
|
2563
|
-
|
|
2599
|
+
i ? (i.count += t, n && (i.note = n)) : o.completions.push({ date: r, count: t, note: n }), this.updateStreak(o), this.habits.set(e, o);
|
|
2564
2600
|
}
|
|
2565
2601
|
}
|
|
2566
2602
|
updateStreak(e) {
|
|
2567
2603
|
const t = [...e.completions].sort(
|
|
2568
|
-
(
|
|
2604
|
+
(r, i) => new Date(i.date).getTime() - new Date(r.date).getTime()
|
|
2569
2605
|
);
|
|
2570
2606
|
if (t.length === 0) {
|
|
2571
2607
|
e.streak = 0;
|
|
2572
2608
|
return;
|
|
2573
2609
|
}
|
|
2574
|
-
let
|
|
2575
|
-
const
|
|
2576
|
-
|
|
2577
|
-
for (let
|
|
2578
|
-
const
|
|
2579
|
-
|
|
2580
|
-
const d = new Date(
|
|
2581
|
-
if (
|
|
2582
|
-
if (t[
|
|
2583
|
-
|
|
2610
|
+
let n = 0;
|
|
2611
|
+
const o = /* @__PURE__ */ new Date();
|
|
2612
|
+
o.setHours(0, 0, 0, 0);
|
|
2613
|
+
for (let r = 0; r < t.length; r++) {
|
|
2614
|
+
const i = new Date(t[r].date);
|
|
2615
|
+
i.setHours(0, 0, 0, 0);
|
|
2616
|
+
const d = new Date(o.getTime() - r * 24 * 60 * 60 * 1e3);
|
|
2617
|
+
if (i.getTime() === d.getTime())
|
|
2618
|
+
if (t[r].count >= e.targetPerPeriod)
|
|
2619
|
+
n++;
|
|
2584
2620
|
else
|
|
2585
2621
|
break;
|
|
2586
2622
|
else
|
|
2587
2623
|
break;
|
|
2588
2624
|
}
|
|
2589
|
-
e.streak =
|
|
2625
|
+
e.streak = n, n > e.longestStreak && (e.longestStreak = n);
|
|
2590
2626
|
}
|
|
2591
2627
|
getAllHabits() {
|
|
2592
2628
|
return Array.from(this.habits.values());
|
|
2593
2629
|
}
|
|
2594
2630
|
getHabitCompletionRate(e, t = 30) {
|
|
2595
|
-
const
|
|
2596
|
-
if (!
|
|
2631
|
+
const n = this.habits.get(e);
|
|
2632
|
+
if (!n)
|
|
2597
2633
|
return 0;
|
|
2598
|
-
const
|
|
2599
|
-
(d) => new Date(d.date) >=
|
|
2634
|
+
const o = /* @__PURE__ */ new Date(), r = new Date(o.getTime() - t * 24 * 60 * 60 * 1e3), i = n.completions.filter(
|
|
2635
|
+
(d) => new Date(d.date) >= r && d.count >= n.targetPerPeriod
|
|
2600
2636
|
);
|
|
2601
|
-
return Math.round(
|
|
2637
|
+
return Math.round(i.length / t * 100);
|
|
2602
2638
|
}
|
|
2603
2639
|
getTodayHabitStatus() {
|
|
2604
2640
|
const e = (/* @__PURE__ */ new Date()).toDateString();
|
|
2605
2641
|
return this.getAllHabits().map((t) => {
|
|
2606
|
-
const
|
|
2642
|
+
const n = t.completions.find((o) => new Date(o.date).toDateString() === e);
|
|
2607
2643
|
return {
|
|
2608
2644
|
habit: t,
|
|
2609
|
-
completed:
|
|
2610
|
-
count: (
|
|
2645
|
+
completed: n ? n.count >= t.targetPerPeriod : !1,
|
|
2646
|
+
count: (n == null ? void 0 : n.count) ?? 0
|
|
2611
2647
|
};
|
|
2612
2648
|
});
|
|
2613
2649
|
}
|
|
@@ -2615,8 +2651,8 @@ class we {
|
|
|
2615
2651
|
MOOD & HEALTH
|
|
2616
2652
|
───────────────────────────────────────────────────────────── */
|
|
2617
2653
|
addMoodEntry(e) {
|
|
2618
|
-
const t = this.generateId(),
|
|
2619
|
-
return this.moodEntries.set(t,
|
|
2654
|
+
const t = this.generateId(), n = { ...e, id: t };
|
|
2655
|
+
return this.moodEntries.set(t, n), n;
|
|
2620
2656
|
}
|
|
2621
2657
|
getAllMoodEntries() {
|
|
2622
2658
|
return Array.from(this.moodEntries.values()).sort(
|
|
@@ -2625,37 +2661,37 @@ class we {
|
|
|
2625
2661
|
}
|
|
2626
2662
|
getMoodEntriesForPeriod(e, t) {
|
|
2627
2663
|
return this.getAllMoodEntries().filter(
|
|
2628
|
-
(
|
|
2664
|
+
(n) => new Date(n.date) >= e && new Date(n.date) <= t
|
|
2629
2665
|
);
|
|
2630
2666
|
}
|
|
2631
2667
|
getAverageMood(e = 7) {
|
|
2632
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2633
|
-
return
|
|
2668
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() - e * 24 * 60 * 60 * 1e3), o = this.getMoodEntriesForPeriod(n, t);
|
|
2669
|
+
return o.length === 0 ? 0 : o.reduce((r, i) => r + i.mood, 0) / o.length;
|
|
2634
2670
|
}
|
|
2635
2671
|
getAverageSleep(e = 7) {
|
|
2636
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2637
|
-
return
|
|
2672
|
+
const t = /* @__PURE__ */ new Date(), n = new Date(t.getTime() - e * 24 * 60 * 60 * 1e3), o = this.getMoodEntriesForPeriod(n, t);
|
|
2673
|
+
return o.length === 0 ? 0 : o.reduce((r, i) => r + i.sleep, 0) / o.length;
|
|
2638
2674
|
}
|
|
2639
2675
|
getMoodCorrelations() {
|
|
2640
2676
|
const e = this.getAllMoodEntries();
|
|
2641
2677
|
if (e.length < 5)
|
|
2642
2678
|
return [];
|
|
2643
|
-
const t = [],
|
|
2644
|
-
e.map((
|
|
2645
|
-
e.map((
|
|
2679
|
+
const t = [], n = this.calculateCorrelation(
|
|
2680
|
+
e.map((r) => r.sleep),
|
|
2681
|
+
e.map((r) => r.mood)
|
|
2646
2682
|
);
|
|
2647
|
-
t.push({ factor: "Sleep", correlation:
|
|
2648
|
-
const
|
|
2649
|
-
e.map((
|
|
2650
|
-
e.map((
|
|
2683
|
+
t.push({ factor: "Sleep", correlation: n });
|
|
2684
|
+
const o = this.calculateCorrelation(
|
|
2685
|
+
e.map((r) => r.stress),
|
|
2686
|
+
e.map((r) => r.mood)
|
|
2651
2687
|
);
|
|
2652
|
-
return t.push({ factor: "Stress", correlation:
|
|
2688
|
+
return t.push({ factor: "Stress", correlation: o }), t.sort((r, i) => Math.abs(i.correlation) - Math.abs(r.correlation));
|
|
2653
2689
|
}
|
|
2654
2690
|
calculateCorrelation(e, t) {
|
|
2655
|
-
const
|
|
2656
|
-
if (
|
|
2691
|
+
const n = e.length;
|
|
2692
|
+
if (n === 0)
|
|
2657
2693
|
return 0;
|
|
2658
|
-
const
|
|
2694
|
+
const o = e.reduce((h, p) => h + p, 0), r = t.reduce((h, p) => h + p, 0), i = e.reduce((h, p, D) => h + p * t[D], 0), d = e.reduce((h, p) => h + p * p, 0), c = t.reduce((h, p) => h + p * p, 0), g = n * i - o * r, u = Math.sqrt((n * d - o ** 2) * (n * c - r ** 2));
|
|
2659
2695
|
return u === 0 ? 0 : g / u;
|
|
2660
2696
|
}
|
|
2661
2697
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -2670,14 +2706,14 @@ class we {
|
|
|
2670
2706
|
calculateFinanceHealth() {
|
|
2671
2707
|
const e = [], t = Math.min(100, this.financeSummary.savingsRate / 20 * 100);
|
|
2672
2708
|
e.push({ name: "Savings Rate", score: t });
|
|
2673
|
-
const
|
|
2709
|
+
const n = this.financeSummary.budgetTotal > 0 ? Math.min(
|
|
2674
2710
|
100,
|
|
2675
2711
|
(1 - this.financeSummary.budgetUsed / this.financeSummary.budgetTotal) * 100 + 50
|
|
2676
2712
|
) : 50;
|
|
2677
|
-
e.push({ name: "Budget Adherence", score:
|
|
2678
|
-
const
|
|
2679
|
-
e.push({ name: "Debt Management", score:
|
|
2680
|
-
const
|
|
2713
|
+
e.push({ name: "Budget Adherence", score: n });
|
|
2714
|
+
const o = this.financeSummary.monthlyIncome > 0 ? this.financeSummary.debts / (this.financeSummary.monthlyIncome * 12) : 0, r = Math.max(0, 100 - o * 100);
|
|
2715
|
+
e.push({ name: "Debt Management", score: r });
|
|
2716
|
+
const i = this.financeSummary.monthlyExpenses > 0 ? this.financeSummary.savings / this.financeSummary.monthlyExpenses : 0, d = Math.min(100, i / 6 * 100);
|
|
2681
2717
|
e.push({ name: "Emergency Fund", score: d });
|
|
2682
2718
|
const c = e.reduce((g, u) => g + u.score, 0) / e.length;
|
|
2683
2719
|
return { score: Math.round(c), factors: e };
|
|
@@ -2686,12 +2722,12 @@ class we {
|
|
|
2686
2722
|
INSIGHTS
|
|
2687
2723
|
───────────────────────────────────────────────────────────── */
|
|
2688
2724
|
generateDailyInsights() {
|
|
2689
|
-
const e = [], t = this.getAllKPIs(),
|
|
2690
|
-
|
|
2691
|
-
const
|
|
2692
|
-
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2725
|
+
const e = [], t = this.getAllKPIs(), n = t.filter((g) => g.currentValue >= g.targetValue);
|
|
2726
|
+
n.length > 0 && e.push(`You've achieved ${n.length} of ${t.length} KPI targets!`);
|
|
2727
|
+
const o = this.getTodayHabitStatus(), r = o.filter((g) => g.completed);
|
|
2728
|
+
r.length === o.length && o.length > 0 ? e.push("All habits completed today! Keep it up!") : r.length > 0 && e.push(`${r.length}/${o.length} habits completed today.`);
|
|
2729
|
+
const i = this.getAllHabits().reduce((g, u) => Math.max(g, u.streak), 0);
|
|
2730
|
+
i >= 7 && e.push(`Amazing ${i}-day streak! You're building a strong routine.`);
|
|
2695
2731
|
const d = this.getUpcomingDeadlines(7);
|
|
2696
2732
|
d.length > 0 && e.push(`${d.length} goal deadline(s) coming up this week.`);
|
|
2697
2733
|
const c = this.getAverageMood(7);
|
|
@@ -2707,12 +2743,12 @@ class we {
|
|
|
2707
2743
|
this.kpis.clear(), this.goals.clear(), this.habits.clear(), this.moodEntries.clear();
|
|
2708
2744
|
}
|
|
2709
2745
|
}
|
|
2710
|
-
function
|
|
2711
|
-
return new
|
|
2746
|
+
function nt() {
|
|
2747
|
+
return new Ie();
|
|
2712
2748
|
}
|
|
2713
|
-
const
|
|
2714
|
-
function
|
|
2715
|
-
const s =
|
|
2749
|
+
const X = /* @__PURE__ */ H(null);
|
|
2750
|
+
function rt() {
|
|
2751
|
+
const s = L(X);
|
|
2716
2752
|
if (!s)
|
|
2717
2753
|
throw new Error("useLifeDashboard must be used within LifeDashboardProvider");
|
|
2718
2754
|
return s;
|
|
@@ -2807,32 +2843,32 @@ const v = {
|
|
|
2807
2843
|
color: "#1565c0"
|
|
2808
2844
|
}
|
|
2809
2845
|
};
|
|
2810
|
-
function
|
|
2846
|
+
function at({
|
|
2811
2847
|
service: s,
|
|
2812
2848
|
className: e,
|
|
2813
2849
|
style: t
|
|
2814
2850
|
}) {
|
|
2815
|
-
const [,
|
|
2816
|
-
|
|
2817
|
-
}, []),
|
|
2818
|
-
return /* @__PURE__ */
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
2851
|
+
const { t: n } = w(), [, o] = T(0), r = N(() => {
|
|
2852
|
+
o((m) => m + 1);
|
|
2853
|
+
}, []), i = { service: s, refresh: r }, d = s.generateDailyInsights(), c = s.getAllKPIs(), g = s.getTodayHabitStatus(), u = s.getActiveGoals(), h = s.getFinanceSummary(), p = s.calculateFinanceHealth(), D = (m) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(m);
|
|
2854
|
+
return /* @__PURE__ */ a(X.Provider, { value: i, children: /* @__PURE__ */ l("div", { className: e, style: { ...v.dashboard, ...t }, children: [
|
|
2855
|
+
/* @__PURE__ */ l("div", { style: v.header, children: [
|
|
2856
|
+
/* @__PURE__ */ a("div", { style: v.title, children: n("lifeDashboard.lifeDashboard", "Life Dashboard") }),
|
|
2857
|
+
/* @__PURE__ */ a("div", { style: { color: "#666" }, children: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
2822
2858
|
weekday: "long",
|
|
2823
2859
|
year: "numeric",
|
|
2824
2860
|
month: "long",
|
|
2825
2861
|
day: "numeric"
|
|
2826
2862
|
}) })
|
|
2827
2863
|
] }),
|
|
2828
|
-
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
2831
|
-
/* @__PURE__ */
|
|
2832
|
-
|
|
2833
|
-
const b = s.calculateKPIProgress(
|
|
2834
|
-
return /* @__PURE__ */
|
|
2835
|
-
/* @__PURE__ */
|
|
2864
|
+
d.length > 0 && /* @__PURE__ */ a("div", { children: d.map((m, b) => /* @__PURE__ */ a("div", { style: v.insight, children: m }, b)) }),
|
|
2865
|
+
/* @__PURE__ */ l("div", { style: v.grid, children: [
|
|
2866
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2867
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.personalKpis", "Personal KPIs") }),
|
|
2868
|
+
c.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: n("lifeDashboard.noKpisDefinedYet", "No KPIs defined yet") }) : c.slice(0, 5).map((m) => {
|
|
2869
|
+
const b = s.calculateKPIProgress(m);
|
|
2870
|
+
return /* @__PURE__ */ l("div", { style: { marginBottom: "16px" }, children: [
|
|
2871
|
+
/* @__PURE__ */ l(
|
|
2836
2872
|
"div",
|
|
2837
2873
|
{
|
|
2838
2874
|
style: {
|
|
@@ -2841,15 +2877,15 @@ function Ze({
|
|
|
2841
2877
|
marginBottom: "4px"
|
|
2842
2878
|
},
|
|
2843
2879
|
children: [
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
|
|
2847
|
-
|
|
2880
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: m.name }),
|
|
2881
|
+
/* @__PURE__ */ l("span", { style: { color: "#666" }, children: [
|
|
2882
|
+
m.currentValue,
|
|
2883
|
+
m.unit ? ` ${m.unit}` : "",
|
|
2848
2884
|
" / ",
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2885
|
+
m.targetValue,
|
|
2886
|
+
m.trend === "up" && /* @__PURE__ */ a(j, { size: 12, style: { marginLeft: 4, verticalAlign: "-1px" } }),
|
|
2887
|
+
m.trend === "down" && /* @__PURE__ */ a(
|
|
2888
|
+
E,
|
|
2853
2889
|
{
|
|
2854
2890
|
size: 12,
|
|
2855
2891
|
style: { marginLeft: 4, verticalAlign: "-1px" }
|
|
@@ -2859,7 +2895,7 @@ function Ze({
|
|
|
2859
2895
|
]
|
|
2860
2896
|
}
|
|
2861
2897
|
),
|
|
2862
|
-
/* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ a("div", { style: v.progressBar, children: /* @__PURE__ */ a(
|
|
2863
2899
|
"div",
|
|
2864
2900
|
{
|
|
2865
2901
|
style: {
|
|
@@ -2869,13 +2905,13 @@ function Ze({
|
|
|
2869
2905
|
}
|
|
2870
2906
|
}
|
|
2871
2907
|
) })
|
|
2872
|
-
] },
|
|
2908
|
+
] }, m.id);
|
|
2873
2909
|
})
|
|
2874
2910
|
] }),
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2877
|
-
|
|
2878
|
-
/* @__PURE__ */
|
|
2911
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2912
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.activeGoals", "Active Goals") }),
|
|
2913
|
+
u.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: n("lifeDashboard.noActiveGoals", "No active goals") }) : u.slice(0, 4).map((m) => /* @__PURE__ */ l("div", { style: { marginBottom: "16px" }, children: [
|
|
2914
|
+
/* @__PURE__ */ l(
|
|
2879
2915
|
"div",
|
|
2880
2916
|
{
|
|
2881
2917
|
style: {
|
|
@@ -2884,48 +2920,53 @@ function Ze({
|
|
|
2884
2920
|
marginBottom: "4px"
|
|
2885
2921
|
},
|
|
2886
2922
|
children: [
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
|
|
2923
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: m.title }),
|
|
2924
|
+
/* @__PURE__ */ l("span", { style: { color: "#666" }, children: [
|
|
2925
|
+
m.progress,
|
|
2890
2926
|
"%"
|
|
2891
2927
|
] })
|
|
2892
2928
|
]
|
|
2893
2929
|
}
|
|
2894
2930
|
),
|
|
2895
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ a("div", { style: v.progressBar, children: /* @__PURE__ */ a(
|
|
2896
2932
|
"div",
|
|
2897
2933
|
{
|
|
2898
2934
|
style: {
|
|
2899
2935
|
...v.progressFill,
|
|
2900
|
-
width: `${
|
|
2936
|
+
width: `${m.progress}%`,
|
|
2901
2937
|
backgroundColor: "#ff9800"
|
|
2902
2938
|
}
|
|
2903
2939
|
}
|
|
2904
2940
|
) }),
|
|
2905
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#999", marginTop: "4px" }, children:
|
|
2906
|
-
"
|
|
2907
|
-
new Date(
|
|
2908
|
-
|
|
2909
|
-
] },
|
|
2941
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#999", marginTop: "4px" }, children: n("lifeDashboard.due", "Due: {targetDate}").replace(
|
|
2942
|
+
"{targetDate}",
|
|
2943
|
+
String(new Date(m.targetDate).toLocaleDateString())
|
|
2944
|
+
) })
|
|
2945
|
+
] }, m.id))
|
|
2910
2946
|
] }),
|
|
2911
|
-
/* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
|
|
2914
|
-
/* @__PURE__ */
|
|
2947
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2948
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.todaysHabits", "Today's Habits") }),
|
|
2949
|
+
g.length === 0 ? /* @__PURE__ */ a("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: n("lifeDashboard.noHabitsTrackedYet", "No habits tracked yet") }) : g.map(({ habit: m, completed: b, count: C }) => /* @__PURE__ */ l("div", { style: v.habitItem, children: [
|
|
2950
|
+
/* @__PURE__ */ a(
|
|
2915
2951
|
"div",
|
|
2916
2952
|
{
|
|
2953
|
+
role: "checkbox",
|
|
2954
|
+
"aria-checked": b,
|
|
2955
|
+
"aria-label": m.name,
|
|
2956
|
+
tabIndex: 0,
|
|
2957
|
+
onKeyDown: A,
|
|
2917
2958
|
style: {
|
|
2918
2959
|
...v.habitCheck,
|
|
2919
2960
|
backgroundColor: b ? "#4caf50" : "transparent",
|
|
2920
2961
|
borderColor: b ? "#4caf50" : "#ccc"
|
|
2921
2962
|
},
|
|
2922
2963
|
onClick: () => {
|
|
2923
|
-
s.completeHabit(
|
|
2964
|
+
s.completeHabit(m.id), r();
|
|
2924
2965
|
},
|
|
2925
|
-
children: b && /* @__PURE__ */
|
|
2966
|
+
children: b && /* @__PURE__ */ a(
|
|
2926
2967
|
"span",
|
|
2927
2968
|
{
|
|
2928
|
-
"aria-label": "Done",
|
|
2969
|
+
"aria-label": n("lifeDashboard.done", "Done"),
|
|
2929
2970
|
style: {
|
|
2930
2971
|
width: "6px",
|
|
2931
2972
|
height: "11px",
|
|
@@ -2938,55 +2979,51 @@ function Ze({
|
|
|
2938
2979
|
)
|
|
2939
2980
|
}
|
|
2940
2981
|
),
|
|
2941
|
-
/* @__PURE__ */
|
|
2942
|
-
/* @__PURE__ */
|
|
2943
|
-
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
2944
|
-
|
|
2945
|
-
"/"
|
|
2946
|
-
|
|
2947
|
-
" • ",
|
|
2948
|
-
f.streak,
|
|
2949
|
-
" day streak"
|
|
2950
|
-
] })
|
|
2982
|
+
/* @__PURE__ */ l("div", { style: { flex: 1 }, children: [
|
|
2983
|
+
/* @__PURE__ */ a("div", { style: { fontWeight: 500 }, children: m.name }),
|
|
2984
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: n(
|
|
2985
|
+
"lifeDashboard.dayStreak",
|
|
2986
|
+
"{count}/{targetPerPeriod} • {streak} day streak"
|
|
2987
|
+
).replace("{count}", String(C)).replace("{targetPerPeriod}", String(m.targetPerPeriod)).replace("{streak}", String(m.streak)) })
|
|
2951
2988
|
] })
|
|
2952
|
-
] },
|
|
2989
|
+
] }, m.id))
|
|
2953
2990
|
] }),
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2991
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
2992
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.financeOverview", "Finance Overview") }),
|
|
2993
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
2994
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.netWorth", "Net Worth") }),
|
|
2995
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: D(h.netWorth) })
|
|
2959
2996
|
] }),
|
|
2960
|
-
/* @__PURE__ */
|
|
2961
|
-
/* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2997
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
2998
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.monthlyIncome", "Monthly Income") }),
|
|
2999
|
+
/* @__PURE__ */ a("span", { style: { color: "#4caf50" }, children: D(h.monthlyIncome) })
|
|
2963
3000
|
] }),
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */
|
|
3001
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
3002
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.monthlyExpenses", "Monthly Expenses") }),
|
|
3003
|
+
/* @__PURE__ */ a("span", { style: { color: "#f44336" }, children: D(h.monthlyExpenses) })
|
|
2967
3004
|
] }),
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
|
|
3005
|
+
/* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
3006
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.savingsRate", "Savings Rate") }),
|
|
3007
|
+
/* @__PURE__ */ l("span", { children: [
|
|
3008
|
+
h.savingsRate.toFixed(1),
|
|
2972
3009
|
"%"
|
|
2973
3010
|
] })
|
|
2974
3011
|
] }),
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
3012
|
+
/* @__PURE__ */ l("div", { style: { marginTop: "16px" }, children: [
|
|
3013
|
+
/* @__PURE__ */ l(
|
|
2977
3014
|
"div",
|
|
2978
3015
|
{
|
|
2979
3016
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" },
|
|
2980
3017
|
children: [
|
|
2981
|
-
/* @__PURE__ */
|
|
2982
|
-
/* @__PURE__ */
|
|
3018
|
+
/* @__PURE__ */ a("span", { children: n("lifeDashboard.financeHealth", "Finance Health") }),
|
|
3019
|
+
/* @__PURE__ */ l("span", { style: { fontWeight: 600 }, children: [
|
|
2983
3020
|
p.score,
|
|
2984
3021
|
"/100"
|
|
2985
3022
|
] })
|
|
2986
3023
|
]
|
|
2987
3024
|
}
|
|
2988
3025
|
),
|
|
2989
|
-
/* @__PURE__ */
|
|
3026
|
+
/* @__PURE__ */ a("div", { style: v.progressBar, children: /* @__PURE__ */ a(
|
|
2990
3027
|
"div",
|
|
2991
3028
|
{
|
|
2992
3029
|
style: {
|
|
@@ -2998,35 +3035,38 @@ function Ze({
|
|
|
2998
3035
|
) })
|
|
2999
3036
|
] })
|
|
3000
3037
|
] }),
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
/* @__PURE__ */
|
|
3004
|
-
/* @__PURE__ */
|
|
3005
|
-
/* @__PURE__ */
|
|
3006
|
-
|
|
3038
|
+
/* @__PURE__ */ l("div", { style: v.card, children: [
|
|
3039
|
+
/* @__PURE__ */ a("div", { style: v.cardTitle, children: n("lifeDashboard.moodHealth", "Mood & Health") }),
|
|
3040
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-around", marginBottom: "20px" }, children: [
|
|
3041
|
+
/* @__PURE__ */ l("div", { style: { textAlign: "center" }, children: [
|
|
3042
|
+
/* @__PURE__ */ a("div", { style: v.moodEmoji, children: n(
|
|
3043
|
+
`lifeDashboard.mood.${Math.round(s.getAverageMood(7))}`,
|
|
3044
|
+
Ce(Math.round(s.getAverageMood(7)))
|
|
3045
|
+
) }),
|
|
3046
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: n("lifeDashboard.avgMood7d", "Avg Mood (7d)") })
|
|
3007
3047
|
] }),
|
|
3008
|
-
/* @__PURE__ */
|
|
3009
|
-
/* @__PURE__ */
|
|
3048
|
+
/* @__PURE__ */ l("div", { style: { textAlign: "center" }, children: [
|
|
3049
|
+
/* @__PURE__ */ l("div", { style: { fontSize: "28px", fontWeight: 600 }, children: [
|
|
3010
3050
|
s.getAverageSleep(7).toFixed(1),
|
|
3011
3051
|
"h"
|
|
3012
3052
|
] }),
|
|
3013
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: n("lifeDashboard.avgSleep7d", "Avg Sleep (7d)") })
|
|
3014
3054
|
] })
|
|
3015
3055
|
] }),
|
|
3016
|
-
s.getMoodCorrelations().slice(0, 2).map((
|
|
3017
|
-
/* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3019
|
-
|
|
3056
|
+
s.getMoodCorrelations().slice(0, 2).map((m) => /* @__PURE__ */ l("div", { style: v.statRow, children: [
|
|
3057
|
+
/* @__PURE__ */ a("span", { children: m.factor }),
|
|
3058
|
+
/* @__PURE__ */ l("span", { style: { color: m.correlation > 0 ? "#4caf50" : "#f44336" }, children: [
|
|
3059
|
+
m.correlation > 0 ? /* @__PURE__ */ a(j, { size: 12, style: { verticalAlign: "-1px" } }) : /* @__PURE__ */ a(E, { size: 12, style: { verticalAlign: "-1px" } }),
|
|
3020
3060
|
" ",
|
|
3021
|
-
Math.abs(
|
|
3061
|
+
Math.abs(m.correlation * 100).toFixed(0),
|
|
3022
3062
|
"%"
|
|
3023
3063
|
] })
|
|
3024
|
-
] },
|
|
3064
|
+
] }, m.factor))
|
|
3025
3065
|
] })
|
|
3026
3066
|
] })
|
|
3027
3067
|
] }) });
|
|
3028
3068
|
}
|
|
3029
|
-
function
|
|
3069
|
+
function Ce(s) {
|
|
3030
3070
|
return {
|
|
3031
3071
|
1: "Very low",
|
|
3032
3072
|
2: "Low",
|
|
@@ -3035,7 +3075,7 @@ function ke(s) {
|
|
|
3035
3075
|
5: "Great"
|
|
3036
3076
|
}[s] || "Neutral";
|
|
3037
3077
|
}
|
|
3038
|
-
const
|
|
3078
|
+
const Ae = {
|
|
3039
3079
|
colors: {
|
|
3040
3080
|
background: "#1a1a2e",
|
|
3041
3081
|
surface: "#16213e",
|
|
@@ -3057,7 +3097,7 @@ const Se = {
|
|
|
3057
3097
|
},
|
|
3058
3098
|
borderRadius: "8px",
|
|
3059
3099
|
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
3060
|
-
},
|
|
3100
|
+
}, G = [
|
|
3061
3101
|
{ id: "name", label: "Name", sortable: !0, visible: !0 },
|
|
3062
3102
|
{ id: "size", label: "Size", width: "100px", sortable: !0, visible: !0 },
|
|
3063
3103
|
{ id: "progress", label: "Progress", width: "150px", sortable: !0, visible: !0 },
|
|
@@ -3068,23 +3108,23 @@ const Se = {
|
|
|
3068
3108
|
{ id: "uploadSpeed", label: "Up", width: "100px", sortable: !0, visible: !0 },
|
|
3069
3109
|
{ id: "eta", label: "ETA", width: "100px", sortable: !0, visible: !0 },
|
|
3070
3110
|
{ id: "ratio", label: "Ratio", width: "80px", sortable: !0, visible: !0 }
|
|
3071
|
-
],
|
|
3072
|
-
function
|
|
3073
|
-
const s =
|
|
3111
|
+
], J = /* @__PURE__ */ H(null);
|
|
3112
|
+
function M() {
|
|
3113
|
+
const s = L(J);
|
|
3074
3114
|
if (!s)
|
|
3075
3115
|
throw new Error("useTorrentUI must be used within TorrentUIProvider");
|
|
3076
3116
|
return s;
|
|
3077
3117
|
}
|
|
3078
|
-
function
|
|
3118
|
+
function P(s, e = 2) {
|
|
3079
3119
|
if (s === 0)
|
|
3080
3120
|
return "0 B";
|
|
3081
|
-
const t = 1024,
|
|
3082
|
-
return `${parseFloat((s / Math.pow(t,
|
|
3121
|
+
const t = 1024, n = ["B", "KB", "MB", "GB", "TB", "PB"], o = Math.floor(Math.log(s) / Math.log(t));
|
|
3122
|
+
return `${parseFloat((s / Math.pow(t, o)).toFixed(e))} ${n[o]}`;
|
|
3083
3123
|
}
|
|
3084
|
-
function
|
|
3085
|
-
return `${
|
|
3124
|
+
function $(s) {
|
|
3125
|
+
return `${P(s)}/s`;
|
|
3086
3126
|
}
|
|
3087
|
-
function
|
|
3127
|
+
function Me(s) {
|
|
3088
3128
|
if (!s || s <= 0)
|
|
3089
3129
|
return "∞";
|
|
3090
3130
|
if (s < 60)
|
|
@@ -3092,16 +3132,16 @@ function De(s) {
|
|
|
3092
3132
|
if (s < 3600)
|
|
3093
3133
|
return `${Math.floor(s / 60)}m`;
|
|
3094
3134
|
if (s < 86400) {
|
|
3095
|
-
const
|
|
3096
|
-
return `${
|
|
3135
|
+
const n = Math.floor(s / 3600), o = Math.floor(s % 3600 / 60);
|
|
3136
|
+
return `${n}h ${o}m`;
|
|
3097
3137
|
}
|
|
3098
3138
|
const e = Math.floor(s / 86400), t = Math.floor(s % 86400 / 3600);
|
|
3099
3139
|
return `${e}d ${t}h`;
|
|
3100
3140
|
}
|
|
3101
|
-
function
|
|
3141
|
+
function Z(s) {
|
|
3102
3142
|
return s.toFixed(2);
|
|
3103
3143
|
}
|
|
3104
|
-
function
|
|
3144
|
+
function ee(s, e) {
|
|
3105
3145
|
switch (s) {
|
|
3106
3146
|
case "downloading":
|
|
3107
3147
|
return e.colors.primary;
|
|
@@ -3119,70 +3159,70 @@ function Y(s, e) {
|
|
|
3119
3159
|
return e.colors.text;
|
|
3120
3160
|
}
|
|
3121
3161
|
}
|
|
3122
|
-
function
|
|
3162
|
+
function Be({
|
|
3123
3163
|
client: s,
|
|
3124
3164
|
config: e = {},
|
|
3125
3165
|
children: t
|
|
3126
3166
|
}) {
|
|
3127
|
-
const
|
|
3128
|
-
() => ({ ...
|
|
3167
|
+
const n = W(
|
|
3168
|
+
() => ({ ...Ae, ...e.theme }),
|
|
3129
3169
|
[e.theme]
|
|
3130
|
-
), [
|
|
3131
|
-
|
|
3170
|
+
), [o, r] = T([]), [i, d] = T(null), [c, g] = T("all"), [u, h] = T(""), p = N(() => {
|
|
3171
|
+
r(s.getAllTorrents());
|
|
3132
3172
|
}, [s]);
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
const
|
|
3136
|
-
return s.on("torrent_added",
|
|
3137
|
-
clearInterval(
|
|
3173
|
+
ae(() => {
|
|
3174
|
+
p();
|
|
3175
|
+
const m = setInterval(p, e.refreshInterval || 1e3), b = () => p(), C = () => p();
|
|
3176
|
+
return s.on("torrent_added", b), s.on("torrent_removed", C), () => {
|
|
3177
|
+
clearInterval(m), s.off("torrent_added", b), s.off("torrent_removed", C);
|
|
3138
3178
|
};
|
|
3139
|
-
}, [s, e.refreshInterval,
|
|
3140
|
-
const
|
|
3179
|
+
}, [s, e.refreshInterval, p]);
|
|
3180
|
+
const D = {
|
|
3141
3181
|
client: s,
|
|
3142
3182
|
config: e,
|
|
3143
|
-
theme:
|
|
3144
|
-
torrents:
|
|
3145
|
-
selectedTorrent:
|
|
3183
|
+
theme: n,
|
|
3184
|
+
torrents: o,
|
|
3185
|
+
selectedTorrent: i,
|
|
3146
3186
|
setSelectedTorrent: d,
|
|
3147
3187
|
filter: c,
|
|
3148
3188
|
setFilter: g,
|
|
3149
3189
|
searchQuery: u,
|
|
3150
|
-
setSearchQuery:
|
|
3151
|
-
refresh:
|
|
3190
|
+
setSearchQuery: h,
|
|
3191
|
+
refresh: p
|
|
3152
3192
|
};
|
|
3153
|
-
return /* @__PURE__ */
|
|
3193
|
+
return /* @__PURE__ */ a(J.Provider, { value: D, children: /* @__PURE__ */ a("div", { style: { fontFamily: n.fontFamily, color: n.colors.text }, children: t }) });
|
|
3154
3194
|
}
|
|
3155
|
-
function
|
|
3195
|
+
function Fe({
|
|
3156
3196
|
progress: s,
|
|
3157
3197
|
status: e,
|
|
3158
3198
|
showLabel: t = !0,
|
|
3159
|
-
height:
|
|
3160
|
-
className:
|
|
3161
|
-
style:
|
|
3199
|
+
height: n = "20px",
|
|
3200
|
+
className: o,
|
|
3201
|
+
style: r
|
|
3162
3202
|
}) {
|
|
3163
|
-
const { theme:
|
|
3164
|
-
return /* @__PURE__ */
|
|
3203
|
+
const { theme: i } = M(), d = Math.min(100, Math.max(0, s * 100)), c = ee(e, i);
|
|
3204
|
+
return /* @__PURE__ */ l(
|
|
3165
3205
|
"div",
|
|
3166
3206
|
{
|
|
3167
|
-
className:
|
|
3207
|
+
className: o,
|
|
3168
3208
|
style: {
|
|
3169
3209
|
display: "flex",
|
|
3170
3210
|
alignItems: "center",
|
|
3171
|
-
gap:
|
|
3172
|
-
...
|
|
3211
|
+
gap: i.spacing.sm,
|
|
3212
|
+
...r
|
|
3173
3213
|
},
|
|
3174
3214
|
children: [
|
|
3175
|
-
/* @__PURE__ */
|
|
3215
|
+
/* @__PURE__ */ a(
|
|
3176
3216
|
"div",
|
|
3177
3217
|
{
|
|
3178
3218
|
style: {
|
|
3179
3219
|
flex: 1,
|
|
3180
|
-
height:
|
|
3181
|
-
backgroundColor:
|
|
3182
|
-
borderRadius:
|
|
3220
|
+
height: n,
|
|
3221
|
+
backgroundColor: i.colors.border,
|
|
3222
|
+
borderRadius: i.borderRadius,
|
|
3183
3223
|
overflow: "hidden"
|
|
3184
3224
|
},
|
|
3185
|
-
children: /* @__PURE__ */
|
|
3225
|
+
children: /* @__PURE__ */ a(
|
|
3186
3226
|
"div",
|
|
3187
3227
|
{
|
|
3188
3228
|
style: {
|
|
@@ -3195,7 +3235,7 @@ function Ae({
|
|
|
3195
3235
|
)
|
|
3196
3236
|
}
|
|
3197
3237
|
),
|
|
3198
|
-
t && /* @__PURE__ */
|
|
3238
|
+
t && /* @__PURE__ */ l("span", { style: { fontSize: "12px", minWidth: "45px", textAlign: "right" }, children: [
|
|
3199
3239
|
d.toFixed(1),
|
|
3200
3240
|
"%"
|
|
3201
3241
|
] })
|
|
@@ -3203,165 +3243,168 @@ function Ae({
|
|
|
3203
3243
|
}
|
|
3204
3244
|
);
|
|
3205
3245
|
}
|
|
3206
|
-
function
|
|
3207
|
-
const { theme:
|
|
3208
|
-
downloading: "Downloading",
|
|
3209
|
-
seeding: "Seeding",
|
|
3210
|
-
paused: "Paused",
|
|
3211
|
-
checking: "Checking",
|
|
3212
|
-
error: "Error",
|
|
3213
|
-
queued: "Queued"
|
|
3246
|
+
function Re({ status: s, className: e, style: t }) {
|
|
3247
|
+
const { t: n } = w(), { theme: o } = M(), r = ee(s, o), i = {
|
|
3248
|
+
downloading: n("torrentUI.downloading", "Downloading"),
|
|
3249
|
+
seeding: n("torrentUI.seeding", "Seeding"),
|
|
3250
|
+
paused: n("torrentUI.paused", "Paused"),
|
|
3251
|
+
checking: n("torrentUI.checking", "Checking"),
|
|
3252
|
+
error: n("torrentUI.error", "Error"),
|
|
3253
|
+
queued: n("torrentUI.queued", "Queued")
|
|
3214
3254
|
};
|
|
3215
|
-
return /* @__PURE__ */
|
|
3255
|
+
return /* @__PURE__ */ l(
|
|
3216
3256
|
"span",
|
|
3217
3257
|
{
|
|
3218
3258
|
className: e,
|
|
3219
3259
|
style: {
|
|
3220
3260
|
display: "inline-flex",
|
|
3221
3261
|
alignItems: "center",
|
|
3222
|
-
gap:
|
|
3223
|
-
padding: `${
|
|
3224
|
-
backgroundColor: `${
|
|
3225
|
-
color:
|
|
3226
|
-
borderRadius:
|
|
3262
|
+
gap: o.spacing.xs,
|
|
3263
|
+
padding: `${o.spacing.xs} ${o.spacing.sm}`,
|
|
3264
|
+
backgroundColor: `${r}20`,
|
|
3265
|
+
color: r,
|
|
3266
|
+
borderRadius: o.borderRadius,
|
|
3227
3267
|
fontSize: "12px",
|
|
3228
3268
|
fontWeight: 500,
|
|
3229
3269
|
textTransform: "capitalize",
|
|
3230
3270
|
...t
|
|
3231
3271
|
},
|
|
3232
3272
|
children: [
|
|
3233
|
-
/* @__PURE__ */
|
|
3273
|
+
/* @__PURE__ */ a(
|
|
3234
3274
|
"span",
|
|
3235
3275
|
{
|
|
3236
3276
|
style: {
|
|
3237
3277
|
width: "8px",
|
|
3238
3278
|
height: "8px",
|
|
3239
3279
|
borderRadius: "50%",
|
|
3240
|
-
backgroundColor:
|
|
3280
|
+
backgroundColor: r
|
|
3241
3281
|
}
|
|
3242
3282
|
}
|
|
3243
3283
|
),
|
|
3244
|
-
|
|
3284
|
+
i[s]
|
|
3245
3285
|
]
|
|
3246
3286
|
}
|
|
3247
3287
|
);
|
|
3248
3288
|
}
|
|
3249
|
-
function
|
|
3289
|
+
function Pe({
|
|
3250
3290
|
onTorrentSelect: s,
|
|
3251
3291
|
onTorrentDoubleClick: e,
|
|
3252
3292
|
className: t,
|
|
3253
|
-
style:
|
|
3293
|
+
style: n
|
|
3254
3294
|
}) {
|
|
3255
|
-
const { theme:
|
|
3256
|
-
if (
|
|
3257
|
-
if (
|
|
3295
|
+
const { t: o } = w(), { theme: r, torrents: i, filter: d, searchQuery: c, selectedTorrent: g, setSelectedTorrent: u, config: h } = M(), [p, D] = T(h.defaultSortBy || "name"), [m, b] = T(h.defaultSortOrder || "asc"), C = h.columns || G, U = W(() => i.filter((x) => {
|
|
3296
|
+
if (d !== "all") {
|
|
3297
|
+
if (d === "completed") {
|
|
3258
3298
|
if (x.stats.progress < 1)
|
|
3259
3299
|
return !1;
|
|
3260
|
-
} else if (
|
|
3300
|
+
} else if (d === "active") {
|
|
3261
3301
|
if (x.status !== "downloading" && x.status !== "seeding")
|
|
3262
3302
|
return !1;
|
|
3263
|
-
} else if (x.status !==
|
|
3303
|
+
} else if (x.status !== d)
|
|
3264
3304
|
return !1;
|
|
3265
3305
|
}
|
|
3266
|
-
if (
|
|
3267
|
-
const
|
|
3268
|
-
if (!x.metadata.name.toLowerCase().includes(
|
|
3306
|
+
if (c) {
|
|
3307
|
+
const B = c.toLowerCase();
|
|
3308
|
+
if (!x.metadata.name.toLowerCase().includes(B))
|
|
3269
3309
|
return !1;
|
|
3270
3310
|
}
|
|
3271
3311
|
return !0;
|
|
3272
|
-
}), [
|
|
3273
|
-
let
|
|
3312
|
+
}), [i, d, c]), I = W(() => [...U].sort((x, B) => {
|
|
3313
|
+
let F, R;
|
|
3274
3314
|
switch (p) {
|
|
3275
3315
|
case "name":
|
|
3276
|
-
|
|
3316
|
+
F = x.metadata.name.toLowerCase(), R = B.metadata.name.toLowerCase();
|
|
3277
3317
|
break;
|
|
3278
3318
|
case "size":
|
|
3279
|
-
|
|
3319
|
+
F = x.metadata.size, R = B.metadata.size;
|
|
3280
3320
|
break;
|
|
3281
3321
|
case "progress":
|
|
3282
|
-
|
|
3322
|
+
F = x.stats.progress, R = B.stats.progress;
|
|
3283
3323
|
break;
|
|
3284
3324
|
case "status":
|
|
3285
|
-
|
|
3325
|
+
F = x.status, R = B.status;
|
|
3286
3326
|
break;
|
|
3287
3327
|
case "downloadSpeed":
|
|
3288
|
-
|
|
3328
|
+
F = x.stats.downloadSpeed, R = B.stats.downloadSpeed;
|
|
3289
3329
|
break;
|
|
3290
3330
|
case "uploadSpeed":
|
|
3291
|
-
|
|
3331
|
+
F = x.stats.uploadSpeed, R = B.stats.uploadSpeed;
|
|
3292
3332
|
break;
|
|
3293
3333
|
case "ratio":
|
|
3294
|
-
|
|
3334
|
+
F = x.stats.ratio, R = B.stats.ratio;
|
|
3295
3335
|
break;
|
|
3296
3336
|
default:
|
|
3297
|
-
|
|
3337
|
+
F = x.metadata.name, R = B.metadata.name;
|
|
3298
3338
|
}
|
|
3299
|
-
return
|
|
3300
|
-
}), [
|
|
3301
|
-
p === x ? b(
|
|
3302
|
-
},
|
|
3303
|
-
|
|
3339
|
+
return F < R ? m === "asc" ? -1 : 1 : F > R ? m === "asc" ? 1 : -1 : 0;
|
|
3340
|
+
}), [U, p, m]), z = (x) => {
|
|
3341
|
+
p === x ? b(m === "asc" ? "desc" : "asc") : (D(x), b("asc"));
|
|
3342
|
+
}, te = (x) => {
|
|
3343
|
+
u(x), s == null || s(x);
|
|
3304
3344
|
};
|
|
3305
|
-
return /* @__PURE__ */
|
|
3345
|
+
return /* @__PURE__ */ l(
|
|
3306
3346
|
"div",
|
|
3307
3347
|
{
|
|
3308
3348
|
className: t,
|
|
3309
3349
|
style: {
|
|
3310
|
-
backgroundColor:
|
|
3311
|
-
borderRadius:
|
|
3350
|
+
backgroundColor: r.colors.surface,
|
|
3351
|
+
borderRadius: r.borderRadius,
|
|
3312
3352
|
overflow: "hidden",
|
|
3313
|
-
...
|
|
3353
|
+
...n
|
|
3314
3354
|
},
|
|
3315
3355
|
children: [
|
|
3316
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ a(
|
|
3317
3357
|
"div",
|
|
3318
3358
|
{
|
|
3319
3359
|
style: {
|
|
3320
3360
|
display: "grid",
|
|
3321
|
-
gridTemplateColumns:
|
|
3322
|
-
padding: `${
|
|
3323
|
-
backgroundColor:
|
|
3324
|
-
borderBottom: `1px solid ${
|
|
3361
|
+
gridTemplateColumns: C.filter((x) => x.visible !== !1).map((x) => x.width || "1fr").join(" "),
|
|
3362
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3363
|
+
backgroundColor: r.colors.primary,
|
|
3364
|
+
borderBottom: `1px solid ${r.colors.border}`,
|
|
3325
3365
|
fontSize: "12px",
|
|
3326
3366
|
fontWeight: 600,
|
|
3327
3367
|
textTransform: "uppercase"
|
|
3328
3368
|
},
|
|
3329
|
-
children:
|
|
3369
|
+
children: C.filter((x) => x.visible !== !1).map((x) => /* @__PURE__ */ l(
|
|
3330
3370
|
"div",
|
|
3331
3371
|
{
|
|
3332
|
-
|
|
3372
|
+
role: x.sortable ? "button" : void 0,
|
|
3373
|
+
tabIndex: x.sortable ? 0 : void 0,
|
|
3374
|
+
onKeyDown: x.sortable ? A : void 0,
|
|
3375
|
+
onClick: () => x.sortable && z(x.id),
|
|
3333
3376
|
style: {
|
|
3334
3377
|
cursor: x.sortable ? "pointer" : "default",
|
|
3335
3378
|
display: "flex",
|
|
3336
3379
|
alignItems: "center",
|
|
3337
|
-
gap:
|
|
3380
|
+
gap: r.spacing.xs
|
|
3338
3381
|
},
|
|
3339
3382
|
children: [
|
|
3340
|
-
x.label,
|
|
3341
|
-
p === x.id && (
|
|
3383
|
+
G.includes(x) ? o(`torrentUI.column.${x.id}`, x.label) : x.label,
|
|
3384
|
+
p === x.id && (m === "asc" ? /* @__PURE__ */ a(j, { size: 12 }) : /* @__PURE__ */ a(E, { size: 12 }))
|
|
3342
3385
|
]
|
|
3343
3386
|
},
|
|
3344
3387
|
x.id
|
|
3345
3388
|
))
|
|
3346
3389
|
}
|
|
3347
3390
|
),
|
|
3348
|
-
/* @__PURE__ */
|
|
3391
|
+
/* @__PURE__ */ a("div", { style: { maxHeight: "500px", overflowY: "auto" }, children: I.length === 0 ? /* @__PURE__ */ a(
|
|
3349
3392
|
"div",
|
|
3350
3393
|
{
|
|
3351
3394
|
style: {
|
|
3352
|
-
padding:
|
|
3395
|
+
padding: r.spacing.xl,
|
|
3353
3396
|
textAlign: "center",
|
|
3354
|
-
color:
|
|
3397
|
+
color: r.colors.textSecondary
|
|
3355
3398
|
},
|
|
3356
|
-
children: "No torrents found"
|
|
3399
|
+
children: o("torrentUI.noTorrentsFound", "No torrents found")
|
|
3357
3400
|
}
|
|
3358
|
-
) :
|
|
3359
|
-
|
|
3401
|
+
) : I.map((x) => /* @__PURE__ */ a(
|
|
3402
|
+
Ue,
|
|
3360
3403
|
{
|
|
3361
3404
|
torrent: x,
|
|
3362
|
-
columns:
|
|
3363
|
-
isSelected:
|
|
3364
|
-
onClick: () =>
|
|
3405
|
+
columns: C,
|
|
3406
|
+
isSelected: g === x.metadata.infoHash,
|
|
3407
|
+
onClick: () => te(x.metadata.infoHash),
|
|
3365
3408
|
onDoubleClick: () => e == null ? void 0 : e(x.metadata.infoHash)
|
|
3366
3409
|
},
|
|
3367
3410
|
x.metadata.infoHash
|
|
@@ -3370,61 +3413,64 @@ function Be({
|
|
|
3370
3413
|
}
|
|
3371
3414
|
);
|
|
3372
3415
|
}
|
|
3373
|
-
function
|
|
3416
|
+
function Ue({
|
|
3374
3417
|
torrent: s,
|
|
3375
3418
|
columns: e,
|
|
3376
3419
|
isSelected: t,
|
|
3377
|
-
onClick:
|
|
3378
|
-
onDoubleClick:
|
|
3420
|
+
onClick: n,
|
|
3421
|
+
onDoubleClick: o
|
|
3379
3422
|
}) {
|
|
3380
|
-
const { theme:
|
|
3423
|
+
const { theme: r } = M(), { metadata: i, stats: d, status: c } = s, g = (u) => {
|
|
3381
3424
|
switch (u) {
|
|
3382
3425
|
case "name":
|
|
3383
|
-
return /* @__PURE__ */
|
|
3384
|
-
/* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3386
|
-
|
|
3426
|
+
return /* @__PURE__ */ l("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
3427
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 500 }, children: i.name }),
|
|
3428
|
+
/* @__PURE__ */ l("span", { style: { fontSize: "11px", color: r.colors.textSecondary }, children: [
|
|
3429
|
+
i.infoHash.substring(0, 8),
|
|
3387
3430
|
"..."
|
|
3388
3431
|
] })
|
|
3389
3432
|
] });
|
|
3390
3433
|
case "size":
|
|
3391
|
-
return
|
|
3434
|
+
return P(i.size);
|
|
3392
3435
|
case "progress":
|
|
3393
|
-
return /* @__PURE__ */
|
|
3436
|
+
return /* @__PURE__ */ a(Fe, { progress: d.progress, status: c, height: "16px" });
|
|
3394
3437
|
case "status":
|
|
3395
|
-
return /* @__PURE__ */
|
|
3438
|
+
return /* @__PURE__ */ a(Re, { status: c });
|
|
3396
3439
|
case "seeds":
|
|
3397
3440
|
return d.seeds;
|
|
3398
3441
|
case "peers":
|
|
3399
3442
|
return d.peers;
|
|
3400
3443
|
case "downloadSpeed":
|
|
3401
|
-
return d.downloadSpeed > 0 ?
|
|
3444
|
+
return d.downloadSpeed > 0 ? $(d.downloadSpeed) : "-";
|
|
3402
3445
|
case "uploadSpeed":
|
|
3403
|
-
return d.uploadSpeed > 0 ?
|
|
3446
|
+
return d.uploadSpeed > 0 ? $(d.uploadSpeed) : "-";
|
|
3404
3447
|
case "eta":
|
|
3405
|
-
return c === "downloading" ?
|
|
3448
|
+
return c === "downloading" ? Me(d.eta) : "-";
|
|
3406
3449
|
case "ratio":
|
|
3407
|
-
return
|
|
3450
|
+
return Z(d.ratio);
|
|
3408
3451
|
default:
|
|
3409
3452
|
return "-";
|
|
3410
3453
|
}
|
|
3411
3454
|
};
|
|
3412
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ a(
|
|
3413
3456
|
"div",
|
|
3414
3457
|
{
|
|
3415
|
-
|
|
3416
|
-
|
|
3458
|
+
role: "button",
|
|
3459
|
+
tabIndex: 0,
|
|
3460
|
+
onKeyDown: A,
|
|
3461
|
+
onClick: n,
|
|
3462
|
+
onDoubleClick: o,
|
|
3417
3463
|
style: {
|
|
3418
3464
|
display: "grid",
|
|
3419
3465
|
gridTemplateColumns: e.filter((u) => u.visible !== !1).map((u) => u.width || "1fr").join(" "),
|
|
3420
|
-
padding: `${
|
|
3421
|
-
backgroundColor: t ?
|
|
3422
|
-
borderBottom: `1px solid ${
|
|
3466
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3467
|
+
backgroundColor: t ? r.colors.primary : "transparent",
|
|
3468
|
+
borderBottom: `1px solid ${r.colors.border}`,
|
|
3423
3469
|
cursor: "pointer",
|
|
3424
3470
|
transition: "background-color 0.15s",
|
|
3425
3471
|
fontSize: "13px"
|
|
3426
3472
|
},
|
|
3427
|
-
children: e.filter((u) => u.visible !== !1).map((u) => /* @__PURE__ */
|
|
3473
|
+
children: e.filter((u) => u.visible !== !1).map((u) => /* @__PURE__ */ a(
|
|
3428
3474
|
"div",
|
|
3429
3475
|
{
|
|
3430
3476
|
style: {
|
|
@@ -3441,10 +3487,10 @@ function Me({
|
|
|
3441
3487
|
}
|
|
3442
3488
|
);
|
|
3443
3489
|
}
|
|
3444
|
-
function
|
|
3445
|
-
const { theme:
|
|
3446
|
-
const
|
|
3447
|
-
all:
|
|
3490
|
+
function ze({ className: s, style: e }) {
|
|
3491
|
+
const { t } = w(), { theme: n, filter: o, setFilter: r, searchQuery: i, setSearchQuery: d, torrents: c } = M(), g = W(() => {
|
|
3492
|
+
const h = {
|
|
3493
|
+
all: c.length,
|
|
3448
3494
|
downloading: 0,
|
|
3449
3495
|
seeding: 0,
|
|
3450
3496
|
paused: 0,
|
|
@@ -3453,70 +3499,69 @@ function Re({ className: s, style: e }) {
|
|
|
3453
3499
|
completed: 0,
|
|
3454
3500
|
active: 0
|
|
3455
3501
|
};
|
|
3456
|
-
for (const p of
|
|
3457
|
-
p.status === "downloading" &&
|
|
3458
|
-
return
|
|
3459
|
-
}, [
|
|
3460
|
-
{ id: "all", label: "All" },
|
|
3461
|
-
{ id: "downloading", label: "Downloading" },
|
|
3462
|
-
{ id: "seeding", label: "Seeding" },
|
|
3463
|
-
{ id: "completed", label: "Completed" },
|
|
3464
|
-
{ id: "active", label: "Active" },
|
|
3465
|
-
{ id: "paused", label: "Paused" },
|
|
3466
|
-
{ id: "error", label: "Error" }
|
|
3502
|
+
for (const p of c)
|
|
3503
|
+
p.status === "downloading" && h.downloading++, p.status === "seeding" && h.seeding++, p.status === "paused" && h.paused++, p.status === "checking" && h.checking++, p.status === "error" && h.error++, p.stats.progress >= 1 && h.completed++, (p.status === "downloading" || p.status === "seeding") && h.active++;
|
|
3504
|
+
return h;
|
|
3505
|
+
}, [c]), u = [
|
|
3506
|
+
{ id: "all", label: t("torrentUI.all", "All") },
|
|
3507
|
+
{ id: "downloading", label: t("torrentUI.downloading", "Downloading") },
|
|
3508
|
+
{ id: "seeding", label: t("torrentUI.seeding", "Seeding") },
|
|
3509
|
+
{ id: "completed", label: t("torrentUI.completed", "Completed") },
|
|
3510
|
+
{ id: "active", label: t("torrentUI.active", "Active") },
|
|
3511
|
+
{ id: "paused", label: t("torrentUI.paused", "Paused") },
|
|
3512
|
+
{ id: "error", label: t("torrentUI.error", "Error") }
|
|
3467
3513
|
];
|
|
3468
|
-
return /* @__PURE__ */
|
|
3514
|
+
return /* @__PURE__ */ l(
|
|
3469
3515
|
"div",
|
|
3470
3516
|
{
|
|
3471
3517
|
className: s,
|
|
3472
3518
|
style: {
|
|
3473
3519
|
display: "flex",
|
|
3474
3520
|
alignItems: "center",
|
|
3475
|
-
gap:
|
|
3476
|
-
padding:
|
|
3477
|
-
backgroundColor:
|
|
3478
|
-
borderRadius:
|
|
3521
|
+
gap: n.spacing.md,
|
|
3522
|
+
padding: n.spacing.md,
|
|
3523
|
+
backgroundColor: n.colors.surface,
|
|
3524
|
+
borderRadius: n.borderRadius,
|
|
3479
3525
|
...e
|
|
3480
3526
|
},
|
|
3481
3527
|
children: [
|
|
3482
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: n.spacing.xs }, children: u.map((h) => /* @__PURE__ */ l(
|
|
3483
3529
|
"button",
|
|
3484
3530
|
{
|
|
3485
|
-
onClick: () =>
|
|
3531
|
+
onClick: () => r(h.id),
|
|
3486
3532
|
style: {
|
|
3487
|
-
padding: `${
|
|
3488
|
-
backgroundColor:
|
|
3489
|
-
color:
|
|
3533
|
+
padding: `${n.spacing.xs} ${n.spacing.sm}`,
|
|
3534
|
+
backgroundColor: o === h.id ? n.colors.primary : "transparent",
|
|
3535
|
+
color: o === h.id ? n.colors.text : n.colors.textSecondary,
|
|
3490
3536
|
border: "none",
|
|
3491
|
-
borderRadius:
|
|
3537
|
+
borderRadius: n.borderRadius,
|
|
3492
3538
|
cursor: "pointer",
|
|
3493
3539
|
fontSize: "13px",
|
|
3494
3540
|
transition: "all 0.15s"
|
|
3495
3541
|
},
|
|
3496
3542
|
children: [
|
|
3497
|
-
|
|
3543
|
+
h.label,
|
|
3498
3544
|
" (",
|
|
3499
|
-
|
|
3545
|
+
g[h.id],
|
|
3500
3546
|
")"
|
|
3501
3547
|
]
|
|
3502
3548
|
},
|
|
3503
|
-
|
|
3549
|
+
h.id
|
|
3504
3550
|
)) }),
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 } }),
|
|
3552
|
+
/* @__PURE__ */ a(
|
|
3507
3553
|
"input",
|
|
3508
3554
|
{
|
|
3509
3555
|
type: "text",
|
|
3510
|
-
placeholder: "Search torrents...",
|
|
3511
|
-
value:
|
|
3512
|
-
onChange: (
|
|
3556
|
+
placeholder: t("torrentUI.searchTorrents", "Search torrents..."),
|
|
3557
|
+
value: i,
|
|
3558
|
+
onChange: (h) => d(h.target.value),
|
|
3513
3559
|
style: {
|
|
3514
|
-
padding: `${
|
|
3515
|
-
backgroundColor:
|
|
3516
|
-
color:
|
|
3517
|
-
border: `1px solid ${
|
|
3518
|
-
borderRadius:
|
|
3519
|
-
outline: "none",
|
|
3560
|
+
padding: `${n.spacing.sm} ${n.spacing.md}`,
|
|
3561
|
+
backgroundColor: n.colors.background,
|
|
3562
|
+
color: n.colors.text,
|
|
3563
|
+
border: `1px solid ${n.colors.border}`,
|
|
3564
|
+
borderRadius: n.borderRadius,
|
|
3520
3565
|
fontSize: "13px",
|
|
3521
3566
|
width: "250px"
|
|
3522
3567
|
}
|
|
@@ -3526,46 +3571,58 @@ function Re({ className: s, style: e }) {
|
|
|
3526
3571
|
}
|
|
3527
3572
|
);
|
|
3528
3573
|
}
|
|
3529
|
-
function
|
|
3574
|
+
function We({
|
|
3530
3575
|
infoHash: s,
|
|
3531
3576
|
className: e,
|
|
3532
3577
|
style: t
|
|
3533
3578
|
}) {
|
|
3534
|
-
const { theme:
|
|
3535
|
-
if (!
|
|
3579
|
+
const { t: n } = w(), { theme: o, client: r } = M(), [i, d] = T("files"), c = r == null ? void 0 : r.getTorrent(s);
|
|
3580
|
+
if (!c)
|
|
3536
3581
|
return null;
|
|
3537
|
-
const { metadata:
|
|
3538
|
-
{
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3582
|
+
const { metadata: g, stats: u, files: h, peers: p, trackers: D } = c, m = [
|
|
3583
|
+
{
|
|
3584
|
+
id: "files",
|
|
3585
|
+
label: n("torrentUI.files", "Files ({files})").replace("{files}", String(h.length))
|
|
3586
|
+
},
|
|
3587
|
+
{
|
|
3588
|
+
id: "peers",
|
|
3589
|
+
label: n("torrentUI.peers", "Peers ({peers})").replace("{peers}", String(p.length))
|
|
3590
|
+
},
|
|
3591
|
+
{
|
|
3592
|
+
id: "trackers",
|
|
3593
|
+
label: n("torrentUI.trackers", "Trackers ({trackers})").replace(
|
|
3594
|
+
"{trackers}",
|
|
3595
|
+
String(D.length)
|
|
3596
|
+
)
|
|
3597
|
+
},
|
|
3598
|
+
{ id: "info", label: n("torrentUI.info", "Info") }
|
|
3542
3599
|
];
|
|
3543
|
-
return /* @__PURE__ */
|
|
3600
|
+
return /* @__PURE__ */ l(
|
|
3544
3601
|
"div",
|
|
3545
3602
|
{
|
|
3546
3603
|
className: e,
|
|
3547
3604
|
style: {
|
|
3548
|
-
backgroundColor:
|
|
3549
|
-
borderRadius:
|
|
3605
|
+
backgroundColor: o.colors.surface,
|
|
3606
|
+
borderRadius: o.borderRadius,
|
|
3550
3607
|
overflow: "hidden",
|
|
3551
3608
|
...t
|
|
3552
3609
|
},
|
|
3553
3610
|
children: [
|
|
3554
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ a(
|
|
3555
3612
|
"div",
|
|
3556
3613
|
{
|
|
3557
3614
|
style: {
|
|
3558
3615
|
display: "flex",
|
|
3559
|
-
borderBottom: `1px solid ${
|
|
3616
|
+
borderBottom: `1px solid ${o.colors.border}`
|
|
3560
3617
|
},
|
|
3561
|
-
children:
|
|
3618
|
+
children: m.map((b) => /* @__PURE__ */ a(
|
|
3562
3619
|
"button",
|
|
3563
3620
|
{
|
|
3564
|
-
onClick: () =>
|
|
3621
|
+
onClick: () => d(b.id),
|
|
3565
3622
|
style: {
|
|
3566
|
-
padding: `${
|
|
3567
|
-
backgroundColor:
|
|
3568
|
-
color:
|
|
3623
|
+
padding: `${o.spacing.sm} ${o.spacing.md}`,
|
|
3624
|
+
backgroundColor: i === b.id ? o.colors.primary : "transparent",
|
|
3625
|
+
color: i === b.id ? o.colors.text : o.colors.textSecondary,
|
|
3569
3626
|
border: "none",
|
|
3570
3627
|
cursor: "pointer",
|
|
3571
3628
|
fontSize: "13px",
|
|
@@ -3577,19 +3634,19 @@ function Pe({
|
|
|
3577
3634
|
))
|
|
3578
3635
|
}
|
|
3579
3636
|
),
|
|
3580
|
-
/* @__PURE__ */
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3637
|
+
/* @__PURE__ */ l("div", { style: { padding: o.spacing.md, maxHeight: "300px", overflowY: "auto" }, children: [
|
|
3638
|
+
i === "files" && /* @__PURE__ */ a(Le, { files: h }),
|
|
3639
|
+
i === "peers" && /* @__PURE__ */ a(Ne, { peers: p }),
|
|
3640
|
+
i === "trackers" && /* @__PURE__ */ a(He, { trackers: D }),
|
|
3641
|
+
i === "info" && /* @__PURE__ */ a($e, { metadata: g, stats: u, addedAt: c.addedAt })
|
|
3585
3642
|
] })
|
|
3586
3643
|
]
|
|
3587
3644
|
}
|
|
3588
3645
|
);
|
|
3589
3646
|
}
|
|
3590
|
-
function
|
|
3591
|
-
const { theme: e } =
|
|
3592
|
-
return /* @__PURE__ */
|
|
3647
|
+
function Le({ files: s }) {
|
|
3648
|
+
const { theme: e } = M();
|
|
3649
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children: s.map((t, n) => /* @__PURE__ */ l(
|
|
3593
3650
|
"div",
|
|
3594
3651
|
{
|
|
3595
3652
|
style: {
|
|
@@ -3602,62 +3659,62 @@ function ze({ files: s }) {
|
|
|
3602
3659
|
fontSize: "13px"
|
|
3603
3660
|
},
|
|
3604
3661
|
children: [
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3607
|
-
/* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ a("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: t.path }),
|
|
3663
|
+
/* @__PURE__ */ a("span", { style: { color: e.colors.textSecondary }, children: P(t.size) }),
|
|
3664
|
+
/* @__PURE__ */ l("span", { style: { width: "50px", textAlign: "right" }, children: [
|
|
3608
3665
|
(t.progress * 100).toFixed(0),
|
|
3609
3666
|
"%"
|
|
3610
3667
|
] })
|
|
3611
3668
|
]
|
|
3612
3669
|
},
|
|
3613
|
-
|
|
3670
|
+
n
|
|
3614
3671
|
)) });
|
|
3615
3672
|
}
|
|
3616
|
-
function
|
|
3617
|
-
const {
|
|
3618
|
-
return /* @__PURE__ */
|
|
3673
|
+
function Ne({ peers: s }) {
|
|
3674
|
+
const { t: e } = w(), { theme: t } = M();
|
|
3675
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: t.spacing.xs }, children: s.length === 0 ? /* @__PURE__ */ a("div", { style: { color: t.colors.textSecondary }, children: e("torrentUI.noPeersConnected", "No peers connected") }) : s.map((n) => /* @__PURE__ */ l(
|
|
3619
3676
|
"div",
|
|
3620
3677
|
{
|
|
3621
3678
|
style: {
|
|
3622
3679
|
display: "grid",
|
|
3623
3680
|
gridTemplateColumns: "1fr 80px 100px 100px 80px",
|
|
3624
3681
|
alignItems: "center",
|
|
3625
|
-
padding:
|
|
3626
|
-
backgroundColor:
|
|
3627
|
-
borderRadius:
|
|
3682
|
+
padding: t.spacing.sm,
|
|
3683
|
+
backgroundColor: t.colors.background,
|
|
3684
|
+
borderRadius: t.borderRadius,
|
|
3628
3685
|
fontSize: "12px"
|
|
3629
3686
|
},
|
|
3630
3687
|
children: [
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
|
|
3688
|
+
/* @__PURE__ */ l("span", { children: [
|
|
3689
|
+
n.ip,
|
|
3633
3690
|
":",
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3691
|
+
n.port,
|
|
3692
|
+
n.isUTP && /* @__PURE__ */ a("span", { style: { marginLeft: "4px", color: t.colors.secondary }, children: e("torrentUI.tp", "µTP") }),
|
|
3693
|
+
n.isEncrypted && /* @__PURE__ */ a("span", { style: { marginLeft: "4px", color: t.colors.secondary }, children: e("torrentUI.enc", "enc") })
|
|
3637
3694
|
] }),
|
|
3638
|
-
/* @__PURE__ */
|
|
3639
|
-
/* @__PURE__ */
|
|
3640
|
-
/* @__PURE__ */
|
|
3695
|
+
/* @__PURE__ */ a("span", { style: { color: t.colors.textSecondary }, children: n.client || e("torrentUI.unknown", "Unknown") }),
|
|
3696
|
+
/* @__PURE__ */ l("span", { style: { color: t.colors.success }, children: [
|
|
3697
|
+
/* @__PURE__ */ a(oe, { size: 12, style: { verticalAlign: "-1px" } }),
|
|
3641
3698
|
" ",
|
|
3642
|
-
|
|
3699
|
+
$(n.downloadSpeed)
|
|
3643
3700
|
] }),
|
|
3644
|
-
/* @__PURE__ */
|
|
3645
|
-
/* @__PURE__ */
|
|
3701
|
+
/* @__PURE__ */ l("span", { style: { color: t.colors.warning }, children: [
|
|
3702
|
+
/* @__PURE__ */ a(ie, { size: 12, style: { verticalAlign: "-1px" } }),
|
|
3646
3703
|
" ",
|
|
3647
|
-
|
|
3704
|
+
$(n.uploadSpeed)
|
|
3648
3705
|
] }),
|
|
3649
|
-
/* @__PURE__ */
|
|
3650
|
-
(
|
|
3706
|
+
/* @__PURE__ */ l("span", { children: [
|
|
3707
|
+
(n.progress * 100).toFixed(0),
|
|
3651
3708
|
"%"
|
|
3652
3709
|
] })
|
|
3653
3710
|
]
|
|
3654
3711
|
},
|
|
3655
|
-
|
|
3712
|
+
n.id
|
|
3656
3713
|
)) });
|
|
3657
3714
|
}
|
|
3658
|
-
function
|
|
3659
|
-
const { theme: e } =
|
|
3660
|
-
return /* @__PURE__ */
|
|
3715
|
+
function He({ trackers: s }) {
|
|
3716
|
+
const { theme: e } = M();
|
|
3717
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children: s.map((t, n) => /* @__PURE__ */ l(
|
|
3661
3718
|
"div",
|
|
3662
3719
|
{
|
|
3663
3720
|
style: {
|
|
@@ -3670,7 +3727,7 @@ function Fe({ trackers: s }) {
|
|
|
3670
3727
|
fontSize: "12px"
|
|
3671
3728
|
},
|
|
3672
3729
|
children: [
|
|
3673
|
-
/* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ a(
|
|
3674
3731
|
"span",
|
|
3675
3732
|
{
|
|
3676
3733
|
style: {
|
|
@@ -3681,8 +3738,8 @@ function Fe({ trackers: s }) {
|
|
|
3681
3738
|
}
|
|
3682
3739
|
}
|
|
3683
3740
|
),
|
|
3684
|
-
/* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3741
|
+
/* @__PURE__ */ a("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: t.url }),
|
|
3742
|
+
/* @__PURE__ */ l("span", { style: { color: e.colors.textSecondary }, children: [
|
|
3686
3743
|
"S: ",
|
|
3687
3744
|
t.seeds,
|
|
3688
3745
|
" | L: ",
|
|
@@ -3690,62 +3747,66 @@ function Fe({ trackers: s }) {
|
|
|
3690
3747
|
] })
|
|
3691
3748
|
]
|
|
3692
3749
|
},
|
|
3693
|
-
|
|
3750
|
+
n
|
|
3694
3751
|
)) });
|
|
3695
3752
|
}
|
|
3696
|
-
function
|
|
3753
|
+
function $e({
|
|
3697
3754
|
metadata: s,
|
|
3698
3755
|
stats: e,
|
|
3699
3756
|
addedAt: t
|
|
3700
3757
|
}) {
|
|
3701
|
-
const { theme:
|
|
3702
|
-
{ label: "Name", value: s.name },
|
|
3703
|
-
{ label: "Info Hash", value: s.infoHash },
|
|
3704
|
-
{ label: "Size", value:
|
|
3705
|
-
{
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
{ label: "
|
|
3710
|
-
{ label: "
|
|
3711
|
-
{ label: "
|
|
3712
|
-
{ label: "
|
|
3713
|
-
{ label: "
|
|
3714
|
-
{ label: "
|
|
3758
|
+
const { t: n } = w(), { theme: o } = M(), r = [
|
|
3759
|
+
{ label: n("torrentUI.name", "Name"), value: s.name },
|
|
3760
|
+
{ label: n("torrentUI.infoHash", "Info Hash"), value: s.infoHash },
|
|
3761
|
+
{ label: n("torrentUI.size", "Size"), value: P(s.size) },
|
|
3762
|
+
{
|
|
3763
|
+
label: n("torrentUI.pieces", "Pieces"),
|
|
3764
|
+
value: `${e.piecesComplete} / ${e.piecesTotal}`
|
|
3765
|
+
},
|
|
3766
|
+
{ label: n("torrentUI.downloads", "Downloads"), value: P(e.downloaded) },
|
|
3767
|
+
{ label: n("torrentUI.uploaded", "Uploaded"), value: P(e.uploaded) },
|
|
3768
|
+
{ label: n("torrentUI.ratio", "Ratio"), value: Z(e.ratio) },
|
|
3769
|
+
{ label: n("torrentUI.availability", "Availability"), value: e.availability.toFixed(2) },
|
|
3770
|
+
{ label: n("torrentUI.wasted", "Wasted"), value: P(e.wastedBytes) },
|
|
3771
|
+
{ label: n("torrentUI.hashFails", "Hash Fails"), value: e.hashFailures },
|
|
3772
|
+
{ label: n("torrentUI.added", "Added"), value: t.toLocaleString() },
|
|
3773
|
+
{ label: n("torrentUI.comment", "Comment"), value: s.comment || "-" },
|
|
3774
|
+
{ label: n("torrentUI.private", "Private"), value: s.isPrivate ? "Yes" : "No" }
|
|
3715
3775
|
];
|
|
3716
|
-
return /* @__PURE__ */
|
|
3776
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: o.spacing.xs }, children: r.map((i) => /* @__PURE__ */ l(
|
|
3717
3777
|
"div",
|
|
3718
3778
|
{
|
|
3719
3779
|
style: {
|
|
3720
3780
|
display: "flex",
|
|
3721
3781
|
justifyContent: "space-between",
|
|
3722
|
-
padding: `${
|
|
3782
|
+
padding: `${o.spacing.xs} ${o.spacing.sm}`,
|
|
3723
3783
|
fontSize: "13px"
|
|
3724
3784
|
},
|
|
3725
3785
|
children: [
|
|
3726
|
-
/* @__PURE__ */
|
|
3727
|
-
/* @__PURE__ */
|
|
3786
|
+
/* @__PURE__ */ a("span", { style: { color: o.colors.textSecondary }, children: i.label }),
|
|
3787
|
+
/* @__PURE__ */ a("span", { style: { fontFamily: "monospace" }, children: i.value })
|
|
3728
3788
|
]
|
|
3729
3789
|
},
|
|
3730
|
-
|
|
3790
|
+
i.label
|
|
3731
3791
|
)) });
|
|
3732
3792
|
}
|
|
3733
|
-
function
|
|
3793
|
+
function je({
|
|
3734
3794
|
isOpen: s,
|
|
3735
3795
|
onClose: e,
|
|
3736
3796
|
onAdd: t,
|
|
3737
|
-
className:
|
|
3797
|
+
className: n
|
|
3738
3798
|
}) {
|
|
3739
|
-
const { theme:
|
|
3799
|
+
const { t: o } = w(), { theme: r, config: i, client: d } = M(), [c, g] = T(""), [u, h] = T(""), [p, D] = T(!1);
|
|
3740
3800
|
if (!s)
|
|
3741
3801
|
return null;
|
|
3742
|
-
const
|
|
3743
|
-
b.preventDefault(),
|
|
3802
|
+
const m = (b) => {
|
|
3803
|
+
b.preventDefault(), c.trim() && (t(c.trim(), { path: u || void 0, paused: p }), g(""), h(""), D(!1), e());
|
|
3744
3804
|
};
|
|
3745
|
-
return /* @__PURE__ */
|
|
3805
|
+
return /* @__PURE__ */ a(
|
|
3746
3806
|
"div",
|
|
3747
3807
|
{
|
|
3748
|
-
|
|
3808
|
+
role: "presentation",
|
|
3809
|
+
className: n,
|
|
3749
3810
|
style: {
|
|
3750
3811
|
position: "fixed",
|
|
3751
3812
|
inset: 0,
|
|
@@ -3756,121 +3817,123 @@ function Ue({
|
|
|
3756
3817
|
zIndex: 1e3
|
|
3757
3818
|
},
|
|
3758
3819
|
onClick: e,
|
|
3759
|
-
children: /* @__PURE__ */
|
|
3820
|
+
children: /* @__PURE__ */ l(
|
|
3760
3821
|
"div",
|
|
3761
3822
|
{
|
|
3823
|
+
role: "presentation",
|
|
3762
3824
|
style: {
|
|
3763
|
-
backgroundColor:
|
|
3764
|
-
borderRadius:
|
|
3765
|
-
padding:
|
|
3825
|
+
backgroundColor: r.colors.surface,
|
|
3826
|
+
borderRadius: r.borderRadius,
|
|
3827
|
+
padding: r.spacing.lg,
|
|
3766
3828
|
width: "500px",
|
|
3767
3829
|
maxWidth: "90vw"
|
|
3768
3830
|
},
|
|
3769
3831
|
onClick: (b) => b.stopPropagation(),
|
|
3770
3832
|
children: [
|
|
3771
|
-
/* @__PURE__ */
|
|
3772
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ a("h2", { style: { margin: 0, marginBottom: r.spacing.md }, children: o("torrentUI.addTorrent", "Add Torrent") }),
|
|
3834
|
+
/* @__PURE__ */ l(
|
|
3773
3835
|
"form",
|
|
3774
3836
|
{
|
|
3775
|
-
onSubmit:
|
|
3776
|
-
style: { display: "flex", flexDirection: "column", gap:
|
|
3837
|
+
onSubmit: m,
|
|
3838
|
+
style: { display: "flex", flexDirection: "column", gap: r.spacing.md },
|
|
3777
3839
|
children: [
|
|
3778
|
-
/* @__PURE__ */
|
|
3779
|
-
/* @__PURE__ */
|
|
3780
|
-
/* @__PURE__ */
|
|
3840
|
+
/* @__PURE__ */ l("div", { children: [
|
|
3841
|
+
/* @__PURE__ */ a("label", { style: { display: "block", marginBottom: r.spacing.xs, fontSize: "13px" }, children: o("torrentUI.magnetUriOrTorrentFile", "Magnet URI or .torrent file path") }),
|
|
3842
|
+
/* @__PURE__ */ a(
|
|
3781
3843
|
"input",
|
|
3782
3844
|
{
|
|
3783
3845
|
type: "text",
|
|
3784
|
-
value:
|
|
3785
|
-
onChange: (b) =>
|
|
3786
|
-
placeholder:
|
|
3846
|
+
value: c,
|
|
3847
|
+
onChange: (b) => g(b.target.value),
|
|
3848
|
+
placeholder: o(
|
|
3849
|
+
"torrentUI.magnetXtUrnBtihOr",
|
|
3850
|
+
"magnet:?xt=urn:btih:... or C:\\path\\to\\file.torrent"
|
|
3851
|
+
),
|
|
3787
3852
|
style: {
|
|
3788
3853
|
width: "100%",
|
|
3789
|
-
padding:
|
|
3790
|
-
backgroundColor:
|
|
3791
|
-
color:
|
|
3792
|
-
border: `1px solid ${
|
|
3793
|
-
borderRadius:
|
|
3794
|
-
outline: "none",
|
|
3854
|
+
padding: r.spacing.sm,
|
|
3855
|
+
backgroundColor: r.colors.background,
|
|
3856
|
+
color: r.colors.text,
|
|
3857
|
+
border: `1px solid ${r.colors.border}`,
|
|
3858
|
+
borderRadius: r.borderRadius,
|
|
3795
3859
|
fontSize: "13px"
|
|
3796
3860
|
}
|
|
3797
3861
|
}
|
|
3798
3862
|
)
|
|
3799
3863
|
] }),
|
|
3800
|
-
/* @__PURE__ */
|
|
3801
|
-
/* @__PURE__ */
|
|
3802
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ l("div", { children: [
|
|
3865
|
+
/* @__PURE__ */ a("label", { style: { display: "block", marginBottom: r.spacing.xs, fontSize: "13px" }, children: o("torrentUI.saveLocation", "Save Location") }),
|
|
3866
|
+
/* @__PURE__ */ a(
|
|
3803
3867
|
"input",
|
|
3804
3868
|
{
|
|
3805
3869
|
type: "text",
|
|
3806
|
-
value:
|
|
3807
|
-
onChange: (b) =>
|
|
3808
|
-
placeholder: "Leave empty for default",
|
|
3870
|
+
value: u,
|
|
3871
|
+
onChange: (b) => h(b.target.value),
|
|
3872
|
+
placeholder: o("torrentUI.leaveEmptyForDefault", "Leave empty for default"),
|
|
3809
3873
|
style: {
|
|
3810
3874
|
width: "100%",
|
|
3811
|
-
padding:
|
|
3812
|
-
backgroundColor:
|
|
3813
|
-
color:
|
|
3814
|
-
border: `1px solid ${
|
|
3815
|
-
borderRadius:
|
|
3816
|
-
outline: "none",
|
|
3875
|
+
padding: r.spacing.sm,
|
|
3876
|
+
backgroundColor: r.colors.background,
|
|
3877
|
+
color: r.colors.text,
|
|
3878
|
+
border: `1px solid ${r.colors.border}`,
|
|
3879
|
+
borderRadius: r.borderRadius,
|
|
3817
3880
|
fontSize: "13px"
|
|
3818
3881
|
}
|
|
3819
3882
|
}
|
|
3820
3883
|
)
|
|
3821
3884
|
] }),
|
|
3822
|
-
/* @__PURE__ */
|
|
3885
|
+
/* @__PURE__ */ l(
|
|
3823
3886
|
"label",
|
|
3824
3887
|
{
|
|
3825
3888
|
style: {
|
|
3826
3889
|
display: "flex",
|
|
3827
3890
|
alignItems: "center",
|
|
3828
|
-
gap:
|
|
3891
|
+
gap: r.spacing.sm,
|
|
3829
3892
|
fontSize: "13px"
|
|
3830
3893
|
},
|
|
3831
3894
|
children: [
|
|
3832
|
-
/* @__PURE__ */
|
|
3895
|
+
/* @__PURE__ */ a(
|
|
3833
3896
|
"input",
|
|
3834
3897
|
{
|
|
3835
3898
|
type: "checkbox",
|
|
3836
3899
|
checked: p,
|
|
3837
|
-
onChange: (b) =>
|
|
3900
|
+
onChange: (b) => D(b.target.checked)
|
|
3838
3901
|
}
|
|
3839
3902
|
),
|
|
3840
|
-
"Start paused"
|
|
3903
|
+
o("torrentUI.startPaused", "Start paused")
|
|
3841
3904
|
]
|
|
3842
3905
|
}
|
|
3843
3906
|
),
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
3907
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", gap: r.spacing.sm, justifyContent: "flex-end" }, children: [
|
|
3908
|
+
/* @__PURE__ */ a(
|
|
3846
3909
|
"button",
|
|
3847
3910
|
{
|
|
3848
3911
|
type: "button",
|
|
3849
3912
|
onClick: e,
|
|
3850
3913
|
style: {
|
|
3851
|
-
padding: `${
|
|
3914
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3852
3915
|
backgroundColor: "transparent",
|
|
3853
|
-
color:
|
|
3854
|
-
border: `1px solid ${
|
|
3855
|
-
borderRadius:
|
|
3916
|
+
color: r.colors.text,
|
|
3917
|
+
border: `1px solid ${r.colors.border}`,
|
|
3918
|
+
borderRadius: r.borderRadius,
|
|
3856
3919
|
cursor: "pointer"
|
|
3857
3920
|
},
|
|
3858
|
-
children: "Cancel"
|
|
3921
|
+
children: o("torrentUI.cancel", "Cancel")
|
|
3859
3922
|
}
|
|
3860
3923
|
),
|
|
3861
|
-
/* @__PURE__ */
|
|
3924
|
+
/* @__PURE__ */ a(
|
|
3862
3925
|
"button",
|
|
3863
3926
|
{
|
|
3864
3927
|
type: "submit",
|
|
3865
3928
|
style: {
|
|
3866
|
-
padding: `${
|
|
3867
|
-
backgroundColor:
|
|
3868
|
-
color:
|
|
3929
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3930
|
+
backgroundColor: r.colors.primary,
|
|
3931
|
+
color: r.colors.text,
|
|
3869
3932
|
border: "none",
|
|
3870
|
-
borderRadius:
|
|
3933
|
+
borderRadius: r.borderRadius,
|
|
3871
3934
|
cursor: "pointer"
|
|
3872
3935
|
},
|
|
3873
|
-
children: "Add Torrent"
|
|
3936
|
+
children: o("torrentUI.addTorrent", "Add Torrent")
|
|
3874
3937
|
}
|
|
3875
3938
|
)
|
|
3876
3939
|
] })
|
|
@@ -3883,14 +3946,14 @@ function Ue({
|
|
|
3883
3946
|
}
|
|
3884
3947
|
);
|
|
3885
3948
|
}
|
|
3886
|
-
function
|
|
3949
|
+
function ot({
|
|
3887
3950
|
client: s,
|
|
3888
3951
|
config: e,
|
|
3889
3952
|
className: t,
|
|
3890
|
-
style:
|
|
3953
|
+
style: n
|
|
3891
3954
|
}) {
|
|
3892
|
-
const [
|
|
3893
|
-
return /* @__PURE__ */
|
|
3955
|
+
const { t: o } = w(), [r, i] = T(!1), [d, c] = T(null);
|
|
3956
|
+
return /* @__PURE__ */ a(Be, { client: s, config: e, children: /* @__PURE__ */ l(
|
|
3894
3957
|
"div",
|
|
3895
3958
|
{
|
|
3896
3959
|
className: t,
|
|
@@ -3899,13 +3962,13 @@ function et({
|
|
|
3899
3962
|
flexDirection: "column",
|
|
3900
3963
|
gap: "16px",
|
|
3901
3964
|
height: "100%",
|
|
3902
|
-
...
|
|
3965
|
+
...n
|
|
3903
3966
|
},
|
|
3904
3967
|
children: [
|
|
3905
|
-
/* @__PURE__ */
|
|
3968
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: "8px" }, children: /* @__PURE__ */ a(
|
|
3906
3969
|
"button",
|
|
3907
3970
|
{
|
|
3908
|
-
onClick: () =>
|
|
3971
|
+
onClick: () => i(!0),
|
|
3909
3972
|
style: {
|
|
3910
3973
|
padding: "8px 16px",
|
|
3911
3974
|
backgroundColor: "#0f3460",
|
|
@@ -3914,18 +3977,18 @@ function et({
|
|
|
3914
3977
|
borderRadius: "8px",
|
|
3915
3978
|
cursor: "pointer"
|
|
3916
3979
|
},
|
|
3917
|
-
children: "+ Add Torrent"
|
|
3980
|
+
children: o("torrentUI.addTorrent2", "+ Add Torrent")
|
|
3918
3981
|
}
|
|
3919
3982
|
) }),
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
3922
|
-
|
|
3923
|
-
/* @__PURE__ */
|
|
3924
|
-
|
|
3983
|
+
/* @__PURE__ */ a(ze, {}),
|
|
3984
|
+
/* @__PURE__ */ a(Pe, { onTorrentSelect: c, style: { flex: 1 } }),
|
|
3985
|
+
d && /* @__PURE__ */ a(We, { infoHash: d }),
|
|
3986
|
+
/* @__PURE__ */ a(
|
|
3987
|
+
je,
|
|
3925
3988
|
{
|
|
3926
|
-
isOpen:
|
|
3927
|
-
onClose: () =>
|
|
3928
|
-
onAdd: (
|
|
3989
|
+
isOpen: r,
|
|
3990
|
+
onClose: () => i(!1),
|
|
3991
|
+
onAdd: (g, u) => s.addTorrent(g, u)
|
|
3929
3992
|
}
|
|
3930
3993
|
)
|
|
3931
3994
|
]
|
|
@@ -3933,34 +3996,34 @@ function et({
|
|
|
3933
3996
|
) });
|
|
3934
3997
|
}
|
|
3935
3998
|
export {
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3999
|
+
je as AddTorrentDialog,
|
|
4000
|
+
ze as FilterBar,
|
|
4001
|
+
le as HealthService,
|
|
4002
|
+
Ie as LifeDashboardService,
|
|
4003
|
+
Ye as NiceHealth,
|
|
4004
|
+
at as NiceLifeDashboard,
|
|
4005
|
+
Je as NicePersonalFinance,
|
|
4006
|
+
tt as NiceTaskManager,
|
|
4007
|
+
ot as NiceTorrentUI,
|
|
4008
|
+
me as PersonalFinanceService,
|
|
4009
|
+
Fe as ProgressBar,
|
|
4010
|
+
Re as StatusBadge,
|
|
4011
|
+
Se as TaskManagerService,
|
|
4012
|
+
We as TorrentDetails,
|
|
4013
|
+
Pe as TorrentList,
|
|
4014
|
+
Be as TorrentUIProvider,
|
|
4015
|
+
qe as createHealthService,
|
|
4016
|
+
nt as createLifeDashboardService,
|
|
4017
|
+
_e as createPersonalFinanceService,
|
|
4018
|
+
Ze as createTaskManagerService,
|
|
4019
|
+
P as formatBytes,
|
|
4020
|
+
Me as formatETA,
|
|
4021
|
+
Z as formatRatio,
|
|
4022
|
+
$ as formatSpeed,
|
|
4023
|
+
ee as getStatusColor,
|
|
4024
|
+
Qe as useHealth,
|
|
4025
|
+
rt as useLifeDashboard,
|
|
4026
|
+
Xe as usePersonalFinance,
|
|
4027
|
+
et as useTaskManager,
|
|
4028
|
+
M as useTorrentUI
|
|
3966
4029
|
};
|