likec4 1.57.0 → 1.58.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 (168) hide show
  1. package/__app__/codegen/react.mjs +7 -8
  2. package/__app__/codegen/webcomponent.mjs +70 -881
  3. package/__app__/src/aichat/index.mjs +8 -1
  4. package/__app__/src/chunks/AIChat.mjs +959 -0
  5. package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
  6. package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
  7. package/__app__/src/chunks/Markdown.mjs +146 -0
  8. package/__app__/src/chunks/NavigationPanel.mjs +61 -0
  9. package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
  10. package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
  11. package/__app__/src/chunks/es.mjs +439 -0
  12. package/__app__/src/chunks/hooks.mjs +145 -0
  13. package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
  14. package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
  15. package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
  16. package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
  17. package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
  18. package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
  19. package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
  20. package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
  21. package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
  22. package/__app__/src/chunks/libs/d3.mjs +2842 -0
  23. package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
  24. package/__app__/src/chunks/libs/framer.mjs +5872 -0
  25. package/__app__/src/chunks/libs/remeda.mjs +642 -0
  26. package/__app__/src/chunks/libs/zod.mjs +3170 -0
  27. package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
  28. package/__app__/src/chunks/styled-system.mjs +1040 -0
  29. package/__app__/src/fonts.css +1 -1
  30. package/__app__/src/main.mjs +14816 -14
  31. package/__app__/src/style.css +1 -1
  32. package/dist/chunks/enableServer.mjs +1 -1
  33. package/dist/chunks/filenames.mjs +2 -2
  34. package/dist/chunks/index2.d.mts +1877 -734
  35. package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
  36. package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
  37. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  38. package/dist/chunks/libs/chevrotain.mjs +25 -25
  39. package/dist/chunks/libs/langium.mjs +1 -1
  40. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  41. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  42. package/dist/chunks/libs/remeda.mjs +1 -1
  43. package/dist/chunks/libs/ufo.mjs +1 -1
  44. package/dist/chunks/libs/unstorage.mjs +1 -1
  45. package/dist/chunks/libs/which.mjs +1 -1
  46. package/dist/chunks/libs/zod.mjs +65 -0
  47. package/dist/chunks/node.mjs +73 -62
  48. package/dist/chunks/{plugin.mjs → vite-plugin.mjs} +41 -41
  49. package/dist/cli/index.mjs +184 -144
  50. package/dist/index.d.mts +1 -1
  51. package/dist/index.mjs +1 -1
  52. package/dist/model/index.d.mts +1 -1
  53. package/dist/vite-plugin/index.mjs +1 -1
  54. package/dist/vite-plugin/internal/index.d.mts +52 -57
  55. package/dist/vite-plugin/internal/index.mjs +946 -1
  56. package/package.json +46 -47
  57. package/react/index.d.mts +92 -23
  58. package/react/index.mjs +44551 -42605
  59. package/__app__/chunks/AIChat2.mjs +0 -2
  60. package/__app__/chunks/DiagramActorProvider.mjs +0 -10
  61. package/__app__/chunks/EmbedPage.mjs +0 -1
  62. package/__app__/chunks/ExportPage.mjs +0 -2
  63. package/__app__/chunks/LikeC4Diagram.mjs +0 -19
  64. package/__app__/chunks/LikeC4Styles.mjs +0 -48
  65. package/__app__/chunks/Markdown.mjs +0 -1
  66. package/__app__/chunks/NavigationPanel.mjs +0 -1
  67. package/__app__/chunks/ViewReact.mjs +0 -1
  68. package/__app__/chunks/adhoc-editor.mjs +0 -1
  69. package/__app__/chunks/aichat.mjs +0 -1
  70. package/__app__/chunks/box.mjs +0 -1
  71. package/__app__/chunks/create-style-context.mjs +0 -1
  72. package/__app__/chunks/css.mjs +0 -1
  73. package/__app__/chunks/factory.mjs +0 -1
  74. package/__app__/chunks/hooks.mjs +0 -1
  75. package/__app__/chunks/hstack.mjs +0 -1
  76. package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
  77. package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
  78. package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
  79. package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
  80. package/__app__/chunks/libs/@mantine/core.mjs +0 -41
  81. package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
  82. package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
  83. package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
  84. package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -358
  85. package/__app__/chunks/libs/@tanstack/ai-client.mjs +0 -2
  86. package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +0 -1
  87. package/__app__/chunks/libs/@tanstack/ai-react.mjs +0 -1
  88. package/__app__/chunks/libs/@tanstack/ai.mjs +0 -2
  89. package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
  90. package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
  91. package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
  92. package/__app__/chunks/libs/@xstate/react.mjs +0 -1
  93. package/__app__/chunks/libs/@xstate/store.mjs +0 -1
  94. package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
  95. package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
  96. package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
  97. package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
  98. package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
  99. package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
  100. package/__app__/chunks/libs/bezier-js.mjs +0 -1
  101. package/__app__/chunks/libs/copy-anything.mjs +0 -1
  102. package/__app__/chunks/libs/d3-path.mjs +0 -1
  103. package/__app__/chunks/libs/d3-shape.mjs +0 -1
  104. package/__app__/chunks/libs/fast-equals.mjs +0 -1
  105. package/__app__/chunks/libs/framer-motion.mjs +0 -9
  106. package/__app__/chunks/libs/html-to-image.mjs +0 -2
  107. package/__app__/chunks/libs/motion-dom.mjs +0 -1
  108. package/__app__/chunks/libs/nanostores.mjs +0 -1
  109. package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
  110. package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
  111. package/__app__/chunks/libs/remeda.mjs +0 -1
  112. package/__app__/chunks/libs/superjson.mjs +0 -1
  113. package/__app__/chunks/libs/zod.mjs +0 -64
  114. package/__app__/chunks/rolldown-runtime.mjs +0 -1
  115. package/__app__/chunks/styles.css.mjs +0 -1
  116. package/__app__/chunks/txt.mjs +0 -1
  117. package/__app__/chunks/useLikeC4Project.mjs +0 -1
  118. package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
  119. package/__app__/src/pages/EmbedPage.mjs +0 -1
  120. package/__app__/src/pages/ExportPage.mjs +0 -1
  121. package/__app__/src/pages/ProjectsOverview.mjs +0 -1
  122. package/__app__/src/pages/ViewAsD2.mjs +0 -1
  123. package/__app__/src/pages/ViewAsDot.mjs +0 -1
  124. package/__app__/src/pages/ViewAsMmd.mjs +0 -1
  125. package/__app__/src/pages/ViewAsPuml.mjs +0 -1
  126. package/__app__/src/pages/ViewEditor.mjs +0 -1
  127. package/__app__/src/pages/ViewReact.mjs +0 -1
  128. package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
  129. package/dist/chunks/libs/@hono/mcp.mjs +0 -70
  130. package/dist/chunks/libs/@hono/node-server.mjs +0 -1
  131. package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
  132. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
  133. package/dist/chunks/libs/ajv.mjs +0 -1
  134. package/dist/chunks/libs/ansi-align.mjs +0 -2
  135. package/dist/chunks/libs/ansi-regex.mjs +0 -1
  136. package/dist/chunks/libs/ansi-styles.mjs +0 -1
  137. package/dist/chunks/libs/atomically.mjs +0 -1
  138. package/dist/chunks/libs/boxen.mjs +0 -22
  139. package/dist/chunks/libs/conf.mjs +0 -1
  140. package/dist/chunks/libs/defu.mjs +0 -1
  141. package/dist/chunks/libs/destr.mjs +0 -1
  142. package/dist/chunks/libs/find-up-simple.mjs +0 -1
  143. package/dist/chunks/libs/get-port.mjs +0 -1
  144. package/dist/chunks/libs/hono.mjs +0 -1
  145. package/dist/chunks/libs/is-docker.mjs +0 -1
  146. package/dist/chunks/libs/is-error-instance.mjs +0 -1
  147. package/dist/chunks/libs/is-inside-container.mjs +0 -1
  148. package/dist/chunks/libs/is-plain-obj.mjs +0 -1
  149. package/dist/chunks/libs/isexe.mjs +0 -1
  150. package/dist/chunks/libs/ky.mjs +0 -3
  151. package/dist/chunks/libs/p-debounce.mjs +0 -1
  152. package/dist/chunks/libs/p-limit.mjs +0 -1
  153. package/dist/chunks/libs/p-timeout.mjs +0 -1
  154. package/dist/chunks/libs/package-up.mjs +0 -1
  155. package/dist/chunks/libs/parse-ms.mjs +0 -1
  156. package/dist/chunks/libs/safe-stringify.mjs +0 -1
  157. package/dist/chunks/libs/strip-indent.mjs +0 -1
  158. package/dist/chunks/libs/tinyrainbow.mjs +0 -1
  159. package/dist/chunks/libs/ts-graphviz.mjs +0 -1
  160. package/dist/chunks/libs/unctx.mjs +0 -1
  161. package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
  162. package/dist/chunks/libs/word-wrap.mjs +0 -12
  163. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
  164. package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
  165. package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
  166. package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
  167. package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
  168. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
