@peasant-labs/fairtrade 0.0.29 → 0.0.31

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.
@@ -1,9 +1,93 @@
1
1
  import { Fragment as e, cloneElement as t, isValidElement as n, useCallback as r, useEffect as i, useId as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l } from "react";
2
2
  import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
3
- import { Check as p, ChevronDown as m, ChevronLeft as h, ChevronRight as g, Eye as _, EyeOff as v, FileCode as y, Folder as b, GitMerge as x, Maximize as S, Minus as ee, Plus as te, ScrollText as ne, Search as re, Star as ie, TriangleAlert as ae, Users as oe, Waypoints as C } from "lucide-react";
4
- import { AllChangeBindings as se, AllDiffLineKinds as ce, AllEdgeViolationKinds as le, AllFileChangeStatuses as ue, AllInsightKinds as w, AllInsightProvenances as T, AllMapNodeKinds as E, AllReadAttributionStates as D, AllReadStateGrades as O, Harness as de, isChangeBinding as k, isDiffLineKind as fe, isEdgeViolationKind as pe, isFileChangeStatus as me, isHarness as he, isInsightKind as ge, isInsightProvenance as _e, isMapNodeKind as ve, isReadAttributionState as ye, isReadStateGrade as A } from "@peasant-labs/schema";
3
+ import { Check as p, ChevronDown as m, ChevronLeft as h, ChevronRight as g, Eye as _, EyeOff as v, FileCode as y, Folder as b, GitMerge as x, Maximize as S, Minus as C, Plus as ee, ScrollText as te, Search as ne, Star as re, TriangleAlert as ie, Users as ae, Waypoints as w } from "lucide-react";
4
+ import { AllChangeBindings as oe, AllDiffLineKinds as se, AllEdgeViolationKinds as ce, AllFileChangeStatuses as le, AllInsightKinds as T, AllInsightProvenances as E, AllMapNodeKinds as D, AllReadAttributionStates as O, AllReadStateGrades as k, Harness as ue, isChangeBinding as A, isDiffLineKind as de, isEdgeViolationKind as fe, isFileChangeStatus as pe, isHarness as me, isInsightKind as he, isInsightProvenance as ge, isMapNodeKind as _e, isReadAttributionState as ve, isReadStateGrade as j } from "@peasant-labs/schema";
5
+ //#region src/ui/Button.jsx
6
+ var ye = {
7
+ primary: "btn-primary",
8
+ secondary: "btn-secondary",
9
+ ghost: "btn-ghost",
10
+ danger: "btn-danger"
11
+ };
12
+ function be({ variant: e = "secondary", size: t = "md", icon: n, iconRight: r, loading: i = !1, disabled: a = !1, pressed: o, as: s = "button", className: c, children: l, ...p }) {
13
+ let m = l != null && l !== !1 && l !== "", h = t === "sm" ? 14 : 16, g = o !== void 0, _ = [
14
+ "btn",
15
+ ye[e] || ye.secondary,
16
+ t === "sm" && "btn-sm",
17
+ !m && "btn-icon",
18
+ g && "bs-toggle",
19
+ c
20
+ ].filter(Boolean).join(" "), v = /* @__PURE__ */ f(u, { children: [
21
+ i ? /* @__PURE__ */ d("span", {
22
+ className: "bs-spin",
23
+ "aria-hidden": "true"
24
+ }) : n ? /* @__PURE__ */ d(n, {
25
+ size: h,
26
+ "aria-hidden": "true"
27
+ }) : null,
28
+ l,
29
+ r && /* @__PURE__ */ d(r, {
30
+ size: h,
31
+ "aria-hidden": "true"
32
+ })
33
+ ] });
34
+ if (s === "a") {
35
+ let { href: e, onClick: t, ...n } = p;
36
+ return /* @__PURE__ */ d("a", {
37
+ className: _,
38
+ "aria-busy": i || void 0,
39
+ "aria-pressed": g ? o : void 0,
40
+ "aria-disabled": a || void 0,
41
+ href: a ? void 0 : e,
42
+ tabIndex: a ? -1 : void 0,
43
+ role: a ? "link" : void 0,
44
+ onClick: a ? (e) => e.preventDefault() : t,
45
+ ...n,
46
+ children: v
47
+ });
48
+ }
49
+ return /* @__PURE__ */ d("button", {
50
+ className: _,
51
+ disabled: a,
52
+ "aria-busy": i || void 0,
53
+ "aria-pressed": g ? o : void 0,
54
+ ...p,
55
+ children: v
56
+ });
57
+ }
58
+ function xe({ label: e, className: t, children: n, ...r }) {
59
+ return /* @__PURE__ */ d("div", {
60
+ className: ["bs-group", t].filter(Boolean).join(" "),
61
+ role: "group",
62
+ "aria-label": e,
63
+ ...r,
64
+ children: n
65
+ });
66
+ }
67
+ function Se({ options: e = [], value: t, defaultValue: n, onChange: r, label: i, className: a, ...o }) {
68
+ let s = t !== void 0, [c, u] = l(n ?? e[0]?.value), p = s ? t : c, m = (e) => {
69
+ s || u(e), r?.(e);
70
+ };
71
+ return /* @__PURE__ */ d("div", {
72
+ className: ["bs-seg", a].filter(Boolean).join(" "),
73
+ role: "group",
74
+ "aria-label": i,
75
+ ...o,
76
+ children: e.map((e) => {
77
+ let t = e.icon;
78
+ return /* @__PURE__ */ f("button", {
79
+ type: "button",
80
+ className: "bs-seg-opt",
81
+ "aria-pressed": p === e.value,
82
+ onClick: () => m(e.value),
83
+ children: [t && /* @__PURE__ */ d(t, { "aria-hidden": "true" }), e.label]
84
+ }, e.value);
85
+ })
86
+ });
87
+ }
88
+ //#endregion
5
89
  //#region src/ui/BrandMark.jsx
6
- var be = {
90
+ var Ce = {
7
91
  github: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.807 1.305 3.492.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.4 3-.405 1.02.005 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",
8
92
  claude: "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",
9
93
  gemini: "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81",
@@ -12,10 +96,10 @@ var be = {
12
96
  cursor: "M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23",
13
97
  strike: "M18.5 6L11 17.5h5.2L13.5 26 21 14.5h-5.2L18.5 6z",
14
98
  pi: "M165.29 165.29 H517.36 V400 H400 V517.36 H282.65 V634.72 H165.29 Z M282.65 282.65 V400 H400 V282.65 Z M517.36 400 H634.72 V634.72 H517.36 Z"
15
- }, xe = {
99
+ }, we = {
16
100
  strike: "6 6 20 20",
17
101
  pi: "0 0 800 800"
18
- }, Se = {
102
+ }, Te = {
19
103
  anthropic: "claude",
20
104
  "claude-code": "claude",
21
105
  google: "gemini",
@@ -25,7 +109,7 @@ var be = {
25
109
  "codex-cli": "openai",
26
110
  chatgpt: "openai",
27
111
  gpt: "openai"
28
- }, Ce = {
112
+ }, Ee = {
29
113
  github: "GitHub",
30
114
  claude: "Claude",
31
115
  gemini: "Gemini",
@@ -35,13 +119,13 @@ var be = {
35
119
  strike: "Strike",
36
120
  pi: "Pi"
37
121
  };
38
- function we(e) {
122
+ function De(e) {
39
123
  if (!e) return null;
40
- let t = String(e).toLowerCase().trim(), n = Se[t] || t;
41
- return be[n] ? n : null;
124
+ let t = String(e).toLowerCase().trim(), n = Te[t] || t;
125
+ return Ce[n] ? n : null;
42
126
  }
43
- function Te({ name: e, size: t, label: n, className: r = "", ...i }) {
44
- let a = we(e);
127
+ function M({ name: e, size: t, label: n, className: r = "", ...i }) {
128
+ let a = De(e);
45
129
  if (!a) return null;
46
130
  let o = ["brand", r].filter(Boolean).join(" "), s = t == null ? {} : {
47
131
  width: t,
@@ -52,7 +136,7 @@ function Te({ name: e, size: t, label: n, className: r = "", ...i }) {
52
136
  }
53
137
  }, c = n ? {
54
138
  role: "img",
55
- "aria-label": n === !0 ? Ce[a] : n,
139
+ "aria-label": n === !0 ? Ee[a] : n,
56
140
  focusable: "false"
57
141
  } : {
58
142
  "aria-hidden": "true",
@@ -60,20 +144,141 @@ function Te({ name: e, size: t, label: n, className: r = "", ...i }) {
60
144
  };
61
145
  return /* @__PURE__ */ d("svg", {
62
146
  className: o,
63
- viewBox: xe[a] ?? "0 0 24 24",
147
+ viewBox: we[a] ?? "0 0 24 24",
64
148
  ...s,
65
149
  ...c,
66
150
  ...i,
67
151
  "data-brand": a,
68
152
  children: /* @__PURE__ */ d("path", {
69
- d: be[a],
153
+ d: Ce[a],
70
154
  fillRule: a === "pi" ? "evenodd" : void 0
71
155
  })
72
156
  });
73
157
  }
74
158
  //#endregion
159
+ //#region src/ui/Tabs.jsx
160
+ function N({ tabs: e, defaultTab: t, value: n, onChange: r, "aria-label": i = "tabs" }) {
161
+ let o = a(), s = c([]), p = n !== void 0, [m, h] = l(() => t ?? e[0]?.id), g = p ? n : m, _ = (e) => {
162
+ p || h(e), e !== g && r?.(e);
163
+ }, v = (t) => {
164
+ let n = e.findIndex((e) => e.id === g);
165
+ if (n < 0) return;
166
+ let r = n;
167
+ if (t.key === "ArrowRight" || t.key === "ArrowDown") r = (n + 1) % e.length;
168
+ else if (t.key === "ArrowLeft" || t.key === "ArrowUp") r = (n - 1 + e.length) % e.length;
169
+ else if (t.key === "Home") r = 0;
170
+ else if (t.key === "End") r = e.length - 1;
171
+ else return;
172
+ t.preventDefault(), _(e[r].id), s.current[r]?.focus();
173
+ }, y = (e) => `${o}-tab-${e}`, b = (e) => `${o}-panel-${e}`;
174
+ return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", {
175
+ className: "tabs",
176
+ role: "tablist",
177
+ "aria-label": i,
178
+ onKeyDown: v,
179
+ children: e.map((e, t) => {
180
+ let n = e.id === g;
181
+ return /* @__PURE__ */ f("button", {
182
+ ref: (e) => {
183
+ s.current[t] = e;
184
+ },
185
+ className: n ? "tab active" : "tab",
186
+ role: "tab",
187
+ id: y(e.id),
188
+ "aria-controls": b(e.id),
189
+ "aria-selected": n ? "true" : "false",
190
+ tabIndex: n ? 0 : -1,
191
+ onClick: () => {
192
+ _(e.id), s.current[t]?.focus();
193
+ },
194
+ children: [e.label, e.count != null && /* @__PURE__ */ d("span", {
195
+ className: "cnt",
196
+ children: e.count
197
+ })]
198
+ }, e.id);
199
+ })
200
+ }), e.map((e) => /* @__PURE__ */ d("div", {
201
+ className: "tabpanel",
202
+ id: b(e.id),
203
+ role: "tabpanel",
204
+ "aria-labelledby": y(e.id),
205
+ tabIndex: e.id === g ? 0 : -1,
206
+ hidden: e.id !== g,
207
+ children: e.content
208
+ }, e.id))] });
209
+ }
210
+ //#endregion
211
+ //#region src/ui/Pagination.jsx
212
+ function P(e, t, n) {
213
+ let r = (e, t) => Array.from({ length: t - e + 1 }, (t, n) => e + n);
214
+ if (t <= 1) return [1];
215
+ if (t <= 7) return r(1, t);
216
+ let i = Math.max(2, e - n), a = Math.min(t - 1, e + n), o = i > 3, s = a < t - 2;
217
+ return !o && !s ? r(1, t) : o && !s ? [
218
+ 1,
219
+ "gap-l",
220
+ ...r(i, t)
221
+ ] : !o && s ? [
222
+ ...r(1, a),
223
+ "gap-r",
224
+ t
225
+ ] : [
226
+ 1,
227
+ "gap-l",
228
+ ...r(i, a),
229
+ "gap-r",
230
+ t
231
+ ];
232
+ }
233
+ function Oe({ page: e, defaultPage: t = 1, total: n, totalItems: r, pageSize: i = 10, onChange: a, siblingCount: o = 1, label: s = "pagination" }) {
234
+ let c = e !== void 0, [u, p] = l(t), m = n ?? (r == null ? 1 : Math.max(1, Math.ceil(r / i))), _ = Math.max(1, m), v = ke(c ? e : u, 1, _), y = (e) => {
235
+ let t = ke(e, 1, _);
236
+ t !== v && (c || p(t), a?.(t));
237
+ }, b = v <= 1, x = v >= _, S = P(v, _, Math.max(0, o));
238
+ return /* @__PURE__ */ f("nav", {
239
+ className: "pgn",
240
+ "aria-label": s,
241
+ children: [
242
+ /* @__PURE__ */ f("button", {
243
+ type: "button",
244
+ className: "pgn-btn pgn-edge",
245
+ "aria-label": "previous page",
246
+ disabled: b,
247
+ onClick: () => y(v - 1),
248
+ children: [/* @__PURE__ */ d(h, { "aria-hidden": "true" }), /* @__PURE__ */ d("span", { children: "prev" })]
249
+ }),
250
+ /* @__PURE__ */ d("ul", {
251
+ className: "pgn-list",
252
+ children: S.map((e) => typeof e == "number" ? /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d("button", {
253
+ type: "button",
254
+ className: "pgn-btn pgn-num tnum",
255
+ "aria-label": `page ${e}`,
256
+ "aria-current": e === v ? "page" : void 0,
257
+ onClick: () => y(e),
258
+ children: e
259
+ }) }, e) : /* @__PURE__ */ d("li", {
260
+ className: "pgn-gap",
261
+ "aria-hidden": "true",
262
+ children: "…"
263
+ }, e))
264
+ }),
265
+ /* @__PURE__ */ f("button", {
266
+ type: "button",
267
+ className: "pgn-btn pgn-edge",
268
+ "aria-label": "next page",
269
+ disabled: x,
270
+ onClick: () => y(v + 1),
271
+ children: [/* @__PURE__ */ d("span", { children: "next" }), /* @__PURE__ */ d(g, { "aria-hidden": "true" })]
272
+ })
273
+ ]
274
+ });
275
+ }
276
+ function ke(e, t, n) {
277
+ return Math.min(n, Math.max(t, e));
278
+ }
279
+ //#endregion
75
280
  //#region src/ui/Tooltip.jsx
