react-artasys-ui 0.1.30 → 0.1.32

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 (87) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +6 -6
  3. package/{lib/src → dist}/Button/Button.d.ts +2 -2
  4. package/dist/Button/index.d.ts +3 -0
  5. package/dist/Checkbox/Checkbox.d.ts +8 -0
  6. package/dist/Checkbox/index.d.ts +2 -0
  7. package/{lib/src → dist}/Components/Arrow/Arrow.d.ts +2 -2
  8. package/dist/Components/Arrow/index.d.ts +2 -0
  9. package/{lib/src → dist}/Dropdown/Dropdown.d.ts +6 -6
  10. package/{lib/src → dist}/Dropdown/Item.d.ts +2 -2
  11. package/{lib/src → dist}/Dropdown/Items.d.ts +2 -2
  12. package/{lib/src → dist}/Dropdown/index.d.ts +3 -3
  13. package/{lib/src → dist}/File/File.d.ts +3 -3
  14. package/dist/File/index.d.ts +3 -0
  15. package/{lib/src → dist}/FileInput/FileInput.d.ts +3 -3
  16. package/dist/FileInput/index.d.ts +3 -0
  17. package/{lib/src → dist}/Form/Element/Element.d.ts +3 -3
  18. package/dist/Form/Element/index.d.ts +3 -0
  19. package/{lib/src → dist}/Form/Form.d.ts +1 -1
  20. package/dist/Form/index.d.ts +5 -0
  21. package/{lib/src → dist}/Form/types.d.ts +1 -1
  22. package/{lib/src → dist}/Form/useForm.d.ts +3 -3
  23. package/dist/Input/Input.d.ts +12 -0
  24. package/dist/Input/index.d.ts +2 -0
  25. package/{lib/src → dist}/Loading/Loading.d.ts +1 -1
  26. package/dist/Loading/index.d.ts +3 -0
  27. package/{lib/src → dist}/Progress/Progress.d.ts +1 -1
  28. package/dist/Progress/index.d.ts +2 -0
  29. package/{lib/src → dist}/Provider/Provider.d.ts +3 -3
  30. package/dist/Provider/ProviderContext.d.ts +1 -0
  31. package/dist/Provider/index.d.ts +2 -0
  32. package/{lib/src → dist}/Select/Optgroup.d.ts +2 -2
  33. package/{lib/src → dist}/Select/Option.d.ts +2 -2
  34. package/{lib/src → dist}/Select/Select.d.ts +7 -7
  35. package/{lib/src → dist}/Select/index.d.ts +4 -4
  36. package/{lib/src → dist}/Spinner/Spinner.d.ts +3 -3
  37. package/dist/Spinner/index.d.ts +3 -0
  38. package/dist/TextArea/TextArea.d.ts +9 -0
  39. package/dist/TextArea/index.d.ts +2 -0
  40. package/{lib/src → dist}/UploadImages/Image.d.ts +2 -2
  41. package/{lib/src → dist}/UploadImages/UploadImages.d.ts +2 -2
  42. package/dist/UploadImages/index.d.ts +4 -0
  43. package/dist/helpers.d.ts +3 -0
  44. package/dist/index.cjs.js +10 -0
  45. package/dist/index.d.ts +17 -0
  46. package/dist/index.es.js +1703 -0
  47. package/dist/styles.css +2 -80
  48. package/package.json +89 -78
  49. package/dist/index.js +0 -3
  50. package/dist/index.js.LICENSE.txt +0 -9
  51. package/dist/index.js.map +0 -1
  52. package/dist/styles.css.map +0 -1
  53. package/lib/src/Button/index.d.ts +0 -3
  54. package/lib/src/Checkbox/Checkbox.d.ts +0 -8
  55. package/lib/src/Checkbox/index.d.ts +0 -2
  56. package/lib/src/Components/Arrow/index.d.ts +0 -2
  57. package/lib/src/File/index.d.ts +0 -3
  58. package/lib/src/FileInput/index.d.ts +0 -3
  59. package/lib/src/Form/Element/index.d.ts +0 -3
  60. package/lib/src/Form/index.d.ts +0 -5
  61. package/lib/src/Input/Input.d.ts +0 -12
  62. package/lib/src/Input/index.d.ts +0 -2
  63. package/lib/src/Loading/index.d.ts +0 -3
  64. package/lib/src/Progress/index.d.ts +0 -2
  65. package/lib/src/Provider/ProviderContext.d.ts +0 -1
  66. package/lib/src/Provider/index.d.ts +0 -2
  67. package/lib/src/Spinner/index.d.ts +0 -3
  68. package/lib/src/TextArea/TextArea.d.ts +0 -9
  69. package/lib/src/TextArea/index.d.ts +0 -2
  70. package/lib/src/UploadImages/index.d.ts +0 -5
  71. package/lib/src/index.d.ts +0 -20
  72. package/lib/stories/Button.stories.d.ts +0 -6
  73. package/lib/stories/Checkbox.stories.d.ts +0 -6
  74. package/lib/stories/Dropdown/Dropdown.stories.d.ts +0 -6
  75. package/lib/stories/Dropdown/Item.stories.d.ts +0 -6
  76. package/lib/stories/Dropdown/Items.stories.d.ts +0 -6
  77. package/lib/stories/File.stories.d.ts +0 -6
  78. package/lib/stories/FileInput.stories.d.ts +0 -9
  79. package/lib/stories/Form/Element/Element.stories.d.ts +0 -6
  80. package/lib/stories/Form/Form.stories.d.ts +0 -6
  81. package/lib/stories/Input.stories.d.ts +0 -6
  82. package/lib/stories/Loading.stories.d.ts +0 -6
  83. package/lib/stories/Progress.stories.d.ts +0 -6
  84. package/lib/stories/Select/Select.stories.d.ts +0 -6
  85. package/lib/stories/Spinner.stories.d.ts +0 -6
  86. package/lib/stories/TextArea.stories.d.ts +0 -6
  87. /package/{lib/src → dist}/ui-types.d.ts +0 -0
