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

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.
@@ -1,12 +1,13 @@
1
- import { Gr as e, Ur as t, Zr as n, li as r, ni as i, ri as a } from "./composite-7VwgfnXx.js";
2
- import { $i as o, Qi as s, _ as c, _a as l, a as u, c as d, d as f, ea as p, f as m, i as h, l as g, m as _, n as ee, o as v, p as y, ra as b, t as te, ta as ne, u as x, va as re, ya as S } from "./addNodeOptions-DqoIueCR.js";
3
- import { Suspense as ie, lazy as ae, useEffect as C, useRef as oe, useState as se } from "react";
4
- import { jsx as w, jsxs as ce } from "react/jsx-runtime";
1
+ import { a as e, f as t, i as n } from "./dist-0lWKriL5.js";
2
+ import { Ir as r, Rr as i, Wr as a } from "./createLucideIcon-MmUpJrIU.js";
3
+ import { _ as o, a as s, c, d as l, dt as u, f as d, g as f, i as p, l as m, m as h, n as g, o as _, p as v, st as y, t as b, u as x, ut as ee, v as S, x as te, y as ne } from "./addNodeOptions-B_d-Z5D3.js";
4
+ import { Suspense as re, lazy as ie, useEffect as C, useRef as ae, useState as oe } from "react";
5
+ import { jsx as w, jsxs as se } from "react/jsx-runtime";
5
6
  //#region src/workbench/browser/runtime/navigation.ts
