@belonguniverseai/react-sdk 0.6.2 → 0.6.3

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 (78) hide show
  1. package/dist/api/agent-grants.d.ts +6 -0
  2. package/dist/api/client.d.ts +30 -1
  3. package/dist/app/call-summary.d.ts +30 -0
  4. package/dist/component/abnfDiagram-N423BO3Z-C1O9dfJJ.js +90 -0
  5. package/dist/component/arc-Cpnt_LFj.js +86 -0
  6. package/dist/component/{architectureDiagram-3BPJPVTR-DYcaPx2M.js → architectureDiagram-T3A2C74G-iakL6yUj.js} +1872 -1785
  7. package/dist/component/{blockDiagram-GPEHLZMM-BdjruLO5.js → blockDiagram-VBNYF7ZC-D7t0jIvW.js} +895 -894
  8. package/dist/component/{c4Diagram-AAUBKEIU-Bd2ebSgB.js → c4Diagram-5PPSVZJV-CRX1o0CJ.js} +3 -3
  9. package/dist/component/{channel-CYFijF_t.js → channel-DnM50Ep0.js} +2 -2
  10. package/dist/component/{chunk-ND2GUHAM-OX1-DIU1.js → chunk-2GRJ4B5K-ChTMjM-v.js} +5 -5
  11. package/dist/component/{chunk-QZHKN3VN-DLQ8oUCc.js → chunk-2Q5K7J3B-F2Rpvtwm.js} +2 -2
  12. package/dist/component/{chunk-AQP2D5EJ-D4G4syYu.js → chunk-5RXB4S5H-B1WLx-ex.js} +399 -378
  13. package/dist/component/{chunk-FMBD7UC4-CbRxWx_A.js → chunk-5VM5RSS4-D35VMAuN.js} +2 -2
  14. package/dist/component/chunk-6Q2QTUOP-DGVp_gyk.js +673 -0
  15. package/dist/component/{chunk-727SXJPM-A5r5oL1_.js → chunk-GF5L2VYU-CZOQEv_q.js} +244 -239
  16. package/dist/component/{chunk-4BX2VUAB-DVpS0I_p.js → chunk-JWPE2WC7-BbwyDj9g.js} +2 -2
  17. package/dist/component/{chunk-2J33WTMH-B06Y_xVy.js → chunk-KBJHAD2P-B9qL0VLM.js} +2 -2
  18. package/dist/component/chunk-RYQCIY6F-5eaMbXXL.js +316 -0
  19. package/dist/component/{chunk-55IACEB6-DmZctFkK.js → chunk-XXDRQBXY-XJadTIK5.js} +2 -2
  20. package/dist/component/{classDiagram-4FO5ZUOK-4S9mdFC1.js → classDiagram-JCYQIIEL-DVaEk7uT.js} +3 -3
  21. package/dist/component/{classDiagram-v2-Q7XG4LA2-4S9mdFC1.js → classDiagram-v2-OCEON4UE-DVaEk7uT.js} +3 -3
  22. package/dist/component/{cose-bilkent-S5V4N54A-BIrVaakt.js → cose-bilkent-JH36ORCC-DZA30AqI.js} +2 -2
  23. package/dist/component/{wardley-L42UT6IY-HA1eSIS_.js → cynefin-VYW2F7L2-DAyxamLw.js} +9199 -7918
  24. package/dist/component/cynefinDiagram-MW4NZA55-CutZScTQ.js +302 -0
  25. package/dist/component/dagre-VZM6K2ZE-CelPLP8N.js +343 -0
  26. package/dist/component/diagram-7IWD3JNH-Cr5piwKc.js +353 -0
  27. package/dist/component/{diagram-KO2AKTUF-Da1E68Eo.js → diagram-B4RE2ZJO-DgLNdZkh.js} +24 -24
  28. package/dist/component/{diagram-LMA3HP47-dRbk5sBa.js → diagram-LBJQPF4R-DxeIMTjN.js} +23 -23
  29. package/dist/component/{diagram-OG6HWLK6-CcKT8mhn.js → diagram-Q27KOJAE-WACyk_gr.js} +197 -197
  30. package/dist/component/diagram-UB23O5K3-DbhVYU5T.js +222 -0
  31. package/dist/component/ebnfDiagram-BXEA7PRR-DoGrYW10.js +112 -0
  32. package/dist/component/{erDiagram-TEJ5UH35-3ATYT9J-.js → erDiagram-JOGREHBK-BgewA6fH.js} +142 -131
  33. package/dist/component/{flowDiagram-I6XJVG4X-D9PLm9Od.js → flowDiagram-UKHOOZJN-1YmYJYcE.js} +268 -258
  34. package/dist/component/ganttDiagram-PKOTCBZU-BFAEPYkH.js +2714 -0
  35. package/dist/component/{gitGraphDiagram-PVQCEYII-13gVhAGc.js → gitGraphDiagram-DS77QQ5N-CSiPuE-l.js} +33 -33
  36. package/dist/component/{graph-BZLHvygk.js → graph-CWpEkm4G.js} +35 -35
  37. package/dist/component/{highlighted-body-OFNGDK62-DCxRI4UV.js → highlighted-body-OFNGDK62-CSJNGt18.js} +2 -2
  38. package/dist/component/index.js +2 -2
  39. package/dist/component/{infoDiagram-5YYISTIA-DymxA7AN.js → infoDiagram-6WML65LV-CoMVfONe.js} +4 -4
  40. package/dist/component/{ishikawaDiagram-YF4QCWOH-C3sTn76C.js → ishikawaDiagram-WSZJBQD7-B2YEkQ4b.js} +27 -27
  41. package/dist/component/{journeyDiagram-JHISSGLW-Cq0hOAfJ.js → journeyDiagram-NVQOT4AX-B7b5ZwlF.js} +5 -5
  42. package/dist/component/{kanban-definition-UN3LZRKU-5tBWjkp7.js → kanban-definition-27J2QSJJ-C9GPAsBR.js} +35 -35
  43. package/dist/component/layout-Br2UjHRU.js +1522 -0
  44. package/dist/component/{linear-BT4blD8s.js → linear-Bi0C-9d1.js} +13 -13
  45. package/dist/component/map-CdwokNh2.js +227 -0
  46. package/dist/component/{mermaid-GHXKKRXX-DXPXjnb7.js → mermaid-GHXKKRXX-BaBCeViM.js} +25220 -24784
  47. package/dist/component/{mindmap-definition-RKZ34NQL-DO-OuAQQ.js → mindmap-definition-FAOFIHXS-tHIAo7Ms.js} +26 -26
  48. package/dist/component/pegDiagram-VL7TDLO6-Db_7lLRV.js +98 -0
  49. package/dist/component/pieDiagram-7S7Q4E2Y-C4fs4XCK.js +210 -0
  50. package/dist/component/{quadrantDiagram-W4KKPZXB-CaJWg9ep.js → quadrantDiagram-CIZ2JOQS-Bw7vXO0q.js} +14 -15
  51. package/dist/component/railroadDiagram-AXF67PYL-kY0VoZEg.js +80 -0
  52. package/dist/component/{requirementDiagram-4Y6WPE33-CmZrtZqe.js → requirementDiagram-LRYGKXZP-BkNtSZm5.js} +15 -15
  53. package/dist/component/{sankeyDiagram-5OEKKPKP-Cp95M1aj.js → sankeyDiagram-W5VNT64P-BK_C1BYE.js} +2 -2
  54. package/dist/component/{sequenceDiagram-3UESZ5HK-C0x0WvhR.js → sequenceDiagram-SI44F4Z6-CEmgVZaE.js} +960 -963
  55. package/dist/component/sizeCapture-X5ZJPWSS-J5ZNXT4c.js +49 -0
  56. package/dist/component/{stateDiagram-AJRCARHV-H10vaGL3.js → stateDiagram-OKZ733FA-DrwrNuNs.js} +5 -5
  57. package/dist/component/{stateDiagram-v2-BHNVJYJU-rj7ljkc-.js → stateDiagram-v2-UEYNNEHI-DHD85VTD.js} +3 -3
  58. package/dist/component/swimlanes-SLNWSIFB-FOK5tys1.js +5335 -0
  59. package/dist/component/swimlanesDiagram-ULZ7WXOC-edTvZTge.js +16 -0
  60. package/dist/component/{timeline-definition-PNZ67QCA-Cil1QaqZ.js → timeline-definition-Z64GVDOM-Cc4fTsjY.js} +15 -15
  61. package/dist/component/vennDiagram-T6HMQDX7-DYZl8srI.js +1581 -0
  62. package/dist/component/{wardleyDiagram-YWT4CUSO-Xq5Hnmio.js → wardleyDiagram-T6FBY63Y-BEvv3PjS.js} +15 -15
  63. package/dist/component/{xychartDiagram-2RQKCTM6-dinwR4Zm.js → xychartDiagram-ELKLHX3M-79AgTtk-.js} +464 -418
  64. package/dist/embed/voice/line-slots.d.ts +37 -2
  65. package/dist/embed/voice-call.d.ts +12 -0
  66. package/dist/i18n/messages/en.d.ts +1 -2
  67. package/dist/lib/web-storage.d.ts +8 -0
  68. package/dist/stream/stream-state-store.d.ts +13 -0
  69. package/dist/types/public.d.ts +3 -0
  70. package/package.json +1 -1
  71. package/dist/component/arc-TLcl3N8_.js +0 -86
  72. package/dist/component/dagre-BM42HDAG-BoPUzTvD.js +0 -448
  73. package/dist/component/diagram-2AECGRRQ-PIXCGxIt.js +0 -220
  74. package/dist/component/diagram-5GNKFQAL-CbJxbGBh.js +0 -126
  75. package/dist/component/ganttDiagram-6RSMTGT7-F_XUzD1p.js +0 -2709
  76. package/dist/component/layout-Bu6nRdWm.js +0 -1731
  77. package/dist/component/pieDiagram-4H26LBE5-BkEktPwZ.js +0 -166
  78. package/dist/component/vennDiagram-CIIHVFJN-Dk8PKmfb.js +0 -1560
