@golemui/gui-shared 0.0.2 → 0.12.0

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 (130) hide show
  1. package/README.md +15 -6
  2. package/index.d.ts +4 -3
  3. package/index.js +2363 -104
  4. package/index.umd.cjs +1 -1
  5. package/lib/dx/__tests__/helpers.d.ts +30 -0
  6. package/lib/dx/core/defineShortcutType.d.ts +38 -0
  7. package/lib/dx/core/dx.domain.d.ts +76 -0
  8. package/lib/dx/core/dxBase.types.d.ts +107 -0
  9. package/lib/dx/core/dxPropsHelper.d.ts +9 -0
  10. package/lib/dx/core/dxUtilityTypes.d.ts +40 -0
  11. package/lib/dx/core/dxValidatorHelper.d.ts +18 -0
  12. package/lib/dx/core/eventWiring.service.d.ts +22 -0
  13. package/lib/dx/core/itemTypeRegistry.d.ts +82 -0
  14. package/lib/dx/core/itemWalker.service.d.ts +31 -0
  15. package/lib/dx/core/selectorNormalizer.service.d.ts +15 -0
  16. package/lib/dx/core/selectorResolver.service.d.ts +11 -0
  17. package/lib/dx/core/sharedSensibleDefaults.service.d.ts +35 -0
  18. package/lib/dx/core/stateExpansion.service.d.ts +31 -0
  19. package/lib/dx/core/widgetMapper.service.d.ts +13 -0
  20. package/lib/dx/core/widgetMerger.service.d.ts +14 -0
  21. package/lib/dx/dx.service.d.ts +40 -0
  22. package/lib/dx/formDef.domain.d.ts +52 -0
  23. package/lib/dx/gui.d.ts +74 -0
  24. package/lib/dx/index.d.ts +100 -0
  25. package/lib/dx/registerAll.d.ts +0 -0
  26. package/lib/dx/resolveFormInput.d.ts +37 -0
  27. package/lib/dx/shortcuts/accordion/accordion.domain.d.ts +20 -0
  28. package/lib/dx/shortcuts/accordion/guiAccordion.impl.d.ts +12 -0
  29. package/lib/dx/shortcuts/accordion/register.d.ts +2 -0
  30. package/lib/dx/shortcuts/actions/actions.domain.d.ts +21 -0
  31. package/lib/dx/shortcuts/actions/guiActions.impl.d.ts +7 -0
  32. package/lib/dx/shortcuts/actions/register.d.ts +2 -0
  33. package/lib/dx/shortcuts/alert/alert.domain.d.ts +9 -0
  34. package/lib/dx/shortcuts/alert/guiAlert.impl.d.ts +6 -0
  35. package/lib/dx/shortcuts/alert/register.d.ts +2 -0
  36. package/lib/dx/shortcuts/calendar/calendar.domain.d.ts +21 -0
  37. package/lib/dx/shortcuts/calendar/calendarSensibleDefaults.service.d.ts +6 -0
  38. package/lib/dx/shortcuts/calendar/guiCalendar.impl.d.ts +6 -0
  39. package/lib/dx/shortcuts/calendar/register.d.ts +2 -0
  40. package/lib/dx/shortcuts/checkbox/checkbox.domain.d.ts +16 -0
  41. package/lib/dx/shortcuts/checkbox/guiCheckbox.impl.d.ts +6 -0
  42. package/lib/dx/shortcuts/checkbox/register.d.ts +2 -0
  43. package/lib/dx/shortcuts/currency/currency.domain.d.ts +17 -0
  44. package/lib/dx/shortcuts/currency/guiCurrency.impl.d.ts +6 -0
  45. package/lib/dx/shortcuts/currency/register.d.ts +2 -0
  46. package/lib/dx/shortcuts/custom-action/customAction.domain.d.ts +14 -0
  47. package/lib/dx/shortcuts/custom-action/guiCustomAction.impl.d.ts +6 -0
  48. package/lib/dx/shortcuts/custom-action/register.d.ts +2 -0
  49. package/lib/dx/shortcuts/custom-display/customDisplay.domain.d.ts +9 -0
  50. package/lib/dx/shortcuts/custom-display/guiCustomDisplay.impl.d.ts +8 -0
  51. package/lib/dx/shortcuts/custom-display/register.d.ts +2 -0
  52. package/lib/dx/shortcuts/custom-input/customInput.domain.d.ts +16 -0
  53. package/lib/dx/shortcuts/custom-input/guiCustomInput.impl.d.ts +6 -0
  54. package/lib/dx/shortcuts/custom-input/register.d.ts +2 -0
  55. package/lib/dx/shortcuts/custom-layout/customLayout.domain.d.ts +13 -0
  56. package/lib/dx/shortcuts/custom-layout/guiCustomLayout.impl.d.ts +7 -0
  57. package/lib/dx/shortcuts/custom-layout/register.d.ts +2 -0
  58. package/lib/dx/shortcuts/date-input/dateInput.domain.d.ts +16 -0
  59. package/lib/dx/shortcuts/date-input/guiDateInput.impl.d.ts +6 -0
  60. package/lib/dx/shortcuts/date-input/register.d.ts +2 -0
  61. package/lib/dx/shortcuts/date-picker/datePicker.domain.d.ts +17 -0
  62. package/lib/dx/shortcuts/date-picker/guiDatePicker.impl.d.ts +7 -0
  63. package/lib/dx/shortcuts/date-picker/register.d.ts +2 -0
  64. package/lib/dx/shortcuts/display/display.domain.d.ts +13 -0
  65. package/lib/dx/shortcuts/display/guiDisplay.impl.d.ts +3 -0
  66. package/lib/dx/shortcuts/display/register.d.ts +2 -0
  67. package/lib/dx/shortcuts/dropdown/dropdown.domain.d.ts +18 -0
  68. package/lib/dx/shortcuts/dropdown/guiDropdown.impl.d.ts +7 -0
  69. package/lib/dx/shortcuts/dropdown/register.d.ts +2 -0
  70. package/lib/dx/shortcuts/inputs/gslInputSubtypes.d.ts +4 -0
  71. package/lib/dx/shortcuts/inputs/guiBooleanInput.impl.d.ts +6 -0
  72. package/lib/dx/shortcuts/inputs/guiInputs.impl.d.ts +2 -0
  73. package/lib/dx/shortcuts/inputs/guiNumberInput.impl.d.ts +6 -0
  74. package/lib/dx/shortcuts/inputs/guiTextInput.impl.d.ts +6 -0
  75. package/lib/dx/shortcuts/inputs/inputDefsByKey.service.d.ts +11 -0
  76. package/lib/dx/shortcuts/inputs/inputSensibleDefaults.service.d.ts +9 -0
  77. package/lib/dx/shortcuts/inputs/inputTypeDefaults.service.d.ts +9 -0
  78. package/lib/dx/shortcuts/inputs/inputs.domain.d.ts +51 -0
  79. package/lib/dx/shortcuts/inputs/register.d.ts +2 -0
  80. package/lib/dx/shortcuts/layouts/guiFlex.impl.d.ts +8 -0
  81. package/lib/dx/shortcuts/layouts/layouts.domain.d.ts +31 -0
  82. package/lib/dx/shortcuts/layouts/register.d.ts +2 -0
  83. package/lib/dx/shortcuts/list/guiList.impl.d.ts +7 -0
  84. package/lib/dx/shortcuts/list/list.domain.d.ts +17 -0
  85. package/lib/dx/shortcuts/list/register.d.ts +2 -0
  86. package/lib/dx/shortcuts/markdown/guiMarkdown.impl.d.ts +6 -0
  87. package/lib/dx/shortcuts/markdown/markdown.domain.d.ts +17 -0
  88. package/lib/dx/shortcuts/markdown/register.d.ts +2 -0
  89. package/lib/dx/shortcuts/password/guiPassword.impl.d.ts +6 -0
  90. package/lib/dx/shortcuts/password/password.domain.d.ts +17 -0
  91. package/lib/dx/shortcuts/password/register.d.ts +2 -0
  92. package/lib/dx/shortcuts/radiogroup/guiRadiogroup.impl.d.ts +7 -0
  93. package/lib/dx/shortcuts/radiogroup/radiogroup.domain.d.ts +17 -0
  94. package/lib/dx/shortcuts/radiogroup/register.d.ts +2 -0
  95. package/lib/dx/shortcuts/range-calendar/guiRangeCalendar.impl.d.ts +6 -0
  96. package/lib/dx/shortcuts/range-calendar/rangeCalendar.domain.d.ts +16 -0
  97. package/lib/dx/shortcuts/range-calendar/register.d.ts +2 -0
  98. package/lib/dx/shortcuts/range-date-input/guiRangeDateInput.impl.d.ts +6 -0
  99. package/lib/dx/shortcuts/range-date-input/rangeDateInput.domain.d.ts +16 -0
  100. package/lib/dx/shortcuts/range-date-input/register.d.ts +2 -0
  101. package/lib/dx/shortcuts/range-date-picker/guiRangeDatePicker.impl.d.ts +6 -0
  102. package/lib/dx/shortcuts/range-date-picker/rangeDatePicker.domain.d.ts +17 -0
  103. package/lib/dx/shortcuts/range-date-picker/register.d.ts +2 -0
  104. package/lib/dx/shortcuts/repeater/guiRepeater.impl.d.ts +6 -0
  105. package/lib/dx/shortcuts/repeater/register.d.ts +3 -0
  106. package/lib/dx/shortcuts/repeater/repeater.domain.d.ts +21 -0
  107. package/lib/dx/shortcuts/scopes/gslStates.impl.d.ts +11 -0
  108. package/lib/dx/shortcuts/scopes/gslTag.impl.d.ts +2 -0
  109. package/lib/dx/shortcuts/scopes/scopeChain.d.ts +99 -0
  110. package/lib/dx/shortcuts/select/guiSelect.impl.d.ts +7 -0
  111. package/lib/dx/shortcuts/select/register.d.ts +2 -0
  112. package/lib/dx/shortcuts/select/select.domain.d.ts +18 -0
  113. package/lib/dx/shortcuts/tabs/guiTabs.impl.d.ts +12 -0
  114. package/lib/dx/shortcuts/tabs/register.d.ts +2 -0
  115. package/lib/dx/shortcuts/tabs/tabs.domain.d.ts +17 -0
  116. package/lib/dx/shortcuts/textarea/guiTextarea.impl.d.ts +6 -0
  117. package/lib/dx/shortcuts/textarea/register.d.ts +2 -0
  118. package/lib/dx/shortcuts/textarea/textarea.domain.d.ts +17 -0
  119. package/lib/golem-form.d.ts +18 -3
  120. package/lib/shared.d.ts +13 -0
  121. package/lib/utils/index.d.ts +2 -0
  122. package/lib/utils/objectUtils.service.d.ts +11 -0
  123. package/lib/utils/repeater.d.ts +9 -0
  124. package/lib/utils/schema.d.ts +14 -0
  125. package/lib/widget.factory.d.ts +4 -2
  126. package/lib/widget.props.d.ts +99 -7
  127. package/lib/widgets.d.ts +9 -9
  128. package/package.json +8 -3
  129. package/CHANGELOG.md +0 -11
  130. package/lib/middleware/json-schema-vanilla.d.ts +0 -2
