@w6w/embed 0.2.31 → 0.2.33

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,1140 +0,0 @@
1
- import { jsxs as y, jsx as l, Fragment as le } from "react/jsx-runtime";
2
- import { useQueryClient as Mt, useQueries as Pe } from "@tanstack/react-query";
3
- import { ApiError as Ae } from "@w6w/sdk";
4
- import { Modal as yn, IconButton as ce, JsonEditor as vn, useExpressionOptions as wn, ExpressionEditorModal as Sn, useW6WApi as Jt, W6WUIProvider as kn, isTestRequired as At, requiredParamsFilled as Nn, ExecutionLogPanel as Rn, testInputSavesSettled as En } from "@w6w/ui";
5
- import { useState as v, useMemo as w, createElement as J, useId as Cn, useCallback as R, useContext as Pn, useRef as S, useEffect as j, Suspense as An, lazy as jn } from "react";
6
- import { E as On, $ as Tn, W as In, Q as Fn, V as Ln, q as Mn, X as Jn, v as Dn, B as Bn, A as Wn, N as $n, a as xn, z as Kn, n as Qn, y as _n, t as qn, b as Hn } from "./workflows-Dz8LMjnt.js";
7
- import { H as Vn, a as zn } from "./editor-apps-HEOclsxL.js";
8
- import { M as ue } from "./ConfirmModal-WqBfWftD.js";
9
- import { d as Gn, W as Yn, e as Un, R as Xn, P as Zn, b as es, c as ts } from "./editor-tools-Ch1cAE4F.js";
10
- import { u as ns } from "./client-context-CX61Bgw-.js";
11
- import { u as ss } from "./use-workflow-draft-l3P5KZzw.js";
12
- import { r as os, h as is, e as rs, f as as, a as ls, d as cs, b as us, p as ds, i as fs, g as ps } from "./setup-incomplete-BHs3Lpfy.js";
13
- import { g as jt, r as hs, c as ms, v as bs } from "./document-sources-Khcw2zB5.js";
14
- import { n as Ot } from "./import-bindings-EUtxZ9Ti.js";
15
- import { p as gs, d as ys } from "./settings-rail-BjsTjg2u.js";
16
- import { u as vs, b as ws } from "./project-context-Tvp-La7A.js";
17
- import { i as Ss, d as Tt } from "./connections-CzsCyIxY.js";
18
- import { r as ks, m as Ns, q as Rs, n as Es, o as Cs } from "./spec-import-CGPqUUjN.js";
19
- import { l as It, a as je, w as Ps } from "./step-tests-B4E4W3ly.js";
20
- import { u as As } from "./spec-export-BtnoV0ex.js";
21
- import { i as js, f as Os } from "./vault-BSEWhMYC.js";
22
- import { i as Ts } from "./data-stores-UeQvwVCa.js";
23
- import { e as Is } from "./apps-FMcQfyL2.js";
24
- import { E as Fs } from "./theme-context-E2ZhlXDX.js";
25
- import { validateInitialState as Ls } from "@w6w/expr";
26
- function Ms({ title: n }) {
27
- const { value: e, placeholder: o, maxLength: s, ariaLabel: r, onChange: a, onBlur: u } = n;
28
- return /* @__PURE__ */ l(
29
- "input",
30
- {
31
- className: "wf-title-input",
32
- value: e,
33
- placeholder: o,
34
- maxLength: s,
35
- size: Math.min(Math.max(e.length, o.length), 80),
36
- "aria-label": r,
37
- onChange: (d) => a(d.target.value),
38
- onBlur: u
39
- }
40
- );
41
- }
42
- function Js({
43
- onBack: n,
44
- backLabel: e,
45
- title: o,
46
- titleAdornment: s,
47
- actions: r
48
- }) {
49
- return /* @__PURE__ */ y("div", { className: "wf-fullbleed-head", children: [
50
- e !== null && /* @__PURE__ */ l(
51
- "button",
52
- {
53
- type: "button",
54
- className: "muted wf-back-btn",
55
- "data-testid": "wf-editor-back",
56
- onClick: n,
57
- children: e
58
- }
59
- ),
60
- o.editable ? /* @__PURE__ */ l(Ms, { title: o }) : /* @__PURE__ */ y("h2", { className: "exec-profile-title", children: [
61
- o.value,
62
- " ",
63
- s
64
- ] }),
65
- /* @__PURE__ */ y("div", { className: "wf-head-actions", style: { marginLeft: "auto" }, children: [
66
- o.editable && s,
67
- r
68
- ] })
69
- ] });
70
- }
71
- function Ds(n, e, o) {
72
- if (!(n !== "workflow" || e === void 0))
73
- return (s) => {
74
- o(), e(s.id);
75
- };
76
- }
77
- function Bs(n) {
78
- const { kind: e, id: o, onClose: s, onOpenRun: r } = n, [a, u] = v(On), d = Ds(e, r, s);
79
- return /* @__PURE__ */ l(
80
- yn,
81
- {
82
- size: "full",
83
- title: "History",
84
- subtitle: o,
85
- onClose: s,
86
- headerRight: /* @__PURE__ */ l(ce, { icon: "close", label: "Close", onClick: s }),
87
- children: /* @__PURE__ */ l("div", { className: "w6w-modal-body", children: /* @__PURE__ */ l(
88
- Vn,
89
- {
90
- scope: { callable: o },
91
- showKind: !1,
92
- filters: a,
93
- onFiltersChange: u,
94
- onOpenInEditor: d
95
- }
96
- ) })
97
- }
98
- );
99
- }
100
- function Ws(n) {
101
- return /* @__PURE__ */ l(ce, { icon: "json", onClick: n.onClick, label: "Edit raw JSON definition" });
102
- }
103
- function $s(n) {
104
- return n.open ? n.mode === "apply" ? /* @__PURE__ */ l(xs, { ...n }) : /* @__PURE__ */ l(Ks, { ...n }) : null;
105
- }
106
- function Dt(n) {
107
- return /* @__PURE__ */ l("div", { className: "json-toggle-editor", children: /* @__PURE__ */ l(
108
- vn,
109
- {
110
- value: n.value,
111
- onChange: n.onChange,
112
- minHeight: "120px",
113
- "aria-label": n.label
114
- }
115
- ) });
116
- }
117
- function xs(n) {
118
- const { onClose: e, title: o, value: s, prepareApply: r, onApply: a, editorLabel: u } = n, [d, m] = v(s), [h, b] = v(s), [O, z] = v([]), [fe, I] = v(!1), C = w(
119
- () => (r == null ? void 0 : r(d)) ?? { ok: !0, text: d, restored: [] },
120
- [r, d]
121
- ), D = d !== h, G = () => D ? I(!0) : e(), Y = () => {
122
- !C.ok || !D || (a == null || a(C.text), m(C.text), b(C.text), z(C.restored), I(!1));
123
- };
124
- return /* @__PURE__ */ y(ue, { title: o, onClose: G, wide: !0, className: "modal-json", children: [
125
- /* @__PURE__ */ y("div", { className: "modal-body", children: [
126
- /* @__PURE__ */ y("p", { className: "muted small", children: [
127
- "Edit the raw definition (",
128
- /* @__PURE__ */ l("code", { children: 'manifestVersion: "2"' }),
129
- "). Apply updates the visual editor; Save stores it."
130
- ] }),
131
- /* @__PURE__ */ l(
132
- Dt,
133
- {
134
- value: d,
135
- onChange: (U) => {
136
- m(U), I(!1);
137
- },
138
- label: u
139
- }
140
- ),
141
- !C.ok && /* @__PURE__ */ l("p", { className: "error small", role: "alert", "data-testid": "json-toggle-error", children: C.error }),
142
- O.length > 0 && /* @__PURE__ */ y("p", { className: "muted small", "data-testid": "json-toggle-restored", children: [
143
- "Restored ",
144
- O.join(", "),
145
- ": ",
146
- O.length > 1 ? "these fields" : "this field",
147
- " ",
148
- "can't be changed in JSON."
149
- ] })
150
- ] }),
151
- /* @__PURE__ */ l("div", { className: "modal-actions", children: fe ? /* @__PURE__ */ y(le, { children: [
152
- /* @__PURE__ */ l("span", { className: "muted small json-toggle-confirm", children: "Discard unapplied changes?" }),
153
- /* @__PURE__ */ l("button", { type: "button", className: "btn ghost", onClick: () => I(!1), children: "Keep editing" }),
154
- /* @__PURE__ */ l(
155
- "button",
156
- {
157
- type: "button",
158
- className: "btn danger",
159
- "data-testid": "json-toggle-discard",
160
- onClick: e,
161
- children: "Discard"
162
- }
163
- )
164
- ] }) : /* @__PURE__ */ y(le, { children: [
165
- /* @__PURE__ */ l(
166
- "button",
167
- {
168
- type: "button",
169
- className: "btn ghost",
170
- "data-testid": "json-toggle-close",
171
- onClick: G,
172
- children: "Close"
173
- }
174
- ),
175
- /* @__PURE__ */ l(
176
- "button",
177
- {
178
- type: "button",
179
- className: "btn",
180
- "data-testid": "json-toggle-apply",
181
- disabled: !C.ok || !D,
182
- onClick: Y,
183
- children: "Apply"
184
- }
185
- )
186
- ] }) })
187
- ] });
188
- }
189
- function Ks(n) {
190
- const { onClose: e, title: o, value: s, onChange: r, guard: a, onSave: u, saving: d, error: m, editorLabel: h } = n, b = (a == null ? void 0 : a(s)) ?? null;
191
- return /* @__PURE__ */ y(ue, { title: o, onClose: e, wide: !0, className: "modal-json", children: [
192
- /* @__PURE__ */ y("div", { className: "modal-body", children: [
193
- /* @__PURE__ */ l("p", { className: "muted small", children: "Save replaces the stored definition." }),
194
- /* @__PURE__ */ l(Dt, { value: s, onChange: (O) => r == null ? void 0 : r(O), label: h }),
195
- b && /* @__PURE__ */ l("p", { className: "muted small", "data-testid": "json-toggle-reason", children: b }),
196
- m && /* @__PURE__ */ l("div", { className: "error", children: m })
197
- ] }),
198
- /* @__PURE__ */ y("div", { className: "modal-actions", children: [
199
- /* @__PURE__ */ l("button", { type: "button", className: "btn ghost", onClick: e, children: "Cancel" }),
200
- /* @__PURE__ */ l(
201
- "button",
202
- {
203
- type: "button",
204
- className: "btn",
205
- "data-testid": "json-toggle-save",
206
- disabled: b != null || !!d,
207
- onClick: u,
208
- children: d ? "Saving…" : "Save"
209
- }
210
- )
211
- ] })
212
- ] });
213
- }
214
- function Ft(n, e, o = {}) {
215
- const s = (a) => Array.isArray(a) ? a.map(s) : a !== null && typeof a == "object" ? Object.fromEntries(
216
- Object.entries(a).sort(([u], [d]) => u.localeCompare(d)).map(([u, d]) => [u, s(d)])
217
- ) : a, r = (a) => {
218
- if (!de(a)) return a;
219
- const { status: u, ...d } = a, m = { ...d, key: d.key ?? null, tags: d.tags ?? [] };
220
- return o.presentation ? m : Qs(m);
221
- };
222
- return JSON.stringify(s(r(n))) === JSON.stringify(s(r(e)));
223
- }
224
- const de = (n) => n !== null && typeof n == "object" && !Array.isArray(n), Bt = (n, e) => {
225
- if (!de(n)) return n;
226
- const o = { ...n };
227
- for (const s of e) delete o[s];
228
- return o;
229
- }, Lt = (n, e) => Array.isArray(n) ? n.map((o) => Bt(o, e)) : n;
230
- function Qs(n) {
231
- const e = { ...n };
232
- for (const o of ["nodes", "steps"])
233
- o in e && (e[o] = Lt(e[o], ["position"]));
234
- if (de(e.settings)) {
235
- const o = Bt(e.settings, ["viewport", "autoSave", "savePosition"]);
236
- e.settings = Object.keys(o).length === 0 ? void 0 : o;
237
- }
238
- if (de(e.canvas)) {
239
- const o = { ...e.canvas };
240
- for (const s of ["notes", "sections"])
241
- s in o && (o[s] = Lt(o[s], ["position", "size"]));
242
- e.canvas = o;
243
- }
244
- return e;
245
- }
246
- function _s(n) {
247
- const { kind: e, problemCount: o, canEnable: s, onEnable: r, pending: a } = n, u = o > 0 ? `This ${e} is disabled and ${o} ${o === 1 ? "step uses" : "steps use"} a connection that no longer exists. Choose another connection, save, then Enable.` : "Connections fixed. Enable to run again.";
248
- return J(
249
- "div",
250
- { role: "alert", className: "error", "data-testid": "binding-disabled-banner" },
251
- J("span", null, u),
252
- " ",
253
- J(
254
- "button",
255
- {
256
- type: "button",
257
- "data-testid": "binding-enable",
258
- disabled: !s || a === !0,
259
- onClick: r
260
- },
261
- "Enable"
262
- )
263
- );
264
- }
265
- function qs({
266
- project: n,
267
- onNavigate: e,
268
- rail: o = !0,
269
- storageKey: s,
270
- tools: r = Un,
271
- children: a
272
- }) {
273
- const u = Gn(), d = /* @__PURE__ */ l(Xn, { project: n, onNavigate: e, children: /* @__PURE__ */ y(Zn, { project: n, children: [
274
- a,
275
- o && /* @__PURE__ */ l(es, { tools: r, storageKey: s })
276
- ] }) });
277
- return o || !u ? /* @__PURE__ */ l(Yn, { children: d }) : d;
278
- }
279
- function Hs({
280
- message: n,
281
- disabled: e = !1,
282
- children: o
283
- }) {
284
- const s = Cn(), [r, a] = v(!1);
285
- return /* @__PURE__ */ y(
286
- "fieldset",
287
- {
288
- className: "wf-publish-tooltip",
289
- "aria-label": "Publish workflow",
290
- "aria-describedby": s,
291
- tabIndex: e ? 0 : void 0,
292
- onMouseEnter: () => a(!0),
293
- onMouseLeave: () => a(!1),
294
- onFocus: () => a(!0),
295
- onBlur: (u) => {
296
- u.currentTarget.contains(u.relatedTarget) || a(!1);
297
- },
298
- onKeyDown: (u) => {
299
- u.key === "Escape" && a(!1);
300
- },
301
- children: [
302
- o(s),
303
- r && /* @__PURE__ */ l("span", { id: s, role: "tooltip", className: "wf-publish-hint", children: n })
304
- ]
305
- }
306
- );
307
- }
308
- function Vs(n) {
309
- const { problems: e, nodeLabel: o } = n, s = Object.entries(e).filter(([, a]) => a.length > 0);
310
- if (s.length === 0) return null;
311
- const r = s.length;
312
- return J(
313
- "div",
314
- { role: "status", className: "error", "data-testid": "setup-incomplete-banner" },
315
- J(
316
- "span",
317
- null,
318
- `Setup incomplete: ${r} ${r === 1 ? "step needs" : "steps need"} attention. The workflow can still run.`
319
- ),
320
- J(
321
- "ul",
322
- { "data-testid": "setup-incomplete-list" },
323
- ...s.map(
324
- ([a, u]) => J("li", { key: a }, `${o ? o(a) : a}: ${u.join(", ")}`)
325
- )
326
- )
327
- );
328
- }
329
- const zs = {
330
- invalid_json: "This isn't valid JSON yet, so it isn't saved. Fix it to save.",
331
- not_object: 'Starting state must be a JSON object, like {"region": "us"}. Not saved.',
332
- too_large: "Starting state is over the 64 KiB limit. Not saved."
333
- };
334
- function Gs(n) {
335
- const e = wn();
336
- return /* @__PURE__ */ l(
337
- Sn,
338
- {
339
- mode: "json-binding",
340
- startingState: !0,
341
- title: "Starting state",
342
- fieldLabel: "initialState",
343
- value: void 0,
344
- options: e,
345
- jsonValue: n.initialState,
346
- jsonProblem: (o) => {
347
- const s = jt(o);
348
- if (!s.ok) return zs[s.reason];
349
- const r = s.value === void 0 ? void 0 : Ls(s.value)[0];
350
- return r ? `${r.message} Not saved.` : null;
351
- },
352
- onSaveJson: (o) => {
353
- const s = jt(o === void 0 ? "" : JSON.stringify(o));
354
- s.ok && n.onChange(s.value);
355
- },
356
- onClose: n.onClose
357
- }
358
- );
359
- }
360
- const Wt = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, Ys = "Untitled workflow", Us = ["id", "key", "manifestVersion"];
361
- function Xs(n) {
362
- let e = 0;
363
- const o = () => {
364
- for (; e < n.length && `
365
- \r`.includes(n[e]); ) e++;
366
- }, s = () => {
367
- throw e;
368
- }, r = (h) => {
369
- for (const b of h)
370
- n[e] !== b && s(), e++;
371
- }, a = () => {
372
- for (e++; n[e] !== '"'; ) {
373
- const h = n[e];
374
- if ((h === void 0 || h < " ") && s(), h === "\\")
375
- if (e++, n[e] === "u")
376
- for (let b = 0; b < 4; b++)
377
- e++, /[0-9a-fA-F]/.test(n[e] ?? "") || s();
378
- else '"\\/bfnrt'.includes(n[e] ?? "x") || s();
379
- e++;
380
- }
381
- e++;
382
- }, u = /-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/y, d = () => {
383
- u.lastIndex = e, u.test(n) || s(), e = u.lastIndex;
384
- }, m = () => {
385
- o();
386
- const h = n[e];
387
- if (h === "{" || h === "[") {
388
- const b = h === "{" ? "}" : "]";
389
- if (e++, o(), n[e] === b) {
390
- e++;
391
- return;
392
- }
393
- for (; ; )
394
- if (b === "}" && (o(), n[e] !== '"' && s(), a(), o(), n[e] !== ":" && s(), e++), m(), o(), n[e] === ",") e++;
395
- else if (n[e] === b) {
396
- e++;
397
- return;
398
- } else s();
399
- }
400
- h === '"' ? a() : h === "t" ? r("true") : h === "f" ? r("false") : h === "n" ? r("null") : d();
401
- };
402
- try {
403
- return m(), o(), e < n.length ? e : null;
404
- } catch (h) {
405
- return typeof h == "number" ? Math.min(h, n.length) : 0;
406
- }
407
- }
408
- function Zs(n, e) {
409
- const o = e instanceof Error ? e.message : String(e), s = Xs(n);
410
- if (s === null) return o;
411
- const r = n.slice(0, s), a = r.split(`
412
- `).length, u = s - r.lastIndexOf(`
413
- `);
414
- return `Line ${a}, column ${u}: ${o}`;
415
- }
416
- const ae = (n) => typeof n == "object" && n !== null && !Array.isArray(n);
417
- function eo(n) {
418
- if (typeof n.name != "string" || n.name.length === 0) return "`name` is required.";
419
- const e = n.nodes ?? n.steps;
420
- if (!Array.isArray(e)) return "`nodes` must be an array.";
421
- const o = /* @__PURE__ */ new Set();
422
- for (let s = 0; s < e.length; s++) {
423
- const r = e[s];
424
- if (!ae(r)) return `\`nodes[${s}]\` must be an object.`;
425
- if (typeof r.id != "string" || r.id.length === 0)
426
- return `\`nodes[${s}].id\` must be a non-empty string.`;
427
- if (r.id.includes(".")) return `Node id "${r.id}" may not contain ".".`;
428
- if (o.has(r.id)) return `Node id "${r.id}" is used twice.`;
429
- o.add(r.id);
430
- const a = r.position;
431
- if (a !== void 0 && (!ae(a) || !Number.isFinite(a.x) || !Number.isFinite(a.y)))
432
- return `\`nodes[${s}].position\` must be { "x": number, "y": number }.`;
433
- }
434
- if (n.edges !== void 0) {
435
- if (!Array.isArray(n.edges)) return "`edges` must be an array.";
436
- for (let s = 0; s < n.edges.length; s++) {
437
- const r = n.edges[s];
438
- if (!ae(r)) return `\`edges[${s}]\` must be an object.`;
439
- for (const a of ["from", "to"])
440
- if (typeof r[a] != "string" || !o.has(r[a]))
441
- return `\`edges[${s}].${a}\` does not name an existing node.`;
442
- }
443
- }
444
- return null;
445
- }
446
- function to(n, e) {
447
- let o;
448
- try {
449
- o = JSON.parse(n);
450
- } catch (d) {
451
- return { ok: !1, error: Zs(n, d) };
452
- }
453
- if (!ae(o)) return { ok: !1, error: "The definition must be a JSON object." };
454
- const s = [];
455
- let r = o;
456
- const a = {};
457
- if (e) {
458
- for (const d of Us) {
459
- const m = Object.hasOwn(e, d), h = Object.hasOwn(r, d);
460
- if (!(m === h && JSON.stringify(e[d]) === JSON.stringify(r[d])))
461
- if (s.push(d), m)
462
- h ? r = { ...r, [d]: e[d] } : a[d] = e[d];
463
- else {
464
- const { [d]: b, ...O } = r;
465
- r = O;
466
- }
467
- }
468
- r = { ...a, ...r };
469
- }
470
- if (typeof r.id == "string" && !Wt.test(r.id))
471
- return { ok: !1, error: "Invalid workflow id." };
472
- const u = eo(r);
473
- return u !== null ? { ok: !1, error: u } : { ok: !0, text: s.length > 0 ? JSON.stringify(r, null, 2) : n, restored: s };
474
- }
475
- function no(n, e, o, s) {
476
- const r = {};
477
- for (const a of n) {
478
- const u = { code: a.code, connection: a.connection };
479
- r[a.siteId] = [...Object.hasOwn(r, a.siteId) ? r[a.siteId] : [], u];
480
- }
481
- for (const a of [e, o, s])
482
- for (const [u, d] of Object.entries(a ?? {}))
483
- d.length > 0 && (r[u] = [...Object.hasOwn(r, u) ? r[u] : [], ...d]);
484
- return r;
485
- }
486
- const so = jn(
487
- () => import("@w6w/ui/flow").then((n) => ({ default: n.WorkflowFlowEditor }))
488
- );
489
- function oo(n) {
490
- var St, kt, Nt, Rt, Et, Ct;
491
- const { workflowId: e, project: o, projectPending: s, initialRunId: r, onNavigate: a, slots: u } = n, d = ns(), m = Jt(), [h, b] = v(null), [O, z] = v(!1), [fe, I] = v(0), [C, D] = v(!1), [G, Y] = v(!1), [U, Oe] = v(!1), [X, Te] = v(void 0), Ie = S(!0), Fe = S(() => null), $t = R(
492
- (t) => {
493
- const i = t;
494
- return Wt.test(typeof i.id == "string" ? i.id : "") ? Ot(X, i.key).reason : "Invalid workflow id.";
495
- },
496
- [X]
497
- ), f = ss({
498
- workflowId: e,
499
- project: o,
500
- autoSave: Ie.current,
501
- // The expression editor holds uncommitted parts in its own local state until its Save
502
- // button, so saving from under it would persist a workflow without the expression the user
503
- // is looking at. Read at fire time (opening it changes neither the buffer nor `canSave`).
504
- canAutoSave: () => !document.querySelector(".w6w-exprmodal"),
505
- saveGuard: $t,
506
- publishBlockedReason: (t) => Fe.current(t)
507
- }), Le = f.json, c = f.parsed, B = f.canSave, xt = f.dirty;
508
- j(() => {
509
- if (f.loading || f.loadError !== null) {
510
- Te(void 0);
511
- return;
512
- }
513
- !f.dirty && c && Te(c.key ?? null);
514
- }, [f.loading, f.loadError, f.dirty, c]);
515
- const [Kt, pe] = v(!1);
516
- j(() => {
517
- f.stale || pe(!1);
518
- }, [f.stale]);
519
- const [Qt, Me] = v(!1), Je = S(!1);
520
- j(() => {
521
- f.saving ? Me(!1) : Je.current && f.error === null && Me(!0), Je.current = f.saving;
522
- }, [f.saving, f.error]);
523
- const [T, N] = v(null), De = Tn(), Be = In(), We = Fn(), P = Ln(T), Q = (St = P.data) == null ? void 0 : St.status, $e = P.isError, Z = Mn(Q, $e), _t = Jn(T, Q), xe = Dn(
524
- Bn(P.data),
525
- (kt = _t.data) == null ? void 0 : kt.writes
526
- ), Ke = Wn(P.data, xe), he = S(!1), [qt, Qe] = v(!1);
527
- j(() => {
528
- N(null);
529
- }, [e]), j(() => {
530
- r && N(r);
531
- }, [e, r]), j(() => {
532
- P.data && P.data.workflowId !== e && N(null);
533
- }, [P.data, e]);
534
- async function _e(t) {
535
- try {
536
- const i = await f.flushThen(t);
537
- !i.ok && i.outcome.status === "blocked" && b(i.outcome.reason);
538
- } catch (i) {
539
- b(i instanceof Ae ? i.message : String(i));
540
- }
541
- }
542
- async function Ht() {
543
- if (!(!e || Z || he.current)) {
544
- b(null), he.current = !0, Qe(!0);
545
- try {
546
- const t = g ? Qn(E, g.isManualTrigger, g.isEntryTrigger) : (_ == null ? void 0 : _[0]) && { id: _[0].id, manual: !0 };
547
- await En();
548
- const i = await _n(
549
- t == null ? void 0 : t.id,
550
- (p) => It(d, e, p),
551
- () => qn(d, e)
552
- );
553
- await _e(
554
- () => t && !t.manual ? (
555
- // A webhook / schedule / app trigger entry runs FROM that trigger: the server takes
556
- // the payload as the event that fired it (its output and `trigger.event`), which a
557
- // plain run's `input` — the Manual trigger's slot — never reaches.
558
- Be.mutateAsync({
559
- id: e,
560
- nodeId: t.id,
561
- body: { stopAt: [], ...i ? { input: i } : {} }
562
- }).then((p) => N(p.runId))
563
- ) : De.mutateAsync({
564
- id: e,
565
- variables: {},
566
- ...i ? { input: i } : {}
567
- }).then((p) => N(p.runId))
568
- );
569
- } finally {
570
- he.current = !1, Qe(!1);
571
- }
572
- }
573
- }
574
- async function Vt(t, i) {
575
- if (!e) return;
576
- b(null);
577
- const p = await f.flushThen(
578
- () => {
579
- var k;
580
- return Be.mutateAsync({
581
- id: e,
582
- nodeId: t,
583
- body: {
584
- stopAt: i.stopAt,
585
- ...(k = i.state) != null && k.steps ? { nodes: i.state.steps } : {},
586
- ...i.input ? { input: i.input } : {}
587
- }
588
- });
589
- }
590
- );
591
- if (!p.ok)
592
- throw new Error(
593
- p.outcome.status === "blocked" ? p.outcome.reason : "The workflow could not be saved, so it was not run."
594
- );
595
- N(p.value.runId);
596
- }
597
- function zt() {
598
- T && (We.mutate(T, {
599
- onError: (t) => {
600
- const i = t instanceof Ae ? t.code : "";
601
- Hn(i) === "surface" && b(t instanceof Ae ? t.message : String(t));
602
- }
603
- }), N(null));
604
- }
605
- async function Gt() {
606
- Oe(!0);
607
- try {
608
- await f.reload(), I((t) => t + 1), b(null);
609
- } finally {
610
- Oe(!1);
611
- }
612
- }
613
- const ee = f.stale ? null : f.error ?? f.loadError, qe = h ?? (ee === null ? null : ee instanceof Error ? ee.message : String(ee)), Yt = c !== null && (Array.isArray(c.nodes) || Array.isArray(c.steps)), He = (c == null ? void 0 : c.displayName) ?? "", me = os(c == null ? void 0 : c.settings), te = hs(c == null ? void 0 : c.initialState), Ut = w(() => ms(c == null ? void 0 : c.variables), [c == null ? void 0 : c.variables]), Ve = Ot(X, c == null ? void 0 : c.key), ze = c !== null && X !== void 0 && !Ve.allowed ? Ve.reason : null, E = w(
614
- () => is(c),
615
- [c]
616
- ), [g, Xt] = v(null);
617
- j(() => {
618
- let t = !1;
619
- return import("@w6w/ui/flow").then((i) => {
620
- t || Xt({
621
- internalNodes: i.INTERNAL_NODES,
622
- isInternalApp: i.isInternalApp,
623
- internalNodeParams: i.internalNodeParams,
624
- isManualTrigger: (p) => p === i.TRIGGER_APP,
625
- isEntryTrigger: i.isTriggerStep,
626
- asFieldDefs: i.asFieldDefs,
627
- findLoopProblems: i.findLoopProblems,
628
- findStateWriteProblems: i.findStateWriteProblems
629
- });
630
- }), () => {
631
- t = !0;
632
- };
633
- }, []);
634
- const _ = w(() => {
635
- if (g)
636
- return rs(
637
- { steps: E },
638
- {
639
- isManualTrigger: g.isManualTrigger,
640
- asFieldDefs: g.asFieldDefs
641
- }
642
- );
643
- }, [g, E]), F = w(() => {
644
- if (!g) return [];
645
- const t = /* @__PURE__ */ new Set();
646
- for (const i of E) {
647
- const { app: p, action: k } = i.uses ?? {};
648
- p && k && !g.isInternalApp(p) && t.add(p);
649
- }
650
- return [...t];
651
- }, [g, E]), { byId: ne } = zn(F), Zt = w(() => [...ne.values()], [ne]), Ge = Pe({
652
- queries: F.map((t) => ({
653
- queryKey: Is(t),
654
- queryFn: () => m.getAppActions(t)
655
- }))
656
- }), Ye = w(() => {
657
- var i, p;
658
- const t = {};
659
- if (!g) return t;
660
- for (const k of E) {
661
- const { app: A, action: K } = k.uses ?? {};
662
- if (!A || !K) continue;
663
- const Ee = `${A}::${K}`;
664
- if (!(Ee in t))
665
- if (g.isInternalApp(A))
666
- t[Ee] = g.internalNodeParams(A, K);
667
- else {
668
- const Pt = F.indexOf(A), Ce = Pt >= 0 ? (i = Ge[Pt]) == null ? void 0 : i.data : void 0;
669
- t[Ee] = ((p = Ce == null ? void 0 : Ce.find((gn) => gn.key === K)) == null ? void 0 : p.params) ?? [];
670
- }
671
- }
672
- return t;
673
- }, [g, E, F, Ge]), q = w(() => {
674
- const t = {};
675
- for (const [i, p] of ne) t[i] = p;
676
- return t;
677
- }, [ne]), be = w(
678
- () => E.filter((t) => {
679
- var p;
680
- const i = (p = t.uses) == null ? void 0 : p.app;
681
- return !!i && i in q && At(q[i]);
682
- }),
683
- [E, q]
684
- ), Ue = Pe({
685
- queries: be.map((t) => ({
686
- queryKey: je(e, t.id),
687
- queryFn: () => It(d, e, t.id),
688
- enabled: !!e
689
- }))
690
- }), Xe = w(() => {
691
- const t = {};
692
- return be.forEach((i, p) => {
693
- var k, A;
694
- t[i.id] = !!((A = (k = Ue[p]) == null ? void 0 : k.data) != null && A.some((K) => K.lastRunStatus === "succeeded"));
695
- }), t;
696
- }, [be, Ue]), H = ks("workflow", e, !!e), ge = Ns("workflow"), L = ((Nt = H.data) == null ? void 0 : Nt.currentPublishedVersion) ?? null, W = Rs("workflow", e, L, !!e), ye = W.data !== void 0 && c !== null && Ft(c, W.data.definition), en = ye && !Ft(c, (Rt = W.data) == null ? void 0 : Rt.definition, { presentation: !0 }), M = H.data === void 0 ? void 0 : L === null ? "unpublished" : W.data === void 0 || f.loading ? void 0 : ye ? "published" : "draft", [tn, Ze] = v(!1), nn = Es("workflow");
697
- async function et(t) {
698
- Ze(!0), b(null);
699
- try {
700
- await f.discardThen(() => nn.mutateAsync({ id: e, versionNumber: t })), I((i) => i + 1), N(null);
701
- } finally {
702
- Ze(!1);
703
- }
704
- }
705
- const se = Mt(), tt = S(null);
706
- j(() => {
707
- var t;
708
- if (!(!e || !T || tt.current === T) && $n(Q, (t = P.data) == null ? void 0 : t.workflowId, e)) {
709
- tt.current = T;
710
- for (const i of xn)
711
- setTimeout(
712
- () => void se.invalidateQueries({ queryKey: Ps(e) }),
713
- i
714
- );
715
- }
716
- }, [e, T, Q, (Et = P.data) == null ? void 0 : Et.workflowId, se]);
717
- const nt = Pe({
718
- queries: F.map((t) => ({
719
- queryKey: Tt(t),
720
- queryFn: () => Ss(d, t)
721
- }))
722
- }), st = w(() => {
723
- const t = /* @__PURE__ */ new Map();
724
- return F.forEach((i, p) => {
725
- const k = nt[p];
726
- k && (k.isError ? t.set(i, { state: "error" }) : k.isSuccess && !k.isFetching ? t.set(i, { state: "ready", ids: new Set((k.data ?? []).map((A) => A.id)) }) : t.set(i, { state: "loading" }));
727
- }), t;
728
- }, [F, nt]), $ = w(
729
- () => as(E, (t) => st.get(t), c == null ? void 0 : c.connections),
730
- [E, st, c == null ? void 0 : c.connections]
731
- ), ot = js(o ?? void 0, o !== null), it = Os(), rt = As(), at = Ts(o ?? void 0), ve = w(() => {
732
- if (!c) return {};
733
- const t = (i) => ({
734
- names: (i.data ?? []).map((p) => p.name),
735
- ready: i.isSuccess
736
- });
737
- return ls({
738
- workflow: c,
739
- lists: {
740
- vars: t(ot),
741
- secrets: t(it),
742
- constants: t(rt),
743
- stores: t(at)
744
- }
745
- });
746
- }, [c, ot, it, rt, at]), lt = w(() => {
747
- const t = {};
748
- for (const [i, p] of Object.entries(ve))
749
- t[i] = [{ code: "setup_incomplete", items: p }];
750
- return t;
751
- }, [ve]), sn = w(
752
- () => no(
753
- $,
754
- g == null ? void 0 : g.findLoopProblems(c),
755
- c ? g == null ? void 0 : g.findStateWriteProblems(c) : void 0,
756
- lt
757
- ),
758
- [$, g, c, lt]
759
- ), ct = S(/* @__PURE__ */ new Set());
760
- j(() => {
761
- for (const t of $) {
762
- const i = `${t.app}|${t.connection}`;
763
- ct.current.has(i) || (ct.current.add(i), se.invalidateQueries({ queryKey: Tt(t.app) }));
764
- }
765
- }, [$, se]);
766
- const oe = S({ id: e, had: !1 });
767
- oe.current.id !== e && (oe.current = { id: e, had: !1 }), $.length > 0 && (oe.current.had = !0);
768
- const ut = Cs("workflow"), we = cs({
769
- enabled: (Ct = H.data) == null ? void 0 : Ct.enabled,
770
- problemCount: $.length,
771
- dirty: f.dirty,
772
- hadProblems: oe.current.had
773
- }), Se = w(
774
- () => ({
775
- actionParamsByKey: Ye,
776
- appsById: q,
777
- testStatus: Xe,
778
- requiredParamsFilled: Nn,
779
- isTestRequired: At
780
- }),
781
- [Ye, q, Xe]
782
- ), on = w(
783
- () => c !== null && g !== null ? us(c, Se) : [],
784
- [c, g, Se]
785
- ), [dt, ft] = v(!1), ke = S(!1), V = ds({
786
- projectMissing: o === null,
787
- loading: !B,
788
- saveBlockedReason: f.saveBlockedReason ?? (B && c === null ? "the workflow JSON does not parse." : null),
789
- catalogLoading: c !== null && g === null,
790
- problems: on,
791
- publishing: dt || ge.isPending
792
- }) ?? (H.isPending || L !== null && W.isPending ? "Checking the published version…" : H.isError || L !== null && W.isError ? "Can't check the published version. Reload to try again." : ye ? en ? "Already published. Moving things on the canvas doesn't need a new version." : "Already published. Make a change before publishing again." : null);
793
- async function Ne() {
794
- if (!(!e || V !== null || ke.current)) {
795
- ke.current = !0, ft(!0), b(null);
796
- try {
797
- await _e(() => ge.mutateAsync(e));
798
- } finally {
799
- ke.current = !1, ft(!1);
800
- }
801
- }
802
- }
803
- Fe.current = (t) => t !== null && typeof t == "object" ? fs(t, Se) : null, Ie.current = me.autoSave;
804
- const rn = R(
805
- (t) => to(t, re.current),
806
- []
807
- );
808
- function ie(t) {
809
- if (!c) return;
810
- const i = { ...c, ...t };
811
- f.setJson(JSON.stringify(i, null, 2));
812
- }
813
- function pt(t) {
814
- if (!c) return;
815
- const i = { ...c, ...t };
816
- b(null), f.commit(JSON.stringify(i, null, 2));
817
- }
818
- const re = S(c);
819
- re.current = c;
820
- const ht = S(f.commit);
821
- ht.current = f.commit;
822
- const mt = S(f.saveNow);
823
- mt.current = f.saveNow, j(() => {
824
- const t = (i) => {
825
- i.altKey || !(i.metaKey || i.ctrlKey) || i.key.toLowerCase() !== "s" || (i.preventDefault(), !document.querySelector(".w6w-exprmodal") && B && mt.current());
826
- };
827
- return document.addEventListener("keydown", t), () => {
828
- document.removeEventListener("keydown", t);
829
- };
830
- }, [B]);
831
- const an = w(
832
- () => c ? gs(c) : {},
833
- [c]
834
- ), ln = R((t) => {
835
- const i = re.current;
836
- if (!i) return;
837
- const p = ys(i, t);
838
- b(null), ht.current(JSON.stringify(p, null, 2));
839
- }, []), cn = R(() => Y(!0), []), bt = S(() => {
840
- });
841
- bt.current = (t) => {
842
- N(t), a({ type: "run", id: e, runId: t });
843
- };
844
- const gt = R((t) => bt.current(t), []), yt = S(et);
845
- yt.current = et;
846
- const un = R((t) => yt.current(t), []), vt = S(Ne);
847
- vt.current = Ne;
848
- const dn = R(() => vt.current(), []), Re = S({ saveMeta: pt, patchMeta: ie });
849
- Re.current = { saveMeta: pt, patchMeta: ie };
850
- const fn = R(
851
- (t, i) => {
852
- var p;
853
- Re.current.saveMeta({
854
- settings: ps((p = re.current) == null ? void 0 : p.settings, t, i)
855
- });
856
- },
857
- []
858
- ), pn = R((t) => {
859
- Re.current.patchMeta({ variables: bs(t) });
860
- }, []), [x, hn] = v(null), wt = S(x);
861
- wt.current = x;
862
- const mn = R(
863
- (t) => {
864
- var i;
865
- (i = wt.current) == null || i.edit(t);
866
- },
867
- []
868
- ), bn = R(() => D(!0), []);
869
- return ts({
870
- kind: "workflow",
871
- id: e,
872
- connectionResources: (x == null ? void 0 : x.workflowId) === e ? { ...x, edit: mn } : void 0,
873
- label: He,
874
- key: (c == null ? void 0 : c.key) ?? void 0,
875
- triggers: _,
876
- onRestoreVersion: un,
877
- definitionStatus: M,
878
- onPublish: dn,
879
- publishDisabled: V !== null,
880
- policy: an,
881
- onPolicyChange: ln,
882
- hasStartingState: te !== void 0 && Object.keys(te).length > 0,
883
- startingState: te,
884
- onOpenStartingState: cn,
885
- onOpenRun: gt,
886
- authoringSettings: { autoSave: me.autoSave, savePosition: me.savePosition },
887
- onAuthoringSettingChange: fn,
888
- variables: Ut,
889
- onVariablesChange: pn,
890
- onOpenHistory: bn
891
- }), /* @__PURE__ */ y("div", { className: "wf-fullbleed", style: { height: "100%", minWidth: 0, flex: 1 }, children: [
892
- (u == null ? void 0 : u.header) ?? /* @__PURE__ */ l(
893
- Js,
894
- {
895
- onBack: () => a({ type: "list" }),
896
- backLabel: (u == null ? void 0 : u.backLabel) === null ? null : (u == null ? void 0 : u.backLabel) ?? "← Workflows",
897
- title: {
898
- editable: !0,
899
- value: He,
900
- placeholder: Ys,
901
- maxLength: 80,
902
- ariaLabel: "Workflow name",
903
- onChange: (t) => ie({ displayName: t }),
904
- onBlur: () => {
905
- B && f.saveNow();
906
- }
907
- },
908
- titleAdornment: M && /* @__PURE__ */ l(
909
- "span",
910
- {
911
- className: `badge wf-definition-status ${M}`,
912
- "data-testid": "wf-definition-status",
913
- "aria-live": "polite",
914
- title: M === "published" ? "This workflow matches the published version. Edits create a separate draft." : M === "draft" ? "You are editing a draft. The published version stays unchanged until you publish." : "You are editing a draft. This workflow has not been published.",
915
- children: M === "published" ? "Live" : "Draft"
916
- }
917
- ),
918
- actions: /* @__PURE__ */ y(le, { children: [
919
- /* @__PURE__ */ l(
920
- ce,
921
- {
922
- icon: "play",
923
- label: Kn(Q, $e),
924
- "data-testid": "wf-run-start",
925
- onClick: Ht,
926
- disabled: !e || Z || qt || De.isPending
927
- }
928
- ),
929
- Z && /* @__PURE__ */ l(
930
- ce,
931
- {
932
- icon: "stop",
933
- label: "Stop this run",
934
- "data-testid": "wf-run-stop",
935
- onClick: zt,
936
- disabled: We.isPending
937
- }
938
- ),
939
- /* @__PURE__ */ l(
940
- Hs,
941
- {
942
- disabled: V !== null,
943
- message: V ?? (L !== null ? "Republish this draft as a new live version" : "Publish this draft as a new live version"),
944
- children: (t) => /* @__PURE__ */ l(le, { children: /* @__PURE__ */ l(
945
- "button",
946
- {
947
- type: "button",
948
- className: "btn ghost wf-publish",
949
- "data-testid": "wf-publish",
950
- onClick: () => void Ne(),
951
- disabled: V !== null,
952
- "aria-describedby": t,
953
- children: dt || ge.isPending ? L !== null ? "Republishing…" : "Publishing…" : L !== null ? M === "draft" ? "Republish" : "Published" : "Publish"
954
- }
955
- ) })
956
- }
957
- ),
958
- /* @__PURE__ */ l(Ws, { onClick: () => z(!0) }),
959
- u == null ? void 0 : u.headerActions
960
- ] })
961
- }
962
- ),
963
- /* @__PURE__ */ l(Vs, { problems: ve }),
964
- we.show && /* @__PURE__ */ l(
965
- _s,
966
- {
967
- kind: "workflow",
968
- problemCount: we.problemCount,
969
- canEnable: we.canEnable,
970
- pending: ut.isPending,
971
- onEnable: () => ut.mutate({ id: e, enabled: !0 })
972
- }
973
- ),
974
- /* @__PURE__ */ l("div", { className: "wf-fullbleed-canvas", children: /* @__PURE__ */ y("div", { className: "wf-run-area", children: [
975
- /* @__PURE__ */ l("div", { className: "wf-run-canvas", children: /* @__PURE__ */ l(An, { fallback: /* @__PURE__ */ l("p", { className: "muted", children: "Loading visual editor…" }), children: Yt && c ? /* @__PURE__ */ l(
976
- so,
977
- {
978
- onConnectionResourcesChange: hn,
979
- value: c,
980
- onChange: (t, i) => {
981
- f.setJson(JSON.stringify(t, null, 2)), i != null && i.viewportOnly || N(null);
982
- },
983
- apps: Zt,
984
- project: o ?? void 0,
985
- height: "100%",
986
- readOnly: Z,
987
- stepProblems: sn,
988
- runState: P.data,
989
- onTestRun: () => N(null),
990
- onRunFromNode: Vt
991
- },
992
- fe
993
- ) : Le === "" ? /* @__PURE__ */ l("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ l("p", { className: "muted", children: "Fix the JSON to render the visual editor." }) }) }),
994
- T && /* @__PURE__ */ l("div", { className: "wf-run-log", "data-testid": "wf-run-log", children: /* @__PURE__ */ l(
995
- Rn,
996
- {
997
- steps: xe,
998
- runError: Ke.runError,
999
- stepErrors: Ke.stepErrors,
1000
- onDismiss: () => N(null)
1001
- }
1002
- ) })
1003
- ] }) }),
1004
- o === null && !s && /* @__PURE__ */ y("div", { role: "alert", className: "error", "data-testid": "wf-project-required", children: [
1005
- "No project selected — pass a ",
1006
- /* @__PURE__ */ l("code", { children: "project" }),
1007
- " prop (or set the provider's project) to edit and save this workflow."
1008
- ] }),
1009
- /* @__PURE__ */ y("div", { className: "wf-fullbleed-foot", children: [
1010
- /* @__PURE__ */ y("div", { className: "row", style: { flexWrap: "wrap", alignItems: "center" }, children: [
1011
- /* @__PURE__ */ l(
1012
- "button",
1013
- {
1014
- type: "button",
1015
- className: "btn",
1016
- disabled: o === null || !B || !xt,
1017
- onClick: f.saveNow,
1018
- children: f.saving ? "Saving…" : "Save"
1019
- }
1020
- ),
1021
- Qt && /* @__PURE__ */ l("span", { className: "ok", children: "Saved." })
1022
- ] }),
1023
- qe && /* @__PURE__ */ l("div", { className: "error", children: qe }),
1024
- ze && /* @__PURE__ */ l("div", { className: "error", "data-testid": "wf-key-guard", children: ze })
1025
- ] }),
1026
- tn && /* @__PURE__ */ l(ue, { title: "Restoring version…", onClose: () => {
1027
- }, children: /* @__PURE__ */ l("div", { className: "modal-body", children: "Replacing the draft…" }) }),
1028
- /* @__PURE__ */ l(
1029
- $s,
1030
- {
1031
- open: O,
1032
- onClose: () => z(!1),
1033
- title: `JSON — ${(c == null ? void 0 : c.displayName) || "workflow"}`,
1034
- mode: "apply",
1035
- value: Le,
1036
- prepareApply: rn,
1037
- onApply: (t) => {
1038
- f.setJson(t), I((i) => i + 1), N(null);
1039
- },
1040
- editorLabel: "Workflow definition JSON"
1041
- }
1042
- ),
1043
- f.stale && !Kt && /* @__PURE__ */ y(ue, { title: "This workflow changed on the server", onClose: () => pe(!0), children: [
1044
- /* @__PURE__ */ y("div", { className: "modal-body", children: [
1045
- /* @__PURE__ */ l("p", { className: "muted small", children: "Someone else — another tab, another session — saved this workflow after you opened it. Your save was refused rather than applied, so their work is still intact." }),
1046
- /* @__PURE__ */ y("p", { className: "muted small", children: [
1047
- /* @__PURE__ */ l("strong", { children: "Reload from server" }),
1048
- " replaces what is on this canvas with the saved copy; anything you changed here and have not saved is lost.",
1049
- " ",
1050
- /* @__PURE__ */ l("strong", { children: "Keep editing" }),
1051
- " leaves your version exactly as it is — but every save will be refused the same way until you reload, so copy out anything you need first."
1052
- ] })
1053
- ] }),
1054
- /* @__PURE__ */ y("div", { className: "modal-actions", children: [
1055
- /* @__PURE__ */ l("button", { type: "button", className: "btn ghost", onClick: () => pe(!0), children: "Keep editing" }),
1056
- /* @__PURE__ */ l("button", { type: "button", className: "btn", disabled: U, onClick: Gt, children: U ? "Reloading…" : "Reload from server" })
1057
- ] })
1058
- ] }),
1059
- C && /* @__PURE__ */ l(
1060
- Bs,
1061
- {
1062
- kind: "workflow",
1063
- id: e,
1064
- onClose: () => D(!1),
1065
- onOpenRun: gt
1066
- }
1067
- ),
1068
- G && /* @__PURE__ */ l(
1069
- Gs,
1070
- {
1071
- initialState: te,
1072
- onChange: (t) => ie({ initialState: t }),
1073
- onClose: () => Y(!1)
1074
- }
1075
- )
1076
- ] });
1077
- }
1078
- function io({
1079
- children: n,
1080
- callableHref: e
1081
- }) {
1082
- const o = Jt(), s = Mt(), r = Pn(Fs), a = w(() => ({
1083
- ...o,
1084
- saveStepTest: (...m) => o.saveStepTest(...m).finally(() => {
1085
- s.invalidateQueries({ queryKey: je(m[0], m[1]) });
1086
- }),
1087
- recordStepTestRun: (...m) => o.recordStepTestRun(...m).finally(() => {
1088
- s.invalidateQueries({ queryKey: je(m[0], m[1]) });
1089
- }),
1090
- callableHref: e ?? o.callableHref
1091
- }), [o, s, e]);
1092
- return /* @__PURE__ */ l(kn, { api: a, theme: r, children: n });
1093
- }
1094
- const ro = () => {
1095
- };
1096
- function Lo(n) {
1097
- const { workflowId: e, initialRunId: o, onNavigate: s = ro, slots: r } = n, a = vs(n.project), u = ws().status, d = n.project === void 0 && u === "resolving", m = R(
1098
- (h) => {
1099
- h.type === "list" ? s({ type: "list" }) : h.kind === "workflow" && s({ type: "workflow", id: h.id });
1100
- },
1101
- [s]
1102
- );
1103
- return /* @__PURE__ */ l(
1104
- "div",
1105
- {
1106
- className: "w6w-embed-root",
1107
- style: { display: "flex", width: "100%", height: "100%", minHeight: 0 },
1108
- children: /* @__PURE__ */ l(
1109
- qs,
1110
- {
1111
- project: a,
1112
- onNavigate: m,
1113
- rail: n.rail,
1114
- storageKey: a === null ? null : `w6w.rail.embed.${a}`,
1115
- children: /* @__PURE__ */ l(io, { callableHref: n.callableHref, children: /* @__PURE__ */ l(
1116
- oo,
1117
- {
1118
- workflowId: e,
1119
- project: a,
1120
- projectPending: d,
1121
- initialRunId: o,
1122
- onNavigate: s,
1123
- slots: r
1124
- }
1125
- ) })
1126
- }
1127
- )
1128
- }
1129
- );
1130
- }
1131
- export {
1132
- _s as B,
1133
- Js as E,
1134
- Bs as H,
1135
- $s as J,
1136
- Lo as W,
1137
- qs as a,
1138
- Ws as b
1139
- };
1140
- //# sourceMappingURL=WorkflowEditor-B-Wc_r4X.js.map