@umriss-ui/schedule 0.7.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schedule.js CHANGED
@@ -1,174 +1,175 @@
1
+ "use client";
1
2
  import "./schedule.css";
2
- var hn = Object.defineProperty;
3
- var cn = (s, t, e) => t in s ? hn(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
4
- var f = (s, t, e) => cn(s, typeof t != "symbol" ? t + "" : t, e);
5
- import { localOffset as Bt, toWorkingTimeClamped as Y, DAY as X, MINUTE as q, timeStep as un, workingTimeTicks as fn, calendarFrom as nt, toWallClock as j, HOUR as xt, LinearScale as mn, resolveColours as pn, removedIntervals as gn, subscribeTheme as kn, Echoes as yn } from "@umriss-ui/charts";
6
- import { createContext as Ee, useContext as Ne, useRef as G, useEffect as U, forwardRef as Re, useId as vn, useState as et, useLayoutEffect as rt, useImperativeHandle as wn, useSyncExternalStore as Pe, useMemo as V, createElement as bn } from "react";
7
- import { jsxs as H, Fragment as lt, jsx as g } from "react/jsx-runtime";
8
- import { useFormats as Ht, useWording as kt, AngleGlyph as Mn, VisuallyHidden as ue } from "@umriss-ui/core";
9
- function ot(s) {
10
- return { from: s.from - (s.leadIn ?? 0), to: s.to + (s.leadOut ?? 0) };
11
- }
12
- function Gt(s, t) {
13
- return (s.leaves ?? "leadOut") === "main" ? t.to : t.to + (t.leadOut ?? 0);
14
- }
15
- function Yt(s, t) {
16
- return (s.arrives ?? "leadIn") === "main" ? t.from : t.from - (t.leadIn ?? 0);
17
- }
18
- function fe(s, t) {
19
- if (t.kind === "place" || t.subtask !== s.id) return s;
3
+ var ds = Object.defineProperty;
4
+ var hs = (n, t, e) => t in n ? ds(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
5
+ var f = (n, t, e) => hs(n, typeof t != "symbol" ? t + "" : t, e);
6
+ import { localOffset as Bt, toWorkingTimeClamped as H, DAY as X, calendarFrom as pt, toWallClock as xt, MINUTE as q, timeStep as cs, workingTimeTicks as us, HOUR as Gt, LinearScale as fs, resolveColours as ms, removedIntervals as ps, subscribeTheme as gs } from "@umriss-ui/charts";
7
+ import { createContext as Ne, useContext as Re, useRef as V, useEffect as z, forwardRef as Pe, useId as ks, useState as ot, useLayoutEffect as ut, useImperativeHandle as ys, useSyncExternalStore as $e, useMemo as W, createElement as vs } from "react";
8
+ import { jsxs as G, Fragment as it, jsx as g } from "react/jsx-runtime";
9
+ import { useFormats as Ht, useWording as gt, AngleGlyph as ws, VisuallyHidden as fe } from "@umriss-ui/core";
10
+ function et(n) {
11
+ return { from: n.from - (n.leadIn ?? 0), to: n.to + (n.leadOut ?? 0) };
12
+ }
13
+ function Yt(n, t) {
14
+ return (n.leaves ?? "leadOut") === "main" ? t.to : t.to + (t.leadOut ?? 0);
15
+ }
16
+ function Kt(n, t) {
17
+ return (n.arrives ?? "leadIn") === "main" ? t.from : t.from - (t.leadIn ?? 0);
18
+ }
19
+ function me(n, t) {
20
+ if (t.kind === "place" || t.subtask !== n.id) return n;
20
21
  switch (t.kind) {
21
22
  case "move":
22
23
  case "stretch":
23
- return { ...s, from: t.from, to: t.to };
24
+ return { ...n, from: t.from, to: t.to };
24
25
  case "leadIn":
25
- return { ...s, leadIn: t.leadIn };
26
+ return { ...n, leadIn: t.leadIn };
26
27
  case "leadOut":
27
- return { ...s, leadOut: t.leadOut };
28
+ return { ...n, leadOut: t.leadOut };
28
29
  case "lane":
29
- return { ...s, lane: t.lane };
30
+ return { ...n, lane: t.lane };
30
31
  }
31
32
  }
32
- function yo(s, t) {
33
+ function yo(n, t) {
33
34
  return {
34
35
  id: t,
35
- task: s.task,
36
- lane: s.lane,
37
- from: s.from,
38
- to: s.to,
39
- ...s.leadIn === void 0 ? {} : { leadIn: s.leadIn },
40
- ...s.leadOut === void 0 ? {} : { leadOut: s.leadOut }
36
+ task: n.task,
37
+ lane: n.lane,
38
+ from: n.from,
39
+ to: n.to,
40
+ ...n.leadIn === void 0 ? {} : { leadIn: n.leadIn },
41
+ ...n.leadOut === void 0 ? {} : { leadOut: n.leadOut }
41
42
  };
42
43
  }
43
- function zt(s) {
44
+ function Vt(n) {
44
45
  const t = [], e = /* @__PURE__ */ new Map();
45
- s.forEach((n, o) => {
46
- const { from: i, to: r } = ot(n);
46
+ n.forEach((s, o) => {
47
+ const { from: i, to: r } = et(s);
47
48
  if (!(i < r)) return;
48
- const a = e.get(n.lane) ?? [];
49
- a.push({ subtask: n, index: o, from: i, to: r }), e.set(n.lane, a);
49
+ const a = e.get(s.lane) ?? [];
50
+ a.push({ subtask: s, index: o, from: i, to: r }), e.set(s.lane, a);
50
51
  });
51
- for (const [n, o] of e) {
52
+ for (const [s, o] of e) {
52
53
  o.sort((i, r) => i.from - r.from || i.index - r.index);
53
54
  for (let i = 0; i < o.length; i++) {
54
55
  const r = o[i];
55
56
  for (let a = i + 1; a < o.length; a++) {
56
57
  const l = o[a];
57
58
  if (l.from >= r.to) break;
58
- t.push({ lane: n, first: r.subtask.id, second: l.subtask.id, from: l.from, to: Math.min(r.to, l.to) });
59
+ t.push({ lane: s, first: r.subtask.id, second: l.subtask.id, from: l.from, to: Math.min(r.to, l.to) });
59
60
  }
60
61
  }
61
62
  }
62
63
  return t;
63
64
  }
64
- function Tn(s) {
65
+ function bs(n) {
65
66
  const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
66
- for (const n of s) {
67
- const o = ot(n), i = e.get(n.lane) ?? [];
67
+ for (const s of n) {
68
+ const o = et(s), i = e.get(s.lane) ?? [];
68
69
  let r = 0;
69
70
  if (o.from < o.to) {
70
71
  for (const a of i) o.from < a.to && a.from < o.to && r++;
71
72
  i.push(o);
72
73
  }
73
- e.set(n.lane, i), t.set(n.id, r);
74
+ e.set(s.lane, i), t.set(s.id, r);
74
75
  }
75
76
  return t;
76
77
  }
77
- function Kt(s, t) {
78
- const e = new Map(s.map((o) => [o.id, o])), n = [];
78
+ function Wt(n, t) {
79
+ const e = new Map(n.map((o) => [o.id, o])), s = [];
79
80
  for (const o of t) {
80
81
  const i = e.get(o.from), r = e.get(o.to);
81
82
  if (i === void 0 || r === void 0) continue;
82
- const a = Gt(o, i), l = Yt(o, r), h = a + o.lag - l;
83
- h > 0 && n.push({ dependency: o.id, departure: a, arrival: l, shortBy: h });
83
+ const a = Yt(o, i), l = Kt(o, r), h = a + o.lag - l;
84
+ h > 0 && s.push({ dependency: o.id, departure: a, arrival: l, shortBy: h });
84
85
  }
85
- return n;
86
+ return s;
86
87
  }
87
- function $e(s, t) {
88
+ function Be(n, t) {
88
89
  const e = [];
89
- for (const n of s) {
90
- const o = ot(n);
90
+ for (const s of n) {
91
+ const o = et(s);
91
92
  for (const i of t)
92
- i.lane !== n.lane || !(o.from < i.to && i.from < o.to) || e.push({ subtask: n.id, blocked: i.id, lane: i.lane, from: Math.max(o.from, i.from), to: Math.min(o.to, i.to) });
93
+ i.lane !== s.lane || !(o.from < i.to && i.from < o.to) || e.push({ subtask: s.id, blocked: i.id, lane: i.lane, from: Math.max(o.from, i.from), to: Math.min(o.to, i.to) });
93
94
  }
94
95
  return e;
95
96
  }
96
- function vo(s, t, e = []) {
97
+ function vo(n, t, e = []) {
97
98
  return {
98
- overlaps: zt(s),
99
- violatedDependencies: Kt(s, t),
100
- inBlockedTime: $e(s, e)
99
+ overlaps: Vt(n),
100
+ violatedDependencies: Wt(n, t),
101
+ inBlockedTime: Be(n, e)
101
102
  };
102
103
  }
103
- function wo(s, t, e) {
104
+ function wo(n, t, e) {
104
105
  if (e.kind === "place") return [];
105
- const n = new Map(s.map((l) => [l.id, fe(l, e)])), o = /* @__PURE__ */ new Map();
106
+ const s = new Map(n.map((l) => [l.id, me(l, e)])), o = /* @__PURE__ */ new Map();
106
107
  for (const l of t) {
107
108
  const h = o.get(l.from) ?? [];
108
109
  h.push(l), o.set(l.from, h);
109
110
  }
110
111
  const i = /* @__PURE__ */ new Map(), r = [e.subtask];
111
- let a = (s.length + 1) * (t.length + 1);
112
+ let a = (n.length + 1) * (t.length + 1);
112
113
  for (; r.length > 0 && a-- > 0; ) {
113
- const l = r.shift(), h = n.get(l);
114
+ const l = r.shift(), h = s.get(l);
114
115
  if (h !== void 0)
115
116
  for (const d of o.get(l) ?? []) {
116
117
  if (d.to === e.subtask) continue;
117
- const c = n.get(d.to);
118
- if (c === void 0) continue;
119
- const m = Gt(d, h) + d.lag - Yt(d, c);
118
+ const u = s.get(d.to);
119
+ if (u === void 0) continue;
120
+ const m = Yt(d, h) + d.lag - Kt(d, u);
120
121
  if (!(m > 0)) continue;
121
- const p = { kind: "move", subtask: c.id, from: c.from + m, to: c.to + m };
122
- n.set(c.id, fe(c, p)), i.set(c.id, p), r.push(c.id);
122
+ const p = { kind: "move", subtask: u.id, from: u.from + m, to: u.to + m };
123
+ s.set(u.id, me(u, p)), i.set(u.id, p), r.push(u.id);
123
124
  }
124
125
  }
125
126
  return [...i.values()];
126
127
  }
127
- function In(s, t) {
128
- const { step: e, offset: n } = typeof t == "number" ? { step: t, offset: 0 } : t;
129
- if (!(e > 0) || !Number.isFinite(s)) return s;
130
- const o = Bt(s) + n;
131
- return o + Math.round((s - o) / e) * e;
128
+ function Ms(n, t) {
129
+ const { step: e, offset: s } = typeof t == "number" ? { step: t, offset: 0 } : t;
130
+ if (!(e > 0) || !Number.isFinite(n)) return n;
131
+ const o = Bt(n) + s;
132
+ return o + Math.round((n - o) / e) * e;
132
133
  }
133
- function bo(s, t, e) {
134
- return e === 0 || !Number.isFinite(e) ? [] : s.filter((n) => n.task === t).map((n) => ({ kind: "move", subtask: n.id, from: n.from + e, to: n.to + e }));
134
+ function bo(n, t, e) {
135
+ return e === 0 || !Number.isFinite(e) ? [] : n.filter((s) => s.task === t).map((s) => ({ kind: "move", subtask: s.id, from: s.from + e, to: s.to + e }));
135
136
  }
136
- function yt(s) {
137
- let t = !1, e = !1, n = !1, o = !1;
138
- for (const i of s ?? [])
139
- i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? n = !0 : i === "open" && (o = !0);
140
- return { dashed: t, hatched: e, muted: n, open: o };
137
+ function kt(n) {
138
+ let t = !1, e = !1, s = !1, o = !1;
139
+ for (const i of n ?? [])
140
+ i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? s = !0 : i === "open" && (o = !0);
141
+ return { dashed: t, hatched: e, muted: s, open: o };
141
142
  }
142
- const Be = Ee(null), xe = Ee(null);
143
+ const xe = Ne(null), Ge = Ne(null);
143
144
  function He() {
144
- return Ne(xe);
145
+ return Re(Ge);
145
146
  }
146
- function Sn(s) {
147
- const t = Ne(Be);
147
+ function Ts(n) {
148
+ const t = Re(xe);
148
149
  if (t === null)
149
- throw new Error(`@umriss-ui/schedule: <${s}> must be used inside a <Schedule>.`);
150
+ throw new Error(`@umriss-ui/schedule: <${n}> must be used inside a <Schedule>.`);
150
151
  return t;
151
152
  }
152
- function Vt(s, t, e, n, o) {
153
- const i = Sn(s), r = G(null);
154
- U(() => (r.current = e(i, t), () => {
153
+ function Ut(n, t, e, s, o) {
154
+ const i = Ts(n), r = V(null);
155
+ z(() => (r.current = e(i, t), () => {
155
156
  r.current !== null && o(i, r.current), r.current = null;
156
- }), [i]), U(() => {
157
- r.current !== null && n(i, r.current, t);
157
+ }), [i]), z(() => {
158
+ r.current !== null && s(i, r.current, t);
158
159
  });
159
160
  }
160
- function Ln(s) {
161
- Vt("Lane", s, (t, e) => t.registerLane(e), (t, e, n) => t.updateLane(e, n), (t, e) => t.unregisterLane(e));
161
+ function Is(n) {
162
+ Ut("Lane", n, (t, e) => t.registerLane(e), (t, e, s) => t.updateLane(e, s), (t, e) => t.unregisterLane(e));
162
163
  }
163
- function An(s) {
164
- Vt("LaneGroup", s, (t, e) => t.registerGroup(e), (t, e, n) => t.updateGroup(e, n), (t, e) => t.unregisterGroup(e));
164
+ function Ss(n) {
165
+ Ut("LaneGroup", n, (t, e) => t.registerGroup(e), (t, e, s) => t.updateGroup(e, s), (t, e) => t.unregisterGroup(e));
165
166
  }
166
- function vt(s, t) {
167
- Vt(s, t, (e, n) => e.registerLayer(n), (e, n, o) => e.updateLayer(n, o), (e, n) => e.unregisterLayer(n));
167
+ function yt(n, t) {
168
+ Ut(n, t, (e, s) => e.registerLayer(s), (e, s, o) => e.updateLayer(s, o), (e, s) => e.unregisterLayer(s));
168
169
  }
169
- const Cn = 24, Dn = 4, _n = 3, Ct = 4;
170
- function me(s) {
171
- const { lanes: t, groups: e, collapsed: n, laneHeight: o } = s, i = new Map(e.map((k) => [k.id, k])), r = (k) => k !== void 0 && i.has(k) ? k : void 0, a = /* @__PURE__ */ new Map(), l = (k) => {
170
+ const Ls = 24, As = 4, Cs = 3, At = 4;
171
+ function pe(n) {
172
+ const { lanes: t, groups: e, collapsed: s, laneHeight: o } = n, i = new Map(e.map((k) => [k.id, k])), r = (k) => k !== void 0 && i.has(k) ? k : void 0, a = /* @__PURE__ */ new Map(), l = (k) => {
172
173
  const T = [];
173
174
  let S = r(k.parent);
174
175
  const E = /* @__PURE__ */ new Set();
@@ -184,20 +185,20 @@ function me(s) {
184
185
  E.push(k.id), a.set(S, E);
185
186
  }
186
187
  }
187
- const d = [], c = /* @__PURE__ */ new Map();
188
+ const d = [], u = /* @__PURE__ */ new Map();
188
189
  let m = [], p = null, y = 0;
189
- const I = (k) => (d.push({ ...k, top: y }), y += k.height, d.length - 1), A = (k) => k.find((T) => n.has(T)), C = () => {
190
+ const I = (k) => (d.push({ ...k, top: y }), y += k.height, d.length - 1), A = (k) => k.find((T) => s.has(T)), C = () => {
190
191
  if (p === null) return;
191
- const { row: k, lanes: T } = p, S = d[k], E = Math.max(S.height, T.length * Dn + 2 * Ct);
192
+ const { row: k, lanes: T } = p, S = d[k], E = Math.max(S.height, T.length * As + 2 * At);
192
193
  d[k] = { ...S, height: E }, y += E - S.height;
193
- const _ = E - 2 * Ct, P = Math.max(_n, Math.floor(_ / T.length));
194
- T.forEach((it, wt) => {
195
- const ut = h.get(it) ?? [];
196
- c.set(it, {
197
- top: S.top + Ct + wt * P,
194
+ const _ = E - 2 * At, P = Math.max(Cs, Math.floor(_ / T.length));
195
+ T.forEach((st, vt) => {
196
+ const ht = h.get(st) ?? [];
197
+ u.set(st, {
198
+ top: S.top + At + vt * P,
198
199
  height: P,
199
200
  miniature: !0,
200
- group: ut[ut.length - 1]
201
+ group: ht[ht.length - 1]
201
202
  });
202
203
  }), p = null;
203
204
  };
@@ -219,7 +220,7 @@ function me(s) {
219
220
  depth: m.length - 1,
220
221
  within: [...m],
221
222
  lanes: (a.get(_) ?? []).length,
222
- height: Cn
223
+ height: Ls
223
224
  });
224
225
  }
225
226
  if (S !== void 0) {
@@ -235,179 +236,178 @@ function me(s) {
235
236
  p = { group: S, row: P, lanes: [k.id] };
236
237
  continue;
237
238
  }
238
- I({ kind: "lane", lane: k.id, group: T[T.length - 1], depth: T.length, within: T, lanes: 1, height: o }), c.set(k.id, {
239
+ I({ kind: "lane", lane: k.id, group: T[T.length - 1], depth: T.length, within: T, lanes: 1, height: o }), u.set(k.id, {
239
240
  top: d[d.length - 1].top,
240
241
  height: o,
241
242
  miniature: !1,
242
243
  group: T[T.length - 1]
243
244
  });
244
245
  }
245
- return C(), { rows: d, slots: c, height: y };
246
+ return C(), { rows: d, slots: u, height: y };
246
247
  }
247
- function Fn(s, t) {
248
- if (t.size === 0) return s;
248
+ function Ds(n, t) {
249
+ if (t.size === 0) return n;
249
250
  const e = /* @__PURE__ */ new Set();
250
- for (const n of s) t.has(n) || e.add(n);
251
+ for (const s of n) t.has(s) || e.add(s);
251
252
  return e;
252
253
  }
253
- function st(s, t) {
254
- if (t < 0 || t >= s.height) return null;
255
- let e = 0, n = s.rows.length - 1;
256
- for (; e <= n; ) {
257
- const o = e + n >> 1, i = s.rows[o];
258
- if (t < i.top) n = o - 1;
254
+ function tt(n, t) {
255
+ if (t < 0 || t >= n.height) return null;
256
+ let e = 0, s = n.rows.length - 1;
257
+ for (; e <= s; ) {
258
+ const o = e + s >> 1, i = n.rows[o];
259
+ if (t < i.top) s = o - 1;
259
260
  else if (t >= i.top + i.height) e = o + 1;
260
261
  else return i;
261
262
  }
262
263
  return null;
263
264
  }
264
- function Wt(s, t) {
265
- return s.slots.get(t) ?? null;
265
+ function zt(n, t) {
266
+ return n.slots.get(t) ?? null;
266
267
  }
267
- function On(s, t) {
268
- const e = st(s, t);
268
+ function _s(n, t) {
269
+ const e = tt(n, t);
269
270
  if (e === null) return null;
270
271
  if (e.kind === "lane") return e.lane ?? null;
271
272
  if (e.kind === "groupHead") return null;
272
- for (const [n, o] of s.slots)
273
- if (o.miniature && t >= o.top && t < o.top + o.height) return n;
273
+ for (const [s, o] of n.slots)
274
+ if (o.miniature && t >= o.top && t < o.top + o.height) return s;
274
275
  return null;
275
276
  }
276
- const En = 6, Ge = 3, at = 2, pe = 3, ge = 3;
277
- function R(s, t) {
278
- return Math.round(s.scale.toPx(Y(t, s.calendar)));
277
+ const Fs = 6, Ye = 3, nt = 2, ge = 3, ke = 3;
278
+ function R(n, t) {
279
+ return Math.round(n.scale.toPx(H(t, n.calendar)));
279
280
  }
280
- function J(s, t) {
281
- const e = Wt(s.rows, t);
282
- return e === null ? null : { ...e, top: e.top - s.scrollY };
281
+ function j(n, t) {
282
+ const e = zt(n.rows, t);
283
+ return e === null ? null : { ...e, top: e.top - n.scrollY };
283
284
  }
284
- function Ut(s, t) {
285
- const e = J(s, t.lane);
286
- return e === null ? null : { x: R(s, t.at), y: e.top + e.height / 2, half: Math.max(2, Math.min(7, e.height * 0.3)) };
285
+ function Xt(n, t) {
286
+ const e = j(n, t.lane);
287
+ return e === null ? null : { x: R(n, t.at), y: e.top + e.height / 2, half: Math.max(2, Math.min(7, e.height * 0.3)) };
287
288
  }
288
- function ke(s, t) {
289
- return On(s.rows, t + s.scrollY);
289
+ function ye(n, t) {
290
+ return _s(n.rows, t + n.scrollY);
290
291
  }
291
- function Ye(s, t, e, n, o) {
292
- const i = n.miniature ? 0 : En, r = n.miniature ? 0 : ge * pe, a = Math.max(n.miniature ? 1 : 4, n.height - 2 * i - r), l = n.top - s.scrollY + Math.floor((n.height - a) / 2), h = ot(t);
292
+ function Ke(n, t, e, s) {
293
+ const o = e.miniature ? 0 : Fs, i = e.miniature ? 0 : ke * ge, r = Math.max(e.miniature ? 1 : 4, e.height - 2 * o - i), a = e.top - n.scrollY + Math.floor((e.height - r) / 2), l = et(t);
293
294
  return {
294
295
  subtask: t,
295
- lane: e,
296
- miniature: n.miniature,
297
- depth: o,
298
- y: l + (n.miniature ? 0 : Math.min(o, ge) * pe),
299
- height: a,
300
- outerFrom: R(s, h.from),
301
- mainFrom: R(s, t.from),
302
- mainTo: R(s, t.to),
303
- outerTo: R(s, h.to)
296
+ miniature: e.miniature,
297
+ depth: s,
298
+ y: a + (e.miniature ? 0 : Math.min(s, ke) * ge),
299
+ height: r,
300
+ outerFrom: R(n, l.from),
301
+ mainFrom: R(n, t.from),
302
+ mainTo: R(n, t.to),
303
+ outerTo: R(n, l.to)
304
304
  };
305
305
  }
306
- function ze(s, t, e) {
307
- if (e < s.y || e > s.y + s.height) return null;
308
- const n = Math.max(0, (6 - (s.outerTo - s.outerFrom)) / 2);
309
- return t < s.outerFrom - n || t > s.outerTo + n ? null : t < s.mainFrom ? "leadIn" : t > s.mainTo ? "leadOut" : "main";
306
+ function Ve(n, t, e) {
307
+ if (e < n.y || e > n.y + n.height) return null;
308
+ const s = Math.max(0, (6 - (n.outerTo - n.outerFrom)) / 2);
309
+ return t < n.outerFrom - s || t > n.outerTo + s ? null : t < n.mainFrom ? "leadIn" : t > n.mainTo ? "leadOut" : "main";
310
310
  }
311
- function Nn(s, t, e, n = 5) {
312
- if (e < s.y || e > s.y + s.height) return null;
313
- const o = Math.abs(t - s.mainFrom), i = Math.abs(t - s.mainTo);
314
- return Math.min(o, i) > n ? null : o <= i ? "from" : "to";
311
+ function Os(n, t, e, s = 5) {
312
+ if (e < n.y || e > n.y + n.height) return null;
313
+ const o = Math.abs(t - n.mainFrom), i = Math.abs(t - n.mainTo);
314
+ return Math.min(o, i) > s ? null : o <= i ? "from" : "to";
315
315
  }
316
- function Et(s, t, e) {
317
- return s.outerTo >= 0 && s.outerFrom <= t && s.y + s.height >= 0 && s.y <= e;
316
+ function Ot(n, t, e) {
317
+ return n.outerTo >= 0 && n.outerFrom <= t && n.y + n.height >= 0 && n.y <= e;
318
318
  }
319
- const Rn = 64;
320
- function Pn(s, t) {
321
- if (s.miniature) return null;
322
- const e = yt(s.subtask.appearance).hatched ? at + Ge + 1 : 0, n = Math.max(s.mainFrom + e, 0), o = Math.min(s.mainTo - e, t) - n;
323
- return o < Rn ? null : { x: n, width: o, y: s.y, height: s.height };
319
+ const Es = 64;
320
+ function Ns(n, t) {
321
+ if (n.miniature) return null;
322
+ const e = kt(n.subtask.appearance).hatched ? nt + Ye + 1 : 0, s = Math.max(n.mainFrom + e, 0), o = Math.min(n.mainTo - e, t) - s;
323
+ return o < Es ? null : { x: s, width: o, y: n.y, height: n.height };
324
324
  }
325
- const $n = 10;
326
- function ye(s, t, e) {
327
- const n = Math.round(t.y + t.height / 2);
328
- return s === "centre" || e.y === t.y ? n : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
325
+ const Rs = 10;
326
+ function ve(n, t, e) {
327
+ const s = Math.round(t.y + t.height / 2);
328
+ return n === "centre" || e.y === t.y ? s : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
329
329
  }
330
- function Nt(s, t, e, n, o) {
331
- const i = t.route ?? o.route, r = t.attach ?? o.attach, a = t.ends ?? o.ends, l = R(s, Gt(t, e.subtask)), h = R(s, Yt(t, n.subtask)), d = ye(r, e, n), c = ye(r, n, e);
330
+ function Et(n, t, e, s, o) {
331
+ const i = t.route ?? o.route, r = t.attach ?? o.attach, a = t.ends ?? o.ends, l = R(n, Yt(t, e.subtask)), h = R(n, Kt(t, s.subtask)), d = ve(r, e, s), u = ve(r, s, e);
332
332
  if (i === "straight")
333
- return { dependency: t, kind: i, ends: a, x1: l, y1: d, x2: h, y2: c, c1x: l, c2x: h, points: [l, d, h, c] };
333
+ return { dependency: t, kind: i, ends: a, x1: l, y1: d, x2: h, y2: u, c1x: l, c2x: h, points: [l, d, h, u] };
334
334
  if (i === "orthogonal") {
335
- const A = l + $n, C = d === c ? A : Math.round((A + h) / 2);
336
- return { dependency: t, kind: i, ends: a, x1: l, y1: d, x2: h, y2: c, c1x: l, c2x: h, points: d === c ? [l, d, h, c] : [l, d, C, d, C, c, h, c] };
335
+ const A = l + Rs, C = d === u ? A : Math.round((A + h) / 2);
336
+ 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, C, d, C, u, h, u] };
337
337
  }
338
338
  const m = Math.max(14, Math.abs(h - l) / 2), p = l + m, y = h - m, I = [];
339
339
  for (let A = 0; A <= 16; A++) {
340
340
  const C = A / 16, k = 1 - C;
341
341
  I.push(
342
342
  k * k * k * l + 3 * k * k * C * p + 3 * k * C * C * y + C * C * C * h,
343
- k * k * k * d + 3 * k * k * C * d + 3 * k * C * C * c + C * C * C * c
343
+ k * k * k * d + 3 * k * k * C * d + 3 * k * C * C * u + C * C * C * u
344
344
  );
345
345
  }
346
- return { dependency: t, kind: "curve", ends: a, x1: l, y1: d, x2: h, y2: c, c1x: p, c2x: y, points: I };
346
+ return { dependency: t, kind: "curve", ends: a, x1: l, y1: d, x2: h, y2: u, c1x: p, c2x: y, points: I };
347
347
  }
348
- function Bn(s, t, e) {
349
- let n = 1 / 0;
350
- const o = s.points;
348
+ function Ps(n, t, e) {
349
+ let s = 1 / 0;
350
+ const o = n.points;
351
351
  for (let i = 0; i + 3 < o.length; i += 2) {
352
- const r = o[i], a = o[i + 1], l = o[i + 2], h = o[i + 3], d = l - r, c = h - a, m = d * d + c * c, p = m === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * d + (e - a) * c) / m));
353
- n = Math.min(n, Math.hypot(t - (r + p * d), e - (a + p * c)));
352
+ const r = o[i], a = o[i + 1], l = o[i + 2], h = o[i + 3], d = l - r, u = h - a, m = d * d + u * u, p = m === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * d + (e - a) * u) / m));
353
+ s = Math.min(s, Math.hypot(t - (r + p * d), e - (a + p * u)));
354
354
  }
355
- return n;
355
+ return s;
356
356
  }
357
- const Ke = [], xn = 56;
358
- function Hn(s, t = xn) {
359
- return s > 0 ? Math.min(X, Math.max(15 * q, un(s * t, 1))) : 15 * q;
357
+ const We = [], $s = 56;
358
+ function Bs(n, t = $s) {
359
+ return n > 0 ? Math.min(X, Math.max(15 * q, cs(n * t, 1))) : 15 * q;
360
360
  }
361
- function Gn(s, t, e = Ke) {
362
- const [n, o] = Ve(s, e);
363
- return fn(e, n, o, t, Bt(n)).filter(
364
- (i) => i.workingTime >= s[0] && i.workingTime <= s[1]
361
+ function xs(n, t, e = We) {
362
+ const [s, o] = Ue(n, e);
363
+ return us(e, s, o, t, Bt(s)).filter(
364
+ (i) => i.workingTime >= n[0] && i.workingTime <= n[1]
365
365
  );
366
366
  }
367
- function Yn(s, t = Ke) {
368
- const [e, n] = Ve(s, t), o = [], i = new Date(e);
369
- for (i.setHours(0, 0, 0, 0); i.getTime() < n && o.length < 400; ) {
367
+ function Gs(n, t = We) {
368
+ const [e, s] = Ue(n, t), o = [], i = new Date(e);
369
+ for (i.setHours(0, 0, 0, 0); i.getTime() < s && o.length < 400; ) {
370
370
  const r = i.getTime();
371
371
  i.setDate(i.getDate() + 1);
372
372
  const a = i.getTime();
373
373
  o.push({
374
374
  start: r,
375
- end: a,
376
- from: Y(r, t),
377
- to: Y(a, t)
375
+ from: H(r, t),
376
+ to: H(a, t)
378
377
  });
379
378
  }
380
379
  return o;
381
380
  }
382
- const Dt = [1, 2, 7, 14, 28];
383
- function zn(s, t) {
384
- return Dt.find((e) => e * s >= t) ?? Dt[Dt.length - 1];
381
+ const Ct = [1, 2, 7, 14, 28];
382
+ function Hs(n, t) {
383
+ return Ct.find((e) => e * n >= t) ?? Ct[Ct.length - 1];
385
384
  }
386
- function _t(s, t) {
387
- return ((Math.round((s - Bt(s)) / X) - 4) % t + t) % t === 0;
385
+ function Dt(n, t) {
386
+ return ((Math.round((n - Bt(n)) / X) - 4) % t + t) % t === 0;
388
387
  }
389
- function Kn(s, t, e, n) {
390
- const o = s[1] - s[0];
391
- if (!(o > 0)) return [s[0], s[1]];
392
- const i = Math.min(n.max, Math.max(n.min, o * e)), r = (t - s[0]) / o, a = t - r * i;
388
+ function Ys(n, t, e, s) {
389
+ const o = n[1] - n[0];
390
+ if (!(o > 0)) return [n[0], n[1]];
391
+ const i = Math.min(s.max, Math.max(s.min, o * e)), r = (t - n[0]) / o, a = t - r * i;
393
392
  return [a, a + i];
394
393
  }
395
- function Vn(s, t) {
396
- return [s[0] + t, s[1] + t];
394
+ function Ks(n, t) {
395
+ return [n[0] + t, n[1] + t];
397
396
  }
398
- function Ve(s, t) {
399
- const e = nt(t);
400
- if (e.intervals.length === 0) return [s[0], s[1]];
401
- const n = (o) => Math.max(0, Math.min(e.total, o));
402
- return [j(n(s[0]), e), j(n(s[1]), e)];
397
+ function at(n, t) {
398
+ const e = pt(t);
399
+ return e.intervals.length === 0 ? n : xt(Math.max(0, Math.min(e.total, n)), e);
403
400
  }
404
- const gt = 44;
405
- class Wn {
401
+ function Ue(n, t) {
402
+ return [at(n[0], t), at(n[1], t)];
403
+ }
404
+ const Nt = 44;
405
+ class Vs {
406
406
  constructor(t) {
407
407
  f(this, "options", {
408
- laneHeight: gt,
408
+ laneHeight: Nt,
409
409
  calendar: [],
410
- zoomLimits: { min: xt, max: 28 * X },
410
+ zoomLimits: { min: Gt, max: 28 * X },
411
411
  snap: "ticks",
412
412
  intents: [],
413
413
  now: null,
@@ -422,7 +422,7 @@ class Wn {
422
422
  /* What is laid out from top to bottom (`rows.ts`). It is derived here and
423
423
  not in the data, because a row's height comes from a view option; every y
424
424
  in the package reads it. */
425
- f(this, "rows", me({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: gt }));
425
+ f(this, "rows", pe({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: Nt }));
426
426
  /** The folded groups, as the scene holds them. */
427
427
  f(this, "collapsed", /* @__PURE__ */ new Set());
428
428
  /** The groups a gesture in flight holds open. Dropped when it ends; the
@@ -435,24 +435,23 @@ class Wn {
435
435
  }
436
436
  /** Takes new options; a new calendar keeps the wall-clock span in view. */
437
437
  setOptions(t) {
438
- const e = t.calendar !== this.options.calendar, n = this.options.calendar;
438
+ const e = t.calendar !== this.options.calendar, s = this.options.calendar;
439
439
  if (this.options = t, e) {
440
- const o = nt(n), i = (r) => {
440
+ const o = pt(s), i = (r) => {
441
441
  const a = o.intervals.length === 0 ? r : Math.max(0, Math.min(o.total, r));
442
- return Y(j(a, o), t.calendar) + (r - a);
442
+ return H(xt(a, o), t.calendar) + (r - a);
443
443
  };
444
444
  this.domain = [i(this.domain[0]), i(this.domain[1])];
445
445
  }
446
446
  }
447
447
  /** Puts a span of two wall-clock instants in view. */
448
448
  showWall(t) {
449
- this.domain = [Y(t[0], this.options.calendar), Y(t[1], this.options.calendar)];
449
+ this.domain = [H(t[0], this.options.calendar), H(t[1], this.options.calendar)];
450
450
  }
451
451
  viewport() {
452
452
  return {
453
- scale: new mn(this.domain, [0, this.width]),
453
+ scale: new fs(this.domain, [0, this.width]),
454
454
  calendar: this.options.calendar,
455
- laneHeight: this.options.laneHeight,
456
455
  scrollY: this.scrollY,
457
456
  rows: this.rows
458
457
  };
@@ -467,41 +466,41 @@ class Wn {
467
466
  /** The fine band's step at the current zoom. */
468
467
  step() {
469
468
  const t = this.domain[1] - this.domain[0];
470
- return Hn(this.width > 0 ? t / this.width : t);
469
+ return Bs(this.width > 0 ? t / this.width : t);
471
470
  }
472
471
  /** Lays the rows out, clamps the scroll, and lays the data out anew. */
473
472
  layout() {
474
- this.rows = me({
473
+ this.rows = pe({
475
474
  lanes: this.data.lanes,
476
475
  groups: this.data.groups,
477
- collapsed: Fn(this.collapsed, this.openForGesture),
476
+ collapsed: Ds(this.collapsed, this.openForGesture),
478
477
  laneHeight: this.options.laneHeight
479
478
  }), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY));
480
479
  const t = this.viewport();
481
480
  this.boxes = [], this.boxById = /* @__PURE__ */ new Map();
482
481
  for (const e of this.data.subtasks) {
483
- const n = Wt(this.rows, e.lane);
484
- if (n === null) continue;
485
- const o = Ye(t, e, e.lane, n, this.data.depth.get(e.id) ?? 0);
482
+ const s = zt(this.rows, e.lane);
483
+ if (s === null) continue;
484
+ const o = Ke(t, e, s, this.data.depth.get(e.id) ?? 0);
486
485
  this.boxes.push(o), this.boxById.set(e.id, o);
487
486
  }
488
487
  this.paths = [];
489
488
  for (const e of this.data.dependencies) {
490
- const n = this.boxById.get(e.from), o = this.boxById.get(e.to);
491
- n === void 0 || o === void 0 || this.paths.push(Nt(t, e, n, o, this.options));
489
+ const s = this.boxById.get(e.from), o = this.boxById.get(e.to);
490
+ s === void 0 || o === void 0 || this.paths.push(Et(t, e, s, o, this.options));
492
491
  }
493
492
  }
494
493
  /** The days of the coarse band and the ticks of the fine band, in pixels. */
495
494
  bands() {
496
495
  const t = this.step();
497
496
  if (this.width <= 0) return { days: [], ticks: [], step: t };
498
- const e = this.viewport().scale, n = this.options.calendar;
497
+ const e = this.viewport().scale, s = this.options.calendar;
499
498
  return {
500
- days: Yn(this.domain, n).map((o) => {
499
+ days: Gs(this.domain, s).map((o) => {
501
500
  const i = Math.round(e.toPx(o.from));
502
501
  return { start: o.start, x: i, width: Math.round(e.toPx(o.to)) - i };
503
502
  }),
504
- ticks: Gn(this.domain, t, n).map((o) => ({ wallClock: o.wallClock, x: Math.round(e.toPx(o.workingTime)) })),
503
+ ticks: xs(this.domain, t, s).map((o) => ({ wallClock: o.wallClock, x: Math.round(e.toPx(o.workingTime)) })),
505
504
  step: t
506
505
  };
507
506
  }
@@ -509,32 +508,32 @@ class Wn {
509
508
  nowX() {
510
509
  const t = this.options.now;
511
510
  if (t === null || this.width <= 0) return null;
512
- const e = Math.round(this.viewport().scale.toPx(Y(t, this.options.calendar)));
511
+ const e = Math.round(this.viewport().scale.toPx(H(t, this.options.calendar)));
513
512
  return e >= 0 && e <= this.width ? e : null;
514
513
  }
515
514
  hitAt(t, e) {
516
- const n = this.viewport();
515
+ const s = this.viewport();
517
516
  for (let a = this.data.milestones.length - 1; a >= 0; a--) {
518
- const l = this.data.milestones[a], h = Ut(n, l);
517
+ const l = this.data.milestones[a], h = Xt(s, l);
519
518
  if (h !== null && Math.abs(t - h.x) + Math.abs(e - h.y) <= h.half + 2) return { kind: "milestone", milestone: l };
520
519
  }
521
520
  for (let a = this.boxes.length - 1; a >= 0; a--) {
522
- const l = this.boxes[a], h = ze(l, t, e);
521
+ const l = this.boxes[a], h = Ve(l, t, e);
523
522
  if (h !== null) return { kind: "subtask", subtask: l.subtask, part: h };
524
523
  }
525
524
  let o = null, i = 4;
526
525
  for (const a of this.paths) {
527
- const l = Bn(a, t, e);
526
+ const l = Ps(a, t, e);
528
527
  l <= i && (i = l, o = a);
529
528
  }
530
529
  if (o !== null) return { kind: "dependency", dependency: o.dependency };
531
- const r = ke(this.viewport(), e);
530
+ const r = ye(this.viewport(), e);
532
531
  return r !== null ? { kind: "lane", lane: r } : { kind: "nothing" };
533
532
  }
534
533
  /** The wall-clock time at a plot x; within the calendar's extent. */
535
534
  timeAt(t) {
536
- const e = this.viewport().scale.fromPx(t), n = nt(this.options.calendar);
537
- return n.intervals.length === 0 ? e : j(Math.max(0, Math.min(n.total, e)), n);
535
+ const e = this.viewport().scale.fromPx(t);
536
+ return at(e, this.options.calendar);
538
537
  }
539
538
  /** The lane at a y, strips included: what the pointer is ON.
540
539
 
@@ -543,7 +542,7 @@ class Wn {
543
542
  `foldedGroupAt` - and a caller that reached through `viewport()` for it
544
543
  would be depending on the layout rather than asking the view. */
545
544
  laneIdAt(t) {
546
- return ke(this.viewport(), t);
545
+ return ye(this.viewport(), t);
547
546
  }
548
547
  /** The lane a DROP at this y would land on.
549
548
 
@@ -553,137 +552,137 @@ class Wn {
553
552
  aim at. Hover, the tooltip and selection do read a strip - they cost
554
553
  nothing if they are a pixel out. */
555
554
  dropLaneIdAt(t) {
556
- const e = st(this.rows, t + this.scrollY);
555
+ const e = tt(this.rows, t + this.scrollY);
557
556
  return e === null || e.kind !== "lane" ? null : e.lane ?? null;
558
557
  }
559
558
  /** The folded group a y lies over, or null. */
560
559
  foldedGroupAt(t) {
561
- const e = st(this.rows, t + this.scrollY);
560
+ const e = tt(this.rows, t + this.scrollY);
562
561
  return e !== null && e.kind === "miniature" ? e.group ?? null : null;
563
562
  }
564
563
  /** Pans by pixels. Says what moved: the span through time, the lanes, or
565
564
  neither - a scroll through the lanes is no news about the time. */
566
565
  pan(t, e) {
567
- const n = this.domain[0], o = this.scrollY, i = this.domain[1] - n;
568
- this.width > 0 && t !== 0 && (this.domain = Vn(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
569
- const r = this.domain[0] !== n;
566
+ const s = this.domain[0], o = this.scrollY, i = this.domain[1] - s;
567
+ this.width > 0 && t !== 0 && (this.domain = Ks(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
568
+ const r = this.domain[0] !== s;
570
569
  return { moved: r || this.scrollY !== o, time: r };
571
570
  }
572
571
  /** Zooms around a plot x; says whether the span changed. */
573
572
  zoomAt(t, e) {
574
573
  if (this.width <= 0 || !Number.isFinite(e)) return !1;
575
- const n = this.domain, o = this.viewport().scale.fromPx(t);
576
- return this.domain = Kn(this.domain, o, e, this.options.zoomLimits), n[0] !== this.domain[0] || n[1] !== this.domain[1];
577
- }
578
- }
579
- const Un = "_root_1892z_4 _text_1krlf_23", Xn = "_corner_1892z_19", qn = "_dayBand_1892z_23", jn = "_tickBand_1892z_24", Jn = "_day_1892z_23", Zn = "_dayLabel_1892z_50", Qn = "_tick_1892z_24", ts = "_tickLabel_1892z_71", es = "_headers_1892z_79", ns = "_header_1892z_79", ss = "_headerLabel_1892z_97", os = "_headerCount_1892z_134", is = "_chevron_1892z_143", rs = "_plot_1892z_201", as = "_focusRing_1892z_208", ls = "_layer_1892z_226", ds = "_grip_1892z_235", hs = "_ghostLabel_1892z_245", cs = "_finding_1892z_258", us = "_refusal_1892z_266", fs = "_tooltip_1892z_270", ms = "_tooltipHead_1892z_289", ps = "_tooltipTimes_1892z_294", gs = "_now_1892z_303", ks = "_barLabel_1892z_317", ys = "_barLabelText_1892z_330", v = {
580
- root: Un,
581
- corner: Xn,
582
- dayBand: qn,
583
- tickBand: jn,
584
- day: Jn,
585
- dayLabel: Zn,
586
- tick: Qn,
587
- tickLabel: ts,
588
- headers: es,
589
- header: ns,
590
- headerLabel: ss,
591
- headerCount: os,
592
- chevron: is,
593
- plot: rs,
594
- focusRing: as,
595
- layer: ls,
596
- grip: ds,
597
- ghostLabel: hs,
598
- finding: cs,
599
- refusal: us,
600
- tooltip: fs,
601
- tooltipHead: ms,
602
- tooltipTimes: ps,
603
- now: gs,
604
- barLabel: ks,
605
- barLabelText: ys
574
+ const s = this.domain, o = this.viewport().scale.fromPx(t);
575
+ return this.domain = Ys(this.domain, o, e, this.options.zoomLimits), s[0] !== this.domain[0] || s[1] !== this.domain[1];
576
+ }
577
+ }
578
+ const Ws = "_root_1g7hg_4 _text_18806_22", Us = "_corner_1g7hg_19", zs = "_dayBand_1g7hg_23", Xs = "_tickBand_1g7hg_24", qs = "_day_1g7hg_23", js = "_dayLabel_1g7hg_50", Js = "_tick_1g7hg_24", Zs = "_tickLabel_1g7hg_71", Qs = "_headers_1g7hg_79", tn = "_header_1g7hg_79", en = "_headerLabel_1g7hg_97", sn = "_headerCount_1g7hg_133", nn = "_chevron_1g7hg_142", on = "_plot_1g7hg_197", rn = "_focusRing_1g7hg_204", an = "_layer_1g7hg_222", ln = "_grip_1g7hg_231", dn = "_ghostLabel_1g7hg_241", hn = "_finding_1g7hg_254", cn = "_refusal_1g7hg_262", un = "_tooltip_1g7hg_266", fn = "_tooltipHead_1g7hg_285", mn = "_tooltipTimes_1g7hg_290", pn = "_now_1g7hg_299", gn = "_barLabel_1g7hg_313", kn = "_barLabelText_1g7hg_326", v = {
579
+ root: Ws,
580
+ corner: Us,
581
+ dayBand: zs,
582
+ tickBand: Xs,
583
+ day: qs,
584
+ dayLabel: js,
585
+ tick: Js,
586
+ tickLabel: Zs,
587
+ headers: Qs,
588
+ header: tn,
589
+ headerLabel: en,
590
+ headerCount: sn,
591
+ chevron: nn,
592
+ plot: on,
593
+ focusRing: rn,
594
+ layer: an,
595
+ grip: ln,
596
+ ghostLabel: dn,
597
+ finding: hn,
598
+ refusal: cn,
599
+ tooltip: un,
600
+ tooltipHead: fn,
601
+ tooltipTimes: mn,
602
+ now: pn,
603
+ barLabel: gn,
604
+ barLabelText: kn
606
605
  };
607
- function We() {
608
- const s = kt();
606
+ function ze() {
607
+ const n = gt();
609
608
  return (t) => {
610
- const e = Math.round(t / q), n = Math.floor(e / 60), o = e % 60;
611
- return [n > 0 ? s.hoursShort(n) : "", o > 0 || n === 0 ? s.minutesShort(o) : ""].filter(Boolean).join(" ");
609
+ const e = Math.round(t / q), s = Math.floor(e / 60), o = e % 60;
610
+ return [s > 0 ? n.hoursShort(s) : "", o > 0 || s === 0 ? n.minutesShort(o) : ""].filter(Boolean).join(" ");
612
611
  };
613
612
  }
614
- function vs({ target: s, lane: t }) {
615
- const e = Ht(), n = kt(), o = We(), i = (c) => e.time(new Date(c), !1);
616
- if (s.kind === "subtask") {
617
- const { subtask: c, task: m } = s, p = [
618
- (m == null ? void 0 : m.name) ?? c.task,
619
- c.name ?? c.id,
620
- `${e.dateShort(new Date(c.from))} ${n.scheduleGhostTimes(i(c.from), i(c.to))}`,
621
- ...s.overlapping.map((y) => n.scheduleOverlapWith(y.name ?? y.id)),
622
- ...s.violatedDependencies.map((y) => n.scheduleViolatedBy(o(y.shortBy))),
623
- ...s.blocked.map((y) => n.scheduleInBlockedTime(y.label))
613
+ function yn({ target: n, lane: t }) {
614
+ const e = Ht(), s = gt(), o = ze(), i = (u) => e.time(new Date(u), !1);
615
+ if (n.kind === "subtask") {
616
+ const { subtask: u, task: m } = n, p = [
617
+ (m == null ? void 0 : m.name) ?? u.task,
618
+ u.name ?? u.id,
619
+ `${e.dateShort(new Date(u.from))} ${s.scheduleGhostTimes(i(u.from), i(u.to))}`,
620
+ ...n.overlapping.map((y) => s.scheduleOverlapWith(y.name ?? y.id)),
621
+ ...n.violatedDependencies.map((y) => s.scheduleViolatedBy(o(y.shortBy))),
622
+ ...n.blocked.map((y) => s.scheduleInBlockedTime(y.label))
624
623
  ];
625
- return /* @__PURE__ */ H(lt, { children: [
624
+ return /* @__PURE__ */ G(it, { children: [
626
625
  t,
627
626
  `, ${p.join(", ")}`
628
627
  ] });
629
628
  }
630
- if (s.kind === "milestone") {
631
- const { milestone: c } = s;
632
- return /* @__PURE__ */ H(lt, { children: [
629
+ if (n.kind === "milestone") {
630
+ const { milestone: u } = n;
631
+ return /* @__PURE__ */ G(it, { children: [
633
632
  t,
634
- `, ${n.scheduleMilestone(c.label ?? c.id)}, ${e.dateShort(new Date(c.at))} ${i(c.at)}`
633
+ `, ${s.scheduleMilestone(u.label ?? u.id)}, ${e.dateShort(new Date(u.at))} ${i(u.at)}`
635
634
  ] });
636
635
  }
637
- const { dependency: r, task: a, from: l, to: h, violated: d } = s;
636
+ const { dependency: r, task: a, from: l, to: h, violated: d } = n;
638
637
  return [
639
638
  (a == null ? void 0 : a.name) ?? (a == null ? void 0 : a.id) ?? r.id,
640
- `${n.scheduleDependency} ${o(r.lag)}`,
641
- n.scheduleRoute((l == null ? void 0 : l.name) ?? r.from, (h == null ? void 0 : h.name) ?? r.to),
642
- ...d === void 0 ? [] : [n.scheduleViolatedBy(o(d.shortBy))]
639
+ `${s.scheduleDependency} ${o(r.lag)}`,
640
+ s.scheduleRoute((l == null ? void 0 : l.name) ?? r.from, (h == null ? void 0 : h.name) ?? r.to),
641
+ ...d === void 0 ? [] : [s.scheduleViolatedBy(o(d.shortBy))]
643
642
  ].join(", ");
644
643
  }
645
- function ws({ target: s }) {
646
- const t = Ht(), e = kt(), n = (d) => t.time(new Date(d), !1), o = We();
647
- if (s.kind === "subtask") {
648
- const { subtask: d, task: c } = s;
649
- return /* @__PURE__ */ H(lt, { children: [
650
- /* @__PURE__ */ g("span", { className: v.tooltipHead, children: (c == null ? void 0 : c.name) ?? d.task }),
644
+ function vn({ target: n }) {
645
+ const t = Ht(), e = gt(), s = (d) => t.time(new Date(d), !1), o = ze();
646
+ if (n.kind === "subtask") {
647
+ const { subtask: d, task: u } = n;
648
+ return /* @__PURE__ */ G(it, { children: [
649
+ /* @__PURE__ */ g("span", { className: v.tooltipHead, children: (u == null ? void 0 : u.name) ?? d.task }),
651
650
  /* @__PURE__ */ g("span", { children: d.name ?? d.id }),
652
- /* @__PURE__ */ g("span", { className: v.tooltipTimes, children: e.scheduleGhostTimes(n(d.from), n(d.to)) }),
651
+ /* @__PURE__ */ g("span", { className: v.tooltipTimes, children: e.scheduleGhostTimes(s(d.from), s(d.to)) }),
653
652
  (d.leadIn ?? 0) > 0 && /* @__PURE__ */ g("span", { children: `${e.scheduleLeadIn} ${o(d.leadIn)}` }),
654
653
  (d.leadOut ?? 0) > 0 && /* @__PURE__ */ g("span", { children: `${e.scheduleLeadOut} ${o(d.leadOut)}` }),
655
- s.overlapping.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleOverlapWith(m.name ?? m.id) }, m.id)),
656
- s.violatedDependencies.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleViolatedBy(o(m.shortBy)) }, m.dependency)),
657
- s.blocked.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleInBlockedTime(m.label) }, m.id))
654
+ n.overlapping.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleOverlapWith(m.name ?? m.id) }, m.id)),
655
+ n.violatedDependencies.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleViolatedBy(o(m.shortBy)) }, m.dependency)),
656
+ n.blocked.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleInBlockedTime(m.label) }, m.id))
658
657
  ] });
659
658
  }
660
- if (s.kind === "milestone") {
661
- const { milestone: d } = s;
662
- return /* @__PURE__ */ H(lt, { children: [
659
+ if (n.kind === "milestone") {
660
+ const { milestone: d } = n;
661
+ return /* @__PURE__ */ G(it, { children: [
663
662
  /* @__PURE__ */ g("span", { className: v.tooltipHead, children: e.scheduleMilestone(d.label ?? d.id) }),
664
- /* @__PURE__ */ g("span", { className: v.tooltipTimes, children: `${t.dateShort(new Date(d.at))} ${n(d.at)}` })
663
+ /* @__PURE__ */ g("span", { className: v.tooltipTimes, children: `${t.dateShort(new Date(d.at))} ${s(d.at)}` })
665
664
  ] });
666
665
  }
667
- const { dependency: i, task: r, from: a, to: l, violated: h } = s;
668
- return /* @__PURE__ */ H(lt, { children: [
666
+ const { dependency: i, task: r, from: a, to: l, violated: h } = n;
667
+ return /* @__PURE__ */ G(it, { children: [
669
668
  /* @__PURE__ */ g("span", { className: v.tooltipHead, children: (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.id) ?? i.id }),
670
669
  /* @__PURE__ */ g("span", { children: e.scheduleRoute((a == null ? void 0 : a.name) ?? i.from, (l == null ? void 0 : l.name) ?? i.to) }),
671
670
  /* @__PURE__ */ g("span", { children: `${e.scheduleDependency} ${o(i.lag)}` }),
672
671
  h !== void 0 && /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleViolatedBy(o(h.shortBy)) })
673
672
  ] });
674
673
  }
675
- const bs = [], ve = { min: xt, max: 28 * X }, Ms = [], we = 20, Ft = 44, Ts = Re(function(t, e) {
676
- var ce;
674
+ const wn = [], we = { min: Gt, max: 28 * X }, bn = [], be = 20, _t = 44, Mn = Pe(function(t, e) {
675
+ var ue;
677
676
  const {
678
- scene: n,
677
+ scene: s,
679
678
  ariaLabel: o,
680
679
  height: i = 400,
681
- laneHeight: r = gt,
680
+ laneHeight: r = Nt,
682
681
  headerWidth: a = 160,
683
- calendar: l = Ms,
682
+ calendar: l = bn,
684
683
  zoomLimits: h,
685
684
  snap: d = "ticks",
686
- intents: c = bs,
685
+ intents: u = wn,
687
686
  onIntent: m,
688
687
  canMoveTo: p,
689
688
  onInteraction: y,
@@ -696,164 +695,164 @@ const bs = [], ve = { min: xt, max: 28 * X }, Ms = [], we = 20, Ft = 44, Ts = Re
696
695
  label: E,
697
696
  tooltip: _,
698
697
  now: P,
699
- className: it,
700
- style: wt,
701
- children: ut
702
- } = t, bt = vn(), qt = `${bt}-summary`, jt = G(null), Jt = G(null), Zt = G(null), Qt = G(null), z = Ht(), B = kt(), te = (h == null ? void 0 : h.min) ?? ve.min, ee = (h == null ? void 0 : h.max) ?? ve.max, ne = typeof d == "object" ? d.step : null, se = typeof d == "object" ? d.offset : null, oe = typeof d == "object" ? null : d, [en, nn] = et(() => Date.now());
703
- U(() => {
698
+ className: st,
699
+ style: vt,
700
+ children: ht
701
+ } = t, wt = ks(), jt = `${wt}-summary`, Jt = V(null), Zt = V(null), Qt = V(null), te = V(null), Y = Ht(), B = gt(), ee = (h == null ? void 0 : h.min) ?? we.min, se = (h == null ? void 0 : h.max) ?? we.max, ne = typeof d == "object" ? d.step : null, oe = typeof d == "object" ? d.offset : null, ie = typeof d == "object" ? null : d, [es, ss] = ot(() => Date.now());
702
+ z(() => {
704
703
  if (P !== !0) return;
705
- const u = setInterval(() => nn(Date.now()), q);
706
- return () => clearInterval(u);
704
+ const c = setInterval(() => ss(Date.now()), q);
705
+ return () => clearInterval(c);
707
706
  }, [P]);
708
- const ie = P === !0 ? en : typeof P == "number" ? P : null;
709
- rt(() => {
710
- const u = oe ?? { step: ne ?? 0, offset: se ?? 0 };
711
- n.setOptions({ laneHeight: r, calendar: l, zoomLimits: { min: te, max: ee }, snap: u, intents: c, now: ie, route: k, attach: T, ends: S });
712
- }, [n, r, l, te, ee, oe, ne, se, c, ie, k, T, S]), U(() => {
713
- n.setHandlers({ onIntent: m, canMoveTo: p, onInteraction: y, onSelectedTaskChange: A });
714
- }, [n, m, p, y, A]), wn(
707
+ const re = P === !0 ? es : typeof P == "number" ? P : null;
708
+ ut(() => {
709
+ const c = ie ?? { step: ne ?? 0, offset: oe ?? 0 };
710
+ s.setOptions({ laneHeight: r, calendar: l, zoomLimits: { min: ee, max: se }, snap: c, intents: u, now: re, route: k, attach: T, ends: S });
711
+ }, [s, r, l, ee, se, ie, ne, oe, u, re, k, T, S]), z(() => {
712
+ s.setHandlers({ onIntent: m, canMoveTo: p, onInteraction: y, onSelectedTaskChange: A });
713
+ }, [s, m, p, y, A]), ys(
715
714
  e,
716
715
  () => ({
717
- positionAt: (u, w) => n.positionAt(u, w),
718
- clientPointOf: (u, w) => n.clientPointOf(u, w),
719
- visibleDomain: () => n.visibleDomain()
716
+ positionAt: (c, w) => s.positionAt(c, w),
717
+ clientPointOf: (c, w) => s.clientPointOf(c, w),
718
+ visibleDomain: () => s.visibleDomain()
720
719
  }),
721
- [n]
722
- ), U(() => {
723
- n.setControlledTask(I);
724
- }, [n, I]), U(() => {
725
- n.setPlacing(C ?? null);
726
- }, [n, C]), U(() => {
727
- const u = jt.current, w = Jt.current, L = Zt.current, N = Qt.current;
728
- if (!u || !w || !L || !N) return;
729
- n.bind(u, w, L, N);
720
+ [s]
721
+ ), z(() => {
722
+ s.setControlledTask(I);
723
+ }, [s, I]), z(() => {
724
+ s.setPlacing(C ?? null);
725
+ }, [s, C]), z(() => {
726
+ const c = Jt.current, w = Zt.current, L = Qt.current, N = te.current;
727
+ if (!c || !w || !L || !N) return;
728
+ s.bind(c, w, L, N);
730
729
  const D = w.getBoundingClientRect();
731
- n.resize(D.width, D.height);
730
+ s.resize(D.width, D.height);
732
731
  const F = new ResizeObserver((O) => {
733
- var ft;
734
- const x = (ft = O[O.length - 1]) == null ? void 0 : ft.contentRect;
735
- x !== void 0 && n.resize(x.width, x.height);
732
+ var ct;
733
+ const x = (ct = O[O.length - 1]) == null ? void 0 : ct.contentRect;
734
+ x !== void 0 && s.resize(x.width, x.height);
736
735
  });
737
736
  F.observe(w);
738
- const $ = (O) => n.wheel(O);
739
- u.addEventListener("wheel", $, { passive: !1 });
737
+ const $ = (O) => s.wheel(O);
738
+ c.addEventListener("wheel", $, { passive: !1 });
740
739
  const K = (O) => {
741
- O.key === "Escape" && n.cancelEdit() && O.preventDefault();
740
+ O.key === "Escape" && s.cancelEdit() && O.preventDefault();
742
741
  };
743
742
  return window.addEventListener("keydown", K), () => {
744
- window.removeEventListener("keydown", K), u.removeEventListener("wheel", $), F.disconnect(), n.unbind();
743
+ window.removeEventListener("keydown", K), c.removeEventListener("wheel", $), F.disconnect(), s.unbind();
745
744
  };
746
- }, [n]);
747
- const b = Pe(n.subscribe, n.getSnapshot, n.getServerSnapshot), sn = (u, w) => {
748
- const L = new Date(u);
749
- return w >= 200 ? z.dateLong(L) : w >= 84 ? z.date(L) : w >= Ft ? z.dateShort(L) : "";
750
- }, on = b.days.reduce((u, w) => Math.max(u, w.width), 0), Z = zn(on, Ft), re = b.step >= X ? Z : 1, M = b.ghost, Q = b.spoken, Mt = b.summary, ae = (u) => `${z.dateShort(new Date(u))} ${z.time(new Date(u), !1)}`, Tt = (u) => `${bt}-row-${encodeURIComponent(u.key)}`, rn = V(() => {
751
- const u = /* @__PURE__ */ new Map();
745
+ }, [s]);
746
+ const b = $e(s.subscribe, s.getSnapshot, s.getServerSnapshot), ns = (c, w) => {
747
+ const L = new Date(c);
748
+ return w >= 200 ? Y.dateLong(L) : w >= 84 ? Y.date(L) : w >= _t ? Y.dateShort(L) : "";
749
+ }, os = b.days.reduce((c, w) => Math.max(c, w.width), 0), J = Hs(os, _t), ae = b.step >= X ? J : 1, M = b.ghost, Z = b.spoken, bt = b.summary, le = (c) => `${Y.dateShort(new Date(c))} ${Y.time(new Date(c), !1)}`, Mt = (c) => `${wt}-row-${encodeURIComponent(c.key)}`, is = W(() => {
750
+ const c = /* @__PURE__ */ new Map();
752
751
  for (const w of b.headers)
753
752
  for (const L of w.within)
754
- w.kind === "groupHead" && L === w.group || u.set(L, [...u.get(L) ?? [], Tt(w)]);
755
- return u;
756
- }, [b.headers, bt]), le = G(null);
757
- rt(() => {
753
+ w.kind === "groupHead" && L === w.group || c.set(L, [...c.get(L) ?? [], Mt(w)]);
754
+ return c;
755
+ }, [b.headers, wt]), de = V(null);
756
+ ut(() => {
758
757
  var F;
759
- const u = le.current;
760
- if (u === null) return;
758
+ const c = de.current;
759
+ if (c === null) return;
761
760
  let w = !0;
762
761
  const L = () => {
763
762
  if (!w) return;
764
- const $ = [...u.querySelectorAll("[data-lane-count]")];
763
+ const $ = [...c.querySelectorAll("[data-lane-count]")];
765
764
  for (const O of $) O.hidden = !1;
766
765
  const K = $.some((O) => {
767
766
  const x = O.previousElementSibling;
768
767
  if (!(x instanceof HTMLElement)) return !1;
769
- const ft = parseFloat(getComputedStyle(x).lineHeight);
770
- return x.scrollWidth > x.clientWidth || x.clientHeight > ft * 1.5;
768
+ const ct = parseFloat(getComputedStyle(x).lineHeight);
769
+ return x.scrollWidth > x.clientWidth || x.clientHeight > ct * 1.5;
771
770
  });
772
771
  for (const O of $) O.hidden = K;
773
772
  };
774
773
  L(), (F = document.fonts) == null || F.ready.then(L);
775
774
  const N = new ResizeObserver(L);
776
- N.observe(u);
775
+ N.observe(c);
777
776
  const D = new MutationObserver(L);
778
- return D.observe(u, { childList: !0, characterData: !0, subtree: !0 }), () => {
777
+ return D.observe(c, { childList: !0, characterData: !0, subtree: !0 }), () => {
779
778
  w = !1, N.disconnect(), D.disconnect();
780
779
  };
781
780
  }, []);
782
- const an = V(() => new Set((M == null ? void 0 : M.refusedLanes) ?? []), [M == null ? void 0 : M.refusedLanes]), de = G(null), [It, ln] = et({ x: 0, y: 0, at: "" }), St = M === null ? "" : `${M.x}:${M.y}:${M.from}:${M.to}:${M.overlap}:${M.violated}:${M.refused}:${M.blocked}`;
783
- rt(() => {
784
- const u = de.current;
785
- if (M === null || u === null) return;
786
- const w = 4, L = M.y - u.offsetHeight - w, N = M.y + M.height + w, D = {
787
- x: Math.max(2, Math.min(M.x, b.width - u.offsetWidth - 2)),
788
- y: L >= 2 ? L : Math.min(N, b.height - u.offsetHeight - 2),
789
- at: St
781
+ const rs = W(() => new Set((M == null ? void 0 : M.refusedLanes) ?? []), [M == null ? void 0 : M.refusedLanes]), he = V(null), [Tt, as] = ot({ x: 0, y: 0, at: "" }), It = M === null ? "" : `${M.x}:${M.y}:${M.from}:${M.to}:${M.overlap}:${M.violated}:${M.refused}:${M.blocked}`;
782
+ ut(() => {
783
+ const c = he.current;
784
+ if (M === null || c === null) return;
785
+ const w = 4, L = M.y - c.offsetHeight - w, N = M.y + M.height + w, D = {
786
+ x: Math.max(2, Math.min(M.x, b.width - c.offsetWidth - 2)),
787
+ y: L >= 2 ? L : Math.min(N, b.height - c.offsetHeight - 2),
788
+ at: It
790
789
  };
791
- ln((F) => F.x === D.x && F.y === D.y && F.at === D.at ? F : D);
792
- }, [M, St, b.width, b.height]);
793
- const he = G(null), [Lt, dn] = et({ x: 0, y: 0, at: "" }), W = b.tooltip, At = W === null ? "" : `${W.x}:${W.y}:${W.target.kind}`;
794
- return rt(() => {
795
- const u = he.current;
796
- if (W === null || u === null) return;
790
+ as((F) => F.x === D.x && F.y === D.y && F.at === D.at ? F : D);
791
+ }, [M, It, b.width, b.height]);
792
+ const ce = V(null), [St, ls] = ot({ x: 0, y: 0, at: "" }), U = b.tooltip, Lt = U === null ? "" : `${U.x}:${U.y}:${U.target.kind}`;
793
+ return ut(() => {
794
+ const c = ce.current;
795
+ if (U === null || c === null) return;
797
796
  const w = 12, L = (D, F, $) => {
798
797
  const K = D + w, O = D - w - F, x = K + F <= $ - 4 || O < 4 ? K : O;
799
798
  return Math.max(4, Math.min(x, $ - F - 4));
800
799
  }, N = {
801
- x: L(W.x, u.offsetWidth, b.width),
802
- y: L(W.y, u.offsetHeight, b.height),
803
- at: At
800
+ x: L(U.x, c.offsetWidth, b.width),
801
+ y: L(U.y, c.offsetHeight, b.height),
802
+ at: Lt
804
803
  };
805
- dn((D) => D.x === N.x && D.y === N.y && D.at === N.at ? D : N);
806
- }, [W, At, b.width, b.height]), /* @__PURE__ */ H(Be.Provider, { value: n, children: [
807
- /* @__PURE__ */ H(
804
+ ls((D) => D.x === N.x && D.y === N.y && D.at === N.at ? D : N);
805
+ }, [U, Lt, b.width, b.height]), /* @__PURE__ */ G(xe.Provider, { value: s, children: [
806
+ /* @__PURE__ */ G(
808
807
  "div",
809
808
  {
810
- ref: jt,
809
+ ref: Jt,
811
810
  role: "figure",
812
811
  "aria-label": o,
813
- className: it ? `${v.root} ${it}` : v.root,
814
- style: { height: `${i}px`, gridTemplateColumns: `min(${a}px, 40%) minmax(0, 1fr)`, ...wt },
812
+ className: st ? `${v.root} ${st}` : v.root,
813
+ style: { height: `${i}px`, gridTemplateColumns: `min(${a}px, 40%) minmax(0, 1fr)`, ...vt },
815
814
  children: [
816
815
  /* @__PURE__ */ g("div", { className: v.corner }),
817
- /* @__PURE__ */ g("div", { className: v.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: b.days.map((u, w) => {
816
+ /* @__PURE__ */ g("div", { className: v.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: b.days.map((c, w) => {
818
817
  var $;
819
- const L = Z === 1 || w === 0 || _t(u.start, Z), N = Z === 1 ? u.x + u.width : (($ = b.days.slice(w + 1).find((K) => _t(K.start, Z))) == null ? void 0 : $.x) ?? b.width, D = Math.max(0, -u.x), F = Math.min(N, b.width) - Math.max(u.x, 0);
820
- return /* @__PURE__ */ g("span", { className: v.day, style: { left: `${u.x}px`, width: `${L ? N - u.x : u.width}px` }, children: /* @__PURE__ */ g("span", { className: v.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${D}px` }, children: L ? sn(u.start, Z === 1 ? F : Math.min(F, Ft)) : "" }) }, u.start);
818
+ const L = J === 1 || w === 0 || Dt(c.start, J), N = J === 1 ? c.x + c.width : (($ = b.days.slice(w + 1).find((K) => Dt(K.start, J))) == null ? void 0 : $.x) ?? b.width, D = Math.max(0, -c.x), F = Math.min(N, b.width) - Math.max(c.x, 0);
819
+ return /* @__PURE__ */ g("span", { className: v.day, style: { left: `${c.x}px`, width: `${L ? N - c.x : c.width}px` }, children: /* @__PURE__ */ g("span", { className: v.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${D}px` }, children: L ? ns(c.start, J === 1 ? F : Math.min(F, _t)) : "" }) }, c.start);
821
820
  }) }),
822
- /* @__PURE__ */ g("div", { ref: le, className: v.headers, "data-schedule-headers": "", children: /* @__PURE__ */ g("div", { className: v.headerRun, style: { transform: `translateY(${-b.scrollY}px)` }, children: b.headers.map((u) => /* @__PURE__ */ H(
821
+ /* @__PURE__ */ g("div", { ref: de, className: v.headers, "data-schedule-headers": "", children: /* @__PURE__ */ g("div", { className: v.headerRun, style: { transform: `translateY(${-b.scrollY}px)` }, children: b.headers.map((c) => /* @__PURE__ */ G(
823
822
  "div",
824
823
  {
825
- id: Tt(u),
824
+ id: Mt(c),
826
825
  className: v.header,
827
- style: { height: `${u.height}px`, paddingLeft: `calc(var(--u-space-3) + ${u.depth} * var(--u-space-3))` },
828
- "data-lane": u.lane,
829
- "data-group": u.group,
830
- "data-row": u.kind,
831
- "data-schedule-clip": `header ${u.kind}`,
832
- "data-refused": u.lane !== void 0 && an.has(u.lane) ? "" : void 0,
826
+ style: { height: `${c.height}px`, paddingLeft: `calc(var(--u-space-3) + ${c.depth} * var(--u-space-3))` },
827
+ "data-lane": c.lane,
828
+ "data-group": c.group,
829
+ "data-row": c.kind,
830
+ "data-schedule-clip": `header ${c.kind}`,
831
+ "data-refused": c.lane !== void 0 && rs.has(c.lane) ? "" : void 0,
833
832
  children: [
834
- u.kind !== "lane" && u.group !== void 0 && /* @__PURE__ */ g(
833
+ c.kind !== "lane" && c.group !== void 0 && /* @__PURE__ */ g(
835
834
  "button",
836
835
  {
837
836
  type: "button",
838
837
  className: v.chevron,
839
838
  "data-schedule-overlay": "fold control",
840
- "aria-expanded": u.collapsed === !1,
841
- "aria-controls": (rn.get(u.group) ?? [Tt(u)]).join(" "),
842
- "aria-label": `${u.collapsed === !0 ? B.scheduleUnfoldGroup : B.scheduleFoldGroup}: ${typeof u.label == "string" ? u.label : u.group}`,
843
- onClick: () => n.toggleGroup(u.group),
844
- children: /* @__PURE__ */ g(Mn, { size: 9, "data-open": u.collapsed === !1 ? "" : void 0 })
839
+ "aria-expanded": c.collapsed === !1,
840
+ "aria-controls": (is.get(c.group) ?? [Mt(c)]).join(" "),
841
+ "aria-label": `${c.collapsed === !0 ? B.scheduleUnfoldGroup : B.scheduleFoldGroup}: ${typeof c.label == "string" ? c.label : c.group}`,
842
+ onClick: () => s.toggleGroup(c.group),
843
+ children: /* @__PURE__ */ g(ws, { size: 9, "data-open": c.collapsed === !1 ? "" : void 0 })
845
844
  }
846
845
  ),
847
- /* @__PURE__ */ g("span", { className: v.headerLabel, "data-schedule-overlay": "header label", children: u.label }),
848
- u.kind !== "lane" && /* @__PURE__ */ g("span", { className: v.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": u.lanes, children: B.scheduleLaneCount(u.lanes) })
846
+ /* @__PURE__ */ g("span", { className: v.headerLabel, "data-schedule-overlay": "header label", children: c.label }),
847
+ c.kind !== "lane" && /* @__PURE__ */ g("span", { className: v.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": c.lanes, children: B.scheduleLaneCount(c.lanes) })
849
848
  ]
850
849
  },
851
- u.key
850
+ c.key
852
851
  )) }) }),
853
- /* @__PURE__ */ H(
852
+ /* @__PURE__ */ G(
854
853
  "div",
855
854
  {
856
- ref: Jt,
855
+ ref: Zt,
857
856
  className: v.plot,
858
857
  "data-schedule-plot": "",
859
858
  "data-schedule-clip": "plot",
@@ -862,71 +861,71 @@ const bs = [], ve = { min: xt, max: 28 * X }, Ms = [], we = 20, Ft = 44, Ts = Re
862
861
  role: "application",
863
862
  "aria-roledescription": B.scheduleRoleDescription,
864
863
  "aria-label": o,
865
- "aria-describedby": qt,
866
- onKeyDown: (u) => {
867
- n.key(u.nativeEvent) && u.preventDefault();
864
+ "aria-describedby": jt,
865
+ onKeyDown: (c) => {
866
+ s.key(c.nativeEvent) && c.preventDefault();
868
867
  },
869
- onFocus: (u) => n.focus(Is(u.currentTarget)),
870
- onBlur: () => n.blur(),
871
- onPointerDown: (u) => n.pointerDown(u.nativeEvent),
872
- onPointerMove: (u) => n.pointerMove(u.nativeEvent),
873
- onPointerUp: (u) => n.pointerUp(u.nativeEvent),
874
- onPointerCancel: (u) => n.pointerCancel(u.nativeEvent),
875
- onPointerLeave: () => n.pointerLeave(),
876
- onContextMenu: (u) => n.contextMenu(u.nativeEvent),
877
- onDragOver: (u) => n.dragOver(u.nativeEvent),
878
- onDrop: (u) => n.drop(u.nativeEvent),
879
- onDragLeave: (u) => {
880
- const w = u.nativeEvent.relatedTarget;
881
- (!(w instanceof Node) || !u.currentTarget.contains(w)) && n.dragLeave();
868
+ onFocus: (c) => s.focus(Tn(c.currentTarget)),
869
+ onBlur: () => s.blur(),
870
+ onPointerDown: (c) => s.pointerDown(c.nativeEvent),
871
+ onPointerMove: (c) => s.pointerMove(c.nativeEvent),
872
+ onPointerUp: (c) => s.pointerUp(c.nativeEvent),
873
+ onPointerCancel: (c) => s.pointerCancel(c.nativeEvent),
874
+ onPointerLeave: () => s.pointerLeave(),
875
+ onContextMenu: (c) => s.contextMenu(c.nativeEvent),
876
+ onDragOver: (c) => s.dragOver(c.nativeEvent),
877
+ onDrop: (c) => s.drop(c.nativeEvent),
878
+ onDragLeave: (c) => {
879
+ const w = c.nativeEvent.relatedTarget;
880
+ (!(w instanceof Node) || !c.currentTarget.contains(w)) && s.dragLeave();
882
881
  },
883
882
  children: [
884
- /* @__PURE__ */ g("canvas", { ref: Zt, className: v.layer, "aria-hidden": "true" }),
885
883
  /* @__PURE__ */ g("canvas", { ref: Qt, className: v.layer, "aria-hidden": "true" }),
886
- b.grips.map((u) => /* @__PURE__ */ g(
884
+ /* @__PURE__ */ g("canvas", { ref: te, className: v.layer, "aria-hidden": "true" }),
885
+ b.grips.map((c) => /* @__PURE__ */ g(
887
886
  "span",
888
887
  {
889
- "data-grip": u.kind,
890
- "data-schedule-overlay": `${u.kind} grip`,
888
+ "data-grip": c.kind,
889
+ "data-schedule-overlay": `${c.kind} grip`,
891
890
  "aria-hidden": "true",
892
891
  className: v.grip,
893
- style: { left: `${u.x}px`, top: `${u.y}px`, height: `${u.height}px` }
892
+ style: { left: `${c.x}px`, top: `${c.y}px`, height: `${c.height}px` }
894
893
  },
895
- u.kind
894
+ c.kind
896
895
  )),
897
- E !== void 0 && b.bars.map((u) => /* @__PURE__ */ g(
896
+ E !== void 0 && b.bars.map((c) => /* @__PURE__ */ g(
898
897
  "span",
899
898
  {
900
899
  className: v.barLabel,
901
- "data-bar-label": u.subtask.id,
900
+ "data-bar-label": c.subtask.id,
902
901
  "data-schedule-overlay": "bar label",
903
902
  "data-schedule-may-cover": "",
904
- "data-on": u.dark ? "dark" : "light",
905
- style: { left: `${u.x}px`, top: `${u.y}px`, width: `${u.width}px`, height: `${u.height}px` },
906
- children: /* @__PURE__ */ g("span", { className: v.barLabelText, children: E(u.subtask) })
903
+ "data-on": c.dark ? "dark" : "light",
904
+ style: { left: `${c.x}px`, top: `${c.y}px`, width: `${c.width}px`, height: `${c.height}px` },
905
+ children: /* @__PURE__ */ g("span", { className: v.barLabelText, children: E(c.subtask) })
907
906
  },
908
- u.subtask.id
907
+ c.subtask.id
909
908
  )),
910
909
  _ !== !1 && b.tooltip !== null && /* @__PURE__ */ g(
911
910
  "span",
912
911
  {
913
- ref: he,
912
+ ref: ce,
914
913
  role: "tooltip",
915
914
  className: v.tooltip,
916
915
  "data-schedule-tooltip": "",
917
916
  "data-schedule-overlay": "tooltip",
918
917
  style: {
919
- left: `${Lt.x}px`,
920
- top: `${Lt.y}px`,
921
- visibility: Lt.at === At ? void 0 : "hidden"
918
+ left: `${St.x}px`,
919
+ top: `${St.y}px`,
920
+ visibility: St.at === Lt ? void 0 : "hidden"
922
921
  },
923
- children: typeof _ == "function" ? _(b.tooltip.target) : /* @__PURE__ */ g(ws, { target: b.tooltip.target })
922
+ children: typeof _ == "function" ? _(b.tooltip.target) : /* @__PURE__ */ g(vn, { target: b.tooltip.target })
924
923
  }
925
924
  ),
926
- M !== null && /* @__PURE__ */ H(
925
+ M !== null && /* @__PURE__ */ G(
927
926
  "span",
928
927
  {
929
- ref: de,
928
+ ref: he,
930
929
  className: v.ghostLabel,
931
930
  "data-ghost": "",
932
931
  "data-schedule-overlay": "ghost label",
@@ -934,12 +933,12 @@ const bs = [], ve = { min: xt, max: 28 * X }, Ms = [], we = 20, Ft = 44, Ts = Re
934
933
  "data-refused": M.refused ? "" : void 0,
935
934
  "data-blocked": M.blocked ? "" : void 0,
936
935
  style: {
937
- left: `${It.x}px`,
938
- top: `${It.y}px`,
939
- visibility: It.at === St ? void 0 : "hidden"
936
+ left: `${Tt.x}px`,
937
+ top: `${Tt.y}px`,
938
+ visibility: Tt.at === It ? void 0 : "hidden"
940
939
  },
941
940
  children: [
942
- B.scheduleGhostTimes(z.time(new Date(M.from), !1), z.time(new Date(M.to), !1)),
941
+ B.scheduleGhostTimes(Y.time(new Date(M.from), !1), Y.time(new Date(M.to), !1)),
943
942
  M.refused && /* @__PURE__ */ g("span", { className: v.refusal, children: B.scheduleLaneRefused }),
944
943
  M.blocked && /* @__PURE__ */ g("span", { className: v.refusal, children: B.scheduleBlockedTime }),
945
944
  M.overlap && /* @__PURE__ */ g("span", { className: v.finding, children: B.scheduleOverlap }),
@@ -952,57 +951,57 @@ const bs = [], ve = { min: xt, max: 28 * X }, Ms = [], we = 20, Ft = 44, Ts = Re
952
951
  }
953
952
  ),
954
953
  /* @__PURE__ */ g("div", { className: v.corner }),
955
- /* @__PURE__ */ H("div", { className: v.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
954
+ /* @__PURE__ */ G("div", { className: v.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
956
955
  b.now !== null && /* @__PURE__ */ g("span", { className: v.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${b.now}px` } }),
957
- b.ticks.map((u) => /* @__PURE__ */ g("span", { className: v.tick, style: { left: `${u.x}px` }, children: u.x >= we && u.x <= b.width - we && (re === 1 || _t(u.wallClock, re)) && /* @__PURE__ */ g("span", { className: v.tickLabel, "data-schedule-overlay": "time label", children: b.step >= X ? z.dateShort(new Date(u.wallClock)) : z.time(new Date(u.wallClock), !1) }) }, u.wallClock))
956
+ b.ticks.map((c) => /* @__PURE__ */ g("span", { className: v.tick, style: { left: `${c.x}px` }, children: c.x >= be && c.x <= b.width - be && (ae === 1 || Dt(c.wallClock, ae)) && /* @__PURE__ */ g("span", { className: v.tickLabel, "data-schedule-overlay": "time label", children: b.step >= X ? Y.dateShort(new Date(c.wallClock)) : Y.time(new Date(c.wallClock), !1) }) }, c.wallClock))
958
957
  ] }),
959
- /* @__PURE__ */ g(ue, { "aria-live": "polite", children: Q !== null && /* @__PURE__ */ g(
960
- vs,
958
+ /* @__PURE__ */ g(fe, { "aria-live": "polite", children: Z !== null && /* @__PURE__ */ g(
959
+ yn,
961
960
  {
962
- target: Q.target,
963
- lane: Q.lane === null ? null : ((ce = n.data.lanes.find((u) => u.id === Q.lane)) == null ? void 0 : ce.label) ?? Q.lane
961
+ target: Z.target,
962
+ lane: Z.lane === null ? null : ((ue = s.data.lanes.find((c) => c.id === Z.lane)) == null ? void 0 : ue.label) ?? Z.lane
964
963
  },
965
- Q.count
964
+ Z.count
966
965
  ) }),
967
- /* @__PURE__ */ g(ue, { id: qt, children: `${B.scheduleSummary({ ...Mt, from: ae(Mt.from), to: ae(Mt.to) })} ${B.scheduleKeyHelp}` })
966
+ /* @__PURE__ */ g(fe, { id: jt, children: `${B.scheduleSummary({ ...bt, from: le(bt.from), to: le(bt.to) })} ${B.scheduleKeyHelp}` })
968
967
  ]
969
968
  }
970
969
  ),
971
- ut
970
+ ht
972
971
  ] });
973
972
  });
974
- function Is(s) {
973
+ function Tn(n) {
975
974
  try {
976
- return s.matches(":focus-visible");
975
+ return n.matches(":focus-visible");
977
976
  } catch {
978
977
  return !0;
979
978
  }
980
979
  }
981
- function Ss({ id: s, label: t }) {
982
- const e = He(), n = V(() => ({ id: s, label: t ?? s, ...e === null ? {} : { parent: e } }), [s, t, e]);
983
- return Ln(n), null;
980
+ function In({ id: n, label: t }) {
981
+ const e = He(), s = W(() => ({ id: n, label: t ?? n, ...e === null ? {} : { parent: e } }), [n, t, e]);
982
+ return Is(s), null;
984
983
  }
985
- function Ls({ id: s, label: t, children: e }) {
986
- const n = He(), o = V(() => ({ id: s, label: t ?? s, ...n === null ? {} : { parent: n } }), [s, t, n]);
987
- return An(o), /* @__PURE__ */ g(xe.Provider, { value: s, children: e });
984
+ function Sn({ id: n, label: t, children: e }) {
985
+ const s = He(), o = W(() => ({ id: n, label: t ?? n, ...s === null ? {} : { parent: s } }), [n, t, s]);
986
+ return Ss(o), /* @__PURE__ */ g(Ge.Provider, { value: n, children: e });
988
987
  }
989
- function As({ data: s, tasks: t }) {
990
- const e = V(() => ({ kind: "subtasks", data: s, tasks: t }), [s, t]);
991
- return vt("Subtasks", e), null;
988
+ function Ln({ data: n, tasks: t }) {
989
+ const e = W(() => ({ kind: "subtasks", data: n, tasks: t }), [n, t]);
990
+ return yt("Subtasks", e), null;
992
991
  }
993
- function Cs({ data: s }) {
994
- const t = V(() => ({ kind: "dependencies", data: s }), [s]);
995
- return vt("Dependencies", t), null;
992
+ function An({ data: n }) {
993
+ const t = W(() => ({ kind: "dependencies", data: n }), [n]);
994
+ return yt("Dependencies", t), null;
996
995
  }
997
- function Ds({ data: s }) {
998
- const t = V(() => ({ kind: "blocked", data: s }), [s]);
999
- return vt("BlockedTimes", t), null;
996
+ function Cn({ data: n }) {
997
+ const t = W(() => ({ kind: "blocked", data: n }), [n]);
998
+ return yt("BlockedTimes", t), null;
1000
999
  }
1001
- function _s({ data: s }) {
1002
- const t = V(() => ({ kind: "milestones", data: s }), [s]);
1003
- return vt("Milestones", t), null;
1000
+ function Dn({ data: n }) {
1001
+ const t = W(() => ({ kind: "milestones", data: n }), [n]);
1002
+ return yt("Milestones", t), null;
1004
1003
  }
1005
- class Fs {
1004
+ class _n {
1006
1005
  /** `changed` is called after every registration change. */
1007
1006
  constructor(t) {
1008
1007
  f(this, "nextId", 1);
@@ -1013,7 +1012,6 @@ class Fs {
1013
1012
  f(this, "lanes", []);
1014
1013
  /** The groups in registration order. */
1015
1014
  f(this, "groups", []);
1016
- f(this, "laneIndex", /* @__PURE__ */ new Map());
1017
1015
  /** The layers in registration order - the drawing order. */
1018
1016
  f(this, "layers", []);
1019
1017
  f(this, "subtasks", []);
@@ -1068,14 +1066,14 @@ class Fs {
1068
1066
  rebuild() {
1069
1067
  if (!this.dirty) return !1;
1070
1068
  this.dirty = !1;
1071
- const t = (e) => [...e.keys()].sort((n, o) => n - o).map((n) => e.get(n));
1072
- 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.milestones = [], this.tasks = /* @__PURE__ */ new Map();
1069
+ const t = (e) => [...e.keys()].sort((s, o) => s - o).map((s) => e.get(s));
1070
+ this.lanes = t(this.laneEntries), this.groups = t(this.groupEntries), this.layers = t(this.layerEntries), this.subtasks = [], this.dependencies = [], this.blocked = [], this.milestones = [], this.tasks = /* @__PURE__ */ new Map();
1073
1071
  for (const e of this.layers)
1074
1072
  if (e.kind === "subtasks") {
1075
1073
  this.subtasks.push(...e.data);
1076
- for (const n of e.tasks) this.tasks.set(n.id, n);
1074
+ for (const s of e.tasks) this.tasks.set(s.id, s);
1077
1075
  } else e.kind === "dependencies" ? this.dependencies.push(...e.data) : e.kind === "milestones" ? this.milestones.push(...e.data) : this.blocked.push(...e.data);
1078
- return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = zt(this.subtasks), this.violatedById = new Map(Kt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = Tn(this.subtasks), this.inBlocked = $e(this.subtasks, this.blocked), !0;
1076
+ return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = Vt(this.subtasks), this.violatedById = new Map(Wt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = bs(this.subtasks), this.inBlocked = Be(this.subtasks, this.blocked), !0;
1079
1077
  }
1080
1078
  /** The task a dependency belongs to: its departing subtask's. */
1081
1079
  taskOfDependency(t) {
@@ -1091,18 +1089,71 @@ class Fs {
1091
1089
  }
1092
1090
  if (t.kind === "milestone") return { kind: "milestone", milestone: t.milestone };
1093
1091
  if (t.kind !== "dependency") return null;
1094
- const e = t.dependency, n = this.taskOfDependency(e);
1092
+ const e = t.dependency, s = this.taskOfDependency(e);
1095
1093
  return {
1096
1094
  kind: "dependency",
1097
1095
  dependency: e,
1098
- task: n !== null ? this.tasks.get(n) : void 0,
1096
+ task: s !== null ? this.tasks.get(s) : void 0,
1099
1097
  from: this.subtaskById.get(e.from),
1100
1098
  to: this.subtaskById.get(e.to),
1101
1099
  violated: this.violatedById.get(e.id)
1102
1100
  };
1103
1101
  }
1104
1102
  }
1105
- const Os = {
1103
+ const Fn = 6;
1104
+ function Xe(n, t, e, s, o, i) {
1105
+ n.save(), n.beginPath(), n.rect(t, e, s, o), n.clip(), n.globalAlpha = 0.35, n.strokeStyle = i, n.lineWidth = 1, n.beginPath();
1106
+ for (let r = t - o; r < t + s + o; r += Fn)
1107
+ n.moveTo(r, e + o), n.lineTo(r + o, e);
1108
+ n.stroke(), n.restore();
1109
+ }
1110
+ function On(n, t, e, s) {
1111
+ if (s.size === 0) return;
1112
+ const { width: o, height: i } = t.view;
1113
+ for (const r of s) {
1114
+ const a = j(e, r);
1115
+ if (a === null) continue;
1116
+ const { top: l, height: h } = a;
1117
+ l + h < 0 || l > i || (n.globalAlpha = 0.6, n.fillStyle = t.colours.surface, n.fillRect(0, l, o, h), n.globalAlpha = 1, Xe(n, 0, l, o, h, t.colours.muted));
1118
+ }
1119
+ }
1120
+ function En(n, t, e) {
1121
+ const { data: s } = t;
1122
+ if (s.violatedById.size !== 0)
1123
+ for (const o of s.violatedById.values()) {
1124
+ const i = s.dependencies.find((u) => u.id === o.dependency), r = i === void 0 ? void 0 : s.subtaskById.get(i.to);
1125
+ if (r === void 0) continue;
1126
+ const a = j(e, r.lane);
1127
+ if (a === null || !a.miniature) continue;
1128
+ const l = tt(e.rows, a.top + e.scrollY);
1129
+ if (l === null) continue;
1130
+ const h = R(e, o.arrival), d = Math.max(h + 2, R(e, o.arrival + o.shortBy));
1131
+ Rt(n, t, h, d, l.top - e.scrollY + 1, 3);
1132
+ }
1133
+ }
1134
+ function Rt(n, t, e, s, o, i) {
1135
+ if (!t.colours.forced) {
1136
+ n.fillStyle = t.colours.alarm, n.fillRect(e, o, s - e, i);
1137
+ return;
1138
+ }
1139
+ n.strokeStyle = t.colours.alarm, n.lineWidth = i, n.setLineDash([4, 3]), n.beginPath(), n.moveTo(e, o + i / 2), n.lineTo(s, o + i / 2), n.stroke(), n.setLineDash([]);
1140
+ }
1141
+ function Nn(n, t, e, s) {
1142
+ const o = j(e, s.lane);
1143
+ if (o === null || o.top + o.height < 0 || o.top > t.view.height) return;
1144
+ const i = Math.max(0, R(e, s.from)), r = Math.min(t.view.width, R(e, s.to));
1145
+ r <= i || (n.globalAlpha = 0.1, n.fillStyle = t.colours.muted, n.fillRect(i, o.top, r - i, o.height), n.globalAlpha = 1, Xe(n, i, o.top, r - i, o.height, t.colours.muted));
1146
+ }
1147
+ function Pt(n, t, e, s) {
1148
+ const o = j(e, s.lane);
1149
+ if (o === null) return;
1150
+ const i = R(e, s.from), r = Math.max(i + 2, R(e, s.to));
1151
+ if (n.fillStyle = t.colours.alarm, n.globalAlpha = 0.14, n.fillRect(i, o.top + 1, r - i, Math.max(1, o.height - 2)), n.globalAlpha = 1, Rt(n, t, i, r, o.top + 1, Math.min(3, Math.max(1, o.height - 1))), o.miniature) {
1152
+ const a = tt(e.rows, o.top + e.scrollY);
1153
+ a !== null && Rt(n, t, i, r, a.top - e.scrollY + 1, 3);
1154
+ }
1155
+ }
1156
+ const Rn = {
1106
1157
  line: "var(--u-hairline)",
1107
1158
  lineStrong: "var(--u-hairline-strong)",
1108
1159
  text: "var(--u-color-text)",
@@ -1116,7 +1167,7 @@ const Os = {
1116
1167
  /* What text and marks take ON a filled bar - the same token the bar labels
1117
1168
  use in CSS, so a cap and the label beside it are one colour. */
1118
1169
  onAccent: "var(--u-color-on-accent)"
1119
- }, Ue = {
1170
+ }, qe = {
1120
1171
  line: "GrayText",
1121
1172
  lineStrong: "CanvasText",
1122
1173
  text: "CanvasText",
@@ -1126,11 +1177,11 @@ const Os = {
1126
1177
  active: "Highlight",
1127
1178
  now: "GrayText",
1128
1179
  onAccent: "Canvas"
1129
- }, Es = (s) => s ? Ue : Os, Ns = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
1130
- function Rs(s, t) {
1131
- const e = Ns(), n = {};
1132
- for (const r of t.tasks.values()) n[`task:${r.id}`] = e ? Ue.text : r.color;
1133
- const o = pn(s, { ...Es(e), ...n }), i = /* @__PURE__ */ new Map();
1180
+ }, Pn = (n) => n ? qe : Rn, $n = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
1181
+ function Bn(n, t) {
1182
+ const e = $n(), s = {};
1183
+ for (const r of t.tasks.values()) s[`task:${r.id}`] = e ? qe.text : r.color;
1184
+ const o = ms(n, { ...Pn(e), ...s }), i = /* @__PURE__ */ new Map();
1134
1185
  for (const r of t.tasks.values()) i.set(r.id, o[`task:${r.id}`] ?? r.color);
1135
1186
  return {
1136
1187
  line: o.line,
@@ -1146,329 +1197,277 @@ function Rs(s, t) {
1146
1197
  forced: e
1147
1198
  };
1148
1199
  }
1149
- function ht(s) {
1150
- const t = s.match(/[\d.]+/g);
1200
+ function lt(n) {
1201
+ const t = n.match(/[\d.]+/g);
1151
1202
  return t === null || t.length < 3 ? null : [Number(t[0]), Number(t[1]), Number(t[2])];
1152
1203
  }
1153
- function be(s) {
1154
- const t = ht(s);
1155
- return t === null ? 0 : qe(Xe(t));
1204
+ function Me(n) {
1205
+ const t = lt(n);
1206
+ return t === null ? 0 : Je(je(t));
1156
1207
  }
1157
- function Xe(s) {
1158
- return s.map((t) => {
1208
+ function je(n) {
1209
+ return n.map((t) => {
1159
1210
  const e = t / 255;
1160
1211
  return e <= 0.04045 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
1161
1212
  });
1162
1213
  }
1163
- function qe([s, t, e]) {
1164
- return 0.2126 * s + 0.7152 * t + 0.0722 * e;
1165
- }
1166
- function Me(s, t) {
1167
- const e = be(s), n = be(t);
1168
- return (Math.max(e, n) + 0.05) / (Math.min(e, n) + 0.05);
1169
- }
1170
- function Te(s, t, e) {
1171
- if (s === null) return null;
1172
- const n = typeof window > "u" ? 1 : window.devicePixelRatio || 1, o = Math.round(t * n), i = Math.round(e * n);
1173
- s.width !== o && (s.width = o), s.height !== i && (s.height = i);
1174
- const r = s.getContext("2d");
1175
- return r === null ? null : (r.setTransform(n, 0, 0, n, 0, 0), r.clearRect(0, 0, t, e), r);
1176
- }
1177
- function Ps(s, t) {
1178
- const { data: e, view: n } = t, o = n.viewport();
1179
- Hs(s, t, o);
1180
- for (const i of e.blocked) Xs(s, t, o, i);
1181
- Gs(s, t);
1214
+ function Je([n, t, e]) {
1215
+ return 0.2126 * n + 0.7152 * t + 0.0722 * e;
1216
+ }
1217
+ function Te(n, t) {
1218
+ const e = Me(n), s = Me(t);
1219
+ return (Math.max(e, s) + 0.05) / (Math.min(e, s) + 0.05);
1220
+ }
1221
+ function Ie(n, t, e) {
1222
+ if (n === null) return null;
1223
+ const s = typeof window > "u" ? 1 : window.devicePixelRatio || 1, o = Math.round(t * s), i = Math.round(e * s);
1224
+ n.width !== o && (n.width = o), n.height !== i && (n.height = i);
1225
+ const r = n.getContext("2d");
1226
+ return r === null ? null : (r.setTransform(s, 0, 0, s, 0, 0), r.clearRect(0, 0, t, e), r);
1227
+ }
1228
+ function xn(n, t) {
1229
+ const { data: e, view: s } = t, o = s.viewport();
1230
+ Yn(n, t, o);
1231
+ for (const i of e.blocked) Nn(n, t, o, i);
1232
+ Kn(n, t);
1182
1233
  for (const i of e.layers) {
1183
1234
  if (i.kind === "blocked" || i.kind === "milestones") continue;
1184
1235
  const r = new Set(i.data);
1185
1236
  if (i.kind === "dependencies")
1186
- for (const a of n.paths) r.has(a.dependency) && Rt(s, t, a, !1);
1237
+ for (const a of s.paths) r.has(a.dependency) && $t(n, t, a, !1);
1187
1238
  else
1188
- for (const a of n.boxes) r.has(a.subtask) && Je(s, t, a, 1);
1239
+ for (const a of s.boxes) r.has(a.subtask) && Qe(n, t, a, 1);
1189
1240
  }
1190
- for (const i of e.overlaps) $t(s, t, o, i);
1191
- for (const i of e.inBlocked) $t(s, t, o, i);
1192
- Us(s, t, o);
1193
- for (const i of e.milestones) tn(s, t, o, i, !1);
1194
- Js(s, t);
1241
+ for (const i of e.overlaps) Pt(n, t, o, i);
1242
+ for (const i of e.inBlocked) Pt(n, t, o, i);
1243
+ En(n, t, o);
1244
+ for (const i of e.milestones) ts(n, t, o, i, !1);
1245
+ Jn(n, t);
1195
1246
  }
1196
- function $s(s, t) {
1197
- const { view: e, hover: n } = t, o = e.viewport();
1247
+ function Gn(n, t) {
1248
+ const { view: e, hover: s } = t, o = e.viewport();
1198
1249
  if (t.ghost === null) {
1199
- if (n.kind === "subtask") {
1200
- const c = e.boxById.get(n.subtask.id);
1201
- c !== void 0 && qs(s, t, c);
1202
- } else if (n.kind === "dependency") {
1203
- const c = e.paths.find((m) => m.dependency === n.dependency);
1204
- c !== void 0 && Rt(s, t, c, !0);
1205
- } else n.kind === "milestone" && tn(s, t, o, n.milestone, !0);
1250
+ if (s.kind === "subtask") {
1251
+ const u = e.boxById.get(s.subtask.id);
1252
+ u !== void 0 && qn(n, t, u);
1253
+ } else if (s.kind === "dependency") {
1254
+ const u = e.paths.find((m) => m.dependency === s.dependency);
1255
+ u !== void 0 && $t(n, t, u, !0);
1256
+ } else s.kind === "milestone" && ts(n, t, o, s.milestone, !0);
1206
1257
  return;
1207
1258
  }
1208
1259
  const i = t.ghost, { ghost: r, overlaps: a, violated: l } = i;
1209
- Bs(s, t, o, i.refusedLanes);
1210
- const h = je(o, r);
1260
+ On(n, t, o, i.refusedLanes);
1261
+ const h = Ze(o, r);
1211
1262
  if (h === null) return;
1212
- for (const c of a) $t(s, t, o, c);
1213
- const d = new Set(l.map((c) => c.dependency));
1214
- for (const c of t.data.dependencies) {
1215
- if (c.from !== r.id && c.to !== r.id) continue;
1216
- const m = e.boxById.get(c.from === r.id ? c.to : c.from);
1263
+ for (const u of a) Pt(n, t, o, u);
1264
+ const d = new Set(l.map((u) => u.dependency));
1265
+ for (const u of t.data.dependencies) {
1266
+ if (u.from !== r.id && u.to !== r.id) continue;
1267
+ const m = e.boxById.get(u.from === r.id ? u.to : u.from);
1217
1268
  if (m === void 0) continue;
1218
- const p = c.from === r.id ? Nt(o, c, h, m, e.options) : Nt(o, c, m, h, e.options);
1219
- Rt(s, t, p, !0, d.has(c.id));
1220
- }
1221
- Je(s, { ...t, selectedTask: null }, h, 0.55), s.strokeStyle = t.colours.text, s.lineWidth = 1, s.setLineDash([3, 2]), s.strokeRect(h.outerFrom + 0.5, h.y + 0.5, Math.max(1, h.outerTo - h.outerFrom - 1), h.height - 1), s.setLineDash([]), i.tether !== null && xs(s, t, h, i.tether);
1222
- }
1223
- function Bs(s, t, e, n) {
1224
- if (n.size === 0) return;
1225
- const { width: o, height: i } = t.view;
1226
- for (const r of n) {
1227
- const a = J(e, r);
1228
- if (a === null) continue;
1229
- const { top: l, height: h } = a;
1230
- l + h < 0 || l > i || (s.globalAlpha = 0.6, s.fillStyle = t.colours.surface, s.fillRect(0, l, o, h), s.globalAlpha = 1, Qe(s, 0, l, o, h, t.colours.muted, 0.7, Ze, 1));
1269
+ const p = u.from === r.id ? Et(o, u, h, m, e.options) : Et(o, u, m, h, e.options);
1270
+ $t(n, t, p, !0, d.has(u.id));
1231
1271
  }
1272
+ Qe(n, { ...t, selectedTask: null }, h, 0.55), n.strokeStyle = t.colours.text, n.lineWidth = 1, n.setLineDash([3, 2]), n.strokeRect(h.outerFrom + 0.5, h.y + 0.5, Math.max(1, h.outerTo - h.outerFrom - 1), h.height - 1), n.setLineDash([]), i.tether !== null && Hn(n, t, h, i.tether);
1232
1273
  }
1233
- function xs(s, t, e, n) {
1234
- const o = Math.max(e.outerFrom, Math.min(e.outerTo, n.x)), i = Math.max(e.y, Math.min(e.y + e.height, n.y));
1235
- Math.hypot(n.x - o, n.y - i) < 2 || (s.strokeStyle = t.colours.text, s.lineWidth = 1, s.setLineDash([2, 3]), s.beginPath(), s.moveTo(o + 0.5, i + 0.5), s.lineTo(n.x + 0.5, n.y + 0.5), s.stroke(), s.setLineDash([]));
1274
+ function Hn(n, t, e, s) {
1275
+ const o = Math.max(e.outerFrom, Math.min(e.outerTo, s.x)), i = Math.max(e.y, Math.min(e.y + e.height, s.y));
1276
+ Math.hypot(s.x - o, s.y - i) < 2 || (n.strokeStyle = t.colours.text, n.lineWidth = 1, n.setLineDash([2, 3]), n.beginPath(), n.moveTo(o + 0.5, i + 0.5), n.lineTo(s.x + 0.5, s.y + 0.5), n.stroke(), n.setLineDash([]));
1236
1277
  }
1237
- function je(s, t) {
1238
- const e = Wt(s.rows, t.lane);
1239
- return e === null ? null : Ye(s, t, t.lane, e, 0);
1278
+ function Ze(n, t) {
1279
+ const e = zt(n.rows, t.lane);
1280
+ return e === null ? null : Ke(n, t, e, 0);
1240
1281
  }
1241
- function Hs(s, t, e) {
1242
- const { view: n, colours: o, bands: i } = t, { width: r, height: a } = n;
1243
- s.lineWidth = 1, s.strokeStyle = o.line, s.beginPath();
1282
+ function Yn(n, t, e) {
1283
+ const { view: s, colours: o, bands: i } = t, { width: r, height: a } = s;
1284
+ n.lineWidth = 1, n.strokeStyle = o.line, n.beginPath();
1244
1285
  for (const d of i.ticks)
1245
- s.moveTo(d.x + 0.5, 0), s.lineTo(d.x + 0.5, a);
1286
+ n.moveTo(d.x + 0.5, 0), n.lineTo(d.x + 0.5, a);
1246
1287
  for (const d of e.rows.rows) {
1247
- const c = d.top + d.height - e.scrollY - 0.5;
1248
- c < 0 || c > a || (s.moveTo(0, c), s.lineTo(r, c));
1288
+ const u = d.top + d.height - e.scrollY - 0.5;
1289
+ u < 0 || u > a || (n.moveTo(0, u), n.lineTo(r, u));
1249
1290
  }
1250
- const l = [...e.rows.slots.values()].filter((d) => d.miniature).sort((d, c) => d.top - c.top);
1251
- l.forEach((d, c) => {
1252
- const m = l[c + 1];
1291
+ const l = [...e.rows.slots.values()].filter((d) => d.miniature).sort((d, u) => d.top - u.top);
1292
+ l.forEach((d, u) => {
1293
+ const m = l[u + 1];
1253
1294
  if (m === void 0 || m.top !== d.top + d.height || m.group === d.group) return;
1254
1295
  const p = d.top + d.height - e.scrollY - 0.5;
1255
- p < 0 || p > a || (s.moveTo(0, p), s.lineTo(r, p));
1256
- }), s.stroke(), s.strokeStyle = o.lineStrong, s.beginPath();
1296
+ p < 0 || p > a || (n.moveTo(0, p), n.lineTo(r, p));
1297
+ }), n.stroke(), n.strokeStyle = o.lineStrong, n.beginPath();
1257
1298
  for (const d of i.days)
1258
- s.moveTo(d.x + 0.5, 0), s.lineTo(d.x + 0.5, a);
1259
- s.stroke();
1260
- const h = gn(n.options.calendar);
1299
+ n.moveTo(d.x + 0.5, 0), n.lineTo(d.x + 0.5, a);
1300
+ n.stroke();
1301
+ const h = ps(s.options.calendar);
1261
1302
  if (h.length > 0) {
1262
- s.strokeStyle = o.muted, s.setLineDash([2, 3]), s.beginPath();
1303
+ n.strokeStyle = o.muted, n.setLineDash([2, 3]), n.beginPath();
1263
1304
  for (const d of h) {
1264
- const c = Math.round(e.scale.toPx(d.workingTime)) + 0.5;
1265
- c < 0 || c > r || (s.moveTo(c, 0), s.lineTo(c, a));
1305
+ const u = Math.round(e.scale.toPx(d.workingTime)) + 0.5;
1306
+ u < 0 || u > r || (n.moveTo(u, 0), n.lineTo(u, a));
1266
1307
  }
1267
- s.stroke(), s.setLineDash([]);
1308
+ n.stroke(), n.setLineDash([]);
1268
1309
  }
1269
1310
  }
1270
- function Gs(s, t) {
1311
+ function Kn(n, t) {
1271
1312
  const e = t.view.nowX();
1272
- e !== null && (s.fillStyle = t.colours.now, s.fillRect(e, 0, 2, t.view.height));
1313
+ e !== null && (n.fillStyle = t.colours.now, n.fillRect(e, 0, 2, t.view.height));
1273
1314
  }
1274
- function Ys(s, t, e, n) {
1275
- const o = ct(t.colours, t, e.subtask.task, e.subtask.id);
1276
- s.fillStyle = o;
1315
+ function Vn(n, t, e, s) {
1316
+ const o = dt(t.colours, t, e.subtask.task, e.subtask.id);
1317
+ n.fillStyle = o;
1277
1318
  for (const [i, r] of [
1278
1319
  [e.outerFrom, e.mainFrom],
1279
1320
  [e.mainTo, e.outerTo]
1280
1321
  ])
1281
- r <= i || (s.globalAlpha = 0.28 * n, s.fillRect(i, e.y, r - i, e.height));
1282
- s.globalAlpha = n, s.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), s.globalAlpha = 1;
1283
- }
1284
- function Xt(s, t, e) {
1285
- if (s.dashed) return { fill: null, onDark: !1 };
1286
- const n = s.muted ? zs(t, e.surface, 0.5) : t;
1287
- return { fill: n, onDark: Me(n, e.onAccent) > Me(n, e.text) };
1288
- }
1289
- function zs(s, t, e) {
1290
- const n = ht(s), o = ht(t);
1291
- if (n === null || o === null) return s;
1292
- const i = (r) => Math.round(n[r] + (o[r] - n[r]) * e);
1322
+ r <= i || (n.globalAlpha = 0.28 * s, n.fillRect(i, e.y, r - i, e.height));
1323
+ n.globalAlpha = s, n.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), n.globalAlpha = 1;
1324
+ }
1325
+ function qt(n, t, e) {
1326
+ if (n.dashed) return { fill: null, onDark: !1 };
1327
+ const s = n.muted ? Wn(t, e.surface, 0.5) : t;
1328
+ return { fill: s, onDark: Te(s, e.onAccent) > Te(s, e.text) };
1329
+ }
1330
+ function Wn(n, t, e) {
1331
+ const s = lt(n), o = lt(t);
1332
+ if (s === null || o === null) return n;
1333
+ const i = (r) => Math.round(s[r] + (o[r] - s[r]) * e);
1293
1334
  return `rgb(${i(0)}, ${i(1)}, ${i(2)})`;
1294
1335
  }
1295
- function Ie(s, t) {
1296
- const e = ht(s);
1297
- if (e === null || t === 0) return s;
1298
- const n = Xe(e), o = qe(n), [i, r, a] = n.map((l) => {
1336
+ function Se(n, t) {
1337
+ const e = lt(n);
1338
+ if (e === null || t === 0) return n;
1339
+ const s = je(e), o = Je(s), [i, r, a] = s.map((l) => {
1299
1340
  const h = l + (o - l) * t, d = h <= 31308e-7 ? h * 12.92 : 1.055 * h ** (1 / 2.4) - 0.055;
1300
1341
  return Math.round(Math.min(1, Math.max(0, d)) * 255);
1301
1342
  });
1302
1343
  return `rgb(${i}, ${r}, ${a})`;
1303
1344
  }
1304
- function ct(s, t, e, n) {
1305
- const o = (e === null ? void 0 : s.tasks.get(e)) ?? s.muted;
1306
- return t.selectedTask === null ? o : e !== t.selectedTask ? s.forced ? s.muted : Ie(o, 1) : s.forced || t.selectedSubtask === null || n === null || n === t.selectedSubtask ? o : Ie(o, 0.5);
1345
+ function dt(n, t, e, s) {
1346
+ const o = (e === null ? void 0 : n.tasks.get(e)) ?? n.muted;
1347
+ return t.selectedTask === null ? o : e !== t.selectedTask ? n.forced ? n.muted : Se(o, 1) : n.forced || t.selectedSubtask === null || s === null || s === t.selectedSubtask ? o : Se(o, 0.5);
1307
1348
  }
1308
- const Ks = 2;
1309
- function Je(s, t, e, n) {
1349
+ const Un = 2;
1350
+ function Qe(n, t, e, s) {
1310
1351
  const { view: o, colours: i } = t;
1311
- if (!Et(e, o.width, o.height)) return;
1352
+ if (!Ot(e, o.width, o.height)) return;
1312
1353
  if (e.miniature) {
1313
- Ys(s, t, e, n);
1354
+ Vn(n, t, e, s);
1314
1355
  return;
1315
1356
  }
1316
- const r = yt(e.subtask.appearance), a = ct(i, t, e.subtask.task, e.subtask.id), l = Xt(r, a, i), h = e.y, d = e.height, c = Math.max(1, e.mainTo - e.mainFrom), m = l.onDark ? i.onAccent : i.text;
1317
- s.lineWidth = 1, s.fillStyle = a, s.strokeStyle = a;
1357
+ const r = kt(e.subtask.appearance), a = dt(i, t, e.subtask.task, e.subtask.id), l = qt(r, a, i), h = e.y, d = e.height, u = Math.max(1, e.mainTo - e.mainFrom), m = l.onDark ? i.onAccent : i.text;
1358
+ n.lineWidth = 1, n.fillStyle = a, n.strokeStyle = a;
1318
1359
  for (const [y, I] of [
1319
1360
  [e.outerFrom, e.mainFrom],
1320
1361
  [e.mainTo, e.outerTo]
1321
1362
  ])
1322
- I <= y || (s.globalAlpha = 0.28 * n, s.fillRect(y, h, I - y, d), s.globalAlpha = n, s.strokeRect(y + 0.5, h + 0.5, I - y - 1, d - 1));
1323
- l.fill !== null && (s.globalAlpha = n, s.fillStyle = l.fill, s.fillRect(e.mainFrom, h, c, d));
1363
+ I <= y || (n.globalAlpha = 0.28 * s, n.fillRect(y, h, I - y, d), n.globalAlpha = s, n.strokeRect(y + 0.5, h + 0.5, I - y - 1, d - 1));
1364
+ l.fill !== null && (n.globalAlpha = s, n.fillStyle = l.fill, n.fillRect(e.mainFrom, h, u, d));
1324
1365
  const p = e.subtask.progress;
1325
1366
  if (p !== void 0) {
1326
- const y = Math.min(4, Math.max(2, Math.round(d / 6))), I = h + d - y - Ks, A = Math.round(c * Math.max(0, Math.min(1, p)));
1327
- s.fillStyle = l.fill === null ? a : m, s.globalAlpha = 0.3 * n, s.fillRect(e.mainFrom, I, c, y), s.globalAlpha = n, A > 0 && s.fillRect(e.mainFrom, I, A, y);
1367
+ const y = Math.min(4, Math.max(2, Math.round(d / 6))), I = h + d - y - Un, A = Math.round(u * Math.max(0, Math.min(1, p)));
1368
+ n.fillStyle = l.fill === null ? a : m, n.globalAlpha = 0.3 * s, n.fillRect(e.mainFrom, I, u, y), n.globalAlpha = s, A > 0 && n.fillRect(e.mainFrom, I, A, y);
1328
1369
  }
1329
1370
  if (r.hatched) {
1330
- const y = Math.max(1, Math.min(Ge, Math.floor((c - 2 * at) / 3))), I = c >= 4 * y ? at : 0, A = d >= 4 * at ? at : 0;
1331
- s.globalAlpha = n, s.fillStyle = m, s.fillRect(e.mainFrom + I, h + A, y, d - 2 * A), s.fillRect(e.mainTo - I - y, h + A, y, d - 2 * A);
1332
- }
1333
- r.open && Ws(s, e, h, d, i.surface, o.width), r.dashed && (s.globalAlpha = n, s.strokeStyle = a, s.setLineDash([4, 3]), s.strokeRect(e.mainFrom + 0.5, h + 0.5, c - 1, d - 1), s.setLineDash([])), s.globalAlpha = 1, e.depth > 0 && n === 1 && (s.strokeStyle = i.surface, s.strokeRect(e.outerFrom - 0.5, h - 0.5, e.outerTo - e.outerFrom + 1, d + 1));
1334
- }
1335
- const Ze = 6, Vs = 16;
1336
- function Qe(s, t, e, n, o, i, r, a, l) {
1337
- s.save(), s.beginPath(), s.rect(t, e, n, o), s.clip(), s.globalAlpha = 0.5 * r, s.strokeStyle = i, s.lineWidth = l, s.beginPath();
1338
- for (let h = t - o; h < t + n + o; h += a)
1339
- s.moveTo(h, e + o), s.lineTo(h + o, e);
1340
- s.stroke(), s.restore();
1341
- }
1342
- function Ws(s, t, e, n, o, i) {
1343
- 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(Vs, l);
1344
- r && Se(s, 0, h, e, n, o, 1), a && Se(s, i, -h, e, n, o, 1);
1345
- }
1346
- function Se(s, t, e, n, o, i, r) {
1347
- const a = s.createLinearGradient(t, 0, t + e, 0);
1348
- a.addColorStop(0, Le(i, r)), a.addColorStop(1, Le(i, 0)), s.globalAlpha = 1, s.fillStyle = a, s.fillRect(Math.min(t, t + e), n, Math.abs(e), o);
1349
- }
1350
- function Le(s, t) {
1351
- const e = ht(s);
1352
- return e === null ? s : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
1353
- }
1354
- function Rt(s, t, e, n, o) {
1355
- const { data: i, colours: r } = t, a = i.taskOfDependency(e.dependency), l = o ?? i.violatedById.has(e.dependency.id), h = a !== null && a === t.selectedTask, d = l ? r.alarm : ct(r, t, a, null);
1356
- if (s.strokeStyle = d, s.fillStyle = d, s.lineWidth = n || h ? 2 : 1.25, s.setLineDash(l ? [4, 3] : []), s.beginPath(), s.moveTo(e.x1, e.y1), e.kind === "curve")
1357
- s.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
1371
+ const y = Math.max(1, Math.min(Ye, Math.floor((u - 2 * nt) / 3))), I = u >= 4 * y ? nt : 0, A = d >= 4 * nt ? nt : 0;
1372
+ n.globalAlpha = s, n.fillStyle = m, n.fillRect(e.mainFrom + I, h + A, y, d - 2 * A), n.fillRect(e.mainTo - I - y, h + A, y, d - 2 * A);
1373
+ }
1374
+ r.open && Xn(n, e, h, d, i.surface, o.width), r.dashed && (n.globalAlpha = s, n.strokeStyle = a, n.setLineDash([4, 3]), n.strokeRect(e.mainFrom + 0.5, h + 0.5, u - 1, d - 1), n.setLineDash([])), n.globalAlpha = 1, e.depth > 0 && s === 1 && (n.strokeStyle = i.surface, n.strokeRect(e.outerFrom - 0.5, h - 0.5, e.outerTo - e.outerFrom + 1, d + 1));
1375
+ }
1376
+ const zn = 16;
1377
+ function Xn(n, t, e, s, o, i) {
1378
+ 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(zn, l);
1379
+ r && Le(n, 0, h, e, s, o), a && Le(n, i, -h, e, s, o);
1380
+ }
1381
+ function Le(n, t, e, s, o, i) {
1382
+ const r = n.createLinearGradient(t, 0, t + e, 0);
1383
+ r.addColorStop(0, Ae(i, 1)), r.addColorStop(1, Ae(i, 0)), n.globalAlpha = 1, n.fillStyle = r, n.fillRect(Math.min(t, t + e), s, Math.abs(e), o);
1384
+ }
1385
+ function Ae(n, t) {
1386
+ const e = lt(n);
1387
+ return e === null ? n : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
1388
+ }
1389
+ function $t(n, t, e, s, o) {
1390
+ const { data: i, colours: r } = t, a = i.taskOfDependency(e.dependency), l = o ?? i.violatedById.has(e.dependency.id), h = a !== null && a === t.selectedTask, d = l ? r.alarm : dt(r, t, a, null);
1391
+ if (n.strokeStyle = d, n.fillStyle = d, n.lineWidth = s || h ? 2 : 1.25, n.setLineDash(l ? [4, 3] : []), n.beginPath(), n.moveTo(e.x1, e.y1), e.kind === "curve")
1392
+ n.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
1358
1393
  else
1359
- for (let c = 2; c + 1 < e.points.length; c += 2) s.lineTo(e.points[c], e.points[c + 1]);
1360
- if (s.stroke(), s.setLineDash([]), e.ends === "dot")
1361
- for (const [c, m] of [
1394
+ for (let u = 2; u + 1 < e.points.length; u += 2) n.lineTo(e.points[u], e.points[u + 1]);
1395
+ if (n.stroke(), n.setLineDash([]), e.ends === "dot")
1396
+ for (const [u, m] of [
1362
1397
  [e.x1, e.y1],
1363
1398
  [e.x2, e.y2]
1364
1399
  ])
1365
- s.beginPath(), s.arc(c, m, l ? 3 : 2.5, 0, Math.PI * 2), s.fill();
1400
+ n.beginPath(), n.arc(u, m, l ? 3 : 2.5, 0, Math.PI * 2), n.fill();
1366
1401
  }
1367
- function Us(s, t, e) {
1368
- const { data: n } = t;
1369
- if (n.violatedById.size !== 0)
1370
- for (const o of n.violatedById.values()) {
1371
- const i = n.dependencies.find((c) => c.id === o.dependency), r = i === void 0 ? void 0 : n.subtaskById.get(i.to);
1372
- if (r === void 0) continue;
1373
- const a = J(e, r.lane);
1374
- if (a === null || !a.miniature) continue;
1375
- const l = st(e.rows, a.top + e.scrollY);
1376
- if (l === null) continue;
1377
- const h = R(e, o.arrival), d = Math.max(h + 2, R(e, o.arrival + o.shortBy));
1378
- Pt(s, t, h, d, l.top - e.scrollY + 1, 3);
1379
- }
1380
- }
1381
- function Pt(s, t, e, n, o, i) {
1382
- if (!t.colours.forced) {
1383
- s.fillStyle = t.colours.alarm, s.fillRect(e, o, n - e, i);
1384
- return;
1385
- }
1386
- s.strokeStyle = t.colours.alarm, s.lineWidth = i, s.setLineDash([4, 3]), s.beginPath(), s.moveTo(e, o + i / 2), s.lineTo(n, o + i / 2), s.stroke(), s.setLineDash([]);
1387
- }
1388
- function Xs(s, t, e, n) {
1389
- const o = J(e, n.lane);
1390
- if (o === null || o.top + o.height < 0 || o.top > t.view.height) return;
1391
- const i = Math.max(0, R(e, n.from)), r = Math.min(t.view.width, R(e, n.to));
1392
- r <= i || (s.globalAlpha = 0.1, s.fillStyle = t.colours.muted, s.fillRect(i, o.top, r - i, o.height), s.globalAlpha = 1, Qe(s, i, o.top, r - i, o.height, t.colours.muted, 0.7, Ze, 1));
1393
- }
1394
- function tn(s, t, e, n, o) {
1395
- const i = Ut(e, n);
1402
+ function ts(n, t, e, s, o) {
1403
+ const i = Xt(e, s);
1396
1404
  if (i === null || i.x < -i.half || i.x > t.view.width + i.half) return;
1397
1405
  const r = (a) => {
1398
- s.beginPath(), s.moveTo(i.x, i.y - a), s.lineTo(i.x + a, i.y), s.lineTo(i.x, i.y + a), s.lineTo(i.x - a, i.y), s.closePath();
1406
+ n.beginPath(), n.moveTo(i.x, i.y - a), n.lineTo(i.x + a, i.y), n.lineTo(i.x, i.y + a), n.lineTo(i.x - a, i.y), n.closePath();
1399
1407
  };
1400
- o && (r(i.half + 3), s.fillStyle = t.colours.active, s.fill()), r(i.half + 1), s.fillStyle = t.colours.surface, s.fill(), r(i.half), s.fillStyle = t.colours.text, s.fill();
1401
- }
1402
- function $t(s, t, e, n) {
1403
- const o = J(e, n.lane);
1404
- if (o === null) return;
1405
- const i = R(e, n.from), r = Math.max(i + 2, R(e, n.to));
1406
- if (s.fillStyle = t.colours.alarm, s.globalAlpha = 0.14, s.fillRect(i, o.top + 1, r - i, Math.max(1, o.height - 2)), s.globalAlpha = 1, Pt(s, t, i, r, o.top + 1, Math.min(3, Math.max(1, o.height - 1))), o.miniature) {
1407
- const a = st(e.rows, o.top + e.scrollY);
1408
- a !== null && Pt(s, t, i, r, a.top - e.scrollY + 1, 3);
1409
- }
1408
+ o && (r(i.half + 3), n.fillStyle = t.colours.active, n.fill()), r(i.half + 1), n.fillStyle = t.colours.surface, n.fill(), r(i.half), n.fillStyle = t.colours.text, n.fill();
1410
1409
  }
1411
- function qs(s, t, e) {
1412
- const { colours: n } = t, o = yt(e.subtask.appearance), i = Xt(o, ct(n, t, e.subtask.task, e.subtask.id), n);
1413
- if (n.forced) {
1414
- s.strokeStyle = n.active, s.lineWidth = 2, s.strokeRect(e.outerFrom - 2, e.y - 2, Math.max(1, e.outerTo - e.outerFrom) + 4, e.height + 4);
1410
+ function qn(n, t, e) {
1411
+ const { colours: s } = t, o = kt(e.subtask.appearance), i = qt(o, dt(s, t, e.subtask.task, e.subtask.id), s);
1412
+ if (s.forced) {
1413
+ n.strokeStyle = s.active, n.lineWidth = 2, n.strokeRect(e.outerFrom - 2, e.y - 2, Math.max(1, e.outerTo - e.outerFrom) + 4, e.height + 4);
1415
1414
  return;
1416
1415
  }
1417
- s.globalAlpha = js, s.fillStyle = i.onDark ? n.onAccent : n.text, s.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), s.globalAlpha = 1;
1416
+ n.globalAlpha = jn, n.fillStyle = i.onDark ? s.onAccent : s.text, n.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), n.globalAlpha = 1;
1418
1417
  }
1419
- const js = 0.2;
1420
- function Js(s, t) {
1418
+ const jn = 0.2;
1419
+ function Jn(n, t) {
1421
1420
  const e = t.selectedTask;
1422
1421
  if (e !== null) {
1423
- s.strokeStyle = t.colours.text;
1424
- for (const n of t.view.boxes) {
1425
- if (n.subtask.task !== e) continue;
1426
- const o = n.subtask.id === t.selectedSubtask;
1427
- s.lineWidth = o ? 2 : 1;
1422
+ n.strokeStyle = t.colours.text;
1423
+ for (const s of t.view.boxes) {
1424
+ if (s.subtask.task !== e) continue;
1425
+ const o = s.subtask.id === t.selectedSubtask;
1426
+ n.lineWidth = o ? 2 : 1;
1428
1427
  const i = o ? 1 : 0.5;
1429
- s.strokeRect(n.outerFrom - i, n.y - i, n.outerTo - n.outerFrom + 2 * i, n.height + 2 * i);
1428
+ n.strokeRect(s.outerFrom - i, s.y - i, s.outerTo - s.outerFrom + 2 * i, s.height + 2 * i);
1430
1429
  }
1431
1430
  }
1432
1431
  }
1433
- const mt = 32, Zs = 18;
1434
- function Ae(s, t) {
1435
- if (!(t > 2 * mt)) return 0;
1436
- const e = mt - s, n = s - (t - mt), o = Math.max(e, n);
1432
+ const ft = 32, Zn = 18;
1433
+ function Ce(n, t) {
1434
+ if (!(t > 2 * ft)) return 0;
1435
+ const e = ft - n, s = n - (t - ft), o = Math.max(e, s);
1437
1436
  if (o <= 0) return 0;
1438
- const i = Math.min(1, o / mt), r = Zs * i * i;
1437
+ const i = Math.min(1, o / ft), r = Zn * i * i;
1439
1438
  return e > 0 ? -r : r;
1440
1439
  }
1441
- function dt(s, t, e) {
1442
- const n = (o, i) => {
1443
- const r = ot(o);
1440
+ function rt(n, t, e) {
1441
+ const s = (o, i) => {
1442
+ const r = et(o);
1444
1443
  return o.lane === i.lane && r.from < i.to && i.from < r.to;
1445
1444
  };
1446
- return e.some((o) => n(s, o) && !(t !== null && n(t, o)));
1445
+ return e.some((o) => s(n, o) && !(t !== null && s(t, o)));
1447
1446
  }
1448
- function Qs(s, t, e, n) {
1447
+ function Qn(n, t, e, s) {
1449
1448
  const o = /* @__PURE__ */ new Set();
1450
- if (n === void 0) return o;
1451
- for (const i of s)
1452
- i !== e && (n(t, i) || o.add(i));
1449
+ if (s === void 0) return o;
1450
+ for (const i of n)
1451
+ i !== e && (s(t, i) || o.add(i));
1453
1452
  return o;
1454
1453
  }
1455
- const Ce = "\0placing", De = /* @__PURE__ */ new Set();
1456
- function Ot(s) {
1457
- switch (s.kind) {
1454
+ const De = "\0placing", _e = /* @__PURE__ */ new Set();
1455
+ function Ft(n) {
1456
+ switch (n.kind) {
1458
1457
  case "subtask":
1459
- return `subtask:${s.subtask.id}:${s.part}`;
1458
+ return `subtask:${n.subtask.id}:${n.part}`;
1460
1459
  case "dependency":
1461
- return `dependency:${s.dependency.id}`;
1460
+ return `dependency:${n.dependency.id}`;
1462
1461
  case "milestone":
1463
- return `milestone:${s.milestone.id}`;
1462
+ return `milestone:${n.milestone.id}`;
1464
1463
  case "lane":
1465
- return `lane:${s.lane}`;
1464
+ return `lane:${n.lane}`;
1466
1465
  default:
1467
1466
  return "nothing";
1468
1467
  }
1469
1468
  }
1470
- const _e = 3, to = 10, eo = 600;
1471
- class no {
1469
+ const Fe = 3, to = 10, eo = 600;
1470
+ class so {
1472
1471
  constructor(t) {
1473
1472
  f(this, "gesture", { kind: "none" });
1474
1473
  f(this, "touches", /* @__PURE__ */ new Map());
@@ -1529,9 +1528,9 @@ class no {
1529
1528
  ghostSummary() {
1530
1529
  const t = this.gesture;
1531
1530
  if (t.kind !== "edit" && t.kind !== "place") return null;
1532
- const e = je(this.host.view.viewport(), t.ghost);
1531
+ const e = Ze(this.host.view.viewport(), t.ghost);
1533
1532
  if (e === null) return null;
1534
- const n = this.ghostFindings(t.ghost, this.ghostHome(t)), o = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), i = o ? ot(t.ghost) : t.ghost;
1533
+ const s = this.ghostFindings(t.ghost, this.ghostHome(t)), o = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), i = o ? et(t.ghost) : t.ghost;
1535
1534
  return {
1536
1535
  refused: this.refused,
1537
1536
  refusedLanes: [...t.refused],
@@ -1541,8 +1540,8 @@ class no {
1541
1540
  height: e.height,
1542
1541
  from: i.from,
1543
1542
  to: i.to,
1544
- overlap: n.overlaps.length > 0,
1545
- violated: n.violated.length > 0
1543
+ overlap: s.overlaps.length > 0,
1544
+ violated: s.violated.length > 0
1546
1545
  };
1547
1546
  }
1548
1547
  /* ---------------------------------------------------------------- */
@@ -1550,24 +1549,24 @@ class no {
1550
1549
  /* ---------------------------------------------------------------- */
1551
1550
  local(t, e) {
1552
1551
  var o;
1553
- const n = (o = this.host.plotElement()) == null ? void 0 : o.getBoundingClientRect();
1554
- return { x: t - ((n == null ? void 0 : n.left) ?? 0), y: e - ((n == null ? void 0 : n.top) ?? 0) };
1552
+ const s = (o = this.host.plotElement()) == null ? void 0 : o.getBoundingClientRect();
1553
+ return { x: t - ((s == null ? void 0 : s.left) ?? 0), y: e - ((s == null ? void 0 : s.top) ?? 0) };
1555
1554
  }
1556
- report(t, e, n, o, i, r) {
1555
+ report(t, e, s, o, i, r) {
1557
1556
  var l, h;
1558
1557
  const a = this.host.view;
1559
- (h = (l = this.host.handlers()).onInteraction) == null || h.call(l, { type: t, hit: e, clientX: n, clientY: o, time: a.timeAt(i), lane: a.laneIdAt(r) });
1558
+ (h = (l = this.host.handlers()).onInteraction) == null || h.call(l, { type: t, hit: e, clientX: s, clientY: o, time: a.timeAt(i), lane: a.laneIdAt(r) });
1560
1559
  }
1561
1560
  pointerDown(t) {
1562
- var a, l, h, d, c;
1563
- const { x: e, y: n } = this.local(t.clientX, t.clientY);
1564
- if (t.pointerType === "touch" && (this.touches.set(t.pointerId, { x: e, y: n }), this.touches.size >= 2)) {
1561
+ var a, l, h, d, u;
1562
+ const { x: e, y: s } = this.local(t.clientX, t.clientY);
1563
+ if (t.pointerType === "touch" && (this.touches.set(t.pointerId, { x: e, y: s }), this.touches.size >= 2)) {
1565
1564
  this.gesture.kind !== "pinch" && (this.cancelEdit(), this.gesture = { kind: "pinch", distance: this.touchDistance() });
1566
1565
  return;
1567
1566
  }
1568
1567
  if (t.button !== 0) return;
1569
1568
  const o = (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;
1570
- t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, mode: "pan", subtask: null } : (o === "leadIn" || o === "leadOut") && r !== null ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, mode: o, subtask: r } : this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, ...this.modeAt(e, n) }, (c = (d = this.host.plotElement()) == null ? void 0 : d.setPointerCapture) == null || c.call(d, t.pointerId);
1569
+ t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: "pan", subtask: null } : (o === "leadIn" || o === "leadOut") && r !== null ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: o, subtask: r } : this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, ...this.modeAt(e, s) }, (u = (d = this.host.plotElement()) == null ? void 0 : d.setPointerCapture) == null || u.call(d, t.pointerId);
1571
1570
  }
1572
1571
  /** A drag over a folded group: resting on one opens it for the GESTURE.
1573
1572
 
@@ -1578,11 +1577,11 @@ class no {
1578
1577
  not fold anything (ADR-0025). */
1579
1578
  restOver(t) {
1580
1579
  var o;
1581
- const e = this.host.view, n = e.foldedGroupAt(t);
1582
- n !== ((o = this.resting) == null ? void 0 : o.group) && (this.stopResting(), n !== null && (this.resting = {
1583
- group: n,
1580
+ const e = this.host.view, s = e.foldedGroupAt(t);
1581
+ s !== ((o = this.resting) == null ? void 0 : o.group) && (this.stopResting(), s !== null && (this.resting = {
1582
+ group: s,
1584
1583
  timer: setTimeout(() => {
1585
- this.resting = null, e.openForGesture = /* @__PURE__ */ new Set([...e.openForGesture, n]), this.host.viewChanged();
1584
+ this.resting = null, e.openForGesture = /* @__PURE__ */ new Set([...e.openForGesture, s]), this.host.viewChanged();
1586
1585
  }, eo)
1587
1586
  }));
1588
1587
  }
@@ -1605,42 +1604,42 @@ class no {
1605
1604
  lane is open. Asked at a drop, where the answer has to be current; while
1606
1605
  a drag runs, the held set answers instead. */
1607
1606
  allowed(t, e) {
1608
- var n, o;
1609
- return ((o = (n = this.host.handlers()).canMoveTo) == null ? void 0 : o.call(n, t, e)) ?? !0;
1607
+ var s, o;
1608
+ return ((o = (s = this.host.handlers()).canMoveTo) == null ? void 0 : o.call(s, t, e)) ?? !0;
1610
1609
  }
1611
1610
  /** The lanes this work may not go to, for the gesture that is beginning. A
1612
1611
  gesture that cannot change a lane at all asks nothing: the intents the
1613
1612
  caller handles decide whether the question exists. */
1614
1613
  askRefused(t, e) {
1615
- if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return De;
1616
- const n = this.host.data.lanes.map((o) => o.id);
1617
- return Qs(n, t, e, this.host.handlers().canMoveTo);
1614
+ if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return _e;
1615
+ const s = this.host.data.lanes.map((o) => o.id);
1616
+ return Qn(s, t, e, this.host.handlers().canMoveTo);
1618
1617
  }
1619
1618
  /** What a press at a point would start, given the intents the caller handles. */
1620
1619
  modeAt(t, e) {
1621
- const n = this.host.view, o = n.options.intents;
1622
- if (n.hitAt(t, e).kind === "milestone") return { mode: "pan", subtask: null };
1623
- for (let i = n.boxes.length - 1; i >= 0; i--) {
1624
- const r = n.boxes[i];
1620
+ const s = this.host.view, o = s.options.intents;
1621
+ if (s.hitAt(t, e).kind === "milestone") return { mode: "pan", subtask: null };
1622
+ for (let i = s.boxes.length - 1; i >= 0; i--) {
1623
+ const r = s.boxes[i];
1625
1624
  if (o.includes("stretch")) {
1626
- const a = Nn(r, t, e);
1625
+ const a = Os(r, t, e);
1627
1626
  if (a !== null) return { mode: a === "from" ? "stretch-from" : "stretch-to", subtask: r.subtask };
1628
1627
  }
1629
- if (ze(r, t, e) !== null)
1628
+ if (Ve(r, t, e) !== null)
1630
1629
  return o.includes("move") || o.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
1631
1630
  }
1632
1631
  return { mode: "pan", subtask: null };
1633
1632
  }
1634
1633
  pointerMove(t) {
1635
- const { x: e, y: n } = this.local(t.clientX, t.clientY);
1636
- if (t.pointerType === "touch" && this.touches.has(t.pointerId) && (this.touches.set(t.pointerId, { x: e, y: n }), this.gesture.kind === "pinch")) {
1634
+ const { x: e, y: s } = this.local(t.clientX, t.clientY);
1635
+ if (t.pointerType === "touch" && this.touches.has(t.pointerId) && (this.touches.set(t.pointerId, { x: e, y: s }), this.gesture.kind === "pinch")) {
1637
1636
  const r = this.touchDistance();
1638
1637
  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 };
1639
1638
  return;
1640
1639
  }
1641
1640
  const o = this.gesture;
1642
1641
  if (o.kind === "pending" && o.pointerId === t.pointerId) {
1643
- if (Math.hypot(e - o.x0, n - o.y0) < (t.pointerType === "touch" ? to : _e)) return;
1642
+ if (Math.hypot(e - o.x0, s - o.y0) < (t.pointerType === "touch" ? to : Fe)) return;
1644
1643
  if (o.mode === "pan" || o.subtask === null)
1645
1644
  this.gesture = { kind: "pan", pointerId: o.pointerId, lastX: o.x0, lastY: o.y0 }, this.setCursor("grabbing");
1646
1645
  else {
@@ -1654,21 +1653,21 @@ class no {
1654
1653
  ghost: o.subtask,
1655
1654
  /* Asked here, once, and drawn from the first frame of the drag: the
1656
1655
  lanes that are closed are marked before the pointer reaches one. */
1657
- refused: o.mode === "move" ? this.askRefused(o.subtask, o.subtask.lane) : De
1656
+ refused: o.mode === "move" ? this.askRefused(o.subtask, o.subtask.lane) : _e
1658
1657
  }, this.setCursor(o.mode === "move" ? "grabbing" : "ew-resize");
1659
1658
  }
1660
1659
  }
1661
1660
  const i = this.gesture;
1662
1661
  if (i.kind === "pan" && i.pointerId === t.pointerId) {
1663
- const r = this.host.view.pan(i.lastX - e, i.lastY - n);
1664
- r.moved && this.host.viewMoved(r.time), this.gesture = { ...i, lastX: e, lastY: n };
1662
+ const r = this.host.view.pan(i.lastX - e, i.lastY - s);
1663
+ r.moved && this.host.viewMoved(r.time), this.gesture = { ...i, lastX: e, lastY: s };
1665
1664
  return;
1666
1665
  }
1667
1666
  if (i.kind === "edit" && i.pointerId === t.pointerId) {
1668
- 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();
1667
+ 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();
1669
1668
  return;
1670
1669
  }
1671
- i.kind === "none" && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, n));
1670
+ i.kind === "none" && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, s));
1672
1671
  }
1673
1672
  pointerUp(t) {
1674
1673
  var i, r;
@@ -1677,11 +1676,11 @@ class no {
1677
1676
  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" });
1678
1677
  return;
1679
1678
  }
1680
- const e = this.gesture, { x: n, y: o } = this.local(t.clientX, t.clientY);
1679
+ const e = this.gesture, { x: s, y: o } = this.local(t.clientX, t.clientY);
1681
1680
  if (e.kind === "pending" && e.pointerId === t.pointerId)
1682
- this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, n, o);
1681
+ this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, s, o);
1683
1682
  else if (e.kind === "pan" && e.pointerId === t.pointerId)
1684
- this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, n, o);
1683
+ this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, s, o);
1685
1684
  else if (e.kind === "edit" && e.pointerId === t.pointerId) {
1686
1685
  this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" };
1687
1686
  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(
@@ -1700,9 +1699,9 @@ class no {
1700
1699
  this.panFrame = 0;
1701
1700
  const e = this.gesture;
1702
1701
  if (e.kind !== "edit" && e.kind !== "place") return;
1703
- const n = this.host.view, { x: o, y: i } = this.local(this.lastClient.x, this.lastClient.y), r = Ae(o, n.width), a = Ae(i, n.height);
1702
+ const s = this.host.view, { x: o, y: i } = this.local(this.lastClient.x, this.lastClient.y), r = Ce(o, s.width), a = Ce(i, s.height);
1704
1703
  if (r === 0 && a === 0) return;
1705
- const l = n.pan(r, a);
1704
+ const l = s.pan(r, a);
1706
1705
  if (l.moved) {
1707
1706
  if (this.dragPoint = { x: o, y: i }, e.kind === "edit")
1708
1707
  this.gesture = { ...e, ghost: this.heldGhost(e, o, i) };
@@ -1727,8 +1726,8 @@ class no {
1727
1726
  times would be a lie. Nothing is reported: no interaction happened. */
1728
1727
  refreshHover() {
1729
1728
  if (!this.idle || this.hoverKey === "nothing" || this.byKeyboard) return;
1730
- const { x: t, y: e } = this.hoverPoint, n = this.host.view.hitAt(t, e);
1731
- this.hover = n, this.hoverKey = Ot(n);
1729
+ const { x: t, y: e } = this.hoverPoint, s = this.host.view.hitAt(t, e);
1730
+ this.hover = s, this.hoverKey = Ft(s);
1732
1731
  }
1733
1732
  pointerLeave() {
1734
1733
  this.gesture.kind !== "none" || this.byKeyboard || this.setHover({ kind: "nothing" }, "nothing");
@@ -1741,19 +1740,19 @@ class no {
1741
1740
  contextMenu(t) {
1742
1741
  if (this.host.handlers().onInteraction === void 0) return;
1743
1742
  t.preventDefault();
1744
- const { x: e, y: n } = this.local(t.clientX, t.clientY);
1745
- this.report("contextmenu", this.host.view.hitAt(e, n), t.clientX, t.clientY, e, n);
1743
+ const { x: e, y: s } = this.local(t.clientX, t.clientY);
1744
+ this.report("contextmenu", this.host.view.hitAt(e, s), t.clientX, t.clientY, e, s);
1746
1745
  }
1747
- /** The wheel, as every scrolling area has it (schedule-refinement 02):
1746
+ /** The wheel, as every scrolling area has it:
1748
1747
  vertical scrolls the lanes, and lets the page scroll on once they are at
1749
1748
  their end; Ctrl or ⌘ zooms - a trackpad pinch arrives as a wheel with
1750
1749
  Ctrl -; horizontal or Shift pans through time. */
1751
1750
  wheel(t) {
1752
- const e = this.host.view, n = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)), o = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? e.height : 1, i = t.deltaX * o, r = t.deltaY * o;
1751
+ const e = this.host.view, s = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)), o = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? e.height : 1, i = t.deltaX * o, r = t.deltaY * o;
1753
1752
  if (t.ctrlKey || t.metaKey) {
1754
1753
  t.preventDefault();
1755
1754
  const h = Math.abs(r) < 50 ? 0.01 : 15e-4;
1756
- e.zoomAt(n, Math.exp(r * h)) && this.host.viewMoved(!0);
1755
+ e.zoomAt(s, Math.exp(r * h)) && this.host.viewMoved(!0);
1757
1756
  return;
1758
1757
  }
1759
1758
  if (Math.abs(i) > Math.abs(r) || t.shiftKey) {
@@ -1768,23 +1767,23 @@ class no {
1768
1767
  const l = e.pan(0, r);
1769
1768
  l.moved && this.host.viewMoved(l.time);
1770
1769
  }
1771
- click(t, e, n, o) {
1772
- const i = this.host.view.hitAt(n, o), r = i.kind === "subtask" ? i.subtask.task : i.kind === "dependency" ? this.host.data.taskOfDependency(i.dependency) : null;
1773
- this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, n, o);
1770
+ click(t, e, s, o) {
1771
+ const i = this.host.view.hitAt(s, o), r = i.kind === "subtask" ? i.subtask.task : i.kind === "dependency" ? this.host.data.taskOfDependency(i.dependency) : null;
1772
+ this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, s, o);
1774
1773
  }
1775
- hoverAt(t, e, n, o) {
1776
- const i = this.host.view.hitAt(n, o), r = Ot(i), { mode: a } = this.modeAt(n, o);
1777
- if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: n, y: o }, r === this.hoverKey) {
1774
+ hoverAt(t, e, s, o) {
1775
+ const i = this.host.view.hitAt(s, o), r = Ft(i), { mode: a } = this.modeAt(s, o);
1776
+ if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: s, y: o }, r === this.hoverKey) {
1778
1777
  (i.kind === "subtask" || i.kind === "dependency" || i.kind === "milestone") && this.host.interactionChanged();
1779
1778
  return;
1780
1779
  }
1781
- this.setHover(i, r), this.report("hover", i, t, e, n, o);
1780
+ this.setHover(i, r), this.report("hover", i, t, e, s, o);
1782
1781
  }
1783
1782
  /** The keyboard sets the hover: drawn, and its tooltip shown, as the
1784
1783
  pointer's would be - and reported to nobody, since `onInteraction`
1785
1784
  speaks of pointer positions. `nothing` hands the hover back. */
1786
1785
  setKeyboardHover(t, e) {
1787
- this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Ot(t), this.host.interactionChanged();
1786
+ this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Ft(t), this.host.interactionChanged();
1788
1787
  }
1789
1788
  setHover(t, e) {
1790
1789
  e !== this.hoverKey && (this.hoverKey = e, this.hover = t, this.host.interactionChanged());
@@ -1807,10 +1806,10 @@ class no {
1807
1806
  dragging and handles the place intent, the drop is accepted and a ghost
1808
1807
  shows where the work would land. */
1809
1808
  dragOver(t, e) {
1810
- const n = this.host.view;
1811
- if (e === null || !n.options.intents.includes("place")) return;
1809
+ const s = this.host.view;
1810
+ if (e === null || !s.options.intents.includes("place")) return;
1812
1811
  const { x: o, y: i } = this.local(t.clientX, t.clientY);
1813
- if (n.laneIdAt(i) === null && n.foldedGroupAt(i) === null) {
1812
+ if (s.laneIdAt(i) === null && s.foldedGroupAt(i) === null) {
1814
1813
  this.clearPlacing();
1815
1814
  return;
1816
1815
  }
@@ -1830,18 +1829,18 @@ class no {
1830
1829
  lanes, none where the caller refuses that lane and none where it would
1831
1830
  cover blocked time - which the answer says apart, because they mean
1832
1831
  different things to the drag. */
1833
- placeGhost(t, e, n, o) {
1834
- const i = this.onLane(n);
1832
+ placeGhost(t, e, s, o) {
1833
+ const i = this.onLane(s);
1835
1834
  if (i === null) return { ghost: null, refused: !1, blocked: !1 };
1836
1835
  if (o.has(i)) return { ghost: null, refused: !0, blocked: !1 };
1837
- const r = { ...this.askedFor(t, i, e), id: Ce };
1838
- return dt(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
1836
+ const r = { ...this.askedFor(t, i, e), id: De };
1837
+ return rt(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
1839
1838
  }
1840
1839
  /** The dragged item as a subtask, under the caller's key for it - not the
1841
1840
  internal sentinel: the rule is asked about the thing the application says
1842
1841
  it is dragging, and the ghost only afterwards takes the sentinel. */
1843
- askedFor(t, e, n) {
1844
- const o = this.snapInside(this.host.view.timeAt(n), this.snapStep());
1842
+ askedFor(t, e, s) {
1843
+ const o = this.snapInside(this.host.view.timeAt(s), this.snapStep());
1845
1844
  return {
1846
1845
  id: t.item,
1847
1846
  task: t.task,
@@ -1859,17 +1858,17 @@ class no {
1859
1858
  const e = this.gesture;
1860
1859
  if (e.kind !== "place") return;
1861
1860
  t.preventDefault();
1862
- const { ghost: n, item: o } = e;
1863
- 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: o.item }, n.lane)) return;
1861
+ const { ghost: s, item: o } = e;
1862
+ 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: o.item }, s.lane)) return;
1864
1863
  const i = {
1865
1864
  kind: "place",
1866
1865
  item: o.item,
1867
- task: n.task,
1868
- lane: n.lane,
1869
- from: n.from,
1870
- to: n.to,
1871
- ...n.leadIn === void 0 ? {} : { leadIn: n.leadIn },
1872
- ...n.leadOut === void 0 ? {} : { leadOut: n.leadOut }
1866
+ task: s.task,
1867
+ lane: s.lane,
1868
+ from: s.from,
1869
+ to: s.to,
1870
+ ...s.leadIn === void 0 ? {} : { leadIn: s.leadIn },
1871
+ ...s.leadOut === void 0 ? {} : { leadOut: s.leadOut }
1873
1872
  };
1874
1873
  (a = (r = this.host.handlers()).onIntent) == null || a.call(r, i);
1875
1874
  }
@@ -1891,20 +1890,20 @@ class no {
1891
1890
  put the work into blocked time it did not already cover, the ghost where
1892
1891
  it last stood. It is held, not clamped: a pointer carried on past the
1893
1892
  blocked time takes the ghost along again. */
1894
- heldGhost(t, e, n) {
1895
- const o = this.ghostFor(t, e, n);
1896
- return this.blocked = dt(o, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : o;
1893
+ heldGhost(t, e, s) {
1894
+ const o = this.ghostFor(t, e, s);
1895
+ return this.blocked = rt(o, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : o;
1897
1896
  }
1898
- ghostFor(t, e, n) {
1897
+ ghostFor(t, e, s) {
1899
1898
  const o = this.host.view, i = t.subtask, r = this.snapStep(), a = o.options.intents, l = this.snapInside(o.timeAt(e), r);
1900
1899
  switch (t.mode) {
1901
1900
  case "move": {
1902
1901
  let h = i.from;
1903
- const d = o.viewport().scale, c = d.fromPx(e) - t.t0;
1904
- a.includes("move") && Math.abs(c * d.m) >= _e && (h = this.shifted(i.from, c, r));
1902
+ const d = o.viewport().scale, u = d.fromPx(e) - t.t0;
1903
+ a.includes("move") && Math.abs(u * d.m) >= Fe && (h = this.shifted(i.from, u, r));
1905
1904
  let m = t.ghost.lane;
1906
1905
  if (a.includes("lane")) {
1907
- const p = this.onLane(n) ?? m;
1906
+ const p = this.onLane(s) ?? m;
1908
1907
  this.refused = t.refused.has(p), this.refused || (m = p);
1909
1908
  } else
1910
1909
  this.refused = !1;
@@ -1923,20 +1922,20 @@ class no {
1923
1922
  /** A time moved by an amount of WORKING time and snapped: a drag moves
1924
1923
  a start this way, and a key by one step of the raster - one arithmetic,
1925
1924
  so a key proposes exactly what a drag of that length would. */
1926
- shifted(t, e, n) {
1927
- const o = nt(this.host.view.options.calendar), i = Y(t, o) + e, r = o.intervals.length === 0 ? i : j(Math.max(0, Math.min(o.total, i)), o);
1928
- return this.snapInside(r, n);
1925
+ shifted(t, e, s) {
1926
+ const o = pt(this.host.view.options.calendar), i = H(t, o) + e, r = at(i, o);
1927
+ return this.snapInside(r, s);
1929
1928
  }
1930
1929
  /** Snapped - and, where the raster lands in time the calendar removes, moved
1931
1930
  on to the seam, where time counts again. An intent never asks for a time
1932
1931
  nobody works. */
1933
1932
  snapInside(t, e) {
1934
- const n = In(t, e), o = nt(this.host.view.options.calendar);
1935
- return o.intervals.length === 0 ? n : j(Y(n, o), o);
1933
+ const s = Ms(t, e), o = pt(this.host.view.options.calendar);
1934
+ return o.intervals.length === 0 ? s : xt(H(s, o), o);
1936
1935
  }
1937
- intentsOf(t, e, n) {
1936
+ intentsOf(t, e, s) {
1938
1937
  const o = [], i = this.host.view.options.intents, r = t.id;
1939
- return n === "move" ? (e.from !== t.from && i.includes("move") && o.push({ kind: "move", subtask: r, from: e.from, to: e.to }), e.lane !== t.lane && i.includes("lane") && o.push({ kind: "lane", subtask: r, lane: e.lane })) : n === "stretch-from" || n === "stretch-to" ? (e.from !== t.from || e.to !== t.to) && o.push({ kind: "stretch", subtask: r, from: e.from, to: e.to }) : n === "leadIn" ? (e.leadIn ?? 0) !== (t.leadIn ?? 0) && o.push({ kind: "leadIn", subtask: r, leadIn: e.leadIn ?? 0 }) : (e.leadOut ?? 0) !== (t.leadOut ?? 0) && o.push({ kind: "leadOut", subtask: r, leadOut: e.leadOut ?? 0 }), o;
1938
+ return s === "move" ? (e.from !== t.from && i.includes("move") && o.push({ kind: "move", subtask: r, from: e.from, to: e.to }), e.lane !== t.lane && i.includes("lane") && o.push({ kind: "lane", subtask: r, lane: e.lane })) : s === "stretch-from" || s === "stretch-to" ? (e.from !== t.from || e.to !== t.to) && o.push({ kind: "stretch", subtask: r, from: e.from, to: e.to }) : s === "leadIn" ? (e.leadIn ?? 0) !== (t.leadIn ?? 0) && o.push({ kind: "leadIn", subtask: r, leadIn: e.leadIn ?? 0 }) : (e.leadOut ?? 0) !== (t.leadOut ?? 0) && o.push({ kind: "leadOut", subtask: r, leadOut: e.leadOut ?? 0 }), o;
1940
1939
  }
1941
1940
  /** The lane the ghost came from - the only other lane a drag can touch. */
1942
1941
  ghostHome(t) {
@@ -1952,34 +1951,34 @@ class no {
1952
1951
  keeps a plan of hundreds of tasks fluid while a drag runs, since this is
1953
1952
  computed on every pointer movement. */
1954
1953
  ghostFindings(t, e) {
1955
- const n = this.host.data, o = (d) => d.lane === t.lane || d.lane === e, r = [...n.subtasks.filter((d) => d.id !== t.id && o(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 === Ce ? n.subtasks : n.subtasks.map((d) => d.id === t.id ? t : d);
1956
- return { overlaps: zt(r).filter(a), violated: Kt(h, l) };
1954
+ const s = this.host.data, o = (d) => d.lane === t.lane || d.lane === e, r = [...s.subtasks.filter((d) => d.id !== t.id && o(d)), t], a = (d) => d.first === t.id || d.second === t.id, l = s.dependencies.filter((d) => d.from === t.id || d.to === t.id), h = t.id === De ? s.subtasks : s.subtasks.map((d) => d.id === t.id ? t : d);
1955
+ return { overlaps: Vt(r).filter(a), violated: Wt(h, l) };
1957
1956
  }
1958
1957
  }
1959
- function so(s, t) {
1958
+ function no(n, t) {
1960
1959
  const e = /* @__PURE__ */ new Map();
1961
- for (const n of t) {
1962
- const o = s.slots.get(n.lane), i = o === void 0 ? null : st(s, o.top);
1960
+ for (const s of t) {
1961
+ const o = n.slots.get(s.lane), i = o === void 0 ? null : tt(n, o.top);
1963
1962
  if (i === null) continue;
1964
- const r = s.rows.indexOf(i);
1965
- e.set(r, [...e.get(r) ?? [], n]);
1963
+ const r = n.rows.indexOf(i);
1964
+ e.set(r, [...e.get(r) ?? [], s]);
1966
1965
  }
1967
- return [...e.entries()].sort(([n], [o]) => n - o).map(([, n]) => n.sort((o, i) => o.from - i.from || o.to - i.to));
1966
+ return [...e.entries()].sort(([s], [o]) => s - o).map(([, s]) => s.sort((o, i) => o.from - i.from || o.to - i.to));
1968
1967
  }
1969
- const Fe = (s, t) => t < s.from ? s.from - t : t > s.to ? t - s.to : 0;
1970
- function oo(s, t, e, n) {
1968
+ const Oe = (n, t) => t < n.from ? n.from - t : t > n.to ? t - n.to : 0;
1969
+ function oo(n, t, e, s) {
1971
1970
  var h;
1972
1971
  let o = -1, i = -1;
1973
- for (let d = 0; d < s.length && t !== null && o < 0; d++)
1974
- i = s[d].findIndex((c) => c.id === t), i >= 0 && (o = d);
1972
+ for (let d = 0; d < n.length && t !== null && o < 0; d++)
1973
+ i = n[d].findIndex((u) => u.id === t), i >= 0 && (o = d);
1975
1974
  if (o < 0) {
1976
- for (const d of s) {
1977
- const c = d.find((m) => m.to > n[0] && m.from < n[1]);
1978
- if (c !== void 0) return c;
1975
+ for (const d of n) {
1976
+ const u = d.find((m) => m.to > s[0] && m.from < s[1]);
1977
+ if (u !== void 0) return u;
1979
1978
  }
1980
- return ((h = s[0]) == null ? void 0 : h[0]) ?? null;
1979
+ return ((h = n[0]) == null ? void 0 : h[0]) ?? null;
1981
1980
  }
1982
- const r = s[o], a = r[i], l = (n[1] - n[0]) / 10;
1981
+ const r = n[o], a = r[i], l = (s[1] - s[0]) / 10;
1983
1982
  switch (e) {
1984
1983
  case "next":
1985
1984
  return r[i + 1] ?? a;
@@ -1990,31 +1989,31 @@ function oo(s, t, e, n) {
1990
1989
  case "last":
1991
1990
  return r[r.length - 1];
1992
1991
  case "pageNext":
1993
- return r.find((d, c) => c > i && d.from >= a.from + l) ?? r[r.length - 1];
1992
+ return r.find((d, u) => u > i && d.from >= a.from + l) ?? r[r.length - 1];
1994
1993
  case "pagePrevious":
1995
1994
  for (let d = i - 1; d >= 0; d--) if (r[d].from <= a.from - l) return r[d];
1996
1995
  return r[0];
1997
1996
  case "up":
1998
1997
  case "down": {
1999
- const d = s[e === "up" ? o - 1 : o + 1];
1998
+ const d = n[e === "up" ? o - 1 : o + 1];
2000
1999
  if (d === void 0) return a;
2001
- const c = (a.from + a.to) / 2;
2002
- return d.reduce((m, p) => Fe(p, c) < Fe(m, c) ? p : m);
2000
+ const u = (a.from + a.to) / 2;
2001
+ return d.reduce((m, p) => Oe(p, u) < Oe(m, u) ? p : m);
2003
2002
  }
2004
2003
  }
2005
2004
  }
2006
- function io(s, t, e, n) {
2005
+ function io(n, t, e, s) {
2007
2006
  if (e.kind === "milestone") return e;
2008
2007
  if (e.kind === "dependency") {
2009
- const i = s.find((a) => a.id === e.id), r = i === void 0 ? void 0 : n === "out" ? i.to : i.from;
2008
+ const i = n.find((a) => a.id === e.id), r = i === void 0 ? void 0 : s === "out" ? i.to : i.from;
2010
2009
  return r !== void 0 && t.has(r) ? { kind: "subtask", id: r } : e;
2011
2010
  }
2012
- const o = s.find(
2013
- (i) => (n === "out" ? i.from : i.to) === e.id && t.has(n === "out" ? i.to : i.from)
2011
+ const o = n.find(
2012
+ (i) => (s === "out" ? i.from : i.to) === e.id && t.has(s === "out" ? i.to : i.from)
2014
2013
  );
2015
2014
  return o === void 0 ? e : { kind: "dependency", id: o.id };
2016
2015
  }
2017
- const pt = "\0milestone:", ro = 150, ao = {
2016
+ const mt = "\0milestone:", ro = 150, ao = {
2018
2017
  ArrowRight: "next",
2019
2018
  ArrowLeft: "previous",
2020
2019
  ArrowUp: "up",
@@ -2049,11 +2048,11 @@ class lo {
2049
2048
  key(t) {
2050
2049
  const e = this.host.gestures;
2051
2050
  if (t.metaKey || !e.idle) return !1;
2052
- const n = t.key.toLowerCase() === "t" && !t.ctrlKey && !t.altKey;
2053
- if (t.key === "]" || t.key === "[" || n) {
2051
+ const s = t.key.toLowerCase() === "t" && !t.ctrlKey && !t.altKey;
2052
+ if (t.key === "]" || t.key === "[" || s) {
2054
2053
  const i = this.active();
2055
2054
  if (i === null) return !1;
2056
- const r = this.host.data, a = n ? !t.shiftKey : t.key === "]";
2055
+ const r = this.host.data, a = s ? !t.shiftKey : t.key === "]";
2057
2056
  return this.show(io(r.dependencies, r.subtaskById, i, a ? "out" : "back")), !0;
2058
2057
  }
2059
2058
  if (t.ctrlKey) return !1;
@@ -2066,17 +2065,17 @@ class lo {
2066
2065
  }
2067
2066
  walk(t) {
2068
2067
  var h;
2069
- const { data: e, view: n } = this.host, o = this.active(), i = o === null ? null : o.kind === "subtask" ? o.id : o.kind === "milestone" ? pt + o.id : ((h = e.dependencies.find((d) => d.id === o.id)) == null ? void 0 : h.from) ?? null, r = [...e.subtasks, ...e.milestones.map((d) => ({ id: pt + d.id, lane: d.lane, from: d.at, to: d.at }))];
2070
- let a = so(n.rows, r);
2068
+ const { data: e, view: s } = this.host, o = this.active(), i = o === null ? null : o.kind === "subtask" ? o.id : o.kind === "milestone" ? mt + o.id : ((h = e.dependencies.find((d) => d.id === o.id)) == null ? void 0 : h.from) ?? null, r = [...e.subtasks, ...e.milestones.map((d) => ({ id: mt + d.id, lane: d.lane, from: d.at, to: d.at }))];
2069
+ let a = no(s.rows, r);
2071
2070
  if (i === null) {
2072
- const d = a.filter((c) => {
2073
- const m = J(n.viewport(), c[0].lane);
2074
- return m !== null && m.top + m.height > 0 && m.top < n.height;
2071
+ const d = a.filter((u) => {
2072
+ const m = j(s.viewport(), u[0].lane);
2073
+ return m !== null && m.top + m.height > 0 && m.top < s.height;
2075
2074
  });
2076
2075
  d.length > 0 && (a = d);
2077
2076
  }
2078
2077
  const l = oo(a, i, t, this.host.visibleDomain());
2079
- l !== null && this.show(l.id.startsWith(pt) ? { kind: "milestone", id: l.id.slice(pt.length) } : { kind: "subtask", id: l.id });
2078
+ l !== null && this.show(l.id.startsWith(mt) ? { kind: "milestone", id: l.id.slice(mt.length) } : { kind: "subtask", id: l.id });
2080
2079
  }
2081
2080
  /** Space and Enter select as a click does: the whole task, and the subtask. */
2082
2081
  select() {
@@ -2090,9 +2089,9 @@ class lo {
2090
2089
  end - the intents a drag of that length reports (ADR-0023), and only
2091
2090
  where the caller handles them. Nothing is applied here. */
2092
2091
  edit(t) {
2093
- var c, m;
2094
- const e = this.host.gestures.hover, n = t.key === "ArrowRight" ? 1 : t.key === "ArrowLeft" ? -1 : 0;
2095
- if (n === 0) return !1;
2092
+ var u, m;
2093
+ const e = this.host.gestures.hover, s = t.key === "ArrowRight" ? 1 : t.key === "ArrowLeft" ? -1 : 0;
2094
+ if (s === 0) return !1;
2096
2095
  if (e.kind !== "subtask") return !0;
2097
2096
  const o = 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;
2098
2097
  let d = null;
@@ -2100,25 +2099,25 @@ class lo {
2100
2099
  const p = (I) => ({ ...o, from: I, to: I + (o.to - o.from) });
2101
2100
  let y = o.from;
2102
2101
  for (let I = 0; I < 1e3; I++) {
2103
- const A = i.shifted(y, n * l.step, l);
2104
- if (A === y || (y = A, !dt(p(y), o, h))) break;
2102
+ const A = i.shifted(y, s * l.step, l);
2103
+ if (A === y || (y = A, !rt(p(y), o, h))) break;
2105
2104
  }
2106
- y !== o.from && !dt(p(y), o, h) && (d = { kind: "move", subtask: o.id, from: y, to: p(y).to });
2105
+ y !== o.from && !rt(p(y), o, h) && (d = { kind: "move", subtask: o.id, from: y, to: p(y).to });
2107
2106
  } else if (t.shiftKey && r.includes("stretch")) {
2108
- const p = Math.max(i.shifted(o.to, n * l.step, l), o.from + Math.max(l.step, q));
2109
- p !== o.to && !dt({ ...o, to: p }, o, h) && (d = { kind: "stretch", subtask: o.id, from: o.from, to: p });
2107
+ const p = Math.max(i.shifted(o.to, s * l.step, l), o.from + Math.max(l.step, q));
2108
+ p !== o.to && !rt({ ...o, to: p }, o, h) && (d = { kind: "stretch", subtask: o.id, from: o.from, to: p });
2110
2109
  }
2111
- return i.byKeyboard = !0, d !== null && ((m = (c = this.host.handlers()).onIntent) == null || m.call(c, d)), this.scheduleReadout(), !0;
2110
+ return i.byKeyboard = !0, d !== null && ((m = (u = this.host.handlers()).onIntent) == null || m.call(u, d)), this.scheduleReadout(), !0;
2112
2111
  }
2113
2112
  /** The keys stand on this target: brought into view, drawn as the hover. */
2114
2113
  show(t, e = !0) {
2115
- const n = this.hitOf(t);
2116
- if (n === null) return;
2114
+ const s = this.hitOf(t);
2115
+ if (s === null) return;
2117
2116
  e && this.reveal(t);
2118
2117
  const o = this.bounds(t);
2119
2118
  if (o === null) return;
2120
2119
  const { view: i } = this.host, r = (a, l) => Math.max(0, Math.min(l, a));
2121
- this.host.gestures.setKeyboardHover(n, {
2120
+ this.host.gestures.setKeyboardHover(s, {
2122
2121
  x: (r(o.x0, i.width) + r(o.x1, i.width)) / 2,
2123
2122
  y: (r(o.y0, i.height) + r(o.y1, i.height)) / 2
2124
2123
  }), e && this.scheduleReadout();
@@ -2133,22 +2132,22 @@ class lo {
2133
2132
  const o = e.milestones.find((i) => i.id === t.id);
2134
2133
  return o === void 0 ? null : { kind: "milestone", milestone: o };
2135
2134
  }
2136
- const n = e.dependencies.find((o) => o.id === t.id);
2137
- return n === void 0 ? null : { kind: "dependency", dependency: n };
2135
+ const s = e.dependencies.find((o) => o.id === t.id);
2136
+ return s === void 0 ? null : { kind: "dependency", dependency: s };
2138
2137
  }
2139
2138
  /** Where a target lies on the plot: a subtask's bar, or the span between
2140
2139
  the two bars a dependency joins. */
2141
2140
  bounds(t) {
2142
- const e = this.host.view, n = (a) => e.boxById.get(a);
2141
+ const e = this.host.view, s = (a) => e.boxById.get(a);
2143
2142
  if (t.kind === "subtask") {
2144
- const a = n(t.id);
2143
+ const a = s(t.id);
2145
2144
  return a === void 0 ? null : { x0: a.outerFrom, x1: a.outerTo, y0: a.y, y1: a.y + a.height };
2146
2145
  }
2147
2146
  if (t.kind === "milestone") {
2148
- const a = this.host.data.milestones.find((h) => h.id === t.id), l = a === void 0 ? null : Ut(e.viewport(), a);
2147
+ const a = this.host.data.milestones.find((h) => h.id === t.id), l = a === void 0 ? null : Xt(e.viewport(), a);
2149
2148
  return l === null ? null : { x0: l.x - l.half, x1: l.x + l.half, y0: l.y - l.half, y1: l.y + l.half };
2150
2149
  }
2151
- const o = this.host.data.dependencies.find((a) => a.id === t.id), i = o === void 0 ? void 0 : n(o.from), r = o === void 0 ? void 0 : n(o.to);
2150
+ const o = this.host.data.dependencies.find((a) => a.id === t.id), i = o === void 0 ? void 0 : s(o.from), r = o === void 0 ? void 0 : s(o.to);
2152
2151
  return i === void 0 || r === void 0 ? null : {
2153
2152
  x0: Math.min(i.mainTo, r.mainFrom),
2154
2153
  x1: Math.max(i.mainTo, r.mainFrom),
@@ -2160,11 +2159,11 @@ class lo {
2160
2159
  at the side it came in from; a target wider than the view shows its
2161
2160
  start. As a drag at the edge pans along, the keys do. */
2162
2161
  reveal(t) {
2163
- const e = this.bounds(t), n = this.host.view;
2164
- if (e === null || n.width <= 0) return;
2165
- const o = Math.min(24, n.width / 10), i = e.x0 < 0 ? e.x0 - o : e.x1 > n.width ? Math.max(0, Math.min(e.x1 - n.width + o, e.x0 - o)) : 0, r = e.y0 < 0 ? e.y0 : e.y1 > n.height ? Math.min(e.y1 - n.height, e.y0) : 0;
2162
+ const e = this.bounds(t), s = this.host.view;
2163
+ if (e === null || s.width <= 0) return;
2164
+ const o = Math.min(24, s.width / 10), i = e.x0 < 0 ? e.x0 - o : e.x1 > s.width ? Math.max(0, Math.min(e.x1 - s.width + o, e.x0 - o)) : 0, r = e.y0 < 0 ? e.y0 : e.y1 > s.height ? Math.min(e.y1 - s.height, e.y0) : 0;
2166
2165
  if (i === 0 && r === 0) return;
2167
- const a = n.pan(i, r);
2166
+ const a = s.pan(i, r);
2168
2167
  a.moved && this.host.viewMoved(a.time);
2169
2168
  }
2170
2169
  /** After the data or the view changed: the keys' target is read anew by its
@@ -2177,12 +2176,12 @@ class lo {
2177
2176
  the hover: a pointer that took it over in the pause is not spoken for. */
2178
2177
  scheduleReadout() {
2179
2178
  this.timer !== null && clearTimeout(this.timer), this.timer = setTimeout(() => {
2180
- var n;
2179
+ var s;
2181
2180
  this.timer = null;
2182
2181
  const t = this.host.gestures.hover;
2183
2182
  if (!this.host.gestures.byKeyboard) return;
2184
2183
  const e = this.host.data.tooltipTargetFor(t);
2185
- e !== null && (this.spoken = { target: e, lane: t.kind === "subtask" ? t.subtask.lane : t.kind === "milestone" ? t.milestone.lane : null, count: (((n = this.spoken) == null ? void 0 : n.count) ?? 0) + 1 }, this.host.spokenChanged());
2184
+ e !== null && (this.spoken = { target: e, lane: t.kind === "subtask" ? t.subtask.lane : t.kind === "milestone" ? t.milestone.lane : null, count: (((s = this.spoken) == null ? void 0 : s.count) ?? 0) + 1 }, this.host.spokenChanged());
2186
2185
  }, ro);
2187
2186
  }
2188
2187
  /** Unmount: no readout after it. */
@@ -2190,30 +2189,29 @@ class lo {
2190
2189
  this.timer !== null && clearTimeout(this.timer), this.timer = null;
2191
2190
  }
2192
2191
  }
2193
- const tt = (s) => JSON.stringify([s.domain ?? null, [...s.folded ?? []].sort()]);
2194
- function ho(s, t) {
2195
- if (t.size === 0 || s.folded === void 0) return s;
2196
- const e = s.folded.filter((n) => t.has(n));
2197
- return e.length === s.folded.length ? s : { ...s.domain ? { domain: s.domain } : {}, ...e.length ? { folded: e } : {} };
2192
+ const Q = (n) => JSON.stringify([n.domain ?? null, [...n.folded ?? []].sort()]);
2193
+ function ho(n, t) {
2194
+ if (t.size === 0 || n.folded === void 0) return n;
2195
+ const e = n.folded.filter((s) => t.has(s));
2196
+ return e.length === n.folded.length ? n : { ...n.domain ? { domain: n.domain } : {}, ...e.length ? { folded: e } : {} };
2198
2197
  }
2199
- function co(s, t, e = (n) => n) {
2200
- if (s.length === 0) return null;
2201
- let n = 1 / 0, o = -1 / 0;
2202
- for (const a of s)
2203
- n = Math.min(n, a.from - (a.leadIn ?? 0)), o = Math.max(o, a.to + (a.leadOut ?? 0));
2204
- n = e(n), o = e(o);
2205
- const i = Math.min(t.max, Math.max(t.min, o - n)), r = (n + o) / 2;
2198
+ function co(n, t, e = (s) => s) {
2199
+ if (n.length === 0) return null;
2200
+ let s = 1 / 0, o = -1 / 0;
2201
+ for (const a of n)
2202
+ s = Math.min(s, a.from - (a.leadIn ?? 0)), o = Math.max(o, a.to + (a.leadOut ?? 0));
2203
+ s = e(s), o = e(o);
2204
+ const i = Math.min(t.max, Math.max(t.min, o - s)), r = (s + o) / 2;
2206
2205
  return [r - i / 2, r + i / 2];
2207
2206
  }
2208
- const Oe = {
2207
+ const Ee = {
2209
2208
  width: 0,
2210
2209
  height: 0,
2211
- laneHeight: gt,
2212
2210
  scrollY: 0,
2213
2211
  headers: [],
2214
2212
  days: [],
2215
2213
  ticks: [],
2216
- step: xt,
2214
+ step: Gt,
2217
2215
  ghost: null,
2218
2216
  grips: [],
2219
2217
  cursor: "default",
@@ -2225,8 +2223,8 @@ const Oe = {
2225
2223
  };
2226
2224
  class uo {
2227
2225
  constructor(t = {}) {
2228
- f(this, "data", new Fs(() => this.viewChanged()));
2229
- f(this, "view", new Wn(this.data));
2226
+ f(this, "data", new _n(() => this.viewChanged()));
2227
+ f(this, "view", new Vs(this.data));
2230
2228
  f(this, "gestures");
2231
2229
  f(this, "keys");
2232
2230
  f(this, "handlersNow", {});
@@ -2248,7 +2246,7 @@ class uo {
2248
2246
  changed. */
2249
2247
  f(this, "viewNow");
2250
2248
  f(this, "viewListeners", /* @__PURE__ */ new Set());
2251
- /** Whether the planner, a setter or a view handed in has changed the view
2249
+ /** Whether the planner, a setter or `setView` has changed the view
2252
2250
  yet. Until then a change is the start losing the groups no LaneGroup
2253
2251
  declares - where the schedule starts, not a change to report. */
2254
2252
  f(this, "actedOn", !1);
@@ -2260,7 +2258,7 @@ class uo {
2260
2258
  f(this, "frame", 0);
2261
2259
  f(this, "domainFrame", 0);
2262
2260
  f(this, "unsubscribeTheme", null);
2263
- f(this, "snapshot", Oe);
2261
+ f(this, "snapshot", Ee);
2264
2262
  f(this, "listeners", /* @__PURE__ */ new Set());
2265
2263
  /* ---------------------------------------------------------------- */
2266
2264
  /* Registration and options */
@@ -2289,7 +2287,7 @@ class uo {
2289
2287
  /** Folds or unfolds one group. */
2290
2288
  f(this, "toggleGroup", (t) => {
2291
2289
  const e = this.viewNow.folded ?? [];
2292
- this.actedOn = !0, this.folded = e.includes(t) ? e.filter((n) => n !== t) : [...e, t], this.viewChanged();
2290
+ this.actedOn = !0, this.folded = e.includes(t) ? e.filter((s) => s !== t) : [...e, t], this.viewChanged();
2293
2291
  });
2294
2292
  f(this, "foldAll", () => {
2295
2293
  this.actedOn = !0, this.folded = this.data.groups.map((t) => t.id), this.viewChanged();
@@ -2301,7 +2299,7 @@ class uo {
2301
2299
  this.listeners.delete(t);
2302
2300
  }));
2303
2301
  f(this, "getSnapshot", () => this.snapshot);
2304
- f(this, "getServerSnapshot", () => Oe);
2302
+ f(this, "getServerSnapshot", () => Ee);
2305
2303
  /* ---------------------------------------------------------------- */
2306
2304
  /* Gestures, as the component hands them in */
2307
2305
  /* ---------------------------------------------------------------- */
@@ -2319,13 +2317,13 @@ class uo {
2319
2317
  f(this, "key", (t) => this.keys.key(t));
2320
2318
  f(this, "focus", (t) => this.keys.focus(t));
2321
2319
  f(this, "blur", () => this.keys.blur());
2322
- this.folded = t.folded ?? [], this.domainInView = t.domain ?? null, this.domainInView !== null && this.view.showWall(this.domainInView), this.viewNow = this.currentView(), this.gestures = new no({
2320
+ this.folded = t.folded ?? [], this.domainInView = t.domain ?? null, this.domainInView !== null && this.view.showWall(this.domainInView), this.viewNow = this.currentView(), this.gestures = new so({
2323
2321
  data: this.data,
2324
2322
  view: this.view,
2325
2323
  plotElement: () => this.plot,
2326
2324
  handlers: () => this.handlersNow,
2327
2325
  selectedSubtask: () => this.selected,
2328
- select: (e, n) => this.select(e, n),
2326
+ select: (e, s) => this.select(e, s),
2329
2327
  viewChanged: () => this.viewChanged(),
2330
2328
  viewMoved: (e) => {
2331
2329
  this.viewChanged(), e && this.reportDomain();
@@ -2337,7 +2335,7 @@ class uo {
2337
2335
  gestures: this.gestures,
2338
2336
  handlers: () => this.handlersNow,
2339
2337
  visibleDomain: () => this.visibleDomain(),
2340
- select: (e, n) => this.select(e, n),
2338
+ select: (e, s) => this.select(e, s),
2341
2339
  viewMoved: (e) => {
2342
2340
  this.viewChanged(), e && this.reportDomain();
2343
2341
  },
@@ -2357,9 +2355,9 @@ class uo {
2357
2355
  setPlacing(t) {
2358
2356
  this.placing = t, t === null && this.gestures.clearPlacing();
2359
2357
  }
2360
- /** Goes to a view handed in; what it leaves out goes back to its default. */
2358
+ /** Goes to a whole view (`setView`); what it leaves out goes back to its default. */
2361
2359
  applyView(t) {
2362
- tt(t) !== tt(this.viewNow) && (this.actedOn = !0, this.folded = t.folded ?? [], this.setDomain(t.domain ?? null));
2360
+ Q(t) !== Q(this.viewNow) && (this.actedOn = !0, this.folded = t.folded ?? [], this.setDomain(t.domain ?? null));
2363
2361
  }
2364
2362
  currentView() {
2365
2363
  return ho(
@@ -2369,7 +2367,7 @@ class uo {
2369
2367
  }
2370
2368
  publishView() {
2371
2369
  const t = this.currentView();
2372
- if (tt(t) !== tt(this.viewNow)) {
2370
+ if (Q(t) !== Q(this.viewNow)) {
2373
2371
  this.viewNow = t;
2374
2372
  for (const e of this.viewListeners) e();
2375
2373
  }
@@ -2377,13 +2375,13 @@ class uo {
2377
2375
  /** The subtasks' extent within the zoom limits, while the view names no
2378
2376
  span - and the local day of today while there is no work to show. */
2379
2377
  fit() {
2380
- const t = this.view.options.calendar, e = co(this.data.subtasks, this.view.options.zoomLimits, (o) => Y(o, t));
2378
+ const t = this.view.options.calendar, e = co(this.data.subtasks, this.view.options.zoomLimits, (o) => H(o, t));
2381
2379
  if (e !== null) {
2382
2380
  this.view.domain = e, this.fitted = !0;
2383
2381
  return;
2384
2382
  }
2385
- const n = /* @__PURE__ */ new Date();
2386
- n.setHours(0, 0, 0, 0), this.view.showWall([n.getTime(), n.getTime() + X]);
2383
+ const s = /* @__PURE__ */ new Date();
2384
+ s.setHours(0, 0, 0, 0), this.view.showWall([s.getTime(), s.getTime() + X]);
2387
2385
  }
2388
2386
  /** `undefined`: the scene keeps the selection itself. */
2389
2387
  setControlledTask(t) {
@@ -2401,14 +2399,14 @@ class uo {
2401
2399
  }
2402
2400
  select(t, e) {
2403
2401
  var o, i;
2404
- const n = t !== this.selectedTask || e !== this.selected;
2405
- this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), n && ((i = (o = this.handlersNow).onSelectedTaskChange) == null || i.call(o, t, e)), this.interactionChanged();
2402
+ const s = t !== this.selectedTask || e !== this.selected;
2403
+ this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), s && ((i = (o = this.handlersNow).onSelectedTaskChange) == null || i.call(o, t, e)), this.interactionChanged();
2406
2404
  }
2407
2405
  /* ---------------------------------------------------------------- */
2408
2406
  /* DOM binding */
2409
2407
  /* ---------------------------------------------------------------- */
2410
- bind(t, e, n, o) {
2411
- this.root = t, this.plot = e, this.dataCanvas = n, this.overlayCanvas = o, this.unsubscribeTheme = kn(() => {
2408
+ bind(t, e, s, o) {
2409
+ this.root = t, this.plot = e, this.dataCanvas = s, this.overlayCanvas = o, this.unsubscribeTheme = gs(() => {
2412
2410
  this.colours = null, this.requestDraw();
2413
2411
  }), this.viewChanged();
2414
2412
  }
@@ -2417,8 +2415,8 @@ class uo {
2417
2415
  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;
2418
2416
  }
2419
2417
  resize(t, e) {
2420
- const n = Math.max(0, Math.round(t)), o = Math.max(0, Math.round(e));
2421
- n === this.view.width && o === this.view.height || (this.view.width = n, this.view.height = o, this.viewChanged());
2418
+ const s = Math.max(0, Math.round(t)), o = Math.max(0, Math.round(e));
2419
+ s === this.view.width && o === this.view.height || (this.view.width = s, this.view.height = o, this.viewChanged());
2422
2420
  }
2423
2421
  /* ---------------------------------------------------------------- */
2424
2422
  /* Changes */
@@ -2430,16 +2428,15 @@ class uo {
2430
2428
  this.publish(), this.requestDraw();
2431
2429
  }
2432
2430
  publish() {
2433
- const t = this.view, e = this.selected !== null ? t.boxById.get(this.selected) : void 0, n = [];
2434
- 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 = {
2431
+ const t = this.view, e = this.selected !== null ? t.boxById.get(this.selected) : void 0, s = [];
2432
+ 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 = {
2435
2433
  width: t.width,
2436
2434
  height: t.height,
2437
- laneHeight: t.options.laneHeight,
2438
2435
  scrollY: t.scrollY,
2439
2436
  headers: this.headers(),
2440
2437
  ...t.bands(),
2441
2438
  ghost: this.gestures.ghostSummary(),
2442
- grips: n,
2439
+ grips: s,
2443
2440
  cursor: this.gestures.cursor,
2444
2441
  tooltip: this.tooltip(),
2445
2442
  now: t.nowX(),
@@ -2453,7 +2450,7 @@ class uo {
2453
2450
  not taken off here: the header column is moved as a whole, as it always
2454
2451
  was, so that a header and its row cannot drift apart by a rounding. */
2455
2452
  headers() {
2456
- const t = new Map(this.data.lanes.map((o) => [o.id, o.label])), e = new Map(this.data.groups.map((o) => [o.id, o.label])), n = new Set(this.folded);
2453
+ const t = new Map(this.data.lanes.map((o) => [o.id, o.label])), e = new Map(this.data.groups.map((o) => [o.id, o.label])), s = new Set(this.folded);
2457
2454
  return this.view.rows.rows.map((o) => ({
2458
2455
  key: o.lane ?? o.group ?? "",
2459
2456
  kind: o.kind,
@@ -2463,7 +2460,7 @@ class uo {
2463
2460
  depth: o.depth,
2464
2461
  within: o.within,
2465
2462
  lanes: o.lanes,
2466
- collapsed: o.group === void 0 ? void 0 : n.has(o.group),
2463
+ collapsed: o.group === void 0 ? void 0 : s.has(o.group),
2467
2464
  top: o.top,
2468
2465
  height: o.height
2469
2466
  }));
@@ -2475,27 +2472,27 @@ class uo {
2475
2472
  const t = this.view;
2476
2473
  if (t.width <= 0) return [];
2477
2474
  const e = this.colours;
2478
- return t.boxes.flatMap((n) => {
2479
- if (!Et(n, t.width, t.height)) return [];
2480
- const o = Pn(n, t.width);
2475
+ return t.boxes.flatMap((s) => {
2476
+ if (!Ot(s, t.width, t.height)) return [];
2477
+ const o = Ns(s, t.width);
2481
2478
  if (o === null) return [];
2482
- const i = e === null ? !0 : Xt(
2483
- yt(n.subtask.appearance),
2484
- ct(e, { selectedTask: this.selectedTask, selectedSubtask: this.selectedSubtask }, n.subtask.task, n.subtask.id),
2479
+ const i = e === null ? !0 : qt(
2480
+ kt(s.subtask.appearance),
2481
+ dt(e, { selectedTask: this.selectedTask, selectedSubtask: this.selectedSubtask }, s.subtask.task, s.subtask.id),
2485
2482
  e
2486
2483
  ).onDark;
2487
- return [{ subtask: n.subtask, ...o, dark: i }];
2484
+ return [{ subtask: s.subtask, ...o, dark: i }];
2488
2485
  });
2489
2486
  }
2490
2487
  /** The findings count the whole plan - an overlap out of view is still one
2491
2488
  to know of -, the subtasks only what is in view. */
2492
2489
  summary() {
2493
- const t = this.view, [e, n] = this.visibleDomain();
2490
+ const t = this.view, [e, s] = this.visibleDomain();
2494
2491
  return {
2495
2492
  lanes: this.data.lanes.length,
2496
- subtasks: t.boxes.filter((o) => Et(o, t.width, t.height)).length,
2493
+ subtasks: t.boxes.filter((o) => Ot(o, t.width, t.height)).length,
2497
2494
  from: e,
2498
- to: n,
2495
+ to: s,
2499
2496
  overlaps: this.data.overlaps.length,
2500
2497
  violated: this.data.violatedById.size,
2501
2498
  blocked: this.data.inBlocked.length,
@@ -2507,13 +2504,13 @@ class uo {
2507
2504
  if (!this.gestures.idle) return null;
2508
2505
  const e = this.data.tooltipTargetFor(t);
2509
2506
  if (e === null) return null;
2510
- const { x: n, y: o } = this.gestures.hoverPoint;
2511
- return { target: e, x: n, y: o };
2507
+ const { x: s, y: o } = this.gestures.hoverPoint;
2508
+ return { target: e, x: s, y: o };
2512
2509
  }
2513
2510
  /** The visible span, as two wall-clock instants. */
2514
2511
  visibleDomain() {
2515
- const t = nt(this.view.options.calendar), e = (n) => t.intervals.length === 0 ? n : j(Math.max(0, Math.min(t.total, n)), t);
2516
- return [e(this.view.domain[0]), e(this.view.domain[1])];
2512
+ const t = (e) => at(e, this.view.options.calendar);
2513
+ return [t(this.view.domain[0]), t(this.view.domain[1])];
2517
2514
  }
2518
2515
  /** A pan or zoom of the planner's goes into the view once per frame,
2519
2516
  however many wheel steps they turn. */
@@ -2527,19 +2524,19 @@ class uo {
2527
2524
  /** The time and the lane at a client point, or null outside the plot. */
2528
2525
  positionAt(t, e) {
2529
2526
  var r;
2530
- const n = (r = this.plot) == null ? void 0 : r.getBoundingClientRect();
2531
- if (n === void 0) return null;
2532
- const o = t - n.left, i = e - n.top;
2533
- return o < 0 || i < 0 || o > n.width || i > n.height ? null : { time: this.view.timeAt(o), lane: this.view.laneIdAt(i) };
2527
+ const s = (r = this.plot) == null ? void 0 : r.getBoundingClientRect();
2528
+ if (s === void 0) return null;
2529
+ const o = t - s.left, i = e - s.top;
2530
+ return o < 0 || i < 0 || o > s.width || i > s.height ? null : { time: this.view.timeAt(o), lane: this.view.laneIdAt(i) };
2534
2531
  }
2535
2532
  /** The client point of a time, on a lane's middle where one is named, or
2536
2533
  null while the schedule is not on screen. */
2537
2534
  clientPointOf(t, e) {
2538
2535
  var a;
2539
- const n = (a = this.plot) == null ? void 0 : a.getBoundingClientRect();
2540
- if (n === void 0) return null;
2541
- const o = this.view.viewport(), i = e === void 0 ? null : J(o, e), r = i === null ? 0 : i.top + i.height / 2;
2542
- return { x: n.left + R(o, t), y: n.top + r };
2536
+ const s = (a = this.plot) == null ? void 0 : a.getBoundingClientRect();
2537
+ if (s === void 0) return null;
2538
+ const o = this.view.viewport(), i = e === void 0 ? null : j(o, e), r = i === null ? 0 : i.top + i.height / 2;
2539
+ return { x: s.left + R(o, t), y: s.top + r };
2543
2540
  }
2544
2541
  requestDraw() {
2545
2542
  this.frame !== 0 || this.dataCanvas === null || typeof requestAnimationFrame != "function" || (this.frame = requestAnimationFrame(() => {
@@ -2548,9 +2545,9 @@ class uo {
2548
2545
  }
2549
2546
  draw() {
2550
2547
  if (this.root === null) return;
2551
- this.colours === null && (this.colours = Rs(this.root, this.data), this.publish());
2552
- const { width: t, height: e } = this.view, n = Te(this.dataCanvas, t, e), o = Te(this.overlayCanvas, t, e);
2553
- if (n === null || o === null || t === 0) return;
2548
+ this.colours === null && (this.colours = Bn(this.root, this.data), this.publish());
2549
+ const { width: t, height: e } = this.view, s = Ie(this.dataCanvas, t, e), o = Ie(this.overlayCanvas, t, e);
2550
+ if (s === null || o === null || t === 0) return;
2554
2551
  const i = {
2555
2552
  data: this.data,
2556
2553
  view: this.view,
@@ -2561,50 +2558,46 @@ class uo {
2561
2558
  hover: this.gestures.hover,
2562
2559
  ghost: this.gestures.ghostDrawing()
2563
2560
  };
2564
- Ps(n, i), $s(o, i);
2565
- }
2566
- }
2567
- function Mo(s = {}) {
2568
- const { initialView: t, onViewChange: e } = s, [n] = et(() => new uo(t)), [o] = et(() => new yn()), [i] = et(() => {
2569
- const c = Re((m, p) => bn(Ts, { ...m, scene: n, ref: p }));
2570
- return c.displayName = "Schedule", {
2571
- Schedule: c,
2572
- Lane: Ss,
2573
- LaneGroup: Ls,
2574
- Subtasks: As,
2575
- Dependencies: Cs,
2576
- BlockedTimes: Ds,
2577
- Milestones: _s,
2578
- setDomain: n.setDomain,
2579
- toggleGroup: n.toggleGroup,
2580
- foldAll: n.foldAll,
2581
- unfoldAll: n.unfoldAll
2561
+ xn(s, i), Gn(o, i);
2562
+ }
2563
+ }
2564
+ function Mo(n = {}) {
2565
+ const { initialView: t, onViewChange: e } = n, [s] = ot(() => new uo(t)), o = V(""), [i] = ot(() => {
2566
+ const l = Pe((h, d) => vs(Mn, { ...h, scene: s, ref: d }));
2567
+ return l.displayName = "Schedule", {
2568
+ Schedule: l,
2569
+ Lane: In,
2570
+ LaneGroup: Sn,
2571
+ Subtasks: Ln,
2572
+ Dependencies: An,
2573
+ BlockedTimes: Cn,
2574
+ Milestones: Dn,
2575
+ setView: (h) => {
2576
+ s.applyView(h), o.current = Q(s.getView());
2577
+ },
2578
+ setDomain: s.setDomain,
2579
+ toggleGroup: s.toggleGroup,
2580
+ foldAll: s.foldAll,
2581
+ unfoldAll: s.unfoldAll
2582
2582
  };
2583
- }), r = Pe(n.subscribeView, n.getView, n.getView), a = t === void 0 ? null : tt(t), l = G(a);
2584
- rt(() => {
2585
- if (t === void 0 || a === null || a === l.current) return;
2586
- l.current = a;
2587
- const c = o.has(a);
2588
- o.handed(a), c || n.applyView(t);
2589
- }, [a]);
2590
- const h = tt(r), d = G(h);
2591
- return U(() => {
2592
- d.current !== h && (d.current = h, n.acted && (o.reported(h), e == null || e(r)));
2593
- }, [h]), V(() => ({ ...i, view: r }), [i, r]);
2583
+ }), r = $e(s.subscribeView, s.getView, s.getView), a = Q(r);
2584
+ return z(() => {
2585
+ o.current !== a && (o.current = a, s.acted && (e == null || e(r)));
2586
+ }, [a]), W(() => ({ ...i, view: r }), [i, r]);
2594
2587
  }
2595
2588
  export {
2596
- fe as applyIntent,
2597
- Yt as arrival,
2598
- Gt as departure,
2589
+ me as applyIntent,
2590
+ Kt as arrival,
2591
+ Yt as departure,
2599
2592
  vo as findings,
2600
- $e as inBlockedTime,
2601
- ot as occupied,
2602
- zt as overlaps,
2603
- yt as resolveAppearance,
2593
+ Be as inBlockedTime,
2594
+ et as occupied,
2595
+ Vt as overlaps,
2596
+ kt as resolveAppearance,
2604
2597
  wo as ripple,
2605
2598
  bo as shiftTask,
2606
- In as snapTime,
2599
+ Ms as snapTime,
2607
2600
  yo as subtaskFromPlace,
2608
2601
  Mo as useSchedule,
2609
- Kt as violatedDependencies
2602
+ Wt as violatedDependencies
2610
2603
  };