@burdenoff/microfe-timecampus 2026.1031.7 → 2026.1031.9

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.
@@ -3,7 +3,7 @@ import { cn as n } from "../../utils/helpers.js";
3
3
  import { StatCard as r } from "../../components/StatCard.js";
4
4
  import { LoadingSkeleton as i } from "../../components/LoadingSkeleton.js";
5
5
  import { EmptyState as a } from "../../components/EmptyState.js";
6
- import { useAcceptRecommendationMutation as o, useDismissRecommendationMutation as s, useGenerateMyRecommendationsMutation as c, useMyRecommendationPreferencesQuery as l, useMyRecommendationsQuery as u, useSnoozeRecommendationMutation as d, useUpdateMyRecommendationPreferencesMutation as f } from "../../../generated/wspace-operations.js";
6
+ import { useAcceptRecommendationMutation as o, useDismissRecommendationMutation as s, useGenerateMyRecommendationsMutation as c, useMyRecommendationPreferencesQuery as l, useMyRecommendationsQuery as u, useMyTimeIntelligenceDeliveriesQuery as d, useSnoozeRecommendationMutation as f, useUpdateMyRecommendationPreferencesMutation as ee } from "../../../generated/wspace-operations.js";
7
7
  import { PageLayout as p } from "../../components/PageLayout.js";
8
8
  import { StatusBadge as m } from "../../components/StatusBadge.js";
9
9
  import { Modal as h } from "../../components/Modal.js";
@@ -11,84 +11,85 @@ import { ToastContainer as g, useToast as _ } from "../../components/Toast.js";
11
11
  import "../../components/index.js";
12
12
  import { TimeCampusLifeDomain as v } from "../../../generated/wspace-types.js";
13
13
  import { lifeDomainLabel as y } from "./domains.js";
14
- import { evidenceWeeks as ee, formatEvidenceRef as b, formatHourOfDay as x, humaniseToken as S, parseEvidenceRefs as C, parseSuggestedAction as w, recommendationKindLabel as T, recommendationProvenance as E } from "./recommendationEvidence.js";
15
- import { useMemo as D, useState as O } from "react";
16
- import { BellOff as k, Briefcase as te, Bus as ne, CalendarClock as A, Check as re, CheckCircle2 as ie, ChevronDown as ae, Circle as oe, Clock as se, Coffee as ce, ExternalLink as j, GraduationCap as le, Handshake as ue, Heart as de, HeartPulse as fe, Home as M, Hourglass as N, Lightbulb as P, Microscope as F, Moon as I, ShieldCheck as L, Sparkles as R, Users as z, Wallet as pe, X as B } from "lucide-react";
17
- import { Fragment as me, jsx as V, jsxs as H } from "react/jsx-runtime";
18
- import { GlassCard as U } from "@burdenoff/fe-libs/ui";
14
+ import { evidenceWeeks as b, formatEvidenceRef as x, formatHourOfDay as S, humaniseToken as C, parseEvidenceRefs as w, parseSuggestedAction as T, recommendationKindLabel as E, recommendationProvenance as D } from "./recommendationEvidence.js";
15
+ import { DIGEST_CADENCE_OPTIONS as O, DIGEST_DAY_OPTIONS as te, describeDelivery as ne, formatUtcHourWithLocal as k } from "./timeIntelligence.js";
16
+ import { useMemo as A, useState as j } from "react";
17
+ import { BellOff as re, Briefcase as ie, Bus as ae, CalendarClock as oe, Check as se, CheckCircle2 as ce, ChevronDown as le, Circle as ue, Clock as M, Coffee as de, ExternalLink as fe, GraduationCap as N, Handshake as pe, Heart as me, HeartPulse as he, Home as P, Hourglass as F, Lightbulb as I, Microscope as L, Moon as R, ShieldCheck as z, Sparkles as B, Users as ge, Wallet as _e, X as V } from "lucide-react";
18
+ import { Fragment as ve, jsx as H, jsxs as U } from "react/jsx-runtime";
19
+ import { GlassCard as W } from "@burdenoff/fe-libs/ui";
19
20
  //#region src/timecampus/pages/lifetime/RecommendationsPage.tsx
