treege 3.0.0-beta.26 → 3.0.0-beta.27
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/README.md +188 -24
- package/dist/ThemeContext-Cc71SvqK.js +410 -0
- package/dist/{TreegeEditor-WqTXkYl3.js → TreegeEditor-PuRxHufZ.js} +198 -197
- package/dist/TreegeRenderer-COBf5Nh3.js +1047 -0
- package/dist/editor.js +2 -2
- package/dist/main.js +54 -52
- package/dist/node-gfy3ym4p.js +340 -0
- package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +20 -11
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +26 -15
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +81 -23
- package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
- package/dist/renderer/hooks/useRenderNode.d.ts +55 -0
- package/dist/renderer/index.d.ts +1 -0
- package/dist/renderer/index.native.d.ts +19 -0
- package/dist/renderer/types/renderer.d.ts +20 -4
- package/dist/renderer/utils/sanitize.native.d.ts +69 -0
- package/dist/renderer/utils/submit.d.ts +1 -1
- package/dist/renderer-native.d.ts +2 -0
- package/dist/renderer-native.js +2979 -0
- package/dist/renderer.js +49 -47
- package/dist/shared/locales/ar.json.d.ts +13 -5
- package/dist/shared/locales/de.json.d.ts +13 -5
- package/dist/shared/locales/en.json.d.ts +13 -5
- package/dist/shared/locales/es.json.d.ts +13 -5
- package/dist/shared/locales/fr.json.d.ts +13 -5
- package/dist/shared/locales/it.json.d.ts +13 -5
- package/dist/shared/locales/pt.json.d.ts +13 -5
- package/dist/shared/types/node.d.ts +2 -2
- package/dist/useRenderNode-B9cpomOv.js +863 -0
- package/package.json +24 -1
- package/dist/ThemeContext-BIT4DHqC.js +0 -764
- package/dist/TreegeRenderer-BSR_ez96.js +0 -1812
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
import { createContext as de, useContext as fe, useState as H, useMemo as R, useCallback as V, useRef as Q, useEffect as B, Fragment as Fe } from "react";
|
|
2
|
+
import { j as U, i as v, g as j, L as Z, b as pe, u as Se, N as G, a as Ae, c as Re } from "./node-gfy3ym4p.js";
|
|
3
|
+
import oe from "dompurify";
|
|
4
|
+
const ge = de(void 0), Oe = () => fe(ge), tt = ({
|
|
5
|
+
children: e,
|
|
6
|
+
components: t,
|
|
7
|
+
googleApiKey: s,
|
|
8
|
+
language: r,
|
|
9
|
+
theme: n,
|
|
10
|
+
validationMode: a
|
|
11
|
+
}) => {
|
|
12
|
+
const o = {
|
|
13
|
+
components: t,
|
|
14
|
+
googleApiKey: s,
|
|
15
|
+
language: r,
|
|
16
|
+
theme: n,
|
|
17
|
+
validationMode: a
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ U.jsx(ge.Provider, { value: o, children: e });
|
|
20
|
+
}, xe = (e) => e.filter(v), se = (e) => {
|
|
21
|
+
if (e.data.name)
|
|
22
|
+
return e.data.name;
|
|
23
|
+
if (e.data.label) {
|
|
24
|
+
if (e.data.label.en)
|
|
25
|
+
return e.data.label.en;
|
|
26
|
+
const t = Object.values(e.data.label).find(Boolean);
|
|
27
|
+
if (t)
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
return e.id;
|
|
31
|
+
}, rt = (e, t) => {
|
|
32
|
+
const s = t.find((r) => r.id === e);
|
|
33
|
+
return s ? se(s) : void 0;
|
|
34
|
+
}, ee = (e) => e == null || typeof e == "string" && e.trim() === "" ? !0 : Array.isArray(e) && e.length === 0, ve = (e, t) => {
|
|
35
|
+
if (!e)
|
|
36
|
+
return !1;
|
|
37
|
+
const s = t[e];
|
|
38
|
+
return s != null;
|
|
39
|
+
}, me = (e, t) => {
|
|
40
|
+
const s = {};
|
|
41
|
+
return t.forEach((r) => {
|
|
42
|
+
const n = r.id, a = se(r);
|
|
43
|
+
e[n] !== void 0 && (s[a] = e[n]);
|
|
44
|
+
}), s;
|
|
45
|
+
}, ae = (e, t, s) => {
|
|
46
|
+
if (!t)
|
|
47
|
+
return e;
|
|
48
|
+
switch (t) {
|
|
49
|
+
case "toString":
|
|
50
|
+
return String(e);
|
|
51
|
+
case "toNumber":
|
|
52
|
+
return Number(e);
|
|
53
|
+
case "toBoolean":
|
|
54
|
+
if (typeof e == "string") {
|
|
55
|
+
const r = e.trim().toLowerCase();
|
|
56
|
+
if (["true", "1", "yes", "on"].includes(r))
|
|
57
|
+
return !0;
|
|
58
|
+
if (["false", "0", "no", "off", ""].includes(r))
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
return typeof e == "number" ? e !== 0 : typeof e == "boolean" ? e : !!e;
|
|
62
|
+
case "toArray":
|
|
63
|
+
return Array.isArray(e) ? e : [e];
|
|
64
|
+
case "toObject":
|
|
65
|
+
if (s && Array.isArray(s)) {
|
|
66
|
+
if (typeof e != "object" || e === null)
|
|
67
|
+
return e;
|
|
68
|
+
const r = {};
|
|
69
|
+
return s.forEach((n) => {
|
|
70
|
+
n.sourceKey && n.targetKey && (r[n.targetKey] = e[n.sourceKey]);
|
|
71
|
+
}), r;
|
|
72
|
+
}
|
|
73
|
+
return e;
|
|
74
|
+
default:
|
|
75
|
+
return e;
|
|
76
|
+
}
|
|
77
|
+
}, ie = (e, t) => {
|
|
78
|
+
if (Object.is(e, t))
|
|
79
|
+
return !0;
|
|
80
|
+
if (!(e && t) || typeof e != "object" || typeof t != "object")
|
|
81
|
+
return !1;
|
|
82
|
+
try {
|
|
83
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
84
|
+
} catch {
|
|
85
|
+
return !1;
|
|
86
|
+
}
|
|
87
|
+
}, Ce = (e, t, s) => {
|
|
88
|
+
const r = {};
|
|
89
|
+
return e.forEach((n) => {
|
|
90
|
+
const { defaultValue: a } = n.data;
|
|
91
|
+
if (!a || a.type !== "reference" || !a.referenceField)
|
|
92
|
+
return;
|
|
93
|
+
const o = n.id, { referenceField: i, transformFunction: c, objectMapping: g } = a, f = t[i], p = s[i];
|
|
94
|
+
if (f === p || f === void 0 || f === null)
|
|
95
|
+
return;
|
|
96
|
+
const u = ae(f, c, g), d = ae(p, c, g), y = t[o], l = ie(y, d), w = ie(y, u);
|
|
97
|
+
!l || w || (r[o] = u);
|
|
98
|
+
}), r;
|
|
99
|
+
}, Me = ["b", "i", "em", "strong", "u", "br", "p", "span"], Ie = ["class"], L = (e, t = {}) => {
|
|
100
|
+
if (e == null || e === "")
|
|
101
|
+
return "";
|
|
102
|
+
const s = String(e), { plainTextOnly: r = !0, allowedTags: n, allowedAttributes: a } = t;
|
|
103
|
+
if (r)
|
|
104
|
+
return oe.sanitize(s, {
|
|
105
|
+
ALLOWED_ATTR: [],
|
|
106
|
+
ALLOWED_TAGS: []
|
|
107
|
+
});
|
|
108
|
+
const o = n ?? Me, i = a ?? Ie;
|
|
109
|
+
return oe.sanitize(s, {
|
|
110
|
+
// Additional security options
|
|
111
|
+
ALLOW_DATA_ATTR: !1,
|
|
112
|
+
// Prevent data-* attributes
|
|
113
|
+
ALLOW_UNKNOWN_PROTOCOLS: !1,
|
|
114
|
+
// Only allow http, https, mailto, etc.
|
|
115
|
+
ALLOWED_ATTR: i,
|
|
116
|
+
ALLOWED_TAGS: o,
|
|
117
|
+
FORBID_ATTR: ["style"],
|
|
118
|
+
// Prevent inline styles
|
|
119
|
+
FORBID_TAGS: ["style", "script"],
|
|
120
|
+
// Explicitly forbid these
|
|
121
|
+
KEEP_CONTENT: !0,
|
|
122
|
+
// Keep text content when removing tags
|
|
123
|
+
RETURN_DOM: !1,
|
|
124
|
+
// Return string, not DOM
|
|
125
|
+
RETURN_DOM_FRAGMENT: !1
|
|
126
|
+
// Return string, not DOM fragment
|
|
127
|
+
});
|
|
128
|
+
}, ce = 100, ue = (e, t = {}, s = 0, r = /* @__PURE__ */ new WeakSet()) => {
|
|
129
|
+
if (s > ce)
|
|
130
|
+
return console.warn(`sanitizeHttpResponse: Maximum depth (${ce}) exceeded.`), typeof e == "string" ? L(e, t) : "[Max Depth Exceeded]";
|
|
131
|
+
if (e == null)
|
|
132
|
+
return e;
|
|
133
|
+
if (typeof e == "string")
|
|
134
|
+
return L(e, t);
|
|
135
|
+
if (Array.isArray(e))
|
|
136
|
+
return e.map((n) => ue(n, t, s + 1, r));
|
|
137
|
+
if (typeof e == "object") {
|
|
138
|
+
if (r.has(e))
|
|
139
|
+
return console.warn("sanitizeHttpResponse: Circular reference detected. Breaking cycle to prevent infinite recursion."), "[Circular Reference]";
|
|
140
|
+
r.add(e);
|
|
141
|
+
const n = {};
|
|
142
|
+
for (const [a, o] of Object.entries(e))
|
|
143
|
+
n[a] = ue(o, t, s + 1, r);
|
|
144
|
+
return r.delete(e), n;
|
|
145
|
+
}
|
|
146
|
+
return e;
|
|
147
|
+
}, _e = async (e) => {
|
|
148
|
+
try {
|
|
149
|
+
const { url: t, method: s = "GET", headers: r = [], body: n } = e;
|
|
150
|
+
if (!t || t.trim() === "")
|
|
151
|
+
return {
|
|
152
|
+
error: "No URL provided",
|
|
153
|
+
success: !1
|
|
154
|
+
};
|
|
155
|
+
const a = {
|
|
156
|
+
"Content-Type": "application/json"
|
|
157
|
+
};
|
|
158
|
+
r.forEach((f) => {
|
|
159
|
+
f.key && f.value && (a[f.key] = f.value);
|
|
160
|
+
});
|
|
161
|
+
const o = {
|
|
162
|
+
headers: a,
|
|
163
|
+
method: s
|
|
164
|
+
};
|
|
165
|
+
n && s && ["POST", "PUT", "PATCH"].includes(s) && (o.body = n);
|
|
166
|
+
const i = await fetch(t, o);
|
|
167
|
+
let c;
|
|
168
|
+
return i.headers.get("content-type")?.includes("application/json") ? c = await i.json() : c = await i.text(), i.ok ? {
|
|
169
|
+
data: c,
|
|
170
|
+
status: i.status,
|
|
171
|
+
statusText: i.statusText,
|
|
172
|
+
success: !0
|
|
173
|
+
} : {
|
|
174
|
+
data: c,
|
|
175
|
+
error: `HTTP ${i.status}: ${i.statusText}`,
|
|
176
|
+
status: i.status,
|
|
177
|
+
statusText: i.statusText,
|
|
178
|
+
success: !1
|
|
179
|
+
};
|
|
180
|
+
} catch (t) {
|
|
181
|
+
return {
|
|
182
|
+
error: t instanceof Error ? t.message : "An unknown error occurred",
|
|
183
|
+
success: !1
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}, te = (e, t, s = {}) => {
|
|
187
|
+
if (!e)
|
|
188
|
+
return "";
|
|
189
|
+
const { encode: r = !1, json: n = !1 } = s;
|
|
190
|
+
return e.replace(/\{\{([\w-]+)}}/g, (a, o) => {
|
|
191
|
+
const i = t[o.trim()];
|
|
192
|
+
if (i == null)
|
|
193
|
+
return n ? "null" : "";
|
|
194
|
+
const c = typeof i == "string" ? L(i) : i;
|
|
195
|
+
if (r)
|
|
196
|
+
return encodeURIComponent(String(c));
|
|
197
|
+
if (n) {
|
|
198
|
+
if (typeof c == "string")
|
|
199
|
+
return `"${c.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
200
|
+
if (typeof c == "number" || typeof c == "boolean")
|
|
201
|
+
return String(c);
|
|
202
|
+
if (typeof c == "object")
|
|
203
|
+
return JSON.stringify(c);
|
|
204
|
+
}
|
|
205
|
+
return String(c);
|
|
206
|
+
});
|
|
207
|
+
}, Ve = (e, t) => e ? e.replace(/\{\{response\.([\w.-]+)}}/g, (s, r) => {
|
|
208
|
+
const n = Le(t, r.trim());
|
|
209
|
+
return n != null ? String(n) : "";
|
|
210
|
+
}) : "", Le = (e, t) => {
|
|
211
|
+
if (!(!e || typeof e != "object"))
|
|
212
|
+
return t.split(".").reduce((s, r) => {
|
|
213
|
+
if (!(s == null || typeof s != "object"))
|
|
214
|
+
return s[r];
|
|
215
|
+
}, e);
|
|
216
|
+
}, je = async (e, t, s) => {
|
|
217
|
+
if (!e.url || e.url.trim() === "")
|
|
218
|
+
return {
|
|
219
|
+
error: "No URL configured for submission",
|
|
220
|
+
success: !1
|
|
221
|
+
};
|
|
222
|
+
const r = te(e.url, t, { encode: !0 });
|
|
223
|
+
if (!r || r.trim() === "")
|
|
224
|
+
return {
|
|
225
|
+
error: "Invalid URL after template replacement",
|
|
226
|
+
success: !1
|
|
227
|
+
};
|
|
228
|
+
const n = e.headers?.map((c) => ({
|
|
229
|
+
key: c.key,
|
|
230
|
+
value: te(c.value, t)
|
|
231
|
+
})), a = e.sendAllFormValues ? JSON.stringify(me(t, s)) : e.body ? te(e.body, t, { json: !0 }) : void 0, o = await _e({
|
|
232
|
+
body: a,
|
|
233
|
+
headers: n,
|
|
234
|
+
method: e.method || "POST",
|
|
235
|
+
url: r
|
|
236
|
+
});
|
|
237
|
+
if (!o.success)
|
|
238
|
+
return {
|
|
239
|
+
data: o.data,
|
|
240
|
+
error: o.error,
|
|
241
|
+
success: !1
|
|
242
|
+
};
|
|
243
|
+
const i = e.redirectUrl ? (() => {
|
|
244
|
+
const c = Ve(e.redirectUrl, o.data);
|
|
245
|
+
return c && c.trim() !== "" ? c : void 0;
|
|
246
|
+
})() : void 0;
|
|
247
|
+
return {
|
|
248
|
+
data: o.data,
|
|
249
|
+
redirectUrl: i,
|
|
250
|
+
success: !0
|
|
251
|
+
};
|
|
252
|
+
}, Pe = (e) => {
|
|
253
|
+
if (!e)
|
|
254
|
+
return;
|
|
255
|
+
e.startsWith("http://") || e.startsWith("https://") ? window.location.href = e : window.history?.pushState ? (window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate"))) : window.location.href = e;
|
|
256
|
+
}, ke = (e, t, s, r) => {
|
|
257
|
+
const [n, a] = H(!1), [o, i] = H(null), c = R(() => {
|
|
258
|
+
const p = e.find((u) => v(u) && u.data?.type === "submit");
|
|
259
|
+
return p && v(p) ? p : null;
|
|
260
|
+
}, [e]), g = V(
|
|
261
|
+
async (p) => {
|
|
262
|
+
if (!c?.data?.submitConfig)
|
|
263
|
+
return null;
|
|
264
|
+
const u = c.data.submitConfig;
|
|
265
|
+
if (!u.url || u.url.trim() === "")
|
|
266
|
+
return null;
|
|
267
|
+
i(null), u.showLoading !== !1 && a(!0);
|
|
268
|
+
try {
|
|
269
|
+
const d = await je(u, t, r);
|
|
270
|
+
if (d.success) {
|
|
271
|
+
const y = j(u.successMessage, s);
|
|
272
|
+
if (y && i({ message: y, type: "success" }), p && p(d.data), d.redirectUrl) {
|
|
273
|
+
const l = d.redirectUrl;
|
|
274
|
+
setTimeout(() => Pe(l), 1e3);
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
const y = j(u.errorMessage, s) || d.error || "An error occurred during submission";
|
|
278
|
+
i({ message: y, type: "error" });
|
|
279
|
+
}
|
|
280
|
+
return d;
|
|
281
|
+
} catch (d) {
|
|
282
|
+
const y = j(u.errorMessage, s) || (d instanceof Error ? d.message : "An unexpected error occurred");
|
|
283
|
+
return i({ message: y, type: "error" }), {
|
|
284
|
+
error: y,
|
|
285
|
+
success: !1
|
|
286
|
+
};
|
|
287
|
+
} finally {
|
|
288
|
+
a(!1);
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
[c, t, s, r]
|
|
292
|
+
);
|
|
293
|
+
return {
|
|
294
|
+
clearSubmitMessage: V(() => {
|
|
295
|
+
i(null);
|
|
296
|
+
}, []),
|
|
297
|
+
handleSubmitWithConfig: g,
|
|
298
|
+
hasSubmitConfig: !!c?.data?.submitConfig,
|
|
299
|
+
isSubmitting: n,
|
|
300
|
+
submitButtonNode: c,
|
|
301
|
+
submitMessage: o
|
|
302
|
+
};
|
|
303
|
+
}, le = (e) => e == null ? null : typeof e == "boolean" || typeof e == "number" ? e : typeof e == "string" ? e === "" ? null : e : typeof e == "object" ? JSON.stringify(e) : String(e), De = (e, t, s) => {
|
|
304
|
+
const r = le(e), n = le(t);
|
|
305
|
+
if (r === null || n === null)
|
|
306
|
+
switch (s) {
|
|
307
|
+
case "===":
|
|
308
|
+
return r === n;
|
|
309
|
+
case "!==":
|
|
310
|
+
return r !== n;
|
|
311
|
+
default:
|
|
312
|
+
return !1;
|
|
313
|
+
}
|
|
314
|
+
if ([">", "<", ">=", "<="].includes(s)) {
|
|
315
|
+
const a = Number(r), o = Number(n);
|
|
316
|
+
if (!(Number.isNaN(a) || Number.isNaN(o)))
|
|
317
|
+
switch (s) {
|
|
318
|
+
case ">":
|
|
319
|
+
return a > o;
|
|
320
|
+
case "<":
|
|
321
|
+
return a < o;
|
|
322
|
+
case ">=":
|
|
323
|
+
return a >= o;
|
|
324
|
+
case "<=":
|
|
325
|
+
return a <= o;
|
|
326
|
+
default:
|
|
327
|
+
return !1;
|
|
328
|
+
}
|
|
329
|
+
return !1;
|
|
330
|
+
}
|
|
331
|
+
switch (s) {
|
|
332
|
+
case "===": {
|
|
333
|
+
const a = Number(r), o = Number(n);
|
|
334
|
+
return Number.isNaN(a) || Number.isNaN(o) ? String(r) === String(n) : a === o;
|
|
335
|
+
}
|
|
336
|
+
case "!==": {
|
|
337
|
+
const a = Number(r), o = Number(n);
|
|
338
|
+
return Number.isNaN(a) || Number.isNaN(o) ? String(r) !== String(n) : a !== o;
|
|
339
|
+
}
|
|
340
|
+
default:
|
|
341
|
+
return !1;
|
|
342
|
+
}
|
|
343
|
+
}, re = (e, t, s) => {
|
|
344
|
+
const { field: r, operator: n, value: a } = e;
|
|
345
|
+
if (!(r && n) || a === void 0)
|
|
346
|
+
return !0;
|
|
347
|
+
let o = t[r];
|
|
348
|
+
if (o === void 0 && s) {
|
|
349
|
+
const i = s.get(r);
|
|
350
|
+
i && v(i) && (o = t[i.id]);
|
|
351
|
+
}
|
|
352
|
+
return De(o, a, n);
|
|
353
|
+
}, Be = (e, t, s) => {
|
|
354
|
+
if (!e || e.length === 0)
|
|
355
|
+
return !0;
|
|
356
|
+
if (e.length === 1)
|
|
357
|
+
return re(e[0], t, s);
|
|
358
|
+
let r = re(e[0], t, s);
|
|
359
|
+
for (let n = 1; n < e.length; n += 1) {
|
|
360
|
+
const a = e[n], o = re(a, t, s), i = e[n - 1].logicalOperator || Z.AND;
|
|
361
|
+
if (i === Z.AND) {
|
|
362
|
+
if (r = r && o, !r)
|
|
363
|
+
return !1;
|
|
364
|
+
} else if (i === Z.OR && (r = r || o, r))
|
|
365
|
+
return !0;
|
|
366
|
+
}
|
|
367
|
+
return r;
|
|
368
|
+
}, Ue = (e) => {
|
|
369
|
+
const t = /* @__PURE__ */ new Map();
|
|
370
|
+
return e.forEach((s) => {
|
|
371
|
+
const r = t.get(s.source);
|
|
372
|
+
r ? r.push(s) : t.set(s.source, [s]);
|
|
373
|
+
}), t;
|
|
374
|
+
}, We = (e, t, s) => {
|
|
375
|
+
const r = [], n = [], a = [];
|
|
376
|
+
e.forEach((g) => {
|
|
377
|
+
const f = g.data?.isFallback, p = g.data?.conditions?.length;
|
|
378
|
+
f ? a.push(g) : p ? n.push(g) : r.push(g);
|
|
379
|
+
});
|
|
380
|
+
const o = [...r];
|
|
381
|
+
if (n.length === 0)
|
|
382
|
+
return a.length > 0 && o.length === 0 && o.push(...a), { edgesToFollow: o, waitingForInput: !1 };
|
|
383
|
+
if (!n.every((g) => {
|
|
384
|
+
const f = g.data?.conditions;
|
|
385
|
+
return f ? f.every((p) => {
|
|
386
|
+
if (!p.field)
|
|
387
|
+
return !0;
|
|
388
|
+
const u = s.get(p.field), d = v(u) ? u.id : p.field;
|
|
389
|
+
return ve(d, t);
|
|
390
|
+
}) : !1;
|
|
391
|
+
}))
|
|
392
|
+
return a.length > 0 && o.push(...a), { edgesToFollow: o, waitingForInput: o.length === 0 };
|
|
393
|
+
const c = n.filter((g) => Be(g.data?.conditions, t, s));
|
|
394
|
+
return c.length > 0 ? (o.push(...c), { edgesToFollow: o, waitingForInput: !1 }) : (o.push(...a), { edgesToFollow: o, waitingForInput: !1 });
|
|
395
|
+
}, $e = (e, t) => !t.some((s) => s.target === e), ze = (e, t) => {
|
|
396
|
+
const s = e.filter((r) => $e(r.id, t));
|
|
397
|
+
return s.find(v) || s[0];
|
|
398
|
+
}, Ge = (e, t, s, r) => {
|
|
399
|
+
e.forEach((n) => {
|
|
400
|
+
const a = r.get(n);
|
|
401
|
+
if (!a)
|
|
402
|
+
return;
|
|
403
|
+
let { parentId: o } = a;
|
|
404
|
+
const i = /* @__PURE__ */ new Set();
|
|
405
|
+
for (; o && !i.has(o); ) {
|
|
406
|
+
if (i.add(o), t.add(o), !s.has(o)) {
|
|
407
|
+
const c = s.get(n);
|
|
408
|
+
c !== void 0 && s.set(o, c);
|
|
409
|
+
}
|
|
410
|
+
o = r.get(o)?.parentId;
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}, He = (e, t, s) => {
|
|
414
|
+
const r = ze(e, t);
|
|
415
|
+
if (!r)
|
|
416
|
+
return {
|
|
417
|
+
endOfPathReached: !0,
|
|
418
|
+
visibleNodeIds: /* @__PURE__ */ new Set(),
|
|
419
|
+
visibleNodes: [],
|
|
420
|
+
visibleRootNodes: []
|
|
421
|
+
};
|
|
422
|
+
const n = new Map(e.map((l) => [l.id, l])), a = Ue(t), o = [], i = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
423
|
+
let g = !1;
|
|
424
|
+
const f = (l) => {
|
|
425
|
+
if (c.has(l))
|
|
426
|
+
return;
|
|
427
|
+
c.add(l);
|
|
428
|
+
const w = n.get(l);
|
|
429
|
+
if (!w)
|
|
430
|
+
return;
|
|
431
|
+
i.add(l), o.push(w);
|
|
432
|
+
const b = a.get(l) || [], { edgesToFollow: O, waitingForInput: A } = We(b, s, n);
|
|
433
|
+
if (A) {
|
|
434
|
+
g = !0;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
O.forEach((m) => {
|
|
438
|
+
f(m.target);
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
f(r.id);
|
|
442
|
+
const p = new Map(o.map((l, w) => [l.id, w])), u = new Set(i);
|
|
443
|
+
Ge(i, u, p, n);
|
|
444
|
+
const d = e.filter((l) => u.has(l.id)).sort((l, w) => (p.get(l.id) ?? Number.MAX_SAFE_INTEGER) - (p.get(w.id) ?? Number.MAX_SAFE_INTEGER)), y = d.filter((l) => !(l.parentId && u.has(l.parentId)));
|
|
445
|
+
return {
|
|
446
|
+
endOfPathReached: !g,
|
|
447
|
+
visibleNodeIds: u,
|
|
448
|
+
visibleNodes: d,
|
|
449
|
+
visibleRootNodes: y
|
|
450
|
+
};
|
|
451
|
+
}, Ke = (e) => {
|
|
452
|
+
if (e.length === 1)
|
|
453
|
+
return e[0];
|
|
454
|
+
const t = new Set(e.map((r) => r.id)), s = /* @__PURE__ */ new Set();
|
|
455
|
+
return e.forEach((r) => {
|
|
456
|
+
r.nodes.forEach((n) => {
|
|
457
|
+
if (pe(n)) {
|
|
458
|
+
const a = n.data.targetId;
|
|
459
|
+
a && t.has(a) && s.add(a);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}), e.find((r) => !s.has(r.id)) || e[0];
|
|
463
|
+
}, he = (e, t, s, r, n = /* @__PURE__ */ new Set()) => {
|
|
464
|
+
const a = /* @__PURE__ */ new Set();
|
|
465
|
+
for (const o of e)
|
|
466
|
+
if (s.has(o)) {
|
|
467
|
+
const i = r.get(o), c = i ? t.get(i) : void 0;
|
|
468
|
+
if (c) {
|
|
469
|
+
if (i && n.has(i))
|
|
470
|
+
continue;
|
|
471
|
+
i && n.add(i);
|
|
472
|
+
const g = new Set(c.nodes.map((p) => p.id)), f = he(g, t, s, r, n);
|
|
473
|
+
for (const p of f)
|
|
474
|
+
a.add(p);
|
|
475
|
+
}
|
|
476
|
+
} else
|
|
477
|
+
a.add(o);
|
|
478
|
+
return a;
|
|
479
|
+
}, qe = (e, t) => {
|
|
480
|
+
const s = /* @__PURE__ */ new Set();
|
|
481
|
+
return t.forEach((r) => {
|
|
482
|
+
e.has(r.source) && e.has(r.target) && s.add(r.source);
|
|
483
|
+
}), Array.from(e).filter((r) => !s.has(r));
|
|
484
|
+
}, ye = (e) => {
|
|
485
|
+
if (!e)
|
|
486
|
+
return { edges: [], id: "empty", nodes: [] };
|
|
487
|
+
const t = Array.isArray(e) ? e : [e];
|
|
488
|
+
if (t.length === 0)
|
|
489
|
+
return { edges: [], id: "empty", nodes: [] };
|
|
490
|
+
const s = Ke(t);
|
|
491
|
+
if (t.length === 1)
|
|
492
|
+
return s;
|
|
493
|
+
const r = new Map(t.map((u) => [u.id, u])), n = [], a = [...s.edges], o = /* @__PURE__ */ new Set([s.id]), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), f = (u) => {
|
|
494
|
+
const d = [];
|
|
495
|
+
return u.forEach((y) => {
|
|
496
|
+
if (!pe(y)) {
|
|
497
|
+
d.push(y);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
const l = y.data.targetId;
|
|
501
|
+
if (!l)
|
|
502
|
+
return;
|
|
503
|
+
const w = r.get(l);
|
|
504
|
+
if (!w) {
|
|
505
|
+
console.warn(`Flow with id "${l}" not found`);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const b = w.nodes.find((O) => !O.parentId);
|
|
509
|
+
if (!b) {
|
|
510
|
+
console.warn(`Flow "${l}" has no root node; preserving FlowNode "${y.id}"`), d.push(y);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
i.set(y.id, b.id), c.set(y.id, l), o.has(l) || (o.add(l), a.push(...w.edges), d.push(...f(w.nodes)));
|
|
514
|
+
}), d;
|
|
515
|
+
};
|
|
516
|
+
n.push(...f(s.nodes)), a.forEach((u) => {
|
|
517
|
+
if (i.has(u.source)) {
|
|
518
|
+
const d = g.get(u.source);
|
|
519
|
+
d ? d.push(u) : g.set(u.source, [u]);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
const p = a.map((u) => {
|
|
523
|
+
if (i.has(u.source))
|
|
524
|
+
return null;
|
|
525
|
+
const d = i.get(u.target);
|
|
526
|
+
return d ? { ...u, target: d } : u;
|
|
527
|
+
}).filter((u) => u !== null);
|
|
528
|
+
return i.forEach((u, d) => {
|
|
529
|
+
const y = g.get(d);
|
|
530
|
+
if (!y?.length)
|
|
531
|
+
return;
|
|
532
|
+
const l = c.get(d), w = l ? r.get(l) : void 0;
|
|
533
|
+
if (!w)
|
|
534
|
+
return;
|
|
535
|
+
const b = new Set(w.nodes.map((m) => m.id)), O = he(
|
|
536
|
+
b,
|
|
537
|
+
r,
|
|
538
|
+
i,
|
|
539
|
+
c,
|
|
540
|
+
new Set(l ? [l] : [])
|
|
541
|
+
);
|
|
542
|
+
qe(O, p).forEach((m) => {
|
|
543
|
+
y.forEach((S) => {
|
|
544
|
+
const M = i.get(S.target) ?? S.target, F = S.id ?? `${d}__${S.target}`;
|
|
545
|
+
p.push({
|
|
546
|
+
...S,
|
|
547
|
+
id: `${m}__${F}`,
|
|
548
|
+
source: m,
|
|
549
|
+
target: M
|
|
550
|
+
});
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
}), {
|
|
554
|
+
edges: p,
|
|
555
|
+
id: s.id,
|
|
556
|
+
nodes: n
|
|
557
|
+
};
|
|
558
|
+
}, be = de(null), st = ({ children: e, value: t }) => /* @__PURE__ */ U.jsx(be.Provider, { value: t, children: e }), Je = () => {
|
|
559
|
+
const t = fe(be) ?? {
|
|
560
|
+
flows: null,
|
|
561
|
+
formErrors: {},
|
|
562
|
+
formValues: {},
|
|
563
|
+
googleApiKey: void 0,
|
|
564
|
+
inputNodes: [],
|
|
565
|
+
language: "",
|
|
566
|
+
setFieldValue: () => {
|
|
567
|
+
}
|
|
568
|
+
}, s = R(() => t.flows ? ye(t.flows).edges : [], [t.flows]);
|
|
569
|
+
return {
|
|
570
|
+
...t,
|
|
571
|
+
edges: s
|
|
572
|
+
};
|
|
573
|
+
}, Xe = (e) => {
|
|
574
|
+
const t = Je(), s = e ?? t.language, r = Se(s);
|
|
575
|
+
return R(
|
|
576
|
+
() => (n) => {
|
|
577
|
+
const a = r(n);
|
|
578
|
+
return typeof n == "object" && n !== null ? L(a) : a;
|
|
579
|
+
},
|
|
580
|
+
[r]
|
|
581
|
+
);
|
|
582
|
+
}, nt = ({
|
|
583
|
+
components: e,
|
|
584
|
+
flows: t,
|
|
585
|
+
googleApiKey: s,
|
|
586
|
+
initialValues: r = {},
|
|
587
|
+
language: n,
|
|
588
|
+
onChange: a,
|
|
589
|
+
onSubmit: o,
|
|
590
|
+
theme: i,
|
|
591
|
+
validate: c,
|
|
592
|
+
validationMode: g
|
|
593
|
+
}) => {
|
|
594
|
+
const f = Oe(), p = R(
|
|
595
|
+
() => ({
|
|
596
|
+
components: {
|
|
597
|
+
form: e?.form ?? f?.components?.form,
|
|
598
|
+
group: e?.group ?? f?.components?.group,
|
|
599
|
+
inputs: { ...f?.components?.inputs, ...e?.inputs },
|
|
600
|
+
submitButton: e?.submitButton ?? f?.components?.submitButton,
|
|
601
|
+
submitButtonWrapper: e?.submitButtonWrapper ?? f?.components?.submitButtonWrapper,
|
|
602
|
+
ui: { ...f?.components?.ui, ...e?.ui }
|
|
603
|
+
},
|
|
604
|
+
googleApiKey: s ?? f?.googleApiKey,
|
|
605
|
+
language: n ?? f?.language ?? "en",
|
|
606
|
+
theme: i ?? f?.theme ?? "dark",
|
|
607
|
+
validationMode: g ?? f?.validationMode ?? "onSubmit"
|
|
608
|
+
}),
|
|
609
|
+
[e, f, s, n, i, g]
|
|
610
|
+
), u = R(() => ye(t), [t]), { nodes: d, edges: y } = u, l = R(() => xe(d), [d]), w = Xe(p.language), b = Q({}), [O, A] = H({}), [m, S] = H(() => {
|
|
611
|
+
const h = { ...r };
|
|
612
|
+
return d.forEach((N) => {
|
|
613
|
+
if (v(N)) {
|
|
614
|
+
const T = N.id;
|
|
615
|
+
if (h[T] !== void 0)
|
|
616
|
+
return;
|
|
617
|
+
const { defaultValue: E } = N.data;
|
|
618
|
+
if (!E)
|
|
619
|
+
return;
|
|
620
|
+
if (E.type === "static" && E.staticValue !== void 0 && (h[T] = E.staticValue), E.type === "reference" && E.referenceField) {
|
|
621
|
+
const { referenceField: x } = E, _ = h[x];
|
|
622
|
+
_ !== void 0 && (h[T] = _);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}), h;
|
|
626
|
+
}), { endOfPathReached: M, visibleNodes: F, visibleRootNodes: P } = R(
|
|
627
|
+
() => He(d, y, m),
|
|
628
|
+
[d, y, m]
|
|
629
|
+
), { clearSubmitMessage: K, handleSubmitWithConfig: W, hasSubmitConfig: $, isSubmitting: q, submitMessage: J } = ke(
|
|
630
|
+
F,
|
|
631
|
+
m,
|
|
632
|
+
p.language,
|
|
633
|
+
l
|
|
634
|
+
), z = Q(a), k = Q(c), C = R(() => me(m, l), [m, l]), X = V((h, N) => {
|
|
635
|
+
S((T) => ({
|
|
636
|
+
...T,
|
|
637
|
+
[h]: N
|
|
638
|
+
})), A((T) => {
|
|
639
|
+
const E = { ...T };
|
|
640
|
+
return delete E[h], E;
|
|
641
|
+
});
|
|
642
|
+
}, []), D = V((h) => {
|
|
643
|
+
Object.keys(h).length !== 0 && (S((N) => ({
|
|
644
|
+
...N,
|
|
645
|
+
...h
|
|
646
|
+
})), A((N) => {
|
|
647
|
+
const T = { ...N };
|
|
648
|
+
return Object.keys(h).forEach((E) => {
|
|
649
|
+
delete T[E];
|
|
650
|
+
}), T;
|
|
651
|
+
}));
|
|
652
|
+
}, []), I = V(
|
|
653
|
+
(h) => {
|
|
654
|
+
const N = {};
|
|
655
|
+
F.forEach((x) => {
|
|
656
|
+
if (v(x)) {
|
|
657
|
+
const _ = x.id, Y = m[_];
|
|
658
|
+
if (x.data.required && ee(Y)) {
|
|
659
|
+
N[_] = w(x.data.errorMessage) || w("validation.required");
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
if (!ee(Y) && x.data.pattern)
|
|
663
|
+
try {
|
|
664
|
+
new RegExp(x.data.pattern).test(String(Y)) || (N[_] = w(x.data.errorMessage) || w("validation.invalidFormat"));
|
|
665
|
+
} catch (ne) {
|
|
666
|
+
console.error(`Invalid pattern for field ${_}:`, ne);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
const T = h ? h(m, F) : {}, E = {
|
|
671
|
+
...N,
|
|
672
|
+
...T
|
|
673
|
+
};
|
|
674
|
+
return A(E), {
|
|
675
|
+
errors: E,
|
|
676
|
+
hasCustomErrors: Object.keys(T).length > 0,
|
|
677
|
+
isValid: Object.keys(E).length === 0
|
|
678
|
+
};
|
|
679
|
+
},
|
|
680
|
+
[F, m, w]
|
|
681
|
+
), we = V(async () => {
|
|
682
|
+
const { isValid: h } = I(k.current);
|
|
683
|
+
if (!h)
|
|
684
|
+
return !1;
|
|
685
|
+
if ($) {
|
|
686
|
+
const N = await W((T) => {
|
|
687
|
+
o && o(C, { httpResponse: T });
|
|
688
|
+
});
|
|
689
|
+
if (N === null)
|
|
690
|
+
return o?.(C), !0;
|
|
691
|
+
if (!N.success)
|
|
692
|
+
return !0;
|
|
693
|
+
} else o && o(C);
|
|
694
|
+
return !0;
|
|
695
|
+
}, [I, $, W, o, C]), Ne = R(() => {
|
|
696
|
+
const h = [];
|
|
697
|
+
return F.forEach((N) => {
|
|
698
|
+
if (!v(N))
|
|
699
|
+
return;
|
|
700
|
+
const T = N.id, E = m[T];
|
|
701
|
+
if (N.data.required && ee(E)) {
|
|
702
|
+
const x = w(N.data.label) || T;
|
|
703
|
+
h.push(x);
|
|
704
|
+
}
|
|
705
|
+
}), h;
|
|
706
|
+
}, [F, m, w]), Te = R(() => F.some((h) => v(h) && h.data.type === "submit"), [F]), Ee = R(() => {
|
|
707
|
+
const h = Object.keys(O);
|
|
708
|
+
return h.length > 0 ? h[0] : void 0;
|
|
709
|
+
}, [O]);
|
|
710
|
+
return B(() => {
|
|
711
|
+
z.current = a;
|
|
712
|
+
}, [a]), B(() => {
|
|
713
|
+
k.current = c;
|
|
714
|
+
}, [c]), B(() => {
|
|
715
|
+
z.current?.(C);
|
|
716
|
+
}, [C]), B(() => {
|
|
717
|
+
p.validationMode === "onChange" && I(k.current);
|
|
718
|
+
}, [p.validationMode, I]), B(() => {
|
|
719
|
+
const h = Ce(l, m, b.current);
|
|
720
|
+
Object.keys(h).length > 0 && D(h), b.current = m;
|
|
721
|
+
}, [m, l, D]), {
|
|
722
|
+
canSubmit: !Te && M && d.length > 0,
|
|
723
|
+
clearSubmitMessage: K,
|
|
724
|
+
config: p,
|
|
725
|
+
firstErrorFieldId: Ee,
|
|
726
|
+
formErrors: O,
|
|
727
|
+
formValues: m,
|
|
728
|
+
handleSubmit: we,
|
|
729
|
+
inputNodes: l,
|
|
730
|
+
isSubmitting: q,
|
|
731
|
+
mergedFlow: u,
|
|
732
|
+
missingRequiredFields: Ne,
|
|
733
|
+
prevFormValuesRef: b,
|
|
734
|
+
setFieldErrors: A,
|
|
735
|
+
setFieldValue: X,
|
|
736
|
+
setMultipleFieldValues: D,
|
|
737
|
+
submitMessage: J,
|
|
738
|
+
t: w,
|
|
739
|
+
validateForm: I,
|
|
740
|
+
visibleNodes: F,
|
|
741
|
+
visibleRootNodes: P
|
|
742
|
+
};
|
|
743
|
+
}, Ye = (e) => new Promise((t, s) => {
|
|
744
|
+
const r = new FileReader();
|
|
745
|
+
r.onload = () => {
|
|
746
|
+
const n = r.result;
|
|
747
|
+
t({
|
|
748
|
+
data: n,
|
|
749
|
+
lastModified: e.lastModified,
|
|
750
|
+
name: e.name,
|
|
751
|
+
size: e.size,
|
|
752
|
+
type: e.type
|
|
753
|
+
});
|
|
754
|
+
}, r.onerror = () => {
|
|
755
|
+
s(new Error(`Failed to read file: ${e.name}`));
|
|
756
|
+
}, r.readAsDataURL(e);
|
|
757
|
+
}), ot = (e) => {
|
|
758
|
+
const t = e.data.split(",")[1], s = atob(t), r = new ArrayBuffer(s.length), n = new Uint8Array(r);
|
|
759
|
+
for (let o = 0; o < s.length; o++)
|
|
760
|
+
n[o] = s.charCodeAt(o);
|
|
761
|
+
const a = new Blob([r], { type: e.type });
|
|
762
|
+
return new File([a], e.name, {
|
|
763
|
+
lastModified: e.lastModified,
|
|
764
|
+
type: e.type
|
|
765
|
+
});
|
|
766
|
+
}, at = (e) => Promise.all(e.map((t) => Ye(t))), it = ({
|
|
767
|
+
DefaultFormWrapper: e,
|
|
768
|
+
DefaultGroup: t,
|
|
769
|
+
DefaultSubmitButton: s,
|
|
770
|
+
DefaultSubmitButtonWrapper: r,
|
|
771
|
+
config: n,
|
|
772
|
+
defaultInputRenderers: a,
|
|
773
|
+
defaultUI: o,
|
|
774
|
+
formErrors: i,
|
|
775
|
+
formValues: c,
|
|
776
|
+
missingRequiredFields: g,
|
|
777
|
+
setFieldValue: f,
|
|
778
|
+
visibleNodes: p
|
|
779
|
+
}) => {
|
|
780
|
+
const u = R(() => n.components.form || e, [n.components.form, e]), d = R(
|
|
781
|
+
() => n.components.submitButton || s,
|
|
782
|
+
[n.components.submitButton, s]
|
|
783
|
+
), y = R(
|
|
784
|
+
() => n.components.submitButtonWrapper || r || Fe,
|
|
785
|
+
[n.components.submitButtonWrapper, r]
|
|
786
|
+
), l = V(
|
|
787
|
+
function w(b) {
|
|
788
|
+
const { type: O } = b;
|
|
789
|
+
switch (O) {
|
|
790
|
+
case G.input: {
|
|
791
|
+
if (!v(b))
|
|
792
|
+
return null;
|
|
793
|
+
const A = b.data, m = A.type || "text", S = n.components.inputs?.[m], M = a[m], F = S || M, P = b.id, K = (I) => f(P, I), W = c[P], $ = i[P], q = j(A.label, n.language), J = j(A.placeholder, n.language), z = j(A.helperText, n.language), k = se(b), C = L(q), X = L(J), D = L(z);
|
|
794
|
+
return F ? /* @__PURE__ */ U.jsx(
|
|
795
|
+
F,
|
|
796
|
+
{
|
|
797
|
+
id: b.id,
|
|
798
|
+
node: b,
|
|
799
|
+
value: W,
|
|
800
|
+
error: $,
|
|
801
|
+
label: C,
|
|
802
|
+
placeholder: X,
|
|
803
|
+
helperText: D,
|
|
804
|
+
name: k,
|
|
805
|
+
setValue: K,
|
|
806
|
+
missingRequiredFields: g
|
|
807
|
+
},
|
|
808
|
+
b.id
|
|
809
|
+
) : (console.warn("No renderer found for input type:", m), null);
|
|
810
|
+
}
|
|
811
|
+
case G.group: {
|
|
812
|
+
if (!Re(b))
|
|
813
|
+
return null;
|
|
814
|
+
const A = n.components.group || t, m = p.filter((S) => S.parentId === b.id);
|
|
815
|
+
return /* @__PURE__ */ U.jsx(A, { node: b, children: m.map((S) => w(S)) }, b.id);
|
|
816
|
+
}
|
|
817
|
+
case G.ui: {
|
|
818
|
+
if (!Ae(b))
|
|
819
|
+
return null;
|
|
820
|
+
const m = b.data.type || "title", S = n.components.ui?.[m], M = o[m], F = S || M;
|
|
821
|
+
return F ? /* @__PURE__ */ U.jsx(F, { node: b }, b.id) : null;
|
|
822
|
+
}
|
|
823
|
+
case G.flow:
|
|
824
|
+
return null;
|
|
825
|
+
default:
|
|
826
|
+
return console.warn("Unknown node type:", O), null;
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
[n, p, c, i, f, g, a, o, t]
|
|
830
|
+
);
|
|
831
|
+
return {
|
|
832
|
+
FormWrapper: u,
|
|
833
|
+
renderNode: l,
|
|
834
|
+
SubmitButton: d,
|
|
835
|
+
SubmitButtonWrapper: y
|
|
836
|
+
};
|
|
837
|
+
};
|
|
838
|
+
export {
|
|
839
|
+
tt as T,
|
|
840
|
+
nt as a,
|
|
841
|
+
Be as b,
|
|
842
|
+
at as c,
|
|
843
|
+
ze as d,
|
|
844
|
+
re as e,
|
|
845
|
+
Ye as f,
|
|
846
|
+
He as g,
|
|
847
|
+
ee as h,
|
|
848
|
+
$e as i,
|
|
849
|
+
ve as j,
|
|
850
|
+
me as k,
|
|
851
|
+
ae as l,
|
|
852
|
+
ye as m,
|
|
853
|
+
Ce as n,
|
|
854
|
+
L as o,
|
|
855
|
+
ue as p,
|
|
856
|
+
Xe as q,
|
|
857
|
+
Je as r,
|
|
858
|
+
ot as s,
|
|
859
|
+
rt as t,
|
|
860
|
+
Oe as u,
|
|
861
|
+
it as v,
|
|
862
|
+
st as w
|
|
863
|
+
};
|