6
- function le(e, t) {
7
+ function ce(e, t) {
7
8
  return t == null ? "design" : e == "design" && t?.draft == null && t != null ? "publications" : e;
8
9
  }
9
- var ue = class {
10
+ var le = class {
10
11
  #e;
11
12
  #t;
12
13
  #n;
@@ -16,10 +17,10 @@ var ue = class {
16
17
  #o;
17
18
  #s;
18
19
  #c;
19
- constructor(e, t, n) {
20
- this.#r = r("design"), this.#i = 0, this.#a = !1, this.#o = !1, this.#s = !1, this.#c = [], this.$ = { view: this.#r }, this.#l = () => {
20
+ constructor(e, n, r) {
21
+ this.#r = t("design"), this.#i = 0, this.#a = !1, this.#o = !1, this.#s = !1, this.#c = [], this.$ = { view: this.#r }, this.#l = () => {
21
22
  this.#o && !this.#s && this.#d(this.#r.value, !0);
22
- }, this.#t = t, this.#e = n, this.#n = e, this.#r.set(t.view);
23
+ }, this.#t = n, this.#e = r, this.#n = e, this.#r.set(n.view);
23
24
  }
24
25
  async start() {
25
26
  let e = this.#t, t = ++this.#i;
@@ -93,7 +94,7 @@ var ue = class {
93
94
  }
94
95
  }
95
96
  async apply(e) {
96
- de(e, this.#t) || (this.#t = e, await this.#u(e));
97
+ T(e, this.#t) || (this.#t = e, await this.#u(e));
97
98
  }
98
99
  #l;
99
100
  async #u(e) {
@@ -116,20 +117,20 @@ var ue = class {
116
117
  }
117
118
  }
118
119
  #d(e, t) {
119
- let n = this.#n.workspace.$.targetFlow.value, r = le(e, n), i = {
120
+ let n = this.#n.workspace.$.targetFlow.value, r = ce(e, n), i = {
120
121
  flowId: n?.flowId,
121
122
  projectId: this.#n.workspace.$.projectId.value,
122
123
  view: r
123
124
  };
124
- de(i, this.#t) || (this.#t = i, this.#e(i, { replace: t })), this.#r.set(r);
125
+ T(i, this.#t) || (this.#t = i, this.#e(i, { replace: t })), this.#r.set(r);
125
126
  }
126
127
  };
127
- function de(e, t) {
128
+ function T(e, t) {
128
129
  return e.projectId == t.projectId && e.flowId == t.flowId && e.view == t.view;
129
130
  }
130
131
  //#endregion
131
132
  //#region src/workbench/browser/runtime/publications/publicationStore.ts
132
- var T = {
133
+ var E = {
133
134
  activities: [],
134
135
  activitiesLoadFailed: !1,
135
136
  activitiesLoading: !1,
@@ -142,46 +143,46 @@ var T = {
142
143
  loadingMore: !1,
143
144
  publications: [],
144
145
  publishing: !1
145
- }, fe = 20, E = 50;
146
+ }, ue = 20, de = 50;
146
147
  function D(e, t) {
147
148
  return e?.projectId == t.projectId && e.flowId == t.flowId;
148
149
  }
149
- var pe = class {
150
+ var fe = class {
150
151
  #e;
151
152
  #t;
152
153
  #n;
153
- #r = new p();
154
- #i = new p();
155
- #a = new p();
156
- #o = new p();
154
+ #r = new S();
155
+ #i = new S();
156
+ #a = new S();
157
+ #o = new S();
157
158
  #s;
158
- #c = r(T);
159
+ #c = t(E);
159
160
  #l;
160
161
  #u;
161
- constructor(e, t, n, r = () => crypto.randomUUID(), i = l()) {
162
- this.#e = e, this.#t = r, this.#n = i, this.#s = n, this.#l = t, this.$ = {
163
- activities: a(this.#c, (e) => e.activities),
164
- activitiesLoadFailed: a(this.#c, (e) => e.activitiesLoadFailed),
165
- activitiesLoading: a(this.#c, (e) => e.activitiesLoading),
166
- activitiesLoadingMore: a(this.#c, (e) => e.activitiesLoadingMore),
167
- activitiesNextCursor: a(this.#c, (e) => e.activitiesNextCursor),
168
- bindings: a(this.#c, (e) => e.bindings),
169
- changingTriggerId: a(this.#c, (e) => e.changingTriggerId),
170
- detail: a(this.#c, (e) => e.detail),
171
- detailLoading: a(this.#c, (e) => e.detailLoading),
172
- live: a(this.#c, (e) => e.live),
173
- loadFailed: a(this.#c, (e) => e.loadFailed),
174
- loading: a(this.#c, (e) => e.loading),
175
- loadMoreFailed: a(this.#c, (e) => e.loadMoreFailed),
176
- loadingMore: a(this.#c, (e) => e.loadingMore),
177
- nextCursor: a(this.#c, (e) => e.nextCursor),
178
- publications: a(this.#c, (e) => e.publications),
179
- publishing: a(this.#c, (e) => e.publishing),
180
- rollingBackPublicationId: a(this.#c, (e) => e.rollingBackPublicationId),
181
- selectedTriggerId: a(this.#c, (e) => e.selectedTriggerId),
182
- testingTriggerId: a(this.#c, (e) => e.testingTriggerId),
183
- testResult: a(this.#c, (e) => e.testResult),
184
- total: a(this.#c, (e) => e.total)
162
+ constructor(t, n, r, i = () => crypto.randomUUID(), a = y()) {
163
+ this.#e = t, this.#t = i, this.#n = a, this.#s = r, this.#l = n, this.$ = {
164
+ activities: e(this.#c, (e) => e.activities),
165
+ activitiesLoadFailed: e(this.#c, (e) => e.activitiesLoadFailed),
166
+ activitiesLoading: e(this.#c, (e) => e.activitiesLoading),
167
+ activitiesLoadingMore: e(this.#c, (e) => e.activitiesLoadingMore),
168
+ activitiesNextCursor: e(this.#c, (e) => e.activitiesNextCursor),
169
+ bindings: e(this.#c, (e) => e.bindings),
170
+ changingTriggerId: e(this.#c, (e) => e.changingTriggerId),
171
+ detail: e(this.#c, (e) => e.detail),
172
+ detailLoading: e(this.#c, (e) => e.detailLoading),
173
+ live: e(this.#c, (e) => e.live),
174
+ loadFailed: e(this.#c, (e) => e.loadFailed),
175
+ loading: e(this.#c, (e) => e.loading),
176
+ loadMoreFailed: e(this.#c, (e) => e.loadMoreFailed),
177
+ loadingMore: e(this.#c, (e) => e.loadingMore),
178
+ nextCursor: e(this.#c, (e) => e.nextCursor),
179
+ publications: e(this.#c, (e) => e.publications),
180
+ publishing: e(this.#c, (e) => e.publishing),
181
+ rollingBackPublicationId: e(this.#c, (e) => e.rollingBackPublicationId),
182
+ selectedTriggerId: e(this.#c, (e) => e.selectedTriggerId),
183
+ testingTriggerId: e(this.#c, (e) => e.testingTriggerId),
184
+ testResult: e(this.#c, (e) => e.testResult),
185
+ total: e(this.#c, (e) => e.total)
185
186
  };
186
187
  }
187
188
  dispose() {
@@ -190,7 +191,7 @@ var pe = class {
190
191
  this.#c.dispose();
191
192
  }
192
193
  reset() {
193
- this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate(), this.#u = void 0, this.#c.set(T);
194
+ this.#r.invalidate(), this.#i.invalidate(), this.#a.invalidate(), this.#o.invalidate(), this.#u = void 0, this.#c.set(E);
194
195
  }
195
196
  async load(e, t) {
196
197
  let n = {
@@ -198,7 +199,7 @@ var pe = class {
198
199
  projectId: e
199
200
  }, r = this.#r.begin();
200
201
  D(this.#c.value.target, n) || (this.#u = void 0), this.#s(void 0), this.#c.set({
201
- ...T,
202
+ ...E,
202
203
  loading: !0,
203
204
  target: n
204
205
  });
@@ -232,7 +233,7 @@ var pe = class {
232
233
  try {
233
234
  let e = await this.#e.listPublications(n.projectId, n.flowId, {
234
235
  cursor: t,
235
- limit: E
236
+ limit: de
236
237
  });
237
238
  if (!r()) return;
238
239
  let i = new Set(this.#c.value.publications.map((e) => e.publicationId));
@@ -273,7 +274,7 @@ var pe = class {
273
274
  message: this.#n.t("notice.published", { name: t.draft.name })
274
275
  }), !0);
275
276
  } catch (e) {
276
- return s() ? (e instanceof S && e.code == "live.conflict" && await this.#f(n), this.#s(o(e, this.#n.t)), !1) : !1;
277
+ return s() ? (e instanceof u && e.code == "live.conflict" && await this.#f(n), this.#s(o(e, this.#n.t)), !1) : !1;
277
278
  } finally {
278
279
  s() && this.#h({ publishing: !1 });
279
280
  }
@@ -298,7 +299,7 @@ var pe = class {
298
299
  message: this.#n.t("notice.rolledBack", { revision: e.revisionId })
299
300
  }), !0);
300
301
  } catch (e) {
301
- return c() ? (e instanceof S && e.code == "live.conflict" && await this.#f(r), this.#s(o(e, this.#n.t)), !1) : !1;
302
+ return c() ? (e instanceof u && e.code == "live.conflict" && await this.#f(r), this.#s(o(e, this.#n.t)), !1) : !1;
302
303
  } finally {
303
304
  c() && this.#h({ rollingBackPublicationId: void 0 });
304
305
  }
@@ -333,7 +334,7 @@ var pe = class {
333
334
  testingTriggerId: void 0,
334
335
  testResult: void 0
335
336
  });
336
- let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.projectId, t.flowId, e), this.#e.listFlowTriggerActivities(t.projectId, t.flowId, e, { limit: fe })]);
337
+ let [r, i] = await Promise.allSettled([this.#e.getFlowTriggerBinding(t.projectId, t.flowId, e), this.#e.listFlowTriggerActivities(t.projectId, t.flowId, e, { limit: ue })]);
337
338
  if (n()) {
338
339
  if (r.status == "rejected") {
339
340
  this.#h({
@@ -367,7 +368,7 @@ var pe = class {
367
368
  try {
368
369
  let e = await this.#e.listFlowTriggerActivities(r.projectId, r.flowId, n, {
369
370
  cursor: t,
370
- limit: fe
371
+ limit: ue
371
372
  });
372
373
  if (!i() || this.#c.value.selectedTriggerId != n) return;
373
374
  let a = new Set(this.#c.value.activities.map((e) => e.activityId));
@@ -443,14 +444,14 @@ var pe = class {
443
444
  this.#e.getLive(e.projectId, e.flowId),
444
445
  this.#e.listPublications(e.projectId, e.flowId, {
445
446
  includeTotal: !0,
446
- limit: E
447
+ limit: de
447
448
  }),
448
449
  this.#e.listFlowTriggerBindings(e.projectId, e.flowId)
449
450
  ]);
450
451
  }
451
452
  #m(e, t) {
452
453
  D(this.#c.value.target, e) ? this.#h(t) : this.#c.set({
453
- ...T,
454
+ ...E,
454
455
  ...t,
455
456
  target: e
456
457
  });
@@ -462,7 +463,7 @@ var pe = class {
462
463
  });
463
464
  }
464
465
  }, O = { starting: !1 };
465
- function me(e) {
466
+ function pe(e) {
466
467
  switch (e.kind) {
467
468
  case "condition": return { [e.node.input.handle]: e.node.input };
468
469
  case "subflow": return e.definition?.inputs ?? {};
@@ -470,44 +471,44 @@ function me(e) {
470
471
  case "value": return {};
471
472
  }
472
473
  }
473
- function he(e) {
474
+ function me(e) {
474
475
  return e.node.name == null ? e.kind == "task" || e.kind == "subflow" ? e.definition?.name ?? e.id : e.id : e.node.name;
475
476
  }
476
- function ge(e, t, n) {
477
- let r = s(e), i = r.graph({
477
+ async function he(e, t, n) {
478
+ let { FlowRunInputEditorStore: r } = await import("./flowRunInputEditorStore-B49C0ZmK.js").then((e) => e.n), i = f(e), a = i.graph({
478
479
  id: t,
479
480
  kind: "flow"
480
481
  });
481
- return i == null ? [] : Object.entries(i.nodes).toSorted(([e], [t]) => e.localeCompare(t)).flatMap(([e, t]) => {
482
- let i = r.resolveNode(e, t);
483
- if (i.kind == "trigger") return [];
484
- let a = Object.entries(me(i)).filter(([e, t]) => i.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
482
+ return a == null ? [] : Object.entries(a.nodes).toSorted(([e], [t]) => e.localeCompare(t)).flatMap(([e, t]) => {
483
+ let a = i.resolveNode(e, t);
484
+ if (a.kind == "trigger") return [];
485
+ let o = Object.entries(pe(a)).filter(([e, t]) => a.node.inputs[e] == null && !Object.hasOwn(t, "value")).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, t]) => Object.assign({
485
486
  handle: e,
486
487
  jsonSchema: t.jsonSchema,
487
488
  nullable: t.nullable
488
489
  }, t.description == null ? {} : { description: t.description }));
489
- return a.length == 0 ? [] : [{
490
- editor: new c(a, n),
490
+ return o.length == 0 ? [] : [{
491
+ editor: new r(o, n),
491
492
  nodeId: e,
492
- title: he(i)
493
+ title: me(a)
493
494
  }];
494
495
  });
495
496
  }
496
- var _e = class {
497
+ var ge = class {
497
498
  #e;
498
499
  #t;
499
500
  #n;
500
- #r = new p();
501
- #i = new p();
501
+ #r = new S();
502
+ #i = new S();
502
503
  #a;
503
504
  #o;
504
- #s = r(O);
505
+ #s = t(O);
505
506
  #c;
506
- constructor(e, t, n, r = l(), i = () => crypto.randomUUID()) {
507
- this.#e = e, this.#a = t, this.#o = n, this.#n = r, this.#t = i, this.$ = {
508
- inputRequest: a(this.#s, (e) => e.inputRequest),
509
- starting: a(this.#s, (e) => e.starting),
510
- submitting: a(this.#s, (e) => e.submitting)
507
+ constructor(t, n, r, i = y(), a = () => crypto.randomUUID()) {
508
+ this.#e = t, this.#a = n, this.#o = r, this.#n = i, this.#t = a, this.$ = {
509
+ inputRequest: e(this.#s, (e) => e.inputRequest),
510
+ starting: e(this.#s, (e) => e.starting),
511
+ submitting: e(this.#s, (e) => e.submitting)
511
512
  };
512
513
  }
513
514
  dispose() {
@@ -521,7 +522,9 @@ var _e = class {
521
522
  this.#s.set(O), this.#d(e);
522
523
  }
523
524
  async requestDraft(e, t, n) {
524
- return this.#i.invalidate(), t.draft == null ? "unavailable" : await this.#l("draft", e, t, n, t.draft.revisionId);
525
+ if (t.draft == null) return "unavailable";
526
+ let r = this.#i.begin();
527
+ return await this.#l("draft", e, t, n, t.draft.revisionId, r);
525
528
  }
526
529
  async requestLive(e, t) {
527
530
  let n = t.live?.publication.revisionId;
@@ -530,7 +533,7 @@ var _e = class {
530
533
  this.#o(void 0), this.#f({ starting: !0 });
531
534
  try {
532
535
  let i = await this.#e.getRevision(e, n);
533
- return r() ? await this.#l("live", e, t, i, n) : "unavailable";
536
+ return r() ? await this.#l("live", e, t, i, n, r) : "unavailable";
534
537
  } catch (e) {
535
538
  return r() && this.#o(o(e, this.#n.t)), "unavailable";
536
539
  } finally {
@@ -551,21 +554,41 @@ var _e = class {
551
554
  let t = Object.fromEntries(e.groups.map((e) => [e.nodeId, e.editor.values()])), n = await this.#u(e.source, e.projectId, e.flow, e.revisionId, t);
552
555
  return n && this.#s.value.inputRequest === e && this.dismissInputs(), n;
553
556
  }
554
- async #l(e, t, n, r, a) {
555
- let o = this.#s.value.inputRequest;
556
- this.#f({ inputRequest: void 0 }), this.#d(o);
557
- let s = ge(r, n.flowId, this.#n.lang$);
558
- if (s.length == 0) return await this.#u(e, t, n, a) ? "started" : "unavailable";
559
- let c = i((e) => s.every((t) => e(t.editor.valid$)));
560
- return this.#f({ inputRequest: {
561
- attempted: !1,
562
- flow: n,
563
- groups: s,
564
- projectId: t,
565
- revisionId: a,
566
- source: e,
567
- valid: c
568
- } }), "input";
557
+ async #l(e, t, r, i, a, o) {
558
+ let s = this.#s.value.inputRequest;
559
+ this.#f({
560
+ inputRequest: void 0,
561
+ starting: !0,
562
+ submitting: e
563
+ }), this.#d(s);
564
+ let c;
565
+ try {
566
+ c = await he(i, r.flowId, this.#n.lang$);
567
+ } catch (e) {
568
+ throw o() && this.#f({
569
+ starting: !1,
570
+ submitting: void 0
571
+ }), e;
572
+ }
573
+ if (!o()) {
574
+ for (let e of c) e.editor.dispose();
575
+ return "unavailable";
576
+ }
577
+ if (c.length == 0) return await this.#u(e, t, r, a) ? "started" : "unavailable";
578
+ let l = n((e) => c.every((t) => e(t.editor.valid$)));
579
+ return this.#f({
580
+ inputRequest: {
581
+ attempted: !1,
582
+ flow: r,
583
+ groups: c,
584
+ projectId: t,
585
+ revisionId: a,
586
+ source: e,
587
+ valid: l
588
+ },
589
+ starting: !1,
590
+ submitting: void 0
591
+ }), "input";
569
592
  }
570
593
  async #u(e, t, n, r, i = {}) {
571
594
  if (e == "draft" && n.draft == null || e == "live" && n.live == null) return !1;
@@ -642,7 +665,7 @@ function j(e, t) {
642
665
  outputs: A(e.outputs)
643
666
  };
644
667
  }
645
- function ve(e, t) {
668
+ function _e(e, t) {
646
669
  let n = /* @__PURE__ */ new Map();
647
670
  for (let t of e) {
648
671
  let e = n.get(t.serviceId) ?? [];
@@ -671,7 +694,7 @@ function ve(e, t) {
671
694
  };
672
695
  });
673
696
  }
674
- function ye(e, t) {
697
+ function ve(e, t) {
675
698
  return {
676
699
  choices: [],
677
700
  description: t("addNode.connectorBrowseActions"),
@@ -685,7 +708,7 @@ function ye(e, t) {
685
708
  serviceId: e.serviceId
686
709
  };
687
710
  }
688
- function M(e) {
711
+ function ye(e) {
689
712
  if (e?.kind != "task" || e.node.task != null) return;
690
713
  let t = e.definition;
691
714
  if (!(t == null || !("executor" in t) || t.executor.kind != "connector")) return {
@@ -710,13 +733,13 @@ var be = class {
710
733
  #d;
711
734
  #f;
712
735
  #p;
713
- constructor(e, t, n, o, s = l()) {
714
- this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new p(), this.#l = r(k), this.#p = !1, this.browseAddNodeOptions = async (e) => {
736
+ constructor(r, i, a, o, s = y()) {
737
+ this.#r = /* @__PURE__ */ new Map(), this.#i = /* @__PURE__ */ new Set(), this.#a = new S(), this.#l = t(k), this.#p = !1, this.browseAddNodeOptions = async (e) => {
715
738
  if (this.#p) return;
716
739
  let t = this.#u.$.projectId.value;
717
740
  if (t == null) return;
718
741
  let n = this.#f ?? await this.#e.listConnectorProviders(t, e);
719
- if (!(e.aborted || this.#p || t != this.#u.$.projectId.value)) return this.#f = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => ye(e, this.#t.t));
742
+ if (!(e.aborted || this.#p || t != this.#u.$.projectId.value)) return this.#f = n, n.toSorted((e, t) => e.serviceName.localeCompare(t.serviceName)).map((e) => ve(e, this.#t.t));
720
743
  }, this.provideAddNodeOptionChoices = async (e, t) => {
721
744
  if (this.#p) return;
722
745
  let n = this.#u.$.projectId.value, r = this.#f?.find((t) => `connector-provider:${t.serviceId}` == e);
@@ -742,33 +765,33 @@ var be = class {
742
765
  let t = a[e];
743
766
  t != null && o.set(e, t);
744
767
  }
745
- return ve([...o.values()], this.#t.t);
746
- }, this.#e = e, this.#n = o, this.#u = t, this.#c = n, this.#t = s;
747
- let c = a(this.#l, (e) => e.actions), u = a(this.#l, (e) => e.catalogs);
748
- this.#s = i((e) => {
749
- let n = M(e(t.$.selection)), r = e(this.#l);
750
- if (n == null) return { authorizationPending: !1 };
751
- let i = r.actions[n.actionId], a = i == null ? void 0 : r.catalogs[i.serviceId], o = n.connectionId == null ? void 0 : a?.byId.get(n.connectionId);
752
- return o == null && i?.defaultConnection?.connectionId == n.connectionId && (o = i.defaultConnection), {
753
- action: i,
754
- actionError: r.actionError?.actionId == n.actionId ? r.actionError.message : void 0,
768
+ return _e([...o.values()], this.#t.t);
769
+ }, this.#e = r, this.#n = o, this.#u = i, this.#c = a, this.#t = s;
770
+ let c = e(this.#l, (e) => e.actions), l = e(this.#l, (e) => e.catalogs);
771
+ this.#s = n((e) => {
772
+ let t = ye(e(i.$.selection)), n = e(this.#l);
773
+ if (t == null) return { authorizationPending: !1 };
774
+ 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);
775
+ return o == null && r?.defaultConnection?.connectionId == t.connectionId && (o = r.defaultConnection), {
776
+ action: r,
777
+ actionError: n.actionError?.actionId == t.actionId ? n.actionError.message : void 0,
755
778
  activeConnections: a?.active,
756
- authorizationPending: i != null && r.authorizationServiceId == i.serviceId,
779
+ authorizationPending: r != null && n.authorizationServiceId == r.serviceId,
757
780
  connection: o,
758
- connectionError: i != null && r.connectionError?.serviceId == i.serviceId ? r.connectionError.message : void 0
781
+ connectionError: r != null && n.connectionError?.serviceId == r.serviceId ? n.connectionError.message : void 0
759
782
  };
760
783
  }), this.$ = {
761
- actionLoading: a(this.#l, (e) => e.actionLoading),
784
+ actionLoading: e(this.#l, (e) => e.actionLoading),
762
785
  actions: c,
763
- catalogs: u,
764
- connectionLoading: a(this.#l, (e) => e.connectionLoading),
765
- selectedAction: a(this.#s, (e) => e.action),
766
- selectedActionError: a(this.#s, (e) => e.actionError),
767
- selectedActiveConnections: a(this.#s, (e) => e.activeConnections),
768
- selectedAuthorizationPending: a(this.#s, (e) => e.authorizationPending),
769
- selectedConnection: a(this.#s, (e) => e.connection),
770
- selectedConnectionError: a(this.#s, (e) => e.connectionError)
771
- }, this.#o = t.$.revision.reaction(() => void this.#b());
786
+ catalogs: l,
787
+ connectionLoading: e(this.#l, (e) => e.connectionLoading),
788
+ selectedAction: e(this.#s, (e) => e.action),
789
+ selectedActionError: e(this.#s, (e) => e.actionError),
790
+ selectedActiveConnections: e(this.#s, (e) => e.activeConnections),
791
+ selectedAuthorizationPending: e(this.#s, (e) => e.authorizationPending),
792
+ selectedConnection: e(this.#s, (e) => e.connection),
793
+ selectedConnectionError: e(this.#s, (e) => e.connectionError)
794
+ }, this.#o = i.$.revision.reaction(() => void this.#b());
772
795
  }
773
796
  dispose() {
774
797
  this.#p = !0, this.#a.invalidate(), this.#o();
@@ -780,7 +803,7 @@ var be = class {
780
803
  }
781
804
  async refresh(e = !1) {
782
805
  if (this.#p) return;
783
- let t = this.#a.begin(), n = this.#u.$.projectId.value, r = M(this.#u.$.selection.value);
806
+ let t = this.#a.begin(), n = this.#u.$.projectId.value, r = ye(this.#u.$.selection.value);
784
807
  if (n == null || r == null) {
785
808
  (this.#l.value.actionLoading != null || this.#l.value.connectionLoading != null) && this.#v({
786
809
  actionLoading: void 0,
@@ -868,11 +891,11 @@ var be = class {
868
891
  return;
869
892
  }
870
893
  if (!this.#y(r, e)) return;
871
- let s = u(a);
894
+ let c = s(a);
872
895
  return this.#v({ catalogs: {
873
896
  ...this.#l.value.catalogs,
874
- [t]: s
875
- } }), s;
897
+ [t]: c
898
+ } }), c;
876
899
  }
877
900
  async #_(e, t, n) {
878
901
  let r = this.#d?.serviceId == t ? this.#d : void 0, i = r == null ? [] : n.active.filter((e) => !r.connectionIds.has(e.connectionId)), a = i.length == 1 ? i[0] : n.preferred, o = this.#u.$.revision.value?.task(e.taskId);
@@ -907,8 +930,8 @@ var be = class {
907
930
  }
908
931
  }
909
932
  }
910
- }, N = { catalogs: {} }, P = 4, F = "trigger:";
911
- function I(e, t) {
933
+ }, M = { catalogs: {} }, N = 4, P = "trigger:";
934
+ function F(e, t) {
912
935
  if (e?.kind != "trigger") return;
913
936
  let n = e.trigger;
914
937
  if (n.kind != "poll" && n.kind != "integration") return;
@@ -919,7 +942,7 @@ function I(e, t) {
919
942
  triggerId: e.id
920
943
  };
921
944
  }
922
- function L(e, t, n, r) {
945
+ function I(e, t, n, r) {
923
946
  return {
924
947
  description: n,
925
948
  group: r,
@@ -938,24 +961,24 @@ function L(e, t, n, r) {
938
961
  }
939
962
  };
940
963
  }
941
- function R(e, t) {
964
+ function xe(e, t) {
942
965
  return {
943
966
  choices: [],
944
967
  description: t.t("addNode.triggerChooseConnection"),
945
968
  group: t.t("addNode.triggers"),
946
- id: `${F}${e.key}`,
969
+ id: `${P}${e.key}`,
947
970
  inputs: [],
948
971
  kind: "trigger",
949
972
  label: e.displayName,
950
973
  outputs: []
951
974
  };
952
975
  }
953
- function z(e, t, n) {
976
+ function L(e, t, n) {
954
977
  let r = n.t("addNode.triggers"), i = t.preferred;
955
- return i == null ? t.active.length > 0 ? t.active.map((t) => L(e, t.connectionId, t.displayName, r)) : [{
978
+ return i == null ? t.active.length > 0 ? t.active.map((t) => I(e, t.connectionId, t.displayName, r)) : [{
956
979
  description: n.t("addNode.triggerNeedsConnection", { provider: e.provider }),
957
980
  group: r,
958
- id: `${F}${e.key}:connect`,
981
+ id: `${P}${e.key}:connect`,
959
982
  inputs: [],
960
983
  kind: "trigger",
961
984
  label: n.t("addNode.triggerAddConnection"),
@@ -964,12 +987,12 @@ function z(e, t, n) {
964
987
  kind: "connect",
965
988
  provider: e.provider
966
989
  }
967
- }] : [L(e, i.connectionId, i.displayName, r)];
990
+ }] : [I(e, i.connectionId, i.displayName, r)];
968
991
  }
969
- function xe(e, t, n) {
992
+ function Se(e, t, n) {
970
993
  let r = t.preferred;
971
- if (r != null) return L(e, r.connectionId, r.displayName, n.t("addNode.triggers"));
972
- let i = R(e, n), a = z(e, t, n);
994
+ if (r != null) return I(e, r.connectionId, r.displayName, n.t("addNode.triggers"));
995
+ let i = xe(e, n), a = L(e, t, n);
973
996
  return {
974
997
  ...i,
975
998
  description: t.active.length == 0 ? n.t("addNode.triggerNeedsConnection", { provider: e.provider }) : i.description,
@@ -984,7 +1007,7 @@ function xe(e, t, n) {
984
1007
  }))
985
1008
  };
986
1009
  }
987
- var Se = class {
1010
+ var Ce = class {
988
1011
  #e;
989
1012
  #t;
990
1013
  #n;
@@ -996,12 +1019,12 @@ var Se = class {
996
1019
  #c;
997
1020
  #l;
998
1021
  #u;
999
- constructor(e, t, n, o, s = l()) {
1000
- this.#t = new AbortController(), this.#a = new p(), this.#c = r(N), this.#u = !1, this.browseAddNodeOptions = async (e) => {
1022
+ constructor(r, i, a, o, c = y()) {
1023
+ this.#t = new AbortController(), this.#a = new S(), this.#c = t(M), this.#u = !1, this.browseAddNodeOptions = async (e) => {
1001
1024
  let t = this.#l.$.projectId.value;
1002
1025
  if (e.aborted || this.#u || t == null || this.#l.$.target.value?.kind != "flow") return [];
1003
1026
  let n = await this.#d();
1004
- if (!(e.aborted || this.#u || t != this.#l.$.projectId.value)) return [...n.values()].map((e) => R(e, this.#i));
1027
+ if (!(e.aborted || this.#u || t != this.#l.$.projectId.value)) return [...n.values()].map((e) => xe(e, this.#i));
1005
1028
  }, this.provideAddNodeOptions = async (e, t) => {
1006
1029
  let n = this.#l.$.projectId.value;
1007
1030
  if (t.aborted || this.#u || n == null || this.#l.$.target.value?.kind != "flow") return [];
@@ -1017,49 +1040,49 @@ var Se = class {
1017
1040
  e.provider,
1018
1041
  e.type
1019
1042
  ].some((e) => e.toLowerCase().includes(r))), o = [...new Set(a.map((e) => e.provider))].filter((e) => this.#c.value.catalogs[e] == null);
1020
- for (let e = 0; e < o.length; e += P) {
1021
- let r = await Promise.all(o.slice(e, e + P).map(async (e) => [e, u(await this.#n.listConnectorConnections(n, e, t))]));
1043
+ for (let e = 0; e < o.length; e += N) {
1044
+ let r = await Promise.all(o.slice(e, e + N).map(async (e) => [e, s(await this.#n.listConnectorConnections(n, e, t))]));
1022
1045
  if (t.aborted || this.#u || n != this.#l.$.projectId.value) return;
1023
1046
  this.#f({ catalogs: {
1024
1047
  ...this.#c.value.catalogs,
1025
1048
  ...Object.fromEntries(r)
1026
1049
  } });
1027
1050
  }
1028
- return a.map((e) => xe(e, this.#c.value.catalogs[e.provider], this.#i));
1051
+ return a.map((e) => Se(e, this.#c.value.catalogs[e.provider], this.#i));
1029
1052
  }, this.provideAddNodeOptionChoices = async (e, t) => {
1030
- let n = this.#l.$.projectId.value, r = e.startsWith(F) ? e.slice(8) : void 0;
1053
+ let n = this.#l.$.projectId.value, r = e.startsWith(P) ? e.slice(8) : void 0;
1031
1054
  if (t.aborted || this.#u || n == null || r == null || this.#l.$.target.value?.kind != "flow") return;
1032
1055
  let i = (await this.#d()).get(r);
1033
1056
  if (t.aborted || this.#u || n != this.#l.$.projectId.value || i == null) return;
1034
1057
  let a = this.#c.value.catalogs[i.provider];
1035
1058
  if (a == null) {
1036
- if (a = u(await this.#n.listConnectorConnections(n, i.provider, t)), t.aborted || this.#u || n != this.#l.$.projectId.value) return;
1059
+ if (a = s(await this.#n.listConnectorConnections(n, i.provider, t)), t.aborted || this.#u || n != this.#l.$.projectId.value) return;
1037
1060
  this.#f({ catalogs: {
1038
1061
  ...this.#c.value.catalogs,
1039
1062
  [i.provider]: a
1040
1063
  } });
1041
1064
  }
1042
- return z(i, a, this.#i);
1043
- }, this.#n = e, this.#r = o, this.#i = s, this.#s = n, this.#l = t, this.#o = i((e) => {
1044
- let n = e(t.$.selection), r = I(n, t), i = e(this.#c);
1045
- if (n?.kind != "trigger") return { authorizationPending: !1 };
1046
- let a = n.trigger;
1065
+ return L(i, a, this.#i);
1066
+ }, this.#n = r, this.#r = o, this.#i = c, this.#s = a, this.#l = i, this.#o = n((e) => {
1067
+ let t = e(i.$.selection), n = F(t, i), r = e(this.#c);
1068
+ if (t?.kind != "trigger") return { authorizationPending: !1 };
1069
+ let a = t.trigger;
1047
1070
  if (a.kind != "poll" && a.kind != "integration") return { authorizationPending: !1 };
1048
- let o = r == null ? void 0 : i.catalogs[r.provider], s = i.connectionError;
1071
+ let o = n == null ? void 0 : r.catalogs[n.provider], s = r.connectionError;
1049
1072
  return {
1050
1073
  activeConnections: o?.active,
1051
- authorizationPending: i.authorizationProvider == r?.provider,
1052
- connection: r?.connectionId == null ? void 0 : o?.byId.get(r.connectionId),
1053
- connectionError: s != null && s.provider == r?.provider ? s.message : void 0,
1074
+ authorizationPending: r.authorizationProvider == n?.provider,
1075
+ connection: n?.connectionId == null ? void 0 : o?.byId.get(n.connectionId),
1076
+ connectionError: s != null && s.provider == n?.provider ? s.message : void 0,
1054
1077
  definition: a.definition
1055
1078
  };
1056
1079
  }), this.$ = {
1057
- connectionLoading: a(this.#c, (e) => e.connectionLoading),
1058
- selectedActiveConnections: a(this.#o, (e) => e.activeConnections),
1059
- selectedAuthorizationPending: a(this.#o, (e) => e.authorizationPending),
1060
- selectedConnection: a(this.#o, (e) => e.connection),
1061
- selectedConnectionError: a(this.#o, (e) => e.connectionError),
1062
- selectedDefinition: a(this.#o, (e) => e.definition)
1080
+ connectionLoading: e(this.#c, (e) => e.connectionLoading),
1081
+ selectedActiveConnections: e(this.#o, (e) => e.activeConnections),
1082
+ selectedAuthorizationPending: e(this.#o, (e) => e.authorizationPending),
1083
+ selectedConnection: e(this.#o, (e) => e.connection),
1084
+ selectedConnectionError: e(this.#o, (e) => e.connectionError),
1085
+ selectedDefinition: e(this.#o, (e) => e.definition)
1063
1086
  };
1064
1087
  }
1065
1088
  dispose() {
@@ -1068,10 +1091,10 @@ var Se = class {
1068
1091
  this.#o.dispose(), this.#c.dispose();
1069
1092
  }
1070
1093
  reset() {
1071
- this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(N));
1094
+ this.#u || (this.#t.abort(), this.#t = new AbortController(), this.#e = void 0, this.#a.invalidate(), this.#c.set(M));
1072
1095
  }
1073
1096
  async refresh(e = !1) {
1074
- let t = this.#a.begin(), n = this.#l.$.projectId.value, r = I(this.#l.$.selection.value, this.#l);
1097
+ let t = this.#a.begin(), n = this.#l.$.projectId.value, r = F(this.#l.$.selection.value, this.#l);
1075
1098
  if (!this.#u) {
1076
1099
  if (n == null || r == null) {
1077
1100
  this.#c.value.connectionLoading != null && this.#f({ connectionLoading: void 0 });
@@ -1083,7 +1106,7 @@ var Se = class {
1083
1106
  connectionLoading: r.provider
1084
1107
  });
1085
1108
  try {
1086
- let e = u(await this.#n.listConnectorConnections(n, r.provider));
1109
+ let e = s(await this.#n.listConnectorConnections(n, r.provider));
1087
1110
  if (!this.#p(t, n)) return;
1088
1111
  this.#f({ catalogs: {
1089
1112
  ...this.#c.value.catalogs,
@@ -1128,7 +1151,7 @@ var Se = class {
1128
1151
  delete t[e], this.#f({
1129
1152
  authorizationProvider: void 0,
1130
1153
  catalogs: t
1131
- }), I(this.#l.$.selection.value, this.#l)?.provider == e && await this.refresh(!0);
1154
+ }), F(this.#l.$.selection.value, this.#l)?.provider == e && await this.refresh(!0);
1132
1155
  }
1133
1156
  #d() {
1134
1157
  if (this.#e != null) return this.#e;
@@ -1149,38 +1172,38 @@ var Se = class {
1149
1172
  };
1150
1173
  //#endregion
1151
1174
  //#region src/project/common/edgeChanges.ts
1152
- function B(e, t, n) {
1175
+ function R(e, t, n) {
1153
1176
  let r = {
1154
1177
  source: n.source,
1155
1178
  sourceHandle: n.sourceHandle,
1156
1179
  target: n.target,
1157
1180
  targetHandle: n.targetHandle
1158
- }, i = V(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
1181
+ }, i = z(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
1159
1182
  return a?.kind == "sources" && a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
1160
1183
  edge: r,
1161
1184
  kind: "graph.edge.connect",
1162
1185
  target: t
1163
1186
  }];
1164
1187
  }
1165
- function Ce(e, t, n) {
1188
+ function we(e, t, n) {
1166
1189
  let r = {
1167
1190
  source: n.source,
1168
1191
  sourceHandle: n.sourceHandle,
1169
1192
  target: n.target,
1170
1193
  targetHandle: n.targetHandle
1171
- }, i = V(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
1194
+ }, i = z(e, t)?.nodes[n.target], a = i != null && "inputs" in i ? i.inputs[n.targetHandle] : void 0;
1172
1195
  return a?.kind != "sources" || !a.sources.some((e) => e.kind == "node" && e.nodeId == n.source && e.output == n.sourceHandle) ? [] : [{
1173
1196
  edge: r,
1174
1197
  kind: "graph.edge.disconnect",
1175
1198
  target: t
1176
1199
  }];
1177
1200
  }
1178
- function V(e, t) {
1201
+ function z(e, t) {
1179
1202
  return t.kind == "flow" ? e.document.flows[t.id]?.graph : e.document.subflows[t.id]?.graph;
1180
1203
  }
1181
1204
  //#endregion
1182
1205
  //#region src/project/common/flowChanges.ts
1183
- function we(e, t) {
1206
+ function Te(e, t) {
1184
1207
  return [{
1185
1208
  flow: {
1186
1209
  graph: { nodes: {} },
@@ -1190,14 +1213,14 @@ function we(e, t) {
1190
1213
  kind: "flow.create"
1191
1214
  }];
1192
1215
  }
1193
- function Te(e, t) {
1216
+ function Ee(e, t) {
1194
1217
  return [{
1195
1218
  flowId: e,
1196
1219
  kind: "flow.rename",
1197
1220
  name: t
1198
1221
  }];
1199
1222
  }
1200
- function Ee(e) {
1223
+ function De(e) {
1201
1224
  return [{
1202
1225
  flowId: e,
1203
1226
  kind: "flow.delete"
@@ -1205,7 +1228,7 @@ function Ee(e) {
1205
1228
  }
1206
1229
  //#endregion
1207
1230
  //#region src/project/common/moduleChanges.ts
1208
- async function De(e) {
1231
+ async function Oe(e) {
1209
1232
  try {
1210
1233
  let { parse: t } = await import("./lib-S4ccuMeT.js"), n = t(e, {
1211
1234
  errorRecovery: !0,
@@ -1221,7 +1244,7 @@ async function De(e) {
1221
1244
  return [];
1222
1245
  }
1223
1246
  }
1224
- function Oe(e, t, n) {
1247
+ function ke(e, t, n) {
1225
1248
  return [{
1226
1249
  imports: n,
1227
1250
  kind: "module.source.replace",
@@ -1231,7 +1254,7 @@ function Oe(e, t, n) {
1231
1254
  }
1232
1255
  //#endregion
1233
1256
  //#region src/project/common/nodeChanges.ts
1234
- function ke(e, t, n, r = {
1257
+ function Ae(e, t, n, r = {
1235
1258
  imports: [],
1236
1259
  source: "export default function run(input) {\n return { result: input.value }\n}\n"
1237
1260
  }, i = {
@@ -1256,7 +1279,7 @@ function ke(e, t, n, r = {
1256
1279
  kind: "graph.node.create",
1257
1280
  node: {
1258
1281
  concurrency: 1,
1259
- inputs: G(i.inputs),
1282
+ inputs: U(i.inputs),
1260
1283
  kind: "task",
1261
1284
  name: n,
1262
1285
  task: {
@@ -1270,7 +1293,7 @@ function ke(e, t, n, r = {
1270
1293
  target: e
1271
1294
  }];
1272
1295
  }
1273
- function H(e, t, n) {
1296
+ function B(e, t, n) {
1274
1297
  return [{
1275
1298
  kind: "task.create",
1276
1299
  task: n,
@@ -1279,7 +1302,7 @@ function H(e, t, n) {
1279
1302
  kind: "graph.node.create",
1280
1303
  node: {
1281
1304
  concurrency: 1,
1282
- inputs: G(n.inputs),
1305
+ inputs: U(n.inputs),
1283
1306
  kind: "task",
1284
1307
  name: n.name,
1285
1308
  taskId: t.taskId
@@ -1288,9 +1311,9 @@ function H(e, t, n) {
1288
1311
  target: e
1289
1312
  }];
1290
1313
  }
1291
- function Ae(e, t, n, r, i, a = {}) {
1314
+ function je(e, t, n, r, i, a = {}) {
1292
1315
  let o = a.inputs ?? {};
1293
- return H(e, t, {
1316
+ return B(e, t, {
1294
1317
  executor: {
1295
1318
  kind: "llm",
1296
1319
  mode: r
@@ -1302,12 +1325,12 @@ function Ae(e, t, n, r, i, a = {}) {
1302
1325
  type: "array"
1303
1326
  },
1304
1327
  nullable: !0,
1305
- value: K(o, "messages", null)
1328
+ value: W(o, "messages", null)
1306
1329
  },
1307
1330
  input: {
1308
1331
  jsonSchema: { type: "string" },
1309
1332
  nullable: !1,
1310
- value: K(o, "input", "Alex")
1333
+ value: W(o, "input", "Alex")
1311
1334
  },
1312
1335
  template: {
1313
1336
  jsonSchema: {
@@ -1316,7 +1339,7 @@ function Ae(e, t, n, r, i, a = {}) {
1316
1339
  type: "array"
1317
1340
  },
1318
1341
  nullable: !1,
1319
- value: K(o, "template", [{
1342
+ value: W(o, "template", [{
1320
1343
  content: "Hello, I'm {{input}}",
1321
1344
  role: "user"
1322
1345
  }])
@@ -1324,7 +1347,7 @@ function Ae(e, t, n, r, i, a = {}) {
1324
1347
  model: {
1325
1348
  jsonSchema: { type: "object" },
1326
1349
  nullable: !1,
1327
- value: K(o, "model", { model: "deepseek-v4-flash" })
1350
+ value: W(o, "model", { model: "deepseek-v4-flash" })
1328
1351
  }
1329
1352
  },
1330
1353
  name: n,
@@ -1335,7 +1358,7 @@ function Ae(e, t, n, r, i, a = {}) {
1335
1358
  } }
1336
1359
  });
1337
1360
  }
1338
- function je(e, t, n) {
1361
+ function Me(e, t, n) {
1339
1362
  return [{
1340
1363
  kind: "graph.node.create",
1341
1364
  node: {
@@ -1366,7 +1389,7 @@ function je(e, t, n) {
1366
1389
  target: e
1367
1390
  }];
1368
1391
  }
1369
- function Me(e, t, n) {
1392
+ function Ne(e, t, n) {
1370
1393
  return [{
1371
1394
  kind: "graph.node.create",
1372
1395
  node: {
@@ -1384,7 +1407,7 @@ function Me(e, t, n) {
1384
1407
  target: e
1385
1408
  }];
1386
1409
  }
1387
- function U(e, t, n) {
1410
+ function V(e, t, n) {
1388
1411
  return [{
1389
1412
  kind: "graph.node.create",
1390
1413
  node: n,
@@ -1392,7 +1415,7 @@ function U(e, t, n) {
1392
1415
  target: e
1393
1416
  }];
1394
1417
  }
1395
- function Ne(e, t, n, r) {
1418
+ function Pe(e, t, n, r) {
1396
1419
  let i = r.name ?? n.displayName, a = n.type == "poll" ? {
1397
1420
  bindingId: t.bindingId,
1398
1421
  config: r.config,
@@ -1425,8 +1448,8 @@ function Ne(e, t, n, r) {
1425
1448
  target: e
1426
1449
  }];
1427
1450
  }
1428
- function Pe(e, t, n) {
1429
- let r = W(e, t)?.nodes;
1451
+ function Fe(e, t, n) {
1452
+ let r = H(e, t)?.nodes;
1430
1453
  if (r == null) return [];
1431
1454
  let i = new Set(n), a = n.flatMap((e) => {
1432
1455
  let n = r[e];
@@ -1450,32 +1473,32 @@ function Pe(e, t, n) {
1450
1473
  });
1451
1474
  return a;
1452
1475
  }
1453
- function Fe(e, t, n, r) {
1454
- let i = W(e, t)?.nodes[n];
1476
+ function Ie(e, t, n, r) {
1477
+ let i = H(e, t)?.nodes[n];
1455
1478
  if (i == null || !("inputs" in i)) return;
1456
1479
  let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
1457
- return q(t, n, {
1480
+ return G(t, n, {
1458
1481
  ...c,
1459
1482
  ...r
1460
1483
  });
1461
1484
  }
1462
- function Ie(e, t, n, r, i) {
1463
- return Le(e, t, n, { [r]: i });
1485
+ function Le(e, t, n, r, i) {
1486
+ return Re(e, t, n, { [r]: i });
1464
1487
  }
1465
- function Le(e, t, n, r) {
1466
- let i = W(e, t)?.nodes[n];
1488
+ function Re(e, t, n, r) {
1489
+ let i = H(e, t)?.nodes[n];
1467
1490
  if (i == null || !("inputs" in i)) return;
1468
1491
  let a = { ...i.inputs };
1469
1492
  for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
1470
1493
  kind: "value",
1471
1494
  value: t
1472
1495
  };
1473
- return q(t, n, {
1496
+ return G(t, n, {
1474
1497
  ...i,
1475
1498
  inputs: a
1476
1499
  });
1477
1500
  }
1478
- function Re(e, t, n) {
1501
+ function ze(e, t, n) {
1479
1502
  let r = e.document.tasks[t];
1480
1503
  if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
1481
1504
  kind: "task.replace",
@@ -1489,7 +1512,7 @@ function Re(e, t, n) {
1489
1512
  taskId: t
1490
1513
  }];
1491
1514
  }
1492
- function ze(e, t, n, r) {
1515
+ function Be(e, t, n, r) {
1493
1516
  let i = e.document.flows[t.id]?.graph.nodes[n];
1494
1517
  if (i == null) return;
1495
1518
  let a = {
@@ -1535,25 +1558,25 @@ function ze(e, t, n, r) {
1535
1558
  config: r.config
1536
1559
  };
1537
1560
  }
1538
- return q(t, n, o);
1561
+ return G(t, n, o);
1539
1562
  }
1540
- function Be(e, t, n, r, i) {
1563
+ function Ve(e, t, n, r, i) {
1541
1564
  let a = e.document.flows[t.id]?.graph.nodes[n];
1542
1565
  if (a == null || a.kind != "integration" && a.kind != "poll") return;
1543
1566
  let o = { ...a.config };
1544
- return i === void 0 ? delete o[r] : o[r] = i, q(t, n, {
1567
+ return i === void 0 ? delete o[r] : o[r] = i, G(t, n, {
1545
1568
  ...a,
1546
1569
  config: o
1547
1570
  });
1548
1571
  }
1549
- function Ve(e, t, n, r) {
1572
+ function He(e, t, n, r) {
1550
1573
  let i = e.document.flows[t.id]?.graph.nodes[n];
1551
1574
  if (i != null) switch (i.kind) {
1552
- case "cron": return q(t, n, {
1575
+ case "cron": return G(t, n, {
1553
1576
  ...i,
1554
1577
  cronTimes: r
1555
1578
  });
1556
- case "poll": return q(t, n, {
1579
+ case "poll": return G(t, n, {
1557
1580
  ...i,
1558
1581
  pollTimes: r
1559
1582
  });
@@ -1562,7 +1585,7 @@ function Ve(e, t, n, r) {
1562
1585
  default: return;
1563
1586
  }
1564
1587
  }
1565
- function He(e, t, n, r) {
1588
+ function Ue(e, t, n, r) {
1566
1589
  let i = e.document.flows[t.id]?.graph.nodes[n];
1567
1590
  if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
1568
1591
  binding: {
@@ -1573,19 +1596,19 @@ function He(e, t, n, r) {
1573
1596
  kind: "binding.replace"
1574
1597
  }];
1575
1598
  }
1576
- function W(e, t) {
1599
+ function H(e, t) {
1577
1600
  return t.kind == "flow" ? e.document.flows[t.id]?.graph : e.document.subflows[t.id]?.graph;
1578
1601
  }
1579
- function G(e) {
1602
+ function U(e) {
1580
1603
  return Object.fromEntries(Object.entries(e).flatMap(([e, t]) => Object.hasOwn(t, "value") ? [[e, {
1581
1604
  kind: "value",
1582
1605
  value: t.value
1583
1606
  }]] : []));
1584
1607
  }
1585
- function K(e, t, n) {
1608
+ function W(e, t, n) {
1586
1609
  return e != null && Object.hasOwn(e, t) ? e[t] : n;
1587
1610
  }
1588
- function q(e, t, n) {
1611
+ function G(e, t, n) {
1589
1612
  return [{
1590
1613
  kind: "graph.node.replace",
1591
1614
  node: n,
@@ -1595,7 +1618,7 @@ function q(e, t, n) {
1595
1618
  }
1596
1619
  //#endregion
1597
1620
  //#region src/workbench/browser/runtime/designer/diagnostics.ts
1598
- function Ue(e, t) {
1621
+ function K(e, t) {
1599
1622
  return t == e || t.startsWith(`${e}/`);
1600
1623
  }
1601
1624
  function We(e, t) {
@@ -1605,7 +1628,7 @@ function Ge(e, t, n, r) {
1605
1628
  if (e == null || t == null || n == null) return [];
1606
1629
  if (r != null) return Xe(t, r, n.diagnostics);
1607
1630
  let i = `/document/${t.kind == "flow" ? "flows" : "subflows"}/${t.id}`;
1608
- return n.diagnostics.filter((e) => Ue(i, e.path));
1631
+ return n.diagnostics.filter((e) => K(i, e.path));
1609
1632
  }
1610
1633
  function Ke(e) {
1611
1634
  return e.startsWith("/modules/") ? "code" : /\/graph\/nodes\/[^/]+\/task(?:\/|$)/.test(e) ? "task" : e.includes("/graph/nodes/") ? "node" : e.startsWith("/document/tasks/") ? "task" : e.startsWith("/document/flows/") ? "flow" : "project";
@@ -1654,18 +1677,18 @@ function Xe(e, t, n) {
1654
1677
  let e = t.definition != null && "moduleId" in t.definition ? t.definition.moduleId : void 0;
1655
1678
  e != null && i.push(`/modules/${e}`);
1656
1679
  } else t.kind == "subflow" && i.push(`/document/subflows/${t.node.subflowId}`);
1657
- return n.filter((e) => i.some((t) => Ue(t, e.path)));
1680
+ return n.filter((e) => i.some((t) => K(t, e.path)));
1658
1681
  }
1659
1682
  //#endregion
1660
1683
  //#region src/workbench/browser/runtime/designer/projectChanges.ts
1661
- function J(e, n) {
1684
+ function q(e, t) {
1662
1685
  return {
1663
1686
  ...e,
1664
- content: t(e.content, n)
1687
+ content: r(e.content, t)
1665
1688
  };
1666
1689
  }
1667
1690
  function Ze(e, t, n) {
1668
- return e == "flow" ? we(t, n) : [{
1691
+ return e == "flow" ? Te(t, n) : [{
1669
1692
  kind: "subflow.create",
1670
1693
  subflow: {
1671
1694
  graph: { nodes: {} },
@@ -1689,15 +1712,15 @@ function Ze(e, t, n) {
1689
1712
  }
1690
1713
  function Qe(e, t, n, r, i) {
1691
1714
  switch (r.kind) {
1692
- case "code": return ke(t, {
1715
+ case "code": return Ae(t, {
1693
1716
  moduleId: i(),
1694
1717
  nodeId: n
1695
1718
  }, r.name);
1696
- case "llm": return Ae(t, {
1719
+ case "llm": return je(t, {
1697
1720
  nodeId: n,
1698
1721
  taskId: i()
1699
1722
  }, r.name, r.mode, r.outputDescription);
1700
- case "connector": return H(t, {
1723
+ case "connector": return B(t, {
1701
1724
  nodeId: n,
1702
1725
  taskId: i()
1703
1726
  }, {
@@ -1710,18 +1733,18 @@ function Qe(e, t, n, r, i) {
1710
1733
  name: r.action.name,
1711
1734
  outputs: r.action.outputs
1712
1735
  });
1713
- case "condition": return je(t, n, r.name);
1714
- case "value": return Me(t, n, r.name);
1736
+ case "condition": return Me(t, n, r.name);
1737
+ case "value": return Ne(t, n, r.name);
1715
1738
  case "subflow": {
1716
1739
  let i = e.subflow(r.subflowId);
1717
1740
  return i == null ? void 0 : dt(t, n, r.subflowId, i.inputs);
1718
1741
  }
1719
- case "webhook": return t.kind == "flow" ? U(t, n, {
1742
+ case "webhook": return t.kind == "flow" ? V(t, n, {
1720
1743
  inputsDef: [],
1721
1744
  kind: "webhook",
1722
1745
  name: r.name
1723
1746
  }) : void 0;
1724
- case "cron": return t.kind == "flow" ? U(t, n, {
1747
+ case "cron": return t.kind == "flow" ? V(t, n, {
1725
1748
  cronTimes: [{
1726
1749
  type: "every",
1727
1750
  unit: "hour",
@@ -1730,7 +1753,7 @@ function Qe(e, t, n, r, i) {
1730
1753
  kind: "cron",
1731
1754
  name: r.name
1732
1755
  }) : void 0;
1733
- case "provider-trigger": return t.kind == "flow" ? Ne(t, {
1756
+ case "provider-trigger": return t.kind == "flow" ? Pe(t, {
1734
1757
  bindingId: i(),
1735
1758
  nodeId: n
1736
1759
  }, r.definition, {
@@ -1740,7 +1763,7 @@ function Qe(e, t, n, r, i) {
1740
1763
  }
1741
1764
  }
1742
1765
  function $e(e, t, n) {
1743
- return Pe(e.revision.content, t, n);
1766
+ return Fe(e.revision.content, t, n);
1744
1767
  }
1745
1768
  function et(e, t, n) {
1746
1769
  let r = e.graph(t)?.nodes ?? {}, i = Object.fromEntries(n.flatMap((e) => r[e] == null ? [] : [[e, r[e]]]));
@@ -1854,32 +1877,71 @@ function tt(e, t, n, r) {
1854
1877
  };
1855
1878
  }
1856
1879
  function nt(e, t, n, r) {
1857
- return Fe(e.revision.content, t, n, r);
1880
+ return Ie(e.revision.content, t, n, r);
1858
1881
  }
1859
1882
  function rt(e, t, n, r) {
1860
1883
  let i = e.node(t, n)?.node;
1861
1884
  if (i == null) return;
1862
1885
  let { description: a, ...o } = i;
1863
- return Y(t, n, r == null ? o : {
1886
+ return X(t, n, r == null ? o : {
1864
1887
  ...o,
1865
1888
  description: r
1866
1889
  });
1867
1890
  }
1868
1891
  function it(e, t, n, r, i) {
1869
- return Ie(e.revision.content, t, n, r, i);
1892
+ return Le(e.revision.content, t, n, r, i);
1870
1893
  }
1871
1894
  function at(e, t, n, r) {
1872
- let i = e.node(t, n)?.node;
1873
- if (i?.kind != "condition") return;
1874
- let { defaultOutput: a, ...o } = i;
1875
- return Y(t, n, {
1876
- ...o,
1877
- ...r
1878
- });
1895
+ let i = e.graph(t), a = i?.nodes[n];
1896
+ if (i == null || a?.kind != "condition") return;
1897
+ let o = Object.fromEntries([...a.cases.map((e) => [e.output, !0]), ...a.defaultOutput == null ? [] : [[a.defaultOutput, !0]]]), s = Object.fromEntries([...r.cases.map((e) => [e.output, !0]), ...r.defaultOutput == null ? [] : [[r.defaultOutput, !0]]]), c = a.input.handle == r.input.handle ? void 0 : [a.input.handle, r.input.handle], l = J(o, s), u = new Set(Object.keys(s)), d = [];
1898
+ for (let [e, o] of Object.entries(i.nodes)) {
1899
+ if (!("inputs" in o)) continue;
1900
+ let i = e == n, s = { ...o.inputs };
1901
+ if (e == n) {
1902
+ c != null && Object.hasOwn(s, c[0]) && (s[c[1]] = s[c[0]], delete s[c[0]]);
1903
+ for (let e of Object.keys(s)) e != r.input.handle && delete s[e];
1904
+ }
1905
+ for (let [e, t] of Object.entries(s)) {
1906
+ if (t.kind != "sources") continue;
1907
+ let r = t.sources.flatMap((e) => e.kind != "node" || e.nodeId != n ? [e] : l != null && e.output == l[0] ? [{
1908
+ ...e,
1909
+ output: l[1]
1910
+ }] : u.has(e.output) ? [e] : []);
1911
+ r.length == t.sources.length && r.every((e, n) => e === t.sources[n]) || (i = !0, r.length == 0 ? delete s[e] : s[e] = {
1912
+ kind: "sources",
1913
+ sources: r
1914
+ });
1915
+ }
1916
+ if (i) {
1917
+ if (e == n) {
1918
+ let { defaultOutput: n, ...i } = a;
1919
+ d.push({
1920
+ kind: "graph.node.replace",
1921
+ node: {
1922
+ ...i,
1923
+ ...r,
1924
+ inputs: s
1925
+ },
1926
+ nodeId: e,
1927
+ target: t
1928
+ });
1929
+ } else d.push({
1930
+ kind: "graph.node.replace",
1931
+ node: {
1932
+ ...o,
1933
+ inputs: s
1934
+ },
1935
+ nodeId: e,
1936
+ target: t
1937
+ });
1938
+ }
1939
+ }
1940
+ return d;
1879
1941
  }
1880
1942
  function ot(e, t, n, r) {
1881
1943
  let i = e.node(t, n)?.node;
1882
- if (i?.kind == "value") return Y(t, n, {
1944
+ if (i?.kind == "value") return X(t, n, {
1883
1945
  ...i,
1884
1946
  values: Object.fromEntries(r.map((e) => [e.handle, {
1885
1947
  ...e.description == null ? {} : { description: e.description },
@@ -1892,7 +1954,7 @@ function ot(e, t, n, r) {
1892
1954
  function st(e, t, n, r) {
1893
1955
  let i = e.graph(t)?.nodes[n];
1894
1956
  if (i?.kind == "task") switch (r.kind) {
1895
- case "code": return i.task == null ? void 0 : mt(e, t, n, {
1957
+ case "code": return i.task == null ? void 0 : Y(e, t, n, {
1896
1958
  ...i.task,
1897
1959
  inputs: r.inputs,
1898
1960
  name: r.name,
@@ -1929,7 +1991,7 @@ function st(e, t, n, r) {
1929
1991
  }
1930
1992
  function ct(e, t, n, r) {
1931
1993
  let i = e.graph(t)?.nodes[n];
1932
- if (i?.kind == "task" && i.task != null) return mt(e, t, n, {
1994
+ if (i?.kind == "task" && i.task != null) return Y(e, t, n, {
1933
1995
  ...i.task,
1934
1996
  ...r
1935
1997
  });
@@ -1938,7 +2000,7 @@ function lt(e, t, n, r) {
1938
2000
  let i = e.trigger(t.id, n);
1939
2001
  if (i == null || i.kind != "webhook") return;
1940
2002
  let { options: a, ...o } = i;
1941
- return Y(t, n, Object.keys(r.options).length == 0 ? {
2003
+ return X(t, n, Object.keys(r.options).length == 0 ? {
1942
2004
  ...o,
1943
2005
  inputsDef: r.inputs
1944
2006
  } : {
@@ -1973,14 +2035,14 @@ function ft(e) {
1973
2035
  value: t.value
1974
2036
  }]] : []));
1975
2037
  }
1976
- function pt(e, t) {
2038
+ function J(e, t) {
1977
2039
  let n = Object.keys(e).filter((e) => !Object.hasOwn(t, e)), r = Object.keys(t).filter((t) => !Object.hasOwn(e, t));
1978
2040
  return n.length == 1 && r.length == 1 ? [n[0], r[0]] : void 0;
1979
2041
  }
1980
- function mt(e, t, n, r) {
2042
+ function Y(e, t, n, r) {
1981
2043
  let i = e.graph(t), a = i?.nodes[n];
1982
2044
  if (i == null || a?.kind != "task" || a.task == null) return;
1983
- let o = pt(a.task.inputs, r.inputs), s = pt(a.task.outputs, r.outputs), c = new Set(Object.keys(r.outputs)), l = [];
2045
+ let o = J(a.task.inputs, r.inputs), s = J(a.task.outputs, r.outputs), c = new Set(Object.keys(r.outputs)), l = [];
1984
2046
  for (let [e, u] of Object.entries(i.nodes)) {
1985
2047
  if (!("inputs" in u)) continue;
1986
2048
  let i = e == n, d = { ...u.inputs };
@@ -2017,7 +2079,7 @@ function mt(e, t, n, r) {
2017
2079
  }
2018
2080
  return l;
2019
2081
  }
2020
- function Y(e, t, n) {
2082
+ function X(e, t, n) {
2021
2083
  return [{
2022
2084
  kind: "graph.node.replace",
2023
2085
  node: n,
@@ -2027,32 +2089,32 @@ function Y(e, t, n) {
2027
2089
  }
2028
2090
  //#endregion
2029
2091
  //#region src/workbench/browser/runtime/designer/remoteChangeTargets.ts
2030
- function ht(e, t) {
2092
+ function pt(e, t) {
2031
2093
  return e.kind == t.kind && e.id == t.id;
2032
2094
  }
2033
- function X(e, t, n, r) {
2095
+ function Z(e, t, n, r) {
2034
2096
  for (let [i, a] of Object.entries(t.graph(n)?.nodes ?? {})) r(a) && e.add(i);
2035
2097
  }
2036
- function gt(e, t, n, r) {
2098
+ function mt(e, t, n, r) {
2037
2099
  let i = /* @__PURE__ */ new Set();
2038
2100
  for (let a of r) switch (a.kind) {
2039
2101
  case "graph.node.create":
2040
2102
  case "graph.node.replace":
2041
- ht(a.target, n) && i.add(a.nodeId);
2103
+ pt(a.target, n) && i.add(a.nodeId);
2042
2104
  break;
2043
2105
  case "task.replace":
2044
- X(i, e, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId), X(i, t, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId);
2106
+ Z(i, e, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId), Z(i, t, n, (e) => e.kind == "task" && e.task == null && e.taskId == a.taskId);
2045
2107
  break;
2046
2108
  case "module.source.replace":
2047
- X(i, e, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId), X(i, t, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId);
2109
+ Z(i, e, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId), Z(i, t, n, (e) => e.kind == "task" && e.task?.moduleId == a.moduleId);
2048
2110
  break;
2049
- case "subflow.definition.replace": X(i, e, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId), X(i, t, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId);
2111
+ case "subflow.definition.replace": Z(i, e, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId), Z(i, t, n, (e) => e.kind == "subflow" && e.subflowId == a.subflowId);
2050
2112
  }
2051
2113
  return new Set([...i].filter((e) => t.selection(n, e) != null));
2052
2114
  }
2053
2115
  //#endregion
2054
2116
  //#region src/workbench/browser/runtime/stores/draftChanges.ts
2055
- function _t(e) {
2117
+ function ht(e) {
2056
2118
  if (e.length != 1) return;
2057
2119
  let t = e[0];
2058
2120
  switch (t.kind) {
@@ -2066,7 +2128,7 @@ function _t(e) {
2066
2128
  default: return;
2067
2129
  }
2068
2130
  }
2069
- function vt(e, t, n) {
2131
+ function gt(e, t, n) {
2070
2132
  let r = new Map(e.map((e) => [e.flowId, e])), i = new Map(t.map((e) => [e.flowId, e]));
2071
2133
  return [...i.keys()].toSorted().map((e) => {
2072
2134
  let t = r.get(e), a = i.get(e), o = t?.live ?? null;
@@ -2083,7 +2145,7 @@ function vt(e, t, n) {
2083
2145
  };
2084
2146
  });
2085
2147
  }
2086
- var yt = class {
2148
+ var _t = class {
2087
2149
  #e;
2088
2150
  #t;
2089
2151
  #n;
@@ -2111,7 +2173,7 @@ var yt = class {
2111
2173
  this.#a = e;
2112
2174
  }
2113
2175
  project(e) {
2114
- return this.#o.reduce((e, t) => J(e, t.changes), e);
2176
+ return this.#o.reduce((e, t) => q(e, t.changes), e);
2115
2177
  }
2116
2178
  enqueue(e) {
2117
2179
  let t = this.#s.then(e);
@@ -2120,8 +2182,8 @@ var yt = class {
2120
2182
  async change(e, t, n, r = !0) {
2121
2183
  this.#t.beforeChange(r);
2122
2184
  let i = this.#t.flows();
2123
- this.#t.apply(J(t, n), i, i);
2124
- let a = _t(n), o = this.#o.at(-1), s = a != null && o != null && !o.started && _t(o.changes) == a ? o : void 0;
2185
+ this.#t.apply(q(t, n), i, i);
2186
+ let a = ht(n), o = this.#o.at(-1), s = a != null && o != null && !o.started && ht(o.changes) == a ? o : void 0;
2125
2187
  if (s != null) return s.changes = n, await s.result;
2126
2188
  let c = {
2127
2189
  ...e,
@@ -2149,7 +2211,7 @@ var yt = class {
2149
2211
  let r = this.#l(e, n, t);
2150
2212
  return this.#o.length == 0 && this.#t.check(), r;
2151
2213
  } catch (n) {
2152
- if (n instanceof S && n.code == "project.revision-conflict") {
2214
+ if (n instanceof u && n.code == "project.revision-conflict") {
2153
2215
  if (!t && await this.#t.recover(e)) {
2154
2216
  t = !0;
2155
2217
  continue;
@@ -2166,10 +2228,10 @@ var yt = class {
2166
2228
  #l(e, t, n) {
2167
2229
  let r = {
2168
2230
  ...n.revision,
2169
- content: J(t, e.changes).content
2231
+ content: q(t, e.changes).content
2170
2232
  };
2171
2233
  this.#o = this.#o.filter((t) => t !== e), this.#a = r;
2172
- let i = this.#t.flows(), a = vt(i, n.draftFlows, r), o = this.#t.diagnostics(), s = this.#o.length == 0 && o != null && a.find((e) => e.flowId == o.flowId)?.draft?.closureDigest == o.closureDigest;
2234
+ let i = this.#t.flows(), a = gt(i, n.draftFlows, r), o = this.#t.diagnostics(), s = this.#o.length == 0 && o != null && a.find((e) => e.flowId == o.flowId)?.draft?.closureDigest == o.closureDigest;
2173
2235
  return this.#t.apply(this.project(r), a, i, s), this.#t.headChanged(e.projectId, r.revisionId), r;
2174
2236
  }
2175
2237
  #u(e) {
@@ -2177,7 +2239,7 @@ var yt = class {
2177
2239
  let t = this.#t.flows();
2178
2240
  this.#t.apply(this.project(this.#a), t, t);
2179
2241
  }
2180
- }, bt = class {
2242
+ }, vt = class {
2181
2243
  #e;
2182
2244
  #t;
2183
2245
  #n;
@@ -2220,7 +2282,7 @@ var yt = class {
2220
2282
  this.#c(a, r);
2221
2283
  } catch (r) {
2222
2284
  if (this.#o || !n()) return;
2223
- if (r instanceof S && r.code == "project.presentation-conflict") try {
2285
+ if (r instanceof u && r.code == "project.presentation-conflict") try {
2224
2286
  let t = await this.#e.getPresentation(e);
2225
2287
  if (this.#o || !n()) return;
2226
2288
  this.#c(a, t), this.#n({
@@ -2242,29 +2304,29 @@ var yt = class {
2242
2304
  value: n
2243
2305
  });
2244
2306
  }
2245
- }, Z = 50, xt = {
2307
+ }, yt = 50, bt = {
2246
2308
  failed: !1,
2247
2309
  loaded: !1,
2248
2310
  loading: !0,
2249
2311
  loadingMore: !1,
2250
2312
  loadMoreFailed: !1,
2251
2313
  projects: []
2252
- }, St = class {
2314
+ }, xt = class {
2253
2315
  #e;
2254
2316
  #t;
2255
- #n = new p();
2317
+ #n = new S();
2256
2318
  #r;
2257
- #i = r(xt);
2319
+ #i = t(bt);
2258
2320
  #a = !1;
2259
- constructor(e, t, n) {
2260
- this.#e = e, this.#t = n, this.#r = t, this.$ = {
2261
- failed: a(this.#i, (e) => e.failed),
2262
- loading: a(this.#i, (e) => e.loading),
2263
- loadingMore: a(this.#i, (e) => e.loadingMore),
2264
- loadMoreFailed: a(this.#i, (e) => e.loadMoreFailed),
2265
- nextCursor: a(this.#i, (e) => e.nextCursor),
2266
- projects: a(this.#i, (e) => e.projects),
2267
- total: a(this.#i, (e) => e.total)
2321
+ constructor(t, n, r) {
2322
+ this.#e = t, this.#t = r, this.#r = n, this.$ = {
2323
+ failed: e(this.#i, (e) => e.failed),
2324
+ loading: e(this.#i, (e) => e.loading),
2325
+ loadingMore: e(this.#i, (e) => e.loadingMore),
2326
+ loadMoreFailed: e(this.#i, (e) => e.loadMoreFailed),
2327
+ nextCursor: e(this.#i, (e) => e.nextCursor),
2328
+ projects: e(this.#i, (e) => e.projects),
2329
+ total: e(this.#i, (e) => e.total)
2268
2330
  };
2269
2331
  }
2270
2332
  get loaded() {
@@ -2300,7 +2362,7 @@ var yt = class {
2300
2362
  try {
2301
2363
  let t = await this.#e.listProjects({
2302
2364
  includeTotal: !0,
2303
- limit: Z
2365
+ limit: yt
2304
2366
  });
2305
2367
  if (!e()) return;
2306
2368
  this.#o({
@@ -2329,7 +2391,7 @@ var yt = class {
2329
2391
  try {
2330
2392
  let e = await this.#e.listProjects({
2331
2393
  cursor: t,
2332
- limit: Z
2394
+ limit: yt
2333
2395
  });
2334
2396
  if (!n()) return;
2335
2397
  let r = new Set(this.#i.value.projects.map((e) => e.projectId));
@@ -2374,14 +2436,14 @@ var yt = class {
2374
2436
  ...e
2375
2437
  });
2376
2438
  }
2377
- }, Ct = {
2439
+ }, St = {
2378
2440
  checkLoading: !1,
2379
2441
  flows: [],
2380
2442
  selectedNodeIds: [],
2381
2443
  workspaceLoadFailed: !1,
2382
2444
  workspaceLoading: !1
2383
2445
  };
2384
- function wt(e) {
2446
+ function Ct(e) {
2385
2447
  return e.workspaceLoading ? "loading" : e.busy == "designer" ? "saving" : e.draft == null ? "noDraft" : "saved";
2386
2448
  }
2387
2449
  function Q(e, t) {
@@ -2397,73 +2459,73 @@ function $(e, t, n) {
2397
2459
  source: r.module.source
2398
2460
  };
2399
2461
  }
2400
- var Tt = class {
2462
+ var wt = class {
2401
2463
  #e;
2402
- #t = r(Ct);
2464
+ #t = t(St);
2403
2465
  #n;
2404
- constructor(e, t) {
2405
- let n = a(this.#t, (e) => e.busy), r = a(this.#t, (e) => e.checkLoading), o = a(this.#t, (e) => e.diagnosticFocus), c = a(this.#t, (e) => e.diagnostics), l = a(this.#t, (e) => e.draft), u = a(this.#t, (e) => e.flows), d = a(this.#t, (e) => {
2466
+ constructor(t, r) {
2467
+ 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) => e.flows), u = e(this.#t, (e) => {
2406
2468
  if (e.moduleEditor == null) return;
2407
2469
  let { phase: t, ...n } = e.moduleEditor;
2408
2470
  return {
2409
2471
  ...n,
2410
2472
  status: Q(e.draft, e.moduleEditor)
2411
2473
  };
2412
- }), f = a(this.#t, (e) => e.nodeFocus), p = a(this.#t, (e) => e.presentation), m = a(this.#t, (e) => e.projectId), h = a(this.#t, (e) => e.draft == null ? void 0 : s(e.draft)), g = a(this.#t, (e) => e.selectedNodeIds), _ = a(this.#t, (e) => e.target), v = a(this.#t, (e) => e.workspaceLoadFailed), y = a(this.#t, (e) => e.workspaceLoading);
2413
- this.#e = a(this.#t, (e) => ({
2414
- revision: e.draft == null ? void 0 : s(e.draft),
2474
+ }), d = e(this.#t, (e) => e.nodeFocus), p = e(this.#t, (e) => e.presentation), m = e(this.#t, (e) => e.projectId), h = e(this.#t, (e) => e.draft == null ? void 0 : f(e.draft)), _ = e(this.#t, (e) => e.selectedNodeIds), v = e(this.#t, (e) => e.target), y = e(this.#t, (e) => e.workspaceLoadFailed), b = e(this.#t, (e) => e.workspaceLoading);
2475
+ this.#e = e(this.#t, (e) => ({
2476
+ revision: e.draft == null ? void 0 : f(e.draft),
2415
2477
  target: e.target
2416
2478
  }), { equal: (e, t) => e.revision === t.revision && e.target === t.target });
2417
- let b = a(this.#t, (e) => {
2418
- if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return s(e.draft).selection(e.target, e.selectedNodeIds[0]);
2479
+ let x = e(this.#t, (e) => {
2480
+ if (e.draft != null && e.target != null && e.selectedNodeIds.length == 1) return f(e.draft).selection(e.target, e.selectedNodeIds[0]);
2419
2481
  });
2420
2482
  this.$ = {
2421
- addNodeOptions: i((t) => {
2422
- let { revision: n, target: r } = t(this.#e);
2423
- return ee(n?.revision, r, t(e.t$));
2483
+ addNodeOptions: n((e) => {
2484
+ let { revision: n, target: r } = e(this.#e);
2485
+ return g(n?.revision, r, e(t.t$));
2424
2486
  }),
2425
- busy: n,
2426
- checkLoading: r,
2487
+ busy: i,
2488
+ checkLoading: a,
2427
2489
  diagnosticFocus: o,
2428
- diagnosticItems: a(this.#t, (e) => Ye(e.draft == null ? void 0 : s(e.draft), e.target, e.diagnostics)),
2429
- diagnostics: c,
2430
- draft: l,
2431
- flows: u,
2432
- inspectorDiagnostics: a(this.#t, (e) => Ge(e.draft == null ? void 0 : s(e.draft), e.target, e.diagnostics, b.value)),
2433
- moduleDiagnostics: a(this.#t, (e) => {
2490
+ diagnosticItems: e(this.#t, (e) => Ye(e.draft == null ? void 0 : f(e.draft), e.target, e.diagnostics)),
2491
+ diagnostics: s,
2492
+ draft: c,
2493
+ flows: l,
2494
+ inspectorDiagnostics: e(this.#t, (e) => Ge(e.draft == null ? void 0 : f(e.draft), e.target, e.diagnostics, x.value)),
2495
+ moduleDiagnostics: e(this.#t, (e) => {
2434
2496
  let t = e.moduleEditor?.moduleId;
2435
2497
  return t == null ? [] : e.diagnostics?.diagnostics.filter((e) => e.path.startsWith(`/modules/${t}/source`)) ?? [];
2436
2498
  }),
2437
- moduleEditor: d,
2438
- nodeFocus: f,
2499
+ moduleEditor: u,
2500
+ nodeFocus: d,
2439
2501
  presentation: p,
2440
- project: i((e) => {
2441
- let n = e(m);
2442
- return n == null ? void 0 : e(t.$.projects).find((e) => e.projectId == n);
2502
+ project: n((e) => {
2503
+ let t = e(m);
2504
+ return t == null ? void 0 : e(r.$.projects).find((e) => e.projectId == t);
2443
2505
  }),
2444
2506
  projectId: m,
2445
- projectLoadFailed: t.$.failed,
2446
- projectLoadMoreFailed: t.$.loadMoreFailed,
2447
- projectLoading: t.$.loading,
2448
- projectLoadingMore: t.$.loadingMore,
2449
- projectNextCursor: t.$.nextCursor,
2450
- projectTotal: t.$.total,
2451
- projects: t.$.projects,
2507
+ projectLoadFailed: r.$.failed,
2508
+ projectLoadMoreFailed: r.$.loadMoreFailed,
2509
+ projectLoading: r.$.loading,
2510
+ projectLoadingMore: r.$.loadingMore,
2511
+ projectNextCursor: r.$.nextCursor,
2512
+ projectTotal: r.$.total,
2513
+ projects: r.$.projects,
2452
2514
  revision: h,
2453
- selection: b,
2454
- selectedNodeIds: g,
2455
- status: a(this.#t, wt),
2456
- target: _,
2457
- targetFlow: a(this.#t, (e) => e.target?.kind == "flow" ? e.flows.find((t) => t.flowId == e.target?.id) : void 0),
2458
- targetName: a(this.#t, (e) => {
2515
+ selection: x,
2516
+ selectedNodeIds: _,
2517
+ status: e(this.#t, Ct),
2518
+ target: v,
2519
+ targetFlow: e(this.#t, (e) => e.target?.kind == "flow" ? e.flows.find((t) => t.flowId == e.target?.id) : void 0),
2520
+ targetName: e(this.#t, (e) => {
2459
2521
  if (e.target == null) return;
2460
2522
  if (e.draft == null) return e.target.id;
2461
- let t = s(e.draft);
2523
+ let t = f(e.draft);
2462
2524
  return (e.target.kind == "flow" ? t.flow(e.target.id)?.name : t.subflow(e.target.id)?.name) ?? e.target.id;
2463
2525
  }),
2464
- workspaceLoadFailed: v,
2465
- workspaceLoading: y
2466
- }, this.#n = new Set(Object.values(t.$));
2526
+ workspaceLoadFailed: y,
2527
+ workspaceLoading: b
2528
+ }, this.#n = new Set(Object.values(r.$));
2467
2529
  }
2468
2530
  get value() {
2469
2531
  return this.#t.value;
@@ -2478,12 +2540,12 @@ var Tt = class {
2478
2540
  for (let e of Object.values(this.$)) this.#n.has(e) || e.dispose();
2479
2541
  this.#e.dispose(), this.#t.dispose();
2480
2542
  }
2481
- }, Et = 250;
2482
- function Dt(e, t, n, r) {
2543
+ }, Tt = 250;
2544
+ function Et(e, t, n, r) {
2483
2545
  if (r == null) return;
2484
2546
  if (r.kind == "subflow") {
2485
2547
  if (e.subflow(r.id) != null) return r;
2486
- let n = d(t, null);
2548
+ let n = c(t, null);
2487
2549
  return n == null ? void 0 : {
2488
2550
  id: n.flowId,
2489
2551
  kind: "flow"
@@ -2496,10 +2558,10 @@ function Dt(e, t, n, r) {
2496
2558
  kind: "flow"
2497
2559
  };
2498
2560
  }
2499
- var Ot = class {
2561
+ var Dt = class {
2500
2562
  #e;
2501
2563
  #t;
2502
- #n = new p();
2564
+ #n = new S();
2503
2565
  #r;
2504
2566
  #i;
2505
2567
  #a;
@@ -2518,8 +2580,8 @@ var Ot = class {
2518
2580
  #v = !1;
2519
2581
  #y = 0;
2520
2582
  #b;
2521
- constructor(e, t, n = () => crypto.randomUUID(), r = l(), i = () => {}) {
2522
- this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new St(e, t, r), this.#l = new Tt(r, this.#o), this.#t = new yt(e, t, r, {
2583
+ constructor(e, t, n = () => crypto.randomUUID(), r = y(), i = () => {}) {
2584
+ this.#e = e, this.#c = t, this.#i = n, this.#r = r, this.#s = i, this.#o = new xt(e, t, r), this.#l = new wt(r, this.#o), this.#t = new _t(e, t, r, {
2523
2585
  apply: (e, t, n, r) => this.#C(e, t, n, r),
2524
2586
  beforeChange: (e) => {
2525
2587
  this.#j(), this.#h = !1, e && (this.#z({ busy: "designer" }), this.#c(void 0));
@@ -2533,7 +2595,7 @@ var Ot = class {
2533
2595
  flows: () => this.#l.value.flows,
2534
2596
  headChanged: (e, t) => this.#M(e, t),
2535
2597
  recover: (e) => this.#D(e, !0)
2536
- }), this.#a = new bt(e, t, (e) => this.#z({ presentation: e }), r), this.$ = this.#l.$;
2598
+ }), this.#a = new vt(e, t, (e) => this.#z({ presentation: e }), r), this.$ = this.#l.$;
2537
2599
  }
2538
2600
  dispose() {
2539
2601
  this.#j(), this.#_ = !0, this.#n.invalidate(), this.#a.dispose(), this.#b?.(), this.#l.dispose(), this.#o.dispose();
@@ -2616,7 +2678,7 @@ var Ot = class {
2616
2678
  selectNodes(e) {
2617
2679
  return e.length == this.#l.value.selectedNodeIds.length && e.every((e, t) => e == this.#l.value.selectedNodeIds[t]) ? !0 : this.#P() ? (this.#j(), this.#z({
2618
2680
  diagnosticFocus: void 0,
2619
- moduleEditor: $(this.#l.value.draft == null ? void 0 : s(this.#l.value.draft), this.#l.value.target, e),
2681
+ moduleEditor: $(this.#l.value.draft == null ? void 0 : f(this.#l.value.draft), this.#l.value.target, e),
2620
2682
  nodeFocus: void 0,
2621
2683
  selectedNodeIds: e
2622
2684
  }), !0) : !1;
@@ -2667,7 +2729,7 @@ var Ot = class {
2667
2729
  if (n == null || r.length == 0) return !1;
2668
2730
  if (n.name == r) return !0;
2669
2731
  this.#z({ busy: "resource" }), this.#c(void 0);
2670
- let i = await this.#S(Te(e, r), !1);
2732
+ let i = await this.#S(Ee(e, r), !1);
2671
2733
  return this.#z({ busy: void 0 }), i != null && (this.#c({
2672
2734
  kind: "success",
2673
2735
  message: this.#r.t("notice.flowRenamed", { name: r })
@@ -2677,7 +2739,7 @@ var Ot = class {
2677
2739
  let t = this.#l.value.flows.find((t) => t.flowId == e);
2678
2740
  if (t?.draft == null || this.#l.value.target?.kind == "flow" && this.#l.value.target.id == e && !this.#P()) return !1;
2679
2741
  this.#z({ busy: "resource" }), this.#c(void 0);
2680
- let n = await this.#S(Ee(e), !1);
2742
+ let n = await this.#S(De(e), !1);
2681
2743
  return this.#z({ busy: void 0 }), n != null && (this.#c({
2682
2744
  kind: "success",
2683
2745
  message: this.#r.t("notice.flowDeleted", { name: t.draft.name })
@@ -2689,32 +2751,32 @@ var Ot = class {
2689
2751
  if (r == null || i == null) return;
2690
2752
  let a = this.#i();
2691
2753
  if (e.kind == "comment") return await this.#x(i, a, t);
2692
- let o = s(r), c = te(e, o, i, this.#r.t);
2754
+ let o = f(r), s = b(e, o, i, this.#r.t);
2755
+ if (s == null) return;
2756
+ let c = Qe(o, i, a, s, this.#i);
2693
2757
  if (c == null) return;
2694
- let l = Qe(o, i, a, c, this.#i);
2695
- if (l == null) return;
2696
- let u = n == null ? l : [...l, ...B(J(r, l).content, i, n(a))], d = this.#S(u);
2758
+ let l = n == null ? c : [...c, ...R(q(r, c).content, i, n(a))], u = this.#S(l);
2697
2759
  this.selectNodes([a]);
2698
- let f = this.moveNodes({ [a]: t });
2699
- if (await d != null) return await f, a;
2760
+ let d = this.moveNodes({ [a]: t });
2761
+ if (await u != null) return await d, a;
2700
2762
  }
2701
2763
  async connect(e) {
2702
2764
  let t = this.$.revision.value, n = this.#l.value.target;
2703
2765
  if (t == null || n == null) return;
2704
- let r = B(t.revision.content, n, e);
2766
+ let r = R(t.revision.content, n, e);
2705
2767
  r.length > 0 && await this.#S(r);
2706
2768
  }
2707
2769
  async disconnect(e) {
2708
2770
  let t = this.$.revision.value, n = this.#l.value.target;
2709
2771
  if (t == null || n == null) return;
2710
- let r = Ce(t.revision.content, n, e);
2772
+ let r = we(t.revision.content, n, e);
2711
2773
  r.length > 0 && await this.#S(r);
2712
2774
  }
2713
2775
  async deleteSelectedNodes() {
2714
2776
  if (!this.#P()) return;
2715
2777
  let e = this.$.revision.value, t = this.#l.value.target;
2716
2778
  if (e == null || t == null || this.#l.value.selectedNodeIds.length == 0) return;
2717
- let n = h(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = $e(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#S(i), o = r.size == 0 ? void 0 : this.#w((e) => g(e, t, r));
2779
+ let n = p(this.#l.value.presentation?.value ?? {}, t), r = new Set(this.#l.value.selectedNodeIds.filter((e) => n.has(e))), i = $e(e, t, this.#l.value.selectedNodeIds), a = i.length == 0 ? void 0 : this.#S(i), o = r.size == 0 ? void 0 : this.#w((e) => m(e, t, r));
2718
2780
  this.selectNodes([]), (a == null || await a != null) && await o;
2719
2781
  }
2720
2782
  copySelectedNodes() {
@@ -2747,7 +2809,7 @@ var Ot = class {
2747
2809
  y: (r?.position.y ?? 80) + 40
2748
2810
  }];
2749
2811
  })), s = this.#w((e) => {
2750
- let n = m(e, t, o);
2812
+ let n = d(e, t, o);
2751
2813
  for (let e of i) n = x(n, t, e.nodeId, {
2752
2814
  content: e.content,
2753
2815
  position: {
@@ -2817,25 +2879,25 @@ var Ot = class {
2817
2879
  async setConnectorConnection(e, t) {
2818
2880
  let n = this.$.revision.value;
2819
2881
  if (n == null) return !1;
2820
- let r = Re(n.revision.content, e, t);
2882
+ let r = ze(n.revision.content, e, t);
2821
2883
  return r != null && await this.#S(r) != null;
2822
2884
  }
2823
2885
  async saveTriggerSettings(e, t) {
2824
2886
  let n = this.$.revision.value, r = this.#l.value.target;
2825
2887
  if (n == null || r?.kind != "flow") return !1;
2826
- let i = ze(n.revision.content, r, e, t);
2888
+ let i = Be(n.revision.content, r, e, t);
2827
2889
  return i != null && await this.#S(i) != null;
2828
2890
  }
2829
2891
  async saveTriggerConfig(e, t, n) {
2830
2892
  let r = this.$.revision.value, i = this.#l.value.target;
2831
2893
  if (r == null || i?.kind != "flow") return !1;
2832
- let a = Be(r.revision.content, i, e, t, n);
2894
+ let a = Ve(r.revision.content, i, e, t, n);
2833
2895
  return a != null && await this.#S(a) != null;
2834
2896
  }
2835
2897
  async saveTriggerSchedule(e, t) {
2836
2898
  let n = this.$.revision.value, r = this.#l.value.target;
2837
2899
  if (n == null || r?.kind != "flow") return !1;
2838
- let i = Ve(n.revision.content, r, e, t);
2900
+ let i = He(n.revision.content, r, e, t);
2839
2901
  return i != null && await this.#S(i) != null;
2840
2902
  }
2841
2903
  async saveWebhook(e, t) {
@@ -2847,7 +2909,7 @@ var Ot = class {
2847
2909
  async setTriggerConnection(e, t) {
2848
2910
  let n = this.$.revision.value, r = this.#l.value.target;
2849
2911
  if (n == null || r?.kind != "flow") return !1;
2850
- let i = He(n.revision.content, r, e, t);
2912
+ let i = Ue(n.revision.content, r, e, t);
2851
2913
  return i != null && await this.#S(i) != null;
2852
2914
  }
2853
2915
  async saveSubflowSettings(e, t) {
@@ -2884,9 +2946,9 @@ var Ot = class {
2884
2946
  ...e,
2885
2947
  phase: "saving"
2886
2948
  } });
2887
- let t = await De(e.source);
2949
+ let t = await Oe(e.source);
2888
2950
  if (this.#_) return !1;
2889
- let n = await this.#S(Oe(e.moduleId, e.source, t));
2951
+ let n = await this.#S(ke(e.moduleId, e.source, t));
2890
2952
  return !this.#_ && this.#l.value.moduleEditor?.moduleId == e.moduleId && this.#z({ moduleEditor: {
2891
2953
  ...this.#l.value.moduleEditor,
2892
2954
  phase: n == null ? "failed" : void 0
@@ -2894,13 +2956,13 @@ var Ot = class {
2894
2956
  }
2895
2957
  async moveNodes(e) {
2896
2958
  let t = this.#l.value.target;
2897
- t != null && await this.#w((n) => m(n, t, e));
2959
+ t != null && await this.#w((n) => d(n, t, e));
2898
2960
  }
2899
2961
  async moveViewport(e) {
2900
2962
  let t = this.#l.value.target;
2901
2963
  if (t == null) return;
2902
2964
  let n = this.#N().viewport;
2903
- (n.x != e.x || n.y != e.y || n.zoom != e.zoom) && this.#j(), await this.#w((n) => f(n, t, e));
2965
+ (n.x != e.x || n.y != e.y || n.zoom != e.zoom) && this.#j(), await this.#w((n) => l(n, t, e));
2904
2966
  }
2905
2967
  async check() {
2906
2968
  await this.#T();
@@ -2970,7 +3032,7 @@ var Ot = class {
2970
3032
  });
2971
3033
  return;
2972
3034
  }
2973
- let r = We(s(t), n);
3035
+ let r = We(f(t), n);
2974
3036
  if (r == null) {
2975
3037
  this.#z({
2976
3038
  checkLoading: !1,
@@ -3016,18 +3078,18 @@ var Ot = class {
3016
3078
  let o = await this.#e.syncDraft(e.projectId, a.revisionId);
3017
3079
  if (!this.#R(e)) return !1;
3018
3080
  if (o.kind == "changes" && o.revisions.length == 0) return !0;
3019
- let c;
3081
+ let s;
3020
3082
  try {
3021
- c = this.#O(a, o);
3083
+ s = this.#O(a, o);
3022
3084
  } catch {
3023
3085
  if (o = await this.#e.syncDraft(e.projectId), !this.#R(e)) return !1;
3024
- c = this.#O(a, o);
3086
+ s = this.#O(a, o);
3025
3087
  }
3026
- if (c.revisionId == a.revisionId) return !0;
3027
- let l = o.kind == "changes" && t != null ? gt(s(a), s(c), t, o.revisions.flatMap((e) => e.operations)) : void 0;
3088
+ if (s.revisionId == a.revisionId) return !0;
3089
+ let c = o.kind == "changes" && t != null ? mt(f(a), f(s), t, o.revisions.flatMap((e) => e.operations)) : void 0;
3028
3090
  o.kind == "snapshot" && this.#j();
3029
- let u = this.#l.value.flows, d = vt(u, o.draftFlows, c), f = this.#l.value.diagnostics, p = this.#t.pendingCount == 0 && f != null && d.find((e) => e.flowId == f.flowId)?.draft?.closureDigest == f.closureDigest, m = this.#I(c, d, p);
3030
- return this.#M(e.projectId, c.revisionId), o.kind == "changes" && o.revisions.length > 0 && t != null && l != null && i == this.#m && this.#k(e, t, l, i), n && (this.#c({
3091
+ let l = this.#l.value.flows, u = gt(l, o.draftFlows, s), d = this.#l.value.diagnostics, p = this.#t.pendingCount == 0 && d != null && u.find((e) => e.flowId == d.flowId)?.draft?.closureDigest == d.closureDigest, m = this.#I(s, u, p);
3092
+ return this.#M(e.projectId, s.revisionId), o.kind == "changes" && o.revisions.length > 0 && t != null && c != null && i == this.#m && this.#k(e, t, c, i), n && (this.#c({
3031
3093
  kind: m ? "error" : "success",
3032
3094
  message: this.#r.t(m ? "notice.moduleUpdated" : "notice.draftUpdated")
3033
3095
  }), p || this.#T()), !0;
@@ -3042,7 +3104,7 @@ var Ot = class {
3042
3104
  if (e.revision.parentRevisionId != n.revisionId) throw Error("Invalid Draft revision chain.");
3043
3105
  n = {
3044
3106
  ...e.revision,
3045
- content: J(n, e.operations).content
3107
+ content: q(n, e.operations).content
3046
3108
  };
3047
3109
  }
3048
3110
  return n;
@@ -3057,7 +3119,7 @@ var Ot = class {
3057
3119
  return;
3058
3120
  }
3059
3121
  for (let e of n) a.targets.add(e);
3060
- globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#A(), Et);
3122
+ globalThis.clearTimeout(a.timer), a.timer = globalThis.setTimeout(() => this.#A(), Tt);
3061
3123
  return;
3062
3124
  }
3063
3125
  n.size == 0 || i.selectedNodeIds.length > 0 || (this.#p = {
@@ -3066,7 +3128,7 @@ var Ot = class {
3066
3128
  projectId: e.projectId,
3067
3129
  target: t,
3068
3130
  targets: new Set(n),
3069
- timer: globalThis.setTimeout(() => this.#A(), Et),
3131
+ timer: globalThis.setTimeout(() => this.#A(), Tt),
3070
3132
  viewport: this.#N().viewport
3071
3133
  });
3072
3134
  }
@@ -3077,7 +3139,7 @@ var Ot = class {
3077
3139
  if (t.projectId != e.projectId || t.target?.kind != e.target.kind || t.target.id != e.target.id || t.selectedNodeIds.length > 0) return;
3078
3140
  let n = this.#N().viewport;
3079
3141
  if (n.x != e.viewport.x || n.y != e.viewport.y || n.zoom != e.viewport.zoom || t.draft == null) return;
3080
- let r = s(t.draft), i = [...e.targets].filter((t) => r.selection(e.target, t) != null);
3142
+ let r = f(t.draft), i = [...e.targets].filter((t) => r.selection(e.target, t) != null);
3081
3143
  i.length == 1 && this.#z({ nodeFocus: {
3082
3144
  nodeId: i[0],
3083
3145
  requestId: ++this.#y
@@ -3091,7 +3153,7 @@ var Ot = class {
3091
3153
  }
3092
3154
  #N() {
3093
3155
  let e = this.#l.value;
3094
- return v(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
3156
+ return _(e.draft, e.target, e.presentation?.value, e.diagnostics?.diagnostics, {}, {}, this.#r.t);
3095
3157
  }
3096
3158
  #P() {
3097
3159
  let e = this.#l.value.moduleEditor;
@@ -3101,7 +3163,7 @@ var Ot = class {
3101
3163
  }), !1);
3102
3164
  }
3103
3165
  #F(e, t, n) {
3104
- let r = s(e), i = Dt(r, t, n, this.#l.value.target);
3166
+ let r = f(e), i = Et(r, t, n, this.#l.value.target);
3105
3167
  return {
3106
3168
  revision: r,
3107
3169
  selectedNodeIds: this.#l.value.selectedNodeIds.filter((e) => i != null && r.selection(i, e) != null),
@@ -3139,13 +3201,13 @@ var Ot = class {
3139
3201
  };
3140
3202
  //#endregion
3141
3203
  //#region src/workbench/browser/runtime/stores/workbenchStore.ts
3142
- function kt(e) {
3204
+ function Ot(e) {
3143
3205
  return new Map(e.nodes.map((e) => [e.id, e]));
3144
3206
  }
3145
- function At(e, t) {
3146
- return e == null || t == null ? [] : s(e).designerInputs(t);
3207
+ function kt(e, t) {
3208
+ return e == null || t == null ? [] : f(e).designerInputs(t);
3147
3209
  }
3148
- function jt(e, t, n, r, i) {
3210
+ function At(e, t, n, r, i) {
3149
3211
  if (e == null || t?.kind != "flow" || n?.revisionId != e.revisionId || n.flowId != t.id) return /* @__PURE__ */ new Map();
3150
3212
  let a = r.find((e) => e.kind == "run.started" && e.payload.flowId == t.id)?.payload.scopeId;
3151
3213
  return typeof a == "string" ? new Map(r.flatMap((e) => {
@@ -3153,43 +3215,43 @@ function jt(e, t, n, r, i) {
3153
3215
  return e.payload.scopeId == a && e.payload.flowId == t.id && typeof n == "string" && i.has(n) ? [[e.sequence, n]] : [];
3154
3216
  })) : /* @__PURE__ */ new Map();
3155
3217
  }
3156
- var Mt = {
3218
+ var jt = {
3157
3219
  openExternalPage: async () => !1,
3158
3220
  returnUrl: ""
3159
- }, Nt = class {
3221
+ }, Mt = class {
3160
3222
  #e;
3161
3223
  #t;
3162
3224
  #n;
3163
3225
  #r;
3164
- constructor(e, t, n = () => crypto.randomUUID(), o = l(), s = Mt) {
3165
- this.#e = new p(), this.#n = r(), this.#r = !1, this.provideAddNodeOptions = async (e, t) => await this.#i([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => await this.#i([this.triggers.browseAddNodeOptions(e), this.connectors.browseAddNodeOptions(e)], e), this.provideAddNodeOptionChoices = async (e, t) => await (e.startsWith("trigger:") ? this.triggers.provideAddNodeOptionChoices(e, t) : this.connectors.provideAddNodeOptionChoices(e, t)), this.#t = o;
3226
+ constructor(r, i, a = () => crypto.randomUUID(), o = y(), s = jt) {
3227
+ this.#e = new S(), this.#n = t(), this.#r = !1, this.provideAddNodeOptions = async (e, t) => await this.#i([this.triggers.provideAddNodeOptions(e, t), this.connectors.provideAddNodeOptions(e, t)], t), this.browseAddNodeOptions = async (e) => await this.#i([this.triggers.browseAddNodeOptions(e), this.connectors.browseAddNodeOptions(e)], e), this.provideAddNodeOptionChoices = async (e, t) => await (e.startsWith("trigger:") ? this.triggers.provideAddNodeOptionChoices(e, t) : this.connectors.provideAddNodeOptionChoices(e, t)), this.#t = o;
3166
3228
  let c = (e) => {
3167
3229
  this.#r || this.#n.set(e);
3168
3230
  };
3169
- this.runs = new _(e, c, o), this.workspace = new Ot(e, c, n, o, (t) => void this.#a(e, t)), this.connectors = new be(e, this.workspace, c, s, o), this.triggers = new Se(e, this.workspace, c, s, o), this.publications = new pe(e, this.workspace, c, n, o), this.runRequests = new _e(e, this.runs, c, o, n);
3170
- let u = /* @__PURE__ */ new Map(), d, f = i((e) => {
3231
+ this.runs = new h(r, c, o), this.workspace = new Dt(r, c, a, o, (e) => void this.#a(r, e)), this.connectors = new be(r, this.workspace, c, s, o), this.triggers = new Ce(r, this.workspace, c, s, o), this.publications = new fe(r, this.workspace, c, a, o), this.runRequests = new ge(r, this.runs, c, o, a);
3232
+ let l = /* @__PURE__ */ new Map(), u, d = n((e) => {
3171
3233
  let t = e(this.workspace.$.draft);
3172
- d != t?.projectId && (u.clear(), d = t?.projectId);
3173
- let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), l = e(this.runs.$.run), f = e(this.runs.$.events), p = n == null ? "" : `${n.kind}:${n.id}`, m = [
3174
- ...At(t, n),
3175
- r == null || n == null ? void 0 : y(r, n),
3234
+ u != t?.projectId && (l.clear(), u = t?.projectId);
3235
+ let n = e(this.workspace.$.target), r = e(this.workspace.$.presentation)?.value, i = e(this.workspace.$.diagnostics)?.diagnostics, a = e(this.connectors.$.actions), s = e(this.connectors.$.catalogs), c = e(o.t$), d = e(this.runs.$.run), f = e(this.runs.$.events), p = n == null ? "" : `${n.kind}:${n.id}`, m = [
3236
+ ...kt(t, n),
3237
+ r == null || n == null ? void 0 : v(r, n),
3176
3238
  i,
3177
3239
  a,
3178
3240
  s,
3179
3241
  c,
3180
- l,
3242
+ d,
3181
3243
  f,
3182
- ...l == null ? [] : [t?.revisionId]
3183
- ], h = u.get(p);
3244
+ ...d == null ? [] : [t?.revisionId]
3245
+ ], h = l.get(p);
3184
3246
  if (h != null && h.inputs.length == m.length && h.inputs.every((e, t) => e === m[t])) return h.graph;
3185
- let g = v(t, n, r, i, a, s, c, l, f);
3186
- return u.set(p, {
3247
+ let g = _(t, n, r, i, a, s, c, d, f);
3248
+ return l.set(p, {
3187
3249
  graph: g,
3188
3250
  inputs: m
3189
3251
  }), g;
3190
- }), m = a(f, kt);
3252
+ }), f = e(d, Ot);
3191
3253
  this.$ = {
3192
- busy: i((e) => {
3254
+ busy: n((e) => {
3193
3255
  let t = e(this.workspace.$.busy);
3194
3256
  if (t != null) return t;
3195
3257
  if (e(this.runRequests.$.starting)) return "run";
@@ -3198,13 +3260,13 @@ var Mt = {
3198
3260
  if (e(this.publications.$.rollingBackPublicationId) != null) return "rollback";
3199
3261
  if (e(this.publications.$.changingTriggerId) != null) return "trigger";
3200
3262
  }),
3201
- designer: f,
3202
- designerNodeById: m,
3263
+ designer: d,
3264
+ designerNodeById: f,
3203
3265
  notice: this.#n,
3204
- runEventNodes: i((e) => jt(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(m))),
3205
- selectedDesignerNode: i((e) => {
3266
+ runEventNodes: n((e) => At(e(this.workspace.$.draft), e(this.workspace.$.target), e(this.runs.$.run), e(this.runs.$.events), e(f))),
3267
+ selectedDesignerNode: n((e) => {
3206
3268
  let t = e(this.workspace.$.selectedNodeIds);
3207
- return t.length == 1 ? e(m).get(t[0]) : void 0;
3269
+ return t.length == 1 ? e(f).get(t[0]) : void 0;
3208
3270
  })
3209
3271
  };
3210
3272
  }
@@ -3277,51 +3339,62 @@ var Mt = {
3277
3339
  return;
3278
3340
  }
3279
3341
  }
3280
- }, Pt = ae(() => import("./flowWorkspace-DwVMpcar.js"));
3281
- function Ft({ host: e, store: t }) {
3282
- let r = n(t.$.notice);
3283
- return C(() => e.notify(r), [e, r]), C(() => () => e.notify(void 0), [e]), null;
3342
+ }, Nt = ie(() => import("./flowWorkspace-CRRe__mi.js"));
3343
+ function Pt({ host: e, store: t }) {
3344
+ let n = a(t.$.notice);
3345
+ return C(() => e.notify(n), [e, n]), C(() => () => e.notify(void 0), [e]), null;
3284
3346
  }
3285
- function It({ language: e, navigation: t, onLanguageChange: r, store: i, theme: a }) {
3286
- let o = n(i.workspace.$.projectId), s = n(i.workspace.$.target);
3347
+ function Ft({ hrefFor: e, language: t, navigation: n, onLanguageChange: r, store: i, theme: o }) {
3348
+ let s = a(i.workspace.$.projectId), c = a(i.workspace.$.target);
3287
3349
  return /* @__PURE__ */ w("div", {
3288
3350
  className: "app-shell",
3289
- children: o == null ? /* @__PURE__ */ w(b, {
3290
- language: e,
3291
- onCreateProject: (e) => t.createProject(e),
3351
+ children: s == null ? /* @__PURE__ */ w(te, {
3352
+ hrefForProject: (t) => e({
3353
+ projectId: t,
3354
+ view: "design"
3355
+ }),
3356
+ language: t,
3357
+ onCreateProject: (e) => n.createProject(e),
3292
3358
  onLanguageChange: r,
3293
- onSelectProject: (e) => void t.selectProject(e),
3359
+ onSelectProject: (e) => void n.selectProject(e),
3294
3360
  store: i
3295
- }) : s == null ? /* @__PURE__ */ w(ne, {
3296
- language: e,
3297
- onCreateFlow: (e) => t.createFlow(e),
3361
+ }) : c == null ? /* @__PURE__ */ w(ne, {
3362
+ hrefForFlow: (t) => e({
3363
+ flowId: t.flowId,
3364
+ projectId: s,
3365
+ view: t.draft == null ? "publications" : "design"
3366
+ }),
3367
+ language: t,
3368
+ onCreateFlow: (e) => n.createFlow(e),
3298
3369
  onLanguageChange: r,
3299
- onOpenProjects: () => void t.openProjects(),
3300
- onSelectFlow: (e) => t.selectFlow(e),
3370
+ onOpenProjects: () => void n.openProjects(),
3371
+ onSelectFlow: (e) => n.selectFlow(e),
3372
+ projectsHref: e({ view: "design" }),
3301
3373
  store: i
3302
- }) : /* @__PURE__ */ w(ie, {
3374
+ }) : /* @__PURE__ */ w(re, {
3303
3375
  fallback: /* @__PURE__ */ w("main", {
3304
3376
  "aria-busy": "true",
3305
3377
  className: "workspace"
3306
3378
  }),
3307
- children: /* @__PURE__ */ w(Pt, {
3308
- language: e,
3309
- navigation: t,
3379
+ children: /* @__PURE__ */ w(Nt, {
3380
+ hrefFor: e,
3381
+ language: t,
3382
+ navigation: n,
3310
3383
  onLanguageChange: r,
3311
3384
  store: i,
3312
- theme: a
3385
+ theme: o
3313
3386
  })
3314
3387
  })
3315
3388
  });
3316
3389
  }
3317
- function Lt({ host: t, language: n, location: r, onLanguageChange: i, onNavigate: a, preferences: o, theme: s }) {
3318
- let c = oe(a);
3319
- c.current = a;
3320
- let [{ i18n: u, navigation: d, store: f }] = se(() => {
3321
- let e = l(n), i = new Nt(new re((e, n) => t.request(e, n), (e, n) => t.subscribeProject(e, n)), o, () => crypto.randomUUID(), e, t);
3390
+ function It({ host: e, hrefFor: t, language: n, location: r, onLanguageChange: a, onNavigate: o, preferences: s, theme: c }) {
3391
+ let l = ae(o);
3392
+ l.current = o;
3393
+ let [{ i18n: u, navigation: d, store: f }] = oe(() => {
3394
+ let t = y(n), i = new Mt(new ee((t, n) => e.request(t, n), (t, n) => e.subscribeProject(t, n)), s, () => crypto.randomUUID(), t, e);
3322
3395
  return {
3323
- i18n: e,
3324
- navigation: new ue(i, r, (e, t) => c.current(e, t)),
3396
+ i18n: t,
3397
+ navigation: new le(i, r, (e, t) => l.current(e, t)),
3325
3398
  store: i
3326
3399
  };
3327
3400
  });
@@ -3339,26 +3412,27 @@ function Lt({ host: t, language: n, location: r, onLanguageChange: i, onNavigate
3339
3412
  f
3340
3413
  ]), C(() => void d.apply(r), [r, d]), C(() => {
3341
3414
  u.lang != n && u.switchLang(n);
3342
- }, [u, n]), /* @__PURE__ */ w(e, {
3415
+ }, [u, n]), /* @__PURE__ */ w(i, {
3343
3416
  i18n: u,
3344
- children: /* @__PURE__ */ ce("div", {
3417
+ children: /* @__PURE__ */ se("div", {
3345
3418
  className: "open-flow-workbench",
3346
- "data-theme": s,
3347
- children: [/* @__PURE__ */ w(Ft, {
3348
- host: t,
3419
+ "data-theme": c,
3420
+ children: [/* @__PURE__ */ w(Pt, {
3421
+ host: e,
3349
3422
  store: f
3350
- }), /* @__PURE__ */ w(It, {
3423
+ }), /* @__PURE__ */ w(Ft, {
3424
+ hrefFor: t,
3351
3425
  language: n,
3352
3426
  navigation: d,
3353
- onLanguageChange: i,
3427
+ onLanguageChange: a,
3354
3428
  store: f,
3355
- theme: s
3429
+ theme: c
3356
3430
  })]
3357
3431
  })
3358
3432
  });
3359
3433
  }
3360
- function Rt({ sessionKey: e, ...t }) {
3361
- return /* @__PURE__ */ w(Lt, { ...t }, e);
3434
+ function Lt({ sessionKey: e, ...t }) {
3435
+ return /* @__PURE__ */ w(It, { ...t }, e);
3362
3436
  }
3363
3437
  //#endregion
3364
- export { Rt as OpenFlowWorkbench };
3438
+ export { Lt as OpenFlowWorkbench };