treege 3.0.0-beta.62 → 3.0.0-beta.63

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,5 +1,5 @@
1
- import { B as e, C as t, E as n, H as r, I as i, L as a, N as o, P as s, R as c, T as l, U as u, V as d, _ as f, k as p, t as m, v as h, w as g } from "./ThemeContext-cGSTk24y.js";
2
- import { $ as _, A as v, B as y, D as b, F as x, G as S, H as C, I as w, J as T, K as E, L as D, M as O, N as k, O as A, P as j, Q as M, R as ee, U as te, V as ne, W as N, X as re, Y as ie, Z as P, at as F, c as ae, ct as oe, et as se, g as ce, h as le, it as I, j as ue, k as de, lt as L, nt as fe, o as pe, ot as R, q as me, rt as he, st as z, t as ge, tt as _e, ut as B, z as ve } from "./DefaultInputs-DamDWb5R.js";
1
+ import { A as e, D as t, E as n, F as r, H as i, L as a, P as o, R as s, T as c, U as l, V as u, W as d, t as f, v as p, w as m, y as h, z as g } from "./ThemeContext-nopV_oRU.js";
2
+ import { $ as _, A as v, B as y, D as b, F as x, G as S, H as C, I as w, J as T, K as E, L as D, M as O, N as k, O as A, P as j, Q as M, R as ee, U as te, V as ne, W as N, X as re, Y as ie, Z as P, at as F, c as ae, ct as oe, et as se, g as ce, h as le, it as I, j as ue, k as de, lt as L, nt as fe, o as pe, ot as R, q as me, rt as he, st as z, t as ge, tt as _e, ut as B, z as ve } from "./DefaultInputs-nX-CVK2i.js";
3
3
  import { Background as ye, BackgroundVariant as be, BaseEdge as xe, ControlButton as Se, Controls as Ce, EdgeLabelRenderer as we, Handle as Te, MiniMap as Ee, Panel as De, Position as Oe, ReactFlow as ke, ReactFlowProvider as Ae, addEdge as je, getBezierPath as Me, useConnection as Ne, useEdges as Pe, useNodes as Fe, useNodesInitialized as Ie, useReactFlow as Le, useStore as Re, useUpdateNodeInternals as ze } from "@xyflow/react";
4
4
  import * as Be from "react";
5
5
  import Ve, { createContext as He, memo as Ue, useCallback as V, useContext as We, useEffect as H, useId as Ge, useMemo as U, useRef as Ke, useState as W } from "react";
@@ -71,30 +71,30 @@ var un = "data:image/svg+xml,%3csvg%20width='462'%20height='144'%20viewBox='0%20
71
71
  setFlowId: () => {},
72
72
  setIsNodeSheetOpen: () => {},
73
73
  setLanguage: () => {}
