logic-atlas 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CITATION.cff +2 -2
  2. package/README.md +8 -4
  3. package/dist/case.js +1 -1
  4. package/dist/chunks/{CasePage-R2k_0lls.js → CasePage-CbCDu1FO.js} +3 -3
  5. package/dist/chunks/{CasePage-R2k_0lls.js.map → CasePage-CbCDu1FO.js.map} +1 -1
  6. package/dist/chunks/{CausalPlayground-Cd7Sok3F.js → CausalPlayground-D93D0ceE.js} +5 -5
  7. package/dist/chunks/{CausalPlayground-Cd7Sok3F.js.map → CausalPlayground-D93D0ceE.js.map} +1 -1
  8. package/dist/chunks/{CiteBlock-irdT1sjg.js → CiteBlock-DMFqM7ZM.js} +2 -2
  9. package/dist/chunks/{CiteBlock-irdT1sjg.js.map → CiteBlock-DMFqM7ZM.js.map} +1 -1
  10. package/dist/chunks/{ConservativeExtension-BX4EtG16.js → ConservativeExtension-Cofe92ak.js} +2 -2
  11. package/dist/chunks/{ConservativeExtension-BX4EtG16.js.map → ConservativeExtension-Cofe92ak.js.map} +1 -1
  12. package/dist/chunks/{ExportMenu-B5HoqaQl.js → ExportMenu-DaLZ5rBJ.js} +3 -3
  13. package/dist/chunks/{ExportMenu-B5HoqaQl.js.map → ExportMenu-DaLZ5rBJ.js.map} +1 -1
  14. package/dist/chunks/{GraphBox-Tg3kDWNT.js → GraphBox-DjjoWUU0.js} +3 -3
  15. package/dist/chunks/{GraphBox-Tg3kDWNT.js.map → GraphBox-DjjoWUU0.js.map} +1 -1
  16. package/dist/chunks/{IdentifyPanel-BVmZsWGN.js → IdentifyPanel-CoPC-Okk.js} +3 -3
  17. package/dist/chunks/{IdentifyPanel-BVmZsWGN.js.map → IdentifyPanel-CoPC-Okk.js.map} +1 -1
  18. package/dist/chunks/{ModelEditor-oAvvVqX5.js → ModelEditor-A6kk6Si5.js} +2 -2
  19. package/dist/chunks/{ModelEditor-oAvvVqX5.js.map → ModelEditor-A6kk6Si5.js.map} +1 -1
  20. package/dist/chunks/{ProbabilityPanel-8-cC68rq.js → ProbabilityPanel-DKTFYU-j.js} +5 -5
  21. package/dist/chunks/{ProbabilityPanel-8-cC68rq.js.map → ProbabilityPanel-DKTFYU-j.js.map} +1 -1
  22. package/dist/chunks/{RulesPanel-Cr6R9xCK.js → RulesPanel-B6X9O0he.js} +3 -3
  23. package/dist/chunks/{RulesPanel-Cr6R9xCK.js.map → RulesPanel-B6X9O0he.js.map} +1 -1
  24. package/dist/chunks/SignalGraph-CWPf_sG8.js +1412 -0
  25. package/dist/chunks/SignalGraph-CWPf_sG8.js.map +1 -0
  26. package/dist/chunks/{SliderList-BrILQCA4.js → SliderList-DmDURTeF.js} +2 -2
  27. package/dist/chunks/{SliderList-BrILQCA4.js.map → SliderList-DmDURTeF.js.map} +1 -1
  28. package/dist/chunks/{WorldLanes-kxYTRnB5.js → WorldLanes-DDtJZqcA.js} +2 -2
  29. package/dist/chunks/{WorldLanes-kxYTRnB5.js.map → WorldLanes-DDtJZqcA.js.map} +1 -1
  30. package/dist/chunks/{cite-B6emUIEW.js → cite-QzNc24r2.js} +2 -2
  31. package/dist/chunks/{cite-B6emUIEW.js.map → cite-QzNc24r2.js.map} +1 -1
  32. package/dist/chunks/{export-image-IsI6PVd9.js → export-image-BBHOXOis.js} +3 -3
  33. package/dist/chunks/{export-image-IsI6PVd9.js.map → export-image-BBHOXOis.js.map} +1 -1
  34. package/dist/cite.js +1 -1
  35. package/dist/editor.js +1 -1
  36. package/dist/extension.js +1 -1
  37. package/dist/ground-cases.js +767 -0
  38. package/dist/ground-cases.js.map +1 -0
  39. package/dist/ground.css +2 -0
  40. package/dist/ground.js +3829 -0
  41. package/dist/ground.js.map +1 -0
  42. package/dist/identify.js +1 -1
  43. package/dist/index.js +8 -8
  44. package/dist/lanes.js +1 -1
  45. package/dist/playground.js +1 -1
  46. package/dist/probability.js +1 -1
  47. package/dist/style.css +1 -1
  48. package/dist/types/ground/cases/index.d.ts +7 -0
  49. package/dist/types/ground/components/DiscernibilityPanel.d.ts +35 -0
  50. package/dist/types/ground/components/GroundChecker.d.ts +16 -0
  51. package/dist/types/ground/components/ProposalTable.d.ts +20 -0
  52. package/dist/types/ground/components/StructureView.d.ts +21 -0
  53. package/dist/types/ground/components/case-text.d.ts +32 -0
  54. package/dist/types/ground/components/parts.d.ts +59 -0
  55. package/dist/types/ground/components/structure-layout.d.ts +59 -0
  56. package/dist/types/ground/components/use-premises.d.ts +21 -0
  57. package/dist/types/ground/data/analyze.d.ts +41 -0
  58. package/dist/types/ground/data/case.d.ts +52 -0
  59. package/dist/types/ground/data/load.d.ts +30 -0
  60. package/dist/types/ground/data/presets.d.ts +32 -0
  61. package/dist/types/ground/data/schema.d.ts +303 -0
  62. package/dist/types/ground/engine/closure.d.ts +34 -0
  63. package/dist/types/ground/engine/discern.d.ts +84 -0
  64. package/dist/types/ground/engine/errors.d.ts +142 -0
  65. package/dist/types/ground/engine/evaluate.d.ts +25 -0
  66. package/dist/types/ground/engine/facts.d.ts +61 -0
  67. package/dist/types/ground/engine/formula.d.ts +100 -0
  68. package/dist/types/ground/engine/index.d.ts +26 -0
  69. package/dist/types/ground/engine/premises.d.ts +58 -0
  70. package/dist/types/ground/engine/print.d.ts +29 -0
  71. package/dist/types/ground/engine/proposals.d.ts +56 -0
  72. package/dist/types/ground/engine/resolve.d.ts +46 -0
  73. package/dist/types/ground/engine/syntax.d.ts +55 -0
  74. package/dist/types/ground/i18n/en.d.ts +2 -0
  75. package/dist/types/ground/i18n/messages.d.ts +14 -0
  76. package/dist/types/ground/i18n/zh.d.ts +95 -0
  77. package/dist/types/ground/index.d.ts +22 -0
  78. package/dist/types/logic/structure.d.ts +72 -0
  79. package/package.json +12 -3
  80. package/dist/chunks/SignalGraph-yoGcj7jf.js +0 -1405
  81. package/dist/chunks/SignalGraph-yoGcj7jf.js.map +0 -1
