@devtron-labs/devtron-fe-common-lib 0.0.55-beta-1 → 0.0.55-beta-3

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 (113) hide show
  1. package/dist/{CodeEditor-0a5bfd53.js → CodeEditor-3c2aaef5.js} +11082 -11082
  2. package/dist/Common/AddCDButton/AddCDButton.js +24 -24
  3. package/dist/Common/AppStatus/AppStatus.js +16 -16
  4. package/dist/Common/BreadCrumb/BreadCrumb.js +43 -43
  5. package/dist/Common/BreadCrumb/BreadcrumbStore.js +9 -9
  6. package/dist/Common/ChartVersionAndTypeSelector.js +42 -42
  7. package/dist/Common/Checkbox.js +8 -8
  8. package/dist/Common/ClipboardButton/ClipboardButton.js +17 -17
  9. package/dist/Common/ClipboardButton/__tests__/ClipboardButton.test.js +10 -10
  10. package/dist/Common/CodeEditor/CodeEditor.js +4 -4
  11. package/dist/Common/Common.service.js +1 -1
  12. package/dist/Common/CustomInput/CustomInput.js +56 -56
  13. package/dist/Common/CustomTagSelector/PropagateTagInfo.js +22 -22
  14. package/dist/Common/CustomTagSelector/ResizableTagTextArea.js +22 -22
  15. package/dist/Common/CustomTagSelector/TagDetails.js +33 -33
  16. package/dist/Common/CustomTagSelector/TagLabelSelect.js +33 -33
  17. package/dist/Common/CustomTagSelector/TagLabelValueSelector.js +83 -83
  18. package/dist/Common/DebouncedSearch/DebouncedSearch.js +24 -24
  19. package/dist/Common/DebouncedSearch/__tests__/DebouncedSearch.test.js +16 -16
  20. package/dist/Common/DeleteComponentModal/DeleteComponent.js +49 -49
  21. package/dist/Common/DevtronProgressing/DevtronProgressing.js +2 -2
  22. package/dist/Common/Dialogs/ConfirmationDialog.js +14 -14
  23. package/dist/Common/Dialogs/DeleteDialog.js +24 -24
  24. package/dist/Common/Dialogs/DialogForm.js +21 -21
  25. package/dist/Common/Dialogs/ForceDeleteDialog.js +12 -12
  26. package/dist/Common/DraggableWrapper/DraggableButton.js +6 -6
  27. package/dist/Common/DraggableWrapper/DraggableWrapper.js +42 -1468
  28. package/dist/Common/Drawer/Drawer.js +6 -6
  29. package/dist/Common/EmptyState/EmptyState.js +19 -19
  30. package/dist/Common/EmptyState/GenericEmptyState.js +25 -25
  31. package/dist/Common/Error.js +6 -6
  32. package/dist/Common/ErrorScreenNotFound.js +3 -3
  33. package/dist/Common/Grid/Grid.js +11 -11
  34. package/dist/Common/Helper.js +3 -3
  35. package/dist/Common/Hooks/UseSuperAdmin/UseSuperAdmin.js +1 -1
  36. package/dist/Common/ImageTags.js +224 -221
  37. package/dist/Common/InfoColorBar/InfoColourbar.js +37 -37
  38. package/dist/Common/Modals/Modal.js +8 -8
  39. package/dist/Common/Modals/OpaqueModal.js +13 -13
  40. package/dist/Common/Modals/VisibleModal.js +3 -3
  41. package/dist/Common/Modals/VisibleModal2.js +8 -8
  42. package/dist/Common/MultiSelectCustomization.js +45 -45
  43. package/dist/Common/Pagination/PageSizeSelector.js +37 -34
  44. package/dist/Common/Pagination/Pagination.js +60 -57
  45. package/dist/Common/PopupMenu.js +32 -32
  46. package/dist/Common/Progressing.js +20 -20
  47. package/dist/Common/RJSF/Form.js +14 -9877
  48. package/dist/Common/RJSF/common/FieldRow.js +16 -16
  49. package/dist/Common/RJSF/config.js +3 -3
  50. package/dist/Common/RJSF/templates/ArrayFieldItemTemplate.js +13 -13
  51. package/dist/Common/RJSF/templates/ArrayFieldTemplate.js +37 -40
  52. package/dist/Common/RJSF/templates/BaseInput.js +14 -6
  53. package/dist/Common/RJSF/templates/ButtonTemplates/AddButton.js +6 -6
  54. package/dist/Common/RJSF/templates/ButtonTemplates/RemoveButton.js +3 -3
  55. package/dist/Common/RJSF/templates/ButtonTemplates/SubmitButton.js +6 -8
  56. package/dist/Common/RJSF/templates/Description.js +6 -6
  57. package/dist/Common/RJSF/templates/Field.js +12 -15
  58. package/dist/Common/RJSF/templates/FieldErrorTemplate.js +8 -10
  59. package/dist/Common/RJSF/templates/ObjectFieldTemplate.js +35 -40
  60. package/dist/Common/RJSF/templates/TitleField.js +5 -5
  61. package/dist/Common/RJSF/templates/WrapIfAdditionalTemplate.js +23 -24
  62. package/dist/Common/RJSF/templates/index.js +3 -3
  63. package/dist/Common/RJSF/utils.js +9 -12
  64. package/dist/Common/RJSF/widgets/Checkbox.js +20 -20
  65. package/dist/Common/RJSF/widgets/Select.js +609 -40
  66. package/dist/Common/RadioGroup/RadioGroup.js +32 -32
  67. package/dist/Common/RadioGroup.js +17 -17
  68. package/dist/Common/Reload.js +10 -10
  69. package/dist/Common/ResizableTextarea.js +11 -11
  70. package/dist/Common/SearchBar/SearchBar.component.js +26 -26
  71. package/dist/Common/Security/ScanVulnerabilitiesTable.js +20 -20
  72. package/dist/Common/Select/Select.js +93 -93
  73. package/dist/Common/TippyCustomized.js +4 -4
  74. package/dist/Common/ToastBody.js +22 -22
  75. package/dist/Common/Toggle/Toggle.js +15 -15
  76. package/dist/Common/index.js +3 -3
  77. package/dist/{Helper-e1262739.js → Helper-a0caa238.js} +916 -916
  78. package/dist/TippyCustomized-7b9b46b9.js +124 -0
  79. package/dist/{_commonjsHelpers-c5d32002.js → _commonjsHelpers-aeeeeb92.js} +2 -2
  80. package/dist/{cssMode-c259da7f.js → cssMode-c5cae484.js} +1 -1
  81. package/dist/{freemarker2-d852fa33.js → freemarker2-b9a8615c.js} +1 -1
  82. package/dist/{handlebars-7e868cd0.js → handlebars-3803af36.js} +1 -1
  83. package/dist/{html-1faea799.js → html-498f0150.js} +1 -1
  84. package/dist/{htmlMode-175871d9.js → htmlMode-a8ae8cc5.js} +1 -1
  85. package/dist/index.js +3 -3
  86. package/dist/{javascript-46245cbe.js → javascript-4363ced3.js} +1 -1
  87. package/dist/{jsonMode-bbe5176f.js → jsonMode-80290b9e.js} +1 -1
  88. package/dist/jsx-runtime-0dcb030c.js +667 -0
  89. package/dist/{liquid-e6b820e1.js → liquid-1398df0a.js} +1 -1
  90. package/dist/{python-7d292338.js → python-dd2d43e8.js} +1 -1
  91. package/dist/{razor-c6ab49dd.js → razor-20a66096.js} +1 -1
  92. package/dist/{react-select.esm-27b8d563.js → react-select.esm-97f26847.js} +1280 -1112
  93. package/dist/{react-toastify.esm-e28f7200.js → react-toastify.esm-1042de65.js} +149 -155
  94. package/dist/{react.esm-5465a283.js → react.esm-2c92920f.js} +4929 -4393
  95. package/dist/{tippy-react.esm-d5c56a0a.js → tippy-react.esm-8dc66a75.js} +89 -89
  96. package/dist/{tsMode-4d1329d1.js → tsMode-3fa4eb6a.js} +1 -1
  97. package/dist/{typescript-402306e6.js → typescript-1bbaf605.js} +1 -1
  98. package/dist/{xml-8975e1f9.js → xml-a2693dbd.js} +1 -1
  99. package/dist/{yaml-680c02bf.js → yaml-01ce4fdd.js} +1 -1
  100. package/package.json +3 -12
  101. package/dist/BaseInput-8101e714.js +0 -1686
  102. package/dist/Common/UseWindowSize.d.ts +0 -4
  103. package/dist/Common/UseWindowSize.js +0 -20
  104. package/dist/TippyCustomized-c58fd46a.js +0 -124
  105. package/dist/canExpand-ab1f6741.js +0 -10
  106. package/dist/englishStringTranslator-2c9a30fc.js +0 -17
  107. package/dist/enums-d0bd3f97.js +0 -6618
  108. package/dist/getSubmitButtonOptions-a1be9bb0.js +0 -20
  109. package/dist/getTemplate-91d3260d.js +0 -11
  110. package/dist/getUiOptions-844b45a7.js +0 -10
  111. package/dist/idGenerators-0b33693c.js +0 -35
  112. package/dist/index-5a231705.js +0 -17417
  113. package/dist/index-c855d89c.js +0 -173
