@umriss-ui/schedule 0.3.1 → 0.3.3

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