package/index.js CHANGED
@@ -1,179 +1,2438 @@
1
- class a {
2
- create(e) {
1
+ const h = {
2
+ INPUTS: "INPUTS",
3
+ ACTIONS: "ACTIONS",
4
+ LAYOUTS: "LAYOUTS",
5
+ DISPLAYS: "DISPLAYS"
6
+ };
7
+ function se(e, t, n) {
8
+ if (typeof t == "function") {
9
+ const i = t;
10
+ return {
11
+ items: [{ key: e, def: (l) => ({ type: "text", ...i(l) }) }],
12
+ type: "ITEMS",
13
+ itemType: h.INPUTS,
14
+ tags: n ?? []
15
+ };
16
+ }
17
+ const s = { type: "text", ...t };
18
+ return {
19
+ items: [{ key: e, def: s }],
20
+ type: "ITEMS",
21
+ itemType: h.INPUTS,
22
+ tags: n ?? []
23
+ };
24
+ }
25
+ function ie(e, t, n) {
26
+ if (typeof t == "function") {
27
+ const i = t;
28
+ return {
29
+ items: [{ key: e, def: (l) => ({ type: "number", ...i(l) }) }],
30
+ type: "ITEMS",
31
+ itemType: h.INPUTS,
32
+ tags: n ?? []
33
+ };
34
+ }
35
+ const s = { type: "number", ...t };
36
+ return {
37
+ items: [{ key: e, def: s }],
38
+ type: "ITEMS",
39
+ itemType: h.INPUTS,
40
+ tags: n ?? []
41
+ };
42
+ }
43
+ function re(e, t, n) {
44
+ if (typeof t == "function") {
45
+ const i = t;
46
+ return {
47
+ items: [{ key: e, def: (l) => ({ type: "boolean", ...i(l) }) }],
48
+ type: "ITEMS",
49
+ itemType: h.INPUTS,
50
+ tags: n ?? []
51
+ };
52
+ }
53
+ const s = { type: "boolean", ...t };
54
+ return {
55
+ items: [{ key: e, def: s }],
56
+ type: "ITEMS",
57
+ itemType: h.INPUTS,
58
+ tags: n ?? []
59
+ };
60
+ }
61
+ function le(e, t, n) {
62
+ if (typeof t == "function") {
63
+ const r = t;
64
+ return { type: "ITEMS", itemType: "SELECT", items: [{ key: e, def: (a) => ({ type: "select", ...r(a) }) }], tags: n ?? [] };
65
+ }
66
+ const s = { type: "select", ...t };
67
+ return { type: "ITEMS", itemType: "SELECT", items: [{ key: e, def: s }], tags: n ?? [] };
68
+ }
69
+ function ae(e, t, n) {
70
+ if (typeof t == "function") {
71
+ const r = t;
72
+ return { type: "ITEMS", itemType: "DROPDOWN", items: [{ key: e, def: (a) => ({
73
+ type: "dropdown",
74
+ ...r(a)
75
+ }) }], tags: n ?? [] };
76
+ }
77
+ const s = { type: "dropdown", ...t };
78
+ return { type: "ITEMS", itemType: "DROPDOWN", items: [{ key: e, def: s }], tags: n ?? [] };
79
+ }
80
+ function oe(e, t, n) {
81
+ if (typeof t == "function") {
82
+ const r = t;
83
+ return { type: "ITEMS", itemType: "RADIOGROUP", items: [{ key: e, def: (a) => ({ type: "radiogroup", ...r(a) }) }], tags: n ?? [] };
84
+ }
85
+ const s = { type: "radiogroup", ...t };
86
+ return { type: "ITEMS", itemType: "RADIOGROUP", items: [{ key: e, def: s }], tags: n ?? [] };
87
+ }
88
+ function ue(e, t, n) {
89
+ if (typeof t == "function") {
90
+ const r = t;
91
+ return { type: "ITEMS", itemType: "CHECKBOX", items: [{ key: e, def: (a) => ({ type: "checkbox", ...r(a) }) }], tags: n ?? [] };
92
+ }
93
+ const s = { type: "checkbox", ...t };
94
+ return { type: "ITEMS", itemType: "CHECKBOX", items: [{ key: e, def: s }], tags: n ?? [] };
95
+ }
96
+ function ce(e, t, n) {
97
+ if (typeof t == "function") {
98
+ const r = t;
99
+ return { type: "ITEMS", itemType: "TEXTAREA", items: [{ key: e, def: (a) => ({ type: "textarea", ...r(a) }) }], tags: n ?? [] };
100
+ }
101
+ const s = { type: "textarea", ...t };
102
+ return { type: "ITEMS", itemType: "TEXTAREA", items: [{ key: e, def: s }], tags: n ?? [] };
103
+ }
104
+ function pe(e, t, n) {
105
+ if (typeof t == "function") {
106
+ const r = t;
107
+ return { type: "ITEMS", itemType: "PASSWORD", items: [{ key: e, def: (a) => ({ type: "password", ...r(a) }) }], tags: n ?? [] };
108
+ }
109
+ const s = { type: "password", ...t };
110
+ return { type: "ITEMS", itemType: "PASSWORD", items: [{ key: e, def: s }], tags: n ?? [] };
111
+ }
112
+ function de(e, t, n) {
113
+ if (typeof t == "function") {
114
+ const r = t;
115
+ return { type: "ITEMS", itemType: "CURRENCY", items: [{ key: e, def: (a) => ({ type: "currency", ...r(a) }) }], tags: n ?? [] };
116
+ }
117
+ const s = { type: "currency", ...t };
118
+ return { type: "ITEMS", itemType: "CURRENCY", items: [{ key: e, def: s }], tags: n ?? [] };
119
+ }
120
+ function ye(e, t, n) {
121
+ if (typeof t == "function") {
122
+ const r = t;
123
+ return { type: "ITEMS", itemType: "MARKDOWN", items: [{ key: e, def: (a) => ({ type: "markdown", ...r(a) }) }], tags: n ?? [] };
124
+ }
125
+ const s = { type: "markdown", ...t };
126
+ return { type: "ITEMS", itemType: "MARKDOWN", items: [{ key: e, def: s }], tags: n ?? [] };
127
+ }
128
+ function me(e, t, n) {
129
+ if (typeof t == "function") {
130
+ const r = t;
131
+ return { type: "ITEMS", itemType: "LIST", items: [{ key: e, def: (a) => ({ type: "list", ...r(a) }) }], tags: n ?? [] };
132
+ }
133
+ const s = { type: "list", ...t };
134
+ return { type: "ITEMS", itemType: "LIST", items: [{ key: e, def: s }], tags: n ?? [] };
135
+ }
136
+ function ge(e, t, n) {
137
+ if (typeof t == "function") {
138
+ const i = t;
139
+ return {
140
+ items: [(l) => ({
141
+ type: "calendar",
142
+ path: e,
143
+ ...i(l)
144
+ })],
145
+ type: "ITEMS",
146
+ itemType: "CALENDAR",
147
+ tags: n ?? []
148
+ };
149
+ }
150
+ return {
151
+ items: [{ type: "calendar", path: e, ...t }],
152
+ type: "ITEMS",
153
+ itemType: "CALENDAR",
154
+ tags: n ?? []
155
+ };
156
+ }
157
+ function be(e, t, n) {
158
+ if (typeof t == "function") {
159
+ const r = t;
160
+ return { type: "ITEMS", itemType: "DATE_INPUT", items: [{ key: e, def: (a) => ({ type: "dateInput", ...r(a) }) }], tags: n ?? [] };
161
+ }
162
+ const s = { type: "dateInput", ...t };
163
+ return { type: "ITEMS", itemType: "DATE_INPUT", items: [{ key: e, def: s }], tags: n ?? [] };
164
+ }
165
+ function fe(e, t, n) {
166
+ if (typeof t == "function") {
167
+ const r = t;
168
+ return { type: "ITEMS", itemType: "DATE_PICKER", items: [{ key: e, def: (a) => ({
169
+ type: "datePicker",
170
+ ...r(a)
171
+ }) }], tags: n ?? [] };
172
+ }
173
+ const s = { type: "datePicker", ...t };
174
+ return { type: "ITEMS", itemType: "DATE_PICKER", items: [{ key: e, def: s }], tags: n ?? [] };
175
+ }
176
+ function he(e, t, n) {
177
+ if (typeof t == "function") {
178
+ const r = t;
179
+ return { type: "ITEMS", itemType: "RANGE_CALENDAR", items: [{ key: e, def: (a) => ({
180
+ type: "rangeCalendar",
181
+ ...r(a)
182
+ }) }], tags: n ?? [] };
183
+ }
184
+ const s = { type: "rangeCalendar", ...t };
185
+ return { type: "ITEMS", itemType: "RANGE_CALENDAR", items: [{ key: e, def: s }], tags: n ?? [] };
186
+ }
187
+ function Te(e, t, n) {
188
+ if (typeof t == "function") {
189
+ const r = t;
190
+ return { type: "ITEMS", itemType: "RANGE_DATE_INPUT", items: [{ key: e, def: (a) => ({
191
+ type: "rangeDateInput",
192
+ ...r(a)
193
+ }) }], tags: n ?? [] };
194
+ }
195
+ const s = { type: "rangeDateInput", ...t };
196
+ return { type: "ITEMS", itemType: "RANGE_DATE_INPUT", items: [{ key: e, def: s }], tags: n ?? [] };
197
+ }
198
+ function Se(e, t, n) {
199
+ if (typeof t == "function") {
200
+ const r = t;
201
+ return { type: "ITEMS", itemType: "RANGE_DATE_PICKER", items: [{ key: e, def: (a) => ({
202
+ type: "rangeDatePicker",
203
+ ...r(a)
204
+ }) }], tags: n ?? [] };
205
+ }
206
+ const s = { type: "rangeDatePicker", ...t };
207
+ return { type: "ITEMS", itemType: "RANGE_DATE_PICKER", items: [{ key: e, def: s }], tags: n ?? [] };
208
+ }
209
+ function Ae(e, t, n, s) {
210
+ if (typeof n == "function") {
211
+ const l = n;
212
+ return { type: "ITEMS", itemType: "CUSTOM_INPUT", items: [{ key: t, def: (u) => ({
213
+ customType: e,
214
+ ...l(u)
215
+ }) }], tags: s ?? [] };
216
+ }
217
+ const i = { customType: e, ...n };
218
+ return { type: "ITEMS", itemType: "CUSTOM_INPUT", items: [{ key: t, def: i }], tags: s ?? [] };
219
+ }
220
+ class ke {
221
+ /**
222
+ * Deep merges two objects, with right taking precedence over left when properties conflict.
223
+ * Arrays are replaced, not merged.
224
+ * @param left - The base object
225
+ * @param right - The object whose properties take precedence
226
+ * @returns A new merged object
227
+ */
228
+ deepMerge(t, n) {
229
+ if (n == null)
230
+ return t;
231
+ if (t == null || typeof t != "object" || typeof n != "object" || Array.isArray(t) || Array.isArray(n))
232
+ return n;
233
+ const s = { ...t };
234
+ for (const i in n)
235
+ Object.prototype.hasOwnProperty.call(n, i) && (typeof n[i] == "object" && !Array.isArray(n[i]) && n[i] !== null && typeof t[i] == "object" && !Array.isArray(t[i]) && t[i] !== null ? s[i] = this.deepMerge(t[i], n[i]) : s[i] = n[i]);
236
+ return s;
237
+ }
238
+ }
239
+ const G = new ke();
240
+ function K(e, t) {
241
+ return {
242
+ items: [e],
243
+ type: "ITEMS",
244
+ itemType: h.ACTIONS,
245
+ tags: t ?? []
246
+ };
247
+ }
248
+ const V = (e) => {
249
+ const t = {
250
+ uid: "#submit",
251
+ label: "Submit"
252
+ }, n = e != null ? G.deepMerge(t, e) : t;
253
+ return K(n);
254
+ };
255
+ function _e(e, t, n) {
256
+ if (typeof t == "function") {
257
+ const r = t;
258
+ return { type: "ITEMS", itemType: "CUSTOM_ACTION", items: [
259
+ (o) => ({ customType: e, ...r(o) })
260
+ ], tags: n ?? [] };
261
+ }
262
+ return { type: "ITEMS", itemType: "CUSTOM_ACTION", items: [{ customType: e, ...t }], tags: n ?? [] };
263
+ }
264
+ const H = (e, t) => ({
265
+ type: "ITEMS",
266
+ itemType: h.DISPLAYS,
267
+ items: [{ render: e }],
268
+ tags: t ?? []
269
+ });
270
+ function Ie(e, t) {
271
+ return { type: "ITEMS", itemType: "ALERTS", items: [e], tags: t ?? [] };
272
+ }
273
+ function Ee(e, t, n) {
274
+ if (typeof t == "function") {
275
+ const o = t;
276
+ return { type: "ITEMS", itemType: "CUSTOM_DISPLAY", items: [
277
+ (u) => ({ customType: e, ...o(u) })
278
+ ], tags: n ?? [] };
279
+ }
280
+ const { uid: s, ...i } = t ?? {};
281
+ return { type: "ITEMS", itemType: "CUSTOM_DISPLAY", items: [{
282
+ customType: e,
283
+ ...s != null ? { uid: s } : {},
284
+ props: Object.keys(i).length > 0 ? i : void 0
285
+ }], tags: n ?? [] };
286
+ }
287
+ const L = (e, t, n) => ({
288
+ type: "ITEMS",
289
+ itemType: h.LAYOUTS,
290
+ items: [{ def: { widgetName: "flex", ...t ?? {} }, children: e }],
291
+ tags: n ?? []
292
+ }), Ue = (e, t, n) => L(e, { direction: "row", ...t ?? {} }, n), De = (e, t, n) => L(e, { direction: "column", ...t ?? {} }, n), B = (e, t, n) => ({
293
+ type: "ITEMS",
294
+ itemType: h.LAYOUTS,
295
+ items: [
296
+ {
297
+ def: {
298
+ widgetName: "grid",
299
+ direction: "row",
300
+ autoFit: !0,
301
+ ...t ?? {}
302
+ },
303
+ children: e
304
+ }
305
+ ],
306
+ tags: n ?? []
307
+ }), Pe = (e, t, n) => B(e, { direction: "row", ...t ?? {} }, n), Ce = (e, t, n) => B(e, { direction: "column", ...t ?? {} }, n);
308
+ function x(e) {
309
+ return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
310
+ }
311
+ function ve(e, t, n) {
312
+ const s = e.map((l) => ({
313
+ label: l.label,
314
+ uid: l.uid ?? x(l.label)
315
+ })), i = e.map((l) => ({
316
+ type: "ITEMS",
317
+ itemType: h.LAYOUTS,
318
+ items: [
319
+ {
320
+ def: { uid: l.uid ?? x(l.label), direction: "column", widgetName: "flex" },
321
+ children: l.children
322
+ }
323
+ ],
324
+ tags: []
325
+ }));
326
+ return {
327
+ type: "ITEMS",
328
+ itemType: "TABS",
329
+ items: [{ def: {
330
+ tabs: s,
331
+ ...t
332
+ }, children: i }],
333
+ tags: n ?? []
334
+ };
335
+ }
336
+ function F(e) {
337
+ return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
338
+ }
339
+ function we(e, t, n) {
340
+ const s = e.map((l) => ({
341
+ label: l.label,
342
+ uid: l.uid ?? F(l.label)
343
+ })), i = e.map((l) => ({
344
+ type: "ITEMS",
345
+ itemType: h.LAYOUTS,
346
+ items: [
347
+ {
348
+ def: { uid: l.uid ?? F(l.label), direction: "column", widgetName: "flex" },
349
+ children: l.children
350
+ }
351
+ ],
352
+ tags: []
353
+ }));
354
+ return {
355
+ type: "ITEMS",
356
+ itemType: "ACCORDION",
357
+ items: [{ def: {
358
+ sections: s,
359
+ ...t
360
+ }, children: i }],
361
+ tags: n ?? []
362
+ };
363
+ }
364
+ function Me(e, t, n, s) {
365
+ if (typeof n == "function") {
366
+ const l = n;
367
+ return { type: "ITEMS", itemType: "CUSTOM_LAYOUT", items: [{ def: (u) => ({
368
+ customType: e,
369
+ ...l(u)
370
+ }), children: t }], tags: s ?? [] };
371
+ }
372
+ return { type: "ITEMS", itemType: "CUSTOM_LAYOUT", items: [{ def: { customType: e, ...n }, children: t }], tags: s ?? [] };
373
+ }
374
+ function Le(e, t, n) {
375
+ const { template: s, ...i } = t;
376
+ return {
377
+ type: "ITEMS",
378
+ itemType: "REPEATER",
379
+ items: [{ key: e, def: i, children: s }],
380
+ tags: n ?? []
381
+ };
382
+ }
383
+ function X(e) {
384
+ return function(t, n = () => !0) {
385
+ return {
386
+ kind: "leaf",
387
+ selectorType: e,
388
+ matcher: n,
389
+ config: t
390
+ };
391
+ };
392
+ }
393
+ const D = /* @__PURE__ */ new Map();
394
+ function Z(e, t) {
395
+ if (D.has(e))
396
+ throw new Error(`Item type "${e}" is already registered.`);
397
+ D.set(e, t);
398
+ }
399
+ function I(e) {
400
+ const t = D.get(e);
401
+ if (!t)
402
+ throw new Error(
403
+ `No handler registered for item type "${e}". Did you forget to import the registration module?`
404
+ );
405
+ return t;
406
+ }
407
+ function q(e) {
408
+ return D.has(e);
409
+ }
410
+ function p(e) {
411
+ const t = (o) => {
412
+ if (!e.sensibleDefaults)
413
+ return {};
414
+ let a = { ...e.sensibleDefaults.base };
415
+ for (const u of o) {
416
+ const c = u.config;
417
+ for (const y of e.sensibleDefaults.fields) {
418
+ const d = y;
419
+ c[d] != null && (a = { ...a, [d]: c[d] });
420
+ }
421
+ }
422
+ return a;
423
+ }, n = (o, a) => e.sensibleDefaults ? e.sensibleDefaults.apply(o, a) : o, s = (o) => {
424
+ switch (e.entryShape) {
425
+ case "bare":
426
+ return { baseDef: o };
427
+ case "keyed": {
428
+ const a = o;
429
+ return { baseDef: a.def, path: a.key };
430
+ }
431
+ case "compound": {
432
+ const a = o;
433
+ return { baseDef: a.def, children: a.children };
434
+ }
435
+ }
436
+ }, i = {
437
+ rollUpSensibleDefaults: t,
438
+ applySensibleDefaults: n,
439
+ mapToWidget: e.mapToWidget,
440
+ parseEntry: s,
441
+ ...e.afterMerge ? { afterMerge: e.afterMerge } : {},
442
+ ...e.buildCustomWidget ? { buildCustomWidget: e.buildCustomWidget } : {},
443
+ ...e.getChildren ? { getChildren: e.getChildren } : {}
444
+ };
445
+ Z(e.itemType, i);
446
+ const r = X(e.itemType);
447
+ return { gsl: r, gslByUid: (o, a) => r(a, ((u) => u.uid === o)) };
448
+ }
449
+ function m(e) {
450
+ const {
451
+ uid: t,
452
+ path: n,
453
+ label: s,
454
+ disabled: i,
455
+ readonly: r,
456
+ defaultValue: l,
457
+ tags: o,
458
+ type: a,
459
+ size: u,
460
+ onLoad: c,
461
+ onChange: y,
462
+ onFilter: d,
463
+ on: T,
464
+ states: E,
465
+ include: U,
466
+ exclude: R,
467
+ validator: N,
468
+ ...k
469
+ } = e;
470
+ return k;
471
+ }
472
+ function f(e, t) {
473
+ return typeof e == "function" ? e : { type: t, ...e ?? {} };
474
+ }
475
+ function Be(e) {
476
+ return e ? e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (t) => t.toUpperCase()) : "";
477
+ }
478
+ function g(e, t) {
479
+ return e.label != null || t.suppressAutomaticLabels || !e.path ? e : { ...e, label: Be(e.path) };
480
+ }
481
+ function A(e, t) {
482
+ return e.placeholder != null || t.suppressAutomaticPlaceholders || !e.path ? e : { ...e, placeholder: e.path };
483
+ }
484
+ function Oe(e) {
485
+ switch (e.type) {
486
+ case "text":
487
+ return Ne(e);
488
+ case "number":
489
+ return We(e);
490
+ case "boolean":
491
+ return Re(e);
492
+ default:
493
+ throw new Error(`Unsupported field type "${e.type}"`);
494
+ }
495
+ }
496
+ function Re(e) {
497
+ const t = m(e);
498
+ return {
499
+ uid: e.uid ?? "",
500
+ kind: "input",
501
+ type: "toggle",
502
+ path: e.path ?? "",
503
+ ...e.label != null ? { label: e.label } : {},
504
+ ...e.disabled != null ? { disabled: e.disabled } : {},
505
+ ...e.readonly != null ? { readonly: e.readonly } : {},
506
+ ...e.validator != null ? { validator: f(e.validator, "boolean") } : {},
507
+ props: t
508
+ };
509
+ }
510
+ function Ne(e) {
511
+ const t = m(e);
512
+ return {
513
+ uid: e.uid ?? "",
514
+ kind: "input",
515
+ type: "textinput",
516
+ path: e.path ?? "",
517
+ ...e.label != null ? { label: e.label } : {},
518
+ ...e.disabled != null ? { disabled: e.disabled } : {},
519
+ ...e.readonly != null ? { readonly: e.readonly } : {},
520
+ props: {
521
+ placeholder: t.placeholder ?? "",
522
+ ...t
523
+ },
524
+ validator: f(e.validator, "string")
525
+ };
526
+ }
527
+ function We(e) {
528
+ const t = m(e);
529
+ return {
530
+ uid: e.uid ?? "",
531
+ kind: "input",
532
+ type: "number",
533
+ path: e.path ?? "",
534
+ ...e.label != null ? { label: e.label } : {},
535
+ ...e.disabled != null ? { disabled: e.disabled } : {},
536
+ ...e.readonly != null ? { readonly: e.readonly } : {},
537
+ props: {
538
+ placeholder: t.placeholder ?? "",
539
+ ...t
540
+ },
541
+ validator: f(e.validator, "number")
542
+ };
543
+ }
544
+ const { gsl: P, gslByUid: xe } = p({
545
+ itemType: "INPUTS",
546
+ entryShape: "keyed",
547
+ sensibleDefaults: {
548
+ base: {
549
+ suppressAutomaticLabels: !1,
550
+ suppressAutomaticPlaceholders: !1
551
+ },
552
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
553
+ apply: (e, t) => {
554
+ let n = g(e, t);
555
+ return n = A(n, t), n;
556
+ }
557
+ },
558
+ mapToWidget: Oe
559
+ }), Fe = (e) => P(e, (t) => t.type === "text"), $e = (e) => P(e, (t) => t.type === "number"), je = (e) => P(e, (t) => t.type === "boolean"), { gsl: Ye, gslByUid: ze } = p({
560
+ itemType: "SELECT",
561
+ entryShape: "keyed",
562
+ sensibleDefaults: {
563
+ base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
564
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
565
+ apply: (e, t) => A(g(e, t), t)
566
+ },
567
+ mapToWidget: (e) => ({
568
+ uid: e.uid ?? "",
569
+ kind: "input",
570
+ type: "select",
571
+ path: e.path ?? "",
572
+ ...e.label != null ? { label: e.label } : {},
573
+ ...e.disabled != null ? { disabled: e.disabled } : {},
574
+ ...e.readonly != null ? { readonly: e.readonly } : {},
575
+ ...e.validator != null ? { validator: e.validator } : {},
576
+ props: m(e)
577
+ })
578
+ }), { gsl: Ge, gslByUid: Ke } = p({
579
+ itemType: "DROPDOWN",
580
+ entryShape: "keyed",
581
+ sensibleDefaults: {
582
+ base: {
583
+ suppressAutomaticLabels: !1,
584
+ suppressAutomaticPlaceholders: !1
585
+ },
586
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
587
+ apply: (e, t) => A(g(e, t), t)
588
+ },
589
+ mapToWidget: (e) => ({
590
+ uid: e.uid ?? "",
591
+ kind: "input",
592
+ type: "dropdown",
593
+ path: e.path ?? "",
594
+ ...e.label != null ? { label: e.label } : {},
595
+ ...e.disabled != null ? { disabled: e.disabled } : {},
596
+ ...e.readonly != null ? { readonly: e.readonly } : {},
597
+ ...e.validator != null ? { validator: e.validator } : {},
598
+ props: m(e)
599
+ })
600
+ }), { gsl: Ve, gslByUid: He } = p({
601
+ itemType: "RADIOGROUP",
602
+ entryShape: "keyed",
603
+ sensibleDefaults: {
604
+ base: { suppressAutomaticLabels: !1 },
605
+ fields: ["suppressAutomaticLabels"],
606
+ apply: (e, t) => g(e, t)
607
+ },
608
+ mapToWidget: (e) => ({
609
+ uid: e.uid ?? "",
610
+ kind: "input",
611
+ type: "radiogroup",
612
+ path: e.path ?? "",
613
+ ...e.label != null ? { label: e.label } : {},
614
+ ...e.disabled != null ? { disabled: e.disabled } : {},
615
+ ...e.readonly != null ? { readonly: e.readonly } : {},
616
+ ...e.validator != null ? { validator: e.validator } : {},
617
+ props: m(e)
618
+ })
619
+ }), { gsl: Xe, gslByUid: Ze } = p({
620
+ itemType: "CHECKBOX",
621
+ entryShape: "keyed",
622
+ sensibleDefaults: {
623
+ base: { suppressAutomaticLabels: !1 },
624
+ fields: ["suppressAutomaticLabels"],
625
+ apply: (e, t) => g(e, t)
626
+ },
627
+ mapToWidget: (e) => ({
628
+ uid: e.uid ?? "",
629
+ kind: "input",
630
+ type: "checkbox",
631
+ path: e.path ?? "",
632
+ ...e.label != null ? { label: e.label } : {},
633
+ ...e.disabled != null ? { disabled: e.disabled } : {},
634
+ ...e.readonly != null ? { readonly: e.readonly } : {},
635
+ ...e.validator != null ? { validator: f(e.validator, "boolean") } : {},
636
+ props: m(e)
637
+ })
638
+ }), { gsl: qe, gslByUid: Qe } = p({
639
+ itemType: "TEXTAREA",
640
+ entryShape: "keyed",
641
+ sensibleDefaults: {
642
+ base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
643
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
644
+ apply: (e, t) => A(g(e, t), t)
645
+ },
646
+ mapToWidget: (e) => ({
647
+ uid: e.uid ?? "",
648
+ kind: "input",
649
+ type: "textarea",
650
+ path: e.path ?? "",
651
+ ...e.label != null ? { label: e.label } : {},
652
+ ...e.disabled != null ? { disabled: e.disabled } : {},
653
+ ...e.readonly != null ? { readonly: e.readonly } : {},
654
+ ...e.validator != null ? { validator: f(e.validator, "string") } : {},
655
+ props: m(e)
656
+ })
657
+ }), { gsl: Je, gslByUid: et } = p({
658
+ itemType: "PASSWORD",
659
+ entryShape: "keyed",
660
+ sensibleDefaults: {
661
+ base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
662
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
663
+ apply: (e, t) => A(g(e, t), t)
664
+ },
665
+ mapToWidget: (e) => ({
666
+ uid: e.uid ?? "",
667
+ kind: "input",
668
+ type: "password",
669
+ path: e.path ?? "",
670
+ ...e.label != null ? { label: e.label } : {},
671
+ ...e.disabled != null ? { disabled: e.disabled } : {},
672
+ ...e.readonly != null ? { readonly: e.readonly } : {},
673
+ ...e.validator != null ? { validator: f(e.validator, "string") } : {},
674
+ props: m(e)
675
+ })
676
+ }), { gsl: tt, gslByUid: nt } = p({
677
+ itemType: "CURRENCY",
678
+ entryShape: "keyed",
679
+ sensibleDefaults: {
680
+ base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
681
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
682
+ apply: (e, t) => A(g(e, t), t)
683
+ },
684
+ mapToWidget: (e) => ({
685
+ uid: e.uid ?? "",
686
+ kind: "input",
687
+ type: "currency",
688
+ path: e.path ?? "",
689
+ ...e.label != null ? { label: e.label } : {},
690
+ ...e.disabled != null ? { disabled: e.disabled } : {},
691
+ ...e.readonly != null ? { readonly: e.readonly } : {},
692
+ ...e.validator != null ? { validator: f(e.validator, "number") } : {},
693
+ props: m(e)
694
+ })
695
+ }), { gsl: st, gslByUid: it } = p({
696
+ itemType: "MARKDOWN",
697
+ entryShape: "keyed",
698
+ sensibleDefaults: {
699
+ base: { suppressAutomaticLabels: !1, suppressAutomaticPlaceholders: !1 },
700
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
701
+ apply: (e, t) => A(g(e, t), t)
702
+ },
703
+ mapToWidget: (e) => ({
704
+ uid: e.uid ?? "",
705
+ kind: "input",
706
+ type: "markdown",
707
+ path: e.path ?? "",
708
+ ...e.label != null ? { label: e.label } : {},
709
+ ...e.disabled != null ? { disabled: e.disabled } : {},
710
+ ...e.readonly != null ? { readonly: e.readonly } : {},
711
+ ...e.validator != null ? { validator: f(e.validator, "string") } : {},
712
+ props: m(e)
713
+ })
714
+ }), { gsl: rt, gslByUid: lt } = p({
715
+ itemType: "LIST",
716
+ entryShape: "keyed",
717
+ sensibleDefaults: {
718
+ base: { suppressAutomaticLabels: !1 },
719
+ fields: ["suppressAutomaticLabels"],
720
+ apply: (e, t) => g(e, t)
721
+ },
722
+ mapToWidget: (e) => ({
723
+ uid: e.uid ?? "",
724
+ kind: "input",
725
+ type: "list",
726
+ path: e.path ?? "",
727
+ ...e.label != null ? { label: e.label } : {},
728
+ ...e.disabled != null ? { disabled: e.disabled } : {},
729
+ ...e.readonly != null ? { readonly: e.readonly } : {},
730
+ ...e.validator != null ? { validator: e.validator } : {},
731
+ props: m(e)
732
+ })
733
+ }), { gsl: at, gslByUid: ot } = p({
734
+ itemType: "CALENDAR",
735
+ entryShape: "bare",
736
+ sensibleDefaults: {
737
+ base: { suppressAutomaticLabels: !1 },
738
+ fields: ["suppressAutomaticLabels"],
739
+ apply: (e, t) => g(e, t)
740
+ },
741
+ mapToWidget: (e) => ({
742
+ uid: e.uid ?? "",
743
+ kind: "input",
744
+ type: "calendar",
745
+ path: e.path ?? "",
746
+ ...e.label != null ? { label: e.label } : {},
747
+ ...e.disabled != null ? { disabled: e.disabled } : {},
748
+ ...e.readonly != null ? { readonly: e.readonly } : {},
749
+ ...e.validator != null ? { validator: f(e.validator, "string") } : {},
750
+ props: m(e)
751
+ })
752
+ }), { gsl: ut, gslByUid: ct } = p({
753
+ itemType: "DATE_INPUT",
754
+ entryShape: "keyed",
755
+ sensibleDefaults: {
756
+ base: { suppressAutomaticLabels: !1 },
757
+ fields: ["suppressAutomaticLabels"],
758
+ apply: (e, t) => g(e, t)
759
+ },
760
+ mapToWidget: (e) => ({
761
+ uid: e.uid ?? "",
762
+ kind: "input",
763
+ type: "dateInput",
764
+ path: e.path ?? "",
765
+ ...e.label != null ? { label: e.label } : {},
766
+ ...e.disabled != null ? { disabled: e.disabled } : {},
767
+ ...e.readonly != null ? { readonly: e.readonly } : {},
768
+ ...e.validator != null ? { validator: f(e.validator, "string") } : {},
769
+ props: m(e)
770
+ })
771
+ }), { gsl: pt, gslByUid: dt } = p({
772
+ itemType: "DATE_PICKER",
773
+ entryShape: "keyed",
774
+ sensibleDefaults: {
775
+ base: {
776
+ suppressAutomaticLabels: !1,
777
+ suppressAutomaticPlaceholders: !1
778
+ },
779
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
780
+ apply: (e, t) => A(g(e, t), t)
781
+ },
782
+ mapToWidget: (e) => ({
783
+ uid: e.uid ?? "",
784
+ kind: "input",
785
+ type: "datePicker",
786
+ path: e.path ?? "",
787
+ ...e.label != null ? { label: e.label } : {},
788
+ ...e.disabled != null ? { disabled: e.disabled } : {},
789
+ ...e.readonly != null ? { readonly: e.readonly } : {},
790
+ ...e.validator != null ? { validator: f(e.validator, "string") } : {},
791
+ props: m(e)
792
+ })
793
+ }), { gsl: yt, gslByUid: mt } = p({
794
+ itemType: "RANGE_CALENDAR",
795
+ entryShape: "keyed",
796
+ sensibleDefaults: {
797
+ base: { suppressAutomaticLabels: !1 },
798
+ fields: ["suppressAutomaticLabels"],
799
+ apply: (e, t) => g(e, t)
800
+ },
801
+ mapToWidget: (e) => ({
802
+ uid: e.uid ?? "",
803
+ kind: "input",
804
+ type: "rangeCalendar",
805
+ path: e.path ?? "",
806
+ ...e.label != null ? { label: e.label } : {},
807
+ ...e.disabled != null ? { disabled: e.disabled } : {},
808
+ ...e.readonly != null ? { readonly: e.readonly } : {},
809
+ ...e.validator != null ? { validator: f(e.validator, "array") } : {},
810
+ props: m(e)
811
+ })
812
+ }), { gsl: gt, gslByUid: bt } = p({
813
+ itemType: "RANGE_DATE_INPUT",
814
+ entryShape: "keyed",
815
+ sensibleDefaults: {
816
+ base: { suppressAutomaticLabels: !1 },
817
+ fields: ["suppressAutomaticLabels"],
818
+ apply: (e, t) => g(e, t)
819
+ },
820
+ mapToWidget: (e) => ({
821
+ uid: e.uid ?? "",
822
+ kind: "input",
823
+ type: "rangeDateInput",
824
+ path: e.path ?? "",
825
+ ...e.label != null ? { label: e.label } : {},
826
+ ...e.disabled != null ? { disabled: e.disabled } : {},
827
+ ...e.readonly != null ? { readonly: e.readonly } : {},
828
+ ...e.validator != null ? { validator: f(e.validator, "array") } : {},
829
+ props: m(e)
830
+ })
831
+ }), { gsl: ft, gslByUid: ht } = p({
832
+ itemType: "RANGE_DATE_PICKER",
833
+ entryShape: "keyed",
834
+ sensibleDefaults: {
835
+ base: {
836
+ suppressAutomaticLabels: !1,
837
+ suppressAutomaticPlaceholders: !1
838
+ },
839
+ fields: ["suppressAutomaticLabels", "suppressAutomaticPlaceholders"],
840
+ apply: (e, t) => A(g(e, t), t)
841
+ },
842
+ mapToWidget: (e) => ({
843
+ uid: e.uid ?? "",
844
+ kind: "input",
845
+ type: "rangeDatePicker",
846
+ path: e.path ?? "",
847
+ ...e.label != null ? { label: e.label } : {},
848
+ ...e.disabled != null ? { disabled: e.disabled } : {},
849
+ ...e.readonly != null ? { readonly: e.readonly } : {},
850
+ ...e.validator != null ? { validator: f(e.validator, "array") } : {},
851
+ props: m(e)
852
+ })
853
+ });
854
+ function Tt(e) {
855
+ const t = {};
856
+ return e.addLabel != null && (t.addLabel = e.addLabel), e.removeLabel != null && (t.removeLabel = e.removeLabel), e.limit != null && (t.limit = e.limit), e.title != null && (t.title = e.title), e.addButtonIcon != null && (t.addButtonIcon = e.addButtonIcon), e.removeButtonIcon != null && (t.removeButtonIcon = e.removeButtonIcon), t;
857
+ }
858
+ function St(e) {
859
+ return {
860
+ uid: e.uid ?? "",
861
+ kind: "input",
862
+ type: "repeater",
863
+ path: e.path ?? "",
864
+ ...e.label != null ? { label: e.label } : {},
865
+ ...e.disabled != null ? { disabled: e.disabled } : {},
866
+ ...e.readonly != null ? { readonly: e.readonly } : {},
867
+ ...e.validator != null ? { validator: f(e.validator, "array") } : {},
868
+ props: {
869
+ ...Tt(e),
870
+ template: { kind: "layout", type: "flex", children: [], props: { direction: "column" } }
871
+ }
872
+ };
873
+ }
874
+ function M(e, t) {
875
+ for (const n of e) {
876
+ if (typeof n == "function") continue;
877
+ const s = n;
878
+ typeof s.path == "string" && s.path && (s.path = t + s.path), "children" in s && Array.isArray(s.children) && M(s.children, t);
879
+ const i = s.props;
880
+ i?.template?.children && Array.isArray(i.template.children) && M(i.template.children, t);
881
+ }
882
+ }
883
+ function At(e, t) {
884
+ const n = t.walkChildren(t.children ?? []), s = e.kind === "static" ? e.def.path ?? "" : e.fn({})?.path ?? "";
885
+ s && M(n, s + ".items.");
886
+ const i = {
887
+ kind: "layout",
888
+ type: "flex",
889
+ uid: "",
890
+ children: n,
891
+ props: { direction: "column" }
892
+ };
893
+ if (e.kind === "static") {
894
+ const l = t.mapStaticDef(e.def, "REPEATER");
895
+ return {
896
+ ...l,
897
+ props: { ...l.props, template: i }
898
+ };
899
+ }
900
+ const r = e.fn;
901
+ return ((l) => {
902
+ const o = r(l), a = t.mapStaticDef(o, "REPEATER");
3
903
  return {
4
- states: e.states,
904
+ ...a,
905
+ props: { ...a.props, template: i }
906
+ };
907
+ });
908
+ }
909
+ function kt(e) {
910
+ return {
911
+ baseDef: e.def,
912
+ path: e.key,
913
+ children: e.children
914
+ };
915
+ }
916
+ function _t(e) {
917
+ return e.children;
918
+ }
919
+ const It = {
920
+ parseEntry: kt,
921
+ rollUpSensibleDefaults: () => ({}),
922
+ applySensibleDefaults: (e) => e,
923
+ mapToWidget: St,
924
+ buildCustomWidget: At,
925
+ getChildren: _t
926
+ };
927
+ Z("REPEATER", It);
928
+ const Q = X("REPEATER"), Et = (e, t) => Q(t, ((n) => n.uid === e)), J = {
929
+ onLoad: "load",
930
+ onChange: "change",
931
+ onFilter: "filter",
932
+ onBlur: "blur"
933
+ }, Ut = Object.keys(J);
934
+ class Dt {
935
+ // ── Action-specific: onClick + submit ─────────────────────────
936
+ extractOnClickFromMergeResult(t, n, s, i) {
937
+ if (t.kind === "dynamic") {
938
+ const o = t.fn;
939
+ return { kind: "dynamic", fn: (u) => {
940
+ const c = o(u);
941
+ return this.wireOnClick(c, n, s, i);
942
+ } };
943
+ }
944
+ const r = t.def;
945
+ return { kind: "static", def: this.wireOnClick(r, n, s, i) };
946
+ }
947
+ countSubmitButtons(t) {
948
+ let n = 0;
949
+ for (const s of t) {
950
+ if (s.type !== "ITEMS") continue;
951
+ const i = I(s.itemType);
952
+ for (const r of s.items) {
953
+ const l = i.getChildren?.(r);
954
+ if (l && (n += this.countSubmitButtons(l)), s.itemType === h.ACTIONS) {
955
+ if (typeof r == "function") continue;
956
+ const o = r;
957
+ (o.uid === "#submit" || o.onClick === "submit") && n++;
958
+ }
959
+ }
960
+ }
961
+ return n;
962
+ }
963
+ wireOnClick(t, n, s, i) {
964
+ const r = t.uid === "#submit" || t.onClick === "submit", l = r ? "#submit" : i.next(), o = r ? "submit" : l, a = t.onClick, c = (typeof a == "function" ? a : void 0) ?? (r ? s.onSubmit : void 0);
965
+ if (c) {
966
+ n.set(o, (T) => c(T.data));
967
+ const { onClick: y, ...d } = t;
968
+ return { ...d, uid: l, on: { click: o } };
969
+ }
970
+ if (r) {
971
+ const { onClick: y, ...d } = t;
972
+ return { ...d, uid: l, on: { click: "submit" } };
973
+ }
974
+ if (typeof a == "string") {
975
+ const { onClick: y, ...d } = t;
976
+ return { ...d, uid: l, on: { click: a } };
977
+ }
978
+ return { ...t, uid: l };
979
+ }
980
+ // ── Universal: onLoad, onChange, onFilter ──────────────────────
981
+ wireInputLayoutEvents(t, n, s) {
982
+ if (t.kind === "dynamic") {
983
+ const r = t.fn;
984
+ return { kind: "dynamic", fn: (o) => {
985
+ const a = r(o);
986
+ return this.wireEventProperties(a, n, s);
987
+ } };
988
+ }
989
+ return { kind: "static", def: this.wireEventProperties(t.def, n, s) };
990
+ }
991
+ wireEventProperties(t, n, s) {
992
+ const i = { ...t.on || {} };
993
+ let r = !1;
994
+ const l = { ...t };
995
+ for (const o of Ut) {
996
+ const a = t[o];
997
+ if (a == null) continue;
998
+ const u = J[o];
999
+ if (typeof a == "function") {
1000
+ const c = s.next();
1001
+ n.set(c, a), i[u] = c, r = !0;
1002
+ } else typeof a == "string" && (i[u] = a, r = !0);
1003
+ delete l[o];
1004
+ }
1005
+ return r && (l.on = i), l;
1006
+ }
1007
+ }
1008
+ const C = new Dt();
1009
+ function Pt(e) {
1010
+ const {
1011
+ uid: t,
1012
+ label: n,
1013
+ disabled: s,
1014
+ on: i,
1015
+ onClick: r,
1016
+ data: l,
1017
+ type: o,
1018
+ tags: a,
1019
+ size: u,
1020
+ include: c,
1021
+ exclude: y,
1022
+ states: d,
1023
+ ...T
1024
+ } = e;
1025
+ return {
1026
+ uid: t ?? "",
1027
+ kind: "action",
1028
+ type: "button",
1029
+ disabled: s,
1030
+ label: n,
1031
+ ...i != null ? { on: i } : {},
1032
+ props: T
1033
+ };
1034
+ }
1035
+ const { gsl: Ct, gslByUid: vt } = p({
1036
+ itemType: "ACTIONS",
1037
+ entryShape: "bare",
1038
+ mapToWidget: Pt,
1039
+ afterMerge: (e, t) => C.extractOnClickFromMergeResult(
1040
+ e,
1041
+ t.eventRegistry,
1042
+ t.formConfig,
1043
+ t.eventIdGenerator
1044
+ )
1045
+ });
1046
+ function wt(e) {
1047
+ const {
1048
+ uid: t,
1049
+ widgetName: n,
1050
+ tags: s,
1051
+ size: i,
1052
+ onChange: r,
1053
+ include: l,
1054
+ exclude: o,
1055
+ ...a
1056
+ } = e, { on: u, ...c } = a;
1057
+ return {
1058
+ uid: t ?? "",
1059
+ kind: "layout",
1060
+ type: n ?? "flex",
1061
+ props: {
1062
+ direction: c.direction ?? "column",
1063
+ ...c
1064
+ },
1065
+ children: []
1066
+ };
1067
+ }
1068
+ function Mt(e, t) {
1069
+ const n = t.walkChildren(t.children ?? []);
1070
+ if (e.kind === "static")
1071
+ return { ...t.mapStaticDef(e.def, "LAYOUTS"), children: n };
1072
+ const s = e.fn;
1073
+ return ((i) => {
1074
+ const r = s(i);
1075
+ return { ...t.mapStaticDef(r, "LAYOUTS"), children: n };
1076
+ });
1077
+ }
1078
+ function Lt(e) {
1079
+ return e.children;
1080
+ }
1081
+ const { gsl: Bt, gslByUid: Ot } = p({
1082
+ itemType: "LAYOUTS",
1083
+ entryShape: "compound",
1084
+ mapToWidget: wt,
1085
+ buildCustomWidget: Mt,
1086
+ getChildren: Lt
1087
+ });
1088
+ function Rt(e) {
1089
+ return {
1090
+ uid: "",
1091
+ kind: "display",
1092
+ type: "renderer",
1093
+ props: { render: e.render }
1094
+ };
1095
+ }
1096
+ function Nt(e, t) {
1097
+ if (e.kind === "static") {
1098
+ const s = e.def;
1099
+ return ((i) => ({
1100
+ uid: "",
1101
+ kind: "display",
1102
+ type: "renderer",
1103
+ ...s.include != null ? { include: s.include } : {},
1104
+ ...s.exclude != null ? { exclude: s.exclude } : {},
1105
+ props: { render: s.render(i ?? {}) }
1106
+ }));
1107
+ }
1108
+ const n = e.fn;
1109
+ return ((s) => {
1110
+ const i = n(s);
1111
+ return {
1112
+ uid: "",
1113
+ kind: "display",
1114
+ type: "renderer",
1115
+ ...i.include != null ? { include: i.include } : {},
1116
+ ...i.exclude != null ? { exclude: i.exclude } : {},
1117
+ props: { render: i.render(s ?? {}) }
1118
+ };
1119
+ });
1120
+ }
1121
+ const { gsl: Wt, gslByUid: xt } = p({
1122
+ itemType: "DISPLAYS",
1123
+ entryShape: "bare",
1124
+ mapToWidget: Rt,
1125
+ buildCustomWidget: Nt
1126
+ }), { gsl: Ft, gslByUid: $t } = p({
1127
+ itemType: "ALERTS",
1128
+ entryShape: "bare",
1129
+ mapToWidget: (e) => ({
1130
+ uid: e.uid ?? "",
1131
+ kind: "display",
1132
+ type: "alert",
1133
+ props: {
1134
+ text: e.text,
1135
+ ...e.level != null ? { level: e.level } : {}
1136
+ }
1137
+ })
1138
+ });
1139
+ function jt(e) {
1140
+ return {
1141
+ uid: e.uid ?? "",
1142
+ kind: "layout",
1143
+ type: "tabs",
1144
+ props: {
1145
+ tabs: e.tabs,
1146
+ renderMode: e.renderMode ?? "all",
1147
+ ...e.defaultOpen != null ? { defaultOpen: e.defaultOpen } : {}
1148
+ },
1149
+ children: []
1150
+ };
1151
+ }
1152
+ function Yt(e, t) {
1153
+ const n = t.walkChildren(t.children ?? []);
1154
+ if (e.kind === "static")
1155
+ return { ...t.mapStaticDef(e.def, "TABS"), children: n };
1156
+ const s = e.fn;
1157
+ return ((i) => {
1158
+ const r = s(i);
1159
+ return { ...t.mapStaticDef(r, "TABS"), children: n };
1160
+ });
1161
+ }
1162
+ function zt(e) {
1163
+ return e.children;
1164
+ }
1165
+ const { gsl: Gt, gslByUid: Kt } = p({
1166
+ itemType: "TABS",
1167
+ entryShape: "compound",
1168
+ mapToWidget: jt,
1169
+ buildCustomWidget: Yt,
1170
+ getChildren: zt
1171
+ });
1172
+ function Vt(e) {
1173
+ return {
1174
+ uid: e.uid ?? "",
1175
+ kind: "layout",
1176
+ type: "accordion",
1177
+ props: {
1178
+ sections: e.sections,
1179
+ renderMode: e.renderMode ?? "all",
1180
+ ...e.singleOpen != null ? { singleOpen: e.singleOpen } : {},
1181
+ ...e.defaultOpen != null ? { defaultOpen: e.defaultOpen } : {}
1182
+ },
1183
+ children: []
1184
+ };
1185
+ }
1186
+ function Ht(e, t) {
1187
+ const n = t.walkChildren(t.children ?? []);
1188
+ if (e.kind === "static")
1189
+ return { ...t.mapStaticDef(e.def, "ACCORDION"), children: n };
1190
+ const s = e.fn;
1191
+ return ((i) => {
1192
+ const r = s(i);
1193
+ return { ...t.mapStaticDef(r, "ACCORDION"), children: n };
1194
+ });
1195
+ }
1196
+ function Xt(e) {
1197
+ return e.children;
1198
+ }
1199
+ const { gsl: Zt, gslByUid: qt } = p({
1200
+ itemType: "ACCORDION",
1201
+ entryShape: "compound",
1202
+ mapToWidget: Vt,
1203
+ buildCustomWidget: Ht,
1204
+ getChildren: Xt
1205
+ }), { gsl: Qt, gslByUid: Jt } = p({
1206
+ itemType: "CUSTOM_INPUT",
1207
+ entryShape: "keyed",
1208
+ sensibleDefaults: {
1209
+ base: {
1210
+ suppressAutomaticLabels: !1
1211
+ },
1212
+ fields: ["suppressAutomaticLabels"],
1213
+ apply: (e, t) => g(e, t)
1214
+ },
1215
+ mapToWidget: (e) => ({
1216
+ uid: e.uid ?? "",
1217
+ kind: "input",
1218
+ type: e.customType,
1219
+ path: e.path ?? "",
1220
+ ...e.label != null ? { label: e.label } : {},
1221
+ ...e.disabled != null ? { disabled: e.disabled } : {},
1222
+ ...e.readonly != null ? { readonly: e.readonly } : {},
1223
+ ...e.defaultValue != null ? { defaultValue: e.defaultValue } : {},
1224
+ ...e.validator != null ? { validator: e.validator } : {},
1225
+ props: e.props ?? {}
1226
+ })
1227
+ }), { gsl: en, gslByUid: tn } = p({
1228
+ itemType: "CUSTOM_ACTION",
1229
+ entryShape: "bare",
1230
+ mapToWidget: (e) => {
1231
+ const {
1232
+ uid: t,
1233
+ label: n,
1234
+ disabled: s,
1235
+ on: i,
1236
+ onClick: r,
1237
+ data: l,
1238
+ customType: o,
1239
+ tags: a,
1240
+ size: u,
1241
+ include: c,
1242
+ exclude: y,
1243
+ states: d,
1244
+ props: T,
1245
+ ...E
1246
+ } = e;
1247
+ return {
1248
+ uid: t ?? "",
1249
+ kind: "action",
1250
+ type: e.customType,
1251
+ label: n,
1252
+ disabled: s,
1253
+ ...i != null ? { on: i } : {},
1254
+ props: { ...T, ...E }
1255
+ };
1256
+ },
1257
+ afterMerge: (e, t) => C.extractOnClickFromMergeResult(
1258
+ e,
1259
+ t.eventRegistry,
1260
+ t.formConfig,
1261
+ t.eventIdGenerator
1262
+ )
1263
+ }), { gsl: nn, gslByUid: sn } = p({
1264
+ itemType: "CUSTOM_DISPLAY",
1265
+ entryShape: "bare",
1266
+ mapToWidget: (e) => ({
1267
+ uid: e.uid ?? "",
1268
+ kind: "display",
1269
+ type: e.customType,
1270
+ props: e.props ?? {}
1271
+ })
1272
+ });
1273
+ function rn(e) {
1274
+ return {
1275
+ uid: e.uid ?? "",
1276
+ kind: "layout",
1277
+ type: e.customType,
1278
+ props: e.props ?? {},
1279
+ children: []
1280
+ };
1281
+ }
1282
+ function ln(e, t) {
1283
+ const n = t.walkChildren(t.children ?? []);
1284
+ if (e.kind === "static")
1285
+ return { ...t.mapStaticDef(e.def, "CUSTOM_LAYOUT"), children: n };
1286
+ const s = e.fn;
1287
+ return ((i) => {
1288
+ const r = s(i);
1289
+ return { ...t.mapStaticDef(r, "CUSTOM_LAYOUT"), children: n };
1290
+ });
1291
+ }
1292
+ function an(e) {
1293
+ return e.children;
1294
+ }
1295
+ const { gsl: on, gslByUid: un } = p({
1296
+ itemType: "CUSTOM_LAYOUT",
1297
+ entryShape: "compound",
1298
+ mapToWidget: rn,
1299
+ buildCustomWidget: ln,
1300
+ getChildren: an
1301
+ });
1302
+ class _ {
1303
+ constructor(t) {
1304
+ this.conditions = t;
1305
+ }
1306
+ static root() {
1307
+ return new _([]);
1308
+ }
1309
+ // ─── Scope methods (chain-extending, immutable) ───
1310
+ tag(t) {
1311
+ return new _([...this.conditions, { kind: "tagsAnd", tags: [t] }]);
1312
+ }
1313
+ state(t) {
1314
+ return new _([...this.conditions, { kind: "state", name: t }]);
1315
+ }
1316
+ tagsAnd(t) {
1317
+ return new _([...this.conditions, { kind: "tagsAnd", tags: t }]);
1318
+ }
1319
+ tagsOr(t) {
1320
+ return new _([...this.conditions, { kind: "tagsOr", tags: t }]);
1321
+ }
1322
+ apply(t) {
1323
+ if (this.conditions.length === 0) return t;
1324
+ const n = this.conditions.find(
1325
+ (r) => r.kind === "state"
1326
+ ), s = this.conditions.filter(
1327
+ (r) => r.kind !== "state"
1328
+ ), i = t.matcher;
1329
+ return {
1330
+ ...t,
1331
+ matcher: (r) => {
1332
+ if (!i(r)) return !1;
1333
+ for (const l of s) {
1334
+ const o = r.tags ?? [];
1335
+ if (l.kind === "tagsAnd") {
1336
+ for (const a of l.tags)
1337
+ if (!o.includes(a)) return !1;
1338
+ } else {
1339
+ if (l.tags.length === 0) continue;
1340
+ if (!l.tags.some((a) => o.includes(a))) return !1;
1341
+ }
1342
+ }
1343
+ return !0;
1344
+ },
1345
+ ...n ? { targetState: n.name } : {}
1346
+ };
1347
+ }
1348
+ // ─── Type selectors — inputs ───
1349
+ inputs(t) {
1350
+ return this.apply(P(t));
1351
+ }
1352
+ inputByUid(t, n) {
1353
+ return this.apply(xe(t, n));
1354
+ }
1355
+ textInputs(t) {
1356
+ return this.apply(Fe(t));
1357
+ }
1358
+ numberInputs(t) {
1359
+ return this.apply($e(t));
1360
+ }
1361
+ booleanInputs(t) {
1362
+ return this.apply(je(t));
1363
+ }
1364
+ selects(t) {
1365
+ return this.apply(Ye(t));
1366
+ }
1367
+ selectByUid(t, n) {
1368
+ return this.apply(ze(t, n));
1369
+ }
1370
+ dropdowns(t) {
1371
+ return this.apply(Ge(t));
1372
+ }
1373
+ dropdownByUid(t, n) {
1374
+ return this.apply(Ke(t, n));
1375
+ }
1376
+ radiogroups(t) {
1377
+ return this.apply(Ve(t));
1378
+ }
1379
+ radiogroupByUid(t, n) {
1380
+ return this.apply(He(t, n));
1381
+ }
1382
+ checkboxes(t) {
1383
+ return this.apply(Xe(t));
1384
+ }
1385
+ checkboxByUid(t, n) {
1386
+ return this.apply(Ze(t, n));
1387
+ }
1388
+ textareas(t) {
1389
+ return this.apply(qe(t));
1390
+ }
1391
+ textareaByUid(t, n) {
1392
+ return this.apply(Qe(t, n));
1393
+ }
1394
+ passwords(t) {
1395
+ return this.apply(Je(t));
1396
+ }
1397
+ passwordByUid(t, n) {
1398
+ return this.apply(et(t, n));
1399
+ }
1400
+ currencies(t) {
1401
+ return this.apply(tt(t));
1402
+ }
1403
+ currencyByUid(t, n) {
1404
+ return this.apply(nt(t, n));
1405
+ }
1406
+ markdowns(t) {
1407
+ return this.apply(st(t));
1408
+ }
1409
+ markdownByUid(t, n) {
1410
+ return this.apply(it(t, n));
1411
+ }
1412
+ lists(t) {
1413
+ return this.apply(rt(t));
1414
+ }
1415
+ listByUid(t, n) {
1416
+ return this.apply(lt(t, n));
1417
+ }
1418
+ calendars(t) {
1419
+ return this.apply(at(t));
1420
+ }
1421
+ calendarByUid(t, n) {
1422
+ return this.apply(ot(t, n));
1423
+ }
1424
+ dateInputs(t) {
1425
+ return this.apply(ut(t));
1426
+ }
1427
+ dateInputByUid(t, n) {
1428
+ return this.apply(ct(t, n));
1429
+ }
1430
+ datePickers(t) {
1431
+ return this.apply(pt(t));
1432
+ }
1433
+ datePickerByUid(t, n) {
1434
+ return this.apply(dt(t, n));
1435
+ }
1436
+ rangeCalendars(t) {
1437
+ return this.apply(yt(t));
1438
+ }
1439
+ rangeCalendarByUid(t, n) {
1440
+ return this.apply(mt(t, n));
1441
+ }
1442
+ rangeDateInputs(t) {
1443
+ return this.apply(gt(t));
1444
+ }
1445
+ rangeDateInputByUid(t, n) {
1446
+ return this.apply(bt(t, n));
1447
+ }
1448
+ rangeDatePickers(t) {
1449
+ return this.apply(ft(t));
1450
+ }
1451
+ rangeDatePickerByUid(t, n) {
1452
+ return this.apply(ht(t, n));
1453
+ }
1454
+ repeaters(t) {
1455
+ return this.apply(Q(t));
1456
+ }
1457
+ repeaterByUid(t, n) {
1458
+ return this.apply(Et(t, n));
1459
+ }
1460
+ // ─── Type selectors — actions, displays, layouts ───
1461
+ actions(t) {
1462
+ return this.apply(Ct(t));
1463
+ }
1464
+ actionByUid(t, n) {
1465
+ return this.apply(vt(t, n));
1466
+ }
1467
+ layouts(t) {
1468
+ return this.apply(Bt(t));
1469
+ }
1470
+ layoutByUid(t, n) {
1471
+ return this.apply(Ot(t, n));
1472
+ }
1473
+ displays(t) {
1474
+ return this.apply(Wt(t));
1475
+ }
1476
+ displayByUid(t, n) {
1477
+ return this.apply(xt(t, n));
1478
+ }
1479
+ alerts(t) {
1480
+ return this.apply(Ft(t));
1481
+ }
1482
+ alertByUid(t, n) {
1483
+ return this.apply($t(t, n));
1484
+ }
1485
+ tabs(t) {
1486
+ return this.apply(Gt(t));
1487
+ }
1488
+ tabsByUid(t, n) {
1489
+ return this.apply(Kt(t, n));
1490
+ }
1491
+ accordions(t) {
1492
+ return this.apply(Zt(t));
1493
+ }
1494
+ accordionByUid(t, n) {
1495
+ return this.apply(qt(t, n));
1496
+ }
1497
+ // ─── Type selectors — custom kinds ───
1498
+ customInputs(t) {
1499
+ return this.apply(Qt(t));
1500
+ }
1501
+ customInputByUid(t, n) {
1502
+ return this.apply(Jt(t, n));
1503
+ }
1504
+ customActions(t) {
1505
+ return this.apply(en(t));
1506
+ }
1507
+ customActionByUid(t, n) {
1508
+ return this.apply(tn(t, n));
1509
+ }
1510
+ customDisplays(t) {
1511
+ return this.apply(nn(t));
1512
+ }
1513
+ customDisplayByUid(t, n) {
1514
+ return this.apply(sn(t, n));
1515
+ }
1516
+ customLayouts(t) {
1517
+ return this.apply(on(t));
1518
+ }
1519
+ customLayoutByUid(t, n) {
1520
+ return this.apply(un(t, n));
1521
+ }
1522
+ }
1523
+ const Rn = {
1524
+ inputs: {
1525
+ textInput: se,
1526
+ numberInput: ie,
1527
+ booleanInput: re,
1528
+ select: le,
1529
+ dropdown: ae,
1530
+ radiogroup: oe,
1531
+ checkbox: ue,
1532
+ textarea: ce,
1533
+ password: pe,
1534
+ currency: de,
1535
+ markdown: ye,
1536
+ list: me,
1537
+ calendar: ge,
1538
+ dateInput: be,
1539
+ datePicker: fe,
1540
+ rangeCalendar: he,
1541
+ rangeDateInput: Te,
1542
+ rangeDatePicker: Se,
1543
+ repeater: Le,
1544
+ custom: Ae
1545
+ },
1546
+ actions: {
1547
+ button: K,
1548
+ submitButton: V,
1549
+ custom: _e
1550
+ },
1551
+ displays: {
1552
+ display: H,
1553
+ alert: Ie,
1554
+ custom: Ee
1555
+ },
1556
+ layouts: {
1557
+ flex: L,
1558
+ horizontalFlex: Ue,
1559
+ verticalFlex: De,
1560
+ grid: B,
1561
+ horizontalGrid: Pe,
1562
+ verticalGrid: Ce,
1563
+ tabs: ve,
1564
+ accordion: we,
1565
+ custom: Me
1566
+ },
1567
+ selectors: _.root()
1568
+ };
1569
+ function Nn(e, ...t) {
1570
+ return t.map((n) => ({
1571
+ ...n,
1572
+ targetState: e
1573
+ }));
1574
+ }
1575
+ function Wn(e, ...t) {
1576
+ return {
1577
+ kind: "aggregated",
1578
+ matcher: (n) => n.tags?.includes(e) ?? !1,
1579
+ children: t
1580
+ };
1581
+ }
1582
+ const ee = {
1583
+ INPUTS: /* @__PURE__ */ new Set([
1584
+ "INPUTS",
1585
+ "TEXTAREA",
1586
+ "PASSWORD",
1587
+ "SELECT",
1588
+ "DROPDOWN",
1589
+ "RADIOGROUP",
1590
+ "CHECKBOX",
1591
+ "CALENDAR",
1592
+ "DATE_INPUT",
1593
+ "DATE_PICKER",
1594
+ "RANGE_CALENDAR",
1595
+ "RANGE_DATE_INPUT",
1596
+ "RANGE_DATE_PICKER",
1597
+ "CURRENCY",
1598
+ "MARKDOWN",
1599
+ "LIST",
1600
+ "CUSTOM_INPUT",
1601
+ "REPEATER"
1602
+ ]),
1603
+ ACTIONS: /* @__PURE__ */ new Set(["ACTIONS", "CUSTOM_ACTION"]),
1604
+ DISPLAYS: /* @__PURE__ */ new Set(["DISPLAYS", "ALERTS", "CUSTOM_DISPLAY"]),
1605
+ LAYOUTS: /* @__PURE__ */ new Set(["LAYOUTS", "TABS", "ACCORDION", "CUSTOM_LAYOUT"])
1606
+ };
1607
+ function cn(e, t) {
1608
+ const n = ee[e];
1609
+ return n ? n.has(t) : e === t;
1610
+ }
1611
+ class pn {
1612
+ resolve(t, n) {
1613
+ const s = [];
1614
+ for (const r of n)
1615
+ r.kind === "aggregated" ? this.collectFromAggregated(r, t, s) : this.collectFromLeaf(r, t, s);
1616
+ const i = this.rollUpSensibleDefaults(s);
1617
+ return {
1618
+ leafSelectors: s,
1619
+ sensibleDefaults: i
1620
+ };
1621
+ }
1622
+ collectFromAggregated(t, n, s) {
1623
+ if (t.matcher(n))
1624
+ for (const i of t.children)
1625
+ this.collectFromLeaf(i, n, s);
1626
+ }
1627
+ collectFromLeaf(t, n, s) {
1628
+ cn(t.selectorType, n.itemType ?? "") && t.matcher(n) && s.push(t);
1629
+ }
1630
+ rollUpSensibleDefaults(t) {
1631
+ const n = /* @__PURE__ */ new Map(), s = (r, l) => {
1632
+ const o = n.get(r) ?? [];
1633
+ o.push(l), n.set(r, o);
1634
+ };
1635
+ for (const r of t) {
1636
+ const l = ee[r.selectorType];
1637
+ if (l)
1638
+ for (const o of l) s(o, r);
1639
+ else
1640
+ s(r.selectorType, r);
1641
+ }
1642
+ const i = {};
1643
+ for (const [r, l] of n)
1644
+ q(r) && (i[r] = I(r).rollUpSensibleDefaults(l));
1645
+ return i;
1646
+ }
1647
+ }
1648
+ const dn = new pn();
1649
+ class yn {
1650
+ constructor(t) {
1651
+ this.objectUtils = t;
1652
+ }
1653
+ merge(t, n, s) {
1654
+ let i = {}, r = null;
1655
+ typeof t == "function" && (r = t);
1656
+ const l = this.collectDecorators(s);
1657
+ for (const u of l) {
1658
+ if (r != null) {
1659
+ r = this.composeRuntimeFunctions(r, u);
1660
+ continue;
1661
+ }
1662
+ if (typeof u == "function") {
1663
+ const c = u({
1664
+ ...i,
1665
+ ...typeof t == "function" ? {} : t
1666
+ });
1667
+ if (typeof c == "function") {
1668
+ r = this.createPromotedFunction(
1669
+ i,
1670
+ t,
1671
+ c,
1672
+ n,
1673
+ s
1674
+ );
1675
+ continue;
1676
+ }
1677
+ i = this.objectUtils.deepMerge(i, c);
1678
+ } else
1679
+ i = this.objectUtils.deepMerge(i, u);
1680
+ }
1681
+ if (r != null)
1682
+ return {
1683
+ kind: "dynamic",
1684
+ fn: this.wrapWithSensibleDefaults(r, i, n, s)
1685
+ };
1686
+ const o = this.objectUtils.deepMerge(t, i);
1687
+ return { kind: "static", def: this.applySensibleDefaults({ ...o }, n, s) };
1688
+ }
1689
+ // ── Collect all decorators in priority order ──
1690
+ collectDecorators(t) {
1691
+ const n = [];
1692
+ for (const s of t.leafSelectors) {
1693
+ const i = s.config;
1694
+ i.override != null && n.push(i.override);
1695
+ }
1696
+ return n;
1697
+ }
1698
+ // ── Apply sensible defaults via registry ──
1699
+ applySensibleDefaults(t, n, s) {
1700
+ if (!q(n)) return t;
1701
+ const i = s.sensibleDefaults[n] ?? {};
1702
+ return I(n).applySensibleDefaults(t, i);
1703
+ }
1704
+ // ── Create promoted FunctionWidget ──
1705
+ createPromotedFunction(t, n, s, i, r) {
1706
+ return (l) => {
1707
+ const o = s(l);
1708
+ let a = this.objectUtils.deepMerge(t, o);
1709
+ return a = this.objectUtils.deepMerge(a, n), this.applySensibleDefaults(a, i, r);
1710
+ };
1711
+ }
1712
+ // ── Wrap runtime function with accumulated static decorators and sensible defaults ──
1713
+ wrapWithSensibleDefaults(t, n, s, i) {
1714
+ return (r) => {
1715
+ let l = t(r);
1716
+ return Object.keys(n).length > 0 && (l = this.objectUtils.deepMerge(n, l)), this.applySensibleDefaults(l, s, i);
1717
+ };
1718
+ }
1719
+ // ── Compose two runtime functions ──
1720
+ composeRuntimeFunctions(t, n) {
1721
+ return typeof n == "function" ? (s) => {
1722
+ const i = t(s), r = n(i);
1723
+ return typeof r == "function" ? r(s) : this.objectUtils.deepMerge(r, i);
1724
+ } : (s) => {
1725
+ const i = t(s);
1726
+ return this.objectUtils.deepMerge(i, n);
1727
+ };
1728
+ }
1729
+ }
1730
+ const mn = new yn(G);
1731
+ class gn {
1732
+ mapToWidget(t, n) {
1733
+ if (t.kind === "dynamic") {
1734
+ const s = t.fn;
1735
+ return ((i) => {
1736
+ const r = s(i);
1737
+ return this.mapStaticDef(r, n);
1738
+ });
1739
+ }
1740
+ return this.mapStaticDef(t.def, n);
1741
+ }
1742
+ mapStaticDef(t, n) {
1743
+ const s = I(n).mapToWidget(t);
1744
+ return this.applyBaseWidgetFields(s, t);
1745
+ }
1746
+ /**
1747
+ * Injects BaseWidget-level fields that all widget types share.
1748
+ * Centralized here so individual mappers don't need to repeat the pattern.
1749
+ */
1750
+ applyBaseWidgetFields(t, n) {
1751
+ return n.size != null && (t.size = n.size), n.defaultValue != null && t.kind === "input" && (t.defaultValue = n.defaultValue), n.on != null && (t.on = n.on), n.include != null && (t.include = n.include), n.exclude != null && (t.exclude = n.exclude), t;
1752
+ }
1753
+ }
1754
+ const bn = new gn();
1755
+ class fn {
1756
+ /**
1757
+ * Ensures the output is always a uniform GslSelector[] of aggregated selectors.
1758
+ *
1759
+ * Callers can pass flat leaf selectors (single styling rules) or pre-grouped
1760
+ * aggregated selectors. This method separates them into two buckets, then wraps
1761
+ * any bare leaves into a catch-all aggregated selector so downstream code only
1762
+ * deals with one shape.
1763
+ */
1764
+ normalizeSelectors(t) {
1765
+ const n = Array.isArray(t) ? t : [t], s = [], i = [];
1766
+ for (const r of n)
1767
+ r.kind === "leaf" ? i.push(r) : s.push(r);
1768
+ return i.length > 0 && s.unshift({
1769
+ kind: "aggregated",
1770
+ matcher: () => !0,
1771
+ children: i
1772
+ }), s;
1773
+ }
1774
+ extractFormConfig() {
1775
+ return {
1776
+ suppressAutomaticStack: !1,
1777
+ suppressAutomaticSubmit: !1,
1778
+ onSubmit: (t) => console.log("Form submitted:", t)
1779
+ };
1780
+ }
1781
+ }
1782
+ const hn = new fn();
1783
+ function Tn() {
1784
+ let e = 0;
1785
+ return { next: () => `event_${e++}` };
1786
+ }
1787
+ class Sn {
1788
+ constructor(t, n, s, i, r) {
1789
+ this.resolver = t, this.merger = n, this.mapper = s, this.eventWiring = i, this.stateExpansion = r;
1790
+ }
1791
+ walkAndMap(t, n, s) {
1792
+ const i = /* @__PURE__ */ new Map(), r = Tn(), l = { value: 0 }, o = /* @__PURE__ */ new Set();
1793
+ return { widgets: this.walkItems(
1794
+ t,
1795
+ n,
1796
+ i,
1797
+ s,
1798
+ r,
1799
+ l,
1800
+ o
1801
+ ), eventRegistry: i };
1802
+ }
1803
+ walkItems(t, n, s, i, r, l, o) {
1804
+ return t.flatMap((a) => {
1805
+ if (a.type !== "ITEMS")
1806
+ throw new Error("Unexpected gui shortcut type");
1807
+ return a.items.map((u) => this.processItem(
1808
+ u,
1809
+ a.itemType,
1810
+ a.tags,
1811
+ n,
1812
+ s,
1813
+ i,
1814
+ r,
1815
+ l,
1816
+ o
1817
+ ));
1818
+ });
1819
+ }
1820
+ processItem(t, n, s, i, r, l, o, a, u) {
1821
+ const c = n, y = I(n), d = y.parseEntry(t), T = this.buildBaseDef(d), E = this.buildDecoratorForMatching(T, c, s), U = this.resolver.resolve(E, i), R = U.leafSelectors.filter((b) => b.targetState != null), N = {
1822
+ leafSelectors: U.leafSelectors.filter((b) => b.targetState == null),
1823
+ sensibleDefaults: U.sensibleDefaults
1824
+ };
1825
+ let k = this.merger.merge(T, c, N);
1826
+ y.afterMerge && (k = y.afterMerge(k, {
1827
+ eventRegistry: r,
1828
+ formConfig: l,
1829
+ eventIdGenerator: o
1830
+ })), k = this.eventWiring.wireInputLayoutEvents(
1831
+ k,
1832
+ r,
1833
+ o
1834
+ );
1835
+ const { cleanedResult: W, stateData: v } = this.stateExpansion.extractFromMergeResult(
1836
+ k,
1837
+ R
1838
+ );
1839
+ let S;
1840
+ if (y.buildCustomWidget) {
1841
+ const b = this.buildCustomWidgetContext(
1842
+ d.children,
1843
+ i,
1844
+ r,
1845
+ l,
1846
+ o,
1847
+ a,
1848
+ u
1849
+ );
1850
+ S = this.buildCustomWidget(y, W, b);
1851
+ } else
1852
+ S = this.mapper.mapToWidget(W, c);
1853
+ if (typeof S != "function") {
1854
+ const b = S;
1855
+ b.uid || (b.path && !u.has(b.path) ? (b.uid = b.path, u.add(b.path)) : b.uid = `dx_${a.value++}`);
1856
+ }
1857
+ if (this.stateExpansion.hasStateData(v))
1858
+ if (typeof S == "function") {
1859
+ const b = S;
1860
+ S = ((te) => {
1861
+ const ne = b(te);
1862
+ return this.stateExpansion.applyToWidget(
1863
+ ne,
1864
+ v,
1865
+ r,
1866
+ o
1867
+ );
1868
+ });
1869
+ } else
1870
+ S = this.stateExpansion.applyToWidget(
1871
+ S,
1872
+ v,
1873
+ r,
1874
+ o
1875
+ );
1876
+ return S;
1877
+ }
1878
+ buildCustomWidgetContext(t, n, s, i, r, l, o) {
1879
+ return {
1880
+ children: t,
1881
+ mapStaticDef: (a, u) => this.mapper.mapStaticDef(a, u),
1882
+ walkChildren: (a) => this.walkItems(
1883
+ a,
1884
+ n,
1885
+ s,
1886
+ i,
1887
+ r,
1888
+ l,
1889
+ o
1890
+ )
1891
+ };
1892
+ }
1893
+ buildCustomWidget(t, n, s) {
1894
+ return t.buildCustomWidget(n, s);
1895
+ }
1896
+ /**
1897
+ * Resolves the base definition from a parsed entry, injecting the path for keyed entries.
1898
+ * For runtime (function) providers, wraps them to inject the path at evaluation time.
1899
+ */
1900
+ buildBaseDef(t) {
1901
+ const n = t.baseDef;
1902
+ return typeof n == "function" ? (s) => {
1903
+ const r = n(s ?? {});
1904
+ return t.path != null ? { ...r, path: t.path } : r;
1905
+ } : t.path != null ? { ...n, path: t.path } : n;
1906
+ }
1907
+ buildDecoratorForMatching(t, n, s) {
1908
+ if (typeof t == "function")
1909
+ return { itemType: n, tags: [...s] };
1910
+ const i = [...s, ..."tags" in t && t.tags ? t.tags : []], r = "uid" in t ? t.uid : void 0, l = "type" in t ? t.type : void 0;
1911
+ return { itemType: n, tags: i, uid: r, type: l };
1912
+ }
1913
+ }
1914
+ const An = {
1915
+ input: /* @__PURE__ */ new Set(["disabled", "readonly", "label", "validator", "size"]),
1916
+ action: /* @__PURE__ */ new Set(["disabled", "label", "size"]),
1917
+ layout: /* @__PURE__ */ new Set(["size"]),
1918
+ display: /* @__PURE__ */ new Set([])
1919
+ }, $ = {
1920
+ onChange: "change",
1921
+ onLoad: "load",
1922
+ onFilter: "filter",
1923
+ onClick: "click"
1924
+ };
1925
+ class kn {
1926
+ /**
1927
+ * Extracts `states` from a merge result, combining with state-targeted
1928
+ * GSL leaf selectors from `_gslStates`.
1929
+ *
1930
+ * Returns a cleaned merge result (no states) and accumulated state data.
1931
+ */
1932
+ extractFromMergeResult(t, n) {
1933
+ const s = {};
1934
+ for (const o of n) {
1935
+ const a = o.targetState, u = o.config, c = u.override && typeof u.override != "function" ? u.override : u;
1936
+ s[a] = {
1937
+ ...s[a] || {},
1938
+ ...c
1939
+ };
1940
+ }
1941
+ if (t.kind === "dynamic") {
1942
+ const o = t.fn;
1943
+ return {
1944
+ cleanedResult: { kind: "dynamic", fn: (u) => {
1945
+ const c = o(u), { states: y, ...d } = c;
1946
+ return d;
1947
+ } },
1948
+ stateData: { stateOverrides: s }
1949
+ };
1950
+ }
1951
+ const { states: i, ...r } = t.def, l = {};
1952
+ for (const [o, a] of Object.entries(s))
1953
+ l[o] = { ...a };
1954
+ if (i)
1955
+ for (const [o, a] of Object.entries(
1956
+ i
1957
+ ))
1958
+ l[o] = { ...l[o] || {}, ...a };
1959
+ return {
1960
+ cleanedResult: { kind: "static", def: r },
1961
+ stateData: { stateOverrides: l }
1962
+ };
1963
+ }
1964
+ /**
1965
+ * Applies state overrides to a core widget. Each override produces:
1966
+ * - `visible: true/false` → `include: { in }` / `exclude: { from }`
1967
+ * - Core suffixable props → `'prop.stateName': value` at widget root
1968
+ * - Event handlers → `on: { 'eventType.stateName': eventId }` with registry wiring
1969
+ * - Custom props → `props: { 'prop.stateName': value }`
1970
+ */
1971
+ applyToWidget(t, n, s, i) {
1972
+ const { stateOverrides: r } = n;
1973
+ if (Object.keys(r).length === 0)
1974
+ return t;
1975
+ const l = { ...t }, o = t.kind, a = An[o] || /* @__PURE__ */ new Set();
1976
+ t.props && (l.props = { ...t.props }), t.on && (l.on = { ...t.on });
1977
+ for (const [u, c] of Object.entries(r))
1978
+ for (const [y, d] of Object.entries(c))
1979
+ y === "visible" ? this.applyVisibility(l, u, d) : $[y] ? this.applyStateEvent(l, u, y, d, s, i) : a.has(y) ? l[`${y}.${u}`] = d : (l.props || (l.props = {}), l.props[`${y}.${u}`] = d);
1980
+ return l;
1981
+ }
1982
+ hasStateData(t) {
1983
+ return Object.keys(t.stateOverrides).length > 0;
1984
+ }
1985
+ // ── Visibility helpers ──
1986
+ applyVisibility(t, n, s) {
1987
+ if (s) {
1988
+ const i = t.include?.in || [];
1989
+ t.include = { ...t.include || {}, in: [...i, n] };
1990
+ } else {
1991
+ const i = t.exclude?.from || [];
1992
+ t.exclude = { ...t.exclude || {}, from: [...i, n] };
1993
+ }
1994
+ }
1995
+ // ── State-suffixed event helpers ──
1996
+ applyStateEvent(t, n, s, i, r, l) {
1997
+ const o = $[s];
1998
+ if (t.on || (t.on = {}), typeof i == "function") {
1999
+ const a = l.next();
2000
+ r.set(a, i), t.on[`${o}.${n}`] = a;
2001
+ } else typeof i == "string" && (t.on[`${o}.${n}`] = i);
2002
+ }
2003
+ }
2004
+ const _n = new kn();
2005
+ class In {
2006
+ constructor(t, n, s) {
2007
+ this.selectorNormalizer = t, this.eventWiring = n, this.walker = s;
2008
+ }
2009
+ processDxFacade(t, n = [], s) {
2010
+ const { defs: i, gslSelectors: r, formConfig: l } = this.prepareForm(
2011
+ t,
2012
+ n,
2013
+ s
2014
+ ), { widgets: o, eventRegistry: a } = this.walker.walkAndMap(
2015
+ i,
2016
+ r,
2017
+ l
2018
+ ), u = o[0];
2019
+ return this.buildResult({ form: u }, a, l);
2020
+ }
2021
+ /**
2022
+ * Normalizes raw form definitions and applies form-level defaults.
2023
+ *
2024
+ * Steps:
2025
+ * 1. Normalize definitions — ensure a flat array; convert bare functions to display widgets.
2026
+ * 2. Normalize selectors — convert mixed leaf/aggregated selectors into a uniform
2027
+ * aggregated shape, and extract form-level config (see {@link FormConfig}).
2028
+ * 3. Auto-submit — unless suppressed, append a submit button if none was declared.
2029
+ * Throws if more than one submit button is found.
2030
+ * 4. Auto-stack — unless suppressed, wrap all definitions in a synthetic root
2031
+ * flex column layout so the form renders as a single vertical container.
2032
+ */
2033
+ prepareForm(t, n, s) {
2034
+ const r = (Array.isArray(t) ? [...t] : [t]).map(
2035
+ (u) => typeof u == "function" ? H(u) : u
2036
+ ), l = this.selectorNormalizer.normalizeSelectors(n), o = {
2037
+ ...this.selectorNormalizer.extractFormConfig(),
2038
+ ...s
2039
+ }, a = this.eventWiring.countSubmitButtons(r);
2040
+ if (a > 1)
2041
+ throw new Error(
2042
+ `Only one submit button is allowed per form, but ${a} were found. A button is a submit button if it has uid: '#submit' or onClick: 'submit'.`
2043
+ );
2044
+ if (!o.suppressAutomaticSubmit && a === 0 && r.push(V()), !o.suppressAutomaticStack) {
2045
+ const u = {
2046
+ def: { uid: "#root", direction: "column", widgetName: "flex" },
2047
+ children: r
2048
+ };
2049
+ return {
2050
+ defs: [{ type: "ITEMS", itemType: h.LAYOUTS, items: [u], tags: [] }],
2051
+ gslSelectors: l,
2052
+ formConfig: o
2053
+ };
2054
+ }
2055
+ return { defs: r, gslSelectors: l, formConfig: o };
2056
+ }
2057
+ /**
2058
+ * Converts DX `$`-separated state names to core's `:`-separated names.
2059
+ * E.g. `{ register$adult: 'expr' }` → `{ 'register:adult': 'expr' }`.
2060
+ */
2061
+ convertStateNames(t) {
2062
+ const n = {};
2063
+ for (const [s, i] of Object.entries(t))
2064
+ n[s.replace(/\$/g, ":")] = i;
2065
+ return n;
2066
+ }
2067
+ buildResult(t, n, s) {
2068
+ s.states && Object.keys(s.states).length > 0 && (t = {
2069
+ ...t,
2070
+ states: this.convertStateNames(s.states)
2071
+ });
2072
+ const i = { form: t };
2073
+ return n.size > 0 && (i.events = (r) => {
2074
+ const l = n.get(r.name);
2075
+ if (l) {
2076
+ const o = (u) => {
2077
+ if (u && typeof u == "object" && "path" in u && !("type" in u)) {
2078
+ const { path: c, ...y } = u;
2079
+ for (const [d, T] of Object.entries(y))
2080
+ r.callback({
2081
+ type: "OVERRIDE_WIDGET_PROP",
2082
+ payload: { path: c, prop: d, value: T }
2083
+ });
2084
+ } else
2085
+ r.callback(u);
2086
+ }, a = {
2087
+ ...r,
2088
+ callback: o,
2089
+ update: o
2090
+ };
2091
+ l(a);
2092
+ }
2093
+ }), s.dependencies && (i.dependencies = s.dependencies), s.widgetLoaders && (i.widgetLoaders = s.widgetLoaders), s.validateOn && (i.validateOn = s.validateOn), s.itemRenderers && (i.itemRenderers = s.itemRenderers), i;
2094
+ }
2095
+ }
2096
+ const En = new Sn(
2097
+ dn,
2098
+ mn,
2099
+ bn,
2100
+ C,
2101
+ _n
2102
+ ), Un = new In(hn, C, En);
2103
+ function Dn(e) {
2104
+ return typeof e == "function" ? !0 : Array.isArray(e) ? e.length === 0 || e.every(j) : j(e);
2105
+ }
2106
+ function j(e) {
2107
+ if (typeof e == "function") return !0;
2108
+ if (e === null || typeof e != "object") return !1;
2109
+ const t = e;
2110
+ return t.type === "ITEMS" && typeof t.itemType == "string";
2111
+ }
2112
+ const Y = Object.freeze({}), Pn = Object.freeze({}), z = /* @__PURE__ */ new WeakMap();
2113
+ function w(e, t) {
2114
+ return e == null ? t : typeof e == "object" ? e : {};
2115
+ }
2116
+ function xn(e, t, n) {
2117
+ if (!Dn(e))
2118
+ return { formDef: e };
2119
+ const s = w(e, Y), i = w(t, Y), r = w(n, Pn);
2120
+ let l = z.get(s);
2121
+ l || (l = /* @__PURE__ */ new WeakMap(), z.set(s, l));
2122
+ let o = l.get(i);
2123
+ o || (o = /* @__PURE__ */ new WeakMap(), l.set(i, o));
2124
+ const a = o.get(r);
2125
+ if (a) return a;
2126
+ const u = Un.processDxFacade(
2127
+ e,
2128
+ t,
2129
+ n
2130
+ ), c = {
2131
+ formDef: u.form,
2132
+ formEvent: u.events,
2133
+ dependencies: u.dependencies,
2134
+ widgetLoaders: u.widgetLoaders,
2135
+ validateOn: u.validateOn,
2136
+ itemRenderers: u.itemRenderers
2137
+ };
2138
+ return o.set(r, c), c;
2139
+ }
2140
+ class Cn {
2141
+ create(t) {
2142
+ return {
2143
+ states: t.states,
5
2144
  form: {
6
2145
  uid: "gui-root-uid",
7
2146
  type: "flex",
8
2147
  kind: "layout",
9
- children: e.form
2148
+ children: t.form
10
2149
  }
11
2150
  };
12
2151
  }
13
2152
  }
14
- function s() {
15
- return new a();
2153
+ function Fn() {
2154
+ return new Cn();
16
2155
  }
17
- const r = [
18
- "calendar",
19
- "checkbox",
20
- "currency",
21
- "dateInput",
22
- "datePicker",
23
- "dropdown",
24
- "list",
25
- "number",
26
- "password",
27
- "radiogroup",
28
- "rangeCalendar",
29
- "repeater",
30
- "select",
31
- "textarea",
32
- "textinput",
33
- "toggle"
34
- ], l = ["accordion", "flex", "tabs"], u = ["alert", "renderer"], o = ["button"], p = [
35
- ...r,
36
- ...l,
37
- ...u,
38
- ...o
39
- ], i = {
2156
+ const $n = (e) => e !== null && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "label") && Object.prototype.hasOwnProperty.call(e, "value");
2157
+ function jn(e, t) {
2158
+ if (e != null && typeof e == "object" && "__rid" in e)
2159
+ return e.__rid;
2160
+ const n = t();
2161
+ return Object.defineProperty(e, "__rid", {
2162
+ value: n,
2163
+ enumerable: !1,
2164
+ configurable: !1
2165
+ }), n;
2166
+ }
2167
+ function vn(e) {
2168
+ return typeof e == "object" && e !== null && "$ref" in e && typeof e.$ref == "string" && Object.keys(e).length === 1;
2169
+ }
2170
+ async function wn(e, t) {
2171
+ const n = new URL(e, t).href, s = await fetch(n);
2172
+ if (!s.ok) throw new Error(`Failed to load form chunk ${n}: ${s.status}`);
2173
+ const { $schema: i, ...r } = await s.json();
2174
+ return O(r, n);
2175
+ }
2176
+ async function O(e, t) {
2177
+ if (vn(e)) return wn(e.$ref, t);
2178
+ const n = e;
2179
+ if (Array.isArray(n.children)) {
2180
+ const s = await Promise.all(n.children.map((i) => O(i, t)));
2181
+ return { ...n, children: s };
2182
+ }
2183
+ return e;
2184
+ }
2185
+ async function Yn(e, t) {
2186
+ const n = await Promise.all(
2187
+ e.form.map((s) => O(s, t))
2188
+ );
2189
+ return { ...e, form: n };
2190
+ }
2191
+ const zn = {
40
2192
  //
41
2193
  // Input widgets
42
2194
  //
43
2195
  textinput: ({
44
- config: t,
45
- props: e,
2196
+ config: e,
2197
+ props: t,
46
2198
  validator: n
47
2199
  }) => ({
48
2200
  uid: "",
49
2201
  kind: "input",
50
2202
  type: "textinput",
51
2203
  // The `props` key only exists in the returned object when `props` is actually provided
52
- ...e && { props: e },
2204
+ ...t && { props: t },
53
2205
  ...n && { validator: n },
54
- ...t
2206
+ ...e
55
2207
  }),
56
2208
  password: ({
57
- config: t,
58
- props: e,
2209
+ config: e,
2210
+ props: t,
59
2211
  validator: n
60
2212
  }) => ({
61
2213
  uid: "",
62
2214
  kind: "input",
63
2215
  type: "password",
64
2216
  // The `props` key only exists in the returned object when `props` is actually provided
65
- ...e && { props: e },
2217
+ ...t && { props: t },
66
2218
  ...n && { validator: n },
67
- ...t
2219
+ ...e
68
2220
  }),
69
2221
  numberinput: ({
70
- config: t,
71
- props: e,
2222
+ config: e,
2223
+ props: t,
72
2224
  validator: n
73
2225
  }) => ({
74
2226
  uid: "",
75
2227
  kind: "input",
76
2228
  type: "numberinput",
77
- ...e && { props: e },
2229
+ ...t && { props: t },
78
2230
  ...n && { validator: n },
79
- ...t
2231
+ ...e
80
2232
  }),
81
2233
  checkbox: ({
82
- config: t,
83
- props: e,
2234
+ config: e,
2235
+ props: t,
84
2236
  validator: n
85
2237
  }) => ({
86
2238
  uid: "",
87
2239
  kind: "input",
88
2240
  type: "checkbox",
89
- ...e && { props: e },
2241
+ ...t && { props: t },
90
2242
  ...n && { validator: n },
91
- ...t
2243
+ ...e
92
2244
  }),
93
2245
  select: ({
94
- config: t,
95
- props: e,
2246
+ config: e,
2247
+ props: t,
96
2248
  validator: n
97
2249
  }) => ({
98
2250
  uid: "",
99
2251
  kind: "input",
100
2252
  type: "select",
101
- ...e && { props: e },
2253
+ ...t && { props: t },
102
2254
  ...n && { validator: n },
103
- ...t
2255
+ ...e
104
2256
  }),
105
2257
  //
106
2258
  // Layout widgets
107
2259
  //
108
- flex: (t, e) => ({
2260
+ flex: (e, t) => ({
109
2261
  uid: "",
110
2262
  kind: "layout",
111
2263
  type: "flex",
112
- ...e && { props: e },
113
- ...t
2264
+ ...t && { props: t },
2265
+ ...e
114
2266
  }),
115
- tabs: (t, e) => ({
2267
+ grid: (e, t) => ({
2268
+ uid: "",
2269
+ kind: "layout",
2270
+ type: "grid",
2271
+ ...t && { props: t },
2272
+ ...e
2273
+ }),
2274
+ tabs: (e, t) => ({
116
2275
  uid: "",
117
2276
  kind: "layout",
118
2277
  type: "tabs",
119
- ...e && { props: e },
120
- ...t
2278
+ ...t && { props: t },
2279
+ ...e
121
2280
  }),
122
2281
  //
123
2282
  // Display widgets
124
2283
  //
125
- alert: (t, e) => ({
2284
+ alert: (e, t) => ({
126
2285
  uid: "",
127
2286
  kind: "display",
128
2287
  type: "alert",
129
- ...e && { props: e },
130
- ...t
131
- })
132
- }, c = (t) => t !== null && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "label") && Object.prototype.hasOwnProperty.call(t, "value");
133
- function d(t) {
134
- return c(t) ? t : { label: t, value: t };
135
- }
136
- const b = (t) => ({
137
- string: (e, n) => i.textinput({ config: { path: n } }),
138
- enum: (e, n) => i.select({
139
- config: { path: n },
140
- props: { options: e.enum?.map(d) ?? [] },
141
- validator: t.stringValidator()
2288
+ ...t && { props: t },
2289
+ ...e
142
2290
  }),
143
- boolean: (e, n) => i.checkbox({ config: { path: n }, validator: t.booleanValidator() }),
144
- number: (e, n) => i.numberinput({ config: { path: n }, validator: t.numberValidator() }),
145
- integer: (e, n) => i.numberinput({ config: { path: n }, validator: t.integerValidator() }),
146
- object: (e, n) => i.flex({ children: n }),
147
- // one or the other must be valid .
148
- // - remove data when tabs change.
149
- // - don't generate all tabs initially.
150
- oneOf: (e, n) => i.tabs(
151
- { children: n }
152
- /* TODO: , props: {logic: 'XOR'} as TabsProps*/
153
- ),
154
- // one or more must be valid.
155
- // - don't remove data when tabs change.
156
- // - generate all tabs initially, there might be a defaultValue to populate initial values.
157
- anyOf: (e, n) => i.tabs(
158
- { children: n }
159
- /* TODO: , props: {logic: 'OR'} as TabsProps*/
160
- ),
161
- fallback: (e) => i.alert(
162
- {},
163
- {
164
- text: `❌ Unsupported Json Schema field ${JSON.stringify(e)}`,
165
- level: "error"
166
- }
167
- )
168
- });
2291
+ markdownText: (e, t) => ({
2292
+ uid: "",
2293
+ kind: "display",
2294
+ type: "markdownText",
2295
+ ...t && { props: t },
2296
+ ...e
2297
+ })
2298
+ }, Mn = [
2299
+ "calendar",
2300
+ "checkbox",
2301
+ "currency",
2302
+ "dateInput",
2303
+ "datePicker",
2304
+ "dropdown",
2305
+ "list",
2306
+ "markdown",
2307
+ "number",
2308
+ "password",
2309
+ "radiogroup",
2310
+ "rangeCalendar",
2311
+ "rangeDateInput",
2312
+ "rangeDatePicker",
2313
+ "repeater",
2314
+ "select",
2315
+ "textarea",
2316
+ "textinput",
2317
+ "toggle"
2318
+ ], Ln = ["accordion", "flex", "grid", "tabs"], Bn = ["alert", "markdownText", "renderer"], On = ["button"], Gn = [
2319
+ ...Mn,
2320
+ ...Ln,
2321
+ ...Bn,
2322
+ ...On
2323
+ ];
169
2324
  export {
170
- i as Vanilla,
171
- o as actionWidgets,
172
- u as displayWidgets,
173
- s as golemForm,
174
- r as inputWidgets,
175
- c as isOption,
176
- l as layoutWidgets,
177
- b as vanillaSchemaToFieldMap,
178
- p as vanillaWidgets
2325
+ zn as GolemWidgets,
2326
+ qt as _gslAccordionByUid,
2327
+ Zt as _gslAccordions,
2328
+ vt as _gslActionByUid,
2329
+ Ct as _gslActions,
2330
+ $t as _gslAlertByUid,
2331
+ Ft as _gslAlerts,
2332
+ je as _gslBooleanInputs,
2333
+ ot as _gslCalendarByUid,
2334
+ at as _gslCalendars,
2335
+ Ze as _gslCheckboxByUid,
2336
+ Xe as _gslCheckboxes,
2337
+ tt as _gslCurrencies,
2338
+ nt as _gslCurrencyByUid,
2339
+ tn as _gslCustomActionByUid,
2340
+ en as _gslCustomActions,
2341
+ sn as _gslCustomDisplayByUid,
2342
+ nn as _gslCustomDisplays,
2343
+ Jt as _gslCustomInputByUid,
2344
+ Qt as _gslCustomInputs,
2345
+ un as _gslCustomLayoutByUid,
2346
+ on as _gslCustomLayouts,
2347
+ ct as _gslDateInputByUid,
2348
+ ut as _gslDateInputs,
2349
+ dt as _gslDatePickerByUid,
2350
+ pt as _gslDatePickers,
2351
+ xt as _gslDisplayByUid,
2352
+ Wt as _gslDisplays,
2353
+ Ke as _gslDropdownByUid,
2354
+ Ge as _gslDropdowns,
2355
+ xe as _gslInputByUid,
2356
+ P as _gslInputs,
2357
+ Ot as _gslLayoutByUid,
2358
+ Bt as _gslLayouts,
2359
+ lt as _gslListByUid,
2360
+ rt as _gslLists,
2361
+ it as _gslMarkdownByUid,
2362
+ st as _gslMarkdowns,
2363
+ $e as _gslNumberInputs,
2364
+ et as _gslPasswordByUid,
2365
+ Je as _gslPasswords,
2366
+ He as _gslRadiogroupByUid,
2367
+ Ve as _gslRadiogroups,
2368
+ mt as _gslRangeCalendarByUid,
2369
+ yt as _gslRangeCalendars,
2370
+ bt as _gslRangeDateInputByUid,
2371
+ gt as _gslRangeDateInputs,
2372
+ ht as _gslRangeDatePickerByUid,
2373
+ ft as _gslRangeDatePickers,
2374
+ Et as _gslRepeaterByUid,
2375
+ Q as _gslRepeaters,
2376
+ ze as _gslSelectByUid,
2377
+ Ye as _gslSelects,
2378
+ Nn as _gslStates,
2379
+ Gt as _gslTabs,
2380
+ Kt as _gslTabsByUid,
2381
+ Wn as _gslTag,
2382
+ Fe as _gslTextInputs,
2383
+ Qe as _gslTextareaByUid,
2384
+ qe as _gslTextareas,
2385
+ we as _guiAccordion,
2386
+ Ie as _guiAlert,
2387
+ re as _guiBooleanInput,
2388
+ K as _guiButton,
2389
+ ge as _guiCalendar,
2390
+ ue as _guiCheckbox,
2391
+ de as _guiCurrency,
2392
+ _e as _guiCustomAction,
2393
+ Ee as _guiCustomDisplay,
2394
+ Ae as _guiCustomInput,
2395
+ Me as _guiCustomLayout,
2396
+ be as _guiDateInput,
2397
+ fe as _guiDatePicker,
2398
+ H as _guiDisplay,
2399
+ ae as _guiDropdown,
2400
+ L as _guiFlex,
2401
+ B as _guiGrid,
2402
+ Ue as _guiHorizontalFlex,
2403
+ Pe as _guiHorizontalGrid,
2404
+ me as _guiList,
2405
+ ye as _guiMarkdown,
2406
+ ie as _guiNumberInput,
2407
+ pe as _guiPassword,
2408
+ oe as _guiRadiogroup,
2409
+ he as _guiRangeCalendar,
2410
+ Te as _guiRangeDateInput,
2411
+ Se as _guiRangeDatePicker,
2412
+ Le as _guiRepeater,
2413
+ le as _guiSelect,
2414
+ V as _guiSubmitButton,
2415
+ ve as _guiTabs,
2416
+ se as _guiTextInput,
2417
+ ce as _guiTextarea,
2418
+ De as _guiVerticalFlex,
2419
+ Ce as _guiVerticalGrid,
2420
+ On as actionWidgets,
2421
+ X as createGslSelector,
2422
+ p as defineShortcutType,
2423
+ Bn as displayWidgets,
2424
+ m as extractWidgetProps,
2425
+ Un as formDefs,
2426
+ jn as getItemKey,
2427
+ Fn as golemForm,
2428
+ Gn as golemWidgets,
2429
+ Rn as gui,
2430
+ Mn as inputWidgets,
2431
+ Dn as isDxDefinitions,
2432
+ $n as isOption,
2433
+ Ln as layoutWidgets,
2434
+ g as processAutoLabel,
2435
+ A as processAutoPlaceholder,
2436
+ Yn as resolveChunkRefs,
2437
+ xn as resolveFormInput
179
2438
  };