treege 3.0.0-beta.3 → 3.0.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/LICENSE +18 -12
  2. package/README.md +306 -52
  3. package/dist/ThemeContext-Cw-S1U8B.js +990 -0
  4. package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
  5. package/dist/editor/constants/defaultNode.d.ts +1 -1
  6. package/dist/editor/constants/edgeTypes.d.ts +3 -2
  7. package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
  8. package/dist/editor/constants/nodeSpacing.d.ts +20 -0
  9. package/dist/editor/constants/nodeTypes.d.ts +5 -5
  10. package/dist/editor/context/TreegeEditorContext.d.ts +24 -1
  11. package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
  12. package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
  13. package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
  14. package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
  15. package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
  16. package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
  17. package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +2 -2
  18. package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +6 -0
  19. package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +6 -0
  20. package/dist/editor/features/TreegeEditor/nodes/components/InputTypeBadge.d.ts +7 -0
  21. package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +9 -0
  22. package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
  23. package/dist/editor/features/TreegeEditor/nodes/components/OptionsEditor.d.ts +7 -0
  24. package/dist/editor/features/TreegeEditor/nodes/components/RequiredBadge.d.ts +6 -0
  25. package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +2 -1
  26. package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
  27. package/dist/editor/hooks/useFlowActions.d.ts +3 -0
  28. package/dist/editor/hooks/useFlowConnections.d.ts +4 -0
  29. package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
  30. package/dist/editor/types/ai.d.ts +65 -0
  31. package/dist/editor/types/editor.d.ts +9 -8
  32. package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
  33. package/dist/editor/utils/image.d.ts +7 -0
  34. package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
  35. package/dist/editor-Bs1sHj4p.js +3751 -0
  36. package/dist/editor.js +3 -7
  37. package/dist/main.js +5 -52
  38. package/dist/renderer/context/TreegeRendererContext.d.ts +4 -1
  39. package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
  40. package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
  41. package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +7 -7
  42. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +21 -15
  43. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
  44. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
  45. package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
  46. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
  47. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
  48. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
  49. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
  50. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
  51. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
  52. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
  53. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
  54. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
  55. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
  56. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
  57. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
  58. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
  59. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
  60. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
  61. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
  62. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
  63. package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +84 -24
  64. package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
  65. package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +1 -1
  66. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
  67. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
  68. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
  69. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
  70. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
  71. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
  72. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
  73. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
  74. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
  75. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
  76. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
  77. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
  78. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +3 -0
  79. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
  80. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
  81. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
  82. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
  83. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
  84. package/dist/renderer/hooks/useRenderNode.d.ts +55 -0
  85. package/dist/renderer/hooks/useSubmitHandler.d.ts +34 -0
  86. package/dist/renderer/hooks/useTranslate.d.ts +6 -4
  87. package/dist/renderer/index.d.ts +2 -0
  88. package/dist/renderer/index.native.d.ts +19 -0
  89. package/dist/renderer/types/renderer.d.ts +60 -6
  90. package/dist/renderer/utils/form.d.ts +22 -2
  91. package/dist/renderer/utils/http.d.ts +101 -0
  92. package/dist/renderer/utils/node.d.ts +9 -1
  93. package/dist/renderer/utils/sanitize.d.ts +85 -0
  94. package/dist/renderer/utils/sanitize.native.d.ts +69 -0
  95. package/dist/renderer/utils/submit.d.ts +47 -0
  96. package/dist/renderer-CsU2Y0iu.js +1204 -0
  97. package/dist/renderer-native.d.ts +2 -0
  98. package/dist/renderer-native.js +3496 -0
  99. package/dist/renderer.js +4 -45
  100. package/dist/separator-B9rc85M6.js +351 -0
  101. package/dist/shared/components/ui/alert-dialog.d.ts +14 -0
  102. package/dist/shared/components/ui/badge.d.ts +2 -2
  103. package/dist/shared/components/ui/button.d.ts +2 -2
  104. package/dist/shared/components/ui/collapsible.d.ts +1 -1
  105. package/dist/shared/components/ui/command.d.ts +1 -1
  106. package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
  107. package/dist/shared/components/ui/form.d.ts +1 -1
  108. package/dist/shared/components/ui/popover.d.ts +4 -2
  109. package/dist/shared/components/ui/select.d.ts +3 -1
  110. package/dist/shared/components/ui/sheet.d.ts +1 -1
  111. package/dist/shared/components/ui/tooltip.d.ts +1 -1
  112. package/dist/shared/constants/colors.d.ts +45 -0
  113. package/dist/shared/constants/inputType.d.ts +1 -0
  114. package/dist/shared/context/ThemeContext.d.ts +2 -0
  115. package/dist/shared/context/ThemeContext.native.d.ts +22 -0
  116. package/dist/shared/hooks/useThemeColors.d.ts +37 -0
  117. package/dist/shared/locales/ar.json.d.ts +109 -10
  118. package/dist/shared/locales/de.json.d.ts +110 -11
  119. package/dist/shared/locales/en.json.d.ts +111 -12
  120. package/dist/shared/locales/es.json.d.ts +110 -11
  121. package/dist/shared/locales/fr.json.d.ts +110 -11
  122. package/dist/shared/locales/it.json.d.ts +110 -11
  123. package/dist/shared/locales/pt.json.d.ts +110 -11
  124. package/dist/shared/types/node.d.ts +64 -0
  125. package/dist/useRenderNode-IL6mmCOS.js +774 -0
  126. package/package.json +39 -12
  127. package/dist/ThemeContext-BIvs8Kw-.js +0 -758
  128. package/dist/TreegeEditor-BSPfQQk3.js +0 -2151
  129. package/dist/TreegeRenderer-D3EvsEfJ.js +0 -1413
  130. package/dist/_name_.css +0 -1
  131. package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
  132. package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
  133. package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
