@oomol-lab/open-flow 0.1.0-alpha.9 → 0.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +5 -1
  2. package/dist/browser/createResourceDialog-BkZns-oZ.js +504 -0
  3. package/dist/browser/diagnostics-giPSzyMo.js +9346 -0
  4. package/dist/browser/{dist-DhsGR_K3.js → dist-3Mj8q8Pr.js} +27 -27
  5. package/dist/browser/{dist-n9WmBm5w.js → dist-BKuSVKCC.js} +1 -1
  6. package/dist/browser/{dist-DQVavPcf.js → dist-BMqL-qR5.js} +469 -903
  7. package/dist/browser/{dist-D5mdziGP.js → dist-BN4ZCyOB.js} +9 -9
  8. package/dist/browser/{dist-CVtP-E2c.js → dist-BpopSHwP.js} +1 -1
  9. package/dist/browser/{dist-B0Q2Mn0n.js → dist-CJpzJrLM.js} +191 -191
  10. package/dist/browser/{dist-DXgEYMFx.js → dist-CPuF50D9.js} +196 -196
  11. package/dist/browser/{dist-CUkceEvN.js → dist-CUSrALSX.js} +113 -113
  12. package/dist/browser/dist-CeSZ2xSM.js +444 -0
  13. package/dist/browser/{dist-Bc9TvHYl.js → dist-DUzA0Ukh.js} +20 -20
  14. package/dist/browser/{dist-DWzdGVm9.js → dist-DWADUsVB.js} +74 -74
  15. package/dist/browser/{esm-YIGXG-Js.js → esm-B_PbUobB.js} +13 -13
  16. package/dist/browser/flow-authoring-node.d.ts +4 -2
  17. package/dist/browser/flow-authoring.d.ts +2 -1
  18. package/dist/browser/flow-authoring.js +400 -100
  19. package/dist/browser/flow-change.d.ts +9 -4
  20. package/dist/browser/flow-change.js +49 -46
  21. package/dist/browser/{flowRunInputEditorStore-DXOyyY7o.js → flowRunInputEditorStore-BeyUSWpO.js} +1644 -908
  22. package/dist/browser/{flowWorkspace-D7-rBA1-.js → flowWorkspace-DAMLVMcF.js} +18416 -16444
  23. package/dist/browser/getPseudoElementBounds-ESJExRFX.js +7642 -0
  24. package/dist/browser/languages-DgJehE1g.js +62 -0
  25. package/dist/browser/lib-C5Ipyfps.js +7856 -0
  26. package/dist/browser/licenses.md +119 -1
  27. package/dist/browser/main-DmjVyuWr.js +76 -0
  28. package/dist/browser/{markdownContent-ColGUxHy.js → markdownContent-DdlIRN3_.js} +4811 -4795
  29. package/dist/browser/theme.css +63 -0
  30. package/dist/browser/theme.css.d.ts +1 -0
  31. package/dist/browser/typeScriptSession-mPCiA9sV.js +2579 -0
  32. package/dist/browser/workbench-contract.d.ts +2 -1
  33. package/dist/browser/workbench.css +1 -1
  34. package/dist/browser/workbench.d.ts +46 -1
  35. package/dist/browser/workbench.js +1132 -1474
  36. package/dist/browser/workbenchSelect-B2s1HV-Y.js +1374 -0
  37. package/dist/common/connector-action.d.ts +6 -0
  38. package/dist/common/connector-action.js +37 -29
  39. package/dist/common/control-api-conformance.js +80 -29
  40. package/dist/common/control-api-errors.d.ts +24 -0
  41. package/dist/common/control-api.d.ts +54 -7
  42. package/dist/common/control-api.js +226 -95
  43. package/dist/common/flow-encoding.d.ts +2 -2
  44. package/dist/common/flow-encoding.js +4 -1
  45. package/dist/common/flow-semantics.d.ts +3 -0
  46. package/dist/common/flow-semantics.js +939 -851
  47. package/dist/common/integration-trigger.d.ts +1 -0
  48. package/dist/common/licenses.md +1 -25
  49. package/dist/common/localization.d.ts +21 -0
  50. package/dist/common/localization.js +62 -0
  51. package/dist/common/provider-triggers.js +4 -1
  52. package/dist/common/scheduler.d.ts +5 -5
  53. package/dist/common/scheduler.js +250 -236
  54. package/package.json +10 -1
  55. package/dist/browser/addNodeOptions-DRndy4EK.js +0 -6910
  56. package/dist/browser/createLucideIcon-CqjqCezK.js +0 -5537
  57. package/dist/browser/createResourceDialog-A64dDFCG.js +0 -467
  58. package/dist/browser/field-CKGQHCIi.js +0 -312
@@ -1,10 +1,13 @@
1
1
  import { a as e, f as t, i as n } from "./dist-C46JByB-.js";
2
- import { Ar as r, Dr as i, Ir as a, Or as o } from "./createLucideIcon-CqjqCezK.js";
3
- import { $ as s, Q as c, Y as l, _ as u, a as d, c as f, d as p, f as m, g as h, i as g, l as _, m as v, n as ee, o as y, t as b, u as te, v as x, y as ne } from "./addNodeOptions-DRndy4EK.js";
4
- import { Suspense as re, lazy as ie, useEffect as S, useRef as ae, useState as oe } from "react";
5
- import { jsx as C, jsxs as se } from "react/jsx-runtime";
2
+ import { a as r, i, s as a, t as o } from "./main-DmjVyuWr.js";
3
+ import { At as s, It as c, Jn as l, Kn as u, Mt as d, Ot as f, Qn as p, Xn as m, Yn as h, Zn as g, er as _, jt as v } from "./getPseudoElementBounds-ESJExRFX.js";
4
+ import { A as y, At as b, B as x, C as S, Ct as C, D as w, Dt as ee, E as T, Et as te, Ft as E, G as ne, H as D, I as O, K as re, Lt as k, M as A, Mt as ie, N as j, Nt as ae, O as M, Ot as oe, P as se, Pt as ce, R as N, Rt as P, S as le, Tt as ue, U as de, V as fe, W as pe, _ as me, a as F, b as he, c as ge, d as I, f as _e, g as ve, h as ye, i as be, j as L, jt as R, kt as xe, l as Se, m as Ce, n as we, p as Te, q as Ee, s as De, t as Oe, u as ke, v as Ae, w as je, wt as z, x as Me, y as Ne, z as B } from "./diagnostics-giPSzyMo.js";
5
+ import { t as Pe } from "./workbenchSelect-B2s1HV-Y.js";
6
+ import { a as V, i as Fe, n as Ie, r as Le } from "./languages-DgJehE1g.js";
7
+ import { Suspense as Re, lazy as ze, useEffect as H, useRef as Be, useState as U } from "react";
8
+ import { Fragment as Ve, jsx as W, jsxs as G } from "react/jsx-runtime";
6
9
  //#region src/workbench/browser/runtime/navigation.ts