@@ -19,11 +19,40 @@
19
19
  * switch must not hand a slot from workspace A to a session that actually
20
20
  * belongs to workspace B.
21
21
  *
22
- * localStorage is a perimeter: the persisted bag is zod-validated on read and
22
+ * TAB isolation multi-tab), the same two tiers and the same rules
23
+ * `stream-state-store.ts` uses for the session pointer:
24
+ *
25
+ * • AUTHORITATIVE bag → `sessionStorage` (PER TAB). What this tab's rail
26
+ * rehydrates from, `runId`s included. Survives a same-tab reload (§41),
27
+ * invisible to every other tab.
28
+ * • SEED → `localStorage` (SHARED). The same bag with every `runId` stripped.
29
+ * A brand-new tab with no bag of its own adopts it ONCE so it comes up
30
+ * holding the user's agents (today's UX, and what a returning visitor
31
+ * expects after closing the browser).
32
+ *
33
+ * The tiers exist because the rail used to live entirely in `localStorage`,
34
+ * which made three tabs of one workspace share ONE set of bindings. Whichever
35
+ * tab last moved an agent silently re-pointed every other tab's rail;
36
+ * `closeAgentLine` wiped the agent everywhere at once; and a boot
37
+ * `reattachPendingLineRuns()` (BelongDock) could open a reader — one that also
38
+ * drives host route navigation — against a `runId` a DIFFERENT tab was
39
+ * driving. Field report (Simetrik, 2026-08-05): "al cerrar el agente o
40
+ * intentar abrir el mismo chat en otra pestaña … el contenido no se carga
41
+ * correctamente — mostrando el contenido de otro chat activo".
42
+ *
43
+ * Stripping `runId` from the seed is what makes cross-tab adoption safe: a
44
+ * brand-new tab inherits WHO the agents are, never a live run it owns no
45
+ * reader for. A genuine same-tab reload still rehydrates its own in-flight
46
+ * runs, because it reads its own `sessionStorage` bag rather than the seed.
47
+ *
48
+ * Web Storage is a perimeter: the persisted bag is zod-validated on read and
23
49
  * any junk (corrupted JSON, wrong shape, storage disabled) degrades to "no
