treege 3.0.0-beta.71 → 3.0.0-beta.72
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-CkCA6_WX.js → editor-Dy_Ul5Mu.js} +245 -243
- package/dist/editor.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
|
@@ -1887,14 +1887,143 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1887
1887
|
]
|
|
1888
1888
|
})]
|
|
1889
1889
|
})] });
|
|
1890
|
-
}, zr =
|
|
1890
|
+
}, zr = [
|
|
1891
|
+
{
|
|
1892
|
+
key: "get",
|
|
1893
|
+
method: "GET"
|
|
1894
|
+
},
|
|
1895
|
+
{
|
|
1896
|
+
key: "post",
|
|
1897
|
+
method: "POST"
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
key: "put",
|
|
1901
|
+
method: "PUT"
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
key: "delete",
|
|
1905
|
+
method: "DELETE"
|
|
1906
|
+
},
|
|
1907
|
+
{
|
|
1908
|
+
key: "patch",
|
|
1909
|
+
method: "PATCH"
|
|
1910
|
+
}
|
|
1911
|
+
], Br = (e) => {
|
|
1912
|
+
if (!e || typeof e != "object") return !1;
|
|
1913
|
+
let t = e;
|
|
1914
|
+
return typeof t.openapi != "string" || !t.openapi.startsWith("3.") ? !1 : !!(t.paths && typeof t.paths == "object");
|
|
1915
|
+
}, Vr = (e) => e.startsWith("{"), Hr = async (e) => {
|
|
1916
|
+
let t = await fetch(e);
|
|
1917
|
+
if (!t.ok) throw Error(`HTTP ${t.status} ${t.statusText}`);
|
|
1918
|
+
return t.json();
|
|
1919
|
+
}, Ur = (e) => Vr(e) ? Promise.resolve(JSON.parse(e)) : Hr(e), Wr = async (e) => {
|
|
1920
|
+
let t = e.trim();
|
|
1921
|
+
if (!t) throw Error("Empty input");
|
|
1922
|
+
let n = await Ur(t);
|
|
1923
|
+
if (!Br(n)) throw Error("Not a valid OpenAPI 3.x document");
|
|
1924
|
+
return n;
|
|
1925
|
+
}, Gr = (e) => {
|
|
1926
|
+
let t = [];
|
|
1927
|
+
for (let [n, r] of Object.entries(e.paths ?? {})) if (r) for (let { key: e, method: i } of zr) {
|
|
1928
|
+
let a = r[e];
|
|
1929
|
+
a && t.push({
|
|
1930
|
+
method: i,
|
|
1931
|
+
operationId: a.operationId,
|
|
1932
|
+
path: n,
|
|
1933
|
+
summary: a.summary
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
return t;
|
|
1937
|
+
}, Kr = (e) => (e.servers?.[0]?.url ?? "").replace(/\/$/, ""), qr = (e) => {
|
|
1938
|
+
let t = e.components?.securitySchemes ?? {}, n = [];
|
|
1939
|
+
for (let [e, r] of Object.entries(t)) {
|
|
1940
|
+
if (!r || typeof r != "object") continue;
|
|
1941
|
+
let t = r;
|
|
1942
|
+
if (t.type === "http" && t.scheme === "bearer") n.push({
|
|
1943
|
+
name: e,
|
|
1944
|
+
scheme: {
|
|
1945
|
+
bearerFormat: typeof t.bearerFormat == "string" ? t.bearerFormat : void 0,
|
|
1946
|
+
description: typeof t.description == "string" ? t.description : void 0,
|
|
1947
|
+
scheme: "bearer",
|
|
1948
|
+
type: "http"
|
|
1949
|
+
}
|
|
1950
|
+
});
|
|
1951
|
+
else if (t.type === "apiKey" && t.in === "header" && typeof t.name == "string") n.push({
|
|
1952
|
+
name: e,
|
|
1953
|
+
scheme: {
|
|
1954
|
+
description: typeof t.description == "string" ? t.description : void 0,
|
|
1955
|
+
in: "header",
|
|
1956
|
+
name: t.name,
|
|
1957
|
+
type: "apiKey"
|
|
1958
|
+
}
|
|
1959
|
+
});
|
|
1960
|
+
else if (t.type === "oauth2" && t.flows && typeof t.flows == "object") {
|
|
1961
|
+
let r = t.flows.password;
|
|
1962
|
+
r && typeof r.tokenUrl == "string" && n.push({
|
|
1963
|
+
name: e,
|
|
1964
|
+
scheme: {
|
|
1965
|
+
description: typeof t.description == "string" ? t.description : void 0,
|
|
1966
|
+
tokenUrl: r.tokenUrl,
|
|
1967
|
+
type: "oauth2"
|
|
1968
|
+
}
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
return n;
|
|
1973
|
+
}, Jr = {
|
|
1974
|
+
baseUrl: "",
|
|
1975
|
+
baseUrlOverride: "",
|
|
1976
|
+
document: null,
|
|
1977
|
+
lastSourceInput: null,
|
|
1978
|
+
routes: [],
|
|
1979
|
+
setBaseUrlOverride: () => {},
|
|
1980
|
+
setDocument: () => {},
|
|
1981
|
+
setLastSourceInput: () => {}
|
|
1982
|
+
}, Yr = Ke(null), Xr = ({ children: e, initialDocument: t, initialBaseUrl: n }) => {
|
|
1983
|
+
let [r, i] = V(typeof t == "object" ? t ?? null : null), [a, o] = V(n ?? ""), [s, c] = V(typeof t == "string" ? {
|
|
1984
|
+
mode: "url",
|
|
1985
|
+
value: t
|
|
1986
|
+
} : null), l = B(() => r ? Gr(r) : [], [r]), u = B(() => a.trim().replace(/\/$/, "") || (r ? Kr(r) : ""), [r, a]), d = B(() => ({
|
|
1987
|
+
baseUrl: u,
|
|
1988
|
+
baseUrlOverride: a,
|
|
1989
|
+
document: r,
|
|
1990
|
+
lastSourceInput: s,
|
|
1991
|
+
routes: l,
|
|
1992
|
+
setBaseUrlOverride: o,
|
|
1993
|
+
setDocument: i,
|
|
1994
|
+
setLastSourceInput: c
|
|
1995
|
+
}), [
|
|
1996
|
+
u,
|
|
1997
|
+
a,
|
|
1998
|
+
r,
|
|
1999
|
+
s,
|
|
2000
|
+
l
|
|
2001
|
+
]);
|
|
2002
|
+
return z(() => {
|
|
2003
|
+
if (typeof t != "string") return;
|
|
2004
|
+
let e = t, n = !1;
|
|
2005
|
+
return Wr(e).then((t) => {
|
|
2006
|
+
n || (i(t), c({
|
|
2007
|
+
mode: "url",
|
|
2008
|
+
value: e
|
|
2009
|
+
}));
|
|
2010
|
+
}).catch((e) => {
|
|
2011
|
+
n || J.error(e instanceof Error ? e.message : String(e));
|
|
2012
|
+
}), () => {
|
|
2013
|
+
n = !0;
|
|
2014
|
+
};
|
|
2015
|
+
}, [t]), /* @__PURE__ */ U(Yr.Provider, {
|
|
2016
|
+
value: d,
|
|
2017
|
+
children: e
|
|
2018
|
+
});
|
|
2019
|
+
}, Zr = () => Je(Yr) ?? Jr, Qr = 400, $r = (e) => {
|
|
1891
2020
|
if (!/^https?:\/\//i.test(e)) return !1;
|
|
1892
2021
|
try {
|
|
1893
2022
|
return !!new URL(e).hostname;
|
|
1894
2023
|
} catch {
|
|
1895
2024
|
return !1;
|
|
1896
2025
|
}
|
|
1897
|
-
},
|
|
2026
|
+
}, ei = ({ value: e, onChange: t }) => {
|
|
1898
2027
|
let n = Xe(null), r = Xe(null), [i, a] = V(!1), [o, s] = V(e && /^https?:\/\//i.test(e) ? e : ""), c = X(), l = async (e) => {
|
|
1899
2028
|
let r = e.target.files?.[0];
|
|
1900
2029
|
if (r) try {
|
|
@@ -1966,9 +2095,9 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1966
2095
|
let i = n.target.value;
|
|
1967
2096
|
s(i), r.current && clearTimeout(r.current);
|
|
1968
2097
|
let a = i.trim();
|
|
1969
|
-
|
|
2098
|
+
!$r(a) || a === e || (r.current = setTimeout(() => {
|
|
1970
2099
|
t(a);
|
|
1971
|
-
},
|
|
2100
|
+
}, Qr));
|
|
1972
2101
|
},
|
|
1973
2102
|
onKeyDown: (e) => {
|
|
1974
2103
|
e.key === "Enter" && (e.preventDefault(), u());
|
|
@@ -1990,7 +2119,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
1990
2119
|
})
|
|
1991
2120
|
]
|
|
1992
2121
|
});
|
|
1993
|
-
},
|
|
2122
|
+
}, ti = (e) => !!(e && "type" in e && e.type && qn.includes(e.type)), ni = new Set(["radio", "checkbox"]), ri = (e) => {
|
|
1994
2123
|
switch (e) {
|
|
1995
2124
|
case "number":
|
|
1996
2125
|
case "daterange":
|
|
@@ -2000,10 +2129,10 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2000
2129
|
case "checkbox": return [];
|
|
2001
2130
|
default: return "";
|
|
2002
2131
|
}
|
|
2003
|
-
},
|
|
2004
|
-
let [n, r] = V(!1), [a, o] = V(""), [s, c] = V(""), [l, p] = V(""), [m, h] = V(""), [g, _] = V(null), { language: v, headers: ee } = Y(), {
|
|
2005
|
-
if (!
|
|
2006
|
-
let
|
|
2132
|
+
}, ii = (e) => e.replace(/^[a-z][\w+.-]*:\/\/[^/]+/i, "") || e, ai = ({ nodeId: e, data: t }) => {
|
|
2133
|
+
let [n, r] = V(!1), [a, o] = V(""), [s, c] = V(""), [l, p] = V(""), [m, h] = V(""), [g, _] = V(null), { language: v, headers: ee } = Y(), { baseUrl: te } = Zr(), { updateNodeData: b } = $(), x = X(), S = t?.type;
|
|
2134
|
+
if (!S) return null;
|
|
2135
|
+
let C = ti(t), w = C ? t.optionsSource?.url : void 0, T = w ?? (S === "http" ? t.httpConfig?.url : void 0), E = C ? t.options ?? [] : [], D = C, O = C, ne = d({
|
|
2007
2136
|
data: t,
|
|
2008
2137
|
id: e,
|
|
2009
2138
|
position: {
|
|
@@ -2011,7 +2140,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2011
2140
|
y: 0
|
|
2012
2141
|
},
|
|
2013
2142
|
type: "input"
|
|
2014
|
-
}),
|
|
2143
|
+
}), re = {
|
|
2015
2144
|
data: {
|
|
2016
2145
|
...t,
|
|
2017
2146
|
name: void 0,
|
|
@@ -2023,46 +2152,47 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2023
2152
|
y: 0
|
|
2024
2153
|
},
|
|
2025
2154
|
type: "input"
|
|
2026
|
-
},
|
|
2155
|
+
}, k = () => {
|
|
2027
2156
|
o(""), c(""), p(""), h("");
|
|
2028
|
-
},
|
|
2157
|
+
}, A = (t) => {
|
|
2029
2158
|
t?.preventDefault();
|
|
2030
2159
|
let n = a.trim(), i = s.trim();
|
|
2031
2160
|
if (!(n || i)) return;
|
|
2032
2161
|
let o = m.trim(), c = {
|
|
2033
2162
|
label: { [v]: n },
|
|
2034
2163
|
value: i,
|
|
2035
|
-
...
|
|
2036
|
-
...
|
|
2164
|
+
...D && l && { image: l },
|
|
2165
|
+
...O && o && { description: { [v]: o } }
|
|
2037
2166
|
};
|
|
2038
|
-
|
|
2039
|
-
}, A = (e) => {
|
|
2040
|
-
r(e), e || (re(), _(null));
|
|
2167
|
+
b(e, { options: g === null ? [...E, c] : E.map((e, t) => t === g ? c : e) }), k(), _(null), r(!1);
|
|
2041
2168
|
}, se = (e) => {
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
}, ue = (
|
|
2047
|
-
e
|
|
2048
|
-
}, de = (e) =>
|
|
2049
|
-
|
|
2050
|
-
|
|
2169
|
+
r(e), e || (k(), _(null));
|
|
2170
|
+
}, j = (e) => {
|
|
2171
|
+
let t = E[e];
|
|
2172
|
+
t && (o(x(t.label) || ""), c(t.value || ""), p(t.image ?? ""), h(x(t.description) || ""), _(e), r(!0));
|
|
2173
|
+
}, ue = (t) => {
|
|
2174
|
+
b(e, { options: E.filter((e, n) => n !== t) });
|
|
2175
|
+
}, de = (e) => {
|
|
2176
|
+
e.key === "Enter" && (e.preventDefault(), A());
|
|
2177
|
+
}, fe = (e) => e.stopPropagation();
|
|
2178
|
+
if (S === "hidden") {
|
|
2179
|
+
let e = Zn(S), n = t.defaultValue?.type === "static" ? t.defaultValue.staticValue : void 0, r = t.defaultValue?.type === "reference" ? t.defaultValue.referenceField : void 0, i = Array.isArray(n) ? n.join(", ") : typeof n == "boolean" ? String(n) : n ?? (r ? `→ ${r}` : "");
|
|
2051
2180
|
return /* @__PURE__ */ W("div", {
|
|
2052
2181
|
className: "tg:pointer-events-none tg:flex tg:select-none tg:flex-col tg:gap-1 tg:text-sm",
|
|
2053
2182
|
children: [/* @__PURE__ */ W("div", {
|
|
2054
2183
|
className: "tg:flex tg:items-center tg:gap-1 tg:text-[10px] tg:text-muted-foreground tg:capitalize tg:[&>svg]:size-3",
|
|
2055
|
-
children: [/* @__PURE__ */ U(e, {}),
|
|
2184
|
+
children: [/* @__PURE__ */ U(e, {}), S]
|
|
2056
2185
|
}), /* @__PURE__ */ U("span", {
|
|
2057
2186
|
className: "tg:truncate tg:text-muted-foreground tg:text-xs",
|
|
2058
2187
|
children: i || "—"
|
|
2059
2188
|
})]
|
|
2060
2189
|
});
|
|
2061
2190
|
}
|
|
2062
|
-
if (
|
|
2191
|
+
if (S === "submit") return /* @__PURE__ */ U("div", {
|
|
2063
2192
|
className: "tg:pointer-events-none tg:flex tg:select-none tg:justify-center",
|
|
2064
2193
|
children: /* @__PURE__ */ U(f, {
|
|
2065
2194
|
value: {
|
|
2195
|
+
baseUrl: te,
|
|
2066
2196
|
headers: ee,
|
|
2067
2197
|
language: v,
|
|
2068
2198
|
optionsDisplayLimit: 10
|
|
@@ -2070,10 +2200,10 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2070
2200
|
children: /* @__PURE__ */ U(be, { label: i(t.label, v) || void 0 })
|
|
2071
2201
|
})
|
|
2072
2202
|
});
|
|
2073
|
-
let
|
|
2074
|
-
if (!
|
|
2075
|
-
let
|
|
2076
|
-
let r = String(e.value), i =
|
|
2203
|
+
let M = ge[S];
|
|
2204
|
+
if (!M) return null;
|
|
2205
|
+
let pe = i(t.helperText, v), me = u(t, v), he = ({ option: e, index: t, variant: n }) => {
|
|
2206
|
+
let r = String(e.value), i = x(e.label) || r;
|
|
2077
2207
|
return /* @__PURE__ */ W(H, { children: [r && r !== i && n !== "card" && /* @__PURE__ */ U("span", {
|
|
2078
2208
|
className: "tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-2 tg:max-w-18 tg:-translate-y-1/2 tg:truncate tg:text-[10px] tg:text-muted-foreground/60 tg:group-hover/option:hidden",
|
|
2079
2209
|
children: r
|
|
@@ -2083,53 +2213,54 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2083
2213
|
type: "button",
|
|
2084
2214
|
variant: "icon",
|
|
2085
2215
|
size: "icon-sm",
|
|
2086
|
-
"aria-label":
|
|
2216
|
+
"aria-label": x("editor.inputNodeForm.editOption"),
|
|
2087
2217
|
className: "tg:size-5",
|
|
2088
2218
|
onClick: (e) => {
|
|
2089
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2219
|
+
e.preventDefault(), e.stopPropagation(), j(t);
|
|
2090
2220
|
},
|
|
2091
2221
|
children: /* @__PURE__ */ U(Vt, {})
|
|
2092
2222
|
}), /* @__PURE__ */ U(P, {
|
|
2093
2223
|
type: "button",
|
|
2094
2224
|
variant: "icon",
|
|
2095
2225
|
size: "icon-sm",
|
|
2096
|
-
"aria-label":
|
|
2226
|
+
"aria-label": x("editor.inputNodeForm.deleteOption"),
|
|
2097
2227
|
className: "tg:size-5 tg:hover:text-destructive",
|
|
2098
2228
|
onClick: (e) => {
|
|
2099
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2229
|
+
e.preventDefault(), e.stopPropagation(), ue(t);
|
|
2100
2230
|
},
|
|
2101
2231
|
children: /* @__PURE__ */ U(Zt, {})
|
|
2102
2232
|
})]
|
|
2103
2233
|
})] });
|
|
2104
|
-
},
|
|
2234
|
+
}, _e = C && !ni.has(S) && !w;
|
|
2105
2235
|
return /* @__PURE__ */ W(H, { children: [
|
|
2106
2236
|
/* @__PURE__ */ U("div", {
|
|
2107
2237
|
className: "tg:pointer-events-none tg:flex tg:select-none tg:flex-col tg:gap-1 tg:[&_label:empty]:hidden",
|
|
2108
2238
|
children: /* @__PURE__ */ U(f, {
|
|
2109
2239
|
value: {
|
|
2240
|
+
baseUrl: te,
|
|
2110
2241
|
headers: ee,
|
|
2111
2242
|
language: v,
|
|
2112
2243
|
optionsDisplayLimit: 10
|
|
2113
2244
|
},
|
|
2114
|
-
children: /* @__PURE__ */ U(
|
|
2245
|
+
children: /* @__PURE__ */ U(M, {
|
|
2115
2246
|
field: {
|
|
2116
2247
|
id: `${e}-preview`,
|
|
2117
|
-
name:
|
|
2118
|
-
placeholder:
|
|
2119
|
-
value:
|
|
2248
|
+
name: ne,
|
|
2249
|
+
placeholder: me || void 0,
|
|
2250
|
+
value: ri(S)
|
|
2120
2251
|
},
|
|
2121
2252
|
extra: {
|
|
2122
2253
|
compactOptions: !0,
|
|
2123
|
-
helperText:
|
|
2254
|
+
helperText: pe || void 0,
|
|
2124
2255
|
missingDependencies: [],
|
|
2125
|
-
node:
|
|
2126
|
-
renderOptionExtras:
|
|
2256
|
+
node: re,
|
|
2257
|
+
renderOptionExtras: w ? void 0 : he,
|
|
2127
2258
|
setValue: () => {}
|
|
2128
2259
|
}
|
|
2129
|
-
},
|
|
2260
|
+
}, S)
|
|
2130
2261
|
})
|
|
2131
2262
|
}),
|
|
2132
|
-
|
|
2263
|
+
T && /* @__PURE__ */ U(y, { children: /* @__PURE__ */ W(ae, {
|
|
2133
2264
|
disableHoverableContent: !0,
|
|
2134
2265
|
children: [/* @__PURE__ */ U(oe, {
|
|
2135
2266
|
asChild: !0,
|
|
@@ -2137,18 +2268,18 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2137
2268
|
className: "nodrag nopan tg:my-1 tg:flex tg:items-center tg:gap-1 tg:text-muted-foreground tg:text-xs",
|
|
2138
2269
|
children: [/* @__PURE__ */ U(Ct, { className: "tg:size-3 tg:shrink-0" }), /* @__PURE__ */ U("span", {
|
|
2139
2270
|
className: "tg:truncate",
|
|
2140
|
-
children:
|
|
2271
|
+
children: ii(T)
|
|
2141
2272
|
})]
|
|
2142
2273
|
})
|
|
2143
2274
|
}), /* @__PURE__ */ U(Se, {
|
|
2144
2275
|
side: "bottom",
|
|
2145
|
-
children:
|
|
2276
|
+
children: T
|
|
2146
2277
|
})]
|
|
2147
2278
|
}) }),
|
|
2148
|
-
|
|
2279
|
+
C && !w && /* @__PURE__ */ W("div", {
|
|
2149
2280
|
className: "nodrag nopan tg:my-1 tg:flex tg:flex-col tg:gap-0.5",
|
|
2150
|
-
children: [
|
|
2151
|
-
let n =
|
|
2281
|
+
children: [_e && E.map((e, t) => {
|
|
2282
|
+
let n = x(e.label), r = n || e.value || "—", i = `${e.value || "opt"}-${t}`, a = !!e.value && !!n && n !== e.value;
|
|
2152
2283
|
return /* @__PURE__ */ W("div", {
|
|
2153
2284
|
className: "tg:group tg:flex tg:min-h-5 tg:items-center tg:gap-1 tg:text-muted-foreground tg:text-xs",
|
|
2154
2285
|
children: [
|
|
@@ -2166,20 +2297,20 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2166
2297
|
type: "button",
|
|
2167
2298
|
variant: "icon",
|
|
2168
2299
|
size: "icon-sm",
|
|
2169
|
-
"aria-label":
|
|
2300
|
+
"aria-label": x("editor.inputNodeForm.editOption"),
|
|
2170
2301
|
className: "tg:size-5",
|
|
2171
2302
|
onClick: (e) => {
|
|
2172
|
-
e.stopPropagation(),
|
|
2303
|
+
e.stopPropagation(), j(t);
|
|
2173
2304
|
},
|
|
2174
2305
|
children: /* @__PURE__ */ U(Vt, {})
|
|
2175
2306
|
}), /* @__PURE__ */ U(P, {
|
|
2176
2307
|
type: "button",
|
|
2177
2308
|
variant: "icon",
|
|
2178
2309
|
size: "icon-sm",
|
|
2179
|
-
"aria-label":
|
|
2310
|
+
"aria-label": x("editor.inputNodeForm.deleteOption"),
|
|
2180
2311
|
className: "tg:size-5 tg:hover:text-destructive",
|
|
2181
2312
|
onClick: (e) => {
|
|
2182
|
-
e.stopPropagation(),
|
|
2313
|
+
e.stopPropagation(), ue(t);
|
|
2183
2314
|
},
|
|
2184
2315
|
children: /* @__PURE__ */ U(Zt, {})
|
|
2185
2316
|
})]
|
|
@@ -2188,55 +2319,55 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2188
2319
|
}, i);
|
|
2189
2320
|
}), /* @__PURE__ */ W(ce, {
|
|
2190
2321
|
open: n,
|
|
2191
|
-
onOpenChange:
|
|
2322
|
+
onOpenChange: se,
|
|
2192
2323
|
children: [/* @__PURE__ */ U(ie, {
|
|
2193
2324
|
asChild: !0,
|
|
2194
|
-
onClick:
|
|
2325
|
+
onClick: fe,
|
|
2195
2326
|
children: /* @__PURE__ */ W(P, {
|
|
2196
2327
|
type: "button",
|
|
2197
2328
|
variant: "link",
|
|
2198
2329
|
size: "xs",
|
|
2199
2330
|
className: "tg:w-fit tg:p-0! tg:focus-visible:border-transparent! tg:focus-visible:ring-0!",
|
|
2200
|
-
children: [/* @__PURE__ */ U(G, { className: "tg:size-3" }),
|
|
2331
|
+
children: [/* @__PURE__ */ U(G, { className: "tg:size-3" }), x("editor.inputNodeForm.addOption")]
|
|
2201
2332
|
})
|
|
2202
2333
|
}), /* @__PURE__ */ U(le, {
|
|
2203
2334
|
align: "start",
|
|
2204
2335
|
className: "tg:w-80 tg:p-3",
|
|
2205
|
-
onClick:
|
|
2336
|
+
onClick: fe,
|
|
2206
2337
|
children: /* @__PURE__ */ W("form", {
|
|
2207
|
-
onSubmit:
|
|
2338
|
+
onSubmit: A,
|
|
2208
2339
|
className: "tg:flex tg:flex-col tg:gap-2",
|
|
2209
2340
|
children: [
|
|
2210
2341
|
/* @__PURE__ */ W("div", {
|
|
2211
2342
|
className: "tg:flex tg:items-start tg:gap-2",
|
|
2212
2343
|
children: [
|
|
2213
|
-
|
|
2344
|
+
D && /* @__PURE__ */ U(ei, {
|
|
2214
2345
|
value: l,
|
|
2215
2346
|
onChange: p
|
|
2216
2347
|
}),
|
|
2217
2348
|
/* @__PURE__ */ U(N, {
|
|
2218
2349
|
id: `${e}-option-label`,
|
|
2219
2350
|
autoFocus: !0,
|
|
2220
|
-
placeholder:
|
|
2351
|
+
placeholder: x("editor.inputNodeForm.optionLabel"),
|
|
2221
2352
|
value: a,
|
|
2222
2353
|
onChange: (e) => o(e.target.value),
|
|
2223
|
-
onKeyDown:
|
|
2354
|
+
onKeyDown: de
|
|
2224
2355
|
}),
|
|
2225
2356
|
/* @__PURE__ */ U(N, {
|
|
2226
2357
|
id: `${e}-option-value`,
|
|
2227
|
-
placeholder:
|
|
2358
|
+
placeholder: x("editor.inputNodeForm.optionValue"),
|
|
2228
2359
|
value: s,
|
|
2229
2360
|
onChange: (e) => c(e.target.value),
|
|
2230
|
-
onKeyDown:
|
|
2361
|
+
onKeyDown: de
|
|
2231
2362
|
})
|
|
2232
2363
|
]
|
|
2233
2364
|
}),
|
|
2234
|
-
|
|
2365
|
+
O && /* @__PURE__ */ U(N, {
|
|
2235
2366
|
id: `${e}-option-description`,
|
|
2236
|
-
placeholder:
|
|
2367
|
+
placeholder: x("editor.inputNodeForm.optionDescription"),
|
|
2237
2368
|
value: m,
|
|
2238
2369
|
onChange: (e) => h(e.target.value),
|
|
2239
|
-
onKeyDown:
|
|
2370
|
+
onKeyDown: de
|
|
2240
2371
|
}),
|
|
2241
2372
|
/* @__PURE__ */ W("div", {
|
|
2242
2373
|
className: "tg:flex tg:gap-2",
|
|
@@ -2245,14 +2376,14 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2245
2376
|
variant: "outline",
|
|
2246
2377
|
size: "sm",
|
|
2247
2378
|
className: "tg:flex-1",
|
|
2248
|
-
onClick: () =>
|
|
2249
|
-
children:
|
|
2379
|
+
onClick: () => se(!1),
|
|
2380
|
+
children: x("common.cancel")
|
|
2250
2381
|
}), /* @__PURE__ */ U(P, {
|
|
2251
2382
|
type: "submit",
|
|
2252
2383
|
size: "sm",
|
|
2253
2384
|
className: "tg:flex-1",
|
|
2254
2385
|
disabled: !(a.trim() || s.trim()),
|
|
2255
|
-
children:
|
|
2386
|
+
children: x(g === null ? "common.create" : "common.save")
|
|
2256
2387
|
})]
|
|
2257
2388
|
})
|
|
2258
2389
|
]
|
|
@@ -2261,7 +2392,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2261
2392
|
})]
|
|
2262
2393
|
})
|
|
2263
2394
|
] });
|
|
2264
|
-
},
|
|
2395
|
+
}, oi = ({ nodeId: e, label: t, placeholder: n, className: r, autoFocus: i }) => {
|
|
2265
2396
|
let { language: a } = Y(), { updateNodeData: o, clearSelection: s } = $(), c = X(), l = Xe(null), u = t?.[a] ?? "", d = n || c("editor.treegeNode.labelPlaceholder");
|
|
2266
2397
|
return z(() => {
|
|
2267
2398
|
if (!i) return;
|
|
@@ -2285,7 +2416,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2285
2416
|
},
|
|
2286
2417
|
className: I("nodrag nopan tg:w-full tg:truncate tg:bg-transparent tg:outline-none tg:placeholder:text-muted-foreground/40", r)
|
|
2287
2418
|
});
|
|
2288
|
-
},
|
|
2419
|
+
}, si = ({ nodeId: e, className: t }) => {
|
|
2289
2420
|
let { selectNode: n } = $(), { setIsNodeSheetOpen: r, openDeleteNodeConfirmation: i } = Y(), a = X(), o = (e) => e.stopPropagation();
|
|
2290
2421
|
return /* @__PURE__ */ W(Qn, {
|
|
2291
2422
|
modal: !1,
|
|
@@ -2321,7 +2452,7 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2321
2452
|
]
|
|
2322
2453
|
})]
|
|
2323
2454
|
});
|
|
2324
|
-
},
|
|
2455
|
+
}, ci = ({ nodeId: e, required: t }) => {
|
|
2325
2456
|
let { updateNodeData: n } = $(), r = X();
|
|
2326
2457
|
return /* @__PURE__ */ U(y, { children: /* @__PURE__ */ W(ae, {
|
|
2327
2458
|
disableHoverableContent: !0,
|
|
@@ -2342,12 +2473,12 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2342
2473
|
children: r(t ? "editor.inputNodeForm.required" : "editor.inputNodeForm.optional")
|
|
2343
2474
|
})]
|
|
2344
2475
|
}) });
|
|
2345
|
-
},
|
|
2476
|
+
}, li = (e) => Symbol.iterator in e, ui = (e) => "entries" in e, di = (e, t) => {
|
|
2346
2477
|
let n = e instanceof Map ? e : new Map(e.entries()), r = t instanceof Map ? t : new Map(t.entries());
|
|
2347
2478
|
if (n.size !== r.size) return !1;
|
|
2348
2479
|
for (let [e, t] of n) if (!r.has(e) || !Object.is(t, r.get(e))) return !1;
|
|
2349
2480
|
return !0;
|
|
2350
|
-
},
|
|
2481
|
+
}, fi = (e, t) => {
|
|
2351
2482
|
let n = e[Symbol.iterator](), r = t[Symbol.iterator](), i = n.next(), a = r.next();
|
|
2352
2483
|
for (; !i.done && !a.done;) {
|
|
2353
2484
|
if (!Object.is(i.value, a.value)) return !1;
|
|
@@ -2355,21 +2486,21 @@ var Or = ({ nodeId: e, groupId: t }) => {
|
|
|
2355
2486
|
}
|
|
2356
2487
|
return !!i.done && !!a.done;
|
|
2357
2488
|
};
|
|
2358
|
-
function
|
|
2359
|
-
return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 :
|
|
2489
|
+
function pi(e, t) {
|
|
2490
|
+
return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 : li(e) && li(t) ? ui(e) && ui(t) ? di(e, t) : fi(e, t) : di({ entries: () => Object.entries(e) }, { entries: () => Object.entries(t) });
|
|
2360
2491
|
}
|
|
2361
2492
|
//#endregion
|
|
2362
2493
|
//#region node_modules/zustand/esm/react/shallow.mjs
|
|
2363
|
-
function
|
|
2494
|
+
function mi(e) {
|
|
2364
2495
|
let t = Ge.useRef(void 0);
|
|
2365
2496
|
return (n) => {
|
|
2366
2497
|
let r = e(n);
|
|
2367
|
-
return
|
|
2498
|
+
return pi(t.current, r) ? t.current : t.current = r;
|
|
2368
2499
|
};
|
|
2369
2500
|
}
|
|
2370
2501
|
//#endregion
|
|
2371
2502
|
//#region src/editor/hooks/useStackPosition.ts
|
|
2372
|
-
var
|
|
2503
|
+
var hi = (e) => He(mi((t) => {
|
|
2373
2504
|
let n = Fn(t.edges).get(e) ?? "single";
|
|
2374
2505
|
return {
|
|
2375
2506
|
isStackHead: n === "first" || n === "single",
|
|
@@ -2378,8 +2509,8 @@ var ni = (e) => He(ti((t) => {
|
|
|
2378
2509
|
isStackTail: n === "last" || n === "single",
|
|
2379
2510
|
position: n
|
|
2380
2511
|
};
|
|
2381
|
-
})),
|
|
2382
|
-
let { position: n, isStackSingle: r } =
|
|
2512
|
+
})), gi = ({ nodeId: e, selected: t }) => {
|
|
2513
|
+
let { position: n, isStackSingle: r } = hi(e), { moveStackNodeUp: i, moveStackNodeDown: a } = br(), o = X(), { isDecision: s, isSuccessorDecision: c } = He(mi((t) => {
|
|
2383
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;
|
|
2384
2515
|
return {
|
|
2385
2516
|
isDecision: n.length > 1,
|
|
@@ -2436,7 +2567,7 @@ var ni = (e) => He(ti((t) => {
|
|
|
2436
2567
|
})]
|
|
2437
2568
|
})
|
|
2438
2569
|
}) : null;
|
|
2439
|
-
},
|
|
2570
|
+
}, _i = Object.values(Z), vi = Object.values(Jn), yi = ({ nodeId: e, nodeType: t, subType: n }) => {
|
|
2440
2571
|
let { updateNodeType: r } = $(), { getEdges: i } = Ve(), { openNodeTypeChangeConfirmation: o } = Y(), s = X(), c = (e) => e.stopPropagation(), l = n || t, u = l, d = Zn(l), f = (t, n) => {
|
|
2441
2572
|
let s = i().filter((t) => t.source === e).length;
|
|
2442
2573
|
if (t === a.ui && s > 1) {
|
|
@@ -2466,7 +2597,7 @@ var ni = (e) => He(ti((t) => {
|
|
|
2466
2597
|
className: "treege-scrollbar tg:max-h-80",
|
|
2467
2598
|
onClick: c,
|
|
2468
2599
|
children: [
|
|
2469
|
-
/* @__PURE__ */ W(tr, { children: [/* @__PURE__ */ U(ir, { children: s("editor.selectNodeType.options.input") }),
|
|
2600
|
+
/* @__PURE__ */ W(tr, { children: [/* @__PURE__ */ U(ir, { children: s("editor.selectNodeType.options.input") }), _i.map((e) => {
|
|
2470
2601
|
let r = Zn(e);
|
|
2471
2602
|
return /* @__PURE__ */ W(Q, {
|
|
2472
2603
|
onClick: () => f(a.input, e),
|
|
@@ -2475,7 +2606,7 @@ var ni = (e) => He(ti((t) => {
|
|
|
2475
2606
|
}, e);
|
|
2476
2607
|
})] }),
|
|
2477
2608
|
/* @__PURE__ */ U(ar, {}),
|
|
2478
|
-
/* @__PURE__ */ W(tr, { children: [/* @__PURE__ */ U(ir, { children: s("editor.selectNodeType.options.ui") }),
|
|
2609
|
+
/* @__PURE__ */ W(tr, { children: [/* @__PURE__ */ U(ir, { children: s("editor.selectNodeType.options.ui") }), vi.map((e) => {
|
|
2479
2610
|
let r = Zn(e);
|
|
2480
2611
|
return /* @__PURE__ */ W(Q, {
|
|
2481
2612
|
onClick: () => f(a.ui, e),
|
|
@@ -2485,20 +2616,20 @@ var ni = (e) => He(ti((t) => {
|
|
|
2485
2616
|
})] })
|
|
2486
2617
|
]
|
|
2487
2618
|
})] });
|
|
2488
|
-
},
|
|
2619
|
+
}, bi = {
|
|
2489
2620
|
first: "tg:rounded-t-lg tg:rounded-b-none",
|
|
2490
2621
|
last: "tg:rounded-b-lg tg:rounded-t-none",
|
|
2491
2622
|
middle: "tg:rounded-none",
|
|
2492
2623
|
single: "tg:rounded-lg"
|
|
2493
|
-
},
|
|
2624
|
+
}, xi = ({ children: e, isSubmit: t, stackPosition: n = "single" }) => {
|
|
2494
2625
|
let r = n === "middle" || n === "last";
|
|
2495
2626
|
return /* @__PURE__ */ U("div", {
|
|
2496
|
-
className: I("react-flow__node__wrapper tg:group tg:relative",
|
|
2627
|
+
className: I("react-flow__node__wrapper tg:group tg:relative", bi[n], r && "stacked", t && "submit-type"),
|
|
2497
2628
|
children: e
|
|
2498
2629
|
});
|
|
2499
|
-
},
|
|
2500
|
-
let { id: t, isConnectable: n, parentId: r, selected: i, type: a } = e, { position: o, isStackHead: s, isStackTail: c } =
|
|
2501
|
-
return /* @__PURE__ */ W(
|
|
2630
|
+
}, Si = qe((e) => {
|
|
2631
|
+
let { id: t, isConnectable: n, parentId: r, selected: i, type: a } = e, { position: o, isStackHead: s, isStackTail: c } = hi(t), l = Le((e) => e.inProgress), u = He((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__ */ W(xi, {
|
|
2502
2633
|
isSubmit: m,
|
|
2503
2634
|
stackPosition: o,
|
|
2504
2635
|
children: [
|
|
@@ -2514,7 +2645,7 @@ var ni = (e) => He(ti((t) => {
|
|
|
2514
2645
|
className: "tg:mb-1 tg:flex tg:items-center tg:justify-between tg:gap-1",
|
|
2515
2646
|
children: [/* @__PURE__ */ W("div", {
|
|
2516
2647
|
className: "tg:flex tg:flex-wrap tg:gap-1",
|
|
2517
|
-
children: [/* @__PURE__ */ U(
|
|
2648
|
+
children: [/* @__PURE__ */ U(yi, {
|
|
2518
2649
|
nodeId: t,
|
|
2519
2650
|
nodeType: a,
|
|
2520
2651
|
subType: p
|
|
@@ -2524,23 +2655,23 @@ var ni = (e) => He(ti((t) => {
|
|
|
2524
2655
|
})]
|
|
2525
2656
|
}), /* @__PURE__ */ W("div", {
|
|
2526
2657
|
className: "tg:flex tg:min-h-6 tg:items-center tg:gap-0.5",
|
|
2527
|
-
children: [d && !m && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(
|
|
2658
|
+
children: [d && !m && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(ci, {
|
|
2528
2659
|
nodeId: t,
|
|
2529
2660
|
required: d.required
|
|
2530
2661
|
}), /* @__PURE__ */ U(Rr, {
|
|
2531
2662
|
nodeId: t,
|
|
2532
2663
|
image: d.image
|
|
2533
|
-
})] }), /* @__PURE__ */ U(
|
|
2664
|
+
})] }), /* @__PURE__ */ U(si, { nodeId: t })]
|
|
2534
2665
|
})]
|
|
2535
2666
|
}),
|
|
2536
|
-
/* @__PURE__ */ U(
|
|
2667
|
+
/* @__PURE__ */ U(oi, {
|
|
2537
2668
|
nodeId: t,
|
|
2538
2669
|
label: e.data?.label,
|
|
2539
2670
|
placeholder: d?.name,
|
|
2540
2671
|
autoFocus: h,
|
|
2541
2672
|
className: I("tg:py-1", a === "ui" && "tg:capitalize")
|
|
2542
2673
|
}),
|
|
2543
|
-
/* @__PURE__ */ U(
|
|
2674
|
+
/* @__PURE__ */ U(ai, {
|
|
2544
2675
|
nodeId: t,
|
|
2545
2676
|
data: d
|
|
2546
2677
|
}),
|
|
@@ -2551,146 +2682,17 @@ var ni = (e) => He(ti((t) => {
|
|
|
2551
2682
|
canBranch: !!d && !m,
|
|
2552
2683
|
isJunction: _
|
|
2553
2684
|
}),
|
|
2554
|
-
/* @__PURE__ */ U(
|
|
2685
|
+
/* @__PURE__ */ U(gi, {
|
|
2555
2686
|
nodeId: t,
|
|
2556
2687
|
selected: i
|
|
2557
2688
|
})
|
|
2558
2689
|
]
|
|
2559
2690
|
});
|
|
2560
|
-
}),
|
|
2691
|
+
}), Ci = {
|
|
2561
2692
|
[a.group]: () => null,
|
|
2562
|
-
[a.input]:
|
|
2563
|
-
[a.ui]:
|
|
2564
|
-
},
|
|
2565
|
-
{
|
|
2566
|
-
key: "get",
|
|
2567
|
-
method: "GET"
|
|
2568
|
-
},
|
|
2569
|
-
{
|
|
2570
|
-
key: "post",
|
|
2571
|
-
method: "POST"
|
|
2572
|
-
},
|
|
2573
|
-
{
|
|
2574
|
-
key: "put",
|
|
2575
|
-
method: "PUT"
|
|
2576
|
-
},
|
|
2577
|
-
{
|
|
2578
|
-
key: "delete",
|
|
2579
|
-
method: "DELETE"
|
|
2580
|
-
},
|
|
2581
|
-
{
|
|
2582
|
-
key: "patch",
|
|
2583
|
-
method: "PATCH"
|
|
2584
|
-
}
|
|
2585
|
-
], fi = (e) => {
|
|
2586
|
-
if (!e || typeof e != "object") return !1;
|
|
2587
|
-
let t = e;
|
|
2588
|
-
return typeof t.openapi != "string" || !t.openapi.startsWith("3.") ? !1 : !!(t.paths && typeof t.paths == "object");
|
|
2589
|
-
}, pi = (e) => e.startsWith("{"), mi = async (e) => {
|
|
2590
|
-
let t = await fetch(e);
|
|
2591
|
-
if (!t.ok) throw Error(`HTTP ${t.status} ${t.statusText}`);
|
|
2592
|
-
return t.json();
|
|
2593
|
-
}, hi = (e) => pi(e) ? Promise.resolve(JSON.parse(e)) : mi(e), gi = async (e) => {
|
|
2594
|
-
let t = e.trim();
|
|
2595
|
-
if (!t) throw Error("Empty input");
|
|
2596
|
-
let n = await hi(t);
|
|
2597
|
-
if (!fi(n)) throw Error("Not a valid OpenAPI 3.x document");
|
|
2598
|
-
return n;
|
|
2599
|
-
}, _i = (e) => {
|
|
2600
|
-
let t = [];
|
|
2601
|
-
for (let [n, r] of Object.entries(e.paths ?? {})) if (r) for (let { key: e, method: i } of di) {
|
|
2602
|
-
let a = r[e];
|
|
2603
|
-
a && t.push({
|
|
2604
|
-
method: i,
|
|
2605
|
-
operationId: a.operationId,
|
|
2606
|
-
path: n,
|
|
2607
|
-
summary: a.summary
|
|
2608
|
-
});
|
|
2609
|
-
}
|
|
2610
|
-
return t;
|
|
2611
|
-
}, vi = (e) => (e.servers?.[0]?.url ?? "").replace(/\/$/, ""), yi = (e) => {
|
|
2612
|
-
let t = e.components?.securitySchemes ?? {}, n = [];
|
|
2613
|
-
for (let [e, r] of Object.entries(t)) {
|
|
2614
|
-
if (!r || typeof r != "object") continue;
|
|
2615
|
-
let t = r;
|
|
2616
|
-
if (t.type === "http" && t.scheme === "bearer") n.push({
|
|
2617
|
-
name: e,
|
|
2618
|
-
scheme: {
|
|
2619
|
-
bearerFormat: typeof t.bearerFormat == "string" ? t.bearerFormat : void 0,
|
|
2620
|
-
description: typeof t.description == "string" ? t.description : void 0,
|
|
2621
|
-
scheme: "bearer",
|
|
2622
|
-
type: "http"
|
|
2623
|
-
}
|
|
2624
|
-
});
|
|
2625
|
-
else if (t.type === "apiKey" && t.in === "header" && typeof t.name == "string") n.push({
|
|
2626
|
-
name: e,
|
|
2627
|
-
scheme: {
|
|
2628
|
-
description: typeof t.description == "string" ? t.description : void 0,
|
|
2629
|
-
in: "header",
|
|
2630
|
-
name: t.name,
|
|
2631
|
-
type: "apiKey"
|
|
2632
|
-
}
|
|
2633
|
-
});
|
|
2634
|
-
else if (t.type === "oauth2" && t.flows && typeof t.flows == "object") {
|
|
2635
|
-
let r = t.flows.password;
|
|
2636
|
-
r && typeof r.tokenUrl == "string" && n.push({
|
|
2637
|
-
name: e,
|
|
2638
|
-
scheme: {
|
|
2639
|
-
description: typeof t.description == "string" ? t.description : void 0,
|
|
2640
|
-
tokenUrl: r.tokenUrl,
|
|
2641
|
-
type: "oauth2"
|
|
2642
|
-
}
|
|
2643
|
-
});
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
return n;
|
|
2647
|
-
}, bi = {
|
|
2648
|
-
baseUrl: "",
|
|
2649
|
-
baseUrlOverride: "",
|
|
2650
|
-
document: null,
|
|
2651
|
-
lastSourceInput: null,
|
|
2652
|
-
routes: [],
|
|
2653
|
-
setBaseUrlOverride: () => {},
|
|
2654
|
-
setDocument: () => {},
|
|
2655
|
-
setLastSourceInput: () => {}
|
|
2656
|
-
}, xi = Ke(null), Si = ({ children: e, initialDocument: t, initialBaseUrl: n }) => {
|
|
2657
|
-
let [r, i] = V(typeof t == "object" ? t ?? null : null), [a, o] = V(n ?? ""), [s, c] = V(typeof t == "string" ? {
|
|
2658
|
-
mode: "url",
|
|
2659
|
-
value: t
|
|
2660
|
-
} : null), l = B(() => r ? _i(r) : [], [r]), u = B(() => a.trim().replace(/\/$/, "") || (r ? vi(r) : ""), [r, a]), d = B(() => ({
|
|
2661
|
-
baseUrl: u,
|
|
2662
|
-
baseUrlOverride: a,
|
|
2663
|
-
document: r,
|
|
2664
|
-
lastSourceInput: s,
|
|
2665
|
-
routes: l,
|
|
2666
|
-
setBaseUrlOverride: o,
|
|
2667
|
-
setDocument: i,
|
|
2668
|
-
setLastSourceInput: c
|
|
2669
|
-
}), [
|
|
2670
|
-
u,
|
|
2671
|
-
a,
|
|
2672
|
-
r,
|
|
2673
|
-
s,
|
|
2674
|
-
l
|
|
2675
|
-
]);
|
|
2676
|
-
return z(() => {
|
|
2677
|
-
if (typeof t != "string") return;
|
|
2678
|
-
let e = t, n = !1;
|
|
2679
|
-
return gi(e).then((t) => {
|
|
2680
|
-
n || (i(t), c({
|
|
2681
|
-
mode: "url",
|
|
2682
|
-
value: e
|
|
2683
|
-
}));
|
|
2684
|
-
}).catch((e) => {
|
|
2685
|
-
n || J.error(e instanceof Error ? e.message : String(e));
|
|
2686
|
-
}), () => {
|
|
2687
|
-
n = !0;
|
|
2688
|
-
};
|
|
2689
|
-
}, [t]), /* @__PURE__ */ U(xi.Provider, {
|
|
2690
|
-
value: d,
|
|
2691
|
-
children: e
|
|
2692
|
-
});
|
|
2693
|
-
}, Ci = () => Je(xi) ?? bi, wi = ({ show: e, onToggle: t }) => /* @__PURE__ */ U(Ee, {
|
|
2693
|
+
[a.input]: Si,
|
|
2694
|
+
[a.ui]: Si
|
|
2695
|
+
}, wi = ({ show: e, onToggle: t }) => /* @__PURE__ */ U(Ee, {
|
|
2694
2696
|
onClick: t,
|
|
2695
2697
|
title: e ? "Hide minimap" : "Show minimap",
|
|
2696
2698
|
children: U(e ? Lt : It, {})
|
|
@@ -2939,7 +2941,7 @@ var ni = (e) => He(ti((t) => {
|
|
|
2939
2941
|
if (!s.access_token) throw Error("Token endpoint did not return an access_token");
|
|
2940
2942
|
return ["Authorization", `${s.token_type ? `${s.token_type[0].toUpperCase()}${s.token_type.slice(1).toLowerCase()}` : "Bearer"} ${s.access_token}`];
|
|
2941
2943
|
}, zi = ({ open: e, onOpenChange: t, onAuthorize: n }) => {
|
|
2942
|
-
let [r, i] = V({}), [a, o] = V(!1), { document: s, baseUrl: c } =
|
|
2944
|
+
let [r, i] = V({}), [a, o] = V(!1), { document: s, baseUrl: c } = Zr(), l = X(), u = B(() => s ? qr(s) : [], [s]), d = (e, t) => t ? `${e}:${t}` : e;
|
|
2943
2945
|
return z(() => {
|
|
2944
2946
|
e && i({});
|
|
2945
2947
|
}, [e]), /* @__PURE__ */ U(v, {
|
|
@@ -3141,7 +3143,7 @@ var ni = (e) => He(ti((t) => {
|
|
|
3141
3143
|
})
|
|
3142
3144
|
});
|
|
3143
3145
|
}, Wi = ({ open: e, onOpenChange: t }) => {
|
|
3144
|
-
let [n, r] = V("url"), [i, a] = V(""), [o, s] = V(""), [c, l] = V(""), [u, d] = V(!1), { document: f, baseUrlOverride: p, lastSourceInput: m, setDocument: h, setBaseUrlOverride: g, setLastSourceInput: _ } =
|
|
3146
|
+
let [n, r] = V("url"), [i, a] = V(""), [o, s] = V(""), [c, l] = V(""), [u, d] = V(!1), { document: f, baseUrlOverride: p, lastSourceInput: m, setDocument: h, setBaseUrlOverride: g, setLastSourceInput: _ } = Zr(), y = X();
|
|
3145
3147
|
return z(() => {
|
|
3146
3148
|
e && (l(p), m ? (r(m.mode), a(m.mode === "url" ? m.value : ""), s(m.mode === "json" ? m.value : "")) : (r("url"), a(""), s("")));
|
|
3147
3149
|
}, [
|
|
@@ -3233,7 +3235,7 @@ var ni = (e) => He(ti((t) => {
|
|
|
3233
3235
|
}
|
|
3234
3236
|
d(!0);
|
|
3235
3237
|
try {
|
|
3236
|
-
h(await
|
|
3238
|
+
h(await Wr(e)), g(c.trim()), _({
|
|
3237
3239
|
mode: n,
|
|
3238
3240
|
value: e
|
|
3239
3241
|
}), J.success(y("editor.openApiDialog.loadSuccess")), t(!1);
|
|
@@ -3527,7 +3529,7 @@ var ea = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
3527
3529
|
it: "it",
|
|
3528
3530
|
pt: "pt"
|
|
3529
3531
|
}, sa = dr(), ca = ({ onExportJson: e, onSave: t, extraMenuItems: n, onAuthorize: r, headers: i, onHeadersChange: a }) => {
|
|
3530
|
-
let [o, s] = V(!1), [c, l] = V(!1), [u, d] = V(!1), [f, p] = V(!1), { flowId: m, setFlowId: h, aiConfig: g, language: _, setLanguage: v } = Y(), { document: y } =
|
|
3532
|
+
let [o, s] = V(!1), [c, l] = V(!1), [u, d] = V(!1), [f, p] = V(!1), { flowId: m, setFlowId: h, aiConfig: g, language: _, setLanguage: v } = Y(), { document: y } = Zr(), { setNodes: ee, setEdges: te, addNodes: b, screenToFlowPosition: x } = Ve(), S = Object.keys(i ?? {}).length > 0, C = m || sa, w = ze(), T = Re(), E = Xe(null), D = !!y && !f, O = X(), ne = () => {
|
|
3531
3533
|
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 = x({
|
|
3532
3534
|
x: e - n,
|
|
3533
3535
|
y: t - r
|
|
@@ -4016,7 +4018,7 @@ var ea = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4016
4018
|
for (let [e, t] of Object.entries(r)) if (i.push(e), typeof t == "object" && t && !Array.isArray(t)) for (let n of Object.keys(t)) i.push(`${e}.${n}`);
|
|
4017
4019
|
return i;
|
|
4018
4020
|
}, xa = ({ request: e, mapping: r, onMappingChange: i, showOptionalFields: a = !1 }) => {
|
|
4019
|
-
let [o, s] = V(!1), [u, d] = V([]), [f, p] = V(null), { headers: m } = Y(), { baseUrl: h } =
|
|
4021
|
+
let [o, s] = V(!1), [u, d] = V([]), [f, p] = V(null), { headers: m } = Y(), { baseUrl: h } = Zr(), { url: g, method: _ = "GET", headers: v, queryParams: y, body: ee, responsePath: te = "" } = e, b = X(), C = B(() => u.map((e) => ({
|
|
4020
4022
|
label: e,
|
|
4021
4023
|
value: e
|
|
4022
4024
|
})), [u]), T = B(() => {
|
|
@@ -4143,7 +4145,7 @@ var ea = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4143
4145
|
POST: "tg:bg-green-500/15 tg:text-green-700 dark:tg:text-green-300",
|
|
4144
4146
|
PUT: "tg:bg-amber-500/15 tg:text-amber-700 dark:tg:text-amber-300"
|
|
4145
4147
|
}, wa = /^(https?:)?\/\//i, Ta = ({ value: e, onChange: t, placeholder: n, children: r, ...i }) => {
|
|
4146
|
-
let [a, o] = V(!1), { baseUrl: s, routes: c } =
|
|
4148
|
+
let [a, o] = V(!1), { baseUrl: s, routes: c } = Zr(), l = X(), u = (e, n) => {
|
|
4147
4149
|
t(e.startsWith("/") ? e : `/${e}`, n), o(!1);
|
|
4148
4150
|
}, d = !!s && e.startsWith(s), f = !!s && (d || !wa.test(e)), p = () => {
|
|
4149
4151
|
if (d) {
|
|
@@ -4844,7 +4846,7 @@ var ea = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4844
4846
|
]
|
|
4845
4847
|
});
|
|
4846
4848
|
}, ja = "#/components/schemas/", Ma = (e, t) => {
|
|
4847
|
-
let n =
|
|
4849
|
+
let n = Kr(e), r = n && t.startsWith(n) ? t.slice(n.length) : t;
|
|
4848
4850
|
return r.startsWith("/") ? r : `/${r}`;
|
|
4849
4851
|
}, Na = (e, t) => t.startsWith(ja) ? e.components?.schemas?.[t.slice(21)] : void 0, Pa = (e, t, n) => {
|
|
4850
4852
|
if (!t) return;
|
|
@@ -4877,7 +4879,7 @@ var ea = ({ aiConfig: e, onGenerate: t }) => {
|
|
|
4877
4879
|
"PUT",
|
|
4878
4880
|
"PATCH"
|
|
4879
4881
|
], La = ({ value: e, onChange: t }) => {
|
|
4880
|
-
let [n, r] = V("en"), { selectedNode: i } = Sr(), a = X(), o = jn(i?.id), { document: s } =
|
|
4882
|
+
let [n, r] = V("en"), { selectedNode: i } = Sr(), a = X(), o = jn(i?.id), { document: s } = Zr(), { Field: c, Subscribe: l, setFieldValue: u } = Ze({
|
|
4881
4883
|
defaultValues: {
|
|
4882
4884
|
errorMessage: e?.errorMessage || { en: "" },
|
|
4883
4885
|
headers: Bi(e?.headers),
|
|
@@ -5378,7 +5380,7 @@ function Ua({ ...e }) {
|
|
|
5378
5380
|
//#endregion
|
|
5379
5381
|
//#region src/editor/features/TreegeEditor/forms/InputNodeForm.tsx
|
|
5380
5382
|
var Wa = (e) => Object.values(oa).includes(e), Ga = () => {
|
|
5381
|
-
let { language: e } = Y(), [t, n] = V(Wa(e) ? e : "en"), { selectedNode: r } = Sr(), { updateSelectedNodeData: i } = $(), a =
|
|
5383
|
+
let { language: e } = Y(), [t, n] = V(Wa(e) ? e : "en"), { selectedNode: r } = Sr(), { updateSelectedNodeData: i } = $(), a = ti(r?.data), o = jn(r?.id), s = X(), c = r?.data?.type === "submit", l = r?.data?.type === "hidden", { handleSubmit: u, Field: d, Subscribe: f } = Ze({
|
|
5382
5384
|
defaultValues: {
|
|
5383
5385
|
defaultValue: r?.data?.defaultValue,
|
|
5384
5386
|
disablePast: r?.data?.disablePast,
|
|
@@ -5622,7 +5624,7 @@ var Wa = (e) => Object.values(oa).includes(e), Ga = () => {
|
|
|
5622
5624
|
children: [
|
|
5623
5625
|
/* @__PURE__ */ U(d, {
|
|
5624
5626
|
name: `options[${r}].image`,
|
|
5625
|
-
children: (e) => /* @__PURE__ */ U(
|
|
5627
|
+
children: (e) => /* @__PURE__ */ U(ei, {
|
|
5626
5628
|
value: e.state.value,
|
|
5627
5629
|
onChange: (t) => e.handleChange(t)
|
|
5628
5630
|
})
|
|
@@ -6328,7 +6330,7 @@ var io = () => {
|
|
|
6328
6330
|
colorMode: r,
|
|
6329
6331
|
selectNodesOnDrag: !1,
|
|
6330
6332
|
nodesDraggable: !1,
|
|
6331
|
-
nodeTypes:
|
|
6333
|
+
nodeTypes: Ci,
|
|
6332
6334
|
edgeTypes: Kn,
|
|
6333
6335
|
defaultEdges: e?.edges || [],
|
|
6334
6336
|
defaultNodes: e?.nodes || [],
|
|
@@ -6386,7 +6388,7 @@ var io = () => {
|
|
|
6386
6388
|
language: v,
|
|
6387
6389
|
setLanguage: y
|
|
6388
6390
|
},
|
|
6389
|
-
children: /* @__PURE__ */ U(
|
|
6391
|
+
children: /* @__PURE__ */ U(Xr, {
|
|
6390
6392
|
initialDocument: o,
|
|
6391
6393
|
initialBaseUrl: s,
|
|
6392
6394
|
children: /* @__PURE__ */ U(Pe, { children: /* @__PURE__ */ U(lo, {
|
package/dist/editor.js
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./editor-
|
|
1
|
+
import { t as e } from "./editor-Dy_Ul5Mu.js";
|
|
2
2
|
import { A as t, B as n, I as r, L as i, R as a, a as o, c as s, g as c, h as l, i as u, k as d, l as f, m as p, n as m, o as h, r as g, s as _, t as v, z as y } from "./ThemeContext-BGeTYtnw.js";
|
|
3
3
|
import { C as b, S as x, _ as S, a as C, b as w, c as T, d as E, g as D, h as O, i as k, m as A, n as j, o as M, r as N, u as P, v as F, x as I, y as L } from "./DefaultSubmitButton-C_141kVj.js";
|
|
4
4
|
import { a as R, c as z, i as B, l as V, n as H, o as U, r as W, s as G } from "./useRenderNode-eqCek6JX.js";
|