@oomol-lab/open-flow 0.1.0-beta.16 → 0.1.0-beta.17

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 (30) hide show
  1. package/dist/browser/{createResourceDialog-DRUIXBbz.js → createResourceDialog-DOWv3Zj0.js} +2 -2
  2. package/dist/browser/flow-authoring.js +1464 -1463
  3. package/dist/browser/flow-change.js +1 -0
  4. package/dist/browser/{flowChanges-iuoam3Bx.js → flowChanges-BDLNaCWZ.js} +1743 -1482
  5. package/dist/browser/{flowWorkspace-B0UAQ-s7.js → flowWorkspace-BtNfkYuG.js} +32422 -29399
  6. package/dist/browser/{i18n-JtW9O5x3.js → i18n-CNu41MKH.js} +153 -13
  7. package/dist/browser/{inputValues-DICmJoN-.js → inputValues-CQlPBtdF.js} +2 -2
  8. package/dist/browser/licenses.md +48 -0
  9. package/dist/browser/{markdownContent-tWc7bRAs.js → markdownContent-BBgH9ZIV.js} +13 -13
  10. package/dist/browser/theme.css +9 -9
  11. package/dist/browser/ui.css +1 -1
  12. package/dist/browser/ui.d.ts +9 -0
  13. package/dist/browser/ui.js +1219 -1022
  14. package/dist/browser/{useValueChanged-DSookOEC.js → useValueChanged-DUuqLWPg.js} +3 -3
  15. package/dist/browser/workbench.css +1 -1
  16. package/dist/browser/workbench.js +931 -629
  17. package/dist/browser/{workbenchSelect-DgxXqCAa.js → workbenchSelect-Bb3cewZj.js} +4 -3
  18. package/dist/common/control-api-conformance.js +389 -394
  19. package/dist/common/control-api-errors.d.ts +5 -0
  20. package/dist/common/control-api.d.ts +1 -6
  21. package/dist/common/control-api.js +1019 -1003
  22. package/dist/common/control-requests.js +1 -0
  23. package/dist/common/engine-contract.d.ts +2 -0
  24. package/dist/common/flow-encoding.js +1 -0
  25. package/dist/common/flow-semantics.js +2802 -2767
  26. package/dist/common/mcp.js +409 -391
  27. package/dist/common/runtime-contract.d.ts +2 -1
  28. package/dist/common/runtime-contract.js +99 -28
  29. package/dist/common/scheduler.js +1254 -1253
  30. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
1
  import { a as e, i as t, l as n } from "./dist-Dz6Nglsd.js";
2
2
  import { a as r, i, r as a, t as o } from "./main-BDnNHhkU.js";
3
- import { C as s, D as c, Et as l, F as u, G as d, H as f, I as p, Jt as m, Kt as h, M as g, N as _, O as v, P as y, Q as b, S as x, St as S, T as C, W as w, X as T, Xt as E, Y as D, Yt as O, Z as k, _ as A, _t as j, a as M, at as N, b as ee, bt as te, c as ne, ct as re, d as ie, dt as ae, et as oe, f as se, ft as ce, g as le, gt as ue, h as de, ht as fe, it as pe, j as me, k as he, l as ge, lt as _e, m as ve, mt as ye, nt as be, o as xe, ot as Se, p as Ce, pt as we, q as Te, qt as Ee, r as P, rt as De, s as Oe, st as ke, t as Ae, tt as je, u as Me, ut as F, v as Ne, vt as Pe, w as Fe, wt as Ie, x as Le, y as Re, yt as ze } from "./flowChanges-iuoam3Bx.js";
4
- import { Y as Be, c as I, i as Ve, q as L } from "./useValueChanged-DSookOEC.js";
5
- import { $t as He, An as Ue, C as We, Dn as Ge, E as Ke, Nt as qe, On as Je, Rt as Ye, S as Xe, T as Ze, Tn as Qe, b as $e, kn as R, l as z, t as et, w as tt, x as nt, zt as B } from "./workbenchSelect-DgxXqCAa.js";
6
- import { t as V } from "./i18n-JtW9O5x3.js";
7
- import { i as rt, n as it, r as at, t as ot } from "./languages-C0zQ4GSo.js";
8
- import { Suspense as st, lazy as ct, useEffect as H, useRef as U, useState as W } from "react";
9
- import { Fragment as lt, jsx as G, jsxs as K } from "react/jsx-runtime";
10
- import * as ut from "effect/Cause";
11
- import * as q from "effect/Effect";
12
- import * as dt from "effect/Exit";
13
- import * as ft from "effect/Fiber";
3
+ import { $ as s, $t as c, A as l, C as u, Ct as d, D as f, Dt as p, F as m, G as h, I as g, J as _, L as v, M as y, N as b, O as x, P as S, Q as C, Qt as w, R as T, S as E, St as D, T as O, Tt as ee, X as k, Zt as A, _ as j, _t as te, a as M, at as ne, b as re, bt as ie, c as ae, ct as oe, d as se, dt as ce, en as le, et as ue, f as de, ft as fe, g as pe, gt as me, h as he, ht as ge, it as _e, jt as ve, k as N, l as ye, lt as be, m as xe, mt as Se, o as Ce, ot as we, p as Te, pt as P, q as F, r as I, rt as Ee, s as De, st as Oe, t as ke, tn as L, tt as Ae, u as je, ut as Me, v as Ne, vt as Pe, w as Fe, x as Ie, xt as Le, y as Re, yt as ze, z as R } from "./flowChanges-BDLNaCWZ.js";
4
+ import { Y as Be, c as z, i as B, q as V } from "./useValueChanged-DUuqLWPg.js";
5
+ import { $t as Ve, An as He, C as Ue, Dn as We, E as Ge, Nt as Ke, On as qe, Pt as Je, Rt as Ye, S as Xe, T as Ze, Tn as Qe, b as $e, kn as et, l as H, t as tt, w as nt, x as rt, zt as U } from "./workbenchSelect-Bb3cewZj.js";
6
+ import { t as W } from "./i18n-CNu41MKH.js";
7
+ import { i as it, n as at, r as ot, t as st } from "./languages-C0zQ4GSo.js";
8
+ import { Suspense as ct, lazy as lt, useEffect as G, useRef as K, useState as q } from "react";
9
+ import { Fragment as ut, jsx as J, jsxs as Y } from "react/jsx-runtime";
10
+ import * as dt from "effect/Cause";
11
+ import * as X from "effect/Effect";
12
+ import * as ft from "effect/Exit";
13
+ import * as pt from "effect/Fiber";
14
14
  //#region src/workbench/browser/runtime/navigation.ts
