@teamflojo/floimg-studio-ui 0.1.5 → 0.1.6
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/LICENSE +21 -0
- package/dist/api/client.d.ts +19 -0
- package/dist/components/ImportModal.d.ts +9 -0
- package/dist/index.js +1349 -1032
- package/dist/index.js.map +1 -1
- package/dist/stores/workflowStore.d.ts +2 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as T, useRef as
|
|
3
|
-
import
|
|
4
|
-
import { create as
|
|
5
|
-
import { useQuery as
|
|
6
|
-
function
|
|
1
|
+
import { jsxs as c, jsx as e, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { memo as T, useRef as xe, useCallback as C, useState as N, useEffect as M, useMemo as te } from "react";
|
|
3
|
+
import ke, { Handle as L, Position as W, applyNodeChanges as we, applyEdgeChanges as ve, MarkerType as ye, Background as Ne, Controls as ze, MiniMap as Ce, ReactFlowProvider as Se } from "reactflow";
|
|
4
|
+
import { create as se } from "zustand";
|
|
5
|
+
import { useQuery as _ } from "@tanstack/react-query";
|
|
6
|
+
function Ie(r, i) {
|
|
7
7
|
let t;
|
|
8
8
|
try {
|
|
9
9
|
t = r();
|
|
@@ -11,238 +11,250 @@ function ye(r, s) {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
|
-
getItem: (
|
|
15
|
-
var
|
|
16
|
-
const
|
|
17
|
-
return
|
|
14
|
+
getItem: (s) => {
|
|
15
|
+
var d;
|
|
16
|
+
const m = (n) => n === null ? null : JSON.parse(n, void 0), o = (d = t.getItem(s)) != null ? d : null;
|
|
17
|
+
return o instanceof Promise ? o.then(m) : m(o);
|
|
18
18
|
},
|
|
19
|
-
setItem: (
|
|
20
|
-
removeItem: (
|
|
19
|
+
setItem: (s, d) => t.setItem(s, JSON.stringify(d, void 0)),
|
|
20
|
+
removeItem: (s) => t.removeItem(s)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const H = (r) => (i) => {
|
|
24
24
|
try {
|
|
25
|
-
const t = r(
|
|
25
|
+
const t = r(i);
|
|
26
26
|
return t instanceof Promise ? t : {
|
|
27
|
-
then(
|
|
28
|
-
return
|
|
27
|
+
then(a) {
|
|
28
|
+
return H(a)(t);
|
|
29
29
|
},
|
|
30
|
-
catch(
|
|
30
|
+
catch(a) {
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
} catch (t) {
|
|
35
35
|
return {
|
|
36
|
-
then(
|
|
36
|
+
then(a) {
|
|
37
37
|
return this;
|
|
38
38
|
},
|
|
39
|
-
catch(
|
|
40
|
-
return
|
|
39
|
+
catch(a) {
|
|
40
|
+
return H(a)(t);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
},
|
|
45
|
-
let
|
|
46
|
-
storage:
|
|
44
|
+
}, Le = (r, i) => (t, a, s) => {
|
|
45
|
+
let d = {
|
|
46
|
+
storage: Ie(() => localStorage),
|
|
47
47
|
partialize: (g) => g,
|
|
48
48
|
version: 0,
|
|
49
|
-
merge: (g,
|
|
50
|
-
...
|
|
49
|
+
merge: (g, v) => ({
|
|
50
|
+
...v,
|
|
51
51
|
...g
|
|
52
52
|
}),
|
|
53
|
-
...
|
|
54
|
-
},
|
|
55
|
-
const
|
|
56
|
-
let u =
|
|
53
|
+
...i
|
|
54
|
+
}, m = !1;
|
|
55
|
+
const o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
56
|
+
let u = d.storage;
|
|
57
57
|
if (!u)
|
|
58
58
|
return r(
|
|
59
59
|
(...g) => {
|
|
60
60
|
console.warn(
|
|
61
|
-
`[zustand persist middleware] Unable to update item '${
|
|
61
|
+
`[zustand persist middleware] Unable to update item '${d.name}', the given storage is currently unavailable.`
|
|
62
62
|
), t(...g);
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
a,
|
|
65
|
+
s
|
|
66
66
|
);
|
|
67
|
-
const
|
|
68
|
-
const g =
|
|
69
|
-
return u.setItem(
|
|
67
|
+
const l = () => {
|
|
68
|
+
const g = d.partialize({ ...a() });
|
|
69
|
+
return u.setItem(d.name, {
|
|
70
70
|
state: g,
|
|
71
|
-
version:
|
|
71
|
+
version: d.version
|
|
72
72
|
});
|
|
73
|
-
}, p =
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
(...g) => (t(...g),
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
}, p = s.setState;
|
|
74
|
+
s.setState = (g, v) => (p(g, v), l());
|
|
75
|
+
const f = r(
|
|
76
|
+
(...g) => (t(...g), l()),
|
|
77
|
+
a,
|
|
78
|
+
s
|
|
79
79
|
);
|
|
80
|
-
|
|
80
|
+
s.getInitialState = () => f;
|
|
81
81
|
let b;
|
|
82
|
-
const
|
|
83
|
-
var g,
|
|
82
|
+
const k = () => {
|
|
83
|
+
var g, v;
|
|
84
84
|
if (!u) return;
|
|
85
|
-
|
|
85
|
+
m = !1, o.forEach((h) => {
|
|
86
86
|
var z;
|
|
87
|
-
return
|
|
87
|
+
return h((z = a()) != null ? z : f);
|
|
88
88
|
});
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
if (
|
|
92
|
-
if (typeof
|
|
93
|
-
if (
|
|
94
|
-
const z =
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
const w = ((v = d.onRehydrateStorage) == null ? void 0 : v.call(d, (g = a()) != null ? g : f)) || void 0;
|
|
90
|
+
return H(u.getItem.bind(u))(d.name).then((h) => {
|
|
91
|
+
if (h)
|
|
92
|
+
if (typeof h.version == "number" && h.version !== d.version) {
|
|
93
|
+
if (d.migrate) {
|
|
94
|
+
const z = d.migrate(
|
|
95
|
+
h.state,
|
|
96
|
+
h.version
|
|
97
97
|
);
|
|
98
|
-
return z instanceof Promise ? z.then((
|
|
98
|
+
return z instanceof Promise ? z.then((S) => [!0, S]) : [!0, z];
|
|
99
99
|
}
|
|
100
100
|
console.error(
|
|
101
101
|
"State loaded from storage couldn't be migrated since no migrate function was provided"
|
|
102
102
|
);
|
|
103
103
|
} else
|
|
104
|
-
return [!1,
|
|
104
|
+
return [!1, h.state];
|
|
105
105
|
return [!1, void 0];
|
|
106
|
-
}).then((
|
|
106
|
+
}).then((h) => {
|
|
107
107
|
var z;
|
|
108
|
-
const [
|
|
109
|
-
if (b =
|
|
110
|
-
|
|
111
|
-
(z =
|
|
112
|
-
), t(b, !0),
|
|
113
|
-
return
|
|
108
|
+
const [S, B] = h;
|
|
109
|
+
if (b = d.merge(
|
|
110
|
+
B,
|
|
111
|
+
(z = a()) != null ? z : f
|
|
112
|
+
), t(b, !0), S)
|
|
113
|
+
return l();
|
|
114
114
|
}).then(() => {
|
|
115
|
-
|
|
116
|
-
}).catch((
|
|
117
|
-
|
|
115
|
+
w == null || w(b, void 0), b = a(), m = !0, n.forEach((h) => h(b));
|
|
116
|
+
}).catch((h) => {
|
|
117
|
+
w == null || w(void 0, h);
|
|
118
118
|
});
|
|
119
119
|
};
|
|
120
|
-
return
|
|
120
|
+
return s.persist = {
|
|
121
121
|
setOptions: (g) => {
|
|
122
|
-
|
|
123
|
-
...
|
|
122
|
+
d = {
|
|
123
|
+
...d,
|
|
124
124
|
...g
|
|
125
125
|
}, g.storage && (u = g.storage);
|
|
126
126
|
},
|
|
127
127
|
clearStorage: () => {
|
|
128
|
-
u == null || u.removeItem(
|
|
128
|
+
u == null || u.removeItem(d.name);
|
|
129
129
|
},
|
|
130
|
-
getOptions: () =>
|
|
131
|
-
rehydrate: () =>
|
|
132
|
-
hasHydrated: () =>
|
|
133
|
-
onHydrate: (g) => (
|
|
134
|
-
|
|
130
|
+
getOptions: () => d,
|
|
131
|
+
rehydrate: () => k(),
|
|
132
|
+
hasHydrated: () => m,
|
|
133
|
+
onHydrate: (g) => (o.add(g), () => {
|
|
134
|
+
o.delete(g);
|
|
135
135
|
}),
|
|
136
|
-
onFinishHydration: (g) => (
|
|
137
|
-
|
|
136
|
+
onFinishHydration: (g) => (n.add(g), () => {
|
|
137
|
+
n.delete(g);
|
|
138
138
|
})
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
async function
|
|
139
|
+
}, d.skipHydration || k(), b || f;
|
|
140
|
+
}, ie = Le, I = "/api";
|
|
141
|
+
async function A(r, i) {
|
|
142
142
|
const t = await fetch(r, {
|
|
143
|
-
...
|
|
143
|
+
...i,
|
|
144
144
|
headers: {
|
|
145
145
|
"Content-Type": "application/json",
|
|
146
|
-
...
|
|
146
|
+
...i == null ? void 0 : i.headers
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
if (!t.ok) {
|
|
150
|
-
const
|
|
151
|
-
throw new Error(
|
|
150
|
+
const a = await t.json().catch(() => ({ error: "Unknown error" }));
|
|
151
|
+
throw new Error(a.error || `HTTP ${t.status}`);
|
|
152
152
|
}
|
|
153
153
|
return t.json();
|
|
154
154
|
}
|
|
155
|
-
async function
|
|
156
|
-
return
|
|
155
|
+
async function We() {
|
|
156
|
+
return A(`${I}/nodes/generators`);
|
|
157
157
|
}
|
|
158
|
-
async function
|
|
159
|
-
return
|
|
158
|
+
async function Ae() {
|
|
159
|
+
return A(`${I}/nodes/transforms`);
|
|
160
160
|
}
|
|
161
|
-
async function
|
|
162
|
-
return
|
|
161
|
+
async function De(r, i, t) {
|
|
162
|
+
return A(`${I}/execute/sync`, {
|
|
163
163
|
method: "POST",
|
|
164
|
-
body: JSON.stringify({ nodes: r, edges:
|
|
164
|
+
body: JSON.stringify({ nodes: r, edges: i, aiProviders: t })
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
async function
|
|
168
|
-
return
|
|
167
|
+
async function $e(r, i) {
|
|
168
|
+
return A(`${I}/export/yaml`, {
|
|
169
169
|
method: "POST",
|
|
170
|
-
body: JSON.stringify({ nodes: r, edges:
|
|
170
|
+
body: JSON.stringify({ nodes: r, edges: i })
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
async function
|
|
174
|
-
return
|
|
173
|
+
async function Me() {
|
|
174
|
+
return A(`${I}/images`);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
return `${
|
|
176
|
+
function F(r) {
|
|
177
|
+
return `${I}/images/${r}/blob`;
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
179
|
+
async function je(r) {
|
|
180
180
|
try {
|
|
181
|
-
return await
|
|
181
|
+
return await A(`${I}/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 Pe(r) {
|
|
187
|
+
const i = new FormData();
|
|
188
|
+
i.append("file", r);
|
|
189
|
+
const t = await fetch(`${I}/uploads`, {
|
|
190
190
|
method: "POST",
|
|
191
|
-
body:
|
|
191
|
+
body: i
|
|
192
192
|
});
|
|
193
193
|
if (!t.ok) {
|
|
194
|
-
const
|
|
195
|
-
throw new Error(
|
|
194
|
+
const a = await t.json().catch(() => ({ error: "Upload failed" }));
|
|
195
|
+
throw new Error(a.error || `HTTP ${t.status}`);
|
|
196
196
|
}
|
|
197
197
|
return t.json();
|
|
198
198
|
}
|
|
199
|
-
async function
|
|
200
|
-
return
|
|
199
|
+
async function Te() {
|
|
200
|
+
return A(`${I}/uploads`);
|
|
201
201
|
}
|
|
202
|
-
async function
|
|
203
|
-
const
|
|
202
|
+
async function Ue(r) {
|
|
203
|
+
const i = await fetch(`${I}/uploads/${r}`, {
|
|
204
204
|
method: "DELETE"
|
|
205
205
|
});
|
|
206
|
-
if (!
|
|
207
|
-
throw new Error(`Failed to delete upload: ${
|
|
206
|
+
if (!i.ok)
|
|
207
|
+
throw new Error(`Failed to delete upload: ${i.status}`);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return `${
|
|
209
|
+
function de(r) {
|
|
210
|
+
return `${I}/uploads/${r}/blob`;
|
|
211
211
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
async function Ee(r) {
|
|
213
|
+
return A(`${I}/import`, {
|
|
214
|
+
method: "POST",
|
|
215
|
+
body: JSON.stringify({ yaml: r })
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
async function Oe(r) {
|
|
219
|
+
return A(`${I}/import/validate`, {
|
|
220
|
+
method: "POST",
|
|
221
|
+
body: JSON.stringify({ yaml: r })
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
const re = "http://localhost:11434", ae = "http://localhost:1234", $ = se()(
|
|
225
|
+
ie(
|
|
226
|
+
(r, i) => ({
|
|
215
227
|
ai: {
|
|
216
228
|
ollama: {
|
|
217
|
-
baseUrl:
|
|
229
|
+
baseUrl: re,
|
|
218
230
|
enabled: !1
|
|
219
231
|
},
|
|
220
232
|
lmstudio: {
|
|
221
|
-
baseUrl:
|
|
233
|
+
baseUrl: ae,
|
|
222
234
|
enabled: !1
|
|
223
235
|
}
|
|
224
236
|
},
|
|
225
237
|
showSettings: !1,
|
|
226
|
-
setAIProvider: (t,
|
|
227
|
-
r((
|
|
238
|
+
setAIProvider: (t, a) => {
|
|
239
|
+
r((s) => ({
|
|
228
240
|
ai: {
|
|
229
|
-
...
|
|
230
|
-
[t]:
|
|
241
|
+
...s.ai,
|
|
242
|
+
[t]: a
|
|
231
243
|
}
|
|
232
244
|
}));
|
|
233
245
|
},
|
|
234
246
|
clearAIProvider: (t) => {
|
|
235
|
-
r((
|
|
236
|
-
const
|
|
237
|
-
return delete
|
|
247
|
+
r((a) => {
|
|
248
|
+
const s = { ...a.ai };
|
|
249
|
+
return delete s[t], { ai: s };
|
|
238
250
|
});
|
|
239
251
|
},
|
|
240
252
|
openSettings: () => r({ showSettings: !0 }),
|
|
241
253
|
closeSettings: () => r({ showSettings: !1 }),
|
|
242
254
|
getConfiguredProviders: () => {
|
|
243
|
-
var
|
|
244
|
-
const { ai: t } =
|
|
245
|
-
return (
|
|
255
|
+
var s, d, m, o, n, u;
|
|
256
|
+
const { ai: t } = i(), a = {};
|
|
257
|
+
return (s = t.openai) != null && s.enabled && t.openai.apiKey && (a.openai = { apiKey: t.openai.apiKey }), (d = t.anthropic) != null && d.enabled && t.anthropic.apiKey && (a.anthropic = { apiKey: t.anthropic.apiKey }), (m = t.gemini) != null && m.enabled && t.gemini.apiKey && (a.gemini = { apiKey: t.gemini.apiKey }), (o = t.openrouter) != null && o.enabled && t.openrouter.apiKey && (a.openrouter = { apiKey: t.openrouter.apiKey }), (n = t.ollama) != null && n.enabled && (a.ollama = { baseUrl: t.ollama.baseUrl || re }), (u = t.lmstudio) != null && u.enabled && (a.lmstudio = { baseUrl: t.lmstudio.baseUrl || ae }), a;
|
|
246
258
|
}
|
|
247
259
|
}),
|
|
248
260
|
{
|
|
@@ -252,17 +264,17 @@ const Z = "http://localhost:11434", ee = "http://localhost:1234", A = oe()(
|
|
|
252
264
|
}
|
|
253
265
|
)
|
|
254
266
|
);
|
|
255
|
-
let
|
|
256
|
-
function
|
|
257
|
-
return `node_${++
|
|
267
|
+
let Be = 0;
|
|
268
|
+
function K() {
|
|
269
|
+
return `node_${++Be}`;
|
|
258
270
|
}
|
|
259
|
-
function
|
|
260
|
-
const r = Date.now(),
|
|
261
|
-
return `wf_${r}_${
|
|
271
|
+
function oe() {
|
|
272
|
+
const r = Date.now(), i = Math.random().toString(36).substring(2, 8);
|
|
273
|
+
return `wf_${r}_${i}`;
|
|
262
274
|
}
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
(r,
|
|
275
|
+
const x = se()(
|
|
276
|
+
ie(
|
|
277
|
+
(r, i) => ({
|
|
266
278
|
nodes: [],
|
|
267
279
|
edges: [],
|
|
268
280
|
selectedNodeId: null,
|
|
@@ -284,25 +296,25 @@ const f = oe()(
|
|
|
284
296
|
nodeStatus: {}
|
|
285
297
|
},
|
|
286
298
|
loadTemplate: (t) => {
|
|
287
|
-
const
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
id:
|
|
291
|
-
type:
|
|
292
|
-
position:
|
|
293
|
-
data:
|
|
299
|
+
const a = /* @__PURE__ */ new Map(), s = t.workflow.nodes.map((m) => {
|
|
300
|
+
const o = K();
|
|
301
|
+
return a.set(m.id, o), {
|
|
302
|
+
id: o,
|
|
303
|
+
type: m.type,
|
|
304
|
+
position: m.position,
|
|
305
|
+
data: m.data
|
|
294
306
|
};
|
|
295
|
-
}),
|
|
296
|
-
const
|
|
307
|
+
}), d = t.workflow.edges.map((m) => {
|
|
308
|
+
const o = a.get(m.source) || m.source, n = a.get(m.target) || m.target;
|
|
297
309
|
return {
|
|
298
|
-
id: `edge_${
|
|
299
|
-
source:
|
|
300
|
-
target:
|
|
310
|
+
id: `edge_${o}_${n}`,
|
|
311
|
+
source: o,
|
|
312
|
+
target: n
|
|
301
313
|
};
|
|
302
314
|
});
|
|
303
315
|
r({
|
|
304
|
-
nodes:
|
|
305
|
-
edges:
|
|
316
|
+
nodes: s,
|
|
317
|
+
edges: d,
|
|
306
318
|
selectedNodeId: null,
|
|
307
319
|
currentTemplateId: t.id,
|
|
308
320
|
previewVisible: {},
|
|
@@ -332,114 +344,128 @@ const f = oe()(
|
|
|
332
344
|
});
|
|
333
345
|
},
|
|
334
346
|
togglePreview: (t) => {
|
|
335
|
-
r((
|
|
347
|
+
r((a) => ({
|
|
336
348
|
previewVisible: {
|
|
337
|
-
...
|
|
338
|
-
[t]:
|
|
349
|
+
...a.previewVisible,
|
|
350
|
+
[t]: a.previewVisible[t] === !1
|
|
339
351
|
// default true, toggle
|
|
340
352
|
}
|
|
341
353
|
}));
|
|
342
354
|
},
|
|
343
355
|
setGenerators: (t) => r({ generators: t }),
|
|
344
356
|
setTransforms: (t) => r({ transforms: t }),
|
|
345
|
-
addNode: (t,
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
357
|
+
addNode: (t, a) => {
|
|
358
|
+
var o, n, u;
|
|
359
|
+
const s = K();
|
|
360
|
+
let d;
|
|
361
|
+
if (t.type === "generator")
|
|
362
|
+
d = {
|
|
363
|
+
generatorName: t.name,
|
|
364
|
+
params: R(t)
|
|
365
|
+
};
|
|
366
|
+
else if (t.type === "transform")
|
|
367
|
+
d = {
|
|
368
|
+
operation: t.name,
|
|
369
|
+
params: R(t)
|
|
370
|
+
};
|
|
371
|
+
else if (t.type === "input")
|
|
372
|
+
d = {
|
|
373
|
+
uploadId: void 0,
|
|
374
|
+
filename: void 0,
|
|
375
|
+
mime: void 0
|
|
376
|
+
};
|
|
377
|
+
else if (t.type === "vision")
|
|
378
|
+
d = {
|
|
379
|
+
providerName: t.name,
|
|
380
|
+
params: R(t)
|
|
381
|
+
};
|
|
382
|
+
else if (t.type === "text")
|
|
383
|
+
d = {
|
|
384
|
+
providerName: t.name,
|
|
385
|
+
params: R(t)
|
|
386
|
+
};
|
|
387
|
+
else {
|
|
388
|
+
const l = ((o = t.params) == null ? void 0 : o.properties) || {}, p = ((n = l.provider) == null ? void 0 : n.default) || "filesystem";
|
|
389
|
+
d = {
|
|
390
|
+
destination: ((u = l.destination) == null ? void 0 : u.default) || "./output/image.png",
|
|
391
|
+
provider: p
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
const m = {
|
|
395
|
+
id: s,
|
|
370
396
|
type: t.type,
|
|
371
|
-
position:
|
|
372
|
-
data:
|
|
397
|
+
position: a,
|
|
398
|
+
data: d
|
|
373
399
|
};
|
|
374
|
-
r((
|
|
375
|
-
nodes: [...
|
|
400
|
+
r((l) => ({
|
|
401
|
+
nodes: [...l.nodes, m]
|
|
376
402
|
}));
|
|
377
403
|
},
|
|
378
|
-
updateNodeData: (t,
|
|
379
|
-
r((
|
|
380
|
-
nodes:
|
|
381
|
-
(
|
|
404
|
+
updateNodeData: (t, a) => {
|
|
405
|
+
r((s) => ({
|
|
406
|
+
nodes: s.nodes.map(
|
|
407
|
+
(d) => d.id === t ? { ...d, data: { ...d.data, ...a } } : d
|
|
382
408
|
)
|
|
383
409
|
}));
|
|
384
410
|
},
|
|
385
411
|
deleteNode: (t) => {
|
|
386
|
-
r((
|
|
387
|
-
nodes:
|
|
388
|
-
edges:
|
|
389
|
-
selectedNodeId:
|
|
412
|
+
r((a) => ({
|
|
413
|
+
nodes: a.nodes.filter((s) => s.id !== t),
|
|
414
|
+
edges: a.edges.filter((s) => s.source !== t && s.target !== t),
|
|
415
|
+
selectedNodeId: a.selectedNodeId === t ? null : a.selectedNodeId
|
|
390
416
|
}));
|
|
391
417
|
},
|
|
392
418
|
setNodes: (t) => r({ nodes: t }),
|
|
393
419
|
addEdge: (t) => {
|
|
394
420
|
if (!t.source || !t.target) return;
|
|
395
|
-
const
|
|
421
|
+
const s = {
|
|
396
422
|
id: `edge_${t.source}_${t.target}`,
|
|
397
423
|
source: t.source,
|
|
398
424
|
target: t.target
|
|
399
425
|
};
|
|
400
|
-
r((
|
|
401
|
-
edges: [...
|
|
426
|
+
r((d) => ({
|
|
427
|
+
edges: [...d.edges, s]
|
|
402
428
|
}));
|
|
403
429
|
},
|
|
404
430
|
deleteEdge: (t) => {
|
|
405
|
-
r((
|
|
406
|
-
edges:
|
|
431
|
+
r((a) => ({
|
|
432
|
+
edges: a.edges.filter((s) => s.id !== t)
|
|
407
433
|
}));
|
|
408
434
|
},
|
|
409
435
|
setEdges: (t) => r({ edges: t }),
|
|
410
436
|
setSelectedNode: (t) => r({ selectedNodeId: t }),
|
|
411
437
|
execute: async () => {
|
|
412
|
-
const { nodes: t, edges:
|
|
413
|
-
id:
|
|
414
|
-
type:
|
|
415
|
-
position:
|
|
416
|
-
data:
|
|
417
|
-
})),
|
|
418
|
-
id:
|
|
419
|
-
source:
|
|
420
|
-
target:
|
|
421
|
-
})),
|
|
422
|
-
for (const
|
|
423
|
-
|
|
438
|
+
const { nodes: t, edges: a } = i(), s = t.map((n) => ({
|
|
439
|
+
id: n.id,
|
|
440
|
+
type: n.type,
|
|
441
|
+
position: n.position,
|
|
442
|
+
data: n.data
|
|
443
|
+
})), d = a.map((n) => ({
|
|
444
|
+
id: n.id,
|
|
445
|
+
source: n.source,
|
|
446
|
+
target: n.target
|
|
447
|
+
})), m = $.getState().getConfiguredProviders(), o = {};
|
|
448
|
+
for (const n of t)
|
|
449
|
+
o[n.id] = "running";
|
|
424
450
|
r({
|
|
425
451
|
execution: {
|
|
426
452
|
status: "running",
|
|
427
453
|
imageIds: [],
|
|
428
454
|
previews: {},
|
|
429
455
|
dataOutputs: {},
|
|
430
|
-
nodeStatus:
|
|
456
|
+
nodeStatus: o
|
|
431
457
|
}
|
|
432
458
|
});
|
|
433
459
|
try {
|
|
434
|
-
const
|
|
435
|
-
for (const
|
|
436
|
-
u[
|
|
437
|
-
|
|
460
|
+
const n = await De(s, d, m), u = {};
|
|
461
|
+
for (const l of t)
|
|
462
|
+
u[l.id] = n.status === "completed" ? "completed" : "error";
|
|
463
|
+
n.status === "completed" ? r({
|
|
438
464
|
execution: {
|
|
439
465
|
status: "completed",
|
|
440
|
-
imageIds:
|
|
441
|
-
previews:
|
|
442
|
-
dataOutputs:
|
|
466
|
+
imageIds: n.imageIds,
|
|
467
|
+
previews: n.previews || {},
|
|
468
|
+
dataOutputs: n.dataOutputs || {},
|
|
443
469
|
nodeStatus: u
|
|
444
470
|
}
|
|
445
471
|
}) : r({
|
|
@@ -449,13 +475,13 @@ const f = oe()(
|
|
|
449
475
|
previews: {},
|
|
450
476
|
dataOutputs: {},
|
|
451
477
|
nodeStatus: u,
|
|
452
|
-
error:
|
|
478
|
+
error: n.error
|
|
453
479
|
}
|
|
454
480
|
});
|
|
455
|
-
} catch (
|
|
481
|
+
} catch (n) {
|
|
456
482
|
const u = {};
|
|
457
|
-
for (const
|
|
458
|
-
u[
|
|
483
|
+
for (const l of t)
|
|
484
|
+
u[l.id] = "error";
|
|
459
485
|
r({
|
|
460
486
|
execution: {
|
|
461
487
|
status: "error",
|
|
@@ -463,23 +489,58 @@ const f = oe()(
|
|
|
463
489
|
previews: {},
|
|
464
490
|
dataOutputs: {},
|
|
465
491
|
nodeStatus: u,
|
|
466
|
-
error:
|
|
492
|
+
error: n instanceof Error ? n.message : "Unknown error"
|
|
467
493
|
}
|
|
468
494
|
});
|
|
469
495
|
}
|
|
470
496
|
},
|
|
471
497
|
exportToYaml: async () => {
|
|
472
|
-
const { nodes: t, edges:
|
|
473
|
-
id:
|
|
474
|
-
type:
|
|
475
|
-
position:
|
|
476
|
-
data:
|
|
477
|
-
})),
|
|
478
|
-
id:
|
|
479
|
-
source:
|
|
480
|
-
target:
|
|
498
|
+
const { nodes: t, edges: a } = i(), s = t.map((o) => ({
|
|
499
|
+
id: o.id,
|
|
500
|
+
type: o.type,
|
|
501
|
+
position: o.position,
|
|
502
|
+
data: o.data
|
|
503
|
+
})), d = a.map((o) => ({
|
|
504
|
+
id: o.id,
|
|
505
|
+
source: o.source,
|
|
506
|
+
target: o.target
|
|
481
507
|
}));
|
|
482
|
-
return (await
|
|
508
|
+
return (await $e(s, d)).yaml;
|
|
509
|
+
},
|
|
510
|
+
importFromYaml: (t, a, s) => {
|
|
511
|
+
const d = /* @__PURE__ */ new Map(), m = t.map((n) => {
|
|
512
|
+
const u = K();
|
|
513
|
+
return d.set(n.id, u), {
|
|
514
|
+
id: u,
|
|
515
|
+
type: n.type,
|
|
516
|
+
position: n.position,
|
|
517
|
+
data: n.data
|
|
518
|
+
};
|
|
519
|
+
}), o = a.map((n) => {
|
|
520
|
+
const u = d.get(n.source) || n.source, l = d.get(n.target) || n.target;
|
|
521
|
+
return {
|
|
522
|
+
id: `edge_${u}_${l}`,
|
|
523
|
+
source: u,
|
|
524
|
+
target: l
|
|
525
|
+
};
|
|
526
|
+
});
|
|
527
|
+
r({
|
|
528
|
+
nodes: m,
|
|
529
|
+
edges: o,
|
|
530
|
+
selectedNodeId: null,
|
|
531
|
+
currentTemplateId: null,
|
|
532
|
+
previewVisible: {},
|
|
533
|
+
activeWorkflowId: null,
|
|
534
|
+
activeWorkflowName: s || "Imported Workflow",
|
|
535
|
+
hasUnsavedChanges: !0,
|
|
536
|
+
execution: {
|
|
537
|
+
status: "idle",
|
|
538
|
+
imageIds: [],
|
|
539
|
+
previews: {},
|
|
540
|
+
dataOutputs: {},
|
|
541
|
+
nodeStatus: {}
|
|
542
|
+
}
|
|
543
|
+
});
|
|
483
544
|
},
|
|
484
545
|
// Workflow persistence methods
|
|
485
546
|
markDirty: () => r({ hasUnsavedChanges: !0 }),
|
|
@@ -506,50 +567,50 @@ const f = oe()(
|
|
|
506
567
|
},
|
|
507
568
|
saveWorkflow: (t) => {
|
|
508
569
|
const {
|
|
509
|
-
nodes:
|
|
510
|
-
edges:
|
|
511
|
-
activeWorkflowId:
|
|
512
|
-
activeWorkflowName:
|
|
513
|
-
savedWorkflows:
|
|
514
|
-
currentTemplateId:
|
|
515
|
-
} =
|
|
516
|
-
if (
|
|
517
|
-
const
|
|
518
|
-
(p) => p.id ===
|
|
570
|
+
nodes: a,
|
|
571
|
+
edges: s,
|
|
572
|
+
activeWorkflowId: d,
|
|
573
|
+
activeWorkflowName: m,
|
|
574
|
+
savedWorkflows: o,
|
|
575
|
+
currentTemplateId: n
|
|
576
|
+
} = i(), u = Date.now();
|
|
577
|
+
if (d) {
|
|
578
|
+
const l = o.map(
|
|
579
|
+
(p) => p.id === d ? { ...p, name: t || m, nodes: a, edges: s, updatedAt: u } : p
|
|
519
580
|
);
|
|
520
581
|
return r({
|
|
521
|
-
savedWorkflows:
|
|
522
|
-
activeWorkflowName: t ||
|
|
582
|
+
savedWorkflows: l,
|
|
583
|
+
activeWorkflowName: t || m,
|
|
523
584
|
hasUnsavedChanges: !1
|
|
524
|
-
}),
|
|
585
|
+
}), d;
|
|
525
586
|
} else {
|
|
526
|
-
const
|
|
527
|
-
id:
|
|
528
|
-
name: t ||
|
|
529
|
-
nodes:
|
|
530
|
-
edges:
|
|
587
|
+
const l = oe(), p = {
|
|
588
|
+
id: l,
|
|
589
|
+
name: t || m,
|
|
590
|
+
nodes: a,
|
|
591
|
+
edges: s,
|
|
531
592
|
createdAt: u,
|
|
532
593
|
updatedAt: u,
|
|
533
|
-
templateId:
|
|
594
|
+
templateId: n || void 0
|
|
534
595
|
};
|
|
535
596
|
return r({
|
|
536
|
-
savedWorkflows: [...
|
|
537
|
-
activeWorkflowId:
|
|
538
|
-
activeWorkflowName: t ||
|
|
597
|
+
savedWorkflows: [...o, p],
|
|
598
|
+
activeWorkflowId: l,
|
|
599
|
+
activeWorkflowName: t || m,
|
|
539
600
|
hasUnsavedChanges: !1
|
|
540
|
-
}),
|
|
601
|
+
}), l;
|
|
541
602
|
}
|
|
542
603
|
},
|
|
543
604
|
loadWorkflow: (t) => {
|
|
544
|
-
const { savedWorkflows:
|
|
545
|
-
|
|
546
|
-
nodes:
|
|
547
|
-
edges:
|
|
605
|
+
const { savedWorkflows: a } = i(), s = a.find((d) => d.id === t);
|
|
606
|
+
s && r({
|
|
607
|
+
nodes: s.nodes,
|
|
608
|
+
edges: s.edges,
|
|
548
609
|
selectedNodeId: null,
|
|
549
|
-
currentTemplateId:
|
|
610
|
+
currentTemplateId: s.templateId || null,
|
|
550
611
|
previewVisible: {},
|
|
551
612
|
activeWorkflowId: t,
|
|
552
|
-
activeWorkflowName:
|
|
613
|
+
activeWorkflowName: s.name,
|
|
553
614
|
hasUnsavedChanges: !1,
|
|
554
615
|
execution: {
|
|
555
616
|
status: "idle",
|
|
@@ -561,9 +622,9 @@ const f = oe()(
|
|
|
561
622
|
});
|
|
562
623
|
},
|
|
563
624
|
deleteWorkflow: (t) => {
|
|
564
|
-
const { savedWorkflows:
|
|
565
|
-
r(
|
|
566
|
-
savedWorkflows:
|
|
625
|
+
const { savedWorkflows: a, activeWorkflowId: s } = i(), d = a.filter((m) => m.id !== t);
|
|
626
|
+
r(s === t ? {
|
|
627
|
+
savedWorkflows: d,
|
|
567
628
|
nodes: [],
|
|
568
629
|
edges: [],
|
|
569
630
|
selectedNodeId: null,
|
|
@@ -579,28 +640,28 @@ const f = oe()(
|
|
|
579
640
|
dataOutputs: {},
|
|
580
641
|
nodeStatus: {}
|
|
581
642
|
}
|
|
582
|
-
} : { savedWorkflows:
|
|
643
|
+
} : { savedWorkflows: d });
|
|
583
644
|
},
|
|
584
|
-
renameWorkflow: (t,
|
|
585
|
-
const { savedWorkflows:
|
|
586
|
-
(
|
|
645
|
+
renameWorkflow: (t, a) => {
|
|
646
|
+
const { savedWorkflows: s, activeWorkflowId: d } = i(), m = s.map(
|
|
647
|
+
(o) => o.id === t ? { ...o, name: a, updatedAt: Date.now() } : o
|
|
587
648
|
);
|
|
588
649
|
r({
|
|
589
|
-
savedWorkflows:
|
|
590
|
-
...
|
|
650
|
+
savedWorkflows: m,
|
|
651
|
+
...d === t ? { activeWorkflowName: a } : {}
|
|
591
652
|
});
|
|
592
653
|
},
|
|
593
654
|
duplicateWorkflow: (t) => {
|
|
594
|
-
const { savedWorkflows:
|
|
595
|
-
if (!
|
|
596
|
-
const
|
|
597
|
-
...
|
|
598
|
-
id:
|
|
599
|
-
name: `${
|
|
600
|
-
createdAt:
|
|
601
|
-
updatedAt:
|
|
655
|
+
const { savedWorkflows: a } = i(), s = a.find((n) => n.id === t);
|
|
656
|
+
if (!s) return "";
|
|
657
|
+
const d = Date.now(), m = oe(), o = {
|
|
658
|
+
...s,
|
|
659
|
+
id: m,
|
|
660
|
+
name: `${s.name} (Copy)`,
|
|
661
|
+
createdAt: d,
|
|
662
|
+
updatedAt: d
|
|
602
663
|
};
|
|
603
|
-
return r({ savedWorkflows: [...
|
|
664
|
+
return r({ savedWorkflows: [...a, o] }), m;
|
|
604
665
|
}
|
|
605
666
|
}),
|
|
606
667
|
{
|
|
@@ -614,26 +675,26 @@ const f = oe()(
|
|
|
614
675
|
);
|
|
615
676
|
function R(r) {
|
|
616
677
|
var t;
|
|
617
|
-
const
|
|
678
|
+
const i = {};
|
|
618
679
|
if ((t = r.params) != null && t.properties)
|
|
619
|
-
for (const [
|
|
620
|
-
|
|
621
|
-
return
|
|
680
|
+
for (const [a, s] of Object.entries(r.params.properties))
|
|
681
|
+
s.default !== void 0 && (i[a] = s.default);
|
|
682
|
+
return i;
|
|
622
683
|
}
|
|
623
|
-
function
|
|
684
|
+
function U(r) {
|
|
624
685
|
return r === "running" ? "border-yellow-400 animate-pulse" : r === "completed" ? "border-green-500" : r === "error" ? "border-red-500" : "";
|
|
625
686
|
}
|
|
626
|
-
function
|
|
627
|
-
const t =
|
|
687
|
+
function Q({ nodeId: r, color: i }) {
|
|
688
|
+
const t = x((s) => s.previewVisible[r] !== !1), a = x((s) => s.togglePreview);
|
|
628
689
|
return /* @__PURE__ */ e(
|
|
629
690
|
"button",
|
|
630
691
|
{
|
|
631
|
-
onClick: (
|
|
632
|
-
|
|
692
|
+
onClick: (s) => {
|
|
693
|
+
s.stopPropagation(), a(r);
|
|
633
694
|
},
|
|
634
695
|
className: `ml-auto p-1 rounded hover:bg-gray-200 dark:hover:bg-zinc-600 transition-colors ${t ? "opacity-100" : "opacity-40"}`,
|
|
635
696
|
title: t ? "Hide preview" : "Show preview",
|
|
636
|
-
children: /* @__PURE__ */ e("svg", { className: `w-3.5 h-3.5 ${
|
|
697
|
+
children: /* @__PURE__ */ e("svg", { className: `w-3.5 h-3.5 ${i}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: t ? /* @__PURE__ */ e(
|
|
637
698
|
"path",
|
|
638
699
|
{
|
|
639
700
|
strokeLinecap: "round",
|
|
@@ -653,72 +714,72 @@ function H({ nodeId: r, color: s }) {
|
|
|
653
714
|
}
|
|
654
715
|
);
|
|
655
716
|
}
|
|
656
|
-
const
|
|
657
|
-
id:
|
|
717
|
+
const Re = T(function({
|
|
718
|
+
id: i,
|
|
658
719
|
data: t,
|
|
659
|
-
selected:
|
|
720
|
+
selected: a
|
|
660
721
|
}) {
|
|
661
|
-
const
|
|
662
|
-
return /* @__PURE__ */
|
|
722
|
+
const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n = U(d) || (a ? "border-blue-500" : "border-blue-200");
|
|
723
|
+
return /* @__PURE__ */ c(
|
|
663
724
|
"div",
|
|
664
725
|
{
|
|
665
|
-
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${
|
|
726
|
+
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${n}`,
|
|
666
727
|
children: [
|
|
667
|
-
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
728
|
+
s && m && /* @__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: s, alt: "Preview", className: "w-full h-24 object-contain" }) }),
|
|
729
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
|
|
730
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
670
731
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-blue-500" }),
|
|
671
732
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-blue-700 dark:text-blue-400", children: t.generatorName }),
|
|
672
|
-
/* @__PURE__ */ e(
|
|
733
|
+
/* @__PURE__ */ e(Q, { nodeId: i, color: "text-blue-500 dark:text-blue-400" })
|
|
673
734
|
] }),
|
|
674
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u,
|
|
735
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, l]) => /* @__PURE__ */ c("div", { className: "truncate", children: [
|
|
675
736
|
u,
|
|
676
737
|
": ",
|
|
677
|
-
String(
|
|
738
|
+
String(l).slice(0, 20)
|
|
678
739
|
] }, u)) })
|
|
679
740
|
] }),
|
|
680
|
-
/* @__PURE__ */ e(
|
|
741
|
+
/* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-blue-500" })
|
|
681
742
|
]
|
|
682
743
|
}
|
|
683
744
|
);
|
|
684
|
-
}),
|
|
685
|
-
id:
|
|
745
|
+
}), Fe = T(function({
|
|
746
|
+
id: i,
|
|
686
747
|
data: t,
|
|
687
|
-
selected:
|
|
748
|
+
selected: a
|
|
688
749
|
}) {
|
|
689
|
-
const
|
|
690
|
-
return /* @__PURE__ */
|
|
750
|
+
const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n = U(d) || (a ? "border-teal-500" : "border-teal-200");
|
|
751
|
+
return /* @__PURE__ */ c(
|
|
691
752
|
"div",
|
|
692
753
|
{
|
|
693
|
-
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${
|
|
754
|
+
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${n}`,
|
|
694
755
|
children: [
|
|
695
|
-
/* @__PURE__ */ e(
|
|
696
|
-
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
756
|
+
/* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-teal-500" }),
|
|
757
|
+
s && m && /* @__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: s, alt: "Preview", className: "w-full h-24 object-contain" }) }),
|
|
758
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
|
|
759
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
699
760
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-teal-500" }),
|
|
700
761
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-teal-700 dark:text-teal-400", children: t.operation }),
|
|
701
|
-
/* @__PURE__ */ e(
|
|
762
|
+
/* @__PURE__ */ e(Q, { nodeId: i, color: "text-teal-500 dark:text-teal-400" })
|
|
702
763
|
] }),
|
|
703
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u,
|
|
764
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, l]) => /* @__PURE__ */ c("div", { className: "truncate", children: [
|
|
704
765
|
u,
|
|
705
766
|
": ",
|
|
706
|
-
String(
|
|
767
|
+
String(l).slice(0, 20)
|
|
707
768
|
] }, u)) })
|
|
708
769
|
] }),
|
|
709
|
-
/* @__PURE__ */ e(
|
|
770
|
+
/* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-teal-500" })
|
|
710
771
|
]
|
|
711
772
|
}
|
|
712
773
|
);
|
|
713
|
-
}),
|
|
714
|
-
const
|
|
715
|
-
return /* @__PURE__ */
|
|
774
|
+
}), Ve = T(function({ id: i, data: t, selected: a }) {
|
|
775
|
+
const s = x((o) => o.execution.nodeStatus[i]), m = U(s) || (a ? "border-green-500" : "border-green-200");
|
|
776
|
+
return /* @__PURE__ */ c(
|
|
716
777
|
"div",
|
|
717
778
|
{
|
|
718
|
-
className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${
|
|
779
|
+
className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${m}`,
|
|
719
780
|
children: [
|
|
720
|
-
/* @__PURE__ */ e(
|
|
721
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-green-500" }),
|
|
782
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
722
783
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-green-500" }),
|
|
723
784
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-green-700 dark:text-green-400", children: "Save" })
|
|
724
785
|
] }),
|
|
@@ -726,54 +787,54 @@ const Pe = T(function({
|
|
|
726
787
|
]
|
|
727
788
|
}
|
|
728
789
|
);
|
|
729
|
-
}),
|
|
730
|
-
const
|
|
731
|
-
async (
|
|
790
|
+
}), Ge = T(function({ id: i, data: t, selected: a }) {
|
|
791
|
+
const s = x((v) => v.execution.previews[i]), d = x((v) => v.execution.nodeStatus[i]), m = x((v) => v.previewVisible[i] !== !1), o = x((v) => v.updateNodeData), n = xe(null), l = U(d) || (a ? "border-amber-500" : "border-amber-200"), p = C(
|
|
792
|
+
async (v) => {
|
|
732
793
|
try {
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
uploadId:
|
|
736
|
-
filename:
|
|
737
|
-
mime:
|
|
794
|
+
const w = await Pe(v);
|
|
795
|
+
o(i, {
|
|
796
|
+
uploadId: w.id,
|
|
797
|
+
filename: w.filename,
|
|
798
|
+
mime: w.mime
|
|
738
799
|
});
|
|
739
|
-
} catch (
|
|
740
|
-
console.error("Upload failed:",
|
|
800
|
+
} catch (w) {
|
|
801
|
+
console.error("Upload failed:", w);
|
|
741
802
|
}
|
|
742
803
|
},
|
|
743
|
-
[
|
|
744
|
-
),
|
|
745
|
-
(
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
|
|
804
|
+
[i, o]
|
|
805
|
+
), f = C(
|
|
806
|
+
(v) => {
|
|
807
|
+
v.preventDefault(), v.stopPropagation();
|
|
808
|
+
const w = v.dataTransfer.files[0];
|
|
809
|
+
w && w.type.startsWith("image/") && p(w);
|
|
749
810
|
},
|
|
750
811
|
[p]
|
|
751
|
-
), b = C((
|
|
752
|
-
|
|
753
|
-
}, []),
|
|
754
|
-
(
|
|
755
|
-
var
|
|
756
|
-
const
|
|
757
|
-
|
|
812
|
+
), b = C((v) => {
|
|
813
|
+
v.preventDefault(), v.stopPropagation();
|
|
814
|
+
}, []), k = C(
|
|
815
|
+
(v) => {
|
|
816
|
+
var h;
|
|
817
|
+
const w = (h = v.target.files) == null ? void 0 : h[0];
|
|
818
|
+
w && p(w);
|
|
758
819
|
},
|
|
759
820
|
[p]
|
|
760
|
-
), g =
|
|
761
|
-
return /* @__PURE__ */
|
|
821
|
+
), g = s || (t.uploadId ? de(t.uploadId) : null);
|
|
822
|
+
return /* @__PURE__ */ c(
|
|
762
823
|
"div",
|
|
763
824
|
{
|
|
764
|
-
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${
|
|
765
|
-
onDrop:
|
|
825
|
+
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${l}`,
|
|
826
|
+
onDrop: f,
|
|
766
827
|
onDragOver: b,
|
|
767
828
|
children: [
|
|
768
|
-
g &&
|
|
829
|
+
g && m ? /* @__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
830
|
"div",
|
|
770
831
|
{
|
|
771
832
|
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
833
|
onClick: () => {
|
|
773
|
-
var
|
|
774
|
-
return (
|
|
834
|
+
var v;
|
|
835
|
+
return (v = n.current) == null ? void 0 : v.click();
|
|
775
836
|
},
|
|
776
|
-
children: /* @__PURE__ */
|
|
837
|
+
children: /* @__PURE__ */ c("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
|
|
777
838
|
/* @__PURE__ */ e("div", { className: "text-2xl mb-1", children: "+" }),
|
|
778
839
|
/* @__PURE__ */ e("div", { className: "text-xs", children: "Drop image or click" })
|
|
779
840
|
] })
|
|
@@ -782,48 +843,48 @@ const Pe = T(function({
|
|
|
782
843
|
/* @__PURE__ */ e(
|
|
783
844
|
"input",
|
|
784
845
|
{
|
|
785
|
-
ref:
|
|
846
|
+
ref: n,
|
|
786
847
|
type: "file",
|
|
787
848
|
accept: "image/*",
|
|
788
849
|
className: "hidden",
|
|
789
|
-
onChange:
|
|
850
|
+
onChange: k
|
|
790
851
|
}
|
|
791
852
|
),
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
|
|
854
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
794
855
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-amber-500" }),
|
|
795
856
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-amber-700 dark:text-amber-400", children: "Input" }),
|
|
796
|
-
/* @__PURE__ */ e(
|
|
857
|
+
/* @__PURE__ */ e(Q, { nodeId: i, color: "text-amber-500 dark:text-amber-400" })
|
|
797
858
|
] }),
|
|
798
859
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: t.filename || "No image selected" })
|
|
799
860
|
] }),
|
|
800
|
-
/* @__PURE__ */ e(
|
|
861
|
+
/* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-amber-500" })
|
|
801
862
|
]
|
|
802
863
|
}
|
|
803
864
|
);
|
|
804
|
-
}),
|
|
805
|
-
id:
|
|
865
|
+
}), qe = T(function({
|
|
866
|
+
id: i,
|
|
806
867
|
data: t,
|
|
807
|
-
selected:
|
|
868
|
+
selected: a
|
|
808
869
|
}) {
|
|
809
|
-
var
|
|
810
|
-
const
|
|
870
|
+
var n, u;
|
|
871
|
+
const s = x((l) => l.execution.nodeStatus[i]), d = x((l) => {
|
|
811
872
|
var p;
|
|
812
|
-
return (p =
|
|
813
|
-
}),
|
|
814
|
-
return /* @__PURE__ */
|
|
873
|
+
return (p = l.execution.dataOutputs) == null ? void 0 : p[i];
|
|
874
|
+
}), o = U(s) || (a ? "border-cyan-500" : "border-cyan-200");
|
|
875
|
+
return /* @__PURE__ */ c(
|
|
815
876
|
"div",
|
|
816
877
|
{
|
|
817
|
-
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${
|
|
878
|
+
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${o}`,
|
|
818
879
|
children: [
|
|
819
|
-
/* @__PURE__ */ e(
|
|
820
|
-
|
|
821
|
-
(
|
|
822
|
-
(((u =
|
|
880
|
+
/* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-cyan-500" }),
|
|
881
|
+
d && /* @__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__ */ c("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
|
|
882
|
+
(n = d.content) == null ? void 0 : n.slice(0, 200),
|
|
883
|
+
(((u = d.content) == null ? void 0 : u.length) || 0) > 200 && "..."
|
|
823
884
|
] }) }),
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
/* @__PURE__ */
|
|
826
|
-
/* @__PURE__ */
|
|
885
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
|
|
886
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
887
|
+
/* @__PURE__ */ c("svg", { className: "w-3 h-3 text-cyan-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
|
|
827
888
|
/* @__PURE__ */ e("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }),
|
|
828
889
|
/* @__PURE__ */ e(
|
|
829
890
|
"path",
|
|
@@ -836,33 +897,33 @@ const Pe = T(function({
|
|
|
836
897
|
] }),
|
|
837
898
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-cyan-700 dark:text-cyan-400", children: t.providerName })
|
|
838
899
|
] }),
|
|
839
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ c("div", { className: "truncate", children: [
|
|
840
901
|
String(t.params.prompt).slice(0, 30),
|
|
841
902
|
"..."
|
|
842
903
|
] }) : null })
|
|
843
904
|
] }),
|
|
844
|
-
/* @__PURE__ */ e(
|
|
905
|
+
/* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-cyan-500" })
|
|
845
906
|
]
|
|
846
907
|
}
|
|
847
908
|
);
|
|
848
|
-
}),
|
|
849
|
-
var
|
|
850
|
-
const
|
|
909
|
+
}), Ke = T(function({ id: i, data: t, selected: a }) {
|
|
910
|
+
var n, u;
|
|
911
|
+
const s = x((l) => l.execution.nodeStatus[i]), d = x((l) => {
|
|
851
912
|
var p;
|
|
852
|
-
return (p =
|
|
853
|
-
}),
|
|
854
|
-
return /* @__PURE__ */
|
|
913
|
+
return (p = l.execution.dataOutputs) == null ? void 0 : p[i];
|
|
914
|
+
}), o = U(s) || (a ? "border-pink-500" : "border-pink-200");
|
|
915
|
+
return /* @__PURE__ */ c(
|
|
855
916
|
"div",
|
|
856
917
|
{
|
|
857
|
-
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${
|
|
918
|
+
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${o}`,
|
|
858
919
|
children: [
|
|
859
|
-
/* @__PURE__ */ e(
|
|
860
|
-
|
|
861
|
-
(
|
|
862
|
-
(((u =
|
|
920
|
+
/* @__PURE__ */ e(L, { type: "target", position: W.Left, className: "w-3 h-3 !bg-pink-500" }),
|
|
921
|
+
d && /* @__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__ */ c("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
|
|
922
|
+
(n = d.content) == null ? void 0 : n.slice(0, 200),
|
|
923
|
+
(((u = d.content) == null ? void 0 : u.length) || 0) > 200 && "..."
|
|
863
924
|
] }) }),
|
|
864
|
-
/* @__PURE__ */
|
|
865
|
-
/* @__PURE__ */
|
|
925
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
|
|
926
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
866
927
|
/* @__PURE__ */ e("svg", { className: "w-3 h-3 text-pink-500", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
|
|
867
928
|
"path",
|
|
868
929
|
{
|
|
@@ -873,27 +934,27 @@ const Pe = T(function({
|
|
|
873
934
|
) }),
|
|
874
935
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-pink-700 dark:text-pink-400", children: t.providerName })
|
|
875
936
|
] }),
|
|
876
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */
|
|
937
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ c("div", { className: "truncate", children: [
|
|
877
938
|
String(t.params.prompt).slice(0, 30),
|
|
878
939
|
"..."
|
|
879
940
|
] }) : null })
|
|
880
941
|
] }),
|
|
881
|
-
/* @__PURE__ */ e(
|
|
942
|
+
/* @__PURE__ */ e(L, { type: "source", position: W.Right, className: "w-3 h-3 !bg-pink-500" })
|
|
882
943
|
]
|
|
883
944
|
}
|
|
884
945
|
);
|
|
885
|
-
}),
|
|
886
|
-
generator:
|
|
887
|
-
transform:
|
|
888
|
-
save:
|
|
889
|
-
input:
|
|
890
|
-
vision:
|
|
891
|
-
text:
|
|
892
|
-
},
|
|
946
|
+
}), _e = {
|
|
947
|
+
generator: Re,
|
|
948
|
+
transform: Fe,
|
|
949
|
+
save: Ve,
|
|
950
|
+
input: Ge,
|
|
951
|
+
vision: qe,
|
|
952
|
+
text: Ke
|
|
953
|
+
}, He = {
|
|
893
954
|
type: "smoothstep",
|
|
894
955
|
animated: !1,
|
|
895
956
|
markerEnd: {
|
|
896
|
-
type:
|
|
957
|
+
type: ye.ArrowClosed,
|
|
897
958
|
color: "#64748b",
|
|
898
959
|
width: 20,
|
|
899
960
|
height: 20
|
|
@@ -903,51 +964,51 @@ const Pe = T(function({
|
|
|
903
964
|
strokeWidth: 2
|
|
904
965
|
}
|
|
905
966
|
};
|
|
906
|
-
function
|
|
907
|
-
const r =
|
|
908
|
-
(
|
|
909
|
-
const { source: b, target:
|
|
910
|
-
if (!b || !
|
|
911
|
-
const g = r.find((
|
|
912
|
-
return !(!g || !
|
|
967
|
+
function Qe() {
|
|
968
|
+
const r = x((f) => f.nodes), i = x((f) => f.edges), t = x((f) => f.setNodes), a = x((f) => f.setEdges), s = x((f) => f.addEdge), d = x((f) => f.setSelectedNode), m = C(
|
|
969
|
+
(f) => {
|
|
970
|
+
const { source: b, target: k } = f;
|
|
971
|
+
if (!b || !k) return !1;
|
|
972
|
+
const g = r.find((h) => h.id === b), v = r.find((h) => h.id === k);
|
|
973
|
+
return !(!g || !v || g.type === "save" || v.type === "generator" || v.type === "input" || i.find((h) => h.target === k) || b === k);
|
|
913
974
|
},
|
|
914
|
-
[r,
|
|
915
|
-
),
|
|
916
|
-
(
|
|
917
|
-
t(
|
|
975
|
+
[r, i]
|
|
976
|
+
), o = C(
|
|
977
|
+
(f) => {
|
|
978
|
+
t(we(f, r));
|
|
918
979
|
},
|
|
919
980
|
[r, t]
|
|
920
|
-
),
|
|
921
|
-
(
|
|
922
|
-
|
|
981
|
+
), n = C(
|
|
982
|
+
(f) => {
|
|
983
|
+
a(ve(f, i));
|
|
923
984
|
},
|
|
924
|
-
[
|
|
985
|
+
[i, a]
|
|
925
986
|
), u = C(
|
|
926
|
-
(
|
|
927
|
-
|
|
987
|
+
(f) => {
|
|
988
|
+
s(f);
|
|
928
989
|
},
|
|
929
|
-
[
|
|
930
|
-
),
|
|
931
|
-
(
|
|
932
|
-
|
|
990
|
+
[s]
|
|
991
|
+
), l = C(
|
|
992
|
+
(f, b) => {
|
|
993
|
+
d(b.id);
|
|
933
994
|
},
|
|
934
|
-
[
|
|
995
|
+
[d]
|
|
935
996
|
), p = C(() => {
|
|
936
|
-
|
|
937
|
-
}, [
|
|
938
|
-
return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */
|
|
939
|
-
|
|
997
|
+
d(null);
|
|
998
|
+
}, [d]);
|
|
999
|
+
return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ c(
|
|
1000
|
+
ke,
|
|
940
1001
|
{
|
|
941
1002
|
nodes: r,
|
|
942
|
-
edges:
|
|
943
|
-
onNodesChange:
|
|
944
|
-
onEdgesChange:
|
|
1003
|
+
edges: i,
|
|
1004
|
+
onNodesChange: o,
|
|
1005
|
+
onEdgesChange: n,
|
|
945
1006
|
onConnect: u,
|
|
946
|
-
onNodeClick:
|
|
1007
|
+
onNodeClick: l,
|
|
947
1008
|
onPaneClick: p,
|
|
948
|
-
nodeTypes:
|
|
949
|
-
defaultEdgeOptions:
|
|
950
|
-
isValidConnection:
|
|
1009
|
+
nodeTypes: _e,
|
|
1010
|
+
defaultEdgeOptions: He,
|
|
1011
|
+
isValidConnection: m,
|
|
951
1012
|
nodesDraggable: !0,
|
|
952
1013
|
nodesConnectable: !0,
|
|
953
1014
|
elementsSelectable: !0,
|
|
@@ -956,92 +1017,92 @@ function Ge() {
|
|
|
956
1017
|
snapToGrid: !0,
|
|
957
1018
|
snapGrid: [15, 15],
|
|
958
1019
|
children: [
|
|
959
|
-
/* @__PURE__ */ e(
|
|
960
|
-
/* @__PURE__ */ e(
|
|
961
|
-
/* @__PURE__ */ e(
|
|
1020
|
+
/* @__PURE__ */ e(Ne, {}),
|
|
1021
|
+
/* @__PURE__ */ e(ze, {}),
|
|
1022
|
+
/* @__PURE__ */ e(Ce, { nodeStrokeWidth: 3, zoomable: !0, pannable: !0 })
|
|
962
1023
|
]
|
|
963
1024
|
}
|
|
964
1025
|
) });
|
|
965
1026
|
}
|
|
966
|
-
function
|
|
967
|
-
const [
|
|
1027
|
+
function Je({ onSelect: r }) {
|
|
1028
|
+
const [i, t] = N([]), [a, s] = N(!0), [d, m] = N(null), o = async () => {
|
|
968
1029
|
try {
|
|
969
|
-
|
|
970
|
-
const
|
|
971
|
-
t(
|
|
972
|
-
} catch (
|
|
973
|
-
l
|
|
1030
|
+
s(!0);
|
|
1031
|
+
const l = await Te();
|
|
1032
|
+
t(l), m(null);
|
|
1033
|
+
} catch (l) {
|
|
1034
|
+
m(l instanceof Error ? l.message : "Failed to load uploads");
|
|
974
1035
|
} finally {
|
|
975
|
-
|
|
1036
|
+
s(!1);
|
|
976
1037
|
}
|
|
977
1038
|
};
|
|
978
|
-
|
|
979
|
-
|
|
1039
|
+
M(() => {
|
|
1040
|
+
o();
|
|
980
1041
|
}, []);
|
|
981
|
-
const
|
|
1042
|
+
const n = async (l, p) => {
|
|
982
1043
|
if (p.stopPropagation(), !!confirm("Delete this upload?"))
|
|
983
1044
|
try {
|
|
984
|
-
await
|
|
985
|
-
} catch (
|
|
986
|
-
console.error("Failed to delete:",
|
|
1045
|
+
await Ue(l), t((f) => f.filter((b) => b.id !== l));
|
|
1046
|
+
} catch (f) {
|
|
1047
|
+
console.error("Failed to delete:", f);
|
|
987
1048
|
}
|
|
988
|
-
}, u = (
|
|
989
|
-
return
|
|
990
|
-
|
|
1049
|
+
}, u = (l) => l < 1024 ? `${l} B` : l < 1024 * 1024 ? `${(l / 1024).toFixed(1)} KB` : `${(l / (1024 * 1024)).toFixed(1)} MB`;
|
|
1050
|
+
return a ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "Loading uploads..." }) : d ? /* @__PURE__ */ c("div", { className: "p-4 text-center text-red-500 dark:text-red-400", children: [
|
|
1051
|
+
d,
|
|
991
1052
|
/* @__PURE__ */ e(
|
|
992
1053
|
"button",
|
|
993
1054
|
{
|
|
994
|
-
onClick:
|
|
1055
|
+
onClick: o,
|
|
995
1056
|
className: "ml-2 text-teal-500 dark:text-teal-400 hover:underline",
|
|
996
1057
|
children: "Retry"
|
|
997
1058
|
}
|
|
998
1059
|
)
|
|
999
|
-
] }) :
|
|
1060
|
+
] }) : i.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: i.map((l) => /* @__PURE__ */ c(
|
|
1000
1061
|
"div",
|
|
1001
1062
|
{
|
|
1002
1063
|
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",
|
|
1003
|
-
onClick: () => r == null ? void 0 : r(
|
|
1064
|
+
onClick: () => r == null ? void 0 : r(l),
|
|
1004
1065
|
children: [
|
|
1005
1066
|
/* @__PURE__ */ e(
|
|
1006
1067
|
"img",
|
|
1007
1068
|
{
|
|
1008
|
-
src:
|
|
1009
|
-
alt:
|
|
1069
|
+
src: de(l.id),
|
|
1070
|
+
alt: l.filename,
|
|
1010
1071
|
className: "w-full h-20 object-cover"
|
|
1011
1072
|
}
|
|
1012
1073
|
),
|
|
1013
1074
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
1014
1075
|
"button",
|
|
1015
1076
|
{
|
|
1016
|
-
onClick: (p) =>
|
|
1077
|
+
onClick: (p) => n(l.id, p),
|
|
1017
1078
|
className: "p-1 bg-red-500 rounded text-white text-xs hover:bg-red-600",
|
|
1018
1079
|
children: "Delete"
|
|
1019
1080
|
}
|
|
1020
1081
|
) }),
|
|
1021
|
-
/* @__PURE__ */ e("div", { className: "p-1 text-xs truncate bg-white dark:bg-zinc-800 text-gray-800 dark:text-zinc-200", children:
|
|
1022
|
-
/* @__PURE__ */ e("div", { className: "px-1 pb-1 text-xs text-gray-400 dark:text-zinc-500 bg-white dark:bg-zinc-800", children: u(
|
|
1082
|
+
/* @__PURE__ */ e("div", { className: "p-1 text-xs truncate bg-white dark:bg-zinc-800 text-gray-800 dark:text-zinc-200", children: l.filename }),
|
|
1083
|
+
/* @__PURE__ */ e("div", { className: "px-1 pb-1 text-xs text-gray-400 dark:text-zinc-500 bg-white dark:bg-zinc-800", children: u(l.size) })
|
|
1023
1084
|
]
|
|
1024
1085
|
},
|
|
1025
|
-
|
|
1086
|
+
l.id
|
|
1026
1087
|
)) }) });
|
|
1027
1088
|
}
|
|
1028
|
-
function
|
|
1029
|
-
const r =
|
|
1089
|
+
function Ye() {
|
|
1090
|
+
const r = x((g) => g.setGenerators), i = x((g) => g.setTransforms), t = x((g) => g.generators), a = x((g) => g.transforms), s = x((g) => g.addNode), [d, m] = N(!1), { data: o } = _({
|
|
1030
1091
|
queryKey: ["generators"],
|
|
1031
|
-
queryFn:
|
|
1032
|
-
}), { data:
|
|
1092
|
+
queryFn: We
|
|
1093
|
+
}), { data: n } = _({
|
|
1033
1094
|
queryKey: ["transforms"],
|
|
1034
|
-
queryFn:
|
|
1095
|
+
queryFn: Ae
|
|
1035
1096
|
});
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
}, [
|
|
1039
|
-
|
|
1040
|
-
}, [
|
|
1041
|
-
const u = (g,
|
|
1042
|
-
g.dataTransfer.setData("application/json", JSON.stringify(
|
|
1043
|
-
},
|
|
1044
|
-
|
|
1097
|
+
M(() => {
|
|
1098
|
+
o && r(o);
|
|
1099
|
+
}, [o, r]), M(() => {
|
|
1100
|
+
n && i(n);
|
|
1101
|
+
}, [n, i]);
|
|
1102
|
+
const u = (g, v) => {
|
|
1103
|
+
g.dataTransfer.setData("application/json", JSON.stringify(v)), g.dataTransfer.effectAllowed = "move";
|
|
1104
|
+
}, l = (g) => {
|
|
1105
|
+
s(g, { x: 250, y: 150 + Math.random() * 100 });
|
|
1045
1106
|
}, p = {
|
|
1046
1107
|
id: "input:upload",
|
|
1047
1108
|
type: "input",
|
|
@@ -1053,7 +1114,7 @@ function Ve() {
|
|
|
1053
1114
|
type: "object",
|
|
1054
1115
|
properties: {}
|
|
1055
1116
|
}
|
|
1056
|
-
},
|
|
1117
|
+
}, f = {
|
|
1057
1118
|
id: "save:filesystem",
|
|
1058
1119
|
type: "save",
|
|
1059
1120
|
name: "save",
|
|
@@ -1067,45 +1128,49 @@ function Ve() {
|
|
|
1067
1128
|
type: "string",
|
|
1068
1129
|
title: "Destination",
|
|
1069
1130
|
default: "./output/image.png"
|
|
1131
|
+
},
|
|
1132
|
+
provider: {
|
|
1133
|
+
type: "string",
|
|
1134
|
+
default: "filesystem"
|
|
1070
1135
|
}
|
|
1071
1136
|
}
|
|
1072
1137
|
}
|
|
1073
1138
|
}, b = t.reduce(
|
|
1074
|
-
(g,
|
|
1075
|
-
const
|
|
1076
|
-
return g[
|
|
1139
|
+
(g, v) => {
|
|
1140
|
+
const w = v.category || "Other";
|
|
1141
|
+
return g[w] || (g[w] = []), g[w].push(v), g;
|
|
1077
1142
|
},
|
|
1078
1143
|
{}
|
|
1079
|
-
),
|
|
1080
|
-
(g,
|
|
1081
|
-
const
|
|
1082
|
-
return g[
|
|
1144
|
+
), k = a.reduce(
|
|
1145
|
+
(g, v) => {
|
|
1146
|
+
const w = v.category || "Other";
|
|
1147
|
+
return g[w] || (g[w] = []), g[w].push(v), g;
|
|
1083
1148
|
},
|
|
1084
1149
|
{}
|
|
1085
1150
|
);
|
|
1086
|
-
return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */
|
|
1151
|
+
return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ c("div", { className: "p-4", children: [
|
|
1087
1152
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white mb-4", children: "Nodes" }),
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ c("div", { className: "mb-6", children: [
|
|
1154
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2", children: [
|
|
1090
1155
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-amber-600 dark:text-amber-400 uppercase tracking-wide", children: "Input" }),
|
|
1091
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ c(
|
|
1092
1157
|
"button",
|
|
1093
1158
|
{
|
|
1094
|
-
onClick: () =>
|
|
1159
|
+
onClick: () => m(!d),
|
|
1095
1160
|
className: "text-xs text-amber-600 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-300",
|
|
1096
1161
|
children: [
|
|
1097
|
-
|
|
1162
|
+
d ? "Hide" : "Browse",
|
|
1098
1163
|
" Uploads"
|
|
1099
1164
|
]
|
|
1100
1165
|
}
|
|
1101
1166
|
)
|
|
1102
1167
|
] }),
|
|
1103
|
-
/* @__PURE__ */
|
|
1168
|
+
/* @__PURE__ */ c(
|
|
1104
1169
|
"div",
|
|
1105
1170
|
{
|
|
1106
1171
|
draggable: !0,
|
|
1107
1172
|
onDragStart: (g) => u(g, p),
|
|
1108
|
-
onDoubleClick: () =>
|
|
1173
|
+
onDoubleClick: () => l(p),
|
|
1109
1174
|
className: "px-3 py-2 bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded cursor-grab active:cursor-grabbing hover:bg-amber-100 dark:hover:bg-amber-900/50 transition-colors",
|
|
1110
1175
|
children: [
|
|
1111
1176
|
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-amber-700 dark:text-amber-300", children: "Upload Image" }),
|
|
@@ -1113,56 +1178,56 @@ function Ve() {
|
|
|
1113
1178
|
]
|
|
1114
1179
|
}
|
|
1115
1180
|
),
|
|
1116
|
-
|
|
1181
|
+
d && /* @__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(Je, {}) })
|
|
1117
1182
|
] }),
|
|
1118
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ c("div", { className: "mb-6", children: [
|
|
1119
1184
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide mb-2", children: "Generators" }),
|
|
1120
|
-
Object.entries(b).map(([g,
|
|
1185
|
+
Object.entries(b).map(([g, v]) => /* @__PURE__ */ c("div", { className: "mb-3", children: [
|
|
1121
1186
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: g }),
|
|
1122
|
-
|
|
1187
|
+
v.map((w) => /* @__PURE__ */ c(
|
|
1123
1188
|
"div",
|
|
1124
1189
|
{
|
|
1125
1190
|
draggable: !0,
|
|
1126
|
-
onDragStart: (
|
|
1127
|
-
onDoubleClick: () =>
|
|
1191
|
+
onDragStart: (h) => u(h, w),
|
|
1192
|
+
onDoubleClick: () => l(w),
|
|
1128
1193
|
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",
|
|
1129
1194
|
children: [
|
|
1130
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children:
|
|
1131
|
-
|
|
1195
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children: w.label }),
|
|
1196
|
+
w.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: w.description })
|
|
1132
1197
|
]
|
|
1133
1198
|
},
|
|
1134
|
-
|
|
1199
|
+
w.id
|
|
1135
1200
|
))
|
|
1136
1201
|
] }, g))
|
|
1137
1202
|
] }),
|
|
1138
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ c("div", { className: "mb-6", children: [
|
|
1139
1204
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-teal-600 dark:text-teal-400 uppercase tracking-wide mb-2", children: "Transforms" }),
|
|
1140
|
-
Object.entries(
|
|
1205
|
+
Object.entries(k).map(([g, v]) => /* @__PURE__ */ c("div", { className: "mb-3", children: [
|
|
1141
1206
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: g }),
|
|
1142
|
-
|
|
1207
|
+
v.map((w) => /* @__PURE__ */ c(
|
|
1143
1208
|
"div",
|
|
1144
1209
|
{
|
|
1145
1210
|
draggable: !0,
|
|
1146
|
-
onDragStart: (
|
|
1147
|
-
onDoubleClick: () =>
|
|
1211
|
+
onDragStart: (h) => u(h, w),
|
|
1212
|
+
onDoubleClick: () => l(w),
|
|
1148
1213
|
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",
|
|
1149
1214
|
children: [
|
|
1150
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children:
|
|
1151
|
-
|
|
1215
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children: w.label }),
|
|
1216
|
+
w.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: w.description })
|
|
1152
1217
|
]
|
|
1153
1218
|
},
|
|
1154
|
-
|
|
1219
|
+
w.id
|
|
1155
1220
|
))
|
|
1156
1221
|
] }, g))
|
|
1157
1222
|
] }),
|
|
1158
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ c("div", { className: "mb-6", children: [
|
|
1159
1224
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-green-600 dark:text-green-400 uppercase tracking-wide mb-2", children: "Output" }),
|
|
1160
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ c(
|
|
1161
1226
|
"div",
|
|
1162
1227
|
{
|
|
1163
1228
|
draggable: !0,
|
|
1164
|
-
onDragStart: (g) => u(g,
|
|
1165
|
-
onDoubleClick: () =>
|
|
1229
|
+
onDragStart: (g) => u(g, f),
|
|
1230
|
+
onDoubleClick: () => l(f),
|
|
1166
1231
|
className: "px-3 py-2 bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-700 rounded cursor-grab active:cursor-grabbing hover:bg-green-100 dark:hover:bg-green-900/50 transition-colors",
|
|
1167
1232
|
children: [
|
|
1168
1233
|
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-green-700 dark:text-green-300", children: "Save" }),
|
|
@@ -1173,120 +1238,120 @@ function Ve() {
|
|
|
1173
1238
|
] })
|
|
1174
1239
|
] }) });
|
|
1175
1240
|
}
|
|
1176
|
-
function
|
|
1177
|
-
var p,
|
|
1178
|
-
const r =
|
|
1179
|
-
if (!
|
|
1241
|
+
function Xe() {
|
|
1242
|
+
var p, f;
|
|
1243
|
+
const r = x((b) => b.selectedNodeId), i = x((b) => b.nodes), t = x((b) => b.generators), a = x((b) => b.transforms), s = x((b) => b.updateNodeData), d = x((b) => b.deleteNode), m = i.find((b) => b.id === r);
|
|
1244
|
+
if (!m)
|
|
1180
1245
|
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" }) });
|
|
1181
|
-
let
|
|
1182
|
-
if (
|
|
1183
|
-
const b =
|
|
1184
|
-
|
|
1185
|
-
} else if (
|
|
1186
|
-
const b =
|
|
1187
|
-
|
|
1188
|
-
} else
|
|
1246
|
+
let o, n = "";
|
|
1247
|
+
if (m.type === "generator") {
|
|
1248
|
+
const b = m.data, k = t.find((g) => g.name === b.generatorName);
|
|
1249
|
+
o = (p = k == null ? void 0 : k.params) == null ? void 0 : p.properties, n = (k == null ? void 0 : k.label) || b.generatorName;
|
|
1250
|
+
} else if (m.type === "transform") {
|
|
1251
|
+
const b = m.data, k = a.find((g) => g.name === b.operation);
|
|
1252
|
+
o = (f = k == null ? void 0 : k.params) == null ? void 0 : f.properties, n = (k == null ? void 0 : k.label) || b.operation;
|
|
1253
|
+
} else m.type === "save" && (n = "Save", o = {
|
|
1189
1254
|
destination: {
|
|
1190
1255
|
type: "string",
|
|
1191
1256
|
title: "Destination",
|
|
1192
1257
|
description: "File path to save the image"
|
|
1193
1258
|
}
|
|
1194
1259
|
});
|
|
1195
|
-
const u = (b,
|
|
1196
|
-
if (
|
|
1197
|
-
const g =
|
|
1198
|
-
|
|
1199
|
-
params: { ...g.params, [b]:
|
|
1260
|
+
const u = (b, k) => {
|
|
1261
|
+
if (m.type === "generator") {
|
|
1262
|
+
const g = m.data;
|
|
1263
|
+
s(m.id, {
|
|
1264
|
+
params: { ...g.params, [b]: k }
|
|
1200
1265
|
});
|
|
1201
|
-
} else if (
|
|
1202
|
-
const g =
|
|
1203
|
-
|
|
1204
|
-
params: { ...g.params, [b]:
|
|
1266
|
+
} else if (m.type === "transform") {
|
|
1267
|
+
const g = m.data;
|
|
1268
|
+
s(m.id, {
|
|
1269
|
+
params: { ...g.params, [b]: k }
|
|
1205
1270
|
});
|
|
1206
|
-
} else
|
|
1207
|
-
},
|
|
1208
|
-
if (
|
|
1209
|
-
return
|
|
1210
|
-
if (
|
|
1211
|
-
return
|
|
1212
|
-
if (
|
|
1213
|
-
return
|
|
1271
|
+
} else m.type === "save" && s(m.id, { [b]: k });
|
|
1272
|
+
}, l = (b) => {
|
|
1273
|
+
if (m.type === "generator")
|
|
1274
|
+
return m.data.params[b];
|
|
1275
|
+
if (m.type === "transform")
|
|
1276
|
+
return m.data.params[b];
|
|
1277
|
+
if (m.type === "save")
|
|
1278
|
+
return m.data[b];
|
|
1214
1279
|
};
|
|
1215
|
-
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__ */
|
|
1216
|
-
/* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children:
|
|
1280
|
+
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__ */ c("div", { className: "p-4", children: [
|
|
1281
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-4", children: [
|
|
1282
|
+
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: n }),
|
|
1218
1283
|
/* @__PURE__ */ e(
|
|
1219
1284
|
"button",
|
|
1220
1285
|
{
|
|
1221
|
-
onClick: () =>
|
|
1286
|
+
onClick: () => d(m.id),
|
|
1222
1287
|
className: "text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 text-sm",
|
|
1223
1288
|
children: "Delete"
|
|
1224
1289
|
}
|
|
1225
1290
|
)
|
|
1226
1291
|
] }),
|
|
1227
|
-
/* @__PURE__ */ e("div", { className: "space-y-4", children:
|
|
1228
|
-
|
|
1292
|
+
/* @__PURE__ */ e("div", { className: "space-y-4", children: o && Object.entries(o).map(([b, k]) => /* @__PURE__ */ e(
|
|
1293
|
+
Ze,
|
|
1229
1294
|
{
|
|
1230
1295
|
name: b,
|
|
1231
|
-
field:
|
|
1232
|
-
value:
|
|
1296
|
+
field: k,
|
|
1297
|
+
value: l(b),
|
|
1233
1298
|
onChange: (g) => u(b, g)
|
|
1234
1299
|
},
|
|
1235
1300
|
b
|
|
1236
1301
|
)) })
|
|
1237
1302
|
] }) });
|
|
1238
1303
|
}
|
|
1239
|
-
function
|
|
1240
|
-
const
|
|
1241
|
-
return
|
|
1242
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1243
|
-
/* @__PURE__ */
|
|
1304
|
+
function Ze({ name: r, field: i, value: t, onChange: a }) {
|
|
1305
|
+
const s = i.title || r, d = "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";
|
|
1306
|
+
return i.enum ? /* @__PURE__ */ c("div", { children: [
|
|
1307
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
|
|
1308
|
+
/* @__PURE__ */ c(
|
|
1244
1309
|
"select",
|
|
1245
1310
|
{
|
|
1246
1311
|
value: String(t || ""),
|
|
1247
|
-
onChange: (
|
|
1248
|
-
className:
|
|
1312
|
+
onChange: (m) => a(m.target.value),
|
|
1313
|
+
className: d,
|
|
1249
1314
|
children: [
|
|
1250
1315
|
/* @__PURE__ */ e("option", { value: "", children: "Select..." }),
|
|
1251
|
-
|
|
1316
|
+
i.enum.map((m) => /* @__PURE__ */ e("option", { value: m, children: m }, m))
|
|
1252
1317
|
]
|
|
1253
1318
|
}
|
|
1254
1319
|
),
|
|
1255
|
-
|
|
1256
|
-
] }) :
|
|
1257
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1320
|
+
i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
|
|
1321
|
+
] }) : i.type === "number" ? /* @__PURE__ */ c("div", { children: [
|
|
1322
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
|
|
1258
1323
|
/* @__PURE__ */ e(
|
|
1259
1324
|
"input",
|
|
1260
1325
|
{
|
|
1261
1326
|
type: "number",
|
|
1262
1327
|
value: t !== void 0 ? Number(t) : "",
|
|
1263
|
-
onChange: (
|
|
1264
|
-
min:
|
|
1265
|
-
max:
|
|
1266
|
-
className:
|
|
1328
|
+
onChange: (m) => a(Number(m.target.value)),
|
|
1329
|
+
min: i.minimum,
|
|
1330
|
+
max: i.maximum,
|
|
1331
|
+
className: d
|
|
1267
1332
|
}
|
|
1268
1333
|
),
|
|
1269
|
-
|
|
1270
|
-
] }) :
|
|
1334
|
+
i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
|
|
1335
|
+
] }) : i.type === "boolean" ? /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1271
1336
|
/* @__PURE__ */ e(
|
|
1272
1337
|
"input",
|
|
1273
1338
|
{
|
|
1274
1339
|
type: "checkbox",
|
|
1275
1340
|
checked: !!t,
|
|
1276
|
-
onChange: (
|
|
1341
|
+
onChange: (m) => a(m.target.checked),
|
|
1277
1342
|
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"
|
|
1278
1343
|
}
|
|
1279
1344
|
),
|
|
1280
|
-
/* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children:
|
|
1281
|
-
] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */
|
|
1282
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1283
|
-
/* @__PURE__ */
|
|
1345
|
+
/* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: s })
|
|
1346
|
+
] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ c("div", { children: [
|
|
1347
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
|
|
1348
|
+
/* @__PURE__ */ c("div", { className: "flex gap-2", children: [
|
|
1284
1349
|
/* @__PURE__ */ e(
|
|
1285
1350
|
"input",
|
|
1286
1351
|
{
|
|
1287
1352
|
type: "color",
|
|
1288
1353
|
value: String(t || "#000000"),
|
|
1289
|
-
onChange: (
|
|
1354
|
+
onChange: (m) => a(m.target.value),
|
|
1290
1355
|
className: "h-10 w-14 p-1 border border-gray-300 dark:border-zinc-600 rounded"
|
|
1291
1356
|
}
|
|
1292
1357
|
),
|
|
@@ -1295,142 +1360,142 @@ function qe({ name: r, field: s, value: t, onChange: o }) {
|
|
|
1295
1360
|
{
|
|
1296
1361
|
type: "text",
|
|
1297
1362
|
value: String(t || ""),
|
|
1298
|
-
onChange: (
|
|
1299
|
-
className:
|
|
1363
|
+
onChange: (m) => a(m.target.value),
|
|
1364
|
+
className: d + " flex-1"
|
|
1300
1365
|
}
|
|
1301
1366
|
)
|
|
1302
1367
|
] })
|
|
1303
|
-
] }) :
|
|
1304
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1368
|
+
] }) : i.type === "object" ? /* @__PURE__ */ c("div", { children: [
|
|
1369
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
|
|
1305
1370
|
/* @__PURE__ */ e(
|
|
1306
1371
|
"textarea",
|
|
1307
1372
|
{
|
|
1308
1373
|
value: t ? JSON.stringify(t, null, 2) : "{}",
|
|
1309
|
-
onChange: (
|
|
1374
|
+
onChange: (m) => {
|
|
1310
1375
|
try {
|
|
1311
|
-
|
|
1376
|
+
a(JSON.parse(m.target.value));
|
|
1312
1377
|
} catch {
|
|
1313
1378
|
}
|
|
1314
1379
|
},
|
|
1315
1380
|
rows: 4,
|
|
1316
|
-
className:
|
|
1381
|
+
className: d + " font-mono text-xs"
|
|
1317
1382
|
}
|
|
1318
1383
|
),
|
|
1319
|
-
|
|
1320
|
-
] }) : /* @__PURE__ */
|
|
1321
|
-
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children:
|
|
1384
|
+
i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
|
|
1385
|
+
] }) : /* @__PURE__ */ c("div", { children: [
|
|
1386
|
+
/* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: s }),
|
|
1322
1387
|
r === "prompt" || r === "code" || r === "text" ? /* @__PURE__ */ e(
|
|
1323
1388
|
"textarea",
|
|
1324
1389
|
{
|
|
1325
1390
|
value: String(t || ""),
|
|
1326
|
-
onChange: (
|
|
1391
|
+
onChange: (m) => a(m.target.value),
|
|
1327
1392
|
rows: 3,
|
|
1328
|
-
className:
|
|
1393
|
+
className: d
|
|
1329
1394
|
}
|
|
1330
1395
|
) : /* @__PURE__ */ e(
|
|
1331
1396
|
"input",
|
|
1332
1397
|
{
|
|
1333
1398
|
type: "text",
|
|
1334
1399
|
value: String(t || ""),
|
|
1335
|
-
onChange: (
|
|
1336
|
-
className:
|
|
1400
|
+
onChange: (m) => a(m.target.value),
|
|
1401
|
+
className: d
|
|
1337
1402
|
}
|
|
1338
1403
|
),
|
|
1339
|
-
|
|
1404
|
+
i.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: i.description })
|
|
1340
1405
|
] });
|
|
1341
1406
|
}
|
|
1342
|
-
function
|
|
1343
|
-
const t = new Map(r.map((
|
|
1344
|
-
for (const
|
|
1345
|
-
|
|
1346
|
-
for (const
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1407
|
+
function et(r, i) {
|
|
1408
|
+
const t = new Map(r.map((o) => [o.id, o])), a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
1409
|
+
for (const o of r)
|
|
1410
|
+
a.set(o.id, 0), s.set(o.id, []);
|
|
1411
|
+
for (const o of i) {
|
|
1412
|
+
const n = s.get(o.source) || [];
|
|
1413
|
+
n.push(o.target), s.set(o.source, n), a.set(o.target, (a.get(o.target) || 0) + 1);
|
|
1349
1414
|
}
|
|
1350
|
-
const
|
|
1351
|
-
for (const [
|
|
1352
|
-
|
|
1353
|
-
const
|
|
1354
|
-
for (;
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
const u =
|
|
1358
|
-
for (const
|
|
1359
|
-
const p = (
|
|
1360
|
-
|
|
1415
|
+
const d = [];
|
|
1416
|
+
for (const [o, n] of a)
|
|
1417
|
+
n === 0 && d.push(o);
|
|
1418
|
+
const m = [];
|
|
1419
|
+
for (; d.length > 0; ) {
|
|
1420
|
+
const o = d.shift(), n = t.get(o);
|
|
1421
|
+
n && m.push(n);
|
|
1422
|
+
const u = s.get(o) || [];
|
|
1423
|
+
for (const l of u) {
|
|
1424
|
+
const p = (a.get(l) || 1) - 1;
|
|
1425
|
+
a.set(l, p), p === 0 && d.push(l);
|
|
1361
1426
|
}
|
|
1362
1427
|
}
|
|
1363
|
-
return
|
|
1428
|
+
return m;
|
|
1364
1429
|
}
|
|
1365
|
-
function
|
|
1366
|
-
const
|
|
1367
|
-
return `${
|
|
1430
|
+
function tt(r) {
|
|
1431
|
+
const i = r.type || "node", t = r.id.replace(/[^a-zA-Z0-9]/g, "_");
|
|
1432
|
+
return `${i}_${t}`;
|
|
1368
1433
|
}
|
|
1369
|
-
function
|
|
1434
|
+
function E(r) {
|
|
1370
1435
|
return typeof r == "string" ? r.includes(`
|
|
1371
1436
|
`) ? "`" + r.replace(/`/g, "\\`").replace(/\$/g, "\\$") + "`" : JSON.stringify(r) : JSON.stringify(r, null, 2);
|
|
1372
1437
|
}
|
|
1373
|
-
function
|
|
1374
|
-
const
|
|
1438
|
+
function rt(r, i, t) {
|
|
1439
|
+
const a = t.get(r.id), s = [], d = i.find((o) => o.target === r.id), m = d ? t.get(d.source) : null;
|
|
1375
1440
|
switch (r.type) {
|
|
1376
1441
|
case "generator": {
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1379
|
-
const
|
|
1442
|
+
const o = r.data;
|
|
1443
|
+
s.push(o.generatorName);
|
|
1444
|
+
const n = o.params || {}, u = Object.entries(n).filter(([, l]) => l !== void 0 && l !== "").map(([l, p]) => ` ${l}: ${E(p)}`).join(`,
|
|
1380
1445
|
`);
|
|
1381
1446
|
return {
|
|
1382
|
-
code: `// Generate image using ${
|
|
1383
|
-
const ${
|
|
1447
|
+
code: `// Generate image using ${o.generatorName}
|
|
1448
|
+
const ${a} = await ${o.generatorName}({
|
|
1384
1449
|
${u}
|
|
1385
1450
|
});`,
|
|
1386
|
-
imports:
|
|
1451
|
+
imports: s
|
|
1387
1452
|
};
|
|
1388
1453
|
}
|
|
1389
1454
|
case "input":
|
|
1390
1455
|
return {
|
|
1391
1456
|
code: `// Load input image
|
|
1392
|
-
const ${
|
|
1457
|
+
const ${a} = await flo.loadImage("./input.png");`,
|
|
1393
1458
|
imports: []
|
|
1394
1459
|
};
|
|
1395
1460
|
case "transform": {
|
|
1396
|
-
const
|
|
1461
|
+
const o = r.data, n = o.params || {}, u = Object.entries(n).filter(([, p]) => p !== void 0 && p !== "").map(([p, f]) => `${p}: ${E(f)}`).join(", "), l = m || "image";
|
|
1397
1462
|
return {
|
|
1398
|
-
code: `// Apply ${
|
|
1399
|
-
const ${
|
|
1463
|
+
code: `// Apply ${o.operation} transform
|
|
1464
|
+
const ${a} = await flo.transform(${l}, "${o.operation}"${u ? `, { ${u} }` : ""});`,
|
|
1400
1465
|
imports: []
|
|
1401
1466
|
};
|
|
1402
1467
|
}
|
|
1403
1468
|
case "vision": {
|
|
1404
|
-
const
|
|
1405
|
-
|
|
1406
|
-
const
|
|
1469
|
+
const o = r.data;
|
|
1470
|
+
s.push(o.providerName);
|
|
1471
|
+
const n = o.params || {}, u = m || "image", l = Object.entries(n).filter(([, p]) => p !== void 0 && p !== "").map(([p, f]) => ` ${p}: ${E(f)}`).join(`,
|
|
1407
1472
|
`);
|
|
1408
1473
|
return {
|
|
1409
|
-
code: `// Analyze image with ${
|
|
1410
|
-
const ${
|
|
1411
|
-
${
|
|
1474
|
+
code: `// Analyze image with ${o.providerName}
|
|
1475
|
+
const ${a} = await ${o.providerName}.analyze(${u}, {
|
|
1476
|
+
${l}
|
|
1412
1477
|
});`,
|
|
1413
|
-
imports:
|
|
1478
|
+
imports: s
|
|
1414
1479
|
};
|
|
1415
1480
|
}
|
|
1416
1481
|
case "text": {
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
const
|
|
1482
|
+
const o = r.data;
|
|
1483
|
+
s.push(o.providerName);
|
|
1484
|
+
const n = o.params || {}, u = Object.entries(n).filter(([, l]) => l !== void 0 && l !== "").map(([l, p]) => ` ${l}: ${E(p)}`).join(`,
|
|
1420
1485
|
`);
|
|
1421
1486
|
return {
|
|
1422
|
-
code: `// Generate text with ${
|
|
1423
|
-
const ${
|
|
1487
|
+
code: `// Generate text with ${o.providerName}
|
|
1488
|
+
const ${a} = await ${o.providerName}.generate({
|
|
1424
1489
|
${u}
|
|
1425
1490
|
});`,
|
|
1426
|
-
imports:
|
|
1491
|
+
imports: s
|
|
1427
1492
|
};
|
|
1428
1493
|
}
|
|
1429
1494
|
case "save": {
|
|
1430
|
-
const
|
|
1495
|
+
const o = r.data;
|
|
1431
1496
|
return {
|
|
1432
1497
|
code: `// Save result
|
|
1433
|
-
await flo.save(${
|
|
1498
|
+
await flo.save(${m || "result"}, ${E(o.destination)});`,
|
|
1434
1499
|
imports: []
|
|
1435
1500
|
};
|
|
1436
1501
|
}
|
|
@@ -1441,33 +1506,33 @@ await flo.save(${l || "result"}, ${U(a.destination)});`,
|
|
|
1441
1506
|
};
|
|
1442
1507
|
}
|
|
1443
1508
|
}
|
|
1444
|
-
function
|
|
1509
|
+
function at(r, i) {
|
|
1445
1510
|
if (r.length === 0)
|
|
1446
1511
|
return `// Empty workflow
|
|
1447
1512
|
// Add nodes to your canvas to generate code`;
|
|
1448
|
-
const t =
|
|
1513
|
+
const t = et(r, i), a = /* @__PURE__ */ new Map();
|
|
1449
1514
|
for (const u of t)
|
|
1450
|
-
|
|
1451
|
-
const
|
|
1515
|
+
a.set(u.id, tt(u));
|
|
1516
|
+
const s = /* @__PURE__ */ new Set(), d = [];
|
|
1452
1517
|
for (const u of t) {
|
|
1453
|
-
const { code:
|
|
1454
|
-
|
|
1455
|
-
for (const
|
|
1456
|
-
|
|
1518
|
+
const { code: l, imports: p } = rt(u, i, a);
|
|
1519
|
+
d.push(l);
|
|
1520
|
+
for (const f of p)
|
|
1521
|
+
s.add(f);
|
|
1457
1522
|
}
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
const
|
|
1523
|
+
const m = [];
|
|
1524
|
+
s.size > 0 && m.push(`import { ${Array.from(s).join(", ")} } from "@teamflojo/floimg";`), m.push('import * as flo from "@teamflojo/floimg";');
|
|
1525
|
+
const o = `/**
|
|
1461
1526
|
* FloImg Workflow
|
|
1462
1527
|
* Generated by FloImg Studio
|
|
1463
1528
|
* https://floimg.com
|
|
1464
1529
|
*/
|
|
1465
1530
|
|
|
1466
|
-
`,
|
|
1531
|
+
`, n = `
|
|
1467
1532
|
async function runWorkflow() {
|
|
1468
|
-
${
|
|
1533
|
+
${d.map(
|
|
1469
1534
|
(u) => u.split(`
|
|
1470
|
-
`).map((
|
|
1535
|
+
`).map((l) => " " + l).join(`
|
|
1471
1536
|
`)
|
|
1472
1537
|
).join(`
|
|
1473
1538
|
|
|
@@ -1477,55 +1542,291 @@ ${i.map(
|
|
|
1477
1542
|
// Run the workflow
|
|
1478
1543
|
runWorkflow().catch(console.error);
|
|
1479
1544
|
`;
|
|
1480
|
-
return
|
|
1545
|
+
return o + m.join(`
|
|
1481
1546
|
`) + `
|
|
1482
|
-
` +
|
|
1547
|
+
` + n;
|
|
1548
|
+
}
|
|
1549
|
+
function ot({ isOpen: r, onClose: i, onImport: t }) {
|
|
1550
|
+
const [a, s] = N(""), [d, m] = N(!1), [o, n] = N(null), [u, l] = N(!1), p = C(async () => {
|
|
1551
|
+
if (!a.trim()) {
|
|
1552
|
+
n({ message: "Please enter or paste YAML content" });
|
|
1553
|
+
return;
|
|
1554
|
+
}
|
|
1555
|
+
m(!0), n(null);
|
|
1556
|
+
try {
|
|
1557
|
+
const h = await Ee(a);
|
|
1558
|
+
h.success ? (t(h.nodes, h.edges, h.name), s(""), i()) : n({
|
|
1559
|
+
message: h.error || "Import failed",
|
|
1560
|
+
line: h.line,
|
|
1561
|
+
column: h.column
|
|
1562
|
+
});
|
|
1563
|
+
} catch (h) {
|
|
1564
|
+
n({ message: h instanceof Error ? h.message : "Import failed" });
|
|
1565
|
+
} finally {
|
|
1566
|
+
m(!1);
|
|
1567
|
+
}
|
|
1568
|
+
}, [a, t, i]), f = C(async () => {
|
|
1569
|
+
if (!a.trim()) {
|
|
1570
|
+
n({ message: "Please enter or paste YAML content" });
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
m(!0), n(null);
|
|
1574
|
+
try {
|
|
1575
|
+
const h = await Oe(a);
|
|
1576
|
+
h.valid ? (n(null), n({ message: "Valid YAML!" }), setTimeout(() => n(null), 2e3)) : h.errors.length > 0 && n(h.errors[0]);
|
|
1577
|
+
} catch (h) {
|
|
1578
|
+
n({ message: h instanceof Error ? h.message : "Validation failed" });
|
|
1579
|
+
} finally {
|
|
1580
|
+
m(!1);
|
|
1581
|
+
}
|
|
1582
|
+
}, [a]), b = C(async (h) => {
|
|
1583
|
+
if (!h.name.endsWith(".yaml") && !h.name.endsWith(".yml")) {
|
|
1584
|
+
n({ message: "Please upload a .yaml or .yml file" });
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
try {
|
|
1588
|
+
const z = await h.text();
|
|
1589
|
+
s(z), n(null);
|
|
1590
|
+
} catch {
|
|
1591
|
+
n({ message: "Failed to read file" });
|
|
1592
|
+
}
|
|
1593
|
+
}, []), k = C((h) => {
|
|
1594
|
+
h.preventDefault(), l(!0);
|
|
1595
|
+
}, []), g = C((h) => {
|
|
1596
|
+
h.preventDefault(), l(!1);
|
|
1597
|
+
}, []), v = C(
|
|
1598
|
+
(h) => {
|
|
1599
|
+
h.preventDefault(), l(!1);
|
|
1600
|
+
const z = h.dataTransfer.files[0];
|
|
1601
|
+
z && b(z);
|
|
1602
|
+
},
|
|
1603
|
+
[b]
|
|
1604
|
+
), w = C(
|
|
1605
|
+
(h) => {
|
|
1606
|
+
var S;
|
|
1607
|
+
const z = (S = h.target.files) == null ? void 0 : S[0];
|
|
1608
|
+
z && b(z);
|
|
1609
|
+
},
|
|
1610
|
+
[b]
|
|
1611
|
+
);
|
|
1612
|
+
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ c("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: [
|
|
1613
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
1614
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Import Workflow" }),
|
|
1615
|
+
/* @__PURE__ */ e(
|
|
1616
|
+
"button",
|
|
1617
|
+
{
|
|
1618
|
+
onClick: i,
|
|
1619
|
+
className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
|
|
1620
|
+
children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
1621
|
+
"path",
|
|
1622
|
+
{
|
|
1623
|
+
strokeLinecap: "round",
|
|
1624
|
+
strokeLinejoin: "round",
|
|
1625
|
+
strokeWidth: 2,
|
|
1626
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1627
|
+
}
|
|
1628
|
+
) })
|
|
1629
|
+
}
|
|
1630
|
+
)
|
|
1631
|
+
] }),
|
|
1632
|
+
/* @__PURE__ */ c("div", { className: "p-4 flex-1 overflow-auto", children: [
|
|
1633
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-4", children: "Paste YAML content or drag and drop a .yaml file to import a workflow." }),
|
|
1634
|
+
/* @__PURE__ */ c(
|
|
1635
|
+
"div",
|
|
1636
|
+
{
|
|
1637
|
+
onDragOver: k,
|
|
1638
|
+
onDragLeave: g,
|
|
1639
|
+
onDrop: v,
|
|
1640
|
+
className: `border-2 border-dashed rounded-lg p-4 mb-4 text-center transition-colors ${u ? "border-teal-500 bg-teal-50 dark:bg-teal-900/20" : "border-gray-300 dark:border-zinc-600"}`,
|
|
1641
|
+
children: [
|
|
1642
|
+
/* @__PURE__ */ e(
|
|
1643
|
+
"input",
|
|
1644
|
+
{
|
|
1645
|
+
type: "file",
|
|
1646
|
+
accept: ".yaml,.yml",
|
|
1647
|
+
onChange: w,
|
|
1648
|
+
className: "hidden",
|
|
1649
|
+
id: "yaml-file-input"
|
|
1650
|
+
}
|
|
1651
|
+
),
|
|
1652
|
+
/* @__PURE__ */ c(
|
|
1653
|
+
"label",
|
|
1654
|
+
{
|
|
1655
|
+
htmlFor: "yaml-file-input",
|
|
1656
|
+
className: "cursor-pointer text-sm text-gray-600 dark:text-zinc-400",
|
|
1657
|
+
children: [
|
|
1658
|
+
/* @__PURE__ */ e(
|
|
1659
|
+
"svg",
|
|
1660
|
+
{
|
|
1661
|
+
className: "h-8 w-8 mx-auto mb-2 text-gray-400 dark:text-zinc-500",
|
|
1662
|
+
fill: "none",
|
|
1663
|
+
viewBox: "0 0 24 24",
|
|
1664
|
+
stroke: "currentColor",
|
|
1665
|
+
children: /* @__PURE__ */ e(
|
|
1666
|
+
"path",
|
|
1667
|
+
{
|
|
1668
|
+
strokeLinecap: "round",
|
|
1669
|
+
strokeLinejoin: "round",
|
|
1670
|
+
strokeWidth: 2,
|
|
1671
|
+
d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
|
|
1672
|
+
}
|
|
1673
|
+
)
|
|
1674
|
+
}
|
|
1675
|
+
),
|
|
1676
|
+
/* @__PURE__ */ e("span", { className: "text-teal-600 dark:text-teal-400 hover:underline", children: "Click to upload" }),
|
|
1677
|
+
" ",
|
|
1678
|
+
"or drag and drop",
|
|
1679
|
+
/* @__PURE__ */ e("br", {}),
|
|
1680
|
+
/* @__PURE__ */ e("span", { className: "text-xs", children: ".yaml or .yml files" })
|
|
1681
|
+
]
|
|
1682
|
+
}
|
|
1683
|
+
)
|
|
1684
|
+
]
|
|
1685
|
+
}
|
|
1686
|
+
),
|
|
1687
|
+
/* @__PURE__ */ e(
|
|
1688
|
+
"textarea",
|
|
1689
|
+
{
|
|
1690
|
+
value: a,
|
|
1691
|
+
onChange: (h) => {
|
|
1692
|
+
s(h.target.value), n(null);
|
|
1693
|
+
},
|
|
1694
|
+
placeholder: `name: My Workflow
|
|
1695
|
+
steps:
|
|
1696
|
+
- kind: generate
|
|
1697
|
+
generator: quickchart
|
|
1698
|
+
params:
|
|
1699
|
+
type: bar
|
|
1700
|
+
data:
|
|
1701
|
+
labels: [Q1, Q2, Q3, Q4]
|
|
1702
|
+
datasets:
|
|
1703
|
+
- label: Revenue
|
|
1704
|
+
data: [12, 19, 8, 15]
|
|
1705
|
+
out: v0
|
|
1706
|
+
|
|
1707
|
+
- kind: transform
|
|
1708
|
+
op: resize
|
|
1709
|
+
in: v0
|
|
1710
|
+
params:
|
|
1711
|
+
width: 800
|
|
1712
|
+
out: v1`,
|
|
1713
|
+
className: "w-full h-64 p-3 font-mono text-sm bg-gray-100 dark:bg-zinc-900 border border-gray-300 dark:border-zinc-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500 text-gray-800 dark:text-zinc-200"
|
|
1714
|
+
}
|
|
1715
|
+
),
|
|
1716
|
+
o && /* @__PURE__ */ c(
|
|
1717
|
+
"div",
|
|
1718
|
+
{
|
|
1719
|
+
className: `mt-4 p-3 rounded-lg text-sm ${o.message === "Valid YAML!" ? "bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400" : "bg-red-50 dark:bg-red-900/30 text-red-700 dark:text-red-400"}`,
|
|
1720
|
+
children: [
|
|
1721
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: o.message }),
|
|
1722
|
+
o.line && /* @__PURE__ */ c("span", { className: "ml-2 text-xs", children: [
|
|
1723
|
+
"(line ",
|
|
1724
|
+
o.line,
|
|
1725
|
+
o.column ? `, column ${o.column}` : "",
|
|
1726
|
+
")"
|
|
1727
|
+
] })
|
|
1728
|
+
]
|
|
1729
|
+
}
|
|
1730
|
+
)
|
|
1731
|
+
] }),
|
|
1732
|
+
/* @__PURE__ */ c("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
|
|
1733
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: "Use with floimg CLI: floimg run workflow.yaml" }),
|
|
1734
|
+
/* @__PURE__ */ c("div", { className: "flex gap-2", children: [
|
|
1735
|
+
/* @__PURE__ */ e(
|
|
1736
|
+
"button",
|
|
1737
|
+
{
|
|
1738
|
+
onClick: f,
|
|
1739
|
+
disabled: d || !a.trim(),
|
|
1740
|
+
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",
|
|
1741
|
+
children: "Validate"
|
|
1742
|
+
}
|
|
1743
|
+
),
|
|
1744
|
+
/* @__PURE__ */ c(
|
|
1745
|
+
"button",
|
|
1746
|
+
{
|
|
1747
|
+
onClick: p,
|
|
1748
|
+
disabled: d || !a.trim(),
|
|
1749
|
+
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",
|
|
1750
|
+
children: [
|
|
1751
|
+
d && /* @__PURE__ */ c("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
|
|
1752
|
+
/* @__PURE__ */ e(
|
|
1753
|
+
"circle",
|
|
1754
|
+
{
|
|
1755
|
+
className: "opacity-25",
|
|
1756
|
+
cx: "12",
|
|
1757
|
+
cy: "12",
|
|
1758
|
+
r: "10",
|
|
1759
|
+
stroke: "currentColor",
|
|
1760
|
+
strokeWidth: "4"
|
|
1761
|
+
}
|
|
1762
|
+
),
|
|
1763
|
+
/* @__PURE__ */ e(
|
|
1764
|
+
"path",
|
|
1765
|
+
{
|
|
1766
|
+
className: "opacity-75",
|
|
1767
|
+
fill: "currentColor",
|
|
1768
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
1769
|
+
}
|
|
1770
|
+
)
|
|
1771
|
+
] }),
|
|
1772
|
+
"Import"
|
|
1773
|
+
]
|
|
1774
|
+
}
|
|
1775
|
+
)
|
|
1776
|
+
] })
|
|
1777
|
+
] })
|
|
1778
|
+
] }) }) : null;
|
|
1483
1779
|
}
|
|
1484
|
-
function
|
|
1780
|
+
function nt({
|
|
1485
1781
|
brandingSlot: r,
|
|
1486
|
-
beforeActionsSlot:
|
|
1782
|
+
beforeActionsSlot: i,
|
|
1487
1783
|
afterActionsSlot: t,
|
|
1488
|
-
hideAttribution:
|
|
1784
|
+
hideAttribution: a = !1
|
|
1489
1785
|
} = {}) {
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1786
|
+
const s = x((y) => y.execution), d = x((y) => y.execute), m = x((y) => y.exportToYaml), o = x((y) => y.importFromYaml), n = x((y) => y.nodes), u = x((y) => y.edges), l = $((y) => y.openSettings), p = x((y) => y.activeWorkflowName), f = x((y) => y.hasUnsavedChanges), b = x((y) => y.saveWorkflow), k = x((y) => y.toggleLibrary), g = x((y) => y.setActiveWorkflowName), [v, w] = N(!1), [h, z] = N(!1), [S, B] = N("yaml"), [J, le] = N(""), [Y, ce] = N(""), [X, j] = N(null), [me, V] = N(!1), [Z, G] = N("");
|
|
1787
|
+
M(() => {
|
|
1788
|
+
const y = () => {
|
|
1789
|
+
j("New workflow created"), setTimeout(() => j(null), 2e3);
|
|
1494
1790
|
};
|
|
1495
|
-
return window.addEventListener("new-workflow-created",
|
|
1791
|
+
return window.addEventListener("new-workflow-created", y), () => window.removeEventListener("new-workflow-created", y);
|
|
1496
1792
|
}, []);
|
|
1497
|
-
const
|
|
1498
|
-
|
|
1499
|
-
}, [
|
|
1500
|
-
|
|
1501
|
-
},
|
|
1502
|
-
const
|
|
1503
|
-
|
|
1793
|
+
const q = C(() => {
|
|
1794
|
+
n.length !== 0 && (b(), j("Saved!"), setTimeout(() => j(null), 2e3));
|
|
1795
|
+
}, [n.length, b]), ue = () => {
|
|
1796
|
+
G(p), V(!0);
|
|
1797
|
+
}, ee = () => {
|
|
1798
|
+
const y = Z.trim();
|
|
1799
|
+
y && y !== p && g(y), V(!1);
|
|
1504
1800
|
};
|
|
1505
|
-
|
|
1506
|
-
function
|
|
1507
|
-
(
|
|
1801
|
+
M(() => {
|
|
1802
|
+
function y(D) {
|
|
1803
|
+
(D.metaKey || D.ctrlKey) && D.key === "s" && (D.preventDefault(), q());
|
|
1508
1804
|
}
|
|
1509
|
-
return document.addEventListener("keydown",
|
|
1510
|
-
}, [
|
|
1511
|
-
const
|
|
1512
|
-
await
|
|
1513
|
-
},
|
|
1514
|
-
const
|
|
1515
|
-
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
},
|
|
1519
|
-
const
|
|
1520
|
-
navigator.clipboard.writeText(
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1805
|
+
return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
|
|
1806
|
+
}, [q]);
|
|
1807
|
+
const ge = async () => {
|
|
1808
|
+
await d();
|
|
1809
|
+
}, pe = async () => {
|
|
1810
|
+
const y = await m();
|
|
1811
|
+
le(y);
|
|
1812
|
+
const D = at(n, u);
|
|
1813
|
+
ce(D), w(!0);
|
|
1814
|
+
}, he = () => {
|
|
1815
|
+
const y = S === "yaml" ? J : Y;
|
|
1816
|
+
navigator.clipboard.writeText(y);
|
|
1817
|
+
}, fe = C(
|
|
1818
|
+
(y, D, be) => {
|
|
1819
|
+
o(y, D, be), j("Workflow imported!"), setTimeout(() => j(null), 2e3);
|
|
1820
|
+
},
|
|
1821
|
+
[o]
|
|
1822
|
+
);
|
|
1823
|
+
return /* @__PURE__ */ c(P, { children: [
|
|
1824
|
+
/* @__PURE__ */ c("div", { className: "h-14 bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between px-4", children: [
|
|
1825
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
1525
1826
|
/* @__PURE__ */ e(
|
|
1526
1827
|
"button",
|
|
1527
1828
|
{
|
|
1528
|
-
onClick:
|
|
1829
|
+
onClick: k,
|
|
1529
1830
|
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",
|
|
1530
1831
|
title: "My Workflows",
|
|
1531
1832
|
children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -1539,10 +1840,10 @@ function Ye({
|
|
|
1539
1840
|
) })
|
|
1540
1841
|
}
|
|
1541
1842
|
),
|
|
1542
|
-
/* @__PURE__ */
|
|
1543
|
-
/* @__PURE__ */ e("h1", { className: "text-xl font-bold text-gray-800 dark:text-white", children: "
|
|
1843
|
+
/* @__PURE__ */ c("div", { className: "flex items-baseline gap-2", children: [
|
|
1844
|
+
/* @__PURE__ */ e("h1", { className: "text-xl font-bold text-gray-800 dark:text-white", children: "FloImg Studio" }),
|
|
1544
1845
|
r,
|
|
1545
|
-
!
|
|
1846
|
+
!a && /* @__PURE__ */ e(
|
|
1546
1847
|
"a",
|
|
1547
1848
|
{
|
|
1548
1849
|
href: "https://flojo.io",
|
|
@@ -1553,16 +1854,16 @@ function Ye({
|
|
|
1553
1854
|
}
|
|
1554
1855
|
)
|
|
1555
1856
|
] }),
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
|
|
1857
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1858
|
+
me ? /* @__PURE__ */ e(
|
|
1558
1859
|
"input",
|
|
1559
1860
|
{
|
|
1560
1861
|
type: "text",
|
|
1561
|
-
value:
|
|
1562
|
-
onChange: (
|
|
1563
|
-
onBlur:
|
|
1564
|
-
onKeyDown: (
|
|
1565
|
-
|
|
1862
|
+
value: Z,
|
|
1863
|
+
onChange: (y) => G(y.target.value),
|
|
1864
|
+
onBlur: ee,
|
|
1865
|
+
onKeyDown: (y) => {
|
|
1866
|
+
y.key === "Enter" && ee(), y.key === "Escape" && (G(p), V(!1));
|
|
1566
1867
|
},
|
|
1567
1868
|
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",
|
|
1568
1869
|
autoFocus: !0
|
|
@@ -1570,30 +1871,30 @@ function Ye({
|
|
|
1570
1871
|
) : /* @__PURE__ */ e(
|
|
1571
1872
|
"button",
|
|
1572
1873
|
{
|
|
1573
|
-
onClick:
|
|
1874
|
+
onClick: ue,
|
|
1574
1875
|
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",
|
|
1575
1876
|
title: "Click to rename",
|
|
1576
|
-
children:
|
|
1877
|
+
children: p
|
|
1577
1878
|
}
|
|
1578
1879
|
),
|
|
1579
|
-
|
|
1580
|
-
|
|
1880
|
+
f && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
|
|
1881
|
+
X && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: X })
|
|
1581
1882
|
] }),
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
|
|
1883
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
|
|
1884
|
+
n.length,
|
|
1584
1885
|
" node",
|
|
1585
|
-
|
|
1886
|
+
n.length !== 1 ? "s" : ""
|
|
1586
1887
|
] })
|
|
1587
1888
|
] }),
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
|
|
1889
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-3", children: [
|
|
1890
|
+
i,
|
|
1590
1891
|
/* @__PURE__ */ e(
|
|
1591
1892
|
"button",
|
|
1592
1893
|
{
|
|
1593
|
-
onClick:
|
|
1894
|
+
onClick: l,
|
|
1594
1895
|
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",
|
|
1595
1896
|
title: "AI Settings",
|
|
1596
|
-
children: /* @__PURE__ */
|
|
1897
|
+
children: /* @__PURE__ */ c("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
1597
1898
|
/* @__PURE__ */ e(
|
|
1598
1899
|
"path",
|
|
1599
1900
|
{
|
|
@@ -1618,8 +1919,8 @@ function Ye({
|
|
|
1618
1919
|
/* @__PURE__ */ e(
|
|
1619
1920
|
"button",
|
|
1620
1921
|
{
|
|
1621
|
-
onClick:
|
|
1622
|
-
disabled:
|
|
1922
|
+
onClick: q,
|
|
1923
|
+
disabled: n.length === 0,
|
|
1623
1924
|
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",
|
|
1624
1925
|
title: "Save Workflow (Cmd+S)",
|
|
1625
1926
|
children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -1636,8 +1937,16 @@ function Ye({
|
|
|
1636
1937
|
/* @__PURE__ */ e(
|
|
1637
1938
|
"button",
|
|
1638
1939
|
{
|
|
1639
|
-
onClick:
|
|
1640
|
-
|
|
1940
|
+
onClick: () => z(!0),
|
|
1941
|
+
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",
|
|
1942
|
+
children: "Import"
|
|
1943
|
+
}
|
|
1944
|
+
),
|
|
1945
|
+
/* @__PURE__ */ e(
|
|
1946
|
+
"button",
|
|
1947
|
+
{
|
|
1948
|
+
onClick: pe,
|
|
1949
|
+
disabled: n.length === 0,
|
|
1641
1950
|
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",
|
|
1642
1951
|
children: "Export"
|
|
1643
1952
|
}
|
|
@@ -1645,11 +1954,11 @@ function Ye({
|
|
|
1645
1954
|
/* @__PURE__ */ e(
|
|
1646
1955
|
"button",
|
|
1647
1956
|
{
|
|
1648
|
-
onClick:
|
|
1649
|
-
disabled:
|
|
1957
|
+
onClick: ge,
|
|
1958
|
+
disabled: n.length === 0 || s.status === "running",
|
|
1650
1959
|
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",
|
|
1651
|
-
children:
|
|
1652
|
-
/* @__PURE__ */
|
|
1960
|
+
children: s.status === "running" ? /* @__PURE__ */ c(P, { children: [
|
|
1961
|
+
/* @__PURE__ */ c("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
|
|
1653
1962
|
/* @__PURE__ */ e(
|
|
1654
1963
|
"circle",
|
|
1655
1964
|
{
|
|
@@ -1671,8 +1980,8 @@ function Ye({
|
|
|
1671
1980
|
)
|
|
1672
1981
|
] }),
|
|
1673
1982
|
"Running..."
|
|
1674
|
-
] }) : /* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1983
|
+
] }) : /* @__PURE__ */ c(P, { children: [
|
|
1984
|
+
/* @__PURE__ */ c("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
1676
1985
|
/* @__PURE__ */ e(
|
|
1677
1986
|
"path",
|
|
1678
1987
|
{
|
|
@@ -1699,54 +2008,54 @@ function Ye({
|
|
|
1699
2008
|
t
|
|
1700
2009
|
] })
|
|
1701
2010
|
] }),
|
|
1702
|
-
|
|
1703
|
-
/* @__PURE__ */
|
|
2011
|
+
s.status === "completed" && s.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__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
2012
|
+
/* @__PURE__ */ c("span", { className: "text-green-700 dark:text-green-400 font-medium", children: [
|
|
1704
2013
|
"Generated ",
|
|
1705
|
-
|
|
2014
|
+
s.imageIds.length,
|
|
1706
2015
|
" image",
|
|
1707
|
-
|
|
2016
|
+
s.imageIds.length !== 1 ? "s" : ""
|
|
1708
2017
|
] }),
|
|
1709
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2", children:
|
|
2018
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2", children: s.imageIds.slice(0, 4).map((y) => /* @__PURE__ */ e(
|
|
1710
2019
|
"a",
|
|
1711
2020
|
{
|
|
1712
|
-
href:
|
|
2021
|
+
href: F(y),
|
|
1713
2022
|
target: "_blank",
|
|
1714
2023
|
rel: "noopener noreferrer",
|
|
1715
2024
|
className: "block",
|
|
1716
2025
|
children: /* @__PURE__ */ e(
|
|
1717
2026
|
"img",
|
|
1718
2027
|
{
|
|
1719
|
-
src:
|
|
2028
|
+
src: F(y),
|
|
1720
2029
|
alt: "Generated",
|
|
1721
2030
|
className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
|
|
1722
2031
|
}
|
|
1723
2032
|
)
|
|
1724
2033
|
},
|
|
1725
|
-
|
|
2034
|
+
y
|
|
1726
2035
|
)) })
|
|
1727
2036
|
] }) }),
|
|
1728
|
-
|
|
2037
|
+
s.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__ */ c("span", { className: "text-red-700 dark:text-red-400", children: [
|
|
1729
2038
|
"Error: ",
|
|
1730
|
-
|
|
2039
|
+
s.error
|
|
1731
2040
|
] }) }),
|
|
1732
|
-
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
2041
|
+
v && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ c("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: [
|
|
2042
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
2043
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
1735
2044
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Export Workflow" }),
|
|
1736
|
-
/* @__PURE__ */
|
|
2045
|
+
/* @__PURE__ */ c("div", { className: "flex gap-1 bg-gray-100 dark:bg-zinc-700 rounded-lg p-1", children: [
|
|
1737
2046
|
/* @__PURE__ */ e(
|
|
1738
2047
|
"button",
|
|
1739
2048
|
{
|
|
1740
|
-
onClick: () =>
|
|
1741
|
-
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${
|
|
2049
|
+
onClick: () => B("yaml"),
|
|
2050
|
+
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "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"}`,
|
|
1742
2051
|
children: "YAML"
|
|
1743
2052
|
}
|
|
1744
2053
|
),
|
|
1745
2054
|
/* @__PURE__ */ e(
|
|
1746
2055
|
"button",
|
|
1747
2056
|
{
|
|
1748
|
-
onClick: () =>
|
|
1749
|
-
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${
|
|
2057
|
+
onClick: () => B("javascript"),
|
|
2058
|
+
className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "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"}`,
|
|
1750
2059
|
children: "JavaScript"
|
|
1751
2060
|
}
|
|
1752
2061
|
)
|
|
@@ -1769,14 +2078,14 @@ function Ye({
|
|
|
1769
2078
|
}
|
|
1770
2079
|
)
|
|
1771
2080
|
] }),
|
|
1772
|
-
/* @__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:
|
|
1773
|
-
/* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children:
|
|
1775
|
-
/* @__PURE__ */
|
|
2081
|
+
/* @__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: S === "yaml" ? J : Y }) }),
|
|
2082
|
+
/* @__PURE__ */ c("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
|
|
2083
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: S === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
|
|
2084
|
+
/* @__PURE__ */ c("div", { className: "flex gap-2", children: [
|
|
1776
2085
|
/* @__PURE__ */ e(
|
|
1777
2086
|
"button",
|
|
1778
2087
|
{
|
|
1779
|
-
onClick:
|
|
2088
|
+
onClick: he,
|
|
1780
2089
|
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",
|
|
1781
2090
|
children: "Copy to Clipboard"
|
|
1782
2091
|
}
|
|
@@ -1791,28 +2100,36 @@ function Ye({
|
|
|
1791
2100
|
)
|
|
1792
2101
|
] })
|
|
1793
2102
|
] })
|
|
1794
|
-
] }) })
|
|
2103
|
+
] }) }),
|
|
2104
|
+
/* @__PURE__ */ e(
|
|
2105
|
+
ot,
|
|
2106
|
+
{
|
|
2107
|
+
isOpen: h,
|
|
2108
|
+
onClose: () => z(!1),
|
|
2109
|
+
onImport: fe
|
|
2110
|
+
}
|
|
2111
|
+
)
|
|
1795
2112
|
] });
|
|
1796
2113
|
}
|
|
1797
|
-
function
|
|
1798
|
-
const r =
|
|
1799
|
-
data:
|
|
1800
|
-
isLoading:
|
|
1801
|
-
error:
|
|
1802
|
-
refetch:
|
|
1803
|
-
} =
|
|
2114
|
+
function st() {
|
|
2115
|
+
const r = x((n) => n.loadTemplate), [i, t] = N(null), {
|
|
2116
|
+
data: a,
|
|
2117
|
+
isLoading: s,
|
|
2118
|
+
error: d,
|
|
2119
|
+
refetch: m
|
|
2120
|
+
} = _({
|
|
1804
2121
|
queryKey: ["images"],
|
|
1805
|
-
queryFn:
|
|
2122
|
+
queryFn: Me,
|
|
1806
2123
|
refetchInterval: 5e3
|
|
1807
2124
|
// Auto-refresh every 5 seconds
|
|
1808
|
-
}),
|
|
1809
|
-
t(
|
|
2125
|
+
}), o = async (n) => {
|
|
2126
|
+
t(n);
|
|
1810
2127
|
try {
|
|
1811
|
-
const u = await
|
|
2128
|
+
const u = await je(n);
|
|
1812
2129
|
if (u != null && u.workflow) {
|
|
1813
|
-
const
|
|
1814
|
-
id: `image-${
|
|
1815
|
-
name: `Workflow from ${
|
|
2130
|
+
const l = {
|
|
2131
|
+
id: `image-${n}`,
|
|
2132
|
+
name: `Workflow from ${n}`,
|
|
1816
2133
|
description: "Loaded from gallery image",
|
|
1817
2134
|
category: "Gallery",
|
|
1818
2135
|
generator: "unknown",
|
|
@@ -1821,7 +2138,7 @@ function Xe() {
|
|
|
1821
2138
|
edges: u.workflow.edges
|
|
1822
2139
|
}
|
|
1823
2140
|
};
|
|
1824
|
-
r(
|
|
2141
|
+
r(l), window.dispatchEvent(new CustomEvent("workflow-loaded"));
|
|
1825
2142
|
} else
|
|
1826
2143
|
alert("No workflow metadata available for this image");
|
|
1827
2144
|
} catch (u) {
|
|
@@ -1830,56 +2147,56 @@ function Xe() {
|
|
|
1830
2147
|
t(null);
|
|
1831
2148
|
}
|
|
1832
2149
|
};
|
|
1833
|
-
return
|
|
2150
|
+
return s ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : d ? /* @__PURE__ */ c("div", { className: "p-8 text-center text-red-500 dark:text-red-400", children: [
|
|
1834
2151
|
"Error loading images: ",
|
|
1835
|
-
|
|
1836
|
-
] }) : !
|
|
2152
|
+
d instanceof Error ? d.message : "Unknown error"
|
|
2153
|
+
] }) : !a || a.length === 0 ? /* @__PURE__ */ c("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: [
|
|
1837
2154
|
/* @__PURE__ */ e("div", { className: "text-lg mb-2", children: "No images yet" }),
|
|
1838
2155
|
/* @__PURE__ */ e("div", { className: "text-sm", children: "Create a workflow and click Execute to generate images" })
|
|
1839
|
-
] }) : /* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
2156
|
+
] }) : /* @__PURE__ */ c("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
|
|
2157
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-4", children: [
|
|
2158
|
+
/* @__PURE__ */ c("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
|
|
1842
2159
|
"Gallery (",
|
|
1843
|
-
|
|
2160
|
+
a.length,
|
|
1844
2161
|
" image",
|
|
1845
|
-
|
|
2162
|
+
a.length !== 1 ? "s" : "",
|
|
1846
2163
|
")"
|
|
1847
2164
|
] }),
|
|
1848
2165
|
/* @__PURE__ */ e(
|
|
1849
2166
|
"button",
|
|
1850
2167
|
{
|
|
1851
|
-
onClick: () =>
|
|
2168
|
+
onClick: () => m(),
|
|
1852
2169
|
className: "text-sm text-teal-600 dark:text-teal-400 hover:text-teal-700 dark:hover:text-violet-300",
|
|
1853
2170
|
children: "Refresh"
|
|
1854
2171
|
}
|
|
1855
2172
|
)
|
|
1856
2173
|
] }),
|
|
1857
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children:
|
|
1858
|
-
|
|
2174
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: a.map((n) => /* @__PURE__ */ e(
|
|
2175
|
+
it,
|
|
1859
2176
|
{
|
|
1860
|
-
image:
|
|
1861
|
-
onLoadWorkflow: () =>
|
|
1862
|
-
isLoading:
|
|
2177
|
+
image: n,
|
|
2178
|
+
onLoadWorkflow: () => o(n.id),
|
|
2179
|
+
isLoading: i === n.id
|
|
1863
2180
|
},
|
|
1864
|
-
|
|
2181
|
+
n.id
|
|
1865
2182
|
)) })
|
|
1866
2183
|
] });
|
|
1867
2184
|
}
|
|
1868
|
-
function
|
|
1869
|
-
const
|
|
1870
|
-
return /* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
2185
|
+
function it({ image: r, onLoadWorkflow: i, isLoading: t }) {
|
|
2186
|
+
const a = (d) => new Date(d).toLocaleString(), s = (d) => d < 1024 ? `${d} B` : d < 1048576 ? `${(d / 1024).toFixed(1)} KB` : `${(d / 1048576).toFixed(1)} MB`;
|
|
2187
|
+
return /* @__PURE__ */ c("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: [
|
|
2188
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
1872
2189
|
/* @__PURE__ */ e(
|
|
1873
2190
|
"a",
|
|
1874
2191
|
{
|
|
1875
|
-
href:
|
|
2192
|
+
href: F(r.id),
|
|
1876
2193
|
target: "_blank",
|
|
1877
2194
|
rel: "noopener noreferrer",
|
|
1878
2195
|
className: "block aspect-square bg-gray-100 dark:bg-zinc-900",
|
|
1879
2196
|
children: /* @__PURE__ */ e(
|
|
1880
2197
|
"img",
|
|
1881
2198
|
{
|
|
1882
|
-
src:
|
|
2199
|
+
src: F(r.id),
|
|
1883
2200
|
alt: r.filename,
|
|
1884
2201
|
className: "w-full h-full object-cover",
|
|
1885
2202
|
loading: "lazy"
|
|
@@ -1890,8 +2207,8 @@ function Ze({ image: r, onLoadWorkflow: s, isLoading: t }) {
|
|
|
1890
2207
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
1891
2208
|
"button",
|
|
1892
2209
|
{
|
|
1893
|
-
onClick: (
|
|
1894
|
-
|
|
2210
|
+
onClick: (d) => {
|
|
2211
|
+
d.preventDefault(), i();
|
|
1895
2212
|
},
|
|
1896
2213
|
disabled: t,
|
|
1897
2214
|
className: "px-3 py-1.5 bg-teal-600 text-white text-sm rounded-lg hover:bg-teal-700 disabled:opacity-50",
|
|
@@ -1899,18 +2216,18 @@ function Ze({ image: r, onLoadWorkflow: s, isLoading: t }) {
|
|
|
1899
2216
|
}
|
|
1900
2217
|
) })
|
|
1901
2218
|
] }),
|
|
1902
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ c("div", { className: "p-3", children: [
|
|
1903
2220
|
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-gray-800 dark:text-white truncate", children: r.filename }),
|
|
1904
|
-
/* @__PURE__ */
|
|
2221
|
+
/* @__PURE__ */ c("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mt-1", children: [
|
|
1905
2222
|
r.mime,
|
|
1906
2223
|
" • ",
|
|
1907
|
-
|
|
2224
|
+
s(r.size)
|
|
1908
2225
|
] }),
|
|
1909
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children:
|
|
2226
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children: a(r.createdAt) })
|
|
1910
2227
|
] })
|
|
1911
2228
|
] });
|
|
1912
2229
|
}
|
|
1913
|
-
const
|
|
2230
|
+
const dt = {
|
|
1914
2231
|
id: "sales-dashboard",
|
|
1915
2232
|
name: "Sales Dashboard",
|
|
1916
2233
|
description: "Quarterly revenue bar chart with gradient styling",
|
|
@@ -1960,7 +2277,7 @@ const et = {
|
|
|
1960
2277
|
],
|
|
1961
2278
|
edges: []
|
|
1962
2279
|
}
|
|
1963
|
-
},
|
|
2280
|
+
}, lt = {
|
|
1964
2281
|
id: "user-growth",
|
|
1965
2282
|
name: "User Growth Line Chart",
|
|
1966
2283
|
description: "Monthly user growth with smooth bezier curves",
|
|
@@ -2008,7 +2325,7 @@ const et = {
|
|
|
2008
2325
|
],
|
|
2009
2326
|
edges: []
|
|
2010
2327
|
}
|
|
2011
|
-
},
|
|
2328
|
+
}, ct = {
|
|
2012
2329
|
id: "api-flow",
|
|
2013
2330
|
name: "API Request Flow",
|
|
2014
2331
|
description: "Sequence diagram showing API authentication flow",
|
|
@@ -2050,7 +2367,7 @@ const et = {
|
|
|
2050
2367
|
],
|
|
2051
2368
|
edges: []
|
|
2052
2369
|
}
|
|
2053
|
-
},
|
|
2370
|
+
}, mt = {
|
|
2054
2371
|
id: "system-architecture",
|
|
2055
2372
|
name: "System Architecture",
|
|
2056
2373
|
description: "Microservices architecture diagram",
|
|
@@ -2108,7 +2425,7 @@ const et = {
|
|
|
2108
2425
|
],
|
|
2109
2426
|
edges: []
|
|
2110
2427
|
}
|
|
2111
|
-
},
|
|
2428
|
+
}, ut = {
|
|
2112
2429
|
id: "git-workflow",
|
|
2113
2430
|
name: "Git Branch Workflow",
|
|
2114
2431
|
description: "Git branching strategy with feature and release branches",
|
|
@@ -2151,7 +2468,7 @@ const et = {
|
|
|
2151
2468
|
],
|
|
2152
2469
|
edges: []
|
|
2153
2470
|
}
|
|
2154
|
-
},
|
|
2471
|
+
}, gt = {
|
|
2155
2472
|
id: "website-qr",
|
|
2156
2473
|
name: "Website QR Code",
|
|
2157
2474
|
description: "QR code linking to your website with custom styling",
|
|
@@ -2179,7 +2496,7 @@ const et = {
|
|
|
2179
2496
|
],
|
|
2180
2497
|
edges: []
|
|
2181
2498
|
}
|
|
2182
|
-
},
|
|
2499
|
+
}, pt = {
|
|
2183
2500
|
id: "wifi-qr",
|
|
2184
2501
|
name: "WiFi QR Code",
|
|
2185
2502
|
description: "Scannable QR code for WiFi network access",
|
|
@@ -2207,7 +2524,7 @@ const et = {
|
|
|
2207
2524
|
],
|
|
2208
2525
|
edges: []
|
|
2209
2526
|
}
|
|
2210
|
-
},
|
|
2527
|
+
}, ht = {
|
|
2211
2528
|
id: "chart-watermark",
|
|
2212
2529
|
name: "Chart with Watermark",
|
|
2213
2530
|
description: "Bar chart with company watermark and rounded corners",
|
|
@@ -2273,7 +2590,7 @@ const et = {
|
|
|
2273
2590
|
{ id: "e2", source: "transform-1", target: "transform-2" }
|
|
2274
2591
|
]
|
|
2275
2592
|
}
|
|
2276
|
-
},
|
|
2593
|
+
}, ft = {
|
|
2277
2594
|
id: "diagram-webp",
|
|
2278
2595
|
name: "Diagram to WebP",
|
|
2279
2596
|
description: "Mermaid diagram converted to optimized WebP format",
|
|
@@ -2314,108 +2631,108 @@ const et = {
|
|
|
2314
2631
|
],
|
|
2315
2632
|
edges: [{ id: "e1", source: "gen-1", target: "transform-1" }]
|
|
2316
2633
|
}
|
|
2317
|
-
},
|
|
2634
|
+
}, O = [
|
|
2318
2635
|
// Charts
|
|
2319
|
-
|
|
2320
|
-
|
|
2636
|
+
dt,
|
|
2637
|
+
lt,
|
|
2321
2638
|
// Diagrams
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2639
|
+
ct,
|
|
2640
|
+
mt,
|
|
2641
|
+
ut,
|
|
2325
2642
|
// QR Codes
|
|
2326
|
-
|
|
2327
|
-
|
|
2643
|
+
gt,
|
|
2644
|
+
pt,
|
|
2328
2645
|
// Pipelines
|
|
2329
|
-
|
|
2330
|
-
|
|
2646
|
+
ht,
|
|
2647
|
+
ft
|
|
2331
2648
|
];
|
|
2332
|
-
function
|
|
2333
|
-
const r = new Set(
|
|
2649
|
+
function bt() {
|
|
2650
|
+
const r = new Set(O.map((i) => i.category));
|
|
2334
2651
|
return Array.from(r).sort();
|
|
2335
2652
|
}
|
|
2336
|
-
function
|
|
2337
|
-
return
|
|
2653
|
+
function $t(r) {
|
|
2654
|
+
return O.filter((i) => i.category === r);
|
|
2338
2655
|
}
|
|
2339
|
-
function
|
|
2340
|
-
return
|
|
2656
|
+
function ne(r) {
|
|
2657
|
+
return O.find((i) => i.id === r);
|
|
2341
2658
|
}
|
|
2342
|
-
function
|
|
2343
|
-
const
|
|
2344
|
-
return
|
|
2659
|
+
function Mt(r) {
|
|
2660
|
+
const i = r.toLowerCase();
|
|
2661
|
+
return O.filter(
|
|
2345
2662
|
(t) => {
|
|
2346
|
-
var
|
|
2347
|
-
return t.name.toLowerCase().includes(
|
|
2663
|
+
var a;
|
|
2664
|
+
return t.name.toLowerCase().includes(i) || t.description.toLowerCase().includes(i) || t.category.toLowerCase().includes(i) || t.generator.toLowerCase().includes(i) || ((a = t.tags) == null ? void 0 : a.some((s) => s.toLowerCase().includes(i)));
|
|
2348
2665
|
}
|
|
2349
2666
|
);
|
|
2350
2667
|
}
|
|
2351
|
-
function
|
|
2352
|
-
const [
|
|
2353
|
-
let
|
|
2354
|
-
if (
|
|
2355
|
-
const
|
|
2356
|
-
|
|
2668
|
+
function xt({ onSelect: r }) {
|
|
2669
|
+
const [i, t] = N(null), [a, s] = N(""), d = te(() => bt(), []), m = te(() => {
|
|
2670
|
+
let o = O;
|
|
2671
|
+
if (i && (o = o.filter((n) => n.category === i)), a) {
|
|
2672
|
+
const n = a.toLowerCase();
|
|
2673
|
+
o = o.filter(
|
|
2357
2674
|
(u) => {
|
|
2358
|
-
var
|
|
2359
|
-
return u.name.toLowerCase().includes(
|
|
2675
|
+
var l;
|
|
2676
|
+
return u.name.toLowerCase().includes(n) || u.description.toLowerCase().includes(n) || u.generator.toLowerCase().includes(n) || ((l = u.tags) == null ? void 0 : l.some((p) => p.toLowerCase().includes(n)));
|
|
2360
2677
|
}
|
|
2361
2678
|
);
|
|
2362
2679
|
}
|
|
2363
|
-
return
|
|
2364
|
-
}, [
|
|
2365
|
-
return /* @__PURE__ */
|
|
2366
|
-
/* @__PURE__ */
|
|
2680
|
+
return o;
|
|
2681
|
+
}, [i, a]);
|
|
2682
|
+
return /* @__PURE__ */ c("div", { className: "p-6", children: [
|
|
2683
|
+
/* @__PURE__ */ c("div", { className: "mb-6", children: [
|
|
2367
2684
|
/* @__PURE__ */ e("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white mb-2", children: "Templates" }),
|
|
2368
2685
|
/* @__PURE__ */ e("p", { className: "text-gray-600 dark:text-zinc-400", children: "Start with a pre-built workflow. Click any template to load it into the editor." })
|
|
2369
2686
|
] }),
|
|
2370
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ c("div", { className: "flex flex-wrap gap-4 mb-6", children: [
|
|
2371
2688
|
/* @__PURE__ */ e(
|
|
2372
2689
|
"input",
|
|
2373
2690
|
{
|
|
2374
2691
|
type: "text",
|
|
2375
2692
|
placeholder: "Search templates...",
|
|
2376
|
-
value:
|
|
2377
|
-
onChange: (
|
|
2693
|
+
value: a,
|
|
2694
|
+
onChange: (o) => s(o.target.value),
|
|
2378
2695
|
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"
|
|
2379
2696
|
}
|
|
2380
2697
|
),
|
|
2381
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ c("div", { className: "flex gap-2 flex-wrap", children: [
|
|
2382
2699
|
/* @__PURE__ */ e(
|
|
2383
2700
|
"button",
|
|
2384
2701
|
{
|
|
2385
2702
|
onClick: () => t(null),
|
|
2386
|
-
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${
|
|
2703
|
+
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${i === 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"}`,
|
|
2387
2704
|
children: "All"
|
|
2388
2705
|
}
|
|
2389
2706
|
),
|
|
2390
|
-
|
|
2707
|
+
d.map((o) => /* @__PURE__ */ e(
|
|
2391
2708
|
"button",
|
|
2392
2709
|
{
|
|
2393
|
-
onClick: () => t(
|
|
2394
|
-
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${
|
|
2395
|
-
children:
|
|
2710
|
+
onClick: () => t(o),
|
|
2711
|
+
className: `px-3 py-1.5 rounded-full text-sm font-medium transition-colors ${i === o ? "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"}`,
|
|
2712
|
+
children: o
|
|
2396
2713
|
},
|
|
2397
|
-
|
|
2714
|
+
o
|
|
2398
2715
|
))
|
|
2399
2716
|
] })
|
|
2400
2717
|
] }),
|
|
2401
|
-
|
|
2402
|
-
|
|
2718
|
+
m.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: m.map((o) => /* @__PURE__ */ e(
|
|
2719
|
+
kt,
|
|
2403
2720
|
{
|
|
2404
|
-
template:
|
|
2405
|
-
onSelect: () => r(
|
|
2721
|
+
template: o,
|
|
2722
|
+
onSelect: () => r(o.id)
|
|
2406
2723
|
},
|
|
2407
|
-
|
|
2724
|
+
o.id
|
|
2408
2725
|
)) })
|
|
2409
2726
|
] });
|
|
2410
2727
|
}
|
|
2411
|
-
function
|
|
2412
|
-
const t = r.workflow.nodes.length,
|
|
2728
|
+
function kt({ template: r, onSelect: i }) {
|
|
2729
|
+
const t = r.workflow.nodes.length, a = r.workflow.edges.length, s = {
|
|
2413
2730
|
quickchart: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
2414
2731
|
mermaid: "bg-pink-100 text-pink-800 dark:bg-pink-900/30 dark:text-pink-300",
|
|
2415
2732
|
qr: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
|
|
2416
2733
|
d3: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300"
|
|
2417
2734
|
};
|
|
2418
|
-
return /* @__PURE__ */
|
|
2735
|
+
return /* @__PURE__ */ c("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden hover:shadow-lg transition-shadow", children: [
|
|
2419
2736
|
/* @__PURE__ */ e("div", { className: "aspect-video bg-gray-100 dark:bg-zinc-900 flex items-center justify-center p-4", children: r.preview ? /* @__PURE__ */ e(
|
|
2420
2737
|
"img",
|
|
2421
2738
|
{
|
|
@@ -2423,7 +2740,7 @@ function mt({ template: r, onSelect: s }) {
|
|
|
2423
2740
|
alt: r.name,
|
|
2424
2741
|
className: "max-w-full max-h-full object-contain"
|
|
2425
2742
|
}
|
|
2426
|
-
) : /* @__PURE__ */
|
|
2743
|
+
) : /* @__PURE__ */ c("div", { className: "text-center text-gray-400 dark:text-zinc-500", children: [
|
|
2427
2744
|
/* @__PURE__ */ e(
|
|
2428
2745
|
"svg",
|
|
2429
2746
|
{
|
|
@@ -2444,20 +2761,20 @@ function mt({ template: r, onSelect: s }) {
|
|
|
2444
2761
|
),
|
|
2445
2762
|
/* @__PURE__ */ e("span", { className: "text-sm", children: "No preview" })
|
|
2446
2763
|
] }) }),
|
|
2447
|
-
/* @__PURE__ */
|
|
2448
|
-
/* @__PURE__ */
|
|
2764
|
+
/* @__PURE__ */ c("div", { className: "p-4", children: [
|
|
2765
|
+
/* @__PURE__ */ c("div", { className: "flex items-start justify-between mb-2", children: [
|
|
2449
2766
|
/* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: r.name }),
|
|
2450
2767
|
/* @__PURE__ */ e(
|
|
2451
2768
|
"span",
|
|
2452
2769
|
{
|
|
2453
|
-
className: `px-2 py-0.5 rounded text-xs font-medium ${
|
|
2770
|
+
className: `px-2 py-0.5 rounded text-xs font-medium ${s[r.generator] || "bg-gray-100 text-gray-800 dark:bg-zinc-700 dark:text-zinc-300"}`,
|
|
2454
2771
|
children: r.generator
|
|
2455
2772
|
}
|
|
2456
2773
|
)
|
|
2457
2774
|
] }),
|
|
2458
2775
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-3", children: r.description }),
|
|
2459
|
-
/* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4 text-xs text-gray-500 dark:text-zinc-500 mb-4", children: [
|
|
2777
|
+
/* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
|
|
2461
2778
|
/* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
|
|
2462
2779
|
"path",
|
|
2463
2780
|
{
|
|
@@ -2471,7 +2788,7 @@ function mt({ template: r, onSelect: s }) {
|
|
|
2471
2788
|
" node",
|
|
2472
2789
|
t !== 1 ? "s" : ""
|
|
2473
2790
|
] }),
|
|
2474
|
-
|
|
2791
|
+
a > 0 && /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
|
|
2475
2792
|
/* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
|
|
2476
2793
|
"path",
|
|
2477
2794
|
{
|
|
@@ -2481,23 +2798,23 @@ function mt({ template: r, onSelect: s }) {
|
|
|
2481
2798
|
d: "M13 7l5 5m0 0l-5 5m5-5H6"
|
|
2482
2799
|
}
|
|
2483
2800
|
) }),
|
|
2484
|
-
|
|
2801
|
+
a,
|
|
2485
2802
|
" edge",
|
|
2486
|
-
|
|
2803
|
+
a !== 1 ? "s" : ""
|
|
2487
2804
|
] })
|
|
2488
2805
|
] }),
|
|
2489
|
-
r.tags && r.tags.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 mb-4", children: r.tags.slice(0, 4).map((
|
|
2806
|
+
r.tags && r.tags.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 mb-4", children: r.tags.slice(0, 4).map((d) => /* @__PURE__ */ e(
|
|
2490
2807
|
"span",
|
|
2491
2808
|
{
|
|
2492
2809
|
className: "px-2 py-0.5 bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-zinc-400 rounded text-xs",
|
|
2493
|
-
children:
|
|
2810
|
+
children: d
|
|
2494
2811
|
},
|
|
2495
|
-
|
|
2812
|
+
d
|
|
2496
2813
|
)) }),
|
|
2497
2814
|
/* @__PURE__ */ e(
|
|
2498
2815
|
"button",
|
|
2499
2816
|
{
|
|
2500
|
-
onClick:
|
|
2817
|
+
onClick: i,
|
|
2501
2818
|
className: "w-full py-2 px-4 bg-teal-600 hover:bg-teal-700 text-white rounded-lg font-medium transition-colors",
|
|
2502
2819
|
children: "Use Template"
|
|
2503
2820
|
}
|
|
@@ -2505,67 +2822,67 @@ function mt({ template: r, onSelect: s }) {
|
|
|
2505
2822
|
] })
|
|
2506
2823
|
] });
|
|
2507
2824
|
}
|
|
2508
|
-
function
|
|
2825
|
+
function wt({
|
|
2509
2826
|
workflow: r,
|
|
2510
|
-
isActive:
|
|
2827
|
+
isActive: i,
|
|
2511
2828
|
onLoad: t,
|
|
2512
|
-
onDelete:
|
|
2513
|
-
onRename:
|
|
2514
|
-
onDuplicate:
|
|
2829
|
+
onDelete: a,
|
|
2830
|
+
onRename: s,
|
|
2831
|
+
onDuplicate: d
|
|
2515
2832
|
}) {
|
|
2516
|
-
const [
|
|
2517
|
-
|
|
2518
|
-
}, b = (
|
|
2519
|
-
const g = new Date(
|
|
2520
|
-
return
|
|
2833
|
+
const [m, o] = N(!1), [n, u] = N(r.name), [l, p] = N(!1), f = () => {
|
|
2834
|
+
n.trim() && n !== r.name && s(n.trim()), o(!1);
|
|
2835
|
+
}, b = (k) => {
|
|
2836
|
+
const g = new Date(k), w = (/* @__PURE__ */ new Date()).getTime() - g.getTime(), h = Math.floor(w / 6e4), z = Math.floor(w / 36e5), S = Math.floor(w / 864e5);
|
|
2837
|
+
return h < 1 ? "Just now" : h < 60 ? `${h}m ago` : z < 24 ? `${z}h ago` : S < 7 ? `${S}d ago` : g.toLocaleDateString();
|
|
2521
2838
|
};
|
|
2522
|
-
return /* @__PURE__ */
|
|
2839
|
+
return /* @__PURE__ */ c(
|
|
2523
2840
|
"div",
|
|
2524
2841
|
{
|
|
2525
|
-
className: `group relative p-3 rounded-lg border transition-colors ${
|
|
2842
|
+
className: `group relative p-3 rounded-lg border transition-colors ${i ? "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"}`,
|
|
2526
2843
|
children: [
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
/* @__PURE__ */
|
|
2529
|
-
|
|
2844
|
+
/* @__PURE__ */ c("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2845
|
+
/* @__PURE__ */ c("button", { onClick: t, className: "flex-1 text-left min-w-0", children: [
|
|
2846
|
+
m ? /* @__PURE__ */ e(
|
|
2530
2847
|
"input",
|
|
2531
2848
|
{
|
|
2532
2849
|
type: "text",
|
|
2533
|
-
value:
|
|
2534
|
-
onChange: (
|
|
2535
|
-
onBlur:
|
|
2536
|
-
onKeyDown: (
|
|
2537
|
-
|
|
2850
|
+
value: n,
|
|
2851
|
+
onChange: (k) => u(k.target.value),
|
|
2852
|
+
onBlur: f,
|
|
2853
|
+
onKeyDown: (k) => {
|
|
2854
|
+
k.key === "Enter" && f(), k.key === "Escape" && (u(r.name), o(!1));
|
|
2538
2855
|
},
|
|
2539
2856
|
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",
|
|
2540
2857
|
autoFocus: !0,
|
|
2541
|
-
onClick: (
|
|
2858
|
+
onClick: (k) => k.stopPropagation()
|
|
2542
2859
|
}
|
|
2543
2860
|
) : /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate", children: r.name }),
|
|
2544
|
-
/* @__PURE__ */
|
|
2861
|
+
/* @__PURE__ */ c("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
|
|
2545
2862
|
r.nodes.length,
|
|
2546
2863
|
" nodes · Updated ",
|
|
2547
2864
|
b(r.updatedAt)
|
|
2548
2865
|
] })
|
|
2549
2866
|
] }),
|
|
2550
|
-
/* @__PURE__ */
|
|
2867
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
2551
2868
|
/* @__PURE__ */ e(
|
|
2552
2869
|
"button",
|
|
2553
2870
|
{
|
|
2554
|
-
onClick: (
|
|
2555
|
-
|
|
2871
|
+
onClick: (k) => {
|
|
2872
|
+
k.stopPropagation(), p(!l);
|
|
2556
2873
|
},
|
|
2557
2874
|
className: "p-1 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 rounded opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2558
2875
|
children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e("path", { d: "M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" }) })
|
|
2559
2876
|
}
|
|
2560
2877
|
),
|
|
2561
|
-
|
|
2878
|
+
l && /* @__PURE__ */ c(P, { children: [
|
|
2562
2879
|
/* @__PURE__ */ e("div", { className: "fixed inset-0 z-10", onClick: () => p(!1) }),
|
|
2563
|
-
/* @__PURE__ */
|
|
2880
|
+
/* @__PURE__ */ c("div", { className: "absolute right-0 top-full mt-1 w-36 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 py-1 z-20", children: [
|
|
2564
2881
|
/* @__PURE__ */ e(
|
|
2565
2882
|
"button",
|
|
2566
2883
|
{
|
|
2567
|
-
onClick: (
|
|
2568
|
-
|
|
2884
|
+
onClick: (k) => {
|
|
2885
|
+
k.stopPropagation(), o(!0), p(!1);
|
|
2569
2886
|
},
|
|
2570
2887
|
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",
|
|
2571
2888
|
children: "Rename"
|
|
@@ -2574,8 +2891,8 @@ function ut({
|
|
|
2574
2891
|
/* @__PURE__ */ e(
|
|
2575
2892
|
"button",
|
|
2576
2893
|
{
|
|
2577
|
-
onClick: (
|
|
2578
|
-
|
|
2894
|
+
onClick: (k) => {
|
|
2895
|
+
k.stopPropagation(), d(), p(!1);
|
|
2579
2896
|
},
|
|
2580
2897
|
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",
|
|
2581
2898
|
children: "Duplicate"
|
|
@@ -2584,8 +2901,8 @@ function ut({
|
|
|
2584
2901
|
/* @__PURE__ */ e(
|
|
2585
2902
|
"button",
|
|
2586
2903
|
{
|
|
2587
|
-
onClick: (
|
|
2588
|
-
|
|
2904
|
+
onClick: (k) => {
|
|
2905
|
+
k.stopPropagation(), window.confirm("Delete this workflow?") && a(), p(!1);
|
|
2589
2906
|
},
|
|
2590
2907
|
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",
|
|
2591
2908
|
children: "Delete"
|
|
@@ -2595,24 +2912,24 @@ function ut({
|
|
|
2595
2912
|
] })
|
|
2596
2913
|
] })
|
|
2597
2914
|
] }),
|
|
2598
|
-
|
|
2915
|
+
i && /* @__PURE__ */ e("span", { className: "absolute top-2 right-2 w-2 h-2 bg-teal-500 rounded-full" })
|
|
2599
2916
|
]
|
|
2600
2917
|
}
|
|
2601
2918
|
);
|
|
2602
2919
|
}
|
|
2603
|
-
function
|
|
2604
|
-
const r =
|
|
2920
|
+
function vt() {
|
|
2921
|
+
const r = x((l) => l.showLibrary), i = x((l) => l.toggleLibrary), t = x((l) => l.savedWorkflows), a = x((l) => l.activeWorkflowId), s = x((l) => l.loadWorkflow), d = x((l) => l.deleteWorkflow), m = x((l) => l.renameWorkflow), o = x((l) => l.duplicateWorkflow), n = x((l) => l.newWorkflow);
|
|
2605
2922
|
if (!r) return null;
|
|
2606
|
-
const u = [...t].sort((
|
|
2607
|
-
return /* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick:
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2923
|
+
const u = [...t].sort((l, p) => p.updatedAt - l.updatedAt);
|
|
2924
|
+
return /* @__PURE__ */ c(P, { children: [
|
|
2925
|
+
/* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: i }),
|
|
2926
|
+
/* @__PURE__ */ c("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: [
|
|
2927
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
|
|
2611
2928
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: "My Workflows" }),
|
|
2612
2929
|
/* @__PURE__ */ e(
|
|
2613
2930
|
"button",
|
|
2614
2931
|
{
|
|
2615
|
-
onClick:
|
|
2932
|
+
onClick: i,
|
|
2616
2933
|
className: "p-1 text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 rounded",
|
|
2617
2934
|
children: /* @__PURE__ */ e("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
2618
2935
|
"path",
|
|
@@ -2626,11 +2943,11 @@ function gt() {
|
|
|
2626
2943
|
}
|
|
2627
2944
|
)
|
|
2628
2945
|
] }),
|
|
2629
|
-
/* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */ c(
|
|
2630
2947
|
"button",
|
|
2631
2948
|
{
|
|
2632
2949
|
onClick: () => {
|
|
2633
|
-
|
|
2950
|
+
n(), i(), window.dispatchEvent(new window.CustomEvent("new-workflow-created"));
|
|
2634
2951
|
},
|
|
2635
2952
|
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",
|
|
2636
2953
|
children: [
|
|
@@ -2647,7 +2964,7 @@ function gt() {
|
|
|
2647
2964
|
]
|
|
2648
2965
|
}
|
|
2649
2966
|
) }),
|
|
2650
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: u.length === 0 ? /* @__PURE__ */
|
|
2967
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: u.length === 0 ? /* @__PURE__ */ c("div", { className: "text-center py-8", children: [
|
|
2651
2968
|
/* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
2652
2969
|
"svg",
|
|
2653
2970
|
{
|
|
@@ -2668,21 +2985,21 @@ function gt() {
|
|
|
2668
2985
|
) }),
|
|
2669
2986
|
/* @__PURE__ */ e("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No saved workflows yet" }),
|
|
2670
2987
|
/* @__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" })
|
|
2671
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: u.map((
|
|
2672
|
-
|
|
2988
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: u.map((l) => /* @__PURE__ */ e(
|
|
2989
|
+
wt,
|
|
2673
2990
|
{
|
|
2674
|
-
workflow:
|
|
2675
|
-
isActive:
|
|
2991
|
+
workflow: l,
|
|
2992
|
+
isActive: l.id === a,
|
|
2676
2993
|
onLoad: () => {
|
|
2677
|
-
|
|
2994
|
+
s(l.id), i();
|
|
2678
2995
|
},
|
|
2679
|
-
onDelete: () =>
|
|
2680
|
-
onRename: (p) => l
|
|
2681
|
-
onDuplicate: () =>
|
|
2996
|
+
onDelete: () => d(l.id),
|
|
2997
|
+
onRename: (p) => m(l.id, p),
|
|
2998
|
+
onDuplicate: () => o(l.id)
|
|
2682
2999
|
},
|
|
2683
|
-
|
|
3000
|
+
l.id
|
|
2684
3001
|
)) }) }),
|
|
2685
|
-
/* @__PURE__ */
|
|
3002
|
+
/* @__PURE__ */ c("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-zinc-700 text-xs text-zinc-500 dark:text-zinc-400", children: [
|
|
2686
3003
|
t.length,
|
|
2687
3004
|
" workflow",
|
|
2688
3005
|
t.length !== 1 ? "s" : "",
|
|
@@ -2691,7 +3008,7 @@ function gt() {
|
|
|
2691
3008
|
] })
|
|
2692
3009
|
] });
|
|
2693
3010
|
}
|
|
2694
|
-
const
|
|
3011
|
+
const yt = [
|
|
2695
3012
|
{
|
|
2696
3013
|
id: "openai",
|
|
2697
3014
|
name: "OpenAI",
|
|
@@ -2720,7 +3037,7 @@ const pt = [
|
|
|
2720
3037
|
placeholder: "sk-or-...",
|
|
2721
3038
|
docsUrl: "https://openrouter.ai/keys"
|
|
2722
3039
|
}
|
|
2723
|
-
],
|
|
3040
|
+
], Nt = [
|
|
2724
3041
|
{
|
|
2725
3042
|
id: "ollama",
|
|
2726
3043
|
name: "Ollama",
|
|
@@ -2736,21 +3053,21 @@ const pt = [
|
|
|
2736
3053
|
docsUrl: "https://lmstudio.ai"
|
|
2737
3054
|
}
|
|
2738
3055
|
];
|
|
2739
|
-
function
|
|
2740
|
-
const
|
|
3056
|
+
function zt({ provider: r }) {
|
|
3057
|
+
const i = $((f) => f.ai), t = $((f) => f.setAIProvider), a = i[r.id], s = (a == null ? void 0 : a.enabled) ?? !1, d = (a == null ? void 0 : a.apiKey) ?? "", [m, o] = N(d), [n, u] = N(!1), l = () => {
|
|
2741
3058
|
t(r.id, {
|
|
2742
|
-
apiKey:
|
|
2743
|
-
enabled: !
|
|
3059
|
+
apiKey: m,
|
|
3060
|
+
enabled: !s
|
|
2744
3061
|
});
|
|
2745
|
-
}, p = (
|
|
2746
|
-
|
|
2747
|
-
apiKey:
|
|
2748
|
-
enabled:
|
|
3062
|
+
}, p = (f) => {
|
|
3063
|
+
o(f), t(r.id, {
|
|
3064
|
+
apiKey: f,
|
|
3065
|
+
enabled: s
|
|
2749
3066
|
});
|
|
2750
3067
|
};
|
|
2751
|
-
return /* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
/* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ c("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
|
|
3069
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
3070
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2754
3071
|
/* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
|
|
2755
3072
|
/* @__PURE__ */ e(
|
|
2756
3073
|
"a",
|
|
@@ -2764,13 +3081,13 @@ function ft({ provider: r }) {
|
|
|
2764
3081
|
)
|
|
2765
3082
|
] }),
|
|
2766
3083
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: r.description }),
|
|
2767
|
-
/* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */
|
|
3084
|
+
/* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ c("div", { className: "relative flex-1", children: [
|
|
2768
3085
|
/* @__PURE__ */ e(
|
|
2769
3086
|
"input",
|
|
2770
3087
|
{
|
|
2771
|
-
type:
|
|
2772
|
-
value:
|
|
2773
|
-
onChange: (
|
|
3088
|
+
type: n ? "text" : "password",
|
|
3089
|
+
value: m,
|
|
3090
|
+
onChange: (f) => p(f.target.value),
|
|
2774
3091
|
placeholder: r.placeholder,
|
|
2775
3092
|
className: "w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-zinc-500"
|
|
2776
3093
|
}
|
|
@@ -2779,9 +3096,9 @@ function ft({ provider: r }) {
|
|
|
2779
3096
|
"button",
|
|
2780
3097
|
{
|
|
2781
3098
|
type: "button",
|
|
2782
|
-
onClick: () => u(!
|
|
3099
|
+
onClick: () => u(!n),
|
|
2783
3100
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-zinc-300",
|
|
2784
|
-
children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children:
|
|
3101
|
+
children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: n ? /* @__PURE__ */ e(
|
|
2785
3102
|
"path",
|
|
2786
3103
|
{
|
|
2787
3104
|
strokeLinecap: "round",
|
|
@@ -2805,33 +3122,33 @@ function ft({ provider: r }) {
|
|
|
2805
3122
|
/* @__PURE__ */ e("div", { className: "flex items-center", children: /* @__PURE__ */ e(
|
|
2806
3123
|
"button",
|
|
2807
3124
|
{
|
|
2808
|
-
onClick:
|
|
2809
|
-
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
|
3125
|
+
onClick: l,
|
|
3126
|
+
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
|
|
2810
3127
|
children: /* @__PURE__ */ e(
|
|
2811
3128
|
"span",
|
|
2812
3129
|
{
|
|
2813
|
-
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
|
3130
|
+
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${s ? "translate-x-6" : "translate-x-1"}`
|
|
2814
3131
|
}
|
|
2815
3132
|
)
|
|
2816
3133
|
}
|
|
2817
3134
|
) })
|
|
2818
3135
|
] });
|
|
2819
3136
|
}
|
|
2820
|
-
function
|
|
2821
|
-
const
|
|
3137
|
+
function Ct({ provider: r }) {
|
|
3138
|
+
const i = $((l) => l.ai), t = $((l) => l.setAIProvider), a = i[r.id], s = (a == null ? void 0 : a.enabled) ?? !1, d = (a == null ? void 0 : a.baseUrl) ?? r.defaultUrl, [m, o] = N(d), n = () => {
|
|
2822
3139
|
t(r.id, {
|
|
2823
|
-
baseUrl:
|
|
2824
|
-
enabled: !
|
|
3140
|
+
baseUrl: m,
|
|
3141
|
+
enabled: !s
|
|
2825
3142
|
});
|
|
2826
|
-
}, u = (
|
|
2827
|
-
|
|
2828
|
-
baseUrl:
|
|
2829
|
-
enabled:
|
|
3143
|
+
}, u = (l) => {
|
|
3144
|
+
o(l), t(r.id, {
|
|
3145
|
+
baseUrl: l,
|
|
3146
|
+
enabled: s
|
|
2830
3147
|
});
|
|
2831
3148
|
};
|
|
2832
|
-
return /* @__PURE__ */
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */
|
|
3149
|
+
return /* @__PURE__ */ c("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
|
|
3150
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
3151
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
2835
3152
|
/* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
|
|
2836
3153
|
/* @__PURE__ */ e(
|
|
2837
3154
|
"a",
|
|
@@ -2850,8 +3167,8 @@ function bt({ provider: r }) {
|
|
|
2850
3167
|
"input",
|
|
2851
3168
|
{
|
|
2852
3169
|
type: "text",
|
|
2853
|
-
value:
|
|
2854
|
-
onChange: (
|
|
3170
|
+
value: m,
|
|
3171
|
+
onChange: (l) => u(l.target.value),
|
|
2855
3172
|
placeholder: r.defaultUrl,
|
|
2856
3173
|
className: "w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-zinc-500"
|
|
2857
3174
|
}
|
|
@@ -2860,30 +3177,30 @@ function bt({ provider: r }) {
|
|
|
2860
3177
|
/* @__PURE__ */ e("div", { className: "flex items-center", children: /* @__PURE__ */ e(
|
|
2861
3178
|
"button",
|
|
2862
3179
|
{
|
|
2863
|
-
onClick:
|
|
2864
|
-
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
|
3180
|
+
onClick: n,
|
|
3181
|
+
className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${s ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
|
|
2865
3182
|
children: /* @__PURE__ */ e(
|
|
2866
3183
|
"span",
|
|
2867
3184
|
{
|
|
2868
|
-
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
|
3185
|
+
className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${s ? "translate-x-6" : "translate-x-1"}`
|
|
2869
3186
|
}
|
|
2870
3187
|
)
|
|
2871
3188
|
}
|
|
2872
3189
|
) })
|
|
2873
3190
|
] });
|
|
2874
3191
|
}
|
|
2875
|
-
function
|
|
2876
|
-
const r =
|
|
2877
|
-
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */
|
|
2878
|
-
/* @__PURE__ */
|
|
2879
|
-
/* @__PURE__ */
|
|
3192
|
+
function St() {
|
|
3193
|
+
const r = $((t) => t.showSettings), i = $((t) => t.closeSettings);
|
|
3194
|
+
return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ c("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: [
|
|
3195
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-zinc-700", children: [
|
|
3196
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2880
3197
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "AI Provider Settings" }),
|
|
2881
3198
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: "Configure your AI providers for vision and text generation" })
|
|
2882
3199
|
] }),
|
|
2883
3200
|
/* @__PURE__ */ e(
|
|
2884
3201
|
"button",
|
|
2885
3202
|
{
|
|
2886
|
-
onClick:
|
|
3203
|
+
onClick: i,
|
|
2887
3204
|
className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
|
|
2888
3205
|
children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
2889
3206
|
"path",
|
|
@@ -2897,16 +3214,16 @@ function xt() {
|
|
|
2897
3214
|
}
|
|
2898
3215
|
)
|
|
2899
3216
|
] }),
|
|
2900
|
-
/* @__PURE__ */
|
|
2901
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
|
|
3218
|
+
/* @__PURE__ */ c("section", { children: [
|
|
2902
3219
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Cloud Providers" }),
|
|
2903
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children:
|
|
3220
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: yt.map((t) => /* @__PURE__ */ e(zt, { provider: t }, t.id)) })
|
|
2904
3221
|
] }),
|
|
2905
|
-
/* @__PURE__ */
|
|
3222
|
+
/* @__PURE__ */ c("section", { children: [
|
|
2906
3223
|
/* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Local Providers" }),
|
|
2907
|
-
/* @__PURE__ */ e("div", { className: "space-y-3", children:
|
|
3224
|
+
/* @__PURE__ */ e("div", { className: "space-y-3", children: Nt.map((t) => /* @__PURE__ */ e(Ct, { provider: t }, t.id)) })
|
|
2908
3225
|
] }),
|
|
2909
|
-
/* @__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__ */
|
|
3226
|
+
/* @__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__ */ c("div", { className: "flex items-start gap-3", children: [
|
|
2910
3227
|
/* @__PURE__ */ e(
|
|
2911
3228
|
"svg",
|
|
2912
3229
|
{
|
|
@@ -2925,7 +3242,7 @@ function xt() {
|
|
|
2925
3242
|
)
|
|
2926
3243
|
}
|
|
2927
3244
|
),
|
|
2928
|
-
/* @__PURE__ */
|
|
3245
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2929
3246
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-blue-900 dark:text-blue-300", children: "Your keys stay local" }),
|
|
2930
3247
|
/* @__PURE__ */ e("p", { className: "text-sm text-blue-700 dark:text-blue-400 mt-1", children: "API keys are stored in your browser only and sent directly to providers. They never pass through our servers." })
|
|
2931
3248
|
] })
|
|
@@ -2934,67 +3251,67 @@ function xt() {
|
|
|
2934
3251
|
/* @__PURE__ */ e("div", { className: "flex justify-end px-6 py-4 border-t border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e(
|
|
2935
3252
|
"button",
|
|
2936
3253
|
{
|
|
2937
|
-
onClick:
|
|
3254
|
+
onClick: i,
|
|
2938
3255
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
|
|
2939
3256
|
children: "Done"
|
|
2940
3257
|
}
|
|
2941
3258
|
) })
|
|
2942
3259
|
] }) }) : null;
|
|
2943
3260
|
}
|
|
2944
|
-
function
|
|
2945
|
-
const [r,
|
|
2946
|
-
|
|
2947
|
-
const
|
|
2948
|
-
if (
|
|
2949
|
-
const u =
|
|
2950
|
-
u && (
|
|
3261
|
+
function jt() {
|
|
3262
|
+
const [r, i] = N("editor"), t = x((o) => o.addNode), a = x((o) => o.loadTemplate);
|
|
3263
|
+
M(() => {
|
|
3264
|
+
const n = new URLSearchParams(window.location.search).get("template");
|
|
3265
|
+
if (n) {
|
|
3266
|
+
const u = ne(n);
|
|
3267
|
+
u && (a(u), window.history.replaceState({}, "", window.location.pathname));
|
|
2951
3268
|
}
|
|
2952
|
-
}, [
|
|
2953
|
-
const
|
|
2954
|
-
|
|
3269
|
+
}, [a]), M(() => {
|
|
3270
|
+
const o = () => {
|
|
3271
|
+
i("editor");
|
|
2955
3272
|
};
|
|
2956
|
-
return window.addEventListener("workflow-loaded",
|
|
2957
|
-
window.removeEventListener("workflow-loaded",
|
|
3273
|
+
return window.addEventListener("workflow-loaded", o), () => {
|
|
3274
|
+
window.removeEventListener("workflow-loaded", o);
|
|
2958
3275
|
};
|
|
2959
3276
|
}, []);
|
|
2960
|
-
const
|
|
2961
|
-
(
|
|
2962
|
-
const
|
|
2963
|
-
|
|
3277
|
+
const s = C(
|
|
3278
|
+
(o) => {
|
|
3279
|
+
const n = ne(o);
|
|
3280
|
+
n && (a(n), i("editor"));
|
|
2964
3281
|
},
|
|
2965
|
-
[
|
|
2966
|
-
),
|
|
2967
|
-
(
|
|
3282
|
+
[a]
|
|
3283
|
+
), d = C(
|
|
3284
|
+
(o) => {
|
|
2968
3285
|
var u;
|
|
2969
|
-
|
|
2970
|
-
const
|
|
2971
|
-
if (
|
|
3286
|
+
o.preventDefault();
|
|
3287
|
+
const n = o.dataTransfer.getData("application/json");
|
|
3288
|
+
if (n)
|
|
2972
3289
|
try {
|
|
2973
|
-
const
|
|
3290
|
+
const l = JSON.parse(n), p = (u = document.querySelector(".react-flow")) == null ? void 0 : u.getBoundingClientRect();
|
|
2974
3291
|
if (!p) return;
|
|
2975
|
-
const
|
|
2976
|
-
x:
|
|
2977
|
-
y:
|
|
3292
|
+
const f = {
|
|
3293
|
+
x: o.clientX - p.left,
|
|
3294
|
+
y: o.clientY - p.top
|
|
2978
3295
|
};
|
|
2979
|
-
t(
|
|
2980
|
-
} catch (
|
|
2981
|
-
console.error("Failed to parse dropped node:",
|
|
3296
|
+
t(l, f);
|
|
3297
|
+
} catch (l) {
|
|
3298
|
+
console.error("Failed to parse dropped node:", l);
|
|
2982
3299
|
}
|
|
2983
3300
|
},
|
|
2984
3301
|
[t]
|
|
2985
|
-
),
|
|
2986
|
-
|
|
3302
|
+
), m = C((o) => {
|
|
3303
|
+
o.preventDefault(), o.dataTransfer.dropEffect = "move";
|
|
2987
3304
|
}, []);
|
|
2988
|
-
return /* @__PURE__ */
|
|
2989
|
-
/* @__PURE__ */ e(
|
|
2990
|
-
/* @__PURE__ */ e(
|
|
2991
|
-
/* @__PURE__ */
|
|
2992
|
-
/* @__PURE__ */ e(
|
|
2993
|
-
/* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */
|
|
3305
|
+
return /* @__PURE__ */ c(Se, { children: [
|
|
3306
|
+
/* @__PURE__ */ e(St, {}),
|
|
3307
|
+
/* @__PURE__ */ e(vt, {}),
|
|
3308
|
+
/* @__PURE__ */ c("div", { className: "h-screen flex flex-col bg-gray-100 dark:bg-zinc-900", children: [
|
|
3309
|
+
/* @__PURE__ */ e(nt, {}),
|
|
3310
|
+
/* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ c("div", { className: "flex", children: [
|
|
2994
3311
|
/* @__PURE__ */ e(
|
|
2995
3312
|
"button",
|
|
2996
3313
|
{
|
|
2997
|
-
onClick: () =>
|
|
3314
|
+
onClick: () => i("editor"),
|
|
2998
3315
|
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"}`,
|
|
2999
3316
|
children: "Editor"
|
|
3000
3317
|
}
|
|
@@ -3002,7 +3319,7 @@ function St() {
|
|
|
3002
3319
|
/* @__PURE__ */ e(
|
|
3003
3320
|
"button",
|
|
3004
3321
|
{
|
|
3005
|
-
onClick: () =>
|
|
3322
|
+
onClick: () => i("gallery"),
|
|
3006
3323
|
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"}`,
|
|
3007
3324
|
children: "Gallery"
|
|
3008
3325
|
}
|
|
@@ -3010,40 +3327,40 @@ function St() {
|
|
|
3010
3327
|
/* @__PURE__ */ e(
|
|
3011
3328
|
"button",
|
|
3012
3329
|
{
|
|
3013
|
-
onClick: () =>
|
|
3330
|
+
onClick: () => i("templates"),
|
|
3014
3331
|
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"}`,
|
|
3015
3332
|
children: "Templates"
|
|
3016
3333
|
}
|
|
3017
3334
|
)
|
|
3018
3335
|
] }) }),
|
|
3019
|
-
/* @__PURE__ */
|
|
3020
|
-
r === "editor" && /* @__PURE__ */
|
|
3021
|
-
/* @__PURE__ */ e(
|
|
3022
|
-
/* @__PURE__ */ e("div", { className: "flex-1", onDrop:
|
|
3023
|
-
/* @__PURE__ */ e(
|
|
3336
|
+
/* @__PURE__ */ c("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
3337
|
+
r === "editor" && /* @__PURE__ */ c(P, { children: [
|
|
3338
|
+
/* @__PURE__ */ e(Ye, {}),
|
|
3339
|
+
/* @__PURE__ */ e("div", { className: "flex-1", onDrop: d, onDragOver: m, children: /* @__PURE__ */ e(Qe, {}) }),
|
|
3340
|
+
/* @__PURE__ */ e(Xe, {})
|
|
3024
3341
|
] }),
|
|
3025
|
-
r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(
|
|
3026
|
-
r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(
|
|
3342
|
+
r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(st, {}) }),
|
|
3343
|
+
r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(xt, { onSelect: s }) })
|
|
3027
3344
|
] })
|
|
3028
3345
|
] })
|
|
3029
3346
|
] });
|
|
3030
3347
|
}
|
|
3031
3348
|
export {
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3349
|
+
St as AISettings,
|
|
3350
|
+
jt as App,
|
|
3351
|
+
st as Gallery,
|
|
3352
|
+
Xe as NodeInspector,
|
|
3353
|
+
Ye as NodePalette,
|
|
3354
|
+
xt as TemplateGallery,
|
|
3355
|
+
nt as Toolbar,
|
|
3356
|
+
Je as UploadGallery,
|
|
3357
|
+
Qe as WorkflowEditor,
|
|
3358
|
+
vt as WorkflowLibrary,
|
|
3359
|
+
bt as getCategories,
|
|
3360
|
+
ne as getTemplateById,
|
|
3361
|
+
$t as getTemplatesByCategory,
|
|
3362
|
+
Mt as searchTemplates,
|
|
3363
|
+
O as templates,
|
|
3364
|
+
x as useWorkflowStore
|
|
3048
3365
|
};
|
|
3049
3366
|
//# sourceMappingURL=index.js.map
|