76
- function Ee({ content: e, children: t, id: n }) {
281
+ function Ae({ content: e, children: t, id: n }) {
77
282
  let r = a(), i = n || `tip-${r}`, [o, s] = l(!1), c = () => s(!0), u = () => s(!1);
78
283
  return /* @__PURE__ */ f("span", {
79
284
  className: "tip-anchor",
@@ -84,7 +289,7 @@ function Ee({ content: e, children: t, id: n }) {
84
289
  onKeyDown: (e) => {
85
290
  e.key === "Escape" && o && s(!1);
86
291
  },
87
- children: [/* @__PURE__ */ d(De, {
292
+ children: [/* @__PURE__ */ d(je, {
88
293
  describedById: i,
89
294
  children: t
90
295
  }), o && /* @__PURE__ */ d("span", {
@@ -95,14 +300,14 @@ function Ee({ content: e, children: t, id: n }) {
95
300
  })]
96
301
  });
97
302
  }
98
- function De({ children: e, describedById: r }) {
303
+ function je({ children: e, describedById: r }) {
99
304
  if (n(e)) {
100
305
  let n = e.props["aria-describedby"];
101
306
  return t(e, { "aria-describedby": n ? `${n} ${r}` : r });
102
307
  }
103
308
  return e;
104
309
  }
105
- function Oe({ children: e, label: t, title: n, icon: r, content: o, footer: s, triggerClassName: u = "btn btn-secondary btn-sm", id: p }) {
310
+ function Me({ children: e, label: t, title: n, icon: r, content: o, footer: s, triggerClassName: u = "btn btn-secondary btn-sm", id: p }) {
106
311
  let m = a(), h = p || `pop-${m}`, [g, _] = l(!1), v = c(null), y = c(null);
107
312
  return i(() => {
108
313
  if (!g) return;
@@ -152,7 +357,7 @@ function Oe({ children: e, label: t, title: n, icon: r, content: o, footer: s, t
152
357
  }
153
358
  //#endregion
154
359
  //#region src/ui/provider-policy.js
155
- var j = Object.freeze(Object.values(de)), M = Object.freeze({
360
+ var Ne = Object.freeze(Object.values(ue)), Pe = Object.freeze({
156
361
  "claude-code": "Claude Code",
157
362
  "gemini-cli": "Gemini CLI",
158
363
  codex: "Codex",
@@ -161,7 +366,7 @@ var j = Object.freeze(Object.values(de)), M = Object.freeze({
161
366
  antigravity: "Google Antigravity",
162
367
  strike: "Strike",
163
368
  pi: "Pi"
164
- }), N = Object.freeze({
369
+ }), Fe = Object.freeze({
165
370
  "claude-code": "claude",
166
371
  "gemini-cli": "gemini",
167
372
  codex: "openai",
@@ -170,7 +375,7 @@ var j = Object.freeze(Object.values(de)), M = Object.freeze({
170
375
  antigravity: "gemini",
171
376
  strike: "strike",
172
377
  pi: "pi"
173
- }), ke = Object.freeze({
378
+ }), Ie = Object.freeze({
174
379
  "claude-code": "amber",
175
380
  "gemini-cli": "teal",
176
381
  codex: "olive",
@@ -180,69 +385,69 @@ var j = Object.freeze(Object.values(de)), M = Object.freeze({
180
385
  strike: "clay",
181
386
  pi: "mauve"
182
387
  });
183
- function Ae(e, t) {
184
- if (he(e)) return;
388
+ function Le(e, t) {
389
+ if (me(e)) return;
185
390
  let n;
186
391
  try {
187
392
  n = JSON.stringify(e);
188
393
  } catch {
189
394
  n = String(e);
190
395
  }
191
- throw TypeError(`Provider harness validation failed for ${n} at src/ui/provider-policy.js during ${t}: the value is outside the canonical @peasant-labs/schema Harness, so Fairtrade cannot select a trustworthy provider identity; the caller must validate its wire boundary and pass one of ${j.join(", ")}.`);
396
+ throw TypeError(`Provider harness validation failed for ${n} at src/ui/provider-policy.js during ${t}: the value is outside the canonical @peasant-labs/schema Harness, so Fairtrade cannot select a trustworthy provider identity; the caller must validate its wire boundary and pass one of ${Ne.join(", ")}.`);
192
397
  }
193
- function je(e) {
194
- return Ae(e, "provider display-name resolution"), M[e];
398
+ function Re(e) {
399
+ return Le(e, "provider display-name resolution"), Pe[e];
195
400
  }
196
- function Me(e) {
197
- return Ae(e, "provider brand resolution"), N[e];
401
+ function ze(e) {
402
+ return Le(e, "provider brand resolution"), Fe[e];
198
403
  }
199
- function Ne(e) {
200
- return Ae(e, "provider accent resolution"), ke[e];
404
+ function F(e) {
405
+ return Le(e, "provider accent resolution"), Ie[e];
201
406
  }
202
407
  //#endregion
203
408
  //#region src/ui/Intensity.jsx
204
- function Pe(e) {
409
+ function I(e) {
205
410
  let t = Math.round(Number(e) || 0);
206
411
  return Math.max(0, Math.min(4, t));
207
412
  }
208
- function P(e, t) {
413
+ function L(e, t) {
209
414
  if (!t || t <= 0 || e <= 0) return 0;
210
415
  let n = Math.min(e / t, 1);
211
416
  return n < .25 ? 1 : n < .5 ? 2 : n < .9 ? 3 : 4;
212
417
  }
213
- function Fe(e) {
418
+ function Be(e) {
214
419
  if (!e || e <= 0) return 0;
215
420
  let t = Math.min(e, 1);
216
421
  return t <= .25 ? 1 : t <= .5 ? 2 : t <= .75 ? 3 : 4;
217
422
  }
218
- function Ie(e, t) {
423
+ function R(e, t) {
219
424
  if (e <= 0 || t <= 0) return 0;
220
425
  let n = Math.min(e / t, 1);
221
426
  return n <= .25 ? 1 : n <= .5 ? 2 : n <= .75 ? 3 : 4;
222
427
  }
223
- function Le(e) {
428
+ function z(e) {
224
429
  let t = Number(e) || 0;
225
430
  return t < 60 ? "xs" : t < 200 ? "sm" : t < 600 ? "md" : t < 1500 ? "lg" : "xl";
226
431
  }
227
- var Re = [
432
+ var Ve = [
228
433
  "none",
229
434
  "low",
230
435
  "some",
231
436
  "most",
232
437
  "full"
233
438
  ];
234
- function ze({ level: e = 0, accent: t, size: n, label: r, className: i = "", ...a }) {
235
- let o = Pe(e);
439
+ function He({ level: e = 0, accent: t, size: n, label: r, className: i = "", ...a }) {
440
+ let o = I(e);
236
441
  return /* @__PURE__ */ d("span", {
237
442
  className: `ir-swatch${n === "lg" ? " ir-swatch--lg" : ""}${i ? ` ${i}` : ""}`,
238
443
  "data-level": o,
239
444
  "data-accent": t || void 0,
240
445
  role: "img",
241
- "aria-label": r || `intensity ${o} of 4 (${Re[o]})`,
446
+ "aria-label": r || `intensity ${o} of 4 (${Ve[o]})`,
242
447
  ...a
243
448
  });
244
449
  }
245
- function F({ title: e = "coverage", words: t = Re, className: n = "" }) {
450
+ function B({ title: e = "coverage", words: t = Ve, className: n = "" }) {
246
451
  return /* @__PURE__ */ f("div", {
247
452
  className: `ir-scope ir-legend${n ? ` ${n}` : ""}`,
248
453
  children: [
@@ -284,8 +489,8 @@ function F({ title: e = "coverage", words: t = Re, className: n = "" }) {
284
489
  ]
285
490
  });
286
491
  }
287
- function I({ values: e, levels: t, max: n, labels: r, ariaLabel: i = "intensity heatmap", className: a = "" }) {
288
- let o = t ? t.map(Pe) : (e || []).map((t) => Ie(t, n ?? Math.max(1, ...e || [1])));
492
+ function Ue({ values: e, levels: t, max: n, labels: r, ariaLabel: i = "intensity heatmap", className: a = "" }) {
493
+ let o = t ? t.map(I) : (e || []).map((t) => R(t, n ?? Math.max(1, ...e || [1])));
289
494
  return /* @__PURE__ */ d("div", {
290
495
  className: `ir-scope ir-heatmap${a ? ` ${a}` : ""}`,
291
496
  role: "img",
@@ -293,24 +498,24 @@ function I({ values: e, levels: t, max: n, labels: r, ariaLabel: i = "intensity
293
498
  children: o.map((e, t) => /* @__PURE__ */ d("span", {
294
499
  className: "ir-heatmap__cell",
295
500
  "data-level": e,
296
- title: `${r?.[t] ?? `cell ${t + 1}`}: ${Re[e]} (${e}/4)`
501
+ title: `${r?.[t] ?? `cell ${t + 1}`}: ${Ve[e]} (${e}/4)`
297
502
  }, t))
298
503
  });
299
504
  }
300
- function L({ label: e, loc: t, coverage: n = 0, recorded: r, total: i, selected: a = !1, violation: o = 0, effortPct: s, size: c, as: l = "button", onClick: u, className: m = "", ...h }) {
301
- let g = i == null ? Pe(n) : P(r ?? 0, i), _ = c || Le(t), v = Math.max(0, Math.round(Number(o) || 0)), y = s != null && s > 0, b = y ? Fe(s > 1 ? s / 100 : s) : 0, x = [
505
+ function We({ label: e, loc: t, coverage: n = 0, recorded: r, total: i, selected: a = !1, violation: o = 0, effortPct: s, size: c, as: l = "button", onClick: u, className: m = "", ...h }) {
506
+ let g = i == null ? I(n) : L(r ?? 0, i), _ = c || z(t), v = Math.max(0, Math.round(Number(o) || 0)), y = s != null && s > 0, b = y ? Be(s > 1 ? s / 100 : s) : 0, x = [
302
507
  e,
303
508
  i == null ? `coverage ${g} of 4` : `${r ?? 0} of ${i} recorded`,
304
509
  t == null ? null : `${t} loc`,
305
510
  v > 0 ? `${v} violation${v === 1 ? "" : "s"}` : null,
306
511
  a ? "selected" : null
307
- ].filter(Boolean).join(", "), S = l, ee = S === "button";
512
+ ].filter(Boolean).join(", "), S = l, C = S === "button";
308
513
  return /* @__PURE__ */ f(S, {
309
514
  className: `ir-node ir-node--${_}${m ? ` ${m}` : ""}`,
310
515
  "data-coverage": g,
311
516
  "data-selected": a ? "true" : void 0,
312
- type: ee ? "button" : void 0,
313
- "aria-pressed": ee ? a : void 0,
517
+ type: C ? "button" : void 0,
518
+ "aria-pressed": C ? a : void 0,
314
519
  "aria-label": x,
315
520
  onClick: u,
316
521
  ...h,
@@ -323,7 +528,7 @@ function L({ label: e, loc: t, coverage: n = 0, recorded: r, total: i, selected:
323
528
  }), v > 0 && /* @__PURE__ */ f("span", {
324
529
  className: "ir-node__badge",
325
530
  "aria-hidden": "true",
326
- children: [/* @__PURE__ */ d(ae, { "aria-hidden": "true" }), /* @__PURE__ */ d("span", {
531
+ children: [/* @__PURE__ */ d(ie, { "aria-hidden": "true" }), /* @__PURE__ */ d("span", {
327
532
  className: "tnum",
328
533
  children: v
329
534
  })]
@@ -346,7 +551,7 @@ function L({ label: e, loc: t, coverage: n = 0, recorded: r, total: i, selected:
346
551
  ]
347
552
  });
348
553
  }
349
- function Be({ children: e, className: t = "", ...n }) {
554
+ function V({ children: e, className: t = "", ...n }) {
350
555
  return /* @__PURE__ */ d("div", {
351
556
  className: `ir-scope${t ? ` ${t}` : ""}`,
352
557
  ...n,
@@ -355,29 +560,29 @@ function Be({ children: e, className: t = "", ...n }) {
355
560
  }
356
561
  //#endregion
357
562
  //#region src/ui/ProviderIcon.jsx
358
- var R = j, z = ke;
359
- function Ve(e) {
360
- return `var(--${Ne(e)})`;
563
+ var H = Ne, U = Ie;
564
+ function Ge(e) {
565
+ return `var(--${F(e)})`;
361
566
  }
362
- function B({ harness: e, size: t, accent: n = !1, label: r, className: i = "", ...a }) {
363
- Ae(e, "ProviderIcon render in src/ui/ProviderIcon.jsx");
364
- let o = Me(e), s = ["pv-icon", i].filter(Boolean).join(" "), c = n ? { color: Ve(e) } : void 0, l = r === !0 ? je(e) : r;
567
+ function W({ harness: e, size: t, accent: n = !1, label: r, className: i = "", ...a }) {
568
+ Le(e, "ProviderIcon render in src/ui/ProviderIcon.jsx");
569
+ let o = ze(e), s = ["pv-icon", i].filter(Boolean).join(" "), c = n ? { color: Ge(e) } : void 0, l = r === !0 ? Re(e) : r;
365
570
  return /* @__PURE__ */ d("span", {
366
571
  className: s,
367
572
  style: c,
368
573
  ...a,
369
- children: /* @__PURE__ */ d(Te, {
574
+ children: /* @__PURE__ */ d(M, {
370
575
  name: o,
371
576
  size: t,
372
577
  label: l
373
578
  })
374
579
  });
375
580
  }
376
- function V({ harness: e, accent: t = !1, className: n = "", ...r }) {
377
- return Ae(e, "ProviderTag render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ f("span", {
581
+ function Ke({ harness: e, accent: t = !1, className: n = "", ...r }) {
582
+ return Le(e, "ProviderTag render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ f("span", {
378
583
  className: ["pv-tag", n].filter(Boolean).join(" "),
379
584
  ...r,
380
- children: [/* @__PURE__ */ d(B, {
585
+ children: [/* @__PURE__ */ d(W, {
381
586
  harness: e,
382
587
  accent: t
383
588
  }), /* @__PURE__ */ d("span", {
@@ -386,27 +591,27 @@ function V({ harness: e, accent: t = !1, className: n = "", ...r }) {
386
591
  })]
387
592
  });
388
593
  }
389
- function He({ harness: e, accent: t = !1, className: n = "", ...r }) {
390
- return Ae(e, "ProviderName render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ f("span", {
594
+ function qe({ harness: e, accent: t = !1, className: n = "", ...r }) {
595
+ return Le(e, "ProviderName render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ f("span", {
391
596
  className: ["pv-name", n].filter(Boolean).join(" "),
392
- style: t ? { color: Ve(e) } : void 0,
597
+ style: t ? { color: Ge(e) } : void 0,
393
598
  ...r,
394
- children: [/* @__PURE__ */ d(B, { harness: e }), /* @__PURE__ */ d("span", {
599
+ children: [/* @__PURE__ */ d(W, { harness: e }), /* @__PURE__ */ d("span", {
395
600
  className: "pv-name-label",
396
601
  children: e
397
602
  })]
398
603
  });
399
604
  }
400
- function H({ className: e = "", ...t }) {
605
+ function Je({ className: e = "", ...t }) {
401
606
  return /* @__PURE__ */ d("ul", {
402
607
  className: ["pv-legend", e].filter(Boolean).join(" "),
403
608
  ...t,
404
- children: R.map((e) => {
405
- let t = Ne(e);
609
+ children: H.map((e) => {
610
+ let t = F(e);
406
611
  return /* @__PURE__ */ f("li", {
407
612
  className: "pv-legend-row",
408
613
  children: [
409
- /* @__PURE__ */ d(B, {
614
+ /* @__PURE__ */ d(W, {
410
615
  harness: e,
411
616
  accent: !0,
412
617
  className: "pv-legend-mark"
@@ -431,13 +636,13 @@ function H({ className: e = "", ...t }) {
431
636
  }
432
637
  //#endregion
433
638
  //#region src/ui/format.js
434
- function U(e) {
639
+ function Ye(e) {
435
640
  return new Intl.NumberFormat("en-US", {
436
641
  notation: "compact",
437
642
  maximumFractionDigits: 1
438
643
  }).format(e).toLowerCase();
439
644
  }
440
- function W(e) {
645
+ function Xe(e) {
441
646
  let t = new Date(e);
442
647
  return Number.isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-US", {
443
648
  month: "short",
@@ -448,7 +653,7 @@ function W(e) {
448
653
  }
449
654
  //#endregion
450
655
  //#region src/ui/graph/GhostCommitNode.jsx
451
- var G = Object.freeze({
656
+ var Ze = Object.freeze({
452
657
  hash: "matched by hash",
453
658
  patch_id: "matched by patch content",
454
659
  author_identity: "matched by author and time",
@@ -456,9 +661,9 @@ var G = Object.freeze({
456
661
  temporal: "matched by nearby time only",
457
662
  none: "no match found"
458
663
  });
459
- function Ue({ ghostHash: e, subject: t, resolution: n, method: r, confidence: i, className: a = "", ...o }) {
460
- let s = n === "unresolved" ? "session-era commit, no longer in history; not enough recorded metadata to map it" : `${G[r] ?? r}, ${i} confidence`;
461
- return /* @__PURE__ */ d(Ee, {
664
+ function G({ ghostHash: e, subject: t, resolution: n, method: r, confidence: i, className: a = "", ...o }) {
665
+ let s = n === "unresolved" ? "session-era commit, no longer in history; not enough recorded metadata to map it" : `${Ze[r] ?? r}, ${i} confidence`;
666
+ return /* @__PURE__ */ d(Ae, {
462
667
  content: s,
463
668
  children: /* @__PURE__ */ d("span", {
464
669
  className: `tlp-ghost-node tlp-terminal-${i}${a ? ` ${a}` : ""}`,
@@ -485,7 +690,7 @@ function Ue({ ghostHash: e, subject: t, resolution: n, method: r, confidence: i,
485
690
  }
486
691
  //#endregion
487
692
  //#region src/ui/graph/SessionLane.jsx
488
- function We({ sessionId: e, title: t, harness: n, hovered: r = !1, selected: i = !1, onHover: a, onSelect: o, unresolvedGhosts: s = [], className: c = "", ...l }) {
693
+ function Qe({ sessionId: e, title: t, harness: n, hovered: r = !1, selected: i = !1, onHover: a, onSelect: o, unresolvedGhosts: s = [], className: c = "", ...l }) {
489
694
  let u = [
490
695
  "tlp-session-lane",
491
696
  r && "tlp-session-lane-hover",
@@ -504,7 +709,7 @@ function We({ sessionId: e, title: t, harness: n, hovered: r = !1, selected: i =
504
709
  onBlur: () => a?.(null),
505
710
  onClick: () => o?.(e),
506
711
  ...l,
507
- children: [n && /* @__PURE__ */ d(B, {
712
+ children: [n && /* @__PURE__ */ d(W, {
508
713
  harness: n,
509
714
  label: !0
510
715
  }), /* @__PURE__ */ d("span", {
@@ -515,7 +720,7 @@ function We({ sessionId: e, title: t, harness: n, hovered: r = !1, selected: i =
515
720
  className: "tlp-session-lane-ghosts",
516
721
  role: "group",
517
722
  "aria-label": "session-era commits with no recorded mapping",
518
- children: s.map((e) => /* @__PURE__ */ d(Ue, {
723
+ children: s.map((e) => /* @__PURE__ */ d(G, {
519
724
  ghostHash: e.ghostHash,
520
725
  subject: e.subject,
521
726
  resolution: e.resolution,
@@ -527,7 +732,7 @@ function We({ sessionId: e, title: t, harness: n, hovered: r = !1, selected: i =
527
732
  }
528
733
  //#endregion
529
734
  //#region src/ui/graph/GhostGroup.jsx
530
- function Ge({ successorHash: e, ghosts: t, expanded: n, onToggle: r, className: i = "", ...a }) {
735
+ function $e({ successorHash: e, ghosts: t, expanded: n, onToggle: r, className: i = "", ...a }) {
531
736
  let o = `${t.length} session-era commit${t.length === 1 ? "" : "s"}`;
532
737
  return /* @__PURE__ */ f("div", {
533
738
  className: `tlp-ghost-group${i ? ` ${i}` : ""}`,
@@ -570,7 +775,7 @@ function Ge({ successorHash: e, ghosts: t, expanded: n, onToggle: r, className:
570
775
  ]
571
776
  }), n && /* @__PURE__ */ d("ul", {
572
777
  className: "tlp-ghost-group-list",
573
- children: t.map((e) => /* @__PURE__ */ f("li", { children: [/* @__PURE__ */ d(Ue, {
778
+ children: t.map((e) => /* @__PURE__ */ f("li", { children: [/* @__PURE__ */ d(G, {
574
779
  ghostHash: e.ghostHash,
575
780
  subject: e.subject,
576
781
  resolution: e.resolution,
@@ -585,7 +790,7 @@ function Ge({ successorHash: e, ghosts: t, expanded: n, onToggle: r, className:
585
790
  }
586
791
  //#endregion
587
792
  //#region src/ui/graph/SessionOverflowDisclosure.jsx
588
- function Ke({ commitHash: e, overflow: t, expanded: n, onToggle: r, onSelect: i, itemLabel: a = "sessions", className: o = "", ...s }) {
793
+ function et({ commitHash: e, overflow: t, expanded: n, onToggle: r, onSelect: i, itemLabel: a = "sessions", className: o = "", ...s }) {
589
794
  if (t.length === 0) return null;
590
795
  let c = t.length === 1 ? {
591
796
  sessions: "session",
@@ -617,7 +822,7 @@ function Ke({ commitHash: e, overflow: t, expanded: n, onToggle: r, onSelect: i,
617
822
  className: "tlp-overflow-item",
618
823
  "data-session-id": e.sessionId,
619
824
  onClick: () => i?.(e.sessionId),
620
- children: [e.harness && /* @__PURE__ */ d(B, {
825
+ children: [e.harness && /* @__PURE__ */ d(W, {
621
826
  harness: e.harness,
622
827
  label: !0
623
828
  }), e.title || e.sessionId]
@@ -627,7 +832,7 @@ function Ke({ commitHash: e, overflow: t, expanded: n, onToggle: r, onSelect: i,
627
832
  }
628
833
  //#endregion
629
834
  //#region src/ui/graph/HighlightEdge.jsx
630
- function qe({ weight: e, geometry: t, className: n = "", ...r }) {
835
+ function tt({ weight: e, geometry: t, className: n = "", ...r }) {
631
836
  return /* @__PURE__ */ d("line", {
632
837
  className: [
633
838
  "tlp-highlight-edge",
@@ -644,9 +849,9 @@ function qe({ weight: e, geometry: t, className: n = "", ...r }) {
644
849
  }
645
850
  //#endregion
646
851
  //#region src/ui/graph/TouchedFileCluster.jsx
647
- var Je = 8;
648
- function Ye({ commitHash: e, files: t, expanded: n, onToggle: r, onOpenDiff: i, className: a = "", ...o }) {
649
- let s = t.slice(0, Je), c = t.slice(Je).map((e) => ({
852
+ var nt = 8;
853
+ function rt({ commitHash: e, files: t, expanded: n, onToggle: r, onOpenDiff: i, className: a = "", ...o }) {
854
+ let s = t.slice(0, nt), c = t.slice(nt).map((e) => ({
650
855
  sessionId: e,
651
856
  title: e
652
857
  }));
@@ -660,7 +865,7 @@ function Ye({ commitHash: e, files: t, expanded: n, onToggle: r, onOpenDiff: i,
660
865
  className: "tlp-file-cluster-item",
661
866
  onClick: () => i?.(e),
662
867
  children: e
663
- }, e)), /* @__PURE__ */ d(Ke, {
868
+ }, e)), /* @__PURE__ */ d(et, {
664
869
  commitHash: e,
665
870
  overflow: c,
666
871
  expanded: n,
@@ -672,9 +877,9 @@ function Ye({ commitHash: e, files: t, expanded: n, onToggle: r, onOpenDiff: i,
672
877
  }
673
878
  //#endregion
674
879
  //#region src/ui/CommitGraph.jsx
675
- var Xe = 22, K = 13, Ze = 13, Qe = 9, $e = "3 3", q = (e) => K + e * Xe, et = (e) => q(Math.max(e - 1, 0)) + Ze;
676
- function tt({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpenSession: i, hasMore: a = !1, onShowOlder: u, label: p = "commit history", className: h = "", sessionLanes: g, hoveredSessionId: _ = null, selectedSessionId: v = null, onHoverSession: y, onSelectSession: b, highlightSelected: x, highlightHovered: S, ghostGroupsByCommit: ee, expandedGhostGroups: te, onToggleGhostGroup: ne, expandedCommitSessions: re, onToggleCommitSessions: ie, touchedFilesByCommit: ae, onOpenTouchedFile: oe, ...C }) {
677
- let se = s(() => new Set(te ?? []), [te]), ce = s(() => new Set(re ?? []), [re]), le = s(() => /* @__PURE__ */ new Set([...x?.commitHashes ?? [], ...x?.ghostHashes ?? []]), [x]), ue = s(() => /* @__PURE__ */ new Set([...S?.commitHashes ?? [], ...S?.ghostHashes ?? []]), [S]), w = s(() => e.reduce((e, t) => Math.max(e, (t.lane ?? 0) + 1), 1), [e]), T = s(() => {
880
+ var it = 22, at = 13, ot = 13, st = 9, ct = "3 3", K = (e) => at + e * it, lt = (e) => K(Math.max(e - 1, 0)) + ot;
881
+ function ut({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpenSession: i, hasMore: a = !1, onShowOlder: u, label: p = "commit history", className: h = "", sessionLanes: g, hoveredSessionId: _ = null, selectedSessionId: v = null, onHoverSession: y, onSelectSession: b, highlightSelected: x, highlightHovered: S, ghostGroupsByCommit: C, expandedGhostGroups: ee, onToggleGhostGroup: te, expandedCommitSessions: ne, onToggleCommitSessions: re, touchedFilesByCommit: ie, onOpenTouchedFile: ae, ...w }) {
882
+ let oe = s(() => new Set(ee ?? []), [ee]), se = s(() => new Set(ne ?? []), [ne]), ce = s(() => /* @__PURE__ */ new Set([...x?.commitHashes ?? [], ...x?.ghostHashes ?? []]), [x]), le = s(() => /* @__PURE__ */ new Set([...S?.commitHashes ?? [], ...S?.ghostHashes ?? []]), [S]), T = s(() => e.reduce((e, t) => Math.max(e, (t.lane ?? 0) + 1), 1), [e]), E = s(() => {
678
883
  let t = new Map(e.map((e) => [e.id, e.lane ?? 0])), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
679
884
  return e.forEach((e, t) => {
680
885
  let i = e.lane ?? 0;
@@ -695,8 +900,8 @@ function tt({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpen
695
900
  laneDown: i < c
696
901
  };
697
902
  });
698
- }, [e]), E = s(() => {
699
- let e = new Set(T.map((e) => e.commit.id)), t = new Set((g ?? []).map((e) => e.sessionId)), n = [...(x?.edges ?? []).map((e) => ({
903
+ }, [e]), D = s(() => {
904
+ let e = new Set(E.map((e) => e.commit.id)), t = new Set((g ?? []).map((e) => e.sessionId)), n = [...(x?.edges ?? []).map((e) => ({
700
905
  ...e,
701
906
  weight: "primary"
702
907
  })), ...(S?.edges ?? []).map((e) => ({
@@ -713,22 +918,22 @@ function tt({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpen
713
918
  }]);
714
919
  });
715
920
  }, [
716
- T,
921
+ E,
717
922
  g,
718
923
  x,
719
924
  S
720
- ]), D = c(null), [O, de] = l([]);
925
+ ]), O = c(null), [k, ue] = l([]);
721
926
  o(() => {
722
- let e = D.current;
723
- if (!e || E.length === 0) {
724
- de([]);
927
+ let e = O.current;
928
+ if (!e || D.length === 0) {
929
+ ue([]);
725
930
  return;
726
931
  }
727
932
  let t = () => {
728
933
  let t = e.querySelector(".cg-history");
729
934
  if (!t) return;
730
935
  let n = t.getBoundingClientRect(), r = new Map([...e.querySelectorAll("[data-timeline-session-id]")].map((e) => [e.getAttribute("data-timeline-session-id"), e])), i = new Map([...e.querySelectorAll(".cg-history-row[data-commit-hash]")].map((e) => [e.getAttribute("data-commit-hash"), e]));
731
- de(E.flatMap((e) => {
936
+ ue(D.flatMap((e) => {
732
937
  let t = r.get(e.sessionId)?.getBoundingClientRect(), a = i.get(e.commitHash)?.querySelector(".cg-dot")?.getBoundingClientRect();
733
938
  return !t || !a ? [] : [{
734
939
  ...e,
@@ -744,28 +949,28 @@ function tt({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpen
744
949
  if (t(), typeof ResizeObserver > "u") return;
745
950
  let n = new ResizeObserver(t);
746
951
  return n.observe(e), () => n.disconnect();
747
- }, [E]);
748
- let k = et(w), fe = ["cg", h].filter(Boolean).join(" ");
952
+ }, [D]);
953
+ let A = lt(T), de = ["cg", h].filter(Boolean).join(" ");
749
954
  return e.length === 0 ? /* @__PURE__ */ d("div", {
750
- className: fe,
751
- ...C,
955
+ className: de,
956
+ ...w,
752
957
  children: /* @__PURE__ */ d("p", {
753
958
  className: "cg-empty",
754
959
  children: "no commits to show."
755
960
  })
756
961
  }) : /* @__PURE__ */ f("div", {
757
- ref: D,
758
- className: fe,
962
+ ref: O,
963
+ className: de,
759
964
  role: "list",
760
965
  "aria-label": p,
761
- ...C,
966
+ ...w,
762
967
  children: [
763
968
  g && g.length > 0 && /* @__PURE__ */ d("div", {
764
969
  className: "cg-session-spine",
765
970
  role: "listitem",
766
971
  "aria-label": "recorded sessions",
767
972
  style: { gridTemplateColumns: `repeat(${g.length}, minmax(0, 1fr))` },
768
- children: g.map((e) => /* @__PURE__ */ d(We, {
973
+ children: g.map((e) => /* @__PURE__ */ d(Qe, {
769
974
  sessionId: e.sessionId,
770
975
  title: e.title,
771
976
  harness: e.harness,
@@ -779,40 +984,40 @@ function tt({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpen
779
984
  }),
780
985
  /* @__PURE__ */ f("div", {
781
986
  className: "cg-history",
782
- children: [O.length > 0 && /* @__PURE__ */ d("svg", {
987
+ children: [k.length > 0 && /* @__PURE__ */ d("svg", {
783
988
  className: "cg-highlight-layer",
784
989
  "aria-hidden": "true",
785
- children: O.map((e) => /* @__PURE__ */ d(qe, {
990
+ children: k.map((e) => /* @__PURE__ */ d(tt, {
786
991
  weight: e.weight,
787
992
  geometry: e.geometry,
788
993
  "data-session-id": e.sessionId,
789
994
  "data-commit-hash": e.commitHash
790
995
  }, e.key))
791
- }), T.map((e) => /* @__PURE__ */ f("div", {
996
+ }), E.map((e) => /* @__PURE__ */ f("div", {
792
997
  className: "cg-history-row",
793
998
  role: "listitem",
794
999
  "data-commit-hash": e.commit.id,
795
- children: [/* @__PURE__ */ d(nt, {
1000
+ children: [/* @__PURE__ */ d(dt, {
796
1001
  row: e,
797
- width: k,
1002
+ width: A,
798
1003
  selected: e.commit.id === t,
799
1004
  onNavigate: n,
800
1005
  onSelect: r,
801
1006
  onOpenSession: i,
802
- highlightWeight: le.has(e.commit.id) ? "primary" : ue.has(e.commit.id) ? "secondary" : null,
803
- expandedSessions: ce.has(e.commit.id),
804
- onToggleSessions: ie,
805
- touchedFiles: ae?.[e.commit.id] ?? [],
806
- expandedFiles: ce.has(`files:${e.commit.id}`),
807
- onOpenTouchedFile: oe
808
- }), ee?.[e.commit.id] && /* @__PURE__ */ d("div", {
1007
+ highlightWeight: ce.has(e.commit.id) ? "primary" : le.has(e.commit.id) ? "secondary" : null,
1008
+ expandedSessions: se.has(e.commit.id),
1009
+ onToggleSessions: re,
1010
+ touchedFiles: ie?.[e.commit.id] ?? [],
1011
+ expandedFiles: se.has(`files:${e.commit.id}`),
1012
+ onOpenTouchedFile: ae
1013
+ }), C?.[e.commit.id] && /* @__PURE__ */ d("div", {
809
1014
  className: "cg-ghost-row",
810
- style: { marginLeft: k },
811
- children: /* @__PURE__ */ d(Ge, {
1015
+ style: { marginLeft: A },
1016
+ children: /* @__PURE__ */ d($e, {
812
1017
  successorHash: e.commit.id,
813
- ghosts: ee[e.commit.id],
814
- expanded: se.has(e.commit.id),
815
- onToggle: ne
1018
+ ghosts: C[e.commit.id],
1019
+ expanded: oe.has(e.commit.id),
1020
+ onToggle: te
816
1021
  })
817
1022
  })]
818
1023
  }, e.commit.id))]
@@ -822,20 +1027,20 @@ function tt({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpen
822
1027
  role: "listitem",
823
1028
  children: [/* @__PURE__ */ d("span", {
824
1029
  className: "cg-gutter cg-gutter-older",
825
- style: { width: k },
1030
+ style: { width: A },
826
1031
  "aria-hidden": "true",
827
1032
  children: /* @__PURE__ */ d("svg", {
828
1033
  className: "cg-svg",
829
- width: k,
1034
+ width: A,
830
1035
  height: "100%",
831
1036
  preserveAspectRatio: "none",
832
1037
  children: /* @__PURE__ */ d("line", {
833
1038
  className: "cg-stroke-lane0",
834
- x1: q(0),
1039
+ x1: K(0),
835
1040
  y1: "0",
836
- x2: q(0),
1041
+ x2: K(0),
837
1042
  y2: "60%",
838
- strokeDasharray: $e
1043
+ strokeDasharray: ct
839
1044
  })
840
1045
  })
841
1046
  }), /* @__PURE__ */ f("button", {
@@ -853,13 +1058,13 @@ function tt({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpen
853
1058
  ]
854
1059
  });
855
1060
  }
856
- function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenSession: a, highlightWeight: o = null, expandedSessions: s = !1, onToggleSessions: c, touchedFiles: l = [], expandedFiles: u = !1, onOpenTouchedFile: p }) {
1061
+ function dt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenSession: a, highlightWeight: o = null, expandedSessions: s = !1, onToggleSessions: c, touchedFiles: l = [], expandedFiles: u = !1, onOpenTouchedFile: p }) {
857
1062
  let { commit: m, lane: h, joins: g, passLanes: _, laneUp: v, laneDown: y } = e, b = !!m.session, S = [
858
1063
  "cg-dot",
859
1064
  b ? "cg-dot-filled" : "cg-dot-hollow",
860
1065
  n && "cg-dot-sel",
861
1066
  o && `cg-dot-highlight-${o}`
862
- ].filter(Boolean).join(" "), ee = m.sessionRefs?.slice(0, 2) ?? [], te = m.sessionRefs?.slice(2) ?? [], ne = ["cg-row", n && "cg-row-sel"].filter(Boolean).join(" ");
1067
+ ].filter(Boolean).join(" "), C = m.sessionRefs?.slice(0, 2) ?? [], ee = m.sessionRefs?.slice(2) ?? [], te = ["cg-row", n && "cg-row-sel"].filter(Boolean).join(" ");
863
1068
  return /* @__PURE__ */ f("div", {
864
1069
  className: "cg-band",
865
1070
  children: [/* @__PURE__ */ f("span", {
@@ -875,38 +1080,38 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
875
1080
  children: [
876
1081
  v && /* @__PURE__ */ d("line", {
877
1082
  className: "cg-stroke-self",
878
- x1: q(h),
1083
+ x1: K(h),
879
1084
  y1: "0",
880
- x2: q(h),
1085
+ x2: K(h),
881
1086
  y2: "50%"
882
1087
  }),
883
1088
  y && /* @__PURE__ */ d("line", {
884
1089
  className: "cg-stroke-self",
885
- x1: q(h),
1090
+ x1: K(h),
886
1091
  y1: "50%",
887
- x2: q(h),
1092
+ x2: K(h),
888
1093
  y2: "100%"
889
1094
  }),
890
1095
  _.map((e) => /* @__PURE__ */ d("line", {
891
1096
  className: e === 0 ? "cg-stroke-lane0" : "cg-stroke-branch",
892
- x1: q(e),
1097
+ x1: K(e),
893
1098
  y1: "0",
894
- x2: q(e),
1099
+ x2: K(e),
895
1100
  y2: "100%"
896
1101
  }, e)),
897
1102
  g.map((e, t) => /* @__PURE__ */ f("g", {
898
1103
  className: "cg-elbow",
899
1104
  children: [/* @__PURE__ */ d("line", {
900
1105
  className: "cg-stroke-branch",
901
- x1: q(e.to),
1106
+ x1: K(e.to),
902
1107
  y1: "50%",
903
- x2: q(e.to),
1108
+ x2: K(e.to),
904
1109
  y2: "100%"
905
1110
  }), /* @__PURE__ */ d("line", {
906
1111
  className: "cg-stroke-branch",
907
- x1: q(e.to),
1112
+ x1: K(e.to),
908
1113
  y1: "50%",
909
- x2: q(e.from),
1114
+ x2: K(e.from),
910
1115
  y2: "50%"
911
1116
  })]
912
1117
  }, t))
@@ -915,17 +1120,17 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
915
1120
  /* @__PURE__ */ d("span", {
916
1121
  className: S,
917
1122
  style: {
918
- left: q(h),
1123
+ left: K(h),
919
1124
  ...b ? null : {
920
- width: Qe,
921
- height: Qe
1125
+ width: st,
1126
+ height: st
922
1127
  }
923
1128
  },
924
1129
  "data-has-session": b || void 0
925
1130
  }),
926
- b && /* @__PURE__ */ d(ie, {
1131
+ b && /* @__PURE__ */ d(re, {
927
1132
  className: "cg-spark",
928
- style: { left: q(h) },
1133
+ style: { left: K(h) },
929
1134
  "aria-hidden": "true"
930
1135
  })
931
1136
  ]
@@ -934,7 +1139,7 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
934
1139
  children: [
935
1140
  /* @__PURE__ */ f("button", {
936
1141
  type: "button",
937
- className: ne,
1142
+ className: te,
938
1143
  onClick: () => {
939
1144
  r ? r({
940
1145
  type: "open-change",
@@ -981,7 +1186,7 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
981
1186
  className: "cg-sessions",
982
1187
  role: "group",
983
1188
  "aria-label": `sessions linked to ${m.message}`,
984
- children: [ee.map((e) => /* @__PURE__ */ f("button", {
1189
+ children: [C.map((e) => /* @__PURE__ */ f("button", {
985
1190
  type: "button",
986
1191
  className: "cg-session",
987
1192
  onClick: () => {
@@ -998,7 +1203,7 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
998
1203
  }) : a?.(e.sessionId);
999
1204
  },
1000
1205
  children: [
1001
- /* @__PURE__ */ d(He, { harness: e.harness }),
1206
+ /* @__PURE__ */ d(qe, { harness: e.harness }),
1002
1207
  /* @__PURE__ */ d("span", {
1003
1208
  className: "cg-session-title",
1004
1209
  children: e.title || e.sessionId
@@ -1006,12 +1211,12 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
1006
1211
  e.startMs != null && /* @__PURE__ */ d("time", {
1007
1212
  className: "cg-session-time tnum",
1008
1213
  dateTime: new Date(e.startMs).toISOString(),
1009
- children: W(e.startMs)
1214
+ children: Xe(e.startMs)
1010
1215
  })
1011
1216
  ]
1012
- }, e.sessionId)), te.length > 0 && /* @__PURE__ */ d(Ke, {
1217
+ }, e.sessionId)), ee.length > 0 && /* @__PURE__ */ d(et, {
1013
1218
  commitHash: m.id,
1014
- overflow: te,
1219
+ overflow: ee,
1015
1220
  expanded: s,
1016
1221
  onToggle: c ?? (() => {}),
1017
1222
  onSelect: (e) => {
@@ -1031,7 +1236,7 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
1031
1236
  }),
1032
1237
  l.length > 0 && /* @__PURE__ */ d("div", {
1033
1238
  className: "cg-touched-files",
1034
- children: /* @__PURE__ */ d(Ye, {
1239
+ children: /* @__PURE__ */ d(rt, {
1035
1240
  commitHash: `files:${m.id}`,
1036
1241
  files: l,
1037
1242
  expanded: u,
@@ -1045,7 +1250,7 @@ function nt({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenS
1045
1250
  }
1046
1251
  //#endregion
1047
1252
  //#region src/ui/DiffView.jsx
1048
- function rt(e) {
1253
+ function ft(e) {
1049
1254
  let t = 0, n = 0;
1050
1255
  for (let r of e) for (let e of r.lines) e.type === "add" ? t++ : e.type === "del" && n++;
1051
1256
  return {
@@ -1053,8 +1258,8 @@ function rt(e) {
1053
1258
  dels: n
1054
1259
  };
1055
1260
  }
1056
- function it({ line: e }) {
1057
- let { type: t, oldNo: n, newNo: r, text: i } = e, a = t === "add" ? te : t === "del" ? ee : null;
1261
+ function pt({ line: e }) {
1262
+ let { type: t, oldNo: n, newNo: r, text: i } = e, a = t === "add" ? ee : t === "del" ? C : null;
1058
1263
  return /* @__PURE__ */ f("div", {
1059
1264
  className: `dv-line dv-${t}`,
1060
1265
  role: "row",
@@ -1090,7 +1295,7 @@ function it({ line: e }) {
1090
1295
  ]
1091
1296
  });
1092
1297
  }
1093
- function at({ match: e }) {
1298
+ function mt({ match: e }) {
1094
1299
  let { category: t, confidence: n, original: r, replacement: i, oldNo: a, newNo: o } = e, [s, c] = l(!1), u = n < .7, p = n.toFixed(2);
1095
1300
  return /* @__PURE__ */ f("div", {
1096
1301
  className: `dv-match${s ? " dv-match-kept" : ""}`,
@@ -1151,7 +1356,7 @@ function at({ match: e }) {
1151
1356
  className: "dv-sign",
1152
1357
  role: "cell",
1153
1358
  "aria-hidden": "true",
1154
- children: /* @__PURE__ */ d(ee, { "aria-hidden": "true" })
1359
+ children: /* @__PURE__ */ d(C, { "aria-hidden": "true" })
1155
1360
  }),
1156
1361
  /* @__PURE__ */ f("span", {
1157
1362
  className: "dv-text",
@@ -1186,7 +1391,7 @@ function at({ match: e }) {
1186
1391
  className: "dv-sign",
1187
1392
  role: "cell",
1188
1393
  "aria-hidden": "true",
1189
- children: /* @__PURE__ */ d(te, { "aria-hidden": "true" })
1394
+ children: /* @__PURE__ */ d(ee, { "aria-hidden": "true" })
1190
1395
  }),
1191
1396
  /* @__PURE__ */ f("span", {
1192
1397
  className: "dv-text",
@@ -1201,8 +1406,8 @@ function at({ match: e }) {
1201
1406
  })]
1202
1407
  });
1203
1408
  }
1204
- function ot({ file: e, hunks: t = [], matches: n = [], variant: r = "default", className: i = "", ...a }) {
1205
- let o = r === "redaction", s = o ? null : rt(t);
1409
+ function ht({ file: e, hunks: t = [], matches: n = [], variant: r = "default", className: i = "", ...a }) {
1410
+ let o = r === "redaction", s = o ? null : ft(t);
1206
1411
  return /* @__PURE__ */ f("figure", {
1207
1412
  className: [
1208
1413
  "dv",
@@ -1241,7 +1446,7 @@ function ot({ file: e, hunks: t = [], matches: n = [], variant: r = "default", c
1241
1446
  children: n.length === 0 ? /* @__PURE__ */ d("p", {
1242
1447
  className: "dv-empty",
1243
1448
  children: "no sensitive content detected. safe to share as-is."
1244
- }) : n.map((e, t) => /* @__PURE__ */ d(at, { match: e }, e.id ?? t))
1449
+ }) : n.map((e, t) => /* @__PURE__ */ d(mt, { match: e }, e.id ?? t))
1245
1450
  }) : /* @__PURE__ */ d("div", {
1246
1451
  className: "dv-body",
1247
1452
  role: "table",
@@ -1272,7 +1477,7 @@ function ot({ file: e, hunks: t = [], matches: n = [], variant: r = "default", c
1272
1477
  }), /* @__PURE__ */ d("div", {
1273
1478
  className: "dv-hunk-pair",
1274
1479
  role: "rowgroup",
1275
- children: e.lines.map((e, t) => /* @__PURE__ */ d(it, { line: e }, t))
1480
+ children: e.lines.map((e, t) => /* @__PURE__ */ d(pt, { line: e }, t))
1276
1481
  })]
1277
1482
  }, t))
1278
1483
  })]
@@ -1280,8 +1485,8 @@ function ot({ file: e, hunks: t = [], matches: n = [], variant: r = "default", c
1280
1485
  }
1281
1486
  //#endregion
1282
1487
  //#region src/ui/graph/types.js
1283
- var st = E, ct = se, lt = le, ut = ue, dt = ce;
1284
- function J(e, t, n, r, i) {
1488
+ var gt = D, _t = oe, vt = ce, yt = le, bt = se;
1489
+ function xt(e, t, n, r, i) {
1285
1490
  if (e(t)) return;
1286
1491
  let a;
1287
1492
  try {
@@ -1291,62 +1496,62 @@ function J(e, t, n, r, i) {
1291
1496
  }
1292
1497
  throw TypeError(`Graph contract validation failed for ${a} at src/ui/graph/types.js during ${r}: ${n} is outside the canonical @peasant-labs/schema value domain (${i.join(", ")}), so Fairtrade cannot safely render this graph payload; the caller must validate and normalize the local API response before passing it to the cooked graph surface.`);
1293
1498
  }
1294
- function ft(e) {
1295
- for (let [t, n] of e.nodes.entries()) J(ve, n.kind, `nodes[${t}].kind`, "code-map payload rendering", E);
1296
- for (let [t, n] of e.violations.entries()) J(pe, n.kind, `violations[${t}].kind`, "code-map payload rendering", le);
1499
+ function St(e) {
1500
+ for (let [t, n] of e.nodes.entries()) xt(_e, n.kind, `nodes[${t}].kind`, "code-map payload rendering", D);
1501
+ for (let [t, n] of e.violations.entries()) xt(fe, n.kind, `violations[${t}].kind`, "code-map payload rendering", ce);
1297
1502
  }
1298
- function pt(e) {
1299
- for (let [t, n] of e.files.entries()) J(me, n.status, `files[${t}].status`, "change-detail payload rendering", ue);
1300
- for (let [t, n] of e.work.entries()) J(k, n.binding, `work[${t}].binding`, "change-detail payload rendering", se);
1301
- for (let [t, n] of e.slice.nodes.entries()) J(ve, n.kind, `slice.nodes[${t}].kind`, "change-detail payload rendering", E);
1302
- for (let [t, n] of e.violations.entries()) J(pe, n.kind, `violations[${t}].kind`, "change-detail payload rendering", le);
1503
+ function Ct(e) {
1504
+ for (let [t, n] of e.files.entries()) xt(pe, n.status, `files[${t}].status`, "change-detail payload rendering", le);
1505
+ for (let [t, n] of e.work.entries()) xt(A, n.binding, `work[${t}].binding`, "change-detail payload rendering", oe);
1506
+ for (let [t, n] of e.slice.nodes.entries()) xt(_e, n.kind, `slice.nodes[${t}].kind`, "change-detail payload rendering", D);
1507
+ for (let [t, n] of e.violations.entries()) xt(fe, n.kind, `violations[${t}].kind`, "change-detail payload rendering", ce);
1303
1508
  }
1304
- function mt(e) {
1305
- J(me, e.status, "status", "change-diff payload rendering", ue);
1306
- for (let [t, n] of e.hunks.entries()) for (let [e, r] of n.lines.entries()) J(fe, r.kind, `hunks[${t}].lines[${e}].kind`, "change-diff payload rendering", ce);
1509
+ function wt(e) {
1510
+ xt(pe, e.status, "status", "change-diff payload rendering", le);
1511
+ for (let [t, n] of e.hunks.entries()) for (let [e, r] of n.lines.entries()) xt(de, r.kind, `hunks[${t}].lines[${e}].kind`, "change-diff payload rendering", se);
1307
1512
  }
1308
1513
  //#endregion
1309
1514
  //#region src/ui/graph/graphContractPolicy.js
1310
- var ht = Object.freeze({
1515
+ var q = Object.freeze({
1311
1516
  decision: "decisions",
1312
1517
  friction: "friction",
1313
1518
  unusual: "unusual signals",
1314
1519
  retry_loop: "retry loops"
1315
- }), gt = Object.freeze({
1520
+ }), Tt = Object.freeze({
1316
1521
  mechanical: Object.freeze({ markerClass: "tlp-insight-provenance-mechanical" }),
1317
1522
  mined: Object.freeze({ markerClass: "tlp-insight-provenance-mined" })
1318
1523
  });
1319
- yt(), bt();
1320
- function _t(e) {
1321
- let t = e.findIndex((e) => !ge(e.kind) || !_e(e.provenance));
1322
- if (t !== -1) throw xt("validate insight values", `insights[${t}]`, `the insight kind or provenance is outside the canonical @peasant-labs/schema value domain (kinds: ${w.join(", ")}; provenances: ${T.join(", ")})`, "validate and normalize the local API response to the published @peasant-labs/schema contract before rendering");
1323
- }
1324
- function vt(e) {
1325
- let t = e.findIndex((e) => !ye(e.readAttribution) || !A(e.readState));
1326
- if (t !== -1) throw xt("validate ranking values", `nodes[${t}]`, `the read-attribution state or read-state grade is outside the canonical @peasant-labs/schema value domain (attribution states: ${D.join(", ")}; read-state grades: ${O.join(", ")})`, "validate and normalize the local API response to the published @peasant-labs/schema contract before ranking");
1327
- }
1328
- function yt() {
1329
- let e = Object.keys(ht), t = w.filter((e) => typeof ht[e] != "string" || ht[e].trim() === ""), n = e.filter((e) => !ge(e));
1330
- if (!(t.length === 0 && n.length === 0 && e.length === w.length)) throw xt("validate insight labels", "INSIGHT_KIND_LABELS", `the Fairtrade label map does not exactly cover the canonical @peasant-labs/schema insight kinds (missing: ${t.join(", ") || "none"}; unknown: ${n.join(", ") || "none"})`, "add one non-empty Fairtrade UI label for each published insight kind and remove labels that are no longer in the schema contract");
1331
- }
1332
- function bt() {
1333
- let e = Object.keys(gt), t = T.filter((e) => {
1334
- let t = gt[e];
1524
+ Ot(), kt();
1525
+ function Et(e) {
1526
+ let t = e.findIndex((e) => !he(e.kind) || !ge(e.provenance));
1527
+ if (t !== -1) throw At("validate insight values", `insights[${t}]`, `the insight kind or provenance is outside the canonical @peasant-labs/schema value domain (kinds: ${T.join(", ")}; provenances: ${E.join(", ")})`, "validate and normalize the local API response to the published @peasant-labs/schema contract before rendering");
1528
+ }
1529
+ function Dt(e) {
1530
+ let t = e.findIndex((e) => !ve(e.readAttribution) || !j(e.readState));
1531
+ if (t !== -1) throw At("validate ranking values", `nodes[${t}]`, `the read-attribution state or read-state grade is outside the canonical @peasant-labs/schema value domain (attribution states: ${O.join(", ")}; read-state grades: ${k.join(", ")})`, "validate and normalize the local API response to the published @peasant-labs/schema contract before ranking");
1532
+ }
1533
+ function Ot() {
1534
+ let e = Object.keys(q), t = T.filter((e) => typeof q[e] != "string" || q[e].trim() === ""), n = e.filter((e) => !he(e));
1535
+ if (!(t.length === 0 && n.length === 0 && e.length === T.length)) throw At("validate insight labels", "INSIGHT_KIND_LABELS", `the Fairtrade label map does not exactly cover the canonical @peasant-labs/schema insight kinds (missing: ${t.join(", ") || "none"}; unknown: ${n.join(", ") || "none"})`, "add one non-empty Fairtrade UI label for each published insight kind and remove labels that are no longer in the schema contract");
1536
+ }
1537
+ function kt() {
1538
+ let e = Object.keys(Tt), t = E.filter((e) => {
1539
+ let t = Tt[e];
1335
1540
  return !t || typeof t.markerClass != "string" || t.markerClass.trim() === "";
1336
- }), n = e.filter((e) => !_e(e));
1337
- if (!(t.length === 0 && n.length === 0 && e.length === T.length)) throw xt("validate insight provenance presentations", "INSIGHT_PROVENANCE_PRESENTATIONS", `the Fairtrade provenance presentation map does not exactly cover the canonical @peasant-labs/schema insight provenances (missing: ${t.join(", ") || "none"}; unknown: ${n.join(", ") || "none"})`, "add one explicit Fairtrade marker class for each published insight provenance and remove presentations that are no longer in the schema contract");
1541
+ }), n = e.filter((e) => !ge(e));
1542
+ if (!(t.length === 0 && n.length === 0 && e.length === E.length)) throw At("validate insight provenance presentations", "INSIGHT_PROVENANCE_PRESENTATIONS", `the Fairtrade provenance presentation map does not exactly cover the canonical @peasant-labs/schema insight provenances (missing: ${t.join(", ") || "none"}; unknown: ${n.join(", ") || "none"})`, "add one explicit Fairtrade marker class for each published insight provenance and remove presentations that are no longer in the schema contract");
1338
1543
  }
1339
- function xt(e, t, n, r) {
1544
+ function At(e, t, n, r) {
1340
1545
  return /* @__PURE__ */ Error(`Fairtrade graph contract ${e} failed: what went wrong: invalid ${t}; why: ${n}; where: src/ui/graph/graphContractPolicy.js ${t}; when: ${e}; what it means: Fairtrade cannot render the graph value without guessing; how to fix: ${r}.`);
1341
1546
  }
1342
1547
  //#endregion
1343
1548
  //#region src/ui/graph/ranking.js
1344
- var St = Object.freeze({
1549
+ var jt = Object.freeze({
1345
1550
  touch: .35,
1346
1551
  effortDensity: .25,
1347
1552
  debt: .25,
1348
1553
  recency: .15
1349
- }), Ct = .5, wt = .9, Tt = 14, Et = 5, Dt = 25, Ot = Object.freeze([
1554
+ }), Mt = .5, Nt = .9, Pt = 14, Ft = 5, It = 25, Lt = Object.freeze([
1350
1555
  "agent wrote: no recorded read",
1351
1556
  "agent wrote: viewed, not reviewed",
1352
1557
  "agent wrote: read state unknown",
@@ -1354,38 +1559,38 @@ var St = Object.freeze({
1354
1559
  "edited this session",
1355
1560
  "high effort density",
1356
1561
  "near your focus"
1357
- ]), kt = .75, At = .75, jt = 1, Mt = /* @__PURE__ */ new Set([
1562
+ ]), Rt = .75, zt = .75, Bt = 1, Vt = /* @__PURE__ */ new Set([
1358
1563
  "relevance",
1359
1564
  "debt",
1360
1565
  "churn"
1361
- ]), Nt = "Use this as a prompt to inspect recorded evidence, not as a verdict about the reader.";
1362
- function Pt(e) {
1566
+ ]), Ht = "Use this as a prompt to inspect recorded evidence, not as a verdict about the reader.";
1567
+ function Ut(e) {
1363
1568
  if (e.agentEditedCount === 0) return "none";
1364
1569
  if (e.readAttribution === "unavailable") return "unknown";
1365
1570
  let t = e.changedRegionCount > e.attributedRegionCount, n = e.attributedRegionCount > 0 ? e.reviewedRegionCount / e.attributedRegionCount : 0, r = e.attributedRegionCount > 0 && n === 1 && !t;
1366
1571
  return e.readState === "reviewed" || e.readState === "reviewed_in_detail" || r ? "reviewed" : e.attributedRegionCount > 0 && e.reviewedRegionCount > 0 ? "partial-read" : e.readState === "viewed" ? "viewed" : e.readCount === 0 ? "no-recorded-read" : "partial-read";
1367
1572
  }
1368
- function Ft(e, t) {
1573
+ function Wt(e, t) {
1369
1574
  if (t === "no-recorded-read") return 1;
1370
1575
  if (t === "partial-read") {
1371
1576
  if (e.attributedRegionCount > 0) {
1372
- let t = It(e), n = e.agentEditedCount > 0 ? e.readCount / e.agentEditedCount : 0;
1373
- return Gt(1 - Math.max(t, n));
1577
+ let t = Gt(e), n = e.agentEditedCount > 0 ? e.readCount / e.agentEditedCount : 0;
1578
+ return en(1 - Math.max(t, n));
1374
1579
  }
1375
- return Gt(1 - (e.agentEditedCount > 0 ? e.readCount / e.agentEditedCount : 0));
1580
+ return en(1 - (e.agentEditedCount > 0 ? e.readCount / e.agentEditedCount : 0));
1376
1581
  }
1377
- return t === "viewed" ? Ct : 0;
1582
+ return t === "viewed" ? Mt : 0;
1378
1583
  }
1379
- function It(e) {
1584
+ function Gt(e) {
1380
1585
  let t = e.changedRegionCount > e.attributedRegionCount, n = e.attributedRegionCount > 0 ? e.reviewedRegionCount / e.attributedRegionCount : 0;
1381
- return Gt(t ? Math.min(n, wt) : n);
1586
+ return en(t ? Math.min(n, Nt) : n);
1382
1587
  }
1383
- function Lt(e) {
1588
+ function Kt(e) {
1384
1589
  let t = e.changedRegionCount > e.attributedRegionCount, n = e.attributedRegionCount > 0 ? e.reviewedRegionCount / e.attributedRegionCount : 0;
1385
1590
  return e.attributedRegionCount > 0 && n === 1 && !t;
1386
1591
  }
1387
- function Rt(e) {
1388
- if (Pt(e) !== "partial-read") return null;
1592
+ function qt(e) {
1593
+ if (Ut(e) !== "partial-read") return null;
1389
1594
  let t = e.attributedRegionCount;
1390
1595
  if (t > 0 && e.reviewedRegionCount > 0) {
1391
1596
  let n = e.reviewedRegionCount, r = t;
@@ -1393,80 +1598,80 @@ function Rt(e) {
1393
1598
  }
1394
1599
  return "some sessions that edited this file were read; per-region coverage is not available";
1395
1600
  }
1396
- function zt(e, t) {
1397
- if (t === "no-recorded-read") return `No read evidence was recorded for sessions that edited this file. ${Nt}`;
1398
- if (t === "viewed") return `A view was recorded, but no explicit review was recorded. ${Nt}`;
1399
- if (t === "unknown") return `No read events were recorded for the sessions that edited this file, so its read state is unknown. ${Nt}`;
1601
+ function Jt(e, t) {
1602
+ if (t === "no-recorded-read") return `No read evidence was recorded for sessions that edited this file. ${Ht}`;
1603
+ if (t === "viewed") return `A view was recorded, but no explicit review was recorded. ${Ht}`;
1604
+ if (t === "unknown") return `No read events were recorded for the sessions that edited this file, so its read state is unknown. ${Ht}`;
1400
1605
  if (t === "partial-read") {
1401
- let t = Rt(e);
1402
- return t ? `${t}. ${Nt}` : Nt;
1606
+ let t = qt(e);
1607
+ return t ? `${t}. ${Ht}` : Ht;
1403
1608
  }
1404
1609
  return null;
1405
1610
  }
1406
- function Bt(e, t, n = {}) {
1611
+ function Yt(e, t, n = {}) {
1407
1612
  let r = [];
1408
- if (t === "no-recorded-read" ? r.push("agent wrote: no recorded read") : t === "unknown" ? r.push("agent wrote: read state unknown") : (t === "viewed" || t === "partial-read") && r.push("agent wrote: viewed, not reviewed"), n.hoveredOrSelectedSessionId && e.recentSessionId === n.hoveredOrSelectedSessionId && r.length < 2 && r.push("edited this session"), n.maxTouch && n.maxTouch > 0 && e.touchCount / n.maxTouch >= kt && r.length < 2 && r.push("heavy churn"), e.effortDensity >= At && r.length < 2 && r.push("high effort density"), n.focusId && n.parentOf) {
1409
- let t = n.distanceToFocus === void 0 ? Vt(e.id, n.focusId, n.parentOf) : n.distanceToFocus;
1410
- t !== null && t <= jt && r.length < 2 && r.push("near your focus");
1613
+ if (t === "no-recorded-read" ? r.push("agent wrote: no recorded read") : t === "unknown" ? r.push("agent wrote: read state unknown") : (t === "viewed" || t === "partial-read") && r.push("agent wrote: viewed, not reviewed"), n.hoveredOrSelectedSessionId && e.recentSessionId === n.hoveredOrSelectedSessionId && r.length < 2 && r.push("edited this session"), n.maxTouch && n.maxTouch > 0 && e.touchCount / n.maxTouch >= Rt && r.length < 2 && r.push("heavy churn"), e.effortDensity >= zt && r.length < 2 && r.push("high effort density"), n.focusId && n.parentOf) {
1614
+ let t = n.distanceToFocus === void 0 ? Xt(e.id, n.focusId, n.parentOf) : n.distanceToFocus;
1615
+ t !== null && t <= Bt && r.length < 2 && r.push("near your focus");
1411
1616
  }
1412
1617
  return r.slice(0, 2);
1413
1618
  }
1414
- function Vt(e, t, n) {
1619
+ function Xt(e, t, n) {
1415
1620
  if (e === t) return 0;
1416
- let r = Ht(e, n), i = Ht(t, n), a = new Map(r.map((e, t) => [e, t]));
1621
+ let r = Zt(e, n), i = Zt(t, n), a = new Map(r.map((e, t) => [e, t]));
1417
1622
  for (let [e, t] of i.entries()) if (a.has(t)) return (a.get(t) ?? 0) + e;
1418
1623
  return null;
1419
1624
  }
1420
- function Ht(e, t) {
1625
+ function Zt(e, t) {
1421
1626
  let n = [e], r = t.get(e) ?? null, i = 0;
1422
1627
  for (; r && i < 1e4;) n.push(r), r = t.get(r) ?? null, i += 1;
1423
1628
  return n;
1424
1629
  }
1425
- function Ut(e) {
1630
+ function Qt(e) {
1426
1631
  let t = Math.min(...e), n = Math.max(...e);
1427
1632
  return !Number.isFinite(t) || !Number.isFinite(n) || n === t ? e.map(() => 0) : e.map((e) => (e - t) / (n - t));
1428
1633
  }
1429
- function Wt(e, t) {
1430
- return e.lastTouchMs == null || !Number.isFinite(t) ? 0 : Gt(.5 ** (Math.max(0, t - e.lastTouchMs) / (336 * 60 * 60 * 1e3)));
1634
+ function $t(e, t) {
1635
+ return e.lastTouchMs == null || !Number.isFinite(t) ? 0 : en(.5 ** (Math.max(0, t - e.lastTouchMs) / (336 * 60 * 60 * 1e3)));
1431
1636
  }
1432
- function Gt(e) {
1637
+ function en(e) {
1433
1638
  return Math.round(Math.max(0, Math.min(1, e)) * 1e9) / 1e9;
1434
1639
  }
1435
- function Kt(e) {
1436
- if (e === "relevance") return St;
1437
- let t = e === "debt" ? "debt" : "touch", n = Object.keys(St).filter((e) => e !== t), r = n.reduce((e, t) => e + St[t], 0), i = r > 0 ? .3 / r : 0, a = { [t]: .7 };
1438
- for (let e of n) a[e] = St[e] * i;
1640
+ function tn(e) {
1641
+ if (e === "relevance") return jt;
1642
+ let t = e === "debt" ? "debt" : "touch", n = Object.keys(jt).filter((e) => e !== t), r = n.reduce((e, t) => e + jt[t], 0), i = r > 0 ? .3 / r : 0, a = { [t]: .7 };
1643
+ for (let e of n) a[e] = jt[e] * i;
1439
1644
  return a;
1440
1645
  }
1441
- function qt(e) {
1646
+ function nn(e) {
1442
1647
  return e === "no-recorded-read" || e === "partial-read" || e === "viewed" ? 0 : e === "unknown" ? 1 : 2;
1443
1648
  }
1444
- function Jt(e, t = {}) {
1649
+ function rn(e, t = {}) {
1445
1650
  let n = t.rankMode ?? "relevance";
1446
- if (!Mt.has(n)) throw $t("compute intrinsic ranking", "rankMode", `value ${JSON.stringify(n)} is unsupported`, "use relevance, debt, or churn");
1447
- vt(e);
1448
- let r = t.nowMs ?? Date.now(), i = Kt(n), a = new Map(e.map((e) => [e.id, e.parent ?? null])), o = e.reduce((e, t) => Math.max(e, t.touchCount), 0), s = Ut(e.map((e) => Math.log1p(Math.max(0, e.touchCount))));
1651
+ if (!Vt.has(n)) throw ln("compute intrinsic ranking", "rankMode", `value ${JSON.stringify(n)} is unsupported`, "use relevance, debt, or churn");
1652
+ Dt(e);
1653
+ let r = t.nowMs ?? Date.now(), i = tn(n), a = new Map(e.map((e) => [e.id, e.parent ?? null])), o = e.reduce((e, t) => Math.max(e, t.touchCount), 0), s = Qt(e.map((e) => Math.log1p(Math.max(0, e.touchCount))));
1449
1654
  return {
1450
1655
  rankMode: n,
1451
1656
  rows: e.map((e, t) => {
1452
- let n = Pt(e), a = Ft(e, n);
1657
+ let n = Ut(e), a = Wt(e, n);
1453
1658
  return {
1454
1659
  node: e,
1455
- intrinsic: i.touch * s[t] + i.effortDensity * Gt(e.effortDensity) + i.debt * a + i.recency * Wt(e, r),
1660
+ intrinsic: i.touch * s[t] + i.effortDensity * en(e.effortDensity) + i.debt * a + i.recency * $t(e, r),
1456
1661
  debtState: n,
1457
1662
  debt: a,
1458
- coverage: It(e),
1459
- hunkClears: Lt(e),
1460
- hoverText: zt(e, n)
1663
+ coverage: Gt(e),
1664
+ hunkClears: Kt(e),
1665
+ hoverText: Jt(e, n)
1461
1666
  };
1462
1667
  }),
1463
1668
  parentOf: a,
1464
1669
  maxTouch: o
1465
1670
  };
1466
1671
  }
1467
- function Yt(e, t = {}) {
1468
- if (t.scentFilter != null && !Ot.includes(t.scentFilter)) throw $t("derive ranked rows", "scentFilter", `value ${JSON.stringify(t.scentFilter)} is unsupported`, `use null or one of ${Ot.join(", ")}`);
1469
- let { rankMode: n, parentOf: r, maxTouch: i } = e, a = t.focusId ? Xt(t.focusId, r) : null, o = e.rows.map((e) => {
1672
+ function an(e, t = {}) {
1673
+ if (t.scentFilter != null && !Lt.includes(t.scentFilter)) throw ln("derive ranked rows", "scentFilter", `value ${JSON.stringify(t.scentFilter)} is unsupported`, `use null or one of ${Lt.join(", ")}`);
1674
+ let { rankMode: n, parentOf: r, maxTouch: i } = e, a = t.focusId ? on(t.focusId, r) : null, o = e.rows.map((e) => {
1470
1675
  let { node: n } = e, o = 0;
1471
1676
  if (t.focusId) {
1472
1677
  let e = a?.get(n.id) ?? null;
@@ -1475,12 +1680,12 @@ function Yt(e, t = {}) {
1475
1680
  return {
1476
1681
  id: n.id,
1477
1682
  name: n.name,
1478
- doi: Gt(e.intrinsic - o),
1683
+ doi: en(e.intrinsic - o),
1479
1684
  debtState: e.debtState,
1480
1685
  debt: e.debt,
1481
1686
  coverage: e.coverage,
1482
1687
  hunkClears: e.hunkClears,
1483
- scentTags: Bt(n, e.debtState, {
1688
+ scentTags: Yt(n, e.debtState, {
1484
1689
  focusId: t.focusId,
1485
1690
  parentOf: r,
1486
1691
  distanceToFocus: a?.get(n.id) ?? null,
@@ -1492,7 +1697,7 @@ function Yt(e, t = {}) {
1492
1697
  });
1493
1698
  o.sort((e, t) => {
1494
1699
  if (n === "debt") {
1495
- let n = qt(e.debtState) - qt(t.debtState);
1700
+ let n = nn(e.debtState) - nn(t.debtState);
1496
1701
  if (n !== 0) return n;
1497
1702
  }
1498
1703
  return t.doi - e.doi || (e.id < t.id ? -1 : +(e.id > t.id));
@@ -1500,7 +1705,7 @@ function Yt(e, t = {}) {
1500
1705
  let s = t.scentFilter;
1501
1706
  return s ? o.filter((e) => e.scentTags.includes(s)) : o;
1502
1707
  }
1503
- function Xt(e, t) {
1708
+ function on(e, t) {
1504
1709
  let n = /* @__PURE__ */ new Map();
1505
1710
  for (let [e, r] of t) {
1506
1711
  if (n.has(e) || n.set(e, []), !r) continue;
@@ -1517,11 +1722,11 @@ function Xt(e, t) {
1517
1722
  }
1518
1723
  return r;
1519
1724
  }
1520
- function Zt(e, t = {}) {
1521
- return Yt(Jt(e, t), t);
1725
+ function sn(e, t = {}) {
1726
+ return an(rn(e, t), t);
1522
1727
  }
1523
- function Qt(e, t = {}) {
1524
- let n = e.reduce((e, t) => Math.max(e, t.doi), 0), r = Math.max(.25, .5 * n), i = new Set(e.filter((e) => e.doi >= r).map((e) => e.id)), a = t.rankMode === "debt" ? new Set(e.filter((e) => qt(e.debtState) === 0).map((e) => e.id)) : /* @__PURE__ */ new Set(), o = e.filter((e) => i.has(e.id) || a.has(e.id));
1728
+ function cn(e, t = {}) {
1729
+ let n = e.reduce((e, t) => Math.max(e, t.doi), 0), r = Math.max(.25, .5 * n), i = new Set(e.filter((e) => e.doi >= r).map((e) => e.id)), a = t.rankMode === "debt" ? new Set(e.filter((e) => nn(e.debtState) === 0).map((e) => e.id)) : /* @__PURE__ */ new Set(), o = e.filter((e) => i.has(e.id) || a.has(e.id));
1525
1730
  o.length < 5 && (o = e.slice(0, Math.min(5, e.length)));
1526
1731
  let s = o.slice(0, 25);
1527
1732
  return {
@@ -1530,19 +1735,19 @@ function Qt(e, t = {}) {
1530
1735
  overflowCount: t.expanded ? 0 : Math.max(0, e.length - s.length)
1531
1736
  };
1532
1737
  }
1533
- function $t(e, t, n, r) {
1738
+ function ln(e, t, n, r) {
1534
1739
  return /* @__PURE__ */ Error(`Code map ranking ${e} failed: what went wrong: invalid ${t}; why: ${n}; where: src/ui/graph/ranking.js ${t}; when: ${e}; what it means: the ranked list cannot be derived safely; how to fix: ${r}.`);
1535
1740
  }
1536
1741
  //#endregion
1537
1742
  //#region src/ui/graph/codeMapState.js
1538
- var en = 1, Y = Object.freeze({
1743
+ var un = 1, J = Object.freeze({
1539
1744
  min: .35,
1540
1745
  max: 2.4
1541
1746
  });
1542
- function tn(e) {
1543
- return typeof e == "number" && Number.isFinite(e) && e >= Y.min && e <= Y.max;
1747
+ function dn(e) {
1748
+ return typeof e == "number" && Number.isFinite(e) && e >= J.min && e <= J.max;
1544
1749
  }
1545
- var nn = Object.freeze({
1750
+ var fn = Object.freeze({
1546
1751
  version: 1,
1547
1752
  presentation: "navigator",
1548
1753
  selectedId: null,
@@ -1557,19 +1762,19 @@ var nn = Object.freeze({
1557
1762
  expandedGhostGroups: Object.freeze([]),
1558
1763
  rankMode: "relevance",
1559
1764
  scentFilter: null
1560
- }), rn = /* @__PURE__ */ new Set(["navigator", "canvas"]), an = /* @__PURE__ */ new Set([
1765
+ }), pn = /* @__PURE__ */ new Set(["navigator", "canvas"]), mn = /* @__PURE__ */ new Set([
1561
1766
  "project",
1562
1767
  "package",
1563
1768
  "file"
1564
- ]), on = /* @__PURE__ */ new Set([
1769
+ ]), hn = /* @__PURE__ */ new Set([
1565
1770
  "relevance",
1566
1771
  "debt",
1567
1772
  "churn"
1568
- ]), sn = new Set(Ot), cn = Object.freeze({
1773
+ ]), gn = new Set(Lt), _n = Object.freeze({
1569
1774
  project: 0,
1570
1775
  package: 1,
1571
1776
  file: 1
1572
- }), ln = cn, un = Object.freeze([
1777
+ }), vn = _n, yn = Object.freeze([
1573
1778
  "version",
1574
1779
  "presentation",
1575
1780
  "selectedId",
@@ -1584,7 +1789,7 @@ var nn = Object.freeze({
1584
1789
  "expandedGhostGroups",
1585
1790
  "rankMode",
1586
1791
  "scentFilter"
1587
- ]), dn = Object.freeze({
1792
+ ]), bn = Object.freeze({
1588
1793
  replace: ["type", "state"],
1589
1794
  hydrate: ["type", "state"],
1590
1795
  "set-presentation": ["type", "presentation"],
@@ -1611,83 +1816,83 @@ var nn = Object.freeze({
1611
1816
  "set-scent-filter": ["type", "scentFilter"],
1612
1817
  "set-rank-expanded": ["type", "expanded"]
1613
1818
  });
1614
- function X(e = null) {
1615
- if (e !== null && !bn(e)) throw Z("create state", "seed", "the seed is not an object", "pass an object or omit the seed");
1819
+ function Y(e = null) {
1820
+ if (e !== null && !kn(e)) throw X("create state", "seed", "the seed is not an object", "pass an object or omit the seed");
1616
1821
  let t = e ?? {};
1617
- if (xn(t, un, "create state", "seed"), t.version !== void 0 && t.version !== 1) throw Z("create state", "version", `version ${String(t.version)} is unsupported`, "use version 1");
1822
+ if (An(t, yn, "create state", "seed"), t.version !== void 0 && t.version !== 1) throw X("create state", "version", `version ${String(t.version)} is unsupported`, "use version 1");
1618
1823
  return {
1619
1824
  version: 1,
1620
- presentation: Mn(t.presentation, rn, nn.presentation, "presentation"),
1621
- selectedId: Tn(t.selectedId, "selectedId"),
1622
- grain: Mn(t.grain, an, nn.grain, "grain"),
1623
- expandedIds: En(t.expandedIds, "expandedIds"),
1624
- navigatorFilter: An(t.navigatorFilter, "", "navigatorFilter"),
1625
- navigatorFocusedId: Tn(t.navigatorFocusedId, "navigatorFocusedId"),
1626
- viewport: Pn(t.viewport),
1627
- hoveredSessionId: Tn(t.hoveredSessionId, "hoveredSessionId"),
1628
- selectedSessionId: Tn(t.selectedSessionId, "selectedSessionId"),
1629
- expandedCommitSessions: En(t.expandedCommitSessions, "expandedCommitSessions"),
1630
- expandedGhostGroups: En(t.expandedGhostGroups, "expandedGhostGroups"),
1631
- rankMode: Mn(t.rankMode, on, nn.rankMode, "rankMode"),
1632
- scentFilter: Ln(t.scentFilter)
1825
+ presentation: Vn(t.presentation, pn, fn.presentation, "presentation"),
1826
+ selectedId: Pn(t.selectedId, "selectedId"),
1827
+ grain: Vn(t.grain, mn, fn.grain, "grain"),
1828
+ expandedIds: Fn(t.expandedIds, "expandedIds"),
1829
+ navigatorFilter: zn(t.navigatorFilter, "", "navigatorFilter"),
1830
+ navigatorFocusedId: Pn(t.navigatorFocusedId, "navigatorFocusedId"),
1831
+ viewport: Hn(t.viewport),
1832
+ hoveredSessionId: Pn(t.hoveredSessionId, "hoveredSessionId"),
1833
+ selectedSessionId: Pn(t.selectedSessionId, "selectedSessionId"),
1834
+ expandedCommitSessions: Fn(t.expandedCommitSessions, "expandedCommitSessions"),
1835
+ expandedGhostGroups: Fn(t.expandedGhostGroups, "expandedGhostGroups"),
1836
+ rankMode: Vn(t.rankMode, hn, fn.rankMode, "rankMode"),
1837
+ scentFilter: Gn(t.scentFilter)
1633
1838
  };
1634
1839
  }
1635
- function fn(e, t) {
1636
- let n = X(e), r = X(t);
1637
- return n.version === r.version && n.presentation === r.presentation && n.selectedId === r.selectedId && n.grain === r.grain && n.expandedIds.length === r.expandedIds.length && n.expandedIds.every((e, t) => e === r.expandedIds[t]) && n.navigatorFilter === r.navigatorFilter && n.navigatorFocusedId === r.navigatorFocusedId && In(n.viewport, r.viewport) && n.hoveredSessionId === r.hoveredSessionId && n.selectedSessionId === r.selectedSessionId && pn(n.expandedCommitSessions, r.expandedCommitSessions) && pn(n.expandedGhostGroups, r.expandedGhostGroups) && n.rankMode === r.rankMode && n.scentFilter === r.scentFilter;
1840
+ function xn(e, t) {
1841
+ let n = Y(e), r = Y(t);
1842
+ return n.version === r.version && n.presentation === r.presentation && n.selectedId === r.selectedId && n.grain === r.grain && n.expandedIds.length === r.expandedIds.length && n.expandedIds.every((e, t) => e === r.expandedIds[t]) && n.navigatorFilter === r.navigatorFilter && n.navigatorFocusedId === r.navigatorFocusedId && Wn(n.viewport, r.viewport) && n.hoveredSessionId === r.hoveredSessionId && n.selectedSessionId === r.selectedSessionId && Sn(n.expandedCommitSessions, r.expandedCommitSessions) && Sn(n.expandedGhostGroups, r.expandedGhostGroups) && n.rankMode === r.rankMode && n.scentFilter === r.scentFilter;
1638
1843
  }
1639
- function pn(e, t) {
1844
+ function Sn(e, t) {
1640
1845
  return e.length === t.length && e.every((e, n) => e === t[n]);
1641
1846
  }
1642
- function mn(e, t) {
1643
- let n = X(e);
1644
- switch (yn(t), t.type) {
1847
+ function Cn(e, t) {
1848
+ let n = Y(e);
1849
+ switch (On(t), t.type) {
1645
1850
  case "replace":
1646
- case "hydrate": return X(t.state);
1647
- case "set-presentation": return X({
1851
+ case "hydrate": return Y(t.state);
1852
+ case "set-presentation": return Y({
1648
1853
  ...n,
1649
- presentation: Nn(t.presentation, rn, "presentation")
1854
+ presentation: Q(t.presentation, pn, "presentation")
1650
1855
  });
1651
- case "select": return X({
1856
+ case "select": return Y({
1652
1857
  ...n,
1653
- selectedId: Q(t.id, "id"),
1654
- navigatorFocusedId: Q(t.id, "id")
1858
+ selectedId: Z(t.id, "id"),
1859
+ navigatorFocusedId: Z(t.id, "id")
1655
1860
  });
1656
- case "clear-selection": return X({
1861
+ case "clear-selection": return Y({
1657
1862
  ...n,
1658
1863
  selectedId: null
1659
1864
  });
1660
- case "focus": return X({
1865
+ case "focus": return Y({
1661
1866
  ...n,
1662
- navigatorFocusedId: Tn(t.id, "id")
1867
+ navigatorFocusedId: Pn(t.id, "id")
1663
1868
  });
1664
- case "set-filter": return X({
1869
+ case "set-filter": return Y({
1665
1870
  ...n,
1666
- navigatorFilter: An(t.filter, "", "filter")
1871
+ navigatorFilter: zn(t.filter, "", "filter")
1667
1872
  });
1668
- case "set-expanded": return X({
1873
+ case "set-expanded": return Y({
1669
1874
  ...n,
1670
- expandedIds: En(t.ids, "ids")
1875
+ expandedIds: Fn(t.ids, "ids")
1671
1876
  });
1672
1877
  case "toggle-expanded": {
1673
- let e = Q(t.id, "id"), r = new Set(n.expandedIds);
1674
- return r.has(e) ? r.delete(e) : r.add(e), X({
1878
+ let e = Z(t.id, "id"), r = new Set(n.expandedIds);
1879
+ return r.has(e) ? r.delete(e) : r.add(e), Y({
1675
1880
  ...n,
1676
1881
  expandedIds: [...r]
1677
1882
  });
1678
1883
  }
1679
- case "set-grain": return X({
1884
+ case "set-grain": return Y({
1680
1885
  ...n,
1681
- grain: Nn(t.grain, an, "grain"),
1886
+ grain: Q(t.grain, mn, "grain"),
1682
1887
  expandedIds: []
1683
1888
  });
1684
- case "set-viewport": return X({
1889
+ case "set-viewport": return Y({
1685
1890
  ...n,
1686
- viewport: Pn(t.viewport)
1891
+ viewport: Hn(t.viewport)
1687
1892
  });
1688
1893
  case "open-in-map": {
1689
- let e = Q(t.id, "id");
1690
- return X({
1894
+ let e = Z(t.id, "id");
1895
+ return Y({
1691
1896
  ...n,
1692
1897
  presentation: "canvas",
1693
1898
  selectedId: e,
@@ -1695,57 +1900,57 @@ function mn(e, t) {
1695
1900
  });
1696
1901
  }
1697
1902
  case "reveal": {
1698
- let e = Q(t.id, "id");
1699
- return X({
1903
+ let e = Z(t.id, "id");
1904
+ return Y({
1700
1905
  ...n,
1701
- grain: Nn(t.grain, an, "grain"),
1702
- expandedIds: En(t.expandedIds, "expandedIds"),
1906
+ grain: Q(t.grain, mn, "grain"),
1907
+ expandedIds: Fn(t.expandedIds, "expandedIds"),
1703
1908
  selectedId: e,
1704
1909
  navigatorFocusedId: e
1705
1910
  });
1706
1911
  }
1707
- case "hover-session": return X({
1912
+ case "hover-session": return Y({
1708
1913
  ...n,
1709
- hoveredSessionId: wn(t.sessionId, "sessionId")
1914
+ hoveredSessionId: Nn(t.sessionId, "sessionId")
1710
1915
  });
1711
- case "select-session": return X({
1916
+ case "select-session": return Y({
1712
1917
  ...n,
1713
- selectedSessionId: wn(t.sessionId, "sessionId")
1918
+ selectedSessionId: Nn(t.sessionId, "sessionId")
1714
1919
  });
1715
1920
  case "toggle-commit-sessions": {
1716
- let e = Q(t.commitHash, "commitHash"), r = new Set(n.expandedCommitSessions);
1717
- return r.has(e) ? r.delete(e) : r.add(e), X({
1921
+ let e = Z(t.commitHash, "commitHash"), r = new Set(n.expandedCommitSessions);
1922
+ return r.has(e) ? r.delete(e) : r.add(e), Y({
1718
1923
  ...n,
1719
1924
  expandedCommitSessions: [...r]
1720
1925
  });
1721
1926
  }
1722
1927
  case "toggle-ghost-group": {
1723
- let e = Q(t.successorHash, "successorHash"), r = new Set(n.expandedGhostGroups);
1724
- return r.has(e) ? r.delete(e) : r.add(e), X({
1928
+ let e = Z(t.successorHash, "successorHash"), r = new Set(n.expandedGhostGroups);
1929
+ return r.has(e) ? r.delete(e) : r.add(e), Y({
1725
1930
  ...n,
1726
1931
  expandedGhostGroups: [...r]
1727
1932
  });
1728
1933
  }
1729
- case "set-rank-mode": return X({
1934
+ case "set-rank-mode": return Y({
1730
1935
  ...n,
1731
- rankMode: Nn(t.rankMode, on, "rankMode")
1936
+ rankMode: Q(t.rankMode, hn, "rankMode")
1732
1937
  });
1733
- case "set-scent-filter": return X({
1938
+ case "set-scent-filter": return Y({
1734
1939
  ...n,
1735
- scentFilter: Rn(t.scentFilter, "scentFilter")
1940
+ scentFilter: Kn(t.scentFilter, "scentFilter")
1736
1941
  });
1737
1942
  case "set-rank-expanded": {
1738
- let e = jn(t.expanded, "expanded"), r = new Set(n.expandedCommitSessions);
1739
- return e ? r.add("ranked:all") : r.delete("ranked:all"), X({
1943
+ let e = Bn(t.expanded, "expanded"), r = new Set(n.expandedCommitSessions);
1944
+ return e ? r.add("ranked:all") : r.delete("ranked:all"), Y({
1740
1945
  ...n,
1741
1946
  expandedCommitSessions: [...r]
1742
1947
  });
1743
1948
  }
1744
- default: throw Z("reduce state", "action.type", "the action is unsupported", "use a documented CodeMapAction");
1949
+ default: throw X("reduce state", "action.type", "the action is unsupported", "use a documented CodeMapAction");
1745
1950
  }
1746
1951
  }
1747
- function hn(e, t) {
1748
- let n = X(t), r = _n(e), i = (e) => {
1952
+ function wn(e, t) {
1953
+ let n = Y(t), r = En(e), i = (e) => {
1749
1954
  if (!e) return {
1750
1955
  sessionId: null,
1751
1956
  commitHashes: [],
@@ -1755,8 +1960,8 @@ function hn(e, t) {
1755
1960
  let t = r.filter((t) => t.sessionId === e);
1756
1961
  return {
1757
1962
  sessionId: e,
1758
- commitHashes: [...new Set(t.filter((e) => !e.ghost).map((e) => e.commitHash))].sort(Cn),
1759
- ghostHashes: [...new Set(t.filter((e) => e.ghost).map((e) => e.commitHash))].sort(Cn),
1963
+ commitHashes: [...new Set(t.filter((e) => !e.ghost).map((e) => e.commitHash))].sort(Mn),
1964
+ ghostHashes: [...new Set(t.filter((e) => e.ghost).map((e) => e.commitHash))].sort(Mn),
1760
1965
  edges: t.map((e) => ({ ...e }))
1761
1966
  };
1762
1967
  };
@@ -1765,8 +1970,8 @@ function hn(e, t) {
1765
1970
  hovered: i(n.hoveredSessionId)
1766
1971
  };
1767
1972
  }
1768
- function gn(e) {
1769
- let t = X(e);
1973
+ function Tn(e) {
1974
+ let t = Y(e);
1770
1975
  return t.hoveredSessionId === null ? t.selectedSessionId === null ? null : {
1771
1976
  type: "select-session",
1772
1977
  sessionId: null
@@ -1775,45 +1980,45 @@ function gn(e) {
1775
1980
  sessionId: null
1776
1981
  };
1777
1982
  }
1778
- function _n(e) {
1983
+ function En(e) {
1779
1984
  let t = e?.edges ?? [];
1780
- if (!Array.isArray(t)) throw Z("derive timeline highlight", "payload.edges", "edges is not an array", "provide a payload with an edges array");
1985
+ if (!Array.isArray(t)) throw X("derive timeline highlight", "payload.edges", "edges is not an array", "provide a payload with an edges array");
1781
1986
  return t.map((e, t) => {
1782
- if (!bn(e)) throw Z("derive timeline highlight", `payload.edges[${t}]`, "the edge is not an object", "provide an edge object");
1987
+ if (!kn(e)) throw X("derive timeline highlight", `payload.edges[${t}]`, "the edge is not an object", "provide an edge object");
1783
1988
  return {
1784
- sessionId: Q(e.sessionId, `payload.edges[${t}].sessionId`),
1785
- commitHash: Q(e.commitHash, `payload.edges[${t}].commitHash`),
1989
+ sessionId: Z(e.sessionId, `payload.edges[${t}].sessionId`),
1990
+ commitHash: Z(e.commitHash, `payload.edges[${t}].commitHash`),
1786
1991
  ghost: e.ghost === !0
1787
1992
  };
1788
1993
  });
1789
1994
  }
1790
- function vn(e, t) {
1791
- e && ft(e);
1792
- let n = X(t), r = e?.nodes ?? [];
1793
- if (!Array.isArray(r)) throw Z("derive view", "payload.nodes", "nodes is not an array", "provide a CodeMapPayload with a nodes array");
1995
+ function Dn(e, t) {
1996
+ e && St(e);
1997
+ let n = Y(t), r = e?.nodes ?? [];
1998
+ if (!Array.isArray(r)) throw X("derive view", "payload.nodes", "nodes is not an array", "provide a CodeMapPayload with a nodes array");
1794
1999
  let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1795
2000
  r.forEach((e, t) => {
1796
- if (!bn(e)) throw Z("derive view", `payload.nodes[${t}]`, "the node is not an object", "provide a node object");
1797
- let n = Q(e.id, `payload.nodes[${t}].id`);
1798
- if (i.has(n)) throw Z("derive view", `payload.nodes[${t}].id`, `duplicate node id ${JSON.stringify(n)}`, "give every node one unique nonempty id");
2001
+ if (!kn(e)) throw X("derive view", `payload.nodes[${t}]`, "the node is not an object", "provide a node object");
2002
+ let n = Z(e.id, `payload.nodes[${t}].id`);
2003
+ if (i.has(n)) throw X("derive view", `payload.nodes[${t}].id`, `duplicate node id ${JSON.stringify(n)}`, "give every node one unique nonempty id");
1799
2004
  let r = {
1800
2005
  ...e,
1801
2006
  id: n
1802
2007
  };
1803
- r.parent !== void 0 && r.parent !== null && r.parent !== "" ? r.parent = Q(r.parent, `payload.nodes[${t}].parent`) : delete r.parent, i.set(n, r), a.set(n, t);
2008
+ r.parent !== void 0 && r.parent !== null && r.parent !== "" ? r.parent = Z(r.parent, `payload.nodes[${t}].parent`) : delete r.parent, i.set(n, r), a.set(n, t);
1804
2009
  });
1805
- for (let e of i.values()) if (e.parent && !i.has(e.parent)) throw Z("derive view", `node ${JSON.stringify(e.id)} parent`, `parent ${JSON.stringify(e.parent)} does not exist`, "add the parent node or remove the parent reference to make this node a root");
2010
+ for (let e of i.values()) if (e.parent && !i.has(e.parent)) throw X("derive view", `node ${JSON.stringify(e.id)} parent`, `parent ${JSON.stringify(e.parent)} does not exist`, "add the parent node or remove the parent reference to make this node a root");
1806
2011
  let o = /* @__PURE__ */ new Map(), s = [];
1807
2012
  for (let e of i.values()) if (e.parent) {
1808
2013
  let t = o.get(e.parent) ?? [];
1809
2014
  t.push(e), o.set(e.parent, t);
1810
2015
  } else s.push(e);
1811
- let c = (e, t) => (Number.isFinite(e.order) ? Number(e.order) : a.get(e.id) ?? 0) - (Number.isFinite(t.order) ? Number(t.order) : a.get(t.id) ?? 0) || Cn(e.id, t.id);
2016
+ let c = (e, t) => (Number.isFinite(e.order) ? Number(e.order) : a.get(e.id) ?? 0) - (Number.isFinite(t.order) ? Number(t.order) : a.get(t.id) ?? 0) || Mn(e.id, t.id);
1812
2017
  s.sort(c);
1813
2018
  for (let e of o.values()) e.sort(c);
1814
2019
  let l = /* @__PURE__ */ new Map(), u = [], d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
1815
2020
  function p(e, t) {
1816
- if (d.has(e.id)) throw Z("derive view", `node ${JSON.stringify(e.id)}`, "the parent graph contains a cycle", "remove the cyclic parent reference");
2021
+ if (d.has(e.id)) throw X("derive view", `node ${JSON.stringify(e.id)}`, "the parent graph contains a cycle", "remove the cyclic parent reference");
1817
2022
  if (!f.has(e.id)) {
1818
2023
  d.add(e.id), u.push(e.id), l.set(e.id, t);
1819
2024
  for (let n of o.get(e.id) ?? []) p(n, t + 1);
@@ -1831,7 +2036,7 @@ function vn(e, t) {
1831
2036
  let t = e;
1832
2037
  for (; t;) g.add(t.id), t = t.parent ? i.get(t.parent) : null;
1833
2038
  }
1834
- let _ = cn[n.grain], v = [];
2039
+ let _ = _n[n.grain], v = [];
1835
2040
  function y(e, t, n = null) {
1836
2041
  if (h && !g.has(e.id)) return;
1837
2042
  let r = o.get(e.id) ?? [], i = r.filter((e) => !h || g.has(e.id)).map((e) => e.id), a = r.length > 0, s = a && (t < _ || m.has(e.id)), c = !!h && i.length > 0;
@@ -1854,11 +2059,11 @@ function vn(e, t) {
1854
2059
  else b.push({ ...e });
1855
2060
  }
1856
2061
  for (let e of s) x(e, 0);
1857
- let S = n.selectedId ? i.get(n.selectedId) ?? null : null, ee = new Set(v.map((e) => e.node.id));
2062
+ let S = n.selectedId ? i.get(n.selectedId) ?? null : null, C = new Set(v.map((e) => e.node.id));
1858
2063
  return {
1859
2064
  state: n,
1860
2065
  rows: v,
1861
- focusedId: n.navigatorFocusedId && ee.has(n.navigatorFocusedId) ? n.navigatorFocusedId : v[0]?.node.id ?? null,
2066
+ focusedId: n.navigatorFocusedId && C.has(n.navigatorFocusedId) ? n.navigatorFocusedId : v[0]?.node.id ?? null,
1862
2067
  selected: S ? { ...S } : null,
1863
2068
  staleSelectedId: n.selectedId && !S ? n.selectedId : null,
1864
2069
  canvas: {
@@ -1867,7 +2072,7 @@ function vn(e, t) {
1867
2072
  visibleIds: b.map((e) => e.id),
1868
2073
  selectedId: S?.id ?? null,
1869
2074
  grain: n.grain,
1870
- expandedIds: [...m].sort(Cn),
2075
+ expandedIds: [...m].sort(Mn),
1871
2076
  viewport: n.viewport ? { ...n.viewport } : null,
1872
2077
  hierarchy: {
1873
2078
  orderedIds: u,
@@ -1878,160 +2083,160 @@ function vn(e, t) {
1878
2083
  }
1879
2084
  };
1880
2085
  }
1881
- function yn(e) {
1882
- if (!bn(e) || typeof e.type != "string") throw Z("reduce state", "action.type", "the action has no string type", "pass a supported action object");
1883
- let t = dn[e.type];
1884
- if (!t) throw Z("reduce state", "action.type", `action ${JSON.stringify(e.type)} is not supported`, `use one of ${Object.keys(dn).join(", ")}`);
1885
- switch (Sn(e, t, "reduce state", `action ${e.type}`), e.type) {
2086
+ function On(e) {
2087
+ if (!kn(e) || typeof e.type != "string") throw X("reduce state", "action.type", "the action has no string type", "pass a supported action object");
2088
+ let t = bn[e.type];
2089
+ if (!t) throw X("reduce state", "action.type", `action ${JSON.stringify(e.type)} is not supported`, `use one of ${Object.keys(bn).join(", ")}`);
2090
+ switch (jn(e, t, "reduce state", `action ${e.type}`), e.type) {
1886
2091
  case "replace":
1887
2092
  case "hydrate":
1888
- On(e.state, "state");
2093
+ Ln(e.state, "state");
1889
2094
  break;
1890
2095
  case "set-presentation":
1891
- Nn(e.presentation, rn, "presentation");
2096
+ Q(e.presentation, pn, "presentation");
1892
2097
  break;
1893
2098
  case "select":
1894
2099
  case "toggle-expanded":
1895
2100
  case "open-in-map":
1896
- Q(e.id, "id");
2101
+ Z(e.id, "id");
1897
2102
  break;
1898
2103
  case "focus":
1899
- wn(e.id, "id");
2104
+ Nn(e.id, "id");
1900
2105
  break;
1901
2106
  case "set-filter":
1902
- kn(e.filter, "filter");
2107
+ Rn(e.filter, "filter");
1903
2108
  break;
1904
2109
  case "set-expanded":
1905
- Dn(e.ids, "ids");
2110
+ In(e.ids, "ids");
1906
2111
  break;
1907
2112
  case "set-grain":
1908
- Nn(e.grain, an, "grain");
2113
+ Q(e.grain, mn, "grain");
1909
2114
  break;
1910
2115
  case "set-viewport":
1911
- Fn(e.viewport, "viewport");
2116
+ Un(e.viewport, "viewport");
1912
2117
  break;
1913
2118
  case "reveal":
1914
- Q(e.id, "id"), Nn(e.grain, an, "grain"), Dn(e.expandedIds, "expandedIds");
2119
+ Z(e.id, "id"), Q(e.grain, mn, "grain"), In(e.expandedIds, "expandedIds");
1915
2120
  break;
1916
2121
  case "clear-selection": break;
1917
2122
  case "hover-session":
1918
2123
  case "select-session":
1919
- wn(e.sessionId, "sessionId");
2124
+ Nn(e.sessionId, "sessionId");
1920
2125
  break;
1921
2126
  case "toggle-commit-sessions":
1922
- Q(e.commitHash, "commitHash");
2127
+ Z(e.commitHash, "commitHash");
1923
2128
  break;
1924
2129
  case "toggle-ghost-group":
1925
- Q(e.successorHash, "successorHash");
2130
+ Z(e.successorHash, "successorHash");
1926
2131
  break;
1927
2132
  case "set-rank-mode":
1928
- Nn(e.rankMode, on, "rankMode");
2133
+ Q(e.rankMode, hn, "rankMode");
1929
2134
  break;
1930
2135
  case "set-scent-filter":
1931
- Rn(e.scentFilter, "scentFilter");
2136
+ Kn(e.scentFilter, "scentFilter");
1932
2137
  break;
1933
2138
  case "set-rank-expanded":
1934
- jn(e.expanded, "expanded");
2139
+ Bn(e.expanded, "expanded");
1935
2140
  break;
1936
2141
  }
1937
2142
  }
1938
- function Z(e, t, n, r) {
2143
+ function X(e, t, n, r) {
1939
2144
  return /* @__PURE__ */ Error(`Code map ${e} failed: what went wrong: invalid ${t}; why: ${n}; where: @peasant-labs/fairtrade/graph ${t}; when: ${e}; what it means: the requested code-map state cannot be used safely; how to fix: ${r}.`);
1940
2145
  }
1941
- function bn(e) {
2146
+ function kn(e) {
1942
2147
  return typeof e == "object" && !!e && !Array.isArray(e);
1943
2148
  }
1944
- function xn(e, t, n, r) {
2149
+ function An(e, t, n, r) {
1945
2150
  let i = new Set(t), a = Object.keys(e).find((e) => !i.has(e));
1946
- if (a) throw Z(n, `${r}.${a}`, `field ${JSON.stringify(a)} is not allowed`, `remove ${JSON.stringify(a)} and use only ${t.join(", ")}`);
2151
+ if (a) throw X(n, `${r}.${a}`, `field ${JSON.stringify(a)} is not allowed`, `remove ${JSON.stringify(a)} and use only ${t.join(", ")}`);
1947
2152
  }
1948
- function Sn(e, t, n, r) {
1949
- xn(e, t, n, r);
2153
+ function jn(e, t, n, r) {
2154
+ An(e, t, n, r);
1950
2155
  let i = t.find((t) => !(t in e));
1951
- if (i) throw Z(n, `${r}.${i}`, `required field ${JSON.stringify(i)} is missing`, `provide ${JSON.stringify(i)} for this action`);
2156
+ if (i) throw X(n, `${r}.${i}`, `required field ${JSON.stringify(i)} is missing`, `provide ${JSON.stringify(i)} for this action`);
1952
2157
  }
1953
- function Cn(e, t) {
2158
+ function Mn(e, t) {
1954
2159
  return e < t ? -1 : +(e > t);
1955
2160
  }
1956
- function Q(e, t) {
1957
- if (typeof e != "string" || e.length === 0) throw Z("normalize state", t, "the id is not a nonempty string", "provide a nonempty string id");
2161
+ function Z(e, t) {
2162
+ if (typeof e != "string" || e.length === 0) throw X("normalize state", t, "the id is not a nonempty string", "provide a nonempty string id");
1958
2163
  return e;
1959
2164
  }
1960
- function wn(e, t) {
1961
- return e === null ? null : Q(e, t);
2165
+ function Nn(e, t) {
2166
+ return e === null ? null : Z(e, t);
1962
2167
  }
1963
- function Tn(e, t) {
1964
- return e == null ? null : Q(e, t);
2168
+ function Pn(e, t) {
2169
+ return e == null ? null : Z(e, t);
1965
2170
  }
1966
- function En(e, t) {
2171
+ function Fn(e, t) {
1967
2172
  if (e === void 0) return [];
1968
- if (e === null || typeof e == "string" || typeof e[Symbol.iterator] != "function") throw Z("normalize state", t, "the value is not an iterable of ids", "provide an array or other iterable of nonempty string ids");
2173
+ if (e === null || typeof e == "string" || typeof e[Symbol.iterator] != "function") throw X("normalize state", t, "the value is not an iterable of ids", "provide an array or other iterable of nonempty string ids");
1969
2174
  let n = [...e];
1970
- return [...new Set(n.map((e, n) => Q(e, `${t}[${n}]`)))].sort(Cn);
2175
+ return [...new Set(n.map((e, n) => Z(e, `${t}[${n}]`)))].sort(Mn);
1971
2176
  }
1972
- function Dn(e, t) {
1973
- if (e === void 0) throw Z("normalize action", t, "the required id iterable is undefined", "provide a non-string iterable of nonempty ids");
1974
- return En(e, t);
2177
+ function In(e, t) {
2178
+ if (e === void 0) throw X("normalize action", t, "the required id iterable is undefined", "provide a non-string iterable of nonempty ids");
2179
+ return Fn(e, t);
1975
2180
  }
1976
- function On(e, t) {
1977
- if (!bn(e)) throw Z("normalize action", t, "the required value is not an object", "provide an object");
2181
+ function Ln(e, t) {
2182
+ if (!kn(e)) throw X("normalize action", t, "the required value is not an object", "provide an object");
1978
2183
  return e;
1979
2184
  }
1980
- function kn(e, t) {
1981
- if (typeof e != "string") throw Z("normalize action", t, "the required value is not a string", "provide a string");
2185
+ function Rn(e, t) {
2186
+ if (typeof e != "string") throw X("normalize action", t, "the required value is not a string", "provide a string");
1982
2187
  return e;
1983
2188
  }
1984
- function An(e, t, n) {
2189
+ function zn(e, t, n) {
1985
2190
  if (e === void 0) return t;
1986
- if (typeof e != "string") throw Z("normalize state", n, "the value is not a string", "provide a string");
2191
+ if (typeof e != "string") throw X("normalize state", n, "the value is not a string", "provide a string");
1987
2192
  return e;
1988
2193
  }
1989
- function jn(e, t) {
1990
- if (typeof e != "boolean") throw Z("normalize state", t, "the value is not a boolean", "provide true or false");
2194
+ function Bn(e, t) {
2195
+ if (typeof e != "boolean") throw X("normalize state", t, "the value is not a boolean", "provide true or false");
1991
2196
  return e;
1992
2197
  }
1993
- function Mn(e, t, n, r) {
1994
- return e === void 0 ? n : Nn(e, t, r);
2198
+ function Vn(e, t, n, r) {
2199
+ return e === void 0 ? n : Q(e, t, r);
1995
2200
  }
1996
- function Nn(e, t, n) {
1997
- if (typeof e != "string" || !t.has(e)) throw Z("normalize state", n, `value ${JSON.stringify(e)} is unsupported`, `use one of ${[...t].join(", ")}`);
2201
+ function Q(e, t, n) {
2202
+ if (typeof e != "string" || !t.has(e)) throw X("normalize state", n, `value ${JSON.stringify(e)} is unsupported`, `use one of ${[...t].join(", ")}`);
1998
2203
  return e;
1999
2204
  }
2000
- function Pn(e) {
2205
+ function Hn(e) {
2001
2206
  if (e == null) return null;
2002
- if (!bn(e)) throw Z("normalize state", "viewport", "the viewport is not an object or null", "provide {scale, panX, panY} or null");
2207
+ if (!kn(e)) throw X("normalize state", "viewport", "the viewport is not an object or null", "provide {scale, panX, panY} or null");
2003
2208
  let { scale: t, panX: n, panY: r } = e;
2004
- if (!tn(t) || typeof n != "number" || typeof r != "number" || !Number.isFinite(n) || !Number.isFinite(r)) throw Z("normalize state", "viewport", `scale must be within ${Y.min}..${Y.max} and pan values must be finite`, `provide finite panX and panY values and a scale within ${Y.min}..${Y.max}`);
2209
+ if (!dn(t) || typeof n != "number" || typeof r != "number" || !Number.isFinite(n) || !Number.isFinite(r)) throw X("normalize state", "viewport", `scale must be within ${J.min}..${J.max} and pan values must be finite`, `provide finite panX and panY values and a scale within ${J.min}..${J.max}`);
2005
2210
  return {
2006
2211
  scale: t,
2007
2212
  panX: n,
2008
2213
  panY: r
2009
2214
  };
2010
2215
  }
2011
- function Fn(e, t) {
2216
+ function Un(e, t) {
2012
2217
  if (e === null) return null;
2013
- if (e === void 0) throw Z("normalize action", t, "the required viewport is undefined", "provide null or a bounded viewport object");
2014
- return Pn(e);
2218
+ if (e === void 0) throw X("normalize action", t, "the required viewport is undefined", "provide null or a bounded viewport object");
2219
+ return Hn(e);
2015
2220
  }
2016
- function In(e, t) {
2221
+ function Wn(e, t) {
2017
2222
  return e === null || t === null ? e === t : e.scale === t.scale && e.panX === t.panX && e.panY === t.panY;
2018
2223
  }
2019
- function Ln(e) {
2224
+ function Gn(e) {
2020
2225
  if (e == null) return null;
2021
- if (typeof e != "string" || !sn.has(e)) throw Z("normalize state", "scentFilter", `value ${JSON.stringify(e)} is unsupported`, `use null or one of ${[...sn].join(", ")}`);
2226
+ if (typeof e != "string" || !gn.has(e)) throw X("normalize state", "scentFilter", `value ${JSON.stringify(e)} is unsupported`, `use null or one of ${[...gn].join(", ")}`);
2022
2227
  return e;
2023
2228
  }
2024
- function Rn(e, t) {
2025
- if (e === void 0) throw Z("normalize action", t, "the required scent filter is undefined", "provide null or a SCENT_TAGS member");
2026
- return Ln(e);
2229
+ function Kn(e, t) {
2230
+ if (e === void 0) throw X("normalize action", t, "the required scent filter is undefined", "provide null or a SCENT_TAGS member");
2231
+ return Gn(e);
2027
2232
  }
2028
2233
  //#endregion
2029
2234
  //#region src/ui/MapCanvas.jsx
2030
- var zn = 56, Bn = 104, Vn = 248, Hn = 132, Un = 28, Wn = 48, Gn = 1200, Kn = 1.25, qn = {
2235
+ var qn = 56, Jn = 104, Yn = 248, Xn = 132, Zn = 28, Qn = 48, $n = 1200, er = 1.25, tr = {
2031
2236
  overview: "project",
2032
2237
  folders: "package",
2033
2238
  files: "file"
2034
- }, Jn = Object.fromEntries(Object.entries(qn).map(([e, t]) => [e, ln[t]])), Yn = [
2239
+ }, nr = Object.fromEntries(Object.entries(tr).map(([e, t]) => [e, vn[t]])), rr = [
2035
2240
  {
2036
2241
  id: "overview",
2037
2242
  label: "overview"
@@ -2044,19 +2249,19 @@ var zn = 56, Bn = 104, Vn = 248, Hn = 132, Un = 28, Wn = 48, Gn = 1200, Kn = 1.2
2044
2249
  id: "files",
2045
2250
  label: "files"
2046
2251
  }
2047
- ], Xn = 500, Zn = 1e4, Qn = 3;
2048
- function $n(e) {
2252
+ ], ir = 500, ar = 1e4, or = 3;
2253
+ function sr(e) {
2049
2254
  let t = Math.round(Number(e) || 0);
2050
2255
  return t < 0 ? 0 : t > 4 ? 4 : t;
2051
2256
  }
2052
- function er(e) {
2257
+ function cr(e) {
2053
2258
  let t = String(e ?? ""), n = t.lastIndexOf("/");
2054
2259
  return n >= 0 ? t.slice(n + 1) : t;
2055
2260
  }
2056
- function tr(e, t) {
2261
+ function lr(e, t) {
2057
2262
  return e._order === t._order ? e.id < t.id ? -1 : +(e.id > t.id) : e._order - t._order;
2058
2263
  }
2059
- function nr(e) {
2264
+ function ur(e) {
2060
2265
  let t = /* @__PURE__ */ new Map();
2061
2266
  e.forEach((e, n) => {
2062
2267
  let r = Number.isFinite(e.order) ? e.order : n;
@@ -2074,8 +2279,8 @@ function nr(e) {
2074
2279
  t ? t.push(e) : n.set(a, [e]);
2075
2280
  } else i.push(e);
2076
2281
  }
2077
- for (let e of n.values()) e.sort(tr);
2078
- i.sort(tr);
2282
+ for (let e of n.values()) e.sort(lr);
2283
+ i.sort(lr);
2079
2284
  let a = /* @__PURE__ */ new Map(), o = [], s = (e, t) => {
2080
2285
  a.set(e.id, t), o.push(e.id);
2081
2286
  for (let r of n.get(e.id) ?? []) s(r, t + 1);
@@ -2091,7 +2296,7 @@ function nr(e) {
2091
2296
  canonical: !1
2092
2297
  };
2093
2298
  }
2094
- function rr(e, t) {
2299
+ function dr(e, t) {
2095
2300
  let n = new Map(t.orderedIds.map((e, t) => [e, t])), r = new Map(e.map((e) => [e.id, {
2096
2301
  ...e,
2097
2302
  _order: n.get(e.id) ?? 2 ** 53 - 1
@@ -2110,10 +2315,10 @@ function rr(e, t) {
2110
2315
  canonical: !0
2111
2316
  };
2112
2317
  }
2113
- function ir(e, t) {
2318
+ function fr(e, t) {
2114
2319
  return t.canonical ? t.depthById.get(e.id) ?? 0 : Number.isFinite(e.layer) ? e.layer : t.depthById.get(e.id) ?? 0;
2115
2320
  }
2116
- function ar(e, t, n) {
2321
+ function pr(e, t, n) {
2117
2322
  let { children: r, roots: i } = e, a = [], o = (e, i) => {
2118
2323
  let s = r.get(e.id);
2119
2324
  if (s && s.length > 0 && (i < t || n.has(e.id))) for (let e of s) o(e, i + 1);
@@ -2122,7 +2327,7 @@ function ar(e, t, n) {
2122
2327
  for (let e of i) o(e, 0);
2123
2328
  return a;
2124
2329
  }
2125
- function or(e, t) {
2330
+ function mr(e, t) {
2126
2331
  if (e.length === 0) return {
2127
2332
  positioned: [],
2128
2333
  width: 0,
@@ -2131,21 +2336,21 @@ function or(e, t) {
2131
2336
  let n = 0;
2132
2337
  for (let t of e) n = Math.max(n, Math.max(0, Number(t.loc) || 0));
2133
2338
  let r = (e) => {
2134
- if (n <= 0) return Bn;
2339
+ if (n <= 0) return Jn;
2135
2340
  let t = Math.max(0, Number(e.loc) || 0) / n;
2136
- return Math.round(Bn + t * (Vn - Bn));
2341
+ return Math.round(Jn + t * (Yn - Jn));
2137
2342
  }, i = /* @__PURE__ */ new Map();
2138
2343
  for (let n of e) {
2139
- let e = ir(n, t), r = i.get(e);
2344
+ let e = fr(n, t), r = i.get(e);
2140
2345
  r ? r.push(n) : i.set(e, [n]);
2141
2346
  }
2142
2347
  let a = Array.from(i.keys()).sort((e, t) => e - t);
2143
- for (let e of a) i.get(e).sort(tr);
2144
- let o = (e) => e.reduce((e, t) => e + r(t), 0) + Un * (e.length - 1), s = (e) => {
2348
+ for (let e of a) i.get(e).sort(lr);
2349
+ let o = (e) => e.reduce((e, t) => e + r(t), 0) + Zn * (e.length - 1), s = (e) => {
2145
2350
  let t = [], n = [], i = 0;
2146
2351
  for (let a of e) {
2147
- let e = r(a), o = n.length === 0 ? e : e + Un;
2148
- n.length > 0 && i + o > Gn ? (t.push(n), n = [a], i = e) : (n.push(a), i += o);
2352
+ let e = r(a), o = n.length === 0 ? e : e + Zn;
2353
+ n.length > 0 && i + o > $n ? (t.push(n), n = [a], i = e) : (n.push(a), i += o);
2149
2354
  }
2150
2355
  return n.length > 0 && t.push(n), t;
2151
2356
  }, c = /* @__PURE__ */ new Map();
@@ -2154,7 +2359,7 @@ function or(e, t) {
2154
2359
  for (let e of a) for (let t of c.get(e)) l = Math.max(l, o(t));
2155
2360
  let u = [], d = 0;
2156
2361
  for (let e of a) for (let t of c.get(e)) {
2157
- let e = Wn + (l - o(t)) / 2, n = Wn + d * Hn;
2362
+ let e = Qn + (l - o(t)) / 2, n = Qn + d * Xn;
2158
2363
  for (let i of t) {
2159
2364
  let t = r(i);
2160
2365
  u.push({
@@ -2162,18 +2367,18 @@ function or(e, t) {
2162
2367
  x: e,
2163
2368
  y: n,
2164
2369
  w: t,
2165
- h: zn
2166
- }), e += t + Un;
2370
+ h: qn
2371
+ }), e += t + Zn;
2167
2372
  }
2168
2373
  d += 1;
2169
2374
  }
2170
2375
  return {
2171
2376
  positioned: u,
2172
- width: l + Wn * 2,
2173
- height: (d - 1) * Hn + zn + Wn * 2
2377
+ width: l + Qn * 2,
2378
+ height: (d - 1) * Xn + qn + Qn * 2
2174
2379
  };
2175
2380
  }
2176
- function sr(e, t) {
2381
+ function hr(e, t) {
2177
2382
  let n = /* @__PURE__ */ new Map();
2178
2383
  return (r) => {
2179
2384
  if (n.has(r)) return n.get(r);
@@ -2182,8 +2387,8 @@ function sr(e, t) {
2182
2387
  return n.set(r, i ?? null), i ?? null;
2183
2388
  };
2184
2389
  }
2185
- function cr(e, t, n) {
2186
- let r = sr(t, n), i = /* @__PURE__ */ new Map();
2390
+ function gr(e, t, n) {
2391
+ let r = hr(t, n), i = /* @__PURE__ */ new Map();
2187
2392
  for (let t of e) {
2188
2393
  let e = r(t.from), n = r(t.to);
2189
2394
  if (!e || !n || e === n) continue;
@@ -2197,8 +2402,8 @@ function cr(e, t, n) {
2197
2402
  }
2198
2403
  return Array.from(i.values()).sort((e, t) => e.from === t.from ? e.to < t.to ? -1 : +(e.to > t.to) : e.from < t.from ? -1 : 1);
2199
2404
  }
2200
- function lr(e, t, n) {
2201
- let r = sr(t, n), i = /* @__PURE__ */ new Map();
2405
+ function _r(e, t, n) {
2406
+ let r = hr(t, n), i = /* @__PURE__ */ new Map();
2202
2407
  for (let t of e) {
2203
2408
  let e = Math.max(0, Number(t.violations) || 0);
2204
2409
  if (e <= 0) continue;
@@ -2207,16 +2412,16 @@ function lr(e, t, n) {
2207
2412
  }
2208
2413
  return i;
2209
2414
  }
2210
- function ur(e) {
2415
+ function vr(e) {
2211
2416
  let t;
2212
2417
  for (let n of e) (!t || n.y < t.y || n.y === t.y && n.x < t.x) && (t = n);
2213
2418
  return t;
2214
2419
  }
2215
- function dr(e, t, n) {
2420
+ function yr(e, t, n) {
2216
2421
  let r = e.filter((e) => e.y === t.y).sort((e, t) => e.x - t.x), i = r.findIndex((e) => e.node.id === t.node.id);
2217
2422
  if (i !== -1) return r[i + n];
2218
2423
  }
2219
- function fr(e, t, n) {
2424
+ function br(e, t, n) {
2220
2425
  let r;
2221
2426
  for (let i of e) (i.y - t.y) * n <= 0 || (r === void 0 || (i.y - r) * n < 0) && (r = i.y);
2222
2427
  if (r === void 0) return;
@@ -2230,84 +2435,84 @@ function fr(e, t, n) {
2230
2435
  }
2231
2436
  return a;
2232
2437
  }
2233
- function pr({ data: t = {
2438
+ function xr({ data: t = {
2234
2439
  nodes: [],
2235
2440
  edges: []
2236
- }, grain: n = "folders", expandedIds: o, visibleIds: m, hierarchy: h, selectedId: _, highlightedIds: v, nodeDeltas: x = {}, edgeDeltas: ne = {}, onSelect: ie, onGrainChange: oe, onExpandedIdsChange: C, onExpand: se, height: ce = 520, ariaLabel: le = "code map", className: ue = "", viewport: w, onViewportChange: T, onStateAction: E, canonicalControlled: D = !1 }) {
2237
- let O = t?.nodes ?? [], de = t?.edges ?? [], k = a().replace(/[:]/g, ""), fe = `${k}-live`, pe = `${k}-list`, [me, he] = l(Jn[n] === void 0 ? "folders" : n), [ge, _e] = l(() => hr(o)), [ve, ye] = l(_ ?? null), [A, be] = l(null), [xe, Se] = l(() => gr(w?.scale) ? w.scale : 1), [Ce, we] = l(() => ({
2238
- x: $(w?.panX, 0),
2239
- y: $(w?.panY, 0)
2240
- })), [Te, Ee] = l(""), [De, Oe] = l(!1), j = c(null), M = c(null), [N, ke] = l(null), Ae = c(null), je = c(!1), Me = c(w != null), Ne = w && gr(w.scale) ? `${w.scale}|${$(w.panX, 0)}|${$(w.panY, 0)}` : "", Pe = c(Ne), P = c(Ne), Fe = c(!1), Ie = c(n), Le = c(_), Re = _r(o), ze = _r(v), F = D ? Jn[n] === void 0 ? "folders" : n : me, I = s(() => D ? hr(o) : ge, [
2241
- D,
2441
+ }, grain: n = "folders", expandedIds: o, visibleIds: m, hierarchy: h, selectedId: _, highlightedIds: v, nodeDeltas: x = {}, edgeDeltas: te = {}, onSelect: re, onGrainChange: ae, onExpandedIdsChange: w, onExpand: oe, height: se = 520, ariaLabel: ce = "code map", className: le = "", viewport: T, onViewportChange: E, onStateAction: D, canonicalControlled: O = !1 }) {
2442
+ let k = t?.nodes ?? [], ue = t?.edges ?? [], A = a().replace(/[:]/g, ""), de = `${A}-live`, fe = `${A}-list`, [pe, me] = l(nr[n] === void 0 ? "folders" : n), [he, ge] = l(() => Cr(o)), [_e, ve] = l(_ ?? null), [j, ye] = l(null), [be, xe] = l(() => wr(T?.scale) ? T.scale : 1), [Se, Ce] = l(() => ({
2443
+ x: $(T?.panX, 0),
2444
+ y: $(T?.panY, 0)
2445
+ })), [we, Te] = l(""), [Ee, De] = l(!1), M = c(null), N = c(null), [P, Oe] = l(null), ke = c(null), Ae = c(!1), je = c(T != null), Me = T && wr(T.scale) ? `${T.scale}|${$(T.panX, 0)}|${$(T.panY, 0)}` : "", Ne = c(Me), Pe = c(Me), Fe = c(!1), Ie = c(n), Le = c(_), Re = Tr(o), ze = Tr(v), F = O ? nr[n] === void 0 ? "folders" : n : pe, I = s(() => O ? Cr(o) : he, [
2446
+ O,
2242
2447
  Re,
2243
- ge
2244
- ]), L = D ? _ ?? null : ve, Be = D && w != null && gr(w.scale), R = N ? N.scale : Be ? w.scale : xe, z = N ? {
2245
- x: N.panX,
2246
- y: N.panY
2448
+ he
2449
+ ]), L = O ? _ ?? null : _e, Be = O && T != null && wr(T.scale), R = P ? P.scale : Be ? T.scale : be, z = P ? {
2450
+ x: P.panX,
2451
+ y: P.panY
2247
2452
  } : Be ? {
2248
- x: $(w.panX, 0),
2249
- y: $(w.panY, 0)
2250
- } : Ce, Ve = c(R), B = c(z);
2251
- Ve.current = R, B.current = z, i(() => {
2252
- if (N && !M.current) {
2253
- if (Be && w.scale === N.scale && $(w.panX, 0) === N.panX && $(w.panY, 0) === N.panY) {
2254
- ke(null);
2453
+ x: $(T.panX, 0),
2454
+ y: $(T.panY, 0)
2455
+ } : Se, Ve = c(R), He = c(z);
2456
+ Ve.current = R, He.current = z, i(() => {
2457
+ if (P && !N.current) {
2458
+ if (Be && T.scale === P.scale && $(T.panX, 0) === P.panX && $(T.panY, 0) === P.panY) {
2459
+ Oe(null);
2255
2460
  return;
2256
2461
  }
2257
- return Ae.current = setTimeout(() => ke(null), Xn), () => clearTimeout(Ae.current);
2462
+ return ke.current = setTimeout(() => Oe(null), ir), () => clearTimeout(ke.current);
2258
2463
  }
2259
2464
  }, [
2260
- N,
2465
+ P,
2261
2466
  Be,
2262
- w?.scale,
2263
- w?.panX,
2264
- w?.panY
2467
+ T?.scale,
2468
+ T?.panX,
2469
+ T?.panY
2265
2470
  ]), i(() => {
2266
- D || n !== Ie.current && (Ie.current = n, Jn[n] !== void 0 && he(n));
2267
- }, [D, n]), i(() => {
2268
- !D && o !== void 0 && _e(hr(o));
2269
- }, [D, Re]), i(() => {
2270
- D || _ !== Le.current && (Le.current = _, _ !== void 0 && ye(_));
2271
- }, [D, _]), i(() => {
2272
- if (D) {
2273
- if (!w && P.current !== "") P.current = "", Me.current = !1, je.current = !1, Se(1), we({
2471
+ O || n !== Ie.current && (Ie.current = n, nr[n] !== void 0 && me(n));
2472
+ }, [O, n]), i(() => {
2473
+ !O && o !== void 0 && ge(Cr(o));
2474
+ }, [O, Re]), i(() => {
2475
+ O || _ !== Le.current && (Le.current = _, _ !== void 0 && ve(_));
2476
+ }, [O, _]), i(() => {
2477
+ if (O) {
2478
+ if (!T && Pe.current !== "") Pe.current = "", je.current = !1, Ae.current = !1, xe(1), Ce({
2274
2479
  x: 0,
2275
2480
  y: 0
2276
2481
  });
2277
- else if (w && gr(w.scale)) {
2278
- let e = `${w.scale}|${$(w.panX, 0)}|${$(w.panY, 0)}`;
2279
- e !== P.current && (P.current = e, Me.current = !0);
2482
+ else if (T && wr(T.scale)) {
2483
+ let e = `${T.scale}|${$(T.panX, 0)}|${$(T.panY, 0)}`;
2484
+ e !== Pe.current && (Pe.current = e, je.current = !0);
2280
2485
  }
2281
2486
  return;
2282
2487
  }
2283
- if (!w) {
2284
- if (P.current === "") return;
2285
- P.current = "", Pe.current = "1|0|0", Me.current = !1, Se(1), we({
2488
+ if (!T) {
2489
+ if (Pe.current === "") return;
2490
+ Pe.current = "", Ne.current = "1|0|0", je.current = !1, xe(1), Ce({
2286
2491
  x: 0,
2287
2492
  y: 0
2288
2493
  });
2289
2494
  return;
2290
2495
  }
2291
- if (!gr(w.scale)) return;
2292
- let e = `${w.scale}|${$(w.panX, 0)}|${$(w.panY, 0)}`;
2293
- e !== P.current && (P.current = e, Me.current = !0, Pe.current = e, Se(w.scale), we({
2294
- x: $(w.panX, 0),
2295
- y: $(w.panY, 0)
2496
+ if (!wr(T.scale)) return;
2497
+ let e = `${T.scale}|${$(T.panX, 0)}|${$(T.panY, 0)}`;
2498
+ e !== Pe.current && (Pe.current = e, je.current = !0, Ne.current = e, xe(T.scale), Ce({
2499
+ x: $(T.panX, 0),
2500
+ y: $(T.panY, 0)
2296
2501
  }));
2297
2502
  }, [
2298
- D,
2299
- w,
2300
- w?.scale,
2301
- w?.panX,
2302
- w?.panY
2503
+ O,
2504
+ T,
2505
+ T?.scale,
2506
+ T?.panX,
2507
+ T?.panY
2303
2508
  ]), i(() => {
2304
- if (D || !T && !E) return;
2509
+ if (O || !E && !D) return;
2305
2510
  let e = `${R}|${z.x}|${z.y}`;
2306
- Pe.current !== e && (Pe.current = e, T?.({
2511
+ Ne.current !== e && (Ne.current = e, E?.({
2307
2512
  scale: R,
2308
2513
  panX: z.x,
2309
2514
  panY: z.y
2310
- }), Fe.current && (Fe.current = !1, E?.({
2515
+ }), Fe.current && (Fe.current = !1, D?.({
2311
2516
  type: "set-viewport",
2312
2517
  viewport: {
2313
2518
  scale: R,
@@ -2316,38 +2521,38 @@ function pr({ data: t = {
2316
2521
  }
2317
2522
  })));
2318
2523
  }, [
2524
+ O,
2319
2525
  D,
2320
2526
  E,
2321
- T,
2322
2527
  z.x,
2323
2528
  z.y,
2324
2529
  R
2325
2530
  ]);
2326
- let V = s(() => h ? rr(O, h) : nr(O), [O, h]), He = s(() => m === void 0 ? ar(V, Jn[F], I) : Array.from(m, (e) => V.byId.get(e)).filter(Boolean), [
2327
- V,
2531
+ let B = s(() => h ? dr(k, h) : ur(k), [k, h]), Ue = s(() => m === void 0 ? pr(B, nr[F], I) : Array.from(m, (e) => B.byId.get(e)).filter(Boolean), [
2532
+ B,
2328
2533
  F,
2329
2534
  I,
2330
- _r(m)
2331
- ]), H = s(() => new Set(He.map((e) => e.id)), [He]), { positioned: U, width: W, height: G } = s(() => or(He, V), [He, V]), Ue = s(() => {
2535
+ Tr(m)
2536
+ ]), We = s(() => new Set(Ue.map((e) => e.id)), [Ue]), { positioned: V, width: H, height: U } = s(() => mr(Ue, B), [Ue, B]), Ge = s(() => {
2332
2537
  let e = /* @__PURE__ */ new Map();
2333
- for (let t of U) e.set(t.node.id, t);
2538
+ for (let t of V) e.set(t.node.id, t);
2334
2539
  return e;
2335
- }, [U]), We = s(() => {
2540
+ }, [V]), W = s(() => {
2336
2541
  let e = /* @__PURE__ */ new Map();
2337
- for (let [t, n] of V.children) e.set(t, n.length);
2542
+ for (let [t, n] of B.children) e.set(t, n.length);
2338
2543
  return e;
2339
- }, [V]), Ge = s(() => cr(de, V.parentIdByChild, H), [
2340
- de,
2341
- V.parentIdByChild,
2342
- H
2343
- ]), Ke = s(() => Ge.reduce((e, t) => Math.max(e, t.weight), 1), [Ge]), qe = s(() => lr(O, V.parentIdByChild, H), [
2344
- O,
2345
- V.parentIdByChild,
2346
- H
2347
- ]), Je = s(() => {
2348
- let e = hr(v);
2544
+ }, [B]), Ke = s(() => gr(ue, B.parentIdByChild, We), [
2545
+ ue,
2546
+ B.parentIdByChild,
2547
+ We
2548
+ ]), qe = s(() => Ke.reduce((e, t) => Math.max(e, t.weight), 1), [Ke]), Je = s(() => _r(k, B.parentIdByChild, We), [
2549
+ k,
2550
+ B.parentIdByChild,
2551
+ We
2552
+ ]), Ye = s(() => {
2553
+ let e = Cr(v);
2349
2554
  if (e.size === 0) return e;
2350
- let t = sr(V.parentIdByChild, H), n = /* @__PURE__ */ new Set();
2555
+ let t = hr(B.parentIdByChild, We), n = /* @__PURE__ */ new Set();
2351
2556
  for (let r of e) {
2352
2557
  let e = t(r);
2353
2558
  e && n.add(e);
@@ -2355,70 +2560,70 @@ function pr({ data: t = {
2355
2560
  return n;
2356
2561
  }, [
2357
2562
  ze,
2358
- V.parentIdByChild,
2359
- H
2360
- ]), Ye = s(() => {
2361
- let e = Te.trim().toLowerCase();
2362
- return e ? O.filter((t) => t.id.toLowerCase().includes(e) || (t.label || "").toLowerCase().includes(e)).slice(0, 8) : [];
2363
- }, [O, Te]), Xe = r((e) => {
2364
- T?.(e), E?.({
2563
+ B.parentIdByChild,
2564
+ We
2565
+ ]), Xe = s(() => {
2566
+ let e = we.trim().toLowerCase();
2567
+ return e ? k.filter((t) => t.id.toLowerCase().includes(e) || (t.label || "").toLowerCase().includes(e)).slice(0, 8) : [];
2568
+ }, [k, we]), Ze = r((e) => {
2569
+ E?.(e), D?.({
2365
2570
  type: "set-viewport",
2366
2571
  viewport: e
2367
2572
  });
2368
- }, [E, T]), K = r((e, t) => {
2369
- if (D && t) {
2370
- Xe(e);
2573
+ }, [D, E]), G = r((e, t) => {
2574
+ if (O && t) {
2575
+ Ze(e);
2371
2576
  return;
2372
2577
  }
2373
- t && (Fe.current = !0), Se(e.scale), we({
2578
+ t && (Fe.current = !0), xe(e.scale), Ce({
2374
2579
  x: e.panX,
2375
2580
  y: e.panY
2376
2581
  });
2377
- }, [D, Xe]), Ze = r((e = !1) => {
2378
- let t = j.current;
2379
- if (!t || W <= 0 || G <= 0) return;
2582
+ }, [O, Ze]), Qe = r((e = !1) => {
2583
+ let t = M.current;
2584
+ if (!t || H <= 0 || U <= 0) return;
2380
2585
  let n = t.clientWidth, r = t.clientHeight;
2381
2586
  if (n <= 0 || r <= 0) return;
2382
- let i = Math.min(n / W, r / G), a = Math.max(Y.min, Math.min(Y.max, i));
2383
- K({
2587
+ let i = Math.min(n / H, r / U), a = Math.max(J.min, Math.min(J.max, i));
2588
+ G({
2384
2589
  scale: a,
2385
- panX: (n - W * a) / 2,
2386
- panY: (r - G * a) / 2
2590
+ panX: (n - H * a) / 2,
2591
+ panY: (r - U * a) / 2
2387
2592
  }, e);
2388
2593
  }, [
2389
- K,
2390
- W,
2391
- G
2392
- ]), Qe = r((e, t = !1) => {
2393
- let n = j.current;
2594
+ G,
2595
+ H,
2596
+ U
2597
+ ]), $e = r((e, t = !1) => {
2598
+ let n = M.current;
2394
2599
  if (!n) return !1;
2395
2600
  let r = n.clientWidth, i = n.clientHeight;
2396
2601
  if (r <= 0 || i <= 0) return !1;
2397
- let a = U.filter((t) => e.has(t.node.id));
2602
+ let a = V.filter((t) => e.has(t.node.id));
2398
2603
  if (a.length === 0) return !1;
2399
2604
  let o = Math.min(...a.map((e) => e.x)), s = Math.min(...a.map((e) => e.y)), c = Math.max(...a.map((e) => e.x + e.w)), l = Math.max(...a.map((e) => e.y + e.h)), u = c - o, d = l - s;
2400
2605
  if (u <= 0 || d <= 0) return !1;
2401
- let f = Math.min(r / u, i / d), p = Math.max(Y.min, Math.min(Y.max, f));
2402
- return K({
2606
+ let f = Math.min(r / u, i / d), p = Math.max(J.min, Math.min(J.max, f));
2607
+ return G({
2403
2608
  scale: p,
2404
2609
  panX: r / 2 - (o + u / 2) * p,
2405
2610
  panY: i / 2 - (s + d / 2) * p
2406
2611
  }, t), !0;
2407
- }, [K, U]), [$e, q] = l(!1);
2612
+ }, [G, V]), [et, tt] = l(!1);
2408
2613
  i(() => {
2409
- if (!$e) return;
2410
- let e = window.setTimeout(() => q(!1), 200);
2614
+ if (!et) return;
2615
+ let e = window.setTimeout(() => tt(!1), 200);
2411
2616
  return () => window.clearTimeout(e);
2412
- }, [$e]);
2413
- let et = s(() => U.map((e) => e.node.id).join("|"), [U]), tt = Be ? `canonical|${w.scale}|${$(w.panX, 0)}|${$(w.panY, 0)}` : D ? "canonical|auto-fit" : "legacy", nt = c(I);
2617
+ }, [et]);
2618
+ let nt = s(() => V.map((e) => e.node.id).join("|"), [V]), rt = Be ? `canonical|${T.scale}|${$(T.panX, 0)}|${$(T.panY, 0)}` : O ? "canonical|auto-fit" : "legacy", it = c(I);
2414
2619
  i(() => {
2415
- let e = nt.current;
2416
- if (nt.current = I, Me.current) {
2417
- Me.current = !1, je.current = !0;
2620
+ let e = it.current;
2621
+ if (it.current = I, je.current) {
2622
+ je.current = !1, Ae.current = !0;
2418
2623
  return;
2419
2624
  }
2420
- if (!je.current) {
2421
- je.current = !0, Ze(Be);
2625
+ if (!Ae.current) {
2626
+ Ae.current = !0, Qe(Be);
2422
2627
  return;
2423
2628
  }
2424
2629
  let t = null;
@@ -2430,163 +2635,163 @@ function pr({ data: t = {
2430
2635
  let e = /* @__PURE__ */ new Set([t]), n = [t];
2431
2636
  for (; n.length > 0;) {
2432
2637
  let t = n.pop();
2433
- for (let r of V.children.get(t) ?? []) e.add(r.id), n.push(r.id);
2638
+ for (let r of B.children.get(t) ?? []) e.add(r.id), n.push(r.id);
2434
2639
  }
2435
- let r = [...e].filter((e) => H.has(e));
2436
- if (q(!0), r.length > 0 && Qe(new Set(r), !0)) return;
2640
+ let r = [...e].filter((e) => We.has(e));
2641
+ if (tt(!0), r.length > 0 && $e(new Set(r), !0)) return;
2437
2642
  }
2438
- Ze(Be);
2439
- }, [et, tt]);
2440
- let rt = r((e) => {
2441
- let t = j.current, n = t ? t.clientWidth / 2 : 0, r = t ? t.clientHeight / 2 : 0, i = Ve.current, a = Math.max(Y.min, Math.min(Y.max, i * e));
2643
+ Qe(Be);
2644
+ }, [nt, rt]);
2645
+ let at = r((e) => {
2646
+ let t = M.current, n = t ? t.clientWidth / 2 : 0, r = t ? t.clientHeight / 2 : 0, i = Ve.current, a = Math.max(J.min, Math.min(J.max, i * e));
2442
2647
  if (a === i) return;
2443
- let o = B.current;
2444
- K({
2648
+ let o = He.current;
2649
+ G({
2445
2650
  scale: a,
2446
2651
  panX: n - (n - o.x) / i * a,
2447
2652
  panY: r - (r - o.y) / i * a
2448
2653
  }, !0);
2449
- }, [K]), it = r((e) => {
2654
+ }, [G]), ot = r((e) => {
2450
2655
  if (!(e.ctrlKey || e.metaKey)) return;
2451
2656
  e.preventDefault();
2452
- let t = j.current;
2657
+ let t = M.current;
2453
2658
  if (!t) return;
2454
- let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = Ve.current, o = Math.exp(-e.deltaY * .01), s = Math.max(1 / Kn, Math.min(Kn, o)), c = Math.max(Y.min, Math.min(Y.max, a * s));
2659
+ let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = Ve.current, o = Math.exp(-e.deltaY * .01), s = Math.max(1 / er, Math.min(er, o)), c = Math.max(J.min, Math.min(J.max, a * s));
2455
2660
  if (c === a) return;
2456
- let l = B.current;
2457
- K({
2661
+ let l = He.current;
2662
+ G({
2458
2663
  scale: c,
2459
2664
  panX: r - (r - l.x) / a * c,
2460
2665
  panY: i - (i - l.y) / a * c
2461
2666
  }, !0);
2462
- }, [K]);
2667
+ }, [G]);
2463
2668
  i(() => {
2464
- let e = j.current;
2465
- if (e) return e.addEventListener("wheel", it, { passive: !1 }), () => e.removeEventListener("wheel", it);
2466
- }, [it]);
2467
- let at = r((e) => {
2468
- let t = Ue.get(e), n = j.current;
2669
+ let e = M.current;
2670
+ if (e) return e.addEventListener("wheel", ot, { passive: !1 }), () => e.removeEventListener("wheel", ot);
2671
+ }, [ot]);
2672
+ let st = r((e) => {
2673
+ let t = Ge.get(e), n = M.current;
2469
2674
  if (!t || !n) return;
2470
2675
  let r = Math.max(R, 1);
2471
- K({
2676
+ G({
2472
2677
  scale: r,
2473
2678
  panX: n.clientWidth / 2 - (t.x + t.w / 2) * r,
2474
2679
  panY: n.clientHeight / 2 - (t.y + t.h / 2) * r
2475
2680
  }, !0);
2476
2681
  }, [
2477
- K,
2478
- Ue,
2682
+ G,
2683
+ Ge,
2479
2684
  R
2480
- ]), ot = r((e) => {
2481
- if (D && e === L) return;
2482
- D || ye(e), E?.(e ? {
2685
+ ]), ct = r((e) => {
2686
+ if (O && e === L) return;
2687
+ O || ve(e), D?.(e ? {
2483
2688
  type: "select",
2484
2689
  id: e
2485
2690
  } : { type: "clear-selection" });
2486
- let t = e ? V.byId.get(e) : null;
2487
- ie?.(e, t ? mr(t) : null);
2691
+ let t = e ? B.byId.get(e) : null;
2692
+ re?.(e, t ? Sr(t) : null);
2488
2693
  }, [
2694
+ O,
2695
+ re,
2489
2696
  D,
2490
- ie,
2491
- E,
2492
2697
  L,
2493
- V.byId
2494
- ]), st = r((e) => {
2495
- D || (he(e), _e(/* @__PURE__ */ new Set())), E?.({
2698
+ B.byId
2699
+ ]), K = r((e) => {
2700
+ O || (me(e), ge(/* @__PURE__ */ new Set())), D?.({
2496
2701
  type: "set-grain",
2497
- grain: qn[e]
2498
- }), oe?.(e), D || C?.([]);
2702
+ grain: tr[e]
2703
+ }), ae?.(e), O || w?.([]);
2499
2704
  }, [
2500
- D,
2501
- C,
2502
- oe,
2503
- E
2504
- ]), [ct, lt] = l(null), [ut, dt] = l("");
2705
+ O,
2706
+ w,
2707
+ ae,
2708
+ D
2709
+ ]), [lt, ut] = l(null), [dt, ft] = l("");
2505
2710
  i(() => {
2506
- ct && !I.has(ct) && lt(null);
2507
- }, [ct, I]);
2508
- let J = r((e) => {
2509
- if ((We.get(e) || 0) === 0) return;
2510
- let t = V.byId.get(e), n = new Set(I);
2511
- if (n.has(e)) n.delete(e), lt((t) => {
2711
+ lt && !I.has(lt) && ut(null);
2712
+ }, [lt, I]);
2713
+ let pt = r((e) => {
2714
+ if ((W.get(e) || 0) === 0) return;
2715
+ let t = B.byId.get(e), n = new Set(I);
2716
+ if (n.has(e)) n.delete(e), ut((t) => {
2512
2717
  if (t !== e) return t;
2513
- let r = V.parentIdByChild.get(e) ?? null;
2718
+ let r = B.parentIdByChild.get(e) ?? null;
2514
2719
  return r && n.has(r) ? r : null;
2515
- }), dt(`closed ${er(t?.label || e)}`);
2720
+ }), ft(`closed ${cr(t?.label || e)}`);
2516
2721
  else {
2517
- n.add(e), se?.(e), lt(e);
2518
- let r = We.get(e) || 0;
2519
- dt(`opened ${er(t?.label || e)}, showing ${r} item${r === 1 ? "" : "s"}`);
2722
+ n.add(e), oe?.(e), ut(e);
2723
+ let r = W.get(e) || 0;
2724
+ ft(`opened ${cr(t?.label || e)}, showing ${r} item${r === 1 ? "" : "s"}`);
2520
2725
  }
2521
- D || _e(n), E?.({
2726
+ O || ge(n), D?.({
2522
2727
  type: "set-expanded",
2523
2728
  ids: Array.from(n)
2524
- }), C?.(Array.from(n));
2729
+ }), w?.(Array.from(n));
2525
2730
  }, [
2526
- D,
2527
- We,
2731
+ O,
2732
+ W,
2528
2733
  I,
2529
- se,
2530
- C,
2531
- E,
2532
- V.byId,
2533
- V.parentIdByChild
2534
- ]), ft = s(() => {
2535
- if (!ct) return [];
2536
- let e = [], t = ct;
2734
+ oe,
2735
+ w,
2736
+ D,
2737
+ B.byId,
2738
+ B.parentIdByChild
2739
+ ]), mt = s(() => {
2740
+ if (!lt) return [];
2741
+ let e = [], t = lt;
2537
2742
  for (; t;) {
2538
- let n = V.byId.get(t);
2743
+ let n = B.byId.get(t);
2539
2744
  if (!n) break;
2540
- e.unshift(n), t = V.parentIdByChild.get(t) ?? null;
2745
+ e.unshift(n), t = B.parentIdByChild.get(t) ?? null;
2541
2746
  }
2542
2747
  return e;
2543
- }, [ct, V]), pt = r(() => {
2544
- D || _e(/* @__PURE__ */ new Set()), E?.({
2748
+ }, [lt, B]), ht = r(() => {
2749
+ O || ge(/* @__PURE__ */ new Set()), D?.({
2545
2750
  type: "set-expanded",
2546
2751
  ids: []
2547
- }), C?.([]), lt(null), dt("back to the top level");
2752
+ }), w?.([]), ut(null), ft("back to the top level");
2548
2753
  }, [
2549
- D,
2550
- C,
2551
- E
2552
- ]), mt = r((e) => {
2553
- let t = ft.slice(0, e + 1), n = t.map((e) => e.id), r = new Set(n);
2554
- D || _e(r), E?.({
2754
+ O,
2755
+ w,
2756
+ D
2757
+ ]), gt = r((e) => {
2758
+ let t = mt.slice(0, e + 1), n = t.map((e) => e.id), r = new Set(n);
2759
+ O || ge(r), D?.({
2555
2760
  type: "set-expanded",
2556
2761
  ids: n
2557
- }), C?.(n);
2762
+ }), w?.(n);
2558
2763
  let i = t[t.length - 1] ?? null;
2559
- lt(i?.id ?? null), dt(i ? `back to ${er(i.label || i.id)}` : "back to the top level");
2764
+ ut(i?.id ?? null), ft(i ? `back to ${cr(i.label || i.id)}` : "back to the top level");
2560
2765
  }, [
2561
- ft,
2562
- D,
2563
- C,
2564
- E
2565
- ]), ht = r((e) => {
2766
+ mt,
2767
+ O,
2768
+ w,
2769
+ D
2770
+ ]), _t = r((e) => {
2566
2771
  let t = e.key;
2567
2772
  if (t === "+" || t === "=") {
2568
- e.preventDefault(), rt(Kn);
2773
+ e.preventDefault(), at(er);
2569
2774
  return;
2570
2775
  }
2571
2776
  if (t === "-" || t === "_") {
2572
- e.preventDefault(), rt(1 / Kn);
2777
+ e.preventDefault(), at(1 / er);
2573
2778
  return;
2574
2779
  }
2575
2780
  if (t === "0") {
2576
- e.preventDefault(), Ze(!0);
2781
+ e.preventDefault(), Qe(!0);
2577
2782
  return;
2578
2783
  }
2579
2784
  if (t === "ArrowLeft" || t === "ArrowRight" || t === "ArrowUp" || t === "ArrowDown") {
2580
2785
  e.preventDefault();
2581
- let n = A ? Ue.get(A) : void 0;
2786
+ let n = j ? Ge.get(j) : void 0;
2582
2787
  if (!n) {
2583
- let e = ur(U);
2584
- e && be(e.node.id);
2788
+ let e = vr(V);
2789
+ e && ye(e.node.id);
2585
2790
  return;
2586
2791
  }
2587
2792
  let r;
2588
- r = t === "ArrowLeft" ? dr(U, n, -1) : t === "ArrowRight" ? dr(U, n, 1) : t === "ArrowUp" ? fr(U, n, -1) : fr(U, n, 1), r && (be(r.node.id), xr(r, j.current, R, z, (e) => {
2589
- K({
2793
+ r = t === "ArrowLeft" ? yr(V, n, -1) : t === "ArrowRight" ? yr(V, n, 1) : t === "ArrowUp" ? br(V, n, -1) : br(V, n, 1), r && (ye(r.node.id), kr(r, M.current, R, z, (e) => {
2794
+ G({
2590
2795
  scale: R,
2591
2796
  panX: e.x,
2592
2797
  panY: e.y
@@ -2595,46 +2800,46 @@ function pr({ data: t = {
2595
2800
  return;
2596
2801
  }
2597
2802
  if (t === "Enter") {
2598
- if (!A) return;
2599
- e.preventDefault(), e.shiftKey ? J(A) : D ? L !== A && ot(A) : ot(L === A ? null : A);
2803
+ if (!j) return;
2804
+ e.preventDefault(), e.shiftKey ? pt(j) : O ? L !== j && ct(j) : ct(L === j ? null : j);
2600
2805
  return;
2601
2806
  }
2602
2807
  if (t === "e" || t === "E") {
2603
- if (!A) return;
2604
- e.preventDefault(), J(A);
2808
+ if (!j) return;
2809
+ e.preventDefault(), pt(j);
2605
2810
  return;
2606
2811
  }
2607
- t === "Escape" && L && (e.preventDefault(), ot(null));
2812
+ t === "Escape" && L && (e.preventDefault(), ct(null));
2608
2813
  }, [
2609
- A,
2610
- U,
2611
- Ue,
2814
+ j,
2815
+ V,
2816
+ Ge,
2612
2817
  L,
2613
2818
  R,
2614
2819
  z,
2615
- D,
2616
- K,
2617
- rt,
2618
- Ze,
2619
- J,
2620
- ot
2621
- ]), gt = r((e) => {
2622
- let t = M.current;
2820
+ O,
2821
+ G,
2822
+ at,
2823
+ Qe,
2824
+ pt,
2825
+ ct
2826
+ ]), vt = r((e) => {
2827
+ let t = N.current;
2623
2828
  if (!t || e !== t.pointerId) return;
2624
- M.current = null;
2625
- let n = j.current;
2829
+ N.current = null;
2830
+ let n = M.current;
2626
2831
  try {
2627
2832
  n?.releasePointerCapture?.(e);
2628
2833
  } catch {}
2629
- D && ke(null);
2630
- }, [D]), _t = r((e) => {
2834
+ O && Oe(null);
2835
+ }, [O]), yt = r((e) => {
2631
2836
  if (e.button !== 0 || e.target instanceof Element && e.target.closest("button, a, input, select, textarea")) return;
2632
- if (M.current) {
2633
- if (Date.now() - M.current.startedAt < Zn) return;
2634
- gt(M.current.pointerId);
2837
+ if (N.current) {
2838
+ if (Date.now() - N.current.startedAt < ar) return;
2839
+ vt(N.current.pointerId);
2635
2840
  }
2636
- let t = j.current;
2637
- t && t.setPointerCapture?.(e.pointerId), M.current = {
2841
+ let t = M.current;
2842
+ t && t.setPointerCapture?.(e.pointerId), N.current = {
2638
2843
  pointerId: e.pointerId,
2639
2844
  startX: e.clientX,
2640
2845
  startY: e.clientY,
@@ -2644,49 +2849,49 @@ function pr({ data: t = {
2644
2849
  nextPan: null,
2645
2850
  startedAt: Date.now()
2646
2851
  };
2647
- }, [z, gt]), vt = r((e) => {
2648
- let t = M.current;
2852
+ }, [z, vt]), bt = r((e) => {
2853
+ let t = N.current;
2649
2854
  if (!t || e.pointerId !== t.pointerId) return;
2650
2855
  let n = e.clientX - t.startX, r = e.clientY - t.startY;
2651
2856
  !t.moved && Math.abs(n) + Math.abs(r) > 3 && (t.moved = !0), t.moved && (t.nextPan = {
2652
2857
  scale: Ve.current,
2653
2858
  panX: t.panX + n,
2654
2859
  panY: t.panY + r
2655
- }, D ? ke(t.nextPan) : K(t.nextPan, !0));
2656
- }, [K, D]), yt = r((e) => {
2657
- let t = M.current;
2860
+ }, O ? Oe(t.nextPan) : G(t.nextPan, !0));
2861
+ }, [G, O]), xt = r((e) => {
2862
+ let t = N.current;
2658
2863
  if (!t || e.pointerId !== t.pointerId) return;
2659
- M.current = null;
2660
- let n = j.current;
2864
+ N.current = null;
2865
+ let n = M.current;
2661
2866
  try {
2662
2867
  n?.releasePointerCapture?.(e.pointerId);
2663
2868
  } catch {}
2664
- t.moved && D && t.nextPan && (K(t.nextPan, !0), ke({ ...t.nextPan })), !t.moved && e.target === e.currentTarget && ot(null);
2869
+ t.moved && O && t.nextPan && (G(t.nextPan, !0), Oe({ ...t.nextPan })), !t.moved && e.target === e.currentTarget && ct(null);
2665
2870
  }, [
2666
- K,
2667
- D,
2668
- ot
2669
- ]), bt = r((e) => gt(e.pointerId), [gt]), xt = r((e) => gt(e.pointerId), [gt]), St = s(() => {
2670
- if (!A) return "";
2671
- let e = V.byId.get(A);
2672
- return e ? br(e, {
2673
- selected: L === A,
2674
- expanded: I.has(A),
2675
- violations: qe.get(A) || 0
2871
+ G,
2872
+ O,
2873
+ ct
2874
+ ]), St = r((e) => vt(e.pointerId), [vt]), Ct = r((e) => vt(e.pointerId), [vt]), wt = s(() => {
2875
+ if (!j) return "";
2876
+ let e = B.byId.get(j);
2877
+ return e ? Or(e, {
2878
+ selected: L === j,
2879
+ expanded: I.has(j),
2880
+ violations: Je.get(j) || 0
2676
2881
  }) : "";
2677
2882
  }, [
2678
- A,
2679
- V.byId,
2883
+ j,
2884
+ B.byId,
2680
2885
  L,
2681
2886
  I,
2682
- qe
2683
- ]), Ct = s(() => {
2684
- let e = j.current;
2685
- if (!e || W <= 0 || G <= 0) return null;
2887
+ Je
2888
+ ]), q = s(() => {
2889
+ let e = M.current;
2890
+ if (!e || H <= 0 || U <= 0) return null;
2686
2891
  let t = e.clientWidth, n = e.clientHeight;
2687
2892
  return {
2688
- graphW: W,
2689
- graphH: G,
2893
+ graphW: H,
2894
+ graphH: U,
2690
2895
  viewX: -z.x / R,
2691
2896
  viewY: -z.y / R,
2692
2897
  viewW: t / R,
@@ -2695,30 +2900,30 @@ function pr({ data: t = {
2695
2900
  }, [
2696
2901
  z,
2697
2902
  R,
2698
- W,
2699
- G
2700
- ]), wt = U.length === 0, Tt = (e) => `${k}-grain-${e}`;
2903
+ H,
2904
+ U
2905
+ ]), Tt = V.length === 0, Et = (e) => `${A}-grain-${e}`;
2701
2906
  return /* @__PURE__ */ f("div", {
2702
- className: ["mc", ue].filter(Boolean).join(" "),
2703
- style: { height: ce },
2907
+ className: ["mc", le].filter(Boolean).join(" "),
2908
+ style: { height: se },
2704
2909
  role: "application",
2705
- "aria-label": le,
2910
+ "aria-label": ce,
2706
2911
  "aria-roledescription": "code structure map",
2707
2912
  children: [
2708
2913
  /* @__PURE__ */ f("div", {
2709
- id: fe,
2914
+ id: de,
2710
2915
  className: "mc-sr",
2711
2916
  role: "status",
2712
2917
  "aria-live": "polite",
2713
2918
  children: [
2714
2919
  /* @__PURE__ */ d("span", {
2715
2920
  "data-focus-announcement": !0,
2716
- children: St
2921
+ children: wt
2717
2922
  }),
2718
2923
  " ",
2719
2924
  /* @__PURE__ */ d("span", {
2720
2925
  "data-descent-announcement": !0,
2721
- children: ut
2926
+ children: dt
2722
2927
  })
2723
2928
  ]
2724
2929
  }),
@@ -2728,14 +2933,14 @@ function pr({ data: t = {
2728
2933
  className: "mc-seg",
2729
2934
  role: "radiogroup",
2730
2935
  "aria-label": "detail grain",
2731
- children: Yn.map((e) => /* @__PURE__ */ f("button", {
2732
- id: Tt(e.id),
2936
+ children: rr.map((e) => /* @__PURE__ */ f("button", {
2937
+ id: Et(e.id),
2733
2938
  type: "button",
2734
2939
  role: "radio",
2735
2940
  "aria-checked": F === e.id,
2736
2941
  className: "mc-seg-btn mono",
2737
2942
  "data-active": F === e.id ? "true" : void 0,
2738
- onClick: () => st(e.id),
2943
+ onClick: () => K(e.id),
2739
2944
  children: [F === e.id && /* @__PURE__ */ d(p, {
2740
2945
  className: "lucide",
2741
2946
  "aria-hidden": "true"
@@ -2744,11 +2949,11 @@ function pr({ data: t = {
2744
2949
  }), /* @__PURE__ */ f("div", {
2745
2950
  className: "mc-search",
2746
2951
  role: "combobox",
2747
- "aria-expanded": De && Ye.length > 0,
2952
+ "aria-expanded": Ee && Xe.length > 0,
2748
2953
  "aria-haspopup": "listbox",
2749
- "aria-owns": pe,
2954
+ "aria-owns": fe,
2750
2955
  children: [
2751
- /* @__PURE__ */ d(re, {
2956
+ /* @__PURE__ */ d(ne, {
2752
2957
  className: "lucide mc-search-ico",
2753
2958
  "aria-hidden": "true"
2754
2959
  }),
@@ -2757,31 +2962,31 @@ function pr({ data: t = {
2757
2962
  type: "text",
2758
2963
  placeholder: "find a node",
2759
2964
  "aria-label": "find a node",
2760
- "aria-controls": pe,
2965
+ "aria-controls": fe,
2761
2966
  "aria-autocomplete": "list",
2762
- value: Te,
2967
+ value: we,
2763
2968
  onChange: (e) => {
2764
- Ee(e.target.value), Oe(!0);
2969
+ Te(e.target.value), De(!0);
2765
2970
  },
2766
- onFocus: () => Oe(!0),
2971
+ onFocus: () => De(!0),
2767
2972
  onBlur: () => {
2768
- window.setTimeout(() => Oe(!1), 120);
2973
+ window.setTimeout(() => De(!1), 120);
2769
2974
  },
2770
2975
  onKeyDown: (e) => {
2771
- e.key === "Enter" && Ye[0] ? (e.preventDefault(), Et(Ye[0])) : e.key === "Escape" && Oe(!1);
2976
+ e.key === "Enter" && Xe[0] ? (e.preventDefault(), Dt(Xe[0])) : e.key === "Escape" && De(!1);
2772
2977
  }
2773
2978
  }),
2774
- De && Ye.length > 0 && /* @__PURE__ */ d("ul", {
2979
+ Ee && Xe.length > 0 && /* @__PURE__ */ d("ul", {
2775
2980
  className: "mc-results",
2776
- id: pe,
2981
+ id: fe,
2777
2982
  role: "listbox",
2778
2983
  "aria-label": "search results",
2779
- children: Ye.map((e) => /* @__PURE__ */ f("li", {
2984
+ children: Xe.map((e) => /* @__PURE__ */ f("li", {
2780
2985
  role: "option",
2781
2986
  "aria-selected": e.id === L,
2782
2987
  className: "mc-result mono",
2783
2988
  onMouseDown: (t) => {
2784
- t.preventDefault(), Et(e);
2989
+ t.preventDefault(), Dt(e);
2785
2990
  },
2786
2991
  children: [e.kind === "folder" ? /* @__PURE__ */ d(b, {
2787
2992
  className: "lucide",
@@ -2798,93 +3003,93 @@ function pr({ data: t = {
2798
3003
  ]
2799
3004
  })]
2800
3005
  }),
2801
- ft.length > 0 && /* @__PURE__ */ f("nav", {
3006
+ mt.length > 0 && /* @__PURE__ */ f("nav", {
2802
3007
  className: "mc-breadcrumb mono",
2803
3008
  "aria-label": "folder path",
2804
3009
  children: [/* @__PURE__ */ d("button", {
2805
3010
  type: "button",
2806
3011
  className: "mc-breadcrumb-crumb",
2807
- onClick: pt,
3012
+ onClick: ht,
2808
3013
  children: "top level"
2809
- }), ft.map((t, n) => /* @__PURE__ */ f(e, { children: [/* @__PURE__ */ d(g, {
3014
+ }), mt.map((t, n) => /* @__PURE__ */ f(e, { children: [/* @__PURE__ */ d(g, {
2810
3015
  className: "lucide mc-breadcrumb-sep",
2811
3016
  "aria-hidden": "true"
2812
- }), n === ft.length - 1 ? /* @__PURE__ */ d("span", {
3017
+ }), n === mt.length - 1 ? /* @__PURE__ */ d("span", {
2813
3018
  className: "mc-breadcrumb-crumb mc-breadcrumb-current",
2814
3019
  "aria-current": "location",
2815
- children: er(t.label || t.id)
3020
+ children: cr(t.label || t.id)
2816
3021
  }) : /* @__PURE__ */ d("button", {
2817
3022
  type: "button",
2818
3023
  className: "mc-breadcrumb-crumb",
2819
- onClick: () => mt(n),
2820
- children: er(t.label || t.id)
3024
+ onClick: () => gt(n),
3025
+ children: cr(t.label || t.id)
2821
3026
  })] }, t.id))]
2822
3027
  }),
2823
3028
  /* @__PURE__ */ d("div", {
2824
3029
  className: "mc-viewport",
2825
- ref: j,
3030
+ ref: M,
2826
3031
  tabIndex: 0,
2827
3032
  role: "group",
2828
3033
  "aria-label": "map canvas: arrow keys move focus, enter selects, plus and minus zoom, ctrl or cmd plus wheel to zoom",
2829
- "aria-activedescendant": A && H.has(A) ? `${k}-node-${yr(A)}` : void 0,
2830
- onKeyDown: ht,
2831
- onPointerDown: _t,
2832
- onPointerMove: vt,
2833
- onPointerUp: yt,
2834
- onPointerCancel: bt,
2835
- onLostPointerCapture: xt,
2836
- children: wt ? /* @__PURE__ */ d("p", {
3034
+ "aria-activedescendant": j && We.has(j) ? `${A}-node-${Dr(j)}` : void 0,
3035
+ onKeyDown: _t,
3036
+ onPointerDown: yt,
3037
+ onPointerMove: bt,
3038
+ onPointerUp: xt,
3039
+ onPointerCancel: St,
3040
+ onLostPointerCapture: Ct,
3041
+ children: Tt ? /* @__PURE__ */ d("p", {
2837
3042
  className: "mc-empty mono",
2838
3043
  children: "no nodes to map"
2839
3044
  }) : /* @__PURE__ */ f(u, { children: [
2840
3045
  /* @__PURE__ */ f("div", {
2841
- className: ["mc-stage", $e ? "mc-stage--auto-fit" : ""].filter(Boolean).join(" "),
3046
+ className: ["mc-stage", et ? "mc-stage--auto-fit" : ""].filter(Boolean).join(" "),
2842
3047
  style: {
2843
3048
  transform: `translate(${z.x}px, ${z.y}px) scale(${R})`,
2844
- width: W,
2845
- height: G
3049
+ width: H,
3050
+ height: U
2846
3051
  },
2847
3052
  children: [/* @__PURE__ */ d("svg", {
2848
3053
  className: "mc-edges",
2849
- width: W,
2850
- height: G,
2851
- viewBox: `0 0 ${W} ${G}`,
3054
+ width: H,
3055
+ height: U,
3056
+ viewBox: `0 0 ${H} ${U}`,
2852
3057
  "aria-hidden": "true",
2853
- children: Ge.map((e) => {
2854
- let t = Ue.get(e.from), n = Ue.get(e.to);
3058
+ children: Ke.map((e) => {
3059
+ let t = Ge.get(e.from), n = Ge.get(e.to);
2855
3060
  if (!t || !n) return null;
2856
- let r = ne[vr(e.from, e.to)] ?? ne[vr(e.from, e.to, "arrow")];
2857
- return /* @__PURE__ */ d(Cr, {
3061
+ let r = te[Er(e.from, e.to)] ?? te[Er(e.from, e.to, "arrow")];
3062
+ return /* @__PURE__ */ d(jr, {
2858
3063
  a: t,
2859
3064
  b: n,
2860
3065
  kind: e.kind,
2861
3066
  weight: e.weight,
2862
- maxWeight: Ke,
3067
+ maxWeight: qe,
2863
3068
  delta: r
2864
3069
  }, `${e.kind}:${e.from}->${e.to}`);
2865
3070
  })
2866
- }), U.map((t) => {
2867
- let n = (We.get(t.node.id) || 0) > 0, r = I.has(t.node.id);
2868
- return /* @__PURE__ */ f(e, { children: [/* @__PURE__ */ d(Sr, {
2869
- domId: `${k}-node-${yr(t.node.id)}`,
3071
+ }), V.map((t) => {
3072
+ let n = (W.get(t.node.id) || 0) > 0, r = I.has(t.node.id);
3073
+ return /* @__PURE__ */ f(e, { children: [/* @__PURE__ */ d(Ar, {
3074
+ domId: `${A}-node-${Dr(t.node.id)}`,
2870
3075
  p: t,
2871
3076
  selected: L === t.node.id,
2872
- focused: A === t.node.id,
2873
- highlighted: Je.has(t.node.id),
3077
+ focused: j === t.node.id,
3078
+ highlighted: Ye.has(t.node.id),
2874
3079
  delta: x[t.node.id],
2875
3080
  expandable: n,
2876
3081
  expanded: r,
2877
- violations: qe.get(t.node.id) || 0,
3082
+ violations: Je.get(t.node.id) || 0,
2878
3083
  onClick: (e) => {
2879
- e >= 2 || (be(t.node.id), D ? L !== t.node.id && ot(t.node.id) : ot(L === t.node.id ? null : t.node.id));
3084
+ e >= 2 || (ye(t.node.id), O ? L !== t.node.id && ct(t.node.id) : ct(L === t.node.id ? null : t.node.id));
2880
3085
  },
2881
3086
  onDoubleClick: () => {
2882
- n && J(t.node.id);
3087
+ n && pt(t.node.id);
2883
3088
  }
2884
3089
  }), n ? /* @__PURE__ */ d("button", {
2885
3090
  type: "button",
2886
3091
  className: "mc-node-disclosure",
2887
- "aria-label": `${r ? "hide" : "show"} children for ${er(t.node.label || t.node.id)}`,
3092
+ "aria-label": `${r ? "hide" : "show"} children for ${cr(t.node.label || t.node.id)}`,
2888
3093
  "aria-expanded": r,
2889
3094
  style: {
2890
3095
  left: t.x + t.w,
@@ -2893,7 +3098,7 @@ function pr({ data: t = {
2893
3098
  onPointerDown: (e) => e.stopPropagation(),
2894
3099
  onKeyDown: (e) => e.stopPropagation(),
2895
3100
  onClick: (e) => {
2896
- e.stopPropagation(), J(t.node.id);
3101
+ e.stopPropagation(), pt(t.node.id);
2897
3102
  },
2898
3103
  children: /* @__PURE__ */ d(g, { "aria-hidden": "true" })
2899
3104
  }) : null] }, t.node.id);
@@ -2908,8 +3113,8 @@ function pr({ data: t = {
2908
3113
  type: "button",
2909
3114
  className: "mc-zoom-btn",
2910
3115
  "aria-label": "zoom in",
2911
- onClick: () => rt(Kn),
2912
- children: /* @__PURE__ */ d(te, {
3116
+ onClick: () => at(er),
3117
+ children: /* @__PURE__ */ d(ee, {
2913
3118
  className: "lucide",
2914
3119
  "aria-hidden": "true"
2915
3120
  })
@@ -2918,8 +3123,8 @@ function pr({ data: t = {
2918
3123
  type: "button",
2919
3124
  className: "mc-zoom-btn",
2920
3125
  "aria-label": "zoom out",
2921
- onClick: () => rt(1 / Kn),
2922
- children: /* @__PURE__ */ d(ee, {
3126
+ onClick: () => at(1 / er),
3127
+ children: /* @__PURE__ */ d(C, {
2923
3128
  className: "lucide",
2924
3129
  "aria-hidden": "true"
2925
3130
  })
@@ -2928,7 +3133,7 @@ function pr({ data: t = {
2928
3133
  type: "button",
2929
3134
  className: "mc-zoom-btn",
2930
3135
  "aria-label": "fit map to view",
2931
- onClick: () => Ze(!0),
3136
+ onClick: () => Qe(!0),
2932
3137
  children: /* @__PURE__ */ d(S, {
2933
3138
  className: "lucide",
2934
3139
  "aria-hidden": "true"
@@ -2936,26 +3141,26 @@ function pr({ data: t = {
2936
3141
  })
2937
3142
  ]
2938
3143
  }),
2939
- Ct && /* @__PURE__ */ d("div", {
3144
+ q && /* @__PURE__ */ d("div", {
2940
3145
  className: "mc-minimap",
2941
3146
  "aria-hidden": "true",
2942
3147
  children: /* @__PURE__ */ f("svg", {
2943
3148
  className: "mc-minimap-svg",
2944
- viewBox: `0 0 ${Ct.graphW} ${Ct.graphH}`,
3149
+ viewBox: `0 0 ${q.graphW} ${q.graphH}`,
2945
3150
  preserveAspectRatio: "xMidYMid meet",
2946
- children: [U.map((e) => /* @__PURE__ */ d("rect", {
3151
+ children: [V.map((e) => /* @__PURE__ */ d("rect", {
2947
3152
  className: "mc-mini-node",
2948
- "data-cov": $n(e.node.coverage),
3153
+ "data-cov": sr(e.node.coverage),
2949
3154
  x: e.x,
2950
3155
  y: e.y,
2951
3156
  width: e.w,
2952
3157
  height: e.h
2953
3158
  }, e.node.id)), /* @__PURE__ */ d("rect", {
2954
3159
  className: "mc-mini-view",
2955
- x: Ct.viewX,
2956
- y: Ct.viewY,
2957
- width: Ct.viewW,
2958
- height: Ct.viewH
3160
+ x: q.viewX,
3161
+ y: q.viewY,
3162
+ width: q.viewW,
3163
+ height: q.viewH
2959
3164
  })]
2960
3165
  })
2961
3166
  }),
@@ -2999,7 +3204,7 @@ function pr({ data: t = {
2999
3204
  }),
3000
3205
  /* @__PURE__ */ f("span", {
3001
3206
  className: "mc-legend-item mc-legend-viol",
3002
- children: [/* @__PURE__ */ d(ae, { className: "lucide" }), " violation"]
3207
+ children: [/* @__PURE__ */ d(ie, { className: "lucide" }), " violation"]
3003
3208
  })
3004
3209
  ]
3005
3210
  })
@@ -3007,47 +3212,47 @@ function pr({ data: t = {
3007
3212
  })
3008
3213
  ]
3009
3214
  });
3010
- function Et(e) {
3011
- let t = e.kind === "file" && F !== "files" ? "files" : F, n = new Set(t === F ? I : []), r = V.parentIdByChild.get(e.id);
3012
- for (; r && V.byId.has(r);) n.has(r) || (n.add(r), se?.(r)), r = V.parentIdByChild.get(r);
3215
+ function Dt(e) {
3216
+ let t = e.kind === "file" && F !== "files" ? "files" : F, n = new Set(t === F ? I : []), r = B.parentIdByChild.get(e.id);
3217
+ for (; r && B.byId.has(r);) n.has(r) || (n.add(r), oe?.(r)), r = B.parentIdByChild.get(r);
3013
3218
  let i = Array.from(n);
3014
- D || (he(t), _e(n)), E?.({
3219
+ O || (me(t), ge(n)), D?.({
3015
3220
  type: "reveal",
3016
3221
  id: e.id,
3017
- grain: qn[t],
3222
+ grain: tr[t],
3018
3223
  expandedIds: i
3019
- }), t !== F && oe?.(t), C?.(i), Ee(""), Oe(!1), be(e.id), D || ye(e.id), ie?.(e.id, mr(e)), window.requestAnimationFrame(() => {
3020
- window.requestAnimationFrame(() => at(e.id));
3224
+ }), t !== F && ae?.(t), w?.(i), Te(""), De(!1), ye(e.id), O || ve(e.id), re?.(e.id, Sr(e)), window.requestAnimationFrame(() => {
3225
+ window.requestAnimationFrame(() => st(e.id));
3021
3226
  });
3022
3227
  }
3023
3228
  }
3024
- function mr(e) {
3229
+ function Sr(e) {
3025
3230
  let { _order: t, ...n } = e;
3026
3231
  return n;
3027
3232
  }
3028
- function hr(e) {
3233
+ function Cr(e) {
3029
3234
  return e ? e instanceof Set ? new Set(e) : new Set(Array.from(e)) : /* @__PURE__ */ new Set();
3030
3235
  }
3031
- function gr(e) {
3032
- return tn(e);
3236
+ function wr(e) {
3237
+ return dn(e);
3033
3238
  }
3034
3239
  function $(e, t) {
3035
3240
  return Number.isFinite(e) ? e : t;
3036
3241
  }
3037
- function _r(e) {
3242
+ function Tr(e) {
3038
3243
  return e ? Array.from(e).map(String).sort().join("\0") : "";
3039
3244
  }
3040
- function vr(e, t, n = "plain") {
3245
+ function Er(e, t, n = "plain") {
3041
3246
  return n === "arrow" ? `${e}->${t}` : `${e}→${t}`;
3042
3247
  }
3043
- function yr(e) {
3248
+ function Dr(e) {
3044
3249
  return String(e).replace(/[^a-zA-Z0-9_-]/g, "_");
3045
3250
  }
3046
- function br(e, t = {}) {
3047
- let { selected: n, expanded: r, violations: i = 0 } = t, a = $n(e.coverage), o = `${er(e.label || e.id)}: ${e.kind}, coverage ${a} of 4`;
3251
+ function Or(e, t = {}) {
3252
+ let { selected: n, expanded: r, violations: i = 0 } = t, a = sr(e.coverage), o = `${cr(e.label || e.id)}: ${e.kind}, coverage ${a} of 4`;
3048
3253
  return e.loc && (o += `, ${e.loc} loc`), i > 0 && (o += `, ${i} violation${i === 1 ? "" : "s"}`), n && (o += ", selected"), r && (o += ", expanded"), o;
3049
3254
  }
3050
- function xr(e, t, n, r, i) {
3255
+ function kr(e, t, n, r, i) {
3051
3256
  if (!t) return;
3052
3257
  let a = e.x * n + r.x, o = e.y * n + r.y, s = (e.x + e.w) * n + r.x, c = (e.y + e.h) * n + r.y, l = 0, u = 0;
3053
3258
  a < 24 ? l = 24 - a : s > t.clientWidth - 24 && (l = t.clientWidth - 24 - s), o < 24 ? u = 24 - o : c > t.clientHeight - 24 && (u = t.clientHeight - 24 - c), (l !== 0 || u !== 0) && i({
@@ -3055,8 +3260,8 @@ function xr(e, t, n, r, i) {
3055
3260
  y: r.y + u
3056
3261
  });
3057
3262
  }
3058
- function Sr({ domId: e, p: t, selected: n, focused: r, highlighted: i, delta: a, expandable: o, expanded: s, violations: c, onClick: l, onDoubleClick: u }) {
3059
- let p = t.node, m = $n(p.coverage);
3263
+ function Ar({ domId: e, p: t, selected: n, focused: r, highlighted: i, delta: a, expandable: o, expanded: s, violations: c, onClick: l, onDoubleClick: u }) {
3264
+ let p = t.node, m = sr(p.coverage);
3060
3265
  return /* @__PURE__ */ f("button", {
3061
3266
  id: e,
3062
3267
  type: "button",
@@ -3066,8 +3271,8 @@ function Sr({ domId: e, p: t, selected: n, focused: r, highlighted: i, delta: a,
3066
3271
  "data-focused": r ? "true" : void 0,
3067
3272
  "data-highlighted": i ? "true" : void 0,
3068
3273
  "data-delta": a || void 0,
3069
- "data-ink-flip": m >= Qn ? "true" : void 0,
3070
- "aria-label": br(p, {
3274
+ "data-ink-flip": m >= or ? "true" : void 0,
3275
+ "aria-label": Or(p, {
3071
3276
  selected: n,
3072
3277
  expanded: s,
3073
3278
  violations: c
@@ -3104,12 +3309,12 @@ function Sr({ domId: e, p: t, selected: n, focused: r, highlighted: i, delta: a,
3104
3309
  }),
3105
3310
  /* @__PURE__ */ d("span", {
3106
3311
  className: "mc-node-name mono",
3107
- children: er(p.label || p.id)
3312
+ children: cr(p.label || p.id)
3108
3313
  }),
3109
3314
  c > 0 && /* @__PURE__ */ f("span", {
3110
3315
  className: "mc-node-viol mono tnum",
3111
3316
  "aria-hidden": "true",
3112
- children: [/* @__PURE__ */ d(ae, {
3317
+ children: [/* @__PURE__ */ d(ie, {
3113
3318
  className: "lucide",
3114
3319
  "aria-hidden": "true"
3115
3320
  }), c]
@@ -3127,7 +3332,7 @@ function Sr({ domId: e, p: t, selected: n, focused: r, highlighted: i, delta: a,
3127
3332
  ]
3128
3333
  });
3129
3334
  }
3130
- function Cr({ a: e, b: t, kind: n, weight: r, maxWeight: i, delta: a }) {
3335
+ function jr({ a: e, b: t, kind: n, weight: r, maxWeight: i, delta: a }) {
3131
3336
  let o = e.x + e.w / 2, s = e.y + e.h, c = t.x + t.w / 2, l = t.y, u = (s + l) / 2, p = `M ${o} ${s} L ${o} ${u} L ${c} ${u} L ${c} ${l}`, m = 1 + Math.min(r, i) / i * 2;
3132
3337
  return /* @__PURE__ */ f("g", {
3133
3338
  className: "mc-edge",
@@ -3145,7 +3350,7 @@ function Cr({ a: e, b: t, kind: n, weight: r, maxWeight: i, delta: a }) {
3145
3350
  }
3146
3351
  //#endregion
3147
3352
  //#region src/ui/RailShell.jsx
3148
- function wr({ toolbar: e, children: t, rail: n, railSide: r = "right", sheetTitle: i = "details", sheetMeta: o, className: s = "" }) {
3353
+ function Mr({ toolbar: e, children: t, rail: n, railSide: r = "right", sheetTitle: i = "details", sheetMeta: o, className: s = "" }) {
3149
3354
  let [c, u] = l(!1), p = `rs-sheet-${a()}`;
3150
3355
  return /* @__PURE__ */ f("div", {
3151
3356
  className: `rs rs--${r}${s ? ` ${s}` : ""}`,
@@ -3208,7 +3413,7 @@ function wr({ toolbar: e, children: t, rail: n, railSide: r = "right", sheetTitl
3208
3413
  })]
3209
3414
  });
3210
3415
  }
3211
- function Tr({ title: e, icon: t, meta: n, children: r, collapsible: i = !1, defaultOpen: o = !0, className: s = "" }) {
3416
+ function Nr({ title: e, icon: t, meta: n, children: r, collapsible: i = !1, defaultOpen: o = !0, className: s = "" }) {
3212
3417
  let [c, p] = l(o), m = `rs-sec-${a()}`, h = /* @__PURE__ */ f(u, { children: [
3213
3418
  t && /* @__PURE__ */ d(t, {
3214
3419
  className: "rs-sec-icon lucide",
@@ -3249,7 +3454,7 @@ function Tr({ title: e, icon: t, meta: n, children: r, collapsible: i = !1, defa
3249
3454
  })]
3250
3455
  });
3251
3456
  }
3252
- function Er({ title: e, icon: t, meta: n, children: r, defaultOpen: i = !0 }) {
3457
+ function Pr({ title: e, icon: t, meta: n, children: r, defaultOpen: i = !0 }) {
3253
3458
  let [o, s] = l(i), c = `rs-split-${a()}`;
3254
3459
  return /* @__PURE__ */ f("section", {
3255
3460
  className: `rs-split-panel${o ? " is-open" : ""}`,
@@ -3287,15 +3492,15 @@ function Er({ title: e, icon: t, meta: n, children: r, defaultOpen: i = !0 }) {
3287
3492
  })]
3288
3493
  });
3289
3494
  }
3290
- function Dr({ left: e, right: t, leftTitle: n = "outline", rightTitle: r = "filters", leftIcon: i, rightIcon: a, leftMeta: o, rightMeta: s, className: c = "" }) {
3495
+ function Fr({ left: e, right: t, leftTitle: n = "outline", rightTitle: r = "filters", leftIcon: i, rightIcon: a, leftMeta: o, rightMeta: s, className: c = "" }) {
3291
3496
  return /* @__PURE__ */ f("div", {
3292
3497
  className: `rs-split${c ? ` ${c}` : ""}`,
3293
- children: [/* @__PURE__ */ d(Er, {
3498
+ children: [/* @__PURE__ */ d(Pr, {
3294
3499
  title: n,
3295
3500
  icon: i,
3296
3501
  meta: o,
3297
3502
  children: e
3298
- }), /* @__PURE__ */ d(Er, {
3503
+ }), /* @__PURE__ */ d(Pr, {
3299
3504
  title: r,
3300
3505
  icon: a,
3301
3506
  meta: s,
@@ -3305,28 +3510,33 @@ function Dr({ left: e, right: t, leftTitle: n = "outline", rightTitle: r = "filt
3305
3510
  }
3306
3511
  //#endregion
3307
3512
  //#region src/ui/inuse/InUseShell.jsx
3308
- var Or = Object.freeze([
3513
+ var Ir = Object.freeze([
3309
3514
  {
3310
3515
  id: "transcript",
3311
3516
  mark: "transcript-browser",
3312
- icon: ne
3517
+ icon: te
3313
3518
  },
3314
3519
  {
3315
3520
  id: "commons",
3316
3521
  mark: "village",
3317
- icon: oe
3522
+ icon: ae
3318
3523
  },
3319
3524
  {
3320
3525
  id: "graph",
3321
3526
  mark: "peasant",
3322
- icon: C
3527
+ icon: w
3323
3528
  }
3324
- ]), kr = Object.freeze([
3529
+ ]), Lr = Object.freeze([
3325
3530
  Object.freeze({
3326
3531
  id: "home",
3327
3532
  label: "home",
3328
3533
  inNav: !0
3329
3534
  }),
3535
+ Object.freeze({
3536
+ id: "village",
3537
+ label: "village",
3538
+ inNav: !0
3539
+ }),
3330
3540
  Object.freeze({
3331
3541
  id: "settings",
3332
3542
  label: "settings",
@@ -3347,7 +3557,7 @@ var Or = Object.freeze([
3347
3557
  label: "code map",
3348
3558
  inNav: !1
3349
3559
  })
3350
- ]), Ar = Object.freeze([
3560
+ ]), Rr = Object.freeze([
3351
3561
  {
3352
3562
  id: "analytics",
3353
3563
  label: "analytics"
@@ -3361,13 +3571,13 @@ var Or = Object.freeze([
3361
3571
  label: "code map"
3362
3572
  }
3363
3573
  ]);
3364
- function jr(e) {
3574
+ function zr(e) {
3365
3575
  return e.filter((e) => e.inNav !== !1);
3366
3576
  }
3367
- function Mr(e) {
3577
+ function Br(e) {
3368
3578
  return e && (/(INPUT|TEXTAREA|SELECT)/.test(e.tagName) || e.isContentEditable);
3369
3579
  }
3370
- function Nr({ apps: e = Or, defaultApp: t, activeApp: n, onAppChange: r, renderApp: i, brand: a = "fairtrade", ariaLabel: o = "the design system in use" }) {
3580
+ function Vr({ apps: e = Ir, defaultApp: t, activeApp: n, onAppChange: r, renderApp: i, brand: a = "fairtrade", ariaLabel: o = "the design system in use" }) {
3371
3581
  let [s, u] = l(t ?? e[0]?.id), p = n ?? s, m = c({}), h = (e) => {
3372
3582
  n === void 0 && u(e), r?.(e);
3373
3583
  }, g = e.find((e) => e.id === p) ?? e[0];
@@ -3376,7 +3586,7 @@ function Nr({ apps: e = Or, defaultApp: t, activeApp: n, onAppChange: r, renderA
3376
3586
  id: "inuse",
3377
3587
  "aria-label": o,
3378
3588
  onKeyDown: (t) => {
3379
- if (Mr(t.target)) return;
3589
+ if (Br(t.target)) return;
3380
3590
  let n = {
3381
3591
  1: 0,
3382
3592
  2: 1,
@@ -3460,7 +3670,7 @@ function Nr({ apps: e = Or, defaultApp: t, activeApp: n, onAppChange: r, renderA
3460
3670
  })]
3461
3671
  });
3462
3672
  }
3463
- function Pr({ sections: e = kr, activeId: t, activePrimaryId: n, onSectionChange: r, backTo: i, onBack: a, notice: o = null, children: s, ariaLabel: c = "peasant sections" }) {
3673
+ function Hr({ sections: e = Lr, activeId: t, activePrimaryId: n, onSectionChange: r, backTo: i, onBack: a, notice: o = null, children: s, ariaLabel: c = "peasant sections" }) {
3464
3674
  let l = n ?? t;
3465
3675
  return /* @__PURE__ */ f("div", {
3466
3676
  className: "iu-app-root",
@@ -3476,7 +3686,7 @@ function Pr({ sections: e = kr, activeId: t, activePrimaryId: n, onSectionChange
3476
3686
  size: 14,
3477
3687
  "aria-hidden": "true"
3478
3688
  }), " back"]
3479
- }) : null, jr(e).map((e) => /* @__PURE__ */ d("button", {
3689
+ }) : null, zr(e).map((e) => /* @__PURE__ */ d("button", {
3480
3690
  type: "button",
3481
3691
  className: "iu-subnav-item" + (l === e.id ? " active" : ""),
3482
3692
  "aria-current": t === e.id ? "page" : void 0,
@@ -3492,11 +3702,11 @@ function Pr({ sections: e = kr, activeId: t, activePrimaryId: n, onSectionChange
3492
3702
  ]
3493
3703
  });
3494
3704
  }
3495
- function Fr({ sections: e = kr, activeId: t = void 0, hrefFor: n = void 0, LinkComponent: r = void 0, onSectionChange: i = void 0, className: a = "iu-subnav", itemClassName: o = "iu-subnav-item", activeItemClassName: s = "active", activeMarker: c = null, ariaLabel: l = "peasant sections" }) {
3705
+ function Ur({ sections: e = Lr, activeId: t = void 0, hrefFor: n = void 0, LinkComponent: r = void 0, onSectionChange: i = void 0, className: a = "iu-subnav", itemClassName: o = "iu-subnav-item", activeItemClassName: s = "active", activeMarker: c = null, ariaLabel: l = "peasant sections" }) {
3496
3706
  return /* @__PURE__ */ d("nav", {
3497
3707
  className: a,
3498
3708
  "aria-label": l,
3499
- children: jr(e).map((e) => {
3709
+ children: zr(e).map((e) => {
3500
3710
  let a = t === e.id, l = o + (a && s ? " " + s : ""), p = /* @__PURE__ */ f(u, { children: [e.label, a ? c : null] }), m = n?.(e);
3501
3711
  return m && r ? /* @__PURE__ */ d(r, {
3502
3712
  href: m,
@@ -3521,23 +3731,193 @@ function Fr({ sections: e = kr, activeId: t = void 0, hrefFor: n = void 0, LinkC
3521
3731
  });
3522
3732
  }
3523
3733
  //#endregion
3734
+ //#region src/ui/VillageObservations.jsx
3735
+ function Wr({ value: e }) {
3736
+ return e ? /* @__PURE__ */ d("time", {
3737
+ className: "tnum",
3738
+ dateTime: e,
3739
+ children: e
3740
+ }) : /* @__PURE__ */ d(u, { children: "unknown" });
3741
+ }
3742
+ function Gr({ issue: e }) {
3743
+ return e ? /* @__PURE__ */ f("div", {
3744
+ className: "vobs-issue",
3745
+ children: [/* @__PURE__ */ d("p", { children: e.message }), /* @__PURE__ */ d("p", { children: e.retry })]
3746
+ }) : null;
3747
+ }
3748
+ function Kr({ accountLabel: e, villageLabel: t, domains: n, collectives: r, categories: i, view: a, categoryId: o, fetching: s = !1, fetchDisabled: c = !1, status: p, issue: m, onFetch: h, onTrack: g, onViewChange: _, onCategoryChange: v, onPageChange: y, onRestart: b }) {
3749
+ let [x, S] = l("catalog"), [C, ee] = l(i[0]?.id), te = a ?? x, ne = o ?? (i.some((e) => e.id === C) ? C : i[0]?.id);
3750
+ if (a !== void 0 && a !== "catalog" && a !== "history") throw Error("VillageObservations: controlled view must be catalog or history; supply a registered view or omit it for local selection.");
3751
+ if (o !== void 0 && !i.some((e) => e.id === o)) throw Error("VillageObservations: controlled categoryId is not present in categories; supply the selected category or clear the controlled selection when changing scope.");
3752
+ let re = /* @__PURE__ */ f(u, { children: [
3753
+ /* @__PURE__ */ d("p", { children: "Observations do not grant current permission. Earlier details remain dated evidence." }),
3754
+ /* @__PURE__ */ d("div", {
3755
+ role: "status",
3756
+ className: "vobs-status",
3757
+ children: p ?? (s ? "fetching metadata" : "")
3758
+ }),
3759
+ /* @__PURE__ */ d(Gr, { issue: m }),
3760
+ /* @__PURE__ */ d("dl", {
3761
+ className: "vobs-domains",
3762
+ children: n.map((e) => /* @__PURE__ */ f("div", {
3763
+ "data-domain": e.id,
3764
+ children: [/* @__PURE__ */ d("dt", { children: e.label }), /* @__PURE__ */ f("dd", { children: [
3765
+ /* @__PURE__ */ f("p", { children: [e.result, e.commit ? `; ${e.commit}` : ""] }),
3766
+ /* @__PURE__ */ f("p", { children: ["last completed: ", /* @__PURE__ */ d(Wr, { value: e.lastCompletedAt })] }),
3767
+ /* @__PURE__ */ f("p", { children: ["last attempt: ", /* @__PURE__ */ d(Wr, { value: e.lastAttemptAt })] }),
3768
+ /* @__PURE__ */ d(Gr, { issue: e.issue })
3769
+ ] })]
3770
+ }, e.id))
3771
+ })
3772
+ ] }), ie = /* @__PURE__ */ f("div", {
3773
+ className: "vobs-catalog",
3774
+ children: [
3775
+ /* @__PURE__ */ d("p", { children: "Read saved observations offline. Fetch checks metadata only, without downloading transcripts or publishing." }),
3776
+ te === "catalog" && re,
3777
+ /* @__PURE__ */ d("p", { children: "Relevant collectives only. Tracking does not join a collective or grant access." }),
3778
+ r.length === 0 ? /* @__PURE__ */ d("p", { children: "No saved relevant collectives. Fetch metadata to check available sources." }) : /* @__PURE__ */ d("ul", {
3779
+ className: "vobs-list",
3780
+ children: r.map((e) => /* @__PURE__ */ f("li", { children: [
3781
+ /* @__PURE__ */ f("div", {
3782
+ className: "vobs-row-head",
3783
+ children: [/* @__PURE__ */ d("strong", { children: e.name }), g && typeof e.tracking == "boolean" ? /* @__PURE__ */ f(be, {
3784
+ onClick: () => g(e.id, !e.tracking),
3785
+ children: [e.tracking ? "untrack" : "track", /* @__PURE__ */ f("span", {
3786
+ className: "sr-only",
3787
+ children: [" ", e.name]
3788
+ })]
3789
+ }) : null]
3790
+ }),
3791
+ e.description && /* @__PURE__ */ d("p", { children: e.description }),
3792
+ /* @__PURE__ */ f("dl", {
3793
+ className: "vobs-facts",
3794
+ children: [
3795
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("dt", { children: "evidence" }), /* @__PURE__ */ d("dd", { children: e.state })] }),
3796
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("dt", { children: "relevance" }), /* @__PURE__ */ d("dd", { children: e.reasons.join(", ") || "no current relevance" })] }),
3797
+ e.policy && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("dt", { children: "observed policy" }), /* @__PURE__ */ d("dd", { children: e.policy })] }),
3798
+ /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("dt", { children: "observed at" }), /* @__PURE__ */ d("dd", { children: /* @__PURE__ */ d(Wr, { value: e.observedAt }) })] })
3799
+ ]
3800
+ })
3801
+ ] }, e.id))
3802
+ })
3803
+ ]
3804
+ }), ae = /* @__PURE__ */ d("div", {
3805
+ className: "vobs-history",
3806
+ children: i.length ? /* @__PURE__ */ d(N, {
3807
+ "aria-label": "history categories",
3808
+ value: ne,
3809
+ onChange: (e) => {
3810
+ ee(e), v?.(e);
3811
+ },
3812
+ tabs: i.map((e) => ({
3813
+ id: e.id,
3814
+ label: e.label,
3815
+ content: /* @__PURE__ */ f("div", {
3816
+ "aria-busy": e.loading || void 0,
3817
+ children: [
3818
+ te === "history" && ne === e.id && re,
3819
+ /* @__PURE__ */ d("p", { children: "Saved evidence is dated. A confirmed receipt does not mean collective approval. Unknown coverage is not an empty history." }),
3820
+ /* @__PURE__ */ f("p", {
3821
+ className: "vobs-summary",
3822
+ children: [
3823
+ /* @__PURE__ */ d("span", {
3824
+ className: "tnum",
3825
+ children: e.total
3826
+ }),
3827
+ " saved items; coverage: ",
3828
+ e.coverage
3829
+ ]
3830
+ }),
3831
+ /* @__PURE__ */ d(Gr, { issue: e.issue }),
3832
+ e.conflict ? /* @__PURE__ */ d(be, {
3833
+ disabled: !b,
3834
+ onClick: () => b?.(e.id),
3835
+ children: "restart this category"
3836
+ }) : /* @__PURE__ */ f(u, { children: [e.rows.length ? /* @__PURE__ */ d("ul", {
3837
+ className: "vobs-list",
3838
+ children: e.rows.map((e) => /* @__PURE__ */ f("li", {
3839
+ "data-evidence-id": e.id,
3840
+ children: [
3841
+ /* @__PURE__ */ d("strong", { children: e.title }),
3842
+ /* @__PURE__ */ d("p", { children: e.outcome }),
3843
+ e.description && /* @__PURE__ */ d("p", { children: e.description }),
3844
+ /* @__PURE__ */ f("dl", {
3845
+ className: "vobs-facts",
3846
+ children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("dt", { children: "recorded at" }), /* @__PURE__ */ d("dd", { children: /* @__PURE__ */ d(Wr, { value: e.occurredAt }) })] }), e.details?.map((e) => /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("dt", { children: e.label }), /* @__PURE__ */ d("dd", { children: e.value })] }, e.label))]
3847
+ })
3848
+ ]
3849
+ }, e.id))
3850
+ }) : /* @__PURE__ */ d("p", { children: "No saved items on this page." }), /* @__PURE__ */ d("div", {
3851
+ className: "vobs-pager",
3852
+ inert: e.loading || !y ? !0 : void 0,
3853
+ children: /* @__PURE__ */ d(Oe, {
3854
+ label: `${e.label} pages`,
3855
+ page: e.page,
3856
+ total: e.pageCount,
3857
+ onChange: (t) => y?.(e.id, t)
3858
+ })
3859
+ })] })
3860
+ ]
3861
+ })
3862
+ }))
3863
+ }) : /* @__PURE__ */ d("p", { children: "No saved contribution evidence. Fetch metadata to check available history." })
3864
+ });
3865
+ return /* @__PURE__ */ f("section", {
3866
+ className: "vobs",
3867
+ "aria-label": "village observations",
3868
+ children: [/* @__PURE__ */ f("header", {
3869
+ className: "vobs-header",
3870
+ children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h2", { children: "village" }), /* @__PURE__ */ f("p", {
3871
+ className: "vobs-scope",
3872
+ children: [
3873
+ t,
3874
+ /* @__PURE__ */ d("br", {}),
3875
+ e
3876
+ ]
3877
+ })] }), /* @__PURE__ */ d(be, {
3878
+ variant: "primary",
3879
+ onClick: h,
3880
+ disabled: c || s || !h,
3881
+ loading: s,
3882
+ children: "fetch metadata"
3883
+ })]
3884
+ }), /* @__PURE__ */ d(N, {
3885
+ "aria-label": "village views",
3886
+ value: a ?? x,
3887
+ onChange: (e) => {
3888
+ let t = e === "history" ? "history" : "catalog";
3889
+ S(t), _?.(t);
3890
+ },
3891
+ tabs: [{
3892
+ id: "catalog",
3893
+ label: "catalog",
3894
+ content: ie
3895
+ }, {
3896
+ id: "history",
3897
+ label: "history",
3898
+ content: ae
3899
+ }]
3900
+ })]
3901
+ });
3902
+ }
3903
+ //#endregion
3524
3904
  //#region src/ui/transcript/graph/GraphTurnNode.jsx
3525
- function Ir(e) {
3905
+ function qr(e) {
3526
3906
  return e >= 1e3 ? (e / 1e3).toFixed(1).replace(/\.0$/, "") + "k" : String(e);
3527
3907
  }
3528
- function Lr(e, t) {
3908
+ function Jr(e, t) {
3529
3909
  return e === "user" ? "you" : t ? "subagent" : e === "assistant" ? "assistant" : e;
3530
3910
  }
3531
- function Rr({ role: e, agentName: t, provider: n, hasError: r }) {
3532
- return r ? "clay" : e === "user" ? "teal" : t ? "mauve" : e === "assistant" ? n === void 0 ? "amber" : Ne(n) : null;
3911
+ function Yr({ role: e, agentName: t, provider: n, hasError: r }) {
3912
+ return r ? "clay" : e === "user" ? "teal" : t ? "mauve" : e === "assistant" ? n === void 0 ? "amber" : F(n) : null;
3533
3913
  }
3534
- function zr({ role: e, agentName: t, turnNumber: n, contentPreview: r, toolCount: i, totalTokens: a, tokensIn: o, tokensOut: s, hasError: c = !1, hasRetry: l = !1, hasRevert: u = !1, isSearchMatch: p = !1, isFilteredOut: m = !1, isSelected: h = !1, provider: g, className: _ = "" }) {
3535
- let v = Rr({
3914
+ function Xr({ role: e, agentName: t, turnNumber: n, contentPreview: r, toolCount: i, totalTokens: a, tokensIn: o, tokensOut: s, hasError: c = !1, hasRetry: l = !1, hasRevert: u = !1, isSearchMatch: p = !1, isFilteredOut: m = !1, isSelected: h = !1, provider: g, className: _ = "" }) {
3915
+ let v = Yr({
3536
3916
  role: e,
3537
3917
  agentName: t,
3538
3918
  provider: g,
3539
3919
  hasError: c
3540
- }), y = Lr(e, t), b = c ? "error" : l ? "retry" : u ? "re-edit" : null, x = o != null || s != null ? `${o ?? 0} in, ${s ?? 0} out` : void 0;
3920
+ }), y = Jr(e, t), b = c ? "error" : l ? "retry" : u ? "re-edit" : null, x = o != null || s != null ? `${o ?? 0} in, ${s ?? 0} out` : void 0;
3541
3921
  return /* @__PURE__ */ f("div", {
3542
3922
  className: [
3543
3923
  "ft-gnode",
@@ -3590,7 +3970,7 @@ function zr({ role: e, agentName: t, turnNumber: n, contentPreview: r, toolCount
3590
3970
  }), a > 0 && /* @__PURE__ */ d("span", {
3591
3971
  className: "ft-gnode-meta-tokens",
3592
3972
  title: x,
3593
- children: Ir(a)
3973
+ children: qr(a)
3594
3974
  })]
3595
3975
  })
3596
3976
  ]
@@ -3598,19 +3978,19 @@ function zr({ role: e, agentName: t, turnNumber: n, contentPreview: r, toolCount
3598
3978
  }
3599
3979
  //#endregion
3600
3980
  //#region src/ui/transcript/graph/GraphToolNode.jsx
3601
- function Br(e) {
3981
+ function Zr(e) {
3602
3982
  return e == null || e <= 0 ? "" : e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1).replace(/\.0$/, "")}s`;
3603
3983
  }
3604
- function Vr(e) {
3984
+ function Qr(e) {
3605
3985
  if (!e) return "";
3606
3986
  let t = e.split("/");
3607
3987
  return t[t.length - 1] || e;
3608
3988
  }
3609
- function Hr(e) {
3989
+ function $r(e) {
3610
3990
  return !!e.isError || e.exitCode != null && e.exitCode !== 0;
3611
3991
  }
3612
- function Ur({ tools: e, totalDurationMs: t, hasError: n = !1, isFilteredOut: r = !1, max: i = 4, className: a = "" }) {
3613
- let o = e.slice(0, i), s = e.length - o.length, c = Br(t), l = e.length;
3992
+ function ei({ tools: e, totalDurationMs: t, hasError: n = !1, isFilteredOut: r = !1, max: i = 4, className: a = "" }) {
3993
+ let o = e.slice(0, i), s = e.length - o.length, c = Zr(t), l = e.length;
3614
3994
  return /* @__PURE__ */ f("div", {
3615
3995
  className: [
3616
3996
  "ft-gnode",
@@ -3631,7 +4011,7 @@ function Ur({ tools: e, totalDurationMs: t, hasError: n = !1, isFilteredOut: r =
3631
4011
  }), /* @__PURE__ */ f("ul", {
3632
4012
  className: "ft-gnode-tools-list",
3633
4013
  children: [o.map((e) => {
3634
- let t = Hr(e), n = e.preview || Vr(e.filePath);
4014
+ let t = $r(e), n = e.preview || Qr(e.filePath);
3635
4015
  return /* @__PURE__ */ f("li", {
3636
4016
  className: `ft-gnode-tools-row${t ? " ft-gnode-tools-row-failed" : ""}`,
3637
4017
  children: [
@@ -3662,7 +4042,7 @@ function Ur({ tools: e, totalDurationMs: t, hasError: n = !1, isFilteredOut: r =
3662
4042
  }
3663
4043
  //#endregion
3664
4044
  //#region src/ui/transcript/graph/GraphSubagentBranch.jsx
3665
- function Wr({ agentName: e, depth: t, className: n = "" }) {
4045
+ function ti({ agentName: e, depth: t, className: n = "" }) {
3666
4046
  return /* @__PURE__ */ f("div", {
3667
4047
  className: ["ft-gnode-lane", n].filter(Boolean).join(" "),
3668
4048
  children: [
@@ -3683,7 +4063,7 @@ function Wr({ agentName: e, depth: t, className: n = "" }) {
3683
4063
  }
3684
4064
  //#endregion
3685
4065
  //#region src/ui/transcript/graph/GraphLegend.jsx
3686
- var Gr = Object.freeze([
4066
+ var ni = Object.freeze([
3687
4067
  {
3688
4068
  kind: "user",
3689
4069
  label: "you"
@@ -3705,20 +4085,20 @@ var Gr = Object.freeze([
3705
4085
  label: "error"
3706
4086
  }
3707
4087
  ]);
3708
- function Kr({ kind: e, provider: t }) {
4088
+ function ri({ kind: e, provider: t }) {
3709
4089
  switch (e) {
3710
4090
  case "user": return "teal";
3711
- case "assistant": return t === void 0 ? "amber" : Ne(t);
4091
+ case "assistant": return t === void 0 ? "amber" : F(t);
3712
4092
  case "subagent": return "mauve";
3713
4093
  case "error": return "clay";
3714
4094
  default: return null;
3715
4095
  }
3716
4096
  }
3717
- function qr({ items: e = Gr, className: t = "" }) {
4097
+ function ii({ items: e = ni, className: t = "" }) {
3718
4098
  return /* @__PURE__ */ d("div", {
3719
4099
  className: ["ft-graph-legend", t].filter(Boolean).join(" "),
3720
4100
  children: e.map((e) => {
3721
- let t = Kr(e), n = t ? { background: `var(--${t})` } : void 0;
4101
+ let t = ri(e), n = t ? { background: `var(--${t})` } : void 0;
3722
4102
  return /* @__PURE__ */ f("span", {
3723
4103
  className: "ft-graph-legend-item",
3724
4104
  children: [/* @__PURE__ */ d("span", {
@@ -3732,4 +4112,4 @@ function qr({ items: e = Gr, className: t = "" }) {
3732
4112
  });
3733
4113
  }
3734
4114
  //#endregion
3735
- export { ft as $, Tt as A, Zt as B, mn as C, Ne as Ct, St as D, Te as Dt, Ct as E, Ee as Et, Pt as F, _t as G, Bt as H, Yt as I, lt as J, ct as K, Qt as L, It as M, Ft as N, Dt as O, we as Ot, zt as P, mt as Q, Lt as R, tn as S, Le as St, wt as T, Oe as Tt, ht as U, Jt as V, gt as W, st as X, ut as Y, pt as Z, Y as _, ze as _t, zr as a, Ge as at, vn as b, P as bt, Fr as c, U as ct, kr as d, z as dt, ot as et, Tr as f, B as ft, en as g, Be as gt, pr as h, I as ht, Ur as i, Ke as it, Ot as j, Et as k, Or as l, W as lt, Dr as m, V as mt, qr as n, Ye as nt, Ar as o, We as ot, wr as p, He as pt, dt as q, Wr as r, qe as rt, Pr as s, Ue as st, Gr as t, tt, Nr as u, H as ut, fn as v, L as vt, gn as w, je as wt, hn as x, Fe as xt, X as y, F as yt, Rt as z };
4115
+ export { wt as $, Ft as A, M as At, qt as B, dn as C, z as Ct, Mt as D, Ae as Dt, Nt as E, Me as Et, Jt as F, Tt as G, rn as H, Ut as I, bt as J, Et as K, an as L, Lt as M, be as Mt, Gt as N, xe as Nt, jt as O, Oe as Ot, Wt as P, Se as Pt, Ct as Q, cn as R, wn as S, Be as St, Tn as T, Re as Tt, Yt as U, sn as V, q as W, yt as X, vt as Y, gt as Z, un as _, V as _t, Xr as a, et as at, Y as b, B as bt, Hr as c, G as ct, Vr as d, Je as dt, St as et, Lr as f, U as ft, xr as g, Ue as gt, Fr as h, Ke as ht, ei as i, tt as it, Pt as j, De as jt, It as k, N as kt, Ur as l, Ye as lt, Mr as m, qe as mt, ii as n, ut as nt, Kr as o, $e as ot, Nr as p, W as pt, _t as q, ti as r, rt, Rr as s, Qe as st, ni as t, ht as tt, Ir as u, Xe as ut, J as v, He as vt, Cn as w, F as wt, Dn as x, L as xt, xn as y, We as yt, Kt as z };