15
- var pt = class {
15
+ var mt = class {
16
16
  #e;
17
17
  #t;
18
18
  #n;
@@ -71,7 +71,7 @@ var pt = class {
71
71
  this.#s = !0, await this.#n.selectFlow(void 0), e == this.#i && (this.#u("design", !1), this.#s = !1);
72
72
  }
73
73
  async apply(e) {
74
- if (mt(e, this.#t)) return;
74
+ if (ht(e, this.#t)) return;
75
75
  this.#t = e;
76
76
  let t = ++this.#i;
77
77
  this.#s = !0;
@@ -87,59 +87,59 @@ var pt = class {
87
87
  flowId: n,
88
88
  view: n == null ? "design" : e
89
89
  };
90
- mt(r, this.#t) || (this.#t = r, this.#e(r, { replace: t })), this.#r.set(r.view);
90
+ ht(r, this.#t) || (this.#t = r, this.#e(r, { replace: t })), this.#r.set(r.view);
91
91
  }
92
92
  };
93
- function mt(e, t) {
93
+ function ht(e, t) {
94
94
  return e.flowId == t.flowId && e.view == t.view;
95
95
  }
96
96
  //#endregion
97
97
  //#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
98
- var ht = ct(() => import("./createResourceDialog-DRUIXBbz.js")), gt = rt.map((e) => ({
99
- label: at[e],
98
+ var gt = lt(() => import("./createResourceDialog-DOWv3Zj0.js")), _t = it.map((e) => ({
99
+ label: ot[e],
100
100
  value: e
101
101
  }));
102
- function _t({ language: e, onLanguageChange: t }) {
103
- let n = i(), [r, a] = W(null);
104
- return t == null ? null : /* @__PURE__ */ K("div", {
102
+ function vt({ language: e, onLanguageChange: t }) {
103
+ let n = i(), [r, a] = q(null);
104
+ return t == null ? null : /* @__PURE__ */ Y("div", {
105
105
  className: "resource-language",
106
106
  ref: a,
107
- children: [/* @__PURE__ */ G("span", {
107
+ children: [/* @__PURE__ */ J("span", {
108
108
  className: "sr-only",
109
109
  children: n("language.label")
110
- }), /* @__PURE__ */ G(et, {
110
+ }), /* @__PURE__ */ J(tt, {
111
111
  ariaLabel: n("language.label"),
112
112
  onValueChange: (e) => t(e),
113
- options: gt,
113
+ options: _t,
114
114
  portalRoot: r,
115
115
  value: e
116
116
  })]
117
117
  });
118
118
  }
119
- function vt({ badge: e, busy: t, flow: n, href: r, onSelect: o, store: s }) {
120
- let [c, u] = W(null), d = U(null), f = U(null), p = U(null), m = a(), g = i(), [_, v] = W("idle"), [y, b] = W(n.name), [x, C] = W(), w = n.live != null && n.live.revisionId != n.draftRevisionId;
121
- async function T(e) {
122
- C(e == "publish" ? "publish" : "enabled");
119
+ function yt({ badge: e, busy: t, flow: n, href: r, onSelect: o, store: s }) {
120
+ let [c, l] = q(null), u = K(null), f = K(null), m = K(null), h = a(), g = i(), [_, v] = q("idle"), [y, b] = q(n.name), [x, S] = q(), C = n.live != null && n.live.revisionId != n.draftRevisionId;
121
+ async function w(e) {
122
+ S(e == "publish" ? "publish" : "enabled");
123
123
  try {
124
124
  e == "publish" ? await s.workspace.publishFlow(n) : await s.workspace.setFlowEnabled(n, e);
125
125
  } finally {
126
- C(void 0);
126
+ S(void 0);
127
127
  }
128
128
  }
129
- let E = B(y);
130
- async function D(e) {
129
+ let T = U(y);
130
+ async function E(e) {
131
131
  e.preventDefault();
132
132
  let t = y.trim();
133
- B(t) == null && await s.workspace.renameFlow(n.flowId, t) && v("idle");
133
+ U(t) == null && await s.workspace.renameFlow(n.flowId, t) && v("idle");
134
134
  }
135
- async function O() {
135
+ async function D() {
136
136
  await s.workspace.deleteFlow(n.flowId) && v("idle");
137
137
  }
138
- return /* @__PURE__ */ K("div", {
138
+ return /* @__PURE__ */ Y("div", {
139
139
  className: "resource-item-row",
140
- ref: u,
140
+ ref: l,
141
141
  children: [
142
- /* @__PURE__ */ K(L, {
142
+ /* @__PURE__ */ Y(V, {
143
143
  "aria-disabled": n.status == "retiring",
144
144
  className: "resource-list-row flow-columns",
145
145
  nativeButton: !1,
@@ -148,123 +148,123 @@ function vt({ badge: e, busy: t, flow: n, href: r, onSelect: o, store: s }) {
148
148
  e.preventDefault();
149
149
  return;
150
150
  }
151
- re(e, () => o(n));
151
+ ce(e, () => o(n));
152
152
  },
153
- render: /* @__PURE__ */ G("a", { href: n.status == "retiring" ? void 0 : r }),
153
+ render: /* @__PURE__ */ J("a", { href: n.status == "retiring" ? void 0 : r }),
154
154
  tabIndex: n.status == "retiring" ? -1 : void 0,
155
155
  variant: "ghost",
156
156
  children: [
157
- /* @__PURE__ */ K("span", {
157
+ /* @__PURE__ */ Y("span", {
158
158
  className: "resource-primary-cell",
159
- children: [/* @__PURE__ */ G("span", {
159
+ children: [/* @__PURE__ */ J("span", {
160
160
  className: "resource-icon",
161
- children: /* @__PURE__ */ G(z, { name: "flow" })
162
- }), /* @__PURE__ */ K("span", { children: [/* @__PURE__ */ K("span", {
161
+ children: /* @__PURE__ */ J(H, { name: "flow" })
162
+ }), /* @__PURE__ */ Y("span", { children: [/* @__PURE__ */ Y("span", {
163
163
  className: "flex min-w-0 items-center gap-2",
164
- children: [/* @__PURE__ */ G("strong", {
164
+ children: [/* @__PURE__ */ J("strong", {
165
165
  className: "min-w-0 truncate",
166
166
  children: n.name
167
- }), e != null && /* @__PURE__ */ G(h, {
167
+ }), e != null && /* @__PURE__ */ J(A, {
168
168
  className: "min-w-0 shrink",
169
169
  title: e,
170
170
  variant: "secondary",
171
- children: /* @__PURE__ */ G("span", {
171
+ children: /* @__PURE__ */ J("span", {
172
172
  className: "truncate",
173
173
  children: e
174
174
  })
175
175
  })]
176
- }), /* @__PURE__ */ G("code", {
176
+ }), /* @__PURE__ */ J("code", {
177
177
  translate: "no",
178
178
  children: n.flowId
179
179
  })] })]
180
180
  }),
181
- /* @__PURE__ */ G("time", {
181
+ /* @__PURE__ */ J("time", {
182
182
  dateTime: n.updatedAt,
183
- children: new Date(n.updatedAt).toLocaleString(m)
183
+ children: new Date(n.updatedAt).toLocaleString(h)
184
184
  }),
185
- /* @__PURE__ */ G("span", {
185
+ /* @__PURE__ */ J("span", {
186
186
  className: "resource-status",
187
- children: g(n.status == "retiring" ? "resource.retiring" : n.live == null ? "resource.notPublished" : w ? "resource.unpublishedChanges" : "resource.isPublished")
187
+ children: g(n.status == "retiring" ? "resource.retiring" : n.live == null ? "resource.notPublished" : C ? "resource.unpublishedChanges" : "resource.isPublished")
188
188
  })
189
189
  ]
190
190
  }),
191
- /* @__PURE__ */ K("div", {
191
+ /* @__PURE__ */ Y("div", {
192
192
  className: "resource-live-controls",
193
193
  "aria-busy": x != null,
194
- children: [n.live == null ? /* @__PURE__ */ G("span", {
194
+ children: [n.live == null ? /* @__PURE__ */ J("span", {
195
195
  className: "resource-status",
196
196
  title: g("resource.publishFirst"),
197
197
  children: "—"
198
- }) : /* @__PURE__ */ K(Ue, {
198
+ }) : /* @__PURE__ */ Y(He, {
199
199
  className: "resource-enable",
200
200
  title: g("resource.enabledHint"),
201
- children: [/* @__PURE__ */ G(_e, {
201
+ children: [/* @__PURE__ */ J(fe, {
202
202
  "aria-label": g("resource.enableFlow", { name: n.name }),
203
203
  checked: n.live?.enabled ?? !1,
204
204
  disabled: n.status != "active" || n.live == null || t != null || x != null,
205
- onCheckedChange: (e) => void T(e),
205
+ onCheckedChange: (e) => void w(e),
206
206
  size: "sm"
207
- }), /* @__PURE__ */ G("span", { children: g(n.live?.enabled ? "resource.enabled" : "resource.disabled") })]
208
- }), /* @__PURE__ */ G(L, {
209
- disabled: n.status != "active" || t != null || x != null || n.live != null && !w,
210
- onClick: () => void T("publish"),
207
+ }), /* @__PURE__ */ J("span", { children: g(n.live?.enabled ? "resource.enabled" : "resource.disabled") })]
208
+ }), /* @__PURE__ */ J(V, {
209
+ disabled: n.status != "active" || t != null || x != null || n.live != null && !C,
210
+ onClick: () => void w("publish"),
211
211
  size: "sm",
212
212
  variant: "outline",
213
213
  children: g(x == "publish" ? "workspace.publishing" : n.live == null ? "resource.publish" : "resource.publishUpdate")
214
214
  })]
215
215
  }),
216
- n.status == "active" && /* @__PURE__ */ K(te, { children: [/* @__PURE__ */ G(l, {
216
+ n.status == "active" && /* @__PURE__ */ Y(d, { children: [/* @__PURE__ */ J(ve, {
217
217
  "aria-label": g("sidebar.flowActions", { name: n.name }),
218
218
  disabled: t != null || x != null,
219
- render: /* @__PURE__ */ G(L, {
219
+ render: /* @__PURE__ */ J(V, {
220
220
  className: "resource-row-more",
221
- ref: d,
221
+ ref: u,
222
222
  size: "icon-sm",
223
223
  variant: "ghost",
224
- children: /* @__PURE__ */ G(z, { name: "more" })
224
+ children: /* @__PURE__ */ J(H, { name: "more" })
225
225
  })
226
- }), /* @__PURE__ */ K(S, {
226
+ }), /* @__PURE__ */ Y(ee, {
227
227
  align: "end",
228
228
  className: "min-w-36",
229
229
  container: c,
230
230
  finalFocus: _ == "idle",
231
- children: [/* @__PURE__ */ G(Ie, {
231
+ children: [/* @__PURE__ */ J(p, {
232
232
  onClick: () => {
233
233
  b(n.name), v("rename");
234
234
  },
235
235
  children: g("common.rename")
236
- }), /* @__PURE__ */ G(Ie, {
236
+ }), /* @__PURE__ */ J(p, {
237
237
  onClick: () => v("delete"),
238
238
  variant: "destructive",
239
239
  children: g("common.delete")
240
240
  })]
241
241
  })] }),
242
- /* @__PURE__ */ G($e, {
242
+ /* @__PURE__ */ J($e, {
243
243
  open: _ == "rename",
244
244
  onOpenChange: (e) => {
245
245
  e || v("idle");
246
246
  },
247
- children: /* @__PURE__ */ G(Xe, {
247
+ children: /* @__PURE__ */ J(Xe, {
248
248
  container: c,
249
249
  initialFocus: f,
250
- finalFocus: d,
250
+ finalFocus: u,
251
251
  closeLabel: g("common.cancel"),
252
- children: /* @__PURE__ */ K("form", {
252
+ children: /* @__PURE__ */ Y("form", {
253
253
  className: "flex flex-col gap-4",
254
- onSubmit: (e) => void D(e),
254
+ onSubmit: (e) => void E(e),
255
255
  children: [
256
- /* @__PURE__ */ G(Ze, { children: /* @__PURE__ */ G(Ke, { children: g("sidebar.renameFlow", { name: n.name }) }) }),
257
- /* @__PURE__ */ K(Qe, {
258
- "data-invalid": y.length > 0 && E != null,
256
+ /* @__PURE__ */ J(Ze, { children: /* @__PURE__ */ J(Ge, { children: g("sidebar.renameFlow", { name: n.name }) }) }),
257
+ /* @__PURE__ */ Y(Qe, {
258
+ "data-invalid": y.length > 0 && T != null,
259
259
  children: [
260
- /* @__PURE__ */ G(R, {
260
+ /* @__PURE__ */ J(et, {
261
261
  htmlFor: `rename-flow-${n.flowId}`,
262
262
  children: g("resource.flowName")
263
263
  }),
264
- /* @__PURE__ */ G(I, {
264
+ /* @__PURE__ */ J(z, {
265
265
  autoComplete: "off",
266
- "aria-invalid": y.length > 0 && E != null,
267
- "aria-describedby": y.length > 0 && E != null ? `rename-error-${n.flowId}` : void 0,
266
+ "aria-invalid": y.length > 0 && T != null,
267
+ "aria-describedby": y.length > 0 && T != null ? `rename-error-${n.flowId}` : void 0,
268
268
  id: `rename-flow-${n.flowId}`,
269
269
  name: "flow-name",
270
270
  onChange: (e) => b(e.target.value),
@@ -272,18 +272,18 @@ function vt({ badge: e, busy: t, flow: n, href: r, onSelect: o, store: s }) {
272
272
  required: !0,
273
273
  value: y
274
274
  }),
275
- y.length > 0 && E != null && /* @__PURE__ */ G(Ge, {
275
+ y.length > 0 && T != null && /* @__PURE__ */ J(We, {
276
276
  id: `rename-error-${n.flowId}`,
277
- children: g(`resource.nameIssue.${E}`, { max: 80 })
277
+ children: g(`resource.nameIssue.${T}`, { max: 80 })
278
278
  })
279
279
  ]
280
280
  }),
281
- /* @__PURE__ */ K(tt, { children: [/* @__PURE__ */ G(nt, {
282
- render: /* @__PURE__ */ G(L, { variant: "outline" }),
281
+ /* @__PURE__ */ Y(nt, { children: [/* @__PURE__ */ J(rt, {
282
+ render: /* @__PURE__ */ J(V, { variant: "outline" }),
283
283
  type: "button",
284
284
  children: g("common.cancel")
285
- }), /* @__PURE__ */ G(L, {
286
- disabled: t != null || E != null,
285
+ }), /* @__PURE__ */ J(V, {
286
+ disabled: t != null || T != null,
287
287
  type: "submit",
288
288
  children: g("common.save")
289
289
  })] })
@@ -291,25 +291,25 @@ function vt({ badge: e, busy: t, flow: n, href: r, onSelect: o, store: s }) {
291
291
  })
292
292
  })
293
293
  }),
294
- /* @__PURE__ */ G($e, {
294
+ /* @__PURE__ */ J($e, {
295
295
  open: _ == "delete",
296
296
  onOpenChange: (e) => {
297
297
  e || v("idle");
298
298
  },
299
- children: /* @__PURE__ */ K(Xe, {
299
+ children: /* @__PURE__ */ Y(Xe, {
300
300
  container: c,
301
- initialFocus: p,
302
- finalFocus: d,
301
+ initialFocus: m,
302
+ finalFocus: u,
303
303
  showCloseButton: !1,
304
- children: [/* @__PURE__ */ K(Ze, { children: [/* @__PURE__ */ G(Ke, { children: g("sidebar.deleteFlowConfirm", { name: n.name }) }), /* @__PURE__ */ G(We, { children: g("resource.deleteDescription") })] }), /* @__PURE__ */ K(tt, { children: [/* @__PURE__ */ G(nt, {
305
- render: /* @__PURE__ */ G(L, {
306
- ref: p,
304
+ children: [/* @__PURE__ */ Y(Ze, { children: [/* @__PURE__ */ J(Ge, { children: g("sidebar.deleteFlowConfirm", { name: n.name }) }), /* @__PURE__ */ J(Ue, { children: g("resource.deleteDescription") })] }), /* @__PURE__ */ Y(nt, { children: [/* @__PURE__ */ J(rt, {
305
+ render: /* @__PURE__ */ J(V, {
306
+ ref: m,
307
307
  variant: "outline"
308
308
  }),
309
309
  children: g("common.cancel")
310
- }), /* @__PURE__ */ G(L, {
310
+ }), /* @__PURE__ */ J(V, {
311
311
  disabled: t != null,
312
- onClick: () => void O(),
312
+ onClick: () => void D(),
313
313
  variant: "destructive",
314
314
  children: g(t == "flow" ? "common.deleting" : "common.delete")
315
315
  })] })]
@@ -318,94 +318,94 @@ function vt({ badge: e, busy: t, flow: n, href: r, onSelect: o, store: s }) {
318
318
  ]
319
319
  });
320
320
  }
321
- function yt() {
322
- return /* @__PURE__ */ K("div", {
321
+ function bt() {
322
+ return /* @__PURE__ */ Y("div", {
323
323
  "aria-hidden": "true",
324
324
  className: "resource-list-row resource-skeleton-row flow-columns",
325
325
  children: [
326
- /* @__PURE__ */ K("span", {
326
+ /* @__PURE__ */ Y("span", {
327
327
  className: "resource-primary-cell",
328
- children: [/* @__PURE__ */ G(F, { className: "size-8 shrink-0" }), /* @__PURE__ */ K("span", {
328
+ children: [/* @__PURE__ */ J(P, { className: "size-8 shrink-0" }), /* @__PURE__ */ Y("span", {
329
329
  className: "resource-skeleton-copy",
330
- children: [/* @__PURE__ */ G(F, { className: "h-3.5 w-36" }), /* @__PURE__ */ G(F, { className: "h-2.5 w-48 max-w-full" })]
330
+ children: [/* @__PURE__ */ J(P, { className: "h-3.5 w-36" }), /* @__PURE__ */ J(P, { className: "h-2.5 w-48 max-w-full" })]
331
331
  })]
332
332
  }),
333
- /* @__PURE__ */ G(F, { className: "h-3 w-28" }),
334
- /* @__PURE__ */ G(F, { className: "h-3 w-16" })
333
+ /* @__PURE__ */ J(P, { className: "h-3 w-28" }),
334
+ /* @__PURE__ */ J(P, { className: "h-3 w-16" })
335
335
  ]
336
336
  });
337
337
  }
338
- function bt({ catalogWidth: e, createFlowDisabled: t, createFlowField: n, flowBadges: a, hrefForFlow: o, hostAction: s, hostTitle: c, language: l, onCreateFlow: u, onHostAction: d, onLanguageChange: f, onSelectFlow: p, store: m }) {
339
- let h = i(), g = r(m.workspace.$.busy), _ = r(m.workspace.$.flowLoadFailed), v = r(m.workspace.$.flowLoadMoreFailed), y = r(m.workspace.$.flowLoading), b = r(m.workspace.$.flowLoadingMore), x = r(m.workspace.$.flowNextCursor), S = r(m.workspace.$.flowRefreshing), C = r(m.workspace.$.flows), w = r(m.workspace.$.flowTotal), [T, E] = W(!1), [D, O] = W(""), [k, A] = W(""), M = D.trim().toLocaleLowerCase(), N = C.filter((e) => e.name.toLocaleLowerCase().includes(M));
340
- async function ee(e) {
338
+ function xt({ catalogWidth: e, createFlowDisabled: t, createFlowField: n, flowBadges: a, hrefForFlow: o, hostAction: s, hostTitle: c, language: l, onCreateFlow: u, onHostAction: d, onLanguageChange: f, onSelectFlow: p, store: m }) {
339
+ let h = i(), g = r(m.workspace.$.busy), _ = r(m.workspace.$.flowLoadFailed), v = r(m.workspace.$.flowLoadMoreFailed), y = r(m.workspace.$.flowLoading), b = r(m.workspace.$.flowLoadingMore), x = r(m.workspace.$.flowNextCursor), S = r(m.workspace.$.flowRefreshing), C = r(m.workspace.$.flows), w = r(m.workspace.$.flowTotal), [T, E] = q(!1), [O, ee] = q(""), [k, A] = q(""), j = O.trim().toLocaleLowerCase(), M = C.filter((e) => e.name.toLocaleLowerCase().includes(j));
340
+ async function ne(e) {
341
341
  e.preventDefault();
342
342
  let t = k.trim();
343
- B(t) != null || !await u(t) || (E(!1), A(""));
343
+ U(t) != null || !await u(t) || (E(!1), A(""));
344
344
  }
345
- return /* @__PURE__ */ G("main", {
345
+ return /* @__PURE__ */ J("main", {
346
346
  className: "resource-browser",
347
- children: /* @__PURE__ */ K("div", {
347
+ children: /* @__PURE__ */ Y("div", {
348
348
  className: Be("resource-page", e != "default" && "resource-page-full"),
349
349
  children: [
350
- /* @__PURE__ */ G("h1", {
350
+ /* @__PURE__ */ J("h1", {
351
351
  className: "sr-only",
352
352
  children: h("resource.flows")
353
353
  }),
354
- /* @__PURE__ */ K("section", {
354
+ /* @__PURE__ */ Y("section", {
355
355
  "aria-labelledby": "flow-list-title",
356
356
  className: "resource-list-section",
357
357
  children: [
358
- /* @__PURE__ */ K("div", {
358
+ /* @__PURE__ */ Y("div", {
359
359
  className: "resource-list-title",
360
- children: [/* @__PURE__ */ K("div", {
360
+ children: [/* @__PURE__ */ Y("div", {
361
361
  className: "resource-list-heading",
362
- children: [/* @__PURE__ */ G("h2", {
362
+ children: [/* @__PURE__ */ J("h2", {
363
363
  id: "flow-list-title",
364
364
  children: h("resource.allFlows")
365
- }), !y && /* @__PURE__ */ G("span", { children: h("resource.flowCount", { count: w ?? C.length }) })]
366
- }), /* @__PURE__ */ K("div", {
365
+ }), !y && /* @__PURE__ */ J("span", { children: h("resource.flowCount", { count: w ?? C.length }) })]
366
+ }), /* @__PURE__ */ Y("div", {
367
367
  className: "resource-list-actions",
368
368
  children: [
369
- /* @__PURE__ */ G(_t, {
369
+ /* @__PURE__ */ J(vt, {
370
370
  language: l,
371
371
  onLanguageChange: f
372
372
  }),
373
- /* @__PURE__ */ K(ae, {
373
+ /* @__PURE__ */ Y(Se, {
374
374
  className: "w-full sm:w-56",
375
- children: [/* @__PURE__ */ G(ce, { children: /* @__PURE__ */ G(z, {
375
+ children: [/* @__PURE__ */ J(ge, { children: /* @__PURE__ */ J(H, {
376
376
  name: "search",
377
377
  size: 17
378
- }) }), /* @__PURE__ */ G(we, {
378
+ }) }), /* @__PURE__ */ J(me, {
379
379
  autoComplete: "off",
380
380
  "aria-label": h("resource.searchFlows"),
381
381
  name: "flow-search",
382
- onChange: (e) => O(e.target.value),
382
+ onChange: (e) => ee(e.target.value),
383
383
  placeholder: h("resource.searchFlows"),
384
- value: D
384
+ value: O
385
385
  })]
386
386
  }),
387
- /* @__PURE__ */ G(L, {
387
+ /* @__PURE__ */ J(V, {
388
388
  "aria-label": h("common.refresh"),
389
389
  disabled: y || S || g != null,
390
390
  onClick: () => void m.workspace.reloadFlows(),
391
391
  size: "icon",
392
392
  title: h("common.refresh"),
393
393
  variant: "outline",
394
- children: /* @__PURE__ */ G(z, {
394
+ children: /* @__PURE__ */ J(H, {
395
395
  className: S ? "animate-spin" : void 0,
396
396
  name: "refresh"
397
397
  })
398
398
  }),
399
- /* @__PURE__ */ K(L, {
399
+ /* @__PURE__ */ Y(V, {
400
400
  className: "resource-page-primary-action",
401
401
  disabled: g != null,
402
402
  onClick: () => E(!0),
403
- children: [/* @__PURE__ */ G(z, {
403
+ children: [/* @__PURE__ */ J(H, {
404
404
  "data-icon": "inline-start",
405
405
  name: "plus"
406
406
  }), h("resource.newFlow")]
407
407
  }),
408
- s != null && c != null && d != null && /* @__PURE__ */ G(ke, {
408
+ s != null && c != null && d != null && /* @__PURE__ */ J(Me, {
409
409
  action: s,
410
410
  onAction: d,
411
411
  title: c
@@ -413,57 +413,57 @@ function bt({ catalogWidth: e, createFlowDisabled: t, createFlowField: n, flowBa
413
413
  ]
414
414
  })]
415
415
  }),
416
- /* @__PURE__ */ K("div", {
416
+ /* @__PURE__ */ Y("div", {
417
417
  "aria-hidden": "true",
418
418
  className: "resource-list-columns flow-columns",
419
419
  children: [
420
- /* @__PURE__ */ G("span", { children: h("resource.name") }),
421
- /* @__PURE__ */ G("span", { children: h("resource.updated") }),
422
- /* @__PURE__ */ G("span", { children: h("resource.publication") }),
423
- /* @__PURE__ */ G("span", { children: h("resource.enabledColumn") })
420
+ /* @__PURE__ */ J("span", { children: h("resource.name") }),
421
+ /* @__PURE__ */ J("span", { children: h("resource.updated") }),
422
+ /* @__PURE__ */ J("span", { children: h("resource.publication") }),
423
+ /* @__PURE__ */ J("span", { children: h("resource.enabledColumn") })
424
424
  ]
425
425
  }),
426
- /* @__PURE__ */ G("div", {
426
+ /* @__PURE__ */ J("div", {
427
427
  className: "resource-list",
428
- children: y ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ G(yt, {}, t)) : _ ? /* @__PURE__ */ K(ye, {
428
+ children: y ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ J(bt, {}, t)) : _ ? /* @__PURE__ */ Y(te, {
429
429
  className: "min-h-64",
430
430
  role: "alert",
431
- children: [/* @__PURE__ */ K(j, { children: [
432
- /* @__PURE__ */ G(Pe, {
431
+ children: [/* @__PURE__ */ Y(ie, { children: [
432
+ /* @__PURE__ */ J(Le, {
433
433
  variant: "icon",
434
- children: /* @__PURE__ */ G(z, {
434
+ children: /* @__PURE__ */ J(H, {
435
435
  name: "alert",
436
436
  size: 20
437
437
  })
438
438
  }),
439
- /* @__PURE__ */ G(ze, { children: h("resource.flowsLoadFailed") }),
440
- /* @__PURE__ */ G(ue, { children: h("resource.flowsLoadFailedDescription") })
441
- ] }), /* @__PURE__ */ G(fe, { children: /* @__PURE__ */ G(L, {
439
+ /* @__PURE__ */ J(D, { children: h("resource.flowsLoadFailed") }),
440
+ /* @__PURE__ */ J(ze, { children: h("resource.flowsLoadFailedDescription") })
441
+ ] }), /* @__PURE__ */ J(Pe, { children: /* @__PURE__ */ J(V, {
442
442
  onClick: () => void m.retryFlows(),
443
443
  variant: "outline",
444
444
  children: h("empty.retry")
445
445
  }) })]
446
- }) : N.length == 0 ? /* @__PURE__ */ K(ye, {
446
+ }) : M.length == 0 ? /* @__PURE__ */ Y(te, {
447
447
  className: "min-h-64",
448
- children: [/* @__PURE__ */ K(j, { children: [
449
- /* @__PURE__ */ G(Pe, {
448
+ children: [/* @__PURE__ */ Y(ie, { children: [
449
+ /* @__PURE__ */ J(Le, {
450
450
  variant: "icon",
451
- children: /* @__PURE__ */ G(z, {
451
+ children: /* @__PURE__ */ J(H, {
452
452
  name: "flow",
453
453
  size: 20
454
454
  })
455
455
  }),
456
- /* @__PURE__ */ G(ze, { children: h(M.length == 0 ? "resource.noFlows" : "resource.noMatchingFlows") }),
457
- /* @__PURE__ */ G(ue, { children: h(M.length == 0 ? "resource.noFlowsDescription" : "resource.noMatchingDescription") })
458
- ] }), M.length == 0 && /* @__PURE__ */ G(fe, { children: /* @__PURE__ */ K(L, {
456
+ /* @__PURE__ */ J(D, { children: h(j.length == 0 ? "resource.noFlows" : "resource.noMatchingFlows") }),
457
+ /* @__PURE__ */ J(ze, { children: h(j.length == 0 ? "resource.noFlowsDescription" : "resource.noMatchingDescription") })
458
+ ] }), j.length == 0 && /* @__PURE__ */ J(Pe, { children: /* @__PURE__ */ Y(V, {
459
459
  onClick: () => E(!0),
460
460
  variant: "outline",
461
- children: [/* @__PURE__ */ G(z, {
461
+ children: [/* @__PURE__ */ J(H, {
462
462
  "data-icon": "inline-start",
463
463
  name: "plus"
464
464
  }), h("resource.newFlow")]
465
465
  }) })]
466
- }) : N.map((e) => /* @__PURE__ */ G(vt, {
466
+ }) : M.map((e) => /* @__PURE__ */ J(yt, {
467
467
  badge: a?.[e.flowId],
468
468
  busy: g,
469
469
  flow: e,
@@ -472,9 +472,9 @@ function bt({ catalogWidth: e, createFlowDisabled: t, createFlowField: n, flowBa
472
472
  store: m
473
473
  }, e.flowId))
474
474
  }),
475
- x != null && /* @__PURE__ */ G("div", {
475
+ x != null && /* @__PURE__ */ J("div", {
476
476
  className: "resource-list-footer",
477
- children: /* @__PURE__ */ G(L, {
477
+ children: /* @__PURE__ */ J(V, {
478
478
  disabled: b || S,
479
479
  onClick: () => void m.workspace.loadMoreFlows(),
480
480
  variant: "outline",
@@ -483,18 +483,18 @@ function bt({ catalogWidth: e, createFlowDisabled: t, createFlowField: n, flowBa
483
483
  })
484
484
  ]
485
485
  }),
486
- T && /* @__PURE__ */ G(st, {
486
+ T && /* @__PURE__ */ J(ct, {
487
487
  fallback: null,
488
- children: /* @__PURE__ */ G(ht, {
488
+ children: /* @__PURE__ */ J(gt, {
489
489
  disabled: t,
490
490
  field: n,
491
491
  id: "flow-name",
492
- issue: B(k),
492
+ issue: U(k),
493
493
  label: h("resource.flowName"),
494
494
  name: k,
495
495
  onNameChange: A,
496
496
  onOpenChange: E,
497
- onSubmit: (e) => void ee(e),
497
+ onSubmit: (e) => void ne(e),
498
498
  pending: g == "flow",
499
499
  title: h("resource.newFlow")
500
500
  })
@@ -505,7 +505,7 @@ function bt({ catalogWidth: e, createFlowDisabled: t, createFlowField: n, flowBa
505
505
  }
506
506
  //#endregion
507
507
  //#region ../../node_modules/.bun/nanoid@6.0.1/node_modules/nanoid/index.browser.js
508
- var xt = (e) => crypto.getRandomValues(new Uint8Array(e)), St = (e, t, n) => {
508
+ var St = (e) => crypto.getRandomValues(new Uint8Array(e)), Ct = (e, t, n) => {
509
509
  let r = 256 - 256 % e.length;
510
510
  if (r === 256) {
511
511
  let r = e.length - 1;
@@ -527,29 +527,29 @@ var xt = (e) => crypto.getRandomValues(new Uint8Array(e)), St = (e, t, n) => {
527
527
  for (; s--;) if (t[s] < r && (o += e[t[s] % e.length], o.length >= a)) return o;
528
528
  }
529
529
  };
530
- }, Ct = (e, t = 21) => St(e, t | 0, xt);
530
+ }, wt = (e, t = 21) => Ct(e, t | 0, St);
531
531
  //#endregion
532
532
  //#region src/flow/common/edgeChanges.ts
533
- function wt(e, t, n) {
534
- return Et(e, t)?.edges.some((e) => Ve(e, n)) ? [] : [{
533
+ function Tt(e, t, n) {
534
+ return Dt(e, t)?.edges.some((e) => B(e, n)) ? [] : [{
535
535
  edge: n,
536
536
  kind: "graph.edge.connect",
537
537
  target: t
538
538
  }];
539
539
  }
540
- function Tt(e, t, n) {
541
- return Et(e, t)?.edges.some((e) => Ve(e, n)) ? [{
540
+ function Et(e, t, n) {
541
+ return Dt(e, t)?.edges.some((e) => B(e, n)) ? [{
542
542
  edge: n,
543
543
  kind: "graph.edge.disconnect",
544
544
  target: t
545
545
  }] : [];
546
546
  }
547
- function Et(e, t) {
547
+ function Dt(e, t) {
548
548
  return t.kind == "flow" ? e.document.graph : e.document.subflows[t.id]?.graph;
549
549
  }
550
550
  //#endregion
551
551
  //#region src/flow/common/moduleChanges.ts
552
- async function Dt(e) {
552
+ async function Ot(e) {
553
553
  try {
554
554
  let { parse: t } = await import("./lib-C5Ipyfps.js").then((e) => e.t), n = t(e, {
555
555
  errorRecovery: !0,
@@ -565,7 +565,7 @@ async function Dt(e) {
565
565
  return [];
566
566
  }
567
567
  }
568
- function Ot(e, t, n, r, i) {
568
+ function kt(e, t, n, r, i) {
569
569
  return [{
570
570
  beforeImports: n,
571
571
  beforeSource: t,
@@ -575,7 +575,7 @@ function Ot(e, t, n, r, i) {
575
575
  source: r
576
576
  }];
577
577
  }
578
- var kt = Ct("23456789abcdefghjkmnpqrstuvwxyz", 10), J = {
578
+ var At = wt("23456789abcdefghjkmnpqrstuvwxyz", 10), Z = {
579
579
  activities: [],
580
580
  activitiesLoadFailed: !1,
581
581
  activitiesLoading: !1,
@@ -590,25 +590,25 @@ var kt = Ct("23456789abcdefghjkmnpqrstuvwxyz", 10), J = {
590
590
  publications: [],
591
591
  publishing: !1,
592
592
  refreshing: !1
593
- }, At = 20, jt = 50, Mt = 750;
594
- function Y(e, t) {
593
+ }, jt = 20, Mt = 50, Nt = 750;
594
+ function Q(e, t) {
595
595
  return e?.flowId == t.flowId;
596
596
  }
597
- var Nt = class {
597
+ var Pt = class {
598
598
  #e;
599
599
  #t;
600
600
  #n;
601
- #r = new T();
602
- #i = new T();
601
+ #r = new s();
602
+ #i = new s();
603
603
  #a;
604
- #o = new T();
605
- #s = new T();
604
+ #o = new s();
605
+ #s = new s();
606
606
  #c;
607
- #l = n(J);
607
+ #l = n(Z);
608
608
  #u;
609
609
  #d;
610
610
  #f;
611
- constructor(t, n, r, i, a = E, o = V()) {
611
+ constructor(t, n, r, i, a = L, o = W()) {
612
612
  this.#e = t, this.#t = a, this.#n = o, this.#a = i, this.#c = r, this.#u = n, this.$ = {
613
613
  activities: e(this.#l, (e) => e.activities),
614
614
  activitiesLoadFailed: e(this.#l, (e) => e.activitiesLoadFailed),
@@ -642,17 +642,17 @@ var Nt = class {
642
642
  this.#l.dispose();
643
643
  }
644
644
  reset() {
645
- this.#r.invalidate(), this.#i.invalidate(), this.#y(), this.#o.invalidate(), this.#s.invalidate(), this.#f = void 0, this.#l.set(J);
645
+ this.#r.invalidate(), this.#i.invalidate(), this.#y(), this.#o.invalidate(), this.#s.invalidate(), this.#f = void 0, this.#l.set(Z);
646
646
  }
647
647
  async load(e) {
648
- let t = { flowId: e }, n = this.#l.value, r = n.loaded && Y(n.target, t), i = this.#r.begin();
649
- Y(n.target, t) || (this.#i.invalidate(), this.#y(), this.#f = void 0), r ? this.#S({
648
+ let t = { flowId: e }, n = this.#l.value, r = n.loaded && Q(n.target, t), i = this.#r.begin();
649
+ Q(n.target, t) || (this.#i.invalidate(), this.#y(), this.#f = void 0), r ? this.#S({
650
650
  loadFailed: !1,
651
651
  loadingMore: !1,
652
652
  loadMoreFailed: !1,
653
653
  refreshing: !0
654
654
  }) : (this.#c(void 0), this.#l.set({
655
- ...J,
655
+ ...Z,
656
656
  loading: !0,
657
657
  target: t
658
658
  }));
@@ -682,7 +682,7 @@ var Nt = class {
682
682
  loadFailed: !r,
683
683
  loading: !1,
684
684
  refreshing: !1
685
- }), this.#c(D(e, this.#n.t));
685
+ }), this.#c(C(e, this.#n.t));
686
686
  }
687
687
  }
688
688
  async loadMore() {
@@ -696,7 +696,7 @@ var Nt = class {
696
696
  try {
697
697
  let e = await this.#e.listPublications(n.flowId, {
698
698
  cursor: t,
699
- limit: jt
699
+ limit: Mt
700
700
  });
701
701
  if (!r()) return;
702
702
  let i = new Set(this.#l.value.publications.map((e) => e.publicationId));
@@ -711,7 +711,7 @@ var Nt = class {
711
711
  this.#S({
712
712
  loadMoreFailed: !0,
713
713
  loadingMore: !1
714
- }), this.#c(D(e, this.#n.t));
714
+ }), this.#c(C(e, this.#n.t));
715
715
  }
716
716
  }
717
717
  async publish() {
@@ -738,7 +738,7 @@ var Nt = class {
738
738
  publishing: e.status == "pending"
739
739
  }), await this.#_(r, e, s, t.name)) : !1;
740
740
  } catch (e) {
741
- return s() ? (e instanceof m && e.code == "live.conflict" && await this.#m(r), this.#c(D(e, this.#n.t)), !1) : !1;
741
+ return s() ? (e instanceof c && e.code == "live.conflict" && await this.#m(r), this.#c(C(e, this.#n.t)), !1) : !1;
742
742
  } finally {
743
743
  s() && this.#S({ publishing: !1 });
744
744
  }
@@ -764,7 +764,7 @@ var Nt = class {
764
764
  message: this.#n.t("notice.rolledBack", { revision: e.revisionId })
765
765
  }), !0);
766
766
  } catch (e) {
767
- return s() ? (e instanceof m && e.code == "live.conflict" && await this.#m(r), this.#c(D(e, this.#n.t)), !1) : !1;
767
+ return s() ? (e instanceof c && e.code == "live.conflict" && await this.#m(r), this.#c(C(e, this.#n.t)), !1) : !1;
768
768
  } finally {
769
769
  s() && this.#S({ rollingBackPublicationId: void 0 });
770
770
  }
@@ -799,13 +799,13 @@ var Nt = class {
799
799
  testingTriggerId: void 0,
800
800
  testResult: void 0
801
801
  });
802
- let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.flowId, e), this.#e.listFlowTriggerActivities(t.flowId, e, { limit: At })]);
802
+ let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.flowId, e), this.#e.listFlowTriggerActivities(t.flowId, e, { limit: jt })]);
803
803
  if (n()) {
804
804
  if (r.status == "rejected") {
805
805
  this.#S({
806
806
  activitiesLoading: !1,
807
807
  detailLoading: !1
808
- }), this.#c(D(r.reason, this.#n.t));
808
+ }), this.#c(C(r.reason, this.#n.t));
809
809
  return;
810
810
  }
811
811
  this.#S({
@@ -819,7 +819,7 @@ var Nt = class {
819
819
  }) : (this.#S({
820
820
  activitiesLoadFailed: !0,
821
821
  activitiesLoading: !1
822
- }), this.#c(D(i.reason, this.#n.t)));
822
+ }), this.#c(C(i.reason, this.#n.t)));
823
823
  }
824
824
  }
825
825
  async loadMoreTriggerActivities() {
@@ -833,7 +833,7 @@ var Nt = class {
833
833
  try {
834
834
  let e = await this.#e.listFlowTriggerActivities(r.flowId, n, {
835
835
  cursor: t,
836
- limit: At
836
+ limit: jt
837
837
  });
838
838
  if (!i() || this.#l.value.selectedTriggerId != n) return;
839
839
  let a = new Set(this.#l.value.activities.map((e) => e.activityId));
@@ -848,7 +848,7 @@ var Nt = class {
848
848
  this.#S({
849
849
  activitiesLoadFailed: !0,
850
850
  activitiesLoadingMore: !1
851
- }), this.#c(D(e, this.#n.t));
851
+ }), this.#c(C(e, this.#n.t));
852
852
  }
853
853
  }
854
854
  async testTrigger() {
@@ -863,7 +863,7 @@ var Nt = class {
863
863
  let e = await this.#e.testFlowPollTrigger(n.flowId, t);
864
864
  return !i() || this.#l.value.selectedTriggerId != t ? !1 : (this.#S({ testResult: e }), !0);
865
865
  } catch (e) {
866
- return i() && this.#l.value.selectedTriggerId == t && this.#c(D(e, this.#n.t)), !1;
866
+ return i() && this.#l.value.selectedTriggerId == t && this.#c(C(e, this.#n.t)), !1;
867
867
  } finally {
868
868
  i() && this.#l.value.selectedTriggerId == t && this.#S({ testingTriggerId: void 0 });
869
869
  }
@@ -882,16 +882,16 @@ var Nt = class {
882
882
  message: this.#n.t(e.operatorState == "active" ? "notice.triggerPaused" : "notice.triggerResumed")
883
883
  }), !0) : !1;
884
884
  } catch (e) {
885
- return n() && this.#c(D(e, this.#n.t)), !1;
885
+ return n() && this.#c(C(e, this.#n.t)), !1;
886
886
  } finally {
887
887
  n() && this.#S({ changingTriggerId: void 0 });
888
888
  }
889
889
  }
890
890
  async #p(e, t) {
891
891
  let n = this.#r.begin(), [r, i, a] = await this.#h(e, t).catch((t) => {
892
- throw n() && Y(this.#l.value.target, e) && this.#S({ refreshing: !1 }), t;
892
+ throw n() && Q(this.#l.value.target, e) && this.#S({ refreshing: !1 }), t;
893
893
  });
894
- t?.throwIfAborted(), n() && this.#u.updateLive(r), n() && Y(this.#l.value.target, e) && this.#S({
894
+ t?.throwIfAborted(), n() && this.#u.updateLive(r), n() && Q(this.#l.value.target, e) && this.#S({
895
895
  bindings: a,
896
896
  live: r,
897
897
  loaded: !0,
@@ -915,7 +915,7 @@ var Nt = class {
915
915
  this.#e.getLive(e.flowId, t),
916
916
  this.#e.listPublications(e.flowId, {
917
917
  includeTotal: !0,
918
- limit: jt
918
+ limit: Mt
919
919
  }, t),
920
920
  this.#e.listFlowTriggerBindings(e.flowId, t)
921
921
  ]);
@@ -925,7 +925,7 @@ var Nt = class {
925
925
  if (t != null && t != "") try {
926
926
  return await this.#e.getPublishOperation(e.flowId, t);
927
927
  } catch (t) {
928
- if (t instanceof m && t.code == "publication.operation-not-found") {
928
+ if (t instanceof c && t.code == "publication.operation-not-found") {
929
929
  this.#a.setItem(this.#b(e.flowId), "");
930
930
  return;
931
931
  }
@@ -934,7 +934,7 @@ var Nt = class {
934
934
  }
935
935
  async #_(e, t, n, r) {
936
936
  this.#y();
937
- let i = q.runFork(q.gen({ self: this }, function* () {
937
+ let i = X.runFork(X.gen({ self: this }, function* () {
938
938
  let i = yield* this.#v(e, t, n);
939
939
  if (i == null || !n()) return !1;
940
940
  if (this.#f = void 0, this.#x(e, {
@@ -944,11 +944,11 @@ var Nt = class {
944
944
  kind: "error",
945
945
  message: i.issue.message
946
946
  }), !1;
947
- let a = yield* q.tryPromise({
947
+ let a = yield* X.tryPromise({
948
948
  try: (t) => this.#p(e, t),
949
949
  catch: (e) => e
950
- }).pipe(q.match({
951
- onFailure: (e) => (n() && this.#c(D(e, this.#n.t)), !1),
950
+ }).pipe(X.match({
951
+ onFailure: (e) => (n() && this.#c(C(e, this.#n.t)), !1),
952
952
  onSuccess: () => !0
953
953
  }));
954
954
  return n() ? (a && this.#c({
@@ -957,34 +957,34 @@ var Nt = class {
957
957
  }), !0) : !1;
958
958
  }));
959
959
  this.#d = i;
960
- let a = await q.runPromiseExit(ft.join(i));
961
- if (dt.isSuccess(a)) return a.value;
962
- if (ut.hasInterruptsOnly(a.cause)) return !1;
963
- throw ut.squash(a.cause);
960
+ let a = await X.runPromiseExit(pt.join(i));
961
+ if (ft.isSuccess(a)) return a.value;
962
+ if (dt.hasInterruptsOnly(a.cause)) return !1;
963
+ throw dt.squash(a.cause);
964
964
  }
965
965
  #v(e, t, n) {
966
- return q.gen({ self: this }, function* () {
966
+ return X.gen({ self: this }, function* () {
967
967
  let r = t;
968
968
  for (; r.status == "pending";) {
969
- if (yield* q.sleep(Mt), !n()) return;
970
- let t = yield* q.tryPromise({
969
+ if (yield* X.sleep(Nt), !n()) return;
970
+ let t = yield* X.tryPromise({
971
971
  try: (t) => this.#e.getPublishOperation(e.flowId, r.operationId, t),
972
972
  catch: (e) => e
973
- }).pipe(q.match({
973
+ }).pipe(X.match({
974
974
  onFailure: (e) => ({ error: e }),
975
975
  onSuccess: (e) => ({ value: e })
976
976
  }));
977
977
  if (!n()) return;
978
978
  if ("error" in t) {
979
979
  let n = t.error;
980
- if (n instanceof m && n.code == "publication.operation-not-found") {
980
+ if (n instanceof c && n.code == "publication.operation-not-found") {
981
981
  this.#a.setItem(this.#b(e.flowId), ""), this.#x(e, {
982
982
  operation: void 0,
983
983
  publishing: !1
984
- }), this.#c(D(n, this.#n.t));
984
+ }), this.#c(C(n, this.#n.t));
985
985
  return;
986
986
  }
987
- this.#c(D(n, this.#n.t));
987
+ this.#c(C(n, this.#n.t));
988
988
  continue;
989
989
  }
990
990
  r = t.value, this.#x(e, { operation: r });
@@ -999,8 +999,8 @@ var Nt = class {
999
999
  return `publish-operation:${e}`;
1000
1000
  }
1001
1001
  #x(e, t) {
1002
- Y(this.#l.value.target, e) ? this.#S(t) : this.#l.set({
1003
- ...J,
1002
+ Q(this.#l.value.target, e) ? this.#S(t) : this.#l.set({
1003
+ ...Z,
1004
1004
  ...t,
1005
1005
  target: e
1006
1006
  });
@@ -1011,8 +1011,8 @@ var Nt = class {
1011
1011
  ...e
1012
1012
  });
1013
1013
  }
1014
- }, Pt = { starting: !1 };
1015
- function Ft(e) {
1014
+ }, Ft = { starting: !1 };
1015
+ function It(e) {
1016
1016
  switch (e.kind) {
1017
1017
  case "condition": return { [e.node.input.handle]: e.node.input };
1018
1018
  case "subflow": return Ye(e.definition?.inputs ?? []);
@@ -1021,11 +1021,11 @@ function Ft(e) {
1021
1021
  case "wait": return { [e.node.input.handle]: e.node.input };
1022
1022
  }
1023
1023
  }
1024
- function It(e) {
1024
+ function Lt(e) {
1025
1025
  return e.node.name == null ? e.kind == "task" || e.kind == "subflow" ? e.definition?.name ?? e.id : e.id : e.node.name;
1026
1026
  }
1027
- function X(e, t) {
1028
- let n = w(e), r = n.graph({ kind: "flow" });
1027
+ function $(e, t) {
1028
+ let n = F(e), r = n.graph({ kind: "flow" });
1029
1029
  if (r == null) return [];
1030
1030
  let i = /* @__PURE__ */ new Set([t]), a = [t];
1031
1031
  for (; a.length > 0;) {
@@ -1037,13 +1037,13 @@ function X(e, t) {
1037
1037
  if (r.kind == "trigger") return r.trigger.kind == "manual" || r.trigger.kind == "cron" ? [] : [{
1038
1038
  definitions: [{
1039
1039
  handle: "payload",
1040
- jsonSchema: Te(r.trigger),
1040
+ jsonSchema: k(r.trigger),
1041
1041
  nullable: !1
1042
1042
  }],
1043
1043
  nodeId: e,
1044
1044
  title: r.trigger.name
1045
1045
  }];
1046
- let i = Object.entries(Ft(r)).filter(([e, t]) => r.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
1046
+ let i = Object.entries(It(r)).filter(([e, t]) => r.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
1047
1047
  handle: e,
1048
1048
  jsonSchema: t.jsonSchema,
1049
1049
  nullable: t.nullable
@@ -1051,18 +1051,18 @@ function X(e, t) {
1051
1051
  return i.length == 0 ? [] : [{
1052
1052
  definitions: i,
1053
1053
  nodeId: e,
1054
- title: It(r)
1054
+ title: Lt(r)
1055
1055
  }];
1056
1056
  });
1057
1057
  }
1058
- function Z(e) {
1058
+ function Rt(e) {
1059
1059
  return JSON.stringify(e.map((e) => [e.nodeId, e.definitions.map((e) => [
1060
1060
  e.handle,
1061
1061
  e.jsonSchema,
1062
1062
  e.nullable
1063
1063
  ])]));
1064
1064
  }
1065
- async function Lt(e, t, n, r) {
1065
+ async function zt(e, t, n, r) {
1066
1066
  let { FlowRunInputEditorStore: i } = await import("./flowRunInputEditorStore-BBqQIOCR.js").then((e) => e.n);
1067
1067
  return e.map((e) => {
1068
1068
  let a = new i(e.definitions, t);
@@ -1073,28 +1073,28 @@ async function Lt(e, t, n, r) {
1073
1073
  };
1074
1074
  });
1075
1075
  }
1076
- function Rt(e) {
1076
+ function Bt(e) {
1077
1077
  return Object.fromEntries(e.map((e) => [e.nodeId, e.editor.values()]));
1078
1078
  }
1079
- function zt(e, t) {
1079
+ function Vt(e, t) {
1080
1080
  return {
1081
1081
  inputs: Object.fromEntries(e.filter((e) => e.nodeId != t).map((e) => [e.nodeId, e.editor.values()])),
1082
1082
  payload: e.find((e) => e.nodeId == t)?.editor.values().payload ?? {}
1083
1083
  };
1084
1084
  }
1085
- var Bt = class {
1085
+ var Ht = class {
1086
1086
  #e;
1087
1087
  #t;
1088
1088
  #n;
1089
1089
  #r;
1090
- #i = new T();
1091
- #a = new T();
1090
+ #i = new s();
1091
+ #a = new s();
1092
1092
  #o;
1093
1093
  #s = /* @__PURE__ */ new Map();
1094
1094
  #c;
1095
- #l = n(Pt);
1095
+ #l = n(Ft);
1096
1096
  #u;
1097
- constructor(t, n, r, i, a = V(), o = E) {
1097
+ constructor(t, n, r, i, a = W(), o = L) {
1098
1098
  this.#e = i, this.#t = t, this.#o = n, this.#c = r, this.#r = a, this.#n = o, this.$ = {
1099
1099
  inputRequest: e(this.#l, (e) => e.inputRequest),
1100
1100
  starting: e(this.#l, (e) => e.starting),
@@ -1109,14 +1109,14 @@ var Bt = class {
1109
1109
  reset() {
1110
1110
  this.#i.invalidate(), this.#a.invalidate(), this.#u = void 0;
1111
1111
  let e = this.#l.value.inputRequest;
1112
- this.#h(e), this.#l.set(Pt), this.#p(e);
1112
+ this.#h(e), this.#l.set(Ft), this.#p(e);
1113
1113
  }
1114
1114
  async requestDraft(e, t, n) {
1115
1115
  let r = this.#a.begin();
1116
1116
  try {
1117
1117
  return await this.#d("draft", e, t, t.revisionId, r, void 0, n);
1118
1118
  } catch (e) {
1119
- return r() && this.#c(D(e, this.#r.t)), "unavailable";
1119
+ return r() && this.#c(C(e, this.#r.t)), "unavailable";
1120
1120
  } finally {
1121
1121
  r() && this.#g({ starting: !1 });
1122
1122
  }
@@ -1126,16 +1126,16 @@ var Bt = class {
1126
1126
  try {
1127
1127
  return await this.#d("draft", e, t, t.revisionId, r, void 0, n, !0);
1128
1128
  } catch (e) {
1129
- return r() && this.#c(D(e, this.#r.t)), "unavailable";
1129
+ return r() && this.#c(C(e, this.#r.t)), "unavailable";
1130
1130
  } finally {
1131
1131
  r() && this.#g({ starting: !1 });
1132
1132
  }
1133
1133
  }
1134
1134
  inputStatus(e, t, n) {
1135
- let r = X(t, n);
1135
+ let r = $(t, n);
1136
1136
  if (r.length == 0) return "none";
1137
1137
  let i = this.#s.get(this.#m(e, n));
1138
- return i?.valid == 1 && i.signature == Z(r) ? "ready" : "missing";
1138
+ return i?.valid == 1 && i.signature == Rt(r) ? "ready" : "missing";
1139
1139
  }
1140
1140
  async requestLive(e) {
1141
1141
  let t = this.#a.begin();
@@ -1146,7 +1146,7 @@ var Bt = class {
1146
1146
  let r = await this.#t.getRevision(e.flowId, n.revisionId);
1147
1147
  return t() ? await this.#d("live", e, r, n.revisionId, t, n.publicationId) : "unavailable";
1148
1148
  } catch (e) {
1149
- return t() && this.#c(D(e, this.#r.t)), "unavailable";
1149
+ return t() && this.#c(C(e, this.#r.t)), "unavailable";
1150
1150
  } finally {
1151
1151
  t() && this.#g({ starting: !1 });
1152
1152
  }
@@ -1163,7 +1163,7 @@ var Bt = class {
1163
1163
  attempted: !0
1164
1164
  } }), !1;
1165
1165
  this.#h(e);
1166
- let { inputs: t, payload: n } = zt(e.groups, e.triggerId), r = await this.#f(e.source, e.flow, e.revisionId, {
1166
+ let { inputs: t, payload: n } = Vt(e.groups, e.triggerId), r = await this.#f(e.source, e.flow, e.revisionId, {
1167
1167
  nodeId: e.triggerId,
1168
1168
  payload: n
1169
1169
  }, t, e.publicationId);
@@ -1175,7 +1175,7 @@ var Bt = class {
1175
1175
  let r = this.#a.begin();
1176
1176
  this.#h(n), this.#g({ starting: !0 });
1177
1177
  try {
1178
- let i = X(n.revision, e), a = this.#s.get(this.#m(n.flow.flowId, e)), o = await Lt(i, this.#r.lang$, e, a?.values);
1178
+ let i = $(n.revision, e), a = this.#s.get(this.#m(n.flow.flowId, e)), o = await zt(i, this.#r.lang$, e, a?.values);
1179
1179
  if (!r() || this.#l.value.inputRequest !== n) {
1180
1180
  for (let e of o) e.editor.dispose();
1181
1181
  return;
@@ -1189,7 +1189,7 @@ var Bt = class {
1189
1189
  valid: s
1190
1190
  } }), this.#p(n);
1191
1191
  } catch (e) {
1192
- r() && this.#c(D(e, this.#r.t));
1192
+ r() && this.#c(C(e, this.#r.t));
1193
1193
  } finally {
1194
1194
  r() && this.#g({ starting: !1 });
1195
1195
  }
@@ -1201,7 +1201,7 @@ var Bt = class {
1201
1201
  starting: !0,
1202
1202
  submitting: void 0
1203
1203
  }), this.#p(l);
1204
- let u = w(r).graph({ kind: "flow" }), d = Object.entries(u?.nodes ?? {}).flatMap(([e, t]) => "inputs" in t ? [] : [{
1204
+ let u = F(r).graph({ kind: "flow" }), d = Object.entries(u?.nodes ?? {}).flatMap(([e, t]) => "inputs" in t ? [] : [{
1205
1205
  nodeId: e,
1206
1206
  title: t.name
1207
1207
  }]);
@@ -1214,7 +1214,7 @@ var Bt = class {
1214
1214
  kind: "error",
1215
1215
  message: this.#r.t("runInput.selectTrigger")
1216
1216
  }), "unavailable";
1217
- let p = f == null ? [] : X(r, f.nodeId), m = Z(p), h = f == null ? void 0 : this.#s.get(this.#m(n.flowId, f.nodeId)), g = f == null ? [] : await Lt(p, this.#r.lang$, f.nodeId, h?.values);
1217
+ let p = f == null ? [] : $(r, f.nodeId), m = Rt(p), h = f == null ? void 0 : this.#s.get(this.#m(n.flowId, f.nodeId)), g = f == null ? [] : await zt(p, this.#r.lang$, f.nodeId, h?.values);
1218
1218
  if (!a()) {
1219
1219
  for (let e of g) e.editor.dispose();
1220
1220
  return "unavailable";
@@ -1224,7 +1224,7 @@ var Bt = class {
1224
1224
  payload: {}
1225
1225
  }, {}, o) ? "started" : "unavailable";
1226
1226
  if (!c && f != null && h?.valid == 1 && h.signature == m && g.every((e) => e.editor.valid$.value)) {
1227
- let t = zt(g, f.nodeId);
1227
+ let t = Vt(g, f.nodeId);
1228
1228
  for (let e of g) e.editor.dispose();
1229
1229
  return await this.#f(e, n, i, {
1230
1230
  nodeId: f.nodeId,
@@ -1286,7 +1286,7 @@ var Bt = class {
1286
1286
  });
1287
1287
  return !o() || !s() ? !1 : (this.#u = void 0, this.#o.follow(d, s));
1288
1288
  } catch (e) {
1289
- return o() && s() && this.#c(D(e, this.#r.t)), !1;
1289
+ return o() && s() && this.#c(C(e, this.#r.t)), !1;
1290
1290
  } finally {
1291
1291
  o() && this.#g({
1292
1292
  starting: !1,
@@ -1305,9 +1305,9 @@ var Bt = class {
1305
1305
  }
1306
1306
  #h(e) {
1307
1307
  e?.triggerId != null && e.groups.length != 0 && this.#s.set(this.#m(e.flow.flowId, e.triggerId), {
1308
- signature: Z(X(e.revision, e.triggerId)),
1308
+ signature: Rt($(e.revision, e.triggerId)),
1309
1309
  valid: e.valid.value,
1310
- values: Rt(e.groups)
1310
+ values: Bt(e.groups)
1311
1311
  });
1312
1312
  }
1313
1313
  #g(e) {
@@ -1316,18 +1316,18 @@ var Bt = class {
1316
1316
  ...e
1317
1317
  });
1318
1318
  }
1319
- }, Vt = {
1319
+ }, Ut = {
1320
1320
  actions: {},
1321
1321
  catalogs: {}
1322
1322
  };
1323
- function Ht(e) {
1323
+ function Wt(e) {
1324
1324
  return Object.entries(e).map(([e, t]) => ({
1325
1325
  description: t.description,
1326
1326
  handle: e,
1327
1327
  jsonSchema: t.jsonSchema
1328
1328
  }));
1329
1329
  }
1330
- function Q(e, t) {
1330
+ function Gt(e, t) {
1331
1331
  return {
1332
1332
  connector: e,
1333
1333
  description: e.authenticated && e.defaultConnection == null ? t("addNode.connectorNeedsConnection", {
@@ -1335,15 +1335,15 @@ function Q(e, t) {
1335
1335
  service: e.serviceName
1336
1336
  }) : e.description,
1337
1337
  group: t("addNode.connectorActions"),
1338
- icon: p(e),
1338
+ icon: R(e),
1339
1339
  id: `connector:${e.actionId}`,
1340
- inputs: Ht(e.inputs),
1340
+ inputs: Wt(e.inputs),
1341
1341
  kind: "connector",
1342
1342
  label: e.name,
1343
- outputs: Ht(e.outputs)
1343
+ outputs: Wt(e.outputs)
1344
1344
  };
1345
1345
  }
1346
- function Ut(e, t) {
1346
+ function Kt(e, t) {
1347
1347
  let n = /* @__PURE__ */ new Map();
1348
1348
  for (let t of e) {
1349
1349
  let e = n.get(t.serviceId) ?? [];
@@ -1351,7 +1351,7 @@ function Ut(e, t) {
1351
1351
  }
1352
1352
  return [...n.values()].toSorted((e, t) => e[0].serviceName.localeCompare(t[0].serviceName)).map((e) => {
1353
1353
  let n = e[0], r = e.map((e) => {
1354
- let n = Q(e, t);
1354
+ let n = Gt(e, t);
1355
1355
  return {
1356
1356
  description: n.description,
1357
1357
  label: n.label,
@@ -1362,7 +1362,7 @@ function Ut(e, t) {
1362
1362
  choices: r,
1363
1363
  description: t(r.length == 1 ? "addNode.connectorActionCountOne" : "addNode.connectorActionCount", { count: r.length }),
1364
1364
  group: t("addNode.connectorActions"),
1365
- icon: p(n),
1365
+ icon: R(n),
1366
1366
  id: `connector-provider:${n.serviceId}`,
1367
1367
  inputs: [],
1368
1368
  kind: "connector-group",
@@ -1372,12 +1372,12 @@ function Ut(e, t) {
1372
1372
  };
1373
1373
  });
1374
1374
  }
1375
- function Wt(e, t) {
1375
+ function qt(e, t) {
1376
1376
  return {
1377
1377
  choices: [],
1378
1378
  description: t("addNode.connectorBrowseActions"),
1379
1379
  group: t("addNode.connectorActions"),
1380
- icon: p(e),
1380
+ icon: R(e),
1381
1381
  id: `connector-provider:${e.serviceId}`,
1382
1382
  inputs: [],
1383
1383
  kind: "connector-group",
@@ -1386,7 +1386,7 @@ function Wt(e, t) {
1386
1386
  serviceId: e.serviceId
1387
1387
  };
1388
1388
  }
1389
- function Gt(e, t) {
1389
+ function Jt(e, t) {
1390
1390
  if (e == null) return;
1391
1391
  let n = e.kind == "wait" ? e.node.notification?.taskId : e.kind == "task" && e.node.task == null ? e.node.taskId : void 0;
1392
1392
  if (n == null) return;
@@ -1398,10 +1398,10 @@ function Gt(e, t) {
1398
1398
  taskId: n
1399
1399
  };
1400
1400
  }
1401
- function Kt(e, t, n) {
1401
+ function Yt(e, t, n) {
1402
1402
  if (e == null) return [];
1403
1403
  let r = [];
1404
- for (let i of [...d(e.revision.content).tasks].toSorted()) {
1404
+ for (let i of [..._(e.revision.content).tasks].toSorted()) {
1405
1405
  let a = e.task(i);
1406
1406
  if (a?.executor.kind != "connector") continue;
1407
1407
  let o = t[a.executor.action];
@@ -1418,7 +1418,7 @@ function Kt(e, t, n) {
1418
1418
  }
1419
1419
  return r;
1420
1420
  }
1421
- var qt = class {
1421
+ var Xt = class {
1422
1422
  #e;
1423
1423
  #t;
1424
1424
  #n;
@@ -1435,13 +1435,13 @@ var qt = class {
1435
1435
  #p;
1436
1436
  #m;
1437
1437
  #h;
1438
- constructor(r, i, a, o, s = V()) {
1439
- this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new T(), this.#o = new T(), this.#d = n(Vt), this.#h = !1, this.browseAddNodeOptions = async (e) => {
1438
+ constructor(r, i, a, o, c = W()) {
1439
+ this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new s(), this.#o = new s(), this.#d = n(Ut), this.#h = !1, this.browseAddNodeOptions = async (e) => {
1440
1440
  if (this.#h) return;
1441
1441
  let t = this.#f.$.flowId.value;
1442
1442
  if (t == null) return;
1443
1443
  let n = this.#m ?? await this.#e.listConnectorProviders(e, t);
1444
- if (!(e.aborted || this.#h || t != this.#f.$.flowId.value)) return this.#m = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => Wt(e, this.#t.t));
1444
+ if (!(e.aborted || this.#h || t != this.#f.$.flowId.value)) return this.#m = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => qt(e, this.#t.t));
1445
1445
  }, this.provideAddNodeOptionChoices = async (e, t) => {
1446
1446
  if (this.#h) return;
1447
1447
  let n = this.#f.$.flowId.value, r = this.#m?.find((t) => `connector-provider:${t.serviceId}` == e);
@@ -1452,7 +1452,7 @@ var qt = class {
1452
1452
  return this.#r.set(r.serviceId, a), this.#b({ actions: {
1453
1453
  ...this.#d.value.actions,
1454
1454
  ...Object.fromEntries(a.map((e) => [e.actionId, e]))
1455
- } }), a.map((e) => Q(e, this.#t.t));
1455
+ } }), a.map((e) => Gt(e, this.#t.t));
1456
1456
  }, this.provideAddNodeOptions = async (e, t) => {
1457
1457
  if (this.#h) return;
1458
1458
  let n = this.#f.$.flowId.value;
@@ -1461,17 +1461,17 @@ var qt = class {
1461
1461
  if (t.aborted || this.#h || n != this.#f.$.flowId.value) return;
1462
1462
  let a = { ...this.#d.value.actions };
1463
1463
  for (let e of i) a[e.actionId] = e;
1464
- if (this.#b({ actions: a }), r.length != 0) return i.map((e) => Q(e, this.#t.t));
1464
+ if (this.#b({ actions: a }), r.length != 0) return i.map((e) => Gt(e, this.#t.t));
1465
1465
  let o = new Map(i.map((e) => [e.actionId, e]));
1466
1466
  for (let e of this.#f.$.revision.value?.connectorActionIds ?? []) {
1467
1467
  let t = a[e];
1468
1468
  t != null && o.set(e, t);
1469
1469
  }
1470
- return Ut([...o.values()], this.#t.t);
1471
- }, this.#e = r, this.#n = o, this.#f = i, this.#u = a, this.#t = s;
1472
- let c = e(this.#d, (e) => e.actions), l = e(this.#d, (e) => e.catalogs);
1470
+ return Kt([...o.values()], this.#t.t);
1471
+ }, this.#e = r, this.#n = o, this.#f = i, this.#u = a, this.#t = c;
1472
+ let l = e(this.#d, (e) => e.actions), u = e(this.#d, (e) => e.catalogs);
1473
1473
  this.#l = t((e) => {
1474
- let t = Gt(e(i.$.selection), e(i.$.revision)), n = e(this.#d);
1474
+ let t = Jt(e(i.$.selection), e(i.$.revision)), n = e(this.#d);
1475
1475
  if (t == null) return { authorizationPending: !1 };
1476
1476
  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);
1477
1477
  return o == null && r?.defaultConnection?.connectionId == t.connectionId && (o = r.defaultConnection), {
@@ -1484,10 +1484,10 @@ var qt = class {
1484
1484
  };
1485
1485
  }), this.$ = {
1486
1486
  actionLoading: e(this.#d, (e) => e.actionLoading),
1487
- actions: c,
1488
- catalogs: l,
1487
+ actions: l,
1488
+ catalogs: u,
1489
1489
  connectionLoading: e(this.#d, (e) => e.connectionLoading),
1490
- diagnostics: t((e) => Kt(e(i.$.revision), e(c), e(l))),
1490
+ diagnostics: t((e) => Yt(e(i.$.revision), e(l), e(u))),
1491
1491
  selectedAction: e(this.#l, (e) => e.action),
1492
1492
  selectedActionError: e(this.#l, (e) => e.actionError),
1493
1493
  selectedActiveConnections: e(this.#l, (e) => e.activeConnections),
@@ -1502,11 +1502,11 @@ var qt = class {
1502
1502
  this.#l.dispose(), this.#d.dispose();
1503
1503
  }
1504
1504
  reset() {
1505
- this.#h || (this.#a.invalidate(), this.#o.invalidate(), this.#p = void 0, this.#r.clear(), this.#m = void 0, this.#i.clear(), this.#d.set(Vt));
1505
+ this.#h || (this.#a.invalidate(), this.#o.invalidate(), this.#p = void 0, this.#r.clear(), this.#m = void 0, this.#i.clear(), this.#d.set(Ut));
1506
1506
  }
1507
1507
  async refresh(e = !1) {
1508
1508
  if (this.#h) return;
1509
- let t = this.#o.begin(), n = this.#f.$.flowId.value, r = Gt(this.#f.$.selection.value, this.#f.$.revision.value);
1509
+ let t = this.#o.begin(), n = this.#f.$.flowId.value, r = Jt(this.#f.$.selection.value, this.#f.$.revision.value);
1510
1510
  if (n == null || r == null) {
1511
1511
  (this.#d.value.actionLoading != null || this.#d.value.connectionLoading != null) && this.#b({
1512
1512
  actionLoading: void 0,
@@ -1530,7 +1530,7 @@ var qt = class {
1530
1530
  } catch (e) {
1531
1531
  this.#x(t, n) && this.#b({ actionError: {
1532
1532
  actionId: r.actionId,
1533
- message: D(e, this.#t.t).message
1533
+ message: C(e, this.#t.t).message
1534
1534
  } });
1535
1535
  } finally {
1536
1536
  this.#x(t, n) && this.#d.value.actionLoading == r.actionId && this.#b({ actionLoading: void 0 });
@@ -1542,7 +1542,7 @@ var qt = class {
1542
1542
  let r = await this.#e.listConnectorConnections(e, t, n);
1543
1543
  t.aborted || this.#h || n != this.#f.$.flowId.value || this.#b({ catalogs: {
1544
1544
  ...this.#d.value.catalogs,
1545
- [e]: v(r)
1545
+ [e]: N(r)
1546
1546
  } });
1547
1547
  }
1548
1548
  async loadCodeAction(e, t) {
@@ -1573,7 +1573,7 @@ var qt = class {
1573
1573
  serviceId: e
1574
1574
  }, this.#b({ authorizationServiceId: e });
1575
1575
  } catch (e) {
1576
- this.#h || this.#u(D(e, this.#t.t));
1576
+ this.#h || this.#u(C(e, this.#t.t));
1577
1577
  }
1578
1578
  }
1579
1579
  async setConnection(e, t) {
@@ -1606,13 +1606,13 @@ var qt = class {
1606
1606
  a = await this.#e.listConnectorConnections(t, void 0, e);
1607
1607
  } catch (n) {
1608
1608
  this.#x(r, e) && this.#b({ connectionError: {
1609
- message: D(n, this.#t.t).message,
1609
+ message: C(n, this.#t.t).message,
1610
1610
  serviceId: t
1611
1611
  } });
1612
1612
  return;
1613
1613
  }
1614
1614
  if (!this.#x(r, e)) return;
1615
- let o = v(a);
1615
+ let o = N(a);
1616
1616
  return this.#b({ catalogs: {
1617
1617
  ...this.#d.value.catalogs,
1618
1618
  [t]: o
@@ -1652,7 +1652,7 @@ var qt = class {
1652
1652
  }
1653
1653
  if (!this.#x(e, t)) return;
1654
1654
  let i = /* @__PURE__ */ new Set();
1655
- for (let e of d(n.revision.content).tasks) {
1655
+ for (let e of _(n.revision.content).tasks) {
1656
1656
  let t = n.task(e);
1657
1657
  if (t?.executor.kind != "connector") continue;
1658
1658
  let r = this.#d.value.actions[t.executor.action];
@@ -1660,8 +1660,8 @@ var qt = class {
1660
1660
  }
1661
1661
  await Promise.all([...i].map((n) => this.#v(t, n, !1, e)));
1662
1662
  }
1663
- }, Jt = { catalogs: {} }, Yt = "trigger:";
1664
- function $(e, t) {
1663
+ }, Zt = { catalogs: {} }, Qt = "trigger:";
1664
+ function $t(e, t) {
1665
1665
  if (e?.kind != "trigger") return;
1666
1666
  let n = e.trigger;
1667
1667
  if (n.kind != "poll" && n.kind != "integration") return;
@@ -1672,15 +1672,15 @@ function $(e, t) {
1672
1672
  triggerId: e.id
1673
1673
  };
1674
1674
  }
1675
- function Xt(e, t) {
1675
+ function en(e, t) {
1676
1676
  return {
1677
1677
  description: t.t("addNode.triggerNeedsConnection", { provider: e.provider }),
1678
1678
  group: t.t("addNode.integrationTriggers"),
1679
- icon: p({
1679
+ icon: R({
1680
1680
  serviceId: e.provider,
1681
1681
  serviceName: e.provider
1682
1682
  }),
1683
- id: `${Yt}${e.key}`,
1683
+ id: `${Qt}${e.key}`,
1684
1684
  inputs: [],
1685
1685
  kind: "trigger",
1686
1686
  label: e.displayName,
@@ -1694,7 +1694,7 @@ function Xt(e, t) {
1694
1694
  }
1695
1695
  };
1696
1696
  }
1697
- var Zt = class {
1697
+ var tn = class {
1698
1698
  #e;
1699
1699
  #t;
1700
1700
  #n;
@@ -1707,12 +1707,12 @@ var Zt = class {
1707
1707
  #l;
1708
1708
  #u;
1709
1709
  #d;
1710
- constructor(r, i, a, o, s = V()) {
1711
- this.#t = new AbortController(), this.#a = new T(), this.#o = /* @__PURE__ */ new Set(), this.#l = n(Jt), this.#d = !1, this.browseAddNodeOptions = async (e) => {
1710
+ constructor(r, i, a, o, c = W()) {
1711
+ this.#t = new AbortController(), this.#a = new s(), this.#o = /* @__PURE__ */ new Set(), this.#l = n(Zt), this.#d = !1, this.browseAddNodeOptions = async (e) => {
1712
1712
  let t = this.#u.$.flowId.value;
1713
1713
  if (e.aborted || this.#d || t == null || this.#u.$.target.value?.kind != "flow") return [];
1714
1714
  let n = await this.#f();
1715
- if (!(e.aborted || this.#d || t != this.#u.$.flowId.value)) return [...n.values()].map((e) => Xt(e, this.#i));
1715
+ if (!(e.aborted || this.#d || t != this.#u.$.flowId.value)) return [...n.values()].map((e) => en(e, this.#i));
1716
1716
  }, this.provideAddNodeOptions = async (e, t) => {
1717
1717
  let n = this.#u.$.flowId.value;
1718
1718
  if (t.aborted || this.#d || n == null || this.#u.$.target.value?.kind != "flow") return [];
@@ -1726,9 +1726,9 @@ var Zt = class {
1726
1726
  e.name,
1727
1727
  e.provider,
1728
1728
  e.type
1729
- ].some((e) => e.toLowerCase().includes(r))).map((e) => Xt(e, this.#i));
1730
- }, this.#n = r, this.#r = o, this.#i = s, this.#c = a, this.#u = i, this.#s = t((e) => {
1731
- let t = e(i.$.selection), n = $(t, i), r = e(this.#l);
1729
+ ].some((e) => e.toLowerCase().includes(r))).map((e) => en(e, this.#i));
1730
+ }, this.#n = r, this.#r = o, this.#i = c, this.#c = a, this.#u = i, this.#s = t((e) => {
1731
+ let t = e(i.$.selection), n = $t(t, i), r = e(this.#l);
1732
1732
  if (t?.kind != "trigger") return { authorizationPending: !1 };
1733
1733
  let a = t.trigger;
1734
1734
  if (a.kind != "poll" && a.kind != "integration") return { authorizationPending: !1 };
@@ -1755,11 +1755,11 @@ var Zt = class {
1755
1755
  this.#s.dispose(), this.#l.dispose();
1756
1756
  }
1757
1757
  reset() {
1758
- this.#d || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#o.clear(), this.#a.invalidate(), this.#l.set(Jt));
1758
+ this.#d || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#o.clear(), this.#a.invalidate(), this.#l.set(Zt));
1759
1759
  }
1760
1760
  async refresh(e = !1) {
1761
1761
  if (this.#d) return;
1762
- let t = this.#a.begin(), n = this.#u.$.flowId.value, r = $(this.#u.$.selection.value, this.#u);
1762
+ let t = this.#a.begin(), n = this.#u.$.flowId.value, r = $t(this.#u.$.selection.value, this.#u);
1763
1763
  if (n == null || r == null) {
1764
1764
  this.#l.value.connectionLoading != null && this.#p({ connectionLoading: void 0 });
1765
1765
  return;
@@ -1773,7 +1773,7 @@ var Zt = class {
1773
1773
  connectionLoading: r.provider
1774
1774
  });
1775
1775
  try {
1776
- let e = v(await this.#n.listConnectorConnections(r.provider, void 0, n));
1776
+ let e = N(await this.#n.listConnectorConnections(r.provider, void 0, n));
1777
1777
  if (!this.#m(t, n)) return;
1778
1778
  this.#o.delete(r.provider), this.#p({ catalogs: {
1779
1779
  ...this.#l.value.catalogs,
@@ -1781,7 +1781,7 @@ var Zt = class {
1781
1781
  } });
1782
1782
  } catch (e) {
1783
1783
  this.#m(t, n) && this.#p({ connectionError: {
1784
- message: D(e, this.#i.t).message,
1784
+ message: C(e, this.#i.t).message,
1785
1785
  provider: r.provider
1786
1786
  } });
1787
1787
  } finally {
@@ -1800,7 +1800,7 @@ var Zt = class {
1800
1800
  }
1801
1801
  !this.#d && t == this.#u.$.flowId.value && this.#p({ authorizationProvider: e });
1802
1802
  } catch (e) {
1803
- this.#d || this.#c(D(e, this.#i.t));
1803
+ this.#d || this.#c(C(e, this.#i.t));
1804
1804
  }
1805
1805
  }
1806
1806
  async setConnection(e, t) {
@@ -1809,7 +1809,7 @@ var Zt = class {
1809
1809
  async refreshAfterAuthorization() {
1810
1810
  if (this.#d) return;
1811
1811
  let e = this.#l.value.authorizationProvider;
1812
- e != null && (this.#o.add(e), this.#p({ authorizationProvider: void 0 }), $(this.#u.$.selection.value, this.#u)?.provider == e && await this.refresh(!0));
1812
+ e != null && (this.#o.add(e), this.#p({ authorizationProvider: void 0 }), $t(this.#u.$.selection.value, this.#u)?.provider == e && await this.refresh(!0));
1813
1813
  }
1814
1814
  #f() {
1815
1815
  if (this.#e != null) return this.#e;
@@ -1829,8 +1829,176 @@ var Zt = class {
1829
1829
  }
1830
1830
  };
1831
1831
  //#endregion
1832
+ //#region src/flow/common/inverseChanges.ts
1833
+ function nn(e, t) {
1834
+ let n = e, r = [];
1835
+ for (let e of t) {
1836
+ let t = Je(n, [e]), i = [];
1837
+ switch (e.kind) {
1838
+ case "graph.node.create":
1839
+ i.push({
1840
+ kind: "graph.node.delete",
1841
+ nodeId: e.nodeId,
1842
+ target: e.target
1843
+ });
1844
+ break;
1845
+ case "graph.node.delete": {
1846
+ let { target: r, nodeId: a } = e, o = r.kind == "flow" ? n.document.graph : n.document.subflows[r.id].graph, s = r.kind == "flow" ? t.document.graph : t.document.subflows[r.id].graph;
1847
+ i.push({
1848
+ kind: "graph.node.create",
1849
+ nodeId: a,
1850
+ target: r,
1851
+ node: o.nodes[a]
1852
+ });
1853
+ for (let [e, t] of Object.entries(s.nodes)) {
1854
+ let n = o.nodes[e];
1855
+ if (!(!("inputs" in t) || !("inputs" in n))) for (let a of /* @__PURE__ */ new Set([...Object.keys(n.inputs), ...Object.keys(t.inputs)])) B(t.inputs[a], n.inputs[a]) || i.push({
1856
+ kind: "graph.node.input.set",
1857
+ target: r,
1858
+ nodeId: e,
1859
+ handle: a,
1860
+ before: t.inputs[a],
1861
+ value: n.inputs[a]
1862
+ });
1863
+ }
1864
+ for (let e of s.edges) i.push({
1865
+ kind: "graph.edge.disconnect",
1866
+ target: r,
1867
+ edge: e
1868
+ });
1869
+ for (let e of o.edges) i.push({
1870
+ kind: "graph.edge.connect",
1871
+ target: r,
1872
+ edge: e
1873
+ });
1874
+ if (r.kind == "subflow") {
1875
+ let { graph: e, ...a } = n.document.subflows[r.id], { graph: o, ...s } = t.document.subflows[r.id];
1876
+ B(s, a) || i.push({
1877
+ kind: "subflow.definition.set",
1878
+ subflowId: r.id,
1879
+ before: s,
1880
+ definition: a
1881
+ });
1882
+ }
1883
+ break;
1884
+ }
1885
+ case "graph.edge.connect":
1886
+ i.push({
1887
+ ...e,
1888
+ kind: "graph.edge.disconnect"
1889
+ });
1890
+ break;
1891
+ case "graph.edge.disconnect": {
1892
+ let { target: r } = e, a = r.kind == "flow" ? n.document.graph : n.document.subflows[r.id].graph, o = r.kind == "flow" ? t.document.graph : t.document.subflows[r.id].graph;
1893
+ i.push(...o.edges.map((e) => ({
1894
+ kind: "graph.edge.disconnect",
1895
+ target: r,
1896
+ edge: e
1897
+ }))), i.push(...a.edges.map((e) => ({
1898
+ kind: "graph.edge.connect",
1899
+ target: r,
1900
+ edge: e
1901
+ })));
1902
+ break;
1903
+ }
1904
+ case "module.create":
1905
+ i.push({
1906
+ kind: "module.delete",
1907
+ moduleId: e.moduleId
1908
+ });
1909
+ break;
1910
+ case "module.delete":
1911
+ i.push({
1912
+ kind: "module.create",
1913
+ moduleId: e.moduleId,
1914
+ module: n.modules[e.moduleId]
1915
+ });
1916
+ break;
1917
+ case "binding.create":
1918
+ i.push({
1919
+ kind: "binding.delete",
1920
+ bindingId: e.bindingId
1921
+ });
1922
+ break;
1923
+ case "binding.delete":
1924
+ i.push({
1925
+ kind: "binding.create",
1926
+ bindingId: e.bindingId,
1927
+ binding: n.document.bindings[e.bindingId]
1928
+ });
1929
+ break;
1930
+ case "task.create":
1931
+ i.push({
1932
+ kind: "task.delete",
1933
+ taskId: e.taskId
1934
+ });
1935
+ break;
1936
+ case "task.delete":
1937
+ i.push({
1938
+ kind: "task.create",
1939
+ taskId: e.taskId,
1940
+ task: n.document.tasks[e.taskId]
1941
+ });
1942
+ break;
1943
+ case "graph.node.input.set":
1944
+ i.push({
1945
+ ...e,
1946
+ before: e.value,
1947
+ value: e.before
1948
+ });
1949
+ break;
1950
+ default: throw Error(`Unsupported canvas history operation: ${e.kind}`);
1951
+ }
1952
+ r.push(i), n = t;
1953
+ }
1954
+ return r.toReversed().flat();
1955
+ }
1956
+ //#endregion
1957
+ //#region src/workbench/browser/runtime/stores/canvasHistory.ts
1958
+ var rn = class {
1959
+ constructor() {
1960
+ this.state$ = n({
1961
+ canUndo: !1,
1962
+ canRedo: !1,
1963
+ applying: !1,
1964
+ failed: !1,
1965
+ undo: void 0,
1966
+ redo: void 0
1967
+ }), this.#e = [], this.#t = [], this.generation = 0, this.pending = 0, this.applying = !1, this.failed = !1;
1968
+ }
1969
+ #e;
1970
+ #t;
1971
+ clear() {
1972
+ let e = this.#e.length + this.#t.length > 0;
1973
+ return this.generation++, this.#e.length = 0, this.#t.length = 0, this.publish(), e;
1974
+ }
1975
+ record(e) {
1976
+ if (this.#t.length = 0, this.#e.push(e), this.#n([e]) > 10485760) return this.clear(), !1;
1977
+ for (; this.#e.length > 30 || this.#n(this.#e) > 10485760;) this.#e.shift();
1978
+ return this.publish(), !0;
1979
+ }
1980
+ complete(e) {
1981
+ let t = e ? this.#t : this.#e, n = e ? this.#e : this.#t, r = t.pop();
1982
+ r != null && n.push(r), this.publish();
1983
+ }
1984
+ publish() {
1985
+ let e = this.pending == 0 && !this.applying && !this.failed;
1986
+ this.state$.set({
1987
+ canUndo: e && this.#e.length > 0,
1988
+ canRedo: e && this.#t.length > 0,
1989
+ applying: this.applying,
1990
+ failed: this.failed,
1991
+ undo: this.#e.at(-1),
1992
+ redo: this.#t.at(-1)
1993
+ });
1994
+ }
1995
+ #n(e) {
1996
+ return new TextEncoder().encode(JSON.stringify(e)).byteLength;
1997
+ }
1998
+ };
1999
+ //#endregion
1832
2000
  //#region src/workbench/browser/runtime/stores/draftChanges.ts
1833
- function Qt(e, t) {
2001
+ function an(e, t) {
1834
2002
  if (e.length != 1 || t.length != 1) return;
1835
2003
  let n = e[0], r = t[0];
1836
2004
  if (n?.kind == "graph.node.field.set" && r?.kind == "graph.node.field.set") return n.nodeId != r.nodeId || n.field != r.field || n.target.kind != r.target.kind || n.target.kind == "subflow" && (r.target.kind != "subflow" || n.target.id != r.target.id) ? void 0 : [{
@@ -1850,7 +2018,7 @@ function Qt(e, t) {
1850
2018
  value: r.value
1851
2019
  }];
1852
2020
  }
1853
- var $t = class {
2021
+ var on = class {
1854
2022
  #e;
1855
2023
  #t;
1856
2024
  #n;
@@ -1878,34 +2046,37 @@ var $t = class {
1878
2046
  this.#a = e;
1879
2047
  let t = e, n = [];
1880
2048
  for (let e of this.#o) try {
1881
- t = P(t, e.changes), n.push(e);
2049
+ t = I(t, e.changes), n.push(e);
1882
2050
  } catch (t) {
1883
- if (!(t instanceof qe)) throw t;
2051
+ if (!(t instanceof Ke)) throw t;
1884
2052
  e.active = !1;
1885
2053
  }
1886
2054
  return this.#o = n, t;
1887
2055
  }
1888
2056
  project(e) {
1889
- return this.#o.reduce((e, t) => P(e, t.changes), e);
2057
+ return this.#o.reduce((e, t) => I(e, t.changes), e);
2058
+ }
2059
+ async settled() {
2060
+ await this.#s;
1890
2061
  }
1891
2062
  enqueue(e) {
1892
2063
  let t = this.#s.then(e);
1893
2064
  return this.#s = t, t;
1894
2065
  }
1895
2066
  async change(e, t, n, r = !0) {
1896
- let i = this.#o.at(-1), a = i == null || i.started || !i.active ? void 0 : Qt(i.changes, n);
2067
+ let i = this.#o.at(-1), a = i == null || i.started || !i.active ? void 0 : an(i.changes, n);
1897
2068
  if (i != null && a != null) return i.changes = a, this.#a != null && this.#t.apply(this.project(this.#a)), i.result;
1898
2069
  this.#t.beforeChange(r);
1899
2070
  let o = {
1900
2071
  ...e,
1901
2072
  active: !0,
1902
- changeId: E(),
2073
+ changeId: L(),
1903
2074
  changes: n,
1904
2075
  started: !1
1905
2076
  };
1906
2077
  this.#a ??= t, this.#o.push(o), this.#t.apply(this.project(this.#a)), this.#i += 1;
1907
2078
  let s = this.#s.then(() => (o.started = !0, this.#c(o)));
1908
- o.result = s, this.#s = s.then(() => void 0);
2079
+ o.result = s, this.#s = s.then(() => void 0, () => void 0);
1909
2080
  try {
1910
2081
  return await s;
1911
2082
  } finally {
@@ -1924,21 +2095,21 @@ var $t = class {
1924
2095
  let r = this.#l(e, n, t);
1925
2096
  return this.#o.length == 0 && this.#t.check(), r;
1926
2097
  } catch (n) {
1927
- if (n instanceof m && n.code == "flow.revision-conflict") {
2098
+ if (n instanceof c && n.code == "flow.revision-conflict") {
1928
2099
  if (!t && await this.#t.recover(e)) {
1929
- t = !0, e.changeId = E();
2100
+ t = !0, e.changeId = L();
1930
2101
  continue;
1931
2102
  }
1932
2103
  t && await this.#t.recover(e), this.#u(e);
1933
2104
  } else {
1934
- if (!(n instanceof m) && !t) {
2105
+ if (!(n instanceof c) && !t) {
1935
2106
  let n = this.#a?.revisionId;
1936
2107
  if (await this.#t.recover(e)) {
1937
- t = !0, e.active && this.#a?.revisionId != n && (e.changeId = E());
2108
+ t = !0, e.active && this.#a?.revisionId != n && (e.changeId = L());
1938
2109
  continue;
1939
2110
  }
1940
2111
  }
1941
- this.#u(e), this.#t.current(e) && this.#r(D(n, this.#n.t));
2112
+ this.#u(e), this.#t.current(e) && this.#r(C(n, this.#n.t));
1942
2113
  }
1943
2114
  return;
1944
2115
  }
@@ -1947,7 +2118,7 @@ var $t = class {
1947
2118
  #l(e, t, n) {
1948
2119
  let r = {
1949
2120
  ...n.revision,
1950
- content: P(t, e.changes).content
2121
+ content: I(t, e.changes).content
1951
2122
  };
1952
2123
  this.#o = this.#o.filter((t) => t !== e), this.#a = r;
1953
2124
  let i = this.#t.diagnostics(), a = this.#o.length == 0 && i?.revisionId == r.revisionId;
@@ -1956,7 +2127,7 @@ var $t = class {
1956
2127
  #u(e) {
1957
2128
  e.active = !1, this.#o = this.#o.filter((t) => t !== e), !(!this.#t.current(e) || this.#a == null) && this.#t.apply(this.project(this.#a));
1958
2129
  }
1959
- }, en = 50, tn = {
2130
+ }, sn = 50, cn = {
1960
2131
  failed: !1,
1961
2132
  loaded: !1,
1962
2133
  loading: !0,
@@ -1964,12 +2135,12 @@ var $t = class {
1964
2135
  loadMoreFailed: !1,
1965
2136
  refreshing: !1,
1966
2137
  flows: []
1967
- }, nn = class {
2138
+ }, ln = class {
1968
2139
  #e;
1969
2140
  #t;
1970
- #n = new T();
2141
+ #n = new s();
1971
2142
  #r;
1972
- #i = n(tn);
2143
+ #i = n(cn);
1973
2144
  #a = new AbortController();
1974
2145
  #o = /* @__PURE__ */ new Set();
1975
2146
  #s = !1;
@@ -2016,7 +2187,7 @@ var $t = class {
2016
2187
  try {
2017
2188
  let t = await this.#e.listFlows({
2018
2189
  includeTotal: !0,
2019
- limit: en
2190
+ limit: sn
2020
2191
  });
2021
2192
  if (!e()) return;
2022
2193
  this.#c({
@@ -2033,7 +2204,7 @@ var $t = class {
2033
2204
  failed: !t,
2034
2205
  loading: !1,
2035
2206
  refreshing: !1
2036
- }), this.#r(D(n, this.#t.t));
2207
+ }), this.#r(C(n, this.#t.t));
2037
2208
  }
2038
2209
  }
2039
2210
  async loadMore() {
@@ -2047,7 +2218,7 @@ var $t = class {
2047
2218
  try {
2048
2219
  let e = await this.#e.listFlows({
2049
2220
  cursor: t,
2050
- limit: en
2221
+ limit: sn
2051
2222
  });
2052
2223
  if (!r()) return;
2053
2224
  let n = new Set(this.#i.value.flows.map((e) => e.flowId));
@@ -2061,7 +2232,7 @@ var $t = class {
2061
2232
  this.#c({
2062
2233
  loadingMore: !1,
2063
2234
  loadMoreFailed: !0
2064
- }), this.#r(D(e, this.#t.t));
2235
+ }), this.#r(C(e, this.#t.t));
2065
2236
  }
2066
2237
  }
2067
2238
  async setEnabled(e, t) {
@@ -2071,7 +2242,7 @@ var $t = class {
2071
2242
  let n = await this.#e.setFlowEnabled(e.flowId, e.live.publicationId, t);
2072
2243
  this.#s || this.include(n);
2073
2244
  } catch (e) {
2074
- this.#s || (this.#r(D(e, this.#t.t)), await this.reload());
2245
+ this.#s || (this.#r(C(e, this.#t.t)), await this.reload());
2075
2246
  } finally {
2076
2247
  this.#o.delete(e.flowId);
2077
2248
  }
@@ -2083,9 +2254,9 @@ var $t = class {
2083
2254
  try {
2084
2255
  let t = await this.#e.publishFlow(e.flowId, e.draftRevisionId, e.live?.publicationId ?? null);
2085
2256
  if (this.#s) return;
2086
- let n = await q.runPromise(q.gen({ self: this }, function* () {
2257
+ let n = await X.runPromise(X.gen({ self: this }, function* () {
2087
2258
  let n = t;
2088
- for (; n.status == "pending";) yield* q.sleep(1e3), n = yield* q.tryPromise((t) => this.#e.getPublishOperation(e.flowId, n.operationId, t));
2259
+ for (; n.status == "pending";) yield* X.sleep(1e3), n = yield* X.tryPromise((t) => this.#e.getPublishOperation(e.flowId, n.operationId, t));
2089
2260
  return n;
2090
2261
  }), { signal: this.#a.signal });
2091
2262
  if (this.#s) return;
@@ -2097,7 +2268,7 @@ var $t = class {
2097
2268
  message: this.#t.t("notice.published", { name: e.name })
2098
2269
  }), this.include(await this.#e.getFlow(e.flowId));
2099
2270
  } catch (e) {
2100
- this.#s || this.#r(D(e, this.#t.t));
2271
+ this.#s || this.#r(C(e, this.#t.t));
2101
2272
  } finally {
2102
2273
  this.#o.delete(e.flowId);
2103
2274
  }
@@ -2139,7 +2310,7 @@ var $t = class {
2139
2310
  ...e
2140
2311
  });
2141
2312
  }
2142
- }, rn = class {
2313
+ }, un = class {
2143
2314
  #e;
2144
2315
  #t;
2145
2316
  #n;
@@ -2157,10 +2328,13 @@ var $t = class {
2157
2328
  dispose() {
2158
2329
  this.#o = !0, this.#s = [];
2159
2330
  }
2331
+ async settled() {
2332
+ await this.#i;
2333
+ }
2160
2334
  async change(e, t, n, r) {
2161
- if (this.#o || this.#a == null) return;
2335
+ if (this.#o || this.#a == null) return !1;
2162
2336
  let i = r(t.value);
2163
- if (i === t.value) return;
2337
+ if (B(i, t.value)) return !0;
2164
2338
  let a = {
2165
2339
  current: n,
2166
2340
  flowId: e,
@@ -2169,20 +2343,22 @@ var $t = class {
2169
2343
  this.#s.push(a), this.#r({
2170
2344
  ...t,
2171
2345
  value: i
2172
- }), this.#i = this.#i.then(async () => {
2346
+ });
2347
+ let o = !1;
2348
+ return this.#i = this.#i.then(async () => {
2173
2349
  if (this.#o || !n()) return;
2174
2350
  let t = this.#a, i = r(t.value);
2175
- if (i === t.value) {
2176
- this.#c(a, t);
2351
+ if (B(i, t.value)) {
2352
+ this.#c(a, t), o = !0;
2177
2353
  return;
2178
2354
  }
2179
2355
  try {
2180
2356
  let r = await this.#e.updatePresentation(e, t.revision, i);
2181
2357
  if (this.#o || !n()) return;
2182
- this.#c(a, r);
2358
+ this.#c(a, r), o = !0;
2183
2359
  } catch (r) {
2184
2360
  if (this.#o || !n()) return;
2185
- if (r instanceof m && r.code == "flow.presentation-conflict") try {
2361
+ if (r instanceof c && r.code == "flow.presentation-conflict") try {
2186
2362
  let t = await this.#e.getPresentation(e);
2187
2363
  if (this.#o || !n()) return;
2188
2364
  this.#c(a, t), this.#n({
@@ -2190,11 +2366,11 @@ var $t = class {
2190
2366
  message: this.#t.t("notice.layoutConflict")
2191
2367
  });
2192
2368
  } catch (e) {
2193
- !this.#o && n() && this.#n(D(e, this.#t.t));
2369
+ !this.#o && n() && this.#c(a, t), !this.#o && n() && this.#n(C(e, this.#t.t));
2194
2370
  }
2195
- else this.#c(a, t), this.#n(D(r, this.#t.t));
2371
+ else this.#c(a, t), this.#n(C(r, this.#t.t));
2196
2372
  }
2197
- }), await this.#i;
2373
+ }), await this.#i, o;
2198
2374
  }
2199
2375
  #c(e, t) {
2200
2376
  this.#s = this.#s.filter((t) => t !== e), this.#a = t;
@@ -2204,21 +2380,21 @@ var $t = class {
2204
2380
  value: n
2205
2381
  });
2206
2382
  }
2207
- }, an = {
2383
+ }, dn = {
2208
2384
  checkLoading: !1,
2209
2385
  selectedNodeIds: [],
2210
2386
  workspaceLoadFailed: !1,
2211
2387
  workspaceLoading: !1
2212
2388
  };
2213
- function on(e) {
2389
+ function fn(e) {
2214
2390
  return e.workspaceLoading ? "loading" : e.moduleSaveStatus == null ? e.busy == "designer" ? "saving" : e.draft == null ? "noDraft" : "saved" : e.moduleSaveStatus;
2215
2391
  }
2216
- function sn(e, t) {
2392
+ function pn(e, t) {
2217
2393
  if (t.phase != null) return t.phase;
2218
2394
  let n = e?.content.modules[t.moduleId];
2219
2395
  return n == null ? "failed" : t.source == n.source ? "saved" : "dirty";
2220
2396
  }
2221
- function cn(e, t, n) {
2397
+ function mn(e, t, n) {
2222
2398
  if (e == null || t == null || n.length != 1) return;
2223
2399
  let r = e.node(t, n[0]);
2224
2400
  if (!(r?.kind != "task" || r.definition == null || !("moduleId" in r.definition) || r.module == null)) return {
@@ -2226,9 +2402,9 @@ function cn(e, t, n) {
2226
2402
  source: r.module.source
2227
2403
  };
2228
2404
  }
2229
- var ln = class {
2405
+ var hn = class {
2230
2406
  #e;
2231
- #t = n(an);
2407
+ #t = n(dn);
2232
2408
  #n;
2233
2409
  constructor(n, r) {
2234
2410
  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) => {
@@ -2236,25 +2412,25 @@ var ln = class {
2236
2412
  let { phase: t, ...n } = e.moduleEditor;
2237
2413
  return {
2238
2414
  ...n,
2239
- status: sn(e.draft, e.moduleEditor)
2415
+ status: pn(e.draft, e.moduleEditor)
2240
2416
  };
2241
- }), 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 : w(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);
2417
+ }), 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 : F(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);
2242
2418
  this.#e = e(this.#t, (e) => ({
2243
- revision: e.draft == null ? void 0 : w(e.draft),
2419
+ revision: e.draft == null ? void 0 : F(e.draft),
2244
2420
  target: e.target
2245
2421
  }), { equal: (e, t) => e.revision === t.revision && e.target === t.target });
2246
2422
  let y = e(this.#t, (e) => {
2247
- if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return w(e.draft).selection(e.target, e.selectedNodeIds[0]);
2423
+ if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return F(e.draft).selection(e.target, e.selectedNodeIds[0]);
2248
2424
  });
2249
2425
  this.$ = {
2250
2426
  addNodeOptions: t((e) => {
2251
2427
  let { revision: t, target: r } = e(this.#e);
2252
- return C(t?.revision, r, e(n.t$));
2428
+ return O(t?.revision, r, e(n.t$));
2253
2429
  }),
2254
2430
  busy: i,
2255
2431
  checkLoading: a,
2256
2432
  diagnosticFocus: o,
2257
- diagnosticItems: e(this.#t, (e) => b(e.draft == null ? void 0 : w(e.draft), e.target, e.diagnostics)),
2433
+ diagnosticItems: e(this.#t, (e) => Ae(e.draft == null ? void 0 : F(e.draft), e.target, e.diagnostics)),
2258
2434
  diagnostics: s,
2259
2435
  draft: c,
2260
2436
  flow: t((e) => {
@@ -2270,7 +2446,7 @@ var ln = class {
2270
2446
  flowRefreshing: r.$.refreshing,
2271
2447
  flowTotal: r.$.total,
2272
2448
  flows: r.$.flows,
2273
- inspectorDiagnostics: e(this.#t, (e) => k(e.draft == null ? void 0 : w(e.draft), e.target, e.diagnostics, y.value)),
2449
+ inspectorDiagnostics: e(this.#t, (e) => ue(e.draft == null ? void 0 : F(e.draft), e.target, e.diagnostics, y.value)),
2274
2450
  live: p,
2275
2451
  moduleEditor: l,
2276
2452
  nodeFocus: u,
@@ -2278,11 +2454,11 @@ var ln = class {
2278
2454
  revision: m,
2279
2455
  selection: y,
2280
2456
  selectedNodeIds: h,
2281
- status: e(this.#t, on),
2457
+ status: e(this.#t, fn),
2282
2458
  target: g,
2283
2459
  targetFlow: t((e) => e(g)?.kind == "flow" ? e(r.$.flows).find((t) => t.flowId == e(f)) : void 0),
2284
2460
  targetName: e(this.#t, (e) => {
2285
- if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id : w(e.draft).subflow(e.target.id)?.name ?? e.target.id;
2461
+ if (e.target != null) return e.target.kind == "flow" ? r.flow(e.flowId ?? "")?.name : e.draft == null ? e.target.id : F(e.draft).subflow(e.target.id)?.name ?? e.target.id;
2286
2462
  }),
2287
2463
  workspaceLoadFailed: _,
2288
2464
  workspaceLoading: v
@@ -2301,17 +2477,17 @@ var ln = class {
2301
2477
  for (let e of Object.values(this.$)) this.#n.has(e) || e.dispose();
2302
2478
  this.#e.dispose(), this.#t.dispose();
2303
2479
  }
2304
- }, un = {
2480
+ }, gn = {
2305
2481
  x: 40,
2306
2482
  y: 40
2307
2483
  };
2308
- function dn(e, t) {
2484
+ function _n(e, t) {
2309
2485
  if (t != null) return t.kind == "flow" || e.subflow(t.id) != null ? t : { kind: "flow" };
2310
2486
  }
2311
- var fn = class {
2487
+ var vn = class {
2312
2488
  #e;
2313
2489
  #t;
2314
- #n = new T();
2490
+ #n;
2315
2491
  #r;
2316
2492
  #i;
2317
2493
  #a;
@@ -2319,42 +2495,44 @@ var fn = class {
2319
2495
  #s;
2320
2496
  #c;
2321
2497
  #l;
2322
- #u = /* @__PURE__ */ new Map();
2498
+ #u;
2323
2499
  #d;
2324
2500
  #f;
2325
- #p = 0;
2326
- #m = 0;
2327
- #h = !1;
2328
- #g = !1;
2329
- #_ = !1;
2330
- #v = 0;
2501
+ #p;
2502
+ #m;
2503
+ #h;
2504
+ #g;
2505
+ #_;
2506
+ #v;
2331
2507
  #y;
2332
2508
  #b;
2333
- constructor(e, t, n = kt, r = V(), i = () => {}) {
2334
- this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new nn(e, t, r), this.#l = new ln(r, this.#o), this.#t = new $t(e, t, r, {
2335
- apply: (e, t) => this.#E(e, "local", t),
2509
+ #x;
2510
+ #S;
2511
+ constructor(e, t, n = At, r = W(), i = () => {}) {
2512
+ this.#n = new s(), this.#u = /* @__PURE__ */ new Map(), this.#d = new rn(), this.history$ = this.#d.state$, this.#h = 0, this.#g = 0, this.#_ = !1, this.#v = !1, this.#y = !1, this.#b = 0, this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new ln(e, t, r), this.#l = new hn(r, this.#o), this.#t = new on(e, t, r, {
2513
+ apply: (e, t) => this.#O(e, "local", t),
2336
2514
  beforeChange: (e) => {
2337
- e && (this.#I({ busy: "designer" }), this.#c(void 0));
2515
+ e && (this.#V({ busy: "designer" }), this.#c(void 0));
2338
2516
  },
2339
- check: () => void this.#O(),
2340
- current: (e) => this.#N(e),
2517
+ check: () => void this.#N(),
2518
+ current: (e) => this.#R(e),
2341
2519
  diagnostics: () => this.#l.value.diagnostics,
2342
2520
  finishChanges: () => {
2343
- !this.#g && this.#l.value.busy == "designer" && this.#I({ busy: void 0 });
2521
+ !this.#v && this.#l.value.busy == "designer" && this.#V({ busy: void 0 });
2344
2522
  },
2345
2523
  headChanged: (e, t) => this.#o.advanceHead(e, t),
2346
- recover: (e) => this.#A(e, !0)
2347
- }), this.#a = new rn(e, t, (e) => this.#I({ presentation: e }), r), this.$ = this.#l.$;
2524
+ recover: (e) => (this.retryHistorySync(), this.#F(e, !0))
2525
+ }), this.#a = new un(e, t, (e) => this.#V({ presentation: e }), r), this.$ = this.#l.$;
2348
2526
  }
2349
2527
  dispose() {
2350
- this.#g = !0, this.#n.invalidate(), this.#a.dispose(), this.#y?.(), this.#b?.(), this.#l.dispose(), this.#o.dispose();
2528
+ this.#v = !0, this.#n.invalidate(), this.#a.dispose(), this.#x?.(), this.#S?.(), this.history$.dispose(), this.#l.dispose(), this.#o.dispose();
2351
2529
  }
2352
2530
  async start(e) {
2353
- if (this.#y == null) {
2531
+ if (this.#x == null) {
2354
2532
  let e = this.#e.watchFlowCatalog(() => void this.reloadFlows());
2355
- this.#y = e.stop, await e.ready;
2533
+ this.#x = e.stop, await e.ready;
2356
2534
  }
2357
- this.#g || (await this.reloadFlows(), this.#g || await this.selectFlow(e));
2535
+ this.#v || (await this.reloadFlows(), this.#v || await this.selectFlow(e));
2358
2536
  }
2359
2537
  async reloadFlows() {
2360
2538
  await this.#o.reload();
@@ -2369,9 +2547,10 @@ var fn = class {
2369
2547
  await this.#o.loadMore();
2370
2548
  }
2371
2549
  async selectFlow(e) {
2372
- if (!await this.saveModuleEditor()) return !1;
2550
+ if (this.#d.applying || !await this.saveModuleEditor() || this.#v) return !1;
2551
+ this.#d.clear(), this.#d.failed = !1, this.#d.publish();
2373
2552
  let t = this.#n.begin();
2374
- if (this.#t.reset(), this.#a.reset(), this.#m = 0, this.#h = !1, this.#_ = !1, this.#b?.(), this.#b = void 0, this.#I({
2553
+ if (this.#t.reset(), this.#a.reset(), this.#g = 0, this.#_ = !1, this.#y = !1, this.#S?.(), this.#S = void 0, this.#V({
2375
2554
  checkLoading: !1,
2376
2555
  diagnosticFocus: void 0,
2377
2556
  diagnostics: void 0,
@@ -2388,26 +2567,26 @@ var fn = class {
2388
2567
  }), e == null) return !0;
2389
2568
  try {
2390
2569
  let n = !1, r, i = this.#e.watchFlow(e, (e) => {
2391
- t() && (this.#t.committed == null ? (n = !0, r = e) : e != this.#t.committed.revisionId && this.#k(e));
2570
+ t() && (this.#t.committed == null ? (n = !0, r = e) : e != this.#t.committed.revisionId && this.#P(e));
2392
2571
  }, (e) => {
2393
2572
  t() && this.#s(e);
2394
2573
  });
2395
- if (this.#b = i.stop, await i.ready, !t()) return !1;
2574
+ if (this.#S = i.stop, await i.ready, !t()) return !1;
2396
2575
  let { flow: a, draft: o, live: s, presentation: c } = await this.#e.getEditor(e);
2397
2576
  if (!t()) return !1;
2398
- this.#t.reset(o), this.#a.reset(c), this.#o.include(a), this.#I({
2577
+ this.#t.reset(o), this.#a.reset(c), this.#o.include(a), this.#V({
2399
2578
  draft: o,
2400
2579
  live: s,
2401
2580
  presentation: c,
2402
2581
  target: { kind: "flow" },
2403
2582
  workspaceLoadFailed: !1,
2404
2583
  workspaceLoading: !1
2405
- }), await this.#T(t), n && r != o.revisionId && this.#k(r);
2584
+ }), await this.#D(t), n && r != o.revisionId && this.#P(r);
2406
2585
  } catch (e) {
2407
2586
  if (!t()) return !1;
2408
- this.#b?.(), this.#b = void 0;
2409
- let n = e instanceof m && e.code == O.flowNotFound;
2410
- return this.#I(n ? {
2587
+ this.#S?.(), this.#S = void 0;
2588
+ let n = e instanceof c && e.code == le.flowNotFound;
2589
+ return this.#V(n ? {
2411
2590
  flowId: void 0,
2412
2591
  target: void 0,
2413
2592
  workspaceLoadFailed: !1,
@@ -2418,39 +2597,39 @@ var fn = class {
2418
2597
  }), this.#c(n ? {
2419
2598
  kind: "error",
2420
2599
  message: this.#r.t("notice.flowMissing")
2421
- } : D(e, this.#r.t)), !1;
2600
+ } : C(e, this.#r.t)), !1;
2422
2601
  }
2423
2602
  return !0;
2424
2603
  }
2425
2604
  selectTarget(e) {
2426
- return this.#x(), this.#I({
2605
+ return !this.#d.applying && (B(e, this.#l.value.target) || this.#d.clear(), this.#C(), this.#V({
2427
2606
  diagnosticFocus: void 0,
2428
2607
  diagnostics: void 0,
2429
2608
  moduleEditor: void 0,
2430
2609
  nodeFocus: void 0,
2431
2610
  selectedNodeIds: [],
2432
2611
  target: e
2433
- }), this.#O(), !0;
2612
+ }), this.#N(), !0);
2434
2613
  }
2435
2614
  selectNodes(e) {
2436
- return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : (this.#x(), this.#I({
2615
+ return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : (this.#C(), this.#V({
2437
2616
  diagnosticFocus: void 0,
2438
- moduleEditor: cn(this.#l.value.draft == null ? void 0 : w(this.#l.value.draft), this.#l.value.target, e),
2617
+ moduleEditor: mn(this.#l.value.draft == null ? void 0 : F(this.#l.value.draft), this.#l.value.target, e),
2439
2618
  nodeFocus: void 0,
2440
2619
  selectedNodeIds: e
2441
2620
  }), !0);
2442
2621
  }
2443
2622
  async createFlow(e, t) {
2444
2623
  if (await this.saveModuleEditor()) {
2445
- this.#I({ busy: "flow" }), this.#c(void 0);
2624
+ this.#V({ busy: "flow" }), this.#c(void 0);
2446
2625
  try {
2447
2626
  if (t == null) return await this.#o.create(e);
2448
2627
  let n = await this.#e.getFlow(await t(e));
2449
2628
  return this.#o.insert(n), n;
2450
2629
  } catch (e) {
2451
- this.#g || this.#c(D(e, this.#r.t));
2630
+ this.#v || this.#c(C(e, this.#r.t));
2452
2631
  } finally {
2453
- this.#I({ busy: void 0 });
2632
+ this.#V({ busy: void 0 });
2454
2633
  }
2455
2634
  }
2456
2635
  }
@@ -2458,24 +2637,24 @@ var fn = class {
2458
2637
  if (!await this.saveModuleEditor()) return !1;
2459
2638
  let t = this.#o.flow(e);
2460
2639
  if (t == null || t.status == "retiring") return !1;
2461
- this.#I({ busy: "flow" }), this.#c(void 0);
2640
+ this.#V({ busy: "flow" }), this.#c(void 0);
2462
2641
  try {
2463
- return await this.#e.deleteFlow(e), !this.#g && (this.#o.remove(e), this.#c({
2642
+ return await this.#e.deleteFlow(e), !this.#v && (this.#o.remove(e), this.#c({
2464
2643
  kind: "success",
2465
2644
  message: this.#r.t("notice.flowDeleteAccepted", { name: t.name })
2466
2645
  }), !0);
2467
2646
  } catch (e) {
2468
- return this.#g || this.#c(D(e, this.#r.t)), !1;
2647
+ return this.#v || this.#c(C(e, this.#r.t)), !1;
2469
2648
  } finally {
2470
- this.#I({ busy: void 0 });
2649
+ this.#V({ busy: void 0 });
2471
2650
  }
2472
2651
  }
2473
2652
  async createResource(e) {
2474
2653
  if (!await this.saveModuleEditor() || this.#l.value.draft == null) return !1;
2475
2654
  let t = this.#i();
2476
- this.#I({ busy: "resource" }), this.#c(void 0);
2477
- let n = await this.#w(xe(t, e), !1);
2478
- return this.#I({ busy: void 0 }), n != null && (this.selectTarget({
2655
+ this.#V({ busy: "resource" }), this.#c(void 0);
2656
+ let n = await this.#E(Ce(t, e), !1);
2657
+ return this.#V({ busy: void 0 }), n != null && (this.selectTarget({
2479
2658
  id: t,
2480
2659
  kind: "subflow"
2481
2660
  }), this.#c({
@@ -2487,14 +2666,14 @@ var fn = class {
2487
2666
  let n = this.#o.flow(e), r = t.trim();
2488
2667
  if (n == null || r.length == 0) return !1;
2489
2668
  if (n.name == r) return !0;
2490
- this.#I({ busy: "flow" }), this.#c(void 0);
2669
+ this.#V({ busy: "flow" }), this.#c(void 0);
2491
2670
  let i;
2492
2671
  try {
2493
2672
  i = await this.#e.renameFlow(e, r), i != null && this.#o.include(i);
2494
2673
  } catch (e) {
2495
- this.#g || this.#c(D(e, this.#r.t));
2674
+ this.#v || this.#c(C(e, this.#r.t));
2496
2675
  }
2497
- return this.#I({ busy: void 0 }), i != null && (this.#c({
2676
+ return this.#V({ busy: void 0 }), i != null && (this.#c({
2498
2677
  kind: "success",
2499
2678
  message: this.#r.t("notice.flowRenamed", { name: r })
2500
2679
  }), !0);
@@ -2504,56 +2683,59 @@ var fn = class {
2504
2683
  let r = this.#l.value.draft, i = this.#l.value.target;
2505
2684
  if (r == null || i == null) return;
2506
2685
  let a = this.#i();
2507
- if (e.kind == "comment") return await this.#C(i, a, t);
2508
- let o = w(r), s = Fe(e, o, i, this.#r.t);
2686
+ if (e.kind == "comment") return await this.#T(i, a, t);
2687
+ let o = F(r), s = Fe(e, o, i, this.#r.t);
2509
2688
  if (s == null) return;
2510
- let c = n?.(a), l = Ae(o, i, a, s, this.#i);
2689
+ let c = n?.(a), l = ke(o, i, a, s, this.#i);
2511
2690
  if (l == null) return;
2512
- let u = c == null ? l : [...l, ...wt(P(r, l).content, i, {
2691
+ let u = c == null ? l : [...l, ...Tt(I(r, l).content, i, {
2513
2692
  source: c.source,
2514
2693
  target: c.target,
2515
2694
  ...c.sourceHandle.startsWith("$branch:") ? { sourceHandle: c.sourceHandle.slice(8) } : {}
2516
- })], d = this.#w(u);
2517
- this.selectNodes([a]);
2518
- let f = this.moveNodes({ [a]: t });
2519
- if (await d != null && (await f, !this.#g)) return this.#I({ nodeFocus: {
2695
+ })];
2696
+ if (await this.#j("add", 1, u, (e) => v(e, i, { [a]: t }), [a]) && !this.#v) return this.#V({ nodeFocus: {
2520
2697
  nodeId: a,
2521
- requestId: ++this.#v
2698
+ requestId: ++this.#b
2522
2699
  } }), a;
2523
2700
  }
2524
2701
  async connect(e) {
2525
2702
  let t = this.$.revision.value, n = this.#l.value.target;
2526
2703
  if (t == null || n == null) return;
2527
- let r = wt(t.revision.content, n, {
2704
+ let r = Tt(t.revision.content, n, {
2528
2705
  source: e.source,
2529
2706
  target: e.target,
2530
2707
  ...e.sourceHandle.startsWith("$branch:") ? { sourceHandle: e.sourceHandle.slice(8) } : {}
2531
2708
  });
2532
- r.length > 0 && await this.#w(r);
2709
+ r.length > 0 && await this.#j("connect", 1, r);
2533
2710
  }
2534
2711
  async disconnect(e) {
2535
2712
  let t = this.$.revision.value, n = this.#l.value.target;
2536
2713
  if (t == null || n == null) return;
2537
- let r = Tt(t.revision.content, n, {
2714
+ let r = Et(t.revision.content, n, {
2538
2715
  source: e.source,
2539
2716
  target: e.target,
2540
2717
  ...e.sourceHandle.startsWith("$branch:") ? { sourceHandle: e.sourceHandle.slice(8) } : {}
2541
2718
  });
2542
- r.length > 0 && await this.#w(r);
2719
+ r.length > 0 && await this.#j("disconnect", 1, r);
2543
2720
  }
2544
2721
  async deleteSelectedNodes() {
2545
2722
  if (!await this.saveModuleEditor()) return;
2546
2723
  let e = this.$.revision.value, t = this.#l.value.target;
2547
2724
  if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
2548
- let n = c(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = Oe(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#w(i), o = r.size == 0 ? void 0 : this.#D((e) => me(e, t, r));
2549
- this.selectNodes([]), (a == null || await a != null) && await o;
2725
+ let n = [...this.#l.value.selectedNodeIds], r = x(this.#l.value.presentation?.value ?? {}, t), i = new Set(this.#l.value.selectedNodeIds.filter((e) => r.has(e))), a = De(e, t, this.#l.value.selectedNodeIds);
2726
+ await this.#j("delete", this.#l.value.selectedNodeIds.length, a, (e) => {
2727
+ let r = i.size == 0 ? e : y(e, t, i);
2728
+ for (let e of n) r = g(r, t, e, !1);
2729
+ return r;
2730
+ }, []);
2550
2731
  }
2551
2732
  copySelectedNodes() {
2552
2733
  let e = this.$.revision.value, t = this.#l.value.target;
2553
2734
  if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
2554
2735
  let n = new Set(this.#l.value.selectedNodeIds);
2555
- this.#f = {
2556
- comments: this.#j().nodes.flatMap((e) => e.kind == "comment" && n.has(e.id) ? [{
2736
+ this.#m = {
2737
+ hiddenNodeIds: this.#I().nodes.flatMap((e) => e.contentHidden && n.has(e.id) ? [e.id] : []),
2738
+ comments: this.#I().nodes.flatMap((e) => e.kind == "comment" && n.has(e.id) ? [{
2557
2739
  content: e.content,
2558
2740
  position: e.position,
2559
2741
  sourceId: e.id,
@@ -2562,29 +2744,31 @@ var fn = class {
2562
2744
  nodes: M(e, t, this.#l.value.selectedNodeIds)
2563
2745
  };
2564
2746
  }
2565
- async pasteNodes(e, t = un) {
2747
+ async pasteNodes(e, t = gn) {
2566
2748
  if (!await this.saveModuleEditor()) return;
2567
2749
  let n = this.$.revision.value, r = this.#l.value.target;
2568
- if (n == null || r == null || this.#f == null) return;
2569
- let i = ne(n, r, this.#f.nodes, this.#i), a = i.changes.length == 0 ? void 0 : this.#w(i.changes), o = this.#f.comments.map((e) => ({
2750
+ if (n == null || r == null || this.#m == null) return;
2751
+ let i = new Set(this.#m.hiddenNodeIds), a = ae(n, r, this.#m.nodes, this.#i), o = this.#m.comments.map((e) => ({
2570
2752
  ...e,
2571
2753
  nodeId: this.#i()
2572
2754
  }));
2573
- if (i.nodeIds.length == 0 && o.length == 0) return;
2574
- let s = new Map(this.#j().nodes.map((e) => [e.id, e])), c = /* @__PURE__ */ new Set([...i.nodeIds, ...o.map((e) => e.nodeId)]), l = new Set([...s].filter(([e]) => !c.has(e)).map(([, e]) => `${e.position.x}\0${e.position.y}`)), u = [...i.sourceIds.map((t) => e?.[t] ?? s.get(t)?.position ?? {
2755
+ if (a.nodeIds.length == 0 && o.length == 0) return;
2756
+ let s = new Map(this.#I().nodes.map((e) => [e.id, e])), c = /* @__PURE__ */ new Set([...a.nodeIds, ...o.map((e) => e.nodeId)]), l = new Set([...s].filter(([e]) => !c.has(e)).map(([, e]) => `${e.position.x}\0${e.position.y}`)), u = [...a.sourceIds.map((t) => e?.[t] ?? s.get(t)?.position ?? {
2575
2757
  x: 80,
2576
2758
  y: 80
2577
2759
  }), ...o.map((e) => e.position)], d = 1;
2578
2760
  if (t.x != 0 || t.y != 0) for (; u.some((e) => l.has(`${e.x + t.x * d}\0${e.y + t.y * d}`));) d += 1;
2579
- let f = Object.fromEntries(i.sourceIds.map((n, r) => {
2580
- let a = e?.[n] ?? s.get(n)?.position;
2581
- return [i.nodeIds[r], {
2582
- x: (a?.x ?? 80) + t.x * d,
2583
- y: (a?.y ?? 80) + t.y * d
2761
+ let f = Object.fromEntries(a.sourceIds.map((n, r) => {
2762
+ let i = e?.[n] ?? s.get(n)?.position;
2763
+ return [a.nodeIds[r], {
2764
+ x: (i?.x ?? 80) + t.x * d,
2765
+ y: (i?.y ?? 80) + t.y * d
2584
2766
  }];
2585
- })), p = this.#D((e) => {
2586
- let n = y(e, r, f);
2587
- for (let e of o) n = g(n, r, e.nodeId, {
2767
+ }));
2768
+ await this.#j("paste", c.size, a.changes, (e) => {
2769
+ let n = v(e, r, f);
2770
+ for (let [e, t] of a.sourceIds.entries()) i.has(t) && (n = g(n, r, a.nodeIds[e], !0));
2771
+ for (let e of o) i.has(e.sourceId) && (n = g(n, r, e.nodeId, !0)), n = S(n, r, e.nodeId, {
2588
2772
  content: e.content,
2589
2773
  position: {
2590
2774
  x: e.position.x + t.x * d,
@@ -2593,8 +2777,7 @@ var fn = class {
2593
2777
  title: this.#r.t("addNode.commentCopy", { title: e.title })
2594
2778
  });
2595
2779
  return n;
2596
- });
2597
- this.selectNodes([...i.nodeIds, ...o.map((e) => e.nodeId)]), (a == null || await a != null) && await p;
2780
+ }, [...a.nodeIds, ...o.map((e) => e.nodeId)]);
2598
2781
  }
2599
2782
  async duplicateSelectedNodes(e, t) {
2600
2783
  this.copySelectedNodes(), await this.pasteNodes(e, t);
@@ -2602,36 +2785,36 @@ var fn = class {
2602
2785
  async saveNodeSettings(e, t) {
2603
2786
  let n = this.$.revision.value, r = this.#l.value.target;
2604
2787
  if (n == null || r == null) return !1;
2605
- let i = le(n, r, e, t);
2606
- return i != null && await this.#w(i) != null;
2788
+ let i = pe(n, r, e, t);
2789
+ return i != null && await this.#E(i) != null;
2607
2790
  }
2608
2791
  async saveNodeDescription(e, t) {
2609
2792
  let n = this.$.revision.value, r = this.#l.value.target;
2610
2793
  if (n == null || r == null) return !1;
2611
- let i = Ce(n, r, e, t);
2612
- return i != null && await this.#w(i) != null;
2794
+ let i = Te(n, r, e, t);
2795
+ return i != null && await this.#E(i) != null;
2613
2796
  }
2614
2797
  async saveNodeIcon(e, t) {
2615
2798
  let n = this.$.revision.value, r = this.#l.value.target;
2616
2799
  if (n == null || r == null) return !1;
2617
- let i = ve(n, r, e, t);
2618
- return i != null && await this.#w(i) != null;
2800
+ let i = xe(n, r, e, t);
2801
+ return i != null && await this.#E(i) != null;
2619
2802
  }
2620
2803
  async saveNodeTitle(e, t) {
2621
2804
  let n = this.$.revision.value, r = this.#l.value.target;
2622
2805
  if (n == null || r == null) return !1;
2623
- let i = de(n, r, e, t);
2624
- return i != null && await this.#w(i) != null;
2806
+ let i = he(n, r, e, t);
2807
+ return i != null && await this.#E(i) != null;
2625
2808
  }
2626
2809
  async setInputValue(e, t, n) {
2627
2810
  let r = this.$.revision.value, i = this.#l.value.target;
2628
2811
  if (r == null || i == null) return !1;
2629
- let a = ge(r, i, e, t, n);
2630
- return a != null && await this.#w(a) != null;
2812
+ let a = ye(r, i, e, t, n);
2813
+ return a != null && await this.#E(a) != null;
2631
2814
  }
2632
2815
  async setInputSource(e, t, n) {
2633
2816
  let r = this.$.revision.value, i = this.#l.value.target;
2634
- return r == null || i == null ? !1 : await this.#w(De(r.revision.content, i, e, t, [{
2817
+ return r == null || i == null ? !1 : await this.#E(we(r.revision.content, i, e, t, [{
2635
2818
  kind: "node",
2636
2819
  ...n
2637
2820
  }])) != null;
@@ -2639,36 +2822,40 @@ var fn = class {
2639
2822
  async setInputVariable(e, t, n) {
2640
2823
  let r = this.$.revision.value, i = this.#l.value.target;
2641
2824
  if (r == null || i == null) return !1;
2642
- let a = n == null ? ge(r, i, e, t, void 0) : Me(r, i, e, t, n, this.#i());
2643
- return a != null && await this.#w(a) != null;
2825
+ let a = n == null ? ye(r, i, e, t, void 0) : je(r, i, e, t, n, this.#i());
2826
+ return a != null && await this.#E(a) != null;
2644
2827
  }
2645
2828
  async saveCondition(e, t) {
2646
2829
  let n = this.$.revision.value, r = this.#l.value.target;
2647
2830
  if (n == null || r == null) return !1;
2648
- let i = se(n, r, e, t);
2649
- return i != null && await this.#w(i) != null;
2831
+ let i = de(n, r, e, t);
2832
+ return i != null && await this.#E(i) != null;
2650
2833
  }
2651
2834
  async saveValue(e, t) {
2652
2835
  let n = this.$.revision.value, r = this.#l.value.target;
2653
2836
  if (n == null || r == null) return !1;
2654
- let i = Le(n, r, e, t);
2655
- return i != null && await this.#w(i) != null;
2837
+ let i = Ie(n, r, e, t);
2838
+ return i != null && await this.#E(i) != null;
2656
2839
  }
2657
2840
  async saveWait(e, t) {
2658
2841
  let n = this.$.revision.value, r = this.#l.value.target;
2659
2842
  if (n == null || r?.kind != "flow") return !1;
2660
- let i = x(n, r, e, t);
2661
- return i != null && await this.#w(i) != null;
2843
+ let i = E(n, r, e, t);
2844
+ return i != null && await this.#E(i) != null;
2662
2845
  }
2663
2846
  async setWaitNotification(e, t) {
2664
- let n = this.$.revision.value, r = n == null ? void 0 : ie(n, e, t, this.#i());
2665
- return r != null && await this.#w(r) != null;
2847
+ let n = this.$.revision.value, r = n == null ? void 0 : se(n, e, t, this.#i());
2848
+ return r != null && await this.#E(r) != null;
2849
+ }
2850
+ async saveNodeContentHidden(e, t) {
2851
+ let n = this.#l.value.target, r = this.#I().nodes.find((t) => t.id == e);
2852
+ n != null && r != null && r.kind != "condition" && await this.#k((r) => g(r, n, e, t));
2666
2853
  }
2667
2854
  async saveComment(e, t) {
2668
2855
  let n = this.#l.value.target;
2669
2856
  if (n == null) return;
2670
- let r = this.#j().nodes.find((t) => t.id == e)?.position;
2671
- r != null && await this.#D((i) => g(i, n, e, {
2857
+ let r = this.#I().nodes.find((t) => t.id == e)?.position;
2858
+ r != null && await this.#k((i) => S(i, n, e, {
2672
2859
  ...t,
2673
2860
  position: r
2674
2861
  }));
@@ -2677,65 +2864,66 @@ var fn = class {
2677
2864
  let n = this.$.revision.value, r = this.#l.value.target;
2678
2865
  if (n == null || r == null) return !1;
2679
2866
  let i = Ne(n, r, e, t);
2680
- return i != null && await this.#w(i) != null;
2867
+ return i != null && await this.#E(i) != null;
2681
2868
  }
2682
2869
  async saveCodeActions(e, t) {
2683
2870
  let n = this.$.revision.value, r = this.#l.value.target;
2684
2871
  if (n == null || r == null) return !1;
2685
- let i = je(n.revision.content, r, e, t);
2686
- return i == null || await this.#w(i) != null;
2872
+ let i = _e(n.revision.content, r, e, t);
2873
+ return i == null || await this.#E(i) != null;
2687
2874
  }
2688
2875
  async saveTaskPorts(e, t) {
2689
2876
  let n = this.$.revision.value, r = this.#l.value.target;
2690
2877
  if (n == null || r == null) return !1;
2691
- let i = ee(n, r, e, t);
2692
- return i != null && await this.#w(i) != null;
2878
+ let i = re(n, r, e, t);
2879
+ return i != null && await this.#E(i) != null;
2693
2880
  }
2694
2881
  async saveTaskAdditionalInputs(e, t) {
2695
2882
  let n = this.$.revision.value, r = this.#l.value.target;
2696
2883
  if (n == null || r == null) return !1;
2697
2884
  let i = Re(n, r, e, t);
2698
- return i != null && await this.#w(i) != null;
2885
+ return i != null && await this.#E(i) != null;
2699
2886
  }
2700
2887
  async setConnectorConnection(e, t) {
2701
2888
  let n = this.$.revision.value;
2702
2889
  if (n == null) return !1;
2703
- let r = be(n.revision.content, e, t);
2704
- return r != null && await this.#w(r) != null;
2890
+ let r = ne(n.revision.content, e, t);
2891
+ return r != null && await this.#E(r) != null;
2705
2892
  }
2706
2893
  async saveTriggerConfig(e, t, n) {
2707
2894
  let r = this.$.revision.value, i = this.#l.value.target;
2708
2895
  if (r == null || i?.kind != "flow") return !1;
2709
- let a = N(r.revision.content, i, e, t, n);
2710
- return a != null && await this.#w(a) != null;
2896
+ let a = oe(r.revision.content, i, e, t, n);
2897
+ return a != null && await this.#E(a) != null;
2711
2898
  }
2712
2899
  async saveTriggerSchedule(e, t) {
2713
2900
  let n = this.$.revision.value, r = this.#l.value.target;
2714
2901
  if (n == null || r?.kind != "flow") return !1;
2715
- let i = Se(n.revision.content, r, e, t);
2716
- return i != null && await this.#w(i) != null;
2902
+ let i = be(n.revision.content, r, e, t);
2903
+ return i != null && await this.#E(i) != null;
2717
2904
  }
2718
2905
  async saveWebhook(e, t) {
2719
2906
  let n = this.$.revision.value, r = this.#l.value.target;
2720
2907
  if (n == null || r?.kind != "flow") return !1;
2721
- let i = s(n, r, e, t);
2722
- return i != null && await this.#w(i) != null;
2908
+ let i = u(n, r, e, t);
2909
+ return i != null && await this.#E(i) != null;
2723
2910
  }
2724
2911
  async setTriggerConnection(e, t) {
2725
2912
  let n = this.$.revision.value, r = this.#l.value.target;
2726
2913
  if (n == null || r?.kind != "flow") return !1;
2727
- let i = pe(n.revision.content, r, e, t);
2728
- return i != null && await this.#w(i) != null;
2914
+ let i = Oe(n.revision.content, r, e, t);
2915
+ return i != null && await this.#E(i) != null;
2729
2916
  }
2730
2917
  async saveSubflowSettings(e, t) {
2731
2918
  let n = this.$.revision.value;
2732
2919
  if (n == null) return !1;
2733
- let r = A(n, e, t);
2734
- return r != null && await this.#w(r) != null;
2920
+ let r = j(n, e, t);
2921
+ return r != null && await this.#E(r) != null;
2735
2922
  }
2736
2923
  updateModuleSource(e) {
2737
2924
  let t = this.#l.value.moduleEditor;
2738
- if (t == null || t.source == e) return;
2925
+ if (this.#d.applying || this.#d.failed || t == null || t.source == e) return;
2926
+ this.#A();
2739
2927
  let n = this.#u.get(t.moduleId)?.base ?? this.#l.value.draft?.content.modules[t.moduleId];
2740
2928
  n != null && (this.#u.set(t.moduleId, {
2741
2929
  base: n,
@@ -2744,14 +2932,14 @@ var fn = class {
2744
2932
  phase: void 0,
2745
2933
  source: e
2746
2934
  }
2747
- }), this.#F());
2935
+ }), this.#B());
2748
2936
  }
2749
2937
  discardModuleChanges() {
2750
2938
  let e = this.#l.value.moduleEditor;
2751
- if (e == null || this.#d != null) return;
2939
+ if (e == null || this.#p != null) return;
2752
2940
  this.#u.delete(e.moduleId);
2753
2941
  let t = this.#l.value.draft?.content.modules[e.moduleId];
2754
- this.#I({ moduleEditor: t == null ? void 0 : {
2942
+ this.#V({ moduleEditor: t == null ? void 0 : {
2755
2943
  moduleId: e.moduleId,
2756
2944
  source: t.source
2757
2945
  } });
@@ -2760,44 +2948,44 @@ var fn = class {
2760
2948
  return this.#u.size > 0;
2761
2949
  }
2762
2950
  async saveModuleEditor() {
2763
- if (this.#g) return !1;
2951
+ if (this.#v) return !1;
2764
2952
  for (let e of this.#u.values()) e.editor.phase == "failed" && (e.editor = {
2765
2953
  ...e.editor,
2766
2954
  phase: void 0
2767
2955
  });
2768
- return this.#F(), await this.#x();
2956
+ return this.#B(), await this.#C();
2769
2957
  }
2770
- #x() {
2771
- if (this.#d != null) return this.#d;
2772
- if (this.#g) return Promise.resolve(!1);
2958
+ #C() {
2959
+ if (this.#p != null) return this.#p;
2960
+ if (this.#v) return Promise.resolve(!1);
2773
2961
  if (![...this.#u.values()].some((e) => e.editor.phase != "failed")) return Promise.resolve(this.#u.size == 0);
2774
2962
  let e = this.#n.capture();
2775
- return this.#d = this.#S(e).finally(() => {
2776
- this.#d = void 0;
2777
- }), this.#d;
2963
+ return this.#p = this.#w(e).finally(() => {
2964
+ this.#p = void 0;
2965
+ }), this.#p;
2778
2966
  }
2779
- async #S(e) {
2780
- for (; !this.#g && e();) {
2967
+ async #w(e) {
2968
+ for (; !this.#v && e();) {
2781
2969
  let t = [...this.#u.entries()].find(([, e]) => e.editor.phase != "failed");
2782
2970
  if (t == null) return this.#u.size == 0;
2783
2971
  let [n, r] = t, i = r.editor.source;
2784
2972
  r.editor = {
2785
2973
  ...r.editor,
2786
2974
  phase: "saving"
2787
- }, this.#F();
2975
+ }, this.#B();
2788
2976
  try {
2789
- let t = await Dt(i);
2790
- if (this.#g || !e()) return !1;
2977
+ let t = await Ot(i);
2978
+ if (this.#v || !e()) return !1;
2791
2979
  let a = this.#l.value.draft?.content.modules[n];
2792
2980
  if (a == null || a.source != r.base.source || JSON.stringify(a.imports) != JSON.stringify(r.base.imports)) throw Error(this.#r.t("notice.moduleUpdated"));
2793
- let o = i == a.source && JSON.stringify(t) == JSON.stringify(a.imports) ? this.#l.value.draft : await this.#w(Ot(n, r.base.source, r.base.imports, i, t), !1);
2794
- if (this.#g || !e()) return !1;
2981
+ let o = i == a.source && JSON.stringify(t) == JSON.stringify(a.imports) ? this.#l.value.draft : await this.#E(kt(n, r.base.source, r.base.imports, i, t), !1);
2982
+ if (this.#v || !e()) return !1;
2795
2983
  let s = this.#u.get(n);
2796
2984
  if (s == null) continue;
2797
2985
  o == null ? s.editor = {
2798
2986
  ...s.editor,
2799
2987
  phase: "failed"
2800
- } : s.editor.source == i ? (this.#u.delete(n), this.#l.value.moduleEditor?.moduleId == n && this.#I({ moduleEditor: {
2988
+ } : s.editor.source == i ? (this.#u.delete(n), this.#l.value.moduleEditor?.moduleId == n && this.#V({ moduleEditor: {
2801
2989
  moduleId: n,
2802
2990
  source: i
2803
2991
  } })) : (s.base = {
@@ -2809,87 +2997,102 @@ var fn = class {
2809
2997
  phase: void 0
2810
2998
  });
2811
2999
  } catch (t) {
2812
- if (this.#g || !e()) return !1;
3000
+ if (this.#v || !e()) return !1;
2813
3001
  let r = this.#u.get(n);
2814
3002
  r != null && (r.editor = {
2815
3003
  ...r.editor,
2816
3004
  phase: "failed"
2817
- }), this.#c(D(t, this.#r.t));
3005
+ }), this.#c(C(t, this.#r.t));
2818
3006
  }
2819
- this.#F();
3007
+ this.#B();
2820
3008
  }
2821
3009
  return !1;
2822
3010
  }
2823
3011
  async moveNodes(e) {
2824
3012
  let t = this.#l.value.target;
2825
- t != null && await this.#D((n) => y(n, t, e));
3013
+ t != null && await this.#j("move", Object.keys(e).length, [], (n) => v(n, t, e));
2826
3014
  }
2827
3015
  async moveViewport(e) {
2828
3016
  let t = this.#l.value.target;
2829
- t != null && await this.#D((n) => _(n, t, e));
3017
+ t != null && await this.#k((n) => m(n, t, e), !0);
2830
3018
  }
2831
3019
  async check() {
2832
- await this.#O();
3020
+ await this.#N();
2833
3021
  }
2834
3022
  async refreshFlows() {
2835
3023
  await this.reloadFlows();
2836
3024
  }
2837
3025
  updateLive(e) {
2838
- e.flowId == this.#l.value.flowId && this.#I({ live: e });
3026
+ e.flowId == this.#l.value.flowId && this.#V({ live: e });
2839
3027
  }
2840
3028
  locateNode(e) {
2841
3029
  let t = this.$.revision.value, n = this.#l.value.target;
2842
- return t == null || n == null || t.node(n, e) == null || !this.selectNodes([e]) ? !1 : (this.#I({ nodeFocus: {
3030
+ return t == null || n == null || t.node(n, e) == null || !this.selectNodes([e]) ? !1 : (this.#V({ nodeFocus: {
2843
3031
  nodeId: e,
2844
- requestId: ++this.#v
3032
+ requestId: ++this.#b
2845
3033
  } }), !0);
2846
3034
  }
2847
3035
  locateDiagnostic(e) {
2848
- return e.location == null || !this.selectNodes([e.location.nodeId]) ? !1 : (this.#I({ diagnosticFocus: {
3036
+ return e.location == null || !this.selectNodes([e.location.nodeId]) ? !1 : (this.#V({ diagnosticFocus: {
2849
3037
  ...e.location,
2850
3038
  diagnostic: e.diagnostic,
2851
- requestId: ++this.#p
3039
+ requestId: ++this.#h
2852
3040
  } }), !0);
2853
3041
  }
2854
- async #C(e, t, n) {
2855
- let r = Math.max(0, ...this.#j().nodes.flatMap((e) => {
3042
+ async #T(e, t, n) {
3043
+ let r = Math.max(0, ...this.#I().nodes.flatMap((e) => {
2856
3044
  if (e.kind != "comment") return [];
2857
3045
  let t = /#(\d+)$/.exec(e.title);
2858
3046
  return t == null ? [] : [Number(t[1])];
2859
- })), i = this.#D((i) => g(i, e, t, {
3047
+ }));
3048
+ if (!(!await this.#j("add", 1, [], (i) => S(i, e, t, {
2860
3049
  content: "",
2861
3050
  position: n,
2862
3051
  title: this.#r.t("addNode.commentName", { number: r + 1 })
2863
- }));
2864
- if (this.selectNodes([t]), await i, !this.#g) return t;
3052
+ }), [t]) || this.#v)) return t;
2865
3053
  }
2866
- async #w(e, t = !0) {
2867
- let n = this.#l.value.flowId, r = this.#l.value.draft;
2868
- if (n != null && r != null) return e.length == 0 ? r : await this.#t.change({
2869
- current: this.#n.capture(),
2870
- flowId: n
2871
- }, r, e, t);
3054
+ async #E(e, t = !0, n = !1) {
3055
+ if (this.#v || (this.#d.applying || this.#d.failed) && !n) return;
3056
+ let r = this.#l.value.flowId, i = this.#l.value.draft;
3057
+ if (r == null || i == null) return;
3058
+ if (e.length == 0 || B(I(i, e).content, i.content)) return i;
3059
+ let a = !n && this.#d.clear(), o = this.#n.capture();
3060
+ this.#d.pending++, this.#d.publish();
3061
+ try {
3062
+ let n = this.#t.change({
3063
+ current: o,
3064
+ flowId: r
3065
+ }, i, e, t);
3066
+ a && this.#c({
3067
+ kind: "success",
3068
+ message: this.#r.t("history.cleared")
3069
+ });
3070
+ let s = await n;
3071
+ return s == null && o() && this.retryHistorySync(), s;
3072
+ } finally {
3073
+ this.#d.pending--, this.#v || this.#d.publish();
3074
+ }
2872
3075
  }
2873
- async #T(e) {
3076
+ async #D(e) {
2874
3077
  for (let t = 0; t < 2 && e(); t += 1) {
2875
3078
  let t = this.#l.value.draft;
2876
3079
  if (t == null) return;
2877
- let n = oe(t.content);
3080
+ let n = Ee(t.content);
2878
3081
  if (n.length == 0) {
2879
- this.#O();
3082
+ this.#N();
2880
3083
  return;
2881
3084
  }
2882
- if (await this.#w(n, !1) != null || !e()) return;
3085
+ if (await this.#E(n, !1) != null || !e()) return;
2883
3086
  if (this.#l.value.draft?.revisionId == t.revisionId) break;
2884
3087
  }
2885
- e() && this.#O();
3088
+ e() && this.#N();
2886
3089
  }
2887
- #E(e, t, n = !1) {
2888
- let r = this.#l.value.draft, { revision: i, selectedNodeIds: a, target: o } = this.#M(e), s = this.#l.value.moduleEditor, c = s != null && (t == "external" || r != null) && sn(r, s) != "saved", l;
3090
+ #O(e, t, n = !1) {
3091
+ let r = this.#l.value.draft, { revision: i, selectedNodeIds: a, target: o } = this.#L(e), s = this.#l.value.moduleEditor, c = s != null && (t == "external" || r != null) && pn(r, s) != "saved", l;
2889
3092
  return l = c ? t == "external" ? {
2890
3093
  ...s,
2891
3094
  phase: "failed"
2892
- } : s : cn(i, o, a), this.#I({
3095
+ } : s : mn(i, o, a), this.#V({
2893
3096
  diagnostics: n ? this.#l.value.diagnostics : void 0,
2894
3097
  draft: e,
2895
3098
  moduleEditor: l,
@@ -2897,30 +3100,125 @@ var fn = class {
2897
3100
  target: o
2898
3101
  }), c;
2899
3102
  }
2900
- async #D(e) {
2901
- if (this.#g) return;
2902
- let t = this.#l.value.flowId, n = this.#l.value.presentation;
2903
- t != null && n != null && await this.#a.change(t, n, this.#n.capture(), e);
3103
+ async #k(e, t = !1) {
3104
+ if (this.#v || (this.#d.applying || this.#d.failed) && !t) return !1;
3105
+ let n = this.#l.value.flowId, r = this.#l.value.presentation;
3106
+ if (n == null || r == null) return !1;
3107
+ if (B(e(r.value), r.value)) return !0;
3108
+ t || this.#A();
3109
+ let i = this.#n.capture();
3110
+ this.#d.pending++, this.#d.publish();
3111
+ try {
3112
+ let t = await this.#a.change(n, r, i, e);
3113
+ return !t && i() && this.retryHistorySync(), t;
3114
+ } finally {
3115
+ this.#d.pending--, this.#v || this.#d.publish();
3116
+ }
2904
3117
  }
2905
- async #O() {
2906
- if (this.#g) return;
3118
+ #A() {
3119
+ this.#d.clear() && this.#c({
3120
+ kind: "success",
3121
+ message: this.#r.t("history.cleared")
3122
+ });
3123
+ }
3124
+ async #j(e, t, n, r, i = this.#l.value.selectedNodeIds) {
3125
+ if (this.#v || this.#d.applying || this.#d.failed) return !1;
3126
+ let { draft: a, target: o, presentation: s, selectedNodeIds: c } = this.#l.value;
3127
+ if (a == null || o == null || s == null) return !1;
3128
+ let l = r?.(s.value) ?? s.value, u = f(s.value, l, o);
3129
+ if (B(I(a, n).content, a.content) && u.nodeIds.length == 0) return !0;
3130
+ let d = this.#d.generation, p = nn(a.content, n);
3131
+ this.#d.pending++;
3132
+ let m = this.#d.record({
3133
+ action: e,
3134
+ count: t,
3135
+ target: o,
3136
+ forward: n,
3137
+ inverse: p,
3138
+ presentation: u,
3139
+ beforeSelection: c,
3140
+ afterSelection: i
3141
+ });
3142
+ try {
3143
+ let e = n.length == 0 ? Promise.resolve(a) : this.#E(n, !0, !0), t = r == null ? Promise.resolve(!0) : this.#k(r, !0);
3144
+ this.selectNodes(i), m || this.#c({
3145
+ kind: "success",
3146
+ message: this.#r.t("history.tooLarge")
3147
+ });
3148
+ let [o, s] = await Promise.all([e, t]);
3149
+ return o != null && s && (!m || d == this.#d.generation);
3150
+ } catch (e) {
3151
+ return this.#c(C(e, this.#r.t)), this.retryHistorySync(), !1;
3152
+ } finally {
3153
+ this.#d.pending--, this.#v || this.#d.publish();
3154
+ }
3155
+ }
3156
+ async undo() {
3157
+ await this.#M(!1);
3158
+ }
3159
+ async redo() {
3160
+ await this.#M(!0);
3161
+ }
3162
+ async #M(e) {
3163
+ let t = this.history$.value;
3164
+ if (!(e ? t.canRedo : t.canUndo)) return;
3165
+ let n = e ? t.redo : t.undo;
3166
+ if (n == null) return;
3167
+ let r = this.#d.generation;
3168
+ this.#d.applying = !0, this.#d.publish();
3169
+ try {
3170
+ let [t, i] = await Promise.all([this.#E(e ? n.forward : n.inverse, !0, !0), this.#k((t) => b(t, n.target, n.presentation, e), !0)]);
3171
+ t != null && i && r == this.#d.generation && (this.selectNodes(e ? n.afterSelection : n.beforeSelection), this.#d.complete(e));
3172
+ } catch (e) {
3173
+ this.#c(C(e, this.#r.t)), this.retryHistorySync();
3174
+ } finally {
3175
+ this.#d.applying = !1, this.#v || this.#d.publish();
3176
+ }
3177
+ }
3178
+ async retryHistorySync() {
3179
+ if (this.#v || this.#f != null) return this.#f;
3180
+ let e = this.#l.value.flowId;
3181
+ if (e == null) return;
3182
+ let t = this.#n.capture();
3183
+ this.#d.failed = !0, this.#d.clear();
3184
+ let n = async () => {
3185
+ if (await Promise.allSettled([this.#t.settled(), this.#a.settled()]), !(!t() || this.#v)) try {
3186
+ let { draft: n, presentation: r } = await this.#e.getEditor(e);
3187
+ if (!t() || this.#v) return;
3188
+ this.#t.reset(n), this.#a.reset(r), this.#O(n, "external"), this.#V({ presentation: r }), this.#o.advanceHead(e, n.revisionId), this.#d.failed = !1, this.#c({
3189
+ kind: "error",
3190
+ message: this.#r.t("history.resynced")
3191
+ }), this.#N();
3192
+ } catch {
3193
+ t() && !this.#v && this.#c({
3194
+ kind: "error",
3195
+ message: this.#r.t("history.syncFailed")
3196
+ });
3197
+ }
3198
+ };
3199
+ return this.#f = n().finally(() => {
3200
+ this.#f = void 0, this.#v || this.#d.publish();
3201
+ }), this.#f;
3202
+ }
3203
+ async #N() {
3204
+ if (this.#v) return;
2907
3205
  let e = this.#l.value.flowId, t = this.#l.value.draft, n = this.#l.value.target;
2908
3206
  if (e == null || t == null || n == null) {
2909
- n ?? this.#I({
3207
+ n ?? this.#V({
2910
3208
  checkLoading: !1,
2911
3209
  diagnostics: void 0
2912
3210
  });
2913
3211
  return;
2914
3212
  }
2915
- this.#I({
3213
+ this.#V({
2916
3214
  checkLoading: !0,
2917
3215
  diagnosticFocus: void 0
2918
3216
  });
2919
3217
  try {
2920
3218
  let n = await this.#e.checkFlow(e, t.revisionId);
2921
- if (!this.#g && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId) {
3219
+ if (!this.#v && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId) {
2922
3220
  let e = this.#l.value.live;
2923
- this.#I({
3221
+ this.#V({
2924
3222
  diagnostics: n,
2925
3223
  live: e == null ? void 0 : {
2926
3224
  ...e,
@@ -2929,16 +3227,16 @@ var fn = class {
2929
3227
  });
2930
3228
  }
2931
3229
  } catch (n) {
2932
- !this.#g && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(D(n, this.#r.t));
3230
+ !this.#v && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#c(C(n, this.#r.t));
2933
3231
  } finally {
2934
- !this.#g && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#I({ checkLoading: !1 });
3232
+ !this.#v && e == this.#l.value.flowId && t.revisionId == this.#l.value.draft?.revisionId && this.#V({ checkLoading: !1 });
2935
3233
  }
2936
3234
  }
2937
- async #k(e) {
2938
- if (this.#g) return;
3235
+ async #P(e) {
3236
+ if (this.#v) return;
2939
3237
  let t = this.#l.value.flowId;
2940
- if (t == null || (this.#m += 1, e != null && (this.#h = !0), this.#_)) return;
2941
- this.#_ = !0;
3238
+ if (t == null || (this.#g += 1, e != null && (this.#_ = !0), this.#y)) return;
3239
+ this.#y = !0;
2942
3240
  let n = {
2943
3241
  current: this.#n.capture(),
2944
3242
  flowId: t
@@ -2946,72 +3244,76 @@ var fn = class {
2946
3244
  await this.#t.enqueue(async () => {
2947
3245
  let e;
2948
3246
  do {
2949
- e = this.#m;
2950
- let t = this.#h;
2951
- this.#h = !1, await this.#A(n, !1, t);
2952
- } while (this.#N(n) && e != this.#m);
2953
- }), this.#N(n) && (this.#_ = !1);
3247
+ e = this.#g;
3248
+ let t = this.#_;
3249
+ this.#_ = !1, await this.#F(n, !1, t);
3250
+ } while (this.#R(n) && e != this.#g);
3251
+ }), this.#R(n) && (this.#y = !1);
2954
3252
  }
2955
- async #A(e, t, n = !1) {
3253
+ async #F(e, t, n = !1) {
2956
3254
  try {
2957
3255
  let t = this.#t.committed;
2958
3256
  if (t == null) return !1;
2959
3257
  let r = await this.#e.syncDraft(e.flowId);
2960
- if (!this.#N(e)) return !1;
3258
+ if (!this.#R(e)) return !1;
2961
3259
  let i = r.draft;
2962
3260
  if (i.revisionId == t.revisionId) return !0;
2963
- let a = this.#t.replaceCommitted(i), o = this.#E(a, "external");
3261
+ this.#d.clear() && this.#c({
3262
+ kind: "success",
3263
+ message: this.#r.t("history.external")
3264
+ });
3265
+ let a = this.#t.replaceCommitted(i), o = this.#O(a, "external");
2964
3266
  return this.#o.advanceHead(e.flowId, i.revisionId), n && this.#c({
2965
3267
  kind: o ? "error" : "success",
2966
3268
  message: this.#r.t(o ? "notice.moduleUpdated" : "notice.draftUpdated")
2967
- }), this.#O(), !0;
3269
+ }), this.#N(), !0;
2968
3270
  } catch (n) {
2969
- return t && this.#N(e) && this.#c(D(n, this.#r.t)), !1;
3271
+ return t && this.#R(e) && this.#c(C(n, this.#r.t)), !1;
2970
3272
  }
2971
3273
  }
2972
- #j() {
3274
+ #I() {
2973
3275
  let e = this.#l.value;
2974
- return he(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
3276
+ return l(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
2975
3277
  }
2976
- #M(e) {
2977
- let t = w(e), n = dn(t, this.#l.value.target);
3278
+ #L(e) {
3279
+ let t = F(e), n = _n(t, this.#l.value.target);
2978
3280
  return {
2979
3281
  revision: t,
2980
3282
  selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) => n != null && t.selection(n, e) != null),
2981
3283
  target: n
2982
3284
  };
2983
3285
  }
2984
- #N(e) {
2985
- return !this.#g && e.flowId == this.#l.value.flowId && e.current();
3286
+ #R(e) {
3287
+ return !this.#v && e.flowId == this.#l.value.flowId && e.current();
2986
3288
  }
2987
- #P(e) {
3289
+ #z(e) {
2988
3290
  let t = e == null ? void 0 : this.#u.get(e.moduleId)?.editor ?? e, n;
2989
3291
  return [...this.#u.values()].some((e) => e.editor.phase == "failed") ? n = "failed" : this.#u.size > 0 && (n = "saving"), {
2990
3292
  moduleEditor: t,
2991
3293
  moduleSaveStatus: n
2992
3294
  };
2993
3295
  }
2994
- #F() {
2995
- this.#g || this.#l.set(this.#P(this.#l.value.moduleEditor));
3296
+ #B() {
3297
+ this.#v || this.#l.set(this.#z(this.#l.value.moduleEditor));
2996
3298
  }
2997
- #I(e) {
2998
- if (this.#g) return;
3299
+ #V(e) {
3300
+ if (this.#v) return;
2999
3301
  let t = Object.hasOwn(e, "moduleEditor") ? e.moduleEditor : this.#l.value.moduleEditor;
3000
3302
  this.#l.set({
3001
3303
  ...e,
3002
- ...this.#P(t)
3304
+ ...this.#z(t)
3003
3305
  });
3004
3306
  }
3005
3307
  };
3006
3308
  //#endregion
3007
3309
  //#region src/workbench/browser/runtime/stores/workbenchStore.ts
3008
- function pn(e) {
3310
+ function yn(e) {
3009
3311
  return new Map(e.nodes.map((e) => [e.id, e]));
3010
3312
  }
3011
- function mn(e, t) {
3012
- return e == null || t == null ? [] : w(e).designerInputs(t);
3313
+ function bn(e, t) {
3314
+ return e == null || t == null ? [] : F(e).designerInputs(t);
3013
3315
  }
3014
- function hn(e, t, n, r, i) {
3316
+ function xn(e, t, n, r, i) {
3015
3317
  if (e == null || t?.kind != "flow" || n?.revisionId != e.revisionId || n.flowId != e.flowId) return /* @__PURE__ */ new Map();
3016
3318
  let a = r.find((t) => t.kind == "run.started" && t.payload.flowId == e.flowId)?.payload.scopeId;
3017
3319
  return typeof a == "string" ? new Map(r.flatMap((t) => {
@@ -3019,7 +3321,7 @@ function hn(e, t, n, r, i) {
3019
3321
  return t.payload.scopeId == a && t.payload.flowId == e.flowId && typeof n == "string" && i.has(n) ? [[t.sequence, n]] : [];
3020
3322
  })) : /* @__PURE__ */ new Map();
3021
3323
  }
3022
- var gn = { openExternalPage: async () => !1 }, _n = class {
3324
+ var Sn = { openExternalPage: async () => !1 }, Cn = class {
3023
3325
  #e;
3024
3326
  #t;
3025
3327
  #n;
@@ -3034,22 +3336,22 @@ var gn = { openExternalPage: async () => !1 }, _n = class {
3034
3336
  #c;
3035
3337
  #l;
3036
3338
  #u;
3037
- constructor(r, i, a = E, o = V(), s = gn, c = !0) {
3038
- this.#t = new T(), this.#r = n(), this.#a = n([]), this.#o = n(!1), this.#s = n(!1), this.#c = !0, this.#u = !1, this.provideAddNodeOptions = async (e, t) => await this.#d([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => {
3339
+ constructor(r, i, a = L, o = W(), c = Sn, u = !0) {
3340
+ this.#t = new s(), this.#r = n(), this.#a = n([]), this.#o = n(!1), this.#s = n(!1), this.#c = !0, this.#u = !1, this.provideAddNodeOptions = async (e, t) => await this.#d([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => {
3039
3341
  let t = await Promise.all([this.triggers.browseAddNodeOptions(e), this.connectors.browseAddNodeOptions(e)]);
3040
3342
  if (!(e.aborted || this.#u)) return t.flatMap((e) => e ?? []);
3041
3343
  }, this.provideAddNodeOptionChoices = async (e, t) => {
3042
3344
  if (!e.startsWith("trigger:")) return await this.connectors.provideAddNodeOptionChoices(e, t);
3043
- }, this.#e = r, this.results = r, this.#n = o, this.#i = c;
3044
- let l = (e) => {
3345
+ }, this.#e = r, this.results = r, this.#n = o, this.#i = u;
3346
+ let d = (e) => {
3045
3347
  this.#u || this.#r.set(e);
3046
3348
  };
3047
- this.runs = new f(r, l, o), this.workspace = new fn(r, l, kt, o, (e) => {
3349
+ this.runs = new h(r, d, o), this.workspace = new vn(r, d, At, o, (e) => {
3048
3350
  e.kind == "run.created" ? this.#f(r, e) : this.runs.changed(e.runId);
3049
- }), this.connectors = new qt(r, this.workspace, l, s, o), this.triggers = new Zt(r, this.workspace, l, s, o), this.publications = new Nt(r, this.workspace, l, i, a, o), this.runRequests = new Bt(r, this.runs, l, async (e) => {
3351
+ }), this.connectors = new Xt(r, this.workspace, d, c, o), this.triggers = new tn(r, this.workspace, d, c, o), this.publications = new Pt(r, this.workspace, d, i, a, o), this.runRequests = new Ht(r, this.runs, d, async (e) => {
3050
3352
  if (!(e != this.workspace.$.flowId.value || !await this.workspace.saveModuleEditor() || this.#u || e != this.workspace.$.flowId.value)) return this.workspace.$.draft.value?.revisionId;
3051
3353
  }, o, a);
3052
- let d = t((e) => {
3354
+ let f = t((e) => {
3053
3355
  let t = e(this.workspace.$.diagnostics);
3054
3356
  if (t == null) return;
3055
3357
  let n = e(this.connectors.$.diagnostics);
@@ -3058,27 +3360,27 @@ var gn = { openExternalPage: async () => !1 }, _n = class {
3058
3360
  diagnostics: [...t.diagnostics, ...n],
3059
3361
  valid: !1
3060
3362
  };
3061
- }), p = /* @__PURE__ */ new Map(), m, h = t((e) => {
3363
+ }), p = /* @__PURE__ */ new Map(), m, g = t((e) => {
3062
3364
  let t = e(this.workspace.$.draft);
3063
3365
  m != t?.flowId && (p.clear(), m = t?.flowId);
3064
- let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(d)?.diagnostics ?? e(this.connectors.$.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), h = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`, g = [
3065
- ...mn(t, n),
3066
- r == null || n == null ? void 0 : u(r, n),
3366
+ let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(f)?.diagnostics ?? e(this.connectors.$.diagnostics), a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), u = e(this.runs.$.run), d = e(this.runs.$.events), h = n == null ? "" : n.kind == "flow" ? "flow" : `subflow:${n.id}`, g = [
3367
+ ...bn(t, n),
3368
+ r == null || n == null ? void 0 : T(r, n),
3067
3369
  i,
3068
3370
  a,
3069
3371
  s,
3070
3372
  c,
3071
- l,
3072
- f,
3073
- ...l == null ? [] : [t?.revisionId]
3373
+ u,
3374
+ d,
3375
+ ...u == null ? [] : [t?.revisionId]
3074
3376
  ], _ = p.get(h);
3075
3377
  if (_ != null && _.inputs.length == g.length && _.inputs.every((e, t) => e === g[t])) return _.graph;
3076
- let v = he(t, n, r, i, a, s, c, l, f);
3378
+ let v = l(t, n, r, i, a, s, c, u, d);
3077
3379
  return p.set(h, {
3078
3380
  graph: v,
3079
3381
  inputs: g
3080
3382
  }), v;
3081
- }), g = e(h, pn);
3383
+ }), _ = e(g, yn);
3082
3384
  this.$ = {
3083
3385
  busy: t((e) => {
3084
3386
  let t = e(this.workspace.$.busy);
@@ -3089,15 +3391,15 @@ var gn = { openExternalPage: async () => !1 }, _n = class {
3089
3391
  if (e(this.publications.$.rollingBackPublicationId) != null) return "rollback";
3090
3392
  if (e(this.publications.$.changingTriggerId) != null) return "trigger";
3091
3393
  }),
3092
- diagnosticItems: t((e) => b(e(this.workspace.$.revision), e(this.workspace.$.target), e(d))),
3093
- diagnostics: d,
3094
- designer: h,
3095
- designerNodeById: g,
3394
+ diagnosticItems: t((e) => Ae(e(this.workspace.$.revision), e(this.workspace.$.target), e(f))),
3395
+ diagnostics: f,
3396
+ designer: g,
3397
+ designerNodeById: _,
3096
3398
  notice: this.#r,
3097
- runEventNodes: t((e) => hn(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(g))),
3399
+ runEventNodes: t((e) => xn(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(_))),
3098
3400
  selectedDesignerNode: t((e) => {
3099
3401
  let t = e(this.workspace.$.selectedNodeIds);
3100
- return t.length == 1 ? e(g).get(t[0]) : void 0;
3402
+ return t.length == 1 ? e(_).get(t[0]) : void 0;
3101
3403
  }),
3102
3404
  variableNames: this.#a,
3103
3405
  variableNamesLoaded: this.#o,
@@ -3130,7 +3432,7 @@ var gn = { openExternalPage: async () => !1 }, _n = class {
3130
3432
  if (this.#u) return;
3131
3433
  this.#a.set(e.map((e) => e.name)), this.#o.set(!0);
3132
3434
  } catch (e) {
3133
- this.#c = !0, this.#u || this.#r.set(D(e, this.#n.t));
3435
+ this.#c = !0, this.#u || this.#r.set(C(e, this.#n.t));
3134
3436
  } finally {
3135
3437
  this.#l = void 0, this.#u || this.#s.set(!1);
3136
3438
  }
@@ -3175,7 +3477,7 @@ var gn = { openExternalPage: async () => !1 }, _n = class {
3175
3477
  if (t.aborted || this.#u) return;
3176
3478
  let r = n.filter((e) => e.status == "rejected");
3177
3479
  if (r.length > 0 && r.length == n.length) throw r[0].reason;
3178
- return r.length > 0 && this.#r.set(D(r[0].reason, this.#n.t)), n.flatMap((e) => e.status == "fulfilled" ? e.value ?? [] : []);
3480
+ return r.length > 0 && this.#r.set(C(r[0].reason, this.#n.t)), n.flatMap((e) => e.status == "fulfilled" ? e.value ?? [] : []);
3179
3481
  }
3180
3482
  async refreshSelectedConnector(e = !1) {
3181
3483
  await this.connectors.refresh(e);
@@ -3208,13 +3510,13 @@ var gn = { openExternalPage: async () => !1 }, _n = class {
3208
3510
  return;
3209
3511
  }
3210
3512
  }
3211
- }, vn = ct(() => import("./flowWorkspace-B0UAQ-s7.js").then((e) => e.t));
3212
- function yn({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i, pending: a = !1, title: o, token: s, tokenLabel: c }) {
3213
- let l = s != null && c != null && i != null, u = s ?? "", d = /* @__PURE__ */ K(lt, { children: [
3214
- /* @__PURE__ */ G("div", {
3513
+ }, wn = lt(() => import("./flowWorkspace-BtNfkYuG.js").then((e) => e.t));
3514
+ function Tn({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i, pending: a = !1, title: o, token: s, tokenLabel: c }) {
3515
+ let l = s != null && c != null && i != null, u = s ?? "", d = /* @__PURE__ */ Y(ut, { children: [
3516
+ /* @__PURE__ */ J("div", {
3215
3517
  "aria-hidden": "true",
3216
3518
  className: "flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground",
3217
- children: /* @__PURE__ */ K("svg", {
3519
+ children: /* @__PURE__ */ Y("svg", {
3218
3520
  className: "size-5",
3219
3521
  fill: "none",
3220
3522
  stroke: "currentColor",
@@ -3222,40 +3524,40 @@ function yn({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i
3222
3524
  strokeLinejoin: "round",
3223
3525
  strokeWidth: "1.8",
3224
3526
  viewBox: "0 0 24 24",
3225
- children: [/* @__PURE__ */ G("rect", {
3527
+ children: [/* @__PURE__ */ J("rect", {
3226
3528
  height: "9",
3227
3529
  rx: "2",
3228
3530
  width: "14",
3229
3531
  x: "5",
3230
3532
  y: "11"
3231
- }), /* @__PURE__ */ G("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })]
3533
+ }), /* @__PURE__ */ J("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })]
3232
3534
  })
3233
3535
  }),
3234
- /* @__PURE__ */ K("header", {
3536
+ /* @__PURE__ */ Y("header", {
3235
3537
  className: "flex flex-col gap-2",
3236
- children: [/* @__PURE__ */ G("h1", {
3538
+ children: [/* @__PURE__ */ J("h1", {
3237
3539
  className: "text-xl font-semibold tracking-tight text-balance",
3238
3540
  children: o
3239
- }), /* @__PURE__ */ G("p", {
3541
+ }), /* @__PURE__ */ J("p", {
3240
3542
  className: "text-sm/relaxed text-muted-foreground text-pretty",
3241
3543
  children: t
3242
3544
  })]
3243
3545
  }),
3244
- l && /* @__PURE__ */ G(Je, { children: /* @__PURE__ */ K(Qe, {
3546
+ l && /* @__PURE__ */ J(qe, { children: /* @__PURE__ */ Y(Qe, {
3245
3547
  "data-invalid": n != null,
3246
3548
  children: [
3247
- /* @__PURE__ */ G(R, {
3549
+ /* @__PURE__ */ J(et, {
3248
3550
  htmlFor: "session-token",
3249
3551
  children: c
3250
3552
  }),
3251
- /* @__PURE__ */ G(I, {
3553
+ /* @__PURE__ */ J(z, {
3252
3554
  autoComplete: "username",
3253
3555
  name: "username",
3254
3556
  type: "hidden",
3255
3557
  value: "open-flow",
3256
3558
  readOnly: !0
3257
3559
  }),
3258
- /* @__PURE__ */ G(I, {
3560
+ /* @__PURE__ */ J(z, {
3259
3561
  autoComplete: "current-password",
3260
3562
  "aria-invalid": n != null,
3261
3563
  autoFocus: !0,
@@ -3267,29 +3569,29 @@ function yn({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i
3267
3569
  type: "password",
3268
3570
  value: u
3269
3571
  }),
3270
- n != null && /* @__PURE__ */ G(Ge, { children: n })
3572
+ n != null && /* @__PURE__ */ J(We, { children: n })
3271
3573
  ]
3272
3574
  }) }),
3273
- e != null && r != null && /* @__PURE__ */ K(L, {
3575
+ e != null && r != null && /* @__PURE__ */ Y(V, {
3274
3576
  disabled: a || l && u.length == 0,
3275
3577
  size: "lg",
3276
3578
  type: "submit",
3277
- children: [a && /* @__PURE__ */ G(He, {
3579
+ children: [a && /* @__PURE__ */ J(Ve, {
3278
3580
  "aria-label": e,
3279
3581
  "data-icon": "inline-start"
3280
3582
  }), e]
3281
3583
  }),
3282
- a && e == null && /* @__PURE__ */ G(He, { "aria-label": t })
3584
+ a && e == null && /* @__PURE__ */ J(Ve, { "aria-label": t })
3283
3585
  ] }), f = "m-auto flex w-full max-w-[420px] flex-col gap-5 rounded-xl bg-card p-6 shadow-lg shadow-black/10";
3284
- return /* @__PURE__ */ G("main", {
3586
+ return /* @__PURE__ */ J("main", {
3285
3587
  className: "open-flow-workbench",
3286
- children: /* @__PURE__ */ G("div", {
3588
+ children: /* @__PURE__ */ J("div", {
3287
3589
  className: "grid h-full overflow-auto bg-muted/20 p-4",
3288
- children: r == null ? /* @__PURE__ */ G("section", {
3590
+ children: r == null ? /* @__PURE__ */ J("section", {
3289
3591
  "aria-busy": a,
3290
3592
  className: f,
3291
3593
  children: d
3292
- }) : /* @__PURE__ */ G("form", {
3594
+ }) : /* @__PURE__ */ J("form", {
3293
3595
  "aria-busy": a,
3294
3596
  className: f,
3295
3597
  onSubmit: r,
@@ -3298,15 +3600,15 @@ function yn({ action: e, description: t, error: n, onSubmit: r, onTokenChange: i
3298
3600
  })
3299
3601
  });
3300
3602
  }
3301
- function bn({ host: e, store: t }) {
3603
+ function En({ host: e, store: t }) {
3302
3604
  let n = r(t.$.notice);
3303
- return H(() => e.notify(n), [e, n]), H(() => () => e.notify(void 0), [e]), null;
3605
+ return G(() => e.notify(n), [e, n]), G(() => () => e.notify(void 0), [e]), null;
3304
3606
  }
3305
- function xn({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowField: i, flowBadges: a, hrefFor: o, hostAction: s, hostTitle: c, language: l, navigation: u, onConfigureConnector: d, onHostAction: f, onLanguageChange: p, store: m, theme: h }) {
3607
+ function Dn({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowField: i, flowBadges: a, hrefFor: o, hostAction: s, hostTitle: c, language: l, navigation: u, onConfigureConnector: d, onHostAction: f, onLanguageChange: p, store: m, theme: h }) {
3306
3608
  let g = r(m.workspace.$.flowId);
3307
- return /* @__PURE__ */ G("div", {
3609
+ return /* @__PURE__ */ J("div", {
3308
3610
  className: "app-shell",
3309
- children: g == null ? /* @__PURE__ */ G(bt, {
3611
+ children: g == null ? /* @__PURE__ */ J(xt, {
3310
3612
  catalogWidth: e,
3311
3613
  createFlowDisabled: n,
3312
3614
  createFlowField: i,
@@ -3323,12 +3625,12 @@ function xn({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowF
3323
3625
  onLanguageChange: p,
3324
3626
  onSelectFlow: (e) => void u.selectFlow(e),
3325
3627
  store: m
3326
- }) : /* @__PURE__ */ G(st, {
3327
- fallback: /* @__PURE__ */ G("main", {
3628
+ }) : /* @__PURE__ */ J(ct, {
3629
+ fallback: /* @__PURE__ */ J("main", {
3328
3630
  "aria-busy": "true",
3329
3631
  className: "workspace"
3330
3632
  }),
3331
- children: /* @__PURE__ */ G(vn, {
3633
+ children: /* @__PURE__ */ J(wn, {
3332
3634
  hostAction: s,
3333
3635
  hostTitle: c,
3334
3636
  hrefFor: o,
@@ -3341,18 +3643,18 @@ function xn({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowF
3341
3643
  })
3342
3644
  });
3343
3645
  }
3344
- function Sn({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowField: r, flowBadges: i, host: a, hostAction: s, hostTitle: c, hrefFor: l, language: u, location: d, onConfigureConnector: f, onHostAction: p, onLanguageChange: m, onNavigate: h, preferences: g, theme: _, variables: v = !0 }) {
3345
- let y = U(h);
3646
+ function On({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowField: r, flowBadges: i, host: a, hostAction: s, hostTitle: c, hrefFor: l, language: u, location: d, onConfigureConnector: f, onHostAction: p, onLanguageChange: m, onNavigate: h, preferences: g, theme: _, variables: v = !0 }) {
3647
+ let y = K(h);
3346
3648
  y.current = h;
3347
- let [{ i18n: b, navigation: x, store: S }] = W(() => {
3348
- let e = V(u), t = new _n(new Ee((e, t) => a.request(e, t), (e, t) => a.subscribeFlow(e, t), (e) => a.subscribeFlowCatalog(e)), g, E, e, a, v);
3649
+ let [{ i18n: b, navigation: x, store: S }] = q(() => {
3650
+ let e = W(u), t = new Cn(new w((e, t) => a.request(e, t), (e, t) => a.subscribeFlow(e, t), (e) => a.subscribeFlowCatalog(e)), g, L, e, a, v);
3349
3651
  return {
3350
3652
  i18n: e,
3351
- navigation: new pt(t, d, (e, t) => y.current(e, t)),
3653
+ navigation: new mt(t, d, (e, t) => y.current(e, t)),
3352
3654
  store: t
3353
3655
  };
3354
3656
  });
3355
- return H(() => {
3657
+ return G(() => {
3356
3658
  x.start();
3357
3659
  let e = () => {
3358
3660
  S.connectors.refreshAfterAuthorization(), S.triggers.refreshAfterAuthorization(), S.invalidateVariableNames();
@@ -3364,17 +3666,17 @@ function Sn({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowF
3364
3666
  b,
3365
3667
  x,
3366
3668
  S
3367
- ]), H(() => void x.apply(d), [d, x]), H(() => {
3669
+ ]), G(() => void x.apply(d), [d, x]), G(() => {
3368
3670
  b.lang != u && b.switchLang(u);
3369
- }, [b, u]), /* @__PURE__ */ G(o, {
3671
+ }, [b, u]), /* @__PURE__ */ J(o, {
3370
3672
  i18n: b,
3371
- children: /* @__PURE__ */ K("div", {
3673
+ children: /* @__PURE__ */ Y("div", {
3372
3674
  className: "open-flow-theme open-flow-workbench",
3373
3675
  "data-theme": _,
3374
- children: [/* @__PURE__ */ G(bn, {
3676
+ children: [/* @__PURE__ */ J(En, {
3375
3677
  host: a,
3376
3678
  store: S
3377
- }), /* @__PURE__ */ G(xn, {
3679
+ }), /* @__PURE__ */ J(Dn, {
3378
3680
  catalogWidth: e,
3379
3681
  createFlow: t,
3380
3682
  createFlowDisabled: n,
@@ -3394,8 +3696,8 @@ function Sn({ catalogWidth: e, createFlow: t, createFlowDisabled: n, createFlowF
3394
3696
  })
3395
3697
  });
3396
3698
  }
3397
- function Cn({ sessionKey: e, ...t }) {
3398
- return /* @__PURE__ */ G(Sn, { ...t }, e);
3699
+ function kn({ sessionKey: e, ...t }) {
3700
+ return /* @__PURE__ */ J(On, { ...t }, e);
3399
3701
  }
3400
3702
  //#endregion
3401
- export { yn as OpenFlowSessionGate, Cn as OpenFlowWorkbench, ot as isWorkbenchLanguage, it as resolveWorkbenchLanguage, at as workbenchLanguageNames, rt as workbenchLanguages };
3703
+ export { Tn as OpenFlowSessionGate, kn as OpenFlowWorkbench, st as isWorkbenchLanguage, at as resolveWorkbenchLanguage, ot as workbenchLanguageNames, it as workbenchLanguages };