@oomol-lab/open-flow 0.1.0-beta.1 → 0.1.0-beta.10

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.
Files changed (54) hide show
  1. package/dist/browser/DesignerIcon-DjgOMYI5.js +2065 -0
  2. package/dist/browser/{createResourceDialog-DXQz0thK.js → createResourceDialog-DNBueSYZ.js} +161 -160
  3. package/dist/browser/{dist-BMqL-qR5.js → dist-BMRLCebL.js} +291 -292
  4. package/dist/browser/{dist-DWADUsVB.js → dist-By46o5UV.js} +47 -47
  5. package/dist/browser/dist-CP0883sY.js +4 -0
  6. package/dist/browser/{dist-CJpzJrLM.js → dist-Cc0y2Pli.js} +811 -812
  7. package/dist/browser/{dist-DUzA0Ukh.js → dist-Dg_VXC8f.js} +134 -135
  8. package/dist/browser/{dist-3Mj8q8Pr.js → dist-DmuE3M0R.js} +53 -54
  9. package/dist/browser/{dist-BN4ZCyOB.js → dist-DpDLsYtO.js} +14 -15
  10. package/dist/browser/dist-DxahK_I8.js +2688 -0
  11. package/dist/browser/{dist-CPuF50D9.js → dist-meg_oHVR.js} +335 -335
  12. package/dist/browser/{esm-DGQbgYoJ.js → esm-yhVU_KbQ.js} +5 -6
  13. package/dist/browser/flow-authoring-module.d.ts +2 -2
  14. package/dist/browser/flow-authoring-node.d.ts +6 -3
  15. package/dist/browser/flow-authoring.d.ts +1 -1
  16. package/dist/browser/flow-authoring.js +509 -209
  17. package/dist/browser/flow-change.d.ts +113 -9
  18. package/dist/browser/flow-change.js +323 -96
  19. package/dist/browser/flow-notifications.d.ts +5 -0
  20. package/dist/browser/flowChanges-B2ttnaj9.js +12265 -0
  21. package/dist/browser/{flowRunInputEditorStore-BeyUSWpO.js → flowRunInputEditorStore-DDidwd8h.js} +728 -719
  22. package/dist/browser/{flowWorkspace-DwyxAOBH.js → flowWorkspace-Dr8-Hut9.js} +40821 -42895
  23. package/dist/browser/{getPseudoElementBounds-ESJExRFX.js → getPseudoElementBounds-5LArT6Xc.js} +1827 -2322
  24. package/dist/browser/icons-KIOgjHpD.js +730 -0
  25. package/dist/browser/{markdownContent-DdlIRN3_.js → markdownContent-DUfLdnUt.js} +1 -1
  26. package/dist/browser/{typeScriptSession-mPCiA9sV.js → typeScriptSession-_TgJ_7Oq.js} +256 -257
  27. package/dist/browser/waitNotificationInputs-BPulOxYt.js +26 -0
  28. package/dist/browser/workbench.css +1 -1
  29. package/dist/browser/workbench.d.ts +3 -1
  30. package/dist/browser/workbench.js +1136 -1038
  31. package/dist/browser/{workbenchSelect-B2s1HV-Y.js → workbenchSelect-CbXrdwxW.js} +479 -478
  32. package/dist/common/control-api-conformance.d.ts +1 -0
  33. package/dist/common/control-api-conformance.js +126 -47
  34. package/dist/common/control-api-errors.d.ts +12 -0
  35. package/dist/common/control-api.d.ts +60 -15
  36. package/dist/common/control-api.js +225 -101
  37. package/dist/common/flow-encoding.js +24 -8
  38. package/dist/common/flow-notifications.d.ts +5 -0
  39. package/dist/common/flow-semantics.d.ts +1 -0
  40. package/dist/common/flow-semantics.js +3464 -1113
  41. package/dist/common/integration-trigger.d.ts +1 -0
  42. package/dist/common/provider-triggers.js +4 -1
  43. package/dist/common/run-events.js +2 -1
  44. package/dist/common/run-lifecycle.d.ts +17 -2
  45. package/dist/common/run-lifecycle.js +53 -2
  46. package/dist/common/runtime-contract.d.ts +1 -1
  47. package/dist/common/runtime-contract.js +27 -0
  48. package/dist/common/scheduler.d.ts +65 -4
  49. package/dist/common/scheduler.js +420 -146
  50. package/dist/index.d.ts +2 -1
  51. package/package.json +1 -1
  52. package/dist/browser/diagnostics-BGoGFvHA.js +0 -9237
  53. package/dist/browser/dist-BpopSHwP.js +0 -1543
  54. package/dist/browser/dist-CUSrALSX.js +0 -1620