20
- var W = {
21
+ var G = {
21
22
  New: "NEW",
22
23
  Snoozed: "SNOOZED",
23
24
  Accepted: "ACCEPTED",
24
25
  Dismissed: "DISMISSED",
25
26
  Expired: "EXPIRED"
26
- }, he = [
27
+ }, ye = [
27
28
  {
28
- key: W.New,
29
+ key: G.New,
29
30
  label: "New"
30
31
  },
31
32
  {
32
- key: W.Snoozed,
33
+ key: G.Snoozed,
33
34
  label: "Snoozed"
34
35
  },
35
36
  {
36
- key: W.Accepted,
37
+ key: G.Accepted,
37
38
  label: "Accepted"
38
39
  },
39
40
  {
40
- key: W.Dismissed,
41
+ key: G.Dismissed,
41
42
  label: "Dismissed"
42
43
  }
43
44
  ];
44
- function ge(e) {
45
- return e === W.New || e === W.Snoozed;
45
+ function be(e) {
46
+ return e === G.New || e === G.Snoozed;
46
47
  }
47
- function _e() {
48
+ function xe() {
48
49
  return new Date(Date.now() + 6048e5).toISOString();
49
50
  }
50
- var ve = (e) => Math.min(1, Math.max(0, e)), G = (e) => `${Math.round(ve(e) * 100)}%`;
51
- function K(e) {
51
+ var Se = (e) => Math.min(1, Math.max(0, e)), K = (e) => `${Math.round(Se(e) * 100)}%`;
52
+ function q(e) {
52
53
  return new Date(e).toLocaleDateString(void 0, {
53
54
  month: "short",
54
55
  day: "numeric",
55
56
  year: "numeric"
56
57
  });
57
58
  }
58
- var q = Array.from({ length: 24 }, (e, t) => t), ye = {
59
- [v.Work]: te,
60
- [v.Sleep]: I,
61
- [v.Health]: fe,
62
- [v.Family]: z,
63
- [v.Learning]: le,
64
- [v.Leisure]: ce,
65
- [v.Commute]: ne,
66
- [v.Waiting]: N,
67
- [v.Chores]: M,
68
- [v.SelfCare]: de,
69
- [v.Social]: ue,
70
- [v.FinanceAdmin]: pe,
71
- [v.Reflection]: R,
72
- [v.Other]: oe
59
+ var J = Array.from({ length: 24 }, (e, t) => t), Ce = {
60
+ [v.Work]: ie,
61
+ [v.Sleep]: R,
62
+ [v.Health]: he,
63
+ [v.Family]: ge,
64
+ [v.Learning]: N,
65
+ [v.Leisure]: de,
66
+ [v.Commute]: ae,
67
+ [v.Waiting]: F,
68
+ [v.Chores]: P,
69
+ [v.SelfCare]: me,
70
+ [v.Social]: pe,
71
+ [v.FinanceAdmin]: _e,
72
+ [v.Reflection]: B,
73
+ [v.Other]: ue
73
74
  };
74
- function be(e) {
75
- return e ? ye[e] ?? P : P;
75
+ function Y(e) {
76
+ return e ? Ce[e] ?? I : I;
76
77
  }
77
- function J(e) {
78
+ function we(e) {
78
79
  switch (e) {
79
- case W.Accepted: return {
80
+ case G.Accepted: return {
80
81
  variant: "success",
81
82
  label: "Accepted"
82
83
  };
83
- case W.Snoozed: return {
84
+ case G.Snoozed: return {
84
85
  variant: "warning",
85
86
  label: "Snoozed"
86
87
  };
87
- case W.Dismissed: return {
88
+ case G.Dismissed: return {
88
89
  variant: "muted",
89
90
  label: "Dismissed"
90
91
  };
91
- case W.Expired: return {
92
+ case G.Expired: return {
92
93
  variant: "muted",
93
94
  label: "Expired"
94
95
  };
@@ -98,9 +99,9 @@ function J(e) {
98
99
  };
99
100
  }
100
101
  }
101
- var Y = "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50", X = "inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50", Z = "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary";
102
- function xe({ checked: e, onChange: t, label: r, disabled: i }) {
103
- return /* @__PURE__ */ V("button", {
102
+ var Te = "inline-flex items-center gap-1.5 rounded-md bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90 disabled:opacity-50", X = "inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken/50 disabled:opacity-50", Z = "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary";
103
+ function Ee({ checked: e, onChange: t, label: r, disabled: i }) {
104
+ return /* @__PURE__ */ H("button", {
104
105
  type: "button",
105
106
  role: "switch",
106
107
  "aria-checked": e,
@@ -108,106 +109,106 @@ function xe({ checked: e, onChange: t, label: r, disabled: i }) {
108
109
  disabled: i,
109
110
  onClick: () => t(!e),
110
111
  className: n("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border transition-colors disabled:cursor-not-allowed disabled:opacity-50", e ? "border-transparent bg-action-primary-bg" : "border-border-subtle bg-bg-sunken"),
111
- children: /* @__PURE__ */ V("span", { className: n("inline-block h-3.5 w-3.5 transform rounded-full shadow-sm transition-transform", e ? "translate-x-4 bg-action-primary-text" : "translate-x-0.5 bg-text-secondary") })
112
+ children: /* @__PURE__ */ H("span", { className: n("inline-block h-3.5 w-3.5 transform rounded-full shadow-sm transition-transform", e ? "translate-x-4 bg-action-primary-text" : "translate-x-0.5 bg-text-secondary") })
112
113
  });
113
114
  }
114
- function Se({ rec: e, busy: r, muted: i, onAccept: a, onSnooze: o, onDismiss: s, onMuteKind: c }) {
115
- let l = be(e.domain), u = ge(e.state), d = J(e.state), [f, p] = O(!1), h = C(e.evidenceRefs), g = w(e.suggestedAction), _ = `rec-evidence-${e.id}`, v = ee(e.createdAt, h), x = t();
116
- return /* @__PURE__ */ H(U, {
115
+ function De({ rec: e, busy: r, muted: i, onAccept: a, onSnooze: o, onDismiss: s, onMuteKind: c }) {
116
+ let l = Y(e.domain), u = be(e.state), d = we(e.state), [f, ee] = j(!1), p = w(e.evidenceRefs), h = T(e.suggestedAction), g = `rec-evidence-${e.id}`, _ = b(e.createdAt, p), v = t();
117
+ return /* @__PURE__ */ U(W, {
117
118
  treatment: "glass",
118
119
  className: "flex flex-col gap-3 p-4 sm:p-5",
119
120
  children: [
120
- /* @__PURE__ */ H("div", {
121
+ /* @__PURE__ */ U("div", {
121
122
  className: "flex items-start justify-between gap-3",
122
- children: [/* @__PURE__ */ H("div", {
123
+ children: [/* @__PURE__ */ U("div", {
123
124
  className: "flex min-w-0 items-center gap-3",
124
- children: [/* @__PURE__ */ V("span", {
125
+ children: [/* @__PURE__ */ H("span", {
125
126
  className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg/10 text-primary",
126
- children: /* @__PURE__ */ V(l, { className: "h-5 w-5" })
127
- }), /* @__PURE__ */ H("div", {
127
+ children: /* @__PURE__ */ H(l, { className: "h-5 w-5" })
128
+ }), /* @__PURE__ */ U("div", {
128
129
  className: "min-w-0",
129
- children: [/* @__PURE__ */ H("p", {
130
+ children: [/* @__PURE__ */ U("p", {
130
131
  className: "flex min-w-0 items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-secondary",
131
- children: [e.source === "AI" && /* @__PURE__ */ H("span", {
132
+ children: [e.source === "AI" && /* @__PURE__ */ U("span", {
132
133
  className: Z,
133
134
  "data-testid": "rec-ai-chip",
134
- children: [/* @__PURE__ */ V(R, { className: "h-3 w-3" }), "AI"]
135
- }), /* @__PURE__ */ V("span", {
135
+ children: [/* @__PURE__ */ H(B, { className: "h-3 w-3" }), "AI"]
136
+ }), /* @__PURE__ */ H("span", {
136
137
  className: "truncate",
137
- children: T(e.kind)
138
+ children: E(e.kind)
138
139
  })]
139
- }), /* @__PURE__ */ V("h3", {
140
+ }), /* @__PURE__ */ H("h3", {
140
141
  className: "mt-0.5 text-base font-semibold text-text-primary",
141
142
  children: e.title
142
143
  })]
143
144
  })]
144
- }), e.confidence != null && /* @__PURE__ */ V(m, {
145
+ }), e.confidence != null && /* @__PURE__ */ H(m, {
145
146
  variant: "info",
146
- label: `${G(e.confidence)} confident`,
147
+ label: `${K(e.confidence)} confident`,
147
148
  className: "shrink-0"
148
149
  })]
149
150
  }),
150
- /* @__PURE__ */ V("p", {
151
+ /* @__PURE__ */ H("p", {
151
152
  className: "text-sm text-text-secondary",
152
153
  children: e.rationale
153
154
  }),
154
- /* @__PURE__ */ V("p", {
155
+ /* @__PURE__ */ H("p", {
155
156
  className: "text-xs text-text-tertiary",
156
157
  "data-testid": "rec-provenance",
157
- children: E(e.source, e.aiModel)
158
+ children: D(e.source, e.aiModel)
158
159
  }),
159
- /* @__PURE__ */ H("div", {
160
+ /* @__PURE__ */ U("div", {
160
161
  className: "flex flex-wrap items-center gap-1.5",
161
162
  children: [
162
- e.domain && /* @__PURE__ */ V("span", {
163
+ e.domain && /* @__PURE__ */ H("span", {
163
164
  className: Z,
164
165
  children: y(e.domain)
165
166
  }),
166
- e.valueAlignment != null && /* @__PURE__ */ H("span", {
167
+ e.valueAlignment != null && /* @__PURE__ */ U("span", {
167
168
  className: Z,
168
169
  children: [
169
- /* @__PURE__ */ V(L, { className: "h-3 w-3" }),
170
+ /* @__PURE__ */ H(z, { className: "h-3 w-3" }),
170
171
  "Aligns with your values · ",
171
- G(e.valueAlignment)
172
+ K(e.valueAlignment)
172
173
  ]
173
174
  }),
174
- e.state === W.Snoozed && e.snoozeUntil && /* @__PURE__ */ H("span", {
175
+ e.state === G.Snoozed && e.snoozeUntil && /* @__PURE__ */ U("span", {
175
176
  className: Z,
176
177
  children: [
177
- /* @__PURE__ */ V(se, { className: "h-3 w-3" }),
178
+ /* @__PURE__ */ H(M, { className: "h-3 w-3" }),
178
179
  "Snoozed until ",
179
- K(e.snoozeUntil)
180
+ q(e.snoozeUntil)
180
181
  ]
181
182
  }),
182
- u && e.expiresAt && /* @__PURE__ */ H("span", {
183
+ u && e.expiresAt && /* @__PURE__ */ U("span", {
183
184
  className: Z,
184
185
  children: [
185
- /* @__PURE__ */ V(A, { className: "h-3 w-3" }),
186
+ /* @__PURE__ */ H(oe, { className: "h-3 w-3" }),
186
187
  "Expires ",
187
- K(e.expiresAt)
188
+ q(e.expiresAt)
188
189
  ]
189
190
  })
190
191
  ]
191
192
  }),
192
- g && /* @__PURE__ */ H("div", {
193
+ h && /* @__PURE__ */ U("div", {
193
194
  className: "rounded-lg border border-border-seam bg-bg-sunken/40 p-3",
194
195
  children: [
195
- /* @__PURE__ */ V("p", {
196
+ /* @__PURE__ */ H("p", {
196
197
  className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
197
198
  children: "Suggested action"
198
199
  }),
199
- /* @__PURE__ */ V("p", {
200
+ /* @__PURE__ */ H("p", {
200
201
  className: "mt-1 text-sm font-medium text-text-primary",
201
- children: S(g.type)
202
+ children: C(h.type)
202
203
  }),
203
- g.details.length > 0 && /* @__PURE__ */ V("dl", {
204
+ h.details.length > 0 && /* @__PURE__ */ H("dl", {
204
205
  className: "mt-1.5 flex flex-wrap gap-x-4 gap-y-1",
205
- children: g.details.map((e) => /* @__PURE__ */ H("div", {
206
+ children: h.details.map((e) => /* @__PURE__ */ U("div", {
206
207
  className: "flex items-center gap-1.5",
207
- children: [/* @__PURE__ */ V("dt", {
208
+ children: [/* @__PURE__ */ H("dt", {
208
209
  className: "text-xs text-text-secondary",
209
210
  children: e.key
210
- }), /* @__PURE__ */ V("dd", {
211
+ }), /* @__PURE__ */ H("dd", {
211
212
  className: "text-xs font-medium tabular-nums text-text-primary",
212
213
  children: e.value
213
214
  })]
@@ -215,106 +216,106 @@ function Se({ rec: e, busy: r, muted: i, onAccept: a, onSnooze: o, onDismiss: s,
215
216
  })
216
217
  ]
217
218
  }),
218
- h.length > 0 && /* @__PURE__ */ H("div", {
219
+ p.length > 0 && /* @__PURE__ */ U("div", {
219
220
  className: "rounded-lg border border-border-seam bg-bg-sunken/40",
220
- children: [/* @__PURE__ */ H("button", {
221
+ children: [/* @__PURE__ */ U("button", {
221
222
  type: "button",
222
- onClick: () => p((e) => !e),
223
+ onClick: () => ee((e) => !e),
223
224
  "aria-expanded": f,
224
- "aria-controls": _,
225
+ "aria-controls": g,
225
226
  className: "flex w-full items-center justify-between gap-2 px-3 py-2 text-left",
226
- children: [/* @__PURE__ */ H("span", {
227
+ children: [/* @__PURE__ */ U("span", {
227
228
  className: "flex min-w-0 items-center gap-2",
228
- children: [/* @__PURE__ */ V(F, { className: "h-3.5 w-3.5 shrink-0 text-text-secondary" }), /* @__PURE__ */ H("span", {
229
+ children: [/* @__PURE__ */ H(L, { className: "h-3.5 w-3.5 shrink-0 text-text-secondary" }), /* @__PURE__ */ U("span", {
229
230
  className: "truncate text-xs text-text-secondary",
230
231
  children: [
231
232
  "Evidence: ",
232
- b(h[0]),
233
- h.length > 1 ? ` · +${h.length - 1} more` : ""
233
+ x(p[0]),
234
+ p.length > 1 ? ` · +${p.length - 1} more` : ""
234
235
  ]
235
236
  })]
236
- }), /* @__PURE__ */ V(ae, { className: n("h-4 w-4 shrink-0 text-text-secondary transition-transform", f && "rotate-180") })]
237
- }), f && /* @__PURE__ */ H("dl", {
238
- id: _,
237
+ }), /* @__PURE__ */ H(le, { className: n("h-4 w-4 shrink-0 text-text-secondary transition-transform", f && "rotate-180") })]
238
+ }), f && /* @__PURE__ */ U("dl", {
239
+ id: g,
239
240
  className: "space-y-1.5 border-t border-border-seam px-3 py-2.5",
240
241
  children: [
241
- h.map((e, t) => /* @__PURE__ */ H("div", {
242
+ p.map((e, t) => /* @__PURE__ */ U("div", {
242
243
  className: "flex items-baseline justify-between gap-3",
243
- children: [/* @__PURE__ */ V("dt", {
244
+ children: [/* @__PURE__ */ H("dt", {
244
245
  className: "text-xs text-text-secondary",
245
- children: b(e).split(": ")[0]
246
- }), /* @__PURE__ */ V("dd", {
246
+ children: x(e).split(": ")[0]
247
+ }), /* @__PURE__ */ H("dd", {
247
248
  className: "text-xs font-medium tabular-nums text-text-primary",
248
- children: b(e).split(": ").slice(1).join(": ")
249
+ children: x(e).split(": ").slice(1).join(": ")
249
250
  })]
250
251
  }, `${e.metric}-${e.period ?? e.domain ?? t}`)),
251
- v.length > 0 && /* @__PURE__ */ V("div", {
252
+ _.length > 0 && /* @__PURE__ */ H("div", {
252
253
  className: "flex flex-wrap gap-2 pt-1",
253
- children: v.map((e) => /* @__PURE__ */ H("button", {
254
+ children: _.map((e) => /* @__PURE__ */ U("button", {
254
255
  type: "button",
255
- onClick: () => x(`/timeline?date=${encodeURIComponent(e)}`),
256
+ onClick: () => v(`/timeline?date=${encodeURIComponent(e)}`),
256
257
  "data-testid": "rec-evidence-timeline-link",
257
258
  className: "inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg/40",
258
259
  children: [
259
- /* @__PURE__ */ V(j, { className: "h-3 w-3" }),
260
+ /* @__PURE__ */ H(fe, { className: "h-3 w-3" }),
260
261
  "Open the week of ",
261
- K(`${e}T12:00:00`),
262
+ q(`${e}T12:00:00`),
262
263
  " on your timeline"
263
264
  ]
264
265
  }, e))
265
266
  }),
266
- /* @__PURE__ */ V("p", {
267
+ /* @__PURE__ */ H("p", {
267
268
  className: "pt-1 text-xs text-text-tertiary",
268
269
  children: "Measured from your own tracked week. Nothing is applied until you accept."
269
270
  })
270
271
  ]
271
272
  })]
272
273
  }),
273
- u ? /* @__PURE__ */ H("div", {
274
+ u ? /* @__PURE__ */ U("div", {
274
275
  className: "flex flex-wrap items-center gap-2 pt-1",
275
276
  children: [
276
- /* @__PURE__ */ H("button", {
277
+ /* @__PURE__ */ U("button", {
277
278
  type: "button",
278
279
  onClick: () => a(e.id),
279
280
  disabled: r,
280
- className: Y,
281
- children: [/* @__PURE__ */ V(re, { className: "h-4 w-4" }), "Accept"]
281
+ className: Te,
282
+ children: [/* @__PURE__ */ H(se, { className: "h-4 w-4" }), "Accept"]
282
283
  }),
283
- /* @__PURE__ */ H("button", {
284
+ /* @__PURE__ */ U("button", {
284
285
  type: "button",
285
286
  onClick: () => o(e.id),
286
287
  disabled: r,
287
288
  className: X,
288
- children: [/* @__PURE__ */ V(se, { className: "h-4 w-4" }), "Snooze"]
289
+ children: [/* @__PURE__ */ H(M, { className: "h-4 w-4" }), "Snooze"]
289
290
  }),
290
- /* @__PURE__ */ H("button", {
291
+ /* @__PURE__ */ U("button", {
291
292
  type: "button",
292
293
  onClick: () => s(e),
293
294
  disabled: r,
294
295
  className: X,
295
- children: [/* @__PURE__ */ V(B, { className: "h-4 w-4" }), "Dismiss"]
296
+ children: [/* @__PURE__ */ H(V, { className: "h-4 w-4" }), "Dismiss"]
296
297
  }),
297
- /* @__PURE__ */ H("button", {
298
+ /* @__PURE__ */ U("button", {
298
299
  type: "button",
299
300
  onClick: () => c(e.kind),
300
301
  disabled: r || i,
301
302
  className: X,
302
- title: i ? `${T(e.kind)} suggestions are already muted` : `Stop generating ${T(e.kind)} suggestions`,
303
- children: [/* @__PURE__ */ V(k, { className: "h-4 w-4" }), i ? "Muted" : "Mute this kind"]
303
+ title: i ? `${E(e.kind)} suggestions are already muted` : `Stop generating ${E(e.kind)} suggestions`,
304
+ children: [/* @__PURE__ */ H(re, { className: "h-4 w-4" }), i ? "Muted" : "Mute this kind"]
304
305
  })
305
306
  ]
306
- }) : /* @__PURE__ */ H("div", {
307
+ }) : /* @__PURE__ */ U("div", {
307
308
  className: "flex flex-col gap-2 pt-1",
308
- children: [/* @__PURE__ */ H("div", {
309
+ children: [/* @__PURE__ */ U("div", {
309
310
  className: "flex items-center justify-between gap-2",
310
- children: [/* @__PURE__ */ V(m, {
311
+ children: [/* @__PURE__ */ H(m, {
311
312
  variant: d.variant,
312
313
  label: d.label
313
- }), /* @__PURE__ */ V("span", {
314
+ }), /* @__PURE__ */ H("span", {
314
315
  className: "text-xs text-text-secondary",
315
- children: K(e.createdAt)
316
+ children: q(e.createdAt)
316
317
  })]
317
- }), e.state === W.Dismissed && e.dismissReason && /* @__PURE__ */ H("p", {
318
+ }), e.state === G.Dismissed && e.dismissReason && /* @__PURE__ */ U("p", {
318
319
  className: "text-xs text-text-secondary",
319
320
  children: ["Reason given: ", e.dismissReason]
320
321
  })]
@@ -322,102 +323,102 @@ function Se({ rec: e, busy: r, muted: i, onAccept: a, onSnooze: o, onDismiss: s,
322
323
  ]
323
324
  });
324
325
  }
325
- function Ce({ prefs: e, loading: t, saving: r, onToggleOutputGuard: a, onQuietHoursChange: o, onUnmuteKind: s }) {
326
- if (t) return /* @__PURE__ */ V(i, {
326
+ function Oe({ prefs: e, loading: t, saving: r, onToggleOutputGuard: a, onQuietHoursChange: o, onUnmuteKind: s, onAutonomousChange: c }) {
327
+ if (t) return /* @__PURE__ */ H(i, {
327
328
  variant: "card",
328
329
  count: 1
329
330
  });
330
331
  if (!e) return null;
331
- let c = x(e.quietHoursStart), l = x(e.quietHoursEnd), u = c !== null && l !== null, d = "rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-xs text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40 disabled:opacity-50";
332
- return /* @__PURE__ */ H(U, {
332
+ let l = S(e.quietHoursStart), u = S(e.quietHoursEnd), d = l !== null && u !== null, f = "rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-xs text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg/40 disabled:opacity-50";
333
+ return /* @__PURE__ */ U(W, {
333
334
  treatment: "glass",
334
335
  className: "p-4 sm:p-5",
335
336
  children: [
336
- /* @__PURE__ */ H("div", {
337
+ /* @__PURE__ */ U("div", {
337
338
  className: "flex items-center gap-2",
338
- children: [/* @__PURE__ */ V(L, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ V("h3", {
339
+ children: [/* @__PURE__ */ H(z, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ H("h3", {
339
340
  className: "text-sm font-semibold text-text-primary",
340
341
  children: "Guardrails"
341
342
  })]
342
343
  }),
343
- /* @__PURE__ */ V("p", {
344
+ /* @__PURE__ */ H("p", {
344
345
  className: "mt-1 text-xs text-text-secondary",
345
346
  children: "What TimeCampus is allowed to suggest, and when."
346
347
  }),
347
- /* @__PURE__ */ H("div", {
348
+ /* @__PURE__ */ U("div", {
348
349
  className: "mt-4 space-y-4",
349
350
  children: [
350
- /* @__PURE__ */ H("div", {
351
+ /* @__PURE__ */ U("div", {
351
352
  className: "flex items-start justify-between gap-3",
352
- children: [/* @__PURE__ */ H("div", {
353
+ children: [/* @__PURE__ */ U("div", {
353
354
  className: "min-w-0",
354
- children: [/* @__PURE__ */ V("p", {
355
+ children: [/* @__PURE__ */ H("p", {
355
356
  className: "text-sm font-medium text-text-primary",
356
357
  children: "Never suggest more work"
357
- }), /* @__PURE__ */ V("p", {
358
+ }), /* @__PURE__ */ H("p", {
358
359
  className: "mt-0.5 text-xs text-text-secondary",
359
360
  children: "Output-increasing suggestions are filtered out before they reach you."
360
361
  })]
361
- }), /* @__PURE__ */ V(xe, {
362
+ }), /* @__PURE__ */ H(Ee, {
362
363
  checked: e.neverOptimiseForOutput,
363
364
  disabled: r,
364
365
  label: "Never suggest more work",
365
366
  onChange: a
366
367
  })]
367
368
  }),
368
- /* @__PURE__ */ H("div", {
369
+ /* @__PURE__ */ U("div", {
369
370
  className: "border-t border-border-seam pt-4",
370
371
  children: [
371
- /* @__PURE__ */ H("div", {
372
+ /* @__PURE__ */ U("div", {
372
373
  className: "flex items-center justify-between gap-3",
373
- children: [/* @__PURE__ */ V("p", {
374
+ children: [/* @__PURE__ */ H("p", {
374
375
  className: "text-sm font-medium text-text-primary",
375
376
  children: "Quiet hours"
376
- }), /* @__PURE__ */ V("span", {
377
+ }), /* @__PURE__ */ H("span", {
377
378
  className: "text-xs text-text-secondary",
378
- children: u ? `${c}–${l}` : "Not set"
379
+ children: d ? `${l}–${u}` : "Not set"
379
380
  })]
380
381
  }),
381
- /* @__PURE__ */ V("p", {
382
+ /* @__PURE__ */ H("p", {
382
383
  className: "mt-0.5 text-xs text-text-secondary",
383
384
  children: "No nudges are sent inside this window."
384
385
  }),
385
- /* @__PURE__ */ H("div", {
386
+ /* @__PURE__ */ U("div", {
386
387
  className: "mt-2 flex flex-wrap items-center gap-2",
387
388
  children: [
388
- /* @__PURE__ */ H("label", {
389
+ /* @__PURE__ */ U("label", {
389
390
  className: "flex items-center gap-1.5 text-xs text-text-secondary",
390
- children: ["From", /* @__PURE__ */ H("select", {
391
- className: d,
391
+ children: ["From", /* @__PURE__ */ U("select", {
392
+ className: f,
392
393
  disabled: r,
393
394
  value: e.quietHoursStart ?? "",
394
395
  onChange: (t) => o(t.target.value === "" ? null : Number(t.target.value), e.quietHoursEnd ?? null),
395
- children: [/* @__PURE__ */ V("option", {
396
+ children: [/* @__PURE__ */ H("option", {
396
397
  value: "",
397
398
  children: "—"
398
- }), q.map((e) => /* @__PURE__ */ V("option", {
399
+ }), J.map((e) => /* @__PURE__ */ H("option", {
399
400
  value: e,
400
- children: x(e)
401
+ children: S(e)
401
402
  }, e))]
402
403
  })]
403
404
  }),
404
- /* @__PURE__ */ H("label", {
405
+ /* @__PURE__ */ U("label", {
405
406
  className: "flex items-center gap-1.5 text-xs text-text-secondary",
406
- children: ["To", /* @__PURE__ */ H("select", {
407
- className: d,
407
+ children: ["To", /* @__PURE__ */ U("select", {
408
+ className: f,
408
409
  disabled: r,
409
410
  value: e.quietHoursEnd ?? "",
410
411
  onChange: (t) => o(e.quietHoursStart ?? null, t.target.value === "" ? null : Number(t.target.value)),
411
- children: [/* @__PURE__ */ V("option", {
412
+ children: [/* @__PURE__ */ H("option", {
412
413
  value: "",
413
414
  children: "—"
414
- }), q.map((e) => /* @__PURE__ */ V("option", {
415
+ }), J.map((e) => /* @__PURE__ */ H("option", {
415
416
  value: e,
416
- children: x(e)
417
+ children: S(e)
417
418
  }, e))]
418
419
  })]
419
420
  }),
420
- u && /* @__PURE__ */ V("button", {
421
+ d && /* @__PURE__ */ H("button", {
421
422
  type: "button",
422
423
  disabled: r,
423
424
  onClick: () => o(null, null),
@@ -428,70 +429,173 @@ function Ce({ prefs: e, loading: t, saving: r, onToggleOutputGuard: a, onQuietHo
428
429
  })
429
430
  ]
430
431
  }),
431
- /* @__PURE__ */ H("div", {
432
+ /* @__PURE__ */ U("div", {
432
433
  className: "border-t border-border-seam pt-4",
433
- children: [/* @__PURE__ */ H("div", {
434
+ children: [/* @__PURE__ */ U("div", {
434
435
  className: "flex items-center justify-between gap-3",
435
- children: [/* @__PURE__ */ V("p", {
436
+ children: [/* @__PURE__ */ H("p", {
436
437
  className: "text-sm font-medium text-text-primary",
437
438
  children: "Muted kinds"
438
- }), /* @__PURE__ */ V("span", {
439
+ }), /* @__PURE__ */ H("span", {
439
440
  className: Z,
440
441
  children: e.mutedKinds.length
441
442
  })]
442
- }), e.mutedKinds.length === 0 ? /* @__PURE__ */ V("p", {
443
+ }), e.mutedKinds.length === 0 ? /* @__PURE__ */ H("p", {
443
444
  className: "mt-0.5 text-xs text-text-secondary",
444
445
  children: "Nothing muted — mute a kind from any suggestion to stop it coming back."
445
- }) : /* @__PURE__ */ V("div", {
446
+ }) : /* @__PURE__ */ H("div", {
446
447
  className: "mt-2 flex flex-wrap gap-1.5",
447
- children: e.mutedKinds.map((e) => /* @__PURE__ */ H("button", {
448
+ children: e.mutedKinds.map((e) => /* @__PURE__ */ U("button", {
448
449
  type: "button",
449
450
  disabled: r,
450
451
  onClick: () => s(e),
451
452
  className: n(Z, "hover:text-text-primary disabled:opacity-50"),
452
- title: `Unmute ${T(e)} suggestions`,
453
- children: [T(e), /* @__PURE__ */ V(B, { className: "h-3 w-3" })]
453
+ title: `Unmute ${E(e)} suggestions`,
454
+ children: [E(e), /* @__PURE__ */ H(V, { className: "h-3 w-3" })]
454
455
  }, e))
455
456
  })]
456
457
  }),
457
- /* @__PURE__ */ H("div", {
458
+ /* @__PURE__ */ U("div", {
458
459
  className: "border-t border-border-seam pt-4",
459
- children: [/* @__PURE__ */ H("div", {
460
- className: "flex items-center justify-between gap-3",
461
- children: [/* @__PURE__ */ V("p", {
462
- className: "text-sm font-medium text-text-primary",
463
- children: "Cadence"
464
- }), /* @__PURE__ */ V("span", {
465
- className: "text-xs text-text-secondary",
466
- children: S(e.cadence)
467
- })]
468
- }), e.optedInDomains.length > 0 && /* @__PURE__ */ H(me, { children: [/* @__PURE__ */ V("p", {
469
- className: "mt-3 text-sm font-medium text-text-primary",
470
- children: "Opted-in domains"
471
- }), /* @__PURE__ */ V("div", {
472
- className: "mt-1.5 flex flex-wrap gap-1.5",
473
- children: e.optedInDomains.map((e) => /* @__PURE__ */ V("span", {
474
- className: Z,
475
- children: y(e)
476
- }, e))
477
- })] })]
460
+ "data-testid": "autonomous-digests",
461
+ children: [
462
+ /* @__PURE__ */ U("div", {
463
+ className: "flex items-start justify-between gap-3",
464
+ children: [/* @__PURE__ */ U("div", {
465
+ className: "min-w-0",
466
+ children: [/* @__PURE__ */ H("p", {
467
+ className: "text-sm font-medium text-text-primary",
468
+ children: "Send me digests without asking"
469
+ }), /* @__PURE__ */ H("p", {
470
+ className: "mt-0.5 text-xs text-text-secondary",
471
+ children: "Off unless you turn it on. TimeCampus then sends a short summary of your own tracked time to your notifications, and you can turn it off here at any time. Quiet hours and muted kinds still apply."
472
+ })]
473
+ }), /* @__PURE__ */ H(Ee, {
474
+ checked: e.autonomousEnabled,
475
+ disabled: r,
476
+ label: "Send me digests without asking",
477
+ onChange: (e) => c({ autonomousEnabled: e })
478
+ })]
479
+ }),
480
+ e.autonomousEnabled && /* @__PURE__ */ U("div", {
481
+ className: "mt-3 flex flex-col gap-2",
482
+ children: [
483
+ /* @__PURE__ */ U("label", {
484
+ className: "flex flex-wrap items-center gap-1.5 text-xs text-text-secondary",
485
+ children: ["What to send", /* @__PURE__ */ H("select", {
486
+ className: f,
487
+ disabled: r,
488
+ value: e.cadence,
489
+ "aria-label": "What to send",
490
+ onChange: (e) => c({ cadence: e.target.value }),
491
+ children: O.map((e) => /* @__PURE__ */ H("option", {
492
+ value: e.value,
493
+ children: e.label
494
+ }, e.value))
495
+ })]
496
+ }),
497
+ /* @__PURE__ */ U("label", {
498
+ className: "flex flex-wrap items-center gap-1.5 text-xs text-text-secondary",
499
+ children: ["Not before", /* @__PURE__ */ H("select", {
500
+ className: f,
501
+ disabled: r,
502
+ value: e.digestHourUtc,
503
+ "aria-label": "Not before",
504
+ onChange: (e) => c({ digestHourUtc: Number(e.target.value) }),
505
+ children: J.map((e) => /* @__PURE__ */ H("option", {
506
+ value: e,
507
+ children: k(e)
508
+ }, e))
509
+ })]
510
+ }),
511
+ /* @__PURE__ */ U("label", {
512
+ className: "flex flex-wrap items-center gap-1.5 text-xs text-text-secondary",
513
+ children: ["Weekly digest on", /* @__PURE__ */ H("select", {
514
+ className: f,
515
+ disabled: r,
516
+ value: e.weeklyDigestDay,
517
+ "aria-label": "Weekly digest on",
518
+ onChange: (e) => c({ weeklyDigestDay: Number(e.target.value) }),
519
+ children: te.map((e) => /* @__PURE__ */ H("option", {
520
+ value: e.value,
521
+ children: e.label
522
+ }, e.value))
523
+ })]
524
+ })
525
+ ]
526
+ }),
527
+ e.optedInDomains.length > 0 && /* @__PURE__ */ U(ve, { children: [/* @__PURE__ */ H("p", {
528
+ className: "mt-3 text-sm font-medium text-text-primary",
529
+ children: "Opted-in domains"
530
+ }), /* @__PURE__ */ H("div", {
531
+ className: "mt-1.5 flex flex-wrap gap-1.5",
532
+ children: e.optedInDomains.map((e) => /* @__PURE__ */ H("span", {
533
+ className: Z,
534
+ children: y(e)
535
+ }, e))
536
+ })] })
537
+ ]
478
538
  })
479
539
  ]
480
540
  })
481
541
  ]
482
542
  });
483
543
  }
484
- function we(e) {
544
+ var ke = {
545
+ success: "success",
546
+ neutral: "muted",
547
+ warning: "warning"
548
+ };
549
+ function Ae({ deliveries: e, loading: t, enabled: n }) {
550
+ return t || !n && e.length === 0 ? null : /* @__PURE__ */ U(W, {
551
+ treatment: "glass",
552
+ className: "mt-4 p-4 sm:p-5",
553
+ "data-testid": "recent-digests",
554
+ children: [/* @__PURE__ */ H("h3", {
555
+ className: "text-sm font-semibold text-text-primary",
556
+ children: "Recent digests"
557
+ }), e.length === 0 ? /* @__PURE__ */ H("p", {
558
+ className: "mt-1 text-xs text-text-secondary",
559
+ children: "Nothing yet. Your first digest arrives after the time you chose."
560
+ }) : /* @__PURE__ */ H("ul", {
561
+ className: "mt-3 space-y-3",
562
+ children: e.map((e) => {
563
+ let t = ne(e);
564
+ return /* @__PURE__ */ U("li", {
565
+ className: "flex flex-col gap-1",
566
+ children: [/* @__PURE__ */ U("div", {
567
+ className: "flex items-center justify-between gap-2",
568
+ children: [/* @__PURE__ */ H("span", {
569
+ className: "text-xs font-medium text-text-primary",
570
+ children: t.title
571
+ }), /* @__PURE__ */ H(m, {
572
+ variant: ke[t.tone],
573
+ label: e.trigger === "SCHEDULED" ? "Automatic" : "Manual"
574
+ })]
575
+ }), /* @__PURE__ */ U("span", {
576
+ className: "text-xs text-text-secondary",
577
+ children: [
578
+ t.status,
579
+ " · ",
580
+ q(e.createdAt)
581
+ ]
582
+ })]
583
+ }, e.id);
584
+ })
585
+ })]
586
+ });
587
+ }
588
+ function je(e) {
485
589
  switch (e) {
486
- case W.Snoozed: return {
590
+ case G.Snoozed: return {
487
591
  title: "Nothing snoozed",
488
592
  description: "Suggestions you snooze for later will wait here quietly until they're worth another look."
489
593
  };
490
- case W.Accepted: return {
594
+ case G.Accepted: return {
491
595
  title: "Nothing accepted yet",
492
596
  description: "When you accept a suggestion it moves here, so you can see the changes you chose to make."
493
597
  };
494
- case W.Dismissed: return {
598
+ case G.Dismissed: return {
495
599
  title: "Nothing dismissed",
496
600
  description: "Suggestions you dismiss are kept here — TimeCampus learns from them and won't keep nagging."
497
601
  };
@@ -501,22 +605,25 @@ function we(e) {
501
605
  };
502
606
  }
503
607
  }
504
- function Te() {
505
- let { workspaceId: t } = e(), { toasts: n, addToast: m, dismissToast: v } = _(), [y, ee] = O(W.New), [b, x] = O(null), [S, C] = O(null), [w, E] = O(""), { data: k, loading: te, error: ne, refetch: A } = u({
608
+ function Q() {
609
+ let { workspaceId: t } = e(), { toasts: n, addToast: m, dismissToast: v } = _(), [y, b] = j(G.New), [x, S] = j(null), [C, w] = j(null), [T, D] = j(""), { data: O, loading: te, error: ne, refetch: k } = u({
506
610
  variables: { state: null },
507
611
  skip: !t
508
- }), { data: re, loading: ae, refetch: oe } = l({ skip: !t }), [ce, { loading: j }] = c(), [le] = o(), [ue] = s(), [de] = d(), [fe, { loading: M }] = f(), N = re?.myRecommendationPreferences, P = D(() => new Set(N?.mutedKinds ?? []), [N?.mutedKinds]), F = D(() => k?.myRecommendations ?? [], [k?.myRecommendations]), I = D(() => {
612
+ }), { data: re, loading: ie, refetch: ae } = l({ skip: !t }), [oe, { loading: se }] = c(), [le] = o(), [ue] = s(), [de] = f(), [fe, { loading: N }] = ee(), { data: pe, loading: me, refetch: he } = d({
613
+ variables: { limit: 5 },
614
+ skip: !t
615
+ }), P = re?.myRecommendationPreferences, F = A(() => new Set(P?.mutedKinds ?? []), [P?.mutedKinds]), I = A(() => O?.myRecommendations ?? [], [O?.myRecommendations]), L = A(() => {
509
616
  let e = {};
510
- for (let t of F) e[t.state] = (e[t.state] ?? 0) + 1;
617
+ for (let t of I) e[t.state] = (e[t.state] ?? 0) + 1;
511
618
  return e;
512
- }, [F]), z = D(() => F.filter((e) => e.state === y), [F, y]), pe = I[W.New] ?? 0, ge = I[W.Accepted] ?? 0, ve = I[W.Snoozed] ?? 0, G = async () => {
619
+ }, [I]), R = A(() => I.filter((e) => e.state === y), [I, y]), ge = L[G.New] ?? 0, _e = L[G.Accepted] ?? 0, be = L[G.Snoozed] ?? 0, Se = async () => {
513
620
  try {
514
- let e = (await ce()).data?.generateMyRecommendations ?? [];
621
+ let e = (await oe()).data?.generateMyRecommendations ?? [];
515
622
  m({
516
623
  title: e.length > 0 ? `${e.length} suggestion${e.length === 1 ? "" : "s"} ready` : "No new suggestions",
517
624
  description: e.length > 0 ? "Fresh, values-aware ideas are in your New feed." : "You're all caught up — nothing new to suggest right now.",
518
625
  variant: e.length > 0 ? "success" : "info"
519
- }), ee(W.New), await A();
626
+ }), b(G.New), await k();
520
627
  } catch {
521
628
  m({
522
629
  title: "Couldn't generate recommendations",
@@ -525,46 +632,46 @@ function Te() {
525
632
  });
526
633
  }
527
634
  }, K = async (e) => {
528
- x(e);
635
+ S(e);
529
636
  try {
530
637
  await le({ variables: { id: e } }), m({
531
638
  title: "Accepted — nice",
532
639
  variant: "success"
533
- }), await A();
640
+ }), await k();
534
641
  } catch {
535
642
  m({
536
643
  title: "Couldn't accept that one",
537
644
  variant: "error"
538
645
  });
539
646
  } finally {
540
- x(null);
647
+ S(null);
541
648
  }
542
649
  }, q = async (e) => {
543
- x(e);
650
+ S(e);
544
651
  try {
545
652
  await de({ variables: {
546
653
  id: e,
547
- until: _e()
654
+ until: xe()
548
655
  } }), m({
549
656
  title: "Snoozed for a week",
550
657
  description: "It'll resurface later — no nagging in between.",
551
658
  variant: "info"
552
- }), await A();
659
+ }), await k();
553
660
  } catch {
554
661
  m({
555
662
  title: "Couldn't snooze that one",
556
663
  variant: "error"
557
664
  });
558
665
  } finally {
559
- x(null);
666
+ S(null);
560
667
  }
561
- }, ye = (e) => {
562
- E(""), C(e);
563
- }, be = async () => {
564
- let e = S;
668
+ }, J = (e) => {
669
+ D(""), w(e);
670
+ }, Ce = async () => {
671
+ let e = C;
565
672
  if (!e) return;
566
- let t = w.trim();
567
- x(e.id);
673
+ let t = T.trim();
674
+ S(e.id);
568
675
  try {
569
676
  await ue({ variables: {
570
677
  id: e.id,
@@ -572,21 +679,21 @@ function Te() {
572
679
  } }), m({
573
680
  title: "Dismissed",
574
681
  variant: "success"
575
- }), C(null), E(""), await A();
682
+ }), w(null), D(""), await k();
576
683
  } catch {
577
684
  m({
578
685
  title: "Couldn't dismiss that one",
579
686
  variant: "error"
580
687
  });
581
688
  } finally {
582
- x(null);
689
+ S(null);
583
690
  }
584
- }, J = async (e, t) => {
691
+ }, Y = async (e, t) => {
585
692
  try {
586
693
  await fe({ variables: { input: e } }), m({
587
694
  title: t,
588
695
  variant: "success"
589
- }), await oe();
696
+ }), await ae();
590
697
  } catch {
591
698
  m({
592
699
  title: "Couldn't save that guardrail",
@@ -594,115 +701,125 @@ function Te() {
594
701
  variant: "error"
595
702
  });
596
703
  }
597
- }, Z = (e) => void J({ neverOptimiseForOutput: e }, e ? "Output-increasing suggestions are off" : "Output-increasing suggestions allowed"), xe = (e, t) => void J({
704
+ }, we = (e) => void Y({ neverOptimiseForOutput: e }, e ? "Output-increasing suggestions are off" : "Output-increasing suggestions allowed"), Z = (e, t) => void Y({
598
705
  quietHoursStart: e,
599
706
  quietHoursEnd: t
600
- }, e === null && t === null ? "Quiet hours cleared" : "Quiet hours saved"), Te = (e) => {
601
- P.has(e) || J({ mutedKinds: [...P, e] }, `${T(e)} suggestions muted`);
602
- }, Ee = /* @__PURE__ */ V(Ce, {
603
- prefs: N,
604
- loading: ae,
605
- saving: M,
606
- onToggleOutputGuard: Z,
607
- onQuietHoursChange: xe,
608
- onUnmuteKind: (e) => void J({ mutedKinds: [...P].filter((t) => t !== e) }, `${T(e)} suggestions unmuted`)
609
- }), Q = /* @__PURE__ */ H("button", {
707
+ }, e === null && t === null ? "Quiet hours cleared" : "Quiet hours saved"), Ee = (e) => {
708
+ F.has(e) || Y({ mutedKinds: [...F, e] }, `${E(e)} suggestions muted`);
709
+ }, ke = /* @__PURE__ */ H(Oe, {
710
+ prefs: P,
711
+ loading: ie,
712
+ saving: N,
713
+ onToggleOutputGuard: we,
714
+ onQuietHoursChange: Z,
715
+ onUnmuteKind: (e) => void Y({ mutedKinds: [...F].filter((t) => t !== e) }, `${E(e)} suggestions unmuted`),
716
+ onAutonomousChange: (e) => {
717
+ (async () => {
718
+ let t = "Digest settings saved";
719
+ e.autonomousEnabled === !0 && (t = "Digests turned on"), e.autonomousEnabled === !1 && (t = "Digests turned off"), await Y(e, t), await he();
720
+ })();
721
+ }
722
+ }), Q = /* @__PURE__ */ H(Ae, {
723
+ deliveries: pe?.myTimeIntelligenceDeliveries ?? [],
724
+ loading: me,
725
+ enabled: P?.autonomousEnabled ?? !1
726
+ }), $ = /* @__PURE__ */ U("button", {
610
727
  type: "button",
611
- onClick: G,
612
- disabled: j || !t,
613
- className: Y,
614
- children: [/* @__PURE__ */ V(R, { className: "h-4 w-4" }), j ? "Generating…" : "Generate recommendations"]
615
- }), $ = "Gentle, values-aware nudges built from your real timeline — protect a focus block, reclaim a commute, guard family time. Accept the ones that fit, snooze the rest, and dismiss what doesn't. TimeCampus never optimises for more output — only for time that matches what you value.", De = /* @__PURE__ */ V(U, {
728
+ onClick: Se,
729
+ disabled: se || !t,
730
+ className: Te,
731
+ children: [/* @__PURE__ */ H(B, { className: "h-4 w-4" }), se ? "Generating…" : "Generate recommendations"]
732
+ }), Me = "Gentle, values-aware nudges built from your real timeline — protect a focus block, reclaim a commute, guard family time. Accept the ones that fit, snooze the rest, and dismiss what doesn't. TimeCampus never optimises for more output — only for time that matches what you value.", Ne = /* @__PURE__ */ H(W, {
616
733
  treatment: "insight",
617
734
  className: "mt-6 p-4 sm:p-5",
618
- children: /* @__PURE__ */ H("div", {
735
+ children: /* @__PURE__ */ U("div", {
619
736
  className: "flex items-start gap-3",
620
- children: [/* @__PURE__ */ V("span", {
737
+ children: [/* @__PURE__ */ H("span", {
621
738
  className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-status-info-bg text-status-info-text",
622
- children: /* @__PURE__ */ V(L, { className: "h-5 w-5" })
623
- }), /* @__PURE__ */ H("div", {
739
+ children: /* @__PURE__ */ H(z, { className: "h-5 w-5" })
740
+ }), /* @__PURE__ */ U("div", {
624
741
  className: "min-w-0",
625
- children: [/* @__PURE__ */ V("h3", {
742
+ children: [/* @__PURE__ */ H("h3", {
626
743
  className: "text-sm font-semibold text-text-primary",
627
744
  children: "Never optimises for more output."
628
- }), /* @__PURE__ */ V("p", {
745
+ }), /* @__PURE__ */ H("p", {
629
746
  className: "mt-1 text-sm text-text-secondary",
630
747
  children: "Every suggestion protects something you value — rest, focus, relationships — not your throughput. Snooze or dismiss freely; TimeCampus takes the hint and won't keep nagging."
631
748
  })]
632
749
  })]
633
750
  })
634
751
  });
635
- if (!t || te) return /* @__PURE__ */ V(p, {
752
+ if (!t || te) return /* @__PURE__ */ H(p, {
636
753
  title: "Recommendations",
637
754
  description: "Values-aware suggestions from your real timeline",
638
- purpose: $,
639
- actions: Q,
640
- children: /* @__PURE__ */ V(i, {
755
+ purpose: Me,
756
+ actions: $,
757
+ children: /* @__PURE__ */ H(i, {
641
758
  variant: "list",
642
759
  count: 4
643
760
  })
644
761
  });
645
- if (ne) return /* @__PURE__ */ V(p, {
762
+ if (ne) return /* @__PURE__ */ H(p, {
646
763
  title: "Recommendations",
647
764
  description: "Values-aware suggestions from your real timeline",
648
- purpose: $,
649
- actions: Q,
650
- children: /* @__PURE__ */ V("div", {
765
+ purpose: Me,
766
+ actions: $,
767
+ children: /* @__PURE__ */ H("div", {
651
768
  className: "rounded-xl border border-status-error-border/50 bg-status-error-bg/10 p-4 text-sm text-status-error-text",
652
769
  children: "Couldn't load your recommendations right now. Please try again in a moment."
653
770
  })
654
771
  });
655
- let Oe = F.length > 0, ke = we(y);
656
- return /* @__PURE__ */ H(p, {
772
+ let Pe = I.length > 0, Fe = je(y);
773
+ return /* @__PURE__ */ U(p, {
657
774
  title: "Recommendations",
658
775
  description: "Values-aware suggestions from your real timeline",
659
- purpose: $,
660
- actions: Q,
776
+ purpose: Me,
777
+ actions: $,
661
778
  children: [
662
- Oe ? /* @__PURE__ */ H("div", {
779
+ Pe ? /* @__PURE__ */ U("div", {
663
780
  className: "grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]",
664
- children: [/* @__PURE__ */ H("div", {
781
+ children: [/* @__PURE__ */ U("div", {
665
782
  className: "min-w-0 space-y-6",
666
783
  children: [
667
- /* @__PURE__ */ H("div", {
784
+ /* @__PURE__ */ U("div", {
668
785
  className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
669
786
  children: [
670
- /* @__PURE__ */ V(r, {
787
+ /* @__PURE__ */ H(r, {
671
788
  featured: !0,
672
789
  title: "New for you",
673
- value: String(pe),
674
- icon: /* @__PURE__ */ V(R, { className: "h-5 w-5" }),
790
+ value: String(ge),
791
+ icon: /* @__PURE__ */ H(B, { className: "h-5 w-5" }),
675
792
  description: "Awaiting your call"
676
793
  }),
677
- /* @__PURE__ */ V(r, {
794
+ /* @__PURE__ */ H(r, {
678
795
  title: "Accepted",
679
- value: String(ge),
680
- icon: /* @__PURE__ */ V(ie, { className: "h-5 w-5" }),
796
+ value: String(_e),
797
+ icon: /* @__PURE__ */ H(ce, { className: "h-5 w-5" }),
681
798
  description: "Changes you chose to make"
682
799
  }),
683
- /* @__PURE__ */ V(r, {
800
+ /* @__PURE__ */ H(r, {
684
801
  title: "Snoozed",
685
- value: String(ve),
686
- icon: /* @__PURE__ */ V(se, { className: "h-5 w-5" }),
802
+ value: String(be),
803
+ icon: /* @__PURE__ */ H(M, { className: "h-5 w-5" }),
687
804
  description: "Waiting for a better moment"
688
805
  })
689
806
  ]
690
807
  }),
691
- /* @__PURE__ */ V("div", {
808
+ /* @__PURE__ */ H("div", {
692
809
  className: "overflow-x-auto",
693
- children: /* @__PURE__ */ V("div", {
810
+ children: /* @__PURE__ */ H("div", {
694
811
  className: "inline-flex items-center rounded-lg border border-border-subtle bg-bg-sunken/50 p-0.5",
695
812
  role: "tablist",
696
813
  "aria-label": "Filter recommendations by state",
697
- children: he.map((e) => {
698
- let t = e.key === y, n = I[e.key] ?? 0;
699
- return /* @__PURE__ */ H("button", {
814
+ children: ye.map((e) => {
815
+ let t = e.key === y, n = L[e.key] ?? 0;
816
+ return /* @__PURE__ */ U("button", {
700
817
  type: "button",
701
818
  role: "tab",
702
819
  "aria-selected": t,
703
- onClick: () => ee(e.key),
820
+ onClick: () => b(e.key),
704
821
  className: t ? "flex items-center gap-1.5 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-primary shadow-sm" : "flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-text-secondary transition-colors hover:text-text-primary",
705
- children: [e.label, /* @__PURE__ */ V("span", {
822
+ children: [e.label, /* @__PURE__ */ H("span", {
706
823
  className: t ? "rounded-full bg-action-primary-bg/15 px-1.5 text-xs font-semibold text-primary" : "rounded-full bg-bg-sunken px-1.5 text-xs font-semibold text-text-secondary",
707
824
  children: n
708
825
  })]
@@ -710,81 +827,81 @@ function Te() {
710
827
  })
711
828
  })
712
829
  }),
713
- z.length === 0 ? /* @__PURE__ */ V(a, {
830
+ R.length === 0 ? /* @__PURE__ */ H(a, {
714
831
  illustration: "empty-data",
715
- title: ke.title,
716
- description: ke.description,
717
- action: y === W.New ? Q : void 0
718
- }) : /* @__PURE__ */ V("div", {
832
+ title: Fe.title,
833
+ description: Fe.description,
834
+ action: y === G.New ? $ : void 0
835
+ }) : /* @__PURE__ */ H("div", {
719
836
  className: "space-y-4",
720
- children: z.map((e) => /* @__PURE__ */ V(Se, {
837
+ children: R.map((e) => /* @__PURE__ */ H(De, {
721
838
  rec: e,
722
- busy: b === e.id || M,
723
- muted: P.has(e.kind),
839
+ busy: x === e.id || N,
840
+ muted: F.has(e.kind),
724
841
  onAccept: K,
725
842
  onSnooze: q,
726
- onDismiss: ye,
727
- onMuteKind: Te
843
+ onDismiss: J,
844
+ onMuteKind: Ee
728
845
  }, e.id))
729
846
  }),
730
- De
847
+ Ne
731
848
  ]
732
- }), /* @__PURE__ */ V("div", { children: Ee })]
733
- }) : /* @__PURE__ */ H("div", {
849
+ }), /* @__PURE__ */ U("div", { children: [ke, Q] })]
850
+ }) : /* @__PURE__ */ U("div", {
734
851
  className: "grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]",
735
- children: [/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V(a, {
852
+ children: [/* @__PURE__ */ U("div", { children: [/* @__PURE__ */ H(a, {
736
853
  illustration: "empty-data",
737
854
  title: "No recommendations yet",
738
855
  description: "TimeCampus turns your real timeline into gentle, values-aware suggestions — like protecting a focus block or reclaiming a commute. Generate your first set to see what it notices.",
739
- action: Q
740
- }), De] }), /* @__PURE__ */ V("div", { children: Ee })]
856
+ action: $
857
+ }), Ne] }), /* @__PURE__ */ U("div", { children: [ke, Q] })]
741
858
  }),
742
- /* @__PURE__ */ H(h, {
743
- open: S !== null,
744
- onClose: () => C(null),
859
+ /* @__PURE__ */ U(h, {
860
+ open: C !== null,
861
+ onClose: () => w(null),
745
862
  title: "Dismiss this suggestion",
746
- description: S?.title,
863
+ description: C?.title,
747
864
  size: "sm",
748
- footer: /* @__PURE__ */ H(me, { children: [/* @__PURE__ */ V("button", {
865
+ footer: /* @__PURE__ */ U(ve, { children: [/* @__PURE__ */ H("button", {
749
866
  type: "button",
750
- onClick: () => C(null),
867
+ onClick: () => w(null),
751
868
  className: X,
752
869
  children: "Cancel"
753
- }), /* @__PURE__ */ H("button", {
870
+ }), /* @__PURE__ */ U("button", {
754
871
  type: "button",
755
- onClick: () => void be(),
756
- disabled: b !== null,
757
- className: Y,
758
- children: [/* @__PURE__ */ V(B, { className: "h-4 w-4" }), "Dismiss"]
872
+ onClick: () => void Ce(),
873
+ disabled: x !== null,
874
+ className: Te,
875
+ children: [/* @__PURE__ */ H(V, { className: "h-4 w-4" }), "Dismiss"]
759
876
  })] }),
760
877
  children: [
761
- /* @__PURE__ */ H("label", {
878
+ /* @__PURE__ */ U("label", {
762
879
  htmlFor: "rec-dismiss-reason",
763
880
  className: "block text-sm font-medium text-text-primary",
764
881
  children: [
765
882
  "Why isn't this one for you?",
766
883
  " ",
767
- /* @__PURE__ */ V("span", {
884
+ /* @__PURE__ */ H("span", {
768
885
  className: "font-normal text-text-secondary",
769
886
  children: "(optional)"
770
887
  })
771
888
  ]
772
889
  }),
773
- /* @__PURE__ */ V("textarea", {
890
+ /* @__PURE__ */ H("textarea", {
774
891
  id: "rec-dismiss-reason",
775
892
  rows: 3,
776
- value: w,
777
- onChange: (e) => E(e.target.value),
893
+ value: T,
894
+ onChange: (e) => D(e.target.value),
778
895
  placeholder: "e.g. already handled, not the right week",
779
896
  className: "mt-1.5 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary"
780
897
  }),
781
- /* @__PURE__ */ V("p", {
898
+ /* @__PURE__ */ H("p", {
782
899
  className: "mt-2 text-xs text-text-secondary",
783
900
  children: "Saved with the suggestion so you can see why you passed on it later. To stop this kind of suggestion entirely, use Mute this kind."
784
901
  })
785
902
  ]
786
903
  }),
787
- /* @__PURE__ */ V(g, {
904
+ /* @__PURE__ */ H(g, {
788
905
  toasts: n,
789
906
  onDismiss: v
790
907
  })
@@ -792,6 +909,6 @@ function Te() {
792
909
  });
793
910
  }
794
911
  //#endregion
795
- export { Te as RecommendationsPage };
912
+ export { Q as RecommendationsPage };
796
913
 
797
914
  //# sourceMappingURL=RecommendationsPage.js.map