@@ -1,1405 +0,0 @@
1
- import { at as e, b as t, gt as n, vt as r, y as i } from "./engine-CO00-1sC.js";
2
- import { l as a } from "./messages-ZiFmPfDY.js";
3
- import { $ as o, S as s, W as c, Y as l, _ as u, b as d, c as f, d as p, et as m, f as h, ft as g, g as ee, h as _, i as v, it as y, l as te, m as b, o as ne, ot as re, p as x, s as ie, u as S, v as C, x as w, y as T } from "./doc-case-YauWsu0F.js";
4
- import { d as E } from "./parts-8cUsl2jJ.js";
5
- import { useId as ae, useRef as oe, useState as D } from "react";
6
- import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
7
- function j(e, n, r, a, o) {
8
- if (e.prior === void 0) throw Error(`${e.data.id}: dsep needs probabilities`);
9
- let [s, c] = n, l = [...Object.keys(a), ...Object.keys(o)], u = i(e.model, s, c, Object.keys(r), l), d = t(e.model, e.prior, s, c, r, a, o), f = (e) => `${e.from}>${e.to}`, p = new Set(u.paths.filter((e) => e.open).flatMap((e) => e.edges.map(f)));
10
- return {
11
- result: u,
12
- delta: d,
13
- marks: {
14
- open: p,
15
- blocked: new Set(u.paths.filter((e) => !e.open).flatMap((e) => e.edges.map(f)).filter((e) => !p.has(e))),
16
- ends: [s, c],
17
- paths: u.paths
18
- }
19
- };
20
- }
21
- function M(e) {
22
- return Number.isNaN(e) ? "—" : e < 1e-12 ? "0.000" : o(e, 4).replace(/(\.\d\d\d*?)0+$/, "$1");
23
- }
24
- function se(e) {
25
- return e.nodes.reduce((t, n, r) => r === 0 ? n : `${t}${e.edges[r - 1].from === e.nodes[r - 1] ? "→" : "←"}${n}`, "");
26
- }
27
- function N(e, t) {
28
- let n = e.dsep;
29
- if (!t.open) return t.kind === "collider" ? n.colliderUnknown(t.blockedBy ?? "") : n.middleKnown(t.blockedBy ?? "");
30
- let r = t.opened ?? [];
31
- return r.length === 0 ? t.nodes.length === 2 ? n.adjacent : n.middlesUnknown : e.list(r.map((e) => e.by === e.collider ? n.colliderKnown(e.collider) : n.descendantKnown(e.collider, e.by)));
32
- }
33
- function ce(e) {
34
- return e.nodes.reduce((t, n, r) => r === 0 ? n : `${t} ${e.edges[r - 1].from === e.nodes[r - 1] ? "→" : "←"} ${n}`, "");
35
- }
36
- function le(e, t) {
37
- let n = e.edgeTip, r = ce(t);
38
- if (!t.open) {
39
- let e = t.blockedBy ?? "";
40
- if (t.kind === "collider") return n.pathBlocked(r, e, n.colliderUnknown(e, t.descendants ?? []));
41
- let i = t.nodes.indexOf(e), a = i > 0 && t.edges[i - 1].from === e && t.edges[i].from === e;
42
- return n.pathBlocked(r, e, a ? n.forkKnown(e) : n.chainKnown(e));
43
- }
44
- if (t.nodes.length === 2) return n.pathOpen(r, n.adjacent);
45
- let i = t.opened ?? [], a = new Set(i.map((e) => e.collider)), o = t.nodes.slice(1, -1).filter((e) => !a.has(e)), s = [...i.map((e) => e.by === e.collider ? n.colliderKnown(e.collider) : n.descendantKnown(e.collider, e.by)), ...o.length === 0 ? [] : [n.middlesUnknown(o)]];
46
- return n.pathOpen(r, e.list(s));
47
- }
48
- function ue(e, t, n, r) {
49
- let i = t.paths.filter((e) => e.open === (r === "open") && e.edges.some((e) => `${e.from}>${e.to}` === n)), a = i.slice(0, 2).map((t) => le(e, t)), o = i.length > 2 ? [...a, e.edgeTip.more(i.length)] : a;
50
- return r === "open" ? e.edgeTip.open(o) : e.edgeTip.blocked(o);
51
- }
52
- // src/components/shared/focus-visible.ts
53
- function P(e) {
54
- try {
55
- return e.matches(":focus-visible");
56
- } catch {
57
- return !0;
58
- }
59
- }
60
- // src/components/graph/signal-shapes.ts
61
- var de = .25;
62
- function fe(e = 2) {
63
- return w(`0.${"0".repeat(e)}`, 16) + 4;
64
- }
65
- function pe(e, t, r, i, a) {
66
- return i === void 0 ? a === void 0 ? {
67
- prefix: `${e.nodeReadout.unknown} `,
68
- text: y(r ?? NaN, t),
69
- settled: !1
70
- } : {
71
- prefix: "",
72
- text: e.nodeReadout.observed(n(a)),
73
- settled: !0
74
- } : {
75
- prefix: "",
76
- text: e.nodeReadout.intervened(n(i)),
77
- settled: !0
78
- };
79
- }
80
- function me(e, t) {
81
- return (e.prefix === "" ? 0 : w(e.prefix, 11)) + (e.settled ? w(e.text, 14) + 4 : fe(t));
82
- }
83
- function F(e, t, n, r, i = 0, a = !1) {
84
- let o = e + 12, s = a ? n.lines : void 0, c = s === void 0 ? o : o + 17, l = T(i, o, "middle", s === void 0 ? n.width : Math.max(...s), 14), u = [{
85
- ...l,
86
- y1: l.y1 + c - o
87
- }], d = c, f = c, p = i, m = c, h = c, g = c;
88
- if (r.kind === "none" && (r.noteW !== void 0 || r.note2W !== void 0)) f = g + 17, h = r.noteW === void 0 ? f : f + 18, r.noteW !== void 0 && u.push(T(i, f, "middle", r.noteW, 12)), r.note2W !== void 0 && u.push(T(i, h, "middle", r.note2W + 8, 14));
89
- else if (r.kind === "number") d = g + 22, f = d + 19, u.push(T(i, d, "middle", r.numberW ?? fe(), 16)), r.noteW !== void 0 && u.push(T(i, f, "middle", r.noteW, 12));
90
- else if (r.kind === "bars") {
91
- let e = g + 10;
92
- p = i - r.width / 2, m = e + 24, f = m + 11 + 16, u.push(ee(p, e, r.width, 41)), u.push(T(p - 5, e + 8, "end", r.maxW, 11)), r.noteW !== void 0 && u.push(T(i, f, "middle", r.noteW, 12));
93
- }
94
- return {
95
- side: t,
96
- cx: i,
97
- wrapped: s !== void 0,
98
- labelY: o,
99
- label2Y: c,
100
- numberY: d,
101
- noteY: f,
102
- note2Y: h,
103
- x0: p,
104
- baseline: m,
105
- boxes: u
106
- };
107
- }
108
- function he(e, t, n) {
109
- let r = typeof t == "number" ? { width: t } : t, i = (t) => {
110
- let i = F(0, "below", r, n, 0, t), a = Math.max(...i.boxes.map((e) => e.y1)), o = Math.min(...i.boxes.map((e) => e.x0)), s = Math.max(...i.boxes.map((e) => e.x1)), c = e + 12, l = -e - 10 - a, u = -Math.max(8, a / 2), d = e + 10 - o, f = -e - 10 - s, p = e + 4;
111
- return {
112
- sides: [
113
- F(c, "below", r, n, 0, t),
114
- F(l, "above", r, n, 0, t),
115
- F(u, "right", r, n, d, t),
116
- F(u, "left", r, n, f, t)
117
- ],
118
- corners: [
119
- F(p, "below-right", r, n, p - o, t),
120
- F(p, "below-left", r, n, -p - s, t),
121
- F(-p - a, "above-right", r, n, p - o, t),
122
- F(-p - a, "above-left", r, n, -p - s, t)
123
- ]
124
- };
125
- }, a = i(!1), o = [...a.sides, ...a.corners];
126
- if (r.lines === void 0) return o;
127
- let s = i(!0), c = [...s.sides, ...s.corners];
128
- return o.flatMap((e, t) => [e, c[t]]);
129
- }
130
- function ge(e, t, n) {
131
- let r = Math.min(...e.boxes.map((e) => e.y0)), i = Math.max(...e.boxes.map((e) => e.y1)), a = e.boxes[0], o = (e, t, r) => ({
132
- x: e,
133
- y: t,
134
- anchor: r,
135
- box: T(e, t, r, n, 12)
136
- }), s = e.side === "below" || e.side.startsWith("below-") || e.side === "right" || e.side === "left", c = s ? o(e.cx, i + 13, "middle") : o(e.cx, r - 5, "middle"), l = s ? o(0, -t - 8, "middle") : o(0, t + 17, "middle");
137
- return [
138
- c,
139
- o(a.x1 + 6, e.labelY, "start"),
140
- o(a.x0 - 6, e.labelY, "end"),
141
- o(t + 8, 4, "start"),
142
- o(-t - 8, 4, "end"),
143
- l
144
- ];
145
- }
146
- function I(e) {
147
- return Math.round(e / de) * de;
148
- }
149
- function _e(e, t) {
150
- let n = t.x - e.x, r = t.y - e.y, i = Math.hypot(n, r) || 1;
151
- return {
152
- ux: n / i,
153
- uy: r / i,
154
- d: i
155
- };
156
- }
157
- function ve(e) {
158
- let t = 2 * Math.PI * e, n = t / Math.max(6, Math.round(t / 11));
159
- return `${(n * .6).toFixed(2)} ${(n * .4).toFixed(2)}`;
160
- }
161
- var ye = 4.5;
162
- function L(e, t, n) {
163
- let r = Math.hypot(t, n) || 1, i = t / r, a = n / r, o = e.x - 9 * i, s = e.y - 9 * a;
164
- return `M${e.x} ${e.y}L${o - 3.6 * a} ${s + 3.6 * i}L${o + 3.6 * a} ${s - 3.6 * i}z`;
165
- }
166
- function R(e) {
167
- let t = e + 8;
168
- return `M${-t} ${-t + 14}v-14h14M${t - 14} ${-t}h14v14M${t} ${t - 14}v14h-14M${-t + 14} ${t}h-14v-14`;
169
- }
170
- // src/components/graph/BarChart.tsx
171
- function be({ id: e, labels: t, dist: n, block: r, barText: i }) {
172
- let o = a(), s = g(), c = d(t, 11), l = (n ?? []).filter((e) => !Number.isNaN(e)), u = l.length === 0 ? NaN : Math.max(...l);
173
- return /* @__PURE__ */ A("g", {
174
- className: "ca-bars",
175
- "data-bars": e,
176
- transform: `translate(${r.x0} ${r.baseline})`,
177
- children: [
178
- /* @__PURE__ */ k("line", {
179
- x1: 0,
180
- x2: c.width,
181
- y1: 0,
182
- y2: 0,
183
- className: "ca-hair"
184
- }),
185
- !Number.isNaN(u) && /* @__PURE__ */ k("text", {
186
- x: -5,
187
- y: -16,
188
- textAnchor: "end",
189
- className: "ca-mono ca-svg-tiny ca-fill-muted",
190
- "data-max": u.toFixed(4),
191
- children: o.barMax(y(u, s))
192
- }),
193
- t.map((e, r) => {
194
- let a = n?.[r], o = a !== void 0 && !Number.isNaN(a), s = o && u > 0 && a > 0 ? Math.max(1, a / u * 24) : 0, l = r * c.pitch + c.pitch / 2, d = r === 0 || r === t.length - 1;
195
- return /* @__PURE__ */ A("g", {
196
- "data-bar": e,
197
- "data-p": o ? a.toFixed(4) : "",
198
- children: [
199
- /* @__PURE__ */ k("title", { children: i(r) }),
200
- /* @__PURE__ */ k("rect", {
201
- x: l - c.barW / 2,
202
- y: -s,
203
- width: c.barW,
204
- height: s,
205
- className: "ca-fill-fg"
206
- }),
207
- (c.labelsFit || d) && /* @__PURE__ */ k("text", {
208
- x: l,
209
- y: 13,
210
- textAnchor: "middle",
211
- className: "ca-mono ca-svg-tiny ca-fill-muted",
212
- children: e
213
- })
214
- ]
215
- }, e);
216
- })
217
- ]
218
- });
219
- }
220
- // src/components/graph/signal-geometry.ts
221
- function xe(e, t) {
222
- if ([...t].some((e) => (e.codePointAt(0) ?? 0) > 11903)) return;
223
- let n = t.split(" ").filter((e) => e !== ""), r, i = Infinity;
224
- for (let t = 1; t < n.length; t++) {
225
- if (/^[A-Za-z]{1,3}\.$/.test(n[t - 1])) continue;
226
- let a = n.slice(0, t).join(" "), o = n.slice(t).join(" "), s = Math.max(w(m(e, a), 14), w(o, 14));
227
- s < i && (r = [a, o], i = s);
228
- }
229
- return r;
230
- }
231
- var z = [
232
- [-.55, -.55],
233
- [-.55, .55],
234
- [0, -.7],
235
- [-.7, 0],
236
- [.55, -.55],
237
- [.55, .55],
238
- [0, .7],
239
- [.7, 0]
240
- ];
241
- function B(e, t, n, r, i, a, o) {
242
- let s = n.filter((e) => t.includes(e));
243
- if (s.length === 0) return r;
244
- let c = (e) => ({
245
- x: e.col * i,
246
- y: e.row * a
247
- }), l = h(e.model.edges, t).filter((e) => !n.includes(e.from)), d = (e, t, n) => Math.hypot(e.x - t.x, e.y - t.y) < n, f = (e, t) => ({
248
- x0: e.x - t,
249
- y0: e.y - t,
250
- x1: e.x + t,
251
- y1: e.y + t
252
- });
253
- for (let t of s) {
254
- let n = e.model.edges.find((e) => e.from === t)?.to, i = n === void 0 ? void 0 : r.get(n);
255
- if (n === void 0 || i === void 0) throw Error(`logic-atlas: ${e.data.id}: switch ${t} points into no drawn variable`);
256
- let a = c(i), s = (e) => {
257
- let t = c(e);
258
- for (let [e, i] of r) {
259
- if (e === n) continue;
260
- let r = c(i);
261
- if (d(t, r, 2 * o + 8) || u(t, a, f(r, o + 4))) return !1;
262
- }
263
- return l.every((e) => {
264
- let n = r.get(e.from), i = r.get(e.to);
265
- return n === void 0 || i === void 0 || !u(c(n), c(i), f(t, 19));
266
- });
267
- }, p = z.map(([e, t]) => ({
268
- col: i.col + e,
269
- row: i.row + t
270
- }));
271
- r.set(t, p.find(s) ?? p[0]);
272
- }
273
- return r;
274
- }
275
- function Se(t, i) {
276
- let { c: a, shown: o, values: s, original: c, probs: g, probe: E = {}, dists: ae, probNotes: oe, interventions: D, tagText: O, stochastic: k, removedEdges: A, witness: j, observedValues: M, evidence: se, holdNotes: N, defaults: ce, paths: le, clamped: ue, switches: P = [], compact: de, drag: fe, digits: F = 2 } = t, I = g !== void 0, { r: ve, col: ye, row: L } = f(I, de), R = t.structural === !0 ? 19 : ve, be = de ? 60 : 96, z = B(a, o, P, te(a, o.filter((e) => !P.includes(e))), ye, L, R), Se = [...z.values()], V = Math.min(...Se.map((e) => e.col)), Ce = Math.max(...Se.map((e) => e.col)), H = Math.min(...Se.map((e) => e.row)), we = Math.max(...Se.map((e) => e.row)), Te = be * 2 + (Ce - V) * ye, Ee = j !== void 0 && Object.keys(j).length > 0, De = (t) => I && e(a.model, t).domain.kind === "finite", Oe = 144 + (we - H) * L + (Ee ? 40 : 0), U = /* @__PURE__ */ new Map();
277
- for (let [e, t] of z) {
278
- let n = fe?.id === e ? fe : void 0;
279
- U.set(e, {
280
- x: be + (t.col - V) * ye + (n?.dx ?? 0),
281
- y: 72 + (t.row - H) * L + (n?.dy ?? 0)
282
- });
283
- }
284
- let ke = new Set(A.map((e) => `${e.from}>${e.to}`)), Ae = h(a.model.edges, o), je = (e) => re(a.model, e, i.locale), W = (e) => {
285
- let t = U.get(e.from), n = U.get(e.to);
286
- if (t === void 0 || n === void 0) return;
287
- let { ux: r, uy: i } = _e(t, n), o = P.includes(e.from) ? 9 / Math.max(Math.abs(r), Math.abs(i)) : R, s = `${e.from}>${e.to}`, c = ke.has(s) ? "cut" : ie(a.model, e.from, e.to) === "inhibit" ? "inhibit" : "plain", l = c === "inhibit" ? R + 7 : R + 2;
288
- return {
289
- kind: c,
290
- key: s,
291
- a: t,
292
- b: n,
293
- ux: r,
294
- uy: i,
295
- x1: t.x + o * r,
296
- y1: t.y + o * i,
297
- x2: n.x - l * r,
298
- y2: n.y - l * i
299
- };
300
- }, G = (e) => {
301
- let t = D[e], a = k[e], o = M[e];
302
- if (t === void 0 && a === void 0 && (o === void 0 || se) || j !== void 0 && e in j) return;
303
- let s = c?.[e], l = N && t !== void 0 && s !== void 0 && r(t, s), u = t === void 0 ? a === void 0 ? `${e}=${n(o)}` : `P(${e}=1)=${y(a, F)}` : O?.[e] ?? (l ? i.witness.resetTag(e, n(t)) : `${e}←${n(t)}`), d = w(u, 12) + 18, f = (z.get(e)?.col ?? 0) === Ce;
304
- return {
305
- text: u,
306
- left: f,
307
- reset: l,
308
- seen: t === void 0 && a === void 0,
309
- box: ee(f ? -R - 12 - d : R + 12, -R - 10, d, 22)
310
- };
311
- }, Me = (e) => {
312
- if (!N || j === void 0 || !(e in j)) return;
313
- if (I) return i.witness.heldPlain;
314
- let t = c?.[e], a = s?.[e] ?? j[e];
315
- return t === void 0 || r(t, a) ? i.witness.heldActual : i.witness.held(n(a), n(t));
316
- }, Ne = (e) => {
317
- let t = ce?.[e], a = s?.[e];
318
- if (!(I || t === void 0 || a === void 0 || r(a, t))) return i.normality.deviant(n(t));
319
- }, Pe = [], K = /* @__PURE__ */ new Map(), Fe = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), Ie = /* @__PURE__ */ new Map(), Le = [], Re = [];
320
- for (let e of o) {
321
- let t = U.get(e);
322
- if (t === void 0) continue;
323
- Le.push(x(t.x, t.y, (P.includes(e) ? 9 : R) + 3));
324
- let n = G(e);
325
- n !== void 0 && (Le.push(C(n.box, t.x, t.y)), Re.push(C(n.box, t.x, t.y)));
326
- }
327
- let J = (e, t) => ke.has(`${e}>${t}`) || t in D || t in k || ue.includes(t), ze = p(S(a, o).filter((e) => !J(e.via, e.a) && !J(e.via, e.b)), U, Ae, R, Re), Be = ze.map((e) => v(e.start, e.control, e.end, 12)), Ve = [], Y = [], He = (e, t, n, r) => {
328
- let i = {
329
- x: e.x + r * t,
330
- y: e.y + r * n
331
- }, a = {
332
- x: e.x - 10 * t,
333
- y: e.y - 10 * n
334
- };
335
- Y.push({
336
- x0: Math.min(i.x, a.x) - 5,
337
- y0: Math.min(i.y, a.y) - 5,
338
- x1: Math.max(i.x, a.x) + 5,
339
- y1: Math.max(i.y, a.y) + 5
340
- });
341
- };
342
- for (let e of Ae) {
343
- let t = W(e);
344
- if (t === void 0) continue;
345
- let { x1: n, y1: r, x2: i, y2: a, ux: o, uy: s } = t;
346
- if (t.kind === "cut") {
347
- let e = (n + i) / 2, t = (r + a) / 2;
348
- Ve.push([{
349
- x: n,
350
- y: r
351
- }, {
352
- x: e - 10 * o,
353
- y: t - 10 * s
354
- }], [{
355
- x: e + 10 * o,
356
- y: t + 10 * s
357
- }, {
358
- x: i,
359
- y: a
360
- }]);
361
- } else Ve.push([{
362
- x: n,
363
- y: r
364
- }, {
365
- x: i,
366
- y: a
367
- }]), He({
368
- x: i,
369
- y: a
370
- }, o, s, t.kind === "inhibit" ? 10 : 0);
371
- }
372
- for (let e of ze) {
373
- let t = v(e.start, e.control, e.end, 40);
374
- for (let e = 0; e + 1 < t.length; e++) Ve.push([t[e], t[e + 1]]);
375
- for (let [t, n] of [[e.start, e.control], [e.end, e.control]]) {
376
- let { ux: e, uy: r } = _e(n, t);
377
- He(t, e, r, 0);
378
- }
379
- }
380
- let Ue = (e) => {
381
- let t = {
382
- x0: e.x0 - 1,
383
- y0: e.y0 - 1,
384
- x1: e.x1 + 1,
385
- y1: e.y1 + 1
386
- };
387
- return Ve.filter(([e, n]) => u(e, n, t)).length + Y.filter((e) => _(t, e, 0)).length;
388
- }, We = (e) => P.includes(e) ? 9 : R, Ge = (e, t) => {
389
- let n = {
390
- x0: Math.min(...t.map((e) => e.x0)),
391
- y0: Math.min(...t.map((e) => e.y0)),
392
- x1: Math.max(...t.map((e) => e.x1)),
393
- y1: Math.max(...t.map((e) => e.y1))
394
- }, r = (e, t) => Math.hypot(Math.max(n.x0 - e.x, 0, e.x - n.x1), Math.max(n.y0 - e.y, 0, e.y - n.y1)) - t, i = r(U.get(e) ?? {
395
- x: 0,
396
- y: 0
397
- }, We(e));
398
- return o.some((t) => {
399
- let n = U.get(t);
400
- return t !== e && n !== void 0 && r(n, We(t)) < i + 12;
401
- });
402
- }, Ke = (e, t, n) => {
403
- let r = U.get(e) ?? {
404
- x: 0,
405
- y: 0
406
- }, i = 0, a = 0, o = 0;
407
- t.boxes.forEach((e, t) => {
408
- let s = C(e, r.x, r.y), c = Ue(s);
409
- t === 0 ? a += c : o += c;
410
- for (let e of Le) _(s, e, 0) && (i += 1);
411
- for (let e of n) _(s, e, 10) && (i += 1);
412
- });
413
- let s = t.boxes.map((e) => C(e, r.x, r.y));
414
- Ge(e, s) && (i += 1);
415
- let c = Math.max(0, -Math.min(...s.map((e) => e.x0))) + Math.max(0, Math.max(...s.map((e) => e.x1)) - Te) + Math.max(0, -Math.min(...s.map((e) => e.y0))) + Math.max(0, Math.max(...s.map((e) => e.y1)) - Oe);
416
- return [
417
- i,
418
- a,
419
- o,
420
- Math.floor(c / 48) + +!!t.side.includes("-")
421
- ];
422
- }, qe = (e) => e[0] === 0 && e[1] === 0 && e[2] === 0, Je = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Map();
423
- for (let l of o) {
424
- let o = U.get(l);
425
- if (o === void 0) continue;
426
- let u = e(a.model, l), f = I ? pe(i, F, g?.[l], D[l], se ? void 0 : M[l]) : void 0, p = c?.[l], h = s?.[l], ee = N && !I && p !== void 0 && h !== void 0 && !r(p, h) ? i.was(n(p)) : void 0, _ = Me(l) ?? ee ?? (f?.settled === !0 && !se ? void 0 : oe?.[l]), v = _ === void 0 ? void 0 : w(_, 12), te = Ne(l), b = {
427
- kind: "none",
428
- noteW: v,
429
- note2W: te === void 0 ? void 0 : w(te, 11)
430
- };
431
- if (De(l) && u.domain.kind === "finite") {
432
- let e = (ae?.[l] ?? []).filter((e) => !Number.isNaN(e)), t = e.length === 0 ? 0 : w(i.barMax(y(Math.max(...e), F)), 11);
433
- b = {
434
- kind: "bars",
435
- width: d(u.domain.values.map(n), 11).width,
436
- maxW: t,
437
- noteW: v
438
- };
439
- } else I ? b = {
440
- kind: "number",
441
- noteW: v,
442
- numberW: me(f ?? pe(i, F, void 0, void 0, void 0), F)
443
- } : l in E && (b = {
444
- kind: "number",
445
- noteW: v,
446
- numberW: me(pe(i, F, E[l], void 0, void 0), F)
447
- });
448
- let ne = P.includes(l), re = w(ne ? l : m(l, je(l)), 14), x = ne ? void 0 : xe(l, je(l)), ie = x === void 0 ? void 0 : [w(m(l, x[0]), 14), w(x[1], 14)], S = he(ne ? 9 : R + (t.hedge?.fPrime.includes(l) === !0 ? 16 : t.hedge?.f.includes(l) === !0 ? 9 : 0), {
449
- width: re,
450
- lines: ie
451
- }, b);
452
- Fe.set(l, S);
453
- let T = S.map((e) => Ke(l, e, Pe)), O = 0;
454
- if (!qe(T[0])) for (let e = 1; e < S.length; e++) (T[e].map((e, t) => e - T[O][t]).find((e) => e !== 0) ?? 0) < 0 && (O = e);
455
- let k = S[O];
456
- K.set(l, k), x !== void 0 && Je.set(l, x), ee !== void 0 && v !== void 0 && Me(l) === void 0 && Ye.set(l, {
457
- text: ee,
458
- w: v
459
- });
460
- for (let e of k.boxes) Pe.push(C(e, o.x, o.y));
461
- }
462
- let Xe = /* @__PURE__ */ new Map();
463
- for (let e of o) {
464
- let t = U.get(e);
465
- t === void 0 || P.includes(e) || Xe.set(Math.round(t.x), [...Xe.get(Math.round(t.x)) ?? [], e]);
466
- }
467
- for (let e of Xe.values()) {
468
- if (e.length < 3 || new Set(e.map((e) => K.get(e)?.side)).size === 1) continue;
469
- let t = o.filter((t) => !e.includes(t)).flatMap((e) => {
470
- let t = U.get(e);
471
- return t === void 0 ? [] : (K.get(e)?.boxes ?? []).map((e) => C(e, t.x, t.y));
472
- }), n;
473
- for (let [r, i] of [
474
- "below",
475
- "above",
476
- "right",
477
- "left"
478
- ].flatMap((e) => [[e, !1], [e, !0]])) {
479
- let a = [...t], o = /* @__PURE__ */ new Map(), s = 0;
480
- for (let t of e) {
481
- let e = U.get(t) ?? {
482
- x: 0,
483
- y: 0
484
- }, n = (Fe.get(t) ?? []).filter((e) => e.side === r), c = n.find((e) => e.wrapped === i) ?? n[0];
485
- if (c === void 0 || !qe(Ke(t, c, a))) break;
486
- o.set(t, c), s += Ke(t, c, a)[3], a.push(...c.boxes.map((t) => C(t, e.x, e.y)));
487
- }
488
- o.size === e.length && (n === void 0 || s < n.past) && (n = {
489
- chosen: o,
490
- past: s
491
- });
492
- }
493
- for (let [e, t] of n?.chosen ?? []) K.set(e, t);
494
- }
495
- Pe.length = 0;
496
- for (let e of o) {
497
- let t = U.get(e), n = K.get(e);
498
- if (t === void 0 || n === void 0) continue;
499
- for (let e of n.boxes) Pe.push(C(e, t.x, t.y));
500
- let r = Je.get(e);
501
- n.wrapped && r !== void 0 && q.set(e, r);
502
- let i = Ye.get(e);
503
- i !== void 0 && Ie.set(e, {
504
- text: i.text,
505
- x: n.cx,
506
- y: n.noteY,
507
- anchor: "middle",
508
- box: T(n.cx, n.noteY, "middle", i.w, 12)
509
- });
510
- }
511
- if (!N && !I) {
512
- let e = o.flatMap((e) => {
513
- let t = U.get(e), n = G(e);
514
- return t === void 0 || n === void 0 ? [] : [C(n.box, t.x, t.y)];
515
- }), t = [...Pe, ...e], a = o.flatMap((e) => {
516
- let t = U.get(e);
517
- return t === void 0 ? [] : [x(t.x, t.y, (P.includes(e) ? 9 : R) + 3)];
518
- }), l = (e) => Ae.some((t) => {
519
- let n = U.get(t.from), r = U.get(t.to);
520
- return n !== void 0 && r !== void 0 && u(n, r, e);
521
- }) || Be.some((t) => t.some((n, r) => r + 1 < t.length && u(n, t[r + 1], e)));
522
- for (let e of o) {
523
- let o = U.get(e), u = K.get(e), d = c?.[e], f = s?.[e];
524
- if (o === void 0 || u === void 0 || d === void 0 || f === void 0 || r(d, f)) continue;
525
- let p = i.was(n(d)), m = ge(u, R, w(p, 12)).map((e) => ({
526
- ...e,
527
- abs: C(e.box, o.x, o.y)
528
- })), h = m.filter(({ abs: e }) => !t.some((t) => _(e, t)) && !a.some((t) => _(e, t, 0))), g = h.find(({ abs: e }) => !l(e)) ?? h[0] ?? m[0];
529
- Ie.set(e, {
530
- text: p,
531
- x: g.x,
532
- y: g.y,
533
- anchor: g.anchor,
534
- box: g.box
535
- }), t.push(g.abs), Pe.push(g.abs);
536
- }
537
- }
538
- let Ze = (e) => o.some((t) => {
539
- let n = U.get(t);
540
- if (!n) return !1;
541
- if (P.includes(t)) return _(e, x(n.x, n.y, 9), 0);
542
- let r = Math.max(e.x0 - n.x, 0, n.x - e.x1), i = Math.max(e.y0 - n.y, 0, n.y - e.y1);
543
- return r * r + i * i <= R * R;
544
- }), Qe = [...Pe];
545
- for (let e of o) {
546
- let t = U.get(e);
547
- if (t === void 0) continue;
548
- let n = [x(0, 0, (P.includes(e) ? 9 : R) + 6)], r = G(e);
549
- r !== void 0 && n.push(r.box);
550
- for (let e of n) Qe.push(C(e, t.x, t.y));
551
- }
552
- let $e = w(i.arc.label, 12), et = ze.map((e) => {
553
- let t = v(e.start, e.control, e.end, 40), n = [];
554
- for (let r of [1, -1]) for (let i of [
555
- 20,
556
- 16,
557
- 24,
558
- 12,
559
- 28
560
- ]) {
561
- let a = t[i], o = e.bulge.x * r, s = e.bulge.y * r, c = 8 + $e / 2 * Math.abs(o) + Math.abs(s) * 7, l = a.x + o * c, u = a.y + s * c + 4;
562
- n.push({
563
- x: l,
564
- y: u,
565
- anchor: "middle",
566
- box: T(l, u, "middle", $e, 12)
567
- });
568
- }
569
- let r = n.filter((e) => Ae.every((t) => {
570
- let n = U.get(t.from), r = U.get(t.to);
571
- return n === void 0 || r === void 0 || !u(n, r, e.box);
572
- })), i = b(r.length > 0 ? r : n, Qe);
573
- return Qe.push(i.box), {
574
- plan: e,
575
- curve: t,
576
- label: i
577
- };
578
- });
579
- for (let { curve: e } of et) for (let t = 0; t + 1 < e.length; t += 2) {
580
- let [n, r] = [e[t], e[Math.min(t + 2, e.length - 1)]];
581
- Qe.push({
582
- x0: Math.min(n.x, r.x) - 2,
583
- y0: Math.min(n.y, r.y) - 2,
584
- x1: Math.max(n.x, r.x) + 2,
585
- y1: Math.max(n.y, r.y) + 2
586
- });
587
- }
588
- let X = 0, Z = Oe, Q = 0, $ = Te;
589
- for (let e of o) {
590
- let t = U.get(e), n = K.get(e);
591
- if (t !== void 0 && n !== void 0) for (let e of n.boxes) X = Math.min(X, t.y + e.y0 - 8), Z = Math.max(Z, t.y + e.y1 + 12), Q = Math.min(Q, t.x + e.x0 - 8), $ = Math.max($, t.x + e.x1 + 8);
592
- }
593
- for (let [e, t] of Ie) {
594
- let n = U.get(e);
595
- n !== void 0 && (X = Math.min(X, n.y + t.box.y0 - 8), Z = Math.max(Z, n.y + t.box.y1 + 12), Q = Math.min(Q, n.x + t.box.x0 - 8), $ = Math.max($, n.x + t.box.x1 + 8));
596
- }
597
- for (let { curve: e, label: t } of et) {
598
- for (let t of e) X = Math.min(X, t.y - 8), Z = Math.max(Z, t.y + 12), Q = Math.min(Q, t.x - 8), $ = Math.max($, t.x + 8);
599
- X = Math.min(X, t.box.y0 - 6), Z = Math.max(Z, t.box.y1 + 8), Q = Math.min(Q, t.box.x0 - 8), $ = Math.max($, t.box.x1 + 8);
600
- }
601
- X = Math.floor(X), Q = Math.floor(Q);
602
- let tt = (e) => (Qe.push(e.box), e), nt = [];
603
- for (let e of Ae) {
604
- let t = W(e);
605
- if (t === void 0) continue;
606
- let { a: n, b: r, ux: a, uy: o, x1: c, y1: l, x2: d, y2: f, key: p } = t;
607
- if (t.kind === "cut") {
608
- let e = (c + d) / 2, t = (l + f) / 2, n = -o, r = a, s = (e, t) => `M${e - 10 * n - 3 * a} ${t - 10 * r - 3 * o}L${e + 10 * n + 3 * a} ${t + 10 * r + 3 * o}`, m = [];
609
- for (let n of [18, 28]) for (let r of [1, -1]) {
610
- let s = e + r * n * o, c = t - r * n * a + 4, l = r * o > .3 ? "start" : r * o < -.3 ? "end" : "middle";
611
- m.push({
612
- x: s,
613
- y: c,
614
- anchor: l,
615
- box: T(s, c, l, w(i.cut, 12), 12)
616
- });
617
- }
618
- let h = m.filter((e) => Ae.every((t) => {
619
- let n = U.get(t.from), r = U.get(t.to);
620
- return ke.has(`${t.from}>${t.to}`) || n === void 0 || r === void 0 || !u(n, r, e.box);
621
- })), g = tt(b(h.length > 0 ? h : m, Qe));
622
- nt.push({
623
- kind: "cut",
624
- key: p,
625
- x1: c,
626
- y1: l,
627
- x2: d,
628
- y2: f,
629
- mx: e,
630
- my: t,
631
- ux: a,
632
- uy: o,
633
- slash: s(e - 4 * a, t - 4 * o) + s(e + 4 * a, t + 4 * o),
634
- label: g
635
- });
636
- continue;
637
- }
638
- let m = ne(s, e.from), h = le?.open.has(p) === !0 ? "open" : le?.blocked.has(p) === !0 ? "blocked" : void 0, g = `${m ? "ca-stroke-live" : "ca-stroke-idle"}${h === void 0 ? "" : ` ca-path-${h}`}`;
639
- if (t.kind === "inhibit") {
640
- let t = `¬${e.from}`, i = w(t, 12), s = [];
641
- {
642
- let e = n.x + (r.x - n.x) * .55 + 14 * Math.abs(o) + 4, t = n.y + (r.y - n.y) * .55 - 12 * Math.abs(a);
643
- s.push({
644
- x: e,
645
- y: t,
646
- anchor: "start",
647
- box: T(e, t, "start", i, 12)
648
- });
649
- }
650
- for (let e of [
651
- .55,
652
- .45,
653
- .65,
654
- .35,
655
- .72,
656
- .28
657
- ]) for (let t of [1, -1]) {
658
- let c = -o * t, l = a * t, u = 8 + i / 2 * Math.abs(c) + Math.abs(l) * 7, d = n.x + (r.x - n.x) * e + c * u, f = n.y + (r.y - n.y) * e + l * u, p = d - i / 2, m = f + 4;
659
- s.push({
660
- x: p,
661
- y: m,
662
- anchor: "start",
663
- box: T(p, m, "start", i, 12)
664
- });
665
- }
666
- let ee = (e) => !u({
667
- x: c,
668
- y: l
669
- }, {
670
- x: d,
671
- y: f
672
- }, e.box) && !Ze(e.box), v = b(s, Qe), y = ee(v) ? v : void 0, te = Infinity;
673
- for (let e = 0; y === void 0; e++) for (let t of e === 0 ? [0] : [-24 * e, 24 * e]) {
674
- for (let e of s) {
675
- let n = t === 0 ? e : {
676
- ...e,
677
- y: e.y + t,
678
- box: C(e.box, 0, t)
679
- };
680
- if (!ee(n)) continue;
681
- let r = Qe.filter((e) => _(n.box, e)).length;
682
- if (r < te && (y = n, te = r), r === 0) break;
683
- }
684
- if (te === 0) break;
685
- }
686
- let ne = tt(y);
687
- y !== v && (Q = Math.min(Q, Math.floor(y.box.x0)), $ = Math.max($, y.box.x1), X = Math.min(X, Math.floor(y.box.y0)), Z = Math.max(Z, y.box.y1)), nt.push({
688
- kind: "inhibit",
689
- key: p,
690
- x1: c,
691
- y1: l,
692
- x2: d,
693
- y2: f,
694
- ux: a,
695
- uy: o,
696
- live: m,
697
- onPath: h,
698
- cls: g,
699
- text: t,
700
- label: ne
701
- });
702
- } else nt.push({
703
- kind: "plain",
704
- key: p,
705
- x1: c,
706
- y1: l,
707
- x2: d,
708
- y2: f,
709
- live: m,
710
- onPath: h,
711
- cls: g
712
- });
713
- }
714
- let rt;
715
- if (j !== void 0 && Object.keys(j).length > 0) {
716
- let e = Object.keys(j).map((e) => U.get(e)).filter((e) => e !== void 0);
717
- if (e.length > 0) {
718
- let t = R + 14, n = N ? Object.keys(j).flatMap((e) => {
719
- let t = U.get(e);
720
- return t === void 0 ? [] : (K.get(e)?.boxes ?? []).map((e) => C(e, t.x, t.y));
721
- }) : [], r = Math.min(...e.map((e) => e.x - t - 20), ...n.map((e) => e.x0 - 5)), a = Math.min(...e.map((e) => e.y - t), ...n.map((e) => e.y0 - 5));
722
- rt = {
723
- x: r,
724
- y: a,
725
- w: Math.max(...e.map((e) => e.x + t + 20), ...n.map((e) => e.x1 + 5)) - r,
726
- h: Math.max(...e.map((e) => e.y + R + (N ? 10 : 34)), ...n.map((e) => e.y1 + 5)) - a,
727
- text: i.witnessHold(l(j))
728
- };
729
- }
730
- }
731
- let it = /* @__PURE__ */ new Map(), at = /* @__PURE__ */ new Map(), ot = /* @__PURE__ */ new Map();
732
- for (let e of o) {
733
- let t = G(e);
734
- t !== void 0 && it.set(e, t);
735
- let n = Me(e);
736
- n !== void 0 && at.set(e, n);
737
- let r = Ne(e);
738
- r !== void 0 && ot.set(e, r);
739
- }
740
- return {
741
- prob: I,
742
- r: R,
743
- col: ye,
744
- row: L,
745
- pos: U,
746
- blocks: K,
747
- labelOptions: Fe,
748
- labelLines: q,
749
- tags: it,
750
- holdNotes: at,
751
- deviantNotes: ot,
752
- wasNotes: Ie,
753
- edges: nt,
754
- arcs: et,
755
- hull: rt,
756
- left: Q,
757
- top: X,
758
- width: Math.ceil($ - Q),
759
- height: Math.ceil(Z - X)
760
- };
761
- }
762
- // src/components/graph/use-node-gestures.ts
763
- var V = {
764
- ArrowLeft: [-.5, 0],
765
- ArrowRight: [.5, 0],
766
- ArrowUp: [0, -.5],
767
- ArrowDown: [0, .5]
768
- };
769
- function Ce(e, t) {
770
- let [n, r] = D(void 0), i = oe(0), a = (t) => {
771
- let n = e.current?.getScreenCTM?.();
772
- if (n == null) return {
773
- x: t.clientX,
774
- y: t.clientY
775
- };
776
- let r = n.inverse();
777
- return {
778
- x: r.a * t.clientX + r.c * t.clientY + r.e,
779
- y: r.b * t.clientX + r.d * t.clientY + r.f
780
- };
781
- }, o = (e, n) => {
782
- if (t === void 0 || n.button !== 0) return;
783
- let i = a(n);
784
- r({
785
- id: e,
786
- pointer: n.pointerId,
787
- x0: i.x,
788
- y0: i.y,
789
- dx: 0,
790
- dy: 0,
791
- moved: !1
792
- });
793
- };
794
- return {
795
- drag: n,
796
- moveDrag: (t) => {
797
- if (n === void 0 || t.pointerId !== n.pointer) return;
798
- let i = a(t), o = i.x - n.x0, s = i.y - n.y0, c = n.moved || Math.hypot(o, s) > 4;
799
- c && !n.moved && e.current?.setPointerCapture?.(t.pointerId), r({
800
- ...n,
801
- dx: o,
802
- dy: s,
803
- moved: c
804
- });
805
- },
806
- endDrag: (e, a, o) => {
807
- if (n === void 0 || e.pointerId !== n.pointer || (r(void 0), !n.moved)) return;
808
- i.current = Date.now() + 400;
809
- let s = I(n.dx / a), c = I(n.dy / o);
810
- (s !== 0 || c !== 0) && t?.(n.id, s, c);
811
- },
812
- cancelDrag: () => r(void 0),
813
- nodeHandlers: (e, n) => ({
814
- onClick: () => {
815
- Date.now() < i.current || n();
816
- },
817
- onKeyDown: (r) => {
818
- if (r.key === "Enter" || r.key === " ") {
819
- r.preventDefault(), n();
820
- return;
821
- }
822
- let i = V[r.key];
823
- t !== void 0 && i !== void 0 && (r.preventDefault(), t(e, i[0], i[1]));
824
- },
825
- onPointerDown: (t) => o(e, t)
826
- })
827
- };
828
- }
829
- // src/components/graph/SignalGraph.tsx
830
- function H(t) {
831
- let { c: i, shown: o, structural: l = !1, hedge: u, values: d, original: f, probs: p, probe: h = {}, dists: ee, probNotes: _, observed: v = [], interventions: te, tagText: b, stochastic: ne = {}, removedEdges: x, witness: ie, onMove: S, observedValues: C = {}, evidence: T = !1, holdNotes: D = !1, defaults: j, paths: M, clamped: se = [], testClamped: N = [], switches: ce = [], nodeNotes: le = {}, onPick: de, pickable: fe, pickHint: me, fresh: F = [], onOpen: he, observable: ge = !1, open: I, lit: _e = [], onHover: xe, edgeTip: z, onEdgeTip: B } = t, V = a(), H = g(), we = ae().replace(/[^a-zA-Z0-9_-]/g, ""), Te = oe(null), { drag: Ee, moveDrag: De, endDrag: Oe, cancelDrag: U, nodeHandlers: ke } = Ce(Te, S), Ae = (e) => xe === void 0 ? {} : {
832
- onPointerEnter: (t) => t.pointerType !== "touch" && xe(e),
833
- onPointerLeave: (e) => e.pointerType !== "touch" && xe(void 0),
834
- onFocus: (t) => P(t.currentTarget) && xe(e),
835
- onBlur: () => xe(void 0)
836
- }, je = Se({
837
- c: i,
838
- shown: o,
839
- structural: l,
840
- values: d,
841
- original: f,
842
- probs: p,
843
- probe: h,
844
- dists: ee,
845
- probNotes: _,
846
- observedValues: C,
847
- evidence: T,
848
- interventions: te,
849
- tagText: b,
850
- stochastic: ne,
851
- removedEdges: x,
852
- witness: ie,
853
- hedge: u,
854
- holdNotes: D,
855
- defaults: j,
856
- paths: M,
857
- clamped: [...se, ...N],
858
- switches: ce,
859
- compact: t.compact === !0,
860
- drag: Ee,
861
- digits: H
862
- }, V), { prob: W, r: G, col: Me, row: Ne, pos: Pe, blocks: K, arcs: Fe, hull: q, left: Ie, top: Le, width: Re, height: J } = je, ze = (t) => W && e(i.model, t).domain.kind === "finite", Be = (e) => re(i.model, e, V.locale), Ve = oe("mouse"), Y = (e, t) => t === void 0 || B === void 0 ? {} : {
863
- tabIndex: 0,
864
- role: "img",
865
- "aria-label": t,
866
- "data-tip": z === e ? "open" : void 0,
867
- onPointerEnter: (n) => n.pointerType !== "touch" && B({
868
- key: e,
869
- text: t
870
- }),
871
- onPointerLeave: (e) => e.pointerType !== "touch" && B(void 0),
872
- onPointerDown: (e) => {
873
- Ve.current = e.pointerType;
874
- },
875
- onFocus: (n) => P(n.currentTarget) && B({
876
- key: e,
877
- text: t
878
- }),
879
- onBlur: () => B(void 0),
880
- onClick: () => B(Ve.current === "touch" && z === e ? void 0 : {
881
- key: e,
882
- text: t
883
- })
884
- }, He = (e, t) => t === void 0 || M === void 0 ? void 0 : ue(V, M, e, t), Ue = (e, t, n, r, i, a) => a === void 0 || B === void 0 ? null : /* @__PURE__ */ k("line", {
885
- x1: t,
886
- y1: n,
887
- x2: r,
888
- y2: i,
889
- className: "ca-edge-hit"
890
- }, `${e}-hit`), We = (e) => u?.f.includes(e) === !0, Ge = (e) => e.cx === 0 ? void 0 : e.cx, Ke = je.edges.map((e) => {
891
- if (e.kind === "cut") {
892
- let { key: t, x1: n, y1: r, x2: i, y2: a, mx: o, my: s, ux: c, uy: l, label: u } = e, [d = "", f = ""] = e.key.split(">"), p = V.edgeTip.cut(d, f);
893
- return /* @__PURE__ */ A("g", {
894
- className: "ca-edge ca-edge-cut",
895
- "data-edge": t,
896
- "data-state": "cut",
897
- ...Y(t, p),
898
- children: [
899
- Ue(t, n, r, i, a, p),
900
- /* @__PURE__ */ k("line", {
901
- x1: n,
902
- y1: r,
903
- x2: o - 10 * c,
904
- y2: s - 10 * l,
905
- className: "ca-stroke-cut"
906
- }),
907
- /* @__PURE__ */ k("line", {
908
- x1: o + 10 * c,
909
- y1: s + 10 * l,
910
- x2: i,
911
- y2: a,
912
- className: "ca-stroke-cut"
913
- }),
914
- /* @__PURE__ */ k("path", {
915
- d: e.slash,
916
- className: "ca-stroke-slash"
917
- }),
918
- /* @__PURE__ */ k("text", {
919
- x: u.x,
920
- y: u.y,
921
- className: "ca-svg-small ca-svg-bold",
922
- textAnchor: u.anchor,
923
- children: V.cut
924
- })
925
- ]
926
- }, t);
927
- }
928
- let { key: t, x1: n, y1: r, x2: i, y2: a, live: o, onPath: c, cls: l } = e;
929
- if (e.kind === "inhibit") {
930
- let { ux: u, uy: d, text: f, label: p } = e, m = He(t, c);
931
- return /* @__PURE__ */ A("g", {
932
- className: "ca-edge",
933
- "data-edge": t,
934
- "data-state": o ? "live" : "idle",
935
- "data-path": c,
936
- ...Y(t, m),
937
- children: [
938
- Ue(t, n, r, i, a, m),
939
- /* @__PURE__ */ k("line", {
940
- x1: n,
941
- y1: r,
942
- x2: i,
943
- y2: a,
944
- className: l
945
- }),
946
- /* @__PURE__ */ k("circle", {
947
- cx: i + 5 * u,
948
- cy: a + 5 * d,
949
- r: 5,
950
- className: `ca-inhibit ${o ? "is-live" : ""}`
951
- }),
952
- /* @__PURE__ */ k("text", {
953
- x: p.x,
954
- y: p.y,
955
- className: `ca-svg-small ca-svg-bold ca-mono ${o ? "" : "ca-fill-muted"}`,
956
- children: s(f)
957
- })
958
- ]
959
- }, t);
960
- }
961
- let u = He(t, c), d = t.split(">").every(We);
962
- return /* @__PURE__ */ A("g", {
963
- className: "ca-edge",
964
- "data-edge": t,
965
- "data-state": o ? "live" : "idle",
966
- "data-path": c,
967
- "data-hedge-edge": d ? "" : void 0,
968
- ...Y(t, u),
969
- children: [Ue(t, n, r, i, a, u), /* @__PURE__ */ k("line", {
970
- x1: n,
971
- y1: r,
972
- x2: i,
973
- y2: a,
974
- className: l,
975
- markerEnd: `url(#${we}-${d ? "hedge" : c === "open" ? "open" : o ? "live" : "idle"})`
976
- })]
977
- }, t);
978
- }), qe = Fe.map(({ plan: e, label: t }) => {
979
- let n = `${e.via}:${e.a}-${e.b}`, r = [`${e.via}>${e.a}`, `${e.via}>${e.b}`], a = r.every((e) => M?.open.has(e) === !0) ? "open" : r.every((e) => M?.open.has(e) === !0 || M?.blocked.has(e) === !0) ? "blocked" : void 0, o = `ca-stroke-arc${a === void 0 ? "" : ` ca-path-${a}`}`, s = t.box;
980
- return /* @__PURE__ */ A("g", {
981
- className: "ca-arc",
982
- "data-arc": n,
983
- "data-path": a,
984
- "data-hedge-edge": We(e.a) && We(e.b) ? "" : void 0,
985
- children: [
986
- /* @__PURE__ */ k("path", {
987
- d: `M${e.start.x} ${e.start.y}Q${e.control.x} ${e.control.y} ${e.end.x} ${e.end.y}`,
988
- className: o
989
- }),
990
- /* @__PURE__ */ k("path", {
991
- d: L(e.start, e.start.x - e.control.x, e.start.y - e.control.y),
992
- className: "ca-arc-head ca-fill-fg"
993
- }),
994
- /* @__PURE__ */ k("path", {
995
- d: L(e.end, e.end.x - e.control.x, e.end.y - e.control.y),
996
- className: "ca-arc-head ca-fill-fg"
997
- }),
998
- /* @__PURE__ */ k("text", {
999
- x: t.x,
1000
- y: t.y,
1001
- textAnchor: "middle",
1002
- className: "ca-svg-small ca-fill-muted",
1003
- "aria-hidden": "true",
1004
- children: V.arc.label
1005
- }),
1006
- /* @__PURE__ */ k("foreignObject", {
1007
- className: "ca-arc-tip-box",
1008
- x: s.x0,
1009
- y: s.y0,
1010
- width: s.x1 - s.x0,
1011
- height: s.y1 - s.y0,
1012
- children: /* @__PURE__ */ k(E, {
1013
- tip: l ? V.identify.arc : /* @__PURE__ */ k(c, {
1014
- text: V.arc.tip(e.via, e.a, e.b),
1015
- ids: i.model.byId
1016
- }),
1017
- className: "ca-arc-tip",
1018
- children: /* @__PURE__ */ k("span", {
1019
- className: "ca-arc-hit",
1020
- children: V.arc.label
1021
- })
1022
- })
1023
- })
1024
- ]
1025
- }, n);
1026
- }), Je = o.map((t) => {
1027
- let a = Pe.get(t), o = K.get(t);
1028
- if (a === void 0 || o === void 0) return null;
1029
- if (ce.includes(t)) {
1030
- let e = V.withHint(m(t, Be(t)), le[t] ?? "");
1031
- return /* @__PURE__ */ A("g", {
1032
- className: `ca-node ca-switch${he === void 0 ? "" : " is-interactive"}`,
1033
- "data-node": t,
1034
- "data-switch": "true",
1035
- "data-block": o.side,
1036
- transform: `translate(${a.x} ${a.y})`,
1037
- ...he === void 0 ? {
1038
- role: "img",
1039
- "aria-label": e
1040
- } : {
1041
- role: "button",
1042
- tabIndex: 0,
1043
- "aria-haspopup": "dialog",
1044
- "aria-expanded": I === t,
1045
- "aria-label": V.withHint(e, V.nodeHint("switch", !1)),
1046
- ...ke(t, () => he(t))
1047
- },
1048
- ...Ae(t),
1049
- children: [
1050
- /* @__PURE__ */ k("circle", {
1051
- r: 21,
1052
- className: "ca-focus-ring"
1053
- }),
1054
- I === t && /* @__PURE__ */ k("circle", {
1055
- r: 21,
1056
- className: "ca-open-ring"
1057
- }),
1058
- v.includes(t) && /* @__PURE__ */ k("rect", {
1059
- x: -13,
1060
- y: -13,
1061
- width: 26,
1062
- height: 26,
1063
- className: "ca-ring"
1064
- }),
1065
- M?.ends.includes(t) === !0 && /* @__PURE__ */ k("circle", {
1066
- r: 17 + (v.includes(t) ? 4 : 0),
1067
- className: "ca-dsep-ring",
1068
- "data-dsep-end": t
1069
- }),
1070
- /* @__PURE__ */ k("rect", {
1071
- x: -9,
1072
- y: -9,
1073
- width: 18,
1074
- height: 18,
1075
- className: "ca-switch-box"
1076
- }),
1077
- /* @__PURE__ */ k("text", {
1078
- x: Ge(o),
1079
- y: o.labelY,
1080
- textAnchor: "middle",
1081
- className: "ca-svg-label",
1082
- children: /* @__PURE__ */ k("tspan", {
1083
- className: "ca-mono ca-svg-bold",
1084
- children: s(t)
1085
- })
1086
- })
1087
- ]
1088
- }, t);
1089
- }
1090
- let c = e(i.model, t), g = d?.[t], re = te[t], x = ne[t], E = re !== void 0 || x !== void 0, ae = ie !== void 0 && t in ie, oe = c.domain.kind === "boolean", D = !W && g === !0, j = g === void 0 ? "" : n(g), ue = f?.[t], P = !W && ue !== void 0 && g !== void 0 && !r(ue, g), L = Be(t), xe = m(t, L), z = p?.[t], B = ze(t) && c.domain.kind === "finite" ? c.domain.values : void 0, Se = ee?.[t], Ce = (e) => `P(${t}=${n((B ?? [])[e])})=${y(Se?.[e] ?? NaN, H)}`, Te = W ? B === void 0 ? `P(${t}=1) ${y(z ?? NaN, H)}` : B.map((e, t) => Ce(t)).join(", ") : t in h ? `P(${t}=1) ${y(h[t], H)}` : V.nodeValue(j), Ee = t in h && !W ? pe(V, H, h[t], void 0, void 0) : pe(V, H, z, re, T ? void 0 : C[t]), De = re === void 0 ? x === void 0 ? void 0 : `P(${t}=1)=${y(x, H)}` : b?.[t] ?? n(re), Oe = C[t], U = V.withHint(V.nodeAria(xe, Te, De, P ? n(ue) : void 0, Oe === void 0 ? void 0 : n(Oe)), le[t] ?? ""), Me = de === void 0 && he !== void 0 && (c.kind === "endogenous" || ge), Ne = de !== void 0 && (fe === void 0 || fe.includes(t)), Fe = Me || S !== void 0 || Ne, q = () => {
1091
- de === void 0 ? he?.(t) : Ne && de(t);
1092
- }, Ie = Ne ? "pick" : Me ? ge ? c.kind === "exogenous" ? "observe" : "observeOrDo" : "do" : void 0, Le = Ne && me !== void 0 ? V.withHint(me, S === void 0 ? "" : V.nodeHint(void 0, !0)) : V.nodeHint(Ie, S !== void 0), Re = c.kind === "exogenous", J = Re ? G - ye : G, Ve = W && z !== void 0 && !Number.isNaN(z) ? 2 * J * z : 0, Y = je.tags.get(t), He = je.holdNotes.get(t), Ue = je.labelLines.get(t), Ke = je.deviantNotes.get(t), qe = je.wasNotes.get(t);
1093
- return /* @__PURE__ */ A("g", {
1094
- className: `ca-node${Fe ? " is-interactive" : ""}${S === void 0 ? "" : " is-movable"}`,
1095
- "data-node": t,
1096
- "data-value": j,
1097
- "data-intervened": E ? "true" : "false",
1098
- "data-observed": Oe === void 0 ? void 0 : n(Oe),
1099
- "data-do-p": x === void 0 ? void 0 : x.toFixed(2),
1100
- "data-block": o.side,
1101
- transform: `translate(${a.x} ${a.y})`,
1102
- ...Fe ? {
1103
- role: "button",
1104
- tabIndex: 0,
1105
- "aria-haspopup": Me ? "dialog" : void 0,
1106
- "aria-expanded": Me ? I === t : void 0,
1107
- "aria-label": V.withHint(U, Le),
1108
- ...ke(t, q)
1109
- } : {
1110
- role: "img",
1111
- "aria-label": U
1112
- },
1113
- ...Ae(t),
1114
- children: [
1115
- We(t) && /* @__PURE__ */ k("circle", {
1116
- r: G + 9,
1117
- className: "ca-hedge-ring",
1118
- "data-hedge": "f",
1119
- "data-member": t
1120
- }),
1121
- u?.fPrime.includes(t) === !0 && /* @__PURE__ */ k("circle", {
1122
- r: G + 16,
1123
- className: "ca-hedge-inner",
1124
- "data-hedge": "f-prime",
1125
- "data-member": t
1126
- }),
1127
- _e.includes(t) && /* @__PURE__ */ k("circle", {
1128
- r: G + 14,
1129
- className: "ca-lit-ring",
1130
- "data-lit": t
1131
- }),
1132
- F.includes(t) && /* @__PURE__ */ k("circle", {
1133
- r: G + 7,
1134
- className: "ca-new-ring",
1135
- "data-new": t
1136
- }),
1137
- /* @__PURE__ */ k("circle", {
1138
- r: G + 12,
1139
- className: "ca-focus-ring"
1140
- }),
1141
- I === t && /* @__PURE__ */ k("circle", {
1142
- r: G + 12,
1143
- className: "ca-open-ring"
1144
- }),
1145
- v.includes(t) && /* @__PURE__ */ k("circle", {
1146
- r: G + 5,
1147
- className: "ca-ring"
1148
- }),
1149
- M?.ends.includes(t) === !0 && /* @__PURE__ */ k("circle", {
1150
- r: G + 9,
1151
- className: "ca-dsep-ring",
1152
- "data-dsep-end": t
1153
- }),
1154
- W ? /* @__PURE__ */ A(O, { children: [
1155
- /* @__PURE__ */ k("clipPath", {
1156
- id: `${we}-cp-${t}`,
1157
- children: /* @__PURE__ */ k("circle", { r: J })
1158
- }),
1159
- /* @__PURE__ */ k("circle", {
1160
- r: G,
1161
- className: "ca-fill-bg"
1162
- }),
1163
- B === void 0 && /* @__PURE__ */ k("rect", {
1164
- x: -J,
1165
- y: J - Ve,
1166
- width: 2 * J,
1167
- height: Ve,
1168
- className: "ca-fill-fg",
1169
- clipPath: `url(#${we}-cp-${t})`,
1170
- "data-level": z === void 0 ? "" : z.toFixed(4)
1171
- }),
1172
- /* @__PURE__ */ k("circle", {
1173
- r: G,
1174
- className: `ca-node-outline${Re ? " ca-exo" : ""}`,
1175
- strokeDasharray: Re ? ve(G) : void 0
1176
- })
1177
- ] }) : /* @__PURE__ */ A(O, { children: [Re ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("circle", {
1178
- r: G,
1179
- className: "ca-node-off ca-exo",
1180
- strokeDasharray: ve(G)
1181
- }), D && /* @__PURE__ */ k("circle", {
1182
- r: J,
1183
- className: "ca-fill-fg ca-exo-core"
1184
- })] }) : /* @__PURE__ */ k("circle", {
1185
- r: G,
1186
- className: D ? "ca-node-on" : "ca-node-off"
1187
- }), /* @__PURE__ */ k("text", {
1188
- y: oe ? 7.5 : 5,
1189
- textAnchor: "middle",
1190
- className: `ca-mono ca-svg-bold ${D ? "ca-fill-bg-text" : ""}`,
1191
- fontSize: l ? 14 : oe || j.length <= 2 ? 21 : 13,
1192
- children: l ? s(t) : j
1193
- })] }),
1194
- !E && N.includes(t) && /* @__PURE__ */ k("path", {
1195
- d: R(G),
1196
- className: "ca-stroke-clamp ca-clamp-test",
1197
- "data-clamp": "test"
1198
- }),
1199
- (E && !ae || !E && se.includes(t)) && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("path", {
1200
- d: R(G),
1201
- className: Y?.reset ? "ca-stroke-reset" : "ca-stroke-clamp"
1202
- }), E && Y !== void 0 && /* @__PURE__ */ A("g", {
1203
- transform: `translate(${Y.box.x0} ${Y.box.y0})`,
1204
- children: [/* @__PURE__ */ k("rect", {
1205
- width: Y.box.x1 - Y.box.x0,
1206
- height: 22,
1207
- className: Y.reset ? "ca-fill-reset" : "ca-fill-accent"
1208
- }), /* @__PURE__ */ k("text", {
1209
- x: (Y.box.x1 - Y.box.x0) / 2,
1210
- y: 15.5,
1211
- textAnchor: "middle",
1212
- className: "ca-mono ca-svg-small ca-svg-bold ca-fill-on-accent",
1213
- children: s(Y.text)
1214
- })]
1215
- })] }),
1216
- !E && Y !== void 0 && Y.seen && /* @__PURE__ */ A("g", {
1217
- transform: `translate(${Y.box.x0} ${Y.box.y0})`,
1218
- className: "ca-seen-tag",
1219
- children: [/* @__PURE__ */ k("rect", {
1220
- width: Y.box.x1 - Y.box.x0,
1221
- height: 22,
1222
- className: "ca-seen-tag-box"
1223
- }), /* @__PURE__ */ k("text", {
1224
- x: (Y.box.x1 - Y.box.x0) / 2,
1225
- y: 15.5,
1226
- textAnchor: "middle",
1227
- className: "ca-mono ca-svg-small ca-svg-bold",
1228
- children: s(Y.text)
1229
- })]
1230
- }),
1231
- He === void 0 ? qe !== void 0 && /* @__PURE__ */ k("text", {
1232
- x: qe.x,
1233
- y: qe.y,
1234
- textAnchor: qe.anchor,
1235
- className: "ca-svg-small ca-fill-muted",
1236
- children: qe.text
1237
- }) : /* @__PURE__ */ k("text", {
1238
- x: Ge(o),
1239
- y: o.noteY,
1240
- textAnchor: "middle",
1241
- className: "ca-svg-small ca-svg-bold ca-fill-amber",
1242
- "data-held": t,
1243
- children: He
1244
- }),
1245
- Ke !== void 0 && /* @__PURE__ */ A("g", {
1246
- className: "ca-deviant",
1247
- "data-deviant": t,
1248
- children: [/* @__PURE__ */ k("rect", {
1249
- x: o.cx - (w(Ke ?? "", 11) + 8) / 2,
1250
- y: o.note2Y - 11,
1251
- width: w(Ke ?? "", 11) + 8,
1252
- height: 15,
1253
- className: "ca-deviant-box"
1254
- }), /* @__PURE__ */ k("text", {
1255
- x: Ge(o),
1256
- y: o.note2Y,
1257
- textAnchor: "middle",
1258
- className: "ca-svg-tiny ca-svg-bold",
1259
- children: Ke
1260
- })]
1261
- }),
1262
- /* @__PURE__ */ A("text", {
1263
- x: Ge(o),
1264
- y: o.labelY,
1265
- textAnchor: "middle",
1266
- className: "ca-svg-label",
1267
- children: [!l && /* @__PURE__ */ k("tspan", {
1268
- className: "ca-mono ca-svg-bold",
1269
- children: s(t)
1270
- }), Ue === void 0 ? L === "" ? null : l ? L : ` ${L}` : /* @__PURE__ */ A(O, { children: [l ? Ue[0] : ` ${Ue[0]}`, /* @__PURE__ */ k("tspan", {
1271
- x: o.cx,
1272
- y: o.label2Y,
1273
- children: Ue[1]
1274
- })] })]
1275
- }),
1276
- B === void 0 ? (W || t in h) && /* @__PURE__ */ A("text", {
1277
- x: Ge(o),
1278
- y: o.numberY,
1279
- textAnchor: "middle",
1280
- className: "ca-mono ca-svg-num",
1281
- children: [Ee.prefix !== "" && /* @__PURE__ */ k("tspan", {
1282
- className: "ca-svg-small ca-fill-muted",
1283
- children: Ee.prefix
1284
- }), /* @__PURE__ */ k("tspan", {
1285
- "data-readout": t,
1286
- fontSize: Ee.settled ? 14 : void 0,
1287
- children: Ee.text
1288
- })]
1289
- }) : /* @__PURE__ */ k(be, {
1290
- id: t,
1291
- labels: B.map(n),
1292
- dist: Se,
1293
- block: o,
1294
- barText: Ce
1295
- }),
1296
- W && (!Ee.settled || T) && _?.[t] !== void 0 && He === void 0 && /* @__PURE__ */ k("text", {
1297
- x: Ge(o),
1298
- y: o.noteY,
1299
- textAnchor: "middle",
1300
- className: "ca-svg-small ca-fill-muted",
1301
- "data-note": t,
1302
- children: _[t]
1303
- })
1304
- ]
1305
- }, t);
1306
- });
1307
- return /* @__PURE__ */ A("svg", {
1308
- ref: Te,
1309
- onPointerMove: S === void 0 ? void 0 : De,
1310
- onPointerUp: S === void 0 ? void 0 : (e) => Oe(e, Me, Ne),
1311
- onPointerCancel: S === void 0 ? void 0 : U,
1312
- className: "ca-graph",
1313
- viewBox: `${Ie} ${Le} ${Re} ${J}`,
1314
- width: Re,
1315
- height: J,
1316
- role: "group",
1317
- "aria-label": t.title,
1318
- "data-mode": W ? "probability" : "value",
1319
- children: [
1320
- /* @__PURE__ */ A("defs", { children: [
1321
- /* @__PURE__ */ k("marker", {
1322
- id: `${we}-live`,
1323
- viewBox: "0 0 10 10",
1324
- refX: "9",
1325
- refY: "5",
1326
- markerWidth: "6.5",
1327
- markerHeight: "6.5",
1328
- orient: "auto",
1329
- children: /* @__PURE__ */ k("path", {
1330
- d: "M0 0.5L10 5L0 9.5z",
1331
- className: "ca-fill-fg"
1332
- })
1333
- }),
1334
- /* @__PURE__ */ k("marker", {
1335
- id: `${we}-open`,
1336
- viewBox: "0 0 10 10",
1337
- refX: "9",
1338
- refY: "5",
1339
- markerWidth: "6.5",
1340
- markerHeight: "6.5",
1341
- orient: "auto",
1342
- children: /* @__PURE__ */ k("path", {
1343
- d: "M0 0.5L10 5L0 9.5z",
1344
- className: "ca-fill-accent"
1345
- })
1346
- }),
1347
- u !== void 0 && /* @__PURE__ */ k("marker", {
1348
- id: `${we}-hedge`,
1349
- viewBox: "0 0 10 10",
1350
- refX: "9",
1351
- refY: "5",
1352
- markerWidth: "6.5",
1353
- markerHeight: "6.5",
1354
- orient: "auto",
1355
- children: /* @__PURE__ */ k("path", {
1356
- d: "M0 0.5L10 5L0 9.5z",
1357
- className: "ca-hedge-arrow"
1358
- })
1359
- }),
1360
- /* @__PURE__ */ k("marker", {
1361
- id: `${we}-idle`,
1362
- viewBox: "0 0 10 10",
1363
- refX: "9",
1364
- refY: "5",
1365
- markerWidth: "8",
1366
- markerHeight: "8",
1367
- orient: "auto",
1368
- children: /* @__PURE__ */ k("path", {
1369
- d: "M0 0.5L10 5L0 9.5z",
1370
- className: "ca-fill-idle"
1371
- })
1372
- })
1373
- ] }),
1374
- q !== void 0 && /* @__PURE__ */ A("g", {
1375
- className: "ca-witness",
1376
- "data-witness": Object.keys(ie ?? {}).join(","),
1377
- children: [/* @__PURE__ */ k("rect", {
1378
- x: q.x,
1379
- y: q.y,
1380
- width: q.w,
1381
- height: q.h,
1382
- className: "ca-hull"
1383
- }), !D && /* @__PURE__ */ A("g", {
1384
- transform: `translate(${q.x} ${q.y + q.h + 6})`,
1385
- children: [/* @__PURE__ */ k("rect", {
1386
- width: w(q.text, 12) + 18,
1387
- height: 22,
1388
- className: "ca-amber-tag"
1389
- }), /* @__PURE__ */ k("text", {
1390
- x: 8,
1391
- y: 15.5,
1392
- className: "ca-svg-small ca-svg-bold ca-fill-amber",
1393
- children: s(q.text)
1394
- })]
1395
- })]
1396
- }),
1397
- Ke,
1398
- qe,
1399
- Je
1400
- ]
1401
- });
1402
- }
1403
- export { N as a, j as i, P as n, se as o, M as r, H as t };
1404
-
1405
- //# sourceMappingURL=SignalGraph-yoGcj7jf.js.map