@mechane-ai/elements 0.44.0 → 0.45.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.
@@ -1,94 +1,94 @@
1
- import { c as e } from "../src-CDp1JtwC.js";
2
- import { a as t, n, t as r } from "../chart-navigation-BAbb5PV9.js";
3
- import { i, n as a } from "../chart-frame-Bcd9Tpt5.js";
4
- import { n as o, t as s } from "../chart-input-B6_HXFDP.js";
5
- import { n as c, t as l } from "../plot-width-8cXdAjoD.js";
6
- import { t as u } from "../label-spacing-BncjePGb.js";
7
- import { r as d } from "../categorical-values-ByvFLaNE.js";
8
- import * as f from "@stylexjs/stylex";
9
- import { Button as p } from "@ui-sdk/react/button";
10
- import { useId as m } from "react";
11
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
12
- var v = 16, y = 2, b = .5;
13
- function x({ nodes: e, links: t, columns: n }) {
1
+ import { c as e, l as t } from "../src-Dcs3SZ9V.js";
2
+ import { a as n, n as r, t as i } from "../chart-navigation-BAbb5PV9.js";
3
+ import { i as a, n as o } from "../chart-frame-Ztktqs1b.js";
4
+ import { n as s, t as c } from "../chart-input-BO3BqlFO.js";
5
+ import { n as l, t as u } from "../plot-width-CIqBiHcd.js";
6
+ import { t as d } from "../label-spacing-BncjePGb.js";
7
+ import { r as f } from "../categorical-values-DZLGQVW1.js";
8
+ import * as p from "@stylexjs/stylex";
9
+ import { Button as m } from "@ui-sdk/react/button";
10
+ import { useId as h } from "react";
11
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
12
+ var y = 16, b = 2, x = .5;
13
+ function S({ nodes: e, links: t, columns: n }) {
14
14
  return new Map(e.map((e) => {
15
15
  let r = t.filter((t) => t.targetId === e.id).map((e) => (n.get(e.sourceId) ?? 0) + 1);
16
16
  return [e.id, Math.max(0, ...r)];
17
17
  }));
18
18
  }
19
- function S({ nodes: e, links: t }) {
19
+ function C({ nodes: e, links: t }) {
20
20
  let n = new Map(e.map((e) => [e.id, 0]));
21
- for (let r of e) n = x({
21
+ for (let r of e) n = S({
22
22
  nodes: e,
23
23
  links: t,
24
24
  columns: n
25
25
  });
26
- let r = x({
26
+ let r = S({
27
27
  nodes: e,
28
28
  links: t,
29
29
  columns: n
30
30
  });
31
31
  return e.every((e) => r.get(e.id) === n.get(e.id)) ? n : void 0;
32
32
  }
33
- function C(e) {
33
+ function w(e) {
34
34
  return e.reduce((e, t) => e + t, 0);
35
35
  }
36
- function w(e) {
36
+ function T(e) {
37
37
  return e.value ?? 0;
38
38
  }
39
- function T(e) {
40
- return e.map((t, n) => C(e.slice(0, n)));
39
+ function E(e) {
40
+ return e.map((t, n) => w(e.slice(0, n)));
41
41
  }
42
- function E({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
43
- let o = S({
42
+ function D({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
43
+ let o = C({
44
44
  nodes: e,
45
45
  links: t
46
46
  }) ?? /* @__PURE__ */ new Map(), s = Math.max(1, ...[...o.values()].map((e) => e + 1)), c = Array.from({ length: s }, (t, n) => e.filter((e) => o.get(e.id) === n)), l = e.map((e) => {
47
47
  let n = t.filter((t) => t.targetId === e.id), r = t.filter((t) => t.sourceId === e.id), i = [...n, ...r].some((e) => e.value === null);
48
48
  return {
49
49
  id: e.id,
50
- inflow: C(n.map(w)),
51
- outflow: C(r.map(w)),
50
+ inflow: w(n.map(T)),
51
+ outflow: w(r.map(T)),
52
52
  hasUnavailable: i
53
53
  };
54
54
  }), u = new Map(l.map((e) => [e.id, e]));
55
- function f(e) {
55
+ function d(e) {
56
56
  let t = u.get(e.id);
57
57
  return Math.max(t?.inflow ?? 0, t?.outflow ?? 0);
58
58
  }
59
59
  let p = a - i, m = Math.min(...c.map((e) => {
60
- let t = C(e.map(f)), n = p - Math.max(0, e.length - 1) * v - e.length * y;
60
+ let t = w(e.map(d)), n = p - Math.max(0, e.length - 1) * y - e.length * b;
61
61
  return t === 0 ? Infinity : Math.max(0, n) / t;
62
62
  })), h = Number.isFinite(m) ? m : 0, g = s === 1 ? 0 : (r - n - 12) / (s - 1), _ = c.flatMap((t, r) => {
63
- let a = t.map((e) => Math.max(y, f(e) * h)), o = C(a) + Math.max(0, t.length - 1) * v, s = i + (p - o) * b, c = T(a.map((e) => e + v));
63
+ let a = t.map((e) => Math.max(b, d(e) * h)), o = w(a) + Math.max(0, t.length - 1) * y, s = i + (p - o) * x, c = E(a.map((e) => e + y));
64
64
  return t.map((t, i) => {
65
65
  let o = u.get(t.id);
66
66
  return {
67
67
  node: t,
68
- tone: d(t.tone, e.indexOf(t)),
68
+ tone: f(t.tone, e.indexOf(t)),
69
69
  column: r,
70
70
  x: n + r * g,
71
71
  y: s + (c[i] ?? 0),
72
- height: a[i] ?? y,
72
+ height: a[i] ?? b,
73
73
  inflow: o?.inflow ?? 0,
74
74
  outflow: o?.outflow ?? 0,
75
75
  hasUnavailable: o?.hasUnavailable ?? !1
76
76
  };
77
77
  });
78
- }), x = new Map(_.map((e) => [e.node.id, e]));
79
- function E(e) {
80
- let t = x.get(e);
81
- return t === void 0 ? 0 : t.y + t.height * b;
78
+ }), v = new Map(_.map((e) => [e.node.id, e]));
79
+ function S(e) {
80
+ let t = v.get(e);
81
+ return t === void 0 ? 0 : t.y + t.height * x;
82
82
  }
83
83
  function D(e, t) {
84
- let n = e.toSorted((e, n) => E(t(e)) - E(t(n))), r = T(n.map((e) => w(e) * h));
84
+ let n = e.toSorted((e, n) => S(t(e)) - S(t(n))), r = E(n.map((e) => T(e) * h));
85
85
  return new Map(n.map((e, t) => [e.id, r[t] ?? 0]));
86
86
  }
87
87
  let O = new Map(_.map((e) => [e.node.id, D(t.filter((t) => t.sourceId === e.node.id), (e) => e.targetId)])), k = new Map(_.map((e) => [e.node.id, D(t.filter((t) => t.targetId === e.node.id), (e) => e.sourceId)]));
88
88
  return {
89
89
  nodes: _,
90
90
  links: t.flatMap((e) => {
91
- let t = x.get(e.sourceId), n = x.get(e.targetId);
91
+ let t = v.get(e.sourceId), n = v.get(e.targetId);
92
92
  if (t === void 0 || n === void 0) return [];
93
93
  let r = O.get(t.node.id)?.get(e.id) ?? 0, i = k.get(n.node.id)?.get(e.id) ?? 0;
94
94
  return [{
@@ -98,14 +98,14 @@ function E({ nodes: e, links: t, left: n, right: r, top: i, bottom: a }) {
98
98
  target: n,
99
99
  sourceY: t.y + r,
100
100
  targetY: n.y + i,
101
- width: w(e) * h
101
+ width: T(e) * h
102
102
  }];
103
103
  }),
104
104
  columnCount: s
105
105
  };
106
106
  }
107
- function D(e) {
108
- let t = e.source.x + 12, n = e.target.x, r = (t + n) * b, { sourceY: i, targetY: a, width: o } = e;
107
+ function O(e) {
108
+ let t = e.source.x + 12, n = e.target.x, r = (t + n) * x, { sourceY: i, targetY: a, width: o } = e;
109
109
  return [
110
110
  `M${t},${i}`,
111
111
  `C${r},${i} ${r},${a} ${n},${a}`,
@@ -114,22 +114,25 @@ function D(e) {
114
114
  "Z"
115
115
  ].join(" ");
116
116
  }
117
- function O(e) {
118
- let t = e.source.x + 12, n = e.target.x, r = (t + n) * b, i = e.sourceY + e.width * b, a = e.targetY + e.width * b;
117
+ function k(e) {
118
+ let t = e.source.x + 12, n = e.target.x, r = (t + n) * x, i = e.sourceY + e.width * x, a = e.targetY + e.width * x;
119
119
  return `M${t},${i} C${r},${i} ${r},${a} ${n},${a}`;
120
120
  }
121
121
  // packages/charts/src/graph/flow-diagram.tsx
122
- var k = {
122
+ var A = {
123
123
  kVYP8I: "x14kjgpu",
124
124
  $$css: !0
125
- }, A = {
125
+ }, j = {
126
126
  kDwRjp: "xbh8q5q",
127
127
  kfJifR: "xhr4kjn",
128
128
  kREpy8: "x13efnbd",
129
129
  $$css: !0
130
- }, j = {
130
+ }, M = {
131
+ kfJifR: "xnpr05h",
132
+ $$css: !0
133
+ }, N = {
131
134
  ribbon: (e) => [
132
- k,
135
+ A,
133
136
  {
134
137
  kDwRjp: e == null ? e : "x19zyb68",
135
138
  $$css: !0
@@ -137,7 +140,7 @@ var k = {
137
140
  { "--x-fill": e ?? void 0 }
138
141
  ],
139
142
  thread: (e) => [
140
- A,
143
+ j,
141
144
  {
142
145
  kjVXCG: e == null ? e : "x6mkzkt",
143
146
  $$css: !0
@@ -148,10 +151,18 @@ var k = {
148
151
  k5rJSQ: "x15lqr97",
149
152
  $$css: !0
150
153
  },
151
- node: (e) => [{
152
- kDwRjp: e == null ? e : "x19zyb68",
153
- $$css: !0
154
- }, { "--x-fill": e ?? void 0 }],
154
+ node: (e, t) => [
155
+ M,
156
+ {
157
+ kDwRjp: e == null ? e : "x19zyb68",
158
+ kjVXCG: t == null ? t : "x6mkzkt",
159
+ $$css: !0
160
+ },
161
+ {
162
+ "--x-fill": e ?? void 0,
163
+ "--x-stroke": t ?? void 0
164
+ }
165
+ ],
155
166
  lit: {
156
167
  kVYP8I: "xif5ylx",
157
168
  $$css: !0
@@ -176,22 +187,22 @@ var k = {
176
187
  kkrTdU: "x1ypdohk",
177
188
  $$css: !0
178
189
  }
179
- }, M = 64, N = 256, P = 8, F = 8, I = 16, L = 6.5, R = 22, z = 180, B = 48, V = 240, H = 96;
180
- function U({ nodes: e, links: t }) {
190
+ }, P = 64, F = 256, I = 8, L = 8, R = 16, z = 6.5, B = 22, V = 180, H = 48, ee = 240, U = 96;
191
+ function te({ nodes: e, links: t }) {
181
192
  if (e.length > 64 || t.length > 256) return "This flow exceeds the render limit of 64 nodes or 256 links. Supply a smaller, labelled grouping.";
182
- if (!o([...e, ...t])) return "Flow nodes and links require distinct, unique identifiers.";
193
+ if (!s([...e, ...t])) return "Flow nodes and links require distinct, unique identifiers.";
183
194
  let n = new Set(e.map((e) => e.id));
184
195
  for (let e of t) {
185
196
  if (!(n.has(e.sourceId) && n.has(e.targetId) && e.sourceId !== e.targetId)) return "Every flow link must join two different supplied nodes.";
186
197
  if (e.value !== null && (!Number.isFinite(e.value) || e.value < 0)) return "Flow amounts must be finite and nonnegative, or explicitly unavailable.";
187
198
  }
188
- return S({
199
+ return C({
189
200
  nodes: e,
190
201
  links: t
191
202
  }) === void 0 ? "Flow links must not form a cycle." : void 0;
192
203
  }
193
204
  function W(e) {
194
- return e.length > R ? `${e.slice(0, 21)}…` : e;
205
+ return e.length > B ? `${e.slice(0, 21)}…` : e;
195
206
  }
196
207
  function G(e) {
197
208
  return Math.max(e.inflow, e.outflow);
@@ -200,7 +211,7 @@ function K({ placed: e, formatValue: t }) {
200
211
  let n = e.inflow > 0 && e.outflow > 0 && e.inflow !== e.outflow ? `in ${t(e.inflow)}, out ${t(e.outflow)}` : t(G(e));
201
212
  return e.hasUnavailable ? `${n}, with an unavailable amount` : n;
202
213
  }
203
- function ee({ placed: e, formatValue: t }) {
214
+ function ne({ placed: e, formatValue: t }) {
204
215
  let n = e.link.value === null ? "Unavailable" : t(e.link.value);
205
216
  return `${e.source.node.label} → ${e.target.node.label}: ${n}`;
206
217
  }
@@ -209,83 +220,83 @@ function q({ nodes: e, links: t, formatValue: n }) {
209
220
  let r = t.filter((t) => t.targetId === e.id).reduce((e, t) => e + (t.value ?? 0), 0), i = t.filter((t) => t.sourceId === e.id).reduce((e, t) => e + (t.value ?? 0), 0), a = Math.max(r, i);
210
221
  return W(e.label).length + n(a).length + 1;
211
222
  });
212
- return Math.min(z, Math.max(0, ...r) * L + F);
223
+ return Math.min(V, Math.max(0, ...r) * z + L);
213
224
  }
214
- function J({ title: o, description: c, report: u, nodes: d, links: p, formatValue: m, selection: h, height: v, emptyLabel: y = "No flows" }) {
215
- let { ref: b, width: x } = l(), C = U({
216
- nodes: d,
217
- links: p
218
- }), w = (C === void 0 ? S({
219
- nodes: d,
220
- links: p
221
- }) : void 0) ?? /* @__PURE__ */ new Map(), T = Math.max(0, ...w.values()), k = Array.from({ length: T + 1 }, (e, t) => d.filter((e) => w.get(e.id) === t).length), A = v ?? Math.max(V, Math.max(...k) * B), M = T === 0 ? [] : d.filter((e) => w.get(e.id) === 0), N = d.filter((e) => w.get(e.id) === T), F = q({
225
+ function J({ title: s, description: l, report: d, nodes: f, links: m, formatValue: h, selection: g, height: y, emptyLabel: b = "No flows" }) {
226
+ let { ref: x, width: S } = u(), w = te({
227
+ nodes: f,
228
+ links: m
229
+ }), T = (w === void 0 ? C({
230
+ nodes: f,
231
+ links: m
232
+ }) : void 0) ?? /* @__PURE__ */ new Map(), E = Math.max(0, ...T.values()), A = Array.from({ length: E + 1 }, (e, t) => f.filter((e) => T.get(e.id) === t).length), j = y ?? Math.max(ee, Math.max(...A) * H), M = E === 0 ? [] : f.filter((e) => T.get(e.id) === 0), P = f.filter((e) => T.get(e.id) === E), F = q({
222
233
  nodes: M,
223
- links: p,
224
- formatValue: m
225
- }), I = q({
226
- nodes: N,
227
- links: p,
228
- formatValue: m
229
- }), L = E({
230
- nodes: C === void 0 ? d : [],
231
- links: C === void 0 ? p : [],
234
+ links: m,
235
+ formatValue: h
236
+ }), L = q({
237
+ nodes: P,
238
+ links: m,
239
+ formatValue: h
240
+ }), R = D({
241
+ nodes: w === void 0 ? f : [],
242
+ links: w === void 0 ? m : [],
232
243
  left: F,
233
- right: Math.max(F + 12, x - I),
234
- top: P,
235
- bottom: A - P
236
- }), R = L.nodes.flatMap((e) => [{
244
+ right: Math.max(F + 12, S - L),
245
+ top: I,
246
+ bottom: j - I
247
+ }), z = R.nodes.flatMap((e) => [{
237
248
  id: e.node.id,
238
249
  label: `${e.node.label}: ${K({
239
250
  placed: e,
240
- formatValue: m
251
+ formatValue: h
241
252
  })}`
242
- }, ...L.links.filter((t) => t.source.node.id === e.node.id).map((e) => ({
253
+ }, ...R.links.filter((t) => t.source.node.id === e.node.id).map((e) => ({
243
254
  id: e.link.id,
244
- label: ee({
255
+ label: ne({
245
256
  placed: e,
246
- formatValue: m
257
+ formatValue: h
247
258
  })
248
- }))]), z = r({
249
- title: o,
250
- selection: h,
251
- items: R
259
+ }))]), B = i({
260
+ title: s,
261
+ selection: g,
262
+ items: z
252
263
  });
253
- if (C !== void 0) return /* @__PURE__ */ g(s, {
254
- title: o,
255
- description: c,
256
- report: u,
257
- message: C
264
+ if (w !== void 0) return /* @__PURE__ */ _(c, {
265
+ title: s,
266
+ description: l,
267
+ report: d,
268
+ message: w
258
269
  });
259
- if (!Number.isFinite(A) || A < H) return /* @__PURE__ */ g(s, {
260
- title: o,
261
- description: c,
262
- report: u,
263
- message: `Flow height must be at least ${H} pixels.`
270
+ if (!Number.isFinite(j) || j < U) return /* @__PURE__ */ _(c, {
271
+ title: s,
272
+ description: l,
273
+ report: d,
274
+ message: `Flow height must be at least ${U} pixels.`
264
275
  });
265
- let W = z.label === void 0 ? void 0 : z.activeId, G = L.links.find((e) => e.link.id === W), J = L.nodes.find((e) => e.node.id === W);
266
- function Y(e) {
267
- return G === void 0 ? J !== void 0 && [e.source.node.id, e.target.node.id].includes(J.node.id) : G.link.id === e.link.id;
276
+ let V = B.label === void 0 ? void 0 : B.activeId, W = R.links.find((e) => e.link.id === V), G = R.nodes.find((e) => e.node.id === V);
277
+ function J(e) {
278
+ return W === void 0 ? G !== void 0 && [e.source.node.id, e.target.node.id].includes(G.node.id) : W.link.id === e.link.id;
268
279
  }
269
- function X(e) {
270
- return G === void 0 ? J === void 0 || J.node.id === e.node.id || L.links.some((t) => Y(t) && [t.source.node.id, t.target.node.id].includes(e.node.id)) : [G.source.node.id, G.target.node.id].includes(e.node.id);
280
+ function Y(e) {
281
+ return W === void 0 ? G === void 0 || G.node.id === e.node.id || R.links.some((t) => J(t) && [t.source.node.id, t.target.node.id].includes(e.node.id)) : [W.source.node.id, W.target.node.id].includes(e.node.id);
271
282
  }
272
- let Z = W !== void 0;
273
- function Q(e) {
283
+ let X = V !== void 0;
284
+ function Z(e) {
274
285
  return {
275
- onPointerEnter: () => z.inspect(e),
276
- onClick: () => h?.onSelect(e)
286
+ onPointerEnter: () => B.inspect(e),
287
+ onClick: () => g?.onSelect(e)
277
288
  };
278
289
  }
279
- return /* @__PURE__ */ _(a, {
280
- title: o,
281
- description: c,
282
- report: u,
283
- footer: /* @__PURE__ */ g(i, {
284
- id: z.id,
285
- children: z.label ?? "\xA0"
290
+ return /* @__PURE__ */ v(o, {
291
+ title: s,
292
+ description: l,
293
+ report: d,
294
+ footer: /* @__PURE__ */ _(a, {
295
+ id: B.id,
296
+ children: B.label ?? "\xA0"
286
297
  }),
287
- children: [/* @__PURE__ */ g(t, {
288
- label: `${o} flows`,
298
+ children: [/* @__PURE__ */ _(n, {
299
+ label: `${s} flows`,
289
300
  columns: [{
290
301
  id: "item",
291
302
  label: "Item"
@@ -293,53 +304,53 @@ function J({ title: o, description: c, report: u, nodes: d, links: p, formatValu
293
304
  id: "amount",
294
305
  label: "Amount"
295
306
  }],
296
- rows: [...L.nodes.map((e) => ({
307
+ rows: [...R.nodes.map((e) => ({
297
308
  id: `node:${e.node.id}`,
298
309
  values: [e.node.label, K({
299
310
  placed: e,
300
- formatValue: m
311
+ formatValue: h
301
312
  })]
302
- })), ...L.links.map((e) => ({
313
+ })), ...R.links.map((e) => ({
303
314
  id: `link:${e.link.id}`,
304
- values: [`${e.source.node.label} → ${e.target.node.label}`, e.link.value === null ? "Unavailable" : m(e.link.value)]
315
+ values: [`${e.source.node.label} → ${e.target.node.label}`, e.link.value === null ? "Unavailable" : h(e.link.value)]
305
316
  }))]
306
- }), /* @__PURE__ */ g("div", {
307
- ref: b,
308
- children: d.length === 0 ? /* @__PURE__ */ g("p", {
317
+ }), /* @__PURE__ */ _("div", {
318
+ ref: x,
319
+ children: f.length === 0 ? /* @__PURE__ */ _("p", {
309
320
  className: "x1ghz6dp x153jb6y xy8obcc",
310
- children: y
311
- }) : /* @__PURE__ */ g(n, {
312
- ...z.props,
321
+ children: b
322
+ }) : /* @__PURE__ */ _(r, {
323
+ ...B.props,
313
324
  className: "xeuugli x1we84gm x1t137rt x13qnu6 x19rmrnh x9v5kkp x7s97pk",
314
- children: /* @__PURE__ */ _("svg", {
325
+ children: /* @__PURE__ */ v("svg", {
315
326
  "aria-hidden": !0,
316
- viewBox: `0 0 ${x} ${A}`,
317
- height: A,
327
+ viewBox: `0 0 ${S} ${j}`,
328
+ height: j,
318
329
  className: "x1lliihq xh8yej3 x1rea2x4",
319
330
  children: [
320
- /* @__PURE__ */ g("g", { children: L.links.map((t) => {
321
- let n = e[t.tone], r = Y(t), i = t.width > 0, a = h?.selectedId === t.link.id;
322
- return /* @__PURE__ */ g("path", {
323
- d: i ? D(t) : O(t),
324
- ...Q(t.link.id),
325
- ...f.props(i ? j.ribbon(n) : j.thread(n), t.link.value === null && j.unavailable, j.transition, r && i && j.lit, Z && !r && j.dim, a && j.selected, h !== void 0 && j.interactive)
331
+ /* @__PURE__ */ _("g", { children: R.links.map((t) => {
332
+ let n = e[t.tone], r = J(t), i = t.width > 0, a = g?.selectedId === t.link.id;
333
+ return /* @__PURE__ */ _("path", {
334
+ d: i ? O(t) : k(t),
335
+ ...Z(t.link.id),
336
+ ...p.props(i ? N.ribbon(n) : N.thread(n), t.link.value === null && N.unavailable, N.transition, r && i && N.lit, X && !r && N.dim, a && N.selected, g !== void 0 && N.interactive)
326
337
  }, t.link.id);
327
338
  }) }),
328
- L.nodes.map((t) => /* @__PURE__ */ g("rect", {
329
- x: t.x,
330
- y: t.y,
339
+ R.nodes.map((n) => /* @__PURE__ */ _("rect", {
340
+ x: n.x,
341
+ y: n.y,
331
342
  width: 12,
332
- height: t.height,
333
- ...Q(t.node.id),
334
- ...f.props(j.node(e[t.tone]), j.transition, Z && !X(t) && j.dim, h?.selectedId === t.node.id && j.selected, h !== void 0 && j.interactive)
335
- }, t.node.id)),
336
- /* @__PURE__ */ g(te, {
337
- nodes: L.nodes,
338
- columnCount: L.columnCount,
339
- top: P,
340
- bottom: A - P,
341
- formatValue: m,
342
- isLit: (e) => !Z || X(e)
343
+ height: n.height,
344
+ ...Z(n.node.id),
345
+ ...p.props(N.node(e[n.tone], t[n.tone]), N.transition, X && !Y(n) && N.dim, g?.selectedId === n.node.id && N.selected, g !== void 0 && N.interactive)
346
+ }, n.node.id)),
347
+ /* @__PURE__ */ _(re, {
348
+ nodes: R.nodes,
349
+ columnCount: R.columnCount,
350
+ top: I,
351
+ bottom: j - I,
352
+ formatValue: h,
353
+ isLit: (e) => !X || Y(e)
343
354
  })
344
355
  ]
345
356
  })
@@ -347,24 +358,24 @@ function J({ title: o, description: c, report: u, nodes: d, links: p, formatValu
347
358
  })]
348
359
  });
349
360
  }
350
- function te({ nodes: e, columnCount: t, top: n, bottom: r, formatValue: i, isLit: a }) {
361
+ function re({ nodes: e, columnCount: t, top: n, bottom: r, formatValue: i, isLit: a }) {
351
362
  let o = Array.from({ length: t }, (t, n) => e.filter((e) => e.column === n));
352
- return /* @__PURE__ */ g("g", { children: o.map((e, o) => {
353
- let s = o === 0 && t > 1, l = u({
363
+ return /* @__PURE__ */ _("g", { children: o.map((e, o) => {
364
+ let s = o === 0 && t > 1, c = d({
354
365
  positions: e.map((e) => e.y + e.height / 2),
355
- gap: I,
366
+ gap: R,
356
367
  start: n,
357
368
  end: r
358
369
  });
359
- return e.map((e, t) => /* @__PURE__ */ _("text", {
360
- x: s ? e.x - F : e.x + 12 + F,
361
- y: l[t] ?? e.y,
370
+ return e.map((e, t) => /* @__PURE__ */ v("text", {
371
+ x: s ? e.x - L : e.x + 12 + L,
372
+ y: c[t] ?? e.y,
362
373
  textAnchor: s ? "end" : "start",
363
374
  dominantBaseline: "middle",
364
- ...f.props(c.label, c.haloLabel, j.transition, !a(e) && j.dim),
375
+ ...p.props(l.label, l.haloLabel, N.transition, !a(e) && N.dim),
365
376
  children: [
366
- /* @__PURE__ */ g("tspan", {
367
- ...f.props(c.strongLabel),
377
+ /* @__PURE__ */ _("tspan", {
378
+ ...p.props(l.strongLabel),
368
379
  children: W(e.node.label)
369
380
  }),
370
381
  " ",
@@ -449,54 +460,54 @@ var Y = {
449
460
  kInvED: "x2ssjo2",
450
461
  $$css: !0
451
462
  }
452
- }, Z = 256, Q = 1024, ne = 256, $ = 8192;
453
- function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v = [], width: y, height: b, selection: x, emptyLabel: S }) {
454
- let C = r({
455
- title: o,
463
+ }, Z = 256, Q = 1024, ie = 256, $ = 8192;
464
+ function ae({ title: t, report: s, description: l, nodes: u, edges: d, groups: f = [], width: y, height: b, selection: x, emptyLabel: S }) {
465
+ let C = i({
466
+ title: t,
456
467
  selection: x,
457
468
  items: u.map((e) => ({
458
469
  id: e.id,
459
470
  label: [e.label, e.description].filter((e) => e !== void 0).join(", ")
460
471
  }))
461
- }), w = m(), T = ie({
472
+ }), w = h(), T = oe({
462
473
  nodes: u,
463
474
  edges: d,
464
- groups: v,
475
+ groups: f,
465
476
  width: y,
466
477
  height: b
467
478
  });
468
- if (T !== null) return /* @__PURE__ */ g(s, {
469
- title: o,
470
- report: c,
479
+ if (T !== null) return /* @__PURE__ */ _(c, {
480
+ title: t,
481
+ report: s,
471
482
  description: l,
472
483
  message: T
473
484
  });
474
- let E = new Map(u.map((e) => [e.id, e])), D = ae(d, E), O = u.length > 0;
475
- return D === null ? /* @__PURE__ */ g(s, {
476
- title: o,
477
- report: c,
485
+ let E = new Map(u.map((e) => [e.id, e])), D = se(d, E), O = u.length > 0;
486
+ return D === null ? /* @__PURE__ */ _(c, {
487
+ title: t,
488
+ report: s,
478
489
  description: l,
479
490
  message: "Every relationship must refer to two supplied nodes."
480
- }) : /* @__PURE__ */ _(a, {
481
- title: o,
482
- report: c,
491
+ }) : /* @__PURE__ */ v(o, {
492
+ title: t,
493
+ report: s,
483
494
  description: l,
484
- footer: /* @__PURE__ */ g(i, {
495
+ footer: /* @__PURE__ */ _(a, {
485
496
  id: C.id,
486
497
  children: C.label ?? "\xA0"
487
498
  }),
488
- children: [O ? /* @__PURE__ */ g(n, {
499
+ children: [O ? /* @__PURE__ */ _(r, {
489
500
  ...C.props,
490
501
  className: "xysyzu8 xzuc9lq xeuugli x1t137rt xmkeg23 x1y0btm7 x1ey3b81 x13qnu6 x19rmrnh x9v5kkp x1bqaal",
491
- children: /* @__PURE__ */ _("div", {
492
- ...f.props(X.canvas(y, b)),
493
- children: [/* @__PURE__ */ _("svg", {
502
+ children: /* @__PURE__ */ v("div", {
503
+ ...p.props(X.canvas(y, b)),
504
+ children: [/* @__PURE__ */ v("svg", {
494
505
  width: y,
495
506
  height: b,
496
507
  "aria-hidden": !0,
497
508
  className: "x10l6tqk x10a8y8t x1lliihq",
498
509
  children: [
499
- /* @__PURE__ */ g("defs", { children: /* @__PURE__ */ g("marker", {
510
+ /* @__PURE__ */ _("defs", { children: /* @__PURE__ */ _("marker", {
500
511
  id: w,
501
512
  markerWidth: 8,
502
513
  markerHeight: 8,
@@ -504,24 +515,24 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
504
515
  refY: 4,
505
516
  orient: "auto",
506
517
  markerUnits: "userSpaceOnUse",
507
- children: /* @__PURE__ */ g("path", {
518
+ children: /* @__PURE__ */ _("path", {
508
519
  d: "M0,0 L8,4 L0,8 Z",
509
520
  className: "x8futc7"
510
521
  })
511
522
  }) }),
512
- v.map((e) => /* @__PURE__ */ _("g", { children: [/* @__PURE__ */ g("rect", {
523
+ f.map((e) => /* @__PURE__ */ v("g", { children: [/* @__PURE__ */ _("rect", {
513
524
  x: e.x,
514
525
  y: e.y,
515
526
  width: e.width,
516
527
  height: e.height,
517
528
  className: "x2wnxhi x13hfdr1 xnpr05h"
518
- }), /* @__PURE__ */ g("svg", {
529
+ }), /* @__PURE__ */ _("svg", {
519
530
  x: e.x,
520
531
  y: e.y,
521
532
  width: e.width,
522
533
  height: e.height,
523
534
  overflow: "hidden",
524
- children: /* @__PURE__ */ g("text", {
535
+ children: /* @__PURE__ */ _("text", {
525
536
  x: 12,
526
537
  y: 20,
527
538
  className: "x1q7gtio x1hz01jw xy8obcc",
@@ -530,34 +541,34 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
530
541
  })] }, e.id)),
531
542
  D.map(({ edge: e, source: t, target: n }) => {
532
543
  let r = t.x < n.x, i = t.x + (r ? t.width : 0), a = n.x + (r ? 0 : n.width), o = t.y + t.height / 2, s = n.y + n.height / 2, c = (i + a) / 2, l = t.x + t.width / 2, u = t.id === n.id ? `M${l - 12},${t.y} C${l - 48},${t.y - 36} ${l + 48},${t.y - 36} ${l + 12},${t.y}` : `M${i},${o} C${c},${o} ${c},${s} ${a},${s}`;
533
- return /* @__PURE__ */ g("path", {
544
+ return /* @__PURE__ */ _("path", {
534
545
  d: u,
535
546
  markerEnd: e.direction === "directed" ? `url(#${w})` : void 0,
536
547
  className: "xbh8q5q x1crw9hw xhr4kjn",
537
- children: /* @__PURE__ */ g("title", { children: e.label })
548
+ children: /* @__PURE__ */ _("title", { children: e.label })
538
549
  }, e.id);
539
550
  })
540
551
  ]
541
552
  }), u.map((t) => {
542
553
  let n = C.label !== void 0 && C.activeId === t.id, r = [
543
- ...v.filter((e) => e.nodeIds.includes(t.id)).map((e) => e.label),
554
+ ...f.filter((e) => e.nodeIds.includes(t.id)).map((e) => e.label),
544
555
  t.label,
545
556
  t.description
546
- ].filter((e) => e !== void 0).join(", "), i = f.props(X.node, X.position(t.x, t.y), X.size(t.width, t.height), X.tone(e[t.tone]), x !== void 0 && X.action, (x?.selectedId === t.id || n) && X.selected), a = /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("span", {
557
+ ].filter((e) => e !== void 0).join(", "), i = p.props(X.node, X.position(t.x, t.y), X.size(t.width, t.height), X.tone(e[t.tone]), x !== void 0 && X.action, (x?.selectedId === t.id || n) && X.selected), a = /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
547
558
  className: "xtqrqnz x1778rvt xk4h15q xb3r6kr xlyipyv xuxw1ft",
548
559
  children: t.label
549
- }), t.description !== void 0 && t.height >= 56 && /* @__PURE__ */ g("span", {
560
+ }), t.description !== void 0 && t.height >= 56 && /* @__PURE__ */ _("span", {
550
561
  className: "xy8obcc xas2l8k x153jb6y xb3r6kr xlyipyv xuxw1ft",
551
562
  children: t.description
552
563
  })] });
553
- return x === void 0 ? /* @__PURE__ */ g("div", {
564
+ return x === void 0 ? /* @__PURE__ */ _("div", {
554
565
  onPointerEnter: () => C.inspect(t.id),
555
566
  role: "group",
556
567
  "aria-label": r,
557
568
  title: r,
558
569
  ...i,
559
570
  children: a
560
- }, t.id) : /* @__PURE__ */ g(p, {
571
+ }, t.id) : /* @__PURE__ */ _(m, {
561
572
  type: "button",
562
573
  tabIndex: -1,
563
574
  onPointerEnter: () => C.inspect(t.id),
@@ -570,11 +581,11 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
570
581
  }, t.id);
571
582
  })]
572
583
  })
573
- }) : /* @__PURE__ */ g("p", {
584
+ }) : /* @__PURE__ */ _("p", {
574
585
  className: "x1ghz6dp x153jb6y",
575
586
  children: S
576
- }), /* @__PURE__ */ g(t, {
577
- label: `${o} graph data`,
587
+ }), /* @__PURE__ */ _(n, {
588
+ label: `${t} graph data`,
578
589
  columns: [{
579
590
  id: "kind",
580
591
  label: "Kind"
@@ -587,7 +598,7 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
587
598
  id: `node:${e.id}`,
588
599
  values: ["Node", [e.label, e.description].filter((e) => e !== void 0).join(", ")]
589
600
  })),
590
- ...v.map((e) => ({
601
+ ...f.map((e) => ({
591
602
  id: `group:${e.id}`,
592
603
  values: ["Group", `${e.label}: ${e.nodeIds.map((e) => E.get(e)?.label).join(", ")}`]
593
604
  })),
@@ -599,11 +610,11 @@ function re({ title: o, report: c, description: l, nodes: u, edges: d, groups: v
599
610
  })]
600
611
  });
601
612
  }
602
- function ie({ nodes: e, edges: t, groups: n, width: r, height: i }) {
613
+ function oe({ nodes: e, edges: t, groups: n, width: r, height: i }) {
603
614
  if (!Number.isFinite(r) || r <= 0 || r > 8192 || !Number.isFinite(i) || i <= 0 || i > 8192) return `Graph dimensions must be finite, positive, and at most ${$} pixels.`;
604
615
  if (e.length > 256 || t.length > 1024 || n.length > 256) return `This graph exceeds the render limit of 256 nodes, ${Q} relationships, or 256 groups. Supply a smaller, labelled neighborhood.`;
605
616
  let a = new Set(e.map((e) => e.id));
606
- return !o(e) || !o(t) || !o(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
617
+ return !s(e) || !s(t) || !s(n) ? "Graph nodes, relationships, and groups must have unique identifiers." : [...e, ...n].some((e) => {
607
618
  if (!Number.isFinite(e.width) || !Number.isFinite(e.height) || e.width <= 0 || e.height <= 0) return !0;
608
619
  let t = !Number.isFinite(e.x) || e.x < 0 || e.x + e.width > r, n = !Number.isFinite(e.y) || e.y < 0 || e.y + e.height > i;
609
620
  return t || n;
@@ -614,7 +625,7 @@ function ie({ nodes: e, edges: t, groups: n, width: r, height: i }) {
614
625
  return i || a;
615
626
  })) ? "A group box must contain the node boxes assigned to it." : null;
616
627
  }
617
- function ae(e, t) {
628
+ function se(e, t) {
618
629
  let n = [];
619
630
  for (let r of e) {
620
631
  let e = t.get(r.sourceId), i = t.get(r.targetId);
@@ -627,4 +638,4 @@ function ae(e, t) {
627
638
  }
628
639
  return n;
629
640
  }
630
- export { J as FlowDiagram, N as MAX_FLOW_LINKS, M as MAX_FLOW_NODES, $ as MAX_RELATION_DIMENSION, Q as MAX_RELATION_EDGES, ne as MAX_RELATION_GROUPS, Z as MAX_RELATION_NODES, re as RelationGraph };
641
+ export { J as FlowDiagram, F as MAX_FLOW_LINKS, P as MAX_FLOW_NODES, $ as MAX_RELATION_DIMENSION, Q as MAX_RELATION_EDGES, ie as MAX_RELATION_GROUPS, Z as MAX_RELATION_NODES, ae as RelationGraph };