@@ -0,0 +1,730 @@
1
+ import { At as e, Ot as t, Un as n, Wn as r } from "./getPseudoElementBounds-5LArT6Xc.js";
2
+ import { useMemo as i } from "react";
3
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ //#region src/ui/browser/label.tsx
5
+ function c({ className: e, ...t }) {
6
+ return /* @__PURE__ */ o("label", {
7
+ "data-slot": "label",
8
+ className: n("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
9
+ ...t
10
+ });
11
+ }
12
+ //#endregion
13
+ //#region src/ui/browser/field.tsx
14
+ function l({ className: e, ...t }) {
15
+ return /* @__PURE__ */ o("div", {
16
+ "data-slot": "field-group",
17
+ className: n("group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", e),
18
+ ...t
19
+ });
20
+ }
21
+ var u = r("group/field flex w-full gap-2 data-[invalid=true]:text-destructive", {
22
+ variants: { orientation: {
23
+ vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
24
+ horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
25
+ responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
26
+ } },
27
+ defaultVariants: { orientation: "vertical" }
28
+ });
29
+ function d({ className: e, orientation: t = "vertical", ...r }) {
30
+ return /* @__PURE__ */ o("div", {
31
+ role: "group",
32
+ "data-slot": "field",
33
+ "data-orientation": t,
34
+ className: n(u({ orientation: t }), e),
35
+ ...r
36
+ });
37
+ }
38
+ function f({ className: e, ...t }) {
39
+ return /* @__PURE__ */ o(c, {
40
+ "data-slot": "field-label",
41
+ className: n("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", e),
42
+ ...t
43
+ });
44
+ }
45
+ function p({ className: e, ...t }) {
46
+ return /* @__PURE__ */ o("p", {
47
+ "data-slot": "field-description",
48
+ className: n("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5", "last:mt-0 nth-last-2:-mt-1", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", e),
49
+ ...t
50
+ });
51
+ }
52
+ function m({ className: e, children: t, errors: r, ...a }) {
53
+ let s = i(() => {
54
+ if (t) return t;
55
+ if (!r?.length) return null;
56
+ let e = [...new Map(r.map((e) => [e?.message, e])).values()];
57
+ return e?.length == 1 ? e[0]?.message : /* @__PURE__ */ o("ul", {
58
+ className: "ml-4 flex list-disc flex-col gap-1",
59
+ children: e.map((e, t) => e?.message && /* @__PURE__ */ o("li", { children: e.message }, t))
60
+ });
61
+ }, [t, r]);
62
+ return s ? /* @__PURE__ */ o("div", {
63
+ role: "alert",
64
+ "data-slot": "field-error",
65
+ className: n("text-sm font-normal text-destructive", e),
66
+ ...a,
67
+ children: s
68
+ }) : null;
69
+ }
70
+ //#endregion
71
+ //#region ../../node_modules/.bun/lucide-react@0.468.0+f4eacebf2041cd4f/node_modules/lucide-react/dist/esm/icons/chevron-down.js
72
+ var h = e("ChevronDown", [["path", {
73
+ d: "m6 9 6 6 6-6",
74
+ key: "qrunsl"
75
+ }]]), g = e("LoaderCircle", [["path", {
76
+ d: "M21 12a9 9 0 1 1-6.219-8.56",
77
+ key: "13zald"
78
+ }]]);
79
+ //#endregion
80
+ //#region src/ui/browser/spinner.tsx
81
+ function _({ className: e, ...t }) {
82
+ return /* @__PURE__ */ o(g, {
83
+ "data-slot": "spinner",
84
+ role: "status",
85
+ "aria-label": "Loading",
86
+ className: n("size-4 animate-spin", e),
87
+ ...t
88
+ });
89
+ }
90
+ function v(e) {
91
+ let t = e.trim();
92
+ if (t.length == 0) return "empty";
93
+ if (t.length > 80) return "tooLong";
94
+ for (let e of t) {
95
+ let t = e.charCodeAt(0);
96
+ if (t <= 31 || t >= 127 && t <= 159) return "controlCharacter";
97
+ }
98
+ if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(t)) return "specialCharacter";
99
+ }
100
+ function y(e) {
101
+ return Object.fromEntries(e.flatMap((e) => "handle" in e ? [[e.handle, e]] : []));
102
+ }
103
+ var b = class extends Error {
104
+ constructor(e) {
105
+ super(e), this.name = "FlowChangeError";
106
+ }
107
+ };
108
+ function x(e) {
109
+ throw new b(e);
110
+ }
111
+ function S(e, t) {
112
+ if (t.kind == "flow") return e.graph;
113
+ let n = e.subflows[t.id];
114
+ return n ?? x("The target Subflow does not exist."), n.graph;
115
+ }
116
+ function C(e, t, n) {
117
+ if (t.kind == "flow") return {
118
+ ...e,
119
+ graph: n
120
+ };
121
+ let r = e.subflows[t.id];
122
+ return r ?? x("The target Subflow does not exist."), {
123
+ ...e,
124
+ subflows: {
125
+ ...e.subflows,
126
+ [t.id]: {
127
+ ...r,
128
+ graph: n
129
+ }
130
+ }
131
+ };
132
+ }
133
+ function w(e, t) {
134
+ if (!("inputs" in e)) return e;
135
+ let n = { ...e.inputs };
136
+ for (let [e, r] of Object.entries(n)) {
137
+ if (r.kind != "sources") continue;
138
+ let i = r.sources.filter((e) => e.kind != "node" || !t.has(e.nodeId));
139
+ i.length == 0 ? delete n[e] : n[e] = {
140
+ kind: "sources",
141
+ sources: i
142
+ };
143
+ }
144
+ return {
145
+ ...e,
146
+ inputs: n
147
+ };
148
+ }
149
+ function T(e, n) {
150
+ let r = { ...e.document }, i = { ...e.modules };
151
+ for (let e of n) switch (e.kind) {
152
+ case "binding.create":
153
+ r.bindings[e.bindingId] != null && x("A Binding with this ID already exists."), r.bindings = {
154
+ ...r.bindings,
155
+ [e.bindingId]: e.binding
156
+ };
157
+ break;
158
+ case "binding.delete": {
159
+ r.bindings[e.bindingId] ?? x("The Binding does not exist.");
160
+ let t = { ...r.bindings };
161
+ delete t[e.bindingId], r.bindings = t;
162
+ break;
163
+ }
164
+ case "binding.target.set": {
165
+ let t = r.bindings[e.bindingId];
166
+ t ?? x("The Binding does not exist."), t.target != e.before && x("The Binding target changed before this operation was applied."), r.bindings = {
167
+ ...r.bindings,
168
+ [e.bindingId]: {
169
+ ...t,
170
+ target: e.value
171
+ }
172
+ };
173
+ break;
174
+ }
175
+ case "graph.edge.connect": {
176
+ let n = S(r, e.target);
177
+ n.nodes[e.edge.source] ?? x("The source Node does not exist.");
178
+ let i = n.nodes[e.edge.target];
179
+ (i == null || !("inputs" in i)) && x("The target Node does not accept inputs.");
180
+ let a = i.inputs[e.edge.targetHandle];
181
+ t(a, e.before) || x("The target input changed before this operation was applied.");
182
+ let o = {
183
+ kind: "node",
184
+ nodeId: e.edge.source,
185
+ output: e.edge.sourceHandle
186
+ }, s = a?.kind == "sources" ? a.sources.filter((e) => e.kind != "binding" || r.bindings[e.bindingId]?.kind != "variable") : [];
187
+ s.some((e) => e.kind == "node" && e.nodeId == o.nodeId && e.output == o.output) && x("The Nodes are already connected.");
188
+ let c = {
189
+ ...i,
190
+ inputs: {
191
+ ...i.inputs,
192
+ [e.edge.targetHandle]: {
193
+ kind: "sources",
194
+ sources: [...s, o]
195
+ }
196
+ }
197
+ };
198
+ Object.assign(r, C(r, e.target, { nodes: {
199
+ ...n.nodes,
200
+ [e.edge.target]: c
201
+ } }));
202
+ break;
203
+ }
204
+ case "graph.edge.disconnect": {
205
+ let n = S(r, e.target), i = n.nodes[e.edge.target];
206
+ (i == null || !("inputs" in i)) && x("The target Node does not accept inputs.");
207
+ let a = i.inputs[e.edge.targetHandle];
208
+ (a?.kind != "sources" || !t(a, e.before)) && x("The target input changed before this operation was applied.");
209
+ let o = a.sources.filter((t) => t.kind != "node" || t.nodeId != e.edge.source || t.output != e.edge.sourceHandle);
210
+ o.length == a.sources.length && x("The Nodes are not connected.");
211
+ let s = { ...i.inputs };
212
+ o.length == 0 ? delete s[e.edge.targetHandle] : s[e.edge.targetHandle] = {
213
+ kind: "sources",
214
+ sources: o
215
+ }, Object.assign(r, C(r, e.target, { nodes: {
216
+ ...n.nodes,
217
+ [e.edge.target]: {
218
+ ...i,
219
+ inputs: s
220
+ }
221
+ } }));
222
+ break;
223
+ }
224
+ case "graph.node.additional-inputs.set": {
225
+ let n = S(r, e.target), i = n.nodes[e.nodeId];
226
+ i?.kind != "task" && x("The Task Node does not exist."), t(i.additionalInputs, e.before) || x("The Task Node inputs changed before this operation was applied.");
227
+ let { additionalInputs: a, ...o } = i, s = e.value == null ? o : {
228
+ ...o,
229
+ additionalInputs: e.value
230
+ };
231
+ Object.assign(r, C(r, e.target, { nodes: {
232
+ ...n.nodes,
233
+ [e.nodeId]: s
234
+ } }));
235
+ break;
236
+ }
237
+ case "graph.node.condition.set": {
238
+ let n = S(r, e.target), i = n.nodes[e.nodeId];
239
+ i?.kind != "condition" && x("The Condition Node does not exist."), (!t(i.cases, e.before.cases) || i.defaultOutput != e.before.defaultOutput || !t(i.input, e.before.input)) && x("The Condition Node changed before this operation was applied.");
240
+ let { defaultOutput: a, ...o } = i, s = e.value.defaultOutput == null ? {
241
+ ...o,
242
+ ...e.value
243
+ } : {
244
+ ...i,
245
+ ...e.value
246
+ };
247
+ Object.assign(r, C(r, e.target, { nodes: {
248
+ ...n.nodes,
249
+ [e.nodeId]: s
250
+ } }));
251
+ break;
252
+ }
253
+ case "graph.node.create": {
254
+ let t = S(r, e.target);
255
+ t.nodes[e.nodeId] != null && x("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && x("Trigger Nodes cannot be created inside a Subflow."), Object.assign(r, C(r, e.target, { nodes: {
256
+ ...t.nodes,
257
+ [e.nodeId]: e.node
258
+ } }));
259
+ break;
260
+ }
261
+ case "graph.node.delete": {
262
+ let t = S(r, e.target);
263
+ t.nodes[e.nodeId] ?? x("The Node does not exist in the target graph.");
264
+ let n = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => n.has(e) ? [] : [[e, w(t, n)]]));
265
+ if (Object.assign(r, C(r, e.target, { nodes: i })), e.target.kind == "subflow") {
266
+ let t = r.subflows[e.target.id], i = t.outputs.map((e) => ({
267
+ ...e,
268
+ sources: e.sources.filter((e) => e.kind != "node" || !n.has(e.nodeId))
269
+ }));
270
+ r.subflows = {
271
+ ...r.subflows,
272
+ [e.target.id]: {
273
+ ...t,
274
+ outputs: i
275
+ }
276
+ };
277
+ }
278
+ break;
279
+ }
280
+ case "graph.node.field.set": {
281
+ let n = S(r, e.target), i = n.nodes[e.nodeId];
282
+ i ?? x("The Node does not exist in the target graph."), t(Reflect.get(i, e.field), e.before) || x("The Node field changed before this operation was applied."), e.field == "concurrency" && e.value == null && x("Node concurrency cannot be removed.");
283
+ let a = { ...i };
284
+ e.value == null ? Reflect.deleteProperty(a, e.field) : Object.assign(a, { [e.field]: e.value }), Object.assign(r, C(r, e.target, { nodes: {
285
+ ...n.nodes,
286
+ [e.nodeId]: a
287
+ } }));
288
+ break;
289
+ }
290
+ case "graph.node.input.set": {
291
+ let n = S(r, e.target), i = n.nodes[e.nodeId];
292
+ (i == null || !("inputs" in i)) && x("The Node does not accept inputs."), t(i.inputs[e.handle], e.before) || x("The Node input changed before this operation was applied.");
293
+ let a = { ...i.inputs };
294
+ e.value == null ? delete a[e.handle] : a[e.handle] = e.value, Object.assign(r, C(r, e.target, { nodes: {
295
+ ...n.nodes,
296
+ [e.nodeId]: {
297
+ ...i,
298
+ inputs: a
299
+ }
300
+ } }));
301
+ break;
302
+ }
303
+ case "graph.node.task.name.set": {
304
+ let t = S(r, e.target), n = t.nodes[e.nodeId];
305
+ (n?.kind != "task" || n.task == null) && x("The inline Task Node does not exist."), n.task.name != e.before && x("The inline Task name changed before this operation was applied.");
306
+ let i = {
307
+ ...n,
308
+ task: {
309
+ ...n.task,
310
+ name: e.value
311
+ }
312
+ };
313
+ Object.assign(r, C(r, e.target, { nodes: {
314
+ ...t.nodes,
315
+ [e.nodeId]: i
316
+ } }));
317
+ break;
318
+ }
319
+ case "graph.node.task.ports.set": {
320
+ let n = S(r, e.target), i = n.nodes[e.nodeId];
321
+ (i?.kind != "task" || i.task == null) && x("The inline Task Node does not exist."), t({
322
+ inputs: i.task.inputs,
323
+ outputs: i.task.outputs
324
+ }, e.before) || x("The inline Task ports changed before this operation was applied.");
325
+ let a = {
326
+ ...i,
327
+ task: {
328
+ ...i.task,
329
+ ...e.value
330
+ }
331
+ };
332
+ Object.assign(r, C(r, e.target, { nodes: {
333
+ ...n.nodes,
334
+ [e.nodeId]: a
335
+ } }));
336
+ break;
337
+ }
338
+ case "graph.node.values.set": {
339
+ let n = S(r, e.target), i = n.nodes[e.nodeId];
340
+ i?.kind != "value" && x("The Value Node does not exist."), t(i.values, e.before) || x("The Value Node changed before this operation was applied."), Object.assign(r, C(r, e.target, { nodes: {
341
+ ...n.nodes,
342
+ [e.nodeId]: {
343
+ ...i,
344
+ values: e.value
345
+ }
346
+ } }));
347
+ break;
348
+ }
349
+ case "graph.node.wait.set": {
350
+ let n = r.graph, i = n.nodes[e.nodeId];
351
+ (i?.kind != "wait" || !t({
352
+ actions: i.actions,
353
+ ...i.notification == null ? {} : { notification: i.notification },
354
+ prompt: i.prompt
355
+ }, e.before)) && x("The Wait Node changed before this operation was applied.");
356
+ let { notification: a, ...o } = i, s = e.value.notification == null ? {
357
+ ...o,
358
+ ...e.value
359
+ } : {
360
+ ...i,
361
+ ...e.value
362
+ };
363
+ r.graph = { nodes: {
364
+ ...n.nodes,
365
+ [e.nodeId]: s
366
+ } };
367
+ break;
368
+ }
369
+ case "graph.node.webhook.set": {
370
+ let n = S(r, e.target), i = n.nodes[e.nodeId];
371
+ i?.kind != "webhook" && x("The Webhook Node does not exist."), (!t(i.inputsDef, e.before.inputsDef) || !t(i.options, e.before.options)) && x("The Webhook Node changed before this operation was applied.");
372
+ let { options: a, ...o } = i, s = e.value.options == null ? {
373
+ ...o,
374
+ inputsDef: e.value.inputsDef
375
+ } : {
376
+ ...i,
377
+ ...e.value
378
+ };
379
+ Object.assign(r, C(r, e.target, { nodes: {
380
+ ...n.nodes,
381
+ [e.nodeId]: s
382
+ } }));
383
+ break;
384
+ }
385
+ case "graph.trigger.config.set": {
386
+ let n = r.graph, i = n.nodes[e.nodeId];
387
+ (i == null || i.kind != "integration" && i.kind != "poll") && x("The configurable Trigger Node does not exist."), t(i.config[e.name], e.before) || x("The Trigger configuration changed before this operation was applied.");
388
+ let a = { ...i.config };
389
+ e.value === void 0 ? delete a[e.name] : a[e.name] = e.value, r.graph = { nodes: {
390
+ ...n.nodes,
391
+ [e.nodeId]: {
392
+ ...i,
393
+ config: a
394
+ }
395
+ } };
396
+ break;
397
+ }
398
+ case "graph.trigger.schedule.set": {
399
+ let n = r.graph, i = n.nodes[e.nodeId];
400
+ (i == null || i.kind != "cron" && i.kind != "poll") && x("The scheduled Trigger Node does not exist.");
401
+ let a = i.kind == "cron" ? i.cronTimes : i.pollTimes;
402
+ t(a, e.before) || x("The Trigger schedule changed before this operation was applied.");
403
+ let o = i.kind == "cron" ? {
404
+ ...i,
405
+ cronTimes: e.value
406
+ } : {
407
+ ...i,
408
+ pollTimes: e.value
409
+ };
410
+ r.graph = { nodes: {
411
+ ...n.nodes,
412
+ [e.nodeId]: o
413
+ } };
414
+ break;
415
+ }
416
+ case "module.create":
417
+ i[e.moduleId] != null && x("A CodeModule with this ID already exists."), i[e.moduleId] = e.module;
418
+ break;
419
+ case "module.delete":
420
+ i[e.moduleId] ?? x("The CodeModule does not exist."), delete i[e.moduleId];
421
+ break;
422
+ case "module.rename": {
423
+ let t = i[e.moduleId];
424
+ t ?? x("The CodeModule does not exist."), t.name != e.before && x("The CodeModule name changed before this operation was applied."), i[e.moduleId] = {
425
+ ...t,
426
+ name: e.name
427
+ };
428
+ break;
429
+ }
430
+ case "module.source.replace": {
431
+ let n = i[e.moduleId];
432
+ n ?? x("The CodeModule does not exist."), (n.source != e.beforeSource || !t(n.imports, e.beforeImports)) && x("The CodeModule source changed before this operation was applied."), i[e.moduleId] = {
433
+ ...n,
434
+ imports: e.imports,
435
+ source: e.source
436
+ };
437
+ break;
438
+ }
439
+ case "subflow.create":
440
+ r.subflows[e.subflowId] != null && x("A Subflow with this ID already exists."), r.subflows = {
441
+ ...r.subflows,
442
+ [e.subflowId]: e.subflow
443
+ };
444
+ break;
445
+ case "subflow.definition.set": {
446
+ let n = r.subflows[e.subflowId];
447
+ n ?? x("The Subflow does not exist."), t({
448
+ inputs: n.inputs,
449
+ name: n.name,
450
+ outputs: n.outputs
451
+ }, e.before) || x("The Subflow definition changed before this operation was applied."), r.subflows = {
452
+ ...r.subflows,
453
+ [e.subflowId]: {
454
+ ...e.definition,
455
+ graph: n.graph
456
+ }
457
+ };
458
+ break;
459
+ }
460
+ case "subflow.delete": {
461
+ r.subflows[e.subflowId] ?? x("The Subflow does not exist.");
462
+ let t = { ...r.subflows };
463
+ delete t[e.subflowId], r.subflows = t;
464
+ break;
465
+ }
466
+ case "task.create":
467
+ r.tasks[e.taskId] != null && x("A Task with this ID already exists."), r.tasks = {
468
+ ...r.tasks,
469
+ [e.taskId]: e.task
470
+ };
471
+ break;
472
+ case "task.connector.connection.set": {
473
+ let t = r.tasks[e.taskId];
474
+ (t == null || !("executor" in t) || t.executor.kind != "connector") && x("The Connector Task does not exist."), t.executor.connectionId != e.before && x("The Connector Task connection changed before this operation was applied.");
475
+ let { connectionId: n, ...i } = t.executor, a = e.value == null ? i : {
476
+ ...i,
477
+ connectionId: e.value
478
+ };
479
+ r.tasks = {
480
+ ...r.tasks,
481
+ [e.taskId]: {
482
+ ...t,
483
+ executor: a
484
+ }
485
+ };
486
+ break;
487
+ }
488
+ case "task.delete": {
489
+ r.tasks[e.taskId] ?? x("The Task does not exist.");
490
+ let t = { ...r.tasks };
491
+ delete t[e.taskId], r.tasks = t;
492
+ break;
493
+ }
494
+ case "task.llm.mode.set": {
495
+ let t = r.tasks[e.taskId];
496
+ (t == null || !("executor" in t) || t.executor.kind != "llm") && x("The LLM Task does not exist."), t.executor.mode != e.before && x("The LLM Task mode changed before this operation was applied."), r.tasks = {
497
+ ...r.tasks,
498
+ [e.taskId]: {
499
+ ...t,
500
+ executor: {
501
+ ...t.executor,
502
+ mode: e.value
503
+ }
504
+ }
505
+ };
506
+ break;
507
+ }
508
+ case "task.name.set": {
509
+ let t = r.tasks[e.taskId];
510
+ t ?? x("The Task does not exist."), t.name != e.before && x("The Task name changed before this operation was applied."), r.tasks = {
511
+ ...r.tasks,
512
+ [e.taskId]: {
513
+ ...t,
514
+ name: e.value
515
+ }
516
+ };
517
+ break;
518
+ }
519
+ }
520
+ return {
521
+ document: r,
522
+ modelVersion: e.modelVersion,
523
+ modules: i
524
+ };
525
+ }
526
+ //#endregion
527
+ //#region src/workbench/browser/runtime/icons.tsx
528
+ function E(e) {
529
+ switch (e) {
530
+ case "alert": return /* @__PURE__ */ s(a, { children: [
531
+ /* @__PURE__ */ o("circle", {
532
+ cx: "12",
533
+ cy: "12",
534
+ r: "9"
535
+ }),
536
+ /* @__PURE__ */ o("path", { d: "M12 7v6" }),
537
+ /* @__PURE__ */ o("path", { d: "M12 17h.01" })
538
+ ] });
539
+ case "check": return /* @__PURE__ */ o("path", { d: "m5 12 4 4L19 6" });
540
+ case "chevron-down": return /* @__PURE__ */ o("path", { d: "m7 10 5 5 5-5" });
541
+ case "chevron-left": return /* @__PURE__ */ o("path", { d: "m15 18-6-6 6-6" });
542
+ case "chevron-up": return /* @__PURE__ */ o("path", { d: "m7 14 5-5 5 5" });
543
+ case "close": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "m6 6 12 12" }), /* @__PURE__ */ o("path", { d: "M18 6 6 18" })] });
544
+ case "condition": return /* @__PURE__ */ o(a, { children: /* @__PURE__ */ o("path", { d: "M5 5h14l-5.5 6v6l-3 2v-8z" }) });
545
+ case "connection": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M10 13a5 5 0 0 0 7.1.1l2-2a5 5 0 0 0-7.1-7.1l-1.1 1.1" }), /* @__PURE__ */ o("path", { d: "M14 11a5 5 0 0 0-7.1-.1l-2 2A5 5 0 0 0 12 20l1.1-1.1" })] });
546
+ case "download": return /* @__PURE__ */ s(a, { children: [
547
+ /* @__PURE__ */ o("path", { d: "M12 4v11" }),
548
+ /* @__PURE__ */ o("path", { d: "m7 10 5 5 5-5" }),
549
+ /* @__PURE__ */ o("path", { d: "M5 20h14" })
550
+ ] });
551
+ case "fit": return /* @__PURE__ */ s(a, { children: [
552
+ /* @__PURE__ */ o("path", { d: "M8 3H3v5" }),
553
+ /* @__PURE__ */ o("path", { d: "M16 3h5v5" }),
554
+ /* @__PURE__ */ o("path", { d: "M8 21H3v-5" }),
555
+ /* @__PURE__ */ o("path", { d: "M16 21h5v-5" })
556
+ ] });
557
+ case "filter": return /* @__PURE__ */ o("path", { d: "M4 6h16l-6 7v5l-4 2v-7z" });
558
+ case "flow": return /* @__PURE__ */ s(a, { children: [
559
+ /* @__PURE__ */ o("circle", {
560
+ cx: "12",
561
+ cy: "5",
562
+ r: "2"
563
+ }),
564
+ /* @__PURE__ */ o("circle", {
565
+ cx: "6",
566
+ cy: "18",
567
+ r: "2"
568
+ }),
569
+ /* @__PURE__ */ o("circle", {
570
+ cx: "18",
571
+ cy: "18",
572
+ r: "2"
573
+ }),
574
+ /* @__PURE__ */ o("path", { d: "M12 7v4M6 16v-3h12v3" })
575
+ ] });
576
+ case "hand": return /* @__PURE__ */ o("path", { d: "M8 11V6a1.5 1.5 0 0 1 3 0v4-6a1.5 1.5 0 0 1 3 0v6-4a1.5 1.5 0 0 1 3 0v5-2a1.5 1.5 0 0 1 3 0v4a8 8 0 0 1-16 0v-2a2 2 0 0 1 4 0Z" });
577
+ case "logo": return /* @__PURE__ */ s(a, { children: [
578
+ /* @__PURE__ */ o("circle", {
579
+ cx: "7",
580
+ cy: "5",
581
+ r: "2.5"
582
+ }),
583
+ /* @__PURE__ */ o("circle", {
584
+ cx: "7",
585
+ cy: "19",
586
+ r: "2.5"
587
+ }),
588
+ /* @__PURE__ */ o("circle", {
589
+ cx: "18",
590
+ cy: "12",
591
+ r: "2.5"
592
+ }),
593
+ /* @__PURE__ */ o("path", { d: "M9.2 6.2 15.7 10M9.2 17.8l6.5-3.8M7 7.5v9" })
594
+ ] });
595
+ case "llm": return /* @__PURE__ */ s(a, { children: [
596
+ /* @__PURE__ */ o("path", { d: "M7 7h10v10H7z" }),
597
+ /* @__PURE__ */ o("path", { d: "M9 2v3m6-3v3M9 19v3m6-3v3M2 9h3m-3 6h3m14-6h3m-3 6h3" }),
598
+ /* @__PURE__ */ o("circle", {
599
+ cx: "10",
600
+ cy: "11",
601
+ r: ".7",
602
+ fill: "currentColor",
603
+ stroke: "none"
604
+ }),
605
+ /* @__PURE__ */ o("circle", {
606
+ cx: "14",
607
+ cy: "11",
608
+ r: ".7",
609
+ fill: "currentColor",
610
+ stroke: "none"
611
+ }),
612
+ /* @__PURE__ */ o("path", { d: "M10 14h4" })
613
+ ] });
614
+ case "more": return /* @__PURE__ */ s(a, { children: [
615
+ /* @__PURE__ */ o("circle", {
616
+ cx: "5",
617
+ cy: "12",
618
+ r: "1",
619
+ fill: "currentColor",
620
+ stroke: "none"
621
+ }),
622
+ /* @__PURE__ */ o("circle", {
623
+ cx: "12",
624
+ cy: "12",
625
+ r: "1",
626
+ fill: "currentColor",
627
+ stroke: "none"
628
+ }),
629
+ /* @__PURE__ */ o("circle", {
630
+ cx: "19",
631
+ cy: "12",
632
+ r: "1",
633
+ fill: "currentColor",
634
+ stroke: "none"
635
+ })
636
+ ] });
637
+ case "panel": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("rect", {
638
+ x: "3",
639
+ y: "4",
640
+ width: "18",
641
+ height: "16",
642
+ rx: "2"
643
+ }), /* @__PURE__ */ o("path", { d: "M15 4v16" })] });
644
+ case "play":
645
+ case "run": return /* @__PURE__ */ o("path", { d: "m8 5 11 7-11 7z" });
646
+ case "pointer": return /* @__PURE__ */ o("path", { d: "m5 3 13 9-6 1-3 6z" });
647
+ case "plus": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M12 5v14" }), /* @__PURE__ */ o("path", { d: "M5 12h14" })] });
648
+ case "project": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("path", { d: "M3 7h6l2 2h10v10H3z" }), /* @__PURE__ */ o("path", { d: "M3 7V5h7l2 2" })] });
649
+ case "publish": return /* @__PURE__ */ s(a, { children: [
650
+ /* @__PURE__ */ o("path", { d: "M12 16V4" }),
651
+ /* @__PURE__ */ o("path", { d: "m7 9 5-5 5 5" }),
652
+ /* @__PURE__ */ o("path", { d: "M5 14v5h14v-5" })
653
+ ] });
654
+ case "refresh": return /* @__PURE__ */ s(a, { children: [
655
+ /* @__PURE__ */ o("path", { d: "M20 11a8 8 0 0 0-14.7-4.4L3 9" }),
656
+ /* @__PURE__ */ o("path", { d: "M3 4v5h5" }),
657
+ /* @__PURE__ */ o("path", { d: "M4 13a8 8 0 0 0 14.7 4.4L21 15" }),
658
+ /* @__PURE__ */ o("path", { d: "M21 20v-5h-5" })
659
+ ] });
660
+ case "search": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("circle", {
661
+ cx: "11",
662
+ cy: "11",
663
+ r: "7"
664
+ }), /* @__PURE__ */ o("path", { d: "m16 16 4 4" })] });
665
+ case "settings": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("circle", {
666
+ cx: "12",
667
+ cy: "12",
668
+ r: "3"
669
+ }), /* @__PURE__ */ o("path", {
670
+ d: "M19 13.5v-3l-2-.6-.7-1.7 1-1.8-2.1-2.1-1.8 1-1.7-.7L10.5 3h-3l-.6 2-1.7.7-1.8-1-2.1 2.1 1 1.8-.7 1.7-2 .6v3l2 .6.7 1.7-1 1.8 2.1 2.1 1.8-1 1.7.7.6 2h3l.6-2 1.7-.7 1.8 1 2.1-2.1-1-1.8.7-1.7z",
671
+ transform: "translate(2.5) scale(.8)"
672
+ })] });
673
+ case "subflow": return /* @__PURE__ */ s(a, { children: [
674
+ /* @__PURE__ */ o("rect", {
675
+ x: "4",
676
+ y: "4",
677
+ width: "6",
678
+ height: "6",
679
+ rx: "1"
680
+ }),
681
+ /* @__PURE__ */ o("rect", {
682
+ x: "14",
683
+ y: "14",
684
+ width: "6",
685
+ height: "6",
686
+ rx: "1"
687
+ }),
688
+ /* @__PURE__ */ o("path", { d: "M10 7h4a3 3 0 0 1 3 3v4M14 17h-4a3 3 0 0 1-3-3v-4" })
689
+ ] });
690
+ case "value": return /* @__PURE__ */ o("path", { d: "m12 3 8 9-8 9-8-9z" });
691
+ case "wait": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("circle", {
692
+ cx: "12",
693
+ cy: "12",
694
+ r: "9"
695
+ }), /* @__PURE__ */ o("path", { d: "M12 7v5l3 2" })] });
696
+ case "task": return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("rect", {
697
+ x: "4",
698
+ y: "4",
699
+ width: "16",
700
+ height: "16",
701
+ rx: "3"
702
+ }), /* @__PURE__ */ o("path", { d: "m9 12 2 2 4-5" })] });
703
+ case "trigger": return /* @__PURE__ */ o(a, { children: /* @__PURE__ */ o("path", { d: "M13 2 5 14h6l-1 8 8-12h-6z" }) });
704
+ case "trash": return /* @__PURE__ */ s(a, { children: [
705
+ /* @__PURE__ */ o("path", { d: "M4 7h16" }),
706
+ /* @__PURE__ */ o("path", { d: "M9 7V4h6v3" }),
707
+ /* @__PURE__ */ o("path", { d: "m6 7 1 13h10l1-13" }),
708
+ /* @__PURE__ */ o("path", { d: "M10 11v5M14 11v5" })
709
+ ] });
710
+ }
711
+ }
712
+ function D({ name: e, size: t = 18, ...n }) {
713
+ return /* @__PURE__ */ o("svg", {
714
+ "aria-hidden": "true",
715
+ fill: "none",
716
+ height: t,
717
+ viewBox: "0 0 24 24",
718
+ width: t,
719
+ ...n,
720
+ children: /* @__PURE__ */ o("g", {
721
+ stroke: "currentColor",
722
+ strokeLinecap: "round",
723
+ strokeLinejoin: "round",
724
+ strokeWidth: "1.7",
725
+ children: E(e)
726
+ })
727
+ });
728
+ }
729
+ //#endregion
730
+ export { v as a, d as c, l as d, f, y as i, p as l, b as n, _ as o, c as p, T as r, h as s, D as t, m as u };