7
- var ce = class {
10
+ var He = class {
8
11
  #e;
9
12
  #t;
10
13
  #n;
@@ -31,14 +34,14 @@ var ce = class {
31
34
  open(e) {
32
35
  this.#i += 1, this.#s = !1, this.#u(e, !1);
33
36
  }
34
- async createFlow(e) {
35
- let t = ++this.#i;
37
+ async createFlow(e, t) {
38
+ let n = ++this.#i;
36
39
  this.#s = !0;
37
40
  try {
38
- let n = await this.#n.createFlow(e);
39
- return n && t == this.#i && this.#u("design", !1), n;
41
+ let r = await this.#n.createFlow(e, t);
42
+ return r && n == this.#i && this.#u("design", !1), r;
40
43
  } finally {
41
- t == this.#i && (this.#s = !1);
44
+ n == this.#i && (this.#s = !1);
42
45
  }
43
46
  }
44
47
  async createSubflow(e) {
@@ -63,7 +66,7 @@ var ce = class {
63
66
  this.#s = !0, await this.#n.selectFlow(void 0), e == this.#i && (this.#u("design", !1), this.#s = !1);
64
67
  }
65
68
  async apply(e) {
66
- if (w(e, this.#t)) return;
69
+ if (Ue(e, this.#t)) return;
67
70
  this.#t = e;
68
71
  let t = ++this.#i;
69
72
  this.#s = !0;
@@ -79,15 +82,450 @@ var ce = class {
79
82
  flowId: this.#n.workspace.$.flowId.value,
80
83
  view: e
81
84
  };
82
- w(n, this.#t) || (this.#t = n, this.#e(n, { replace: t })), this.#r.set(e);
85
+ Ue(n, this.#t) || (this.#t = n, this.#e(n, { replace: t })), this.#r.set(e);
83
86
  }
84
87
  };
85
- function w(e, t) {
88
+ function Ue(e, t) {
86
89
  return e.flowId == t.flowId && e.view == t.view;
87
90
  }
88
91
  //#endregion
89
- //#region src/workbench/browser/runtime/publications/publicationStore.ts
90
- var T = {
92
+ //#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
93
+ var We = ze(() => import("./createResourceDialog-BkZns-oZ.js")), Ge = V.map((e) => ({
94
+ label: Fe[e],
95
+ value: e
96
+ }));
97
+ function Ke({ language: e, onLanguageChange: t }) {
98
+ let n = r(), [i, a] = U(null);
99
+ return t == null ? null : /* @__PURE__ */ G("div", {
100
+ className: "resource-language",
101
+ ref: a,
102
+ children: [/* @__PURE__ */ W("span", {
103
+ className: "sr-only",
104
+ children: n("language.label")
105
+ }), /* @__PURE__ */ W(Pe, {
106
+ ariaLabel: n("language.label"),
107
+ onValueChange: (e) => t(e),
108
+ options: Ge,
109
+ portalRoot: i,
110
+ value: e
111
+ })]
112
+ });
113
+ }
114
+ function qe({ badge: e, busy: t, flow: n, href: a, onSelect: o, store: s }) {
115
+ let l = i(), u = r(), [d, m] = U("idle"), [h, y] = U(n.name), b = v(h);
116
+ async function x(e) {
117
+ e.preventDefault();
118
+ let t = h.trim();
119
+ v(t) == null && await s.workspace.renameFlow(n.flowId, t) && m("idle");
120
+ }
121
+ async function S() {
122
+ await s.workspace.deleteFlow(n.flowId) && m("idle");
123
+ }
124
+ return /* @__PURE__ */ G("div", {
125
+ className: "resource-item-row",
126
+ children: [
127
+ /* @__PURE__ */ G(p, {
128
+ "aria-disabled": n.status == "retiring",
129
+ className: "resource-list-row flow-columns",
130
+ nativeButton: !1,
131
+ onClick: (e) => {
132
+ if (n.status == "retiring") {
133
+ e.preventDefault();
134
+ return;
135
+ }
136
+ C(e, () => o(n));
137
+ },
138
+ render: /* @__PURE__ */ W("a", { href: n.status == "retiring" ? void 0 : a }),
139
+ tabIndex: n.status == "retiring" ? -1 : void 0,
140
+ variant: "ghost",
141
+ children: [
142
+ /* @__PURE__ */ G("span", {
143
+ className: "resource-primary-cell",
144
+ children: [/* @__PURE__ */ W("span", {
145
+ className: "resource-icon",
146
+ children: /* @__PURE__ */ W(f, { name: "flow" })
147
+ }), /* @__PURE__ */ G("span", { children: [/* @__PURE__ */ G("span", {
148
+ className: "flex min-w-0 items-center gap-2",
149
+ children: [/* @__PURE__ */ W("strong", {
150
+ className: "min-w-0 truncate",
151
+ children: n.name
152
+ }), e != null && /* @__PURE__ */ W(ce, {
153
+ className: "min-w-0 shrink",
154
+ title: e,
155
+ variant: "secondary",
156
+ children: /* @__PURE__ */ W("span", {
157
+ className: "truncate",
158
+ children: e
159
+ })
160
+ })]
161
+ }), /* @__PURE__ */ W("code", {
162
+ translate: "no",
163
+ children: n.flowId
164
+ })] })]
165
+ }),
166
+ /* @__PURE__ */ W("time", {
167
+ dateTime: n.updatedAt,
168
+ children: new Date(n.updatedAt).toLocaleString(l)
169
+ }),
170
+ /* @__PURE__ */ G("span", {
171
+ className: `resource-status ${n.status == "active" ? "active" : "warning"}`,
172
+ children: [/* @__PURE__ */ W("span", {
173
+ "aria-hidden": "true",
174
+ className: `status-dot ${n.status == "active" ? "success" : "running"}`
175
+ }), u(n.status == "active" ? "resource.active" : "resource.retiring")]
176
+ })
177
+ ]
178
+ }),
179
+ n.status == "active" && /* @__PURE__ */ W(p, {
180
+ "aria-expanded": d != "idle",
181
+ "aria-label": u("sidebar.flowActions", { name: n.name }),
182
+ className: _("resource-row-more", d != "idle" && "active"),
183
+ disabled: t != null,
184
+ onClick: () => m(d == "idle" ? "actions" : "idle"),
185
+ size: "icon-sm",
186
+ variant: "ghost",
187
+ children: /* @__PURE__ */ W(f, { name: "more" })
188
+ }),
189
+ d == "actions" && /* @__PURE__ */ G("div", {
190
+ className: "resource-row-actions",
191
+ children: [/* @__PURE__ */ W(p, {
192
+ onClick: () => {
193
+ y(n.name), m("rename");
194
+ },
195
+ size: "sm",
196
+ variant: "outline",
197
+ children: u("common.rename")
198
+ }), /* @__PURE__ */ W(p, {
199
+ onClick: () => m("delete"),
200
+ size: "sm",
201
+ variant: "destructive",
202
+ children: u("common.delete")
203
+ })]
204
+ }),
205
+ d == "rename" && /* @__PURE__ */ G("form", {
206
+ className: "resource-row-form",
207
+ onSubmit: (e) => void x(e),
208
+ children: [
209
+ /* @__PURE__ */ W(g, {
210
+ htmlFor: `rename-flow-${n.flowId}`,
211
+ children: u("sidebar.renameFlow", { name: n.name })
212
+ }),
213
+ /* @__PURE__ */ G("span", {
214
+ className: "resource-row-field",
215
+ children: [/* @__PURE__ */ W(c, {
216
+ autoComplete: "off",
217
+ "aria-invalid": h.length > 0 && b != null,
218
+ autoFocus: !0,
219
+ id: `rename-flow-${n.flowId}`,
220
+ name: "flow-name",
221
+ onChange: (e) => y(e.target.value),
222
+ required: !0,
223
+ value: h
224
+ }), h.length > 0 && b != null && /* @__PURE__ */ W("small", {
225
+ className: "resource-name-message error",
226
+ children: u(`resource.nameIssue.${b}`, { max: 80 })
227
+ })]
228
+ }),
229
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(p, {
230
+ onClick: () => m("idle"),
231
+ size: "sm",
232
+ variant: "outline",
233
+ children: u("common.cancel")
234
+ }), /* @__PURE__ */ W(p, {
235
+ disabled: t != null || b != null,
236
+ size: "sm",
237
+ type: "submit",
238
+ children: u("common.save")
239
+ })] })
240
+ ]
241
+ }),
242
+ d == "delete" && /* @__PURE__ */ G("div", {
243
+ className: "resource-row-confirm",
244
+ role: "group",
245
+ "aria-label": u("sidebar.deleteFlow", { name: n.name }),
246
+ children: [/* @__PURE__ */ W("span", { children: /* @__PURE__ */ W("strong", { children: u("sidebar.deleteFlowConfirm", { name: n.name }) }) }), /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(p, {
247
+ onClick: () => m("idle"),
248
+ size: "sm",
249
+ variant: "outline",
250
+ children: u("common.cancel")
251
+ }), /* @__PURE__ */ W(p, {
252
+ disabled: t != null,
253
+ onClick: () => void S(),
254
+ size: "sm",
255
+ variant: "destructive",
256
+ children: u(t == "flow" ? "common.deleting" : "common.delete")
257
+ })] })]
258
+ })
259
+ ]
260
+ });
261
+ }
262
+ function Je() {
263
+ return /* @__PURE__ */ G("div", {
264
+ "aria-hidden": "true",
265
+ className: "resource-list-row resource-skeleton-row flow-columns",
266
+ children: [
267
+ /* @__PURE__ */ G("span", {
268
+ className: "resource-primary-cell",
269
+ children: [/* @__PURE__ */ W(z, { className: "size-8 shrink-0" }), /* @__PURE__ */ G("span", {
270
+ className: "resource-skeleton-copy",
271
+ children: [/* @__PURE__ */ W(z, { className: "h-3.5 w-36" }), /* @__PURE__ */ W(z, { className: "h-2.5 w-48 max-w-full" })]
272
+ })]
273
+ }),
274
+ /* @__PURE__ */ W(z, { className: "h-3 w-28" }),
275
+ /* @__PURE__ */ W(z, { className: "h-3 w-16" })
276
+ ]
277
+ });
278
+ }
279
+ function Ye({ createFlowDisabled: e, createFlowField: t, flowBadges: n, hrefForFlow: i, hostAction: o, hostTitle: s, language: c, onCreateFlow: l, onHostAction: u, onLanguageChange: d, onSelectFlow: m, store: h }) {
280
+ let g = r(), _ = a(h.workspace.$.busy), y = a(h.workspace.$.flowLoadFailed), x = a(h.workspace.$.flowLoadMoreFailed), S = a(h.workspace.$.flowLoading), C = a(h.workspace.$.flowLoadingMore), w = a(h.workspace.$.flowNextCursor), T = a(h.workspace.$.flows), E = a(h.workspace.$.flowTotal), [ne, D] = U(!1), [O, re] = U(""), [k, A] = U(""), j = O.trim().toLocaleLowerCase(), M = T.filter((e) => e.name.toLocaleLowerCase().includes(j));
281
+ async function se(e) {
282
+ e.preventDefault();
283
+ let t = k.trim();
284
+ v(t) != null || !await l(t) || (D(!1), A(""));
285
+ }
286
+ return /* @__PURE__ */ W("main", {
287
+ className: "resource-browser",
288
+ children: /* @__PURE__ */ G("div", {
289
+ className: "resource-page",
290
+ children: [
291
+ /* @__PURE__ */ G("header", {
292
+ className: "resource-page-header",
293
+ children: [/* @__PURE__ */ W("div", {
294
+ className: "resource-heading",
295
+ children: /* @__PURE__ */ W("h1", { children: g("resource.flows") })
296
+ }), /* @__PURE__ */ G("div", {
297
+ className: "resource-page-actions",
298
+ children: [
299
+ /* @__PURE__ */ W(Ke, {
300
+ language: c,
301
+ onLanguageChange: d
302
+ }),
303
+ /* @__PURE__ */ G(p, {
304
+ disabled: _ != null,
305
+ onClick: () => D(!0),
306
+ children: [/* @__PURE__ */ W(f, {
307
+ "data-icon": "inline-start",
308
+ name: "plus"
309
+ }), g("resource.newFlow")]
310
+ }),
311
+ o != null && s != null && u != null && /* @__PURE__ */ W(Ee, {
312
+ action: o,
313
+ onAction: u,
314
+ title: s
315
+ })
316
+ ]
317
+ })]
318
+ }),
319
+ /* @__PURE__ */ G("section", {
320
+ "aria-labelledby": "flow-list-title",
321
+ className: "resource-list-section",
322
+ children: [
323
+ /* @__PURE__ */ G("div", {
324
+ className: "resource-list-title",
325
+ children: [/* @__PURE__ */ G("div", {
326
+ className: "resource-list-heading",
327
+ children: [/* @__PURE__ */ W("h2", {
328
+ id: "flow-list-title",
329
+ children: g("resource.allFlows")
330
+ }), !S && /* @__PURE__ */ W("span", { children: g("resource.flowCount", { count: E ?? T.length }) })]
331
+ }), /* @__PURE__ */ G("div", {
332
+ className: "resource-list-actions",
333
+ children: [/* @__PURE__ */ G(ue, {
334
+ className: "w-full sm:w-56",
335
+ children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ W(f, {
336
+ name: "search",
337
+ size: 17
338
+ }) }), /* @__PURE__ */ W(ee, {
339
+ autoComplete: "off",
340
+ "aria-label": g("resource.searchFlows"),
341
+ name: "flow-search",
342
+ onChange: (e) => re(e.target.value),
343
+ placeholder: g("resource.searchFlows"),
344
+ value: O
345
+ })]
346
+ }), /* @__PURE__ */ W(p, {
347
+ "aria-label": g("common.refresh"),
348
+ disabled: S || _ != null,
349
+ onClick: () => void h.workspace.reloadFlows(),
350
+ size: "icon",
351
+ title: g("common.refresh"),
352
+ variant: "outline",
353
+ children: /* @__PURE__ */ W(f, { name: "refresh" })
354
+ })]
355
+ })]
356
+ }),
357
+ /* @__PURE__ */ G("div", {
358
+ "aria-hidden": "true",
359
+ className: "resource-list-columns flow-columns",
360
+ children: [
361
+ /* @__PURE__ */ W("span", { children: g("resource.name") }),
362
+ /* @__PURE__ */ W("span", { children: g("resource.updated") }),
363
+ /* @__PURE__ */ W("span", { children: g("resource.status") })
364
+ ]
365
+ }),
366
+ /* @__PURE__ */ W("div", {
367
+ className: "resource-list",
368
+ children: S ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ W(Je, {}, t)) : y ? /* @__PURE__ */ G(oe, {
369
+ className: "min-h-64",
370
+ role: "alert",
371
+ children: [/* @__PURE__ */ G(R, { children: [
372
+ /* @__PURE__ */ W(ie, {
373
+ variant: "icon",
374
+ children: /* @__PURE__ */ W(f, {
375
+ name: "alert",
376
+ size: 20
377
+ })
378
+ }),
379
+ /* @__PURE__ */ W(ae, { children: g("resource.flowsLoadFailed") }),
380
+ /* @__PURE__ */ W(b, { children: g("resource.flowsLoadFailedDescription") })
381
+ ] }), /* @__PURE__ */ W(xe, { children: /* @__PURE__ */ W(p, {
382
+ onClick: () => void h.retryFlows(),
383
+ variant: "outline",
384
+ children: g("empty.retry")
385
+ }) })]
386
+ }) : M.length == 0 ? /* @__PURE__ */ G(oe, {
387
+ className: "min-h-64",
388
+ children: [/* @__PURE__ */ G(R, { children: [
389
+ /* @__PURE__ */ W(ie, {
390
+ variant: "icon",
391
+ children: /* @__PURE__ */ W(f, {
392
+ name: "flow",
393
+ size: 20
394
+ })
395
+ }),
396
+ /* @__PURE__ */ W(ae, { children: g(j.length == 0 ? "resource.noFlows" : "resource.noMatchingFlows") }),
397
+ /* @__PURE__ */ W(b, { children: g(j.length == 0 ? "resource.noFlowsDescription" : "resource.noMatchingDescription") })
398
+ ] }), j.length == 0 && /* @__PURE__ */ W(xe, { children: /* @__PURE__ */ G(p, {
399
+ onClick: () => D(!0),
400
+ variant: "outline",
401
+ children: [/* @__PURE__ */ W(f, {
402
+ "data-icon": "inline-start",
403
+ name: "plus"
404
+ }), g("resource.newFlow")]
405
+ }) })]
406
+ }) : M.map((e) => /* @__PURE__ */ W(qe, {
407
+ badge: n?.[e.flowId],
408
+ busy: _,
409
+ flow: e,
410
+ href: i(e),
411
+ onSelect: m,
412
+ store: h
413
+ }, e.flowId))
414
+ }),
415
+ w != null && /* @__PURE__ */ W("div", {
416
+ className: "resource-list-footer",
417
+ children: /* @__PURE__ */ W(p, {
418
+ disabled: C,
419
+ onClick: () => void h.workspace.loadMoreFlows(),
420
+ variant: "outline",
421
+ children: g(C ? "resource.loadingMore" : x ? "resource.retryLoadMore" : "resource.loadMore")
422
+ })
423
+ })
424
+ ]
425
+ }),
426
+ ne && /* @__PURE__ */ W(Re, {
427
+ fallback: null,
428
+ children: /* @__PURE__ */ W(We, {
429
+ disabled: e,
430
+ field: t,
431
+ id: "flow-name",
432
+ issue: v(k),
433
+ label: g("resource.flowName"),
434
+ name: k,
435
+ onNameChange: A,
436
+ onOpenChange: D,
437
+ onSubmit: (e) => void se(e),
438
+ pending: _ == "flow",
439
+ title: g("resource.newFlow")
440
+ })
441
+ })
442
+ ]
443
+ })
444
+ });
445
+ }
446
+ //#endregion
447
+ //#region ../../node_modules/.bun/nanoid@6.0.1/node_modules/nanoid/index.browser.js
448
+ var Xe = (e) => crypto.getRandomValues(new Uint8Array(e)), Ze = (e, t, n) => {
449
+ let r = 256 - 256 % e.length;
450
+ if (r === 256) {
451
+ let r = e.length - 1;
452
+ return (i = t) => {
453
+ if (!i) return "";
454
+ let a = "";
455
+ for (;;) {
456
+ let t = n(i), o = i;
457
+ for (; o--;) if (a += e[t[o] & r], a.length >= i) return a;
458
+ }
459
+ };
460
+ }
461
+ let i = Math.ceil(409.6 * t / r);
462
+ return (a = t) => {
463
+ if (!a) return "";
464
+ let o = "";
465
+ for (;;) {
466
+ let t = n(i), s = i;
467
+ for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
468
+ }
469
+ };
470
+ }, Qe = (e, t = 21) => Ze(e, t | 0, Xe);
471
+ //#endregion
472
+ //#region src/flow/common/edgeChanges.ts
473
+ function $e(e, t, n) {
474
+ let r = {
475
+ source: n.source,
476
+ sourceHandle: n.sourceHandle,
477
+ target: n.target,
478
+ targetHandle: n.targetHandle
479
+ }, i = tt(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
480
+ return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : fe(e, [{
481
+ edge: r,
482
+ kind: "graph.edge.connect",
483
+ target: t
484
+ }]);
485
+ }
486
+ function et(e, t, n) {
487
+ let r = {
488
+ source: n.source,
489
+ sourceHandle: n.sourceHandle,
490
+ target: n.target,
491
+ targetHandle: n.targetHandle
492
+ }, i = tt(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
493
+ return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
494
+ edge: r,
495
+ kind: "graph.edge.disconnect",
496
+ target: t
497
+ }];
498
+ }
499
+ function tt(e, t) {
500
+ return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
501
+ }
502
+ //#endregion
503
+ //#region src/flow/common/moduleChanges.ts
504
+ async function nt(e) {
505
+ try {
506
+ let { parse: t } = await import("./lib-C5Ipyfps.js").then((e) => e.t), n = t(e, {
507
+ errorRecovery: !0,
508
+ sourceType: "module"
509
+ }).program, r = /* @__PURE__ */ new Set();
510
+ for (let e of n.body) {
511
+ if (e.type != "ImportDeclaration") continue;
512
+ let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
513
+ t?.[1] != null && r.add(t[1]);
514
+ }
515
+ return [...r].toSorted();
516
+ } catch {
517
+ return [];
518
+ }
519
+ }
520
+ function rt(e, t, n) {
521
+ return [{
522
+ imports: n,
523
+ kind: "module.source.replace",
524
+ moduleId: e,
525
+ source: t
526
+ }];
527
+ }
528
+ var it = Qe("23456789abcdefghjkmnpqrstuvwxyz", 10), K = {
91
529
  activities: [],
92
530
  activitiesLoadFailed: !1,
93
531
  activitiesLoading: !1,
@@ -100,161 +538,169 @@ var T = {
100
538
  loadingMore: !1,
101
539
  publications: [],
102
540
  publishing: !1
103
- }, le = 20, ue = 50;
104
- function E(e, t) {
541
+ }, at = 20, ot = 50, st = 750;
542
+ function q(e, t) {
105
543
  return e?.flowId == t.flowId;
106
544
  }
107
- var de = class {
545
+ var ct = class {
108
546
  #e;
109
547
  #t;
110
548
  #n;
111
549
  #r = new x();
112
550
  #i = new x();
113
- #a = new x();
551
+ #a;
114
552
  #o = new x();
115
- #s;
116
- #c = t(T);
117
- #l;
553
+ #s = new x();
554
+ #c;
555
+ #l = t(K);
118
556
  #u;
119
- constructor(t, n, r, i = () => crypto.randomUUID(), a = l()) {
120
- this.#e = t, this.#t = i, this.#n = a, this.#s = r, this.#l = n, this.$ = {
121
- activities: e(this.#c, (e) => e.activities),
122
- activitiesLoadFailed: e(this.#c, (e) => e.activitiesLoadFailed),
123
- activitiesLoading: e(this.#c, (e) => e.activitiesLoading),
124
- activitiesLoadingMore: e(this.#c, (e) => e.activitiesLoadingMore),
125
- activitiesNextCursor: e(this.#c, (e) => e.activitiesNextCursor),
126
- bindings: e(this.#c, (e) => e.bindings),
127
- changingTriggerId: e(this.#c, (e) => e.changingTriggerId),
128
- detail: e(this.#c, (e) => e.detail),
129
- detailLoading: e(this.#c, (e) => e.detailLoading),
130
- live: e(this.#c, (e) => e.live),
131
- loadFailed: e(this.#c, (e) => e.loadFailed),
132
- loading: e(this.#c, (e) => e.loading),
133
- loadMoreFailed: e(this.#c, (e) => e.loadMoreFailed),
134
- loadingMore: e(this.#c, (e) => e.loadingMore),
135
- nextCursor: e(this.#c, (e) => e.nextCursor),
136
- publications: e(this.#c, (e) => e.publications),
137
- publishing: e(this.#c, (e) => e.publishing),
138
- rollingBackPublicationId: e(this.#c, (e) => e.rollingBackPublicationId),
139
- selectedTriggerId: e(this.#c, (e) => e.selectedTriggerId),
140
- testingTriggerId: e(this.#c, (e) => e.testingTriggerId),
141
- testResult: e(this.#c, (e) => e.testResult),
142
- total: e(this.#c, (e) => e.total)
557
+ #d;
558
+ constructor(t, n, r, i, a = () => crypto.randomUUID(), o = E()) {
559
+ this.#e = t, this.#t = a, this.#n = o, this.#a = i, this.#c = r, this.#u = n, this.$ = {
560
+ activities: e(this.#l, (e) => e.activities),
561
+ activitiesLoadFailed: e(this.#l, (e) => e.activitiesLoadFailed),
562
+ activitiesLoading: e(this.#l, (e) => e.activitiesLoading),
563
+ activitiesLoadingMore: e(this.#l, (e) => e.activitiesLoadingMore),
564
+ activitiesNextCursor: e(this.#l, (e) => e.activitiesNextCursor),
565
+ bindings: e(this.#l, (e) => e.bindings),
566
+ changingTriggerId: e(this.#l, (e) => e.changingTriggerId),
567
+ detail: e(this.#l, (e) => e.detail),
568
+ detailLoading: e(this.#l, (e) => e.detailLoading),
569
+ live: e(this.#l, (e) => e.live),
570
+ loadFailed: e(this.#l, (e) => e.loadFailed),
571
+ loading: e(this.#l, (e) => e.loading),
572
+ loadMoreFailed: e(this.#l, (e) => e.loadMoreFailed),
573
+ loadingMore: e(this.#l, (e) => e.loadingMore),
574
+ nextCursor: e(this.#l, (e) => e.nextCursor),
575
+ operation: e(this.#l, (e) => e.operation),
576
+ publications: e(this.#l, (e) => e.publications),
577
+ publishing: e(this.#l, (e) => e.publishing),
578
+ rollingBackPublicationId: e(this.#l, (e) => e.rollingBackPublicationId),
579
+ selectedTriggerId: e(this.#l, (e) => e.selectedTriggerId),
580
+ testingTriggerId: e(this.#l, (e) => e.testingTriggerId),
581
+ testResult: e(this.#l, (e) => e.testResult),
582
+ total: e(this.#l, (e) => e.total)
143
583
  };
144
584
  }
145
585
  dispose() {
146
- this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate();
586
+ this.#r.invalidate(), this.#i.invalidate(), this.#o.invalidate(), this.#s.invalidate();
147
587
  for (let e of Object.values(this.$)) e.dispose();
148
- this.#c.dispose();
588
+ this.#l.dispose();
149
589
  }
150
590
  reset() {
151
- this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate(), this.#u = void 0, this.#c.set(T);
591
+ this.#r.invalidate(), this.#i.invalidate(), this.#o.invalidate(), this.#s.invalidate(), this.#d = void 0, this.#l.set(K);
152
592
  }
153
593
  async load(e) {
154
594
  let t = { flowId: e }, n = this.#r.begin();
155
- E(this.#c.value.target, t) || (this.#u = void 0), this.#s(void 0), this.#c.set({
156
- ...T,
595
+ q(this.#l.value.target, t) || (this.#i.invalidate(), this.#d = void 0), this.#c(void 0), this.#l.set({
596
+ ...K,
157
597
  loading: !0,
158
598
  target: t
159
599
  });
160
600
  try {
161
- let [e, r, i] = await this.#p(t);
601
+ let e = await this.#h(t), [r, i, a] = await this.#m(t);
162
602
  if (!n()) return;
163
- this.#h({
164
- bindings: i,
165
- live: e,
603
+ if (this.#y({
604
+ bindings: a,
605
+ live: r,
166
606
  loading: !1,
167
- nextCursor: r.nextCursor,
168
- publications: r.publications,
169
- total: r.total
170
- });
607
+ nextCursor: i.nextCursor,
608
+ operation: e,
609
+ publications: i.publications,
610
+ publishing: e?.status == "pending",
611
+ total: i.total
612
+ }), e?.status == "pending") {
613
+ let n = this.#u.$.targetFlow.value;
614
+ this.#g(t, e, this.#i.begin(), n?.flowId == t.flowId ? n.name : t.flowId);
615
+ }
171
616
  } catch (e) {
172
617
  if (!n()) return;
173
- this.#h({
618
+ this.#y({
174
619
  loadFailed: !0,
175
620
  loading: !1
176
- }), this.#s(u(e, this.#n.t));
621
+ }), this.#c(B(e, this.#n.t));
177
622
  }
178
623
  }
179
624
  async loadMore() {
180
- let { loadingMore: e, nextCursor: t, target: n } = this.#c.value;
625
+ let { loadingMore: e, nextCursor: t, target: n } = this.#l.value;
181
626
  if (e || t == null || n == null) return;
182
627
  let r = this.#r.capture();
183
- this.#h({
628
+ this.#y({
184
629
  loadMoreFailed: !1,
185
630
  loadingMore: !0
186
631
  });
187
632
  try {
188
633
  let e = await this.#e.listPublications(n.flowId, {
189
634
  cursor: t,
190
- limit: ue
635
+ limit: ot
191
636
  });
192
637
  if (!r()) return;
193
- let i = new Set(this.#c.value.publications.map((e) => e.publicationId));
194
- this.#h({
638
+ let i = new Set(this.#l.value.publications.map((e) => e.publicationId));
639
+ this.#y({
195
640
  loadingMore: !1,
196
641
  loadMoreFailed: !1,
197
642
  nextCursor: e.nextCursor,
198
- publications: [...this.#c.value.publications, ...e.publications.filter((e) => !i.has(e.publicationId))]
643
+ publications: [...this.#l.value.publications, ...e.publications.filter((e) => !i.has(e.publicationId))]
199
644
  });
200
645
  } catch (e) {
201
646
  if (!r()) return;
202
- this.#h({
647
+ this.#y({
203
648
  loadMoreFailed: !0,
204
649
  loadingMore: !1
205
- }), this.#s(u(e, this.#n.t));
650
+ }), this.#c(B(e, this.#n.t));
206
651
  }
207
652
  }
208
653
  async publish() {
209
- let e = this.#l.$.targetFlow.value, t = this.#l.$.draft.value;
210
- if (e == null || t == null || this.#c.value.changingTriggerId != null || this.#c.value.publishing || this.#c.value.rollingBackPublicationId != null) return !1;
211
- let n = { flowId: e.flowId }, r = this.#l.$.live.value?.publication?.publicationId ?? null, i = JSON.stringify({
654
+ let e = this.#u.$.targetFlow.value, t = this.#u.$.draft.value;
655
+ if (e == null || t == null || this.#l.value.changingTriggerId != null || this.#l.value.publishing || this.#l.value.rollingBackPublicationId != null) return !1;
656
+ let n = { flowId: e.flowId }, r = this.#u.$.live.value?.publication?.publicationId ?? null, i = JSON.stringify({
212
657
  expectedLivePublicationId: r,
213
658
  flowId: e.flowId,
214
659
  kind: "publish",
215
660
  revisionId: t.revisionId
216
- }), a = this.#u?.signature == i ? this.#u : {
661
+ }), a = this.#d?.signature == i ? this.#d : {
217
662
  key: this.#t(),
218
663
  signature: i
219
664
  }, o = this.#i.begin();
220
- this.#u = a, this.#s(void 0), this.#m(n, { publishing: !0 });
665
+ this.#d = a, this.#c(void 0), this.#v(n, { publishing: !0 });
221
666
  try {
222
- return await this.#e.publishFlow(e.flowId, t.revisionId, r, { idempotencyKey: a.key }), !o() || (await this.#d(n), !o()) ? !1 : (this.#u = void 0, this.#s({
223
- kind: "success",
224
- message: this.#n.t("notice.published", { name: e.name })
225
- }), !0);
667
+ let i = await this.#e.publishFlow(e.flowId, t.revisionId, r, { idempotencyKey: a.key });
668
+ return o() ? (this.#a.setItem(this.#_(n.flowId), i.operationId), this.#y({
669
+ operation: i,
670
+ publishing: i.status == "pending"
671
+ }), await this.#g(n, i, o, e.name)) : !1;
226
672
  } catch (e) {
227
- return o() ? (e instanceof s && e.code == "live.conflict" && await this.#f(n), this.#s(u(e, this.#n.t)), !1) : !1;
673
+ return o() ? (e instanceof P && e.code == "live.conflict" && await this.#p(n), this.#c(B(e, this.#n.t)), !1) : !1;
228
674
  } finally {
229
- o() && this.#h({ publishing: !1 });
675
+ o() && this.#y({ publishing: !1 });
230
676
  }
231
677
  }
232
678
  async rollback(e) {
233
- let { live: t, rollingBackPublicationId: n, target: r } = this.#c.value, i = t?.publication?.publicationId;
234
- if (r == null || i == null || this.#c.value.changingTriggerId != null || n != null || this.#c.value.publishing || e.flowId != r.flowId) return !1;
679
+ let { live: t, rollingBackPublicationId: n, target: r } = this.#l.value, i = t?.publication?.publicationId;
680
+ if (r == null || i == null || this.#l.value.changingTriggerId != null || n != null || this.#l.value.publishing || e.flowId != r.flowId) return !1;
235
681
  let a = JSON.stringify({
236
682
  currentPublicationId: i,
237
683
  flowId: r.flowId,
238
684
  kind: "rollback",
239
685
  targetPublicationId: e.publicationId
240
- }), o = this.#u?.signature == a ? this.#u : {
686
+ }), o = this.#d?.signature == a ? this.#d : {
241
687
  key: this.#t(),
242
688
  signature: a
243
- }, c = this.#i.begin();
244
- this.#u = o, this.#s(void 0), this.#h({ rollingBackPublicationId: e.publicationId });
689
+ }, s = this.#i.begin();
690
+ this.#d = o, this.#c(void 0), this.#y({ rollingBackPublicationId: e.publicationId });
245
691
  try {
246
- return await this.#e.rollbackFlow(r.flowId, e.publicationId, i, { idempotencyKey: o.key }), !c() || (await this.#d(r), !c()) ? !1 : (this.#u = void 0, this.#s({
692
+ return await this.#e.rollbackFlow(r.flowId, e.publicationId, i, { idempotencyKey: o.key }), !s() || (await this.#f(r), !s()) ? !1 : (this.#d = void 0, this.#c({
247
693
  kind: "success",
248
694
  message: this.#n.t("notice.rolledBack", { revision: e.revisionId })
249
695
  }), !0);
250
696
  } catch (e) {
251
- return c() ? (e instanceof s && e.code == "live.conflict" && await this.#f(r), this.#s(u(e, this.#n.t)), !1) : !1;
697
+ return s() ? (e instanceof P && e.code == "live.conflict" && await this.#p(r), this.#c(B(e, this.#n.t)), !1) : !1;
252
698
  } finally {
253
- c() && this.#h({ rollingBackPublicationId: void 0 });
699
+ s() && this.#y({ rollingBackPublicationId: void 0 });
254
700
  }
255
701
  }
256
702
  closeTrigger() {
257
- this.#a.invalidate(), this.#o.invalidate(), this.#h({
703
+ this.#o.invalidate(), this.#s.invalidate(), this.#y({
258
704
  activities: [],
259
705
  activitiesLoadFailed: !1,
260
706
  activitiesLoading: !1,
@@ -268,10 +714,10 @@ var de = class {
268
714
  });
269
715
  }
270
716
  async openTrigger(e) {
271
- let t = this.#c.value.target;
717
+ let t = this.#l.value.target;
272
718
  if (t == null) return;
273
- let n = this.#a.begin();
274
- this.#o.invalidate(), this.#h({
719
+ let n = this.#o.begin();
720
+ this.#s.invalidate(), this.#y({
275
721
  activities: [],
276
722
  activitiesLoadFailed: !1,
277
723
  activitiesLoading: !0,
@@ -283,96 +729,96 @@ var de = class {
283
729
  testingTriggerId: void 0,
284
730
  testResult: void 0
285
731
  });
286
- let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.flowId, e), this.#e.listFlowTriggerActivities(t.flowId, e, { limit: le })]);
732
+ let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.flowId, e), this.#e.listFlowTriggerActivities(t.flowId, e, { limit: at })]);
287
733
  if (n()) {
288
734
  if (r.status == "rejected") {
289
- this.#h({
735
+ this.#y({
290
736
  activitiesLoading: !1,
291
737
  detailLoading: !1
292
- }), this.#s(u(r.reason, this.#n.t));
738
+ }), this.#c(B(r.reason, this.#n.t));
293
739
  return;
294
740
  }
295
- this.#h({
741
+ this.#y({
296
742
  detail: r.value,
297
743
  detailLoading: !1
298
- }), i.status == "fulfilled" ? this.#h({
744
+ }), i.status == "fulfilled" ? this.#y({
299
745
  activities: i.value.activities,
300
746
  activitiesLoadFailed: !1,
301
747
  activitiesLoading: !1,
302
748
  activitiesNextCursor: i.value.nextCursor
303
- }) : (this.#h({
749
+ }) : (this.#y({
304
750
  activitiesLoadFailed: !0,
305
751
  activitiesLoading: !1
306
- }), this.#s(u(i.reason, this.#n.t)));
752
+ }), this.#c(B(i.reason, this.#n.t)));
307
753
  }
308
754
  }
309
755
  async loadMoreTriggerActivities() {
310
- let { activitiesLoadingMore: e, activitiesNextCursor: t, selectedTriggerId: n, target: r } = this.#c.value;
756
+ let { activitiesLoadingMore: e, activitiesNextCursor: t, selectedTriggerId: n, target: r } = this.#l.value;
311
757
  if (e || t == null || n == null || r == null) return;
312
- let i = this.#a.capture();
313
- this.#h({
758
+ let i = this.#o.capture();
759
+ this.#y({
314
760
  activitiesLoadFailed: !1,
315
761
  activitiesLoadingMore: !0
316
762
  });
317
763
  try {
318
764
  let e = await this.#e.listFlowTriggerActivities(r.flowId, n, {
319
765
  cursor: t,
320
- limit: le
766
+ limit: at
321
767
  });
322
- if (!i() || this.#c.value.selectedTriggerId != n) return;
323
- let a = new Set(this.#c.value.activities.map((e) => e.activityId));
324
- this.#h({
325
- activities: [...this.#c.value.activities, ...e.activities.filter((e) => !a.has(e.activityId))],
768
+ if (!i() || this.#l.value.selectedTriggerId != n) return;
769
+ let a = new Set(this.#l.value.activities.map((e) => e.activityId));
770
+ this.#y({
771
+ activities: [...this.#l.value.activities, ...e.activities.filter((e) => !a.has(e.activityId))],
326
772
  activitiesLoadFailed: !1,
327
773
  activitiesLoadingMore: !1,
328
774
  activitiesNextCursor: e.nextCursor
329
775
  });
330
776
  } catch (e) {
331
- if (!i() || this.#c.value.selectedTriggerId != n) return;
332
- this.#h({
777
+ if (!i() || this.#l.value.selectedTriggerId != n) return;
778
+ this.#y({
333
779
  activitiesLoadFailed: !0,
334
780
  activitiesLoadingMore: !1
335
- }), this.#s(u(e, this.#n.t));
781
+ }), this.#c(B(e, this.#n.t));
336
782
  }
337
783
  }
338
784
  async testTrigger() {
339
- let { detail: e, selectedTriggerId: t, target: n, testingTriggerId: r } = this.#c.value;
785
+ let { detail: e, selectedTriggerId: t, target: n, testingTriggerId: r } = this.#l.value;
340
786
  if (e?.binding.kind != "poll" || e.binding.currentPublicationId == null || t == null || n == null || r != null) return !1;
341
- let i = this.#o.begin();
342
- this.#h({
787
+ let i = this.#s.begin();
788
+ this.#y({
343
789
  testingTriggerId: t,
344
790
  testResult: void 0
345
791
  });
346
792
  try {
347
793
  let e = await this.#e.testFlowPollTrigger(n.flowId, t);
348
- return !i() || this.#c.value.selectedTriggerId != t ? !1 : (this.#h({ testResult: e }), !0);
794
+ return !i() || this.#l.value.selectedTriggerId != t ? !1 : (this.#y({ testResult: e }), !0);
349
795
  } catch (e) {
350
- return i() && this.#c.value.selectedTriggerId == t && this.#s(u(e, this.#n.t)), !1;
796
+ return i() && this.#l.value.selectedTriggerId == t && this.#c(B(e, this.#n.t)), !1;
351
797
  } finally {
352
- i() && this.#c.value.selectedTriggerId == t && this.#h({ testingTriggerId: void 0 });
798
+ i() && this.#l.value.selectedTriggerId == t && this.#y({ testingTriggerId: void 0 });
353
799
  }
354
800
  }
355
801
  async toggleTrigger(e) {
356
- let t = this.#c.value.target;
357
- if (t == null || this.#c.value.changingTriggerId != null || this.#c.value.publishing || this.#c.value.rollingBackPublicationId != null) return !1;
802
+ let t = this.#l.value.target;
803
+ if (t == null || this.#l.value.changingTriggerId != null || this.#l.value.publishing || this.#l.value.rollingBackPublicationId != null) return !1;
358
804
  let n = this.#i.begin();
359
- this.#h({ changingTriggerId: e.triggerNodeId });
805
+ this.#y({ changingTriggerId: e.triggerNodeId });
360
806
  try {
361
807
  if (e.operatorState == "active" ? await this.#e.pauseFlowTrigger(t.flowId, e.triggerNodeId) : await this.#e.resumeFlowTrigger(t.flowId, e.triggerNodeId), !n()) return !1;
362
808
  let r = await this.#e.listFlowTriggerBindings(t.flowId);
363
- return n() ? (this.#h({ bindings: r }), this.#c.value.selectedTriggerId == e.triggerNodeId && this.openTrigger(e.triggerNodeId), this.#s({
809
+ return n() ? (this.#y({ bindings: r }), this.#l.value.selectedTriggerId == e.triggerNodeId && this.openTrigger(e.triggerNodeId), this.#c({
364
810
  kind: "success",
365
811
  message: this.#n.t(e.operatorState == "active" ? "notice.triggerPaused" : "notice.triggerResumed")
366
812
  }), !0) : !1;
367
813
  } catch (e) {
368
- return n() && this.#s(u(e, this.#n.t)), !1;
814
+ return n() && this.#c(B(e, this.#n.t)), !1;
369
815
  } finally {
370
- n() && this.#h({ changingTriggerId: void 0 });
816
+ n() && this.#y({ changingTriggerId: void 0 });
371
817
  }
372
818
  }
373
- async #d(e) {
374
- let [t, n, r] = await this.#p(e);
375
- this.#l.updateLive(t), await this.#l.refreshFlows(), E(this.#c.value.target, e) && this.#h({
819
+ async #f(e) {
820
+ let [t, n, r] = await this.#m(e);
821
+ this.#u.updateLive(t), await this.#u.refreshFlows(), q(this.#l.value.target, e) && this.#y({
376
822
  bindings: r,
377
823
  live: t,
378
824
  loadFailed: !1,
@@ -381,54 +827,104 @@ var de = class {
381
827
  total: n.total
382
828
  });
383
829
  }
384
- async #f(e) {
830
+ async #p(e) {
385
831
  try {
386
- await this.#d(e), this.#u = void 0;
832
+ await this.#f(e), this.#d = void 0;
387
833
  } catch {
388
834
  return;
389
835
  }
390
836
  }
391
- async #p(e) {
837
+ async #m(e) {
392
838
  return await Promise.all([
393
839
  this.#e.getLive(e.flowId),
394
840
  this.#e.listPublications(e.flowId, {
395
841
  includeTotal: !0,
396
- limit: ue
842
+ limit: ot
397
843
  }),
398
844
  this.#e.listFlowTriggerBindings(e.flowId)
399
845
  ]);
400
846
  }
401
- #m(e, t) {
402
- E(this.#c.value.target, e) ? this.#h(t) : this.#c.set({
403
- ...T,
847
+ async #h(e) {
848
+ let t = this.#a.getItem(this.#_(e.flowId));
849
+ if (t != null && t != "") try {
850
+ return await this.#e.getPublishOperation(e.flowId, t);
851
+ } catch (t) {
852
+ if (t instanceof P && t.code == "publication.operation-not-found") {
853
+ this.#a.setItem(this.#_(e.flowId), "");
854
+ return;
855
+ }
856
+ throw t;
857
+ }
858
+ }
859
+ async #g(e, t, n, r) {
860
+ let i = t;
861
+ for (; i.status == "pending";) {
862
+ if (await new Promise((e) => setTimeout(e, st)), !n()) return !1;
863
+ try {
864
+ i = await this.#e.getPublishOperation(e.flowId, i.operationId);
865
+ } catch (t) {
866
+ if (!n()) return !1;
867
+ if (t instanceof P && t.code == "publication.operation-not-found") return this.#a.setItem(this.#_(e.flowId), ""), this.#v(e, {
868
+ operation: void 0,
869
+ publishing: !1
870
+ }), this.#c(B(t, this.#n.t)), !1;
871
+ this.#c(B(t, this.#n.t));
872
+ continue;
873
+ }
874
+ if (!n()) return !1;
875
+ this.#v(e, { operation: i });
876
+ }
877
+ if (this.#d = void 0, this.#v(e, {
878
+ operation: i,
879
+ publishing: !1
880
+ }), i.status == "failed") return this.#c({
881
+ kind: "error",
882
+ message: i.issue.message
883
+ }), !1;
884
+ try {
885
+ await this.#f(e);
886
+ } catch (e) {
887
+ return n() && this.#c(B(e, this.#n.t)), !0;
888
+ }
889
+ return n() ? (this.#c({
890
+ kind: "success",
891
+ message: this.#n.t("notice.published", { name: r })
892
+ }), !0) : !1;
893
+ }
894
+ #_(e) {
895
+ return `publish-operation:${e}`;
896
+ }
897
+ #v(e, t) {
898
+ q(this.#l.value.target, e) ? this.#y(t) : this.#l.set({
899
+ ...K,
404
900
  ...t,
405
901
  target: e
406
902
  });
