@infotrust/ui 0.0.0-stage → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/LICENSE +24 -0
  2. package/NOTICE.md +37 -0
  3. package/README.md +53 -2
  4. package/dist/assistant-session-DP4_70Xk.js +1381 -0
  5. package/dist/command-Bjncx7YR.js +1279 -0
  6. package/dist/components/actions/ItActionMenu.vue.d.ts +24 -0
  7. package/dist/components/actions/ItDecisionToggle.vue.d.ts +22 -0
  8. package/dist/components/actions/ItIconButton.vue.d.ts +24 -0
  9. package/dist/components/actions/ItLinkButton.vue.d.ts +17 -0
  10. package/dist/components/actions/action-menu.d.ts +19 -0
  11. package/dist/components/charts/ItBarChart.vue.d.ts +121 -0
  12. package/dist/components/charts/ItCalendarChart.vue.d.ts +80 -0
  13. package/dist/components/charts/ItChartLegend.vue.d.ts +47 -0
  14. package/dist/components/charts/ItChartTable.vue.d.ts +16 -0
  15. package/dist/components/charts/ItChartTooltip.vue.d.ts +52 -0
  16. package/dist/components/charts/ItDonutChart.vue.d.ts +79 -0
  17. package/dist/components/charts/ItProportionBar.vue.d.ts +42 -0
  18. package/dist/components/charts/ItSparkline.vue.d.ts +42 -0
  19. package/dist/components/charts/ItTrendChart.vue.d.ts +80 -0
  20. package/dist/components/charts/chart.d.ts +84 -0
  21. package/dist/components/charts/selection.d.ts +14 -0
  22. package/dist/components/charts/skeleton.d.ts +16 -0
  23. package/dist/components/command/ItAssistantPanel.vue.d.ts +56 -0
  24. package/dist/components/command/ItAssistantThread.vue.d.ts +73 -0
  25. package/dist/components/command/ItCommandPalette.vue.d.ts +102 -0
  26. package/dist/components/command/ItMarkdown.vue.d.ts +12 -0
  27. package/dist/components/command/assistant-session.d.ts +26 -0
  28. package/dist/components/command/command.d.ts +127 -0
  29. package/dist/components/command/markdown.d.ts +55 -0
  30. package/dist/components/content/ItDocsArticle.vue.d.ts +18 -0
  31. package/dist/components/content/ItDocsLayout.vue.d.ts +29 -0
  32. package/dist/components/content/ItDocsPager.vue.d.ts +12 -0
  33. package/dist/components/content/ItProse.vue.d.ts +18 -0
  34. package/dist/components/content/docs.d.ts +23 -0
  35. package/dist/components/dag/ItDagCanvas.vue.d.ts +143 -0
  36. package/dist/components/dag/ItDagControls.vue.d.ts +2 -0
  37. package/dist/components/dag/ItDagEdge.vue.d.ts +21 -0
  38. package/dist/components/dag/ItDagLibrary.vue.d.ts +19 -0
  39. package/dist/components/dag/ItDagNode.vue.d.ts +20 -0
  40. package/dist/components/dag/dag.d.ts +182 -0
  41. package/dist/components/dag/history.d.ts +51 -0
  42. package/dist/components/dag/layout.d.ts +54 -0
  43. package/dist/components/dag/route.d.ts +24 -0
  44. package/dist/components/data/DataError.vue.d.ts +12 -0
  45. package/dist/components/data/ItChangeList.vue.d.ts +48 -0
  46. package/dist/components/data/ItCodeBlock.vue.d.ts +23 -0
  47. package/dist/components/data/ItDataTable.vue.d.ts +135 -0
  48. package/dist/components/data/ItDataToolbar.vue.d.ts +57 -0
  49. package/dist/components/data/ItDescriptionList.vue.d.ts +30 -0
  50. package/dist/components/data/ItEmptyState.vue.d.ts +22 -0
  51. package/dist/components/data/ItKpiCard.vue.d.ts +89 -0
  52. package/dist/components/data/ItKpiDetail.vue.d.ts +40 -0
  53. package/dist/components/data/ItKpiGrid.vue.d.ts +19 -0
  54. package/dist/components/data/ItObjectName.vue.d.ts +64 -0
  55. package/dist/components/data/ItPaginator.vue.d.ts +46 -0
  56. package/dist/components/data/ItResourceList.vue.d.ts +39 -0
  57. package/dist/components/data/ItResourceListItem.vue.d.ts +40 -0
  58. package/dist/components/data/ItSkeleton.vue.d.ts +14 -0
  59. package/dist/components/data/ItTablePaginator.vue.d.ts +34 -0
  60. package/dist/components/data/ItTime.vue.d.ts +13 -0
  61. package/dist/components/data/ItTreeTable.vue.d.ts +109 -0
  62. package/dist/components/data/TableChevron.vue.d.ts +8 -0
  63. package/dist/components/data/TableExpansion.vue.d.ts +22 -0
  64. package/dist/components/data/column-sizing.d.ts +31 -0
  65. package/dist/components/data/data-table.d.ts +15 -0
  66. package/dist/components/data/highlight-worker.d.ts +1 -0
  67. package/dist/components/data/highlight.d.ts +3 -0
  68. package/dist/components/data/kpi-placement.d.ts +40 -0
  69. package/dist/components/data/kpi.d.ts +16 -0
  70. package/dist/components/data/sticky-header.d.ts +9 -0
  71. package/dist/components/data/table-skeleton.d.ts +11 -0
  72. package/dist/components/data/table-source.d.ts +77 -0
  73. package/dist/components/data/tree-table-public.d.ts +17 -0
  74. package/dist/components/data/tree-table.d.ts +30 -0
  75. package/dist/components/feedback/ItCallout.vue.d.ts +25 -0
  76. package/dist/components/feedback/ItConfirmHost.vue.d.ts +2 -0
  77. package/dist/components/feedback/ItOverlayHost.vue.d.ts +2 -0
  78. package/dist/components/feedback/ItProgressBar.vue.d.ts +19 -0
  79. package/dist/components/feedback/ItToastHost.vue.d.ts +2 -0
  80. package/dist/components/forms/FieldClearButton.vue.d.ts +11 -0
  81. package/dist/components/forms/ItAutoComplete.vue.d.ts +69 -0
  82. package/dist/components/forms/ItCheckboxGroup.vue.d.ts +27 -0
  83. package/dist/components/forms/ItChipInput.vue.d.ts +32 -0
  84. package/dist/components/forms/ItCodeEditor.vue.d.ts +64 -0
  85. package/dist/components/forms/ItDatePicker.vue.d.ts +35 -0
  86. package/dist/components/forms/ItFileDrop.vue.d.ts +47 -0
  87. package/dist/components/forms/ItFilterChip.vue.d.ts +13 -0
  88. package/dist/components/forms/ItFilterMenu.vue.d.ts +37 -0
  89. package/dist/components/forms/ItFilterPopover.vue.d.ts +44 -0
  90. package/dist/components/forms/ItFormActions.vue.d.ts +14 -0
  91. package/dist/components/forms/ItFormField.vue.d.ts +44 -0
  92. package/dist/components/forms/ItFormRows.vue.d.ts +50 -0
  93. package/dist/components/forms/ItFormSection.vue.d.ts +28 -0
  94. package/dist/components/forms/ItLabelCell.vue.d.ts +42 -0
  95. package/dist/components/forms/ItLabelPicker.vue.d.ts +34 -0
  96. package/dist/components/forms/ItMultiSelect.vue.d.ts +53 -0
  97. package/dist/components/forms/ItOptionCardGroup.vue.d.ts +35 -0
  98. package/dist/components/forms/ItRadioGroup.vue.d.ts +29 -0
  99. package/dist/components/forms/ItSearchInput.vue.d.ts +25 -0
  100. package/dist/components/forms/ItSegmentedControl.vue.d.ts +25 -0
  101. package/dist/components/forms/ItSelect.vue.d.ts +50 -0
  102. package/dist/components/forms/ItSwitch.vue.d.ts +31 -0
  103. package/dist/components/forms/ItTabs.vue.d.ts +27 -0
  104. package/dist/components/forms/OptionSourceSlot.vue.d.ts +13 -0
  105. package/dist/components/forms/choice.d.ts +24 -0
  106. package/dist/components/forms/code-editor.d.ts +17 -0
  107. package/dist/components/forms/field-context.d.ts +39 -0
  108. package/dist/components/forms/file-drop.d.ts +19 -0
  109. package/dist/components/forms/form-errors.d.ts +7 -0
  110. package/dist/components/forms/form-rows.d.ts +8 -0
  111. package/dist/components/forms/option-source.d.ts +39 -0
  112. package/dist/components/forms/virtual-options.d.ts +12 -0
  113. package/dist/components/layout/ItBreadcrumb.vue.d.ts +12 -0
  114. package/dist/components/layout/ItDetailSection.vue.d.ts +21 -0
  115. package/dist/components/layout/ItPage.vue.d.ts +44 -0
  116. package/dist/components/layout/ItPanel.vue.d.ts +47 -0
  117. package/dist/components/layout/ItSectionNav.vue.d.ts +43 -0
  118. package/dist/components/layout/ItWizard.vue.d.ts +57 -0
  119. package/dist/components/layout/ItWizardSteps.vue.d.ts +15 -0
  120. package/dist/components/layout/SectionNavLinks.vue.d.ts +15 -0
  121. package/dist/components/layout/panel.d.ts +18 -0
  122. package/dist/components/layout/section-nav.d.ts +17 -0
  123. package/dist/components/layout/wizard.d.ts +13 -0
  124. package/dist/components/logic/ItFieldPicker.vue.d.ts +40 -0
  125. package/dist/components/logic/ItLogicBuilder.vue.d.ts +58 -0
  126. package/dist/components/logic/ItLogicCondition.vue.d.ts +9 -0
  127. package/dist/components/logic/ItLogicGroup.vue.d.ts +9 -0
  128. package/dist/components/logic/ItOperatorSelect.vue.d.ts +25 -0
  129. package/dist/components/logic/ItValueInput.vue.d.ts +29 -0
  130. package/dist/components/logic/logic.d.ts +263 -0
  131. package/dist/components/logic/region.d.ts +44 -0
  132. package/dist/components/overlays/ItDrawer.vue.d.ts +48 -0
  133. package/dist/components/overlays/ItModal.vue.d.ts +53 -0
  134. package/dist/components/overlays/escape-stack.d.ts +7 -0
  135. package/dist/components/overlays/modal.d.ts +23 -0
  136. package/dist/components/shell/ItAppShell.vue.d.ts +68 -0
  137. package/dist/components/shell/ItCommandTrigger.vue.d.ts +17 -0
  138. package/dist/components/shell/ItOrgSwitcher.vue.d.ts +26 -0
  139. package/dist/components/shell/ItShellMenuItem.vue.d.ts +18 -0
  140. package/dist/components/shell/ItShellNavBranch.vue.d.ts +15 -0
  141. package/dist/components/shell/ItShellNavLink.vue.d.ts +18 -0
  142. package/dist/components/shell/ItShellSidebarButton.vue.d.ts +15 -0
  143. package/dist/components/shell/ItThemeControl.vue.d.ts +13 -0
  144. package/dist/components/shell/org.d.ts +36 -0
  145. package/dist/components/shell/types.d.ts +67 -0
  146. package/dist/components/status/ItBadge.vue.d.ts +12 -0
  147. package/dist/components/status/ItEntityTypeChip.vue.d.ts +14 -0
  148. package/dist/components/status/ItLabelChip.vue.d.ts +21 -0
  149. package/dist/components/status/ItLabelChipList.vue.d.ts +27 -0
  150. package/dist/components/status/ItPlatformChip.vue.d.ts +20 -0
  151. package/dist/components/status/ItPlatformLogo.vue.d.ts +17 -0
  152. package/dist/components/status/ItSeverityBadge.vue.d.ts +9 -0
  153. package/dist/components/status/ItStatus.vue.d.ts +12 -0
  154. package/dist/components.css +1 -0
  155. package/dist/composables/iconMotion.d.ts +12 -0
  156. package/dist/composables/ripple.d.ts +3 -0
  157. package/dist/composables/useItConfirm.d.ts +16 -0
  158. package/dist/composables/useItCopy.d.ts +4 -0
  159. package/dist/composables/useItCursorPager.d.ts +50 -0
  160. package/dist/composables/useItTheme.d.ts +26 -0
  161. package/dist/composables/useItToast.d.ts +24 -0
  162. package/dist/dag.d.ts +5 -0
  163. package/dist/dag.js +1754 -0
  164. package/dist/dev-D7A7MIn_.js +1264 -0
  165. package/dist/directives/truncate.d.ts +29 -0
  166. package/dist/elk-worker.min-O2A22ecl.js +6321 -0
  167. package/dist/format/index.d.ts +53 -0
  168. package/dist/highlight-worker-DIrLC7a2.js +25 -0
  169. package/dist/index.d.ts +147 -0
  170. package/dist/index.js +11989 -0
  171. package/dist/licenses/@vue-flow__core.LICENSE +20 -0
  172. package/dist/licenses/elkjs.LICENSE.md +263 -0
  173. package/dist/licenses/highlight.js.LICENSE +29 -0
  174. package/dist/licenses/vue-sonner.LICENSE +21 -0
  175. package/dist/platform-art-Bt1CnaKE.js +86 -0
  176. package/dist/plugin.d.ts +69 -0
  177. package/dist/registries/entity-type.d.ts +18 -0
  178. package/dist/registries/platform-art.d.ts +2 -0
  179. package/dist/registries/platform-marks.d.ts +12 -0
  180. package/dist/registries/platform.d.ts +22 -0
  181. package/dist/registries/severity.d.ts +23 -0
  182. package/dist/registries/status.d.ts +13 -0
  183. package/dist/styles.css +26 -0
  184. package/dist/text-nGkJYA88.js +470 -0
  185. package/dist/utils/chip-truncation.d.ts +8 -0
  186. package/dist/utils/chunk-recovery.d.ts +24 -0
  187. package/dist/utils/dev.d.ts +2 -0
  188. package/dist/utils/listeners.d.ts +10 -0
  189. package/dist/utils/router.d.ts +9 -0
  190. package/dist/utils/scroll.d.ts +8 -0
  191. package/dist/utils/select.d.ts +21 -0
  192. package/dist/utils/text.d.ts +6 -0
  193. package/package.json +91 -3
