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