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