@peasant-labs/fairtrade 0.0.6 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -21
- package/dist/lib/InUseShell-ClWg74-v.js +3388 -0
- package/dist/lib/commons.js +803 -838
- package/dist/lib/components.css +1 -1
- package/dist/lib/graph.css +1 -1
- package/dist/lib/graph.js +871 -276
- package/dist/lib/tokens.css +4 -0
- package/dist/lib/tokens.json +16 -0
- package/dist/lib/types/CommitGraph.d.ts +50 -3
- package/dist/lib/types/MapCanvas.d.ts +45 -2
- package/dist/lib/types/ProviderIcon.d.ts +23 -20
- package/dist/lib/types/commons/providers.d.ts +7 -8
- package/dist/lib/types/commons/types.d.ts +3 -6
- package/dist/lib/types/graph/Changes.d.ts +8 -4
- package/dist/lib/types/graph/CodeMap.d.ts +17 -1
- package/dist/lib/types/graph/CodeMapComposition.d.ts +25 -1
- package/dist/lib/types/graph/CodeMapNavigator.d.ts +35 -0
- package/dist/lib/types/graph/GhostCommitNode.d.ts +20 -0
- package/dist/lib/types/graph/GhostGroup.d.ts +21 -0
- package/dist/lib/types/graph/HighlightEdge.d.ts +16 -0
- package/dist/lib/types/graph/InsightPanel.d.ts +25 -0
- package/dist/lib/types/graph/RankModeControl.d.ts +13 -0
- package/dist/lib/types/graph/RankedRow.d.ts +15 -0
- package/dist/lib/types/graph/ScentTag.d.ts +15 -0
- package/dist/lib/types/graph/SessionLane.d.ts +29 -0
- package/dist/lib/types/graph/SessionOverflowDisclosure.d.ts +23 -0
- package/dist/lib/types/graph/TouchedFileCluster.d.ts +17 -0
- package/dist/lib/types/graph/changeGraph.d.ts +12 -0
- package/dist/lib/types/graph/codeMapState.d.ts +240 -0
- package/dist/lib/types/graph/graphContractPolicy.d.ts +24 -0
- package/dist/lib/types/graph/index.d.ts +35 -1
- package/dist/lib/types/graph/ranking.d.ts +222 -0
- package/dist/lib/types/graph/timelineNavigation.d.ts +33 -0
- package/dist/lib/types/graph/types.d.ts +67 -440
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/provider-policy.d.ts +27 -0
- package/dist/lib/types/transcript/TranscriptViewer.d.ts +1 -1
- package/dist/lib/types/transcript/adapter.d.ts +5 -40
- package/dist/lib/types/transcript/graph/GraphLegend.d.ts +3 -3
- package/dist/lib/types/transcript/graph/GraphTurnNode.d.ts +2 -2
- package/dist/lib/types/transcript/index.d.ts +3 -1
- package/dist/lib/types/transcript/initial-position.d.ts +80 -0
- package/dist/lib/types/transcript/state-capabilities.d.ts +22 -1
- package/dist/lib/types/transcript/useTranscriptInitialPosition.d.ts +26 -0
- package/dist/lib/types/transcript/view-model.d.ts +16 -16
- package/dist/lib/types/transcript/wire-types.d.ts +46 -308
- package/dist/lib/{ui-TG4XLhWL.js → ui-FKKOy92_.js} +3295 -3455
- package/dist/lib/ui.js +4 -4
- package/package.json +66 -26
- package/dist/lib/InUseShell-CjtqHauP.js +0 -1532
|
@@ -0,0 +1,3388 @@
|
|
|
1
|
+
import { Fragment as e, useCallback as t, useEffect as n, useId as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { Check as d, ChevronDown as f, ChevronLeft as p, ChevronRight as m, Eye as h, EyeOff as g, FileCode as _, Folder as v, GitMerge as y, Maximize as ee, Minus as b, Plus as x, ScrollText as te, Search as ne, Star as re, TriangleAlert as ie, Users as ae, Waypoints as oe } from "lucide-react";
|
|
4
|
+
import { AllChangeBindings as se, AllDiffLineKinds as S, AllEdgeViolationKinds as ce, AllFileChangeStatuses as le, AllInsightKinds as ue, AllInsightProvenances as de, AllMapNodeKinds as C, AllReadAttributionStates as fe, AllReadStateGrades as w, Harness as T, isChangeBinding as E, isDiffLineKind as pe, isEdgeViolationKind as D, isFileChangeStatus as me, isHarness as he, isInsightKind as ge, isInsightProvenance as _e, isMapNodeKind as ve, isReadAttributionState as ye, isReadStateGrade as be } from "@peasant-labs/schema";
|
|
5
|
+
//#region src/ui/BrandMark.jsx
|
|
6
|
+
var xe = {
|
|
7
|
+
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",
|
|
8
|
+
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",
|
|
9
|
+
openai: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",
|
|
10
|
+
opencode: "M22 24H2V0h20zM17 4.8H7v14.4h10z",
|
|
11
|
+
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"
|
|
12
|
+
}, O = {
|
|
13
|
+
anthropic: "claude",
|
|
14
|
+
"claude-code": "claude",
|
|
15
|
+
google: "gemini",
|
|
16
|
+
googlegemini: "gemini",
|
|
17
|
+
"gemini-cli": "gemini",
|
|
18
|
+
codex: "openai",
|
|
19
|
+
"codex-cli": "openai",
|
|
20
|
+
chatgpt: "openai",
|
|
21
|
+
gpt: "openai"
|
|
22
|
+
}, Se = {
|
|
23
|
+
claude: "Claude",
|
|
24
|
+
gemini: "Gemini",
|
|
25
|
+
openai: "OpenAI",
|
|
26
|
+
cursor: "Cursor",
|
|
27
|
+
opencode: "opencode"
|
|
28
|
+
};
|
|
29
|
+
function Ce(e) {
|
|
30
|
+
if (!e) return null;
|
|
31
|
+
let t = String(e).toLowerCase().trim(), n = O[t] || t;
|
|
32
|
+
return xe[n] ? n : null;
|
|
33
|
+
}
|
|
34
|
+
function we({ name: e, size: t, label: n, className: r = "", ...i }) {
|
|
35
|
+
let a = Ce(e);
|
|
36
|
+
if (!a) return null;
|
|
37
|
+
let o = ["brand", r].filter(Boolean).join(" "), s = t == null ? {} : {
|
|
38
|
+
width: t,
|
|
39
|
+
height: t,
|
|
40
|
+
style: {
|
|
41
|
+
width: t,
|
|
42
|
+
height: t
|
|
43
|
+
}
|
|
44
|
+
}, c = n ? {
|
|
45
|
+
role: "img",
|
|
46
|
+
"aria-label": n === !0 ? Se[a] : n,
|
|
47
|
+
focusable: "false"
|
|
48
|
+
} : {
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
focusable: "false"
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ l("svg", {
|
|
53
|
+
className: o,
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
...s,
|
|
56
|
+
...c,
|
|
57
|
+
...i,
|
|
58
|
+
children: /* @__PURE__ */ l("path", { d: xe[a] })
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/ui/provider-policy.js
|
|
63
|
+
var Te = Object.freeze(Object.values(T)), Ee = Object.freeze({
|
|
64
|
+
"claude-code": "Claude Code",
|
|
65
|
+
"gemini-cli": "Gemini CLI",
|
|
66
|
+
codex: "Codex",
|
|
67
|
+
opencode: "opencode",
|
|
68
|
+
cursor: "Cursor",
|
|
69
|
+
antigravity: "Google Antigravity"
|
|
70
|
+
}), De = Object.freeze({
|
|
71
|
+
"claude-code": "claude",
|
|
72
|
+
"gemini-cli": "gemini",
|
|
73
|
+
codex: "openai",
|
|
74
|
+
opencode: "opencode",
|
|
75
|
+
cursor: "cursor",
|
|
76
|
+
antigravity: "gemini"
|
|
77
|
+
}), Oe = Object.freeze({
|
|
78
|
+
"claude-code": "amber",
|
|
79
|
+
"gemini-cli": "teal",
|
|
80
|
+
codex: "olive",
|
|
81
|
+
opencode: "mauve",
|
|
82
|
+
cursor: "clay",
|
|
83
|
+
antigravity: "teal"
|
|
84
|
+
});
|
|
85
|
+
function ke(e, t) {
|
|
86
|
+
if (he(e)) return;
|
|
87
|
+
let n;
|
|
88
|
+
try {
|
|
89
|
+
n = JSON.stringify(e);
|
|
90
|
+
} catch {
|
|
91
|
+
n = String(e);
|
|
92
|
+
}
|
|
93
|
+
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 ${Te.join(", ")}.`);
|
|
94
|
+
}
|
|
95
|
+
function Ae(e) {
|
|
96
|
+
return ke(e, "provider display-name resolution"), Ee[e];
|
|
97
|
+
}
|
|
98
|
+
function k(e) {
|
|
99
|
+
return ke(e, "provider brand resolution"), De[e];
|
|
100
|
+
}
|
|
101
|
+
function A(e) {
|
|
102
|
+
return ke(e, "provider accent resolution"), Oe[e];
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/ui/Intensity.jsx
|
|
106
|
+
function j(e) {
|
|
107
|
+
let t = Math.round(Number(e) || 0);
|
|
108
|
+
return Math.max(0, Math.min(4, t));
|
|
109
|
+
}
|
|
110
|
+
function je(e, t) {
|
|
111
|
+
if (!t || t <= 0 || e <= 0) return 0;
|
|
112
|
+
let n = Math.min(e / t, 1);
|
|
113
|
+
return n < .25 ? 1 : n < .5 ? 2 : n < .9 ? 3 : 4;
|
|
114
|
+
}
|
|
115
|
+
function Me(e) {
|
|
116
|
+
if (!e || e <= 0) return 0;
|
|
117
|
+
let t = Math.min(e, 1);
|
|
118
|
+
return t <= .25 ? 1 : t <= .5 ? 2 : t <= .75 ? 3 : 4;
|
|
119
|
+
}
|
|
120
|
+
function Ne(e, t) {
|
|
121
|
+
if (e <= 0 || t <= 0) return 0;
|
|
122
|
+
let n = Math.min(e / t, 1);
|
|
123
|
+
return n <= .25 ? 1 : n <= .5 ? 2 : n <= .75 ? 3 : 4;
|
|
124
|
+
}
|
|
125
|
+
function Pe(e) {
|
|
126
|
+
let t = Number(e) || 0;
|
|
127
|
+
return t < 60 ? "xs" : t < 200 ? "sm" : t < 600 ? "md" : t < 1500 ? "lg" : "xl";
|
|
128
|
+
}
|
|
129
|
+
var Fe = [
|
|
130
|
+
"none",
|
|
131
|
+
"low",
|
|
132
|
+
"some",
|
|
133
|
+
"most",
|
|
134
|
+
"full"
|
|
135
|
+
];
|
|
136
|
+
function Ie({ level: e = 0, accent: t, size: n, label: r, className: i = "", ...a }) {
|
|
137
|
+
let o = j(e);
|
|
138
|
+
return /* @__PURE__ */ l("span", {
|
|
139
|
+
className: `ir-swatch${n === "lg" ? " ir-swatch--lg" : ""}${i ? ` ${i}` : ""}`,
|
|
140
|
+
"data-level": o,
|
|
141
|
+
"data-accent": t || void 0,
|
|
142
|
+
role: "img",
|
|
143
|
+
"aria-label": r || `intensity ${o} of 4 (${Fe[o]})`,
|
|
144
|
+
...a
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function M({ title: e = "coverage", words: t = Fe, className: n = "" }) {
|
|
148
|
+
return /* @__PURE__ */ u("div", {
|
|
149
|
+
className: `ir-scope ir-legend${n ? ` ${n}` : ""}`,
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ l("span", {
|
|
152
|
+
className: "ir-legend__title",
|
|
153
|
+
children: e
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ l("div", {
|
|
156
|
+
className: "ir-legend__steps",
|
|
157
|
+
children: [
|
|
158
|
+
0,
|
|
159
|
+
1,
|
|
160
|
+
2,
|
|
161
|
+
3,
|
|
162
|
+
4
|
|
163
|
+
].map((e) => /* @__PURE__ */ u("div", {
|
|
164
|
+
className: "ir-legend__step",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ l("span", {
|
|
167
|
+
className: "ir-legend__cell",
|
|
168
|
+
"data-level": e,
|
|
169
|
+
"aria-hidden": "true"
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ l("span", {
|
|
172
|
+
className: "ir-legend__num",
|
|
173
|
+
children: e
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ l("span", {
|
|
176
|
+
className: "ir-legend__label",
|
|
177
|
+
children: t[e]
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
}, e))
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ u("div", {
|
|
183
|
+
className: "ir-legend__ends",
|
|
184
|
+
children: [/* @__PURE__ */ l("span", { children: "none" }), /* @__PURE__ */ l("span", { children: "full" })]
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function Le({ values: e, levels: t, max: n, labels: r, ariaLabel: i = "intensity heatmap", className: a = "" }) {
|
|
190
|
+
let o = t ? t.map(j) : (e || []).map((t) => Ne(t, n ?? Math.max(1, ...e || [1])));
|
|
191
|
+
return /* @__PURE__ */ l("div", {
|
|
192
|
+
className: `ir-scope ir-heatmap${a ? ` ${a}` : ""}`,
|
|
193
|
+
role: "img",
|
|
194
|
+
"aria-label": i,
|
|
195
|
+
children: o.map((e, t) => /* @__PURE__ */ l("span", {
|
|
196
|
+
className: "ir-heatmap__cell",
|
|
197
|
+
"data-level": e,
|
|
198
|
+
title: `${r?.[t] ?? `cell ${t + 1}`}: ${Fe[e]} (${e}/4)`
|
|
199
|
+
}, t))
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function Re({ label: e, loc: t, coverage: n = 0, recorded: r, total: i, selected: a = !1, violation: o = 0, effortPct: s, size: c, as: f = "button", onClick: p, className: m = "", ...h }) {
|
|
203
|
+
let g = i == null ? j(n) : je(r ?? 0, i), _ = c || Pe(t), v = Math.max(0, Math.round(Number(o) || 0)), y = s != null && s > 0, ee = y ? Me(s > 1 ? s / 100 : s) : 0, b = [
|
|
204
|
+
e,
|
|
205
|
+
i == null ? `coverage ${g} of 4` : `${r ?? 0} of ${i} recorded`,
|
|
206
|
+
t == null ? null : `${t} loc`,
|
|
207
|
+
v > 0 ? `${v} violation${v === 1 ? "" : "s"}` : null,
|
|
208
|
+
a ? "selected" : null
|
|
209
|
+
].filter(Boolean).join(" · "), x = f, te = x === "button";
|
|
210
|
+
return /* @__PURE__ */ u(x, {
|
|
211
|
+
className: `ir-node ir-node--${_}${m ? ` ${m}` : ""}`,
|
|
212
|
+
"data-coverage": g,
|
|
213
|
+
"data-selected": a ? "true" : void 0,
|
|
214
|
+
type: te ? "button" : void 0,
|
|
215
|
+
"aria-pressed": te ? a : void 0,
|
|
216
|
+
"aria-label": b,
|
|
217
|
+
onClick: p,
|
|
218
|
+
...h,
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ u("span", {
|
|
221
|
+
className: "ir-node__head",
|
|
222
|
+
children: [/* @__PURE__ */ l("span", {
|
|
223
|
+
className: "ir-node__label",
|
|
224
|
+
children: e
|
|
225
|
+
}), v > 0 && /* @__PURE__ */ u("span", {
|
|
226
|
+
className: "ir-node__badge",
|
|
227
|
+
"aria-hidden": "true",
|
|
228
|
+
children: [/* @__PURE__ */ l(ie, { "aria-hidden": "true" }), /* @__PURE__ */ l("span", {
|
|
229
|
+
className: "tnum",
|
|
230
|
+
children: v
|
|
231
|
+
})]
|
|
232
|
+
})]
|
|
233
|
+
}),
|
|
234
|
+
/* @__PURE__ */ u("span", {
|
|
235
|
+
className: "ir-node__count",
|
|
236
|
+
children: [i == null ? `cov ${g}/4` : `${r ?? 0}/${i}`, t == null ? "" : ` · ${t} loc`]
|
|
237
|
+
}),
|
|
238
|
+
a && /* @__PURE__ */ l("span", {
|
|
239
|
+
className: "ir-node__mark",
|
|
240
|
+
"aria-hidden": "true",
|
|
241
|
+
children: /* @__PURE__ */ l(d, { "aria-hidden": "true" })
|
|
242
|
+
}),
|
|
243
|
+
y && /* @__PURE__ */ l("span", {
|
|
244
|
+
className: "ir-node__effort",
|
|
245
|
+
"data-level": ee,
|
|
246
|
+
"aria-hidden": "true"
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function ze({ children: e, className: t = "", ...n }) {
|
|
252
|
+
return /* @__PURE__ */ l("div", {
|
|
253
|
+
className: `ir-scope${t ? ` ${t}` : ""}`,
|
|
254
|
+
...n,
|
|
255
|
+
children: e
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/ui/ProviderIcon.jsx
|
|
260
|
+
var Be = Te, Ve = Oe;
|
|
261
|
+
function N(e) {
|
|
262
|
+
return `var(--${A(e)})`;
|
|
263
|
+
}
|
|
264
|
+
function P({ harness: e, size: t, accent: n = !1, label: r, className: i = "", ...a }) {
|
|
265
|
+
ke(e, "ProviderIcon render in src/ui/ProviderIcon.jsx");
|
|
266
|
+
let o = k(e), s = ["pv-icon", i].filter(Boolean).join(" "), c = n ? { color: N(e) } : void 0, u = r === !0 ? Ae(e) : r;
|
|
267
|
+
return /* @__PURE__ */ l("span", {
|
|
268
|
+
className: s,
|
|
269
|
+
style: c,
|
|
270
|
+
...a,
|
|
271
|
+
children: /* @__PURE__ */ l(we, {
|
|
272
|
+
name: o,
|
|
273
|
+
size: t,
|
|
274
|
+
label: u
|
|
275
|
+
})
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function F({ harness: e, accent: t = !1, className: n = "", ...r }) {
|
|
279
|
+
return ke(e, "ProviderTag render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ u("span", {
|
|
280
|
+
className: ["pv-tag", n].filter(Boolean).join(" "),
|
|
281
|
+
...r,
|
|
282
|
+
children: [/* @__PURE__ */ l(P, {
|
|
283
|
+
harness: e,
|
|
284
|
+
accent: t
|
|
285
|
+
}), /* @__PURE__ */ l("span", {
|
|
286
|
+
className: "pv-tag-label",
|
|
287
|
+
children: e
|
|
288
|
+
})]
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function I({ harness: e, accent: t = !1, className: n = "", ...r }) {
|
|
292
|
+
return ke(e, "ProviderName render in src/ui/ProviderIcon.jsx"), /* @__PURE__ */ u("span", {
|
|
293
|
+
className: ["pv-name", n].filter(Boolean).join(" "),
|
|
294
|
+
style: t ? { color: N(e) } : void 0,
|
|
295
|
+
...r,
|
|
296
|
+
children: [/* @__PURE__ */ l(P, { harness: e }), /* @__PURE__ */ l("span", {
|
|
297
|
+
className: "pv-name-label",
|
|
298
|
+
children: e
|
|
299
|
+
})]
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function L({ className: e = "", ...t }) {
|
|
303
|
+
return /* @__PURE__ */ l("ul", {
|
|
304
|
+
className: ["pv-legend", e].filter(Boolean).join(" "),
|
|
305
|
+
...t,
|
|
306
|
+
children: Be.map((e) => {
|
|
307
|
+
let t = A(e);
|
|
308
|
+
return /* @__PURE__ */ u("li", {
|
|
309
|
+
className: "pv-legend-row",
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ l(P, {
|
|
312
|
+
harness: e,
|
|
313
|
+
accent: !0,
|
|
314
|
+
className: "pv-legend-mark"
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ l("span", {
|
|
317
|
+
className: "pv-legend-name",
|
|
318
|
+
children: e
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ l("span", {
|
|
321
|
+
className: "pv-swatch",
|
|
322
|
+
style: { background: `var(--${t})` },
|
|
323
|
+
"aria-hidden": "true"
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ l("span", {
|
|
326
|
+
className: "pv-legend-token",
|
|
327
|
+
children: t
|
|
328
|
+
})
|
|
329
|
+
]
|
|
330
|
+
}, e);
|
|
331
|
+
})
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/ui/graph/GhostCommitNode.jsx
|
|
336
|
+
var R = Object.freeze({
|
|
337
|
+
hash: "matched by hash",
|
|
338
|
+
patch_id: "matched by patch content",
|
|
339
|
+
author_identity: "matched by author and time",
|
|
340
|
+
message_embedded: "matched by message text",
|
|
341
|
+
temporal: "matched by nearby time only",
|
|
342
|
+
none: "no match found"
|
|
343
|
+
});
|
|
344
|
+
function He({ ghostHash: e, subject: t, resolution: n, method: r, confidence: i, className: a = "", ...o }) {
|
|
345
|
+
let s = n === "unresolved" ? "session-era commit, no longer in history; not enough recorded metadata to map it" : `${R[r] ?? r}, ${i} confidence`;
|
|
346
|
+
return /* @__PURE__ */ l("span", {
|
|
347
|
+
className: `tlp-ghost-node tlp-terminal-${i}${a ? ` ${a}` : ""}`,
|
|
348
|
+
role: "img",
|
|
349
|
+
"aria-label": `rewritten commit ${e.slice(0, 8)}${t ? `: ${t}` : ""}: ${s}`,
|
|
350
|
+
title: s,
|
|
351
|
+
...o,
|
|
352
|
+
children: /* @__PURE__ */ l("svg", {
|
|
353
|
+
className: "tlp-ghost-diamond",
|
|
354
|
+
viewBox: "0 0 9 9",
|
|
355
|
+
width: "9",
|
|
356
|
+
height: "9",
|
|
357
|
+
"aria-hidden": "true",
|
|
358
|
+
children: /* @__PURE__ */ l("rect", {
|
|
359
|
+
x: "1.3",
|
|
360
|
+
y: "1.3",
|
|
361
|
+
width: "6.4",
|
|
362
|
+
height: "6.4",
|
|
363
|
+
transform: "rotate(45 4.5 4.5)"
|
|
364
|
+
})
|
|
365
|
+
})
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/ui/graph/SessionLane.jsx
|
|
370
|
+
function Ue({ sessionId: e, title: t, harness: n, hovered: r = !1, selected: i = !1, onHover: a, onSelect: o, unresolvedGhosts: s = [], className: c = "", ...d }) {
|
|
371
|
+
let f = [
|
|
372
|
+
"tlp-session-lane",
|
|
373
|
+
r && "tlp-session-lane-hover",
|
|
374
|
+
i && "tlp-session-lane-sel",
|
|
375
|
+
c
|
|
376
|
+
].filter(Boolean).join(" "), p = t || e, m = i ? `${p} selected` : "";
|
|
377
|
+
return /* @__PURE__ */ u("span", {
|
|
378
|
+
className: "tlp-session-lane-group",
|
|
379
|
+
children: [/* @__PURE__ */ u("button", {
|
|
380
|
+
type: "button",
|
|
381
|
+
className: f,
|
|
382
|
+
"aria-pressed": i,
|
|
383
|
+
onMouseEnter: () => a?.(e),
|
|
384
|
+
onMouseLeave: () => a?.(null),
|
|
385
|
+
onFocus: () => a?.(e),
|
|
386
|
+
onBlur: () => a?.(null),
|
|
387
|
+
onClick: () => o?.(e),
|
|
388
|
+
...d,
|
|
389
|
+
children: [
|
|
390
|
+
n && /* @__PURE__ */ l(P, {
|
|
391
|
+
harness: n,
|
|
392
|
+
label: !0
|
|
393
|
+
}),
|
|
394
|
+
/* @__PURE__ */ l("span", {
|
|
395
|
+
className: "tlp-session-lane-title",
|
|
396
|
+
children: p
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ l("span", {
|
|
399
|
+
className: "tlp-sr",
|
|
400
|
+
role: "status",
|
|
401
|
+
"aria-live": "polite",
|
|
402
|
+
children: m
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
}), s.length > 0 && /* @__PURE__ */ l("span", {
|
|
406
|
+
className: "tlp-session-lane-ghosts",
|
|
407
|
+
role: "group",
|
|
408
|
+
"aria-label": "session-era commits with no recorded mapping",
|
|
409
|
+
children: s.map((e) => /* @__PURE__ */ l(He, {
|
|
410
|
+
ghostHash: e.ghostHash,
|
|
411
|
+
subject: e.subject,
|
|
412
|
+
resolution: e.resolution,
|
|
413
|
+
method: e.method,
|
|
414
|
+
confidence: e.confidence
|
|
415
|
+
}, e.ghostHash))
|
|
416
|
+
})]
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/ui/graph/GhostGroup.jsx
|
|
421
|
+
function z({ successorHash: e, ghosts: t, expanded: n, onToggle: r, className: i = "", ...a }) {
|
|
422
|
+
let o = `${t.length} session-era commit${t.length === 1 ? "" : "s"}`;
|
|
423
|
+
return /* @__PURE__ */ u("div", {
|
|
424
|
+
className: `tlp-ghost-group${i ? ` ${i}` : ""}`,
|
|
425
|
+
...a,
|
|
426
|
+
children: [/* @__PURE__ */ u("button", {
|
|
427
|
+
type: "button",
|
|
428
|
+
className: "tlp-ghost-group-toggle",
|
|
429
|
+
"aria-expanded": n,
|
|
430
|
+
"aria-label": `${o}, mapped to ${e.slice(0, 8)}`,
|
|
431
|
+
onClick: () => r(e),
|
|
432
|
+
children: [
|
|
433
|
+
/* @__PURE__ */ l(m, {
|
|
434
|
+
className: `tlp-ghost-group-chevron${n ? " tlp-ghost-group-chevron-open" : ""}`,
|
|
435
|
+
"aria-hidden": "true"
|
|
436
|
+
}),
|
|
437
|
+
/* @__PURE__ */ l("span", {
|
|
438
|
+
className: "tlp-ghost-group-stack",
|
|
439
|
+
"aria-hidden": "true",
|
|
440
|
+
children: /* @__PURE__ */ l("svg", {
|
|
441
|
+
viewBox: "0 0 9 9",
|
|
442
|
+
width: "9",
|
|
443
|
+
height: "9",
|
|
444
|
+
children: /* @__PURE__ */ l("rect", {
|
|
445
|
+
x: "1.3",
|
|
446
|
+
y: "1.3",
|
|
447
|
+
width: "6.4",
|
|
448
|
+
height: "6.4",
|
|
449
|
+
transform: "rotate(45 4.5 4.5)"
|
|
450
|
+
})
|
|
451
|
+
})
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ l("span", {
|
|
454
|
+
className: "tnum tlp-ghost-group-count",
|
|
455
|
+
children: t.length
|
|
456
|
+
}),
|
|
457
|
+
/* @__PURE__ */ l("span", {
|
|
458
|
+
className: "tlp-ghost-group-label",
|
|
459
|
+
children: o
|
|
460
|
+
}),
|
|
461
|
+
/* @__PURE__ */ l("span", {
|
|
462
|
+
className: "tlp-sr",
|
|
463
|
+
role: "status",
|
|
464
|
+
"aria-live": "polite",
|
|
465
|
+
children: n ? `${o} expanded` : `${o} collapsed`
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
}), n && /* @__PURE__ */ l("ul", {
|
|
469
|
+
className: "tlp-ghost-group-list",
|
|
470
|
+
children: t.map((e) => /* @__PURE__ */ u("li", { children: [/* @__PURE__ */ l(He, {
|
|
471
|
+
ghostHash: e.ghostHash,
|
|
472
|
+
subject: e.subject,
|
|
473
|
+
resolution: e.resolution,
|
|
474
|
+
method: e.method,
|
|
475
|
+
confidence: e.confidence
|
|
476
|
+
}), e.subject && /* @__PURE__ */ l("span", {
|
|
477
|
+
className: "tlp-ghost-subject",
|
|
478
|
+
children: e.subject
|
|
479
|
+
})] }, e.ghostHash))
|
|
480
|
+
})]
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/ui/graph/SessionOverflowDisclosure.jsx
|
|
485
|
+
function We({ commitHash: e, overflow: t, expanded: n, onToggle: r, onSelect: i, itemLabel: a = "sessions", className: o = "", ...s }) {
|
|
486
|
+
return t.length === 0 ? null : /* @__PURE__ */ u("span", {
|
|
487
|
+
className: `tlp-overflow${o ? ` ${o}` : ""}`,
|
|
488
|
+
...s,
|
|
489
|
+
children: [
|
|
490
|
+
/* @__PURE__ */ u("button", {
|
|
491
|
+
type: "button",
|
|
492
|
+
className: "tlp-overflow-toggle",
|
|
493
|
+
"aria-expanded": n,
|
|
494
|
+
"aria-label": `${t.length} more ${a}`,
|
|
495
|
+
onClick: () => r(e),
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ u("span", {
|
|
498
|
+
className: "tnum",
|
|
499
|
+
children: ["+", t.length]
|
|
500
|
+
}),
|
|
501
|
+
" more ",
|
|
502
|
+
a
|
|
503
|
+
]
|
|
504
|
+
}),
|
|
505
|
+
/* @__PURE__ */ l("span", {
|
|
506
|
+
className: "tlp-sr",
|
|
507
|
+
role: "status",
|
|
508
|
+
"aria-live": "polite",
|
|
509
|
+
children: n ? `${t.length} more ${a} expanded` : ""
|
|
510
|
+
}),
|
|
511
|
+
n && /* @__PURE__ */ l("span", {
|
|
512
|
+
className: "tlp-overflow-list",
|
|
513
|
+
role: "group",
|
|
514
|
+
"aria-label": `all ${a}`,
|
|
515
|
+
children: t.map((e) => /* @__PURE__ */ u("button", {
|
|
516
|
+
type: "button",
|
|
517
|
+
className: "tlp-overflow-item",
|
|
518
|
+
"data-session-id": e.sessionId,
|
|
519
|
+
onClick: () => i?.(e.sessionId),
|
|
520
|
+
children: [e.harness && /* @__PURE__ */ l(P, {
|
|
521
|
+
harness: e.harness,
|
|
522
|
+
label: !0
|
|
523
|
+
}), e.title || e.sessionId]
|
|
524
|
+
}, e.sessionId))
|
|
525
|
+
})
|
|
526
|
+
]
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/ui/graph/HighlightEdge.jsx
|
|
531
|
+
function B({ weight: e, geometry: t, className: n = "", ...r }) {
|
|
532
|
+
return /* @__PURE__ */ l("line", {
|
|
533
|
+
className: [
|
|
534
|
+
"tlp-highlight-edge",
|
|
535
|
+
`tlp-highlight-edge-${e}`,
|
|
536
|
+
n
|
|
537
|
+
].filter(Boolean).join(" "),
|
|
538
|
+
x1: t.x1,
|
|
539
|
+
y1: t.y1,
|
|
540
|
+
x2: t.x2,
|
|
541
|
+
y2: t.y2,
|
|
542
|
+
"aria-hidden": "true",
|
|
543
|
+
...r
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/ui/graph/TouchedFileCluster.jsx
|
|
548
|
+
var V = 8;
|
|
549
|
+
function H({ commitHash: e, files: t, expanded: n, onToggle: r, onOpenDiff: i, className: a = "", ...o }) {
|
|
550
|
+
let s = t.slice(0, V), c = t.slice(V).map((e) => ({
|
|
551
|
+
sessionId: e,
|
|
552
|
+
title: e
|
|
553
|
+
}));
|
|
554
|
+
return /* @__PURE__ */ u("div", {
|
|
555
|
+
className: `tlp-file-cluster${a ? ` ${a}` : ""}`,
|
|
556
|
+
role: "group",
|
|
557
|
+
"aria-label": "touched files",
|
|
558
|
+
...o,
|
|
559
|
+
children: [s.map((e) => /* @__PURE__ */ l("button", {
|
|
560
|
+
type: "button",
|
|
561
|
+
className: "tlp-file-cluster-item",
|
|
562
|
+
onClick: () => i?.(e),
|
|
563
|
+
children: e
|
|
564
|
+
}, e)), /* @__PURE__ */ l(We, {
|
|
565
|
+
commitHash: e,
|
|
566
|
+
overflow: c,
|
|
567
|
+
expanded: n,
|
|
568
|
+
onToggle: r,
|
|
569
|
+
onSelect: i,
|
|
570
|
+
itemLabel: "files"
|
|
571
|
+
})]
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/ui/CommitGraph.jsx
|
|
576
|
+
var U = 14, Ge = 9, Ke = 7, qe = 9, Je = "3 3", W = (e) => Ge + e * U, Ye = (e) => W(Math.max(e - 1, 0)) + Ke;
|
|
577
|
+
function Xe({ commits: e = [], selectedId: t, onNavigate: n, onSelect: r, onOpenSession: c, hasMore: d = !1, onShowOlder: p, label: m = "commit history", className: h = "", sessionLanes: g, hoveredSessionId: _ = null, selectedSessionId: v = null, onHoverSession: y, onSelectSession: ee, highlightSelected: b, highlightHovered: x, ghostGroupsByCommit: te, expandedGhostGroups: ne, onToggleGhostGroup: re, expandedCommitSessions: ie, onToggleCommitSessions: ae, touchedFilesByCommit: oe, onOpenTouchedFile: se, ...S }) {
|
|
578
|
+
let ce = a(() => new Set(ne ?? []), [ne]), le = a(() => new Set(ie ?? []), [ie]), ue = a(() => /* @__PURE__ */ new Set([...b?.commitHashes ?? [], ...b?.ghostHashes ?? []]), [b]), de = a(() => /* @__PURE__ */ new Set([...x?.commitHashes ?? [], ...x?.ghostHashes ?? []]), [x]), C = a(() => e.reduce((e, t) => Math.max(e, (t.lane ?? 0) + 1), 1), [e]), fe = a(() => {
|
|
579
|
+
let t = new Map(e.map((e) => [e.id, e.lane ?? 0])), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
580
|
+
return e.forEach((e, t) => {
|
|
581
|
+
let i = e.lane ?? 0;
|
|
582
|
+
n.has(i) || n.set(i, t), r.set(i, t);
|
|
583
|
+
}), e.map((e, i) => {
|
|
584
|
+
let a = e.lane ?? 0, o = (e.parents ?? []).map((e) => t.get(e)).filter((e) => e !== void 0 && e !== a).map((e) => ({
|
|
585
|
+
from: a,
|
|
586
|
+
to: e
|
|
587
|
+
})), s = [];
|
|
588
|
+
for (let [e, t] of n) e !== a && i >= t && i <= r.get(e) && s.push(e);
|
|
589
|
+
let c = r.get(a);
|
|
590
|
+
return {
|
|
591
|
+
commit: e,
|
|
592
|
+
lane: a,
|
|
593
|
+
joins: o,
|
|
594
|
+
passLanes: s,
|
|
595
|
+
laneUp: i > n.get(a),
|
|
596
|
+
laneDown: i < c
|
|
597
|
+
};
|
|
598
|
+
});
|
|
599
|
+
}, [e]), w = a(() => {
|
|
600
|
+
let e = new Set(fe.map((e) => e.commit.id)), t = new Set((g ?? []).map((e) => e.sessionId)), n = [...(b?.edges ?? []).map((e) => ({
|
|
601
|
+
...e,
|
|
602
|
+
weight: "primary"
|
|
603
|
+
})), ...(x?.edges ?? []).map((e) => ({
|
|
604
|
+
...e,
|
|
605
|
+
weight: "secondary"
|
|
606
|
+
}))], r = /* @__PURE__ */ new Set();
|
|
607
|
+
return n.flatMap((n) => {
|
|
608
|
+
if (n.ghost) return [];
|
|
609
|
+
let i = `${n.sessionId}:${n.commitHash}`;
|
|
610
|
+
return !e.has(n.commitHash) || !t.has(n.sessionId) || r.has(i) ? [] : (r.add(i), [{
|
|
611
|
+
...n,
|
|
612
|
+
key: i,
|
|
613
|
+
weight: n.weight
|
|
614
|
+
}]);
|
|
615
|
+
});
|
|
616
|
+
}, [
|
|
617
|
+
fe,
|
|
618
|
+
g,
|
|
619
|
+
b,
|
|
620
|
+
x
|
|
621
|
+
]), T = o(null), [E, pe] = s([]);
|
|
622
|
+
i(() => {
|
|
623
|
+
let e = T.current;
|
|
624
|
+
if (!e || w.length === 0) {
|
|
625
|
+
pe([]);
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
let t = () => {
|
|
629
|
+
let t = e.querySelector(".cg-history");
|
|
630
|
+
if (!t) return;
|
|
631
|
+
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]));
|
|
632
|
+
pe(w.flatMap((e) => {
|
|
633
|
+
let t = r.get(e.sessionId)?.getBoundingClientRect(), a = i.get(e.commitHash)?.querySelector(".cg-dot")?.getBoundingClientRect();
|
|
634
|
+
return !t || !a ? [] : [{
|
|
635
|
+
...e,
|
|
636
|
+
geometry: {
|
|
637
|
+
x1: t.left + t.width / 2 - n.left,
|
|
638
|
+
y1: t.bottom - n.top,
|
|
639
|
+
x2: a.left + a.width / 2 - n.left,
|
|
640
|
+
y2: a.top + a.height / 2 - n.top
|
|
641
|
+
}
|
|
642
|
+
}];
|
|
643
|
+
}));
|
|
644
|
+
};
|
|
645
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
646
|
+
let n = new ResizeObserver(t);
|
|
647
|
+
return n.observe(e), () => n.disconnect();
|
|
648
|
+
}, [w]);
|
|
649
|
+
let D = Ye(C), me = ["cg", h].filter(Boolean).join(" ");
|
|
650
|
+
return e.length === 0 ? /* @__PURE__ */ l("div", {
|
|
651
|
+
className: me,
|
|
652
|
+
...S,
|
|
653
|
+
children: /* @__PURE__ */ l("p", {
|
|
654
|
+
className: "cg-empty",
|
|
655
|
+
children: "no commits to show."
|
|
656
|
+
})
|
|
657
|
+
}) : /* @__PURE__ */ u("div", {
|
|
658
|
+
ref: T,
|
|
659
|
+
className: me,
|
|
660
|
+
role: "list",
|
|
661
|
+
"aria-label": m,
|
|
662
|
+
...S,
|
|
663
|
+
children: [
|
|
664
|
+
g && g.length > 0 && /* @__PURE__ */ l("div", {
|
|
665
|
+
className: "cg-session-spine",
|
|
666
|
+
role: "group",
|
|
667
|
+
"aria-label": "recorded sessions",
|
|
668
|
+
style: { gridTemplateColumns: `repeat(${g.length}, minmax(0, 1fr))` },
|
|
669
|
+
children: g.map((e) => /* @__PURE__ */ l(Ue, {
|
|
670
|
+
sessionId: e.sessionId,
|
|
671
|
+
title: e.title,
|
|
672
|
+
harness: e.harness,
|
|
673
|
+
hovered: _ === e.sessionId,
|
|
674
|
+
selected: v === e.sessionId,
|
|
675
|
+
onHover: y,
|
|
676
|
+
onSelect: ee,
|
|
677
|
+
unresolvedGhosts: e.unresolvedGhosts,
|
|
678
|
+
"data-timeline-session-id": e.sessionId
|
|
679
|
+
}, e.sessionId))
|
|
680
|
+
}),
|
|
681
|
+
/* @__PURE__ */ u("div", {
|
|
682
|
+
className: "cg-history",
|
|
683
|
+
children: [E.length > 0 && /* @__PURE__ */ l("svg", {
|
|
684
|
+
className: "cg-highlight-layer",
|
|
685
|
+
"aria-hidden": "true",
|
|
686
|
+
children: E.map((e) => /* @__PURE__ */ l(B, {
|
|
687
|
+
weight: e.weight,
|
|
688
|
+
geometry: e.geometry,
|
|
689
|
+
"data-session-id": e.sessionId,
|
|
690
|
+
"data-commit-hash": e.commitHash
|
|
691
|
+
}, e.key))
|
|
692
|
+
}), fe.map((e) => /* @__PURE__ */ u("div", {
|
|
693
|
+
className: "cg-history-row",
|
|
694
|
+
"data-commit-hash": e.commit.id,
|
|
695
|
+
children: [/* @__PURE__ */ l(Ze, {
|
|
696
|
+
row: e,
|
|
697
|
+
width: D,
|
|
698
|
+
selected: e.commit.id === t,
|
|
699
|
+
onNavigate: n,
|
|
700
|
+
onSelect: r,
|
|
701
|
+
onOpenSession: c,
|
|
702
|
+
highlightWeight: ue.has(e.commit.id) ? "primary" : de.has(e.commit.id) ? "secondary" : null,
|
|
703
|
+
expandedSessions: le.has(e.commit.id),
|
|
704
|
+
onToggleSessions: ae,
|
|
705
|
+
touchedFiles: oe?.[e.commit.id] ?? [],
|
|
706
|
+
expandedFiles: le.has(`files:${e.commit.id}`),
|
|
707
|
+
onOpenTouchedFile: se
|
|
708
|
+
}), te?.[e.commit.id] && /* @__PURE__ */ l("div", {
|
|
709
|
+
className: "cg-ghost-row",
|
|
710
|
+
style: { marginLeft: D },
|
|
711
|
+
children: /* @__PURE__ */ l(z, {
|
|
712
|
+
successorHash: e.commit.id,
|
|
713
|
+
ghosts: te[e.commit.id],
|
|
714
|
+
expanded: ce.has(e.commit.id),
|
|
715
|
+
onToggle: re
|
|
716
|
+
})
|
|
717
|
+
})]
|
|
718
|
+
}, e.commit.id))]
|
|
719
|
+
}),
|
|
720
|
+
d && /* @__PURE__ */ u("div", {
|
|
721
|
+
className: "cg-older-band",
|
|
722
|
+
children: [/* @__PURE__ */ l("span", {
|
|
723
|
+
className: "cg-gutter cg-gutter-older",
|
|
724
|
+
style: { width: D },
|
|
725
|
+
"aria-hidden": "true",
|
|
726
|
+
children: /* @__PURE__ */ l("svg", {
|
|
727
|
+
className: "cg-svg",
|
|
728
|
+
width: D,
|
|
729
|
+
height: "100%",
|
|
730
|
+
preserveAspectRatio: "none",
|
|
731
|
+
children: /* @__PURE__ */ l("line", {
|
|
732
|
+
className: "cg-stroke-lane0",
|
|
733
|
+
x1: W(0),
|
|
734
|
+
y1: "0",
|
|
735
|
+
x2: W(0),
|
|
736
|
+
y2: "60%",
|
|
737
|
+
strokeDasharray: Je
|
|
738
|
+
})
|
|
739
|
+
})
|
|
740
|
+
}), /* @__PURE__ */ u("button", {
|
|
741
|
+
type: "button",
|
|
742
|
+
className: "cg-older",
|
|
743
|
+
onClick: () => {
|
|
744
|
+
n ? n({ type: "show-older" }) : p?.();
|
|
745
|
+
},
|
|
746
|
+
children: [/* @__PURE__ */ l(f, {
|
|
747
|
+
className: "cg-older-ic",
|
|
748
|
+
"aria-hidden": "true"
|
|
749
|
+
}), "show older"]
|
|
750
|
+
})]
|
|
751
|
+
})
|
|
752
|
+
]
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
function Ze({ row: e, width: t, selected: n, onNavigate: r, onSelect: i, onOpenSession: a, highlightWeight: o = null, expandedSessions: s = !1, onToggleSessions: c, touchedFiles: d = [], expandedFiles: f = !1, onOpenTouchedFile: p }) {
|
|
756
|
+
let { commit: m, lane: h, joins: g, passLanes: _, laneUp: v, laneDown: ee } = e, b = !!m.session, x = [
|
|
757
|
+
"cg-dot",
|
|
758
|
+
b ? "cg-dot-filled" : "cg-dot-hollow",
|
|
759
|
+
n && "cg-dot-sel",
|
|
760
|
+
o && `cg-dot-highlight-${o}`
|
|
761
|
+
].filter(Boolean).join(" "), te = m.sessionRefs?.slice(0, 2) ?? [], ne = m.sessionRefs?.slice(2) ?? [], ie = ["cg-row", n && "cg-row-sel"].filter(Boolean).join(" ");
|
|
762
|
+
return /* @__PURE__ */ u("div", {
|
|
763
|
+
className: "cg-band",
|
|
764
|
+
role: "listitem",
|
|
765
|
+
children: [/* @__PURE__ */ u("span", {
|
|
766
|
+
className: "cg-gutter",
|
|
767
|
+
style: { width: t },
|
|
768
|
+
"aria-hidden": "true",
|
|
769
|
+
children: [
|
|
770
|
+
/* @__PURE__ */ u("svg", {
|
|
771
|
+
className: "cg-svg",
|
|
772
|
+
width: t,
|
|
773
|
+
height: "100%",
|
|
774
|
+
preserveAspectRatio: "none",
|
|
775
|
+
children: [
|
|
776
|
+
v && /* @__PURE__ */ l("line", {
|
|
777
|
+
className: "cg-stroke-self",
|
|
778
|
+
x1: W(h),
|
|
779
|
+
y1: "0",
|
|
780
|
+
x2: W(h),
|
|
781
|
+
y2: "50%"
|
|
782
|
+
}),
|
|
783
|
+
ee && /* @__PURE__ */ l("line", {
|
|
784
|
+
className: "cg-stroke-self",
|
|
785
|
+
x1: W(h),
|
|
786
|
+
y1: "50%",
|
|
787
|
+
x2: W(h),
|
|
788
|
+
y2: "100%"
|
|
789
|
+
}),
|
|
790
|
+
_.map((e) => /* @__PURE__ */ l("line", {
|
|
791
|
+
className: e === 0 ? "cg-stroke-lane0" : "cg-stroke-branch",
|
|
792
|
+
x1: W(e),
|
|
793
|
+
y1: "0",
|
|
794
|
+
x2: W(e),
|
|
795
|
+
y2: "100%"
|
|
796
|
+
}, e)),
|
|
797
|
+
g.map((e, t) => /* @__PURE__ */ u("g", {
|
|
798
|
+
className: "cg-elbow",
|
|
799
|
+
children: [/* @__PURE__ */ l("line", {
|
|
800
|
+
className: "cg-stroke-branch",
|
|
801
|
+
x1: W(e.to),
|
|
802
|
+
y1: "50%",
|
|
803
|
+
x2: W(e.to),
|
|
804
|
+
y2: "100%"
|
|
805
|
+
}), /* @__PURE__ */ l("line", {
|
|
806
|
+
className: "cg-stroke-branch",
|
|
807
|
+
x1: W(e.to),
|
|
808
|
+
y1: "50%",
|
|
809
|
+
x2: W(e.from),
|
|
810
|
+
y2: "50%"
|
|
811
|
+
})]
|
|
812
|
+
}, t))
|
|
813
|
+
]
|
|
814
|
+
}),
|
|
815
|
+
/* @__PURE__ */ l("span", {
|
|
816
|
+
className: x,
|
|
817
|
+
style: {
|
|
818
|
+
left: W(h),
|
|
819
|
+
width: qe,
|
|
820
|
+
height: qe
|
|
821
|
+
},
|
|
822
|
+
"data-has-session": b || void 0
|
|
823
|
+
}),
|
|
824
|
+
b && /* @__PURE__ */ l(re, {
|
|
825
|
+
className: "cg-spark",
|
|
826
|
+
style: { left: W(h) },
|
|
827
|
+
"aria-hidden": "true"
|
|
828
|
+
})
|
|
829
|
+
]
|
|
830
|
+
}), /* @__PURE__ */ u("div", {
|
|
831
|
+
className: "cg-content",
|
|
832
|
+
children: [
|
|
833
|
+
/* @__PURE__ */ u("button", {
|
|
834
|
+
type: "button",
|
|
835
|
+
className: ie,
|
|
836
|
+
onClick: () => {
|
|
837
|
+
r ? r({
|
|
838
|
+
type: "open-change",
|
|
839
|
+
change: {
|
|
840
|
+
id: m.id,
|
|
841
|
+
branch: m.branch ?? null
|
|
842
|
+
}
|
|
843
|
+
}) : i?.(m);
|
|
844
|
+
},
|
|
845
|
+
children: [/* @__PURE__ */ l("span", {
|
|
846
|
+
className: "cg-msg",
|
|
847
|
+
title: m.message,
|
|
848
|
+
children: m.message
|
|
849
|
+
}), /* @__PURE__ */ u("span", {
|
|
850
|
+
className: "cg-meta",
|
|
851
|
+
children: [
|
|
852
|
+
m.merged && /* @__PURE__ */ u("span", {
|
|
853
|
+
className: "cg-merged",
|
|
854
|
+
children: [/* @__PURE__ */ l(y, {
|
|
855
|
+
className: "cg-merged-ic",
|
|
856
|
+
"aria-hidden": "true"
|
|
857
|
+
}), "merged"]
|
|
858
|
+
}),
|
|
859
|
+
m.tip && /* @__PURE__ */ l("span", {
|
|
860
|
+
className: "cg-tip",
|
|
861
|
+
children: "tip"
|
|
862
|
+
}),
|
|
863
|
+
m.branch && /* @__PURE__ */ l("span", {
|
|
864
|
+
className: "cg-branch",
|
|
865
|
+
children: m.branch
|
|
866
|
+
}),
|
|
867
|
+
b && /* @__PURE__ */ l("span", {
|
|
868
|
+
className: "cg-sr",
|
|
869
|
+
children: "session"
|
|
870
|
+
}),
|
|
871
|
+
m.time && /* @__PURE__ */ l("span", {
|
|
872
|
+
className: "cg-time tnum",
|
|
873
|
+
children: m.time
|
|
874
|
+
})
|
|
875
|
+
]
|
|
876
|
+
})]
|
|
877
|
+
}),
|
|
878
|
+
m.sessionRefs?.length > 0 && /* @__PURE__ */ u("div", {
|
|
879
|
+
className: "cg-sessions",
|
|
880
|
+
role: "group",
|
|
881
|
+
"aria-label": `sessions linked to ${m.message}`,
|
|
882
|
+
children: [te.map((e) => /* @__PURE__ */ u("button", {
|
|
883
|
+
type: "button",
|
|
884
|
+
className: "cg-session",
|
|
885
|
+
onClick: () => {
|
|
886
|
+
r ? r({
|
|
887
|
+
type: "open-session",
|
|
888
|
+
sessionId: e.sessionId,
|
|
889
|
+
source: {
|
|
890
|
+
kind: "commit",
|
|
891
|
+
commit: {
|
|
892
|
+
id: m.id,
|
|
893
|
+
branch: m.branch ?? null
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}) : a?.(e.sessionId);
|
|
897
|
+
},
|
|
898
|
+
children: [
|
|
899
|
+
/* @__PURE__ */ l(I, { harness: e.harness }),
|
|
900
|
+
/* @__PURE__ */ l("span", {
|
|
901
|
+
className: "cg-session-title",
|
|
902
|
+
children: e.title || e.sessionId
|
|
903
|
+
}),
|
|
904
|
+
e.startMs != null && /* @__PURE__ */ l("time", {
|
|
905
|
+
className: "cg-session-time tnum",
|
|
906
|
+
dateTime: new Date(e.startMs).toISOString(),
|
|
907
|
+
children: new Date(e.startMs).toLocaleDateString(void 0, {
|
|
908
|
+
month: "short",
|
|
909
|
+
day: "numeric"
|
|
910
|
+
}).toLowerCase()
|
|
911
|
+
})
|
|
912
|
+
]
|
|
913
|
+
}, e.sessionId)), ne.length > 0 && /* @__PURE__ */ l(We, {
|
|
914
|
+
commitHash: m.id,
|
|
915
|
+
overflow: ne,
|
|
916
|
+
expanded: s,
|
|
917
|
+
onToggle: c ?? (() => {}),
|
|
918
|
+
onSelect: (e) => {
|
|
919
|
+
r ? r({
|
|
920
|
+
type: "open-session",
|
|
921
|
+
sessionId: e,
|
|
922
|
+
source: {
|
|
923
|
+
kind: "commit",
|
|
924
|
+
commit: {
|
|
925
|
+
id: m.id,
|
|
926
|
+
branch: m.branch ?? null
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}) : a?.(e);
|
|
930
|
+
}
|
|
931
|
+
})]
|
|
932
|
+
}),
|
|
933
|
+
d.length > 0 && /* @__PURE__ */ l("div", {
|
|
934
|
+
className: "cg-touched-files",
|
|
935
|
+
children: /* @__PURE__ */ l(H, {
|
|
936
|
+
commitHash: `files:${m.id}`,
|
|
937
|
+
files: d,
|
|
938
|
+
expanded: f,
|
|
939
|
+
onToggle: c ?? (() => {}),
|
|
940
|
+
onOpenDiff: p
|
|
941
|
+
})
|
|
942
|
+
})
|
|
943
|
+
]
|
|
944
|
+
})]
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
//#endregion
|
|
948
|
+
//#region src/ui/DiffView.jsx
|
|
949
|
+
function G(e) {
|
|
950
|
+
let t = 0, n = 0;
|
|
951
|
+
for (let r of e) for (let e of r.lines) e.type === "add" ? t++ : e.type === "del" && n++;
|
|
952
|
+
return {
|
|
953
|
+
adds: t,
|
|
954
|
+
dels: n
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
function Qe({ line: e }) {
|
|
958
|
+
let { type: t, oldNo: n, newNo: r, text: i } = e, a = t === "add" ? x : t === "del" ? b : null;
|
|
959
|
+
return /* @__PURE__ */ u("div", {
|
|
960
|
+
className: `dv-line dv-${t}`,
|
|
961
|
+
role: "row",
|
|
962
|
+
children: [
|
|
963
|
+
/* @__PURE__ */ l("span", {
|
|
964
|
+
className: "dv-rail",
|
|
965
|
+
"aria-hidden": "true"
|
|
966
|
+
}),
|
|
967
|
+
/* @__PURE__ */ l("span", {
|
|
968
|
+
className: "dv-num dv-num-old tnum",
|
|
969
|
+
role: "cell",
|
|
970
|
+
children: n ?? ""
|
|
971
|
+
}),
|
|
972
|
+
/* @__PURE__ */ l("span", {
|
|
973
|
+
className: "dv-num dv-num-new tnum",
|
|
974
|
+
role: "cell",
|
|
975
|
+
children: r ?? ""
|
|
976
|
+
}),
|
|
977
|
+
/* @__PURE__ */ l("span", {
|
|
978
|
+
className: "dv-sign",
|
|
979
|
+
role: "cell",
|
|
980
|
+
"aria-hidden": "true",
|
|
981
|
+
children: a ? /* @__PURE__ */ l(a, { "aria-hidden": "true" }) : null
|
|
982
|
+
}),
|
|
983
|
+
/* @__PURE__ */ u("span", {
|
|
984
|
+
className: "dv-text",
|
|
985
|
+
role: "cell",
|
|
986
|
+
children: [/* @__PURE__ */ l("span", {
|
|
987
|
+
className: "dv-sr",
|
|
988
|
+
children: t === "add" ? "added: " : t === "del" ? "removed: " : ""
|
|
989
|
+
}), i || "\xA0"]
|
|
990
|
+
})
|
|
991
|
+
]
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
function $e({ match: e }) {
|
|
995
|
+
let { category: t, confidence: n, original: r, replacement: i, oldNo: a, newNo: o } = e, [c, d] = s(!1), f = n < .7, p = n.toFixed(2);
|
|
996
|
+
return /* @__PURE__ */ u("div", {
|
|
997
|
+
className: `dv-match${c ? " dv-match-kept" : ""}`,
|
|
998
|
+
children: [/* @__PURE__ */ u("div", {
|
|
999
|
+
className: "dv-match-head",
|
|
1000
|
+
children: [
|
|
1001
|
+
/* @__PURE__ */ u("span", {
|
|
1002
|
+
className: `dv-badge${f ? " dv-badge-low" : ""}`,
|
|
1003
|
+
children: [
|
|
1004
|
+
/* @__PURE__ */ l("span", {
|
|
1005
|
+
className: "dv-badge-cat",
|
|
1006
|
+
children: t
|
|
1007
|
+
}),
|
|
1008
|
+
/* @__PURE__ */ l("span", {
|
|
1009
|
+
className: "dv-badge-dot",
|
|
1010
|
+
"aria-hidden": "true",
|
|
1011
|
+
children: "·"
|
|
1012
|
+
}),
|
|
1013
|
+
/* @__PURE__ */ l("span", {
|
|
1014
|
+
className: "dv-badge-conf tnum",
|
|
1015
|
+
children: p
|
|
1016
|
+
})
|
|
1017
|
+
]
|
|
1018
|
+
}),
|
|
1019
|
+
c && /* @__PURE__ */ u("span", {
|
|
1020
|
+
className: "dv-kept-flag",
|
|
1021
|
+
children: [/* @__PURE__ */ l(g, { "aria-hidden": "true" }), "un-redacted"]
|
|
1022
|
+
}),
|
|
1023
|
+
/* @__PURE__ */ u("button", {
|
|
1024
|
+
type: "button",
|
|
1025
|
+
className: "dv-keep",
|
|
1026
|
+
"aria-pressed": c,
|
|
1027
|
+
onClick: () => d((e) => !e),
|
|
1028
|
+
children: [l(c ? h : g, { "aria-hidden": "true" }), c ? "revert" : "keep"]
|
|
1029
|
+
})
|
|
1030
|
+
]
|
|
1031
|
+
}), /* @__PURE__ */ u("div", {
|
|
1032
|
+
className: "dv-match-pair",
|
|
1033
|
+
role: "rowgroup",
|
|
1034
|
+
children: [/* @__PURE__ */ u("div", {
|
|
1035
|
+
className: `dv-line dv-del${c ? " dv-line-muted" : ""}`,
|
|
1036
|
+
role: "row",
|
|
1037
|
+
children: [
|
|
1038
|
+
/* @__PURE__ */ l("span", {
|
|
1039
|
+
className: "dv-rail",
|
|
1040
|
+
"aria-hidden": "true"
|
|
1041
|
+
}),
|
|
1042
|
+
/* @__PURE__ */ l("span", {
|
|
1043
|
+
className: "dv-num dv-num-old tnum",
|
|
1044
|
+
role: "cell",
|
|
1045
|
+
children: a ?? ""
|
|
1046
|
+
}),
|
|
1047
|
+
/* @__PURE__ */ l("span", {
|
|
1048
|
+
className: "dv-num dv-num-new tnum",
|
|
1049
|
+
role: "cell"
|
|
1050
|
+
}),
|
|
1051
|
+
/* @__PURE__ */ l("span", {
|
|
1052
|
+
className: "dv-sign",
|
|
1053
|
+
role: "cell",
|
|
1054
|
+
"aria-hidden": "true",
|
|
1055
|
+
children: /* @__PURE__ */ l(b, { "aria-hidden": "true" })
|
|
1056
|
+
}),
|
|
1057
|
+
/* @__PURE__ */ u("span", {
|
|
1058
|
+
className: "dv-text",
|
|
1059
|
+
role: "cell",
|
|
1060
|
+
children: [/* @__PURE__ */ l("span", {
|
|
1061
|
+
className: "dv-sr",
|
|
1062
|
+
children: "original: "
|
|
1063
|
+
}), /* @__PURE__ */ l("span", {
|
|
1064
|
+
className: "dv-strike",
|
|
1065
|
+
children: r
|
|
1066
|
+
})]
|
|
1067
|
+
})
|
|
1068
|
+
]
|
|
1069
|
+
}), /* @__PURE__ */ u("div", {
|
|
1070
|
+
className: `dv-line dv-add${c ? " dv-line-muted" : ""}`,
|
|
1071
|
+
role: "row",
|
|
1072
|
+
children: [
|
|
1073
|
+
/* @__PURE__ */ l("span", {
|
|
1074
|
+
className: "dv-rail",
|
|
1075
|
+
"aria-hidden": "true"
|
|
1076
|
+
}),
|
|
1077
|
+
/* @__PURE__ */ l("span", {
|
|
1078
|
+
className: "dv-num dv-num-old tnum",
|
|
1079
|
+
role: "cell"
|
|
1080
|
+
}),
|
|
1081
|
+
/* @__PURE__ */ l("span", {
|
|
1082
|
+
className: "dv-num dv-num-new tnum",
|
|
1083
|
+
role: "cell",
|
|
1084
|
+
children: o ?? ""
|
|
1085
|
+
}),
|
|
1086
|
+
/* @__PURE__ */ l("span", {
|
|
1087
|
+
className: "dv-sign",
|
|
1088
|
+
role: "cell",
|
|
1089
|
+
"aria-hidden": "true",
|
|
1090
|
+
children: /* @__PURE__ */ l(x, { "aria-hidden": "true" })
|
|
1091
|
+
}),
|
|
1092
|
+
/* @__PURE__ */ u("span", {
|
|
1093
|
+
className: "dv-text",
|
|
1094
|
+
role: "cell",
|
|
1095
|
+
children: [/* @__PURE__ */ l("span", {
|
|
1096
|
+
className: "dv-sr",
|
|
1097
|
+
children: "redacted to: "
|
|
1098
|
+
}), i]
|
|
1099
|
+
})
|
|
1100
|
+
]
|
|
1101
|
+
})]
|
|
1102
|
+
})]
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
function et({ file: e, hunks: t = [], matches: n = [], variant: r = "default", className: i = "", ...a }) {
|
|
1106
|
+
let o = r === "redaction", s = o ? null : G(t);
|
|
1107
|
+
return /* @__PURE__ */ u("figure", {
|
|
1108
|
+
className: [
|
|
1109
|
+
"dv",
|
|
1110
|
+
o && "dv-redaction",
|
|
1111
|
+
i
|
|
1112
|
+
].filter(Boolean).join(" "),
|
|
1113
|
+
...a,
|
|
1114
|
+
children: [/* @__PURE__ */ u("figcaption", {
|
|
1115
|
+
className: "dv-head",
|
|
1116
|
+
children: [/* @__PURE__ */ l("span", {
|
|
1117
|
+
className: "dv-file",
|
|
1118
|
+
children: e
|
|
1119
|
+
}), o ? /* @__PURE__ */ u("span", {
|
|
1120
|
+
className: "dv-churn",
|
|
1121
|
+
children: [/* @__PURE__ */ l("span", {
|
|
1122
|
+
className: "dv-churn-r tnum",
|
|
1123
|
+
children: n.length
|
|
1124
|
+
}), /* @__PURE__ */ l("span", {
|
|
1125
|
+
className: "dv-churn-label",
|
|
1126
|
+
children: "redacted"
|
|
1127
|
+
})]
|
|
1128
|
+
}) : /* @__PURE__ */ u("span", {
|
|
1129
|
+
className: "dv-churn",
|
|
1130
|
+
children: [/* @__PURE__ */ u("span", {
|
|
1131
|
+
className: "dv-churn-add tnum",
|
|
1132
|
+
children: ["+", s.adds]
|
|
1133
|
+
}), /* @__PURE__ */ u("span", {
|
|
1134
|
+
className: "dv-churn-del tnum",
|
|
1135
|
+
children: ["−", s.dels]
|
|
1136
|
+
})]
|
|
1137
|
+
})]
|
|
1138
|
+
}), o ? /* @__PURE__ */ l("div", {
|
|
1139
|
+
className: "dv-body dv-matches",
|
|
1140
|
+
role: "table",
|
|
1141
|
+
"aria-label": `redactions in ${e}`,
|
|
1142
|
+
children: n.length === 0 ? /* @__PURE__ */ l("p", {
|
|
1143
|
+
className: "dv-empty",
|
|
1144
|
+
children: "no sensitive content detected. safe to share as-is."
|
|
1145
|
+
}) : n.map((e, t) => /* @__PURE__ */ l($e, { match: e }, e.id ?? t))
|
|
1146
|
+
}) : /* @__PURE__ */ l("div", {
|
|
1147
|
+
className: "dv-body",
|
|
1148
|
+
role: "table",
|
|
1149
|
+
"aria-label": `diff of ${e}`,
|
|
1150
|
+
children: t.length === 0 ? /* @__PURE__ */ l("p", {
|
|
1151
|
+
className: "dv-empty",
|
|
1152
|
+
children: "no line changes."
|
|
1153
|
+
}) : t.map((e, t) => /* @__PURE__ */ u("div", {
|
|
1154
|
+
className: "dv-hunk",
|
|
1155
|
+
children: [/* @__PURE__ */ u("div", {
|
|
1156
|
+
className: "dv-hunk-head",
|
|
1157
|
+
children: [
|
|
1158
|
+
/* @__PURE__ */ l("span", {
|
|
1159
|
+
className: "dv-hunk-at",
|
|
1160
|
+
"aria-hidden": "true",
|
|
1161
|
+
children: "@@"
|
|
1162
|
+
}),
|
|
1163
|
+
/* @__PURE__ */ l("span", {
|
|
1164
|
+
className: "dv-hunk-range tnum",
|
|
1165
|
+
children: e.header
|
|
1166
|
+
}),
|
|
1167
|
+
/* @__PURE__ */ l("span", {
|
|
1168
|
+
className: "dv-hunk-at",
|
|
1169
|
+
"aria-hidden": "true",
|
|
1170
|
+
children: "@@"
|
|
1171
|
+
})
|
|
1172
|
+
]
|
|
1173
|
+
}), /* @__PURE__ */ l("div", {
|
|
1174
|
+
className: "dv-hunk-pair",
|
|
1175
|
+
role: "rowgroup",
|
|
1176
|
+
children: e.lines.map((e, t) => /* @__PURE__ */ l(Qe, { line: e }, t))
|
|
1177
|
+
})]
|
|
1178
|
+
}, t))
|
|
1179
|
+
})]
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
//#endregion
|
|
1183
|
+
//#region src/ui/graph/types.js
|
|
1184
|
+
var tt = C, nt = se, rt = ce, it = le, at = S;
|
|
1185
|
+
function K(e, t, n, r, i) {
|
|
1186
|
+
if (e(t)) return;
|
|
1187
|
+
let a;
|
|
1188
|
+
try {
|
|
1189
|
+
a = JSON.stringify(t);
|
|
1190
|
+
} catch {
|
|
1191
|
+
a = String(t);
|
|
1192
|
+
}
|
|
1193
|
+
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.`);
|
|
1194
|
+
}
|
|
1195
|
+
function ot(e) {
|
|
1196
|
+
for (let [t, n] of e.nodes.entries()) K(ve, n.kind, `nodes[${t}].kind`, "code-map payload rendering", C);
|
|
1197
|
+
for (let [t, n] of e.violations.entries()) K(D, n.kind, `violations[${t}].kind`, "code-map payload rendering", ce);
|
|
1198
|
+
}
|
|
1199
|
+
function st(e) {
|
|
1200
|
+
for (let [t, n] of e.files.entries()) K(me, n.status, `files[${t}].status`, "change-detail payload rendering", le);
|
|
1201
|
+
for (let [t, n] of e.work.entries()) K(E, n.binding, `work[${t}].binding`, "change-detail payload rendering", se);
|
|
1202
|
+
for (let [t, n] of e.slice.nodes.entries()) K(ve, n.kind, `slice.nodes[${t}].kind`, "change-detail payload rendering", C);
|
|
1203
|
+
for (let [t, n] of e.violations.entries()) K(D, n.kind, `violations[${t}].kind`, "change-detail payload rendering", ce);
|
|
1204
|
+
}
|
|
1205
|
+
function ct(e) {
|
|
1206
|
+
K(me, e.status, "status", "change-diff payload rendering", le);
|
|
1207
|
+
for (let [t, n] of e.hunks.entries()) for (let [e, r] of n.lines.entries()) K(pe, r.kind, `hunks[${t}].lines[${e}].kind`, "change-diff payload rendering", S);
|
|
1208
|
+
}
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/ui/graph/graphContractPolicy.js
|
|
1211
|
+
var q = Object.freeze({
|
|
1212
|
+
decision: "decisions",
|
|
1213
|
+
friction: "friction",
|
|
1214
|
+
unusual: "unusual signals",
|
|
1215
|
+
retry_loop: "retry loops"
|
|
1216
|
+
}), lt = Object.freeze({
|
|
1217
|
+
mechanical: Object.freeze({ markerClass: "tlp-insight-provenance-mechanical" }),
|
|
1218
|
+
mined: Object.freeze({ markerClass: "tlp-insight-provenance-mined" })
|
|
1219
|
+
});
|
|
1220
|
+
ft(), pt();
|
|
1221
|
+
function ut(e) {
|
|
1222
|
+
let t = e.findIndex((e) => !ge(e.kind) || !_e(e.provenance));
|
|
1223
|
+
if (t !== -1) throw mt("validate insight values", `insights[${t}]`, `the insight kind or provenance is outside the canonical @peasant-labs/schema value domain (kinds: ${ue.join(", ")}; provenances: ${de.join(", ")})`, "validate and normalize the local API response to the published @peasant-labs/schema contract before rendering");
|
|
1224
|
+
}
|
|
1225
|
+
function dt(e) {
|
|
1226
|
+
let t = e.findIndex((e) => !ye(e.readAttribution) || !be(e.readState));
|
|
1227
|
+
if (t !== -1) throw mt("validate ranking values", `nodes[${t}]`, `the read-attribution state or read-state grade is outside the canonical @peasant-labs/schema value domain (attribution states: ${fe.join(", ")}; read-state grades: ${w.join(", ")})`, "validate and normalize the local API response to the published @peasant-labs/schema contract before ranking");
|
|
1228
|
+
}
|
|
1229
|
+
function ft() {
|
|
1230
|
+
let e = Object.keys(q), t = ue.filter((e) => typeof q[e] != "string" || q[e].trim() === ""), n = e.filter((e) => !ge(e));
|
|
1231
|
+
if (!(t.length === 0 && n.length === 0 && e.length === ue.length)) throw mt("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");
|
|
1232
|
+
}
|
|
1233
|
+
function pt() {
|
|
1234
|
+
let e = Object.keys(lt), t = de.filter((e) => {
|
|
1235
|
+
let t = lt[e];
|
|
1236
|
+
return !t || typeof t.markerClass != "string" || t.markerClass.trim() === "";
|
|
1237
|
+
}), n = e.filter((e) => !_e(e));
|
|
1238
|
+
if (!(t.length === 0 && n.length === 0 && e.length === de.length)) throw mt("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");
|
|
1239
|
+
}
|
|
1240
|
+
function mt(e, t, n, r) {
|
|
1241
|
+
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}.`);
|
|
1242
|
+
}
|
|
1243
|
+
//#endregion
|
|
1244
|
+
//#region src/ui/graph/ranking.js
|
|
1245
|
+
var ht = Object.freeze({
|
|
1246
|
+
touch: .35,
|
|
1247
|
+
effortDensity: .25,
|
|
1248
|
+
debt: .25,
|
|
1249
|
+
recency: .15
|
|
1250
|
+
}), gt = .5, _t = .9, vt = 14, yt = 5, bt = 25, xt = Object.freeze([
|
|
1251
|
+
"agent wrote: no recorded read",
|
|
1252
|
+
"agent wrote: viewed, not reviewed",
|
|
1253
|
+
"agent wrote: read state unknown",
|
|
1254
|
+
"heavy churn",
|
|
1255
|
+
"edited this session",
|
|
1256
|
+
"high effort density",
|
|
1257
|
+
"near your focus"
|
|
1258
|
+
]), St = .75, Ct = .75, wt = 1, Tt = /* @__PURE__ */ new Set([
|
|
1259
|
+
"relevance",
|
|
1260
|
+
"debt",
|
|
1261
|
+
"churn"
|
|
1262
|
+
]), Et = "Use this as a prompt to inspect recorded evidence, not as a verdict about the reader.";
|
|
1263
|
+
function Dt(e) {
|
|
1264
|
+
if (e.agentEditedCount === 0) return "none";
|
|
1265
|
+
if (e.readAttribution === "unavailable") return "unknown";
|
|
1266
|
+
let t = e.changedRegionCount > e.attributedRegionCount, n = e.attributedRegionCount > 0 ? e.reviewedRegionCount / e.attributedRegionCount : 0, r = e.attributedRegionCount > 0 && n === 1 && !t;
|
|
1267
|
+
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";
|
|
1268
|
+
}
|
|
1269
|
+
function Ot(e, t) {
|
|
1270
|
+
if (t === "no-recorded-read") return 1;
|
|
1271
|
+
if (t === "partial-read") {
|
|
1272
|
+
if (e.attributedRegionCount > 0) {
|
|
1273
|
+
let t = kt(e), n = e.agentEditedCount > 0 ? e.readCount / e.agentEditedCount : 0;
|
|
1274
|
+
return Rt(1 - Math.max(t, n));
|
|
1275
|
+
}
|
|
1276
|
+
return Rt(1 - (e.agentEditedCount > 0 ? e.readCount / e.agentEditedCount : 0));
|
|
1277
|
+
}
|
|
1278
|
+
return t === "viewed" ? gt : 0;
|
|
1279
|
+
}
|
|
1280
|
+
function kt(e) {
|
|
1281
|
+
let t = e.changedRegionCount > e.attributedRegionCount, n = e.attributedRegionCount > 0 ? e.reviewedRegionCount / e.attributedRegionCount : 0;
|
|
1282
|
+
return Rt(t ? Math.min(n, _t) : n);
|
|
1283
|
+
}
|
|
1284
|
+
function At(e) {
|
|
1285
|
+
let t = e.changedRegionCount > e.attributedRegionCount, n = e.attributedRegionCount > 0 ? e.reviewedRegionCount / e.attributedRegionCount : 0;
|
|
1286
|
+
return e.attributedRegionCount > 0 && n === 1 && !t;
|
|
1287
|
+
}
|
|
1288
|
+
function jt(e) {
|
|
1289
|
+
if (Dt(e) !== "partial-read") return null;
|
|
1290
|
+
let t = e.attributedRegionCount;
|
|
1291
|
+
if (t > 0 && e.reviewedRegionCount > 0) {
|
|
1292
|
+
let n = e.reviewedRegionCount, r = t;
|
|
1293
|
+
return e.changedRegionCount > t ? `${n} of ${r} attributed regions reviewed; ${e.changedRegionCount - t} regions could not be attributed` : `${n} of ${r} changed regions reviewed`;
|
|
1294
|
+
}
|
|
1295
|
+
return "some sessions that edited this file were read; per-region coverage is not available";
|
|
1296
|
+
}
|
|
1297
|
+
function Mt(e, t) {
|
|
1298
|
+
if (t === "no-recorded-read") return `No read evidence was recorded for sessions that edited this file. ${Et}`;
|
|
1299
|
+
if (t === "viewed") return `A view was recorded, but no explicit review was recorded. ${Et}`;
|
|
1300
|
+
if (t === "unknown") return `No read events were recorded for the sessions that edited this file, so its read state is unknown. ${Et}`;
|
|
1301
|
+
if (t === "partial-read") {
|
|
1302
|
+
let t = jt(e);
|
|
1303
|
+
return t ? `${t}. ${Et}` : Et;
|
|
1304
|
+
}
|
|
1305
|
+
return null;
|
|
1306
|
+
}
|
|
1307
|
+
function Nt(e, t, n = {}) {
|
|
1308
|
+
let r = [];
|
|
1309
|
+
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 >= St && r.length < 2 && r.push("heavy churn"), e.effortDensity >= Ct && r.length < 2 && r.push("high effort density"), n.focusId && n.parentOf) {
|
|
1310
|
+
let t = n.distanceToFocus === void 0 ? Pt(e.id, n.focusId, n.parentOf) : n.distanceToFocus;
|
|
1311
|
+
t !== null && t <= wt && r.length < 2 && r.push("near your focus");
|
|
1312
|
+
}
|
|
1313
|
+
return r.slice(0, 2);
|
|
1314
|
+
}
|
|
1315
|
+
function Pt(e, t, n) {
|
|
1316
|
+
if (e === t) return 0;
|
|
1317
|
+
let r = Ft(e, n), i = Ft(t, n), a = new Map(r.map((e, t) => [e, t]));
|
|
1318
|
+
for (let [e, t] of i.entries()) if (a.has(t)) return (a.get(t) ?? 0) + e;
|
|
1319
|
+
return null;
|
|
1320
|
+
}
|
|
1321
|
+
function Ft(e, t) {
|
|
1322
|
+
let n = [e], r = t.get(e) ?? null, i = 0;
|
|
1323
|
+
for (; r && i < 1e4;) n.push(r), r = t.get(r) ?? null, i += 1;
|
|
1324
|
+
return n;
|
|
1325
|
+
}
|
|
1326
|
+
function It(e) {
|
|
1327
|
+
let t = Math.min(...e), n = Math.max(...e);
|
|
1328
|
+
return !Number.isFinite(t) || !Number.isFinite(n) || n === t ? e.map(() => 0) : e.map((e) => (e - t) / (n - t));
|
|
1329
|
+
}
|
|
1330
|
+
function Lt(e, t) {
|
|
1331
|
+
return e.lastTouchMs == null || !Number.isFinite(t) ? 0 : Rt(.5 ** (Math.max(0, t - e.lastTouchMs) / (336 * 60 * 60 * 1e3)));
|
|
1332
|
+
}
|
|
1333
|
+
function Rt(e) {
|
|
1334
|
+
return Math.round(Math.max(0, Math.min(1, e)) * 1e9) / 1e9;
|
|
1335
|
+
}
|
|
1336
|
+
function zt(e) {
|
|
1337
|
+
if (e === "relevance") return ht;
|
|
1338
|
+
let t = e === "debt" ? "debt" : "touch", n = Object.keys(ht).filter((e) => e !== t), r = n.reduce((e, t) => e + ht[t], 0), i = r > 0 ? .3 / r : 0, a = { [t]: .7 };
|
|
1339
|
+
for (let e of n) a[e] = ht[e] * i;
|
|
1340
|
+
return a;
|
|
1341
|
+
}
|
|
1342
|
+
function Bt(e) {
|
|
1343
|
+
return e === "no-recorded-read" || e === "partial-read" || e === "viewed" ? 0 : e === "unknown" ? 1 : 2;
|
|
1344
|
+
}
|
|
1345
|
+
function Vt(e, t = {}) {
|
|
1346
|
+
let n = t.rankMode ?? "relevance";
|
|
1347
|
+
if (!Tt.has(n)) throw Kt("compute intrinsic ranking", "rankMode", `value ${JSON.stringify(n)} is unsupported`, "use relevance, debt, or churn");
|
|
1348
|
+
dt(e);
|
|
1349
|
+
let r = t.nowMs ?? Date.now(), i = zt(n), a = new Map(e.map((e) => [e.id, e.parent ?? null])), o = e.reduce((e, t) => Math.max(e, t.touchCount), 0), s = It(e.map((e) => Math.log1p(Math.max(0, e.touchCount))));
|
|
1350
|
+
return {
|
|
1351
|
+
rankMode: n,
|
|
1352
|
+
rows: e.map((e, t) => {
|
|
1353
|
+
let n = Dt(e), a = Ot(e, n);
|
|
1354
|
+
return {
|
|
1355
|
+
node: e,
|
|
1356
|
+
intrinsic: i.touch * s[t] + i.effortDensity * Rt(e.effortDensity) + i.debt * a + i.recency * Lt(e, r),
|
|
1357
|
+
debtState: n,
|
|
1358
|
+
debt: a,
|
|
1359
|
+
coverage: kt(e),
|
|
1360
|
+
hunkClears: At(e),
|
|
1361
|
+
hoverText: Mt(e, n)
|
|
1362
|
+
};
|
|
1363
|
+
}),
|
|
1364
|
+
parentOf: a,
|
|
1365
|
+
maxTouch: o
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
function Ht(e, t = {}) {
|
|
1369
|
+
if (t.scentFilter != null && !xt.includes(t.scentFilter)) throw Kt("derive ranked rows", "scentFilter", `value ${JSON.stringify(t.scentFilter)} is unsupported`, `use null or one of ${xt.join(", ")}`);
|
|
1370
|
+
let { rankMode: n, parentOf: r, maxTouch: i } = e, a = t.focusId ? Ut(t.focusId, r) : null, o = e.rows.map((e) => {
|
|
1371
|
+
let { node: n } = e, o = 0;
|
|
1372
|
+
if (t.focusId) {
|
|
1373
|
+
let e = a?.get(n.id) ?? null;
|
|
1374
|
+
o = e === null ? 0 : Math.min(1, e / 4) * .5;
|
|
1375
|
+
}
|
|
1376
|
+
return {
|
|
1377
|
+
id: n.id,
|
|
1378
|
+
name: n.name,
|
|
1379
|
+
doi: Rt(e.intrinsic - o),
|
|
1380
|
+
debtState: e.debtState,
|
|
1381
|
+
debt: e.debt,
|
|
1382
|
+
coverage: e.coverage,
|
|
1383
|
+
hunkClears: e.hunkClears,
|
|
1384
|
+
scentTags: Nt(n, e.debtState, {
|
|
1385
|
+
focusId: t.focusId,
|
|
1386
|
+
parentOf: r,
|
|
1387
|
+
distanceToFocus: a?.get(n.id) ?? null,
|
|
1388
|
+
maxTouch: i,
|
|
1389
|
+
hoveredOrSelectedSessionId: t.hoveredOrSelectedSessionId
|
|
1390
|
+
}),
|
|
1391
|
+
hoverText: e.hoverText
|
|
1392
|
+
};
|
|
1393
|
+
});
|
|
1394
|
+
o.sort((e, t) => {
|
|
1395
|
+
if (n === "debt") {
|
|
1396
|
+
let n = Bt(e.debtState) - Bt(t.debtState);
|
|
1397
|
+
if (n !== 0) return n;
|
|
1398
|
+
}
|
|
1399
|
+
return t.doi - e.doi || (e.id < t.id ? -1 : +(e.id > t.id));
|
|
1400
|
+
});
|
|
1401
|
+
let s = t.scentFilter;
|
|
1402
|
+
return s ? o.filter((e) => e.scentTags.includes(s)) : o;
|
|
1403
|
+
}
|
|
1404
|
+
function Ut(e, t) {
|
|
1405
|
+
let n = /* @__PURE__ */ new Map();
|
|
1406
|
+
for (let [e, r] of t) {
|
|
1407
|
+
if (n.has(e) || n.set(e, []), !r) continue;
|
|
1408
|
+
let t = n.get(r) ?? [];
|
|
1409
|
+
t.push(e), n.set(r, t), n.get(e)?.push(r);
|
|
1410
|
+
}
|
|
1411
|
+
let r = /* @__PURE__ */ new Map();
|
|
1412
|
+
if (!n.has(e)) return r;
|
|
1413
|
+
let i = [e];
|
|
1414
|
+
r.set(e, 0);
|
|
1415
|
+
for (let e = 0; e < i.length; e += 1) {
|
|
1416
|
+
let t = i[e], a = (r.get(t) ?? 0) + 1;
|
|
1417
|
+
for (let e of n.get(t) ?? []) r.has(e) || (r.set(e, a), i.push(e));
|
|
1418
|
+
}
|
|
1419
|
+
return r;
|
|
1420
|
+
}
|
|
1421
|
+
function Wt(e, t = {}) {
|
|
1422
|
+
return Ht(Vt(e, t), t);
|
|
1423
|
+
}
|
|
1424
|
+
function Gt(e, t = {}) {
|
|
1425
|
+
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) => Bt(e.debtState) === 0).map((e) => e.id)) : /* @__PURE__ */ new Set(), o = e.filter((e) => i.has(e.id) || a.has(e.id));
|
|
1426
|
+
o.length < 5 && (o = e.slice(0, Math.min(5, e.length)));
|
|
1427
|
+
let s = o.slice(0, 25);
|
|
1428
|
+
return {
|
|
1429
|
+
visible: t.expanded ? e : s,
|
|
1430
|
+
total: e.length,
|
|
1431
|
+
overflowCount: t.expanded ? 0 : Math.max(0, e.length - s.length)
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
function Kt(e, t, n, r) {
|
|
1435
|
+
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}.`);
|
|
1436
|
+
}
|
|
1437
|
+
//#endregion
|
|
1438
|
+
//#region src/ui/graph/codeMapState.js
|
|
1439
|
+
var qt = 1, J = Object.freeze({
|
|
1440
|
+
min: .35,
|
|
1441
|
+
max: 2.4
|
|
1442
|
+
});
|
|
1443
|
+
function Jt(e) {
|
|
1444
|
+
return typeof e == "number" && Number.isFinite(e) && e >= J.min && e <= J.max;
|
|
1445
|
+
}
|
|
1446
|
+
var Yt = Object.freeze({
|
|
1447
|
+
version: 1,
|
|
1448
|
+
presentation: "navigator",
|
|
1449
|
+
selectedId: null,
|
|
1450
|
+
grain: "package",
|
|
1451
|
+
expandedIds: Object.freeze([]),
|
|
1452
|
+
navigatorFilter: "",
|
|
1453
|
+
navigatorFocusedId: null,
|
|
1454
|
+
viewport: null,
|
|
1455
|
+
hoveredSessionId: null,
|
|
1456
|
+
selectedSessionId: null,
|
|
1457
|
+
expandedCommitSessions: Object.freeze([]),
|
|
1458
|
+
expandedGhostGroups: Object.freeze([]),
|
|
1459
|
+
rankMode: "relevance",
|
|
1460
|
+
scentFilter: null
|
|
1461
|
+
}), Xt = /* @__PURE__ */ new Set(["navigator", "canvas"]), Zt = /* @__PURE__ */ new Set([
|
|
1462
|
+
"project",
|
|
1463
|
+
"package",
|
|
1464
|
+
"file"
|
|
1465
|
+
]), Qt = /* @__PURE__ */ new Set([
|
|
1466
|
+
"relevance",
|
|
1467
|
+
"debt",
|
|
1468
|
+
"churn"
|
|
1469
|
+
]), $t = new Set(xt), en = Object.freeze({
|
|
1470
|
+
project: 0,
|
|
1471
|
+
package: 1,
|
|
1472
|
+
file: 1
|
|
1473
|
+
}), tn = en, nn = Object.freeze([
|
|
1474
|
+
"version",
|
|
1475
|
+
"presentation",
|
|
1476
|
+
"selectedId",
|
|
1477
|
+
"grain",
|
|
1478
|
+
"expandedIds",
|
|
1479
|
+
"navigatorFilter",
|
|
1480
|
+
"navigatorFocusedId",
|
|
1481
|
+
"viewport",
|
|
1482
|
+
"hoveredSessionId",
|
|
1483
|
+
"selectedSessionId",
|
|
1484
|
+
"expandedCommitSessions",
|
|
1485
|
+
"expandedGhostGroups",
|
|
1486
|
+
"rankMode",
|
|
1487
|
+
"scentFilter"
|
|
1488
|
+
]), rn = Object.freeze({
|
|
1489
|
+
replace: ["type", "state"],
|
|
1490
|
+
hydrate: ["type", "state"],
|
|
1491
|
+
"set-presentation": ["type", "presentation"],
|
|
1492
|
+
select: ["type", "id"],
|
|
1493
|
+
"clear-selection": ["type"],
|
|
1494
|
+
focus: ["type", "id"],
|
|
1495
|
+
"set-filter": ["type", "filter"],
|
|
1496
|
+
"set-expanded": ["type", "ids"],
|
|
1497
|
+
"toggle-expanded": ["type", "id"],
|
|
1498
|
+
"set-grain": ["type", "grain"],
|
|
1499
|
+
"set-viewport": ["type", "viewport"],
|
|
1500
|
+
"open-in-map": ["type", "id"],
|
|
1501
|
+
reveal: [
|
|
1502
|
+
"type",
|
|
1503
|
+
"id",
|
|
1504
|
+
"grain",
|
|
1505
|
+
"expandedIds"
|
|
1506
|
+
],
|
|
1507
|
+
"hover-session": ["type", "sessionId"],
|
|
1508
|
+
"select-session": ["type", "sessionId"],
|
|
1509
|
+
"toggle-commit-sessions": ["type", "commitHash"],
|
|
1510
|
+
"toggle-ghost-group": ["type", "successorHash"],
|
|
1511
|
+
"set-rank-mode": ["type", "rankMode"],
|
|
1512
|
+
"set-scent-filter": ["type", "scentFilter"],
|
|
1513
|
+
"set-rank-expanded": ["type", "expanded"]
|
|
1514
|
+
});
|
|
1515
|
+
function Y(e = null) {
|
|
1516
|
+
if (e !== null && !pn(e)) throw X("create state", "seed", "the seed is not an object", "pass an object or omit the seed");
|
|
1517
|
+
let t = e ?? {};
|
|
1518
|
+
if (mn(t, nn, "create state", "seed"), t.version !== void 0 && t.version !== 1) throw X("create state", "version", `version ${String(t.version)} is unsupported`, "use version 1");
|
|
1519
|
+
return {
|
|
1520
|
+
version: 1,
|
|
1521
|
+
presentation: Tn(t.presentation, Xt, Yt.presentation, "presentation"),
|
|
1522
|
+
selectedId: vn(t.selectedId, "selectedId"),
|
|
1523
|
+
grain: Tn(t.grain, Zt, Yt.grain, "grain"),
|
|
1524
|
+
expandedIds: yn(t.expandedIds, "expandedIds"),
|
|
1525
|
+
navigatorFilter: Cn(t.navigatorFilter, "", "navigatorFilter"),
|
|
1526
|
+
navigatorFocusedId: vn(t.navigatorFocusedId, "navigatorFocusedId"),
|
|
1527
|
+
viewport: En(t.viewport),
|
|
1528
|
+
hoveredSessionId: vn(t.hoveredSessionId, "hoveredSessionId"),
|
|
1529
|
+
selectedSessionId: vn(t.selectedSessionId, "selectedSessionId"),
|
|
1530
|
+
expandedCommitSessions: yn(t.expandedCommitSessions, "expandedCommitSessions"),
|
|
1531
|
+
expandedGhostGroups: yn(t.expandedGhostGroups, "expandedGhostGroups"),
|
|
1532
|
+
rankMode: Tn(t.rankMode, Qt, Yt.rankMode, "rankMode"),
|
|
1533
|
+
scentFilter: kn(t.scentFilter)
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
function an(e, t) {
|
|
1537
|
+
let n = Y(e), r = Y(t);
|
|
1538
|
+
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 && On(n.viewport, r.viewport) && n.hoveredSessionId === r.hoveredSessionId && n.selectedSessionId === r.selectedSessionId && on(n.expandedCommitSessions, r.expandedCommitSessions) && on(n.expandedGhostGroups, r.expandedGhostGroups) && n.rankMode === r.rankMode && n.scentFilter === r.scentFilter;
|
|
1539
|
+
}
|
|
1540
|
+
function on(e, t) {
|
|
1541
|
+
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1542
|
+
}
|
|
1543
|
+
function sn(e, t) {
|
|
1544
|
+
let n = Y(e);
|
|
1545
|
+
switch (fn(t), t.type) {
|
|
1546
|
+
case "replace":
|
|
1547
|
+
case "hydrate": return Y(t.state);
|
|
1548
|
+
case "set-presentation": return Y({
|
|
1549
|
+
...n,
|
|
1550
|
+
presentation: Q(t.presentation, Xt, "presentation")
|
|
1551
|
+
});
|
|
1552
|
+
case "select": return Y({
|
|
1553
|
+
...n,
|
|
1554
|
+
selectedId: Z(t.id, "id"),
|
|
1555
|
+
navigatorFocusedId: Z(t.id, "id")
|
|
1556
|
+
});
|
|
1557
|
+
case "clear-selection": return Y({
|
|
1558
|
+
...n,
|
|
1559
|
+
selectedId: null
|
|
1560
|
+
});
|
|
1561
|
+
case "focus": return Y({
|
|
1562
|
+
...n,
|
|
1563
|
+
navigatorFocusedId: vn(t.id, "id")
|
|
1564
|
+
});
|
|
1565
|
+
case "set-filter": return Y({
|
|
1566
|
+
...n,
|
|
1567
|
+
navigatorFilter: Cn(t.filter, "", "filter")
|
|
1568
|
+
});
|
|
1569
|
+
case "set-expanded": return Y({
|
|
1570
|
+
...n,
|
|
1571
|
+
expandedIds: yn(t.ids, "ids")
|
|
1572
|
+
});
|
|
1573
|
+
case "toggle-expanded": {
|
|
1574
|
+
let e = Z(t.id, "id"), r = new Set(n.expandedIds);
|
|
1575
|
+
return r.has(e) ? r.delete(e) : r.add(e), Y({
|
|
1576
|
+
...n,
|
|
1577
|
+
expandedIds: [...r]
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
case "set-grain": return Y({
|
|
1581
|
+
...n,
|
|
1582
|
+
grain: Q(t.grain, Zt, "grain"),
|
|
1583
|
+
expandedIds: []
|
|
1584
|
+
});
|
|
1585
|
+
case "set-viewport": return Y({
|
|
1586
|
+
...n,
|
|
1587
|
+
viewport: En(t.viewport)
|
|
1588
|
+
});
|
|
1589
|
+
case "open-in-map": {
|
|
1590
|
+
let e = Z(t.id, "id");
|
|
1591
|
+
return Y({
|
|
1592
|
+
...n,
|
|
1593
|
+
presentation: "canvas",
|
|
1594
|
+
selectedId: e,
|
|
1595
|
+
navigatorFocusedId: e
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
case "reveal": {
|
|
1599
|
+
let e = Z(t.id, "id");
|
|
1600
|
+
return Y({
|
|
1601
|
+
...n,
|
|
1602
|
+
grain: Q(t.grain, Zt, "grain"),
|
|
1603
|
+
expandedIds: yn(t.expandedIds, "expandedIds"),
|
|
1604
|
+
selectedId: e,
|
|
1605
|
+
navigatorFocusedId: e
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
case "hover-session": return Y({
|
|
1609
|
+
...n,
|
|
1610
|
+
hoveredSessionId: _n(t.sessionId, "sessionId")
|
|
1611
|
+
});
|
|
1612
|
+
case "select-session": return Y({
|
|
1613
|
+
...n,
|
|
1614
|
+
selectedSessionId: _n(t.sessionId, "sessionId")
|
|
1615
|
+
});
|
|
1616
|
+
case "toggle-commit-sessions": {
|
|
1617
|
+
let e = Z(t.commitHash, "commitHash"), r = new Set(n.expandedCommitSessions);
|
|
1618
|
+
return r.has(e) ? r.delete(e) : r.add(e), Y({
|
|
1619
|
+
...n,
|
|
1620
|
+
expandedCommitSessions: [...r]
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
case "toggle-ghost-group": {
|
|
1624
|
+
let e = Z(t.successorHash, "successorHash"), r = new Set(n.expandedGhostGroups);
|
|
1625
|
+
return r.has(e) ? r.delete(e) : r.add(e), Y({
|
|
1626
|
+
...n,
|
|
1627
|
+
expandedGhostGroups: [...r]
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
case "set-rank-mode": return Y({
|
|
1631
|
+
...n,
|
|
1632
|
+
rankMode: Q(t.rankMode, Qt, "rankMode")
|
|
1633
|
+
});
|
|
1634
|
+
case "set-scent-filter": return Y({
|
|
1635
|
+
...n,
|
|
1636
|
+
scentFilter: An(t.scentFilter, "scentFilter")
|
|
1637
|
+
});
|
|
1638
|
+
case "set-rank-expanded": {
|
|
1639
|
+
let e = wn(t.expanded, "expanded"), r = new Set(n.expandedCommitSessions);
|
|
1640
|
+
return e ? r.add("ranked:all") : r.delete("ranked:all"), Y({
|
|
1641
|
+
...n,
|
|
1642
|
+
expandedCommitSessions: [...r]
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
default: throw X("reduce state", "action.type", "the action is unsupported", "use a documented CodeMapAction");
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
function cn(e, t) {
|
|
1649
|
+
let n = Y(t), r = un(e), i = (e) => {
|
|
1650
|
+
if (!e) return {
|
|
1651
|
+
sessionId: null,
|
|
1652
|
+
commitHashes: [],
|
|
1653
|
+
ghostHashes: [],
|
|
1654
|
+
edges: []
|
|
1655
|
+
};
|
|
1656
|
+
let t = r.filter((t) => t.sessionId === e);
|
|
1657
|
+
return {
|
|
1658
|
+
sessionId: e,
|
|
1659
|
+
commitHashes: [...new Set(t.filter((e) => !e.ghost).map((e) => e.commitHash))].sort(gn),
|
|
1660
|
+
ghostHashes: [...new Set(t.filter((e) => e.ghost).map((e) => e.commitHash))].sort(gn),
|
|
1661
|
+
edges: t.map((e) => ({ ...e }))
|
|
1662
|
+
};
|
|
1663
|
+
};
|
|
1664
|
+
return {
|
|
1665
|
+
selected: i(n.selectedSessionId),
|
|
1666
|
+
hovered: i(n.hoveredSessionId)
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
function ln(e) {
|
|
1670
|
+
let t = Y(e);
|
|
1671
|
+
return t.hoveredSessionId === null ? t.selectedSessionId === null ? null : {
|
|
1672
|
+
type: "select-session",
|
|
1673
|
+
sessionId: null
|
|
1674
|
+
} : {
|
|
1675
|
+
type: "hover-session",
|
|
1676
|
+
sessionId: null
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
function un(e) {
|
|
1680
|
+
let t = e?.edges ?? [];
|
|
1681
|
+
if (!Array.isArray(t)) throw X("derive timeline highlight", "payload.edges", "edges is not an array", "provide a payload with an edges array");
|
|
1682
|
+
return t.map((e, t) => {
|
|
1683
|
+
if (!pn(e)) throw X("derive timeline highlight", `payload.edges[${t}]`, "the edge is not an object", "provide an edge object");
|
|
1684
|
+
return {
|
|
1685
|
+
sessionId: Z(e.sessionId, `payload.edges[${t}].sessionId`),
|
|
1686
|
+
commitHash: Z(e.commitHash, `payload.edges[${t}].commitHash`),
|
|
1687
|
+
ghost: e.ghost === !0
|
|
1688
|
+
};
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
function dn(e, t) {
|
|
1692
|
+
e && ot(e);
|
|
1693
|
+
let n = Y(t), r = e?.nodes ?? [];
|
|
1694
|
+
if (!Array.isArray(r)) throw X("derive view", "payload.nodes", "nodes is not an array", "provide a CodeMapPayload with a nodes array");
|
|
1695
|
+
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
1696
|
+
r.forEach((e, t) => {
|
|
1697
|
+
if (!pn(e)) throw X("derive view", `payload.nodes[${t}]`, "the node is not an object", "provide a node object");
|
|
1698
|
+
let n = Z(e.id, `payload.nodes[${t}].id`);
|
|
1699
|
+
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");
|
|
1700
|
+
let r = {
|
|
1701
|
+
...e,
|
|
1702
|
+
id: n
|
|
1703
|
+
};
|
|
1704
|
+
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);
|
|
1705
|
+
});
|
|
1706
|
+
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");
|
|
1707
|
+
let o = /* @__PURE__ */ new Map(), s = [];
|
|
1708
|
+
for (let e of i.values()) if (e.parent) {
|
|
1709
|
+
let t = o.get(e.parent) ?? [];
|
|
1710
|
+
t.push(e), o.set(e.parent, t);
|
|
1711
|
+
} else s.push(e);
|
|
1712
|
+
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) || gn(e.id, t.id);
|
|
1713
|
+
s.sort(c);
|
|
1714
|
+
for (let e of o.values()) e.sort(c);
|
|
1715
|
+
let l = /* @__PURE__ */ new Map(), u = [], d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set();
|
|
1716
|
+
function p(e, t) {
|
|
1717
|
+
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");
|
|
1718
|
+
if (!f.has(e.id)) {
|
|
1719
|
+
d.add(e.id), u.push(e.id), l.set(e.id, t);
|
|
1720
|
+
for (let n of o.get(e.id) ?? []) p(n, t + 1);
|
|
1721
|
+
d.delete(e.id), f.add(e.id);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
for (let e of s) p(e, 0);
|
|
1725
|
+
if (f.size !== i.size) {
|
|
1726
|
+
let e = [...i.keys()].find((e) => !f.has(e)), t = e ? i.get(e) : void 0;
|
|
1727
|
+
t && p(t, 0);
|
|
1728
|
+
}
|
|
1729
|
+
let m = new Set(n.expandedIds.filter((e) => i.has(e))), h = n.navigatorFilter.trim().toLowerCase(), g = /* @__PURE__ */ new Set();
|
|
1730
|
+
if (h) for (let e of i.values()) {
|
|
1731
|
+
if (!e.id.toLowerCase().includes(h) && !String(e.name ?? "").toLowerCase().includes(h)) continue;
|
|
1732
|
+
let t = e;
|
|
1733
|
+
for (; t;) g.add(t.id), t = t.parent ? i.get(t.parent) : null;
|
|
1734
|
+
}
|
|
1735
|
+
let _ = en[n.grain], v = [];
|
|
1736
|
+
function y(e, t, n = null) {
|
|
1737
|
+
if (h && !g.has(e.id)) return;
|
|
1738
|
+
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;
|
|
1739
|
+
if (v.push({
|
|
1740
|
+
node: { ...e },
|
|
1741
|
+
depth: t,
|
|
1742
|
+
parentId: n,
|
|
1743
|
+
childIds: i,
|
|
1744
|
+
hasChildren: a,
|
|
1745
|
+
canExpand: s,
|
|
1746
|
+
forcedOpen: c,
|
|
1747
|
+
expanded: c || s && m.has(e.id)
|
|
1748
|
+
}), h || t < _ || m.has(e.id)) for (let n of r) y(n, t + 1, e.id);
|
|
1749
|
+
}
|
|
1750
|
+
for (let e of s) y(e, 0);
|
|
1751
|
+
let ee = [];
|
|
1752
|
+
function b(e, t) {
|
|
1753
|
+
let n = o.get(e.id) ?? [];
|
|
1754
|
+
if (n.length > 0 && (t < _ || m.has(e.id))) for (let e of n) b(e, t + 1);
|
|
1755
|
+
else ee.push({ ...e });
|
|
1756
|
+
}
|
|
1757
|
+
for (let e of s) b(e, 0);
|
|
1758
|
+
let x = n.selectedId ? i.get(n.selectedId) ?? null : null, te = new Set(v.map((e) => e.node.id));
|
|
1759
|
+
return {
|
|
1760
|
+
state: n,
|
|
1761
|
+
rows: v,
|
|
1762
|
+
focusedId: n.navigatorFocusedId && te.has(n.navigatorFocusedId) ? n.navigatorFocusedId : v[0]?.node.id ?? null,
|
|
1763
|
+
selected: x ? { ...x } : null,
|
|
1764
|
+
staleSelectedId: n.selectedId && !x ? n.selectedId : null,
|
|
1765
|
+
canvas: {
|
|
1766
|
+
allNodes: [...i.values()].map((e) => ({ ...e })),
|
|
1767
|
+
nodes: ee,
|
|
1768
|
+
visibleIds: ee.map((e) => e.id),
|
|
1769
|
+
selectedId: x?.id ?? null,
|
|
1770
|
+
grain: n.grain,
|
|
1771
|
+
expandedIds: [...m].sort(gn),
|
|
1772
|
+
viewport: n.viewport ? { ...n.viewport } : null,
|
|
1773
|
+
hierarchy: {
|
|
1774
|
+
orderedIds: u,
|
|
1775
|
+
rootIds: s.map((e) => e.id),
|
|
1776
|
+
childIdsByParent: Object.fromEntries([...o].map(([e, t]) => [e, t.map((e) => e.id)])),
|
|
1777
|
+
depthById: Object.fromEntries(l)
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
function fn(e) {
|
|
1783
|
+
if (!pn(e) || typeof e.type != "string") throw X("reduce state", "action.type", "the action has no string type", "pass a supported action object");
|
|
1784
|
+
let t = rn[e.type];
|
|
1785
|
+
if (!t) throw X("reduce state", "action.type", `action ${JSON.stringify(e.type)} is not supported`, `use one of ${Object.keys(rn).join(", ")}`);
|
|
1786
|
+
switch (hn(e, t, "reduce state", `action ${e.type}`), e.type) {
|
|
1787
|
+
case "replace":
|
|
1788
|
+
case "hydrate":
|
|
1789
|
+
xn(e.state, "state");
|
|
1790
|
+
break;
|
|
1791
|
+
case "set-presentation":
|
|
1792
|
+
Q(e.presentation, Xt, "presentation");
|
|
1793
|
+
break;
|
|
1794
|
+
case "select":
|
|
1795
|
+
case "toggle-expanded":
|
|
1796
|
+
case "open-in-map":
|
|
1797
|
+
Z(e.id, "id");
|
|
1798
|
+
break;
|
|
1799
|
+
case "focus":
|
|
1800
|
+
_n(e.id, "id");
|
|
1801
|
+
break;
|
|
1802
|
+
case "set-filter":
|
|
1803
|
+
Sn(e.filter, "filter");
|
|
1804
|
+
break;
|
|
1805
|
+
case "set-expanded":
|
|
1806
|
+
bn(e.ids, "ids");
|
|
1807
|
+
break;
|
|
1808
|
+
case "set-grain":
|
|
1809
|
+
Q(e.grain, Zt, "grain");
|
|
1810
|
+
break;
|
|
1811
|
+
case "set-viewport":
|
|
1812
|
+
Dn(e.viewport, "viewport");
|
|
1813
|
+
break;
|
|
1814
|
+
case "reveal":
|
|
1815
|
+
Z(e.id, "id"), Q(e.grain, Zt, "grain"), bn(e.expandedIds, "expandedIds");
|
|
1816
|
+
break;
|
|
1817
|
+
case "clear-selection": break;
|
|
1818
|
+
case "hover-session":
|
|
1819
|
+
case "select-session":
|
|
1820
|
+
_n(e.sessionId, "sessionId");
|
|
1821
|
+
break;
|
|
1822
|
+
case "toggle-commit-sessions":
|
|
1823
|
+
Z(e.commitHash, "commitHash");
|
|
1824
|
+
break;
|
|
1825
|
+
case "toggle-ghost-group":
|
|
1826
|
+
Z(e.successorHash, "successorHash");
|
|
1827
|
+
break;
|
|
1828
|
+
case "set-rank-mode":
|
|
1829
|
+
Q(e.rankMode, Qt, "rankMode");
|
|
1830
|
+
break;
|
|
1831
|
+
case "set-scent-filter":
|
|
1832
|
+
An(e.scentFilter, "scentFilter");
|
|
1833
|
+
break;
|
|
1834
|
+
case "set-rank-expanded":
|
|
1835
|
+
wn(e.expanded, "expanded");
|
|
1836
|
+
break;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
function X(e, t, n, r) {
|
|
1840
|
+
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}.`);
|
|
1841
|
+
}
|
|
1842
|
+
function pn(e) {
|
|
1843
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1844
|
+
}
|
|
1845
|
+
function mn(e, t, n, r) {
|
|
1846
|
+
let i = new Set(t), a = Object.keys(e).find((e) => !i.has(e));
|
|
1847
|
+
if (a) throw X(n, `${r}.${a}`, `field ${JSON.stringify(a)} is not allowed`, `remove ${JSON.stringify(a)} and use only ${t.join(", ")}`);
|
|
1848
|
+
}
|
|
1849
|
+
function hn(e, t, n, r) {
|
|
1850
|
+
mn(e, t, n, r);
|
|
1851
|
+
let i = t.find((t) => !(t in e));
|
|
1852
|
+
if (i) throw X(n, `${r}.${i}`, `required field ${JSON.stringify(i)} is missing`, `provide ${JSON.stringify(i)} for this action`);
|
|
1853
|
+
}
|
|
1854
|
+
function gn(e, t) {
|
|
1855
|
+
return e < t ? -1 : +(e > t);
|
|
1856
|
+
}
|
|
1857
|
+
function Z(e, t) {
|
|
1858
|
+
if (typeof e != "string" || e.length === 0) throw X("normalize state", t, "the id is not a nonempty string", "provide a nonempty string id");
|
|
1859
|
+
return e;
|
|
1860
|
+
}
|
|
1861
|
+
function _n(e, t) {
|
|
1862
|
+
return e === null ? null : Z(e, t);
|
|
1863
|
+
}
|
|
1864
|
+
function vn(e, t) {
|
|
1865
|
+
return e == null ? null : Z(e, t);
|
|
1866
|
+
}
|
|
1867
|
+
function yn(e, t) {
|
|
1868
|
+
if (e === void 0) return [];
|
|
1869
|
+
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");
|
|
1870
|
+
let n = [...e];
|
|
1871
|
+
return [...new Set(n.map((e, n) => Z(e, `${t}[${n}]`)))].sort(gn);
|
|
1872
|
+
}
|
|
1873
|
+
function bn(e, t) {
|
|
1874
|
+
if (e === void 0) throw X("normalize action", t, "the required id iterable is undefined", "provide a non-string iterable of nonempty ids");
|
|
1875
|
+
return yn(e, t);
|
|
1876
|
+
}
|
|
1877
|
+
function xn(e, t) {
|
|
1878
|
+
if (!pn(e)) throw X("normalize action", t, "the required value is not an object", "provide an object");
|
|
1879
|
+
return e;
|
|
1880
|
+
}
|
|
1881
|
+
function Sn(e, t) {
|
|
1882
|
+
if (typeof e != "string") throw X("normalize action", t, "the required value is not a string", "provide a string");
|
|
1883
|
+
return e;
|
|
1884
|
+
}
|
|
1885
|
+
function Cn(e, t, n) {
|
|
1886
|
+
if (e === void 0) return t;
|
|
1887
|
+
if (typeof e != "string") throw X("normalize state", n, "the value is not a string", "provide a string");
|
|
1888
|
+
return e;
|
|
1889
|
+
}
|
|
1890
|
+
function wn(e, t) {
|
|
1891
|
+
if (typeof e != "boolean") throw X("normalize state", t, "the value is not a boolean", "provide true or false");
|
|
1892
|
+
return e;
|
|
1893
|
+
}
|
|
1894
|
+
function Tn(e, t, n, r) {
|
|
1895
|
+
return e === void 0 ? n : Q(e, t, r);
|
|
1896
|
+
}
|
|
1897
|
+
function Q(e, t, n) {
|
|
1898
|
+
if (typeof e != "string" || !t.has(e)) throw X("normalize state", n, `value ${JSON.stringify(e)} is unsupported`, `use one of ${[...t].join(", ")}`);
|
|
1899
|
+
return e;
|
|
1900
|
+
}
|
|
1901
|
+
function En(e) {
|
|
1902
|
+
if (e == null) return null;
|
|
1903
|
+
if (!pn(e)) throw X("normalize state", "viewport", "the viewport is not an object or null", "provide {scale, panX, panY} or null");
|
|
1904
|
+
let { scale: t, panX: n, panY: r } = e;
|
|
1905
|
+
if (!Jt(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}`);
|
|
1906
|
+
return {
|
|
1907
|
+
scale: t,
|
|
1908
|
+
panX: n,
|
|
1909
|
+
panY: r
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1912
|
+
function Dn(e, t) {
|
|
1913
|
+
if (e === null) return null;
|
|
1914
|
+
if (e === void 0) throw X("normalize action", t, "the required viewport is undefined", "provide null or a bounded viewport object");
|
|
1915
|
+
return En(e);
|
|
1916
|
+
}
|
|
1917
|
+
function On(e, t) {
|
|
1918
|
+
return e === null || t === null ? e === t : e.scale === t.scale && e.panX === t.panX && e.panY === t.panY;
|
|
1919
|
+
}
|
|
1920
|
+
function kn(e) {
|
|
1921
|
+
if (e == null) return null;
|
|
1922
|
+
if (typeof e != "string" || !$t.has(e)) throw X("normalize state", "scentFilter", `value ${JSON.stringify(e)} is unsupported`, `use null or one of ${[...$t].join(", ")}`);
|
|
1923
|
+
return e;
|
|
1924
|
+
}
|
|
1925
|
+
function An(e, t) {
|
|
1926
|
+
if (e === void 0) throw X("normalize action", t, "the required scent filter is undefined", "provide null or a SCENT_TAGS member");
|
|
1927
|
+
return kn(e);
|
|
1928
|
+
}
|
|
1929
|
+
//#endregion
|
|
1930
|
+
//#region src/ui/MapCanvas.jsx
|
|
1931
|
+
var jn = 56, Mn = 104, Nn = 248, Pn = 132, Fn = 28, In = 48, Ln = 1200, Rn = 1.25, zn = {
|
|
1932
|
+
overview: "project",
|
|
1933
|
+
folders: "package",
|
|
1934
|
+
files: "file"
|
|
1935
|
+
}, Bn = Object.fromEntries(Object.entries(zn).map(([e, t]) => [e, tn[t]])), Vn = [
|
|
1936
|
+
{
|
|
1937
|
+
id: "overview",
|
|
1938
|
+
label: "overview"
|
|
1939
|
+
},
|
|
1940
|
+
{
|
|
1941
|
+
id: "folders",
|
|
1942
|
+
label: "folders"
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
id: "files",
|
|
1946
|
+
label: "files"
|
|
1947
|
+
}
|
|
1948
|
+
], Hn = 500, Un = 1e4, Wn = 3;
|
|
1949
|
+
function Gn(e) {
|
|
1950
|
+
let t = Math.round(Number(e) || 0);
|
|
1951
|
+
return t < 0 ? 0 : t > 4 ? 4 : t;
|
|
1952
|
+
}
|
|
1953
|
+
function Kn(e) {
|
|
1954
|
+
let t = String(e ?? ""), n = t.lastIndexOf("/");
|
|
1955
|
+
return n >= 0 ? t.slice(n + 1) : t;
|
|
1956
|
+
}
|
|
1957
|
+
function qn(e, t) {
|
|
1958
|
+
return e._order === t._order ? e.id < t.id ? -1 : +(e.id > t.id) : e._order - t._order;
|
|
1959
|
+
}
|
|
1960
|
+
function Jn(e) {
|
|
1961
|
+
let t = /* @__PURE__ */ new Map();
|
|
1962
|
+
e.forEach((e, n) => {
|
|
1963
|
+
let r = Number.isFinite(e.order) ? e.order : n;
|
|
1964
|
+
t.set(e.id, {
|
|
1965
|
+
...e,
|
|
1966
|
+
_order: r
|
|
1967
|
+
});
|
|
1968
|
+
});
|
|
1969
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [];
|
|
1970
|
+
for (let e of t.values()) {
|
|
1971
|
+
let a = e.parent && t.has(e.parent) ? e.parent : null;
|
|
1972
|
+
if (a) {
|
|
1973
|
+
r.set(e.id, a);
|
|
1974
|
+
let t = n.get(a);
|
|
1975
|
+
t ? t.push(e) : n.set(a, [e]);
|
|
1976
|
+
} else i.push(e);
|
|
1977
|
+
}
|
|
1978
|
+
for (let e of n.values()) e.sort(qn);
|
|
1979
|
+
i.sort(qn);
|
|
1980
|
+
let a = /* @__PURE__ */ new Map(), o = [], s = (e, t) => {
|
|
1981
|
+
a.set(e.id, t), o.push(e.id);
|
|
1982
|
+
for (let r of n.get(e.id) ?? []) s(r, t + 1);
|
|
1983
|
+
};
|
|
1984
|
+
for (let e of i) s(e, 0);
|
|
1985
|
+
return {
|
|
1986
|
+
byId: t,
|
|
1987
|
+
children: n,
|
|
1988
|
+
roots: i,
|
|
1989
|
+
parentIdByChild: r,
|
|
1990
|
+
depthById: a,
|
|
1991
|
+
orderedIds: o,
|
|
1992
|
+
canonical: !1
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
function Yn(e, t) {
|
|
1996
|
+
let n = new Map(t.orderedIds.map((e, t) => [e, t])), r = new Map(e.map((e) => [e.id, {
|
|
1997
|
+
...e,
|
|
1998
|
+
_order: n.get(e.id) ?? 2 ** 53 - 1
|
|
1999
|
+
}])), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
2000
|
+
for (let [e, n] of Object.entries(t.childIdsByParent)) {
|
|
2001
|
+
i.set(e, n.map((e) => r.get(e)).filter(Boolean));
|
|
2002
|
+
for (let t of n) a.set(t, e);
|
|
2003
|
+
}
|
|
2004
|
+
return {
|
|
2005
|
+
byId: r,
|
|
2006
|
+
children: i,
|
|
2007
|
+
roots: t.rootIds.map((e) => r.get(e)).filter(Boolean),
|
|
2008
|
+
parentIdByChild: a,
|
|
2009
|
+
depthById: new Map(Object.entries(t.depthById)),
|
|
2010
|
+
orderedIds: [...t.orderedIds],
|
|
2011
|
+
canonical: !0
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
function Xn(e, t) {
|
|
2015
|
+
return t.canonical ? t.depthById.get(e.id) ?? 0 : Number.isFinite(e.layer) ? e.layer : t.depthById.get(e.id) ?? 0;
|
|
2016
|
+
}
|
|
2017
|
+
function Zn(e, t, n) {
|
|
2018
|
+
let { children: r, roots: i } = e, a = [], o = (e, i) => {
|
|
2019
|
+
let s = r.get(e.id);
|
|
2020
|
+
if (s && s.length > 0 && (i < t || n.has(e.id))) for (let e of s) o(e, i + 1);
|
|
2021
|
+
else a.push(e);
|
|
2022
|
+
};
|
|
2023
|
+
for (let e of i) o(e, 0);
|
|
2024
|
+
return a;
|
|
2025
|
+
}
|
|
2026
|
+
function Qn(e, t) {
|
|
2027
|
+
if (e.length === 0) return {
|
|
2028
|
+
positioned: [],
|
|
2029
|
+
width: 0,
|
|
2030
|
+
height: 0
|
|
2031
|
+
};
|
|
2032
|
+
let n = 0;
|
|
2033
|
+
for (let t of e) n = Math.max(n, Math.max(0, Number(t.loc) || 0));
|
|
2034
|
+
let r = (e) => {
|
|
2035
|
+
if (n <= 0) return Mn;
|
|
2036
|
+
let t = Math.max(0, Number(e.loc) || 0) / n;
|
|
2037
|
+
return Math.round(Mn + t * (Nn - Mn));
|
|
2038
|
+
}, i = /* @__PURE__ */ new Map();
|
|
2039
|
+
for (let n of e) {
|
|
2040
|
+
let e = Xn(n, t), r = i.get(e);
|
|
2041
|
+
r ? r.push(n) : i.set(e, [n]);
|
|
2042
|
+
}
|
|
2043
|
+
let a = Array.from(i.keys()).sort((e, t) => e - t);
|
|
2044
|
+
for (let e of a) i.get(e).sort(qn);
|
|
2045
|
+
let o = (e) => e.reduce((e, t) => e + r(t), 0) + Fn * (e.length - 1), s = (e) => {
|
|
2046
|
+
let t = [], n = [], i = 0;
|
|
2047
|
+
for (let a of e) {
|
|
2048
|
+
let e = r(a), o = n.length === 0 ? e : e + Fn;
|
|
2049
|
+
n.length > 0 && i + o > Ln ? (t.push(n), n = [a], i = e) : (n.push(a), i += o);
|
|
2050
|
+
}
|
|
2051
|
+
return n.length > 0 && t.push(n), t;
|
|
2052
|
+
}, c = /* @__PURE__ */ new Map();
|
|
2053
|
+
for (let e of a) c.set(e, s(i.get(e)));
|
|
2054
|
+
let l = 0;
|
|
2055
|
+
for (let e of a) for (let t of c.get(e)) l = Math.max(l, o(t));
|
|
2056
|
+
let u = [], d = 0;
|
|
2057
|
+
for (let e of a) for (let t of c.get(e)) {
|
|
2058
|
+
let e = In + (l - o(t)) / 2, n = In + d * Pn;
|
|
2059
|
+
for (let i of t) {
|
|
2060
|
+
let t = r(i);
|
|
2061
|
+
u.push({
|
|
2062
|
+
node: i,
|
|
2063
|
+
x: e,
|
|
2064
|
+
y: n,
|
|
2065
|
+
w: t,
|
|
2066
|
+
h: jn
|
|
2067
|
+
}), e += t + Fn;
|
|
2068
|
+
}
|
|
2069
|
+
d += 1;
|
|
2070
|
+
}
|
|
2071
|
+
return {
|
|
2072
|
+
positioned: u,
|
|
2073
|
+
width: l + In * 2,
|
|
2074
|
+
height: (d - 1) * Pn + jn + In * 2
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
function $n(e, t) {
|
|
2078
|
+
let n = /* @__PURE__ */ new Map();
|
|
2079
|
+
return (r) => {
|
|
2080
|
+
if (n.has(r)) return n.get(r);
|
|
2081
|
+
let i = r;
|
|
2082
|
+
for (; i != null && !t.has(i);) i = e.get(i) ?? null;
|
|
2083
|
+
return n.set(r, i ?? null), i ?? null;
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
function er(e, t, n) {
|
|
2087
|
+
let r = $n(t, n), i = /* @__PURE__ */ new Map();
|
|
2088
|
+
for (let t of e) {
|
|
2089
|
+
let e = r(t.from), n = r(t.to);
|
|
2090
|
+
if (!e || !n || e === n) continue;
|
|
2091
|
+
let a = t.kind === "activity" ? "activity" : "structure", o = `${a}|${e}→${n}`, s = Math.max(0, Number(t.weight) || 1), c = i.get(o);
|
|
2092
|
+
c ? c.weight += s : i.set(o, {
|
|
2093
|
+
from: e,
|
|
2094
|
+
to: n,
|
|
2095
|
+
kind: a,
|
|
2096
|
+
weight: s
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
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);
|
|
2100
|
+
}
|
|
2101
|
+
function tr(e, t, n) {
|
|
2102
|
+
let r = $n(t, n), i = /* @__PURE__ */ new Map();
|
|
2103
|
+
for (let t of e) {
|
|
2104
|
+
let e = Math.max(0, Number(t.violations) || 0);
|
|
2105
|
+
if (e <= 0) continue;
|
|
2106
|
+
let n = r(t.id);
|
|
2107
|
+
n && i.set(n, (i.get(n) || 0) + e);
|
|
2108
|
+
}
|
|
2109
|
+
return i;
|
|
2110
|
+
}
|
|
2111
|
+
function nr(e) {
|
|
2112
|
+
let t;
|
|
2113
|
+
for (let n of e) (!t || n.y < t.y || n.y === t.y && n.x < t.x) && (t = n);
|
|
2114
|
+
return t;
|
|
2115
|
+
}
|
|
2116
|
+
function rr(e, t, n) {
|
|
2117
|
+
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);
|
|
2118
|
+
if (i !== -1) return r[i + n];
|
|
2119
|
+
}
|
|
2120
|
+
function ir(e, t, n) {
|
|
2121
|
+
let r;
|
|
2122
|
+
for (let i of e) (i.y - t.y) * n <= 0 || (r === void 0 || (i.y - r) * n < 0) && (r = i.y);
|
|
2123
|
+
if (r === void 0) return;
|
|
2124
|
+
let i = t.x + t.w / 2, a;
|
|
2125
|
+
for (let t of e) if (t.y === r) {
|
|
2126
|
+
if (!a) {
|
|
2127
|
+
a = t;
|
|
2128
|
+
continue;
|
|
2129
|
+
}
|
|
2130
|
+
Math.abs(t.x + t.w / 2 - i) < Math.abs(a.x + a.w / 2 - i) && (a = t);
|
|
2131
|
+
}
|
|
2132
|
+
return a;
|
|
2133
|
+
}
|
|
2134
|
+
function ar({ data: i = {
|
|
2135
|
+
nodes: [],
|
|
2136
|
+
edges: []
|
|
2137
|
+
}, grain: f = "folders", expandedIds: p, visibleIds: h, hierarchy: g, selectedId: y, highlightedIds: te, nodeDeltas: re = {}, edgeDeltas: ae = {}, onSelect: oe, onGrainChange: se, onExpandedIdsChange: S, onExpand: ce, height: le = 520, ariaLabel: ue = "code map", className: de = "", viewport: C, onViewportChange: fe, onStateAction: w, canonicalControlled: T = !1 }) {
|
|
2138
|
+
let E = i?.nodes ?? [], pe = i?.edges ?? [], D = r().replace(/[:]/g, ""), me = `${D}-live`, he = `${D}-list`, [ge, _e] = s(Bn[f] === void 0 ? "folders" : f), [ve, ye] = s(() => sr(p)), [be, xe] = s(y ?? null), [O, Se] = s(null), [Ce, we] = s(() => cr(C?.scale) ? C.scale : 1), [Te, Ee] = s(() => ({
|
|
2139
|
+
x: $(C?.panX, 0),
|
|
2140
|
+
y: $(C?.panY, 0)
|
|
2141
|
+
})), [De, Oe] = s(""), [ke, Ae] = s(!1), k = o(null), A = o(null), [j, je] = s(null), Me = o(null), Ne = o(!1), Pe = o(C != null), Fe = C && cr(C.scale) ? `${C.scale}|${$(C.panX, 0)}|${$(C.panY, 0)}` : "", Ie = o(Fe), M = o(Fe), Le = o(!1), Re = o(f), ze = o(y), Be = lr(p), Ve = lr(te), N = T ? Bn[f] === void 0 ? "folders" : f : ge, P = a(() => T ? sr(p) : ve, [
|
|
2142
|
+
T,
|
|
2143
|
+
Be,
|
|
2144
|
+
ve
|
|
2145
|
+
]), F = T ? y ?? null : be, I = T && C != null && cr(C.scale), L = j ? j.scale : I ? C.scale : Ce, R = j ? {
|
|
2146
|
+
x: j.panX,
|
|
2147
|
+
y: j.panY
|
|
2148
|
+
} : I ? {
|
|
2149
|
+
x: $(C.panX, 0),
|
|
2150
|
+
y: $(C.panY, 0)
|
|
2151
|
+
} : Te, He = o(L), Ue = o(R);
|
|
2152
|
+
He.current = L, Ue.current = R, n(() => {
|
|
2153
|
+
if (j && !A.current) {
|
|
2154
|
+
if (I && C.scale === j.scale && $(C.panX, 0) === j.panX && $(C.panY, 0) === j.panY) {
|
|
2155
|
+
je(null);
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
return Me.current = setTimeout(() => je(null), Hn), () => clearTimeout(Me.current);
|
|
2159
|
+
}
|
|
2160
|
+
}, [
|
|
2161
|
+
j,
|
|
2162
|
+
I,
|
|
2163
|
+
C?.scale,
|
|
2164
|
+
C?.panX,
|
|
2165
|
+
C?.panY
|
|
2166
|
+
]), n(() => {
|
|
2167
|
+
T || f !== Re.current && (Re.current = f, Bn[f] !== void 0 && _e(f));
|
|
2168
|
+
}, [T, f]), n(() => {
|
|
2169
|
+
!T && p !== void 0 && ye(sr(p));
|
|
2170
|
+
}, [T, Be]), n(() => {
|
|
2171
|
+
T || y !== ze.current && (ze.current = y, y !== void 0 && xe(y));
|
|
2172
|
+
}, [T, y]), n(() => {
|
|
2173
|
+
if (T) {
|
|
2174
|
+
if (!C && M.current !== "") M.current = "", Pe.current = !1, Ne.current = !1, we(1), Ee({
|
|
2175
|
+
x: 0,
|
|
2176
|
+
y: 0
|
|
2177
|
+
});
|
|
2178
|
+
else if (C && cr(C.scale)) {
|
|
2179
|
+
let e = `${C.scale}|${$(C.panX, 0)}|${$(C.panY, 0)}`;
|
|
2180
|
+
e !== M.current && (M.current = e, Pe.current = !0);
|
|
2181
|
+
}
|
|
2182
|
+
return;
|
|
2183
|
+
}
|
|
2184
|
+
if (!C) {
|
|
2185
|
+
if (M.current === "") return;
|
|
2186
|
+
M.current = "", Ie.current = "1|0|0", Pe.current = !1, we(1), Ee({
|
|
2187
|
+
x: 0,
|
|
2188
|
+
y: 0
|
|
2189
|
+
});
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
if (!cr(C.scale)) return;
|
|
2193
|
+
let e = `${C.scale}|${$(C.panX, 0)}|${$(C.panY, 0)}`;
|
|
2194
|
+
e !== M.current && (M.current = e, Pe.current = !0, Ie.current = e, we(C.scale), Ee({
|
|
2195
|
+
x: $(C.panX, 0),
|
|
2196
|
+
y: $(C.panY, 0)
|
|
2197
|
+
}));
|
|
2198
|
+
}, [
|
|
2199
|
+
T,
|
|
2200
|
+
C,
|
|
2201
|
+
C?.scale,
|
|
2202
|
+
C?.panX,
|
|
2203
|
+
C?.panY
|
|
2204
|
+
]), n(() => {
|
|
2205
|
+
if (T || !fe && !w) return;
|
|
2206
|
+
let e = `${L}|${R.x}|${R.y}`;
|
|
2207
|
+
Ie.current !== e && (Ie.current = e, fe?.({
|
|
2208
|
+
scale: L,
|
|
2209
|
+
panX: R.x,
|
|
2210
|
+
panY: R.y
|
|
2211
|
+
}), Le.current && (Le.current = !1, w?.({
|
|
2212
|
+
type: "set-viewport",
|
|
2213
|
+
viewport: {
|
|
2214
|
+
scale: L,
|
|
2215
|
+
panX: R.x,
|
|
2216
|
+
panY: R.y
|
|
2217
|
+
}
|
|
2218
|
+
})));
|
|
2219
|
+
}, [
|
|
2220
|
+
T,
|
|
2221
|
+
w,
|
|
2222
|
+
fe,
|
|
2223
|
+
R.x,
|
|
2224
|
+
R.y,
|
|
2225
|
+
L
|
|
2226
|
+
]);
|
|
2227
|
+
let z = a(() => g ? Yn(E, g) : Jn(E), [E, g]), We = a(() => h === void 0 ? Zn(z, Bn[N], P) : Array.from(h, (e) => z.byId.get(e)).filter(Boolean), [
|
|
2228
|
+
z,
|
|
2229
|
+
N,
|
|
2230
|
+
P,
|
|
2231
|
+
lr(h)
|
|
2232
|
+
]), B = a(() => new Set(We.map((e) => e.id)), [We]), { positioned: V, width: H, height: U } = a(() => Qn(We, z), [We, z]), Ge = a(() => {
|
|
2233
|
+
let e = /* @__PURE__ */ new Map();
|
|
2234
|
+
for (let t of V) e.set(t.node.id, t);
|
|
2235
|
+
return e;
|
|
2236
|
+
}, [V]), Ke = a(() => {
|
|
2237
|
+
let e = /* @__PURE__ */ new Map();
|
|
2238
|
+
for (let [t, n] of z.children) e.set(t, n.length);
|
|
2239
|
+
return e;
|
|
2240
|
+
}, [z]), qe = a(() => er(pe, z.parentIdByChild, B), [
|
|
2241
|
+
pe,
|
|
2242
|
+
z.parentIdByChild,
|
|
2243
|
+
B
|
|
2244
|
+
]), Je = a(() => qe.reduce((e, t) => Math.max(e, t.weight), 1), [qe]), W = a(() => tr(E, z.parentIdByChild, B), [
|
|
2245
|
+
E,
|
|
2246
|
+
z.parentIdByChild,
|
|
2247
|
+
B
|
|
2248
|
+
]), Ye = a(() => {
|
|
2249
|
+
let e = sr(te);
|
|
2250
|
+
if (e.size === 0) return e;
|
|
2251
|
+
let t = $n(z.parentIdByChild, B), n = /* @__PURE__ */ new Set();
|
|
2252
|
+
for (let r of e) {
|
|
2253
|
+
let e = t(r);
|
|
2254
|
+
e && n.add(e);
|
|
2255
|
+
}
|
|
2256
|
+
return n;
|
|
2257
|
+
}, [
|
|
2258
|
+
Ve,
|
|
2259
|
+
z.parentIdByChild,
|
|
2260
|
+
B
|
|
2261
|
+
]), Xe = a(() => {
|
|
2262
|
+
let e = De.trim().toLowerCase();
|
|
2263
|
+
return e ? E.filter((t) => t.id.toLowerCase().includes(e) || (t.label || "").toLowerCase().includes(e)).slice(0, 8) : [];
|
|
2264
|
+
}, [E, De]), Ze = t((e) => {
|
|
2265
|
+
fe?.(e), w?.({
|
|
2266
|
+
type: "set-viewport",
|
|
2267
|
+
viewport: e
|
|
2268
|
+
});
|
|
2269
|
+
}, [w, fe]), G = t((e, t) => {
|
|
2270
|
+
if (T && t) {
|
|
2271
|
+
Ze(e);
|
|
2272
|
+
return;
|
|
2273
|
+
}
|
|
2274
|
+
t && (Le.current = !0), we(e.scale), Ee({
|
|
2275
|
+
x: e.panX,
|
|
2276
|
+
y: e.panY
|
|
2277
|
+
});
|
|
2278
|
+
}, [T, Ze]), Qe = t((e = !1) => {
|
|
2279
|
+
let t = k.current;
|
|
2280
|
+
if (!t || H <= 0 || U <= 0) return;
|
|
2281
|
+
let n = t.clientWidth, r = t.clientHeight;
|
|
2282
|
+
if (n <= 0 || r <= 0) return;
|
|
2283
|
+
let i = Math.min(n / H, r / U), a = Math.max(J.min, Math.min(J.max, i));
|
|
2284
|
+
G({
|
|
2285
|
+
scale: a,
|
|
2286
|
+
panX: (n - H * a) / 2,
|
|
2287
|
+
panY: (r - U * a) / 2
|
|
2288
|
+
}, e);
|
|
2289
|
+
}, [
|
|
2290
|
+
G,
|
|
2291
|
+
H,
|
|
2292
|
+
U
|
|
2293
|
+
]), $e = t((e, t = !1) => {
|
|
2294
|
+
let n = k.current;
|
|
2295
|
+
if (!n) return !1;
|
|
2296
|
+
let r = n.clientWidth, i = n.clientHeight;
|
|
2297
|
+
if (r <= 0 || i <= 0) return !1;
|
|
2298
|
+
let a = V.filter((t) => e.has(t.node.id));
|
|
2299
|
+
if (a.length === 0) return !1;
|
|
2300
|
+
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;
|
|
2301
|
+
if (u <= 0 || d <= 0) return !1;
|
|
2302
|
+
let f = Math.min(r / u, i / d), p = Math.max(J.min, Math.min(J.max, f));
|
|
2303
|
+
return G({
|
|
2304
|
+
scale: p,
|
|
2305
|
+
panX: r / 2 - (o + u / 2) * p,
|
|
2306
|
+
panY: i / 2 - (s + d / 2) * p
|
|
2307
|
+
}, t), !0;
|
|
2308
|
+
}, [G, V]), [et, tt] = s(!1);
|
|
2309
|
+
n(() => {
|
|
2310
|
+
if (!et) return;
|
|
2311
|
+
let e = window.setTimeout(() => tt(!1), 200);
|
|
2312
|
+
return () => window.clearTimeout(e);
|
|
2313
|
+
}, [et]);
|
|
2314
|
+
let nt = a(() => V.map((e) => e.node.id).join("|"), [V]), rt = I ? `canonical|${C.scale}|${$(C.panX, 0)}|${$(C.panY, 0)}` : T ? "canonical|auto-fit" : "legacy", it = o(P);
|
|
2315
|
+
n(() => {
|
|
2316
|
+
let e = it.current;
|
|
2317
|
+
if (it.current = P, Pe.current) {
|
|
2318
|
+
Pe.current = !1, Ne.current = !0;
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
if (!Ne.current) {
|
|
2322
|
+
Ne.current = !0, Qe(I);
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
let t = null;
|
|
2326
|
+
for (let n of P) if (!e.has(n)) {
|
|
2327
|
+
t = n;
|
|
2328
|
+
break;
|
|
2329
|
+
}
|
|
2330
|
+
if (t) {
|
|
2331
|
+
let e = /* @__PURE__ */ new Set([t]), n = [t];
|
|
2332
|
+
for (; n.length > 0;) {
|
|
2333
|
+
let t = n.pop();
|
|
2334
|
+
for (let r of z.children.get(t) ?? []) e.add(r.id), n.push(r.id);
|
|
2335
|
+
}
|
|
2336
|
+
let r = [...e].filter((e) => B.has(e));
|
|
2337
|
+
if (tt(!0), r.length > 0 && $e(new Set(r), !0)) return;
|
|
2338
|
+
}
|
|
2339
|
+
Qe(I);
|
|
2340
|
+
}, [nt, rt]);
|
|
2341
|
+
let at = t((e) => {
|
|
2342
|
+
let t = k.current, n = t ? t.clientWidth / 2 : 0, r = t ? t.clientHeight / 2 : 0, i = He.current, a = Math.max(J.min, Math.min(J.max, i * e));
|
|
2343
|
+
if (a === i) return;
|
|
2344
|
+
let o = Ue.current;
|
|
2345
|
+
G({
|
|
2346
|
+
scale: a,
|
|
2347
|
+
panX: n - (n - o.x) / i * a,
|
|
2348
|
+
panY: r - (r - o.y) / i * a
|
|
2349
|
+
}, !0);
|
|
2350
|
+
}, [G]), K = t((e) => {
|
|
2351
|
+
if (!(e.ctrlKey || e.metaKey)) return;
|
|
2352
|
+
e.preventDefault();
|
|
2353
|
+
let t = k.current;
|
|
2354
|
+
if (!t) return;
|
|
2355
|
+
let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = He.current, o = Math.exp(-e.deltaY * .01), s = Math.max(1 / Rn, Math.min(Rn, o)), c = Math.max(J.min, Math.min(J.max, a * s));
|
|
2356
|
+
if (c === a) return;
|
|
2357
|
+
let l = Ue.current;
|
|
2358
|
+
G({
|
|
2359
|
+
scale: c,
|
|
2360
|
+
panX: r - (r - l.x) / a * c,
|
|
2361
|
+
panY: i - (i - l.y) / a * c
|
|
2362
|
+
}, !0);
|
|
2363
|
+
}, [G]);
|
|
2364
|
+
n(() => {
|
|
2365
|
+
let e = k.current;
|
|
2366
|
+
if (e) return e.addEventListener("wheel", K, { passive: !1 }), () => e.removeEventListener("wheel", K);
|
|
2367
|
+
}, [K]);
|
|
2368
|
+
let ot = t((e) => {
|
|
2369
|
+
let t = Ge.get(e), n = k.current;
|
|
2370
|
+
if (!t || !n) return;
|
|
2371
|
+
let r = Math.max(L, 1);
|
|
2372
|
+
G({
|
|
2373
|
+
scale: r,
|
|
2374
|
+
panX: n.clientWidth / 2 - (t.x + t.w / 2) * r,
|
|
2375
|
+
panY: n.clientHeight / 2 - (t.y + t.h / 2) * r
|
|
2376
|
+
}, !0);
|
|
2377
|
+
}, [
|
|
2378
|
+
G,
|
|
2379
|
+
Ge,
|
|
2380
|
+
L
|
|
2381
|
+
]), st = t((e) => {
|
|
2382
|
+
if (T && e === F) return;
|
|
2383
|
+
T || xe(e), w?.(e ? {
|
|
2384
|
+
type: "select",
|
|
2385
|
+
id: e
|
|
2386
|
+
} : { type: "clear-selection" });
|
|
2387
|
+
let t = e ? z.byId.get(e) : null;
|
|
2388
|
+
oe?.(e, t ? or(t) : null);
|
|
2389
|
+
}, [
|
|
2390
|
+
T,
|
|
2391
|
+
oe,
|
|
2392
|
+
w,
|
|
2393
|
+
F,
|
|
2394
|
+
z.byId
|
|
2395
|
+
]), ct = t((e) => {
|
|
2396
|
+
T || (_e(e), ye(/* @__PURE__ */ new Set())), w?.({
|
|
2397
|
+
type: "set-grain",
|
|
2398
|
+
grain: zn[e]
|
|
2399
|
+
}), se?.(e), T || S?.([]);
|
|
2400
|
+
}, [
|
|
2401
|
+
T,
|
|
2402
|
+
S,
|
|
2403
|
+
se,
|
|
2404
|
+
w
|
|
2405
|
+
]), [q, lt] = s(null), [ut, dt] = s("");
|
|
2406
|
+
n(() => {
|
|
2407
|
+
q && !P.has(q) && lt(null);
|
|
2408
|
+
}, [q, P]);
|
|
2409
|
+
let ft = t((e) => {
|
|
2410
|
+
if ((Ke.get(e) || 0) === 0) return;
|
|
2411
|
+
let t = z.byId.get(e), n = new Set(P);
|
|
2412
|
+
if (n.has(e)) n.delete(e), lt((t) => {
|
|
2413
|
+
if (t !== e) return t;
|
|
2414
|
+
let r = z.parentIdByChild.get(e) ?? null;
|
|
2415
|
+
return r && n.has(r) ? r : null;
|
|
2416
|
+
}), dt(`closed ${Kn(t?.label || e)}`);
|
|
2417
|
+
else {
|
|
2418
|
+
n.add(e), ce?.(e), lt(e);
|
|
2419
|
+
let r = Ke.get(e) || 0;
|
|
2420
|
+
dt(`opened ${Kn(t?.label || e)}, showing ${r} item${r === 1 ? "" : "s"}`);
|
|
2421
|
+
}
|
|
2422
|
+
T || ye(n), w?.({
|
|
2423
|
+
type: "set-expanded",
|
|
2424
|
+
ids: Array.from(n)
|
|
2425
|
+
}), S?.(Array.from(n));
|
|
2426
|
+
}, [
|
|
2427
|
+
T,
|
|
2428
|
+
Ke,
|
|
2429
|
+
P,
|
|
2430
|
+
ce,
|
|
2431
|
+
S,
|
|
2432
|
+
w,
|
|
2433
|
+
z.byId,
|
|
2434
|
+
z.parentIdByChild
|
|
2435
|
+
]), pt = a(() => {
|
|
2436
|
+
if (!q) return [];
|
|
2437
|
+
let e = [], t = q;
|
|
2438
|
+
for (; t;) {
|
|
2439
|
+
let n = z.byId.get(t);
|
|
2440
|
+
if (!n) break;
|
|
2441
|
+
e.unshift(n), t = z.parentIdByChild.get(t) ?? null;
|
|
2442
|
+
}
|
|
2443
|
+
return e;
|
|
2444
|
+
}, [q, z]), mt = t(() => {
|
|
2445
|
+
T || ye(/* @__PURE__ */ new Set()), w?.({
|
|
2446
|
+
type: "set-expanded",
|
|
2447
|
+
ids: []
|
|
2448
|
+
}), S?.([]), lt(null), dt("back to the top level");
|
|
2449
|
+
}, [
|
|
2450
|
+
T,
|
|
2451
|
+
S,
|
|
2452
|
+
w
|
|
2453
|
+
]), ht = t((e) => {
|
|
2454
|
+
let t = pt.slice(0, e + 1), n = t.map((e) => e.id), r = new Set(n);
|
|
2455
|
+
T || ye(r), w?.({
|
|
2456
|
+
type: "set-expanded",
|
|
2457
|
+
ids: n
|
|
2458
|
+
}), S?.(n);
|
|
2459
|
+
let i = t[t.length - 1] ?? null;
|
|
2460
|
+
lt(i?.id ?? null), dt(i ? `back to ${Kn(i.label || i.id)}` : "back to the top level");
|
|
2461
|
+
}, [
|
|
2462
|
+
pt,
|
|
2463
|
+
T,
|
|
2464
|
+
S,
|
|
2465
|
+
w
|
|
2466
|
+
]), gt = t((e) => {
|
|
2467
|
+
let t = e.key;
|
|
2468
|
+
if (t === "+" || t === "=") {
|
|
2469
|
+
e.preventDefault(), at(Rn);
|
|
2470
|
+
return;
|
|
2471
|
+
}
|
|
2472
|
+
if (t === "-" || t === "_") {
|
|
2473
|
+
e.preventDefault(), at(1 / Rn);
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
if (t === "0") {
|
|
2477
|
+
e.preventDefault(), Qe(!0);
|
|
2478
|
+
return;
|
|
2479
|
+
}
|
|
2480
|
+
if (t === "ArrowLeft" || t === "ArrowRight" || t === "ArrowUp" || t === "ArrowDown") {
|
|
2481
|
+
e.preventDefault();
|
|
2482
|
+
let n = O ? Ge.get(O) : void 0;
|
|
2483
|
+
if (!n) {
|
|
2484
|
+
let e = nr(V);
|
|
2485
|
+
e && Se(e.node.id);
|
|
2486
|
+
return;
|
|
2487
|
+
}
|
|
2488
|
+
let r;
|
|
2489
|
+
r = t === "ArrowLeft" ? rr(V, n, -1) : t === "ArrowRight" ? rr(V, n, 1) : t === "ArrowUp" ? ir(V, n, -1) : ir(V, n, 1), r && (Se(r.node.id), pr(r, k.current, L, R, (e) => {
|
|
2490
|
+
G({
|
|
2491
|
+
scale: L,
|
|
2492
|
+
panX: e.x,
|
|
2493
|
+
panY: e.y
|
|
2494
|
+
}, !0);
|
|
2495
|
+
}));
|
|
2496
|
+
return;
|
|
2497
|
+
}
|
|
2498
|
+
if (t === "Enter") {
|
|
2499
|
+
if (!O) return;
|
|
2500
|
+
e.preventDefault(), e.shiftKey ? ft(O) : T ? F !== O && st(O) : st(F === O ? null : O);
|
|
2501
|
+
return;
|
|
2502
|
+
}
|
|
2503
|
+
if (t === "e" || t === "E") {
|
|
2504
|
+
if (!O) return;
|
|
2505
|
+
e.preventDefault(), ft(O);
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
t === "Escape" && F && (e.preventDefault(), st(null));
|
|
2509
|
+
}, [
|
|
2510
|
+
O,
|
|
2511
|
+
V,
|
|
2512
|
+
Ge,
|
|
2513
|
+
F,
|
|
2514
|
+
L,
|
|
2515
|
+
R,
|
|
2516
|
+
T,
|
|
2517
|
+
G,
|
|
2518
|
+
at,
|
|
2519
|
+
Qe,
|
|
2520
|
+
ft,
|
|
2521
|
+
st
|
|
2522
|
+
]), _t = t((e) => {
|
|
2523
|
+
let t = A.current;
|
|
2524
|
+
if (!t || e !== t.pointerId) return;
|
|
2525
|
+
A.current = null;
|
|
2526
|
+
let n = k.current;
|
|
2527
|
+
try {
|
|
2528
|
+
n?.releasePointerCapture?.(e);
|
|
2529
|
+
} catch {}
|
|
2530
|
+
T && je(null);
|
|
2531
|
+
}, [T]), vt = t((e) => {
|
|
2532
|
+
if (e.button !== 0 || e.target instanceof Element && e.target.closest("button, a, input, select, textarea")) return;
|
|
2533
|
+
if (A.current) {
|
|
2534
|
+
if (Date.now() - A.current.startedAt < Un) return;
|
|
2535
|
+
_t(A.current.pointerId);
|
|
2536
|
+
}
|
|
2537
|
+
let t = k.current;
|
|
2538
|
+
t && t.setPointerCapture?.(e.pointerId), A.current = {
|
|
2539
|
+
pointerId: e.pointerId,
|
|
2540
|
+
startX: e.clientX,
|
|
2541
|
+
startY: e.clientY,
|
|
2542
|
+
panX: R.x,
|
|
2543
|
+
panY: R.y,
|
|
2544
|
+
moved: !1,
|
|
2545
|
+
nextPan: null,
|
|
2546
|
+
startedAt: Date.now()
|
|
2547
|
+
};
|
|
2548
|
+
}, [R, _t]), yt = t((e) => {
|
|
2549
|
+
let t = A.current;
|
|
2550
|
+
if (!t || e.pointerId !== t.pointerId) return;
|
|
2551
|
+
let n = e.clientX - t.startX, r = e.clientY - t.startY;
|
|
2552
|
+
!t.moved && Math.abs(n) + Math.abs(r) > 3 && (t.moved = !0), t.moved && (t.nextPan = {
|
|
2553
|
+
scale: He.current,
|
|
2554
|
+
panX: t.panX + n,
|
|
2555
|
+
panY: t.panY + r
|
|
2556
|
+
}, T ? je(t.nextPan) : G(t.nextPan, !0));
|
|
2557
|
+
}, [G, T]), bt = t((e) => {
|
|
2558
|
+
let t = A.current;
|
|
2559
|
+
if (!t || e.pointerId !== t.pointerId) return;
|
|
2560
|
+
A.current = null;
|
|
2561
|
+
let n = k.current;
|
|
2562
|
+
try {
|
|
2563
|
+
n?.releasePointerCapture?.(e.pointerId);
|
|
2564
|
+
} catch {}
|
|
2565
|
+
t.moved && T && t.nextPan && (G(t.nextPan, !0), je({ ...t.nextPan })), !t.moved && e.target === e.currentTarget && st(null);
|
|
2566
|
+
}, [
|
|
2567
|
+
G,
|
|
2568
|
+
T,
|
|
2569
|
+
st
|
|
2570
|
+
]), xt = t((e) => _t(e.pointerId), [_t]), St = t((e) => _t(e.pointerId), [_t]), Ct = a(() => {
|
|
2571
|
+
if (!O) return "";
|
|
2572
|
+
let e = z.byId.get(O);
|
|
2573
|
+
return e ? fr(e, {
|
|
2574
|
+
selected: F === O,
|
|
2575
|
+
expanded: P.has(O),
|
|
2576
|
+
violations: W.get(O) || 0
|
|
2577
|
+
}) : "";
|
|
2578
|
+
}, [
|
|
2579
|
+
O,
|
|
2580
|
+
z.byId,
|
|
2581
|
+
F,
|
|
2582
|
+
P,
|
|
2583
|
+
W
|
|
2584
|
+
]), wt = a(() => {
|
|
2585
|
+
let e = k.current;
|
|
2586
|
+
if (!e || H <= 0 || U <= 0) return null;
|
|
2587
|
+
let t = e.clientWidth, n = e.clientHeight;
|
|
2588
|
+
return {
|
|
2589
|
+
graphW: H,
|
|
2590
|
+
graphH: U,
|
|
2591
|
+
viewX: -R.x / L,
|
|
2592
|
+
viewY: -R.y / L,
|
|
2593
|
+
viewW: t / L,
|
|
2594
|
+
viewH: n / L
|
|
2595
|
+
};
|
|
2596
|
+
}, [
|
|
2597
|
+
R,
|
|
2598
|
+
L,
|
|
2599
|
+
H,
|
|
2600
|
+
U
|
|
2601
|
+
]), Tt = V.length === 0, Et = (e) => `${D}-grain-${e}`;
|
|
2602
|
+
return /* @__PURE__ */ u("div", {
|
|
2603
|
+
className: ["mc", de].filter(Boolean).join(" "),
|
|
2604
|
+
style: { height: le },
|
|
2605
|
+
role: "application",
|
|
2606
|
+
"aria-label": ue,
|
|
2607
|
+
"aria-roledescription": "code structure map",
|
|
2608
|
+
children: [
|
|
2609
|
+
/* @__PURE__ */ l("div", {
|
|
2610
|
+
id: me,
|
|
2611
|
+
className: "mc-sr",
|
|
2612
|
+
role: "status",
|
|
2613
|
+
"aria-live": "polite",
|
|
2614
|
+
children: Ct
|
|
2615
|
+
}),
|
|
2616
|
+
/* @__PURE__ */ u("div", {
|
|
2617
|
+
className: "mc-toolbar",
|
|
2618
|
+
children: [/* @__PURE__ */ l("div", {
|
|
2619
|
+
className: "mc-seg",
|
|
2620
|
+
role: "radiogroup",
|
|
2621
|
+
"aria-label": "detail grain",
|
|
2622
|
+
children: Vn.map((e) => /* @__PURE__ */ u("button", {
|
|
2623
|
+
id: Et(e.id),
|
|
2624
|
+
type: "button",
|
|
2625
|
+
role: "radio",
|
|
2626
|
+
"aria-checked": N === e.id,
|
|
2627
|
+
className: "mc-seg-btn mono",
|
|
2628
|
+
"data-active": N === e.id ? "true" : void 0,
|
|
2629
|
+
onClick: () => ct(e.id),
|
|
2630
|
+
children: [N === e.id && /* @__PURE__ */ l(d, {
|
|
2631
|
+
className: "lucide",
|
|
2632
|
+
"aria-hidden": "true"
|
|
2633
|
+
}), e.label]
|
|
2634
|
+
}, e.id))
|
|
2635
|
+
}), /* @__PURE__ */ u("div", {
|
|
2636
|
+
className: "mc-search",
|
|
2637
|
+
role: "combobox",
|
|
2638
|
+
"aria-expanded": ke && Xe.length > 0,
|
|
2639
|
+
"aria-haspopup": "listbox",
|
|
2640
|
+
"aria-owns": he,
|
|
2641
|
+
children: [
|
|
2642
|
+
/* @__PURE__ */ l(ne, {
|
|
2643
|
+
className: "lucide mc-search-ico",
|
|
2644
|
+
"aria-hidden": "true"
|
|
2645
|
+
}),
|
|
2646
|
+
/* @__PURE__ */ l("input", {
|
|
2647
|
+
className: "mc-search-input mono",
|
|
2648
|
+
type: "text",
|
|
2649
|
+
placeholder: "find a node",
|
|
2650
|
+
"aria-label": "find a node",
|
|
2651
|
+
"aria-controls": he,
|
|
2652
|
+
"aria-autocomplete": "list",
|
|
2653
|
+
value: De,
|
|
2654
|
+
onChange: (e) => {
|
|
2655
|
+
Oe(e.target.value), Ae(!0);
|
|
2656
|
+
},
|
|
2657
|
+
onFocus: () => Ae(!0),
|
|
2658
|
+
onBlur: () => {
|
|
2659
|
+
window.setTimeout(() => Ae(!1), 120);
|
|
2660
|
+
},
|
|
2661
|
+
onKeyDown: (e) => {
|
|
2662
|
+
e.key === "Enter" && Xe[0] ? (e.preventDefault(), Dt(Xe[0])) : e.key === "Escape" && Ae(!1);
|
|
2663
|
+
}
|
|
2664
|
+
}),
|
|
2665
|
+
ke && Xe.length > 0 && /* @__PURE__ */ l("ul", {
|
|
2666
|
+
className: "mc-results",
|
|
2667
|
+
id: he,
|
|
2668
|
+
role: "listbox",
|
|
2669
|
+
"aria-label": "search results",
|
|
2670
|
+
children: Xe.map((e) => /* @__PURE__ */ u("li", {
|
|
2671
|
+
role: "option",
|
|
2672
|
+
"aria-selected": e.id === F,
|
|
2673
|
+
className: "mc-result mono",
|
|
2674
|
+
onMouseDown: (t) => {
|
|
2675
|
+
t.preventDefault(), Dt(e);
|
|
2676
|
+
},
|
|
2677
|
+
children: [e.kind === "folder" ? /* @__PURE__ */ l(v, {
|
|
2678
|
+
className: "lucide",
|
|
2679
|
+
"aria-hidden": "true"
|
|
2680
|
+
}) : /* @__PURE__ */ l(_, {
|
|
2681
|
+
className: "lucide",
|
|
2682
|
+
"aria-hidden": "true"
|
|
2683
|
+
}), /* @__PURE__ */ l("span", {
|
|
2684
|
+
className: "mc-result-path",
|
|
2685
|
+
children: e.id
|
|
2686
|
+
})]
|
|
2687
|
+
}, e.id))
|
|
2688
|
+
})
|
|
2689
|
+
]
|
|
2690
|
+
})]
|
|
2691
|
+
}),
|
|
2692
|
+
/* @__PURE__ */ l("div", {
|
|
2693
|
+
className: "mc-sr",
|
|
2694
|
+
role: "status",
|
|
2695
|
+
"aria-live": "polite",
|
|
2696
|
+
children: ut
|
|
2697
|
+
}),
|
|
2698
|
+
pt.length > 0 && /* @__PURE__ */ u("nav", {
|
|
2699
|
+
className: "mc-breadcrumb mono",
|
|
2700
|
+
"aria-label": "folder path",
|
|
2701
|
+
children: [/* @__PURE__ */ l("button", {
|
|
2702
|
+
type: "button",
|
|
2703
|
+
className: "mc-breadcrumb-crumb",
|
|
2704
|
+
onClick: mt,
|
|
2705
|
+
children: "top level"
|
|
2706
|
+
}), pt.map((t, n) => /* @__PURE__ */ u(e, { children: [/* @__PURE__ */ l(m, {
|
|
2707
|
+
className: "lucide mc-breadcrumb-sep",
|
|
2708
|
+
"aria-hidden": "true"
|
|
2709
|
+
}), n === pt.length - 1 ? /* @__PURE__ */ l("span", {
|
|
2710
|
+
className: "mc-breadcrumb-crumb mc-breadcrumb-current",
|
|
2711
|
+
"aria-current": "location",
|
|
2712
|
+
children: Kn(t.label || t.id)
|
|
2713
|
+
}) : /* @__PURE__ */ l("button", {
|
|
2714
|
+
type: "button",
|
|
2715
|
+
className: "mc-breadcrumb-crumb",
|
|
2716
|
+
onClick: () => ht(n),
|
|
2717
|
+
children: Kn(t.label || t.id)
|
|
2718
|
+
})] }, t.id))]
|
|
2719
|
+
}),
|
|
2720
|
+
/* @__PURE__ */ l("div", {
|
|
2721
|
+
className: "mc-viewport",
|
|
2722
|
+
ref: k,
|
|
2723
|
+
tabIndex: 0,
|
|
2724
|
+
role: "group",
|
|
2725
|
+
"aria-label": "map canvas: arrow keys move focus, enter selects, plus and minus zoom, ctrl or cmd plus wheel to zoom",
|
|
2726
|
+
"aria-activedescendant": O && B.has(O) ? `${D}-node-${dr(O)}` : void 0,
|
|
2727
|
+
onKeyDown: gt,
|
|
2728
|
+
onPointerDown: vt,
|
|
2729
|
+
onPointerMove: yt,
|
|
2730
|
+
onPointerUp: bt,
|
|
2731
|
+
onPointerCancel: xt,
|
|
2732
|
+
onLostPointerCapture: St,
|
|
2733
|
+
children: Tt ? /* @__PURE__ */ l("p", {
|
|
2734
|
+
className: "mc-empty mono",
|
|
2735
|
+
children: "no nodes to map"
|
|
2736
|
+
}) : /* @__PURE__ */ u(c, { children: [
|
|
2737
|
+
/* @__PURE__ */ u("div", {
|
|
2738
|
+
className: ["mc-stage", et ? "mc-stage--auto-fit" : ""].filter(Boolean).join(" "),
|
|
2739
|
+
style: {
|
|
2740
|
+
transform: `translate(${R.x}px, ${R.y}px) scale(${L})`,
|
|
2741
|
+
width: H,
|
|
2742
|
+
height: U
|
|
2743
|
+
},
|
|
2744
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
2745
|
+
className: "mc-edges",
|
|
2746
|
+
width: H,
|
|
2747
|
+
height: U,
|
|
2748
|
+
viewBox: `0 0 ${H} ${U}`,
|
|
2749
|
+
"aria-hidden": "true",
|
|
2750
|
+
children: qe.map((e) => {
|
|
2751
|
+
let t = Ge.get(e.from), n = Ge.get(e.to);
|
|
2752
|
+
if (!t || !n) return null;
|
|
2753
|
+
let r = ae[ur(e.from, e.to)] ?? ae[ur(e.from, e.to, "arrow")];
|
|
2754
|
+
return /* @__PURE__ */ l(hr, {
|
|
2755
|
+
a: t,
|
|
2756
|
+
b: n,
|
|
2757
|
+
kind: e.kind,
|
|
2758
|
+
weight: e.weight,
|
|
2759
|
+
maxWeight: Je,
|
|
2760
|
+
delta: r
|
|
2761
|
+
}, `${e.kind}:${e.from}->${e.to}`);
|
|
2762
|
+
})
|
|
2763
|
+
}), V.map((t) => {
|
|
2764
|
+
let n = (Ke.get(t.node.id) || 0) > 0, r = P.has(t.node.id);
|
|
2765
|
+
return /* @__PURE__ */ u(e, { children: [/* @__PURE__ */ l(mr, {
|
|
2766
|
+
domId: `${D}-node-${dr(t.node.id)}`,
|
|
2767
|
+
p: t,
|
|
2768
|
+
selected: F === t.node.id,
|
|
2769
|
+
focused: O === t.node.id,
|
|
2770
|
+
highlighted: Ye.has(t.node.id),
|
|
2771
|
+
delta: re[t.node.id],
|
|
2772
|
+
expandable: n,
|
|
2773
|
+
expanded: r,
|
|
2774
|
+
violations: W.get(t.node.id) || 0,
|
|
2775
|
+
onClick: (e) => {
|
|
2776
|
+
e >= 2 || (Se(t.node.id), T ? F !== t.node.id && st(t.node.id) : st(F === t.node.id ? null : t.node.id));
|
|
2777
|
+
},
|
|
2778
|
+
onDoubleClick: () => {
|
|
2779
|
+
n && ft(t.node.id);
|
|
2780
|
+
}
|
|
2781
|
+
}), n ? /* @__PURE__ */ l("button", {
|
|
2782
|
+
type: "button",
|
|
2783
|
+
className: "mc-node-disclosure",
|
|
2784
|
+
"aria-label": `${r ? "hide" : "show"} children for ${Kn(t.node.label || t.node.id)}`,
|
|
2785
|
+
"aria-expanded": r,
|
|
2786
|
+
style: {
|
|
2787
|
+
left: t.x + t.w,
|
|
2788
|
+
top: t.y + t.h
|
|
2789
|
+
},
|
|
2790
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2791
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
2792
|
+
onClick: (e) => {
|
|
2793
|
+
e.stopPropagation(), ft(t.node.id);
|
|
2794
|
+
},
|
|
2795
|
+
children: /* @__PURE__ */ l(m, { "aria-hidden": "true" })
|
|
2796
|
+
}) : null] }, t.node.id);
|
|
2797
|
+
})]
|
|
2798
|
+
}),
|
|
2799
|
+
/* @__PURE__ */ u("div", {
|
|
2800
|
+
className: "mc-zoom",
|
|
2801
|
+
role: "group",
|
|
2802
|
+
"aria-label": "map zoom",
|
|
2803
|
+
children: [
|
|
2804
|
+
/* @__PURE__ */ l("button", {
|
|
2805
|
+
type: "button",
|
|
2806
|
+
className: "mc-zoom-btn",
|
|
2807
|
+
"aria-label": "zoom in",
|
|
2808
|
+
onClick: () => at(Rn),
|
|
2809
|
+
children: /* @__PURE__ */ l(x, {
|
|
2810
|
+
className: "lucide",
|
|
2811
|
+
"aria-hidden": "true"
|
|
2812
|
+
})
|
|
2813
|
+
}),
|
|
2814
|
+
/* @__PURE__ */ l("button", {
|
|
2815
|
+
type: "button",
|
|
2816
|
+
className: "mc-zoom-btn",
|
|
2817
|
+
"aria-label": "zoom out",
|
|
2818
|
+
onClick: () => at(1 / Rn),
|
|
2819
|
+
children: /* @__PURE__ */ l(b, {
|
|
2820
|
+
className: "lucide",
|
|
2821
|
+
"aria-hidden": "true"
|
|
2822
|
+
})
|
|
2823
|
+
}),
|
|
2824
|
+
/* @__PURE__ */ l("button", {
|
|
2825
|
+
type: "button",
|
|
2826
|
+
className: "mc-zoom-btn",
|
|
2827
|
+
"aria-label": "fit map to view",
|
|
2828
|
+
onClick: () => Qe(!0),
|
|
2829
|
+
children: /* @__PURE__ */ l(ee, {
|
|
2830
|
+
className: "lucide",
|
|
2831
|
+
"aria-hidden": "true"
|
|
2832
|
+
})
|
|
2833
|
+
})
|
|
2834
|
+
]
|
|
2835
|
+
}),
|
|
2836
|
+
wt && /* @__PURE__ */ l("div", {
|
|
2837
|
+
className: "mc-minimap",
|
|
2838
|
+
"aria-hidden": "true",
|
|
2839
|
+
children: /* @__PURE__ */ u("svg", {
|
|
2840
|
+
className: "mc-minimap-svg",
|
|
2841
|
+
viewBox: `0 0 ${wt.graphW} ${wt.graphH}`,
|
|
2842
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
2843
|
+
children: [V.map((e) => /* @__PURE__ */ l("rect", {
|
|
2844
|
+
className: "mc-mini-node",
|
|
2845
|
+
"data-cov": Gn(e.node.coverage),
|
|
2846
|
+
x: e.x,
|
|
2847
|
+
y: e.y,
|
|
2848
|
+
width: e.w,
|
|
2849
|
+
height: e.h
|
|
2850
|
+
}, e.node.id)), /* @__PURE__ */ l("rect", {
|
|
2851
|
+
className: "mc-mini-view",
|
|
2852
|
+
x: wt.viewX,
|
|
2853
|
+
y: wt.viewY,
|
|
2854
|
+
width: wt.viewW,
|
|
2855
|
+
height: wt.viewH
|
|
2856
|
+
})]
|
|
2857
|
+
})
|
|
2858
|
+
}),
|
|
2859
|
+
/* @__PURE__ */ u("div", {
|
|
2860
|
+
className: "mc-legend mono",
|
|
2861
|
+
"aria-hidden": "true",
|
|
2862
|
+
children: [
|
|
2863
|
+
/* @__PURE__ */ u("span", {
|
|
2864
|
+
className: "mc-legend-item",
|
|
2865
|
+
children: [/* @__PURE__ */ l(v, { className: "lucide" }), " folder"]
|
|
2866
|
+
}),
|
|
2867
|
+
/* @__PURE__ */ u("span", {
|
|
2868
|
+
className: "mc-legend-item",
|
|
2869
|
+
children: [/* @__PURE__ */ l(_, { className: "lucide" }), " file"]
|
|
2870
|
+
}),
|
|
2871
|
+
/* @__PURE__ */ u("span", {
|
|
2872
|
+
className: "mc-legend-item mc-legend-ramp",
|
|
2873
|
+
children: [
|
|
2874
|
+
/* @__PURE__ */ l("span", {
|
|
2875
|
+
className: "mc-ramp-sw",
|
|
2876
|
+
"data-cov": "0"
|
|
2877
|
+
}),
|
|
2878
|
+
/* @__PURE__ */ l("span", {
|
|
2879
|
+
className: "mc-ramp-sw",
|
|
2880
|
+
"data-cov": "1"
|
|
2881
|
+
}),
|
|
2882
|
+
/* @__PURE__ */ l("span", {
|
|
2883
|
+
className: "mc-ramp-sw",
|
|
2884
|
+
"data-cov": "2"
|
|
2885
|
+
}),
|
|
2886
|
+
/* @__PURE__ */ l("span", {
|
|
2887
|
+
className: "mc-ramp-sw",
|
|
2888
|
+
"data-cov": "3"
|
|
2889
|
+
}),
|
|
2890
|
+
/* @__PURE__ */ l("span", {
|
|
2891
|
+
className: "mc-ramp-sw",
|
|
2892
|
+
"data-cov": "4"
|
|
2893
|
+
}),
|
|
2894
|
+
"coverage"
|
|
2895
|
+
]
|
|
2896
|
+
}),
|
|
2897
|
+
/* @__PURE__ */ u("span", {
|
|
2898
|
+
className: "mc-legend-item mc-legend-viol",
|
|
2899
|
+
children: [/* @__PURE__ */ l(ie, { className: "lucide" }), " violation"]
|
|
2900
|
+
})
|
|
2901
|
+
]
|
|
2902
|
+
})
|
|
2903
|
+
] })
|
|
2904
|
+
})
|
|
2905
|
+
]
|
|
2906
|
+
});
|
|
2907
|
+
function Dt(e) {
|
|
2908
|
+
let t = e.kind === "file" && N !== "files" ? "files" : N, n = new Set(t === N ? P : []), r = z.parentIdByChild.get(e.id);
|
|
2909
|
+
for (; r && z.byId.has(r);) n.has(r) || (n.add(r), ce?.(r)), r = z.parentIdByChild.get(r);
|
|
2910
|
+
let i = Array.from(n);
|
|
2911
|
+
T || (_e(t), ye(n)), w?.({
|
|
2912
|
+
type: "reveal",
|
|
2913
|
+
id: e.id,
|
|
2914
|
+
grain: zn[t],
|
|
2915
|
+
expandedIds: i
|
|
2916
|
+
}), t !== N && se?.(t), S?.(i), Oe(""), Ae(!1), Se(e.id), T || xe(e.id), oe?.(e.id, or(e)), window.requestAnimationFrame(() => {
|
|
2917
|
+
window.requestAnimationFrame(() => ot(e.id));
|
|
2918
|
+
});
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
function or(e) {
|
|
2922
|
+
let { _order: t, ...n } = e;
|
|
2923
|
+
return n;
|
|
2924
|
+
}
|
|
2925
|
+
function sr(e) {
|
|
2926
|
+
return e ? e instanceof Set ? new Set(e) : new Set(Array.from(e)) : /* @__PURE__ */ new Set();
|
|
2927
|
+
}
|
|
2928
|
+
function cr(e) {
|
|
2929
|
+
return Jt(e);
|
|
2930
|
+
}
|
|
2931
|
+
function $(e, t) {
|
|
2932
|
+
return Number.isFinite(e) ? e : t;
|
|
2933
|
+
}
|
|
2934
|
+
function lr(e) {
|
|
2935
|
+
return e ? Array.from(e).map(String).sort().join("\0") : "";
|
|
2936
|
+
}
|
|
2937
|
+
function ur(e, t, n = "plain") {
|
|
2938
|
+
return n === "arrow" ? `${e}->${t}` : `${e}→${t}`;
|
|
2939
|
+
}
|
|
2940
|
+
function dr(e) {
|
|
2941
|
+
return String(e).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2942
|
+
}
|
|
2943
|
+
function fr(e, t = {}) {
|
|
2944
|
+
let { selected: n, expanded: r, violations: i = 0 } = t, a = Gn(e.coverage), o = `${Kn(e.label || e.id)}: ${e.kind} · coverage ${a} of 4`;
|
|
2945
|
+
return e.loc && (o += ` · ${e.loc} loc`), i > 0 && (o += ` · ${i} violation${i === 1 ? "" : "s"}`), n && (o += " · selected"), r && (o += " · expanded"), o;
|
|
2946
|
+
}
|
|
2947
|
+
function pr(e, t, n, r, i) {
|
|
2948
|
+
if (!t) return;
|
|
2949
|
+
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;
|
|
2950
|
+
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({
|
|
2951
|
+
x: r.x + l,
|
|
2952
|
+
y: r.y + u
|
|
2953
|
+
});
|
|
2954
|
+
}
|
|
2955
|
+
function mr({ domId: e, p: t, selected: n, focused: r, highlighted: i, delta: a, expandable: o, expanded: s, violations: c, onClick: d, onDoubleClick: f }) {
|
|
2956
|
+
let p = t.node, m = Gn(p.coverage);
|
|
2957
|
+
return /* @__PURE__ */ u("button", {
|
|
2958
|
+
id: e,
|
|
2959
|
+
type: "button",
|
|
2960
|
+
className: "mc-node",
|
|
2961
|
+
"data-cov": m,
|
|
2962
|
+
"data-selected": n ? "true" : void 0,
|
|
2963
|
+
"data-focused": r ? "true" : void 0,
|
|
2964
|
+
"data-highlighted": i ? "true" : void 0,
|
|
2965
|
+
"data-delta": a || void 0,
|
|
2966
|
+
"data-ink-flip": m >= Wn ? "true" : void 0,
|
|
2967
|
+
"aria-label": fr(p, {
|
|
2968
|
+
selected: n,
|
|
2969
|
+
expanded: s,
|
|
2970
|
+
violations: c
|
|
2971
|
+
}),
|
|
2972
|
+
"aria-pressed": n,
|
|
2973
|
+
"aria-expanded": o ? s : void 0,
|
|
2974
|
+
style: {
|
|
2975
|
+
left: t.x,
|
|
2976
|
+
top: t.y,
|
|
2977
|
+
width: t.w,
|
|
2978
|
+
height: t.h
|
|
2979
|
+
},
|
|
2980
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2981
|
+
onClick: (e) => {
|
|
2982
|
+
e.stopPropagation(), d(e.detail);
|
|
2983
|
+
},
|
|
2984
|
+
onDoubleClick: (e) => {
|
|
2985
|
+
e.stopPropagation(), f();
|
|
2986
|
+
},
|
|
2987
|
+
children: [
|
|
2988
|
+
n && /* @__PURE__ */ l("span", {
|
|
2989
|
+
className: "mc-node-marker",
|
|
2990
|
+
"aria-hidden": "true"
|
|
2991
|
+
}),
|
|
2992
|
+
/* @__PURE__ */ u("span", {
|
|
2993
|
+
className: "mc-node-head",
|
|
2994
|
+
children: [
|
|
2995
|
+
p.kind === "folder" ? /* @__PURE__ */ l(v, {
|
|
2996
|
+
className: "lucide mc-node-ico",
|
|
2997
|
+
"aria-hidden": "true"
|
|
2998
|
+
}) : /* @__PURE__ */ l(_, {
|
|
2999
|
+
className: "lucide mc-node-ico",
|
|
3000
|
+
"aria-hidden": "true"
|
|
3001
|
+
}),
|
|
3002
|
+
/* @__PURE__ */ l("span", {
|
|
3003
|
+
className: "mc-node-name mono",
|
|
3004
|
+
children: Kn(p.label || p.id)
|
|
3005
|
+
}),
|
|
3006
|
+
c > 0 && /* @__PURE__ */ u("span", {
|
|
3007
|
+
className: "mc-node-viol mono tnum",
|
|
3008
|
+
"aria-hidden": "true",
|
|
3009
|
+
children: [/* @__PURE__ */ l(ie, {
|
|
3010
|
+
className: "lucide",
|
|
3011
|
+
"aria-hidden": "true"
|
|
3012
|
+
}), c]
|
|
3013
|
+
})
|
|
3014
|
+
]
|
|
3015
|
+
}),
|
|
3016
|
+
/* @__PURE__ */ u("span", {
|
|
3017
|
+
className: "mc-node-meta mono tnum",
|
|
3018
|
+
children: [
|
|
3019
|
+
p.kind === "folder" && o ? s ? "open" : "folder" : "file",
|
|
3020
|
+
p.loc ? ` · ${p.loc} loc` : "",
|
|
3021
|
+
` · cov ${m}/4`
|
|
3022
|
+
]
|
|
3023
|
+
})
|
|
3024
|
+
]
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
function hr({ a: e, b: t, kind: n, weight: r, maxWeight: i, delta: a }) {
|
|
3028
|
+
let o = e.x + e.w / 2, s = e.y + e.h, c = t.x + t.w / 2, d = t.y, f = (s + d) / 2, p = `M ${o} ${s} L ${o} ${f} L ${c} ${f} L ${c} ${d}`, m = 1 + Math.min(r, i) / i * 2;
|
|
3029
|
+
return /* @__PURE__ */ u("g", {
|
|
3030
|
+
className: "mc-edge",
|
|
3031
|
+
"data-kind": n,
|
|
3032
|
+
"data-delta": a || void 0,
|
|
3033
|
+
children: [/* @__PURE__ */ l("path", {
|
|
3034
|
+
className: "mc-edge-path",
|
|
3035
|
+
d: p,
|
|
3036
|
+
style: { strokeWidth: m }
|
|
3037
|
+
}), n === "structure" && /* @__PURE__ */ l("path", {
|
|
3038
|
+
className: "mc-edge-head",
|
|
3039
|
+
d: `M ${c - 4} ${d - 6} L ${c + 4} ${d - 6} L ${c} ${d} Z`
|
|
3040
|
+
})]
|
|
3041
|
+
});
|
|
3042
|
+
}
|
|
3043
|
+
//#endregion
|
|
3044
|
+
//#region src/ui/RailShell.jsx
|
|
3045
|
+
function gr({ toolbar: e, children: t, rail: n, railSide: i = "right", sheetTitle: a = "details", sheetMeta: o, className: c = "" }) {
|
|
3046
|
+
let [d, p] = s(!1), m = `rs-sheet-${r()}`;
|
|
3047
|
+
return /* @__PURE__ */ u("div", {
|
|
3048
|
+
className: `rs rs--${i}${c ? ` ${c}` : ""}`,
|
|
3049
|
+
"data-sheet-open": d ? "true" : "false",
|
|
3050
|
+
children: [/* @__PURE__ */ u("div", {
|
|
3051
|
+
className: "rs-frame",
|
|
3052
|
+
children: [/* @__PURE__ */ u("div", {
|
|
3053
|
+
className: "rs-main",
|
|
3054
|
+
children: [e && /* @__PURE__ */ l("div", {
|
|
3055
|
+
className: "rs-toolbar",
|
|
3056
|
+
children: e
|
|
3057
|
+
}), /* @__PURE__ */ l("div", {
|
|
3058
|
+
className: "rs-canvas",
|
|
3059
|
+
children: t
|
|
3060
|
+
})]
|
|
3061
|
+
}), /* @__PURE__ */ l("aside", {
|
|
3062
|
+
className: "rs-rail",
|
|
3063
|
+
"aria-label": a,
|
|
3064
|
+
children: /* @__PURE__ */ l("div", {
|
|
3065
|
+
className: "rs-rail-card",
|
|
3066
|
+
children: n
|
|
3067
|
+
})
|
|
3068
|
+
})]
|
|
3069
|
+
}), /* @__PURE__ */ u("div", {
|
|
3070
|
+
className: "rs-sheet",
|
|
3071
|
+
"aria-label": a,
|
|
3072
|
+
children: [/* @__PURE__ */ u("button", {
|
|
3073
|
+
type: "button",
|
|
3074
|
+
className: "rs-sheet-toggle",
|
|
3075
|
+
"aria-expanded": d,
|
|
3076
|
+
"aria-controls": m,
|
|
3077
|
+
onClick: () => p((e) => !e),
|
|
3078
|
+
children: [/* @__PURE__ */ l("span", {
|
|
3079
|
+
className: "rs-sheet-grip",
|
|
3080
|
+
"aria-hidden": "true"
|
|
3081
|
+
}), /* @__PURE__ */ u("span", {
|
|
3082
|
+
className: "rs-sheet-row",
|
|
3083
|
+
children: [/* @__PURE__ */ l("span", {
|
|
3084
|
+
className: "rs-sheet-title",
|
|
3085
|
+
children: a
|
|
3086
|
+
}), /* @__PURE__ */ u("span", {
|
|
3087
|
+
className: "rs-sheet-end",
|
|
3088
|
+
children: [o && /* @__PURE__ */ l("span", {
|
|
3089
|
+
className: "rs-sheet-meta",
|
|
3090
|
+
children: o
|
|
3091
|
+
}), /* @__PURE__ */ l(f, {
|
|
3092
|
+
className: "rs-sheet-chevron lucide",
|
|
3093
|
+
"aria-hidden": "true"
|
|
3094
|
+
})]
|
|
3095
|
+
})]
|
|
3096
|
+
})]
|
|
3097
|
+
}), /* @__PURE__ */ l("div", {
|
|
3098
|
+
id: m,
|
|
3099
|
+
role: "region",
|
|
3100
|
+
"aria-label": a,
|
|
3101
|
+
className: "rs-sheet-body",
|
|
3102
|
+
hidden: !d,
|
|
3103
|
+
children: n
|
|
3104
|
+
})]
|
|
3105
|
+
})]
|
|
3106
|
+
});
|
|
3107
|
+
}
|
|
3108
|
+
function _r({ title: e, icon: t, meta: n, children: i, collapsible: a = !1, defaultOpen: o = !0, className: d = "" }) {
|
|
3109
|
+
let [f, p] = s(o), h = `rs-sec-${r()}`, g = /* @__PURE__ */ u(c, { children: [
|
|
3110
|
+
t && /* @__PURE__ */ l(t, {
|
|
3111
|
+
className: "rs-sec-icon lucide",
|
|
3112
|
+
"aria-hidden": "true"
|
|
3113
|
+
}),
|
|
3114
|
+
e && /* @__PURE__ */ l("span", {
|
|
3115
|
+
className: "rs-sec-title",
|
|
3116
|
+
children: e
|
|
3117
|
+
}),
|
|
3118
|
+
/* @__PURE__ */ u("span", {
|
|
3119
|
+
className: "rs-sec-end",
|
|
3120
|
+
children: [n && /* @__PURE__ */ l("span", {
|
|
3121
|
+
className: "rs-sec-meta",
|
|
3122
|
+
children: n
|
|
3123
|
+
}), a && /* @__PURE__ */ l(m, {
|
|
3124
|
+
className: "rs-sec-chevron lucide",
|
|
3125
|
+
"aria-hidden": "true"
|
|
3126
|
+
})]
|
|
3127
|
+
})
|
|
3128
|
+
] });
|
|
3129
|
+
return /* @__PURE__ */ u("section", {
|
|
3130
|
+
className: `rs-sec${a ? " rs-sec--collapsible" : ""}${f ? " is-open" : ""}${d ? ` ${d}` : ""}`,
|
|
3131
|
+
children: [a ? /* @__PURE__ */ l("button", {
|
|
3132
|
+
type: "button",
|
|
3133
|
+
className: "rs-sec-head rs-sec-head--button",
|
|
3134
|
+
"aria-expanded": f,
|
|
3135
|
+
"aria-controls": h,
|
|
3136
|
+
onClick: () => p((e) => !e),
|
|
3137
|
+
children: g
|
|
3138
|
+
}) : /* @__PURE__ */ l("div", {
|
|
3139
|
+
className: "rs-sec-head",
|
|
3140
|
+
children: g
|
|
3141
|
+
}), /* @__PURE__ */ l("div", {
|
|
3142
|
+
id: a ? h : void 0,
|
|
3143
|
+
className: "rs-sec-body",
|
|
3144
|
+
hidden: a ? !f : void 0,
|
|
3145
|
+
children: i
|
|
3146
|
+
})]
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3149
|
+
function vr({ title: e, icon: t, meta: n, children: i, defaultOpen: a = !0 }) {
|
|
3150
|
+
let [o, c] = s(a), d = `rs-split-${r()}`;
|
|
3151
|
+
return /* @__PURE__ */ u("section", {
|
|
3152
|
+
className: `rs-split-panel${o ? " is-open" : ""}`,
|
|
3153
|
+
children: [/* @__PURE__ */ u("button", {
|
|
3154
|
+
type: "button",
|
|
3155
|
+
className: "rs-split-head",
|
|
3156
|
+
"aria-expanded": o,
|
|
3157
|
+
"aria-controls": d,
|
|
3158
|
+
onClick: () => c((e) => !e),
|
|
3159
|
+
children: [
|
|
3160
|
+
t && /* @__PURE__ */ l(t, {
|
|
3161
|
+
className: "rs-sec-icon lucide",
|
|
3162
|
+
"aria-hidden": "true"
|
|
3163
|
+
}),
|
|
3164
|
+
e && /* @__PURE__ */ l("span", {
|
|
3165
|
+
className: "rs-sec-title",
|
|
3166
|
+
children: e
|
|
3167
|
+
}),
|
|
3168
|
+
/* @__PURE__ */ u("span", {
|
|
3169
|
+
className: "rs-sec-end",
|
|
3170
|
+
children: [n && /* @__PURE__ */ l("span", {
|
|
3171
|
+
className: "rs-sec-meta",
|
|
3172
|
+
children: n
|
|
3173
|
+
}), /* @__PURE__ */ l(m, {
|
|
3174
|
+
className: "rs-sec-chevron lucide",
|
|
3175
|
+
"aria-hidden": "true"
|
|
3176
|
+
})]
|
|
3177
|
+
})
|
|
3178
|
+
]
|
|
3179
|
+
}), /* @__PURE__ */ l("div", {
|
|
3180
|
+
id: d,
|
|
3181
|
+
className: "rs-split-body",
|
|
3182
|
+
hidden: !o,
|
|
3183
|
+
children: i
|
|
3184
|
+
})]
|
|
3185
|
+
});
|
|
3186
|
+
}
|
|
3187
|
+
function yr({ left: e, right: t, leftTitle: n = "outline", rightTitle: r = "filters", leftIcon: i, rightIcon: a, leftMeta: o, rightMeta: s, className: c = "" }) {
|
|
3188
|
+
return /* @__PURE__ */ u("div", {
|
|
3189
|
+
className: `rs-split${c ? ` ${c}` : ""}`,
|
|
3190
|
+
children: [/* @__PURE__ */ l(vr, {
|
|
3191
|
+
title: n,
|
|
3192
|
+
icon: i,
|
|
3193
|
+
meta: o,
|
|
3194
|
+
children: e
|
|
3195
|
+
}), /* @__PURE__ */ l(vr, {
|
|
3196
|
+
title: r,
|
|
3197
|
+
icon: a,
|
|
3198
|
+
meta: s,
|
|
3199
|
+
children: t
|
|
3200
|
+
})]
|
|
3201
|
+
});
|
|
3202
|
+
}
|
|
3203
|
+
//#endregion
|
|
3204
|
+
//#region src/ui/inuse/InUseShell.jsx
|
|
3205
|
+
var br = Object.freeze([
|
|
3206
|
+
{
|
|
3207
|
+
id: "transcript",
|
|
3208
|
+
mark: "transcript-browser",
|
|
3209
|
+
icon: te
|
|
3210
|
+
},
|
|
3211
|
+
{
|
|
3212
|
+
id: "commons",
|
|
3213
|
+
mark: "village",
|
|
3214
|
+
icon: ae
|
|
3215
|
+
},
|
|
3216
|
+
{
|
|
3217
|
+
id: "graph",
|
|
3218
|
+
mark: "peasant",
|
|
3219
|
+
icon: oe
|
|
3220
|
+
}
|
|
3221
|
+
]), xr = Object.freeze([
|
|
3222
|
+
{
|
|
3223
|
+
id: "analytics",
|
|
3224
|
+
label: "analytics"
|
|
3225
|
+
},
|
|
3226
|
+
{
|
|
3227
|
+
id: "changes",
|
|
3228
|
+
label: "changes"
|
|
3229
|
+
},
|
|
3230
|
+
{
|
|
3231
|
+
id: "map",
|
|
3232
|
+
label: "code map"
|
|
3233
|
+
}
|
|
3234
|
+
]);
|
|
3235
|
+
function Sr(e) {
|
|
3236
|
+
return e && (/(INPUT|TEXTAREA|SELECT)/.test(e.tagName) || e.isContentEditable);
|
|
3237
|
+
}
|
|
3238
|
+
function Cr({ apps: e = br, defaultApp: t, activeApp: n, onAppChange: r, renderApp: i, brand: a = "fairtrade", ariaLabel: c = "the design system in use" }) {
|
|
3239
|
+
let [d, f] = s(t ?? e[0]?.id), p = n ?? d, m = o({}), h = (e) => {
|
|
3240
|
+
n === void 0 && f(e), r?.(e);
|
|
3241
|
+
}, g = e.find((e) => e.id === p) ?? e[0];
|
|
3242
|
+
return /* @__PURE__ */ u("section", {
|
|
3243
|
+
className: "iu",
|
|
3244
|
+
id: "inuse",
|
|
3245
|
+
"aria-label": c,
|
|
3246
|
+
onKeyDown: (t) => {
|
|
3247
|
+
if (Sr(t.target)) return;
|
|
3248
|
+
let n = {
|
|
3249
|
+
1: 0,
|
|
3250
|
+
2: 1,
|
|
3251
|
+
3: 2
|
|
3252
|
+
}[t.key];
|
|
3253
|
+
n != null && e[n] && (t.preventDefault(), h(e[n].id));
|
|
3254
|
+
},
|
|
3255
|
+
children: [/* @__PURE__ */ u("div", {
|
|
3256
|
+
className: "iu-bar",
|
|
3257
|
+
children: [/* @__PURE__ */ u("div", {
|
|
3258
|
+
className: "iu-bar-brand",
|
|
3259
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
3260
|
+
className: "logo",
|
|
3261
|
+
width: "18",
|
|
3262
|
+
height: "18",
|
|
3263
|
+
viewBox: "0 0 32 32",
|
|
3264
|
+
"aria-hidden": "true",
|
|
3265
|
+
children: /* @__PURE__ */ l("use", { href: "#logo" })
|
|
3266
|
+
}), /* @__PURE__ */ l("span", { children: a })]
|
|
3267
|
+
}), /* @__PURE__ */ l("div", {
|
|
3268
|
+
className: "iu-switch",
|
|
3269
|
+
role: "tablist",
|
|
3270
|
+
"aria-label": "apps",
|
|
3271
|
+
"aria-orientation": "horizontal",
|
|
3272
|
+
onKeyDown: (t) => {
|
|
3273
|
+
let n = e.map((e) => e.id), r = n.indexOf(g?.id);
|
|
3274
|
+
if (r < 0) return;
|
|
3275
|
+
let i = r;
|
|
3276
|
+
if (t.key === "ArrowRight" || t.key === "ArrowDown") i = (r + 1) % n.length;
|
|
3277
|
+
else if (t.key === "ArrowLeft" || t.key === "ArrowUp") i = (r - 1 + n.length) % n.length;
|
|
3278
|
+
else if (t.key === "Home") i = 0;
|
|
3279
|
+
else if (t.key === "End") i = n.length - 1;
|
|
3280
|
+
else return;
|
|
3281
|
+
t.preventDefault(), h(n[i]), m.current[n[i]]?.focus();
|
|
3282
|
+
},
|
|
3283
|
+
children: e.map((e, t) => {
|
|
3284
|
+
let n = e.icon, r = e.id === g?.id;
|
|
3285
|
+
return /* @__PURE__ */ u("button", {
|
|
3286
|
+
type: "button",
|
|
3287
|
+
role: "tab",
|
|
3288
|
+
id: "iu-tab-" + e.id,
|
|
3289
|
+
"aria-selected": r ? "true" : "false",
|
|
3290
|
+
"aria-controls": "inuse-stage",
|
|
3291
|
+
tabIndex: r ? 0 : -1,
|
|
3292
|
+
ref: (t) => {
|
|
3293
|
+
m.current[e.id] = t;
|
|
3294
|
+
},
|
|
3295
|
+
className: "iu-opt" + (r ? " iu-opt-on" : ""),
|
|
3296
|
+
onClick: () => h(e.id),
|
|
3297
|
+
children: [
|
|
3298
|
+
n ? /* @__PURE__ */ l("span", {
|
|
3299
|
+
className: "iu-opt-ico",
|
|
3300
|
+
children: /* @__PURE__ */ l(n, {
|
|
3301
|
+
size: 16,
|
|
3302
|
+
"aria-hidden": "true"
|
|
3303
|
+
})
|
|
3304
|
+
}) : null,
|
|
3305
|
+
/* @__PURE__ */ l("span", {
|
|
3306
|
+
className: "iu-opt-label",
|
|
3307
|
+
children: e.mark
|
|
3308
|
+
}),
|
|
3309
|
+
/* @__PURE__ */ l("span", {
|
|
3310
|
+
className: "iu-opt-key",
|
|
3311
|
+
"aria-hidden": "true",
|
|
3312
|
+
children: t + 1
|
|
3313
|
+
})
|
|
3314
|
+
]
|
|
3315
|
+
}, e.id);
|
|
3316
|
+
})
|
|
3317
|
+
})]
|
|
3318
|
+
}), /* @__PURE__ */ l("div", {
|
|
3319
|
+
className: "iu-stage",
|
|
3320
|
+
id: "inuse-stage",
|
|
3321
|
+
role: "tabpanel",
|
|
3322
|
+
"aria-labelledby": "iu-tab-" + g?.id,
|
|
3323
|
+
tabIndex: -1,
|
|
3324
|
+
children: /* @__PURE__ */ l("div", {
|
|
3325
|
+
className: "iu-screen",
|
|
3326
|
+
children: g ? i?.(g.id) : null
|
|
3327
|
+
}, g?.id)
|
|
3328
|
+
})]
|
|
3329
|
+
});
|
|
3330
|
+
}
|
|
3331
|
+
function wr({ sections: e = xr, activeId: t, activePrimaryId: n, onSectionChange: r, backTo: i, onBack: a, children: o, ariaLabel: s = "peasant sections" }) {
|
|
3332
|
+
let c = n ?? t;
|
|
3333
|
+
return /* @__PURE__ */ u("div", {
|
|
3334
|
+
className: "iu-app-root",
|
|
3335
|
+
children: [/* @__PURE__ */ u("nav", {
|
|
3336
|
+
className: "iu-subnav",
|
|
3337
|
+
"aria-label": s,
|
|
3338
|
+
children: [i ? /* @__PURE__ */ u("button", {
|
|
3339
|
+
type: "button",
|
|
3340
|
+
className: "iu-subnav-back",
|
|
3341
|
+
onClick: () => a ? a(i) : r?.(i),
|
|
3342
|
+
children: [/* @__PURE__ */ l(p, {
|
|
3343
|
+
size: 14,
|
|
3344
|
+
"aria-hidden": "true"
|
|
3345
|
+
}), " back"]
|
|
3346
|
+
}) : null, e.map((e) => /* @__PURE__ */ l("button", {
|
|
3347
|
+
type: "button",
|
|
3348
|
+
className: "iu-subnav-item" + (c === e.id ? " active" : ""),
|
|
3349
|
+
"aria-current": t === e.id ? "page" : void 0,
|
|
3350
|
+
onClick: () => r?.(e.id),
|
|
3351
|
+
children: e.label
|
|
3352
|
+
}, e.id))]
|
|
3353
|
+
}), /* @__PURE__ */ l("div", {
|
|
3354
|
+
className: "iu-view",
|
|
3355
|
+
children: o
|
|
3356
|
+
})]
|
|
3357
|
+
});
|
|
3358
|
+
}
|
|
3359
|
+
function Tr({ sections: e = xr, 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: d = null, ariaLabel: f = "peasant sections" }) {
|
|
3360
|
+
return /* @__PURE__ */ l("nav", {
|
|
3361
|
+
className: a,
|
|
3362
|
+
"aria-label": f,
|
|
3363
|
+
children: e.map((e) => {
|
|
3364
|
+
let a = t === e.id, f = o + (a && s ? " " + s : ""), p = /* @__PURE__ */ u(c, { children: [e.label, a ? d : null] }), m = n?.(e);
|
|
3365
|
+
return m && r ? /* @__PURE__ */ l(r, {
|
|
3366
|
+
href: m,
|
|
3367
|
+
className: f,
|
|
3368
|
+
"aria-current": a ? "page" : void 0,
|
|
3369
|
+
title: e.title,
|
|
3370
|
+
children: p
|
|
3371
|
+
}, e.id) : m ? /* @__PURE__ */ l("a", {
|
|
3372
|
+
href: m,
|
|
3373
|
+
className: f,
|
|
3374
|
+
"aria-current": a ? "page" : void 0,
|
|
3375
|
+
title: e.title,
|
|
3376
|
+
children: p
|
|
3377
|
+
}, e.id) : /* @__PURE__ */ l("button", {
|
|
3378
|
+
type: "button",
|
|
3379
|
+
className: f,
|
|
3380
|
+
"aria-current": a ? "page" : void 0,
|
|
3381
|
+
onClick: () => i?.(e.id),
|
|
3382
|
+
children: p
|
|
3383
|
+
}, e.id);
|
|
3384
|
+
})
|
|
3385
|
+
});
|
|
3386
|
+
}
|
|
3387
|
+
//#endregion
|
|
3388
|
+
export { z as $, Ht as A, nt as B, yt as C, Ot as D, kt as E, Vt as F, st as G, rt as H, Nt as I, et as J, ct as K, q as L, At as M, jt as N, Mt as O, Wt as P, We as Q, lt as R, bt as S, xt as T, it as U, at as V, tt as W, H as X, Xe as Y, B as Z, sn as _, we as _t, Cr as a, I as at, gt as b, yr as c, ze as ct, J as d, M as dt, Ue as et, an as f, je as ft, Jt as g, Ae as gt, cn as h, A as ht, br as i, P as it, Gt as j, Dt as k, ar as l, Ie as lt, dn as m, Pe as mt, wr as n, L as nt, _r as o, F as ot, Y as p, Me as pt, ot as q, Tr as r, Ve as rt, gr as s, Le as st, xr as t, He as tt, qt as u, Re as ut, ln as v, Ce as vt, vt as w, ht as x, _t as y, ut as z };
|