@teamflojo/floimg-studio-ui 0.2.1 → 0.2.2

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/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { jsxs as s, jsx as e, Fragment as U } from "react/jsx-runtime";
2
- import { memo as E, useRef as Q, useCallback as L, useState as I, useEffect as D, useMemo as ne } from "react";
3
- import we, { Handle as A, Position as P, applyNodeChanges as Ne, applyEdgeChanges as ze, MarkerType as Ce, Background as Ie, Controls as Se, MiniMap as Le, ReactFlowProvider as We, useReactFlow as Ae } from "reactflow";
4
- import { create as ce } from "zustand";
1
+ import { jsxs as o, jsx as e, Fragment as U } from "react/jsx-runtime";
2
+ import { memo as E, useRef as Q, useCallback as L, useState as I, useEffect as D, useMemo as oe } from "react";
3
+ import Ne, { Handle as A, Position as P, applyNodeChanges as ze, applyEdgeChanges as Ce, MarkerType as Ie, Background as Se, Controls as Le, MiniMap as We, ReactFlowProvider as Ae, useReactFlow as Pe } from "reactflow";
4
+ import { create as me } from "zustand";
5
5
  import { useQuery as F } from "@tanstack/react-query";
6
- function Pe(r, l) {
6
+ function $e(r, l) {
7
7
  let t;
8
8
  try {
9
9
  t = r();
@@ -11,13 +11,13 @@ function Pe(r, l) {
11
11
  return;
12
12
  }
13
13
  return {
14
- getItem: (o) => {
15
- var i;
16
- const m = (a) => a === null ? null : JSON.parse(a, void 0), d = (i = t.getItem(o)) != null ? i : null;
17
- return d instanceof Promise ? d.then(m) : m(d);
14
+ getItem: (i) => {
15
+ var s;
16
+ const p = (a) => a === null ? null : JSON.parse(a, void 0), d = (s = t.getItem(i)) != null ? s : null;
17
+ return d instanceof Promise ? d.then(p) : p(d);
18
18
  },
19
- setItem: (o, i) => t.setItem(o, JSON.stringify(i, void 0)),
20
- removeItem: (o) => t.removeItem(o)
19
+ setItem: (i, s) => t.setItem(i, JSON.stringify(s, void 0)),
20
+ removeItem: (i) => t.removeItem(i)
21
21
  };
22
22
  }
23
23
  const Y = (r) => (l) => {
@@ -41,61 +41,61 @@ const Y = (r) => (l) => {
41
41
  }
42
42
  };
43
43
  }
44
- }, $e = (r, l) => (t, n, o) => {
45
- let i = {
46
- storage: Pe(() => localStorage),
44
+ }, Me = (r, l) => (t, n, i) => {
45
+ let s = {
46
+ storage: $e(() => localStorage),
47
47
  partialize: (v) => v,
48
48
  version: 0,
49
- merge: (v, y) => ({
50
- ...y,
49
+ merge: (v, w) => ({
50
+ ...w,
51
51
  ...v
52
52
  }),
53
53
  ...l
54
- }, m = !1;
54
+ }, p = !1;
55
55
  const d = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
56
- let p = i.storage;
57
- if (!p)
56
+ let m = s.storage;
57
+ if (!m)
58
58
  return r(
59
59
  (...v) => {
60
60
  console.warn(
61
- `[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`
61
+ `[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`
62
62
  ), t(...v);
63
63
  },
64
64
  n,
65
- o
65
+ i
66
66
  );
67
67
  const c = () => {
68
- const v = i.partialize({ ...n() });
69
- return p.setItem(i.name, {
68
+ const v = s.partialize({ ...n() });
69
+ return m.setItem(s.name, {
70
70
  state: v,
71
- version: i.version
71
+ version: s.version
72
72
  });
73
- }, u = o.setState;
74
- o.setState = (v, y) => (u(v, y), c());
73
+ }, u = i.setState;
74
+ i.setState = (v, w) => (u(v, w), c());
75
75
  const h = r(
76
76
  (...v) => (t(...v), c()),
77
77
  n,
78
- o
78
+ i
79
79
  );
80
- o.getInitialState = () => h;
80
+ i.getInitialState = () => h;
81
81
  let f;
82
- const w = () => {
83
- var v, y;
84
- if (!p) return;
85
- m = !1, d.forEach((g) => {
86
- var N;
87
- return g((N = n()) != null ? N : h);
82
+ const y = () => {
83
+ var v, w;
84
+ if (!m) return;
85
+ p = !1, d.forEach((g) => {
86
+ var z;
87
+ return g((z = n()) != null ? z : h);
88
88
  });
89
- const b = ((y = i.onRehydrateStorage) == null ? void 0 : y.call(i, (v = n()) != null ? v : h)) || void 0;
90
- return Y(p.getItem.bind(p))(i.name).then((g) => {
89
+ const b = ((w = s.onRehydrateStorage) == null ? void 0 : w.call(s, (v = n()) != null ? v : h)) || void 0;
90
+ return Y(m.getItem.bind(m))(s.name).then((g) => {
91
91
  if (g)
92
- if (typeof g.version == "number" && g.version !== i.version) {
93
- if (i.migrate) {
94
- const N = i.migrate(
92
+ if (typeof g.version == "number" && g.version !== s.version) {
93
+ if (s.migrate) {
94
+ const z = s.migrate(
95
95
  g.state,
96
96
  g.version
97
97
  );
98
- return N instanceof Promise ? N.then((W) => [!0, W]) : [!0, N];
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"
@@ -104,40 +104,40 @@ const Y = (r) => (l) => {
104
104
  return [!1, g.state];
105
105
  return [!1, void 0];
106
106
  }).then((g) => {
107
- var N;
107
+ var z;
108
108
  const [W, x] = g;
109
- if (f = i.merge(
109
+ if (f = s.merge(
110
110
  x,
111
- (N = n()) != null ? N : h
111
+ (z = n()) != null ? z : h
112
112
  ), t(f, !0), W)
113
113
  return c();
114
114
  }).then(() => {
115
- b == null || b(f, void 0), f = n(), m = !0, a.forEach((g) => g(f));
115
+ b == null || b(f, void 0), f = n(), p = !0, a.forEach((g) => g(f));
116
116
  }).catch((g) => {
117
117
  b == null || b(void 0, g);
118
118
  });
119
119
  };
120
- return o.persist = {
120
+ return i.persist = {
121
121
  setOptions: (v) => {
122
- i = {
123
- ...i,
122
+ s = {
123
+ ...s,
124
124
  ...v
125
- }, v.storage && (p = v.storage);
125
+ }, v.storage && (m = v.storage);
126
126
  },
127
127
  clearStorage: () => {
128
- p == null || p.removeItem(i.name);
128
+ m == null || m.removeItem(s.name);
129
129
  },
130
- getOptions: () => i,
131
- rehydrate: () => w(),
132
- hasHydrated: () => m,
130
+ getOptions: () => s,
131
+ rehydrate: () => y(),
132
+ hasHydrated: () => p,
133
133
  onHydrate: (v) => (d.add(v), () => {
134
134
  d.delete(v);
135
135
  }),
136
136
  onFinishHydration: (v) => (a.add(v), () => {
137
137
  a.delete(v);
138
138
  })
139
- }, i.skipHydration || w(), f || h;
140
- }, me = $e, $ = "/api";
139
+ }, s.skipHydration || y(), f || h;
140
+ }, pe = Me, $ = "/api";
141
141
  async function j(r, l) {
142
142
  const t = await fetch(r, {
143
143
  ...l,
@@ -152,44 +152,44 @@ async function j(r, l) {
152
152
  }
153
153
  return t.json();
154
154
  }
155
- async function Me() {
155
+ async function je() {
156
156
  return j(`${$}/nodes/generators`);
157
157
  }
158
- async function je() {
158
+ async function De() {
159
159
  return j(`${$}/nodes/transforms`);
160
160
  }
161
- async function De() {
161
+ async function Te() {
162
162
  return j(`${$}/nodes/text`);
163
163
  }
164
- async function Te() {
164
+ async function Ue() {
165
165
  return j(`${$}/nodes/vision`);
166
166
  }
167
- async function Ue(r, l, t) {
167
+ async function Oe(r, l, t) {
168
168
  return j(`${$}/execute/sync`, {
169
169
  method: "POST",
170
170
  body: JSON.stringify({ nodes: r, edges: l, aiProviders: t })
171
171
  });
172
172
  }
173
- async function Oe(r, l) {
173
+ async function Re(r, l) {
174
174
  return j(`${$}/export/yaml`, {
175
175
  method: "POST",
176
176
  body: JSON.stringify({ nodes: r, edges: l })
177
177
  });
178
178
  }
179
- async function Re() {
179
+ async function Ee() {
180
180
  return j(`${$}/images`);
181
181
  }
182
- function oe(r) {
182
+ function se(r) {
183
183
  return `${$}/images/${r}/blob`;
184
184
  }
185
- async function Ee(r) {
185
+ async function Be(r) {
186
186
  try {
187
187
  return await j(`${$}/images/${r}/workflow`);
188
188
  } catch {
189
189
  return null;
190
190
  }
191
191
  }
192
- async function Be(r) {
192
+ async function Ve(r) {
193
193
  const l = new FormData();
194
194
  l.append("file", r);
195
195
  const t = await fetch(`${$}/uploads`, {
@@ -202,74 +202,74 @@ async function Be(r) {
202
202
  }
203
203
  return t.json();
204
204
  }
205
- async function Ve() {
205
+ async function Ge() {
206
206
  return j(`${$}/uploads`);
207
207
  }
208
- async function Ge(r) {
208
+ async function Fe(r) {
209
209
  const l = await fetch(`${$}/uploads/${r}`, {
210
210
  method: "DELETE"
211
211
  });
212
212
  if (!l.ok)
213
213
  throw new Error(`Failed to delete upload: ${l.status}`);
214
214
  }
215
- function pe(r) {
215
+ function ue(r) {
216
216
  return `${$}/uploads/${r}/blob`;
217
217
  }
218
- async function Fe(r) {
218
+ async function He(r) {
219
219
  return j(`${$}/import`, {
220
220
  method: "POST",
221
221
  body: JSON.stringify({ yaml: r })
222
222
  });
223
223
  }
224
- async function He(r) {
224
+ async function _e(r) {
225
225
  return j(`${$}/import/validate`, {
226
226
  method: "POST",
227
227
  body: JSON.stringify({ yaml: r })
228
228
  });
229
229
  }
230
- async function _e(r) {
230
+ async function Ke(r) {
231
231
  return j(`${$}/generate/workflow`, {
232
232
  method: "POST",
233
233
  body: JSON.stringify(r)
234
234
  });
235
235
  }
236
- async function Ke() {
236
+ async function qe() {
237
237
  return j(`${$}/generate/status`);
238
238
  }
239
- const se = "http://localhost:11434", ie = "http://localhost:1234", O = ce()(
240
- me(
239
+ const ie = "http://localhost:11434", le = "http://localhost:1234", O = me()(
240
+ pe(
241
241
  (r, l) => ({
242
242
  ai: {
243
243
  ollama: {
244
- baseUrl: se,
244
+ baseUrl: ie,
245
245
  enabled: !1
246
246
  },
247
247
  lmstudio: {
248
- baseUrl: ie,
248
+ baseUrl: le,
249
249
  enabled: !1
250
250
  }
251
251
  },
252
252
  showSettings: !1,
253
253
  setAIProvider: (t, n) => {
254
- r((o) => ({
254
+ r((i) => ({
255
255
  ai: {
256
- ...o.ai,
256
+ ...i.ai,
257
257
  [t]: n
258
258
  }
259
259
  }));
260
260
  },
261
261
  clearAIProvider: (t) => {
262
262
  r((n) => {
263
- const o = { ...n.ai };
264
- return delete o[t], { ai: o };
263
+ const i = { ...n.ai };
264
+ return delete i[t], { ai: i };
265
265
  });
266
266
  },
267
267
  openSettings: () => r({ showSettings: !0 }),
268
268
  closeSettings: () => r({ showSettings: !1 }),
269
269
  getConfiguredProviders: () => {
270
- var o, i, m, d, a, p, c;
270
+ var i, s, p, d, a, m, c;
271
271
  const { ai: t } = l(), n = {};
272
- return (o = t.openai) != null && o.enabled && t.openai.apiKey && (n.openai = { apiKey: t.openai.apiKey }), (i = t.anthropic) != null && i.enabled && t.anthropic.apiKey && (n.anthropic = { apiKey: t.anthropic.apiKey }), (m = t.gemini) != null && m.enabled && t.gemini.apiKey && (n.gemini = { apiKey: t.gemini.apiKey }), (d = t.grok) != null && d.enabled && t.grok.apiKey && (n.grok = { apiKey: t.grok.apiKey }), (a = t.openrouter) != null && a.enabled && t.openrouter.apiKey && (n.openrouter = { apiKey: t.openrouter.apiKey }), (p = t.ollama) != null && p.enabled && (n.ollama = { baseUrl: t.ollama.baseUrl || se }), (c = t.lmstudio) != null && c.enabled && (n.lmstudio = { baseUrl: t.lmstudio.baseUrl || ie }), n;
272
+ return (i = t.openai) != null && i.enabled && t.openai.apiKey && (n.openai = { apiKey: t.openai.apiKey }), (s = t.anthropic) != null && s.enabled && t.anthropic.apiKey && (n.anthropic = { apiKey: t.anthropic.apiKey }), (p = t.gemini) != null && p.enabled && t.gemini.apiKey && (n.gemini = { apiKey: t.gemini.apiKey }), (d = t.grok) != null && d.enabled && t.grok.apiKey && (n.grok = { apiKey: t.grok.apiKey }), (a = t.openrouter) != null && a.enabled && t.openrouter.apiKey && (n.openrouter = { apiKey: t.openrouter.apiKey }), (m = t.ollama) != null && m.enabled && (n.ollama = { baseUrl: t.ollama.baseUrl || ie }), (c = t.lmstudio) != null && c.enabled && (n.lmstudio = { baseUrl: t.lmstudio.baseUrl || le }), n;
273
273
  }
274
274
  }),
275
275
  {
@@ -279,16 +279,16 @@ const se = "http://localhost:11434", ie = "http://localhost:1234", O = ce()(
279
279
  }
280
280
  )
281
281
  );
282
- let qe = 0;
282
+ let Je = 0;
283
283
  function V() {
284
- return `node_${++qe}`;
284
+ return `node_${++Je}`;
285
285
  }
286
- function le() {
286
+ function de() {
287
287
  const r = Date.now(), l = Math.random().toString(36).substring(2, 8);
288
288
  return `wf_${r}_${l}`;
289
289
  }
290
- const k = ce()(
291
- me(
290
+ const k = me()(
291
+ pe(
292
292
  (r, l) => ({
293
293
  nodes: [],
294
294
  edges: [],
@@ -314,16 +314,16 @@ const k = ce()(
314
314
  nodeStatus: {}
315
315
  },
316
316
  loadTemplate: (t) => {
317
- const n = /* @__PURE__ */ new Map(), o = t.workflow.nodes.map((m) => {
317
+ const n = /* @__PURE__ */ new Map(), i = t.workflow.nodes.map((p) => {
318
318
  const d = V();
319
- return n.set(m.id, d), {
319
+ return n.set(p.id, d), {
320
320
  id: d,
321
- type: m.type,
322
- position: m.position,
323
- data: m.data
321
+ type: p.type,
322
+ position: p.position,
323
+ data: p.data
324
324
  };
325
- }), i = t.workflow.edges.map((m) => {
326
- const d = n.get(m.source) || m.source, a = n.get(m.target) || m.target;
325
+ }), s = t.workflow.edges.map((p) => {
326
+ const d = n.get(p.source) || p.source, a = n.get(p.target) || p.target;
327
327
  return {
328
328
  id: `edge_${d}_${a}`,
329
329
  source: d,
@@ -331,8 +331,8 @@ const k = ce()(
331
331
  };
332
332
  });
333
333
  r({
334
- nodes: o,
335
- edges: i,
334
+ nodes: i,
335
+ edges: s,
336
336
  selectedNodeId: null,
337
337
  currentTemplateId: t.id,
338
338
  previewVisible: {},
@@ -377,11 +377,11 @@ const k = ce()(
377
377
  setTextProviders: (t) => r({ textProviders: t }),
378
378
  setVisionProviders: (t) => r({ visionProviders: t }),
379
379
  addNode: (t, n) => {
380
- var d, a, p;
381
- const o = V();
382
- let i;
380
+ var d, a, m;
381
+ const i = V();
382
+ let s;
383
383
  if (t.type === "generator")
384
- i = {
384
+ s = {
385
385
  generatorName: t.name,
386
386
  params: _(t),
387
387
  isAI: t.isAI,
@@ -390,7 +390,7 @@ const k = ce()(
390
390
  maxReferenceImages: t.maxReferenceImages
391
391
  };
392
392
  else if (t.type === "transform")
393
- i = {
393
+ s = {
394
394
  operation: t.name,
395
395
  providerName: t.providerName,
396
396
  // Track which provider this transform belongs to
@@ -401,20 +401,20 @@ const k = ce()(
401
401
  maxReferenceImages: t.maxReferenceImages
402
402
  };
403
403
  else if (t.type === "input")
404
- i = {
404
+ s = {
405
405
  uploadId: void 0,
406
406
  filename: void 0,
407
407
  mime: void 0
408
408
  };
409
409
  else if (t.type === "vision")
410
- i = {
410
+ s = {
411
411
  providerName: t.name,
412
412
  providerLabel: t.label,
413
413
  // Human-readable label (e.g., "Gemini Vision")
414
414
  params: _(t)
415
415
  };
416
416
  else if (t.type === "text")
417
- i = {
417
+ s = {
418
418
  providerName: t.name,
419
419
  providerLabel: t.label,
420
420
  // Human-readable label (e.g., "Gemini Text")
@@ -422,89 +422,89 @@ const k = ce()(
422
422
  };
423
423
  else {
424
424
  const c = ((d = t.params) == null ? void 0 : d.properties) || {}, u = ((a = c.provider) == null ? void 0 : a.default) || "filesystem";
425
- i = {
426
- destination: ((p = c.destination) == null ? void 0 : p.default) || "./output/image.png",
425
+ s = {
426
+ destination: ((m = c.destination) == null ? void 0 : m.default) || "./output/image.png",
427
427
  provider: u
428
428
  };
429
429
  }
430
- const m = {
431
- id: o,
430
+ const p = {
431
+ id: i,
432
432
  type: t.type,
433
433
  position: n,
434
- data: i
434
+ data: s
435
435
  };
436
436
  r((c) => ({
437
- nodes: [...c.nodes, m]
437
+ nodes: [...c.nodes, p]
438
438
  }));
439
439
  },
440
440
  updateNodeData: (t, n) => {
441
- r((o) => ({
442
- nodes: o.nodes.map(
443
- (i) => i.id === t ? { ...i, data: { ...i.data, ...n } } : i
441
+ r((i) => ({
442
+ nodes: i.nodes.map(
443
+ (s) => s.id === t ? { ...s, data: { ...s.data, ...n } } : s
444
444
  )
445
445
  }));
446
446
  },
447
447
  deleteNode: (t) => {
448
448
  r((n) => ({
449
- nodes: n.nodes.filter((o) => o.id !== t),
450
- edges: n.edges.filter((o) => o.source !== t && o.target !== t),
449
+ nodes: n.nodes.filter((i) => i.id !== t),
450
+ edges: n.edges.filter((i) => i.source !== t && i.target !== t),
451
451
  selectedNodeId: n.selectedNodeId === t ? null : n.selectedNodeId
452
452
  }));
453
453
  },
454
454
  duplicateNode: (t) => {
455
- const n = l(), o = n.nodes.find((d) => d.id === t);
456
- if (!o) return;
457
- const i = V(), m = {
458
- ...o,
459
- id: i,
455
+ const n = l(), i = n.nodes.find((d) => d.id === t);
456
+ if (!i) return;
457
+ const s = V(), p = {
458
+ ...i,
459
+ id: s,
460
460
  position: {
461
- x: o.position.x + 50,
462
- y: o.position.y + 50
461
+ x: i.position.x + 50,
462
+ y: i.position.y + 50
463
463
  },
464
- data: JSON.parse(JSON.stringify(o.data)),
464
+ data: JSON.parse(JSON.stringify(i.data)),
465
465
  // Deep clone
466
466
  selected: !1
467
467
  };
468
468
  r({
469
- nodes: [...n.nodes, m],
470
- selectedNodeId: i
469
+ nodes: [...n.nodes, p],
470
+ selectedNodeId: s
471
471
  // Select the new node
472
472
  });
473
473
  },
474
474
  setNodes: (t) => r({ nodes: t }),
475
475
  addEdge: (t) => {
476
476
  if (!t.source || !t.target) return;
477
- const n = [t.sourceHandle, t.targetHandle].filter(Boolean).join("_"), i = {
477
+ const n = [t.sourceHandle, t.targetHandle].filter(Boolean).join("_"), s = {
478
478
  id: n ? `edge_${t.source}_${t.target}_${n}` : `edge_${t.source}_${t.target}`,
479
479
  source: t.source,
480
480
  target: t.target,
481
481
  sourceHandle: t.sourceHandle ?? void 0,
482
482
  targetHandle: t.targetHandle ?? void 0
483
483
  };
484
- r((m) => ({
485
- edges: [...m.edges, i]
484
+ r((p) => ({
485
+ edges: [...p.edges, s]
486
486
  }));
487
487
  },
488
488
  deleteEdge: (t) => {
489
489
  r((n) => ({
490
- edges: n.edges.filter((o) => o.id !== t)
490
+ edges: n.edges.filter((i) => i.id !== t)
491
491
  }));
492
492
  },
493
493
  setEdges: (t) => r({ edges: t }),
494
494
  setSelectedNode: (t) => r({ selectedNodeId: t }),
495
495
  execute: async () => {
496
- const { nodes: t, edges: n } = l(), o = t.map((a) => ({
496
+ const { nodes: t, edges: n } = l(), i = t.map((a) => ({
497
497
  id: a.id,
498
498
  type: a.type,
499
499
  position: a.position,
500
500
  data: a.data
501
- })), i = n.map((a) => ({
501
+ })), s = n.map((a) => ({
502
502
  id: a.id,
503
503
  source: a.source,
504
504
  target: a.target,
505
505
  sourceHandle: a.sourceHandle ?? void 0,
506
506
  targetHandle: a.targetHandle ?? void 0
507
- })), m = O.getState().getConfiguredProviders(), d = {};
507
+ })), p = O.getState().getConfiguredProviders(), d = {};
508
508
  for (const a of t)
509
509
  d[a.id] = "running";
510
510
  r({
@@ -518,9 +518,9 @@ const k = ce()(
518
518
  }
519
519
  });
520
520
  try {
521
- const a = await Ue(o, i, m), p = {};
521
+ const a = await Oe(i, s, p), m = {};
522
522
  for (const c of t)
523
- p[c.id] = a.status === "completed" ? "completed" : "error";
523
+ m[c.id] = a.status === "completed" ? "completed" : "error";
524
524
  a.status === "completed" ? r({
525
525
  execution: {
526
526
  status: "completed",
@@ -528,7 +528,7 @@ const k = ce()(
528
528
  imageUrls: a.imageUrls || [],
529
529
  previews: a.previews || {},
530
530
  dataOutputs: a.dataOutputs || {},
531
- nodeStatus: p
531
+ nodeStatus: m
532
532
  }
533
533
  }) : r({
534
534
  execution: {
@@ -537,14 +537,14 @@ const k = ce()(
537
537
  imageUrls: [],
538
538
  previews: {},
539
539
  dataOutputs: {},
540
- nodeStatus: p,
540
+ nodeStatus: m,
541
541
  error: a.error
542
542
  }
543
543
  });
544
544
  } catch (a) {
545
- const p = {};
545
+ const m = {};
546
546
  for (const c of t)
547
- p[c.id] = "error";
547
+ m[c.id] = "error";
548
548
  r({
549
549
  execution: {
550
550
  status: "error",
@@ -552,52 +552,52 @@ const k = ce()(
552
552
  imageUrls: [],
553
553
  previews: {},
554
554
  dataOutputs: {},
555
- nodeStatus: p,
555
+ nodeStatus: m,
556
556
  error: a instanceof Error ? a.message : "Unknown error"
557
557
  }
558
558
  });
559
559
  }
560
560
  },
561
561
  exportToYaml: async () => {
562
- const { nodes: t, edges: n } = l(), o = t.map((d) => ({
562
+ const { nodes: t, edges: n } = l(), i = t.map((d) => ({
563
563
  id: d.id,
564
564
  type: d.type,
565
565
  position: d.position,
566
566
  data: d.data
567
- })), i = n.map((d) => ({
567
+ })), s = n.map((d) => ({
568
568
  id: d.id,
569
569
  source: d.source,
570
570
  target: d.target,
571
571
  sourceHandle: d.sourceHandle ?? void 0,
572
572
  targetHandle: d.targetHandle ?? void 0
573
573
  }));
574
- return (await Oe(o, i)).yaml;
574
+ return (await Re(i, s)).yaml;
575
575
  },
576
- importFromYaml: (t, n, o) => {
577
- const i = /* @__PURE__ */ new Map(), m = t.map((a) => {
578
- const p = V();
579
- return i.set(a.id, p), {
580
- id: p,
576
+ importFromYaml: (t, n, i) => {
577
+ const s = /* @__PURE__ */ new Map(), p = t.map((a) => {
578
+ const m = V();
579
+ return s.set(a.id, m), {
580
+ id: m,
581
581
  type: a.type,
582
582
  position: a.position,
583
583
  data: a.data
584
584
  };
585
585
  }), d = n.map((a) => {
586
- const p = i.get(a.source) || a.source, c = i.get(a.target) || a.target;
586
+ const m = s.get(a.source) || a.source, c = s.get(a.target) || a.target;
587
587
  return {
588
- id: `edge_${p}_${c}`,
589
- source: p,
588
+ id: `edge_${m}_${c}`,
589
+ source: m,
590
590
  target: c
591
591
  };
592
592
  });
593
593
  r({
594
- nodes: m,
594
+ nodes: p,
595
595
  edges: d,
596
596
  selectedNodeId: null,
597
597
  currentTemplateId: null,
598
598
  previewVisible: {},
599
599
  activeWorkflowId: null,
600
- activeWorkflowName: o || "Imported Workflow",
600
+ activeWorkflowName: i || "Imported Workflow",
601
601
  hasUnsavedChanges: !0,
602
602
  execution: {
603
603
  status: "idle",
@@ -636,49 +636,49 @@ const k = ce()(
636
636
  saveWorkflow: (t) => {
637
637
  const {
638
638
  nodes: n,
639
- edges: o,
640
- activeWorkflowId: i,
641
- activeWorkflowName: m,
639
+ edges: i,
640
+ activeWorkflowId: s,
641
+ activeWorkflowName: p,
642
642
  savedWorkflows: d,
643
643
  currentTemplateId: a
644
- } = l(), p = Date.now();
645
- if (i) {
644
+ } = l(), m = Date.now();
645
+ if (s) {
646
646
  const c = d.map(
647
- (u) => u.id === i ? { ...u, name: t || m, nodes: n, edges: o, updatedAt: p } : u
647
+ (u) => u.id === s ? { ...u, name: t || p, nodes: n, edges: i, updatedAt: m } : u
648
648
  );
649
649
  return r({
650
650
  savedWorkflows: c,
651
- activeWorkflowName: t || m,
651
+ activeWorkflowName: t || p,
652
652
  hasUnsavedChanges: !1
653
- }), i;
653
+ }), s;
654
654
  } else {
655
- const c = le(), u = {
655
+ const c = de(), u = {
656
656
  id: c,
657
- name: t || m,
657
+ name: t || p,
658
658
  nodes: n,
659
- edges: o,
660
- createdAt: p,
661
- updatedAt: p,
659
+ edges: i,
660
+ createdAt: m,
661
+ updatedAt: m,
662
662
  templateId: a || void 0
663
663
  };
664
664
  return r({
665
665
  savedWorkflows: [...d, u],
666
666
  activeWorkflowId: c,
667
- activeWorkflowName: t || m,
667
+ activeWorkflowName: t || p,
668
668
  hasUnsavedChanges: !1
669
669
  }), c;
670
670
  }
671
671
  },
672
672
  loadWorkflow: (t) => {
673
- const { savedWorkflows: n } = l(), o = n.find((i) => i.id === t);
674
- o && r({
675
- nodes: o.nodes,
676
- edges: o.edges,
673
+ const { savedWorkflows: n } = l(), i = n.find((s) => s.id === t);
674
+ i && r({
675
+ nodes: i.nodes,
676
+ edges: i.edges,
677
677
  selectedNodeId: null,
678
- currentTemplateId: o.templateId || null,
678
+ currentTemplateId: i.templateId || null,
679
679
  previewVisible: {},
680
680
  activeWorkflowId: t,
681
- activeWorkflowName: o.name,
681
+ activeWorkflowName: i.name,
682
682
  hasUnsavedChanges: !1,
683
683
  execution: {
684
684
  status: "idle",
@@ -691,9 +691,9 @@ const k = ce()(
691
691
  });
692
692
  },
693
693
  deleteWorkflow: (t) => {
694
- const { savedWorkflows: n, activeWorkflowId: o } = l(), i = n.filter((m) => m.id !== t);
695
- r(o === t ? {
696
- savedWorkflows: i,
694
+ const { savedWorkflows: n, activeWorkflowId: i } = l(), s = n.filter((p) => p.id !== t);
695
+ r(i === t ? {
696
+ savedWorkflows: s,
697
697
  nodes: [],
698
698
  edges: [],
699
699
  selectedNodeId: null,
@@ -710,42 +710,42 @@ const k = ce()(
710
710
  dataOutputs: {},
711
711
  nodeStatus: {}
712
712
  }
713
- } : { savedWorkflows: i });
713
+ } : { savedWorkflows: s });
714
714
  },
715
715
  renameWorkflow: (t, n) => {
716
- const { savedWorkflows: o, activeWorkflowId: i } = l(), m = o.map(
716
+ const { savedWorkflows: i, activeWorkflowId: s } = l(), p = i.map(
717
717
  (d) => d.id === t ? { ...d, name: n, updatedAt: Date.now() } : d
718
718
  );
719
719
  r({
720
- savedWorkflows: m,
721
- ...i === t ? { activeWorkflowName: n } : {}
720
+ savedWorkflows: p,
721
+ ...s === t ? { activeWorkflowName: n } : {}
722
722
  });
723
723
  },
724
724
  duplicateWorkflow: (t) => {
725
- const { savedWorkflows: n } = l(), o = n.find((a) => a.id === t);
726
- if (!o) return "";
727
- const i = Date.now(), m = le(), d = {
728
- ...o,
729
- id: m,
730
- name: `${o.name} (Copy)`,
731
- createdAt: i,
732
- updatedAt: i
725
+ const { savedWorkflows: n } = l(), i = n.find((a) => a.id === t);
726
+ if (!i) return "";
727
+ const s = Date.now(), p = de(), d = {
728
+ ...i,
729
+ id: p,
730
+ name: `${i.name} (Copy)`,
731
+ createdAt: s,
732
+ updatedAt: s
733
733
  };
734
- return r({ savedWorkflows: [...n, d] }), m;
734
+ return r({ savedWorkflows: [...n, d] }), p;
735
735
  },
736
736
  loadGeneratedWorkflow: (t) => {
737
- const n = /* @__PURE__ */ new Map(), o = 250, i = 150, m = 3, d = t.nodes.map((p, c) => {
737
+ const n = /* @__PURE__ */ new Map(), i = 250, s = 150, p = 3, d = t.nodes.map((m, c) => {
738
738
  const u = V();
739
- n.set(p.id, u);
740
- const h = p.nodeType.split(":"), f = h[0], w = Math.floor(c / m), y = {
741
- x: 100 + c % m * o,
742
- y: 100 + w * i
739
+ n.set(m.id, u);
740
+ const h = m.nodeType.split(":"), f = h[0], y = Math.floor(c / p), w = {
741
+ x: 100 + c % p * i,
742
+ y: 100 + y * s
743
743
  };
744
744
  let b;
745
745
  if (f === "generator")
746
746
  b = {
747
747
  generatorName: h.slice(1).join(":"),
748
- params: p.parameters,
748
+ params: m.parameters,
749
749
  isAI: !0
750
750
  // Assume AI since we're generating from AI
751
751
  };
@@ -754,7 +754,7 @@ const k = ce()(
754
754
  b = {
755
755
  operation: h.slice(2).join(":"),
756
756
  providerName: g,
757
- params: p.parameters
757
+ params: m.parameters
758
758
  };
759
759
  } else if (f === "input")
760
760
  b = {
@@ -765,13 +765,13 @@ const k = ce()(
765
765
  else if (f === "vision")
766
766
  b = {
767
767
  providerName: h.slice(1).join(":"),
768
- params: p.parameters
768
+ params: m.parameters
769
769
  };
770
770
  else if (f === "text") {
771
- const g = h.slice(1).join(":"), N = p.parameters.jsonSchema, W = N != null && N.properties ? {
771
+ const g = h.slice(1).join(":"), z = m.parameters.jsonSchema, W = z != null && z.properties ? {
772
772
  type: "object",
773
773
  properties: Object.fromEntries(
774
- Object.entries(N.properties).map(([x, C]) => [
774
+ Object.entries(z.properties).map(([x, C]) => [
775
775
  x,
776
776
  {
777
777
  type: C.type || "string",
@@ -782,28 +782,28 @@ const k = ce()(
782
782
  } : void 0;
783
783
  b = {
784
784
  providerName: g,
785
- params: p.parameters,
785
+ params: m.parameters,
786
786
  outputSchema: W
787
787
  };
788
788
  } else
789
789
  b = {
790
- destination: p.parameters.destination || "./output/image.png",
791
- provider: p.parameters.provider || "filesystem"
790
+ destination: m.parameters.destination || "./output/image.png",
791
+ provider: m.parameters.provider || "filesystem"
792
792
  };
793
793
  return {
794
794
  id: u,
795
795
  type: f,
796
- position: y,
796
+ position: w,
797
797
  data: b
798
798
  };
799
- }), a = t.edges.map((p) => {
800
- const c = n.get(p.source) || p.source, u = n.get(p.target) || p.target, h = [p.sourceHandle, p.targetHandle].filter(Boolean).join("_");
799
+ }), a = t.edges.map((m) => {
800
+ const c = n.get(m.source) || m.source, u = n.get(m.target) || m.target, h = [m.sourceHandle, m.targetHandle].filter(Boolean).join("_");
801
801
  return {
802
802
  id: h ? `edge_${c}_${u}_${h}` : `edge_${c}_${u}`,
803
803
  source: c,
804
804
  target: u,
805
- sourceHandle: p.sourceHandle ?? void 0,
806
- targetHandle: p.targetHandle ?? void 0
805
+ sourceHandle: m.sourceHandle ?? void 0,
806
+ targetHandle: m.targetHandle ?? void 0
807
807
  };
808
808
  });
809
809
  r({
@@ -839,20 +839,20 @@ function _(r) {
839
839
  var t;
840
840
  const l = {};
841
841
  if ((t = r.params) != null && t.properties)
842
- for (const [n, o] of Object.entries(r.params.properties))
843
- o.default !== void 0 && (l[n] = o.default);
842
+ for (const [n, i] of Object.entries(r.params.properties))
843
+ i.default !== void 0 && (l[n] = i.default);
844
844
  return l;
845
845
  }
846
846
  function B(r) {
847
847
  return r === "running" ? "border-yellow-400 animate-pulse" : r === "completed" ? "border-green-500" : r === "error" ? "border-red-500" : "";
848
848
  }
849
849
  function X({ nodeId: r, color: l }) {
850
- const t = k((o) => o.previewVisible[r] !== !1), n = k((o) => o.togglePreview);
850
+ const t = k((i) => i.previewVisible[r] !== !1), n = k((i) => i.togglePreview);
851
851
  return /* @__PURE__ */ e(
852
852
  "button",
853
853
  {
854
- onClick: (o) => {
855
- o.stopPropagation(), n(r);
854
+ onClick: (i) => {
855
+ i.stopPropagation(), n(r);
856
856
  },
857
857
  className: `ml-auto p-1 rounded hover:bg-gray-200 dark:hover:bg-zinc-600 transition-colors ${t ? "opacity-100" : "opacity-40"}`,
858
858
  title: t ? "Hide preview" : "Show preview",
@@ -876,18 +876,18 @@ function X({ nodeId: r, color: l }) {
876
876
  }
877
877
  );
878
878
  }
879
- const Je = E(function({
879
+ const Qe = E(function({
880
880
  id: l,
881
881
  data: t,
882
882
  selected: n
883
883
  }) {
884
- const o = k((u) => u.execution.previews[l]), i = k((u) => u.execution.nodeStatus[l]), m = k((u) => u.previewVisible[l] !== !1), a = B(i) || (n ? "border-blue-500" : "border-blue-200"), p = t.isAI, c = t.acceptsReferenceImages;
885
- return /* @__PURE__ */ s(
884
+ const i = k((u) => u.execution.previews[l]), s = k((u) => u.execution.nodeStatus[l]), p = k((u) => u.previewVisible[l] !== !1), a = B(s) || (n ? "border-blue-500" : "border-blue-200"), m = t.isAI, c = t.acceptsReferenceImages;
885
+ return /* @__PURE__ */ o(
886
886
  "div",
887
887
  {
888
888
  className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
889
889
  children: [
890
- p && /* @__PURE__ */ e(
890
+ m && /* @__PURE__ */ e(
891
891
  A,
892
892
  {
893
893
  type: "target",
@@ -908,16 +908,16 @@ const Je = E(function({
908
908
  title: `Reference images (up to ${t.maxReferenceImages || 14})`
909
909
  }
910
910
  ),
911
- o && m && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: o, alt: "Preview", className: "w-full h-24 object-contain" }) }),
912
- /* @__PURE__ */ s("div", { className: "px-4 py-3", children: [
913
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-2", children: [
911
+ i && p && /* @__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: i, alt: "Preview", className: "w-full h-24 object-contain" }) }),
912
+ /* @__PURE__ */ o("div", { className: "px-4 py-3", children: [
913
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 mb-2", children: [
914
914
  /* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-blue-500" }),
915
915
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-blue-700 dark:text-blue-400", children: t.generatorName }),
916
916
  /* @__PURE__ */ e(X, { nodeId: l, color: "text-blue-500 dark:text-blue-400" })
917
917
  ] }),
918
- p && /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 mb-1", children: "↑ Connect text node for dynamic prompt" }),
918
+ m && /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 mb-1", children: "↑ Connect text node for dynamic prompt" }),
919
919
  c && /* @__PURE__ */ e("div", { className: "text-[10px] text-violet-500 dark:text-violet-400 mb-1", children: "← Connect reference images" }),
920
- /* @__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, h]) => /* @__PURE__ */ s("div", { className: "truncate", children: [
920
+ /* @__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, h]) => /* @__PURE__ */ o("div", { className: "truncate", children: [
921
921
  u,
922
922
  ": ",
923
923
  String(h).slice(0, 20)
@@ -927,18 +927,18 @@ const Je = E(function({
927
927
  ]
928
928
  }
929
929
  );
930
- }), Qe = E(function({
930
+ }), Ye = E(function({
931
931
  id: l,
932
932
  data: t,
933
933
  selected: n
934
934
  }) {
935
- const o = k((u) => u.execution.previews[l]), i = k((u) => u.execution.nodeStatus[l]), m = k((u) => u.previewVisible[l] !== !1), a = B(i) || (n ? "border-teal-500" : "border-teal-200"), p = t.isAI, c = t.acceptsReferenceImages;
936
- return /* @__PURE__ */ s(
935
+ const i = k((u) => u.execution.previews[l]), s = k((u) => u.execution.nodeStatus[l]), p = k((u) => u.previewVisible[l] !== !1), a = B(s) || (n ? "border-teal-500" : "border-teal-200"), m = t.isAI, c = t.acceptsReferenceImages;
936
+ return /* @__PURE__ */ o(
937
937
  "div",
938
938
  {
939
939
  className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${a}`,
940
940
  children: [
941
- p && /* @__PURE__ */ e(
941
+ m && /* @__PURE__ */ e(
942
942
  A,
943
943
  {
944
944
  type: "target",
@@ -959,10 +959,10 @@ const Je = E(function({
959
959
  title: `Reference images (up to ${t.maxReferenceImages || 13})`
960
960
  }
961
961
  ),
962
- o && m && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: o, alt: "Preview", className: "w-full h-24 object-contain" }) }),
963
- /* @__PURE__ */ s("div", { className: "px-4 py-3", children: [
964
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-2", children: [
965
- p ? /* @__PURE__ */ s("svg", { className: "w-3 h-3 text-purple-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
962
+ i && p && /* @__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: i, alt: "Preview", className: "w-full h-24 object-contain" }) }),
963
+ /* @__PURE__ */ o("div", { className: "px-4 py-3", children: [
964
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 mb-2", children: [
965
+ m ? /* @__PURE__ */ o("svg", { className: "w-3 h-3 text-purple-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
966
966
  /* @__PURE__ */ e("path", { d: "M13 7H7v6h6V7z" }),
967
967
  /* @__PURE__ */ e(
968
968
  "path",
@@ -976,7 +976,7 @@ const Je = E(function({
976
976
  /* @__PURE__ */ e(
977
977
  "span",
978
978
  {
979
- className: `font-semibold text-sm ${p ? "text-purple-700 dark:text-purple-400" : "text-teal-700 dark:text-teal-400"}`,
979
+ className: `font-semibold text-sm ${m ? "text-purple-700 dark:text-purple-400" : "text-teal-700 dark:text-teal-400"}`,
980
980
  children: t.operation
981
981
  }
982
982
  ),
@@ -984,13 +984,13 @@ const Je = E(function({
984
984
  X,
985
985
  {
986
986
  nodeId: l,
987
- color: p ? "text-purple-500 dark:text-purple-400" : "text-teal-500 dark:text-teal-400"
987
+ color: m ? "text-purple-500 dark:text-purple-400" : "text-teal-500 dark:text-teal-400"
988
988
  }
989
989
  )
990
990
  ] }),
991
- p && /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 mb-1", children: "↑ Connect text node for dynamic prompt" }),
991
+ m && /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 mb-1", children: "↑ Connect text node for dynamic prompt" }),
992
992
  c && /* @__PURE__ */ e("div", { className: "text-[10px] text-violet-500 dark:text-violet-400 mb-1", children: "↓ Connect reference images" }),
993
- /* @__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, h]) => /* @__PURE__ */ s("div", { className: "truncate", children: [
993
+ /* @__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, h]) => /* @__PURE__ */ o("div", { className: "truncate", children: [
994
994
  u,
995
995
  ": ",
996
996
  String(h).slice(0, 20)
@@ -1000,15 +1000,15 @@ const Je = E(function({
1000
1000
  ]
1001
1001
  }
1002
1002
  );
1003
- }), Ye = E(function({ id: l, data: t, selected: n }) {
1004
- const o = k((d) => d.execution.nodeStatus[l]), m = B(o) || (n ? "border-green-500" : "border-green-200");
1005
- return /* @__PURE__ */ s(
1003
+ }), Xe = E(function({ id: l, data: t, selected: n }) {
1004
+ const i = k((d) => d.execution.nodeStatus[l]), p = B(i) || (n ? "border-green-500" : "border-green-200");
1005
+ return /* @__PURE__ */ o(
1006
1006
  "div",
1007
1007
  {
1008
- className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${m}`,
1008
+ className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${p}`,
1009
1009
  children: [
1010
1010
  /* @__PURE__ */ e(A, { type: "target", position: P.Left, className: "w-3 h-3 !bg-green-500" }),
1011
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-2", children: [
1011
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 mb-2", children: [
1012
1012
  /* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-green-500" }),
1013
1013
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-green-700 dark:text-green-400", children: "Save" })
1014
1014
  ] }),
@@ -1016,11 +1016,11 @@ const Je = E(function({
1016
1016
  ]
1017
1017
  }
1018
1018
  );
1019
- }), Xe = E(function({ id: l, data: t, selected: n }) {
1020
- const o = k((y) => y.execution.previews[l]), i = k((y) => y.execution.nodeStatus[l]), m = k((y) => y.previewVisible[l] !== !1), d = k((y) => y.updateNodeData), a = Q(null), c = B(i) || (n ? "border-amber-500" : "border-amber-200"), u = L(
1021
- async (y) => {
1019
+ }), Ze = E(function({ id: l, data: t, selected: n }) {
1020
+ const i = k((w) => w.execution.previews[l]), s = k((w) => w.execution.nodeStatus[l]), p = k((w) => w.previewVisible[l] !== !1), d = k((w) => w.updateNodeData), a = Q(null), c = B(s) || (n ? "border-amber-500" : "border-amber-200"), u = L(
1021
+ async (w) => {
1022
1022
  try {
1023
- const b = await Be(y);
1023
+ const b = await Ve(w);
1024
1024
  d(l, {
1025
1025
  uploadId: b.id,
1026
1026
  filename: b.filename,
@@ -1032,38 +1032,38 @@ const Je = E(function({
1032
1032
  },
1033
1033
  [l, d]
1034
1034
  ), h = L(
1035
- (y) => {
1036
- y.preventDefault(), y.stopPropagation();
1037
- const b = y.dataTransfer.files[0];
1035
+ (w) => {
1036
+ w.preventDefault(), w.stopPropagation();
1037
+ const b = w.dataTransfer.files[0];
1038
1038
  b && b.type.startsWith("image/") && u(b);
1039
1039
  },
1040
1040
  [u]
1041
- ), f = L((y) => {
1042
- y.preventDefault(), y.stopPropagation();
1043
- }, []), w = L(
1044
- (y) => {
1041
+ ), f = L((w) => {
1042
+ w.preventDefault(), w.stopPropagation();
1043
+ }, []), y = L(
1044
+ (w) => {
1045
1045
  var g;
1046
- const b = (g = y.target.files) == null ? void 0 : g[0];
1046
+ const b = (g = w.target.files) == null ? void 0 : g[0];
1047
1047
  b && u(b);
1048
1048
  },
1049
1049
  [u]
1050
- ), v = o || (t.uploadId ? pe(t.uploadId) : null);
1051
- return /* @__PURE__ */ s(
1050
+ ), v = i || (t.uploadId ? ue(t.uploadId) : null);
1051
+ return /* @__PURE__ */ o(
1052
1052
  "div",
1053
1053
  {
1054
1054
  className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${c}`,
1055
1055
  onDrop: h,
1056
1056
  onDragOver: f,
1057
1057
  children: [
1058
- v && m ? /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: v, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : v ? null : /* @__PURE__ */ e(
1058
+ v && p ? /* @__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: v, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : v ? null : /* @__PURE__ */ e(
1059
1059
  "div",
1060
1060
  {
1061
1061
  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",
1062
1062
  onClick: () => {
1063
- var y;
1064
- return (y = a.current) == null ? void 0 : y.click();
1063
+ var w;
1064
+ return (w = a.current) == null ? void 0 : w.click();
1065
1065
  },
1066
- children: /* @__PURE__ */ s("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
1066
+ children: /* @__PURE__ */ o("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
1067
1067
  /* @__PURE__ */ e("div", { className: "text-2xl mb-1", children: "+" }),
1068
1068
  /* @__PURE__ */ e("div", { className: "text-xs", children: "Drop image or click" })
1069
1069
  ] })
@@ -1076,11 +1076,11 @@ const Je = E(function({
1076
1076
  type: "file",
1077
1077
  accept: "image/*",
1078
1078
  className: "hidden",
1079
- onChange: w
1079
+ onChange: y
1080
1080
  }
1081
1081
  ),
1082
- /* @__PURE__ */ s("div", { className: "px-4 py-3", children: [
1083
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-2", children: [
1082
+ /* @__PURE__ */ o("div", { className: "px-4 py-3", children: [
1083
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 mb-2", children: [
1084
1084
  /* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-amber-500" }),
1085
1085
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-amber-700 dark:text-amber-400", children: "Input" }),
1086
1086
  /* @__PURE__ */ e(X, { nodeId: l, color: "text-amber-500 dark:text-amber-400" })
@@ -1091,29 +1091,29 @@ const Je = E(function({
1091
1091
  ]
1092
1092
  }
1093
1093
  );
1094
- }), Ze = E(function({
1094
+ }), et = E(function({
1095
1095
  id: l,
1096
1096
  data: t,
1097
1097
  selected: n
1098
1098
  }) {
1099
1099
  var c, u, h;
1100
- const o = k((f) => f.execution.nodeStatus[l]), i = k((f) => {
1101
- var w;
1102
- return (w = f.execution.dataOutputs) == null ? void 0 : w[l];
1103
- }), d = B(o) || (n ? "border-cyan-500" : "border-cyan-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], p = a.length > 0;
1104
- return /* @__PURE__ */ s(
1100
+ const i = k((f) => f.execution.nodeStatus[l]), s = k((f) => {
1101
+ var y;
1102
+ return (y = f.execution.dataOutputs) == null ? void 0 : y[l];
1103
+ }), d = B(i) || (n ? "border-cyan-500" : "border-cyan-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], m = a.length > 0;
1104
+ return /* @__PURE__ */ o(
1105
1105
  "div",
1106
1106
  {
1107
1107
  className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${d}`,
1108
1108
  children: [
1109
1109
  /* @__PURE__ */ e(A, { type: "target", position: P.Left, className: "w-3 h-3 !bg-cyan-500" }),
1110
- 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__ */ s("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
1111
- (u = i.content) == null ? void 0 : u.slice(0, 200),
1112
- (((h = i.content) == null ? void 0 : h.length) || 0) > 200 && "..."
1110
+ s && /* @__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__ */ o("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
1111
+ (u = s.content) == null ? void 0 : u.slice(0, 200),
1112
+ (((h = s.content) == null ? void 0 : h.length) || 0) > 200 && "..."
1113
1113
  ] }) }),
1114
- /* @__PURE__ */ s("div", { className: "px-4 py-3", children: [
1115
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-2", children: [
1116
- /* @__PURE__ */ s("svg", { className: "w-3 h-3 text-cyan-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
1114
+ /* @__PURE__ */ o("div", { className: "px-4 py-3", children: [
1115
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 mb-2", children: [
1116
+ /* @__PURE__ */ o("svg", { className: "w-3 h-3 text-cyan-500", fill: "currentColor", viewBox: "0 0 20 20", children: [
1117
1117
  /* @__PURE__ */ e("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }),
1118
1118
  /* @__PURE__ */ e(
1119
1119
  "path",
@@ -1126,13 +1126,13 @@ const Je = E(function({
1126
1126
  ] }),
1127
1127
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-cyan-700 dark:text-cyan-400", children: t.providerLabel || t.providerName })
1128
1128
  ] }),
1129
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ s("div", { className: "truncate", children: [
1129
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ o("div", { className: "truncate", children: [
1130
1130
  String(t.params.prompt).slice(0, 30),
1131
1131
  "..."
1132
1132
  ] }) : null }),
1133
- p && /* @__PURE__ */ s("div", { className: "mt-2 pt-2 border-t border-cyan-200 dark:border-cyan-800", children: [
1133
+ m && /* @__PURE__ */ o("div", { className: "mt-2 pt-2 border-t border-cyan-200 dark:border-cyan-800", children: [
1134
1134
  /* @__PURE__ */ e("div", { className: "text-[10px] text-cyan-500 dark:text-cyan-400 font-medium mb-1", children: "Outputs:" }),
1135
- a.map(([f]) => /* @__PURE__ */ s(
1135
+ a.map(([f]) => /* @__PURE__ */ o(
1136
1136
  "div",
1137
1137
  {
1138
1138
  className: "text-[10px] text-gray-500 dark:text-zinc-400 flex items-center gap-1",
@@ -1145,7 +1145,7 @@ const Je = E(function({
1145
1145
  ))
1146
1146
  ] })
1147
1147
  ] }),
1148
- p ? /* @__PURE__ */ s(U, { children: [
1148
+ m ? /* @__PURE__ */ o(U, { children: [
1149
1149
  /* @__PURE__ */ e(
1150
1150
  A,
1151
1151
  {
@@ -1157,7 +1157,7 @@ const Je = E(function({
1157
1157
  title: "Full JSON output"
1158
1158
  }
1159
1159
  ),
1160
- a.map(([f, w], v) => /* @__PURE__ */ e(
1160
+ a.map(([f, y], v) => /* @__PURE__ */ e(
1161
1161
  A,
1162
1162
  {
1163
1163
  type: "source",
@@ -1167,7 +1167,7 @@ const Je = E(function({
1167
1167
  style: {
1168
1168
  top: `${70 + v * 14}%`
1169
1169
  },
1170
- title: `${f}: ${w.description || w.type}`
1170
+ title: `${f}: ${y.description || y.type}`
1171
1171
  },
1172
1172
  f
1173
1173
  ))
@@ -1175,24 +1175,24 @@ const Je = E(function({
1175
1175
  ]
1176
1176
  }
1177
1177
  );
1178
- }), et = E(function({ id: l, data: t, selected: n }) {
1178
+ }), tt = E(function({ id: l, data: t, selected: n }) {
1179
1179
  var c, u, h;
1180
- const o = k((f) => f.execution.nodeStatus[l]), i = k((f) => {
1181
- var w;
1182
- return (w = f.execution.dataOutputs) == null ? void 0 : w[l];
1183
- }), d = B(o) || (n ? "border-pink-500" : "border-pink-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], p = a.length > 0;
1184
- return /* @__PURE__ */ s(
1180
+ const i = k((f) => f.execution.nodeStatus[l]), s = k((f) => {
1181
+ var y;
1182
+ return (y = f.execution.dataOutputs) == null ? void 0 : y[l];
1183
+ }), d = B(i) || (n ? "border-pink-500" : "border-pink-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], m = a.length > 0;
1184
+ return /* @__PURE__ */ o(
1185
1185
  "div",
1186
1186
  {
1187
1187
  className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${d}`,
1188
1188
  children: [
1189
1189
  /* @__PURE__ */ e(A, { type: "target", position: P.Left, className: "w-3 h-3 !bg-pink-500" }),
1190
- 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__ */ s("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
1191
- (u = i.content) == null ? void 0 : u.slice(0, 200),
1192
- (((h = i.content) == null ? void 0 : h.length) || 0) > 200 && "..."
1190
+ s && /* @__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__ */ o("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
1191
+ (u = s.content) == null ? void 0 : u.slice(0, 200),
1192
+ (((h = s.content) == null ? void 0 : h.length) || 0) > 200 && "..."
1193
1193
  ] }) }),
1194
- /* @__PURE__ */ s("div", { className: "px-4 py-3", children: [
1195
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-2", children: [
1194
+ /* @__PURE__ */ o("div", { className: "px-4 py-3", children: [
1195
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2 mb-2", children: [
1196
1196
  /* @__PURE__ */ e("svg", { className: "w-3 h-3 text-pink-500", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
1197
1197
  "path",
1198
1198
  {
@@ -1203,13 +1203,13 @@ const Je = E(function({
1203
1203
  ) }),
1204
1204
  /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-pink-700 dark:text-pink-400", children: t.providerLabel || t.providerName })
1205
1205
  ] }),
1206
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ s("div", { className: "truncate", children: [
1206
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: t.params.prompt ? /* @__PURE__ */ o("div", { className: "truncate", children: [
1207
1207
  String(t.params.prompt).slice(0, 30),
1208
1208
  "..."
1209
1209
  ] }) : null }),
1210
- p && /* @__PURE__ */ s("div", { className: "mt-2 pt-2 border-t border-pink-200 dark:border-pink-800", children: [
1210
+ m && /* @__PURE__ */ o("div", { className: "mt-2 pt-2 border-t border-pink-200 dark:border-pink-800", children: [
1211
1211
  /* @__PURE__ */ e("div", { className: "text-[10px] text-pink-500 dark:text-pink-400 font-medium mb-1", children: "Outputs:" }),
1212
- a.map(([f]) => /* @__PURE__ */ s(
1212
+ a.map(([f]) => /* @__PURE__ */ o(
1213
1213
  "div",
1214
1214
  {
1215
1215
  className: "text-[10px] text-gray-500 dark:text-zinc-400 flex items-center gap-1",
@@ -1222,7 +1222,7 @@ const Je = E(function({
1222
1222
  ))
1223
1223
  ] })
1224
1224
  ] }),
1225
- p ? /* @__PURE__ */ s(U, { children: [
1225
+ m ? /* @__PURE__ */ o(U, { children: [
1226
1226
  /* @__PURE__ */ e(
1227
1227
  A,
1228
1228
  {
@@ -1234,7 +1234,7 @@ const Je = E(function({
1234
1234
  title: "Full JSON output"
1235
1235
  }
1236
1236
  ),
1237
- a.map(([f, w], v) => /* @__PURE__ */ e(
1237
+ a.map(([f, y], v) => /* @__PURE__ */ e(
1238
1238
  A,
1239
1239
  {
1240
1240
  type: "source",
@@ -1244,7 +1244,7 @@ const Je = E(function({
1244
1244
  style: {
1245
1245
  top: `${70 + v * 14}%`
1246
1246
  },
1247
- title: `${f}: ${w.description || w.type}`
1247
+ title: `${f}: ${y.description || y.type}`
1248
1248
  },
1249
1249
  f
1250
1250
  ))
@@ -1252,18 +1252,18 @@ const Je = E(function({
1252
1252
  ]
1253
1253
  }
1254
1254
  );
1255
- }), tt = {
1256
- generator: Je,
1257
- transform: Qe,
1258
- save: Ye,
1259
- input: Xe,
1260
- vision: Ze,
1261
- text: et
1262
- }, rt = {
1255
+ }), rt = {
1256
+ generator: Qe,
1257
+ transform: Ye,
1258
+ save: Xe,
1259
+ input: Ze,
1260
+ vision: et,
1261
+ text: tt
1262
+ }, at = {
1263
1263
  type: "smoothstep",
1264
1264
  animated: !1,
1265
1265
  markerEnd: {
1266
- type: Ce.ArrowClosed,
1266
+ type: Ie.ArrowClosed,
1267
1267
  color: "#64748b",
1268
1268
  width: 20,
1269
1269
  height: 20
@@ -1273,53 +1273,53 @@ const Je = E(function({
1273
1273
  strokeWidth: 2
1274
1274
  }
1275
1275
  };
1276
- function at() {
1277
- const r = k((h) => h.nodes), l = k((h) => h.edges), t = k((h) => h.setNodes), n = k((h) => h.setEdges), o = k((h) => h.addEdge), i = k((h) => h.setSelectedNode), m = L(
1276
+ function nt() {
1277
+ const r = k((h) => h.nodes), l = k((h) => h.edges), t = k((h) => h.setNodes), n = k((h) => h.setEdges), i = k((h) => h.addEdge), s = k((h) => h.setSelectedNode), p = L(
1278
1278
  (h) => {
1279
- const { source: f, target: w } = h;
1280
- if (!f || !w) return !1;
1281
- const v = r.find((g) => g.id === f), y = r.find((g) => g.id === w);
1282
- return !(!v || !y || v.type === "save" || y.type === "generator" || y.type === "input" || l.find(
1283
- (g) => g.target === w && g.targetHandle === h.targetHandle
1284
- ) || f === w);
1279
+ const { source: f, target: y } = h;
1280
+ if (!f || !y) return !1;
1281
+ const v = r.find((g) => g.id === f), w = r.find((g) => g.id === y);
1282
+ return !(!v || !w || v.type === "save" || w.type === "generator" || w.type === "input" || l.find(
1283
+ (g) => g.target === y && g.targetHandle === h.targetHandle
1284
+ ) || f === y);
1285
1285
  },
1286
1286
  [r, l]
1287
1287
  ), d = L(
1288
1288
  (h) => {
1289
- t(Ne(h, r));
1289
+ t(ze(h, r));
1290
1290
  },
1291
1291
  [r, t]
1292
1292
  ), a = L(
1293
1293
  (h) => {
1294
- n(ze(h, l));
1294
+ n(Ce(h, l));
1295
1295
  },
1296
1296
  [l, n]
1297
- ), p = L(
1297
+ ), m = L(
1298
1298
  (h) => {
1299
- o(h);
1299
+ i(h);
1300
1300
  },
1301
- [o]
1301
+ [i]
1302
1302
  ), c = L(
1303
1303
  (h, f) => {
1304
- i(f.id);
1304
+ s(f.id);
1305
1305
  },
1306
- [i]
1306
+ [s]
1307
1307
  ), u = L(() => {
1308
- i(null);
1309
- }, [i]);
1310
- return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ s(
1311
- we,
1308
+ s(null);
1309
+ }, [s]);
1310
+ return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ o(
1311
+ Ne,
1312
1312
  {
1313
1313
  nodes: r,
1314
1314
  edges: l,
1315
1315
  onNodesChange: d,
1316
1316
  onEdgesChange: a,
1317
- onConnect: p,
1317
+ onConnect: m,
1318
1318
  onNodeClick: c,
1319
1319
  onPaneClick: u,
1320
- nodeTypes: tt,
1321
- defaultEdgeOptions: rt,
1322
- isValidConnection: m,
1320
+ nodeTypes: rt,
1321
+ defaultEdgeOptions: at,
1322
+ isValidConnection: p,
1323
1323
  nodesDraggable: !0,
1324
1324
  nodesConnectable: !0,
1325
1325
  elementsSelectable: !0,
@@ -1328,23 +1328,23 @@ function at() {
1328
1328
  snapToGrid: !0,
1329
1329
  snapGrid: [15, 15],
1330
1330
  children: [
1331
- /* @__PURE__ */ e(Ie, {}),
1332
1331
  /* @__PURE__ */ e(Se, {}),
1333
- /* @__PURE__ */ e(Le, { nodeStrokeWidth: 3, zoomable: !0, pannable: !0 })
1332
+ /* @__PURE__ */ e(Le, {}),
1333
+ /* @__PURE__ */ e(We, { nodeStrokeWidth: 3, zoomable: !0, pannable: !0 })
1334
1334
  ]
1335
1335
  }
1336
1336
  ) });
1337
1337
  }
1338
- function nt({ onSelect: r }) {
1339
- const [l, t] = I([]), [n, o] = I(!0), [i, m] = I(null), d = async () => {
1338
+ function ot({ onSelect: r }) {
1339
+ const [l, t] = I([]), [n, i] = I(!0), [s, p] = I(null), d = async () => {
1340
1340
  try {
1341
- o(!0);
1342
- const c = await Ve();
1343
- t(c), m(null);
1341
+ i(!0);
1342
+ const c = await Ge();
1343
+ t(c), p(null);
1344
1344
  } catch (c) {
1345
- m(c instanceof Error ? c.message : "Failed to load uploads");
1345
+ p(c instanceof Error ? c.message : "Failed to load uploads");
1346
1346
  } finally {
1347
- o(!1);
1347
+ i(!1);
1348
1348
  }
1349
1349
  };
1350
1350
  D(() => {
@@ -1353,13 +1353,13 @@ function nt({ onSelect: r }) {
1353
1353
  const a = async (c, u) => {
1354
1354
  if (u.stopPropagation(), !!confirm("Delete this upload?"))
1355
1355
  try {
1356
- await Ge(c), t((h) => h.filter((f) => f.id !== c));
1356
+ await Fe(c), t((h) => h.filter((f) => f.id !== c));
1357
1357
  } catch (h) {
1358
1358
  console.error("Failed to delete:", h);
1359
1359
  }
1360
- }, p = (c) => c < 1024 ? `${c} B` : c < 1024 * 1024 ? `${(c / 1024).toFixed(1)} KB` : `${(c / (1024 * 1024)).toFixed(1)} MB`;
1361
- return n ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "Loading uploads..." }) : i ? /* @__PURE__ */ s("div", { className: "p-4 text-center text-red-500 dark:text-red-400", children: [
1362
- i,
1360
+ }, m = (c) => c < 1024 ? `${c} B` : c < 1024 * 1024 ? `${(c / 1024).toFixed(1)} KB` : `${(c / (1024 * 1024)).toFixed(1)} MB`;
1361
+ return n ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-gray-500 dark:text-zinc-400", children: "Loading uploads..." }) : s ? /* @__PURE__ */ o("div", { className: "p-4 text-center text-red-500 dark:text-red-400", children: [
1362
+ s,
1363
1363
  /* @__PURE__ */ e(
1364
1364
  "button",
1365
1365
  {
@@ -1368,7 +1368,7 @@ function nt({ onSelect: r }) {
1368
1368
  children: "Retry"
1369
1369
  }
1370
1370
  )
1371
- ] }) : l.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: l.map((c) => /* @__PURE__ */ s(
1371
+ ] }) : l.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: l.map((c) => /* @__PURE__ */ o(
1372
1372
  "div",
1373
1373
  {
1374
1374
  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",
@@ -1377,7 +1377,7 @@ function nt({ onSelect: r }) {
1377
1377
  /* @__PURE__ */ e(
1378
1378
  "img",
1379
1379
  {
1380
- src: pe(c.id),
1380
+ src: ue(c.id),
1381
1381
  alt: c.filename,
1382
1382
  className: "w-full h-20 object-cover"
1383
1383
  }
@@ -1391,25 +1391,25 @@ function nt({ onSelect: r }) {
1391
1391
  }
1392
1392
  ) }),
1393
1393
  /* @__PURE__ */ e("div", { className: "p-1 text-xs truncate bg-white dark:bg-zinc-800 text-gray-800 dark:text-zinc-200", children: c.filename }),
1394
- /* @__PURE__ */ e("div", { className: "px-1 pb-1 text-xs text-gray-400 dark:text-zinc-500 bg-white dark:bg-zinc-800", children: p(c.size) })
1394
+ /* @__PURE__ */ e("div", { className: "px-1 pb-1 text-xs text-gray-400 dark:text-zinc-500 bg-white dark:bg-zinc-800", children: m(c.size) })
1395
1395
  ]
1396
1396
  },
1397
1397
  c.id
1398
1398
  )) }) });
1399
1399
  }
1400
- function ot() {
1401
- const r = k((x) => x.setGenerators), l = k((x) => x.setTransforms), t = k((x) => x.setTextProviders), n = k((x) => x.setVisionProviders), o = k((x) => x.generators), i = k((x) => x.transforms), m = k((x) => x.textProviders), d = k((x) => x.visionProviders), a = k((x) => x.addNode), [p, c] = I(!1), { data: u } = F({
1400
+ function st() {
1401
+ const r = k((x) => x.setGenerators), l = k((x) => x.setTransforms), t = k((x) => x.setTextProviders), n = k((x) => x.setVisionProviders), i = k((x) => x.generators), s = k((x) => x.transforms), p = k((x) => x.textProviders), d = k((x) => x.visionProviders), a = k((x) => x.addNode), [m, c] = I(!1), { data: u } = F({
1402
1402
  queryKey: ["generators"],
1403
- queryFn: Me
1403
+ queryFn: je
1404
1404
  }), { data: h } = F({
1405
1405
  queryKey: ["transforms"],
1406
- queryFn: je
1406
+ queryFn: De
1407
1407
  }), { data: f } = F({
1408
1408
  queryKey: ["textProviders"],
1409
- queryFn: De
1410
- }), { data: w } = F({
1411
- queryKey: ["visionProviders"],
1412
1409
  queryFn: Te
1410
+ }), { data: y } = F({
1411
+ queryKey: ["visionProviders"],
1412
+ queryFn: Ue
1413
1413
  });
1414
1414
  D(() => {
1415
1415
  u && r(u);
@@ -1418,11 +1418,11 @@ function ot() {
1418
1418
  }, [h, l]), D(() => {
1419
1419
  f && t(f);
1420
1420
  }, [f, t]), D(() => {
1421
- w && n(w);
1422
- }, [w, n]);
1421
+ y && n(y);
1422
+ }, [y, n]);
1423
1423
  const v = (x, C) => {
1424
1424
  x.dataTransfer.setData("application/json", JSON.stringify(C)), x.dataTransfer.effectAllowed = "move";
1425
- }, y = (x) => {
1425
+ }, w = (x) => {
1426
1426
  a(x, { x: 250, y: 150 + Math.random() * 100 });
1427
1427
  }, b = {
1428
1428
  id: "input:upload",
@@ -1456,42 +1456,42 @@ function ot() {
1456
1456
  }
1457
1457
  }
1458
1458
  }
1459
- }, N = o.reduce(
1459
+ }, z = i.reduce(
1460
1460
  (x, C) => {
1461
1461
  const S = C.category || "Other";
1462
1462
  return x[S] || (x[S] = []), x[S].push(C), x;
1463
1463
  },
1464
1464
  {}
1465
- ), W = i.reduce(
1465
+ ), W = s.reduce(
1466
1466
  (x, C) => {
1467
1467
  const S = C.category || "Other";
1468
1468
  return x[S] || (x[S] = []), x[S].push(C), x;
1469
1469
  },
1470
1470
  {}
1471
1471
  );
1472
- return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ s("div", { className: "p-4", children: [
1472
+ return /* @__PURE__ */ e("div", { className: "w-64 bg-gray-50 dark:bg-zinc-800 border-r border-gray-200 dark:border-zinc-700 overflow-y-auto", children: /* @__PURE__ */ o("div", { className: "p-4", children: [
1473
1473
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white mb-4", children: "Nodes" }),
1474
- /* @__PURE__ */ s("div", { className: "mb-6", children: [
1475
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-2", children: [
1474
+ /* @__PURE__ */ o("div", { className: "mb-6", children: [
1475
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-2", children: [
1476
1476
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-amber-600 dark:text-amber-400 uppercase tracking-wide", children: "Input" }),
1477
- /* @__PURE__ */ s(
1477
+ /* @__PURE__ */ o(
1478
1478
  "button",
1479
1479
  {
1480
- onClick: () => c(!p),
1480
+ onClick: () => c(!m),
1481
1481
  className: "text-xs text-amber-600 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-300",
1482
1482
  children: [
1483
- p ? "Hide" : "Browse",
1483
+ m ? "Hide" : "Browse",
1484
1484
  " Uploads"
1485
1485
  ]
1486
1486
  }
1487
1487
  )
1488
1488
  ] }),
1489
- /* @__PURE__ */ s(
1489
+ /* @__PURE__ */ o(
1490
1490
  "div",
1491
1491
  {
1492
1492
  draggable: !0,
1493
1493
  onDragStart: (x) => v(x, b),
1494
- onDoubleClick: () => y(b),
1494
+ onDoubleClick: () => w(b),
1495
1495
  className: "px-3 py-2 bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-700 rounded cursor-grab active:cursor-grabbing hover:bg-amber-100 dark:hover:bg-amber-900/50 transition-colors",
1496
1496
  children: [
1497
1497
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-amber-700 dark:text-amber-300", children: "Upload Image" }),
@@ -1499,18 +1499,18 @@ function ot() {
1499
1499
  ]
1500
1500
  }
1501
1501
  ),
1502
- p && /* @__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(nt, {}) })
1502
+ m && /* @__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(ot, {}) })
1503
1503
  ] }),
1504
- /* @__PURE__ */ s("div", { className: "mb-6", children: [
1504
+ /* @__PURE__ */ o("div", { className: "mb-6", children: [
1505
1505
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide mb-2", children: "Generators" }),
1506
- Object.entries(N).map(([x, C]) => /* @__PURE__ */ s("div", { className: "mb-3", children: [
1506
+ Object.entries(z).map(([x, C]) => /* @__PURE__ */ o("div", { className: "mb-3", children: [
1507
1507
  /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: x }),
1508
- C.map((S) => /* @__PURE__ */ s(
1508
+ C.map((S) => /* @__PURE__ */ o(
1509
1509
  "div",
1510
1510
  {
1511
1511
  draggable: !0,
1512
1512
  onDragStart: (T) => v(T, S),
1513
- onDoubleClick: () => y(S),
1513
+ onDoubleClick: () => w(S),
1514
1514
  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",
1515
1515
  children: [
1516
1516
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children: S.label }),
@@ -1521,16 +1521,16 @@ function ot() {
1521
1521
  ))
1522
1522
  ] }, x))
1523
1523
  ] }),
1524
- /* @__PURE__ */ s("div", { className: "mb-6", children: [
1524
+ /* @__PURE__ */ o("div", { className: "mb-6", children: [
1525
1525
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-teal-600 dark:text-teal-400 uppercase tracking-wide mb-2", children: "Transforms" }),
1526
- Object.entries(W).map(([x, C]) => /* @__PURE__ */ s("div", { className: "mb-3", children: [
1526
+ Object.entries(W).map(([x, C]) => /* @__PURE__ */ o("div", { className: "mb-3", children: [
1527
1527
  /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: x }),
1528
- C.map((S) => /* @__PURE__ */ s(
1528
+ C.map((S) => /* @__PURE__ */ o(
1529
1529
  "div",
1530
1530
  {
1531
1531
  draggable: !0,
1532
1532
  onDragStart: (T) => v(T, S),
1533
- onDoubleClick: () => y(S),
1533
+ onDoubleClick: () => w(S),
1534
1534
  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",
1535
1535
  children: [
1536
1536
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children: S.label }),
@@ -1541,14 +1541,14 @@ function ot() {
1541
1541
  ))
1542
1542
  ] }, x))
1543
1543
  ] }),
1544
- m.length > 0 && /* @__PURE__ */ s("div", { className: "mb-6", children: [
1544
+ p.length > 0 && /* @__PURE__ */ o("div", { className: "mb-6", children: [
1545
1545
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-pink-600 dark:text-pink-400 uppercase tracking-wide mb-2", children: "AI Text" }),
1546
- m.map((x) => /* @__PURE__ */ s(
1546
+ p.map((x) => /* @__PURE__ */ o(
1547
1547
  "div",
1548
1548
  {
1549
1549
  draggable: !0,
1550
1550
  onDragStart: (C) => v(C, x),
1551
- onDoubleClick: () => y(x),
1551
+ onDoubleClick: () => w(x),
1552
1552
  className: "px-3 py-2 bg-pink-50 dark:bg-pink-900/30 border border-pink-200 dark:border-pink-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-pink-100 dark:hover:bg-pink-900/50 transition-colors",
1553
1553
  children: [
1554
1554
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-pink-700 dark:text-pink-300", children: x.label }),
@@ -1558,14 +1558,14 @@ function ot() {
1558
1558
  x.id
1559
1559
  ))
1560
1560
  ] }),
1561
- d.length > 0 && /* @__PURE__ */ s("div", { className: "mb-6", children: [
1561
+ d.length > 0 && /* @__PURE__ */ o("div", { className: "mb-6", children: [
1562
1562
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-cyan-600 dark:text-cyan-400 uppercase tracking-wide mb-2", children: "AI Vision" }),
1563
- d.map((x) => /* @__PURE__ */ s(
1563
+ d.map((x) => /* @__PURE__ */ o(
1564
1564
  "div",
1565
1565
  {
1566
1566
  draggable: !0,
1567
1567
  onDragStart: (C) => v(C, x),
1568
- onDoubleClick: () => y(x),
1568
+ onDoubleClick: () => w(x),
1569
1569
  className: "px-3 py-2 bg-cyan-50 dark:bg-cyan-900/30 border border-cyan-200 dark:border-cyan-700 rounded mb-1 cursor-grab active:cursor-grabbing hover:bg-cyan-100 dark:hover:bg-cyan-900/50 transition-colors",
1570
1570
  children: [
1571
1571
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-cyan-700 dark:text-cyan-300", children: x.label }),
@@ -1575,14 +1575,14 @@ function ot() {
1575
1575
  x.id
1576
1576
  ))
1577
1577
  ] }),
1578
- /* @__PURE__ */ s("div", { className: "mb-6", children: [
1578
+ /* @__PURE__ */ o("div", { className: "mb-6", children: [
1579
1579
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-green-600 dark:text-green-400 uppercase tracking-wide mb-2", children: "Output" }),
1580
- /* @__PURE__ */ s(
1580
+ /* @__PURE__ */ o(
1581
1581
  "div",
1582
1582
  {
1583
1583
  draggable: !0,
1584
1584
  onDragStart: (x) => v(x, g),
1585
- onDoubleClick: () => y(g),
1585
+ onDoubleClick: () => w(g),
1586
1586
  className: "px-3 py-2 bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-700 rounded cursor-grab active:cursor-grabbing hover:bg-green-100 dark:hover:bg-green-900/50 transition-colors",
1587
1587
  children: [
1588
1588
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-green-700 dark:text-green-300", children: "Save" }),
@@ -1593,21 +1593,21 @@ function ot() {
1593
1593
  ] })
1594
1594
  ] }) });
1595
1595
  }
1596
- function st() {
1597
- var f, w, v, y;
1598
- const r = k((b) => b.selectedNodeId), l = k((b) => b.nodes), t = k((b) => b.generators), n = k((b) => b.transforms), o = k((b) => b.textProviders), i = k((b) => b.visionProviders), m = k((b) => b.updateNodeData), d = k((b) => b.deleteNode), a = l.find((b) => b.id === r);
1596
+ function it() {
1597
+ var f, y, v, w;
1598
+ const r = k((b) => b.selectedNodeId), l = k((b) => b.nodes), t = k((b) => b.generators), n = k((b) => b.transforms), i = k((b) => b.textProviders), s = k((b) => b.visionProviders), p = k((b) => b.updateNodeData), d = k((b) => b.deleteNode), a = l.find((b) => b.id === r);
1599
1599
  if (!a)
1600
1600
  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" }) });
1601
- let p, c = "";
1601
+ let m, c = "";
1602
1602
  if (a.type === "generator") {
1603
- const b = a.data, g = t.find((N) => N.name === b.generatorName);
1604
- p = (f = g == null ? void 0 : g.params) == null ? void 0 : f.properties, c = (g == null ? void 0 : g.label) || b.generatorName;
1603
+ const b = a.data, g = t.find((z) => z.name === b.generatorName);
1604
+ m = (f = g == null ? void 0 : g.params) == null ? void 0 : f.properties, c = (g == null ? void 0 : g.label) || b.generatorName;
1605
1605
  } else if (a.type === "transform") {
1606
- const b = a.data, g = n.find((N) => N.name === b.operation);
1607
- p = (w = g == null ? void 0 : g.params) == null ? void 0 : w.properties, c = (g == null ? void 0 : g.label) || b.operation;
1606
+ const b = a.data, g = n.find((z) => z.name === b.operation);
1607
+ m = (y = g == null ? void 0 : g.params) == null ? void 0 : y.properties, c = (g == null ? void 0 : g.label) || b.operation;
1608
1608
  } else if (a.type === "save") {
1609
1609
  const g = a.data.provider === "floimg-cloud";
1610
- c = g ? "Save to FloImg Cloud" : "Save", p = {
1610
+ c = g ? "Save to FloImg Cloud" : "Save", m = {
1611
1611
  destination: {
1612
1612
  type: "string",
1613
1613
  title: g ? "Filename" : "Destination",
@@ -1615,34 +1615,34 @@ function st() {
1615
1615
  }
1616
1616
  };
1617
1617
  } else if (a.type === "text") {
1618
- const b = a.data, g = o.find((N) => N.name === b.providerName);
1619
- p = (v = g == null ? void 0 : g.params) == null ? void 0 : v.properties, c = (g == null ? void 0 : g.label) || b.providerName;
1618
+ const b = a.data, g = i.find((z) => z.name === b.providerName);
1619
+ m = (v = g == null ? void 0 : g.params) == null ? void 0 : v.properties, c = (g == null ? void 0 : g.label) || b.providerName;
1620
1620
  } else if (a.type === "vision") {
1621
- const b = a.data, g = i.find((N) => N.name === b.providerName);
1622
- p = (y = g == null ? void 0 : g.params) == null ? void 0 : y.properties, c = (g == null ? void 0 : g.label) || b.providerName;
1621
+ const b = a.data, g = s.find((z) => z.name === b.providerName);
1622
+ m = (w = g == null ? void 0 : g.params) == null ? void 0 : w.properties, c = (g == null ? void 0 : g.label) || b.providerName;
1623
1623
  }
1624
1624
  const u = (b, g) => {
1625
1625
  if (a.type === "generator") {
1626
- const N = a.data;
1627
- m(a.id, {
1628
- params: { ...N.params, [b]: g }
1626
+ const z = a.data;
1627
+ p(a.id, {
1628
+ params: { ...z.params, [b]: g }
1629
1629
  });
1630
1630
  } else if (a.type === "transform") {
1631
- const N = a.data;
1632
- m(a.id, {
1633
- params: { ...N.params, [b]: g }
1631
+ const z = a.data;
1632
+ p(a.id, {
1633
+ params: { ...z.params, [b]: g }
1634
1634
  });
1635
1635
  } else if (a.type === "save")
1636
- m(a.id, { [b]: g });
1636
+ p(a.id, { [b]: g });
1637
1637
  else if (a.type === "text") {
1638
- const N = a.data;
1639
- m(a.id, {
1640
- params: { ...N.params, [b]: g }
1638
+ const z = a.data;
1639
+ p(a.id, {
1640
+ params: { ...z.params, [b]: g }
1641
1641
  });
1642
1642
  } else if (a.type === "vision") {
1643
- const N = a.data;
1644
- m(a.id, {
1645
- params: { ...N.params, [b]: g }
1643
+ const z = a.data;
1644
+ p(a.id, {
1645
+ params: { ...z.params, [b]: g }
1646
1646
  });
1647
1647
  }
1648
1648
  }, h = (b) => {
@@ -1657,8 +1657,8 @@ function st() {
1657
1657
  if (a.type === "vision")
1658
1658
  return a.data.params[b];
1659
1659
  };
1660
- 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__ */ s("div", { className: "p-4", children: [
1661
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-4", children: [
1660
+ 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__ */ o("div", { className: "p-4", children: [
1661
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4", children: [
1662
1662
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: c }),
1663
1663
  /* @__PURE__ */ e(
1664
1664
  "button",
@@ -1669,77 +1669,77 @@ function st() {
1669
1669
  }
1670
1670
  )
1671
1671
  ] }),
1672
- /* @__PURE__ */ e("div", { className: "space-y-4", children: p && Object.entries(p).map(([b, g]) => /* @__PURE__ */ e(
1673
- it,
1672
+ /* @__PURE__ */ e("div", { className: "space-y-4", children: m && Object.entries(m).map(([b, g]) => /* @__PURE__ */ e(
1673
+ lt,
1674
1674
  {
1675
1675
  name: b,
1676
1676
  field: g,
1677
1677
  value: h(b),
1678
- onChange: (N) => u(b, N)
1678
+ onChange: (z) => u(b, z)
1679
1679
  },
1680
1680
  b
1681
1681
  )) }),
1682
1682
  (a.type === "text" || a.type === "vision") && /* @__PURE__ */ e(
1683
- lt,
1683
+ dt,
1684
1684
  {
1685
1685
  nodeId: a.id,
1686
1686
  outputSchema: a.data.outputSchema,
1687
- updateNodeData: m
1687
+ updateNodeData: p
1688
1688
  }
1689
1689
  )
1690
1690
  ] }) });
1691
1691
  }
1692
- function it({ name: r, field: l, value: t, onChange: n }) {
1693
- const o = l.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";
1694
- return l.enum ? /* @__PURE__ */ s("div", { children: [
1695
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: o }),
1696
- /* @__PURE__ */ s(
1692
+ function lt({ name: r, field: l, value: t, onChange: n }) {
1693
+ const i = l.title || r, s = "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";
1694
+ return l.enum ? /* @__PURE__ */ o("div", { children: [
1695
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
1696
+ /* @__PURE__ */ o(
1697
1697
  "select",
1698
1698
  {
1699
1699
  value: String(t || ""),
1700
- onChange: (m) => n(m.target.value),
1701
- className: i,
1700
+ onChange: (p) => n(p.target.value),
1701
+ className: s,
1702
1702
  children: [
1703
1703
  /* @__PURE__ */ e("option", { value: "", children: "Select..." }),
1704
- l.enum.map((m) => /* @__PURE__ */ e("option", { value: m, children: m }, m))
1704
+ l.enum.map((p) => /* @__PURE__ */ e("option", { value: p, children: p }, p))
1705
1705
  ]
1706
1706
  }
1707
1707
  ),
1708
1708
  l.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: l.description })
1709
- ] }) : l.type === "number" ? /* @__PURE__ */ s("div", { children: [
1710
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: o }),
1709
+ ] }) : l.type === "number" ? /* @__PURE__ */ o("div", { children: [
1710
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
1711
1711
  /* @__PURE__ */ e(
1712
1712
  "input",
1713
1713
  {
1714
1714
  type: "number",
1715
1715
  value: t !== void 0 ? Number(t) : "",
1716
- onChange: (m) => n(Number(m.target.value)),
1716
+ onChange: (p) => n(Number(p.target.value)),
1717
1717
  min: l.minimum,
1718
1718
  max: l.maximum,
1719
- className: i
1719
+ className: s
1720
1720
  }
1721
1721
  ),
1722
1722
  l.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: l.description })
1723
- ] }) : l.type === "boolean" ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
1723
+ ] }) : l.type === "boolean" ? /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
1724
1724
  /* @__PURE__ */ e(
1725
1725
  "input",
1726
1726
  {
1727
1727
  type: "checkbox",
1728
1728
  checked: !!t,
1729
- onChange: (m) => n(m.target.checked),
1729
+ onChange: (p) => n(p.target.checked),
1730
1730
  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"
1731
1731
  }
1732
1732
  ),
1733
- /* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: o })
1734
- ] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ s("div", { children: [
1735
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: o }),
1736
- /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
1733
+ /* @__PURE__ */ e("label", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: i })
1734
+ ] }) : r.toLowerCase().includes("color") && typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ o("div", { children: [
1735
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
1736
+ /* @__PURE__ */ o("div", { className: "flex gap-2", children: [
1737
1737
  /* @__PURE__ */ e(
1738
1738
  "input",
1739
1739
  {
1740
1740
  type: "color",
1741
1741
  value: String(t || "#000000"),
1742
- onChange: (m) => n(m.target.value),
1742
+ onChange: (p) => n(p.target.value),
1743
1743
  className: "h-10 w-14 p-1 border border-gray-300 dark:border-zinc-600 rounded"
1744
1744
  }
1745
1745
  ),
@@ -1748,73 +1748,73 @@ function it({ name: r, field: l, value: t, onChange: n }) {
1748
1748
  {
1749
1749
  type: "text",
1750
1750
  value: String(t || ""),
1751
- onChange: (m) => n(m.target.value),
1752
- className: i + " flex-1"
1751
+ onChange: (p) => n(p.target.value),
1752
+ className: s + " flex-1"
1753
1753
  }
1754
1754
  )
1755
1755
  ] })
1756
- ] }) : l.type === "object" ? /* @__PURE__ */ s("div", { children: [
1757
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: o }),
1756
+ ] }) : l.type === "object" ? /* @__PURE__ */ o("div", { children: [
1757
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
1758
1758
  /* @__PURE__ */ e(
1759
1759
  "textarea",
1760
1760
  {
1761
1761
  value: t ? JSON.stringify(t, null, 2) : "{}",
1762
- onChange: (m) => {
1762
+ onChange: (p) => {
1763
1763
  try {
1764
- n(JSON.parse(m.target.value));
1764
+ n(JSON.parse(p.target.value));
1765
1765
  } catch {
1766
1766
  }
1767
1767
  },
1768
1768
  rows: 4,
1769
- className: i + " font-mono text-xs"
1769
+ className: s + " font-mono text-xs"
1770
1770
  }
1771
1771
  ),
1772
1772
  l.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: l.description })
1773
- ] }) : /* @__PURE__ */ s("div", { children: [
1774
- /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: o }),
1773
+ ] }) : /* @__PURE__ */ o("div", { children: [
1774
+ /* @__PURE__ */ e("label", { className: "block text-sm font-medium text-gray-700 dark:text-zinc-300 mb-1", children: i }),
1775
1775
  r === "prompt" || r === "code" || r === "text" ? /* @__PURE__ */ e(
1776
1776
  "textarea",
1777
1777
  {
1778
1778
  value: String(t || ""),
1779
- onChange: (m) => n(m.target.value),
1779
+ onChange: (p) => n(p.target.value),
1780
1780
  rows: 3,
1781
- className: i
1781
+ className: s
1782
1782
  }
1783
1783
  ) : /* @__PURE__ */ e(
1784
1784
  "input",
1785
1785
  {
1786
1786
  type: "text",
1787
1787
  value: String(t || ""),
1788
- onChange: (m) => n(m.target.value),
1789
- className: i
1788
+ onChange: (p) => n(p.target.value),
1789
+ className: s
1790
1790
  }
1791
1791
  ),
1792
1792
  l.description && /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-gray-500 dark:text-zinc-400", children: l.description })
1793
1793
  ] });
1794
1794
  }
1795
- function lt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
1796
- const [n, o] = I(""), i = (l == null ? void 0 : l.properties) || {}, m = Object.entries(i), d = () => {
1795
+ function dt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
1796
+ const [n, i] = I(""), s = (l == null ? void 0 : l.properties) || {}, p = Object.entries(s), d = () => {
1797
1797
  if (!n.trim()) return;
1798
1798
  const u = {
1799
1799
  type: "object",
1800
1800
  properties: {
1801
- ...i,
1801
+ ...s,
1802
1802
  [n.trim()]: { type: "string" }
1803
1803
  }
1804
1804
  };
1805
- t(r, { outputSchema: u }), o("");
1805
+ t(r, { outputSchema: u }), i("");
1806
1806
  }, a = (u) => {
1807
- const h = { ...i };
1807
+ const h = { ...s };
1808
1808
  delete h[u], Object.keys(h).length === 0 ? t(r, { outputSchema: void 0 }) : t(r, {
1809
1809
  outputSchema: { type: "object", properties: h }
1810
1810
  });
1811
- }, p = (u, h) => {
1811
+ }, m = (u, h) => {
1812
1812
  t(r, {
1813
1813
  outputSchema: {
1814
1814
  type: "object",
1815
1815
  properties: {
1816
- ...i,
1817
- [u]: { ...i[u], type: h }
1816
+ ...s,
1817
+ [u]: { ...s[u], type: h }
1818
1818
  }
1819
1819
  }
1820
1820
  });
@@ -1823,31 +1823,31 @@ function lt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
1823
1823
  outputSchema: {
1824
1824
  type: "object",
1825
1825
  properties: {
1826
- ...i,
1827
- [u]: { ...i[u], description: h || void 0 }
1826
+ ...s,
1827
+ [u]: { ...s[u], description: h || void 0 }
1828
1828
  }
1829
1829
  }
1830
1830
  });
1831
1831
  };
1832
- return /* @__PURE__ */ s("div", { className: "mt-6 pt-4 border-t border-gray-200 dark:border-zinc-700", children: [
1833
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-3", children: [
1832
+ return /* @__PURE__ */ o("div", { className: "mt-6 pt-4 border-t border-gray-200 dark:border-zinc-700", children: [
1833
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-3", children: [
1834
1834
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300", children: "Output Schema" }),
1835
- /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-500", children: m.length > 0 ? `${m.length} output${m.length > 1 ? "s" : ""}` : "No outputs defined" })
1835
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-500", children: p.length > 0 ? `${p.length} output${p.length > 1 ? "s" : ""}` : "No outputs defined" })
1836
1836
  ] }),
1837
1837
  /* @__PURE__ */ e("p", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-3", children: "Define output properties to enable connecting individual JSON fields to other nodes." }),
1838
- m.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-2 mb-3", children: m.map(([u, h]) => /* @__PURE__ */ s(
1838
+ p.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-2 mb-3", children: p.map(([u, h]) => /* @__PURE__ */ o(
1839
1839
  "div",
1840
1840
  {
1841
1841
  className: "flex items-center gap-2 p-2 bg-pink-50 dark:bg-pink-900/20 rounded border border-pink-200 dark:border-pink-800",
1842
1842
  children: [
1843
- /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
1844
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
1843
+ /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
1844
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
1845
1845
  /* @__PURE__ */ e("span", { className: "text-sm font-medium text-pink-700 dark:text-pink-300 truncate", children: u }),
1846
- /* @__PURE__ */ s(
1846
+ /* @__PURE__ */ o(
1847
1847
  "select",
1848
1848
  {
1849
1849
  value: h.type,
1850
- onChange: (f) => p(u, f.target.value),
1850
+ onChange: (f) => m(u, f.target.value),
1851
1851
  className: "text-xs px-1.5 py-0.5 rounded border border-pink-300 dark:border-pink-700 bg-white dark:bg-zinc-800 text-gray-700 dark:text-zinc-300",
1852
1852
  children: [
1853
1853
  /* @__PURE__ */ e("option", { value: "string", children: "string" }),
@@ -1891,13 +1891,13 @@ function lt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
1891
1891
  },
1892
1892
  u
1893
1893
  )) }),
1894
- /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
1894
+ /* @__PURE__ */ o("div", { className: "flex gap-2", children: [
1895
1895
  /* @__PURE__ */ e(
1896
1896
  "input",
1897
1897
  {
1898
1898
  type: "text",
1899
1899
  value: n,
1900
- onChange: (u) => o(u.target.value),
1900
+ onChange: (u) => i(u.target.value),
1901
1901
  onKeyDown: (u) => u.key === "Enter" && d(),
1902
1902
  placeholder: "Property name...",
1903
1903
  className: "flex-1 px-2 py-1.5 text-sm border border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-900 text-gray-900 dark:text-zinc-100 placeholder-gray-400 dark:placeholder-zinc-500"
@@ -1913,33 +1913,33 @@ function lt({ nodeId: r, outputSchema: l, updateNodeData: t }) {
1913
1913
  }
1914
1914
  )
1915
1915
  ] }),
1916
- m.length > 0 && /* @__PURE__ */ e("p", { className: "mt-3 text-xs text-gray-500 dark:text-zinc-500", children: "Connect from the small pink handles on the right of the node to route individual properties." })
1916
+ p.length > 0 && /* @__PURE__ */ e("p", { className: "mt-3 text-xs text-gray-500 dark:text-zinc-500", children: "Connect from the small pink handles on the right of the node to route individual properties." })
1917
1917
  ] });
1918
1918
  }
1919
- function dt(r, l) {
1920
- const t = new Map(r.map((d) => [d.id, d])), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1919
+ function ct(r, l) {
1920
+ const t = new Map(r.map((d) => [d.id, d])), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1921
1921
  for (const d of r)
1922
- n.set(d.id, 0), o.set(d.id, []);
1922
+ n.set(d.id, 0), i.set(d.id, []);
1923
1923
  for (const d of l) {
1924
- const a = o.get(d.source) || [];
1925
- a.push(d.target), o.set(d.source, a), n.set(d.target, (n.get(d.target) || 0) + 1);
1924
+ const a = i.get(d.source) || [];
1925
+ a.push(d.target), i.set(d.source, a), n.set(d.target, (n.get(d.target) || 0) + 1);
1926
1926
  }
1927
- const i = [];
1927
+ const s = [];
1928
1928
  for (const [d, a] of n)
1929
- a === 0 && i.push(d);
1930
- const m = [];
1931
- for (; i.length > 0; ) {
1932
- const d = i.shift(), a = t.get(d);
1933
- a && m.push(a);
1934
- const p = o.get(d) || [];
1935
- for (const c of p) {
1929
+ a === 0 && s.push(d);
1930
+ const p = [];
1931
+ for (; s.length > 0; ) {
1932
+ const d = s.shift(), a = t.get(d);
1933
+ a && p.push(a);
1934
+ const m = i.get(d) || [];
1935
+ for (const c of m) {
1936
1936
  const u = (n.get(c) || 1) - 1;
1937
- n.set(c, u), u === 0 && i.push(c);
1937
+ n.set(c, u), u === 0 && s.push(c);
1938
1938
  }
1939
1939
  }
1940
- return m;
1940
+ return p;
1941
1941
  }
1942
- function ct(r) {
1942
+ function mt(r) {
1943
1943
  const l = r.type || "node", t = r.id.replace(/[^a-zA-Z0-9]/g, "_");
1944
1944
  return `${l}_${t}`;
1945
1945
  }
@@ -1947,20 +1947,20 @@ function G(r) {
1947
1947
  return typeof r == "string" ? r.includes(`
1948
1948
  `) ? "`" + r.replace(/`/g, "\\`").replace(/\$/g, "\\$") + "`" : JSON.stringify(r) : JSON.stringify(r, null, 2);
1949
1949
  }
1950
- function mt(r, l, t) {
1951
- const n = t.get(r.id), o = [], i = l.find((d) => d.target === r.id), m = i ? t.get(i.source) : null;
1950
+ function pt(r, l, t) {
1951
+ const n = t.get(r.id), i = [], s = l.find((d) => d.target === r.id), p = s ? t.get(s.source) : null;
1952
1952
  switch (r.type) {
1953
1953
  case "generator": {
1954
1954
  const d = r.data;
1955
- o.push(d.generatorName);
1956
- const a = d.params || {}, p = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${G(u)}`).join(`,
1955
+ i.push(d.generatorName);
1956
+ const a = d.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${G(u)}`).join(`,
1957
1957
  `);
1958
1958
  return {
1959
1959
  code: `// Generate image using ${d.generatorName}
1960
1960
  const ${n} = await ${d.generatorName}({
1961
- ${p}
1961
+ ${m}
1962
1962
  });`,
1963
- imports: o
1963
+ imports: i
1964
1964
  };
1965
1965
  }
1966
1966
  case "input":
@@ -1970,44 +1970,44 @@ const ${n} = await flo.loadImage("./input.png");`,
1970
1970
  imports: []
1971
1971
  };
1972
1972
  case "transform": {
1973
- const d = r.data, a = d.params || {}, p = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${G(h)}`).join(", "), c = m || "image";
1973
+ const d = r.data, a = d.params || {}, m = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${G(h)}`).join(", "), c = p || "image";
1974
1974
  return {
1975
1975
  code: `// Apply ${d.operation} transform
1976
- const ${n} = await flo.transform(${c}, "${d.operation}"${p ? `, { ${p} }` : ""});`,
1976
+ const ${n} = await flo.transform(${c}, "${d.operation}"${m ? `, { ${m} }` : ""});`,
1977
1977
  imports: []
1978
1978
  };
1979
1979
  }
1980
1980
  case "vision": {
1981
1981
  const d = r.data;
1982
- o.push(d.providerName);
1983
- const a = d.params || {}, p = m || "image", c = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => ` ${u}: ${G(h)}`).join(`,
1982
+ i.push(d.providerName);
1983
+ const a = d.params || {}, m = p || "image", c = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => ` ${u}: ${G(h)}`).join(`,
1984
1984
  `);
1985
1985
  return {
1986
1986
  code: `// Analyze image with ${d.providerName}
1987
- const ${n} = await ${d.providerName}.analyze(${p}, {
1987
+ const ${n} = await ${d.providerName}.analyze(${m}, {
1988
1988
  ${c}
1989
1989
  });`,
1990
- imports: o
1990
+ imports: i
1991
1991
  };
1992
1992
  }
1993
1993
  case "text": {
1994
1994
  const d = r.data;
1995
- o.push(d.providerName);
1996
- const a = d.params || {}, p = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${G(u)}`).join(`,
1995
+ i.push(d.providerName);
1996
+ const a = d.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${G(u)}`).join(`,
1997
1997
  `);
1998
1998
  return {
1999
1999
  code: `// Generate text with ${d.providerName}
2000
2000
  const ${n} = await ${d.providerName}.generate({
2001
- ${p}
2001
+ ${m}
2002
2002
  });`,
2003
- imports: o
2003
+ imports: i
2004
2004
  };
2005
2005
  }
2006
2006
  case "save": {
2007
2007
  const d = r.data;
2008
2008
  return {
2009
2009
  code: `// Save result
2010
- await flo.save(${m || "result"}, ${G(d.destination)});`,
2010
+ await flo.save(${p || "result"}, ${G(d.destination)});`,
2011
2011
  imports: []
2012
2012
  };
2013
2013
  }
@@ -2018,22 +2018,22 @@ await flo.save(${m || "result"}, ${G(d.destination)});`,
2018
2018
  };
2019
2019
  }
2020
2020
  }
2021
- function pt(r, l) {
2021
+ function ut(r, l) {
2022
2022
  if (r.length === 0)
2023
2023
  return `// Empty workflow
2024
2024
  // Add nodes to your canvas to generate code`;
2025
- const t = dt(r, l), n = /* @__PURE__ */ new Map();
2026
- for (const p of t)
2027
- n.set(p.id, ct(p));
2028
- const o = /* @__PURE__ */ new Set(), i = [];
2029
- for (const p of t) {
2030
- const { code: c, imports: u } = mt(p, l, n);
2031
- i.push(c);
2025
+ const t = ct(r, l), n = /* @__PURE__ */ new Map();
2026
+ for (const m of t)
2027
+ n.set(m.id, mt(m));
2028
+ const i = /* @__PURE__ */ new Set(), s = [];
2029
+ for (const m of t) {
2030
+ const { code: c, imports: u } = pt(m, l, n);
2031
+ s.push(c);
2032
2032
  for (const h of u)
2033
- o.add(h);
2033
+ i.add(h);
2034
2034
  }
2035
- const m = [];
2036
- o.size > 0 && m.push(`import { ${Array.from(o).join(", ")} } from "@teamflojo/floimg";`), m.push('import * as flo from "@teamflojo/floimg";');
2035
+ const p = [];
2036
+ i.size > 0 && p.push(`import { ${Array.from(i).join(", ")} } from "@teamflojo/floimg";`), p.push('import * as flo from "@teamflojo/floimg";');
2037
2037
  const d = `/**
2038
2038
  * FloImg Workflow
2039
2039
  * Generated by FloImg Studio
@@ -2042,8 +2042,8 @@ function pt(r, l) {
2042
2042
 
2043
2043
  `, a = `
2044
2044
  async function runWorkflow() {
2045
- ${i.map(
2046
- (p) => p.split(`
2045
+ ${s.map(
2046
+ (m) => m.split(`
2047
2047
  `).map((c) => " " + c).join(`
2048
2048
  `)
2049
2049
  ).join(`
@@ -2054,20 +2054,20 @@ ${i.map(
2054
2054
  // Run the workflow
2055
2055
  runWorkflow().catch(console.error);
2056
2056
  `;
2057
- return d + m.join(`
2057
+ return d + p.join(`
2058
2058
  `) + `
2059
2059
  ` + a;
2060
2060
  }
2061
- function ut({ isOpen: r, onClose: l, onImport: t }) {
2062
- const [n, o] = I(""), [i, m] = I(!1), [d, a] = I(null), [p, c] = I(!1), u = L(async () => {
2061
+ function gt({ isOpen: r, onClose: l, onImport: t }) {
2062
+ const [n, i] = I(""), [s, p] = I(!1), [d, a] = I(null), [m, c] = I(!1), u = L(async () => {
2063
2063
  if (!n.trim()) {
2064
2064
  a({ message: "Please enter or paste YAML content" });
2065
2065
  return;
2066
2066
  }
2067
- m(!0), a(null);
2067
+ p(!0), a(null);
2068
2068
  try {
2069
- const g = await Fe(n);
2070
- g.success ? (t(g.nodes, g.edges, g.name), o(""), l()) : a({
2069
+ const g = await He(n);
2070
+ g.success ? (t(g.nodes, g.edges, g.name), i(""), l()) : a({
2071
2071
  message: g.error || "Import failed",
2072
2072
  line: g.line,
2073
2073
  column: g.column
@@ -2075,21 +2075,21 @@ function ut({ isOpen: r, onClose: l, onImport: t }) {
2075
2075
  } catch (g) {
2076
2076
  a({ message: g instanceof Error ? g.message : "Import failed" });
2077
2077
  } finally {
2078
- m(!1);
2078
+ p(!1);
2079
2079
  }
2080
2080
  }, [n, t, l]), h = L(async () => {
2081
2081
  if (!n.trim()) {
2082
2082
  a({ message: "Please enter or paste YAML content" });
2083
2083
  return;
2084
2084
  }
2085
- m(!0), a(null);
2085
+ p(!0), a(null);
2086
2086
  try {
2087
- const g = await He(n);
2087
+ const g = await _e(n);
2088
2088
  g.valid ? (a(null), a({ message: "Valid YAML!" }), setTimeout(() => a(null), 2e3)) : g.errors.length > 0 && a(g.errors[0]);
2089
2089
  } catch (g) {
2090
2090
  a({ message: g instanceof Error ? g.message : "Validation failed" });
2091
2091
  } finally {
2092
- m(!1);
2092
+ p(!1);
2093
2093
  }
2094
2094
  }, [n]), f = L(async (g) => {
2095
2095
  if (!g.name.endsWith(".yaml") && !g.name.endsWith(".yml")) {
@@ -2097,32 +2097,32 @@ function ut({ isOpen: r, onClose: l, onImport: t }) {
2097
2097
  return;
2098
2098
  }
2099
2099
  try {
2100
- const N = await g.text();
2101
- o(N), a(null);
2100
+ const z = await g.text();
2101
+ i(z), a(null);
2102
2102
  } catch {
2103
2103
  a({ message: "Failed to read file" });
2104
2104
  }
2105
- }, []), w = L((g) => {
2105
+ }, []), y = L((g) => {
2106
2106
  g.preventDefault(), c(!0);
2107
2107
  }, []), v = L((g) => {
2108
2108
  g.preventDefault(), c(!1);
2109
- }, []), y = L(
2109
+ }, []), w = L(
2110
2110
  (g) => {
2111
2111
  g.preventDefault(), c(!1);
2112
- const N = g.dataTransfer.files[0];
2113
- N && f(N);
2112
+ const z = g.dataTransfer.files[0];
2113
+ z && f(z);
2114
2114
  },
2115
2115
  [f]
2116
2116
  ), b = L(
2117
2117
  (g) => {
2118
2118
  var W;
2119
- const N = (W = g.target.files) == null ? void 0 : W[0];
2120
- N && f(N);
2119
+ const z = (W = g.target.files) == null ? void 0 : W[0];
2120
+ z && f(z);
2121
2121
  },
2122
2122
  [f]
2123
2123
  );
2124
- return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ s("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: [
2125
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
2124
+ return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ o("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: [
2125
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
2126
2126
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Import Workflow" }),
2127
2127
  /* @__PURE__ */ e(
2128
2128
  "button",
@@ -2141,15 +2141,15 @@ function ut({ isOpen: r, onClose: l, onImport: t }) {
2141
2141
  }
2142
2142
  )
2143
2143
  ] }),
2144
- /* @__PURE__ */ s("div", { className: "p-4 flex-1 overflow-auto", children: [
2144
+ /* @__PURE__ */ o("div", { className: "p-4 flex-1 overflow-auto", children: [
2145
2145
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-4", children: "Paste YAML content or drag and drop a .yaml file to import a workflow." }),
2146
- /* @__PURE__ */ s(
2146
+ /* @__PURE__ */ o(
2147
2147
  "div",
2148
2148
  {
2149
- onDragOver: w,
2149
+ onDragOver: y,
2150
2150
  onDragLeave: v,
2151
- onDrop: y,
2152
- className: `border-2 border-dashed rounded-lg p-4 mb-4 text-center transition-colors ${p ? "border-teal-500 bg-teal-50 dark:bg-teal-900/20" : "border-gray-300 dark:border-zinc-600"}`,
2151
+ onDrop: w,
2152
+ className: `border-2 border-dashed rounded-lg p-4 mb-4 text-center transition-colors ${m ? "border-teal-500 bg-teal-50 dark:bg-teal-900/20" : "border-gray-300 dark:border-zinc-600"}`,
2153
2153
  children: [
2154
2154
  /* @__PURE__ */ e(
2155
2155
  "input",
@@ -2161,7 +2161,7 @@ function ut({ isOpen: r, onClose: l, onImport: t }) {
2161
2161
  id: "yaml-file-input"
2162
2162
  }
2163
2163
  ),
2164
- /* @__PURE__ */ s(
2164
+ /* @__PURE__ */ o(
2165
2165
  "label",
2166
2166
  {
2167
2167
  htmlFor: "yaml-file-input",
@@ -2201,7 +2201,7 @@ function ut({ isOpen: r, onClose: l, onImport: t }) {
2201
2201
  {
2202
2202
  value: n,
2203
2203
  onChange: (g) => {
2204
- o(g.target.value), a(null);
2204
+ i(g.target.value), a(null);
2205
2205
  },
2206
2206
  placeholder: `name: My Workflow
2207
2207
  steps:
@@ -2225,13 +2225,13 @@ steps:
2225
2225
  className: "w-full h-64 p-3 font-mono text-sm bg-gray-100 dark:bg-zinc-900 border border-gray-300 dark:border-zinc-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500 text-gray-800 dark:text-zinc-200"
2226
2226
  }
2227
2227
  ),
2228
- d && /* @__PURE__ */ s(
2228
+ d && /* @__PURE__ */ o(
2229
2229
  "div",
2230
2230
  {
2231
2231
  className: `mt-4 p-3 rounded-lg text-sm ${d.message === "Valid YAML!" ? "bg-green-50 dark:bg-green-900/30 text-green-700 dark:text-green-400" : "bg-red-50 dark:bg-red-900/30 text-red-700 dark:text-red-400"}`,
2232
2232
  children: [
2233
2233
  /* @__PURE__ */ e("span", { className: "font-medium", children: d.message }),
2234
- d.line && /* @__PURE__ */ s("span", { className: "ml-2 text-xs", children: [
2234
+ d.line && /* @__PURE__ */ o("span", { className: "ml-2 text-xs", children: [
2235
2235
  "(line ",
2236
2236
  d.line,
2237
2237
  d.column ? `, column ${d.column}` : "",
@@ -2241,26 +2241,26 @@ steps:
2241
2241
  }
2242
2242
  )
2243
2243
  ] }),
2244
- /* @__PURE__ */ s("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
2244
+ /* @__PURE__ */ o("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
2245
2245
  /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: "Use with floimg CLI: floimg run workflow.yaml" }),
2246
- /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
2246
+ /* @__PURE__ */ o("div", { className: "flex gap-2", children: [
2247
2247
  /* @__PURE__ */ e(
2248
2248
  "button",
2249
2249
  {
2250
2250
  onClick: h,
2251
- disabled: i || !n.trim(),
2251
+ disabled: s || !n.trim(),
2252
2252
  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",
2253
2253
  children: "Validate"
2254
2254
  }
2255
2255
  ),
2256
- /* @__PURE__ */ s(
2256
+ /* @__PURE__ */ o(
2257
2257
  "button",
2258
2258
  {
2259
2259
  onClick: u,
2260
- disabled: i || !n.trim(),
2260
+ disabled: s || !n.trim(),
2261
2261
  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",
2262
2262
  children: [
2263
- i && /* @__PURE__ */ s("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
2263
+ s && /* @__PURE__ */ o("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
2264
2264
  /* @__PURE__ */ e(
2265
2265
  "circle",
2266
2266
  {
@@ -2289,58 +2289,59 @@ steps:
2289
2289
  ] })
2290
2290
  ] }) }) : null;
2291
2291
  }
2292
- function gt({
2292
+ function ht({
2293
2293
  brandingSlot: r,
2294
2294
  beforeActionsSlot: l,
2295
2295
  afterActionsSlot: t,
2296
- hideAttribution: n = !1
2296
+ hideAttribution: n = !1,
2297
+ hideWorkflowLibrary: i = !1
2297
2298
  } = {}) {
2298
- const o = k((z) => z.execution), i = k((z) => z.execute), m = k((z) => z.exportToYaml), d = k((z) => z.importFromYaml), a = k((z) => z.nodes), p = k((z) => z.edges), c = O((z) => z.openSettings), u = k((z) => z.activeWorkflowName), h = k((z) => z.hasUnsavedChanges), f = k((z) => z.saveWorkflow), w = k((z) => z.toggleLibrary), v = k((z) => z.setActiveWorkflowName), y = k((z) => z.selectedNodeId), b = k((z) => z.duplicateNode), [g, N] = I(!1), [W, x] = I(!1), [C, S] = I("yaml"), [T, ue] = I(""), [Z, ge] = I(""), [ee, R] = I(null), [he, K] = I(!1), [te, q] = I("");
2299
+ const s = k((N) => N.execution), p = k((N) => N.execute), d = k((N) => N.exportToYaml), a = k((N) => N.importFromYaml), m = k((N) => N.nodes), c = k((N) => N.edges), u = O((N) => N.openSettings), h = k((N) => N.activeWorkflowName), f = k((N) => N.hasUnsavedChanges), y = k((N) => N.saveWorkflow), v = k((N) => N.toggleLibrary), w = k((N) => N.setActiveWorkflowName), b = k((N) => N.selectedNodeId), g = k((N) => N.duplicateNode), [z, W] = I(!1), [x, C] = I(!1), [S, T] = I("yaml"), [Z, ge] = I(""), [ee, he] = I(""), [te, R] = I(null), [xe, K] = I(!1), [re, q] = I("");
2299
2300
  D(() => {
2300
- const z = () => {
2301
+ const N = () => {
2301
2302
  R("New workflow created"), setTimeout(() => R(null), 2e3);
2302
2303
  };
2303
- return window.addEventListener("new-workflow-created", z), () => window.removeEventListener("new-workflow-created", z);
2304
+ return window.addEventListener("new-workflow-created", N), () => window.removeEventListener("new-workflow-created", N);
2304
2305
  }, []);
2305
2306
  const J = L(() => {
2306
- a.length !== 0 && (f(), R("Saved!"), setTimeout(() => R(null), 2e3));
2307
- }, [a.length, f]), xe = () => {
2308
- q(u), K(!0);
2309
- }, re = () => {
2310
- const z = te.trim();
2311
- z && z !== u && v(z), K(!1);
2312
- }, ae = L(() => {
2313
- y && b(y);
2314
- }, [y, b]);
2307
+ m.length !== 0 && (y(), R("Saved!"), setTimeout(() => R(null), 2e3));
2308
+ }, [m.length, y]), be = () => {
2309
+ q(h), K(!0);
2310
+ }, ae = () => {
2311
+ const N = re.trim();
2312
+ N && N !== h && w(N), K(!1);
2313
+ }, ne = L(() => {
2314
+ b && g(b);
2315
+ }, [b, g]);
2315
2316
  D(() => {
2316
- function z(M) {
2317
- (M.metaKey || M.ctrlKey) && M.key === "s" && (M.preventDefault(), J()), (M.metaKey || M.ctrlKey) && M.key === "d" && (M.preventDefault(), ae());
2317
+ function N(M) {
2318
+ (M.metaKey || M.ctrlKey) && M.key === "s" && (M.preventDefault(), J()), (M.metaKey || M.ctrlKey) && M.key === "d" && (M.preventDefault(), ne());
2318
2319
  }
2319
- return document.addEventListener("keydown", z), () => document.removeEventListener("keydown", z);
2320
- }, [J, ae]);
2321
- const be = async () => {
2322
- await i();
2323
- }, fe = async () => {
2324
- const z = await m();
2325
- ue(z);
2326
- const M = pt(a, p);
2327
- ge(M), N(!0);
2328
- }, ke = () => {
2329
- const z = C === "yaml" ? T : Z;
2330
- navigator.clipboard.writeText(z);
2331
- }, ve = L(
2332
- (z, M, ye) => {
2333
- d(z, M, ye), R("Workflow imported!"), setTimeout(() => R(null), 2e3);
2320
+ return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
2321
+ }, [J, ne]);
2322
+ const fe = async () => {
2323
+ await p();
2324
+ }, ke = async () => {
2325
+ const N = await d();
2326
+ ge(N);
2327
+ const M = ut(m, c);
2328
+ he(M), W(!0);
2329
+ }, ve = () => {
2330
+ const N = S === "yaml" ? Z : ee;
2331
+ navigator.clipboard.writeText(N);
2332
+ }, ye = L(
2333
+ (N, M, we) => {
2334
+ a(N, M, we), R("Workflow imported!"), setTimeout(() => R(null), 2e3);
2334
2335
  },
2335
- [d]
2336
+ [a]
2336
2337
  );
2337
- return /* @__PURE__ */ s(U, { children: [
2338
- /* @__PURE__ */ s("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: [
2339
- /* @__PURE__ */ s("div", { className: "flex items-center gap-4", children: [
2340
- /* @__PURE__ */ e(
2338
+ return /* @__PURE__ */ o(U, { children: [
2339
+ /* @__PURE__ */ o("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: [
2340
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-4", children: [
2341
+ !i && /* @__PURE__ */ e(
2341
2342
  "button",
2342
2343
  {
2343
- onClick: w,
2344
+ onClick: v,
2344
2345
  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",
2345
2346
  title: "My Workflows",
2346
2347
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
@@ -2354,7 +2355,7 @@ function gt({
2354
2355
  ) })
2355
2356
  }
2356
2357
  ),
2357
- /* @__PURE__ */ s("div", { className: "flex items-baseline gap-2", children: [
2358
+ /* @__PURE__ */ o("div", { className: "flex items-baseline gap-2", children: [
2358
2359
  /* @__PURE__ */ e("h1", { className: "text-xl font-bold text-gray-800 dark:text-white", children: "FloImg Studio" }),
2359
2360
  r,
2360
2361
  !n && /* @__PURE__ */ e(
@@ -2368,16 +2369,16 @@ function gt({
2368
2369
  }
2369
2370
  )
2370
2371
  ] }),
2371
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
2372
- he ? /* @__PURE__ */ e(
2372
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
2373
+ xe ? /* @__PURE__ */ e(
2373
2374
  "input",
2374
2375
  {
2375
2376
  type: "text",
2376
- value: te,
2377
- onChange: (z) => q(z.target.value),
2378
- onBlur: re,
2379
- onKeyDown: (z) => {
2380
- z.key === "Enter" && re(), z.key === "Escape" && (q(u), K(!1));
2377
+ value: re,
2378
+ onChange: (N) => q(N.target.value),
2379
+ onBlur: ae,
2380
+ onKeyDown: (N) => {
2381
+ N.key === "Enter" && ae(), N.key === "Escape" && (q(h), K(!1));
2381
2382
  },
2382
2383
  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",
2383
2384
  autoFocus: !0
@@ -2385,30 +2386,30 @@ function gt({
2385
2386
  ) : /* @__PURE__ */ e(
2386
2387
  "button",
2387
2388
  {
2388
- onClick: xe,
2389
+ onClick: be,
2389
2390
  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",
2390
2391
  title: "Click to rename",
2391
- children: u
2392
+ children: h
2392
2393
  }
2393
2394
  ),
2394
- h && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
2395
- ee && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: ee })
2395
+ f && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
2396
+ te && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: te })
2396
2397
  ] }),
2397
- /* @__PURE__ */ s("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
2398
- a.length,
2398
+ /* @__PURE__ */ o("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
2399
+ m.length,
2399
2400
  " node",
2400
- a.length !== 1 ? "s" : ""
2401
+ m.length !== 1 ? "s" : ""
2401
2402
  ] })
2402
2403
  ] }),
2403
- /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
2404
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-3", children: [
2404
2405
  l,
2405
2406
  /* @__PURE__ */ e(
2406
2407
  "button",
2407
2408
  {
2408
- onClick: c,
2409
+ onClick: u,
2409
2410
  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",
2410
2411
  title: "AI Settings",
2411
- children: /* @__PURE__ */ s("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
2412
+ children: /* @__PURE__ */ o("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
2412
2413
  /* @__PURE__ */ e(
2413
2414
  "path",
2414
2415
  {
@@ -2434,7 +2435,7 @@ function gt({
2434
2435
  "button",
2435
2436
  {
2436
2437
  onClick: J,
2437
- disabled: a.length === 0,
2438
+ disabled: m.length === 0,
2438
2439
  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",
2439
2440
  title: "Save Workflow (Cmd+S)",
2440
2441
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
@@ -2451,7 +2452,7 @@ function gt({
2451
2452
  /* @__PURE__ */ e(
2452
2453
  "button",
2453
2454
  {
2454
- onClick: () => x(!0),
2455
+ onClick: () => C(!0),
2455
2456
  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",
2456
2457
  children: "Import"
2457
2458
  }
@@ -2459,8 +2460,8 @@ function gt({
2459
2460
  /* @__PURE__ */ e(
2460
2461
  "button",
2461
2462
  {
2462
- onClick: fe,
2463
- disabled: a.length === 0,
2463
+ onClick: ke,
2464
+ disabled: m.length === 0,
2464
2465
  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",
2465
2466
  children: "Export"
2466
2467
  }
@@ -2468,11 +2469,11 @@ function gt({
2468
2469
  /* @__PURE__ */ e(
2469
2470
  "button",
2470
2471
  {
2471
- onClick: be,
2472
- disabled: a.length === 0 || o.status === "running",
2472
+ onClick: fe,
2473
+ disabled: m.length === 0 || s.status === "running",
2473
2474
  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",
2474
- children: o.status === "running" ? /* @__PURE__ */ s(U, { children: [
2475
- /* @__PURE__ */ s("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
2475
+ children: s.status === "running" ? /* @__PURE__ */ o(U, { children: [
2476
+ /* @__PURE__ */ o("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
2476
2477
  /* @__PURE__ */ e(
2477
2478
  "circle",
2478
2479
  {
@@ -2494,8 +2495,8 @@ function gt({
2494
2495
  )
2495
2496
  ] }),
2496
2497
  "Running..."
2497
- ] }) : /* @__PURE__ */ s(U, { children: [
2498
- /* @__PURE__ */ s("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
2498
+ ] }) : /* @__PURE__ */ o(U, { children: [
2499
+ /* @__PURE__ */ o("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
2499
2500
  /* @__PURE__ */ e(
2500
2501
  "path",
2501
2502
  {
@@ -2522,44 +2523,44 @@ function gt({
2522
2523
  t
2523
2524
  ] })
2524
2525
  ] }),
2525
- o.status === "completed" && o.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__ */ s("div", { className: "flex items-center gap-4", children: [
2526
- /* @__PURE__ */ s("span", { className: "text-green-700 dark:text-green-400 font-medium", children: [
2526
+ s.status === "completed" && s.imageIds.length > 0 && /* @__PURE__ */ e("div", { className: "bg-green-50 dark:bg-green-900/30 border-b border-green-200 dark:border-green-800 px-4 py-3", children: /* @__PURE__ */ o("div", { className: "flex items-center gap-4", children: [
2527
+ /* @__PURE__ */ o("span", { className: "text-green-700 dark:text-green-400 font-medium", children: [
2527
2528
  "Generated ",
2528
- o.imageIds.length,
2529
+ s.imageIds.length,
2529
2530
  " image",
2530
- o.imageIds.length !== 1 ? "s" : ""
2531
+ s.imageIds.length !== 1 ? "s" : ""
2531
2532
  ] }),
2532
- /* @__PURE__ */ e("div", { className: "flex gap-2", children: o.imageUrls.slice(0, 4).map((z, M) => /* @__PURE__ */ e("a", { href: z, target: "_blank", rel: "noopener noreferrer", className: "block", children: /* @__PURE__ */ e(
2533
+ /* @__PURE__ */ e("div", { className: "flex gap-2", children: s.imageUrls.slice(0, 4).map((N, M) => /* @__PURE__ */ e("a", { href: N, target: "_blank", rel: "noopener noreferrer", className: "block", children: /* @__PURE__ */ e(
2533
2534
  "img",
2534
2535
  {
2535
- src: z,
2536
+ src: N,
2536
2537
  alt: "Generated",
2537
2538
  className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
2538
2539
  }
2539
2540
  ) }, M)) })
2540
2541
  ] }) }),
2541
- o.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__ */ s("span", { className: "text-red-700 dark:text-red-400", children: [
2542
+ s.status === "error" && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border-b border-red-200 dark:border-red-800 px-4 py-3", children: /* @__PURE__ */ o("span", { className: "text-red-700 dark:text-red-400", children: [
2542
2543
  "Error: ",
2543
- o.error
2544
+ s.error
2544
2545
  ] }) }),
2545
- g && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ s("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: [
2546
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
2547
- /* @__PURE__ */ s("div", { className: "flex items-center gap-4", children: [
2546
+ z && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ o("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: [
2547
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
2548
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-4", children: [
2548
2549
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Export Workflow" }),
2549
- /* @__PURE__ */ s("div", { className: "flex gap-1 bg-gray-100 dark:bg-zinc-700 rounded-lg p-1", children: [
2550
+ /* @__PURE__ */ o("div", { className: "flex gap-1 bg-gray-100 dark:bg-zinc-700 rounded-lg p-1", children: [
2550
2551
  /* @__PURE__ */ e(
2551
2552
  "button",
2552
2553
  {
2553
- onClick: () => S("yaml"),
2554
- className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${C === "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"}`,
2554
+ onClick: () => T("yaml"),
2555
+ className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "yaml" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
2555
2556
  children: "YAML"
2556
2557
  }
2557
2558
  ),
2558
2559
  /* @__PURE__ */ e(
2559
2560
  "button",
2560
2561
  {
2561
- onClick: () => S("javascript"),
2562
- className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${C === "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"}`,
2562
+ onClick: () => T("javascript"),
2563
+ className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${S === "javascript" ? "bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm" : "text-gray-600 dark:text-zinc-400 hover:text-gray-900 dark:hover:text-white"}`,
2563
2564
  children: "JavaScript"
2564
2565
  }
2565
2566
  )
@@ -2568,7 +2569,7 @@ function gt({
2568
2569
  /* @__PURE__ */ e(
2569
2570
  "button",
2570
2571
  {
2571
- onClick: () => N(!1),
2572
+ onClick: () => W(!1),
2572
2573
  className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
2573
2574
  children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
2574
2575
  "path",
@@ -2582,14 +2583,14 @@ function gt({
2582
2583
  }
2583
2584
  )
2584
2585
  ] }),
2585
- /* @__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: C === "yaml" ? T : Z }) }),
2586
- /* @__PURE__ */ s("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
2587
- /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: C === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
2588
- /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
2586
+ /* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: S === "yaml" ? Z : ee }) }),
2587
+ /* @__PURE__ */ o("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
2588
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: S === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
2589
+ /* @__PURE__ */ o("div", { className: "flex gap-2", children: [
2589
2590
  /* @__PURE__ */ e(
2590
2591
  "button",
2591
2592
  {
2592
- onClick: ke,
2593
+ onClick: ve,
2593
2594
  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",
2594
2595
  children: "Copy to Clipboard"
2595
2596
  }
@@ -2597,7 +2598,7 @@ function gt({
2597
2598
  /* @__PURE__ */ e(
2598
2599
  "button",
2599
2600
  {
2600
- onClick: () => N(!1),
2601
+ onClick: () => W(!1),
2601
2602
  className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
2602
2603
  children: "Close"
2603
2604
  }
@@ -2606,31 +2607,31 @@ function gt({
2606
2607
  ] })
2607
2608
  ] }) }),
2608
2609
  /* @__PURE__ */ e(
2609
- ut,
2610
+ gt,
2610
2611
  {
2611
- isOpen: W,
2612
- onClose: () => x(!1),
2613
- onImport: ve
2612
+ isOpen: x,
2613
+ onClose: () => C(!1),
2614
+ onImport: ye
2614
2615
  }
2615
2616
  )
2616
2617
  ] });
2617
2618
  }
2618
- function ht() {
2619
+ function xt() {
2619
2620
  const r = k((a) => a.loadTemplate), [l, t] = I(null), {
2620
2621
  data: n,
2621
- isLoading: o,
2622
- error: i,
2623
- refetch: m
2622
+ isLoading: i,
2623
+ error: s,
2624
+ refetch: p
2624
2625
  } = F({
2625
2626
  queryKey: ["images"],
2626
- queryFn: Re,
2627
+ queryFn: Ee,
2627
2628
  refetchInterval: 5e3
2628
2629
  // Auto-refresh every 5 seconds
2629
2630
  }), d = async (a) => {
2630
2631
  t(a);
2631
2632
  try {
2632
- const p = await Ee(a);
2633
- if (p != null && p.workflow) {
2633
+ const m = await Be(a);
2634
+ if (m != null && m.workflow) {
2634
2635
  const c = {
2635
2636
  id: `image-${a}`,
2636
2637
  name: `Workflow from ${a}`,
@@ -2638,29 +2639,29 @@ function ht() {
2638
2639
  category: "Gallery",
2639
2640
  generator: "unknown",
2640
2641
  workflow: {
2641
- nodes: p.workflow.nodes,
2642
- edges: p.workflow.edges
2642
+ nodes: m.workflow.nodes,
2643
+ edges: m.workflow.edges
2643
2644
  }
2644
2645
  };
2645
2646
  r(c), window.dispatchEvent(new CustomEvent("workflow-loaded"));
2646
2647
  } else
2647
2648
  alert("No workflow metadata available for this image");
2648
- } catch (p) {
2649
- console.error("Failed to load workflow:", p), alert("Failed to load workflow");
2649
+ } catch (m) {
2650
+ console.error("Failed to load workflow:", m), alert("Failed to load workflow");
2650
2651
  } finally {
2651
2652
  t(null);
2652
2653
  }
2653
2654
  };
2654
- return o ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : i ? /* @__PURE__ */ s("div", { className: "p-8 text-center text-red-500 dark:text-red-400", children: [
2655
+ return i ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: "Loading images..." }) : s ? /* @__PURE__ */ o("div", { className: "p-8 text-center text-red-500 dark:text-red-400", children: [
2655
2656
  "Error loading images: ",
2656
- i instanceof Error ? i.message : "Unknown error"
2657
- ] }) : !n || n.length === 0 ? /* @__PURE__ */ s("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: [
2657
+ s instanceof Error ? s.message : "Unknown error"
2658
+ ] }) : !n || n.length === 0 ? /* @__PURE__ */ o("div", { className: "p-8 text-center text-gray-500 dark:text-zinc-400", children: [
2658
2659
  /* @__PURE__ */ e("div", { className: "text-lg mb-2", children: "No images yet" }),
2659
2660
  /* @__PURE__ */ e("div", { className: "text-sm", children: "Create a workflow and click Execute to generate images" })
2660
- ] }) : /* @__PURE__ */ s("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
2661
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-4", children: [
2662
- /* @__PURE__ */ s("div", { children: [
2663
- /* @__PURE__ */ s("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
2661
+ ] }) : /* @__PURE__ */ o("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
2662
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4", children: [
2663
+ /* @__PURE__ */ o("div", { children: [
2664
+ /* @__PURE__ */ o("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
2664
2665
  "Images (",
2665
2666
  n.length,
2666
2667
  ")"
@@ -2670,14 +2671,14 @@ function ht() {
2670
2671
  /* @__PURE__ */ e(
2671
2672
  "button",
2672
2673
  {
2673
- onClick: () => m(),
2674
+ onClick: () => p(),
2674
2675
  className: "text-sm text-teal-600 dark:text-teal-400 hover:text-teal-700 dark:hover:text-violet-300",
2675
2676
  children: "Refresh"
2676
2677
  }
2677
2678
  )
2678
2679
  ] }),
2679
2680
  /* @__PURE__ */ e("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: n.map((a) => /* @__PURE__ */ e(
2680
- xt,
2681
+ bt,
2681
2682
  {
2682
2683
  image: a,
2683
2684
  onLoadWorkflow: () => d(a.id),
@@ -2687,21 +2688,21 @@ function ht() {
2687
2688
  )) })
2688
2689
  ] });
2689
2690
  }
2690
- function xt({ image: r, onLoadWorkflow: l, isLoading: t }) {
2691
- const n = (i) => new Date(i).toLocaleString(), o = (i) => i < 1024 ? `${i} B` : i < 1048576 ? `${(i / 1024).toFixed(1)} KB` : `${(i / 1048576).toFixed(1)} MB`;
2692
- return /* @__PURE__ */ s("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: [
2693
- /* @__PURE__ */ s("div", { className: "relative", children: [
2691
+ function bt({ image: r, onLoadWorkflow: l, isLoading: t }) {
2692
+ const n = (s) => new Date(s).toLocaleString(), i = (s) => s < 1024 ? `${s} B` : s < 1048576 ? `${(s / 1024).toFixed(1)} KB` : `${(s / 1048576).toFixed(1)} MB`;
2693
+ return /* @__PURE__ */ o("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: [
2694
+ /* @__PURE__ */ o("div", { className: "relative", children: [
2694
2695
  /* @__PURE__ */ e(
2695
2696
  "a",
2696
2697
  {
2697
- href: oe(r.id),
2698
+ href: se(r.id),
2698
2699
  target: "_blank",
2699
2700
  rel: "noopener noreferrer",
2700
2701
  className: "block aspect-square bg-gray-100 dark:bg-zinc-900",
2701
2702
  children: /* @__PURE__ */ e(
2702
2703
  "img",
2703
2704
  {
2704
- src: oe(r.id),
2705
+ src: se(r.id),
2705
2706
  alt: r.filename,
2706
2707
  className: "w-full h-full object-cover",
2707
2708
  loading: "lazy"
@@ -2712,8 +2713,8 @@ function xt({ image: r, onLoadWorkflow: l, isLoading: t }) {
2712
2713
  /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ e(
2713
2714
  "button",
2714
2715
  {
2715
- onClick: (i) => {
2716
- i.preventDefault(), l();
2716
+ onClick: (s) => {
2717
+ s.preventDefault(), l();
2717
2718
  },
2718
2719
  disabled: t,
2719
2720
  className: "px-3 py-1.5 bg-teal-600 text-white text-sm rounded-lg hover:bg-teal-700 disabled:opacity-50",
@@ -2721,18 +2722,18 @@ function xt({ image: r, onLoadWorkflow: l, isLoading: t }) {
2721
2722
  }
2722
2723
  ) })
2723
2724
  ] }),
2724
- /* @__PURE__ */ s("div", { className: "p-3", children: [
2725
+ /* @__PURE__ */ o("div", { className: "p-3", children: [
2725
2726
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-gray-800 dark:text-white truncate", children: r.filename }),
2726
- /* @__PURE__ */ s("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mt-1", children: [
2727
+ /* @__PURE__ */ o("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mt-1", children: [
2727
2728
  r.mime,
2728
2729
  " • ",
2729
- o(r.size)
2730
+ i(r.size)
2730
2731
  ] }),
2731
2732
  /* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-zinc-500 mt-1", children: n(r.createdAt) })
2732
2733
  ] })
2733
2734
  ] });
2734
2735
  }
2735
- const bt = {
2736
+ const ft = {
2736
2737
  id: "sales-dashboard",
2737
2738
  name: "Sales Dashboard",
2738
2739
  description: "Quarterly revenue bar chart with gradient styling",
@@ -2782,7 +2783,7 @@ const bt = {
2782
2783
  ],
2783
2784
  edges: []
2784
2785
  }
2785
- }, ft = {
2786
+ }, kt = {
2786
2787
  id: "user-growth",
2787
2788
  name: "User Growth Line Chart",
2788
2789
  description: "Monthly user growth with smooth bezier curves",
@@ -2830,7 +2831,7 @@ const bt = {
2830
2831
  ],
2831
2832
  edges: []
2832
2833
  }
2833
- }, kt = {
2834
+ }, vt = {
2834
2835
  id: "api-flow",
2835
2836
  name: "API Request Flow",
2836
2837
  description: "Sequence diagram showing API authentication flow",
@@ -2872,7 +2873,7 @@ const bt = {
2872
2873
  ],
2873
2874
  edges: []
2874
2875
  }
2875
- }, vt = {
2876
+ }, yt = {
2876
2877
  id: "system-architecture",
2877
2878
  name: "System Architecture",
2878
2879
  description: "Microservices architecture diagram",
@@ -2930,7 +2931,7 @@ const bt = {
2930
2931
  ],
2931
2932
  edges: []
2932
2933
  }
2933
- }, yt = {
2934
+ }, wt = {
2934
2935
  id: "git-workflow",
2935
2936
  name: "Git Branch Workflow",
2936
2937
  description: "Git branching strategy with feature and release branches",
@@ -2973,7 +2974,7 @@ const bt = {
2973
2974
  ],
2974
2975
  edges: []
2975
2976
  }
2976
- }, wt = {
2977
+ }, Nt = {
2977
2978
  id: "website-qr",
2978
2979
  name: "Website QR Code",
2979
2980
  description: "QR code linking to your website with custom styling",
@@ -3001,7 +3002,7 @@ const bt = {
3001
3002
  ],
3002
3003
  edges: []
3003
3004
  }
3004
- }, Nt = {
3005
+ }, zt = {
3005
3006
  id: "wifi-qr",
3006
3007
  name: "WiFi QR Code",
3007
3008
  description: "Scannable QR code for WiFi network access",
@@ -3029,7 +3030,7 @@ const bt = {
3029
3030
  ],
3030
3031
  edges: []
3031
3032
  }
3032
- }, zt = {
3033
+ }, Ct = {
3033
3034
  id: "chart-watermark",
3034
3035
  name: "Chart with Watermark",
3035
3036
  description: "Bar chart with company watermark and rounded corners",
@@ -3095,7 +3096,7 @@ const bt = {
3095
3096
  { id: "e2", source: "transform-1", target: "transform-2" }
3096
3097
  ]
3097
3098
  }
3098
- }, Ct = {
3099
+ }, It = {
3099
3100
  id: "diagram-webp",
3100
3101
  name: "Diagram to WebP",
3101
3102
  description: "Mermaid diagram converted to optimized WebP format",
@@ -3138,69 +3139,69 @@ const bt = {
3138
3139
  }
3139
3140
  }, H = [
3140
3141
  // Charts
3141
- bt,
3142
3142
  ft,
3143
- // Diagrams
3144
3143
  kt,
3144
+ // Diagrams
3145
3145
  vt,
3146
3146
  yt,
3147
- // QR Codes
3148
3147
  wt,
3148
+ // QR Codes
3149
3149
  Nt,
3150
- // Pipelines
3151
3150
  zt,
3152
- Ct
3151
+ // Pipelines
3152
+ Ct,
3153
+ It
3153
3154
  ];
3154
- function It() {
3155
+ function St() {
3155
3156
  const r = new Set(H.map((l) => l.category));
3156
3157
  return Array.from(r).sort();
3157
3158
  }
3158
- function Gt(r) {
3159
+ function Ft(r) {
3159
3160
  return H.filter((l) => l.category === r);
3160
3161
  }
3161
- function de(r) {
3162
+ function ce(r) {
3162
3163
  return H.find((l) => l.id === r);
3163
3164
  }
3164
- function Ft(r) {
3165
+ function Ht(r) {
3165
3166
  const l = r.toLowerCase();
3166
3167
  return H.filter(
3167
3168
  (t) => {
3168
3169
  var n;
3169
- return t.name.toLowerCase().includes(l) || t.description.toLowerCase().includes(l) || t.category.toLowerCase().includes(l) || t.generator.toLowerCase().includes(l) || ((n = t.tags) == null ? void 0 : n.some((o) => o.toLowerCase().includes(l)));
3170
+ return t.name.toLowerCase().includes(l) || t.description.toLowerCase().includes(l) || t.category.toLowerCase().includes(l) || t.generator.toLowerCase().includes(l) || ((n = t.tags) == null ? void 0 : n.some((i) => i.toLowerCase().includes(l)));
3170
3171
  }
3171
3172
  );
3172
3173
  }
3173
- function St({ onSelect: r }) {
3174
- const [l, t] = I(null), [n, o] = I(""), i = ne(() => It(), []), m = ne(() => {
3174
+ function Lt({ onSelect: r }) {
3175
+ const [l, t] = I(null), [n, i] = I(""), s = oe(() => St(), []), p = oe(() => {
3175
3176
  let d = H;
3176
3177
  if (l && (d = d.filter((a) => a.category === l)), n) {
3177
3178
  const a = n.toLowerCase();
3178
3179
  d = d.filter(
3179
- (p) => {
3180
+ (m) => {
3180
3181
  var c;
3181
- return p.name.toLowerCase().includes(a) || p.description.toLowerCase().includes(a) || p.generator.toLowerCase().includes(a) || ((c = p.tags) == null ? void 0 : c.some((u) => u.toLowerCase().includes(a)));
3182
+ return m.name.toLowerCase().includes(a) || m.description.toLowerCase().includes(a) || m.generator.toLowerCase().includes(a) || ((c = m.tags) == null ? void 0 : c.some((u) => u.toLowerCase().includes(a)));
3182
3183
  }
3183
3184
  );
3184
3185
  }
3185
3186
  return d;
3186
3187
  }, [l, n]);
3187
- return /* @__PURE__ */ s("div", { className: "p-6", children: [
3188
- /* @__PURE__ */ s("div", { className: "mb-6", children: [
3188
+ return /* @__PURE__ */ o("div", { className: "p-6", children: [
3189
+ /* @__PURE__ */ o("div", { className: "mb-6", children: [
3189
3190
  /* @__PURE__ */ e("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white mb-2", children: "Templates" }),
3190
3191
  /* @__PURE__ */ e("p", { className: "text-gray-600 dark:text-zinc-400", children: "Start with a pre-built workflow. Click any template to load it into the editor." })
3191
3192
  ] }),
3192
- /* @__PURE__ */ s("div", { className: "flex flex-wrap gap-4 mb-6", children: [
3193
+ /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-4 mb-6", children: [
3193
3194
  /* @__PURE__ */ e(
3194
3195
  "input",
3195
3196
  {
3196
3197
  type: "text",
3197
3198
  placeholder: "Search templates...",
3198
3199
  value: n,
3199
- onChange: (d) => o(d.target.value),
3200
+ onChange: (d) => i(d.target.value),
3200
3201
  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"
3201
3202
  }
3202
3203
  ),
3203
- /* @__PURE__ */ s("div", { className: "flex gap-2 flex-wrap", children: [
3204
+ /* @__PURE__ */ o("div", { className: "flex gap-2 flex-wrap", children: [
3204
3205
  /* @__PURE__ */ e(
3205
3206
  "button",
3206
3207
  {
@@ -3209,7 +3210,7 @@ function St({ onSelect: r }) {
3209
3210
  children: "All"
3210
3211
  }
3211
3212
  ),
3212
- i.map((d) => /* @__PURE__ */ e(
3213
+ s.map((d) => /* @__PURE__ */ e(
3213
3214
  "button",
3214
3215
  {
3215
3216
  onClick: () => t(d),
@@ -3220,8 +3221,8 @@ function St({ onSelect: r }) {
3220
3221
  ))
3221
3222
  ] })
3222
3223
  ] }),
3223
- m.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-12 text-gray-500 dark:text-zinc-400", children: "No templates found matching your criteria." }) : /* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: m.map((d) => /* @__PURE__ */ e(
3224
- Lt,
3224
+ p.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: p.map((d) => /* @__PURE__ */ e(
3225
+ Wt,
3225
3226
  {
3226
3227
  template: d,
3227
3228
  onSelect: () => r(d.id)
@@ -3230,14 +3231,14 @@ function St({ onSelect: r }) {
3230
3231
  )) })
3231
3232
  ] });
3232
3233
  }
3233
- function Lt({ template: r, onSelect: l }) {
3234
- const t = r.workflow.nodes.length, n = r.workflow.edges.length, o = {
3234
+ function Wt({ template: r, onSelect: l }) {
3235
+ const t = r.workflow.nodes.length, n = r.workflow.edges.length, i = {
3235
3236
  quickchart: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
3236
3237
  mermaid: "bg-pink-100 text-pink-800 dark:bg-pink-900/30 dark:text-pink-300",
3237
3238
  qr: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
3238
3239
  d3: "bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300"
3239
3240
  };
3240
- return /* @__PURE__ */ s("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden hover:shadow-lg transition-shadow", children: [
3241
+ return /* @__PURE__ */ o("div", { className: "bg-white dark:bg-zinc-800 rounded-lg border border-gray-200 dark:border-zinc-700 overflow-hidden hover:shadow-lg transition-shadow", children: [
3241
3242
  /* @__PURE__ */ e("div", { className: "aspect-video bg-gray-100 dark:bg-zinc-900 flex items-center justify-center p-4", children: r.preview ? /* @__PURE__ */ e(
3242
3243
  "img",
3243
3244
  {
@@ -3245,7 +3246,7 @@ function Lt({ template: r, onSelect: l }) {
3245
3246
  alt: r.name,
3246
3247
  className: "max-w-full max-h-full object-contain"
3247
3248
  }
3248
- ) : /* @__PURE__ */ s("div", { className: "text-center text-gray-400 dark:text-zinc-500", children: [
3249
+ ) : /* @__PURE__ */ o("div", { className: "text-center text-gray-400 dark:text-zinc-500", children: [
3249
3250
  /* @__PURE__ */ e(
3250
3251
  "svg",
3251
3252
  {
@@ -3266,20 +3267,20 @@ function Lt({ template: r, onSelect: l }) {
3266
3267
  ),
3267
3268
  /* @__PURE__ */ e("span", { className: "text-sm", children: "No preview" })
3268
3269
  ] }) }),
3269
- /* @__PURE__ */ s("div", { className: "p-4", children: [
3270
- /* @__PURE__ */ s("div", { className: "flex items-start justify-between mb-2", children: [
3270
+ /* @__PURE__ */ o("div", { className: "p-4", children: [
3271
+ /* @__PURE__ */ o("div", { className: "flex items-start justify-between mb-2", children: [
3271
3272
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: r.name }),
3272
3273
  /* @__PURE__ */ e(
3273
3274
  "span",
3274
3275
  {
3275
- className: `px-2 py-0.5 rounded text-xs font-medium ${o[r.generator] || "bg-gray-100 text-gray-800 dark:bg-zinc-700 dark:text-zinc-300"}`,
3276
+ className: `px-2 py-0.5 rounded text-xs font-medium ${i[r.generator] || "bg-gray-100 text-gray-800 dark:bg-zinc-700 dark:text-zinc-300"}`,
3276
3277
  children: r.generator
3277
3278
  }
3278
3279
  )
3279
3280
  ] }),
3280
3281
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-600 dark:text-zinc-400 mb-3", children: r.description }),
3281
- /* @__PURE__ */ s("div", { className: "flex items-center gap-4 text-xs text-gray-500 dark:text-zinc-500 mb-4", children: [
3282
- /* @__PURE__ */ s("span", { className: "flex items-center gap-1", children: [
3282
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-4 text-xs text-gray-500 dark:text-zinc-500 mb-4", children: [
3283
+ /* @__PURE__ */ o("span", { className: "flex items-center gap-1", children: [
3283
3284
  /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
3284
3285
  "path",
3285
3286
  {
@@ -3293,7 +3294,7 @@ function Lt({ template: r, onSelect: l }) {
3293
3294
  " node",
3294
3295
  t !== 1 ? "s" : ""
3295
3296
  ] }),
3296
- n > 0 && /* @__PURE__ */ s("span", { className: "flex items-center gap-1", children: [
3297
+ n > 0 && /* @__PURE__ */ o("span", { className: "flex items-center gap-1", children: [
3297
3298
  /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
3298
3299
  "path",
3299
3300
  {
@@ -3308,13 +3309,13 @@ function Lt({ template: r, onSelect: l }) {
3308
3309
  n !== 1 ? "s" : ""
3309
3310
  ] })
3310
3311
  ] }),
3311
- 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(
3312
+ r.tags && r.tags.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 mb-4", children: r.tags.slice(0, 4).map((s) => /* @__PURE__ */ e(
3312
3313
  "span",
3313
3314
  {
3314
3315
  className: "px-2 py-0.5 bg-gray-100 dark:bg-zinc-700 text-gray-600 dark:text-zinc-400 rounded text-xs",
3315
- children: i
3316
+ children: s
3316
3317
  },
3317
- i
3318
+ s
3318
3319
  )) }),
3319
3320
  /* @__PURE__ */ e(
3320
3321
  "button",
@@ -3327,67 +3328,67 @@ function Lt({ template: r, onSelect: l }) {
3327
3328
  ] })
3328
3329
  ] });
3329
3330
  }
3330
- function Wt({
3331
+ function At({
3331
3332
  workflow: r,
3332
3333
  isActive: l,
3333
3334
  onLoad: t,
3334
3335
  onDelete: n,
3335
- onRename: o,
3336
- onDuplicate: i
3336
+ onRename: i,
3337
+ onDuplicate: s
3337
3338
  }) {
3338
- const [m, d] = I(!1), [a, p] = I(r.name), [c, u] = I(!1), h = () => {
3339
- a.trim() && a !== r.name && o(a.trim()), d(!1);
3340
- }, f = (w) => {
3341
- const v = new Date(w), b = (/* @__PURE__ */ new Date()).getTime() - v.getTime(), g = Math.floor(b / 6e4), N = Math.floor(b / 36e5), W = Math.floor(b / 864e5);
3342
- return g < 1 ? "Just now" : g < 60 ? `${g}m ago` : N < 24 ? `${N}h ago` : W < 7 ? `${W}d ago` : v.toLocaleDateString();
3339
+ const [p, d] = I(!1), [a, m] = I(r.name), [c, u] = I(!1), h = () => {
3340
+ a.trim() && a !== r.name && i(a.trim()), d(!1);
3341
+ }, f = (y) => {
3342
+ const v = new Date(y), b = (/* @__PURE__ */ new Date()).getTime() - v.getTime(), g = Math.floor(b / 6e4), z = Math.floor(b / 36e5), W = Math.floor(b / 864e5);
3343
+ return g < 1 ? "Just now" : g < 60 ? `${g}m ago` : z < 24 ? `${z}h ago` : W < 7 ? `${W}d ago` : v.toLocaleDateString();
3343
3344
  };
3344
- return /* @__PURE__ */ s(
3345
+ return /* @__PURE__ */ o(
3345
3346
  "div",
3346
3347
  {
3347
3348
  className: `group relative p-3 rounded-lg border transition-colors ${l ? "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"}`,
3348
3349
  children: [
3349
- /* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-2", children: [
3350
- /* @__PURE__ */ s("button", { onClick: t, className: "flex-1 text-left min-w-0", children: [
3351
- m ? /* @__PURE__ */ e(
3350
+ /* @__PURE__ */ o("div", { className: "flex items-start justify-between gap-2", children: [
3351
+ /* @__PURE__ */ o("button", { onClick: t, className: "flex-1 text-left min-w-0", children: [
3352
+ p ? /* @__PURE__ */ e(
3352
3353
  "input",
3353
3354
  {
3354
3355
  type: "text",
3355
3356
  value: a,
3356
- onChange: (w) => p(w.target.value),
3357
+ onChange: (y) => m(y.target.value),
3357
3358
  onBlur: h,
3358
- onKeyDown: (w) => {
3359
- w.key === "Enter" && h(), w.key === "Escape" && (p(r.name), d(!1));
3359
+ onKeyDown: (y) => {
3360
+ y.key === "Enter" && h(), y.key === "Escape" && (m(r.name), d(!1));
3360
3361
  },
3361
3362
  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",
3362
3363
  autoFocus: !0,
3363
- onClick: (w) => w.stopPropagation()
3364
+ onClick: (y) => y.stopPropagation()
3364
3365
  }
3365
3366
  ) : /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate", children: r.name }),
3366
- /* @__PURE__ */ s("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
3367
+ /* @__PURE__ */ o("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
3367
3368
  r.nodes.length,
3368
3369
  " nodes · Updated ",
3369
3370
  f(r.updatedAt)
3370
3371
  ] })
3371
3372
  ] }),
3372
- /* @__PURE__ */ s("div", { className: "relative", children: [
3373
+ /* @__PURE__ */ o("div", { className: "relative", children: [
3373
3374
  /* @__PURE__ */ e(
3374
3375
  "button",
3375
3376
  {
3376
- onClick: (w) => {
3377
- w.stopPropagation(), u(!c);
3377
+ onClick: (y) => {
3378
+ y.stopPropagation(), u(!c);
3378
3379
  },
3379
3380
  className: "p-1 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 rounded opacity-0 group-hover:opacity-100 transition-opacity",
3380
3381
  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" }) })
3381
3382
  }
3382
3383
  ),
3383
- c && /* @__PURE__ */ s(U, { children: [
3384
+ c && /* @__PURE__ */ o(U, { children: [
3384
3385
  /* @__PURE__ */ e("div", { className: "fixed inset-0 z-10", onClick: () => u(!1) }),
3385
- /* @__PURE__ */ s("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: [
3386
+ /* @__PURE__ */ o("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: [
3386
3387
  /* @__PURE__ */ e(
3387
3388
  "button",
3388
3389
  {
3389
- onClick: (w) => {
3390
- w.stopPropagation(), d(!0), u(!1);
3390
+ onClick: (y) => {
3391
+ y.stopPropagation(), d(!0), u(!1);
3391
3392
  },
3392
3393
  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",
3393
3394
  children: "Rename"
@@ -3396,8 +3397,8 @@ function Wt({
3396
3397
  /* @__PURE__ */ e(
3397
3398
  "button",
3398
3399
  {
3399
- onClick: (w) => {
3400
- w.stopPropagation(), i(), u(!1);
3400
+ onClick: (y) => {
3401
+ y.stopPropagation(), s(), u(!1);
3401
3402
  },
3402
3403
  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",
3403
3404
  children: "Duplicate"
@@ -3406,8 +3407,8 @@ function Wt({
3406
3407
  /* @__PURE__ */ e(
3407
3408
  "button",
3408
3409
  {
3409
- onClick: (w) => {
3410
- w.stopPropagation(), window.confirm("Delete this workflow?") && n(), u(!1);
3410
+ onClick: (y) => {
3411
+ y.stopPropagation(), window.confirm("Delete this workflow?") && n(), u(!1);
3411
3412
  },
3412
3413
  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",
3413
3414
  children: "Delete"
@@ -3422,14 +3423,14 @@ function Wt({
3422
3423
  }
3423
3424
  );
3424
3425
  }
3425
- function At() {
3426
- const r = k((c) => c.showLibrary), l = k((c) => c.toggleLibrary), t = k((c) => c.savedWorkflows), n = k((c) => c.activeWorkflowId), o = k((c) => c.loadWorkflow), i = k((c) => c.deleteWorkflow), m = k((c) => c.renameWorkflow), d = k((c) => c.duplicateWorkflow), a = k((c) => c.newWorkflow);
3426
+ function Pt() {
3427
+ const r = k((c) => c.showLibrary), l = k((c) => c.toggleLibrary), t = k((c) => c.savedWorkflows), n = k((c) => c.activeWorkflowId), i = k((c) => c.loadWorkflow), s = k((c) => c.deleteWorkflow), p = k((c) => c.renameWorkflow), d = k((c) => c.duplicateWorkflow), a = k((c) => c.newWorkflow);
3427
3428
  if (!r) return null;
3428
- const p = [...t].sort((c, u) => u.updatedAt - c.updatedAt);
3429
- return /* @__PURE__ */ s(U, { children: [
3429
+ const m = [...t].sort((c, u) => u.updatedAt - c.updatedAt);
3430
+ return /* @__PURE__ */ o(U, { children: [
3430
3431
  /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: l }),
3431
- /* @__PURE__ */ s("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: [
3432
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
3432
+ /* @__PURE__ */ o("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: [
3433
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
3433
3434
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: "My Workflows" }),
3434
3435
  /* @__PURE__ */ e(
3435
3436
  "button",
@@ -3448,7 +3449,7 @@ function At() {
3448
3449
  }
3449
3450
  )
3450
3451
  ] }),
3451
- /* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */ s(
3452
+ /* @__PURE__ */ e("div", { className: "p-4 border-b border-zinc-200 dark:border-zinc-700", children: /* @__PURE__ */ o(
3452
3453
  "button",
3453
3454
  {
3454
3455
  onClick: () => {
@@ -3469,7 +3470,7 @@ function At() {
3469
3470
  ]
3470
3471
  }
3471
3472
  ) }),
3472
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: p.length === 0 ? /* @__PURE__ */ s("div", { className: "text-center py-8", children: [
3473
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: m.length === 0 ? /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
3473
3474
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center", children: /* @__PURE__ */ e(
3474
3475
  "svg",
3475
3476
  {
@@ -3490,21 +3491,21 @@ function At() {
3490
3491
  ) }),
3491
3492
  /* @__PURE__ */ e("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No saved workflows yet" }),
3492
3493
  /* @__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" })
3493
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: p.map((c) => /* @__PURE__ */ e(
3494
- Wt,
3494
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: m.map((c) => /* @__PURE__ */ e(
3495
+ At,
3495
3496
  {
3496
3497
  workflow: c,
3497
3498
  isActive: c.id === n,
3498
3499
  onLoad: () => {
3499
- o(c.id), l();
3500
+ i(c.id), l();
3500
3501
  },
3501
- onDelete: () => i(c.id),
3502
- onRename: (u) => m(c.id, u),
3502
+ onDelete: () => s(c.id),
3503
+ onRename: (u) => p(c.id, u),
3503
3504
  onDuplicate: () => d(c.id)
3504
3505
  },
3505
3506
  c.id
3506
3507
  )) }) }),
3507
- /* @__PURE__ */ s("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-zinc-700 text-xs text-zinc-500 dark:text-zinc-400", children: [
3508
+ /* @__PURE__ */ o("div", { className: "px-4 py-3 border-t border-zinc-200 dark:border-zinc-700 text-xs text-zinc-500 dark:text-zinc-400", children: [
3508
3509
  t.length,
3509
3510
  " workflow",
3510
3511
  t.length !== 1 ? "s" : "",
@@ -3513,7 +3514,7 @@ function At() {
3513
3514
  ] })
3514
3515
  ] });
3515
3516
  }
3516
- const Pt = [
3517
+ const $t = [
3517
3518
  {
3518
3519
  id: "openai",
3519
3520
  name: "OpenAI",
@@ -3549,7 +3550,7 @@ const Pt = [
3549
3550
  placeholder: "sk-or-...",
3550
3551
  docsUrl: "https://openrouter.ai/keys"
3551
3552
  }
3552
- ], $t = [
3553
+ ], Mt = [
3553
3554
  {
3554
3555
  id: "ollama",
3555
3556
  name: "Ollama",
@@ -3565,21 +3566,21 @@ const Pt = [
3565
3566
  docsUrl: "https://lmstudio.ai"
3566
3567
  }
3567
3568
  ];
3568
- function Mt({ provider: r }) {
3569
- const l = O((h) => h.ai), t = O((h) => h.setAIProvider), n = l[r.id], o = (n == null ? void 0 : n.enabled) ?? !1, i = (n == null ? void 0 : n.apiKey) ?? "", [m, d] = I(i), [a, p] = I(!1), c = () => {
3569
+ function jt({ provider: r }) {
3570
+ const l = O((h) => h.ai), t = O((h) => h.setAIProvider), n = l[r.id], i = (n == null ? void 0 : n.enabled) ?? !1, s = (n == null ? void 0 : n.apiKey) ?? "", [p, d] = I(s), [a, m] = I(!1), c = () => {
3570
3571
  t(r.id, {
3571
- apiKey: m,
3572
- enabled: !o
3572
+ apiKey: p,
3573
+ enabled: !i
3573
3574
  });
3574
3575
  }, u = (h) => {
3575
3576
  d(h), t(r.id, {
3576
3577
  apiKey: h,
3577
- enabled: o
3578
+ enabled: i
3578
3579
  });
3579
3580
  };
3580
- return /* @__PURE__ */ s("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
3581
- /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
3582
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
3581
+ return /* @__PURE__ */ o("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
3582
+ /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
3583
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
3583
3584
  /* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
3584
3585
  /* @__PURE__ */ e(
3585
3586
  "a",
@@ -3593,12 +3594,12 @@ function Mt({ provider: r }) {
3593
3594
  )
3594
3595
  ] }),
3595
3596
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: r.description }),
3596
- /* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ s("div", { className: "relative flex-1", children: [
3597
+ /* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
3597
3598
  /* @__PURE__ */ e(
3598
3599
  "input",
3599
3600
  {
3600
3601
  type: a ? "text" : "password",
3601
- value: m,
3602
+ value: p,
3602
3603
  onChange: (h) => u(h.target.value),
3603
3604
  placeholder: r.placeholder,
3604
3605
  className: "w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-zinc-500"
@@ -3608,7 +3609,7 @@ function Mt({ provider: r }) {
3608
3609
  "button",
3609
3610
  {
3610
3611
  type: "button",
3611
- onClick: () => p(!a),
3612
+ onClick: () => m(!a),
3612
3613
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-zinc-300",
3613
3614
  children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: a ? /* @__PURE__ */ e(
3614
3615
  "path",
@@ -3635,32 +3636,32 @@ function Mt({ provider: r }) {
3635
3636
  "button",
3636
3637
  {
3637
3638
  onClick: c,
3638
- className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${o ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
3639
+ className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${i ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
3639
3640
  children: /* @__PURE__ */ e(
3640
3641
  "span",
3641
3642
  {
3642
- className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${o ? "translate-x-6" : "translate-x-1"}`
3643
+ className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${i ? "translate-x-6" : "translate-x-1"}`
3643
3644
  }
3644
3645
  )
3645
3646
  }
3646
3647
  ) })
3647
3648
  ] });
3648
3649
  }
3649
- function jt({ provider: r }) {
3650
- const l = O((c) => c.ai), t = O((c) => c.setAIProvider), n = l[r.id], o = (n == null ? void 0 : n.enabled) ?? !1, i = (n == null ? void 0 : n.baseUrl) ?? r.defaultUrl, [m, d] = I(i), a = () => {
3650
+ function Dt({ provider: r }) {
3651
+ const l = O((c) => c.ai), t = O((c) => c.setAIProvider), n = l[r.id], i = (n == null ? void 0 : n.enabled) ?? !1, s = (n == null ? void 0 : n.baseUrl) ?? r.defaultUrl, [p, d] = I(s), a = () => {
3651
3652
  t(r.id, {
3652
- baseUrl: m,
3653
- enabled: !o
3653
+ baseUrl: p,
3654
+ enabled: !i
3654
3655
  });
3655
- }, p = (c) => {
3656
+ }, m = (c) => {
3656
3657
  d(c), t(r.id, {
3657
3658
  baseUrl: c,
3658
- enabled: o
3659
+ enabled: i
3659
3660
  });
3660
3661
  };
3661
- return /* @__PURE__ */ s("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
3662
- /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
3663
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
3662
+ return /* @__PURE__ */ o("div", { className: "flex items-start gap-4 p-4 border border-gray-200 dark:border-zinc-700 rounded-lg", children: [
3663
+ /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
3664
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
3664
3665
  /* @__PURE__ */ e("span", { className: "font-medium text-gray-900 dark:text-white", children: r.name }),
3665
3666
  /* @__PURE__ */ e(
3666
3667
  "a",
@@ -3679,8 +3680,8 @@ function jt({ provider: r }) {
3679
3680
  "input",
3680
3681
  {
3681
3682
  type: "text",
3682
- value: m,
3683
- onChange: (c) => p(c.target.value),
3683
+ value: p,
3684
+ onChange: (c) => m(c.target.value),
3684
3685
  placeholder: r.defaultUrl,
3685
3686
  className: "w-full px-3 py-1.5 text-sm border border-gray-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-zinc-500"
3686
3687
  }
@@ -3690,22 +3691,22 @@ function jt({ provider: r }) {
3690
3691
  "button",
3691
3692
  {
3692
3693
  onClick: a,
3693
- className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${o ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
3694
+ className: `relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${i ? "bg-teal-600" : "bg-gray-300 dark:bg-zinc-600"}`,
3694
3695
  children: /* @__PURE__ */ e(
3695
3696
  "span",
3696
3697
  {
3697
- className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${o ? "translate-x-6" : "translate-x-1"}`
3698
+ className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${i ? "translate-x-6" : "translate-x-1"}`
3698
3699
  }
3699
3700
  )
3700
3701
  }
3701
3702
  ) })
3702
3703
  ] });
3703
3704
  }
3704
- function Dt() {
3705
+ function Tt() {
3705
3706
  const r = O((t) => t.showSettings), l = O((t) => t.closeSettings);
3706
- return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ s("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: [
3707
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-zinc-700", children: [
3708
- /* @__PURE__ */ s("div", { children: [
3707
+ return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ o("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: [
3708
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-zinc-700", children: [
3709
+ /* @__PURE__ */ o("div", { children: [
3709
3710
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "AI Provider Settings" }),
3710
3711
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-zinc-400 mt-0.5", children: "Configure your AI providers for vision and text generation" })
3711
3712
  ] }),
@@ -3726,16 +3727,16 @@ function Dt() {
3726
3727
  }
3727
3728
  )
3728
3729
  ] }),
3729
- /* @__PURE__ */ s("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
3730
- /* @__PURE__ */ s("section", { children: [
3730
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
3731
+ /* @__PURE__ */ o("section", { children: [
3731
3732
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Cloud Providers" }),
3732
- /* @__PURE__ */ e("div", { className: "space-y-3", children: Pt.map((t) => /* @__PURE__ */ e(Mt, { provider: t }, t.id)) })
3733
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: $t.map((t) => /* @__PURE__ */ e(jt, { provider: t }, t.id)) })
3733
3734
  ] }),
3734
- /* @__PURE__ */ s("section", { children: [
3735
+ /* @__PURE__ */ o("section", { children: [
3735
3736
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-gray-700 dark:text-zinc-300 mb-3", children: "Local Providers" }),
3736
- /* @__PURE__ */ e("div", { className: "space-y-3", children: $t.map((t) => /* @__PURE__ */ e(jt, { provider: t }, t.id)) })
3737
+ /* @__PURE__ */ e("div", { className: "space-y-3", children: Mt.map((t) => /* @__PURE__ */ e(Dt, { provider: t }, t.id)) })
3737
3738
  ] }),
3738
- /* @__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__ */ s("div", { className: "flex items-start gap-3", children: [
3739
+ /* @__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__ */ o("div", { className: "flex items-start gap-3", children: [
3739
3740
  /* @__PURE__ */ e(
3740
3741
  "svg",
3741
3742
  {
@@ -3754,7 +3755,7 @@ function Dt() {
3754
3755
  )
3755
3756
  }
3756
3757
  ),
3757
- /* @__PURE__ */ s("div", { children: [
3758
+ /* @__PURE__ */ o("div", { children: [
3758
3759
  /* @__PURE__ */ e("p", { className: "text-sm font-medium text-blue-900 dark:text-blue-300", children: "Your keys stay local" }),
3759
3760
  /* @__PURE__ */ e("p", { className: "text-sm text-blue-700 dark:text-blue-400 mt-1", children: "API keys are stored in your browser only and sent directly to providers. They never pass through our servers." })
3760
3761
  ] })
@@ -3770,30 +3771,30 @@ function Dt() {
3770
3771
  ) })
3771
3772
  ] }) }) : null;
3772
3773
  }
3773
- function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3774
- const [n, o] = I([]), [i, m] = I(""), [d, a] = I(!1), [p, c] = I(null), [u, h] = I(null), [f, w] = I(""), v = Q(null), y = Q(null);
3774
+ function Ut({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3775
+ const [n, i] = I([]), [s, p] = I(""), [d, a] = I(!1), [m, c] = I(null), [u, h] = I(null), [f, y] = I(""), v = Q(null), w = Q(null);
3775
3776
  D(() => {
3776
- r && u === null && Ke().then((x) => {
3777
- h(x.available), w(x.message);
3777
+ r && u === null && qe().then((x) => {
3778
+ h(x.available), y(x.message);
3778
3779
  }).catch(() => {
3779
- h(!1), w("Failed to check AI availability");
3780
+ h(!1), y("Failed to check AI availability");
3780
3781
  });
3781
3782
  }, [r, u]), D(() => {
3782
- r && y.current && y.current.focus();
3783
+ r && w.current && w.current.focus();
3783
3784
  }, [r]), D(() => {
3784
3785
  var x;
3785
3786
  (x = v.current) == null || x.scrollIntoView({ behavior: "smooth" });
3786
3787
  }, [n]);
3787
3788
  const b = L(async () => {
3788
- if (!i.trim() || d) return;
3789
+ if (!s.trim() || d) return;
3789
3790
  const x = {
3790
3791
  role: "user",
3791
- content: i.trim(),
3792
+ content: s.trim(),
3792
3793
  timestamp: Date.now()
3793
3794
  };
3794
- o((C) => [...C, x]), m(""), a(!0), c(null);
3795
+ i((C) => [...C, x]), p(""), a(!0), c(null);
3795
3796
  try {
3796
- const C = await _e({
3797
+ const C = await Ke({
3797
3798
  prompt: x.content,
3798
3799
  history: n
3799
3800
  }), S = {
@@ -3802,23 +3803,23 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3802
3803
  workflow: C.workflow,
3803
3804
  timestamp: Date.now()
3804
3805
  };
3805
- o((T) => [...T, S]), !C.success && C.error && c(C.error);
3806
+ i((T) => [...T, S]), !C.success && C.error && c(C.error);
3806
3807
  } catch (C) {
3807
3808
  c(C instanceof Error ? C.message : "Failed to generate workflow");
3808
3809
  } finally {
3809
3810
  a(!1);
3810
3811
  }
3811
- }, [i, d, n]), g = (x) => {
3812
+ }, [s, d, n]), g = (x) => {
3812
3813
  x.key === "Enter" && !x.shiftKey && (x.preventDefault(), b());
3813
- }, N = (x) => {
3814
+ }, z = (x) => {
3814
3815
  t(x), l();
3815
3816
  }, W = () => {
3816
- o([]), c(null);
3817
+ i([]), c(null);
3817
3818
  };
3818
- return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: /* @__PURE__ */ s("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl w-full max-w-2xl mx-4 h-[80vh] flex flex-col", children: [
3819
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
3820
- /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
3821
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
3819
+ return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: /* @__PURE__ */ o("div", { className: "bg-white dark:bg-zinc-800 rounded-lg shadow-xl w-full max-w-2xl mx-4 h-[80vh] flex flex-col", children: [
3820
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
3821
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-3", children: [
3822
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
3822
3823
  /* @__PURE__ */ e(
3823
3824
  "svg",
3824
3825
  {
@@ -3841,7 +3842,7 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3841
3842
  ] }),
3842
3843
  /* @__PURE__ */ e("span", { className: "text-xs bg-teal-100 dark:bg-teal-900 text-teal-700 dark:text-teal-300 px-2 py-0.5 rounded", children: "Gemini 3 Pro" })
3843
3844
  ] }),
3844
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
3845
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
3845
3846
  n.length > 0 && /* @__PURE__ */ e(
3846
3847
  "button",
3847
3848
  {
@@ -3877,8 +3878,8 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3877
3878
  )
3878
3879
  ] })
3879
3880
  ] }),
3880
- /* @__PURE__ */ s("div", { className: "flex-1 overflow-auto p-4 space-y-4", children: [
3881
- u === !1 && /* @__PURE__ */ e("div", { className: "bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4", children: /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
3881
+ /* @__PURE__ */ o("div", { className: "flex-1 overflow-auto p-4 space-y-4", children: [
3882
+ u === !1 && /* @__PURE__ */ e("div", { className: "bg-amber-50 dark:bg-amber-900/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4", children: /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
3882
3883
  /* @__PURE__ */ e(
3883
3884
  "svg",
3884
3885
  {
@@ -3897,13 +3898,13 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3897
3898
  )
3898
3899
  }
3899
3900
  ),
3900
- /* @__PURE__ */ s("div", { children: [
3901
+ /* @__PURE__ */ o("div", { children: [
3901
3902
  /* @__PURE__ */ e("p", { className: "font-medium text-amber-800 dark:text-amber-200", children: "AI Generation Not Available" }),
3902
3903
  /* @__PURE__ */ e("p", { className: "text-sm text-amber-700 dark:text-amber-300 mt-1", children: f }),
3903
3904
  /* @__PURE__ */ e("p", { className: "text-xs text-amber-600 dark:text-amber-400 mt-2", children: "Set GEMINI_API_KEY in your environment to enable this feature." })
3904
3905
  ] })
3905
3906
  ] }) }),
3906
- n.length === 0 && u !== !1 && /* @__PURE__ */ s("div", { className: "text-center py-8", children: [
3907
+ n.length === 0 && u !== !1 && /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
3907
3908
  /* @__PURE__ */ e("div", { className: "inline-flex items-center justify-center w-16 h-16 bg-teal-100 dark:bg-teal-900/50 rounded-full mb-4", children: /* @__PURE__ */ e(
3908
3909
  "svg",
3909
3910
  {
@@ -3930,10 +3931,10 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3930
3931
  "Generate an image with Gemini, then use it as a reference to create a variation with different lighting",
3931
3932
  "Create a product mockup: generate a minimalist logo, then composite it onto a t-shirt image",
3932
3933
  "Build an AI art pipeline: generate a base image, apply artistic style transfer, then upscale to 4K"
3933
- ].map((x, C) => /* @__PURE__ */ s(
3934
+ ].map((x, C) => /* @__PURE__ */ o(
3934
3935
  "button",
3935
3936
  {
3936
- onClick: () => m(x),
3937
+ onClick: () => p(x),
3937
3938
  className: "block w-full text-left text-sm px-4 py-2 bg-gray-100 dark:bg-zinc-700 hover:bg-gray-200 dark:hover:bg-zinc-600 rounded-lg text-gray-700 dark:text-zinc-300 transition-colors",
3938
3939
  children: [
3939
3940
  '"',
@@ -3948,32 +3949,32 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3948
3949
  "div",
3949
3950
  {
3950
3951
  className: `flex ${x.role === "user" ? "justify-end" : "justify-start"}`,
3951
- children: /* @__PURE__ */ s(
3952
+ children: /* @__PURE__ */ o(
3952
3953
  "div",
3953
3954
  {
3954
3955
  className: `max-w-[80%] rounded-lg px-4 py-3 ${x.role === "user" ? "bg-teal-600 text-white" : "bg-gray-100 dark:bg-zinc-700 text-gray-900 dark:text-white"}`,
3955
3956
  children: [
3956
3957
  /* @__PURE__ */ e("p", { className: "text-sm whitespace-pre-wrap", children: x.content }),
3957
- x.role === "assistant" && x.workflow && /* @__PURE__ */ s("div", { className: "mt-3 pt-3 border-t border-gray-200 dark:border-zinc-600", children: [
3958
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-2", children: [
3958
+ x.role === "assistant" && x.workflow && /* @__PURE__ */ o("div", { className: "mt-3 pt-3 border-t border-gray-200 dark:border-zinc-600", children: [
3959
+ /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-2", children: [
3959
3960
  /* @__PURE__ */ e("span", { className: "text-xs font-medium text-gray-500 dark:text-zinc-400", children: "Generated Workflow" }),
3960
3961
  /* @__PURE__ */ e(
3961
3962
  "button",
3962
3963
  {
3963
- onClick: () => N(x.workflow),
3964
+ onClick: () => z(x.workflow),
3964
3965
  className: "text-xs px-3 py-1 bg-teal-600 hover:bg-teal-700 text-white rounded transition-colors",
3965
3966
  children: "Apply to Canvas"
3966
3967
  }
3967
3968
  )
3968
3969
  ] }),
3969
- /* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 rounded p-2 text-xs", children: /* @__PURE__ */ s("div", { className: "space-y-1", children: [
3970
- x.workflow.nodes.map((S, T) => /* @__PURE__ */ s(
3970
+ /* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 rounded p-2 text-xs", children: /* @__PURE__ */ o("div", { className: "space-y-1", children: [
3971
+ x.workflow.nodes.map((S, T) => /* @__PURE__ */ o(
3971
3972
  "div",
3972
3973
  {
3973
3974
  className: "flex items-center gap-2 text-gray-600 dark:text-zinc-300",
3974
3975
  children: [
3975
3976
  /* @__PURE__ */ e("span", { className: "font-mono bg-gray-100 dark:bg-zinc-700 px-1.5 py-0.5 rounded", children: S.nodeType.split(":").pop() }),
3976
- S.label && /* @__PURE__ */ s("span", { className: "text-gray-400", children: [
3977
+ S.label && /* @__PURE__ */ o("span", { className: "text-gray-400", children: [
3977
3978
  "(",
3978
3979
  S.label,
3979
3980
  ")"
@@ -3982,7 +3983,7 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3982
3983
  },
3983
3984
  T
3984
3985
  )),
3985
- x.workflow.edges.length > 0 && /* @__PURE__ */ s("div", { className: "text-gray-400 dark:text-zinc-500 pt-1", children: [
3986
+ x.workflow.edges.length > 0 && /* @__PURE__ */ o("div", { className: "text-gray-400 dark:text-zinc-500 pt-1", children: [
3986
3987
  x.workflow.edges.length,
3987
3988
  " connection",
3988
3989
  x.workflow.edges.length !== 1 ? "s" : ""
@@ -3995,8 +3996,8 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
3995
3996
  },
3996
3997
  C
3997
3998
  )),
3998
- d && /* @__PURE__ */ e("div", { className: "flex justify-start", children: /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-700 rounded-lg px-4 py-3", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
3999
- /* @__PURE__ */ s("div", { className: "flex space-x-1", children: [
3999
+ d && /* @__PURE__ */ e("div", { className: "flex justify-start", children: /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-700 rounded-lg px-4 py-3", children: /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
4000
+ /* @__PURE__ */ o("div", { className: "flex space-x-1", children: [
4000
4001
  /* @__PURE__ */ e("div", { className: "w-2 h-2 bg-gray-400 dark:bg-zinc-500 rounded-full animate-bounce" }),
4001
4002
  /* @__PURE__ */ e(
4002
4003
  "div",
@@ -4015,17 +4016,17 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
4015
4016
  ] }),
4016
4017
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: "Generating workflow..." })
4017
4018
  ] }) }) }),
4018
- p && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg p-3", children: /* @__PURE__ */ e("p", { className: "text-sm text-red-700 dark:text-red-300", children: p }) }),
4019
+ m && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg p-3", children: /* @__PURE__ */ e("p", { className: "text-sm text-red-700 dark:text-red-300", children: m }) }),
4019
4020
  /* @__PURE__ */ e("div", { ref: v })
4020
4021
  ] }),
4021
- /* @__PURE__ */ s("div", { className: "border-t border-gray-200 dark:border-zinc-700 p-4", children: [
4022
- /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
4022
+ /* @__PURE__ */ o("div", { className: "border-t border-gray-200 dark:border-zinc-700 p-4", children: [
4023
+ /* @__PURE__ */ o("div", { className: "flex gap-2", children: [
4023
4024
  /* @__PURE__ */ e(
4024
4025
  "textarea",
4025
4026
  {
4026
- ref: y,
4027
- value: i,
4028
- onChange: (x) => m(x.target.value),
4027
+ ref: w,
4028
+ value: s,
4029
+ onChange: (x) => p(x.target.value),
4029
4030
  onKeyDown: g,
4030
4031
  placeholder: u === !1 ? "AI generation not available" : "Describe what workflow you want to create...",
4031
4032
  disabled: d || u === !1,
@@ -4037,7 +4038,7 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
4037
4038
  "button",
4038
4039
  {
4039
4040
  onClick: b,
4040
- disabled: !i.trim() || d || u === !1,
4041
+ disabled: !s.trim() || d || u === !1,
4041
4042
  className: "self-end px-4 py-2 bg-teal-600 hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded-lg transition-colors",
4042
4043
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
4043
4044
  "path",
@@ -4055,37 +4056,37 @@ function Tt({ isOpen: r, onClose: l, onApplyWorkflow: t }) {
4055
4056
  ] })
4056
4057
  ] }) }) : null;
4057
4058
  }
4058
- function Ut() {
4059
- const { screenToFlowPosition: r } = Ae(), l = k((o) => o.addNode), t = L(
4060
- (o) => {
4061
- o.preventDefault();
4062
- const i = o.dataTransfer.getData("application/json");
4063
- if (i)
4059
+ function Ot() {
4060
+ const { screenToFlowPosition: r } = Pe(), l = k((i) => i.addNode), t = L(
4061
+ (i) => {
4062
+ i.preventDefault();
4063
+ const s = i.dataTransfer.getData("application/json");
4064
+ if (s)
4064
4065
  try {
4065
- const m = JSON.parse(i), d = r({
4066
- x: o.clientX,
4067
- y: o.clientY
4066
+ const p = JSON.parse(s), d = r({
4067
+ x: i.clientX,
4068
+ y: i.clientY
4068
4069
  });
4069
- l(m, d);
4070
- } catch (m) {
4071
- console.error("Failed to parse dropped node:", m);
4070
+ l(p, d);
4071
+ } catch (p) {
4072
+ console.error("Failed to parse dropped node:", p);
4072
4073
  }
4073
4074
  },
4074
4075
  [l, r]
4075
- ), n = L((o) => {
4076
- o.preventDefault(), o.dataTransfer.dropEffect = "move";
4076
+ ), n = L((i) => {
4077
+ i.preventDefault(), i.dataTransfer.dropEffect = "move";
4077
4078
  }, []);
4078
- return /* @__PURE__ */ e("div", { className: "flex-1", onDrop: t, onDragOver: n, children: /* @__PURE__ */ e(at, {}) });
4079
+ return /* @__PURE__ */ e("div", { className: "flex-1", onDrop: t, onDragOver: n, children: /* @__PURE__ */ e(nt, {}) });
4079
4080
  }
4080
- function Ht() {
4081
- const [r, l] = I("editor"), [t, n] = I(!1), o = k((a) => a.loadTemplate), i = k((a) => a.loadGeneratedWorkflow);
4081
+ function _t() {
4082
+ const [r, l] = I("editor"), [t, n] = I(!1), i = k((a) => a.loadTemplate), s = k((a) => a.loadGeneratedWorkflow);
4082
4083
  D(() => {
4083
- const p = new URLSearchParams(window.location.search).get("template");
4084
- if (p) {
4085
- const c = de(p);
4086
- c && (o(c), window.history.replaceState({}, "", window.location.pathname));
4084
+ const m = new URLSearchParams(window.location.search).get("template");
4085
+ if (m) {
4086
+ const c = ce(m);
4087
+ c && (i(c), window.history.replaceState({}, "", window.location.pathname));
4087
4088
  }
4088
- }, [o]), D(() => {
4089
+ }, [i]), D(() => {
4089
4090
  const a = () => {
4090
4091
  l("editor");
4091
4092
  };
@@ -4093,33 +4094,33 @@ function Ht() {
4093
4094
  window.removeEventListener("workflow-loaded", a);
4094
4095
  };
4095
4096
  }, []);
4096
- const m = L(
4097
+ const p = L(
4097
4098
  (a) => {
4098
- const p = de(a);
4099
- p && (o(p), l("editor"));
4099
+ const m = ce(a);
4100
+ m && (i(m), l("editor"));
4100
4101
  },
4101
- [o]
4102
+ [i]
4102
4103
  ), d = L(
4103
4104
  (a) => {
4104
- i(a), l("editor");
4105
+ s(a), l("editor");
4105
4106
  },
4106
- [i]
4107
+ [s]
4107
4108
  );
4108
- return /* @__PURE__ */ s(We, { children: [
4109
- /* @__PURE__ */ e(Dt, {}),
4109
+ return /* @__PURE__ */ o(Ae, { children: [
4110
+ /* @__PURE__ */ e(Tt, {}),
4110
4111
  /* @__PURE__ */ e(
4111
- Tt,
4112
+ Ut,
4112
4113
  {
4113
4114
  isOpen: t,
4114
4115
  onClose: () => n(!1),
4115
4116
  onApplyWorkflow: d
4116
4117
  }
4117
4118
  ),
4118
- /* @__PURE__ */ e(At, {}),
4119
- /* @__PURE__ */ s("div", { className: "h-screen flex flex-col bg-gray-100 dark:bg-zinc-900", children: [
4120
- /* @__PURE__ */ e(gt, {}),
4121
- /* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
4122
- /* @__PURE__ */ s("div", { className: "flex", children: [
4119
+ /* @__PURE__ */ e(Pt, {}),
4120
+ /* @__PURE__ */ o("div", { className: "h-screen flex flex-col bg-gray-100 dark:bg-zinc-900", children: [
4121
+ /* @__PURE__ */ e(ht, {}),
4122
+ /* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
4123
+ /* @__PURE__ */ o("div", { className: "flex", children: [
4123
4124
  /* @__PURE__ */ e(
4124
4125
  "button",
4125
4126
  {
@@ -4145,7 +4146,7 @@ function Ht() {
4145
4146
  }
4146
4147
  )
4147
4148
  ] }),
4148
- /* @__PURE__ */ s(
4149
+ /* @__PURE__ */ o(
4149
4150
  "button",
4150
4151
  {
4151
4152
  onClick: () => n(!0),
@@ -4165,34 +4166,34 @@ function Ht() {
4165
4166
  }
4166
4167
  )
4167
4168
  ] }) }),
4168
- /* @__PURE__ */ s("div", { className: "flex-1 flex overflow-hidden", children: [
4169
- r === "editor" && /* @__PURE__ */ s(U, { children: [
4170
- /* @__PURE__ */ e(ot, {}),
4171
- /* @__PURE__ */ e(Ut, {}),
4172
- /* @__PURE__ */ e(st, {})
4169
+ /* @__PURE__ */ o("div", { className: "flex-1 flex overflow-hidden", children: [
4170
+ r === "editor" && /* @__PURE__ */ o(U, { children: [
4171
+ /* @__PURE__ */ e(st, {}),
4172
+ /* @__PURE__ */ e(Ot, {}),
4173
+ /* @__PURE__ */ e(it, {})
4173
4174
  ] }),
4174
- r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(ht, {}) }),
4175
- r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(St, { onSelect: m }) })
4175
+ r === "gallery" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(xt, {}) }),
4176
+ r === "templates" && /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(Lt, { onSelect: p }) })
4176
4177
  ] })
4177
4178
  ] })
4178
4179
  ] });
4179
4180
  }
4180
4181
  export {
4181
- Tt as AIChat,
4182
- Dt as AISettings,
4183
- Ht as App,
4184
- ht as Gallery,
4185
- st as NodeInspector,
4186
- ot as NodePalette,
4187
- St as TemplateGallery,
4188
- gt as Toolbar,
4189
- nt as UploadGallery,
4190
- at as WorkflowEditor,
4191
- At as WorkflowLibrary,
4192
- It as getCategories,
4193
- de as getTemplateById,
4194
- Gt as getTemplatesByCategory,
4195
- Ft as searchTemplates,
4182
+ Ut as AIChat,
4183
+ Tt as AISettings,
4184
+ _t as App,
4185
+ xt as Gallery,
4186
+ it as NodeInspector,
4187
+ st as NodePalette,
4188
+ Lt as TemplateGallery,
4189
+ ht as Toolbar,
4190
+ ot as UploadGallery,
4191
+ nt as WorkflowEditor,
4192
+ Pt as WorkflowLibrary,
4193
+ St as getCategories,
4194
+ ce as getTemplateById,
4195
+ Ft as getTemplatesByCategory,
4196
+ Ht as searchTemplates,
4196
4197
  H as templates,
4197
4198
  k as useWorkflowStore
4198
4199
  };