@nice2dev/templates 1.2.1 → 1.2.2

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