@teamflojo/floimg-studio-ui 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsxs as i, jsx as e, Fragment as G } from "react/jsx-runtime";
2
- import { memo as O, useRef as te, useCallback as L, useState as C, useEffect as j, useMemo as de } from "react";
3
- import ze, { Handle as P, Position as M, applyNodeChanges as Ce, applyEdgeChanges as Ie, MarkerType as Se, Background as Ae, Controls as Le, MiniMap as We, ReactFlowProvider as Pe, useReactFlow as Me } from "reactflow";
2
+ import { memo as O, useRef as re, useCallback as W, useState as I, useEffect as j, useMemo as le } from "react";
3
+ import ze, { Handle as P, Position as T, applyNodeChanges as Ce, applyEdgeChanges as Ie, MarkerType as Se, Background as Ae, Controls as Le, MiniMap as We, ReactFlowProvider as Pe, useReactFlow as Te } from "reactflow";
4
4
  import { create as ue } from "zustand";
5
5
  import { useQuery as K } from "@tanstack/react-query";
6
- function Te(r, d) {
6
+ function Me(r, d) {
7
7
  let t;
8
8
  try {
9
9
  t = r();
@@ -20,12 +20,12 @@ function Te(r, d) {
20
20
  removeItem: (s) => t.removeItem(s)
21
21
  };
22
22
  }
23
- const re = (r) => (d) => {
23
+ const ae = (r) => (d) => {
24
24
  try {
25
25
  const t = r(d);
26
26
  return t instanceof Promise ? t : {
27
27
  then(o) {
28
- return re(o)(t);
28
+ return ae(o)(t);
29
29
  },
30
30
  catch(o) {
31
31
  return this;
@@ -37,18 +37,18 @@ const re = (r) => (d) => {
37
37
  return this;
38
38
  },
39
39
  catch(o) {
40
- return re(o)(t);
40
+ return ae(o)(t);
41
41
  }
42
42
  };
43
43
  }
44
44
  }, De = (r, d) => (t, o, s) => {
45
45
  let n = {
46
- storage: Te(() => localStorage),
47
- partialize: (w) => w,
46
+ storage: Me(() => localStorage),
47
+ partialize: (y) => y,
48
48
  version: 0,
49
- merge: (w, v) => ({
50
- ...v,
51
- ...w
49
+ merge: (y, k) => ({
50
+ ...k,
51
+ ...y
52
52
  }),
53
53
  ...d
54
54
  }, p = !1;
@@ -56,88 +56,88 @@ const re = (r) => (d) => {
56
56
  let m = n.storage;
57
57
  if (!m)
58
58
  return r(
59
- (...w) => {
59
+ (...y) => {
60
60
  console.warn(
61
61
  `[zustand persist middleware] Unable to update item '${n.name}', the given storage is currently unavailable.`
62
- ), t(...w);
62
+ ), t(...y);
63
63
  },
64
64
  o,
65
65
  s
66
66
  );
67
67
  const c = () => {
68
- const w = n.partialize({ ...o() });
68
+ const y = n.partialize({ ...o() });
69
69
  return m.setItem(n.name, {
70
- state: w,
70
+ state: y,
71
71
  version: n.version
72
72
  });
73
- }, g = s.setState;
74
- s.setState = (w, v) => (g(w, v), c());
73
+ }, u = s.setState;
74
+ s.setState = (y, k) => (u(y, k), c());
75
75
  const h = r(
76
- (...w) => (t(...w), c()),
76
+ (...y) => (t(...y), c()),
77
77
  o,
78
78
  s
79
79
  );
80
80
  s.getInitialState = () => h;
81
- let b;
82
- const k = () => {
83
- var w, v;
81
+ let x;
82
+ const v = () => {
83
+ var y, k;
84
84
  if (!m) return;
85
- p = !1, l.forEach((u) => {
86
- var N;
87
- return u((N = o()) != null ? N : h);
85
+ p = !1, l.forEach((g) => {
86
+ var f;
87
+ return g((f = o()) != null ? f : h);
88
88
  });
89
- const f = ((v = n.onRehydrateStorage) == null ? void 0 : v.call(n, (w = o()) != null ? w : h)) || void 0;
90
- return re(m.getItem.bind(m))(n.name).then((u) => {
91
- if (u)
92
- if (typeof u.version == "number" && u.version !== n.version) {
89
+ const z = ((k = n.onRehydrateStorage) == null ? void 0 : k.call(n, (y = o()) != null ? y : h)) || void 0;
90
+ return ae(m.getItem.bind(m))(n.name).then((g) => {
91
+ if (g)
92
+ if (typeof g.version == "number" && g.version !== n.version) {
93
93
  if (n.migrate) {
94
- const N = n.migrate(
95
- u.state,
96
- u.version
94
+ const f = n.migrate(
95
+ g.state,
96
+ g.version
97
97
  );
98
- return N instanceof Promise ? N.then((W) => [!0, W]) : [!0, N];
98
+ return f instanceof Promise ? f.then((C) => [!0, C]) : [!0, f];
99
99
  }
100
100
  console.error(
101
101
  "State loaded from storage couldn't be migrated since no migrate function was provided"
102
102
  );
103
103
  } else
104
- return [!1, u.state];
104
+ return [!1, g.state];
105
105
  return [!1, void 0];
106
- }).then((u) => {
107
- var N;
108
- const [W, y] = u;
109
- if (b = n.merge(
110
- y,
111
- (N = o()) != null ? N : h
112
- ), t(b, !0), W)
106
+ }).then((g) => {
107
+ var f;
108
+ const [C, b] = g;
109
+ if (x = n.merge(
110
+ b,
111
+ (f = o()) != null ? f : h
112
+ ), t(x, !0), C)
113
113
  return c();
114
114
  }).then(() => {
115
- f == null || f(b, void 0), b = o(), p = !0, a.forEach((u) => u(b));
116
- }).catch((u) => {
117
- f == null || f(void 0, u);
115
+ z == null || z(x, void 0), x = o(), p = !0, a.forEach((g) => g(x));
116
+ }).catch((g) => {
117
+ z == null || z(void 0, g);
118
118
  });
119
119
  };
120
120
  return s.persist = {
121
- setOptions: (w) => {
121
+ setOptions: (y) => {
122
122
  n = {
123
123
  ...n,
124
- ...w
125
- }, w.storage && (m = w.storage);
124
+ ...y
125
+ }, y.storage && (m = y.storage);
126
126
  },
127
127
  clearStorage: () => {
128
128
  m == null || m.removeItem(n.name);
129
129
  },
130
130
  getOptions: () => n,
131
- rehydrate: () => k(),
131
+ rehydrate: () => v(),
132
132
  hasHydrated: () => p,
133
- onHydrate: (w) => (l.add(w), () => {
134
- l.delete(w);
133
+ onHydrate: (y) => (l.add(y), () => {
134
+ l.delete(y);
135
135
  }),
136
- onFinishHydration: (w) => (a.add(w), () => {
137
- a.delete(w);
136
+ onFinishHydration: (y) => (a.add(y), () => {
137
+ a.delete(y);
138
138
  })
139
- }, n.skipHydration || k(), b || h;
140
- }, he = De, T = "/api";
139
+ }, n.skipHydration || v(), x || h;
140
+ }, he = De, M = "/api";
141
141
  async function B(r, d) {
142
142
  const t = await fetch(r, {
143
143
  ...d,
@@ -153,38 +153,38 @@ async function B(r, d) {
153
153
  return t.json();
154
154
  }
155
155
  async function Ue() {
156
- return B(`${T}/nodes/generators`);
156
+ return B(`${M}/nodes/generators`);
157
157
  }
158
158
  async function Be() {
159
- return B(`${T}/nodes/transforms`);
159
+ return B(`${M}/nodes/transforms`);
160
160
  }
161
161
  async function je() {
162
- return B(`${T}/nodes/text`);
162
+ return B(`${M}/nodes/text`);
163
163
  }
164
- async function $e() {
165
- return B(`${T}/nodes/vision`);
164
+ async function Re() {
165
+ return B(`${M}/nodes/vision`);
166
166
  }
167
- async function Re(r, d, t) {
168
- return B(`${T}/execute/sync`, {
167
+ async function $e(r, d, t) {
168
+ return B(`${M}/execute/sync`, {
169
169
  method: "POST",
170
170
  body: JSON.stringify({ nodes: r, edges: d, aiProviders: t })
171
171
  });
172
172
  }
173
173
  async function Ee(r, d) {
174
- return B(`${T}/export/yaml`, {
174
+ return B(`${M}/export/yaml`, {
175
175
  method: "POST",
176
176
  body: JSON.stringify({ nodes: r, edges: d })
177
177
  });
178
178
  }
179
179
  async function Ge() {
180
- return B(`${T}/images`);
180
+ return B(`${M}/images`);
181
181
  }
182
- function le(r) {
183
- return `${T}/images/${r}/blob`;
182
+ function te(r) {
183
+ return `${M}/images/${r}/blob`;
184
184
  }
185
185
  async function qe(r) {
186
186
  try {
187
- return await B(`${T}/images/${r}/workflow`);
187
+ return await B(`${M}/images/${r}/workflow`);
188
188
  } catch {
189
189
  return null;
190
190
  }
@@ -192,7 +192,7 @@ async function qe(r) {
192
192
  async function Oe(r) {
193
193
  const d = new FormData();
194
194
  d.append("file", r);
195
- const t = await fetch(`${T}/uploads`, {
195
+ const t = await fetch(`${M}/uploads`, {
196
196
  method: "POST",
197
197
  body: d
198
198
  });
@@ -203,38 +203,38 @@ async function Oe(r) {
203
203
  return t.json();
204
204
  }
205
205
  async function Fe() {
206
- return B(`${T}/uploads`);
206
+ return B(`${M}/uploads`);
207
207
  }
208
208
  async function Ve(r) {
209
- const d = await fetch(`${T}/uploads/${r}`, {
209
+ const d = await fetch(`${M}/uploads/${r}`, {
210
210
  method: "DELETE"
211
211
  });
212
212
  if (!d.ok)
213
213
  throw new Error(`Failed to delete upload: ${d.status}`);
214
214
  }
215
215
  function fe(r) {
216
- return `${T}/uploads/${r}/blob`;
216
+ return `${M}/uploads/${r}/blob`;
217
217
  }
218
218
  async function He(r) {
219
- return B(`${T}/import`, {
219
+ return B(`${M}/import`, {
220
220
  method: "POST",
221
221
  body: JSON.stringify({ yaml: r })
222
222
  });
223
223
  }
224
224
  async function Ke(r) {
225
- return B(`${T}/import/validate`, {
225
+ return B(`${M}/import/validate`, {
226
226
  method: "POST",
227
227
  body: JSON.stringify({ yaml: r })
228
228
  });
229
229
  }
230
230
  async function _e(r) {
231
- return B(`${T}/generate/workflow`, {
231
+ return B(`${M}/generate/workflow`, {
232
232
  method: "POST",
233
233
  body: JSON.stringify(r)
234
234
  });
235
235
  }
236
236
  async function Qe() {
237
- return B(`${T}/generate/status`);
237
+ return B(`${M}/generate/status`);
238
238
  }
239
239
  const ce = "http://localhost:11434", me = "http://localhost:1234", q = ue()(
240
240
  he(
@@ -287,7 +287,7 @@ function pe() {
287
287
  const r = Date.now(), d = Math.random().toString(36).substring(2, 8);
288
288
  return `wf_${r}_${d}`;
289
289
  }
290
- const x = ue()(
290
+ const w = ue()(
291
291
  he(
292
292
  (r, d) => ({
293
293
  nodes: [],
@@ -421,10 +421,10 @@ const x = ue()(
421
421
  params: J(t)
422
422
  };
423
423
  else {
424
- const c = ((l = t.params) == null ? void 0 : l.properties) || {}, g = ((a = c.provider) == null ? void 0 : a.default) || "filesystem";
424
+ const c = ((l = t.params) == null ? void 0 : l.properties) || {}, u = ((a = c.provider) == null ? void 0 : a.default) || "filesystem";
425
425
  n = {
426
426
  destination: ((m = c.destination) == null ? void 0 : m.default) || "./output/image.png",
427
- provider: g
427
+ provider: u
428
428
  };
429
429
  }
430
430
  const p = {
@@ -518,7 +518,7 @@ const x = ue()(
518
518
  }
519
519
  });
520
520
  try {
521
- const a = await Re(s, n, p), m = {};
521
+ const a = await $e(s, n, p), m = {};
522
522
  for (const c of t)
523
523
  m[c.id] = a.status === "completed" ? "completed" : "error";
524
524
  a.status === "completed" ? r({
@@ -644,7 +644,7 @@ const x = ue()(
644
644
  } = d(), m = Date.now();
645
645
  if (n) {
646
646
  const c = l.map(
647
- (g) => g.id === n ? { ...g, name: t || p, nodes: o, edges: s, updatedAt: m } : g
647
+ (u) => u.id === n ? { ...u, name: t || p, nodes: o, edges: s, updatedAt: m } : u
648
648
  );
649
649
  return r({
650
650
  savedWorkflows: c,
@@ -652,7 +652,7 @@ const x = ue()(
652
652
  hasUnsavedChanges: !1
653
653
  }), n;
654
654
  } else {
655
- const c = pe(), g = {
655
+ const c = pe(), u = {
656
656
  id: c,
657
657
  name: t || p,
658
658
  nodes: o,
@@ -662,7 +662,7 @@ const x = ue()(
662
662
  templateId: a || void 0
663
663
  };
664
664
  return r({
665
- savedWorkflows: [...l, g],
665
+ savedWorkflows: [...l, u],
666
666
  activeWorkflowId: c,
667
667
  activeWorkflowName: t || p,
668
668
  hasUnsavedChanges: !1
@@ -735,73 +735,73 @@ const x = ue()(
735
735
  },
736
736
  loadGeneratedWorkflow: (t) => {
737
737
  const o = /* @__PURE__ */ new Map(), s = 250, n = 150, p = 3, l = t.nodes.map((m, c) => {
738
- const g = V();
739
- o.set(m.id, g);
740
- const h = m.nodeType.split(":"), b = h[0], k = Math.floor(c / p), v = {
738
+ const u = V();
739
+ o.set(m.id, u);
740
+ const h = m.nodeType.split(":"), x = h[0], v = Math.floor(c / p), k = {
741
741
  x: 100 + c % p * s,
742
- y: 100 + k * n
742
+ y: 100 + v * n
743
743
  };
744
- let f;
745
- if (b === "generator")
746
- f = {
744
+ let z;
745
+ if (x === "generator")
746
+ z = {
747
747
  generatorName: h.slice(1).join(":"),
748
748
  params: m.parameters,
749
749
  isAI: !0
750
750
  // Assume AI since we're generating from AI
751
751
  };
752
- else if (b === "transform") {
753
- const u = h[1];
754
- f = {
752
+ else if (x === "transform") {
753
+ const g = h[1];
754
+ z = {
755
755
  operation: h.slice(2).join(":"),
756
- providerName: u,
756
+ providerName: g,
757
757
  params: m.parameters
758
758
  };
759
- } else if (b === "input")
760
- f = {
759
+ } else if (x === "input")
760
+ z = {
761
761
  uploadId: void 0,
762
762
  filename: void 0,
763
763
  mime: void 0
764
764
  };
765
- else if (b === "vision")
766
- f = {
765
+ else if (x === "vision")
766
+ z = {
767
767
  providerName: h.slice(1).join(":"),
768
768
  params: m.parameters
769
769
  };
770
- else if (b === "text") {
771
- const u = h.slice(1).join(":"), N = m.parameters.jsonSchema, W = N != null && N.properties ? {
770
+ else if (x === "text") {
771
+ const g = h.slice(1).join(":"), f = m.parameters.jsonSchema, C = f != null && f.properties ? {
772
772
  type: "object",
773
773
  properties: Object.fromEntries(
774
- Object.entries(N.properties).map(([y, A]) => [
775
- y,
774
+ Object.entries(f.properties).map(([b, L]) => [
775
+ b,
776
776
  {
777
- type: A.type || "string",
778
- description: A.description
777
+ type: L.type || "string",
778
+ description: L.description
779
779
  }
780
780
  ])
781
781
  )
782
782
  } : void 0;
783
- f = {
784
- providerName: u,
783
+ z = {
784
+ providerName: g,
785
785
  params: m.parameters,
786
- outputSchema: W
786
+ outputSchema: C
787
787
  };
788
788
  } else
789
- f = {
789
+ z = {
790
790
  destination: m.parameters.destination || "./output/image.png",
791
791
  provider: m.parameters.provider || "filesystem"
792
792
  };
793
793
  return {
794
- id: g,
795
- type: b,
796
- position: v,
797
- data: f
794
+ id: u,
795
+ type: x,
796
+ position: k,
797
+ data: z
798
798
  };
799
799
  }), a = t.edges.map((m) => {
800
- const c = o.get(m.source) || m.source, g = o.get(m.target) || m.target, h = [m.sourceHandle, m.targetHandle].filter(Boolean).join("_");
800
+ const c = o.get(m.source) || m.source, u = o.get(m.target) || m.target, h = [m.sourceHandle, m.targetHandle].filter(Boolean).join("_");
801
801
  return {
802
- id: h ? `edge_${c}_${g}_${h}` : `edge_${c}_${g}`,
802
+ id: h ? `edge_${c}_${u}_${h}` : `edge_${c}_${u}`,
803
803
  source: c,
804
- target: g,
804
+ target: u,
805
805
  sourceHandle: m.sourceHandle ?? void 0,
806
806
  targetHandle: m.targetHandle ?? void 0
807
807
  };
@@ -846,8 +846,8 @@ function J(r) {
846
846
  function F(r) {
847
847
  return r === "running" ? "border-yellow-400 animate-pulse" : r === "completed" ? "border-green-500" : r === "error" ? "border-red-500" : "";
848
848
  }
849
- function ae({ nodeId: r, color: d }) {
850
- const t = x((s) => s.previewVisible[r] !== !1), o = x((s) => s.togglePreview);
849
+ function oe({ nodeId: r, color: d }) {
850
+ const t = w((s) => s.previewVisible[r] !== !1), o = w((s) => s.togglePreview);
851
851
  return /* @__PURE__ */ e(
852
852
  "button",
853
853
  {
@@ -881,7 +881,7 @@ const Ye = O(function({
881
881
  data: t,
882
882
  selected: o
883
883
  }) {
884
- const s = x((g) => g.execution.previews[d]), n = x((g) => g.execution.nodeStatus[d]), p = x((g) => g.previewVisible[d] !== !1), a = F(n) || (o ? "border-blue-500" : "border-blue-200"), m = t.isAI, c = t.acceptsReferenceImages;
884
+ const s = w((u) => u.execution.previews[d]), n = w((u) => u.execution.nodeStatus[d]), p = w((u) => u.previewVisible[d] !== !1), a = F(n) || (o ? "border-blue-500" : "border-blue-200"), m = t.isAI, c = t.acceptsReferenceImages;
885
885
  return /* @__PURE__ */ i(
886
886
  "div",
887
887
  {
@@ -891,7 +891,7 @@ const Ye = O(function({
891
891
  P,
892
892
  {
893
893
  type: "target",
894
- position: M.Top,
894
+ position: T.Top,
895
895
  id: "text",
896
896
  className: "w-3 h-3 !bg-pink-500",
897
897
  title: "Text input (optional prompt from text/vision node)"
@@ -901,7 +901,7 @@ const Ye = O(function({
901
901
  P,
902
902
  {
903
903
  type: "target",
904
- position: M.Left,
904
+ position: T.Left,
905
905
  id: "references",
906
906
  className: "w-3 h-3 !bg-violet-500",
907
907
  style: { top: "50%" },
@@ -913,17 +913,17 @@ const Ye = O(function({
913
913
  /* @__PURE__ */ i("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
- /* @__PURE__ */ e(ae, { nodeId: d, color: "text-blue-500 dark:text-blue-400" })
916
+ /* @__PURE__ */ e(oe, { nodeId: d, color: "text-blue-500 dark:text-blue-400" })
917
917
  ] }),
918
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(([, g]) => typeof g != "object" || g === null).slice(0, 2).map(([g, h]) => /* @__PURE__ */ i("div", { className: "truncate", children: [
921
- g,
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__ */ i("div", { className: "truncate", children: [
921
+ u,
922
922
  ": ",
923
923
  String(h).slice(0, 20)
924
- ] }, g)) })
924
+ ] }, u)) })
925
925
  ] }),
926
- /* @__PURE__ */ e(P, { type: "source", position: M.Right, className: "w-3 h-3 !bg-blue-500" })
926
+ /* @__PURE__ */ e(P, { type: "source", position: T.Right, className: "w-3 h-3 !bg-blue-500" })
927
927
  ]
928
928
  }
929
929
  );
@@ -932,7 +932,7 @@ const Ye = O(function({
932
932
  data: t,
933
933
  selected: o
934
934
  }) {
935
- const s = x((g) => g.execution.previews[d]), n = x((g) => g.execution.nodeStatus[d]), p = x((g) => g.previewVisible[d] !== !1), a = F(n) || (o ? "border-teal-500" : "border-teal-200"), m = t.isAI, c = t.acceptsReferenceImages;
935
+ const s = w((u) => u.execution.previews[d]), n = w((u) => u.execution.nodeStatus[d]), p = w((u) => u.previewVisible[d] !== !1), a = F(n) || (o ? "border-teal-500" : "border-teal-200"), m = t.isAI, c = t.acceptsReferenceImages;
936
936
  return /* @__PURE__ */ i(
937
937
  "div",
938
938
  {
@@ -942,18 +942,18 @@ const Ye = O(function({
942
942
  P,
943
943
  {
944
944
  type: "target",
945
- position: M.Top,
945
+ position: T.Top,
946
946
  id: "text",
947
947
  className: "w-3 h-3 !bg-pink-500",
948
948
  title: "Text input (optional prompt from text/vision node)"
949
949
  }
950
950
  ),
951
- /* @__PURE__ */ e(P, { type: "target", position: M.Left, id: "image", className: "w-3 h-3 !bg-teal-500" }),
951
+ /* @__PURE__ */ e(P, { type: "target", position: T.Left, id: "image", className: "w-3 h-3 !bg-teal-500" }),
952
952
  c && /* @__PURE__ */ e(
953
953
  P,
954
954
  {
955
955
  type: "target",
956
- position: M.Bottom,
956
+ position: T.Bottom,
957
957
  id: "references",
958
958
  className: "w-3 h-3 !bg-violet-500",
959
959
  title: `Reference images (up to ${t.maxReferenceImages || 13})`
@@ -981,7 +981,7 @@ const Ye = O(function({
981
981
  }
982
982
  ),
983
983
  /* @__PURE__ */ e(
984
- ae,
984
+ oe,
985
985
  {
986
986
  nodeId: d,
987
987
  color: m ? "text-purple-500 dark:text-purple-400" : "text-teal-500 dark:text-teal-400"
@@ -990,24 +990,24 @@ const Ye = O(function({
990
990
  ] }),
991
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(([, g]) => typeof g != "object" || g === null).slice(0, 2).map(([g, h]) => /* @__PURE__ */ i("div", { className: "truncate", children: [
994
- g,
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__ */ i("div", { className: "truncate", children: [
994
+ u,
995
995
  ": ",
996
996
  String(h).slice(0, 20)
997
- ] }, g)) })
997
+ ] }, u)) })
998
998
  ] }),
999
- /* @__PURE__ */ e(P, { type: "source", position: M.Right, className: "w-3 h-3 !bg-teal-500" })
999
+ /* @__PURE__ */ e(P, { type: "source", position: T.Right, className: "w-3 h-3 !bg-teal-500" })
1000
1000
  ]
1001
1001
  }
1002
1002
  );
1003
1003
  }), Ze = O(function({ id: d, data: t, selected: o }) {
1004
- const s = x((l) => l.execution.nodeStatus[d]), p = F(s) || (o ? "border-green-500" : "border-green-200");
1004
+ const s = w((l) => l.execution.nodeStatus[d]), p = F(s) || (o ? "border-green-500" : "border-green-200");
1005
1005
  return /* @__PURE__ */ i(
1006
1006
  "div",
1007
1007
  {
1008
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
- /* @__PURE__ */ e(P, { type: "target", position: M.Left, className: "w-3 h-3 !bg-green-500" }),
1010
+ /* @__PURE__ */ e(P, { type: "target", position: T.Left, className: "w-3 h-3 !bg-green-500" }),
1011
1011
  /* @__PURE__ */ i("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" })
@@ -1017,51 +1017,51 @@ const Ye = O(function({
1017
1017
  }
1018
1018
  );
1019
1019
  }), et = O(function({ id: d, data: t, selected: o }) {
1020
- const s = x((v) => v.execution.previews[d]), n = x((v) => v.execution.nodeStatus[d]), p = x((v) => v.previewVisible[d] !== !1), l = x((v) => v.updateNodeData), a = te(null), c = F(n) || (o ? "border-amber-500" : "border-amber-200"), g = L(
1021
- async (v) => {
1020
+ const s = w((k) => k.execution.previews[d]), n = w((k) => k.execution.nodeStatus[d]), p = w((k) => k.previewVisible[d] !== !1), l = w((k) => k.updateNodeData), a = re(null), c = F(n) || (o ? "border-amber-500" : "border-amber-200"), u = W(
1021
+ async (k) => {
1022
1022
  try {
1023
- const f = await Oe(v);
1023
+ const z = await Oe(k);
1024
1024
  l(d, {
1025
- uploadId: f.id,
1026
- filename: f.filename,
1027
- mime: f.mime
1025
+ uploadId: z.id,
1026
+ filename: z.filename,
1027
+ mime: z.mime
1028
1028
  });
1029
- } catch (f) {
1030
- console.error("Upload failed:", f);
1029
+ } catch (z) {
1030
+ console.error("Upload failed:", z);
1031
1031
  }
1032
1032
  },
1033
1033
  [d, l]
1034
- ), h = L(
1035
- (v) => {
1036
- v.preventDefault(), v.stopPropagation();
1037
- const f = v.dataTransfer.files[0];
1038
- f && f.type.startsWith("image/") && g(f);
1034
+ ), h = W(
1035
+ (k) => {
1036
+ k.preventDefault(), k.stopPropagation();
1037
+ const z = k.dataTransfer.files[0];
1038
+ z && z.type.startsWith("image/") && u(z);
1039
1039
  },
1040
- [g]
1041
- ), b = L((v) => {
1042
- v.preventDefault(), v.stopPropagation();
1043
- }, []), k = L(
1044
- (v) => {
1045
- var u;
1046
- const f = (u = v.target.files) == null ? void 0 : u[0];
1047
- f && g(f);
1040
+ [u]
1041
+ ), x = W((k) => {
1042
+ k.preventDefault(), k.stopPropagation();
1043
+ }, []), v = W(
1044
+ (k) => {
1045
+ var g;
1046
+ const z = (g = k.target.files) == null ? void 0 : g[0];
1047
+ z && u(z);
1048
1048
  },
1049
- [g]
1050
- ), w = s || (t.uploadId ? fe(t.uploadId) : null);
1049
+ [u]
1050
+ ), y = s || (t.uploadId ? fe(t.uploadId) : null);
1051
1051
  return /* @__PURE__ */ i(
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
- onDragOver: b,
1056
+ onDragOver: x,
1057
1057
  children: [
1058
- w && 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: w, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : w ? null : /* @__PURE__ */ e(
1058
+ y && 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: y, alt: "Uploaded", className: "w-full h-24 object-contain" }) }) : y ? 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 v;
1064
- return (v = a.current) == null ? void 0 : v.click();
1063
+ var k;
1064
+ return (k = a.current) == null ? void 0 : k.click();
1065
1065
  },
1066
1066
  children: /* @__PURE__ */ i("div", { className: "text-center text-amber-600 dark:text-amber-400", children: [
1067
1067
  /* @__PURE__ */ e("div", { className: "text-2xl mb-1", children: "+" }),
@@ -1076,18 +1076,18 @@ const Ye = O(function({
1076
1076
  type: "file",
1077
1077
  accept: "image/*",
1078
1078
  className: "hidden",
1079
- onChange: k
1079
+ onChange: v
1080
1080
  }
1081
1081
  ),
1082
1082
  /* @__PURE__ */ i("div", { className: "px-4 py-3", children: [
1083
1083
  /* @__PURE__ */ i("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
- /* @__PURE__ */ e(ae, { nodeId: d, color: "text-amber-500 dark:text-amber-400" })
1086
+ /* @__PURE__ */ e(oe, { nodeId: d, color: "text-amber-500 dark:text-amber-400" })
1087
1087
  ] }),
1088
1088
  /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: t.filename || "No image selected" })
1089
1089
  ] }),
1090
- /* @__PURE__ */ e(P, { type: "source", position: M.Right, className: "w-3 h-3 !bg-amber-500" })
1090
+ /* @__PURE__ */ e(P, { type: "source", position: T.Right, className: "w-3 h-3 !bg-amber-500" })
1091
1091
  ]
1092
1092
  }
1093
1093
  );
@@ -1096,19 +1096,19 @@ const Ye = O(function({
1096
1096
  data: t,
1097
1097
  selected: o
1098
1098
  }) {
1099
- var c, g, h;
1100
- const s = x((b) => b.execution.nodeStatus[d]), n = x((b) => {
1101
- var k;
1102
- return (k = b.execution.dataOutputs) == null ? void 0 : k[d];
1099
+ var c, u, h;
1100
+ const s = w((x) => x.execution.nodeStatus[d]), n = w((x) => {
1101
+ var v;
1102
+ return (v = x.execution.dataOutputs) == null ? void 0 : v[d];
1103
1103
  }), l = F(s) || (o ? "border-cyan-500" : "border-cyan-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], m = a.length > 0;
1104
1104
  return /* @__PURE__ */ i(
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 ${l}`,
1108
1108
  children: [
1109
- /* @__PURE__ */ e(P, { type: "target", position: M.Left, className: "w-3 h-3 !bg-cyan-500" }),
1109
+ /* @__PURE__ */ e(P, { type: "target", position: T.Left, className: "w-3 h-3 !bg-cyan-500" }),
1110
1110
  n && /* @__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__ */ i("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
1111
- (g = n.content) == null ? void 0 : g.slice(0, 200),
1111
+ (u = n.content) == null ? void 0 : u.slice(0, 200),
1112
1112
  (((h = n.content) == null ? void 0 : h.length) || 0) > 200 && "..."
1113
1113
  ] }) }),
1114
1114
  /* @__PURE__ */ i("div", { className: "px-4 py-3", children: [
@@ -1132,16 +1132,16 @@ const Ye = O(function({
1132
1132
  ] }) : null }),
1133
1133
  m && /* @__PURE__ */ i("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(([b]) => /* @__PURE__ */ i(
1135
+ a.map(([x]) => /* @__PURE__ */ i(
1136
1136
  "div",
1137
1137
  {
1138
1138
  className: "text-[10px] text-gray-500 dark:text-zinc-400 flex items-center gap-1",
1139
1139
  children: [
1140
1140
  /* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-cyan-400" }),
1141
- b
1141
+ x
1142
1142
  ]
1143
1143
  },
1144
- b
1144
+ x
1145
1145
  ))
1146
1146
  ] })
1147
1147
  ] }),
@@ -1150,45 +1150,45 @@ const Ye = O(function({
1150
1150
  P,
1151
1151
  {
1152
1152
  type: "source",
1153
- position: M.Right,
1153
+ position: T.Right,
1154
1154
  id: "output",
1155
1155
  className: "w-3 h-3 !bg-cyan-500",
1156
1156
  style: { top: "50%" },
1157
1157
  title: "Full JSON output"
1158
1158
  }
1159
1159
  ),
1160
- a.map(([b, k], w) => /* @__PURE__ */ e(
1160
+ a.map(([x, v], y) => /* @__PURE__ */ e(
1161
1161
  P,
1162
1162
  {
1163
1163
  type: "source",
1164
- position: M.Right,
1165
- id: `output.${b}`,
1164
+ position: T.Right,
1165
+ id: `output.${x}`,
1166
1166
  className: "w-2.5 h-2.5 !bg-cyan-400",
1167
1167
  style: {
1168
- top: `${70 + w * 14}%`
1168
+ top: `${70 + y * 14}%`
1169
1169
  },
1170
- title: `${b}: ${k.description || k.type}`
1170
+ title: `${x}: ${v.description || v.type}`
1171
1171
  },
1172
- b
1172
+ x
1173
1173
  ))
1174
- ] }) : /* @__PURE__ */ e(P, { type: "source", position: M.Right, className: "w-3 h-3 !bg-cyan-500" })
1174
+ ] }) : /* @__PURE__ */ e(P, { type: "source", position: T.Right, className: "w-3 h-3 !bg-cyan-500" })
1175
1175
  ]
1176
1176
  }
1177
1177
  );
1178
1178
  }), rt = O(function({ id: d, data: t, selected: o }) {
1179
- var c, g, h;
1180
- const s = x((b) => b.execution.nodeStatus[d]), n = x((b) => {
1181
- var k;
1182
- return (k = b.execution.dataOutputs) == null ? void 0 : k[d];
1179
+ var c, u, h;
1180
+ const s = w((x) => x.execution.nodeStatus[d]), n = w((x) => {
1181
+ var v;
1182
+ return (v = x.execution.dataOutputs) == null ? void 0 : v[d];
1183
1183
  }), l = F(s) || (o ? "border-pink-500" : "border-pink-200"), a = (c = t.outputSchema) != null && c.properties ? Object.entries(t.outputSchema.properties) : [], m = a.length > 0;
1184
1184
  return /* @__PURE__ */ i(
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 ${l}`,
1188
1188
  children: [
1189
- /* @__PURE__ */ e(P, { type: "target", position: M.Left, className: "w-3 h-3 !bg-pink-500" }),
1189
+ /* @__PURE__ */ e(P, { type: "target", position: T.Left, className: "w-3 h-3 !bg-pink-500" }),
1190
1190
  n && /* @__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__ */ i("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
1191
- (g = n.content) == null ? void 0 : g.slice(0, 200),
1191
+ (u = n.content) == null ? void 0 : u.slice(0, 200),
1192
1192
  (((h = n.content) == null ? void 0 : h.length) || 0) > 200 && "..."
1193
1193
  ] }) }),
1194
1194
  /* @__PURE__ */ i("div", { className: "px-4 py-3", children: [
@@ -1209,16 +1209,16 @@ const Ye = O(function({
1209
1209
  ] }) : null }),
1210
1210
  m && /* @__PURE__ */ i("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(([b]) => /* @__PURE__ */ i(
1212
+ a.map(([x]) => /* @__PURE__ */ i(
1213
1213
  "div",
1214
1214
  {
1215
1215
  className: "text-[10px] text-gray-500 dark:text-zinc-400 flex items-center gap-1",
1216
1216
  children: [
1217
1217
  /* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-pink-400" }),
1218
- b
1218
+ x
1219
1219
  ]
1220
1220
  },
1221
- b
1221
+ x
1222
1222
  ))
1223
1223
  ] })
1224
1224
  ] }),
@@ -1227,28 +1227,28 @@ const Ye = O(function({
1227
1227
  P,
1228
1228
  {
1229
1229
  type: "source",
1230
- position: M.Right,
1230
+ position: T.Right,
1231
1231
  id: "output",
1232
1232
  className: "w-3 h-3 !bg-pink-500",
1233
1233
  style: { top: "50%" },
1234
1234
  title: "Full JSON output"
1235
1235
  }
1236
1236
  ),
1237
- a.map(([b, k], w) => /* @__PURE__ */ e(
1237
+ a.map(([x, v], y) => /* @__PURE__ */ e(
1238
1238
  P,
1239
1239
  {
1240
1240
  type: "source",
1241
- position: M.Right,
1242
- id: `output.${b}`,
1241
+ position: T.Right,
1242
+ id: `output.${x}`,
1243
1243
  className: "w-2.5 h-2.5 !bg-pink-400",
1244
1244
  style: {
1245
- top: `${70 + w * 14}%`
1245
+ top: `${70 + y * 14}%`
1246
1246
  },
1247
- title: `${b}: ${k.description || k.type}`
1247
+ title: `${x}: ${v.description || v.type}`
1248
1248
  },
1249
- b
1249
+ x
1250
1250
  ))
1251
- ] }) : /* @__PURE__ */ e(P, { type: "source", position: M.Right, className: "w-3 h-3 !bg-pink-500" })
1251
+ ] }) : /* @__PURE__ */ e(P, { type: "source", position: T.Right, className: "w-3 h-3 !bg-pink-500" })
1252
1252
  ]
1253
1253
  }
1254
1254
  );
@@ -1271,40 +1271,56 @@ const Ye = O(function({
1271
1271
  style: {
1272
1272
  stroke: "#64748b",
1273
1273
  strokeWidth: 2
1274
- }
1274
+ },
1275
+ // Make edges easier to select
1276
+ interactionWidth: 20
1275
1277
  };
1276
1278
  function it() {
1277
- const r = x((h) => h.nodes), d = x((h) => h.edges), t = x((h) => h.setNodes), o = x((h) => h.setEdges), s = x((h) => h.addEdge), n = x((h) => h.setSelectedNode), p = L(
1279
+ const r = w((h) => h.nodes), d = w((h) => h.edges), t = w((h) => h.setNodes), o = w((h) => h.setEdges), s = w((h) => h.addEdge), n = w((h) => h.setSelectedNode), p = W(
1278
1280
  (h) => {
1279
- const { source: b, target: k } = h;
1280
- if (!b || !k) return !1;
1281
- const w = r.find((u) => u.id === b), v = r.find((u) => u.id === k);
1282
- return !(!w || !v || w.type === "save" || v.type === "generator" || v.type === "input" || d.find(
1283
- (u) => u.target === k && u.targetHandle === h.targetHandle
1284
- ) || b === k);
1281
+ const { source: x, target: v, targetHandle: y } = h;
1282
+ if (!x || !v) return !1;
1283
+ const k = r.find((g) => g.id === x), z = r.find((g) => g.id === v);
1284
+ if (!k || !z || k.type === "save") return !1;
1285
+ if (z.type === "generator") {
1286
+ const g = z.data;
1287
+ return !!(y === "text" && g.isAI || y === "references" && g.acceptsReferenceImages);
1288
+ }
1289
+ return !(z.type === "input" || x === v);
1285
1290
  },
1286
- [r, d]
1287
- ), l = L(
1291
+ [r]
1292
+ ), l = W(
1288
1293
  (h) => {
1289
1294
  t(Ce(h, r));
1290
1295
  },
1291
1296
  [r, t]
1292
- ), a = L(
1297
+ ), a = W(
1293
1298
  (h) => {
1294
1299
  o(Ie(h, d));
1295
1300
  },
1296
1301
  [d, o]
1297
- ), m = L(
1302
+ ), m = W(
1298
1303
  (h) => {
1304
+ if (!(h.targetHandle === "references")) {
1305
+ const v = d.filter((y) => {
1306
+ if (y.target !== h.target) return !1;
1307
+ const k = y.targetHandle || null, z = h.targetHandle || null;
1308
+ return k === z || (h.targetHandle === "text" || h.targetHandle === "image") && !y.targetHandle || !h.targetHandle && y.targetHandle === "image";
1309
+ });
1310
+ if (v.length > 0) {
1311
+ const y = new Set(v.map((k) => k.id));
1312
+ o(d.filter((k) => !y.has(k.id)));
1313
+ }
1314
+ }
1299
1315
  s(h);
1300
1316
  },
1301
- [s]
1302
- ), c = L(
1303
- (h, b) => {
1304
- n(b.id);
1317
+ [s, d, o]
1318
+ ), c = W(
1319
+ (h, x) => {
1320
+ n(x.id);
1305
1321
  },
1306
1322
  [n]
1307
- ), g = L(() => {
1323
+ ), u = W(() => {
1308
1324
  n(null);
1309
1325
  }, [n]);
1310
1326
  return /* @__PURE__ */ e("div", { className: "h-full w-full", children: /* @__PURE__ */ i(
@@ -1316,13 +1332,15 @@ function it() {
1316
1332
  onEdgesChange: a,
1317
1333
  onConnect: m,
1318
1334
  onNodeClick: c,
1319
- onPaneClick: g,
1335
+ onPaneClick: u,
1320
1336
  nodeTypes: at,
1321
1337
  defaultEdgeOptions: ot,
1322
1338
  isValidConnection: p,
1323
1339
  nodesDraggable: !0,
1324
1340
  nodesConnectable: !0,
1325
1341
  elementsSelectable: !0,
1342
+ edgesFocusable: !0,
1343
+ deleteKeyCode: ["Backspace", "Delete"],
1326
1344
  proOptions: { hideAttribution: !0 },
1327
1345
  fitView: !0,
1328
1346
  snapToGrid: !0,
@@ -1336,7 +1354,7 @@ function it() {
1336
1354
  ) });
1337
1355
  }
1338
1356
  function nt({ onSelect: r }) {
1339
- const [d, t] = C([]), [o, s] = C(!0), [n, p] = C(null), l = async () => {
1357
+ const [d, t] = I([]), [o, s] = I(!0), [n, p] = I(null), l = async () => {
1340
1358
  try {
1341
1359
  s(!0);
1342
1360
  const c = await Fe();
@@ -1350,10 +1368,10 @@ function nt({ onSelect: r }) {
1350
1368
  j(() => {
1351
1369
  l();
1352
1370
  }, []);
1353
- const a = async (c, g) => {
1354
- if (g.stopPropagation(), !!confirm("Delete this upload?"))
1371
+ const a = async (c, u) => {
1372
+ if (u.stopPropagation(), !!confirm("Delete this upload?"))
1355
1373
  try {
1356
- await Ve(c), t((h) => h.filter((b) => b.id !== c));
1374
+ await Ve(c), t((h) => h.filter((x) => x.id !== c));
1357
1375
  } catch (h) {
1358
1376
  console.error("Failed to delete:", h);
1359
1377
  }
@@ -1385,7 +1403,7 @@ function nt({ onSelect: r }) {
1385
1403
  /* @__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(
1386
1404
  "button",
1387
1405
  {
1388
- onClick: (g) => a(c.id, g),
1406
+ onClick: (u) => a(c.id, u),
1389
1407
  className: "p-1 bg-red-500 rounded text-white text-xs hover:bg-red-600",
1390
1408
  children: "Delete"
1391
1409
  }
@@ -1398,33 +1416,33 @@ function nt({ onSelect: r }) {
1398
1416
  )) }) });
1399
1417
  }
1400
1418
  function st() {
1401
- const r = x((y) => y.setGenerators), d = x((y) => y.setTransforms), t = x((y) => y.setTextProviders), o = x((y) => y.setVisionProviders), s = x((y) => y.generators), n = x((y) => y.transforms), p = x((y) => y.textProviders), l = x((y) => y.visionProviders), a = x((y) => y.addNode), [m, c] = C(!1), { data: g } = K({
1419
+ const r = w((b) => b.setGenerators), d = w((b) => b.setTransforms), t = w((b) => b.setTextProviders), o = w((b) => b.setVisionProviders), s = w((b) => b.generators), n = w((b) => b.transforms), p = w((b) => b.textProviders), l = w((b) => b.visionProviders), a = w((b) => b.addNode), [m, c] = I(!1), { data: u } = K({
1402
1420
  queryKey: ["generators"],
1403
1421
  queryFn: Ue
1404
1422
  }), { data: h } = K({
1405
1423
  queryKey: ["transforms"],
1406
1424
  queryFn: Be
1407
- }), { data: b } = K({
1425
+ }), { data: x } = K({
1408
1426
  queryKey: ["textProviders"],
1409
1427
  queryFn: je
1410
- }), { data: k } = K({
1428
+ }), { data: v } = K({
1411
1429
  queryKey: ["visionProviders"],
1412
- queryFn: $e
1430
+ queryFn: Re
1413
1431
  });
1414
1432
  j(() => {
1415
- g && r(g);
1416
- }, [g, r]), j(() => {
1433
+ u && r(u);
1434
+ }, [u, r]), j(() => {
1417
1435
  h && d(h);
1418
1436
  }, [h, d]), j(() => {
1419
- b && t(b);
1420
- }, [b, t]), j(() => {
1421
- k && o(k);
1422
- }, [k, o]);
1423
- const w = (y, A) => {
1424
- y.dataTransfer.setData("application/json", JSON.stringify(A)), y.dataTransfer.effectAllowed = "move";
1425
- }, v = (y) => {
1426
- a(y, { x: 250, y: 150 + Math.random() * 100 });
1427
- }, f = {
1437
+ x && t(x);
1438
+ }, [x, t]), j(() => {
1439
+ v && o(v);
1440
+ }, [v, o]);
1441
+ const y = (b, L) => {
1442
+ b.dataTransfer.setData("application/json", JSON.stringify(L)), b.dataTransfer.effectAllowed = "move";
1443
+ }, k = (b) => {
1444
+ a(b, { x: 250, y: 150 + Math.random() * 100 });
1445
+ }, z = {
1428
1446
  id: "input:upload",
1429
1447
  type: "input",
1430
1448
  name: "upload",
@@ -1435,7 +1453,7 @@ function st() {
1435
1453
  type: "object",
1436
1454
  properties: {}
1437
1455
  }
1438
- }, u = {
1456
+ }, g = {
1439
1457
  id: "save:filesystem",
1440
1458
  type: "save",
1441
1459
  name: "save",
@@ -1456,16 +1474,16 @@ function st() {
1456
1474
  }
1457
1475
  }
1458
1476
  }
1459
- }, N = s.reduce(
1460
- (y, A) => {
1461
- const S = A.category || "Other";
1462
- return y[S] || (y[S] = []), y[S].push(A), y;
1477
+ }, f = s.reduce(
1478
+ (b, L) => {
1479
+ const A = L.category || "Other";
1480
+ return b[A] || (b[A] = []), b[A].push(L), b;
1463
1481
  },
1464
1482
  {}
1465
- ), W = n.reduce(
1466
- (y, A) => {
1467
- const S = A.category || "Other";
1468
- return y[S] || (y[S] = []), y[S].push(A), y;
1483
+ ), C = n.reduce(
1484
+ (b, L) => {
1485
+ const A = L.category || "Other";
1486
+ return b[A] || (b[A] = []), b[A].push(L), b;
1469
1487
  },
1470
1488
  {}
1471
1489
  );
@@ -1490,8 +1508,8 @@ function st() {
1490
1508
  "div",
1491
1509
  {
1492
1510
  draggable: !0,
1493
- onDragStart: (y) => w(y, f),
1494
- onDoubleClick: () => v(f),
1511
+ onDragStart: (b) => y(b, z),
1512
+ onDoubleClick: () => k(z),
1495
1513
  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
1514
  children: [
1497
1515
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-amber-700 dark:text-amber-300", children: "Upload Image" }),
@@ -1503,76 +1521,76 @@ function st() {
1503
1521
  ] }),
1504
1522
  /* @__PURE__ */ i("div", { className: "mb-6", children: [
1505
1523
  /* @__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(([y, A]) => /* @__PURE__ */ i("div", { className: "mb-3", children: [
1507
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: y }),
1508
- A.map((S) => /* @__PURE__ */ i(
1524
+ Object.entries(f).map(([b, L]) => /* @__PURE__ */ i("div", { className: "mb-3", children: [
1525
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: b }),
1526
+ L.map((A) => /* @__PURE__ */ i(
1509
1527
  "div",
1510
1528
  {
1511
1529
  draggable: !0,
1512
- onDragStart: (R) => w(R, S),
1513
- onDoubleClick: () => v(S),
1530
+ onDragStart: ($) => y($, A),
1531
+ onDoubleClick: () => k(A),
1514
1532
  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
1533
  children: [
1516
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children: S.label }),
1517
- S.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: S.description })
1534
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-700 dark:text-blue-300", children: A.label }),
1535
+ A.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: A.description })
1518
1536
  ]
1519
1537
  },
1520
- S.id
1538
+ A.id
1521
1539
  ))
1522
- ] }, y))
1540
+ ] }, b))
1523
1541
  ] }),
1524
1542
  /* @__PURE__ */ i("div", { className: "mb-6", children: [
1525
1543
  /* @__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(([y, A]) => /* @__PURE__ */ i("div", { className: "mb-3", children: [
1527
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: y }),
1528
- A.map((S) => /* @__PURE__ */ i(
1544
+ Object.entries(C).map(([b, L]) => /* @__PURE__ */ i("div", { className: "mb-3", children: [
1545
+ /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 mb-1", children: b }),
1546
+ L.map((A) => /* @__PURE__ */ i(
1529
1547
  "div",
1530
1548
  {
1531
1549
  draggable: !0,
1532
- onDragStart: (R) => w(R, S),
1533
- onDoubleClick: () => v(S),
1550
+ onDragStart: ($) => y($, A),
1551
+ onDoubleClick: () => k(A),
1534
1552
  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
1553
  children: [
1536
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children: S.label }),
1537
- S.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: S.description })
1554
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-teal-700 dark:text-teal-300", children: A.label }),
1555
+ A.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: A.description })
1538
1556
  ]
1539
1557
  },
1540
- S.id
1558
+ A.id
1541
1559
  ))
1542
- ] }, y))
1560
+ ] }, b))
1543
1561
  ] }),
1544
1562
  p.length > 0 && /* @__PURE__ */ i("div", { className: "mb-6", children: [
1545
1563
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-pink-600 dark:text-pink-400 uppercase tracking-wide mb-2", children: "AI Text" }),
1546
- p.map((y) => /* @__PURE__ */ i(
1564
+ p.map((b) => /* @__PURE__ */ i(
1547
1565
  "div",
1548
1566
  {
1549
1567
  draggable: !0,
1550
- onDragStart: (A) => w(A, y),
1551
- onDoubleClick: () => v(y),
1568
+ onDragStart: (L) => y(L, b),
1569
+ onDoubleClick: () => k(b),
1552
1570
  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
1571
  children: [
1554
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-pink-700 dark:text-pink-300", children: y.label }),
1555
- y.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: y.description })
1572
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-pink-700 dark:text-pink-300", children: b.label }),
1573
+ b.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: b.description })
1556
1574
  ]
1557
1575
  },
1558
- y.id
1576
+ b.id
1559
1577
  ))
1560
1578
  ] }),
1561
1579
  l.length > 0 && /* @__PURE__ */ i("div", { className: "mb-6", children: [
1562
1580
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium text-cyan-600 dark:text-cyan-400 uppercase tracking-wide mb-2", children: "AI Vision" }),
1563
- l.map((y) => /* @__PURE__ */ i(
1581
+ l.map((b) => /* @__PURE__ */ i(
1564
1582
  "div",
1565
1583
  {
1566
1584
  draggable: !0,
1567
- onDragStart: (A) => w(A, y),
1568
- onDoubleClick: () => v(y),
1585
+ onDragStart: (L) => y(L, b),
1586
+ onDoubleClick: () => k(b),
1569
1587
  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
1588
  children: [
1571
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-cyan-700 dark:text-cyan-300", children: y.label }),
1572
- y.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: y.description })
1589
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-cyan-700 dark:text-cyan-300", children: b.label }),
1590
+ b.description && /* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: b.description })
1573
1591
  ]
1574
1592
  },
1575
- y.id
1593
+ b.id
1576
1594
  ))
1577
1595
  ] }),
1578
1596
  /* @__PURE__ */ i("div", { className: "mb-6", children: [
@@ -1581,8 +1599,8 @@ function st() {
1581
1599
  "div",
1582
1600
  {
1583
1601
  draggable: !0,
1584
- onDragStart: (y) => w(y, u),
1585
- onDoubleClick: () => v(u),
1602
+ onDragStart: (b) => y(b, g),
1603
+ onDoubleClick: () => k(g),
1586
1604
  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
1605
  children: [
1588
1606
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-green-700 dark:text-green-300", children: "Save" }),
@@ -1594,68 +1612,81 @@ function st() {
1594
1612
  ] }) });
1595
1613
  }
1596
1614
  function dt() {
1597
- var b, k, w, v;
1598
- const r = x((f) => f.selectedNodeId), d = x((f) => f.nodes), t = x((f) => f.generators), o = x((f) => f.transforms), s = x((f) => f.textProviders), n = x((f) => f.visionProviders), p = x((f) => f.updateNodeData), l = x((f) => f.deleteNode), a = d.find((f) => f.id === r);
1615
+ var v, y, k, z;
1616
+ const r = w((g) => g.selectedNodeId), d = w((g) => g.nodes), t = w((g) => g.generators), o = w((g) => g.transforms), s = w((g) => g.textProviders), n = w((g) => g.visionProviders), p = w((g) => g.updateNodeData), l = w((g) => g.deleteNode), a = d.find((g) => g.id === r);
1599
1617
  if (!a)
1600
1618
  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
1619
  let m, c = "";
1602
1620
  if (a.type === "generator") {
1603
- const f = a.data, u = t.find((N) => N.name === f.generatorName);
1604
- m = (b = u == null ? void 0 : u.params) == null ? void 0 : b.properties, c = (u == null ? void 0 : u.label) || f.generatorName;
1621
+ const g = a.data, f = t.find((C) => C.name === g.generatorName);
1622
+ m = (v = f == null ? void 0 : f.params) == null ? void 0 : v.properties, c = (f == null ? void 0 : f.label) || g.generatorName;
1605
1623
  } else if (a.type === "transform") {
1606
- const f = a.data, u = o.find((N) => N.name === f.operation);
1607
- m = (k = u == null ? void 0 : u.params) == null ? void 0 : k.properties, c = (u == null ? void 0 : u.label) || f.operation;
1624
+ const g = a.data, f = o.find((C) => C.name === g.operation);
1625
+ m = (y = f == null ? void 0 : f.params) == null ? void 0 : y.properties, c = (f == null ? void 0 : f.label) || g.operation;
1608
1626
  } else if (a.type === "save") {
1609
- const u = a.data.provider === "floimg-cloud";
1610
- c = u ? "Save to FloImg Cloud" : "Save", m = {
1627
+ const f = a.data.provider === "floimg-cloud";
1628
+ c = f ? "Save to FloImg Cloud" : "Save", m = {
1611
1629
  destination: {
1612
1630
  type: "string",
1613
- title: u ? "Filename" : "Destination",
1614
- description: u ? "Filename for cloud storage" : "File path to save the image"
1631
+ title: f ? "Filename" : "Destination",
1632
+ description: f ? "Filename for cloud storage" : "File path to save the image"
1615
1633
  }
1616
1634
  };
1617
1635
  } else if (a.type === "text") {
1618
- const f = a.data, u = s.find((N) => N.name === f.providerName);
1619
- m = (w = u == null ? void 0 : u.params) == null ? void 0 : w.properties, c = (u == null ? void 0 : u.label) || f.providerName;
1636
+ const g = a.data, f = s.find((C) => C.name === g.providerName);
1637
+ m = (k = f == null ? void 0 : f.params) == null ? void 0 : k.properties, c = (f == null ? void 0 : f.label) || g.providerName;
1620
1638
  } else if (a.type === "vision") {
1621
- const f = a.data, u = n.find((N) => N.name === f.providerName);
1622
- m = (v = u == null ? void 0 : u.params) == null ? void 0 : v.properties, c = (u == null ? void 0 : u.label) || f.providerName;
1639
+ const g = a.data, f = n.find((C) => C.name === g.providerName);
1640
+ m = (z = f == null ? void 0 : f.params) == null ? void 0 : z.properties, c = (f == null ? void 0 : f.label) || g.providerName;
1623
1641
  }
1624
- const g = (f, u) => {
1642
+ const u = (g, f) => {
1625
1643
  if (a.type === "generator") {
1626
- const N = a.data;
1644
+ const C = a.data;
1627
1645
  p(a.id, {
1628
- params: { ...N.params, [f]: u }
1646
+ params: { ...C.params, [g]: f }
1629
1647
  });
1630
1648
  } else if (a.type === "transform") {
1631
- const N = a.data;
1649
+ const C = a.data;
1632
1650
  p(a.id, {
1633
- params: { ...N.params, [f]: u }
1651
+ params: { ...C.params, [g]: f }
1634
1652
  });
1635
1653
  } else if (a.type === "save")
1636
- p(a.id, { [f]: u });
1654
+ p(a.id, { [g]: f });
1637
1655
  else if (a.type === "text") {
1638
- const N = a.data;
1656
+ const C = a.data;
1639
1657
  p(a.id, {
1640
- params: { ...N.params, [f]: u }
1658
+ params: { ...C.params, [g]: f }
1641
1659
  });
1642
1660
  } else if (a.type === "vision") {
1643
- const N = a.data;
1661
+ const C = a.data;
1644
1662
  p(a.id, {
1645
- params: { ...N.params, [f]: u }
1663
+ params: { ...C.params, [g]: f }
1646
1664
  });
1647
1665
  }
1648
- }, h = (f) => {
1666
+ }, h = (g) => {
1649
1667
  if (a.type === "generator")
1650
- return a.data.params[f];
1668
+ return a.data.params[g];
1651
1669
  if (a.type === "transform")
1652
- return a.data.params[f];
1670
+ return a.data.params[g];
1653
1671
  if (a.type === "save")
1654
- return a.data[f];
1672
+ return a.data[g];
1655
1673
  if (a.type === "text")
1656
- return a.data.params[f];
1674
+ return a.data.params[g];
1657
1675
  if (a.type === "vision")
1658
- return a.data.params[f];
1676
+ return a.data.params[g];
1677
+ }, x = (g, f) => {
1678
+ if (a.type === "generator" && a.data.generatorName === "shapes") {
1679
+ const C = h("shapeType") || "rectangle", b = h("fillType") || "solid";
1680
+ if (g === "sides") return C === "polygon";
1681
+ if (g === "points" || g === "innerRadius") return C === "star";
1682
+ if (g === "cornerRadius") return C === "rectangle";
1683
+ if (g === "fillColor") return b === "solid";
1684
+ if (g === "gradientType" || g === "gradientColor1" || g === "gradientColor2" || g === "gradientAngle")
1685
+ return b === "gradient";
1686
+ if (g === "patternType" || g === "patternColor" || g === "patternBackground" || g === "patternScale")
1687
+ return b === "pattern";
1688
+ }
1689
+ return !0;
1659
1690
  };
1660
1691
  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__ */ i("div", { className: "p-4", children: [
1661
1692
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-4", children: [
@@ -1669,15 +1700,15 @@ function dt() {
1669
1700
  }
1670
1701
  )
1671
1702
  ] }),
1672
- /* @__PURE__ */ e("div", { className: "space-y-4", children: m && Object.entries(m).map(([f, u]) => /* @__PURE__ */ e(
1703
+ /* @__PURE__ */ e("div", { className: "space-y-4", children: m && Object.entries(m).filter(([g, f]) => x(g)).map(([g, f]) => /* @__PURE__ */ e(
1673
1704
  lt,
1674
1705
  {
1675
- name: f,
1676
- field: u,
1677
- value: h(f),
1678
- onChange: (N) => g(f, N)
1706
+ name: g,
1707
+ field: f,
1708
+ value: h(g),
1709
+ onChange: (C) => u(g, C)
1679
1710
  },
1680
- f
1711
+ g
1681
1712
  )) }),
1682
1713
  (a.type === "text" || a.type === "vision") && /* @__PURE__ */ e(
1683
1714
  ct,
@@ -1793,38 +1824,38 @@ function lt({ name: r, field: d, value: t, onChange: o }) {
1793
1824
  ] });
1794
1825
  }
1795
1826
  function ct({ nodeId: r, outputSchema: d, updateNodeData: t }) {
1796
- const [o, s] = C(""), n = (d == null ? void 0 : d.properties) || {}, p = Object.entries(n), l = () => {
1827
+ const [o, s] = I(""), n = (d == null ? void 0 : d.properties) || {}, p = Object.entries(n), l = () => {
1797
1828
  if (!o.trim()) return;
1798
- const g = {
1829
+ const u = {
1799
1830
  type: "object",
1800
1831
  properties: {
1801
1832
  ...n,
1802
1833
  [o.trim()]: { type: "string" }
1803
1834
  }
1804
1835
  };
1805
- t(r, { outputSchema: g }), s("");
1806
- }, a = (g) => {
1836
+ t(r, { outputSchema: u }), s("");
1837
+ }, a = (u) => {
1807
1838
  const h = { ...n };
1808
- delete h[g], Object.keys(h).length === 0 ? t(r, { outputSchema: void 0 }) : t(r, {
1839
+ delete h[u], Object.keys(h).length === 0 ? t(r, { outputSchema: void 0 }) : t(r, {
1809
1840
  outputSchema: { type: "object", properties: h }
1810
1841
  });
1811
- }, m = (g, h) => {
1842
+ }, m = (u, h) => {
1812
1843
  t(r, {
1813
1844
  outputSchema: {
1814
1845
  type: "object",
1815
1846
  properties: {
1816
1847
  ...n,
1817
- [g]: { ...n[g], type: h }
1848
+ [u]: { ...n[u], type: h }
1818
1849
  }
1819
1850
  }
1820
1851
  });
1821
- }, c = (g, h) => {
1852
+ }, c = (u, h) => {
1822
1853
  t(r, {
1823
1854
  outputSchema: {
1824
1855
  type: "object",
1825
1856
  properties: {
1826
1857
  ...n,
1827
- [g]: { ...n[g], description: h || void 0 }
1858
+ [u]: { ...n[u], description: h || void 0 }
1828
1859
  }
1829
1860
  }
1830
1861
  });
@@ -1835,19 +1866,19 @@ function ct({ nodeId: r, outputSchema: d, updateNodeData: t }) {
1835
1866
  /* @__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
1867
  ] }),
1837
1868
  /* @__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
- p.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-2 mb-3", children: p.map(([g, h]) => /* @__PURE__ */ i(
1869
+ p.length > 0 && /* @__PURE__ */ e("div", { className: "space-y-2 mb-3", children: p.map(([u, h]) => /* @__PURE__ */ i(
1839
1870
  "div",
1840
1871
  {
1841
1872
  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
1873
  children: [
1843
1874
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1844
1875
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
1845
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-pink-700 dark:text-pink-300 truncate", children: g }),
1876
+ /* @__PURE__ */ e("span", { className: "text-sm font-medium text-pink-700 dark:text-pink-300 truncate", children: u }),
1846
1877
  /* @__PURE__ */ i(
1847
1878
  "select",
1848
1879
  {
1849
1880
  value: h.type,
1850
- onChange: (b) => m(g, b.target.value),
1881
+ onChange: (x) => m(u, x.target.value),
1851
1882
  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
1883
  children: [
1853
1884
  /* @__PURE__ */ e("option", { value: "string", children: "string" }),
@@ -1864,7 +1895,7 @@ function ct({ nodeId: r, outputSchema: d, updateNodeData: t }) {
1864
1895
  {
1865
1896
  type: "text",
1866
1897
  value: h.description || "",
1867
- onChange: (b) => c(g, b.target.value),
1898
+ onChange: (x) => c(u, x.target.value),
1868
1899
  placeholder: "Description (optional)",
1869
1900
  className: "mt-1 w-full text-xs px-2 py-1 rounded border border-pink-200 dark:border-pink-700 bg-white dark:bg-zinc-800 text-gray-600 dark:text-zinc-400 placeholder-gray-400 dark:placeholder-zinc-500"
1870
1901
  }
@@ -1873,7 +1904,7 @@ function ct({ nodeId: r, outputSchema: d, updateNodeData: t }) {
1873
1904
  /* @__PURE__ */ e(
1874
1905
  "button",
1875
1906
  {
1876
- onClick: () => a(g),
1907
+ onClick: () => a(u),
1877
1908
  className: "text-pink-500 hover:text-pink-700 dark:text-pink-400 dark:hover:text-pink-300 p-1",
1878
1909
  title: "Remove property",
1879
1910
  children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
@@ -1889,7 +1920,7 @@ function ct({ nodeId: r, outputSchema: d, updateNodeData: t }) {
1889
1920
  )
1890
1921
  ]
1891
1922
  },
1892
- g
1923
+ u
1893
1924
  )) }),
1894
1925
  /* @__PURE__ */ i("div", { className: "flex gap-2", children: [
1895
1926
  /* @__PURE__ */ e(
@@ -1897,8 +1928,8 @@ function ct({ nodeId: r, outputSchema: d, updateNodeData: t }) {
1897
1928
  {
1898
1929
  type: "text",
1899
1930
  value: o,
1900
- onChange: (g) => s(g.target.value),
1901
- onKeyDown: (g) => g.key === "Enter" && l(),
1931
+ onChange: (u) => s(u.target.value),
1932
+ onKeyDown: (u) => u.key === "Enter" && l(),
1902
1933
  placeholder: "Property name...",
1903
1934
  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"
1904
1935
  }
@@ -1933,8 +1964,8 @@ function mt(r, d) {
1933
1964
  a && p.push(a);
1934
1965
  const m = s.get(l) || [];
1935
1966
  for (const c of m) {
1936
- const g = (o.get(c) || 1) - 1;
1937
- o.set(c, g), g === 0 && n.push(c);
1967
+ const u = (o.get(c) || 1) - 1;
1968
+ o.set(c, u), u === 0 && n.push(c);
1938
1969
  }
1939
1970
  }
1940
1971
  return p;
@@ -1953,7 +1984,7 @@ function gt(r, d, t) {
1953
1984
  case "generator": {
1954
1985
  const l = r.data;
1955
1986
  s.push(l.generatorName);
1956
- const a = l.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, g]) => ` ${c}: ${H(g)}`).join(`,
1987
+ const a = l.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${H(u)}`).join(`,
1957
1988
  `);
1958
1989
  return {
1959
1990
  code: `// Generate image using ${l.generatorName}
@@ -1970,7 +2001,7 @@ const ${o} = await flo.loadImage("./input.png");`,
1970
2001
  imports: []
1971
2002
  };
1972
2003
  case "transform": {
1973
- const l = r.data, a = l.params || {}, m = Object.entries(a).filter(([, g]) => g !== void 0 && g !== "").map(([g, h]) => `${g}: ${H(h)}`).join(", "), c = p || "image";
2004
+ const l = r.data, a = l.params || {}, m = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${H(h)}`).join(", "), c = p || "image";
1974
2005
  return {
1975
2006
  code: `// Apply ${l.operation} transform
1976
2007
  const ${o} = await flo.transform(${c}, "${l.operation}"${m ? `, { ${m} }` : ""});`,
@@ -1980,7 +2011,7 @@ const ${o} = await flo.transform(${c}, "${l.operation}"${m ? `, { ${m} }` : ""})
1980
2011
  case "vision": {
1981
2012
  const l = r.data;
1982
2013
  s.push(l.providerName);
1983
- const a = l.params || {}, m = p || "image", c = Object.entries(a).filter(([, g]) => g !== void 0 && g !== "").map(([g, h]) => ` ${g}: ${H(h)}`).join(`,
2014
+ const a = l.params || {}, m = p || "image", c = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => ` ${u}: ${H(h)}`).join(`,
1984
2015
  `);
1985
2016
  return {
1986
2017
  code: `// Analyze image with ${l.providerName}
@@ -1993,7 +2024,7 @@ ${c}
1993
2024
  case "text": {
1994
2025
  const l = r.data;
1995
2026
  s.push(l.providerName);
1996
- const a = l.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, g]) => ` ${c}: ${H(g)}`).join(`,
2027
+ const a = l.params || {}, m = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${H(u)}`).join(`,
1997
2028
  `);
1998
2029
  return {
1999
2030
  code: `// Generate text with ${l.providerName}
@@ -2027,9 +2058,9 @@ function ut(r, d) {
2027
2058
  o.set(m.id, pt(m));
2028
2059
  const s = /* @__PURE__ */ new Set(), n = [];
2029
2060
  for (const m of t) {
2030
- const { code: c, imports: g } = gt(m, d, o);
2061
+ const { code: c, imports: u } = gt(m, d, o);
2031
2062
  n.push(c);
2032
- for (const h of g)
2063
+ for (const h of u)
2033
2064
  s.add(h);
2034
2065
  }
2035
2066
  const p = [];
@@ -2059,67 +2090,67 @@ runWorkflow().catch(console.error);
2059
2090
  ` + a;
2060
2091
  }
2061
2092
  function ht({ isOpen: r, onClose: d, onImport: t }) {
2062
- const [o, s] = C(""), [n, p] = C(!1), [l, a] = C(null), [m, c] = C(!1), g = L(async () => {
2093
+ const [o, s] = I(""), [n, p] = I(!1), [l, a] = I(null), [m, c] = I(!1), u = W(async () => {
2063
2094
  if (!o.trim()) {
2064
2095
  a({ message: "Please enter or paste YAML content" });
2065
2096
  return;
2066
2097
  }
2067
2098
  p(!0), a(null);
2068
2099
  try {
2069
- const u = await He(o);
2070
- u.success ? (t(u.nodes, u.edges, u.name), s(""), d()) : a({
2071
- message: u.error || "Import failed",
2072
- line: u.line,
2073
- column: u.column
2100
+ const g = await He(o);
2101
+ g.success ? (t(g.nodes, g.edges, g.name), s(""), d()) : a({
2102
+ message: g.error || "Import failed",
2103
+ line: g.line,
2104
+ column: g.column
2074
2105
  });
2075
- } catch (u) {
2076
- a({ message: u instanceof Error ? u.message : "Import failed" });
2106
+ } catch (g) {
2107
+ a({ message: g instanceof Error ? g.message : "Import failed" });
2077
2108
  } finally {
2078
2109
  p(!1);
2079
2110
  }
2080
- }, [o, t, d]), h = L(async () => {
2111
+ }, [o, t, d]), h = W(async () => {
2081
2112
  if (!o.trim()) {
2082
2113
  a({ message: "Please enter or paste YAML content" });
2083
2114
  return;
2084
2115
  }
2085
2116
  p(!0), a(null);
2086
2117
  try {
2087
- const u = await Ke(o);
2088
- u.valid ? (a(null), a({ message: "Valid YAML!" }), setTimeout(() => a(null), 2e3)) : u.errors.length > 0 && a(u.errors[0]);
2089
- } catch (u) {
2090
- a({ message: u instanceof Error ? u.message : "Validation failed" });
2118
+ const g = await Ke(o);
2119
+ g.valid ? (a(null), a({ message: "Valid YAML!" }), setTimeout(() => a(null), 2e3)) : g.errors.length > 0 && a(g.errors[0]);
2120
+ } catch (g) {
2121
+ a({ message: g instanceof Error ? g.message : "Validation failed" });
2091
2122
  } finally {
2092
2123
  p(!1);
2093
2124
  }
2094
- }, [o]), b = L(async (u) => {
2095
- if (!u.name.endsWith(".yaml") && !u.name.endsWith(".yml")) {
2125
+ }, [o]), x = W(async (g) => {
2126
+ if (!g.name.endsWith(".yaml") && !g.name.endsWith(".yml")) {
2096
2127
  a({ message: "Please upload a .yaml or .yml file" });
2097
2128
  return;
2098
2129
  }
2099
2130
  try {
2100
- const N = await u.text();
2101
- s(N), a(null);
2131
+ const f = await g.text();
2132
+ s(f), a(null);
2102
2133
  } catch {
2103
2134
  a({ message: "Failed to read file" });
2104
2135
  }
2105
- }, []), k = L((u) => {
2106
- u.preventDefault(), c(!0);
2107
- }, []), w = L((u) => {
2108
- u.preventDefault(), c(!1);
2109
- }, []), v = L(
2110
- (u) => {
2111
- u.preventDefault(), c(!1);
2112
- const N = u.dataTransfer.files[0];
2113
- N && b(N);
2136
+ }, []), v = W((g) => {
2137
+ g.preventDefault(), c(!0);
2138
+ }, []), y = W((g) => {
2139
+ g.preventDefault(), c(!1);
2140
+ }, []), k = W(
2141
+ (g) => {
2142
+ g.preventDefault(), c(!1);
2143
+ const f = g.dataTransfer.files[0];
2144
+ f && x(f);
2114
2145
  },
2115
- [b]
2116
- ), f = L(
2117
- (u) => {
2118
- var W;
2119
- const N = (W = u.target.files) == null ? void 0 : W[0];
2120
- N && b(N);
2146
+ [x]
2147
+ ), z = W(
2148
+ (g) => {
2149
+ var C;
2150
+ const f = (C = g.target.files) == null ? void 0 : C[0];
2151
+ f && x(f);
2121
2152
  },
2122
- [b]
2153
+ [x]
2123
2154
  );
2124
2155
  return r ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ i("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
2156
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
@@ -2146,9 +2177,9 @@ function ht({ isOpen: r, onClose: d, onImport: t }) {
2146
2177
  /* @__PURE__ */ i(
2147
2178
  "div",
2148
2179
  {
2149
- onDragOver: k,
2150
- onDragLeave: w,
2151
- onDrop: v,
2180
+ onDragOver: v,
2181
+ onDragLeave: y,
2182
+ onDrop: k,
2152
2183
  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
2184
  children: [
2154
2185
  /* @__PURE__ */ e(
@@ -2156,7 +2187,7 @@ function ht({ isOpen: r, onClose: d, onImport: t }) {
2156
2187
  {
2157
2188
  type: "file",
2158
2189
  accept: ".yaml,.yml",
2159
- onChange: f,
2190
+ onChange: z,
2160
2191
  className: "hidden",
2161
2192
  id: "yaml-file-input"
2162
2193
  }
@@ -2200,8 +2231,8 @@ function ht({ isOpen: r, onClose: d, onImport: t }) {
2200
2231
  "textarea",
2201
2232
  {
2202
2233
  value: o,
2203
- onChange: (u) => {
2204
- s(u.target.value), a(null);
2234
+ onChange: (g) => {
2235
+ s(g.target.value), a(null);
2205
2236
  },
2206
2237
  placeholder: `name: My Workflow
2207
2238
  steps:
@@ -2256,7 +2287,7 @@ steps:
2256
2287
  /* @__PURE__ */ i(
2257
2288
  "button",
2258
2289
  {
2259
- onClick: g,
2290
+ onClick: u,
2260
2291
  disabled: n || !o.trim(),
2261
2292
  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
2293
  children: [
@@ -2296,42 +2327,42 @@ function ft({
2296
2327
  hideAttribution: o = !1,
2297
2328
  hideWorkflowLibrary: s = !1
2298
2329
  } = {}) {
2299
- const n = x((z) => z.execution), p = x((z) => z.execute), l = x((z) => z.exportToYaml), a = x((z) => z.importFromYaml), m = x((z) => z.nodes), c = x((z) => z.edges), g = q((z) => z.openSettings), h = x((z) => z.activeWorkflowName), b = x((z) => z.hasUnsavedChanges), k = x((z) => z.saveWorkflow), w = x((z) => z.toggleLibrary), v = x((z) => z.setActiveWorkflowName), f = x((z) => z.selectedNodeId), u = x((z) => z.duplicateNode), [N, W] = C(!1), [y, A] = C(!1), [S, R] = C("yaml"), [Q, Y] = C(""), [I, D] = C(""), [E, $] = C(null), [be, X] = C(!1), [ie, Z] = C("");
2330
+ const n = w((N) => N.execution), p = w((N) => N.execute), l = w((N) => N.exportToYaml), a = w((N) => N.importFromYaml), m = w((N) => N.nodes), c = w((N) => N.edges), u = q((N) => N.openSettings), h = w((N) => N.activeWorkflowName), x = w((N) => N.hasUnsavedChanges), v = w((N) => N.saveWorkflow), y = w((N) => N.toggleLibrary), k = w((N) => N.setActiveWorkflowName), z = w((N) => N.selectedNodeId), g = w((N) => N.duplicateNode), [f, C] = I(!1), [b, L] = I(!1), [A, $] = I("yaml"), [Q, Y] = I(""), [S, D] = I(""), [E, R] = I(null), [be, X] = I(!1), [ne, Z] = I("");
2300
2331
  j(() => {
2301
- const z = () => {
2302
- $("New workflow created"), setTimeout(() => $(null), 2e3);
2332
+ const N = () => {
2333
+ R("New workflow created"), setTimeout(() => R(null), 2e3);
2303
2334
  };
2304
- return window.addEventListener("new-workflow-created", z), () => window.removeEventListener("new-workflow-created", z);
2335
+ return window.addEventListener("new-workflow-created", N), () => window.removeEventListener("new-workflow-created", N);
2305
2336
  }, []);
2306
- const ee = L(() => {
2307
- m.length !== 0 && (k(), $("Saved!"), setTimeout(() => $(null), 2e3));
2308
- }, [m.length, k]), xe = () => {
2337
+ const ee = W(() => {
2338
+ m.length !== 0 && (v(), R("Saved!"), setTimeout(() => R(null), 2e3));
2339
+ }, [m.length, v]), xe = () => {
2309
2340
  Z(h), X(!0);
2310
- }, ne = () => {
2311
- const z = ie.trim();
2312
- z && z !== h && v(z), X(!1);
2313
- }, se = L(() => {
2314
- f && u(f);
2315
- }, [f, u]);
2341
+ }, se = () => {
2342
+ const N = ne.trim();
2343
+ N && N !== h && k(N), X(!1);
2344
+ }, de = W(() => {
2345
+ z && g(z);
2346
+ }, [z, g]);
2316
2347
  j(() => {
2317
- function z(U) {
2318
- (U.metaKey || U.ctrlKey) && U.key === "s" && (U.preventDefault(), ee()), (U.metaKey || U.ctrlKey) && U.key === "d" && (U.preventDefault(), se());
2348
+ function N(U) {
2349
+ (U.metaKey || U.ctrlKey) && U.key === "s" && (U.preventDefault(), ee()), (U.metaKey || U.ctrlKey) && U.key === "d" && (U.preventDefault(), de());
2319
2350
  }
2320
- return document.addEventListener("keydown", z), () => document.removeEventListener("keydown", z);
2321
- }, [ee, se]);
2351
+ return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
2352
+ }, [ee, de]);
2322
2353
  const ye = async () => {
2323
2354
  await p();
2324
2355
  }, we = async () => {
2325
- const z = await l();
2326
- Y(z);
2356
+ const N = await l();
2357
+ Y(N);
2327
2358
  const U = ut(m, c);
2328
- D(U), W(!0);
2329
- }, ke = () => {
2330
- const z = S === "yaml" ? Q : I;
2331
- navigator.clipboard.writeText(z);
2332
- }, ve = L(
2333
- (z, U, Ne) => {
2334
- a(z, U, Ne), $("Workflow imported!"), setTimeout(() => $(null), 2e3);
2359
+ D(U), C(!0);
2360
+ }, ve = () => {
2361
+ const N = A === "yaml" ? Q : S;
2362
+ navigator.clipboard.writeText(N);
2363
+ }, ke = W(
2364
+ (N, U, Ne) => {
2365
+ a(N, U, Ne), R("Workflow imported!"), setTimeout(() => R(null), 2e3);
2335
2366
  },
2336
2367
  [a]
2337
2368
  );
@@ -2341,7 +2372,7 @@ function ft({
2341
2372
  !s && /* @__PURE__ */ e(
2342
2373
  "button",
2343
2374
  {
2344
- onClick: w,
2375
+ onClick: y,
2345
2376
  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",
2346
2377
  title: "My Workflows",
2347
2378
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
@@ -2374,11 +2405,11 @@ function ft({
2374
2405
  "input",
2375
2406
  {
2376
2407
  type: "text",
2377
- value: ie,
2378
- onChange: (z) => Z(z.target.value),
2379
- onBlur: ne,
2380
- onKeyDown: (z) => {
2381
- z.key === "Enter" && ne(), z.key === "Escape" && (Z(h), X(!1));
2408
+ value: ne,
2409
+ onChange: (N) => Z(N.target.value),
2410
+ onBlur: se,
2411
+ onKeyDown: (N) => {
2412
+ N.key === "Enter" && se(), N.key === "Escape" && (Z(h), X(!1));
2382
2413
  },
2383
2414
  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",
2384
2415
  autoFocus: !0
@@ -2392,7 +2423,7 @@ function ft({
2392
2423
  children: h
2393
2424
  }
2394
2425
  ),
2395
- b && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
2426
+ x && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
2396
2427
  E && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: E })
2397
2428
  ] }),
2398
2429
  /* @__PURE__ */ i("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
@@ -2406,7 +2437,7 @@ function ft({
2406
2437
  /* @__PURE__ */ e(
2407
2438
  "button",
2408
2439
  {
2409
- onClick: g,
2440
+ onClick: u,
2410
2441
  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",
2411
2442
  title: "AI Settings",
2412
2443
  children: /* @__PURE__ */ i("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
@@ -2452,7 +2483,7 @@ function ft({
2452
2483
  /* @__PURE__ */ e(
2453
2484
  "button",
2454
2485
  {
2455
- onClick: () => A(!0),
2486
+ onClick: () => L(!0),
2456
2487
  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",
2457
2488
  children: "Import"
2458
2489
  }
@@ -2530,10 +2561,10 @@ function ft({
2530
2561
  " image",
2531
2562
  n.imageIds.length !== 1 ? "s" : ""
2532
2563
  ] }),
2533
- /* @__PURE__ */ e("div", { className: "flex gap-2", children: n.imageUrls.slice(0, 4).map((z, U) => /* @__PURE__ */ e("a", { href: z, target: "_blank", rel: "noopener noreferrer", className: "block", children: /* @__PURE__ */ e(
2564
+ /* @__PURE__ */ e("div", { className: "flex gap-2", children: n.imageUrls.slice(0, 4).map((N, U) => /* @__PURE__ */ e("a", { href: N, target: "_blank", rel: "noopener noreferrer", className: "block", children: /* @__PURE__ */ e(
2534
2565
  "img",
2535
2566
  {
2536
- src: z,
2567
+ src: N,
2537
2568
  alt: "Generated",
2538
2569
  className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
2539
2570
  }
@@ -2543,7 +2574,7 @@ function ft({
2543
2574
  "Error: ",
2544
2575
  n.error
2545
2576
  ] }) }),
2546
- N && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ i("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: [
2577
+ f && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ i("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
2578
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-zinc-700", children: [
2548
2579
  /* @__PURE__ */ i("div", { className: "flex items-center gap-4", children: [
2549
2580
  /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Export Workflow" }),
@@ -2551,16 +2582,16 @@ function ft({
2551
2582
  /* @__PURE__ */ e(
2552
2583
  "button",
2553
2584
  {
2554
- onClick: () => R("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"}`,
2585
+ onClick: () => $("yaml"),
2586
+ className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${A === "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"}`,
2556
2587
  children: "YAML"
2557
2588
  }
2558
2589
  ),
2559
2590
  /* @__PURE__ */ e(
2560
2591
  "button",
2561
2592
  {
2562
- onClick: () => R("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"}`,
2593
+ onClick: () => $("javascript"),
2594
+ className: `px-3 py-1 text-sm font-medium rounded-md transition-colors ${A === "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"}`,
2564
2595
  children: "JavaScript"
2565
2596
  }
2566
2597
  )
@@ -2569,7 +2600,7 @@ function ft({
2569
2600
  /* @__PURE__ */ e(
2570
2601
  "button",
2571
2602
  {
2572
- onClick: () => W(!1),
2603
+ onClick: () => C(!1),
2573
2604
  className: "text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200",
2574
2605
  children: /* @__PURE__ */ e("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
2575
2606
  "path",
@@ -2583,14 +2614,14 @@ function ft({
2583
2614
  }
2584
2615
  )
2585
2616
  ] }),
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" ? Q : I }) }),
2617
+ /* @__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: A === "yaml" ? Q : S }) }),
2587
2618
  /* @__PURE__ */ i("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" }),
2619
+ /* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: A === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
2589
2620
  /* @__PURE__ */ i("div", { className: "flex gap-2", children: [
2590
2621
  /* @__PURE__ */ e(
2591
2622
  "button",
2592
2623
  {
2593
- onClick: ke,
2624
+ onClick: ve,
2594
2625
  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",
2595
2626
  children: "Copy to Clipboard"
2596
2627
  }
@@ -2598,7 +2629,7 @@ function ft({
2598
2629
  /* @__PURE__ */ e(
2599
2630
  "button",
2600
2631
  {
2601
- onClick: () => W(!1),
2632
+ onClick: () => C(!1),
2602
2633
  className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700",
2603
2634
  children: "Close"
2604
2635
  }
@@ -2609,15 +2640,15 @@ function ft({
2609
2640
  /* @__PURE__ */ e(
2610
2641
  ht,
2611
2642
  {
2612
- isOpen: y,
2613
- onClose: () => A(!1),
2614
- onImport: ve
2643
+ isOpen: b,
2644
+ onClose: () => L(!1),
2645
+ onImport: ke
2615
2646
  }
2616
2647
  )
2617
2648
  ] });
2618
2649
  }
2619
2650
  function bt() {
2620
- const r = x((a) => a.loadTemplate), [d, t] = C(null), {
2651
+ const r = w((a) => a.loadTemplate), [d, t] = I(null), {
2621
2652
  data: o,
2622
2653
  isLoading: s,
2623
2654
  error: n,
@@ -2695,14 +2726,14 @@ function xt({ image: r, onLoadWorkflow: d, isLoading: t }) {
2695
2726
  /* @__PURE__ */ e(
2696
2727
  "a",
2697
2728
  {
2698
- href: le(r.id),
2729
+ href: te(r.id),
2699
2730
  target: "_blank",
2700
2731
  rel: "noopener noreferrer",
2701
2732
  className: "block aspect-square bg-gray-100 dark:bg-zinc-900",
2702
2733
  children: /* @__PURE__ */ e(
2703
2734
  "img",
2704
2735
  {
2705
- src: le(r.id),
2736
+ src: te(r.id),
2706
2737
  alt: r.filename,
2707
2738
  className: "w-full h-full object-cover",
2708
2739
  loading: "lazy"
@@ -2710,17 +2741,38 @@ function xt({ image: r, onLoadWorkflow: d, isLoading: t }) {
2710
2741
  )
2711
2742
  }
2712
2743
  ),
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(
2714
- "button",
2715
- {
2716
- onClick: (n) => {
2717
- n.preventDefault(), d();
2718
- },
2719
- disabled: t,
2720
- className: "px-3 py-1.5 bg-teal-600 text-white text-sm rounded-lg hover:bg-teal-700 disabled:opacity-50",
2721
- children: t ? "Loading..." : "Load Workflow"
2722
- }
2723
- ) })
2744
+ /* @__PURE__ */ i("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2", children: [
2745
+ /* @__PURE__ */ e(
2746
+ "button",
2747
+ {
2748
+ onClick: (n) => {
2749
+ n.preventDefault(), d();
2750
+ },
2751
+ disabled: t,
2752
+ className: "px-3 py-1.5 bg-teal-600 text-white text-sm rounded-lg hover:bg-teal-700 disabled:opacity-50",
2753
+ children: t ? "Loading..." : "Load Workflow"
2754
+ }
2755
+ ),
2756
+ /* @__PURE__ */ e(
2757
+ "a",
2758
+ {
2759
+ href: te(r.id),
2760
+ download: r.filename,
2761
+ onClick: (n) => n.stopPropagation(),
2762
+ className: "p-1.5 bg-zinc-700 text-white rounded-lg hover:bg-zinc-600",
2763
+ title: "Download image",
2764
+ children: /* @__PURE__ */ e("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e(
2765
+ "path",
2766
+ {
2767
+ strokeLinecap: "round",
2768
+ strokeLinejoin: "round",
2769
+ strokeWidth: 2,
2770
+ d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
2771
+ }
2772
+ ) })
2773
+ }
2774
+ )
2775
+ ] })
2724
2776
  ] }),
2725
2777
  /* @__PURE__ */ i("div", { className: "p-3", children: [
2726
2778
  /* @__PURE__ */ e("div", { className: "text-sm font-medium text-gray-800 dark:text-white truncate", children: r.filename }),
@@ -2973,7 +3025,7 @@ const yt = {
2973
3025
  { id: "e3", source: "transform-corners", target: "transform-png" }
2974
3026
  ]
2975
3027
  }
2976
- }, kt = {
3028
+ }, vt = {
2977
3029
  id: "framework-usage",
2978
3030
  name: "Framework Usage Stats",
2979
3031
  description: "Blog-ready comparison chart with optimized sizing and fast web loading",
@@ -3095,7 +3147,7 @@ const yt = {
3095
3147
  { id: "e3", source: "transform-padding", target: "transform-webp" }
3096
3148
  ]
3097
3149
  }
3098
- }, vt = {
3150
+ }, kt = {
3099
3151
  id: "traffic-breakdown",
3100
3152
  name: "Traffic by Device",
3101
3153
  description: "Analytics breakdown optimized for Slack sharing and weekly reports",
@@ -3598,8 +3650,8 @@ const yt = {
3598
3650
  }, It = [
3599
3651
  yt,
3600
3652
  wt,
3601
- kt,
3602
3653
  vt,
3654
+ kt,
3603
3655
  Nt,
3604
3656
  zt,
3605
3657
  Ct
@@ -4003,7 +4055,7 @@ const yt = {
4003
4055
  { id: "e2", source: "transform-bg", target: "transform-caption" }
4004
4056
  ]
4005
4057
  }
4006
- }, Mt = {
4058
+ }, Tt = {
4007
4059
  id: "cloud-ai-social",
4008
4060
  name: "AI Art to Social Post",
4009
4061
  description: "Generate creative AI art, optimize for social media",
@@ -4080,13 +4132,13 @@ const yt = {
4080
4132
  { id: "e3", source: "transform-caption", target: "transform-webp" }
4081
4133
  ]
4082
4134
  }
4083
- }, Tt = [
4135
+ }, Mt = [
4084
4136
  St,
4085
4137
  At,
4086
4138
  Lt,
4087
4139
  Wt,
4088
4140
  Pt,
4089
- Mt
4141
+ Tt
4090
4142
  ], Dt = {
4091
4143
  id: "social-media-kit",
4092
4144
  name: "Social Media Kit",
@@ -4408,7 +4460,7 @@ const socialKit = await floimg.pipeline(heroImage, [
4408
4460
  { id: "e3", source: "input-1", target: "transform-dramatic" }
4409
4461
  ]
4410
4462
  }
4411
- }, $t = {
4463
+ }, Rt = {
4412
4464
  id: "responsive-images",
4413
4465
  name: "Responsive Image Pipeline",
4414
4466
  description: "Generate thumbnail, mobile, tablet, desktop, and retina sizes from one source",
@@ -4512,7 +4564,7 @@ const responsive = await floimg.from(source)
4512
4564
  { id: "e5", source: "input-1", target: "transform-retina" }
4513
4565
  ]
4514
4566
  }
4515
- }, Rt = {
4567
+ }, $t = {
4516
4568
  id: "team-headshots",
4517
4569
  name: "Team Headshot Standardizer",
4518
4570
  description: "Standardize team photos with consistent sizing and professional styling",
@@ -4979,8 +5031,8 @@ const responsive = await floimg.from(source)
4979
5031
  Ut,
4980
5032
  Bt,
4981
5033
  jt,
4982
- $t,
4983
5034
  Rt,
5035
+ $t,
4984
5036
  Et,
4985
5037
  Gt,
4986
5038
  qt,
@@ -5400,15 +5452,15 @@ const responsive = await floimg.from(source)
5400
5452
  Kt,
5401
5453
  _t,
5402
5454
  Qt
5403
- ], oe = [
5455
+ ], ie = [
5404
5456
  ...It,
5405
- ...Tt,
5457
+ ...Mt,
5406
5458
  ...Ft,
5407
5459
  ...Jt
5408
- ], _ = oe.filter((r) => !r.requiresCloud);
5409
- oe.filter((r) => r.requiresCloud);
5460
+ ], _ = ie.filter((r) => !r.requiresCloud);
5461
+ ie.filter((r) => r.requiresCloud);
5410
5462
  function Yt(r) {
5411
- return oe.find((d) => d.id === r);
5463
+ return ie.find((d) => d.id === r);
5412
5464
  }
5413
5465
  function hr(r) {
5414
5466
  return _.find((d) => d.id === r);
@@ -5431,14 +5483,14 @@ function ge(r) {
5431
5483
  return Yt(r);
5432
5484
  }
5433
5485
  function Zt({ onSelect: r }) {
5434
- const [d, t] = C(null), [o, s] = C(""), n = de(() => Xt(), []), p = de(() => {
5486
+ const [d, t] = I(null), [o, s] = I(""), n = le(() => Xt(), []), p = le(() => {
5435
5487
  let l = _;
5436
5488
  if (d && (l = l.filter((a) => a.category === d)), o) {
5437
5489
  const a = o.toLowerCase();
5438
5490
  l = l.filter(
5439
5491
  (m) => {
5440
5492
  var c;
5441
- return m.name.toLowerCase().includes(a) || m.description.toLowerCase().includes(a) || m.generator.toLowerCase().includes(a) || ((c = m.tags) == null ? void 0 : c.some((g) => g.toLowerCase().includes(a)));
5493
+ 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)));
5442
5494
  }
5443
5495
  );
5444
5496
  }
@@ -5595,11 +5647,11 @@ function tr({
5595
5647
  onRename: s,
5596
5648
  onDuplicate: n
5597
5649
  }) {
5598
- const [p, l] = C(!1), [a, m] = C(r.name), [c, g] = C(!1), h = () => {
5650
+ const [p, l] = I(!1), [a, m] = I(r.name), [c, u] = I(!1), h = () => {
5599
5651
  a.trim() && a !== r.name && s(a.trim()), l(!1);
5600
- }, b = (k) => {
5601
- const w = new Date(k), f = (/* @__PURE__ */ new Date()).getTime() - w.getTime(), u = Math.floor(f / 6e4), N = Math.floor(f / 36e5), W = Math.floor(f / 864e5);
5602
- return u < 1 ? "Just now" : u < 60 ? `${u}m ago` : N < 24 ? `${N}h ago` : W < 7 ? `${W}d ago` : w.toLocaleDateString();
5652
+ }, x = (v) => {
5653
+ const y = new Date(v), z = (/* @__PURE__ */ new Date()).getTime() - y.getTime(), g = Math.floor(z / 6e4), f = Math.floor(z / 36e5), C = Math.floor(z / 864e5);
5654
+ return g < 1 ? "Just now" : g < 60 ? `${g}m ago` : f < 24 ? `${f}h ago` : C < 7 ? `${C}d ago` : y.toLocaleDateString();
5603
5655
  };
5604
5656
  return /* @__PURE__ */ i(
5605
5657
  "div",
@@ -5613,41 +5665,41 @@ function tr({
5613
5665
  {
5614
5666
  type: "text",
5615
5667
  value: a,
5616
- onChange: (k) => m(k.target.value),
5668
+ onChange: (v) => m(v.target.value),
5617
5669
  onBlur: h,
5618
- onKeyDown: (k) => {
5619
- k.key === "Enter" && h(), k.key === "Escape" && (m(r.name), l(!1));
5670
+ onKeyDown: (v) => {
5671
+ v.key === "Enter" && h(), v.key === "Escape" && (m(r.name), l(!1));
5620
5672
  },
5621
5673
  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",
5622
5674
  autoFocus: !0,
5623
- onClick: (k) => k.stopPropagation()
5675
+ onClick: (v) => v.stopPropagation()
5624
5676
  }
5625
5677
  ) : /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate", children: r.name }),
5626
5678
  /* @__PURE__ */ i("span", { className: "block text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: [
5627
5679
  r.nodes.length,
5628
5680
  " nodes · Updated ",
5629
- b(r.updatedAt)
5681
+ x(r.updatedAt)
5630
5682
  ] })
5631
5683
  ] }),
5632
5684
  /* @__PURE__ */ i("div", { className: "relative", children: [
5633
5685
  /* @__PURE__ */ e(
5634
5686
  "button",
5635
5687
  {
5636
- onClick: (k) => {
5637
- k.stopPropagation(), g(!c);
5688
+ onClick: (v) => {
5689
+ v.stopPropagation(), u(!c);
5638
5690
  },
5639
5691
  className: "p-1 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 rounded opacity-0 group-hover:opacity-100 transition-opacity",
5640
5692
  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" }) })
5641
5693
  }
5642
5694
  ),
5643
5695
  c && /* @__PURE__ */ i(G, { children: [
5644
- /* @__PURE__ */ e("div", { className: "fixed inset-0 z-10", onClick: () => g(!1) }),
5696
+ /* @__PURE__ */ e("div", { className: "fixed inset-0 z-10", onClick: () => u(!1) }),
5645
5697
  /* @__PURE__ */ i("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: [
5646
5698
  /* @__PURE__ */ e(
5647
5699
  "button",
5648
5700
  {
5649
- onClick: (k) => {
5650
- k.stopPropagation(), l(!0), g(!1);
5701
+ onClick: (v) => {
5702
+ v.stopPropagation(), l(!0), u(!1);
5651
5703
  },
5652
5704
  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",
5653
5705
  children: "Rename"
@@ -5656,8 +5708,8 @@ function tr({
5656
5708
  /* @__PURE__ */ e(
5657
5709
  "button",
5658
5710
  {
5659
- onClick: (k) => {
5660
- k.stopPropagation(), n(), g(!1);
5711
+ onClick: (v) => {
5712
+ v.stopPropagation(), n(), u(!1);
5661
5713
  },
5662
5714
  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",
5663
5715
  children: "Duplicate"
@@ -5666,8 +5718,8 @@ function tr({
5666
5718
  /* @__PURE__ */ e(
5667
5719
  "button",
5668
5720
  {
5669
- onClick: (k) => {
5670
- k.stopPropagation(), window.confirm("Delete this workflow?") && o(), g(!1);
5721
+ onClick: (v) => {
5722
+ v.stopPropagation(), window.confirm("Delete this workflow?") && o(), u(!1);
5671
5723
  },
5672
5724
  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",
5673
5725
  children: "Delete"
@@ -5683,9 +5735,9 @@ function tr({
5683
5735
  );
5684
5736
  }
5685
5737
  function rr() {
5686
- const r = x((c) => c.showLibrary), d = x((c) => c.toggleLibrary), t = x((c) => c.savedWorkflows), o = x((c) => c.activeWorkflowId), s = x((c) => c.loadWorkflow), n = x((c) => c.deleteWorkflow), p = x((c) => c.renameWorkflow), l = x((c) => c.duplicateWorkflow), a = x((c) => c.newWorkflow);
5738
+ const r = w((c) => c.showLibrary), d = w((c) => c.toggleLibrary), t = w((c) => c.savedWorkflows), o = w((c) => c.activeWorkflowId), s = w((c) => c.loadWorkflow), n = w((c) => c.deleteWorkflow), p = w((c) => c.renameWorkflow), l = w((c) => c.duplicateWorkflow), a = w((c) => c.newWorkflow);
5687
5739
  if (!r) return null;
5688
- const m = [...t].sort((c, g) => g.updatedAt - c.updatedAt);
5740
+ const m = [...t].sort((c, u) => u.updatedAt - c.updatedAt);
5689
5741
  return /* @__PURE__ */ i(G, { children: [
5690
5742
  /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: d }),
5691
5743
  /* @__PURE__ */ i("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: [
@@ -5759,7 +5811,7 @@ function rr() {
5759
5811
  s(c.id), d();
5760
5812
  },
5761
5813
  onDelete: () => n(c.id),
5762
- onRename: (g) => p(c.id, g),
5814
+ onRename: (u) => p(c.id, u),
5763
5815
  onDuplicate: () => l(c.id)
5764
5816
  },
5765
5817
  c.id
@@ -5826,12 +5878,12 @@ const ar = [
5826
5878
  }
5827
5879
  ];
5828
5880
  function ir({ provider: r }) {
5829
- const d = q((h) => h.ai), t = q((h) => h.setAIProvider), o = d[r.id], s = (o == null ? void 0 : o.enabled) ?? !1, n = (o == null ? void 0 : o.apiKey) ?? "", [p, l] = C(n), [a, m] = C(!1), c = () => {
5881
+ const d = q((h) => h.ai), t = q((h) => h.setAIProvider), o = d[r.id], s = (o == null ? void 0 : o.enabled) ?? !1, n = (o == null ? void 0 : o.apiKey) ?? "", [p, l] = I(n), [a, m] = I(!1), c = () => {
5830
5882
  t(r.id, {
5831
5883
  apiKey: p,
5832
5884
  enabled: !s
5833
5885
  });
5834
- }, g = (h) => {
5886
+ }, u = (h) => {
5835
5887
  l(h), t(r.id, {
5836
5888
  apiKey: h,
5837
5889
  enabled: s
@@ -5859,7 +5911,7 @@ function ir({ provider: r }) {
5859
5911
  {
5860
5912
  type: a ? "text" : "password",
5861
5913
  value: p,
5862
- onChange: (h) => g(h.target.value),
5914
+ onChange: (h) => u(h.target.value),
5863
5915
  placeholder: r.placeholder,
5864
5916
  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"
5865
5917
  }
@@ -5907,7 +5959,7 @@ function ir({ provider: r }) {
5907
5959
  ] });
5908
5960
  }
5909
5961
  function nr({ provider: r }) {
5910
- const d = q((c) => c.ai), t = q((c) => c.setAIProvider), o = d[r.id], s = (o == null ? void 0 : o.enabled) ?? !1, n = (o == null ? void 0 : o.baseUrl) ?? r.defaultUrl, [p, l] = C(n), a = () => {
5962
+ const d = q((c) => c.ai), t = q((c) => c.setAIProvider), o = d[r.id], s = (o == null ? void 0 : o.enabled) ?? !1, n = (o == null ? void 0 : o.baseUrl) ?? r.defaultUrl, [p, l] = I(n), a = () => {
5911
5963
  t(r.id, {
5912
5964
  baseUrl: p,
5913
5965
  enabled: !s
@@ -6031,30 +6083,30 @@ function sr() {
6031
6083
  ] }) }) : null;
6032
6084
  }
6033
6085
  function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6034
- const [o, s] = C([]), [n, p] = C(""), [l, a] = C(!1), [m, c] = C(null), [g, h] = C(null), [b, k] = C(""), [w, v] = C(), [f, u] = C(!1), [N, W] = C(), y = te(null), A = te(null);
6086
+ const [o, s] = I([]), [n, p] = I(""), [l, a] = I(!1), [m, c] = I(null), [u, h] = I(null), [x, v] = I(""), [y, k] = I(), [z, g] = I(!1), [f, C] = I(), b = re(null), L = re(null);
6035
6087
  j(() => {
6036
- r && g === null && Qe().then((I) => {
6037
- h(I.available), k(I.message), v(I.reason), u(I.isCloudDeployment ?? !1), W(I.supportUrl);
6088
+ r && u === null && Qe().then((S) => {
6089
+ h(S.available), v(S.message), k(S.reason), g(S.isCloudDeployment ?? !1), C(S.supportUrl);
6038
6090
  }).catch(() => {
6039
- h(!1), k("Failed to check AI availability"), v("service_unavailable");
6091
+ h(!1), v("Failed to check AI availability"), k("service_unavailable");
6040
6092
  });
6041
- }, [r, g]), j(() => {
6042
- r && A.current && A.current.focus();
6093
+ }, [r, u]), j(() => {
6094
+ r && L.current && L.current.focus();
6043
6095
  }, [r]), j(() => {
6044
- var I;
6045
- (I = y.current) == null || I.scrollIntoView({ behavior: "smooth" });
6096
+ var S;
6097
+ (S = b.current) == null || S.scrollIntoView({ behavior: "smooth" });
6046
6098
  }, [o]);
6047
- const S = L(async () => {
6099
+ const A = W(async () => {
6048
6100
  if (!n.trim() || l) return;
6049
- const I = {
6101
+ const S = {
6050
6102
  role: "user",
6051
6103
  content: n.trim(),
6052
6104
  timestamp: Date.now()
6053
6105
  };
6054
- s((D) => [...D, I]), p(""), a(!0), c(null);
6106
+ s((D) => [...D, S]), p(""), a(!0), c(null);
6055
6107
  try {
6056
6108
  const D = await _e({
6057
- prompt: I.content,
6109
+ prompt: S.content,
6058
6110
  history: o
6059
6111
  }), E = {
6060
6112
  role: "assistant",
@@ -6062,16 +6114,16 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6062
6114
  workflow: D.workflow,
6063
6115
  timestamp: Date.now()
6064
6116
  };
6065
- s(($) => [...$, E]), !D.success && D.error && c(D.error);
6117
+ s((R) => [...R, E]), !D.success && D.error && c(D.error);
6066
6118
  } catch (D) {
6067
6119
  c(D instanceof Error ? D.message : "Failed to generate workflow");
6068
6120
  } finally {
6069
6121
  a(!1);
6070
6122
  }
6071
- }, [n, l, o]), R = (I) => {
6072
- I.key === "Enter" && !I.shiftKey && (I.preventDefault(), S());
6073
- }, Q = (I) => {
6074
- t(I), d();
6123
+ }, [n, l, o]), $ = (S) => {
6124
+ S.key === "Enter" && !S.shiftKey && (S.preventDefault(), A());
6125
+ }, Q = (S) => {
6126
+ t(S), d();
6075
6127
  }, Y = () => {
6076
6128
  s([]), c(null);
6077
6129
  };
@@ -6138,8 +6190,8 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6138
6190
  ] })
6139
6191
  ] }),
6140
6192
  /* @__PURE__ */ i("div", { className: "flex-1 overflow-auto p-4 space-y-4", children: [
6141
- g === !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__ */ i("div", { className: "flex items-start gap-3", children: [
6142
- w === "tier_limit" ? /* @__PURE__ */ e(
6193
+ 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__ */ i("div", { className: "flex items-start gap-3", children: [
6194
+ y === "tier_limit" ? /* @__PURE__ */ e(
6143
6195
  "svg",
6144
6196
  {
6145
6197
  className: "h-5 w-5 text-amber-600 dark:text-amber-400 mt-0.5",
@@ -6175,10 +6227,10 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6175
6227
  }
6176
6228
  ),
6177
6229
  /* @__PURE__ */ i("div", { children: [
6178
- /* @__PURE__ */ e("p", { className: "font-medium text-amber-800 dark:text-amber-200", children: w === "tier_limit" ? "AI Workflow Generation Not Available" : "AI Generation Not Available" }),
6179
- /* @__PURE__ */ e("p", { className: "text-sm text-amber-700 dark:text-amber-300 mt-1", children: b }),
6230
+ /* @__PURE__ */ e("p", { className: "font-medium text-amber-800 dark:text-amber-200", children: y === "tier_limit" ? "AI Workflow Generation Not Available" : "AI Generation Not Available" }),
6231
+ /* @__PURE__ */ e("p", { className: "text-sm text-amber-700 dark:text-amber-300 mt-1", children: x }),
6180
6232
  /* @__PURE__ */ i("div", { className: "flex flex-col sm:flex-row gap-2 mt-3", children: [
6181
- w === "tier_limit" && /* @__PURE__ */ e(
6233
+ y === "tier_limit" && /* @__PURE__ */ e(
6182
6234
  "a",
6183
6235
  {
6184
6236
  href: "/pricing",
@@ -6186,15 +6238,15 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6186
6238
  children: "View Plans"
6187
6239
  }
6188
6240
  ),
6189
- w === "service_unavailable" && N && /* @__PURE__ */ e(
6241
+ y === "service_unavailable" && f && /* @__PURE__ */ e(
6190
6242
  "a",
6191
6243
  {
6192
- href: N,
6244
+ href: f,
6193
6245
  className: "text-sm font-medium text-amber-700 hover:text-amber-800 dark:text-amber-400 dark:hover:text-amber-300",
6194
6246
  children: "Contact Support"
6195
6247
  }
6196
6248
  ),
6197
- w === "not_configured" && !f && /* @__PURE__ */ e(
6249
+ y === "not_configured" && !z && /* @__PURE__ */ e(
6198
6250
  "a",
6199
6251
  {
6200
6252
  href: "https://floimg.com/docs/studio/ai-workflows",
@@ -6207,7 +6259,7 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6207
6259
  ] })
6208
6260
  ] })
6209
6261
  ] }) }),
6210
- o.length === 0 && g !== !1 && /* @__PURE__ */ i("div", { className: "text-center py-8", children: [
6262
+ o.length === 0 && u !== !1 && /* @__PURE__ */ i("div", { className: "text-center py-8", children: [
6211
6263
  /* @__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(
6212
6264
  "svg",
6213
6265
  {
@@ -6234,44 +6286,44 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6234
6286
  "Generate an image with Gemini, then use it as a reference to create a variation with different lighting",
6235
6287
  "Create a product mockup: generate a minimalist logo, then composite it onto a t-shirt image",
6236
6288
  "Build an AI art pipeline: generate a base image, apply artistic style transfer, then upscale to 4K"
6237
- ].map((I, D) => /* @__PURE__ */ i(
6289
+ ].map((S, D) => /* @__PURE__ */ i(
6238
6290
  "button",
6239
6291
  {
6240
- onClick: () => p(I),
6292
+ onClick: () => p(S),
6241
6293
  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",
6242
6294
  children: [
6243
6295
  '"',
6244
- I,
6296
+ S,
6245
6297
  '"'
6246
6298
  ]
6247
6299
  },
6248
6300
  D
6249
6301
  )) })
6250
6302
  ] }),
6251
- o.map((I, D) => /* @__PURE__ */ e(
6303
+ o.map((S, D) => /* @__PURE__ */ e(
6252
6304
  "div",
6253
6305
  {
6254
- className: `flex ${I.role === "user" ? "justify-end" : "justify-start"}`,
6306
+ className: `flex ${S.role === "user" ? "justify-end" : "justify-start"}`,
6255
6307
  children: /* @__PURE__ */ i(
6256
6308
  "div",
6257
6309
  {
6258
- className: `max-w-[80%] rounded-lg px-4 py-3 ${I.role === "user" ? "bg-teal-600 text-white" : "bg-gray-100 dark:bg-zinc-700 text-gray-900 dark:text-white"}`,
6310
+ className: `max-w-[80%] rounded-lg px-4 py-3 ${S.role === "user" ? "bg-teal-600 text-white" : "bg-gray-100 dark:bg-zinc-700 text-gray-900 dark:text-white"}`,
6259
6311
  children: [
6260
- /* @__PURE__ */ e("p", { className: "text-sm whitespace-pre-wrap", children: I.content }),
6261
- I.role === "assistant" && I.workflow && /* @__PURE__ */ i("div", { className: "mt-3 pt-3 border-t border-gray-200 dark:border-zinc-600", children: [
6312
+ /* @__PURE__ */ e("p", { className: "text-sm whitespace-pre-wrap", children: S.content }),
6313
+ S.role === "assistant" && S.workflow && /* @__PURE__ */ i("div", { className: "mt-3 pt-3 border-t border-gray-200 dark:border-zinc-600", children: [
6262
6314
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-2", children: [
6263
6315
  /* @__PURE__ */ e("span", { className: "text-xs font-medium text-gray-500 dark:text-zinc-400", children: "Generated Workflow" }),
6264
6316
  /* @__PURE__ */ e(
6265
6317
  "button",
6266
6318
  {
6267
- onClick: () => Q(I.workflow),
6319
+ onClick: () => Q(S.workflow),
6268
6320
  className: "text-xs px-3 py-1 bg-teal-600 hover:bg-teal-700 text-white rounded transition-colors",
6269
6321
  children: "Apply to Canvas"
6270
6322
  }
6271
6323
  )
6272
6324
  ] }),
6273
6325
  /* @__PURE__ */ e("div", { className: "bg-white dark:bg-zinc-800 rounded p-2 text-xs", children: /* @__PURE__ */ i("div", { className: "space-y-1", children: [
6274
- I.workflow.nodes.map((E, $) => /* @__PURE__ */ i(
6326
+ S.workflow.nodes.map((E, R) => /* @__PURE__ */ i(
6275
6327
  "div",
6276
6328
  {
6277
6329
  className: "flex items-center gap-2 text-gray-600 dark:text-zinc-300",
@@ -6284,12 +6336,12 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6284
6336
  ] })
6285
6337
  ]
6286
6338
  },
6287
- $
6339
+ R
6288
6340
  )),
6289
- I.workflow.edges.length > 0 && /* @__PURE__ */ i("div", { className: "text-gray-400 dark:text-zinc-500 pt-1", children: [
6290
- I.workflow.edges.length,
6341
+ S.workflow.edges.length > 0 && /* @__PURE__ */ i("div", { className: "text-gray-400 dark:text-zinc-500 pt-1", children: [
6342
+ S.workflow.edges.length,
6291
6343
  " connection",
6292
- I.workflow.edges.length !== 1 ? "s" : ""
6344
+ S.workflow.edges.length !== 1 ? "s" : ""
6293
6345
  ] })
6294
6346
  ] }) })
6295
6347
  ] })
@@ -6320,19 +6372,19 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6320
6372
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: "Generating workflow..." })
6321
6373
  ] }) }) }),
6322
6374
  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 }) }),
6323
- /* @__PURE__ */ e("div", { ref: y })
6375
+ /* @__PURE__ */ e("div", { ref: b })
6324
6376
  ] }),
6325
6377
  /* @__PURE__ */ i("div", { className: "border-t border-gray-200 dark:border-zinc-700 p-4", children: [
6326
6378
  /* @__PURE__ */ i("div", { className: "flex gap-2", children: [
6327
6379
  /* @__PURE__ */ e(
6328
6380
  "textarea",
6329
6381
  {
6330
- ref: A,
6382
+ ref: L,
6331
6383
  value: n,
6332
- onChange: (I) => p(I.target.value),
6333
- onKeyDown: R,
6334
- placeholder: g === !1 ? "AI generation not available" : "Describe what workflow you want to create...",
6335
- disabled: l || g === !1,
6384
+ onChange: (S) => p(S.target.value),
6385
+ onKeyDown: $,
6386
+ placeholder: u === !1 ? "AI generation not available" : "Describe what workflow you want to create...",
6387
+ disabled: l || u === !1,
6336
6388
  rows: 2,
6337
6389
  className: "flex-1 resize-none rounded-lg border border-gray-300 dark:border-zinc-600 bg-white dark:bg-zinc-900 px-4 py-2 text-sm text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-zinc-500 focus:border-teal-500 focus:outline-none focus:ring-1 focus:ring-teal-500 disabled:opacity-50 disabled:cursor-not-allowed"
6338
6390
  }
@@ -6340,8 +6392,8 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6340
6392
  /* @__PURE__ */ e(
6341
6393
  "button",
6342
6394
  {
6343
- onClick: S,
6344
- disabled: !n.trim() || l || g === !1,
6395
+ onClick: A,
6396
+ disabled: !n.trim() || l || u === !1,
6345
6397
  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",
6346
6398
  children: /* @__PURE__ */ e("svg", { className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
6347
6399
  "path",
@@ -6360,7 +6412,7 @@ function dr({ isOpen: r, onClose: d, onApplyWorkflow: t }) {
6360
6412
  ] }) }) : null;
6361
6413
  }
6362
6414
  function lr() {
6363
- const { screenToFlowPosition: r } = Me(), d = x((s) => s.addNode), t = L(
6415
+ const { screenToFlowPosition: r } = Te(), d = w((s) => s.addNode), t = W(
6364
6416
  (s) => {
6365
6417
  s.preventDefault();
6366
6418
  const n = s.dataTransfer.getData("application/json");
@@ -6376,13 +6428,13 @@ function lr() {
6376
6428
  }
6377
6429
  },
6378
6430
  [d, r]
6379
- ), o = L((s) => {
6431
+ ), o = W((s) => {
6380
6432
  s.preventDefault(), s.dataTransfer.dropEffect = "move";
6381
6433
  }, []);
6382
6434
  return /* @__PURE__ */ e("div", { className: "flex-1", onDrop: t, onDragOver: o, children: /* @__PURE__ */ e(it, {}) });
6383
6435
  }
6384
6436
  function xr() {
6385
- const [r, d] = C("editor"), [t, o] = C(!1), s = x((a) => a.loadTemplate), n = x((a) => a.loadGeneratedWorkflow);
6437
+ const [r, d] = I("editor"), [t, o] = I(!1), s = w((a) => a.loadTemplate), n = w((a) => a.loadGeneratedWorkflow);
6386
6438
  j(() => {
6387
6439
  const m = new URLSearchParams(window.location.search).get("template");
6388
6440
  if (m) {
@@ -6397,13 +6449,13 @@ function xr() {
6397
6449
  window.removeEventListener("workflow-loaded", a);
6398
6450
  };
6399
6451
  }, []);
6400
- const p = L(
6452
+ const p = W(
6401
6453
  (a) => {
6402
6454
  const m = ge(a);
6403
6455
  m && (s(m), d("editor"));
6404
6456
  },
6405
6457
  [s]
6406
- ), l = L(
6458
+ ), l = W(
6407
6459
  (a) => {
6408
6460
  n(a), d("editor");
6409
6461
  },
@@ -6499,6 +6551,6 @@ export {
6499
6551
  ge as resolveTemplate,
6500
6552
  br as searchTemplates,
6501
6553
  _ as templates,
6502
- x as useWorkflowStore
6554
+ w as useWorkflowStore
6503
6555
  };
6504
6556
  //# sourceMappingURL=index.js.map