24
50
  * slots" — the switchboard just starts fresh, same as a first-ever call. The
25
51
  * schema is back-compatible with the pre-line-1 bag: a persisted object with
26
52
  * only `line2`/`line3` still parses fine, `line1` just defaults to `null`.
53
+ * It is also back-compatible ACROSS this change: an existing localStorage bag
54
+ * is exactly what the seed looks like, so an upgrading tab adopts the agents
55
+ * it already had.
27
56
  *
28
57
  * `runId` (F3/R4 — reload must not lie about a still-running background
29
58
  * line): the durable half of `bindLineRun`'s in-memory tracking, written by
@@ -98,6 +127,12 @@ export declare const readAllLineSlots: () => readonly {
98
127
  readonly line: SlotLine;
99
128
  readonly slot: LineSlot;
100
129
  }[];
101
- /** Test-only: drop every persisted slot for the current workspace scope. */
130
+ /** Test-only: drop every persisted slot for the current workspace scope, in
131
+ * BOTH tiers, and forget this realm's provenance/seed bookkeeping — so the
132
+ * next read behaves like a brand-new tab with nothing to adopt. */
102
133
  export declare const __clearLineSlotsForTest: () => void;
134
+ /** Test-only: re-mint this module's PAGE-REALM state (provenance + seed cache)
135
+ * without touching Web Storage, so a test can model a fresh page load while
136
+ * choosing for itself which storage tiers carry over. */
137
+ export declare const __resetLineSlotsProvenanceForTest: () => void;
103
138
  export {};
