@mcp-b/react-components 0.69.0 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/AgentComputer-CpS9R2KG.d.ts +305 -0
  2. package/dist/{AgentComputer-CFJxjMFE.js → AgentComputer-DZCyQkcE.js} +1850 -478
  3. package/dist/CommandPalette-DDctKdpC.d.ts +53 -0
  4. package/dist/ComputerCalendar-Ci7tLASe.js +1360 -0
  5. package/dist/ComputerCustomWallpaper-CnGQYHp0.js +518 -0
  6. package/dist/ComputerCustomWallpaper-D4lgwj2k.d.ts +18 -0
  7. package/dist/ComputerNotifications-q7eeELZ8.d.ts +41 -0
  8. package/dist/ComputerPresentation-BEQKYAjc.js +888 -0
  9. package/dist/Context-CYUxZrwW.js +918 -0
  10. package/dist/{ExecutionResult-C7SzVquo.js → ExecutionResult-CXnGcmM4.js} +1 -1
  11. package/dist/{WorkspaceBrowser-ojoZy0uO.js → WorkspaceBrowser-mRScUczT.js} +5 -5
  12. package/dist/WorkspaceFileTransfer-D2cOoVyO.js +1625 -0
  13. package/dist/{WorkspaceMessageResponse-BoeeltJM.js → WorkspaceMessageResponse-CXGOQgpo.js} +1 -1
  14. package/dist/components/agents-sdk/AgentComputer.d.ts +2 -276
  15. package/dist/components/agents-sdk/AgentComputer.js +1 -1
  16. package/dist/components/agents-sdk/BrowserReplay.js +1 -1
  17. package/dist/components/agents-sdk/ComputerAutomations.d.ts +5 -15
  18. package/dist/components/agents-sdk/ComputerAutomations.js +164 -145
  19. package/dist/components/agents-sdk/ComputerCalendar.d.ts +1 -1
  20. package/dist/components/agents-sdk/ComputerCalendar.js +1 -1344
  21. package/dist/components/agents-sdk/ComputerCustomWallpaper.d.ts +2 -39
  22. package/dist/components/agents-sdk/ComputerCustomWallpaper.js +2 -522
  23. package/dist/components/agents-sdk/ComputerFiles.d.ts +18 -81
  24. package/dist/components/agents-sdk/ComputerFiles.js +365 -89
  25. package/dist/components/agents-sdk/ComputerHome.d.ts +6 -11
  26. package/dist/components/agents-sdk/ComputerHome.js +1 -89
  27. package/dist/components/agents-sdk/ComputerHost.d.ts +43 -0
  28. package/dist/components/agents-sdk/ComputerHost.js +97 -0
  29. package/dist/components/agents-sdk/ComputerLayout.d.ts +1 -1
  30. package/dist/components/agents-sdk/ComputerNotifications.d.ts +2 -54
  31. package/dist/components/agents-sdk/ComputerNotifications.js +1 -668
  32. package/dist/components/agents-sdk/ComputerPresentation.d.ts +2 -0
  33. package/dist/components/agents-sdk/ComputerPresentation.js +2 -0
  34. package/dist/components/agents-sdk/ComputerScreen.d.ts +14 -14
  35. package/dist/components/agents-sdk/ComputerScreen.js +109 -50
  36. package/dist/components/agents-sdk/ComputerSettings.d.ts +12 -40
  37. package/dist/components/agents-sdk/ComputerSettings.js +249 -1038
  38. package/dist/components/agents-sdk/ComputerSpotlight.d.ts +13 -15
  39. package/dist/components/agents-sdk/ComputerSpotlight.js +1 -231
  40. package/dist/components/agents-sdk/ComputerViewer.d.ts +13 -17
  41. package/dist/components/agents-sdk/ComputerViewer.js +176 -187
  42. package/dist/components/agents-sdk/ComputerWallpapers.d.ts +1 -1
  43. package/dist/components/agents-sdk/EmployeeChat.js +2 -2
  44. package/dist/components/agents-sdk/EmployeeChrome.js +3 -3
  45. package/dist/components/agents-sdk/EmployeeSchedules.js +2 -2
  46. package/dist/components/agents-sdk/ExecutionBoard.js +1 -1
  47. package/dist/components/agents-sdk/ManagerOffice.js +1 -1
  48. package/dist/components/agents-sdk/ManagerOfficeScreens.js +2 -2
  49. package/dist/components/agents-sdk/McpPluginCatalog.js +1 -1
  50. package/dist/components/agents-sdk/ThinkChat.js +1 -1
  51. package/dist/components/agents-sdk/ThinkChatToolPanels.js +3 -3
  52. package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
  53. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +2 -2
  54. package/dist/components/agents-sdk/ThinkScheduleActions.js +1 -1
  55. package/dist/components/agents-sdk/ThinkScheduleBrowser.js +1 -1
  56. package/dist/components/agents-sdk/ThinkScheduleDetail.js +4 -4
  57. package/dist/components/agents-sdk/ThinkScheduleForm.js +3 -3
  58. package/dist/components/agents-sdk/WorkspaceAutomation.js +3 -3
  59. package/dist/components/agents-sdk/WorkspaceAutomationTable.js +1 -1
  60. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  61. package/dist/components/agents-sdk/WorkspaceDesktop.d.ts +1 -5
  62. package/dist/components/agents-sdk/WorkspaceDesktop.js +53 -41
  63. package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -3
  64. package/dist/components/agents-sdk/WorkspaceFileCommands.js +1 -924
  65. package/dist/components/agents-sdk/WorkspaceFileDetails.js +1 -1
  66. package/dist/components/agents-sdk/WorkspaceFileTransfer.js +1 -504
  67. package/dist/components/agents-sdk/WorkspaceFileView.js +6 -6
  68. package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
  69. package/dist/components/agents-sdk/WorkspaceLive.d.ts +9 -0
  70. package/dist/components/agents-sdk/WorkspaceLive.js +2 -177
  71. package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
  72. package/dist/components/agents-sdk/WorkspaceMountManager.js +1 -1
  73. package/dist/components/ai-sdk/Context.js +1 -842
  74. package/dist/components/ai-sdk/Plan.d.ts +33 -9
  75. package/dist/components/ai-sdk/Plan.js +336 -107
  76. package/dist/components/ai-sdk/PromptInput.js +1 -1
  77. package/dist/components/extension/FirstRunSetup.js +2 -2
  78. package/dist/components/foundations/ThemeProvider.d.ts +2 -0
  79. package/dist/components/foundations/ThemeProvider.js +2 -1
  80. package/dist/components/general-purpose/CommandPalette.d.ts +2 -52
  81. package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
  82. package/dist/components/general-purpose/WallpaperPicker.d.ts +33 -2
  83. package/dist/components/nanites/AgentConnection.js +1 -1
  84. package/dist/components/nanites/AgentToolDetail.js +1 -1
  85. package/dist/context-BWJpR084.js +94 -0
  86. package/dist/{parts-CPVz9l31.js → parts-DuT5-rDz.js} +1 -1
  87. package/dist/styles/agent-computer.css +16 -0
  88. package/dist/styles/computer-files.css +5 -0
  89. package/dist/styles/computer-notifications.css +1 -0
  90. package/dist/styles/plan.css +160 -23
  91. package/dist/{workspace-drag-B6hMXUNt.js → workspace-drag-BNhZIN8F.js} +1 -1
  92. package/dist/{workspace-quick-look-DODjsfhH.js → workspace-quick-look-8cbGu1Xf.js} +2 -2
  93. package/package.json +2 -2
  94. package/dist/WallpaperPicker-C-FItmDS.d.ts +0 -34
  95. package/dist/automations-host-DPORjdc7.js +0 -17
  96. package/dist/context-Ddsp8HgD.js +0 -43
  97. package/dist/minute-clock-CXpRGCMF.js +0 -35
  98. package/dist/progress-ring-BO649JA9.js +0 -79
  99. package/dist/{ManagerOffice-kSK7vTBl.js → ManagerOffice-BJ2vs-Lr.js} +2 -2
  100. package/dist/{WorkspaceLink-DK9kdMUH.js → WorkspaceLink-DDkj-Tq5.js} +1 -1