package/dist/dag.js ADDED
@@ -0,0 +1,1754 @@
1
+ import { defineComponent as Xe, inject as dt, computed as E, openBlock as b, createElementBlock as _, normalizeClass as Ie, createElementVNode as U, Fragment as q, renderList as ge, normalizeStyle as rt, createCommentVNode as C, createBlock as O, resolveDynamicComponent as fe, normalizeProps as pn, mergeProps as Te, withDirectives as ye, createTextVNode as be, toDisplayString as G, unref as k, renderSlot as Re, ref as V, watch as te, nextTick as ee, withCtx as X, createVNode as D, markRaw as co, useId as fo, onMounted as go, watchEffect as vo, shallowRef as Lt, onBeforeUnmount as ot, provide as po, Teleport as mo, createSlots as it, toRaw as ho } from "vue";
2
+ import ce from "primevue/button";
3
+ import yo from "primevue/inputtext";
4
+ import { Plus as Ut, Info as bo, Trash2 as En, Minus as wo, Scan as ko, Minimize2 as $o, Maximize2 as xo, Network as Eo, Undo2 as _o, Redo2 as So } from "lucide-vue-next";
5
+ import { NodeIdInjection as Po, Position as Z, Handle as No, getBezierPath as Co, getSmoothStepPath as Mo, useVueFlow as _n, EdgeLabelRenderer as To, getRectOfNodes as mn, VueFlow as Do, ConnectionLineType as hn, ConnectionMode as Ro, Panel as Ot } from "@vue-flow/core";
6
+ import { a as Sn, v as we, _ as ne, p as Io } from "./text-nGkJYA88.js";
7
+ import { s as Ft, _ as Pn, a as zo, b as At, c as Lo, i as Oo, d as Fo, e as Ao, f as Bo, g as Uo, h as Yo } from "./dev-D7A7MIn_.js";
8
+ const Yt = { one: "step", other: "steps" };
9
+ function He(i) {
10
+ return `${i.article ?? (/^[aeiou]/i.test(i.one) ? "an" : "a")} ${i.one}`;
11
+ }
12
+ function Ho(i) {
13
+ return i.charAt(0).toUpperCase() + i.slice(1);
14
+ }
15
+ const Xo = [{ id: "in" }], Vo = [{ id: "out" }];
16
+ function $e(i) {
17
+ return i.inputs ?? Xo;
18
+ }
19
+ function xe(i) {
20
+ return i.outputs ?? Vo;
21
+ }
22
+ function ke(i, l) {
23
+ var y, m;
24
+ const r = (p) => "get" in l ? l.get(p) : l.find((c) => c.id === p), n = r(i.source), d = r(i.target);
25
+ return {
26
+ sourcePort: i.sourcePort ?? (n ? (y = xe(n)[0]) == null ? void 0 : y.id : void 0),
27
+ targetPort: i.targetPort ?? (d ? (m = $e(d)[0]) == null ? void 0 : m.id : void 0)
28
+ };
29
+ }
30
+ function at(i) {
31
+ return `${i.source}.${i.sourcePort}->${i.target}.${i.targetPort}`;
32
+ }
33
+ function Wo(i, l, r) {
34
+ const n = /* @__PURE__ */ new Map();
35
+ for (const m of i) n.set(m.source, [...n.get(m.source) ?? [], m.target]);
36
+ const d = /* @__PURE__ */ new Set(), y = [l];
37
+ for (; y.length; ) {
38
+ const m = y.pop();
39
+ if (m === r) return !0;
40
+ d.has(m) || (d.add(m), y.push(...n.get(m) ?? []));
41
+ }
42
+ return !1;
43
+ }
44
+ function jo(i) {
45
+ return i.length < 2 ? i[0] ?? "" : `${i.slice(0, -1).join(", ")} or ${i[i.length - 1]}`;
46
+ }
47
+ function yn(i, l, r, n = {}) {
48
+ var v;
49
+ const d = n.noun ?? Yt, y = i.find((h) => h.id === r.source), m = i.find((h) => h.id === r.target);
50
+ if (!y || !m) return `That ${d.one} is no longer on the canvas.`;
51
+ if (y.id === m.id) return `${Ho(He(d))} cannot connect to itself.`;
52
+ const p = xe(y).find((h) => h.id === r.sourcePort), c = $e(m).find((h) => h.id === r.targetPort);
53
+ if (!p || !c) return "Connect an output (right side) to an input (left side).";
54
+ const g = l.filter((h) => h.target === m.id && ke(h, i).targetPort === c.id);
55
+ return g.some((h) => h.source === y.id && ke(h, i).sourcePort === p.id) ? `These ${d.other} are already connected.` : (v = c.accepts) != null && v.length && !(p.type && c.accepts.includes(p.type)) ? `${m.label} takes ${jo(c.accepts)}${p.type ? `, not ${p.type}` : ""}.` : c.max !== void 0 && g.length >= c.max ? `${c.label ?? m.label} takes ${c.max === 1 ? "one connection" : `${c.max} connections`}.` : !n.allowCycles && Wo(l, m.id, y.id) ? "That connection would make a loop." : null;
56
+ }
57
+ const ut = Symbol("ItDagCanvas"), Zo = {
58
+ key: 0,
59
+ class: "it-dag-node__ring",
60
+ "aria-hidden": "true"
61
+ }, Ko = { class: "it-dag-node__head" }, qo = { class: "it-dag-node__titles" }, Go = {
62
+ key: 0,
63
+ class: "it-dag-node__kind"
64
+ }, Qo = { class: "it-dag-node__label" }, Jo = {
65
+ key: 1,
66
+ class: "it-dag-node__foot"
67
+ }, ei = {
68
+ key: 0,
69
+ class: "it-dag-node__meta"
70
+ }, ti = {
71
+ key: 2,
72
+ class: "it-dag-node__call"
73
+ }, ni = {
74
+ key: 0,
75
+ class: "it-text-code"
76
+ }, oi = {
77
+ key: 3,
78
+ class: "it-dag-node__body"
79
+ }, ii = {
80
+ key: 4,
81
+ class: "it-dag-node__ports",
82
+ role: "list"
83
+ }, ai = { class: "it-dag-node__port-cell" }, si = { class: "it-dag-node__port-cell it-dag-node__port-cell--out" }, li = /* @__PURE__ */ Xe({
84
+ __name: "ItDagNode",
85
+ props: {
86
+ node: {},
87
+ selected: { type: Boolean, default: !1 }
88
+ },
89
+ setup(i) {
90
+ const l = i, r = dt(Po, null) !== null, n = dt(ut, null), d = E(() => (n == null ? void 0 : n.direction()) === "down"), y = E(() => !!l.node.status && !!Ft(l.node.status).live), m = E(() => !y.value && !!l.node.status && !!Ft(l.node.status).waiting), p = [100, 88, 76, 64, 52, 40, 28, 16], c = E(() => r && !!(n != null && n.editable())), g = E(() => !!l.node.kind && l.node.kind.trim().toLowerCase() !== l.node.label.trim().toLowerCase()), v = E(() => $e(l.node)), h = E(() => xe(l.node)), f = (z) => z.length === 1 && !z[0].label, R = E(() => !d.value && f(v.value)), Y = E(() => !d.value && f(h.value)), j = E(() => d.value || R.value ? [] : v.value), K = E(() => d.value || Y.value ? [] : h.value), N = E(
91
+ () => Array.from({ length: Math.max(j.value.length, K.value.length) }, (z, T) => ({ in: j.value[T], out: K.value[T] }))
92
+ );
93
+ function S(z, T, M = 0, A = 1) {
94
+ const ie = d.value ? z === "in" ? Z.Top : Z.Bottom : z === "in" ? Z.Left : Z.Right, Q = {
95
+ class: ["it-dag-node__port", `it-dag-node__port--${ie}`],
96
+ style: d.value ? { left: `${(M + 1) / (A + 1) * 100}%` } : void 0
97
+ };
98
+ return r ? {
99
+ is: No,
100
+ attrs: { ...Q, id: `${z}:${T.id}`, type: z === "in" ? "target" : "source", position: ie, connectable: c.value }
101
+ } : { is: "span", attrs: { ...Q, "aria-hidden": "true" } };
102
+ }
103
+ return (z, T) => (b(), _("div", {
104
+ class: Ie(["it-dag-node", { "it-dag-node--call": i.node.call || i.node.badge, "it-dag-node--selected": i.selected, "it-dag-node--muted": i.node.muted, "it-dag-node--down": d.value, "it-dag-node--working": y.value, "it-dag-node--waiting": m.value }])
105
+ }, [
106
+ y.value || m.value ? (b(), _("svg", Zo, [
107
+ T[0] || (T[0] = U("rect", {
108
+ class: "it-dag-node__ring-base",
109
+ pathLength: "100"
110
+ }, null, -1)),
111
+ (b(), _(q, null, ge(p, (M) => U("rect", {
112
+ key: M,
113
+ class: "it-dag-node__ring-light",
114
+ pathLength: "100",
115
+ style: rt({ "--it-dag-ring-dash": M })
116
+ }, null, 4)), 64))
117
+ ])) : C("", !0),
118
+ U("div", Ko, [
119
+ R.value ? (b(), O(fe(S("in", v.value[0]).is), pn(Te({ key: 0 }, S("in", v.value[0]).attrs)), null, 16)) : C("", !0),
120
+ i.node.platform ? (b(), O(Sn, {
121
+ key: 1,
122
+ class: "it-dag-node__platform",
123
+ platform: i.node.platform,
124
+ size: 20
125
+ }, null, 8, ["platform"])) : i.node.icon ? (b(), O(fe(i.node.icon), {
126
+ key: 2,
127
+ class: "it-dag-node__icon",
128
+ size: 16,
129
+ "aria-hidden": "true"
130
+ })) : C("", !0),
131
+ U("span", qo, [
132
+ g.value ? ye((b(), _("span", Go, [
133
+ be(G(i.node.kind), 1)
134
+ ])), [
135
+ [k(we)]
136
+ ]) : C("", !0),
137
+ ye((b(), _("span", Qo, [
138
+ be(G(i.node.label), 1)
139
+ ])), [
140
+ [k(we)]
141
+ ])
142
+ ]),
143
+ Y.value ? (b(), O(fe(S("out", h.value[0]).is), pn(Te({ key: 3 }, S("out", h.value[0]).attrs)), null, 16)) : C("", !0)
144
+ ]),
145
+ i.node.meta || i.node.status ? (b(), _("div", Jo, [
146
+ i.node.meta ? ye((b(), _("span", ei, [
147
+ be(G(i.node.meta), 1)
148
+ ])), [
149
+ [k(we)]
150
+ ]) : C("", !0),
151
+ i.node.status ? (b(), O(Pn, {
152
+ key: 1,
153
+ class: "it-dag-node__status",
154
+ status: i.node.status
155
+ }, null, 8, ["status"])) : C("", !0)
156
+ ])) : C("", !0),
157
+ i.node.call || i.node.badge ? (b(), _("div", ti, [
158
+ i.node.call ? ye((b(), _("code", ni, [
159
+ be(G(i.node.call), 1)
160
+ ])), [
161
+ [k(we)]
162
+ ]) : C("", !0),
163
+ i.node.badge ? (b(), O(zo, {
164
+ key: 1,
165
+ class: "it-dag-node__badge",
166
+ label: i.node.badge.label,
167
+ tone: i.node.badge.tone
168
+ }, null, 8, ["label", "tone"])) : C("", !0)
169
+ ])) : C("", !0),
170
+ z.$slots.default ? (b(), _("div", oi, [
171
+ Re(z.$slots, "default")
172
+ ])) : C("", !0),
173
+ N.value.length ? (b(), _("ul", ii, [
174
+ (b(!0), _(q, null, ge(N.value, (M, A) => (b(), _("li", {
175
+ key: A,
176
+ class: "it-dag-node__port-row"
177
+ }, [
178
+ U("span", ai, [
179
+ M.in ? (b(), _(q, { key: 0 }, [
180
+ (b(), O(fe(S("in", M.in).is), Te({ ref_for: !0 }, S("in", M.in).attrs), null, 16)),
181
+ T[1] || (T[1] = U("span", { class: "it-sr-only" }, "Input: ", -1)),
182
+ ye((b(), _("span", null, [
183
+ be(G(M.in.label ?? M.in.id), 1)
184
+ ])), [
185
+ [k(we)]
186
+ ])
187
+ ], 64)) : C("", !0)
188
+ ]),
189
+ U("span", si, [
190
+ M.out ? (b(), _(q, { key: 0 }, [
191
+ T[2] || (T[2] = U("span", { class: "it-sr-only" }, "Output: ", -1)),
192
+ ye((b(), _("span", null, [
193
+ be(G(M.out.label ?? M.out.id), 1)
194
+ ])), [
195
+ [k(we)]
196
+ ]),
197
+ (b(), O(fe(S("out", M.out).is), Te({ ref_for: !0 }, S("out", M.out).attrs), null, 16))
198
+ ], 64)) : C("", !0)
199
+ ])
200
+ ]))), 128))
201
+ ])) : C("", !0),
202
+ d.value ? (b(), _(q, { key: 5 }, [
203
+ (b(!0), _(q, null, ge(v.value, (M, A) => (b(), O(fe(S("in", M, A, v.value.length).is), Te({
204
+ key: `in-${M.id}`
205
+ }, { ref_for: !0 }, S("in", M, A, v.value.length).attrs), null, 16))), 128)),
206
+ (b(!0), _(q, null, ge(h.value, (M, A) => (b(), O(fe(S("out", M, A, h.value.length).is), Te({
207
+ key: `out-${M.id}`
208
+ }, { ref_for: !0 }, S("out", M, A, h.value.length).attrs), null, 16))), 128))
209
+ ], 64)) : C("", !0)
210
+ ], 2));
211
+ }
212
+ }), bn = 1.5, di = 24;
213
+ function ri(i, l, r, n) {
214
+ const d = n ? "y" : "x", y = n ? "x" : "y", m = (c, g) => Math.abs(c[y] - g[y]) <= bn && Math.abs(c[d] - g[d]) <= di;
215
+ if (!i || !m(i.from, l) || !m(i.to, r)) return null;
216
+ const p = i.bends.map((c) => ({ ...c }));
217
+ if (p.length) {
218
+ const c = (g, v, h) => {
219
+ const f = p[g][d];
220
+ for (let R = g; R >= 0 && R < p.length && Math.abs(p[R][d] - f) <= bn; R += v) p[R][d] = h;
221
+ };
222
+ c(0, 1, l[d]), c(p.length - 1, -1, r[d]);
223
+ }
224
+ return [l, ...p, r];
225
+ }
226
+ const De = (i, l) => Math.hypot(l.x - i.x, l.y - i.y);
227
+ function ui(i, l) {
228
+ const r = i.filter((p, c) => c === 0 || De(i[c - 1], p) > 0.01);
229
+ let n = `M ${r[0].x},${r[0].y}`;
230
+ for (let p = 1; p < r.length - 1; p++) {
231
+ const [c, g, v] = [r[p - 1], r[p], r[p + 1]], h = Math.min(l, De(c, g) / 2, De(g, v) / 2), f = (j, K) => {
232
+ const N = De(j, g) || 1;
233
+ return { x: g.x + (j.x - g.x) / N * K, y: g.y + (j.y - g.y) / N * K };
234
+ }, R = f(c, h), Y = f(v, h);
235
+ n += ` L ${R.x},${R.y} Q ${g.x},${g.y} ${Y.x},${Y.y}`;
236
+ }
237
+ const d = r[r.length - 1];
238
+ n += ` L ${d.x},${d.y}`;
239
+ let m = r.slice(1).reduce((p, c, g) => p + De(r[g], c), 0) / 2;
240
+ for (let p = 1; p < r.length; p++) {
241
+ const c = De(r[p - 1], r[p]);
242
+ if (m <= c) {
243
+ const g = c ? m / c : 0;
244
+ return { path: n, labelX: r[p - 1].x + (r[p].x - r[p - 1].x) * g, labelY: r[p - 1].y + (r[p].y - r[p - 1].y) * g };
245
+ }
246
+ m -= c;
247
+ }
248
+ return { path: n, labelX: d.x, labelY: d.y };
249
+ }
250
+ const ci = ["d"], fi = ["d"], gi = {
251
+ key: 1,
252
+ class: "it-dag-edge__pulses",
253
+ "aria-hidden": "true"
254
+ }, vi = ["path", "dur", "begin"], pi = ["dur", "begin"], mi = ["d"], wn = 8, hi = 24, kn = 6, st = 8, yi = /* @__PURE__ */ Xe({
255
+ inheritAttrs: !1,
256
+ __name: "ItDagEdge",
257
+ props: {
258
+ id: {},
259
+ sourceX: {},
260
+ sourceY: {},
261
+ targetX: {},
262
+ targetY: {},
263
+ sourcePosition: {},
264
+ targetPosition: {},
265
+ data: {}
266
+ },
267
+ setup(i) {
268
+ const l = i, r = dt(ut, null), n = E(() => !!(r != null && r.editable()) && r.hoveredEdge() === l.id), d = E(() => {
269
+ var ie, Q;
270
+ const N = {
271
+ sourceX: l.sourceX,
272
+ sourceY: l.sourceY,
273
+ sourcePosition: l.sourcePosition,
274
+ targetX: l.targetX,
275
+ targetY: l.targetY,
276
+ targetPosition: l.targetPosition
277
+ };
278
+ if (((ie = l.data) == null ? void 0 : ie.shape) === "bezier") {
279
+ const [ae, Ee, Ve] = Co(N);
280
+ return { path: ae, labelX: Ee, labelY: Ve };
281
+ }
282
+ const S = l.sourcePosition === Z.Right || l.sourcePosition === Z.Left, z = ri((Q = l.data) == null ? void 0 : Q.route, { x: l.sourceX, y: l.sourceY }, { x: l.targetX, y: l.targetY }, S);
283
+ if (z) return ui(z, wn);
284
+ const [T, M, A] = Mo({ ...N, borderRadius: wn, offset: hi });
285
+ return { path: T, labelX: M, labelY: A };
286
+ }), y = E(() => ({ transform: `translate(-50%, -50%) translate(${d.value.labelX}px, ${d.value.labelY}px)` })), { viewport: m } = _n(), p = E(() => {
287
+ const N = l.sourcePosition === Z.Right || l.sourcePosition === Z.Left, S = `scale(${1 / (m.value.zoom || 1)})`;
288
+ return N ? { transformOrigin: "0 0", transform: `translate(${d.value.labelX}px, ${Math.min(l.sourceY, l.targetY) - kn}px) ${S} translate(-50%, -100%)` } : { transformOrigin: "0 0", transform: `translate(${Math.max(l.sourceX, l.targetX) + kn}px, ${d.value.labelY}px) ${S} translate(0, -50%)` };
289
+ }), c = { speed: 60, spacing: 56, max: 8 }, g = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, v = E(() => {
290
+ var N;
291
+ return ((N = l.data) == null ? void 0 : N.tone) === "active";
292
+ }), h = E(() => {
293
+ var N;
294
+ return v.value || ((N = l.data) == null ? void 0 : N.tone) === "success";
295
+ }), f = V(null), R = V(0), Y = V(null);
296
+ te(
297
+ [v, () => d.value.path],
298
+ async () => {
299
+ var S, z;
300
+ if (!v.value || g) return;
301
+ await ee(), R.value = typeof ((S = f.value) == null ? void 0 : S.getTotalLength) == "function" ? f.value.getTotalLength() : 0;
302
+ const N = typeof ((z = f.value) == null ? void 0 : z.getBBox) == "function" ? f.value.getBBox() : null;
303
+ Y.value = N ? { x: N.x, y: N.y, width: N.width, height: N.height } : null;
304
+ },
305
+ { immediate: !0 }
306
+ );
307
+ const j = E(() => {
308
+ const N = r == null ? void 0 : r.view(), S = Y.value;
309
+ return !N || !S ? !0 : S.x - st < N.x + N.width && S.x + S.width + st > N.x && S.y - st < N.y + N.height && S.y + S.height + st > N.y;
310
+ }), K = E(() => {
311
+ if (!v.value || g || !R.value || !j.value) return [];
312
+ const N = R.value / c.speed, S = Math.min(c.max, Math.max(1, Math.round(R.value / c.spacing)));
313
+ return Array.from({ length: S }, (z, T) => ({ dur: `${N.toFixed(3)}s`, begin: `${(-(T * N) / S).toFixed(3)}s` }));
314
+ });
315
+ return (N, S) => {
316
+ var z;
317
+ return b(), _(q, null, [
318
+ h.value ? (b(), _("path", {
319
+ key: 0,
320
+ d: d.value.path,
321
+ class: "it-dag-edge__glow",
322
+ fill: "none"
323
+ }, null, 8, ci)) : C("", !0),
324
+ U("path", {
325
+ ref_key: "line",
326
+ ref: f,
327
+ d: d.value.path,
328
+ class: Ie(["vue-flow__edge-path it-dag-edge__path", { "it-dag-edge__path--hot": n.value }]),
329
+ fill: "none"
330
+ }, null, 10, fi),
331
+ K.value.length ? (b(), _("g", gi, [
332
+ (b(!0), _(q, null, ge(K.value, (T, M) => (b(), _("circle", {
333
+ key: M,
334
+ class: "it-dag-edge__pulse",
335
+ r: "2.5"
336
+ }, [
337
+ U("animateMotion", {
338
+ path: d.value.path,
339
+ dur: T.dur,
340
+ begin: T.begin,
341
+ repeatCount: "indefinite"
342
+ }, null, 8, vi),
343
+ U("animate", {
344
+ attributeName: "opacity",
345
+ values: "0;1;1;0",
346
+ keyTimes: "0;0.15;0.85;1",
347
+ dur: T.dur,
348
+ begin: T.begin,
349
+ repeatCount: "indefinite"
350
+ }, null, 8, pi)
351
+ ]))), 128))
352
+ ])) : C("", !0),
353
+ U("path", {
354
+ d: d.value.path,
355
+ class: "vue-flow__edge-interaction",
356
+ fill: "none",
357
+ "stroke-opacity": "0",
358
+ "stroke-width": "16"
359
+ }, null, 8, mi),
360
+ n.value || (z = i.data) != null && z.label ? (b(), O(k(To), { key: 2 }, {
361
+ default: X(() => {
362
+ var T, M, A, ie;
363
+ return [
364
+ n.value ? (b(), _("div", {
365
+ key: 0,
366
+ class: "it-dag-edge__tools nodrag nopan",
367
+ style: rt(p.value),
368
+ onPointerenter: S[3] || (S[3] = (Q) => k(r).hoverEdge(i.id, "tools", !0)),
369
+ onPointerleave: S[4] || (S[4] = (Q) => k(r).hoverEdge(i.id, "tools", !1))
370
+ }, [
371
+ D(ne, {
372
+ icon: k(Ut),
373
+ label: `Add ${k(He)(k(r).noun())} between ${((T = i.data) == null ? void 0 : T.name) ?? `these ${k(r).noun().other}`}`,
374
+ tooltip: `Add ${k(He)(k(r).noun())} here`,
375
+ size: "sm",
376
+ onClick: S[0] || (S[0] = (Q) => k(r).insertOnEdge(i.id))
377
+ }, null, 8, ["icon", "label", "tooltip"]),
378
+ D(ne, {
379
+ icon: k(bo),
380
+ label: `Connection details ${((M = i.data) == null ? void 0 : M.name) ?? ""}`.trim(),
381
+ tooltip: "Connection details",
382
+ size: "sm",
383
+ onClick: S[1] || (S[1] = (Q) => k(r).openConnection(i.id))
384
+ }, null, 8, ["icon", "label"]),
385
+ D(ne, {
386
+ icon: k(En),
387
+ label: `Delete connection ${((A = i.data) == null ? void 0 : A.name) ?? ""}`.trim(),
388
+ tooltip: "Delete connection",
389
+ size: "sm",
390
+ tone: "danger",
391
+ onClick: S[2] || (S[2] = (Q) => k(r).removeEdge(i.id))
392
+ }, null, 8, ["icon", "label"])
393
+ ], 36)) : (ie = i.data) != null && ie.label ? (b(), _("span", {
394
+ key: 1,
395
+ class: Ie(["it-dag-edge__label", `it-dag-edge__label--${i.data.tone ?? "default"}`]),
396
+ style: rt(y.value)
397
+ }, G(i.data.label), 7)) : C("", !0)
398
+ ];
399
+ }),
400
+ _: 1
401
+ })) : C("", !0)
402
+ ], 64);
403
+ };
404
+ }
405
+ }), bi = {
406
+ class: "it-dag-controls",
407
+ role: "group",
408
+ "aria-label": "Canvas view"
409
+ }, wi = /* @__PURE__ */ Xe({
410
+ __name: "ItDagControls",
411
+ setup(i) {
412
+ const l = dt(ut), r = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent), n = r ? "⌘Z" : "Ctrl+Z", d = r ? "⇧⌘Z" : "Ctrl+Shift+Z";
413
+ return (y, m) => (b(), _("div", bi, [
414
+ D(ne, {
415
+ icon: k(Ut),
416
+ label: "Zoom in",
417
+ size: "sm",
418
+ onClick: m[0] || (m[0] = (p) => k(l).zoomIn())
419
+ }, null, 8, ["icon"]),
420
+ D(ne, {
421
+ icon: k(wo),
422
+ label: "Zoom out",
423
+ size: "sm",
424
+ onClick: m[1] || (m[1] = (p) => k(l).zoomOut())
425
+ }, null, 8, ["icon"]),
426
+ D(ne, {
427
+ icon: k(ko),
428
+ label: "Fit to view",
429
+ size: "sm",
430
+ onClick: m[2] || (m[2] = (p) => k(l).fit())
431
+ }, null, 8, ["icon"]),
432
+ D(ne, {
433
+ "data-it-dag-expand": "",
434
+ icon: k(l).expanded() ? k($o) : k(xo),
435
+ label: k(l).expanded() ? "Exit full view" : "Full view",
436
+ tooltip: k(l).expanded() ? "Exit full view (Esc)" : "Full view",
437
+ size: "sm",
438
+ onClick: m[3] || (m[3] = (p) => k(l).toggleExpanded())
439
+ }, null, 8, ["icon", "label", "tooltip"]),
440
+ k(l).editable() ? (b(), _(q, { key: 0 }, [
441
+ m[7] || (m[7] = U("span", {
442
+ class: "it-dag-controls__separator",
443
+ "aria-hidden": "true"
444
+ }, null, -1)),
445
+ D(ne, {
446
+ icon: k(Eo),
447
+ label: "Tidy up",
448
+ tooltip: `Tidy up: arrange every ${k(l).noun().one}`,
449
+ size: "sm",
450
+ onClick: m[4] || (m[4] = (p) => k(l).arrange())
451
+ }, null, 8, ["icon", "tooltip"]),
452
+ k(l).history() ? (b(), _(q, { key: 0 }, [
453
+ D(ne, {
454
+ "data-it-dag-undo": "",
455
+ icon: k(_o),
456
+ label: "Undo",
457
+ tooltip: `Undo (${k(n)})`,
458
+ size: "sm",
459
+ disabled: !k(l).canUndo(),
460
+ onClick: m[5] || (m[5] = (p) => k(l).undo())
461
+ }, null, 8, ["icon", "tooltip", "disabled"]),
462
+ D(ne, {
463
+ "data-it-dag-redo": "",
464
+ icon: k(So),
465
+ label: "Redo",
466
+ tooltip: `Redo (${k(d)})`,
467
+ size: "sm",
468
+ disabled: !k(l).canRedo(),
469
+ onClick: m[6] || (m[6] = (p) => k(l).redo())
470
+ }, null, 8, ["icon", "tooltip", "disabled"])
471
+ ], 64)) : C("", !0)
472
+ ], 64)) : C("", !0)
473
+ ]));
474
+ }
475
+ }), ki = { class: "it-dag-library" }, $i = ["aria-label"], xi = {
476
+ key: 0,
477
+ class: "it-dag-library__heading"
478
+ }, Ei = {
479
+ class: "it-dag-library__grid",
480
+ role: "list"
481
+ }, _i = ["onClick"], Si = { class: "it-dag-library__text" }, Pi = { class: "it-dag-library__label" }, Ni = {
482
+ key: 0,
483
+ class: "it-dag-library__description"
484
+ }, Ci = {
485
+ key: 1,
486
+ class: "it-dag-library__description"
487
+ }, Mi = {
488
+ key: 0,
489
+ class: "it-dag-library__empty"
490
+ }, Ti = /* @__PURE__ */ Xe({
491
+ __name: "ItDagLibrary",
492
+ props: {
493
+ visible: { type: Boolean },
494
+ items: {},
495
+ description: {},
496
+ misfits: {},
497
+ noun: {}
498
+ },
499
+ emits: ["update:visible", "pick"],
500
+ setup(i, { emit: l }) {
501
+ const r = i, n = l, d = V(""), y = E(() => r.noun ?? Yt), m = E(() => `Not between these ${y.value.other} · added at the end, unconnected`), p = E(() => {
502
+ var h;
503
+ const c = d.value.trim().toLowerCase(), g = /* @__PURE__ */ new Map(), v = [];
504
+ for (const f of r.items) {
505
+ if (c && !`${f.label} ${f.description ?? ""} ${f.group ?? ""}`.toLowerCase().includes(c)) continue;
506
+ if ((h = r.misfits) != null && h[f.key]) {
507
+ v.push(f);
508
+ continue;
509
+ }
510
+ const R = f.group ?? "";
511
+ g.set(R, [...g.get(R) ?? [], f]);
512
+ }
513
+ return v.length && g.set(m.value, v), [...g].map(([f, R]) => ({ title: f, items: R, misfit: f === m.value && v.length > 0 }));
514
+ });
515
+ return te(
516
+ () => r.visible,
517
+ (c) => {
518
+ c && (d.value = "");
519
+ }
520
+ ), (c, g) => (b(), O(At, {
521
+ visible: i.visible,
522
+ title: `Add ${k(He)(y.value)}`,
523
+ description: i.description,
524
+ size: "lg",
525
+ "onUpdate:visible": g[1] || (g[1] = (v) => n("update:visible", v))
526
+ }, {
527
+ default: X(() => [
528
+ U("div", ki, [
529
+ D(Lo, {
530
+ modelValue: d.value,
531
+ "onUpdate:modelValue": g[0] || (g[0] = (v) => d.value = v),
532
+ label: `Search ${y.value.other}`,
533
+ placeholder: `Search ${y.value.other}`
534
+ }, null, 8, ["modelValue", "label", "placeholder"]),
535
+ (b(!0), _(q, null, ge(p.value, (v) => (b(), _("section", {
536
+ key: v.title,
537
+ class: "it-dag-library__group",
538
+ "aria-label": v.title || void 0
539
+ }, [
540
+ v.title ? (b(), _("h3", xi, G(v.title), 1)) : C("", !0),
541
+ U("ul", Ei, [
542
+ (b(!0), _(q, null, ge(v.items, (h) => (b(), _("li", {
543
+ key: h.key
544
+ }, [
545
+ U("button", {
546
+ type: "button",
547
+ class: Ie(["it-dag-library__item", { "it-dag-library__item--misfit": v.misfit }]),
548
+ onClick: (f) => n("pick", h)
549
+ }, [
550
+ h.platform ? (b(), O(Sn, {
551
+ key: 0,
552
+ class: "it-dag-library__icon",
553
+ platform: h.platform,
554
+ size: 20
555
+ }, null, 8, ["platform"])) : h.icon ? (b(), O(fe(h.icon), {
556
+ key: 1,
557
+ class: "it-dag-library__icon",
558
+ size: 16,
559
+ "aria-hidden": "true"
560
+ })) : C("", !0),
561
+ U("span", Si, [
562
+ ye((b(), _("span", Pi, [
563
+ be(G(h.label), 1)
564
+ ])), [
565
+ [k(we)]
566
+ ]),
567
+ v.misfit ? (b(), _("span", Ni, G(i.misfits[h.key]), 1)) : h.description ? (b(), _("span", Ci, G(h.description), 1)) : C("", !0),
568
+ h.status ? (b(), O(Pn, {
569
+ key: 2,
570
+ class: "it-dag-library__status",
571
+ status: h.status
572
+ }, null, 8, ["status"])) : C("", !0)
573
+ ])
574
+ ], 10, _i)
575
+ ]))), 128))
576
+ ])
577
+ ], 8, $i))), 128)),
578
+ p.value.length ? C("", !0) : (b(), _("p", Mi, "No " + G(y.value.other) + " match “" + G(d.value) + "”.", 1))
579
+ ])
580
+ ]),
581
+ _: 1
582
+ }, 8, ["visible", "title", "description"]));
583
+ }
584
+ }), Di = (i, l) => i === l || !!i && !!l && i.x === l.x && i.y === l.y;
585
+ function $n(i, l) {
586
+ const r = new Set(i.map((d) => d.id)), n = new Set(l.map((d) => d.id));
587
+ return {
588
+ added: l.flatMap((d, y) => r.has(d.id) ? [] : [{ item: d, index: y }]),
589
+ removed: i.flatMap((d, y) => n.has(d.id) ? [] : [{ item: d, index: y }])
590
+ };
591
+ }
592
+ function Ri(i, l) {
593
+ const r = $n(i.nodes, l.nodes), n = $n(i.edges, l.edges), d = new Map(i.nodes.map((c) => [c.id, c.position])), y = l.nodes.flatMap((c) => d.has(c.id) && !Di(d.get(c.id), c.position) ? [{ id: c.id, from: d.get(c.id), to: c.position }] : []), m = {
594
+ addedNodes: r.added.map(({ item: c, index: g }) => ({ node: c, index: g })),
595
+ removedNodes: r.removed.map(({ item: c, index: g }) => ({ node: c, index: g })),
596
+ addedEdges: n.added.map(({ item: c, index: g }) => ({ edge: c, index: g })),
597
+ removedEdges: n.removed.map(({ item: c, index: g }) => ({ edge: c, index: g })),
598
+ moved: y
599
+ };
600
+ return !m.addedNodes.length && !m.removedNodes.length && !m.addedEdges.length && !m.removedEdges.length && !y.length ? null : m;
601
+ }
602
+ function Nn(i, l) {
603
+ const r = [...i];
604
+ for (const { item: n, index: d } of [...l].sort((y, m) => y.index - m.index))
605
+ r.some((y) => y.id === n.id) || r.splice(Math.min(d, r.length), 0, n);
606
+ return r;
607
+ }
608
+ function Ii(i, l, r) {
609
+ const n = new Set((r === "undo" ? i.addedNodes : i.removedNodes).map(({ node: p }) => p.id)), d = (r === "undo" ? i.removedNodes : i.addedNodes).map(({ node: p, index: c }) => ({ item: p, index: c })), y = new Map(i.moved.map((p) => [p.id, r === "undo" ? p.from : p.to])), m = l.filter((p) => !n.has(p.id)).map((p) => y.has(p.id) ? { ...p, position: y.get(p.id) } : p);
610
+ return Nn(m, d);
611
+ }
612
+ function zi(i, l, r, n) {
613
+ const d = new Set(r.map((g) => g.id)), y = new Set((n === "undo" ? i.addedNodes : i.removedNodes).map(({ node: g }) => g.id)), m = new Set((n === "undo" ? i.addedEdges : i.removedEdges).map(({ edge: g }) => g.id)), p = (n === "undo" ? i.removedEdges : i.addedEdges).filter(({ edge: g }) => d.has(g.source) && d.has(g.target)).map(({ edge: g, index: v }) => ({ item: g, index: v })), c = l.filter((g) => !m.has(g.id) && !y.has(g.source) && !y.has(g.target));
614
+ return Nn(c, p);
615
+ }
616
+ const oe = { node: 32, layer: 96, lead: 24 };
617
+ let lt = null;
618
+ async function Li() {
619
+ if (typeof Worker > "u" || typeof Blob > "u" || typeof URL.createObjectURL != "function") throw new Error("No Web Worker here.");
620
+ const [i, l] = await Promise.all([import("elkjs/lib/elk-api.js"), import("./elk-worker.min-O2A22ecl.js")]);
621
+ if (typeof l.default != "string") throw new Error("The ELK worker script did not load as text.");
622
+ const r = URL.createObjectURL(new Blob([l.default], { type: "text/javascript" }));
623
+ let n, d;
624
+ try {
625
+ n = new Worker(r);
626
+ const c = new Promise((g, v) => {
627
+ n.addEventListener("message", () => g(), { once: !0 }), n.addEventListener("error", (h) => v(new Error(h.message || "The ELK worker did not start.")), { once: !0 });
628
+ });
629
+ d = new i.default({ workerFactory: () => n }), await c;
630
+ } catch (c) {
631
+ throw n == null || n.terminate(), c;
632
+ } finally {
633
+ URL.revokeObjectURL(r);
634
+ }
635
+ let y = () => {
636
+ };
637
+ const m = new Promise((c, g) => y = g);
638
+ m.catch(() => {
639
+ }), n.addEventListener("error", (c) => {
640
+ n.terminate(), lt = null, y(new Error(c.message || "The ELK worker stopped."));
641
+ });
642
+ const p = d.layout.bind(d);
643
+ return d.layout = (c, g) => Promise.race([p(c, g), m]), d;
644
+ }
645
+ async function Oi() {
646
+ const i = await import("elkjs/lib/elk.bundled.js");
647
+ return new i.default();
648
+ }
649
+ function Cn() {
650
+ return lt ?? (lt = Li().catch(() => Oi()).catch((i) => {
651
+ throw lt = null, i;
652
+ })), lt;
653
+ }
654
+ function Fi() {
655
+ Cn().catch(() => {
656
+ });
657
+ }
658
+ const Bt = (i, l, r) => `${i}::${l}::${r}`;
659
+ function Mn(i) {
660
+ const l = i.portOffsets;
661
+ return !!l && l.inputs.length === i.inputs.length && l.outputs.length === i.outputs.length;
662
+ }
663
+ function Ai(i, l) {
664
+ var c, g;
665
+ const r = l === "down", n = r ? "NORTH" : "WEST", d = r ? "SOUTH" : "EAST", y = Mn(i), m = (v, h) => r ? { x: h, y: v === "in" ? 0 : i.height } : { x: v === "in" ? 0 : i.width, y: h }, p = (v, h, f, R, Y) => h.map((j, K) => {
666
+ const N = { "elk.port.side": R };
667
+ return y || (N["elk.port.index"] = String(Y ? h.length - 1 - K : K)), { id: Bt(i.id, v, j), width: 0, height: 0, ...y ? m(v, f[K]) : {}, layoutOptions: N };
668
+ });
669
+ return [
670
+ ...p("in", i.inputs, (c = i.portOffsets) == null ? void 0 : c.inputs, n, n === "WEST"),
671
+ ...p("out", i.outputs, (g = i.portOffsets) == null ? void 0 : g.outputs, d, d === "SOUTH")
672
+ ];
673
+ }
674
+ async function Tn(i, l, r = "right") {
675
+ var g;
676
+ const n = new Map(i.map((v) => [v.id, v])), d = l.filter((v) => {
677
+ var h, f;
678
+ return ((h = n.get(v.source)) == null ? void 0 : h.outputs.includes(v.sourcePort)) && ((f = n.get(v.target)) == null ? void 0 : f.inputs.includes(v.targetPort));
679
+ }).map((v) => ({ id: v.id, sources: [Bt(v.source, "out", v.sourcePort)], targets: [Bt(v.target, "in", v.targetPort)] })), y = {
680
+ id: "root",
681
+ layoutOptions: {
682
+ "elk.algorithm": "layered",
683
+ "elk.direction": r === "down" ? "DOWN" : "RIGHT",
684
+ "elk.edgeRouting": "ORTHOGONAL",
685
+ "elk.spacing.nodeNode": String(oe.node),
686
+ "elk.layered.spacing.nodeNodeBetweenLayers": String(oe.layer),
687
+ "elk.layered.spacing.edgeNodeBetweenLayers": String(oe.lead),
688
+ "elk.layered.spacing.edgeEdgeBetweenLayers": "12",
689
+ "elk.spacing.edgeNode": String(oe.node / 2),
690
+ "elk.spacing.edgeEdge": "12",
691
+ "elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
692
+ "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES"
693
+ },
694
+ children: i.map((v) => ({
695
+ id: v.id,
696
+ width: v.width,
697
+ height: v.height,
698
+ layoutOptions: { "elk.portConstraints": Mn(v) ? "FIXED_POS" : "FIXED_ORDER" },
699
+ ports: Ai(v, r)
700
+ })),
701
+ edges: d
702
+ }, m = await (await Cn()).layout(y), p = new Map((m.children ?? []).map((v) => [v.id, { x: Math.round(v.x ?? 0), y: Math.round(v.y ?? 0) }])), c = /* @__PURE__ */ new Map();
703
+ for (const v of m.edges ?? []) {
704
+ const h = ((g = v.sections) == null ? void 0 : g.length) === 1 ? v.sections[0] : void 0;
705
+ h && c.set(v.id, { start: h.startPoint, bends: h.bendPoints ?? [], end: h.endPoint });
706
+ }
707
+ return { positions: p, routes: c };
708
+ }
709
+ function Bi(i, l, r = "right") {
710
+ var c;
711
+ const n = new Map(i.map((g) => [g.id, 0]));
712
+ for (let g = 0; g < i.length; g++) {
713
+ let v = !1;
714
+ for (const h of l) {
715
+ const f = (n.get(h.source) ?? 0) + 1;
716
+ n.has(h.target) && f > n.get(h.target) && (n.set(h.target, f), v = !0);
717
+ }
718
+ if (!v) break;
719
+ }
720
+ const d = [];
721
+ for (const g of i) (d[c = n.get(g.id)] ?? (d[c] = [])).push(g);
722
+ const y = r === "down", m = /* @__PURE__ */ new Map();
723
+ let p = 0;
724
+ for (const g of d) {
725
+ if (!g) continue;
726
+ let v = 0, h = 0;
727
+ for (const f of g)
728
+ m.set(f.id, y ? { x: v, y: p } : { x: p, y: v }), v += (y ? f.width : f.height) + oe.node, h = Math.max(h, y ? f.height : f.width);
729
+ p += h + oe.layer;
730
+ }
731
+ return m;
732
+ }
733
+ async function na(i, l, r = "right") {
734
+ return (await Tn(i, l, r)).positions;
735
+ }
736
+ const Ui = ["role", "aria-modal", "aria-label", "tabindex"], Yi = {
737
+ key: 0,
738
+ class: "it-dag__fade it-dag__fade--start",
739
+ "aria-hidden": "true"
740
+ }, Hi = {
741
+ key: 1,
742
+ class: "it-dag__fade it-dag__fade--end",
743
+ "aria-hidden": "true"
744
+ }, Xi = {
745
+ key: 0,
746
+ class: "it-dag__empty"
747
+ }, Vi = {
748
+ key: 0,
749
+ class: "it-dag__editor"
750
+ }, Wi = {
751
+ key: 0,
752
+ class: "it-dag__editor"
753
+ }, ji = 4e3, xn = 1.5, Zi = "\0it-dag-preview", oa = /* @__PURE__ */ Xe({
754
+ __name: "ItDagCanvas",
755
+ props: {
756
+ nodes: {},
757
+ edges: {},
758
+ label: {},
759
+ editable: { type: Boolean, default: !1 },
760
+ direction: { default: "right" },
761
+ edgeShape: { default: "step" },
762
+ allowCycles: { type: Boolean, default: !1 },
763
+ connectionRule: { type: Function, default: void 0 },
764
+ selected: { default: null },
765
+ library: { default: void 0 },
766
+ height: { default: 480 },
767
+ editorSize: { default: "md" },
768
+ emptyTitle: { default: void 0 },
769
+ emptyDescription: { default: "" },
770
+ noun: { default: () => Yt },
771
+ beforeRemove: { type: Function, default: void 0 },
772
+ editor: { default: "modal" },
773
+ history: { type: [Boolean, Object], default: !1 },
774
+ fitMinZoom: { default: void 0 },
775
+ minZoom: { default: void 0 },
776
+ wheel: { default: "page" }
777
+ },
778
+ emits: ["update:nodes", "update:edges", "update:selected", "create", "open"],
779
+ setup(i, { expose: l, emit: r }) {
780
+ const n = i, d = r, y = { width: 240, height: 56 }, m = { padding: 32, maxZoom: 1 }, p = E(() => n.fitMinZoom ?? n.minZoom ?? 0.75), c = E(() => Math.min(0.25, p.value));
781
+ te(() => n.minZoom, (e) => {
782
+ e !== void 0 && Oo("ItDagCanvas minZoom is deprecated. Use fitMinZoom for the Fit to view minimum.");
783
+ }, { immediate: !0 });
784
+ const g = { it: co(yi) }, v = ["Backspace", "Delete"], h = `it-dag-${fo()}`, f = _n(h), R = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
785
+ typeof window < "u" && (n.nodes.some((e) => !e.position) || n.edgeShape !== "bezier" && n.edges.length) && Fi();
786
+ const Y = V({}), j = V({});
787
+ function K(e) {
788
+ return [[e.kind, e.label].filter(Boolean).join(": "), e.platform ? Io(e.platform).name : "", e.status ? Ft(e.status).label : ""].filter(Boolean).join(", ");
789
+ }
790
+ const N = { active: "running", success: "taken", danger: "failed", muted: "not taken" }, S = E(
791
+ () => n.nodes.map((e) => ({
792
+ id: e.id,
793
+ type: "it",
794
+ position: e.position ?? Y.value[e.id] ?? { x: 0, y: 0 },
795
+ data: e,
796
+ draggable: n.editable,
797
+ connectable: n.editable,
798
+ deletable: n.editable && e.removable !== !1,
799
+ selectable: !0,
800
+ ariaLabel: K(e)
801
+ }))
802
+ );
803
+ function z() {
804
+ for (const e of f.getNodes.value) {
805
+ const t = e.id === n.selected;
806
+ e.selected !== t && (e.selected = t);
807
+ }
808
+ }
809
+ te([() => n.selected, S], z, { flush: "post" }), go(z);
810
+ const T = E(() => new Map(n.nodes.map((e) => [e.id, e]))), M = E(() => new Set(n.edges.map((e) => e.id))), A = (e) => {
811
+ var t;
812
+ return ((t = T.value.get(e)) == null ? void 0 : t.label) ?? e;
813
+ }, ie = E(
814
+ () => n.edges.map((e) => {
815
+ const t = ke(e, T.value), o = `${A(e.source)} to ${A(e.target)}`;
816
+ return {
817
+ ariaLabel: [o, e.label, e.tone && N[e.tone]].filter(Boolean).join(", "),
818
+ id: e.id,
819
+ source: e.source,
820
+ target: e.target,
821
+ sourceHandle: `out:${t.sourcePort}`,
822
+ targetHandle: `in:${t.targetPort}`,
823
+ type: "it",
824
+ class: `it-dag-edge it-dag-edge--${e.tone ?? "default"}`,
825
+ data: { label: e.label, tone: e.tone, shape: n.edgeShape, name: o, route: j.value[e.id] },
826
+ selectable: n.editable,
827
+ deletable: n.editable,
828
+ // Focusable on every canvas: Enter opens the connection, read-only or not.
829
+ // Vue Flow writes `tabIndex`, which an SVG element ignores (its attribute
830
+ // names are case-sensitive); the lowercase attribute makes the line focusable.
831
+ focusable: !0,
832
+ domAttributes: { tabindex: 0 }
833
+ };
834
+ })
835
+ ), Q = E(() => n.nodes.some((e) => !e.position && !Y.value[e.id])), ae = V(n.nodes.length > 0);
836
+ te(
837
+ () => n.nodes.length === 0,
838
+ (e) => {
839
+ e && (ae.value = !1);
840
+ }
841
+ );
842
+ let Ee = !1;
843
+ const Ve = E(() => f.getNodes.value.length ? mn(f.getNodes.value) : null), Dn = E(() => {
844
+ const e = Ve.value;
845
+ if (!e || !f.dimensions.value.width) return !1;
846
+ const { x: t, zoom: o } = f.viewport.value;
847
+ return t + e.x * o < -1;
848
+ }), Rn = E(() => {
849
+ const e = Ve.value, t = f.dimensions.value.width;
850
+ if (!e || !t) return !1;
851
+ const { x: o, zoom: s } = f.viewport.value;
852
+ return o + (e.x + e.width) * s > t + 1;
853
+ });
854
+ function In(e) {
855
+ var o;
856
+ const t = (o = e.closest(".it-dag")) == null ? void 0 : o.querySelector(".it-dag-controls");
857
+ return t ? Math.max(m.padding, t.getBoundingClientRect().right - e.getBoundingClientRect().left + m.padding / 2) : m.padding;
858
+ }
859
+ async function _e() {
860
+ const e = f.vueFlowRef.value, t = f.getNodes.value;
861
+ if (!e || !t.length) return;
862
+ const o = mn(t), s = In(e), a = { width: e.clientWidth - s - m.padding, height: e.clientHeight - 2 * m.padding }, u = Math.min(m.maxZoom, Math.max(p.value, Math.min(a.width / o.width, a.height / o.height))), $ = (w, P, I, L) => (w * u <= P ? L + (P - w * u) / 2 : L) - I * u;
863
+ await f.setViewport(
864
+ { x: $(o.width, a.width, o.x, s), y: $(o.height, a.height, o.y, m.padding), zoom: u },
865
+ { duration: Ee && !R && !ae.value ? 200 : 0 }
866
+ ), Ee = !0, ft();
867
+ }
868
+ function ct(e, t) {
869
+ var s;
870
+ const o = (s = f.findNode(e)) == null ? void 0 : s.handleBounds;
871
+ return [...(o == null ? void 0 : o.source) ?? [], ...(o == null ? void 0 : o.target) ?? []].find((a) => a.id === t) ?? null;
872
+ }
873
+ function Ht(e) {
874
+ return e.position === Z.Left ? { x: e.x, y: e.y + e.height / 2 } : e.position === Z.Right ? { x: e.x + e.width, y: e.y + e.height / 2 } : e.position === Z.Top ? { x: e.x + e.width / 2, y: e.y } : { x: e.x + e.width / 2, y: e.y + e.height };
875
+ }
876
+ function zn(e, t, o) {
877
+ const s = n.direction === "down", a = s ? [Z.Top, Z.Bottom] : [Z.Left, Z.Right], u = (I, L) => L.map((W) => ct(e.id, `${I}:${W}`)), $ = u("in", t), w = u("out", o);
878
+ if (![...$, ...w].every((I) => I && a.includes(I.position))) return;
879
+ const P = (I) => s ? I.x + I.width / 2 : I.y + I.height / 2;
880
+ return { inputs: $.map(P), outputs: w.map(P) };
881
+ }
882
+ let We = 0;
883
+ const Xt = /* @__PURE__ */ new Set();
884
+ async function ze(e = "all", t = !1) {
885
+ if (!n.nodes.length) return;
886
+ const o = ++We;
887
+ e === "unplaced" && (ae.value = !0);
888
+ try {
889
+ await Ln(e, o, t);
890
+ } catch {
891
+ if (o === We && e !== "routes") {
892
+ const s = Bi(...Vt()), a = { ...Y.value };
893
+ for (const u of n.nodes) !u.position && !a[u.id] && s.has(u.id) && (a[u.id] = s.get(u.id));
894
+ Y.value = a, await ee(), await _e();
895
+ }
896
+ } finally {
897
+ o === We && e !== "routes" && ae.value && await je();
898
+ }
899
+ }
900
+ function Vt() {
901
+ const e = n.nodes.map((o) => {
902
+ var $;
903
+ const s = ($ = f.findNode(o.id)) == null ? void 0 : $.dimensions, a = $e(o).map((w) => w.id), u = xe(o).map((w) => w.id);
904
+ return {
905
+ id: o.id,
906
+ width: (s == null ? void 0 : s.width) || y.width,
907
+ height: (s == null ? void 0 : s.height) || y.height,
908
+ inputs: a,
909
+ outputs: u,
910
+ portOffsets: zn(o, a, u)
911
+ };
912
+ }), t = n.edges.flatMap((o) => {
913
+ const { sourcePort: s, targetPort: a } = ke(o, T.value);
914
+ return s && a ? [{ id: o.id, source: o.source, target: o.target, sourcePort: s, targetPort: a }] : [];
915
+ });
916
+ return [e, t, n.direction];
917
+ }
918
+ async function Ln(e, t, o) {
919
+ const [s, a, u] = Vt(), { positions: $, routes: w } = await Tn(s, a, u);
920
+ if (t !== We) return;
921
+ const P = (x) => (e === "all" || !x.position) && $.has(x.id), I = (x) => {
922
+ const B = T.value.get(x);
923
+ if (B)
924
+ return P(B) ? $.get(x) : B.position ?? Y.value[x];
925
+ }, L = (x) => {
926
+ const B = $.get(x), J = I(x);
927
+ return !!B && !!J && Math.abs(B.x - J.x) <= xn && Math.abs(B.y - J.y) <= xn;
928
+ }, W = {};
929
+ for (const x of a) {
930
+ Xt.add(x.id);
931
+ const B = w.get(x.id), J = ct(x.source, `out:${x.sourcePort}`), fn = ct(x.target, `in:${x.targetPort}`), It = $.get(x.source), zt = $.get(x.target);
932
+ if (B && J && fn && It && zt && L(x.source) && L(x.target)) {
933
+ const gn = Ht(J), vn = Ht(fn);
934
+ W[x.id] = { from: { x: It.x + gn.x, y: It.y + gn.y }, to: { x: zt.x + vn.x, y: zt.y + vn.y }, bends: B.bends };
935
+ } else j.value[x.id] && (W[x.id] = j.value[x.id]);
936
+ }
937
+ if (j.value = W, e === "routes") return;
938
+ const H = { ...Y.value };
939
+ for (const x of n.nodes) P(x) && (H[x.id] = $.get(x.id));
940
+ if (Y.value = H, n.editable) {
941
+ const x = { nodes: n.nodes, edges: n.edges }, B = n.nodes.map((J) => P(J) ? { ...J, position: $.get(J.id) } : J);
942
+ d("update:nodes", B), o && Ce(x, { nodes: B, edges: n.edges });
943
+ }
944
+ await ee(), await _e(), await je();
945
+ }
946
+ async function je() {
947
+ await new Promise((t) => requestAnimationFrame(t)), ae.value = !1;
948
+ const e = Rt;
949
+ Rt = null, e && cn(e);
950
+ }
951
+ function On() {
952
+ if (Q.value) return void ze("unplaced");
953
+ Ee ? ae.value && je() : _e().then(je), n.edgeShape !== "bezier" && n.edges.some((e) => !Xt.has(e.id)) && ze("routes");
954
+ }
955
+ te(
956
+ () => n.direction,
957
+ async () => {
958
+ await ee(), f.updateNodeInternals(n.nodes.map((e) => e.id)), await ee(), await ze("all");
959
+ }
960
+ ), vo(() => {
961
+ const e = f.vueFlowRef.value;
962
+ if (!e) return;
963
+ const { x: t, y: o, zoom: s } = f.viewport.value;
964
+ e.style.backgroundSize = `${16 * s}px ${16 * s}px`, e.style.backgroundPosition = `${t}px ${o}px`;
965
+ });
966
+ const Wt = Lt(null);
967
+ let Ze;
968
+ function ft() {
969
+ clearTimeout(Ze);
970
+ const { x: e, y: t, zoom: o } = f.viewport.value, { width: s, height: a } = f.dimensions.value;
971
+ !s || !a || !o || (Wt.value = { x: -e / o, y: -t / o, width: s / o, height: a / o });
972
+ }
973
+ f.onMoveEnd(ft), te(
974
+ () => [f.viewport.value.x, f.viewport.value.y, f.viewport.value.zoom, f.dimensions.value.width, f.dimensions.value.height],
975
+ () => {
976
+ clearTimeout(Ze), Ze = setTimeout(ft, 120);
977
+ }
978
+ ), ot(() => clearTimeout(Ze));
979
+ const gt = V(!1), Ke = V("");
980
+ let vt, pt = !1, Se = null;
981
+ function re(e) {
982
+ Ke.value = e, clearTimeout(vt), vt = setTimeout(() => Ke.value = "", ji);
983
+ }
984
+ ot(() => clearTimeout(vt));
985
+ function jt(e) {
986
+ const { sourceHandle: t, targetHandle: o } = e;
987
+ return !(t != null && t.startsWith("out:")) || !(o != null && o.startsWith("in:")) ? null : { source: e.source, sourcePort: t.slice(4), target: e.target, targetPort: o.slice(3) };
988
+ }
989
+ function Zt(e) {
990
+ var o;
991
+ const t = jt(e);
992
+ return t ? yn(n.nodes, n.edges, t, { allowCycles: n.allowCycles, noun: n.noun }) ?? ((o = n.connectionRule) == null ? void 0 : o.call(n, t)) ?? null : "Connect an output to an input.";
993
+ }
994
+ function Fn(e) {
995
+ const t = e.id;
996
+ return t && M.value.has(t) ? !0 : (Se = Zt(e), !Se);
997
+ }
998
+ function An() {
999
+ gt.value = !0, pt = !1, Se = null;
1000
+ }
1001
+ function Bn(e) {
1002
+ const t = jt(e);
1003
+ if (!t || Zt(e)) return;
1004
+ pt = !0;
1005
+ const o = [...n.edges, { id: at(t), ...t }];
1006
+ d("update:edges", o), Ce({ nodes: n.nodes, edges: n.edges }, { nodes: n.nodes, edges: o });
1007
+ }
1008
+ function Un() {
1009
+ gt.value = !1, !pt && Se && f.connectionStatus.value === "invalid" && re(Se), Se = null;
1010
+ }
1011
+ let qe = /* @__PURE__ */ new Set(), Ge = /* @__PURE__ */ new Set(), mt = !1;
1012
+ function Kt() {
1013
+ mt || (mt = !0, queueMicrotask(() => {
1014
+ mt = !1;
1015
+ const e = qe, t = Ge;
1016
+ qe = /* @__PURE__ */ new Set(), Ge = /* @__PURE__ */ new Set(), ht(e, t);
1017
+ }));
1018
+ }
1019
+ function ht(e, t) {
1020
+ const o = { nodes: n.nodes, edges: n.edges }, s = e.size ? n.nodes.filter((u) => !e.has(u.id)) : n.nodes, a = n.edges.filter((u) => !t.has(u.id) && !e.has(u.source) && !e.has(u.target));
1021
+ e.size && d("update:nodes", s), d("update:edges", a), n.selected && e.has(n.selected) && d("update:selected", null), Ce(o, { nodes: s, edges: a });
1022
+ }
1023
+ async function yt(e) {
1024
+ if (!n.beforeRemove) return !0;
1025
+ try {
1026
+ return await n.beforeRemove(e) !== !1;
1027
+ } catch {
1028
+ return !1;
1029
+ }
1030
+ }
1031
+ async function Yn() {
1032
+ const e = new Set(f.getSelectedNodes.value.filter((a) => a.deletable !== !1).map((a) => a.id)), t = new Set(f.getSelectedEdges.value.filter((a) => a.deletable !== !1).map((a) => a.id)), o = n.nodes.filter((a) => e.has(a.id)), s = n.edges.filter((a) => t.has(a.id) || e.has(a.source) || e.has(a.target));
1033
+ !o.length && !s.length || await yt({ nodes: o, edges: s }) && ht(e, t);
1034
+ }
1035
+ function Hn(e) {
1036
+ var s, a;
1037
+ const t = /* @__PURE__ */ new Map();
1038
+ let o;
1039
+ for (const u of e)
1040
+ if (u.type === "remove" && n.editable) qe.add(u.id);
1041
+ else if (u.type === "position" && !u.dragging && n.editable) {
1042
+ const $ = u.position ?? ((s = f.findNode(u.id)) == null ? void 0 : s.position);
1043
+ $ && t.set(u.id, { x: Math.round($.x), y: Math.round($.y) });
1044
+ } else u.type === "select" && (u.selected ? o = u.id : u.id === n.selected && o === void 0 && (o = null));
1045
+ qe.size && Kt();
1046
+ for (const [u, $] of t) {
1047
+ const w = (a = T.value.get(u)) == null ? void 0 : a.position;
1048
+ w && w.x === $.x && w.y === $.y && t.delete(u);
1049
+ }
1050
+ if (t.size) {
1051
+ const u = n.nodes.map(($) => t.has($.id) ? { ...$, position: t.get($.id) } : $);
1052
+ d("update:nodes", u), Ce({ nodes: n.nodes, edges: n.edges }, { nodes: u, edges: n.edges });
1053
+ }
1054
+ o !== void 0 && o !== n.selected && d("update:selected", o);
1055
+ }
1056
+ function Xn(e) {
1057
+ if (n.editable) {
1058
+ for (const t of e) t.type === "remove" && Ge.add(t.id);
1059
+ Ge.size && Kt();
1060
+ }
1061
+ }
1062
+ const Le = V(!1);
1063
+ let qt = null;
1064
+ const Oe = E(() => {
1065
+ var e;
1066
+ return n.editable && !!((e = n.library) != null && e.length);
1067
+ }), Pe = V(null);
1068
+ let bt = null;
1069
+ function wt(e = null) {
1070
+ qt = e, Le.value = !0;
1071
+ }
1072
+ const Gt = E(() => {
1073
+ const e = Pe.value;
1074
+ if (!e || !n.library) return {};
1075
+ const t = {};
1076
+ for (const o of n.library) {
1077
+ if (!o.inputs && !o.outputs) continue;
1078
+ const s = sn(e, { id: Zi, label: o.label, inputs: o.inputs, outputs: o.outputs });
1079
+ (!s.into || !s.out) && (t[o.key] = s.reason ?? "It does not fit here.");
1080
+ }
1081
+ return t;
1082
+ }), Vn = E(() => {
1083
+ const e = Pe.value;
1084
+ return e ? `Between ${A(e.source)} and ${A(e.target)}.` : void 0;
1085
+ });
1086
+ function Wn(e) {
1087
+ const t = Pe.value, o = t ? Gt.value[e.key] : void 0;
1088
+ Le.value = !1, Pe.value = null, bt = { known: new Set(n.nodes.map((s) => s.id)), edge: t && !o ? t : void 0 }, t && !o ? en(e, Zn(t)) : (t && o && re(`${e.label} is at the end of the chain, not connected: ${o}`), en(e, qt ?? void 0));
1089
+ }
1090
+ te(Le, (e) => {
1091
+ e || queueMicrotask(() => Pe.value = null);
1092
+ });
1093
+ function jn(e) {
1094
+ const t = e.target instanceof Element ? e.target : null;
1095
+ if (!Oe.value || !(t != null && t.closest(".vue-flow__pane")) || t.closest(".vue-flow__node, .vue-flow__edge, .vue-flow__panel")) return;
1096
+ const o = Qt(e.clientX, e.clientY);
1097
+ wt({ x: o.x - y.width / 2, y: o.y - y.height / 2 });
1098
+ }
1099
+ function Qt(e, t) {
1100
+ var a;
1101
+ const o = (a = f.vueFlowRef.value) == null ? void 0 : a.getBoundingClientRect(), s = f.project({ x: e - ((o == null ? void 0 : o.left) ?? 0), y: t - ((o == null ? void 0 : o.top) ?? 0) });
1102
+ return { x: Math.round(s.x), y: Math.round(s.y) };
1103
+ }
1104
+ const Jt = (e) => ({ x: Math.round(e.x / 8) * 8, y: Math.round(e.y / 8) * 8 }), Fe = E(() => n.direction !== "down"), ve = (e) => ({ width: e.dimensions.width || y.width, height: e.dimensions.height || y.height });
1105
+ function en(e, t) {
1106
+ n.editable && d("create", { item: e, position: Jt(t ?? kt()) });
1107
+ }
1108
+ function kt() {
1109
+ var a;
1110
+ const e = f.getNodes.value;
1111
+ if (!e.length) {
1112
+ const u = (a = f.vueFlowRef.value) == null ? void 0 : a.getBoundingClientRect(), $ = u ? Qt(u.left + u.width / 2, u.top + u.height / 2) : { x: 0, y: 0 };
1113
+ return { x: $.x - y.width / 2, y: $.y - y.height / 2 };
1114
+ }
1115
+ const t = (u) => Fe.value ? u.position.x + ve(u).width : u.position.y + ve(u).height, o = e.reduce((u, $) => t($) > t(u) ? $ : u), s = Fe.value ? { x: t(o) + oe.layer, y: o.position.y } : { x: o.position.x, y: t(o) + oe.layer };
1116
+ return Gn(s);
1117
+ }
1118
+ function Zn(e) {
1119
+ const t = f.findNode(e.source), o = f.findNode(e.target);
1120
+ return !t || !o ? kt() : Fe.value ? { x: t.position.x + ve(t).width + oe.layer, y: o.position.y } : { x: o.position.x, y: t.position.y + ve(t).height + oe.layer };
1121
+ }
1122
+ async function Kn(e) {
1123
+ for (let t = 0; t < 12; t += 1) {
1124
+ const o = f.findNode(e);
1125
+ if (o != null && o.dimensions.width) return o;
1126
+ await (typeof requestAnimationFrame == "function" ? new Promise((s) => requestAnimationFrame(s)) : ee());
1127
+ }
1128
+ return f.findNode(e);
1129
+ }
1130
+ function qn(e, t) {
1131
+ const o = f.findNode(t.target);
1132
+ if (!o) return n.nodes;
1133
+ const s = Fe.value ? "x" : "y", a = e.position[s], u = a + (Fe.value ? ve(e).width : ve(e).height) + oe.layer, $ = Math.ceil(Math.max(0, u - o.position[s]) / 8) * 8;
1134
+ if (!$) return n.nodes;
1135
+ const w = Math.min(a, o.position[s]) - 1, P = new Set(f.getNodes.value.filter((L) => L.id !== e.id && L.position[s] >= w).map((L) => L.id)), I = n.nodes.map((L) => {
1136
+ var H;
1137
+ const W = (H = f.findNode(L.id)) == null ? void 0 : H.position;
1138
+ return P.has(L.id) && W ? { ...L, position: { ...W, [s]: W[s] + $ } } : L;
1139
+ });
1140
+ return d("update:nodes", I), I;
1141
+ }
1142
+ function tn(e) {
1143
+ const t = f.vueFlowRef.value;
1144
+ if (!t) return;
1145
+ const { x: o, y: s, zoom: a } = f.viewport.value, { width: u, height: $ } = ve(e), w = e.position.x * a + o, P = e.position.y * a + s;
1146
+ w >= 0 && P >= 0 && w + u * a <= t.clientWidth && P + $ * a <= t.clientHeight || f.setCenter(e.position.x + u / 2, e.position.y + $ / 2, { zoom: a, duration: R ? 0 : 200 });
1147
+ }
1148
+ function Gn(e) {
1149
+ const o = f.getNodes.value.map((a) => ({
1150
+ x: a.position.x - 16,
1151
+ y: a.position.y - 16,
1152
+ width: (a.dimensions.width || y.width) + 32,
1153
+ height: (a.dimensions.height || y.height) + 32
1154
+ })), s = (a) => o.some((u) => a.x < u.x + u.width && a.x + y.width > u.x && a.y < u.y + u.height && a.y + y.height > u.y);
1155
+ for (let a = 0; a < 40; a += 1) {
1156
+ const u = { x: e.x, y: e.y + a * 32 };
1157
+ if (!s(u)) return u;
1158
+ }
1159
+ return e;
1160
+ }
1161
+ const Qe = V(null);
1162
+ let Je;
1163
+ const pe = { line: null, tools: null };
1164
+ function $t(e, t, o) {
1165
+ o ? pe[t] = e : pe[t] === e && (pe[t] = null), clearTimeout(Je);
1166
+ const s = pe.tools ?? pe.line;
1167
+ s ? Qe.value = s : Je = setTimeout(() => Qe.value = null, 160);
1168
+ }
1169
+ ot(() => clearTimeout(Je));
1170
+ const Ae = V(null), xt = E({
1171
+ get: () => !!F.value,
1172
+ set: (e) => {
1173
+ e || (Ae.value = null);
1174
+ }
1175
+ }), F = E(() => {
1176
+ const e = n.edges.find((a) => a.id === Ae.value), t = e && n.nodes.find((a) => a.id === e.source), o = e && n.nodes.find((a) => a.id === e.target);
1177
+ if (!e || !t || !o) return null;
1178
+ const s = ke(e, n.nodes);
1179
+ return {
1180
+ edge: e,
1181
+ source: t,
1182
+ target: o,
1183
+ sourcePort: xe(t).find((a) => a.id === s.sourcePort),
1184
+ targetPort: $e(o).find((a) => a.id === s.targetPort),
1185
+ between: n.edges.filter((a) => a.source === e.source && a.target === e.target)
1186
+ };
1187
+ });
1188
+ function et(e, t) {
1189
+ return (e == null ? void 0 : e.label) ?? (t === "in" ? "Input" : "Output");
1190
+ }
1191
+ function nn(e) {
1192
+ const t = n.nodes.find((a) => a.id === e.source), o = n.nodes.find((a) => a.id === e.target), s = ke(e, n.nodes);
1193
+ return `${et(t && xe(t).find((a) => a.id === s.sourcePort), "out")} → ${et(o && $e(o).find((a) => a.id === s.targetPort), "in")}`;
1194
+ }
1195
+ const Qn = E(() => {
1196
+ const e = F.value;
1197
+ return e ? [
1198
+ { key: "from", label: "From", value: `${e.source.label} · ${et(e.sourcePort, "out")}` },
1199
+ { key: "to", label: "To", value: `${e.target.label} · ${et(e.targetPort, "in")}` }
1200
+ ] : [];
1201
+ });
1202
+ function tt() {
1203
+ clearTimeout(Je), pe.line = pe.tools = null, Qe.value = null;
1204
+ }
1205
+ function Et(e) {
1206
+ tt(), Ae.value = e;
1207
+ }
1208
+ function Be(e) {
1209
+ if (!n.editable || !e.length) return;
1210
+ if (!n.beforeRemove) return on(e);
1211
+ const t = new Set(e);
1212
+ tt(), yt({ nodes: [], edges: n.edges.filter((o) => t.has(o.id)) }).then((o) => o && on(e));
1213
+ }
1214
+ function on(e) {
1215
+ var a;
1216
+ const t = new Set(e), o = n.edges.filter((u) => !t.has(u.id)), s = F.value;
1217
+ d("update:edges", o), Ce({ nodes: n.nodes, edges: n.edges }, { nodes: n.nodes, edges: o }), tt(), s && t.has(s.edge.id) && (Ae.value = ((a = s.between.find((u) => !t.has(u.id))) == null ? void 0 : a.id) ?? null), re(e.length === 1 ? "Connection deleted." : `${e.length} connections deleted.`);
1218
+ }
1219
+ function an(e) {
1220
+ const t = n.edges.find((o) => o.id === e);
1221
+ !t || !Oe.value || (Ae.value = null, tt(), Pe.value = t, wt(null));
1222
+ }
1223
+ function sn(e, t) {
1224
+ const { sourcePort: o, targetPort: s } = ke(e, n.nodes);
1225
+ if (!o || !s) return { reason: "That connection has no ports." };
1226
+ const a = n.nodes.some((x) => x.id === t.id) ? n.nodes : [...n.nodes, t], u = n.edges.filter((x) => x.id !== e.id), $ = (x) => {
1227
+ var B;
1228
+ try {
1229
+ return ((B = n.connectionRule) == null ? void 0 : B.call(n, x)) ?? null;
1230
+ } catch {
1231
+ return null;
1232
+ }
1233
+ }, w = (x, B) => yn(a, x, B, { allowCycles: n.allowCycles, noun: n.noun }) ?? $(B), P = $e(t).map((x) => ({ source: e.source, sourcePort: o, target: t.id, targetPort: x.id })), I = P.find((x) => !w(u, x));
1234
+ if (!I) return { reason: P[0] ? w(u, P[0]) ?? void 0 : `${t.label} has no input.` };
1235
+ const L = [...u, { id: at(I), ...I }], W = xe(t).map((x) => ({ source: t.id, sourcePort: x.id, target: e.target, targetPort: s })), H = W.find((x) => !w(L, x));
1236
+ return H ? { into: I, out: H } : { into: I, reason: W[0] ? w(L, W[0]) ?? void 0 : `${t.label} has no output.` };
1237
+ }
1238
+ function Jn(e, t, o) {
1239
+ const s = sn(e, t);
1240
+ if (s.into && s.out) {
1241
+ const $ = [...n.edges.filter((P) => P.id !== e.id), { id: at(s.into), ...s.into }, { id: at(s.out), ...s.out }];
1242
+ d("update:edges", $);
1243
+ const w = qn(o, e);
1244
+ return re(`${t.label} is now between ${A(e.source)} and ${A(e.target)}.`), { nodes: w, edges: $ };
1245
+ }
1246
+ const a = Jt(kt()), u = n.nodes.map(($) => $.id === t.id ? { ...$, position: a } : $);
1247
+ return d("update:nodes", u), re(`${t.label} is at the end of the chain, not connected: ${s.reason ?? "it does not fit between them."}`), { nodes: u, edges: n.edges };
1248
+ }
1249
+ te(
1250
+ () => n.nodes,
1251
+ async (e) => {
1252
+ const t = bt, o = t && e.find((P) => !t.known.has(P.id));
1253
+ if (!t || !o) return;
1254
+ bt = null;
1255
+ const s = { nodes: e.filter((P) => P.id !== o.id), edges: n.edges.filter((P) => P.source !== o.id && P.target !== o.id) }, a = await Kn(o.id), u = n.nodes.find((P) => P.id === o.id), $ = a && u && t.edge ? Jn(t.edge, u, a) : { nodes: n.nodes, edges: n.edges };
1256
+ if (Ce(s, $), !a || !u) return;
1257
+ await ee();
1258
+ const w = f.findNode(o.id);
1259
+ w && tn(w);
1260
+ }
1261
+ );
1262
+ const de = V(null), me = V(null), Ue = E({
1263
+ get: () => !!de.value,
1264
+ set: (e) => {
1265
+ e || (de.value = me.value = null);
1266
+ }
1267
+ });
1268
+ function eo(e) {
1269
+ try {
1270
+ return structuredClone(ho(e));
1271
+ } catch {
1272
+ return e && typeof e == "object" ? { ...e } : e;
1273
+ }
1274
+ }
1275
+ function to(e) {
1276
+ const t = n.nodes.find((o) => o.id === e);
1277
+ !n.editable || !t || (de.value = t, me.value = { ...t, data: eo(t.data) });
1278
+ }
1279
+ function no() {
1280
+ const e = me.value;
1281
+ e && (d("update:nodes", n.nodes.map((t) => t.id === e.id ? { ...e, label: e.label.trim() || t.label, position: t.position } : t)), Ue.value = !1);
1282
+ }
1283
+ function oo() {
1284
+ var s;
1285
+ const e = (s = de.value) == null ? void 0 : s.id;
1286
+ if (!e) return;
1287
+ const t = () => {
1288
+ ht(/* @__PURE__ */ new Set([e]), /* @__PURE__ */ new Set()), Ue.value = !1;
1289
+ };
1290
+ if (!n.beforeRemove) return t();
1291
+ const o = n.nodes.find((a) => a.id === e);
1292
+ yt({ nodes: o ? [o] : [], edges: n.edges.filter((a) => a.source === e || a.target === e) }).then((a) => a && t());
1293
+ }
1294
+ function _t(e) {
1295
+ if (n.editor === "modal") return to(e);
1296
+ const t = n.nodes.find((o) => o.id === e);
1297
+ t && d("open", t);
1298
+ }
1299
+ function ln(e) {
1300
+ return !!(e != null && e.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"])'));
1301
+ }
1302
+ function io(e) {
1303
+ const t = e.target instanceof Element ? e.target : null, o = e.key.toLowerCase();
1304
+ if (he.value && (e.metaKey || e.ctrlKey) && !e.altKey && (o === "z" || o === "y" && e.ctrlKey) && !ln(t)) {
1305
+ e.preventDefault(), o === "y" || e.shiftKey ? Mt() : Ct();
1306
+ return;
1307
+ }
1308
+ e.key === "Enter" && (t != null && t.classList.contains("vue-flow__node")) && t instanceof HTMLElement && t.dataset.id && _t(t.dataset.id);
1309
+ const s = t != null && t.classList.contains("vue-flow__edge") ? t.getAttribute("data-id") : null;
1310
+ if (!s) {
1311
+ v.includes(e.key) && n.editable && n.beforeRemove && !ln(t) && (e.preventDefault(), Yn());
1312
+ return;
1313
+ }
1314
+ e.key === "Enter" ? (e.preventDefault(), Et(s)) : (e.key === "Delete" || e.key === "Backspace") && n.editable && (e.preventDefault(), Be([s]));
1315
+ }
1316
+ const he = E(() => !!n.history && n.editable), se = E(() => typeof n.history == "object" ? n.history : null), Ne = V(!1), ue = Lt([]), Ye = Lt([]), St = E(() => {
1317
+ var e, t;
1318
+ return he.value && !Ne.value && !((e = se.value) != null && e.busy) && (((t = se.value) == null ? void 0 : t.canUndo) ?? ue.value.length > 0);
1319
+ }), Pt = E(() => {
1320
+ var e, t;
1321
+ return he.value && !Ne.value && !((e = se.value) != null && e.busy) && (((t = se.value) == null ? void 0 : t.canRedo) ?? Ye.value.length > 0);
1322
+ });
1323
+ function ao(e) {
1324
+ const t = (o) => o.map((s) => s.id).join(",");
1325
+ return [
1326
+ t(e.addedNodes.map((o) => o.node)),
1327
+ t(e.removedNodes.map((o) => o.node)),
1328
+ t(e.addedEdges.map((o) => o.edge)),
1329
+ t(e.removedEdges.map((o) => o.edge)),
1330
+ e.moved.map((o) => {
1331
+ var s, a;
1332
+ return `${o.id}@${(s = o.to) == null ? void 0 : s.x},${(a = o.to) == null ? void 0 : a.y}`;
1333
+ }).join(",")
1334
+ ].join("|");
1335
+ }
1336
+ function Ce(e, t) {
1337
+ if (!he.value || se.value) return;
1338
+ const o = Ri(e, t);
1339
+ if (!o) return;
1340
+ const s = ao(o), a = ue.value[ue.value.length - 1];
1341
+ if (a && a.key === s && a.from[0] === e.nodes && a.from[1] === e.edges) return;
1342
+ const u = { entry: o, key: s, from: [e.nodes, e.edges] };
1343
+ ue.value = [...ue.value, u].slice(-100), Ye.value = [];
1344
+ }
1345
+ function dn() {
1346
+ var e, t;
1347
+ ue.value = [], Ye.value = [], (t = (e = se.value) == null ? void 0 : e.clear) == null || t.call(e);
1348
+ }
1349
+ te(
1350
+ () => n.nodes,
1351
+ (e, t) => {
1352
+ if (se.value || !(t != null && t.length) || !e.length) return;
1353
+ const o = new Set(t.map((s) => s.id));
1354
+ e.some((s) => o.has(s.id)) || dn();
1355
+ }
1356
+ );
1357
+ async function so(e) {
1358
+ for (let t = 0; t < 12 && e.some((o) => !f.findNode(o)); t += 1)
1359
+ await (typeof requestAnimationFrame == "function" ? new Promise((o) => requestAnimationFrame(o)) : ee());
1360
+ }
1361
+ let Nt = Promise.resolve();
1362
+ function rn(e) {
1363
+ return Nt = Nt.then(() => lo(e)).catch(() => {
1364
+ }), Nt;
1365
+ }
1366
+ async function lo(e) {
1367
+ var L, W;
1368
+ const t = se.value;
1369
+ if (t) {
1370
+ if (!(e === "undo" ? St.value : Pt.value)) return;
1371
+ const H = !!((L = Me.value) != null && L.contains(document.activeElement));
1372
+ Ne.value = !0;
1373
+ try {
1374
+ await t[e](), re(e === "undo" ? "Undone." : "Redone.");
1375
+ } catch {
1376
+ re(e === "undo" ? "Could not undo. Try again." : "Could not redo. Try again.");
1377
+ } finally {
1378
+ Ne.value = !1, await ee(), H && un();
1379
+ }
1380
+ return;
1381
+ }
1382
+ const o = e === "undo" ? ue : Ye, s = e === "undo" ? Ye : ue, a = o.value[o.value.length - 1];
1383
+ if (!he.value || !a) return;
1384
+ o.value = o.value.slice(0, -1), s.value = [...s.value, a];
1385
+ const u = !!((W = Me.value) != null && W.contains(document.activeElement)), { entry: $ } = a, w = Ii($, n.nodes, e);
1386
+ (w.length !== n.nodes.length || w.some((H, x) => H !== n.nodes[x])) && d("update:nodes", w);
1387
+ const P = (e === "undo" ? $.removedNodes : $.addedNodes).map(({ node: H }) => H.id);
1388
+ P.length && await so(P);
1389
+ const I = zi($, n.edges, w, e);
1390
+ (I.length !== n.edges.length || I.some((H, x) => H !== n.edges[x])) && d("update:edges", I), n.selected && !w.some((H) => H.id === n.selected) && d("update:selected", null), re(e === "undo" ? "Undone." : "Redone."), await ee(), u && un();
1391
+ }
1392
+ function un() {
1393
+ const e = Me.value, t = document.activeElement;
1394
+ if (!e || t && e.contains(t) && !(t instanceof HTMLButtonElement && t.disabled)) return;
1395
+ (e.querySelector("[data-it-dag-undo]:not(:disabled), [data-it-dag-redo]:not(:disabled)") ?? e).focus({ preventScroll: !0 });
1396
+ }
1397
+ function Ct() {
1398
+ return rn("undo");
1399
+ }
1400
+ function Mt() {
1401
+ return rn("redo");
1402
+ }
1403
+ const le = V(!1), ro = E(() => n.wheel === "pan" || le.value);
1404
+ function Tt(e) {
1405
+ e.key === "Escape" && !e.defaultPrevented && !document.querySelector(".p-dialog-mask") && (le.value = !1);
1406
+ }
1407
+ const Me = V(null);
1408
+ let nt = [];
1409
+ function Dt(e) {
1410
+ if (e) {
1411
+ nt = [...document.body.children].filter((t) => t instanceof HTMLElement && t !== Me.value && !t.inert);
1412
+ for (const t of nt) t.inert = !0;
1413
+ } else {
1414
+ for (const t of nt) t.inert = !1;
1415
+ nt = [];
1416
+ }
1417
+ }
1418
+ te(le, async (e) => {
1419
+ var t, o;
1420
+ e ? window.addEventListener("keydown", Tt) : window.removeEventListener("keydown", Tt), e || Dt(!1), await ee(), e && Dt(!0), (o = (t = Me.value) == null ? void 0 : t.querySelector("[data-it-dag-expand]")) == null || o.focus(), await _e();
1421
+ }), ot(() => {
1422
+ window.removeEventListener("keydown", Tt), Dt(!1);
1423
+ }), po(ut, {
1424
+ editable: () => n.editable,
1425
+ direction: () => n.direction,
1426
+ expanded: () => le.value,
1427
+ toggleExpanded: () => le.value = !le.value,
1428
+ zoomIn: () => void f.zoomIn({ duration: R ? 0 : 150 }),
1429
+ zoomOut: () => void f.zoomOut({ duration: R ? 0 : 150 }),
1430
+ fit: () => void _e(),
1431
+ arrange: () => void ze("all", !0),
1432
+ hoveredEdge: () => Qe.value,
1433
+ hoverEdge: $t,
1434
+ openConnection: Et,
1435
+ insertOnEdge: an,
1436
+ removeEdge: (e) => Be([e]),
1437
+ view: () => Wt.value,
1438
+ noun: () => n.noun,
1439
+ history: () => he.value,
1440
+ canUndo: () => St.value,
1441
+ canRedo: () => Pt.value,
1442
+ undo: () => void Ct(),
1443
+ redo: () => void Mt()
1444
+ });
1445
+ let Rt = null;
1446
+ function cn(e) {
1447
+ if (!Ee || ae.value) {
1448
+ Rt = e;
1449
+ return;
1450
+ }
1451
+ const t = f.findNode(e);
1452
+ t && tn(t);
1453
+ }
1454
+ const uo = E(() => n.emptyTitle ?? `No ${n.noun.other} yet`);
1455
+ return l({ fit: _e, arrange: () => ze("all", !0), revealNode: cn, openNode: _t, undo: Ct, redo: Mt, canUndo: St, canRedo: Pt, clearHistory: dn }), (e, t) => {
1456
+ var o, s, a, u, $;
1457
+ return b(), _("div", {
1458
+ class: "it-dag-host",
1459
+ style: rt({ height: typeof i.height == "number" ? `${i.height}px` : i.height })
1460
+ }, [
1461
+ (b(), O(mo, {
1462
+ to: "body",
1463
+ disabled: !le.value
1464
+ }, [
1465
+ U("div", {
1466
+ ref_key: "frame",
1467
+ ref: Me,
1468
+ class: Ie(["it-dag", { "it-dag--editable": i.editable, "it-dag--connecting": gt.value, "it-dag--pending": Q.value || ae.value, "it-dag--expanded": le.value }]),
1469
+ role: le.value ? "dialog" : "region",
1470
+ "aria-modal": le.value ? "true" : void 0,
1471
+ "aria-label": i.label,
1472
+ tabindex: he.value ? -1 : void 0,
1473
+ onDblclick: jn,
1474
+ onKeydown: io
1475
+ }, [
1476
+ D(k(Do), {
1477
+ id: h,
1478
+ class: "it-dag__flow",
1479
+ nodes: S.value,
1480
+ edges: ie.value,
1481
+ "nodes-draggable": i.editable,
1482
+ "nodes-connectable": i.editable,
1483
+ "elements-selectable": !0,
1484
+ "edges-updatable": !1,
1485
+ "delete-key-code": i.editable && !i.beforeRemove ? v : null,
1486
+ "edge-types": g,
1487
+ "connection-mode": k(Ro).Strict,
1488
+ "connection-line-type": i.edgeShape === "bezier" ? k(hn).Bezier : k(hn).SmoothStep,
1489
+ "is-valid-connection": Fn,
1490
+ "min-zoom": c.value,
1491
+ "max-zoom": 2,
1492
+ "zoom-on-scroll": !1,
1493
+ "zoom-on-double-click": !1,
1494
+ "prevent-scrolling": !1,
1495
+ "pan-on-scroll": ro.value,
1496
+ "pan-on-scroll-speed": 1,
1497
+ "snap-to-grid": !0,
1498
+ "snap-grid": [8, 8],
1499
+ "select-nodes-on-drag": !1,
1500
+ onNodesChange: Hn,
1501
+ onEdgesChange: Xn,
1502
+ onNodesInitialized: On,
1503
+ onConnect: Bn,
1504
+ onConnectStart: An,
1505
+ onConnectEnd: Un,
1506
+ onNodeClick: t[1] || (t[1] = ({ node: w }) => _t(w.id)),
1507
+ onEdgeClick: t[2] || (t[2] = ({ edge: w }) => Et(w.id)),
1508
+ onEdgeMouseEnter: t[3] || (t[3] = ({ edge: w }) => $t(w.id, "line", !0)),
1509
+ onEdgeMouseLeave: t[4] || (t[4] = ({ edge: w }) => $t(w.id, "line", !1))
1510
+ }, {
1511
+ "node-it": X(({ data: w, selected: P }) => [
1512
+ Re(e.$slots, "node", {
1513
+ node: w,
1514
+ selected: P
1515
+ }, () => [
1516
+ D(li, {
1517
+ node: w,
1518
+ selected: P
1519
+ }, null, 8, ["node", "selected"])
1520
+ ])
1521
+ ]),
1522
+ default: X(() => [
1523
+ Dn.value ? (b(), _("div", Yi)) : C("", !0),
1524
+ Rn.value ? (b(), _("div", Hi)) : C("", !0),
1525
+ Oe.value ? (b(), O(k(Ot), {
1526
+ key: 2,
1527
+ position: "top-left",
1528
+ class: "it-dag__panel"
1529
+ }, {
1530
+ default: X(() => [
1531
+ D(k(ce), {
1532
+ label: `Add ${i.noun.one}`,
1533
+ size: "small",
1534
+ onClick: t[0] || (t[0] = (w) => wt())
1535
+ }, {
1536
+ icon: X(() => [
1537
+ D(k(Ut), {
1538
+ size: 14,
1539
+ "aria-hidden": "true"
1540
+ })
1541
+ ]),
1542
+ _: 1
1543
+ }, 8, ["label"])
1544
+ ]),
1545
+ _: 1
1546
+ })) : C("", !0),
1547
+ e.$slots.actions ? (b(), O(k(Ot), {
1548
+ key: 3,
1549
+ position: "top-right",
1550
+ class: "it-dag__panel it-dag__actions"
1551
+ }, {
1552
+ default: X(() => [
1553
+ Re(e.$slots, "actions")
1554
+ ]),
1555
+ _: 3
1556
+ })) : C("", !0),
1557
+ D(k(Ot), {
1558
+ position: "bottom-left",
1559
+ class: "it-dag__panel"
1560
+ }, {
1561
+ default: X(() => [
1562
+ D(wi)
1563
+ ]),
1564
+ _: 1
1565
+ })
1566
+ ]),
1567
+ _: 3
1568
+ }, 8, ["nodes", "edges", "nodes-draggable", "nodes-connectable", "delete-key-code", "connection-mode", "connection-line-type", "min-zoom", "pan-on-scroll"]),
1569
+ i.nodes.length ? C("", !0) : (b(), _("div", Xi, [
1570
+ Re(e.$slots, "empty", {}, () => [
1571
+ D(Fo, {
1572
+ title: uo.value,
1573
+ description: i.emptyDescription || void 0
1574
+ }, null, 8, ["title", "description"])
1575
+ ])
1576
+ ])),
1577
+ U("p", {
1578
+ class: Ie(["it-dag__notice", { "it-dag__notice--shown": ((o = se.value) == null ? void 0 : o.busy) || Ne.value || Ke.value }]),
1579
+ role: "status"
1580
+ }, G((s = se.value) != null && s.busy || Ne.value ? "Saving workflow" : Ke.value), 3)
1581
+ ], 42, Ui)
1582
+ ], 8, ["disabled"])),
1583
+ Oe.value ? (b(), O(Ti, {
1584
+ key: 0,
1585
+ visible: Le.value,
1586
+ "onUpdate:visible": t[5] || (t[5] = (w) => Le.value = w),
1587
+ items: i.library,
1588
+ description: Vn.value,
1589
+ misfits: Gt.value,
1590
+ noun: i.noun,
1591
+ onPick: Wn
1592
+ }, null, 8, ["visible", "items", "description", "misfits", "noun"])) : C("", !0),
1593
+ i.editor === "modal" ? (b(), O(At, {
1594
+ key: 1,
1595
+ visible: Ue.value,
1596
+ "onUpdate:visible": t[8] || (t[8] = (w) => Ue.value = w),
1597
+ title: ((a = de.value) == null ? void 0 : a.editorTitle) ?? `Edit ${i.noun.one}`,
1598
+ description: (u = de.value) == null ? void 0 : u.kind,
1599
+ size: i.editorSize,
1600
+ "initial-focus": "start"
1601
+ }, it({
1602
+ footer: X(() => [
1603
+ D(k(ce), {
1604
+ label: "Cancel",
1605
+ severity: "secondary",
1606
+ outlined: "",
1607
+ onClick: t[7] || (t[7] = (w) => Ue.value = !1)
1608
+ }),
1609
+ D(k(ce), {
1610
+ label: "Save",
1611
+ onClick: no
1612
+ })
1613
+ ]),
1614
+ default: X(() => [
1615
+ de.value && me.value ? (b(), _("div", Vi, [
1616
+ D(Ao, { label: "Name" }, {
1617
+ default: X(({ id: w }) => [
1618
+ D(k(yo), {
1619
+ id: w,
1620
+ modelValue: me.value.label,
1621
+ "onUpdate:modelValue": t[6] || (t[6] = (P) => me.value.label = P)
1622
+ }, null, 8, ["id", "modelValue"])
1623
+ ]),
1624
+ _: 1
1625
+ }),
1626
+ Re(e.$slots, "editor", {
1627
+ node: de.value,
1628
+ draft: me.value
1629
+ })
1630
+ ])) : C("", !0)
1631
+ ]),
1632
+ _: 2
1633
+ }, [
1634
+ (($ = de.value) == null ? void 0 : $.removable) !== !1 ? {
1635
+ name: "footer-start",
1636
+ fn: X(() => [
1637
+ D(k(ce), {
1638
+ label: `Delete ${i.noun.one}`,
1639
+ severity: "danger",
1640
+ text: "",
1641
+ onClick: oo
1642
+ }, null, 8, ["label"])
1643
+ ]),
1644
+ key: "0"
1645
+ } : void 0
1646
+ ]), 1032, ["visible", "title", "description", "size"])) : C("", !0),
1647
+ D(At, {
1648
+ visible: xt.value,
1649
+ "onUpdate:visible": t[13] || (t[13] = (w) => xt.value = w),
1650
+ title: "Connection",
1651
+ description: F.value ? `${F.value.source.label} to ${F.value.target.label}` : void 0
1652
+ }, it({
1653
+ footer: X(() => [
1654
+ Oe.value ? (b(), O(k(ce), {
1655
+ key: 0,
1656
+ label: `Add ${k(He)(i.noun)} here`,
1657
+ severity: "secondary",
1658
+ outlined: "",
1659
+ onClick: t[11] || (t[11] = (w) => F.value && an(F.value.edge.id))
1660
+ }, null, 8, ["label"])) : C("", !0),
1661
+ D(k(ce), {
1662
+ label: "Done",
1663
+ onClick: t[12] || (t[12] = (w) => xt.value = !1)
1664
+ })
1665
+ ]),
1666
+ default: X(() => [
1667
+ F.value ? (b(), _("div", Wi, [
1668
+ D(Bo, {
1669
+ items: Qn.value,
1670
+ layout: "stacked",
1671
+ columns: 2
1672
+ }, null, 8, ["items"]),
1673
+ Re(e.$slots, "connection", {
1674
+ edge: F.value.edge,
1675
+ source: F.value.source,
1676
+ target: F.value.target,
1677
+ sourcePort: F.value.sourcePort,
1678
+ targetPort: F.value.targetPort
1679
+ }),
1680
+ F.value.between.length > 1 ? (b(), O(Uo, {
1681
+ key: 0,
1682
+ title: `Connections between these ${i.noun.other}`,
1683
+ meta: String(F.value.between.length)
1684
+ }, it({
1685
+ default: X(() => [
1686
+ (b(!0), _(q, null, ge(F.value.between, (w) => (b(), O(Yo, {
1687
+ key: w.id,
1688
+ title: nn(w),
1689
+ meta: w.id === F.value.edge.id ? "This connection" : void 0
1690
+ }, it({ _: 2 }, [
1691
+ i.editable ? {
1692
+ name: "actions",
1693
+ fn: X(() => [
1694
+ D(ne, {
1695
+ icon: k(En),
1696
+ label: `Delete connection ${nn(w)}`,
1697
+ size: "sm",
1698
+ tone: "danger",
1699
+ onClick: (P) => Be([w.id])
1700
+ }, null, 8, ["icon", "label", "onClick"])
1701
+ ]),
1702
+ key: "0"
1703
+ } : void 0
1704
+ ]), 1032, ["title", "meta"]))), 128))
1705
+ ]),
1706
+ _: 2
1707
+ }, [
1708
+ i.editable ? {
1709
+ name: "actions",
1710
+ fn: X(() => [
1711
+ D(k(ce), {
1712
+ label: `Delete all ${F.value.between.length}`,
1713
+ severity: "danger",
1714
+ text: "",
1715
+ size: "small",
1716
+ onClick: t[9] || (t[9] = (w) => Be(F.value.between.map((P) => P.id)))
1717
+ }, null, 8, ["label"])
1718
+ ]),
1719
+ key: "0"
1720
+ } : void 0
1721
+ ]), 1032, ["title", "meta"])) : C("", !0)
1722
+ ])) : C("", !0)
1723
+ ]),
1724
+ _: 2
1725
+ }, [
1726
+ i.editable ? {
1727
+ name: "footer-start",
1728
+ fn: X(() => [
1729
+ D(k(ce), {
1730
+ label: "Delete connection",
1731
+ severity: "danger",
1732
+ text: "",
1733
+ onClick: t[10] || (t[10] = (w) => F.value && Be([F.value.edge.id]))
1734
+ })
1735
+ ]),
1736
+ key: "0"
1737
+ } : void 0
1738
+ ]), 1032, ["visible", "description"])
1739
+ ], 4);
1740
+ };
1741
+ }
1742
+ });
1743
+ export {
1744
+ oe as IT_DAG_SPACING,
1745
+ oa as ItDagCanvas,
1746
+ li as ItDagNode,
1747
+ Tn as itDagArrange,
1748
+ yn as itDagConnectionError,
1749
+ at as itDagEdgeId,
1750
+ $e as itDagInputs,
1751
+ na as itDagLayout,
1752
+ xe as itDagOutputs,
1753
+ Wo as itDagReaches
1754
+ };