@@ -0,0 +1,1204 @@
1
+ import { f as e, t } from "./ThemeContext-Cw-S1U8B.js";
2
+ import { A as n, C as r, D as i, E as a, F as o, M as s, N as c, O as l, P as u, S as d, T as f, _ as p, a as m, b as h, c as g, i as _, j as v, k as y, l as b, n as ee, o as te, r as x, s as S, t as C, v as w, w as T, y as E } from "./separator-B9rc85M6.js";
3
+ import { S as D, a as O, b as ne, c as k, d as A, g as re, n as j, o as M, r as N, s as P, t as F, w as I } from "./useRenderNode-IL6mmCOS.js";
4
+ import * as L from "react";
5
+ import { forwardRef as R, useCallback as ie, useEffect as z, useMemo as ae, useRef as B, useState as V } from "react";
6
+ import { Check as oe, ChevronDownIcon as se, ChevronLeftIcon as ce, ChevronRightIcon as le, ChevronsUpDown as ue, CircleIcon as H, Loader2 as de, MapPin as U } from "lucide-react";
7
+ import { DayPicker as W, getDefaultClassNames as G } from "react-day-picker";
8
+ import * as K from "@radix-ui/react-tooltip";
9
+ import * as q from "@radix-ui/react-radio-group";
10
+ //#region src/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.tsx
11
+ var J = e(), fe = ({ children: e, onSubmit: t }) => /* @__PURE__ */ (0, J.jsx)("form", {
12
+ onSubmit: t,
13
+ className: "mx-auto max-w-2xl gap-y-3",
14
+ children: e
15
+ }), Y = ({ node: e, children: t }) => {
16
+ let n = M()(e.data.label);
17
+ return /* @__PURE__ */ (0, J.jsxs)("section", {
18
+ className: "mb-6 rounded-lg border p-4",
19
+ children: [n && /* @__PURE__ */ (0, J.jsx)("h3", {
20
+ className: "mb-4 font-semibold text-lg",
21
+ children: n
22
+ }), t]
23
+ });
24
+ }, pe = async (e, t) => {
25
+ if (!e || e.trim().length < 3) return [];
26
+ try {
27
+ let n = await fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&format=jsonv2&addressdetails=1&limit=5`, { headers: {
28
+ Accept: "application/json",
29
+ "User-Agent": "Treege Renderer",
30
+ ...t && { "Accept-Language": t }
31
+ } });
32
+ return n.ok ? (await n.json()).map((e) => ({
33
+ label: e.display_name,
34
+ value: e.display_name
35
+ })) : [];
36
+ } catch (e) {
37
+ return console.error("Nominatim fetch error:", e), [];
38
+ }
39
+ }, me = (e) => !e || e.trim().length < 3 ? Promise.resolve([]) : new Promise((t) => {
40
+ if (!window.google?.maps?.places) {
41
+ console.warn("Google Places SDK not loaded yet"), t([]);
42
+ return;
43
+ }
44
+ new window.google.maps.places.AutocompleteService().getPlacePredictions({ input: e }, (e, n) => {
45
+ if (n !== google.maps.places.PlacesServiceStatus.OK || !e) {
46
+ console.warn("Google Places API status:", n), t([]);
47
+ return;
48
+ }
49
+ t(e.map((e) => ({
50
+ label: e.description,
51
+ value: e.description
52
+ })));
53
+ });
54
+ }), he = ({ node: e, value: t, setValue: r, error: a, label: o, placeholder: s, helperText: c, id: u, name: d }) => {
55
+ let [f, p] = V(""), [m, h] = V([]), [g, b] = V(!1), { googleApiKey: C, language: w } = k(), T = M(), E = ie((e) => {
56
+ r(e.value), p(e.value), b(!1);
57
+ }, [r]);
58
+ z(() => {
59
+ if (!f || f.trim().length < 3) {
60
+ h([]);
61
+ return;
62
+ }
63
+ let e = setTimeout(async () => {
64
+ h(C ? await me(f) : await pe(f, w));
65
+ }, 300);
66
+ return () => clearTimeout(e);
67
+ }, [
68
+ f,
69
+ C,
70
+ w
71
+ ]);
72
+ let D = ie((e) => {
73
+ r(e), p(e), e.length >= 3 && b(!0);
74
+ }, [r]);
75
+ return /* @__PURE__ */ (0, J.jsxs)(J.Fragment, { children: [C && /* @__PURE__ */ (0, J.jsx)("script", {
76
+ async: !0,
77
+ src: `https://maps.googleapis.com/maps/api/js?key=${C}&libraries=places`
78
+ }), /* @__PURE__ */ (0, J.jsxs)(v, {
79
+ className: "mb-4",
80
+ children: [
81
+ /* @__PURE__ */ (0, J.jsxs)(i, {
82
+ htmlFor: u,
83
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
84
+ className: "text-red-500",
85
+ children: "*"
86
+ })]
87
+ }),
88
+ /* @__PURE__ */ (0, J.jsxs)("div", {
89
+ className: "relative",
90
+ children: [
91
+ /* @__PURE__ */ (0, J.jsx)(l, {
92
+ type: "text",
93
+ id: u,
94
+ name: d,
95
+ value: t || "",
96
+ onChange: (e) => D(e.target.value),
97
+ onFocus: () => {
98
+ m.length > 0 && b(!0);
99
+ },
100
+ placeholder: s || T("renderer.defaultAddressInput.enterAddress"),
101
+ className: "pr-10",
102
+ autoComplete: "off"
103
+ }),
104
+ /* @__PURE__ */ (0, J.jsx)(U, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 right-3 h-4 w-4 text-muted-foreground" }),
105
+ g && /* @__PURE__ */ (0, J.jsx)("div", {
106
+ className: "absolute z-50 mt-1 w-full rounded-md border bg-popover shadow-md",
107
+ children: /* @__PURE__ */ (0, J.jsx)(ee, { children: /* @__PURE__ */ (0, J.jsxs)(S, { children: [/* @__PURE__ */ (0, J.jsx)(x, { children: T("renderer.defaultAddressInput.noAddressesFound") }), /* @__PURE__ */ (0, J.jsx)(_, { children: m.map((e, t) => /* @__PURE__ */ (0, J.jsxs)(te, {
108
+ value: e.value,
109
+ onSelect: () => E(e),
110
+ onMouseDown: (e) => e.preventDefault(),
111
+ children: [/* @__PURE__ */ (0, J.jsx)(U, { className: "mr-2 h-4 w-4" }), e.label]
112
+ }, t)) })] }) })
113
+ })
114
+ ]
115
+ }),
116
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
117
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
118
+ ]
119
+ })] });
120
+ }, X = ({ node: e, value: t, setValue: r, error: s, label: l, placeholder: u, helperText: d, id: p }) => {
121
+ let h = M(), [g, b] = V(!1), C = `${p}-trigger`, w = `${p}-error`, E = e.data.options || [], D = E.find((e) => e.value === t);
122
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
123
+ className: "mb-4",
124
+ children: [
125
+ /* @__PURE__ */ (0, J.jsxs)(i, {
126
+ htmlFor: C,
127
+ children: [l || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
128
+ className: "text-red-500",
129
+ children: "*"
130
+ })]
131
+ }),
132
+ /* @__PURE__ */ (0, J.jsxs)(T, {
133
+ open: g,
134
+ onOpenChange: b,
135
+ children: [/* @__PURE__ */ (0, J.jsx)(a, {
136
+ asChild: !0,
137
+ children: /* @__PURE__ */ (0, J.jsxs)(c, {
138
+ id: C,
139
+ variant: "outline",
140
+ role: "combobox",
141
+ "aria-expanded": g,
142
+ "aria-invalid": !!s || void 0,
143
+ "aria-describedby": s ? w : void 0,
144
+ className: "w-full justify-between font-normal",
145
+ children: [t ? D?.label ? h(D.label) : t : u || h("renderer.defaultAutocompleteInput.selectOption"), /* @__PURE__ */ (0, J.jsx)(ue, { className: "ml-2 size-4 shrink-0 opacity-50" })]
146
+ })
147
+ }), /* @__PURE__ */ (0, J.jsx)(f, {
148
+ className: "w-full p-0",
149
+ align: "start",
150
+ children: /* @__PURE__ */ (0, J.jsxs)(ee, { children: [/* @__PURE__ */ (0, J.jsx)(m, { placeholder: u || h("renderer.defaultAutocompleteInput.search") }), /* @__PURE__ */ (0, J.jsxs)(S, { children: [/* @__PURE__ */ (0, J.jsx)(x, { children: h("renderer.defaultAutocompleteInput.noResults") }), /* @__PURE__ */ (0, J.jsx)(_, { children: E.map((e) => /* @__PURE__ */ (0, J.jsxs)(te, {
151
+ value: e.value,
152
+ disabled: e.disabled,
153
+ onSelect: (e) => {
154
+ r(e === t ? "" : e), b(!1);
155
+ },
156
+ children: [/* @__PURE__ */ (0, J.jsx)(oe, { className: o("mr-2 size-4", t === e.value ? "opacity-100" : "opacity-0") }), h(e.label)]
157
+ }, e.value)) })] })] })
158
+ })]
159
+ }),
160
+ s && /* @__PURE__ */ (0, J.jsx)(n, {
161
+ id: w,
162
+ children: s
163
+ }),
164
+ d && !s && /* @__PURE__ */ (0, J.jsx)(y, { children: d })
165
+ ]
166
+ });
167
+ }, Z = ({ node: e, value: t, setValue: r, error: a, label: o, helperText: c, id: l, name: u }) => {
168
+ let d = M();
169
+ if (e.data.options && e.data.options.length > 0) {
170
+ let f = Array.isArray(t) ? t.map(String) : [], p = (e, t) => {
171
+ r(t ? [...f, e] : f.filter((t) => t !== e));
172
+ };
173
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
174
+ className: "mb-4",
175
+ children: [
176
+ /* @__PURE__ */ (0, J.jsxs)(i, {
177
+ className: "mb-1",
178
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
179
+ className: "text-red-500",
180
+ children: "*"
181
+ })]
182
+ }),
183
+ /* @__PURE__ */ (0, J.jsx)("div", {
184
+ className: "space-y-2",
185
+ children: e.data.options.map((e, t) => {
186
+ let n = d(e.description);
187
+ return /* @__PURE__ */ (0, J.jsxs)("div", {
188
+ className: "flex items-start gap-3",
189
+ children: [/* @__PURE__ */ (0, J.jsx)(s, {
190
+ id: `${l}-${e.value}`,
191
+ name: u,
192
+ checked: f.includes(String(e.value)),
193
+ onCheckedChange: (t) => p(String(e.value), !!t),
194
+ disabled: e.disabled,
195
+ className: "mt-0.5"
196
+ }), /* @__PURE__ */ (0, J.jsxs)("div", {
197
+ className: "flex flex-col",
198
+ children: [/* @__PURE__ */ (0, J.jsx)(i, {
199
+ htmlFor: `${l}-${e.value}`,
200
+ className: "cursor-pointer font-normal text-sm",
201
+ children: d(e.label) ? d(e.label) : e.value
202
+ }), n && /* @__PURE__ */ (0, J.jsx)("span", {
203
+ className: "text-muted-foreground text-xs",
204
+ children: n
205
+ })]
206
+ })]
207
+ }, e.value + t);
208
+ })
209
+ }),
210
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
211
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
212
+ ]
213
+ });
214
+ }
215
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
216
+ className: "mb-4",
217
+ children: [/* @__PURE__ */ (0, J.jsxs)("div", {
218
+ className: "flex items-center gap-3",
219
+ children: [/* @__PURE__ */ (0, J.jsx)(s, {
220
+ id: l,
221
+ name: u,
222
+ checked: typeof t == "boolean" ? t : !1,
223
+ onCheckedChange: (e) => r(!!e)
224
+ }), /* @__PURE__ */ (0, J.jsxs)("div", { children: [/* @__PURE__ */ (0, J.jsxs)(i, {
225
+ htmlFor: l,
226
+ className: "cursor-pointer font-medium text-sm",
227
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
228
+ className: "text-red-500",
229
+ children: "*"
230
+ })]
231
+ }), c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })] })]
232
+ }), a && /* @__PURE__ */ (0, J.jsx)(n, { children: a })]
233
+ });
234
+ };
235
+ //#endregion
236
+ //#region src/shared/components/ui/calendar.tsx
237
+ function Q({ className: e, classNames: t, showOutsideDays: n = !0, captionLayout: r = "label", buttonVariant: i = "ghost", formatters: a, components: s, ...c }) {
238
+ let l = G();
239
+ return /* @__PURE__ */ (0, J.jsx)(W, {
240
+ showOutsideDays: n,
241
+ className: o("group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, e),
242
+ captionLayout: r,
243
+ formatters: {
244
+ formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
245
+ ...a
246
+ },
247
+ classNames: {
248
+ button_next: o(u({ variant: i }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", l.button_next),
249
+ button_previous: o(u({ variant: i }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", l.button_previous),
250
+ caption_label: o("select-none font-medium", r === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", l.caption_label),
251
+ day: o("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none", l.day),
252
+ disabled: o("text-muted-foreground opacity-50", l.disabled),
253
+ dropdown: o("absolute bg-popover inset-0 opacity-0", l.dropdown),
254
+ dropdown_root: o("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md", l.dropdown_root),
255
+ dropdowns: o("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", l.dropdowns),
256
+ hidden: o("invisible", l.hidden),
257
+ month: o("flex flex-col w-full gap-4", l.month),
258
+ month_caption: o("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", l.month_caption),
259
+ months: o("flex gap-4 flex-col md:flex-row relative", l.months),
260
+ nav: o("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", l.nav),
261
+ outside: o("text-muted-foreground aria-selected:text-muted-foreground", l.outside),
262
+ range_end: o("rounded-r-md bg-accent", l.range_end),
263
+ range_middle: o("rounded-none", l.range_middle),
264
+ range_start: o("rounded-l-md bg-accent", l.range_start),
265
+ root: o("w-fit", l.root),
266
+ table: "w-full border-collapse",
267
+ today: o("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", l.today),
268
+ week: o("flex w-full mt-2", l.week),
269
+ week_number: o("text-[0.8rem] select-none text-muted-foreground", l.week_number),
270
+ week_number_header: o("select-none w-(--cell-size)", l.week_number_header),
271
+ weekday: o("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", l.weekday),
272
+ weekdays: o("flex", l.weekdays),
273
+ ...t
274
+ },
275
+ components: {
276
+ Chevron: ({ className: e, orientation: t, ...n }) => t === "left" ? /* @__PURE__ */ (0, J.jsx)(ce, {
277
+ className: o("size-4", e),
278
+ ...n
279
+ }) : t === "right" ? /* @__PURE__ */ (0, J.jsx)(le, {
280
+ className: o("size-4", e),
281
+ ...n
282
+ }) : /* @__PURE__ */ (0, J.jsx)(se, {
283
+ className: o("size-4", e),
284
+ ...n
285
+ }),
286
+ DayButton: ge,
287
+ Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */ (0, J.jsx)("div", {
288
+ "data-slot": "calendar",
289
+ ref: t,
290
+ className: o(e),
291
+ ...n
292
+ }),
293
+ WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */ (0, J.jsx)("td", {
294
+ ...t,
295
+ children: /* @__PURE__ */ (0, J.jsx)("div", {
296
+ className: "flex size-(--cell-size) items-center justify-center text-center",
297
+ children: e
298
+ })
299
+ }),
300
+ ...s
301
+ },
302
+ ...c
303
+ });
304
+ }
305
+ function ge({ className: e, day: t, modifiers: n, ...r }) {
306
+ let i = G(), a = L.useRef(null);
307
+ return L.useEffect(() => {
308
+ n.focused && a.current?.focus();
309
+ }, [n.focused]), /* @__PURE__ */ (0, J.jsx)(c, {
310
+ ref: a,
311
+ variant: "ghost",
312
+ size: "icon",
313
+ "data-day": t.date.toLocaleDateString(),
314
+ "data-selected-single": n.selected && !n.range_start && !n.range_end && !n.range_middle,
315
+ "data-range-start": n.range_start,
316
+ "data-range-end": n.range_end,
317
+ "data-range-middle": n.range_middle,
318
+ className: o("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-start=true]:rounded-l-md data-[range-end=true]:bg-primary data-[range-middle=true]:bg-accent data-[range-start=true]:bg-primary data-[selected-single=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:text-accent-foreground data-[range-start=true]:text-primary-foreground data-[selected-single=true]:text-primary-foreground group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70", i.day, e),
319
+ ...r
320
+ });
321
+ }
322
+ //#endregion
323
+ //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.tsx
324
+ var _e = ({ node: e, value: t, setValue: r, error: o, label: s, placeholder: l, helperText: u, id: d, name: p }) => {
325
+ let [m, h] = V(!1), g = M(), _ = t ? new Date(t) : void 0;
326
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
327
+ className: "mb-4",
328
+ children: [
329
+ /* @__PURE__ */ (0, J.jsxs)(i, {
330
+ htmlFor: d,
331
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
332
+ className: "text-red-500",
333
+ children: "*"
334
+ })]
335
+ }),
336
+ /* @__PURE__ */ (0, J.jsxs)(T, {
337
+ open: m,
338
+ onOpenChange: h,
339
+ children: [/* @__PURE__ */ (0, J.jsx)(a, {
340
+ asChild: !0,
341
+ children: /* @__PURE__ */ (0, J.jsxs)(c, {
342
+ variant: "outline",
343
+ id: d,
344
+ name: p,
345
+ className: "w-full justify-between font-normal",
346
+ children: [_ ? _.toLocaleDateString() : l || g("renderer.defaultInputs.selectDate"), /* @__PURE__ */ (0, J.jsx)(se, { className: "size-4" })]
347
+ })
348
+ }), /* @__PURE__ */ (0, J.jsx)(f, {
349
+ className: "w-auto overflow-hidden p-0",
350
+ align: "start",
351
+ children: /* @__PURE__ */ (0, J.jsx)(Q, {
352
+ mode: "single",
353
+ selected: _,
354
+ captionLayout: "dropdown",
355
+ disabled: (t) => {
356
+ if (e.data.disablePast) {
357
+ let e = /* @__PURE__ */ new Date();
358
+ return e.setHours(0, 0, 0, 0), t < e;
359
+ }
360
+ return !1;
361
+ },
362
+ onSelect: (e) => {
363
+ r(e ? e.toISOString() : ""), h(!1);
364
+ }
365
+ })
366
+ })]
367
+ }),
368
+ o && /* @__PURE__ */ (0, J.jsx)(n, { children: o }),
369
+ u && !o && /* @__PURE__ */ (0, J.jsx)(y, { children: u })
370
+ ]
371
+ });
372
+ }, $ = ({ node: e, value: t, setValue: r, error: o, label: s, helperText: l, id: u }) => {
373
+ let [d, p] = V(!1), m = M(), h = Array.isArray(t) ? t : [], g = h[0] ? new Date(h[0]) : void 0, _ = h[1] ? new Date(h[1]) : void 0;
374
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
375
+ className: "mb-4",
376
+ children: [
377
+ /* @__PURE__ */ (0, J.jsxs)(i, {
378
+ htmlFor: u,
379
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
380
+ className: "text-red-500",
381
+ children: "*"
382
+ })]
383
+ }),
384
+ /* @__PURE__ */ (0, J.jsxs)(T, {
385
+ open: d,
386
+ onOpenChange: p,
387
+ children: [/* @__PURE__ */ (0, J.jsx)(a, {
388
+ asChild: !0,
389
+ children: /* @__PURE__ */ (0, J.jsxs)(c, {
390
+ id: u,
391
+ variant: "outline",
392
+ className: "w-full justify-between font-normal",
393
+ children: [g && _ ? `${g.toLocaleDateString()} - ${_.toLocaleDateString()}` : g ? g.toLocaleDateString() : m("renderer.defaultInputs.selectDateRange"), /* @__PURE__ */ (0, J.jsx)(se, { className: "size-4" })]
394
+ })
395
+ }), /* @__PURE__ */ (0, J.jsx)(f, {
396
+ className: "w-auto overflow-hidden p-0",
397
+ align: "start",
398
+ children: /* @__PURE__ */ (0, J.jsx)(Q, {
399
+ mode: "range",
400
+ selected: {
401
+ from: g,
402
+ to: _
403
+ },
404
+ captionLayout: "dropdown",
405
+ disabled: (t) => {
406
+ if (e.data.disablePast) {
407
+ let e = /* @__PURE__ */ new Date();
408
+ return e.setHours(0, 0, 0, 0), t < e;
409
+ }
410
+ return !1;
411
+ },
412
+ onSelect: (e) => {
413
+ r([e?.from ? e.from.toISOString() : void 0, e?.to ? e.to.toISOString() : void 0]);
414
+ },
415
+ numberOfMonths: 2
416
+ })
417
+ })]
418
+ }),
419
+ o && /* @__PURE__ */ (0, J.jsx)(n, { children: o }),
420
+ l && !o && /* @__PURE__ */ (0, J.jsx)(y, { children: l })
421
+ ]
422
+ });
423
+ }, ve = ({ node: e, setValue: t, error: r, label: a, placeholder: o, helperText: s, name: c, id: u }) => /* @__PURE__ */ (0, J.jsxs)(v, {
424
+ className: "mb-4",
425
+ children: [
426
+ /* @__PURE__ */ (0, J.jsxs)(i, {
427
+ htmlFor: u,
428
+ children: [a || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
429
+ className: "text-red-500",
430
+ children: "*"
431
+ })]
432
+ }),
433
+ /* @__PURE__ */ (0, J.jsx)(l, {
434
+ type: "file",
435
+ name: c,
436
+ id: u,
437
+ onChange: async (n) => {
438
+ let { files: r } = n.target;
439
+ if (!r || r.length === 0) {
440
+ t(null);
441
+ return;
442
+ }
443
+ if (e.data.multiple) {
444
+ t(await N(Array.from(r)));
445
+ return;
446
+ }
447
+ t(await j(r[0]));
448
+ },
449
+ multiple: e.data.multiple,
450
+ placeholder: o
451
+ }),
452
+ r && /* @__PURE__ */ (0, J.jsx)(n, { children: r }),
453
+ s && !r && /* @__PURE__ */ (0, J.jsx)(y, { children: s })
454
+ ]
455
+ }), ye = ({ value: e, name: t, id: n }) => /* @__PURE__ */ (0, J.jsx)(l, {
456
+ type: "hidden",
457
+ id: n,
458
+ name: t,
459
+ value: e ?? ""
460
+ });
461
+ //#endregion
462
+ //#region src/shared/components/ui/tooltip.tsx
463
+ function be({ delayDuration: e = 0, ...t }) {
464
+ return /* @__PURE__ */ (0, J.jsx)(K.Provider, {
465
+ "data-slot": "tooltip-provider",
466
+ delayDuration: e,
467
+ ...t
468
+ });
469
+ }
470
+ function xe({ ...e }) {
471
+ return /* @__PURE__ */ (0, J.jsx)(be, { children: /* @__PURE__ */ (0, J.jsx)(K.Root, {
472
+ "data-slot": "tooltip",
473
+ ...e
474
+ }) });
475
+ }
476
+ function Se({ ...e }) {
477
+ return /* @__PURE__ */ (0, J.jsx)(K.Trigger, {
478
+ "data-slot": "tooltip-trigger",
479
+ ...e
480
+ });
481
+ }
482
+ function Ce({ className: e, sideOffset: t = 0, children: n, ...r }) {
483
+ return /* @__PURE__ */ (0, J.jsx)(K.Portal, { children: /* @__PURE__ */ (0, J.jsxs)(K.Content, {
484
+ "data-slot": "tooltip-content",
485
+ sideOffset: t,
486
+ className: o("fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[state=closed]:animate-out", e),
487
+ ...r,
488
+ children: [n, /* @__PURE__ */ (0, J.jsx)(K.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })]
489
+ }) });
490
+ }
491
+ //#endregion
492
+ //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.tsx
493
+ var we = (e, t) => t ? t.split(".").reduce((e, t) => {
494
+ if (e == null) return;
495
+ let n = t.match(/^(\w+)\[(\d+)]$/);
496
+ if (n) {
497
+ let [, t, r] = n, i = e[t];
498
+ return Array.isArray(i) ? i[Number.parseInt(r, 10)] : i;
499
+ }
500
+ return e[t];
501
+ }, e) : e, Te = (e) => {
502
+ let t = e.matchAll(/{{([\w-]+)}}/g);
503
+ return Array.from(t, (e) => e[1]);
504
+ }, Ee = (e, t) => Te(e).every((e) => {
505
+ let n = t[e];
506
+ return n != null && n !== "";
507
+ }), De = (e, t, n = !1) => e.replace(/{{([\w-]+)}}/g, (e, r) => {
508
+ let i = t[r], a = i == null ? "" : String(i);
509
+ return n ? encodeURIComponent(a) : a;
510
+ }), Oe = ({ node: e, value: t, setValue: s, error: u, label: g, placeholder: b, helperText: C, id: O, name: A }) => {
511
+ let [j, N] = V(!1), [P, F] = V(null), [I, L] = V([]), [R, se] = V(""), [ce, le] = V(!1), { formValues: H, inputNodes: U } = k(), W = M(), { httpConfig: G } = e.data, K = B(!1), q = B(""), fe = B(G), Y = B(H), pe = B(U), me = B(s), he = B(null), X = B(null), Z = ae(() => G?.url ? Te(G.url) : [], [G?.url]), Q = Z.length > 0, ge = ae(() => Z.map((e) => `${e}:${String(H[e] ?? "")}`).join("|"), [Z, H]), _e = ae(() => G?.url ? Q ? Ee(G.url, H) : !0 : !1, [
512
+ G?.url,
513
+ Q,
514
+ H
515
+ ]), $ = ie(async (e) => {
516
+ X.current && X.current.abort();
517
+ let t = new AbortController();
518
+ X.current = t;
519
+ let n = fe.current, r = Y.current, i = me.current;
520
+ if (!n?.url) {
521
+ F(W("renderer.defaultHttpInput.noUrlConfigured")), X.current = null;
522
+ return;
523
+ }
524
+ if (n.url && !Ee(n.url, r)) {
525
+ X.current = null;
526
+ return;
527
+ }
528
+ N(!0), F(null);
529
+ try {
530
+ let a = De(n.url, r, !0), o = n.searchParam && e ? `${a}${a.includes("?") ? "&" : "?"}${n.searchParam}=${encodeURIComponent(e)}` : a, s = {};
531
+ n.headers?.forEach((e) => {
532
+ s[e.key] = De(e.value, r);
533
+ });
534
+ let c = [
535
+ "POST",
536
+ "PUT",
537
+ "PATCH"
538
+ ].includes(n.method || "") ? n.sendAllFormValues ? JSON.stringify(ne(r, pe.current)) : n.body ? De(n.body, r) : void 0 : void 0, l = setTimeout(() => t.abort(), 3e4), u = await fetch(o, {
539
+ body: c || void 0,
540
+ headers: {
541
+ "Content-Type": "application/json",
542
+ ...s
543
+ },
544
+ method: n.method || "GET",
545
+ signal: t.signal
546
+ });
547
+ if (clearTimeout(l), !u.ok) {
548
+ F(`HTTP Error ${u.status}: ${u.statusText}`), N(!1);
549
+ return;
550
+ }
551
+ let d = re(await u.json()), f = n.responsePath ? we(d, n.responsePath) : d;
552
+ if (n.responseMapping && Array.isArray(f)) {
553
+ let { valueField: e = "value", labelField: t = "label" } = n.responseMapping;
554
+ L(f.map((n) => ({
555
+ label: String(we(n, t) || ""),
556
+ value: String(we(n, e) || "")
557
+ })));
558
+ } else i(typeof f == "string" ? f : JSON.stringify(f));
559
+ } catch (e) {
560
+ if (e instanceof Error && e.name === "AbortError") return;
561
+ F(e instanceof Error ? e.message : W("renderer.defaultHttpInput.fetchFailed")), console.error("HTTP Input fetch error:", e);
562
+ } finally {
563
+ N(!1), X.current = null;
564
+ }
565
+ }, [W]);
566
+ if (z(() => {
567
+ fe.current = G, Y.current = H, pe.current = U, me.current = s, he.current = $;
568
+ }, [
569
+ G,
570
+ H,
571
+ U,
572
+ s,
573
+ $
574
+ ]), z(() => () => {
575
+ X.current && X.current.abort();
576
+ }, []), z(() => {
577
+ if (K.current) return;
578
+ K.current = !0;
579
+ let e = fe.current, t = Y.current, n = he.current, r = e?.url && Ee(e.url, t);
580
+ e?.fetchOnMount && r && n && (n(), e.url && (q.current = Te(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
581
+ }, []), z(() => {
582
+ if (!K.current || !Q || q.current === ge || !_e) return;
583
+ let e = setTimeout(() => {
584
+ $(), q.current = ge;
585
+ }, 500);
586
+ return () => clearTimeout(e);
587
+ }, [
588
+ ge,
589
+ Q,
590
+ _e,
591
+ $
592
+ ]), z(() => {
593
+ if (!(G?.searchParam && R)) return;
594
+ let e = setTimeout(() => {
595
+ $(R);
596
+ }, 300);
597
+ return () => clearTimeout(e);
598
+ }, [
599
+ R,
600
+ G?.searchParam,
601
+ $
602
+ ]), G?.responseMapping) {
603
+ let l = Array.isArray(t) ? t[0] : t, ne = I.find((e) => e.value === l);
604
+ if (G.searchParam) {
605
+ let r = j && G?.showLoading ? /* @__PURE__ */ (0, J.jsxs)("div", {
606
+ className: "flex items-center gap-2",
607
+ children: [/* @__PURE__ */ (0, J.jsx)(de, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ (0, J.jsx)("span", {
608
+ className: "text-muted-foreground",
609
+ children: ne?.label || b || W("renderer.defaultHttpInput.search")
610
+ })]
611
+ }) : ne?.label || b || W("renderer.defaultHttpInput.search");
612
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
613
+ className: "mb-4",
614
+ children: [
615
+ /* @__PURE__ */ (0, J.jsxs)(i, { children: [g || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
616
+ className: "text-red-500",
617
+ children: "*"
618
+ })] }),
619
+ /* @__PURE__ */ (0, J.jsxs)(T, {
620
+ open: ce,
621
+ onOpenChange: le,
622
+ children: [/* @__PURE__ */ (0, J.jsx)(a, {
623
+ asChild: !0,
624
+ children: /* @__PURE__ */ (0, J.jsxs)(c, {
625
+ variant: "outline",
626
+ role: "combobox",
627
+ "aria-expanded": ce,
628
+ className: "w-full justify-between",
629
+ children: [r, /* @__PURE__ */ (0, J.jsx)(ue, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
630
+ })
631
+ }), /* @__PURE__ */ (0, J.jsx)(f, {
632
+ className: "w-[300px] p-0",
633
+ align: "start",
634
+ children: /* @__PURE__ */ (0, J.jsxs)(ee, {
635
+ shouldFilter: !1,
636
+ children: [/* @__PURE__ */ (0, J.jsx)(m, {
637
+ placeholder: W("renderer.defaultHttpInput.search"),
638
+ value: R,
639
+ onValueChange: (e) => {
640
+ se(e), F(null);
641
+ }
642
+ }), /* @__PURE__ */ (0, J.jsxs)(S, { children: [
643
+ j && /* @__PURE__ */ (0, J.jsx)("div", {
644
+ className: "flex items-center justify-center p-4",
645
+ children: /* @__PURE__ */ (0, J.jsx)(de, { className: "h-4 w-4 animate-spin" })
646
+ }),
647
+ !j && P && /* @__PURE__ */ (0, J.jsxs)("div", {
648
+ className: "p-4 text-destructive text-sm",
649
+ children: [/* @__PURE__ */ (0, J.jsx)("div", { children: P }), /* @__PURE__ */ (0, J.jsx)("button", {
650
+ type: "button",
651
+ onClick: () => $(R),
652
+ className: "mt-2 block text-primary hover:underline",
653
+ children: W("renderer.defaultHttpInput.retry")
654
+ })]
655
+ }),
656
+ !(j || P) && /* @__PURE__ */ (0, J.jsxs)(J.Fragment, { children: [/* @__PURE__ */ (0, J.jsx)(x, { children: W("renderer.defaultHttpInput.noResults") }), /* @__PURE__ */ (0, J.jsx)(_, { children: I.map((e) => /* @__PURE__ */ (0, J.jsxs)(te, {
657
+ value: e.value,
658
+ onSelect: () => {
659
+ s(e.value), le(!1);
660
+ },
661
+ children: [/* @__PURE__ */ (0, J.jsx)(oe, { className: o("mr-2 h-4 w-4", t === e.value ? "opacity-100" : "opacity-0") }), e.label]
662
+ }, e.value)) })] })
663
+ ] })]
664
+ })
665
+ })]
666
+ }),
667
+ u && /* @__PURE__ */ (0, J.jsx)(n, { children: u }),
668
+ C && !u && /* @__PURE__ */ (0, J.jsx)(y, { children: C })
669
+ ]
670
+ });
671
+ }
672
+ let k = j && G?.showLoading, re = Z.filter((e) => {
673
+ let t = H[e];
674
+ return t == null || t === "";
675
+ }), M = re.map((e) => D(e, U) || e), N = I.length === 0 && !k ? P || (re.length > 0 ? `${W("renderer.defaultHttpInput.waitingForRequiredFields")}: ${M.join(", ")}` : W("renderer.defaultHttpInput.noDataAvailable")) : void 0, L = /* @__PURE__ */ (0, J.jsxs)(p, {
676
+ value: Array.isArray(t) ? t[0] ?? "" : t ?? "",
677
+ onValueChange: (e) => s(e),
678
+ disabled: k || I.length === 0,
679
+ name: A,
680
+ children: [/* @__PURE__ */ (0, J.jsxs)(d, {
681
+ id: O,
682
+ name: A,
683
+ className: "w-full",
684
+ children: [k && /* @__PURE__ */ (0, J.jsx)(de, { className: "mr-2 h-4 w-4 animate-spin" }), /* @__PURE__ */ (0, J.jsx)(r, { placeholder: b || W("renderer.defaultHttpInput.selectOption") })]
685
+ }), /* @__PURE__ */ (0, J.jsx)(w, { children: /* @__PURE__ */ (0, J.jsx)(E, { children: I.map((e, t) => /* @__PURE__ */ (0, J.jsx)(h, {
686
+ value: e.value,
687
+ children: e.label
688
+ }, e.value + t)) }) })]
689
+ });
690
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
691
+ className: "mb-4",
692
+ children: [
693
+ /* @__PURE__ */ (0, J.jsxs)(i, {
694
+ htmlFor: O,
695
+ children: [g || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
696
+ className: "text-red-500",
697
+ children: "*"
698
+ })]
699
+ }),
700
+ N ? /* @__PURE__ */ (0, J.jsx)(be, { children: /* @__PURE__ */ (0, J.jsxs)(xe, { children: [/* @__PURE__ */ (0, J.jsx)(Se, {
701
+ asChild: !0,
702
+ children: /* @__PURE__ */ (0, J.jsx)("div", {
703
+ className: "w-full",
704
+ children: L
705
+ })
706
+ }), /* @__PURE__ */ (0, J.jsx)(Ce, { children: /* @__PURE__ */ (0, J.jsx)("p", { children: N }) })] }) }) : L,
707
+ u && /* @__PURE__ */ (0, J.jsx)(n, { children: u }),
708
+ C && !u && /* @__PURE__ */ (0, J.jsx)(y, { children: C })
709
+ ]
710
+ });
711
+ }
712
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
713
+ className: "mb-4",
714
+ children: [
715
+ /* @__PURE__ */ (0, J.jsxs)(i, {
716
+ htmlFor: O,
717
+ children: [g || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
718
+ className: "text-red-500",
719
+ children: "*"
720
+ })]
721
+ }),
722
+ /* @__PURE__ */ (0, J.jsx)(l, {
723
+ type: "text",
724
+ name: A,
725
+ id: O,
726
+ value: typeof t == "string" ? t : JSON.stringify(t),
727
+ readOnly: !0,
728
+ disabled: !0
729
+ }),
730
+ u && /* @__PURE__ */ (0, J.jsx)(n, { children: u }),
731
+ C && !u && /* @__PURE__ */ (0, J.jsx)(y, { children: C })
732
+ ]
733
+ });
734
+ }, ke = ({ node: e, value: t, setValue: r, error: a, label: o, placeholder: s, helperText: c, name: u, id: d }) => /* @__PURE__ */ (0, J.jsxs)(v, {
735
+ className: "mb-4",
736
+ children: [
737
+ /* @__PURE__ */ (0, J.jsxs)(i, {
738
+ htmlFor: d,
739
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
740
+ className: "text-red-500",
741
+ children: "*"
742
+ })]
743
+ }),
744
+ /* @__PURE__ */ (0, J.jsx)(l, {
745
+ id: d,
746
+ type: "number",
747
+ name: u,
748
+ value: t ?? "",
749
+ onChange: (e) => r(e.target.value === "" ? null : Number(e.target.value)),
750
+ placeholder: s
751
+ }),
752
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
753
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
754
+ ]
755
+ }), Ae = ({ node: e, value: t, setValue: r, error: a, label: o, placeholder: s, helperText: c, name: u, id: d }) => /* @__PURE__ */ (0, J.jsxs)(v, {
756
+ className: "mb-4",
757
+ children: [
758
+ /* @__PURE__ */ (0, J.jsxs)(i, {
759
+ htmlFor: d,
760
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
761
+ className: "text-red-500",
762
+ children: "*"
763
+ })]
764
+ }),
765
+ /* @__PURE__ */ (0, J.jsx)(l, {
766
+ id: d,
767
+ name: u,
768
+ type: "password",
769
+ value: t ?? "",
770
+ onChange: (e) => r(e.target.value),
771
+ placeholder: s,
772
+ autoComplete: "new-password"
773
+ }),
774
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
775
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
776
+ ]
777
+ });
778
+ //#endregion
779
+ //#region src/shared/components/ui/radio-group.tsx
780
+ function je({ className: e, ...t }) {
781
+ return /* @__PURE__ */ (0, J.jsx)(q.Root, {
782
+ "data-slot": "radio-group",
783
+ className: o("grid gap-3", e),
784
+ ...t
785
+ });
786
+ }
787
+ function Me({ className: e, ...t }) {
788
+ return /* @__PURE__ */ (0, J.jsx)(q.Item, {
789
+ "data-slot": "radio-group-item",
790
+ className: o("aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40", e),
791
+ ...t,
792
+ children: /* @__PURE__ */ (0, J.jsx)(q.Indicator, {
793
+ "data-slot": "radio-group-indicator",
794
+ className: "relative flex items-center justify-center",
795
+ children: /* @__PURE__ */ (0, J.jsx)(H, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" })
796
+ })
797
+ });
798
+ }
799
+ //#endregion
800
+ //#region src/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.tsx
801
+ var Ne = ({ node: e, value: t, setValue: r, error: a, label: s, helperText: c, id: l, name: u }) => {
802
+ let d = M(), f = t ? String(t) : "", p = e.data.variant === "card";
803
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
804
+ className: "mb-4",
805
+ children: [
806
+ /* @__PURE__ */ (0, J.jsxs)(i, {
807
+ className: "mb-1",
808
+ htmlFor: l,
809
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
810
+ className: "text-red-500",
811
+ children: "*"
812
+ })]
813
+ }),
814
+ /* @__PURE__ */ (0, J.jsx)(je, {
815
+ value: f,
816
+ onValueChange: (e) => r(e),
817
+ id: l,
818
+ name: u,
819
+ className: p ? "flex flex-col gap-2" : void 0,
820
+ children: e.data.options?.map((e, t) => {
821
+ let n = `${l}-${e.value}`, r = d(e.label) || e.value, a = d(e.description), s = f === String(e.value);
822
+ return p ? /* @__PURE__ */ (0, J.jsxs)(i, {
823
+ htmlFor: n,
824
+ className: o("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors", "hover:border-primary/50", s && "border-primary bg-primary/5", e.disabled && "pointer-events-none opacity-50"),
825
+ children: [
826
+ /* @__PURE__ */ (0, J.jsx)(Me, {
827
+ value: String(e.value),
828
+ id: n,
829
+ disabled: e.disabled,
830
+ className: "mt-1"
831
+ }),
832
+ e.image && /* @__PURE__ */ (0, J.jsx)("img", {
833
+ src: e.image,
834
+ alt: "",
835
+ className: "h-10 w-10 shrink-0 rounded object-cover"
836
+ }),
837
+ /* @__PURE__ */ (0, J.jsxs)("div", {
838
+ className: "flex min-w-0 flex-col",
839
+ children: [/* @__PURE__ */ (0, J.jsx)("span", {
840
+ className: "font-medium text-sm",
841
+ children: r
842
+ }), a && /* @__PURE__ */ (0, J.jsx)("span", {
843
+ className: "text-muted-foreground text-xs",
844
+ children: a
845
+ })]
846
+ })
847
+ ]
848
+ }, e.value + t) : /* @__PURE__ */ (0, J.jsxs)("div", {
849
+ className: "flex items-start space-x-2",
850
+ children: [
851
+ /* @__PURE__ */ (0, J.jsx)(Me, {
852
+ value: String(e.value),
853
+ id: n,
854
+ disabled: e.disabled,
855
+ className: "mt-0.5"
856
+ }),
857
+ e.image && /* @__PURE__ */ (0, J.jsx)("img", {
858
+ src: e.image,
859
+ alt: "",
860
+ className: "h-8 w-8 rounded object-cover"
861
+ }),
862
+ /* @__PURE__ */ (0, J.jsxs)("div", {
863
+ className: "flex flex-col",
864
+ children: [/* @__PURE__ */ (0, J.jsx)(i, {
865
+ htmlFor: n,
866
+ className: "cursor-pointer font-normal text-sm",
867
+ children: r
868
+ }), a && /* @__PURE__ */ (0, J.jsx)("span", {
869
+ className: "text-muted-foreground text-xs",
870
+ children: a
871
+ })]
872
+ })
873
+ ]
874
+ }, e.value + t);
875
+ })
876
+ }),
877
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
878
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
879
+ ]
880
+ });
881
+ }, Pe = ({ node: e, value: t, setValue: a, error: o, label: s, placeholder: c, helperText: l, name: u, id: f }) => {
882
+ let m = M(), g = t ? String(t) : "";
883
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
884
+ className: "mb-4",
885
+ children: [
886
+ /* @__PURE__ */ (0, J.jsxs)(i, {
887
+ htmlFor: f,
888
+ children: [s || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
889
+ className: "text-red-500",
890
+ children: "*"
891
+ })]
892
+ }),
893
+ /* @__PURE__ */ (0, J.jsxs)(p, {
894
+ name: u,
895
+ value: g,
896
+ onValueChange: (e) => a(e),
897
+ children: [/* @__PURE__ */ (0, J.jsx)(d, {
898
+ id: f,
899
+ name: u,
900
+ className: "w-full",
901
+ children: /* @__PURE__ */ (0, J.jsx)(r, { placeholder: c || m("renderer.defaultSelectInput.selectOption") })
902
+ }), /* @__PURE__ */ (0, J.jsx)(w, { children: /* @__PURE__ */ (0, J.jsx)(E, { children: e.data.options?.map((e, t) => /* @__PURE__ */ (0, J.jsx)(h, {
903
+ value: String(e.value),
904
+ disabled: e.disabled,
905
+ children: m(e.label) ? m(e.label) : e.value
906
+ }, `${e.value}-${t}`)) }) })]
907
+ }),
908
+ o && /* @__PURE__ */ (0, J.jsx)(n, { children: o }),
909
+ l && !o && /* @__PURE__ */ (0, J.jsx)(y, { children: l })
910
+ ]
911
+ });
912
+ }, Fe = R(({ label: e, id: t, disabled: n, onBlur: r, onClick: i, onFocus: a, onPointerDown: o, onPointerLeave: s, onPointerMove: c, ...l }, u) => {
913
+ let d = M();
914
+ return /* @__PURE__ */ (0, J.jsx)("button", {
915
+ ref: u,
916
+ id: t,
917
+ onBlur: r,
918
+ onClick: i,
919
+ onFocus: a,
920
+ onPointerDown: o,
921
+ disabled: n,
922
+ onPointerLeave: s,
923
+ onPointerMove: c,
924
+ type: "submit",
925
+ className: "mt-4 rounded-md bg-blue-500 px-4 py-2 font-medium text-white transition-colors hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
926
+ ...l,
927
+ children: e || d("renderer.defaultSubmitButton.submit")
928
+ });
929
+ }), Ie = ({ children: e, missingFields: t = [] }) => {
930
+ let n = t.length > 0, r = M();
931
+ return n ? /* @__PURE__ */ (0, J.jsx)(be, { children: /* @__PURE__ */ (0, J.jsxs)(xe, { children: [/* @__PURE__ */ (0, J.jsx)(Se, {
932
+ asChild: !0,
933
+ children: e
934
+ }), /* @__PURE__ */ (0, J.jsx)(Ce, { children: /* @__PURE__ */ (0, J.jsxs)("div", {
935
+ className: "space-y-1",
936
+ children: [/* @__PURE__ */ (0, J.jsxs)("p", {
937
+ className: "font-semibold",
938
+ children: [r("renderer.defaultSubmitButton.requiredFieldsMissing"), ":"]
939
+ }), /* @__PURE__ */ (0, J.jsx)("ul", {
940
+ className: "list-inside list-disc",
941
+ children: t.map((e, t) => /* @__PURE__ */ (0, J.jsx)("li", { children: e }, t))
942
+ })]
943
+ }) })] }) }) : e;
944
+ }, Le = ({ missingRequiredFields: e, isSubmitting: t, label: n }) => {
945
+ let r = I(), i = r?.components?.submitButton, a = r?.components?.submitButtonWrapper;
946
+ return /* @__PURE__ */ (0, J.jsx)(a || Ie, {
947
+ missingFields: e,
948
+ children: /* @__PURE__ */ (0, J.jsx)(i || Fe, {
949
+ label: n,
950
+ disabled: t
951
+ })
952
+ });
953
+ }, Re = ({ node: e, value: t, setValue: r, error: a, label: o, helperText: s, name: c, id: l }) => /* @__PURE__ */ (0, J.jsxs)(v, {
954
+ className: "mb-4",
955
+ children: [
956
+ /* @__PURE__ */ (0, J.jsxs)(i, {
957
+ htmlFor: l,
958
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
959
+ className: "text-red-500",
960
+ children: "*"
961
+ })]
962
+ }),
963
+ /* @__PURE__ */ (0, J.jsx)(g, {
964
+ id: l,
965
+ name: c,
966
+ checked: t,
967
+ onCheckedChange: r
968
+ }),
969
+ s && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: s }),
970
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a })
971
+ ]
972
+ }), ze = ({ node: e, value: t, setValue: r, error: a, label: o, placeholder: s, helperText: c, name: l, id: u }) => /* @__PURE__ */ (0, J.jsxs)(v, {
973
+ className: "mb-4",
974
+ children: [
975
+ /* @__PURE__ */ (0, J.jsxs)(i, {
976
+ htmlFor: u,
977
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
978
+ className: "text-red-500",
979
+ children: "*"
980
+ })]
981
+ }),
982
+ /* @__PURE__ */ (0, J.jsx)(b, {
983
+ id: u,
984
+ name: l,
985
+ value: t ?? "",
986
+ onChange: (e) => r(e.target.value),
987
+ placeholder: s,
988
+ className: "w-full rounded-md border px-3 py-2",
989
+ rows: 4
990
+ }),
991
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
992
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
993
+ ]
994
+ }), Be = ({ node: e, value: t, setValue: r, error: a, label: o, placeholder: s, helperText: c, name: u, id: d }) => /* @__PURE__ */ (0, J.jsxs)(v, {
995
+ className: "mb-4",
996
+ children: [
997
+ /* @__PURE__ */ (0, J.jsxs)(i, {
998
+ htmlFor: d,
999
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
1000
+ className: "text-red-500",
1001
+ children: "*"
1002
+ })]
1003
+ }),
1004
+ /* @__PURE__ */ (0, J.jsx)(l, {
1005
+ type: "text",
1006
+ id: d,
1007
+ name: u,
1008
+ value: t ?? "",
1009
+ onChange: (e) => r(e.target.value),
1010
+ placeholder: s
1011
+ }),
1012
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
1013
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
1014
+ ]
1015
+ }), Ve = ({ node: e, value: t, setValue: r, error: a, label: o, placeholder: s, helperText: c, name: u, id: d }) => /* @__PURE__ */ (0, J.jsxs)(v, {
1016
+ className: "mb-4",
1017
+ children: [
1018
+ /* @__PURE__ */ (0, J.jsxs)(i, {
1019
+ htmlFor: d,
1020
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
1021
+ className: "text-red-500",
1022
+ children: "*"
1023
+ })]
1024
+ }),
1025
+ /* @__PURE__ */ (0, J.jsx)(l, {
1026
+ type: "time",
1027
+ id: d,
1028
+ name: u,
1029
+ value: t ?? "",
1030
+ onChange: (e) => r(e.target.value),
1031
+ placeholder: s,
1032
+ className: "bg-background [color-scheme:light] dark:[color-scheme:dark]"
1033
+ }),
1034
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
1035
+ c && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: c })
1036
+ ]
1037
+ }), He = ({ node: e, value: t, setValue: r, error: a, label: o, helperText: s, id: c, name: u }) => {
1038
+ let d = M(), f = Array.isArray(t) ? t : [], p = f[0] || "", m = f[1] || "", h = (e) => {
1039
+ r([e, m]);
1040
+ }, g = (e) => {
1041
+ r([p, e]);
1042
+ };
1043
+ return /* @__PURE__ */ (0, J.jsxs)(v, {
1044
+ className: "mb-4",
1045
+ children: [
1046
+ /* @__PURE__ */ (0, J.jsxs)(i, {
1047
+ htmlFor: `${c}-start`,
1048
+ children: [o || e.data.name, e.data.required && /* @__PURE__ */ (0, J.jsx)("span", {
1049
+ className: "text-red-500",
1050
+ children: "*"
1051
+ })]
1052
+ }),
1053
+ /* @__PURE__ */ (0, J.jsxs)("div", {
1054
+ className: "flex gap-2",
1055
+ children: [/* @__PURE__ */ (0, J.jsx)(l, {
1056
+ id: `${c}-start`,
1057
+ name: `${u}-start`,
1058
+ "aria-label": `${o || e.data.name} - ${d("renderer.defaultInputs.startTime")}`,
1059
+ "aria-invalid": !!a,
1060
+ "aria-describedby": a ? `${e.id}-error` : void 0,
1061
+ type: "time",
1062
+ value: p,
1063
+ onChange: (e) => h(e.target.value),
1064
+ placeholder: d("renderer.defaultInputs.startTime"),
1065
+ className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
1066
+ }), /* @__PURE__ */ (0, J.jsx)(l, {
1067
+ id: `${c}-end`,
1068
+ name: `${u}-end`,
1069
+ "aria-label": `${o || e.data.name} - ${d("renderer.defaultInputs.endTime")}`,
1070
+ "aria-invalid": !!a,
1071
+ "aria-describedby": a ? `${e.id}-error` : void 0,
1072
+ type: "time",
1073
+ value: m,
1074
+ onChange: (e) => g(e.target.value),
1075
+ placeholder: d("renderer.defaultInputs.endTime"),
1076
+ className: "flex-1 bg-background [color-scheme:light] dark:[color-scheme:dark]"
1077
+ })]
1078
+ }),
1079
+ a && /* @__PURE__ */ (0, J.jsx)(n, { children: a }),
1080
+ s && !a && /* @__PURE__ */ (0, J.jsx)(y, { children: s })
1081
+ ]
1082
+ });
1083
+ }, Ue = {
1084
+ address: he,
1085
+ autocomplete: X,
1086
+ checkbox: Z,
1087
+ date: _e,
1088
+ daterange: $,
1089
+ file: ve,
1090
+ hidden: ye,
1091
+ http: Oe,
1092
+ number: ke,
1093
+ password: Ae,
1094
+ radio: Ne,
1095
+ select: Pe,
1096
+ submit: Le,
1097
+ switch: Re,
1098
+ text: Be,
1099
+ textarea: ze,
1100
+ time: Ve,
1101
+ timerange: He
1102
+ }, We = ({ node: e }) => {
1103
+ let t = M()(e.data?.label);
1104
+ return t ? /* @__PURE__ */ (0, J.jsxs)("div", {
1105
+ className: "flex items-center gap-x-3",
1106
+ children: [
1107
+ /* @__PURE__ */ (0, J.jsx)(C, { className: "my-8 flex-1" }),
1108
+ /* @__PURE__ */ (0, J.jsx)("h4", {
1109
+ className: "font-semibold text-sm",
1110
+ children: t
1111
+ }),
1112
+ /* @__PURE__ */ (0, J.jsx)(C, { className: "my-8 flex-1" })
1113
+ ]
1114
+ }) : /* @__PURE__ */ (0, J.jsx)(C, { className: "my-8" });
1115
+ }, Ge = ({ node: e }) => {
1116
+ let { edges: t } = k(), n = M();
1117
+ return /* @__PURE__ */ (0, J.jsx)("h2", {
1118
+ className: o("mb-5 font-bold text-2xl", !A(e.id, t) && "mt-10"),
1119
+ children: n(e.data?.label)
1120
+ });
1121
+ }, Ke = {
1122
+ divider: We,
1123
+ title: Ge
1124
+ }, qe = ({ components: e, className: n, flows: r, googleApiKey: i, language: a, onChange: s, onSubmit: c, theme: l, validate: u, validationMode: d, initialValues: f = {} }) => {
1125
+ let { canSubmit: p, clearSubmitMessage: m, config: h, firstErrorFieldId: g, formErrors: _, formValues: v, handleSubmit: y, inputNodes: b, isSubmitting: ee, mergedFlow: te, missingRequiredFields: x, setFieldValue: S, submitMessage: C, t: w, visibleNodes: T, visibleRootNodes: E } = O({
1126
+ components: e,
1127
+ flows: r,
1128
+ googleApiKey: i,
1129
+ initialValues: f,
1130
+ language: a,
1131
+ onChange: s,
1132
+ onSubmit: c,
1133
+ theme: l,
1134
+ validate: u,
1135
+ validationMode: d
1136
+ }), { FormWrapper: D, SubmitButton: ne, SubmitButtonWrapper: k, renderNode: A } = F({
1137
+ config: h,
1138
+ DefaultFormWrapper: fe,
1139
+ DefaultGroup: Y,
1140
+ DefaultSubmitButton: Fe,
1141
+ DefaultSubmitButtonWrapper: Ie,
1142
+ defaultInputRenderers: Ue,
1143
+ defaultUI: Ke,
1144
+ formErrors: _,
1145
+ formValues: v,
1146
+ missingRequiredFields: x,
1147
+ setFieldValue: S,
1148
+ visibleNodes: T
1149
+ }), re = ie(async (e) => {
1150
+ e.preventDefault(), !await y() && g && document.getElementById(g)?.focus();
1151
+ }, [y, g]);
1152
+ return /* @__PURE__ */ (0, J.jsx)("div", {
1153
+ className: o("treege", n),
1154
+ children: /* @__PURE__ */ (0, J.jsx)(t, {
1155
+ theme: h.theme,
1156
+ storageKey: "treege-renderer-theme",
1157
+ children: /* @__PURE__ */ (0, J.jsxs)(P, {
1158
+ value: {
1159
+ flows: te,
1160
+ formErrors: _,
1161
+ formValues: v,
1162
+ googleApiKey: h.googleApiKey,
1163
+ inputNodes: b,
1164
+ language: h.language,
1165
+ setFieldValue: S
1166
+ },
1167
+ children: [/* @__PURE__ */ (0, J.jsxs)(D, {
1168
+ onSubmit: re,
1169
+ children: [
1170
+ E.map((e) => A(e)),
1171
+ p && /* @__PURE__ */ (0, J.jsx)(k, {
1172
+ missingFields: x,
1173
+ children: /* @__PURE__ */ (0, J.jsx)(ne, {
1174
+ label: w("renderer.defaultSubmitButton.submit"),
1175
+ disabled: ee
1176
+ })
1177
+ }),
1178
+ /* @__PURE__ */ (0, J.jsx)("p", {
1179
+ className: "py-2 text-muted-foreground text-xs",
1180
+ children: "Powered by Treege"
1181
+ })
1182
+ ]
1183
+ }), C && /* @__PURE__ */ (0, J.jsx)("div", {
1184
+ className: `my-4 rounded-md p-4 ${C.type === "success" ? "bg-green-50 text-green-800 dark:bg-green-900/20 dark:text-green-300" : "bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,
1185
+ role: "alert",
1186
+ children: /* @__PURE__ */ (0, J.jsxs)("div", {
1187
+ className: "flex items-center justify-between",
1188
+ children: [/* @__PURE__ */ (0, J.jsx)("p", {
1189
+ className: "font-medium text-sm",
1190
+ children: C.message
1191
+ }), /* @__PURE__ */ (0, J.jsx)("button", {
1192
+ type: "button",
1193
+ onClick: m,
1194
+ className: "ml-4 font-medium text-sm underline hover:no-underline focus:outline-none",
1195
+ children: w("common.close")
1196
+ })]
1197
+ })
1198
+ })]
1199
+ })
1200
+ })
1201
+ });
1202
+ };
1203
+ //#endregion
1204
+ export { Y as C, he as S, ve as _, Ue as a, Z as b, Be as c, Pe as d, Ne as f, ye as g, Oe as h, Ke as i, ze as l, ke as m, We as n, He as o, Ae as p, Ge as r, Ve as s, qe as t, Re as u, $ as v, X as x, _e as y };