@scbt-ecom/ui 0.46.1 → 0.46.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.
@@ -1,6 +1,6 @@
1
- import { z as d, p as g, i as N, f as T, D as L, s as D } from "./utils-SIizw_5C.js";
2
- import { T as _ } from "./typeGuards-yOWv7RXH.js";
3
- const S = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]+)$/, h = /^[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4}(?:\s+[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4})?$/i, I = {
1
+ import { z as o, p as f, i as N, f as T, D as L, s as D } from "./utils-SIizw_5C.js";
2
+ import { T as c } from "./typeGuards-yOWv7RXH.js";
3
+ const Z = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]+)$/, h = /^[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4}(?:\s+[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4})?$/i, I = {
4
4
  REQUIRED: "Поле обязательно к заполнению",
5
5
  MIN_LENGTH: "Минимальная длина символов должна быть не менее",
6
6
  MAX_LENGTH: "Максимальная длина символов должна быть не более",
@@ -13,58 +13,58 @@ const S = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
13
13
  FUTURE_DATE_NOT_ALLOWED: "Нельзя выбрать дату позже текущей",
14
14
  INVALID_URL: "Некорректная ссылка"
15
15
  }, P = (e) => {
16
- const t = e.trim().replace(/\s+/g, " ").split(" "), [o, s, ...i] = t, n = i == null ? void 0 : i.join(" ");
16
+ const t = e.trim().replace(/\s+/g, " ").split(" "), [d, s, ...n] = t, i = n == null ? void 0 : n.join(" ");
17
17
  return {
18
- surname: o,
18
+ surname: d,
19
19
  name: s,
20
- patronymic: n
20
+ patronymic: i
21
21
  };
22
- }, oe = d.string({ invalid_type_error: "Обязательно к заполнению", required_error: "Обязательно к заполнению" }).superRefine((e, t) => {
22
+ }, oe = o.string({ invalid_type_error: "Обязательно к заполнению", required_error: "Обязательно к заполнению" }).superRefine((e, t) => {
23
23
  e === "" && t.addIssue({
24
- code: d.ZodIssueCode.custom,
24
+ code: o.ZodIssueCode.custom,
25
25
  message: "Введите имя и фамилию"
26
- }), S.test(e) || t.addIssue({
27
- code: d.ZodIssueCode.custom,
26
+ }), Z.test(e) || t.addIssue({
27
+ code: o.ZodIssueCode.custom,
28
28
  message: "Должна быть только кириллица"
29
29
  });
30
- const { surname: o, name: s, patronymic: i } = P(e);
31
- (!o || !s) && t.addIssue({
32
- code: d.ZodIssueCode.custom,
30
+ const { surname: d, name: s, patronymic: n } = P(e);
31
+ (!d || !s) && t.addIssue({
32
+ code: o.ZodIssueCode.custom,
33
33
  message: "Введите имя и фамилию"
34
34
  }), A.test(s) || t.addIssue({
35
- code: d.ZodIssueCode.custom,
35
+ code: o.ZodIssueCode.custom,
36
36
  message: "Неверно введено имя"
37
- }), A.test(o) || t.addIssue({
38
- code: d.ZodIssueCode.custom,
37
+ }), A.test(d) || t.addIssue({
38
+ code: o.ZodIssueCode.custom,
39
39
  message: "Неверно введена фамилия"
40
- }), i && (h.test(i) || t.addIssue({
41
- code: d.ZodIssueCode.custom,
40
+ }), n && (h.test(n) || t.addIssue({
41
+ code: o.ZodIssueCode.custom,
42
42
  message: "Неверно введено отчество"
43
43
  }));
44
- }), ae = d.string().length(10, { message: I.INVALID_DATE }).superRefine((e, t) => {
45
- const [o, s, i] = (e == null ? void 0 : e.split(".")) ?? "", n = g(`${o}/${s}/${i}`, "dd/MM/yyyy", /* @__PURE__ */ new Date());
46
- +i <= 1950 && t.addIssue({
47
- code: d.ZodIssueCode.custom,
44
+ }), ae = o.string().length(10, { message: I.INVALID_DATE }).superRefine((e, t) => {
45
+ const [d, s, n] = (e == null ? void 0 : e.split(".")) ?? "", i = f(`${d}/${s}/${n}`, "dd/MM/yyyy", /* @__PURE__ */ new Date());
46
+ +n <= 1950 && t.addIssue({
47
+ code: o.ZodIssueCode.custom,
48
48
  message: I.INVALID_DATE
49
- }), N(n) || t.addIssue({
50
- code: d.ZodIssueCode.custom,
49
+ }), N(i) || t.addIssue({
50
+ code: o.ZodIssueCode.custom,
51
51
  message: I.INVALID_DATE
52
- }), (/* @__PURE__ */ new Date()).getTime() < new Date(n).getTime() && t.addIssue({
53
- code: d.ZodIssueCode.custom,
52
+ }), (/* @__PURE__ */ new Date()).getTime() < new Date(i).getTime() && t.addIssue({
53
+ code: o.ZodIssueCode.custom,
54
54
  message: I.FUTURE_DATE_NOT_ALLOWED
55
55
  });
56
- }), re = d.string().superRefine((e, t) => {
57
- const o = e.charAt(0);
58
- ["3", "4", "5", "6", "9"].includes(o) || t.addIssue({
59
- code: d.ZodIssueCode.custom,
56
+ }), re = o.string().superRefine((e, t) => {
57
+ const d = e.charAt(0);
58
+ ["3", "4", "5", "6", "9"].includes(d) || t.addIssue({
59
+ code: o.ZodIssueCode.custom,
60
60
  message: "Код города/оператора должен начинаться с цифры 3, 4, 5, 6 или 9"
61
61
  }), e.length !== 10 && t.addIssue({
62
- code: d.ZodIssueCode.custom,
62
+ code: o.ZodIssueCode.custom,
63
63
  message: "Введите номер телефона полностью"
64
64
  });
65
- }).transform((e) => `7${e}`), ue = d.coerce.number().min(1e3, `${I.FIX_LENGTH} 4`).max(9999, `${I.FIX_LENGTH} 4`).nullable().superRefine((e, t) => {
65
+ }).transform((e) => `7${e}`), ue = o.coerce.number().min(1e3, `${I.FIX_LENGTH} 4`).max(9999, `${I.FIX_LENGTH} 4`).nullable().superRefine((e, t) => {
66
66
  e === null && t.addIssue({
67
- code: d.ZodIssueCode.invalid_type,
67
+ code: o.ZodIssueCode.invalid_type,
68
68
  expected: "number",
69
69
  received: "null",
70
70
  message: `${I.FIX_LENGTH} 4`
@@ -88,94 +88,94 @@ const S = /^[\u0400-\u04FF\u00CB\u00EB -]+$/, A = /^(?:[^-]+(?:-[^-]+){0,4}|[^-]
88
88
  DATE_NON_EMPTY: () => "Укажите дату",
89
89
  VALUE_OUT_OF_RANGE: (e) => `Выберите один из вариантов ${e.join(", ")}`,
90
90
  DATE_MIN: (e) => {
91
- const t = _.isString(e) ? new Date(e) : e;
91
+ const t = c.isString(e) ? new Date(e) : e;
92
92
  return `Выбранная дата должна быть не раньше ${T(t)}`;
93
93
  },
94
94
  DATE_MAX: (e) => {
95
- const t = _.isString(e) ? new Date(e) : e;
95
+ const t = c.isString(e) ? new Date(e) : e;
96
96
  return `Выбранная дата должна быть не позже ${T(t)}`;
97
97
  },
98
98
  INVALID_URL: () => "Ссылка введена некорректно. Пример: https://example.com, example.com"
99
99
  }, V = (e) => {
100
- const { iso: t = !0, pattern: o = L, min: s, max: i, message: n } = e || {};
101
- return d.string().min(8, (n == null ? void 0 : n.min) || r.DATE_NON_EMPTY()).superRefine((u, a) => {
102
- const l = o.replace(/\W/g, "").length;
100
+ const { iso: t = !0, pattern: d = L, min: s, max: n, message: i } = e || {};
101
+ return o.string().min(8, (i == null ? void 0 : i.min) || r.DATE_NON_EMPTY()).superRefine((u, a) => {
102
+ const l = d.replace(/\W/g, "").length;
103
103
  if (u.replace(/[._-]/g, "").length < l && a.addIssue({
104
- code: d.ZodIssueCode.too_small,
104
+ code: o.ZodIssueCode.too_small,
105
105
  minimum: l,
106
106
  type: "date",
107
107
  inclusive: !0,
108
- message: (n == null ? void 0 : n.min) || r.DATE_NON_EMPTY()
108
+ message: (i == null ? void 0 : i.min) || r.DATE_NON_EMPTY()
109
109
  }), t) {
110
- let c = null;
110
+ let _ = null;
111
111
  try {
112
- c = new Date(u);
112
+ _ = new Date(u);
113
113
  } catch {
114
114
  a.addIssue({
115
- code: d.ZodIssueCode.invalid_date,
116
- message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
115
+ code: o.ZodIssueCode.invalid_date,
116
+ message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
117
117
  });
118
118
  }
119
- s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
120
- code: d.ZodIssueCode.invalid_date,
121
- message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
122
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
123
- code: d.ZodIssueCode.invalid_date,
124
- message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
119
+ s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
120
+ code: o.ZodIssueCode.invalid_date,
121
+ message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
122
+ }), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && a.addIssue({
123
+ code: o.ZodIssueCode.invalid_date,
124
+ message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
125
125
  });
126
126
  } else {
127
- const c = g(u, o, /* @__PURE__ */ new Date());
128
- N(c) || a.addIssue({
129
- code: d.ZodIssueCode.invalid_date,
130
- message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
131
- }), s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
132
- code: d.ZodIssueCode.invalid_date,
133
- message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
134
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
135
- code: d.ZodIssueCode.invalid_date,
136
- message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
127
+ const _ = f(u, d, /* @__PURE__ */ new Date());
128
+ N(_) || a.addIssue({
129
+ code: o.ZodIssueCode.invalid_date,
130
+ message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
131
+ }), s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
132
+ code: o.ZodIssueCode.invalid_date,
133
+ message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
134
+ }), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && a.addIssue({
135
+ code: o.ZodIssueCode.invalid_date,
136
+ message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
137
137
  });
138
138
  }
139
139
  }).default("");
140
140
  }, y = (e) => {
141
- const { iso: t = !0, pattern: o = L, min: s, max: i, message: n } = e || {};
142
- return d.string().transform((u) => u || void 0).superRefine((u, a) => {
143
- if (_.isString(u) && u.length) {
144
- const l = o.replace(/\W/g, "").length;
141
+ const { iso: t = !0, pattern: d = L, min: s, max: n, message: i } = e || {};
142
+ return o.string().transform((u) => u || void 0).superRefine((u, a) => {
143
+ if (c.isString(u) && u.length) {
144
+ const l = d.replace(/\W/g, "").length;
145
145
  if (u.replace(/[._-]/g, "").length < l && a.addIssue({
146
- code: d.ZodIssueCode.too_small,
146
+ code: o.ZodIssueCode.too_small,
147
147
  minimum: l,
148
148
  type: "date",
149
149
  inclusive: !0,
150
- message: (n == null ? void 0 : n.min) || r.DATE_NON_EMPTY()
150
+ message: (i == null ? void 0 : i.min) || r.DATE_NON_EMPTY()
151
151
  }), t) {
152
- let c = null;
152
+ let _ = null;
153
153
  try {
154
- c = new Date(u);
154
+ _ = new Date(u);
155
155
  } catch {
156
156
  a.addIssue({
157
- code: d.ZodIssueCode.invalid_date,
158
- message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
157
+ code: o.ZodIssueCode.invalid_date,
158
+ message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
159
159
  });
160
160
  }
161
- s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
162
- code: d.ZodIssueCode.invalid_date,
163
- message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
164
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
165
- code: d.ZodIssueCode.invalid_date,
166
- message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
161
+ s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
162
+ code: o.ZodIssueCode.invalid_date,
163
+ message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
164
+ }), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && a.addIssue({
165
+ code: o.ZodIssueCode.invalid_date,
166
+ message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
167
167
  });
168
168
  } else {
169
- const c = g(u, o, /* @__PURE__ */ new Date());
170
- N(c) || a.addIssue({
171
- code: d.ZodIssueCode.invalid_date,
172
- message: (n == null ? void 0 : n.invalidDate) || r.DATE_INVALID_FORMAT()
173
- }), s && c.getTime() < (_.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
174
- code: d.ZodIssueCode.invalid_date,
175
- message: (n == null ? void 0 : n.min) || r.DATE_MIN(s)
176
- }), i && c.getTime() > (_.isString(i) ? new Date(i).getTime() : i.getTime()) && a.addIssue({
177
- code: d.ZodIssueCode.invalid_date,
178
- message: (n == null ? void 0 : n.max) || r.DATE_MAX(i)
169
+ const _ = f(u, d, /* @__PURE__ */ new Date());
170
+ N(_) || a.addIssue({
171
+ code: o.ZodIssueCode.invalid_date,
172
+ message: (i == null ? void 0 : i.invalidDate) || r.DATE_INVALID_FORMAT()
173
+ }), s && _.getTime() < (c.isString(s) ? new Date(s).getTime() : s.getTime()) && a.addIssue({
174
+ code: o.ZodIssueCode.invalid_date,
175
+ message: (i == null ? void 0 : i.min) || r.DATE_MIN(s)
176
+ }), n && _.getTime() > (c.isString(n) ? new Date(n).getTime() : n.getTime()) && a.addIssue({
177
+ code: o.ZodIssueCode.invalid_date,
178
+ message: (i == null ? void 0 : i.max) || r.DATE_MAX(n)
179
179
  });
180
180
  }
181
181
  }
@@ -186,132 +186,132 @@ function H(e) {
186
186
  return t ? V(e) : y(e);
187
187
  }
188
188
  const M = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/g, U = (e) => {
189
- const { message: t, regexp: o = M } = e || {};
190
- return d.string().min(1, (t == null ? void 0 : t.min) || r.EMAIL_NON_EMPTY()).regex(o, (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()).default("");
189
+ const { message: t, regexp: d = M } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
190
+ return o.string().min(1, (t == null ? void 0 : t.min) || r.EMAIL_NON_EMPTY()).regex(s, (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()).default("");
191
191
  }, Y = (e) => {
192
- const { message: t, regexp: o = M } = e || {};
193
- return d.string().refine(
194
- (s) => _.isStringEmpty(s) ? !0 : o.test(s),
192
+ const { message: t, regexp: d = M } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
193
+ return o.string().refine(
194
+ (n) => c.isStringEmpty(n) ? !0 : s.test(n),
195
195
  {
196
196
  message: (t == null ? void 0 : t.invalid) || r.EMAIL_INVALID()
197
197
  }
198
- ).optional().transform((s) => (s == null ? void 0 : s.length) === 0 ? void 0 : s);
198
+ ).optional().transform((n) => (n == null ? void 0 : n.length) === 0 ? void 0 : n);
199
199
  };
200
- function F(e) {
200
+ function w(e) {
201
201
  const { required: t = !0 } = e || {};
202
202
  return t ? U(e) : Y(e);
203
203
  }
204
204
  const O = (e) => {
205
- const { min: t, max: o, message: s } = e || {};
206
- let i = d.coerce.number();
207
- return t && (i = i.min(t, (s == null ? void 0 : s.min) || r.MIN_VALUE(t))), o && (i = i.max(o, (s == null ? void 0 : s.min) || r.MAX_VALUE(o))), i.default(0);
208
- }, G = (e) => O(e).optional().transform((t) => t || void 0);
209
- function w(e) {
205
+ const { min: t, max: d, message: s } = e || {};
206
+ let n = o.coerce.number();
207
+ return t && (n = n.min(t, (s == null ? void 0 : s.min) || r.MIN_VALUE(t))), d && (n = n.max(d, (s == null ? void 0 : s.min) || r.MAX_VALUE(d))), n.default(0);
208
+ }, F = (e) => O(e).optional().transform((t) => t || void 0);
209
+ function G(e) {
210
210
  const { required: t = !0 } = e || {};
211
- return t ? O(e) : G(e);
211
+ return t ? O(e) : F(e);
212
212
  }
213
213
  const X = (e) => {
214
- const { ignoreMask: t = !0, maskSymbols: o = /[()+_ -]/g, message: s } = e || {};
215
- let i = d.string().superRefine((n, u) => {
216
- const a = n.replace(o, ""), l = a.charAt(1);
217
- ["3", "4", "5", "6", "7", "9"].includes(l) || u.addIssue({
218
- code: d.ZodIssueCode.invalid_string,
214
+ const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n = c.isString(d) ? new RegExp(d) : d;
215
+ let i = o.string().superRefine((u, a) => {
216
+ const l = u.replace(n, ""), E = l.charAt(1);
217
+ ["3", "4", "5", "6", "7", "9"].includes(E) || a.addIssue({
218
+ code: o.ZodIssueCode.invalid_string,
219
219
  validation: "regex",
220
220
  message: (s == null ? void 0 : s.invalidOperator) || r.PHONE_INVALID_OPERATOR()
221
- }), a.length < 11 && u.addIssue({
222
- code: d.ZodIssueCode.too_small,
221
+ }), l.length < 11 && a.addIssue({
222
+ code: o.ZodIssueCode.too_small,
223
223
  minimum: 11,
224
224
  inclusive: !0,
225
225
  type: "string",
226
226
  message: (s == null ? void 0 : s.min) || r.PHONE_NON_EMPTY()
227
227
  });
228
228
  });
229
- return t && (i = i.transform((n) => n.replace(o, ""))), i.default("");
229
+ return t && (i = i.transform((u) => u.replace(n, ""))), i.default("");
230
230
  }, $ = (e) => {
231
- const { ignoreMask: t = !0, maskSymbols: o = /[()+_ -]/g, message: s } = e || {};
232
- let i = d.string().superRefine((n, u) => {
233
- const a = n.replace(o, ""), l = a.charAt(1);
234
- ["3", "4", "5", "6", "7", "9"].includes(l) || u.addIssue({
235
- code: d.ZodIssueCode.invalid_string,
231
+ const { ignoreMask: t = !0, maskSymbols: d = /[()+_ -]/g, message: s } = e || {}, n = c.isString(d) ? new RegExp(d) : d;
232
+ let i = o.string().superRefine((u, a) => {
233
+ const l = u.replace(n, ""), E = l.charAt(1);
234
+ ["3", "4", "5", "6", "7", "9"].includes(E) || a.addIssue({
235
+ code: o.ZodIssueCode.invalid_string,
236
236
  validation: "regex",
237
237
  message: (s == null ? void 0 : s.invalidOperator) || r.PHONE_INVALID_OPERATOR()
238
- }), a.length < 11 && u.addIssue({
239
- code: d.ZodIssueCode.too_small,
238
+ }), l.length < 11 && a.addIssue({
239
+ code: o.ZodIssueCode.too_small,
240
240
  minimum: 11,
241
241
  inclusive: !0,
242
242
  type: "string",
243
243
  message: (s == null ? void 0 : s.min) || r.PHONE_NON_EMPTY()
244
244
  });
245
245
  });
246
- return t && (i = i.transform((n) => n.replace(o, ""))), i.transform((n) => n || void 0);
246
+ return t && (i = i.transform((u) => u.replace(n, ""))), i.transform((u) => u || void 0);
247
247
  };
248
- function b(e) {
248
+ function x(e) {
249
249
  const { required: t = !0 } = e || {};
250
250
  return t ? X(e) : $(e);
251
251
  }
252
- const q = (e) => {
253
- var s, i;
254
- const { message: t } = e || {}, o = d.string().min(1, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).nullable().refine((n) => !!n, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).default(null);
252
+ const b = (e) => {
253
+ var s, n;
254
+ const { message: t } = e || {}, d = o.string().min(1, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).nullable().refine((i) => !!i, (t == null ? void 0 : t.single) || r.SELECT_NON_EMPTY()).default(null);
255
255
  if (e != null && e.multiple) {
256
- let n = d.array(o).min((e == null ? void 0 : e.minLength) || 0, (t == null ? void 0 : t.multiple) || r.SELECT_MULTIPLE_MIN_LENGTH((e == null ? void 0 : e.minLength) || 0));
257
- return e != null && e.length ? n.length(e.length, ((s = e.message) == null ? void 0 : s.length) || r.SELECT_FIX_LENGTH(e.length)).default([]) : (e != null && e.maxLength && (n = n.max(
256
+ let i = o.array(d).min((e == null ? void 0 : e.minLength) || 0, (t == null ? void 0 : t.multiple) || r.SELECT_MULTIPLE_MIN_LENGTH((e == null ? void 0 : e.minLength) || 0));
257
+ return e != null && e.length ? i.length(e.length, ((s = e.message) == null ? void 0 : s.length) || r.SELECT_FIX_LENGTH(e.length)).default([]) : (e != null && e.maxLength && (i = i.max(
258
258
  e.maxLength,
259
- ((i = e.message) == null ? void 0 : i.maxLength) || r.SELECT_MULTIPLE_MAX_LENGTH(e.maxLength)
260
- )), n.default([]));
259
+ ((n = e.message) == null ? void 0 : n.maxLength) || r.SELECT_MULTIPLE_MAX_LENGTH(e.maxLength)
260
+ )), i.default([]));
261
261
  }
262
- return o;
262
+ return d;
263
263
  };
264
- function v(e) {
265
- const t = d.string().nullable().optional();
266
- return e != null && e.multiple ? d.array(t).optional() : t;
264
+ function q(e) {
265
+ const t = o.string().nullable().optional();
266
+ return e != null && e.multiple ? o.array(t).optional() : t;
267
267
  }
268
- function x(e) {
268
+ function v(e) {
269
269
  const { required: t = !0 } = e || {};
270
- return t ? q(e) : v(e);
270
+ return t ? b(e) : q(e);
271
271
  }
272
272
  const z = (e) => {
273
- const { min: t, max: o, length: s, message: i } = e || {};
274
- let n = d.string({ message: i == null ? void 0 : i.root });
275
- return t && (n = n.min(t, { message: (i == null ? void 0 : i.min) || r.MIN_LENGTH(t) })), o && (n = n.max(o, { message: (i == null ? void 0 : i.max) || r.MAX_LENGTH(o) })), s && (n = n.length(s, { message: (i == null ? void 0 : i.length) || r.FIX_LENGTH(s) })), n.refine((u) => !!u.length, { message: (i == null ? void 0 : i.min) || r.NON_EMPTY() }).default("");
276
- }, B = (e) => {
277
- const { min: t, max: o, length: s, message: i } = e || {};
278
- let n = d.string({ message: i == null ? void 0 : i.root });
279
- return t && (n = n.min(t, { message: (i == null ? void 0 : i.min) || r.MIN_LENGTH(t) })), o && (n = n.max(o, { message: (i == null ? void 0 : i.max) || r.MAX_LENGTH(o) })), s && (n = n.length(s, { message: (i == null ? void 0 : i.length) || r.FIX_LENGTH(s) })), n.optional().transform((u) => u != null && u.length ? u : void 0);
273
+ const { min: t, max: d, length: s, message: n } = e || {};
274
+ let i = o.string({ message: n == null ? void 0 : n.root });
275
+ return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) || r.MIN_LENGTH(t) })), d && (i = i.max(d, { message: (n == null ? void 0 : n.max) || r.MAX_LENGTH(d) })), s && (i = i.length(s, { message: (n == null ? void 0 : n.length) || r.FIX_LENGTH(s) })), i.refine((u) => !!u.length, { message: (n == null ? void 0 : n.min) || r.NON_EMPTY() }).default("");
276
+ }, p = (e) => {
277
+ const { min: t, max: d, length: s, message: n } = e || {};
278
+ let i = o.string({ message: n == null ? void 0 : n.root });
279
+ return t && (i = i.min(t, { message: (n == null ? void 0 : n.min) || r.MIN_LENGTH(t) })), d && (i = i.max(d, { message: (n == null ? void 0 : n.max) || r.MAX_LENGTH(d) })), s && (i = i.length(s, { message: (n == null ? void 0 : n.length) || r.FIX_LENGTH(s) })), i.optional().transform((u) => u != null && u.length ? u : void 0);
280
280
  };
281
- function j(e) {
282
- const { required: t = !0, ...o } = e || {};
283
- return t ? z(o) : B(o);
281
+ function B(e) {
282
+ const { required: t = !0, ...d } = e || {};
283
+ return t ? z(d) : p(d);
284
284
  }
285
285
  const C = (e, t) => {
286
- const { message: o, ...s } = t || {}, [i, n, ...u] = e.map((l) => d.literal(l)), a = o ? typeof o == "function" ? o(e) : o : r.VALUE_OUT_OF_RANGE(e);
287
- return d.union([i, n, ...u], {
286
+ const { message: d, ...s } = t || {}, [n, i, ...u] = e.map((l) => o.literal(l)), a = d ? typeof d == "function" ? d(e) : d : r.VALUE_OUT_OF_RANGE(e);
287
+ return o.union([n, i, ...u], {
288
288
  message: a,
289
289
  ...s
290
290
  }).nullable().refine(Boolean, r.NON_EMPTY()).default(null);
291
- }, p = (e, t) => C(e, t).optional();
292
- function W(e, t) {
293
- const { required: o, ...s } = t || {};
294
- return o ? C(e, s) : p(e, s);
291
+ }, k = (e, t) => C(e, t).optional();
292
+ function j(e, t) {
293
+ const { required: d, ...s } = t || {};
294
+ return d ? C(e, s) : k(e, s);
295
295
  }
296
- const Z = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, k = (e) => {
297
- const { message: t, regexp: o = Z } = e || {};
298
- return D().min(1, (t == null ? void 0 : t.min) || r.NON_EMPTY()).regex(o, (t == null ? void 0 : t.invalid) || r.INVALID_URL()).default("");
296
+ const R = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/, W = (e) => {
297
+ const { message: t, regexp: d = R } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
298
+ return D().min(1, (t == null ? void 0 : t.min) || r.NON_EMPTY()).regex(s, (t == null ? void 0 : t.invalid) || r.INVALID_URL()).default("");
299
299
  }, K = (e) => {
300
- const { message: t, regexp: o = Z } = e || {};
301
- return D().refine((s) => _.isStringEmpty(s) ? !0 : o.test(s), (t == null ? void 0 : t.invalid) || r.INVALID_URL()).optional().transform((s) => s != null && s.length ? s : void 0);
300
+ const { message: t, regexp: d = R } = e || {}, s = c.isString(d) ? new RegExp(d) : d;
301
+ return D().refine((n) => c.isStringEmpty(n) ? !0 : s.test(n), (t == null ? void 0 : t.invalid) || r.INVALID_URL()).optional().transform((n) => n != null && n.length ? n : void 0);
302
302
  };
303
303
  function Q(e) {
304
304
  const { required: t = !0 } = e || {};
305
- return t ? k(e) : K(e);
305
+ return t ? W(e) : K(e);
306
306
  }
307
307
  const J = {
308
- getStringSchema: j,
309
- getEmailSchema: F,
310
- getSelectSchema: x,
311
- getNumberSchema: w,
312
- getPhoneSchema: b,
308
+ getStringSchema: B,
309
+ getEmailSchema: w,
310
+ getSelectSchema: v,
311
+ getNumberSchema: G,
312
+ getPhoneSchema: x,
313
313
  getDateSchema: H,
314
- getUnionSchema: W,
314
+ getUnionSchema: j,
315
315
  getUrlSchema: Q
316
316
  };
317
317
  class ce {
@@ -345,46 +345,46 @@ class ce {
345
345
  * // }
346
346
  * // }
347
347
  */
348
- static getZodDefaults(t, o) {
349
- const { fillArrayWithValue: s } = o || {};
350
- if (t instanceof d.ZodEffects)
351
- return t.innerType() instanceof d.ZodEffects ? this.getZodDefaults(t.innerType(), o) : this.getZodDefaults(d.ZodObject.create(t.innerType().shape), o);
352
- const i = (a) => {
348
+ static getZodDefaults(t, d) {
349
+ const { fillArrayWithValue: s } = d || {};
350
+ if (t instanceof o.ZodEffects)
351
+ return t.innerType() instanceof o.ZodEffects ? this.getZodDefaults(t.innerType(), d) : this.getZodDefaults(o.ZodObject.create(t.innerType().shape), d);
352
+ const n = (a) => {
353
353
  switch (!0) {
354
- case a instanceof d.ZodDefault:
354
+ case a instanceof o.ZodDefault:
355
355
  return a._def.defaultValue();
356
- case a instanceof d.ZodOptional:
356
+ case a instanceof o.ZodOptional:
357
357
  return;
358
- case a instanceof d.ZodNullable:
358
+ case a instanceof o.ZodNullable:
359
359
  return null;
360
- case a instanceof d.ZodArray:
361
- return s ? [i(a.element)] : [];
362
- case a instanceof d.ZodObject:
363
- return this.getZodDefaults(a, o);
364
- case a instanceof d.ZodUnion:
365
- return i(a._def.options[0]);
366
- case a instanceof d.ZodLiteral:
360
+ case a instanceof o.ZodArray:
361
+ return s ? [n(a.element)] : [];
362
+ case a instanceof o.ZodObject:
363
+ return this.getZodDefaults(a, d);
364
+ case a instanceof o.ZodUnion:
365
+ return n(a._def.options[0]);
366
+ case a instanceof o.ZodLiteral:
367
367
  return a._def.value;
368
- case a instanceof d.ZodEnum:
368
+ case a instanceof o.ZodEnum:
369
369
  return a._def.values[0];
370
- case a instanceof d.ZodString:
370
+ case a instanceof o.ZodString:
371
371
  return "";
372
- case a instanceof d.ZodNumber:
372
+ case a instanceof o.ZodNumber:
373
373
  return 0;
374
- case a instanceof d.ZodBoolean:
374
+ case a instanceof o.ZodBoolean:
375
375
  return !1;
376
376
  case !("innerType" in a._def):
377
377
  return;
378
378
  default:
379
- return i(a._def.innerType);
379
+ return n(a._def.innerType);
380
380
  }
381
- }, n = {};
381
+ }, i = {};
382
382
  return Object.entries(t.shape).map(([a, l]) => {
383
- n[a] = i(l);
384
- }), n;
383
+ i[a] = n(l);
384
+ }), i;
385
385
  }
386
386
  }
387
- const E = {
387
+ const g = {
388
388
  NON_EMPTY: () => "Поле обязательно для заполнения",
389
389
  VALUE_NO_WHITESPACE: () => "Укажите фамилию, имя и отчество через пробел",
390
390
  ONLY_CYRILLIC: () => "Данные должны быть написаны кириллицей",
@@ -392,43 +392,43 @@ const E = {
392
392
  INVALID_NAME: () => "Неверно введено имя",
393
393
  INVALID_SURNAME: () => "Неверно введена фамилия",
394
394
  INVALID_PATRONYMIC: () => "Неверно введено отчество"
395
- }, f = {
395
+ }, m = {
396
396
  ONLY_CYRILLIC: /[\u0400-\u04FF\u00CB\u00EB -]/g,
397
397
  CHECK_HYPHEN: /^(?:[^-]+(?:-[^-]+){0,4}|[^-]+)$/,
398
398
  PATRONYMIC: /^[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4}(?:\s+[a-zA-Zа-яА-ЯёЁ]+(?:\s*-\s*[a-zA-Zа-яА-ЯёЁ]+){0,4})?$/i
399
399
  }, ee = (e) => {
400
- const [t, o, ...s] = e.trim().replace(/\s+/g, " ").split(" "), i = s.join(" ");
401
- return { surname: t, name: o, patronymic: i };
402
- }, R = (e) => {
403
- const { message: t } = e || {}, { nameOrSurnameEmpty: o, invalidSurname: s, invalidPatronymic: i, invalidName: n } = t || {};
404
- return d.string().superRefine((u, a) => {
405
- const { name: l, surname: m, patronymic: c } = ee(u);
406
- f.ONLY_CYRILLIC.test(u) || a.addIssue({
407
- code: d.ZodIssueCode.invalid_string,
400
+ const [t, d, ...s] = e.trim().replace(/\s+/g, " ").split(" "), n = s.join(" ");
401
+ return { surname: t, name: d, patronymic: n };
402
+ }, S = (e) => {
403
+ const { message: t } = e || {}, { nameOrSurnameEmpty: d, invalidSurname: s, invalidPatronymic: n, invalidName: i } = t || {};
404
+ return o.string().superRefine((u, a) => {
405
+ const { name: l, surname: E, patronymic: _ } = ee(u);
406
+ m.ONLY_CYRILLIC.test(u) || a.addIssue({
407
+ code: o.ZodIssueCode.invalid_string,
408
408
  validation: "regex",
409
- message: E.ONLY_CYRILLIC()
410
- }), (!l || !m) && a.addIssue({
411
- code: d.ZodIssueCode.invalid_string,
409
+ message: g.ONLY_CYRILLIC()
410
+ }), (!l || !E) && a.addIssue({
411
+ code: o.ZodIssueCode.invalid_string,
412
412
  validation: "regex",
413
- message: o || E.NAME_OR_SURNAME_NON_EMPTY()
414
- }), f.CHECK_HYPHEN.test(l) || a.addIssue({
415
- code: d.ZodIssueCode.invalid_string,
413
+ message: d || g.NAME_OR_SURNAME_NON_EMPTY()
414
+ }), m.CHECK_HYPHEN.test(l) || a.addIssue({
415
+ code: o.ZodIssueCode.invalid_string,
416
416
  validation: "regex",
417
- message: n || E.INVALID_NAME()
418
- }), f.CHECK_HYPHEN.test(m) || a.addIssue({
419
- code: d.ZodIssueCode.invalid_string,
417
+ message: i || g.INVALID_NAME()
418
+ }), m.CHECK_HYPHEN.test(E) || a.addIssue({
419
+ code: o.ZodIssueCode.invalid_string,
420
420
  validation: "regex",
421
- message: s || E.INVALID_SURNAME()
422
- }), c && (f.PATRONYMIC.test(c) || a.addIssue({
423
- code: d.ZodIssueCode.invalid_string,
421
+ message: s || g.INVALID_SURNAME()
422
+ }), _ && (m.PATRONYMIC.test(_) || a.addIssue({
423
+ code: o.ZodIssueCode.invalid_string,
424
424
  validation: "regex",
425
- message: i || E.INVALID_PATRONYMIC()
425
+ message: n || g.INVALID_PATRONYMIC()
426
426
  }));
427
427
  }).transform((u) => u.trimEnd()).default("");
428
- }, te = (e) => R(e).optional().transform((t) => t != null && t.length ? t : void 0);
428
+ }, te = (e) => S(e).optional().transform((t) => t != null && t.length ? t : void 0);
429
429
  function ne(e) {
430
- const { required: t = !0, ...o } = e || {};
431
- return t ? R(o) : te(o);
430
+ const { required: t = !0, ...d } = e || {};
431
+ return t ? S(d) : te(d);
432
432
  }
433
433
  const ie = {
434
434
  getFioSchema: ne
@@ -439,7 +439,7 @@ const ie = {
439
439
  export {
440
440
  A as RgxCheckForHyphen,
441
441
  h as RgxPatronymic,
442
- S as RgxUnicode,
442
+ Z as RgxUnicode,
443
443
  I as VALIDATION_MESSAGES,
444
444
  ce as ZodUtils,
445
445
  r as baseDefaultMessages,