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