@@ -0,0 +1,1360 @@
1
+ import { Z as PlusIcon, g as ChevronRightIcon, gt as XIcon, h as ChevronLeftIcon } from "./icons-nLTnB9kd.js";
2
+ import { Checkbox } from "./components/foundations/Checkbox.js";
3
+ import { Button } from "./components/foundations/Button.js";
4
+ import { IconButton } from "./components/foundations/IconButton.js";
5
+ import { n as useAgentComputerActions } from "./AgentComputer-DZCyQkcE.js";
6
+ import { AppTopBar } from "./components/general-purpose/AppTopBar.js";
7
+ import { COMPUTER_APP_IDS } from "./components/agents-sdk/ComputerAppIds.js";
8
+ import { Popover } from "./components/foundations/Popover.js";
9
+ import { Menubar } from "./components/foundations/Menubar.js";
10
+ import { EmptyState } from "./components/foundations/EmptyState.js";
11
+ import { formatThinkExecutionStatus, getThinkExecutionRunId, getThinkExecutionRunStatus, isThinkSubmissionRun } from "./components/agents-sdk/ThinkExecutionRun.js";
12
+ import { formatThinkScheduleTimeZone } from "./components/agents-sdk/ThinkSchedule.js";
13
+ import { LinkButton } from "./components/foundations/LinkButton.js";
14
+ import { DescriptionList } from "./components/foundations/DescriptionList.js";
15
+ import { SearchField } from "./components/foundations/SearchField.js";
16
+ import { ResponsiveSidebarShell } from "./components/general-purpose/ResponsiveSidebarShell.js";
17
+ import { t as computerAppParts } from "./parts-DuT5-rDz.js";
18
+ import { c } from "react/compiler-runtime";
19
+ import * as React from "react";
20
+ import { createContext, use, useId, useLayoutEffect, useRef, useState } from "react";
21
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
+ //#region src/components/_internal/computer-apps/automations-host.ts
23
+ const ComputerAutomationsContext = React.createContext(null);
24
+ function useComputerAutomationsContext() {
25
+ const value = React.use(ComputerAutomationsContext);
26
+ if (!value) throw new Error("Automations and Calendar need ComputerAutomations.Host.");
27
+ return value;
28
+ }
29
+ /** A formatter in the employee's working timezone. */
30
+ function zonedFormat(timeZone, options) {
31
+ return new Intl.DateTimeFormat("en-US", {
32
+ ...options,
33
+ timeZone
34
+ });
35
+ }
36
+ //#endregion
37
+ //#region src/components/agents-sdk/ComputerCalendar.tsx
38
+ const DAY = 864e5;
39
+ /** The employee's wall clock: every source instant is placed on its days. */
40
+ function calendarClock(timeZone, now) {
41
+ const sourceDay = zonedFormat(timeZone, {
42
+ year: "numeric",
43
+ month: "2-digit",
44
+ day: "2-digit"
45
+ });
46
+ const time = zonedFormat(timeZone, {
47
+ hour: "numeric",
48
+ minute: "2-digit"
49
+ });
50
+ const calendarDay = (timestamp) => {
51
+ const parts = sourceDay.formatToParts(timestamp);
52
+ const part = (name) => Number(parts.find((value) => value.type === name)?.value);
53
+ return Date.UTC(part("year"), part("month") - 1, part("day"));
54
+ };
55
+ return {
56
+ time,
57
+ zoneName: formatThinkScheduleTimeZone(timeZone),
58
+ calendarDay,
59
+ today: calendarDay(now),
60
+ monthTime(timestamp) {
61
+ const parts = time.formatToParts(timestamp);
62
+ const hour = parts.find((part) => part.type === "hour")?.value ?? "";
63
+ const minute = parts.find((part) => part.type === "minute")?.value;
64
+ const period = parts.find((part) => part.type === "dayPeriod")?.value.toLowerCase().at(0) ?? "";
65
+ return `${hour}${minute && minute !== "00" ? `:${minute}` : ""}${period}`;
66
+ }
67
+ };
68
+ }
69
+ const CalendarClockContext = createContext(null);
70
+ const useClock = () => use(CalendarClockContext);
71
+ const dateFormat = (options) => new Intl.DateTimeFormat("en-US", {
72
+ ...options,
73
+ timeZone: "UTC"
74
+ });
75
+ const fullDate = dateFormat({
76
+ weekday: "long",
77
+ year: "numeric",
78
+ month: "long",
79
+ day: "numeric"
80
+ });
81
+ const monthFormat = dateFormat({ month: "long" });
82
+ const dayFormat = dateFormat({
83
+ month: "long",
84
+ day: "numeric"
85
+ });
86
+ const weekdays = [
87
+ "Sunday",
88
+ "Monday",
89
+ "Tuesday",
90
+ "Wednesday",
91
+ "Thursday",
92
+ "Friday",
93
+ "Saturday"
94
+ ];
95
+ const dateKey = (day) => new Date(day).toISOString().slice(0, 10);
96
+ function moveMonth(day, offset) {
97
+ const date = new Date(day);
98
+ const year = date.getUTCFullYear();
99
+ const month = date.getUTCMonth() + offset;
100
+ const lastDay = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
101
+ return Date.UTC(year, month, Math.min(date.getUTCDate(), lastDay));
102
+ }
103
+ /** One confirmed next occurrence and each retained run; never expand schedule text. */
104
+ function calendarEntries(schedules, { calendarDay }) {
105
+ return schedules.flatMap((schedule) => {
106
+ const entries = [];
107
+ const next = schedule.enabled && schedule.alarm ? schedule.alarm.time * 1e3 : NaN;
108
+ if (Number.isFinite(new Date(next).getTime())) entries.push({
109
+ key: `${schedule.id}:next`,
110
+ schedule,
111
+ kind: "scheduled",
112
+ timestamp: next,
113
+ day: calendarDay(next)
114
+ });
115
+ for (const run of schedule.runs) {
116
+ const instant = isThinkSubmissionRun(run) ? run.startedAt ?? run.createdAt : run.createdAt;
117
+ const timestamp = instant instanceof Date ? instant.getTime() : instant;
118
+ if (!Number.isFinite(new Date(timestamp).getTime())) continue;
119
+ entries.push({
120
+ key: `${schedule.id}:run:${getThinkExecutionRunId(run)}`,
121
+ schedule,
122
+ kind: "run",
123
+ run,
124
+ timestamp,
125
+ day: calendarDay(timestamp)
126
+ });
127
+ }
128
+ return entries;
129
+ }).toSorted((first, second) => first.timestamp - second.timestamp);
130
+ }
131
+ /** Where the entry opens in Automations, as the link shows it. */
132
+ function useSourceLink() {
133
+ const $ = c(2);
134
+ const { host } = useComputerAutomationsContext();
135
+ let t0;
136
+ if ($[0] !== host) {
137
+ t0 = (entry) => host.renderLink(entry.kind === "scheduled" ? {
138
+ section: "schedules",
139
+ schedule: entry.schedule.id
140
+ } : {
141
+ section: "runs",
142
+ run: getThinkExecutionRunId(entry.run)
143
+ });
144
+ $[0] = host;
145
+ $[1] = t0;
146
+ } else t0 = $[1];
147
+ return t0;
148
+ }
149
+ function entryStatus(entry) {
150
+ return entry.kind === "scheduled" ? "Confirmed next run" : formatThinkExecutionStatus(getThinkExecutionRunStatus(entry.run));
151
+ }
152
+ function CalendarEvent(t0) {
153
+ const $ = c(94);
154
+ const { entry, onSelect, onOpen, detailed: t1 } = t0;
155
+ const detailed = t1 === void 0 ? false : t1;
156
+ const navigating = useRef(false);
157
+ const sourceLink = useSourceLink();
158
+ const clock = useClock();
159
+ let t2;
160
+ if ($[0] !== entry.day || $[1] !== onSelect) {
161
+ t2 = (open) => {
162
+ if (open) {
163
+ navigating.current = false;
164
+ onSelect(entry.day);
165
+ }
166
+ };
167
+ $[0] = entry.day;
168
+ $[1] = onSelect;
169
+ $[2] = t2;
170
+ } else t2 = $[2];
171
+ let t3;
172
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
173
+ t3 = /* @__PURE__ */ jsx(Button, {
174
+ variant: "ghost",
175
+ color: "neutral",
176
+ size: "xs"
177
+ });
178
+ $[3] = t3;
179
+ } else t3 = $[3];
180
+ const t4 = entry.kind;
181
+ const t5 = detailed ? "" : void 0;
182
+ const t6 = entry.key;
183
+ const t7 = entry.schedule.name;
184
+ let t8;
185
+ if ($[4] !== entry) {
186
+ t8 = entryStatus(entry);
187
+ $[4] = entry;
188
+ $[5] = t8;
189
+ } else t8 = $[5];
190
+ let t9;
191
+ if ($[6] !== entry.day) {
192
+ t9 = fullDate.format(entry.day);
193
+ $[6] = entry.day;
194
+ $[7] = t9;
195
+ } else t9 = $[7];
196
+ let t10;
197
+ if ($[8] !== clock.time || $[9] !== entry.timestamp) {
198
+ t10 = clock.time.format(entry.timestamp);
199
+ $[8] = clock.time;
200
+ $[9] = entry.timestamp;
201
+ $[10] = t10;
202
+ } else t10 = $[10];
203
+ const t11 = `${t7}, ${t8}, ${t9}, ${t10}`;
204
+ let t12;
205
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
206
+ t12 = /* @__PURE__ */ jsx("span", {
207
+ className: "computer-calendar__event-dot",
208
+ "aria-hidden": "true"
209
+ });
210
+ $[11] = t12;
211
+ } else t12 = $[11];
212
+ let t13;
213
+ if ($[12] !== entry.schedule.name) {
214
+ t13 = /* @__PURE__ */ jsx("span", {
215
+ className: "computer-calendar__event-title sigvelo-truncate",
216
+ children: entry.schedule.name
217
+ });
218
+ $[12] = entry.schedule.name;
219
+ $[13] = t13;
220
+ } else t13 = $[13];
221
+ let t14;
222
+ if ($[14] !== entry.timestamp) {
223
+ t14 = new Date(entry.timestamp).toISOString();
224
+ $[14] = entry.timestamp;
225
+ $[15] = t14;
226
+ } else t14 = $[15];
227
+ let t15;
228
+ if ($[16] !== clock || $[17] !== detailed || $[18] !== entry.timestamp) {
229
+ t15 = detailed ? clock.time.format(entry.timestamp) : clock.monthTime(entry.timestamp);
230
+ $[16] = clock;
231
+ $[17] = detailed;
232
+ $[18] = entry.timestamp;
233
+ $[19] = t15;
234
+ } else t15 = $[19];
235
+ let t16;
236
+ if ($[20] !== t14 || $[21] !== t15) {
237
+ t16 = /* @__PURE__ */ jsx("time", {
238
+ dateTime: t14,
239
+ children: t15
240
+ });
241
+ $[20] = t14;
242
+ $[21] = t15;
243
+ $[22] = t16;
244
+ } else t16 = $[22];
245
+ let t17;
246
+ if ($[23] !== detailed || $[24] !== entry) {
247
+ t17 = detailed ? /* @__PURE__ */ jsx("span", {
248
+ className: "computer-calendar__entry-detail",
249
+ children: entryStatus(entry)
250
+ }) : null;
251
+ $[23] = detailed;
252
+ $[24] = entry;
253
+ $[25] = t17;
254
+ } else t17 = $[25];
255
+ let t18;
256
+ if ($[26] !== entry.key || $[27] !== entry.kind || $[28] !== t11 || $[29] !== t13 || $[30] !== t16 || $[31] !== t17 || $[32] !== t5) {
257
+ t18 = /* @__PURE__ */ jsxs(Popover.Trigger, {
258
+ unstyled: true,
259
+ render: t3,
260
+ className: "computer-calendar__event",
261
+ "data-kind": t4,
262
+ "data-detailed": t5,
263
+ "data-entry": t6,
264
+ "aria-label": t11,
265
+ children: [
266
+ t12,
267
+ t13,
268
+ t16,
269
+ t17
270
+ ]
271
+ });
272
+ $[26] = entry.key;
273
+ $[27] = entry.kind;
274
+ $[28] = t11;
275
+ $[29] = t13;
276
+ $[30] = t16;
277
+ $[31] = t17;
278
+ $[32] = t5;
279
+ $[33] = t18;
280
+ } else t18 = $[33];
281
+ let t19;
282
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
283
+ t19 = () => !navigating.current;
284
+ $[34] = t19;
285
+ } else t19 = $[34];
286
+ let t20;
287
+ if ($[35] !== entry.schedule.name) {
288
+ t20 = /* @__PURE__ */ jsx(Popover.Title, {
289
+ className: "computer-calendar__event-title-heading",
290
+ children: entry.schedule.name
291
+ });
292
+ $[35] = entry.schedule.name;
293
+ $[36] = t20;
294
+ } else t20 = $[36];
295
+ let t21;
296
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
297
+ t21 = /* @__PURE__ */ jsx(Popover.Close, { render: /* @__PURE__ */ jsx(IconButton, {
298
+ label: "Close event details",
299
+ size: "xs",
300
+ variant: "ghost",
301
+ color: "neutral",
302
+ children: /* @__PURE__ */ jsx(XIcon, {})
303
+ }) });
304
+ $[37] = t21;
305
+ } else t21 = $[37];
306
+ let t22;
307
+ if ($[38] !== t20) {
308
+ t22 = /* @__PURE__ */ jsxs("div", {
309
+ className: "computer-calendar__event-header",
310
+ children: [t20, t21]
311
+ });
312
+ $[38] = t20;
313
+ $[39] = t22;
314
+ } else t22 = $[39];
315
+ let t23;
316
+ if ($[40] !== entry.day) {
317
+ t23 = fullDate.format(entry.day);
318
+ $[40] = entry.day;
319
+ $[41] = t23;
320
+ } else t23 = $[41];
321
+ let t24;
322
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
323
+ t24 = /* @__PURE__ */ jsx("br", {});
324
+ $[42] = t24;
325
+ } else t24 = $[42];
326
+ let t25;
327
+ if ($[43] !== entry.timestamp) {
328
+ t25 = new Date(entry.timestamp).toISOString();
329
+ $[43] = entry.timestamp;
330
+ $[44] = t25;
331
+ } else t25 = $[44];
332
+ let t26;
333
+ if ($[45] !== clock.time || $[46] !== entry.timestamp) {
334
+ t26 = clock.time.format(entry.timestamp);
335
+ $[45] = clock.time;
336
+ $[46] = entry.timestamp;
337
+ $[47] = t26;
338
+ } else t26 = $[47];
339
+ let t27;
340
+ if ($[48] !== t25 || $[49] !== t26) {
341
+ t27 = /* @__PURE__ */ jsx("time", {
342
+ dateTime: t25,
343
+ children: t26
344
+ });
345
+ $[48] = t25;
346
+ $[49] = t26;
347
+ $[50] = t27;
348
+ } else t27 = $[50];
349
+ const t28 = clock.zoneName ? ` · ${clock.zoneName}` : null;
350
+ let t29;
351
+ if ($[51] !== t23 || $[52] !== t27 || $[53] !== t28) {
352
+ t29 = /* @__PURE__ */ jsxs(Popover.Description, {
353
+ className: "computer-calendar__event-description",
354
+ children: [
355
+ t23,
356
+ t24,
357
+ t27,
358
+ t28
359
+ ]
360
+ });
361
+ $[51] = t23;
362
+ $[52] = t27;
363
+ $[53] = t28;
364
+ $[54] = t29;
365
+ } else t29 = $[54];
366
+ let t30;
367
+ if ($[55] === Symbol.for("react.memo_cache_sentinel")) {
368
+ t30 = /* @__PURE__ */ jsx(DescriptionList.Term, { children: "Calendar" });
369
+ $[55] = t30;
370
+ } else t30 = $[55];
371
+ const t31 = entry.kind === "scheduled" ? "Scheduled work" : "Run history";
372
+ let t32;
373
+ if ($[56] !== t31) {
374
+ t32 = /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [t30, /* @__PURE__ */ jsx(DescriptionList.Details, { children: t31 })] });
375
+ $[56] = t31;
376
+ $[57] = t32;
377
+ } else t32 = $[57];
378
+ let t33;
379
+ if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
380
+ t33 = /* @__PURE__ */ jsx(DescriptionList.Term, { children: "Owner" });
381
+ $[58] = t33;
382
+ } else t33 = $[58];
383
+ let t34;
384
+ if ($[59] !== entry.schedule.owner.name) {
385
+ t34 = /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [t33, /* @__PURE__ */ jsx(DescriptionList.Details, { children: entry.schedule.owner.name })] });
386
+ $[59] = entry.schedule.owner.name;
387
+ $[60] = t34;
388
+ } else t34 = $[60];
389
+ let t35;
390
+ if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
391
+ t35 = /* @__PURE__ */ jsx(DescriptionList.Term, { children: "Status" });
392
+ $[61] = t35;
393
+ } else t35 = $[61];
394
+ let t36;
395
+ if ($[62] !== entry) {
396
+ t36 = entryStatus(entry);
397
+ $[62] = entry;
398
+ $[63] = t36;
399
+ } else t36 = $[63];
400
+ let t37;
401
+ if ($[64] !== t36) {
402
+ t37 = /* @__PURE__ */ jsxs(DescriptionList.Item, { children: [t35, /* @__PURE__ */ jsx(DescriptionList.Details, { children: t36 })] });
403
+ $[64] = t36;
404
+ $[65] = t37;
405
+ } else t37 = $[65];
406
+ let t38;
407
+ if ($[66] !== t32 || $[67] !== t34 || $[68] !== t37) {
408
+ t38 = /* @__PURE__ */ jsxs(DescriptionList.Root, {
409
+ align: "start",
410
+ className: "computer-calendar__event-facts",
411
+ children: [
412
+ t32,
413
+ t34,
414
+ t37
415
+ ]
416
+ });
417
+ $[66] = t32;
418
+ $[67] = t34;
419
+ $[68] = t37;
420
+ $[69] = t38;
421
+ } else t38 = $[69];
422
+ const t39 = entry.kind === "scheduled" ? "The next run confirmed by the schedule." : "A recorded run.";
423
+ let t40;
424
+ if ($[70] !== t39) {
425
+ t40 = /* @__PURE__ */ jsx("p", {
426
+ className: "computer-calendar__event-note",
427
+ children: t39
428
+ });
429
+ $[70] = t39;
430
+ $[71] = t40;
431
+ } else t40 = $[71];
432
+ let t41;
433
+ if ($[72] !== entry || $[73] !== sourceLink) {
434
+ t41 = sourceLink(entry);
435
+ $[72] = entry;
436
+ $[73] = sourceLink;
437
+ $[74] = t41;
438
+ } else t41 = $[74];
439
+ let t42;
440
+ if ($[75] !== t41) {
441
+ t42 = /* @__PURE__ */ jsx(LinkButton, {
442
+ render: t41,
443
+ variant: "surface",
444
+ color: "neutral",
445
+ size: "xs"
446
+ });
447
+ $[75] = t41;
448
+ $[76] = t42;
449
+ } else t42 = $[76];
450
+ let t43;
451
+ if ($[77] !== entry || $[78] !== onOpen) {
452
+ t43 = (event) => {
453
+ event.preventDefault();
454
+ navigating.current = true;
455
+ onOpen(entry);
456
+ };
457
+ $[77] = entry;
458
+ $[78] = onOpen;
459
+ $[79] = t43;
460
+ } else t43 = $[79];
461
+ const t44 = entry.kind === "scheduled" ? "Open schedule" : "Open run";
462
+ let t45;
463
+ if ($[80] !== t42 || $[81] !== t43 || $[82] !== t44) {
464
+ t45 = /* @__PURE__ */ jsx(Popover.Close, {
465
+ nativeButton: false,
466
+ role: "link",
467
+ render: t42,
468
+ onClick: t43,
469
+ children: t44
470
+ });
471
+ $[80] = t42;
472
+ $[81] = t43;
473
+ $[82] = t44;
474
+ $[83] = t45;
475
+ } else t45 = $[83];
476
+ let t46;
477
+ if ($[84] !== t22 || $[85] !== t29 || $[86] !== t38 || $[87] !== t40 || $[88] !== t45) {
478
+ t46 = /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
479
+ side: "right",
480
+ align: "start",
481
+ sideOffset: 8,
482
+ children: /* @__PURE__ */ jsxs(Popover.Popup, {
483
+ className: "computer-calendar__event-popup",
484
+ finalFocus: t19,
485
+ children: [
486
+ t22,
487
+ t29,
488
+ t38,
489
+ t40,
490
+ t45
491
+ ]
492
+ })
493
+ }) });
494
+ $[84] = t22;
495
+ $[85] = t29;
496
+ $[86] = t38;
497
+ $[87] = t40;
498
+ $[88] = t45;
499
+ $[89] = t46;
500
+ } else t46 = $[89];
501
+ let t47;
502
+ if ($[90] !== t18 || $[91] !== t2 || $[92] !== t46) {
503
+ t47 = /* @__PURE__ */ jsxs(Popover.Root, {
504
+ onOpenChange: t2,
505
+ children: [t18, t46]
506
+ });
507
+ $[90] = t18;
508
+ $[91] = t2;
509
+ $[92] = t46;
510
+ $[93] = t47;
511
+ } else t47 = $[93];
512
+ return t47;
513
+ }
514
+ function CalendarOverflow(t0) {
515
+ const $ = c(31);
516
+ const { day, entries, onSelect, onOpen } = t0;
517
+ const navigating = useRef(false);
518
+ const sourceLink = useSourceLink();
519
+ const clock = useClock();
520
+ let t1;
521
+ if ($[0] !== day || $[1] !== onSelect) {
522
+ t1 = (open) => {
523
+ if (open) {
524
+ navigating.current = false;
525
+ onSelect(day);
526
+ }
527
+ };
528
+ $[0] = day;
529
+ $[1] = onSelect;
530
+ $[2] = t1;
531
+ } else t1 = $[2];
532
+ let t2;
533
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
534
+ t2 = /* @__PURE__ */ jsx(Button, {
535
+ variant: "ghost",
536
+ color: "neutral",
537
+ size: "xs"
538
+ });
539
+ $[3] = t2;
540
+ } else t2 = $[3];
541
+ const t3 = entries.length;
542
+ let t4;
543
+ if ($[4] !== day) {
544
+ t4 = fullDate.format(day);
545
+ $[4] = day;
546
+ $[5] = t4;
547
+ } else t4 = $[5];
548
+ const t5 = `Show all ${t3} events on ${t4}`;
549
+ const t6 = entries.length - 1;
550
+ let t7;
551
+ if ($[6] !== t5 || $[7] !== t6) {
552
+ t7 = /* @__PURE__ */ jsxs(Popover.Trigger, {
553
+ unstyled: true,
554
+ render: t2,
555
+ className: "computer-calendar__more",
556
+ "aria-label": t5,
557
+ children: [t6, " more…"]
558
+ });
559
+ $[6] = t5;
560
+ $[7] = t6;
561
+ $[8] = t7;
562
+ } else t7 = $[8];
563
+ let t8;
564
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
565
+ t8 = () => !navigating.current;
566
+ $[9] = t8;
567
+ } else t8 = $[9];
568
+ let t9;
569
+ if ($[10] !== day) {
570
+ t9 = dayFormat.format(day);
571
+ $[10] = day;
572
+ $[11] = t9;
573
+ } else t9 = $[11];
574
+ let t10;
575
+ if ($[12] !== t9) {
576
+ t10 = /* @__PURE__ */ jsx(Popover.Title, { children: t9 });
577
+ $[12] = t9;
578
+ $[13] = t10;
579
+ } else t10 = $[13];
580
+ let t11;
581
+ if ($[14] !== entries.length) {
582
+ t11 = /* @__PURE__ */ jsxs(Popover.Description, { children: [entries.length, " events"] });
583
+ $[14] = entries.length;
584
+ $[15] = t11;
585
+ } else t11 = $[15];
586
+ let t12;
587
+ if ($[16] !== clock || $[17] !== entries || $[18] !== onOpen || $[19] !== sourceLink) {
588
+ t12 = entries.map((entry) => /* @__PURE__ */ jsxs("li", { children: [
589
+ /* @__PURE__ */ jsx("time", {
590
+ dateTime: new Date(entry.timestamp).toISOString(),
591
+ children: clock.time.format(entry.timestamp)
592
+ }),
593
+ /* @__PURE__ */ jsx(Popover.Close, {
594
+ className: "computer-calendar__source-link",
595
+ render: /* @__PURE__ */ jsx(LinkButton, {
596
+ render: sourceLink(entry),
597
+ variant: "ghost",
598
+ color: "neutral",
599
+ size: "xs"
600
+ }),
601
+ nativeButton: false,
602
+ role: "link",
603
+ onClick: (event) => {
604
+ event.preventDefault();
605
+ navigating.current = true;
606
+ onOpen(entry);
607
+ },
608
+ children: entry.schedule.name
609
+ }),
610
+ /* @__PURE__ */ jsx("span", { children: entryStatus(entry) })
611
+ ] }, entry.key));
612
+ $[16] = clock;
613
+ $[17] = entries;
614
+ $[18] = onOpen;
615
+ $[19] = sourceLink;
616
+ $[20] = t12;
617
+ } else t12 = $[20];
618
+ let t13;
619
+ if ($[21] !== t12) {
620
+ t13 = /* @__PURE__ */ jsx("ol", {
621
+ className: "computer-calendar__overflow-list",
622
+ children: t12
623
+ });
624
+ $[21] = t12;
625
+ $[22] = t13;
626
+ } else t13 = $[22];
627
+ let t14;
628
+ if ($[23] !== t10 || $[24] !== t11 || $[25] !== t13) {
629
+ t14 = /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
630
+ side: "right",
631
+ align: "start",
632
+ sideOffset: 8,
633
+ children: /* @__PURE__ */ jsxs(Popover.Popup, {
634
+ className: "computer-calendar__event-popup",
635
+ finalFocus: t8,
636
+ children: [
637
+ t10,
638
+ t11,
639
+ t13
640
+ ]
641
+ })
642
+ }) });
643
+ $[23] = t10;
644
+ $[24] = t11;
645
+ $[25] = t13;
646
+ $[26] = t14;
647
+ } else t14 = $[26];
648
+ let t15;
649
+ if ($[27] !== t1 || $[28] !== t14 || $[29] !== t7) {
650
+ t15 = /* @__PURE__ */ jsxs(Popover.Root, {
651
+ onOpenChange: t1,
652
+ children: [t7, t14]
653
+ });
654
+ $[27] = t1;
655
+ $[28] = t14;
656
+ $[29] = t7;
657
+ $[30] = t15;
658
+ } else t15 = $[30];
659
+ return t15;
660
+ }
661
+ function CalendarMonth(t0) {
662
+ const $ = c(18);
663
+ const { entries, selected, month, onSelect, onSelectEvent, onOpen, mini: t1 } = t0;
664
+ const mini = t1 === void 0 ? false : t1;
665
+ const clock = useClock();
666
+ let t2;
667
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
668
+ t2 = /* @__PURE__ */ new Map();
669
+ $[0] = t2;
670
+ } else t2 = $[0];
671
+ const dates = useRef(t2);
672
+ const focusDate = useRef(null);
673
+ let t3;
674
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
675
+ t3 = () => {
676
+ if (focusDate.current === null) return;
677
+ const date = dates.current.get(focusDate.current);
678
+ date?.focus({ preventScroll: true });
679
+ date?.scrollIntoView({
680
+ block: "nearest",
681
+ inline: "nearest"
682
+ });
683
+ focusDate.current = null;
684
+ };
685
+ $[1] = t3;
686
+ } else t3 = $[1];
687
+ let t4;
688
+ if ($[2] !== month || $[3] !== selected) {
689
+ t4 = [selected, month];
690
+ $[2] = month;
691
+ $[3] = selected;
692
+ $[4] = t4;
693
+ } else t4 = $[4];
694
+ useLayoutEffect(t3, t4);
695
+ let t5;
696
+ if ($[5] !== clock || $[6] !== entries || $[7] !== mini || $[8] !== month || $[9] !== onOpen || $[10] !== onSelect || $[11] !== onSelectEvent || $[12] !== selected) {
697
+ const displayedMonth = new Date(month);
698
+ const first = Date.UTC(displayedMonth.getUTCFullYear(), displayedMonth.getUTCMonth(), 1);
699
+ const start = first - new Date(first).getUTCDay() * DAY;
700
+ const monthLabel = `${monthFormat.format(first)} ${displayedMonth.getUTCFullYear()}`;
701
+ const select = function select(day) {
702
+ if (day === selected && new Date(day).getUTCMonth() === displayedMonth.getUTCMonth()) {
703
+ onSelect(day);
704
+ return;
705
+ }
706
+ focusDate.current = day;
707
+ onSelect(day);
708
+ };
709
+ const navigate = function navigate(event, day_0) {
710
+ if (event.defaultPrevented || event.nativeEvent.isComposing || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
711
+ const weekday = new Date(day_0).getUTCDay();
712
+ const next = event.key === "ArrowLeft" ? day_0 - DAY : event.key === "ArrowRight" ? day_0 + DAY : event.key === "ArrowUp" ? day_0 - DAY * 7 : event.key === "ArrowDown" ? day_0 + DAY * 7 : event.key === "Home" ? day_0 - DAY * weekday : event.key === "End" ? day_0 + DAY * (6 - weekday) : event.key === "PageUp" ? moveMonth(day_0, -1) : event.key === "PageDown" ? moveMonth(day_0, 1) : null;
713
+ if (next === null) return;
714
+ event.preventDefault();
715
+ select(next);
716
+ };
717
+ let t6;
718
+ if ($[14] !== mini) {
719
+ t6 = weekdays.map((weekday_0) => /* @__PURE__ */ jsx("span", {
720
+ role: "columnheader",
721
+ "aria-label": weekday_0,
722
+ children: weekday_0.slice(0, mini ? 1 : 3)
723
+ }, weekday_0));
724
+ $[14] = mini;
725
+ $[15] = t6;
726
+ } else t6 = $[15];
727
+ let t7;
728
+ if ($[16] !== t6) {
729
+ t7 = /* @__PURE__ */ jsx("div", {
730
+ className: "computer-calendar__weekdays",
731
+ role: "row",
732
+ children: t6
733
+ });
734
+ $[16] = t6;
735
+ $[17] = t7;
736
+ } else t7 = $[17];
737
+ t5 = /* @__PURE__ */ jsxs("div", {
738
+ className: mini ? "computer-calendar__mini-grid" : "computer-calendar__month",
739
+ role: "grid",
740
+ "aria-label": mini ? `Date navigator, ${monthLabel}` : monthLabel,
741
+ children: [t7, Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ jsx("div", {
742
+ className: "computer-calendar__week",
743
+ role: "row",
744
+ children: Array.from({ length: 7 }, (__0, column) => {
745
+ const day_1 = start + (week * 7 + column) * DAY;
746
+ const items = entries.filter((entry) => entry.day === day_1);
747
+ const date_0 = new Date(day_1);
748
+ const outside = date_0.getUTCMonth() !== displayedMonth.getUTCMonth();
749
+ return /* @__PURE__ */ jsxs("div", {
750
+ className: "computer-calendar__cell",
751
+ role: "gridcell",
752
+ "aria-selected": day_1 === selected,
753
+ "data-outside": outside ? "" : void 0,
754
+ "data-weekend": column === 0 || column === 6 ? "" : void 0,
755
+ children: [/* @__PURE__ */ jsxs("button", {
756
+ className: "computer-calendar__date",
757
+ type: "button",
758
+ "data-date": dateKey(day_1),
759
+ "aria-label": `${mini ? "Go to " : ""}${fullDate.format(day_1)}${items.length ? `, ${items.length} ${items.length === 1 ? "event" : "events"}` : ""}`,
760
+ "aria-current": day_1 === clock.today ? "date" : void 0,
761
+ tabIndex: day_1 === selected ? 0 : -1,
762
+ ref: (node) => {
763
+ if (node) dates.current.set(day_1, node);
764
+ else dates.current.delete(day_1);
765
+ },
766
+ onClick: () => select(day_1),
767
+ onKeyDown: (event_0) => navigate(event_0, day_1),
768
+ children: [/* @__PURE__ */ jsxs("span", {
769
+ className: "computer-calendar__number",
770
+ children: [!mini && date_0.getUTCDate() === 1 ? /* @__PURE__ */ jsxs("span", {
771
+ className: "computer-calendar__month-prefix",
772
+ children: [monthFormat.format(day_1).slice(0, 3), "\xA0"]
773
+ }) : null, date_0.getUTCDate()]
774
+ }), !mini && items.length ? /* @__PURE__ */ jsx("span", {
775
+ className: "computer-calendar__event-indicator",
776
+ "data-kind": items.some(_temp) ? "scheduled" : "run"
777
+ }) : null]
778
+ }), !mini && items.length ? /* @__PURE__ */ jsxs("div", {
779
+ className: "computer-calendar__events",
780
+ children: [items.slice(0, items.length > 2 ? 1 : 2).map((entry_1) => /* @__PURE__ */ jsx(CalendarEvent, {
781
+ entry: entry_1,
782
+ onSelect: onSelectEvent,
783
+ onOpen
784
+ }, entry_1.key)), items.length > 2 ? /* @__PURE__ */ jsx(CalendarOverflow, {
785
+ day: day_1,
786
+ entries: items,
787
+ onSelect: onSelectEvent,
788
+ onOpen
789
+ }) : null]
790
+ }) : null]
791
+ }, day_1);
792
+ })
793
+ }, week))]
794
+ });
795
+ $[5] = clock;
796
+ $[6] = entries;
797
+ $[7] = mini;
798
+ $[8] = month;
799
+ $[9] = onOpen;
800
+ $[10] = onSelect;
801
+ $[11] = onSelectEvent;
802
+ $[12] = selected;
803
+ $[13] = t5;
804
+ } else t5 = $[13];
805
+ return t5;
806
+ }
807
+ function _temp(entry_0) {
808
+ return entry_0.kind === "scheduled";
809
+ }
810
+ /** Today's date on Calendar's paper, from the host's clock. */
811
+ function CalendarIcon() {
812
+ const $ = c(13);
813
+ const { clock } = useComputerAutomationsContext();
814
+ let t0;
815
+ if ($[0] !== clock.now || $[1] !== clock.timeZone) {
816
+ t0 = zonedFormat(clock.timeZone, { weekday: "short" }).format(clock.now);
817
+ $[0] = clock.now;
818
+ $[1] = clock.timeZone;
819
+ $[2] = t0;
820
+ } else t0 = $[2];
821
+ let t1;
822
+ if ($[3] !== t0) {
823
+ t1 = /* @__PURE__ */ jsx("span", { children: t0 });
824
+ $[3] = t0;
825
+ $[4] = t1;
826
+ } else t1 = $[4];
827
+ let t2;
828
+ if ($[5] !== clock.now || $[6] !== clock.timeZone) {
829
+ t2 = zonedFormat(clock.timeZone, { day: "numeric" }).format(clock.now);
830
+ $[5] = clock.now;
831
+ $[6] = clock.timeZone;
832
+ $[7] = t2;
833
+ } else t2 = $[7];
834
+ let t3;
835
+ if ($[8] !== t2) {
836
+ t3 = /* @__PURE__ */ jsx("strong", { children: t2 });
837
+ $[8] = t2;
838
+ $[9] = t3;
839
+ } else t3 = $[9];
840
+ let t4;
841
+ if ($[10] !== t1 || $[11] !== t3) {
842
+ t4 = /* @__PURE__ */ jsxs("span", {
843
+ className: "computer-app-calendar",
844
+ "aria-hidden": "true",
845
+ children: [t1, t3]
846
+ });
847
+ $[10] = t1;
848
+ $[11] = t3;
849
+ $[12] = t4;
850
+ } else t4 = $[12];
851
+ return t4;
852
+ }
853
+ /**
854
+ * Calendar: each schedule's confirmed next run and its retained runs on the
855
+ * employee's wall clock. Opening one shows it in Automations.
856
+ */
857
+ function useCalendarModel() {
858
+ const $ = c(71);
859
+ const { host, clock: hostClock, calendar } = useComputerAutomationsContext();
860
+ const { openApp } = useAgentComputerActions();
861
+ let t0;
862
+ if ($[0] !== openApp) {
863
+ t0 = (shown) => void shown.then((ok) => {
864
+ if (ok) openApp(COMPUTER_APP_IDS.automations);
865
+ });
866
+ $[0] = openApp;
867
+ $[1] = t0;
868
+ } else t0 = $[1];
869
+ const showAutomations = t0;
870
+ let t1;
871
+ if ($[2] !== calendar || $[3] !== showAutomations) {
872
+ t1 = () => showAutomations(calendar.createSchedule());
873
+ $[2] = calendar;
874
+ $[3] = showAutomations;
875
+ $[4] = t1;
876
+ } else t1 = $[4];
877
+ const onCreateSchedule = t1;
878
+ const { schedules } = host;
879
+ const clock = calendarClock(hostClock.timeZone, hostClock.now);
880
+ const [t2, setDate] = useState({
881
+ selected: clock.today,
882
+ month: clock.today
883
+ });
884
+ const { selected, month } = t2;
885
+ const searchRef = useRef(null);
886
+ const [showScheduled, setShowScheduled] = useState(true);
887
+ const [showRuns, setShowRuns] = useState(true);
888
+ const [query, setQuery] = useState("");
889
+ let t3;
890
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
891
+ t3 = (day) => setDate({
892
+ selected: day,
893
+ month: day
894
+ });
895
+ $[5] = t3;
896
+ } else t3 = $[5];
897
+ const selectDate = t3;
898
+ let t4;
899
+ if ($[6] !== selectDate) {
900
+ t4 = (day_0) => {
901
+ setQuery("");
902
+ selectDate(day_0);
903
+ };
904
+ $[6] = selectDate;
905
+ $[7] = t4;
906
+ } else t4 = $[7];
907
+ const navigateDate = t4;
908
+ let t5;
909
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
910
+ t5 = (day_1) => setDate((current) => ({
911
+ ...current,
912
+ selected: day_1
913
+ }));
914
+ $[8] = t5;
915
+ } else t5 = $[8];
916
+ const selectEvent = t5;
917
+ let t6;
918
+ if ($[9] !== month || $[10] !== navigateDate) {
919
+ t6 = (offset) => {
920
+ const day_2 = moveMonth(month, offset);
921
+ navigateDate(day_2);
922
+ };
923
+ $[9] = month;
924
+ $[10] = navigateDate;
925
+ $[11] = t6;
926
+ } else t6 = $[11];
927
+ const navigateMonth = t6;
928
+ let t7;
929
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
930
+ t7 = () => {
931
+ setQuery("");
932
+ searchRef.current?.focus({ preventScroll: true });
933
+ };
934
+ $[12] = t7;
935
+ } else t7 = $[12];
936
+ const clearSearch = t7;
937
+ let t8;
938
+ if ($[13] !== onCreateSchedule) {
939
+ t8 = () => onCreateSchedule();
940
+ $[13] = onCreateSchedule;
941
+ $[14] = t8;
942
+ } else t8 = $[14];
943
+ let t9;
944
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
945
+ t9 = /* @__PURE__ */ jsx(PlusIcon, {});
946
+ $[15] = t9;
947
+ } else t9 = $[15];
948
+ let t10;
949
+ if ($[16] !== t8) {
950
+ t10 = /* @__PURE__ */ jsx(AppTopBar.Button, {
951
+ label: "New schedule",
952
+ onClick: t8,
953
+ children: t9
954
+ });
955
+ $[16] = t8;
956
+ $[17] = t10;
957
+ } else t10 = $[17];
958
+ const newSchedule = t10;
959
+ let t11;
960
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
961
+ t11 = /* @__PURE__ */ jsx(SearchField.Label, {
962
+ className: "sigvelo-visually-hidden",
963
+ children: "Search calendar"
964
+ });
965
+ $[18] = t11;
966
+ } else t11 = $[18];
967
+ let t12;
968
+ if ($[19] !== clearSearch || $[20] !== query) {
969
+ t12 = (event) => {
970
+ if (event.defaultPrevented || event.key !== "Escape" || event.nativeEvent.isComposing || !query) return;
971
+ event.preventDefault();
972
+ event.stopPropagation();
973
+ clearSearch();
974
+ };
975
+ $[19] = clearSearch;
976
+ $[20] = query;
977
+ $[21] = t12;
978
+ } else t12 = $[21];
979
+ let t13;
980
+ if ($[22] !== query || $[23] !== t12) {
981
+ t13 = /* @__PURE__ */ jsxs(SearchField.Root, {
982
+ className: "computer-calendar__search",
983
+ children: [t11, /* @__PURE__ */ jsx(SearchField.Control, {
984
+ ref: searchRef,
985
+ placeholder: "Search",
986
+ value: query,
987
+ onValueChange: setQuery,
988
+ onKeyDown: t12
989
+ })]
990
+ });
991
+ $[22] = query;
992
+ $[23] = t12;
993
+ $[24] = t13;
994
+ } else t13 = $[24];
995
+ const search = t13;
996
+ const titleId = useId();
997
+ const scheduledId = useId();
998
+ const runsId = useId();
999
+ const allEntries = calendarEntries(schedules, clock);
1000
+ const term = query.trim().toLocaleLowerCase();
1001
+ const entries = allEntries.filter((entry) => (entry.kind === "scheduled" ? showScheduled : showRuns) && (!term || `${entry.schedule.name} ${entry.schedule.owner.name} ${entryStatus(entry)}`.toLocaleLowerCase().includes(term)));
1002
+ let t14;
1003
+ if ($[25] !== selected) {
1004
+ t14 = (entry_0) => entry_0.day === selected;
1005
+ $[25] = selected;
1006
+ $[26] = t14;
1007
+ } else t14 = $[26];
1008
+ const agenda = entries.filter(t14);
1009
+ let t15;
1010
+ if ($[27] !== month) {
1011
+ t15 = new Date(month);
1012
+ $[27] = month;
1013
+ $[28] = t15;
1014
+ } else t15 = $[28];
1015
+ const displayedMonth = t15;
1016
+ const searchDays = Map.groupBy(entries, _temp2);
1017
+ let t16;
1018
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
1019
+ t16 = (event_0) => {
1020
+ if (event_0.defaultPrevented || event_0.nativeEvent.isComposing || event_0.altKey || event_0.shiftKey || !(event_0.metaKey || event_0.ctrlKey) || event_0.key.toLowerCase() !== "f") return;
1021
+ event_0.preventDefault();
1022
+ searchRef.current?.focus({ preventScroll: true });
1023
+ searchRef.current?.select();
1024
+ };
1025
+ $[29] = t16;
1026
+ } else t16 = $[29];
1027
+ let t17;
1028
+ if ($[30] !== newSchedule || $[31] !== search) {
1029
+ t17 = (t18) => {
1030
+ const { phone } = t18;
1031
+ return phone ? null : /* @__PURE__ */ jsxs(AppTopBar.Root, {
1032
+ className: "computer-calendar-toolbar",
1033
+ "aria-label": "Calendar controls",
1034
+ children: [/* @__PURE__ */ jsx(AppTopBar.Leading, { children: newSchedule }), /* @__PURE__ */ jsx(AppTopBar.Trailing, { children: search })]
1035
+ });
1036
+ };
1037
+ $[30] = newSchedule;
1038
+ $[31] = search;
1039
+ $[32] = t17;
1040
+ } else t17 = $[32];
1041
+ let t18;
1042
+ if ($[33] !== clock || $[34] !== navigateDate || $[35] !== navigateMonth || $[36] !== onCreateSchedule || $[37] !== setShowRuns || $[38] !== setShowScheduled || $[39] !== showRuns || $[40] !== showScheduled) {
1043
+ t18 = () => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Menubar.Menu, { children: [/* @__PURE__ */ jsx(Menubar.Trigger, { children: "File" }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
1044
+ align: "start",
1045
+ sideOffset: 4,
1046
+ children: /* @__PURE__ */ jsx(Menubar.Popup, { children: /* @__PURE__ */ jsx(Menubar.Item, {
1047
+ onClick: () => onCreateSchedule(),
1048
+ children: "New Schedule"
1049
+ }) })
1050
+ }) })] }), /* @__PURE__ */ jsxs(Menubar.Menu, { children: [/* @__PURE__ */ jsx(Menubar.Trigger, { children: "View" }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
1051
+ align: "start",
1052
+ sideOffset: 4,
1053
+ children: /* @__PURE__ */ jsxs(Menubar.Popup, { children: [
1054
+ /* @__PURE__ */ jsx(Menubar.Item, {
1055
+ onClick: () => navigateDate(clock.today),
1056
+ children: "Go to Today"
1057
+ }),
1058
+ /* @__PURE__ */ jsx(Menubar.Item, {
1059
+ onClick: () => navigateMonth(-1),
1060
+ children: "Previous Month"
1061
+ }),
1062
+ /* @__PURE__ */ jsx(Menubar.Item, {
1063
+ onClick: () => navigateMonth(1),
1064
+ children: "Next Month"
1065
+ }),
1066
+ /* @__PURE__ */ jsx(Menubar.Separator, {}),
1067
+ /* @__PURE__ */ jsxs(Menubar.CheckboxItem, {
1068
+ checked: showScheduled,
1069
+ onCheckedChange: setShowScheduled,
1070
+ children: [/* @__PURE__ */ jsx(Menubar.CheckboxItemIndicator, {}), "Scheduled work"]
1071
+ }),
1072
+ /* @__PURE__ */ jsxs(Menubar.CheckboxItem, {
1073
+ checked: showRuns,
1074
+ onCheckedChange: setShowRuns,
1075
+ children: [/* @__PURE__ */ jsx(Menubar.CheckboxItemIndicator, {}), "Run history"]
1076
+ })
1077
+ ] })
1078
+ }) })] })] });
1079
+ $[33] = clock;
1080
+ $[34] = navigateDate;
1081
+ $[35] = navigateMonth;
1082
+ $[36] = onCreateSchedule;
1083
+ $[37] = setShowRuns;
1084
+ $[38] = setShowScheduled;
1085
+ $[39] = showRuns;
1086
+ $[40] = showScheduled;
1087
+ $[41] = t18;
1088
+ } else t18 = $[41];
1089
+ let t19;
1090
+ if ($[42] !== agenda || $[43] !== calendar || $[44] !== clearSearch || $[45] !== clock || $[46] !== displayedMonth || $[47] !== entries || $[48] !== month || $[49] !== navigateDate || $[50] !== navigateMonth || $[51] !== newSchedule || $[52] !== runsId || $[53] !== scheduledId || $[54] !== search || $[55] !== searchDays || $[56] !== selectDate || $[57] !== selectEvent || $[58] !== selected || $[59] !== setShowRuns || $[60] !== setShowScheduled || $[61] !== showAutomations || $[62] !== showRuns || $[63] !== showScheduled || $[64] !== term || $[65] !== titleId) {
1091
+ t19 = (t20) => {
1092
+ const { phone: phone_0 } = t20;
1093
+ const openEntry = (entry_2) => {
1094
+ showAutomations(entry_2.kind === "scheduled" ? calendar.openSchedule(entry_2.schedule.id) : calendar.openRun(entry_2.run));
1095
+ };
1096
+ return /* @__PURE__ */ jsx(CalendarClockContext, {
1097
+ value: clock,
1098
+ children: /* @__PURE__ */ jsx("div", {
1099
+ className: "computer-calendar",
1100
+ children: /* @__PURE__ */ jsx(ResponsiveSidebarShell, {
1101
+ className: "computer-calendar__shell",
1102
+ sidebarLabel: "calendars",
1103
+ sidebarTogglePlacement: "sidebar",
1104
+ defaultSidebarWidth: 180,
1105
+ bar: phone_0 ? {
1106
+ label: "Calendar controls",
1107
+ title: term ? "Search" : "Month",
1108
+ leading: newSchedule,
1109
+ actions: search
1110
+ } : { hidden: true },
1111
+ sidebar: /* @__PURE__ */ jsxs("div", {
1112
+ className: "computer-calendar__sidebar",
1113
+ children: [/* @__PURE__ */ jsxs("fieldset", {
1114
+ className: "computer-calendar__sources",
1115
+ children: [
1116
+ /* @__PURE__ */ jsx("legend", { children: "Calendars" }),
1117
+ /* @__PURE__ */ jsxs("label", {
1118
+ className: "computer-calendar__source",
1119
+ "data-kind": "scheduled",
1120
+ htmlFor: scheduledId,
1121
+ children: [/* @__PURE__ */ jsx(Checkbox.Root, {
1122
+ id: scheduledId,
1123
+ checked: showScheduled,
1124
+ onCheckedChange: setShowScheduled,
1125
+ children: /* @__PURE__ */ jsx(Checkbox.Indicator, {})
1126
+ }), "Scheduled work"]
1127
+ }),
1128
+ /* @__PURE__ */ jsxs("label", {
1129
+ className: "computer-calendar__source",
1130
+ "data-kind": "run",
1131
+ htmlFor: runsId,
1132
+ children: [/* @__PURE__ */ jsx(Checkbox.Root, {
1133
+ id: runsId,
1134
+ className: "computer-calendar__history-checkbox",
1135
+ checked: showRuns,
1136
+ onCheckedChange: setShowRuns,
1137
+ children: /* @__PURE__ */ jsx(Checkbox.Indicator, { className: "computer-calendar__history-checkmark" })
1138
+ }), "Run history"]
1139
+ })
1140
+ ]
1141
+ }), /* @__PURE__ */ jsxs("div", {
1142
+ className: "computer-calendar__mini",
1143
+ children: [/* @__PURE__ */ jsxs("div", {
1144
+ className: "computer-calendar__mini-navigation",
1145
+ children: [
1146
+ /* @__PURE__ */ jsx(IconButton, {
1147
+ label: "Previous mini-calendar month",
1148
+ variant: "ghost",
1149
+ color: "neutral",
1150
+ size: "xs",
1151
+ onClick: () => navigateMonth(-1),
1152
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
1153
+ }),
1154
+ /* @__PURE__ */ jsxs("span", { children: [
1155
+ monthFormat.format(month),
1156
+ " ",
1157
+ displayedMonth.getUTCFullYear()
1158
+ ] }),
1159
+ /* @__PURE__ */ jsx(IconButton, {
1160
+ label: "Next mini-calendar month",
1161
+ variant: "ghost",
1162
+ color: "neutral",
1163
+ size: "xs",
1164
+ onClick: () => navigateMonth(1),
1165
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
1166
+ })
1167
+ ]
1168
+ }), /* @__PURE__ */ jsx(CalendarMonth, {
1169
+ mini: true,
1170
+ entries,
1171
+ selected,
1172
+ month,
1173
+ onSelect: navigateDate,
1174
+ onSelectEvent: selectEvent,
1175
+ onOpen: openEntry
1176
+ })]
1177
+ })]
1178
+ }),
1179
+ children: /* @__PURE__ */ jsx("section", {
1180
+ className: "computer-calendar__canvas",
1181
+ "aria-labelledby": titleId,
1182
+ children: term ? /* @__PURE__ */ jsxs("div", {
1183
+ className: "computer-calendar__search-results",
1184
+ children: [/* @__PURE__ */ jsxs("div", {
1185
+ className: "computer-calendar__search-heading",
1186
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
1187
+ id: titleId,
1188
+ children: "Search results"
1189
+ }), /* @__PURE__ */ jsxs("p", {
1190
+ role: "status",
1191
+ children: [
1192
+ entries.length,
1193
+ " ",
1194
+ entries.length === 1 ? "event" : "events",
1195
+ " in visible calendars"
1196
+ ]
1197
+ })] }), /* @__PURE__ */ jsx(Button, {
1198
+ variant: "ghost",
1199
+ color: "neutral",
1200
+ size: "xs",
1201
+ onClick: clearSearch,
1202
+ children: "Done"
1203
+ })]
1204
+ }), entries.length ? /* @__PURE__ */ jsx("ol", {
1205
+ className: "computer-calendar__search-days",
1206
+ "aria-label": "Calendar search results",
1207
+ children: [...searchDays].map((t21) => {
1208
+ const [day_3, dayEntries] = t21;
1209
+ return /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("h3", { children: fullDate.format(day_3) }), /* @__PURE__ */ jsx("ol", {
1210
+ className: "computer-calendar__search-events",
1211
+ children: dayEntries.map((entry_3) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(CalendarEvent, {
1212
+ entry: entry_3,
1213
+ detailed: true,
1214
+ onSelect: selectDate,
1215
+ onOpen: openEntry
1216
+ }) }, entry_3.key))
1217
+ })] }, day_3);
1218
+ })
1219
+ }) : /* @__PURE__ */ jsx(EmptyState, {
1220
+ className: "computer-calendar__search-empty",
1221
+ title: /* @__PURE__ */ jsx("h3", { children: !showScheduled && !showRuns ? "Calendars are hidden" : "No matching events" }),
1222
+ description: !showScheduled && !showRuns ? "Show a calendar to search its events." : "Try a different name, owner, or run status."
1223
+ })]
1224
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1225
+ /* @__PURE__ */ jsxs("div", {
1226
+ className: "computer-calendar__month-heading",
1227
+ children: [/* @__PURE__ */ jsxs("h2", {
1228
+ id: titleId,
1229
+ className: "computer-calendar__title",
1230
+ "aria-live": "polite",
1231
+ "aria-atomic": "true",
1232
+ children: [
1233
+ /* @__PURE__ */ jsx("strong", { children: monthFormat.format(month) }),
1234
+ " ",
1235
+ displayedMonth.getUTCFullYear()
1236
+ ]
1237
+ }), /* @__PURE__ */ jsxs("div", {
1238
+ className: "computer-calendar__navigation",
1239
+ "aria-label": "Month navigation",
1240
+ children: [
1241
+ /* @__PURE__ */ jsx(IconButton, {
1242
+ label: "Previous month",
1243
+ variant: "ghost",
1244
+ color: "neutral",
1245
+ size: "xs",
1246
+ onClick: () => navigateMonth(-1),
1247
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
1248
+ }),
1249
+ /* @__PURE__ */ jsx(Button, {
1250
+ variant: "surface",
1251
+ color: "neutral",
1252
+ size: "xs",
1253
+ onClick: () => navigateDate(clock.today),
1254
+ children: "Today"
1255
+ }),
1256
+ /* @__PURE__ */ jsx(IconButton, {
1257
+ label: "Next month",
1258
+ variant: "ghost",
1259
+ color: "neutral",
1260
+ size: "xs",
1261
+ onClick: () => navigateMonth(1),
1262
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
1263
+ })
1264
+ ]
1265
+ })]
1266
+ }),
1267
+ /* @__PURE__ */ jsx(CalendarMonth, {
1268
+ entries,
1269
+ selected,
1270
+ month,
1271
+ onSelect: navigateDate,
1272
+ onSelectEvent: selectEvent,
1273
+ onOpen: openEntry
1274
+ }),
1275
+ /* @__PURE__ */ jsxs("div", {
1276
+ className: "computer-calendar__day-context",
1277
+ "aria-live": "polite",
1278
+ "aria-atomic": "true",
1279
+ children: [/* @__PURE__ */ jsx("h3", {
1280
+ className: "computer-calendar__day-heading",
1281
+ children: dayFormat.format(selected)
1282
+ }), /* @__PURE__ */ jsx("p", { children: !showScheduled && !showRuns ? "Calendars are hidden" : agenda.length ? `${agenda.length} ${agenda.length === 1 ? "event" : "events"}` : "No events on this day" })]
1283
+ }),
1284
+ agenda.length ? /* @__PURE__ */ jsx("ol", {
1285
+ className: "computer-calendar__phone-agenda",
1286
+ children: agenda.map((entry_4) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(CalendarEvent, {
1287
+ entry: entry_4,
1288
+ detailed: true,
1289
+ onSelect: selectEvent,
1290
+ onOpen: openEntry
1291
+ }) }, entry_4.key))
1292
+ }) : null
1293
+ ] })
1294
+ })
1295
+ })
1296
+ })
1297
+ });
1298
+ };
1299
+ $[42] = agenda;
1300
+ $[43] = calendar;
1301
+ $[44] = clearSearch;
1302
+ $[45] = clock;
1303
+ $[46] = displayedMonth;
1304
+ $[47] = entries;
1305
+ $[48] = month;
1306
+ $[49] = navigateDate;
1307
+ $[50] = navigateMonth;
1308
+ $[51] = newSchedule;
1309
+ $[52] = runsId;
1310
+ $[53] = scheduledId;
1311
+ $[54] = search;
1312
+ $[55] = searchDays;
1313
+ $[56] = selectDate;
1314
+ $[57] = selectEvent;
1315
+ $[58] = selected;
1316
+ $[59] = setShowRuns;
1317
+ $[60] = setShowScheduled;
1318
+ $[61] = showAutomations;
1319
+ $[62] = showRuns;
1320
+ $[63] = showScheduled;
1321
+ $[64] = term;
1322
+ $[65] = titleId;
1323
+ $[66] = t19;
1324
+ } else t19 = $[66];
1325
+ let t20;
1326
+ if ($[67] !== t17 || $[68] !== t18 || $[69] !== t19) {
1327
+ t20 = {
1328
+ onKeyDown: t16,
1329
+ renderTitle: t17,
1330
+ renderMenus: t18,
1331
+ render: t19
1332
+ };
1333
+ $[67] = t17;
1334
+ $[68] = t18;
1335
+ $[69] = t19;
1336
+ $[70] = t20;
1337
+ } else t20 = $[70];
1338
+ return t20;
1339
+ }
1340
+ function _temp2(entry_1) {
1341
+ return entry_1.day;
1342
+ }
1343
+ /** Calendar in the Dock. It reads the schedules and runs `ComputerAutomations.Host` keeps. */
1344
+ const ComputerCalendar = { app: {
1345
+ id: COMPUTER_APP_IDS.calendar,
1346
+ label: "Calendar",
1347
+ launcher: "favorite",
1348
+ icon: /* @__PURE__ */ jsx(CalendarIcon, {}),
1349
+ defaultWindowSize: {
1350
+ width: 960,
1351
+ height: 640
1352
+ },
1353
+ titleBar: "unified",
1354
+ ...computerAppParts(useCalendarModel, {
1355
+ title: true,
1356
+ menus: true
1357
+ })
1358
+ } };
1359
+ //#endregion
1360
+ export { zonedFormat as i, ComputerAutomationsContext as n, useComputerAutomationsContext as r, ComputerCalendar as t };