@@ -1,1686 +0,0 @@
1
- import { jsx as p, jsxs as U, Fragment as $e } from "react/jsx-runtime";
2
- import * as de from "react";
3
- import { createElement as qt, Component as fe, useState as Ue, useCallback as W, useEffect as ut, useReducer as Kt } from "react";
4
- import { i as Vt, _ as Gt, c as pe, l as Yt, g as We, R as Ke, d as J, e as H, s as q, E as zt, C as Xt, f as Zt, h as Jt, j as Qt, k as en, m as tn, n as Ve, o as nn, p as ve, T as $, q as Q, r as rn, t as Ge, u as je, v as an, w as sn, x as on, y as Ye, z as ze, P as Xe, A as Pe, B as ln, O as cn, I as Ze, D as dn, a as Ce } from "./enums-d0bd3f97.js";
5
- import { g as Me } from "./_commonjsHelpers-c5d32002.js";
6
- import { e as un } from "./englishStringTranslator-2c9a30fc.js";
7
- import { g as R } from "./getUiOptions-844b45a7.js";
8
- import { g as B } from "./getTemplate-91d3260d.js";
9
- import { d as ge, t as mt, a as Je, b as ne, e as mn, h as pn, o as pt } from "./idGenerators-0b33693c.js";
10
- import { g as hn } from "./getSubmitButtonOptions-a1be9bb0.js";
11
- import { c as fn } from "./canExpand-ab1f6741.js";
12
- import { PLACEHOLDERS as gn } from "./Common/RJSF/constants.js";
13
- function yn(t) {
14
- return t.additionalItems === !0 && console.warn("additionalItems=true is currently not supported"), Vt(t.additionalItems);
15
- }
16
- function Qe(t) {
17
- if (t === "")
18
- return;
19
- if (t === null)
20
- return null;
21
- if (/\.$/.test(t) || /\.0$/.test(t) || /\.\d*0$/.test(t))
22
- return t;
23
- const e = Number(t);
24
- return typeof e == "number" && !Number.isNaN(e) ? e : t;
25
- }
26
- var bn = Gt;
27
- function Sn(t, e, n) {
28
- n = typeof n == "function" ? n : void 0;
29
- var r = n ? n(t, e) : void 0;
30
- return r === void 0 ? bn(t, e, void 0, n) : !!r;
31
- }
32
- var On = Sn;
33
- const Fn = /* @__PURE__ */ Me(On);
34
- function Ae(t, e) {
35
- return Fn(t, e, (n, r) => {
36
- if (typeof n == "function" && typeof r == "function")
37
- return !0;
38
- });
39
- }
40
- function vn(t = {}) {
41
- return (
42
- // TODO: Remove the `&& uiSchema['ui:widget'] !== 'hidden'` once we support hidden widgets for arrays.
43
- // https://rjsf-team.github.io/react-jsonschema-form/docs/usage/widgets/#hidden-widgets
44
- "widget" in R(t) && R(t).widget !== "hidden"
45
- );
46
- }
47
- function Cn(t) {
48
- const e = t.split(","), n = e[0].split(";"), r = n[0].replace("data:", ""), a = n.filter((o) => o.split("=")[0] === "name");
49
- let s;
50
- a.length !== 1 ? s = "unknown" : s = decodeURI(a[0].split("=")[1]);
51
- try {
52
- const o = atob(e[1]), l = [];
53
- for (let m = 0; m < o.length; m++)
54
- l.push(o.charCodeAt(m));
55
- return { blob: new window.Blob([new Uint8Array(l)], { type: r }), name: s };
56
- } catch (o) {
57
- return { blob: { size: 0, type: o.message }, name: t };
58
- }
59
- }
60
- function K(t, e = [], n) {
61
- if (Array.isArray(t))
62
- return t.map((s) => K(s, e)).filter((s) => s);
63
- const r = t === "" || t === null ? -1 : Number(t), a = e[r];
64
- return a ? a.value : n;
65
- }
66
- function kn(t, e, n = []) {
67
- const r = K(t, n);
68
- return Array.isArray(e) ? e.filter((a) => !pe(a, r)) : pe(r, e) ? void 0 : e;
69
- }
70
- function Re(t, e) {
71
- return Array.isArray(e) ? e.some((n) => pe(n, t)) : pe(e, t);
72
- }
73
- function wn(t, e = [], n = !1) {
74
- const r = e.map((a, s) => Re(a.value, t) ? String(s) : void 0).filter((a) => typeof a < "u");
75
- return n ? r : r[0];
76
- }
77
- function Dn(t, e, n = []) {
78
- const r = K(t, n);
79
- if (!Yt.isNil(r)) {
80
- const a = n.findIndex((l) => r === l.value), s = n.map(({ value: l }) => l);
81
- return e.slice(0, a).concat(r, e.slice(a)).sort((l, d) => +(s.indexOf(l) > s.indexOf(d)));
82
- }
83
- return e;
84
- }
85
- function Tn(t) {
86
- const e = {};
87
- return t.multipleOf && (e.step = t.multipleOf), (t.minimum || t.minimum === 0) && (e.min = t.minimum), (t.maximum || t.maximum === 0) && (e.max = t.maximum), e;
88
- }
89
- function Nn(t, e, n = {}, r = !0) {
90
- const a = Object.assign({ type: e || "text" }, Tn(t));
91
- return n.inputType ? a.type = n.inputType : e || (t.type === "number" ? (a.type = "number", r && a.step === void 0 && (a.step = "any")) : t.type === "integer" && (a.type = "number", a.step === void 0 && (a.step = 1))), n.autocomplete && (a.autoComplete = n.autocomplete), a;
92
- }
93
- const ke = {
94
- boolean: {
95
- checkbox: "CheckboxWidget",
96
- radio: "RadioWidget",
97
- select: "SelectWidget",
98
- hidden: "HiddenWidget"
99
- },
100
- string: {
101
- text: "TextWidget",
102
- password: "PasswordWidget",
103
- email: "EmailWidget",
104
- hostname: "TextWidget",
105
- ipv4: "TextWidget",
106
- ipv6: "TextWidget",
107
- uri: "URLWidget",
108
- "data-url": "FileWidget",
109
- radio: "RadioWidget",
110
- select: "SelectWidget",
111
- textarea: "TextareaWidget",
112
- hidden: "HiddenWidget",
113
- date: "DateWidget",
114
- datetime: "DateTimeWidget",
115
- "date-time": "DateTimeWidget",
116
- "alt-date": "AltDateWidget",
117
- "alt-datetime": "AltDateTimeWidget",
118
- time: "TimeWidget",
119
- color: "ColorWidget",
120
- file: "FileWidget"
121
- },
122
- number: {
123
- text: "TextWidget",
124
- select: "SelectWidget",
125
- updown: "UpDownWidget",
126
- range: "RangeWidget",
127
- radio: "RadioWidget",
128
- hidden: "HiddenWidget"
129
- },
130
- integer: {
131
- text: "TextWidget",
132
- select: "SelectWidget",
133
- updown: "UpDownWidget",
134
- range: "RangeWidget",
135
- radio: "RadioWidget",
136
- hidden: "HiddenWidget"
137
- },
138
- array: {
139
- select: "SelectWidget",
140
- checkboxes: "CheckboxesWidget",
141
- files: "FileWidget",
142
- hidden: "HiddenWidget"
143
- }
144
- };
145
- function In(t) {
146
- let e = J(t, "MergedWidget");
147
- if (!e) {
148
- const n = t.defaultProps && t.defaultProps.options || {};
149
- e = (r) => {
150
- var { options: a } = r, s = H(r, ["options"]);
151
- return p(t, Object.assign({ options: Object.assign(Object.assign({}, n), a) }, s));
152
- }, q(t, "MergedWidget", e);
153
- }
154
- return e;
155
- }
156
- function G(t, e, n = {}) {
157
- const r = We(t);
158
- if (typeof e == "function" || e && Ke.isForwardRef(qt(e)) || Ke.isMemo(e))
159
- return In(e);
160
- if (typeof e != "string")
161
- throw new Error(`Unsupported widget definition: ${typeof e}`);
162
- if (e in n) {
163
- const a = n[e];
164
- return G(t, a, n);
165
- }
166
- if (typeof r == "string") {
167
- if (!(r in ke))
168
- throw new Error(`No widget for type '${r}'`);
169
- if (e in ke[r]) {
170
- const a = n[ke[r][e]];
171
- return G(t, a, n);
172
- }
173
- }
174
- throw new Error(`No widget '${e}' for type '${r}'`);
175
- }
176
- function xn(t, e, n = {}) {
177
- try {
178
- return G(t, e, n), !0;
179
- } catch (r) {
180
- const a = r;
181
- if (a.message && (a.message.startsWith("No widget") || a.message.startsWith("Unsupported widget")))
182
- return !1;
183
- throw r;
184
- }
185
- }
186
- function jn(t, e, n) {
187
- return e ? n : t;
188
- }
189
- function An(t) {
190
- return t ? new Date(t).toJSON() : void 0;
191
- }
192
- function En(t) {
193
- if (zt in t && Array.isArray(t.enum) && t.enum.length === 1)
194
- return t.enum[0];
195
- if (Xt in t)
196
- return t.const;
197
- throw new Error("schema cannot be inferred as a constant");
198
- }
199
- function he(t) {
200
- const e = t;
201
- if (e.enumNames && process.env.NODE_ENV !== "production" && console.warn("The enumNames property is deprecated and may be removed in a future major release."), t.enum)
202
- return t.enum.map((r, a) => ({ label: e.enumNames && e.enumNames[a] || String(r), value: r }));
203
- const n = t.oneOf || t.anyOf;
204
- return n && n.map((r) => {
205
- const a = r, s = En(a), o = a.title || String(s);
206
- return {
207
- schema: a,
208
- label: o,
209
- value: s
210
- };
211
- });
212
- }
213
- function Bn(t, e) {
214
- if (!Array.isArray(e))
215
- return t;
216
- const n = (h) => h.reduce((g, y) => (g[y] = !0, g), {}), r = (h) => h.length > 1 ? `properties '${h.join("', '")}'` : `property '${h[0]}'`, a = n(t), s = e.filter((h) => h === "*" || a[h]), o = n(s), l = t.filter((h) => !o[h]), d = s.indexOf("*");
217
- if (d === -1) {
218
- if (l.length)
219
- throw new Error(`uiSchema order list does not contain ${r(l)}`);
220
- return s;
221
- }
222
- if (d !== s.lastIndexOf("*"))
223
- throw new Error("uiSchema order list contains more than one wildcard item");
224
- const m = [...s];
225
- return m.splice(d, 1, ...l), m;
226
- }
227
- function Z(t, e) {
228
- let n = String(t);
229
- for (; n.length < e; )
230
- n = "0" + n;
231
- return n;
232
- }
233
- function we(t, e = !0) {
234
- if (!t)
235
- return {
236
- year: -1,
237
- month: -1,
238
- day: -1,
239
- hour: e ? -1 : 0,
240
- minute: e ? -1 : 0,
241
- second: e ? -1 : 0
242
- };
243
- const n = new Date(t);
244
- if (Number.isNaN(n.getTime()))
245
- throw new Error("Unable to parse date " + t);
246
- return {
247
- year: n.getUTCFullYear(),
248
- month: n.getUTCMonth() + 1,
249
- day: n.getUTCDate(),
250
- hour: e ? n.getUTCHours() : 0,
251
- minute: e ? n.getUTCMinutes() : 0,
252
- second: e ? n.getUTCSeconds() : 0
253
- };
254
- }
255
- function ue(t) {
256
- if (t.const || t.enum && t.enum.length === 1 && t.enum[0] === !0)
257
- return !0;
258
- if (t.anyOf && t.anyOf.length === 1)
259
- return ue(t.anyOf[0]);
260
- if (t.oneOf && t.oneOf.length === 1)
261
- return ue(t.oneOf[0]);
262
- if (t.allOf) {
263
- const e = (n) => ue(n);
264
- return t.allOf.some(e);
265
- }
266
- return !1;
267
- }
268
- function et(t, e = !0) {
269
- const { year: n, month: r, day: a, hour: s = 0, minute: o = 0, second: l = 0 } = t, d = Date.UTC(n, r - 1, a, s, o, l), m = new Date(d).toJSON();
270
- return e ? m : m.slice(0, 10);
271
- }
272
- function _n(t) {
273
- if (!t)
274
- return "";
275
- const e = new Date(t), n = Z(e.getFullYear(), 4), r = Z(e.getMonth() + 1, 2), a = Z(e.getDate(), 2), s = Z(e.getHours(), 2), o = Z(e.getMinutes(), 2), l = Z(e.getSeconds(), 2), d = Z(e.getMilliseconds(), 3);
276
- return `${n}-${r}-${a}T${s}:${o}:${l}.${d}`;
277
- }
278
- var $n = Zt, Un = Jt, Wn = Qt;
279
- function Pn(t, e, n) {
280
- for (var r = -1, a = e.length, s = {}; ++r < a; ) {
281
- var o = e[r], l = $n(t, o);
282
- n(l, o) && Un(s, Wn(o, t), l);
283
- }
284
- return s;
285
- }
286
- var Mn = Pn, Rn = Mn, Ln = en;
287
- function Hn(t, e) {
288
- return Rn(t, e, function(n, r) {
289
- return Ln(t, r);
290
- });
291
- }
292
- var qn = Hn, Kn = qn, Vn = tn, Gn = Vn(function(t, e) {
293
- return t == null ? {} : Kn(t, e);
294
- }), Yn = Gn;
295
- const Na = /* @__PURE__ */ Me(Yn);
296
- let zn = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
297
- function Ee() {
298
- return zn();
299
- }
300
- function tt(t) {
301
- return Array.isArray(t) ? t.map((e) => ({
302
- key: Ee(),
303
- item: e
304
- })) : [];
305
- }
306
- function ae(t) {
307
- return Array.isArray(t) ? t.map((e) => e.item) : [];
308
- }
309
- class Xn extends fe {
310
- /** Constructs an `ArrayField` from the `props`, generating the initial keyed data from the `formData`
311
- *
312
- * @param props - The `FieldProps` for this template
313
- */
314
- constructor(e) {
315
- super(e), this._getNewFormDataRow = () => {
316
- const { schema: a, registry: s } = this.props, { schemaUtils: o } = s;
317
- let l = a.items;
318
- return Ve(a) && yn(a) && (l = a.additionalItems), o.getDefaultFormState(l);
319
- }, this.onAddClick = (a) => {
320
- this._handleAddClick(a);
321
- }, this.onAddIndexClick = (a) => (s) => {
322
- this._handleAddClick(s, a);
323
- }, this.onCopyIndexClick = (a) => (s) => {
324
- s && s.preventDefault();
325
- const { onChange: o, errorSchema: l } = this.props, { keyedFormData: d } = this.state;
326
- let m;
327
- if (l) {
328
- m = {};
329
- for (const y in l) {
330
- const i = parseInt(y);
331
- i <= a ? q(m, [i], l[y]) : i > a && q(m, [i + 1], l[y]);
332
- }
333
- }
334
- const h = {
335
- key: Ee(),
336
- item: nn(d[a].item)
337
- }, g = [...d];
338
- a !== void 0 ? g.splice(a + 1, 0, h) : g.push(h), this.setState({
339
- keyedFormData: g,
340
- updatedKeyedFormData: !0
341
- }, () => o(ae(g), m));
342
- }, this.onDropIndexClick = (a) => (s) => {
343
- s && s.preventDefault();
344
- const { onChange: o, errorSchema: l } = this.props, { keyedFormData: d } = this.state;
345
- let m;
346
- if (l) {
347
- m = {};
348
- for (const g in l) {
349
- const y = parseInt(g);
350
- y < a ? q(m, [y], l[g]) : y > a && q(m, [y - 1], l[g]);
351
- }
352
- }
353
- const h = d.filter((g, y) => y !== a);
354
- this.setState({
355
- keyedFormData: h,
356
- updatedKeyedFormData: !0
357
- }, () => o(ae(h), m));
358
- }, this.onReorderClick = (a, s) => (o) => {
359
- o && (o.preventDefault(), o.currentTarget.blur());
360
- const { onChange: l, errorSchema: d } = this.props;
361
- let m;
362
- if (d) {
363
- m = {};
364
- for (const i in d) {
365
- const u = parseInt(i);
366
- u == a ? q(m, [s], d[a]) : u == s ? q(m, [a], d[s]) : q(m, [i], d[u]);
367
- }
368
- }
369
- const { keyedFormData: h } = this.state;
370
- function g() {
371
- const i = h.slice();
372
- return i.splice(a, 1), i.splice(s, 0, h[a]), i;
373
- }
374
- const y = g();
375
- this.setState({
376
- keyedFormData: y
377
- }, () => l(ae(y), m));
378
- }, this.onChangeForIndex = (a) => (s, o, l) => {
379
- const { formData: d, onChange: m, errorSchema: h } = this.props, y = (Array.isArray(d) ? d : []).map((i, u) => a === u ? typeof s > "u" ? null : s : i);
380
- m(y, h && h && Object.assign(Object.assign({}, h), { [a]: o }), l);
381
- }, this.onSelectChange = (a) => {
382
- const { onChange: s, idSchema: o } = this.props;
383
- s(a, void 0, o && o.$id);
384
- };
385
- const { formData: n = [] } = e, r = tt(n);
386
- this.state = {
387
- keyedFormData: r,
388
- updatedKeyedFormData: !1
389
- };
390
- }
391
- /** React lifecycle method that is called when the props are about to change allowing the state to be updated. It
392
- * regenerates the keyed form data and returns it
393
- *
394
- * @param nextProps - The next set of props data
395
- * @param prevState - The previous set of state data
396
- */
397
- static getDerivedStateFromProps(e, n) {
398
- if (n.updatedKeyedFormData)
399
- return {
400
- updatedKeyedFormData: !1
401
- };
402
- const r = Array.isArray(e.formData) ? e.formData : [], a = n.keyedFormData || [];
403
- return {
404
- keyedFormData: r.length === a.length ? a.map((o, l) => ({
405
- key: o.key,
406
- item: r[l]
407
- })) : tt(r)
408
- };
409
- }
410
- /** Returns the appropriate title for an item by getting first the title from the schema.items, then falling back to
411
- * the description from the schema.items, and finally the string "Item"
412
- */
413
- get itemTitle() {
414
- const { schema: e, registry: n } = this.props, { translateString: r } = n;
415
- return J(e, [ve, "title"], J(e, [ve, "description"], r($.ArrayItemTitle)));
416
- }
417
- /** Determines whether the item described in the schema is always required, which is determined by whether any item
418
- * may be null.
419
- *
420
- * @param itemSchema - The schema for the item
421
- * @return - True if the item schema type does not contain the "null" type
422
- */
423
- isItemRequired(e) {
424
- return Array.isArray(e.type) ? !e.type.includes("null") : e.type !== "null";
425
- }
426
- /** Determines whether more items can be added to the array. If the uiSchema indicates the array doesn't allow adding
427
- * then false is returned. Otherwise, if the schema indicates that there are a maximum number of items and the
428
- * `formData` matches that value, then false is returned, otherwise true is returned.
429
- *
430
- * @param formItems - The list of items in the form
431
- * @returns - True if the item is addable otherwise false
432
- */
433
- canAddItem(e) {
434
- const { schema: n, uiSchema: r, registry: a } = this.props;
435
- let { addable: s } = R(r, a.globalUiOptions);
436
- return s !== !1 && (n.maxItems !== void 0 ? s = e.length < n.maxItems : s = !0), s;
437
- }
438
- /** Callback handler for when the user clicks on the add or add at index buttons. Creates a new row of keyed form data
439
- * either at the end of the list (when index is not specified) or inserted at the `index` when it is, adding it into
440
- * the state, and then returning `onChange()` with the plain form data converted from the keyed data
441
- *
442
- * @param event - The event for the click
443
- * @param [index] - The optional index at which to add the new data
444
- */
445
- _handleAddClick(e, n) {
446
- e && e.preventDefault();
447
- const { onChange: r, errorSchema: a } = this.props, { keyedFormData: s } = this.state;
448
- let o;
449
- if (a) {
450
- o = {};
451
- for (const m in a) {
452
- const h = parseInt(m);
453
- n === void 0 || h < n ? q(o, [h], a[m]) : h >= n && q(o, [h + 1], a[m]);
454
- }
455
- }
456
- const l = {
457
- key: Ee(),
458
- item: this._getNewFormDataRow()
459
- }, d = [...s];
460
- n !== void 0 ? d.splice(n, 0, l) : d.push(l), this.setState({
461
- keyedFormData: d,
462
- updatedKeyedFormData: !0
463
- }, () => r(ae(d), o));
464
- }
465
- /** Renders the `ArrayField` depending on the specific needs of the schema and uischema elements
466
- */
467
- render() {
468
- const { schema: e, uiSchema: n, idSchema: r, registry: a } = this.props, { schemaUtils: s, translateString: o } = a;
469
- if (!(ve in e)) {
470
- const l = R(n), d = B("UnsupportedFieldTemplate", a, l);
471
- return p(d, { schema: e, idSchema: r, reason: o($.MissingItems), registry: a });
472
- }
473
- return s.isMultiSelect(e) ? this.renderMultiSelect() : vn(n) ? this.renderCustomWidget() : Ve(e) ? this.renderFixedArray() : s.isFilesArray(e, n) ? this.renderFiles() : this.renderNormalArray();
474
- }
475
- /** Renders a normal array without any limitations of length
476
- */
477
- renderNormalArray() {
478
- const { schema: e, uiSchema: n = {}, errorSchema: r, idSchema: a, name: s, disabled: o = !1, readonly: l = !1, autofocus: d = !1, required: m = !1, registry: h, onBlur: g, onFocus: y, idPrefix: i, idSeparator: u = "_", rawErrors: c } = this.props, { keyedFormData: f } = this.state, S = e.title === void 0 ? s : e.title, { schemaUtils: b, formContext: v } = h, C = R(n), F = Q(e.items) ? e.items : {}, w = b.retrieveSchema(F), O = ae(this.state.keyedFormData), k = this.canAddItem(O), D = {
479
- canAdd: k,
480
- items: f.map((P, A) => {
481
- const { key: _, item: j } = P, E = j, L = b.retrieveSchema(F, E), N = r ? r[A] : void 0, x = a.$id + u + A, M = b.toIdSchema(L, x, E, i, u);
482
- return this.renderArrayFieldItem({
483
- key: _,
484
- index: A,
485
- name: s && `${s}-${A}`,
486
- canAdd: k,
487
- canMoveUp: A > 0,
488
- canMoveDown: A < O.length - 1,
489
- itemSchema: L,
490
- itemIdSchema: M,
491
- itemErrorSchema: N,
492
- itemData: E,
493
- itemUiSchema: n.items,
494
- autofocus: d && A === 0,
495
- onBlur: g,
496
- onFocus: y,
497
- rawErrors: c,
498
- totalItems: f.length
499
- });
500
- }),
501
- className: `field field-array field-array-of-${w.type}`,
502
- disabled: o,
503
- idSchema: a,
504
- uiSchema: n,
505
- onAddClick: this.onAddClick,
506
- readonly: l,
507
- required: m,
508
- schema: e,
509
- title: S,
510
- formContext: v,
511
- formData: O,
512
- rawErrors: c,
513
- registry: h
514
- }, T = B("ArrayFieldTemplate", h, C);
515
- return p(T, Object.assign({}, D));
516
- }
517
- /** Renders an array using the custom widget provided by the user in the `uiSchema`
518
- */
519
- renderCustomWidget() {
520
- var e;
521
- const { schema: n, idSchema: r, uiSchema: a, disabled: s = !1, readonly: o = !1, autofocus: l = !1, required: d = !1, hideError: m, placeholder: h, onBlur: g, onFocus: y, formData: i = [], registry: u, rawErrors: c, name: f } = this.props, { widgets: S, formContext: b, globalUiOptions: v, schemaUtils: C } = u, F = R(a, v), { widget: w, title: O } = F, k = H(F, ["widget", "title"]), D = G(n, w, S), T = (e = O ?? n.title) !== null && e !== void 0 ? e : f, P = C.getDisplayLabel(n, a, v);
522
- return p(D, { id: r.$id, name: f, multiple: !0, onChange: this.onSelectChange, onBlur: g, onFocus: y, options: k, schema: n, uiSchema: a, registry: u, value: i, disabled: s, readonly: o, hideError: m, required: d, label: T, hideLabel: !P, placeholder: h, formContext: b, autofocus: l, rawErrors: c });
523
- }
524
- /** Renders an array as a set of checkboxes
525
- */
526
- renderMultiSelect() {
527
- var e;
528
- const { schema: n, idSchema: r, uiSchema: a, formData: s = [], disabled: o = !1, readonly: l = !1, autofocus: d = !1, required: m = !1, placeholder: h, onBlur: g, onFocus: y, registry: i, rawErrors: u, name: c } = this.props, { widgets: f, schemaUtils: S, formContext: b, globalUiOptions: v } = i, C = S.retrieveSchema(n.items, s), F = he(C), w = R(a, v), { widget: O = "select", title: k } = w, D = H(w, ["widget", "title"]), T = G(n, O, f), P = (e = k ?? n.title) !== null && e !== void 0 ? e : c, A = S.getDisplayLabel(n, a, v);
529
- return p(T, { id: r.$id, name: c, multiple: !0, onChange: this.onSelectChange, onBlur: g, onFocus: y, options: Object.assign(Object.assign({}, D), { enumOptions: F }), schema: n, uiSchema: a, registry: i, value: s, disabled: o, readonly: l, required: m, label: P, hideLabel: !A, placeholder: h, formContext: b, autofocus: d, rawErrors: u });
530
- }
531
- /** Renders an array of files using the `FileWidget`
532
- */
533
- renderFiles() {
534
- var e;
535
- const { schema: n, uiSchema: r, idSchema: a, name: s, disabled: o = !1, readonly: l = !1, autofocus: d = !1, required: m = !1, onBlur: h, onFocus: g, registry: y, formData: i = [], rawErrors: u } = this.props, { widgets: c, formContext: f, globalUiOptions: S, schemaUtils: b } = y, v = R(r, S), { widget: C = "files", title: F } = v, w = H(v, ["widget", "title"]), O = G(n, C, c), k = (e = F ?? n.title) !== null && e !== void 0 ? e : s, D = b.getDisplayLabel(n, r, S);
536
- return p(O, { options: w, id: a.$id, name: s, multiple: !0, onChange: this.onSelectChange, onBlur: h, onFocus: g, schema: n, uiSchema: r, value: i, disabled: o, readonly: l, required: m, registry: y, formContext: f, autofocus: d, rawErrors: u, label: k, hideLabel: !D });
537
- }
538
- /** Renders an array that has a maximum limit of items
539
- */
540
- renderFixedArray() {
541
- const { schema: e, uiSchema: n = {}, formData: r = [], errorSchema: a, idPrefix: s, idSeparator: o = "_", idSchema: l, name: d, disabled: m = !1, readonly: h = !1, autofocus: g = !1, required: y = !1, registry: i, onBlur: u, onFocus: c, rawErrors: f } = this.props, { keyedFormData: S } = this.state;
542
- let { formData: b = [] } = this.props;
543
- const v = e.title || d, C = R(n), { schemaUtils: F, formContext: w } = i, k = (Q(e.items) ? e.items : []).map((_, j) => F.retrieveSchema(_, r[j])), D = Q(e.additionalItems) ? F.retrieveSchema(e.additionalItems, r) : null;
544
- (!b || b.length < k.length) && (b = b || [], b = b.concat(new Array(k.length - b.length)));
545
- const T = this.canAddItem(b) && !!D, P = {
546
- canAdd: T,
547
- className: "field field-array field-array-fixed-items",
548
- disabled: m,
549
- idSchema: l,
550
- formData: r,
551
- items: S.map((_, j) => {
552
- const { key: E, item: L } = _, N = L, x = j >= k.length, M = (x && Q(e.additionalItems) ? F.retrieveSchema(e.additionalItems, N) : k[j]) || {}, ie = l.$id + o + j, Y = F.toIdSchema(M, ie, N, s, o), be = x ? n.additionalItems || {} : Array.isArray(n.items) ? n.items[j] : n.items || {}, le = a ? a[j] : void 0;
553
- return this.renderArrayFieldItem({
554
- key: E,
555
- index: j,
556
- name: d && `${d}-${j}`,
557
- canAdd: T,
558
- canRemove: x,
559
- canMoveUp: j >= k.length + 1,
560
- canMoveDown: x && j < b.length - 1,
561
- itemSchema: M,
562
- itemData: N,
563
- itemUiSchema: be,
564
- itemIdSchema: Y,
565
- itemErrorSchema: le,
566
- autofocus: g && j === 0,
567
- onBlur: u,
568
- onFocus: c,
569
- rawErrors: f,
570
- totalItems: S.length
571
- });
572
- }),
573
- onAddClick: this.onAddClick,
574
- readonly: h,
575
- required: y,
576
- registry: i,
577
- schema: e,
578
- uiSchema: n,
579
- title: v,
580
- formContext: w,
581
- rawErrors: f
582
- }, A = B("ArrayFieldTemplate", i, C);
583
- return p(A, Object.assign({}, P));
584
- }
585
- /** Renders the individual array item using a `SchemaField` along with the additional properties required to be send
586
- * back to the `ArrayFieldItemTemplate`.
587
- *
588
- * @param props - The props for the individual array item to be rendered
589
- */
590
- renderArrayFieldItem(e) {
591
- const { key: n, index: r, name: a, canAdd: s, canRemove: o = !0, canMoveUp: l, canMoveDown: d, itemSchema: m, itemData: h, itemUiSchema: g, itemIdSchema: y, itemErrorSchema: i, autofocus: u, onBlur: c, onFocus: f, rawErrors: S, totalItems: b } = e, { disabled: v, hideError: C, idPrefix: F, idSeparator: w, readonly: O, uiSchema: k, registry: D, formContext: T } = this.props, { fields: { ArraySchemaField: P, SchemaField: A }, globalUiOptions: _ } = D, j = P || A, { orderable: E = !0, removable: L = !0, copyable: N = !1 } = R(k, _), x = {
592
- moveUp: E && l,
593
- moveDown: E && d,
594
- copy: N && s,
595
- remove: L && o,
596
- toolbar: !1
597
- };
598
- return x.toolbar = Object.keys(x).some((M) => x[M]), {
599
- children: p(j, { name: a, index: r, schema: m, uiSchema: g, formData: h, formContext: T, errorSchema: i, idPrefix: F, idSeparator: w, idSchema: y, required: this.isItemRequired(m), onChange: this.onChangeForIndex(r), onBlur: c, onFocus: f, registry: D, disabled: v, readonly: O, hideError: C, autofocus: u, rawErrors: S }),
600
- className: "array-item",
601
- disabled: v,
602
- canAdd: s,
603
- hasCopy: x.copy,
604
- hasToolbar: x.toolbar,
605
- hasMoveUp: x.moveUp,
606
- hasMoveDown: x.moveDown,
607
- hasRemove: x.remove,
608
- index: r,
609
- totalItems: b,
610
- key: n,
611
- onAddIndexClick: this.onAddIndexClick,
612
- onCopyIndexClick: this.onCopyIndexClick,
613
- onDropIndexClick: this.onDropIndexClick,
614
- onReorderClick: this.onReorderClick,
615
- readonly: O,
616
- registry: D,
617
- schema: m,
618
- uiSchema: g
619
- };
620
- }
621
- }
622
- function Zn(t) {
623
- var e, n;
624
- const { schema: r, name: a, uiSchema: s, idSchema: o, formData: l, registry: d, required: m, disabled: h, readonly: g, hideError: y, autofocus: i, onChange: u, onFocus: c, onBlur: f, rawErrors: S } = t, { title: b } = r, { widgets: v, formContext: C, translateString: F, globalUiOptions: w } = d, O = R(s, w), {
625
- widget: k = "checkbox",
626
- title: D,
627
- // Unlike the other fields, don't use `getDisplayLabel()` since it always returns false for the boolean type
628
- label: T = !0
629
- } = O, P = H(O, ["widget", "title", "label"]), A = G(r, k, v), _ = F($.YesLabel), j = F($.NoLabel);
630
- let E;
631
- const L = (e = D ?? b) !== null && e !== void 0 ? e : a;
632
- if (Array.isArray(r.oneOf))
633
- E = he({
634
- oneOf: r.oneOf.map((N) => {
635
- if (Q(N))
636
- return Object.assign(Object.assign({}, N), { title: N.title || (N.const === !0 ? _ : j) });
637
- }).filter((N) => N)
638
- // cast away the error that typescript can't grok is fixed
639
- });
640
- else {
641
- const N = r, x = (n = r.enum) !== null && n !== void 0 ? n : [!0, !1];
642
- !N.enumNames && x.length === 2 && x.every((M) => typeof M == "boolean") ? E = [
643
- {
644
- value: x[0],
645
- label: x[0] ? _ : j
646
- },
647
- {
648
- value: x[1],
649
- label: x[1] ? _ : j
650
- }
651
- ] : E = he({
652
- enum: x,
653
- // NOTE: enumNames is deprecated, but still supported for now.
654
- enumNames: N.enumNames
655
- });
656
- }
657
- return p(A, { options: Object.assign(Object.assign({}, P), { enumOptions: E }), schema: r, uiSchema: s, id: o.$id, name: a, onChange: u, onFocus: c, onBlur: f, label: L, hideLabel: !T, value: l, required: m, disabled: h, readonly: g, hideError: y, registry: d, formContext: C, autofocus: i, rawErrors: S });
658
- }
659
- class nt extends fe {
660
- /** Constructs an `AnyOfField` with the given `props` to initialize the initially selected option in state
661
- *
662
- * @param props - The `FieldProps` for this template
663
- */
664
- constructor(e) {
665
- super(e), this.onOptionChange = (o) => {
666
- const { selectedOption: l, retrievedOptions: d } = this.state, { formData: m, onChange: h, registry: g } = this.props, { schemaUtils: y } = g, i = o !== void 0 ? parseInt(o, 10) : -1;
667
- if (i === l)
668
- return;
669
- const u = i >= 0 ? d[i] : void 0, c = l >= 0 ? d[l] : void 0;
670
- let f = y.sanitizeDataForNewSchema(u, c, m);
671
- f && u && (f = y.getDefaultFormState(u, f, "excludeObjectChildren")), h(f, void 0, this.getFieldId()), this.setState({ selectedOption: i });
672
- };
673
- const { formData: n, options: r, registry: { schemaUtils: a } } = this.props, s = r.map((o) => a.retrieveSchema(o, n));
674
- this.state = {
675
- retrievedOptions: s,
676
- selectedOption: this.getMatchingOption(0, n, s)
677
- };
678
- }
679
- /** React lifecycle method that is called when the props and/or state for this component is updated. It recomputes the
680
- * currently selected option based on the overall `formData`
681
- *
682
- * @param prevProps - The previous `FieldProps` for this template
683
- * @param prevState - The previous `AnyOfFieldState` for this template
684
- */
685
- componentDidUpdate(e, n) {
686
- const { formData: r, options: a, idSchema: s } = this.props, { selectedOption: o } = this.state;
687
- let l = this.state;
688
- if (!Ae(e.options, a)) {
689
- const { registry: { schemaUtils: d } } = this.props, m = a.map((h) => d.retrieveSchema(h, r));
690
- l = { selectedOption: o, retrievedOptions: m };
691
- }
692
- if (!Ae(r, e.formData) && s.$id === e.idSchema.$id) {
693
- const { retrievedOptions: d } = l, m = this.getMatchingOption(o, r, d);
694
- n && m !== o && (l = { selectedOption: m, retrievedOptions: d });
695
- }
696
- l !== this.state && this.setState(l);
697
- }
698
- /** Determines the best matching option for the given `formData` and `options`.
699
- *
700
- * @param formData - The new formData
701
- * @param options - The list of options to choose from
702
- * @return - The index of the `option` that best matches the `formData`
703
- */
704
- getMatchingOption(e, n, r) {
705
- const { schema: a, registry: { schemaUtils: s } } = this.props, o = rn(a);
706
- return s.getClosestMatchingOption(n, r, e, o);
707
- }
708
- getFieldId() {
709
- const { idSchema: e, schema: n } = this.props;
710
- return `${e.$id}${n.oneOf ? "__oneof_select" : "__anyof_select"}`;
711
- }
712
- /** Renders the `AnyOfField` selector along with a `SchemaField` for the value of the `formData`
713
- */
714
- render() {
715
- const { name: e, disabled: n = !1, errorSchema: r = {}, formContext: a, onBlur: s, onFocus: o, registry: l, schema: d, uiSchema: m } = this.props, { widgets: h, fields: g, translateString: y, globalUiOptions: i, schemaUtils: u } = l, { SchemaField: c } = g, { selectedOption: f, retrievedOptions: S } = this.state, b = R(m, i), { widget: v = "select", placeholder: C, autofocus: F, autocomplete: w, title: O = d.title } = b, k = H(b, ["widget", "placeholder", "autofocus", "autocomplete", "title"]), D = G({ type: "number" }, v, h), T = J(r, Ge, []), P = je(r, [Ge]), A = u.getDisplayLabel(d, m, i), _ = f >= 0 && S[f] || null;
716
- let j;
717
- if (_) {
718
- const { required: x } = d;
719
- j = x ? an({ required: x }, _) : _;
720
- }
721
- const E = O ? $.TitleOptionPrefix : $.OptionPrefix, L = O ? [O] : [], N = S.map((x, M) => ({
722
- label: x.title || y(E, L.concat(String(M + 1))),
723
- value: M
724
- }));
725
- return U("div", Object.assign({ className: "panel panel-default panel-body" }, { children: [p("div", Object.assign({ className: "form-group" }, { children: p(D, { id: this.getFieldId(), name: `${e}${d.oneOf ? "__oneof_select" : "__anyof_select"}`, schema: { type: "number", default: 0 }, onChange: this.onOptionChange, onBlur: s, onFocus: o, disabled: n || sn(N), multiple: !1, rawErrors: T, errorSchema: P, value: f >= 0 ? f : void 0, options: Object.assign({ enumOptions: N }, k), registry: l, formContext: a, placeholder: C, autocomplete: w, autofocus: F, label: O ?? e, hideLabel: !A }) })), _ !== null && p(c, Object.assign({}, this.props, { schema: j }))] }));
726
- }
727
- }
728
- const Jn = /\.([0-9]*0)*$/, Qn = /[0.]0*$/;
729
- function er(t) {
730
- const { registry: e, onChange: n, formData: r, value: a } = t, [s, o] = Ue(a), { StringField: l } = e.fields;
731
- let d = r;
732
- const m = W((h) => {
733
- o(h), `${h}`.charAt(0) === "." && (h = `0${h}`);
734
- const g = typeof h == "string" && h.match(Jn) ? Qe(h.replace(Qn, "")) : Qe(h);
735
- n(g);
736
- }, [n]);
737
- if (typeof s == "string" && typeof d == "number") {
738
- const h = new RegExp(`${d}`.replace(".", "\\.") + "\\.?0*$");
739
- s.match(h) && (d = s);
740
- }
741
- return p(l, Object.assign({}, t, { formData: d, onChange: m }));
742
- }
743
- function te() {
744
- return te = Object.assign ? Object.assign.bind() : function(t) {
745
- for (var e = 1; e < arguments.length; e++) {
746
- var n = arguments[e];
747
- for (var r in n)
748
- Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
749
- }
750
- return t;
751
- }, te.apply(this, arguments);
752
- }
753
- const tr = ["children", "options"], rt = ["allowFullScreen", "allowTransparency", "autoComplete", "autoFocus", "autoPlay", "cellPadding", "cellSpacing", "charSet", "className", "classId", "colSpan", "contentEditable", "contextMenu", "crossOrigin", "encType", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "frameBorder", "hrefLang", "inputMode", "keyParams", "keyType", "marginHeight", "marginWidth", "maxLength", "mediaGroup", "minLength", "noValidate", "radioGroup", "readOnly", "rowSpan", "spellCheck", "srcDoc", "srcLang", "srcSet", "tabIndex", "useMap"].reduce((t, e) => (t[e.toLowerCase()] = e, t), { for: "htmlFor" }), it = { amp: "&", apos: "'", gt: ">", lt: "<", nbsp: " ", quot: "“" }, nr = ["style", "script"], rr = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi, ir = /mailto:/i, ar = /\n{2,}$/, ht = /^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/, sr = /^ *> ?/gm, or = /^ {2,}\n/, lr = /^(?:( *[-*_])){3,} *(?:\n *)+\n/, ft = /^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/, gt = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/, cr = /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, dr = /^(?:\n *)*\n/, ur = /\r\n?/g, mr = /^\[\^([^\]]+)](:.*)\n/, pr = /^\[\^([^\]]+)]/, hr = /\f/g, fr = /^\s*?\[(x|\s)\]/, yt = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/, bt = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/, St = /^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/, Be = /^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i, gr = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi, Ot = /^<!--[\s\S]*?(?:-->)/, yr = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/, _e = /^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i, br = /^\{.*\}$/, Sr = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, Or = /^<([^ >]+@[^ >]+)>/, Fr = /^<([^ >]+:\/[^ >]+)>/, vr = /-([a-z])?/gi, Ft = /^(.*\|?.*)\n *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*)\n?/, Cr = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/, kr = /^!\[([^\]]*)\] ?\[([^\]]*)\]/, wr = /^\[([^\]]*)\] ?\[([^\]]*)\]/, Dr = /(\[|\])/g, Tr = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/, Nr = /\t/g, Ir = /^ *\| */, xr = /(^ *\||\| *$)/g, jr = / *$/, Ar = /^ *:-+: *$/, Er = /^ *:-+ *$/, Br = /^ *-+: *$/, _r = /^([*_])\1((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1\1(?!\1)/, $r = /^([*_])((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~+.*?~+|.)*?)\1(?!\1|\w)/, Ur = /^==((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)==/, Wr = /^~~((?:\[.*?\]|<.*?>(?:.*?<.*?>)?|`.*?`|.)*?)~~/, Pr = /^\\([^0-9A-Za-z\s])/, Mr = /^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i, Rr = /^\n+/, Lr = /^([ \t]*)/, Hr = /\\([^\\])/g, at = / *\n+$/, qr = /(?:^|\n)( *)$/, Le = "(?:\\d+\\.)", He = "(?:[*+-])";
754
- function vt(t) {
755
- return "( *)(" + (t === 1 ? Le : He) + ") +";
756
- }
757
- const Ct = vt(1), kt = vt(2);
758
- function wt(t) {
759
- return new RegExp("^" + (t === 1 ? Ct : kt));
760
- }
761
- const Kr = wt(1), Vr = wt(2);
762
- function Dt(t) {
763
- return new RegExp("^" + (t === 1 ? Ct : kt) + "[^\\n]*(?:\\n(?!\\1" + (t === 1 ? Le : He) + " )[^\\n]*)*(\\n|$)", "gm");
764
- }
765
- const Tt = Dt(1), Nt = Dt(2);
766
- function It(t) {
767
- const e = t === 1 ? Le : He;
768
- return new RegExp("^( *)(" + e + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + e + " (?!" + e + " ))\\n*|\\s*\\n*$)");
769
- }
770
- const xt = It(1), jt = It(2);
771
- function st(t, e) {
772
- const n = e === 1, r = n ? xt : jt, a = n ? Tt : Nt, s = n ? Kr : Vr;
773
- return { t(o, l, d) {
774
- const m = qr.exec(d);
775
- return m && (l.o || !l._ && !l.u) ? r.exec(o = m[1] + o) : null;
776
- }, i: I.HIGH, l(o, l, d) {
777
- const m = n ? +o[2] : void 0, h = o[0].replace(ar, `
778
- `).match(a);
779
- let g = !1;
780
- return { p: h.map(function(y, i) {
781
- const u = s.exec(y)[0].length, c = new RegExp("^ {1," + u + "}", "gm"), f = y.replace(c, "").replace(s, ""), S = i === h.length - 1, b = f.indexOf(`
782
-
783
- `) !== -1 || S && g;
784
- g = b;
785
- const v = d._, C = d.o;
786
- let F;
787
- d.o = !0, b ? (d._ = !1, F = f.replace(at, `
788
-
789
- `)) : (d._ = !0, F = f.replace(at, ""));
790
- const w = l(F, d);
791
- return d._ = v, d.o = C, w;
792
- }), m: n, g: m };
793
- }, h: (o, l, d) => t(o.m ? "ol" : "ul", { key: d.k, start: o.g }, o.p.map(function(m, h) {
794
- return t("li", { key: h }, l(m, d));
795
- })) };
796
- }
797
- const Gr = /^\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/, Yr = /^!\[([^\]]*)]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/, At = [ht, ft, gt, yt, St, bt, Ot, Ft, Tt, xt, Nt, jt], zr = [...At, /^[^\n]+(?: \n|\n{2,})/, Be, _e];
798
- function Xr(t) {
799
- return t.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase();
800
- }
801
- function Zr(t) {
802
- return Br.test(t) ? "right" : Ar.test(t) ? "center" : Er.test(t) ? "left" : null;
803
- }
804
- function ot(t, e, n) {
805
- const r = n.$;
806
- n.$ = !0;
807
- const a = e(t.trim(), n);
808
- n.$ = r;
809
- let s = [[]];
810
- return a.forEach(function(o, l) {
811
- o.type === "tableSeparator" ? l !== 0 && l !== a.length - 1 && s.push([]) : (o.type !== "text" || a[l + 1] != null && a[l + 1].type !== "tableSeparator" || (o.v = o.v.replace(jr, "")), s[s.length - 1].push(o));
812
- }), s;
813
- }
814
- function Jr(t, e, n) {
815
- n._ = !0;
816
- const r = ot(t[1], e, n), a = t[2].replace(xr, "").split("|").map(Zr), s = function(o, l, d) {
817
- return o.trim().split(`
818
- `).map(function(m) {
819
- return ot(m, l, d);
820
- });
821
- }(t[3], e, n);
822
- return n._ = !1, { S: a, A: s, L: r, type: "table" };
823
- }
824
- function lt(t, e) {
825
- return t.S[e] == null ? {} : { textAlign: t.S[e] };
826
- }
827
- function z(t) {
828
- return function(e, n) {
829
- return n._ ? t.exec(e) : null;
830
- };
831
- }
832
- function X(t) {
833
- return function(e, n) {
834
- return n._ || n.u ? t.exec(e) : null;
835
- };
836
- }
837
- function V(t) {
838
- return function(e, n) {
839
- return n._ || n.u ? null : t.exec(e);
840
- };
841
- }
842
- function se(t) {
843
- return function(e) {
844
- return t.exec(e);
845
- };
846
- }
847
- function Qr(t, e, n) {
848
- if (e._ || e.u || n && !n.endsWith(`
849
- `))
850
- return null;
851
- let r = "";
852
- t.split(`
853
- `).every((s) => !At.some((o) => o.test(s)) && (r += s + `
854
- `, s.trim()));
855
- const a = r.trimEnd();
856
- return a == "" ? null : [r, a];
857
- }
858
- function re(t) {
859
- try {
860
- if (decodeURIComponent(t).replace(/[^A-Za-z0-9/:]/g, "").match(/^\s*(javascript|vbscript|data(?!:image)):/i))
861
- return;
862
- } catch {
863
- return null;
864
- }
865
- return t;
866
- }
867
- function ct(t) {
868
- return t.replace(Hr, "$1");
869
- }
870
- function me(t, e, n) {
871
- const r = n._ || !1, a = n.u || !1;
872
- n._ = !0, n.u = !0;
873
- const s = t(e, n);
874
- return n._ = r, n.u = a, s;
875
- }
876
- function ei(t, e, n) {
877
- const r = n._ || !1, a = n.u || !1;
878
- n._ = !1, n.u = !0;
879
- const s = t(e, n);
880
- return n._ = r, n.u = a, s;
881
- }
882
- function ti(t, e, n) {
883
- return n._ = !1, t(e, n);
884
- }
885
- const De = (t, e, n) => ({ v: me(e, t[1], n) });
886
- function Te() {
887
- return {};
888
- }
889
- function Ne() {
890
- return null;
891
- }
892
- function ni(...t) {
893
- return t.filter(Boolean).join(" ");
894
- }
895
- function Ie(t, e, n) {
896
- let r = t;
897
- const a = e.split(".");
898
- for (; a.length && (r = r[a[0]], r !== void 0); )
899
- a.shift();
900
- return r || n;
901
- }
902
- var I;
903
- function ri(t, e = {}) {
904
- e.overrides = e.overrides || {}, e.slugify = e.slugify || Xr, e.namedCodesToUnicode = e.namedCodesToUnicode ? te({}, it, e.namedCodesToUnicode) : it;
905
- const n = e.createElement || de.createElement;
906
- function r(i, u, ...c) {
907
- const f = Ie(e.overrides, `${i}.props`, {});
908
- return n(function(S, b) {
909
- const v = Ie(b, S);
910
- return v ? typeof v == "function" || typeof v == "object" && "render" in v ? v : Ie(b, `${S}.component`, S) : S;
911
- }(i, e.overrides), te({}, u, f, { className: ni(u?.className, f.className) || void 0 }), ...c);
912
- }
913
- function a(i) {
914
- let u = !1;
915
- e.forceInline ? u = !0 : e.forceBlock || (u = Tr.test(i) === !1);
916
- const c = h(m(u ? i : `${i.trimEnd().replace(Rr, "")}
917
-
918
- `, { _: u }));
919
- for (; typeof c[c.length - 1] == "string" && !c[c.length - 1].trim(); )
920
- c.pop();
921
- if (e.wrapper === null)
922
- return c;
923
- const f = e.wrapper || (u ? "span" : "div");
924
- let S;
925
- if (c.length > 1 || e.forceWrapper)
926
- S = c;
927
- else {
928
- if (c.length === 1)
929
- return S = c[0], typeof S == "string" ? r("span", { key: "outer" }, S) : S;
930
- S = null;
931
- }
932
- return de.createElement(f, { key: "outer" }, S);
933
- }
934
- function s(i) {
935
- const u = i.match(rr);
936
- return u ? u.reduce(function(c, f, S) {
937
- const b = f.indexOf("=");
938
- if (b !== -1) {
939
- const v = function(O) {
940
- return O.indexOf("-") !== -1 && O.match(yr) === null && (O = O.replace(vr, function(k, D) {
941
- return D.toUpperCase();
942
- })), O;
943
- }(f.slice(0, b)).trim(), C = function(O) {
944
- const k = O[0];
945
- return (k === '"' || k === "'") && O.length >= 2 && O[O.length - 1] === k ? O.slice(1, -1) : O;
946
- }(f.slice(b + 1).trim()), F = rt[v] || v, w = c[F] = function(O, k) {
947
- return O === "style" ? k.split(/;\s?/).reduce(function(D, T) {
948
- const P = T.slice(0, T.indexOf(":"));
949
- return D[P.replace(/(-[a-z])/g, (A) => A[1].toUpperCase())] = T.slice(P.length + 1).trim(), D;
950
- }, {}) : O === "href" ? re(k) : (k.match(br) && (k = k.slice(1, k.length - 1)), k === "true" || k !== "false" && k);
951
- }(v, C);
952
- typeof w == "string" && (Be.test(w) || _e.test(w)) && (c[F] = de.cloneElement(a(w.trim()), { key: S }));
953
- } else
954
- f !== "style" && (c[rt[f] || f] = !0);
955
- return c;
956
- }, {}) : null;
957
- }
958
- const o = [], l = {}, d = { blockQuote: { t: V(ht), i: I.HIGH, l: (i, u, c) => ({ v: u(i[0].replace(sr, ""), c) }), h: (i, u, c) => r("blockquote", { key: c.k }, u(i.v, c)) }, breakLine: { t: se(or), i: I.HIGH, l: Te, h: (i, u, c) => r("br", { key: c.k }) }, breakThematic: { t: V(lr), i: I.HIGH, l: Te, h: (i, u, c) => r("hr", { key: c.k }) }, codeBlock: { t: V(gt), i: I.MAX, l: (i) => ({ v: i[0].replace(/^ {4}/gm, "").replace(/\n+$/, ""), M: void 0 }), h: (i, u, c) => r("pre", { key: c.k }, r("code", te({}, i.O, { className: i.M ? `lang-${i.M}` : "" }), i.v)) }, codeFenced: { t: V(ft), i: I.MAX, l: (i) => ({ O: s(i[3] || ""), v: i[4], M: i[2] || void 0, type: "codeBlock" }) }, codeInline: { t: X(cr), i: I.LOW, l: (i) => ({ v: i[2] }), h: (i, u, c) => r("code", { key: c.k }, i.v) }, footnote: { t: V(mr), i: I.MAX, l: (i) => (o.push({ I: i[2], j: i[1] }), {}), h: Ne }, footnoteReference: { t: z(pr), i: I.HIGH, l: (i) => ({ v: i[1], B: `#${e.slugify(i[1])}` }), h: (i, u, c) => r("a", { key: c.k, href: re(i.B) }, r("sup", { key: c.k }, i.v)) }, gfmTask: { t: z(fr), i: I.HIGH, l: (i) => ({ R: i[1].toLowerCase() === "x" }), h: (i, u, c) => r("input", { checked: i.R, key: c.k, readOnly: !0, type: "checkbox" }) }, heading: { t: V(e.enforceAtxHeadings ? bt : yt), i: I.HIGH, l: (i, u, c) => ({ v: me(u, i[2], c), T: e.slugify(i[2]), C: i[1].length }), h: (i, u, c) => r(`h${i.C}`, { id: i.T, key: c.k }, u(i.v, c)) }, headingSetext: { t: V(St), i: I.MAX, l: (i, u, c) => ({ v: me(u, i[1], c), C: i[2] === "=" ? 1 : 2, type: "heading" }) }, htmlComment: { t: se(Ot), i: I.HIGH, l: () => ({}), h: Ne }, image: { t: X(Yr), i: I.HIGH, l: (i) => ({ D: i[1], B: ct(i[2]), F: i[3] }), h: (i, u, c) => r("img", { key: c.k, alt: i.D || void 0, title: i.F || void 0, src: re(i.B) }) }, link: { t: z(Gr), i: I.LOW, l: (i, u, c) => ({ v: ei(u, i[1], c), B: ct(i[2]), F: i[3] }), h: (i, u, c) => r("a", { key: c.k, href: re(i.B), title: i.F }, u(i.v, c)) }, linkAngleBraceStyleDetector: { t: z(Fr), i: I.MAX, l: (i) => ({ v: [{ v: i[1], type: "text" }], B: i[1], type: "link" }) }, linkBareUrlDetector: { t: (i, u) => u.N ? null : z(Sr)(i, u), i: I.MAX, l: (i) => ({ v: [{ v: i[1], type: "text" }], B: i[1], F: void 0, type: "link" }) }, linkMailtoDetector: { t: z(Or), i: I.MAX, l(i) {
959
- let u = i[1], c = i[1];
960
- return ir.test(c) || (c = "mailto:" + c), { v: [{ v: u.replace("mailto:", ""), type: "text" }], B: c, type: "link" };
961
- } }, orderedList: st(r, 1), unorderedList: st(r, 2), newlineCoalescer: { t: V(dr), i: I.LOW, l: Te, h: () => `
962
- ` }, paragraph: { t: Qr, i: I.LOW, l: De, h: (i, u, c) => r("p", { key: c.k }, u(i.v, c)) }, ref: { t: z(Cr), i: I.MAX, l: (i) => (l[i[1]] = { B: i[2], F: i[4] }, {}), h: Ne }, refImage: { t: X(kr), i: I.MAX, l: (i) => ({ D: i[1] || void 0, P: i[2] }), h: (i, u, c) => r("img", { key: c.k, alt: i.D, src: re(l[i.P].B), title: l[i.P].F }) }, refLink: { t: z(wr), i: I.MAX, l: (i, u, c) => ({ v: u(i[1], c), Z: u(i[0].replace(Dr, "\\$1"), c), P: i[2] }), h: (i, u, c) => l[i.P] ? r("a", { key: c.k, href: re(l[i.P].B), title: l[i.P].F }, u(i.v, c)) : r("span", { key: c.k }, u(i.Z, c)) }, table: { t: V(Ft), i: I.HIGH, l: Jr, h: (i, u, c) => r("table", { key: c.k }, r("thead", null, r("tr", null, i.L.map(function(f, S) {
963
- return r("th", { key: S, style: lt(i, S) }, u(f, c));
964
- }))), r("tbody", null, i.A.map(function(f, S) {
965
- return r("tr", { key: S }, f.map(function(b, v) {
966
- return r("td", { key: v, style: lt(i, v) }, u(b, c));
967
- }));
968
- }))) }, tableSeparator: { t: function(i, u) {
969
- return u.$ ? (u._ = !0, Ir.exec(i)) : null;
970
- }, i: I.HIGH, l: function() {
971
- return { type: "tableSeparator" };
972
- }, h: () => " | " }, text: { t: se(Mr), i: I.MIN, l: (i) => ({ v: i[0].replace(gr, (u, c) => e.namedCodesToUnicode[c] ? e.namedCodesToUnicode[c] : u) }), h: (i) => i.v }, textBolded: { t: X(_r), i: I.MED, l: (i, u, c) => ({ v: u(i[2], c) }), h: (i, u, c) => r("strong", { key: c.k }, u(i.v, c)) }, textEmphasized: { t: X($r), i: I.LOW, l: (i, u, c) => ({ v: u(i[2], c) }), h: (i, u, c) => r("em", { key: c.k }, u(i.v, c)) }, textEscaped: { t: X(Pr), i: I.HIGH, l: (i) => ({ v: i[1], type: "text" }) }, textMarked: { t: X(Ur), i: I.LOW, l: De, h: (i, u, c) => r("mark", { key: c.k }, u(i.v, c)) }, textStrikethroughed: { t: X(Wr), i: I.LOW, l: De, h: (i, u, c) => r("del", { key: c.k }, u(i.v, c)) } };
973
- e.disableParsingRawHTML !== !0 && (d.htmlBlock = { t: se(Be), i: I.HIGH, l(i, u, c) {
974
- const [, f] = i[3].match(Lr), S = new RegExp(`^${f}`, "gm"), b = i[3].replace(S, ""), v = (C = b, zr.some((k) => k.test(C)) ? ti : me);
975
- var C;
976
- const F = i[1].toLowerCase(), w = nr.indexOf(F) !== -1;
977
- c.N = c.N || F === "a";
978
- const O = w ? i[3] : v(u, b, c);
979
- return c.N = !1, { O: s(i[2]), v: O, G: w, H: w ? F : i[1] };
980
- }, h: (i, u, c) => r(i.H, te({ key: c.k }, i.O), i.G ? i.v : u(i.v, c)) }, d.htmlSelfClosing = { t: se(_e), i: I.HIGH, l: (i) => ({ O: s(i[2] || ""), H: i[1] }), h: (i, u, c) => r(i.H, te({}, i.O, { key: c.k })) });
981
- const m = function(i) {
982
- let u = Object.keys(i);
983
- function c(f, S) {
984
- let b = [], v = "";
985
- for (; f; ) {
986
- let C = 0;
987
- for (; C < u.length; ) {
988
- const F = u[C], w = i[F], O = w.t(f, S, v);
989
- if (O) {
990
- const k = O[0];
991
- f = f.substring(k.length);
992
- const D = w.l(O, c, S);
993
- D.type == null && (D.type = F), b.push(D), v = k;
994
- break;
995
- }
996
- C++;
997
- }
998
- }
999
- return b;
1000
- }
1001
- return u.sort(function(f, S) {
1002
- let b = i[f].i, v = i[S].i;
1003
- return b !== v ? b - v : f < S ? -1 : 1;
1004
- }), function(f, S) {
1005
- return c(function(b) {
1006
- return b.replace(ur, `
1007
- `).replace(hr, "").replace(Nr, " ");
1008
- }(f), S);
1009
- };
1010
- }(d), h = (g = function(i) {
1011
- return function(u, c, f) {
1012
- return i[u.type].h(u, c, f);
1013
- };
1014
- }(d), function i(u, c = {}) {
1015
- if (Array.isArray(u)) {
1016
- const f = c.k, S = [];
1017
- let b = !1;
1018
- for (let v = 0; v < u.length; v++) {
1019
- c.k = v;
1020
- const C = i(u[v], c), F = typeof C == "string";
1021
- F && b ? S[S.length - 1] += C : C !== null && S.push(C), b = F;
1022
- }
1023
- return c.k = f, S;
1024
- }
1025
- return g(u, i, c);
1026
- });
1027
- var g;
1028
- const y = a(t);
1029
- return o.length ? r("div", null, y, r("footer", { key: "footer" }, o.map(function(i) {
1030
- return r("div", { id: e.slugify(i.j), key: i.j }, i.j, h(m(i.I, { _: !0 })));
1031
- }))) : y;
1032
- }
1033
- (function(t) {
1034
- t[t.MAX = 0] = "MAX", t[t.HIGH = 1] = "HIGH", t[t.MED = 2] = "MED", t[t.LOW = 3] = "LOW", t[t.MIN = 4] = "MIN";
1035
- })(I || (I = {}));
1036
- const ye = (t) => {
1037
- let { children: e, options: n } = t, r = function(a, s) {
1038
- if (a == null)
1039
- return {};
1040
- var o, l, d = {}, m = Object.keys(a);
1041
- for (l = 0; l < m.length; l++)
1042
- s.indexOf(o = m[l]) >= 0 || (d[o] = a[o]);
1043
- return d;
1044
- }(t, tr);
1045
- return de.cloneElement(ri(e, n), r);
1046
- };
1047
- var ii = on;
1048
- function ai(t, e) {
1049
- return t == null ? !0 : ii(t, e);
1050
- }
1051
- var si = ai;
1052
- const oi = /* @__PURE__ */ Me(si);
1053
- class li extends fe {
1054
- constructor() {
1055
- super(...arguments), this.state = {
1056
- wasPropertyKeyModified: !1,
1057
- additionalProperties: {}
1058
- }, this.onPropertyChange = (e, n = !1) => (r, a, s) => {
1059
- const { formData: o, onChange: l, errorSchema: d } = this.props;
1060
- r === void 0 && n && (r = "");
1061
- const m = Object.assign(Object.assign({}, o), { [e]: r });
1062
- l(m, d && d && Object.assign(Object.assign({}, d), { [e]: a }), s);
1063
- }, this.onDropPropertyClick = (e) => (n) => {
1064
- n.preventDefault();
1065
- const { onChange: r, formData: a } = this.props, s = Object.assign({}, a);
1066
- oi(s, e), r(s);
1067
- }, this.getAvailableKey = (e, n) => {
1068
- const { uiSchema: r, registry: a } = this.props, { duplicateKeySuffixSeparator: s = "-" } = R(r, a.globalUiOptions);
1069
- let o = 0, l = e;
1070
- for (; Ye(n, l); )
1071
- l = `${e}${s}${++o}`;
1072
- return l;
1073
- }, this.onKeyChange = (e) => (n, r) => {
1074
- if (e === n)
1075
- return;
1076
- const { formData: a, onChange: s, errorSchema: o } = this.props;
1077
- n = this.getAvailableKey(n, a);
1078
- const l = Object.assign({}, a), d = { [e]: n }, m = Object.keys(l).map((g) => ({ [d[g] || g]: l[g] })), h = Object.assign({}, ...m);
1079
- this.setState({ wasPropertyKeyModified: !0 }), s(h, o && o && Object.assign(Object.assign({}, o), { [n]: r }));
1080
- }, this.handleAddClick = (e) => () => {
1081
- if (!e.additionalProperties)
1082
- return;
1083
- const { formData: n, onChange: r, registry: a } = this.props, s = Object.assign({}, n);
1084
- let o;
1085
- if (Q(e.additionalProperties)) {
1086
- o = e.additionalProperties.type;
1087
- let d = e.additionalProperties;
1088
- if (ze in d) {
1089
- const { schemaUtils: m } = a;
1090
- d = m.retrieveSchema({ $ref: d[ze] }, n), o = d.type;
1091
- }
1092
- !o && (ln in d || cn in d) && (o = "object");
1093
- }
1094
- const l = this.getAvailableKey("newKey", s);
1095
- q(s, l, this.getDefaultValue(o)), r(s);
1096
- };
1097
- }
1098
- /** Returns a flag indicating whether the `name` field is required in the object schema
1099
- *
1100
- * @param name - The name of the field to check for required-ness
1101
- * @returns - True if the field `name` is required, false otherwise
1102
- */
1103
- isRequired(e) {
1104
- const { schema: n } = this.props;
1105
- return Array.isArray(n.required) && n.required.indexOf(e) !== -1;
1106
- }
1107
- /** Returns a default value to be used for a new additional schema property of the given `type`
1108
- *
1109
- * @param type - The type of the new additional schema property
1110
- */
1111
- getDefaultValue(e) {
1112
- const { registry: { translateString: n } } = this.props;
1113
- switch (e) {
1114
- case "array":
1115
- return [];
1116
- case "boolean":
1117
- return !1;
1118
- case "null":
1119
- return null;
1120
- case "number":
1121
- return 0;
1122
- case "object":
1123
- return {};
1124
- case "string":
1125
- default:
1126
- return n($.NewStringDefault);
1127
- }
1128
- }
1129
- /** Renders the `ObjectField` from the given props
1130
- */
1131
- render() {
1132
- var e, n, r;
1133
- const { schema: a, uiSchema: s = {}, formData: o, errorSchema: l, idSchema: d, name: m, required: h = !1, disabled: g = !1, readonly: y = !1, hideError: i, idPrefix: u, idSeparator: c, onBlur: f, onFocus: S, registry: b } = this.props, { fields: v, formContext: C, schemaUtils: F, translateString: w, globalUiOptions: O } = b, { SchemaField: k } = v, D = F.retrieveSchema(a, o), T = R(s, O), { properties: P = {} } = D, A = (n = (e = T.title) !== null && e !== void 0 ? e : D.title) !== null && n !== void 0 ? n : m, _ = (r = T.description) !== null && r !== void 0 ? r : D.description;
1134
- let j;
1135
- try {
1136
- const N = Object.keys(P);
1137
- j = Bn(N, T.order);
1138
- } catch (N) {
1139
- return U("div", { children: [p("p", Object.assign({ className: "config-error", style: { color: "red" } }, { children: p(ye, { children: w($.InvalidObjectField, [m || "root", N.message]) }) })), p("pre", { children: JSON.stringify(D) })] });
1140
- }
1141
- const E = B("ObjectFieldTemplate", b, T), L = {
1142
- // getDisplayLabel() always returns false for object types, so just check the `uiOptions.label`
1143
- title: T.label === !1 ? "" : A,
1144
- description: T.label === !1 ? void 0 : _,
1145
- properties: j.map((N) => {
1146
- const x = Ye(D, [Xe, N, Pe]), M = x ? s.additionalProperties : s[N], ie = R(M).widget === "hidden", Y = J(d, [N], {});
1147
- return {
1148
- content: p(k, { name: N, required: this.isRequired(N), schema: J(D, [Xe, N], {}), uiSchema: M, errorSchema: J(l, N), idSchema: Y, idPrefix: u, idSeparator: c, formData: J(o, N), formContext: C, wasPropertyKeyModified: this.state.wasPropertyKeyModified, onKeyChange: this.onKeyChange(N), onChange: this.onPropertyChange(N, x), onBlur: f, onFocus: S, registry: b, disabled: g, readonly: y, hideError: i, onDropPropertyClick: this.onDropPropertyClick }, N),
1149
- name: N,
1150
- readonly: y,
1151
- disabled: g,
1152
- required: h,
1153
- hidden: ie
1154
- };
1155
- }),
1156
- readonly: y,
1157
- disabled: g,
1158
- required: h,
1159
- idSchema: d,
1160
- uiSchema: s,
1161
- errorSchema: l,
1162
- schema: D,
1163
- formData: o,
1164
- formContext: C,
1165
- registry: b
1166
- };
1167
- return p(E, Object.assign({}, L, { onAddClick: this.handleAddClick }));
1168
- }
1169
- }
1170
- const ci = {
1171
- array: "ArrayField",
1172
- boolean: "BooleanField",
1173
- integer: "NumberField",
1174
- number: "NumberField",
1175
- object: "ObjectField",
1176
- string: "StringField",
1177
- null: "NullField"
1178
- };
1179
- function di(t, e, n, r) {
1180
- const a = e.field, { fields: s, translateString: o } = r;
1181
- if (typeof a == "function")
1182
- return a;
1183
- if (typeof a == "string" && a in s)
1184
- return s[a];
1185
- const l = We(t), d = Array.isArray(l) ? l[0] : l || "", m = t.$id;
1186
- let h = ci[d];
1187
- return m && m in s && (h = m), !h && (t.anyOf || t.oneOf) ? () => null : h in s ? s[h] : () => {
1188
- const g = B("UnsupportedFieldTemplate", r, e);
1189
- return p(g, { schema: t, idSchema: n, reason: o($.UnknownFieldType, [String(t.type)]), registry: r });
1190
- };
1191
- }
1192
- function ui(t) {
1193
- const { schema: e, idSchema: n, uiSchema: r, formData: a, errorSchema: s, idPrefix: o, idSeparator: l, name: d, onChange: m, onKeyChange: h, onDropPropertyClick: g, required: y, registry: i, wasPropertyKeyModified: u = !1 } = t, { formContext: c, schemaUtils: f, globalUiOptions: S } = i, b = R(r, S), v = B("FieldTemplate", i, b), C = B("DescriptionFieldTemplate", i, b), F = B("FieldHelpTemplate", i, b), w = B("FieldErrorTemplate", i, b), O = f.retrieveSchema(e, a), k = n[Ze], D = dn(f.toIdSchema(O, k, a, o, l), n), T = W((ee, Lt, Ht) => m(ee, Lt, Ht || k), [k, m]), P = di(O, b, D, i), A = !!(t.disabled || b.disabled), _ = !!(t.readonly || b.readonly || t.schema.readOnly || O.readOnly), j = b.hideError, E = j === void 0 ? t.hideError : !!j, L = !!(t.autofocus || b.autofocus);
1194
- if (Object.keys(O).length === 0)
1195
- return null;
1196
- const N = f.getDisplayLabel(O, r, S), x = s || {}, { __errors: M } = x, ie = H(x, ["__errors"]), Y = je(r, ["ui:classNames", "classNames", "ui:style"]);
1197
- Ce in Y && (Y[Ce] = je(Y[Ce], ["classNames", "style"]));
1198
- const be = p(P, Object.assign({}, t, { onChange: T, idSchema: D, schema: O, uiSchema: Y, disabled: A, readonly: _, hideError: E, autofocus: L, errorSchema: ie, formContext: c, rawErrors: M })), le = D[Ze];
1199
- let Se;
1200
- u ? Se = d : Se = Pe in O ? d : b.title || t.schema.title || O.title || d;
1201
- const Oe = b.description || t.schema.description || O.description || "", _t = b.enableMarkdownInDescription ? p(ye, { children: Oe }) : Oe, Fe = b.help, $t = b.widget === "hidden", ce = ["form-group", "field", `field-${We(O)}`];
1202
- !E && M && M.length > 0 && ce.push("field-error has-error has-danger"), r?.classNames && (process.env.NODE_ENV !== "production" && console.warn("'uiSchema.classNames' is deprecated and may be removed in a major release; Use 'ui:classNames' instead."), ce.push(r.classNames)), b.classNames && ce.push(b.classNames);
1203
- const Ut = p(F, { help: Fe, idSchema: D, schema: O, uiSchema: r, hasErrors: !E && M && M.length > 0, registry: i }), Wt = E || (O.anyOf || O.oneOf) && !f.isSelect(O) ? void 0 : p(w, { errors: M, errorSchema: s, idSchema: D, schema: O, uiSchema: r, registry: i }), Pt = {
1204
- description: p(C, { id: ge(le), description: _t, schema: O, uiSchema: r, registry: i }),
1205
- rawDescription: Oe,
1206
- help: Ut,
1207
- rawHelp: typeof Fe == "string" ? Fe : void 0,
1208
- errors: Wt,
1209
- rawErrors: E ? void 0 : M,
1210
- id: le,
1211
- label: Se,
1212
- hidden: $t,
1213
- onChange: m,
1214
- onKeyChange: h,
1215
- onDropPropertyClick: g,
1216
- required: y,
1217
- disabled: A,
1218
- readonly: _,
1219
- hideError: E,
1220
- displayLabel: N,
1221
- classNames: ce.join(" ").trim(),
1222
- style: b.style,
1223
- formContext: c,
1224
- formData: a,
1225
- schema: O,
1226
- uiSchema: r,
1227
- registry: i
1228
- }, Mt = i.fields.AnyOfField, Rt = i.fields.OneOfField, qe = r?.["ui:field"] && r?.["ui:fieldReplacesAnyOrOneOf"] === !0;
1229
- return p(v, Object.assign({}, Pt, { children: U($e, { children: [be, O.anyOf && !qe && !f.isSelect(O) && p(Mt, { name: d, disabled: A, readonly: _, hideError: E, errorSchema: s, formData: a, formContext: c, idPrefix: o, idSchema: D, idSeparator: l, onBlur: t.onBlur, onChange: t.onChange, onFocus: t.onFocus, options: O.anyOf.map((ee) => f.retrieveSchema(Q(ee) ? ee : {}, a)), registry: i, schema: O, uiSchema: r }), O.oneOf && !qe && !f.isSelect(O) && p(Rt, { name: d, disabled: A, readonly: _, hideError: E, errorSchema: s, formData: a, formContext: c, idPrefix: o, idSchema: D, idSeparator: l, onBlur: t.onBlur, onChange: t.onChange, onFocus: t.onFocus, options: O.oneOf.map((ee) => f.retrieveSchema(Q(ee) ? ee : {}, a)), registry: i, schema: O, uiSchema: r })] }) }));
1230
- }
1231
- class mi extends fe {
1232
- shouldComponentUpdate(e) {
1233
- return !Ae(this.props, e);
1234
- }
1235
- render() {
1236
- return p(ui, Object.assign({}, this.props));
1237
- }
1238
- }
1239
- function pi(t) {
1240
- var e;
1241
- const { schema: n, name: r, uiSchema: a, idSchema: s, formData: o, required: l, disabled: d = !1, readonly: m = !1, autofocus: h = !1, onChange: g, onBlur: y, onFocus: i, registry: u, rawErrors: c, hideError: f } = t, { title: S, format: b } = n, { widgets: v, formContext: C, schemaUtils: F, globalUiOptions: w } = u, O = F.isSelect(n) ? he(n) : void 0;
1242
- let k = O ? "select" : "text";
1243
- b && xn(n, b, v) && (k = b);
1244
- const D = R(a), { widget: T = k, placeholder: P = "", title: A } = D, _ = H(D, ["widget", "placeholder", "title"]), j = F.getDisplayLabel(n, a, w), E = (e = A ?? S) !== null && e !== void 0 ? e : r, L = G(n, T, v);
1245
- return p(L, { options: Object.assign(Object.assign({}, _), { enumOptions: O }), schema: n, uiSchema: a, id: s.$id, name: r, label: E, hideLabel: !j, hideError: f, value: o, onChange: g, onBlur: y, onFocus: i, required: l, disabled: d, readonly: m, formContext: C, autofocus: h, registry: u, placeholder: P, rawErrors: c });
1246
- }
1247
- function hi(t) {
1248
- const { formData: e, onChange: n } = t;
1249
- return ut(() => {
1250
- e === void 0 && n(null);
1251
- }, [e, n]), null;
1252
- }
1253
- function fi() {
1254
- return {
1255
- AnyOfField: nt,
1256
- ArrayField: Xn,
1257
- // ArrayField falls back to SchemaField if ArraySchemaField is not defined, which it isn't by default
1258
- BooleanField: Zn,
1259
- NumberField: er,
1260
- ObjectField: li,
1261
- OneOfField: nt,
1262
- SchemaField: mi,
1263
- StringField: pi,
1264
- NullField: hi
1265
- };
1266
- }
1267
- function gi(t) {
1268
- const { idSchema: e, description: n, registry: r, schema: a, uiSchema: s } = t, o = R(s, r.globalUiOptions), { label: l = !0 } = o;
1269
- if (!n || !l)
1270
- return null;
1271
- const d = B("DescriptionFieldTemplate", r, o);
1272
- return p(d, { id: ge(e), description: n, schema: a, uiSchema: s, registry: r });
1273
- }
1274
- function yi(t) {
1275
- const { children: e, className: n, disabled: r, hasToolbar: a, hasMoveDown: s, hasMoveUp: o, hasRemove: l, hasCopy: d, index: m, onCopyIndexClick: h, onDropIndexClick: g, onReorderClick: y, readonly: i, registry: u, uiSchema: c } = t, { CopyButton: f, MoveDownButton: S, MoveUpButton: b, RemoveButton: v } = u.templates.ButtonTemplates, C = {
1276
- flex: 1,
1277
- paddingLeft: 6,
1278
- paddingRight: 6,
1279
- fontWeight: "bold"
1280
- };
1281
- return U("div", Object.assign({ className: n }, { children: [p("div", Object.assign({ className: a ? "col-xs-9" : "col-xs-12" }, { children: e })), a && p("div", Object.assign({ className: "col-xs-3 array-item-toolbox" }, { children: U("div", Object.assign({ className: "btn-group", style: {
1282
- display: "flex",
1283
- justifyContent: "space-around"
1284
- } }, { children: [(o || s) && p(b, { style: C, disabled: r || i || !o, onClick: y(m, m - 1), uiSchema: c, registry: u }), (o || s) && p(S, { style: C, disabled: r || i || !s, onClick: y(m, m + 1), uiSchema: c, registry: u }), d && p(f, { style: C, disabled: r || i, onClick: h(m), uiSchema: c, registry: u }), l && p(v, { style: C, disabled: r || i, onClick: g(m), uiSchema: c, registry: u })] })) }))] }));
1285
- }
1286
- function bi(t) {
1287
- const { canAdd: e, className: n, disabled: r, idSchema: a, uiSchema: s, items: o, onAddClick: l, readonly: d, registry: m, required: h, schema: g, title: y } = t, i = R(s), u = B("ArrayFieldDescriptionTemplate", m, i), c = B("ArrayFieldItemTemplate", m, i), f = B("ArrayFieldTitleTemplate", m, i), { ButtonTemplates: { AddButton: S } } = m.templates;
1288
- return U("fieldset", Object.assign({ className: n, id: a.$id }, { children: [p(f, { idSchema: a, title: i.title || y, required: h, schema: g, uiSchema: s, registry: m }), p(u, { idSchema: a, description: i.description || g.description, schema: g, uiSchema: s, registry: m }), p("div", Object.assign({ className: "row array-item-list" }, { children: o && o.map((b) => {
1289
- var { key: v } = b, C = H(b, ["key"]);
1290
- return p(c, Object.assign({}, C), v);
1291
- }) })), e && p(S, { className: "array-item-add", onClick: l, disabled: r || d, uiSchema: s, registry: m })] }));
1292
- }
1293
- function Si(t) {
1294
- const { idSchema: e, title: n, schema: r, uiSchema: a, required: s, registry: o } = t, l = R(a, o.globalUiOptions), { label: d = !0 } = l;
1295
- if (!n || !d)
1296
- return null;
1297
- const m = B("TitleFieldTemplate", o, l);
1298
- return p(m, { id: mt(e), title: n, required: s, schema: r, uiSchema: a, registry: o });
1299
- }
1300
- function Oi(t) {
1301
- const {
1302
- id: e,
1303
- name: n,
1304
- // remove this from ...rest
1305
- value: r,
1306
- readonly: a,
1307
- disabled: s,
1308
- autofocus: o,
1309
- onBlur: l,
1310
- onFocus: d,
1311
- onChange: m,
1312
- onChangeOverride: h,
1313
- options: g,
1314
- schema: y,
1315
- uiSchema: i,
1316
- formContext: u,
1317
- registry: c,
1318
- rawErrors: f,
1319
- type: S,
1320
- hideLabel: b,
1321
- // remove this from ...rest
1322
- hideError: v
1323
- } = t, C = H(t, ["id", "name", "value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "onChange", "onChangeOverride", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors", "type", "hideLabel", "hideError"]);
1324
- if (!e)
1325
- throw console.log("No id for", t), new Error(`no id for props ${JSON.stringify(t)}`);
1326
- const F = Object.assign(Object.assign({}, C), Nn(y, S, g));
1327
- let w;
1328
- F.type === "number" || F.type === "integer" ? w = r || r === 0 ? r : "" : w = r ?? "";
1329
- const O = W(({ target: { value: T } }) => m(T === "" ? g.emptyValue : T), [m, g]), k = W(({ target: { value: T } }) => l(e, T), [l, e]), D = W(({ target: { value: T } }) => d(e, T), [d, e]);
1330
- return U($e, { children: [p("input", Object.assign({ id: e, name: e, className: "form-control", readOnly: a, disabled: s, autoFocus: o, value: w }, F, { list: y.examples ? Je(e) : void 0, onChange: h || O, onBlur: k, onFocus: D, "aria-describedby": ne(e, !!y.examples) })), Array.isArray(y.examples) && p("datalist", Object.assign({ id: Je(e) }, { children: y.examples.concat(y.default && !y.examples.includes(y.default) ? [y.default] : []).map((T) => p("option", { value: T }, T)) }), `datalist_${e}`)] });
1331
- }
1332
- function Fi({ uiSchema: t }) {
1333
- const { submitText: e, norender: n, props: r = {} } = hn(t);
1334
- return n ? null : p("div", { children: p("button", Object.assign({ type: "submit" }, r, { className: `btn btn-info ${r.className || ""}` }, { children: e })) });
1335
- }
1336
- function oe(t) {
1337
- const { iconType: e = "default", icon: n, className: r, uiSchema: a, registry: s } = t, o = H(t, ["iconType", "icon", "className", "uiSchema", "registry"]);
1338
- return p("button", Object.assign({ type: "button", className: `btn btn-${e} ${r}` }, o, { children: p("i", { className: `glyphicon glyphicon-${n}` }) }));
1339
- }
1340
- function vi(t) {
1341
- const { registry: { translateString: e } } = t;
1342
- return p(oe, Object.assign({ title: e($.CopyButton), className: "array-item-copy" }, t, { icon: "copy" }));
1343
- }
1344
- function Ci(t) {
1345
- const { registry: { translateString: e } } = t;
1346
- return p(oe, Object.assign({ title: e($.MoveDownButton), className: "array-item-move-down" }, t, { icon: "arrow-down" }));
1347
- }
1348
- function ki(t) {
1349
- const { registry: { translateString: e } } = t;
1350
- return p(oe, Object.assign({ title: e($.MoveUpButton), className: "array-item-move-up" }, t, { icon: "arrow-up" }));
1351
- }
1352
- function wi(t) {
1353
- const { registry: { translateString: e } } = t;
1354
- return p(oe, Object.assign({ title: e($.RemoveButton), className: "array-item-remove" }, t, { iconType: "danger", icon: "remove" }));
1355
- }
1356
- function Di({ className: t, onClick: e, disabled: n, registry: r }) {
1357
- const { translateString: a } = r;
1358
- return p("div", Object.assign({ className: "row" }, { children: p("p", Object.assign({ className: `col-xs-3 col-xs-offset-9 text-right ${t}` }, { children: p(oe, { iconType: "info", icon: "plus", className: "btn-add col-xs-12", title: a($.AddButton), onClick: e, disabled: n, registry: r }) })) }));
1359
- }
1360
- function Ti() {
1361
- return {
1362
- SubmitButton: Fi,
1363
- AddButton: Di,
1364
- CopyButton: vi,
1365
- MoveDownButton: Ci,
1366
- MoveUpButton: ki,
1367
- RemoveButton: wi
1368
- };
1369
- }
1370
- function Ni(t) {
1371
- const { id: e, description: n } = t;
1372
- return n ? typeof n == "string" ? p("p", Object.assign({ id: e, className: "field-description" }, { children: n })) : p("div", Object.assign({ id: e, className: "field-description" }, { children: n })) : null;
1373
- }
1374
- function Ii({ errors: t, registry: e }) {
1375
- const { translateString: n } = e;
1376
- return U("div", Object.assign({ className: "panel panel-danger errors" }, { children: [p("div", Object.assign({ className: "panel-heading" }, { children: p("h3", Object.assign({ className: "panel-title" }, { children: n($.ErrorsLabel) })) })), p("ul", Object.assign({ className: "list-group" }, { children: t.map((r, a) => p("li", Object.assign({ className: "list-group-item text-danger" }, { children: r.stack }), a)) }))] }));
1377
- }
1378
- const xi = "*";
1379
- function Et(t) {
1380
- const { label: e, required: n, id: r } = t;
1381
- return e ? U("label", Object.assign({ className: "control-label", htmlFor: r }, { children: [e, n && p("span", Object.assign({ className: "required" }, { children: xi }))] })) : null;
1382
- }
1383
- function ji(t) {
1384
- const { id: e, label: n, children: r, errors: a, help: s, description: o, hidden: l, required: d, displayLabel: m, registry: h, uiSchema: g } = t, y = R(g), i = B("WrapIfAdditionalTemplate", h, y);
1385
- return l ? p("div", Object.assign({ className: "hidden" }, { children: r })) : U(i, Object.assign({}, t, { children: [m && p(Et, { label: n, required: d, id: e }), m && o ? o : null, r, a, s] }));
1386
- }
1387
- function Ai(t) {
1388
- const { errors: e = [], idSchema: n } = t;
1389
- if (e.length === 0)
1390
- return null;
1391
- const r = mn(n);
1392
- return p("div", { children: p("ul", Object.assign({ id: r, className: "error-detail bs-callout bs-callout-info" }, { children: e.filter((a) => !!a).map((a, s) => p("li", Object.assign({ className: "text-danger" }, { children: a }), s)) })) });
1393
- }
1394
- function Ei(t) {
1395
- const { idSchema: e, help: n } = t;
1396
- if (!n)
1397
- return null;
1398
- const r = pn(e);
1399
- return typeof n == "string" ? p("p", Object.assign({ id: r, className: "help-block" }, { children: n })) : p("div", Object.assign({ id: r, className: "help-block" }, { children: n }));
1400
- }
1401
- function Bi(t) {
1402
- const { description: e, disabled: n, formData: r, idSchema: a, onAddClick: s, properties: o, readonly: l, registry: d, required: m, schema: h, title: g, uiSchema: y } = t, i = R(y), u = B("TitleFieldTemplate", d, i), c = B("DescriptionFieldTemplate", d, i), { ButtonTemplates: { AddButton: f } } = d.templates;
1403
- return U("fieldset", Object.assign({ id: a.$id }, { children: [g && p(u, { id: mt(a), title: g, required: m, schema: h, uiSchema: y, registry: d }), e && p(c, { id: ge(a), description: e, schema: h, uiSchema: y, registry: d }), o.map((S) => S.content), fn(h, y, r) && p(f, { className: "object-property-expand", onClick: s(h), disabled: n || l, uiSchema: y, registry: d })] }));
1404
- }
1405
- const _i = "*";
1406
- function $i(t) {
1407
- const { id: e, title: n, required: r } = t;
1408
- return U("legend", Object.assign({ id: e }, { children: [n, r && p("span", Object.assign({ className: "required" }, { children: _i }))] }));
1409
- }
1410
- function Ui(t) {
1411
- const { schema: e, idSchema: n, reason: r, registry: a } = t, { translateString: s } = a;
1412
- let o = $.UnsupportedField;
1413
- const l = [];
1414
- return n && n.$id && (o = $.UnsupportedFieldWithId, l.push(n.$id)), r && (o = o === $.UnsupportedField ? $.UnsupportedFieldWithReason : $.UnsupportedFieldWithIdAndReason, l.push(r)), U("div", Object.assign({ className: "unsupported-field" }, { children: [p("p", { children: p(ye, { children: s(o, l) }) }), e && p("pre", { children: JSON.stringify(e, null, 2) })] }));
1415
- }
1416
- function Wi(t) {
1417
- const { id: e, classNames: n, style: r, disabled: a, label: s, onKeyChange: o, onDropPropertyClick: l, readonly: d, required: m, schema: h, children: g, uiSchema: y, registry: i } = t, { templates: u, translateString: c } = i, { RemoveButton: f } = u.ButtonTemplates, S = c($.KeyLabel, [s]);
1418
- return Pe in h ? p("div", Object.assign({ className: n, style: r }, { children: U("div", Object.assign({ className: "row" }, { children: [p("div", Object.assign({ className: "col-xs-5 form-additional" }, { children: U("div", Object.assign({ className: "form-group" }, { children: [p(Et, { label: S, required: m, id: `${e}-key` }), p("input", { className: "form-control", type: "text", id: `${e}-key`, onBlur: (v) => o(v.target.value), defaultValue: s })] })) })), p("div", Object.assign({ className: "form-additional form-group col-xs-5" }, { children: g })), p("div", Object.assign({ className: "col-xs-2" }, { children: p(f, { className: "array-item-remove btn-block", style: { border: "0" }, disabled: a || d, onClick: l(s), uiSchema: y, registry: i }) }))] })) })) : p("div", Object.assign({ className: n, style: r }, { children: g }));
1419
- }
1420
- function Pi() {
1421
- return {
1422
- ArrayFieldDescriptionTemplate: gi,
1423
- ArrayFieldItemTemplate: yi,
1424
- ArrayFieldTemplate: bi,
1425
- ArrayFieldTitleTemplate: Si,
1426
- ButtonTemplates: Ti(),
1427
- BaseInputTemplate: Oi,
1428
- DescriptionFieldTemplate: Ni,
1429
- ErrorListTemplate: Ii,
1430
- FieldTemplate: ji,
1431
- FieldErrorTemplate: Ai,
1432
- FieldHelpTemplate: Ei,
1433
- ObjectFieldTemplate: Bi,
1434
- TitleFieldTemplate: $i,
1435
- UnsupportedFieldTemplate: Ui,
1436
- WrapIfAdditionalTemplate: Wi
1437
- };
1438
- }
1439
- function Mi(t, e) {
1440
- const n = [];
1441
- for (let r = t; r <= e; r++)
1442
- n.push({ value: r, label: Z(r, 2) });
1443
- return n;
1444
- }
1445
- function Ri(t) {
1446
- return Object.values(t).every((e) => e !== -1);
1447
- }
1448
- function Li(t, e, n = [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2]) {
1449
- const { year: r, month: a, day: s, hour: o, minute: l, second: d } = t, m = [
1450
- {
1451
- type: "year",
1452
- range: n,
1453
- value: r
1454
- },
1455
- { type: "month", range: [1, 12], value: a },
1456
- { type: "day", range: [1, 31], value: s }
1457
- ];
1458
- return e && m.push({ type: "hour", range: [0, 23], value: o }, { type: "minute", range: [0, 59], value: l }, { type: "second", range: [0, 59], value: d }), m;
1459
- }
1460
- function Hi({ type: t, range: e, value: n, select: r, rootId: a, name: s, disabled: o, readonly: l, autofocus: d, registry: m, onBlur: h, onFocus: g }) {
1461
- const y = a + "_" + t, { SelectWidget: i } = m.widgets;
1462
- return p(i, { schema: { type: "integer" }, id: y, name: s, className: "form-control", options: { enumOptions: Mi(e[0], e[1]) }, placeholder: t, value: n, disabled: o, readonly: l, autofocus: d, onChange: (u) => r(t, u), onBlur: h, onFocus: g, registry: m, label: "", "aria-describedby": ne(a) });
1463
- }
1464
- function qi({ time: t = !1, disabled: e = !1, readonly: n = !1, autofocus: r = !1, options: a, id: s, name: o, registry: l, onBlur: d, onFocus: m, onChange: h, value: g }) {
1465
- const { translateString: y } = l, [i, u] = Ue(g), [c, f] = Kt((C, F) => Object.assign(Object.assign({}, C), F), we(g, t));
1466
- ut(() => {
1467
- const C = et(c, t);
1468
- Ri(c) && C !== g ? h(C) : i !== g && (u(g), f(we(g, t)));
1469
- }, [t, g, h, c, i]);
1470
- const S = W((C, F) => {
1471
- f({ [C]: F });
1472
- }, []), b = W((C) => {
1473
- if (C.preventDefault(), e || n)
1474
- return;
1475
- const F = we((/* @__PURE__ */ new Date()).toJSON(), t);
1476
- h(et(F, t));
1477
- }, [e, n, t]), v = W((C) => {
1478
- C.preventDefault(), !(e || n) && h(void 0);
1479
- }, [e, n, h]);
1480
- return U("ul", Object.assign({ className: "list-inline" }, { children: [Li(c, t, a.yearsRange).map((C, F) => p("li", Object.assign({ className: "list-inline-item" }, { children: p(Hi, Object.assign({ rootId: s, name: o, select: S }, C, { disabled: e, readonly: n, registry: l, onBlur: d, onFocus: m, autofocus: r && F === 0 })) }), F)), (a.hideNowButton !== "undefined" ? !a.hideNowButton : !0) && p("li", Object.assign({ className: "list-inline-item" }, { children: p("a", Object.assign({ href: "#", className: "btn btn-info btn-now", onClick: b }, { children: y($.NowLabel) })) })), (a.hideClearButton !== "undefined" ? !a.hideClearButton : !0) && p("li", Object.assign({ className: "list-inline-item" }, { children: p("a", Object.assign({ href: "#", className: "btn btn-warning btn-clear", onClick: v }, { children: y($.ClearLabel) })) }))] }));
1481
- }
1482
- function Ki(t) {
1483
- var { time: e = !0 } = t, n = H(t, ["time"]);
1484
- const { AltDateWidget: r } = n.registry.widgets;
1485
- return p(r, Object.assign({ time: e }, n));
1486
- }
1487
- function Vi({ schema: t, uiSchema: e, options: n, id: r, value: a, disabled: s, readonly: o, label: l, hideLabel: d, autofocus: m = !1, onBlur: h, onFocus: g, onChange: y, registry: i }) {
1488
- var u;
1489
- const c = B("DescriptionFieldTemplate", i, n), f = ue(t), S = W((F) => y(F.target.checked), [y]), b = W((F) => h(r, F.target.checked), [h, r]), v = W((F) => g(r, F.target.checked), [g, r]), C = (u = n.description) !== null && u !== void 0 ? u : t.description;
1490
- return U("div", Object.assign({ className: `checkbox ${s || o ? "disabled" : ""}` }, { children: [!d && !!C && p(c, { id: ge(r), description: C, schema: t, uiSchema: e, registry: i }), U("label", { children: [p("input", { type: "checkbox", id: r, name: r, checked: typeof a > "u" ? !1 : a, required: f, disabled: s || o, autoFocus: m, onChange: S, onBlur: b, onFocus: v, "aria-describedby": ne(r) }), jn(p("span", { children: l }), d)] })] }));
1491
- }
1492
- function Gi({ id: t, disabled: e, options: { inline: n = !1, enumOptions: r, enumDisabled: a, emptyValue: s }, value: o, autofocus: l = !1, readonly: d, onChange: m, onBlur: h, onFocus: g }) {
1493
- const y = Array.isArray(o) ? o : [o], i = W(({ target: { value: c } }) => h(t, K(c, r, s)), [h, t]), u = W(({ target: { value: c } }) => g(t, K(c, r, s)), [g, t]);
1494
- return p("div", Object.assign({ className: "checkboxes", id: t }, { children: Array.isArray(r) && r.map((c, f) => {
1495
- const S = Re(c.value, y), b = Array.isArray(a) && a.indexOf(c.value) !== -1, v = e || b || d ? "disabled" : "", C = (w) => {
1496
- w.target.checked ? m(Dn(f, y, r)) : m(kn(f, y, r));
1497
- }, F = U("span", { children: [p("input", { type: "checkbox", id: pt(t, f), name: t, checked: S, value: String(f), disabled: e || b || d, autoFocus: l && f === 0, onChange: C, onBlur: i, onFocus: u, "aria-describedby": ne(t) }), p("span", { children: c.label })] });
1498
- return n ? p("label", Object.assign({ className: `checkbox-inline ${v}` }, { children: F }), f) : p("div", Object.assign({ className: `checkbox ${v}` }, { children: p("label", { children: F }) }), f);
1499
- }) }));
1500
- }
1501
- function Yi(t) {
1502
- const { disabled: e, readonly: n, options: r, registry: a } = t, s = B("BaseInputTemplate", a, r);
1503
- return p(s, Object.assign({ type: "color" }, t, { disabled: e || n }));
1504
- }
1505
- function zi(t) {
1506
- const { onChange: e, options: n, registry: r } = t, a = B("BaseInputTemplate", r, n), s = W((o) => e(o || void 0), [e]);
1507
- return p(a, Object.assign({ type: "date" }, t, { onChange: s }));
1508
- }
1509
- function Xi(t) {
1510
- const { onChange: e, value: n, options: r, registry: a } = t, s = B("BaseInputTemplate", a, r);
1511
- return p(s, Object.assign({ type: "datetime-local" }, t, { value: _n(n), onChange: (o) => e(An(o)) }));
1512
- }
1513
- function Zi(t) {
1514
- const { options: e, registry: n } = t, r = B("BaseInputTemplate", n, e);
1515
- return p(r, Object.assign({ type: "email" }, t));
1516
- }
1517
- function Ji(t, e) {
1518
- return t === null ? null : t.replace(";base64", `;name=${encodeURIComponent(e)};base64`);
1519
- }
1520
- function Qi(t) {
1521
- const { name: e, size: n, type: r } = t;
1522
- return new Promise((a, s) => {
1523
- const o = new window.FileReader();
1524
- o.onerror = s, o.onload = (l) => {
1525
- var d;
1526
- typeof ((d = l.target) === null || d === void 0 ? void 0 : d.result) == "string" ? a({
1527
- dataURL: Ji(l.target.result, e),
1528
- name: e,
1529
- size: n,
1530
- type: r
1531
- }) : a({
1532
- dataURL: null,
1533
- name: e,
1534
- size: n,
1535
- type: r
1536
- });
1537
- }, o.readAsDataURL(t);
1538
- });
1539
- }
1540
- function ea(t) {
1541
- return Promise.all(Array.from(t).map(Qi));
1542
- }
1543
- function ta({ fileInfo: t, registry: e }) {
1544
- const { translateString: n } = e, { dataURL: r, type: a, name: s } = t;
1545
- return r ? a.indexOf("image") !== -1 ? p("img", { src: r, style: { maxWidth: "100%" }, className: "file-preview" }) : U($e, { children: [" ", p("a", Object.assign({ download: `preview-${s}`, href: r, className: "file-download" }, { children: n($.PreviewLabel) }))] }) : null;
1546
- }
1547
- function na({ filesInfo: t, registry: e, preview: n }) {
1548
- if (t.length === 0)
1549
- return null;
1550
- const { translateString: r } = e;
1551
- return p("ul", Object.assign({ className: "file-info" }, { children: t.map((a, s) => {
1552
- const { name: o, size: l, type: d } = a;
1553
- return U("li", { children: [p(ye, { children: r($.FilesInfo, [o, d, String(l)]) }), n && p(ta, { fileInfo: a, registry: e })] }, s);
1554
- }) }));
1555
- }
1556
- function dt(t) {
1557
- return t.filter((e) => e).map((e) => {
1558
- const { blob: n, name: r } = Cn(e);
1559
- return {
1560
- dataURL: e,
1561
- name: r,
1562
- size: n.size,
1563
- type: n.type
1564
- };
1565
- });
1566
- }
1567
- function ra(t) {
1568
- const { disabled: e, readonly: n, required: r, multiple: a, onChange: s, value: o, options: l, registry: d } = t, m = B("BaseInputTemplate", d, l), [h, g] = Ue(Array.isArray(o) ? dt(o) : dt([o])), y = W((i) => {
1569
- i.target.files && ea(i.target.files).then((u) => {
1570
- const c = u.map((f) => f.dataURL);
1571
- a ? (g(h.concat(u[0])), s(o.concat(c[0]))) : (g(u), s(c[0]));
1572
- });
1573
- }, [a, o, h, s]);
1574
- return U("div", { children: [p(m, Object.assign({}, t, { disabled: e || n, type: "file", required: o ? !1 : r, onChangeOverride: y, value: "", accept: l.accept ? String(l.accept) : void 0 })), p(na, { filesInfo: h, registry: d, preview: l.filePreview })] });
1575
- }
1576
- function ia({ id: t, value: e }) {
1577
- return p("input", { type: "hidden", id: t, name: t, value: typeof e > "u" ? "" : e });
1578
- }
1579
- function aa(t) {
1580
- const { options: e, registry: n } = t, r = B("BaseInputTemplate", n, e);
1581
- return p(r, Object.assign({ type: "password" }, t));
1582
- }
1583
- function sa({ options: t, value: e, required: n, disabled: r, readonly: a, autofocus: s = !1, onBlur: o, onFocus: l, onChange: d, id: m }) {
1584
- const { enumOptions: h, enumDisabled: g, inline: y, emptyValue: i } = t, u = W(({ target: { value: f } }) => o(m, K(f, h, i)), [o, m]), c = W(({ target: { value: f } }) => l(m, K(f, h, i)), [l, m]);
1585
- return p("div", Object.assign({ className: "field-radio-group", id: m }, { children: Array.isArray(h) && h.map((f, S) => {
1586
- const b = Re(f.value, e), v = Array.isArray(g) && g.indexOf(f.value) !== -1, C = r || v || a ? "disabled" : "", F = () => d(f.value), w = U("span", { children: [p("input", { type: "radio", id: pt(m, S), checked: b, name: m, required: n, value: String(S), disabled: r || v || a, autoFocus: s && S === 0, onChange: F, onBlur: u, onFocus: c, "aria-describedby": ne(m) }), p("span", { children: f.label })] });
1587
- return y ? p("label", Object.assign({ className: `radio-inline ${C}` }, { children: w }), S) : p("div", Object.assign({ className: `radio ${C}` }, { children: p("label", { children: w }) }), S);
1588
- }) }));
1589
- }
1590
- function oa(t) {
1591
- const { value: e, registry: { templates: { BaseInputTemplate: n } } } = t;
1592
- return U("div", Object.assign({ className: "field-range-wrapper" }, { children: [p(n, Object.assign({ type: "range" }, t)), p("span", Object.assign({ className: "range-view" }, { children: e }))] }));
1593
- }
1594
- function xe(t, e) {
1595
- return e ? Array.from(t.target.options).slice().filter((n) => n.selected).map((n) => n.value) : t.target.value;
1596
- }
1597
- function la({ schema: t, id: e, options: n, value: r, required: a, disabled: s, readonly: o, multiple: l = !1, autofocus: d = !1, onChange: m, onBlur: h, onFocus: g, placeholder: y }) {
1598
- const { enumOptions: i, enumDisabled: u, emptyValue: c } = n, f = l ? [] : "", S = W((F) => {
1599
- const w = xe(F, l);
1600
- return g(e, K(w, i, c));
1601
- }, [g, e, t, l, n]), b = W((F) => {
1602
- const w = xe(F, l);
1603
- return h(e, K(w, i, c));
1604
- }, [h, e, t, l, n]), v = W((F) => {
1605
- const w = xe(F, l);
1606
- return m(K(w, i, c));
1607
- }, [m, t, l, n]), C = wn(r, i, l);
1608
- return U("select", Object.assign({ id: e, name: e, multiple: l, className: "form-control", value: typeof C > "u" ? f : C, required: a, disabled: s || o, autoFocus: d, onBlur: b, onFocus: S, onChange: v, "aria-describedby": ne(e) }, { children: [!l && t.default === void 0 && p("option", Object.assign({ value: "" }, { children: y })), Array.isArray(i) && i.map(({ value: F, label: w }, O) => {
1609
- const k = u && u.indexOf(F) !== -1;
1610
- return p("option", Object.assign({ value: String(O), disabled: k }, { children: w }), O);
1611
- })] }));
1612
- }
1613
- function Bt({ id: t, options: e = {}, placeholder: n, value: r, required: a, disabled: s, readonly: o, autofocus: l = !1, onChange: d, onBlur: m, onFocus: h }) {
1614
- const g = W(({ target: { value: u } }) => d(u === "" ? e.emptyValue : u), [d, e.emptyValue]), y = W(({ target: { value: u } }) => m(t, u), [m, t]), i = W(({ target: { value: u } }) => h(t, u), [t, h]);
1615
- return p("textarea", { id: t, name: t, className: "form-control", value: r || "", placeholder: n, required: a, disabled: s, readOnly: o, autoFocus: l, rows: e.rows, onBlur: y, onFocus: i, onChange: g, "aria-describedby": ne(t) });
1616
- }
1617
- Bt.defaultProps = {
1618
- autofocus: !1,
1619
- options: {}
1620
- };
1621
- function ca(t) {
1622
- const { options: e, registry: n } = t, r = B("BaseInputTemplate", n, e);
1623
- return p(r, Object.assign({}, t));
1624
- }
1625
- function da(t) {
1626
- const { onChange: e, options: n, registry: r } = t, a = B("BaseInputTemplate", r, n), s = W((o) => e(o ? `${o}:00` : void 0), [e]);
1627
- return p(a, Object.assign({ type: "time" }, t, { onChange: s }));
1628
- }
1629
- function ua(t) {
1630
- const { options: e, registry: n } = t, r = B("BaseInputTemplate", n, e);
1631
- return p(r, Object.assign({ type: "url" }, t));
1632
- }
1633
- function ma(t) {
1634
- const { options: e, registry: n } = t, r = B("BaseInputTemplate", n, e);
1635
- return p(r, Object.assign({ type: "number" }, t));
1636
- }
1637
- function pa() {
1638
- return {
1639
- AltDateWidget: qi,
1640
- AltDateTimeWidget: Ki,
1641
- CheckboxWidget: Vi,
1642
- CheckboxesWidget: Gi,
1643
- ColorWidget: Yi,
1644
- DateWidget: zi,
1645
- DateTimeWidget: Xi,
1646
- EmailWidget: Zi,
1647
- FileWidget: ra,
1648
- HiddenWidget: ia,
1649
- PasswordWidget: aa,
1650
- RadioWidget: sa,
1651
- RangeWidget: oa,
1652
- SelectWidget: la,
1653
- TextWidget: ca,
1654
- TextareaWidget: Bt,
1655
- TimeWidget: da,
1656
- UpDownWidget: ma,
1657
- URLWidget: ua
1658
- };
1659
- }
1660
- function ha() {
1661
- return {
1662
- fields: fi(),
1663
- templates: Pi(),
1664
- widgets: pa(),
1665
- rootSchema: {},
1666
- formContext: {},
1667
- translateString: un
1668
- };
1669
- }
1670
- const {
1671
- templates: { BaseInputTemplate: fa }
1672
- } = ha(), Ia = ({ placeholder: t, ...e }) => /* @__PURE__ */ p(
1673
- fa,
1674
- {
1675
- placeholder: t || gn.INPUT,
1676
- ...e,
1677
- className: "form__input cn-9 fs-13 lh-20 fw-4"
1678
- }
1679
- );
1680
- export {
1681
- Ia as B,
1682
- Na as _,
1683
- Ae as d,
1684
- ha as g,
1685
- vn as i
1686
- };