treege 3.0.0-beta.79 → 3.0.0-beta.80
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.
- package/dist/editor/utils/cleanEmptyData.d.ts +18 -0
- package/dist/editor/utils/cleanNodeConfig.d.ts +3 -3
- package/dist/{editor-CqWlTe-N.js → editor-Dw_ODEe1.js} +374 -337
- package/dist/editor.js +1 -1
- package/dist/main.js +3 -3
- package/dist/{renderer-DOEjomS9.js → renderer-CN83AtIp.js} +1 -1
- package/dist/renderer-native.js +1 -1
- package/dist/renderer.js +2 -2
- package/dist/{useRenderNode-DJ0mFozt.js → useRenderNode-BZ7fZJxT.js} +29 -39
- package/package.json +1 -1
|
@@ -1685,11 +1685,10 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1685
1685
|
keepFor: (e) => e === Q.submit,
|
|
1686
1686
|
key: "submitConfig"
|
|
1687
1687
|
}
|
|
1688
|
-
], jr = (e, t) => {
|
|
1689
|
-
let n;
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
}, Mr = () => {
|
|
1688
|
+
], jr = (e, t) => Ar.some(({ key: n, keepFor: r }) => n === e && !r(t)), Mr = (e, t) => {
|
|
1689
|
+
let n = Object.entries(e).filter(([e]) => !jr(e, t));
|
|
1690
|
+
return Object.fromEntries(n);
|
|
1691
|
+
}, Nr = () => {
|
|
1693
1692
|
let { setNodes: e, setEdges: t, getNodes: n } = ze(), { takeSnapshot: r } = hr(), i = V(() => {
|
|
1694
1693
|
e((e) => e.map(({ selected: e, ...t }) => t)), t((e) => e.map(({ selected: e, ...t }) => t));
|
|
1695
1694
|
}, [t, e]), a = V((n) => {
|
|
@@ -1711,7 +1710,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1711
1710
|
let r = e.type === n ? e.data : {};
|
|
1712
1711
|
return {
|
|
1713
1712
|
...e,
|
|
1714
|
-
data: i === void 0 ? r :
|
|
1713
|
+
data: i === void 0 ? r : Mr({
|
|
1715
1714
|
...r,
|
|
1716
1715
|
type: i
|
|
1717
1716
|
}, i),
|
|
@@ -1772,34 +1771,34 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1772
1771
|
updateSelectedNodeData: l,
|
|
1773
1772
|
updateSelectedNodeType: c
|
|
1774
1773
|
};
|
|
1775
|
-
},
|
|
1774
|
+
}, Pr = 400, Fr = .8, Ir = (e) => new Promise((t, n) => {
|
|
1776
1775
|
let r = new FileReader();
|
|
1777
1776
|
r.onerror = () => n(/* @__PURE__ */ Error("read_failed")), r.onload = () => {
|
|
1778
1777
|
let e = new Image();
|
|
1779
1778
|
e.onload = () => t(e), e.onerror = () => n(/* @__PURE__ */ Error("decode_failed")), e.src = r.result;
|
|
1780
1779
|
}, r.readAsDataURL(e);
|
|
1781
|
-
}),
|
|
1780
|
+
}), Lr = async (e) => {
|
|
1782
1781
|
if (!e.type.startsWith("image/")) throw Error("invalid_type");
|
|
1783
1782
|
if (e.size > 5242880) throw Error("too_large");
|
|
1784
|
-
let t = await
|
|
1783
|
+
let t = await Ir(e), n = Math.min(1, Pr / Math.max(t.width, t.height)), r = document.createElement("canvas");
|
|
1785
1784
|
r.width = Math.round(t.width * n), r.height = Math.round(t.height * n);
|
|
1786
1785
|
let i = r.getContext("2d");
|
|
1787
1786
|
if (!i) throw Error("canvas_unavailable");
|
|
1788
|
-
return i.drawImage(t, 0, 0, r.width, r.height), r.toDataURL("image/jpeg",
|
|
1789
|
-
},
|
|
1787
|
+
return i.drawImage(t, 0, 0, r.width, r.height), r.toDataURL("image/jpeg", Fr);
|
|
1788
|
+
}, Rr = 400, zr = (e) => {
|
|
1790
1789
|
if (!/^https?:\/\//i.test(e)) return !1;
|
|
1791
1790
|
try {
|
|
1792
1791
|
return !!new URL(e).hostname;
|
|
1793
1792
|
} catch {
|
|
1794
1793
|
return !1;
|
|
1795
1794
|
}
|
|
1796
|
-
},
|
|
1797
|
-
let [n, r] = W(!1), [i, a] = W(t && /^https?:\/\//i.test(t) ? t : ""), { updateNodeData: o } =
|
|
1795
|
+
}, Br = ({ nodeId: e, image: t }) => {
|
|
1796
|
+
let [n, r] = W(!1), [i, a] = W(t && /^https?:\/\//i.test(t) ? t : ""), { updateNodeData: o } = Nr(), s = Je(null), c = Je(null), l = Z(), u = (t) => {
|
|
1798
1797
|
o(e, { image: t || void 0 });
|
|
1799
1798
|
}, d = async (e) => {
|
|
1800
1799
|
let t = e.target.files?.[0];
|
|
1801
1800
|
if (t) try {
|
|
1802
|
-
u(await
|
|
1801
|
+
u(await Lr(t)), r(!1);
|
|
1803
1802
|
} catch (e) {
|
|
1804
1803
|
let t = e.message;
|
|
1805
1804
|
t === "too_large" ? Y.error(l("editor.inputNodeForm.optionImageTooLarge")) : t === "invalid_type" ? Y.error(l("editor.inputNodeForm.optionImageInvalid")) : Y.error(l("editor.inputNodeForm.optionImageError"));
|
|
@@ -1813,7 +1812,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1813
1812
|
let n = e.target.value;
|
|
1814
1813
|
a(n), c.current && clearTimeout(c.current);
|
|
1815
1814
|
let r = n.trim();
|
|
1816
|
-
!
|
|
1815
|
+
!zr(r) || r === t || (c.current = setTimeout(() => u(r), Rr));
|
|
1817
1816
|
}, m = (e) => {
|
|
1818
1817
|
e.stopPropagation(), u("");
|
|
1819
1818
|
}, h = (e) => e.stopPropagation();
|
|
@@ -1887,7 +1886,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1887
1886
|
]
|
|
1888
1887
|
})]
|
|
1889
1888
|
})] });
|
|
1890
|
-
},
|
|
1889
|
+
}, Vr = [
|
|
1891
1890
|
{
|
|
1892
1891
|
key: "get",
|
|
1893
1892
|
method: "GET"
|
|
@@ -1908,23 +1907,23 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1908
1907
|
key: "patch",
|
|
1909
1908
|
method: "PATCH"
|
|
1910
1909
|
}
|
|
1911
|
-
],
|
|
1910
|
+
], Hr = (e) => {
|
|
1912
1911
|
if (!e || typeof e != "object") return !1;
|
|
1913
1912
|
let t = e;
|
|
1914
1913
|
return typeof t.openapi != "string" || !t.openapi.startsWith("3.") ? !1 : !!(t.paths && typeof t.paths == "object");
|
|
1915
|
-
},
|
|
1914
|
+
}, Ur = (e) => e.startsWith("{"), Wr = async (e) => {
|
|
1916
1915
|
let t = await fetch(e);
|
|
1917
1916
|
if (!t.ok) throw Error(`HTTP ${t.status} ${t.statusText}`);
|
|
1918
1917
|
return t.json();
|
|
1919
|
-
},
|
|
1918
|
+
}, Gr = (e) => Ur(e) ? Promise.resolve(JSON.parse(e)) : Wr(e), Kr = async (e) => {
|
|
1920
1919
|
let t = e.trim();
|
|
1921
1920
|
if (!t) throw Error("Empty input");
|
|
1922
|
-
let n = await
|
|
1923
|
-
if (!
|
|
1921
|
+
let n = await Gr(t);
|
|
1922
|
+
if (!Hr(n)) throw Error("Not a valid OpenAPI 3.x document");
|
|
1924
1923
|
return n;
|
|
1925
|
-
},
|
|
1924
|
+
}, qr = (e) => {
|
|
1926
1925
|
let t = [];
|
|
1927
|
-
for (let [n, r] of Object.entries(e.paths ?? {})) if (r) for (let { key: e, method: i } of
|
|
1926
|
+
for (let [n, r] of Object.entries(e.paths ?? {})) if (r) for (let { key: e, method: i } of Vr) {
|
|
1928
1927
|
let a = r[e];
|
|
1929
1928
|
a && t.push({
|
|
1930
1929
|
method: i,
|
|
@@ -1934,7 +1933,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1934
1933
|
});
|
|
1935
1934
|
}
|
|
1936
1935
|
return t;
|
|
1937
|
-
},
|
|
1936
|
+
}, Jr = (e) => (e.servers?.[0]?.url ?? "").replace(/\/$/, ""), Yr = (e) => {
|
|
1938
1937
|
let t = e.components?.securitySchemes ?? {}, n = [];
|
|
1939
1938
|
for (let [e, r] of Object.entries(t)) {
|
|
1940
1939
|
if (!r || typeof r != "object") continue;
|
|
@@ -1970,7 +1969,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1970
1969
|
}
|
|
1971
1970
|
}
|
|
1972
1971
|
return n;
|
|
1973
|
-
},
|
|
1972
|
+
}, Xr = {
|
|
1974
1973
|
baseUrl: "",
|
|
1975
1974
|
baseUrlOverride: "",
|
|
1976
1975
|
document: null,
|
|
@@ -1979,11 +1978,11 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1979
1978
|
setBaseUrlOverride: () => {},
|
|
1980
1979
|
setDocument: () => {},
|
|
1981
1980
|
setLastSourceInput: () => {}
|
|
1982
|
-
},
|
|
1981
|
+
}, Zr = We(null), Qr = ({ children: e, initialDocument: t, initialBaseUrl: n }) => {
|
|
1983
1982
|
let [r, i] = W(typeof t == "object" ? t ?? null : null), [a, o] = W(n ?? ""), [s, c] = W(typeof t == "string" ? {
|
|
1984
1983
|
mode: "url",
|
|
1985
1984
|
value: t
|
|
1986
|
-
} : null), l = U(() => r ?
|
|
1985
|
+
} : null), l = U(() => r ? qr(r) : [], [r]), u = U(() => a.trim().replace(/\/$/, "") || (r ? Jr(r) : ""), [r, a]), d = U(() => ({
|
|
1987
1986
|
baseUrl: u,
|
|
1988
1987
|
baseUrlOverride: a,
|
|
1989
1988
|
document: r,
|
|
@@ -2002,7 +2001,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2002
2001
|
return H(() => {
|
|
2003
2002
|
if (typeof t != "string") return;
|
|
2004
2003
|
let e = t, n = !1;
|
|
2005
|
-
return
|
|
2004
|
+
return Kr(e).then((t) => {
|
|
2006
2005
|
n || (i(t), c({
|
|
2007
2006
|
mode: "url",
|
|
2008
2007
|
value: e
|
|
@@ -2012,22 +2011,22 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2012
2011
|
}), () => {
|
|
2013
2012
|
n = !0;
|
|
2014
2013
|
};
|
|
2015
|
-
}, [t]), /* @__PURE__ */ K(
|
|
2014
|
+
}, [t]), /* @__PURE__ */ K(Zr.Provider, {
|
|
2016
2015
|
value: d,
|
|
2017
2016
|
children: e
|
|
2018
2017
|
});
|
|
2019
|
-
},
|
|
2018
|
+
}, $r = () => Ke(Zr) ?? Xr, ei = 400, ti = (e) => {
|
|
2020
2019
|
if (!/^https?:\/\//i.test(e)) return !1;
|
|
2021
2020
|
try {
|
|
2022
2021
|
return !!new URL(e).hostname;
|
|
2023
2022
|
} catch {
|
|
2024
2023
|
return !1;
|
|
2025
2024
|
}
|
|
2026
|
-
},
|
|
2025
|
+
}, ni = ({ value: e, onChange: t }) => {
|
|
2027
2026
|
let n = Je(null), r = Je(null), [i, a] = W(!1), [o, s] = W(e && /^https?:\/\//i.test(e) ? e : ""), c = Z(), l = async (e) => {
|
|
2028
2027
|
let r = e.target.files?.[0];
|
|
2029
2028
|
if (r) try {
|
|
2030
|
-
t(await
|
|
2029
|
+
t(await Lr(r)), a(!1);
|
|
2031
2030
|
} catch (e) {
|
|
2032
2031
|
let t = e.message;
|
|
2033
2032
|
t === "too_large" ? Y.error(c("editor.inputNodeForm.optionImageTooLarge")) : t === "invalid_type" ? Y.error(c("editor.inputNodeForm.optionImageInvalid")) : Y.error(c("editor.inputNodeForm.optionImageError"));
|
|
@@ -2095,9 +2094,9 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2095
2094
|
let i = n.target.value;
|
|
2096
2095
|
s(i), r.current && clearTimeout(r.current);
|
|
2097
2096
|
let a = i.trim();
|
|
2098
|
-
!
|
|
2097
|
+
!ti(a) || a === e || (r.current = setTimeout(() => {
|
|
2099
2098
|
t(a);
|
|
2100
|
-
},
|
|
2099
|
+
}, ei));
|
|
2101
2100
|
},
|
|
2102
2101
|
onKeyDown: (e) => {
|
|
2103
2102
|
e.key === "Enter" && (e.preventDefault(), u());
|
|
@@ -2119,7 +2118,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2119
2118
|
})
|
|
2120
2119
|
]
|
|
2121
2120
|
});
|
|
2122
|
-
},
|
|
2121
|
+
}, ri = (e) => !!(e && "type" in e && e.type && qn.includes(e.type)), ii = new Set(["radio", "checkbox"]), ai = (e) => {
|
|
2123
2122
|
switch (e) {
|
|
2124
2123
|
case "number":
|
|
2125
2124
|
case "daterange":
|
|
@@ -2129,10 +2128,10 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2129
2128
|
case "checkbox": return [];
|
|
2130
2129
|
default: return "";
|
|
2131
2130
|
}
|
|
2132
|
-
},
|
|
2133
|
-
let [r, i] = W(!1), [o, s] = W(""), [c, l] = W(""), [u, p] = W(""), [m, h] = W(""), [g, v] = W(null), { language: b, headers: ee } = X(), { baseUrl: x } =
|
|
2131
|
+
}, oi = (e) => e.replace(/^[a-z][\w+.-]*:\/\/[^/]+/i, "") || e, si = ({ nodeId: t, data: n }) => {
|
|
2132
|
+
let [r, i] = W(!1), [o, s] = W(""), [c, l] = W(""), [u, p] = W(""), [m, h] = W(""), [g, v] = W(null), { language: b, headers: ee } = X(), { baseUrl: x } = $r(), { updateNodeData: S } = Nr(), w = Z(), T = n?.type;
|
|
2134
2133
|
if (!T) return null;
|
|
2135
|
-
let E =
|
|
2134
|
+
let E = ri(n), D = E ? n.optionsSource?.url : void 0, O = D ?? (T === "http" ? n.httpConfig?.url : void 0), ne = E ? n.options ?? [] : [], k = E, A = E, ie = f({
|
|
2136
2135
|
data: n,
|
|
2137
2136
|
id: t,
|
|
2138
2137
|
position: {
|
|
@@ -2231,7 +2230,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2231
2230
|
children: /* @__PURE__ */ K(Yt, {})
|
|
2232
2231
|
})]
|
|
2233
2232
|
})] });
|
|
2234
|
-
}, R = E && !
|
|
2233
|
+
}, R = E && !ii.has(T) && !D;
|
|
2235
2234
|
return /* @__PURE__ */ q(G, { children: [
|
|
2236
2235
|
/* @__PURE__ */ K("div", {
|
|
2237
2236
|
className: "tg:pointer-events-none tg:flex tg:select-none tg:flex-col tg:gap-1 tg:[&_label:empty]:hidden",
|
|
@@ -2247,7 +2246,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2247
2246
|
id: `${t}-preview`,
|
|
2248
2247
|
name: ie,
|
|
2249
2248
|
placeholder: ue || void 0,
|
|
2250
|
-
value:
|
|
2249
|
+
value: ai(T)
|
|
2251
2250
|
},
|
|
2252
2251
|
extra: {
|
|
2253
2252
|
compactOptions: !0,
|
|
@@ -2269,7 +2268,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2269
2268
|
className: "nodrag nopan tg:my-1 tg:flex tg:items-center tg:gap-1 tg:text-muted-foreground tg:text-xs",
|
|
2270
2269
|
children: [/* @__PURE__ */ K(bt, { className: "tg:size-3 tg:shrink-0" }), /* @__PURE__ */ K("span", {
|
|
2271
2270
|
className: "tg:truncate",
|
|
2272
|
-
children:
|
|
2271
|
+
children: oi(O)
|
|
2273
2272
|
})]
|
|
2274
2273
|
})
|
|
2275
2274
|
}), /* @__PURE__ */ K(y, {
|
|
@@ -2342,7 +2341,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2342
2341
|
/* @__PURE__ */ q("div", {
|
|
2343
2342
|
className: "tg:flex tg:items-start tg:gap-2",
|
|
2344
2343
|
children: [
|
|
2345
|
-
k && /* @__PURE__ */ K(
|
|
2344
|
+
k && /* @__PURE__ */ K(ni, {
|
|
2346
2345
|
value: u,
|
|
2347
2346
|
onChange: p
|
|
2348
2347
|
}),
|
|
@@ -2393,8 +2392,8 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2393
2392
|
})]
|
|
2394
2393
|
})
|
|
2395
2394
|
] });
|
|
2396
|
-
},
|
|
2397
|
-
let { language: a } = X(), { updateNodeData: o, clearSelection: s } =
|
|
2395
|
+
}, ci = ({ nodeId: e, label: t, placeholder: n, className: r, autoFocus: i }) => {
|
|
2396
|
+
let { language: a } = X(), { updateNodeData: o, clearSelection: s } = Nr(), c = Z(), l = Je(null), u = t?.[a] ?? "", d = n || c("editor.treegeNode.labelPlaceholder");
|
|
2398
2397
|
return H(() => {
|
|
2399
2398
|
if (!i) return;
|
|
2400
2399
|
let e = setTimeout(() => {
|
|
@@ -2417,8 +2416,8 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2417
2416
|
},
|
|
2418
2417
|
className: I("nodrag nopan tg:w-full tg:truncate tg:bg-transparent tg:outline-none tg:placeholder:text-muted-foreground/40", r)
|
|
2419
2418
|
});
|
|
2420
|
-
},
|
|
2421
|
-
let { selectNode: n } =
|
|
2419
|
+
}, li = ({ nodeId: e, className: t }) => {
|
|
2420
|
+
let { selectNode: n } = Nr(), { setIsNodeSheetOpen: r, openDeleteNodeConfirmation: i } = X(), a = Z(), o = (e) => e.stopPropagation();
|
|
2422
2421
|
return /* @__PURE__ */ q(Qn, {
|
|
2423
2422
|
modal: !1,
|
|
2424
2423
|
children: [/* @__PURE__ */ K($n, {
|
|
@@ -2453,8 +2452,8 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2453
2452
|
]
|
|
2454
2453
|
})]
|
|
2455
2454
|
});
|
|
2456
|
-
},
|
|
2457
|
-
let { updateNodeData: n } =
|
|
2455
|
+
}, ui = ({ nodeId: e, required: t }) => {
|
|
2456
|
+
let { updateNodeData: n } = Nr(), r = Z();
|
|
2458
2457
|
return /* @__PURE__ */ K(ae, { children: /* @__PURE__ */ q(be, {
|
|
2459
2458
|
disableHoverableContent: !0,
|
|
2460
2459
|
children: [/* @__PURE__ */ K(C, {
|
|
@@ -2474,12 +2473,12 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2474
2473
|
children: r(t ? "editor.inputNodeForm.required" : "editor.inputNodeForm.optional")
|
|
2475
2474
|
})]
|
|
2476
2475
|
}) });
|
|
2477
|
-
},
|
|
2476
|
+
}, di = (e) => Symbol.iterator in e, fi = (e) => "entries" in e, pi = (e, t) => {
|
|
2478
2477
|
let n = e instanceof Map ? e : new Map(e.entries()), r = t instanceof Map ? t : new Map(t.entries());
|
|
2479
2478
|
if (n.size !== r.size) return !1;
|
|
2480
2479
|
for (let [e, t] of n) if (!r.has(e) || !Object.is(t, r.get(e))) return !1;
|
|
2481
2480
|
return !0;
|
|
2482
|
-
},
|
|
2481
|
+
}, mi = (e, t) => {
|
|
2483
2482
|
let n = e[Symbol.iterator](), r = t[Symbol.iterator](), i = n.next(), a = r.next();
|
|
2484
2483
|
for (; !i.done && !a.done;) {
|
|
2485
2484
|
if (!Object.is(i.value, a.value)) return !1;
|
|
@@ -2487,21 +2486,21 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2487
2486
|
}
|
|
2488
2487
|
return !!i.done && !!a.done;
|
|
2489
2488
|
};
|
|
2490
|
-
function
|
|
2491
|
-
return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 :
|
|
2489
|
+
function hi(e, t) {
|
|
2490
|
+
return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 : di(e) && di(t) ? fi(e) && fi(t) ? pi(e, t) : mi(e, t) : pi({ entries: () => Object.entries(e) }, { entries: () => Object.entries(t) });
|
|
2492
2491
|
}
|
|
2493
2492
|
//#endregion
|
|
2494
2493
|
//#region node_modules/zustand/esm/react/shallow.mjs
|
|
2495
|
-
function
|
|
2494
|
+
function gi(e) {
|
|
2496
2495
|
let t = Ue.useRef(void 0);
|
|
2497
2496
|
return (n) => {
|
|
2498
2497
|
let r = e(n);
|
|
2499
|
-
return
|
|
2498
|
+
return hi(t.current, r) ? t.current : t.current = r;
|
|
2500
2499
|
};
|
|
2501
2500
|
}
|
|
2502
2501
|
//#endregion
|
|
2503
2502
|
//#region src/editor/hooks/useStackPosition.ts
|
|
2504
|
-
var
|
|
2503
|
+
var _i = (e) => Be(gi((t) => {
|
|
2505
2504
|
let n = Fn(t.edges).get(e) ?? "single";
|
|
2506
2505
|
return {
|
|
2507
2506
|
isStackHead: n === "first" || n === "single",
|
|
@@ -2510,8 +2509,8 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2510
2509
|
isStackTail: n === "last" || n === "single",
|
|
2511
2510
|
position: n
|
|
2512
2511
|
};
|
|
2513
|
-
})),
|
|
2514
|
-
let { position: n, isStackSingle: r } =
|
|
2512
|
+
})), vi = ({ nodeId: e, selected: t }) => {
|
|
2513
|
+
let { position: n, isStackSingle: r } = _i(e), { moveStackNodeUp: i, moveStackNodeDown: a } = br(), o = Z(), { isDecision: s, isSuccessorDecision: c } = Be(gi((t) => {
|
|
2515
2514
|
let n = t.edges.filter((t) => t.source === e), r = n.length === 1 ? n[0].target : null, i = r ? t.edges.filter((e) => e.source === r).length : 0;
|
|
2516
2515
|
return {
|
|
2517
2516
|
isDecision: n.length > 1,
|
|
@@ -2568,8 +2567,8 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2568
2567
|
})]
|
|
2569
2568
|
})
|
|
2570
2569
|
}) : null;
|
|
2571
|
-
},
|
|
2572
|
-
let { updateNodeType: i } =
|
|
2570
|
+
}, yi = Object.values(Q), bi = Object.values(Jn), xi = ({ nodeId: e, nodeType: t, subType: n }) => {
|
|
2571
|
+
let { updateNodeType: i } = Nr(), { getEdges: a } = ze(), { openNodeTypeChangeConfirmation: o } = X(), s = Z(), c = (e) => e.stopPropagation(), l = n || t, u = l, d = Zn(l), f = (t, n) => {
|
|
2573
2572
|
let s = a().filter((t) => t.source === e).length;
|
|
2574
2573
|
if (t === r.ui && s > 1) {
|
|
2575
2574
|
o({
|
|
@@ -2598,7 +2597,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2598
2597
|
className: "treege-scrollbar tg:max-h-80",
|
|
2599
2598
|
onClick: c,
|
|
2600
2599
|
children: [
|
|
2601
|
-
/* @__PURE__ */ q(tr, { children: [/* @__PURE__ */ K(ir, { children: s("editor.selectNodeType.options.input") }),
|
|
2600
|
+
/* @__PURE__ */ q(tr, { children: [/* @__PURE__ */ K(ir, { children: s("editor.selectNodeType.options.input") }), yi.map((e) => {
|
|
2602
2601
|
let i = Zn(e);
|
|
2603
2602
|
return /* @__PURE__ */ q($, {
|
|
2604
2603
|
onClick: () => f(r.input, e),
|
|
@@ -2607,7 +2606,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2607
2606
|
}, e);
|
|
2608
2607
|
})] }),
|
|
2609
2608
|
/* @__PURE__ */ K(ar, {}),
|
|
2610
|
-
/* @__PURE__ */ q(tr, { children: [/* @__PURE__ */ K(ir, { children: s("editor.selectNodeType.options.ui") }),
|
|
2609
|
+
/* @__PURE__ */ q(tr, { children: [/* @__PURE__ */ K(ir, { children: s("editor.selectNodeType.options.ui") }), bi.map((e) => {
|
|
2611
2610
|
let i = Zn(e);
|
|
2612
2611
|
return /* @__PURE__ */ q($, {
|
|
2613
2612
|
onClick: () => f(r.ui, e),
|
|
@@ -2617,20 +2616,20 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2617
2616
|
})] })
|
|
2618
2617
|
]
|
|
2619
2618
|
})] });
|
|
2620
|
-
},
|
|
2619
|
+
}, Si = {
|
|
2621
2620
|
first: "tg:rounded-t-lg tg:rounded-b-none",
|
|
2622
2621
|
last: "tg:rounded-b-lg tg:rounded-t-none",
|
|
2623
2622
|
middle: "tg:rounded-none",
|
|
2624
2623
|
single: "tg:rounded-lg"
|
|
2625
|
-
},
|
|
2624
|
+
}, Ci = ({ children: e, isSubmit: t, stackPosition: n = "single" }) => {
|
|
2626
2625
|
let r = n === "middle" || n === "last";
|
|
2627
2626
|
return /* @__PURE__ */ K("div", {
|
|
2628
|
-
className: I("react-flow__node__wrapper tg:group tg:relative",
|
|
2627
|
+
className: I("react-flow__node__wrapper tg:group tg:relative", Si[n], r && "stacked", t && "submit-type"),
|
|
2629
2628
|
children: e
|
|
2630
2629
|
});
|
|
2631
|
-
},
|
|
2632
|
-
let { id: t, isConnectable: n, parentId: r, selected: i, type: a } = e, { position: o, isStackHead: s, isStackTail: c } =
|
|
2633
|
-
return /* @__PURE__ */ q(
|
|
2630
|
+
}, wi = Ge((e) => {
|
|
2631
|
+
let { id: t, isConnectable: n, parentId: r, selected: i, type: a } = e, { position: o, isStackHead: s, isStackTail: c } = _i(t), l = Fe((e) => e.inProgress), u = Be((e) => e.nodes.filter((e) => e.selected).length > 1), d = e.type === "input" ? e.data : void 0, f = e.type === "ui" ? e.data : void 0, p = d?.type ?? f?.type, m = d?.type === "submit", h = i && !u, g = m || u, _ = !c;
|
|
2632
|
+
return /* @__PURE__ */ q(Ci, {
|
|
2634
2633
|
isSubmit: m,
|
|
2635
2634
|
stackPosition: o,
|
|
2636
2635
|
children: [
|
|
@@ -2646,7 +2645,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2646
2645
|
className: "tg:mb-1 tg:flex tg:items-center tg:justify-between tg:gap-1",
|
|
2647
2646
|
children: [/* @__PURE__ */ q("div", {
|
|
2648
2647
|
className: "tg:flex tg:flex-wrap tg:gap-1",
|
|
2649
|
-
children: [/* @__PURE__ */ K(
|
|
2648
|
+
children: [/* @__PURE__ */ K(xi, {
|
|
2650
2649
|
nodeId: t,
|
|
2651
2650
|
nodeType: a,
|
|
2652
2651
|
subType: p
|
|
@@ -2656,23 +2655,23 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2656
2655
|
})]
|
|
2657
2656
|
}), /* @__PURE__ */ q("div", {
|
|
2658
2657
|
className: "tg:flex tg:min-h-6 tg:items-center tg:gap-0.5",
|
|
2659
|
-
children: [d && !m && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(
|
|
2658
|
+
children: [d && !m && /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(ui, {
|
|
2660
2659
|
nodeId: t,
|
|
2661
2660
|
required: d.required
|
|
2662
|
-
}), /* @__PURE__ */ K(
|
|
2661
|
+
}), /* @__PURE__ */ K(Br, {
|
|
2663
2662
|
nodeId: t,
|
|
2664
2663
|
image: d.image
|
|
2665
|
-
})] }), /* @__PURE__ */ K(
|
|
2664
|
+
})] }), /* @__PURE__ */ K(li, { nodeId: t })]
|
|
2666
2665
|
})]
|
|
2667
2666
|
}),
|
|
2668
|
-
/* @__PURE__ */ K(
|
|
2667
|
+
/* @__PURE__ */ K(ci, {
|
|
2669
2668
|
nodeId: t,
|
|
2670
2669
|
label: e.data?.label,
|
|
2671
2670
|
placeholder: d?.name,
|
|
2672
2671
|
autoFocus: h,
|
|
2673
2672
|
className: I("tg:py-1", a === "ui" && "tg:capitalize")
|
|
2674
2673
|
}),
|
|
2675
|
-
/* @__PURE__ */ K(
|
|
2674
|
+
/* @__PURE__ */ K(si, {
|
|
2676
2675
|
nodeId: t,
|
|
2677
2676
|
data: d
|
|
2678
2677
|
}),
|
|
@@ -2683,35 +2682,35 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2683
2682
|
canBranch: !!d && !m,
|
|
2684
2683
|
isJunction: _
|
|
2685
2684
|
}),
|
|
2686
|
-
/* @__PURE__ */ K(
|
|
2685
|
+
/* @__PURE__ */ K(vi, {
|
|
2687
2686
|
nodeId: t,
|
|
2688
2687
|
selected: i
|
|
2689
2688
|
})
|
|
2690
2689
|
]
|
|
2691
2690
|
});
|
|
2692
|
-
}),
|
|
2691
|
+
}), Ti = {
|
|
2693
2692
|
[r.group]: () => null,
|
|
2694
|
-
[r.input]:
|
|
2695
|
-
[r.ui]:
|
|
2696
|
-
},
|
|
2693
|
+
[r.input]: wi,
|
|
2694
|
+
[r.ui]: wi
|
|
2695
|
+
}, Ei = ({ show: e, onToggle: t }) => /* @__PURE__ */ K(we, {
|
|
2697
2696
|
onClick: t,
|
|
2698
2697
|
title: e ? "Hide minimap" : "Show minimap",
|
|
2699
2698
|
children: K(e ? Pt : Nt, {})
|
|
2700
|
-
}),
|
|
2699
|
+
}), Di = {
|
|
2701
2700
|
"!==": "≠",
|
|
2702
2701
|
"<": "<",
|
|
2703
2702
|
"<=": "≤",
|
|
2704
2703
|
"===": "=",
|
|
2705
2704
|
">": ">",
|
|
2706
2705
|
">=": "≥"
|
|
2707
|
-
},
|
|
2706
|
+
}, Oi = (e, t) => {
|
|
2708
2707
|
let n = e?.filter((e) => e.value !== void 0 && e.value !== "") ?? [];
|
|
2709
2708
|
return n.length === 0 ? "" : n.map((e, n) => {
|
|
2710
|
-
let r =
|
|
2709
|
+
let r = Di[e.operator ?? ""] ?? e.operator ?? "", i = `${e.field ? t(e.field) : ""} ${r} ${e.value ?? ""}`.trim();
|
|
2711
2710
|
return `${n === 0 ? "" : ` ${e.logicalOperator ?? "AND"} `}${i}`;
|
|
2712
2711
|
}).join("");
|
|
2713
|
-
},
|
|
2714
|
-
let { pendingNodeTypeChange: e, closeNodeTypeChangeConfirmation: t } = X(), { getEdges: n, getNode: r, setEdges: i, updateEdgeData: a } = ze(), { updateNodeType: o } =
|
|
2712
|
+
}, ki = () => {
|
|
2713
|
+
let { pendingNodeTypeChange: e, closeNodeTypeChangeConfirmation: t } = X(), { getEdges: n, getNode: r, setEdges: i, updateEdgeData: a } = ze(), { updateNodeType: o } = Nr(), s = Z(), c = U(() => e ? n().filter((t) => t.source === e.nodeId).sort((e, t) => {
|
|
2715
2714
|
let n = r(e.target)?.position ?? {
|
|
2716
2715
|
x: 0,
|
|
2717
2716
|
y: 0
|
|
@@ -2743,7 +2742,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2743
2742
|
}, m = (e) => {
|
|
2744
2743
|
let t = r(e)?.data, n = s(t?.label) || t?.name || e;
|
|
2745
2744
|
return n === e && n.length > 5 ? `${n.slice(0, 5)}…` : n;
|
|
2746
|
-
}, h = (e) => e?.isFallback ? s("editor.conditionalEdge.fallback") : e?.label ? e.label :
|
|
2745
|
+
}, h = (e) => e?.isFallback ? s("editor.conditionalEdge.fallback") : e?.label ? e.label : Oi(e?.conditions, m) || s("editor.changeNodeTypeDialog.noConditions");
|
|
2747
2746
|
return H(() => {
|
|
2748
2747
|
c.length > 0 && u(c[0].id);
|
|
2749
2748
|
}, [c]), /* @__PURE__ */ K(v, {
|
|
@@ -2794,8 +2793,8 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2794
2793
|
]
|
|
2795
2794
|
})
|
|
2796
2795
|
});
|
|
2797
|
-
},
|
|
2798
|
-
let { pendingDeleteNodeId: e, closeDeleteNodeConfirmation: t } = X(), { deleteNode: n } =
|
|
2796
|
+
}, Ai = () => {
|
|
2797
|
+
let { pendingDeleteNodeId: e, closeDeleteNodeConfirmation: t } = X(), { deleteNode: n } = Nr(), r = Z();
|
|
2799
2798
|
return /* @__PURE__ */ K(v, {
|
|
2800
2799
|
open: e !== null,
|
|
2801
2800
|
onOpenChange: (e) => {
|
|
@@ -2815,10 +2814,10 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2815
2814
|
})] })]
|
|
2816
2815
|
})
|
|
2817
2816
|
});
|
|
2818
|
-
},
|
|
2817
|
+
}, ji = 200, Mi = 100, Ni = (e) => !!(e.measured?.width && e.measured?.height), Pi = (e, t, n) => {
|
|
2819
2818
|
let r = n === "TB" ? "y" : "x";
|
|
2820
2819
|
return e.reduce((e, n) => t.node(n.id)[r] < t.node(e.id)[r] ? n : e, e[0]);
|
|
2821
|
-
},
|
|
2820
|
+
}, Fi = (e, t, n) => {
|
|
2822
2821
|
let r = new dn.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
|
|
2823
2822
|
r.setGraph({
|
|
2824
2823
|
nodesep: n.horizontalSpacing,
|
|
@@ -2828,13 +2827,13 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2828
2827
|
let i = /* @__PURE__ */ new Set();
|
|
2829
2828
|
e.forEach((e) => {
|
|
2830
2829
|
i.add(e.id), r.setNode(e.id, {
|
|
2831
|
-
height: e.measured?.height ??
|
|
2832
|
-
width: e.measured?.width ??
|
|
2830
|
+
height: e.measured?.height ?? Mi,
|
|
2831
|
+
width: e.measured?.width ?? ji
|
|
2833
2832
|
});
|
|
2834
2833
|
}), t.forEach((e) => {
|
|
2835
2834
|
i.has(e.source) && i.has(e.target) && r.setEdge(e.source, e.target);
|
|
2836
2835
|
}), dn.layout(r);
|
|
2837
|
-
let a = n.direction === "TB" ? "y" : "x", o = (e) => n.direction === "TB" ? e.measured?.height ??
|
|
2836
|
+
let a = n.direction === "TB" ? "y" : "x", o = (e) => n.direction === "TB" ? e.measured?.height ?? Mi : e.measured?.width ?? ji, s = /* @__PURE__ */ new Map();
|
|
2838
2837
|
e.forEach((e) => {
|
|
2839
2838
|
let t = Math.round(r.node(e.id)[a]);
|
|
2840
2839
|
s.set(t, Math.max(s.get(t) ?? 0, o(e)));
|
|
@@ -2842,15 +2841,15 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2842
2841
|
let c = (e) => {
|
|
2843
2842
|
let t = r.node(e.id)[a];
|
|
2844
2843
|
return t - (s.get(Math.round(t)) ?? o(e)) / 2;
|
|
2845
|
-
}, l =
|
|
2844
|
+
}, l = Pi(e, r, n.direction), u = l.measured?.width ?? ji, d = l.measured?.height ?? Mi, f = r.node(l.id), p = n.direction === "LR" ? l.position.x - c(l) : l.position.x - (f.x - u / 2), m = n.direction === "TB" ? l.position.y - c(l) : l.position.y - (f.y - d / 2), h = /* @__PURE__ */ new Map();
|
|
2846
2845
|
return e.forEach((e) => {
|
|
2847
|
-
let { x: t, y: i } = r.node(e.id), a = e.measured?.width ??
|
|
2846
|
+
let { x: t, y: i } = r.node(e.id), a = e.measured?.width ?? ji, o = e.measured?.height ?? Mi;
|
|
2848
2847
|
h.set(e.id, {
|
|
2849
2848
|
x: n.direction === "LR" ? c(e) + p : t - a / 2 + p,
|
|
2850
2849
|
y: n.direction === "TB" ? c(e) + m : i - o / 2 + m
|
|
2851
2850
|
});
|
|
2852
2851
|
}), h;
|
|
2853
|
-
},
|
|
2852
|
+
}, Ii = (e, t, n, r) => {
|
|
2854
2853
|
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
2855
2854
|
t.forEach((e) => {
|
|
2856
2855
|
o.set(e.source, (o.get(e.source) ?? 0) + 1), s.set(e.target, (s.get(e.target) ?? 0) + 1), i.set(e.source, e.target), a.set(e.target, e.source);
|
|
@@ -2869,7 +2868,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2869
2868
|
let n = l(e.id);
|
|
2870
2869
|
return n ? f(n, t) : t;
|
|
2871
2870
|
}, p = (e, t) => {
|
|
2872
|
-
let n = t.measured?.width ??
|
|
2871
|
+
let n = t.measured?.width ?? ji, i = t.measured?.height ?? Mi;
|
|
2873
2872
|
return r === "TB" ? {
|
|
2874
2873
|
x: e.x,
|
|
2875
2874
|
y: e.y + i
|
|
@@ -2891,25 +2890,25 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2891
2890
|
return n.set(t.id, a), a;
|
|
2892
2891
|
}, r);
|
|
2893
2892
|
});
|
|
2894
|
-
},
|
|
2893
|
+
}, Li = (e, t, n = {}) => {
|
|
2895
2894
|
let r = {
|
|
2896
2895
|
direction: n.direction ?? "TB",
|
|
2897
2896
|
horizontalSpacing: n.horizontalSpacing ?? 60,
|
|
2898
2897
|
verticalSpacing: n.verticalSpacing ?? 80
|
|
2899
|
-
}, i = e.filter((e) => e.type !== "group" &&
|
|
2898
|
+
}, i = e.filter((e) => e.type !== "group" && Ni(e));
|
|
2900
2899
|
if (i.length === 0) return e;
|
|
2901
|
-
let a =
|
|
2902
|
-
return
|
|
2900
|
+
let a = Fi(i, t, r);
|
|
2901
|
+
return Ii(i, t, a, r.direction), e.map((e) => {
|
|
2903
2902
|
let t = a.get(e.id);
|
|
2904
2903
|
return t ? {
|
|
2905
2904
|
...e,
|
|
2906
2905
|
position: t
|
|
2907
2906
|
} : e;
|
|
2908
2907
|
});
|
|
2909
|
-
},
|
|
2910
|
-
let { getNodes: r, getEdges: i, setNodes: a } = ze(), o = Re(), s = Be(
|
|
2908
|
+
}, Ri = (e) => Array.from(e.nodeLookup.values()).map((e) => `${e.id}:${e.measured?.width ?? 0}x${e.measured?.height ?? 0}`).join("|"), zi = ({ direction: e, horizontalSpacing: t, verticalSpacing: n } = {}) => {
|
|
2909
|
+
let { getNodes: r, getEdges: i, setNodes: a } = ze(), o = Re(), s = Be(Ri);
|
|
2911
2910
|
return H(() => {
|
|
2912
|
-
o && s && a(
|
|
2911
|
+
o && s && a(Li(r(), i(), {
|
|
2913
2912
|
direction: e,
|
|
2914
2913
|
horizontalSpacing: t,
|
|
2915
2914
|
verticalSpacing: n
|
|
@@ -2924,7 +2923,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2924
2923
|
i,
|
|
2925
2924
|
a
|
|
2926
2925
|
]), null;
|
|
2927
|
-
},
|
|
2926
|
+
}, Bi = ({ onChange: e, debounceMs: t = 150 }) => {
|
|
2928
2927
|
let { flowId: n } = X(), r = Le(), i = Ie(), a = Je("");
|
|
2929
2928
|
a.current ||= dr();
|
|
2930
2929
|
let o = Je(e);
|
|
@@ -2944,7 +2943,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2944
2943
|
n,
|
|
2945
2944
|
t
|
|
2946
2945
|
]), null;
|
|
2947
|
-
},
|
|
2946
|
+
}, Vi = async (e, t, n, r) => {
|
|
2948
2947
|
let i = /^https?:\/\//i.test(e.tokenUrl) ? e.tokenUrl : `${t.replace(/\/$/, "")}/${e.tokenUrl.replace(/^\//, "")}`, a = new URLSearchParams({
|
|
2949
2948
|
grant_type: "password",
|
|
2950
2949
|
password: r,
|
|
@@ -2961,8 +2960,8 @@ var gi = (e) => Be(hi((t) => {
|
|
|
2961
2960
|
let s = await o.json();
|
|
2962
2961
|
if (!s.access_token) throw Error("Token endpoint did not return an access_token");
|
|
2963
2962
|
return ["Authorization", `${s.token_type ? `${s.token_type[0].toUpperCase()}${s.token_type.slice(1).toLowerCase()}` : "Bearer"} ${s.access_token}`];
|
|
2964
|
-
},
|
|
2965
|
-
let [r, i] = W({}), [a, o] = W(!1), { document: s, baseUrl: c } =
|
|
2963
|
+
}, Hi = ({ open: e, onOpenChange: t, onAuthorize: n }) => {
|
|
2964
|
+
let [r, i] = W({}), [a, o] = W(!1), { document: s, baseUrl: c } = $r(), l = Z(), u = U(() => s ? Yr(s) : [], [s]), d = (e, t) => t ? `${e}:${t}` : e;
|
|
2966
2965
|
return H(() => {
|
|
2967
2966
|
e && i({});
|
|
2968
2967
|
}, [e]), /* @__PURE__ */ K(v, {
|
|
@@ -3070,7 +3069,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
3070
3069
|
} else if (n.type === "oauth2") {
|
|
3071
3070
|
let i = r[d(t, "username")]?.trim(), a = r[d(t, "password")];
|
|
3072
3071
|
if (!(i && a)) continue;
|
|
3073
|
-
let [o, s] = await
|
|
3072
|
+
let [o, s] = await Vi(n, c, i, a);
|
|
3074
3073
|
e[o] = s;
|
|
3075
3074
|
}
|
|
3076
3075
|
n?.(e), t(!1);
|
|
@@ -3089,23 +3088,23 @@ var gi = (e) => Be(hi((t) => {
|
|
|
3089
3088
|
]
|
|
3090
3089
|
})
|
|
3091
3090
|
});
|
|
3092
|
-
},
|
|
3091
|
+
}, Ui = (e) => Object.entries(e ?? {}).map(([e, t]) => ({
|
|
3093
3092
|
key: e,
|
|
3094
3093
|
value: t
|
|
3095
|
-
})),
|
|
3094
|
+
})), Wi = (e) => {
|
|
3096
3095
|
let t = {};
|
|
3097
3096
|
return e?.forEach(({ key: e, value: n }) => {
|
|
3098
3097
|
e && (t[e] = n);
|
|
3099
3098
|
}), t;
|
|
3100
|
-
},
|
|
3101
|
-
let [n, r] = W(() =>
|
|
3102
|
-
return e !== i && (a(e), r(
|
|
3099
|
+
}, Gi = (e, t) => {
|
|
3100
|
+
let [n, r] = W(() => Ui(e)), [i, a] = W(e);
|
|
3101
|
+
return e !== i && (a(e), r(Ui(e))), [n, (e) => {
|
|
3103
3102
|
r(e);
|
|
3104
|
-
let n =
|
|
3103
|
+
let n = Wi(e);
|
|
3105
3104
|
a(n), t(n);
|
|
3106
3105
|
}];
|
|
3107
|
-
},
|
|
3108
|
-
let [i, a] =
|
|
3106
|
+
}, Ki = ({ open: e, onOpenChange: t, headers: n, onChange: r }) => {
|
|
3107
|
+
let [i, a] = Gi(n, r), o = Z(), s = (e, t) => {
|
|
3109
3108
|
a(i.map((n, r) => r === e ? {
|
|
3110
3109
|
...n,
|
|
3111
3110
|
...t
|
|
@@ -3163,8 +3162,8 @@ var gi = (e) => Be(hi((t) => {
|
|
|
3163
3162
|
]
|
|
3164
3163
|
})
|
|
3165
3164
|
});
|
|
3166
|
-
},
|
|
3167
|
-
let [n, r] = W("url"), [i, a] = W(""), [o, s] = W(""), [c, l] = W(""), [u, d] = W(!1), { document: f, baseUrlOverride: p, lastSourceInput: m, setDocument: h, setBaseUrlOverride: g, setLastSourceInput: _ } =
|
|
3165
|
+
}, qi = ({ open: e, onOpenChange: t }) => {
|
|
3166
|
+
let [n, r] = W("url"), [i, a] = W(""), [o, s] = W(""), [c, l] = W(""), [u, d] = W(!1), { document: f, baseUrlOverride: p, lastSourceInput: m, setDocument: h, setBaseUrlOverride: g, setLastSourceInput: _ } = $r(), y = Z();
|
|
3168
3167
|
return H(() => {
|
|
3169
3168
|
e && (l(p), m ? (r(m.mode), a(m.mode === "url" ? m.value : ""), s(m.mode === "json" ? m.value : "")) : (r("url"), a(""), s("")));
|
|
3170
3169
|
}, [
|
|
@@ -3256,7 +3255,7 @@ var gi = (e) => Be(hi((t) => {
|
|
|
3256
3255
|
}
|
|
3257
3256
|
d(!0);
|
|
3258
3257
|
try {
|
|
3259
|
-
h(await
|
|
3258
|
+
h(await Kr(e)), g(c.trim()), _({
|
|
3260
3259
|
mode: n,
|
|
3261
3260
|
value: e
|
|
3262
3261
|
}), Y.success(y("editor.openApiDialog.loadSuccess")), t(!1);
|
|
@@ -3274,13 +3273,13 @@ var gi = (e) => Be(hi((t) => {
|
|
|
3274
3273
|
]
|
|
3275
3274
|
})
|
|
3276
3275
|
});
|
|
3277
|
-
}, qi = "You are a Treege decision tree generator. You must generate valid JSON structures for decision trees.\n\nIMPORTANT RULES:\n1. Always respond with valid JSON only, no markdown, no code blocks, no explanations outside the JSON\n2. The JSON must have this exact structure: { \"nodes\": [...], \"edges\": [...] }\n3. Every node must have: id (string), type (string), position ({ x: number, y: number }), data (object)\n4. Every edge must have: id (string), source (string), target (string)\n5. For regex patterns: ALWAYS use double backslashes (\\\\) for special characters (\\\\s, \\\\d, etc.)\n6. AVOID using \"pattern\" field unless specifically requested - prefer using simple validation\n7. For submit buttons, use type \"input\" with data.type \"submit\"\n8. For conditional logic, use conditional edges with proper operators (===, !==, >, <, >=, <=)\n\nNODE TYPES:\n- \"input\": Form input fields (text, number, select, checkbox, etc.)\n- \"ui\": UI elements (title, divider)\n- \"group\": Container for organizing nodes\n\nINPUT NODE TYPES (data.type):\n- \"text\", \"number\", \"textarea\", \"password\"\n- \"select\", \"radio\", \"checkbox\", \"switch\"\n- \"autocomplete\", \"date\", \"daterange\", \"time\", \"timerange\"\n- \"file\", \"address\", \"http\", \"hidden\", \"submit\"\n\nINPUT NODE DATA STRUCTURE:\n{\n \"id\": \"unique-id\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": {\n \"label\": \"Field Label\",\n \"name\": \"fieldName\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"Enter value...\",\n \"helperText\": \"Optional helper text\",\n \"pattern\": \"regex pattern (optional)\",\n \"errorMessage\": \"Error message if validation fails\",\n \"options\": [{ \"value\": \"val\", \"label\": \"Label\" }], // for select/radio/checkbox\n \"multiple\": false // for select/checkbox\n }\n}\n\nUI NODE TYPES (data.type):\n- \"title\": Display a title\n- \"divider\": Display a divider line\n\nUI NODE DATA STRUCTURE:\n{\n \"id\": \"unique-id\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": {\n \"label\": \"UI Element Label\",\n \"type\": \"title\" // or \"divider\"\n }\n}\n\nGROUP NODE DATA STRUCTURE:\n{\n \"id\": \"unique-id\",\n \"type\": \"group\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": {\n \"label\": \"Group Label\"\n }\n}\n\nEDGE STRUCTURE:\n{\n \"id\": \"edge-id\",\n \"source\": \"source-node-id\",\n \"target\": \"target-node-id\",\n \"type\": \"default\" // or \"conditional\" for conditional logic\n}\n\nCONDITIONAL EDGE STRUCTURE:\n{\n \"id\": \"edge-id\",\n \"source\": \"source-node-id\",\n \"target\": \"target-node-id\",\n \"type\": \"conditional\",\n \"data\": {\n \"label\": \"If condition is true\", // optional label for the edge\n \"conditions\": [\n {\n \"field\": \"field-node-id\", // ID of the field to check\n \"operator\": \">=\", // operators: ===, !==, >, <, >=, <=\n \"value\": \"18\" // value to compare (as string)\n }\n ],\n \"operator\": \"AND\" // optional: \"AND\" or \"OR\" for multiple conditions (default: AND)\n }\n}\n\nIMPORTANT: For conditional edges, the value must ALWAYS be a string, even for numbers.\nExample: For \"age >= 18\", use \"value\": \"18\" (not value: 18)\n\nLAYOUT GUIDELINES:\n- Position nodes in a vertical flow (top to bottom)\n- Start at position { x: 0, y: 0 }\n- Space nodes vertically by exactly 250 pixels between each position (node height 150px + 100px spacing)\n- For horizontal spacing, use 350 pixels\n- Create logical flow from top to bottom\n- IMPORTANT: Keep consistent vertical spacing to avoid overlap\n- Each node position Y should increment by 250: first at y:0, second at y:250, third at y:500, etc.\n\nEXAMPLES:\n\nUser: \"Create a simple contact form with name, email and message\"\nResponse:\n{\n \"nodes\": [\n {\n \"id\": \"title-1\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": { \"label\": \"Contact Form\", \"type\": \"title\" }\n },\n {\n \"id\": \"name-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 250 },\n \"data\": {\n \"label\": \"Name\",\n \"name\": \"name\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"Enter your name\"\n }\n },\n {\n \"id\": \"email-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 500 },\n \"data\": {\n \"label\": \"Email\",\n \"name\": \"email\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"your@email.com\"\n }\n },\n {\n \"id\": \"message-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 750 },\n \"data\": {\n \"label\": \"Message\",\n \"name\": \"message\",\n \"type\": \"textarea\",\n \"required\": true,\n \"placeholder\": \"Enter your message\"\n }\n }\n ],\n \"edges\": [\n { \"id\": \"e1\", \"source\": \"title-1\", \"target\": \"name-1\" },\n { \"id\": \"e2\", \"source\": \"name-1\", \"target\": \"email-1\" },\n { \"id\": \"e3\", \"source\": \"email-1\", \"target\": \"message-1\" }\n ]\n}\n\nUser: \"Create a user registration form with age, address and country selector\"\nResponse:\n{\n \"nodes\": [\n {\n \"id\": \"title-1\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": { \"label\": \"User Registration\", \"type\": \"title\" }\n },\n {\n \"id\": \"age-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 250 },\n \"data\": {\n \"label\": \"Age\",\n \"name\": \"age\",\n \"type\": \"number\",\n \"required\": true,\n \"placeholder\": \"Enter your age\"\n }\n },\n {\n \"id\": \"address-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 500 },\n \"data\": {\n \"label\": \"Address\",\n \"name\": \"address\",\n \"type\": \"address\",\n \"required\": true,\n \"placeholder\": \"Enter your address\"\n }\n },\n {\n \"id\": \"country-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 750 },\n \"data\": {\n \"label\": \"Country\",\n \"name\": \"country\",\n \"type\": \"select\",\n \"required\": true,\n \"options\": [\n { \"value\": \"us\", \"label\": \"United States\" },\n { \"value\": \"ca\", \"label\": \"Canada\" },\n { \"value\": \"uk\", \"label\": \"United Kingdom\" },\n { \"value\": \"fr\", \"label\": \"France\" },\n { \"value\": \"de\", \"label\": \"Germany\" }\n ]\n }\n },\n {\n \"id\": \"submit-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 1000 },\n \"data\": {\n \"label\": \"Submit\",\n \"type\": \"submit\"\n }\n }\n ],\n \"edges\": [\n { \"id\": \"e1\", \"source\": \"title-1\", \"target\": \"age-1\" },\n { \"id\": \"e2\", \"source\": \"age-1\", \"target\": \"address-1\" },\n { \"id\": \"e3\", \"source\": \"address-1\", \"target\": \"country-1\" },\n { \"id\": \"e4\", \"source\": \"country-1\", \"target\": \"submit-1\" }\n ]\n}\n\nUser: \"Create a form with name, age, and show different questions based on age (movie for 18+, color for under 18)\"\nResponse:\n{\n \"nodes\": [\n {\n \"id\": \"title-1\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": { \"label\": \"Survey Form\", \"type\": \"title\" }\n },\n {\n \"id\": \"name-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 250 },\n \"data\": {\n \"label\": \"Name\",\n \"name\": \"name\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"Enter your name\"\n }\n },\n {\n \"id\": \"age-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 500 },\n \"data\": {\n \"label\": \"Age\",\n \"name\": \"age\",\n \"type\": \"number\",\n \"required\": true,\n \"placeholder\": \"Enter your age\"\n }\n },\n {\n \"id\": \"movie-1\",\n \"type\": \"input\",\n \"position\": { \"x\": -350, \"y\": 750 },\n \"data\": {\n \"label\": \"Favorite Movie\",\n \"name\": \"favoriteMovie\",\n \"type\": \"text\",\n \"required\": true,\n \"helperText\": \"For adults 18 and over\"\n }\n },\n {\n \"id\": \"color-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 350, \"y\": 750 },\n \"data\": {\n \"label\": \"Favorite Color\",\n \"name\": \"favoriteColor\",\n \"type\": \"text\",\n \"required\": true,\n \"helperText\": \"For those under 18\"\n }\n },\n {\n \"id\": \"submit-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 1000 },\n \"data\": {\n \"label\": \"Submit\",\n \"type\": \"submit\"\n }\n }\n ],\n \"edges\": [\n { \"id\": \"e1\", \"source\": \"title-1\", \"target\": \"name-1\" },\n { \"id\": \"e2\", \"source\": \"name-1\", \"target\": \"age-1\" },\n {\n \"id\": \"e3\",\n \"source\": \"age-1\",\n \"target\": \"movie-1\",\n \"type\": \"conditional\",\n \"data\": {\n \"label\": \"If 18 or older\",\n \"conditions\": [\n {\n \"field\": \"age-1\",\n \"operator\": \">=\",\n \"value\": \"18\"\n }\n ]\n }\n },\n {\n \"id\": \"e4\",\n \"source\": \"age-1\",\n \"target\": \"color-1\",\n \"type\": \"conditional\",\n \"data\": {\n \"label\": \"If under 18\",\n \"conditions\": [\n {\n \"field\": \"age-1\",\n \"operator\": \"<\",\n \"value\": \"18\"\n }\n ]\n }\n },\n { \"id\": \"e5\", \"source\": \"movie-1\", \"target\": \"submit-1\" },\n { \"id\": \"e6\", \"source\": \"color-1\", \"target\": \"submit-1\" }\n ]\n}\n\nRemember:\n- Always respond with ONLY valid JSON\n- No markdown code blocks\n- No explanations outside the JSON\n- Follow the exact structure shown above\n- For submit buttons, ALWAYS use type \"input\" with data.type \"submit\"\n- For conditional edges, ALWAYS specify the value as a string and use proper operators (>=, <, ===, etc.)\n- Never leave condition values empty - always provide the comparison value\n", Ji = {
|
|
3276
|
+
}, Ji = "You are a Treege decision tree generator. You must generate valid JSON structures for decision trees.\n\nIMPORTANT RULES:\n1. Always respond with valid JSON only, no markdown, no code blocks, no explanations outside the JSON\n2. The JSON must have this exact structure: { \"nodes\": [...], \"edges\": [...] }\n3. Every node must have: id (string), type (string), position ({ x: number, y: number }), data (object)\n4. Every edge must have: id (string), source (string), target (string)\n5. For regex patterns: ALWAYS use double backslashes (\\\\) for special characters (\\\\s, \\\\d, etc.)\n6. AVOID using \"pattern\" field unless specifically requested - prefer using simple validation\n7. For submit buttons, use type \"input\" with data.type \"submit\"\n8. For conditional logic, use conditional edges with proper operators (===, !==, >, <, >=, <=)\n\nNODE TYPES:\n- \"input\": Form input fields (text, number, select, checkbox, etc.)\n- \"ui\": UI elements (title, divider)\n- \"group\": Container for organizing nodes\n\nINPUT NODE TYPES (data.type):\n- \"text\", \"number\", \"textarea\", \"password\"\n- \"select\", \"radio\", \"checkbox\", \"switch\"\n- \"autocomplete\", \"date\", \"daterange\", \"time\", \"timerange\"\n- \"file\", \"address\", \"http\", \"hidden\", \"submit\"\n\nINPUT NODE DATA STRUCTURE:\n{\n \"id\": \"unique-id\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": {\n \"label\": \"Field Label\",\n \"name\": \"fieldName\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"Enter value...\",\n \"helperText\": \"Optional helper text\",\n \"pattern\": \"regex pattern (optional)\",\n \"errorMessage\": \"Error message if validation fails\",\n \"options\": [{ \"value\": \"val\", \"label\": \"Label\" }], // for select/radio/checkbox\n \"multiple\": false // for select/checkbox\n }\n}\n\nUI NODE TYPES (data.type):\n- \"title\": Display a title\n- \"divider\": Display a divider line\n\nUI NODE DATA STRUCTURE:\n{\n \"id\": \"unique-id\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": {\n \"label\": \"UI Element Label\",\n \"type\": \"title\" // or \"divider\"\n }\n}\n\nGROUP NODE DATA STRUCTURE:\n{\n \"id\": \"unique-id\",\n \"type\": \"group\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": {\n \"label\": \"Group Label\"\n }\n}\n\nEDGE STRUCTURE:\n{\n \"id\": \"edge-id\",\n \"source\": \"source-node-id\",\n \"target\": \"target-node-id\",\n \"type\": \"default\" // or \"conditional\" for conditional logic\n}\n\nCONDITIONAL EDGE STRUCTURE:\n{\n \"id\": \"edge-id\",\n \"source\": \"source-node-id\",\n \"target\": \"target-node-id\",\n \"type\": \"conditional\",\n \"data\": {\n \"label\": \"If condition is true\", // optional label for the edge\n \"conditions\": [\n {\n \"field\": \"field-node-id\", // ID of the field to check\n \"operator\": \">=\", // operators: ===, !==, >, <, >=, <=\n \"value\": \"18\" // value to compare (as string)\n }\n ],\n \"operator\": \"AND\" // optional: \"AND\" or \"OR\" for multiple conditions (default: AND)\n }\n}\n\nIMPORTANT: For conditional edges, the value must ALWAYS be a string, even for numbers.\nExample: For \"age >= 18\", use \"value\": \"18\" (not value: 18)\n\nLAYOUT GUIDELINES:\n- Position nodes in a vertical flow (top to bottom)\n- Start at position { x: 0, y: 0 }\n- Space nodes vertically by exactly 250 pixels between each position (node height 150px + 100px spacing)\n- For horizontal spacing, use 350 pixels\n- Create logical flow from top to bottom\n- IMPORTANT: Keep consistent vertical spacing to avoid overlap\n- Each node position Y should increment by 250: first at y:0, second at y:250, third at y:500, etc.\n\nEXAMPLES:\n\nUser: \"Create a simple contact form with name, email and message\"\nResponse:\n{\n \"nodes\": [\n {\n \"id\": \"title-1\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": { \"label\": \"Contact Form\", \"type\": \"title\" }\n },\n {\n \"id\": \"name-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 250 },\n \"data\": {\n \"label\": \"Name\",\n \"name\": \"name\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"Enter your name\"\n }\n },\n {\n \"id\": \"email-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 500 },\n \"data\": {\n \"label\": \"Email\",\n \"name\": \"email\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"your@email.com\"\n }\n },\n {\n \"id\": \"message-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 750 },\n \"data\": {\n \"label\": \"Message\",\n \"name\": \"message\",\n \"type\": \"textarea\",\n \"required\": true,\n \"placeholder\": \"Enter your message\"\n }\n }\n ],\n \"edges\": [\n { \"id\": \"e1\", \"source\": \"title-1\", \"target\": \"name-1\" },\n { \"id\": \"e2\", \"source\": \"name-1\", \"target\": \"email-1\" },\n { \"id\": \"e3\", \"source\": \"email-1\", \"target\": \"message-1\" }\n ]\n}\n\nUser: \"Create a user registration form with age, address and country selector\"\nResponse:\n{\n \"nodes\": [\n {\n \"id\": \"title-1\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": { \"label\": \"User Registration\", \"type\": \"title\" }\n },\n {\n \"id\": \"age-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 250 },\n \"data\": {\n \"label\": \"Age\",\n \"name\": \"age\",\n \"type\": \"number\",\n \"required\": true,\n \"placeholder\": \"Enter your age\"\n }\n },\n {\n \"id\": \"address-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 500 },\n \"data\": {\n \"label\": \"Address\",\n \"name\": \"address\",\n \"type\": \"address\",\n \"required\": true,\n \"placeholder\": \"Enter your address\"\n }\n },\n {\n \"id\": \"country-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 750 },\n \"data\": {\n \"label\": \"Country\",\n \"name\": \"country\",\n \"type\": \"select\",\n \"required\": true,\n \"options\": [\n { \"value\": \"us\", \"label\": \"United States\" },\n { \"value\": \"ca\", \"label\": \"Canada\" },\n { \"value\": \"uk\", \"label\": \"United Kingdom\" },\n { \"value\": \"fr\", \"label\": \"France\" },\n { \"value\": \"de\", \"label\": \"Germany\" }\n ]\n }\n },\n {\n \"id\": \"submit-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 1000 },\n \"data\": {\n \"label\": \"Submit\",\n \"type\": \"submit\"\n }\n }\n ],\n \"edges\": [\n { \"id\": \"e1\", \"source\": \"title-1\", \"target\": \"age-1\" },\n { \"id\": \"e2\", \"source\": \"age-1\", \"target\": \"address-1\" },\n { \"id\": \"e3\", \"source\": \"address-1\", \"target\": \"country-1\" },\n { \"id\": \"e4\", \"source\": \"country-1\", \"target\": \"submit-1\" }\n ]\n}\n\nUser: \"Create a form with name, age, and show different questions based on age (movie for 18+, color for under 18)\"\nResponse:\n{\n \"nodes\": [\n {\n \"id\": \"title-1\",\n \"type\": \"ui\",\n \"position\": { \"x\": 0, \"y\": 0 },\n \"data\": { \"label\": \"Survey Form\", \"type\": \"title\" }\n },\n {\n \"id\": \"name-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 250 },\n \"data\": {\n \"label\": \"Name\",\n \"name\": \"name\",\n \"type\": \"text\",\n \"required\": true,\n \"placeholder\": \"Enter your name\"\n }\n },\n {\n \"id\": \"age-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 500 },\n \"data\": {\n \"label\": \"Age\",\n \"name\": \"age\",\n \"type\": \"number\",\n \"required\": true,\n \"placeholder\": \"Enter your age\"\n }\n },\n {\n \"id\": \"movie-1\",\n \"type\": \"input\",\n \"position\": { \"x\": -350, \"y\": 750 },\n \"data\": {\n \"label\": \"Favorite Movie\",\n \"name\": \"favoriteMovie\",\n \"type\": \"text\",\n \"required\": true,\n \"helperText\": \"For adults 18 and over\"\n }\n },\n {\n \"id\": \"color-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 350, \"y\": 750 },\n \"data\": {\n \"label\": \"Favorite Color\",\n \"name\": \"favoriteColor\",\n \"type\": \"text\",\n \"required\": true,\n \"helperText\": \"For those under 18\"\n }\n },\n {\n \"id\": \"submit-1\",\n \"type\": \"input\",\n \"position\": { \"x\": 0, \"y\": 1000 },\n \"data\": {\n \"label\": \"Submit\",\n \"type\": \"submit\"\n }\n }\n ],\n \"edges\": [\n { \"id\": \"e1\", \"source\": \"title-1\", \"target\": \"name-1\" },\n { \"id\": \"e2\", \"source\": \"name-1\", \"target\": \"age-1\" },\n {\n \"id\": \"e3\",\n \"source\": \"age-1\",\n \"target\": \"movie-1\",\n \"type\": \"conditional\",\n \"data\": {\n \"label\": \"If 18 or older\",\n \"conditions\": [\n {\n \"field\": \"age-1\",\n \"operator\": \">=\",\n \"value\": \"18\"\n }\n ]\n }\n },\n {\n \"id\": \"e4\",\n \"source\": \"age-1\",\n \"target\": \"color-1\",\n \"type\": \"conditional\",\n \"data\": {\n \"label\": \"If under 18\",\n \"conditions\": [\n {\n \"field\": \"age-1\",\n \"operator\": \"<\",\n \"value\": \"18\"\n }\n ]\n }\n },\n { \"id\": \"e5\", \"source\": \"movie-1\", \"target\": \"submit-1\" },\n { \"id\": \"e6\", \"source\": \"color-1\", \"target\": \"submit-1\" }\n ]\n}\n\nRemember:\n- Always respond with ONLY valid JSON\n- No markdown code blocks\n- No explanations outside the JSON\n- Follow the exact structure shown above\n- For submit buttons, ALWAYS use type \"input\" with data.type \"submit\"\n- For conditional edges, ALWAYS specify the value as a string and use proper operators (>=, <, ===, etc.)\n- Never leave condition values empty - always provide the comparison value\n", Yi = {
|
|
3278
3277
|
claude: "claude-3-5-haiku-20241022",
|
|
3279
3278
|
deepseek: "deepseek-chat",
|
|
3280
3279
|
gemini: "gemini-2.5-flash",
|
|
3281
3280
|
openai: "gpt-4o-mini"
|
|
3282
|
-
},
|
|
3283
|
-
function
|
|
3281
|
+
}, Xi = .3;
|
|
3282
|
+
function Zi(e) {
|
|
3284
3283
|
try {
|
|
3285
3284
|
return JSON.parse(e);
|
|
3286
3285
|
} catch (t) {
|
|
@@ -3292,10 +3291,10 @@ function Xi(e) {
|
|
|
3292
3291
|
}
|
|
3293
3292
|
}
|
|
3294
3293
|
}
|
|
3295
|
-
async function
|
|
3296
|
-
let t = e.config.model ||
|
|
3294
|
+
async function Qi(e) {
|
|
3295
|
+
let t = e.config.model || Yi.gemini, n = e.config.temperature ?? Xi, r = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${t}:generateContent?key=${e.config.apiKey}`, {
|
|
3297
3296
|
body: JSON.stringify({
|
|
3298
|
-
contents: [{ parts: [{ text: `${
|
|
3297
|
+
contents: [{ parts: [{ text: `${Ji}\n\nUser request: ${e.prompt}` }] }],
|
|
3299
3298
|
generationConfig: {
|
|
3300
3299
|
responseMimeType: "application/json",
|
|
3301
3300
|
temperature: n
|
|
@@ -3310,13 +3309,13 @@ async function Zi(e) {
|
|
|
3310
3309
|
}
|
|
3311
3310
|
let i = (await r.json()).candidates?.[0]?.content?.parts?.[0]?.text;
|
|
3312
3311
|
if (!i) throw Error("No response from Gemini");
|
|
3313
|
-
return
|
|
3312
|
+
return Zi(i);
|
|
3314
3313
|
}
|
|
3315
|
-
async function
|
|
3316
|
-
let t = e.config.model ||
|
|
3314
|
+
async function $i(e) {
|
|
3315
|
+
let t = e.config.model || Yi.openai, n = e.config.temperature ?? Xi, r = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
3317
3316
|
body: JSON.stringify({
|
|
3318
3317
|
messages: [{
|
|
3319
|
-
content:
|
|
3318
|
+
content: Ji,
|
|
3320
3319
|
role: "system"
|
|
3321
3320
|
}, {
|
|
3322
3321
|
content: e.prompt,
|
|
@@ -3338,13 +3337,13 @@ async function Qi(e) {
|
|
|
3338
3337
|
}
|
|
3339
3338
|
let i = (await r.json()).choices?.[0]?.message?.content;
|
|
3340
3339
|
if (!i) throw Error("No response from OpenAI");
|
|
3341
|
-
return
|
|
3340
|
+
return Zi(i);
|
|
3342
3341
|
}
|
|
3343
|
-
async function
|
|
3344
|
-
let t = e.config.model ||
|
|
3342
|
+
async function ea(e) {
|
|
3343
|
+
let t = e.config.model || Yi.deepseek, n = e.config.temperature ?? Xi, r = await fetch("https://api.deepseek.com/v1/chat/completions", {
|
|
3345
3344
|
body: JSON.stringify({
|
|
3346
3345
|
messages: [{
|
|
3347
|
-
content:
|
|
3346
|
+
content: Ji,
|
|
3348
3347
|
role: "system"
|
|
3349
3348
|
}, {
|
|
3350
3349
|
content: e.prompt,
|
|
@@ -3366,10 +3365,10 @@ async function $i(e) {
|
|
|
3366
3365
|
}
|
|
3367
3366
|
let i = (await r.json()).choices?.[0]?.message?.content;
|
|
3368
3367
|
if (!i) throw Error("No response from DeepSeek");
|
|
3369
|
-
return
|
|
3368
|
+
return Zi(i);
|
|
3370
3369
|
}
|
|
3371
|
-
async function
|
|
3372
|
-
let t = e.config.model ||
|
|
3370
|
+
async function ta(e) {
|
|
3371
|
+
let t = e.config.model || Yi.claude, n = e.config.temperature ?? Xi, r = await fetch("https://api.anthropic.com/v1/messages", {
|
|
3373
3372
|
body: JSON.stringify({
|
|
3374
3373
|
max_tokens: 4096,
|
|
3375
3374
|
messages: [{
|
|
@@ -3377,7 +3376,7 @@ async function ea(e) {
|
|
|
3377
3376
|
role: "user"
|
|
3378
3377
|
}],
|
|
3379
3378
|
model: t,
|
|
3380
|
-
system:
|
|
3379
|
+
system: Ji,
|
|
3381
3380
|
temperature: n
|
|
3382
3381
|
}),
|
|
3383
3382
|
headers: {
|
|
@@ -3393,20 +3392,20 @@ async function ea(e) {
|
|
|
3393
3392
|
}
|
|
3394
3393
|
let i = (await r.json()).content?.[0]?.text;
|
|
3395
3394
|
if (!i) throw Error("No response from Claude");
|
|
3396
|
-
return
|
|
3395
|
+
return Zi(i);
|
|
3397
3396
|
}
|
|
3398
|
-
function
|
|
3397
|
+
function na(e) {
|
|
3399
3398
|
switch (e.config.provider) {
|
|
3400
|
-
case "gemini": return
|
|
3401
|
-
case "openai": return
|
|
3402
|
-
case "deepseek": return
|
|
3403
|
-
case "claude": return
|
|
3399
|
+
case "gemini": return Qi(e);
|
|
3400
|
+
case "openai": return $i(e);
|
|
3401
|
+
case "deepseek": return ea(e);
|
|
3402
|
+
case "claude": return ta(e);
|
|
3404
3403
|
default: throw Error(`Unsupported AI provider: ${e.config.provider}`);
|
|
3405
3404
|
}
|
|
3406
3405
|
}
|
|
3407
3406
|
//#endregion
|
|
3408
3407
|
//#region src/editor/features/TreegeEditor/panel/AIGeneratorDialog.tsx
|
|
3409
|
-
var
|
|
3408
|
+
var ra = ({ aiConfig: e, onGenerate: t }) => {
|
|
3410
3409
|
let [n, r] = W(!1), [i, a] = W(""), [o, s] = W(!1), c = Z(), l = async () => {
|
|
3411
3410
|
if (!i.trim()) {
|
|
3412
3411
|
Y.error(c("editor.aiGenerator.enterDescription"));
|
|
@@ -3418,7 +3417,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3418
3417
|
}
|
|
3419
3418
|
s(!0);
|
|
3420
3419
|
try {
|
|
3421
|
-
let n = await
|
|
3420
|
+
let n = await na({
|
|
3422
3421
|
config: e,
|
|
3423
3422
|
prompt: i.trim()
|
|
3424
3423
|
});
|
|
@@ -3511,40 +3510,78 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3511
3510
|
]
|
|
3512
3511
|
})]
|
|
3513
3512
|
});
|
|
3514
|
-
},
|
|
3513
|
+
}, ia = () => ({
|
|
3515
3514
|
hasInputNodes: Be((e) => e.nodes.some((e) => e.type === r.input)),
|
|
3516
3515
|
isEmpty: Be((e) => e.nodes.length === 0 && e.edges.length === 0)
|
|
3517
|
-
}),
|
|
3516
|
+
}), aa = { variant: "card" }, oa = (e) => typeof e == "object" && !!e && !Array.isArray(e), sa = (e) => {
|
|
3517
|
+
if (e == null || e === "") return !0;
|
|
3518
|
+
if (Array.isArray(e)) return e.length === 0;
|
|
3519
|
+
if (oa(e)) {
|
|
3520
|
+
let t = Object.values(e);
|
|
3521
|
+
return t.length === 0 || t.every(sa);
|
|
3522
|
+
}
|
|
3523
|
+
return !1;
|
|
3524
|
+
}, ca = (e, t) => Object.hasOwn(aa, e) && t === aa[e], la = (e, t) => sa(t) || ca(e, t), ua = (e) => {
|
|
3525
|
+
let t = Object.entries(e).filter(([e, t]) => !la(e, t));
|
|
3526
|
+
return Object.fromEntries(t);
|
|
3527
|
+
}, da = (e) => ({
|
|
3528
|
+
...e,
|
|
3529
|
+
edges: e.edges.map(({ selected: e, ...t }) => t),
|
|
3530
|
+
nodes: e.nodes.map(({ selected: e, dragging: t, measured: n, ...r }) => r.data ? {
|
|
3531
|
+
...r,
|
|
3532
|
+
data: ua(r.data)
|
|
3533
|
+
} : r)
|
|
3534
|
+
}), fa = (e) => typeof e == "object" && !!e && !Array.isArray(e), pa = /^(authorization|proxy-authorization|cookie|x-api-key|api-?key|x-auth-token|x-access-token|x-secret)$/i, ma = [
|
|
3518
3535
|
"httpConfig",
|
|
3519
3536
|
"optionsSource",
|
|
3520
3537
|
"submitConfig"
|
|
3521
|
-
],
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
let s = o.filter(([e]) => !oa(e));
|
|
3530
|
-
s.length !== o.length && (t += o.length - s.length, i[e] = {
|
|
3531
|
-
...a,
|
|
3532
|
-
headers: Object.fromEntries(s)
|
|
3533
|
-
}, r = !0);
|
|
3534
|
-
}
|
|
3535
|
-
return r ? {
|
|
3538
|
+
], ha = (e) => pa.test(e.trim()), ga = (e) => !!e?.some((e) => ha(e.key) && e.value.trim() !== ""), _a = (e) => {
|
|
3539
|
+
if (!(fa(e) && fa(e.headers))) return {
|
|
3540
|
+
config: e,
|
|
3541
|
+
removed: 0
|
|
3542
|
+
};
|
|
3543
|
+
let t = Object.entries(e.headers).filter(([e]) => !ha(e)), n = Object.keys(e.headers).length - t.length;
|
|
3544
|
+
return {
|
|
3545
|
+
config: {
|
|
3536
3546
|
...e,
|
|
3537
|
-
|
|
3538
|
-
}
|
|
3547
|
+
headers: Object.fromEntries(t)
|
|
3548
|
+
},
|
|
3549
|
+
removed: n
|
|
3550
|
+
};
|
|
3551
|
+
}, va = (e) => {
|
|
3552
|
+
let t = e.nodes.map((e) => {
|
|
3553
|
+
if (!fa(e.data)) return {
|
|
3554
|
+
node: e,
|
|
3555
|
+
removed: 0
|
|
3556
|
+
};
|
|
3557
|
+
let t = ma.map((t) => ({
|
|
3558
|
+
key: t,
|
|
3559
|
+
..._a(e.data[t])
|
|
3560
|
+
})).filter((e) => e.removed > 0);
|
|
3561
|
+
if (t.length === 0) return {
|
|
3562
|
+
node: e,
|
|
3563
|
+
removed: 0
|
|
3564
|
+
};
|
|
3565
|
+
let n = {
|
|
3566
|
+
...e.data,
|
|
3567
|
+
...Object.fromEntries(t.map((e) => [e.key, e.config]))
|
|
3568
|
+
}, r = t.reduce((e, t) => e + t.removed, 0);
|
|
3569
|
+
return {
|
|
3570
|
+
node: {
|
|
3571
|
+
...e,
|
|
3572
|
+
data: n
|
|
3573
|
+
},
|
|
3574
|
+
removed: r
|
|
3575
|
+
};
|
|
3539
3576
|
});
|
|
3540
3577
|
return {
|
|
3541
3578
|
flow: {
|
|
3542
3579
|
...e,
|
|
3543
|
-
nodes:
|
|
3580
|
+
nodes: t.map((e) => e.node)
|
|
3544
3581
|
},
|
|
3545
|
-
strippedCount: t
|
|
3582
|
+
strippedCount: t.reduce((e, t) => e + t.removed, 0)
|
|
3546
3583
|
};
|
|
3547
|
-
},
|
|
3584
|
+
}, ya = {
|
|
3548
3585
|
ar: "ar",
|
|
3549
3586
|
de: "de",
|
|
3550
3587
|
en: "en",
|
|
@@ -3552,8 +3589,8 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3552
3589
|
fr: "fr",
|
|
3553
3590
|
it: "it",
|
|
3554
3591
|
pt: "pt"
|
|
3555
|
-
},
|
|
3556
|
-
let [o, s] = W(!1), [c, l] = W(!1), [u, d] = W(!1), [f, p] = W(!1), { flowId: m, setFlowId: h, aiConfig: g, language: _, setLanguage: v } = X(), { document: y } =
|
|
3592
|
+
}, ba = dr(), xa = ({ onExportJson: e, onSave: t, extraMenuItems: n, onAuthorize: r, headers: i, onHeadersChange: a }) => {
|
|
3593
|
+
let [o, s] = W(!1), [c, l] = W(!1), [u, d] = W(!1), [f, p] = W(!1), { flowId: m, setFlowId: h, aiConfig: g, language: _, setLanguage: v } = X(), { document: y } = $r(), { setNodes: b, setEdges: ee, addNodes: x, screenToFlowPosition: S } = ze(), C = Object.keys(i ?? {}).length > 0, w = m || ba, T = Le(), E = Ie(), { hasInputNodes: te, isEmpty: D } = ia(), O = Je(null), ne = !!y && !f, k = Z(), re = () => {
|
|
3557
3594
|
let e = (window.innerWidth || 0) / 2, t = (window.innerHeight || 0) / 2, n = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--node-width"), 10), r = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--node-height"), 10), i = S({
|
|
3558
3595
|
x: e - n,
|
|
3559
3596
|
y: t - r
|
|
@@ -3578,24 +3615,24 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3578
3615
|
O.current && (O.current.value = "");
|
|
3579
3616
|
}, n.readAsText(t);
|
|
3580
3617
|
}, ie = () => {
|
|
3581
|
-
let { flow: e, strippedCount: t } =
|
|
3618
|
+
let { flow: e, strippedCount: t } = va({
|
|
3582
3619
|
edges: E,
|
|
3583
3620
|
id: w,
|
|
3584
3621
|
nodes: T
|
|
3585
3622
|
});
|
|
3586
|
-
return t > 0 && Y.warning(k("editor.actionsPanel.sensitiveHeadersStripped"), { description: k("editor.actionsPanel.sensitiveHeadersStrippedDesc") }), e;
|
|
3623
|
+
return t > 0 && Y.warning(k("editor.actionsPanel.sensitiveHeadersStripped"), { description: k("editor.actionsPanel.sensitiveHeadersStrippedDesc") }), da(e);
|
|
3587
3624
|
}, j = () => {
|
|
3588
3625
|
let t = ie(), n = new Blob([JSON.stringify(t, null, 2)], { type: "application/json" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
3589
3626
|
i.href = r, i.download = "treege.json", i.click(), URL.revokeObjectURL(r), Y.success(k("editor.actionsPanel.downloadSuccess"), { description: k("editor.actionsPanel.downloadSuccessDesc") }), m || h?.(w), e?.(t);
|
|
3590
3627
|
}, ae = V(() => {
|
|
3591
3628
|
if (!t) return;
|
|
3592
3629
|
m || h?.(w);
|
|
3593
|
-
let { flow: e, strippedCount: n } =
|
|
3630
|
+
let { flow: e, strippedCount: n } = va({
|
|
3594
3631
|
edges: E,
|
|
3595
3632
|
id: w,
|
|
3596
3633
|
nodes: T
|
|
3597
3634
|
});
|
|
3598
|
-
n > 0 && Y.warning(k("editor.actionsPanel.sensitiveHeadersStripped"), { description: k("editor.actionsPanel.sensitiveHeadersStrippedDesc") }), t?.(e);
|
|
3635
|
+
n > 0 && Y.warning(k("editor.actionsPanel.sensitiveHeadersStripped"), { description: k("editor.actionsPanel.sensitiveHeadersStrippedDesc") }), t?.(da(e));
|
|
3599
3636
|
}, [
|
|
3600
3637
|
E,
|
|
3601
3638
|
m,
|
|
@@ -3618,7 +3655,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3618
3655
|
position: "top-right",
|
|
3619
3656
|
className: "tg:flex tg:gap-2",
|
|
3620
3657
|
children: [
|
|
3621
|
-
/* @__PURE__ */ K(
|
|
3658
|
+
/* @__PURE__ */ K(ra, {
|
|
3622
3659
|
aiConfig: g,
|
|
3623
3660
|
onGenerate: (e) => {
|
|
3624
3661
|
b(e.nodes), ee(e.edges);
|
|
@@ -3729,7 +3766,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3729
3766
|
] }), /* @__PURE__ */ K(cr, { children: /* @__PURE__ */ K(nr, {
|
|
3730
3767
|
value: _,
|
|
3731
3768
|
onValueChange: v,
|
|
3732
|
-
children: Object.values(
|
|
3769
|
+
children: Object.values(ya).map((e) => /* @__PURE__ */ K(rr, {
|
|
3733
3770
|
value: e,
|
|
3734
3771
|
className: "tg:uppercase",
|
|
3735
3772
|
children: e
|
|
@@ -3756,7 +3793,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3756
3793
|
/* @__PURE__ */ K(ar, {}),
|
|
3757
3794
|
/* @__PURE__ */ q(ir, {
|
|
3758
3795
|
className: "tg:font-normal tg:text-muted-foreground tg:text-xs",
|
|
3759
|
-
children: ["v", "3.0.0-beta.
|
|
3796
|
+
children: ["v", "3.0.0-beta.80"]
|
|
3760
3797
|
})
|
|
3761
3798
|
]
|
|
3762
3799
|
})]
|
|
@@ -3768,16 +3805,16 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3768
3805
|
ref: O,
|
|
3769
3806
|
onChange: A
|
|
3770
3807
|
}),
|
|
3771
|
-
/* @__PURE__ */ K(
|
|
3808
|
+
/* @__PURE__ */ K(qi, {
|
|
3772
3809
|
open: o,
|
|
3773
3810
|
onOpenChange: s
|
|
3774
3811
|
}),
|
|
3775
|
-
/* @__PURE__ */ K(
|
|
3812
|
+
/* @__PURE__ */ K(Hi, {
|
|
3776
3813
|
open: c,
|
|
3777
3814
|
onOpenChange: l,
|
|
3778
3815
|
onAuthorize: r
|
|
3779
3816
|
}),
|
|
3780
|
-
a && /* @__PURE__ */ K(
|
|
3817
|
+
a && /* @__PURE__ */ K(Ki, {
|
|
3781
3818
|
open: u,
|
|
3782
3819
|
onOpenChange: d,
|
|
3783
3820
|
headers: i ?? {},
|
|
@@ -3785,8 +3822,8 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3785
3822
|
})
|
|
3786
3823
|
]
|
|
3787
3824
|
});
|
|
3788
|
-
},
|
|
3789
|
-
let { selectedNodes: e } = Sr(), { clearSelection: t, deleteNodes: n } =
|
|
3825
|
+
}, Sa = () => {
|
|
3826
|
+
let { selectedNodes: e } = Sr(), { clearSelection: t, deleteNodes: n } = Nr(), r = Z(), i = U(() => e.filter((e) => !u(e)), [e]);
|
|
3790
3827
|
return i.length < 2 ? null : /* @__PURE__ */ K(ke, {
|
|
3791
3828
|
position: "top-center",
|
|
3792
3829
|
className: "tg:pointer-events-auto",
|
|
@@ -3834,19 +3871,19 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3834
3871
|
]
|
|
3835
3872
|
})
|
|
3836
3873
|
});
|
|
3837
|
-
},
|
|
3874
|
+
}, Ca = ({ value: e = "en", onValueChange: t }) => /* @__PURE__ */ q(j, {
|
|
3838
3875
|
value: e,
|
|
3839
3876
|
onValueChange: t,
|
|
3840
3877
|
children: [/* @__PURE__ */ K(P, {
|
|
3841
3878
|
className: "tg:uppercase",
|
|
3842
3879
|
children: /* @__PURE__ */ K(N, { placeholder: "" })
|
|
3843
|
-
}), /* @__PURE__ */ K(M, { children: /* @__PURE__ */ K(S, { children: Object.values(
|
|
3880
|
+
}), /* @__PURE__ */ K(M, { children: /* @__PURE__ */ K(S, { children: Object.values(ya).map((e) => /* @__PURE__ */ K(E, {
|
|
3844
3881
|
value: e,
|
|
3845
3882
|
className: "tg:uppercase",
|
|
3846
3883
|
children: e
|
|
3847
3884
|
}, e)) }) })]
|
|
3848
|
-
}),
|
|
3849
|
-
let [e, t] = W("en"), { selectedNode: n } = Sr(), { updateSelectedNodeData: r } =
|
|
3885
|
+
}), wa = () => {
|
|
3886
|
+
let [e, t] = W("en"), { selectedNode: n } = Sr(), { updateSelectedNodeData: r } = Nr(), { Field: i } = Ye({
|
|
3850
3887
|
defaultValues: { label: n?.data?.label || { en: "" } },
|
|
3851
3888
|
listeners: {
|
|
3852
3889
|
onChange: ({ formApi: e }) => {
|
|
@@ -3884,29 +3921,29 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3884
3921
|
}
|
|
3885
3922
|
})]
|
|
3886
3923
|
})
|
|
3887
|
-
}), /* @__PURE__ */ K(
|
|
3924
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
3888
3925
|
value: e,
|
|
3889
3926
|
onValueChange: t
|
|
3890
3927
|
})]
|
|
3891
3928
|
})
|
|
3892
3929
|
});
|
|
3893
|
-
},
|
|
3930
|
+
}, Ta = /^"?\{\{[\w-]+}}"?$/, Ea = new Set([
|
|
3894
3931
|
"Number",
|
|
3895
3932
|
"True",
|
|
3896
3933
|
"False",
|
|
3897
3934
|
"Null"
|
|
3898
|
-
]),
|
|
3935
|
+
]), Da = (e, t) => {
|
|
3899
3936
|
let n = (t) => {
|
|
3900
3937
|
if (!t) return null;
|
|
3901
|
-
let r = t.name === "String" && t.parent?.name === "PropertyName", i = t.name === "PropertyName" || r || t.name === "String" ||
|
|
3938
|
+
let r = t.name === "String" && t.parent?.name === "PropertyName", i = t.name === "PropertyName" || r || t.name === "String" || Ea.has(t.name) ? t : null;
|
|
3902
3939
|
return i ? {
|
|
3903
3940
|
from: i.from,
|
|
3904
|
-
isToken:
|
|
3941
|
+
isToken: Ta.test(e.sliceDoc(i.from, i.to)),
|
|
3905
3942
|
to: i.to
|
|
3906
3943
|
} : n(t.parent);
|
|
3907
3944
|
};
|
|
3908
3945
|
return n(xn(e).resolveInner(t, -1));
|
|
3909
|
-
},
|
|
3946
|
+
}, Oa = /"\{\{([\w-]+)}}"|\{\{([\w-]+)}}/g, ka = class extends bn {
|
|
3910
3947
|
constructor(e, t) {
|
|
3911
3948
|
super(), this.nodeId = e, this.label = t;
|
|
3912
3949
|
}
|
|
@@ -3920,7 +3957,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3920
3957
|
ignoreEvent() {
|
|
3921
3958
|
return !1;
|
|
3922
3959
|
}
|
|
3923
|
-
},
|
|
3960
|
+
}, Aa = _n.baseTheme({
|
|
3924
3961
|
".tg-cm-token": {
|
|
3925
3962
|
backgroundColor: "rgba(59, 130, 246, 0.15)",
|
|
3926
3963
|
borderRadius: "4px",
|
|
@@ -3934,7 +3971,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3934
3971
|
backgroundColor: "rgba(59, 130, 246, 0.25)",
|
|
3935
3972
|
color: "#93c5fd"
|
|
3936
3973
|
}
|
|
3937
|
-
}),
|
|
3974
|
+
}), ja = ({ value: e, onChange: t, fields: n }) => {
|
|
3938
3975
|
let r = Z(), { theme: i } = m(), a = i === "dark" ? "dark" : i === "light" ? "light" : typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light", o = U(() => {
|
|
3939
3976
|
if (!e.trim()) return !1;
|
|
3940
3977
|
try {
|
|
@@ -3944,8 +3981,8 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3944
3981
|
}
|
|
3945
3982
|
}, [e]), s = U(() => {
|
|
3946
3983
|
let e = (e) => n.find((t) => t.nodeId === e)?.label ?? e, t = new vn({
|
|
3947
|
-
decoration: (t) => gn.replace({ widget: new
|
|
3948
|
-
regexp:
|
|
3984
|
+
decoration: (t) => gn.replace({ widget: new ka(t[1] ?? t[2], e(t[1] ?? t[2])) }),
|
|
3985
|
+
regexp: Oa
|
|
3949
3986
|
}), i = yn.fromClass(class {
|
|
3950
3987
|
decorations;
|
|
3951
3988
|
constructor(e) {
|
|
@@ -3969,7 +4006,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3969
4006
|
}))
|
|
3970
4007
|
};
|
|
3971
4008
|
if (!e.explicit) return null;
|
|
3972
|
-
let i =
|
|
4009
|
+
let i = Da(e.state, e.pos);
|
|
3973
4010
|
if (!i) return null;
|
|
3974
4011
|
let a = n.map((e) => ({
|
|
3975
4012
|
apply: `"{{${e.nodeId}}}"`,
|
|
@@ -3993,11 +4030,11 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3993
4030
|
x: e.clientX,
|
|
3994
4031
|
y: e.clientY
|
|
3995
4032
|
});
|
|
3996
|
-
return n == null || !
|
|
4033
|
+
return n == null || !Da(t.state, n) || requestAnimationFrame(() => pn(t)), !1;
|
|
3997
4034
|
} });
|
|
3998
4035
|
return [
|
|
3999
4036
|
mn(),
|
|
4000
|
-
|
|
4037
|
+
Aa,
|
|
4001
4038
|
i,
|
|
4002
4039
|
fn({ override: [a] }),
|
|
4003
4040
|
o,
|
|
@@ -4034,11 +4071,11 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4034
4071
|
})
|
|
4035
4072
|
]
|
|
4036
4073
|
});
|
|
4037
|
-
},
|
|
4074
|
+
}, Ma = [
|
|
4038
4075
|
"POST",
|
|
4039
4076
|
"PUT",
|
|
4040
4077
|
"PATCH"
|
|
4041
|
-
],
|
|
4078
|
+
], Na = (e, n) => {
|
|
4042
4079
|
let r = t(e, n);
|
|
4043
4080
|
if (!Array.isArray(r) || r.length === 0) return [];
|
|
4044
4081
|
let i = r[0];
|
|
@@ -4046,8 +4083,8 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4046
4083
|
let a = [];
|
|
4047
4084
|
for (let [e, t] of Object.entries(i)) if (a.push(e), typeof t == "object" && t && !Array.isArray(t)) for (let n of Object.keys(t)) a.push(`${e}.${n}`);
|
|
4048
4085
|
return a;
|
|
4049
|
-
},
|
|
4050
|
-
let [i, a] = W(!1), [o, l] = W([]), [u, d] = W(null), { headers: f } = X(), { baseUrl: m } =
|
|
4086
|
+
}, Pa = ({ request: e, mapping: t, onMappingChange: n, showOptionalFields: r = !1 }) => {
|
|
4087
|
+
let [i, a] = W(!1), [o, l] = W([]), [u, d] = W(null), { headers: f } = X(), { baseUrl: m } = $r(), { url: h, method: _ = "GET", headers: v, queryParams: y, body: b, responsePath: ee = "" } = e, x = Z(), S = U(() => o.map((e) => ({
|
|
4051
4088
|
label: e,
|
|
4052
4089
|
value: e
|
|
4053
4090
|
})), [o]), C = U(() => {
|
|
@@ -4070,7 +4107,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4070
4107
|
a(!0);
|
|
4071
4108
|
try {
|
|
4072
4109
|
let e = await g({
|
|
4073
|
-
body: b &&
|
|
4110
|
+
body: b && Ma.includes(_) ? b : void 0,
|
|
4074
4111
|
headers: c(f, v),
|
|
4075
4112
|
method: _,
|
|
4076
4113
|
queryParams: y,
|
|
@@ -4080,7 +4117,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4080
4117
|
Y.error(e.error || x("editor.optionsSourceForm.detectFailed"), T);
|
|
4081
4118
|
return;
|
|
4082
4119
|
}
|
|
4083
|
-
let n =
|
|
4120
|
+
let n = Na(e.data, ee);
|
|
4084
4121
|
if (n.length === 0) {
|
|
4085
4122
|
Y.error(x("editor.optionsSourceForm.noFieldsDetected"), T), l([]), d(null);
|
|
4086
4123
|
return;
|
|
@@ -4160,23 +4197,23 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4160
4197
|
})
|
|
4161
4198
|
]
|
|
4162
4199
|
});
|
|
4163
|
-
},
|
|
4200
|
+
}, Fa = ({ headers: e }) => {
|
|
4164
4201
|
let t = Z();
|
|
4165
|
-
return
|
|
4202
|
+
return ga(e) ? /* @__PURE__ */ q("div", {
|
|
4166
4203
|
role: "alert",
|
|
4167
4204
|
className: "tg:flex tg:items-start tg:gap-2 tg:rounded-md tg:border tg:border-destructive/50 tg:bg-destructive/10 tg:p-2 tg:text-destructive tg:text-xs",
|
|
4168
4205
|
children: [/* @__PURE__ */ K(Kt, { className: "tg:mt-0.5 tg:h-4 tg:w-4 tg:shrink-0" }), /* @__PURE__ */ K("span", { children: t("editor.sensitiveHeaderWarning.message") })]
|
|
4169
4206
|
}) : null;
|
|
4170
|
-
},
|
|
4207
|
+
}, Ia = {
|
|
4171
4208
|
DELETE: "tg:bg-red-500/15 tg:text-red-700 dark:tg:text-red-300",
|
|
4172
4209
|
GET: "tg:bg-blue-500/15 tg:text-blue-700 dark:tg:text-blue-300",
|
|
4173
4210
|
PATCH: "tg:bg-purple-500/15 tg:text-purple-700 dark:tg:text-purple-300",
|
|
4174
4211
|
POST: "tg:bg-green-500/15 tg:text-green-700 dark:tg:text-green-300",
|
|
4175
4212
|
PUT: "tg:bg-amber-500/15 tg:text-amber-700 dark:tg:text-amber-300"
|
|
4176
|
-
},
|
|
4177
|
-
let [a, o] = W(!1), { baseUrl: s, routes: c } =
|
|
4213
|
+
}, La = /^(https?:)?\/\//i, Ra = ({ value: e, onChange: t, placeholder: n, children: r, ...i }) => {
|
|
4214
|
+
let [a, o] = W(!1), { baseUrl: s, routes: c } = $r(), l = Z(), u = (e, n) => {
|
|
4178
4215
|
t(e.startsWith("/") ? e : `/${e}`, n), o(!1);
|
|
4179
|
-
}, d = !!s && e.startsWith(s), f = !!s && (d || !
|
|
4216
|
+
}, d = !!s && e.startsWith(s), f = !!s && (d || !La.test(e)), p = () => {
|
|
4180
4217
|
if (d) {
|
|
4181
4218
|
let n = e.slice(s.length);
|
|
4182
4219
|
t(n.startsWith("/") ? n : `/${n}`);
|
|
@@ -4230,7 +4267,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4230
4267
|
className: "tg:flex tg:items-center tg:gap-2",
|
|
4231
4268
|
children: [
|
|
4232
4269
|
/* @__PURE__ */ K("span", {
|
|
4233
|
-
className: `tg:inline-flex tg:min-w-14 tg:justify-center tg:rounded tg:px-1.5 tg:py-0.5 tg:font-mono tg:font-semibold tg:text-[10px] ${
|
|
4270
|
+
className: `tg:inline-flex tg:min-w-14 tg:justify-center tg:rounded tg:px-1.5 tg:py-0.5 tg:font-mono tg:font-semibold tg:text-[10px] ${Ia[e.method]}`,
|
|
4234
4271
|
children: e.method
|
|
4235
4272
|
}),
|
|
4236
4273
|
/* @__PURE__ */ K("span", {
|
|
@@ -4250,18 +4287,18 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4250
4287
|
r
|
|
4251
4288
|
]
|
|
4252
4289
|
});
|
|
4253
|
-
},
|
|
4290
|
+
}, za = [
|
|
4254
4291
|
"POST",
|
|
4255
4292
|
"PUT",
|
|
4256
4293
|
"PATCH"
|
|
4257
|
-
],
|
|
4294
|
+
], Ba = ({ value: e, onChange: t, afterMapping: n }) => {
|
|
4258
4295
|
let { selectedNode: r } = Sr(), i = Z(), a = jn(r?.id), { Field: o, Subscribe: s, setFieldValue: c } = Ye({
|
|
4259
4296
|
defaultValues: {
|
|
4260
4297
|
body: e?.body || "",
|
|
4261
4298
|
fetchOnMount: e?.fetchOnMount ?? !0,
|
|
4262
|
-
headers:
|
|
4299
|
+
headers: Ui(e?.headers),
|
|
4263
4300
|
method: e?.method || "GET",
|
|
4264
|
-
queryParams:
|
|
4301
|
+
queryParams: Ui(e?.queryParams),
|
|
4265
4302
|
responseMapping: e?.responseMapping || {
|
|
4266
4303
|
labelField: "",
|
|
4267
4304
|
valueField: ""
|
|
@@ -4281,8 +4318,8 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4281
4318
|
onSubmit: ({ value: e }) => {
|
|
4282
4319
|
t({
|
|
4283
4320
|
...e,
|
|
4284
|
-
headers:
|
|
4285
|
-
queryParams:
|
|
4321
|
+
headers: Wi(e.headers),
|
|
4322
|
+
queryParams: Wi(e.queryParams)
|
|
4286
4323
|
});
|
|
4287
4324
|
}
|
|
4288
4325
|
});
|
|
@@ -4296,7 +4333,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4296
4333
|
htmlFor: e.name,
|
|
4297
4334
|
children: i("editor.httpConfigForm.apiUrl")
|
|
4298
4335
|
}),
|
|
4299
|
-
/* @__PURE__ */ K(
|
|
4336
|
+
/* @__PURE__ */ K(Ra, {
|
|
4300
4337
|
id: e.name,
|
|
4301
4338
|
name: e.name,
|
|
4302
4339
|
value: e.state.value ?? "",
|
|
@@ -4450,7 +4487,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4450
4487
|
},
|
|
4451
4488
|
children: [/* @__PURE__ */ K(J, { className: "tg:mr-2 tg:h-4 tg:w-4" }), i("editor.httpConfigForm.addHeader")]
|
|
4452
4489
|
}),
|
|
4453
|
-
/* @__PURE__ */ K(
|
|
4490
|
+
/* @__PURE__ */ K(Fa, { headers: e.state.value })
|
|
4454
4491
|
]
|
|
4455
4492
|
})
|
|
4456
4493
|
})]
|
|
@@ -4517,7 +4554,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4517
4554
|
method: e.values.method,
|
|
4518
4555
|
sendAllFormValues: e.values.sendAllFormValues
|
|
4519
4556
|
}),
|
|
4520
|
-
children: ({ method: e, sendAllFormValues: t }) =>
|
|
4557
|
+
children: ({ method: e, sendAllFormValues: t }) => za.includes(e || "") && /* @__PURE__ */ q("div", {
|
|
4521
4558
|
className: "tg:space-y-4",
|
|
4522
4559
|
children: [/* @__PURE__ */ K(o, {
|
|
4523
4560
|
name: "sendAllFormValues",
|
|
@@ -4536,7 +4573,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4536
4573
|
name: "body",
|
|
4537
4574
|
children: (e) => /* @__PURE__ */ q(F, { children: [
|
|
4538
4575
|
/* @__PURE__ */ K(R, { children: i("editor.httpConfigForm.requestBody") }),
|
|
4539
|
-
/* @__PURE__ */ K(
|
|
4576
|
+
/* @__PURE__ */ K(ja, {
|
|
4540
4577
|
value: e.state.value ?? "",
|
|
4541
4578
|
onChange: e.handleChange,
|
|
4542
4579
|
fields: a
|
|
@@ -4589,7 +4626,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4589
4626
|
responsePath: e.values.responsePath,
|
|
4590
4627
|
url: e.values.url
|
|
4591
4628
|
}),
|
|
4592
|
-
children: ({ body: t, headers: n, method: r, queryParams: i, responsePath: a, url: o }) => /* @__PURE__ */ K(
|
|
4629
|
+
children: ({ body: t, headers: n, method: r, queryParams: i, responsePath: a, url: o }) => /* @__PURE__ */ K(Pa, {
|
|
4593
4630
|
showOptionalFields: !0,
|
|
4594
4631
|
mapping: e.state.value ?? {},
|
|
4595
4632
|
onMappingChange: (t) => e.handleChange({
|
|
@@ -4598,9 +4635,9 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4598
4635
|
}),
|
|
4599
4636
|
request: {
|
|
4600
4637
|
body: t,
|
|
4601
|
-
headers:
|
|
4638
|
+
headers: Wi(n),
|
|
4602
4639
|
method: r,
|
|
4603
|
-
queryParams:
|
|
4640
|
+
queryParams: Wi(i),
|
|
4604
4641
|
responsePath: a,
|
|
4605
4642
|
url: o
|
|
4606
4643
|
}
|
|
@@ -4651,23 +4688,23 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4651
4688
|
})
|
|
4652
4689
|
]
|
|
4653
4690
|
}) });
|
|
4654
|
-
},
|
|
4691
|
+
}, Va = [
|
|
4655
4692
|
"POST",
|
|
4656
4693
|
"PUT",
|
|
4657
4694
|
"PATCH"
|
|
4658
|
-
],
|
|
4695
|
+
], Ha = [
|
|
4659
4696
|
"GET",
|
|
4660
4697
|
"POST",
|
|
4661
4698
|
"PUT",
|
|
4662
4699
|
"DELETE",
|
|
4663
4700
|
"PATCH"
|
|
4664
|
-
],
|
|
4701
|
+
], Ua = ({ value: e, onChange: t }) => {
|
|
4665
4702
|
let { selectedNode: n } = Sr(), r = Z(), i = jn(n?.id), a = e?.url ?? "", o = e?.method ?? "GET", s = e?.body ?? "", c = e?.responsePath ?? "", l = e?.mapping, u = e ? "api" : "static", d = (n) => {
|
|
4666
4703
|
t({
|
|
4667
4704
|
...e ?? {},
|
|
4668
4705
|
...n
|
|
4669
4706
|
});
|
|
4670
|
-
}, [f, p] =
|
|
4707
|
+
}, [f, p] = Gi(e?.headers, (e) => d({ headers: e })), [m, h] = Gi(e?.queryParams, (e) => d({ queryParams: e }));
|
|
4671
4708
|
return /* @__PURE__ */ q("div", {
|
|
4672
4709
|
className: "tg:flex tg:flex-col tg:gap-4",
|
|
4673
4710
|
children: [
|
|
@@ -4703,7 +4740,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4703
4740
|
/* @__PURE__ */ q(F, { children: [/* @__PURE__ */ K(R, {
|
|
4704
4741
|
className: "tg:text-xs",
|
|
4705
4742
|
children: r("editor.httpConfigForm.apiUrl")
|
|
4706
|
-
}), /* @__PURE__ */ K(
|
|
4743
|
+
}), /* @__PURE__ */ K(Ra, {
|
|
4707
4744
|
value: a,
|
|
4708
4745
|
onChange: (e, t) => d(t ? {
|
|
4709
4746
|
method: t,
|
|
@@ -4717,7 +4754,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4717
4754
|
}), /* @__PURE__ */ q(j, {
|
|
4718
4755
|
value: o,
|
|
4719
4756
|
onValueChange: (e) => d({ method: e }),
|
|
4720
|
-
children: [/* @__PURE__ */ K(P, { children: /* @__PURE__ */ K(N, {}) }), /* @__PURE__ */ K(M, { children:
|
|
4757
|
+
children: [/* @__PURE__ */ K(P, { children: /* @__PURE__ */ K(N, {}) }), /* @__PURE__ */ K(M, { children: Ha.map((e) => /* @__PURE__ */ K(E, {
|
|
4721
4758
|
value: e,
|
|
4722
4759
|
children: e
|
|
4723
4760
|
}, e)) })]
|
|
@@ -4774,7 +4811,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4774
4811
|
}]),
|
|
4775
4812
|
children: [/* @__PURE__ */ K(J, { className: "tg:mr-2 tg:h-4 tg:w-4" }), r("editor.httpConfigForm.addHeader")]
|
|
4776
4813
|
}),
|
|
4777
|
-
/* @__PURE__ */ K(
|
|
4814
|
+
/* @__PURE__ */ K(Fa, { headers: f })
|
|
4778
4815
|
]
|
|
4779
4816
|
}),
|
|
4780
4817
|
/* @__PURE__ */ q("div", {
|
|
@@ -4831,10 +4868,10 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4831
4868
|
})
|
|
4832
4869
|
]
|
|
4833
4870
|
}),
|
|
4834
|
-
|
|
4871
|
+
Va.includes(o) && /* @__PURE__ */ q(F, { children: [/* @__PURE__ */ K(R, {
|
|
4835
4872
|
className: "tg:text-xs",
|
|
4836
4873
|
children: r("editor.httpConfigForm.requestBody")
|
|
4837
|
-
}), /* @__PURE__ */ K(
|
|
4874
|
+
}), /* @__PURE__ */ K(ja, {
|
|
4838
4875
|
value: s,
|
|
4839
4876
|
onChange: (e) => d({ body: e }),
|
|
4840
4877
|
fields: i
|
|
@@ -4854,7 +4891,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4854
4891
|
children: r("editor.optionsSourceForm.responsePathHint")
|
|
4855
4892
|
})
|
|
4856
4893
|
] }),
|
|
4857
|
-
/* @__PURE__ */ K(
|
|
4894
|
+
/* @__PURE__ */ K(Pa, {
|
|
4858
4895
|
request: {
|
|
4859
4896
|
body: s,
|
|
4860
4897
|
headers: e?.headers,
|
|
@@ -4878,26 +4915,26 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4878
4915
|
] })
|
|
4879
4916
|
]
|
|
4880
4917
|
});
|
|
4881
|
-
},
|
|
4882
|
-
let n =
|
|
4918
|
+
}, Wa = "#/components/schemas/", Ga = (e, t) => {
|
|
4919
|
+
let n = Jr(e), r = n && t.startsWith(n) ? t.slice(n.length) : t;
|
|
4883
4920
|
return r.startsWith("/") ? r : `/${r}`;
|
|
4884
|
-
},
|
|
4921
|
+
}, Ka = (e, t) => t.startsWith(Wa) ? e.components?.schemas?.[t.slice(21)] : void 0, qa = (e, t, n) => {
|
|
4885
4922
|
if (!t) return;
|
|
4886
|
-
let r = (e.paths?.[
|
|
4923
|
+
let r = (e.paths?.[Ga(e, t)]?.[n.toLowerCase()])?.requestBody?.content;
|
|
4887
4924
|
if (r) return r["application/json"]?.schema ?? Object.values(r)[0]?.schema;
|
|
4888
|
-
},
|
|
4925
|
+
}, Ja = (e, t, n = /* @__PURE__ */ new Set()) => {
|
|
4889
4926
|
if (!t) return null;
|
|
4890
|
-
if (t.$ref) return n.has(t.$ref) ? {} :
|
|
4927
|
+
if (t.$ref) return n.has(t.$ref) ? {} : Ja(e, Ka(e, t.$ref), new Set(n).add(t.$ref));
|
|
4891
4928
|
if (t.example !== void 0) return t.example;
|
|
4892
4929
|
if (t.default !== void 0) return t.default;
|
|
4893
4930
|
if (t.enum && t.enum.length > 0) return t.enum[0];
|
|
4894
4931
|
if (t.type === "object" || t.properties) {
|
|
4895
4932
|
let r = {};
|
|
4896
|
-
for (let [i, a] of Object.entries(t.properties ?? {})) r[i] =
|
|
4933
|
+
for (let [i, a] of Object.entries(t.properties ?? {})) r[i] = Ja(e, a, n);
|
|
4897
4934
|
return r;
|
|
4898
4935
|
}
|
|
4899
4936
|
if (t.type === "array") {
|
|
4900
|
-
let r = t.items ?
|
|
4937
|
+
let r = t.items ? Ja(e, t.items, n) : null;
|
|
4901
4938
|
return r === null ? [] : [r];
|
|
4902
4939
|
}
|
|
4903
4940
|
switch (t.type) {
|
|
@@ -4907,18 +4944,18 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4907
4944
|
case "boolean": return !1;
|
|
4908
4945
|
default: return null;
|
|
4909
4946
|
}
|
|
4910
|
-
},
|
|
4947
|
+
}, Ya = [
|
|
4911
4948
|
"POST",
|
|
4912
4949
|
"PUT",
|
|
4913
4950
|
"PATCH"
|
|
4914
|
-
],
|
|
4915
|
-
let [n, r] = W("en"), { selectedNode: i } = Sr(), a = Z(), o = jn(i?.id), { document: s } =
|
|
4951
|
+
], Xa = ({ value: e, onChange: t }) => {
|
|
4952
|
+
let [n, r] = W("en"), { selectedNode: i } = Sr(), a = Z(), o = jn(i?.id), { document: s } = $r(), { Field: c, Subscribe: l, setFieldValue: u } = Ye({
|
|
4916
4953
|
defaultValues: {
|
|
4917
4954
|
errorMessage: e?.errorMessage || { en: "" },
|
|
4918
|
-
headers:
|
|
4955
|
+
headers: Ui(e?.headers),
|
|
4919
4956
|
method: e?.method || "POST",
|
|
4920
4957
|
payloadTemplate: e?.payloadTemplate || "",
|
|
4921
|
-
queryParams:
|
|
4958
|
+
queryParams: Ui(e?.queryParams),
|
|
4922
4959
|
redirectUrl: e?.redirectUrl || "",
|
|
4923
4960
|
sendAllFormValues: !!e?.sendAllFormValues,
|
|
4924
4961
|
showLoading: e?.showLoading !== !1,
|
|
@@ -4934,8 +4971,8 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4934
4971
|
onSubmit: ({ value: e }) => {
|
|
4935
4972
|
t({
|
|
4936
4973
|
...e,
|
|
4937
|
-
headers:
|
|
4938
|
-
queryParams:
|
|
4974
|
+
headers: Wi(e.headers),
|
|
4975
|
+
queryParams: Wi(e.queryParams)
|
|
4939
4976
|
});
|
|
4940
4977
|
}
|
|
4941
4978
|
});
|
|
@@ -4953,7 +4990,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4953
4990
|
url: e.values.url
|
|
4954
4991
|
}),
|
|
4955
4992
|
children: ({ url: t, method: n }) => {
|
|
4956
|
-
let r =
|
|
4993
|
+
let r = qa(s, t ?? "", n ?? "POST");
|
|
4957
4994
|
return /* @__PURE__ */ K(ae, { children: /* @__PURE__ */ q(be, { children: [/* @__PURE__ */ K(C, {
|
|
4958
4995
|
asChild: !0,
|
|
4959
4996
|
children: /* @__PURE__ */ K("span", {
|
|
@@ -4963,7 +5000,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4963
5000
|
variant: "ghost",
|
|
4964
5001
|
size: "sm",
|
|
4965
5002
|
disabled: !r,
|
|
4966
|
-
onClick: () => e.handleChange(JSON.stringify(
|
|
5003
|
+
onClick: () => e.handleChange(JSON.stringify(Ja(s, r), null, 2)),
|
|
4967
5004
|
children: [/* @__PURE__ */ K(_t, { className: "tg:mr-1 tg:h-3 tg:w-3" }), a("editor.submitConfigForm.fillFromApi")]
|
|
4968
5005
|
})
|
|
4969
5006
|
})
|
|
@@ -4971,7 +5008,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4971
5008
|
}
|
|
4972
5009
|
})]
|
|
4973
5010
|
}),
|
|
4974
|
-
/* @__PURE__ */ K(
|
|
5011
|
+
/* @__PURE__ */ K(ja, {
|
|
4975
5012
|
value: e.state.value ?? "",
|
|
4976
5013
|
onChange: e.handleChange,
|
|
4977
5014
|
fields: o
|
|
@@ -4986,7 +5023,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4986
5023
|
htmlFor: e.name,
|
|
4987
5024
|
children: a("editor.submitConfigForm.apiUrl")
|
|
4988
5025
|
}),
|
|
4989
|
-
/* @__PURE__ */ K(
|
|
5026
|
+
/* @__PURE__ */ K(Ra, {
|
|
4990
5027
|
id: e.name,
|
|
4991
5028
|
name: e.name,
|
|
4992
5029
|
value: e.state.value ?? "",
|
|
@@ -5176,7 +5213,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
5176
5213
|
}),
|
|
5177
5214
|
/* @__PURE__ */ K(l, {
|
|
5178
5215
|
selector: (e) => e.values.method,
|
|
5179
|
-
children: (e) =>
|
|
5216
|
+
children: (e) => Ya.includes(e || "") && /* @__PURE__ */ K(c, {
|
|
5180
5217
|
name: "sendAllFormValues",
|
|
5181
5218
|
children: (e) => /* @__PURE__ */ q("div", {
|
|
5182
5219
|
className: "tg:space-y-1",
|
|
@@ -5246,7 +5283,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
5246
5283
|
/* @__PURE__ */ K(L, { children: a("editor.submitConfigForm.successMessageDesc") })
|
|
5247
5284
|
]
|
|
5248
5285
|
})
|
|
5249
|
-
}), /* @__PURE__ */ K(
|
|
5286
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
5250
5287
|
value: n,
|
|
5251
5288
|
onValueChange: r
|
|
5252
5289
|
})]
|
|
@@ -5278,7 +5315,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
5278
5315
|
/* @__PURE__ */ K(L, { children: a("editor.submitConfigForm.errorMessageDesc") })
|
|
5279
5316
|
]
|
|
5280
5317
|
})
|
|
5281
|
-
}), /* @__PURE__ */ K(
|
|
5318
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
5282
5319
|
value: n,
|
|
5283
5320
|
onValueChange: r
|
|
5284
5321
|
})]
|
|
@@ -5307,7 +5344,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
5307
5344
|
})
|
|
5308
5345
|
]
|
|
5309
5346
|
}) });
|
|
5310
|
-
},
|
|
5347
|
+
}, Za = ({ options: e, id: t, value: n, onValueChange: r, placeholder: i = "Select...", searchPlaceholder: a = "Search or create...", createLabel: o = (e) => `Use: ${e}`, clearLabel: s = "Clear selection", emptyLabel: c = "No results found", className: l, allowClear: u = !0, allowCreate: d = !0 }) => {
|
|
5311
5348
|
let [f, p] = W(!1), [m, h] = W(""), g = (e) => e ?? "", v = (e) => e.trim().toLowerCase(), y = g(n), x = n !== null && n !== "", S = x ? e.find((e) => g(e.value) === y) : void 0, C = v(m), w = d && C !== "" && !e.some((e) => v(e.label) === C || v(e.value ?? "") === C), T = (e) => {
|
|
5312
5349
|
e === y ? u && r?.("") : r?.(e), p(!1), h("");
|
|
5313
5350
|
};
|
|
@@ -5369,7 +5406,7 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
5369
5406
|
})
|
|
5370
5407
|
})]
|
|
5371
5408
|
});
|
|
5372
|
-
},
|
|
5409
|
+
}, Qa = Object.entries({
|
|
5373
5410
|
alphanumeric: "^[a-zA-Z0-9]+$",
|
|
5374
5411
|
email: "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",
|
|
5375
5412
|
letters: "^[a-zA-Z]+$",
|
|
@@ -5378,12 +5415,12 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
5378
5415
|
}).map(([e, t]) => ({
|
|
5379
5416
|
label: e.charAt(0).toUpperCase() + e.slice(1).replace(/_/g, " "),
|
|
5380
5417
|
value: t
|
|
5381
|
-
})),
|
|
5418
|
+
})), $a = ({ id: e, value: t, onValueChange: n }) => /* @__PURE__ */ K(Za, {
|
|
5382
5419
|
id: e,
|
|
5383
|
-
options: U(() => t && !
|
|
5420
|
+
options: U(() => t && !Qa.some((e) => e.value === t) ? [...Qa, {
|
|
5384
5421
|
label: `Custom: ${t}`,
|
|
5385
5422
|
value: t
|
|
5386
|
-
}] :
|
|
5423
|
+
}] : Qa, [t]),
|
|
5387
5424
|
value: t,
|
|
5388
5425
|
onValueChange: n,
|
|
5389
5426
|
placeholder: "Select or create a pattern",
|
|
@@ -5392,19 +5429,19 @@ var na = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
5392
5429
|
});
|
|
5393
5430
|
//#endregion
|
|
5394
5431
|
//#region src/shared/components/ui/collapsible.tsx
|
|
5395
|
-
function
|
|
5432
|
+
function eo({ ...e }) {
|
|
5396
5433
|
return /* @__PURE__ */ K(Sn.Root, {
|
|
5397
5434
|
"data-slot": "collapsible",
|
|
5398
5435
|
...e
|
|
5399
5436
|
});
|
|
5400
5437
|
}
|
|
5401
|
-
function
|
|
5438
|
+
function to({ ...e }) {
|
|
5402
5439
|
return /* @__PURE__ */ K(Sn.CollapsibleTrigger, {
|
|
5403
5440
|
"data-slot": "collapsible-trigger",
|
|
5404
5441
|
...e
|
|
5405
5442
|
});
|
|
5406
5443
|
}
|
|
5407
|
-
function
|
|
5444
|
+
function no({ ...e }) {
|
|
5408
5445
|
return /* @__PURE__ */ K(Sn.CollapsibleContent, {
|
|
5409
5446
|
"data-slot": "collapsible-content",
|
|
5410
5447
|
...e
|
|
@@ -5412,8 +5449,8 @@ function Ka({ ...e }) {
|
|
|
5412
5449
|
}
|
|
5413
5450
|
//#endregion
|
|
5414
5451
|
//#region src/editor/features/TreegeEditor/forms/InputNodeForm.tsx
|
|
5415
|
-
var
|
|
5416
|
-
let { language: e } = X(), [t, n] = W(
|
|
5452
|
+
var ro = (e) => Object.values(ya).includes(e), io = () => {
|
|
5453
|
+
let { language: e } = X(), [t, n] = W(ro(e) ? e : "en"), { selectedNode: r } = Sr(), { updateSelectedNodeData: i } = Nr(), a = ri(r?.data), o = jn(r?.id), s = Z(), c = r?.data?.type === "submit", l = r?.data?.type === "hidden", { handleSubmit: u, Field: d, Subscribe: f } = Ye({
|
|
5417
5454
|
defaultValues: {
|
|
5418
5455
|
defaultValue: r?.data?.defaultValue,
|
|
5419
5456
|
disablePast: r?.data?.disablePast,
|
|
@@ -5485,7 +5522,7 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5485
5522
|
}
|
|
5486
5523
|
})]
|
|
5487
5524
|
})
|
|
5488
|
-
}), /* @__PURE__ */ K(
|
|
5525
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
5489
5526
|
value: t,
|
|
5490
5527
|
onValueChange: n
|
|
5491
5528
|
})]
|
|
@@ -5512,7 +5549,7 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5512
5549
|
}
|
|
5513
5550
|
})]
|
|
5514
5551
|
})
|
|
5515
|
-
}), /* @__PURE__ */ K(
|
|
5552
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
5516
5553
|
value: t,
|
|
5517
5554
|
onValueChange: n
|
|
5518
5555
|
})]
|
|
@@ -5539,15 +5576,15 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5539
5576
|
}
|
|
5540
5577
|
})]
|
|
5541
5578
|
})
|
|
5542
|
-
}), /* @__PURE__ */ K(
|
|
5579
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
5543
5580
|
value: t,
|
|
5544
5581
|
onValueChange: n
|
|
5545
5582
|
})]
|
|
5546
5583
|
}),
|
|
5547
|
-
r?.data?.type === "http" && /* @__PURE__ */ q(
|
|
5584
|
+
r?.data?.type === "http" && /* @__PURE__ */ q(eo, {
|
|
5548
5585
|
defaultOpen: !0,
|
|
5549
5586
|
className: "tg:flex tg:w-full tg:max-w-87.5 tg:flex-col tg:gap-2",
|
|
5550
|
-
children: [/* @__PURE__ */ K(
|
|
5587
|
+
children: [/* @__PURE__ */ K(to, {
|
|
5551
5588
|
asChild: !0,
|
|
5552
5589
|
children: /* @__PURE__ */ q("div", {
|
|
5553
5590
|
className: "tg:flex tg:items-center tg:justify-between tg:gap-4",
|
|
@@ -5564,11 +5601,11 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5564
5601
|
})]
|
|
5565
5602
|
})]
|
|
5566
5603
|
})
|
|
5567
|
-
}), /* @__PURE__ */ K(
|
|
5604
|
+
}), /* @__PURE__ */ K(no, {
|
|
5568
5605
|
className: "tg:flex tg:flex-col tg:gap-4",
|
|
5569
5606
|
children: /* @__PURE__ */ K(d, {
|
|
5570
5607
|
name: "httpConfig",
|
|
5571
|
-
children: (e) => /* @__PURE__ */ K(
|
|
5608
|
+
children: (e) => /* @__PURE__ */ K(Ba, {
|
|
5572
5609
|
value: e.state.value,
|
|
5573
5610
|
onChange: (t) => {
|
|
5574
5611
|
e.handleChange(t), u().then();
|
|
@@ -5581,10 +5618,10 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5581
5618
|
})
|
|
5582
5619
|
})]
|
|
5583
5620
|
}),
|
|
5584
|
-
c && /* @__PURE__ */ q(
|
|
5621
|
+
c && /* @__PURE__ */ q(eo, {
|
|
5585
5622
|
defaultOpen: !0,
|
|
5586
5623
|
className: "tg:flex tg:w-full tg:max-w-87.5 tg:flex-col tg:gap-2",
|
|
5587
|
-
children: [/* @__PURE__ */ K(
|
|
5624
|
+
children: [/* @__PURE__ */ K(to, {
|
|
5588
5625
|
asChild: !0,
|
|
5589
5626
|
children: /* @__PURE__ */ q("div", {
|
|
5590
5627
|
className: "tg:flex tg:items-center tg:justify-between tg:gap-4",
|
|
@@ -5601,11 +5638,11 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5601
5638
|
})]
|
|
5602
5639
|
})]
|
|
5603
5640
|
})
|
|
5604
|
-
}), /* @__PURE__ */ K(
|
|
5641
|
+
}), /* @__PURE__ */ K(no, {
|
|
5605
5642
|
className: "tg:flex tg:flex-col tg:gap-4",
|
|
5606
5643
|
children: /* @__PURE__ */ K(d, {
|
|
5607
5644
|
name: "submitConfig",
|
|
5608
|
-
children: (e) => /* @__PURE__ */ K(
|
|
5645
|
+
children: (e) => /* @__PURE__ */ K(Xa, {
|
|
5609
5646
|
value: e.state.value,
|
|
5610
5647
|
onChange: (t) => {
|
|
5611
5648
|
e.handleChange(t), u().then();
|
|
@@ -5628,10 +5665,10 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5628
5665
|
})]
|
|
5629
5666
|
})
|
|
5630
5667
|
}),
|
|
5631
|
-
a && /* @__PURE__ */ q(
|
|
5668
|
+
a && /* @__PURE__ */ q(eo, {
|
|
5632
5669
|
defaultOpen: !0,
|
|
5633
5670
|
className: "tg:flex tg:w-full tg:max-w-87.5 tg:flex-col tg:gap-2",
|
|
5634
|
-
children: [/* @__PURE__ */ K(
|
|
5671
|
+
children: [/* @__PURE__ */ K(to, {
|
|
5635
5672
|
asChild: !0,
|
|
5636
5673
|
children: /* @__PURE__ */ q("div", {
|
|
5637
5674
|
className: "tg:flex tg:items-center tg:justify-between tg:gap-4",
|
|
@@ -5648,12 +5685,12 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5648
5685
|
})]
|
|
5649
5686
|
})]
|
|
5650
5687
|
})
|
|
5651
|
-
}), /* @__PURE__ */ q(
|
|
5688
|
+
}), /* @__PURE__ */ q(no, {
|
|
5652
5689
|
className: "tg:flex tg:flex-col tg:gap-4",
|
|
5653
5690
|
children: [
|
|
5654
5691
|
/* @__PURE__ */ K(d, {
|
|
5655
5692
|
name: "optionsSource",
|
|
5656
|
-
children: (e) => /* @__PURE__ */ K(
|
|
5693
|
+
children: (e) => /* @__PURE__ */ K(Ua, {
|
|
5657
5694
|
value: e.state.value,
|
|
5658
5695
|
onChange: (t) => e.handleChange(t)
|
|
5659
5696
|
})
|
|
@@ -5676,7 +5713,7 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5676
5713
|
children: [
|
|
5677
5714
|
/* @__PURE__ */ K(d, {
|
|
5678
5715
|
name: `options[${r}].image`,
|
|
5679
|
-
children: (e) => /* @__PURE__ */ K(
|
|
5716
|
+
children: (e) => /* @__PURE__ */ K(ni, {
|
|
5680
5717
|
value: e.state.value,
|
|
5681
5718
|
onChange: (t) => e.handleChange(t)
|
|
5682
5719
|
})
|
|
@@ -5785,9 +5822,9 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5785
5822
|
]
|
|
5786
5823
|
})]
|
|
5787
5824
|
}),
|
|
5788
|
-
!c && /* @__PURE__ */ q(
|
|
5825
|
+
!c && /* @__PURE__ */ q(eo, {
|
|
5789
5826
|
className: "tg:flex tg:w-full tg:max-w-87.5 tg:flex-col tg:gap-2",
|
|
5790
|
-
children: [/* @__PURE__ */ K(
|
|
5827
|
+
children: [/* @__PURE__ */ K(to, {
|
|
5791
5828
|
asChild: !0,
|
|
5792
5829
|
children: /* @__PURE__ */ q("div", {
|
|
5793
5830
|
className: "tg:flex tg:items-center tg:justify-between tg:gap-4",
|
|
@@ -5804,7 +5841,7 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5804
5841
|
})]
|
|
5805
5842
|
})]
|
|
5806
5843
|
})
|
|
5807
|
-
}), /* @__PURE__ */ q(
|
|
5844
|
+
}), /* @__PURE__ */ q(no, {
|
|
5808
5845
|
className: "tg:flex tg:flex-col tg:gap-6",
|
|
5809
5846
|
children: [
|
|
5810
5847
|
/* @__PURE__ */ K(d, {
|
|
@@ -5840,7 +5877,7 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5840
5877
|
children: (e) => /* @__PURE__ */ q(F, { children: [/* @__PURE__ */ K(R, {
|
|
5841
5878
|
htmlFor: e.name,
|
|
5842
5879
|
children: s("editor.inputNodeForm.pattern")
|
|
5843
|
-
}), /* @__PURE__ */ K(
|
|
5880
|
+
}), /* @__PURE__ */ K($a, {
|
|
5844
5881
|
id: e.name,
|
|
5845
5882
|
value: e.state.value,
|
|
5846
5883
|
onValueChange: e.handleChange
|
|
@@ -5868,7 +5905,7 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5868
5905
|
}
|
|
5869
5906
|
})]
|
|
5870
5907
|
})
|
|
5871
|
-
}), /* @__PURE__ */ K(
|
|
5908
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
5872
5909
|
value: t,
|
|
5873
5910
|
onValueChange: n
|
|
5874
5911
|
})]
|
|
@@ -5876,9 +5913,9 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5876
5913
|
]
|
|
5877
5914
|
})]
|
|
5878
5915
|
}),
|
|
5879
|
-
!c && /* @__PURE__ */ q(
|
|
5916
|
+
!c && /* @__PURE__ */ q(eo, {
|
|
5880
5917
|
className: "tg:flex tg:w-full tg:max-w-87.5 tg:flex-col tg:gap-2",
|
|
5881
|
-
children: [/* @__PURE__ */ K(
|
|
5918
|
+
children: [/* @__PURE__ */ K(to, {
|
|
5882
5919
|
asChild: !0,
|
|
5883
5920
|
children: /* @__PURE__ */ q("div", {
|
|
5884
5921
|
className: "tg:flex tg:items-center tg:justify-between tg:gap-4",
|
|
@@ -5895,7 +5932,7 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
5895
5932
|
})]
|
|
5896
5933
|
})]
|
|
5897
5934
|
})
|
|
5898
|
-
}), /* @__PURE__ */ q(
|
|
5935
|
+
}), /* @__PURE__ */ q(no, {
|
|
5899
5936
|
className: "tg:flex tg:flex-col tg:gap-6",
|
|
5900
5937
|
children: [/* @__PURE__ */ K(d, {
|
|
5901
5938
|
name: "name",
|
|
@@ -6128,8 +6165,8 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
6128
6165
|
]
|
|
6129
6166
|
})
|
|
6130
6167
|
});
|
|
6131
|
-
},
|
|
6132
|
-
let [e, t] = W("en"), { selectedNode: n } = Sr(), { updateSelectedNodeData: r } =
|
|
6168
|
+
}, ao = () => {
|
|
6169
|
+
let [e, t] = W("en"), { selectedNode: n } = Sr(), { updateSelectedNodeData: r } = Nr(), { Field: i } = Ye({
|
|
6133
6170
|
defaultValues: { label: n?.data?.label || { en: "" } },
|
|
6134
6171
|
listeners: {
|
|
6135
6172
|
onChange: ({ formApi: e }) => {
|
|
@@ -6169,15 +6206,15 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
6169
6206
|
}
|
|
6170
6207
|
})]
|
|
6171
6208
|
})
|
|
6172
|
-
}), /* @__PURE__ */ K(
|
|
6209
|
+
}), /* @__PURE__ */ K(Ca, {
|
|
6173
6210
|
value: e,
|
|
6174
6211
|
onValueChange: t
|
|
6175
6212
|
})]
|
|
6176
6213
|
})
|
|
6177
6214
|
})
|
|
6178
6215
|
});
|
|
6179
|
-
},
|
|
6180
|
-
let { selectedNode: e } = Sr(), { updateSelectedNodeType: t } =
|
|
6216
|
+
}, oo = Object.values(Q), so = Object.values(Jn), co = () => {
|
|
6217
|
+
let { selectedNode: e } = Sr(), { updateSelectedNodeType: t } = Nr(), { getEdges: i } = ze(), { openNodeTypeChangeConfirmation: a } = X(), o = u(e), s = Z(), c = qe(), d = () => e ? n(e) || l(e) ? e.data?.type || "" : e.type || "" : "", f = (n, o) => {
|
|
6181
6218
|
if (!e) return;
|
|
6182
6219
|
let s = i().filter((t) => t.source === e.id).length;
|
|
6183
6220
|
if (n === r.ui && s > 1) {
|
|
@@ -6196,11 +6233,11 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
6196
6233
|
}), /* @__PURE__ */ q(j, {
|
|
6197
6234
|
value: d(),
|
|
6198
6235
|
onValueChange: (e) => {
|
|
6199
|
-
if (
|
|
6236
|
+
if (oo.includes(e)) {
|
|
6200
6237
|
f(r.input, e);
|
|
6201
6238
|
return;
|
|
6202
6239
|
}
|
|
6203
|
-
if (
|
|
6240
|
+
if (so.includes(e)) {
|
|
6204
6241
|
f(r.ui, e);
|
|
6205
6242
|
return;
|
|
6206
6243
|
}
|
|
@@ -6217,13 +6254,13 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
6217
6254
|
value: r.group,
|
|
6218
6255
|
children: s("editor.selectNodeType.options.group")
|
|
6219
6256
|
}) }) : /* @__PURE__ */ q(G, { children: [
|
|
6220
|
-
/* @__PURE__ */ q(S, { children: [/* @__PURE__ */ K(he, { children: s("editor.selectNodeType.options.input") }),
|
|
6257
|
+
/* @__PURE__ */ q(S, { children: [/* @__PURE__ */ K(he, { children: s("editor.selectNodeType.options.input") }), oo.map((e) => /* @__PURE__ */ q(E, {
|
|
6221
6258
|
value: e,
|
|
6222
6259
|
className: "tg:capitalize",
|
|
6223
6260
|
children: [/* @__PURE__ */ K(Zn(e), {}), e]
|
|
6224
6261
|
}, e))] }),
|
|
6225
6262
|
/* @__PURE__ */ K(T, {}),
|
|
6226
|
-
/* @__PURE__ */ q(S, { children: [/* @__PURE__ */ K(he, { children: s("editor.selectNodeType.options.ui") }),
|
|
6263
|
+
/* @__PURE__ */ q(S, { children: [/* @__PURE__ */ K(he, { children: s("editor.selectNodeType.options.ui") }), so.map((e) => /* @__PURE__ */ q(E, {
|
|
6227
6264
|
value: e,
|
|
6228
6265
|
className: "tg:capitalize",
|
|
6229
6266
|
children: [/* @__PURE__ */ K(Zn(e), {}), e]
|
|
@@ -6234,28 +6271,28 @@ var qa = (e) => Object.values(la).includes(e), Ja = () => {
|
|
|
6234
6271
|
};
|
|
6235
6272
|
//#endregion
|
|
6236
6273
|
//#region src/shared/components/ui/sheet.tsx
|
|
6237
|
-
function
|
|
6274
|
+
function lo({ ...e }) {
|
|
6238
6275
|
return /* @__PURE__ */ K(un.Root, {
|
|
6239
6276
|
"data-slot": "sheet",
|
|
6240
6277
|
...e
|
|
6241
6278
|
});
|
|
6242
6279
|
}
|
|
6243
|
-
function
|
|
6280
|
+
function uo({ ...e }) {
|
|
6244
6281
|
return /* @__PURE__ */ K(un.Portal, {
|
|
6245
6282
|
"data-slot": "sheet-portal",
|
|
6246
6283
|
...e
|
|
6247
6284
|
});
|
|
6248
6285
|
}
|
|
6249
|
-
function
|
|
6286
|
+
function fo({ className: e, ...t }) {
|
|
6250
6287
|
return /* @__PURE__ */ K(un.Overlay, {
|
|
6251
6288
|
"data-slot": "sheet-overlay",
|
|
6252
6289
|
className: I("tg:data-[state=closed]:fade-out-0 tg:data-[state=open]:fade-in-0 tg:fixed tg:inset-0 tg:z-[2000] tg:bg-black/50 tg:data-[state=closed]:animate-out tg:data-[state=open]:animate-in", e),
|
|
6253
6290
|
...t
|
|
6254
6291
|
});
|
|
6255
6292
|
}
|
|
6256
|
-
function
|
|
6293
|
+
function po({ className: e, children: t, side: n = "right", ...r }) {
|
|
6257
6294
|
let [i, a] = He.useState(null);
|
|
6258
|
-
return /* @__PURE__ */ q(
|
|
6295
|
+
return /* @__PURE__ */ q(uo, { children: [/* @__PURE__ */ K(fo, {}), /* @__PURE__ */ K(un.Content, {
|
|
6259
6296
|
ref: a,
|
|
6260
6297
|
"data-slot": "sheet-content",
|
|
6261
6298
|
className: I("tg:fixed tg:z-[2000] tg:flex tg:flex-col tg:gap-4 tg:bg-background tg:shadow-lg tg:transition tg:ease-in-out tg:data-[state=closed]:animate-out tg:data-[state=open]:animate-in tg:data-[state=closed]:duration-300 tg:data-[state=open]:duration-500", n === "right" && "tg:data-[state=closed]:slide-out-to-right tg:data-[state=open]:slide-in-from-right tg:inset-y-0 tg:right-0 tg:h-full tg:w-3/4 tg:border-l tg:sm:max-w-sm", n === "left" && "tg:data-[state=closed]:slide-out-to-left tg:data-[state=open]:slide-in-from-left tg:inset-y-0 tg:left-0 tg:h-full tg:w-3/4 tg:border-r tg:sm:max-w-sm", n === "top" && "tg:data-[state=closed]:slide-out-to-top tg:data-[state=open]:slide-in-from-top tg:inset-x-0 tg:top-0 tg:h-auto tg:border-b", n === "bottom" && "tg:data-[state=closed]:slide-out-to-bottom tg:data-[state=open]:slide-in-from-bottom tg:inset-x-0 tg:bottom-0 tg:h-auto tg:border-t", e),
|
|
@@ -6272,28 +6309,28 @@ function no({ className: e, children: t, side: n = "right", ...r }) {
|
|
|
6272
6309
|
})
|
|
6273
6310
|
})] });
|
|
6274
6311
|
}
|
|
6275
|
-
function
|
|
6312
|
+
function mo({ className: e, ...t }) {
|
|
6276
6313
|
return /* @__PURE__ */ K("div", {
|
|
6277
6314
|
"data-slot": "sheet-header",
|
|
6278
6315
|
className: I("tg:flex tg:flex-col tg:gap-1.5 tg:p-4", e),
|
|
6279
6316
|
...t
|
|
6280
6317
|
});
|
|
6281
6318
|
}
|
|
6282
|
-
function
|
|
6319
|
+
function ho({ className: e, ...t }) {
|
|
6283
6320
|
return /* @__PURE__ */ K("div", {
|
|
6284
6321
|
"data-slot": "sheet-footer",
|
|
6285
6322
|
className: I("tg:mt-auto tg:flex tg:flex-col tg:gap-2 tg:p-4", e),
|
|
6286
6323
|
...t
|
|
6287
6324
|
});
|
|
6288
6325
|
}
|
|
6289
|
-
function
|
|
6326
|
+
function go({ className: e, ...t }) {
|
|
6290
6327
|
return /* @__PURE__ */ K(un.Title, {
|
|
6291
6328
|
"data-slot": "sheet-title",
|
|
6292
6329
|
className: I("tg:font-semibold tg:text-foreground", e),
|
|
6293
6330
|
...t
|
|
6294
6331
|
});
|
|
6295
6332
|
}
|
|
6296
|
-
function
|
|
6333
|
+
function _o({ className: e, ...t }) {
|
|
6297
6334
|
return /* @__PURE__ */ K(un.Description, {
|
|
6298
6335
|
"data-slot": "sheet-description",
|
|
6299
6336
|
className: I("tg:text-muted-foreground tg:text-sm", e),
|
|
@@ -6302,44 +6339,44 @@ function oo({ className: e, ...t }) {
|
|
|
6302
6339
|
}
|
|
6303
6340
|
//#endregion
|
|
6304
6341
|
//#region src/editor/features/TreegeEditor/sheets/NodeActionsSheet.tsx
|
|
6305
|
-
var
|
|
6306
|
-
let { selectedNode: e } = Sr(), { clearSelection: t } =
|
|
6342
|
+
var vo = () => {
|
|
6343
|
+
let { selectedNode: e } = Sr(), { clearSelection: t } = Nr(), { isNodeSheetOpen: r, setIsNodeSheetOpen: i, openDeleteNodeConfirmation: a } = X(), o = Z(), s = o(e?.data?.label), c = () => {
|
|
6307
6344
|
i(!1), t();
|
|
6308
6345
|
};
|
|
6309
|
-
return /* @__PURE__ */ K(
|
|
6346
|
+
return /* @__PURE__ */ K(lo, {
|
|
6310
6347
|
open: r && !!e,
|
|
6311
6348
|
onOpenChange: (e) => {
|
|
6312
6349
|
e || c();
|
|
6313
6350
|
},
|
|
6314
|
-
children: /* @__PURE__ */ q(
|
|
6351
|
+
children: /* @__PURE__ */ q(po, {
|
|
6315
6352
|
className: "tg:flex tg:flex-col tg:gap-0",
|
|
6316
6353
|
onKeyDown: (e) => {
|
|
6317
6354
|
e.key !== "Enter" || e.defaultPrevented || e.target.tagName === "INPUT" && (e.preventDefault(), c());
|
|
6318
6355
|
},
|
|
6319
6356
|
children: [
|
|
6320
|
-
/* @__PURE__ */ q(
|
|
6357
|
+
/* @__PURE__ */ q(mo, { children: [/* @__PURE__ */ q(go, { children: [
|
|
6321
6358
|
o("editor.nodeActionsSheet.editNode"),
|
|
6322
6359
|
" ",
|
|
6323
6360
|
/* @__PURE__ */ K("span", {
|
|
6324
6361
|
className: "tg:font-light tg:text-muted-foreground tg:text-xs",
|
|
6325
6362
|
children: e?.id
|
|
6326
6363
|
})
|
|
6327
|
-
] }), /* @__PURE__ */ K(
|
|
6364
|
+
] }), /* @__PURE__ */ K(_o, { children: s || "\xA0" })] }),
|
|
6328
6365
|
/* @__PURE__ */ K(Ln, {
|
|
6329
6366
|
className: "tg:flex tg:min-h-0 tg:flex-1 tg:flex-col tg:px-4",
|
|
6330
6367
|
children: /* @__PURE__ */ q("div", {
|
|
6331
6368
|
className: "tg:space-y-6 tg:py-4",
|
|
6332
6369
|
children: [
|
|
6333
|
-
/* @__PURE__ */ K(
|
|
6370
|
+
/* @__PURE__ */ K(co, {}),
|
|
6334
6371
|
/* @__PURE__ */ K(Cr, {}),
|
|
6335
6372
|
/* @__PURE__ */ K(A, {}),
|
|
6336
|
-
n(e) && /* @__PURE__ */ K(
|
|
6337
|
-
l(e) && /* @__PURE__ */ K(
|
|
6338
|
-
u(e) && /* @__PURE__ */ K(
|
|
6373
|
+
n(e) && /* @__PURE__ */ K(io, {}),
|
|
6374
|
+
l(e) && /* @__PURE__ */ K(ao, {}),
|
|
6375
|
+
u(e) && /* @__PURE__ */ K(wa, {})
|
|
6339
6376
|
]
|
|
6340
6377
|
})
|
|
6341
6378
|
}),
|
|
6342
|
-
/* @__PURE__ */ K(
|
|
6379
|
+
/* @__PURE__ */ K(ho, {
|
|
6343
6380
|
className: "tg:flex tg:items-end tg:border-t",
|
|
6344
6381
|
children: /* @__PURE__ */ K(B, {
|
|
6345
6382
|
variant: "ghost",
|
|
@@ -6354,7 +6391,7 @@ var so = () => {
|
|
|
6354
6391
|
]
|
|
6355
6392
|
})
|
|
6356
6393
|
});
|
|
6357
|
-
},
|
|
6394
|
+
}, yo = ({ ...e }) => {
|
|
6358
6395
|
let { theme: t = "system" } = Cn();
|
|
6359
6396
|
return /* @__PURE__ */ K(ln, {
|
|
6360
6397
|
theme: t,
|
|
@@ -6366,17 +6403,17 @@ var so = () => {
|
|
|
6366
6403
|
},
|
|
6367
6404
|
...e
|
|
6368
6405
|
});
|
|
6369
|
-
},
|
|
6406
|
+
}, bo = {
|
|
6370
6407
|
desktop: "(min-width: 1024px)",
|
|
6371
6408
|
mobile: "(max-width: 767px)",
|
|
6372
6409
|
tablet: "(min-width: 768px) and (max-width: 1023px)"
|
|
6373
|
-
},
|
|
6374
|
-
let [t, n] = W(void 0), r =
|
|
6410
|
+
}, xo = (e) => e in bo, So = (e) => {
|
|
6411
|
+
let [t, n] = W(void 0), r = xo(e) ? bo[e] : e;
|
|
6375
6412
|
return H(() => {
|
|
6376
6413
|
let e = window.matchMedia(r), t = () => n(e.matches);
|
|
6377
6414
|
return e.addEventListener("change", t), n(e.matches), () => e.removeEventListener("change", t);
|
|
6378
6415
|
}, [r]), !!t;
|
|
6379
|
-
},
|
|
6416
|
+
}, Co = ({ flow: e, onExportJson: t, onSave: n, onChange: r, theme: i, className: a, extraMenuItems: o, onAuthorize: s, headers: c, onHeadersChange: l }) => {
|
|
6380
6417
|
let [u, d] = W(!1), [f, p] = W(null), { onConnect: m, onConnectEnd: h, onEdgesDelete: g, isValidConnection: _ } = br(), { onBeforeDelete: v, takeSnapshot: y } = hr({ enableShortcuts: !0 });
|
|
6381
6418
|
return /* @__PURE__ */ K(se, {
|
|
6382
6419
|
container: f,
|
|
@@ -6385,11 +6422,11 @@ var so = () => {
|
|
|
6385
6422
|
fitView: !0,
|
|
6386
6423
|
panOnScroll: !0,
|
|
6387
6424
|
minZoom: .1,
|
|
6388
|
-
fitViewOptions: { maxZoom:
|
|
6425
|
+
fitViewOptions: { maxZoom: So("mobile") ? .6 : 1 },
|
|
6389
6426
|
colorMode: i,
|
|
6390
6427
|
selectNodesOnDrag: !1,
|
|
6391
6428
|
nodesDraggable: !1,
|
|
6392
|
-
nodeTypes:
|
|
6429
|
+
nodeTypes: Ti,
|
|
6393
6430
|
edgeTypes: Kn,
|
|
6394
6431
|
defaultEdges: e?.edges || [],
|
|
6395
6432
|
defaultNodes: e?.nodes || [],
|
|
@@ -6402,13 +6439,13 @@ var so = () => {
|
|
|
6402
6439
|
isValidConnection: _,
|
|
6403
6440
|
className: I(a, "treege treege-editor"),
|
|
6404
6441
|
children: [
|
|
6405
|
-
/* @__PURE__ */ K(
|
|
6406
|
-
/* @__PURE__ */ K(
|
|
6442
|
+
/* @__PURE__ */ K(zi, {}),
|
|
6443
|
+
/* @__PURE__ */ K(Bi, { onChange: r }),
|
|
6407
6444
|
/* @__PURE__ */ K(xe, {
|
|
6408
6445
|
gap: 10,
|
|
6409
6446
|
variant: Se.Dots
|
|
6410
6447
|
}),
|
|
6411
|
-
/* @__PURE__ */ K(
|
|
6448
|
+
/* @__PURE__ */ K(xa, {
|
|
6412
6449
|
onExportJson: t,
|
|
6413
6450
|
onSave: n,
|
|
6414
6451
|
extraMenuItems: o,
|
|
@@ -6417,22 +6454,22 @@ var so = () => {
|
|
|
6417
6454
|
onHeadersChange: l
|
|
6418
6455
|
}),
|
|
6419
6456
|
/* @__PURE__ */ K(En, { theme: i }),
|
|
6420
|
-
/* @__PURE__ */ K(
|
|
6457
|
+
/* @__PURE__ */ K(Sa, {}),
|
|
6421
6458
|
/* @__PURE__ */ K(Te, {
|
|
6422
6459
|
showInteractive: !1,
|
|
6423
|
-
children: /* @__PURE__ */ K(
|
|
6460
|
+
children: /* @__PURE__ */ K(Ei, {
|
|
6424
6461
|
show: u,
|
|
6425
6462
|
onToggle: () => d((e) => !e)
|
|
6426
6463
|
})
|
|
6427
6464
|
}),
|
|
6428
|
-
/* @__PURE__ */ K(
|
|
6465
|
+
/* @__PURE__ */ K(vo, {}),
|
|
6466
|
+
/* @__PURE__ */ K(Ai, {}),
|
|
6429
6467
|
/* @__PURE__ */ K(ki, {}),
|
|
6430
|
-
/* @__PURE__ */ K(Oi, {}),
|
|
6431
6468
|
u && /* @__PURE__ */ K(Oe, {})
|
|
6432
6469
|
]
|
|
6433
6470
|
})
|
|
6434
6471
|
});
|
|
6435
|
-
},
|
|
6472
|
+
}, wo = ({ flow: e, onExportJson: t, onSave: n, onChange: r, onLanguageChange: i, aiConfig: a, extraMenuItems: o, openApi: s, baseUrl: c, onAuthorize: l, headers: u, onHeadersChange: d, language: f, theme: p = "dark", defaultLanguage: m = "en" }) => {
|
|
6436
6473
|
let [g, _] = W(m), v = f !== void 0, y = v ? f : g, b = V((e) => {
|
|
6437
6474
|
v || _(e), i?.(e);
|
|
6438
6475
|
}, [v, i]);
|
|
@@ -6440,7 +6477,7 @@ var so = () => {
|
|
|
6440
6477
|
defaultTheme: p,
|
|
6441
6478
|
storageKey: "treege-editor-theme",
|
|
6442
6479
|
theme: p,
|
|
6443
|
-
children: [/* @__PURE__ */ K(
|
|
6480
|
+
children: [/* @__PURE__ */ K(yo, { position: "bottom-center" }), /* @__PURE__ */ K(An, {
|
|
6444
6481
|
value: {
|
|
6445
6482
|
aiConfig: a,
|
|
6446
6483
|
flowId: e?.id,
|
|
@@ -6448,10 +6485,10 @@ var so = () => {
|
|
|
6448
6485
|
language: y,
|
|
6449
6486
|
setLanguage: b
|
|
6450
6487
|
},
|
|
6451
|
-
children: /* @__PURE__ */ K(
|
|
6488
|
+
children: /* @__PURE__ */ K(Qr, {
|
|
6452
6489
|
initialDocument: s,
|
|
6453
6490
|
initialBaseUrl: c,
|
|
6454
|
-
children: /* @__PURE__ */ K(Me, { children: /* @__PURE__ */ K(
|
|
6491
|
+
children: /* @__PURE__ */ K(Me, { children: /* @__PURE__ */ K(Co, {
|
|
6455
6492
|
onExportJson: t,
|
|
6456
6493
|
onSave: n,
|
|
6457
6494
|
onChange: r,
|
|
@@ -6467,4 +6504,4 @@ var so = () => {
|
|
|
6467
6504
|
})] });
|
|
6468
6505
|
};
|
|
6469
6506
|
//#endregion
|
|
6470
|
-
export {
|
|
6507
|
+
export { wo as t };
|