@@ -0,0 +1,540 @@
1
+ import "./rolldown-runtime.mjs";
2
+ import { K as e, h as t } from "./libs/remeda.mjs";
3
+ import { an as n } from "./libs/@mantine.mjs";
4
+ import { M as r } from "./styled-system.mjs";
5
+ import { n as i } from "./libs/@tabler/icons-react.mjs";
6
+ import { D as a, F as o, I as s, M as c, P as l, R as u, T as d, X as f, a as p, c as m, d as h, f as g, i as _, l as v, o as y, p as b, s as x, t as S, u as C, w, y as T } from "./LikeC4Styles.mjs";
7
+ import { u as E } from "./Markdown.mjs";
8
+ import { l as ee, m as D, s as O, u as k, x as te } from "./libs/@xyflow/react.mjs";
9
+ import { n as A } from "./libs/fast-equals.mjs";
10
+ import { _ as ne, a as j, g as re, p as M, v as N, y as ie } from "./libs/framer.mjs";
11
+ import { a as P, i as F, l as I, n as ae, r as L, t as oe } from "./libs/@xstate/react.mjs";
12
+ import { n as R, t as z } from "./NavigationPanel.mjs";
13
+ import { createContext as B, memo as V, useContext as H, useEffect as U, useRef as W } from "react";
14
+ import { c as G } from "react/compiler-runtime";
15
+ import { jsx as K, jsxs as q } from "react/jsx-runtime";
16
+ import { invariant as se, nonNullable as J, nonexhaustive as ce } from "@likec4/core";
17
+ import { useLikeC4ProjectsOverview as le } from "likec4:projects-overview";
18
+ //#region ../diagram/src/projects-overview/layouted-to-xyflow.ts
19
+ function layoutedProjectsViewToXYFlow(e) {
20
+ return {
21
+ xynodes: t(e.nodes, projectNodeToXY),
22
+ xyedges: t(e.edges, projectEdgeToXY)
23
+ };
24
+ }
25
+ function projectNodeToXY({ id: e, x: t, y: n, width: r, height: i, ...a }) {
26
+ return {
27
+ id: e,
28
+ position: {
29
+ x: t,
30
+ y: n
31
+ },
32
+ type: "project",
33
+ initialWidth: r,
34
+ initialHeight: i,
35
+ draggable: !1,
36
+ deletable: !1,
37
+ zIndex: o.Element,
38
+ style: {
39
+ width: r,
40
+ height: i
41
+ },
42
+ data: {
43
+ id: e,
44
+ width: r,
45
+ height: i,
46
+ ...a
47
+ }
48
+ };
49
+ }
50
+ function projectEdgeToXY({ id: e, source: t, target: n, ...r }) {
51
+ return {
52
+ id: e,
53
+ source: t,
54
+ target: n,
55
+ type: "relationship",
56
+ zIndex: o.Edge,
57
+ deletable: !1,
58
+ data: {
59
+ id: e,
60
+ technology: null,
61
+ labelBBox: null,
62
+ ...r
63
+ }
64
+ };
65
+ }
66
+ //#endregion
67
+ //#region ../diagram/src/projects-overview/persistence.ts
68
+ var Y = "likec4:projects-overview:lastViewport", X = {
69
+ read() {
70
+ try {
71
+ let e = sessionStorage.getItem(Y);
72
+ return e ? JSON.parse(e) : null;
73
+ } catch (e) {
74
+ return console.error(`Error reading fromStorage ${Y}:`, e), null;
75
+ }
76
+ },
77
+ write(e) {
78
+ if (!e) {
79
+ sessionStorage.removeItem(Y);
80
+ return;
81
+ }
82
+ sessionStorage.setItem(Y, JSON.stringify(e));
83
+ }
84
+ }, Z = F({
85
+ types: {
86
+ context: {},
87
+ tags: "",
88
+ input: {},
89
+ events: {},
90
+ emitted: {}
91
+ },
92
+ guards: {
93
+ isReady: ({ context: e }) => e.initialized.xydata && e.initialized.xyflow && !!e.xystore && !!e.xyflow,
94
+ "click: selected node": ({ event: e }) => e.type === "xyflow.click.node" && e.node.selected === !0
95
+ }
96
+ }), updateView = () => Z.assign(({ event: e }) => {
97
+ L(e, "update.view");
98
+ let { xynodes: t, xyedges: n } = layoutedProjectsViewToXYFlow(e.view);
99
+ return {
100
+ view: e.view,
101
+ xynodes: t,
102
+ xyedges: n
103
+ };
104
+ }), xyflowApplyNodeChanges = () => Z.assign(({ context: e, event: t }) => (L(t, "xyflow.applyNodeChanges"), { xynodes: k(t.changes, e.xynodes) })), xyflowApplyEdgeChanges = () => Z.assign(({ context: e, event: t }) => (L(t, "xyflow.applyEdgeChanges"), { xyedges: ee(t.changes, e.xyedges) })), onMouseEnterOrLeave = () => Z.assign(({ context: e, event: t }) => {
105
+ L(t, [
106
+ "xyflow.mouse.enter.edge",
107
+ "xyflow.mouse.leave.edge",
108
+ "xyflow.mouse.enter.node",
109
+ "xyflow.mouse.leave.node"
110
+ ]);
111
+ let n = t.type.startsWith("xyflow.mouse.enter");
112
+ switch (t.type) {
113
+ case "xyflow.mouse.enter.edge":
114
+ case "xyflow.mouse.leave.edge": {
115
+ let r = t.edge.id;
116
+ return { xyedges: e.xyedges.map((e) => e.id === r ? s.setHovered(e, n) : e) };
117
+ }
118
+ case "xyflow.mouse.enter.node":
119
+ case "xyflow.mouse.leave.node": {
120
+ let r = t.node.id;
121
+ return { xynodes: e.xynodes.map((e) => e.id === r ? s.setHovered(e, n) : e) };
122
+ }
123
+ default: ce(t);
124
+ }
125
+ }), saveViewport = () => Z.createAction(({ context: e }) => {
126
+ let t = e.xyflow;
127
+ t && X.write(t.getViewport());
128
+ }), handleClick = () => Z.enqueueActions(({ event: e, enqueue: t }) => {
129
+ if (e.type === "xyflow.click.double") {
130
+ t(fitDiagram());
131
+ return;
132
+ }
133
+ }), fitDiagram = (e) => Z.enqueueActions(({ context: t, event: n }) => {
134
+ let r = t.view.bounds, i;
135
+ e ? (r = e.bounds ?? t.view.bounds, i = e.duration) : n.type === "xyflow.fitDiagram" && (r = n.bounds ?? t.view.bounds, i = n.duration), i ??= 450;
136
+ let { width: a, height: o, panZoom: s, transform: c } = J(t.xystore).getState(), u = Math.max(1, c[2]), d = te(r, a, o, l, u, t.fitViewPadding);
137
+ d.x = Math.round(d.x), d.y = Math.round(d.y);
138
+ let f = i > 0 ? {
139
+ duration: i,
140
+ interpolate: "smooth"
141
+ } : void 0;
142
+ s?.setViewport(d, f).catch((e) => {
143
+ console.error("Error during fitDiagram panZoom setViewport", { err: e });
144
+ }), X.write(null);
145
+ }), restoreViewport = () => Z.enqueueActions(({ context: e, enqueue: t }) => {
146
+ let n = X.read();
147
+ if (n) {
148
+ J(e.xyflow).setViewport(n, { duration: 0 });
149
+ return;
150
+ }
151
+ t(fitDiagram({ duration: 0 }));
152
+ }), dispose = () => Z.assign({
153
+ xyflow: null,
154
+ xystore: null,
155
+ initialized: {
156
+ xyflow: !1,
157
+ xydata: !1
158
+ },
159
+ xyedges: [],
160
+ xynodes: []
161
+ }), assignNavigateTo = () => Z.assign(({ event: e, context: t }) => {
162
+ let n;
163
+ switch (e.type) {
164
+ case "xyflow.click.node":
165
+ n = e.node;
166
+ break;
167
+ case "navigate.to":
168
+ n = J(t.xynodes.find((t) => t.id === e.fromNode), `Node ${e.fromNode} not found`);
169
+ break;
170
+ default: return console.warn(`Unexpected event ${e.type} in assignNavigateTo`), {};
171
+ }
172
+ return { navigateTo: n };
173
+ }), ue = Z.createMachine({
174
+ id: "projects-overview",
175
+ context: ({ input: e }) => ({
176
+ ...e,
177
+ initialized: {
178
+ xydata: !1,
179
+ xyflow: !1
180
+ },
181
+ xyflow: null,
182
+ xystore: null,
183
+ xynodes: [],
184
+ xyedges: []
185
+ }),
186
+ initial: "init",
187
+ on: { close: { target: ".closed" } },
188
+ states: {
189
+ init: { on: {
190
+ "update.view": {
191
+ actions: [updateView(), I(({ context: e }) => ({ initialized: {
192
+ ...e.initialized,
193
+ xydata: !0
194
+ } }))],
195
+ target: "isReady"
196
+ },
197
+ "xyflow.init": {
198
+ actions: [I(({ context: e, event: t }) => ({
199
+ initialized: {
200
+ ...e.initialized,
201
+ xyflow: !0
202
+ },
203
+ xyflow: t.xyflow,
204
+ xystore: t.xystore
205
+ }))],
206
+ target: "isReady"
207
+ }
208
+ } },
209
+ isReady: { always: [{
210
+ guard: "isReady",
211
+ target: "active"
212
+ }, { target: "init" }] },
213
+ active: {
214
+ tags: "active",
215
+ entry: [restoreViewport()],
216
+ on: {
217
+ "navigate.to": {
218
+ actions: assignNavigateTo(),
219
+ target: "navigate"
220
+ },
221
+ "xyflow.applyNodeChanges": { actions: xyflowApplyNodeChanges() },
222
+ "xyflow.applyEdgeChanges": { actions: xyflowApplyEdgeChanges() },
223
+ "xyflow.mouse.*": { actions: onMouseEnterOrLeave() },
224
+ "xyflow.click.*": [{
225
+ guard: "click: selected node",
226
+ actions: assignNavigateTo(),
227
+ target: "navigate"
228
+ }, { actions: handleClick() }],
229
+ "xyflow.fitDiagram": { actions: fitDiagram() },
230
+ "update.view": { actions: updateView() }
231
+ }
232
+ },
233
+ navigate: {
234
+ tags: "active",
235
+ entry: [
236
+ saveViewport(),
237
+ I({ xyedges: [] }),
238
+ ({ context: { navigateTo: t, xyflow: n, xystore: r }, self: i }) => {
239
+ se(n && t, "Invalid state, xyflow is undefined");
240
+ let { width: a, domNode: o } = J(r).getState(), s = e(Math.min(a * 7 / 9 / t.data.width), {
241
+ min: l,
242
+ max: 2.5
243
+ }), c = {
244
+ x: Math.round(-s * t.position.x + (a - s * t.data.width) / 2),
245
+ y: Math.round(-s * t.position.y) + 50
246
+ }, u = n.getViewport(), d = o.querySelectorAll(`.react-flow__node-project:not([data-id="${t.id}"]) > *`), f = j(d, {
247
+ opacity: 0,
248
+ scale: .9
249
+ }, {
250
+ visualDuration: .25,
251
+ delay: ne(.08, { from: "center" })
252
+ }), p = ie(1), m = re(p, [1, 0], [`translate(${u.x}px, ${u.y}px) scale(${u.zoom})`, `translate(${c.x}px, ${c.y}px) scale(${s})`]), h = N(o.querySelector(".xyflow__viewport"), { transform: m }), g = N(o.querySelector(`.react-flow__node-project:is([data-id="${t.id}"]) > *`), { opacity: p }), _ = j(p, 0, {
253
+ delay: d.length > 3 ? .25 : 0,
254
+ type: "spring",
255
+ stiffness: 350,
256
+ damping: 40,
257
+ mass: 1.5,
258
+ visualDuration: .55
259
+ });
260
+ Promise.race([_.finished, sleep(750)]).then(() => {
261
+ h(), g(), _.stop(), f.stop(), i.send({
262
+ type: "emit.navigate.to",
263
+ projectId: t.data.projectId
264
+ });
265
+ });
266
+ }
267
+ ],
268
+ on: { "emit.navigate.to": { actions: P(({ event: e }) => ({
269
+ ...e,
270
+ type: "navigate.to"
271
+ })) } }
272
+ },
273
+ closed: {
274
+ id: "closed",
275
+ type: "final",
276
+ entry: dispose()
277
+ }
278
+ }
279
+ });
280
+ function sleep(e) {
281
+ return new Promise((t) => setTimeout(t, e));
282
+ }
283
+ //#endregion
284
+ //#region ../diagram/src/projects-overview/context.ts
285
+ var Q = B(null), de = Q.Provider;
286
+ function useProjectsOverviewActor() {
287
+ let e = G(2), t = H(Q), n;
288
+ return e[0] === t ? n = e[1] : (n = J(t, "No ProjectsOverviewActorContext"), e[0] = t, e[1] = n), n;
289
+ }
290
+ //#endregion
291
+ //#region ../diagram/src/projects-overview/panel/ProjectsOverviewPanel.tsx
292
+ var ProjectsOverviewPanel = () => {
293
+ let e = G(1), t;
294
+ return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ K(z.Root, { children: /* @__PURE__ */ q(z.Body, { children: [/* @__PURE__ */ K(z.Logo, {}), /* @__PURE__ */ K(z.Label, { children: "Projects Overview" })] }) }), e[0] = t) : t = e[0], t;
295
+ }, fe = p((e) => {
296
+ let t = u(e.data.points);
297
+ return /* @__PURE__ */ q(b, {
298
+ ...e,
299
+ children: [/* @__PURE__ */ K(C, {
300
+ edgeProps: e,
301
+ svgPath: t
302
+ }), /* @__PURE__ */ K(h, {
303
+ edgeProps: e,
304
+ children: /* @__PURE__ */ K(g, { edgeProps: e })
305
+ })]
306
+ });
307
+ });
308
+ //#endregion
309
+ //#region ../diagram/src/projects-overview/custom/nodeTypes.tsx
310
+ function ProjectNode(e) {
311
+ let t = G(19), r = useProjectsOverviewActor(), t0;
312
+ t[0] !== r || t[1] !== e.data.id || t[2] !== e.data.projectId ? (t0 = (t) => {
313
+ t.stopPropagation(), r.send({
314
+ type: "navigate.to",
315
+ fromNode: e.data.id,
316
+ projectId: e.data.projectId
317
+ });
318
+ }, t[0] = r, t[1] = e.data.id, t[2] = e.data.projectId, t[3] = t0) : t0 = t[3];
319
+ let a = n(t0), o, s;
320
+ t[4] === e ? (o = t[5], s = t[6]) : (o = /* @__PURE__ */ K(y, { ...e }), s = /* @__PURE__ */ K(m, { ...e }), t[4] = e, t[5] = o, t[6] = s);
321
+ let c;
322
+ t[7] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ K(i, {}), t[7] = c) : c = t[7];
323
+ let l;
324
+ t[8] === a ? l = t[9] : (l = [{
325
+ key: "navigate",
326
+ icon: c,
327
+ onClick: a
328
+ }], t[8] = a, t[9] = l);
329
+ let u;
330
+ t[10] !== e || t[11] !== l ? (u = /* @__PURE__ */ K(v, {
331
+ ...e,
332
+ buttons: l
333
+ }), t[10] = e, t[11] = l, t[12] = u) : u = t[12];
334
+ let d;
335
+ t[13] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ K(_, {}), t[13] = d) : d = t[13];
336
+ let f;
337
+ return t[14] !== e || t[15] !== o || t[16] !== s || t[17] !== u ? (f = /* @__PURE__ */ q(x, {
338
+ layout: !0,
339
+ nodeProps: e,
340
+ children: [
341
+ o,
342
+ s,
343
+ u,
344
+ d
345
+ ]
346
+ }, e.id), t[14] = e, t[15] = o, t[16] = s, t[17] = u, t[18] = f) : f = t[18], f;
347
+ }
348
+ //#endregion
349
+ //#region ../diagram/src/projects-overview/hooks.ts
350
+ function useProjectsOverviewState(e, t) {
351
+ let n = t === void 0 ? A : t;
352
+ return ae(useProjectsOverviewActor(), e, n);
353
+ }
354
+ function useProjectsOverviewXYStoreApi() {
355
+ return D();
356
+ }
357
+ //#endregion
358
+ //#region ../diagram/src/projects-overview/ProjectsOverviewXY.tsx
359
+ var pe = { project: ProjectNode }, me = { relationship: fe }, selector = (e) => ({
360
+ isActive: e.hasTag("active"),
361
+ nodes: e.context.xynodes,
362
+ edges: e.context.xyedges
363
+ }), selectorEq = (e, t) => e.isActive === t.isActive && A(e.nodes, t.nodes) && A(e.edges, t.edges), $ = V((e) => {
364
+ let t = G(45), n, i;
365
+ t[0] === e ? (n = t[1], i = t[2]) : ({background: i, ...n} = e, t[0] = e, t[1] = n, t[2] = i);
366
+ let a = i === void 0 ? "dots" : i, o = useProjectsOverviewActor(), { isActive: s, nodes: l, edges: u } = useProjectsOverviewState(selector, selectorEq), d = useProjectsOverviewXYStoreApi(), p = s ? "initialized" : "not-initialized", m;
367
+ t[3] === p ? m = t[4] : (m = r(p, "projects-overview"), t[3] = p, t[4] = m);
368
+ let t4;
369
+ t[5] === o ? t4 = t[6] : (t4 = (e, t) => {
370
+ e.stopPropagation(), o.send({
371
+ type: "xyflow.click.node",
372
+ node: t
373
+ });
374
+ }, t[5] = o, t[6] = t4);
375
+ let h = f(t4), t6;
376
+ t[7] === o ? t6 = t[8] : (t6 = (e, t) => {
377
+ e.stopPropagation(), o.send({
378
+ type: "xyflow.click.edge",
379
+ edge: t
380
+ });
381
+ }, t[7] = o, t[8] = t6);
382
+ let g = f(t6), t8;
383
+ t[9] === o ? t8 = t[10] : (t8 = (e) => {
384
+ e.stopPropagation(), o.send({ type: "xyflow.click.pane" });
385
+ }, t[9] = o, t[10] = t8);
386
+ let _ = f(t8), t10;
387
+ t[11] === o ? t10 = t[12] : (t10 = (e) => {
388
+ e.stopPropagation(), o.send({ type: "xyflow.click.double" });
389
+ }, t[11] = o, t[12] = t10);
390
+ let v = f(t10), t12;
391
+ t[13] === o ? t12 = t[14] : (t12 = (e) => {
392
+ o.send({
393
+ type: "xyflow.applyNodeChanges",
394
+ changes: e
395
+ });
396
+ }, t[13] = o, t[14] = t12);
397
+ let y = f(t12), t14;
398
+ t[15] === o ? t14 = t[16] : (t14 = (e) => {
399
+ o.send({
400
+ type: "xyflow.applyEdgeChanges",
401
+ changes: e
402
+ });
403
+ }, t[15] = o, t[16] = t14);
404
+ let b = f(t14), t16;
405
+ t[17] === o ? t16 = t[18] : (t16 = (e, t) => {
406
+ o.send({
407
+ type: "xyflow.mouse.enter.edge",
408
+ edge: t,
409
+ event: e
410
+ });
411
+ }, t[17] = o, t[18] = t16);
412
+ let x = f(t16), t18;
413
+ t[19] === o ? t18 = t[20] : (t18 = (e, t) => {
414
+ o.send({
415
+ type: "xyflow.mouse.leave.edge",
416
+ edge: t,
417
+ event: e
418
+ });
419
+ }, t[19] = o, t[20] = t18);
420
+ let S = f(t18), t20;
421
+ t[21] === o ? t20 = t[22] : (t20 = (e, t) => {
422
+ o.send({
423
+ type: "xyflow.mouse.enter.node",
424
+ node: t
425
+ });
426
+ }, t[21] = o, t[22] = t20);
427
+ let C = f(t20), t22;
428
+ t[23] === o ? t22 = t[24] : (t22 = (e, t) => {
429
+ o.send({
430
+ type: "xyflow.mouse.leave.node",
431
+ node: t
432
+ });
433
+ }, t[23] = o, t[24] = t22);
434
+ let w = f(t22), t24;
435
+ t[25] !== o || t[26] !== d ? (t24 = (e) => {
436
+ o.send({
437
+ type: "xyflow.init",
438
+ xyflow: e,
439
+ xystore: d
440
+ });
441
+ }, t[25] = o, t[26] = d, t[27] = t24) : t24 = t[27];
442
+ let T = f(t24), E;
443
+ return t[28] !== a || t[29] !== u || t[30] !== l || t[31] !== n || t[32] !== v || t[33] !== y || t[34] !== b || t[35] !== x || t[36] !== S || t[37] !== C || t[38] !== w || t[39] !== T || t[40] !== m || t[41] !== h || t[42] !== g || t[43] !== _ ? (E = /* @__PURE__ */ K(c, {
444
+ nodes: l,
445
+ edges: u,
446
+ className: m,
447
+ nodeTypes: pe,
448
+ edgeTypes: me,
449
+ fitView: !1,
450
+ onNodeClick: h,
451
+ onEdgeClick: g,
452
+ onPaneClick: _,
453
+ onDoubleClick: v,
454
+ onNodesChange: y,
455
+ onEdgesChange: b,
456
+ onEdgeMouseEnter: x,
457
+ onEdgeMouseLeave: S,
458
+ onNodeMouseEnter: C,
459
+ onNodeMouseLeave: w,
460
+ onInit: T,
461
+ nodesDraggable: !1,
462
+ nodesSelectable: !0,
463
+ pannable: !0,
464
+ zoomable: !0,
465
+ background: a,
466
+ ...n
467
+ }), t[28] = a, t[29] = u, t[30] = l, t[31] = n, t[32] = v, t[33] = y, t[34] = b, t[35] = x, t[36] = S, t[37] = C, t[38] = w, t[39] = T, t[40] = m, t[41] = h, t[42] = g, t[43] = _, t[44] = E) : E = t[44], E;
468
+ });
469
+ $.displayName = "ProjectsOverviewXY";
470
+ //#endregion
471
+ //#region ../diagram/src/projects-overview/ProjectsOverview.tsx
472
+ function ProjectsOverview({ view: e, onNavigateToProject: t, fitViewPadding: n = {
473
+ top: "50px",
474
+ bottom: "32px",
475
+ left: "32px",
476
+ right: "32px"
477
+ }, ...r }) {
478
+ let i = oe(ue, { input: {
479
+ view: e,
480
+ fitViewPadding: n
481
+ } });
482
+ U(() => {
483
+ i.send({
484
+ type: "update.view",
485
+ view: e
486
+ });
487
+ }, [i, e]);
488
+ let a = E(t);
489
+ U(() => {
490
+ let e = [i.on("navigate.to", ({ projectId: e }) => {
491
+ a.current?.(e);
492
+ })];
493
+ return () => {
494
+ e.forEach((e) => e.unsubscribe());
495
+ };
496
+ }, [i]);
497
+ let o = e.bounds;
498
+ return /* @__PURE__ */ K(de, {
499
+ value: i,
500
+ children: /* @__PURE__ */ q(O, {
501
+ ...W({
502
+ initialNodes: [],
503
+ initialEdges: [],
504
+ initialWidth: o.width,
505
+ initialHeight: o.height,
506
+ fitView: !1
507
+ }).current,
508
+ children: [/* @__PURE__ */ K(M, {
509
+ id: i.sessionId,
510
+ inherit: !1,
511
+ children: /* @__PURE__ */ K($, { ...r })
512
+ }), /* @__PURE__ */ K(ProjectsOverviewPanel, {})]
513
+ })
514
+ });
515
+ }
516
+ //#endregion
517
+ //#region ../diagram/src/LikeC4ProjectsOverview.tsx
518
+ function LikeC4ProjectsOverview({ view: e, className: t, onNavigateToProject: n, ...r }) {
519
+ let i = R(), o = T();
520
+ return n ??= i, /* @__PURE__ */ K(d, { children: /* @__PURE__ */ q(w, { children: [/* @__PURE__ */ K(S, { id: o }), /* @__PURE__ */ K(a, {
521
+ id: o,
522
+ className: t,
523
+ children: /* @__PURE__ */ K(ProjectsOverview, {
524
+ view: e,
525
+ onNavigateToProject: n,
526
+ ...r
527
+ })
528
+ })] }) });
529
+ }
530
+ //#endregion
531
+ //#region src/pages/ProjectsOverview.tsx
532
+ function ProjectsOverviewPage() {
533
+ let e = G(3), t = R(), n = le(), r;
534
+ return e[0] !== t || e[1] !== n ? (r = /* @__PURE__ */ K(LikeC4ProjectsOverview, {
535
+ view: n,
536
+ onNavigateToProject: t
537
+ }), e[0] = t, e[1] = n, e[2] = r) : r = e[2], r;
538
+ }
539
+ //#endregion
540
+ export { ProjectsOverviewPage };