@@ -36,6 +36,18 @@ export type CallState = {
36
36
  readonly assistantCaption: string;
37
37
  /** True from a send_to_belong_agent dispatch until its reply is delivered. */
38
38
  readonly agentBusy: boolean;
39
+ /**
40
+ * What the agent was ASKED to do, verbatim, from dispatch until the run
41
+ * reaches a terminal state; `null` when nothing is in flight.
42
+ *
43
+ * State rather than a timeline row on purpose. It is the summary card's
44
+ * HEADLINE, so a row saying the same thing rendered it twice on one screen —
45
+ * and it counted toward "Worked · N steps", which must count what the agent
46
+ * DID, not what it was asked. Stored WHOLE and untrimmed (the exact string
47
+ * the delegate listeners got): the card truncates for display in CSS, and
48
+ * `callSummary` blank-guards it.
49
+ */
50
+ readonly currentRequest: string | null;
39
51
  /** Current tool phase of the delegated run (drives the orb's work badge). */
40
52
  readonly workPhase: "coding" | "files" | "actions" | null;
41
53
  /** True while the voice model is producing a spoken response. */
@@ -535,8 +535,7 @@ export declare const en: {
535
535
  readonly lineFailed: "Couldn't finish";
536
536
  readonly lineIdle: "Ready";
537
537
  readonly activity: "Activity";
538
- readonly showConversationLog: "Show what was said";
539
- readonly hideConversationLog: "Hide what was said";
538
+ readonly conversation: "Conversation";
540
539
  readonly ambientTypingCode: "Typing code…";
541
540
  readonly ambientReviewingDiff: "Reviewing the diff…";
542
541
  readonly ambientRunningChecks: "Running checks…";
@@ -0,0 +1,8 @@
1
+ /** The small Web Storage surface used by the SDK's durable browser state. */
2
+ type WebStorage = Pick<Storage, "getItem" | "setItem" | "removeItem">;
3
+ export declare const getSessionStorage: () => WebStorage | null;
4
+ export declare const getLocalStorage: () => WebStorage | null;
5
+ export declare const readWebStorage: (store: WebStorage | null, key: string) => string | null;
6
+ export declare const writeWebStorage: (store: WebStorage | null, key: string, value: string) => void;
7
+ export declare const removeWebStorage: (store: WebStorage | null, key: string) => void;
8
+ export {};
@@ -23,6 +23,19 @@ export declare const peekGenerationLostSession: () => string | null;
23
23
  * consumed, or superseded by a newer loss) — a stale reconciler can never
24
24
  * clear a loss it did not actually adopt. */
25
25
  export declare const consumeGenerationLostSession: (sessionId: string) => void;
26
+ /**
27
+ * May per-tab state found at the FIRST read of this page realm keep a live run
28
+ * id? True only for a navigation that PROVES the writing realm is gone (a
29
+ * genuine reload, bfcache/back-forward, or an environment with no Performance
30
+ * API to ask). A `navigate` load is what "Duplicate Tab" performs, and the
31
+ * original tab is still there consuming its own runs.
32
+ *
33
+ * Exported because `sessionStorage` now carries TWO per-tab tiers that both
34
+ * name live runs — the session pointer + parked cursors here, and the rail's
35
+ * agent-line slots (`embed/voice/line-slots.ts`). One duplicate-tab rule for
36
+ * both, so a clone can never double-attach to a run from either direction.
37
+ */
38
+ export declare const mayKeepClonedRunIds: () => boolean;
26
39
  /**
27
40
  * The tab's active stream state.
28
41
  *
@@ -246,6 +246,9 @@ export type BelongGlobal = {
246
246
  userCaption?: string;
247
247
  assistantCaption?: string;
248
248
  agentBusy?: boolean;
249
+ /** What the agent was ASKED to do — the call summary card's headline when
250
+ * no plan step is in flight. State, not a timeline row. */
251
+ currentRequest?: string | null;
249
252
  workPhase?: "coding" | "files" | "actions" | null;
250
253
  speaking?: boolean;
251
254
  thinking?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belonguniverseai/react-sdk",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Belong — embeddable React AI assistant dock. Mount <BelongWidget> in your app tree with getToken dependency-injection auth.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,86 +0,0 @@
1
- import { O as ln, P as an, Q as g, S as on, T as Z, V as w, W as _, X as sn, Y as rn, Z as z, $ as t, a0 as V, a1 as un, a2 as tn, a3 as fn } from "./mermaid-GHXKKRXX-DXPXjnb7.js";
2
- globalThis.process = globalThis.process || { env: {} };
3
- globalThis.global = globalThis.global || globalThis;
4
- function cn(l) {
5
- return l.innerRadius;
6
- }
7
- function gn(l) {
8
- return l.outerRadius;
9
- }
10
- function yn(l) {
11
- return l.startAngle;
12
- }
13
- function pn(l) {
14
- return l.endAngle;
15
- }
16
- function dn(l) {
17
- return l && l.padAngle;
18
- }
19
- function hn(l, x, q, O, v, T, W, a) {
20
- var D = q - l, u = O - x, n = W - v, p = a - T, s = p * D - n * u;
21
- if (!(s * s < g))
22
- return s = (n * (x - T) - p * (l - v)) / s, [l + s * D, x + s * u];
23
- }
24
- function J(l, x, q, O, v, T, W) {
25
- var a = l - q, D = x - O, u = (W ? T : -T) / z(a * a + D * D), n = u * D, p = -u * a, s = l + n, i = x + p, f = q + n, c = O + p, X = (s + f) / 2, o = (i + c) / 2, d = f - s, y = c - i, A = d * d + y * y, R = v - T, b = s * c - f * i, E = (y < 0 ? -1 : 1) * z(fn(0, R * R * A - b * b)), I = (b * y - d * E) / A, Q = (-b * d - y * E) / A, P = (b * y + d * E) / A, h = (-b * d + y * E) / A, m = I - X, e = Q - o, r = P - X, Y = h - o;
26
- return m * m + e * e > r * r + Y * Y && (I = P, Q = h), {
27
- cx: I,
28
- cy: Q,
29
- x01: -n,
30
- y01: -p,
31
- x11: I * (v / R - 1),
32
- y11: Q * (v / R - 1)
33
- };
34
- }
35
- function xn() {
36
- var l = cn, x = gn, q = V(0), O = null, v = yn, T = pn, W = dn, a = null, D = ln(u);
37
- function u() {
38
- var n, p, s = +l.apply(this, arguments), i = +x.apply(this, arguments), f = v.apply(this, arguments) - an, c = T.apply(this, arguments) - an, X = sn(c - f), o = c > f;
39
- if (a || (a = n = D()), i < s && (p = i, i = s, s = p), !(i > g)) a.moveTo(0, 0);
40
- else if (X > on - g)
41
- a.moveTo(i * Z(f), i * w(f)), a.arc(0, 0, i, f, c, !o), s > g && (a.moveTo(s * Z(c), s * w(c)), a.arc(0, 0, s, c, f, o));
42
- else {
43
- var d = f, y = c, A = f, R = c, b = X, E = X, I = W.apply(this, arguments) / 2, Q = I > g && (O ? +O.apply(this, arguments) : z(s * s + i * i)), P = _(sn(i - s) / 2, +q.apply(this, arguments)), h = P, m = P, e, r;
44
- if (Q > g) {
45
- var Y = un(Q / s * w(I)), B = un(Q / i * w(I));
46
- (b -= Y * 2) > g ? (Y *= o ? 1 : -1, A += Y, R -= Y) : (b = 0, A = R = (f + c) / 2), (E -= B * 2) > g ? (B *= o ? 1 : -1, d += B, y -= B) : (E = 0, d = y = (f + c) / 2);
47
- }
48
- var $ = i * Z(d), j = i * w(d), C = s * Z(R), F = s * w(R);
49
- if (P > g) {
50
- var G = i * Z(y), H = i * w(y), K = s * Z(A), L = s * w(A), S;
51
- if (X < rn)
52
- if (S = hn($, j, K, L, G, H, C, F)) {
53
- var M = $ - S[0], N = j - S[1], U = G - S[0], k = H - S[1], nn = 1 / w(tn((M * U + N * k) / (z(M * M + N * N) * z(U * U + k * k))) / 2), en = z(S[0] * S[0] + S[1] * S[1]);
54
- h = _(P, (s - en) / (nn - 1)), m = _(P, (i - en) / (nn + 1));
55
- } else
56
- h = m = 0;
57
- }
58
- E > g ? m > g ? (e = J(K, L, $, j, i, m, o), r = J(G, H, C, F, i, m, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), m < P ? a.arc(e.cx, e.cy, m, t(e.y01, e.x01), t(r.y01, r.x01), !o) : (a.arc(e.cx, e.cy, m, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, i, t(e.cy + e.y11, e.cx + e.x11), t(r.cy + r.y11, r.cx + r.x11), !o), a.arc(r.cx, r.cy, m, t(r.y11, r.x11), t(r.y01, r.x01), !o))) : (a.moveTo($, j), a.arc(0, 0, i, d, y, !o)) : a.moveTo($, j), !(s > g) || !(b > g) ? a.lineTo(C, F) : h > g ? (e = J(C, F, G, H, s, -h, o), r = J($, j, K, L, s, -h, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), h < P ? a.arc(e.cx, e.cy, h, t(e.y01, e.x01), t(r.y01, r.x01), !o) : (a.arc(e.cx, e.cy, h, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, s, t(e.cy + e.y11, e.cx + e.x11), t(r.cy + r.y11, r.cx + r.x11), o), a.arc(r.cx, r.cy, h, t(r.y11, r.x11), t(r.y01, r.x01), !o))) : a.arc(0, 0, s, R, A, o);
59
- }
60
- if (a.closePath(), n) return a = null, n + "" || null;
61
- }
62
- return u.centroid = function() {
63
- var n = (+l.apply(this, arguments) + +x.apply(this, arguments)) / 2, p = (+v.apply(this, arguments) + +T.apply(this, arguments)) / 2 - rn / 2;
64
- return [Z(p) * n, w(p) * n];
65
- }, u.innerRadius = function(n) {
66
- return arguments.length ? (l = typeof n == "function" ? n : V(+n), u) : l;
67
- }, u.outerRadius = function(n) {
68
- return arguments.length ? (x = typeof n == "function" ? n : V(+n), u) : x;
69
- }, u.cornerRadius = function(n) {
70
- return arguments.length ? (q = typeof n == "function" ? n : V(+n), u) : q;
71
- }, u.padRadius = function(n) {
72
- return arguments.length ? (O = n == null ? null : typeof n == "function" ? n : V(+n), u) : O;
73
- }, u.startAngle = function(n) {
74
- return arguments.length ? (v = typeof n == "function" ? n : V(+n), u) : v;
75
- }, u.endAngle = function(n) {
76
- return arguments.length ? (T = typeof n == "function" ? n : V(+n), u) : T;
77
- }, u.padAngle = function(n) {
78
- return arguments.length ? (W = typeof n == "function" ? n : V(+n), u) : W;
79
- }, u.context = function(n) {
80
- return arguments.length ? (a = n ?? null, u) : a;
81
- }, u;
82
- }
83
- export {
84
- xn as d
85
- };
86
- //# sourceMappingURL=arc-TLcl3N8_.js.map
@@ -1,448 +0,0 @@
1
- import { _ as w, aY as _, aZ as Y, a_ as F, a$ as j, l as i, c as H, b0 as V, b1 as $, al as U, aT as Z, am as P, ak as q, b2 as z, b3 as K, b4 as Q } from "./mermaid-GHXKKRXX-DXPXjnb7.js";
2
- import { i as N, G as k } from "./graph-BZLHvygk.js";
3
- import { b as W, m as B, l as I } from "./layout-Bu6nRdWm.js";
4
- globalThis.process = globalThis.process || { env: {} };
5
- globalThis.global = globalThis.global || globalThis;
6
- var ee = 4;
7
- function ne(e) {
8
- return W(e, ee);
9
- }
10
- function v(e) {
11
- var t = {
12
- options: {
13
- directed: e.isDirected(),
14
- multigraph: e.isMultigraph(),
15
- compound: e.isCompound()
16
- },
17
- nodes: te(e),
18
- edges: se(e)
19
- };
20
- return N(e.graph()) || (t.value = ne(e.graph())), t;
21
- }
22
- function te(e) {
23
- return B(e.nodes(), function(t) {
24
- var n = e.node(t), a = e.parent(t), r = { v: t };
25
- return N(n) || (r.value = n), N(a) || (r.parent = a), r;
26
- });
27
- }
28
- function se(e) {
29
- return B(e.edges(), function(t) {
30
- var n = e.edge(t), a = { v: t.v, w: t.w };
31
- return N(t.name) || (a.name = t.name), N(n) || (a.value = n), a;
32
- });
33
- }
34
- var d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ w(() => {
35
- y.clear(), R.clear(), d.clear();
36
- }, "clear"), D = /* @__PURE__ */ w((e, t) => {
37
- const n = y.get(t) || [];
38
- return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
39
- }, "isDescendant"), re = /* @__PURE__ */ w((e, t) => {
40
- const n = y.get(t) || [];
41
- return i.info("Descendants of ", t, " is ", n), i.info("Edge is ", e), e.v === t || e.w === t ? !1 : n ? n.includes(e.v) || D(e.v, t) || D(e.w, t) || n.includes(e.w) : (i.debug("Tilt, ", t, ",not in descendants"), !1);
42
- }, "edgeInCluster"), A = /* @__PURE__ */ w((e, t, n, a) => {
43
- i.warn(
44
- "Copying children of ",
45
- e,
46
- "root",
47
- a,
48
- "data",
49
- t.node(e),
50
- a
51
- );
52
- const r = t.children(e) || [];
53
- e !== a && r.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", r), r.forEach((o) => {
54
- if (t.children(o).length > 0)
55
- A(o, t, n, a);
56
- else {
57
- const l = t.node(o);
58
- i.info("cp ", o, " to ", a, " with parent ", e), n.setNode(o, l), a !== t.parent(o) && (i.warn("Setting parent", o, t.parent(o)), n.setParent(o, t.parent(o))), e !== a && o !== e ? (i.debug("Setting parent", o, e), n.setParent(o, e)) : (i.info("In copy ", e, "root", a, "data", t.node(e), a), i.debug(
59
- "Not Setting parent for node=",
60
- o,
61
- "cluster!==rootId",
62
- e !== a,
63
- "node!==clusterId",
64
- o !== e
65
- ));
66
- const u = t.edges(o);
67
- i.debug("Copying Edges", u), u.forEach((c) => {
68
- i.info("Edge", c);
69
- const h = t.edge(c.v, c.w, c.name);
70
- i.info("Edge data", h, a);
71
- try {
72
- re(c, a) ? (i.info("Copying as ", c.v, c.w, h, c.name), n.setEdge(c.v, c.w, h, c.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
73
- "Skipping copy of edge ",
74
- c.v,
75
- "-->",
76
- c.w,
77
- " rootId: ",
78
- a,
79
- " clusterId:",
80
- e
81
- );
82
- } catch (m) {
83
- i.error(m);
84
- }
85
- });
86
- }
87
- i.debug("Removing node", o), t.removeNode(o);
88
- });
89
- }, "copy"), G = /* @__PURE__ */ w((e, t) => {
90
- const n = t.children(e);
91
- let a = [...n];
92
- for (const r of n)
93
- R.set(r, e), a = [...a, ...G(r, t)];
94
- return a;
95
- }, "extractDescendants"), oe = /* @__PURE__ */ w((e, t, n) => {
96
- const a = e.edges().filter((c) => c.v === t || c.w === t), r = e.edges().filter((c) => c.v === n || c.w === n), o = a.map((c) => ({ v: c.v === t ? n : c.v, w: c.w === t ? t : c.w })), l = r.map((c) => ({ v: c.v, w: c.w }));
97
- return o.filter((c) => l.some((h) => c.v === h.v && c.w === h.w));
98
- }, "findCommonEdges"), C = /* @__PURE__ */ w((e, t, n) => {
99
- const a = t.children(e);
100
- if (i.trace("Searching children of id ", e, a), a.length < 1)
101
- return e;
102
- let r;
103
- for (const o of a) {
104
- const l = C(o, t, n), u = oe(t, n, l);
105
- if (l)
106
- if (u.length > 0)
107
- r = l;
108
- else
109
- return l;
110
- }
111
- return r;
112
- }, "findNonClusterChild"), T = /* @__PURE__ */ w((e) => !d.has(e) || !d.get(e).externalConnections ? e : d.has(e) ? d.get(e).id : e, "getAnchorId"), ae = /* @__PURE__ */ w((e, t) => {
113
- if (!e || t > 10) {
114
- i.debug("Opting out, no graph ");
115
- return;
116
- } else
117
- i.debug("Opting in, graph ");
118
- e.nodes().forEach(function(n) {
119
- e.children(n).length > 0 && (i.warn(
120
- "Cluster identified",
121
- n,
122
- " Replacement id in edges: ",
123
- C(n, e, n)
124
- ), y.set(n, G(n, e)), d.set(n, { id: C(n, e, n), clusterData: e.node(n) }));
125
- }), e.nodes().forEach(function(n) {
126
- const a = e.children(n), r = e.edges();
127
- a.length > 0 ? (i.debug("Cluster identified", n, y), r.forEach((o) => {
128
- const l = D(o.v, n), u = D(o.w, n);
129
- l ^ u && (i.warn("Edge: ", o, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", y.get(n)), d.get(n).externalConnections = !0);
130
- })) : i.debug("Not a cluster ", n, y);
131
- });
132
- for (let n of d.keys()) {
133
- const a = d.get(n).id, r = e.parent(a);
134
- r !== n && d.has(r) && !d.get(r).externalConnections && (d.get(n).id = r);
135
- }
136
- e.edges().forEach(function(n) {
137
- const a = e.edge(n);
138
- i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
139
- let r = n.v, o = n.w;
140
- if (i.warn(
141
- "Fix XXX",
142
- d,
143
- "ids:",
144
- n.v,
145
- n.w,
146
- "Translating: ",
147
- d.get(n.v),
148
- " --- ",
149
- d.get(n.w)
150
- ), d.get(n.v) || d.get(n.w)) {
151
- if (i.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), r = T(n.v), o = T(n.w), e.removeEdge(n.v, n.w, n.name), r !== n.v) {
152
- const l = e.parent(r);
153
- d.get(l).externalConnections = !0, a.fromCluster = n.v;
154
- }
155
- if (o !== n.w) {
156
- const l = e.parent(o);
157
- d.get(l).externalConnections = !0, a.toCluster = n.w;
158
- }
159
- i.warn("Fix Replacing with XXX", r, o, n.name), e.setEdge(r, o, a, n.name);
160
- }
161
- }), i.warn("Adjusted Graph", v(e)), J(e, 0), i.trace(d);
162
- }, "adjustClustersAndEdges"), J = /* @__PURE__ */ w((e, t) => {
163
- if (i.warn("extractor - ", t, v(e), e.children("D")), t > 10) {
164
- i.error("Bailing out");
165
- return;
166
- }
167
- let n = e.nodes(), a = !1;
168
- for (const r of n) {
169
- const o = e.children(r);
170
- a = a || o.length > 0;
171
- }
172
- if (!a) {
173
- i.debug("Done, no node has children", e.nodes());
174
- return;
175
- }
176
- i.debug("Nodes = ", n, t);
177
- for (const r of n)
178
- if (i.debug(
179
- "Extracting node",
180
- r,
181
- d,
182
- d.has(r) && !d.get(r).externalConnections,
183
- !e.parent(r),
184
- e.node(r),
185
- e.children("D"),
186
- " Depth ",
187
- t
188
- ), !d.has(r))
189
- i.debug("Not a cluster", r, t);
190
- else if (!d.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
191
- i.warn(
192
- "Cluster without external connections, without a parent and with children",
193
- r,
194
- t
195
- );
196
- let l = e.graph().rankdir === "TB" ? "LR" : "TB";
197
- d.get(r)?.clusterData?.dir && (l = d.get(r).clusterData.dir, i.warn("Fixing dir", d.get(r).clusterData.dir, l));
198
- const u = new k({
199
- multigraph: !0,
200
- compound: !0
201
- }).setGraph({
202
- rankdir: l,
203
- nodesep: 50,
204
- ranksep: 50,
205
- marginx: 8,
206
- marginy: 8
207
- }).setDefaultEdgeLabel(function() {
208
- return {};
209
- });
210
- i.warn("Old graph before copy", v(e)), A(r, e, u, r), e.setNode(r, {
211
- clusterNode: !0,
212
- id: r,
213
- clusterData: d.get(r).clusterData,
214
- label: d.get(r).label,
215
- graph: u
216
- }), i.warn("New graph after copy node: (", r, ")", v(u)), i.debug("Old graph after copy", v(e));
217
- } else
218
- i.warn(
219
- "Cluster ** ",
220
- r,
221
- " **not meeting the criteria !externalConnections:",
222
- !d.get(r).externalConnections,
223
- " no parent: ",
224
- !e.parent(r),
225
- " children ",
226
- e.children(r) && e.children(r).length > 0,
227
- e.children("D"),
228
- t
229
- ), i.debug(d);
230
- n = e.nodes(), i.warn("New list of nodes", n);
231
- for (const r of n) {
232
- const o = e.node(r);
233
- i.warn(" Now next level", r, o), o?.clusterNode && J(o.graph, t + 1);
234
- }
235
- }, "extractor"), L = /* @__PURE__ */ w((e, t) => {
236
- if (t.length === 0)
237
- return [];
238
- let n = Object.assign([], t);
239
- return t.forEach((a) => {
240
- const r = e.children(a), o = L(e, r);
241
- n = [...n, ...o];
242
- }), n;
243
- }, "sorter"), ce = /* @__PURE__ */ w((e) => L(e, e.children()), "sortNodesByHierarchy"), M = /* @__PURE__ */ w(async (e, t, n, a, r, o) => {
244
- i.warn("Graph in recursive render:XAX", v(t), r);
245
- const l = t.graph().rankdir;
246
- i.trace("Dir in recursive render - dir:", l);
247
- const u = e.insert("g").attr("class", "root");
248
- t.nodes() ? i.info("Recursive render XXX", t.nodes()) : i.info("No nodes found for", t), t.edges().length > 0 && i.info("Recursive edges", t.edge(t.edges()[0]));
249
- const c = u.insert("g").attr("class", "clusters"), h = u.insert("g").attr("class", "edgePaths"), m = u.insert("g").attr("class", "edgeLabels"), b = u.insert("g").attr("class", "nodes");
250
- await Promise.all(
251
- t.nodes().map(async function(f) {
252
- const s = t.node(f);
253
- if (r !== void 0) {
254
- const g = JSON.parse(JSON.stringify(r.clusterData));
255
- i.trace(
256
- `Setting data for parent cluster XXX
257
- Node.id = `,
258
- f,
259
- `
260
- data=`,
261
- g.height,
262
- `
263
- Parent cluster`,
264
- r.height
265
- ), t.setNode(r.id, g), t.parent(f) || (i.trace("Setting parent", f, r.id), t.setParent(f, r.id, g));
266
- }
267
- if (i.info("(Insert) Node XXX" + f + ": " + JSON.stringify(t.node(f))), s?.clusterNode) {
268
- i.info("Cluster identified XBX", f, s.width, t.node(f));
269
- const { ranksep: g, nodesep: p } = t.graph();
270
- s.graph.setGraph({
271
- ...s.graph.graph(),
272
- ranksep: g + 25,
273
- nodesep: p
274
- });
275
- const E = await M(
276
- b,
277
- s.graph,
278
- n,
279
- a,
280
- t.node(f),
281
- o
282
- ), x = E.elem;
283
- V(s, x), s.diff = E.diff || 0, i.info(
284
- "New compound node after recursive render XAX",
285
- f,
286
- "width",
287
- // node,
288
- s.width,
289
- "height",
290
- s.height
291
- // node.x,
292
- // node.y
293
- ), $(x, s);
294
- } else
295
- t.children(f).length > 0 ? (i.trace(
296
- "Cluster - the non recursive path XBX",
297
- f,
298
- s.id,
299
- s,
300
- s.width,
301
- "Graph:",
302
- t
303
- ), i.trace(C(s.id, t)), d.set(s.id, { id: C(s.id, t), node: s })) : (i.trace("Node - the non recursive path XAX", f, b, t.node(f), l), await U(b, t.node(f), { config: o, dir: l }));
304
- })
305
- ), await (/* @__PURE__ */ w(async () => {
306
- const f = t.edges().map(async function(s) {
307
- const g = t.edge(s.v, s.w, s.name);
308
- i.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), i.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), i.info(
309
- "Fix",
310
- d,
311
- "ids:",
312
- s.v,
313
- s.w,
314
- "Translating: ",
315
- d.get(s.v),
316
- d.get(s.w)
317
- ), await Q(m, g);
318
- });
319
- await Promise.all(f);
320
- }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(v(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(v(t)));
321
- let O = 0, { subGraphTitleTotalMargin: S } = Z(o);
322
- return await Promise.all(
323
- ce(t).map(async function(f) {
324
- const s = t.node(f);
325
- if (i.info(
326
- "Position XBX => " + f + ": (" + s.x,
327
- "," + s.y,
328
- ") width: ",
329
- s.width,
330
- " height: ",
331
- s.height
332
- ), s?.clusterNode)
333
- s.y += S, i.info(
334
- "A tainted cluster node XBX1",
335
- f,
336
- s.id,
337
- s.width,
338
- s.height,
339
- s.x,
340
- s.y,
341
- t.parent(f)
342
- ), d.get(s.id).node = s, P(s);
343
- else if (t.children(f).length > 0) {
344
- i.info(
345
- "A pure cluster node XBX1",
346
- f,
347
- s.id,
348
- s.x,
349
- s.y,
350
- s.width,
351
- s.height,
352
- t.parent(f)
353
- ), s.height += S, t.node(s.parentId);
354
- const g = s?.padding / 2 || 0, p = s?.labelBBox?.height || 0, E = p - g || 0;
355
- i.debug("OffsetY", E, "labelHeight", p, "halfPadding", g), await q(c, s), d.get(s.id).node = s;
356
- } else {
357
- const g = t.node(s.parentId);
358
- s.y += S / 2, i.info(
359
- "A regular node XBX1 - using the padding",
360
- s.id,
361
- "parent",
362
- s.parentId,
363
- s.width,
364
- s.height,
365
- s.x,
366
- s.y,
367
- "offsetY",
368
- s.offsetY,
369
- "parent",
370
- g,
371
- g?.offsetY,
372
- s
373
- ), P(s);
374
- }
375
- })
376
- ), t.edges().forEach(function(f) {
377
- const s = t.edge(f);
378
- i.info("Edge " + f.v + " -> " + f.w + ": " + JSON.stringify(s), s), s.points.forEach((x) => x.y += S / 2);
379
- const g = t.node(f.v);
380
- var p = t.node(f.w);
381
- const E = z(h, s, d, n, g, p, a);
382
- K(s, E);
383
- }), t.nodes().forEach(function(f) {
384
- const s = t.node(f);
385
- i.info(f, s.type, s.diff), s.isGroup && (O = s.diff);
386
- }), i.warn("Returning from recursive render XAX", u, O), { elem: u, diff: O };
387
- }, "recursiveRender"), ue = /* @__PURE__ */ w(async (e, t) => {
388
- const n = new k({
389
- multigraph: !0,
390
- compound: !0
391
- }).setGraph({
392
- rankdir: e.direction,
393
- nodesep: e.config?.nodeSpacing || e.config?.flowchart?.nodeSpacing || e.nodeSpacing,
394
- ranksep: e.config?.rankSpacing || e.config?.flowchart?.rankSpacing || e.rankSpacing,
395
- marginx: 8,
396
- marginy: 8
397
- }).setDefaultEdgeLabel(function() {
398
- return {};
399
- }), a = t.select("g");
400
- _(a, e.markers, e.type, e.diagramId), Y(), F(), j(), ie(), e.nodes.forEach((o) => {
401
- n.setNode(o.id, { ...o }), o.parentId && n.setParent(o.id, o.parentId);
402
- }), i.debug("Edges:", e.edges), e.edges.forEach((o) => {
403
- if (o.start === o.end) {
404
- const l = o.start, u = l + "---" + l + "---1", c = l + "---" + l + "---2", h = n.node(l);
405
- n.setNode(u, {
406
- domId: u,
407
- id: u,
408
- parentId: h.parentId,
409
- labelStyle: "",
410
- label: "",
411
- padding: 0,
412
- shape: "labelRect",
413
- // shape: 'rect',
414
- style: "",
415
- width: 10,
416
- height: 10
417
- }), n.setParent(u, h.parentId), n.setNode(c, {
418
- domId: c,
419
- id: c,
420
- parentId: h.parentId,
421
- labelStyle: "",
422
- padding: 0,
423
- // shape: 'rect',
424
- shape: "labelRect",
425
- label: "",
426
- style: "",
427
- width: 10,
428
- height: 10
429
- }), n.setParent(c, h.parentId);
430
- const m = structuredClone(o), b = structuredClone(o), X = structuredClone(o);
431
- m.label = "", m.arrowTypeEnd = "none", m.endLabelLeft = "", m.endLabelRight = "", m.startLabelLeft = "", m.id = l + "-cyclic-special-1", b.startLabelRight = "", b.startLabelLeft = "", b.endLabelLeft = "", b.endLabelRight = "", b.arrowTypeStart = "none", b.arrowTypeEnd = "none", b.id = l + "-cyclic-special-mid", X.label = "", X.startLabelRight = "", X.startLabelLeft = "", X.arrowTypeStart = "none", h.isGroup && (m.fromCluster = l, X.toCluster = l), X.id = l + "-cyclic-special-2", X.arrowTypeStart = "none", n.setEdge(l, u, m, l + "-cyclic-special-0"), n.setEdge(u, c, b, l + "-cyclic-special-1"), n.setEdge(c, l, X, l + "-cyc<lic-special-2");
432
- } else
433
- n.setEdge(o.start, o.end, { ...o }, o.id);
434
- }), i.warn("Graph at first:", JSON.stringify(v(n))), ae(n), i.warn("Graph after XAX:", JSON.stringify(v(n)));
435
- const r = H();
436
- await M(
437
- a,
438
- n,
439
- e.type,
440
- e.diagramId,
441
- void 0,
442
- r
443
- );
444
- }, "render");
445
- export {
446
- ue as render
447
- };
448
- //# sourceMappingURL=dagre-BM42HDAG-BoPUzTvD.js.map