74
- }, vn = (t) => {
75
- let n = Fe(), i = Pe(), { language: a } = _n();
74
+ }, vn = (e) => {
75
+ let t = Fe(), n = Pe(), { language: r } = _n();
76
76
  return U(() => {
77
- if (!t) return [];
78
- let o = (e, t = /* @__PURE__ */ new Set()) => {
77
+ if (!e) return [];
78
+ let i = (e, t = /* @__PURE__ */ new Set()) => {
79
79
  if (t.has(e)) return [];
80
- let n = new Set(t).add(e);
81
- return i.filter((t) => t.target === e).flatMap((e) => [e.source, ...o(e.source, n)]);
82
- }, s = o(t);
83
- return n.filter((e) => s.includes(e.id) && r(e)).map((t) => {
84
- let n = t.data;
80
+ let r = new Set(t).add(e);
81
+ return n.filter((t) => t.target === e).flatMap((e) => [e.source, ...i(e.source, r)]);
82
+ }, a = i(e);
83
+ return t.filter((e) => a.includes(e.id) && l(e)).map((e) => {
84
+ let t = e.data;
85
85
  return {
86
- label: e(n.label, a) || n.name || t.id,
87
- name: n.name,
88
- nodeId: t.id,
89
- options: n.options,
90
- type: n.type || "text"
86
+ label: u(t.label, r) || t.name || e.id,
87
+ name: t.name,
88
+ nodeId: e.id,
89
+ options: t.options,
90
+ type: t.type || "text"
91
91
  };
92
92
  });
93
93
  }, [
94
+ e,
94
95
  t,
95
96
  n,
96
- i,
97
- a
97
+ r
98
98
  ]);
99
99
  }, yn = /* @__PURE__ */ new WeakMap(), bn = (e, t) => e && t ? "middle" : e ? "last" : t ? "first" : "single", xn = (e) => {
100
100
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
@@ -114,7 +114,7 @@ var un = "data:image/svg+xml,%3csvg%20width='462'%20height='144'%20viewBox='0%20
114
114
  return (i === "first" || i === "middle") && (a === "middle" || a === "last");
115
115
  }), Z = (e) => {
116
116
  let t = _n();
117
- return c(e ?? t.language);
117
+ return g(e ?? t.language);
118
118
  };
119
119
  //#endregion
120
120
  //#region src/shared/components/ui/scroll-area.tsx
@@ -208,14 +208,14 @@ var An = {
208
208
  ">": ">",
209
209
  ">=": "≥"
210
210
  }, jn = (e) => !!e.field && e.value !== void 0 && e.value !== "", Mn = (e, t) => e === void 0 ? "" : typeof e == "string" ? e : e[t] ?? e.en ?? "", Nn = {
211
- conditional: Ue(({ id: e, source: t, target: n, sourceX: r, sourceY: i, targetX: o, targetY: s, sourcePosition: c, targetPosition: l, markerEnd: u, style: d, data: f }) => {
211
+ conditional: Ue(({ id: e, source: t, target: n, sourceX: r, sourceY: i, targetX: a, targetY: o, sourcePosition: c, targetPosition: l, markerEnd: u, style: d, data: f }) => {
212
212
  let [p] = Me({
213
213
  sourcePosition: c,
214
214
  sourceX: r,
215
215
  sourceY: i,
216
216
  targetPosition: l,
217
- targetX: o,
218
- targetY: s
217
+ targetX: a,
218
+ targetY: o
219
219
  }), [m, h] = W(!1), [g, v] = W("basic"), { updateEdgeData: y, deleteElements: b } = Le(), { language: x } = _n(), C = Cn(t, n), w = vn(n), D = w.find((e) => e.nodeId === t) ?? w[0], O = Z(), k = Pe(), A = U(() => {
220
220
  let n = /* @__PURE__ */ new Set();
221
221
  return D && k.forEach((r) => {
@@ -284,7 +284,7 @@ var An = {
284
284
  let [t] = e, n = w.find((e) => e.nodeId === t.field)?.label ?? t.field ?? "";
285
285
  return `${n === t.field && n.length > 5 ? `${n.slice(0, 5)}…` : n} ${An[t.operator] ?? t.operator} ${t.value ?? ""}`;
286
286
  }
287
- let t = e.filter((e) => e.logicalOperator === a.AND).length, n = e.filter((e) => e.logicalOperator === a.OR).length;
287
+ let t = e.filter((e) => e.logicalOperator === s.AND).length, n = e.filter((e) => e.logicalOperator === s.OR).length;
288
288
  return t > 0 && n === 0 ? `${e.length} ${O("editor.conditionalEdge.conditionsAnd")}` : n > 0 && t === 0 ? `${e.length} ${O("editor.conditionalEdge.conditionsOr")}` : `${e.length} ${O("editor.conditionalEdge.conditionsMixed")}`;
289
289
  }, fe = () => f?.isFallback ? "var(--treege-chart-4)" : j ? "var(--treege-chart-2)" : "var(--treege-chart-3)";
290
290
  return C ? null : /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(xe, {
@@ -300,7 +300,7 @@ var An = {
300
300
  className: "nodrag nopan nowheel tg:absolute tg:z-10000",
301
301
  style: {
302
302
  pointerEvents: "all",
303
- transform: `translate(-50%, calc(-100% - 8px)) translate(${o}px, ${s}px)`
303
+ transform: `translate(-50%, calc(-100% - 8px)) translate(${a}px, ${o}px)`
304
304
  },
305
305
  children: /* @__PURE__ */ q(_, {
306
306
  open: m,
@@ -559,16 +559,16 @@ var An = {
559
559
  className: "tg:flex tg:justify-center",
560
560
  children: /* @__PURE__ */ q(S, {
561
561
  disabled: t,
562
- value: e.state.value || a.AND,
562
+ value: e.state.value || s.AND,
563
563
  onValueChange: (t) => e.handleChange(t),
564
564
  children: [/* @__PURE__ */ K(P, {
565
565
  className: "tg:h-9 tg:w-32 tg:font-semibold",
566
566
  children: /* @__PURE__ */ K(M, {})
567
567
  }), /* @__PURE__ */ q(E, { children: [/* @__PURE__ */ K(T, {
568
- value: a.AND,
568
+ value: s.AND,
569
569
  children: "AND"
570
570
  }), /* @__PURE__ */ K(T, {
571
- value: a.OR,
571
+ value: s.OR,
572
572
  children: "OR"
573
573
  })] })]
574
574
  })
@@ -583,7 +583,7 @@ var An = {
583
583
  onClick: () => {
584
584
  e.pushValue({
585
585
  field: w[0]?.nodeId ?? "",
586
- logicalOperator: a.AND,
586
+ logicalOperator: s.AND,
587
587
  operator: "===",
588
588
  value: ""
589
589
  }), ee().then();
@@ -811,7 +811,7 @@ var Xn = ({ onSelect: e }) => {
811
811
  /* @__PURE__ */ q(Hn, { children: [/* @__PURE__ */ K(Gn, { children: t("editor.selectNodeType.options.input") }), Object.values(Q).map((t) => /* @__PURE__ */ q($, {
812
812
  onClick: () => e({
813
813
  data: { type: t },
814
- type: i.input
814
+ type: a.input
815
815
  }),
816
816
  className: "tg:capitalize",
817
817
  children: [/* @__PURE__ */ K(Rn(t), {}), t]
@@ -820,7 +820,7 @@ var Xn = ({ onSelect: e }) => {
820
820
  /* @__PURE__ */ q(Hn, { children: [/* @__PURE__ */ K(Gn, { children: t("editor.selectNodeType.options.ui") }), Object.values(Fn).map((t) => /* @__PURE__ */ q($, {
821
821
  onClick: () => e({
822
822
  data: { type: t },
823
- type: i.ui
823
+ type: a.ui
824
824
  }),
825
825
  className: "tg:capitalize",
826
826
  children: [/* @__PURE__ */ K(Rn(t), {}), t]
@@ -971,45 +971,45 @@ var Xn = ({ onSelect: e }) => {
971
971
  };
972
972
  });
973
973
  }, sr = () => {
974
- let { setNodes: e, setEdges: t, screenToFlowPosition: n, getNode: i, getNodes: a, getEdges: o } = Le(), { takeSnapshot: s } = nr(), c = V((n, i, a = !1, c) => {
975
- let l = n.id, u = o().filter((e) => e.source === l), d = r(n);
974
+ let { setNodes: e, setEdges: t, screenToFlowPosition: n, getNode: r, getNodes: i, getEdges: a } = Le(), { takeSnapshot: o } = nr(), s = V((n, r, i = !1, s) => {
975
+ let c = n.id, u = a().filter((e) => e.source === c), d = l(n);
976
976
  if (u.length > 0 && !d) return;
977
- s();
977
+ o();
978
978
  let f = Qn(), p = {
979
979
  ...$n,
980
- ...c && {
981
- data: c.data ?? {},
982
- type: c.type
980
+ ...s && {
981
+ data: s.data ?? {},
982
+ type: s.type
983
983
  },
984
984
  id: f,
985
- position: i,
986
- selected: a
985
+ position: r,
986
+ selected: i
987
987
  };
988
988
  n?.parentId && (p.parentId = n.parentId), e((e) => e.concat(p)), t((e) => {
989
- let t = e.filter((e) => e.source === l).length > 0, n = {
989
+ let t = e.filter((e) => e.source === c).length > 0, n = {
990
990
  data: t && d ? { conditions: [{
991
- field: l,
991
+ field: c,
992
992
  operator: "===",
993
993
  value: ""
994
994
  }] } : void 0,
995
995
  id: Qn(),
996
- source: l,
996
+ source: c,
997
997
  target: f,
998
998
  type: t && d ? "conditional" : "default"
999
999
  };
1000
- return t && d ? e.map((e) => e.source === l ? {
1000
+ return t && d ? e.map((e) => e.source === c ? {
1001
1001
  ...e,
1002
1002
  data: {
1003
1003
  ...e.data,
1004
1004
  conditions: e.data?.conditions || [{
1005
- field: l,
1005
+ field: c,
1006
1006
  operator: "===",
1007
1007
  value: ""
1008
1008
  }]
1009
1009
  },
1010
1010
  type: "conditional"
1011
1011
  } : e).concat(n) : e.concat(n);
1012
- }), a && requestAnimationFrame(() => {
1012
+ }), i && requestAnimationFrame(() => {
1013
1013
  e((e) => e.map((e) => ({
1014
1014
  ...e,
1015
1015
  selected: e.id === f
@@ -1019,22 +1019,22 @@ var Xn = ({ onSelect: e }) => {
1019
1019
  })));
1020
1020
  });
1021
1021
  }, [
1022
- o,
1022
+ a,
1023
1023
  e,
1024
1024
  t,
1025
- s
1026
- ]), l = V((n, r) => {
1027
- s();
1028
- let i = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), a = parseFloat(i) || 100, { node: o, edges: c } = ir(n, r, {
1025
+ o
1026
+ ]), c = V((n, r) => {
1027
+ o();
1028
+ let i = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), a = parseFloat(i) || 100, { node: s, edges: c } = ir(n, r, {
1029
1029
  baseNode: $n,
1030
1030
  commonNodeId: Qn(),
1031
1031
  nodeHeight: a,
1032
1032
  verticalSpacing: 100
1033
1033
  });
1034
- e((e) => e.concat(o)), t((e) => e.concat(...c)), requestAnimationFrame(() => {
1034
+ e((e) => e.concat(s)), t((e) => e.concat(...c)), requestAnimationFrame(() => {
1035
1035
  e((e) => e.map((e) => ({
1036
1036
  ...e,
1037
- selected: e.id === o.id
1037
+ selected: e.id === s.id
1038
1038
  }))), t((e) => e.map((e) => ({
1039
1039
  ...e,
1040
1040
  selected: !1
@@ -1043,12 +1043,12 @@ var Xn = ({ onSelect: e }) => {
1043
1043
  }, [
1044
1044
  e,
1045
1045
  t,
1046
- s
1046
+ o
1047
1047
  ]), u = V((e) => {
1048
- let n = e.source, a = i(n), c = o(), l = !c.some((e) => e.source === n), u = !c.some((t) => t.source === e.target);
1049
- l && u || (s(), t((t) => {
1050
- let i = je(e, t);
1051
- return i.filter((e) => e.source === n).length > 1 && a && r(a) ? i.map((e) => e.source === n ? {
1048
+ let n = e.source, i = r(n), s = a(), c = !s.some((e) => e.source === n), u = !s.some((t) => t.source === e.target);
1049
+ c && u || (o(), t((t) => {
1050
+ let r = je(e, t);
1051
+ return r.filter((e) => e.source === n).length > 1 && i && l(i) ? r.map((e) => e.source === n ? {
1052
1052
  ...e,
1053
1053
  data: {
1054
1054
  ...e.data,
@@ -1059,35 +1059,35 @@ var Xn = ({ onSelect: e }) => {
1059
1059
  }]
1060
1060
  },
1061
1061
  type: "conditional"
1062
- } : e) : i;
1062
+ } : e) : r;
1063
1063
  }));
1064
1064
  }, [
1065
1065
  t,
1066
- i,
1067
- o,
1068
- s
1066
+ r,
1067
+ a,
1068
+ o
1069
1069
  ]), d = V((e, t) => {
1070
- let n = i(e);
1070
+ let n = r(e);
1071
1071
  if (!n) return;
1072
- let r = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), s = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), l = parseFloat(r) || 100, u = parseFloat(s) || 100, d = n.position.y + l + 100, f = a(), p = o(), m = f.filter((t) => p.some((n) => n.source === e && n.target === t.id)).map((e) => e.position.x);
1073
- c(n, {
1072
+ let o = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), c = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), l = parseFloat(o) || 100, u = parseFloat(c) || 100, d = n.position.y + l + 100, f = i(), p = a(), m = f.filter((t) => p.some((n) => n.source === e && n.target === t.id)).map((e) => e.position.x);
1073
+ s(n, {
1074
1074
  x: m.length === 0 ? n.position.x : m.length % 2 == 1 ? Math.max(...m) + u + 50 : Math.min(...m) - u - 50,
1075
1075
  y: d
1076
1076
  }, !0, t);
1077
1077
  }, [
1078
+ r,
1078
1079
  i,
1079
1080
  a,
1080
- o,
1081
- c
1082
- ]), f = V((n, a) => {
1083
- let o = i(n);
1084
- if (!(o && r(o))) return;
1085
- s();
1086
- let c = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), l = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), u = parseFloat(c) || 100, d = parseFloat(l) || 100, f = o.position.y + u + 100, p = d / 2 + 50 / 2, m = (e, t) => {
1081
+ s
1082
+ ]), f = V((n, i) => {
1083
+ let a = r(n);
1084
+ if (!(a && l(a))) return;
1085
+ o();
1086
+ let s = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), c = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), u = parseFloat(s) || 100, d = parseFloat(c) || 100, f = a.position.y + u + 100, p = d / 2 + 50 / 2, m = (e, t) => {
1087
1087
  let n = {
1088
1088
  ...$n,
1089
- ...a ? { type: a.type } : {},
1090
- data: { ...a?.data ?? $n.data },
1089
+ ...i ? { type: i.type } : {},
1090
+ data: { ...i?.data ?? $n.data },
1091
1091
  id: Qn(),
1092
1092
  position: {
1093
1093
  x: e,
@@ -1095,8 +1095,8 @@ var Xn = ({ onSelect: e }) => {
1095
1095
  },
1096
1096
  selected: t
1097
1097
  };
1098
- return o.parentId && (n.parentId = o.parentId), n;
1099
- }, h = m(o.position.x - p, !0), g = m(o.position.x + p, !1);
1098
+ return a.parentId && (n.parentId = a.parentId), n;
1099
+ }, h = m(a.position.x - p, !0), g = m(a.position.x + p, !1);
1100
1100
  e((e) => e.concat(h, g)), t((e) => {
1101
1101
  let t = () => [{
1102
1102
  field: n,
@@ -1127,18 +1127,18 @@ var Xn = ({ onSelect: e }) => {
1127
1127
  })));
1128
1128
  });
1129
1129
  }, [
1130
- i,
1130
+ r,
1131
1131
  e,
1132
1132
  t,
1133
- s
1134
- ]), p = V((n, r) => {
1135
- let a = i(n);
1136
- if (!a) return;
1137
- let c = o(), l = c.filter((e) => e.source === n);
1133
+ o
1134
+ ]), p = V((n, i) => {
1135
+ let s = r(n);
1136
+ if (!s) return;
1137
+ let c = a(), l = c.filter((e) => e.source === n);
1138
1138
  if (l.length !== 1) return;
1139
- let u = l[0], d = i(u.target);
1139
+ let u = l[0], d = r(u.target);
1140
1140
  if (!d) return;
1141
- s();
1141
+ o();
1142
1142
  let f = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), p = (parseFloat(f) || 100) + 100, m = new Set([d.id]), h = [d.id];
1143
1143
  for (; h.length > 0;) {
1144
1144
  let e = h.shift();
@@ -1148,9 +1148,9 @@ var Xn = ({ onSelect: e }) => {
1148
1148
  }
1149
1149
  let g = Qn(), _ = {
1150
1150
  ...$n,
1151
- ...r && {
1152
- data: r.data ?? {},
1153
- type: r.type
1151
+ ...i && {
1152
+ data: i.data ?? {},
1153
+ type: i.type
1154
1154
  },
1155
1155
  id: g,
1156
1156
  position: {
@@ -1159,7 +1159,7 @@ var Xn = ({ onSelect: e }) => {
1159
1159
  },
1160
1160
  selected: !0
1161
1161
  };
1162
- a.parentId && (_.parentId = a.parentId), e((e) => e.map((e) => m.has(e.id) ? {
1162
+ s.parentId && (_.parentId = s.parentId), e((e) => e.map((e) => m.has(e.id) ? {
1163
1163
  ...e,
1164
1164
  position: {
1165
1165
  x: e.position.x,
@@ -1183,33 +1183,33 @@ var Xn = ({ onSelect: e }) => {
1183
1183
  })));
1184
1184
  });
1185
1185
  }, [
1186
- i,
1187
- o,
1186
+ r,
1187
+ a,
1188
1188
  e,
1189
1189
  t,
1190
- s
1191
- ]), m = V((n, r) => {
1192
- let a = i(n), o = i(r);
1193
- if (!(a && o)) return;
1194
- s(), t((e) => e.map((e) => e.source === n && e.target === r ? {
1190
+ o
1191
+ ]), m = V((n, i) => {
1192
+ let a = r(n), s = r(i);
1193
+ if (!(a && s)) return;
1194
+ o(), t((e) => e.map((e) => e.source === n && e.target === i ? {
1195
1195
  ...e,
1196
- source: r,
1196
+ source: i,
1197
1197
  target: n
1198
1198
  } : e.target === n ? {
1199
1199
  ...e,
1200
- target: r
1201
- } : e.source === r ? {
1200
+ target: i
1201
+ } : e.source === i ? {
1202
1202
  ...e,
1203
1203
  source: n
1204
1204
  } : e));
1205
- let c = a.measured?.height, l = o.measured?.height, u = c != null && l != null ? l - c : 0;
1205
+ let c = a.measured?.height, l = s.measured?.height, u = c != null && l != null ? l - c : 0;
1206
1206
  e((e) => e.map((e) => e.id === n ? {
1207
1207
  ...e,
1208
1208
  position: {
1209
1209
  x: e.position.x,
1210
- y: o.position.y + u
1210
+ y: s.position.y + u
1211
1211
  }
1212
- } : e.id === r ? {
1212
+ } : e.id === i ? {
1213
1213
  ...e,
1214
1214
  position: {
1215
1215
  x: e.position.x,
@@ -1217,47 +1217,47 @@ var Xn = ({ onSelect: e }) => {
1217
1217
  }
1218
1218
  } : e));
1219
1219
  }, [
1220
- i,
1220
+ r,
1221
1221
  e,
1222
1222
  t,
1223
- s
1223
+ o
1224
1224
  ]), h = V((e) => {
1225
- let t = o(), n = t.filter((t) => t.target === e);
1225
+ let t = a(), n = t.filter((t) => t.target === e);
1226
1226
  if (n.length !== 1 || t.filter((t) => t.source === e).length > 1) return;
1227
1227
  let r = n[0].source;
1228
1228
  t.filter((e) => e.source === r).length === 1 && m(r, e);
1229
- }, [o, m]), g = V((e) => {
1230
- let t = o(), n = t.filter((t) => t.source === e);
1229
+ }, [a, m]), g = V((e) => {
1230
+ let t = a(), n = t.filter((t) => t.source === e);
1231
1231
  if (n.length !== 1) return;
1232
1232
  let r = n[0].target;
1233
1233
  t.filter((e) => e.target === r).length === 1 && (t.filter((e) => e.source === r).length > 1 || m(e, r));
1234
- }, [o, m]), _ = V((e, t) => {
1235
- let r = t.fromNode;
1236
- if (!r) return;
1237
- let { clientX: a, clientY: s } = "changedTouches" in e ? e.changedTouches[0] : e, u = document.elementFromPoint(a, s)?.closest?.(".react-flow__node")?.getAttribute("data-id") ?? null ?? t.toNode?.id ?? null;
1238
- if (u && u !== r.id) {
1239
- let e = i(u), t = o(), n = !t.some((e) => e.source === r.id), a = !t.some((e) => e.source === u);
1240
- e && n && a && l(r, e);
1234
+ }, [a, m]), _ = V((e, t) => {
1235
+ let i = t.fromNode;
1236
+ if (!i) return;
1237
+ let { clientX: o, clientY: l } = "changedTouches" in e ? e.changedTouches[0] : e, u = document.elementFromPoint(o, l)?.closest?.(".react-flow__node")?.getAttribute("data-id") ?? null ?? t.toNode?.id ?? null;
1238
+ if (u && u !== i.id) {
1239
+ let e = r(u), t = a(), n = !t.some((e) => e.source === i.id), o = !t.some((e) => e.source === u);
1240
+ e && n && o && c(i, e);
1241
1241
  return;
1242
1242
  }
1243
1243
  if (!t.isValid) {
1244
1244
  let e = n({
1245
- x: a,
1246
- y: s
1247
- }), t = r.parentId ? i(r.parentId) : void 0, o = t?.position ?? {
1245
+ x: o,
1246
+ y: l
1247
+ }), t = i.parentId ? r(i.parentId) : void 0, a = t?.position ?? {
1248
1248
  x: 0,
1249
1249
  y: 0
1250
1250
  };
1251
- c(r, t ? {
1252
- x: e.x - o.x,
1253
- y: e.y - o.y
1251
+ s(i, t ? {
1252
+ x: e.x - a.x,
1253
+ y: e.y - a.y
1254
1254
  } : e, !0);
1255
1255
  }
1256
1256
  }, [
1257
- l,
1258
1257
  c,
1259
- i,
1260
- o,
1258
+ s,
1259
+ r,
1260
+ a,
1261
1261
  n
1262
1262
  ]), v = V((e) => {
1263
1263
  t((t) => or(t.filter((t) => !e.find((e) => e.id === t.id)), new Set(e.map((e) => e.source))));
@@ -1265,11 +1265,11 @@ var Xn = ({ onSelect: e }) => {
1265
1265
  return {
1266
1266
  isValidConnection: V((e) => {
1267
1267
  if (e.source === e.target) return !1;
1268
- let t = i(e.source);
1268
+ let t = r(e.source);
1269
1269
  if (!t) return !1;
1270
- let n = o();
1271
- return rr(n, e.source, e.target) || ar(n, e.source, e.target) ? !1 : !(n.filter((t) => t.source === e.source).length > 0 && !r(t));
1272
- }, [i, o]),
1270
+ let n = a();
1271
+ return rr(n, e.source, e.target) || ar(n, e.source, e.target) ? !1 : !(n.filter((t) => t.source === e.source).length > 0 && !l(t));
1272
+ }, [r, a]),
1273
1273
  moveStackNodeDown: g,
1274
1274
  moveStackNodeUp: h,
1275
1275
  onAddFromHandle: d,
@@ -1392,7 +1392,7 @@ var Xn = ({ onSelect: e }) => {
1392
1392
  ]
1393
1393
  });
1394
1394
  }, lr = () => {
1395
- let e = Fe(), t = U(() => e.filter(d), [e]), n = U(() => e.filter((e) => e.selected), [e]), r = U(() => e.find((e) => e.selected), [e]);
1395
+ let e = Fe(), t = U(() => e.filter(i), [e]), n = U(() => e.filter((e) => e.selected), [e]), r = U(() => e.find((e) => e.selected), [e]);
1396
1396
  return {
1397
1397
  groupNodes: t,
1398
1398
  hasSelectedNodes: n.length > 0,
@@ -1401,7 +1401,7 @@ var Xn = ({ onSelect: e }) => {
1401
1401
  selectedNodes: n
1402
1402
  };
1403
1403
  }, ur = ({ targetNodes: e, hideLabel: t, onChange: n } = {}) => {
1404
- let [r, i] = W(""), [a, o] = W(""), [s, c] = W(!1), [l, u] = W(!1), { selectedNode: f, groupNodes: p } = lr(), { setNodes: m } = Le(), h = Z(), g = Ge(), v = Ge(), y = Ge(), b = U(() => e ?? (f ? [f] : []), [e, f]), x = b.length > 0 && b.every(d), C = U(() => new Set(b.map((e) => e.id)), [b]), w = U(() => new Set(b.map((e) => e.parentId)), [b]).size > 1, D = !w && b[0] ? b[0].parentId : void 0, O = D ? p.find((e) => e.id === D) : void 0, k = O?.data?.label?.en ?? "", A = w ? "" : D ?? "none", j = h(w ? "editor.selectNodeGroup.mixed" : "editor.selectNodeGroup.noGroup"), ee = (e) => {
1404
+ let [r, a] = W(""), [o, s] = W(""), [c, l] = W(!1), [u, d] = W(!1), { selectedNode: f, groupNodes: p } = lr(), { setNodes: m } = Le(), h = Z(), g = Ge(), v = Ge(), y = Ge(), b = U(() => e ?? (f ? [f] : []), [e, f]), x = b.length > 0 && b.every(i), C = U(() => new Set(b.map((e) => e.id)), [b]), w = U(() => new Set(b.map((e) => e.parentId)), [b]).size > 1, D = !w && b[0] ? b[0].parentId : void 0, O = D ? p.find((e) => e.id === D) : void 0, k = O?.data?.label?.en ?? "", A = w ? "" : D ?? "none", j = h(w ? "editor.selectNodeGroup.mixed" : "editor.selectNodeGroup.noGroup"), ee = (e) => {
1405
1405
  b.length !== 0 && (m((t) => e === "none" ? t.map((e) => {
1406
1406
  if (C.has(e.id)) {
1407
1407
  let { parentId: t, extent: n, ...r } = e;
@@ -1447,10 +1447,10 @@ var Xn = ({ onSelect: e }) => {
1447
1447
  };
1448
1448
  }
1449
1449
  return e;
1450
- })]), i(""), c(!1), X.success("Group created", { description: `The group "${e}" has been created successfully.` }), n?.();
1450
+ })]), a(""), l(!1), X.success("Group created", { description: `The group "${e}" has been created successfully.` }), n?.();
1451
1451
  }, ne = () => {
1452
- if (!(a.trim() && O)) return;
1453
- let e = a.trim();
1452
+ if (!(o.trim() && O)) return;
1453
+ let e = o.trim();
1454
1454
  if (p.find((t) => t.id !== O.id && String(t.data?.label?.en ?? "").toLowerCase() === e.toLowerCase())) {
1455
1455
  X.error("This group already exists", { description: "Choose a different name." });
1456
1456
  return;
@@ -1464,11 +1464,11 @@ var Xn = ({ onSelect: e }) => {
1464
1464
  en: e
1465
1465
  }
1466
1466
  }
1467
- } : t)), u(!1);
1467
+ } : t)), d(!1);
1468
1468
  };
1469
1469
  return H(() => {
1470
- l && o(String(k ?? ""));
1471
- }, [l, k]), x || b.length === 0 ? null : /* @__PURE__ */ q("div", {
1470
+ u && s(String(k ?? ""));
1471
+ }, [u, k]), x || b.length === 0 ? null : /* @__PURE__ */ q("div", {
1472
1472
  className: "tg:space-y-2",
1473
1473
  children: [!t && /* @__PURE__ */ K(I, {
1474
1474
  htmlFor: g,
@@ -1492,8 +1492,8 @@ var Xn = ({ onSelect: e }) => {
1492
1492
  }, e.id))] }) })]
1493
1493
  }),
1494
1494
  O && /* @__PURE__ */ q(_, {
1495
- open: l,
1496
- onOpenChange: u,
1495
+ open: u,
1496
+ onOpenChange: d,
1497
1497
  children: [/* @__PURE__ */ K(_e, {
1498
1498
  asChild: !0,
1499
1499
  children: /* @__PURE__ */ K(L, {
@@ -1524,8 +1524,8 @@ var Xn = ({ onSelect: e }) => {
1524
1524
  }), /* @__PURE__ */ K(F, {
1525
1525
  autoFocus: !0,
1526
1526
  id: y,
1527
- value: a,
1528
- onChange: (e) => o(e.target.value),
1527
+ value: o,
1528
+ onChange: (e) => s(e.target.value),
1529
1529
  onKeyDown: (e) => {
1530
1530
  e.key === "Enter" && (e.preventDefault(), ne());
1531
1531
  }
@@ -1536,12 +1536,12 @@ var Xn = ({ onSelect: e }) => {
1536
1536
  children: [/* @__PURE__ */ K(L, {
1537
1537
  variant: "outline",
1538
1538
  size: "sm",
1539
- onClick: () => u(!1),
1539
+ onClick: () => d(!1),
1540
1540
  children: h("common.cancel")
1541
1541
  }), /* @__PURE__ */ K(L, {
1542
1542
  size: "sm",
1543
1543
  onClick: ne,
1544
- disabled: !a.trim(),
1544
+ disabled: !o.trim(),
1545
1545
  children: h("common.save")
1546
1546
  })]
1547
1547
  })
@@ -1550,8 +1550,8 @@ var Xn = ({ onSelect: e }) => {
1550
1550
  })]
1551
1551
  }),
1552
1552
  /* @__PURE__ */ q(_, {
1553
- open: s,
1554
- onOpenChange: c,
1553
+ open: c,
1554
+ onOpenChange: l,
1555
1555
  children: [/* @__PURE__ */ K(_e, {
1556
1556
  asChild: !0,
1557
1557
  children: /* @__PURE__ */ K(L, {
@@ -1586,7 +1586,7 @@ var Xn = ({ onSelect: e }) => {
1586
1586
  autoFocus: !0,
1587
1587
  id: v,
1588
1588
  value: r,
1589
- onChange: (e) => i(e.target.value),
1589
+ onChange: (e) => a(e.target.value),
1590
1590
  placeholder: "Ex: Step 1 - Personal info",
1591
1591
  onKeyDown: (e) => {
1592
1592
  e.key === "Enter" && (e.preventDefault(), te());
@@ -1598,7 +1598,7 @@ var Xn = ({ onSelect: e }) => {
1598
1598
  children: [/* @__PURE__ */ K(L, {
1599
1599
  variant: "outline",
1600
1600
  size: "sm",
1601
- onClick: () => c(!1),
1601
+ onClick: () => l(!1),
1602
1602
  children: h("common.cancel")
1603
1603
  }), /* @__PURE__ */ K(L, {
1604
1604
  size: "sm",
@@ -1635,31 +1635,31 @@ function mr({ className: e, variant: t, asChild: n = !1, ...r }) {
1635
1635
  //#endregion
1636
1636
  //#region src/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.tsx
1637
1637
  var hr = ({ nodeId: e, groupId: t }) => {
1638
- let [n, r] = W(!1), i = Z(), a = Fe(), o = U(() => a.find((t) => t.id === e), [a, e]), s = U(() => t ? a.find((e) => e.id === t) : void 0, [a, t]), c = d(s) ? i(s.data?.label) : "", l = fr(t), u = (e) => e.stopPropagation();
1638
+ let [n, r] = W(!1), a = Z(), o = Fe(), s = U(() => o.find((t) => t.id === e), [o, e]), c = U(() => t ? o.find((e) => e.id === t) : void 0, [o, t]), l = i(c) ? a(c.data?.label) : "", u = fr(t), d = (e) => e.stopPropagation();
1639
1639
  return /* @__PURE__ */ q(_, {
1640
1640
  open: n,
1641
1641
  onOpenChange: r,
1642
1642
  children: [/* @__PURE__ */ K(_e, {
1643
1643
  asChild: !0,
1644
- onClick: u,
1644
+ onClick: d,
1645
1645
  children: t ? /* @__PURE__ */ q(mr, {
1646
1646
  variant: "default",
1647
1647
  className: "nodrag nopan tg:cursor-pointer tg:px-1.5 tg:py-0 tg:text-[10px] tg:text-white tg:capitalize tg:[&>svg]:size-2.5",
1648
- style: { backgroundColor: l },
1649
- title: c || t,
1648
+ style: { backgroundColor: u },
1649
+ title: l || t,
1650
1650
  children: [/* @__PURE__ */ K(Qe, {}), /* @__PURE__ */ K(it, {})]
1651
1651
  }) : /* @__PURE__ */ q(mr, {
1652
1652
  variant: "secondary",
1653
1653
  className: "nodrag nopan tg:cursor-pointer tg:px-1.5 tg:py-0 tg:[&>svg]:size-2.5",
1654
- title: i("editor.selectNodeGroup.group"),
1654
+ title: a("editor.selectNodeGroup.group"),
1655
1655
  children: [/* @__PURE__ */ K(Qe, {}), /* @__PURE__ */ K(it, {})]
1656
1656
  })
1657
1657
  }), /* @__PURE__ */ K(se, {
1658
1658
  align: "start",
1659
1659
  className: "tg:w-80",
1660
- onClick: u,
1661
- children: o && /* @__PURE__ */ K(ur, {
1662
- targetNodes: [o],
1660
+ onClick: d,
1661
+ children: s && /* @__PURE__ */ K(ur, {
1662
+ targetNodes: [s],
1663
1663
  onChange: () => r(!1)
1664
1664
  })
1665
1665
  })]
@@ -1996,12 +1996,12 @@ var hr = ({ nodeId: e, groupId: t }) => {
1996
1996
  case "checkbox": return [];
1997
1997
  default: return "";
1998
1998
  }
1999
- }, Nr = (e) => e.replace(/^[a-z][\w+.-]*:\/\/[^/]+/i, "") || e, Pr = ({ nodeId: t, data: n }) => {
2000
- let [r, i] = W(!1), [a, c] = W(""), [l, u] = W(""), [d, p] = W(""), [m, g] = W(""), [v, y] = W(null), { language: b, headers: x } = _n(), { updateNodeData: S } = yr(), w = Z(), T = n?.type;
1999
+ }, Nr = (e) => e.replace(/^[a-z][\w+.-]*:\/\/[^/]+/i, "") || e, Pr = ({ nodeId: e, data: t }) => {
2000
+ let [n, i] = W(!1), [a, s] = W(""), [c, l] = W(""), [d, f] = W(""), [m, g] = W(""), [v, y] = W(null), { language: b, headers: x } = _n(), { updateNodeData: S } = yr(), w = Z(), T = t?.type;
2001
2001
  if (!T) return null;
2002
- let E = Ar(n), D = E ? n.optionsSource?.url : void 0, O = D ?? (T === "http" ? n.httpConfig?.url : void 0), k = E ? n.options ?? [] : [], A = E, j = E, M = h({
2003
- data: n,
2004
- id: t,
2002
+ let E = Ar(t), D = E ? t.optionsSource?.url : void 0, O = D ?? (T === "http" ? t.httpConfig?.url : void 0), k = E ? t.options ?? [] : [], A = E, j = E, M = h({
2003
+ data: t,
2004
+ id: e,
2005
2005
  position: {
2006
2006
  x: 0,
2007
2007
  y: 0
@@ -2009,21 +2009,21 @@ var hr = ({ nodeId: e, groupId: t }) => {
2009
2009
  type: "input"
2010
2010
  }), ee = {
2011
2011
  data: {
2012
- ...n,
2012
+ ...t,
2013
2013
  name: void 0,
2014
2014
  required: void 0
2015
2015
  },
2016
- id: t,
2016
+ id: e,
2017
2017
  position: {
2018
2018
  x: 0,
2019
2019
  y: 0
2020
2020
  },
2021
2021
  type: "input"
2022
2022
  }, re = () => {
2023
- c(""), u(""), p(""), g("");
2024
- }, ie = (e) => {
2025
- e?.preventDefault();
2026
- let n = a.trim(), r = l.trim();
2023
+ s(""), l(""), f(""), g("");
2024
+ }, ie = (t) => {
2025
+ t?.preventDefault();
2026
+ let n = a.trim(), r = c.trim();
2027
2027
  if (!(n || r)) return;
2028
2028
  let o = m.trim(), s = {
2029
2029
  label: { [b]: n },
@@ -2031,19 +2031,19 @@ var hr = ({ nodeId: e, groupId: t }) => {
2031
2031
  ...A && d && { image: d },
2032
2032
  ...j && o && { description: { [b]: o } }
2033
2033
  };
2034
- S(t, { options: v === null ? [...k, s] : k.map((e, t) => t === v ? s : e) }), re(), y(null), i(!1);
2034
+ S(e, { options: v === null ? [...k, s] : k.map((e, t) => t === v ? s : e) }), re(), y(null), i(!1);
2035
2035
  }, P = (e) => {
2036
2036
  i(e), e || (re(), y(null));
2037
2037
  }, ae = (e) => {
2038
2038
  let t = k[e];
2039
- t && (c(w(t.label) || ""), u(t.value || ""), p(t.image ?? ""), g(w(t.description) || ""), y(e), i(!0));
2040
- }, oe = (e) => {
2041
- S(t, { options: k.filter((t, n) => n !== e) });
2039
+ t && (s(w(t.label) || ""), l(t.value || ""), f(t.image ?? ""), g(w(t.description) || ""), y(e), i(!0));
2040
+ }, oe = (t) => {
2041
+ S(e, { options: k.filter((e, n) => n !== t) });
2042
2042
  }, ce = (e) => {
2043
2043
  e.key === "Enter" && (e.preventDefault(), ie());
2044
2044
  }, le = (e) => e.stopPropagation();
2045
2045
  if (T === "hidden") {
2046
- let e = Rn(T), t = n.defaultValue?.type === "static" ? n.defaultValue.staticValue : void 0, r = n.defaultValue?.type === "reference" ? n.defaultValue.referenceField : void 0, i = Array.isArray(t) ? t.join(", ") : typeof t == "boolean" ? String(t) : t ?? (r ? `→ ${r}` : "");
2046
+ let e = Rn(T), n = t.defaultValue?.type === "static" ? t.defaultValue.staticValue : void 0, r = t.defaultValue?.type === "reference" ? t.defaultValue.referenceField : void 0, i = Array.isArray(n) ? n.join(", ") : typeof n == "boolean" ? String(n) : n ?? (r ? `→ ${r}` : "");
2047
2047
  return /* @__PURE__ */ q("div", {
2048
2048
  className: "tg:pointer-events-none tg:flex tg:select-none tg:flex-col tg:gap-1 tg:text-sm",
2049
2049
  children: [/* @__PURE__ */ q("div", {
@@ -2057,7 +2057,7 @@ var hr = ({ nodeId: e, groupId: t }) => {
2057
2057
  }
2058
2058
  let I = ge[T];
2059
2059
  if (!I) return null;
2060
- let ue = e(n.helperText, b), de = f(n, b), fe = ({ option: e, index: t, variant: n }) => {
2060
+ let ue = u(t.helperText, b), de = p(t, b), fe = ({ option: e, index: t, variant: n }) => {
2061
2061
  let r = String(e.value), i = w(e.label) || r;
2062
2062
  return /* @__PURE__ */ q(G, { children: [r && r !== i && n !== "card" && /* @__PURE__ */ K("span", {
2063
2063
  className: "tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-2 tg:max-w-18 tg:-translate-y-1/2 tg:truncate tg:text-[10px] tg:text-muted-foreground/60 tg:group-hover/option:hidden",
@@ -2090,7 +2090,7 @@ var hr = ({ nodeId: e, groupId: t }) => {
2090
2090
  return /* @__PURE__ */ q(G, { children: [
2091
2091
  /* @__PURE__ */ K("div", {
2092
2092
  className: B("tg:pointer-events-none tg:flex tg:select-none tg:flex-col tg:gap-1 tg:[&_label:empty]:hidden", T === "submit" && "tg:items-center"),
2093
- children: /* @__PURE__ */ K(s, {
2093
+ children: /* @__PURE__ */ K(r, {
2094
2094
  value: {
2095
2095
  headers: x,
2096
2096
  language: b,
@@ -2099,7 +2099,7 @@ var hr = ({ nodeId: e, groupId: t }) => {
2099
2099
  children: /* @__PURE__ */ K(o, {
2100
2100
  render: I,
2101
2101
  field: {
2102
- id: t,
2102
+ id: e,
2103
2103
  name: M,
2104
2104
  placeholder: de || void 0,
2105
2105
  value: Mr(T)
@@ -2173,7 +2173,7 @@ var hr = ({ nodeId: e, groupId: t }) => {
2173
2173
  ]
2174
2174
  }, i);
2175
2175
  }), /* @__PURE__ */ q(_, {
2176
- open: r,
2176
+ open: n,
2177
2177
  onOpenChange: P,
2178
2178
  children: [/* @__PURE__ */ K(_e, {
2179
2179
  asChild: !0,
@@ -2198,27 +2198,27 @@ var hr = ({ nodeId: e, groupId: t }) => {
2198
2198
  children: [
2199
2199
  A && /* @__PURE__ */ K(kr, {
2200
2200
  value: d,
2201
- onChange: p
2201
+ onChange: f
2202
2202
  }),
2203
2203
  /* @__PURE__ */ K(F, {
2204
- id: `${t}-option-label`,
2204
+ id: `${e}-option-label`,
2205
2205
  autoFocus: !0,
2206
2206
  placeholder: w("editor.inputNodeForm.optionLabel"),
2207
2207
  value: a,
2208
- onChange: (e) => c(e.target.value),
2208
+ onChange: (e) => s(e.target.value),
2209
2209
  onKeyDown: ce
2210
2210
  }),
2211
2211
  /* @__PURE__ */ K(F, {
2212
- id: `${t}-option-value`,
2212
+ id: `${e}-option-value`,
2213
2213
  placeholder: w("editor.inputNodeForm.optionValue"),
2214
- value: l,
2215
- onChange: (e) => u(e.target.value),
2214
+ value: c,
2215
+ onChange: (e) => l(e.target.value),
2216
2216
  onKeyDown: ce
2217
2217
  })
2218
2218
  ]
2219
2219
  }),
2220
2220
  j && /* @__PURE__ */ K(F, {
2221
- id: `${t}-option-description`,
2221
+ id: `${e}-option-description`,
2222
2222
  placeholder: w("editor.inputNodeForm.optionDescription"),
2223
2223
  value: m,
2224
2224
  onChange: (e) => g(e.target.value),
@@ -2237,7 +2237,7 @@ var hr = ({ nodeId: e, groupId: t }) => {
2237
2237
  type: "submit",
2238
2238
  size: "sm",
2239
2239
  className: "tg:flex-1",
2240
- disabled: !(a.trim() || l.trim()),
2240
+ disabled: !(a.trim() || c.trim()),
2241
2241
  children: w(v === null ? "common.create" : "common.save")
2242
2242
  })]
2243
2243
  })
@@ -2423,9 +2423,9 @@ var Wr = (e) => Re(Ur((t) => {
2423
2423
  })
2424
2424
  }) : null;
2425
2425
  }, Kr = Object.values(Q), qr = Object.values(Fn), Jr = ({ nodeId: e, nodeType: t, subType: n }) => {
2426
- let { updateNodeType: r } = yr(), { getEdges: a } = Le(), { openNodeTypeChangeConfirmation: o } = _n(), s = Z(), c = (e) => e.stopPropagation(), l = n || t, u = l, d = Rn(l), f = (t, n) => {
2427
- let s = a().filter((t) => t.source === e).length;
2428
- if (t === i.ui && s > 1) {
2426
+ let { updateNodeType: r } = yr(), { getEdges: i } = Le(), { openNodeTypeChangeConfirmation: o } = _n(), s = Z(), c = (e) => e.stopPropagation(), l = n || t, u = l, d = Rn(l), f = (t, n) => {
2427
+ let s = i().filter((t) => t.source === e).length;
2428
+ if (t === a.ui && s > 1) {
2429
2429
  o({
2430
2430
  nodeId: e,
2431
2431
  subType: n,
@@ -2455,8 +2455,8 @@ var Wr = (e) => Re(Ur((t) => {
2455
2455
  /* @__PURE__ */ q(Hn, { children: [/* @__PURE__ */ K(Gn, { children: s("editor.selectNodeType.options.input") }), Kr.map((e) => {
2456
2456
  let r = Rn(e);
2457
2457
  return /* @__PURE__ */ q($, {
2458
- onClick: () => f(i.input, e),
2459
- className: B("tg:capitalize", t === i.input && e === n && "tg:bg-accent"),
2458
+ onClick: () => f(a.input, e),
2459
+ className: B("tg:capitalize", t === a.input && e === n && "tg:bg-accent"),
2460
2460
  children: [/* @__PURE__ */ K(r, {}), e]
2461
2461
  }, e);
2462
2462
  })] }),
@@ -2464,8 +2464,8 @@ var Wr = (e) => Re(Ur((t) => {
2464
2464
  /* @__PURE__ */ q(Hn, { children: [/* @__PURE__ */ K(Gn, { children: s("editor.selectNodeType.options.ui") }), qr.map((e) => {
2465
2465
  let r = Rn(e);
2466
2466
  return /* @__PURE__ */ q($, {
2467
- onClick: () => f(i.ui, e),
2468
- className: B("tg:capitalize", t === i.ui && e === n && "tg:bg-accent"),
2467
+ onClick: () => f(a.ui, e),
2468
+ className: B("tg:capitalize", t === a.ui && e === n && "tg:bg-accent"),
2469
2469
  children: [/* @__PURE__ */ K(r, {}), e]
2470
2470
  }, e);
2471
2471
  })] })
@@ -2544,9 +2544,9 @@ var Wr = (e) => Re(Ur((t) => {
2544
2544
  ]
2545
2545
  });
2546
2546
  }), Qr = {
2547
- [i.group]: () => null,
2548
- [i.input]: Zr,
2549
- [i.ui]: Zr
2547
+ [a.group]: () => null,
2548
+ [a.input]: Zr,
2549
+ [a.ui]: Zr
2550
2550
  }, $r = [
2551
2551
  {
2552
2552
  key: "get",
@@ -3738,8 +3738,8 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3738
3738
  ]
3739
3739
  });
3740
3740
  }, Zi = () => {
3741
- let { selectedNodes: e } = lr(), { clearSelection: t, deleteNodes: n } = yr(), r = Z(), i = U(() => e.filter((e) => !d(e)), [e]);
3742
- return i.length < 2 ? null : /* @__PURE__ */ K(De, {
3741
+ let { selectedNodes: e } = lr(), { clearSelection: t, deleteNodes: n } = yr(), r = Z(), a = U(() => e.filter((e) => !i(e)), [e]);
3742
+ return a.length < 2 ? null : /* @__PURE__ */ K(De, {
3743
3743
  position: "top-center",
3744
3744
  className: "tg:pointer-events-auto",
3745
3745
  children: /* @__PURE__ */ q("div", {
@@ -3748,7 +3748,7 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3748
3748
  /* @__PURE__ */ q("span", {
3749
3749
  className: "tg:px-2 tg:font-medium tg:text-sm",
3750
3750
  children: [
3751
- i.length,
3751
+ a.length,
3752
3752
  " ",
3753
3753
  r("editor.multiSelectionPanel.nodesSelected")
3754
3754
  ]
@@ -3759,7 +3759,7 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3759
3759
  }),
3760
3760
  /* @__PURE__ */ K(ur, {
3761
3761
  hideLabel: !0,
3762
- targetNodes: i
3762
+ targetNodes: a
3763
3763
  }),
3764
3764
  /* @__PURE__ */ K(y, {
3765
3765
  orientation: "vertical",
@@ -3769,7 +3769,7 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3769
3769
  variant: "ghost",
3770
3770
  size: "icon",
3771
3771
  onClick: () => {
3772
- n(i.map((e) => e.id)), t();
3772
+ n(a.map((e) => e.id)), t();
3773
3773
  },
3774
3774
  "aria-label": r("editor.multiSelectionPanel.deleteSelected"),
3775
3775
  title: r("editor.multiSelectionPanel.deleteSelected"),
@@ -3847,18 +3847,18 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3847
3847
  "PUT",
3848
3848
  "PATCH"
3849
3849
  ], ta = (e, t) => {
3850
- let n = g(e, t);
3850
+ let n = c(e, t);
3851
3851
  if (!Array.isArray(n) || n.length === 0) return [];
3852
3852
  let r = n[0];
3853
3853
  if (!r || typeof r != "object") return [];
3854
3854
  let i = [];
3855
3855
  for (let [e, t] of Object.entries(r)) if (i.push(e), typeof t == "object" && t && !Array.isArray(t)) for (let n of Object.keys(t)) i.push(`${e}.${n}`);
3856
3856
  return i;
3857
- }, na = ({ request: e, mapping: r, onMappingChange: i, showOptionalFields: a = !1 }) => {
3858
- let [o, s] = W(!1), [c, u] = W([]), [d, f] = W(null), { headers: m } = _n(), { baseUrl: h } = di(), { url: g, method: _ = "GET", headers: v, queryParams: y, body: b, responsePath: x = "" } = e, C = Z(), w = U(() => c.map((e) => ({
3857
+ }, na = ({ request: r, mapping: i, onMappingChange: a, showOptionalFields: o = !1 }) => {
3858
+ let [s, c] = W(!1), [l, u] = W([]), [d, f] = W(null), { headers: p } = _n(), { baseUrl: h } = di(), { url: g, method: _ = "GET", headers: v, queryParams: y, body: b, responsePath: x = "" } = r, C = Z(), w = U(() => l.map((e) => ({
3859
3859
  label: e,
3860
3860
  value: e
3861
- })), [c]), D = U(() => {
3861
+ })), [l]), D = U(() => {
3862
3862
  let e = /* @__PURE__ */ new Set();
3863
3863
  for (let t of [
3864
3864
  g,
@@ -3875,56 +3875,56 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3875
3875
  X.error(C("editor.optionsSourceForm.urlRequired"));
3876
3876
  return;
3877
3877
  }
3878
- s(!0);
3878
+ c(!0);
3879
3879
  try {
3880
- let e = await l({
3880
+ let r = await n({
3881
3881
  body: b && ea.includes(_) ? b : void 0,
3882
- headers: n(m, v),
3882
+ headers: t(p, v),
3883
3883
  method: _,
3884
3884
  queryParams: y,
3885
- url: p(g, h)
3885
+ url: e(g, h)
3886
3886
  });
3887
- if (!e.success) {
3888
- X.error(e.error || C("editor.optionsSourceForm.detectFailed"), k);
3887
+ if (!r.success) {
3888
+ X.error(r.error || C("editor.optionsSourceForm.detectFailed"), k);
3889
3889
  return;
3890
3890
  }
3891
- let i = ta(e.data, x);
3892
- if (i.length === 0) {
3891
+ let a = ta(r.data, x);
3892
+ if (a.length === 0) {
3893
3893
  X.error(C("editor.optionsSourceForm.noFieldsDetected"), k), u([]), f(null);
3894
3894
  return;
3895
3895
  }
3896
- u(i), r.valueField && r.labelField ? f(t(e.data, x, r).length) : f(null), X.success(C("editor.optionsSourceForm.detectSuccess"));
3896
+ u(a), i.valueField && i.labelField ? f(m(r.data, x, i).length) : f(null), X.success(C("editor.optionsSourceForm.detectSuccess"));
3897
3897
  } catch (e) {
3898
3898
  X.error(e instanceof Error ? e.message : C("editor.optionsSourceForm.detectFailed"), k);
3899
3899
  } finally {
3900
- s(!1);
3900
+ c(!1);
3901
3901
  }
3902
- }, j = (e, t, n, a) => {
3903
- let o = r[e] ?? "";
3902
+ }, j = (e, t, n, r) => {
3903
+ let o = i[e] ?? "";
3904
3904
  return w.length === 0 ? /* @__PURE__ */ q(z, {
3905
3905
  className: "tg:min-w-0",
3906
3906
  children: [/* @__PURE__ */ q(I, {
3907
3907
  className: "tg:text-xs",
3908
- children: [t, a && /* @__PURE__ */ K("span", {
3908
+ children: [t, r && /* @__PURE__ */ K("span", {
3909
3909
  className: "tg:text-red-500",
3910
3910
  children: " *"
3911
3911
  })]
3912
3912
  }), /* @__PURE__ */ K(F, {
3913
3913
  value: o,
3914
3914
  placeholder: n,
3915
- onChange: ({ target: t }) => i({ [e]: t.value || void 0 })
3915
+ onChange: ({ target: t }) => a({ [e]: t.value || void 0 })
3916
3916
  })]
3917
3917
  }) : /* @__PURE__ */ q(z, {
3918
3918
  className: "tg:min-w-0",
3919
3919
  children: [/* @__PURE__ */ q(I, {
3920
3920
  className: "tg:text-xs",
3921
- children: [t, a && /* @__PURE__ */ K("span", {
3921
+ children: [t, r && /* @__PURE__ */ K("span", {
3922
3922
  className: "tg:text-red-500",
3923
3923
  children: " *"
3924
3924
  })]
3925
3925
  }), /* @__PURE__ */ q(S, {
3926
3926
  value: o || void 0,
3927
- onValueChange: (t) => i({ [e]: t || void 0 }),
3927
+ onValueChange: (t) => a({ [e]: t || void 0 }),
3928
3928
  children: [/* @__PURE__ */ K(P, {
3929
3929
  className: "tg:w-full tg:min-w-0",
3930
3930
  children: /* @__PURE__ */ K(M, { placeholder: n })
@@ -3950,8 +3950,8 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3950
3950
  variant: "outline",
3951
3951
  size: "sm",
3952
3952
  onClick: A,
3953
- disabled: o || !g,
3954
- children: [o ? /* @__PURE__ */ K(kt, { className: "tg:mr-2 tg:h-4 tg:w-4 tg:animate-spin" }) : /* @__PURE__ */ K(Wt, { className: "tg:mr-2 tg:h-4 tg:w-4" }), C("editor.optionsSourceForm.detect")]
3953
+ disabled: s || !g,
3954
+ children: [s ? /* @__PURE__ */ K(kt, { className: "tg:mr-2 tg:h-4 tg:w-4 tg:animate-spin" }) : /* @__PURE__ */ K(Wt, { className: "tg:mr-2 tg:h-4 tg:w-4" }), C("editor.optionsSourceForm.detect")]
3955
3955
  }), d !== null && /* @__PURE__ */ K("span", {
3956
3956
  className: "tg:text-muted-foreground tg:text-xs",
3957
3957
  children: C("editor.optionsSourceForm.previewCount").replace("{count}", String(d))
@@ -3962,8 +3962,8 @@ var Hi = ({ aiConfig: e, onGenerate: t }) => {
3962
3962
  children: [
3963
3963
  j("labelField", C("editor.optionsSourceForm.labelField"), C("editor.optionsSourceForm.labelFieldPlaceholder"), !0),
3964
3964
  j("valueField", C("editor.optionsSourceForm.valueField"), C("editor.optionsSourceForm.valueFieldPlaceholder"), !0),
3965
- a && j("descriptionField", C("editor.optionsSourceForm.descriptionField"), C("editor.optionsSourceForm.descriptionFieldPlaceholder"), !1),
3966
- a && j("imageField", C("editor.optionsSourceForm.imageField"), C("editor.optionsSourceForm.imageFieldPlaceholder"), !1)
3965
+ o && j("descriptionField", C("editor.optionsSourceForm.descriptionField"), C("editor.optionsSourceForm.descriptionFieldPlaceholder"), !1),
3966
+ o && j("imageField", C("editor.optionsSourceForm.imageField"), C("editor.optionsSourceForm.imageFieldPlaceholder"), !1)
3967
3967
  ]
3968
3968
  })
3969
3969
  ]
@@ -5989,31 +5989,31 @@ var ba = (e) => Object.values(Ji).includes(e), xa = () => {
5989
5989
  })
5990
5990
  });
5991
5991
  }, Ca = Object.values(Q), wa = Object.values(Fn), Ta = () => {
5992
- let { selectedNode: e } = lr(), { updateSelectedNodeType: t } = yr(), { getEdges: n } = Le(), { openNodeTypeChangeConfirmation: a } = _n(), o = d(e), s = Z(), c = Ge(), l = () => e ? r(e) || u(e) ? e.data?.type || "" : e.type || "" : "", f = (r, o) => {
5992
+ let { selectedNode: e } = lr(), { updateSelectedNodeType: t } = yr(), { getEdges: n } = Le(), { openNodeTypeChangeConfirmation: r } = _n(), o = i(e), s = Z(), c = Ge(), u = () => e ? l(e) || d(e) ? e.data?.type || "" : e.type || "" : "", f = (i, o) => {
5993
5993
  if (!e) return;
5994
5994
  let s = n().filter((t) => t.source === e.id).length;
5995
- if (r === i.ui && s > 1) {
5996
- a({
5995
+ if (i === a.ui && s > 1) {
5996
+ r({
5997
5997
  nodeId: e.id,
5998
5998
  subType: o,
5999
- type: r
5999
+ type: i
6000
6000
  });
6001
6001
  return;
6002
6002
  }
6003
- t(r, o);
6003
+ t(i, o);
6004
6004
  };
6005
6005
  return /* @__PURE__ */ q(me, { children: [/* @__PURE__ */ K(ie, {
6006
6006
  htmlFor: c,
6007
6007
  children: s("editor.selectNodeType.nodeType")
6008
6008
  }), /* @__PURE__ */ q(S, {
6009
- value: l(),
6009
+ value: u(),
6010
6010
  onValueChange: (e) => {
6011
6011
  if (Ca.includes(e)) {
6012
- f(i.input, e);
6012
+ f(a.input, e);
6013
6013
  return;
6014
6014
  }
6015
6015
  if (wa.includes(e)) {
6016
- f(i.ui, e);
6016
+ f(a.ui, e);
6017
6017
  return;
6018
6018
  }
6019
6019
  f(e);
@@ -6026,7 +6026,7 @@ var ba = (e) => Object.values(Ji).includes(e), xa = () => {
6026
6026
  }), /* @__PURE__ */ K(E, {
6027
6027
  className: "treege-scrollbar tg:max-h-80",
6028
6028
  children: o ? /* @__PURE__ */ K(me, { children: /* @__PURE__ */ K(T, {
6029
- value: i.group,
6029
+ value: a.group,
6030
6030
  children: s("editor.selectNodeType.options.group")
6031
6031
  }) }) : /* @__PURE__ */ q(G, { children: [
6032
6032
  /* @__PURE__ */ q(me, { children: [/* @__PURE__ */ K(ie, { children: s("editor.selectNodeType.options.input") }), Ca.map((e) => /* @__PURE__ */ q(T, {
@@ -6115,8 +6115,8 @@ function Na({ className: e, ...t }) {
6115
6115
  //#endregion
6116
6116
  //#region src/editor/features/TreegeEditor/sheets/NodeActionsSheet.tsx
6117
6117
  var Pa = () => {
6118
- let { selectedNode: e } = lr(), { clearSelection: t } = yr(), { isNodeSheetOpen: n, setIsNodeSheetOpen: i, openDeleteNodeConfirmation: a } = _n(), o = Z(), s = o(e?.data?.label), c = () => {
6119
- i(!1), t();
6118
+ let { selectedNode: e } = lr(), { clearSelection: t } = yr(), { isNodeSheetOpen: n, setIsNodeSheetOpen: r, openDeleteNodeConfirmation: a } = _n(), o = Z(), s = o(e?.data?.label), c = () => {
6119
+ r(!1), t();
6120
6120
  };
6121
6121
  return /* @__PURE__ */ K(Ea, {
6122
6122
  open: n && !!e,
@@ -6142,9 +6142,9 @@ var Pa = () => {
6142
6142
  /* @__PURE__ */ K(Ta, {}),
6143
6143
  /* @__PURE__ */ K(ur, {}),
6144
6144
  /* @__PURE__ */ K(y, {}),
6145
- r(e) && /* @__PURE__ */ K(xa, {}),
6146
- u(e) && /* @__PURE__ */ K(Sa, {}),
6147
- d(e) && /* @__PURE__ */ K($i, {})
6145
+ l(e) && /* @__PURE__ */ K(xa, {}),
6146
+ d(e) && /* @__PURE__ */ K(Sa, {}),
6147
+ i(e) && /* @__PURE__ */ K($i, {})
6148
6148
  ]
6149
6149
  })
6150
6150
  }),
@@ -6240,14 +6240,14 @@ var Pa = () => {
6240
6240
  ]
6241
6241
  })
6242
6242
  });
6243
- }, Ba = ({ flow: e, onExportJson: t, onSave: n, onLanguageChange: r, aiConfig: i, extraMenuItems: a, openApi: o, baseUrl: s, onAuthorize: c, headers: l, onHeadersChange: u, language: d, theme: f = "dark", defaultLanguage: p = "en" }) => {
6244
- let h = d !== void 0, [g, _] = W(p), v = h ? d : g, y = V((e) => {
6243
+ }, Ba = ({ flow: e, onExportJson: t, onSave: n, onLanguageChange: r, aiConfig: i, extraMenuItems: a, openApi: o, baseUrl: s, onAuthorize: c, headers: l, onHeadersChange: u, language: d, theme: p = "dark", defaultLanguage: m = "en" }) => {
6244
+ let h = d !== void 0, [g, _] = W(m), v = h ? d : g, y = V((e) => {
6245
6245
  h || _(e), r?.(e);
6246
6246
  }, [h, r]);
6247
- return /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(mn, {}), /* @__PURE__ */ q(m, {
6248
- defaultTheme: f,
6247
+ return /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(mn, {}), /* @__PURE__ */ q(f, {
6248
+ defaultTheme: p,
6249
6249
  storageKey: "treege-editor-theme",
6250
- theme: f,
6250
+ theme: p,
6251
6251
  children: [/* @__PURE__ */ K(Fa, { position: "bottom-center" }), /* @__PURE__ */ K(gn, {
6252
6252
  value: {
6253
6253
  aiConfig: i,
@@ -6263,7 +6263,7 @@ var Pa = () => {
6263
6263
  onExportJson: t,
6264
6264
  onSave: n,
6265
6265
  flow: e,
6266
- theme: f,
6266
+ theme: p,
6267
6267
  extraMenuItems: a,
6268
6268
  onAuthorize: c,
6269
6269
  headers: l,