@decido/shell 4.0.2 → 4.0.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.
- package/dist/CenterComposite-RPEGBKQU.mjs +1697 -0
- package/dist/DebugPanel-KEKDMHDN.mjs +14 -0
- package/dist/MorphShell-FKDBB7E5.mjs +14 -0
- package/dist/PlaygroundAppSidebar-ALYJJGAO.mjs +9 -0
- package/dist/PlaygroundChat-MI2KXMK6.mjs +15 -0
- package/dist/PlaygroundTerminal-5AV4BJAI.mjs +7 -0
- package/dist/PluginSandbox-WMNAUQOJ.mjs +188 -0
- package/dist/ReactFlowEditor-RTF2652X.mjs +3574 -0
- package/dist/ReactFlowEditor-ZW5MCN5Y.css +561 -0
- package/dist/TimelineEditor-N4HRMHTB.mjs +226 -0
- package/dist/WidgetSlotPanel-KJI4CHHD.mjs +11 -0
- package/dist/chunk-2YMI4N5I.mjs +2004 -0
- package/dist/chunk-3BZX7LF2.mjs +139 -0
- package/dist/chunk-3P4P3M54.mjs +136 -0
- package/dist/chunk-F3OTFHNO.mjs +40 -0
- package/dist/chunk-IMHORBTL.mjs +48 -0
- package/dist/chunk-JF5QSJYT.mjs +295 -0
- package/dist/chunk-LWMMFTJC.mjs +382 -0
- package/dist/chunk-MSVEFEXE.mjs +179 -0
- package/dist/chunk-OCHGY2MN.mjs +1662 -0
- package/dist/chunk-PMYAM764.mjs +813 -0
- package/dist/chunk-Q64KZXPK.mjs +43 -0
- package/dist/chunk-QHQW2HMU.mjs +155 -0
- package/dist/chunk-RWZ4BOIN.mjs +385 -0
- package/dist/chunk-UHT6FIYF.mjs +195 -0
- package/dist/chunk-UJCSKKID.mjs +30 -0
- package/dist/chunk-V3CYNPGL.mjs +8758 -0
- package/dist/chunk-VBPGEFNM.mjs +2381 -0
- package/dist/chunk-XMSU6UWD.mjs +158 -0
- package/dist/chunk-ZCCCBHE6.mjs +55 -0
- package/dist/index.css +561 -0
- package/dist/index.js +65130 -0
- package/dist/index.mjs +40248 -0
- package/dist/useIntentLens-LEQCAXCK.mjs +13 -0
- package/dist/useSuggestionsStore-4L2AIZ2D.mjs +7 -0
- package/dist/wasm-QFXGEYGP.mjs +81 -0
- package/package.json +17 -18
|
@@ -0,0 +1,3574 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Background,
|
|
3
|
+
Controls,
|
|
4
|
+
Handle,
|
|
5
|
+
MarkerType,
|
|
6
|
+
MiniMap,
|
|
7
|
+
Position,
|
|
8
|
+
ReactFlowProvider,
|
|
9
|
+
SelectionMode,
|
|
10
|
+
addEdge,
|
|
11
|
+
index,
|
|
12
|
+
useEdgesState,
|
|
13
|
+
useNodesState,
|
|
14
|
+
useReactFlow
|
|
15
|
+
} from "./chunk-V3CYNPGL.mjs";
|
|
16
|
+
import {
|
|
17
|
+
getRegisteredMorphComponents
|
|
18
|
+
} from "./chunk-ZCCCBHE6.mjs";
|
|
19
|
+
import {
|
|
20
|
+
useUIComponentStore
|
|
21
|
+
} from "./chunk-3BZX7LF2.mjs";
|
|
22
|
+
import "./chunk-3P4P3M54.mjs";
|
|
23
|
+
import {
|
|
24
|
+
usePlaygroundStore
|
|
25
|
+
} from "./chunk-XMSU6UWD.mjs";
|
|
26
|
+
import "./chunk-UJCSKKID.mjs";
|
|
27
|
+
|
|
28
|
+
// src/components/studio/ReactFlowEditor.tsx
|
|
29
|
+
import React5, { useCallback as useCallback2, useEffect, useRef, useState as useState3 } from "react";
|
|
30
|
+
import { useEngineStore as useEngineStore3, useTimelineStore as useTimelineStore13 } from "@decido/engine";
|
|
31
|
+
import { convertLegacyTimelineToBlueprint } from "@decido/core";
|
|
32
|
+
import { useBlueprintNavigation } from "@decido/engine";
|
|
33
|
+
|
|
34
|
+
// ../../node_modules/.pnpm/@dagrejs+dagre@2.0.4/node_modules/@dagrejs/dagre/dist/dagre.esm.js
|
|
35
|
+
var v = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
|
|
36
|
+
var y = v((Fi, ee) => {
|
|
37
|
+
var Vt = Object.defineProperty, At = (e, t, r) => t in e ? Vt(e, t, { enumerable: true, configurable: true, writable: true, value: r }) : e[t] = r, E = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), k = (e, t, r) => At(e, typeof t != "symbol" ? t + "" : t, r), R = E((e, t) => {
|
|
38
|
+
"use strict";
|
|
39
|
+
var r = "\0", n = "\0", i = "", o = class {
|
|
40
|
+
constructor(d) {
|
|
41
|
+
k(this, "_isDirected", true), k(this, "_isMultigraph", false), k(this, "_isCompound", false), k(this, "_label"), k(this, "_defaultNodeLabelFn", () => {
|
|
42
|
+
}), k(this, "_defaultEdgeLabelFn", () => {
|
|
43
|
+
}), k(this, "_nodes", {}), k(this, "_in", {}), k(this, "_preds", {}), k(this, "_out", {}), k(this, "_sucs", {}), k(this, "_edgeObjs", {}), k(this, "_edgeLabels", {}), k(this, "_nodeCount", 0), k(this, "_edgeCount", 0), k(this, "_parent"), k(this, "_children"), d && (this._isDirected = Object.hasOwn(d, "directed") ? d.directed : true, this._isMultigraph = Object.hasOwn(d, "multigraph") ? d.multigraph : false, this._isCompound = Object.hasOwn(d, "compound") ? d.compound : false), this._isCompound && (this._parent = {}, this._children = {}, this._children[n] = {});
|
|
44
|
+
}
|
|
45
|
+
isDirected() {
|
|
46
|
+
return this._isDirected;
|
|
47
|
+
}
|
|
48
|
+
isMultigraph() {
|
|
49
|
+
return this._isMultigraph;
|
|
50
|
+
}
|
|
51
|
+
isCompound() {
|
|
52
|
+
return this._isCompound;
|
|
53
|
+
}
|
|
54
|
+
setGraph(d) {
|
|
55
|
+
return this._label = d, this;
|
|
56
|
+
}
|
|
57
|
+
graph() {
|
|
58
|
+
return this._label;
|
|
59
|
+
}
|
|
60
|
+
setDefaultNodeLabel(d) {
|
|
61
|
+
return this._defaultNodeLabelFn = d, typeof d != "function" && (this._defaultNodeLabelFn = () => d), this;
|
|
62
|
+
}
|
|
63
|
+
nodeCount() {
|
|
64
|
+
return this._nodeCount;
|
|
65
|
+
}
|
|
66
|
+
nodes() {
|
|
67
|
+
return Object.keys(this._nodes);
|
|
68
|
+
}
|
|
69
|
+
sources() {
|
|
70
|
+
var d = this;
|
|
71
|
+
return this.nodes().filter((h) => Object.keys(d._in[h]).length === 0);
|
|
72
|
+
}
|
|
73
|
+
sinks() {
|
|
74
|
+
var d = this;
|
|
75
|
+
return this.nodes().filter((h) => Object.keys(d._out[h]).length === 0);
|
|
76
|
+
}
|
|
77
|
+
setNodes(d, h) {
|
|
78
|
+
var f = arguments, m = this;
|
|
79
|
+
return d.forEach(function(p) {
|
|
80
|
+
f.length > 1 ? m.setNode(p, h) : m.setNode(p);
|
|
81
|
+
}), this;
|
|
82
|
+
}
|
|
83
|
+
setNode(d, h) {
|
|
84
|
+
return Object.hasOwn(this._nodes, d) ? (arguments.length > 1 && (this._nodes[d] = h), this) : (this._nodes[d] = arguments.length > 1 ? h : this._defaultNodeLabelFn(d), this._isCompound && (this._parent[d] = n, this._children[d] = {}, this._children[n][d] = true), this._in[d] = {}, this._preds[d] = {}, this._out[d] = {}, this._sucs[d] = {}, ++this._nodeCount, this);
|
|
85
|
+
}
|
|
86
|
+
node(d) {
|
|
87
|
+
return this._nodes[d];
|
|
88
|
+
}
|
|
89
|
+
hasNode(d) {
|
|
90
|
+
return Object.hasOwn(this._nodes, d);
|
|
91
|
+
}
|
|
92
|
+
removeNode(d) {
|
|
93
|
+
var h = this;
|
|
94
|
+
if (Object.hasOwn(this._nodes, d)) {
|
|
95
|
+
var f = (m) => h.removeEdge(h._edgeObjs[m]);
|
|
96
|
+
delete this._nodes[d], this._isCompound && (this._removeFromParentsChildList(d), delete this._parent[d], this.children(d).forEach(function(m) {
|
|
97
|
+
h.setParent(m);
|
|
98
|
+
}), delete this._children[d]), Object.keys(this._in[d]).forEach(f), delete this._in[d], delete this._preds[d], Object.keys(this._out[d]).forEach(f), delete this._out[d], delete this._sucs[d], --this._nodeCount;
|
|
99
|
+
}
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
setParent(d, h) {
|
|
103
|
+
if (!this._isCompound) throw new Error("Cannot set parent in a non-compound graph");
|
|
104
|
+
if (h === void 0) h = n;
|
|
105
|
+
else {
|
|
106
|
+
h += "";
|
|
107
|
+
for (var f = h; f !== void 0; f = this.parent(f)) if (f === d) throw new Error("Setting " + h + " as parent of " + d + " would create a cycle");
|
|
108
|
+
this.setNode(h);
|
|
109
|
+
}
|
|
110
|
+
return this.setNode(d), this._removeFromParentsChildList(d), this._parent[d] = h, this._children[h][d] = true, this;
|
|
111
|
+
}
|
|
112
|
+
_removeFromParentsChildList(d) {
|
|
113
|
+
delete this._children[this._parent[d]][d];
|
|
114
|
+
}
|
|
115
|
+
parent(d) {
|
|
116
|
+
if (this._isCompound) {
|
|
117
|
+
var h = this._parent[d];
|
|
118
|
+
if (h !== n) return h;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
children(d = n) {
|
|
122
|
+
if (this._isCompound) {
|
|
123
|
+
var h = this._children[d];
|
|
124
|
+
if (h) return Object.keys(h);
|
|
125
|
+
} else {
|
|
126
|
+
if (d === n) return this.nodes();
|
|
127
|
+
if (this.hasNode(d)) return [];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
predecessors(d) {
|
|
131
|
+
var h = this._preds[d];
|
|
132
|
+
if (h) return Object.keys(h);
|
|
133
|
+
}
|
|
134
|
+
successors(d) {
|
|
135
|
+
var h = this._sucs[d];
|
|
136
|
+
if (h) return Object.keys(h);
|
|
137
|
+
}
|
|
138
|
+
neighbors(d) {
|
|
139
|
+
var h = this.predecessors(d);
|
|
140
|
+
if (h) {
|
|
141
|
+
let m = new Set(h);
|
|
142
|
+
for (var f of this.successors(d)) m.add(f);
|
|
143
|
+
return Array.from(m.values());
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
isLeaf(d) {
|
|
147
|
+
var h;
|
|
148
|
+
return this.isDirected() ? h = this.successors(d) : h = this.neighbors(d), h.length === 0;
|
|
149
|
+
}
|
|
150
|
+
filterNodes(d) {
|
|
151
|
+
var h = new this.constructor({ directed: this._isDirected, multigraph: this._isMultigraph, compound: this._isCompound });
|
|
152
|
+
h.setGraph(this.graph());
|
|
153
|
+
var f = this;
|
|
154
|
+
Object.entries(this._nodes).forEach(function([w, b]) {
|
|
155
|
+
d(w) && h.setNode(w, b);
|
|
156
|
+
}), Object.values(this._edgeObjs).forEach(function(w) {
|
|
157
|
+
h.hasNode(w.v) && h.hasNode(w.w) && h.setEdge(w, f.edge(w));
|
|
158
|
+
});
|
|
159
|
+
var m = {};
|
|
160
|
+
function p(w) {
|
|
161
|
+
var b = f.parent(w);
|
|
162
|
+
return b === void 0 || h.hasNode(b) ? (m[w] = b, b) : b in m ? m[b] : p(b);
|
|
163
|
+
}
|
|
164
|
+
return this._isCompound && h.nodes().forEach((w) => h.setParent(w, p(w))), h;
|
|
165
|
+
}
|
|
166
|
+
setDefaultEdgeLabel(d) {
|
|
167
|
+
return this._defaultEdgeLabelFn = d, typeof d != "function" && (this._defaultEdgeLabelFn = () => d), this;
|
|
168
|
+
}
|
|
169
|
+
edgeCount() {
|
|
170
|
+
return this._edgeCount;
|
|
171
|
+
}
|
|
172
|
+
edges() {
|
|
173
|
+
return Object.values(this._edgeObjs);
|
|
174
|
+
}
|
|
175
|
+
setPath(d, h) {
|
|
176
|
+
var f = this, m = arguments;
|
|
177
|
+
return d.reduce(function(p, w) {
|
|
178
|
+
return m.length > 1 ? f.setEdge(p, w, h) : f.setEdge(p, w), w;
|
|
179
|
+
}), this;
|
|
180
|
+
}
|
|
181
|
+
setEdge() {
|
|
182
|
+
var d, h, f, m, p = false, w = arguments[0];
|
|
183
|
+
typeof w == "object" && w !== null && "v" in w ? (d = w.v, h = w.w, f = w.name, arguments.length === 2 && (m = arguments[1], p = true)) : (d = w, h = arguments[1], f = arguments[3], arguments.length > 2 && (m = arguments[2], p = true)), d = "" + d, h = "" + h, f !== void 0 && (f = "" + f);
|
|
184
|
+
var b = l(this._isDirected, d, h, f);
|
|
185
|
+
if (Object.hasOwn(this._edgeLabels, b)) return p && (this._edgeLabels[b] = m), this;
|
|
186
|
+
if (f !== void 0 && !this._isMultigraph) throw new Error("Cannot set a named edge when isMultigraph = false");
|
|
187
|
+
this.setNode(d), this.setNode(h), this._edgeLabels[b] = p ? m : this._defaultEdgeLabelFn(d, h, f);
|
|
188
|
+
var g = u(this._isDirected, d, h, f);
|
|
189
|
+
return d = g.v, h = g.w, Object.freeze(g), this._edgeObjs[b] = g, s(this._preds[h], d), s(this._sucs[d], h), this._in[h][b] = g, this._out[d][b] = g, this._edgeCount++, this;
|
|
190
|
+
}
|
|
191
|
+
edge(d, h, f) {
|
|
192
|
+
var m = arguments.length === 1 ? c(this._isDirected, arguments[0]) : l(this._isDirected, d, h, f);
|
|
193
|
+
return this._edgeLabels[m];
|
|
194
|
+
}
|
|
195
|
+
edgeAsObj() {
|
|
196
|
+
let d = this.edge(...arguments);
|
|
197
|
+
return typeof d != "object" ? { label: d } : d;
|
|
198
|
+
}
|
|
199
|
+
hasEdge(d, h, f) {
|
|
200
|
+
var m = arguments.length === 1 ? c(this._isDirected, arguments[0]) : l(this._isDirected, d, h, f);
|
|
201
|
+
return Object.hasOwn(this._edgeLabels, m);
|
|
202
|
+
}
|
|
203
|
+
removeEdge(d, h, f) {
|
|
204
|
+
var m = arguments.length === 1 ? c(this._isDirected, arguments[0]) : l(this._isDirected, d, h, f), p = this._edgeObjs[m];
|
|
205
|
+
return p && (d = p.v, h = p.w, delete this._edgeLabels[m], delete this._edgeObjs[m], a(this._preds[h], d), a(this._sucs[d], h), delete this._in[h][m], delete this._out[d][m], this._edgeCount--), this;
|
|
206
|
+
}
|
|
207
|
+
inEdges(d, h) {
|
|
208
|
+
return this.isDirected() ? this.filterEdges(this._in[d], d, h) : this.nodeEdges(d, h);
|
|
209
|
+
}
|
|
210
|
+
outEdges(d, h) {
|
|
211
|
+
return this.isDirected() ? this.filterEdges(this._out[d], d, h) : this.nodeEdges(d, h);
|
|
212
|
+
}
|
|
213
|
+
nodeEdges(d, h) {
|
|
214
|
+
if (d in this._nodes) return this.filterEdges({ ...this._in[d], ...this._out[d] }, d, h);
|
|
215
|
+
}
|
|
216
|
+
filterEdges(d, h, f) {
|
|
217
|
+
if (d) {
|
|
218
|
+
var m = Object.values(d);
|
|
219
|
+
return f ? m.filter(function(p) {
|
|
220
|
+
return p.v === h && p.w === f || p.v === f && p.w === h;
|
|
221
|
+
}) : m;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
function s(d, h) {
|
|
226
|
+
d[h] ? d[h]++ : d[h] = 1;
|
|
227
|
+
}
|
|
228
|
+
function a(d, h) {
|
|
229
|
+
--d[h] || delete d[h];
|
|
230
|
+
}
|
|
231
|
+
function l(d, h, f, m) {
|
|
232
|
+
var p = "" + h, w = "" + f;
|
|
233
|
+
if (!d && p > w) {
|
|
234
|
+
var b = p;
|
|
235
|
+
p = w, w = b;
|
|
236
|
+
}
|
|
237
|
+
return p + i + w + i + (m === void 0 ? r : m);
|
|
238
|
+
}
|
|
239
|
+
function u(d, h, f, m) {
|
|
240
|
+
var p = "" + h, w = "" + f;
|
|
241
|
+
if (!d && p > w) {
|
|
242
|
+
var b = p;
|
|
243
|
+
p = w, w = b;
|
|
244
|
+
}
|
|
245
|
+
var g = { v: p, w };
|
|
246
|
+
return m && (g.name = m), g;
|
|
247
|
+
}
|
|
248
|
+
function c(d, h) {
|
|
249
|
+
return l(d, h.v, h.w, h.name);
|
|
250
|
+
}
|
|
251
|
+
t.exports = o;
|
|
252
|
+
}), Yt = E((e, t) => {
|
|
253
|
+
t.exports = "3.0.2";
|
|
254
|
+
}), Bt = E((e, t) => {
|
|
255
|
+
t.exports = { Graph: R(), version: Yt() };
|
|
256
|
+
}), Wt = E((e, t) => {
|
|
257
|
+
var r = R();
|
|
258
|
+
t.exports = { write: n, read: s };
|
|
259
|
+
function n(a) {
|
|
260
|
+
var l = { options: { directed: a.isDirected(), multigraph: a.isMultigraph(), compound: a.isCompound() }, nodes: i(a), edges: o(a) };
|
|
261
|
+
return a.graph() !== void 0 && (l.value = structuredClone(a.graph())), l;
|
|
262
|
+
}
|
|
263
|
+
function i(a) {
|
|
264
|
+
return a.nodes().map(function(l) {
|
|
265
|
+
var u = a.node(l), c = a.parent(l), d = { v: l };
|
|
266
|
+
return u !== void 0 && (d.value = u), c !== void 0 && (d.parent = c), d;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function o(a) {
|
|
270
|
+
return a.edges().map(function(l) {
|
|
271
|
+
var u = a.edge(l), c = { v: l.v, w: l.w };
|
|
272
|
+
return l.name !== void 0 && (c.name = l.name), u !== void 0 && (c.value = u), c;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function s(a) {
|
|
276
|
+
var l = new r(a.options).setGraph(a.value);
|
|
277
|
+
return a.nodes.forEach(function(u) {
|
|
278
|
+
l.setNode(u.v, u.value), u.parent && l.setParent(u.v, u.parent);
|
|
279
|
+
}), a.edges.forEach(function(u) {
|
|
280
|
+
l.setEdge({ v: u.v, w: u.w, name: u.name }, u.value);
|
|
281
|
+
}), l;
|
|
282
|
+
}
|
|
283
|
+
}), U = E((e, t) => {
|
|
284
|
+
t.exports = n;
|
|
285
|
+
var r = () => 1;
|
|
286
|
+
function n(o, s, a, l) {
|
|
287
|
+
return i(o, String(s), a || r, l || function(u) {
|
|
288
|
+
return o.outEdges(u);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function i(o, s, a, l) {
|
|
292
|
+
var u = {}, c = true, d = 0, h = o.nodes(), f = function(b) {
|
|
293
|
+
var g = a(b);
|
|
294
|
+
u[b.v].distance + g < u[b.w].distance && (u[b.w] = { distance: u[b.v].distance + g, predecessor: b.v }, c = true);
|
|
295
|
+
}, m = function() {
|
|
296
|
+
h.forEach(function(b) {
|
|
297
|
+
l(b).forEach(function(g) {
|
|
298
|
+
var I = g.v === b ? g.v : g.w, Gt = I === g.v ? g.w : g.v;
|
|
299
|
+
f({ v: I, w: Gt });
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
h.forEach(function(b) {
|
|
304
|
+
var g = b === s ? 0 : Number.POSITIVE_INFINITY;
|
|
305
|
+
u[b] = { distance: g };
|
|
306
|
+
});
|
|
307
|
+
for (var p = h.length, w = 1; w < p && (c = false, d++, m(), !!c); w++) ;
|
|
308
|
+
if (d === p - 1 && (c = false, m(), c)) throw new Error("The graph contains a negative weight cycle");
|
|
309
|
+
return u;
|
|
310
|
+
}
|
|
311
|
+
}), zt = E((e, t) => {
|
|
312
|
+
t.exports = r;
|
|
313
|
+
function r(n) {
|
|
314
|
+
var i = {}, o = [], s;
|
|
315
|
+
function a(l) {
|
|
316
|
+
Object.hasOwn(i, l) || (i[l] = true, s.push(l), n.successors(l).forEach(a), n.predecessors(l).forEach(a));
|
|
317
|
+
}
|
|
318
|
+
return n.nodes().forEach(function(l) {
|
|
319
|
+
s = [], a(l), s.length && o.push(s);
|
|
320
|
+
}), o;
|
|
321
|
+
}
|
|
322
|
+
}), K = E((e, t) => {
|
|
323
|
+
var r = class {
|
|
324
|
+
constructor() {
|
|
325
|
+
k(this, "_arr", []), k(this, "_keyIndices", {});
|
|
326
|
+
}
|
|
327
|
+
size() {
|
|
328
|
+
return this._arr.length;
|
|
329
|
+
}
|
|
330
|
+
keys() {
|
|
331
|
+
return this._arr.map(function(n) {
|
|
332
|
+
return n.key;
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
has(n) {
|
|
336
|
+
return Object.hasOwn(this._keyIndices, n);
|
|
337
|
+
}
|
|
338
|
+
priority(n) {
|
|
339
|
+
var i = this._keyIndices[n];
|
|
340
|
+
if (i !== void 0) return this._arr[i].priority;
|
|
341
|
+
}
|
|
342
|
+
min() {
|
|
343
|
+
if (this.size() === 0) throw new Error("Queue underflow");
|
|
344
|
+
return this._arr[0].key;
|
|
345
|
+
}
|
|
346
|
+
add(n, i) {
|
|
347
|
+
var o = this._keyIndices;
|
|
348
|
+
if (n = String(n), !Object.hasOwn(o, n)) {
|
|
349
|
+
var s = this._arr, a = s.length;
|
|
350
|
+
return o[n] = a, s.push({ key: n, priority: i }), this._decrease(a), true;
|
|
351
|
+
}
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
removeMin() {
|
|
355
|
+
this._swap(0, this._arr.length - 1);
|
|
356
|
+
var n = this._arr.pop();
|
|
357
|
+
return delete this._keyIndices[n.key], this._heapify(0), n.key;
|
|
358
|
+
}
|
|
359
|
+
decrease(n, i) {
|
|
360
|
+
var o = this._keyIndices[n];
|
|
361
|
+
if (i > this._arr[o].priority) throw new Error("New priority is greater than current priority. Key: " + n + " Old: " + this._arr[o].priority + " New: " + i);
|
|
362
|
+
this._arr[o].priority = i, this._decrease(o);
|
|
363
|
+
}
|
|
364
|
+
_heapify(n) {
|
|
365
|
+
var i = this._arr, o = 2 * n, s = o + 1, a = n;
|
|
366
|
+
o < i.length && (a = i[o].priority < i[a].priority ? o : a, s < i.length && (a = i[s].priority < i[a].priority ? s : a), a !== n && (this._swap(n, a), this._heapify(a)));
|
|
367
|
+
}
|
|
368
|
+
_decrease(n) {
|
|
369
|
+
for (var i = this._arr, o = i[n].priority, s; n !== 0 && (s = n >> 1, !(i[s].priority < o)); ) this._swap(n, s), n = s;
|
|
370
|
+
}
|
|
371
|
+
_swap(n, i) {
|
|
372
|
+
var o = this._arr, s = this._keyIndices, a = o[n], l = o[i];
|
|
373
|
+
o[n] = l, o[i] = a, s[l.key] = n, s[a.key] = i;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
t.exports = r;
|
|
377
|
+
}), T = E((e, t) => {
|
|
378
|
+
var r = K();
|
|
379
|
+
t.exports = i;
|
|
380
|
+
var n = () => 1;
|
|
381
|
+
function i(s, a, l, u) {
|
|
382
|
+
var c = function(d) {
|
|
383
|
+
return s.outEdges(d);
|
|
384
|
+
};
|
|
385
|
+
return o(s, String(a), l || n, u || c);
|
|
386
|
+
}
|
|
387
|
+
function o(s, a, l, u) {
|
|
388
|
+
var c = {}, d = new r(), h, f, m = function(p) {
|
|
389
|
+
var w = p.v !== h ? p.v : p.w, b = c[w], g = l(p), I = f.distance + g;
|
|
390
|
+
if (g < 0) throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + p + " Weight: " + g);
|
|
391
|
+
I < b.distance && (b.distance = I, b.predecessor = h, d.decrease(w, I));
|
|
392
|
+
};
|
|
393
|
+
for (s.nodes().forEach(function(p) {
|
|
394
|
+
var w = p === a ? 0 : Number.POSITIVE_INFINITY;
|
|
395
|
+
c[p] = { distance: w }, d.add(p, w);
|
|
396
|
+
}); d.size() > 0 && (h = d.removeMin(), f = c[h], f.distance !== Number.POSITIVE_INFINITY); ) u(h).forEach(m);
|
|
397
|
+
return c;
|
|
398
|
+
}
|
|
399
|
+
}), Xt = E((e, t) => {
|
|
400
|
+
var r = T();
|
|
401
|
+
t.exports = n;
|
|
402
|
+
function n(i, o, s) {
|
|
403
|
+
return i.nodes().reduce(function(a, l) {
|
|
404
|
+
return a[l] = r(i, l, o, s), a;
|
|
405
|
+
}, {});
|
|
406
|
+
}
|
|
407
|
+
}), Ht = E((e, t) => {
|
|
408
|
+
t.exports = r;
|
|
409
|
+
function r(i, o, s) {
|
|
410
|
+
if (i[o].predecessor !== void 0) throw new Error("Invalid source vertex");
|
|
411
|
+
if (i[s].predecessor === void 0 && s !== o) throw new Error("Invalid destination vertex");
|
|
412
|
+
return { weight: i[s].distance, path: n(i, o, s) };
|
|
413
|
+
}
|
|
414
|
+
function n(i, o, s) {
|
|
415
|
+
for (var a = [], l = s; l !== o; ) a.push(l), l = i[l].predecessor;
|
|
416
|
+
return a.push(o), a.reverse();
|
|
417
|
+
}
|
|
418
|
+
}), Q = E((e, t) => {
|
|
419
|
+
t.exports = r;
|
|
420
|
+
function r(n) {
|
|
421
|
+
var i = 0, o = [], s = {}, a = [];
|
|
422
|
+
function l(u) {
|
|
423
|
+
var c = s[u] = { onStack: true, lowlink: i, index: i++ };
|
|
424
|
+
if (o.push(u), n.successors(u).forEach(function(f) {
|
|
425
|
+
Object.hasOwn(s, f) ? s[f].onStack && (c.lowlink = Math.min(c.lowlink, s[f].index)) : (l(f), c.lowlink = Math.min(c.lowlink, s[f].lowlink));
|
|
426
|
+
}), c.lowlink === c.index) {
|
|
427
|
+
var d = [], h;
|
|
428
|
+
do
|
|
429
|
+
h = o.pop(), s[h].onStack = false, d.push(h);
|
|
430
|
+
while (u !== h);
|
|
431
|
+
a.push(d);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return n.nodes().forEach(function(u) {
|
|
435
|
+
Object.hasOwn(s, u) || l(u);
|
|
436
|
+
}), a;
|
|
437
|
+
}
|
|
438
|
+
}), Ut = E((e, t) => {
|
|
439
|
+
var r = Q();
|
|
440
|
+
t.exports = n;
|
|
441
|
+
function n(i) {
|
|
442
|
+
return r(i).filter(function(o) {
|
|
443
|
+
return o.length > 1 || o.length === 1 && i.hasEdge(o[0], o[0]);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}), Kt = E((e, t) => {
|
|
447
|
+
t.exports = n;
|
|
448
|
+
var r = () => 1;
|
|
449
|
+
function n(o, s, a) {
|
|
450
|
+
return i(o, s || r, a || function(l) {
|
|
451
|
+
return o.outEdges(l);
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
function i(o, s, a) {
|
|
455
|
+
var l = {}, u = o.nodes();
|
|
456
|
+
return u.forEach(function(c) {
|
|
457
|
+
l[c] = {}, l[c][c] = { distance: 0 }, u.forEach(function(d) {
|
|
458
|
+
c !== d && (l[c][d] = { distance: Number.POSITIVE_INFINITY });
|
|
459
|
+
}), a(c).forEach(function(d) {
|
|
460
|
+
var h = d.v === c ? d.w : d.v, f = s(d);
|
|
461
|
+
l[c][h] = { distance: f, predecessor: c };
|
|
462
|
+
});
|
|
463
|
+
}), u.forEach(function(c) {
|
|
464
|
+
var d = l[c];
|
|
465
|
+
u.forEach(function(h) {
|
|
466
|
+
var f = l[h];
|
|
467
|
+
u.forEach(function(m) {
|
|
468
|
+
var p = f[c], w = d[m], b = f[m], g = p.distance + w.distance;
|
|
469
|
+
g < b.distance && (b.distance = g, b.predecessor = w.predecessor);
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
}), l;
|
|
473
|
+
}
|
|
474
|
+
}), J = E((e, t) => {
|
|
475
|
+
function r(i) {
|
|
476
|
+
var o = {}, s = {}, a = [];
|
|
477
|
+
function l(u) {
|
|
478
|
+
if (Object.hasOwn(s, u)) throw new n();
|
|
479
|
+
Object.hasOwn(o, u) || (s[u] = true, o[u] = true, i.predecessors(u).forEach(l), delete s[u], a.push(u));
|
|
480
|
+
}
|
|
481
|
+
if (i.sinks().forEach(l), Object.keys(o).length !== i.nodeCount()) throw new n();
|
|
482
|
+
return a;
|
|
483
|
+
}
|
|
484
|
+
var n = class extends Error {
|
|
485
|
+
constructor() {
|
|
486
|
+
super(...arguments);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
t.exports = r, r.CycleException = n;
|
|
490
|
+
}), Qt = E((e, t) => {
|
|
491
|
+
var r = J();
|
|
492
|
+
t.exports = n;
|
|
493
|
+
function n(i) {
|
|
494
|
+
try {
|
|
495
|
+
r(i);
|
|
496
|
+
} catch (o) {
|
|
497
|
+
if (o instanceof r.CycleException) return false;
|
|
498
|
+
throw o;
|
|
499
|
+
}
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
502
|
+
}), Z = E((e, t) => {
|
|
503
|
+
t.exports = r;
|
|
504
|
+
function r(i, o, s, a, l) {
|
|
505
|
+
Array.isArray(o) || (o = [o]);
|
|
506
|
+
var u = (i.isDirected() ? i.successors : i.neighbors).bind(i), c = {};
|
|
507
|
+
return o.forEach(function(d) {
|
|
508
|
+
if (!i.hasNode(d)) throw new Error("Graph does not have node: " + d);
|
|
509
|
+
l = n(i, d, s === "post", c, u, a, l);
|
|
510
|
+
}), l;
|
|
511
|
+
}
|
|
512
|
+
function n(i, o, s, a, l, u, c) {
|
|
513
|
+
return Object.hasOwn(a, o) || (a[o] = true, s || (c = u(c, o)), l(o).forEach(function(d) {
|
|
514
|
+
c = n(i, d, s, a, l, u, c);
|
|
515
|
+
}), s && (c = u(c, o))), c;
|
|
516
|
+
}
|
|
517
|
+
}), $ = E((e, t) => {
|
|
518
|
+
var r = Z();
|
|
519
|
+
t.exports = n;
|
|
520
|
+
function n(i, o, s) {
|
|
521
|
+
return r(i, o, s, function(a, l) {
|
|
522
|
+
return a.push(l), a;
|
|
523
|
+
}, []);
|
|
524
|
+
}
|
|
525
|
+
}), Jt = E((e, t) => {
|
|
526
|
+
var r = $();
|
|
527
|
+
t.exports = n;
|
|
528
|
+
function n(i, o) {
|
|
529
|
+
return r(i, o, "post");
|
|
530
|
+
}
|
|
531
|
+
}), Zt = E((e, t) => {
|
|
532
|
+
var r = $();
|
|
533
|
+
t.exports = n;
|
|
534
|
+
function n(i, o) {
|
|
535
|
+
return r(i, o, "pre");
|
|
536
|
+
}
|
|
537
|
+
}), $t = E((e, t) => {
|
|
538
|
+
var r = R(), n = K();
|
|
539
|
+
t.exports = i;
|
|
540
|
+
function i(o, s) {
|
|
541
|
+
var a = new r(), l = {}, u = new n(), c;
|
|
542
|
+
function d(f) {
|
|
543
|
+
var m = f.v === c ? f.w : f.v, p = u.priority(m);
|
|
544
|
+
if (p !== void 0) {
|
|
545
|
+
var w = s(f);
|
|
546
|
+
w < p && (l[m] = c, u.decrease(m, w));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
if (o.nodeCount() === 0) return a;
|
|
550
|
+
o.nodes().forEach(function(f) {
|
|
551
|
+
u.add(f, Number.POSITIVE_INFINITY), a.setNode(f);
|
|
552
|
+
}), u.decrease(o.nodes()[0], 0);
|
|
553
|
+
for (var h = false; u.size() > 0; ) {
|
|
554
|
+
if (c = u.removeMin(), Object.hasOwn(l, c)) a.setEdge(c, l[c]);
|
|
555
|
+
else {
|
|
556
|
+
if (h) throw new Error("Input graph is not connected: " + o);
|
|
557
|
+
h = true;
|
|
558
|
+
}
|
|
559
|
+
o.nodeEdges(c).forEach(d);
|
|
560
|
+
}
|
|
561
|
+
return a;
|
|
562
|
+
}
|
|
563
|
+
}), er = E((e, t) => {
|
|
564
|
+
var r = T(), n = U();
|
|
565
|
+
t.exports = i;
|
|
566
|
+
function i(s, a, l, u) {
|
|
567
|
+
return o(s, a, l, u || function(c) {
|
|
568
|
+
return s.outEdges(c);
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function o(s, a, l, u) {
|
|
572
|
+
if (l === void 0) return r(s, a, l, u);
|
|
573
|
+
for (var c = false, d = s.nodes(), h = 0; h < d.length; h++) {
|
|
574
|
+
for (var f = u(d[h]), m = 0; m < f.length; m++) {
|
|
575
|
+
var p = f[m], w = p.v === d[h] ? p.v : p.w, b = w === p.v ? p.w : p.v;
|
|
576
|
+
l({ v: w, w: b }) < 0 && (c = true);
|
|
577
|
+
}
|
|
578
|
+
if (c) return n(s, a, l, u);
|
|
579
|
+
}
|
|
580
|
+
return r(s, a, l, u);
|
|
581
|
+
}
|
|
582
|
+
}), tr = E((e, t) => {
|
|
583
|
+
t.exports = { bellmanFord: U(), components: zt(), dijkstra: T(), dijkstraAll: Xt(), extractPath: Ht(), findCycles: Ut(), floydWarshall: Kt(), isAcyclic: Qt(), postorder: Jt(), preorder: Zt(), prim: $t(), shortestPaths: er(), reduce: Z(), tarjan: Q(), topsort: J() };
|
|
584
|
+
}), H = Bt();
|
|
585
|
+
ee.exports = { Graph: H.Graph, json: Wt(), alg: tr(), version: H.version };
|
|
586
|
+
});
|
|
587
|
+
var ne = v((Ai, re) => {
|
|
588
|
+
var S = class {
|
|
589
|
+
constructor() {
|
|
590
|
+
let t = {};
|
|
591
|
+
t._next = t._prev = t, this._sentinel = t;
|
|
592
|
+
}
|
|
593
|
+
dequeue() {
|
|
594
|
+
let t = this._sentinel, r = t._prev;
|
|
595
|
+
if (r !== t) return te(r), r;
|
|
596
|
+
}
|
|
597
|
+
enqueue(t) {
|
|
598
|
+
let r = this._sentinel;
|
|
599
|
+
t._prev && t._next && te(t), t._next = r._next, r._next._prev = t, r._next = t, t._prev = r;
|
|
600
|
+
}
|
|
601
|
+
toString() {
|
|
602
|
+
let t = [], r = this._sentinel, n = r._prev;
|
|
603
|
+
for (; n !== r; ) t.push(JSON.stringify(n, rr)), n = n._prev;
|
|
604
|
+
return "[" + t.join(", ") + "]";
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
function te(e) {
|
|
608
|
+
e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
|
|
609
|
+
}
|
|
610
|
+
function rr(e, t) {
|
|
611
|
+
if (e !== "_next" && e !== "_prev") return t;
|
|
612
|
+
}
|
|
613
|
+
re.exports = S;
|
|
614
|
+
});
|
|
615
|
+
var oe = v((Yi, ie) => {
|
|
616
|
+
var nr = y().Graph, ir = ne();
|
|
617
|
+
ie.exports = sr;
|
|
618
|
+
var or = () => 1;
|
|
619
|
+
function sr(e, t) {
|
|
620
|
+
if (e.nodeCount() <= 1) return [];
|
|
621
|
+
let r = dr(e, t || or);
|
|
622
|
+
return ar(r.graph, r.buckets, r.zeroIdx).flatMap((i) => e.outEdges(i.v, i.w));
|
|
623
|
+
}
|
|
624
|
+
function ar(e, t, r) {
|
|
625
|
+
let n = [], i = t[t.length - 1], o = t[0], s;
|
|
626
|
+
for (; e.nodeCount(); ) {
|
|
627
|
+
for (; s = o.dequeue(); ) P(e, t, r, s);
|
|
628
|
+
for (; s = i.dequeue(); ) P(e, t, r, s);
|
|
629
|
+
if (e.nodeCount()) {
|
|
630
|
+
for (let a = t.length - 2; a > 0; --a) if (s = t[a].dequeue(), s) {
|
|
631
|
+
n = n.concat(P(e, t, r, s, true));
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
return n;
|
|
637
|
+
}
|
|
638
|
+
function P(e, t, r, n, i) {
|
|
639
|
+
let o = i ? [] : void 0;
|
|
640
|
+
return e.inEdges(n.v).forEach((s) => {
|
|
641
|
+
let a = e.edge(s), l = e.node(s.v);
|
|
642
|
+
i && o.push({ v: s.v, w: s.w }), l.out -= a, F(t, r, l);
|
|
643
|
+
}), e.outEdges(n.v).forEach((s) => {
|
|
644
|
+
let a = e.edge(s), l = s.w, u = e.node(l);
|
|
645
|
+
u.in -= a, F(t, r, u);
|
|
646
|
+
}), e.removeNode(n.v), o;
|
|
647
|
+
}
|
|
648
|
+
function dr(e, t) {
|
|
649
|
+
let r = new nr(), n = 0, i = 0;
|
|
650
|
+
e.nodes().forEach((a) => {
|
|
651
|
+
r.setNode(a, { v: a, in: 0, out: 0 });
|
|
652
|
+
}), e.edges().forEach((a) => {
|
|
653
|
+
let l = r.edge(a.v, a.w) || 0, u = t(a), c = l + u;
|
|
654
|
+
r.setEdge(a.v, a.w, c), i = Math.max(i, r.node(a.v).out += u), n = Math.max(n, r.node(a.w).in += u);
|
|
655
|
+
});
|
|
656
|
+
let o = lr(i + n + 3).map(() => new ir()), s = n + 1;
|
|
657
|
+
return r.nodes().forEach((a) => {
|
|
658
|
+
F(o, s, r.node(a));
|
|
659
|
+
}), { graph: r, buckets: o, zeroIdx: s };
|
|
660
|
+
}
|
|
661
|
+
function F(e, t, r) {
|
|
662
|
+
r.out ? r.in ? e[r.out - r.in + t].enqueue(r) : e[e.length - 1].enqueue(r) : e[0].enqueue(r);
|
|
663
|
+
}
|
|
664
|
+
function lr(e) {
|
|
665
|
+
let t = [];
|
|
666
|
+
for (let r = 0; r < e; r++) t.push(r);
|
|
667
|
+
return t;
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
var _ = v((Bi, ce) => {
|
|
671
|
+
"use strict";
|
|
672
|
+
var se = y().Graph;
|
|
673
|
+
ce.exports = { addBorderNode: vr, addDummyNode: ae, applyWithChunking: C, asNonCompoundGraph: hr, buildLayerMatrix: mr, intersectRect: pr, mapValues: Or, maxRank: le, normalizeRanks: wr, notime: kr, partition: Er, pick: xr, predecessorWeights: fr, range: he, removeEmptyRanks: br, simplify: ur, successorWeights: cr, time: _r, uniqueId: ue, zipObject: D };
|
|
674
|
+
function ae(e, t, r, n) {
|
|
675
|
+
for (var i = n; e.hasNode(i); ) i = ue(n);
|
|
676
|
+
return r.dummy = t, e.setNode(i, r), i;
|
|
677
|
+
}
|
|
678
|
+
function ur(e) {
|
|
679
|
+
let t = new se().setGraph(e.graph());
|
|
680
|
+
return e.nodes().forEach((r) => t.setNode(r, e.node(r))), e.edges().forEach((r) => {
|
|
681
|
+
let n = t.edge(r.v, r.w) || { weight: 0, minlen: 1 }, i = e.edge(r);
|
|
682
|
+
t.setEdge(r.v, r.w, { weight: n.weight + i.weight, minlen: Math.max(n.minlen, i.minlen) });
|
|
683
|
+
}), t;
|
|
684
|
+
}
|
|
685
|
+
function hr(e) {
|
|
686
|
+
let t = new se({ multigraph: e.isMultigraph() }).setGraph(e.graph());
|
|
687
|
+
return e.nodes().forEach((r) => {
|
|
688
|
+
e.children(r).length || t.setNode(r, e.node(r));
|
|
689
|
+
}), e.edges().forEach((r) => {
|
|
690
|
+
t.setEdge(r, e.edge(r));
|
|
691
|
+
}), t;
|
|
692
|
+
}
|
|
693
|
+
function cr(e) {
|
|
694
|
+
let t = e.nodes().map((r) => {
|
|
695
|
+
let n = {};
|
|
696
|
+
return e.outEdges(r).forEach((i) => {
|
|
697
|
+
n[i.w] = (n[i.w] || 0) + e.edge(i).weight;
|
|
698
|
+
}), n;
|
|
699
|
+
});
|
|
700
|
+
return D(e.nodes(), t);
|
|
701
|
+
}
|
|
702
|
+
function fr(e) {
|
|
703
|
+
let t = e.nodes().map((r) => {
|
|
704
|
+
let n = {};
|
|
705
|
+
return e.inEdges(r).forEach((i) => {
|
|
706
|
+
n[i.v] = (n[i.v] || 0) + e.edge(i).weight;
|
|
707
|
+
}), n;
|
|
708
|
+
});
|
|
709
|
+
return D(e.nodes(), t);
|
|
710
|
+
}
|
|
711
|
+
function pr(e, t) {
|
|
712
|
+
let r = e.x, n = e.y, i = t.x - r, o = t.y - n, s = e.width / 2, a = e.height / 2;
|
|
713
|
+
if (!i && !o) throw new Error("Not possible to find intersection inside of the rectangle");
|
|
714
|
+
let l, u;
|
|
715
|
+
return Math.abs(o) * s > Math.abs(i) * a ? (o < 0 && (a = -a), l = a * i / o, u = a) : (i < 0 && (s = -s), l = s, u = s * o / i), { x: r + l, y: n + u };
|
|
716
|
+
}
|
|
717
|
+
function mr(e) {
|
|
718
|
+
let t = he(le(e) + 1).map(() => []);
|
|
719
|
+
return e.nodes().forEach((r) => {
|
|
720
|
+
let n = e.node(r), i = n.rank;
|
|
721
|
+
i !== void 0 && (t[i][n.order] = r);
|
|
722
|
+
}), t;
|
|
723
|
+
}
|
|
724
|
+
function wr(e) {
|
|
725
|
+
let t = e.nodes().map((n) => {
|
|
726
|
+
let i = e.node(n).rank;
|
|
727
|
+
return i === void 0 ? Number.MAX_VALUE : i;
|
|
728
|
+
}), r = C(Math.min, t);
|
|
729
|
+
e.nodes().forEach((n) => {
|
|
730
|
+
let i = e.node(n);
|
|
731
|
+
Object.hasOwn(i, "rank") && (i.rank -= r);
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
function br(e) {
|
|
735
|
+
let t = e.nodes().map((s) => e.node(s).rank).filter((s) => s !== void 0), r = C(Math.min, t), n = [];
|
|
736
|
+
e.nodes().forEach((s) => {
|
|
737
|
+
let a = e.node(s).rank - r;
|
|
738
|
+
n[a] || (n[a] = []), n[a].push(s);
|
|
739
|
+
});
|
|
740
|
+
let i = 0, o = e.graph().nodeRankFactor;
|
|
741
|
+
Array.from(n).forEach((s, a) => {
|
|
742
|
+
s === void 0 && a % o !== 0 ? --i : s !== void 0 && i && s.forEach((l) => e.node(l).rank += i);
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function vr(e, t, r, n) {
|
|
746
|
+
let i = { width: 0, height: 0 };
|
|
747
|
+
return arguments.length >= 4 && (i.rank = r, i.order = n), ae(e, "border", i, t);
|
|
748
|
+
}
|
|
749
|
+
function gr(e, t = de) {
|
|
750
|
+
let r = [];
|
|
751
|
+
for (let n = 0; n < e.length; n += t) {
|
|
752
|
+
let i = e.slice(n, n + t);
|
|
753
|
+
r.push(i);
|
|
754
|
+
}
|
|
755
|
+
return r;
|
|
756
|
+
}
|
|
757
|
+
var de = 65535;
|
|
758
|
+
function C(e, t) {
|
|
759
|
+
if (t.length > de) {
|
|
760
|
+
let r = gr(t);
|
|
761
|
+
return e.apply(null, r.map((n) => e.apply(null, n)));
|
|
762
|
+
} else return e.apply(null, t);
|
|
763
|
+
}
|
|
764
|
+
function le(e) {
|
|
765
|
+
let r = e.nodes().map((n) => {
|
|
766
|
+
let i = e.node(n).rank;
|
|
767
|
+
return i === void 0 ? Number.MIN_VALUE : i;
|
|
768
|
+
});
|
|
769
|
+
return C(Math.max, r);
|
|
770
|
+
}
|
|
771
|
+
function Er(e, t) {
|
|
772
|
+
let r = { lhs: [], rhs: [] };
|
|
773
|
+
return e.forEach((n) => {
|
|
774
|
+
t(n) ? r.lhs.push(n) : r.rhs.push(n);
|
|
775
|
+
}), r;
|
|
776
|
+
}
|
|
777
|
+
function _r(e, t) {
|
|
778
|
+
let r = Date.now();
|
|
779
|
+
try {
|
|
780
|
+
return t();
|
|
781
|
+
} finally {
|
|
782
|
+
console.log(e + " time: " + (Date.now() - r) + "ms");
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function kr(e, t) {
|
|
786
|
+
return t();
|
|
787
|
+
}
|
|
788
|
+
var yr = 0;
|
|
789
|
+
function ue(e) {
|
|
790
|
+
var t = ++yr;
|
|
791
|
+
return e + ("" + t);
|
|
792
|
+
}
|
|
793
|
+
function he(e, t, r = 1) {
|
|
794
|
+
t == null && (t = e, e = 0);
|
|
795
|
+
let n = (o) => o < t;
|
|
796
|
+
r < 0 && (n = (o) => t < o);
|
|
797
|
+
let i = [];
|
|
798
|
+
for (let o = e; n(o); o += r) i.push(o);
|
|
799
|
+
return i;
|
|
800
|
+
}
|
|
801
|
+
function xr(e, t) {
|
|
802
|
+
let r = {};
|
|
803
|
+
for (let n of t) e[n] !== void 0 && (r[n] = e[n]);
|
|
804
|
+
return r;
|
|
805
|
+
}
|
|
806
|
+
function Or(e, t) {
|
|
807
|
+
let r = t;
|
|
808
|
+
return typeof t == "string" && (r = (n) => n[t]), Object.entries(e).reduce((n, [i, o]) => (n[i] = r(o, i), n), {});
|
|
809
|
+
}
|
|
810
|
+
function D(e, t) {
|
|
811
|
+
return e.reduce((r, n, i) => (r[n] = t[i], r), {});
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
var pe = v((Wi, fe) => {
|
|
815
|
+
"use strict";
|
|
816
|
+
var Nr = oe(), Ir = _().uniqueId;
|
|
817
|
+
fe.exports = { run: jr, undo: Lr };
|
|
818
|
+
function jr(e) {
|
|
819
|
+
(e.graph().acyclicer === "greedy" ? Nr(e, r(e)) : Cr(e)).forEach((n) => {
|
|
820
|
+
let i = e.edge(n);
|
|
821
|
+
e.removeEdge(n), i.forwardName = n.name, i.reversed = true, e.setEdge(n.w, n.v, i, Ir("rev"));
|
|
822
|
+
});
|
|
823
|
+
function r(n) {
|
|
824
|
+
return (i) => n.edge(i).weight;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
function Cr(e) {
|
|
828
|
+
let t = [], r = {}, n = {};
|
|
829
|
+
function i(o) {
|
|
830
|
+
Object.hasOwn(n, o) || (n[o] = true, r[o] = true, e.outEdges(o).forEach((s) => {
|
|
831
|
+
Object.hasOwn(r, s.w) ? t.push(s) : i(s.w);
|
|
832
|
+
}), delete r[o]);
|
|
833
|
+
}
|
|
834
|
+
return e.nodes().forEach(i), t;
|
|
835
|
+
}
|
|
836
|
+
function Lr(e) {
|
|
837
|
+
e.edges().forEach((t) => {
|
|
838
|
+
let r = e.edge(t);
|
|
839
|
+
if (r.reversed) {
|
|
840
|
+
e.removeEdge(t);
|
|
841
|
+
let n = r.forwardName;
|
|
842
|
+
delete r.reversed, delete r.forwardName, e.setEdge(t.w, t.v, r, n);
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
var we = v((zi, me) => {
|
|
848
|
+
"use strict";
|
|
849
|
+
var qr = _();
|
|
850
|
+
me.exports = { run: Mr, undo: Tr };
|
|
851
|
+
function Mr(e) {
|
|
852
|
+
e.graph().dummyChains = [], e.edges().forEach((t) => Rr(e, t));
|
|
853
|
+
}
|
|
854
|
+
function Rr(e, t) {
|
|
855
|
+
let r = t.v, n = e.node(r).rank, i = t.w, o = e.node(i).rank, s = t.name, a = e.edge(t), l = a.labelRank;
|
|
856
|
+
if (o === n + 1) return;
|
|
857
|
+
e.removeEdge(t);
|
|
858
|
+
let u, c, d;
|
|
859
|
+
for (d = 0, ++n; n < o; ++d, ++n) a.points = [], c = { width: 0, height: 0, edgeLabel: a, edgeObj: t, rank: n }, u = qr.addDummyNode(e, "edge", c, "_d"), n === l && (c.width = a.width, c.height = a.height, c.dummy = "edge-label", c.labelpos = a.labelpos), e.setEdge(r, u, { weight: a.weight }, s), d === 0 && e.graph().dummyChains.push(u), r = u;
|
|
860
|
+
e.setEdge(r, i, { weight: a.weight }, s);
|
|
861
|
+
}
|
|
862
|
+
function Tr(e) {
|
|
863
|
+
e.graph().dummyChains.forEach((t) => {
|
|
864
|
+
let r = e.node(t), n = r.edgeLabel, i;
|
|
865
|
+
for (e.setEdge(r.edgeObj, n); r.dummy; ) i = e.successors(t)[0], e.removeNode(t), n.points.push({ x: r.x, y: r.y }), r.dummy === "edge-label" && (n.x = r.x, n.y = r.y, n.width = r.width, n.height = r.height), t = i, r = e.node(t);
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
var j = v((Xi, be) => {
|
|
870
|
+
"use strict";
|
|
871
|
+
var { applyWithChunking: Sr } = _();
|
|
872
|
+
be.exports = { longestPath: Pr, slack: Fr };
|
|
873
|
+
function Pr(e) {
|
|
874
|
+
var t = {};
|
|
875
|
+
function r(n) {
|
|
876
|
+
var i = e.node(n);
|
|
877
|
+
if (Object.hasOwn(t, n)) return i.rank;
|
|
878
|
+
t[n] = true;
|
|
879
|
+
let o = e.outEdges(n).map((a) => a == null ? Number.POSITIVE_INFINITY : r(a.w) - e.edge(a).minlen);
|
|
880
|
+
var s = Sr(Math.min, o);
|
|
881
|
+
return s === Number.POSITIVE_INFINITY && (s = 0), i.rank = s;
|
|
882
|
+
}
|
|
883
|
+
e.sources().forEach(r);
|
|
884
|
+
}
|
|
885
|
+
function Fr(e, t) {
|
|
886
|
+
return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
var G = v((Hi, ve) => {
|
|
890
|
+
"use strict";
|
|
891
|
+
var Dr = y().Graph, L = j().slack;
|
|
892
|
+
ve.exports = Gr;
|
|
893
|
+
function Gr(e) {
|
|
894
|
+
var t = new Dr({ directed: false }), r = e.nodes()[0], n = e.nodeCount();
|
|
895
|
+
t.setNode(r, {});
|
|
896
|
+
for (var i, o; Vr(t, e) < n; ) i = Ar(t, e), o = t.hasNode(i.v) ? L(e, i) : -L(e, i), Yr(t, e, o);
|
|
897
|
+
return t;
|
|
898
|
+
}
|
|
899
|
+
function Vr(e, t) {
|
|
900
|
+
function r(n) {
|
|
901
|
+
t.nodeEdges(n).forEach((i) => {
|
|
902
|
+
var o = i.v, s = n === o ? i.w : o;
|
|
903
|
+
!e.hasNode(s) && !L(t, i) && (e.setNode(s, {}), e.setEdge(n, s, {}), r(s));
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
return e.nodes().forEach(r), e.nodeCount();
|
|
907
|
+
}
|
|
908
|
+
function Ar(e, t) {
|
|
909
|
+
return t.edges().reduce((n, i) => {
|
|
910
|
+
let o = Number.POSITIVE_INFINITY;
|
|
911
|
+
return e.hasNode(i.v) !== e.hasNode(i.w) && (o = L(t, i)), o < n[0] ? [o, i] : n;
|
|
912
|
+
}, [Number.POSITIVE_INFINITY, null])[1];
|
|
913
|
+
}
|
|
914
|
+
function Yr(e, t, r) {
|
|
915
|
+
e.nodes().forEach((n) => t.node(n).rank += r);
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
var Ie = v((Ui, Ne) => {
|
|
919
|
+
"use strict";
|
|
920
|
+
var Br = G(), ge = j().slack, Wr = j().longestPath, zr = y().alg.preorder, Xr = y().alg.postorder, Hr = _().simplify;
|
|
921
|
+
Ne.exports = N;
|
|
922
|
+
N.initLowLimValues = A;
|
|
923
|
+
N.initCutValues = V;
|
|
924
|
+
N.calcCutValue = _e;
|
|
925
|
+
N.leaveEdge = ye;
|
|
926
|
+
N.enterEdge = xe;
|
|
927
|
+
N.exchangeEdges = Oe;
|
|
928
|
+
function N(e) {
|
|
929
|
+
e = Hr(e), Wr(e);
|
|
930
|
+
var t = Br(e);
|
|
931
|
+
A(t), V(t, e);
|
|
932
|
+
for (var r, n; r = ye(t); ) n = xe(t, e, r), Oe(t, e, r, n);
|
|
933
|
+
}
|
|
934
|
+
function V(e, t) {
|
|
935
|
+
var r = Xr(e, e.nodes());
|
|
936
|
+
r = r.slice(0, r.length - 1), r.forEach((n) => Ur(e, t, n));
|
|
937
|
+
}
|
|
938
|
+
function Ur(e, t, r) {
|
|
939
|
+
var n = e.node(r), i = n.parent;
|
|
940
|
+
e.edge(r, i).cutvalue = _e(e, t, r);
|
|
941
|
+
}
|
|
942
|
+
function _e(e, t, r) {
|
|
943
|
+
var n = e.node(r), i = n.parent, o = true, s = t.edge(r, i), a = 0;
|
|
944
|
+
return s || (o = false, s = t.edge(i, r)), a = s.weight, t.nodeEdges(r).forEach((l) => {
|
|
945
|
+
var u = l.v === r, c = u ? l.w : l.v;
|
|
946
|
+
if (c !== i) {
|
|
947
|
+
var d = u === o, h = t.edge(l).weight;
|
|
948
|
+
if (a += d ? h : -h, Qr(e, r, c)) {
|
|
949
|
+
var f = e.edge(r, c).cutvalue;
|
|
950
|
+
a += d ? -f : f;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
}), a;
|
|
954
|
+
}
|
|
955
|
+
function A(e, t) {
|
|
956
|
+
arguments.length < 2 && (t = e.nodes()[0]), ke(e, {}, 1, t);
|
|
957
|
+
}
|
|
958
|
+
function ke(e, t, r, n, i) {
|
|
959
|
+
var o = r, s = e.node(n);
|
|
960
|
+
return t[n] = true, e.neighbors(n).forEach((a) => {
|
|
961
|
+
Object.hasOwn(t, a) || (r = ke(e, t, r, a, n));
|
|
962
|
+
}), s.low = o, s.lim = r++, i ? s.parent = i : delete s.parent, r;
|
|
963
|
+
}
|
|
964
|
+
function ye(e) {
|
|
965
|
+
return e.edges().find((t) => e.edge(t).cutvalue < 0);
|
|
966
|
+
}
|
|
967
|
+
function xe(e, t, r) {
|
|
968
|
+
var n = r.v, i = r.w;
|
|
969
|
+
t.hasEdge(n, i) || (n = r.w, i = r.v);
|
|
970
|
+
var o = e.node(n), s = e.node(i), a = o, l = false;
|
|
971
|
+
o.lim > s.lim && (a = s, l = true);
|
|
972
|
+
var u = t.edges().filter((c) => l === Ee(e, e.node(c.v), a) && l !== Ee(e, e.node(c.w), a));
|
|
973
|
+
return u.reduce((c, d) => ge(t, d) < ge(t, c) ? d : c);
|
|
974
|
+
}
|
|
975
|
+
function Oe(e, t, r, n) {
|
|
976
|
+
var i = r.v, o = r.w;
|
|
977
|
+
e.removeEdge(i, o), e.setEdge(n.v, n.w, {}), A(e), V(e, t), Kr(e, t);
|
|
978
|
+
}
|
|
979
|
+
function Kr(e, t) {
|
|
980
|
+
var r = e.nodes().find((i) => !t.node(i).parent), n = zr(e, r);
|
|
981
|
+
n = n.slice(1), n.forEach((i) => {
|
|
982
|
+
var o = e.node(i).parent, s = t.edge(i, o), a = false;
|
|
983
|
+
s || (s = t.edge(o, i), a = true), t.node(i).rank = t.node(o).rank + (a ? s.minlen : -s.minlen);
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
function Qr(e, t, r) {
|
|
987
|
+
return e.hasEdge(t, r);
|
|
988
|
+
}
|
|
989
|
+
function Ee(e, t, r) {
|
|
990
|
+
return r.low <= t.lim && t.lim <= r.lim;
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
var qe = v((Ki, Le) => {
|
|
994
|
+
"use strict";
|
|
995
|
+
var Jr = j(), Ce = Jr.longestPath, Zr = G(), $r = Ie();
|
|
996
|
+
Le.exports = en;
|
|
997
|
+
function en(e) {
|
|
998
|
+
var t = e.graph().ranker;
|
|
999
|
+
if (t instanceof Function) return t(e);
|
|
1000
|
+
switch (e.graph().ranker) {
|
|
1001
|
+
case "network-simplex":
|
|
1002
|
+
je(e);
|
|
1003
|
+
break;
|
|
1004
|
+
case "tight-tree":
|
|
1005
|
+
rn(e);
|
|
1006
|
+
break;
|
|
1007
|
+
case "longest-path":
|
|
1008
|
+
tn(e);
|
|
1009
|
+
break;
|
|
1010
|
+
case "none":
|
|
1011
|
+
break;
|
|
1012
|
+
default:
|
|
1013
|
+
je(e);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
var tn = Ce;
|
|
1017
|
+
function rn(e) {
|
|
1018
|
+
Ce(e), Zr(e);
|
|
1019
|
+
}
|
|
1020
|
+
function je(e) {
|
|
1021
|
+
$r(e);
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
var Re = v((Qi, Me) => {
|
|
1025
|
+
Me.exports = nn;
|
|
1026
|
+
function nn(e) {
|
|
1027
|
+
let t = sn(e);
|
|
1028
|
+
e.graph().dummyChains.forEach((r) => {
|
|
1029
|
+
let n = e.node(r), i = n.edgeObj, o = on(e, t, i.v, i.w), s = o.path, a = o.lca, l = 0, u = s[l], c = true;
|
|
1030
|
+
for (; r !== i.w; ) {
|
|
1031
|
+
if (n = e.node(r), c) {
|
|
1032
|
+
for (; (u = s[l]) !== a && e.node(u).maxRank < n.rank; ) l++;
|
|
1033
|
+
u === a && (c = false);
|
|
1034
|
+
}
|
|
1035
|
+
if (!c) {
|
|
1036
|
+
for (; l < s.length - 1 && e.node(u = s[l + 1]).minRank <= n.rank; ) l++;
|
|
1037
|
+
u = s[l];
|
|
1038
|
+
}
|
|
1039
|
+
e.setParent(r, u), r = e.successors(r)[0];
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
function on(e, t, r, n) {
|
|
1044
|
+
let i = [], o = [], s = Math.min(t[r].low, t[n].low), a = Math.max(t[r].lim, t[n].lim), l, u;
|
|
1045
|
+
l = r;
|
|
1046
|
+
do
|
|
1047
|
+
l = e.parent(l), i.push(l);
|
|
1048
|
+
while (l && (t[l].low > s || a > t[l].lim));
|
|
1049
|
+
for (u = l, l = n; (l = e.parent(l)) !== u; ) o.push(l);
|
|
1050
|
+
return { path: i.concat(o.reverse()), lca: u };
|
|
1051
|
+
}
|
|
1052
|
+
function sn(e) {
|
|
1053
|
+
let t = {}, r = 0;
|
|
1054
|
+
function n(i) {
|
|
1055
|
+
let o = r;
|
|
1056
|
+
e.children(i).forEach(n), t[i] = { low: o, lim: r++ };
|
|
1057
|
+
}
|
|
1058
|
+
return e.children().forEach(n), t;
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
var Pe = v((Ji, Se) => {
|
|
1062
|
+
var q = _();
|
|
1063
|
+
Se.exports = { run: an, cleanup: un };
|
|
1064
|
+
function an(e) {
|
|
1065
|
+
let t = q.addDummyNode(e, "root", {}, "_root"), r = dn(e), n = Object.values(r), i = q.applyWithChunking(Math.max, n) - 1, o = 2 * i + 1;
|
|
1066
|
+
e.graph().nestingRoot = t, e.edges().forEach((a) => e.edge(a).minlen *= o);
|
|
1067
|
+
let s = ln(e) + 1;
|
|
1068
|
+
e.children().forEach((a) => Te(e, t, o, s, i, r, a)), e.graph().nodeRankFactor = o;
|
|
1069
|
+
}
|
|
1070
|
+
function Te(e, t, r, n, i, o, s) {
|
|
1071
|
+
let a = e.children(s);
|
|
1072
|
+
if (!a.length) {
|
|
1073
|
+
s !== t && e.setEdge(t, s, { weight: 0, minlen: r });
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
let l = q.addBorderNode(e, "_bt"), u = q.addBorderNode(e, "_bb"), c = e.node(s);
|
|
1077
|
+
e.setParent(l, s), c.borderTop = l, e.setParent(u, s), c.borderBottom = u, a.forEach((d) => {
|
|
1078
|
+
Te(e, t, r, n, i, o, d);
|
|
1079
|
+
let h = e.node(d), f = h.borderTop ? h.borderTop : d, m = h.borderBottom ? h.borderBottom : d, p = h.borderTop ? n : 2 * n, w = f !== m ? 1 : i - o[s] + 1;
|
|
1080
|
+
e.setEdge(l, f, { weight: p, minlen: w, nestingEdge: true }), e.setEdge(m, u, { weight: p, minlen: w, nestingEdge: true });
|
|
1081
|
+
}), e.parent(s) || e.setEdge(t, l, { weight: 0, minlen: i + o[s] });
|
|
1082
|
+
}
|
|
1083
|
+
function dn(e) {
|
|
1084
|
+
var t = {};
|
|
1085
|
+
function r(n, i) {
|
|
1086
|
+
var o = e.children(n);
|
|
1087
|
+
o && o.length && o.forEach((s) => r(s, i + 1)), t[n] = i;
|
|
1088
|
+
}
|
|
1089
|
+
return e.children().forEach((n) => r(n, 1)), t;
|
|
1090
|
+
}
|
|
1091
|
+
function ln(e) {
|
|
1092
|
+
return e.edges().reduce((t, r) => t + e.edge(r).weight, 0);
|
|
1093
|
+
}
|
|
1094
|
+
function un(e) {
|
|
1095
|
+
var t = e.graph();
|
|
1096
|
+
e.removeNode(t.nestingRoot), delete t.nestingRoot, e.edges().forEach((r) => {
|
|
1097
|
+
var n = e.edge(r);
|
|
1098
|
+
n.nestingEdge && e.removeEdge(r);
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
var Ge = v((Zi, De) => {
|
|
1103
|
+
var hn = _();
|
|
1104
|
+
De.exports = cn;
|
|
1105
|
+
function cn(e) {
|
|
1106
|
+
function t(r) {
|
|
1107
|
+
let n = e.children(r), i = e.node(r);
|
|
1108
|
+
if (n.length && n.forEach(t), Object.hasOwn(i, "minRank")) {
|
|
1109
|
+
i.borderLeft = [], i.borderRight = [];
|
|
1110
|
+
for (let o = i.minRank, s = i.maxRank + 1; o < s; ++o) Fe(e, "borderLeft", "_bl", r, i, o), Fe(e, "borderRight", "_br", r, i, o);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
e.children().forEach(t);
|
|
1114
|
+
}
|
|
1115
|
+
function Fe(e, t, r, n, i, o) {
|
|
1116
|
+
let s = { width: 0, height: 0, rank: o, borderType: t }, a = i[t][o - 1], l = hn.addDummyNode(e, "border", s, r);
|
|
1117
|
+
i[t][o] = l, e.setParent(l, n), a && e.setEdge(a, l, { weight: 1 });
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
var Be = v(($i, Ye) => {
|
|
1121
|
+
"use strict";
|
|
1122
|
+
Ye.exports = { adjust: fn, undo: pn };
|
|
1123
|
+
function fn(e) {
|
|
1124
|
+
let t = e.graph().rankdir.toLowerCase();
|
|
1125
|
+
(t === "lr" || t === "rl") && Ae(e);
|
|
1126
|
+
}
|
|
1127
|
+
function pn(e) {
|
|
1128
|
+
let t = e.graph().rankdir.toLowerCase();
|
|
1129
|
+
(t === "bt" || t === "rl") && mn(e), (t === "lr" || t === "rl") && (wn(e), Ae(e));
|
|
1130
|
+
}
|
|
1131
|
+
function Ae(e) {
|
|
1132
|
+
e.nodes().forEach((t) => Ve(e.node(t))), e.edges().forEach((t) => Ve(e.edge(t)));
|
|
1133
|
+
}
|
|
1134
|
+
function Ve(e) {
|
|
1135
|
+
let t = e.width;
|
|
1136
|
+
e.width = e.height, e.height = t;
|
|
1137
|
+
}
|
|
1138
|
+
function mn(e) {
|
|
1139
|
+
e.nodes().forEach((t) => Y(e.node(t))), e.edges().forEach((t) => {
|
|
1140
|
+
let r = e.edge(t);
|
|
1141
|
+
r.points.forEach(Y), Object.hasOwn(r, "y") && Y(r);
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
function Y(e) {
|
|
1145
|
+
e.y = -e.y;
|
|
1146
|
+
}
|
|
1147
|
+
function wn(e) {
|
|
1148
|
+
e.nodes().forEach((t) => B(e.node(t))), e.edges().forEach((t) => {
|
|
1149
|
+
let r = e.edge(t);
|
|
1150
|
+
r.points.forEach(B), Object.hasOwn(r, "x") && B(r);
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
function B(e) {
|
|
1154
|
+
let t = e.x;
|
|
1155
|
+
e.x = e.y, e.y = t;
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
var Xe = v((eo, ze) => {
|
|
1159
|
+
"use strict";
|
|
1160
|
+
var We = _();
|
|
1161
|
+
ze.exports = bn;
|
|
1162
|
+
function bn(e) {
|
|
1163
|
+
let t = {}, r = e.nodes().filter((l) => !e.children(l).length), n = r.map((l) => e.node(l).rank), i = We.applyWithChunking(Math.max, n), o = We.range(i + 1).map(() => []);
|
|
1164
|
+
function s(l) {
|
|
1165
|
+
if (t[l]) return;
|
|
1166
|
+
t[l] = true;
|
|
1167
|
+
let u = e.node(l);
|
|
1168
|
+
o[u.rank].push(l), e.successors(l).forEach(s);
|
|
1169
|
+
}
|
|
1170
|
+
return r.sort((l, u) => e.node(l).rank - e.node(u).rank).forEach(s), o;
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
var Ue = v((to, He) => {
|
|
1174
|
+
"use strict";
|
|
1175
|
+
var vn = _().zipObject;
|
|
1176
|
+
He.exports = gn;
|
|
1177
|
+
function gn(e, t) {
|
|
1178
|
+
let r = 0;
|
|
1179
|
+
for (let n = 1; n < t.length; ++n) r += En(e, t[n - 1], t[n]);
|
|
1180
|
+
return r;
|
|
1181
|
+
}
|
|
1182
|
+
function En(e, t, r) {
|
|
1183
|
+
let n = vn(r, r.map((u, c) => c)), i = t.flatMap((u) => e.outEdges(u).map((c) => ({ pos: n[c.w], weight: e.edge(c).weight })).sort((c, d) => c.pos - d.pos)), o = 1;
|
|
1184
|
+
for (; o < r.length; ) o <<= 1;
|
|
1185
|
+
let s = 2 * o - 1;
|
|
1186
|
+
o -= 1;
|
|
1187
|
+
let a = new Array(s).fill(0), l = 0;
|
|
1188
|
+
return i.forEach((u) => {
|
|
1189
|
+
let c = u.pos + o;
|
|
1190
|
+
a[c] += u.weight;
|
|
1191
|
+
let d = 0;
|
|
1192
|
+
for (; c > 0; ) c % 2 && (d += a[c + 1]), c = c - 1 >> 1, a[c] += u.weight;
|
|
1193
|
+
l += u.weight * d;
|
|
1194
|
+
}), l;
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
var Qe = v((ro, Ke) => {
|
|
1198
|
+
Ke.exports = _n;
|
|
1199
|
+
function _n(e, t = []) {
|
|
1200
|
+
return t.map((r) => {
|
|
1201
|
+
let n = e.inEdges(r);
|
|
1202
|
+
if (n.length) {
|
|
1203
|
+
let i = n.reduce((o, s) => {
|
|
1204
|
+
let a = e.edge(s), l = e.node(s.v);
|
|
1205
|
+
return { sum: o.sum + a.weight * l.order, weight: o.weight + a.weight };
|
|
1206
|
+
}, { sum: 0, weight: 0 });
|
|
1207
|
+
return { v: r, barycenter: i.sum / i.weight, weight: i.weight };
|
|
1208
|
+
} else return { v: r };
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
var Ze = v((no, Je) => {
|
|
1213
|
+
"use strict";
|
|
1214
|
+
var kn = _();
|
|
1215
|
+
Je.exports = yn;
|
|
1216
|
+
function yn(e, t) {
|
|
1217
|
+
let r = {};
|
|
1218
|
+
e.forEach((i, o) => {
|
|
1219
|
+
let s = r[i.v] = { indegree: 0, in: [], out: [], vs: [i.v], i: o };
|
|
1220
|
+
i.barycenter !== void 0 && (s.barycenter = i.barycenter, s.weight = i.weight);
|
|
1221
|
+
}), t.edges().forEach((i) => {
|
|
1222
|
+
let o = r[i.v], s = r[i.w];
|
|
1223
|
+
o !== void 0 && s !== void 0 && (s.indegree++, o.out.push(r[i.w]));
|
|
1224
|
+
});
|
|
1225
|
+
let n = Object.values(r).filter((i) => !i.indegree);
|
|
1226
|
+
return xn(n);
|
|
1227
|
+
}
|
|
1228
|
+
function xn(e) {
|
|
1229
|
+
let t = [];
|
|
1230
|
+
function r(i) {
|
|
1231
|
+
return (o) => {
|
|
1232
|
+
o.merged || (o.barycenter === void 0 || i.barycenter === void 0 || o.barycenter >= i.barycenter) && On(i, o);
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
function n(i) {
|
|
1236
|
+
return (o) => {
|
|
1237
|
+
o.in.push(i), --o.indegree === 0 && e.push(o);
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
for (; e.length; ) {
|
|
1241
|
+
let i = e.pop();
|
|
1242
|
+
t.push(i), i.in.reverse().forEach(r(i)), i.out.forEach(n(i));
|
|
1243
|
+
}
|
|
1244
|
+
return t.filter((i) => !i.merged).map((i) => kn.pick(i, ["vs", "i", "barycenter", "weight"]));
|
|
1245
|
+
}
|
|
1246
|
+
function On(e, t) {
|
|
1247
|
+
let r = 0, n = 0;
|
|
1248
|
+
e.weight && (r += e.barycenter * e.weight, n += e.weight), t.weight && (r += t.barycenter * t.weight, n += t.weight), e.vs = t.vs.concat(e.vs), e.barycenter = r / n, e.weight = n, e.i = Math.min(t.i, e.i), t.merged = true;
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
var tt = v((io, et) => {
|
|
1252
|
+
var Nn = _();
|
|
1253
|
+
et.exports = In;
|
|
1254
|
+
function In(e, t) {
|
|
1255
|
+
let r = Nn.partition(e, (c) => Object.hasOwn(c, "barycenter")), n = r.lhs, i = r.rhs.sort((c, d) => d.i - c.i), o = [], s = 0, a = 0, l = 0;
|
|
1256
|
+
n.sort(jn(!!t)), l = $e(o, i, l), n.forEach((c) => {
|
|
1257
|
+
l += c.vs.length, o.push(c.vs), s += c.barycenter * c.weight, a += c.weight, l = $e(o, i, l);
|
|
1258
|
+
});
|
|
1259
|
+
let u = { vs: o.flat(true) };
|
|
1260
|
+
return a && (u.barycenter = s / a, u.weight = a), u;
|
|
1261
|
+
}
|
|
1262
|
+
function $e(e, t, r) {
|
|
1263
|
+
let n;
|
|
1264
|
+
for (; t.length && (n = t[t.length - 1]).i <= r; ) t.pop(), e.push(n.vs), r++;
|
|
1265
|
+
return r;
|
|
1266
|
+
}
|
|
1267
|
+
function jn(e) {
|
|
1268
|
+
return (t, r) => t.barycenter < r.barycenter ? -1 : t.barycenter > r.barycenter ? 1 : e ? r.i - t.i : t.i - r.i;
|
|
1269
|
+
}
|
|
1270
|
+
});
|
|
1271
|
+
var it = v((oo, nt) => {
|
|
1272
|
+
var Cn = Qe(), Ln = Ze(), qn = tt();
|
|
1273
|
+
nt.exports = rt;
|
|
1274
|
+
function rt(e, t, r, n) {
|
|
1275
|
+
let i = e.children(t), o = e.node(t), s = o ? o.borderLeft : void 0, a = o ? o.borderRight : void 0, l = {};
|
|
1276
|
+
s && (i = i.filter((h) => h !== s && h !== a));
|
|
1277
|
+
let u = Cn(e, i);
|
|
1278
|
+
u.forEach((h) => {
|
|
1279
|
+
if (e.children(h.v).length) {
|
|
1280
|
+
let f = rt(e, h.v, r, n);
|
|
1281
|
+
l[h.v] = f, Object.hasOwn(f, "barycenter") && Rn(h, f);
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
let c = Ln(u, r);
|
|
1285
|
+
Mn(c, l);
|
|
1286
|
+
let d = qn(c, n);
|
|
1287
|
+
if (s && (d.vs = [s, d.vs, a].flat(true), e.predecessors(s).length)) {
|
|
1288
|
+
let h = e.node(e.predecessors(s)[0]), f = e.node(e.predecessors(a)[0]);
|
|
1289
|
+
Object.hasOwn(d, "barycenter") || (d.barycenter = 0, d.weight = 0), d.barycenter = (d.barycenter * d.weight + h.order + f.order) / (d.weight + 2), d.weight += 2;
|
|
1290
|
+
}
|
|
1291
|
+
return d;
|
|
1292
|
+
}
|
|
1293
|
+
function Mn(e, t) {
|
|
1294
|
+
e.forEach((r) => {
|
|
1295
|
+
r.vs = r.vs.flatMap((n) => t[n] ? t[n].vs : n);
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
function Rn(e, t) {
|
|
1299
|
+
e.barycenter !== void 0 ? (e.barycenter = (e.barycenter * e.weight + t.barycenter * t.weight) / (e.weight + t.weight), e.weight += t.weight) : (e.barycenter = t.barycenter, e.weight = t.weight);
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1302
|
+
var st = v((so, ot) => {
|
|
1303
|
+
var Tn = y().Graph, Sn = _();
|
|
1304
|
+
ot.exports = Pn;
|
|
1305
|
+
function Pn(e, t, r, n) {
|
|
1306
|
+
n || (n = e.nodes());
|
|
1307
|
+
let i = Fn(e), o = new Tn({ compound: true }).setGraph({ root: i }).setDefaultNodeLabel((s) => e.node(s));
|
|
1308
|
+
return n.forEach((s) => {
|
|
1309
|
+
let a = e.node(s), l = e.parent(s);
|
|
1310
|
+
(a.rank === t || a.minRank <= t && t <= a.maxRank) && (o.setNode(s), o.setParent(s, l || i), e[r](s).forEach((u) => {
|
|
1311
|
+
let c = u.v === s ? u.w : u.v, d = o.edge(c, s), h = d !== void 0 ? d.weight : 0;
|
|
1312
|
+
o.setEdge(c, s, { weight: e.edge(u).weight + h });
|
|
1313
|
+
}), Object.hasOwn(a, "minRank") && o.setNode(s, { borderLeft: a.borderLeft[t], borderRight: a.borderRight[t] }));
|
|
1314
|
+
}), o;
|
|
1315
|
+
}
|
|
1316
|
+
function Fn(e) {
|
|
1317
|
+
for (var t; e.hasNode(t = Sn.uniqueId("_root")); ) ;
|
|
1318
|
+
return t;
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
var dt = v((ao, at) => {
|
|
1322
|
+
at.exports = Dn;
|
|
1323
|
+
function Dn(e, t, r) {
|
|
1324
|
+
let n = {}, i;
|
|
1325
|
+
r.forEach((o) => {
|
|
1326
|
+
let s = e.parent(o), a, l;
|
|
1327
|
+
for (; s; ) {
|
|
1328
|
+
if (a = e.parent(s), a ? (l = n[a], n[a] = s) : (l = i, i = s), l && l !== s) {
|
|
1329
|
+
t.setEdge(l, s);
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
s = a;
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
var ft = v((lo, ct) => {
|
|
1338
|
+
"use strict";
|
|
1339
|
+
var Gn = Xe(), Vn = Ue(), An = it(), Yn = st(), Bn = dt(), Wn = y().Graph, M = _();
|
|
1340
|
+
ct.exports = ht;
|
|
1341
|
+
function ht(e, t = {}) {
|
|
1342
|
+
if (typeof t.customOrder == "function") {
|
|
1343
|
+
t.customOrder(e, ht);
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
let r = M.maxRank(e), n = lt(e, M.range(1, r + 1), "inEdges"), i = lt(e, M.range(r - 1, -1, -1), "outEdges"), o = Gn(e);
|
|
1347
|
+
if (ut(e, o), t.disableOptimalOrderHeuristic) return;
|
|
1348
|
+
let s = Number.POSITIVE_INFINITY, a, l = t.constraints || [];
|
|
1349
|
+
for (let u = 0, c = 0; c < 4; ++u, ++c) {
|
|
1350
|
+
zn(u % 2 ? n : i, u % 4 >= 2, l), o = M.buildLayerMatrix(e);
|
|
1351
|
+
let d = Vn(e, o);
|
|
1352
|
+
d < s ? (c = 0, a = Object.assign({}, o), s = d) : d === s && (a = structuredClone(o));
|
|
1353
|
+
}
|
|
1354
|
+
ut(e, a);
|
|
1355
|
+
}
|
|
1356
|
+
function lt(e, t, r) {
|
|
1357
|
+
let n = /* @__PURE__ */ new Map(), i = (o, s) => {
|
|
1358
|
+
n.has(o) || n.set(o, []), n.get(o).push(s);
|
|
1359
|
+
};
|
|
1360
|
+
for (let o of e.nodes()) {
|
|
1361
|
+
let s = e.node(o);
|
|
1362
|
+
if (typeof s.rank == "number" && i(s.rank, o), typeof s.minRank == "number" && typeof s.maxRank == "number") for (let a = s.minRank; a <= s.maxRank; a++) a !== s.rank && i(a, o);
|
|
1363
|
+
}
|
|
1364
|
+
return t.map(function(o) {
|
|
1365
|
+
return Yn(e, o, r, n.get(o) || []);
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
function zn(e, t, r) {
|
|
1369
|
+
let n = new Wn();
|
|
1370
|
+
e.forEach(function(i) {
|
|
1371
|
+
r.forEach((a) => n.setEdge(a.left, a.right));
|
|
1372
|
+
let o = i.graph().root, s = An(i, o, n, t);
|
|
1373
|
+
s.vs.forEach((a, l) => i.node(a).order = l), Bn(i, n, s.vs);
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
function ut(e, t) {
|
|
1377
|
+
Object.values(t).forEach((r) => r.forEach((n, i) => e.node(n).order = i));
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
var yt = v((uo, kt) => {
|
|
1381
|
+
"use strict";
|
|
1382
|
+
var Xn = y().Graph, O = _();
|
|
1383
|
+
kt.exports = { positionX: Kn, findType1Conflicts: pt, findType2Conflicts: mt, addConflict: W, hasConflict: wt, verticalAlignment: bt, horizontalCompaction: vt, alignCoordinates: Et, findSmallestWidthAlignment: gt, balance: _t };
|
|
1384
|
+
function pt(e, t) {
|
|
1385
|
+
let r = {};
|
|
1386
|
+
function n(i, o) {
|
|
1387
|
+
let s = 0, a = 0, l = i.length, u = o[o.length - 1];
|
|
1388
|
+
return o.forEach((c, d) => {
|
|
1389
|
+
let h = Hn(e, c), f = h ? e.node(h).order : l;
|
|
1390
|
+
(h || c === u) && (o.slice(a, d + 1).forEach((m) => {
|
|
1391
|
+
e.predecessors(m).forEach((p) => {
|
|
1392
|
+
let w = e.node(p), b = w.order;
|
|
1393
|
+
(b < s || f < b) && !(w.dummy && e.node(m).dummy) && W(r, p, m);
|
|
1394
|
+
});
|
|
1395
|
+
}), a = d + 1, s = f);
|
|
1396
|
+
}), o;
|
|
1397
|
+
}
|
|
1398
|
+
return t.length && t.reduce(n), r;
|
|
1399
|
+
}
|
|
1400
|
+
function mt(e, t) {
|
|
1401
|
+
let r = {};
|
|
1402
|
+
function n(o, s, a, l, u) {
|
|
1403
|
+
let c;
|
|
1404
|
+
O.range(s, a).forEach((d) => {
|
|
1405
|
+
c = o[d], e.node(c).dummy && e.predecessors(c).forEach((h) => {
|
|
1406
|
+
let f = e.node(h);
|
|
1407
|
+
f.dummy && (f.order < l || f.order > u) && W(r, h, c);
|
|
1408
|
+
});
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
function i(o, s) {
|
|
1412
|
+
let a = -1, l, u = 0;
|
|
1413
|
+
return s.forEach((c, d) => {
|
|
1414
|
+
if (e.node(c).dummy === "border") {
|
|
1415
|
+
let h = e.predecessors(c);
|
|
1416
|
+
h.length && (l = e.node(h[0]).order, n(s, u, d, a, l), u = d, a = l);
|
|
1417
|
+
}
|
|
1418
|
+
n(s, u, s.length, l, o.length);
|
|
1419
|
+
}), s;
|
|
1420
|
+
}
|
|
1421
|
+
return t.length && t.reduce(i), r;
|
|
1422
|
+
}
|
|
1423
|
+
function Hn(e, t) {
|
|
1424
|
+
if (e.node(t).dummy) return e.predecessors(t).find((r) => e.node(r).dummy);
|
|
1425
|
+
}
|
|
1426
|
+
function W(e, t, r) {
|
|
1427
|
+
if (t > r) {
|
|
1428
|
+
let i = t;
|
|
1429
|
+
t = r, r = i;
|
|
1430
|
+
}
|
|
1431
|
+
let n = e[t];
|
|
1432
|
+
n || (e[t] = n = {}), n[r] = true;
|
|
1433
|
+
}
|
|
1434
|
+
function wt(e, t, r) {
|
|
1435
|
+
if (t > r) {
|
|
1436
|
+
let n = t;
|
|
1437
|
+
t = r, r = n;
|
|
1438
|
+
}
|
|
1439
|
+
return !!e[t] && Object.hasOwn(e[t], r);
|
|
1440
|
+
}
|
|
1441
|
+
function bt(e, t, r, n) {
|
|
1442
|
+
let i = {}, o = {}, s = {};
|
|
1443
|
+
return t.forEach((a) => {
|
|
1444
|
+
a.forEach((l, u) => {
|
|
1445
|
+
i[l] = l, o[l] = l, s[l] = u;
|
|
1446
|
+
});
|
|
1447
|
+
}), t.forEach((a) => {
|
|
1448
|
+
let l = -1;
|
|
1449
|
+
a.forEach((u) => {
|
|
1450
|
+
let c = n(u);
|
|
1451
|
+
if (c.length) {
|
|
1452
|
+
c = c.sort((h, f) => s[h] - s[f]);
|
|
1453
|
+
let d = (c.length - 1) / 2;
|
|
1454
|
+
for (let h = Math.floor(d), f = Math.ceil(d); h <= f; ++h) {
|
|
1455
|
+
let m = c[h];
|
|
1456
|
+
o[u] === u && l < s[m] && !wt(r, u, m) && (o[m] = u, o[u] = i[u] = i[m], l = s[m]);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
}), { root: i, align: o };
|
|
1461
|
+
}
|
|
1462
|
+
function vt(e, t, r, n, i) {
|
|
1463
|
+
let o = {}, s = Un(e, t, r, i), a = i ? "borderLeft" : "borderRight";
|
|
1464
|
+
function l(d, h) {
|
|
1465
|
+
let f = s.nodes().slice(), m = {}, p = f.pop();
|
|
1466
|
+
for (; p; ) {
|
|
1467
|
+
if (m[p]) d(p);
|
|
1468
|
+
else {
|
|
1469
|
+
m[p] = true, f.push(p);
|
|
1470
|
+
for (let w of h(p)) f.push(w);
|
|
1471
|
+
}
|
|
1472
|
+
p = f.pop();
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function u(d) {
|
|
1476
|
+
o[d] = s.inEdges(d).reduce((h, f) => Math.max(h, o[f.v] + s.edge(f)), 0);
|
|
1477
|
+
}
|
|
1478
|
+
function c(d) {
|
|
1479
|
+
let h = s.outEdges(d).reduce((m, p) => Math.min(m, o[p.w] - s.edge(p)), Number.POSITIVE_INFINITY), f = e.node(d);
|
|
1480
|
+
h !== Number.POSITIVE_INFINITY && f.borderType !== a && (o[d] = Math.max(o[d], h));
|
|
1481
|
+
}
|
|
1482
|
+
return l(u, s.predecessors.bind(s)), l(c, s.successors.bind(s)), Object.keys(n).forEach((d) => o[d] = o[r[d]]), o;
|
|
1483
|
+
}
|
|
1484
|
+
function Un(e, t, r, n) {
|
|
1485
|
+
let i = new Xn(), o = e.graph(), s = Qn(o.nodesep, o.edgesep, n);
|
|
1486
|
+
return t.forEach((a) => {
|
|
1487
|
+
let l;
|
|
1488
|
+
a.forEach((u) => {
|
|
1489
|
+
let c = r[u];
|
|
1490
|
+
if (i.setNode(c), l) {
|
|
1491
|
+
var d = r[l], h = i.edge(d, c);
|
|
1492
|
+
i.setEdge(d, c, Math.max(s(e, u, l), h || 0));
|
|
1493
|
+
}
|
|
1494
|
+
l = u;
|
|
1495
|
+
});
|
|
1496
|
+
}), i;
|
|
1497
|
+
}
|
|
1498
|
+
function gt(e, t) {
|
|
1499
|
+
return Object.values(t).reduce((r, n) => {
|
|
1500
|
+
let i = Number.NEGATIVE_INFINITY, o = Number.POSITIVE_INFINITY;
|
|
1501
|
+
Object.entries(n).forEach(([a, l]) => {
|
|
1502
|
+
let u = Jn(e, a) / 2;
|
|
1503
|
+
i = Math.max(l + u, i), o = Math.min(l - u, o);
|
|
1504
|
+
});
|
|
1505
|
+
let s = i - o;
|
|
1506
|
+
return s < r[0] && (r = [s, n]), r;
|
|
1507
|
+
}, [Number.POSITIVE_INFINITY, null])[1];
|
|
1508
|
+
}
|
|
1509
|
+
function Et(e, t) {
|
|
1510
|
+
let r = Object.values(t), n = O.applyWithChunking(Math.min, r), i = O.applyWithChunking(Math.max, r);
|
|
1511
|
+
["u", "d"].forEach((o) => {
|
|
1512
|
+
["l", "r"].forEach((s) => {
|
|
1513
|
+
let a = o + s, l = e[a];
|
|
1514
|
+
if (l === t) return;
|
|
1515
|
+
let u = Object.values(l), c = n - O.applyWithChunking(Math.min, u);
|
|
1516
|
+
s !== "l" && (c = i - O.applyWithChunking(Math.max, u)), c && (e[a] = O.mapValues(l, (d) => d + c));
|
|
1517
|
+
});
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
function _t(e, t) {
|
|
1521
|
+
return O.mapValues(e.ul, (r, n) => {
|
|
1522
|
+
if (t) return e[t.toLowerCase()][n];
|
|
1523
|
+
{
|
|
1524
|
+
let i = Object.values(e).map((o) => o[n]).sort((o, s) => o - s);
|
|
1525
|
+
return (i[1] + i[2]) / 2;
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
function Kn(e) {
|
|
1530
|
+
let t = O.buildLayerMatrix(e), r = Object.assign(pt(e, t), mt(e, t)), n = {}, i;
|
|
1531
|
+
["u", "d"].forEach((s) => {
|
|
1532
|
+
i = s === "u" ? t : Object.values(t).reverse(), ["l", "r"].forEach((a) => {
|
|
1533
|
+
a === "r" && (i = i.map((d) => Object.values(d).reverse()));
|
|
1534
|
+
let l = (s === "u" ? e.predecessors : e.successors).bind(e), u = bt(e, i, r, l), c = vt(e, i, u.root, u.align, a === "r");
|
|
1535
|
+
a === "r" && (c = O.mapValues(c, (d) => -d)), n[s + a] = c;
|
|
1536
|
+
});
|
|
1537
|
+
});
|
|
1538
|
+
let o = gt(e, n);
|
|
1539
|
+
return Et(n, o), _t(n, e.graph().align);
|
|
1540
|
+
}
|
|
1541
|
+
function Qn(e, t, r) {
|
|
1542
|
+
return (n, i, o) => {
|
|
1543
|
+
let s = n.node(i), a = n.node(o), l = 0, u;
|
|
1544
|
+
if (l += s.width / 2, Object.hasOwn(s, "labelpos")) switch (s.labelpos.toLowerCase()) {
|
|
1545
|
+
case "l":
|
|
1546
|
+
u = -s.width / 2;
|
|
1547
|
+
break;
|
|
1548
|
+
case "r":
|
|
1549
|
+
u = s.width / 2;
|
|
1550
|
+
break;
|
|
1551
|
+
}
|
|
1552
|
+
if (u && (l += r ? u : -u), u = 0, l += (s.dummy ? t : e) / 2, l += (a.dummy ? t : e) / 2, l += a.width / 2, Object.hasOwn(a, "labelpos")) switch (a.labelpos.toLowerCase()) {
|
|
1553
|
+
case "l":
|
|
1554
|
+
u = a.width / 2;
|
|
1555
|
+
break;
|
|
1556
|
+
case "r":
|
|
1557
|
+
u = -a.width / 2;
|
|
1558
|
+
break;
|
|
1559
|
+
}
|
|
1560
|
+
return u && (l += r ? u : -u), u = 0, l;
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
function Jn(e, t) {
|
|
1564
|
+
return e.node(t).width;
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
var Nt = v((ho, Ot) => {
|
|
1568
|
+
"use strict";
|
|
1569
|
+
var xt = _(), Zn = yt().positionX;
|
|
1570
|
+
Ot.exports = $n;
|
|
1571
|
+
function $n(e) {
|
|
1572
|
+
e = xt.asNonCompoundGraph(e), ei(e), Object.entries(Zn(e)).forEach(([t, r]) => e.node(t).x = r);
|
|
1573
|
+
}
|
|
1574
|
+
function ei(e) {
|
|
1575
|
+
let t = xt.buildLayerMatrix(e), r = e.graph().ranksep, n = e.graph().rankalign, i = 0;
|
|
1576
|
+
t.forEach((o) => {
|
|
1577
|
+
let s = o.reduce((a, l) => {
|
|
1578
|
+
let u = e.node(l).height;
|
|
1579
|
+
return a > u ? a : u;
|
|
1580
|
+
}, 0);
|
|
1581
|
+
o.forEach((a) => {
|
|
1582
|
+
let l = e.node(a);
|
|
1583
|
+
n === "top" ? l.y = i + l.height / 2 : n === "bottom" ? l.y = i + s - l.height / 2 : l.y = i + s / 2;
|
|
1584
|
+
}), i += s + r;
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
var Rt = v((co, Mt) => {
|
|
1589
|
+
"use strict";
|
|
1590
|
+
var It = pe(), jt = we(), ti = qe(), ri = _().normalizeRanks, ni = Re(), ii = _().removeEmptyRanks, Ct = Pe(), oi = Ge(), Lt = Be(), si = ft(), ai = Nt(), x = _(), di = y().Graph;
|
|
1591
|
+
Mt.exports = li;
|
|
1592
|
+
function li(e, t = {}) {
|
|
1593
|
+
let r = t.debugTiming ? x.time : x.notime;
|
|
1594
|
+
return r("layout", () => {
|
|
1595
|
+
let n = r(" buildLayoutGraph", () => gi(e));
|
|
1596
|
+
return r(" runLayout", () => ui(n, r, t)), r(" updateInputGraph", () => hi(e, n)), n;
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function ui(e, t, r) {
|
|
1600
|
+
t(" makeSpaceForEdgeLabels", () => Ei(e)), t(" removeSelfEdges", () => Ci(e)), t(" acyclic", () => It.run(e)), t(" nestingGraph.run", () => Ct.run(e)), t(" rank", () => ti(x.asNonCompoundGraph(e))), t(" injectEdgeLabelProxies", () => _i(e)), t(" removeEmptyRanks", () => ii(e)), t(" nestingGraph.cleanup", () => Ct.cleanup(e)), t(" normalizeRanks", () => ri(e)), t(" assignRankMinMax", () => ki(e)), t(" removeEdgeLabelProxies", () => yi(e)), t(" normalize.run", () => jt.run(e)), t(" parentDummyChains", () => ni(e)), t(" addBorderSegments", () => oi(e)), t(" order", () => si(e, r)), t(" insertSelfEdges", () => Li(e)), t(" adjustCoordinateSystem", () => Lt.adjust(e)), t(" position", () => ai(e)), t(" positionSelfEdges", () => qi(e)), t(" removeBorderNodes", () => ji(e)), t(" normalize.undo", () => jt.undo(e)), t(" fixupEdgeLabelCoords", () => Ni(e)), t(" undoCoordinateSystem", () => Lt.undo(e)), t(" translateGraph", () => xi(e)), t(" assignNodeIntersects", () => Oi(e)), t(" reversePoints", () => Ii(e)), t(" acyclic.undo", () => It.undo(e));
|
|
1601
|
+
}
|
|
1602
|
+
function hi(e, t) {
|
|
1603
|
+
e.nodes().forEach((r) => {
|
|
1604
|
+
let n = e.node(r), i = t.node(r);
|
|
1605
|
+
n && (n.x = i.x, n.y = i.y, n.order = i.order, n.rank = i.rank, t.children(r).length && (n.width = i.width, n.height = i.height));
|
|
1606
|
+
}), e.edges().forEach((r) => {
|
|
1607
|
+
let n = e.edge(r), i = t.edge(r);
|
|
1608
|
+
n.points = i.points, Object.hasOwn(i, "x") && (n.x = i.x, n.y = i.y);
|
|
1609
|
+
}), e.graph().width = t.graph().width, e.graph().height = t.graph().height;
|
|
1610
|
+
}
|
|
1611
|
+
var ci = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], fi = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb", rankalign: "center" }, pi = ["acyclicer", "ranker", "rankdir", "align", "rankalign"], mi = ["width", "height", "rank"], qt = { width: 0, height: 0 }, wi = ["minlen", "weight", "width", "height", "labeloffset"], bi = { minlen: 1, weight: 1, width: 0, height: 0, labeloffset: 10, labelpos: "r" }, vi = ["labelpos"];
|
|
1612
|
+
function gi(e) {
|
|
1613
|
+
let t = new di({ multigraph: true, compound: true }), r = X4(e.graph());
|
|
1614
|
+
return t.setGraph(Object.assign({}, fi, z(r, ci), x.pick(r, pi))), e.nodes().forEach((n) => {
|
|
1615
|
+
let i = X4(e.node(n)), o = z(i, mi);
|
|
1616
|
+
Object.keys(qt).forEach((s) => {
|
|
1617
|
+
o[s] === void 0 && (o[s] = qt[s]);
|
|
1618
|
+
}), t.setNode(n, o), t.setParent(n, e.parent(n));
|
|
1619
|
+
}), e.edges().forEach((n) => {
|
|
1620
|
+
let i = X4(e.edge(n));
|
|
1621
|
+
t.setEdge(n, Object.assign({}, bi, z(i, wi), x.pick(i, vi)));
|
|
1622
|
+
}), t;
|
|
1623
|
+
}
|
|
1624
|
+
function Ei(e) {
|
|
1625
|
+
let t = e.graph();
|
|
1626
|
+
t.ranksep /= 2, e.edges().forEach((r) => {
|
|
1627
|
+
let n = e.edge(r);
|
|
1628
|
+
n.minlen *= 2, n.labelpos.toLowerCase() !== "c" && (t.rankdir === "TB" || t.rankdir === "BT" ? n.width += n.labeloffset : n.height += n.labeloffset);
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
function _i(e) {
|
|
1632
|
+
e.edges().forEach((t) => {
|
|
1633
|
+
let r = e.edge(t);
|
|
1634
|
+
if (r.width && r.height) {
|
|
1635
|
+
let n = e.node(t.v), o = { rank: (e.node(t.w).rank - n.rank) / 2 + n.rank, e: t };
|
|
1636
|
+
x.addDummyNode(e, "edge-proxy", o, "_ep");
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
function ki(e) {
|
|
1641
|
+
let t = 0;
|
|
1642
|
+
e.nodes().forEach((r) => {
|
|
1643
|
+
let n = e.node(r);
|
|
1644
|
+
n.borderTop && (n.minRank = e.node(n.borderTop).rank, n.maxRank = e.node(n.borderBottom).rank, t = Math.max(t, n.maxRank));
|
|
1645
|
+
}), e.graph().maxRank = t;
|
|
1646
|
+
}
|
|
1647
|
+
function yi(e) {
|
|
1648
|
+
e.nodes().forEach((t) => {
|
|
1649
|
+
let r = e.node(t);
|
|
1650
|
+
r.dummy === "edge-proxy" && (e.edge(r.e).labelRank = r.rank, e.removeNode(t));
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
function xi(e) {
|
|
1654
|
+
let t = Number.POSITIVE_INFINITY, r = 0, n = Number.POSITIVE_INFINITY, i = 0, o = e.graph(), s = o.marginx || 0, a = o.marginy || 0;
|
|
1655
|
+
function l(u) {
|
|
1656
|
+
let c = u.x, d = u.y, h = u.width, f = u.height;
|
|
1657
|
+
t = Math.min(t, c - h / 2), r = Math.max(r, c + h / 2), n = Math.min(n, d - f / 2), i = Math.max(i, d + f / 2);
|
|
1658
|
+
}
|
|
1659
|
+
e.nodes().forEach((u) => l(e.node(u))), e.edges().forEach((u) => {
|
|
1660
|
+
let c = e.edge(u);
|
|
1661
|
+
Object.hasOwn(c, "x") && l(c);
|
|
1662
|
+
}), t -= s, n -= a, e.nodes().forEach((u) => {
|
|
1663
|
+
let c = e.node(u);
|
|
1664
|
+
c.x -= t, c.y -= n;
|
|
1665
|
+
}), e.edges().forEach((u) => {
|
|
1666
|
+
let c = e.edge(u);
|
|
1667
|
+
c.points.forEach((d) => {
|
|
1668
|
+
d.x -= t, d.y -= n;
|
|
1669
|
+
}), Object.hasOwn(c, "x") && (c.x -= t), Object.hasOwn(c, "y") && (c.y -= n);
|
|
1670
|
+
}), o.width = r - t + s, o.height = i - n + a;
|
|
1671
|
+
}
|
|
1672
|
+
function Oi(e) {
|
|
1673
|
+
e.edges().forEach((t) => {
|
|
1674
|
+
let r = e.edge(t), n = e.node(t.v), i = e.node(t.w), o, s;
|
|
1675
|
+
r.points ? (o = r.points[0], s = r.points[r.points.length - 1]) : (r.points = [], o = i, s = n), r.points.unshift(x.intersectRect(n, o)), r.points.push(x.intersectRect(i, s));
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
function Ni(e) {
|
|
1679
|
+
e.edges().forEach((t) => {
|
|
1680
|
+
let r = e.edge(t);
|
|
1681
|
+
if (Object.hasOwn(r, "x")) switch ((r.labelpos === "l" || r.labelpos === "r") && (r.width -= r.labeloffset), r.labelpos) {
|
|
1682
|
+
case "l":
|
|
1683
|
+
r.x -= r.width / 2 + r.labeloffset;
|
|
1684
|
+
break;
|
|
1685
|
+
case "r":
|
|
1686
|
+
r.x += r.width / 2 + r.labeloffset;
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
function Ii(e) {
|
|
1692
|
+
e.edges().forEach((t) => {
|
|
1693
|
+
let r = e.edge(t);
|
|
1694
|
+
r.reversed && r.points.reverse();
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
function ji(e) {
|
|
1698
|
+
e.nodes().forEach((t) => {
|
|
1699
|
+
if (e.children(t).length) {
|
|
1700
|
+
let r = e.node(t), n = e.node(r.borderTop), i = e.node(r.borderBottom), o = e.node(r.borderLeft[r.borderLeft.length - 1]), s = e.node(r.borderRight[r.borderRight.length - 1]);
|
|
1701
|
+
r.width = Math.abs(s.x - o.x), r.height = Math.abs(i.y - n.y), r.x = o.x + r.width / 2, r.y = n.y + r.height / 2;
|
|
1702
|
+
}
|
|
1703
|
+
}), e.nodes().forEach((t) => {
|
|
1704
|
+
e.node(t).dummy === "border" && e.removeNode(t);
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
function Ci(e) {
|
|
1708
|
+
e.edges().forEach((t) => {
|
|
1709
|
+
if (t.v === t.w) {
|
|
1710
|
+
var r = e.node(t.v);
|
|
1711
|
+
r.selfEdges || (r.selfEdges = []), r.selfEdges.push({ e: t, label: e.edge(t) }), e.removeEdge(t);
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
function Li(e) {
|
|
1716
|
+
var t = x.buildLayerMatrix(e);
|
|
1717
|
+
t.forEach((r) => {
|
|
1718
|
+
var n = 0;
|
|
1719
|
+
r.forEach((i, o) => {
|
|
1720
|
+
var s = e.node(i);
|
|
1721
|
+
s.order = o + n, (s.selfEdges || []).forEach((a) => {
|
|
1722
|
+
x.addDummyNode(e, "selfedge", { width: a.label.width, height: a.label.height, rank: s.rank, order: o + ++n, e: a.e, label: a.label }, "_se");
|
|
1723
|
+
}), delete s.selfEdges;
|
|
1724
|
+
});
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
function qi(e) {
|
|
1728
|
+
e.nodes().forEach((t) => {
|
|
1729
|
+
var r = e.node(t);
|
|
1730
|
+
if (r.dummy === "selfedge") {
|
|
1731
|
+
var n = e.node(r.e.v), i = n.x + n.width / 2, o = n.y, s = r.x - i, a = n.height / 2;
|
|
1732
|
+
e.setEdge(r.e, r.label), e.removeNode(t), r.label.points = [{ x: i + 2 * s / 3, y: o - a }, { x: i + 5 * s / 6, y: o - a }, { x: i + s, y: o }, { x: i + 5 * s / 6, y: o + a }, { x: i + 2 * s / 3, y: o + a }], r.label.x = r.x, r.label.y = r.y;
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
function z(e, t) {
|
|
1737
|
+
return x.mapValues(x.pick(e, t), Number);
|
|
1738
|
+
}
|
|
1739
|
+
function X4(e) {
|
|
1740
|
+
var t = {};
|
|
1741
|
+
return e && Object.entries(e).forEach(([r, n]) => {
|
|
1742
|
+
typeof r == "string" && (r = r.toLowerCase()), t[r] = n;
|
|
1743
|
+
}), t;
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
var St = v((fo, Tt) => {
|
|
1747
|
+
var Mi = _(), Ri = y().Graph;
|
|
1748
|
+
Tt.exports = { debugOrdering: Ti };
|
|
1749
|
+
function Ti(e) {
|
|
1750
|
+
let t = Mi.buildLayerMatrix(e), r = new Ri({ compound: true, multigraph: true }).setGraph({});
|
|
1751
|
+
return e.nodes().forEach((n) => {
|
|
1752
|
+
r.setNode(n, { label: n }), r.setParent(n, "layer" + e.node(n).rank);
|
|
1753
|
+
}), e.edges().forEach((n) => r.setEdge(n.v, n.w, {}, n.name)), t.forEach((n, i) => {
|
|
1754
|
+
let o = "layer" + i;
|
|
1755
|
+
r.setNode(o, { rank: "same" }), n.reduce((s, a) => (r.setEdge(s, a, { style: "invis" }), a));
|
|
1756
|
+
}), r;
|
|
1757
|
+
}
|
|
1758
|
+
});
|
|
1759
|
+
var Ft = v((po, Pt) => {
|
|
1760
|
+
Pt.exports = "2.0.4";
|
|
1761
|
+
});
|
|
1762
|
+
var Si = v((mo, Dt) => {
|
|
1763
|
+
Dt.exports = { graphlib: y(), layout: Rt(), debug: St(), util: { time: _().time, notime: _().notime }, version: Ft() };
|
|
1764
|
+
});
|
|
1765
|
+
var dagre_esm_default = Si();
|
|
1766
|
+
|
|
1767
|
+
// src/utils/layoutGraph.ts
|
|
1768
|
+
function getLayoutedElements(nodes, edges, options = {}) {
|
|
1769
|
+
const {
|
|
1770
|
+
direction = "TB",
|
|
1771
|
+
nodeWidth = 260,
|
|
1772
|
+
nodeHeight = 180,
|
|
1773
|
+
rankSep = 100,
|
|
1774
|
+
nodeSep = 80
|
|
1775
|
+
} = options;
|
|
1776
|
+
const g = new dagre_esm_default.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
|
|
1777
|
+
g.setGraph({
|
|
1778
|
+
rankdir: direction,
|
|
1779
|
+
ranksep: rankSep,
|
|
1780
|
+
nodesep: nodeSep,
|
|
1781
|
+
marginx: 50,
|
|
1782
|
+
marginy: 50
|
|
1783
|
+
});
|
|
1784
|
+
nodes.forEach((node) => {
|
|
1785
|
+
const w = node.measured?.width || nodeWidth;
|
|
1786
|
+
const h = node.measured?.height || nodeHeight;
|
|
1787
|
+
g.setNode(node.id, { width: w, height: h });
|
|
1788
|
+
});
|
|
1789
|
+
edges.forEach((edge) => {
|
|
1790
|
+
g.setEdge(edge.source, edge.target);
|
|
1791
|
+
});
|
|
1792
|
+
dagre_esm_default.layout(g);
|
|
1793
|
+
const layoutedNodes = nodes.map((node) => {
|
|
1794
|
+
const dagNode = g.node(node.id);
|
|
1795
|
+
const w = node.measured?.width || nodeWidth;
|
|
1796
|
+
const h = node.measured?.height || nodeHeight;
|
|
1797
|
+
return {
|
|
1798
|
+
...node,
|
|
1799
|
+
position: {
|
|
1800
|
+
x: dagNode.x - w / 2,
|
|
1801
|
+
y: dagNode.y - h / 2
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
});
|
|
1805
|
+
return { nodes: layoutedNodes, edges };
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
// src/components/studio/ReactFlowEditor.tsx
|
|
1809
|
+
import { Home, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
1810
|
+
|
|
1811
|
+
// src/components/studio/editor/nodeTypeRegistry.ts
|
|
1812
|
+
import {
|
|
1813
|
+
DialogueNode,
|
|
1814
|
+
LogicNode,
|
|
1815
|
+
StateNode,
|
|
1816
|
+
SubflowNode,
|
|
1817
|
+
EntryNode,
|
|
1818
|
+
ReturnNode,
|
|
1819
|
+
RenderNode,
|
|
1820
|
+
TriggerNode,
|
|
1821
|
+
ConditionalNode,
|
|
1822
|
+
SetVariableNode,
|
|
1823
|
+
MorphNode
|
|
1824
|
+
} from "@decido/canvas-core";
|
|
1825
|
+
|
|
1826
|
+
// src/components/studio/nodes/shell/RegisterButtonNode.tsx
|
|
1827
|
+
import { PanelLeft } from "lucide-react";
|
|
1828
|
+
|
|
1829
|
+
// src/components/studio/nodes/shell/ShellNodeBase.tsx
|
|
1830
|
+
import { GripVertical } from "lucide-react";
|
|
1831
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1832
|
+
var COLOR_MAP = {
|
|
1833
|
+
teal: { border: "border-teal-500/30", bg: "from-teal-500/15 to-cyan-500/10", text: "text-teal-400", ring: "ring-teal-400", glow: "rgba(20,184,166,0.6)" },
|
|
1834
|
+
cyan: { border: "border-cyan-500/30", bg: "from-cyan-500/15 to-sky-500/10", text: "text-cyan-400", ring: "ring-cyan-400", glow: "rgba(6,182,212,0.6)" },
|
|
1835
|
+
sky: { border: "border-sky-500/30", bg: "from-sky-500/15 to-blue-500/10", text: "text-sky-400", ring: "ring-sky-400", glow: "rgba(14,165,233,0.6)" },
|
|
1836
|
+
indigo: { border: "border-indigo-500/30", bg: "from-indigo-500/15 to-violet-500/10", text: "text-indigo-400", ring: "ring-indigo-400", glow: "rgba(99,102,241,0.6)" },
|
|
1837
|
+
rose: { border: "border-rose-500/30", bg: "from-rose-500/15 to-pink-500/10", text: "text-rose-400", ring: "ring-rose-400", glow: "rgba(244,63,94,0.6)" },
|
|
1838
|
+
amber: { border: "border-amber-500/30", bg: "from-amber-500/15 to-orange-500/10", text: "text-amber-400", ring: "ring-amber-400", glow: "rgba(245,158,11,0.6)" },
|
|
1839
|
+
emerald: { border: "border-emerald-500/30", bg: "from-emerald-500/15 to-green-500/10", text: "text-emerald-400", ring: "ring-emerald-400", glow: "rgba(16,185,129,0.6)" },
|
|
1840
|
+
violet: { border: "border-violet-500/30", bg: "from-violet-500/15 to-purple-500/10", text: "text-violet-400", ring: "ring-violet-400", glow: "rgba(139,92,246,0.6)" },
|
|
1841
|
+
pink: { border: "border-pink-500/30", bg: "from-pink-500/15 to-rose-500/10", text: "text-pink-400", ring: "ring-pink-400", glow: "rgba(236,72,153,0.6)" },
|
|
1842
|
+
orange: { border: "border-orange-500/30", bg: "from-orange-500/15 to-amber-500/10", text: "text-orange-400", ring: "ring-orange-400", glow: "rgba(249,115,22,0.6)" }
|
|
1843
|
+
};
|
|
1844
|
+
var ShellNodeBase = ({ label, icon, accentColor, isExecuting, children, extraHandles }) => {
|
|
1845
|
+
const c = COLOR_MAP[accentColor] || COLOR_MAP.teal;
|
|
1846
|
+
const executionStyle = isExecuting ? `ring-2 ${c.ring} shadow-[0_0_20px_${c.glow}] scale-105 z-50` : "";
|
|
1847
|
+
return /* @__PURE__ */ jsxs("div", { className: `bg-surface-tertiary ${c.border} border rounded-xl shadow-2xl w-[240px] overflow-hidden group hover:${c.border.replace("/30", "/60")} transition-all duration-300 ${executionStyle}`, children: [
|
|
1848
|
+
/* @__PURE__ */ jsxs("div", { className: `bg-linear-to-r ${c.bg} px-3 py-2 border-b ${c.border.replace("/30", "/20")} flex items-center justify-between`, children: [
|
|
1849
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1850
|
+
/* @__PURE__ */ jsx("span", { className: c.text, children: icon }),
|
|
1851
|
+
/* @__PURE__ */ jsx("span", { className: `text-xs font-bold ${c.text} uppercase tracking-widest`, children: label })
|
|
1852
|
+
] }),
|
|
1853
|
+
/* @__PURE__ */ jsx("div", { className: `${c.text} opacity-30 cursor-grab active:cursor-grabbing hover:opacity-80 transition-colors custom-drag-handle`, children: /* @__PURE__ */ jsx(GripVertical, { size: 14 }) })
|
|
1854
|
+
] }),
|
|
1855
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 flex flex-col gap-3", children }),
|
|
1856
|
+
/* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, className: `w-3! h-3! bg-teal-500! border-teal-400/50! -top-1.5!` }),
|
|
1857
|
+
/* @__PURE__ */ jsx(Handle, { type: "source", id: "success", position: Position.Bottom, className: `w-3! h-3! bg-emerald-500! border-emerald-400/50! -bottom-1.5!` }),
|
|
1858
|
+
extraHandles?.map((h) => /* @__PURE__ */ jsx(Handle, { type: "source", id: h.id, position: h.position, className: h.className }, h.id))
|
|
1859
|
+
] });
|
|
1860
|
+
};
|
|
1861
|
+
var ShellField = ({ label, value, onChange, placeholder, type = "text", options }) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1862
|
+
/* @__PURE__ */ jsx("label", { className: "text-[10px] uppercase tracking-wider text-text-muted", children: label }),
|
|
1863
|
+
type === "select" && options ? /* @__PURE__ */ jsx(
|
|
1864
|
+
"select",
|
|
1865
|
+
{
|
|
1866
|
+
value,
|
|
1867
|
+
onChange: (e) => onChange(e.target.value),
|
|
1868
|
+
className: "bg-surface-tertiary/50 border border-border-subtle rounded-lg px-2 py-1.5 text-xs text-text-primary w-full focus:outline-hidden focus:border-teal-500/50 transition-colors appearance-none cursor-pointer",
|
|
1869
|
+
children: options.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
|
|
1870
|
+
}
|
|
1871
|
+
) : /* @__PURE__ */ jsx(
|
|
1872
|
+
"input",
|
|
1873
|
+
{
|
|
1874
|
+
type,
|
|
1875
|
+
value,
|
|
1876
|
+
onChange: (e) => onChange(e.target.value),
|
|
1877
|
+
className: "bg-surface-tertiary/50 border border-border-subtle rounded-lg px-2 py-1.5 text-xs text-text-primary w-full focus:outline-hidden focus:border-teal-500/50 transition-colors font-mono",
|
|
1878
|
+
placeholder
|
|
1879
|
+
}
|
|
1880
|
+
)
|
|
1881
|
+
] });
|
|
1882
|
+
|
|
1883
|
+
// src/components/studio/nodes/shell/RegisterButtonNode.tsx
|
|
1884
|
+
import { useTimelineStore } from "@decido/engine";
|
|
1885
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1886
|
+
var RegisterButtonNode = ({ id, data }) => {
|
|
1887
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
1888
|
+
const updateKeyframe = useTimelineStore((s) => s.updateKeyframe);
|
|
1889
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
1890
|
+
return /* @__PURE__ */ jsxs2(ShellNodeBase, { id, label: "Activity Bar", icon: /* @__PURE__ */ jsx2(PanelLeft, { size: 14 }), accentColor: "teal", isExecuting: data.isExecuting, children: [
|
|
1891
|
+
/* @__PURE__ */ jsx2(ShellField, { label: "ID", value: data.shellItemId || "", onChange: (v2) => u("shellItemId", v2), placeholder: "btn-explorer" }),
|
|
1892
|
+
/* @__PURE__ */ jsx2(ShellField, { label: "T\xEDtulo", value: data.shellTitle || "", onChange: (v2) => u("shellTitle", v2), placeholder: "Explorador" }),
|
|
1893
|
+
/* @__PURE__ */ jsx2(ShellField, { label: "\xCDcono", value: data.shellIcon || "", onChange: (v2) => u("shellIcon", v2), placeholder: "fas fa-folder" }),
|
|
1894
|
+
/* @__PURE__ */ jsx2(ShellField, { label: "View ID", value: data.shellViewId || "", onChange: (v2) => u("shellViewId", v2), placeholder: "explorer-view" }),
|
|
1895
|
+
/* @__PURE__ */ jsx2(ShellField, { label: "Orden", value: String(data.shellOrder || 0), onChange: (v2) => u("shellOrder", parseInt(v2) || 0), type: "number" })
|
|
1896
|
+
] });
|
|
1897
|
+
};
|
|
1898
|
+
|
|
1899
|
+
// src/components/studio/nodes/shell/RegisterTabNode.tsx
|
|
1900
|
+
import { FileText } from "lucide-react";
|
|
1901
|
+
import { useTimelineStore as useTimelineStore2 } from "@decido/engine";
|
|
1902
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1903
|
+
var RegisterTabNode = ({ id, data }) => {
|
|
1904
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
1905
|
+
const updateKeyframe = useTimelineStore2((s) => s.updateKeyframe);
|
|
1906
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
1907
|
+
return /* @__PURE__ */ jsxs3(ShellNodeBase, { id, label: "Open Tab", icon: /* @__PURE__ */ jsx3(FileText, { size: 14 }), accentColor: "cyan", isExecuting: data.isExecuting, children: [
|
|
1908
|
+
/* @__PURE__ */ jsx3(ShellField, { label: "Tab ID", value: data.shellTabId || "", onChange: (v2) => u("shellTabId", v2), placeholder: "settings-tab" }),
|
|
1909
|
+
/* @__PURE__ */ jsx3(ShellField, { label: "T\xEDtulo", value: data.shellTabTitle || "", onChange: (v2) => u("shellTabTitle", v2), placeholder: "Configuraci\xF3n" }),
|
|
1910
|
+
/* @__PURE__ */ jsx3(ShellField, { label: "Componente", value: data.shellTabComponent || "", onChange: (v2) => u("shellTabComponent", v2), placeholder: "settings-view" }),
|
|
1911
|
+
/* @__PURE__ */ jsx3(ShellField, { label: "\xCDcono", value: data.shellIcon || "", onChange: (v2) => u("shellIcon", v2), placeholder: "fas fa-cog" })
|
|
1912
|
+
] });
|
|
1913
|
+
};
|
|
1914
|
+
|
|
1915
|
+
// src/components/studio/nodes/shell/RegisterPanelNode.tsx
|
|
1916
|
+
import { PanelBottom } from "lucide-react";
|
|
1917
|
+
import { useTimelineStore as useTimelineStore3 } from "@decido/engine";
|
|
1918
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1919
|
+
var RegisterPanelNode = ({ id, data }) => {
|
|
1920
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
1921
|
+
const updateKeyframe = useTimelineStore3((s) => s.updateKeyframe);
|
|
1922
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
1923
|
+
return /* @__PURE__ */ jsxs4(ShellNodeBase, { id, label: "Panel View", icon: /* @__PURE__ */ jsx4(PanelBottom, { size: 14 }), accentColor: "indigo", isExecuting: data.isExecuting, children: [
|
|
1924
|
+
/* @__PURE__ */ jsx4(ShellField, { label: "Panel ID", value: data.shellPanelId || "", onChange: (v2) => u("shellPanelId", v2), placeholder: "output-panel" }),
|
|
1925
|
+
/* @__PURE__ */ jsx4(ShellField, { label: "T\xEDtulo", value: data.shellPanelTitle || "", onChange: (v2) => u("shellPanelTitle", v2), placeholder: "Output" })
|
|
1926
|
+
] });
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
// src/components/studio/nodes/shell/RegisterSidebarNode.tsx
|
|
1930
|
+
import { Sidebar } from "lucide-react";
|
|
1931
|
+
import { useTimelineStore as useTimelineStore4 } from "@decido/engine";
|
|
1932
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1933
|
+
var RegisterSidebarNode = ({ id, data }) => {
|
|
1934
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
1935
|
+
const updateKeyframe = useTimelineStore4((s) => s.updateKeyframe);
|
|
1936
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
1937
|
+
return /* @__PURE__ */ jsxs5(ShellNodeBase, { id, label: "Sidebar View", icon: /* @__PURE__ */ jsx5(Sidebar, { size: 14 }), accentColor: "sky", isExecuting: data.isExecuting, children: [
|
|
1938
|
+
/* @__PURE__ */ jsx5(ShellField, { label: "View ID", value: data.shellSidebarId || "", onChange: (v2) => u("shellSidebarId", v2), placeholder: "file-explorer" }),
|
|
1939
|
+
/* @__PURE__ */ jsx5(ShellField, { label: "T\xEDtulo", value: data.shellSidebarTitle || "", onChange: (v2) => u("shellSidebarTitle", v2), placeholder: "Archivos" })
|
|
1940
|
+
] });
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1943
|
+
// src/components/studio/nodes/shell/RegisterStatusBarNode.tsx
|
|
1944
|
+
import { Minus } from "lucide-react";
|
|
1945
|
+
import { useTimelineStore as useTimelineStore5 } from "@decido/engine";
|
|
1946
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1947
|
+
var RegisterStatusBarNode = ({ id, data }) => {
|
|
1948
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
1949
|
+
const updateKeyframe = useTimelineStore5((s) => s.updateKeyframe);
|
|
1950
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
1951
|
+
return /* @__PURE__ */ jsxs6(ShellNodeBase, { id, label: "Status Bar", icon: /* @__PURE__ */ jsx6(Minus, { size: 14 }), accentColor: "emerald", isExecuting: data.isExecuting, children: [
|
|
1952
|
+
/* @__PURE__ */ jsx6(ShellField, { label: "Item ID", value: data.shellStatusId || "", onChange: (v2) => u("shellStatusId", v2), placeholder: "git-branch" }),
|
|
1953
|
+
/* @__PURE__ */ jsx6(ShellField, { label: "Texto", value: data.shellStatusText || "", onChange: (v2) => u("shellStatusText", v2), placeholder: "main \u2713" }),
|
|
1954
|
+
/* @__PURE__ */ jsx6(
|
|
1955
|
+
ShellField,
|
|
1956
|
+
{
|
|
1957
|
+
label: "Alineaci\xF3n",
|
|
1958
|
+
value: data.shellStatusAlign || "left",
|
|
1959
|
+
onChange: (v2) => u("shellStatusAlign", v2),
|
|
1960
|
+
type: "select",
|
|
1961
|
+
options: [{ value: "left", label: "\u2190 Izquierda" }, { value: "right", label: "\u2192 Derecha" }]
|
|
1962
|
+
}
|
|
1963
|
+
),
|
|
1964
|
+
/* @__PURE__ */ jsx6(ShellField, { label: "Orden", value: String(data.shellOrder || 0), onChange: (v2) => u("shellOrder", parseInt(v2) || 0), type: "number" })
|
|
1965
|
+
] });
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
// src/components/studio/nodes/shell/RegisterTopBarNode.tsx
|
|
1969
|
+
import { ArrowUpFromDot } from "lucide-react";
|
|
1970
|
+
import { useTimelineStore as useTimelineStore6 } from "@decido/engine";
|
|
1971
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1972
|
+
var RegisterTopBarNode = ({ id, data }) => {
|
|
1973
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
1974
|
+
const updateKeyframe = useTimelineStore6((s) => s.updateKeyframe);
|
|
1975
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
1976
|
+
return /* @__PURE__ */ jsxs7(ShellNodeBase, { id, label: "Top Bar", icon: /* @__PURE__ */ jsx7(ArrowUpFromDot, { size: 14 }), accentColor: "violet", isExecuting: data.isExecuting, children: [
|
|
1977
|
+
/* @__PURE__ */ jsx7(ShellField, { label: "Item ID", value: data.shellTopBarId || "", onChange: (v2) => u("shellTopBarId", v2), placeholder: "toggle-sidebar" }),
|
|
1978
|
+
/* @__PURE__ */ jsx7(ShellField, { label: "T\xEDtulo", value: data.shellTitle || "", onChange: (v2) => u("shellTitle", v2), placeholder: "Panel Izquierdo" }),
|
|
1979
|
+
/* @__PURE__ */ jsx7(ShellField, { label: "\xCDcono", value: data.shellIcon || "", onChange: (v2) => u("shellIcon", v2), placeholder: "fas fa-bars" }),
|
|
1980
|
+
/* @__PURE__ */ jsx7(ShellField, { label: "Command ID", value: data.shellCommandId || "", onChange: (v2) => u("shellCommandId", v2), placeholder: "layout.toggleSidebar" }),
|
|
1981
|
+
/* @__PURE__ */ jsx7(ShellField, { label: "Orden", value: String(data.shellOrder || 0), onChange: (v2) => u("shellOrder", parseInt(v2) || 0), type: "number" })
|
|
1982
|
+
] });
|
|
1983
|
+
};
|
|
1984
|
+
|
|
1985
|
+
// src/components/studio/nodes/shell/RegisterActionNode.tsx
|
|
1986
|
+
import { Terminal } from "lucide-react";
|
|
1987
|
+
import { useTimelineStore as useTimelineStore7 } from "@decido/engine";
|
|
1988
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1989
|
+
var RegisterActionNode = ({ id, data }) => {
|
|
1990
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
1991
|
+
const updateKeyframe = useTimelineStore7((s) => s.updateKeyframe);
|
|
1992
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
1993
|
+
return /* @__PURE__ */ jsxs8(ShellNodeBase, { id, label: "Register Cmd", icon: /* @__PURE__ */ jsx8(Terminal, { size: 14 }), accentColor: "amber", isExecuting: data.isExecuting, children: [
|
|
1994
|
+
/* @__PURE__ */ jsx8(ShellField, { label: "Command ID", value: data.shellCommandId || "", onChange: (v2) => u("shellCommandId", v2), placeholder: "myModule.doSomething" }),
|
|
1995
|
+
/* @__PURE__ */ jsx8(ShellField, { label: "T\xEDtulo", value: data.shellTitle || "", onChange: (v2) => u("shellTitle", v2), placeholder: "Hacer algo" }),
|
|
1996
|
+
/* @__PURE__ */ jsx8(ShellField, { label: "Categor\xEDa", value: data.shellCategory || "", onChange: (v2) => u("shellCategory", v2), placeholder: "General" })
|
|
1997
|
+
] });
|
|
1998
|
+
};
|
|
1999
|
+
|
|
2000
|
+
// src/components/studio/nodes/shell/LayoutControlNodes.tsx
|
|
2001
|
+
import { PanelLeftClose, PanelBottomClose, Columns2, Focus, X } from "lucide-react";
|
|
2002
|
+
import { useTimelineStore as useTimelineStore8 } from "@decido/engine";
|
|
2003
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2004
|
+
var ToggleSidebarNode = ({ id, data }) => {
|
|
2005
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2006
|
+
const updateKeyframe = useTimelineStore8((s) => s.updateKeyframe);
|
|
2007
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2008
|
+
return /* @__PURE__ */ jsx9(ShellNodeBase, { id, label: "Toggle Sidebar", icon: /* @__PURE__ */ jsx9(PanelLeftClose, { size: 14 }), accentColor: "sky", isExecuting: data.isExecuting, children: /* @__PURE__ */ jsx9(
|
|
2009
|
+
ShellField,
|
|
2010
|
+
{
|
|
2011
|
+
label: "Estado",
|
|
2012
|
+
value: data.shellVisible || "toggle",
|
|
2013
|
+
onChange: (v2) => u("shellVisible", v2),
|
|
2014
|
+
type: "select",
|
|
2015
|
+
options: [{ value: "toggle", label: "\u2194 Toggle" }, { value: "true", label: "\u{1F441} Mostrar" }, { value: "false", label: "\u{1F6AB} Ocultar" }]
|
|
2016
|
+
}
|
|
2017
|
+
) });
|
|
2018
|
+
};
|
|
2019
|
+
var TogglePanelNode = ({ id, data }) => {
|
|
2020
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2021
|
+
const updateKeyframe = useTimelineStore8((s) => s.updateKeyframe);
|
|
2022
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2023
|
+
return /* @__PURE__ */ jsx9(ShellNodeBase, { id, label: "Toggle Panel", icon: /* @__PURE__ */ jsx9(PanelBottomClose, { size: 14 }), accentColor: "indigo", isExecuting: data.isExecuting, children: /* @__PURE__ */ jsx9(
|
|
2024
|
+
ShellField,
|
|
2025
|
+
{
|
|
2026
|
+
label: "Estado",
|
|
2027
|
+
value: data.shellVisible || "toggle",
|
|
2028
|
+
onChange: (v2) => u("shellVisible", v2),
|
|
2029
|
+
type: "select",
|
|
2030
|
+
options: [{ value: "toggle", label: "\u2194 Toggle" }, { value: "true", label: "\u{1F441} Mostrar" }, { value: "false", label: "\u{1F6AB} Ocultar" }]
|
|
2031
|
+
}
|
|
2032
|
+
) });
|
|
2033
|
+
};
|
|
2034
|
+
var SplitPaneNode = ({ id, data }) => /* @__PURE__ */ jsx9(ShellNodeBase, { id, label: "Split Pane", icon: /* @__PURE__ */ jsx9(Columns2, { size: 14 }), accentColor: "violet", isExecuting: data.isExecuting, children: /* @__PURE__ */ jsx9("div", { className: "text-[10px] text-text-muted italic", children: "Divide el editor en un nuevo panel" }) });
|
|
2035
|
+
var FocusTabNode = ({ id, data }) => {
|
|
2036
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2037
|
+
const updateKeyframe = useTimelineStore8((s) => s.updateKeyframe);
|
|
2038
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2039
|
+
return /* @__PURE__ */ jsxs9(ShellNodeBase, { id, label: "Focus Tab", icon: /* @__PURE__ */ jsx9(Focus, { size: 14 }), accentColor: "cyan", isExecuting: data.isExecuting, children: [
|
|
2040
|
+
/* @__PURE__ */ jsx9(ShellField, { label: "Pane ID", value: data.shellPaneId || "", onChange: (v2) => u("shellPaneId", v2), placeholder: "pane-main" }),
|
|
2041
|
+
/* @__PURE__ */ jsx9(ShellField, { label: "Tab ID", value: data.shellTabId || "", onChange: (v2) => u("shellTabId", v2), placeholder: "settings-tab" })
|
|
2042
|
+
] });
|
|
2043
|
+
};
|
|
2044
|
+
var CloseTabNode = ({ id, data }) => {
|
|
2045
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2046
|
+
const updateKeyframe = useTimelineStore8((s) => s.updateKeyframe);
|
|
2047
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2048
|
+
return /* @__PURE__ */ jsxs9(ShellNodeBase, { id, label: "Close Tab", icon: /* @__PURE__ */ jsx9(X, { size: 14 }), accentColor: "rose", isExecuting: data.isExecuting, children: [
|
|
2049
|
+
/* @__PURE__ */ jsx9(ShellField, { label: "Pane ID", value: data.shellPaneId || "", onChange: (v2) => u("shellPaneId", v2), placeholder: "pane-main" }),
|
|
2050
|
+
/* @__PURE__ */ jsx9(ShellField, { label: "Tab ID", value: data.shellTabId || "", onChange: (v2) => u("shellTabId", v2), placeholder: "settings-tab" })
|
|
2051
|
+
] });
|
|
2052
|
+
};
|
|
2053
|
+
|
|
2054
|
+
// src/components/studio/nodes/shell/ThemeNodes.tsx
|
|
2055
|
+
import { Palette, Paintbrush, Pipette } from "lucide-react";
|
|
2056
|
+
import { useTimelineStore as useTimelineStore9 } from "@decido/engine";
|
|
2057
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2058
|
+
var SetThemeNode = ({ id, data }) => {
|
|
2059
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2060
|
+
const updateKeyframe = useTimelineStore9((s) => s.updateKeyframe);
|
|
2061
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2062
|
+
return /* @__PURE__ */ jsx10(ShellNodeBase, { id, label: "Set Theme", icon: /* @__PURE__ */ jsx10(Palette, { size: 14 }), accentColor: "amber", isExecuting: data.isExecuting, children: /* @__PURE__ */ jsx10(
|
|
2063
|
+
ShellField,
|
|
2064
|
+
{
|
|
2065
|
+
label: "Tema",
|
|
2066
|
+
value: data.shellTheme || "dark",
|
|
2067
|
+
onChange: (v2) => u("shellTheme", v2),
|
|
2068
|
+
type: "select",
|
|
2069
|
+
options: [{ value: "dark", label: "\u{1F319} Dark" }, { value: "light", label: "\u2600\uFE0F Light" }]
|
|
2070
|
+
}
|
|
2071
|
+
) });
|
|
2072
|
+
};
|
|
2073
|
+
var ApplyPaletteNode = ({ id, data }) => {
|
|
2074
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2075
|
+
const updateKeyframe = useTimelineStore9((s) => s.updateKeyframe);
|
|
2076
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2077
|
+
return /* @__PURE__ */ jsxs10(ShellNodeBase, { id, label: "Apply Palette", icon: /* @__PURE__ */ jsx10(Paintbrush, { size: 14 }), accentColor: "pink", isExecuting: data.isExecuting, children: [
|
|
2078
|
+
/* @__PURE__ */ jsx10(ShellField, { label: "Primary", value: data.shellPrimary || "", onChange: (v2) => u("shellPrimary", v2), placeholder: "#6366f1" }),
|
|
2079
|
+
/* @__PURE__ */ jsx10(ShellField, { label: "Secondary", value: data.shellSecondary || "", onChange: (v2) => u("shellSecondary", v2), placeholder: "#8b5cf6" }),
|
|
2080
|
+
/* @__PURE__ */ jsx10(ShellField, { label: "Accent", value: data.shellAccent || "", onChange: (v2) => u("shellAccent", v2), placeholder: "#f59e0b" }),
|
|
2081
|
+
/* @__PURE__ */ jsx10(ShellField, { label: "BG Main", value: data.shellBgMain || "", onChange: (v2) => u("shellBgMain", v2), placeholder: "#070720" }),
|
|
2082
|
+
/* @__PURE__ */ jsx10(ShellField, { label: "BG Content", value: data.shellBgContent || "", onChange: (v2) => u("shellBgContent", v2), placeholder: "#0F0F23" })
|
|
2083
|
+
] });
|
|
2084
|
+
};
|
|
2085
|
+
var UpdateTokenNode = ({ id, data }) => {
|
|
2086
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2087
|
+
const updateKeyframe = useTimelineStore9((s) => s.updateKeyframe);
|
|
2088
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2089
|
+
return /* @__PURE__ */ jsxs10(ShellNodeBase, { id, label: "CSS Token", icon: /* @__PURE__ */ jsx10(Pipette, { size: 14 }), accentColor: "orange", isExecuting: data.isExecuting, children: [
|
|
2090
|
+
/* @__PURE__ */ jsx10(ShellField, { label: "Token", value: data.shellToken || "", onChange: (v2) => u("shellToken", v2), placeholder: "--color-primary" }),
|
|
2091
|
+
/* @__PURE__ */ jsx10(ShellField, { label: "Valor", value: data.shellTokenValue || "", onChange: (v2) => u("shellTokenValue", v2), placeholder: "#6366f1" })
|
|
2092
|
+
] });
|
|
2093
|
+
};
|
|
2094
|
+
|
|
2095
|
+
// src/components/studio/nodes/shell/InteractionNodes.tsx
|
|
2096
|
+
import { Bell, SquareStack, Play, Keyboard, Radio } from "lucide-react";
|
|
2097
|
+
import { useTimelineStore as useTimelineStore10 } from "@decido/engine";
|
|
2098
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2099
|
+
var ShowNotificationNode = ({ id, data }) => {
|
|
2100
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2101
|
+
const updateKeyframe = useTimelineStore10((s) => s.updateKeyframe);
|
|
2102
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2103
|
+
return /* @__PURE__ */ jsxs11(ShellNodeBase, { id, label: "Notification", icon: /* @__PURE__ */ jsx11(Bell, { size: 14 }), accentColor: "emerald", isExecuting: data.isExecuting, children: [
|
|
2104
|
+
/* @__PURE__ */ jsx11(
|
|
2105
|
+
ShellField,
|
|
2106
|
+
{
|
|
2107
|
+
label: "Tipo",
|
|
2108
|
+
value: data.shellNotifType || "info",
|
|
2109
|
+
onChange: (v2) => u("shellNotifType", v2),
|
|
2110
|
+
type: "select",
|
|
2111
|
+
options: [
|
|
2112
|
+
{ value: "info", label: "\u2139\uFE0F Info" },
|
|
2113
|
+
{ value: "success", label: "\u2705 Success" },
|
|
2114
|
+
{ value: "warning", label: "\u26A0\uFE0F Warning" },
|
|
2115
|
+
{ value: "error", label: "\u274C Error" }
|
|
2116
|
+
]
|
|
2117
|
+
}
|
|
2118
|
+
),
|
|
2119
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "T\xEDtulo", value: data.shellNotifTitle || "", onChange: (v2) => u("shellNotifTitle", v2), placeholder: "Operaci\xF3n exitosa" }),
|
|
2120
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Mensaje", value: data.shellNotifMessage || "", onChange: (v2) => u("shellNotifMessage", v2), placeholder: "Los cambios se guardaron" })
|
|
2121
|
+
] });
|
|
2122
|
+
};
|
|
2123
|
+
var ShowModalNode = ({ id, data }) => {
|
|
2124
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2125
|
+
const updateKeyframe = useTimelineStore10((s) => s.updateKeyframe);
|
|
2126
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2127
|
+
return /* @__PURE__ */ jsxs11(ShellNodeBase, { id, label: "Show Modal", icon: /* @__PURE__ */ jsx11(SquareStack, { size: 14 }), accentColor: "violet", isExecuting: data.isExecuting, children: [
|
|
2128
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "T\xEDtulo", value: data.shellModalTitle || "", onChange: (v2) => u("shellModalTitle", v2), placeholder: "Confirmaci\xF3n" }),
|
|
2129
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Contenido HTML", value: data.shellModalContent || "", onChange: (v2) => u("shellModalContent", v2), placeholder: "<p>\xBFEst\xE1s seguro?</p>" })
|
|
2130
|
+
] });
|
|
2131
|
+
};
|
|
2132
|
+
var ExecuteCommandNode = ({ id, data }) => {
|
|
2133
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2134
|
+
const updateKeyframe = useTimelineStore10((s) => s.updateKeyframe);
|
|
2135
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2136
|
+
return /* @__PURE__ */ jsxs11(ShellNodeBase, { id, label: "Exec Command", icon: /* @__PURE__ */ jsx11(Play, { size: 14 }), accentColor: "teal", isExecuting: data.isExecuting, children: [
|
|
2137
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Command ID", value: data.shellCommandId || "", onChange: (v2) => u("shellCommandId", v2), placeholder: "palette.toggle" }),
|
|
2138
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Argumento (JSON)", value: data.shellCommandArg || "", onChange: (v2) => u("shellCommandArg", v2), placeholder: '{"key": "value"}' })
|
|
2139
|
+
] });
|
|
2140
|
+
};
|
|
2141
|
+
var RegisterShortcutNode = ({ id, data }) => {
|
|
2142
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2143
|
+
const updateKeyframe = useTimelineStore10((s) => s.updateKeyframe);
|
|
2144
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2145
|
+
return /* @__PURE__ */ jsxs11(ShellNodeBase, { id, label: "Shortcut", icon: /* @__PURE__ */ jsx11(Keyboard, { size: 14 }), accentColor: "amber", isExecuting: data.isExecuting, children: [
|
|
2146
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Keys", value: data.shellKeys || "", onChange: (v2) => u("shellKeys", v2), placeholder: "Control+Shift+P" }),
|
|
2147
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Command ID", value: data.shellCommandId || "", onChange: (v2) => u("shellCommandId", v2), placeholder: "palette.toggle" }),
|
|
2148
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Descripci\xF3n", value: data.shellShortcutDesc || "", onChange: (v2) => u("shellShortcutDesc", v2), placeholder: "Abrir paleta" })
|
|
2149
|
+
] });
|
|
2150
|
+
};
|
|
2151
|
+
var EmitEventNode = ({ id, data }) => {
|
|
2152
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2153
|
+
const updateKeyframe = useTimelineStore10((s) => s.updateKeyframe);
|
|
2154
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2155
|
+
return /* @__PURE__ */ jsxs11(ShellNodeBase, { id, label: "Emit Event", icon: /* @__PURE__ */ jsx11(Radio, { size: 14 }), accentColor: "rose", isExecuting: data.isExecuting, children: [
|
|
2156
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Evento", value: data.shellEventName || "", onChange: (v2) => u("shellEventName", v2), placeholder: "app:customEvent" }),
|
|
2157
|
+
/* @__PURE__ */ jsx11(ShellField, { label: "Data (JSON)", value: data.shellEventData || "", onChange: (v2) => u("shellEventData", v2), placeholder: '{"msg": "hello"}' })
|
|
2158
|
+
] });
|
|
2159
|
+
};
|
|
2160
|
+
|
|
2161
|
+
// src/components/studio/nodes/shell/ShellConfigNode.tsx
|
|
2162
|
+
import { Settings2 } from "lucide-react";
|
|
2163
|
+
import { useTimelineStore as useTimelineStore11 } from "@decido/engine";
|
|
2164
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2165
|
+
var ShellConfigNode = ({ id, data }) => {
|
|
2166
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2167
|
+
const updateKeyframe = useTimelineStore11((s) => s.updateKeyframe);
|
|
2168
|
+
const u = (field, val) => updateKeyframe(activeTimelineId, id, { [field]: val });
|
|
2169
|
+
return /* @__PURE__ */ jsxs12(ShellNodeBase, { id, label: "Shell Config", icon: /* @__PURE__ */ jsx12(Settings2, { size: 14 }), accentColor: "teal", isExecuting: data.isExecuting, children: [
|
|
2170
|
+
/* @__PURE__ */ jsx12(
|
|
2171
|
+
ShellField,
|
|
2172
|
+
{
|
|
2173
|
+
label: "Tema",
|
|
2174
|
+
value: data.shellTheme || "",
|
|
2175
|
+
onChange: (v2) => u("shellTheme", v2),
|
|
2176
|
+
type: "select",
|
|
2177
|
+
options: [{ value: "", label: "\u2014 Sin cambio \u2014" }, { value: "dark", label: "\u{1F319} Dark" }, { value: "light", label: "\u2600\uFE0F Light" }]
|
|
2178
|
+
}
|
|
2179
|
+
),
|
|
2180
|
+
/* @__PURE__ */ jsx12(ShellField, { label: "Primary", value: data.shellPrimary || "", onChange: (v2) => u("shellPrimary", v2), placeholder: "#6366f1" }),
|
|
2181
|
+
/* @__PURE__ */ jsx12(ShellField, { label: "Accent", value: data.shellAccent || "", onChange: (v2) => u("shellAccent", v2), placeholder: "#f59e0b" }),
|
|
2182
|
+
/* @__PURE__ */ jsx12(
|
|
2183
|
+
ShellField,
|
|
2184
|
+
{
|
|
2185
|
+
label: "Sidebar",
|
|
2186
|
+
value: data.shellSidebarState || "",
|
|
2187
|
+
onChange: (v2) => u("shellSidebarState", v2),
|
|
2188
|
+
type: "select",
|
|
2189
|
+
options: [{ value: "", label: "\u2014 Sin cambio \u2014" }, { value: "true", label: "\u{1F441} Visible" }, { value: "false", label: "\u{1F6AB} Oculto" }]
|
|
2190
|
+
}
|
|
2191
|
+
),
|
|
2192
|
+
/* @__PURE__ */ jsx12(
|
|
2193
|
+
ShellField,
|
|
2194
|
+
{
|
|
2195
|
+
label: "Panel",
|
|
2196
|
+
value: data.shellPanelState || "",
|
|
2197
|
+
onChange: (v2) => u("shellPanelState", v2),
|
|
2198
|
+
type: "select",
|
|
2199
|
+
options: [{ value: "", label: "\u2014 Sin cambio \u2014" }, { value: "true", label: "\u{1F441} Visible" }, { value: "false", label: "\u{1F6AB} Oculto" }]
|
|
2200
|
+
}
|
|
2201
|
+
),
|
|
2202
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", children: [
|
|
2203
|
+
/* @__PURE__ */ jsx12("label", { className: "text-[10px] uppercase tracking-wider text-text-muted", children: "Config Extra (JSON)" }),
|
|
2204
|
+
/* @__PURE__ */ jsx12(
|
|
2205
|
+
"textarea",
|
|
2206
|
+
{
|
|
2207
|
+
value: data.shellConfigJson || "",
|
|
2208
|
+
onChange: (e) => u("shellConfigJson", e.target.value),
|
|
2209
|
+
className: "bg-surface-tertiary/50 border border-border-subtle rounded-lg px-2 py-1.5 text-xs text-text-primary w-full focus:outline-hidden focus:border-teal-500/50 transition-colors font-mono resize-y min-h-[40px]",
|
|
2210
|
+
placeholder: '{"shortcuts": [{"id": "s1", "keys": "Ctrl+K", "commandId": "palette.toggle"}]}',
|
|
2211
|
+
rows: 2
|
|
2212
|
+
}
|
|
2213
|
+
)
|
|
2214
|
+
] }),
|
|
2215
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 pt-1 border-t border-border-subtle", children: [
|
|
2216
|
+
/* @__PURE__ */ jsx12(Settings2, { size: 12, className: "text-teal-400" }),
|
|
2217
|
+
/* @__PURE__ */ jsx12("span", { className: "text-[10px] font-mono text-teal-400", children: "Full Shell Configuration" })
|
|
2218
|
+
] })
|
|
2219
|
+
] });
|
|
2220
|
+
};
|
|
2221
|
+
|
|
2222
|
+
// src/components/studio/editor/nodeTypeRegistry.ts
|
|
2223
|
+
var nodeTypes = {
|
|
2224
|
+
dialogue: DialogueNode,
|
|
2225
|
+
"ai:dialogue": DialogueNode,
|
|
2226
|
+
logic: LogicNode,
|
|
2227
|
+
"mcp:execute": LogicNode,
|
|
2228
|
+
ui: StateNode,
|
|
2229
|
+
"ui:state": StateNode,
|
|
2230
|
+
"core:subflow": SubflowNode,
|
|
2231
|
+
"core:entry": EntryNode,
|
|
2232
|
+
"core:return": ReturnNode,
|
|
2233
|
+
"ui:render": RenderNode,
|
|
2234
|
+
"render": RenderNode,
|
|
2235
|
+
"trigger": TriggerNode,
|
|
2236
|
+
"event:trigger": TriggerNode,
|
|
2237
|
+
"condition": ConditionalNode,
|
|
2238
|
+
"logic:condition": ConditionalNode,
|
|
2239
|
+
"set": SetVariableNode,
|
|
2240
|
+
"state:set": SetVariableNode,
|
|
2241
|
+
"morph": MorphNode,
|
|
2242
|
+
"ui:morph": MorphNode,
|
|
2243
|
+
// Shell Control Nodes
|
|
2244
|
+
"shell:registerButton": RegisterButtonNode,
|
|
2245
|
+
"shell:registerTab": RegisterTabNode,
|
|
2246
|
+
"shell:registerPanel": RegisterPanelNode,
|
|
2247
|
+
"shell:registerSidebar": RegisterSidebarNode,
|
|
2248
|
+
"shell:registerStatusBar": RegisterStatusBarNode,
|
|
2249
|
+
"shell:registerTopBar": RegisterTopBarNode,
|
|
2250
|
+
"shell:registerAction": RegisterActionNode,
|
|
2251
|
+
"shell:toggleSidebar": ToggleSidebarNode,
|
|
2252
|
+
"shell:togglePanel": TogglePanelNode,
|
|
2253
|
+
"shell:splitPane": SplitPaneNode,
|
|
2254
|
+
"shell:focusTab": FocusTabNode,
|
|
2255
|
+
"shell:closeTab": CloseTabNode,
|
|
2256
|
+
"shell:setTheme": SetThemeNode,
|
|
2257
|
+
"shell:applyPalette": ApplyPaletteNode,
|
|
2258
|
+
"shell:updateToken": UpdateTokenNode,
|
|
2259
|
+
"shell:notification": ShowNotificationNode,
|
|
2260
|
+
"shell:modal": ShowModalNode,
|
|
2261
|
+
"shell:execCommand": ExecuteCommandNode,
|
|
2262
|
+
"shell:shortcut": RegisterShortcutNode,
|
|
2263
|
+
"shell:emitEvent": EmitEventNode,
|
|
2264
|
+
"shell:config": ShellConfigNode
|
|
2265
|
+
};
|
|
2266
|
+
var TRACK_X_MAP = {
|
|
2267
|
+
"ai:dialogue": 100,
|
|
2268
|
+
"ui:state": 450,
|
|
2269
|
+
"mcp:execute": 800,
|
|
2270
|
+
"core:subflow": 1100,
|
|
2271
|
+
"core:entry": 300,
|
|
2272
|
+
"core:return": 300,
|
|
2273
|
+
"ui:render": 1400,
|
|
2274
|
+
"render": 1400,
|
|
2275
|
+
"event:trigger": -200,
|
|
2276
|
+
"logic:condition": 600,
|
|
2277
|
+
"state:set": 1e3,
|
|
2278
|
+
"set": 1e3,
|
|
2279
|
+
"morph": 1400,
|
|
2280
|
+
"ui:morph": 1400,
|
|
2281
|
+
"shell:registerButton": 1700,
|
|
2282
|
+
"shell:registerTab": 1700,
|
|
2283
|
+
"shell:registerPanel": 1700,
|
|
2284
|
+
"shell:registerSidebar": 1700,
|
|
2285
|
+
"shell:registerStatusBar": 1700,
|
|
2286
|
+
"shell:registerTopBar": 1700,
|
|
2287
|
+
"shell:registerAction": 1700,
|
|
2288
|
+
"shell:toggleSidebar": 2e3,
|
|
2289
|
+
"shell:togglePanel": 2e3,
|
|
2290
|
+
"shell:splitPane": 2e3,
|
|
2291
|
+
"shell:focusTab": 2e3,
|
|
2292
|
+
"shell:closeTab": 2e3,
|
|
2293
|
+
"shell:setTheme": 2300,
|
|
2294
|
+
"shell:applyPalette": 2300,
|
|
2295
|
+
"shell:updateToken": 2300,
|
|
2296
|
+
"shell:notification": 2600,
|
|
2297
|
+
"shell:modal": 2600,
|
|
2298
|
+
"shell:execCommand": 2600,
|
|
2299
|
+
"shell:shortcut": 2600,
|
|
2300
|
+
"shell:emitEvent": 2600,
|
|
2301
|
+
"shell:config": 2900
|
|
2302
|
+
};
|
|
2303
|
+
var NODE_TYPE_TO_TRACK = {
|
|
2304
|
+
"dialogue": "dialogue",
|
|
2305
|
+
"ai:dialogue": "dialogue",
|
|
2306
|
+
"logic": "logic",
|
|
2307
|
+
"mcp:execute": "logic",
|
|
2308
|
+
"ui": "ui",
|
|
2309
|
+
"ui:state": "ui",
|
|
2310
|
+
"core:subflow": "subflow",
|
|
2311
|
+
"core:entry": "entry",
|
|
2312
|
+
"core:return": "return",
|
|
2313
|
+
"ui:render": "render",
|
|
2314
|
+
"render": "render",
|
|
2315
|
+
"trigger": "trigger",
|
|
2316
|
+
"event:trigger": "trigger",
|
|
2317
|
+
"condition": "condition",
|
|
2318
|
+
"logic:condition": "condition",
|
|
2319
|
+
"set": "set",
|
|
2320
|
+
"state:set": "set"
|
|
2321
|
+
};
|
|
2322
|
+
function mapNodePayload(decidoNode) {
|
|
2323
|
+
const data = { ...decidoNode.payload };
|
|
2324
|
+
const t = decidoNode.type;
|
|
2325
|
+
if (t === "core:subflow") data.label = decidoNode.payload.label;
|
|
2326
|
+
if (t === "ui:render" || t === "render") {
|
|
2327
|
+
data.label = decidoNode.payload.label || decidoNode.payload.state || "UI Component";
|
|
2328
|
+
data.state = decidoNode.payload.state || decidoNode.payload.label || "UI Component";
|
|
2329
|
+
data.uiSchema = decidoNode.payload.uiSchema || decidoNode.payload.schema;
|
|
2330
|
+
}
|
|
2331
|
+
if (t === "event:trigger") {
|
|
2332
|
+
Object.assign(data, {
|
|
2333
|
+
triggerType: decidoNode.payload.triggerType || "SYSTEM_START",
|
|
2334
|
+
cronExpression: decidoNode.payload.cronExpression,
|
|
2335
|
+
webhookPath: decidoNode.payload.webhookPath,
|
|
2336
|
+
eventChannel: decidoNode.payload.eventChannel,
|
|
2337
|
+
guardExpression: decidoNode.payload.guardExpression,
|
|
2338
|
+
priority: decidoNode.payload.priority
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
if (t === "logic:condition") data.conditionExpression = decidoNode.payload.conditionExpression || "";
|
|
2342
|
+
if (t === "morph" || t === "ui:morph") {
|
|
2343
|
+
Object.assign(data, {
|
|
2344
|
+
morphType: decidoNode.payload.morphType || "workbench",
|
|
2345
|
+
morphData: decidoNode.payload.morphData || null,
|
|
2346
|
+
componentId: decidoNode.payload.componentId || "",
|
|
2347
|
+
suspendOnMorph: decidoNode.payload.suspendOnMorph || false
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
if (t.startsWith("shell:")) {
|
|
2351
|
+
Object.keys(decidoNode.payload).forEach((key) => {
|
|
2352
|
+
if (key.startsWith("shell")) data[key] = decidoNode.payload[key];
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
return data;
|
|
2356
|
+
}
|
|
2357
|
+
function buildKeyframeDefaults(track, label, position, extra) {
|
|
2358
|
+
const kf = { t: Date.now(), track, position, label, state: label };
|
|
2359
|
+
if (track === "dialogue") {
|
|
2360
|
+
kf.speech = "Nuevo di\xE1logo...";
|
|
2361
|
+
kf.actorId = "assistant";
|
|
2362
|
+
} else if (track === "render" && extra?.uiSchema) {
|
|
2363
|
+
kf.uiSchema = extra.uiSchema;
|
|
2364
|
+
kf.autoComplete = false;
|
|
2365
|
+
} else if (track === "subflow") kf.targetBlueprintId = "";
|
|
2366
|
+
else if (track === "morph") kf.morphType = "workbench";
|
|
2367
|
+
else if (track === "set") {
|
|
2368
|
+
kf.target = "";
|
|
2369
|
+
kf.value = "";
|
|
2370
|
+
} else if (track === "condition") kf.conditionExpression = "true";
|
|
2371
|
+
if (track.startsWith("shell:")) {
|
|
2372
|
+
kf.track = "shell";
|
|
2373
|
+
kf.shellAction = extra?.shellAction || track.replace("shell:", "");
|
|
2374
|
+
}
|
|
2375
|
+
return kf;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
// src/components/studio/editor/edgeStyles.ts
|
|
2379
|
+
var VALID_HANDLES = /* @__PURE__ */ new Set(["success", "error", "true", "false", "fallback", "cancel"]);
|
|
2380
|
+
var HANDLE_COLORS = {
|
|
2381
|
+
success: "#22c55e",
|
|
2382
|
+
error: "#ef4444",
|
|
2383
|
+
true: "#22c55e",
|
|
2384
|
+
false: "#ef4444",
|
|
2385
|
+
fallback: "#f97316",
|
|
2386
|
+
cancel: "#a855f7"
|
|
2387
|
+
};
|
|
2388
|
+
function buildStyledEdges(timelineEdges, activeNodeIds, activeEdgeIds) {
|
|
2389
|
+
return timelineEdges.map((e) => {
|
|
2390
|
+
const rawHandle = e.sourceHandle || "success";
|
|
2391
|
+
const sourceHandle = VALID_HANDLES.has(rawHandle) ? rawHandle : "success";
|
|
2392
|
+
const color = HANDLE_COLORS[sourceHandle] || "#a855f7";
|
|
2393
|
+
const isSourceActive = activeNodeIds.includes(e.source);
|
|
2394
|
+
const isTraversed = activeEdgeIds.includes(e.id);
|
|
2395
|
+
const activeColor = isTraversed ? "#22d3ee" : color;
|
|
2396
|
+
const glowFilter = isTraversed ? `drop-shadow(0 0 10px ${activeColor})` : isSourceActive ? "drop-shadow(0 0 5px rgba(255,255,255,0.8))" : "none";
|
|
2397
|
+
return {
|
|
2398
|
+
id: e.id,
|
|
2399
|
+
source: e.source,
|
|
2400
|
+
target: e.target,
|
|
2401
|
+
sourceHandle,
|
|
2402
|
+
targetHandle: e.targetHandle,
|
|
2403
|
+
animated: isSourceActive || isTraversed,
|
|
2404
|
+
style: { stroke: activeColor, strokeWidth: isTraversed ? 5 : isSourceActive ? 4 : 3, filter: glowFilter },
|
|
2405
|
+
markerEnd: { type: MarkerType.ArrowClosed, color: activeColor }
|
|
2406
|
+
};
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
// src/components/studio/editor/CanvasContextMenu.tsx
|
|
2411
|
+
import { MessageCircle, Cpu, Monitor, Network, LogIn, LogOut, Zap, Layout, GitBranch } from "lucide-react";
|
|
2412
|
+
import { Fragment, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2413
|
+
var MENU_ITEMS = [
|
|
2414
|
+
{ section: "Di\xE1logo" },
|
|
2415
|
+
{ track: "dialogue", label: "Dialogue Node", icon: /* @__PURE__ */ jsx13(MessageCircle, { size: 14, className: "text-blue-400" }), color: "hover:bg-blue-500/10" },
|
|
2416
|
+
{ section: "L\xF3gica" },
|
|
2417
|
+
{ track: "logic", label: "Logic Gate", icon: /* @__PURE__ */ jsx13(Cpu, { size: 14, className: "text-amber-400" }), color: "hover:bg-amber-500/10" },
|
|
2418
|
+
{ section: "Estado UI" },
|
|
2419
|
+
{ track: "ui", label: "State Change", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-purple-400" }), color: "hover:bg-purple-500/10" },
|
|
2420
|
+
{ section: "HSM / Subflujos" },
|
|
2421
|
+
{ track: "subflow", label: "Subflow", icon: /* @__PURE__ */ jsx13(Network, { size: 14, className: "text-violet-400" }), color: "hover:bg-violet-500/10" },
|
|
2422
|
+
{ track: "entry", label: "Entry", icon: /* @__PURE__ */ jsx13(LogIn, { size: 14, className: "text-emerald-400" }), color: "hover:bg-emerald-500/10" },
|
|
2423
|
+
{ track: "return", label: "Return", icon: /* @__PURE__ */ jsx13(LogOut, { size: 14, className: "text-rose-400" }), color: "hover:bg-rose-500/10" },
|
|
2424
|
+
{ section: "Triggers / Branching" },
|
|
2425
|
+
{ track: "trigger", label: "Event Trigger", icon: /* @__PURE__ */ jsx13(Zap, { size: 14, className: "text-yellow-400" }), color: "hover:bg-yellow-500/10" },
|
|
2426
|
+
{ track: "condition", label: "Condici\xF3n", icon: /* @__PURE__ */ jsx13(GitBranch, { size: 14, className: "text-amber-400" }), color: "hover:bg-amber-500/10" },
|
|
2427
|
+
{ track: "set", label: "Set Variable", icon: /* @__PURE__ */ jsx13(Layout, { size: 14, className: "text-violet-400" }), color: "hover:bg-violet-500/10" },
|
|
2428
|
+
{ section: "Morfolog\xEDa" },
|
|
2429
|
+
{ track: "morph", label: "Morph Stage", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-purple-400" }), color: "hover:bg-purple-500/10" },
|
|
2430
|
+
// Shell: Registro
|
|
2431
|
+
{ section: "\u{1F5A5}\uFE0F Shell: Registro" },
|
|
2432
|
+
{ track: "shell:registerButton", label: "Activity Bar", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-teal-400" }), color: "hover:bg-teal-500/10", extra: { shellAction: "registerActivityBarItem" } },
|
|
2433
|
+
{ track: "shell:registerTab", label: "Open Tab", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-cyan-400" }), color: "hover:bg-cyan-500/10", extra: { shellAction: "openTab" } },
|
|
2434
|
+
{ track: "shell:registerPanel", label: "Panel View", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-indigo-400" }), color: "hover:bg-indigo-500/10", extra: { shellAction: "registerPanelView" } },
|
|
2435
|
+
{ track: "shell:registerSidebar", label: "Sidebar View", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-sky-400" }), color: "hover:bg-sky-500/10", extra: { shellAction: "registerSidebarView" } },
|
|
2436
|
+
{ track: "shell:registerStatusBar", label: "Status Bar", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-emerald-400" }), color: "hover:bg-emerald-500/10", extra: { shellAction: "registerStatusBarItem" } },
|
|
2437
|
+
{ track: "shell:registerTopBar", label: "Top Bar", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-violet-400" }), color: "hover:bg-violet-500/10", extra: { shellAction: "registerTopBarItem" } },
|
|
2438
|
+
{ track: "shell:registerAction", label: "Register Cmd", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-amber-400" }), color: "hover:bg-amber-500/10", extra: { shellAction: "registerCommand" } },
|
|
2439
|
+
// Shell: Layout
|
|
2440
|
+
{ section: "\u{1F5A5}\uFE0F Shell: Layout" },
|
|
2441
|
+
{ track: "shell:toggleSidebar", label: "Toggle Sidebar", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-sky-400" }), color: "hover:bg-sky-500/10", extra: { shellAction: "toggleSidebar" } },
|
|
2442
|
+
{ track: "shell:togglePanel", label: "Toggle Panel", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-indigo-400" }), color: "hover:bg-indigo-500/10", extra: { shellAction: "togglePanel" } },
|
|
2443
|
+
{ track: "shell:splitPane", label: "Split Pane", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-violet-400" }), color: "hover:bg-violet-500/10", extra: { shellAction: "splitPane" } },
|
|
2444
|
+
{ track: "shell:focusTab", label: "Focus Tab", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-cyan-400" }), color: "hover:bg-cyan-500/10", extra: { shellAction: "focusTab" } },
|
|
2445
|
+
{ track: "shell:closeTab", label: "Close Tab", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-rose-400" }), color: "hover:bg-rose-500/10", extra: { shellAction: "closeTab" } },
|
|
2446
|
+
// Shell: Tema
|
|
2447
|
+
{ section: "\u{1F5A5}\uFE0F Shell: Tema" },
|
|
2448
|
+
{ track: "shell:setTheme", label: "Set Theme", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-amber-400" }), color: "hover:bg-amber-500/10", extra: { shellAction: "setTheme" } },
|
|
2449
|
+
{ track: "shell:applyPalette", label: "Apply Palette", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-pink-400" }), color: "hover:bg-pink-500/10", extra: { shellAction: "applyPalette" } },
|
|
2450
|
+
{ track: "shell:updateToken", label: "CSS Token", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-orange-400" }), color: "hover:bg-orange-500/10", extra: { shellAction: "updateToken" } },
|
|
2451
|
+
// Shell: Interacción
|
|
2452
|
+
{ section: "\u{1F5A5}\uFE0F Shell: Interacci\xF3n" },
|
|
2453
|
+
{ track: "shell:notification", label: "Notification", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-emerald-400" }), color: "hover:bg-emerald-500/10", extra: { shellAction: "showNotification" } },
|
|
2454
|
+
{ track: "shell:modal", label: "Show Modal", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-violet-400" }), color: "hover:bg-violet-500/10", extra: { shellAction: "showModal" } },
|
|
2455
|
+
{ track: "shell:execCommand", label: "Exec Command", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-teal-400" }), color: "hover:bg-teal-500/10", extra: { shellAction: "executeCommand" } },
|
|
2456
|
+
{ track: "shell:shortcut", label: "Shortcut", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-amber-400" }), color: "hover:bg-amber-500/10", extra: { shellAction: "registerShortcut" } },
|
|
2457
|
+
{ track: "shell:emitEvent", label: "Emit Event", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-rose-400" }), color: "hover:bg-rose-500/10", extra: { shellAction: "emitEvent" } },
|
|
2458
|
+
// Shell: Config
|
|
2459
|
+
{ section: "\u{1F5A5}\uFE0F Shell: Config" },
|
|
2460
|
+
{ track: "shell:config", label: "Shell Config", icon: /* @__PURE__ */ jsx13(Monitor, { size: 14, className: "text-teal-400" }), color: "hover:bg-teal-500/10", extra: { shellAction: "shellConfig" } }
|
|
2461
|
+
];
|
|
2462
|
+
var CanvasContextMenu = ({ x, y: y2, onAdd, onClose }) => {
|
|
2463
|
+
const uiComponents = useUIComponentStore((s) => s.components);
|
|
2464
|
+
const renderItems = Object.values(uiComponents);
|
|
2465
|
+
const menuStyle = {
|
|
2466
|
+
position: "fixed",
|
|
2467
|
+
left: Math.min(x, window.innerWidth - 240),
|
|
2468
|
+
top: Math.min(y2, window.innerHeight - 600),
|
|
2469
|
+
zIndex: 999
|
|
2470
|
+
};
|
|
2471
|
+
return /* @__PURE__ */ jsxs13("div", { style: menuStyle, className: "w-56 bg-surface-secondary/95 backdrop-blur-xl border border-border-default rounded-xl shadow-2xl shadow-black/50 overflow-hidden", children: [
|
|
2472
|
+
/* @__PURE__ */ jsx13("div", { className: "px-3 py-2 border-b border-border-subtle", children: /* @__PURE__ */ jsx13("span", { className: "text-[10px] font-bold text-text-muted uppercase tracking-widest", children: "\u2795 Agregar Nodo" }) }),
|
|
2473
|
+
/* @__PURE__ */ jsxs13("div", { className: "max-h-[480px] overflow-y-auto py-1", children: [
|
|
2474
|
+
MENU_ITEMS.map((item, i) => {
|
|
2475
|
+
if (item.section) return /* @__PURE__ */ jsx13("div", { className: "px-3 pt-2 pb-1 text-[9px] font-bold text-text-muted uppercase tracking-widest", children: item.section }, `s-${i}`);
|
|
2476
|
+
return /* @__PURE__ */ jsxs13(
|
|
2477
|
+
"button",
|
|
2478
|
+
{
|
|
2479
|
+
onClick: () => onAdd(item.track, item.label, item.extra),
|
|
2480
|
+
className: `w-full flex items-center gap-2.5 px-3 py-1.5 text-xs text-text-primary hover:text-text-primary transition-colors ${item.color}`,
|
|
2481
|
+
children: [
|
|
2482
|
+
item.icon,
|
|
2483
|
+
/* @__PURE__ */ jsx13("span", { children: item.label })
|
|
2484
|
+
]
|
|
2485
|
+
},
|
|
2486
|
+
`i-${i}`
|
|
2487
|
+
);
|
|
2488
|
+
}),
|
|
2489
|
+
renderItems.length > 0 && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
2490
|
+
/* @__PURE__ */ jsx13("div", { className: "px-3 pt-2 pb-1 text-[9px] font-bold text-text-muted uppercase tracking-widest", children: "UI Components" }),
|
|
2491
|
+
renderItems.map((comp) => /* @__PURE__ */ jsxs13(
|
|
2492
|
+
"button",
|
|
2493
|
+
{
|
|
2494
|
+
onClick: () => onAdd("render", comp.name, { uiSchema: comp.schema }),
|
|
2495
|
+
className: "w-full flex items-center gap-2.5 px-3 py-1.5 text-xs text-text-primary hover:text-text-primary hover:bg-pink-500/10 transition-colors",
|
|
2496
|
+
children: [
|
|
2497
|
+
/* @__PURE__ */ jsx13(Layout, { size: 14, className: comp.source === "ai-generated" ? "text-pink-400" : "text-cyan-400" }),
|
|
2498
|
+
/* @__PURE__ */ jsx13("span", { children: comp.name }),
|
|
2499
|
+
/* @__PURE__ */ jsx13("span", { className: "ml-auto text-[9px] text-text-muted", children: comp.source === "ai-generated" ? "AI" : "built-in" })
|
|
2500
|
+
]
|
|
2501
|
+
},
|
|
2502
|
+
comp.id
|
|
2503
|
+
))
|
|
2504
|
+
] })
|
|
2505
|
+
] })
|
|
2506
|
+
] });
|
|
2507
|
+
};
|
|
2508
|
+
|
|
2509
|
+
// src/components/studio/editor/EditorToolbar.tsx
|
|
2510
|
+
import React from "react";
|
|
2511
|
+
import { Undo2, Redo2, LayoutGrid, AlignHorizontalDistributeCenter, AlignVerticalDistributeCenter, Trash2 } from "lucide-react";
|
|
2512
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2513
|
+
var EditorToolbar = React.memo(function EditorToolbar2({
|
|
2514
|
+
canUndo,
|
|
2515
|
+
canRedo,
|
|
2516
|
+
undoCount,
|
|
2517
|
+
redoCount,
|
|
2518
|
+
undo,
|
|
2519
|
+
redo,
|
|
2520
|
+
nodes,
|
|
2521
|
+
edges,
|
|
2522
|
+
setNodes,
|
|
2523
|
+
updateKeyframePosition,
|
|
2524
|
+
removeKeyframe,
|
|
2525
|
+
activeTimelineId,
|
|
2526
|
+
currentBlueprintId,
|
|
2527
|
+
fitView,
|
|
2528
|
+
setSelectedNodeId
|
|
2529
|
+
}) {
|
|
2530
|
+
const handleAutoLayout = () => {
|
|
2531
|
+
const { nodes: layoutedNodes } = getLayoutedElements(nodes, edges, { direction: "TB" });
|
|
2532
|
+
setNodes(layoutedNodes);
|
|
2533
|
+
layoutedNodes.forEach((n) => updateKeyframePosition(activeTimelineId, n.id, n.position));
|
|
2534
|
+
setTimeout(() => fitView({ padding: 0.2, duration: 600 }), 50);
|
|
2535
|
+
};
|
|
2536
|
+
const handleAlignH = () => {
|
|
2537
|
+
const selected = nodes.filter((n) => n.selected);
|
|
2538
|
+
if (selected.length < 2) return;
|
|
2539
|
+
const avgY = selected.reduce((s, n) => s + n.position.y, 0) / selected.length;
|
|
2540
|
+
setNodes((nds) => nds.map((n) => !n.selected ? n : { ...n, position: { ...n.position, y: avgY } }));
|
|
2541
|
+
selected.forEach((n) => updateKeyframePosition(activeTimelineId, n.id, { ...n.position, y: avgY }));
|
|
2542
|
+
};
|
|
2543
|
+
const handleAlignV = () => {
|
|
2544
|
+
const selected = nodes.filter((n) => n.selected);
|
|
2545
|
+
if (selected.length < 2) return;
|
|
2546
|
+
const avgX = selected.reduce((s, n) => s + n.position.x, 0) / selected.length;
|
|
2547
|
+
setNodes((nds) => nds.map((n) => !n.selected ? n : { ...n, position: { ...n.position, x: avgX } }));
|
|
2548
|
+
selected.forEach((n) => updateKeyframePosition(activeTimelineId, n.id, { ...n.position, x: avgX }));
|
|
2549
|
+
};
|
|
2550
|
+
const handleDeleteSelected = () => {
|
|
2551
|
+
const selected = nodes.filter((n) => n.selected);
|
|
2552
|
+
if (selected.length === 0) return;
|
|
2553
|
+
const targetId = currentBlueprintId || activeTimelineId;
|
|
2554
|
+
selected.forEach((n) => removeKeyframe(targetId, n.id));
|
|
2555
|
+
setSelectedNodeId(null);
|
|
2556
|
+
};
|
|
2557
|
+
return /* @__PURE__ */ jsxs14("div", { className: "absolute top-3 right-3 z-20 flex items-center gap-1 bg-surface-secondary/90 backdrop-blur-xs border border-border-default rounded-lg p-1", children: [
|
|
2558
|
+
/* @__PURE__ */ jsxs14("button", { onClick: undo, disabled: !canUndo, className: "flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed hover:bg-surface-glass text-text-primary", title: "Deshacer (\u2318Z)", children: [
|
|
2559
|
+
/* @__PURE__ */ jsx14(Undo2, { size: 14 }),
|
|
2560
|
+
canUndo && /* @__PURE__ */ jsx14("span", { className: "text-[9px] text-emerald-400 font-mono", children: undoCount })
|
|
2561
|
+
] }),
|
|
2562
|
+
/* @__PURE__ */ jsx14("div", { className: "w-px h-4 bg-surface-glass" }),
|
|
2563
|
+
/* @__PURE__ */ jsxs14("button", { onClick: redo, disabled: !canRedo, className: "flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors disabled:opacity-30 disabled:cursor-not-allowed hover:bg-surface-glass text-text-primary", title: "Rehacer (\u2318\u21E7Z)", children: [
|
|
2564
|
+
/* @__PURE__ */ jsx14(Redo2, { size: 14 }),
|
|
2565
|
+
canRedo && /* @__PURE__ */ jsx14("span", { className: "text-[9px] text-blue-400 font-mono", children: redoCount })
|
|
2566
|
+
] }),
|
|
2567
|
+
/* @__PURE__ */ jsx14("div", { className: "w-px h-4 bg-surface-glass" }),
|
|
2568
|
+
/* @__PURE__ */ jsx14("button", { onClick: handleAutoLayout, className: "flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-surface-glass text-text-primary", title: "Organizar Nodos (Dagre Layout)", children: /* @__PURE__ */ jsx14(LayoutGrid, { size: 14 }) }),
|
|
2569
|
+
/* @__PURE__ */ jsx14("div", { className: "w-px h-4 bg-surface-glass" }),
|
|
2570
|
+
/* @__PURE__ */ jsx14("button", { onClick: handleAlignH, className: "flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-surface-glass text-text-primary", title: "Alinear Horizontalmente", children: /* @__PURE__ */ jsx14(AlignHorizontalDistributeCenter, { size: 14 }) }),
|
|
2571
|
+
/* @__PURE__ */ jsx14("button", { onClick: handleAlignV, className: "flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-surface-glass text-text-primary", title: "Alinear Verticalmente", children: /* @__PURE__ */ jsx14(AlignVerticalDistributeCenter, { size: 14 }) }),
|
|
2572
|
+
/* @__PURE__ */ jsx14("div", { className: "w-px h-4 bg-surface-glass" }),
|
|
2573
|
+
/* @__PURE__ */ jsx14("button", { onClick: handleDeleteSelected, className: "flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors hover:bg-red-500/20 text-red-400", title: "Eliminar Seleccionados", children: /* @__PURE__ */ jsx14(Trash2, { size: 14 }) })
|
|
2574
|
+
] });
|
|
2575
|
+
});
|
|
2576
|
+
|
|
2577
|
+
// src/components/studio/editor/editorKeyHandler.ts
|
|
2578
|
+
function createEditorKeyHandler(opts) {
|
|
2579
|
+
return (e) => {
|
|
2580
|
+
const meta = e.metaKey || e.ctrlKey;
|
|
2581
|
+
const t = e.target;
|
|
2582
|
+
if (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT") return;
|
|
2583
|
+
const nodes = opts.getNodes();
|
|
2584
|
+
const edges = opts.getEdges();
|
|
2585
|
+
const tid = opts.currentBlueprintId || opts.activeTimelineId;
|
|
2586
|
+
if (meta && e.key === "a") {
|
|
2587
|
+
e.preventDefault();
|
|
2588
|
+
opts.setNodes((n) => n.map((x) => ({ ...x, selected: true })));
|
|
2589
|
+
opts.setEdges((ed) => ed.map((x) => ({ ...x, selected: true })));
|
|
2590
|
+
}
|
|
2591
|
+
if (meta && e.key === "c") {
|
|
2592
|
+
const sel = nodes.filter((n) => n.selected);
|
|
2593
|
+
if (!sel.length) return;
|
|
2594
|
+
const ids = new Set(sel.map((n) => n.id));
|
|
2595
|
+
opts.clipboard.current = { nodes: sel, edges: edges.filter((e2) => ids.has(e2.source) && ids.has(e2.target)) };
|
|
2596
|
+
}
|
|
2597
|
+
if (meta && e.key === "v") {
|
|
2598
|
+
const { nodes: cn, edges: ce } = opts.clipboard.current;
|
|
2599
|
+
if (!cn.length) return;
|
|
2600
|
+
e.preventDefault();
|
|
2601
|
+
const idMap = {};
|
|
2602
|
+
opts.setNodes((n) => n.map((x) => ({ ...x, selected: false })));
|
|
2603
|
+
cn.forEach((node) => {
|
|
2604
|
+
const newId = `${node.id}_copy_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
2605
|
+
idMap[node.id] = newId;
|
|
2606
|
+
opts.addKeyframe(tid, {
|
|
2607
|
+
id: newId,
|
|
2608
|
+
t: Date.now(),
|
|
2609
|
+
track: opts.NODE_TYPE_TO_TRACK[node.type || ""] || node.type || "dialogue",
|
|
2610
|
+
label: `${node.data.label || node.data.state || "Copy"} (copia)`,
|
|
2611
|
+
state: `${node.data.state || node.data.label || "Copy"} (copia)`,
|
|
2612
|
+
position: { x: node.position.x + 50, y: node.position.y + 50 },
|
|
2613
|
+
speech: node.data.speech,
|
|
2614
|
+
actorId: node.data.actorId,
|
|
2615
|
+
intent: node.data.intent,
|
|
2616
|
+
uiSchema: node.data.uiSchema || node.data.schema,
|
|
2617
|
+
autoComplete: node.data.autoComplete,
|
|
2618
|
+
triggerType: node.data.triggerType,
|
|
2619
|
+
guardExpression: node.data.guardExpression,
|
|
2620
|
+
priority: node.data.priority,
|
|
2621
|
+
conditionExpression: node.data.conditionExpression,
|
|
2622
|
+
variableTarget: node.data.variableTarget,
|
|
2623
|
+
variableValue: node.data.variableValue,
|
|
2624
|
+
targetBlueprintId: node.data.targetBlueprintId,
|
|
2625
|
+
handle: node.data.handle
|
|
2626
|
+
});
|
|
2627
|
+
});
|
|
2628
|
+
ce.forEach((edge) => {
|
|
2629
|
+
const ns = idMap[edge.source], nt = idMap[edge.target];
|
|
2630
|
+
if (ns && nt) opts.addTimelineEdge(tid, {
|
|
2631
|
+
id: `edge-${ns}-${nt}-${Date.now()}`,
|
|
2632
|
+
source: ns,
|
|
2633
|
+
target: nt,
|
|
2634
|
+
sourceHandle: edge.sourceHandle || null,
|
|
2635
|
+
targetHandle: edge.targetHandle || null
|
|
2636
|
+
});
|
|
2637
|
+
});
|
|
2638
|
+
}
|
|
2639
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
2640
|
+
const sn = nodes.filter((n) => n.selected);
|
|
2641
|
+
const se = edges.filter((e2) => e2.selected);
|
|
2642
|
+
if (!sn.length && !se.length) return;
|
|
2643
|
+
e.preventDefault();
|
|
2644
|
+
sn.forEach((n) => opts.removeKeyframe(tid, n.id));
|
|
2645
|
+
se.forEach((e2) => opts.removeTimelineEdge(tid, e2.id));
|
|
2646
|
+
opts.setSelectedNodeId(null);
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
// src/components/studio/NodePropertiesPanel.tsx
|
|
2652
|
+
import React2 from "react";
|
|
2653
|
+
import { X as X2, Variable } from "lucide-react";
|
|
2654
|
+
import { motion, AnimatePresence } from "motion/react";
|
|
2655
|
+
import { useTimelineStore as useTimelineStore12, useEngineStore } from "@decido/engine";
|
|
2656
|
+
|
|
2657
|
+
// src/components/studio/editor/TrackPropertyEditors.tsx
|
|
2658
|
+
import { Mic2, Monitor as Monitor2, Zap as Zap2, Image as Image2, PenSquare } from "lucide-react";
|
|
2659
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2660
|
+
var TRACK_CONFIG = {
|
|
2661
|
+
dialogue: { icon: Mic2, label: "Di\xE1logo", color: "text-purple-400", bg: "bg-purple-500/10", border: "border-purple-500/20" },
|
|
2662
|
+
ui: { icon: Monitor2, label: "Estado UI", color: "text-cyan-400", bg: "bg-cyan-500/10", border: "border-cyan-500/20" },
|
|
2663
|
+
logic: { icon: Zap2, label: "L\xF3gica MCP", color: "text-orange-400", bg: "bg-orange-500/10", border: "border-orange-500/20" },
|
|
2664
|
+
render: { icon: Image2, label: "UI Render", color: "text-pink-400", bg: "bg-pink-500/10", border: "border-pink-500/20" },
|
|
2665
|
+
trigger: { icon: Zap2, label: "Trigger", color: "text-yellow-400", bg: "bg-yellow-500/10", border: "border-yellow-500/20" },
|
|
2666
|
+
set: { icon: PenSquare, label: "Set Variable", color: "text-violet-400", bg: "bg-violet-500/10", border: "border-violet-500/20" }
|
|
2667
|
+
};
|
|
2668
|
+
function getTrackConfig(track) {
|
|
2669
|
+
return TRACK_CONFIG[track] || { icon: Zap2, label: track, color: "text-orange-400", bg: "bg-orange-500/10", border: "border-orange-500/20" };
|
|
2670
|
+
}
|
|
2671
|
+
var DialogueEditor = ({ keyframe, onUpdate }) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4", children: [
|
|
2672
|
+
/* @__PURE__ */ jsx15("h4", { className: "text-[10px] font-bold text-purple-400/40 uppercase tracking-widest border-b border-purple-500/20 pb-1", children: "Configuraci\xF3n Di\xE1logo" }),
|
|
2673
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2674
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "Actor ID" }),
|
|
2675
|
+
/* @__PURE__ */ jsxs15(
|
|
2676
|
+
"select",
|
|
2677
|
+
{
|
|
2678
|
+
value: keyframe.actorId || "system",
|
|
2679
|
+
onChange: (e) => onUpdate({ actorId: e.target.value }),
|
|
2680
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-purple-300 focus:outline-hidden focus:border-purple-500/50",
|
|
2681
|
+
children: [
|
|
2682
|
+
/* @__PURE__ */ jsx15("option", { value: "system", children: "\u{1F680} System" }),
|
|
2683
|
+
/* @__PURE__ */ jsx15("option", { value: "user", children: "\u{1F464} User" }),
|
|
2684
|
+
/* @__PURE__ */ jsx15("option", { value: "client", children: "\u{1F4BC} Client" }),
|
|
2685
|
+
/* @__PURE__ */ jsx15("option", { value: "inventory_agent", children: "\u{1F4E6} Inventory Agent" })
|
|
2686
|
+
]
|
|
2687
|
+
}
|
|
2688
|
+
)
|
|
2689
|
+
] }),
|
|
2690
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1 flex-1", children: [
|
|
2691
|
+
/* @__PURE__ */ jsxs15("label", { className: "text-[10px] text-text-muted flex justify-between", children: [
|
|
2692
|
+
/* @__PURE__ */ jsx15("span", { children: "Texto (TTS)" }),
|
|
2693
|
+
/* @__PURE__ */ jsxs15("span", { className: "text-purple-400/50", children: [
|
|
2694
|
+
keyframe.speech?.length || 0,
|
|
2695
|
+
" chars"
|
|
2696
|
+
] })
|
|
2697
|
+
] }),
|
|
2698
|
+
/* @__PURE__ */ jsx15(
|
|
2699
|
+
"textarea",
|
|
2700
|
+
{
|
|
2701
|
+
value: keyframe.speech || "",
|
|
2702
|
+
onChange: (e) => onUpdate({ speech: e.target.value }),
|
|
2703
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-2 text-xs text-text-primary focus:outline-hidden focus:border-purple-500/50 min-h-[120px] resize-y",
|
|
2704
|
+
placeholder: "Escribe el di\xE1logo aqu\xED..."
|
|
2705
|
+
}
|
|
2706
|
+
)
|
|
2707
|
+
] })
|
|
2708
|
+
] });
|
|
2709
|
+
var UIStateEditor = ({ keyframe, onUpdate }) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4", children: [
|
|
2710
|
+
/* @__PURE__ */ jsx15("h4", { className: "text-[10px] font-bold text-cyan-400/40 uppercase tracking-widest border-b border-cyan-500/20 pb-1", children: "Eventos Interfaz" }),
|
|
2711
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2712
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "App State Trigger" }),
|
|
2713
|
+
/* @__PURE__ */ jsx15(
|
|
2714
|
+
"input",
|
|
2715
|
+
{
|
|
2716
|
+
type: "text",
|
|
2717
|
+
value: keyframe.state || "",
|
|
2718
|
+
onChange: (e) => onUpdate({ state: e.target.value }),
|
|
2719
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-cyan-300 font-mono focus:outline-hidden focus:border-cyan-500/50",
|
|
2720
|
+
placeholder: "e.g., loading_screen"
|
|
2721
|
+
}
|
|
2722
|
+
)
|
|
2723
|
+
] }),
|
|
2724
|
+
/* @__PURE__ */ jsx15("div", { className: "mt-1 bg-surface-glass rounded-lg border border-border-default p-3", children: /* @__PURE__ */ jsxs15("label", { className: "flex items-start gap-3 cursor-pointer", children: [
|
|
2725
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", checked: keyframe.canvas || false, onChange: (e) => onUpdate({ canvas: e.target.checked }), className: "mt-0.5 rounded border-border-strong bg-surface-glass text-cyan-500 w-4 h-4 cursor-pointer" }),
|
|
2726
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col", children: [
|
|
2727
|
+
/* @__PURE__ */ jsx15("span", { className: "text-xs font-bold text-cyan-300", children: "Embeber Lienzo 3D" }),
|
|
2728
|
+
/* @__PURE__ */ jsx15("span", { className: "text-[10px] text-text-muted mt-1", children: "Al pasar por este nodo, mostrar\xE1 el motor SpatialCanvas3D." })
|
|
2729
|
+
] })
|
|
2730
|
+
] }) })
|
|
2731
|
+
] });
|
|
2732
|
+
var RenderEditor = ({ keyframe, onUpdate }) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4", children: [
|
|
2733
|
+
/* @__PURE__ */ jsx15("h4", { className: "text-[10px] font-bold text-pink-400/40 uppercase tracking-widest border-b border-pink-500/20 pb-1", children: "UI Component" }),
|
|
2734
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2735
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "Nombre" }),
|
|
2736
|
+
/* @__PURE__ */ jsx15(
|
|
2737
|
+
"input",
|
|
2738
|
+
{
|
|
2739
|
+
type: "text",
|
|
2740
|
+
value: keyframe.label || keyframe.state || "",
|
|
2741
|
+
onChange: (e) => onUpdate({ label: e.target.value, state: e.target.value }),
|
|
2742
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-pink-300 font-mono focus:outline-hidden focus:border-pink-500/50",
|
|
2743
|
+
placeholder: "e.g., Formulario Contacto"
|
|
2744
|
+
}
|
|
2745
|
+
)
|
|
2746
|
+
] }),
|
|
2747
|
+
/* @__PURE__ */ jsx15("div", { className: "bg-surface-glass rounded-lg border border-border-default p-3", children: /* @__PURE__ */ jsxs15("label", { className: "flex items-start gap-3 cursor-pointer", children: [
|
|
2748
|
+
/* @__PURE__ */ jsx15("input", { type: "checkbox", checked: keyframe.autoComplete ?? true, onChange: (e) => onUpdate({ autoComplete: e.target.checked }), className: "mt-0.5 rounded border-border-strong bg-surface-glass text-pink-500 w-4 h-4 cursor-pointer" }),
|
|
2749
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col", children: [
|
|
2750
|
+
/* @__PURE__ */ jsx15("span", { className: "text-xs font-bold text-pink-300", children: "Auto-Complete" }),
|
|
2751
|
+
/* @__PURE__ */ jsx15("span", { className: "text-[10px] text-text-muted mt-1", children: "Si activo, el nodo se completa al mostrarse. Si no, espera interacci\xF3n." })
|
|
2752
|
+
] })
|
|
2753
|
+
] }) }),
|
|
2754
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2755
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "UI Schema (JSON)" }),
|
|
2756
|
+
/* @__PURE__ */ jsx15(
|
|
2757
|
+
"textarea",
|
|
2758
|
+
{
|
|
2759
|
+
value: typeof keyframe.uiSchema === "object" ? JSON.stringify(keyframe.uiSchema, null, 2) : keyframe.uiSchema || "",
|
|
2760
|
+
onChange: (e) => {
|
|
2761
|
+
try {
|
|
2762
|
+
onUpdate({ uiSchema: JSON.parse(e.target.value) });
|
|
2763
|
+
} catch {
|
|
2764
|
+
}
|
|
2765
|
+
},
|
|
2766
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-2 text-[10px] text-pink-200 font-mono focus:outline-hidden focus:border-pink-500/50 min-h-[80px] resize-y",
|
|
2767
|
+
placeholder: '{"type":"div","children":...}'
|
|
2768
|
+
}
|
|
2769
|
+
)
|
|
2770
|
+
] })
|
|
2771
|
+
] });
|
|
2772
|
+
var LogicEditor = ({ keyframe, onUpdate }) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4", children: [
|
|
2773
|
+
/* @__PURE__ */ jsx15("h4", { className: "text-[10px] font-bold text-orange-400/40 uppercase tracking-widest border-b border-orange-500/20 pb-1", children: "Motor de L\xF3gica" }),
|
|
2774
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2775
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "T\xF3pico / Intenci\xF3n" }),
|
|
2776
|
+
/* @__PURE__ */ jsx15(
|
|
2777
|
+
"input",
|
|
2778
|
+
{
|
|
2779
|
+
type: "text",
|
|
2780
|
+
value: keyframe.intent || "",
|
|
2781
|
+
onChange: (e) => onUpdate({ intent: e.target.value }),
|
|
2782
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-orange-300 font-mono focus:outline-hidden focus:border-orange-500/50",
|
|
2783
|
+
placeholder: "e.g., process_payment"
|
|
2784
|
+
}
|
|
2785
|
+
)
|
|
2786
|
+
] }),
|
|
2787
|
+
/* @__PURE__ */ jsx15("div", { className: "p-3 bg-orange-500/10 border border-orange-500/20 rounded", children: /* @__PURE__ */ jsx15("p", { className: "text-[10px] text-orange-300/80 leading-relaxed", children: "Este nodo disparar\xE1 eventos hacia el Event Mesh para orquestar servicios remotos." }) })
|
|
2788
|
+
] });
|
|
2789
|
+
var TriggerEditor = ({ keyframe, onUpdate }) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4", children: [
|
|
2790
|
+
/* @__PURE__ */ jsx15("h4", { className: "text-[10px] font-bold text-yellow-400/40 uppercase tracking-widest border-b border-yellow-500/20 pb-1", children: "Activaci\xF3n Autom\xE1tica" }),
|
|
2791
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2792
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "Guard Expression" }),
|
|
2793
|
+
/* @__PURE__ */ jsx15(
|
|
2794
|
+
"input",
|
|
2795
|
+
{
|
|
2796
|
+
type: "text",
|
|
2797
|
+
value: keyframe.guardExpression || "",
|
|
2798
|
+
onChange: (e) => onUpdate({ guardExpression: e.target.value }),
|
|
2799
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-yellow-300 font-mono focus:outline-hidden focus:border-yellow-500/50",
|
|
2800
|
+
placeholder: "!user.onboardingComplete"
|
|
2801
|
+
}
|
|
2802
|
+
),
|
|
2803
|
+
/* @__PURE__ */ jsx15("span", { className: "text-[9px] text-text-muted", children: "Si true, el flujo se auto-activa al cargar la app." })
|
|
2804
|
+
] }),
|
|
2805
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2806
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "Prioridad" }),
|
|
2807
|
+
/* @__PURE__ */ jsx15(
|
|
2808
|
+
"input",
|
|
2809
|
+
{
|
|
2810
|
+
type: "number",
|
|
2811
|
+
value: keyframe.priority || 0,
|
|
2812
|
+
onChange: (e) => onUpdate({ priority: parseInt(e.target.value) || 0 }),
|
|
2813
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-yellow-300 font-mono focus:outline-hidden focus:border-yellow-500/50 w-20",
|
|
2814
|
+
placeholder: "0"
|
|
2815
|
+
}
|
|
2816
|
+
),
|
|
2817
|
+
/* @__PURE__ */ jsx15("span", { className: "text-[9px] text-text-muted", children: "Mayor = se eval\xFAa primero." })
|
|
2818
|
+
] })
|
|
2819
|
+
] });
|
|
2820
|
+
var SetVariableEditor = ({ keyframe, onUpdate }) => /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4", children: [
|
|
2821
|
+
/* @__PURE__ */ jsx15("h4", { className: "text-[10px] font-bold text-violet-400/40 uppercase tracking-widest border-b border-violet-500/20 pb-1", children: "Escritura de Variable" }),
|
|
2822
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2823
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "Variable Target" }),
|
|
2824
|
+
/* @__PURE__ */ jsx15(
|
|
2825
|
+
"input",
|
|
2826
|
+
{
|
|
2827
|
+
type: "text",
|
|
2828
|
+
value: keyframe.variableTarget || "",
|
|
2829
|
+
onChange: (e) => onUpdate({ variableTarget: e.target.value }),
|
|
2830
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-violet-300 font-mono focus:outline-hidden focus:border-violet-500/50",
|
|
2831
|
+
placeholder: "e.g., user.onboardingComplete"
|
|
2832
|
+
}
|
|
2833
|
+
),
|
|
2834
|
+
/* @__PURE__ */ jsx15("span", { className: "text-[9px] text-text-muted", children: 'Prefijo "user." = persistente. Sin prefijo = sesi\xF3n.' })
|
|
2835
|
+
] }),
|
|
2836
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
|
|
2837
|
+
/* @__PURE__ */ jsx15("label", { className: "text-[10px] text-text-muted", children: "Valor" }),
|
|
2838
|
+
/* @__PURE__ */ jsx15(
|
|
2839
|
+
"input",
|
|
2840
|
+
{
|
|
2841
|
+
type: "text",
|
|
2842
|
+
value: keyframe.variableValue ?? "",
|
|
2843
|
+
onChange: (e) => onUpdate({ variableValue: e.target.value }),
|
|
2844
|
+
className: "bg-surface-overlay border border-border-default rounded px-2 py-1.5 text-xs text-emerald-300 font-mono focus:outline-hidden focus:border-violet-500/50",
|
|
2845
|
+
placeholder: "e.g., true, 50, user.xp + 10"
|
|
2846
|
+
}
|
|
2847
|
+
),
|
|
2848
|
+
/* @__PURE__ */ jsx15("span", { className: "text-[9px] text-text-muted", children: "Puede ser literal o expresi\xF3n JS." })
|
|
2849
|
+
] })
|
|
2850
|
+
] });
|
|
2851
|
+
|
|
2852
|
+
// src/components/studio/NodePropertiesPanel.tsx
|
|
2853
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2854
|
+
var NodePropertiesPanel = ({ selectedNodeId, onClose }) => {
|
|
2855
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
2856
|
+
const timelines = useTimelineStore12((s) => s.timelines);
|
|
2857
|
+
const updateKeyframe = useTimelineStore12((s) => s.updateKeyframe);
|
|
2858
|
+
const variables = useEngineStore((s) => s.variables);
|
|
2859
|
+
const kf = timelines[activeTimelineId]?.keyframes.find((k) => k.id === selectedNodeId);
|
|
2860
|
+
const track = kf?.track || "";
|
|
2861
|
+
const referencedVars = React2.useMemo(() => {
|
|
2862
|
+
if (!kf) return [];
|
|
2863
|
+
const text = (kf.speech || "") + (kf.state || "");
|
|
2864
|
+
const m = text.match(/\{\{([^}]+)\}\}/g) || [];
|
|
2865
|
+
return [...new Set(m.map((x) => x.replace(/\{\{|\}\}/g, "").trim()))];
|
|
2866
|
+
}, [kf?.speech, kf?.state, kf]);
|
|
2867
|
+
if (!kf) return null;
|
|
2868
|
+
const cfg = getTrackConfig(track);
|
|
2869
|
+
const Icon = cfg.icon;
|
|
2870
|
+
const onUpdate = (patch) => updateKeyframe(activeTimelineId, kf.id, patch);
|
|
2871
|
+
return /* @__PURE__ */ jsx16(AnimatePresence, { children: /* @__PURE__ */ jsxs16(
|
|
2872
|
+
motion.div,
|
|
2873
|
+
{
|
|
2874
|
+
initial: { x: 300, opacity: 0 },
|
|
2875
|
+
animate: { x: 0, opacity: 1 },
|
|
2876
|
+
exit: { x: 300, opacity: 0 },
|
|
2877
|
+
transition: { type: "spring", bounce: 0, duration: 0.3 },
|
|
2878
|
+
className: "absolute right-0 top-0 bottom-0 w-[300px] bg-surface-primary border-l border-border-default z-50 shadow-2xl flex flex-col",
|
|
2879
|
+
children: [
|
|
2880
|
+
/* @__PURE__ */ jsxs16("div", { className: `p-4 border-b border-border-default flex items-center justify-between ${cfg.bg}`, children: [
|
|
2881
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
2882
|
+
/* @__PURE__ */ jsx16(Icon, { size: 16, className: cfg.color }),
|
|
2883
|
+
/* @__PURE__ */ jsx16("h3", { className: `text-sm font-bold uppercase tracking-widest ${cfg.color}`, children: cfg.label })
|
|
2884
|
+
] }),
|
|
2885
|
+
/* @__PURE__ */ jsx16("button", { onClick: onClose, className: "p-1 rounded-md hover:bg-surface-glass text-text-primary/50 hover:text-text-primary transition-colors", children: /* @__PURE__ */ jsx16(X2, { size: 16 }) })
|
|
2886
|
+
] }),
|
|
2887
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar flex flex-col gap-5", children: [
|
|
2888
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
|
|
2889
|
+
/* @__PURE__ */ jsx16("h4", { className: "text-[10px] font-bold text-text-primary/40 uppercase tracking-widest border-b border-border-default pb-1", children: "Metadatos Base" }),
|
|
2890
|
+
/* @__PURE__ */ jsxs16("div", { className: "grid grid-cols-2 gap-2 mt-1", children: [
|
|
2891
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
|
|
2892
|
+
/* @__PURE__ */ jsx16("label", { className: "text-[10px] text-text-muted", children: "Node ID" }),
|
|
2893
|
+
/* @__PURE__ */ jsx16("input", { type: "text", value: kf.id, readOnly: true, className: "bg-surface-overlay border border-border-subtle rounded px-2 py-1 text-xs text-text-secondary font-mono outline-hidden" })
|
|
2894
|
+
] }),
|
|
2895
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
|
|
2896
|
+
/* @__PURE__ */ jsx16("label", { className: "text-[10px] text-text-muted", children: "Tiempo (t)" }),
|
|
2897
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center border border-border-default rounded overflow-hidden", children: [
|
|
2898
|
+
/* @__PURE__ */ jsx16("input", { type: "number", step: "0.1", value: kf.t, onChange: (e) => onUpdate({ t: parseFloat(e.target.value) || 0 }), className: "bg-surface-glass px-2 py-1 text-xs text-text-primary outline-hidden w-full font-mono" }),
|
|
2899
|
+
/* @__PURE__ */ jsx16("span", { className: "bg-surface-glass px-2 py-1 text-xs text-text-muted border-l border-border-default", children: "s" })
|
|
2900
|
+
] })
|
|
2901
|
+
] })
|
|
2902
|
+
] })
|
|
2903
|
+
] }),
|
|
2904
|
+
track === "dialogue" && /* @__PURE__ */ jsx16(DialogueEditor, { keyframe: kf, onUpdate }),
|
|
2905
|
+
track === "ui" && /* @__PURE__ */ jsx16(UIStateEditor, { keyframe: kf, onUpdate }),
|
|
2906
|
+
track === "render" && /* @__PURE__ */ jsx16(RenderEditor, { keyframe: kf, onUpdate }),
|
|
2907
|
+
track === "logic" && /* @__PURE__ */ jsx16(LogicEditor, { keyframe: kf, onUpdate }),
|
|
2908
|
+
track === "trigger" && /* @__PURE__ */ jsx16(TriggerEditor, { keyframe: kf, onUpdate }),
|
|
2909
|
+
track === "set" && /* @__PURE__ */ jsx16(SetVariableEditor, { keyframe: kf, onUpdate }),
|
|
2910
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-3 mt-2", children: [
|
|
2911
|
+
/* @__PURE__ */ jsxs16("h4", { className: "text-[10px] font-bold text-emerald-400/40 uppercase tracking-widest border-b border-emerald-500/20 pb-1 flex items-center gap-1.5", children: [
|
|
2912
|
+
/* @__PURE__ */ jsx16(Variable, { size: 10 }),
|
|
2913
|
+
"Data Bindings"
|
|
2914
|
+
] }),
|
|
2915
|
+
referencedVars.length > 0 && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
|
|
2916
|
+
/* @__PURE__ */ jsx16("span", { className: "text-[9px] text-text-muted uppercase", children: "Variables Referenciadas" }),
|
|
2917
|
+
/* @__PURE__ */ jsx16("div", { className: "flex flex-wrap gap-1", children: referencedVars.map((v2) => /* @__PURE__ */ jsxs16("span", { className: `text-[10px] font-mono px-1.5 py-0.5 rounded border ${variables[v2] !== void 0 ? "bg-emerald-500/10 border-emerald-500/20 text-emerald-400" : "bg-red-500/10 border-red-500/20 text-red-400"}`, children: [
|
|
2918
|
+
`{{${v2}}}`,
|
|
2919
|
+
" ",
|
|
2920
|
+
variables[v2] !== void 0 ? `= ${variables[v2]}` : "\u26A0 undefined"
|
|
2921
|
+
] }, v2)) })
|
|
2922
|
+
] }),
|
|
2923
|
+
/* @__PURE__ */ jsxs16("div", { className: "p-2 bg-emerald-500/5 border border-emerald-500/10 rounded text-[10px] text-text-muted", children: [
|
|
2924
|
+
"Usa ",
|
|
2925
|
+
/* @__PURE__ */ jsx16("code", { className: "text-emerald-400 bg-surface-glass px-1 rounded", children: `{{variable}}` }),
|
|
2926
|
+
" en el texto para interpolar valores del Motor."
|
|
2927
|
+
] })
|
|
2928
|
+
] })
|
|
2929
|
+
] })
|
|
2930
|
+
]
|
|
2931
|
+
}
|
|
2932
|
+
) });
|
|
2933
|
+
};
|
|
2934
|
+
|
|
2935
|
+
// src/components/studio/NodePalette.tsx
|
|
2936
|
+
import { useState, useMemo } from "react";
|
|
2937
|
+
import { motion as motion2, AnimatePresence as AnimatePresence2 } from "motion/react";
|
|
2938
|
+
import { ChevronDown, ChevronRight, GripVertical as GripVertical2, PanelLeftClose as PanelLeftClose2, PanelLeft as PanelLeft3, Search, Layout as Layout3, Image as Image4 } from "lucide-react";
|
|
2939
|
+
|
|
2940
|
+
// src/components/studio/editor/paletteCatalog.tsx
|
|
2941
|
+
import {
|
|
2942
|
+
MessageCircle as MessageCircle2,
|
|
2943
|
+
Cpu as Cpu2,
|
|
2944
|
+
Monitor as Monitor3,
|
|
2945
|
+
Network as Network2,
|
|
2946
|
+
LogIn as LogIn2,
|
|
2947
|
+
LogOut as LogOut2,
|
|
2948
|
+
Zap as Zap3,
|
|
2949
|
+
Layout as Layout2,
|
|
2950
|
+
GitBranch as GitBranch2,
|
|
2951
|
+
PenSquare as PenSquare2,
|
|
2952
|
+
Terminal as Terminal2,
|
|
2953
|
+
PanelBottom as PanelBottom2,
|
|
2954
|
+
Sidebar as Sidebar2,
|
|
2955
|
+
Minus as Minus2,
|
|
2956
|
+
ArrowUpFromDot as ArrowUpFromDot2,
|
|
2957
|
+
FileText as FileText2,
|
|
2958
|
+
Columns2 as Columns22,
|
|
2959
|
+
Focus as Focus2,
|
|
2960
|
+
X as X3,
|
|
2961
|
+
Palette as Palette2,
|
|
2962
|
+
Paintbrush as Paintbrush2,
|
|
2963
|
+
Pipette as Pipette2,
|
|
2964
|
+
Bell as Bell2,
|
|
2965
|
+
SquareStack as SquareStack2,
|
|
2966
|
+
Play as Play2,
|
|
2967
|
+
Keyboard as Keyboard2,
|
|
2968
|
+
Radio as Radio2,
|
|
2969
|
+
Settings2 as Settings22,
|
|
2970
|
+
PanelLeft as PanelLeft2
|
|
2971
|
+
} from "lucide-react";
|
|
2972
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2973
|
+
var DRAG_DATA_KEY = "application/decido-node";
|
|
2974
|
+
var STATIC_CATEGORIES = [
|
|
2975
|
+
{ id: "dialogue", label: "Di\xE1logo", icon: /* @__PURE__ */ jsx17(MessageCircle2, { size: 14 }), items: [
|
|
2976
|
+
{ type: "dialogue", label: "Dialogue", icon: /* @__PURE__ */ jsx17(MessageCircle2, { size: 16 }), color: "border-blue-500/40", description: "Nodo de di\xE1logo AI" }
|
|
2977
|
+
] },
|
|
2978
|
+
{ id: "logic", label: "L\xF3gica / MCP", icon: /* @__PURE__ */ jsx17(Cpu2, { size: 14 }), items: [
|
|
2979
|
+
{ type: "logic", label: "Logic Gate", icon: /* @__PURE__ */ jsx17(Cpu2, { size: 16 }), color: "border-amber-500/40", description: "Evaluaci\xF3n condicional" }
|
|
2980
|
+
] },
|
|
2981
|
+
{ id: "ui", label: "Estado UI", icon: /* @__PURE__ */ jsx17(Monitor3, { size: 14 }), items: [
|
|
2982
|
+
{ type: "ui", label: "State Change", icon: /* @__PURE__ */ jsx17(Monitor3, { size: 16 }), color: "border-purple-500/40", description: "Cambio de estado visual" }
|
|
2983
|
+
] },
|
|
2984
|
+
{ id: "hsm", label: "HSM / Subflujos", icon: /* @__PURE__ */ jsx17(Network2, { size: 14 }), items: [
|
|
2985
|
+
{ type: "core:subflow", label: "Subflow", icon: /* @__PURE__ */ jsx17(Network2, { size: 16 }), color: "border-violet-500/40", description: "Subflujo jer\xE1rquico" },
|
|
2986
|
+
{ type: "core:entry", label: "Entry", icon: /* @__PURE__ */ jsx17(LogIn2, { size: 16 }), color: "border-emerald-500/40", description: "Punto de entrada" },
|
|
2987
|
+
{ type: "core:return", label: "Return", icon: /* @__PURE__ */ jsx17(LogOut2, { size: 16 }), color: "border-rose-500/40", description: "Punto de retorno" }
|
|
2988
|
+
] },
|
|
2989
|
+
{ id: "triggers", label: "Triggers / Branching", icon: /* @__PURE__ */ jsx17(Zap3, { size: 14 }), items: [
|
|
2990
|
+
{ type: "trigger", label: "Event Trigger", icon: /* @__PURE__ */ jsx17(Zap3, { size: 16 }), color: "border-yellow-500/40", description: "Disparador de evento" },
|
|
2991
|
+
{ type: "condition", label: "Condici\xF3n", icon: /* @__PURE__ */ jsx17(GitBranch2, { size: 16 }), color: "border-amber-500/40", description: "Bifurcaci\xF3n condicional" },
|
|
2992
|
+
{ type: "set", label: "Set Variable", icon: /* @__PURE__ */ jsx17(PenSquare2, { size: 16 }), color: "border-violet-500/40", description: "Escribir variable (UserState o sesi\xF3n)" }
|
|
2993
|
+
] },
|
|
2994
|
+
{ id: "morphology", label: "Morfolog\xEDa", icon: /* @__PURE__ */ jsx17(Layout2, { size: 14 }), items: [
|
|
2995
|
+
{ type: "morph", label: "Morph Stage", icon: /* @__PURE__ */ jsx17(Monitor3, { size: 16 }), color: "border-purple-500/40", description: "Controlar \xE1rea de renderizado" }
|
|
2996
|
+
] },
|
|
2997
|
+
// Shell Control
|
|
2998
|
+
{ id: "shell-register", label: "\u{1F5A5}\uFE0F Shell: Registro", icon: /* @__PURE__ */ jsx17(Terminal2, { size: 14 }), items: [
|
|
2999
|
+
{ type: "shell:registerButton", label: "Activity Bar", icon: /* @__PURE__ */ jsx17(PanelLeft2, { size: 16 }), color: "border-teal-500/40", description: "Registrar bot\xF3n en Activity Bar", meta: { shellAction: "registerActivityBarItem" } },
|
|
3000
|
+
{ type: "shell:registerTab", label: "Open Tab", icon: /* @__PURE__ */ jsx17(FileText2, { size: 16 }), color: "border-cyan-500/40", description: "Abrir tab en el editor", meta: { shellAction: "openTab" } },
|
|
3001
|
+
{ type: "shell:registerPanel", label: "Panel View", icon: /* @__PURE__ */ jsx17(PanelBottom2, { size: 16 }), color: "border-indigo-500/40", description: "Registrar vista en panel inferior", meta: { shellAction: "registerPanelView" } },
|
|
3002
|
+
{ type: "shell:registerSidebar", label: "Sidebar View", icon: /* @__PURE__ */ jsx17(Sidebar2, { size: 16 }), color: "border-sky-500/40", description: "Registrar vista en sidebar", meta: { shellAction: "registerSidebarView" } },
|
|
3003
|
+
{ type: "shell:registerStatusBar", label: "Status Bar", icon: /* @__PURE__ */ jsx17(Minus2, { size: 16 }), color: "border-emerald-500/40", description: "A\xF1adir item al status bar", meta: { shellAction: "registerStatusBarItem" } },
|
|
3004
|
+
{ type: "shell:registerTopBar", label: "Top Bar", icon: /* @__PURE__ */ jsx17(ArrowUpFromDot2, { size: 16 }), color: "border-violet-500/40", description: "A\xF1adir bot\xF3n al top bar", meta: { shellAction: "registerTopBarItem" } },
|
|
3005
|
+
{ type: "shell:registerAction", label: "Register Cmd", icon: /* @__PURE__ */ jsx17(Terminal2, { size: 16 }), color: "border-amber-500/40", description: "Registrar un comando", meta: { shellAction: "registerCommand" } }
|
|
3006
|
+
] },
|
|
3007
|
+
{ id: "shell-layout", label: "\u{1F5A5}\uFE0F Shell: Layout", icon: /* @__PURE__ */ jsx17(Columns22, { size: 14 }), items: [
|
|
3008
|
+
{ type: "shell:toggleSidebar", label: "Toggle Sidebar", icon: /* @__PURE__ */ jsx17(PanelLeft2, { size: 16 }), color: "border-sky-500/40", description: "Mostrar/ocultar sidebar", meta: { shellAction: "toggleSidebar" } },
|
|
3009
|
+
{ type: "shell:togglePanel", label: "Toggle Panel", icon: /* @__PURE__ */ jsx17(PanelBottom2, { size: 16 }), color: "border-indigo-500/40", description: "Mostrar/ocultar panel", meta: { shellAction: "togglePanel" } },
|
|
3010
|
+
{ type: "shell:splitPane", label: "Split Pane", icon: /* @__PURE__ */ jsx17(Columns22, { size: 16 }), color: "border-violet-500/40", description: "Dividir editor", meta: { shellAction: "splitPane" } },
|
|
3011
|
+
{ type: "shell:focusTab", label: "Focus Tab", icon: /* @__PURE__ */ jsx17(Focus2, { size: 16 }), color: "border-cyan-500/40", description: "Enfocar un tab", meta: { shellAction: "focusTab" } },
|
|
3012
|
+
{ type: "shell:closeTab", label: "Close Tab", icon: /* @__PURE__ */ jsx17(X3, { size: 16 }), color: "border-rose-500/40", description: "Cerrar un tab", meta: { shellAction: "closeTab" } }
|
|
3013
|
+
] },
|
|
3014
|
+
{ id: "shell-theme", label: "\u{1F5A5}\uFE0F Shell: Tema", icon: /* @__PURE__ */ jsx17(Palette2, { size: 14 }), items: [
|
|
3015
|
+
{ type: "shell:setTheme", label: "Set Theme", icon: /* @__PURE__ */ jsx17(Palette2, { size: 16 }), color: "border-amber-500/40", description: "Cambiar dark/light", meta: { shellAction: "setTheme" } },
|
|
3016
|
+
{ type: "shell:applyPalette", label: "Apply Palette", icon: /* @__PURE__ */ jsx17(Paintbrush2, { size: 16 }), color: "border-pink-500/40", description: "Aplicar paleta de colores", meta: { shellAction: "applyPalette" } },
|
|
3017
|
+
{ type: "shell:updateToken", label: "CSS Token", icon: /* @__PURE__ */ jsx17(Pipette2, { size: 16 }), color: "border-orange-500/40", description: "Modificar token CSS", meta: { shellAction: "updateToken" } }
|
|
3018
|
+
] },
|
|
3019
|
+
{ id: "shell-interaction", label: "\u{1F5A5}\uFE0F Shell: Interacci\xF3n", icon: /* @__PURE__ */ jsx17(Bell2, { size: 14 }), items: [
|
|
3020
|
+
{ type: "shell:notification", label: "Notification", icon: /* @__PURE__ */ jsx17(Bell2, { size: 16 }), color: "border-emerald-500/40", description: "Mostrar toast", meta: { shellAction: "showNotification" } },
|
|
3021
|
+
{ type: "shell:modal", label: "Show Modal", icon: /* @__PURE__ */ jsx17(SquareStack2, { size: 16 }), color: "border-violet-500/40", description: "Abrir modal", meta: { shellAction: "showModal" } },
|
|
3022
|
+
{ type: "shell:execCommand", label: "Exec Command", icon: /* @__PURE__ */ jsx17(Play2, { size: 16 }), color: "border-teal-500/40", description: "Ejecutar comando", meta: { shellAction: "executeCommand" } },
|
|
3023
|
+
{ type: "shell:shortcut", label: "Shortcut", icon: /* @__PURE__ */ jsx17(Keyboard2, { size: 16 }), color: "border-amber-500/40", description: "Registrar atajo", meta: { shellAction: "registerShortcut" } },
|
|
3024
|
+
{ type: "shell:emitEvent", label: "Emit Event", icon: /* @__PURE__ */ jsx17(Radio2, { size: 16 }), color: "border-rose-500/40", description: "Emitir evento", meta: { shellAction: "emitEvent" } }
|
|
3025
|
+
] },
|
|
3026
|
+
{ id: "shell-config", label: "\u{1F5A5}\uFE0F Shell: Config", icon: /* @__PURE__ */ jsx17(Settings22, { size: 14 }), items: [
|
|
3027
|
+
{ type: "shell:config", label: "Shell Config", icon: /* @__PURE__ */ jsx17(Settings22, { size: 16 }), color: "border-teal-500/40", description: "Configuraci\xF3n completa del shell", meta: { shellAction: "shellConfig" } }
|
|
3028
|
+
] }
|
|
3029
|
+
];
|
|
3030
|
+
|
|
3031
|
+
// src/components/studio/NodePalette.tsx
|
|
3032
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3033
|
+
var NodePalette = ({ className }) => {
|
|
3034
|
+
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
3035
|
+
const [expandedCategories, setExpandedCategories] = useState({
|
|
3036
|
+
dialogue: true,
|
|
3037
|
+
logic: true,
|
|
3038
|
+
ui: true,
|
|
3039
|
+
render: true,
|
|
3040
|
+
hsm: false,
|
|
3041
|
+
triggers: false,
|
|
3042
|
+
morphology: false,
|
|
3043
|
+
"shell-register": true,
|
|
3044
|
+
"shell-layout": true,
|
|
3045
|
+
"shell-theme": true,
|
|
3046
|
+
"shell-interaction": true,
|
|
3047
|
+
"shell-config": true
|
|
3048
|
+
});
|
|
3049
|
+
const [searchFilter, setSearchFilter] = useState("");
|
|
3050
|
+
const uiComponents = useUIComponentStore((s) => s.components);
|
|
3051
|
+
const categories = useMemo(() => {
|
|
3052
|
+
const renderItems = Object.values(uiComponents).map((comp) => ({
|
|
3053
|
+
type: "render",
|
|
3054
|
+
label: comp.name,
|
|
3055
|
+
icon: /* @__PURE__ */ jsx18(Layout3, { size: 16 }),
|
|
3056
|
+
color: comp.source === "ai-generated" ? "border-pink-500/40" : "border-cyan-500/40",
|
|
3057
|
+
description: `${comp.category} \xB7 ${comp.source}`,
|
|
3058
|
+
meta: { uiSchema: comp.schema, componentId: comp.id }
|
|
3059
|
+
}));
|
|
3060
|
+
const all = [...STATIC_CATEGORIES];
|
|
3061
|
+
all.splice(3, 0, { id: "render", label: "UI Render", icon: /* @__PURE__ */ jsx18(Image4, { size: 14 }), items: renderItems });
|
|
3062
|
+
return all;
|
|
3063
|
+
}, [uiComponents]);
|
|
3064
|
+
const filteredCategories = useMemo(() => {
|
|
3065
|
+
if (!searchFilter.trim()) return categories;
|
|
3066
|
+
const q = searchFilter.toLowerCase();
|
|
3067
|
+
return categories.map((c) => ({ ...c, items: c.items.filter((i) => i.label.toLowerCase().includes(q) || i.type.toLowerCase().includes(q) || (i.description || "").toLowerCase().includes(q)) })).filter((c) => c.items.length > 0);
|
|
3068
|
+
}, [categories, searchFilter]);
|
|
3069
|
+
const onDragStart = (e, item) => {
|
|
3070
|
+
e.dataTransfer.setData(DRAG_DATA_KEY, JSON.stringify({ type: item.type, label: item.label, meta: item.meta || {} }));
|
|
3071
|
+
e.dataTransfer.effectAllowed = "move";
|
|
3072
|
+
};
|
|
3073
|
+
if (isCollapsed) return /* @__PURE__ */ jsx18("div", { className: `flex flex-col items-center py-3 px-1 bg-surface-primary/80 border-r border-border-subtle ${className || ""}`, children: /* @__PURE__ */ jsx18("button", { onClick: () => setIsCollapsed(false), className: "p-2 rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-glass transition-colors", title: "Abrir Palette", children: /* @__PURE__ */ jsx18(PanelLeft3, { size: 18 }) }) });
|
|
3074
|
+
return /* @__PURE__ */ jsxs17(
|
|
3075
|
+
motion2.div,
|
|
3076
|
+
{
|
|
3077
|
+
initial: { width: 0, opacity: 0 },
|
|
3078
|
+
animate: { width: 220, opacity: 1 },
|
|
3079
|
+
exit: { width: 0, opacity: 0 },
|
|
3080
|
+
transition: { duration: 0.2 },
|
|
3081
|
+
className: `flex flex-col bg-surface-primary/90 border-r border-border-subtle overflow-hidden select-none ${className || ""}`,
|
|
3082
|
+
style: { width: 220 },
|
|
3083
|
+
children: [
|
|
3084
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between px-3 py-2.5 border-b border-border-subtle", children: [
|
|
3085
|
+
/* @__PURE__ */ jsx18("span", { className: "text-xs font-bold text-text-secondary uppercase tracking-wider", children: "Nodos" }),
|
|
3086
|
+
/* @__PURE__ */ jsx18("button", { onClick: () => setIsCollapsed(true), className: "p-1 rounded text-text-muted hover:text-text-primary hover:bg-surface-glass transition-colors", children: /* @__PURE__ */ jsx18(PanelLeftClose2, { size: 14 }) })
|
|
3087
|
+
] }),
|
|
3088
|
+
/* @__PURE__ */ jsx18("div", { className: "px-2 py-2 border-b border-border-subtle", children: /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 bg-surface-glass rounded-lg px-2.5 py-1.5", children: [
|
|
3089
|
+
/* @__PURE__ */ jsx18(Search, { size: 12, className: "text-text-muted shrink-0" }),
|
|
3090
|
+
/* @__PURE__ */ jsx18("input", { type: "text", placeholder: "Buscar nodos...", value: searchFilter, onChange: (e) => setSearchFilter(e.target.value), className: "bg-transparent text-xs text-text-primary placeholder-zinc-600 outline-hidden w-full" })
|
|
3091
|
+
] }) }),
|
|
3092
|
+
/* @__PURE__ */ jsx18("div", { className: "flex-1 overflow-y-auto custom-scrollbar", children: filteredCategories.map((cat) => /* @__PURE__ */ jsxs17("div", { children: [
|
|
3093
|
+
/* @__PURE__ */ jsxs17("button", { onClick: () => setExpandedCategories((p) => ({ ...p, [cat.id]: !p[cat.id] })), className: "w-full flex items-center gap-2 px-3 py-2 text-xs font-semibold text-text-secondary hover:text-text-primary hover:bg-surface-glass transition-colors", children: [
|
|
3094
|
+
expandedCategories[cat.id] ? /* @__PURE__ */ jsx18(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsx18(ChevronRight, { size: 12 }),
|
|
3095
|
+
/* @__PURE__ */ jsx18("span", { className: "text-text-muted", children: cat.icon }),
|
|
3096
|
+
/* @__PURE__ */ jsx18("span", { children: cat.label }),
|
|
3097
|
+
/* @__PURE__ */ jsx18("span", { className: "ml-auto text-[10px] text-text-muted bg-surface-glass px-1.5 py-0.5 rounded", children: cat.items.length })
|
|
3098
|
+
] }),
|
|
3099
|
+
/* @__PURE__ */ jsx18(AnimatePresence2, { children: expandedCategories[cat.id] && /* @__PURE__ */ jsx18(motion2.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.15 }, className: "overflow-hidden", children: cat.items.map((item) => /* @__PURE__ */ jsxs17(
|
|
3100
|
+
"div",
|
|
3101
|
+
{
|
|
3102
|
+
draggable: true,
|
|
3103
|
+
onDragStart: (e) => onDragStart(e, item),
|
|
3104
|
+
className: `flex items-center gap-2 px-3 py-2 mx-2 mb-1 rounded-lg border bg-surface-secondary/60 hover:bg-surface-glass cursor-grab active:cursor-grabbing transition-all group ${item.color}`,
|
|
3105
|
+
children: [
|
|
3106
|
+
/* @__PURE__ */ jsx18(GripVertical2, { size: 12, className: "text-text-muted group-hover:text-text-secondary shrink-0" }),
|
|
3107
|
+
/* @__PURE__ */ jsx18("div", { className: "text-text-secondary group-hover:text-text-primary shrink-0", children: item.icon }),
|
|
3108
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
3109
|
+
/* @__PURE__ */ jsx18("div", { className: "text-[11px] font-medium text-text-primary group-hover:text-text-primary truncate", children: item.label }),
|
|
3110
|
+
item.description && /* @__PURE__ */ jsx18("div", { className: "text-[9px] text-text-muted truncate", children: item.description })
|
|
3111
|
+
] })
|
|
3112
|
+
]
|
|
3113
|
+
},
|
|
3114
|
+
`${cat.id}-${item.type}-${item.label}`
|
|
3115
|
+
)) }) })
|
|
3116
|
+
] }, cat.id)) })
|
|
3117
|
+
]
|
|
3118
|
+
}
|
|
3119
|
+
);
|
|
3120
|
+
};
|
|
3121
|
+
|
|
3122
|
+
// src/components/studio/VariablePanel.tsx
|
|
3123
|
+
import { useState as useState2, useCallback } from "react";
|
|
3124
|
+
import { motion as motion3, AnimatePresence as AnimatePresence3 } from "motion/react";
|
|
3125
|
+
import { Variable as Variable2, Plus, Trash2 as Trash22, ChevronDown as ChevronDown2, ChevronRight as ChevronRight2, Search as Search2 } from "lucide-react";
|
|
3126
|
+
import { useEngineStore as useEngineStore2 } from "@decido/engine";
|
|
3127
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3128
|
+
var VariablePanel = ({ isOpen, onToggle }) => {
|
|
3129
|
+
const variables = useEngineStore2((s) => s.variables);
|
|
3130
|
+
const setVariable = useEngineStore2((s) => s.setVariable);
|
|
3131
|
+
const [newKey, setNewKey] = useState2("");
|
|
3132
|
+
const [newValue, setNewValue] = useState2("");
|
|
3133
|
+
const [search, setSearch] = useState2("");
|
|
3134
|
+
const [editingKey, setEditingKey] = useState2(null);
|
|
3135
|
+
const entries = Object.entries(variables).filter(
|
|
3136
|
+
([k]) => !search || k.toLowerCase().includes(search.toLowerCase())
|
|
3137
|
+
);
|
|
3138
|
+
const handleAdd = useCallback(() => {
|
|
3139
|
+
if (!newKey.trim()) return;
|
|
3140
|
+
let parsed = newValue;
|
|
3141
|
+
if (newValue === "true") parsed = true;
|
|
3142
|
+
else if (newValue === "false") parsed = false;
|
|
3143
|
+
else if (!isNaN(Number(newValue)) && newValue.trim()) parsed = Number(newValue);
|
|
3144
|
+
else try {
|
|
3145
|
+
parsed = JSON.parse(newValue);
|
|
3146
|
+
} catch {
|
|
3147
|
+
}
|
|
3148
|
+
setVariable(newKey.trim(), parsed);
|
|
3149
|
+
setNewKey("");
|
|
3150
|
+
setNewValue("");
|
|
3151
|
+
}, [newKey, newValue, setVariable]);
|
|
3152
|
+
const handleDelete = useCallback((key) => {
|
|
3153
|
+
const currentVars = useEngineStore2.getState().variables;
|
|
3154
|
+
const updated = { ...currentVars };
|
|
3155
|
+
delete updated[key];
|
|
3156
|
+
useEngineStore2.setState({ variables: updated });
|
|
3157
|
+
}, []);
|
|
3158
|
+
const handleUpdate = useCallback((key, rawValue) => {
|
|
3159
|
+
let parsed = rawValue;
|
|
3160
|
+
if (rawValue === "true") parsed = true;
|
|
3161
|
+
else if (rawValue === "false") parsed = false;
|
|
3162
|
+
else if (!isNaN(Number(rawValue)) && rawValue.trim()) parsed = Number(rawValue);
|
|
3163
|
+
else try {
|
|
3164
|
+
parsed = JSON.parse(rawValue);
|
|
3165
|
+
} catch {
|
|
3166
|
+
}
|
|
3167
|
+
setVariable(key, parsed);
|
|
3168
|
+
setEditingKey(null);
|
|
3169
|
+
}, [setVariable]);
|
|
3170
|
+
const getTypeColor = (val) => {
|
|
3171
|
+
if (typeof val === "boolean") return "text-amber-400";
|
|
3172
|
+
if (typeof val === "number") return "text-blue-400";
|
|
3173
|
+
if (typeof val === "object") return "text-violet-400";
|
|
3174
|
+
return "text-emerald-400";
|
|
3175
|
+
};
|
|
3176
|
+
const getTypeLabel = (val) => {
|
|
3177
|
+
if (typeof val === "boolean") return "bool";
|
|
3178
|
+
if (typeof val === "number") return "num";
|
|
3179
|
+
if (typeof val === "object") return "obj";
|
|
3180
|
+
return "str";
|
|
3181
|
+
};
|
|
3182
|
+
return /* @__PURE__ */ jsxs18("div", { className: "absolute bottom-0 left-0 right-0 z-30", children: [
|
|
3183
|
+
/* @__PURE__ */ jsxs18(
|
|
3184
|
+
"button",
|
|
3185
|
+
{
|
|
3186
|
+
onClick: onToggle,
|
|
3187
|
+
className: "flex items-center gap-2 px-3 py-1.5 bg-surface-secondary/90 backdrop-blur-xs border-t border-x border-border-default rounded-t-lg text-xs text-text-secondary hover:text-emerald-400 transition-colors ml-4",
|
|
3188
|
+
children: [
|
|
3189
|
+
/* @__PURE__ */ jsx19(Variable2, { size: 12 }),
|
|
3190
|
+
/* @__PURE__ */ jsx19("span", { className: "font-bold uppercase tracking-wider text-[9px]", children: "Variables" }),
|
|
3191
|
+
/* @__PURE__ */ jsx19("span", { className: "ml-1 bg-emerald-500/20 text-emerald-400 text-[9px] px-1.5 py-0.5 rounded-full font-mono", children: Object.keys(variables).length }),
|
|
3192
|
+
isOpen ? /* @__PURE__ */ jsx19(ChevronDown2, { size: 10 }) : /* @__PURE__ */ jsx19(ChevronRight2, { size: 10 })
|
|
3193
|
+
]
|
|
3194
|
+
}
|
|
3195
|
+
),
|
|
3196
|
+
/* @__PURE__ */ jsx19(AnimatePresence3, { children: isOpen && /* @__PURE__ */ jsx19(
|
|
3197
|
+
motion3.div,
|
|
3198
|
+
{
|
|
3199
|
+
initial: { height: 0, opacity: 0 },
|
|
3200
|
+
animate: { height: "auto", opacity: 1 },
|
|
3201
|
+
exit: { height: 0, opacity: 0 },
|
|
3202
|
+
transition: { duration: 0.2 },
|
|
3203
|
+
className: "bg-surface-secondary/95 backdrop-blur-xl border-t border-border-default overflow-hidden",
|
|
3204
|
+
children: /* @__PURE__ */ jsxs18("div", { className: "max-h-[220px] overflow-y-auto custom-scrollbar", children: [
|
|
3205
|
+
/* @__PURE__ */ jsx19("div", { className: "flex items-center gap-2 p-2 border-b border-border-subtle", children: /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1 flex-1 bg-surface-overlay rounded-lg px-2 border border-border-subtle", children: [
|
|
3206
|
+
/* @__PURE__ */ jsx19(Search2, { size: 12, className: "text-text-muted" }),
|
|
3207
|
+
/* @__PURE__ */ jsx19(
|
|
3208
|
+
"input",
|
|
3209
|
+
{
|
|
3210
|
+
type: "text",
|
|
3211
|
+
placeholder: "Buscar...",
|
|
3212
|
+
value: search,
|
|
3213
|
+
onChange: (e) => setSearch(e.target.value),
|
|
3214
|
+
className: "bg-transparent text-xs text-text-primary outline-hidden py-1.5 w-full placeholder-zinc-600"
|
|
3215
|
+
}
|
|
3216
|
+
)
|
|
3217
|
+
] }) }),
|
|
3218
|
+
/* @__PURE__ */ jsxs18("div", { className: "divide-y divide-white/5", children: [
|
|
3219
|
+
entries.length === 0 && /* @__PURE__ */ jsx19("div", { className: "text-center text-text-muted text-[10px] py-4", children: search ? "Sin resultados" : "No hay variables definidas" }),
|
|
3220
|
+
entries.map(([key, val]) => /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 px-3 py-1.5 hover:bg-surface-glass group transition-colors", children: [
|
|
3221
|
+
/* @__PURE__ */ jsx19("span", { className: `text-[9px] font-bold uppercase ${getTypeColor(val)} bg-surface-glass px-1 py-0.5 rounded`, children: getTypeLabel(val) }),
|
|
3222
|
+
/* @__PURE__ */ jsx19("span", { className: "text-xs text-text-primary font-mono truncate min-w-[100px]", children: key }),
|
|
3223
|
+
/* @__PURE__ */ jsx19("span", { className: "text-text-muted text-[10px]", children: "=" }),
|
|
3224
|
+
editingKey === key ? /* @__PURE__ */ jsx19(
|
|
3225
|
+
"input",
|
|
3226
|
+
{
|
|
3227
|
+
autoFocus: true,
|
|
3228
|
+
defaultValue: typeof val === "object" ? JSON.stringify(val) : String(val),
|
|
3229
|
+
onBlur: (e) => handleUpdate(key, e.target.value),
|
|
3230
|
+
onKeyDown: (e) => {
|
|
3231
|
+
if (e.key === "Enter") handleUpdate(key, e.target.value);
|
|
3232
|
+
if (e.key === "Escape") setEditingKey(null);
|
|
3233
|
+
},
|
|
3234
|
+
className: "flex-1 bg-surface-overlay border border-emerald-500/30 rounded px-1.5 py-0.5 text-xs text-text-primary outline-hidden font-mono"
|
|
3235
|
+
}
|
|
3236
|
+
) : /* @__PURE__ */ jsx19(
|
|
3237
|
+
"span",
|
|
3238
|
+
{
|
|
3239
|
+
onClick: () => setEditingKey(key),
|
|
3240
|
+
className: `flex-1 text-xs font-mono truncate cursor-pointer hover:text-text-primary transition-colors ${getTypeColor(val)}`,
|
|
3241
|
+
children: typeof val === "object" ? JSON.stringify(val) : String(val)
|
|
3242
|
+
}
|
|
3243
|
+
),
|
|
3244
|
+
/* @__PURE__ */ jsx19(
|
|
3245
|
+
"button",
|
|
3246
|
+
{
|
|
3247
|
+
onClick: () => handleDelete(key),
|
|
3248
|
+
className: "opacity-0 group-hover:opacity-100 text-text-muted hover:text-red-400 transition-all p-0.5",
|
|
3249
|
+
children: /* @__PURE__ */ jsx19(Trash22, { size: 10 })
|
|
3250
|
+
}
|
|
3251
|
+
)
|
|
3252
|
+
] }, key))
|
|
3253
|
+
] }),
|
|
3254
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 p-2 border-t border-border-subtle bg-surface-glass", children: [
|
|
3255
|
+
/* @__PURE__ */ jsx19(Plus, { size: 12, className: "text-emerald-500" }),
|
|
3256
|
+
/* @__PURE__ */ jsx19(
|
|
3257
|
+
"input",
|
|
3258
|
+
{
|
|
3259
|
+
type: "text",
|
|
3260
|
+
placeholder: "nombre",
|
|
3261
|
+
value: newKey,
|
|
3262
|
+
onChange: (e) => setNewKey(e.target.value),
|
|
3263
|
+
onKeyDown: (e) => {
|
|
3264
|
+
if (e.key === "Enter") handleAdd();
|
|
3265
|
+
},
|
|
3266
|
+
className: "bg-surface-overlay border border-border-subtle rounded px-2 py-1 text-xs text-emerald-300 font-mono outline-hidden w-[120px] focus:border-emerald-500/30"
|
|
3267
|
+
}
|
|
3268
|
+
),
|
|
3269
|
+
/* @__PURE__ */ jsx19("span", { className: "text-text-muted text-[10px]", children: "=" }),
|
|
3270
|
+
/* @__PURE__ */ jsx19(
|
|
3271
|
+
"input",
|
|
3272
|
+
{
|
|
3273
|
+
type: "text",
|
|
3274
|
+
placeholder: "valor",
|
|
3275
|
+
value: newValue,
|
|
3276
|
+
onChange: (e) => setNewValue(e.target.value),
|
|
3277
|
+
onKeyDown: (e) => {
|
|
3278
|
+
if (e.key === "Enter") handleAdd();
|
|
3279
|
+
},
|
|
3280
|
+
className: "bg-surface-overlay border border-border-subtle rounded px-2 py-1 text-xs text-text-primary font-mono outline-hidden flex-1 focus:border-emerald-500/30"
|
|
3281
|
+
}
|
|
3282
|
+
),
|
|
3283
|
+
/* @__PURE__ */ jsx19(
|
|
3284
|
+
"button",
|
|
3285
|
+
{
|
|
3286
|
+
onClick: handleAdd,
|
|
3287
|
+
disabled: !newKey.trim(),
|
|
3288
|
+
className: "px-2 py-1 text-[10px] bg-emerald-500/10 text-emerald-400 rounded font-bold hover:bg-emerald-500/20 disabled:opacity-30 transition-colors",
|
|
3289
|
+
children: "Agregar"
|
|
3290
|
+
}
|
|
3291
|
+
)
|
|
3292
|
+
] })
|
|
3293
|
+
] })
|
|
3294
|
+
}
|
|
3295
|
+
) })
|
|
3296
|
+
] });
|
|
3297
|
+
};
|
|
3298
|
+
|
|
3299
|
+
// src/components/studio/ReactFlowEditor.tsx
|
|
3300
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3301
|
+
var ReactFlowEditorInner = ({ className, style, id }) => {
|
|
3302
|
+
const { fitView, getIntersectingNodes, screenToFlowPosition } = useReactFlow();
|
|
3303
|
+
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
3304
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
3305
|
+
const [selectedNodeId, setSelectedNodeId] = useState3(null);
|
|
3306
|
+
const [isVariablePanelOpen, setIsVariablePanelOpen] = useState3(false);
|
|
3307
|
+
const lastFittedBlueprintRef = useRef(null);
|
|
3308
|
+
const clipboardRef = useRef({ nodes: [], edges: [] });
|
|
3309
|
+
const [contextMenu, setContextMenu] = useState3(null);
|
|
3310
|
+
const activeTimelineId = usePlaygroundStore((s) => s.prototypeBrand);
|
|
3311
|
+
const activeNodeIds = useEngineStore3((s) => s.activeNodeIds);
|
|
3312
|
+
const activeEdgeIds = useEngineStore3((s) => s.activeEdgeIds);
|
|
3313
|
+
const timelines = useTimelineStore13((s) => s.timelines);
|
|
3314
|
+
const blueprintLibrary = useTimelineStore13((s) => s.blueprintLibrary);
|
|
3315
|
+
const updateKeyframePosition = useTimelineStore13((s) => s.updateKeyframePosition);
|
|
3316
|
+
const updateKeyframe = useTimelineStore13((s) => s.updateKeyframe);
|
|
3317
|
+
const addTimelineEdge = useTimelineStore13((s) => s.addEdge);
|
|
3318
|
+
const removeTimelineEdge = useTimelineStore13((s) => s.removeEdge);
|
|
3319
|
+
const addKeyframe = useTimelineStore13((s) => s.addKeyframe);
|
|
3320
|
+
const removeKeyframe = useTimelineStore13((s) => s.removeKeyframe);
|
|
3321
|
+
const undo = useTimelineStore13((s) => s.undo);
|
|
3322
|
+
const redo = useTimelineStore13((s) => s.redo);
|
|
3323
|
+
const setActiveTimeline = useTimelineStore13((s) => s.setActiveTimeline);
|
|
3324
|
+
const pastTimelines = useTimelineStore13((s) => s.pastTimelines);
|
|
3325
|
+
const futureTimelines = useTimelineStore13((s) => s.futureTimelines);
|
|
3326
|
+
useEffect(() => {
|
|
3327
|
+
setActiveTimeline(activeTimelineId);
|
|
3328
|
+
}, [activeTimelineId, setActiveTimeline]);
|
|
3329
|
+
useEffect(() => {
|
|
3330
|
+
const h = (e) => {
|
|
3331
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "z" && !e.shiftKey) {
|
|
3332
|
+
e.preventDefault();
|
|
3333
|
+
undo();
|
|
3334
|
+
} else if ((e.metaKey || e.ctrlKey) && (e.key === "Z" || e.key === "y")) {
|
|
3335
|
+
e.preventDefault();
|
|
3336
|
+
redo();
|
|
3337
|
+
}
|
|
3338
|
+
};
|
|
3339
|
+
window.addEventListener("keydown", h);
|
|
3340
|
+
return () => window.removeEventListener("keydown", h);
|
|
3341
|
+
}, [undo, redo]);
|
|
3342
|
+
const canUndo = (pastTimelines[activeTimelineId]?.length || 0) > 0;
|
|
3343
|
+
const canRedo = (futureTimelines[activeTimelineId]?.length || 0) > 0;
|
|
3344
|
+
const currentBlueprintId = useBlueprintNavigation((s) => s.currentBlueprintId);
|
|
3345
|
+
const pushNavigation = useBlueprintNavigation((s) => s.pushNavigation);
|
|
3346
|
+
const drillTarget = currentBlueprintId ? blueprintLibrary[currentBlueprintId] : null;
|
|
3347
|
+
const activeTimeline = drillTarget || timelines[activeTimelineId];
|
|
3348
|
+
useEffect(() => {
|
|
3349
|
+
if (!activeTimeline) return;
|
|
3350
|
+
const renderTimelineId = drillTarget ? currentBlueprintId : activeTimelineId;
|
|
3351
|
+
const blueprint = convertLegacyTimelineToBlueprint(renderTimelineId, activeTimeline.keyframes || [], activeTimeline.edges || []);
|
|
3352
|
+
const decidoNodes = Object.values(blueprint.nodes);
|
|
3353
|
+
const posMap = {};
|
|
3354
|
+
decidoNodes.forEach((node) => {
|
|
3355
|
+
if (node.visual?.x !== void 0 && node.visual?.y !== void 0 && (node.visual.y !== 0 || node.visual.x !== 0))
|
|
3356
|
+
posMap[node.id] = { x: node.visual.x, y: node.visual.y };
|
|
3357
|
+
});
|
|
3358
|
+
const gapY = 150;
|
|
3359
|
+
let unresolved = decidoNodes.filter((n) => !posMap[n.id]);
|
|
3360
|
+
let changes = true;
|
|
3361
|
+
while (unresolved.length > 0 && changes) {
|
|
3362
|
+
changes = false;
|
|
3363
|
+
unresolved = unresolved.filter((n) => {
|
|
3364
|
+
const inEdge = blueprint.edges.find((e) => e.target === n.id && posMap[e.source]);
|
|
3365
|
+
if (inEdge) {
|
|
3366
|
+
const src = posMap[inEdge.source];
|
|
3367
|
+
const pos = { x: src.x, y: src.y + gapY };
|
|
3368
|
+
let col = true;
|
|
3369
|
+
while (col) {
|
|
3370
|
+
col = Object.values(posMap).some((p) => Math.abs(p.x - pos.x) < 50 && Math.abs(p.y - pos.y) < 50);
|
|
3371
|
+
if (col) pos.x += 250;
|
|
3372
|
+
}
|
|
3373
|
+
posMap[n.id] = pos;
|
|
3374
|
+
changes = true;
|
|
3375
|
+
return false;
|
|
3376
|
+
}
|
|
3377
|
+
return true;
|
|
3378
|
+
});
|
|
3379
|
+
}
|
|
3380
|
+
unresolved.forEach((n, i) => {
|
|
3381
|
+
posMap[n.id] = { x: TRACK_X_MAP[n.type] || 0, y: i * 100 };
|
|
3382
|
+
});
|
|
3383
|
+
const newNodes = decidoNodes.map((dn) => ({
|
|
3384
|
+
id: dn.id,
|
|
3385
|
+
type: dn.type,
|
|
3386
|
+
position: posMap[dn.id],
|
|
3387
|
+
parentId: dn.visual?.parentId,
|
|
3388
|
+
extent: dn.visual?.parentId ? "parent" : void 0,
|
|
3389
|
+
data: {
|
|
3390
|
+
keyframeId: dn.id,
|
|
3391
|
+
isInteractive: true,
|
|
3392
|
+
isExecuting: activeNodeIds.includes(dn.id),
|
|
3393
|
+
onUpdateNodeData: (nodeId, partialData) => updateKeyframe(renderTimelineId, nodeId, partialData),
|
|
3394
|
+
variables: useEngineStore3.getState().variables,
|
|
3395
|
+
isSpeaking: useEngineStore3.getState().isSpeaking,
|
|
3396
|
+
registeredMorphComponents: getRegisteredMorphComponents(),
|
|
3397
|
+
onDrillDown: (blueprintId, label) => pushNavigation({ blueprintId, label }),
|
|
3398
|
+
...mapNodePayload(dn)
|
|
3399
|
+
}
|
|
3400
|
+
}));
|
|
3401
|
+
const newEdges = activeTimeline.edges ? buildStyledEdges(activeTimeline.edges, activeNodeIds, activeEdgeIds) : [];
|
|
3402
|
+
setNodes(newNodes);
|
|
3403
|
+
setEdges(newEdges);
|
|
3404
|
+
if (lastFittedBlueprintRef.current !== renderTimelineId) {
|
|
3405
|
+
lastFittedBlueprintRef.current = renderTimelineId;
|
|
3406
|
+
const needsLayout = newNodes.every((n) => n.position.x === 0 && n.position.y === 0) || newNodes.filter((n) => n.position.x === 0 && n.position.y === 0).length > newNodes.length * 0.5;
|
|
3407
|
+
if (needsLayout && newNodes.length > 1) {
|
|
3408
|
+
const { nodes: ln } = getLayoutedElements(newNodes, newEdges, { direction: "TB" });
|
|
3409
|
+
setNodes(ln);
|
|
3410
|
+
ln.forEach((n) => updateKeyframePosition(activeTimelineId, n.id, n.position));
|
|
3411
|
+
}
|
|
3412
|
+
setTimeout(() => fitView({ padding: 0.2, duration: 800 }), 50);
|
|
3413
|
+
}
|
|
3414
|
+
}, [activeTimeline, activeNodeIds, drillTarget, setNodes, setEdges, fitView]);
|
|
3415
|
+
const onConnect = useCallback2((p) => {
|
|
3416
|
+
setEdges((eds) => addEdge(p, eds));
|
|
3417
|
+
addTimelineEdge(activeTimelineId, { id: `edge-${p.source}-${p.target}-${Date.now()}`, source: p.source, target: p.target, sourceHandle: p.sourceHandle || null, targetHandle: p.targetHandle || null });
|
|
3418
|
+
}, [activeTimelineId, addTimelineEdge, setEdges]);
|
|
3419
|
+
const onEdgesDelete = useCallback2((del) => {
|
|
3420
|
+
del.forEach((e) => removeTimelineEdge(activeTimelineId, e.id));
|
|
3421
|
+
}, [activeTimelineId, removeTimelineEdge]);
|
|
3422
|
+
const onNodeDragStop = useCallback2((_2, node, dragged) => {
|
|
3423
|
+
(dragged.length > 1 ? dragged : [node]).forEach((n) => {
|
|
3424
|
+
updateKeyframePosition(activeTimelineId, n.id, n.position);
|
|
3425
|
+
if (n.id === node.id) {
|
|
3426
|
+
const groups = getIntersectingNodes(n).filter((g) => g.type === "group");
|
|
3427
|
+
if (n.type !== "group") updateKeyframe(activeTimelineId, n.id, { parentId: groups[0]?.id || void 0 });
|
|
3428
|
+
}
|
|
3429
|
+
});
|
|
3430
|
+
}, [activeTimelineId, updateKeyframePosition, updateKeyframe, getIntersectingNodes]);
|
|
3431
|
+
const onNodeClick = useCallback2((_2, n) => setSelectedNodeId(n.id), []);
|
|
3432
|
+
const onPaneClick = useCallback2(() => {
|
|
3433
|
+
setSelectedNodeId(null);
|
|
3434
|
+
setContextMenu(null);
|
|
3435
|
+
}, []);
|
|
3436
|
+
const onPaneContextMenu = useCallback2((e) => {
|
|
3437
|
+
e.preventDefault();
|
|
3438
|
+
const flowPos = screenToFlowPosition({ x: e.clientX, y: e.clientY });
|
|
3439
|
+
setContextMenu({ x: e.clientX, y: e.clientY, flowPos });
|
|
3440
|
+
}, [screenToFlowPosition]);
|
|
3441
|
+
const addNodeAt = useCallback2((track, label, extra) => {
|
|
3442
|
+
if (!contextMenu) return;
|
|
3443
|
+
const targetId = currentBlueprintId || activeTimelineId;
|
|
3444
|
+
addKeyframe(targetId, buildKeyframeDefaults(track, label, contextMenu.flowPos, extra));
|
|
3445
|
+
setContextMenu(null);
|
|
3446
|
+
}, [contextMenu, activeTimelineId, currentBlueprintId, addKeyframe]);
|
|
3447
|
+
useEffect(() => {
|
|
3448
|
+
const h = createEditorKeyHandler({
|
|
3449
|
+
getNodes: () => nodes,
|
|
3450
|
+
getEdges: () => edges,
|
|
3451
|
+
setNodes,
|
|
3452
|
+
setEdges,
|
|
3453
|
+
clipboard: clipboardRef,
|
|
3454
|
+
activeTimelineId,
|
|
3455
|
+
currentBlueprintId,
|
|
3456
|
+
addKeyframe,
|
|
3457
|
+
addTimelineEdge,
|
|
3458
|
+
removeKeyframe,
|
|
3459
|
+
removeTimelineEdge,
|
|
3460
|
+
setSelectedNodeId,
|
|
3461
|
+
NODE_TYPE_TO_TRACK
|
|
3462
|
+
});
|
|
3463
|
+
window.addEventListener("keydown", h);
|
|
3464
|
+
return () => window.removeEventListener("keydown", h);
|
|
3465
|
+
}, [nodes, edges, activeTimelineId, currentBlueprintId, setNodes, setEdges, addKeyframe, addTimelineEdge, removeKeyframe, removeTimelineEdge]);
|
|
3466
|
+
const breadcrumbs = useBlueprintNavigation((s) => s.navigationStack);
|
|
3467
|
+
const navigateToLevel = useBlueprintNavigation((s) => s.navigateToLevel);
|
|
3468
|
+
const isInsideSubflow = breadcrumbs.length > 1;
|
|
3469
|
+
return /* @__PURE__ */ jsxs19("div", { style, className: `relative flex flex-col overflow-hidden w-full h-full ${className || ""}`, id, children: [
|
|
3470
|
+
isInsideSubflow && /* @__PURE__ */ jsxs19("div", { className: "flex-none flex items-center gap-1 px-3 py-2 bg-surface-overlay border-b border-border-default backdrop-blur-xs z-10", children: [
|
|
3471
|
+
/* @__PURE__ */ jsxs19("button", { onClick: () => navigateToLevel(0), className: "flex items-center gap-1 text-xs text-text-secondary hover:text-text-primary transition-colors px-1.5 py-0.5 rounded hover:bg-surface-glass", children: [
|
|
3472
|
+
/* @__PURE__ */ jsx20(Home, { size: 12 }),
|
|
3473
|
+
/* @__PURE__ */ jsx20("span", { children: "Root" })
|
|
3474
|
+
] }),
|
|
3475
|
+
breadcrumbs.slice(1).map((frame, idx) => /* @__PURE__ */ jsxs19(React5.Fragment, { children: [
|
|
3476
|
+
/* @__PURE__ */ jsx20(ChevronRight3, { size: 12, className: "text-text-muted" }),
|
|
3477
|
+
/* @__PURE__ */ jsxs19("button", { onClick: () => navigateToLevel(idx + 1), className: `text-xs px-1.5 py-0.5 rounded transition-colors ${idx + 1 === breadcrumbs.length - 1 ? "text-purple-300 bg-purple-500/10 border border-purple-500/20" : "text-text-secondary hover:text-text-primary hover:bg-surface-glass"}`, children: [
|
|
3478
|
+
"\u{1F4E6} ",
|
|
3479
|
+
frame.label
|
|
3480
|
+
] })
|
|
3481
|
+
] }, idx + 1))
|
|
3482
|
+
] }),
|
|
3483
|
+
/* @__PURE__ */ jsxs19(
|
|
3484
|
+
"div",
|
|
3485
|
+
{
|
|
3486
|
+
className: "flex-1 relative flex overflow-hidden",
|
|
3487
|
+
onDragOver: (e) => {
|
|
3488
|
+
e.preventDefault();
|
|
3489
|
+
e.dataTransfer.dropEffect = "move";
|
|
3490
|
+
},
|
|
3491
|
+
onDrop: (e) => {
|
|
3492
|
+
e.preventDefault();
|
|
3493
|
+
const raw = e.dataTransfer.getData("application/decido-node");
|
|
3494
|
+
if (!raw) return;
|
|
3495
|
+
try {
|
|
3496
|
+
const { type, label, meta } = JSON.parse(raw);
|
|
3497
|
+
const flowPos = screenToFlowPosition({ x: e.clientX, y: e.clientY });
|
|
3498
|
+
addKeyframe(currentBlueprintId || activeTimelineId, buildKeyframeDefaults(type, label, flowPos, meta));
|
|
3499
|
+
} catch (err) {
|
|
3500
|
+
console.error("[ReactFlowEditor] Drop failed:", err);
|
|
3501
|
+
}
|
|
3502
|
+
},
|
|
3503
|
+
children: [
|
|
3504
|
+
/* @__PURE__ */ jsx20(NodePalette, {}),
|
|
3505
|
+
/* @__PURE__ */ jsxs19(
|
|
3506
|
+
index,
|
|
3507
|
+
{
|
|
3508
|
+
nodes,
|
|
3509
|
+
edges,
|
|
3510
|
+
nodeTypes,
|
|
3511
|
+
onNodesChange,
|
|
3512
|
+
onEdgesChange,
|
|
3513
|
+
onEdgesDelete,
|
|
3514
|
+
onConnect,
|
|
3515
|
+
onNodeDragStop,
|
|
3516
|
+
onNodeClick,
|
|
3517
|
+
onPaneClick,
|
|
3518
|
+
onPaneContextMenu,
|
|
3519
|
+
colorMode: "dark",
|
|
3520
|
+
fitView: true,
|
|
3521
|
+
fitViewOptions: { padding: 0.2 },
|
|
3522
|
+
minZoom: 0.1,
|
|
3523
|
+
selectionOnDrag: true,
|
|
3524
|
+
panOnDrag: [1],
|
|
3525
|
+
selectionMode: SelectionMode.Partial,
|
|
3526
|
+
multiSelectionKeyCode: "Meta",
|
|
3527
|
+
deleteKeyCode: null,
|
|
3528
|
+
children: [
|
|
3529
|
+
/* @__PURE__ */ jsx20(Controls, { className: "fill-white" }),
|
|
3530
|
+
/* @__PURE__ */ jsx20(
|
|
3531
|
+
EditorToolbar,
|
|
3532
|
+
{
|
|
3533
|
+
canUndo,
|
|
3534
|
+
canRedo,
|
|
3535
|
+
undoCount: pastTimelines[activeTimelineId]?.length || 0,
|
|
3536
|
+
redoCount: futureTimelines[activeTimelineId]?.length || 0,
|
|
3537
|
+
undo,
|
|
3538
|
+
redo,
|
|
3539
|
+
nodes,
|
|
3540
|
+
edges,
|
|
3541
|
+
setNodes,
|
|
3542
|
+
updateKeyframePosition,
|
|
3543
|
+
removeKeyframe,
|
|
3544
|
+
activeTimelineId,
|
|
3545
|
+
currentBlueprintId,
|
|
3546
|
+
fitView,
|
|
3547
|
+
setSelectedNodeId
|
|
3548
|
+
}
|
|
3549
|
+
),
|
|
3550
|
+
/* @__PURE__ */ jsx20(MiniMap, { nodeStrokeColor: () => "#ffffff", nodeColor: () => "#333333", maskColor: "rgba(0, 0, 0, 0.7)" }),
|
|
3551
|
+
/* @__PURE__ */ jsx20(Background, { color: "#555", gap: 20 })
|
|
3552
|
+
]
|
|
3553
|
+
}
|
|
3554
|
+
),
|
|
3555
|
+
contextMenu && /* @__PURE__ */ jsxs19(Fragment2, { children: [
|
|
3556
|
+
/* @__PURE__ */ jsx20("div", { className: "fixed inset-0 z-998", onClick: () => setContextMenu(null) }),
|
|
3557
|
+
/* @__PURE__ */ jsx20(CanvasContextMenu, { x: contextMenu.x, y: contextMenu.y, onAdd: addNodeAt, onClose: () => setContextMenu(null) })
|
|
3558
|
+
] })
|
|
3559
|
+
]
|
|
3560
|
+
}
|
|
3561
|
+
),
|
|
3562
|
+
selectedNodeId && /* @__PURE__ */ jsx20(NodePropertiesPanel, { selectedNodeId, onClose: () => setSelectedNodeId(null) }),
|
|
3563
|
+
/* @__PURE__ */ jsx20(VariablePanel, { isOpen: isVariablePanelOpen, onToggle: () => setIsVariablePanelOpen((o) => !o) })
|
|
3564
|
+
] });
|
|
3565
|
+
};
|
|
3566
|
+
var ReactFlowEditor = (props) => /* @__PURE__ */ jsx20(ReactFlowProvider, { children: /* @__PURE__ */ jsx20(ReactFlowEditorInner, { ...props }) });
|
|
3567
|
+
export {
|
|
3568
|
+
ReactFlowEditor
|
|
3569
|
+
};
|
|
3570
|
+
/*! Bundled license information:
|
|
3571
|
+
|
|
3572
|
+
@dagrejs/dagre/dist/dagre.esm.js:
|
|
3573
|
+
(*! For license information please see dagre.esm.js.LEGAL.txt *)
|
|
3574
|
+
*/
|