@teamflojo/floimg-studio-ui 0.1.2 → 0.1.4
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/components/Toolbar.d.ts +17 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +676 -666
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import { memo as T, useRef as
|
|
3
|
-
import
|
|
4
|
-
import { create as
|
|
5
|
-
import { useQuery as
|
|
6
|
-
function
|
|
2
|
+
import { memo as T, useRef as ge, useCallback as C, useState as N, useEffect as $, useMemo as X } from "react";
|
|
3
|
+
import pe, { Handle as I, Position as L, applyNodeChanges as he, applyEdgeChanges as fe, MarkerType as be, Background as xe, Controls as ke, MiniMap as we, ReactFlowProvider as ve } from "reactflow";
|
|
4
|
+
import { create as oe } from "zustand";
|
|
5
|
+
import { useQuery as q } from "@tanstack/react-query";
|
|
6
|
+
function ye(r, s) {
|
|
7
7
|
let t;
|
|
8
8
|
try {
|
|
9
9
|
t = r();
|
|
@@ -11,48 +11,48 @@ function xe(r, n) {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
|
-
getItem: (
|
|
14
|
+
getItem: (n) => {
|
|
15
15
|
var i;
|
|
16
|
-
const l = (c) => c === null ? null : JSON.parse(c, void 0),
|
|
17
|
-
return
|
|
16
|
+
const l = (c) => c === null ? null : JSON.parse(c, void 0), a = (i = t.getItem(n)) != null ? i : null;
|
|
17
|
+
return a instanceof Promise ? a.then(l) : l(a);
|
|
18
18
|
},
|
|
19
|
-
setItem: (
|
|
20
|
-
removeItem: (
|
|
19
|
+
setItem: (n, i) => t.setItem(n, JSON.stringify(i, void 0)),
|
|
20
|
+
removeItem: (n) => t.removeItem(n)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const _ = (r) => (s) => {
|
|
24
24
|
try {
|
|
25
|
-
const t = r(
|
|
25
|
+
const t = r(s);
|
|
26
26
|
return t instanceof Promise ? t : {
|
|
27
|
-
then(
|
|
28
|
-
return
|
|
27
|
+
then(o) {
|
|
28
|
+
return _(o)(t);
|
|
29
29
|
},
|
|
30
|
-
catch(
|
|
30
|
+
catch(o) {
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
} catch (t) {
|
|
35
35
|
return {
|
|
36
|
-
then(
|
|
36
|
+
then(o) {
|
|
37
37
|
return this;
|
|
38
38
|
},
|
|
39
|
-
catch(
|
|
40
|
-
return
|
|
39
|
+
catch(o) {
|
|
40
|
+
return _(o)(t);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
},
|
|
44
|
+
}, Ne = (r, s) => (t, o, n) => {
|
|
45
45
|
let i = {
|
|
46
|
-
storage:
|
|
46
|
+
storage: ye(() => localStorage),
|
|
47
47
|
partialize: (g) => g,
|
|
48
48
|
version: 0,
|
|
49
|
-
merge: (g,
|
|
50
|
-
...
|
|
49
|
+
merge: (g, w) => ({
|
|
50
|
+
...w,
|
|
51
51
|
...g
|
|
52
52
|
}),
|
|
53
|
-
...
|
|
53
|
+
...s
|
|
54
54
|
}, l = !1;
|
|
55
|
-
const
|
|
55
|
+
const a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
56
56
|
let u = i.storage;
|
|
57
57
|
if (!u)
|
|
58
58
|
return r(
|
|
@@ -61,33 +61,33 @@ const q = (r) => (n) => {
|
|
|
61
61
|
`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`
|
|
62
62
|
), t(...g);
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
o,
|
|
65
|
+
n
|
|
66
66
|
);
|
|
67
67
|
const d = () => {
|
|
68
|
-
const g = i.partialize({ ...
|
|
68
|
+
const g = i.partialize({ ...o() });
|
|
69
69
|
return u.setItem(i.name, {
|
|
70
70
|
state: g,
|
|
71
71
|
version: i.version
|
|
72
72
|
});
|
|
73
|
-
}, p =
|
|
74
|
-
|
|
73
|
+
}, p = n.setState;
|
|
74
|
+
n.setState = (g, w) => (p(g, w), d());
|
|
75
75
|
const h = r(
|
|
76
76
|
(...g) => (t(...g), d()),
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
o,
|
|
78
|
+
n
|
|
79
79
|
);
|
|
80
|
-
|
|
81
|
-
let
|
|
80
|
+
n.getInitialState = () => h;
|
|
81
|
+
let b;
|
|
82
82
|
const x = () => {
|
|
83
|
-
var g,
|
|
83
|
+
var g, w;
|
|
84
84
|
if (!u) return;
|
|
85
|
-
l = !1,
|
|
85
|
+
l = !1, a.forEach((y) => {
|
|
86
86
|
var z;
|
|
87
|
-
return y((z =
|
|
87
|
+
return y((z = o()) != null ? z : h);
|
|
88
88
|
});
|
|
89
|
-
const
|
|
90
|
-
return
|
|
89
|
+
const k = ((w = i.onRehydrateStorage) == null ? void 0 : w.call(i, (g = o()) != null ? g : h)) || void 0;
|
|
90
|
+
return _(u.getItem.bind(u))(i.name).then((y) => {
|
|
91
91
|
if (y)
|
|
92
92
|
if (typeof y.version == "number" && y.version !== i.version) {
|
|
93
93
|
if (i.migrate) {
|
|
@@ -95,7 +95,7 @@ const q = (r) => (n) => {
|
|
|
95
95
|
y.state,
|
|
96
96
|
y.version
|
|
97
97
|
);
|
|
98
|
-
return z instanceof Promise ? z.then((
|
|
98
|
+
return z instanceof Promise ? z.then((W) => [!0, W]) : [!0, z];
|
|
99
99
|
}
|
|
100
100
|
console.error(
|
|
101
101
|
"State loaded from storage couldn't be migrated since no migrate function was provided"
|
|
@@ -105,19 +105,19 @@ const q = (r) => (n) => {
|
|
|
105
105
|
return [!1, void 0];
|
|
106
106
|
}).then((y) => {
|
|
107
107
|
var z;
|
|
108
|
-
const [
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
(z =
|
|
112
|
-
), t(
|
|
108
|
+
const [W, O] = y;
|
|
109
|
+
if (b = i.merge(
|
|
110
|
+
O,
|
|
111
|
+
(z = o()) != null ? z : h
|
|
112
|
+
), t(b, !0), W)
|
|
113
113
|
return d();
|
|
114
114
|
}).then(() => {
|
|
115
|
-
|
|
115
|
+
k == null || k(b, void 0), b = o(), l = !0, c.forEach((y) => y(b));
|
|
116
116
|
}).catch((y) => {
|
|
117
|
-
|
|
117
|
+
k == null || k(void 0, y);
|
|
118
118
|
});
|
|
119
119
|
};
|
|
120
|
-
return
|
|
120
|
+
return n.persist = {
|
|
121
121
|
setOptions: (g) => {
|
|
122
122
|
i = {
|
|
123
123
|
...i,
|
|
@@ -130,119 +130,119 @@ const q = (r) => (n) => {
|
|
|
130
130
|
getOptions: () => i,
|
|
131
131
|
rehydrate: () => x(),
|
|
132
132
|
hasHydrated: () => l,
|
|
133
|
-
onHydrate: (g) => (
|
|
134
|
-
|
|
133
|
+
onHydrate: (g) => (a.add(g), () => {
|
|
134
|
+
a.delete(g);
|
|
135
135
|
}),
|
|
136
136
|
onFinishHydration: (g) => (c.add(g), () => {
|
|
137
137
|
c.delete(g);
|
|
138
138
|
})
|
|
139
|
-
}, i.skipHydration || x(),
|
|
140
|
-
},
|
|
141
|
-
async function D(r,
|
|
139
|
+
}, i.skipHydration || x(), b || h;
|
|
140
|
+
}, ne = Ne, S = "/api";
|
|
141
|
+
async function D(r, s) {
|
|
142
142
|
const t = await fetch(r, {
|
|
143
|
-
...
|
|
143
|
+
...s,
|
|
144
144
|
headers: {
|
|
145
145
|
"Content-Type": "application/json",
|
|
146
|
-
...
|
|
146
|
+
...s == null ? void 0 : s.headers
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
if (!t.ok) {
|
|
150
|
-
const
|
|
151
|
-
throw new Error(
|
|
150
|
+
const o = await t.json().catch(() => ({ error: "Unknown error" }));
|
|
151
|
+
throw new Error(o.error || `HTTP ${t.status}`);
|
|
152
152
|
}
|
|
153
153
|
return t.json();
|
|
154
154
|
}
|
|
155
|
-
async function
|
|
156
|
-
return D(`${
|
|
155
|
+
async function ze() {
|
|
156
|
+
return D(`${S}/nodes/generators`);
|
|
157
157
|
}
|
|
158
|
-
async function
|
|
159
|
-
return D(`${
|
|
158
|
+
async function Ce() {
|
|
159
|
+
return D(`${S}/nodes/transforms`);
|
|
160
160
|
}
|
|
161
|
-
async function
|
|
162
|
-
return D(`${
|
|
161
|
+
async function Se(r, s, t) {
|
|
162
|
+
return D(`${S}/execute/sync`, {
|
|
163
163
|
method: "POST",
|
|
164
|
-
body: JSON.stringify({ nodes: r, edges:
|
|
164
|
+
body: JSON.stringify({ nodes: r, edges: s, aiProviders: t })
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
async function
|
|
168
|
-
return D(`${
|
|
167
|
+
async function Ie(r, s) {
|
|
168
|
+
return D(`${S}/export/yaml`, {
|
|
169
169
|
method: "POST",
|
|
170
|
-
body: JSON.stringify({ nodes: r, edges:
|
|
170
|
+
body: JSON.stringify({ nodes: r, edges: s })
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
async function
|
|
174
|
-
return D(`${
|
|
173
|
+
async function Le() {
|
|
174
|
+
return D(`${S}/images`);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
return `${
|
|
176
|
+
function G(r) {
|
|
177
|
+
return `${S}/images/${r}/blob`;
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
179
|
+
async function We(r) {
|
|
180
180
|
try {
|
|
181
|
-
return await D(`${
|
|
181
|
+
return await D(`${S}/images/${r}/workflow`);
|
|
182
182
|
} catch {
|
|
183
183
|
return null;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
async function
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
const t = await fetch(`${
|
|
186
|
+
async function Ae(r) {
|
|
187
|
+
const s = new FormData();
|
|
188
|
+
s.append("file", r);
|
|
189
|
+
const t = await fetch(`${S}/uploads`, {
|
|
190
190
|
method: "POST",
|
|
191
|
-
body:
|
|
191
|
+
body: s
|
|
192
192
|
});
|
|
193
193
|
if (!t.ok) {
|
|
194
|
-
const
|
|
195
|
-
throw new Error(
|
|
194
|
+
const o = await t.json().catch(() => ({ error: "Upload failed" }));
|
|
195
|
+
throw new Error(o.error || `HTTP ${t.status}`);
|
|
196
196
|
}
|
|
197
197
|
return t.json();
|
|
198
198
|
}
|
|
199
|
-
async function
|
|
200
|
-
return D(`${
|
|
199
|
+
async function $e() {
|
|
200
|
+
return D(`${S}/uploads`);
|
|
201
201
|
}
|
|
202
|
-
async function
|
|
203
|
-
const
|
|
202
|
+
async function De(r) {
|
|
203
|
+
const s = await fetch(`${S}/uploads/${r}`, {
|
|
204
204
|
method: "DELETE"
|
|
205
205
|
});
|
|
206
|
-
if (!
|
|
207
|
-
throw new Error(`Failed to delete upload: ${
|
|
206
|
+
if (!s.ok)
|
|
207
|
+
throw new Error(`Failed to delete upload: ${s.status}`);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return `${
|
|
209
|
+
function se(r) {
|
|
210
|
+
return `${S}/uploads/${r}/blob`;
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
(r,
|
|
212
|
+
const Z = "http://localhost:11434", ee = "http://localhost:1234", A = oe()(
|
|
213
|
+
ne(
|
|
214
|
+
(r, s) => ({
|
|
215
215
|
ai: {
|
|
216
216
|
ollama: {
|
|
217
|
-
baseUrl:
|
|
217
|
+
baseUrl: Z,
|
|
218
218
|
enabled: !1
|
|
219
219
|
},
|
|
220
220
|
lmstudio: {
|
|
221
|
-
baseUrl:
|
|
221
|
+
baseUrl: ee,
|
|
222
222
|
enabled: !1
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
225
|
showSettings: !1,
|
|
226
|
-
setAIProvider: (t,
|
|
227
|
-
r((
|
|
226
|
+
setAIProvider: (t, o) => {
|
|
227
|
+
r((n) => ({
|
|
228
228
|
ai: {
|
|
229
|
-
...
|
|
230
|
-
[t]:
|
|
229
|
+
...n.ai,
|
|
230
|
+
[t]: o
|
|
231
231
|
}
|
|
232
232
|
}));
|
|
233
233
|
},
|
|
234
234
|
clearAIProvider: (t) => {
|
|
235
|
-
r((
|
|
236
|
-
const
|
|
237
|
-
return delete
|
|
235
|
+
r((o) => {
|
|
236
|
+
const n = { ...o.ai };
|
|
237
|
+
return delete n[t], { ai: n };
|
|
238
238
|
});
|
|
239
239
|
},
|
|
240
240
|
openSettings: () => r({ showSettings: !0 }),
|
|
241
241
|
closeSettings: () => r({ showSettings: !1 }),
|
|
242
242
|
getConfiguredProviders: () => {
|
|
243
|
-
var
|
|
244
|
-
const { ai: t } =
|
|
245
|
-
return (
|
|
243
|
+
var n, i, l, a, c, u;
|
|
244
|
+
const { ai: t } = s(), o = {};
|
|
245
|
+
return (n = t.openai) != null && n.enabled && t.openai.apiKey && (o.openai = { apiKey: t.openai.apiKey }), (i = t.anthropic) != null && i.enabled && t.anthropic.apiKey && (o.anthropic = { apiKey: t.anthropic.apiKey }), (l = t.gemini) != null && l.enabled && t.gemini.apiKey && (o.gemini = { apiKey: t.gemini.apiKey }), (a = t.openrouter) != null && a.enabled && t.openrouter.apiKey && (o.openrouter = { apiKey: t.openrouter.apiKey }), (c = t.ollama) != null && c.enabled && (o.ollama = { baseUrl: t.ollama.baseUrl || Z }), (u = t.lmstudio) != null && u.enabled && (o.lmstudio = { baseUrl: t.lmstudio.baseUrl || ee }), o;
|
|
246
246
|
}
|
|
247
247
|
}),
|
|
248
248
|
{
|
|
@@ -252,17 +252,17 @@ const Y = "http://localhost:11434", X = "http://localhost:1234", A = re()(
|
|
|
252
252
|
}
|
|
253
253
|
)
|
|
254
254
|
);
|
|
255
|
-
let
|
|
256
|
-
function
|
|
257
|
-
return `node_${++
|
|
255
|
+
let Pe = 0;
|
|
256
|
+
function te() {
|
|
257
|
+
return `node_${++Pe}`;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
const r = Date.now(),
|
|
261
|
-
return `wf_${r}_${
|
|
259
|
+
function re() {
|
|
260
|
+
const r = Date.now(), s = Math.random().toString(36).substring(2, 8);
|
|
261
|
+
return `wf_${r}_${s}`;
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
(r,
|
|
263
|
+
const f = oe()(
|
|
264
|
+
ne(
|
|
265
|
+
(r, s) => ({
|
|
266
266
|
nodes: [],
|
|
267
267
|
edges: [],
|
|
268
268
|
selectedNodeId: null,
|
|
@@ -284,24 +284,24 @@ const b = re()(
|
|
|
284
284
|
nodeStatus: {}
|
|
285
285
|
},
|
|
286
286
|
loadTemplate: (t) => {
|
|
287
|
-
const
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
id:
|
|
287
|
+
const o = /* @__PURE__ */ new Map(), n = t.workflow.nodes.map((l) => {
|
|
288
|
+
const a = te();
|
|
289
|
+
return o.set(l.id, a), {
|
|
290
|
+
id: a,
|
|
291
291
|
type: l.type,
|
|
292
292
|
position: l.position,
|
|
293
293
|
data: l.data
|
|
294
294
|
};
|
|
295
295
|
}), i = t.workflow.edges.map((l) => {
|
|
296
|
-
const
|
|
296
|
+
const a = o.get(l.source) || l.source, c = o.get(l.target) || l.target;
|
|
297
297
|
return {
|
|
298
|
-
id: `edge_${
|
|
299
|
-
source:
|
|
298
|
+
id: `edge_${a}_${c}`,
|
|
299
|
+
source: a,
|
|
300
300
|
target: c
|
|
301
301
|
};
|
|
302
302
|
});
|
|
303
303
|
r({
|
|
304
|
-
nodes:
|
|
304
|
+
nodes: n,
|
|
305
305
|
edges: i,
|
|
306
306
|
selectedNodeId: null,
|
|
307
307
|
currentTemplateId: t.id,
|
|
@@ -332,106 +332,106 @@ const b = re()(
|
|
|
332
332
|
});
|
|
333
333
|
},
|
|
334
334
|
togglePreview: (t) => {
|
|
335
|
-
r((
|
|
335
|
+
r((o) => ({
|
|
336
336
|
previewVisible: {
|
|
337
|
-
...
|
|
338
|
-
[t]:
|
|
337
|
+
...o.previewVisible,
|
|
338
|
+
[t]: o.previewVisible[t] === !1
|
|
339
339
|
// default true, toggle
|
|
340
340
|
}
|
|
341
341
|
}));
|
|
342
342
|
},
|
|
343
343
|
setGenerators: (t) => r({ generators: t }),
|
|
344
344
|
setTransforms: (t) => r({ transforms: t }),
|
|
345
|
-
addNode: (t,
|
|
346
|
-
const
|
|
345
|
+
addNode: (t, o) => {
|
|
346
|
+
const n = te();
|
|
347
347
|
let i;
|
|
348
348
|
t.type === "generator" ? i = {
|
|
349
349
|
generatorName: t.name,
|
|
350
|
-
params:
|
|
350
|
+
params: R(t)
|
|
351
351
|
} : t.type === "transform" ? i = {
|
|
352
352
|
operation: t.name,
|
|
353
|
-
params:
|
|
353
|
+
params: R(t)
|
|
354
354
|
} : t.type === "input" ? i = {
|
|
355
355
|
uploadId: void 0,
|
|
356
356
|
filename: void 0,
|
|
357
357
|
mime: void 0
|
|
358
358
|
} : t.type === "vision" ? i = {
|
|
359
359
|
providerName: t.name,
|
|
360
|
-
params:
|
|
360
|
+
params: R(t)
|
|
361
361
|
} : t.type === "text" ? i = {
|
|
362
362
|
providerName: t.name,
|
|
363
|
-
params:
|
|
363
|
+
params: R(t)
|
|
364
364
|
} : i = {
|
|
365
365
|
destination: "./output/image.png",
|
|
366
366
|
provider: "filesystem"
|
|
367
367
|
};
|
|
368
368
|
const l = {
|
|
369
|
-
id:
|
|
369
|
+
id: n,
|
|
370
370
|
type: t.type,
|
|
371
|
-
position:
|
|
371
|
+
position: o,
|
|
372
372
|
data: i
|
|
373
373
|
};
|
|
374
|
-
r((
|
|
375
|
-
nodes: [...
|
|
374
|
+
r((a) => ({
|
|
375
|
+
nodes: [...a.nodes, l]
|
|
376
376
|
}));
|
|
377
377
|
},
|
|
378
|
-
updateNodeData: (t,
|
|
379
|
-
r((
|
|
380
|
-
nodes:
|
|
381
|
-
(i) => i.id === t ? { ...i, data: { ...i.data, ...
|
|
378
|
+
updateNodeData: (t, o) => {
|
|
379
|
+
r((n) => ({
|
|
380
|
+
nodes: n.nodes.map(
|
|
381
|
+
(i) => i.id === t ? { ...i, data: { ...i.data, ...o } } : i
|
|
382
382
|
)
|
|
383
383
|
}));
|
|
384
384
|
},
|
|
385
385
|
deleteNode: (t) => {
|
|
386
|
-
r((
|
|
387
|
-
nodes:
|
|
388
|
-
edges:
|
|
389
|
-
selectedNodeId:
|
|
386
|
+
r((o) => ({
|
|
387
|
+
nodes: o.nodes.filter((n) => n.id !== t),
|
|
388
|
+
edges: o.edges.filter((n) => n.source !== t && n.target !== t),
|
|
389
|
+
selectedNodeId: o.selectedNodeId === t ? null : o.selectedNodeId
|
|
390
390
|
}));
|
|
391
391
|
},
|
|
392
392
|
setNodes: (t) => r({ nodes: t }),
|
|
393
393
|
addEdge: (t) => {
|
|
394
394
|
if (!t.source || !t.target) return;
|
|
395
|
-
const
|
|
395
|
+
const n = {
|
|
396
396
|
id: `edge_${t.source}_${t.target}`,
|
|
397
397
|
source: t.source,
|
|
398
398
|
target: t.target
|
|
399
399
|
};
|
|
400
400
|
r((i) => ({
|
|
401
|
-
edges: [...i.edges,
|
|
401
|
+
edges: [...i.edges, n]
|
|
402
402
|
}));
|
|
403
403
|
},
|
|
404
404
|
deleteEdge: (t) => {
|
|
405
|
-
r((
|
|
406
|
-
edges:
|
|
405
|
+
r((o) => ({
|
|
406
|
+
edges: o.edges.filter((n) => n.id !== t)
|
|
407
407
|
}));
|
|
408
408
|
},
|
|
409
409
|
setEdges: (t) => r({ edges: t }),
|
|
410
410
|
setSelectedNode: (t) => r({ selectedNodeId: t }),
|
|
411
411
|
execute: async () => {
|
|
412
|
-
const { nodes: t, edges:
|
|
412
|
+
const { nodes: t, edges: o } = s(), n = t.map((c) => ({
|
|
413
413
|
id: c.id,
|
|
414
414
|
type: c.type,
|
|
415
415
|
position: c.position,
|
|
416
416
|
data: c.data
|
|
417
|
-
})), i =
|
|
417
|
+
})), i = o.map((c) => ({
|
|
418
418
|
id: c.id,
|
|
419
419
|
source: c.source,
|
|
420
420
|
target: c.target
|
|
421
|
-
})), l = A.getState().getConfiguredProviders(),
|
|
421
|
+
})), l = A.getState().getConfiguredProviders(), a = {};
|
|
422
422
|
for (const c of t)
|
|
423
|
-
|
|
423
|
+
a[c.id] = "running";
|
|
424
424
|
r({
|
|
425
425
|
execution: {
|
|
426
426
|
status: "running",
|
|
427
427
|
imageIds: [],
|
|
428
428
|
previews: {},
|
|
429
429
|
dataOutputs: {},
|
|
430
|
-
nodeStatus:
|
|
430
|
+
nodeStatus: a
|
|
431
431
|
}
|
|
432
432
|
});
|
|
433
433
|
try {
|
|
434
|
-
const c = await
|
|
434
|
+
const c = await Se(n, i, l), u = {};
|
|
435
435
|
for (const d of t)
|
|
436
436
|
u[d.id] = c.status === "completed" ? "completed" : "error";
|
|
437
437
|
c.status === "completed" ? r({
|
|
@@ -469,17 +469,17 @@ const b = re()(
|
|
|
469
469
|
}
|
|
470
470
|
},
|
|
471
471
|
exportToYaml: async () => {
|
|
472
|
-
const { nodes: t, edges:
|
|
473
|
-
id:
|
|
474
|
-
type:
|
|
475
|
-
position:
|
|
476
|
-
data:
|
|
477
|
-
})), i =
|
|
478
|
-
id:
|
|
479
|
-
source:
|
|
480
|
-
target:
|
|
472
|
+
const { nodes: t, edges: o } = s(), n = t.map((a) => ({
|
|
473
|
+
id: a.id,
|
|
474
|
+
type: a.type,
|
|
475
|
+
position: a.position,
|
|
476
|
+
data: a.data
|
|
477
|
+
})), i = o.map((a) => ({
|
|
478
|
+
id: a.id,
|
|
479
|
+
source: a.source,
|
|
480
|
+
target: a.target
|
|
481
481
|
}));
|
|
482
|
-
return (await
|
|
482
|
+
return (await Ie(n, i)).yaml;
|
|
483
483
|
},
|
|
484
484
|
// Workflow persistence methods
|
|
485
485
|
markDirty: () => r({ hasUnsavedChanges: !0 }),
|
|
@@ -506,16 +506,16 @@ const b = re()(
|
|
|
506
506
|
},
|
|
507
507
|
saveWorkflow: (t) => {
|
|
508
508
|
const {
|
|
509
|
-
nodes:
|
|
510
|
-
edges:
|
|
509
|
+
nodes: o,
|
|
510
|
+
edges: n,
|
|
511
511
|
activeWorkflowId: i,
|
|
512
512
|
activeWorkflowName: l,
|
|
513
|
-
savedWorkflows:
|
|
513
|
+
savedWorkflows: a,
|
|
514
514
|
currentTemplateId: c
|
|
515
|
-
} =
|
|
515
|
+
} = s(), u = Date.now();
|
|
516
516
|
if (i) {
|
|
517
|
-
const d =
|
|
518
|
-
(p) => p.id === i ? { ...p, name: t || l, nodes:
|
|
517
|
+
const d = a.map(
|
|
518
|
+
(p) => p.id === i ? { ...p, name: t || l, nodes: o, edges: n, updatedAt: u } : p
|
|
519
519
|
);
|
|
520
520
|
return r({
|
|
521
521
|
savedWorkflows: d,
|
|
@@ -523,17 +523,17 @@ const b = re()(
|
|
|
523
523
|
hasUnsavedChanges: !1
|
|
524
524
|
}), i;
|
|
525
525
|
} else {
|
|
526
|
-
const d =
|
|
526
|
+
const d = re(), p = {
|
|
527
527
|
id: d,
|
|
528
528
|
name: t || l,
|
|
529
|
-
nodes:
|
|
530
|
-
edges:
|
|
529
|
+
nodes: o,
|
|
530
|
+
edges: n,
|
|
531
531
|
createdAt: u,
|
|
532
532
|
updatedAt: u,
|
|
533
533
|
templateId: c || void 0
|
|
534
534
|
};
|
|
535
535
|
return r({
|
|
536
|
-
savedWorkflows: [...
|
|
536
|
+
savedWorkflows: [...a, p],
|
|
537
537
|
activeWorkflowId: d,
|
|
538
538
|
activeWorkflowName: t || l,
|
|
539
539
|
hasUnsavedChanges: !1
|
|
@@ -541,15 +541,15 @@ const b = re()(
|
|
|
541
541
|
}
|
|
542
542
|
},
|
|
543
543
|
loadWorkflow: (t) => {
|
|
544
|
-
const { savedWorkflows:
|
|
545
|
-
|
|
546
|
-
nodes:
|
|
547
|
-
edges:
|
|
544
|
+
const { savedWorkflows: o } = s(), n = o.find((i) => i.id === t);
|
|
545
|
+
n && r({
|
|
546
|
+
nodes: n.nodes,
|
|
547
|
+
edges: n.edges,
|
|
548
548
|
selectedNodeId: null,
|
|
549
|
-
currentTemplateId:
|
|
549
|
+
currentTemplateId: n.templateId || null,
|
|
550
550
|
previewVisible: {},
|
|
551
551
|
activeWorkflowId: t,
|
|
552
|
-
activeWorkflowName:
|
|
552
|
+
activeWorkflowName: n.name,
|
|
553
553
|
hasUnsavedChanges: !1,
|
|
554
554
|
execution: {
|
|
555
555
|
status: "idle",
|
|
@@ -561,8 +561,8 @@ const b = re()(
|
|
|
561
561
|
});
|
|
562
562
|
},
|
|
563
563
|
deleteWorkflow: (t) => {
|
|
564
|
-
const { savedWorkflows:
|
|
565
|
-
r(
|
|
564
|
+
const { savedWorkflows: o, activeWorkflowId: n } = s(), i = o.filter((l) => l.id !== t);
|
|
565
|
+
r(n === t ? {
|
|
566
566
|
savedWorkflows: i,
|
|
567
567
|
nodes: [],
|
|
568
568
|
edges: [],
|
|
@@ -581,26 +581,26 @@ const b = re()(
|
|
|
581
581
|
}
|
|
582
582
|
} : { savedWorkflows: i });
|
|
583
583
|
},
|
|
584
|
-
renameWorkflow: (t,
|
|
585
|
-
const { savedWorkflows:
|
|
586
|
-
(
|
|
584
|
+
renameWorkflow: (t, o) => {
|
|
585
|
+
const { savedWorkflows: n, activeWorkflowId: i } = s(), l = n.map(
|
|
586
|
+
(a) => a.id === t ? { ...a, name: o, updatedAt: Date.now() } : a
|
|
587
587
|
);
|
|
588
588
|
r({
|
|
589
589
|
savedWorkflows: l,
|
|
590
|
-
...i === t ? { activeWorkflowName:
|
|
590
|
+
...i === t ? { activeWorkflowName: o } : {}
|
|
591
591
|
});
|
|
592
592
|
},
|
|
593
593
|
duplicateWorkflow: (t) => {
|
|
594
|
-
const { savedWorkflows:
|
|
595
|
-
if (!
|
|
596
|
-
const i = Date.now(), l =
|
|
597
|
-
...
|
|
594
|
+
const { savedWorkflows: o } = s(), n = o.find((c) => c.id === t);
|
|
595
|
+
if (!n) return "";
|
|
596
|
+
const i = Date.now(), l = re(), a = {
|
|
597
|
+
...n,
|
|
598
598
|
id: l,
|
|
599
|
-
name: `${
|
|
599
|
+
name: `${n.name} (Copy)`,
|
|
600
600
|
createdAt: i,
|
|
601
601
|
updatedAt: i
|
|
602
602
|
};
|
|
603
|
-
return r({ savedWorkflows: [...
|
|
603
|
+
return r({ savedWorkflows: [...o, a] }), l;
|
|
604
604
|
}
|
|
605
605
|
}),
|
|
606
606
|
{
|
|
@@ -612,28 +612,28 @@ const b = re()(
|
|
|
612
612
|
}
|
|
613
613
|
)
|
|
614
614
|
);
|
|
615
|
-
function
|
|
615
|
+
function R(r) {
|
|
616
616
|
var t;
|
|
617
|
-
const
|
|
617
|
+
const s = {};
|
|
618
618
|
if ((t = r.params) != null && t.properties)
|
|
619
|
-
for (const [
|
|
620
|
-
|
|
621
|
-
return
|
|
619
|
+
for (const [o, n] of Object.entries(r.params.properties))
|
|
620
|
+
n.default !== void 0 && (s[o] = n.default);
|
|
621
|
+
return s;
|
|
622
622
|
}
|
|
623
623
|
function M(r) {
|
|
624
624
|
return r === "running" ? "border-yellow-400 animate-pulse" : r === "completed" ? "border-green-500" : r === "error" ? "border-red-500" : "";
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
const t =
|
|
626
|
+
function H({ nodeId: r, color: s }) {
|
|
627
|
+
const t = f((n) => n.previewVisible[r] !== !1), o = f((n) => n.togglePreview);
|
|
628
628
|
return /* @__PURE__ */ e(
|
|
629
629
|
"button",
|
|
630
630
|
{
|
|
631
|
-
onClick: (
|
|
632
|
-
|
|
631
|
+
onClick: (n) => {
|
|
632
|
+
n.stopPropagation(), o(r);
|
|
633
633
|
},
|
|
634
634
|
className: `ml-auto p-1 rounded hover:bg-gray-200 dark:hover:bg-zinc-600 transition-colors ${t ? "opacity-100" : "opacity-40"}`,
|
|
635
635
|
title: t ? "Hide preview" : "Show preview",
|
|
636
|
-
children: /* @__PURE__ */ e("svg", { className: `w-3.5 h-3.5 ${
|
|
636
|
+
children: /* @__PURE__ */ e("svg", { className: `w-3.5 h-3.5 ${s}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: t ? /* @__PURE__ */ e(
|
|
637
637
|
"path",
|
|
638
638
|
{
|
|
639
639
|
strokeLinecap: "round",
|
|
@@ -653,23 +653,23 @@ function _({ nodeId: r, color: n }) {
|
|
|
653
653
|
}
|
|
654
654
|
);
|
|
655
655
|
}
|
|
656
|
-
const
|
|
657
|
-
id:
|
|
656
|
+
const je = T(function({
|
|
657
|
+
id: s,
|
|
658
658
|
data: t,
|
|
659
|
-
selected:
|
|
659
|
+
selected: o
|
|
660
660
|
}) {
|
|
661
|
-
const
|
|
661
|
+
const n = f((u) => u.execution.previews[s]), i = f((u) => u.execution.nodeStatus[s]), l = f((u) => u.previewVisible[s] !== !1), c = M(i) || (o ? "border-blue-500" : "border-blue-200");
|
|
662
662
|
return /* @__PURE__ */ m(
|
|
663
663
|
"div",
|
|
664
664
|
{
|
|
665
665
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${c}`,
|
|
666
666
|
children: [
|
|
667
|
-
|
|
667
|
+
n && l && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: n, alt: "Preview", className: "w-full h-24 object-contain" }) }),
|
|
668
668
|
/* @__PURE__ */ m("div", { className: "px-4 py-3", children: [
|
|
669
669
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
670
670
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-blue-500" }),
|
|
671
671
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-blue-700 dark:text-blue-400", children: t.generatorName }),
|
|
672
|
-
/* @__PURE__ */ e(
|
|
672
|
+
/* @__PURE__ */ e(H, { nodeId: s, color: "text-blue-500 dark:text-blue-400" })
|
|
673
673
|
] }),
|
|
674
674
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).slice(0, 2).map(([u, d]) => /* @__PURE__ */ m("div", { className: "truncate", children: [
|
|
675
675
|
u,
|
|
@@ -677,28 +677,28 @@ const Ae = T(function({
|
|
|
677
677
|
String(d).slice(0, 20)
|
|
678
678
|
] }, u)) })
|
|
679
679
|
] }),
|
|
680
|
-
/* @__PURE__ */ e(
|
|
680
|
+
/* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-blue-500" })
|
|
681
681
|
]
|
|
682
682
|
}
|
|
683
683
|
);
|
|
684
|
-
}),
|
|
685
|
-
id:
|
|
684
|
+
}), Te = T(function({
|
|
685
|
+
id: s,
|
|
686
686
|
data: t,
|
|
687
|
-
selected:
|
|
687
|
+
selected: o
|
|
688
688
|
}) {
|
|
689
|
-
const
|
|
689
|
+
const n = f((u) => u.execution.previews[s]), i = f((u) => u.execution.nodeStatus[s]), l = f((u) => u.previewVisible[s] !== !1), c = M(i) || (o ? "border-teal-500" : "border-teal-200");
|
|
690
690
|
return /* @__PURE__ */ m(
|
|
691
691
|
"div",
|
|
692
692
|
{
|
|
693
693
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${c}`,
|
|
694
694
|
children: [
|
|
695
|
-
/* @__PURE__ */ e(
|
|
696
|
-
|
|
695
|
+
/* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-teal-500" }),
|
|
696
|
+
n && l && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: n, alt: "Preview", className: "w-full h-24 object-contain" }) }),
|
|
697
697
|
/* @__PURE__ */ m("div", { className: "px-4 py-3", children: [
|
|
698
698
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
699
699
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-teal-500" }),
|
|
700
700
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-teal-700 dark:text-teal-400", children: t.operation }),
|
|
701
|
-
/* @__PURE__ */ e(
|
|
701
|
+
/* @__PURE__ */ e(H, { nodeId: s, color: "text-teal-500 dark:text-teal-400" })
|
|
702
702
|
] }),
|
|
703
703
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).slice(0, 2).map(([u, d]) => /* @__PURE__ */ m("div", { className: "truncate", children: [
|
|
704
704
|
u,
|
|
@@ -706,18 +706,18 @@ const Ae = T(function({
|
|
|
706
706
|
String(d).slice(0, 20)
|
|
707
707
|
] }, u)) })
|
|
708
708
|
] }),
|
|
709
|
-
/* @__PURE__ */ e(
|
|
709
|
+
/* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-teal-500" })
|
|
710
710
|
]
|
|
711
711
|
}
|
|
712
712
|
);
|
|
713
|
-
}),
|
|
714
|
-
const
|
|
713
|
+
}), Me = T(function({ id: s, data: t, selected: o }) {
|
|
714
|
+
const n = f((a) => a.execution.nodeStatus[s]), l = M(n) || (o ? "border-green-500" : "border-green-200");
|
|
715
715
|
return /* @__PURE__ */ m(
|
|
716
716
|
"div",
|
|
717
717
|
{
|
|
718
718
|
className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${l}`,
|
|
719
719
|
children: [
|
|
720
|
-
/* @__PURE__ */ e(
|
|
720
|
+
/* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-green-500" }),
|
|
721
721
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
722
722
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-green-500" }),
|
|
723
723
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-green-700 dark:text-green-400", children: "Save" })
|
|
@@ -726,52 +726,52 @@ const Ae = T(function({
|
|
|
726
726
|
]
|
|
727
727
|
}
|
|
728
728
|
);
|
|
729
|
-
}),
|
|
730
|
-
const
|
|
731
|
-
async (
|
|
729
|
+
}), Ue = T(function({ id: s, data: t, selected: o }) {
|
|
730
|
+
const n = f((w) => w.execution.previews[s]), i = f((w) => w.execution.nodeStatus[s]), l = f((w) => w.previewVisible[s] !== !1), a = f((w) => w.updateNodeData), c = ge(null), d = M(i) || (o ? "border-amber-500" : "border-amber-200"), p = C(
|
|
731
|
+
async (w) => {
|
|
732
732
|
try {
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
uploadId:
|
|
736
|
-
filename:
|
|
737
|
-
mime:
|
|
733
|
+
const k = await Ae(w);
|
|
734
|
+
a(s, {
|
|
735
|
+
uploadId: k.id,
|
|
736
|
+
filename: k.filename,
|
|
737
|
+
mime: k.mime
|
|
738
738
|
});
|
|
739
|
-
} catch (
|
|
740
|
-
console.error("Upload failed:",
|
|
739
|
+
} catch (k) {
|
|
740
|
+
console.error("Upload failed:", k);
|
|
741
741
|
}
|
|
742
742
|
},
|
|
743
|
-
[
|
|
743
|
+
[s, a]
|
|
744
744
|
), h = C(
|
|
745
|
-
(
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
|
|
745
|
+
(w) => {
|
|
746
|
+
w.preventDefault(), w.stopPropagation();
|
|
747
|
+
const k = w.dataTransfer.files[0];
|
|
748
|
+
k && k.type.startsWith("image/") && p(k);
|
|
749
749
|
},
|
|
750
750
|
[p]
|
|
751
|
-
),
|
|
752
|
-
|
|
751
|
+
), b = C((w) => {
|
|
752
|
+
w.preventDefault(), w.stopPropagation();
|
|
753
753
|
}, []), x = C(
|
|
754
|
-
(
|
|
754
|
+
(w) => {
|
|
755
755
|
var y;
|
|
756
|
-
const
|
|
757
|
-
|
|
756
|
+
const k = (y = w.target.files) == null ? void 0 : y[0];
|
|
757
|
+
k && p(k);
|
|
758
758
|
},
|
|
759
759
|
[p]
|
|
760
|
-
), g =
|
|
760
|
+
), g = n || (t.uploadId ? se(t.uploadId) : null);
|
|
761
761
|
return /* @__PURE__ */ m(
|
|
762
762
|
"div",
|
|
763
763
|
{
|
|
764
764
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${d}`,
|
|
765
765
|
onDrop: h,
|
|
766
|
-
onDragOver:
|
|
766
|
+
onDragOver: b,
|
|
767
767
|
children: [
|
|
768
768
|
g && l ? /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: g, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : g ? null : /* @__PURE__ */ e(
|
|
769
769
|
"div",
|
|
770
770
|
{
|
|
771
771
|
className: "bg-amber-50 dark:bg-amber-900/30 border-b border-amber-100 dark:border-amber-800 h-24 flex items-center justify-center cursor-pointer hover:bg-amber-100 dark:hover:bg-amber-900/50 transition-colors",
|
|
772
772
|
onClick: () => {
|
|
773
|
-
var
|
|
774
|
-
return (
|
|
773
|
+
var w;
|
|
774
|
+
return (w = c.current) == null ? void 0 : w.click();
|
|
775
775
|
},
|
|
776
776
|
children: /* @__PURE__ */ m("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
|
|
777
777
|
/* @__PURE__ */ e("div", { className: "text-2xl mb-1", children: "+" }),
|
|
@@ -793,30 +793,30 @@ const Ae = T(function({
|
|
|
793
793
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
794
794
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-amber-500" }),
|
|
795
795
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-amber-700 dark:text-amber-400", children: "Input" }),
|
|
796
|
-
/* @__PURE__ */ e(
|
|
796
|
+
/* @__PURE__ */ e(H, { nodeId: s, color: "text-amber-500 dark:text-amber-400" })
|
|
797
797
|
] }),
|
|
798
798
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: t.filename || "No image selected" })
|
|
799
799
|
] }),
|
|
800
|
-
/* @__PURE__ */ e(
|
|
800
|
+
/* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-amber-500" })
|
|
801
801
|
]
|
|
802
802
|
}
|
|
803
803
|
);
|
|
804
|
-
}),
|
|
805
|
-
id:
|
|
804
|
+
}), Ee = T(function({
|
|
805
|
+
id: s,
|
|
806
806
|
data: t,
|
|
807
|
-
selected:
|
|
807
|
+
selected: o
|
|
808
808
|
}) {
|
|
809
809
|
var c, u;
|
|
810
|
-
const
|
|
810
|
+
const n = f((d) => d.execution.nodeStatus[s]), i = f((d) => {
|
|
811
811
|
var p;
|
|
812
|
-
return (p = d.execution.dataOutputs) == null ? void 0 : p[
|
|
813
|
-
}),
|
|
812
|
+
return (p = d.execution.dataOutputs) == null ? void 0 : p[s];
|
|
813
|
+
}), a = M(n) || (o ? "border-cyan-500" : "border-cyan-200");
|
|
814
814
|
return /* @__PURE__ */ m(
|
|
815
815
|
"div",
|
|
816
816
|
{
|
|
817
|
-
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${
|
|
817
|
+
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
|
|
818
818
|
children: [
|
|
819
|
-
/* @__PURE__ */ e(
|
|
819
|
+
/* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-cyan-500" }),
|
|
820
820
|
i && /* @__PURE__ */ e("div", { className: "bg-cyan-50 dark:bg-cyan-900/30 border-b border-cyan-100 dark:border-cyan-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ m("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
|
|
821
821
|
(c = i.content) == null ? void 0 : c.slice(0, 200),
|
|
822
822
|
(((u = i.content) == null ? void 0 : u.length) || 0) > 200 && "..."
|
|
@@ -841,22 +841,22 @@ const Ae = T(function({
|
|
|
841
841
|
"..."
|
|
842
842
|
] }) : null })
|
|
843
843
|
] }),
|
|
844
|
-
/* @__PURE__ */ e(
|
|
844
|
+
/* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-cyan-500" })
|
|
845
845
|
]
|
|
846
846
|
}
|
|
847
847
|
);
|
|
848
|
-
}),
|
|
848
|
+
}), Oe = T(function({ id: s, data: t, selected: o }) {
|
|
849
849
|
var c, u;
|
|
850
|
-
const
|
|
850
|
+
const n = f((d) => d.execution.nodeStatus[s]), i = f((d) => {
|
|
851
851
|
var p;
|
|
852
|
-
return (p = d.execution.dataOutputs) == null ? void 0 : p[
|
|
853
|
-
}),
|
|
852
|
+
return (p = d.execution.dataOutputs) == null ? void 0 : p[s];
|
|
853
|
+
}), a = M(n) || (o ? "border-pink-500" : "border-pink-200");
|
|
854
854
|
return /* @__PURE__ */ m(
|
|
855
855
|
"div",
|
|
856
856
|
{
|
|
857
|
-
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${
|
|
857
|
+
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
|
|
858
858
|
children: [
|
|
859
|
-
/* @__PURE__ */ e(
|
|
859
|
+
/* @__PURE__ */ e(I, { type: "target", position: L.Left, className: "w-3 h-3 !bg-pink-500" }),
|
|
860
860
|
i && /* @__PURE__ */ e("div", { className: "bg-pink-50 dark:bg-pink-900/30 border-b border-pink-100 dark:border-pink-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ m("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
|
|
861
861
|
(c = i.content) == null ? void 0 : c.slice(0, 200),
|
|
862
862
|
(((u = i.content) == null ? void 0 : u.length) || 0) > 200 && "..."
|
|
@@ -878,22 +878,22 @@ const Ae = T(function({
|
|
|
878
878
|
"..."
|
|
879
879
|
] }) : null })
|
|
880
880
|
] }),
|
|
881
|
-
/* @__PURE__ */ e(
|
|
881
|
+
/* @__PURE__ */ e(I, { type: "source", position: L.Right, className: "w-3 h-3 !bg-pink-500" })
|
|
882
882
|
]
|
|
883
883
|
}
|
|
884
884
|
);
|
|
885
|
-
}),
|
|
886
|
-
generator:
|
|
887
|
-
transform:
|
|
888
|
-
save:
|
|
889
|
-
input:
|
|
890
|
-
vision:
|
|
891
|
-
text:
|
|
892
|
-
},
|
|
885
|
+
}), Be = {
|
|
886
|
+
generator: je,
|
|
887
|
+
transform: Te,
|
|
888
|
+
save: Me,
|
|
889
|
+
input: Ue,
|
|
890
|
+
vision: Ee,
|
|
891
|
+
text: Oe
|
|
892
|
+
}, Re = {
|
|
893
893
|
type: "smoothstep",
|
|
894
894
|
animated: !1,
|
|
895
895
|
markerEnd: {
|
|
896
|
-
type:
|
|
896
|
+
type: be.ArrowClosed,
|
|
897
897
|
color: "#64748b",
|
|
898
898
|
width: 20,
|
|
899
899
|
height: 20
|
|
@@ -903,96 +903,97 @@ const Ae = T(function({
|
|
|
903
903
|
strokeWidth: 2
|
|
904
904
|
}
|
|
905
905
|
};
|
|
906
|
-
function
|
|
907
|
-
const r =
|
|
906
|
+
function Ge() {
|
|
907
|
+
const r = f((h) => h.nodes), s = f((h) => h.edges), t = f((h) => h.setNodes), o = f((h) => h.setEdges), n = f((h) => h.addEdge), i = f((h) => h.setSelectedNode), l = C(
|
|
908
908
|
(h) => {
|
|
909
|
-
const { source:
|
|
910
|
-
if (!
|
|
911
|
-
const g = r.find((y) => y.id ===
|
|
912
|
-
return !(!g || !
|
|
909
|
+
const { source: b, target: x } = h;
|
|
910
|
+
if (!b || !x) return !1;
|
|
911
|
+
const g = r.find((y) => y.id === b), w = r.find((y) => y.id === x);
|
|
912
|
+
return !(!g || !w || g.type === "save" || w.type === "generator" || w.type === "input" || s.find((y) => y.target === x) || b === x);
|
|
913
913
|
},
|
|
914
|
-
[r,
|
|
915
|
-
),
|
|
914
|
+
[r, s]
|
|
915
|
+
), a = C(
|
|
916
916
|
(h) => {
|
|
917
|
-
t(
|
|
917
|
+
t(he(h, r));
|
|
918
918
|
},
|
|
919
919
|
[r, t]
|
|
920
920
|
), c = C(
|
|
921
921
|
(h) => {
|
|
922
|
-
|
|
922
|
+
o(fe(h, s));
|
|
923
923
|
},
|
|
924
|
-
[
|
|
924
|
+
[s, o]
|
|
925
925
|
), u = C(
|
|
926
926
|
(h) => {
|
|
927
|
-
|
|
927
|
+
n(h);
|
|
928
928
|
},
|
|
929
|
-
[
|
|
929
|
+
[n]
|
|
930
930
|
), d = C(
|
|
931
|
-
(h,
|
|
932
|
-
i(
|
|
931
|
+
(h, b) => {
|
|
932
|
+
i(b.id);
|
|
933
933
|
},
|
|
934
934
|
[i]
|
|
935
935
|
), p = C(() => {
|
|
936
936
|
i(null);
|
|
937
937
|
}, [i]);
|
|
938
938
|
return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ m(
|
|
939
|
-
|
|
939
|
+
pe,
|
|
940
940
|
{
|
|
941
941
|
nodes: r,
|
|
942
|
-
edges:
|
|
943
|
-
onNodesChange:
|
|
942
|
+
edges: s,
|
|
943
|
+
onNodesChange: a,
|
|
944
944
|
onEdgesChange: c,
|
|
945
945
|
onConnect: u,
|
|
946
946
|
onNodeClick: d,
|
|
947
947
|
onPaneClick: p,
|
|
948
|
-
nodeTypes:
|
|
949
|
-
defaultEdgeOptions:
|
|
948
|
+
nodeTypes: Be,
|
|
949
|
+
defaultEdgeOptions: Re,
|
|
950
950
|
isValidConnection: l,
|
|
951
|
+
proOptions: { hideAttribution: !0 },
|
|
951
952
|
fitView: !0,
|
|
952
953
|
snapToGrid: !0,
|
|
953
954
|
snapGrid: [15, 15],
|
|
954
955
|
children: [
|
|
955
|
-
/* @__PURE__ */ e(
|
|
956
|
-
/* @__PURE__ */ e(
|
|
957
|
-
/* @__PURE__ */ e(
|
|
956
|
+
/* @__PURE__ */ e(xe, {}),
|
|
957
|
+
/* @__PURE__ */ e(ke, {}),
|
|
958
|
+
/* @__PURE__ */ e(we, { nodeStrokeWidth: 3, zoomable: !0, pannable: !0 })
|
|
958
959
|
]
|
|
959
960
|
}
|
|
960
961
|
) });
|
|
961
962
|
}
|
|
962
|
-
function
|
|
963
|
-
const [
|
|
963
|
+
function Fe({ onSelect: r }) {
|
|
964
|
+
const [s, t] = N([]), [o, n] = N(!0), [i, l] = N(null), a = async () => {
|
|
964
965
|
try {
|
|
965
|
-
|
|
966
|
-
const d = await
|
|
966
|
+
n(!0);
|
|
967
|
+
const d = await $e();
|
|
967
968
|
t(d), l(null);
|
|
968
969
|
} catch (d) {
|
|
969
970
|
l(d instanceof Error ? d.message : "Failed to load uploads");
|
|
970
971
|
} finally {
|
|
971
|
-
|
|
972
|
+
n(!1);
|
|
972
973
|
}
|
|
973
974
|
};
|
|
974
975
|
$(() => {
|
|
975
|
-
|
|
976
|
+
a();
|
|
976
977
|
}, []);
|
|
977
978
|
const c = async (d, p) => {
|
|
978
979
|
if (p.stopPropagation(), !!confirm("Delete this upload?"))
|
|
979
980
|
try {
|
|
980
|
-
await
|
|
981
|
+
await De(d), t((h) => h.filter((b) => b.id !== d));
|
|
981
982
|
} catch (h) {
|
|
982
983
|
console.error("Failed to delete:", h);
|
|
983
984
|
}
|
|
984
985
|
}, u = (d) => d < 1024 ? `${d} B` : d < 1024 * 1024 ? `${(d / 1024).toFixed(1)} KB` : `${(d / (1024 * 1024)).toFixed(1)} MB`;
|
|
985
|
-
return
|
|
986
|
+
return o ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "Loading uploads..." }) : i ? /* @__PURE__ */ m("div", { className: "p-4 text-center text-red-500 dark:text-red-400", children: [
|
|
986
987
|
i,
|
|
987
988
|
/* @__PURE__ */ e(
|
|
988
989
|
"button",
|
|
989
990
|
{
|
|
990
|
-
onClick:
|
|
991
|
+
onClick: a,
|
|
991
992
|
className: "ml-2 text-teal-500 dark:text-teal-400 hover:underline",
|
|
992
993
|
children: "Retry"
|
|
993
994
|
}
|
|
994
995
|
)
|
|
995
|
-
] }) :
|
|
996
|
+
] }) : s.length === 0 ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "No uploads yet. Drag an image onto an Input node to upload." }) : /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children: s.map((d) => /* @__PURE__ */ m(
|
|
996
997
|
"div",
|
|
997
998
|
{
|
|
998
999
|
className: "relative group rounded border border-gray-200 dark:border-zinc-700 overflow-hidden cursor-pointer hover:border-amber-400 dark:hover:border-amber-500 transition-colors",
|
|
@@ -1001,7 +1002,7 @@ function Oe({ onSelect: r }) {
|
|
|
1001
1002
|
/* @__PURE__ */ e(
|
|
1002
1003
|
"img",
|
|
1003
1004
|
{
|
|
1004
|
-
src:
|
|
1005
|
+
src: se(d.id),
|
|
1005
1006
|
alt: d.filename,
|
|
1006
1007
|
className: "w-full h-20 object-cover"
|
|
1007
1008
|
}
|
|
@@ -1021,23 +1022,23 @@ function Oe({ onSelect: r }) {
|
|
|
1021
1022
|
d.id
|
|
1022
1023
|
)) }) });
|
|
1023
1024
|
}
|
|
1024
|
-
function
|
|
1025
|
-
const r =
|
|
1025
|
+
function Ve() {
|
|
1026
|
+
const r = f((g) => g.setGenerators), s = f((g) => g.setTransforms), t = f((g) => g.generators), o = f((g) => g.transforms), n = f((g) => g.addNode), [i, l] = N(!1), { data: a } = q({
|
|
1026
1027
|
queryKey: ["generators"],
|
|
1027
|
-
queryFn:
|
|
1028
|
-
}), { data: c } =
|
|
1028
|
+
queryFn: ze
|
|
1029
|
+
}), { data: c } = q({
|
|
1029
1030
|
queryKey: ["transforms"],
|
|
1030
|
-
queryFn:
|
|
1031
|
+
queryFn: Ce
|
|
1031
1032
|
});
|
|
1032
1033
|
$(() => {
|
|
1033
|
-
|
|
1034
|
-
}, [
|
|
1035
|
-
c &&
|
|
1036
|
-
}, [c,
|
|
1037
|
-
const u = (g,
|
|
1038
|
-
g.dataTransfer.setData("application/json", JSON.stringify(
|
|
1034
|
+
a && r(a);
|
|
1035
|
+
}, [a, r]), $(() => {
|
|
1036
|
+
c && s(c);
|
|
1037
|
+
}, [c, s]);
|
|
1038
|
+
const u = (g, w) => {
|
|
1039
|
+
g.dataTransfer.setData("application/json", JSON.stringify(w)), g.dataTransfer.effectAllowed = "move";
|
|
1039
1040
|
}, d = (g) => {
|
|
1040
|
-
|
|
1041
|
+
n(g, { x: 250, y: 150 + Math.random() * 100 });
|
|
1041
1042
|
}, p = {
|
|
1042
1043
|
id: "input:upload",
|
|
1043
1044
|
type: "input",
|
|
@@ -1066,16 +1067,16 @@ function Be() {
|
|
|
1066
1067
|
}
|
|
1067
1068
|
}
|
|
1068
1069
|
}
|
|
1069
|
-
},
|
|
1070
|
-
(g,
|
|
1071
|
-
const
|
|
1072
|
-
return g[
|
|
1070
|
+
}, b = t.reduce(
|
|
1071
|
+
(g, w) => {
|
|
1072
|
+
const k = w.category || "Other";
|
|
1073
|
+
return g[k] || (g[k] = []), g[k].push(w), g;
|
|
1073
1074
|
},
|
|
1074
1075
|
{}
|
|
1075
|
-
), x =
|
|
1076
|
-
(g,
|
|
1077
|
-
const
|
|
1078
|
-
return g[
|
|
1076
|
+
), x = o.reduce(
|
|
1077
|
+
(g, w) => {
|
|
1078
|
+
const k = w.category || "Other";
|
|
1079
|
+
return g[k] || (g[k] = []), g[k].push(w), g;
|
|
1079
1080
|
},
|
|
1080
1081
|
{}
|
|
1081
1082
|
);
|
|
@@ -1109,45 +1110,45 @@ function Be() {
|
|
|
1109
1110
|
]
|
|
1110
1111
|
}
|
|
1111
1112
|
),
|
|
1112
|
-
i && /* @__PURE__ */ e("div", { className: "mt-2 border border-amber-200 dark:border-amber-700 rounded bg-white dark:bg-zinc-900 max-h-64 overflow-y-auto", children: /* @__PURE__ */ e(
|
|
1113
|
+
i && /* @__PURE__ */ e("div", { className: "mt-2 border border-amber-200 dark:border-amber-700 rounded bg-white dark:bg-zinc-900 max-h-64 overflow-y-auto", children: /* @__PURE__ */ e(Fe, {}) })
|
|
1113
1114
|
] }),
|
|
1114
1115
|
/* @__PURE__ */ m("div", { className: "mb-6", children: [
|
|
1115
1116
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide mb-2", children: "Generators" }),
|
|
1116
|
-
Object.entries(
|
|
1117
|
+
Object.entries(b).map(([g, w]) => /* @__PURE__ */ m("div", { className: "mb-3", children: [
|
|
1117
1118
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: g }),
|
|
1118
|
-
|
|
1119
|
+
w.map((k) => /* @__PURE__ */ m(
|
|
1119
1120
|
"div",
|
|
1120
1121
|
{
|
|
1121
1122
|
draggable: !0,
|
|
1122
|
-
onDragStart: (y) => u(y,
|
|
1123
|
-
onDoubleClick: () => d(
|
|
1123
|
+
onDragStart: (y) => u(y, k),
|
|
1124
|
+
onDoubleClick: () => d(k),
|
|
1124
1125
|
className: "px-3 py-2 bg-blue-50 dark:bg-blue-900/30 border border-blue-200 dark:border-blue-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors",
|
|
1125
1126
|
children: [
|
|
1126
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children:
|
|
1127
|
-
|
|
1127
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children: k.label }),
|
|
1128
|
+
k.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: k.description })
|
|
1128
1129
|
]
|
|
1129
1130
|
},
|
|
1130
|
-
|
|
1131
|
+
k.id
|
|
1131
1132
|
))
|
|
1132
1133
|
] }, g))
|
|
1133
1134
|
] }),
|
|
1134
1135
|
/* @__PURE__ */ m("div", { className: "mb-6", children: [
|
|
1135
1136
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-teal-600 dark:text-teal-400 uppercase tracking-wide mb-2", children: "Transforms" }),
|
|
1136
|
-
Object.entries(x).map(([g,
|
|
1137
|
+
Object.entries(x).map(([g, w]) => /* @__PURE__ */ m("div", { className: "mb-3", children: [
|
|
1137
1138
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: g }),
|
|
1138
|
-
|
|
1139
|
+
w.map((k) => /* @__PURE__ */ m(
|
|
1139
1140
|
"div",
|
|
1140
1141
|
{
|
|
1141
1142
|
draggable: !0,
|
|
1142
|
-
onDragStart: (y) => u(y,
|
|
1143
|
-
onDoubleClick: () => d(
|
|
1143
|
+
onDragStart: (y) => u(y, k),
|
|
1144
|
+
onDoubleClick: () => d(k),
|
|
1144
1145
|
className: "px-3 py-2 bg-teal-50 dark:bg-teal-900/30 border border-teal-200 dark:border-teal-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-teal-100 dark:hover:bg-teal-900/50 transition-colors",
|
|
1145
1146
|
children: [
|
|
1146
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children:
|
|
1147
|
-
|
|
1147
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children: k.label }),
|
|
1148
|
+
k.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: k.description })
|
|
1148
1149
|
]
|
|
1149
1150
|
},
|
|
1150
|
-
|
|
1151
|
+
k.id
|
|
1151
1152
|
))
|
|
1152
1153
|
] }, g))
|
|
1153
1154
|
] }),
|
|
@@ -1169,44 +1170,44 @@ function Be() {
|
|
|
1169
1170
|
] })
|
|
1170
1171
|
] }) });
|
|
1171
1172
|
}
|
|
1172
|
-
function
|
|
1173
|
+
function Ke() {
|
|
1173
1174
|
var p, h;
|
|
1174
|
-
const r =
|
|
1175
|
+
const r = f((b) => b.selectedNodeId), s = f((b) => b.nodes), t = f((b) => b.generators), o = f((b) => b.transforms), n = f((b) => b.updateNodeData), i = f((b) => b.deleteNode), l = s.find((b) => b.id === r);
|
|
1175
1176
|
if (!l)
|
|
1176
1177
|
return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 p-4", children: /* @__PURE__ */ e("div", { className: "text-gray-500 dark:text-zinc-400 text-sm", children: "Select a node to edit its properties" }) });
|
|
1177
|
-
let
|
|
1178
|
+
let a, c = "";
|
|
1178
1179
|
if (l.type === "generator") {
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1180
|
+
const b = l.data, x = t.find((g) => g.name === b.generatorName);
|
|
1181
|
+
a = (p = x == null ? void 0 : x.params) == null ? void 0 : p.properties, c = (x == null ? void 0 : x.label) || b.generatorName;
|
|
1181
1182
|
} else if (l.type === "transform") {
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
} else l.type === "save" && (c = "Save",
|
|
1183
|
+
const b = l.data, x = o.find((g) => g.name === b.operation);
|
|
1184
|
+
a = (h = x == null ? void 0 : x.params) == null ? void 0 : h.properties, c = (x == null ? void 0 : x.label) || b.operation;
|
|
1185
|
+
} else l.type === "save" && (c = "Save", a = {
|
|
1185
1186
|
destination: {
|
|
1186
1187
|
type: "string",
|
|
1187
1188
|
title: "Destination",
|
|
1188
1189
|
description: "File path to save the image"
|
|
1189
1190
|
}
|
|
1190
1191
|
});
|
|
1191
|
-
const u = (
|
|
1192
|
+
const u = (b, x) => {
|
|
1192
1193
|
if (l.type === "generator") {
|
|
1193
1194
|
const g = l.data;
|
|
1194
|
-
|
|
1195
|
-
params: { ...g.params, [
|
|
1195
|
+
n(l.id, {
|
|
1196
|
+
params: { ...g.params, [b]: x }
|
|
1196
1197
|
});
|
|
1197
1198
|
} else if (l.type === "transform") {
|
|
1198
1199
|
const g = l.data;
|
|
1199
|
-
|
|
1200
|
-
params: { ...g.params, [
|
|
1200
|
+
n(l.id, {
|
|
1201
|
+
params: { ...g.params, [b]: x }
|
|
1201
1202
|
});
|
|
1202
|
-
} else l.type === "save" &&
|
|
1203
|
-
}, d = (
|
|
1203
|
+
} else l.type === "save" && n(l.id, { [b]: x });
|
|
1204
|
+
}, d = (b) => {
|
|
1204
1205
|
if (l.type === "generator")
|
|
1205
|
-
return l.data.params[
|
|
1206
|
+
return l.data.params[b];
|
|
1206
1207
|
if (l.type === "transform")
|
|
1207
|
-
return l.data.params[
|
|
1208
|
+
return l.data.params[b];
|
|
1208
1209
|
if (l.type === "save")
|
|
1209
|
-
return l.data[
|
|
1210
|
+
return l.data[b];
|
|
1210
1211
|
};
|
|
1211
1212
|
return /* @__PURE__ */ e("div", { className: "w-80 bg-gray-50 dark:bg-zinc-800 border-l border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ m("div", { className: "p-4", children: [
|
|
1212
1213
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between mb-4", children: [
|
|
@@ -1220,69 +1221,69 @@ function Re() {
|
|
|
1220
1221
|
}
|
|
1221
1222
|
)
|
|
1222
1223
|
] }),
|
|
1223
|
-
/* @__PURE__ */ e("div", { className: "space-y-4", children:
|
|
1224
|
-
|
|
1224
|
+
/* @__PURE__ */ e("div", { className: "space-y-4", children: a && Object.entries(a).map(([b, x]) => /* @__PURE__ */ e(
|
|
1225
|
+
qe,
|
|
1225
1226
|
{
|
|
1226
|
-
name:
|
|
1227
|
+
name: b,
|
|
1227
1228
|
field: x,
|
|
1228
|
-
value: d(
|
|
1229
|
-
onChange: (g) => u(
|
|
1229
|
+
value: d(b),
|
|
1230
|
+
onChange: (g) => u(b, g)
|
|
1230
1231
|
},
|
|
1231
|
-
|
|
1232
|
+
b
|
|
1232
1233
|
)) })
|
|
1233
1234
|
] }) });
|
|
1234
1235
|
}
|
|
1235
|
-
function
|
|
1236
|
-
const
|
|
1237
|
-
return
|
|
1238
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1236
|
+
function qe({ name: r, field: s, value: t, onChange: o }) {
|
|
1237
|
+
const n = s.title || r, i = "w-full px-3 py-2 border border-gray-300 dark:border-zinc-600 rounded-md shadow-sm focus:ring-teal-500 focus:border-teal-500 bg-white dark:bg-zinc-900 text-gray-900 dark:text-zinc-100";
|
|
1238
|
+
return s.enum ? /* @__PURE__ */ m("div", { children: [
|
|
1239
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
|
|
1239
1240
|
/* @__PURE__ */ m(
|
|
1240
1241
|
"select",
|
|
1241
1242
|
{
|
|
1242
1243
|
value: String(t || ""),
|
|
1243
|
-
onChange: (l) =>
|
|
1244
|
+
onChange: (l) => o(l.target.value),
|
|
1244
1245
|
className: i,
|
|
1245
1246
|
children: [
|
|
1246
1247
|
/* @__PURE__ */ e("option", { value: "", children: "Select..." }),
|
|
1247
|
-
|
|
1248
|
+
s.enum.map((l) => /* @__PURE__ */ e("option", { value: l, children: l }, l))
|
|
1248
1249
|
]
|
|
1249
1250
|
}
|
|
1250
1251
|
),
|
|
1251
|
-
|
|
1252
|
-
] }) :
|
|
1253
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1252
|
+
s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
|
|
1253
|
+
] }) : s.type === "number" ? /* @__PURE__ */ m("div", { children: [
|
|
1254
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
|
|
1254
1255
|
/* @__PURE__ */ e(
|
|
1255
1256
|
"input",
|
|
1256
1257
|
{
|
|
1257
1258
|
type: "number",
|
|
1258
1259
|
value: t !== void 0 ? Number(t) : "",
|
|
1259
|
-
onChange: (l) =>
|
|
1260
|
-
min:
|
|
1261
|
-
max:
|
|
1260
|
+
onChange: (l) => o(Number(l.target.value)),
|
|
1261
|
+
min: s.minimum,
|
|
1262
|
+
max: s.maximum,
|
|
1262
1263
|
className: i
|
|
1263
1264
|
}
|
|
1264
1265
|
),
|
|
1265
|
-
|
|
1266
|
-
] }) :
|
|
1266
|
+
s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
|
|
1267
|
+
] }) : s.type === "boolean" ? /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
1267
1268
|
/* @__PURE__ */ e(
|
|
1268
1269
|
"input",
|
|
1269
1270
|
{
|
|
1270
1271
|
type: "checkbox",
|
|
1271
1272
|
checked: !!t,
|
|
1272
|
-
onChange: (l) =>
|
|
1273
|
+
onChange: (l) => o(l.target.checked),
|
|
1273
1274
|
className: "h-4 w-4 text-teal-600 focus:ring-teal-500 border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-900"
|
|
1274
1275
|
}
|
|
1275
1276
|
),
|
|
1276
|
-
/* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children:
|
|
1277
|
+
/* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: n })
|
|
1277
1278
|
] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ m("div", { children: [
|
|
1278
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1279
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
|
|
1279
1280
|
/* @__PURE__ */ m("div", { className: "flex gap-2", children: [
|
|
1280
1281
|
/* @__PURE__ */ e(
|
|
1281
1282
|
"input",
|
|
1282
1283
|
{
|
|
1283
1284
|
type: "color",
|
|
1284
1285
|
value: String(t || "#000000"),
|
|
1285
|
-
onChange: (l) =>
|
|
1286
|
+
onChange: (l) => o(l.target.value),
|
|
1286
1287
|
className: "h-10 w-14 p-1 border border-gray-300 dark:border-zinc-600 rounded"
|
|
1287
1288
|
}
|
|
1288
1289
|
),
|
|
@@ -1291,20 +1292,20 @@ function Ge({ name: r, field: n, value: t, onChange: a }) {
|
|
|
1291
1292
|
{
|
|
1292
1293
|
type: "text",
|
|
1293
1294
|
value: String(t || ""),
|
|
1294
|
-
onChange: (l) =>
|
|
1295
|
+
onChange: (l) => o(l.target.value),
|
|
1295
1296
|
className: i + " flex-1"
|
|
1296
1297
|
}
|
|
1297
1298
|
)
|
|
1298
1299
|
] })
|
|
1299
|
-
] }) :
|
|
1300
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1300
|
+
] }) : s.type === "object" ? /* @__PURE__ */ m("div", { children: [
|
|
1301
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
|
|
1301
1302
|
/* @__PURE__ */ e(
|
|
1302
1303
|
"textarea",
|
|
1303
1304
|
{
|
|
1304
1305
|
value: t ? JSON.stringify(t, null, 2) : "{}",
|
|
1305
1306
|
onChange: (l) => {
|
|
1306
1307
|
try {
|
|
1307
|
-
|
|
1308
|
+
o(JSON.parse(l.target.value));
|
|
1308
1309
|
} catch {
|
|
1309
1310
|
}
|
|
1310
1311
|
},
|
|
@@ -1312,14 +1313,14 @@ function Ge({ name: r, field: n, value: t, onChange: a }) {
|
|
|
1312
1313
|
className: i + " font-mono text-xs"
|
|
1313
1314
|
}
|
|
1314
1315
|
),
|
|
1315
|
-
|
|
1316
|
+
s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
|
|
1316
1317
|
] }) : /* @__PURE__ */ m("div", { children: [
|
|
1317
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1318
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: n }),
|
|
1318
1319
|
r === "prompt" || r === "code" || r === "text" ? /* @__PURE__ */ e(
|
|
1319
1320
|
"textarea",
|
|
1320
1321
|
{
|
|
1321
1322
|
value: String(t || ""),
|
|
1322
|
-
onChange: (l) =>
|
|
1323
|
+
onChange: (l) => o(l.target.value),
|
|
1323
1324
|
rows: 3,
|
|
1324
1325
|
className: i
|
|
1325
1326
|
}
|
|
@@ -1328,105 +1329,105 @@ function Ge({ name: r, field: n, value: t, onChange: a }) {
|
|
|
1328
1329
|
{
|
|
1329
1330
|
type: "text",
|
|
1330
1331
|
value: String(t || ""),
|
|
1331
|
-
onChange: (l) =>
|
|
1332
|
+
onChange: (l) => o(l.target.value),
|
|
1332
1333
|
className: i
|
|
1333
1334
|
}
|
|
1334
1335
|
),
|
|
1335
|
-
|
|
1336
|
+
s.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: s.description })
|
|
1336
1337
|
] });
|
|
1337
1338
|
}
|
|
1338
|
-
function
|
|
1339
|
-
const t = new Map(r.map((
|
|
1340
|
-
for (const
|
|
1341
|
-
|
|
1342
|
-
for (const
|
|
1343
|
-
const c =
|
|
1344
|
-
c.push(
|
|
1339
|
+
function _e(r, s) {
|
|
1340
|
+
const t = new Map(r.map((a) => [a.id, a])), o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1341
|
+
for (const a of r)
|
|
1342
|
+
o.set(a.id, 0), n.set(a.id, []);
|
|
1343
|
+
for (const a of s) {
|
|
1344
|
+
const c = n.get(a.source) || [];
|
|
1345
|
+
c.push(a.target), n.set(a.source, c), o.set(a.target, (o.get(a.target) || 0) + 1);
|
|
1345
1346
|
}
|
|
1346
1347
|
const i = [];
|
|
1347
|
-
for (const [
|
|
1348
|
-
c === 0 && i.push(
|
|
1348
|
+
for (const [a, c] of o)
|
|
1349
|
+
c === 0 && i.push(a);
|
|
1349
1350
|
const l = [];
|
|
1350
1351
|
for (; i.length > 0; ) {
|
|
1351
|
-
const
|
|
1352
|
+
const a = i.shift(), c = t.get(a);
|
|
1352
1353
|
c && l.push(c);
|
|
1353
|
-
const u =
|
|
1354
|
+
const u = n.get(a) || [];
|
|
1354
1355
|
for (const d of u) {
|
|
1355
|
-
const p = (
|
|
1356
|
-
|
|
1356
|
+
const p = (o.get(d) || 1) - 1;
|
|
1357
|
+
o.set(d, p), p === 0 && i.push(d);
|
|
1357
1358
|
}
|
|
1358
1359
|
}
|
|
1359
1360
|
return l;
|
|
1360
1361
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const
|
|
1363
|
-
return `${
|
|
1362
|
+
function He(r) {
|
|
1363
|
+
const s = r.type || "node", t = r.id.replace(/[^a-zA-Z0-9]/g, "_");
|
|
1364
|
+
return `${s}_${t}`;
|
|
1364
1365
|
}
|
|
1365
1366
|
function U(r) {
|
|
1366
1367
|
return typeof r == "string" ? r.includes(`
|
|
1367
1368
|
`) ? "`" + r.replace(/`/g, "\\`").replace(/\$/g, "\\$") + "`" : JSON.stringify(r) : JSON.stringify(r, null, 2);
|
|
1368
1369
|
}
|
|
1369
|
-
function
|
|
1370
|
-
const
|
|
1370
|
+
function Je(r, s, t) {
|
|
1371
|
+
const o = t.get(r.id), n = [], i = s.find((a) => a.target === r.id), l = i ? t.get(i.source) : null;
|
|
1371
1372
|
switch (r.type) {
|
|
1372
1373
|
case "generator": {
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1375
|
-
const c =
|
|
1374
|
+
const a = r.data;
|
|
1375
|
+
n.push(a.generatorName);
|
|
1376
|
+
const c = a.params || {}, u = Object.entries(c).filter(([, d]) => d !== void 0 && d !== "").map(([d, p]) => ` ${d}: ${U(p)}`).join(`,
|
|
1376
1377
|
`);
|
|
1377
1378
|
return {
|
|
1378
|
-
code: `// Generate image using ${
|
|
1379
|
-
const ${
|
|
1379
|
+
code: `// Generate image using ${a.generatorName}
|
|
1380
|
+
const ${o} = await ${a.generatorName}({
|
|
1380
1381
|
${u}
|
|
1381
1382
|
});`,
|
|
1382
|
-
imports:
|
|
1383
|
+
imports: n
|
|
1383
1384
|
};
|
|
1384
1385
|
}
|
|
1385
1386
|
case "input":
|
|
1386
1387
|
return {
|
|
1387
1388
|
code: `// Load input image
|
|
1388
|
-
const ${
|
|
1389
|
+
const ${o} = await flo.loadImage("./input.png");`,
|
|
1389
1390
|
imports: []
|
|
1390
1391
|
};
|
|
1391
1392
|
case "transform": {
|
|
1392
|
-
const
|
|
1393
|
+
const a = r.data, c = a.params || {}, u = Object.entries(c).filter(([, p]) => p !== void 0 && p !== "").map(([p, h]) => `${p}: ${U(h)}`).join(", "), d = l || "image";
|
|
1393
1394
|
return {
|
|
1394
|
-
code: `// Apply ${
|
|
1395
|
-
const ${
|
|
1395
|
+
code: `// Apply ${a.operation} transform
|
|
1396
|
+
const ${o} = await flo.transform(${d}, "${a.operation}"${u ? `, { ${u} }` : ""});`,
|
|
1396
1397
|
imports: []
|
|
1397
1398
|
};
|
|
1398
1399
|
}
|
|
1399
1400
|
case "vision": {
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1402
|
-
const c =
|
|
1401
|
+
const a = r.data;
|
|
1402
|
+
n.push(a.providerName);
|
|
1403
|
+
const c = a.params || {}, u = l || "image", d = Object.entries(c).filter(([, p]) => p !== void 0 && p !== "").map(([p, h]) => ` ${p}: ${U(h)}`).join(`,
|
|
1403
1404
|
`);
|
|
1404
1405
|
return {
|
|
1405
|
-
code: `// Analyze image with ${
|
|
1406
|
-
const ${
|
|
1406
|
+
code: `// Analyze image with ${a.providerName}
|
|
1407
|
+
const ${o} = await ${a.providerName}.analyze(${u}, {
|
|
1407
1408
|
${d}
|
|
1408
1409
|
});`,
|
|
1409
|
-
imports:
|
|
1410
|
+
imports: n
|
|
1410
1411
|
};
|
|
1411
1412
|
}
|
|
1412
1413
|
case "text": {
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1415
|
-
const c =
|
|
1414
|
+
const a = r.data;
|
|
1415
|
+
n.push(a.providerName);
|
|
1416
|
+
const c = a.params || {}, u = Object.entries(c).filter(([, d]) => d !== void 0 && d !== "").map(([d, p]) => ` ${d}: ${U(p)}`).join(`,
|
|
1416
1417
|
`);
|
|
1417
1418
|
return {
|
|
1418
|
-
code: `// Generate text with ${
|
|
1419
|
-
const ${
|
|
1419
|
+
code: `// Generate text with ${a.providerName}
|
|
1420
|
+
const ${o} = await ${a.providerName}.generate({
|
|
1420
1421
|
${u}
|
|
1421
1422
|
});`,
|
|
1422
|
-
imports:
|
|
1423
|
+
imports: n
|
|
1423
1424
|
};
|
|
1424
1425
|
}
|
|
1425
1426
|
case "save": {
|
|
1426
|
-
const
|
|
1427
|
+
const a = r.data;
|
|
1427
1428
|
return {
|
|
1428
1429
|
code: `// Save result
|
|
1429
|
-
await flo.save(${l || "result"}, ${U(
|
|
1430
|
+
await flo.save(${l || "result"}, ${U(a.destination)});`,
|
|
1430
1431
|
imports: []
|
|
1431
1432
|
};
|
|
1432
1433
|
}
|
|
@@ -1437,23 +1438,23 @@ await flo.save(${l || "result"}, ${U(o.destination)});`,
|
|
|
1437
1438
|
};
|
|
1438
1439
|
}
|
|
1439
1440
|
}
|
|
1440
|
-
function
|
|
1441
|
+
function Qe(r, s) {
|
|
1441
1442
|
if (r.length === 0)
|
|
1442
1443
|
return `// Empty workflow
|
|
1443
1444
|
// Add nodes to your canvas to generate code`;
|
|
1444
|
-
const t =
|
|
1445
|
+
const t = _e(r, s), o = /* @__PURE__ */ new Map();
|
|
1445
1446
|
for (const u of t)
|
|
1446
|
-
|
|
1447
|
-
const
|
|
1447
|
+
o.set(u.id, He(u));
|
|
1448
|
+
const n = /* @__PURE__ */ new Set(), i = [];
|
|
1448
1449
|
for (const u of t) {
|
|
1449
|
-
const { code: d, imports: p } =
|
|
1450
|
+
const { code: d, imports: p } = Je(u, s, o);
|
|
1450
1451
|
i.push(d);
|
|
1451
1452
|
for (const h of p)
|
|
1452
|
-
|
|
1453
|
+
n.add(h);
|
|
1453
1454
|
}
|
|
1454
1455
|
const l = [];
|
|
1455
|
-
|
|
1456
|
-
const
|
|
1456
|
+
n.size > 0 && l.push(`import { ${Array.from(n).join(", ")} } from "@teamflojo/floimg";`), l.push('import * as flo from "@teamflojo/floimg";');
|
|
1457
|
+
const a = `/**
|
|
1457
1458
|
* FloImg Workflow
|
|
1458
1459
|
* Generated by FloImg Studio
|
|
1459
1460
|
* https://floimg.com
|
|
@@ -1473,41 +1474,46 @@ ${i.map(
|
|
|
1473
1474
|
// Run the workflow
|
|
1474
1475
|
runWorkflow().catch(console.error);
|
|
1475
1476
|
`;
|
|
1476
|
-
return
|
|
1477
|
+
return a + l.join(`
|
|
1477
1478
|
`) + `
|
|
1478
1479
|
` + c;
|
|
1479
1480
|
}
|
|
1480
|
-
function
|
|
1481
|
-
|
|
1481
|
+
function Ye({
|
|
1482
|
+
brandingSlot: r,
|
|
1483
|
+
beforeActionsSlot: s,
|
|
1484
|
+
afterActionsSlot: t,
|
|
1485
|
+
hideAttribution: o = !1
|
|
1486
|
+
} = {}) {
|
|
1487
|
+
const n = f((v) => v.execution), i = f((v) => v.execute), l = f((v) => v.exportToYaml), a = f((v) => v.nodes), c = f((v) => v.edges), u = A((v) => v.openSettings), d = f((v) => v.activeWorkflowName), p = f((v) => v.hasUnsavedChanges), h = f((v) => v.saveWorkflow), b = f((v) => v.toggleLibrary), x = f((v) => v.setActiveWorkflowName), [g, w] = N(!1), [k, y] = N("yaml"), [z, W] = N(""), [O, ie] = N(""), [J, B] = N(null), [de, F] = N(!1), [Q, V] = N("");
|
|
1482
1488
|
$(() => {
|
|
1483
1489
|
const v = () => {
|
|
1484
|
-
|
|
1490
|
+
B("New workflow created"), setTimeout(() => B(null), 2e3);
|
|
1485
1491
|
};
|
|
1486
1492
|
return window.addEventListener("new-workflow-created", v), () => window.removeEventListener("new-workflow-created", v);
|
|
1487
1493
|
}, []);
|
|
1488
|
-
const
|
|
1489
|
-
a.length !== 0 && (
|
|
1490
|
-
}, [a.length,
|
|
1491
|
-
|
|
1492
|
-
},
|
|
1493
|
-
const v =
|
|
1494
|
-
v && v !==
|
|
1494
|
+
const K = C(() => {
|
|
1495
|
+
a.length !== 0 && (h(), B("Saved!"), setTimeout(() => B(null), 2e3));
|
|
1496
|
+
}, [a.length, h]), le = () => {
|
|
1497
|
+
V(d), F(!0);
|
|
1498
|
+
}, Y = () => {
|
|
1499
|
+
const v = Q.trim();
|
|
1500
|
+
v && v !== d && x(v), F(!1);
|
|
1495
1501
|
};
|
|
1496
1502
|
$(() => {
|
|
1497
1503
|
function v(P) {
|
|
1498
|
-
(P.metaKey || P.ctrlKey) && P.key === "s" && (P.preventDefault(),
|
|
1504
|
+
(P.metaKey || P.ctrlKey) && P.key === "s" && (P.preventDefault(), K());
|
|
1499
1505
|
}
|
|
1500
1506
|
return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
|
|
1501
|
-
}, [
|
|
1502
|
-
const
|
|
1503
|
-
await
|
|
1504
|
-
},
|
|
1505
|
-
const v = await
|
|
1506
|
-
|
|
1507
|
-
const P =
|
|
1508
|
-
|
|
1509
|
-
},
|
|
1510
|
-
const v =
|
|
1507
|
+
}, [K]);
|
|
1508
|
+
const ce = async () => {
|
|
1509
|
+
await i();
|
|
1510
|
+
}, me = async () => {
|
|
1511
|
+
const v = await l();
|
|
1512
|
+
W(v);
|
|
1513
|
+
const P = Qe(a, c);
|
|
1514
|
+
ie(P), w(!0);
|
|
1515
|
+
}, ue = () => {
|
|
1516
|
+
const v = k === "yaml" ? z : O;
|
|
1511
1517
|
navigator.clipboard.writeText(v);
|
|
1512
1518
|
};
|
|
1513
1519
|
return /* @__PURE__ */ m(j, { children: [
|
|
@@ -1516,7 +1522,7 @@ function _e() {
|
|
|
1516
1522
|
/* @__PURE__ */ e(
|
|
1517
1523
|
"button",
|
|
1518
1524
|
{
|
|
1519
|
-
onClick:
|
|
1525
|
+
onClick: b,
|
|
1520
1526
|
className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md",
|
|
1521
1527
|
title: "My Workflows",
|
|
1522
1528
|
children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -1532,7 +1538,8 @@ function _e() {
|
|
|
1532
1538
|
),
|
|
1533
1539
|
/* @__PURE__ */ m("div", { className: "flex items-baseline gap-2", children: [
|
|
1534
1540
|
/* @__PURE__ */ e("h1", { className: "text-xl font-bold text-gray-800 dark:text-white", children: "floimg Studio" }),
|
|
1535
|
-
|
|
1541
|
+
r,
|
|
1542
|
+
!o && /* @__PURE__ */ e(
|
|
1536
1543
|
"a",
|
|
1537
1544
|
{
|
|
1538
1545
|
href: "https://flojo.io",
|
|
@@ -1544,15 +1551,15 @@ function _e() {
|
|
|
1544
1551
|
)
|
|
1545
1552
|
] }),
|
|
1546
1553
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
1547
|
-
|
|
1554
|
+
de ? /* @__PURE__ */ e(
|
|
1548
1555
|
"input",
|
|
1549
1556
|
{
|
|
1550
1557
|
type: "text",
|
|
1551
|
-
value:
|
|
1552
|
-
onChange: (v) =>
|
|
1553
|
-
onBlur:
|
|
1558
|
+
value: Q,
|
|
1559
|
+
onChange: (v) => V(v.target.value),
|
|
1560
|
+
onBlur: Y,
|
|
1554
1561
|
onKeyDown: (v) => {
|
|
1555
|
-
v.key === "Enter" &&
|
|
1562
|
+
v.key === "Enter" && Y(), v.key === "Escape" && (V(d), F(!1));
|
|
1556
1563
|
},
|
|
1557
1564
|
className: "w-48 px-2 py-1 text-sm font-medium bg-white dark:bg-zinc-900 border border-teal-500 rounded focus:outline-none focus:ring-1 focus:ring-teal-500 text-gray-900 dark:text-zinc-100",
|
|
1558
1565
|
autoFocus: !0
|
|
@@ -1560,14 +1567,14 @@ function _e() {
|
|
|
1560
1567
|
) : /* @__PURE__ */ e(
|
|
1561
1568
|
"button",
|
|
1562
1569
|
{
|
|
1563
|
-
onClick:
|
|
1570
|
+
onClick: le,
|
|
1564
1571
|
className: "text-sm text-gray-700 dark:text-zinc-300 font-medium hover:text-gray-900 dark:hover:text-zinc-100 rounded px-2 py-1 -mx-2 hover:bg-gray-100 dark:hover:bg-zinc-700 transition-colors",
|
|
1565
1572
|
title: "Click to rename",
|
|
1566
|
-
children:
|
|
1573
|
+
children: d
|
|
1567
1574
|
}
|
|
1568
1575
|
),
|
|
1569
|
-
|
|
1570
|
-
|
|
1576
|
+
p && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
|
|
1577
|
+
J && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: J })
|
|
1571
1578
|
] }),
|
|
1572
1579
|
/* @__PURE__ */ m("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
|
|
1573
1580
|
a.length,
|
|
@@ -1576,10 +1583,11 @@ function _e() {
|
|
|
1576
1583
|
] })
|
|
1577
1584
|
] }),
|
|
1578
1585
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
1586
|
+
s,
|
|
1579
1587
|
/* @__PURE__ */ e(
|
|
1580
1588
|
"button",
|
|
1581
1589
|
{
|
|
1582
|
-
onClick:
|
|
1590
|
+
onClick: u,
|
|
1583
1591
|
className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md",
|
|
1584
1592
|
title: "AI Settings",
|
|
1585
1593
|
children: /* @__PURE__ */ m("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
@@ -1607,7 +1615,7 @@ function _e() {
|
|
|
1607
1615
|
/* @__PURE__ */ e(
|
|
1608
1616
|
"button",
|
|
1609
1617
|
{
|
|
1610
|
-
onClick:
|
|
1618
|
+
onClick: K,
|
|
1611
1619
|
disabled: a.length === 0,
|
|
1612
1620
|
className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1613
1621
|
title: "Save Workflow (Cmd+S)",
|
|
@@ -1625,7 +1633,7 @@ function _e() {
|
|
|
1625
1633
|
/* @__PURE__ */ e(
|
|
1626
1634
|
"button",
|
|
1627
1635
|
{
|
|
1628
|
-
onClick:
|
|
1636
|
+
onClick: me,
|
|
1629
1637
|
disabled: a.length === 0,
|
|
1630
1638
|
className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1631
1639
|
children: "Export"
|
|
@@ -1634,10 +1642,10 @@ function _e() {
|
|
|
1634
1642
|
/* @__PURE__ */ e(
|
|
1635
1643
|
"button",
|
|
1636
1644
|
{
|
|
1637
|
-
onClick:
|
|
1638
|
-
disabled: a.length === 0 ||
|
|
1645
|
+
onClick: ce,
|
|
1646
|
+
disabled: a.length === 0 || n.status === "running",
|
|
1639
1647
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
|
|
1640
|
-
children:
|
|
1648
|
+
children: n.status === "running" ? /* @__PURE__ */ m(j, { children: [
|
|
1641
1649
|
/* @__PURE__ */ m("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
|
|
1642
1650
|
/* @__PURE__ */ e(
|
|
1643
1651
|
"circle",
|
|
@@ -1684,27 +1692,28 @@ function _e() {
|
|
|
1684
1692
|
"Execute"
|
|
1685
1693
|
] })
|
|
1686
1694
|
}
|
|
1687
|
-
)
|
|
1695
|
+
),
|
|
1696
|
+
t
|
|
1688
1697
|
] })
|
|
1689
1698
|
] }),
|
|
1690
|
-
|
|
1699
|
+
n.status === "completed" && n.imageIds.length > 0 && /* @__PURE__ */ e("div", { className: "bg-green-50 dark:bg-green-900/30 border-b border-green-200 dark:border-green-800 px-4 py-3", children: /* @__PURE__ */ m("div", { className: "flex items-center gap-4", children: [
|
|
1691
1700
|
/* @__PURE__ */ m("span", { className: "text-green-700 dark:text-green-400 font-medium", children: [
|
|
1692
1701
|
"Generated ",
|
|
1693
|
-
|
|
1702
|
+
n.imageIds.length,
|
|
1694
1703
|
" image",
|
|
1695
|
-
|
|
1704
|
+
n.imageIds.length !== 1 ? "s" : ""
|
|
1696
1705
|
] }),
|
|
1697
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2", children:
|
|
1706
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2", children: n.imageIds.slice(0, 4).map((v) => /* @__PURE__ */ e(
|
|
1698
1707
|
"a",
|
|
1699
1708
|
{
|
|
1700
|
-
href:
|
|
1709
|
+
href: G(v),
|
|
1701
1710
|
target: "_blank",
|
|
1702
1711
|
rel: "noopener noreferrer",
|
|
1703
1712
|
className: "block",
|
|
1704
1713
|
children: /* @__PURE__ */ e(
|
|
1705
1714
|
"img",
|
|
1706
1715
|
{
|
|
1707
|
-
src:
|
|
1716
|
+
src: G(v),
|
|
1708
1717
|
alt: "Generated",
|
|
1709
1718
|
className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
|
|
1710
1719
|
}
|
|
@@ -1713,11 +1722,11 @@ function _e() {
|
|
|
1713
1722
|
v
|
|
1714
1723
|
)) })
|
|
1715
1724
|
] }) }),
|
|
1716
|
-
|
|
1725
|
+
n.status === "error" && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border-b border-red-200 dark:border-red-800 px-4 py-3", children: /* @__PURE__ */ m("span", { className: "text-red-700 dark:text-red-400", children: [
|
|
1717
1726
|
"Error: ",
|
|
1718
|
-
|
|
1727
|
+
n.error
|
|
1719
1728
|
] }) }),
|
|
1720
|
-
|
|
1729
|
+
g && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ m("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col", children: [
|
|
1721
1730
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
1722
1731
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-4", children: [
|
|
1723
1732
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Export Workflow" }),
|
|
@@ -1725,16 +1734,16 @@ function _e() {
|
|
|
1725
1734
|
/* @__PURE__ */ e(
|
|
1726
1735
|
"button",
|
|
1727
1736
|
{
|
|
1728
|
-
onClick: () =>
|
|
1729
|
-
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${
|
|
1737
|
+
onClick: () => y("yaml"),
|
|
1738
|
+
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${k === "yaml" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
|
|
1730
1739
|
children: "YAML"
|
|
1731
1740
|
}
|
|
1732
1741
|
),
|
|
1733
1742
|
/* @__PURE__ */ e(
|
|
1734
1743
|
"button",
|
|
1735
1744
|
{
|
|
1736
|
-
onClick: () =>
|
|
1737
|
-
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${
|
|
1745
|
+
onClick: () => y("javascript"),
|
|
1746
|
+
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${k === "javascript" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
|
|
1738
1747
|
children: "JavaScript"
|
|
1739
1748
|
}
|
|
1740
1749
|
)
|
|
@@ -1743,7 +1752,7 @@ function _e() {
|
|
|
1743
1752
|
/* @__PURE__ */ e(
|
|
1744
1753
|
"button",
|
|
1745
1754
|
{
|
|
1746
|
-
onClick: () =>
|
|
1755
|
+
onClick: () => w(!1),
|
|
1747
1756
|
className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
|
|
1748
1757
|
children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
1749
1758
|
"path",
|
|
@@ -1757,14 +1766,14 @@ function _e() {
|
|
|
1757
1766
|
}
|
|
1758
1767
|
)
|
|
1759
1768
|
] }),
|
|
1760
|
-
/* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children:
|
|
1769
|
+
/* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: k === "yaml" ? z : O }) }),
|
|
1761
1770
|
/* @__PURE__ */ m("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
|
|
1762
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children:
|
|
1771
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: k === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
|
|
1763
1772
|
/* @__PURE__ */ m("div", { className: "flex gap-2", children: [
|
|
1764
1773
|
/* @__PURE__ */ e(
|
|
1765
1774
|
"button",
|
|
1766
1775
|
{
|
|
1767
|
-
onClick:
|
|
1776
|
+
onClick: ue,
|
|
1768
1777
|
className: "px-4 py-2 text-sm font-medium text-gray-700 dark:text-zinc-200 bg-white dark:bg-zinc-700 border border-gray-300 dark:border-zinc-600 rounded-md hover:bg-gray-50 dark:hover:bg-zinc-600",
|
|
1769
1778
|
children: "Copy to Clipboard"
|
|
1770
1779
|
}
|
|
@@ -1772,7 +1781,7 @@ function _e() {
|
|
|
1772
1781
|
/* @__PURE__ */ e(
|
|
1773
1782
|
"button",
|
|
1774
1783
|
{
|
|
1775
|
-
onClick: () =>
|
|
1784
|
+
onClick: () => w(!1),
|
|
1776
1785
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
|
|
1777
1786
|
children: "Close"
|
|
1778
1787
|
}
|
|
@@ -1782,21 +1791,21 @@ function _e() {
|
|
|
1782
1791
|
] }) })
|
|
1783
1792
|
] });
|
|
1784
1793
|
}
|
|
1785
|
-
function
|
|
1786
|
-
const r =
|
|
1787
|
-
data:
|
|
1788
|
-
isLoading:
|
|
1794
|
+
function Xe() {
|
|
1795
|
+
const r = f((c) => c.loadTemplate), [s, t] = N(null), {
|
|
1796
|
+
data: o,
|
|
1797
|
+
isLoading: n,
|
|
1789
1798
|
error: i,
|
|
1790
1799
|
refetch: l
|
|
1791
|
-
} =
|
|
1800
|
+
} = q({
|
|
1792
1801
|
queryKey: ["images"],
|
|
1793
|
-
queryFn:
|
|
1802
|
+
queryFn: Le,
|
|
1794
1803
|
refetchInterval: 5e3
|
|
1795
1804
|
// Auto-refresh every 5 seconds
|
|
1796
|
-
}),
|
|
1805
|
+
}), a = async (c) => {
|
|
1797
1806
|
t(c);
|
|
1798
1807
|
try {
|
|
1799
|
-
const u = await
|
|
1808
|
+
const u = await We(c);
|
|
1800
1809
|
if (u != null && u.workflow) {
|
|
1801
1810
|
const d = {
|
|
1802
1811
|
id: `image-${c}`,
|
|
@@ -1818,19 +1827,19 @@ function He() {
|
|
|
1818
1827
|
t(null);
|
|
1819
1828
|
}
|
|
1820
1829
|
};
|
|
1821
|
-
return
|
|
1830
|
+
return n ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : i ? /* @__PURE__ */ m("div", { className: "p-8 text-center text-red-500 dark:text-red-400", children: [
|
|
1822
1831
|
"Error loading images: ",
|
|
1823
1832
|
i instanceof Error ? i.message : "Unknown error"
|
|
1824
|
-
] }) : !
|
|
1833
|
+
] }) : !o || o.length === 0 ? /* @__PURE__ */ m("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: [
|
|
1825
1834
|
/* @__PURE__ */ e("div", { className: "text-lg mb-2", children: "No images yet" }),
|
|
1826
1835
|
/* @__PURE__ */ e("div", { className: "text-sm", children: "Create a workflow and click Execute to generate images" })
|
|
1827
1836
|
] }) : /* @__PURE__ */ m("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
|
|
1828
1837
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between mb-4", children: [
|
|
1829
1838
|
/* @__PURE__ */ m("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
|
|
1830
1839
|
"Gallery (",
|
|
1831
|
-
|
|
1840
|
+
o.length,
|
|
1832
1841
|
" image",
|
|
1833
|
-
|
|
1842
|
+
o.length !== 1 ? "s" : "",
|
|
1834
1843
|
")"
|
|
1835
1844
|
] }),
|
|
1836
1845
|
/* @__PURE__ */ e(
|
|
@@ -1842,32 +1851,32 @@ function He() {
|
|
|
1842
1851
|
}
|
|
1843
1852
|
)
|
|
1844
1853
|
] }),
|
|
1845
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children:
|
|
1846
|
-
|
|
1854
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: o.map((c) => /* @__PURE__ */ e(
|
|
1855
|
+
Ze,
|
|
1847
1856
|
{
|
|
1848
1857
|
image: c,
|
|
1849
|
-
onLoadWorkflow: () =>
|
|
1850
|
-
isLoading:
|
|
1858
|
+
onLoadWorkflow: () => a(c.id),
|
|
1859
|
+
isLoading: s === c.id
|
|
1851
1860
|
},
|
|
1852
1861
|
c.id
|
|
1853
1862
|
)) })
|
|
1854
1863
|
] });
|
|
1855
1864
|
}
|
|
1856
|
-
function
|
|
1857
|
-
const
|
|
1865
|
+
function Ze({ image: r, onLoadWorkflow: s, isLoading: t }) {
|
|
1866
|
+
const o = (i) => new Date(i).toLocaleString(), n = (i) => i < 1024 ? `${i} B` : i < 1048576 ? `${(i / 1024).toFixed(1)} KB` : `${(i / 1048576).toFixed(1)} MB`;
|
|
1858
1867
|
return /* @__PURE__ */ m("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden shadow-sm hover:shadow-md transition-shadow group", children: [
|
|
1859
1868
|
/* @__PURE__ */ m("div", { className: "relative", children: [
|
|
1860
1869
|
/* @__PURE__ */ e(
|
|
1861
1870
|
"a",
|
|
1862
1871
|
{
|
|
1863
|
-
href:
|
|
1872
|
+
href: G(r.id),
|
|
1864
1873
|
target: "_blank",
|
|
1865
1874
|
rel: "noopener noreferrer",
|
|
1866
1875
|
className: "block aspect-square bg-gray-100 dark:bg-zinc-900",
|
|
1867
1876
|
children: /* @__PURE__ */ e(
|
|
1868
1877
|
"img",
|
|
1869
1878
|
{
|
|
1870
|
-
src:
|
|
1879
|
+
src: G(r.id),
|
|
1871
1880
|
alt: r.filename,
|
|
1872
1881
|
className: "w-full h-full object-cover",
|
|
1873
1882
|
loading: "lazy"
|
|
@@ -1879,7 +1888,7 @@ function Je({ image: r, onLoadWorkflow: n, isLoading: t }) {
|
|
|
1879
1888
|
"button",
|
|
1880
1889
|
{
|
|
1881
1890
|
onClick: (i) => {
|
|
1882
|
-
i.preventDefault(),
|
|
1891
|
+
i.preventDefault(), s();
|
|
1883
1892
|
},
|
|
1884
1893
|
disabled: t,
|
|
1885
1894
|
className: "px-3 py-1.5 bg-teal-600 text-white text-sm rounded-lg hover:bg-teal-700 disabled:opacity-50",
|
|
@@ -1892,13 +1901,13 @@ function Je({ image: r, onLoadWorkflow: n, isLoading: t }) {
|
|
|
1892
1901
|
/* @__PURE__ */ m("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mt-1", children: [
|
|
1893
1902
|
r.mime,
|
|
1894
1903
|
" • ",
|
|
1895
|
-
|
|
1904
|
+
n(r.size)
|
|
1896
1905
|
] }),
|
|
1897
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children:
|
|
1906
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children: o(r.createdAt) })
|
|
1898
1907
|
] })
|
|
1899
1908
|
] });
|
|
1900
1909
|
}
|
|
1901
|
-
const
|
|
1910
|
+
const et = {
|
|
1902
1911
|
id: "sales-dashboard",
|
|
1903
1912
|
name: "Sales Dashboard",
|
|
1904
1913
|
description: "Quarterly revenue bar chart with gradient styling",
|
|
@@ -1948,7 +1957,7 @@ const Qe = {
|
|
|
1948
1957
|
],
|
|
1949
1958
|
edges: []
|
|
1950
1959
|
}
|
|
1951
|
-
},
|
|
1960
|
+
}, tt = {
|
|
1952
1961
|
id: "user-growth",
|
|
1953
1962
|
name: "User Growth Line Chart",
|
|
1954
1963
|
description: "Monthly user growth with smooth bezier curves",
|
|
@@ -1996,7 +2005,7 @@ const Qe = {
|
|
|
1996
2005
|
],
|
|
1997
2006
|
edges: []
|
|
1998
2007
|
}
|
|
1999
|
-
},
|
|
2008
|
+
}, rt = {
|
|
2000
2009
|
id: "api-flow",
|
|
2001
2010
|
name: "API Request Flow",
|
|
2002
2011
|
description: "Sequence diagram showing API authentication flow",
|
|
@@ -2038,7 +2047,7 @@ const Qe = {
|
|
|
2038
2047
|
],
|
|
2039
2048
|
edges: []
|
|
2040
2049
|
}
|
|
2041
|
-
},
|
|
2050
|
+
}, at = {
|
|
2042
2051
|
id: "system-architecture",
|
|
2043
2052
|
name: "System Architecture",
|
|
2044
2053
|
description: "Microservices architecture diagram",
|
|
@@ -2096,7 +2105,7 @@ const Qe = {
|
|
|
2096
2105
|
],
|
|
2097
2106
|
edges: []
|
|
2098
2107
|
}
|
|
2099
|
-
},
|
|
2108
|
+
}, ot = {
|
|
2100
2109
|
id: "git-workflow",
|
|
2101
2110
|
name: "Git Branch Workflow",
|
|
2102
2111
|
description: "Git branching strategy with feature and release branches",
|
|
@@ -2139,7 +2148,7 @@ const Qe = {
|
|
|
2139
2148
|
],
|
|
2140
2149
|
edges: []
|
|
2141
2150
|
}
|
|
2142
|
-
},
|
|
2151
|
+
}, nt = {
|
|
2143
2152
|
id: "website-qr",
|
|
2144
2153
|
name: "Website QR Code",
|
|
2145
2154
|
description: "QR code linking to your website with custom styling",
|
|
@@ -2167,7 +2176,7 @@ const Qe = {
|
|
|
2167
2176
|
],
|
|
2168
2177
|
edges: []
|
|
2169
2178
|
}
|
|
2170
|
-
},
|
|
2179
|
+
}, st = {
|
|
2171
2180
|
id: "wifi-qr",
|
|
2172
2181
|
name: "WiFi QR Code",
|
|
2173
2182
|
description: "Scannable QR code for WiFi network access",
|
|
@@ -2195,7 +2204,7 @@ const Qe = {
|
|
|
2195
2204
|
],
|
|
2196
2205
|
edges: []
|
|
2197
2206
|
}
|
|
2198
|
-
},
|
|
2207
|
+
}, it = {
|
|
2199
2208
|
id: "chart-watermark",
|
|
2200
2209
|
name: "Chart with Watermark",
|
|
2201
2210
|
description: "Bar chart with company watermark and rounded corners",
|
|
@@ -2261,7 +2270,7 @@ const Qe = {
|
|
|
2261
2270
|
{ id: "e2", source: "transform-1", target: "transform-2" }
|
|
2262
2271
|
]
|
|
2263
2272
|
}
|
|
2264
|
-
},
|
|
2273
|
+
}, dt = {
|
|
2265
2274
|
id: "diagram-webp",
|
|
2266
2275
|
name: "Diagram to WebP",
|
|
2267
2276
|
description: "Mermaid diagram converted to optimized WebP format",
|
|
@@ -2304,52 +2313,52 @@ const Qe = {
|
|
|
2304
2313
|
}
|
|
2305
2314
|
}, E = [
|
|
2306
2315
|
// Charts
|
|
2307
|
-
Qe,
|
|
2308
|
-
Ye,
|
|
2309
|
-
// Diagrams
|
|
2310
|
-
Xe,
|
|
2311
|
-
Ze,
|
|
2312
2316
|
et,
|
|
2313
|
-
// QR Codes
|
|
2314
2317
|
tt,
|
|
2318
|
+
// Diagrams
|
|
2315
2319
|
rt,
|
|
2316
|
-
// Pipelines
|
|
2317
2320
|
at,
|
|
2318
|
-
ot
|
|
2321
|
+
ot,
|
|
2322
|
+
// QR Codes
|
|
2323
|
+
nt,
|
|
2324
|
+
st,
|
|
2325
|
+
// Pipelines
|
|
2326
|
+
it,
|
|
2327
|
+
dt
|
|
2319
2328
|
];
|
|
2320
|
-
function
|
|
2321
|
-
const r = new Set(E.map((
|
|
2329
|
+
function lt() {
|
|
2330
|
+
const r = new Set(E.map((s) => s.category));
|
|
2322
2331
|
return Array.from(r).sort();
|
|
2323
2332
|
}
|
|
2324
|
-
function
|
|
2325
|
-
return E.filter((
|
|
2333
|
+
function zt(r) {
|
|
2334
|
+
return E.filter((s) => s.category === r);
|
|
2326
2335
|
}
|
|
2327
|
-
function
|
|
2328
|
-
return E.find((
|
|
2336
|
+
function ae(r) {
|
|
2337
|
+
return E.find((s) => s.id === r);
|
|
2329
2338
|
}
|
|
2330
|
-
function
|
|
2331
|
-
const
|
|
2339
|
+
function Ct(r) {
|
|
2340
|
+
const s = r.toLowerCase();
|
|
2332
2341
|
return E.filter(
|
|
2333
2342
|
(t) => {
|
|
2334
|
-
var
|
|
2335
|
-
return t.name.toLowerCase().includes(
|
|
2343
|
+
var o;
|
|
2344
|
+
return t.name.toLowerCase().includes(s) || t.description.toLowerCase().includes(s) || t.category.toLowerCase().includes(s) || t.generator.toLowerCase().includes(s) || ((o = t.tags) == null ? void 0 : o.some((n) => n.toLowerCase().includes(s)));
|
|
2336
2345
|
}
|
|
2337
2346
|
);
|
|
2338
2347
|
}
|
|
2339
|
-
function
|
|
2340
|
-
const [
|
|
2341
|
-
let
|
|
2342
|
-
if (
|
|
2343
|
-
const c =
|
|
2344
|
-
|
|
2348
|
+
function ct({ onSelect: r }) {
|
|
2349
|
+
const [s, t] = N(null), [o, n] = N(""), i = X(() => lt(), []), l = X(() => {
|
|
2350
|
+
let a = E;
|
|
2351
|
+
if (s && (a = a.filter((c) => c.category === s)), o) {
|
|
2352
|
+
const c = o.toLowerCase();
|
|
2353
|
+
a = a.filter(
|
|
2345
2354
|
(u) => {
|
|
2346
2355
|
var d;
|
|
2347
2356
|
return u.name.toLowerCase().includes(c) || u.description.toLowerCase().includes(c) || u.generator.toLowerCase().includes(c) || ((d = u.tags) == null ? void 0 : d.some((p) => p.toLowerCase().includes(c)));
|
|
2348
2357
|
}
|
|
2349
2358
|
);
|
|
2350
2359
|
}
|
|
2351
|
-
return
|
|
2352
|
-
}, [
|
|
2360
|
+
return a;
|
|
2361
|
+
}, [s, o]);
|
|
2353
2362
|
return /* @__PURE__ */ m("div", { className: "p-6", children: [
|
|
2354
2363
|
/* @__PURE__ */ m("div", { className: "mb-6", children: [
|
|
2355
2364
|
/* @__PURE__ */ e("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white mb-2", children: "Templates" }),
|
|
@@ -2361,8 +2370,8 @@ function st({ onSelect: r }) {
|
|
|
2361
2370
|
{
|
|
2362
2371
|
type: "text",
|
|
2363
2372
|
placeholder: "Search templates...",
|
|
2364
|
-
value:
|
|
2365
|
-
onChange: (
|
|
2373
|
+
value: o,
|
|
2374
|
+
onChange: (a) => n(a.target.value),
|
|
2366
2375
|
className: "px-4 py-2 border border-gray-300 dark:border-zinc-600 rounded-lg bg-white dark:bg-zinc-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-teal-500 focus:border-transparent w-64"
|
|
2367
2376
|
}
|
|
2368
2377
|
),
|
|
@@ -2371,33 +2380,33 @@ function st({ onSelect: r }) {
|
|
|
2371
2380
|
"button",
|
|
2372
2381
|
{
|
|
2373
2382
|
onClick: () => t(null),
|
|
2374
|
-
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${
|
|
2383
|
+
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${s === null ? "bg-teal-600 text-white" : "bg-gray-200 dark:bg-zinc-700 text-gray-700 dark:text-zinc-300 hover:bg-gray-300 dark:hover:bg-zinc-600"}`,
|
|
2375
2384
|
children: "All"
|
|
2376
2385
|
}
|
|
2377
2386
|
),
|
|
2378
|
-
i.map((
|
|
2387
|
+
i.map((a) => /* @__PURE__ */ e(
|
|
2379
2388
|
"button",
|
|
2380
2389
|
{
|
|
2381
|
-
onClick: () => t(
|
|
2382
|
-
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${
|
|
2383
|
-
children:
|
|
2390
|
+
onClick: () => t(a),
|
|
2391
|
+
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${s === a ? "bg-teal-600 text-white" : "bg-gray-200 dark:bg-zinc-700 text-gray-700 dark:text-zinc-300 hover:bg-gray-300 dark:hover:bg-zinc-600"}`,
|
|
2392
|
+
children: a
|
|
2384
2393
|
},
|
|
2385
|
-
|
|
2394
|
+
a
|
|
2386
2395
|
))
|
|
2387
2396
|
] })
|
|
2388
2397
|
] }),
|
|
2389
|
-
l.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-12 text-gray-500 dark:text-zinc-400", children: "No templates found matching your criteria." }) : /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: l.map((
|
|
2390
|
-
|
|
2398
|
+
l.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-12 text-gray-500 dark:text-zinc-400", children: "No templates found matching your criteria." }) : /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: l.map((a) => /* @__PURE__ */ e(
|
|
2399
|
+
mt,
|
|
2391
2400
|
{
|
|
2392
|
-
template:
|
|
2393
|
-
onSelect: () => r(
|
|
2401
|
+
template: a,
|
|
2402
|
+
onSelect: () => r(a.id)
|
|
2394
2403
|
},
|
|
2395
|
-
|
|
2404
|
+
a.id
|
|
2396
2405
|
)) })
|
|
2397
2406
|
] });
|
|
2398
2407
|
}
|
|
2399
|
-
function
|
|
2400
|
-
const t = r.workflow.nodes.length,
|
|
2408
|
+
function mt({ template: r, onSelect: s }) {
|
|
2409
|
+
const t = r.workflow.nodes.length, o = r.workflow.edges.length, n = {
|
|
2401
2410
|
quickchart: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
2402
2411
|
mermaid: "bg-pink-100 text-pink-800 dark:bg-pink-900/30 dark:text-pink-300",
|
|
2403
2412
|
qr: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
|
|
@@ -2438,7 +2447,7 @@ function it({ template: r, onSelect: n }) {
|
|
|
2438
2447
|
/* @__PURE__ */ e(
|
|
2439
2448
|
"span",
|
|
2440
2449
|
{
|
|
2441
|
-
className: `px-2 py-0.5 rounded text-xs font-medium ${
|
|
2450
|
+
className: `px-2 py-0.5 rounded text-xs font-medium ${n[r.generator] || "bg-gray-100 text-gray-800 dark:bg-zinc-700 dark:text-zinc-300"}`,
|
|
2442
2451
|
children: r.generator
|
|
2443
2452
|
}
|
|
2444
2453
|
)
|
|
@@ -2459,7 +2468,7 @@ function it({ template: r, onSelect: n }) {
|
|
|
2459
2468
|
" node",
|
|
2460
2469
|
t !== 1 ? "s" : ""
|
|
2461
2470
|
] }),
|
|
2462
|
-
|
|
2471
|
+
o > 0 && /* @__PURE__ */ m("span", { className: "flex items-center gap-1", children: [
|
|
2463
2472
|
/* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
|
|
2464
2473
|
"path",
|
|
2465
2474
|
{
|
|
@@ -2469,9 +2478,9 @@ function it({ template: r, onSelect: n }) {
|
|
|
2469
2478
|
d: "M13 7l5 5m0 0l-5 5m5-5H6"
|
|
2470
2479
|
}
|
|
2471
2480
|
) }),
|
|
2472
|
-
|
|
2481
|
+
o,
|
|
2473
2482
|
" edge",
|
|
2474
|
-
|
|
2483
|
+
o !== 1 ? "s" : ""
|
|
2475
2484
|
] })
|
|
2476
2485
|
] }),
|
|
2477
2486
|
r.tags && r.tags.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 mb-4", children: r.tags.slice(0, 4).map((i) => /* @__PURE__ */ e(
|
|
@@ -2485,7 +2494,7 @@ function it({ template: r, onSelect: n }) {
|
|
|
2485
2494
|
/* @__PURE__ */ e(
|
|
2486
2495
|
"button",
|
|
2487
2496
|
{
|
|
2488
|
-
onClick:
|
|
2497
|
+
onClick: s,
|
|
2489
2498
|
className: "w-full py-2 px-4 bg-teal-600 hover:bg-teal-700 text-white rounded-lg font-medium transition-colors",
|
|
2490
2499
|
children: "Use Template"
|
|
2491
2500
|
}
|
|
@@ -2493,24 +2502,24 @@ function it({ template: r, onSelect: n }) {
|
|
|
2493
2502
|
] })
|
|
2494
2503
|
] });
|
|
2495
2504
|
}
|
|
2496
|
-
function
|
|
2505
|
+
function ut({
|
|
2497
2506
|
workflow: r,
|
|
2498
|
-
isActive:
|
|
2507
|
+
isActive: s,
|
|
2499
2508
|
onLoad: t,
|
|
2500
|
-
onDelete:
|
|
2501
|
-
onRename:
|
|
2509
|
+
onDelete: o,
|
|
2510
|
+
onRename: n,
|
|
2502
2511
|
onDuplicate: i
|
|
2503
2512
|
}) {
|
|
2504
|
-
const [l,
|
|
2505
|
-
c.trim() && c !== r.name &&
|
|
2506
|
-
},
|
|
2507
|
-
const g = new Date(x),
|
|
2508
|
-
return y < 1 ? "Just now" : y < 60 ? `${y}m ago` : z < 24 ? `${z}h ago` :
|
|
2513
|
+
const [l, a] = N(!1), [c, u] = N(r.name), [d, p] = N(!1), h = () => {
|
|
2514
|
+
c.trim() && c !== r.name && n(c.trim()), a(!1);
|
|
2515
|
+
}, b = (x) => {
|
|
2516
|
+
const g = new Date(x), k = (/* @__PURE__ */ new Date()).getTime() - g.getTime(), y = Math.floor(k / 6e4), z = Math.floor(k / 36e5), W = Math.floor(k / 864e5);
|
|
2517
|
+
return y < 1 ? "Just now" : y < 60 ? `${y}m ago` : z < 24 ? `${z}h ago` : W < 7 ? `${W}d ago` : g.toLocaleDateString();
|
|
2509
2518
|
};
|
|
2510
2519
|
return /* @__PURE__ */ m(
|
|
2511
2520
|
"div",
|
|
2512
2521
|
{
|
|
2513
|
-
className: `group relative p-3 rounded-lg border transition-colors ${
|
|
2522
|
+
className: `group relative p-3 rounded-lg border transition-colors ${s ? "bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800" : "bg-white dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600"}`,
|
|
2514
2523
|
children: [
|
|
2515
2524
|
/* @__PURE__ */ m("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2516
2525
|
/* @__PURE__ */ m("button", { onClick: t, className: "flex-1 text-left min-w-0", children: [
|
|
@@ -2522,7 +2531,7 @@ function dt({
|
|
|
2522
2531
|
onChange: (x) => u(x.target.value),
|
|
2523
2532
|
onBlur: h,
|
|
2524
2533
|
onKeyDown: (x) => {
|
|
2525
|
-
x.key === "Enter" && h(), x.key === "Escape" && (u(r.name),
|
|
2534
|
+
x.key === "Enter" && h(), x.key === "Escape" && (u(r.name), a(!1));
|
|
2526
2535
|
},
|
|
2527
2536
|
className: "w-full px-1 py-0.5 text-sm font-medium bg-white dark:bg-zinc-900 border border-teal-500 rounded focus:outline-none focus:ring-1 focus:ring-teal-500",
|
|
2528
2537
|
autoFocus: !0,
|
|
@@ -2532,7 +2541,7 @@ function dt({
|
|
|
2532
2541
|
/* @__PURE__ */ m("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
|
|
2533
2542
|
r.nodes.length,
|
|
2534
2543
|
" nodes · Updated ",
|
|
2535
|
-
|
|
2544
|
+
b(r.updatedAt)
|
|
2536
2545
|
] })
|
|
2537
2546
|
] }),
|
|
2538
2547
|
/* @__PURE__ */ m("div", { className: "relative", children: [
|
|
@@ -2553,7 +2562,7 @@ function dt({
|
|
|
2553
2562
|
"button",
|
|
2554
2563
|
{
|
|
2555
2564
|
onClick: (x) => {
|
|
2556
|
-
x.stopPropagation(),
|
|
2565
|
+
x.stopPropagation(), a(!0), p(!1);
|
|
2557
2566
|
},
|
|
2558
2567
|
className: "w-full px-3 py-1.5 text-left text-sm text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700",
|
|
2559
2568
|
children: "Rename"
|
|
@@ -2573,7 +2582,7 @@ function dt({
|
|
|
2573
2582
|
"button",
|
|
2574
2583
|
{
|
|
2575
2584
|
onClick: (x) => {
|
|
2576
|
-
x.stopPropagation(), window.confirm("Delete this workflow?") &&
|
|
2585
|
+
x.stopPropagation(), window.confirm("Delete this workflow?") && o(), p(!1);
|
|
2577
2586
|
},
|
|
2578
2587
|
className: "w-full px-3 py-1.5 text-left text-sm text-red-600 dark:text-red-400 hover:bg-zinc-100 dark:hover:bg-zinc-700",
|
|
2579
2588
|
children: "Delete"
|
|
@@ -2583,24 +2592,24 @@ function dt({
|
|
|
2583
2592
|
] })
|
|
2584
2593
|
] })
|
|
2585
2594
|
] }),
|
|
2586
|
-
|
|
2595
|
+
s && /* @__PURE__ */ e("span", { className: "absolute top-2 right-2 w-2 h-2 bg-teal-500 rounded-full" })
|
|
2587
2596
|
]
|
|
2588
2597
|
}
|
|
2589
2598
|
);
|
|
2590
2599
|
}
|
|
2591
|
-
function
|
|
2592
|
-
const r =
|
|
2600
|
+
function gt() {
|
|
2601
|
+
const r = f((d) => d.showLibrary), s = f((d) => d.toggleLibrary), t = f((d) => d.savedWorkflows), o = f((d) => d.activeWorkflowId), n = f((d) => d.loadWorkflow), i = f((d) => d.deleteWorkflow), l = f((d) => d.renameWorkflow), a = f((d) => d.duplicateWorkflow), c = f((d) => d.newWorkflow);
|
|
2593
2602
|
if (!r) return null;
|
|
2594
2603
|
const u = [...t].sort((d, p) => p.updatedAt - d.updatedAt);
|
|
2595
2604
|
return /* @__PURE__ */ m(j, { children: [
|
|
2596
|
-
/* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick:
|
|
2605
|
+
/* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: s }),
|
|
2597
2606
|
/* @__PURE__ */ m("div", { className: "fixed left-0 top-0 bottom-0 w-80 bg-zinc-50 dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-700 z-50 flex flex-col shadow-xl", children: [
|
|
2598
2607
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
|
|
2599
2608
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: "My Workflows" }),
|
|
2600
2609
|
/* @__PURE__ */ e(
|
|
2601
2610
|
"button",
|
|
2602
2611
|
{
|
|
2603
|
-
onClick:
|
|
2612
|
+
onClick: s,
|
|
2604
2613
|
className: "p-1 text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 rounded",
|
|
2605
2614
|
children: /* @__PURE__ */ e("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
2606
2615
|
"path",
|
|
@@ -2618,7 +2627,7 @@ function lt() {
|
|
|
2618
2627
|
"button",
|
|
2619
2628
|
{
|
|
2620
2629
|
onClick: () => {
|
|
2621
|
-
c(),
|
|
2630
|
+
c(), s(), window.dispatchEvent(new window.CustomEvent("new-workflow-created"));
|
|
2622
2631
|
},
|
|
2623
2632
|
className: "w-full flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-lg hover:bg-teal-700 transition-colors",
|
|
2624
2633
|
children: [
|
|
@@ -2657,16 +2666,16 @@ function lt() {
|
|
|
2657
2666
|
/* @__PURE__ */ e("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No saved workflows yet" }),
|
|
2658
2667
|
/* @__PURE__ */ e("p", { className: "text-xs text-zinc-400 dark:text-zinc-500 mt-1", children: "Build a workflow and save it to see it here" })
|
|
2659
2668
|
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: u.map((d) => /* @__PURE__ */ e(
|
|
2660
|
-
|
|
2669
|
+
ut,
|
|
2661
2670
|
{
|
|
2662
2671
|
workflow: d,
|
|
2663
|
-
isActive: d.id ===
|
|
2672
|
+
isActive: d.id === o,
|
|
2664
2673
|
onLoad: () => {
|
|
2665
|
-
|
|
2674
|
+
n(d.id), s();
|
|
2666
2675
|
},
|
|
2667
2676
|
onDelete: () => i(d.id),
|
|
2668
2677
|
onRename: (p) => l(d.id, p),
|
|
2669
|
-
onDuplicate: () =>
|
|
2678
|
+
onDuplicate: () => a(d.id)
|
|
2670
2679
|
},
|
|
2671
2680
|
d.id
|
|
2672
2681
|
)) }) }),
|
|
@@ -2679,7 +2688,7 @@ function lt() {
|
|
|
2679
2688
|
] })
|
|
2680
2689
|
] });
|
|
2681
2690
|
}
|
|
2682
|
-
const
|
|
2691
|
+
const pt = [
|
|
2683
2692
|
{
|
|
2684
2693
|
id: "openai",
|
|
2685
2694
|
name: "OpenAI",
|
|
@@ -2708,7 +2717,7 @@ const ct = [
|
|
|
2708
2717
|
placeholder: "sk-or-...",
|
|
2709
2718
|
docsUrl: "https://openrouter.ai/keys"
|
|
2710
2719
|
}
|
|
2711
|
-
],
|
|
2720
|
+
], ht = [
|
|
2712
2721
|
{
|
|
2713
2722
|
id: "ollama",
|
|
2714
2723
|
name: "Ollama",
|
|
@@ -2724,16 +2733,16 @@ const ct = [
|
|
|
2724
2733
|
docsUrl: "https://lmstudio.ai"
|
|
2725
2734
|
}
|
|
2726
2735
|
];
|
|
2727
|
-
function
|
|
2728
|
-
const
|
|
2736
|
+
function ft({ provider: r }) {
|
|
2737
|
+
const s = A((h) => h.ai), t = A((h) => h.setAIProvider), o = s[r.id], n = (o == null ? void 0 : o.enabled) ?? !1, i = (o == null ? void 0 : o.apiKey) ?? "", [l, a] = N(i), [c, u] = N(!1), d = () => {
|
|
2729
2738
|
t(r.id, {
|
|
2730
2739
|
apiKey: l,
|
|
2731
|
-
enabled: !
|
|
2740
|
+
enabled: !n
|
|
2732
2741
|
});
|
|
2733
2742
|
}, p = (h) => {
|
|
2734
|
-
|
|
2743
|
+
a(h), t(r.id, {
|
|
2735
2744
|
apiKey: h,
|
|
2736
|
-
enabled:
|
|
2745
|
+
enabled: n
|
|
2737
2746
|
});
|
|
2738
2747
|
};
|
|
2739
2748
|
return /* @__PURE__ */ m("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
|
|
@@ -2794,27 +2803,27 @@ function ut({ provider: r }) {
|
|
|
2794
2803
|
"button",
|
|
2795
2804
|
{
|
|
2796
2805
|
onClick: d,
|
|
2797
|
-
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
|
2806
|
+
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${n ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
|
|
2798
2807
|
children: /* @__PURE__ */ e(
|
|
2799
2808
|
"span",
|
|
2800
2809
|
{
|
|
2801
|
-
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
|
2810
|
+
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${n ? "translate-x-6" : "translate-x-1"}`
|
|
2802
2811
|
}
|
|
2803
2812
|
)
|
|
2804
2813
|
}
|
|
2805
2814
|
) })
|
|
2806
2815
|
] });
|
|
2807
2816
|
}
|
|
2808
|
-
function
|
|
2809
|
-
const
|
|
2817
|
+
function bt({ provider: r }) {
|
|
2818
|
+
const s = A((d) => d.ai), t = A((d) => d.setAIProvider), o = s[r.id], n = (o == null ? void 0 : o.enabled) ?? !1, i = (o == null ? void 0 : o.baseUrl) ?? r.defaultUrl, [l, a] = N(i), c = () => {
|
|
2810
2819
|
t(r.id, {
|
|
2811
2820
|
baseUrl: l,
|
|
2812
|
-
enabled: !
|
|
2821
|
+
enabled: !n
|
|
2813
2822
|
});
|
|
2814
2823
|
}, u = (d) => {
|
|
2815
|
-
|
|
2824
|
+
a(d), t(r.id, {
|
|
2816
2825
|
baseUrl: d,
|
|
2817
|
-
enabled:
|
|
2826
|
+
enabled: n
|
|
2818
2827
|
});
|
|
2819
2828
|
};
|
|
2820
2829
|
return /* @__PURE__ */ m("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
|
|
@@ -2849,19 +2858,19 @@ function gt({ provider: r }) {
|
|
|
2849
2858
|
"button",
|
|
2850
2859
|
{
|
|
2851
2860
|
onClick: c,
|
|
2852
|
-
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
|
2861
|
+
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${n ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
|
|
2853
2862
|
children: /* @__PURE__ */ e(
|
|
2854
2863
|
"span",
|
|
2855
2864
|
{
|
|
2856
|
-
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
|
2865
|
+
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${n ? "translate-x-6" : "translate-x-1"}`
|
|
2857
2866
|
}
|
|
2858
2867
|
)
|
|
2859
2868
|
}
|
|
2860
2869
|
) })
|
|
2861
2870
|
] });
|
|
2862
2871
|
}
|
|
2863
|
-
function
|
|
2864
|
-
const r = A((t) => t.showSettings),
|
|
2872
|
+
function xt() {
|
|
2873
|
+
const r = A((t) => t.showSettings), s = A((t) => t.closeSettings);
|
|
2865
2874
|
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ m("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl max-w-xl w-full mx-4 max-h-[85vh] flex flex-col", children: [
|
|
2866
2875
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
2867
2876
|
/* @__PURE__ */ m("div", { children: [
|
|
@@ -2871,7 +2880,7 @@ function pt() {
|
|
|
2871
2880
|
/* @__PURE__ */ e(
|
|
2872
2881
|
"button",
|
|
2873
2882
|
{
|
|
2874
|
-
onClick:
|
|
2883
|
+
onClick: s,
|
|
2875
2884
|
className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
|
|
2876
2885
|
children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
2877
2886
|
"path",
|
|
@@ -2888,11 +2897,11 @@ function pt() {
|
|
|
2888
2897
|
/* @__PURE__ */ m("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
|
|
2889
2898
|
/* @__PURE__ */ m("section", { children: [
|
|
2890
2899
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Cloud Providers" }),
|
|
2891
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children:
|
|
2900
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: pt.map((t) => /* @__PURE__ */ e(ft, { provider: t }, t.id)) })
|
|
2892
2901
|
] }),
|
|
2893
2902
|
/* @__PURE__ */ m("section", { children: [
|
|
2894
2903
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Local Providers" }),
|
|
2895
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children:
|
|
2904
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: ht.map((t) => /* @__PURE__ */ e(bt, { provider: t }, t.id)) })
|
|
2896
2905
|
] }),
|
|
2897
2906
|
/* @__PURE__ */ e("div", { className: "bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4", children: /* @__PURE__ */ m("div", { className: "flex items-start gap-3", children: [
|
|
2898
2907
|
/* @__PURE__ */ e(
|
|
@@ -2922,47 +2931,47 @@ function pt() {
|
|
|
2922
2931
|
/* @__PURE__ */ e("div", { className: "flex justify-end px-6 py-4 border-t border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e(
|
|
2923
2932
|
"button",
|
|
2924
2933
|
{
|
|
2925
|
-
onClick:
|
|
2934
|
+
onClick: s,
|
|
2926
2935
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
|
|
2927
2936
|
children: "Done"
|
|
2928
2937
|
}
|
|
2929
2938
|
) })
|
|
2930
2939
|
] }) }) : null;
|
|
2931
2940
|
}
|
|
2932
|
-
function
|
|
2933
|
-
const [r,
|
|
2941
|
+
function St() {
|
|
2942
|
+
const [r, s] = N("editor"), t = f((a) => a.addNode), o = f((a) => a.loadTemplate);
|
|
2934
2943
|
$(() => {
|
|
2935
2944
|
const c = new URLSearchParams(window.location.search).get("template");
|
|
2936
2945
|
if (c) {
|
|
2937
|
-
const u =
|
|
2938
|
-
u && (
|
|
2946
|
+
const u = ae(c);
|
|
2947
|
+
u && (o(u), window.history.replaceState({}, "", window.location.pathname));
|
|
2939
2948
|
}
|
|
2940
|
-
}, [
|
|
2941
|
-
const
|
|
2942
|
-
|
|
2949
|
+
}, [o]), $(() => {
|
|
2950
|
+
const a = () => {
|
|
2951
|
+
s("editor");
|
|
2943
2952
|
};
|
|
2944
|
-
return window.addEventListener("workflow-loaded",
|
|
2945
|
-
window.removeEventListener("workflow-loaded",
|
|
2953
|
+
return window.addEventListener("workflow-loaded", a), () => {
|
|
2954
|
+
window.removeEventListener("workflow-loaded", a);
|
|
2946
2955
|
};
|
|
2947
2956
|
}, []);
|
|
2948
|
-
const
|
|
2949
|
-
(
|
|
2950
|
-
const c =
|
|
2951
|
-
c && (
|
|
2957
|
+
const n = C(
|
|
2958
|
+
(a) => {
|
|
2959
|
+
const c = ae(a);
|
|
2960
|
+
c && (o(c), s("editor"));
|
|
2952
2961
|
},
|
|
2953
|
-
[
|
|
2962
|
+
[o]
|
|
2954
2963
|
), i = C(
|
|
2955
|
-
(
|
|
2964
|
+
(a) => {
|
|
2956
2965
|
var u;
|
|
2957
|
-
|
|
2958
|
-
const c =
|
|
2966
|
+
a.preventDefault();
|
|
2967
|
+
const c = a.dataTransfer.getData("application/json");
|
|
2959
2968
|
if (c)
|
|
2960
2969
|
try {
|
|
2961
2970
|
const d = JSON.parse(c), p = (u = document.querySelector(".react-flow")) == null ? void 0 : u.getBoundingClientRect();
|
|
2962
2971
|
if (!p) return;
|
|
2963
2972
|
const h = {
|
|
2964
|
-
x:
|
|
2965
|
-
y:
|
|
2973
|
+
x: a.clientX - p.left,
|
|
2974
|
+
y: a.clientY - p.top
|
|
2966
2975
|
};
|
|
2967
2976
|
t(d, h);
|
|
2968
2977
|
} catch (d) {
|
|
@@ -2970,19 +2979,19 @@ function yt() {
|
|
|
2970
2979
|
}
|
|
2971
2980
|
},
|
|
2972
2981
|
[t]
|
|
2973
|
-
), l = C((
|
|
2974
|
-
|
|
2982
|
+
), l = C((a) => {
|
|
2983
|
+
a.preventDefault(), a.dataTransfer.dropEffect = "move";
|
|
2975
2984
|
}, []);
|
|
2976
|
-
return /* @__PURE__ */ m(
|
|
2977
|
-
/* @__PURE__ */ e(
|
|
2978
|
-
/* @__PURE__ */ e(
|
|
2985
|
+
return /* @__PURE__ */ m(ve, { children: [
|
|
2986
|
+
/* @__PURE__ */ e(xt, {}),
|
|
2987
|
+
/* @__PURE__ */ e(gt, {}),
|
|
2979
2988
|
/* @__PURE__ */ m("div", { className: "h-screen flex flex-col bg-gray-100 dark:bg-zinc-900", children: [
|
|
2980
|
-
/* @__PURE__ */ e(
|
|
2989
|
+
/* @__PURE__ */ e(Ye, {}),
|
|
2981
2990
|
/* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ m("div", { className: "flex", children: [
|
|
2982
2991
|
/* @__PURE__ */ e(
|
|
2983
2992
|
"button",
|
|
2984
2993
|
{
|
|
2985
|
-
onClick: () =>
|
|
2994
|
+
onClick: () => s("editor"),
|
|
2986
2995
|
className: `px-6 py-3 text-sm font-medium border-b-2 transition-colors ${r === "editor" ? "border-teal-500 text-teal-600 dark:text-teal-400" : "border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200"}`,
|
|
2987
2996
|
children: "Editor"
|
|
2988
2997
|
}
|
|
@@ -2990,7 +2999,7 @@ function yt() {
|
|
|
2990
2999
|
/* @__PURE__ */ e(
|
|
2991
3000
|
"button",
|
|
2992
3001
|
{
|
|
2993
|
-
onClick: () =>
|
|
3002
|
+
onClick: () => s("gallery"),
|
|
2994
3003
|
className: `px-6 py-3 text-sm font-medium border-b-2 transition-colors ${r === "gallery" ? "border-teal-500 text-teal-600 dark:text-teal-400" : "border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200"}`,
|
|
2995
3004
|
children: "Gallery"
|
|
2996
3005
|
}
|
|
@@ -2998,7 +3007,7 @@ function yt() {
|
|
|
2998
3007
|
/* @__PURE__ */ e(
|
|
2999
3008
|
"button",
|
|
3000
3009
|
{
|
|
3001
|
-
onClick: () =>
|
|
3010
|
+
onClick: () => s("templates"),
|
|
3002
3011
|
className: `px-6 py-3 text-sm font-medium border-b-2 transition-colors ${r === "templates" ? "border-teal-500 text-teal-600 dark:text-teal-400" : "border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200"}`,
|
|
3003
3012
|
children: "Templates"
|
|
3004
3013
|
}
|
|
@@ -3006,31 +3015,32 @@ function yt() {
|
|
|
3006
3015
|
] }) }),
|
|
3007
3016
|
/* @__PURE__ */ m("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
3008
3017
|
r === "editor" && /* @__PURE__ */ m(j, { children: [
|
|
3009
|
-
/* @__PURE__ */ e(
|
|
3010
|
-
/* @__PURE__ */ e("div", { className: "flex-1", onDrop: i, onDragOver: l, children: /* @__PURE__ */ e(
|
|
3011
|
-
/* @__PURE__ */ e(
|
|
3018
|
+
/* @__PURE__ */ e(Ve, {}),
|
|
3019
|
+
/* @__PURE__ */ e("div", { className: "flex-1", onDrop: i, onDragOver: l, children: /* @__PURE__ */ e(Ge, {}) }),
|
|
3020
|
+
/* @__PURE__ */ e(Ke, {})
|
|
3012
3021
|
] }),
|
|
3013
|
-
r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(
|
|
3014
|
-
r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(
|
|
3022
|
+
r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(Xe, {}) }),
|
|
3023
|
+
r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(ct, { onSelect: n }) })
|
|
3015
3024
|
] })
|
|
3016
3025
|
] })
|
|
3017
3026
|
] });
|
|
3018
3027
|
}
|
|
3019
3028
|
export {
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3029
|
+
xt as AISettings,
|
|
3030
|
+
St as App,
|
|
3031
|
+
Xe as Gallery,
|
|
3032
|
+
Ke as NodeInspector,
|
|
3033
|
+
Ve as NodePalette,
|
|
3034
|
+
ct as TemplateGallery,
|
|
3035
|
+
Ye as Toolbar,
|
|
3036
|
+
Fe as UploadGallery,
|
|
3037
|
+
Ge as WorkflowEditor,
|
|
3038
|
+
gt as WorkflowLibrary,
|
|
3039
|
+
lt as getCategories,
|
|
3040
|
+
ae as getTemplateById,
|
|
3041
|
+
zt as getTemplatesByCategory,
|
|
3042
|
+
Ct as searchTemplates,
|
|
3033
3043
|
E as templates,
|
|
3034
|
-
|
|
3044
|
+
f as useWorkflowStore
|
|
3035
3045
|
};
|
|
3036
3046
|
//# sourceMappingURL=index.js.map
|