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