407
903
  }
408
- #h(e) {
409
- this.#c.set({
410
- ...this.#c.value,
904
+ #y(e) {
905
+ this.#l.set({
906
+ ...this.#l.value,
411
907
  ...e
412
908
  });
413
909
  }
414
- }, fe = { starting: !1 };
415
- function pe(e) {
910
+ }, lt = { starting: !1 };
911
+ function ut(e) {
416
912
  switch (e.kind) {
417
913
  case "condition": return { [e.node.input.handle]: e.node.input };
418
- case "subflow": return o(e.definition?.inputs ?? []);
419
- case "task": return o(e.definition?.inputs ?? []);
914
+ case "subflow": return s(e.definition?.inputs ?? []);
915
+ case "task": return s(e.definition?.inputs ?? []);
420
916
  case "value": return {};
421
917
  }
422
918
  }
423
- function me(e) {
919
+ function dt(e) {
424
920
  return e.node.name == null ? e.kind == "task" || e.kind == "subflow" ? e.definition?.name ?? e.id : e.id : e.node.name;
425
921
  }
426
- async function he(e, t) {
427
- let { FlowRunInputEditorStore: n } = await import("./flowRunInputEditorStore-DXOyyY7o.js").then((e) => e.n), r = h(e), i = r.graph({ kind: "flow" });
922
+ async function ft(e, t) {
923
+ let { FlowRunInputEditorStore: n } = await import("./flowRunInputEditorStore-BeyUSWpO.js").then((e) => e.n), r = N(e), i = r.graph({ kind: "flow" });
428
924
  return i == null ? [] : Object.entries(i.nodes).toSorted(([e], [t]) => e.localeCompare(t)).flatMap(([e, i]) => {
429
925
  let a = r.resolveNode(e, i);
430
926
  if (a.kind == "trigger") return [];
431
- let o = Object.entries(pe(a)).filter(([e, t]) => a.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
927
+ let o = Object.entries(ut(a)).filter(([e, t]) => a.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
432
928
  handle: e,
433
929
  jsonSchema: t.jsonSchema,
434
930
  nullable: t.nullable
@@ -436,11 +932,11 @@ async function he(e, t) {
436
932
  return o.length == 0 ? [] : [{
437
933
  editor: new n(o, t),
438
934
  nodeId: e,
439
- title: me(a)
935
+ title: dt(a)
440
936
  }];
441
937
  });
442
938
  }
443
- var ge = class {
939
+ var pt = class {
444
940
  #e;
445
941
  #t;
446
942
  #n;
@@ -448,9 +944,9 @@ var ge = class {
448
944
  #i = new x();
449
945
  #a;
450
946
  #o;
451
- #s = t(fe);
947
+ #s = t(lt);
452
948
  #c;
453
- constructor(t, n, r, i = l(), a = () => crypto.randomUUID()) {
949
+ constructor(t, n, r, i = E(), a = () => crypto.randomUUID()) {
454
950
  this.#e = t, this.#a = n, this.#o = r, this.#n = i, this.#t = a, this.$ = {
455
951
  inputRequest: e(this.#s, (e) => e.inputRequest),
456
952
  starting: e(this.#s, (e) => e.starting),
@@ -465,7 +961,7 @@ var ge = class {
465
961
  reset() {
466
962
  this.#r.invalidate(), this.#i.invalidate(), this.#c = void 0;
467
963
  let e = this.#s.value.inputRequest;
468
- this.#s.set(fe), this.#d(e);
964
+ this.#s.set(lt), this.#d(e);
469
965
  }
470
966
  async requestDraft(e, t) {
471
967
  let n = this.#i.begin();
@@ -480,7 +976,7 @@ var ge = class {
480
976
  let r = await this.#e.getRevision(e.flowId, n.revisionId);
481
977
  return t() ? await this.#l("live", e, r, n.revisionId, t, n.publicationId) : "unavailable";
482
978
  } catch (e) {
483
- return t() && this.#o(u(e, this.#n.t)), "unavailable";
979
+ return t() && this.#o(B(e, this.#n.t)), "unavailable";
484
980
  } finally {
485
981
  t() && this.#f({ starting: !1 });
486
982
  }
@@ -504,11 +1000,11 @@ var ge = class {
504
1000
  this.#f({
505
1001
  inputRequest: void 0,
506
1002
  starting: !0,
507
- submitting: e
1003
+ submitting: void 0
508
1004
  }), this.#d(s);
509
1005
  let c;
510
1006
  try {
511
- c = await he(r, this.#n.lang$);
1007
+ c = await ft(r, this.#n.lang$);
512
1008
  } catch (e) {
513
1009
  throw a() && this.#f({
514
1010
  starting: !1,
@@ -564,7 +1060,7 @@ var ge = class {
564
1060
  });
565
1061
  return !a() || !o() ? !1 : (this.#c = void 0, this.#a.follow(s, o));
566
1062
  } catch (e) {
567
- return a() && o() && this.#o(u(e, this.#n.t)), !1;
1063
+ return a() && o() && this.#o(B(e, this.#n.t)), !1;
568
1064
  } finally {
569
1065
  a() && this.#f({
570
1066
  starting: !1,
@@ -584,34 +1080,34 @@ var ge = class {
584
1080
  ...e
585
1081
  });
586
1082
  }
587
- }, D = {
1083
+ }, mt = {
588
1084
  actions: {},
589
1085
  catalogs: {}
590
1086
  };
591
- function O(e) {
1087
+ function ht(e) {
592
1088
  return Object.entries(e).map(([e, t]) => ({
593
1089
  description: t.description,
594
1090
  handle: e,
595
1091
  jsonSchema: t.jsonSchema
596
1092
  }));
597
1093
  }
598
- function k(e, t) {
1094
+ function J(e, t) {
599
1095
  return {
600
1096
  connector: e,
601
- description: e.defaultConnection == null ? t("addNode.connectorNeedsConnection", {
1097
+ description: e.authenticated && e.defaultConnection == null ? t("addNode.connectorNeedsConnection", {
602
1098
  description: e.description,
603
1099
  service: e.serviceName
604
1100
  }) : e.description,
605
1101
  group: t("addNode.connectorActions"),
606
1102
  icon: e.icon ?? ":carbon:connection-signal:",
607
1103
  id: `connector:${e.actionId}`,
608
- inputs: O(e.inputs),
1104
+ inputs: ht(e.inputs),
609
1105
  kind: "connector",
610
1106
  label: e.name,
611
- outputs: O(e.outputs)
1107
+ outputs: ht(e.outputs)
612
1108
  };
613
1109
  }
614
- function _e(e, t) {
1110
+ function gt(e, t) {
615
1111
  let n = /* @__PURE__ */ new Map();
616
1112
  for (let t of e) {
617
1113
  let e = n.get(t.serviceId) ?? [];
@@ -619,7 +1115,7 @@ function _e(e, t) {
619
1115
  }
620
1116
  return [...n.values()].toSorted((e, t) => e[0].serviceName.localeCompare(t[0].serviceName)).map((e) => {
621
1117
  let n = e[0], r = e.map((e) => {
622
- let n = k(e, t);
1118
+ let n = J(e, t);
623
1119
  return {
624
1120
  description: n.description,
625
1121
  label: n.label,
@@ -640,7 +1136,7 @@ function _e(e, t) {
640
1136
  };
641
1137
  });
642
1138
  }
643
- function ve(e, t) {
1139
+ function _t(e, t) {
644
1140
  return {
645
1141
  choices: [],
646
1142
  description: t("addNode.connectorBrowseActions"),
@@ -654,7 +1150,7 @@ function ve(e, t) {
654
1150
  serviceId: e.serviceId
655
1151
  };
656
1152
  }
657
- function A(e) {
1153
+ function vt(e) {
658
1154
  if (e?.kind != "task" || e.node.task != null) return;
659
1155
  let t = e.definition;
660
1156
  if (!(t == null || !("executor" in t) || t.executor.kind != "connector")) return {
@@ -664,7 +1160,7 @@ function A(e) {
664
1160
  taskId: e.node.taskId
665
1161
  };
666
1162
  }
667
- var ye = class {
1163
+ var yt = class {
668
1164
  #e;
669
1165
  #t;
670
1166
  #n;
@@ -679,43 +1175,44 @@ var ye = class {
679
1175
  #d;
680
1176
  #f;
681
1177
  #p;
682
- constructor(r, i, a, o, s = l()) {
683
- this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new x(), this.#l = t(D), this.#p = !1, this.browseAddNodeOptions = async (e) => {
684
- if (this.#p) return;
685
- let t = this.#u.$.flowId.value;
1178
+ #m;
1179
+ constructor(r, i, a, o, s = E()) {
1180
+ this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new x(), this.#u = t(mt), this.#m = !1, this.browseAddNodeOptions = async (e) => {
1181
+ if (this.#m) return;
1182
+ let t = this.#d.$.flowId.value;
686
1183
  if (t == null) return;
687
- let n = this.#f ?? await this.#e.listConnectorProviders(e);
688
- if (!(e.aborted || this.#p || t != this.#u.$.flowId.value)) return this.#f = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => ve(e, this.#t.t));
1184
+ let n = this.#p ?? await this.#e.listConnectorProviders(e, t);
1185
+ if (!(e.aborted || this.#m || t != this.#d.$.flowId.value)) return this.#p = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => _t(e, this.#t.t));
689
1186
  }, this.provideAddNodeOptionChoices = async (e, t) => {
690
- if (this.#p) return;
691
- let n = this.#u.$.flowId.value, r = this.#f?.find((t) => `connector-provider:${t.serviceId}` == e);
1187
+ if (this.#m) return;
1188
+ let n = this.#d.$.flowId.value, r = this.#p?.find((t) => `connector-provider:${t.serviceId}` == e);
692
1189
  if (n == null || r == null) return;
693
- let i = this.#r.get(r.serviceId) ?? await this.#e.listConnectorActions(r.serviceId, t);
694
- if (t.aborted || this.#p || n != this.#u.$.flowId.value) return;
1190
+ let i = this.#r.get(r.serviceId) ?? await this.#e.listConnectorActions(r.serviceId, t, n);
1191
+ if (t.aborted || this.#m || n != this.#d.$.flowId.value) return;
695
1192
  let a = i.map((e) => Object.assign({}, e, e.icon == null && r.icon != null ? { icon: r.icon } : {}, { serviceName: r.serviceName }));
696
- return this.#r.set(r.serviceId, a), this.#v({ actions: {
697
- ...this.#l.value.actions,
1193
+ return this.#r.set(r.serviceId, a), this.#y({ actions: {
1194
+ ...this.#u.value.actions,
698
1195
  ...Object.fromEntries(a.map((e) => [e.actionId, e]))
699
- } }), a.map((e) => k(e, this.#t.t));
1196
+ } }), a.map((e) => J(e, this.#t.t));
700
1197
  }, this.provideAddNodeOptions = async (e, t) => {
701
- if (this.#p) return;
702
- let n = this.#u.$.flowId.value;
1198
+ if (this.#m) return;
1199
+ let n = this.#d.$.flowId.value;
703
1200
  if (n == null) return;
704
- let r = e.trim(), i = r.length == 0 ? Object.values(this.#l.value.actions) : await this.#e.searchConnectorActions(r, t);
705
- if (t.aborted || this.#p || n != this.#u.$.flowId.value) return;
706
- let a = { ...this.#l.value.actions };
1201
+ let r = e.trim(), i = r.length == 0 ? Object.values(this.#u.value.actions) : await this.#e.searchConnectorActions(r, t, n);
1202
+ if (t.aborted || this.#m || n != this.#d.$.flowId.value) return;
1203
+ let a = { ...this.#u.value.actions };
707
1204
  for (let e of i) a[e.actionId] = e;
708
- if (this.#v({ actions: a }), r.length != 0) return i.map((e) => k(e, this.#t.t));
1205
+ if (this.#y({ actions: a }), r.length != 0) return i.map((e) => J(e, this.#t.t));
709
1206
  let o = new Map(i.map((e) => [e.actionId, e]));
710
- for (let e of this.#u.$.revision.value?.connectorActionIds ?? []) {
1207
+ for (let e of this.#d.$.revision.value?.connectorActionIds ?? []) {
711
1208
  let t = a[e];
712
1209
  t != null && o.set(e, t);
713
1210
  }
714
- return _e([...o.values()], this.#t.t);
715
- }, this.#e = r, this.#n = o, this.#u = i, this.#c = a, this.#t = s;
716
- let c = e(this.#l, (e) => e.actions), u = e(this.#l, (e) => e.catalogs);
717
- this.#s = n((e) => {
718
- let t = A(e(i.$.selection)), n = e(this.#l);
1211
+ return gt([...o.values()], this.#t.t);
1212
+ }, this.#e = r, this.#n = o, this.#d = i, this.#l = a, this.#t = s;
1213
+ let c = e(this.#u, (e) => e.actions), l = e(this.#u, (e) => e.catalogs);
1214
+ this.#c = n((e) => {
1215
+ let t = vt(e(i.$.selection)), n = e(this.#u);
719
1216
  if (t == null) return { authorizationPending: !1 };
720
1217
  let r = n.actions[t.actionId], a = r == null ? void 0 : n.catalogs[r.serviceId], o = t.connectionId == null ? void 0 : a?.byId.get(t.connectionId);
721
1218
  return o == null && r?.defaultConnection?.connectionId == t.connectionId && (o = r.defaultConnection), {
@@ -727,148 +1224,148 @@ var ye = class {
727
1224
  connectionError: r != null && n.connectionError?.serviceId == r.serviceId ? n.connectionError.message : void 0
728
1225
  };
729
1226
  }), this.$ = {
730
- actionLoading: e(this.#l, (e) => e.actionLoading),
1227
+ actionLoading: e(this.#u, (e) => e.actionLoading),
731
1228
  actions: c,
732
- catalogs: u,
733
- connectionLoading: e(this.#l, (e) => e.connectionLoading),
734
- selectedAction: e(this.#s, (e) => e.action),
735
- selectedActionError: e(this.#s, (e) => e.actionError),
736
- selectedActiveConnections: e(this.#s, (e) => e.activeConnections),
737
- selectedAuthorizationPending: e(this.#s, (e) => e.authorizationPending),
738
- selectedConnection: e(this.#s, (e) => e.connection),
739
- selectedConnectionError: e(this.#s, (e) => e.connectionError)
740
- }, this.#o = i.$.revision.reaction(() => void this.#b());
1229
+ catalogs: l,
1230
+ connectionLoading: e(this.#u, (e) => e.connectionLoading),
1231
+ selectedAction: e(this.#c, (e) => e.action),
1232
+ selectedActionError: e(this.#c, (e) => e.actionError),
1233
+ selectedActiveConnections: e(this.#c, (e) => e.activeConnections),
1234
+ selectedAuthorizationPending: e(this.#c, (e) => e.authorizationPending),
1235
+ selectedConnection: e(this.#c, (e) => e.connection),
1236
+ selectedConnectionError: e(this.#c, (e) => e.connectionError)
1237
+ }, this.#o = i.$.flowId.reaction(() => this.reset()), this.#s = i.$.revision.reaction(() => void this.#x());
741
1238
  }
742
1239
  dispose() {
743
- this.#p = !0, this.#a.invalidate(), this.#o();
1240
+ this.#m = !0, this.#a.invalidate(), this.#o(), this.#s();
744
1241
  for (let e of Object.values(this.$)) e.dispose();
745
- this.#s.dispose(), this.#l.dispose();
1242
+ this.#c.dispose(), this.#u.dispose();
746
1243
  }
747
1244
  reset() {
748
- this.#p || (this.#a.invalidate(), this.#d = void 0, this.#r.clear(), this.#f = void 0, this.#i.clear(), this.#l.set(D));
1245
+ this.#m || (this.#a.invalidate(), this.#f = void 0, this.#r.clear(), this.#p = void 0, this.#i.clear(), this.#u.set(mt));
749
1246
  }
750
1247
  async refresh(e = !1) {
751
- if (this.#p) return;
752
- let t = this.#a.begin(), n = this.#u.$.flowId.value, r = A(this.#u.$.selection.value);
1248
+ if (this.#m) return;
1249
+ let t = this.#a.begin(), n = this.#d.$.flowId.value, r = vt(this.#d.$.selection.value);
753
1250
  if (n == null || r == null) {
754
- (this.#l.value.actionLoading != null || this.#l.value.connectionLoading != null) && this.#v({
1251
+ (this.#u.value.actionLoading != null || this.#u.value.connectionLoading != null) && this.#y({
755
1252
  actionLoading: void 0,
756
1253
  connectionLoading: void 0
757
1254
  });
758
1255
  return;
759
1256
  }
760
- this.#v({
1257
+ this.#y({
761
1258
  actionError: void 0,
762
1259
  actionLoading: r.actionId,
763
1260
  connectionError: void 0,
764
1261
  connectionLoading: void 0
765
1262
  });
766
1263
  try {
767
- let i = await this.#m(r.actionId, e);
768
- if (!this.#y(t, n)) return;
769
- this.#v({ actions: {
770
- ...this.#l.value.actions,
1264
+ let i = await this.#h(r.actionId, e);
1265
+ if (!this.#b(t, n)) return;
1266
+ this.#y({ actions: {
1267
+ ...this.#u.value.actions,
771
1268
  [i.actionId]: i
772
- } }), await this.#h(n, r, i.serviceId, e, t);
1269
+ } }), i.authenticated && await this.#g(n, r, i.serviceId, e, t);
773
1270
  } catch (e) {
774
- this.#y(t, n) && this.#v({ actionError: {
1271
+ this.#b(t, n) && this.#y({ actionError: {
775
1272
  actionId: r.actionId,
776
- message: u(e, this.#t.t).message
1273
+ message: B(e, this.#t.t).message
777
1274
  } });
778
1275
  } finally {
779
- this.#y(t, n) && this.#l.value.actionLoading == r.actionId && this.#v({ actionLoading: void 0 });
1276
+ this.#b(t, n) && this.#u.value.actionLoading == r.actionId && this.#y({ actionLoading: void 0 });
780
1277
  }
781
1278
  }
782
1279
  async connect(e) {
783
- if (this.#p) return;
784
- let t = this.#u.$.flowId.value;
1280
+ if (this.#m) return;
1281
+ let t = this.#d.$.flowId.value;
785
1282
  if (t == null) return;
786
- let n = this.#l.value.catalogs[e];
1283
+ let n = this.#u.value.catalogs[e];
787
1284
  try {
788
- if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(e))) {
789
- this.#c({
1285
+ if (!await this.#n.openExternalPage(() => this.#e.createConnectorConnectionPage(e, t))) {
1286
+ this.#l({
790
1287
  kind: "error",
791
1288
  message: this.#t.t("notice.connectionPopupBlocked")
792
1289
  });
793
1290
  return;
794
1291
  }
795
- if (this.#p || t != this.#u.$.flowId.value) return;
796
- this.#d = {
1292
+ if (this.#m || t != this.#d.$.flowId.value) return;
1293
+ this.#f = {
797
1294
  connectionIds: new Set(n?.all.map((e) => e.connectionId)),
798
1295
  serviceId: e
799
- }, this.#v({ authorizationServiceId: e });
1296
+ }, this.#y({ authorizationServiceId: e });
800
1297
  } catch (e) {
801
- this.#p || this.#c(u(e, this.#t.t));
1298
+ this.#m || this.#l(B(e, this.#t.t));
802
1299
  }
803
1300
  }
804
1301
  async setConnection(e, t) {
805
- return await this.#u.setConnectorConnection(e, t);
1302
+ return await this.#d.setConnectorConnection(e, t);
806
1303
  }
807
1304
  async refreshAfterAuthorization() {
808
- if (this.#p || this.#d == null) return;
809
- let e = this.#d.serviceId;
810
- this.#r.delete(e), this.#v({ authorizationServiceId: void 0 }), this.$.selectedAction.value?.serviceId == e && await this.refresh(!0), !this.#p && this.#d?.serviceId == e && (this.#d = void 0);
1305
+ if (this.#m || this.#f == null) return;
1306
+ let e = this.#f.serviceId;
1307
+ this.#r.delete(e), this.#y({ authorizationServiceId: void 0 }), this.$.selectedAction.value?.serviceId == e && await this.refresh(!0), !this.#m && this.#f?.serviceId == e && (this.#f = void 0);
811
1308
  }
812
- async #m(e, t) {
813
- let n = this.#l.value.actions[e];
814
- return !t && n != null ? n : await this.#e.getConnectorAction(e);
1309
+ async #h(e, t) {
1310
+ let n = this.#u.value.actions[e];
1311
+ return !t && n != null ? n : await this.#e.getConnectorAction(e, void 0, this.#d.$.flowId.value);
815
1312
  }
816
- async #h(e, t, n, r, i) {
817
- this.#v({ connectionLoading: n });
1313
+ async #g(e, t, n, r, i) {
1314
+ this.#y({ connectionLoading: n });
818
1315
  try {
819
- let a = await this.#g(e, n, r, i);
820
- if (a == null || !this.#y(i, e)) return;
821
- await this.#_(t, n, a);
1316
+ let a = await this.#_(e, n, r, i);
1317
+ if (a == null || !this.#b(i, e)) return;
1318
+ await this.#v(t, n, a);
822
1319
  } finally {
823
- this.#y(i, e) && this.#l.value.connectionLoading == n && this.#v({ connectionLoading: void 0 });
1320
+ this.#b(i, e) && this.#u.value.connectionLoading == n && this.#y({ connectionLoading: void 0 });
824
1321
  }
825
1322
  }
826
- async #g(e, t, n, r) {
827
- let i = this.#l.value.catalogs[t];
1323
+ async #_(e, t, n, r) {
1324
+ let i = this.#u.value.catalogs[t];
828
1325
  if (!n && i != null) return i;
829
1326
  let a;
830
1327
  try {
831
- a = await this.#e.listConnectorConnections(t);
1328
+ a = await this.#e.listConnectorConnections(t, void 0, e);
832
1329
  } catch (n) {
833
- this.#y(r, e) && this.#v({ connectionError: {
834
- message: u(n, this.#t.t).message,
1330
+ this.#b(r, e) && this.#y({ connectionError: {
1331
+ message: B(n, this.#t.t).message,
835
1332
  serviceId: t
836
1333
  } });
837
1334
  return;
838
1335
  }
839
- if (!this.#y(r, e)) return;
840
- let o = d(a);
841
- return this.#v({ catalogs: {
842
- ...this.#l.value.catalogs,
1336
+ if (!this.#b(r, e)) return;
1337
+ let o = w(a);
1338
+ return this.#y({ catalogs: {
1339
+ ...this.#u.value.catalogs,
843
1340
  [t]: o
844
1341
  } }), o;
845
1342
  }
846
- async #_(e, t, n) {
847
- let r = this.#d?.serviceId == t ? this.#d : void 0, i = r == null ? [] : n.active.filter((e) => !r.connectionIds.has(e.connectionId)), a = i.length == 1 ? i[0] : n.preferred, o = this.#u.$.revision.value?.task(e.taskId);
848
- a != null && this.#u.$.selectedNodeIds.value.includes(e.nodeId) && o != null && "executor" in o && o.executor.kind == "connector" && o.executor.connectionId == null && await this.#u.setConnectorConnection(e.taskId, a.connectionId);
1343
+ async #v(e, t, n) {
1344
+ let r = this.#f?.serviceId == t ? this.#f : void 0, i = r == null ? [] : n.active.filter((e) => !r.connectionIds.has(e.connectionId)), a = i.length == 1 ? i[0] : n.preferred, o = this.#d.$.revision.value?.task(e.taskId);
1345
+ a != null && this.#d.$.selectedNodeIds.value.includes(e.nodeId) && o != null && "executor" in o && o.executor.kind == "connector" && o.executor.connectionId == null && await this.#d.setConnectorConnection(e.taskId, a.connectionId);
849
1346
  }
850
- #v(e) {
851
- this.#p || this.#l.set({
852
- ...this.#l.value,
1347
+ #y(e) {
1348
+ this.#m || this.#u.set({
1349
+ ...this.#u.value,
853
1350
  ...e
854
1351
  });
855
1352
  }
856
- #y(e, t) {
857
- return !this.#p && e() && t == this.#u.$.flowId.value;
1353
+ #b(e, t) {
1354
+ return !this.#m && e() && t == this.#d.$.flowId.value;
858
1355
  }
859
- async #b() {
860
- if (this.#p) return;
861
- let e = this.#a.capture(), t = this.#u.$.flowId.value, n = this.#u.$.revision.value;
1356
+ async #x() {
1357
+ if (this.#m) return;
1358
+ let e = this.#a.capture(), t = this.#d.$.flowId.value, n = this.#d.$.revision.value;
862
1359
  if (t == null || n == null) return;
863
- let r = [...n.connectorActionIds].filter((e) => this.#l.value.actions[e] == null && !this.#i.has(e));
1360
+ let r = [...n.connectorActionIds].filter((e) => this.#u.value.actions[e] == null && !this.#i.has(e));
864
1361
  if (r.length != 0) {
865
1362
  for (let e of r) this.#i.add(e);
866
1363
  try {
867
- let n = await Promise.all(r.map((e) => this.#e.getConnectorAction(e)));
868
- if (!this.#y(e, t)) return;
869
- let i = { ...this.#l.value.actions };
1364
+ let n = await Promise.all(r.map((e) => this.#e.getConnectorAction(e, void 0, t)));
1365
+ if (!this.#b(e, t)) return;
1366
+ let i = { ...this.#u.value.actions };
870
1367
  for (let e of n) i[e.actionId] = e;
871
- this.#v({ actions: i });
1368
+ this.#y({ actions: i });
872
1369
  } catch {
873
1370
  return;
874
1371
  } finally {
@@ -876,8 +1373,8 @@ var ye = class {
876
1373
  }
877
1374
  }
878
1375
  }
879
- }, j = { catalogs: {} }, M = 4, N = "trigger:";
880
- function P(e, t) {
1376
+ }, bt = { catalogs: {} }, xt = "trigger:";
1377
+ function Y(e, t) {
881
1378
  if (e?.kind != "trigger") return;
882
1379
  let n = e.trigger;
883
1380
  if (n.kind != "poll" && n.kind != "integration") return;
@@ -888,11 +1385,11 @@ function P(e, t) {
888
1385
  triggerId: e.id
889
1386
  };
890
1387
  }
891
- function F(e, t, n, r) {
1388
+ function St(e, t) {
892
1389
  return {
893
- description: n,
894
- group: r,
895
- id: `trigger:${e.key}:${t}`,
1390
+ description: t.t("addNode.triggerNeedsConnection", { provider: e.provider }),
1391
+ group: t.t("addNode.triggers"),
1392
+ id: `${xt}${e.key}`,
896
1393
  inputs: [],
897
1394
  kind: "trigger",
898
1395
  label: e.displayName,
@@ -901,59 +1398,12 @@ function F(e, t, n, r) {
901
1398
  jsonSchema: e.payloadSchema
902
1399
  }],
903
1400
  trigger: {
904
- connectionId: t,
905
1401
  definition: e,
906
1402
  kind: "catalog"
907
1403
  }
908
1404
  };
909
1405
  }
910
- function I(e, t) {
911
- return {
912
- choices: [],
913
- description: t.t("addNode.triggerChooseConnection"),
914
- group: t.t("addNode.triggers"),
915
- id: `${N}${e.key}`,
916
- inputs: [],
917
- kind: "trigger",
918
- label: e.displayName,
919
- outputs: []
920
- };
921
- }
922
- function L(e, t, n) {
923
- let r = n.t("addNode.triggers"), i = t.preferred;
924
- return i == null ? t.active.length > 0 ? t.active.map((t) => F(e, t.connectionId, t.displayName, r)) : [{
925
- description: n.t("addNode.triggerNeedsConnection", { provider: e.provider }),
926
- group: r,
927
- id: `${N}${e.key}:connect`,
928
- inputs: [],
929
- kind: "trigger",
930
- label: n.t("addNode.triggerAddConnection"),
931
- outputs: [],
932
- trigger: {
933
- kind: "connect",
934
- provider: e.provider
935
- }
936
- }] : [F(e, i.connectionId, i.displayName, r)];
937
- }
938
- function be(e, t, n) {
939
- let r = t.preferred;
940
- if (r != null) return F(e, r.connectionId, r.displayName, n.t("addNode.triggers"));
941
- let i = I(e, n), a = L(e, t, n);
942
- return {
943
- ...i,
944
- description: t.active.length == 0 ? n.t("addNode.triggerNeedsConnection", { provider: e.provider }) : i.description,
945
- outputs: t.active.length == 0 ? [] : [{
946
- handle: "payload",
947
- jsonSchema: e.payloadSchema
948
- }],
949
- choices: a.map((n) => ({
950
- description: t.active.length == 0 ? e.provider : void 0,
951
- label: n.label,
952
- option: n
953
- }))
954
- };
955
- }
956
- var xe = class {
1406
+ var Ct = class {
957
1407
  #e;
958
1408
  #t;
959
1409
  #n;
@@ -965,52 +1415,28 @@ var xe = class {
965
1415
  #c;
966
1416
  #l;
967
1417
  #u;
968
- constructor(r, i, a, o, s = l()) {
969
- this.#t = new AbortController(), this.#a = new x(), this.#c = t(j), this.#u = !1, this.browseAddNodeOptions = async (e) => {
1418
+ constructor(r, i, a, o, s = E()) {
1419
+ this.#t = new AbortController(), this.#a = new x(), this.#c = t(bt), this.#u = !1, this.browseAddNodeOptions = async (e) => {
970
1420
  let t = this.#l.$.flowId.value;
971
1421
  if (e.aborted || this.#u || t == null || this.#l.$.target.value?.kind != "flow") return [];
972
1422
  let n = await this.#d();
973
- if (!(e.aborted || this.#u || t != this.#l.$.flowId.value)) return [...n.values()].map((e) => I(e, this.#i));
1423
+ if (!(e.aborted || this.#u || t != this.#l.$.flowId.value)) return [...n.values()].map((e) => St(e, this.#i));
974
1424
  }, this.provideAddNodeOptions = async (e, t) => {
975
1425
  let n = this.#l.$.flowId.value;
976
1426
  if (t.aborted || this.#u || n == null || this.#l.$.target.value?.kind != "flow") return [];
977
1427
  let r = e.trim().toLowerCase();
978
1428
  if (r.length == 0) return [];
979
1429
  let i = await this.#d();
980
- if (t.aborted || this.#u || n != this.#l.$.flowId.value) return;
981
- let a = [...i.values()].filter((e) => [
1430
+ if (!(t.aborted || this.#u || n != this.#l.$.flowId.value)) return [...i.values()].filter((e) => [
982
1431
  e.description,
983
1432
  e.displayName,
984
1433
  e.key,
985
1434
  e.name,
986
1435
  e.provider,
987
1436
  e.type
988
- ].some((e) => e.toLowerCase().includes(r))), o = [...new Set(a.map((e) => e.provider))].filter((e) => this.#c.value.catalogs[e] == null);
989
- for (let e = 0; e < o.length; e += M) {
990
- let r = await Promise.all(o.slice(e, e + M).map(async (e) => [e, d(await this.#n.listConnectorConnections(e, t))]));
991
- if (t.aborted || this.#u || n != this.#l.$.flowId.value) return;
992
- this.#f({ catalogs: {
993
- ...this.#c.value.catalogs,
994
- ...Object.fromEntries(r)
995
- } });
996
- }
997
- return a.map((e) => be(e, this.#c.value.catalogs[e.provider], this.#i));
998
- }, this.provideAddNodeOptionChoices = async (e, t) => {
999
- let n = this.#l.$.flowId.value, r = e.startsWith(N) ? e.slice(8) : void 0;
1000
- if (t.aborted || this.#u || n == null || r == null || this.#l.$.target.value?.kind != "flow") return;
1001
- let i = (await this.#d()).get(r);
1002
- if (t.aborted || this.#u || n != this.#l.$.flowId.value || i == null) return;
1003
- let a = this.#c.value.catalogs[i.provider];
1004
- if (a == null) {
1005
- if (a = d(await this.#n.listConnectorConnections(i.provider, t)), t.aborted || this.#u || n != this.#l.$.flowId.value) return;
1006
- this.#f({ catalogs: {
1007
- ...this.#c.value.catalogs,
1008
- [i.provider]: a
1009
- } });
1010
- }
1011
- return L(i, a, this.#i);
1437
+ ].some((e) => e.toLowerCase().includes(r))).map((e) => St(e, this.#i));
1012
1438
  }, this.#n = r, this.#r = o, this.#i = s, this.#s = a, this.#l = i, this.#o = n((e) => {
1013
- let t = e(i.$.selection), n = P(t, i), r = e(this.#c);
1439
+ let t = e(i.$.selection), n = Y(t, i), r = e(this.#c);
1014
1440
  if (t?.kind != "trigger") return { authorizationPending: !1 };
1015
1441
  let a = t.trigger;
1016
1442
  if (a.kind != "poll" && a.kind != "integration") return { authorizationPending: !1 };
@@ -1037,10 +1463,10 @@ var xe = class {
1037
1463
  this.#o.dispose(), this.#c.dispose();
1038
1464
  }
1039
1465
  reset() {
1040
- this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(j));
1466
+ this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(bt));
1041
1467
  }
1042
1468
  async refresh(e = !1) {
1043
- let t = this.#a.begin(), n = this.#l.$.flowId.value, r = P(this.#l.$.selection.value, this.#l);
1469
+ let t = this.#a.begin(), n = this.#l.$.flowId.value, r = Y(this.#l.$.selection.value, this.#l);
1044
1470
  if (!this.#u) {
1045
1471
  if (n == null || r == null) {
1046
1472
  this.#c.value.connectionLoading != null && this.#f({ connectionLoading: void 0 });
@@ -1052,7 +1478,7 @@ var xe = class {
1052
1478
  connectionLoading: r.provider
1053
1479
  });
1054
1480
  try {
1055
- let e = d(await this.#n.listConnectorConnections(r.provider));
1481
+ let e = w(await this.#n.listConnectorConnections(r.provider, void 0, n));
1056
1482
  if (!this.#p(t, n)) return;
1057
1483
  this.#f({ catalogs: {
1058
1484
  ...this.#c.value.catalogs,
@@ -1060,7 +1486,7 @@ var xe = class {
1060
1486
  } });
1061
1487
  } catch (e) {
1062
1488
  this.#p(t, n) && this.#f({ connectionError: {
1063
- message: u(e, this.#i.t).message,
1489
+ message: B(e, this.#i.t).message,
1064
1490
  provider: r.provider
1065
1491
  } });
1066
1492
  } finally {
@@ -1072,7 +1498,7 @@ var xe = class {
1072
1498
  async connect(e) {
1073
1499
  let t = this.#l.$.flowId.value;
1074
1500
  if (!(this.#u || t == null)) try {
1075
- if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(e))) {
1501
+ if (!await this.#r.openExternalPage(() => this.#n.createConnectorConnectionPage(e, t))) {
1076
1502
  this.#s({
1077
1503
  kind: "error",
1078
1504
  message: this.#i.t("notice.connectionPopupBlocked")
@@ -1081,7 +1507,7 @@ var xe = class {
1081
1507
  }
1082
1508
  !this.#u && t == this.#l.$.flowId.value && this.#f({ authorizationProvider: e });
1083
1509
  } catch (e) {
1084
- this.#u || this.#s(u(e, this.#i.t));
1510
+ this.#u || this.#s(B(e, this.#i.t));
1085
1511
  }
1086
1512
  }
1087
1513
  async setConnection(e, t) {
@@ -1097,7 +1523,7 @@ var xe = class {
1097
1523
  delete t[e], this.#f({
1098
1524
  authorizationProvider: void 0,
1099
1525
  catalogs: t
1100
- }), P(this.#l.$.selection.value, this.#l)?.provider == e && await this.refresh(!0);
1526
+ }), Y(this.#l.$.selection.value, this.#l)?.provider == e && await this.refresh(!0);
1101
1527
  }
1102
1528
  #d() {
1103
1529
  if (this.#e != null) return this.#e;
@@ -1117,883 +1543,19 @@ var xe = class {
1117
1543
  }
1118
1544
  };
1119
1545
  //#endregion
1120
- //#region src/flow/common/edgeChanges.ts
1121
- function R(e, t, n) {
1122
- let r = {
1123
- source: n.source,
1124
- sourceHandle: n.sourceHandle,
1125
- target: n.target,
1126
- targetHandle: n.targetHandle
1127
- }, i = z(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
1128
- return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
1129
- edge: r,
1130
- kind: "graph.edge.connect",
1131
- target: t
1132
- }];
1133
- }
1134
- function Se(e, t, n) {
1135
- let r = {
1136
- source: n.source,
1137
- sourceHandle: n.sourceHandle,
1138
- target: n.target,
1139
- targetHandle: n.targetHandle
1140
- }, i = z(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
1141
- return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
1142
- edge: r,
1143
- kind: "graph.edge.disconnect",
1144
- target: t
1145
- }];
1146
- }
1147
- function z(e, t) {
1148
- return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
1149
- }
1150
- //#endregion
1151
- //#region src/flow/common/moduleChanges.ts
1152
- async function Ce(e) {
1153
- try {
1154
- let { parse: t } = await import("./lib-GrGxYjsJ.js"), n = t(e, {
1155
- errorRecovery: !0,
1156
- sourceType: "module"
1157
- }).program, r = /* @__PURE__ */ new Set();
1158
- for (let e of n.body) {
1159
- if (e.type != "ImportDeclaration") continue;
1160
- let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
1161
- t?.[1] != null && r.add(t[1]);
1162
- }
1163
- return [...r].toSorted();
1164
- } catch {
1165
- return [];
1166
- }
1167
- }
1168
- function we(e, t, n) {
1169
- return [{
1170
- imports: n,
1171
- kind: "module.source.replace",
1172
- moduleId: e,
1173
- source: t
1174
- }];
1175
- }
1176
- //#endregion
1177
- //#region src/flow/common/nodeChanges.ts
1178
- function Te(e, t, n, r = {
1179
- imports: [],
1180
- source: "export default function run(input) {\n return { result: input.value }\n}\n"
1181
- }, i = {
1182
- inputs: [{
1183
- handle: "value",
1184
- jsonSchema: {},
1185
- nullable: !0,
1186
- value: null
1187
- }],
1188
- outputs: [{
1189
- handle: "result",
1190
- jsonSchema: {},
1191
- nullable: !0
1192
- }]
1193
- }) {
1194
- return [{
1195
- kind: "module.create",
1196
- module: {
1197
- ...r,
1198
- name: n
1199
- },
1200
- moduleId: t.moduleId
1201
- }, {
1202
- kind: "graph.node.create",
1203
- node: {
1204
- concurrency: 1,
1205
- inputs: U(i.inputs),
1206
- kind: "task",
1207
- name: n,
1208
- task: {
1209
- inputs: i.inputs,
1210
- moduleId: t.moduleId,
1211
- name: n,
1212
- outputs: i.outputs
1213
- }
1214
- },
1215
- nodeId: t.nodeId,
1216
- target: e
1217
- }];
1218
- }
1219
- function B(e, t, n) {
1220
- return [{
1221
- kind: "task.create",
1222
- task: n,
1223
- taskId: t.taskId
1224
- }, {
1225
- kind: "graph.node.create",
1226
- node: {
1227
- concurrency: 1,
1228
- inputs: U(n.inputs),
1229
- kind: "task",
1230
- name: n.name,
1231
- taskId: t.taskId
1232
- },
1233
- nodeId: t.nodeId,
1234
- target: e
1235
- }];
1236
- }
1237
- function Ee(e, t, n, r, i, a = {}) {
1238
- let o = a.inputs ?? {};
1239
- return B(e, t, {
1240
- executor: {
1241
- kind: "llm",
1242
- mode: r
1243
- },
1244
- inputs: [
1245
- {
1246
- handle: "messages",
1247
- jsonSchema: {
1248
- items: { type: "object" },
1249
- type: "array"
1250
- },
1251
- nullable: !0,
1252
- value: W(o, "messages", null)
1253
- },
1254
- {
1255
- handle: "input",
1256
- jsonSchema: { type: "string" },
1257
- nullable: !1,
1258
- value: W(o, "input", "Alex")
1259
- },
1260
- {
1261
- handle: "template",
1262
- jsonSchema: {
1263
- items: { type: "object" },
1264
- minItems: 1,
1265
- type: "array"
1266
- },
1267
- nullable: !1,
1268
- value: W(o, "template", [{
1269
- content: "Hello, I'm {{input}}",
1270
- role: "user"
1271
- }])
1272
- },
1273
- {
1274
- handle: "model",
1275
- jsonSchema: { type: "object" },
1276
- nullable: !1,
1277
- value: W(o, "model", { model: "deepseek-v4-flash" })
1278
- }
1279
- ],
1280
- name: n,
1281
- outputs: [{
1282
- ...a.output,
1283
- description: a.output?.description ?? i,
1284
- handle: "output",
1285
- jsonSchema: a.output?.jsonSchema ?? (r == "chat" ? { type: "string" } : {}),
1286
- nullable: a.output?.nullable ?? !1
1287
- }]
1288
- });
1289
- }
1290
- function De(e, t, n) {
1291
- return [{
1292
- kind: "graph.node.create",
1293
- node: {
1294
- cases: [{
1295
- expressions: [{
1296
- input: "value",
1297
- operator: "isTrue"
1298
- }],
1299
- output: "true",
1300
- relation: "all"
1301
- }],
1302
- concurrency: 1,
1303
- defaultOutput: "false",
1304
- input: {
1305
- handle: "value",
1306
- jsonSchema: {},
1307
- nullable: !0,
1308
- value: null
1309
- },
1310
- inputs: { value: {
1311
- kind: "value",
1312
- value: null
1313
- } },
1314
- kind: "condition",
1315
- name: n
1316
- },
1317
- nodeId: t,
1318
- target: e
1319
- }];
1320
- }
1321
- function Oe(e, t, n) {
1322
- return [{
1323
- kind: "graph.node.create",
1324
- node: {
1325
- concurrency: 1,
1326
- inputs: {},
1327
- kind: "value",
1328
- name: n,
1329
- values: [{
1330
- handle: "value",
1331
- jsonSchema: {},
1332
- nullable: !0,
1333
- value: null
1334
- }]
1335
- },
1336
- nodeId: t,
1337
- target: e
1338
- }];
1339
- }
1340
- function V(e, t, n) {
1341
- return [{
1342
- kind: "graph.node.create",
1343
- node: n,
1344
- nodeId: t,
1345
- target: e
1346
- }];
1347
- }
1348
- function ke(e, t, n, r) {
1349
- let i = r.name ?? n.displayName, a = n.type == "poll" ? {
1350
- bindingId: t.bindingId,
1351
- config: r.config,
1352
- definition: n,
1353
- kind: "poll",
1354
- name: i,
1355
- pollTimes: r.schedule ?? [{
1356
- type: "every",
1357
- unit: "minute",
1358
- value: 5
1359
- }]
1360
- } : {
1361
- bindingId: t.bindingId,
1362
- config: r.config,
1363
- definition: n,
1364
- kind: "integration",
1365
- name: i
1366
- };
1367
- return [{
1368
- binding: {
1369
- kind: "connection",
1370
- target: r.connectionId
1371
- },
1372
- bindingId: t.bindingId,
1373
- kind: "binding.create"
1374
- }, {
1375
- kind: "graph.node.create",
1376
- node: a,
1377
- nodeId: t.nodeId,
1378
- target: e
1379
- }];
1380
- }
1381
- function Ae(e, t, n) {
1382
- let r = H(e, t)?.nodes;
1383
- if (r == null) return [];
1384
- let i = new Set(n), a = n.flatMap((e) => {
1385
- let n = r[e];
1386
- return n == null ? [] : [{
1387
- kind: "graph.node.delete",
1388
- nodeId: e,
1389
- target: t
1390
- }, ...n.kind == "task" && n.task != null ? [{
1391
- kind: "module.delete",
1392
- moduleId: n.task.moduleId
1393
- }] : []];
1394
- });
1395
- if (t.kind == "subflow") return a;
1396
- let o = new Set(n.flatMap((e) => {
1397
- let t = r[e];
1398
- return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
1399
- }));
1400
- for (let t of o) Object.entries(e.document.graph.nodes).some(([e, n]) => !i.has(e) && (n.kind == "poll" || n.kind == "integration") && n.bindingId == t) || a.push({
1401
- bindingId: t,
1402
- kind: "binding.delete"
1403
- });
1404
- return a;
1405
- }
1406
- function je(e, t, n, r) {
1407
- let i = H(e, t)?.nodes[n];
1408
- if (i == null || !("inputs" in i)) return;
1409
- let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
1410
- return G(t, n, {
1411
- ...c,
1412
- ...r
1413
- });
1414
- }
1415
- function Me(e, t, n, r, i) {
1416
- return Ne(e, t, n, { [r]: i });
1417
- }
1418
- function Ne(e, t, n, r) {
1419
- let i = H(e, t)?.nodes[n];
1420
- if (i == null || !("inputs" in i)) return;
1421
- let a = { ...i.inputs };
1422
- for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
1423
- kind: "value",
1424
- value: t
1425
- };
1426
- return G(t, n, {
1427
- ...i,
1428
- inputs: a
1429
- });
1430
- }
1431
- function Pe(e, t, n) {
1432
- let r = e.document.tasks[t];
1433
- if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
1434
- kind: "task.replace",
1435
- task: {
1436
- ...r,
1437
- executor: {
1438
- ...r.executor,
1439
- connectionId: n
1440
- }
1441
- },
1442
- taskId: t
1443
- }];
1444
- }
1445
- function Fe(e, t, n, r) {
1446
- let i = e.document.graph.nodes[n];
1447
- if (i == null) return;
1448
- let a = {
1449
- ...r.description == null ? {} : { description: r.description },
1450
- icon: i.icon,
1451
- name: r.name
1452
- }, o;
1453
- switch (r.kind) {
1454
- case "webhook":
1455
- if (i.kind != "webhook") return;
1456
- o = Object.keys(r.options).length == 0 ? {
1457
- ...a,
1458
- inputsDef: r.inputs,
1459
- kind: "webhook"
1460
- } : {
1461
- ...a,
1462
- inputsDef: r.inputs,
1463
- kind: "webhook",
1464
- options: r.options
1465
- };
1466
- break;
1467
- case "cron":
1468
- if (i.kind != "cron") return;
1469
- o = {
1470
- ...a,
1471
- cronTimes: r.schedule,
1472
- kind: "cron"
1473
- };
1474
- break;
1475
- case "poll":
1476
- if (i.kind != "poll") return;
1477
- o = {
1478
- ...i,
1479
- ...a,
1480
- config: r.config,
1481
- pollTimes: r.schedule
1482
- };
1483
- break;
1484
- case "integration":
1485
- if (i.kind != "integration") return;
1486
- o = {
1487
- ...i,
1488
- ...a,
1489
- config: r.config
1490
- };
1491
- }
1492
- return G(t, n, o);
1493
- }
1494
- function Ie(e, t, n, r, i) {
1495
- let a = e.document.graph.nodes[n];
1496
- if (a == null || a.kind != "integration" && a.kind != "poll") return;
1497
- let o = { ...a.config };
1498
- return i === void 0 ? delete o[r] : o[r] = i, G(t, n, {
1499
- ...a,
1500
- config: o
1501
- });
1502
- }
1503
- function Le(e, t, n, r) {
1504
- let i = e.document.graph.nodes[n];
1505
- if (i != null) switch (i.kind) {
1506
- case "cron": return G(t, n, {
1507
- ...i,
1508
- cronTimes: r
1509
- });
1510
- case "poll": return G(t, n, {
1511
- ...i,
1512
- pollTimes: r
1513
- });
1514
- case "integration":
1515
- case "webhook": return;
1516
- default: return;
1517
- }
1518
- }
1519
- function Re(e, t, n, r) {
1520
- let i = e.document.graph.nodes[n];
1521
- if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
1522
- binding: {
1523
- kind: "connection",
1524
- target: r
1525
- },
1526
- bindingId: i.bindingId,
1527
- kind: "binding.replace"
1528
- }];
1529
- }
1530
- function H(e, t) {
1531
- return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
1532
- }
1533
- function U(e) {
1534
- return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
1535
- kind: "value",
1536
- value: e.value
1537
- }]] : []));
1538
- }
1539
- function W(e, t, n) {
1540
- return e != null && Object.hasOwn(e, t) ? e[t] : n;
1541
- }
1542
- function G(e, t, n) {
1543
- return [{
1544
- kind: "graph.node.replace",
1545
- node: n,
1546
- nodeId: t,
1547
- target: e
1548
- }];
1549
- }
1550
- //#endregion
1551
- //#region src/workbench/browser/runtime/designer/flowChanges.ts
1552
- function K(e, t) {
1553
- return {
1554
- ...e,
1555
- content: i(e.content, t)
1556
- };
1557
- }
1558
- function ze(e, t) {
1559
- return [{
1560
- kind: "subflow.create",
1561
- subflow: {
1562
- graph: { nodes: {} },
1563
- inputs: [{
1564
- handle: "value",
1565
- jsonSchema: {},
1566
- nullable: !0,
1567
- value: null
1568
- }],
1569
- name: t,
1570
- outputs: [{
1571
- handle: "result",
1572
- jsonSchema: {},
1573
- nullable: !0,
1574
- sources: [{
1575
- input: "value",
1576
- kind: "flow"
1577
- }]
1578
- }]
1579
- },
1580
- subflowId: e
1581
- }];
1582
- }
1583
- function Be(e, t, n, r, i) {
1584
- switch (r.kind) {
1585
- case "code": return Te(t, {
1586
- moduleId: i(),
1587
- nodeId: n
1588
- }, r.name);
1589
- case "llm": return Ee(t, {
1590
- nodeId: n,
1591
- taskId: i()
1592
- }, r.name, r.mode, r.outputDescription);
1593
- case "connector": return B(t, {
1594
- nodeId: n,
1595
- taskId: i()
1596
- }, {
1597
- executor: {
1598
- action: r.action.actionId,
1599
- ...r.action.defaultConnection == null ? {} : { connectionId: r.action.defaultConnection.connectionId },
1600
- kind: "connector"
1601
- },
1602
- inputs: Object.entries(r.action.inputs).map(([e, t]) => Object.assign({ handle: e }, t)),
1603
- name: r.action.name,
1604
- outputs: Object.entries(r.action.outputs).map(([e, t]) => Object.assign({ handle: e }, t))
1605
- });
1606
- case "condition": return De(t, n, r.name);
1607
- case "value": return Oe(t, n, r.name);
1608
- case "subflow": {
1609
- let i = e.subflow(r.subflowId);
1610
- return i == null ? void 0 : tt(t, n, r.subflowId, i.inputs);
1611
- }
1612
- case "webhook": return t.kind == "flow" ? V(t, n, {
1613
- inputsDef: [],
1614
- kind: "webhook",
1615
- name: r.name
1616
- }) : void 0;
1617
- case "cron": return t.kind == "flow" ? V(t, n, {
1618
- cronTimes: [{
1619
- type: "every",
1620
- unit: "hour",
1621
- value: 1
1622
- }],
1623
- kind: "cron",
1624
- name: r.name
1625
- }) : void 0;
1626
- case "provider-trigger": return t.kind == "flow" ? ke(t, {
1627
- bindingId: i(),
1628
- nodeId: n
1629
- }, r.definition, {
1630
- config: {},
1631
- connectionId: r.connectionId
1632
- }) : void 0;
1633
- }
1634
- }
1635
- function Ve(e, t, n) {
1636
- return Ae(e.revision.content, t, n);
1637
- }
1638
- function He(e, t, n) {
1639
- let r = e.graph(t)?.nodes ?? {}, i = Object.fromEntries(n.flatMap((e) => r[e] == null ? [] : [[e, r[e]]]));
1640
- return {
1641
- modules: Object.fromEntries(Object.values(i).flatMap((t) => {
1642
- if (t.kind != "task" || t.task == null) return [];
1643
- let n = e.revision.content.modules[t.task.moduleId];
1644
- return n == null ? [] : [[t.task.moduleId, n]];
1645
- })),
1646
- nodes: i
1647
- };
1648
- }
1649
- function Ue(e, t, n, r) {
1650
- if (e.graph(t) == null) return {
1651
- changes: [],
1652
- nodeIds: [],
1653
- sourceIds: []
1654
- };
1655
- let i = Object.entries(n.nodes).filter(([, e]) => (t.kind == "flow" || "inputs" in e) && (e.kind != "task" || e.task == null || n.modules[e.task.moduleId] != null)), a = i.map(([e]) => e), o = new Map(a.map((e) => [e, r()])), s = [];
1656
- for (let [a, c] of i) {
1657
- let i = o.get(a);
1658
- if (!("inputs" in c)) {
1659
- if (c.kind == "poll" || c.kind == "integration") {
1660
- let n = e.binding(c.bindingId);
1661
- if (n == null) continue;
1662
- let a = r();
1663
- s.push({
1664
- binding: n,
1665
- bindingId: a,
1666
- kind: "binding.create"
1667
- }), s.push({
1668
- kind: "graph.node.create",
1669
- node: {
1670
- ...c,
1671
- bindingId: a,
1672
- name: `${c.name} copy`
1673
- },
1674
- nodeId: i,
1675
- target: t
1676
- });
1677
- } else s.push({
1678
- kind: "graph.node.create",
1679
- node: {
1680
- ...c,
1681
- name: `${c.name} copy`
1682
- },
1683
- nodeId: i,
1684
- target: t
1685
- });
1686
- continue;
1687
- }
1688
- let l = {};
1689
- for (let [e, t] of Object.entries(c.inputs)) {
1690
- if (t.kind == "value") {
1691
- l[e] = t;
1692
- continue;
1693
- }
1694
- let n = [];
1695
- for (let e of t.sources) {
1696
- if (e.kind != "node") {
1697
- n.push(e);
1698
- continue;
1699
- }
1700
- let t = o.get(e.nodeId);
1701
- t != null && n.push({
1702
- ...e,
1703
- nodeId: t
1704
- });
1705
- }
1706
- n.length > 0 && (l[e] = {
1707
- kind: "sources",
1708
- sources: n
1709
- });
1710
- }
1711
- let u = {
1712
- ...c,
1713
- inputs: l,
1714
- ...c.name == null ? {} : { name: `${c.name} copy` }
1715
- };
1716
- if (c.kind == "task" && c.task != null) {
1717
- let e = r(), t = n.modules[c.task.moduleId];
1718
- s.push({
1719
- kind: "module.create",
1720
- module: {
1721
- ...t,
1722
- name: `${t.name} copy`
1723
- },
1724
- moduleId: e
1725
- }), u = {
1726
- ...c,
1727
- inputs: l,
1728
- ...c.name == null ? {} : { name: `${c.name} copy` },
1729
- task: {
1730
- ...c.task,
1731
- moduleId: e,
1732
- name: `${c.task.name} copy`
1733
- }
1734
- };
1735
- }
1736
- s.push({
1737
- kind: "graph.node.create",
1738
- node: u,
1739
- nodeId: i,
1740
- target: t
1741
- });
1742
- }
1743
- return {
1744
- changes: s,
1745
- nodeIds: [...o.values()],
1746
- sourceIds: a
1747
- };
1748
- }
1749
- function We(e, t, n, r) {
1750
- return je(e.revision.content, t, n, r);
1751
- }
1752
- function Ge(e, t, n, r) {
1753
- let i = e.node(t, n)?.node;
1754
- if (i == null) return;
1755
- let { description: a, ...o } = i;
1756
- return Y(t, n, r == null ? o : {
1757
- ...o,
1758
- description: r
1759
- });
1760
- }
1761
- function Ke(e, t, n, r) {
1762
- let i = e.node(t, n)?.node;
1763
- if (i == null) return;
1764
- let { icon: a, ...o } = i;
1765
- return Y(t, n, r == null ? o : {
1766
- ...o,
1767
- icon: r
1768
- });
1769
- }
1770
- function qe(e, t, n, r) {
1771
- let i = e.node(t, n)?.node;
1772
- if (i == null) return;
1773
- if (!("inputs" in i)) return Y(t, n, {
1774
- ...i,
1775
- name: r ?? i.name
1776
- });
1777
- let { name: a, ...o } = i;
1778
- return Y(t, n, r == null ? o : {
1779
- ...o,
1780
- name: r
1781
- });
1782
- }
1783
- function Je(e, t, n, r, i) {
1784
- return Me(e.revision.content, t, n, r, i);
1785
- }
1786
- function Ye(e, t, n, r) {
1787
- let i = e.graph(t), a = i?.nodes[n];
1788
- if (i == null || a?.kind != "condition") return;
1789
- let o = Object.fromEntries([...a.cases.map((e) => [e.output, !0]), ...a.defaultOutput == null ? [] : [[a.defaultOutput, !0]]]), s = Object.fromEntries([...r.cases.map((e) => [e.output, !0]), ...r.defaultOutput == null ? [] : [[r.defaultOutput, !0]]]), c = a.input.handle == r.input.handle ? void 0 : [a.input.handle, r.input.handle], l = q(Object.keys(o).map((e) => ({ handle: e })), Object.keys(s).map((e) => ({ handle: e }))), u = new Set(Object.keys(s)), d = [];
1790
- for (let [e, o] of Object.entries(i.nodes)) {
1791
- if (!("inputs" in o)) continue;
1792
- let i = e == n, s = { ...o.inputs };
1793
- if (e == n) {
1794
- c != null && Object.hasOwn(s, c[0]) && (s[c[1]] = s[c[0]], delete s[c[0]]);
1795
- for (let e of Object.keys(s)) e != r.input.handle && delete s[e];
1796
- }
1797
- for (let [e, t] of Object.entries(s)) {
1798
- if (t.kind != "sources") continue;
1799
- let r = t.sources.flatMap((e) => e.kind != "node" || e.nodeId != n ? [e] : l != null && e.output == l[0] ? [{
1800
- ...e,
1801
- output: l[1]
1802
- }] : u.has(e.output) ? [e] : []);
1803
- r.length == t.sources.length && r.every((e, n) => e === t.sources[n]) || (i = !0, r.length == 0 ? delete s[e] : s[e] = {
1804
- kind: "sources",
1805
- sources: r
1806
- });
1807
- }
1808
- if (i) {
1809
- if (e == n) {
1810
- let { defaultOutput: n, ...i } = a;
1811
- d.push({
1812
- kind: "graph.node.replace",
1813
- node: {
1814
- ...i,
1815
- ...r,
1816
- inputs: s
1817
- },
1818
- nodeId: e,
1819
- target: t
1820
- });
1821
- } else d.push({
1822
- kind: "graph.node.replace",
1823
- node: {
1824
- ...o,
1825
- inputs: s
1826
- },
1827
- nodeId: e,
1828
- target: t
1829
- });
1830
- }
1831
- }
1832
- return d;
1833
- }
1834
- function Xe(e, t, n, r) {
1835
- let i = e.node(t, n)?.node;
1836
- if (i?.kind == "value") return Y(t, n, {
1837
- ...i,
1838
- values: r.map((e) => ({
1839
- handle: e.handle,
1840
- ...e.description == null ? {} : { description: e.description },
1841
- jsonSchema: e.jsonSchema ?? {},
1842
- nullable: e.nullable ?? !1,
1843
- ...Object.hasOwn(e, "value") ? { value: e.value } : {}
1844
- }))
1845
- });
1846
- }
1847
- function Ze(e, t, n, r) {
1848
- let i = e.graph(t)?.nodes[n];
1849
- if (i?.kind == "task") switch (r.kind) {
1850
- case "code": return i.task == null ? void 0 : J(e, t, n, {
1851
- ...i.task,
1852
- name: r.name
1853
- });
1854
- case "llm": {
1855
- if (i.task != null) return;
1856
- let t = e.task(i.taskId);
1857
- return t?.executor.kind == "llm" ? [{
1858
- kind: "task.replace",
1859
- task: {
1860
- executor: {
1861
- kind: "llm",
1862
- mode: r.mode
1863
- },
1864
- inputs: t.inputs,
1865
- name: r.name,
1866
- outputs: t.outputs
1867
- },
1868
- taskId: i.taskId
1869
- }] : void 0;
1870
- }
1871
- case "connector": {
1872
- if (i.task != null) return;
1873
- let t = e.task(i.taskId);
1874
- return t?.executor.kind == "connector" ? [{
1875
- kind: "task.replace",
1876
- task: {
1877
- ...t,
1878
- name: r.name
1879
- },
1880
- taskId: i.taskId
1881
- }] : void 0;
1882
- }
1883
- }
1884
- }
1885
- function Qe(e, t, n, r) {
1886
- let i = e.graph(t)?.nodes[n];
1887
- if (i?.kind == "task" && i.task != null) return J(e, t, n, {
1888
- ...i.task,
1889
- ...r
1890
- });
1891
- }
1892
- function $e(e, t, n, r) {
1893
- let i = e.trigger(n);
1894
- if (i == null || i.kind != "webhook") return;
1895
- let { options: a, ...o } = i;
1896
- return Y(t, n, Object.keys(r.options).length == 0 ? {
1897
- ...o,
1898
- inputsDef: r.inputs
1899
- } : {
1900
- ...i,
1901
- inputsDef: r.inputs,
1902
- options: r.options
1903
- });
1904
- }
1905
- function et(e, t, n) {
1906
- if (e.subflow(t) != null) return [{
1907
- definition: n,
1908
- kind: "subflow.definition.replace",
1909
- subflowId: t
1910
- }];
1911
- }
1912
- function tt(e, t, n, r) {
1913
- return [{
1914
- kind: "graph.node.create",
1915
- node: {
1916
- concurrency: 1,
1917
- inputs: nt(r),
1918
- kind: "subflow",
1919
- subflowId: n
1920
- },
1921
- nodeId: t,
1922
- target: e
1923
- }];
1924
- }
1925
- function nt(e) {
1926
- return Object.fromEntries(e.flatMap((e) => Object.hasOwn(e, "value") ? [[e.handle, {
1927
- kind: "value",
1928
- value: e.value
1929
- }]] : []));
1930
- }
1931
- function q(e, t) {
1932
- let n = new Set(e.map((e) => e.handle)), r = new Set(t.map((e) => e.handle)), i = [...n].filter((e) => !r.has(e)), a = [...r].filter((e) => !n.has(e));
1933
- return i.length == 1 && a.length == 1 ? [i[0], a[0]] : void 0;
1934
- }
1935
- function J(e, t, n, r) {
1936
- let i = e.graph(t), a = i?.nodes[n];
1937
- if (i == null || a?.kind != "task" || a.task == null) return;
1938
- let o = q(a.task.inputs, r.inputs), s = q(a.task.outputs, r.outputs), c = new Set(r.inputs.map((e) => e.handle)), l = new Set(r.outputs.map((e) => e.handle)), u = [];
1939
- for (let [e, d] of Object.entries(i.nodes)) {
1940
- if (!("inputs" in d)) continue;
1941
- let i = e == n, f = { ...d.inputs };
1942
- if (e == n) {
1943
- o != null && Object.hasOwn(f, o[0]) && (f[o[1]] = f[o[0]], delete f[o[0]]);
1944
- for (let e of Object.keys(f)) c.has(e) || delete f[e];
1945
- }
1946
- for (let [e, t] of Object.entries(f)) {
1947
- if (t.kind != "sources") continue;
1948
- let r = t.sources.flatMap((e) => e.kind != "node" || e.nodeId != n ? [e] : s != null && e.output == s[0] ? [{
1949
- ...e,
1950
- output: s[1]
1951
- }] : l.has(e.output) ? [e] : []);
1952
- r.length == t.sources.length && r.every((e, n) => e === t.sources[n]) || (i = !0, r.length == 0 ? delete f[e] : f[e] = {
1953
- kind: "sources",
1954
- sources: r
1955
- });
1956
- }
1957
- if (!i) continue;
1958
- let p = e == n ? {
1959
- ...a,
1960
- inputs: f,
1961
- task: r
1962
- } : {
1963
- ...d,
1964
- inputs: f
1965
- };
1966
- u.push({
1967
- kind: "graph.node.replace",
1968
- node: p,
1969
- nodeId: e,
1970
- target: t
1971
- });
1972
- }
1973
- return u;
1974
- }
1975
- function Y(e, t, n) {
1976
- return [{
1977
- kind: "graph.node.replace",
1978
- node: n,
1979
- nodeId: t,
1980
- target: e
1981
- }];
1982
- }
1983
- //#endregion
1984
1546
  //#region src/workbench/browser/runtime/designer/remoteChangeTargets.ts
1985
- function rt(e, t) {
1547
+ function wt(e, t) {
1986
1548
  return e.kind == t.kind && (e.kind != "subflow" || t.kind == "subflow" && e.id == t.id);
1987
1549
  }
1988
1550
  function X(e, t, n, r) {
1989
1551
  for (let [i, a] of Object.entries(t.graph(n)?.nodes ?? {})) r(a) && e.add(i);
1990
1552
  }
1991
- function it(e, t, n, r) {
1553
+ function Tt(e, t, n, r) {
1992
1554
  let i = /* @__PURE__ */ new Set();
1993
1555
  for (let a of r) switch (a.kind) {
1994
1556
  case "graph.node.create":
1995
1557
  case "graph.node.replace":
1996
- rt(a.target, n) && i.add(a.nodeId);
1558
+ wt(a.target, n) && i.add(a.nodeId);
1997
1559
  break;
1998
1560
  case "task.replace":
1999
1561
  X(i, e, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId), X(i, t, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId);
@@ -2007,7 +1569,7 @@ function it(e, t, n, r) {
2007
1569
  }
2008
1570
  //#endregion
2009
1571
  //#region src/workbench/browser/runtime/stores/draftChanges.ts
2010
- function at(e) {
1572
+ function Et(e) {
2011
1573
  if (e.length != 1) return;
2012
1574
  let t = e[0];
2013
1575
  switch (t.kind) {
@@ -2020,7 +1582,7 @@ function at(e) {
2020
1582
  default: return;
2021
1583
  }
2022
1584
  }
2023
- var ot = class {
1585
+ var Dt = class {
2024
1586
  #e;
2025
1587
  #t;
2026
1588
  #n;
@@ -2048,15 +1610,15 @@ var ot = class {
2048
1610
  this.#a = e;
2049
1611
  }
2050
1612
  project(e) {
2051
- return this.#o.reduce((e, t) => K(e, t.changes), e);
1613
+ return this.#o.reduce((e, t) => F(e, t.changes), e);
2052
1614
  }
2053
1615
  enqueue(e) {
2054
1616
  let t = this.#s.then(e);
2055
1617
  return this.#s = t, t;
2056
1618
  }
2057
1619
  async change(e, t, n, r = !0) {
2058
- this.#t.beforeChange(r), this.#t.apply(K(t, n));
2059
- let i = at(n), a = this.#o.at(-1), o = i != null && a != null && !a.started && at(a.changes) == i ? a : void 0;
1620
+ this.#t.beforeChange(r), this.#t.apply(F(t, n));
1621
+ let i = Et(n), a = this.#o.at(-1), o = i != null && a != null && !a.started && Et(a.changes) == i ? a : void 0;
2060
1622
  if (o != null) return o.changes = n, await o.result;
2061
1623
  let s = {
2062
1624
  ...e,
@@ -2084,7 +1646,7 @@ var ot = class {
2084
1646
  let r = this.#l(e, n, t);
2085
1647
  return this.#o.length == 0 && this.#t.check(), r;
2086
1648
  } catch (n) {
2087
- if (n instanceof s && n.code == "flow.revision-conflict") {
1649
+ if (n instanceof P && n.code == "flow.revision-conflict") {
2088
1650
  if (!t && await this.#t.recover(e)) {
2089
1651
  t = !0;
2090
1652
  continue;
@@ -2093,7 +1655,7 @@ var ot = class {
2093
1655
  kind: "error",
2094
1656
  message: this.#n.t("notice.draftConflict")
2095
1657
  });
2096
- } else this.#u(e), this.#t.current(e) && this.#r(u(n, this.#n.t));
1658
+ } else this.#u(e), this.#t.current(e) && this.#r(B(n, this.#n.t));
2097
1659
  return;
2098
1660
  }
2099
1661
  }
@@ -2101,7 +1663,7 @@ var ot = class {
2101
1663
  #l(e, t, n) {
2102
1664
  let r = {
2103
1665
  ...n.revision,
2104
- content: K(t, e.changes).content
1666
+ content: F(t, e.changes).content
2105
1667
  };
2106
1668
  this.#o = this.#o.filter((t) => t !== e), this.#a = r;
2107
1669
  let i = this.#t.diagnostics(), a = this.#o.length == 0 && i?.revisionId == r.revisionId;
@@ -2110,19 +1672,19 @@ var ot = class {
2110
1672
  #u(e) {
2111
1673
  this.#o = this.#o.filter((t) => t !== e), !(!this.#t.current(e) || this.#a == null) && this.#t.apply(this.project(this.#a));
2112
1674
  }
2113
- }, st = 50, ct = {
1675
+ }, Ot = 50, kt = {
2114
1676
  failed: !1,
2115
1677
  loaded: !1,
2116
1678
  loading: !0,
2117
1679
  loadingMore: !1,
2118
1680
  loadMoreFailed: !1,
2119
1681
  flows: []
2120
- }, lt = class {
1682
+ }, At = class {
2121
1683
  #e;
2122
1684
  #t;
2123
1685
  #n = new x();
2124
1686
  #r;
2125
- #i = t(ct);
1687
+ #i = t(kt);
2126
1688
  #a = !1;
2127
1689
  constructor(t, n, r) {
2128
1690
  this.#e = t, this.#t = r, this.#r = n, this.$ = {
@@ -2164,7 +1726,7 @@ var ot = class {
2164
1726
  try {
2165
1727
  let t = await this.#e.listFlows({
2166
1728
  includeTotal: !0,
2167
- limit: st
1729
+ limit: Ot
2168
1730
  });
2169
1731
  if (!e()) return;
2170
1732
  this.#o({
@@ -2179,7 +1741,7 @@ var ot = class {
2179
1741
  this.#o({
2180
1742
  failed: !0,
2181
1743
  loading: !1
2182
- }), this.#r(u(t, this.#t.t));
1744
+ }), this.#r(B(t, this.#t.t));
2183
1745
  }
2184
1746
  }
2185
1747
  async loadMore() {
@@ -2193,7 +1755,7 @@ var ot = class {
2193
1755
  try {
2194
1756
  let e = await this.#e.listFlows({
2195
1757
  cursor: t,
2196
- limit: st
1758
+ limit: Ot
2197
1759
  });
2198
1760
  if (!n()) return;
2199
1761
  let r = new Set(this.#i.value.flows.map((e) => e.flowId));
@@ -2207,7 +1769,7 @@ var ot = class {
2207
1769
  this.#o({
2208
1770
  loadingMore: !1,
2209
1771
  loadMoreFailed: !0
2210
- }), this.#r(u(e, this.#t.t));
1772
+ }), this.#r(B(e, this.#t.t));
2211
1773
  }
2212
1774
  }
2213
1775
  async create(e) {
@@ -2225,6 +1787,12 @@ var ot = class {
2225
1787
  }
2226
1788
  this.#o({ flows: this.#i.value.flows.with(t, e) });
2227
1789
  }
1790
+ insert(e) {
1791
+ this.#i.value.flows.some((t) => t.flowId == e.flowId) || this.#o({
1792
+ flows: [...this.#i.value.flows, e],
1793
+ total: this.#i.value.total == null ? void 0 : this.#i.value.total + 1
1794
+ });
1795
+ }
2228
1796
  remove(e) {
2229
1797
  this.#o({
2230
1798
  flows: this.#i.value.flows.filter((t) => t.flowId != e),
@@ -2243,7 +1811,7 @@ var ot = class {
2243
1811
  ...e
2244
1812
  });
2245
1813
  }
2246
- }, ut = class {
1814
+ }, jt = class {
2247
1815
  #e;
2248
1816
  #t;
2249
1817
  #n;
@@ -2286,7 +1854,7 @@ var ot = class {
2286
1854
  this.#c(a, r);
2287
1855
  } catch (r) {
2288
1856
  if (this.#o || !n()) return;
2289
- if (r instanceof s && r.code == "flow.presentation-conflict") try {
1857
+ if (r instanceof P && r.code == "flow.presentation-conflict") try {
2290
1858
  let t = await this.#e.getPresentation(e);
2291
1859
  if (this.#o || !n()) return;
2292
1860
  this.#c(a, t), this.#n({
@@ -2294,9 +1862,9 @@ var ot = class {
2294
1862
  message: this.#t.t("notice.layoutConflict")
2295
1863
  });
2296
1864
  } catch (e) {
2297
- !this.#o && n() && this.#n(u(e, this.#t.t));
1865
+ !this.#o && n() && this.#n(B(e, this.#t.t));
2298
1866
  }
2299
- else this.#c(a, t), this.#n(u(r, this.#t.t));
1867
+ else this.#c(a, t), this.#n(B(r, this.#t.t));
2300
1868
  }
2301
1869
  }), await this.#i;
2302
1870
  }
@@ -2308,76 +1876,13 @@ var ot = class {
2308
1876
  value: n
2309
1877
  });
2310
1878
  }
2311
- };
2312
- //#endregion
2313
- //#region src/workbench/browser/runtime/designer/diagnostics.ts
2314
- function dt(e, t) {
2315
- return t == e || t.startsWith(`${e}/`);
2316
- }
2317
- function ft(e, t, n, r) {
2318
- if (e == null || t == null || n == null) return [];
2319
- if (r != null) return _t(t, r, n.diagnostics);
2320
- let i = t.kind == "flow" ? "/document/graph" : `/document/subflows/${t.id}`;
2321
- return n.diagnostics.filter((e) => dt(i, e.path));
2322
- }
2323
- function pt(e) {
2324
- return e.startsWith("/modules/") ? "code" : /\/graph\/nodes\/[^/]+\/task(?:\/|$)/.test(e) ? "task" : e.includes("/graph/nodes/") ? "node" : e.startsWith("/document/tasks/") ? "task" : "flow";
2325
- }
2326
- function mt(e, t) {
2327
- return t.startsWith("/inputs/") ? "inputs" : e.kind == "task" && t.startsWith("/task") ? "task" : e.kind == "condition" && (t.startsWith("/cases/") || t.startsWith("/input") || t.startsWith("/defaultOutput")) ? "condition" : "node";
2328
- }
2329
- function ht(e, t, n) {
2330
- if (e == null || t == null) return;
2331
- let r = t.kind == "flow" ? "/document/graph/nodes/" : `/document/subflows/${t.id}/graph/nodes/`;
2332
- if (n.path.startsWith(r)) {
2333
- let i = n.path.slice(r.length), a = i.indexOf("/"), o = a < 0 ? i : i.slice(0, a), s = e.node(t, o);
2334
- return s == null ? void 0 : {
2335
- nodeId: o,
2336
- section: mt(s.node, a < 0 ? "" : i.slice(a))
2337
- };
2338
- }
2339
- let i = /^\/document\/tasks\/([^/]+)(.*)$/.exec(n.path);
2340
- if (i != null) {
2341
- let n = e.findTaskNode(t, /* @__PURE__ */ new Set([i[1]]));
2342
- return n == null ? void 0 : {
2343
- nodeId: n,
2344
- section: i[2].startsWith("/executor") ? "account" : "task"
2345
- };
2346
- }
2347
- let a = /^\/modules\/([^/]+)\/source$/.exec(n.path);
2348
- if (a != null) {
2349
- let n = e.findModuleNode(t, a[1]);
2350
- if (n != null) return {
2351
- nodeId: n,
2352
- section: "module"
2353
- };
2354
- }
2355
- }
2356
- function gt(e, t, n) {
2357
- return n?.diagnostics.map((n) => ({
2358
- diagnostic: n,
2359
- location: ht(e, t, n),
2360
- scope: pt(n.path)
2361
- })) ?? [];
2362
- }
2363
- function _t(e, t, n) {
2364
- let r = e.kind == "flow" ? `/document/graph/nodes/${t.id}` : `/document/subflows/${e.id}/graph/nodes/${t.id}`, i = [r];
2365
- if (t.kind == "task") {
2366
- t.node.task == null ? i.push(`/document/tasks/${t.node.taskId}`) : i.push(`${r}/task`);
2367
- let e = t.definition != null && "moduleId" in t.definition ? t.definition.moduleId : void 0;
2368
- e != null && i.push(`/modules/${e}`);
2369
- } else t.kind == "subflow" && i.push(`/document/subflows/${t.node.subflowId}`);
2370
- return n.filter((e) => i.some((t) => dt(t, e.path)));
2371
- }
2372
- //#endregion
2373
- //#region src/workbench/browser/runtime/stores/workspaceModel.ts
2374
- var vt = {
1879
+ }, Mt = {
2375
1880
  checkLoading: !1,
2376
1881
  selectedNodeIds: [],
2377
1882
  workspaceLoadFailed: !1,
2378
1883
  workspaceLoading: !1
2379
1884
  };
2380
- function yt(e) {
1885
+ function Nt(e) {
2381
1886
  return e.workspaceLoading ? "loading" : e.busy == "designer" ? "saving" : e.draft == null ? "noDraft" : "saved";
2382
1887
  }
2383
1888
  function Z(e, t) {
@@ -2393,9 +1898,9 @@ function Q(e, t, n) {
2393
1898
  source: r.module.source
2394
1899
  };
2395
1900
  }
2396
- var bt = class {
1901
+ var Pt = class {
2397
1902
  #e;
2398
- #t = t(vt);
1903
+ #t = t(Mt);
2399
1904
  #n;
2400
1905
  constructor(t, r) {
2401
1906
  let i = e(this.#t, (e) => e.busy), a = e(this.#t, (e) => e.checkLoading), o = e(this.#t, (e) => e.diagnosticFocus), s = e(this.#t, (e) => e.diagnostics), c = e(this.#t, (e) => e.draft), l = e(this.#t, (e) => {
@@ -2405,23 +1910,23 @@ var bt = class {
2405
1910
  ...n,
2406
1911
  status: Z(e.draft, e.moduleEditor)
2407
1912
  };
2408
- }), u = e(this.#t, (e) => e.nodeFocus), d = e(this.#t, (e) => e.presentation), f = e(this.#t, (e) => e.flowId), p = e(this.#t, (e) => e.live), m = e(this.#t, (e) => e.draft == null ? void 0 : h(e.draft)), g = e(this.#t, (e) => e.selectedNodeIds), _ = e(this.#t, (e) => e.target), v = e(this.#t, (e) => e.workspaceLoadFailed), y = e(this.#t, (e) => e.workspaceLoading);
1913
+ }), u = e(this.#t, (e) => e.nodeFocus), d = e(this.#t, (e) => e.presentation), f = e(this.#t, (e) => e.flowId), p = e(this.#t, (e) => e.live), m = e(this.#t, (e) => e.draft == null ? void 0 : N(e.draft)), h = e(this.#t, (e) => e.selectedNodeIds), g = e(this.#t, (e) => e.target), _ = e(this.#t, (e) => e.workspaceLoadFailed), v = e(this.#t, (e) => e.workspaceLoading);
2409
1914
  this.#e = e(this.#t, (e) => ({
2410
- revision: e.draft == null ? void 0 : h(e.draft),
1915
+ revision: e.draft == null ? void 0 : N(e.draft),
2411
1916
  target: e.target
2412
1917
  }), { equal: (e, t) => e.revision === t.revision && e.target === t.target });
2413
- let b = e(this.#t, (e) => {
2414
- if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return h(e.draft).selection(e.target, e.selectedNodeIds[0]);
1918
+ let y = e(this.#t, (e) => {
1919
+ if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return N(e.draft).selection(e.target, e.selectedNodeIds[0]);
2415
1920
  });
2416
1921
  this.$ = {
2417
1922
  addNodeOptions: n((e) => {
2418
1923
  let { revision: n, target: r } = e(this.#e);
2419
- return ee(n?.revision, r, e(t.t$));
1924
+ return je(n?.revision, r, e(t.t$));
2420
1925
  }),
2421
1926
  busy: i,
2422
1927
  checkLoading: a,
2423
1928
  diagnosticFocus: o,
2424
- diagnosticItems: e(this.#t, (e) => gt(e.draft == null ? void 0 : h(e.draft), e.target, e.diagnostics)),
1929
+ diagnosticItems: e(this.#t, (e) => we(e.draft == null ? void 0 : N(e.draft), e.target, e.diagnostics)),
2425
1930
  diagnostics: s,
2426
1931
  draft: c,
2427
1932
  flow: n((e) => {
@@ -2436,7 +1941,7 @@ var bt = class {
2436
1941
  flowNextCursor: r.$.nextCursor,
2437
1942
  flowTotal: r.$.total,
2438
1943
  flows: r.$.flows,
2439
- inspectorDiagnostics: e(this.#t, (e) => ft(e.draft == null ? void 0 : h(e.draft), e.target, e.diagnostics, b.value)),
1944
+ inspectorDiagnostics: e(this.#t, (e) => Oe(e.draft == null ? void 0 : N(e.draft), e.target, e.diagnostics, y.value)),
2440
1945
  live: p,
2441
1946
  moduleDiagnostics: e(this.#t, (e) => {
2442
1947
  let t = e.moduleEditor?.moduleId;
@@ -2446,16 +1951,16 @@ var bt = class {
2446
1951
  nodeFocus: u,
2447
1952
  presentation: d,
2448
1953
  revision: m,
2449
- selection: b,
2450
- selectedNodeIds: g,
2451
- status: e(this.#t, yt),
2452
- target: _,
2453
- targetFlow: n((e) => e(_)?.kind == "flow" ? e(r.$.flows).find((t) => t.flowId == e(f)) : void 0),
1954
+ selection: y,
1955
+ selectedNodeIds: h,
1956
+ status: e(this.#t, Nt),
1957
+ target: g,
1958
+ targetFlow: n((e) => e(g)?.kind == "flow" ? e(r.$.flows).find((t) => t.flowId == e(f)) : void 0),
2454
1959
  targetName: e(this.#t, (e) => {
2455
- if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id : h(e.draft).subflow(e.target.id)?.name ?? e.target.id;
1960
+ if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id : N(e.draft).subflow(e.target.id)?.name ?? e.target.id;
2456
1961
  }),
2457
- workspaceLoadFailed: v,
2458
- workspaceLoading: y
1962
+ workspaceLoadFailed: _,
1963
+ workspaceLoading: v
2459
1964
  }, this.#n = new Set(Object.values(r.$));
2460
1965
  }
2461
1966
  get value() {
@@ -2471,14 +1976,14 @@ var bt = class {
2471
1976
  for (let e of Object.values(this.$)) this.#n.has(e) || e.dispose();
2472
1977
  this.#e.dispose(), this.#t.dispose();
2473
1978
  }
2474
- }, xt = 250;
2475
- function St(e, t) {
1979
+ }, Ft = 250;
1980
+ function It(e, t) {
2476
1981
  if (t != null) return t.kind == "flow" || e.subflow(t.id) != null ? t : { kind: "flow" };
2477
1982
  }
2478
1983
  function $(e, t) {
2479
1984
  return e?.kind == t?.kind ? e?.kind != "subflow" || t?.kind == "subflow" && e.id == t.id : !1;
2480
1985
  }
2481
- var Ct = class {
1986
+ var Lt = class {
2482
1987
  #e;
2483
1988
  #t;
2484
1989
  #n = new x();
@@ -2501,8 +2006,8 @@ var Ct = class {
2501
2006
  #y = 0;
2502
2007
  #b;
2503
2008
  #x;
2504
- constructor(e, t, n = () => crypto.randomUUID(), r = l(), i = () => {}) {
2505
- this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new lt(e, t, r), this.#l = new bt(r, this.#o), this.#t = new ot(e, t, r, {
2009
+ constructor(e, t, n = it, r = E(), i = () => {}) {
2010
+ this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new At(e, t, r), this.#l = new Pt(r, this.#o), this.#t = new Dt(e, t, r, {
2506
2011
  apply: (e, t) => this.#w(e, t),
2507
2012
  beforeChange: (e) => {
2508
2013
  this.#M(), this.#h = !1, e && (this.#B({ busy: "designer" }), this.#c(void 0));
@@ -2515,7 +2020,7 @@ var Ct = class {
2515
2020
  },
2516
2021
  headChanged: (e, t) => this.#N(e, t),
2517
2022
  recover: (e) => this.#O(e, !0)
2518
- }), this.#a = new ut(e, t, (e) => this.#B({ presentation: e }), r), this.$ = this.#l.$;
2023
+ }), this.#a = new jt(e, t, (e) => this.#B({ presentation: e }), r), this.$ = this.#l.$;
2519
2024
  }
2520
2025
  dispose() {
2521
2026
  this.#M(), this.#_ = !0, this.#n.invalidate(), this.#a.dispose(), this.#b?.(), this.#x?.(), this.#l.dispose(), this.#o.dispose();
@@ -2570,7 +2075,7 @@ var Ct = class {
2570
2075
  return t() ? (this.#B({
2571
2076
  workspaceLoadFailed: !0,
2572
2077
  workspaceLoading: !1
2573
- }), this.#c(u(e, this.#r.t)), !1) : !1;
2078
+ }), this.#c(B(e, this.#r.t)), !1) : !1;
2574
2079
  }
2575
2080
  return !0;
2576
2081
  }
@@ -2587,18 +2092,20 @@ var Ct = class {
2587
2092
  selectNodes(e) {
2588
2093
  return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : this.#F() ? (this.#M(), this.#B({
2589
2094
  diagnosticFocus: void 0,
2590
- moduleEditor: Q(this.#l.value.draft == null ? void 0 : h(this.#l.value.draft), this.#l.value.target, e),
2095
+ moduleEditor: Q(this.#l.value.draft == null ? void 0 : N(this.#l.value.draft), this.#l.value.target, e),
2591
2096
  nodeFocus: void 0,
2592
2097
  selectedNodeIds: e
2593
2098
  }), !0) : !1;
2594
2099
  }
2595
- async createFlow(e) {
2100
+ async createFlow(e, t) {
2596
2101
  if (this.#F()) {
2597
2102
  this.#B({ busy: "flow" }), this.#c(void 0);
2598
2103
  try {
2599
- return await this.#o.create(e);
2104
+ if (t == null) return await this.#o.create(e);
2105
+ let n = await this.#e.getFlow(await t(e));
2106
+ return this.#o.insert(n), n;
2600
2107
  } catch (e) {
2601
- this.#_ || this.#c(u(e, this.#r.t));
2108
+ this.#_ || this.#c(B(e, this.#r.t));
2602
2109
  } finally {
2603
2110
  this.#B({ busy: void 0 });
2604
2111
  }
@@ -2615,7 +2122,7 @@ var Ct = class {
2615
2122
  message: this.#r.t("notice.flowDeleteAccepted", { name: t.name })
2616
2123
  }), !0);
2617
2124
  } catch (e) {
2618
- return this.#_ || this.#c(u(e, this.#r.t)), !1;
2125
+ return this.#_ || this.#c(B(e, this.#r.t)), !1;
2619
2126
  } finally {
2620
2127
  this.#B({ busy: void 0 });
2621
2128
  }
@@ -2624,7 +2131,7 @@ var Ct = class {
2624
2131
  if (!this.#F() || this.#l.value.draft == null) return !1;
2625
2132
  let t = this.#i();
2626
2133
  this.#B({ busy: "resource" }), this.#c(void 0);
2627
- let n = await this.#C(ze(t, e), !1);
2134
+ let n = await this.#C(ge(t, e), !1);
2628
2135
  return this.#B({ busy: void 0 }), n != null && (this.selectTarget({
2629
2136
  id: t,
2630
2137
  kind: "subflow"
@@ -2642,7 +2149,7 @@ var Ct = class {
2642
2149
  try {
2643
2150
  i = await this.#e.renameFlow(e, r), i != null && this.#o.include(i);
2644
2151
  } catch (e) {
2645
- this.#_ || this.#c(u(e, this.#r.t));
2152
+ this.#_ || this.#c(B(e, this.#r.t));
2646
2153
  }
2647
2154
  return this.#B({ busy: void 0 }), i != null && (this.#c({
2648
2155
  kind: "success",
@@ -2655,32 +2162,35 @@ var Ct = class {
2655
2162
  if (r == null || i == null) return;
2656
2163
  let a = this.#i();
2657
2164
  if (e.kind == "comment") return await this.#S(i, a, t);
2658
- let o = h(r), s = b(e, o, i, this.#r.t);
2165
+ let o = N(r), s = S(e, o, i, this.#r.t);
2659
2166
  if (s == null) return;
2660
- let c = Be(o, i, a, s, this.#i);
2167
+ let c = be(o, i, a, s, this.#i);
2661
2168
  if (c == null) return;
2662
- let l = n == null ? c : [...c, ...R(K(r, c).content, i, n(a))], u = this.#C(l);
2169
+ let l = n == null ? c : [...c, ...$e(F(r, c).content, i, n(a))], u = this.#C(l);
2663
2170
  this.selectNodes([a]);
2664
2171
  let d = this.moveNodes({ [a]: t });
2665
- if (await u != null) return await d, a;
2172
+ if (await u != null && (await d, !this.#_)) return this.#B({ nodeFocus: {
2173
+ nodeId: a,
2174
+ requestId: ++this.#y
2175
+ } }), a;
2666
2176
  }
2667
2177
  async connect(e) {
2668
2178
  let t = this.$.revision.value, n = this.#l.value.target;
2669
2179
  if (t == null || n == null) return;
2670
- let r = R(t.revision.content, n, e);
2180
+ let r = $e(t.revision.content, n, e);
2671
2181
  r.length > 0 && await this.#C(r);
2672
2182
  }
2673
2183
  async disconnect(e) {
2674
2184
  let t = this.$.revision.value, n = this.#l.value.target;
2675
2185
  if (t == null || n == null) return;
2676
- let r = Se(t.revision.content, n, e);
2186
+ let r = et(t.revision.content, n, e);
2677
2187
  r.length > 0 && await this.#C(r);
2678
2188
  }
2679
2189
  async deleteSelectedNodes() {
2680
2190
  if (!this.#F()) return;
2681
2191
  let e = this.$.revision.value, t = this.#l.value.target;
2682
2192
  if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
2683
- let n = g(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = Ve(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#C(i), o = r.size == 0 ? void 0 : this.#T((e) => f(e, t, r));
2193
+ let n = T(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = Se(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#C(i), o = r.size == 0 ? void 0 : this.#T((e) => y(e, t, r));
2684
2194
  this.selectNodes([]), (a == null || await a != null) && await o;
2685
2195
  }
2686
2196
  copySelectedNodes() {
@@ -2694,14 +2204,14 @@ var Ct = class {
2694
2204
  sourceId: e.id,
2695
2205
  title: e.title
2696
2206
  }] : []),
2697
- nodes: He(e, t, this.#l.value.selectedNodeIds)
2207
+ nodes: De(e, t, this.#l.value.selectedNodeIds)
2698
2208
  };
2699
2209
  }
2700
2210
  async pasteNodes(e) {
2701
2211
  if (!this.#F()) return;
2702
2212
  let t = this.$.revision.value, n = this.#l.value.target;
2703
2213
  if (t == null || n == null || this.#u == null) return;
2704
- let r = Ue(t, n, this.#u.nodes, this.#i), i = r.changes.length == 0 ? void 0 : this.#C(r.changes), a = this.#u.comments.map((e) => ({
2214
+ let r = ke(t, n, this.#u.nodes, this.#i), i = r.changes.length == 0 ? void 0 : this.#C(r.changes), a = this.#u.comments.map((e) => ({
2705
2215
  ...e,
2706
2216
  nodeId: this.#i()
2707
2217
  }));
@@ -2713,8 +2223,8 @@ var Ct = class {
2713
2223
  y: (i?.y ?? 80) + 40
2714
2224
  }];
2715
2225
  })), c = this.#T((e) => {
2716
- let t = p(e, n, s);
2717
- for (let e of a) t = _(t, n, e.nodeId, {
2226
+ let t = j(e, n, s);
2227
+ for (let e of a) t = L(t, n, e.nodeId, {
2718
2228
  content: e.content,
2719
2229
  position: {
2720
2230
  x: e.position.x + 40,
@@ -2732,50 +2242,56 @@ var Ct = class {
2732
2242
  async saveNodeSettings(e, t) {
2733
2243
  let n = this.$.revision.value, r = this.#l.value.target;
2734
2244
  if (n == null || r == null) return !1;
2735
- let i = We(n, r, e, t);
2245
+ let i = Ae(n, r, e, t);
2736
2246
  return i != null && await this.#C(i) != null;
2737
2247
  }
2738
2248
  async saveNodeDescription(e, t) {
2739
2249
  let n = this.$.revision.value, r = this.#l.value.target;
2740
2250
  if (n == null || r == null) return !1;
2741
- let i = Ge(n, r, e, t);
2251
+ let i = ye(n, r, e, t);
2742
2252
  return i != null && await this.#C(i) != null;
2743
2253
  }
2744
2254
  async saveNodeIcon(e, t) {
2745
2255
  let n = this.$.revision.value, r = this.#l.value.target;
2746
2256
  if (n == null || r == null) return !1;
2747
- let i = Ke(n, r, e, t);
2257
+ let i = ve(n, r, e, t);
2748
2258
  return i != null && await this.#C(i) != null;
2749
2259
  }
2750
2260
  async saveNodeTitle(e, t) {
2751
2261
  let n = this.$.revision.value, r = this.#l.value.target;
2752
2262
  if (n == null || r == null) return !1;
2753
- let i = qe(n, r, e, t);
2263
+ let i = me(n, r, e, t);
2754
2264
  return i != null && await this.#C(i) != null;
2755
2265
  }
2756
2266
  async setInputValue(e, t, n) {
2757
2267
  let r = this.$.revision.value, i = this.#l.value.target;
2758
2268
  if (r == null || i == null) return !1;
2759
- let a = Je(r, i, e, t, n);
2269
+ let a = I(r, i, e, t, n);
2270
+ return a != null && await this.#C(a) != null;
2271
+ }
2272
+ async setInputVariable(e, t, n) {
2273
+ let r = this.$.revision.value, i = this.#l.value.target;
2274
+ if (r == null || i == null) return !1;
2275
+ let a = n == null ? I(r, i, e, t, void 0) : _e(r, i, e, t, n, this.#i());
2760
2276
  return a != null && await this.#C(a) != null;
2761
2277
  }
2762
2278
  async saveCondition(e, t) {
2763
2279
  let n = this.$.revision.value, r = this.#l.value.target;
2764
2280
  if (n == null || r == null) return !1;
2765
- let i = Ye(n, r, e, t);
2281
+ let i = Ce(n, r, e, t);
2766
2282
  return i != null && await this.#C(i) != null;
2767
2283
  }
2768
2284
  async saveValue(e, t) {
2769
2285
  let n = this.$.revision.value, r = this.#l.value.target;
2770
2286
  if (n == null || r == null) return !1;
2771
- let i = Xe(n, r, e, t);
2287
+ let i = Me(n, r, e, t);
2772
2288
  return i != null && await this.#C(i) != null;
2773
2289
  }
2774
2290
  async saveComment(e, t) {
2775
2291
  let n = this.#l.value.target;
2776
2292
  if (n == null) return;
2777
2293
  let r = this.#P().nodes.find((t) => t.id == e)?.position;
2778
- r != null && await this.#T((i) => _(i, n, e, {
2294
+ r != null && await this.#T((i) => L(i, n, e, {
2779
2295
  ...t,
2780
2296
  position: r
2781
2297
  }));
@@ -2783,55 +2299,55 @@ var Ct = class {
2783
2299
  async saveTaskSettings(e, t) {
2784
2300
  let n = this.$.revision.value, r = this.#l.value.target;
2785
2301
  if (n == null || r == null) return !1;
2786
- let i = Ze(n, r, e, t);
2302
+ let i = he(n, r, e, t);
2787
2303
  return i != null && await this.#C(i) != null;
2788
2304
  }
2789
2305
  async saveCodeTaskPorts(e, t) {
2790
2306
  let n = this.$.revision.value, r = this.#l.value.target;
2791
2307
  if (n == null || r == null) return !1;
2792
- let i = Qe(n, r, e, t);
2308
+ let i = Te(n, r, e, t);
2793
2309
  return i != null && await this.#C(i) != null;
2794
2310
  }
2795
2311
  async setConnectorConnection(e, t) {
2796
2312
  let n = this.$.revision.value;
2797
2313
  if (n == null) return !1;
2798
- let r = Pe(n.revision.content, e, t);
2314
+ let r = D(n.revision.content, e, t);
2799
2315
  return r != null && await this.#C(r) != null;
2800
2316
  }
2801
2317
  async saveTriggerSettings(e, t) {
2802
2318
  let n = this.$.revision.value, r = this.#l.value.target;
2803
2319
  if (n == null || r?.kind != "flow") return !1;
2804
- let i = Fe(n.revision.content, r, e, t);
2320
+ let i = pe(n.revision.content, r, e, t);
2805
2321
  return i != null && await this.#C(i) != null;
2806
2322
  }
2807
2323
  async saveTriggerConfig(e, t, n) {
2808
2324
  let r = this.$.revision.value, i = this.#l.value.target;
2809
2325
  if (r == null || i?.kind != "flow") return !1;
2810
- let a = Ie(r.revision.content, i, e, t, n);
2326
+ let a = ne(r.revision.content, i, e, t, n);
2811
2327
  return a != null && await this.#C(a) != null;
2812
2328
  }
2813
2329
  async saveTriggerSchedule(e, t) {
2814
2330
  let n = this.$.revision.value, r = this.#l.value.target;
2815
2331
  if (n == null || r?.kind != "flow") return !1;
2816
- let i = Le(n.revision.content, r, e, t);
2332
+ let i = re(n.revision.content, r, e, t);
2817
2333
  return i != null && await this.#C(i) != null;
2818
2334
  }
2819
2335
  async saveWebhook(e, t) {
2820
2336
  let n = this.$.revision.value, r = this.#l.value.target;
2821
2337
  if (n == null || r?.kind != "flow") return !1;
2822
- let i = $e(n, r, e, t);
2338
+ let i = le(n, r, e, t);
2823
2339
  return i != null && await this.#C(i) != null;
2824
2340
  }
2825
2341
  async setTriggerConnection(e, t) {
2826
2342
  let n = this.$.revision.value, r = this.#l.value.target;
2827
2343
  if (n == null || r?.kind != "flow") return !1;
2828
- let i = Re(n.revision.content, r, e, t);
2344
+ let i = de(n.revision.content, r, e, t);
2829
2345
  return i != null && await this.#C(i) != null;
2830
2346
  }
2831
2347
  async saveSubflowSettings(e, t) {
2832
2348
  let n = this.$.revision.value;
2833
2349
  if (n == null) return !1;
2834
- let r = et(n, e, t);
2350
+ let r = Ne(n, e, t);
2835
2351
  return r != null && await this.#C(r) != null;
2836
2352
  }
2837
2353
  updateModuleSource(e) {
@@ -2862,9 +2378,9 @@ var Ct = class {
2862
2378
  ...e,
2863
2379
  phase: "saving"
2864
2380
  } });
2865
- let t = await Ce(e.source);
2381
+ let t = await nt(e.source);
2866
2382
  if (this.#_) return !1;
2867
- let n = await this.#C(we(e.moduleId, e.source, t));
2383
+ let n = await this.#C(rt(e.moduleId, e.source, t));
2868
2384
  return !this.#_ && this.#l.value.moduleEditor?.moduleId == e.moduleId && this.#B({ moduleEditor: {
2869
2385
  ...this.#l.value.moduleEditor,
2870
2386
  phase: n == null ? "failed" : void 0
@@ -2872,13 +2388,13 @@ var Ct = class {
2872
2388
  }
2873
2389
  async moveNodes(e, t = "detail") {
2874
2390
  let n = this.#l.value.target;
2875
- n != null && await this.#T((r) => p(r, n, e, t));
2391
+ n != null && await this.#T((r) => j(r, n, e, t));
2876
2392
  }
2877
2393
  async moveViewport(e, t = "detail") {
2878
2394
  let n = this.#l.value.target;
2879
2395
  if (n == null) return;
2880
2396
  let r = this.#P().viewport;
2881
- (r.x != e.x || r.y != e.y || r.zoom != e.zoom) && this.#M(), await this.#T((r) => te(r, n, e, t));
2397
+ (r.x != e.x || r.y != e.y || r.zoom != e.zoom) && this.#M(), await this.#T((r) => A(r, n, e, t));
2882
2398
  }
2883
2399
  async check() {
2884
2400
  await this.#E();
@@ -2908,7 +2424,7 @@ var Ct = class {
2908
2424
  if (e.kind != "comment") return [];
2909
2425
  let t = /#(\d+)$/.exec(e.title);
2910
2426
  return t == null ? [] : [Number(t[1])];
2911
- })), i = this.#T((i) => _(i, e, t, {
2427
+ })), i = this.#T((i) => L(i, e, t, {
2912
2428
  content: "",
2913
2429
  position: n,
2914
2430
  title: this.#r.t("addNode.commentName", { number: r + 1 })
@@ -2953,9 +2469,18 @@ var Ct = class {
2953
2469
  });
2954
2470
  try {
2955
2471
  let n = await this.#e.checkFlow(e, t.revisionId);
2956
- !this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ diagnostics: n });
2472
+ if (!this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId) {
2473
+ let e = this.#l.value.live;
2474
+ this.#B({
2475
+ diagnostics: n,
2476
+ live: e == null ? void 0 : {
2477
+ ...e,
2478
+ hasUnpublishedChanges: e.publication == null || e.publication.closureDigest != n.closureDigest
2479
+ }
2480
+ });
2481
+ }
2957
2482
  } catch (n) {
2958
- !this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(u(n, this.#r.t));
2483
+ !this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(B(n, this.#r.t));
2959
2484
  } finally {
2960
2485
  !this.#_ && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#B({ checkLoading: !1 });
2961
2486
  }
@@ -2993,7 +2518,7 @@ var Ct = class {
2993
2518
  s = this.#k(a, o);
2994
2519
  }
2995
2520
  if (s.revisionId == a.revisionId) return !0;
2996
- let c = o.kind == "changes" && t != null ? it(h(a), h(s), t, o.revisions.flatMap((e) => e.operations)) : void 0;
2521
+ let c = o.kind == "changes" && t != null ? Tt(N(a), N(s), t, o.revisions.flatMap((e) => e.operations)) : void 0;
2997
2522
  o.kind == "snapshot" && this.#M();
2998
2523
  let l = this.#L(s, !1);
2999
2524
  return this.#N(e.flowId, s.revisionId), o.kind == "changes" && o.revisions.length > 0 && t != null && c != null && i == this.#m && this.#A(e, t, c, i), n && (this.#c({
@@ -3001,7 +2526,7 @@ var Ct = class {
3001
2526
  message: this.#r.t(l ? "notice.moduleUpdated" : "notice.draftUpdated")
3002
2527
  }), this.#E()), !0;
3003
2528
  } catch (n) {
3004
- return t && this.#z(e) && this.#c(u(n, this.#r.t)), !1;
2529
+ return t && this.#z(e) && this.#c(B(n, this.#r.t)), !1;
3005
2530
  }
3006
2531
  }
3007
2532
  #k(e, t) {
@@ -3011,7 +2536,7 @@ var Ct = class {
3011
2536
  if (e.revision.parentRevisionId != n.revisionId) throw Error("Invalid Draft revision chain.");
3012
2537
  n = {
3013
2538
  ...e.revision,
3014
- content: K(n, e.operations).content
2539
+ content: F(n, e.operations).content
3015
2540
  };
3016
2541
  }
3017
2542
  return n;
@@ -3026,7 +2551,7 @@ var Ct = class {
3026
2551
  return;
3027
2552
  }
3028
2553
  for (let e of n) a.targets.add(e);
3029
- globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#j(), xt);
2554
+ globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#j(), Ft);
3030
2555
  return;
3031
2556
  }
3032
2557
  n.size == 0 || i.selectedNodeIds.length > 0 || (this.#p = {
@@ -3035,7 +2560,7 @@ var Ct = class {
3035
2560
  flowId: e.flowId,
3036
2561
  target: t,
3037
2562
  targets: new Set(n),
3038
- timer: globalThis.setTimeout(() => this.#j(), xt),
2563
+ timer: globalThis.setTimeout(() => this.#j(), Ft),
3039
2564
  viewport: this.#P().viewport
3040
2565
  });
3041
2566
  }
@@ -3046,7 +2571,7 @@ var Ct = class {
3046
2571
  if (t.flowId != e.flowId || !$(t.target, e.target) || t.selectedNodeIds.length > 0) return;
3047
2572
  let n = this.#P().viewport;
3048
2573
  if (n.x != e.viewport.x || n.y != e.viewport.y || n.zoom != e.viewport.zoom || t.draft == null) return;
3049
- let r = h(t.draft), i = [...e.targets].filter((t) => r.selection(e.target, t) != null);
2574
+ let r = N(t.draft), i = [...e.targets].filter((t) => r.selection(e.target, t) != null);
3050
2575
  i.length == 1 && this.#B({ nodeFocus: {
3051
2576
  nodeId: i[0],
3052
2577
  requestId: ++this.#y
@@ -3060,7 +2585,7 @@ var Ct = class {
3060
2585
  }
3061
2586
  #P() {
3062
2587
  let e = this.#l.value;
3063
- return y(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
2588
+ return M(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
3064
2589
  }
3065
2590
  #F() {
3066
2591
  let e = this.#l.value.moduleEditor;
@@ -3070,7 +2595,7 @@ var Ct = class {
3070
2595
  }), !1);
3071
2596
  }
3072
2597
  #I(e) {
3073
- let t = h(e), n = St(t, this.#l.value.target);
2598
+ let t = N(e), n = It(t, this.#l.value.target);
3074
2599
  return {
3075
2600
  revision: t,
3076
2601
  selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) => n != null && t.selection(n, e) != null),
@@ -3104,13 +2629,13 @@ var Ct = class {
3104
2629
  };
3105
2630
  //#endregion
3106
2631
  //#region src/workbench/browser/runtime/stores/workbenchStore.ts
3107
- function wt(e) {
2632
+ function Rt(e) {
3108
2633
  return new Map(e.nodes.map((e) => [e.id, e]));
3109
2634
  }
3110
- function Tt(e, t) {
3111
- return e == null || t == null ? [] : h(e).designerInputs(t);
2635
+ function zt(e, t) {
2636
+ return e == null || t == null ? [] : N(e).designerInputs(t);
3112
2637
  }
3113
- function Et(e, t, n, r, i) {
2638
+ function Bt(e, t, n, r, i) {
3114
2639
  if (e == null || t?.kind != "flow" || n?.revisionId != e.revisionId || n.flowId != e.flowId) return /* @__PURE__ */ new Map();
3115
2640
  let a = r.find((t) => t.kind == "run.started" && t.payload.flowId == e.flowId)?.payload.scopeId;
3116
2641
  return typeof a == "string" ? new Map(r.flatMap((t) => {
@@ -3118,38 +2643,49 @@ function Et(e, t, n, r, i) {
3118
2643
  return t.payload.scopeId == a && t.payload.flowId == e.flowId && typeof n == "string" && i.has(n) ? [[t.sequence, n]] : [];
3119
2644
  })) : /* @__PURE__ */ new Map();
3120
2645
  }
3121
- var Dt = { openExternalPage: async () => !1 }, Ot = class {
2646
+ var Vt = { openExternalPage: async () => !1 }, Ht = class {
3122
2647
  #e;
3123
2648
  #t;
3124
2649
  #n;
3125
2650
  #r;
3126
- constructor(r, i, a = () => crypto.randomUUID(), o = l(), s = Dt) {
3127
- this.#e = new x(), this.#n = t(), this.#r = !1, this.provideAddNodeOptions = async (e, t) => await this.#i([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => await this.#i([this.triggers.browseAddNodeOptions(e), this.connectors.browseAddNodeOptions(e)], e), this.provideAddNodeOptionChoices = async (e, t) => await (e.startsWith("trigger:") ? this.triggers.provideAddNodeOptionChoices(e, t) : this.connectors.provideAddNodeOptionChoices(e, t)), this.#t = o;
3128
- let c = (e) => {
3129
- this.#r || this.#n.set(e);
2651
+ #i;
2652
+ #a;
2653
+ #o;
2654
+ #s;
2655
+ #c;
2656
+ #l;
2657
+ constructor(r, i, a = () => crypto.randomUUID(), o = E(), s = Vt, c = !0) {
2658
+ this.#t = new x(), this.#r = t(), this.#a = t([]), this.#o = t(!1), this.#s = t(!1), this.#c = new x(), this.#l = !1, this.provideAddNodeOptions = async (e, t) => await this.#u([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => await this.#u([this.triggers.browseAddNodeOptions(e), this.connectors.browseAddNodeOptions(e)], e), this.provideAddNodeOptionChoices = async (e, t) => {
2659
+ if (!e.startsWith("trigger:")) return await this.connectors.provideAddNodeOptionChoices(e, t);
2660
+ }, this.#e = r, this.#n = o, this.#i = c;
2661
+ let l = (e) => {
2662
+ this.#l || this.#r.set(e);
3130
2663
  };
3131
- this.runs = new v(r, c, o), this.workspace = new Ct(r, c, a, o, (e) => void this.#a(r, e)), this.connectors = new ye(r, this.workspace, c, s, o), this.triggers = new xe(r, this.workspace, c, s, o), this.publications = new de(r, this.workspace, c, a, o), this.runRequests = new ge(r, this.runs, c, o, a);
2664
+ this.runs = new O(r, l, o), this.workspace = new Lt(r, l, it, o, (e) => void this.#d(r, e)), this.connectors = new yt(r, this.workspace, l, s, o), this.triggers = new Ct(r, this.workspace, l, s, o), this.publications = new ct(r, this.workspace, l, i, a, o), this.runRequests = new pt(r, this.runs, l, o, a);
3132
2665
  let u = /* @__PURE__ */ new Map(), d, f = n((e) => {
3133
2666
  let t = e(this.workspace.$.draft);
3134
2667
  d != t?.flowId && (u.clear(), d = t?.flowId);
3135
- let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), l = e(this.runs.$.run), f = e(this.runs.$.events), p = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`, h = [
3136
- ...Tt(t, n),
3137
- r == null || n == null ? void 0 : m(r, n),
2668
+ let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), l = e(this.runs.$.run), f = e(this.runs.$.events), p = e(this.#a), m = e(this.#o), h = e(this.#s), g = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`, _ = [
2669
+ ...zt(t, n),
2670
+ r == null || n == null ? void 0 : se(r, n),
3138
2671
  i,
3139
2672
  a,
3140
2673
  s,
3141
2674
  c,
3142
2675
  l,
3143
2676
  f,
2677
+ p,
2678
+ m,
2679
+ h,
3144
2680
  ...l == null ? [] : [t?.revisionId]
3145
- ], g = u.get(p);
3146
- if (g != null && g.inputs.length == h.length && g.inputs.every((e, t) => e === h[t])) return g.graph;
3147
- let _ = y(t, n, r, i, a, s, c, l, f);
3148
- return u.set(p, {
3149
- graph: _,
3150
- inputs: h
3151
- }), _;
3152
- }), p = e(f, wt);
2681
+ ], v = u.get(g);
2682
+ if (v != null && v.inputs.length == _.length && v.inputs.every((e, t) => e === _[t])) return v.graph;
2683
+ let y = M(t, n, r, i, a, s, c, l, f, p, m, h, this.#i);
2684
+ return u.set(g, {
2685
+ graph: y,
2686
+ inputs: _
2687
+ }), y;
2688
+ }), p = e(f, Rt);
3153
2689
  this.$ = {
3154
2690
  busy: n((e) => {
3155
2691
  let t = e(this.workspace.$.busy);
@@ -3162,36 +2698,53 @@ var Dt = { openExternalPage: async () => !1 }, Ot = class {
3162
2698
  }),
3163
2699
  designer: f,
3164
2700
  designerNodeById: p,
3165
- notice: this.#n,
3166
- runEventNodes: n((e) => Et(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(p))),
2701
+ notice: this.#r,
2702
+ runEventNodes: n((e) => Bt(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(p))),
3167
2703
  selectedDesignerNode: n((e) => {
3168
2704
  let t = e(this.workspace.$.selectedNodeIds);
3169
2705
  return t.length == 1 ? e(p).get(t[0]) : void 0;
3170
- })
2706
+ }),
2707
+ variableNames: this.#a,
2708
+ variableNamesLoaded: this.#o,
2709
+ variableNamesLoading: this.#s
3171
2710
  };
3172
2711
  }
3173
2712
  dispose() {
3174
- this.#r = !0, this.#e.invalidate();
2713
+ this.#l = !0, this.#t.invalidate(), this.#c.invalidate();
3175
2714
  for (let e of Object.values(this.$)) e.dispose();
3176
- this.connectors.dispose(), this.publications.dispose(), this.runRequests.dispose(), this.runs.dispose(), this.triggers.dispose(), this.workspace.dispose();
2715
+ this.connectors.dispose(), this.publications.dispose(), this.runRequests.dispose(), this.runs.dispose(), this.triggers.dispose(), this.workspace.dispose(), this.#a.dispose(), this.#o.dispose(), this.#s.dispose();
3177
2716
  }
3178
2717
  async start(e) {
3179
- this.#e.invalidate(), this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), await this.workspace.start(e);
2718
+ this.#t.invalidate(), this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), await this.workspace.start(e);
3180
2719
  }
3181
2720
  async retryFlows() {
3182
2721
  await this.workspace.reloadFlows();
3183
2722
  }
3184
2723
  dismissNotice() {
3185
- this.#r || this.#n.set(void 0);
2724
+ this.#l || this.#r.set(void 0);
2725
+ }
2726
+ async refreshVariableNames() {
2727
+ if (this.#l || !this.#i) return;
2728
+ let e = this.#c.begin();
2729
+ this.#s.set(!0);
2730
+ try {
2731
+ let { variables: t } = await this.#e.listVariables();
2732
+ if (!e() || this.#l) return;
2733
+ this.#a.set(t.map((e) => e.name)), this.#o.set(!0);
2734
+ } catch (t) {
2735
+ e() && !this.#l && this.#r.set(B(t, this.#n.t));
2736
+ } finally {
2737
+ e() && !this.#l && this.#s.set(!1);
2738
+ }
3186
2739
  }
3187
2740
  async selectFlow(e) {
3188
- return this.#r || (this.#e.invalidate(), this.#n.set(void 0), !await this.workspace.selectFlow(e)) ? !1 : (this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), !0);
2741
+ return this.#l || (this.#t.invalidate(), this.#r.set(void 0), !await this.workspace.selectFlow(e)) ? !1 : (this.connectors.reset(), this.triggers.reset(), this.publications.reset(), this.runRequests.reset(), this.runs.reset(), !0);
3189
2742
  }
3190
- async createFlow(e) {
3191
- let t = await this.workspace.createFlow(e);
3192
- return this.#r || t == null ? !1 : (await this.selectFlow(t.flowId), this.#r || this.#n.set({
2743
+ async createFlow(e, t) {
2744
+ let n = await this.workspace.createFlow(e, t);
2745
+ return this.#l || n == null ? !1 : (await this.selectFlow(n.flowId), this.#l || this.#r.set({
3193
2746
  kind: "success",
3194
- message: this.#t.t("notice.created", { name: t.name })
2747
+ message: this.#n.t("notice.created", { name: n.name })
3195
2748
  }), !0);
3196
2749
  }
3197
2750
  selectNodes(e) {
@@ -3213,12 +2766,12 @@ var Dt = { openExternalPage: async () => !1 }, Ot = class {
3213
2766
  let r = await this.workspace.addNode(e, t, n);
3214
2767
  return r != null && e.kind == "connector" && this.connectors.refresh(), r != null && e.kind == "trigger" && this.triggers.refresh(), r;
3215
2768
  }
3216
- async #i(e, t) {
2769
+ async #u(e, t) {
3217
2770
  let n = await Promise.allSettled(e);
3218
- if (t.aborted || this.#r) return;
2771
+ if (t.aborted || this.#l) return;
3219
2772
  let r = n.filter((e) => e.status == "rejected");
3220
2773
  if (r.length > 0 && r.length == n.length) throw r[0].reason;
3221
- return r.length > 0 && this.#n.set(u(r[0].reason, this.#t.t)), n.flatMap((e) => e.status == "fulfilled" ? e.value ?? [] : []);
2774
+ return r.length > 0 && this.#r.set(B(r[0].reason, this.#n.t)), n.flatMap((e) => e.status == "fulfilled" ? e.value ?? [] : []);
3222
2775
  }
3223
2776
  async refreshSelectedConnector(e = !1) {
3224
2777
  await this.connectors.refresh(e);
@@ -3231,99 +2784,204 @@ var Dt = { openExternalPage: async () => !1 }, Ot = class {
3231
2784
  let e = this.workspace.$.targetFlow.value;
3232
2785
  return e == null ? "unavailable" : await this.runRequests.requestLive(e);
3233
2786
  }
3234
- async #a(e, t) {
2787
+ async #d(e, t) {
3235
2788
  let n = this.workspace.$.target.value;
3236
- if (this.#r || this.runRequests.$.submitting.value != null || n?.kind != "flow" || this.workspace.$.flowId.value != t.flowId) return;
3237
- let r = this.#e.begin();
2789
+ if (this.#l || this.runRequests.$.submitting.value != null || n?.kind != "flow" || this.workspace.$.flowId.value != t.flowId) return;
2790
+ let r = this.#t.begin();
3238
2791
  try {
3239
2792
  let n = await e.getRun(t.runId), i = this.workspace.$.target.value;
3240
- if (!r() || this.#r || i?.kind != "flow" || this.workspace.$.flowId.value != t.flowId || n.flowId != t.flowId || n.runId != t.runId) return;
2793
+ if (!r() || this.#l || i?.kind != "flow" || this.workspace.$.flowId.value != t.flowId || n.flowId != t.flowId || n.runId != t.runId) return;
3241
2794
  this.runs.followExternal(n);
3242
2795
  } catch {
3243
2796
  return;
3244
2797
  }
3245
2798
  }
3246
- }, kt = ie(() => import("./flowWorkspace-D7-rBA1-.js").then((e) => e.t));
3247
- function At({ host: e, store: t }) {
2799
+ }, Ut = ze(() => import("./flowWorkspace-DAMLVMcF.js").then((e) => e.t));
2800
+ function Wt({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i, pending: a = !1, title: o, token: s, tokenLabel: f }) {
2801
+ let g = s != null && f != null && i != null, _ = s ?? "", v = /* @__PURE__ */ G(Ve, { children: [
2802
+ /* @__PURE__ */ W("div", {
2803
+ "aria-hidden": "true",
2804
+ className: "flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground",
2805
+ children: /* @__PURE__ */ G("svg", {
2806
+ className: "size-5",
2807
+ fill: "none",
2808
+ stroke: "currentColor",
2809
+ strokeLinecap: "round",
2810
+ strokeLinejoin: "round",
2811
+ strokeWidth: "1.8",
2812
+ viewBox: "0 0 24 24",
2813
+ children: [/* @__PURE__ */ W("rect", {
2814
+ height: "9",
2815
+ rx: "2",
2816
+ width: "14",
2817
+ x: "5",
2818
+ y: "11"
2819
+ }), /* @__PURE__ */ W("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })]
2820
+ })
2821
+ }),
2822
+ /* @__PURE__ */ G("header", {
2823
+ className: "flex flex-col gap-2",
2824
+ children: [/* @__PURE__ */ W("h1", {
2825
+ className: "text-xl font-semibold tracking-tight text-balance",
2826
+ children: o
2827
+ }), /* @__PURE__ */ W("p", {
2828
+ className: "text-sm/relaxed text-muted-foreground text-pretty",
2829
+ children: t
2830
+ })]
2831
+ }),
2832
+ g && /* @__PURE__ */ W(h, { children: /* @__PURE__ */ G(u, {
2833
+ "data-invalid": n != null,
2834
+ children: [
2835
+ /* @__PURE__ */ W(m, {
2836
+ htmlFor: "session-token",
2837
+ children: f
2838
+ }),
2839
+ /* @__PURE__ */ W(c, {
2840
+ autoComplete: "username",
2841
+ name: "username",
2842
+ type: "hidden",
2843
+ value: "open-flow",
2844
+ readOnly: !0
2845
+ }),
2846
+ /* @__PURE__ */ W(c, {
2847
+ autoComplete: "current-password",
2848
+ "aria-invalid": n != null,
2849
+ autoFocus: !0,
2850
+ className: "h-9",
2851
+ id: "session-token",
2852
+ name: "session-token",
2853
+ onChange: (e) => i?.(e.target.value),
2854
+ spellCheck: !1,
2855
+ type: "password",
2856
+ value: _
2857
+ }),
2858
+ n != null && /* @__PURE__ */ W(l, { children: n })
2859
+ ]
2860
+ }) }),
2861
+ e != null && r != null && /* @__PURE__ */ G(p, {
2862
+ disabled: a || g && _.length == 0,
2863
+ size: "lg",
2864
+ type: "submit",
2865
+ children: [a && /* @__PURE__ */ W(d, {
2866
+ "aria-label": e,
2867
+ "data-icon": "inline-start"
2868
+ }), e]
2869
+ }),
2870
+ a && e == null && /* @__PURE__ */ W(d, { "aria-label": t })
2871
+ ] }), y = "m-auto flex w-full max-w-[420px] flex-col gap-5 rounded-xl bg-card p-6 shadow-lg shadow-black/10";
2872
+ return /* @__PURE__ */ W("main", {
2873
+ className: "open-flow-workbench",
2874
+ children: /* @__PURE__ */ W("div", {
2875
+ className: "grid h-full overflow-auto bg-muted/20 p-4",
2876
+ children: r == null ? /* @__PURE__ */ W("section", {
2877
+ "aria-busy": a,
2878
+ className: y,
2879
+ children: v
2880
+ }) : /* @__PURE__ */ W("form", {
2881
+ "aria-busy": a,
2882
+ className: y,
2883
+ onSubmit: r,
2884
+ children: v
2885
+ })
2886
+ })
2887
+ });
2888
+ }
2889
+ function Gt({ host: e, store: t }) {
3248
2890
  let n = a(t.$.notice);
3249
- return S(() => e.notify(n), [e, n]), S(() => () => e.notify(void 0), [e]), null;
2891
+ return H(() => e.notify(n), [e, n]), H(() => () => e.notify(void 0), [e]), null;
3250
2892
  }
3251
- function jt({ hrefFor: e, language: t, navigation: n, onLanguageChange: r, store: i, theme: o }) {
3252
- let s = a(i.workspace.$.flowId);
3253
- return /* @__PURE__ */ C("div", {
2893
+ function Kt({ createFlow: e, createFlowDisabled: t, createFlowField: n, flowBadges: r, hrefFor: i, hostAction: o, hostTitle: s, language: c, navigation: l, onConfigureConnector: u, onHostAction: d, onLanguageChange: f, store: p, theme: m }) {
2894
+ let h = a(p.workspace.$.flowId);
2895
+ return /* @__PURE__ */ W("div", {
3254
2896
  className: "app-shell",
3255
- children: s == null ? /* @__PURE__ */ C(ne, {
3256
- hrefForFlow: (t) => e({
3257
- flowId: t.flowId,
2897
+ children: h == null ? /* @__PURE__ */ W(Ye, {
2898
+ createFlowDisabled: t,
2899
+ createFlowField: n,
2900
+ flowBadges: r,
2901
+ hrefForFlow: (e) => i({
2902
+ flowId: e.flowId,
3258
2903
  view: "design"
3259
2904
  }),
3260
- language: t,
3261
- onCreateFlow: (e) => n.createFlow(e),
3262
- onLanguageChange: r,
3263
- onSelectFlow: (e) => void n.selectFlow(e),
3264
- store: i
3265
- }) : /* @__PURE__ */ C(re, {
3266
- fallback: /* @__PURE__ */ C("main", {
2905
+ hostAction: o,
2906
+ hostTitle: s,
2907
+ language: c,
2908
+ onCreateFlow: (t) => l.createFlow(t, e),
2909
+ onHostAction: d,
2910
+ onLanguageChange: f,
2911
+ onSelectFlow: (e) => void l.selectFlow(e),
2912
+ store: p
2913
+ }) : /* @__PURE__ */ W(Re, {
2914
+ fallback: /* @__PURE__ */ W("main", {
3267
2915
  "aria-busy": "true",
3268
2916
  className: "workspace"
3269
2917
  }),
3270
- children: /* @__PURE__ */ C(kt, {
3271
- hrefFor: e,
3272
- language: t,
3273
- navigation: n,
3274
- onLanguageChange: r,
3275
- store: i,
3276
- theme: o
2918
+ children: /* @__PURE__ */ W(Ut, {
2919
+ hostAction: o,
2920
+ hostTitle: s,
2921
+ hrefFor: i,
2922
+ navigation: l,
2923
+ onConfigureConnector: u,
2924
+ onHostAction: d,
2925
+ store: p,
2926
+ theme: m
3277
2927
  })
3278
2928
  })
3279
2929
  });
3280
2930
  }
3281
- function Mt({ host: e, hrefFor: t, language: n, location: i, onLanguageChange: a, onNavigate: o, preferences: s, theme: u }) {
3282
- let d = ae(o);
3283
- d.current = o;
3284
- let [{ i18n: f, navigation: p, store: m }] = oe(() => {
3285
- let t = l(n), r = new Ot(new c((t, n) => e.request(t, n), (t, n) => e.subscribeFlow(t, n), (t) => e.subscribeFlowCatalog(t)), s, () => crypto.randomUUID(), t, e);
2931
+ function qt({ createFlow: e, createFlowDisabled: t, createFlowField: n, flowBadges: r, host: i, hostAction: a, hostTitle: s, hrefFor: c, language: l, location: u, onConfigureConnector: d, onHostAction: f, onLanguageChange: p, onNavigate: m, preferences: h, theme: g, variables: _ = !0 }) {
2932
+ let v = Be(m);
2933
+ v.current = m;
2934
+ let [{ i18n: y, navigation: b, store: x }] = U(() => {
2935
+ let e = E(l), t = new Ht(new k((e, t) => i.request(e, t), (e, t) => i.subscribeFlow(e, t), (e) => i.subscribeFlowCatalog(e)), h, () => crypto.randomUUID(), e, i, _);
3286
2936
  return {
3287
- i18n: t,
3288
- navigation: new ce(r, i, (e, t) => d.current(e, t)),
3289
- store: r
2937
+ i18n: e,
2938
+ navigation: new He(t, u, (e, t) => v.current(e, t)),
2939
+ store: t
3290
2940
  };
3291
2941
  });
3292
- return S(() => {
3293
- p.start();
2942
+ return H(() => {
2943
+ b.start();
3294
2944
  let e = () => {
3295
- m.connectors.refreshAfterAuthorization(), m.triggers.refreshAfterAuthorization();
2945
+ x.connectors.refreshAfterAuthorization(), x.triggers.refreshAfterAuthorization(), x.refreshVariableNames();
3296
2946
  };
3297
2947
  return globalThis.addEventListener("focus", e), () => {
3298
- globalThis.removeEventListener("focus", e), p.dispose(), m.dispose(), f.dispose();
2948
+ globalThis.removeEventListener("focus", e), b.dispose(), x.dispose(), y.dispose();
3299
2949
  };
3300
2950
  }, [
3301
- f,
3302
- p,
3303
- m
3304
- ]), S(() => void p.apply(i), [i, p]), S(() => {
3305
- f.lang != n && f.switchLang(n);
3306
- }, [f, n]), /* @__PURE__ */ C(r, {
3307
- i18n: f,
3308
- children: /* @__PURE__ */ se("div", {
3309
- className: "open-flow-workbench",
3310
- "data-theme": u,
3311
- children: [/* @__PURE__ */ C(At, {
3312
- host: e,
3313
- store: m
3314
- }), /* @__PURE__ */ C(jt, {
3315
- hrefFor: t,
3316
- language: n,
3317
- navigation: p,
3318
- onLanguageChange: a,
3319
- store: m,
3320
- theme: u
2951
+ y,
2952
+ b,
2953
+ x
2954
+ ]), H(() => void b.apply(u), [u, b]), H(() => {
2955
+ y.lang != l && y.switchLang(l);
2956
+ }, [y, l]), /* @__PURE__ */ W(o, {
2957
+ i18n: y,
2958
+ children: /* @__PURE__ */ G("div", {
2959
+ className: "open-flow-theme open-flow-workbench",
2960
+ "data-theme": g,
2961
+ children: [/* @__PURE__ */ W(Gt, {
2962
+ host: i,
2963
+ store: x
2964
+ }), /* @__PURE__ */ W(Kt, {
2965
+ createFlow: e,
2966
+ createFlowDisabled: t,
2967
+ createFlowField: n,
2968
+ flowBadges: r,
2969
+ hostAction: a,
2970
+ hostTitle: s,
2971
+ hrefFor: c,
2972
+ language: l,
2973
+ navigation: b,
2974
+ onConfigureConnector: d,
2975
+ onHostAction: f,
2976
+ onLanguageChange: p,
2977
+ store: x,
2978
+ theme: g
3321
2979
  })]
3322
2980
  })
3323
2981
  });
3324
2982
  }
3325
- function Nt({ sessionKey: e, ...t }) {
3326
- return /* @__PURE__ */ C(Mt, { ...t }, e);
2983
+ function Jt({ sessionKey: e, ...t }) {
2984
+ return /* @__PURE__ */ W(qt, { ...t }, e);
3327
2985
  }
3328
2986
  //#endregion
3329
- export { Nt as OpenFlowWorkbench };
2987
+ export { Wt as OpenFlowSessionGate, Jt as OpenFlowWorkbench, Ie as isWorkbenchLanguage, Le as resolveWorkbenchLanguage, Fe as workbenchLanguageNames, V as workbenchLanguages };