@umriss-ui/schedule 0.1.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schedule.js CHANGED
@@ -1,310 +1,323 @@
1
1
  import "./schedule.css";
2
- var He = Object.defineProperty;
3
- var Ye = (n, t, e) => t in n ? He(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
4
- var f = (n, t, e) => Ye(n, typeof t != "symbol" ? t + "" : t, e);
5
- import { jsxs as Y, Fragment as Wt, jsx as k } from "react/jsx-runtime";
6
- import { useContext as fe, createContext as pe, useRef as O, useEffect as x, forwardRef as Xe, useState as it, useId as Ke, useLayoutEffect as vt, useImperativeHandle as Ue, useSyncExternalStore as ze, useMemo as W } from "react";
7
- import { toOperatingTimeClamped as B, resolveColours as We, removedIntervals as qe, localOffset as me, MINUTE as q, calendarFrom as j, toWallClock as U, DAY as st, timeStep as je, operatingTimeTicks as Ve, HOUR as Tt, LinearScale as Ze, subscribeTheme as Je } from "@umriss-ui/charts";
8
- import { useFormats as ge, useWording as we, AngleGlyph as Qe } from "@umriss-ui/core";
9
- const ke = pe(null), ve = pe(null);
10
- function ye() {
11
- return fe(ve);
12
- }
13
- function ts(n) {
14
- const t = fe(ke);
2
+ var es = Object.defineProperty;
3
+ var ss = (o, t, e) => t in o ? es(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
4
+ var f = (o, t, e) => ss(o, typeof t != "symbol" ? t + "" : t, e);
5
+ import { jsxs as Y, Fragment as St, jsx as k } from "react/jsx-runtime";
6
+ import { useContext as Se, createContext as Ae, useRef as $, useEffect as H, forwardRef as ns, useState as ht, useId as os, useLayoutEffect as It, useImperativeHandle as is, useSyncExternalStore as rs, useMemo as X } from "react";
7
+ import { toWorkingTimeClamped as K, resolveColours as as, removedIntervals as ls, localOffset as _e, MINUTE as W, calendarFrom as q, toWallClock as z, DAY as rt, timeStep as hs, workingTimeTicks as ds, HOUR as Et, LinearScale as us, subscribeTheme as cs } from "@umriss-ui/charts";
8
+ import { useFormats as Rt, useWording as ft, AngleGlyph as fs, VisuallyHidden as ae } from "@umriss-ui/core";
9
+ const De = Ae(null), Fe = Ae(null);
10
+ function Oe() {
11
+ return Se(Fe);
12
+ }
13
+ function ps(o) {
14
+ const t = Se(De);
15
15
  if (t === null)
16
- throw new Error(`@umriss-ui/schedule: <${n}> must be used inside a <Schedule>.`);
16
+ throw new Error(`@umriss-ui/schedule: <${o}> must be used inside a <Schedule>.`);
17
17
  return t;
18
18
  }
19
- function Ct(n, t, e, s, o) {
20
- const i = ts(n), r = O(null);
21
- x(() => (r.current = e(i, t), () => {
22
- r.current !== null && o(i, r.current), r.current = null;
23
- }), [i]), x(() => {
19
+ function Pt(o, t, e, s, n) {
20
+ const i = ps(o), r = $(null);
21
+ H(() => (r.current = e(i, t), () => {
22
+ r.current !== null && n(i, r.current), r.current = null;
23
+ }), [i]), H(() => {
24
24
  r.current !== null && s(i, r.current, t);
25
25
  });
26
26
  }
27
- function es(n) {
28
- Ct("Lane", n, (t, e) => t.registerLane(e), (t, e, s) => t.updateLane(e, s), (t, e) => t.unregisterLane(e));
29
- }
30
- function ss(n) {
31
- Ct("LaneGroup", n, (t, e) => t.registerGroup(e), (t, e, s) => t.updateGroup(e, s), (t, e) => t.unregisterGroup(e));
32
- }
33
- function be(n, t) {
34
- Ct(n, t, (e, s) => e.registerLayer(s), (e, s, o) => e.updateLayer(s, o), (e, s) => e.unregisterLayer(s));
35
- }
36
- function ht(n) {
37
- let t = !1, e = !1, s = !1, o = !1;
38
- for (const i of n ?? [])
39
- i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? s = !0 : i === "open" && (o = !0);
40
- return { dashed: t, hatched: e, muted: s, open: o };
41
- }
42
- const ns = 24, os = 4, is = 3, yt = 4;
43
- function qt(n) {
44
- const { lanes: t, groups: e, collapsed: s, laneHeight: o } = n, i = new Map(e.map((m) => [m.id, m])), r = (m) => m !== void 0 && i.has(m) ? m : void 0, a = /* @__PURE__ */ new Map(), u = (m) => {
45
- const C = [];
46
- let L = r(m.parent);
47
- const E = /* @__PURE__ */ new Set();
48
- for (; L !== void 0 && !E.has(L); )
49
- E.add(L), C.unshift(L), L = r(i.get(L).parent);
50
- return C;
51
- }, c = /* @__PURE__ */ new Map();
52
- for (const m of t) {
53
- const C = u(m);
54
- c.set(m.id, C);
55
- for (const L of C) {
56
- const E = a.get(L) ?? [];
57
- E.push(m.id), a.set(L, E);
27
+ function ms(o) {
28
+ Pt("Lane", o, (t, e) => t.registerLane(e), (t, e, s) => t.updateLane(e, s), (t, e) => t.unregisterLane(e));
29
+ }
30
+ function gs(o) {
31
+ Pt("LaneGroup", o, (t, e) => t.registerGroup(e), (t, e, s) => t.updateGroup(e, s), (t, e) => t.unregisterGroup(e));
32
+ }
33
+ function Bt(o, t) {
34
+ Pt(o, t, (e, s) => e.registerLayer(s), (e, s, n) => e.updateLayer(s, n), (e, s) => e.unregisterLayer(s));
35
+ }
36
+ function pt(o) {
37
+ let t = !1, e = !1, s = !1, n = !1;
38
+ for (const i of o ?? [])
39
+ i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? s = !0 : i === "open" && (n = !0);
40
+ return { dashed: t, hatched: e, muted: s, open: n };
41
+ }
42
+ const ks = 24, ys = 4, vs = 3, Ct = 4;
43
+ function le(o) {
44
+ const { lanes: t, groups: e, collapsed: s, laneHeight: n } = o, i = new Map(e.map((g) => [g.id, g])), r = (g) => g !== void 0 && i.has(g) ? g : void 0, a = /* @__PURE__ */ new Map(), h = (g) => {
45
+ const I = [];
46
+ let L = r(g.parent);
47
+ const F = /* @__PURE__ */ new Set();
48
+ for (; L !== void 0 && !F.has(L); )
49
+ F.add(L), I.unshift(L), L = r(i.get(L).parent);
50
+ return I;
51
+ }, d = /* @__PURE__ */ new Map();
52
+ for (const g of t) {
53
+ const I = h(g);
54
+ d.set(g.id, I);
55
+ for (const L of I) {
56
+ const F = a.get(L) ?? [];
57
+ F.push(g.id), a.set(L, F);
58
58
  }
59
59
  }
60
- const l = [], d = /* @__PURE__ */ new Map();
61
- let p = [], g = null, b = 0;
62
- const I = (m) => (l.push({ ...m, top: b }), b += m.height, l.length - 1), _ = (m) => m.find((C) => s.has(C)), S = () => {
63
- if (g === null) return;
64
- const { row: m, lanes: C } = g, L = l[m], E = Math.max(L.height, C.length * os + 2 * yt);
65
- l[m] = { ...L, height: E }, b += E - L.height;
66
- const F = E - 2 * yt, R = Math.max(is, Math.floor(F / C.length));
67
- C.forEach((V, ot) => {
68
- const z = c.get(V) ?? [];
69
- d.set(V, {
70
- top: L.top + yt + ot * R,
71
- height: R,
60
+ const l = [], c = /* @__PURE__ */ new Map();
61
+ let p = [], m = null, y = 0;
62
+ const C = (g) => (l.push({ ...g, top: y }), y += g.height, l.length - 1), S = (g) => g.find((I) => s.has(I)), A = () => {
63
+ if (m === null) return;
64
+ const { row: g, lanes: I } = m, L = l[g], F = Math.max(L.height, I.length * ys + 2 * Ct);
65
+ l[g] = { ...L, height: F }, y += F - L.height;
66
+ const D = F - 2 * Ct, N = Math.max(vs, Math.floor(D / I.length));
67
+ I.forEach((Q, lt) => {
68
+ const V = d.get(Q) ?? [];
69
+ c.set(Q, {
70
+ top: L.top + Ct + lt * N,
71
+ height: N,
72
72
  miniature: !0,
73
- group: z[z.length - 1]
73
+ group: V[V.length - 1]
74
74
  });
75
- }), g = null;
75
+ }), m = null;
76
76
  };
77
- for (const m of t) {
78
- const C = (c.get(m.id) ?? []).filter((F) => (a.get(F) ?? []).length > 0), L = _(C);
79
- if (g !== null && L === g.group) {
80
- g.lanes.push(m.id);
77
+ for (const g of t) {
78
+ const I = (d.get(g.id) ?? []).filter((D) => (a.get(D) ?? []).length > 0), L = S(I);
79
+ if (m !== null && L === m.group) {
80
+ m.lanes.push(g.id);
81
81
  continue;
82
82
  }
83
- S();
84
- const E = C.filter((F, R) => p[R] === F).length;
85
- p = p.slice(0, E);
86
- for (const F of C.slice(E)) {
87
- if (p.push(F), F === L) break;
88
- I({
83
+ A();
84
+ const F = I.filter((D, N) => p[N] === D).length;
85
+ p = p.slice(0, F);
86
+ for (const D of I.slice(F)) {
87
+ if (p.push(D), D === L) break;
88
+ C({
89
89
  kind: "groupHead",
90
90
  lane: void 0,
91
- group: F,
91
+ group: D,
92
92
  depth: p.length - 1,
93
93
  within: [...p],
94
- lanes: (a.get(F) ?? []).length,
95
- height: ns
94
+ lanes: (a.get(D) ?? []).length,
95
+ height: ks
96
96
  });
97
97
  }
98
98
  if (L !== void 0) {
99
- const F = C.indexOf(L), R = I({
99
+ const D = I.indexOf(L), N = C({
100
100
  kind: "miniature",
101
101
  lane: void 0,
102
102
  group: L,
103
- depth: F,
104
- within: C.slice(0, F + 1),
103
+ depth: D,
104
+ within: I.slice(0, D + 1),
105
105
  lanes: (a.get(L) ?? []).length,
106
- height: o
106
+ height: n
107
107
  });
108
- g = { group: L, row: R, lanes: [m.id] };
108
+ m = { group: L, row: N, lanes: [g.id] };
109
109
  continue;
110
110
  }
111
- I({ kind: "lane", lane: m.id, group: C[C.length - 1], depth: C.length, within: C, lanes: 1, height: o }), d.set(m.id, {
111
+ C({ kind: "lane", lane: g.id, group: I[I.length - 1], depth: I.length, within: I, lanes: 1, height: n }), c.set(g.id, {
112
112
  top: l[l.length - 1].top,
113
- height: o,
113
+ height: n,
114
114
  miniature: !1,
115
- group: C[C.length - 1]
115
+ group: I[I.length - 1]
116
116
  });
117
117
  }
118
- return S(), { rows: l, slots: d, height: b };
118
+ return A(), { rows: l, slots: c, height: y };
119
119
  }
120
- function rs(n, t) {
121
- if (t.size === 0) return n;
120
+ function ws(o, t) {
121
+ if (t.size === 0) return o;
122
122
  const e = /* @__PURE__ */ new Set();
123
- for (const s of n) t.has(s) || e.add(s);
123
+ for (const s of o) t.has(s) || e.add(s);
124
124
  return e;
125
125
  }
126
- function nt(n, t) {
127
- if (t < 0 || t >= n.height) return null;
128
- let e = 0, s = n.rows.length - 1;
126
+ function Z(o, t) {
127
+ if (t < 0 || t >= o.height) return null;
128
+ let e = 0, s = o.rows.length - 1;
129
129
  for (; e <= s; ) {
130
- const o = e + s >> 1, i = n.rows[o];
131
- if (t < i.top) s = o - 1;
132
- else if (t >= i.top + i.height) e = o + 1;
130
+ const n = e + s >> 1, i = o.rows[n];
131
+ if (t < i.top) s = n - 1;
132
+ else if (t >= i.top + i.height) e = n + 1;
133
133
  else return i;
134
134
  }
135
135
  return null;
136
136
  }
137
- function Lt(n, t) {
138
- return n.slots.get(t) ?? null;
137
+ function Nt(o, t) {
138
+ return o.slots.get(t) ?? null;
139
139
  }
140
- function as(n, t) {
141
- const e = nt(n, t);
140
+ function bs(o, t) {
141
+ const e = Z(o, t);
142
142
  if (e === null) return null;
143
143
  if (e.kind === "lane") return e.lane ?? null;
144
144
  if (e.kind === "groupHead") return null;
145
- for (const [s, o] of n.slots)
146
- if (o.miniature && t >= o.top && t < o.top + o.height) return s;
145
+ for (const [s, n] of o.slots)
146
+ if (n.miniature && t >= n.top && t < n.top + n.height) return s;
147
147
  return null;
148
148
  }
149
- function ut(n) {
150
- return { from: n.from - (n.setup ?? 0), to: n.to + (n.teardown ?? 0) };
149
+ function J(o) {
150
+ return { from: o.from - (o.leadIn ?? 0), to: o.to + (o.leadOut ?? 0) };
151
151
  }
152
- function St(n, t) {
153
- return (n.leaves ?? "teardown") === "main" ? t.to : t.to + (t.teardown ?? 0);
152
+ function xt(o, t) {
153
+ return (o.leaves ?? "leadOut") === "main" ? t.to : t.to + (t.leadOut ?? 0);
154
154
  }
155
- function It(n, t) {
156
- return (n.arrives ?? "setup") === "main" ? t.from : t.from - (t.setup ?? 0);
155
+ function Gt(o, t) {
156
+ return (o.arrives ?? "leadIn") === "main" ? t.from : t.from - (t.leadIn ?? 0);
157
157
  }
158
- function jt(n, t) {
159
- if (t.kind === "place" || t.subtask !== n.id) return n;
158
+ function he(o, t) {
159
+ if (t.kind === "place" || t.subtask !== o.id) return o;
160
160
  switch (t.kind) {
161
161
  case "move":
162
162
  case "stretch":
163
- return { ...n, from: t.from, to: t.to };
164
- case "setup":
165
- return { ...n, setup: t.setup };
166
- case "teardown":
167
- return { ...n, teardown: t.teardown };
163
+ return { ...o, from: t.from, to: t.to };
164
+ case "leadIn":
165
+ return { ...o, leadIn: t.leadIn };
166
+ case "leadOut":
167
+ return { ...o, leadOut: t.leadOut };
168
168
  case "lane":
169
- return { ...n, lane: t.lane };
169
+ return { ...o, lane: t.lane };
170
170
  }
171
171
  }
172
- function _n(n, t) {
172
+ function Qn(o, t) {
173
173
  return {
174
174
  id: t,
175
- task: n.task,
176
- lane: n.lane,
177
- from: n.from,
178
- to: n.to,
179
- ...n.setup === void 0 ? {} : { setup: n.setup },
180
- ...n.teardown === void 0 ? {} : { teardown: n.teardown }
175
+ task: o.task,
176
+ lane: o.lane,
177
+ from: o.from,
178
+ to: o.to,
179
+ ...o.leadIn === void 0 ? {} : { leadIn: o.leadIn },
180
+ ...o.leadOut === void 0 ? {} : { leadOut: o.leadOut }
181
181
  };
182
182
  }
183
- const ls = 6, Me = 3, et = 2, Vt = 3, Zt = 3;
184
- function N(n, t) {
185
- return Math.round(n.scale.toPx(B(t, n.calendar)));
183
+ const Ms = 6, Ee = 3, ot = 2, de = 3, ue = 3;
184
+ function E(o, t) {
185
+ return Math.round(o.scale.toPx(K(t, o.calendar)));
186
186
  }
187
- function ct(n, t) {
188
- const e = Lt(n.rows, t);
189
- return e === null ? null : { ...e, top: e.top - n.scrollY };
187
+ function at(o, t) {
188
+ const e = Nt(o.rows, t);
189
+ return e === null ? null : { ...e, top: e.top - o.scrollY };
190
190
  }
191
- function Jt(n, t) {
192
- return as(n.rows, t + n.scrollY);
191
+ function ce(o, t) {
192
+ return bs(o.rows, t + o.scrollY);
193
193
  }
194
- function Te(n, t, e, s, o) {
195
- const i = s.miniature ? 0 : ls, r = s.miniature ? 0 : Zt * Vt, a = Math.max(s.miniature ? 1 : 4, s.height - 2 * i - r), u = s.top - n.scrollY + Math.floor((s.height - a) / 2), c = ut(t);
194
+ function Re(o, t, e, s, n) {
195
+ const i = s.miniature ? 0 : Ms, r = s.miniature ? 0 : ue * de, a = Math.max(s.miniature ? 1 : 4, s.height - 2 * i - r), h = s.top - o.scrollY + Math.floor((s.height - a) / 2), d = J(t);
196
196
  return {
197
197
  subtask: t,
198
198
  lane: e,
199
199
  miniature: s.miniature,
200
- depth: o,
201
- y: u + (s.miniature ? 0 : Math.min(o, Zt) * Vt),
200
+ depth: n,
201
+ y: h + (s.miniature ? 0 : Math.min(n, ue) * de),
202
202
  height: a,
203
- outerFrom: N(n, c.from),
204
- mainFrom: N(n, t.from),
205
- mainTo: N(n, t.to),
206
- outerTo: N(n, c.to)
203
+ outerFrom: E(o, d.from),
204
+ mainFrom: E(o, t.from),
205
+ mainTo: E(o, t.to),
206
+ outerTo: E(o, d.to)
207
207
  };
208
208
  }
209
- function Ce(n, t, e) {
210
- if (e < n.y || e > n.y + n.height) return null;
211
- const s = Math.max(0, (6 - (n.outerTo - n.outerFrom)) / 2);
212
- return t < n.outerFrom - s || t > n.outerTo + s ? null : t < n.mainFrom ? "setup" : t > n.mainTo ? "teardown" : "main";
209
+ function Pe(o, t, e) {
210
+ if (e < o.y || e > o.y + o.height) return null;
211
+ const s = Math.max(0, (6 - (o.outerTo - o.outerFrom)) / 2);
212
+ return t < o.outerFrom - s || t > o.outerTo + s ? null : t < o.mainFrom ? "leadIn" : t > o.mainTo ? "leadOut" : "main";
213
213
  }
214
- function hs(n, t, e, s = 5) {
215
- if (e < n.y || e > n.y + n.height) return null;
216
- const o = Math.abs(t - n.mainFrom), i = Math.abs(t - n.mainTo);
217
- return Math.min(o, i) > s ? null : o <= i ? "from" : "to";
214
+ function Ts(o, t, e, s = 5) {
215
+ if (e < o.y || e > o.y + o.height) return null;
216
+ const n = Math.abs(t - o.mainFrom), i = Math.abs(t - o.mainTo);
217
+ return Math.min(n, i) > s ? null : n <= i ? "from" : "to";
218
218
  }
219
- function Le(n, t, e) {
220
- return n.outerTo >= 0 && n.outerFrom <= t && n.y + n.height >= 0 && n.y <= e;
219
+ function At(o, t, e) {
220
+ return o.outerTo >= 0 && o.outerFrom <= t && o.y + o.height >= 0 && o.y <= e;
221
221
  }
222
- const us = 64;
223
- function cs(n, t) {
224
- if (n.miniature) return null;
225
- const e = ht(n.subtask.appearance).hatched ? et + Me + 1 : 0, s = Math.max(n.mainFrom + e, 0), o = Math.min(n.mainTo - e, t) - s;
226
- return o < us ? null : { x: s, width: o, y: n.y, height: n.height };
222
+ const Is = 64;
223
+ function Cs(o, t) {
224
+ if (o.miniature) return null;
225
+ const e = pt(o.subtask.appearance).hatched ? ot + Ee + 1 : 0, s = Math.max(o.mainFrom + e, 0), n = Math.min(o.mainTo - e, t) - s;
226
+ return n < Is ? null : { x: s, width: n, y: o.y, height: o.height };
227
227
  }
228
- const ds = 10;
229
- function Qt(n, t, e) {
228
+ const Ls = 10;
229
+ function fe(o, t, e) {
230
230
  const s = Math.round(t.y + t.height / 2);
231
- return n === "centre" || e.y === t.y ? s : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
231
+ return o === "centre" || e.y === t.y ? s : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
232
232
  }
233
- function bt(n, t, e, s, o) {
234
- const i = t.route ?? o.route, r = t.attach ?? o.attach, a = t.ends ?? o.ends, u = N(n, St(t, e.subtask)), c = N(n, It(t, s.subtask)), l = Qt(r, e, s), d = Qt(r, s, e);
233
+ function _t(o, t, e, s, n) {
234
+ const i = t.route ?? n.route, r = t.attach ?? n.attach, a = t.ends ?? n.ends, h = E(o, xt(t, e.subtask)), d = E(o, Gt(t, s.subtask)), l = fe(r, e, s), c = fe(r, s, e);
235
235
  if (i === "straight")
236
- return { transport: t, kind: i, ends: a, x1: u, y1: l, x2: c, y2: d, c1x: u, c2x: c, points: [u, l, c, d] };
236
+ return { dependency: t, kind: i, ends: a, x1: h, y1: l, x2: d, y2: c, c1x: h, c2x: d, points: [h, l, d, c] };
237
237
  if (i === "orthogonal") {
238
- const _ = u + ds, S = l === d ? _ : Math.round((_ + c) / 2);
239
- return { transport: t, kind: i, ends: a, x1: u, y1: l, x2: c, y2: d, c1x: u, c2x: c, points: l === d ? [u, l, c, d] : [u, l, S, l, S, d, c, d] };
240
- }
241
- const p = Math.max(14, Math.abs(c - u) / 2), g = u + p, b = c - p, I = [];
242
- for (let _ = 0; _ <= 16; _++) {
243
- const S = _ / 16, m = 1 - S;
244
- I.push(
245
- m * m * m * u + 3 * m * m * S * g + 3 * m * S * S * b + S * S * S * c,
246
- m * m * m * l + 3 * m * m * S * l + 3 * m * S * S * d + S * S * S * d
238
+ const S = h + Ls, A = l === c ? S : Math.round((S + d) / 2);
239
+ return { dependency: t, kind: i, ends: a, x1: h, y1: l, x2: d, y2: c, c1x: h, c2x: d, points: l === c ? [h, l, d, c] : [h, l, A, l, A, c, d, c] };
240
+ }
241
+ const p = Math.max(14, Math.abs(d - h) / 2), m = h + p, y = d - p, C = [];
242
+ for (let S = 0; S <= 16; S++) {
243
+ const A = S / 16, g = 1 - A;
244
+ C.push(
245
+ g * g * g * h + 3 * g * g * A * m + 3 * g * A * A * y + A * A * A * d,
246
+ g * g * g * l + 3 * g * g * A * l + 3 * g * A * A * c + A * A * A * c
247
247
  );
248
248
  }
249
- return { transport: t, kind: "curve", ends: a, x1: u, y1: l, x2: c, y2: d, c1x: g, c2x: b, points: I };
249
+ return { dependency: t, kind: "curve", ends: a, x1: h, y1: l, x2: d, y2: c, c1x: m, c2x: y, points: C };
250
250
  }
251
- function fs(n, t, e) {
251
+ function Ss(o, t, e) {
252
252
  let s = 1 / 0;
253
- const o = n.points;
254
- for (let i = 0; i + 3 < o.length; i += 2) {
255
- const r = o[i], a = o[i + 1], u = o[i + 2], c = o[i + 3], l = u - r, d = c - a, p = l * l + d * d, g = p === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * l + (e - a) * d) / p));
256
- s = Math.min(s, Math.hypot(t - (r + g * l), e - (a + g * d)));
253
+ const n = o.points;
254
+ for (let i = 0; i + 3 < n.length; i += 2) {
255
+ const r = n[i], a = n[i + 1], h = n[i + 2], d = n[i + 3], l = h - r, c = d - a, p = l * l + c * c, m = p === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * l + (e - a) * c) / p));
256
+ s = Math.min(s, Math.hypot(t - (r + m * l), e - (a + m * c)));
257
257
  }
258
258
  return s;
259
259
  }
260
- function At(n) {
260
+ function $t(o) {
261
261
  const t = [], e = /* @__PURE__ */ new Map();
262
- n.forEach((s, o) => {
263
- const { from: i, to: r } = ut(s);
262
+ o.forEach((s, n) => {
263
+ const { from: i, to: r } = J(s);
264
264
  if (!(i < r)) return;
265
265
  const a = e.get(s.lane) ?? [];
266
- a.push({ subtask: s, index: o, from: i, to: r }), e.set(s.lane, a);
266
+ a.push({ subtask: s, index: n, from: i, to: r }), e.set(s.lane, a);
267
267
  });
268
- for (const [s, o] of e) {
269
- o.sort((i, r) => i.from - r.from || i.index - r.index);
270
- for (let i = 0; i < o.length; i++) {
271
- const r = o[i];
272
- for (let a = i + 1; a < o.length; a++) {
273
- const u = o[a];
274
- if (u.from >= r.to) break;
275
- t.push({ lane: s, first: r.subtask.id, second: u.subtask.id, from: u.from, to: Math.min(r.to, u.to) });
268
+ for (const [s, n] of e) {
269
+ n.sort((i, r) => i.from - r.from || i.index - r.index);
270
+ for (let i = 0; i < n.length; i++) {
271
+ const r = n[i];
272
+ for (let a = i + 1; a < n.length; a++) {
273
+ const h = n[a];
274
+ if (h.from >= r.to) break;
275
+ t.push({ lane: s, first: r.subtask.id, second: h.subtask.id, from: h.from, to: Math.min(r.to, h.to) });
276
276
  }
277
277
  }
278
278
  }
279
279
  return t;
280
280
  }
281
- function ps(n) {
281
+ function As(o) {
282
282
  const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
283
- for (const s of n) {
284
- const o = ut(s), i = e.get(s.lane) ?? [];
283
+ for (const s of o) {
284
+ const n = J(s), i = e.get(s.lane) ?? [];
285
285
  let r = 0;
286
- if (o.from < o.to) {
287
- for (const a of i) o.from < a.to && a.from < o.to && r++;
288
- i.push(o);
286
+ if (n.from < n.to) {
287
+ for (const a of i) n.from < a.to && a.from < n.to && r++;
288
+ i.push(n);
289
289
  }
290
290
  e.set(s.lane, i), t.set(s.id, r);
291
291
  }
292
292
  return t;
293
293
  }
294
- function _t(n, t) {
295
- const e = new Map(n.map((o) => [o.id, o])), s = [];
296
- for (const o of t) {
297
- const i = e.get(o.from), r = e.get(o.to);
294
+ function Ht(o, t) {
295
+ const e = new Map(o.map((n) => [n.id, n])), s = [];
296
+ for (const n of t) {
297
+ const i = e.get(n.from), r = e.get(n.to);
298
298
  if (i === void 0 || r === void 0) continue;
299
- const a = St(o, i), u = It(o, r), c = a + o.duration - u;
300
- c > 0 && s.push({ transport: o.id, departure: a, arrival: u, shortBy: c });
299
+ const a = xt(n, i), h = Gt(n, r), d = a + n.lag - h;
300
+ d > 0 && s.push({ dependency: n.id, departure: a, arrival: h, shortBy: d });
301
301
  }
302
302
  return s;
303
303
  }
304
- function Fn(n, t) {
305
- return { overlaps: At(n), lateTransports: _t(n, t) };
304
+ function Be(o, t) {
305
+ const e = [];
306
+ for (const s of o) {
307
+ const n = J(s);
308
+ for (const i of t)
309
+ i.lane !== s.lane || !(n.from < i.to && i.from < n.to) || e.push({ subtask: s.id, blocked: i.id, lane: i.lane, from: Math.max(n.from, i.from), to: Math.min(n.to, i.to) });
310
+ }
311
+ return e;
312
+ }
313
+ function to(o, t, e = []) {
314
+ return {
315
+ overlaps: $t(o),
316
+ violatedDependencies: Ht(o, t),
317
+ inBlockedTime: Be(o, e)
318
+ };
306
319
  }
307
- class ms {
320
+ class _s {
308
321
  /** `changed` is called after every registration change. */
309
322
  constructor(t) {
310
323
  f(this, "nextId", 1);
@@ -320,11 +333,14 @@ class ms {
320
333
  f(this, "layers", []);
321
334
  f(this, "subtasks", []);
322
335
  f(this, "subtaskById", /* @__PURE__ */ new Map());
323
- f(this, "transports", []);
336
+ f(this, "dependencies", []);
337
+ /** Every blocked time, whichever layer declared it. */
338
+ f(this, "blocked", []);
324
339
  f(this, "tasks", /* @__PURE__ */ new Map());
325
340
  f(this, "overlaps", []);
326
- f(this, "lateById", /* @__PURE__ */ new Map());
341
+ f(this, "violatedById", /* @__PURE__ */ new Map());
327
342
  f(this, "depth", /* @__PURE__ */ new Map());
343
+ f(this, "inBlocked", []);
328
344
  this.changed = t;
329
345
  }
330
346
  registerLane(t) {
@@ -365,343 +381,383 @@ class ms {
365
381
  rebuild() {
366
382
  if (!this.dirty) return !1;
367
383
  this.dirty = !1;
368
- const t = (e) => [...e.keys()].sort((s, o) => s - o).map((s) => e.get(s));
369
- this.lanes = t(this.laneEntries), this.groups = t(this.groupEntries), this.laneIndex = new Map(this.lanes.map((e, s) => [e.id, s])), this.layers = t(this.layerEntries), this.subtasks = [], this.transports = [], this.tasks = /* @__PURE__ */ new Map();
384
+ const t = (e) => [...e.keys()].sort((s, n) => s - n).map((s) => e.get(s));
385
+ this.lanes = t(this.laneEntries), this.groups = t(this.groupEntries), this.laneIndex = new Map(this.lanes.map((e, s) => [e.id, s])), this.layers = t(this.layerEntries), this.subtasks = [], this.dependencies = [], this.blocked = [], this.tasks = /* @__PURE__ */ new Map();
370
386
  for (const e of this.layers)
371
387
  if (e.kind === "subtasks") {
372
388
  this.subtasks.push(...e.data);
373
389
  for (const s of e.tasks) this.tasks.set(s.id, s);
374
- } else
375
- this.transports.push(...e.data);
376
- return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = At(this.subtasks), this.lateById = new Map(_t(this.subtasks, this.transports).map((e) => [e.transport, e])), this.depth = ps(this.subtasks), !0;
390
+ } else e.kind === "dependencies" ? this.dependencies.push(...e.data) : this.blocked.push(...e.data);
391
+ return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = $t(this.subtasks), this.violatedById = new Map(Ht(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = As(this.subtasks), this.inBlocked = Be(this.subtasks, this.blocked), !0;
377
392
  }
378
- /** The task a transport belongs to: its departing subtask's. */
379
- taskOfTransport(t) {
393
+ /** The task a dependency belongs to: its departing subtask's. */
394
+ taskOfDependency(t) {
380
395
  var e;
381
396
  return ((e = this.subtaskById.get(t.from)) == null ? void 0 : e.task) ?? null;
382
397
  }
383
- /** What a tooltip is about: the hovered subtask or transport with what this
398
+ /** What a tooltip is about: the hovered subtask or dependency with what this
384
399
  data knows about it - its task, and the findings it stands in. */
385
400
  tooltipTargetFor(t) {
386
401
  if (t.kind === "subtask") {
387
- const o = t.subtask.id, i = this.overlaps.filter((a) => a.first === o || a.second === o).map((a) => this.subtaskById.get(a.first === o ? a.second : a.first)).filter((a) => a !== void 0), r = this.transports.filter((a) => a.from === o || a.to === o).map((a) => this.lateById.get(a.id)).filter((a) => a !== void 0);
388
- return { kind: "subtask", subtask: t.subtask, task: this.tasks.get(t.subtask.task), overlapping: i, lateTransports: r };
402
+ const n = t.subtask.id, i = this.overlaps.filter((h) => h.first === n || h.second === n).map((h) => this.subtaskById.get(h.first === n ? h.second : h.first)).filter((h) => h !== void 0), r = this.dependencies.filter((h) => h.from === n || h.to === n).map((h) => this.violatedById.get(h.id)).filter((h) => h !== void 0), a = this.inBlocked.filter((h) => h.subtask === n).map((h) => this.blocked.find((d) => d.id === h.blocked)).filter((h) => h !== void 0);
403
+ return { kind: "subtask", subtask: t.subtask, task: this.tasks.get(t.subtask.task), overlapping: i, violatedDependencies: r, blocked: a };
389
404
  }
390
- if (t.kind !== "transport") return null;
391
- const e = t.transport, s = this.taskOfTransport(e);
405
+ if (t.kind !== "dependency") return null;
406
+ const e = t.dependency, s = this.taskOfDependency(e);
392
407
  return {
393
- kind: "transport",
394
- transport: e,
408
+ kind: "dependency",
409
+ dependency: e,
395
410
  task: s !== null ? this.tasks.get(s) : void 0,
396
411
  from: this.subtaskById.get(e.from),
397
412
  to: this.subtaskById.get(e.to),
398
- late: this.lateById.get(e.id)
413
+ violated: this.violatedById.get(e.id)
399
414
  };
400
415
  }
401
416
  }
402
- const gs = {
417
+ const Ds = {
403
418
  line: "var(--u-hairline)",
404
419
  lineStrong: "var(--u-hairline-strong)",
405
420
  text: "var(--u-color-text)",
406
421
  muted: "var(--u-color-text-muted)",
407
422
  alarm: "var(--u-color-danger)",
408
423
  surface: "var(--u-color-surface)",
409
- accent: "var(--u-color-accent)",
424
+ /* The active subtask's mark - drawn in a colour of its own only under
425
+ forced colours; outside them it is the hover's wash (`drawHover`). */
426
+ active: "var(--u-color-accent)",
427
+ now: "var(--u-color-accent)",
410
428
  /* What text and marks take ON a filled bar - the same token the bar labels
411
429
  use in CSS, so a cap and the label beside it are one colour. */
412
430
  onAccent: "var(--u-color-on-accent)"
413
- };
414
- function ws(n, t) {
415
- const e = {};
416
- for (const i of t.tasks.values()) e[`task:${i.id}`] = i.color;
417
- const s = We(n, { ...gs, ...e }), o = /* @__PURE__ */ new Map();
418
- for (const i of t.tasks.values()) o.set(i.id, s[`task:${i.id}`] ?? i.color);
431
+ }, Ne = {
432
+ line: "GrayText",
433
+ lineStrong: "CanvasText",
434
+ text: "CanvasText",
435
+ muted: "GrayText",
436
+ alarm: "CanvasText",
437
+ surface: "Canvas",
438
+ active: "Highlight",
439
+ now: "GrayText",
440
+ onAccent: "Canvas"
441
+ }, Fs = (o) => o ? Ne : Ds, Os = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
442
+ function Es(o, t) {
443
+ const e = Os(), s = {};
444
+ for (const r of t.tasks.values()) s[`task:${r.id}`] = e ? Ne.text : r.color;
445
+ const n = as(o, { ...Fs(e), ...s }), i = /* @__PURE__ */ new Map();
446
+ for (const r of t.tasks.values()) i.set(r.id, n[`task:${r.id}`] ?? r.color);
419
447
  return {
420
- line: s.line,
421
- lineStrong: s.lineStrong,
422
- text: s.text,
423
- muted: s.muted,
424
- alarm: s.alarm,
425
- surface: s.surface,
426
- accent: s.accent,
427
- onAccent: s.onAccent,
428
- tasks: o
448
+ line: n.line,
449
+ lineStrong: n.lineStrong,
450
+ text: n.text,
451
+ muted: n.muted,
452
+ alarm: n.alarm,
453
+ surface: n.surface,
454
+ active: n.active,
455
+ now: n.now,
456
+ onAccent: n.onAccent,
457
+ tasks: i,
458
+ forced: e
429
459
  };
430
460
  }
431
- function at(n) {
432
- const t = n.match(/[\d.]+/g);
461
+ function ut(o) {
462
+ const t = o.match(/[\d.]+/g);
433
463
  return t === null || t.length < 3 ? null : [Number(t[0]), Number(t[1]), Number(t[2])];
434
464
  }
435
- function te(n) {
436
- const t = at(n);
465
+ function pe(o) {
466
+ const t = ut(o);
437
467
  if (t === null) return 0;
438
- const [e, s, o] = t.map((i) => {
468
+ const [e, s, n] = t.map((i) => {
439
469
  const r = i / 255;
440
470
  return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
441
471
  });
442
- return 0.2126 * e + 0.7152 * s + 0.0722 * o;
472
+ return 0.2126 * e + 0.7152 * s + 0.0722 * n;
443
473
  }
444
- function ee(n, t) {
445
- const e = te(n), s = te(t);
474
+ function me(o, t) {
475
+ const e = pe(o), s = pe(t);
446
476
  return (Math.max(e, s) + 0.05) / (Math.min(e, s) + 0.05);
447
477
  }
448
- function se(n, t, e) {
449
- if (n === null) return null;
450
- const s = typeof window > "u" ? 1 : window.devicePixelRatio || 1, o = Math.round(t * s), i = Math.round(e * s);
451
- n.width !== o && (n.width = o), n.height !== i && (n.height = i);
452
- const r = n.getContext("2d");
478
+ function ge(o, t, e) {
479
+ if (o === null) return null;
480
+ const s = typeof window > "u" ? 1 : window.devicePixelRatio || 1, n = Math.round(t * s), i = Math.round(e * s);
481
+ o.width !== n && (o.width = n), o.height !== i && (o.height = i);
482
+ const r = o.getContext("2d");
453
483
  return r === null ? null : (r.setTransform(s, 0, 0, s, 0, 0), r.clearRect(0, 0, t, e), r);
454
484
  }
455
- function ks(n, t) {
456
- const { data: e, view: s } = t, o = s.viewport();
457
- Ms(n, t, o), Ts(n, t);
485
+ function Rs(o, t) {
486
+ const { data: e, view: s } = t, n = s.viewport();
487
+ xs(o, t, n);
488
+ for (const i of e.blocked) Ws(o, t, n, i);
489
+ Gs(o, t);
458
490
  for (const i of e.layers) {
491
+ if (i.kind === "blocked") continue;
459
492
  const r = new Set(i.data);
460
- if (i.kind === "transports")
461
- for (const a of s.paths) r.has(a.transport) && Mt(n, t, a, !1);
493
+ if (i.kind === "dependencies")
494
+ for (const a of s.paths) r.has(a.dependency) && Dt(o, t, a, !1);
462
495
  else
463
- for (const a of s.boxes) r.has(a.subtask) && Ie(n, t, a, 1);
496
+ for (const a of s.boxes) r.has(a.subtask) && Ge(o, t, a, 1);
464
497
  }
465
- for (const i of e.overlaps) Ae(n, t, o, i);
466
- Es(n, t, o), Ns(n, t);
498
+ for (const i of e.overlaps) Ot(o, t, n, i);
499
+ for (const i of e.inBlocked) Ot(o, t, n, i);
500
+ Xs(o, t, n), js(o, t);
467
501
  }
468
- function vs(n, t) {
469
- const { view: e, hover: s } = t, o = e.viewport();
502
+ function Ps(o, t) {
503
+ const { view: e, hover: s } = t, n = e.viewport();
470
504
  if (t.ghost === null) {
471
505
  if (s.kind === "subtask") {
472
506
  const l = e.boxById.get(s.subtask.id);
473
- l !== void 0 && Ds(n, t, l);
474
- } else if (s.kind === "transport") {
475
- const l = e.paths.find((d) => d.transport === s.transport);
476
- l !== void 0 && Mt(n, t, l, !0);
507
+ l !== void 0 && zs(o, t, l);
508
+ } else if (s.kind === "dependency") {
509
+ const l = e.paths.find((c) => c.dependency === s.dependency);
510
+ l !== void 0 && Dt(o, t, l, !0);
477
511
  }
478
512
  return;
479
513
  }
480
- const { ghost: i, overlaps: r, late: a } = t.ghost;
481
- ys(n, t, o, t.ghost.refusedLanes);
482
- const u = Se(o, i);
483
- if (u === null) return;
484
- for (const l of r) Ae(n, t, o, l);
485
- const c = new Set(a.map((l) => l.transport));
486
- for (const l of t.data.transports) {
514
+ const { ghost: i, overlaps: r, violated: a } = t.ghost;
515
+ Bs(o, t, n, t.ghost.refusedLanes);
516
+ const h = xe(n, i);
517
+ if (h === null) return;
518
+ for (const l of r) Ot(o, t, n, l);
519
+ const d = new Set(a.map((l) => l.dependency));
520
+ for (const l of t.data.dependencies) {
487
521
  if (l.from !== i.id && l.to !== i.id) continue;
488
- const d = e.boxById.get(l.from === i.id ? l.to : l.from);
489
- if (d === void 0) continue;
490
- const p = l.from === i.id ? bt(o, l, u, d, e.options) : bt(o, l, d, u, e.options);
491
- Mt(n, t, p, !0, c.has(l.id));
522
+ const c = e.boxById.get(l.from === i.id ? l.to : l.from);
523
+ if (c === void 0) continue;
524
+ const p = l.from === i.id ? _t(n, l, h, c, e.options) : _t(n, l, c, h, e.options);
525
+ Dt(o, t, p, !0, d.has(l.id));
492
526
  }
493
- Ie(n, t, u, 0.55), n.strokeStyle = t.colours.text, n.lineWidth = 1, n.setLineDash([3, 2]), n.strokeRect(u.outerFrom + 0.5, u.y + 0.5, Math.max(1, u.outerTo - u.outerFrom - 1), u.height - 1), n.setLineDash([]), t.ghost.tether !== null && bs(n, t, u, t.ghost.tether);
527
+ Ge(o, t, h, 0.55), o.strokeStyle = t.colours.text, o.lineWidth = 1, o.setLineDash([3, 2]), o.strokeRect(h.outerFrom + 0.5, h.y + 0.5, Math.max(1, h.outerTo - h.outerFrom - 1), h.height - 1), o.setLineDash([]), t.ghost.tether !== null && Ns(o, t, h, t.ghost.tether);
494
528
  }
495
- function ys(n, t, e, s) {
529
+ function Bs(o, t, e, s) {
496
530
  if (s.size === 0) return;
497
- const { width: o, height: i } = t.view;
531
+ const { width: n, height: i } = t.view;
498
532
  for (const r of s) {
499
- const a = ct(e, r);
533
+ const a = at(e, r);
500
534
  if (a === null) continue;
501
- const { top: u, height: c } = a;
502
- u + c < 0 || u > i || (n.globalAlpha = 0.6, n.fillStyle = t.colours.surface, n.fillRect(0, u, o, c), n.globalAlpha = 1, _s(n, 0, u, o, c, t.colours.muted, 0.7, Is, 1));
535
+ const { top: h, height: d } = a;
536
+ h + d < 0 || h > i || (o.globalAlpha = 0.6, o.fillStyle = t.colours.surface, o.fillRect(0, h, n, d), o.globalAlpha = 1, He(o, 0, h, n, d, t.colours.muted, 0.7, $e, 1));
503
537
  }
504
538
  }
505
- function bs(n, t, e, s) {
506
- const o = Math.max(e.outerFrom, Math.min(e.outerTo, s.x)), i = Math.max(e.y, Math.min(e.y + e.height, s.y));
507
- Math.hypot(s.x - o, s.y - i) < 2 || (n.strokeStyle = t.colours.text, n.lineWidth = 1, n.setLineDash([2, 3]), n.beginPath(), n.moveTo(o + 0.5, i + 0.5), n.lineTo(s.x + 0.5, s.y + 0.5), n.stroke(), n.setLineDash([]));
539
+ function Ns(o, t, e, s) {
540
+ const n = Math.max(e.outerFrom, Math.min(e.outerTo, s.x)), i = Math.max(e.y, Math.min(e.y + e.height, s.y));
541
+ Math.hypot(s.x - n, s.y - i) < 2 || (o.strokeStyle = t.colours.text, o.lineWidth = 1, o.setLineDash([2, 3]), o.beginPath(), o.moveTo(n + 0.5, i + 0.5), o.lineTo(s.x + 0.5, s.y + 0.5), o.stroke(), o.setLineDash([]));
508
542
  }
509
- function Se(n, t) {
510
- const e = Lt(n.rows, t.lane);
511
- return e === null ? null : Te(n, t, t.lane, e, 0);
543
+ function xe(o, t) {
544
+ const e = Nt(o.rows, t.lane);
545
+ return e === null ? null : Re(o, t, t.lane, e, 0);
512
546
  }
513
- function Ms(n, t, e) {
514
- const { view: s, colours: o, bands: i } = t, { width: r, height: a } = s;
515
- n.lineWidth = 1, n.strokeStyle = o.line, n.beginPath();
547
+ function xs(o, t, e) {
548
+ const { view: s, colours: n, bands: i } = t, { width: r, height: a } = s;
549
+ o.lineWidth = 1, o.strokeStyle = n.line, o.beginPath();
516
550
  for (const l of i.ticks)
517
- n.moveTo(l.x + 0.5, 0), n.lineTo(l.x + 0.5, a);
551
+ o.moveTo(l.x + 0.5, 0), o.lineTo(l.x + 0.5, a);
518
552
  for (const l of e.rows.rows) {
519
- const d = l.top + l.height - e.scrollY - 0.5;
520
- d < 0 || d > a || (n.moveTo(0, d), n.lineTo(r, d));
553
+ const c = l.top + l.height - e.scrollY - 0.5;
554
+ c < 0 || c > a || (o.moveTo(0, c), o.lineTo(r, c));
521
555
  }
522
- const u = [...e.rows.slots.values()].filter((l) => l.miniature).sort((l, d) => l.top - d.top);
523
- u.forEach((l, d) => {
524
- const p = u[d + 1];
556
+ const h = [...e.rows.slots.values()].filter((l) => l.miniature).sort((l, c) => l.top - c.top);
557
+ h.forEach((l, c) => {
558
+ const p = h[c + 1];
525
559
  if (p === void 0 || p.top !== l.top + l.height || p.group === l.group) return;
526
- const g = l.top + l.height - e.scrollY - 0.5;
527
- g < 0 || g > a || (n.moveTo(0, g), n.lineTo(r, g));
528
- }), n.stroke(), n.strokeStyle = o.lineStrong, n.beginPath();
560
+ const m = l.top + l.height - e.scrollY - 0.5;
561
+ m < 0 || m > a || (o.moveTo(0, m), o.lineTo(r, m));
562
+ }), o.stroke(), o.strokeStyle = n.lineStrong, o.beginPath();
529
563
  for (const l of i.days)
530
- n.moveTo(l.x + 0.5, 0), n.lineTo(l.x + 0.5, a);
531
- n.stroke();
532
- const c = qe(s.options.calendar);
533
- if (c.length > 0) {
534
- n.strokeStyle = o.muted, n.setLineDash([2, 3]), n.beginPath();
535
- for (const l of c) {
536
- const d = Math.round(e.scale.toPx(l.operatingTime)) + 0.5;
537
- d < 0 || d > r || (n.moveTo(d, 0), n.lineTo(d, a));
564
+ o.moveTo(l.x + 0.5, 0), o.lineTo(l.x + 0.5, a);
565
+ o.stroke();
566
+ const d = ls(s.options.calendar);
567
+ if (d.length > 0) {
568
+ o.strokeStyle = n.muted, o.setLineDash([2, 3]), o.beginPath();
569
+ for (const l of d) {
570
+ const c = Math.round(e.scale.toPx(l.workingTime)) + 0.5;
571
+ c < 0 || c > r || (o.moveTo(c, 0), o.lineTo(c, a));
538
572
  }
539
- n.stroke(), n.setLineDash([]);
573
+ o.stroke(), o.setLineDash([]);
540
574
  }
541
575
  }
542
- function Ts(n, t) {
576
+ function Gs(o, t) {
543
577
  const e = t.view.nowX();
544
- e !== null && (n.fillStyle = t.colours.accent, n.fillRect(e, 0, 2, t.view.height));
578
+ e !== null && (o.fillStyle = t.colours.now, o.fillRect(e, 0, 2, t.view.height));
545
579
  }
546
- function Cs(n, t, e, s) {
547
- const o = t.colours.tasks.get(e.subtask.task) ?? t.colours.muted;
548
- n.fillStyle = o;
580
+ function $s(o, t, e, s) {
581
+ const n = t.colours.tasks.get(e.subtask.task) ?? t.colours.muted;
582
+ o.fillStyle = n;
549
583
  for (const [i, r] of [
550
584
  [e.outerFrom, e.mainFrom],
551
585
  [e.mainTo, e.outerTo]
552
586
  ])
553
- r <= i || (n.globalAlpha = 0.28 * s, n.fillRect(i, e.y, r - i, e.height));
554
- n.globalAlpha = s, n.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), n.globalAlpha = 1;
555
- }
556
- function Ft(n, t, e) {
557
- if (n.dashed) return { fill: null, onDark: !1 };
558
- const s = n.muted ? Ls(t, e.surface, 0.5) : t;
559
- return { fill: s, onDark: ee(s, e.onAccent) > ee(s, e.text) };
560
- }
561
- function Ls(n, t, e) {
562
- const s = at(n), o = at(t);
563
- if (s === null || o === null) return n;
564
- const i = (r) => Math.round(s[r] + (o[r] - s[r]) * e);
587
+ r <= i || (o.globalAlpha = 0.28 * s, o.fillRect(i, e.y, r - i, e.height));
588
+ o.globalAlpha = s, o.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), o.globalAlpha = 1;
589
+ }
590
+ function Yt(o, t, e) {
591
+ if (o.dashed) return { fill: null, onDark: !1 };
592
+ const s = o.muted ? Hs(t, e.surface, 0.5) : t;
593
+ return { fill: s, onDark: me(s, e.onAccent) > me(s, e.text) };
594
+ }
595
+ function Hs(o, t, e) {
596
+ const s = ut(o), n = ut(t);
597
+ if (s === null || n === null) return o;
598
+ const i = (r) => Math.round(s[r] + (n[r] - s[r]) * e);
565
599
  return `rgb(${i(0)}, ${i(1)}, ${i(2)})`;
566
600
  }
567
- const Ss = 2;
568
- function Ie(n, t, e, s) {
569
- const { view: o, colours: i } = t;
570
- if (!Le(e, o.width, o.height)) return;
601
+ const Ys = 2;
602
+ function Ge(o, t, e, s) {
603
+ const { view: n, colours: i } = t;
604
+ if (!At(e, n.width, n.height)) return;
571
605
  if (e.miniature) {
572
- Cs(n, t, e, s);
606
+ $s(o, t, e, s);
573
607
  return;
574
608
  }
575
- const r = ht(e.subtask.appearance), a = i.tasks.get(e.subtask.task) ?? i.muted, u = Ft(r, a, i), c = e.y, l = e.height, d = Math.max(1, e.mainTo - e.mainFrom), p = u.onDark ? i.onAccent : i.text;
576
- n.lineWidth = 1, n.fillStyle = a, n.strokeStyle = a;
577
- for (const [b, I] of [
609
+ const r = pt(e.subtask.appearance), a = i.tasks.get(e.subtask.task) ?? i.muted, h = Yt(r, a, i), d = e.y, l = e.height, c = Math.max(1, e.mainTo - e.mainFrom), p = h.onDark ? i.onAccent : i.text;
610
+ o.lineWidth = 1, o.fillStyle = a, o.strokeStyle = a;
611
+ for (const [y, C] of [
578
612
  [e.outerFrom, e.mainFrom],
579
613
  [e.mainTo, e.outerTo]
580
614
  ])
581
- I <= b || (n.globalAlpha = 0.28 * s, n.fillRect(b, c, I - b, l), n.globalAlpha = s, n.strokeRect(b + 0.5, c + 0.5, I - b - 1, l - 1));
582
- u.fill !== null && (n.globalAlpha = s, n.fillStyle = u.fill, n.fillRect(e.mainFrom, c, d, l));
583
- const g = e.subtask.progress;
584
- if (g !== void 0) {
585
- const b = Math.min(4, Math.max(2, Math.round(l / 6))), I = c + l - b - Ss, _ = Math.round(d * Math.max(0, Math.min(1, g)));
586
- n.fillStyle = u.fill === null ? a : p, n.globalAlpha = 0.3 * s, n.fillRect(e.mainFrom, I, d, b), n.globalAlpha = s, _ > 0 && n.fillRect(e.mainFrom, I, _, b);
615
+ C <= y || (o.globalAlpha = 0.28 * s, o.fillRect(y, d, C - y, l), o.globalAlpha = s, o.strokeRect(y + 0.5, d + 0.5, C - y - 1, l - 1));
616
+ h.fill !== null && (o.globalAlpha = s, o.fillStyle = h.fill, o.fillRect(e.mainFrom, d, c, l));
617
+ const m = e.subtask.progress;
618
+ if (m !== void 0) {
619
+ const y = Math.min(4, Math.max(2, Math.round(l / 6))), C = d + l - y - Ys, S = Math.round(c * Math.max(0, Math.min(1, m)));
620
+ o.fillStyle = h.fill === null ? a : p, o.globalAlpha = 0.3 * s, o.fillRect(e.mainFrom, C, c, y), o.globalAlpha = s, S > 0 && o.fillRect(e.mainFrom, C, S, y);
587
621
  }
588
622
  if (r.hatched) {
589
- const b = Math.max(1, Math.min(Me, Math.floor((d - 2 * et) / 3))), I = d >= 4 * b ? et : 0, _ = l >= 4 * et ? et : 0;
590
- n.globalAlpha = s, n.fillStyle = p, n.fillRect(e.mainFrom + I, c + _, b, l - 2 * _), n.fillRect(e.mainTo - I - b, c + _, b, l - 2 * _);
591
- }
592
- r.open && Fs(n, e, c, l, i.surface, o.width), r.dashed && (n.globalAlpha = s, n.strokeStyle = a, n.setLineDash([4, 3]), n.strokeRect(e.mainFrom + 0.5, c + 0.5, d - 1, l - 1), n.setLineDash([])), n.globalAlpha = 1, e.depth > 0 && s === 1 && (n.strokeStyle = i.surface, n.strokeRect(e.outerFrom - 0.5, c - 0.5, e.outerTo - e.outerFrom + 1, l + 1));
593
- }
594
- const Is = 6, As = 16;
595
- function _s(n, t, e, s, o, i, r, a, u) {
596
- n.save(), n.beginPath(), n.rect(t, e, s, o), n.clip(), n.globalAlpha = 0.5 * r, n.strokeStyle = i, n.lineWidth = u, n.beginPath();
597
- for (let c = t - o; c < t + s + o; c += a)
598
- n.moveTo(c, e + o), n.lineTo(c + o, e);
599
- n.stroke(), n.restore();
600
- }
601
- function Fs(n, t, e, s, o, i) {
602
- const r = t.mainFrom < 0, a = t.mainTo > i, u = Math.max(1, Math.min(t.mainTo, i) - Math.max(t.mainFrom, 0)), c = Math.min(As, u);
603
- r && ne(n, 0, c, e, s, o, 1), a && ne(n, i, -c, e, s, o, 1);
604
- }
605
- function ne(n, t, e, s, o, i, r) {
606
- const a = n.createLinearGradient(t, 0, t + e, 0);
607
- a.addColorStop(0, oe(i, r)), a.addColorStop(1, oe(i, 0)), n.globalAlpha = 1, n.fillStyle = a, n.fillRect(Math.min(t, t + e), s, Math.abs(e), o);
608
- }
609
- function oe(n, t) {
610
- const e = at(n);
611
- return e === null ? n : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
612
- }
613
- function Mt(n, t, e, s, o) {
614
- const { data: i, colours: r } = t, a = i.taskOfTransport(e.transport), u = o ?? i.lateById.has(e.transport.id), c = a !== null && a === t.selectedTask, l = u ? r.alarm : (a !== null ? r.tasks.get(a) : void 0) ?? r.muted;
615
- if (n.strokeStyle = l, n.fillStyle = l, n.lineWidth = s || c ? 2 : 1.25, n.setLineDash(u ? [4, 3] : []), n.beginPath(), n.moveTo(e.x1, e.y1), e.kind === "curve")
616
- n.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
623
+ const y = Math.max(1, Math.min(Ee, Math.floor((c - 2 * ot) / 3))), C = c >= 4 * y ? ot : 0, S = l >= 4 * ot ? ot : 0;
624
+ o.globalAlpha = s, o.fillStyle = p, o.fillRect(e.mainFrom + C, d + S, y, l - 2 * S), o.fillRect(e.mainTo - C - y, d + S, y, l - 2 * S);
625
+ }
626
+ r.open && Us(o, e, d, l, i.surface, n.width), r.dashed && (o.globalAlpha = s, o.strokeStyle = a, o.setLineDash([4, 3]), o.strokeRect(e.mainFrom + 0.5, d + 0.5, c - 1, l - 1), o.setLineDash([])), o.globalAlpha = 1, e.depth > 0 && s === 1 && (o.strokeStyle = i.surface, o.strokeRect(e.outerFrom - 0.5, d - 0.5, e.outerTo - e.outerFrom + 1, l + 1));
627
+ }
628
+ const $e = 6, Ks = 16;
629
+ function He(o, t, e, s, n, i, r, a, h) {
630
+ o.save(), o.beginPath(), o.rect(t, e, s, n), o.clip(), o.globalAlpha = 0.5 * r, o.strokeStyle = i, o.lineWidth = h, o.beginPath();
631
+ for (let d = t - n; d < t + s + n; d += a)
632
+ o.moveTo(d, e + n), o.lineTo(d + n, e);
633
+ o.stroke(), o.restore();
634
+ }
635
+ function Us(o, t, e, s, n, i) {
636
+ const r = t.mainFrom < 0, a = t.mainTo > i, h = Math.max(1, Math.min(t.mainTo, i) - Math.max(t.mainFrom, 0)), d = Math.min(Ks, h);
637
+ r && ke(o, 0, d, e, s, n, 1), a && ke(o, i, -d, e, s, n, 1);
638
+ }
639
+ function ke(o, t, e, s, n, i, r) {
640
+ const a = o.createLinearGradient(t, 0, t + e, 0);
641
+ a.addColorStop(0, ye(i, r)), a.addColorStop(1, ye(i, 0)), o.globalAlpha = 1, o.fillStyle = a, o.fillRect(Math.min(t, t + e), s, Math.abs(e), n);
642
+ }
643
+ function ye(o, t) {
644
+ const e = ut(o);
645
+ return e === null ? o : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
646
+ }
647
+ function Dt(o, t, e, s, n) {
648
+ const { data: i, colours: r } = t, a = i.taskOfDependency(e.dependency), h = n ?? i.violatedById.has(e.dependency.id), d = a !== null && a === t.selectedTask, l = h ? r.alarm : (a !== null ? r.tasks.get(a) : void 0) ?? r.muted;
649
+ if (o.strokeStyle = l, o.fillStyle = l, o.lineWidth = s || d ? 2 : 1.25, o.setLineDash(h ? [4, 3] : []), o.beginPath(), o.moveTo(e.x1, e.y1), e.kind === "curve")
650
+ o.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
617
651
  else
618
- for (let d = 2; d + 1 < e.points.length; d += 2) n.lineTo(e.points[d], e.points[d + 1]);
619
- if (n.stroke(), n.setLineDash([]), e.ends === "dot")
620
- for (const [d, p] of [
652
+ for (let c = 2; c + 1 < e.points.length; c += 2) o.lineTo(e.points[c], e.points[c + 1]);
653
+ if (o.stroke(), o.setLineDash([]), e.ends === "dot")
654
+ for (const [c, p] of [
621
655
  [e.x1, e.y1],
622
656
  [e.x2, e.y2]
623
657
  ])
624
- n.beginPath(), n.arc(d, p, u ? 3 : 2.5, 0, Math.PI * 2), n.fill();
658
+ o.beginPath(), o.arc(c, p, h ? 3 : 2.5, 0, Math.PI * 2), o.fill();
625
659
  }
626
- function Es(n, t, e) {
660
+ function Xs(o, t, e) {
627
661
  const { data: s } = t;
628
- if (s.lateById.size !== 0) {
629
- n.fillStyle = t.colours.alarm;
630
- for (const o of s.lateById.values()) {
631
- const i = s.transports.find((d) => d.id === o.transport), r = i === void 0 ? void 0 : s.subtaskById.get(i.to);
662
+ if (s.violatedById.size !== 0)
663
+ for (const n of s.violatedById.values()) {
664
+ const i = s.dependencies.find((c) => c.id === n.dependency), r = i === void 0 ? void 0 : s.subtaskById.get(i.to);
632
665
  if (r === void 0) continue;
633
- const a = ct(e, r.lane);
666
+ const a = at(e, r.lane);
634
667
  if (a === null || !a.miniature) continue;
635
- const u = nt(e.rows, a.top + e.scrollY);
636
- if (u === null) continue;
637
- const c = N(e, o.arrival), l = Math.max(c + 2, N(e, o.arrival + o.shortBy));
638
- n.fillRect(c, u.top - e.scrollY + 1, l - c, 3);
668
+ const h = Z(e.rows, a.top + e.scrollY);
669
+ if (h === null) continue;
670
+ const d = E(e, n.arrival), l = Math.max(d + 2, E(e, n.arrival + n.shortBy));
671
+ Ft(o, t, d, l, h.top - e.scrollY + 1, 3);
639
672
  }
673
+ }
674
+ function Ft(o, t, e, s, n, i) {
675
+ if (!t.colours.forced) {
676
+ o.fillStyle = t.colours.alarm, o.fillRect(e, n, s - e, i);
677
+ return;
640
678
  }
679
+ o.strokeStyle = t.colours.alarm, o.lineWidth = i, o.setLineDash([4, 3]), o.beginPath(), o.moveTo(e, n + i / 2), o.lineTo(s, n + i / 2), o.stroke(), o.setLineDash([]);
641
680
  }
642
- function Ae(n, t, e, s) {
643
- const o = ct(e, s.lane);
644
- if (o === null) return;
645
- const i = N(e, s.from), r = Math.max(i + 2, N(e, s.to));
646
- if (n.fillStyle = t.colours.alarm, n.globalAlpha = 0.14, n.fillRect(i, o.top + 1, r - i, Math.max(1, o.height - 2)), n.globalAlpha = 1, n.fillRect(i, o.top + 1, r - i, Math.min(3, Math.max(1, o.height - 1))), o.miniature) {
647
- const a = nt(e.rows, o.top + e.scrollY);
648
- a !== null && n.fillRect(i, a.top - e.scrollY + 1, r - i, 3);
681
+ function Ws(o, t, e, s) {
682
+ const n = at(e, s.lane);
683
+ if (n === null || n.top + n.height < 0 || n.top > t.view.height) return;
684
+ const i = Math.max(0, E(e, s.from)), r = Math.min(t.view.width, E(e, s.to));
685
+ r <= i || (o.globalAlpha = 0.1, o.fillStyle = t.colours.muted, o.fillRect(i, n.top, r - i, n.height), o.globalAlpha = 1, He(o, i, n.top, r - i, n.height, t.colours.muted, 0.7, $e, 1));
686
+ }
687
+ function Ot(o, t, e, s) {
688
+ const n = at(e, s.lane);
689
+ if (n === null) return;
690
+ const i = E(e, s.from), r = Math.max(i + 2, E(e, s.to));
691
+ if (o.fillStyle = t.colours.alarm, o.globalAlpha = 0.14, o.fillRect(i, n.top + 1, r - i, Math.max(1, n.height - 2)), o.globalAlpha = 1, Ft(o, t, i, r, n.top + 1, Math.min(3, Math.max(1, n.height - 1))), n.miniature) {
692
+ const a = Z(e.rows, n.top + e.scrollY);
693
+ a !== null && Ft(o, t, i, r, a.top - e.scrollY + 1, 3);
649
694
  }
650
695
  }
651
- function Ds(n, t, e) {
652
- const { colours: s } = t, o = ht(e.subtask.appearance), i = Ft(o, s.tasks.get(e.subtask.task) ?? s.muted, s);
653
- n.globalAlpha = Ps, n.fillStyle = i.onDark ? s.onAccent : s.text, n.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), n.globalAlpha = 1;
696
+ function zs(o, t, e) {
697
+ const { colours: s } = t, n = pt(e.subtask.appearance), i = Yt(n, s.tasks.get(e.subtask.task) ?? s.muted, s);
698
+ if (s.forced) {
699
+ o.strokeStyle = s.active, o.lineWidth = 2, o.strokeRect(e.outerFrom - 2, e.y - 2, Math.max(1, e.outerTo - e.outerFrom) + 4, e.height + 4);
700
+ return;
701
+ }
702
+ o.globalAlpha = Vs, o.fillStyle = i.onDark ? s.onAccent : s.text, o.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), o.globalAlpha = 1;
654
703
  }
655
- const Ps = 0.2;
656
- function Ns(n, t) {
704
+ const Vs = 0.2;
705
+ function js(o, t) {
657
706
  const e = t.selectedTask;
658
707
  if (e !== null) {
659
- n.strokeStyle = t.colours.text;
708
+ o.strokeStyle = t.colours.text;
660
709
  for (const s of t.view.boxes) {
661
710
  if (s.subtask.task !== e) continue;
662
- const o = s.subtask.id === t.selectedSubtask;
663
- n.lineWidth = o ? 2 : 1;
664
- const i = o ? 1 : 0.5;
665
- n.strokeRect(s.outerFrom - i, s.y - i, s.outerTo - s.outerFrom + 2 * i, s.height + 2 * i);
711
+ const n = s.subtask.id === t.selectedSubtask;
712
+ o.lineWidth = n ? 2 : 1;
713
+ const i = n ? 1 : 0.5;
714
+ o.strokeRect(s.outerFrom - i, s.y - i, s.outerTo - s.outerFrom + 2 * i, s.height + 2 * i);
666
715
  }
667
716
  }
668
717
  }
669
- const rt = 32, Gs = 18;
670
- function ie(n, t) {
671
- if (!(t > 2 * rt)) return 0;
672
- const e = rt - n, s = n - (t - rt), o = Math.max(e, s);
673
- if (o <= 0) return 0;
674
- const i = Math.min(1, o / rt), r = Gs * i * i;
718
+ const dt = 32, qs = 18;
719
+ function ve(o, t) {
720
+ if (!(t > 2 * dt)) return 0;
721
+ const e = dt - o, s = o - (t - dt), n = Math.max(e, s);
722
+ if (n <= 0) return 0;
723
+ const i = Math.min(1, n / dt), r = qs * i * i;
675
724
  return e > 0 ? -r : r;
676
725
  }
677
- function Rs(n, t, e, s) {
678
- const o = /* @__PURE__ */ new Set();
679
- if (s === void 0) return o;
680
- for (const i of n)
681
- i !== e && (s(t, i) || o.add(i));
682
- return o;
726
+ function it(o, t, e) {
727
+ const s = (n, i) => {
728
+ const r = J(n);
729
+ return n.lane === i.lane && r.from < i.to && i.from < r.to;
730
+ };
731
+ return e.some((n) => s(o, n) && !(t !== null && s(t, n)));
732
+ }
733
+ function Zs(o, t, e, s) {
734
+ const n = /* @__PURE__ */ new Set();
735
+ if (s === void 0) return n;
736
+ for (const i of o)
737
+ i !== e && (s(t, i) || n.add(i));
738
+ return n;
683
739
  }
684
- function $s(n, t) {
740
+ function Js(o, t) {
685
741
  const { step: e, offset: s } = typeof t == "number" ? { step: t, offset: 0 } : t;
686
- if (!(e > 0) || !Number.isFinite(n)) return n;
687
- const o = me(n) + s;
688
- return o + Math.round((n - o) / e) * e;
742
+ if (!(e > 0) || !Number.isFinite(o)) return o;
743
+ const n = _e(o) + s;
744
+ return n + Math.round((o - n) / e) * e;
689
745
  }
690
- const re = "\0placing", ae = /* @__PURE__ */ new Set();
691
- function le(n) {
692
- switch (n.kind) {
746
+ const we = "\0placing", be = /* @__PURE__ */ new Set();
747
+ function Lt(o) {
748
+ switch (o.kind) {
693
749
  case "subtask":
694
- return `subtask:${n.subtask.id}:${n.part}`;
695
- case "transport":
696
- return `transport:${n.transport.id}`;
750
+ return `subtask:${o.subtask.id}:${o.part}`;
751
+ case "dependency":
752
+ return `dependency:${o.dependency.id}`;
697
753
  case "lane":
698
- return `lane:${n.lane}`;
754
+ return `lane:${o.lane}`;
699
755
  default:
700
756
  return "nothing";
701
757
  }
702
758
  }
703
- const he = 3, Os = 10, xs = 600;
704
- class Bs {
759
+ const Me = 3, Qs = 10, tn = 600;
760
+ class en {
705
761
  constructor(t) {
706
762
  f(this, "gesture", { kind: "none" });
707
763
  f(this, "touches", /* @__PURE__ */ new Map());
@@ -714,6 +770,9 @@ class Bs {
714
770
  to. It is a fact about the pointer and not about the ghost, which stayed
715
771
  where it was allowed. */
716
772
  f(this, "refused", !1);
773
+ /** Whether the pointer last stood where the dragged work would cover blocked
774
+ time - as `refused`, a fact about the pointer and not about the ghost. */
775
+ f(this, "blocked", !1);
717
776
  /** Where the pointer stands on the plot while a drag is in flight - what the
718
777
  tether is drawn to, since the ghost is not following it. */
719
778
  f(this, "dragPoint", { x: 0, y: 0 });
@@ -721,8 +780,13 @@ class Bs {
721
780
  open it for this gesture. */
722
781
  f(this, "resting", null);
723
782
  f(this, "hover", { kind: "nothing" });
724
- /** Where the pointer rests on the plot while nothing is being dragged. */
783
+ /** Where the pointer rests on the plot while nothing is being dragged - or,
784
+ where the keyboard set the hover, the point its tooltip stands at. */
725
785
  f(this, "hoverPoint", { x: 0, y: 0 });
786
+ /** Whether the keyboard set the hover (ADR-0030): pointer and keys share one
787
+ **Active subtask**, and the last input wins. The keys' hover stays when
788
+ the pointer leaves, and the pointer takes it over by moving. */
789
+ f(this, "byKeyboard", !1);
726
790
  f(this, "cursor", "default");
727
791
  this.host = t;
728
792
  }
@@ -743,55 +807,56 @@ class Bs {
743
807
  return {
744
808
  ghost: t.ghost,
745
809
  overlaps: e.overlaps,
746
- late: e.late,
810
+ violated: e.violated,
747
811
  refusedLanes: t.refused,
748
812
  /* The tether is drawn only while the pointer really stands on a refused
749
813
  lane: the marked lanes say where the work may not go, the tether says
750
814
  that the ghost is held on purpose right now. */
751
- tether: this.refused ? this.dragPoint : null
815
+ tether: this.refused || this.blocked ? this.dragPoint : null
752
816
  };
753
817
  }
754
818
  ghostSummary() {
755
819
  const t = this.gesture;
756
820
  if (t.kind !== "edit" && t.kind !== "place") return null;
757
- const e = Se(this.host.view.viewport(), t.ghost);
821
+ const e = xe(this.host.view.viewport(), t.ghost);
758
822
  if (e === null) return null;
759
- const s = this.ghostFindings(t.ghost, this.ghostHome(t)), o = t.kind === "edit" && (t.mode === "setup" || t.mode === "teardown"), i = o ? ut(t.ghost) : t.ghost;
823
+ const s = this.ghostFindings(t.ghost, this.ghostHome(t)), n = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), i = n ? J(t.ghost) : t.ghost;
760
824
  return {
761
825
  refused: this.refused,
762
826
  refusedLanes: [...t.refused],
763
- x: o ? e.outerFrom : e.mainFrom,
827
+ blocked: this.blocked,
828
+ x: n ? e.outerFrom : e.mainFrom,
764
829
  y: e.y,
765
830
  height: e.height,
766
831
  from: i.from,
767
832
  to: i.to,
768
833
  overlap: s.overlaps.length > 0,
769
- late: s.late.length > 0
834
+ violated: s.violated.length > 0
770
835
  };
771
836
  }
772
837
  /* ---------------------------------------------------------------- */
773
838
  /* Pointer */
774
839
  /* ---------------------------------------------------------------- */
775
840
  local(t, e) {
776
- var o;
777
- const s = (o = this.host.plotElement()) == null ? void 0 : o.getBoundingClientRect();
841
+ var n;
842
+ const s = (n = this.host.plotElement()) == null ? void 0 : n.getBoundingClientRect();
778
843
  return { x: t - ((s == null ? void 0 : s.left) ?? 0), y: e - ((s == null ? void 0 : s.top) ?? 0) };
779
844
  }
780
- report(t, e, s, o, i, r) {
781
- var u, c;
845
+ report(t, e, s, n, i, r) {
846
+ var h, d;
782
847
  const a = this.host.view;
783
- (c = (u = this.host.handlers()).onInteraction) == null || c.call(u, { type: t, hit: e, clientX: s, clientY: o, time: a.timeAt(i), lane: a.laneIdAt(r) });
848
+ (d = (h = this.host.handlers()).onInteraction) == null || d.call(h, { type: t, hit: e, clientX: s, clientY: n, time: a.timeAt(i), lane: a.laneIdAt(r) });
784
849
  }
785
850
  pointerDown(t) {
786
- var a, u, c, l, d;
851
+ var a, h, d, l, c;
787
852
  const { x: e, y: s } = this.local(t.clientX, t.clientY);
788
853
  if (t.pointerType === "touch" && (this.touches.set(t.pointerId, { x: e, y: s }), this.touches.size >= 2)) {
789
854
  this.gesture.kind !== "pinch" && (this.cancelEdit(), this.gesture = { kind: "pinch", distance: this.touchDistance() });
790
855
  return;
791
856
  }
792
857
  if (t.button !== 0) return;
793
- const o = (c = (u = (a = t.target) == null ? void 0 : a.closest) == null ? void 0 : u.call(a, "[data-grip]")) == null ? void 0 : c.getAttribute("data-grip"), i = this.host.selectedSubtask(), r = i !== null ? this.host.data.subtaskById.get(i) ?? null : null;
794
- t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: "pan", subtask: null } : (o === "setup" || o === "teardown") && r !== null ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: o, subtask: r } : this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, ...this.modeAt(e, s) }, (d = (l = this.host.plotElement()) == null ? void 0 : l.setPointerCapture) == null || d.call(l, t.pointerId);
858
+ const n = (d = (h = (a = t.target) == null ? void 0 : a.closest) == null ? void 0 : h.call(a, "[data-grip]")) == null ? void 0 : d.getAttribute("data-grip"), i = this.host.selectedSubtask(), r = i !== null ? this.host.data.subtaskById.get(i) ?? null : null;
859
+ t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: "pan", subtask: null } : (n === "leadIn" || n === "leadOut") && r !== null ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: n, subtask: r } : this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, ...this.modeAt(e, s) }, (c = (l = this.host.plotElement()) == null ? void 0 : l.setPointerCapture) == null || c.call(l, t.pointerId);
795
860
  }
796
861
  /** A drag over a folded group: resting on one opens it for the GESTURE.
797
862
 
@@ -801,13 +866,13 @@ class Bs {
801
866
  never written to and no change is reported, because the application did
802
867
  not fold anything (ADR-0025). */
803
868
  restOver(t) {
804
- var o;
869
+ var n;
805
870
  const e = this.host.view, s = e.foldedGroupAt(t);
806
- s !== ((o = this.resting) == null ? void 0 : o.group) && (this.stopResting(), s !== null && (this.resting = {
871
+ s !== ((n = this.resting) == null ? void 0 : n.group) && (this.stopResting(), s !== null && (this.resting = {
807
872
  group: s,
808
873
  timer: setTimeout(() => {
809
874
  this.resting = null, e.openForGesture = /* @__PURE__ */ new Set([...e.openForGesture, s]), this.host.viewChanged();
810
- }, xs)
875
+ }, tn)
811
876
  }));
812
877
  }
813
878
  stopResting() {
@@ -829,28 +894,28 @@ class Bs {
829
894
  lane is open. Asked at a drop, where the answer has to be current; while
830
895
  a drag runs, the held set answers instead. */
831
896
  allowed(t, e) {
832
- var s, o;
833
- return ((o = (s = this.host.handlers()).canMoveTo) == null ? void 0 : o.call(s, t, e)) ?? !0;
897
+ var s, n;
898
+ return ((n = (s = this.host.handlers()).canMoveTo) == null ? void 0 : n.call(s, t, e)) ?? !0;
834
899
  }
835
900
  /** The lanes this work may not go to, for the gesture that is beginning. A
836
901
  gesture that cannot change a lane at all asks nothing: the intents the
837
902
  caller handles decide whether the question exists. */
838
903
  askRefused(t, e) {
839
- if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return ae;
840
- const s = this.host.data.lanes.map((o) => o.id);
841
- return Rs(s, t, e, this.host.handlers().canMoveTo);
904
+ if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return be;
905
+ const s = this.host.data.lanes.map((n) => n.id);
906
+ return Zs(s, t, e, this.host.handlers().canMoveTo);
842
907
  }
843
908
  /** What a press at a point would start, given the intents the caller handles. */
844
909
  modeAt(t, e) {
845
- const s = this.host.view, o = s.options.intents;
910
+ const s = this.host.view, n = s.options.intents;
846
911
  for (let i = s.boxes.length - 1; i >= 0; i--) {
847
912
  const r = s.boxes[i];
848
- if (o.includes("stretch")) {
849
- const a = hs(r, t, e);
913
+ if (n.includes("stretch")) {
914
+ const a = Ts(r, t, e);
850
915
  if (a !== null) return { mode: a === "from" ? "stretch-from" : "stretch-to", subtask: r.subtask };
851
916
  }
852
- if (Ce(r, t, e) !== null)
853
- return o.includes("move") || o.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
917
+ if (Pe(r, t, e) !== null)
918
+ return n.includes("move") || n.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
854
919
  }
855
920
  return { mode: "pan", subtask: null };
856
921
  }
@@ -861,24 +926,24 @@ class Bs {
861
926
  r > 0 && this.gesture.distance > 0 && this.host.view.zoomAt(this.touchCentre(), this.gesture.distance / r) && this.host.viewMoved(!0), this.gesture = { kind: "pinch", distance: r };
862
927
  return;
863
928
  }
864
- const o = this.gesture;
865
- if (o.kind === "pending" && o.pointerId === t.pointerId) {
866
- if (Math.hypot(e - o.x0, s - o.y0) < (t.pointerType === "touch" ? Os : he)) return;
867
- if (o.mode === "pan" || o.subtask === null)
868
- this.gesture = { kind: "pan", pointerId: o.pointerId, lastX: o.x0, lastY: o.y0 }, this.setCursor("grabbing");
929
+ const n = this.gesture;
930
+ if (n.kind === "pending" && n.pointerId === t.pointerId) {
931
+ if (Math.hypot(e - n.x0, s - n.y0) < (t.pointerType === "touch" ? Qs : Me)) return;
932
+ if (n.mode === "pan" || n.subtask === null)
933
+ this.gesture = { kind: "pan", pointerId: n.pointerId, lastX: n.x0, lastY: n.y0 }, this.setCursor("grabbing");
869
934
  else {
870
- const r = this.host.view.viewport().scale.fromPx(o.x0);
935
+ const r = this.host.view.viewport().scale.fromPx(n.x0);
871
936
  this.gesture = {
872
937
  kind: "edit",
873
- pointerId: o.pointerId,
874
- mode: o.mode,
875
- subtask: o.subtask,
938
+ pointerId: n.pointerId,
939
+ mode: n.mode,
940
+ subtask: n.subtask,
876
941
  t0: r,
877
- ghost: o.subtask,
942
+ ghost: n.subtask,
878
943
  /* Asked here, once, and drawn from the first frame of the drag: the
879
944
  lanes that are closed are marked before the pointer reaches one. */
880
- refused: o.mode === "move" ? this.askRefused(o.subtask, o.subtask.lane) : ae
881
- }, this.setCursor(o.mode === "move" ? "grabbing" : "ew-resize");
945
+ refused: n.mode === "move" ? this.askRefused(n.subtask, n.subtask.lane) : be
946
+ }, this.setCursor(n.mode === "move" ? "grabbing" : "ew-resize");
882
947
  }
883
948
  }
884
949
  const i = this.gesture;
@@ -888,10 +953,10 @@ class Bs {
888
953
  return;
889
954
  }
890
955
  if (i.kind === "edit" && i.pointerId === t.pointerId) {
891
- this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: e, y: s }, this.restOver(s), this.gesture = { ...i, ghost: this.ghostFor(i, e, s) }, this.setCursor(this.refused ? "not-allowed" : i.mode === "move" ? "grabbing" : "ew-resize"), this.host.interactionChanged(), this.autoPan();
956
+ this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: e, y: s }, this.restOver(s), this.gesture = { ...i, ghost: this.heldGhost(i, e, s) }, this.setCursor(this.refused || this.blocked ? "not-allowed" : i.mode === "move" ? "grabbing" : "ew-resize"), this.host.interactionChanged(), this.autoPan();
892
957
  return;
893
958
  }
894
- i.kind === "none" && this.hoverAt(t.clientX, t.clientY, e, s);
959
+ i.kind === "none" && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, s));
895
960
  }
896
961
  pointerUp(t) {
897
962
  var i, r;
@@ -900,18 +965,18 @@ class Bs {
900
965
  this.touches.size === 1 && a !== void 0 ? this.gesture = { kind: "pan", pointerId: a[0], lastX: a[1].x, lastY: a[1].y } : this.touches.size === 0 && (this.gesture = { kind: "none" });
901
966
  return;
902
967
  }
903
- const e = this.gesture, { x: s, y: o } = this.local(t.clientX, t.clientY);
968
+ const e = this.gesture, { x: s, y: n } = this.local(t.clientX, t.clientY);
904
969
  if (e.kind === "pending" && e.pointerId === t.pointerId)
905
- this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, s, o);
970
+ this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, s, n);
906
971
  else if (e.kind === "pan" && e.pointerId === t.pointerId)
907
- this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, s, o);
972
+ this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, s, n);
908
973
  else if (e.kind === "edit" && e.pointerId === t.pointerId) {
909
974
  this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" };
910
- const a = e.ghost.lane === e.subtask.lane || this.allowed(e.subtask, e.ghost.lane), u = this.intentsOf(e.subtask, e.ghost, e.mode).filter(
911
- (c) => a || c.kind !== "lane"
975
+ const a = e.ghost.lane === e.subtask.lane || this.allowed(e.subtask, e.ghost.lane), h = this.intentsOf(e.subtask, e.ghost, e.mode).filter(
976
+ (d) => a || d.kind !== "lane"
912
977
  );
913
- this.refused = !1, this.cursor = "default", this.host.interactionChanged();
914
- for (const c of u) (r = (i = this.host.handlers()).onIntent) == null || r.call(i, c);
978
+ this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged();
979
+ for (const d of h) (r = (i = this.host.handlers()).onIntent) == null || r.call(i, d);
915
980
  }
916
981
  }
917
982
  /** While a drag is in flight near an edge, pans along once per frame and
@@ -923,17 +988,17 @@ class Bs {
923
988
  this.panFrame = 0;
924
989
  const e = this.gesture;
925
990
  if (e.kind !== "edit" && e.kind !== "place") return;
926
- const s = this.host.view, { x: o, y: i } = this.local(this.lastClient.x, this.lastClient.y), r = ie(o, s.width), a = ie(i, s.height);
991
+ const s = this.host.view, { x: n, y: i } = this.local(this.lastClient.x, this.lastClient.y), r = ve(n, s.width), a = ve(i, s.height);
927
992
  if (r === 0 && a === 0) return;
928
- const u = s.pan(r, a);
929
- if (u.moved) {
930
- if (this.dragPoint = { x: o, y: i }, e.kind === "edit")
931
- this.gesture = { ...e, ghost: this.ghostFor(e, o, i) };
993
+ const h = s.pan(r, a);
994
+ if (h.moved) {
995
+ if (this.dragPoint = { x: n, y: i }, e.kind === "edit")
996
+ this.gesture = { ...e, ghost: this.heldGhost(e, n, i) };
932
997
  else {
933
- const c = this.placeGhost(e.item, o, i, e.refused);
934
- this.refused = c.refused, this.gesture = { ...e, ghost: c.ghost ?? e.ghost };
998
+ const d = this.placeGhost(e.item, n, i, e.refused);
999
+ this.refused = d.refused, this.blocked = d.blocked, this.gesture = { ...e, ghost: d.ghost ?? e.ghost };
935
1000
  }
936
- this.host.viewMoved(u.time), this.panFrame = requestAnimationFrame(t);
1001
+ this.host.viewMoved(h.time), this.panFrame = requestAnimationFrame(t);
937
1002
  }
938
1003
  };
939
1004
  this.panFrame = requestAnimationFrame(t);
@@ -949,17 +1014,17 @@ class Bs {
949
1014
  pointer without the pointer moving, and a tooltip still naming the old
950
1015
  times would be a lie. Nothing is reported: no interaction happened. */
951
1016
  refreshHover() {
952
- if (!this.idle || this.hoverKey === "nothing") return;
1017
+ if (!this.idle || this.hoverKey === "nothing" || this.byKeyboard) return;
953
1018
  const { x: t, y: e } = this.hoverPoint, s = this.host.view.hitAt(t, e);
954
- this.hover = s, this.hoverKey = le(s);
1019
+ this.hover = s, this.hoverKey = Lt(s);
955
1020
  }
956
1021
  pointerLeave() {
957
- this.gesture.kind === "none" && this.setHover({ kind: "nothing" }, "nothing");
1022
+ this.gesture.kind !== "none" || this.byKeyboard || this.setHover({ kind: "nothing" }, "nothing");
958
1023
  }
959
1024
  /** Escape while a drag is in flight: the ghost goes, and nothing is reported.
960
1025
  It ends a drag from outside as it ends one inside. */
961
1026
  cancelEdit() {
962
- return this.gesture.kind !== "edit" && this.gesture.kind !== "place" ? !1 : (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.cursor = "default", this.host.interactionChanged(), !0);
1027
+ return this.gesture.kind !== "edit" && this.gesture.kind !== "place" ? !1 : (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged(), !0);
963
1028
  }
964
1029
  contextMenu(t) {
965
1030
  if (this.host.handlers().onInteraction === void 0) return;
@@ -972,36 +1037,42 @@ class Bs {
972
1037
  their end; Ctrl or ⌘ zooms - a trackpad pinch arrives as a wheel with
973
1038
  Ctrl -; horizontal or Shift pans through time. */
974
1039
  wheel(t) {
975
- const e = this.host.view, s = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)), o = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? e.height : 1, i = t.deltaX * o, r = t.deltaY * o;
1040
+ const e = this.host.view, s = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)), n = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? e.height : 1, i = t.deltaX * n, r = t.deltaY * n;
976
1041
  if (t.ctrlKey || t.metaKey) {
977
1042
  t.preventDefault();
978
- const c = Math.abs(r) < 50 ? 0.01 : 15e-4;
979
- e.zoomAt(s, Math.exp(r * c)) && this.host.viewMoved(!0);
1043
+ const d = Math.abs(r) < 50 ? 0.01 : 15e-4;
1044
+ e.zoomAt(s, Math.exp(r * d)) && this.host.viewMoved(!0);
980
1045
  return;
981
1046
  }
982
1047
  if (Math.abs(i) > Math.abs(r) || t.shiftKey) {
983
1048
  t.preventDefault();
984
- const c = e.pan(t.shiftKey && i === 0 ? r : i, 0);
985
- c.moved && this.host.viewMoved(c.time);
1049
+ const d = e.pan(t.shiftKey && i === 0 ? r : i, 0);
1050
+ d.moved && this.host.viewMoved(d.time);
986
1051
  return;
987
1052
  }
988
1053
  const a = r > 0 ? e.maxScroll() - e.scrollY : e.scrollY;
989
1054
  if (r === 0 || a <= 0) return;
990
1055
  t.preventDefault();
991
- const u = e.pan(0, r);
992
- u.moved && this.host.viewMoved(u.time);
1056
+ const h = e.pan(0, r);
1057
+ h.moved && this.host.viewMoved(h.time);
993
1058
  }
994
- click(t, e, s, o) {
995
- const i = this.host.view.hitAt(s, o), r = i.kind === "subtask" ? i.subtask.task : i.kind === "transport" ? this.host.data.taskOfTransport(i.transport) : null;
996
- this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, s, o);
1059
+ click(t, e, s, n) {
1060
+ const i = this.host.view.hitAt(s, n), r = i.kind === "subtask" ? i.subtask.task : i.kind === "dependency" ? this.host.data.taskOfDependency(i.dependency) : null;
1061
+ this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, s, n);
997
1062
  }
998
- hoverAt(t, e, s, o) {
999
- const i = this.host.view.hitAt(s, o), r = le(i), { mode: a } = this.modeAt(s, o);
1000
- if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: s, y: o }, r === this.hoverKey) {
1001
- (i.kind === "subtask" || i.kind === "transport") && this.host.interactionChanged();
1063
+ hoverAt(t, e, s, n) {
1064
+ const i = this.host.view.hitAt(s, n), r = Lt(i), { mode: a } = this.modeAt(s, n);
1065
+ if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: s, y: n }, r === this.hoverKey) {
1066
+ (i.kind === "subtask" || i.kind === "dependency") && this.host.interactionChanged();
1002
1067
  return;
1003
1068
  }
1004
- this.setHover(i, r), this.report("hover", i, t, e, s, o);
1069
+ this.setHover(i, r), this.report("hover", i, t, e, s, n);
1070
+ }
1071
+ /** The keyboard sets the hover: drawn, and its tooltip shown, as the
1072
+ pointer's would be - and reported to nobody, since `onInteraction`
1073
+ speaks of pointer positions. `nothing` hands the hover back. */
1074
+ setKeyboardHover(t, e) {
1075
+ this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Lt(t), this.host.interactionChanged();
1005
1076
  }
1006
1077
  setHover(t, e) {
1007
1078
  e !== this.hoverKey && (this.hoverKey = e, this.hover = t, this.host.interactionChanged());
@@ -1026,7 +1097,7 @@ class Bs {
1026
1097
  dragOver(t, e) {
1027
1098
  const s = this.host.view;
1028
1099
  if (e === null || !s.options.intents.includes("place")) return;
1029
- const { x: o, y: i } = this.local(t.clientX, t.clientY);
1100
+ const { x: n, y: i } = this.local(t.clientX, t.clientY);
1030
1101
  if (s.laneIdAt(i) === null && s.foldedGroupAt(i) === null) {
1031
1102
  this.clearPlacing();
1032
1103
  return;
@@ -1037,32 +1108,36 @@ class Bs {
1037
1108
  pointer is not over one either, the rule is asked about an item
1038
1109
  whose own lane is empty - which is the truth of it: `canMoveTo`
1039
1110
  is asked ABOUT a lane, and the one this item is on is none. */
1040
- this.askRefused(this.askedFor(e, this.onLane(i) ?? "", o), null)
1041
- ), a = this.placeGhost(e, o, i, r);
1042
- this.refused = a.refused, this.setCursor(a.refused ? "not-allowed" : "default");
1043
- const u = this.gesture.kind === "place" ? this.gesture.ghost : null, c = a.ghost ?? (a.refused ? u : null);
1044
- t.dataTransfer !== null && (t.dataTransfer.dropEffect = c === null ? "none" : "copy"), c !== null && (this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: o, y: i }, this.gesture = { kind: "place", ghost: c, item: e, refused: r }, this.host.interactionChanged(), this.autoPan());
1111
+ this.askRefused(this.askedFor(e, this.onLane(i) ?? "", n), null)
1112
+ ), a = this.placeGhost(e, n, i, r);
1113
+ this.refused = a.refused, this.blocked = a.blocked, this.setCursor(a.refused || a.blocked ? "not-allowed" : "default");
1114
+ const h = this.gesture.kind === "place" ? this.gesture.ghost : null, d = a.ghost ?? (a.refused || a.blocked ? h : null);
1115
+ t.dataTransfer !== null && (t.dataTransfer.dropEffect = d === null ? "none" : "copy"), d !== null && (this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: n, y: i }, this.gesture = { kind: "place", ghost: d, item: e, refused: r }, this.host.interactionChanged(), this.autoPan());
1045
1116
  }
1046
1117
  /** The ghost of a drag from outside at a point on the plot: none off the
1047
- lanes, and none where the caller refuses that lane - which the answer
1048
- says apart, because the two mean different things to the drag. */
1049
- placeGhost(t, e, s, o) {
1118
+ lanes, none where the caller refuses that lane and none where it would
1119
+ cover blocked time - which the answer says apart, because they mean
1120
+ different things to the drag. */
1121
+ placeGhost(t, e, s, n) {
1050
1122
  const i = this.onLane(s);
1051
- return i === null ? { ghost: null, refused: !1 } : o.has(i) ? { ghost: null, refused: !0 } : { ghost: { ...this.askedFor(t, i, e), id: re }, refused: !1 };
1123
+ if (i === null) return { ghost: null, refused: !1, blocked: !1 };
1124
+ if (n.has(i)) return { ghost: null, refused: !0, blocked: !1 };
1125
+ const r = { ...this.askedFor(t, i, e), id: we };
1126
+ return it(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
1052
1127
  }
1053
1128
  /** The dragged item as a subtask, under the caller's key for it - not the
1054
1129
  internal sentinel: the rule is asked about the thing the application says
1055
1130
  it is dragging, and the ghost only afterwards takes the sentinel. */
1056
1131
  askedFor(t, e, s) {
1057
- const o = this.snapInside(this.host.view.timeAt(s), this.snapStep());
1132
+ const n = this.snapInside(this.host.view.timeAt(s), this.snapStep());
1058
1133
  return {
1059
1134
  id: t.item,
1060
1135
  task: t.task,
1061
1136
  lane: e,
1062
- from: o,
1063
- to: o + t.duration,
1064
- ...t.setup === void 0 ? {} : { setup: t.setup },
1065
- ...t.teardown === void 0 ? {} : { teardown: t.teardown }
1137
+ from: n,
1138
+ to: n + t.duration,
1139
+ ...t.leadIn === void 0 ? {} : { leadIn: t.leadIn },
1140
+ ...t.leadOut === void 0 ? {} : { leadOut: t.leadOut }
1066
1141
  };
1067
1142
  }
1068
1143
  /** The drop: the place intent, and the ghost goes. Off every lane, or with
@@ -1072,17 +1147,17 @@ class Bs {
1072
1147
  const e = this.gesture;
1073
1148
  if (e.kind !== "place") return;
1074
1149
  t.preventDefault();
1075
- const { ghost: s, item: o } = e;
1076
- if (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.cursor = "default", this.host.interactionChanged(), !this.allowed({ ...s, id: o.item }, s.lane)) return;
1150
+ const { ghost: s, item: n } = e;
1151
+ if (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged(), !this.allowed({ ...s, id: n.item }, s.lane)) return;
1077
1152
  const i = {
1078
1153
  kind: "place",
1079
- item: o.item,
1154
+ item: n.item,
1080
1155
  task: s.task,
1081
1156
  lane: s.lane,
1082
1157
  from: s.from,
1083
1158
  to: s.to,
1084
- ...s.setup === void 0 ? {} : { setup: s.setup },
1085
- ...s.teardown === void 0 ? {} : { teardown: s.teardown }
1159
+ ...s.leadIn === void 0 ? {} : { leadIn: s.leadIn },
1160
+ ...s.leadOut === void 0 ? {} : { leadOut: s.leadOut }
1086
1161
  };
1087
1162
  (a = (r = this.host.handlers()).onIntent) == null || a.call(r, i);
1088
1163
  }
@@ -1091,7 +1166,7 @@ class Bs {
1091
1166
  and a `dragend`, since it delivers no key events while a native drag
1092
1167
  runs. */
1093
1168
  clearPlacing() {
1094
- this.refused = !1, this.cursor = "default", this.closeGestureFolds(), this.gesture.kind === "place" && (this.stopAutoPan(), this.gesture = { kind: "none" }, this.host.interactionChanged());
1169
+ this.refused = !1, this.blocked = !1, this.cursor = "default", this.closeGestureFolds(), this.gesture.kind === "place" && (this.stopAutoPan(), this.gesture = { kind: "none" }, this.host.interactionChanged());
1095
1170
  }
1096
1171
  /* ---------------------------------------------------------------- */
1097
1172
  /* Ghost and intents */
@@ -1100,44 +1175,56 @@ class Bs {
1100
1175
  const t = this.host.view.options.snap;
1101
1176
  return t === "ticks" ? { step: this.host.view.step(), offset: 0 } : t === !1 ? { step: 0, offset: 0 } : typeof t == "number" ? { step: t, offset: 0 } : t;
1102
1177
  }
1178
+ /** The ghost of a drag inside the plot at a point - or, where that would
1179
+ put the work into blocked time it did not already cover, the ghost where
1180
+ it last stood. It is held, not clamped: a pointer carried on past the
1181
+ blocked time takes the ghost along again. */
1182
+ heldGhost(t, e, s) {
1183
+ const n = this.ghostFor(t, e, s);
1184
+ return this.blocked = it(n, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : n;
1185
+ }
1103
1186
  ghostFor(t, e, s) {
1104
- const o = this.host.view, i = t.subtask, r = this.snapStep(), a = o.options.intents, u = this.snapInside(o.timeAt(e), r);
1187
+ const n = this.host.view, i = t.subtask, r = this.snapStep(), a = n.options.intents, h = this.snapInside(n.timeAt(e), r);
1105
1188
  switch (t.mode) {
1106
1189
  case "move": {
1107
- let c = i.from;
1108
- const l = o.viewport().scale, d = l.fromPx(e) - t.t0;
1109
- if (a.includes("move") && Math.abs(d * l.m) >= he) {
1110
- const g = j(o.options.calendar), b = B(i.from, g) + d, I = g.intervals.length === 0 ? b : U(Math.max(0, Math.min(g.total, b)), g);
1111
- c = this.snapInside(I, r);
1112
- }
1190
+ let d = i.from;
1191
+ const l = n.viewport().scale, c = l.fromPx(e) - t.t0;
1192
+ a.includes("move") && Math.abs(c * l.m) >= Me && (d = this.shifted(i.from, c, r));
1113
1193
  let p = t.ghost.lane;
1114
1194
  if (a.includes("lane")) {
1115
- const g = this.onLane(s) ?? p;
1116
- this.refused = t.refused.has(g), this.refused || (p = g);
1195
+ const m = this.onLane(s) ?? p;
1196
+ this.refused = t.refused.has(m), this.refused || (p = m);
1117
1197
  } else
1118
1198
  this.refused = !1;
1119
- return { ...i, from: c, to: c + (i.to - i.from), lane: p };
1199
+ return { ...i, from: d, to: d + (i.to - i.from), lane: p };
1120
1200
  }
1121
1201
  case "stretch-from":
1122
- return { ...i, from: Math.min(u, i.to - Math.max(r.step, q)) };
1202
+ return { ...i, from: Math.min(h, i.to - Math.max(r.step, W)) };
1123
1203
  case "stretch-to":
1124
- return { ...i, to: Math.max(u, i.from + Math.max(r.step, q)) };
1125
- case "setup":
1126
- return { ...i, setup: Math.max(0, i.from - u) };
1127
- case "teardown":
1128
- return { ...i, teardown: Math.max(0, u - i.to) };
1204
+ return { ...i, to: Math.max(h, i.from + Math.max(r.step, W)) };
1205
+ case "leadIn":
1206
+ return { ...i, leadIn: Math.max(0, i.from - h) };
1207
+ case "leadOut":
1208
+ return { ...i, leadOut: Math.max(0, h - i.to) };
1129
1209
  }
1130
1210
  }
1211
+ /** A time moved by an amount of WORKING time and snapped: a drag moves
1212
+ a start this way, and a key by one step of the raster - one arithmetic,
1213
+ so a key proposes exactly what a drag of that length would. */
1214
+ shifted(t, e, s) {
1215
+ const n = q(this.host.view.options.calendar), i = K(t, n) + e, r = n.intervals.length === 0 ? i : z(Math.max(0, Math.min(n.total, i)), n);
1216
+ return this.snapInside(r, s);
1217
+ }
1131
1218
  /** Snapped - and, where the raster lands in time the calendar removes, moved
1132
1219
  on to the seam, where time counts again. An intent never asks for a time
1133
- the plant does not run. */
1220
+ nobody works. */
1134
1221
  snapInside(t, e) {
1135
- const s = $s(t, e), o = j(this.host.view.options.calendar);
1136
- return o.intervals.length === 0 ? s : U(B(s, o), o);
1222
+ const s = Js(t, e), n = q(this.host.view.options.calendar);
1223
+ return n.intervals.length === 0 ? s : z(K(s, n), n);
1137
1224
  }
1138
1225
  intentsOf(t, e, s) {
1139
- const o = [], i = this.host.view.options.intents, r = t.id;
1140
- return s === "move" ? (e.from !== t.from && i.includes("move") && o.push({ kind: "move", subtask: r, from: e.from, to: e.to }), e.lane !== t.lane && i.includes("lane") && o.push({ kind: "lane", subtask: r, lane: e.lane })) : s === "stretch-from" || s === "stretch-to" ? (e.from !== t.from || e.to !== t.to) && o.push({ kind: "stretch", subtask: r, from: e.from, to: e.to }) : s === "setup" ? (e.setup ?? 0) !== (t.setup ?? 0) && o.push({ kind: "setup", subtask: r, setup: e.setup ?? 0 }) : (e.teardown ?? 0) !== (t.teardown ?? 0) && o.push({ kind: "teardown", subtask: r, teardown: e.teardown ?? 0 }), o;
1226
+ const n = [], i = this.host.view.options.intents, r = t.id;
1227
+ return s === "move" ? (e.from !== t.from && i.includes("move") && n.push({ kind: "move", subtask: r, from: e.from, to: e.to }), e.lane !== t.lane && i.includes("lane") && n.push({ kind: "lane", subtask: r, lane: e.lane })) : s === "stretch-from" || s === "stretch-to" ? (e.from !== t.from || e.to !== t.to) && n.push({ kind: "stretch", subtask: r, from: e.from, to: e.to }) : s === "leadIn" ? (e.leadIn ?? 0) !== (t.leadIn ?? 0) && n.push({ kind: "leadIn", subtask: r, leadIn: e.leadIn ?? 0 }) : (e.leadOut ?? 0) !== (t.leadOut ?? 0) && n.push({ kind: "leadOut", subtask: r, leadOut: e.leadOut ?? 0 }), n;
1141
1228
  }
1142
1229
  /** The lane the ghost came from - the only other lane a drag can touch. */
1143
1230
  ghostHome(t) {
@@ -1153,57 +1240,282 @@ class Bs {
1153
1240
  keeps a plan of hundreds of tasks fluid while a drag runs, since this is
1154
1241
  computed on every pointer movement. */
1155
1242
  ghostFindings(t, e) {
1156
- const s = this.host.data, o = (l) => l.lane === t.lane || l.lane === e, r = [...s.subtasks.filter((l) => l.id !== t.id && o(l)), t], a = (l) => l.first === t.id || l.second === t.id, u = s.transports.filter((l) => l.from === t.id || l.to === t.id), c = t.id === re ? s.subtasks : s.subtasks.map((l) => l.id === t.id ? t : l);
1157
- return { overlaps: At(r).filter(a), late: _t(c, u) };
1243
+ const s = this.host.data, n = (l) => l.lane === t.lane || l.lane === e, r = [...s.subtasks.filter((l) => l.id !== t.id && n(l)), t], a = (l) => l.first === t.id || l.second === t.id, h = s.dependencies.filter((l) => l.from === t.id || l.to === t.id), d = t.id === we ? s.subtasks : s.subtasks.map((l) => l.id === t.id ? t : l);
1244
+ return { overlaps: $t(r).filter(a), violated: Ht(d, h) };
1245
+ }
1246
+ }
1247
+ function sn(o, t) {
1248
+ const e = /* @__PURE__ */ new Map();
1249
+ for (const s of t) {
1250
+ const n = o.slots.get(s.lane), i = n === void 0 ? null : Z(o, n.top);
1251
+ if (i === null) continue;
1252
+ const r = o.rows.indexOf(i);
1253
+ e.set(r, [...e.get(r) ?? [], s]);
1254
+ }
1255
+ return [...e.entries()].sort(([s], [n]) => s - n).map(([, s]) => s.sort((n, i) => n.from - i.from || n.to - i.to));
1256
+ }
1257
+ const Te = (o, t) => t < o.from ? o.from - t : t > o.to ? t - o.to : 0;
1258
+ function nn(o, t, e, s) {
1259
+ var d;
1260
+ let n = -1, i = -1;
1261
+ for (let l = 0; l < o.length && t !== null && n < 0; l++)
1262
+ i = o[l].findIndex((c) => c.id === t), i >= 0 && (n = l);
1263
+ if (n < 0) {
1264
+ for (const l of o) {
1265
+ const c = l.find((p) => p.to > s[0] && p.from < s[1]);
1266
+ if (c !== void 0) return c;
1267
+ }
1268
+ return ((d = o[0]) == null ? void 0 : d[0]) ?? null;
1269
+ }
1270
+ const r = o[n], a = r[i], h = (s[1] - s[0]) / 10;
1271
+ switch (e) {
1272
+ case "next":
1273
+ return r[i + 1] ?? a;
1274
+ case "previous":
1275
+ return r[i - 1] ?? a;
1276
+ case "first":
1277
+ return r[0];
1278
+ case "last":
1279
+ return r[r.length - 1];
1280
+ case "pageNext":
1281
+ return r.find((l, c) => c > i && l.from >= a.from + h) ?? r[r.length - 1];
1282
+ case "pagePrevious":
1283
+ for (let l = i - 1; l >= 0; l--) if (r[l].from <= a.from - h) return r[l];
1284
+ return r[0];
1285
+ case "up":
1286
+ case "down": {
1287
+ const l = o[e === "up" ? n - 1 : n + 1];
1288
+ if (l === void 0) return a;
1289
+ const c = (a.from + a.to) / 2;
1290
+ return l.reduce((p, m) => Te(m, c) < Te(p, c) ? m : p);
1291
+ }
1158
1292
  }
1159
1293
  }
1160
- const _e = [], Hs = 56;
1161
- function Ys(n, t = Hs) {
1162
- return n > 0 ? Math.min(st, Math.max(15 * q, je(n * t, 1))) : 15 * q;
1163
- }
1164
- function Xs(n, t, e = _e) {
1165
- const [s, o] = Fe(n, e);
1166
- return Ve(e, s, o, t, me(s)).filter(
1167
- (i) => i.operatingTime >= n[0] && i.operatingTime <= n[1]
1294
+ function on(o, t, e, s) {
1295
+ if (e.kind === "dependency") {
1296
+ const i = o.find((a) => a.id === e.id), r = i === void 0 ? void 0 : s === "out" ? i.to : i.from;
1297
+ return r !== void 0 && t.has(r) ? { kind: "subtask", id: r } : e;
1298
+ }
1299
+ const n = o.find(
1300
+ (i) => (s === "out" ? i.from : i.to) === e.id && t.has(s === "out" ? i.to : i.from)
1301
+ );
1302
+ return n === void 0 ? e : { kind: "dependency", id: n.id };
1303
+ }
1304
+ const rn = 150, an = {
1305
+ ArrowRight: "next",
1306
+ ArrowLeft: "previous",
1307
+ ArrowUp: "up",
1308
+ ArrowDown: "down",
1309
+ Home: "first",
1310
+ End: "last",
1311
+ PageDown: "pageNext",
1312
+ PageUp: "pagePrevious"
1313
+ };
1314
+ class ln {
1315
+ constructor(t) {
1316
+ f(this, "spoken", null);
1317
+ f(this, "timer", null);
1318
+ this.host = t;
1319
+ }
1320
+ /** Where the keys stand: the hover, whoever set it. */
1321
+ active() {
1322
+ const t = this.host.gestures.hover;
1323
+ return t.kind === "subtask" ? { kind: "subtask", id: t.subtask.id } : t.kind === "dependency" ? { kind: "dependency", id: t.dependency.id } : null;
1324
+ }
1325
+ /** The focus came in by keyboard: the walk starts where the pointer
1326
+ stands, or at the first subtask in view. A click focuses the plot too,
1327
+ and must not start it. */
1328
+ focus(t) {
1329
+ !t || this.active() !== null || this.walk("first");
1330
+ }
1331
+ /** The focus left: the keys' subtask goes with it. */
1332
+ blur() {
1333
+ this.host.gestures.byKeyboard && this.host.gestures.setKeyboardHover({ kind: "nothing" }, { x: 0, y: 0 });
1334
+ }
1335
+ /** A key on the plot; true where the schedule took it. */
1336
+ key(t) {
1337
+ const e = this.host.gestures;
1338
+ if (t.metaKey || !e.idle) return !1;
1339
+ const s = t.key.toLowerCase() === "t" && !t.ctrlKey && !t.altKey;
1340
+ if (t.key === "]" || t.key === "[" || s) {
1341
+ const i = this.active();
1342
+ if (i === null) return !1;
1343
+ const r = this.host.data, a = s ? !t.shiftKey : t.key === "]";
1344
+ return this.show(on(r.dependencies, r.subtaskById, i, a ? "out" : "back")), !0;
1345
+ }
1346
+ if (t.ctrlKey) return !1;
1347
+ if (t.altKey) return this.edit(t);
1348
+ if (t.key === "Escape")
1349
+ return e.byKeyboard ? (this.blur(), !0) : !1;
1350
+ if (t.key === "Enter" || t.key === " ") return this.select();
1351
+ const n = t.shiftKey ? void 0 : an[t.key];
1352
+ return n === void 0 ? !1 : (this.walk(n), !0);
1353
+ }
1354
+ walk(t) {
1355
+ var h;
1356
+ const { data: e, view: s } = this.host, n = this.active(), i = n === null ? null : n.kind === "subtask" ? n.id : ((h = e.dependencies.find((d) => d.id === n.id)) == null ? void 0 : h.from) ?? null;
1357
+ let r = sn(s.rows, e.subtasks);
1358
+ if (i === null) {
1359
+ const d = r.filter((l) => {
1360
+ const c = s.boxById.get(l[0].id);
1361
+ return c !== void 0 && c.y + c.height > 0 && c.y < s.height;
1362
+ });
1363
+ d.length > 0 && (r = d);
1364
+ }
1365
+ const a = nn(r, i, t, this.host.visibleDomain());
1366
+ a !== null && this.show({ kind: "subtask", id: a.id });
1367
+ }
1368
+ /** Space and Enter select as a click does: the whole task, and the subtask. */
1369
+ select() {
1370
+ const t = this.host.gestures.hover;
1371
+ if (t.kind === "subtask") this.host.select(t.subtask.task, t.subtask.id);
1372
+ else if (t.kind === "dependency") this.host.select(this.host.data.taskOfDependency(t.dependency), null);
1373
+ else return !1;
1374
+ return !0;
1375
+ }
1376
+ /** Alt+←/→ proposes a move by one step of the raster, Alt+Shift+←/→ a new
1377
+ end - the intents a drag of that length reports (ADR-0023), and only
1378
+ where the caller handles them. Nothing is applied here. */
1379
+ edit(t) {
1380
+ var c, p;
1381
+ const e = this.host.gestures.hover, s = t.key === "ArrowRight" ? 1 : t.key === "ArrowLeft" ? -1 : 0;
1382
+ if (s === 0) return !1;
1383
+ if (e.kind !== "subtask") return !0;
1384
+ const n = e.subtask, i = this.host.gestures, r = this.host.view.options.intents, a = i.snapStep(), h = a.step > 0 ? a : { step: this.host.view.step(), offset: 0 }, d = this.host.data.blocked;
1385
+ let l = null;
1386
+ if (!t.shiftKey && r.includes("move")) {
1387
+ const m = (C) => ({ ...n, from: C, to: C + (n.to - n.from) });
1388
+ let y = n.from;
1389
+ for (let C = 0; C < 1e3; C++) {
1390
+ const S = i.shifted(y, s * h.step, h);
1391
+ if (S === y || (y = S, !it(m(y), n, d))) break;
1392
+ }
1393
+ y !== n.from && !it(m(y), n, d) && (l = { kind: "move", subtask: n.id, from: y, to: m(y).to });
1394
+ } else if (t.shiftKey && r.includes("stretch")) {
1395
+ const m = Math.max(i.shifted(n.to, s * h.step, h), n.from + Math.max(h.step, W));
1396
+ m !== n.to && !it({ ...n, to: m }, n, d) && (l = { kind: "stretch", subtask: n.id, from: n.from, to: m });
1397
+ }
1398
+ return i.byKeyboard = !0, l !== null && ((p = (c = this.host.handlers()).onIntent) == null || p.call(c, l)), this.scheduleReadout(), !0;
1399
+ }
1400
+ /** The keys stand on this target: brought into view, drawn as the hover. */
1401
+ show(t, e = !0) {
1402
+ const s = this.hitOf(t);
1403
+ if (s === null) return;
1404
+ e && this.reveal(t);
1405
+ const n = this.bounds(t);
1406
+ if (n === null) return;
1407
+ const { view: i } = this.host, r = (a, h) => Math.max(0, Math.min(h, a));
1408
+ this.host.gestures.setKeyboardHover(s, {
1409
+ x: (r(n.x0, i.width) + r(n.x1, i.width)) / 2,
1410
+ y: (r(n.y0, i.height) + r(n.y1, i.height)) / 2
1411
+ }), e && this.scheduleReadout();
1412
+ }
1413
+ hitOf(t) {
1414
+ const e = this.host.data;
1415
+ if (t.kind === "subtask") {
1416
+ const n = e.subtaskById.get(t.id);
1417
+ return n === void 0 ? null : { kind: "subtask", subtask: n, part: "main" };
1418
+ }
1419
+ const s = e.dependencies.find((n) => n.id === t.id);
1420
+ return s === void 0 ? null : { kind: "dependency", dependency: s };
1421
+ }
1422
+ /** Where a target lies on the plot: a subtask's bar, or the span between
1423
+ the two bars a dependency joins. */
1424
+ bounds(t) {
1425
+ const e = this.host.view, s = (a) => e.boxById.get(a);
1426
+ if (t.kind === "subtask") {
1427
+ const a = s(t.id);
1428
+ return a === void 0 ? null : { x0: a.outerFrom, x1: a.outerTo, y0: a.y, y1: a.y + a.height };
1429
+ }
1430
+ const n = this.host.data.dependencies.find((a) => a.id === t.id), i = n === void 0 ? void 0 : s(n.from), r = n === void 0 ? void 0 : s(n.to);
1431
+ return i === void 0 || r === void 0 ? null : {
1432
+ x0: Math.min(i.mainTo, r.mainFrom),
1433
+ x1: Math.max(i.mainTo, r.mainFrom),
1434
+ y0: Math.min(i.y, r.y),
1435
+ y1: Math.max(i.y + i.height, r.y + r.height)
1436
+ };
1437
+ }
1438
+ /** Pans and scrolls just enough to bring a target into view, with a margin
1439
+ at the side it came in from; a target wider than the view shows its
1440
+ start. As a drag at the edge pans along, the keys do. */
1441
+ reveal(t) {
1442
+ const e = this.bounds(t), s = this.host.view;
1443
+ if (e === null || s.width <= 0) return;
1444
+ const n = Math.min(24, s.width / 10), i = e.x0 < 0 ? e.x0 - n : e.x1 > s.width ? Math.max(0, Math.min(e.x1 - s.width + n, e.x0 - n)) : 0, r = e.y0 < 0 ? e.y0 : e.y1 > s.height ? Math.min(e.y1 - s.height, e.y0) : 0;
1445
+ if (i === 0 && r === 0) return;
1446
+ const a = s.pan(i, r);
1447
+ a.moved && this.host.viewMoved(a.time);
1448
+ }
1449
+ /** After the data or the view changed: the keys' target is read anew by its
1450
+ id - its new times, its new place -, and dropped where it is gone. */
1451
+ refresh() {
1452
+ const t = this.active();
1453
+ !this.host.gestures.byKeyboard || t === null || (this.hitOf(t) === null || this.bounds(t) === null ? this.blur() : this.show(t, !1));
1454
+ }
1455
+ /** The readout, written once the keys rest - and only while they still hold
1456
+ the hover: a pointer that took it over in the pause is not spoken for. */
1457
+ scheduleReadout() {
1458
+ this.timer !== null && clearTimeout(this.timer), this.timer = setTimeout(() => {
1459
+ var s;
1460
+ this.timer = null;
1461
+ const t = this.host.gestures.hover;
1462
+ if (!this.host.gestures.byKeyboard) return;
1463
+ const e = this.host.data.tooltipTargetFor(t);
1464
+ e !== null && (this.spoken = { target: e, lane: t.kind === "subtask" ? t.subtask.lane : null, count: (((s = this.spoken) == null ? void 0 : s.count) ?? 0) + 1 }, this.host.spokenChanged());
1465
+ }, rn);
1466
+ }
1467
+ /** Unmount: no readout after it. */
1468
+ stop() {
1469
+ this.timer !== null && clearTimeout(this.timer), this.timer = null;
1470
+ }
1471
+ }
1472
+ const Ye = [], hn = 56;
1473
+ function dn(o, t = hn) {
1474
+ return o > 0 ? Math.min(rt, Math.max(15 * W, hs(o * t, 1))) : 15 * W;
1475
+ }
1476
+ function un(o, t, e = Ye) {
1477
+ const [s, n] = Ke(o, e);
1478
+ return ds(e, s, n, t, _e(s)).filter(
1479
+ (i) => i.workingTime >= o[0] && i.workingTime <= o[1]
1168
1480
  );
1169
1481
  }
1170
- function Ks(n, t = _e) {
1171
- const [e, s] = Fe(n, t), o = [], i = new Date(e);
1172
- for (i.setHours(0, 0, 0, 0); i.getTime() < s && o.length < 400; ) {
1482
+ function cn(o, t = Ye) {
1483
+ const [e, s] = Ke(o, t), n = [], i = new Date(e);
1484
+ for (i.setHours(0, 0, 0, 0); i.getTime() < s && n.length < 400; ) {
1173
1485
  const r = i.getTime();
1174
1486
  i.setDate(i.getDate() + 1);
1175
1487
  const a = i.getTime();
1176
- o.push({
1488
+ n.push({
1177
1489
  start: r,
1178
1490
  end: a,
1179
- from: B(r, t),
1180
- to: B(a, t)
1491
+ from: K(r, t),
1492
+ to: K(a, t)
1181
1493
  });
1182
1494
  }
1183
- return o;
1495
+ return n;
1184
1496
  }
1185
- function Us(n, t, e, s) {
1186
- const o = n[1] - n[0];
1187
- if (!(o > 0)) return [n[0], n[1]];
1188
- const i = Math.min(s.max, Math.max(s.min, o * e)), r = (t - n[0]) / o, a = t - r * i;
1497
+ function fn(o, t, e, s) {
1498
+ const n = o[1] - o[0];
1499
+ if (!(n > 0)) return [o[0], o[1]];
1500
+ const i = Math.min(s.max, Math.max(s.min, n * e)), r = (t - o[0]) / n, a = t - r * i;
1189
1501
  return [a, a + i];
1190
1502
  }
1191
- function zs(n, t) {
1192
- return [n[0] + t, n[1] + t];
1503
+ function pn(o, t) {
1504
+ return [o[0] + t, o[1] + t];
1193
1505
  }
1194
- function Fe(n, t) {
1195
- const e = j(t);
1196
- if (e.intervals.length === 0) return [n[0], n[1]];
1197
- const s = (o) => Math.max(0, Math.min(e.total, o));
1198
- return [U(s(n[0]), e), U(s(n[1]), e)];
1506
+ function Ke(o, t) {
1507
+ const e = q(t);
1508
+ if (e.intervals.length === 0) return [o[0], o[1]];
1509
+ const s = (n) => Math.max(0, Math.min(e.total, n));
1510
+ return [z(s(o[0]), e), z(s(o[1]), e)];
1199
1511
  }
1200
- const lt = 44;
1201
- class Ws {
1512
+ const ct = 44;
1513
+ class mn {
1202
1514
  constructor(t) {
1203
1515
  f(this, "options", {
1204
- laneHeight: lt,
1516
+ laneHeight: ct,
1205
1517
  calendar: [],
1206
- zoomLimits: { min: Tt, max: 28 * st },
1518
+ zoomLimits: { min: Et, max: 28 * rt },
1207
1519
  snap: "ticks",
1208
1520
  intents: [],
1209
1521
  now: null,
@@ -1211,14 +1523,14 @@ class Ws {
1211
1523
  attach: "centre",
1212
1524
  ends: "dot"
1213
1525
  });
1214
- f(this, "domain", [0, st]);
1526
+ f(this, "domain", [0, rt]);
1215
1527
  f(this, "scrollY", 0);
1216
1528
  f(this, "width", 0);
1217
1529
  f(this, "height", 0);
1218
1530
  /* What is laid out from top to bottom (`rows.ts`). It is derived here and
1219
1531
  not in the data, because a row's height comes from a view option; every y
1220
1532
  in the package reads it. */
1221
- f(this, "rows", qt({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: lt }));
1533
+ f(this, "rows", le({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: ct }));
1222
1534
  /** The folded groups, as the scene holds them. */
1223
1535
  f(this, "collapsed", /* @__PURE__ */ new Set());
1224
1536
  /** The groups a gesture in flight holds open. Dropped when it ends; the
@@ -1232,20 +1544,20 @@ class Ws {
1232
1544
  /** Takes new options; an initial domain in wall-clock time puts the view
1233
1545
  there, and a new calendar keeps the wall-clock span in view. */
1234
1546
  setOptions(t, e) {
1235
- const s = t.calendar !== this.options.calendar, o = this.options.calendar;
1547
+ const s = t.calendar !== this.options.calendar, n = this.options.calendar;
1236
1548
  if (this.options = t, e !== null)
1237
- this.domain = [B(e[0], t.calendar), B(e[1], t.calendar)];
1549
+ this.domain = [K(e[0], t.calendar), K(e[1], t.calendar)];
1238
1550
  else if (s) {
1239
- const i = j(o), r = (a) => {
1240
- const u = i.intervals.length === 0 ? a : Math.max(0, Math.min(i.total, a));
1241
- return B(U(u, i), t.calendar) + (a - u);
1551
+ const i = q(n), r = (a) => {
1552
+ const h = i.intervals.length === 0 ? a : Math.max(0, Math.min(i.total, a));
1553
+ return K(z(h, i), t.calendar) + (a - h);
1242
1554
  };
1243
1555
  this.domain = [r(this.domain[0]), r(this.domain[1])];
1244
1556
  }
1245
1557
  }
1246
1558
  viewport() {
1247
1559
  return {
1248
- scale: new Ze(this.domain, [0, this.width]),
1560
+ scale: new us(this.domain, [0, this.width]),
1249
1561
  calendar: this.options.calendar,
1250
1562
  laneHeight: this.options.laneHeight,
1251
1563
  scrollY: this.scrollY,
@@ -1262,28 +1574,28 @@ class Ws {
1262
1574
  /** The fine band's step at the current zoom. */
1263
1575
  step() {
1264
1576
  const t = this.domain[1] - this.domain[0];
1265
- return Ys(this.width > 0 ? t / this.width : t);
1577
+ return dn(this.width > 0 ? t / this.width : t);
1266
1578
  }
1267
1579
  /** Lays the rows out, clamps the scroll, and lays the data out anew. */
1268
1580
  layout() {
1269
- this.rows = qt({
1581
+ this.rows = le({
1270
1582
  lanes: this.data.lanes,
1271
1583
  groups: this.data.groups,
1272
- collapsed: rs(this.collapsed, this.openForGesture),
1584
+ collapsed: ws(this.collapsed, this.openForGesture),
1273
1585
  laneHeight: this.options.laneHeight
1274
1586
  }), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY));
1275
1587
  const t = this.viewport();
1276
1588
  this.boxes = [], this.boxById = /* @__PURE__ */ new Map();
1277
1589
  for (const e of this.data.subtasks) {
1278
- const s = Lt(this.rows, e.lane);
1590
+ const s = Nt(this.rows, e.lane);
1279
1591
  if (s === null) continue;
1280
- const o = Te(t, e, e.lane, s, this.data.depth.get(e.id) ?? 0);
1281
- this.boxes.push(o), this.boxById.set(e.id, o);
1592
+ const n = Re(t, e, e.lane, s, this.data.depth.get(e.id) ?? 0);
1593
+ this.boxes.push(n), this.boxById.set(e.id, n);
1282
1594
  }
1283
1595
  this.paths = [];
1284
- for (const e of this.data.transports) {
1285
- const s = this.boxById.get(e.from), o = this.boxById.get(e.to);
1286
- s === void 0 || o === void 0 || this.paths.push(bt(t, e, s, o, this.options));
1596
+ for (const e of this.data.dependencies) {
1597
+ const s = this.boxById.get(e.from), n = this.boxById.get(e.to);
1598
+ s === void 0 || n === void 0 || this.paths.push(_t(t, e, s, n, this.options));
1287
1599
  }
1288
1600
  }
1289
1601
  /** The days of the coarse band and the ticks of the fine band, in pixels. */
@@ -1292,11 +1604,11 @@ class Ws {
1292
1604
  if (this.width <= 0) return { days: [], ticks: [], step: t };
1293
1605
  const e = this.viewport().scale, s = this.options.calendar;
1294
1606
  return {
1295
- days: Ks(this.domain, s).map((o) => {
1296
- const i = Math.round(e.toPx(o.from));
1297
- return { start: o.start, x: i, width: Math.round(e.toPx(o.to)) - i };
1607
+ days: cn(this.domain, s).map((n) => {
1608
+ const i = Math.round(e.toPx(n.from));
1609
+ return { start: n.start, x: i, width: Math.round(e.toPx(n.to)) - i };
1298
1610
  }),
1299
- ticks: Xs(this.domain, t, s).map((o) => ({ wallClock: o.wallClock, x: Math.round(e.toPx(o.operatingTime)) })),
1611
+ ticks: un(this.domain, t, s).map((n) => ({ wallClock: n.wallClock, x: Math.round(e.toPx(n.workingTime)) })),
1300
1612
  step: t
1301
1613
  };
1302
1614
  }
@@ -1304,27 +1616,27 @@ class Ws {
1304
1616
  nowX() {
1305
1617
  const t = this.options.now;
1306
1618
  if (t === null || this.width <= 0) return null;
1307
- const e = Math.round(this.viewport().scale.toPx(B(t, this.options.calendar)));
1619
+ const e = Math.round(this.viewport().scale.toPx(K(t, this.options.calendar)));
1308
1620
  return e >= 0 && e <= this.width ? e : null;
1309
1621
  }
1310
1622
  hitAt(t, e) {
1311
1623
  for (let r = this.boxes.length - 1; r >= 0; r--) {
1312
- const a = this.boxes[r], u = Ce(a, t, e);
1313
- if (u !== null) return { kind: "subtask", subtask: a.subtask, part: u };
1624
+ const a = this.boxes[r], h = Pe(a, t, e);
1625
+ if (h !== null) return { kind: "subtask", subtask: a.subtask, part: h };
1314
1626
  }
1315
- let s = null, o = 4;
1627
+ let s = null, n = 4;
1316
1628
  for (const r of this.paths) {
1317
- const a = fs(r, t, e);
1318
- a <= o && (o = a, s = r);
1629
+ const a = Ss(r, t, e);
1630
+ a <= n && (n = a, s = r);
1319
1631
  }
1320
- if (s !== null) return { kind: "transport", transport: s.transport };
1321
- const i = Jt(this.viewport(), e);
1632
+ if (s !== null) return { kind: "dependency", dependency: s.dependency };
1633
+ const i = ce(this.viewport(), e);
1322
1634
  return i !== null ? { kind: "lane", lane: i } : { kind: "nothing" };
1323
1635
  }
1324
1636
  /** The wall-clock time at a plot x; within the calendar's extent. */
1325
1637
  timeAt(t) {
1326
- const e = this.viewport().scale.fromPx(t), s = j(this.options.calendar);
1327
- return s.intervals.length === 0 ? e : U(Math.max(0, Math.min(s.total, e)), s);
1638
+ const e = this.viewport().scale.fromPx(t), s = q(this.options.calendar);
1639
+ return s.intervals.length === 0 ? e : z(Math.max(0, Math.min(s.total, e)), s);
1328
1640
  }
1329
1641
  /** The lane at a y, strips included: what the pointer is ON.
1330
1642
 
@@ -1333,60 +1645,63 @@ class Ws {
1333
1645
  `foldedGroupAt` - and a caller that reached through `viewport()` for it
1334
1646
  would be depending on the layout rather than asking the view. */
1335
1647
  laneIdAt(t) {
1336
- return Jt(this.viewport(), t);
1648
+ return ce(this.viewport(), t);
1337
1649
  }
1338
1650
  /** The lane a DROP at this y would land on.
1339
1651
 
1340
- A **Miniature** is no drop target. A strip is three pixels of a machine's
1652
+ A **Miniature** is no drop target. A strip is three pixels of a lane's
1341
1653
  whole day, and a drop aimed at one would be a guess; resting over the
1342
1654
  group opens it for the gesture instead, and then there is a real lane to
1343
1655
  aim at. Hover, the tooltip and selection do read a strip - they cost
1344
1656
  nothing if they are a pixel out. */
1345
1657
  dropLaneIdAt(t) {
1346
- const e = nt(this.rows, t + this.scrollY);
1658
+ const e = Z(this.rows, t + this.scrollY);
1347
1659
  return e === null || e.kind !== "lane" ? null : e.lane ?? null;
1348
1660
  }
1349
1661
  /** The folded group a y lies over, or null. */
1350
1662
  foldedGroupAt(t) {
1351
- const e = nt(this.rows, t + this.scrollY);
1663
+ const e = Z(this.rows, t + this.scrollY);
1352
1664
  return e !== null && e.kind === "miniature" ? e.group ?? null : null;
1353
1665
  }
1354
1666
  /** Pans by pixels. Says what moved: the span through time, the lanes, or
1355
1667
  neither - a scroll through the lanes is no news about the time. */
1356
1668
  pan(t, e) {
1357
- const s = this.domain[0], o = this.scrollY, i = this.domain[1] - s;
1358
- this.width > 0 && t !== 0 && (this.domain = zs(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
1669
+ const s = this.domain[0], n = this.scrollY, i = this.domain[1] - s;
1670
+ this.width > 0 && t !== 0 && (this.domain = pn(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
1359
1671
  const r = this.domain[0] !== s;
1360
- return { moved: r || this.scrollY !== o, time: r };
1672
+ return { moved: r || this.scrollY !== n, time: r };
1361
1673
  }
1362
1674
  /** Zooms around a plot x; says whether the span changed. */
1363
1675
  zoomAt(t, e) {
1364
1676
  if (this.width <= 0 || !Number.isFinite(e)) return !1;
1365
- const s = this.domain, o = this.viewport().scale.fromPx(t);
1366
- return this.domain = Us(this.domain, o, e, this.options.zoomLimits), s[0] !== this.domain[0] || s[1] !== this.domain[1];
1677
+ const s = this.domain, n = this.viewport().scale.fromPx(t);
1678
+ return this.domain = fn(this.domain, n, e, this.options.zoomLimits), s[0] !== this.domain[0] || s[1] !== this.domain[1];
1367
1679
  }
1368
1680
  }
1369
- const ue = {
1681
+ const Ie = {
1370
1682
  width: 0,
1371
1683
  height: 0,
1372
- laneHeight: lt,
1684
+ laneHeight: ct,
1373
1685
  scrollY: 0,
1374
1686
  headers: [],
1375
1687
  days: [],
1376
1688
  ticks: [],
1377
- step: Tt,
1689
+ step: Et,
1378
1690
  ghost: null,
1379
1691
  grips: [],
1380
1692
  cursor: "default",
1381
1693
  tooltip: null,
1382
1694
  now: null,
1383
- bars: []
1695
+ bars: [],
1696
+ spoken: null,
1697
+ summary: { lanes: 0, subtasks: 0, from: 0, to: 0, overlaps: 0, violated: 0, blocked: 0 }
1384
1698
  };
1385
- class qs {
1699
+ class gn {
1386
1700
  constructor() {
1387
- f(this, "data", new ms(() => this.viewChanged()));
1388
- f(this, "view", new Ws(this.data));
1701
+ f(this, "data", new _s(() => this.viewChanged()));
1702
+ f(this, "view", new mn(this.data));
1389
1703
  f(this, "gestures");
1704
+ f(this, "keys");
1390
1705
  f(this, "handlersNow", {});
1391
1706
  f(this, "placing", null);
1392
1707
  f(this, "controlledTask");
@@ -1405,7 +1720,7 @@ class qs {
1405
1720
  f(this, "frame", 0);
1406
1721
  f(this, "domainFrame", 0);
1407
1722
  f(this, "unsubscribeTheme", null);
1408
- f(this, "snapshot", ue);
1723
+ f(this, "snapshot", Ie);
1409
1724
  f(this, "listeners", /* @__PURE__ */ new Set());
1410
1725
  /* ---------------------------------------------------------------- */
1411
1726
  /* Registration and options */
@@ -1423,7 +1738,7 @@ class qs {
1423
1738
  this.listeners.delete(t);
1424
1739
  }));
1425
1740
  f(this, "getSnapshot", () => this.snapshot);
1426
- f(this, "getServerSnapshot", () => ue);
1741
+ f(this, "getServerSnapshot", () => Ie);
1427
1742
  /* ---------------------------------------------------------------- */
1428
1743
  /* Gestures, as the component hands them in */
1429
1744
  /* ---------------------------------------------------------------- */
@@ -1438,7 +1753,10 @@ class qs {
1438
1753
  f(this, "drop", (t) => this.gestures.drop(t));
1439
1754
  f(this, "dragLeave", () => this.gestures.clearPlacing());
1440
1755
  f(this, "cancelEdit", () => this.gestures.cancelEdit());
1441
- this.gestures = new Bs({
1756
+ f(this, "key", (t) => this.keys.key(t));
1757
+ f(this, "focus", (t) => this.keys.focus(t));
1758
+ f(this, "blur", () => this.keys.blur());
1759
+ this.gestures = new en({
1442
1760
  data: this.data,
1443
1761
  view: this.view,
1444
1762
  plotElement: () => this.plot,
@@ -1450,6 +1768,17 @@ class qs {
1450
1768
  this.viewChanged(), t && this.reportDomain();
1451
1769
  },
1452
1770
  interactionChanged: () => this.interactionChanged()
1771
+ }), this.keys = new ln({
1772
+ data: this.data,
1773
+ view: this.view,
1774
+ gestures: this.gestures,
1775
+ handlers: () => this.handlersNow,
1776
+ visibleDomain: () => this.visibleDomain(),
1777
+ select: (t, e) => this.select(t, e),
1778
+ viewMoved: (t) => {
1779
+ this.viewChanged(), t && this.reportDomain();
1780
+ },
1781
+ spokenChanged: () => this.publish()
1453
1782
  });
1454
1783
  }
1455
1784
  setOptions(t, e) {
@@ -1476,9 +1805,9 @@ class qs {
1476
1805
  /** Folds or unfolds one group. The caller's list is never written to: where
1477
1806
  the state is controlled, only the report goes out. */
1478
1807
  toggleGroup(t) {
1479
- var o, i;
1808
+ var n, i;
1480
1809
  const e = this.collapsedGroups, s = e.includes(t) ? e.filter((r) => r !== t) : [...e, t];
1481
- this.controlledCollapsed === void 0 && (this.ownCollapsed = s), (i = (o = this.handlersNow).onCollapsedGroupsChange) == null || i.call(o, s), this.viewChanged();
1810
+ this.controlledCollapsed === void 0 && (this.ownCollapsed = s), (i = (n = this.handlersNow).onCollapsedGroupsChange) == null || i.call(n, s), this.viewChanged();
1482
1811
  }
1483
1812
  /** `undefined`: the scene keeps the selection itself. */
1484
1813
  setControlledTask(t) {
@@ -1488,38 +1817,38 @@ class qs {
1488
1817
  return this.controlledTask !== void 0 ? this.controlledTask : this.ownTask;
1489
1818
  }
1490
1819
  select(t, e) {
1491
- var o, i;
1820
+ var n, i;
1492
1821
  const s = t !== this.selectedTask || e !== this.selected;
1493
- this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), s && ((i = (o = this.handlersNow).onSelectedTaskChange) == null || i.call(o, t, e)), this.interactionChanged();
1822
+ this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), s && ((i = (n = this.handlersNow).onSelectedTaskChange) == null || i.call(n, t, e)), this.interactionChanged();
1494
1823
  }
1495
1824
  /* ---------------------------------------------------------------- */
1496
1825
  /* DOM binding */
1497
1826
  /* ---------------------------------------------------------------- */
1498
- bind(t, e, s, o) {
1499
- this.root = t, this.plot = e, this.dataCanvas = s, this.overlayCanvas = o, this.unsubscribeTheme = Je(() => {
1827
+ bind(t, e, s, n) {
1828
+ this.root = t, this.plot = e, this.dataCanvas = s, this.overlayCanvas = n, this.unsubscribeTheme = cs(() => {
1500
1829
  this.colours = null, this.requestDraw();
1501
1830
  }), this.viewChanged();
1502
1831
  }
1503
1832
  unbind() {
1504
1833
  var t;
1505
- this.gestures.cancelEdit(), (t = this.unsubscribeTheme) == null || t.call(this), this.unsubscribeTheme = null, this.frame !== 0 && cancelAnimationFrame(this.frame), this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.frame = this.domainFrame = 0, this.root = this.plot = this.dataCanvas = this.overlayCanvas = null;
1834
+ this.gestures.cancelEdit(), this.keys.stop(), (t = this.unsubscribeTheme) == null || t.call(this), this.unsubscribeTheme = null, this.frame !== 0 && cancelAnimationFrame(this.frame), this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.frame = this.domainFrame = 0, this.root = this.plot = this.dataCanvas = this.overlayCanvas = null;
1506
1835
  }
1507
1836
  resize(t, e) {
1508
- const s = Math.max(0, Math.round(t)), o = Math.max(0, Math.round(e));
1509
- s === this.view.width && o === this.view.height || (this.view.width = s, this.view.height = o, this.viewChanged());
1837
+ const s = Math.max(0, Math.round(t)), n = Math.max(0, Math.round(e));
1838
+ s === this.view.width && n === this.view.height || (this.view.width = s, this.view.height = n, this.viewChanged());
1510
1839
  }
1511
1840
  /* ---------------------------------------------------------------- */
1512
1841
  /* Changes */
1513
1842
  /* ---------------------------------------------------------------- */
1514
1843
  viewChanged() {
1515
- this.view.collapsed = new Set(this.collapsedGroups), this.data.rebuild() && (this.colours = null, this.selected !== null && !this.data.subtaskById.has(this.selected) && (this.selected = null)), this.view.layout(), this.gestures.refreshHover(), this.interactionChanged();
1844
+ this.view.collapsed = new Set(this.collapsedGroups), this.data.rebuild() && (this.colours = null, this.selected !== null && !this.data.subtaskById.has(this.selected) && (this.selected = null)), this.view.layout(), this.gestures.refreshHover(), this.keys.refresh(), this.interactionChanged();
1516
1845
  }
1517
1846
  interactionChanged() {
1518
1847
  this.publish(), this.requestDraw();
1519
1848
  }
1520
1849
  publish() {
1521
1850
  const t = this.view, e = this.selected !== null ? t.boxById.get(this.selected) : void 0, s = [];
1522
- e !== void 0 && !e.miniature && !this.gestures.editing && e.subtask.task === this.selectedTask && (t.options.intents.includes("setup") && s.push({ kind: "setup", x: e.outerFrom, y: e.y, height: e.height }), t.options.intents.includes("teardown") && s.push({ kind: "teardown", x: e.outerTo, y: e.y, height: e.height })), this.snapshot = {
1851
+ e !== void 0 && !e.miniature && !this.gestures.editing && e.subtask.task === this.selectedTask && (t.options.intents.includes("leadIn") && s.push({ kind: "leadIn", x: e.outerFrom, y: e.y, height: e.height }), t.options.intents.includes("leadOut") && s.push({ kind: "leadOut", x: e.outerTo, y: e.y, height: e.height })), this.snapshot = {
1523
1852
  width: t.width,
1524
1853
  height: t.height,
1525
1854
  laneHeight: t.options.laneHeight,
@@ -1531,27 +1860,29 @@ class qs {
1531
1860
  cursor: this.gestures.cursor,
1532
1861
  tooltip: this.tooltip(),
1533
1862
  now: t.nowX(),
1534
- bars: this.bars()
1863
+ bars: this.bars(),
1864
+ spoken: this.keys.spoken,
1865
+ summary: this.summary()
1535
1866
  };
1536
- for (const o of this.listeners) o();
1867
+ for (const n of this.listeners) n();
1537
1868
  }
1538
1869
  /** One header per row, with what it says and where it sits. The scroll is
1539
1870
  not taken off here: the header column is moved as a whole, as it always
1540
1871
  was, so that a header and its row cannot drift apart by a rounding. */
1541
1872
  headers() {
1542
- const t = new Map(this.data.lanes.map((o) => [o.id, o.label])), e = new Map(this.data.groups.map((o) => [o.id, o.label])), s = new Set(this.collapsedGroups);
1543
- return this.view.rows.rows.map((o) => ({
1544
- key: o.lane ?? o.group ?? "",
1545
- kind: o.kind,
1546
- lane: o.lane,
1547
- group: o.group,
1548
- label: (o.lane !== void 0 ? t.get(o.lane) : e.get(o.group ?? "")) ?? o.lane ?? o.group ?? "",
1549
- depth: o.depth,
1550
- within: o.within,
1551
- lanes: o.lanes,
1552
- collapsed: o.group === void 0 ? void 0 : s.has(o.group),
1553
- top: o.top,
1554
- height: o.height
1873
+ const t = new Map(this.data.lanes.map((n) => [n.id, n.label])), e = new Map(this.data.groups.map((n) => [n.id, n.label])), s = new Set(this.collapsedGroups);
1874
+ return this.view.rows.rows.map((n) => ({
1875
+ key: n.lane ?? n.group ?? "",
1876
+ kind: n.kind,
1877
+ lane: n.lane,
1878
+ group: n.group,
1879
+ label: (n.lane !== void 0 ? t.get(n.lane) : e.get(n.group ?? "")) ?? n.lane ?? n.group ?? "",
1880
+ depth: n.depth,
1881
+ within: n.within,
1882
+ lanes: n.lanes,
1883
+ collapsed: n.group === void 0 ? void 0 : s.has(n.group),
1884
+ top: n.top,
1885
+ height: n.height
1555
1886
  }));
1556
1887
  }
1557
1888
  /** The bars a label could stand in: the visible part of every main time,
@@ -1562,24 +1893,38 @@ class qs {
1562
1893
  if (t.width <= 0) return [];
1563
1894
  const e = this.colours;
1564
1895
  return t.boxes.flatMap((s) => {
1565
- if (!Le(s, t.width, t.height)) return [];
1566
- const o = cs(s, t.width);
1567
- if (o === null) return [];
1568
- const i = e === null ? void 0 : e.tasks.get(s.subtask.task), r = i === void 0 || e === null ? !0 : Ft(ht(s.subtask.appearance), i, e).onDark;
1569
- return [{ subtask: s.subtask, ...o, dark: r }];
1896
+ if (!At(s, t.width, t.height)) return [];
1897
+ const n = Cs(s, t.width);
1898
+ if (n === null) return [];
1899
+ const i = e === null ? void 0 : e.tasks.get(s.subtask.task), r = i === void 0 || e === null ? !0 : Yt(pt(s.subtask.appearance), i, e).onDark;
1900
+ return [{ subtask: s.subtask, ...n, dark: r }];
1570
1901
  });
1571
1902
  }
1903
+ /** The findings count the whole plan - an overlap out of view is still one
1904
+ to know of -, the subtasks only what is in view. */
1905
+ summary() {
1906
+ const t = this.view, [e, s] = this.visibleDomain();
1907
+ return {
1908
+ lanes: this.data.lanes.length,
1909
+ subtasks: t.boxes.filter((n) => At(n, t.width, t.height)).length,
1910
+ from: e,
1911
+ to: s,
1912
+ overlaps: this.data.overlaps.length,
1913
+ violated: this.data.violatedById.size,
1914
+ blocked: this.data.inBlocked.length
1915
+ };
1916
+ }
1572
1917
  tooltip() {
1573
1918
  const t = this.gestures.hover;
1574
1919
  if (!this.gestures.idle) return null;
1575
1920
  const e = this.data.tooltipTargetFor(t);
1576
1921
  if (e === null) return null;
1577
- const { x: s, y: o } = this.gestures.hoverPoint;
1578
- return { target: e, x: s, y: o };
1922
+ const { x: s, y: n } = this.gestures.hoverPoint;
1923
+ return { target: e, x: s, y: n };
1579
1924
  }
1580
1925
  /** The visible span, as two wall-clock instants. */
1581
1926
  visibleDomain() {
1582
- const t = j(this.view.options.calendar), e = (s) => t.intervals.length === 0 ? s : U(Math.max(0, Math.min(t.total, s)), t);
1927
+ const t = q(this.view.options.calendar), e = (s) => t.intervals.length === 0 ? s : z(Math.max(0, Math.min(t.total, s)), t);
1583
1928
  return [e(this.view.domain[0]), e(this.view.domain[1])];
1584
1929
  }
1585
1930
  /** Reported once per frame, however many wheel steps a planner turns - and
@@ -1593,8 +1938,8 @@ class qs {
1593
1938
  return;
1594
1939
  }
1595
1940
  this.domainFrame === 0 && (this.domainFrame = requestAnimationFrame(() => {
1596
- var s, o;
1597
- this.domainFrame = 0, (o = (s = this.handlersNow).onDomainChange) == null || o.call(s, this.visibleDomain());
1941
+ var s, n;
1942
+ this.domainFrame = 0, (n = (s = this.handlersNow).onDomainChange) == null || n.call(s, this.visibleDomain());
1598
1943
  }));
1599
1944
  }
1600
1945
  /** The time and the lane at a client point, or null outside the plot. */
@@ -1602,8 +1947,8 @@ class qs {
1602
1947
  var r;
1603
1948
  const s = (r = this.plot) == null ? void 0 : r.getBoundingClientRect();
1604
1949
  if (s === void 0) return null;
1605
- const o = t - s.left, i = e - s.top;
1606
- return o < 0 || i < 0 || o > s.width || i > s.height ? null : { time: this.view.timeAt(o), lane: this.view.laneIdAt(i) };
1950
+ const n = t - s.left, i = e - s.top;
1951
+ return n < 0 || i < 0 || n > s.width || i > s.height ? null : { time: this.view.timeAt(n), lane: this.view.laneIdAt(i) };
1607
1952
  }
1608
1953
  /** The client point of a time, on a lane's middle where one is named, or
1609
1954
  null while the schedule is not on screen. */
@@ -1611,8 +1956,8 @@ class qs {
1611
1956
  var a;
1612
1957
  const s = (a = this.plot) == null ? void 0 : a.getBoundingClientRect();
1613
1958
  if (s === void 0) return null;
1614
- const o = this.view.viewport(), i = e === void 0 ? null : ct(o, e), r = i === null ? 0 : i.top + i.height / 2;
1615
- return { x: s.left + N(o, t), y: s.top + r };
1959
+ const n = this.view.viewport(), i = e === void 0 ? null : at(n, e), r = i === null ? 0 : i.top + i.height / 2;
1960
+ return { x: s.left + E(n, t), y: s.top + r };
1616
1961
  }
1617
1962
  requestDraw() {
1618
1963
  this.frame !== 0 || this.dataCanvas === null || typeof requestAnimationFrame != "function" || (this.frame = requestAnimationFrame(() => {
@@ -1621,9 +1966,9 @@ class qs {
1621
1966
  }
1622
1967
  draw() {
1623
1968
  if (this.root === null) return;
1624
- this.colours === null && (this.colours = ws(this.root, this.data), this.publish());
1625
- const { width: t, height: e } = this.view, s = se(this.dataCanvas, t, e), o = se(this.overlayCanvas, t, e);
1626
- if (s === null || o === null || t === 0) return;
1969
+ this.colours === null && (this.colours = Es(this.root, this.data), this.publish());
1970
+ const { width: t, height: e } = this.view, s = ge(this.dataCanvas, t, e), n = ge(this.overlayCanvas, t, e);
1971
+ if (s === null || n === null || t === 0) return;
1627
1972
  const i = {
1628
1973
  data: this.data,
1629
1974
  view: this.view,
@@ -1634,385 +1979,451 @@ class qs {
1634
1979
  hover: this.gestures.hover,
1635
1980
  ghost: this.gestures.ghostDrawing()
1636
1981
  };
1637
- ks(s, i), vs(o, i);
1638
- }
1639
- }
1640
- const js = "_root_p2o7g_4 _text_1hv7a_23", Vs = "_corner_p2o7g_18", Zs = "_dayBand_p2o7g_22", Js = "_tickBand_p2o7g_23", Qs = "_day_p2o7g_22", tn = "_dayLabel_p2o7g_46", en = "_tick_p2o7g_23", sn = "_tickLabel_p2o7g_64", nn = "_headers_p2o7g_72", on = "_header_p2o7g_72", rn = "_headerLabel_p2o7g_90", an = "_headerCount_p2o7g_103", ln = "_chevron_p2o7g_112", hn = "_plot_p2o7g_170", un = "_layer_p2o7g_176", cn = "_grip_p2o7g_185", dn = "_ghostLabel_p2o7g_195", fn = "_finding_p2o7g_208", pn = "_refusal_p2o7g_216", mn = "_tooltip_p2o7g_220", gn = "_tooltipHead_p2o7g_238", wn = "_tooltipTimes_p2o7g_243", kn = "_now_p2o7g_252", vn = "_barLabel_p2o7g_266", yn = "_barLabelText_p2o7g_279", v = {
1641
- root: js,
1642
- corner: Vs,
1643
- dayBand: Zs,
1644
- tickBand: Js,
1645
- day: Qs,
1646
- dayLabel: tn,
1647
- tick: en,
1648
- tickLabel: sn,
1649
- headers: nn,
1650
- header: on,
1651
- headerLabel: rn,
1652
- headerCount: an,
1653
- chevron: ln,
1654
- plot: hn,
1655
- layer: un,
1656
- grip: cn,
1657
- ghostLabel: dn,
1658
- finding: fn,
1659
- refusal: pn,
1660
- tooltip: mn,
1661
- tooltipHead: gn,
1662
- tooltipTimes: wn,
1663
- now: kn,
1664
- barLabel: vn,
1665
- barLabelText: yn
1982
+ Rs(s, i), Ps(n, i);
1983
+ }
1984
+ }
1985
+ const kn = "_root_19uyg_4 _text_k1tvc_23", yn = "_corner_19uyg_19", vn = "_dayBand_19uyg_23", wn = "_tickBand_19uyg_24", bn = "_day_19uyg_23", Mn = "_dayLabel_19uyg_47", Tn = "_tick_19uyg_24", In = "_tickLabel_19uyg_65", Cn = "_headers_19uyg_73", Ln = "_header_19uyg_73", Sn = "_headerLabel_19uyg_91", An = "_headerCount_19uyg_104", _n = "_chevron_19uyg_113", Dn = "_plot_19uyg_171", Fn = "_focusRing_19uyg_178", On = "_layer_19uyg_196", En = "_grip_19uyg_205", Rn = "_ghostLabel_19uyg_215", Pn = "_finding_19uyg_228", Bn = "_refusal_19uyg_236", Nn = "_tooltip_19uyg_240", xn = "_tooltipHead_19uyg_259", Gn = "_tooltipTimes_19uyg_264", $n = "_now_19uyg_273", Hn = "_barLabel_19uyg_287", Yn = "_barLabelText_19uyg_300", w = {
1986
+ root: kn,
1987
+ corner: yn,
1988
+ dayBand: vn,
1989
+ tickBand: wn,
1990
+ day: bn,
1991
+ dayLabel: Mn,
1992
+ tick: Tn,
1993
+ tickLabel: In,
1994
+ headers: Cn,
1995
+ header: Ln,
1996
+ headerLabel: Sn,
1997
+ headerCount: An,
1998
+ chevron: _n,
1999
+ plot: Dn,
2000
+ focusRing: Fn,
2001
+ layer: On,
2002
+ grip: En,
2003
+ ghostLabel: Rn,
2004
+ finding: Pn,
2005
+ refusal: Bn,
2006
+ tooltip: Nn,
2007
+ tooltipHead: xn,
2008
+ tooltipTimes: Gn,
2009
+ now: $n,
2010
+ barLabel: Hn,
2011
+ barLabelText: Yn
1666
2012
  };
1667
- function bn({ target: n }) {
1668
- const t = ge(), e = we(), s = (l) => t.time(new Date(l), !1), o = (l) => {
1669
- const d = Math.round(l / q), p = Math.floor(d / 60), g = d % 60;
1670
- return [p > 0 ? e.hoursShort(p) : "", g > 0 || p === 0 ? e.minutesShort(g) : ""].filter(Boolean).join(" ");
2013
+ function Ue() {
2014
+ const o = ft();
2015
+ return (t) => {
2016
+ const e = Math.round(t / W), s = Math.floor(e / 60), n = e % 60;
2017
+ return [s > 0 ? o.hoursShort(s) : "", n > 0 || s === 0 ? o.minutesShort(n) : ""].filter(Boolean).join(" ");
1671
2018
  };
1672
- if (n.kind === "subtask") {
1673
- const { subtask: l, task: d } = n;
1674
- return /* @__PURE__ */ Y(Wt, { children: [
1675
- /* @__PURE__ */ k("span", { className: v.tooltipHead, children: (d == null ? void 0 : d.name) ?? l.task }),
2019
+ }
2020
+ function Kn({ target: o, lane: t }) {
2021
+ const e = Rt(), s = ft(), n = Ue(), i = (c) => e.time(new Date(c), !1);
2022
+ if (o.kind === "subtask") {
2023
+ const { subtask: c, task: p } = o, m = [
2024
+ (p == null ? void 0 : p.name) ?? c.task,
2025
+ c.name ?? c.id,
2026
+ `${e.dateShort(new Date(c.from))} ${s.scheduleGhostTimes(i(c.from), i(c.to))}`,
2027
+ ...o.overlapping.map((y) => s.scheduleOverlapWith(y.name ?? y.id)),
2028
+ ...o.violatedDependencies.map((y) => s.scheduleViolatedBy(n(y.shortBy))),
2029
+ ...o.blocked.map((y) => s.scheduleInBlockedTime(y.label))
2030
+ ];
2031
+ return /* @__PURE__ */ Y(St, { children: [
2032
+ t,
2033
+ `, ${m.join(", ")}`
2034
+ ] });
2035
+ }
2036
+ const { dependency: r, task: a, from: h, to: d, violated: l } = o;
2037
+ return [
2038
+ (a == null ? void 0 : a.name) ?? (a == null ? void 0 : a.id) ?? r.id,
2039
+ `${s.scheduleDependency} ${n(r.lag)}`,
2040
+ s.scheduleRoute((h == null ? void 0 : h.name) ?? r.from, (d == null ? void 0 : d.name) ?? r.to),
2041
+ ...l === void 0 ? [] : [s.scheduleViolatedBy(n(l.shortBy))]
2042
+ ].join(", ");
2043
+ }
2044
+ function Un({ target: o }) {
2045
+ const t = Rt(), e = ft(), s = (l) => t.time(new Date(l), !1), n = Ue();
2046
+ if (o.kind === "subtask") {
2047
+ const { subtask: l, task: c } = o;
2048
+ return /* @__PURE__ */ Y(St, { children: [
2049
+ /* @__PURE__ */ k("span", { className: w.tooltipHead, children: (c == null ? void 0 : c.name) ?? l.task }),
1676
2050
  /* @__PURE__ */ k("span", { children: l.name ?? l.id }),
1677
- /* @__PURE__ */ k("span", { className: v.tooltipTimes, children: e.scheduleGhostTimes(s(l.from), s(l.to)) }),
1678
- (l.setup ?? 0) > 0 && /* @__PURE__ */ k("span", { children: `${e.scheduleSetup} ${o(l.setup)}` }),
1679
- (l.teardown ?? 0) > 0 && /* @__PURE__ */ k("span", { children: `${e.scheduleTeardown} ${o(l.teardown)}` }),
1680
- n.overlapping.map((p) => /* @__PURE__ */ k("span", { className: v.finding, children: e.scheduleOverlapWith(p.name ?? p.id) }, p.id)),
1681
- n.lateTransports.map((p) => /* @__PURE__ */ k("span", { className: v.finding, children: e.scheduleLateBy(o(p.shortBy)) }, p.transport))
2051
+ /* @__PURE__ */ k("span", { className: w.tooltipTimes, children: e.scheduleGhostTimes(s(l.from), s(l.to)) }),
2052
+ (l.leadIn ?? 0) > 0 && /* @__PURE__ */ k("span", { children: `${e.scheduleLeadIn} ${n(l.leadIn)}` }),
2053
+ (l.leadOut ?? 0) > 0 && /* @__PURE__ */ k("span", { children: `${e.scheduleLeadOut} ${n(l.leadOut)}` }),
2054
+ o.overlapping.map((p) => /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleOverlapWith(p.name ?? p.id) }, p.id)),
2055
+ o.violatedDependencies.map((p) => /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleViolatedBy(n(p.shortBy)) }, p.dependency)),
2056
+ o.blocked.map((p) => /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleInBlockedTime(p.label) }, p.id))
1682
2057
  ] });
1683
2058
  }
1684
- const { transport: i, task: r, from: a, to: u, late: c } = n;
1685
- return /* @__PURE__ */ Y(Wt, { children: [
1686
- /* @__PURE__ */ k("span", { className: v.tooltipHead, children: (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.id) ?? i.id }),
1687
- /* @__PURE__ */ k("span", { children: e.scheduleRoute((a == null ? void 0 : a.name) ?? i.from, (u == null ? void 0 : u.name) ?? i.to) }),
1688
- /* @__PURE__ */ k("span", { children: `${e.scheduleTransport} ${o(i.duration)}` }),
1689
- c !== void 0 && /* @__PURE__ */ k("span", { className: v.finding, children: e.scheduleLateBy(o(c.shortBy)) })
2059
+ const { dependency: i, task: r, from: a, to: h, violated: d } = o;
2060
+ return /* @__PURE__ */ Y(St, { children: [
2061
+ /* @__PURE__ */ k("span", { className: w.tooltipHead, children: (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.id) ?? i.id }),
2062
+ /* @__PURE__ */ k("span", { children: e.scheduleRoute((a == null ? void 0 : a.name) ?? i.from, (h == null ? void 0 : h.name) ?? i.to) }),
2063
+ /* @__PURE__ */ k("span", { children: `${e.scheduleDependency} ${n(i.lag)}` }),
2064
+ d !== void 0 && /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleViolatedBy(n(d.shortBy)) })
1690
2065
  ] });
1691
2066
  }
1692
- const Mn = [], ce = { min: Tt, max: 28 * st }, Tn = [], de = 20, En = Xe(function(t, e) {
2067
+ const Xn = [], Ce = { min: Et, max: 28 * rt }, Wn = [], Le = 20, eo = ns(function(t, e) {
2068
+ var ie;
1693
2069
  const {
1694
2070
  ariaLabel: s,
1695
- initialDomain: o,
2071
+ initialDomain: n,
1696
2072
  height: i = 400,
1697
- laneHeight: r = lt,
2073
+ laneHeight: r = ct,
1698
2074
  headerWidth: a = 160,
1699
- calendar: u = Tn,
1700
- zoomLimits: c,
2075
+ calendar: h = Wn,
2076
+ zoomLimits: d,
1701
2077
  snap: l = "ticks",
1702
- intents: d = Mn,
2078
+ intents: c = Xn,
1703
2079
  onIntent: p,
1704
- canMoveTo: g,
1705
- onInteraction: b,
1706
- selectedTask: I,
1707
- onSelectedTaskChange: _,
1708
- collapsedGroups: S,
1709
- defaultCollapsedGroups: m,
1710
- onCollapsedGroupsChange: C,
2080
+ canMoveTo: m,
2081
+ onInteraction: y,
2082
+ selectedTask: C,
2083
+ onSelectedTaskChange: S,
2084
+ collapsedGroups: A,
2085
+ defaultCollapsedGroups: g,
2086
+ onCollapsedGroupsChange: I,
1711
2087
  onDomainChange: L,
1712
- placing: E,
1713
- route: F = "curve",
1714
- attach: R = "centre",
1715
- ends: V = "dot",
1716
- label: ot,
1717
- tooltip: z,
1718
- now: Z,
1719
- className: Et,
1720
- style: Ee,
1721
- children: De
1722
- } = t, [w] = it(() => new qs()), Dt = Ke(), Pt = O(null), Nt = O(null), Gt = O(null), Rt = O(null), X = ge(), K = we(), [dt, ft] = o, $t = (c == null ? void 0 : c.min) ?? ce.min, Ot = (c == null ? void 0 : c.max) ?? ce.max, xt = O(null), Bt = typeof l == "object" ? l.step : null, Ht = typeof l == "object" ? l.offset : null, Yt = typeof l == "object" ? null : l, [Pe, Ne] = it(() => Date.now());
1723
- x(() => {
1724
- if (Z !== !0) return;
1725
- const h = setInterval(() => Ne(Date.now()), q);
1726
- return () => clearInterval(h);
1727
- }, [Z]);
1728
- const Xt = Z === !0 ? Pe : typeof Z == "number" ? Z : null;
1729
- vt(() => {
1730
- const h = `${dt}|${ft}`, y = xt.current !== h;
1731
- xt.current = h;
1732
- const A = Yt ?? { step: Bt ?? 0, offset: Ht ?? 0 };
1733
- w.setOptions(
1734
- { laneHeight: r, calendar: u, zoomLimits: { min: $t, max: Ot }, snap: A, intents: d, now: Xt, route: F, attach: R, ends: V },
1735
- y ? [dt, ft] : null
2088
+ placing: F,
2089
+ route: D = "curve",
2090
+ attach: N = "centre",
2091
+ ends: Q = "dot",
2092
+ label: lt,
2093
+ tooltip: V,
2094
+ now: tt,
2095
+ className: Kt,
2096
+ style: Xe,
2097
+ children: We
2098
+ } = t, [v] = ht(() => new gn()), mt = os(), Ut = `${mt}-summary`, Xt = $(null), Wt = $(null), zt = $(null), Vt = $(null), x = Rt(), R = ft(), [gt, kt] = n, jt = (d == null ? void 0 : d.min) ?? Ce.min, qt = (d == null ? void 0 : d.max) ?? Ce.max, Zt = $(null), Jt = typeof l == "object" ? l.step : null, Qt = typeof l == "object" ? l.offset : null, te = typeof l == "object" ? null : l, [ze, Ve] = ht(() => Date.now());
2099
+ H(() => {
2100
+ if (tt !== !0) return;
2101
+ const u = setInterval(() => Ve(Date.now()), W);
2102
+ return () => clearInterval(u);
2103
+ }, [tt]);
2104
+ const ee = tt === !0 ? ze : typeof tt == "number" ? tt : null;
2105
+ It(() => {
2106
+ const u = `${gt}|${kt}`, M = Zt.current !== u;
2107
+ Zt.current = u;
2108
+ const _ = te ?? { step: Jt ?? 0, offset: Qt ?? 0 };
2109
+ v.setOptions(
2110
+ { laneHeight: r, calendar: h, zoomLimits: { min: jt, max: qt }, snap: _, intents: c, now: ee, route: D, attach: N, ends: Q },
2111
+ M ? [gt, kt] : null
1736
2112
  );
1737
- }, [w, dt, ft, r, u, $t, Ot, Yt, Bt, Ht, d, Xt, F, R, V]), x(() => {
1738
- w.setHandlers({ onIntent: p, canMoveTo: g, onInteraction: b, onSelectedTaskChange: _, onCollapsedGroupsChange: C, onDomainChange: L });
1739
- }, [w, p, g, b, _, C, L]);
1740
- const Ge = O(m);
1741
- x(() => {
1742
- const h = Ge.current;
1743
- h !== void 0 && w.setDefaultCollapsedGroups(h);
1744
- }, [w]), x(() => {
1745
- w.setCollapsedGroups(S);
1746
- }, [w, S]), Ue(
2113
+ }, [v, gt, kt, r, h, jt, qt, te, Jt, Qt, c, ee, D, N, Q]), H(() => {
2114
+ v.setHandlers({ onIntent: p, canMoveTo: m, onInteraction: y, onSelectedTaskChange: S, onCollapsedGroupsChange: I, onDomainChange: L });
2115
+ }, [v, p, m, y, S, I, L]);
2116
+ const je = $(g);
2117
+ H(() => {
2118
+ const u = je.current;
2119
+ u !== void 0 && v.setDefaultCollapsedGroups(u);
2120
+ }, [v]), H(() => {
2121
+ v.setCollapsedGroups(A);
2122
+ }, [v, A]), is(
1747
2123
  e,
1748
2124
  () => ({
1749
- positionAt: (h, y) => w.positionAt(h, y),
1750
- clientPointOf: (h, y) => w.clientPointOf(h, y),
1751
- visibleDomain: () => w.visibleDomain()
2125
+ positionAt: (u, M) => v.positionAt(u, M),
2126
+ clientPointOf: (u, M) => v.clientPointOf(u, M),
2127
+ visibleDomain: () => v.visibleDomain()
1752
2128
  }),
1753
- [w]
1754
- ), x(() => {
1755
- w.setControlledTask(I);
1756
- }, [w, I]), x(() => {
1757
- w.setPlacing(E ?? null);
1758
- }, [w, E]), x(() => {
1759
- const h = Pt.current, y = Nt.current, A = Gt.current, $ = Rt.current;
1760
- if (!h || !y || !A || !$) return;
1761
- w.bind(h, y, A, $);
1762
- const D = y.getBoundingClientRect();
1763
- w.resize(D.width, D.height);
1764
- const P = new ResizeObserver((G) => {
1765
- var zt;
1766
- const tt = (zt = G[G.length - 1]) == null ? void 0 : zt.contentRect;
1767
- tt !== void 0 && w.resize(tt.width, tt.height);
2129
+ [v]
2130
+ ), H(() => {
2131
+ v.setControlledTask(C);
2132
+ }, [v, C]), H(() => {
2133
+ v.setPlacing(F ?? null);
2134
+ }, [v, F]), H(() => {
2135
+ const u = Xt.current, M = Wt.current, _ = zt.current, G = Vt.current;
2136
+ if (!u || !M || !_ || !G) return;
2137
+ v.bind(u, M, _, G);
2138
+ const O = M.getBoundingClientRect();
2139
+ v.resize(O.width, O.height);
2140
+ const P = new ResizeObserver((B) => {
2141
+ var re;
2142
+ const nt = (re = B[B.length - 1]) == null ? void 0 : re.contentRect;
2143
+ nt !== void 0 && v.resize(nt.width, nt.height);
1768
2144
  });
1769
- P.observe(y);
1770
- const J = (G) => w.wheel(G);
1771
- h.addEventListener("wheel", J, { passive: !1 });
1772
- const Q = (G) => {
1773
- G.key === "Escape" && w.cancelEdit() && G.preventDefault();
2145
+ P.observe(M);
2146
+ const et = (B) => v.wheel(B);
2147
+ u.addEventListener("wheel", et, { passive: !1 });
2148
+ const st = (B) => {
2149
+ B.key === "Escape" && v.cancelEdit() && B.preventDefault();
1774
2150
  };
1775
- return window.addEventListener("keydown", Q), () => {
1776
- window.removeEventListener("keydown", Q), h.removeEventListener("wheel", J), P.disconnect(), w.unbind();
2151
+ return window.addEventListener("keydown", st), () => {
2152
+ window.removeEventListener("keydown", st), u.removeEventListener("wheel", et), P.disconnect(), v.unbind();
1777
2153
  };
1778
- }, [w]);
1779
- const T = ze(w.subscribe, w.getSnapshot, w.getServerSnapshot), Re = (h, y) => {
1780
- const A = new Date(h);
1781
- return y >= 200 ? X.dateLong(A) : y >= 84 ? X.date(A) : y >= 44 ? X.dateShort(A) : "";
1782
- }, M = T.ghost, pt = (h) => `${Dt}-row-${encodeURIComponent(h.key)}`, $e = W(() => {
1783
- const h = /* @__PURE__ */ new Map();
1784
- for (const y of T.headers)
1785
- for (const A of y.within)
1786
- y.kind === "groupHead" && A === y.group || h.set(A, [...h.get(A) ?? [], pt(y)]);
1787
- return h;
1788
- }, [T.headers, Dt]), Oe = W(() => new Set((M == null ? void 0 : M.refusedLanes) ?? []), [M == null ? void 0 : M.refusedLanes]), Kt = O(null), [mt, xe] = it({ x: 0, y: 0, at: "" }), gt = M === null ? "" : `${M.x}:${M.y}:${M.from}:${M.to}:${M.overlap}:${M.late}`;
1789
- vt(() => {
1790
- const h = Kt.current;
1791
- if (M === null || h === null) return;
1792
- const y = 4, A = M.y - h.offsetHeight - y, $ = M.y + M.height + y, D = {
1793
- x: Math.max(2, Math.min(M.x, T.width - h.offsetWidth - 2)),
1794
- y: A >= 2 ? A : Math.min($, T.height - h.offsetHeight - 2),
1795
- at: gt
2154
+ }, [v]);
2155
+ const T = rs(v.subscribe, v.getSnapshot, v.getServerSnapshot), qe = (u, M) => {
2156
+ const _ = new Date(u);
2157
+ return M >= 200 ? x.dateLong(_) : M >= 84 ? x.date(_) : M >= 44 ? x.dateShort(_) : "";
2158
+ }, b = T.ghost, j = T.spoken, yt = T.summary, se = (u) => `${x.dateShort(new Date(u))} ${x.time(new Date(u), !1)}`, vt = (u) => `${mt}-row-${encodeURIComponent(u.key)}`, Ze = X(() => {
2159
+ const u = /* @__PURE__ */ new Map();
2160
+ for (const M of T.headers)
2161
+ for (const _ of M.within)
2162
+ M.kind === "groupHead" && _ === M.group || u.set(_, [...u.get(_) ?? [], vt(M)]);
2163
+ return u;
2164
+ }, [T.headers, mt]), Je = X(() => new Set((b == null ? void 0 : b.refusedLanes) ?? []), [b == null ? void 0 : b.refusedLanes]), ne = $(null), [wt, Qe] = ht({ x: 0, y: 0, at: "" }), bt = b === null ? "" : `${b.x}:${b.y}:${b.from}:${b.to}:${b.overlap}:${b.violated}:${b.refused}:${b.blocked}`;
2165
+ It(() => {
2166
+ const u = ne.current;
2167
+ if (b === null || u === null) return;
2168
+ const M = 4, _ = b.y - u.offsetHeight - M, G = b.y + b.height + M, O = {
2169
+ x: Math.max(2, Math.min(b.x, T.width - u.offsetWidth - 2)),
2170
+ y: _ >= 2 ? _ : Math.min(G, T.height - u.offsetHeight - 2),
2171
+ at: bt
1796
2172
  };
1797
- xe((P) => P.x === D.x && P.y === D.y && P.at === D.at ? P : D);
1798
- }, [M, gt, T.width, T.height]);
1799
- const Ut = O(null), [wt, Be] = it({ x: 0, y: 0, at: "" }), H = T.tooltip, kt = H === null ? "" : `${H.x}:${H.y}:${H.target.kind}`;
1800
- return vt(() => {
1801
- const h = Ut.current;
1802
- if (H === null || h === null) return;
1803
- const y = 12, A = (D, P, J) => {
1804
- const Q = D + y, G = D - y - P, tt = Q + P <= J - 4 || G < 4 ? Q : G;
1805
- return Math.max(4, Math.min(tt, J - P - 4));
1806
- }, $ = {
1807
- x: A(H.x, h.offsetWidth, T.width),
1808
- y: A(H.y, h.offsetHeight, T.height),
1809
- at: kt
2173
+ Qe((P) => P.x === O.x && P.y === O.y && P.at === O.at ? P : O);
2174
+ }, [b, bt, T.width, T.height]);
2175
+ const oe = $(null), [Mt, ts] = ht({ x: 0, y: 0, at: "" }), U = T.tooltip, Tt = U === null ? "" : `${U.x}:${U.y}:${U.target.kind}`;
2176
+ return It(() => {
2177
+ const u = oe.current;
2178
+ if (U === null || u === null) return;
2179
+ const M = 12, _ = (O, P, et) => {
2180
+ const st = O + M, B = O - M - P, nt = st + P <= et - 4 || B < 4 ? st : B;
2181
+ return Math.max(4, Math.min(nt, et - P - 4));
2182
+ }, G = {
2183
+ x: _(U.x, u.offsetWidth, T.width),
2184
+ y: _(U.y, u.offsetHeight, T.height),
2185
+ at: Tt
1810
2186
  };
1811
- Be((D) => D.x === $.x && D.y === $.y && D.at === $.at ? D : $);
1812
- }, [H, kt, T.width, T.height]), /* @__PURE__ */ Y(ke.Provider, { value: w, children: [
2187
+ ts((O) => O.x === G.x && O.y === G.y && O.at === G.at ? O : G);
2188
+ }, [U, Tt, T.width, T.height]), /* @__PURE__ */ Y(De.Provider, { value: v, children: [
1813
2189
  /* @__PURE__ */ Y(
1814
2190
  "div",
1815
2191
  {
1816
- ref: Pt,
2192
+ ref: Xt,
1817
2193
  role: "figure",
1818
2194
  "aria-label": s,
1819
- className: Et ? `${v.root} ${Et}` : v.root,
1820
- style: { height: `${i}px`, gridTemplateColumns: `min(${a}px, 40%) minmax(0, 1fr)`, ...Ee },
2195
+ className: Kt ? `${w.root} ${Kt}` : w.root,
2196
+ style: { height: `${i}px`, gridTemplateColumns: `min(${a}px, 40%) minmax(0, 1fr)`, ...Xe },
1821
2197
  children: [
1822
- /* @__PURE__ */ k("div", { className: v.corner }),
1823
- /* @__PURE__ */ k("div", { className: v.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: T.days.map((h) => {
1824
- const y = Math.max(0, -h.x), A = Math.min(h.x + h.width, T.width) - Math.max(h.x, 0);
1825
- return /* @__PURE__ */ k("span", { className: v.day, style: { left: `${h.x}px`, width: `${h.width}px` }, children: /* @__PURE__ */ k("span", { className: v.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${y}px` }, children: Re(h.start, A) }) }, h.start);
2198
+ /* @__PURE__ */ k("div", { className: w.corner }),
2199
+ /* @__PURE__ */ k("div", { className: w.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: T.days.map((u) => {
2200
+ const M = Math.max(0, -u.x), _ = Math.min(u.x + u.width, T.width) - Math.max(u.x, 0);
2201
+ return /* @__PURE__ */ k("span", { className: w.day, style: { left: `${u.x}px`, width: `${u.width}px` }, children: /* @__PURE__ */ k("span", { className: w.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${M}px` }, children: qe(u.start, _) }) }, u.start);
1826
2202
  }) }),
1827
- /* @__PURE__ */ k("div", { className: v.headers, "data-schedule-headers": "", children: /* @__PURE__ */ k("div", { className: v.headerRun, style: { transform: `translateY(${-T.scrollY}px)` }, children: T.headers.map((h) => /* @__PURE__ */ Y(
2203
+ /* @__PURE__ */ k("div", { className: w.headers, "data-schedule-headers": "", children: /* @__PURE__ */ k("div", { className: w.headerRun, style: { transform: `translateY(${-T.scrollY}px)` }, children: T.headers.map((u) => /* @__PURE__ */ Y(
1828
2204
  "div",
1829
2205
  {
1830
- id: pt(h),
1831
- className: v.header,
1832
- style: { height: `${h.height}px`, paddingLeft: `calc(var(--u-space-3) + ${h.depth} * var(--u-space-3))` },
1833
- "data-lane": h.lane,
1834
- "data-group": h.group,
1835
- "data-row": h.kind,
1836
- "data-schedule-clip": `header ${h.kind}`,
1837
- "data-refused": h.lane !== void 0 && Oe.has(h.lane) ? "" : void 0,
2206
+ id: vt(u),
2207
+ className: w.header,
2208
+ style: { height: `${u.height}px`, paddingLeft: `calc(var(--u-space-3) + ${u.depth} * var(--u-space-3))` },
2209
+ "data-lane": u.lane,
2210
+ "data-group": u.group,
2211
+ "data-row": u.kind,
2212
+ "data-schedule-clip": `header ${u.kind}`,
2213
+ "data-refused": u.lane !== void 0 && Je.has(u.lane) ? "" : void 0,
1838
2214
  children: [
1839
- h.kind !== "lane" && h.group !== void 0 && /* @__PURE__ */ k(
2215
+ u.kind !== "lane" && u.group !== void 0 && /* @__PURE__ */ k(
1840
2216
  "button",
1841
2217
  {
1842
2218
  type: "button",
1843
- className: v.chevron,
2219
+ className: w.chevron,
1844
2220
  "data-schedule-overlay": "fold control",
1845
- "aria-expanded": h.collapsed === !1,
1846
- "aria-controls": ($e.get(h.group) ?? [pt(h)]).join(" "),
1847
- "aria-label": `${h.collapsed === !0 ? K.scheduleUnfoldGroup : K.scheduleFoldGroup}: ${typeof h.label == "string" ? h.label : h.group}`,
1848
- onClick: () => w.toggleGroup(h.group),
1849
- children: /* @__PURE__ */ k(Qe, { size: 9, "data-open": h.collapsed === !1 ? "" : void 0 })
2221
+ "aria-expanded": u.collapsed === !1,
2222
+ "aria-controls": (Ze.get(u.group) ?? [vt(u)]).join(" "),
2223
+ "aria-label": `${u.collapsed === !0 ? R.scheduleUnfoldGroup : R.scheduleFoldGroup}: ${typeof u.label == "string" ? u.label : u.group}`,
2224
+ onClick: () => v.toggleGroup(u.group),
2225
+ children: /* @__PURE__ */ k(fs, { size: 9, "data-open": u.collapsed === !1 ? "" : void 0 })
1850
2226
  }
1851
2227
  ),
1852
- /* @__PURE__ */ k("span", { className: v.headerLabel, "data-schedule-overlay": "header label", children: h.label }),
1853
- h.kind !== "lane" && /* @__PURE__ */ k("span", { className: v.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": h.lanes, children: K.scheduleLaneCount(h.lanes) })
2228
+ /* @__PURE__ */ k("span", { className: w.headerLabel, "data-schedule-overlay": "header label", children: u.label }),
2229
+ u.kind !== "lane" && /* @__PURE__ */ k("span", { className: w.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": u.lanes, children: R.scheduleLaneCount(u.lanes) })
1854
2230
  ]
1855
2231
  },
1856
- h.key
2232
+ u.key
1857
2233
  )) }) }),
1858
2234
  /* @__PURE__ */ Y(
1859
2235
  "div",
1860
2236
  {
1861
- ref: Nt,
1862
- className: v.plot,
2237
+ ref: Wt,
2238
+ className: w.plot,
1863
2239
  "data-schedule-plot": "",
1864
2240
  "data-schedule-clip": "plot",
1865
2241
  style: { cursor: T.cursor },
1866
- onPointerDown: (h) => w.pointerDown(h.nativeEvent),
1867
- onPointerMove: (h) => w.pointerMove(h.nativeEvent),
1868
- onPointerUp: (h) => w.pointerUp(h.nativeEvent),
1869
- onPointerCancel: (h) => w.pointerCancel(h.nativeEvent),
1870
- onPointerLeave: () => w.pointerLeave(),
1871
- onContextMenu: (h) => w.contextMenu(h.nativeEvent),
1872
- onDragOver: (h) => w.dragOver(h.nativeEvent),
1873
- onDrop: (h) => w.drop(h.nativeEvent),
1874
- onDragLeave: (h) => {
1875
- const y = h.nativeEvent.relatedTarget;
1876
- (!(y instanceof Node) || !h.currentTarget.contains(y)) && w.dragLeave();
2242
+ tabIndex: 0,
2243
+ role: "application",
2244
+ "aria-roledescription": R.scheduleRoleDescription,
2245
+ "aria-label": s,
2246
+ "aria-describedby": Ut,
2247
+ onKeyDown: (u) => {
2248
+ v.key(u.nativeEvent) && u.preventDefault();
2249
+ },
2250
+ onFocus: (u) => v.focus(zn(u.currentTarget)),
2251
+ onBlur: () => v.blur(),
2252
+ onPointerDown: (u) => v.pointerDown(u.nativeEvent),
2253
+ onPointerMove: (u) => v.pointerMove(u.nativeEvent),
2254
+ onPointerUp: (u) => v.pointerUp(u.nativeEvent),
2255
+ onPointerCancel: (u) => v.pointerCancel(u.nativeEvent),
2256
+ onPointerLeave: () => v.pointerLeave(),
2257
+ onContextMenu: (u) => v.contextMenu(u.nativeEvent),
2258
+ onDragOver: (u) => v.dragOver(u.nativeEvent),
2259
+ onDrop: (u) => v.drop(u.nativeEvent),
2260
+ onDragLeave: (u) => {
2261
+ const M = u.nativeEvent.relatedTarget;
2262
+ (!(M instanceof Node) || !u.currentTarget.contains(M)) && v.dragLeave();
1877
2263
  },
1878
2264
  children: [
1879
- /* @__PURE__ */ k("canvas", { ref: Gt, className: v.layer, "aria-hidden": "true" }),
1880
- /* @__PURE__ */ k("canvas", { ref: Rt, className: v.layer, "aria-hidden": "true" }),
1881
- T.grips.map((h) => /* @__PURE__ */ k(
2265
+ /* @__PURE__ */ k("canvas", { ref: zt, className: w.layer, "aria-hidden": "true" }),
2266
+ /* @__PURE__ */ k("canvas", { ref: Vt, className: w.layer, "aria-hidden": "true" }),
2267
+ T.grips.map((u) => /* @__PURE__ */ k(
1882
2268
  "span",
1883
2269
  {
1884
- "data-grip": h.kind,
1885
- "data-schedule-overlay": `${h.kind} grip`,
2270
+ "data-grip": u.kind,
2271
+ "data-schedule-overlay": `${u.kind} grip`,
1886
2272
  "aria-hidden": "true",
1887
- className: v.grip,
1888
- style: { left: `${h.x}px`, top: `${h.y}px`, height: `${h.height}px` }
2273
+ className: w.grip,
2274
+ style: { left: `${u.x}px`, top: `${u.y}px`, height: `${u.height}px` }
1889
2275
  },
1890
- h.kind
2276
+ u.kind
1891
2277
  )),
1892
- ot !== void 0 && T.bars.map((h) => /* @__PURE__ */ k(
2278
+ lt !== void 0 && T.bars.map((u) => /* @__PURE__ */ k(
1893
2279
  "span",
1894
2280
  {
1895
- className: v.barLabel,
1896
- "data-bar-label": h.subtask.id,
2281
+ className: w.barLabel,
2282
+ "data-bar-label": u.subtask.id,
1897
2283
  "data-schedule-overlay": "bar label",
1898
2284
  "data-schedule-may-cover": "",
1899
- "data-on": h.dark ? "dark" : "light",
1900
- style: { left: `${h.x}px`, top: `${h.y}px`, width: `${h.width}px`, height: `${h.height}px` },
1901
- children: /* @__PURE__ */ k("span", { className: v.barLabelText, children: ot(h.subtask) })
2285
+ "data-on": u.dark ? "dark" : "light",
2286
+ style: { left: `${u.x}px`, top: `${u.y}px`, width: `${u.width}px`, height: `${u.height}px` },
2287
+ children: /* @__PURE__ */ k("span", { className: w.barLabelText, children: lt(u.subtask) })
1902
2288
  },
1903
- h.subtask.id
2289
+ u.subtask.id
1904
2290
  )),
1905
- z !== !1 && T.tooltip !== null && /* @__PURE__ */ k(
2291
+ V !== !1 && T.tooltip !== null && /* @__PURE__ */ k(
1906
2292
  "span",
1907
2293
  {
1908
- ref: Ut,
2294
+ ref: oe,
1909
2295
  role: "tooltip",
1910
- className: v.tooltip,
2296
+ className: w.tooltip,
1911
2297
  "data-schedule-tooltip": "",
1912
2298
  "data-schedule-overlay": "tooltip",
1913
2299
  style: {
1914
- left: `${wt.x}px`,
1915
- top: `${wt.y}px`,
1916
- visibility: wt.at === kt ? void 0 : "hidden"
2300
+ left: `${Mt.x}px`,
2301
+ top: `${Mt.y}px`,
2302
+ visibility: Mt.at === Tt ? void 0 : "hidden"
1917
2303
  },
1918
- children: typeof z == "function" ? z(T.tooltip.target) : /* @__PURE__ */ k(bn, { target: T.tooltip.target })
2304
+ children: typeof V == "function" ? V(T.tooltip.target) : /* @__PURE__ */ k(Un, { target: T.tooltip.target })
1919
2305
  }
1920
2306
  ),
1921
- M !== null && /* @__PURE__ */ Y(
2307
+ b !== null && /* @__PURE__ */ Y(
1922
2308
  "span",
1923
2309
  {
1924
- ref: Kt,
1925
- className: v.ghostLabel,
2310
+ ref: ne,
2311
+ className: w.ghostLabel,
1926
2312
  "data-ghost": "",
1927
2313
  "data-schedule-overlay": "ghost label",
1928
- "data-findings": [M.overlap ? "overlap" : "", M.late ? "late-transport" : ""].filter(Boolean).join(" "),
1929
- "data-refused": M.refused ? "" : void 0,
2314
+ "data-findings": [b.overlap ? "overlap" : "", b.violated ? "violated-dependency" : ""].filter(Boolean).join(" "),
2315
+ "data-refused": b.refused ? "" : void 0,
2316
+ "data-blocked": b.blocked ? "" : void 0,
1930
2317
  style: {
1931
- left: `${mt.x}px`,
1932
- top: `${mt.y}px`,
1933
- visibility: mt.at === gt ? void 0 : "hidden"
2318
+ left: `${wt.x}px`,
2319
+ top: `${wt.y}px`,
2320
+ visibility: wt.at === bt ? void 0 : "hidden"
1934
2321
  },
1935
2322
  children: [
1936
- K.scheduleGhostTimes(X.time(new Date(M.from), !1), X.time(new Date(M.to), !1)),
1937
- M.refused && /* @__PURE__ */ k("span", { className: v.refusal, children: K.scheduleLaneRefused }),
1938
- M.overlap && /* @__PURE__ */ k("span", { className: v.finding, children: K.scheduleOverlap }),
1939
- M.late && /* @__PURE__ */ k("span", { className: v.finding, children: K.scheduleLateTransport })
2323
+ R.scheduleGhostTimes(x.time(new Date(b.from), !1), x.time(new Date(b.to), !1)),
2324
+ b.refused && /* @__PURE__ */ k("span", { className: w.refusal, children: R.scheduleLaneRefused }),
2325
+ b.blocked && /* @__PURE__ */ k("span", { className: w.refusal, children: R.scheduleBlockedTime }),
2326
+ b.overlap && /* @__PURE__ */ k("span", { className: w.finding, children: R.scheduleOverlap }),
2327
+ b.violated && /* @__PURE__ */ k("span", { className: w.finding, children: R.scheduleViolatedDependency })
1940
2328
  ]
1941
2329
  }
1942
- )
2330
+ ),
2331
+ /* @__PURE__ */ k("span", { className: w.focusRing, "aria-hidden": "true" })
1943
2332
  ]
1944
2333
  }
1945
2334
  ),
1946
- /* @__PURE__ */ k("div", { className: v.corner }),
1947
- /* @__PURE__ */ Y("div", { className: v.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
1948
- T.now !== null && /* @__PURE__ */ k("span", { className: v.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${T.now}px` } }),
1949
- T.ticks.map((h) => /* @__PURE__ */ k("span", { className: v.tick, style: { left: `${h.x}px` }, children: h.x >= de && h.x <= T.width - de && /* @__PURE__ */ k("span", { className: v.tickLabel, "data-schedule-overlay": "time label", children: T.step >= st ? X.dateShort(new Date(h.wallClock)) : X.time(new Date(h.wallClock), !1) }) }, h.wallClock))
1950
- ] })
2335
+ /* @__PURE__ */ k("div", { className: w.corner }),
2336
+ /* @__PURE__ */ Y("div", { className: w.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
2337
+ T.now !== null && /* @__PURE__ */ k("span", { className: w.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${T.now}px` } }),
2338
+ T.ticks.map((u) => /* @__PURE__ */ k("span", { className: w.tick, style: { left: `${u.x}px` }, children: u.x >= Le && u.x <= T.width - Le && /* @__PURE__ */ k("span", { className: w.tickLabel, "data-schedule-overlay": "time label", children: T.step >= rt ? x.dateShort(new Date(u.wallClock)) : x.time(new Date(u.wallClock), !1) }) }, u.wallClock))
2339
+ ] }),
2340
+ /* @__PURE__ */ k(ae, { "aria-live": "polite", children: j !== null && /* @__PURE__ */ k(
2341
+ Kn,
2342
+ {
2343
+ target: j.target,
2344
+ lane: j.lane === null ? null : ((ie = v.data.lanes.find((u) => u.id === j.lane)) == null ? void 0 : ie.label) ?? j.lane
2345
+ },
2346
+ j.count
2347
+ ) }),
2348
+ /* @__PURE__ */ k(ae, { id: Ut, children: `${R.scheduleSummary({ ...yt, from: se(yt.from), to: se(yt.to) })} ${R.scheduleKeyHelp}` })
1951
2349
  ]
1952
2350
  }
1953
2351
  ),
1954
- De
2352
+ We
1955
2353
  ] });
1956
2354
  });
1957
- function Dn({ id: n, label: t }) {
1958
- const e = ye(), s = W(() => ({ id: n, label: t ?? n, ...e === null ? {} : { parent: e } }), [n, t, e]);
1959
- return es(s), null;
2355
+ function zn(o) {
2356
+ try {
2357
+ return o.matches(":focus-visible");
2358
+ } catch {
2359
+ return !0;
2360
+ }
2361
+ }
2362
+ function so({ id: o, label: t }) {
2363
+ const e = Oe(), s = X(() => ({ id: o, label: t ?? o, ...e === null ? {} : { parent: e } }), [o, t, e]);
2364
+ return ms(s), null;
2365
+ }
2366
+ function no({ id: o, label: t, children: e }) {
2367
+ const s = Oe(), n = X(() => ({ id: o, label: t ?? o, ...s === null ? {} : { parent: s } }), [o, t, s]);
2368
+ return gs(n), /* @__PURE__ */ k(Fe.Provider, { value: o, children: e });
1960
2369
  }
1961
- function Pn({ id: n, label: t, children: e }) {
1962
- const s = ye(), o = W(() => ({ id: n, label: t ?? n, ...s === null ? {} : { parent: s } }), [n, t, s]);
1963
- return ss(o), /* @__PURE__ */ k(ve.Provider, { value: n, children: e });
2370
+ function oo({ data: o, tasks: t }) {
2371
+ const e = X(() => ({ kind: "subtasks", data: o, tasks: t }), [o, t]);
2372
+ return Bt("Subtasks", e), null;
1964
2373
  }
1965
- function Nn({ data: n, tasks: t }) {
1966
- const e = W(() => ({ kind: "subtasks", data: n, tasks: t }), [n, t]);
1967
- return be("Subtasks", e), null;
2374
+ function io({ data: o }) {
2375
+ const t = X(() => ({ kind: "dependencies", data: o }), [o]);
2376
+ return Bt("Dependencies", t), null;
1968
2377
  }
1969
- function Gn({ data: n }) {
1970
- const t = W(() => ({ kind: "transports", data: n }), [n]);
1971
- return be("Transports", t), null;
2378
+ function ro({ data: o }) {
2379
+ const t = X(() => ({ kind: "blocked", data: o }), [o]);
2380
+ return Bt("BlockedTimes", t), null;
1972
2381
  }
1973
- function Rn(n, t, e) {
2382
+ function ao(o, t, e) {
1974
2383
  if (e.kind === "place") return [];
1975
- const s = new Map(n.map((u) => [u.id, jt(u, e)])), o = /* @__PURE__ */ new Map();
1976
- for (const u of t) {
1977
- const c = o.get(u.from) ?? [];
1978
- c.push(u), o.set(u.from, c);
2384
+ const s = new Map(o.map((h) => [h.id, he(h, e)])), n = /* @__PURE__ */ new Map();
2385
+ for (const h of t) {
2386
+ const d = n.get(h.from) ?? [];
2387
+ d.push(h), n.set(h.from, d);
1979
2388
  }
1980
2389
  const i = /* @__PURE__ */ new Map(), r = [e.subtask];
1981
- let a = (n.length + 1) * (t.length + 1);
2390
+ let a = (o.length + 1) * (t.length + 1);
1982
2391
  for (; r.length > 0 && a-- > 0; ) {
1983
- const u = r.shift(), c = s.get(u);
1984
- if (c !== void 0)
1985
- for (const l of o.get(u) ?? []) {
2392
+ const h = r.shift(), d = s.get(h);
2393
+ if (d !== void 0)
2394
+ for (const l of n.get(h) ?? []) {
1986
2395
  if (l.to === e.subtask) continue;
1987
- const d = s.get(l.to);
1988
- if (d === void 0) continue;
1989
- const p = St(l, c) + l.duration - It(l, d);
2396
+ const c = s.get(l.to);
2397
+ if (c === void 0) continue;
2398
+ const p = xt(l, d) + l.lag - Gt(l, c);
1990
2399
  if (!(p > 0)) continue;
1991
- const g = { kind: "move", subtask: d.id, from: d.from + p, to: d.to + p };
1992
- s.set(d.id, jt(d, g)), i.set(d.id, g), r.push(d.id);
2400
+ const m = { kind: "move", subtask: c.id, from: c.from + p, to: c.to + p };
2401
+ s.set(c.id, he(c, m)), i.set(c.id, m), r.push(c.id);
1993
2402
  }
1994
2403
  }
1995
2404
  return [...i.values()];
1996
2405
  }
1997
- function $n(n, t, e) {
1998
- return e === 0 || !Number.isFinite(e) ? [] : n.filter((s) => s.task === t).map((s) => ({ kind: "move", subtask: s.id, from: s.from + e, to: s.to + e }));
2406
+ function lo(o, t, e) {
2407
+ return e === 0 || !Number.isFinite(e) ? [] : o.filter((s) => s.task === t).map((s) => ({ kind: "move", subtask: s.id, from: s.from + e, to: s.to + e }));
1999
2408
  }
2000
2409
  export {
2001
- Dn as Lane,
2002
- Pn as LaneGroup,
2003
- En as Schedule,
2004
- Nn as Subtasks,
2005
- Gn as Transports,
2006
- jt as applyIntent,
2007
- It as arrival,
2008
- St as departure,
2009
- Fn as findings,
2010
- _t as lateTransports,
2011
- ut as occupied,
2012
- At as overlaps,
2013
- ht as resolveAppearance,
2014
- Rn as ripple,
2015
- $n as shiftTask,
2016
- $s as snapTime,
2017
- _n as subtaskFromPlace
2410
+ ro as BlockedTimes,
2411
+ io as Dependencies,
2412
+ so as Lane,
2413
+ no as LaneGroup,
2414
+ eo as Schedule,
2415
+ oo as Subtasks,
2416
+ he as applyIntent,
2417
+ Gt as arrival,
2418
+ xt as departure,
2419
+ to as findings,
2420
+ Be as inBlockedTime,
2421
+ J as occupied,
2422
+ $t as overlaps,
2423
+ pt as resolveAppearance,
2424
+ ao as ripple,
2425
+ lo as shiftTask,
2426
+ Js as snapTime,
2427
+ Qn as subtaskFromPlace,
2428
+ Ht as violatedDependencies
2018
2429
  };