@@ -0,0 +1,1703 @@
1
+ import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
2
+ import r, { cloneElement as i, createContext as a, forwardRef as o, useCallback as s, useContext as c, useEffect as l, useImperativeHandle as u, useMemo as d, useRef as f, useState as p } from "react";
3
+ var m = {
4
+ container: "style-module__container__62IoS",
5
+ "wait-indicator": "style-module__wait-indicator__gf4Cz",
6
+ wait: "style-module__wait__gRt9X"
7
+ }, h = {
8
+ spinner: "style-module__spinner__bqxDY",
9
+ "button-spinner-border": "style-module__button-spinner-border__Zu60W",
10
+ "ui-spinner-contrast": "style-module__ui-spinner-contrast__uV5ba",
11
+ small: "style-module__small__A2XhO",
12
+ middle: "style-module__middle__5esgZ",
13
+ large: "style-module__large__5MX0S"
14
+ }, g = ({ size: e, contrast: n, ...r }) => {
15
+ let i = ["ui-spinner"];
16
+ return i.push(h.spinner), e && i.push(h[e], "ui-spinner-" + e), n && i.push(h["ui-spinner-contrast"]), r.className && i.push(r.className), /* @__PURE__ */ t("div", {
17
+ ...r,
18
+ className: i.join(" ")
19
+ });
20
+ }, _ = {
21
+ container: "style-module__container__Tcehc",
22
+ radius: "style-module__radius__9sZ2F",
23
+ small: "style-module__small__GbGdW",
24
+ middle: "style-module__middle__Xb1-y",
25
+ large: "style-module__large__eTEPS"
26
+ }, v = ({ value: e = 0, size: n, radius: r = !1 }) => {
27
+ e = Math.ceil(Number(e) * 10) / 10, e > 100 && (e = 100), e < 0 && (e = 0);
28
+ let i = r ? 360 / 100 * e + "deg" : e + "%", a = ["ui-progress"];
29
+ return a.push(_.container), n && a.push(_[n]), r && a.push(_.radius), /* @__PURE__ */ t("div", {
30
+ className: a.join(" "),
31
+ "data-progress": e,
32
+ style: { "--progress": i }
33
+ });
34
+ }, y = ({ children: e, wait: r, progress: i, progressRadius: a = !0, className: o, onSubmit: s, ...c }) => {
35
+ let l = (e) => {
36
+ e.preventDefault(), typeof s == "function" && s(e);
37
+ }, u = [];
38
+ return u.push(m.container), r && u.push(m.wait), o && u.push(o), /* @__PURE__ */ n("form", {
39
+ ...c,
40
+ onSubmit: l,
41
+ className: u.join(" "),
42
+ children: [e, /* @__PURE__ */ t("div", {
43
+ className: m["wait-indicator"],
44
+ children: typeof i == "number" ? /* @__PURE__ */ t(v, {
45
+ radius: a,
46
+ value: i
47
+ }) : /* @__PURE__ */ t(g, {})
48
+ })]
49
+ });
50
+ }, b = (e) => e.type === "checkbox", x = (e) => e instanceof Date, S = (e) => e == null, C = (e) => typeof e == "object", w = (e) => !S(e) && !Array.isArray(e) && C(e) && !x(e), ee = (e) => w(e) && e.target ? b(e.target) ? e.target.checked : e.target.value : e, T = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), E = (e) => {
51
+ let t = e.constructor && e.constructor.prototype;
52
+ return w(t) && t.hasOwnProperty("isPrototypeOf");
53
+ }, D = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
54
+ function O(e) {
55
+ if (e instanceof Date) return new Date(e);
56
+ let t = typeof FileList < "u" && e instanceof FileList;
57
+ if (D && (e instanceof Blob || t)) return e;
58
+ let n = Array.isArray(e);
59
+ if (!n && !(w(e) && E(e))) return e;
60
+ let r = n ? [] : Object.create(Object.getPrototypeOf(e));
61
+ for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = O(e[t]));
62
+ return r;
63
+ }
64
+ var k = {
65
+ BLUR: "blur",
66
+ FOCUS_OUT: "focusout",
67
+ CHANGE: "change",
68
+ SUBMIT: "submit",
69
+ TRIGGER: "trigger",
70
+ VALID: "valid"
71
+ }, A = {
72
+ onBlur: "onBlur",
73
+ onChange: "onChange",
74
+ onSubmit: "onSubmit",
75
+ onTouched: "onTouched",
76
+ all: "all"
77
+ }, j = {
78
+ max: "max",
79
+ min: "min",
80
+ maxLength: "maxLength",
81
+ minLength: "minLength",
82
+ pattern: "pattern",
83
+ required: "required",
84
+ validate: "validate"
85
+ }, te = "root", ne = [
86
+ "__proto__",
87
+ "constructor",
88
+ "prototype"
89
+ ], re = /^\w*$/, ie = (e) => re.test(e), M = (e) => e === void 0, ae = /[.[\]'"]/, oe = (e) => e.split(ae).filter(Boolean), N = (e, t, n) => {
90
+ if (!t || !w(e)) return n;
91
+ let r = ie(t) ? [t] : oe(t);
92
+ if (r.some((e) => ne.includes(e))) return n;
93
+ let i = r.reduce((e, t) => S(e) ? void 0 : e[t], e);
94
+ return M(i) || i === e ? M(e[t]) ? n : e[t] : i;
95
+ }, P = (e) => typeof e == "boolean", F = (e) => typeof e == "function", I = (e, t, n) => {
96
+ let r = -1, i = ie(t) ? [t] : oe(t), a = i.length, o = a - 1;
97
+ for (; ++r < a;) {
98
+ let t = i[r], a = n;
99
+ if (r !== o) {
100
+ let n = e[t];
101
+ a = w(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
102
+ }
103
+ if (ne.includes(t)) return;
104
+ e[t] = a, e = e[t];
105
+ }
106
+ }, se = r.createContext(null);
107
+ se.displayName = "HookFormControlContext";
108
+ var ce = (e, t, n, r = !0) => {
109
+ let i = {};
110
+ for (let a in e) Object.defineProperty(i, a, { get: () => {
111
+ let i = a;
112
+ return t._proxyFormState[i] !== A.all && (t._proxyFormState[i] = !r || A.all), n && (n[i] = !0), e[i];
113
+ } });
114
+ return i;
115
+ }, le = D ? r.useLayoutEffect : r.useEffect, L = (e) => typeof e == "string", ue = (e, t, n, r, i) => L(e) ? (r && t.watch.add(e), N(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), N(n, e))) : (r && (t.watchAll = !0), n), de = (e) => S(e) || !C(e), R = (e, t) => t.length === 0 && !Array.isArray(e) && !E(e);
116
+ function z(e, t, n = /* @__PURE__ */ new WeakMap()) {
117
+ if (e === t) return !0;
118
+ if (de(e) || de(t)) return Object.is(e, t);
119
+ if (x(e) && x(t)) return Object.is(e.getTime(), t.getTime());
120
+ let r = Object.keys(e), i = Object.keys(t);
121
+ if (r.length !== i.length) return !1;
122
+ if (R(e, r) || R(t, i)) return Object.is(e, t);
123
+ if (!r.length && Array.isArray(e) !== Array.isArray(t)) return !1;
124
+ let a = n.get(e);
125
+ if (a && a.has(t)) return !0;
126
+ if (a) a.add(t);
127
+ else {
128
+ let r = /* @__PURE__ */ new WeakSet();
129
+ r.add(t), n.set(e, r);
130
+ }
131
+ for (let i of r) {
132
+ let r = e[i];
133
+ if (!(i in t)) return !1;
134
+ if (i !== "ref") {
135
+ let e = t[i];
136
+ if (x(r) && x(e) || (w(r) || Array.isArray(r)) && (w(e) || Array.isArray(e)) ? !z(r, e, n) : !Object.is(r, e)) return !1;
137
+ }
138
+ }
139
+ return !0;
140
+ }
141
+ var fe = r.createContext(null);
142
+ fe.displayName = "HookFormContext";
143
+ var pe = (e, t, n, r, i) => t ? {
144
+ ...n[e],
145
+ types: {
146
+ ...n[e] && n[e].types ? n[e].types : {},
147
+ [r]: i || !0
148
+ }
149
+ } : {}, me = (e) => Array.isArray(e) ? e.filter(Boolean) : [], he = (e) => Array.isArray(e) ? e : [e], ge = () => {
150
+ let e = [];
151
+ return {
152
+ get observers() {
153
+ return e;
154
+ },
155
+ next: (t) => {
156
+ for (let n of e) n.next && n.next(t);
157
+ },
158
+ subscribe: (t) => (e.push(t), { unsubscribe: () => {
159
+ e = e.filter((e) => e !== t);
160
+ } }),
161
+ unsubscribe: () => {
162
+ e = [];
163
+ }
164
+ };
165
+ };
166
+ function _e(e, t) {
167
+ let n = {};
168
+ for (let r in e) if (e.hasOwnProperty(r)) {
169
+ let i = e[r], a = t[r];
170
+ if (i && w(i) && a) {
171
+ let e = _e(i, a);
172
+ w(e) && (n[r] = e);
173
+ } else e[r] && (n[r] = a);
174
+ }
175
+ return n;
176
+ }
177
+ var B = (e) => w(e) && !Object.keys(e).length, ve = (e) => e.type === "file", ye = (e) => {
178
+ if (!D) return !1;
179
+ let t = e ? e.ownerDocument : 0;
180
+ return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
181
+ }, be = (e) => e.type === "select-multiple", V = (e) => e.type === "radio", xe = (e) => V(e) || b(e), Se = (e) => ye(e) && e.isConnected;
182
+ function Ce(e, t) {
183
+ let n = t.slice(0, -1).length, r = 0;
184
+ for (; r < n;) {
185
+ if (S(e)) {
186
+ e = void 0;
187
+ break;
188
+ }
189
+ e = e[t[r]], r++;
190
+ }
191
+ return e;
192
+ }
193
+ function H(e) {
194
+ for (let t in e) if (e.hasOwnProperty(t) && !M(e[t])) return !1;
195
+ return !0;
196
+ }
197
+ function U(e, t) {
198
+ if (L(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
199
+ let n = Array.isArray(t) ? t : ie(t) ? [t] : oe(t), r = n.length === 1 ? e : Ce(e, n), i = n.length - 1, a = n[i];
200
+ return r && delete r[a], i !== 0 && (w(r) && B(r) || Array.isArray(r) && H(r)) && U(e, n.slice(0, -1)), e;
201
+ }
202
+ var we = (e) => {
203
+ for (let t in e) if (F(e[t])) return !0;
204
+ return !1;
205
+ };
206
+ function Te(e) {
207
+ return Array.isArray(e) || w(e) && !we(e);
208
+ }
209
+ function Ee(e, t = {}) {
210
+ for (let n in e) {
211
+ let r = e[n];
212
+ Te(r) ? (t[n] = Array.isArray(r) ? [] : {}, Ee(r, t[n])) : M(r) || (t[n] = !0);
213
+ }
214
+ return t;
215
+ }
216
+ function De(e) {
217
+ if (e !== !1) {
218
+ if (e === !0) return !0;
219
+ if (Array.isArray(e)) {
220
+ let t = e.map((e) => De(e));
221
+ return t.some((e) => e !== void 0) ? t : void 0;
222
+ }
223
+ if (w(e)) {
224
+ let t = {};
225
+ for (let n in e) {
226
+ let r = De(e[n]);
227
+ M(r) || (t[n] = r);
228
+ }
229
+ return Object.keys(t).length ? t : void 0;
230
+ }
231
+ }
232
+ }
233
+ function W(e, t, n) {
234
+ n ||= Ee(t);
235
+ for (let r in e) {
236
+ let i = e[r];
237
+ if (Te(i)) M(t) || de(n[r]) ? n[r] = Ee(i, Array.isArray(i) ? [] : {}) : W(i, S(t) ? {} : t[r], n[r]);
238
+ else {
239
+ let e = t[r];
240
+ n[r] = !z(i, e);
241
+ }
242
+ }
243
+ return De(n) || {};
244
+ }
245
+ var Oe = {
246
+ value: !1,
247
+ isValid: !1
248
+ }, G = {
249
+ value: !0,
250
+ isValid: !0
251
+ }, ke = (e) => {
252
+ if (Array.isArray(e)) {
253
+ if (e.length > 1) {
254
+ let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
255
+ return {
256
+ value: t,
257
+ isValid: !!t.length
258
+ };
259
+ }
260
+ return e[0].checked && !e[0].disabled ? e[0].attributes && !M(e[0].attributes.value) ? M(e[0].value) || e[0].value === "" ? G : {
261
+ value: e[0].value,
262
+ isValid: !0
263
+ } : G : Oe;
264
+ }
265
+ return Oe;
266
+ }, Ae = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => M(e) ? e : t ? e === "" ? NaN : e && +e : n && L(e) ? new Date(e) : r ? r(e) : e, je = {
267
+ isValid: !1,
268
+ value: null
269
+ }, Me = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
270
+ isValid: !0,
271
+ value: t.value
272
+ } : e, je) : je;
273
+ function Ne(e) {
274
+ let t = e.ref;
275
+ return ve(t) ? t.files : V(t) ? Me(e.refs).value : be(t) ? [...t.selectedOptions].map(({ value: e }) => e) : b(t) ? ke(e.refs).value : Ae(M(t.value) ? e.ref.value : t.value, e);
276
+ }
277
+ var Pe = (e, t, n, r) => {
278
+ let i = {};
279
+ for (let n of e) {
280
+ let e = N(t, n);
281
+ e && I(i, n, e._f);
282
+ }
283
+ return {
284
+ criteriaMode: n,
285
+ names: [...e],
286
+ fields: i,
287
+ shouldUseNativeValidation: r
288
+ };
289
+ }, K = (e) => e instanceof RegExp, Fe = (e) => M(e) ? e : K(e) ? e.source : w(e) ? K(e.value) ? e.value.source : e.value : e, Ie = (e) => ({
290
+ isOnSubmit: !e || e === A.onSubmit,
291
+ isOnBlur: e === A.onBlur,
292
+ isOnChange: e === A.onChange,
293
+ isOnAll: e === A.all,
294
+ isOnTouch: e === A.onTouched
295
+ }), Le = "AsyncFunction", Re = (e) => {
296
+ if (!e || !e.validate) return !1;
297
+ if (F(e.validate)) return e.validate.constructor.name === Le;
298
+ if (w(e.validate)) {
299
+ for (let t in e.validate) if (e.validate[t].constructor.name === Le) return !0;
300
+ }
301
+ return !1;
302
+ }, ze = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Be = (e, t, n) => {
303
+ if (n) return !1;
304
+ if (t.watchAll || t.watch.has(e)) return !0;
305
+ for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
306
+ return !1;
307
+ }, Ve = (e, t, n, r) => {
308
+ for (let i of n || Object.keys(e)) {
309
+ let n = N(e, i);
310
+ if (n) {
311
+ let { _f: e, ...a } = n;
312
+ if (e) {
313
+ if (e.refs && e.refs[0] && t(e.refs[0], i) && !r || e.ref && t(e.ref, e.name) && !r) return !0;
314
+ if (Ve(a, t)) break;
315
+ } else if (w(a) && Ve(a, t)) break;
316
+ }
317
+ }
318
+ };
319
+ function He(e, t, n) {
320
+ let r = N(e, n);
321
+ if (r || ie(n)) return {
322
+ error: r,
323
+ name: n
324
+ };
325
+ let i = n.split(".");
326
+ for (; i.length;) {
327
+ let r = i.join("."), a = N(t, r), o = N(e, r);
328
+ if (a && !Array.isArray(a) && n !== r) return { name: n };
329
+ if (o && o.type) return {
330
+ name: r,
331
+ error: o
332
+ };
333
+ if (o && o.root && o.root.type) return {
334
+ name: `${r}.root`,
335
+ error: o.root
336
+ };
337
+ i.pop();
338
+ }
339
+ return { name: n };
340
+ }
341
+ var Ue = (e, t, n, r) => {
342
+ n(e);
343
+ let { name: i, ...a } = e, o = Object.keys(a);
344
+ return !o.length || r && o.length >= Object.keys(t).length || o.find((e) => t[e] === (!r || A.all));
345
+ }, We = (e, t, n) => !e || !t || e === t || he(e).some((e) => e && (n ? e === t : e.startsWith(t) || t.startsWith(e))), Ge = (e, t, n, r, i) => i.isOnAll ? !1 : !n && i.isOnTouch ? !(t || e) : (n ? r.isOnBlur : i.isOnBlur) ? !e : (n ? r.isOnChange : i.isOnChange) ? e : !0, Ke = (e, t) => !me(N(e, t)).length && U(e, t), qe = (e, t, n) => {
346
+ let r = N(e, n), i = Array.isArray(r) ? r : [];
347
+ return I(i, te, t[n]), I(e, n, i), e;
348
+ };
349
+ function Je(e, t, n = "validate") {
350
+ if (L(e) || Array.isArray(e) && e.every(L) || P(e) && !e) return {
351
+ type: n,
352
+ message: L(e) ? e : "",
353
+ ref: t
354
+ };
355
+ }
356
+ var q = (e) => w(e) && !K(e) ? e : {
357
+ value: e,
358
+ message: ""
359
+ }, Ye = async (e, t, n, r, i, a) => {
360
+ let { ref: o, refs: s, required: c, maxLength: l, minLength: u, min: d, max: f, pattern: p, validate: m, name: h, valueAsNumber: g, mount: _ } = e._f, v = N(n, h);
361
+ if (!_ || t.has(h)) return {};
362
+ let y = s ? s[0] : o, x = (e) => {
363
+ if (i && y.reportValidity) {
364
+ let t = P(e) ? "" : e || "";
365
+ s ? s.forEach((e) => e.setCustomValidity(t)) : y.setCustomValidity(t), y.reportValidity();
366
+ }
367
+ }, C = {}, ee = V(o), T = b(o), E = ee || T, D = (g || ve(o)) && M(o.value) && M(v) || ye(o) && o.value === "" || v === "" || Array.isArray(v) && !v.length, O = pe.bind(null, h, r, C), k = (e, t, n, r = j.maxLength, i = j.minLength) => {
368
+ let a = e ? t : n;
369
+ C[h] = {
370
+ type: e ? r : i,
371
+ message: a,
372
+ ref: o,
373
+ ...O(e ? r : i, a)
374
+ };
375
+ };
376
+ if (a ? !Array.isArray(v) || !v.length : c && (!E && (D || S(v)) || P(v) && !v || T && !ke(s).isValid || ee && !Me(s).isValid)) {
377
+ let { value: e, message: t } = L(c) ? {
378
+ value: !!c,
379
+ message: c
380
+ } : q(c);
381
+ if (e && (C[h] = {
382
+ type: j.required,
383
+ message: t,
384
+ ref: y,
385
+ ...O(j.required, t)
386
+ }, !r)) return x(t), C;
387
+ }
388
+ if (!D && (!S(d) || !S(f))) {
389
+ let e, t, n = q(f), i = q(d);
390
+ if (!S(v) && !isNaN(v)) {
391
+ let r = o.valueAsNumber || v && +v;
392
+ S(n.value) || (e = r > n.value), S(i.value) || (t = r < i.value);
393
+ } else {
394
+ let r = o.valueAsDate || new Date(v), a = (e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + e), s = o.type == "time", c = o.type == "week";
395
+ L(n.value) && v && (e = s ? a(v) > a(n.value) : c ? v > n.value : r > new Date(n.value)), L(i.value) && v && (t = s ? a(v) < a(i.value) : c ? v < i.value : r < new Date(i.value));
396
+ }
397
+ if ((e || t) && (k(!!e, n.message, i.message, j.max, j.min), !r)) return x(C[h].message), C;
398
+ }
399
+ if ((l || u) && !D && (L(v) || a && Array.isArray(v))) {
400
+ let e = q(l), t = q(u), n = !S(e.value) && v.length > +e.value, i = !S(t.value) && v.length < +t.value;
401
+ if ((n || i) && (k(n, e.message, t.message), !r)) return x(C[h].message), C;
402
+ }
403
+ if (p && !D && L(v)) {
404
+ let { value: e, message: t } = q(p);
405
+ if (K(e) && !v.match(e) && (C[h] = {
406
+ type: j.pattern,
407
+ message: t,
408
+ ref: o,
409
+ ...O(j.pattern, t)
410
+ }, !r)) return x(t), C;
411
+ }
412
+ if (m) {
413
+ if (F(m)) {
414
+ let e = Je(await m(v, n), y);
415
+ if (e && (C[h] = {
416
+ ...e,
417
+ ...O(j.validate, e.message)
418
+ }, !r)) return x(e.message), C;
419
+ } else if (w(m)) {
420
+ let e = {};
421
+ for (let t in m) {
422
+ if (!B(e) && !r) break;
423
+ let i = Je(await m[t](v, n), y, t);
424
+ i && (e = {
425
+ ...i,
426
+ ...O(t, i.message)
427
+ }, x(i.message), r && (C[h] = e));
428
+ }
429
+ if (!B(e) && (C[h] = {
430
+ ref: y,
431
+ ...e
432
+ }, !r)) return C;
433
+ }
434
+ }
435
+ return x(!0), C;
436
+ }, Xe = {
437
+ mode: A.onSubmit,
438
+ reValidateMode: A.onChange,
439
+ shouldFocusError: !0
440
+ }, Ze = "form", Qe = {
441
+ submitCount: 0,
442
+ isDirty: !1,
443
+ isReady: !1,
444
+ isValidating: !1,
445
+ isSubmitted: !1,
446
+ isSubmitting: !1,
447
+ isSubmitSuccessful: !1,
448
+ isValid: !1,
449
+ touchedFields: {},
450
+ dirtyFields: {},
451
+ validatingFields: {}
452
+ };
453
+ function $e(e = {}) {
454
+ let t = {
455
+ ...Xe,
456
+ ...e
457
+ }, n = {
458
+ ...O(Qe),
459
+ isLoading: F(t.defaultValues),
460
+ errors: t.errors || {},
461
+ disabled: t.disabled || !1
462
+ }, r = {}, i = (w(t.defaultValues) || w(t.values)) && O(t.defaultValues || t.values) || {}, a = t.shouldUnregister ? {} : O(i), o = {
463
+ action: !1,
464
+ mount: !1,
465
+ watch: !1,
466
+ keepIsValid: !1
467
+ }, s = {
468
+ mount: /* @__PURE__ */ new Set(),
469
+ disabled: /* @__PURE__ */ new Set(),
470
+ unMount: /* @__PURE__ */ new Set(),
471
+ array: /* @__PURE__ */ new Set(),
472
+ watch: /* @__PURE__ */ new Set(),
473
+ registerName: /* @__PURE__ */ new Set()
474
+ }, c, l = 0, u = 0, d = Ie(t.mode), f = Ie(t.reValidateMode), p = {
475
+ isDirty: !1,
476
+ dirtyFields: !1,
477
+ validatingFields: !1,
478
+ touchedFields: !1,
479
+ isValidating: !1,
480
+ isValid: !1,
481
+ errors: !1
482
+ }, m = { ...p }, h = { ...m }, g = {
483
+ array: ge(),
484
+ state: ge()
485
+ }, _ = t.criteriaMode === A.all, v = (e) => (t) => {
486
+ clearTimeout(l), l = setTimeout(e, t);
487
+ }, y = async (e) => {
488
+ if (!o.keepIsValid && !t.disabled && (m.isValid || h.isValid || e)) {
489
+ let e;
490
+ t.resolver ? (e = B((await R()).errors), C()) : e = await V({
491
+ fields: r,
492
+ onlyCheckValid: !0,
493
+ eventType: k.VALID
494
+ }), e !== n.isValid && g.state.next({ isValid: e });
495
+ }
496
+ }, C = (e, r) => {
497
+ !t.disabled && (m.isValidating || m.validatingFields || h.isValidating || h.validatingFields) && ((e || Array.from(s.mount)).forEach((e) => {
498
+ e && (r ? I(n.validatingFields, e, r) : U(n.validatingFields, e));
499
+ }), g.state.next({
500
+ validatingFields: n.validatingFields,
501
+ isValidating: !B(n.validatingFields)
502
+ }));
503
+ }, E = () => {
504
+ n.dirtyFields = W(i, a);
505
+ }, ne = (e, i = [], s, c, l = !0, u = !0) => {
506
+ if (c && s && !t.disabled) {
507
+ if (o.action = !0, u && Array.isArray(N(r, e))) {
508
+ let t = s(N(r, e), c.argA, c.argB);
509
+ l && I(r, e, t);
510
+ }
511
+ if (u && Array.isArray(N(n.errors, e))) {
512
+ let t = s(N(n.errors, e), c.argA, c.argB);
513
+ l && I(n.errors, e, t), Ke(n.errors, e);
514
+ }
515
+ if ((m.touchedFields || h.touchedFields) && u && Array.isArray(N(n.touchedFields, e))) {
516
+ let t = s(N(n.touchedFields, e), c.argA, c.argB);
517
+ l && I(n.touchedFields, e, t);
518
+ }
519
+ (m.dirtyFields || h.dirtyFields) && E(), g.state.next({
520
+ name: e,
521
+ isDirty: H(e, i),
522
+ dirtyFields: n.dirtyFields,
523
+ errors: n.errors,
524
+ isValid: n.isValid
525
+ });
526
+ } else I(a, e, i);
527
+ }, re = (e, t) => {
528
+ I(n.errors, e, t), n.errors = { ...n.errors }, g.state.next({ errors: n.errors });
529
+ }, ae = (e) => {
530
+ n.errors = e, g.state.next({
531
+ errors: n.errors,
532
+ isValid: !1
533
+ });
534
+ }, se = (e) => {
535
+ let t = ie(e) ? [e] : oe(e), n = a, r = i;
536
+ for (let e = 0; e < t.length - 1; e++) {
537
+ let i = t[e];
538
+ if (n = S(n) ? n : n[i], r = S(r) ? r : r[i], n === null && r !== null) return !0;
539
+ }
540
+ return !1;
541
+ }, ce = (t, c, l, u) => {
542
+ let d = N(r, t);
543
+ if (d) {
544
+ if (se(t)) return;
545
+ let r = M(N(a, t)), f = N(a, t, M(l) ? N(i, t) : l);
546
+ M(f) || u && u.defaultChecked || c ? I(a, t, c ? f : Ne(d._f)) : Ee(t, f), o.mount && !o.action && (y(), r && n.isDirty && (m.isDirty || h.isDirty) && (H() || (n.isDirty = !1, g.state.next({ ...n }))), e.shouldUnregister && r && !M(N(a, t)) && Be(t, s) && (o.watch = !0));
547
+ }
548
+ }, le = (e, r, o, s, c) => {
549
+ let l = !1, u = !1, d = { name: e };
550
+ if (!t.disabled) {
551
+ if (!o || s) {
552
+ let t = z(N(i, e), r);
553
+ (m.isDirty || h.isDirty) && (u = n.isDirty, n.isDirty = d.isDirty = !t || H(), l = u !== d.isDirty), u = !!N(n.dirtyFields, e), t === n.isDirty ? t ? U(n.dirtyFields, e) : I(n.dirtyFields, e, !0) : n.dirtyFields = W(i, a), d.dirtyFields = n.dirtyFields, l ||= (m.dirtyFields || h.dirtyFields) && u !== !t;
554
+ }
555
+ if (o) {
556
+ let t = N(n.touchedFields, e);
557
+ t || (I(n.touchedFields, e, o), d.touchedFields = n.touchedFields, l ||= (m.touchedFields || h.touchedFields) && t !== o);
558
+ }
559
+ l && c && g.state.next(d);
560
+ }
561
+ return l ? d : {};
562
+ }, de = (e, r, i, a) => {
563
+ let o = N(n.errors, e), s = (m.isValid || h.isValid) && P(r) && n.isValid !== r;
564
+ if (t.delayError && i ? (c = v(() => re(e, i)), c(t.delayError)) : (clearTimeout(l), c = null, i ? I(n.errors, e, i) : U(n.errors, e), n.errors = { ...n.errors }), (i ? !z(o, i) : o) || !B(a) || s) {
565
+ let t = {
566
+ ...a,
567
+ ...s && P(r) ? { isValid: r } : {},
568
+ errors: n.errors,
569
+ name: e
570
+ };
571
+ n = {
572
+ ...n,
573
+ ...t
574
+ }, g.state.next(t);
575
+ }
576
+ }, R = async (e) => (C(e, !0), await t.resolver(a, t.context, Pe(e || s.mount, r, t.criteriaMode, t.shouldUseNativeValidation))), fe = async (e) => {
577
+ let { errors: t } = await R(e);
578
+ if (C(e), e) {
579
+ for (let r of e) {
580
+ let e = N(t, r);
581
+ e ? s.array.has(r) && w(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))) ? qe(n.errors, { [r]: e }, r) : I(n.errors, r, e) : U(n.errors, r);
582
+ }
583
+ n.errors = { ...n.errors };
584
+ } else n.errors = t;
585
+ return t;
586
+ }, pe = async ({ name: t, eventType: r }) => {
587
+ if (e.validate) {
588
+ let i = await e.validate({
589
+ formValues: a,
590
+ formState: n,
591
+ name: t,
592
+ eventType: r
593
+ });
594
+ if (w(i)) for (let e in i) {
595
+ let t = i[e];
596
+ t && $e(`${Ze}.${e}`, {
597
+ message: L(t.message) ? t.message : "",
598
+ type: t.type || j.validate
599
+ });
600
+ }
601
+ else L(i) || !i ? $e(Ze, {
602
+ message: i || "",
603
+ type: j.validate
604
+ }) : q(Ze);
605
+ return i;
606
+ }
607
+ return !0;
608
+ }, V = async ({ fields: r, onlyCheckValid: i, name: o, eventType: c, context: l = {
609
+ valid: !0,
610
+ runRootValidation: !1
611
+ } }) => {
612
+ if (e.validate && (l.runRootValidation = !0, !await pe({
613
+ name: o,
614
+ eventType: c
615
+ }) && (l.valid = !1, i))) return l.valid;
616
+ for (let o in r) {
617
+ let u = r[o];
618
+ if (u) {
619
+ let { _f: r, ...d } = u;
620
+ if (r) {
621
+ let o = s.array.has(r.name), c = u._f && Re(u._f), d = m.validatingFields || m.isValidating || h.validatingFields || h.isValidating;
622
+ c && d && C([r.name], !0);
623
+ let f = await Ye(u, s.disabled, a, _, t.shouldUseNativeValidation && !i, o);
624
+ if (c && d && C([r.name]), f[r.name] && (l.valid = !1, i) || (!i && (N(f, r.name) ? o ? qe(n.errors, f, r.name) : I(n.errors, r.name, f[r.name]) : U(n.errors, r.name)), e.shouldUseNativeValidation && f[r.name])) break;
625
+ }
626
+ !B(d) && await V({
627
+ context: l,
628
+ onlyCheckValid: i,
629
+ fields: d,
630
+ name: o,
631
+ eventType: c
632
+ });
633
+ }
634
+ }
635
+ return l.valid;
636
+ }, Ce = () => {
637
+ for (let e of s.unMount) {
638
+ let t = N(r, e);
639
+ t && (t._f.refs ? t._f.refs.every((e) => !Se(e)) : !Se(t._f.ref)) && Y(e);
640
+ }
641
+ s.unMount = /* @__PURE__ */ new Set();
642
+ }, H = (e, n) => !t.disabled && (e && n && I(a, e, n), !z(o.mount ? a : i, i)), we = (e, t, n) => ue(e, s, { ...o.mount ? a : M(t) ? i : L(e) ? { [e]: t } : t }, n, t), Te = (e) => me(N(o.mount ? a : i, e, t.shouldUnregister ? N(i, e, []) : [])), Ee = (e, t, n = {}, i = !1, o = !1) => {
643
+ let s = N(r, e), c = t;
644
+ if (s) {
645
+ let n = s._f;
646
+ n && (!n.disabled && I(a, e, Ae(t, n)), c = ye(n.ref) && S(t) ? "" : t, be(n.ref) ? [...n.ref.options].forEach((e) => e.selected = c.includes(e.value)) : n.refs ? b(n.ref) ? n.refs.forEach((e) => {
647
+ (!e.defaultChecked || !e.disabled) && (Array.isArray(c) ? e.checked = !!c.find((t) => t === e.value) : e.checked = c === e.value || !!c);
648
+ }) : n.refs.forEach((e) => e.checked = e.value === c) : ve(n.ref) ? n.ref.value = "" : (n.ref.value = c, !n.ref.type && !o && g.state.next({
649
+ name: e,
650
+ values: i ? a : O(a)
651
+ })));
652
+ }
653
+ (n.shouldDirty || n.shouldTouch) && le(e, c, n.shouldTouch, n.shouldDirty, !o), n.shouldValidate && K(e);
654
+ }, De = (e, t, n, i = !1, a = !1) => {
655
+ for (let o in t) {
656
+ if (!t.hasOwnProperty(o)) return;
657
+ let c = t[o], l = e + "." + o, u = N(r, l);
658
+ (s.array.has(e) || w(c) || u && !u._f) && !x(c) ? De(l, c, n, i, a) : Ee(l, c, n, i, a);
659
+ }
660
+ }, Oe = (e, t, i, c, l = !1) => {
661
+ let u = N(r, e), d = s.array.has(e), f = c ? t : O(t), p = z(N(a, e), f);
662
+ if (p || I(a, e, f), d) g.array.next({
663
+ name: e,
664
+ values: c ? a : O(a)
665
+ }), (m.isDirty || m.dirtyFields || h.isDirty || h.dirtyFields) && i.shouldDirty && (E(), l || g.state.next({
666
+ name: e,
667
+ dirtyFields: n.dirtyFields,
668
+ isDirty: H(e, f)
669
+ }));
670
+ else {
671
+ let t = Array.isArray(f) && !f.length || B(f);
672
+ !u || u._f || S(f) || t ? Ee(e, f, i, c, l) : De(e, f, i, c, l);
673
+ }
674
+ if (!p && !l) {
675
+ let t = Be(e, s), r = c ? a : O(a);
676
+ g.state.next({
677
+ ...t && n,
678
+ name: o.mount || t ? e : void 0,
679
+ values: r
680
+ });
681
+ }
682
+ }, G = (e, t, n = {}) => Oe(e, t, n, !1), ke = (e, t = {}) => {
683
+ let r = F(e) ? e(a) : e;
684
+ if (!z(a, r)) {
685
+ a = {
686
+ ...a,
687
+ ...r
688
+ };
689
+ for (let e of s.mount) Oe(e, N(r, e), t, !0, !0);
690
+ g.state.next({
691
+ ...n,
692
+ name: void 0,
693
+ type: void 0,
694
+ ...u ? { values: a } : {}
695
+ }), t.shouldValidate && y();
696
+ }
697
+ }, je = async (i) => {
698
+ o.mount = !0;
699
+ let l = i.target, p = l.name, v = !0, b = N(r, p), S = (e) => {
700
+ v = Number.isNaN(e) || x(e) && isNaN(e.getTime()) || z(e, N(a, p, e));
701
+ };
702
+ if (b) {
703
+ let o, x, w = l.type ? Ne(b._f) : ee(i), T = i.type === k.BLUR || i.type === k.FOCUS_OUT, E = !ze(b._f) && !e.validate && !t.resolver && !N(n.errors, p) && !b._f.deps, D = E || Ge(T, N(n.touchedFields, p), n.isSubmitted, f, d), A = Be(p, s, T);
704
+ I(a, p, w), T ? (!l || !l.readOnly) && (b._f.onBlur && b._f.onBlur(i), c && c(0)) : b._f.onChange && b._f.onChange(i);
705
+ let j = le(p, w, T), te = !B(j) || A;
706
+ if (!T && g.state.next({
707
+ name: p,
708
+ type: i.type,
709
+ ...u ? { values: O(a) } : {}
710
+ }), D) return (!E || !n.isValid) && (m.isValid || h.isValid) && (t.mode === "onBlur" ? T && y() : T || y()), te && g.state.next({
711
+ name: p,
712
+ ...A ? {} : j
713
+ });
714
+ if (!t.resolver && e.validate && await pe({
715
+ name: p,
716
+ eventType: i.type
717
+ }), !T && A && g.state.next({ ...n }), t.resolver) {
718
+ let { errors: e } = await R([p]);
719
+ if (C([p]), S(w), !v) {
720
+ !B(j) && g.state.next(j);
721
+ return;
722
+ }
723
+ let t = He(n.errors, r, p), i = He(e, r, t.name || p);
724
+ o = i.error, p = i.name, x = B(e);
725
+ } else C([p], !0), o = (await Ye(b, s.disabled, a, _, t.shouldUseNativeValidation))[p], C([p]), S(w), v && (o ? x = !1 : (m.isValid || h.isValid) && (x = await V({
726
+ fields: r,
727
+ onlyCheckValid: !0,
728
+ name: p,
729
+ eventType: i.type
730
+ })));
731
+ v && (b._f.deps && (!Array.isArray(b._f.deps) || b._f.deps.length > 0) && K(b._f.deps), de(p, x, o, j));
732
+ }
733
+ }, Me = (e, t) => {
734
+ if (N(n.errors, t) && e.focus) return e.focus(), 1;
735
+ }, K = async (e, i = {}) => {
736
+ let a, o, c = he(e);
737
+ if (t.resolver) {
738
+ let t = await fe(M(e) ? e : c);
739
+ a = B(t), o = e ? !c.some((e) => N(t, e)) : a;
740
+ } else e ? (o = (await Promise.all(c.map(async (e) => {
741
+ let t = N(r, e);
742
+ return await V({
743
+ fields: t && t._f ? { [e]: t } : t,
744
+ eventType: k.TRIGGER
745
+ });
746
+ }))).every(Boolean), !(!o && !n.isValid) && y()) : o = a = await V({
747
+ fields: r,
748
+ name: e,
749
+ eventType: k.TRIGGER
750
+ });
751
+ return g.state.next({
752
+ ...!L(e) || (m.isValid || h.isValid) && a !== n.isValid ? {} : { name: e },
753
+ ...t.resolver || !e ? { isValid: a } : {},
754
+ errors: n.errors
755
+ }), i.shouldFocus && !o && Ve(r, Me, e ? c : s.mount), o;
756
+ }, Le = (e, t) => {
757
+ let r = { ...o.mount ? a : i };
758
+ return t && (r = _e(t.dirtyFields ? n.dirtyFields : n.touchedFields, r)), M(e) ? r : L(e) ? N(r, e) : e.map((e) => N(r, e));
759
+ }, Je = (e, t) => ({
760
+ invalid: !!N((t || n).errors, e),
761
+ isDirty: !!N((t || n).dirtyFields, e),
762
+ error: N((t || n).errors, e),
763
+ isValidating: !!N(n.validatingFields, e),
764
+ isTouched: !!N((t || n).touchedFields, e)
765
+ }), q = (e) => {
766
+ let t = e ? he(e) : void 0;
767
+ t?.forEach((e) => U(n.errors, e)), t ? t.forEach((e) => {
768
+ g.state.next({
769
+ name: e,
770
+ errors: n.errors
771
+ });
772
+ }) : g.state.next({ errors: {} });
773
+ }, $e = (e, t, i) => {
774
+ let a = (N(r, e, { _f: {} })._f || {}).ref, { ref: o, message: s, type: c, ...l } = N(n.errors, e) || {};
775
+ I(n.errors, e, {
776
+ ...l,
777
+ ...t,
778
+ ref: a
779
+ }), g.state.next({
780
+ name: e,
781
+ errors: n.errors,
782
+ isValid: !1
783
+ }), i && i.shouldFocus && a && a.focus && a.focus();
784
+ }, et = (e, t) => {
785
+ if (F(e)) {
786
+ u++;
787
+ let { unsubscribe: n } = g.state.subscribe({ next: (n) => "values" in n && e(n.values || we(void 0, t), n) }), r = !1;
788
+ return { unsubscribe: () => {
789
+ r || (r = !0, u--, n());
790
+ } };
791
+ }
792
+ return we(e, t, !0);
793
+ }, tt = (e) => {
794
+ let t = !!e.formState?.values;
795
+ t && u++;
796
+ let { unsubscribe: r } = g.state.subscribe({ next: (t) => {
797
+ if (We(e.name, t.name, e.exact) && Ue(t, e.formState || m, lt, e.reRenderRoot)) {
798
+ let r = { ...a };
799
+ e.callback({
800
+ values: r,
801
+ ...n,
802
+ ...t,
803
+ defaultValues: i
804
+ });
805
+ }
806
+ } });
807
+ if (!t) return r;
808
+ let o = !1;
809
+ return () => {
810
+ o || (o = !0, u--, r());
811
+ };
812
+ }, J = (e) => (o.mount = !0, h = {
813
+ ...h,
814
+ ...e.formState
815
+ }, tt({
816
+ ...e,
817
+ formState: {
818
+ ...p,
819
+ ...e.formState
820
+ }
821
+ })), Y = (e, o = {}) => {
822
+ for (let c of e ? he(e) : s.mount) s.mount.delete(c), s.array.delete(c), o.keepValue || (U(r, c), U(a, c)), !o.keepError && U(n.errors, c), !o.keepDirty && U(n.dirtyFields, c), !o.keepTouched && U(n.touchedFields, c), !o.keepIsValidating && U(n.validatingFields, c), !t.shouldUnregister && !o.keepDefaultValue && U(i, c);
823
+ g.state.next({ values: O(a) }), g.state.next({
824
+ ...n,
825
+ ...o.keepDirty ? { isDirty: H() } : {}
826
+ }), !o.keepIsValid && y();
827
+ }, nt = ({ disabled: e, name: t }) => {
828
+ if (P(e) && o.mount || e || s.disabled.has(t)) {
829
+ let n = s.disabled.has(t) !== !!e;
830
+ e ? s.disabled.add(t) : s.disabled.delete(t), n && o.mount && !o.action && y();
831
+ }
832
+ }, X = (e, n = {}) => {
833
+ let a = N(r, e), c = P(n.disabled) || P(t.disabled), l = !s.registerName.has(e) && a && a._f && !a._f.mount;
834
+ return I(r, e, {
835
+ ...a || {},
836
+ _f: {
837
+ ...a && a._f ? a._f : { ref: { name: e } },
838
+ name: e,
839
+ mount: !0,
840
+ ...n
841
+ }
842
+ }), s.mount.add(e), a && !l ? nt({
843
+ disabled: P(n.disabled) ? n.disabled : t.disabled,
844
+ name: e
845
+ }) : ce(e, !0, n.value), {
846
+ ...c ? { disabled: n.disabled || t.disabled } : {},
847
+ ...t.progressive ? {
848
+ required: !!n.required,
849
+ min: Fe(n.min),
850
+ max: Fe(n.max),
851
+ minLength: Fe(n.minLength),
852
+ maxLength: Fe(n.maxLength),
853
+ pattern: Fe(n.pattern)
854
+ } : {},
855
+ name: e,
856
+ onChange: je,
857
+ onBlur: je,
858
+ ref: (c) => {
859
+ if (c) {
860
+ s.registerName.add(e), X(e, n), s.registerName.delete(e), a = N(r, e);
861
+ let t = M(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, o = xe(t), l = a._f.refs || [];
862
+ if (o ? l.find((e) => e === t) : t === a._f.ref) return;
863
+ I(r, e, { _f: {
864
+ ...a._f,
865
+ ...o ? {
866
+ refs: [
867
+ ...l.filter(Se),
868
+ t,
869
+ ...Array.isArray(N(i, e)) ? [{}] : []
870
+ ],
871
+ ref: {
872
+ type: t.type,
873
+ name: e
874
+ }
875
+ } : { ref: t }
876
+ } }), ce(e, !1, void 0, t);
877
+ } else a = N(r, e, {}), a._f && (a._f.mount = !1), (t.shouldUnregister || n.shouldUnregister) && !(T(s.array, e) && o.action) && s.unMount.add(e);
878
+ }
879
+ };
880
+ }, rt = () => t.shouldFocusError && !t.shouldUseNativeValidation && Ve(r, Me, s.mount), it = (e) => {
881
+ P(e) && (g.state.next({ disabled: e }), Ve(r, (t, n) => {
882
+ let i = N(r, n);
883
+ i && (t.disabled = i._f.disabled || e, Array.isArray(i._f.refs) && i._f.refs.forEach((t) => {
884
+ t.disabled = i._f.disabled || e;
885
+ }));
886
+ }, 0, !1));
887
+ }, at = (e, i) => async (o) => {
888
+ let c;
889
+ o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
890
+ let l = O(a);
891
+ if (g.state.next({ isSubmitting: !0 }), t.resolver) {
892
+ let { errors: e, values: t } = await R();
893
+ C(), n.errors = e, l = O(t);
894
+ } else await V({
895
+ fields: r,
896
+ eventType: k.SUBMIT
897
+ });
898
+ if (s.disabled.size) for (let e of s.disabled) U(l, e);
899
+ if (U(n.errors, te), B(n.errors)) {
900
+ g.state.next({ errors: {} });
901
+ try {
902
+ await e(l, o);
903
+ } catch (e) {
904
+ c = e;
905
+ }
906
+ } else i && await i({ ...n.errors }, o), rt(), setTimeout(rt);
907
+ if (g.state.next({
908
+ isSubmitted: !0,
909
+ isSubmitting: !1,
910
+ isSubmitSuccessful: B(n.errors) && !c,
911
+ submitCount: n.submitCount + 1,
912
+ errors: n.errors
913
+ }), c) throw c;
914
+ }, ot = (e, t = {}) => {
915
+ N(r, e) && (M(t.defaultValue) ? G(e, O(N(i, e))) : (G(e, t.defaultValue), I(i, e, O(t.defaultValue))), t.keepTouched || U(n.touchedFields, e), t.keepDirty || (U(n.dirtyFields, e), n.isDirty = t.defaultValue ? H(e, O(N(i, e))) : H()), t.keepError || (U(n.errors, e), m.isValid && y()), g.state.next({ ...n }));
916
+ }, st = (e, c = {}) => {
917
+ let l = e ? O(e) : i, u = O(l), d = B(e), f = u;
918
+ if (c.keepDefaultValues || (i = l), !c.keepValues) {
919
+ if (c.keepDirtyValues) {
920
+ let e = /* @__PURE__ */ new Set([...s.mount, ...Object.keys(W(i, a))]);
921
+ for (let t of Array.from(e)) {
922
+ let e = N(n.dirtyFields, t), r = N(a, t), i = N(f, t);
923
+ e && !M(r) ? I(f, t, r) : !e && !M(i) && G(t, i);
924
+ }
925
+ } else {
926
+ if (D && M(e)) for (let e of s.mount) {
927
+ let t = N(r, e);
928
+ if (t && t._f) {
929
+ let e = Array.isArray(t._f.refs) ? t._f.refs[0] : t._f.ref;
930
+ if (ye(e)) {
931
+ let t = e.closest("form");
932
+ if (t) {
933
+ t.reset();
934
+ break;
935
+ }
936
+ }
937
+ }
938
+ }
939
+ if (c.keepFieldsRef) for (let e of s.mount) G(e, N(f, e));
940
+ else r = {};
941
+ }
942
+ if (t.shouldUnregister) {
943
+ if (a = c.keepDefaultValues ? O(i) : {}, c.keepFieldsRef) for (let e of s.mount) I(a, e, N(f, e));
944
+ } else a = O(f);
945
+ g.array.next({ values: { ...f } }), g.state.next({ values: { ...f } });
946
+ }
947
+ s = {
948
+ mount: c.keepDirtyValues ? s.mount : /* @__PURE__ */ new Set(),
949
+ unMount: /* @__PURE__ */ new Set(),
950
+ array: /* @__PURE__ */ new Set(),
951
+ registerName: /* @__PURE__ */ new Set(),
952
+ disabled: /* @__PURE__ */ new Set(),
953
+ watch: /* @__PURE__ */ new Set(),
954
+ watchAll: !1,
955
+ focus: ""
956
+ }, o.mount = !m.isValid || !!c.keepIsValid || !!c.keepDirtyValues || !t.shouldUnregister && !B(f), o.watch = !!t.shouldUnregister, o.keepIsValid = !!c.keepIsValid, o.action = !1, c.keepErrors || (n.errors = {}), g.state.next({
957
+ submitCount: c.keepSubmitCount ? n.submitCount : 0,
958
+ isDirty: d ? !1 : c.keepDirty ? n.isDirty : c.keepValues ? H() : !!(c.keepDefaultValues && !z(e, i)),
959
+ isSubmitted: c.keepIsSubmitted ? n.isSubmitted : !1,
960
+ dirtyFields: d ? {} : c.keepDirtyValues ? c.keepDefaultValues && a ? W(i, a) : n.dirtyFields : c.keepDefaultValues && e ? W(i, e) : c.keepDirty ? n.dirtyFields : {},
961
+ touchedFields: c.keepTouched ? n.touchedFields : {},
962
+ errors: c.keepErrors ? n.errors : {},
963
+ isSubmitSuccessful: c.keepIsSubmitSuccessful ? n.isSubmitSuccessful : !1,
964
+ isSubmitting: !1,
965
+ defaultValues: i
966
+ });
967
+ }, ct = (e, n) => st(F(e) ? e(a) : e, {
968
+ ...t.resetOptions,
969
+ ...n
970
+ }), Z = (e, t = {}) => {
971
+ let n = N(r, e), i = n && n._f;
972
+ if (i) {
973
+ let e = i.refs ? i.refs[0] : i.ref;
974
+ e.focus && setTimeout(() => {
975
+ e.focus(), t.shouldSelect && F(e.select) && e.select();
976
+ });
977
+ }
978
+ }, lt = (e) => {
979
+ n = {
980
+ ...n,
981
+ ...e
982
+ };
983
+ }, ut = {
984
+ control: {
985
+ register: X,
986
+ unregister: Y,
987
+ getFieldState: Je,
988
+ handleSubmit: at,
989
+ setError: $e,
990
+ _subscribe: tt,
991
+ _runSchema: R,
992
+ _updateIsValidating: C,
993
+ _focusError: rt,
994
+ _getWatch: we,
995
+ _getDirty: H,
996
+ _setValid: y,
997
+ _setFieldArray: ne,
998
+ _setDisabledField: nt,
999
+ _setErrors: ae,
1000
+ _getFieldArray: Te,
1001
+ _reset: st,
1002
+ _resetDefaultValues: () => F(t.defaultValues) && t.defaultValues().then((e) => {
1003
+ ct(e, t.resetOptions), g.state.next({ isLoading: !1 });
1004
+ }),
1005
+ _removeUnmounted: Ce,
1006
+ _disableForm: it,
1007
+ _subjects: g,
1008
+ _proxyFormState: m,
1009
+ get _fields() {
1010
+ return r;
1011
+ },
1012
+ get _formValues() {
1013
+ return a;
1014
+ },
1015
+ get _state() {
1016
+ return o;
1017
+ },
1018
+ set _state(e) {
1019
+ o = e;
1020
+ },
1021
+ get _defaultValues() {
1022
+ return i;
1023
+ },
1024
+ get _names() {
1025
+ return s;
1026
+ },
1027
+ set _names(e) {
1028
+ s = e;
1029
+ },
1030
+ get _formState() {
1031
+ return n;
1032
+ },
1033
+ get _options() {
1034
+ return t;
1035
+ },
1036
+ set _options(e) {
1037
+ t = {
1038
+ ...t,
1039
+ ...e
1040
+ }, d = Ie(t.mode), f = Ie(t.reValidateMode);
1041
+ }
1042
+ },
1043
+ subscribe: J,
1044
+ trigger: K,
1045
+ register: X,
1046
+ handleSubmit: at,
1047
+ watch: et,
1048
+ setValue: G,
1049
+ setValues: ke,
1050
+ getValues: Le,
1051
+ reset: ct,
1052
+ resetField: ot,
1053
+ resetDefaultValues: (e, t = {}) => {
1054
+ if (i = O(e), !t.keepDirty) {
1055
+ let e = W(i, a);
1056
+ n.dirtyFields = e, n.isDirty = !B(e);
1057
+ }
1058
+ t.keepIsValid || y(), g.state.next({
1059
+ ...n,
1060
+ defaultValues: i
1061
+ });
1062
+ },
1063
+ clearErrors: q,
1064
+ unregister: Y,
1065
+ setError: $e,
1066
+ setFocus: Z,
1067
+ getFieldState: Je
1068
+ };
1069
+ return {
1070
+ ...ut,
1071
+ formControl: ut
1072
+ };
1073
+ }
1074
+ function et(e = {}) {
1075
+ let t = r.useRef(void 0), n = r.useRef(void 0), i = r.useRef(e.formControl), [a, o] = r.useState(() => ({
1076
+ ...O(Qe),
1077
+ isLoading: F(e.defaultValues),
1078
+ errors: e.errors || {},
1079
+ disabled: e.disabled || !1,
1080
+ defaultValues: F(e.defaultValues) ? void 0 : e.defaultValues
1081
+ }));
1082
+ if (!t.current || e.formControl && i.current !== e.formControl) if (i.current = e.formControl, e.formControl) t.current = {
1083
+ ...e.formControl,
1084
+ formState: a
1085
+ }, e.defaultValues && !F(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1086
+ else {
1087
+ let { formControl: n, ...r } = $e(e);
1088
+ t.current = {
1089
+ ...r,
1090
+ formState: a
1091
+ };
1092
+ }
1093
+ let s = t.current.control;
1094
+ return s._options = e, le(() => {
1095
+ let e = s._subscribe({
1096
+ formState: s._proxyFormState,
1097
+ callback: () => o({
1098
+ ...s._formState,
1099
+ defaultValues: s._defaultValues
1100
+ }),
1101
+ reRenderRoot: !0
1102
+ });
1103
+ return o((e) => ({
1104
+ ...e,
1105
+ isReady: !0
1106
+ })), s._formState.isReady = !0, e;
1107
+ }, [s]), r.useEffect(() => s._disableForm(e.disabled), [s, e.disabled]), r.useEffect(() => {
1108
+ e.mode && (s._options.mode = e.mode), e.reValidateMode && (s._options.reValidateMode = e.reValidateMode);
1109
+ }, [
1110
+ s,
1111
+ e.mode,
1112
+ e.reValidateMode
1113
+ ]), r.useEffect(() => {
1114
+ e.errors && (s._setErrors(e.errors), s._focusError());
1115
+ }, [s, e.errors]), r.useEffect(() => {
1116
+ e.shouldUnregister && s._subjects.state.next({ values: s._getWatch() });
1117
+ }, [s, e.shouldUnregister]), r.useEffect(() => {
1118
+ if (s._proxyFormState.isDirty) {
1119
+ let e = s._getDirty();
1120
+ e !== a.isDirty && s._subjects.state.next({ isDirty: e });
1121
+ }
1122
+ }, [s, a.isDirty]), r.useEffect(() => {
1123
+ e.values && !z(e.values, n.current) ? (s._reset(e.values, {
1124
+ keepFieldsRef: !0,
1125
+ ...s._options.resetOptions
1126
+ }), s._options.resetOptions?.keepIsValid || s._setValid(), n.current = e.values, o((e) => ({ ...e }))) : s._resetDefaultValues();
1127
+ }, [s, e.values]), r.useEffect(() => {
1128
+ s._state.mount || (s._setValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
1129
+ }), t.current.formState = r.useMemo(() => ce(a, s), [s, a]), t.current;
1130
+ }
1131
+ //#endregion
1132
+ //#region src/Form/useForm.tsx
1133
+ var tt = () => {
1134
+ let [n, r] = p(), i = et({ reValidateMode: "onChange" }), a = (e, t) => {
1135
+ let n = i.register(e, t), a = (t) => (r(null), i.clearErrors(e), n.onChange(t)), o = i?.formState.errors, s = i.watch(e);
1136
+ return {
1137
+ ...n,
1138
+ onChange: a,
1139
+ formvalue: s,
1140
+ error: o?.[e]?.message?.toString()
1141
+ };
1142
+ }, o = (e) => {
1143
+ e.errors ? Object.keys(e.errors).forEach((t) => i.setError(t, { message: e.errors?.[t]?.[0] })) : r(e);
1144
+ }, s = () => /* @__PURE__ */ t(e, { children: n && !n.errors && /* @__PURE__ */ t("div", {
1145
+ className: m["global-error"],
1146
+ children: n.message
1147
+ }) });
1148
+ return {
1149
+ ...i,
1150
+ register: a,
1151
+ GlobalError: s,
1152
+ setErrors: o
1153
+ };
1154
+ }, J = {
1155
+ container: "style-module__container__JyG0-",
1156
+ "loading-container": "style-module__loading-container__sphNQ",
1157
+ hidden: "style-module__hidden__jvJWI",
1158
+ disabled: "style-module__disabled__p40Jo",
1159
+ error: "style-module__error__pSghy",
1160
+ placeholder: "style-module__placeholder__c-V0V",
1161
+ element: "style-module__element__Ex50N"
1162
+ }, Y = {
1163
+ loading: "style-module__loading__r9fwC",
1164
+ dot: "style-module__dot__mMqu2",
1165
+ bounce: "style-module__bounce__ikJLW",
1166
+ light: "style-module__light__Kubs1",
1167
+ secondary: "style-module__secondary__EkNcU",
1168
+ "secondary-light": "style-module__secondary-light__cJeWY"
1169
+ }, nt = ({ color: e = "primary", ...r }) => {
1170
+ let i = ["ui-loading"];
1171
+ return i.push(Y.loading), e && i.push(Y[e], "ui-loading-" + e), /* @__PURE__ */ n("div", {
1172
+ ...r,
1173
+ className: i.join(" "),
1174
+ children: [
1175
+ /* @__PURE__ */ t("div", { className: Y.dot }),
1176
+ /* @__PURE__ */ t("div", { className: Y.dot }),
1177
+ /* @__PURE__ */ t("div", { className: Y.dot }),
1178
+ /* @__PURE__ */ t("div", { className: Y.dot })
1179
+ ]
1180
+ });
1181
+ }, X = ({ children: r, beforeElement: a, afterElement: o, error: s, placeholder: c, styleContainer: u, classNameContainer: f, hiddenContainer: m, formvalue: h, wait: g, ..._ }) => {
1182
+ let [v, y] = p("");
1183
+ return l(() => {
1184
+ y(s ?? "");
1185
+ }, [s]), /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("label", {
1186
+ className: d(() => {
1187
+ let e = ["ui-form-element-container"];
1188
+ return e.push(J.container), v && e.push(J.error), _.disabled && e.push(J.disabled), m && e.push(J.hidden), f && e.push(f), e.join(" ");
1189
+ }, [
1190
+ v,
1191
+ _.disabled,
1192
+ m,
1193
+ f
1194
+ ]),
1195
+ style: u,
1196
+ children: /* @__PURE__ */ n("div", {
1197
+ className: "ui-form-element " + J.element,
1198
+ children: [
1199
+ a ? i(a, { key: "ui-before-element" }) : null,
1200
+ typeof r == "function" ? r(_) : null,
1201
+ c && g ? "" : /* @__PURE__ */ t("span", {
1202
+ className: "ui-form-element-placeholder " + J.placeholder,
1203
+ children: c
1204
+ }),
1205
+ g && /* @__PURE__ */ t(nt, {}),
1206
+ o ? i(o, { key: "ui-after-element" }) : null
1207
+ ]
1208
+ })
1209
+ }), v && /* @__PURE__ */ t("div", {
1210
+ className: "ui-form-error " + J.error,
1211
+ children: v
1212
+ })] });
1213
+ }, rt = y, it = o(({ onChange: e, onInput: n, onChangeText: r, wait: i, disabled: a, formvalue: o, children: s, ...c }, u) => {
1214
+ let [d, f] = p(""), m = (t) => {
1215
+ typeof e == "function" && e(t), typeof r == "function" && r(t.target.value);
1216
+ }, h = (e) => {
1217
+ a || i || (typeof n == "function" && n(e), f(e.target.value));
1218
+ };
1219
+ return l(() => {
1220
+ let e = c.value ?? o;
1221
+ f(e ? String(e) : "");
1222
+ }, [c.value, o]), /* @__PURE__ */ t(X, {
1223
+ ...c,
1224
+ wait: i,
1225
+ children: (e) => /* @__PURE__ */ t("input", {
1226
+ ...e,
1227
+ placeholder: "",
1228
+ onChange: m,
1229
+ disabled: a || i,
1230
+ value: i ? "" : d,
1231
+ onInput: h,
1232
+ ref: u
1233
+ })
1234
+ });
1235
+ }), at = o(({ onChange: e, onInput: n, onChangeText: r, formvalue: i, wait: a, ...o }, s) => {
1236
+ let c = f(null), [d, m] = p(o.value ?? i ?? ""), h = (t) => {
1237
+ typeof e == "function" && e(t), typeof r == "function" && r(t.target.value);
1238
+ }, g = (e) => {
1239
+ typeof n == "function" && n(e), m(e.target.value);
1240
+ };
1241
+ l(() => {
1242
+ let e = c.current;
1243
+ if (!e) return;
1244
+ let t = e.offsetHeight;
1245
+ e.style.height = "auto";
1246
+ let n = e.scrollHeight, r = Math.max(n, 50);
1247
+ e.style.height = `${Math.max(r, t)}px`;
1248
+ }, [d]), l(() => {
1249
+ m(o.value ?? i ?? "");
1250
+ }, [o.value, i]), u(s, () => c.current);
1251
+ let _ = a ? "" : d;
1252
+ return /* @__PURE__ */ t(X, {
1253
+ ...o,
1254
+ wait: a,
1255
+ children: (e) => /* @__PURE__ */ t("textarea", {
1256
+ ...e,
1257
+ disabled: a,
1258
+ placeholder: e.placeholder ?? "",
1259
+ value: _,
1260
+ onChange: h,
1261
+ onInput: g,
1262
+ ref: c
1263
+ })
1264
+ });
1265
+ }), ot = {
1266
+ "file-btn": "style-module__file-btn__WajPw",
1267
+ icon: "style-module__icon__f1VPN"
1268
+ }, st = ({ onChange: r, onChangeFiles: i, accept: a, multiple: o, wait: c, children: l, className: u, icon: d, ...p }) => {
1269
+ let m = f(null), h = `
1270
+ ${ot["file-btn"]}
1271
+ ${d && !c ? ot.icon : ""}
1272
+ `.trim(), g = s((e) => {
1273
+ let t = e.target.files;
1274
+ typeof r == "function" && r(e), typeof i == "function" && i(t);
1275
+ }, [r, i]);
1276
+ return /* @__PURE__ */ t(X, {
1277
+ ...p,
1278
+ wait: c,
1279
+ children: (r) => /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("input", {
1280
+ type: "file",
1281
+ ref: m,
1282
+ onChange: g,
1283
+ accept: a,
1284
+ multiple: o,
1285
+ style: { display: "none" },
1286
+ ...r
1287
+ }), /* @__PURE__ */ t("div", {
1288
+ className: `ui-file-uploader ${h} ${u || ""}`,
1289
+ children: !c && (l || "Выбрать файл")
1290
+ })] })
1291
+ });
1292
+ }, ct = ({ onChange: e, children: n, multiple: r, accept: i, ...a }) => {
1293
+ let o = f(null), s = (t) => {
1294
+ let n = t.target;
1295
+ if (n.files) for (let t of n.files) {
1296
+ let n = new FileReader();
1297
+ n.onload = (n) => {
1298
+ let r = n.target?.result?.toString().split(";base64,"), i = r?.[0].replace("data:", "") ?? "", a = r?.[1] ?? "";
1299
+ typeof e == "function" && (o.current.value = "", e({
1300
+ name: t.name,
1301
+ type: t.type,
1302
+ size: t.size,
1303
+ mime: i,
1304
+ data: a,
1305
+ base64: n.target?.result
1306
+ }));
1307
+ }, n.readAsDataURL(t);
1308
+ }
1309
+ }, c = (e) => {
1310
+ a.disabled || (o.current.click(), e.preventDefault());
1311
+ }, u = () => {
1312
+ let e = document.createElement("input");
1313
+ return e.setAttribute("type", "file"), e.onchange = s, i && i.length > 0 && e.setAttribute("accept", i.join(",")), r && e.setAttribute("multiple", "multiple"), e;
1314
+ };
1315
+ return l(() => (o.current = u(), () => {
1316
+ o.current?.remove();
1317
+ }), []), /* @__PURE__ */ t("div", {
1318
+ ...a,
1319
+ onClick: c,
1320
+ children: n
1321
+ });
1322
+ }, Z = {
1323
+ container: "style-module__container__Y4Az4",
1324
+ "wait-indicator": "style-module__wait-indicator__qOZNZ",
1325
+ active: "style-module__active__SLZO0",
1326
+ btn: "style-module__btn__w2P2j",
1327
+ "icon-left": "style-module__icon-left__yptLL",
1328
+ "icon-right": "style-module__icon-right__WiI7N",
1329
+ "icon-only": "style-module__icon-only__EfIlC",
1330
+ "btn-light": "style-module__btn-light__sxtcL",
1331
+ "btn-secondary": "style-module__btn-secondary__t7dC7",
1332
+ "btn-secondary-light": "style-module__btn-secondary-light__wBuc1",
1333
+ "btn-tertiary": "style-module__btn-tertiary__2CjQz",
1334
+ "normal-btn": "style-module__normal-btn__qHevU",
1335
+ "small-btn": "style-module__small-btn__Axtvq",
1336
+ "large-btn": "style-module__large-btn__X3--3"
1337
+ }, lt = ({ children: e, className: r, classNameContainer: i, styleContainer: a, wait: o = !1, variant: s, size: c = "normal", icon: l, ...u }) => {
1338
+ let d = `
1339
+ ${Z.btn}
1340
+ ${s && Z[`btn-${s}`]}
1341
+ ${c && Z[`${c}-btn`]}
1342
+ ${l && !o ? Z[`icon-${l}`] : ""}
1343
+ ${r || ""}
1344
+ `.replace(/\s+/g, " ").trim(), f = ["ui-button-container"];
1345
+ return f.push(Z.container), i && f.push(i), /* @__PURE__ */ n("div", {
1346
+ className: f.join(" "),
1347
+ style: a,
1348
+ children: [/* @__PURE__ */ t("button", {
1349
+ ...u,
1350
+ className: d,
1351
+ children: !o && e
1352
+ }), o && /* @__PURE__ */ t("div", {
1353
+ className: "ui-button-spinner " + Z["wait-indicator"] + (o ? " " + Z.active : ""),
1354
+ children: /* @__PURE__ */ t(nt, { color: s })
1355
+ })]
1356
+ });
1357
+ }, ut = {
1358
+ container: "style-module__container__Qt7Ix",
1359
+ image: "style-module__image__1qdut",
1360
+ new: "style-module__new__fOnXf",
1361
+ close: "style-module__close__9k-p1",
1362
+ wait: "style-module__wait__qnGnj"
1363
+ }, dt = ({ onChange: e, onClick: r, onId: i, onRemove: a, ...o }) => {
1364
+ let { base64: s, src: c } = o, [u, d] = p(!0), m = f(!1), h = f(), _ = (e) => {
1365
+ h.current = e, typeof i == "function" && i(e);
1366
+ };
1367
+ return l(() => {
1368
+ typeof e != "function" || c || e({
1369
+ ...o,
1370
+ setWait: d,
1371
+ setId: _,
1372
+ id: h.current
1373
+ });
1374
+ }, []), /* @__PURE__ */ n("span", {
1375
+ className: ut.image,
1376
+ onClick: () => {
1377
+ typeof r == "function" && r({
1378
+ ...o,
1379
+ setWait: d,
1380
+ setId: _,
1381
+ id: h.current
1382
+ });
1383
+ },
1384
+ children: [
1385
+ /* @__PURE__ */ t("span", {
1386
+ className: ut.close,
1387
+ onClick: (e) => {
1388
+ if (!e.target) return;
1389
+ let t = e.target;
1390
+ m.current && (m.current = !1, t.blur(), typeof a == "function" && a()), m.current = !0;
1391
+ },
1392
+ onBlur: () => {
1393
+ m.current = !1;
1394
+ },
1395
+ tabIndex: 1
1396
+ }),
1397
+ /* @__PURE__ */ t("img", {
1398
+ src: c ?? s?.toString(),
1399
+ onLoad: () => {
1400
+ d(!1);
1401
+ }
1402
+ }),
1403
+ u && /* @__PURE__ */ t("span", {
1404
+ className: ut.wait,
1405
+ children: /* @__PURE__ */ t(g, {})
1406
+ })
1407
+ ]
1408
+ });
1409
+ }, ft = ({ imagesArray: e, onChange: r, onChangeArray: i, onClick: a }) => {
1410
+ let [o, s] = p([]), c = (e) => {
1411
+ s((t) => [...t, { ...e }]);
1412
+ }, u = (e) => (t) => {
1413
+ s((n) => n.map((n) => (e === n && (n.id = t), n)));
1414
+ }, d = (e) => () => s((t) => t.filter((t) => t !== e));
1415
+ return l(() => {
1416
+ typeof i == "function" && i(o);
1417
+ }, [o]), l(() => {
1418
+ e && s(e);
1419
+ }, [e]), /* @__PURE__ */ n("div", {
1420
+ className: ut.container,
1421
+ children: [o.map((e, n) => /* @__PURE__ */ t(dt, {
1422
+ ...e,
1423
+ onChange: r,
1424
+ onClick: a,
1425
+ onRemove: d(e),
1426
+ onId: u(e)
1427
+ }, e.name + n)), /* @__PURE__ */ t(ct, {
1428
+ onChange: c,
1429
+ accept: ["image/png"],
1430
+ className: ut.new,
1431
+ multiple: !0
1432
+ })]
1433
+ });
1434
+ }, pt = {
1435
+ container: "style-module__container__tUkU0",
1436
+ text: "style-module__text__5dksK",
1437
+ indicator: "style-module__indicator__BdmZs"
1438
+ }, mt = o(({ type: e = "checkbox", hiddenContainer: r = !0, placeholder: i, onChecked: a, onChange: o, ...s }, c) => {
1439
+ let l = (e) => {
1440
+ typeof o == "function" && o(e), typeof a == "function" && a(e.target.checked, s.value);
1441
+ };
1442
+ return /* @__PURE__ */ t(X, {
1443
+ ...s,
1444
+ hiddenContainer: r,
1445
+ children: (r) => /* @__PURE__ */ n("div", {
1446
+ className: "ui-checkbox-container " + pt.container,
1447
+ children: [
1448
+ /* @__PURE__ */ t("input", {
1449
+ ...r,
1450
+ className: "ui-checkbox" + (r.className ? " " + r.className : ""),
1451
+ type: e,
1452
+ onChange: l,
1453
+ ref: c
1454
+ }),
1455
+ /* @__PURE__ */ t("span", { className: "ui-checkbox-indicator " + pt.indicator }),
1456
+ /* @__PURE__ */ t("span", {
1457
+ className: "ui-checkbox-text " + pt.text,
1458
+ children: i
1459
+ })
1460
+ ]
1461
+ })
1462
+ });
1463
+ }), ht = {
1464
+ container: "style-module__container__nvLZo",
1465
+ down: "style-module__down__0mCw1",
1466
+ up: "style-module__up__4e9Cz",
1467
+ left: "style-module__left__tsvvk",
1468
+ right: "style-module__right__-YgfC"
1469
+ }, gt = ({ className: e, direction: n = "down", ...r }) => {
1470
+ let i = ["ui-component-arrow"];
1471
+ return i.push(ht.container), n && i.push(ht[n]), e && i.push(e), /* @__PURE__ */ t("div", {
1472
+ ...r,
1473
+ className: i.join(" ")
1474
+ });
1475
+ }, Q = {
1476
+ "container-element": "style-module__container-element__bbCnL",
1477
+ container: "style-module__container__P3B9C",
1478
+ select: "style-module__select__BYzzT",
1479
+ arrow: "style-module__arrow__pfRrX",
1480
+ opened: "style-module__opened__1ytU8",
1481
+ "select-list": "style-module__select-list__c--KX",
1482
+ left: "style-module__left__pbJ6F",
1483
+ right: "style-module__right__WUUwr",
1484
+ hidden: "style-module__hidden__u48qc",
1485
+ optgpoup: "style-module__optgpoup__VDA2I",
1486
+ label: "style-module__label__GP062",
1487
+ option: "style-module__option__byy-y",
1488
+ title: "style-module__title__x7nug",
1489
+ active: "style-module__active__ORdtQ",
1490
+ disabled: "style-module__disabled__xA0bc"
1491
+ }, _t = "ui-", vt = (e, t, n) => {
1492
+ let r = _t + (n ? n + "-" : "");
1493
+ return Array.isArray(e) ? e.map(() => vt(e, t, r)).join(" ") : `${t[e]} ${r}${e}`;
1494
+ }, yt = a({
1495
+ selected: "",
1496
+ emptyValue: { current: {} },
1497
+ setSelect: (e) => {},
1498
+ setSelected: (e) => {},
1499
+ setTitle: (e) => {}
1500
+ }), bt = o(({ children: e, onChangeSelect: r, value: i, formvalue: a, ...o }, s) => {
1501
+ let c = f(null), m = f(null), h = f(!1), [g, _] = p(!1), [v, y] = p(""), [b, x] = p(), S = () => {
1502
+ o.disabled || _(!0);
1503
+ }, C = () => {
1504
+ _(!1);
1505
+ }, w = () => {
1506
+ g ? C() : S();
1507
+ }, ee = (e) => {
1508
+ (Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(m.current, e);
1509
+ let t = new Event("input", { bubbles: !0 });
1510
+ m.current.dispatchEvent(t);
1511
+ }, T = (e) => {
1512
+ typeof r == "function" && r(e), i === void 0 && y(e), C();
1513
+ }, E = (e) => {
1514
+ o.disabled || (typeof o.onInput == "function" && o.onInput(e), typeof o.onChange == "function" && o.onChange(e), y(e.target.value));
1515
+ };
1516
+ l(() => {
1517
+ v && ee(v);
1518
+ }, [v]), l(() => {
1519
+ y(String(i ?? a));
1520
+ }, [i, a]), l(() => {
1521
+ let e = c.current, t = e.classList;
1522
+ g ? (t.remove(Q.hidden), requestAnimationFrame(() => {
1523
+ t.add(Q.opened), e?.focus();
1524
+ })) : (t.contains(Q.opened) && (e.ontransitionend = () => {
1525
+ t.add(Q.hidden), e.ontransitionend = null;
1526
+ }), t.remove(Q.opened));
1527
+ }, [g]), u(s, () => m.current, []);
1528
+ let D = d(() => {
1529
+ let e = [vt("container", Q, "select")];
1530
+ return e.push(Q.hidden), e;
1531
+ }, []);
1532
+ return /* @__PURE__ */ t(X, {
1533
+ ...o,
1534
+ classNameContainer: vt("container-element", Q, "select"),
1535
+ children: (r) => /* @__PURE__ */ n(yt.Provider, {
1536
+ value: {
1537
+ selected: v,
1538
+ emptyValue: h,
1539
+ setSelect: T,
1540
+ setSelected: y,
1541
+ setTitle: x
1542
+ },
1543
+ children: [/* @__PURE__ */ t("input", {
1544
+ ...r,
1545
+ type: "hidden",
1546
+ value: v,
1547
+ onInput: E,
1548
+ ref: m
1549
+ }), /* @__PURE__ */ n("div", {
1550
+ className: D.join(" "),
1551
+ ref: c,
1552
+ tabIndex: 1,
1553
+ onBlur: C,
1554
+ children: [/* @__PURE__ */ n("div", {
1555
+ className: Q.select,
1556
+ onClick: w,
1557
+ children: [/* @__PURE__ */ t("span", {
1558
+ className: vt("title", Q, "select"),
1559
+ children: b
1560
+ }), /* @__PURE__ */ t(gt, { className: vt("arrow", Q, "select") })]
1561
+ }), /* @__PURE__ */ t("ul", {
1562
+ className: vt("select-list", Q, "select"),
1563
+ children: e
1564
+ })]
1565
+ })]
1566
+ })
1567
+ });
1568
+ }), xt = ({ children: e, value: n, disabled: r, hidden: i, onClick: a, ...o }) => {
1569
+ let s = c(yt), u = (e) => {
1570
+ n === void 0 || r || (s.setSelect(n), typeof a == "function" && a(e));
1571
+ };
1572
+ if (l(() => {
1573
+ e && (n === s.selected || !s.emptyValue.current) && (s.setTitle(e), !s.emptyValue.current && n && s.setSelected(n), s.emptyValue.current = !0);
1574
+ }, [s.selected, s.emptyValue.current]), i) return null;
1575
+ let f = d(() => {
1576
+ let e = [vt("ui-select-option", Q, "select")];
1577
+ return e.push(Q.option), s.selected === n && e.push(Q.active, "active"), r && e.push(Q.disabled, "disabled"), e;
1578
+ }, [s.selected, r]);
1579
+ return /* @__PURE__ */ t("li", {
1580
+ ...o,
1581
+ onClick: u,
1582
+ className: f.join(" "),
1583
+ children: e
1584
+ });
1585
+ }, St = ({ children: e, label: r }) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n("ul", {
1586
+ className: Q.optgpoup,
1587
+ children: [r && /* @__PURE__ */ t("li", {
1588
+ className: Q.label,
1589
+ children: r
1590
+ }), e]
1591
+ }) }), Ct = {
1592
+ ...o(({ ...e }, n) => /* @__PURE__ */ t(bt, {
1593
+ ...e,
1594
+ ref: n
1595
+ })),
1596
+ Option: xt,
1597
+ Optgroup: St
1598
+ }, $ = {
1599
+ container: "style-module__container__3-2SP",
1600
+ hide: "style-module__hide__4ywHX",
1601
+ down: "style-module__down__STzsX",
1602
+ "dropdown-list": "style-module__dropdown-list__O27el",
1603
+ up: "style-module__up__PYaUD",
1604
+ left: "style-module__left__9XBs6",
1605
+ right: "style-module__right__Tvd1-",
1606
+ opened: "style-module__opened__GjGrB",
1607
+ arrow: "style-module__arrow__SCvqs",
1608
+ item: "style-module__item__v8SnZ"
1609
+ }, wt = ({ items: e, isOpen: n, enableRerenderItems: r, disabled: i }) => {
1610
+ let a = f(null), o = d(() => r ? n ? e : null : e, [
1611
+ r,
1612
+ e,
1613
+ n
1614
+ ]);
1615
+ return l(() => {
1616
+ a.current && (window.innerWidth, a.current.getBoundingClientRect().left);
1617
+ }, [n]), i ? null : /* @__PURE__ */ t("ul", {
1618
+ className: `${$["dropdown-list"]} ui-dropdown-list`,
1619
+ children: o,
1620
+ ref: a
1621
+ });
1622
+ }, Tt = a({ close: () => {} }), Et = ({ children: e, className: r, items: i, arrow: a = !0, direction: o = "down", position: s = "right", split: c = !1, disabled: u, hover: m = !1, enableRerenderItems: h = !0, onShow: g, onHide: _, ...v }) => {
1623
+ let y = f(null), b = f(null), [x, S] = p(!1), C = () => {
1624
+ S(!1);
1625
+ }, w = () => {
1626
+ S(!0);
1627
+ }, ee = () => {
1628
+ S((e) => u ? !1 : !e);
1629
+ }, T = () => {
1630
+ ee();
1631
+ }, E = () => {
1632
+ b.current || (!c || m) && ee();
1633
+ }, D = (e) => {
1634
+ e.currentTarget.contains(e.relatedTarget) || C();
1635
+ }, O = () => {
1636
+ !m || x || b.current || (b.current = setTimeout(w, 50));
1637
+ }, k = () => {
1638
+ b.current &&= (clearTimeout(b.current), null);
1639
+ };
1640
+ l(() => {
1641
+ let e = y.current, t = e?.classList;
1642
+ x ? (t?.add($.opened), e?.focus(), typeof g == "function" && g()) : (t?.remove($.opened), typeof _ == "function" && _());
1643
+ }, [x]);
1644
+ let A = d(() => {
1645
+ let e = ["ui-dropdown"];
1646
+ return e.push($.container), r && e.push(r), o && e.push($[o]), s && e.push($[s]), e.join(" ");
1647
+ }, [
1648
+ r,
1649
+ o,
1650
+ s
1651
+ ]);
1652
+ return /* @__PURE__ */ t(Tt.Provider, {
1653
+ value: { close: C },
1654
+ children: /* @__PURE__ */ n("div", {
1655
+ ...v,
1656
+ className: A,
1657
+ ref: y,
1658
+ onMouseEnter: O,
1659
+ onMouseLeave: k,
1660
+ tabIndex: 1,
1661
+ onBlur: D,
1662
+ children: [
1663
+ s === "left" && !u && /* @__PURE__ */ t(gt, {
1664
+ className: $.arrow,
1665
+ onClick: T
1666
+ }),
1667
+ /* @__PURE__ */ t("div", {
1668
+ onClick: E,
1669
+ className: "ui-dropdown-block" + (x ? " " + $.hide : ""),
1670
+ children: e
1671
+ }),
1672
+ s === "right" && !u && a && /* @__PURE__ */ t(gt, {
1673
+ className: $.arrow,
1674
+ onClick: T
1675
+ }),
1676
+ /* @__PURE__ */ t(wt, {
1677
+ isOpen: x,
1678
+ disabled: u,
1679
+ enableRerenderItems: h,
1680
+ items: i
1681
+ })
1682
+ ]
1683
+ })
1684
+ });
1685
+ }, Dt = ({ children: e, onClick: n, autoClose: r = !0, active: i, className: a, ...o }) => {
1686
+ let s = c(Tt), l = (e) => {
1687
+ typeof n == "function" && n(e), r && s.close();
1688
+ }, u = ["ui-dropdown-item"];
1689
+ return u.push($.item), i && u.push($.active, "active"), a && u.push(a), /* @__PURE__ */ t("li", {
1690
+ ...o,
1691
+ onClick: l,
1692
+ className: u.join(" "),
1693
+ children: typeof e == "function" ? e(s) : e
1694
+ });
1695
+ }, Ot = {
1696
+ ...o(({ ...e }, n) => /* @__PURE__ */ t(Et, { ...e })),
1697
+ Item: Dt
1698
+ }, kt = a({}), At = ({ children: e }) => /* @__PURE__ */ t(kt.Provider, {
1699
+ value: {},
1700
+ children: e
1701
+ });
1702
+ //#endregion
1703
+ export { lt as Button, mt as Checkbox, Ot as Dropdown, Dt as DropdownItem, X as Element, X as FormElement, ct as File, st as FileInput, rt as Form, it as Input, nt as Loading, v as Progress, At as Provider, Ct as Select, St as SelectOptgroup, xt as SelectOption, g as Spinner, at as TextArea, ft as UploadImages, tt as useForm };