@nice2dev/ui 1.0.30 → 1.1.5

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 (126) hide show
  1. package/CHANGELOG.md +848 -0
  2. package/README.md +30 -31
  3. package/dist/NiceCalendarScheduler.doc-BEtQkZjV.cjs +9 -0
  4. package/dist/NiceCalendarScheduler.doc-D__LRgOx.js +33 -0
  5. package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
  6. package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
  7. package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
  8. package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
  9. package/dist/NiceConfirmDialog-B57cl_F7.cjs +1 -0
  10. package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
  11. package/dist/NiceConfirmDialog-N9fBTLYm.js +81 -0
  12. package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
  13. package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
  14. package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
  15. package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
  16. package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
  17. package/dist/NiceDrawingCanvas.doc-Dv5vB4gY.js +32 -0
  18. package/dist/NiceDrawingCanvas.doc-Ww9zz17x.cjs +8 -0
  19. package/dist/NiceErrorBoundary-BD-uqk_q.js +709 -0
  20. package/dist/NiceErrorBoundary-CIPXaYik.cjs +1 -0
  21. package/dist/NiceFileManagerViews.doc-CKlnm6cX.cjs +1 -0
  22. package/dist/NiceFileManagerViews.doc-Cg21DArG.js +25 -0
  23. package/dist/NiceForm-BNZB31Pg.js +4499 -0
  24. package/dist/NiceForm-C6F0HvrX.cjs +1 -0
  25. package/dist/NiceForm-CCyfWgIs.js +4805 -0
  26. package/dist/NiceForm-CPyAXxBO.cjs +1 -0
  27. package/dist/NiceGantt-CSFLZD2y.js +328 -0
  28. package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
  29. package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
  30. package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
  31. package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
  32. package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
  33. package/dist/NiceMegaMenu.doc-7UyOCd3l.cjs +7 -0
  34. package/dist/NiceMegaMenu.doc-zeIyVa65.js +31 -0
  35. package/dist/NiceMention-CWoLD0SE.js +11082 -0
  36. package/dist/NiceMention-J1lUDLhg.cjs +430 -0
  37. package/dist/NiceMention.css +1 -0
  38. package/dist/NiceModal-0UxviEYE.cjs +1 -0
  39. package/dist/NiceModal-Bj53SKLI.js +95 -0
  40. package/dist/NiceModal-D-iOonog.js +95 -0
  41. package/dist/NiceModal-DC0UlQhc.cjs +1 -0
  42. package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
  43. package/dist/NiceModuleLifecyclePanel-BBOg9g0b.cjs +1 -0
  44. package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
  45. package/dist/NiceModuleLifecyclePanel-DtuXRiLR.js +6991 -0
  46. package/dist/NiceModuleLifecyclePanel.css +1 -1
  47. package/dist/NicePagination-Bjxy9aEc.js +172 -0
  48. package/dist/NicePagination-CPn-Q1h_.js +172 -0
  49. package/dist/NicePagination-CfFfNwrg.cjs +1 -0
  50. package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
  51. package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
  52. package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
  53. package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
  54. package/dist/NiceSavedQueryPanel-CH5c3rUG.js +6988 -0
  55. package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
  56. package/dist/NiceSavedQueryPanel-aQrEmmcC.cjs +596 -0
  57. package/dist/NiceScannerControl-Cd5KXJA9.js +12769 -0
  58. package/dist/NiceScannerControl-DZsERSw_.cjs +698 -0
  59. package/dist/NiceScannerControl.css +1 -0
  60. package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
  61. package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
  62. package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
  63. package/dist/NiceSelect-DHowflmX.js +433 -0
  64. package/dist/NiceWindow-BoDzlGk-.js +1621 -0
  65. package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
  66. package/dist/NiceWindow-DgONWxBm.cjs +1 -0
  67. package/dist/NiceWindow-xnTSHdHv.js +1623 -0
  68. package/dist/charts-B-sl1V9y.cjs +882 -0
  69. package/dist/charts-Bs0aDM0X.js +4671 -0
  70. package/dist/charts-DO2z6Ziu.js +31920 -0
  71. package/dist/charts-DjjKkw0q.cjs +761 -0
  72. package/dist/charts.cjs +1 -1
  73. package/dist/charts.mjs +7 -7
  74. package/dist/core-BUsZ7_vI.js +27914 -0
  75. package/dist/core-C2KhqEaU.cjs +1 -0
  76. package/dist/core-CLfcCDKc.cjs +122 -0
  77. package/dist/core-K2DIxXLn.js +795 -0
  78. package/dist/data-branching-D7l_kILW.cjs +1 -0
  79. package/dist/data-branching-DC6hcBQN.cjs +1 -0
  80. package/dist/data-branching-DykdTpjJ.js +6255 -0
  81. package/dist/data-branching-lJ07lDN-.js +6255 -0
  82. package/dist/data-branching.cjs +1 -1
  83. package/dist/data-branching.mjs +1 -1
  84. package/dist/data.cjs +1 -1
  85. package/dist/data.d.ts +70 -44
  86. package/dist/data.mjs +17 -16
  87. package/dist/devops-Bi8MXtko.js +8165 -0
  88. package/dist/devops-CU0sOVEA.cjs +17 -0
  89. package/dist/devops-CXyEwQeM.js +8165 -0
  90. package/dist/devops-On_1wRf9.cjs +17 -0
  91. package/dist/devops.cjs +1 -1
  92. package/dist/devops.mjs +1 -1
  93. package/dist/editors.cjs +1 -1
  94. package/dist/editors.d.ts +288 -432
  95. package/dist/editors.mjs +58 -62
  96. package/dist/feedback.cjs +1 -1
  97. package/dist/feedback.d.ts +1 -1
  98. package/dist/feedback.mjs +3 -3
  99. package/dist/index-BDH1yDSg.js +69235 -0
  100. package/dist/index-C9njkNOD.cjs +5470 -0
  101. package/dist/index.cjs +5137 -1
  102. package/dist/index.css +1 -1
  103. package/dist/index.d.ts +556 -929
  104. package/dist/index.mjs +66371 -1017
  105. package/dist/lazy.cjs +1 -1
  106. package/dist/lazy.mjs +24 -24
  107. package/dist/navigation.cjs +1 -1
  108. package/dist/navigation.d.ts +31 -213
  109. package/dist/navigation.mjs +105 -113
  110. package/dist/no-code-8lO7o6xi.js +7425 -0
  111. package/dist/no-code-C58g8_fb.cjs +332 -0
  112. package/dist/no-code-Cj4xJ3w9.js +7425 -0
  113. package/dist/no-code-K8tOLNew.cjs +332 -0
  114. package/dist/no-code.cjs +1 -1
  115. package/dist/no-code.mjs +1 -1
  116. package/dist/overlays.cjs +1 -1
  117. package/dist/overlays.d.ts +10 -0
  118. package/dist/overlays.mjs +36 -36
  119. package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
  120. package/dist/pickerCommons-CORo9j2a.js +2119 -0
  121. package/dist/pickerCommons-COiSUiP2.js +1122 -0
  122. package/dist/pickerCommons-D3WShRrR.cjs +1 -0
  123. package/dist/style.css +6 -6
  124. package/dist/vendor-BPVpdtPp.js +271 -0
  125. package/dist/vendor-Bo2Q64AF.cjs +1 -0
  126. package/package.json +17 -17
@@ -0,0 +1,4499 @@
1
+ import { jsxs as p, jsx as e, Fragment as _n } from "react/jsx-runtime";
2
+ import { D as sn, G as Oe, b as cn, r as On, a as En, s as St, i as At, c as mn, d as xt, j as Ut, e as Ge, o as ze, E as Rt, k as Et, Z as Ft, S as Lt, l as It } from "./core-BUsZ7_vI.js";
3
+ import Rn, { forwardRef as vn, useCallback as x, useMemo as ve, useState as Te, useRef as Ce, useContext as zt, useEffect as Fe, useLayoutEffect as ut, useImperativeHandle as Bt } from "react";
4
+ import { s as Ht, u as Pt, d as Xe, c as pt, g as Gt, F as tt, a as Yt, e as Vt, N as jt, b as it, h as Yn, f as Kt } from "./pickerCommons-CORo9j2a.js";
5
+ import { createPortal as ft } from "react-dom";
6
+ const Zn = vn(
7
+ ({
8
+ label: n,
9
+ helperText: i,
10
+ error: t,
11
+ required: l,
12
+ disabled: a,
13
+ readOnly: o,
14
+ size: d = "md",
15
+ name: y,
16
+ id: w,
17
+ className: B,
18
+ style: ne,
19
+ accessMode: k,
20
+ displayStyle: T,
21
+ value: H,
22
+ defaultValue: re,
23
+ onChange: G,
24
+ onBlur: V,
25
+ onKeyDown: j,
26
+ placeholder: Y,
27
+ rows: me = 3,
28
+ maxLength: _,
29
+ resize: ie = "vertical",
30
+ autoFocus: Z,
31
+ showCount: X,
32
+ counterPlacement: ae = "bottom",
33
+ submitOnEnter: z,
34
+ onSubmit: R,
35
+ showKeyboardHints: F,
36
+ labelPlacement: D,
37
+ errorPlacement: K,
38
+ loading: U,
39
+ labelWidth: O,
40
+ controlWidth: W,
41
+ displayMode: P
42
+ }, v) => {
43
+ const b = sn(k, w), q = b === "hidden";
44
+ b === "disabled" && (a = !0), b === "readOnly" && (o = !0);
45
+ const { t: se } = Oe(), u = cn(w), C = On("input", T), L = En("input", T), te = H?.length ?? 0, he = _ ? te > _ : !1, be = St({ enabled: P, readOnly: o, disabled: a }), J = {
46
+ key: "Enter",
47
+ ctrl: !0,
48
+ description: se("shortcuts.submit", "Submit")
49
+ }, m = x(
50
+ (oe) => {
51
+ z && At(oe, J) && (oe.preventDefault(), R?.()), j?.(oe);
52
+ },
53
+ [z, R, j, J]
54
+ ), E = ve(() => {
55
+ const oe = [];
56
+ return z && oe.push(J), oe.push({ key: "Tab", description: se("shortcuts.indent", "Indent (when supported)") }), oe;
57
+ }, [z, se, J]);
58
+ return q ? null : /* @__PURE__ */ p(
59
+ "div",
60
+ {
61
+ className: `nice-field nice-field--${d} ${D === "left" ? "nice-field--label-left" : ""} ${U ? "nice-field--loading" : ""} ${B || ""}`,
62
+ style: {
63
+ ...ne,
64
+ ...O != null && {
65
+ "--nice-field-label-width": typeof O == "number" ? `${O}px` : O
66
+ },
67
+ ...W != null && {
68
+ "--nice-field-control-width": typeof W == "number" ? `${W}px` : W
69
+ }
70
+ },
71
+ "aria-busy": U || void 0,
72
+ children: [
73
+ n && /* @__PURE__ */ p(
74
+ "label",
75
+ {
76
+ htmlFor: u,
77
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
78
+ children: [
79
+ n,
80
+ F && E.length > 0 && /* @__PURE__ */ e(mn, { shortcuts: E, size: "sm" })
81
+ ]
82
+ }
83
+ ),
84
+ /* @__PURE__ */ p("div", { className: "nice-field__control nice-field__control--textarea", children: [
85
+ be.isDisplay ? /* @__PURE__ */ e(
86
+ xt,
87
+ {
88
+ value: H ?? re ?? "",
89
+ placeholder: Y,
90
+ disabled: a,
91
+ readOnly: o,
92
+ onActivate: be.enterEdit,
93
+ ariaLabel: n,
94
+ className: "nice-display-value--textarea"
95
+ }
96
+ ) : /* @__PURE__ */ p(_n, { children: [
97
+ /* @__PURE__ */ p(
98
+ "div",
99
+ {
100
+ style: { display: "flex", flexDirection: "column", flex: "1 1 auto", minWidth: 0 },
101
+ children: [
102
+ /* @__PURE__ */ e(
103
+ "textarea",
104
+ {
105
+ ref: (oe) => {
106
+ typeof v == "function" ? v(oe) : v && (v.current = oe), be.autoFocusRef(oe);
107
+ },
108
+ id: u,
109
+ className: `nice-textarea nice-input--${d} nice-textarea--ds-${L} ${t ? "nice-textarea--error" : ""} ${a ? "nice-textarea--disabled" : ""}`,
110
+ style: { ...C, resize: ie },
111
+ name: y,
112
+ value: H,
113
+ defaultValue: re,
114
+ placeholder: Y,
115
+ rows: me,
116
+ maxLength: _,
117
+ disabled: a || U,
118
+ readOnly: o,
119
+ autoFocus: Z,
120
+ "aria-invalid": !!t,
121
+ "aria-describedby": t ? `${u}-error` : i ? `${u}-helper` : void 0,
122
+ onChange: (oe) => G?.(oe.target.value),
123
+ onBlur: (oe) => {
124
+ P && be.exitEdit(), V?.(oe);
125
+ },
126
+ onKeyDown: m
127
+ }
128
+ ),
129
+ ae !== "right" && (X || _) && /* @__PURE__ */ p(
130
+ "div",
131
+ {
132
+ className: `nice-textarea__counter ${he ? "nice-textarea__counter--over" : ""}`,
133
+ children: [
134
+ te,
135
+ _ ? ` / ${_}` : ""
136
+ ]
137
+ }
138
+ )
139
+ ]
140
+ }
141
+ ),
142
+ ae === "right" && (X || _) && /* @__PURE__ */ p(
143
+ "div",
144
+ {
145
+ className: `nice-textarea__counter nice-textarea__counter--right ${he ? "nice-textarea__counter--over" : ""}`,
146
+ children: [
147
+ te,
148
+ _ ? ` / ${_}` : ""
149
+ ]
150
+ }
151
+ )
152
+ ] }),
153
+ U && /* @__PURE__ */ e("span", { className: "nice-field__spinner nice-field__spinner--textarea", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
154
+ K === "right" && t && /* @__PURE__ */ e("div", { id: `${u}-error`, className: "nice-field__error", role: "alert", children: t }),
155
+ K === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${u}-helper`, className: "nice-field__helper", children: i })
156
+ ] }),
157
+ K !== "right" && t && /* @__PURE__ */ e("div", { id: `${u}-error`, className: "nice-field__error", role: "alert", children: t }),
158
+ K !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${u}-helper`, className: "nice-field__helper", children: i })
159
+ ]
160
+ }
161
+ );
162
+ }
163
+ );
164
+ Zn.displayName = "NiceTextArea";
165
+ const Li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
166
+ __proto__: null,
167
+ NiceTextArea: Zn
168
+ }, Symbol.toStringTag, { value: "Module" })), Ot = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
169
+ function Zt(n, i) {
170
+ return new Date(n, i + 1, 0).getDate();
171
+ }
172
+ function qt(n, i) {
173
+ return new Date(n, i, 1).getDay();
174
+ }
175
+ function at(n, i, t) {
176
+ return `${n}-${String(i + 1).padStart(2, "0")}-${String(t).padStart(2, "0")}`;
177
+ }
178
+ function Jt(n) {
179
+ const i = new Date(Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()));
180
+ i.setUTCDate(i.getUTCDate() + 4 - (i.getUTCDay() || 7));
181
+ const t = new Date(Date.UTC(i.getUTCFullYear(), 0, 1));
182
+ return Math.ceil(((i.getTime() - t.getTime()) / 864e5 + 1) / 7);
183
+ }
184
+ const lt = [
185
+ "January",
186
+ "February",
187
+ "March",
188
+ "April",
189
+ "May",
190
+ "June",
191
+ "July",
192
+ "August",
193
+ "September",
194
+ "October",
195
+ "November",
196
+ "December"
197
+ ], mt = ({
198
+ value: n,
199
+ onChange: i,
200
+ min: t,
201
+ max: l,
202
+ disabledDates: a = [],
203
+ firstDayOfWeek: o = 1,
204
+ size: d = "md",
205
+ showWeekNumbers: y,
206
+ onMonthChange: w,
207
+ className: B,
208
+ style: ne,
209
+ accessMode: k,
210
+ id: T,
211
+ multiple: H,
212
+ selectedDates: re,
213
+ onSelectedDatesChange: G,
214
+ renderDay: V,
215
+ showKeyboardHints: j,
216
+ persistPreferences: Y = !1,
217
+ fullWidth: me = !1,
218
+ // Traceless storage props
219
+ cookies: _ = !1,
220
+ localStorage: ie = !0,
221
+ sessionStorage: Z = !1,
222
+ storageMode: X,
223
+ storageKey: ae
224
+ }) => {
225
+ const z = sn(k, T), R = z === "hidden", F = z === "disabled" || z === "readOnly", { t: D } = Oe(), K = /* @__PURE__ */ new Date(), U = n ? new Date(n) : K, O = Ut(ae ?? "nice-calendar"), W = ve(() => Y ? O.get("prefs") ?? {} : {}, [Y, O]), P = W.firstDayOfWeek ?? o, [v, b] = Te(W.lastViewYear ?? U.getFullYear()), [q, se] = Te(W.lastViewMonth ?? U.getMonth()), [u, C] = Te(W.preferredView ?? "days"), [L, te] = Te([]), he = re ?? L, be = x(
226
+ ($) => {
227
+ if (!Y)
228
+ return;
229
+ const pe = O.get("prefs") ?? {};
230
+ O.set("prefs", { ...pe, ...$ });
231
+ },
232
+ [Y, O]
233
+ ), J = x(
234
+ ($) => {
235
+ C($), be({ preferredView: $ });
236
+ },
237
+ [be]
238
+ ), m = x(
239
+ ($, pe) => {
240
+ be({ lastViewYear: $, lastViewMonth: pe });
241
+ },
242
+ [be]
243
+ ), E = ve(
244
+ () => [
245
+ Ge.moveUp,
246
+ Ge.moveDown,
247
+ Ge.moveLeft,
248
+ Ge.moveRight,
249
+ { key: "Enter", description: D("shortcuts.selectDate", "Select date") },
250
+ Ge.pageUp,
251
+ Ge.pageDown
252
+ ],
253
+ [D]
254
+ ), oe = ve(() => Zt(v, q), [v, q]), xe = ve(() => (qt(v, q) - P + 7) % 7, [v, q, P]), ke = ve(() => {
255
+ const $ = [...Ot];
256
+ for (let pe = 0; pe < P; pe++)
257
+ $.push($.shift());
258
+ return $;
259
+ }, [P]), ee = x(
260
+ ($) => {
261
+ const pe = (A) => /^\d{4}-\d{2}-\d{2}/.test(A);
262
+ return t && pe(t) && $ < t || l && pe(l) && $ > l ? !0 : a.includes($);
263
+ },
264
+ [t, l, a]
265
+ ), le = x(
266
+ ($) => {
267
+ if (u === "years") {
268
+ b((we) => we + $ * 10);
269
+ return;
270
+ }
271
+ if (u === "months") {
272
+ b((we) => we + $);
273
+ return;
274
+ }
275
+ let pe = q + $, A = v;
276
+ pe < 0 && (pe = 11, A--), pe > 11 && (pe = 0, A++), se(pe), b(A), m(A, pe), w?.(A, pe);
277
+ },
278
+ [q, v, w, u, m]
279
+ ), ye = at(K.getFullYear(), K.getMonth(), K.getDate()), Se = x(
280
+ ($) => H ? he.includes($) : $ === n,
281
+ [H, he, n]
282
+ ), f = x(
283
+ ($) => {
284
+ if (!F) {
285
+ if (H) {
286
+ const pe = he.includes($) ? he.filter((A) => A !== $) : [...he, $];
287
+ re === void 0 && te(pe), G?.(pe);
288
+ }
289
+ i?.($);
290
+ }
291
+ },
292
+ [F, H, he, re, i, G]
293
+ ), c = x(() => {
294
+ u === "days" ? J("months") : u === "months" && J("years");
295
+ }, [u, J]), N = x(
296
+ ($) => {
297
+ se($), J("days"), m(v, $), w?.(v, $);
298
+ },
299
+ [v, w, J, m]
300
+ ), ue = x(
301
+ ($) => {
302
+ b($), J("months");
303
+ },
304
+ [J]
305
+ ), de = u === "years" ? `${v - v % 10} – ${v - v % 10 + 9}` : u === "months" ? `${v}` : `${lt[q]} ${v}`, Q = u === "years" ? "decade" : u === "months" ? "year" : "month", g = [];
306
+ for (let $ = 0; $ < xe; $++)
307
+ g.push(null);
308
+ for (let $ = 1; $ <= oe; $++)
309
+ g.push($);
310
+ for (; g.length % 7 !== 0; )
311
+ g.push(null);
312
+ const Ye = [];
313
+ for (let $ = 0; $ < g.length; $ += 7)
314
+ Ye.push(g.slice($, $ + 7));
315
+ const Ze = v - v % 10;
316
+ return R ? null : /* @__PURE__ */ p(
317
+ "div",
318
+ {
319
+ className: `nice-calendar nice-calendar--${d}${me ? " nice-calendar--full-width" : ""} ${B || ""}`,
320
+ style: ne,
321
+ children: [
322
+ /* @__PURE__ */ p("div", { className: "nice-calendar__header", children: [
323
+ /* @__PURE__ */ e(
324
+ "button",
325
+ {
326
+ type: "button",
327
+ className: "nice-calendar__nav",
328
+ onClick: () => le(-1),
329
+ "aria-label": `Previous ${Q}`,
330
+ children: /* @__PURE__ */ e(ze, { name: "chevron-left", size: 16 })
331
+ }
332
+ ),
333
+ /* @__PURE__ */ e(
334
+ "button",
335
+ {
336
+ type: "button",
337
+ className: "nice-calendar__title",
338
+ onClick: c,
339
+ "aria-label": u === "days" ? "Show month picker" : u === "months" ? "Show year picker" : void 0,
340
+ disabled: u === "years",
341
+ children: de
342
+ }
343
+ ),
344
+ /* @__PURE__ */ e(
345
+ "button",
346
+ {
347
+ type: "button",
348
+ className: "nice-calendar__nav",
349
+ onClick: () => le(1),
350
+ "aria-label": `Next ${Q}`,
351
+ children: /* @__PURE__ */ e(ze, { name: "chevron-right", size: 16 })
352
+ }
353
+ ),
354
+ j && /* @__PURE__ */ e(mn, { shortcuts: E, size: "sm" })
355
+ ] }),
356
+ u === "days" && /* @__PURE__ */ p("table", { className: "nice-calendar__grid", role: "grid", children: [
357
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ p("tr", { children: [
358
+ y && /* @__PURE__ */ e("th", { className: "nice-calendar__wk", children: "W" }),
359
+ ke.map(($) => /* @__PURE__ */ e("th", { children: $ }, $))
360
+ ] }) }),
361
+ /* @__PURE__ */ e("tbody", { children: Ye.map(($, pe) => /* @__PURE__ */ p("tr", { children: [
362
+ y && /* @__PURE__ */ e("td", { className: "nice-calendar__wk", children: $.find((A) => A != null) ? Jt(new Date(v, q, $.find((A) => A != null))) : "" }),
363
+ $.map((A, we) => {
364
+ if (A == null)
365
+ return /* @__PURE__ */ e("td", { className: "nice-calendar__empty-cell" }, we);
366
+ const Ve = at(v, q, A), Ne = ee(Ve), en = Se(Ve);
367
+ return /* @__PURE__ */ e(
368
+ "td",
369
+ {
370
+ className: `nice-calendar__day${en ? " nice-calendar__day--selected" : ""}${Ve === ye ? " nice-calendar__day--today" : ""}${Ne ? " nice-calendar__day--disabled" : ""}`,
371
+ onClick: () => !Ne && f(Ve),
372
+ role: "gridcell",
373
+ "aria-selected": en,
374
+ "aria-disabled": Ne,
375
+ children: V ? V(Ve, A) : A
376
+ },
377
+ we
378
+ );
379
+ })
380
+ ] }, pe)) })
381
+ ] }),
382
+ u === "months" && /* @__PURE__ */ e("div", { className: "nice-calendar__picker-grid", children: lt.map(($, pe) => /* @__PURE__ */ e(
383
+ "button",
384
+ {
385
+ type: "button",
386
+ className: `nice-calendar__picker-cell${pe === q && v === U.getFullYear() ? " nice-calendar__picker-cell--selected" : ""}`,
387
+ onClick: () => N(pe),
388
+ children: $.slice(0, 3)
389
+ },
390
+ pe
391
+ )) }),
392
+ u === "years" && /* @__PURE__ */ e("div", { className: "nice-calendar__picker-grid", children: Array.from({ length: 12 }, ($, pe) => Ze - 1 + pe).map(($) => /* @__PURE__ */ e(
393
+ "button",
394
+ {
395
+ type: "button",
396
+ className: `nice-calendar__picker-cell${$ === v ? " nice-calendar__picker-cell--selected" : ""}${$ < Ze || $ > Ze + 9 ? " nice-calendar__picker-cell--other" : ""}`,
397
+ onClick: () => ue($),
398
+ children: $
399
+ },
400
+ $
401
+ )) })
402
+ ]
403
+ }
404
+ );
405
+ };
406
+ mt.displayName = "NiceCalendar";
407
+ const Qt = {
408
+ "date-local": { inputType: "date", localized: !0 },
409
+ "date-utc": { inputType: "date", localized: !1 },
410
+ "datetime-local": { inputType: "datetime-local", localized: !0 },
411
+ "datetime-utc": { inputType: "datetime-local", localized: !1 },
412
+ "month-local": { inputType: "month", localized: !0 },
413
+ "month-utc": { inputType: "month", localized: !1 },
414
+ week: { inputType: "week", localized: !1 },
415
+ time: { inputType: "time", localized: !1 }
416
+ }, rt = {
417
+ date: "yyyy-MM-dd",
418
+ "datetime-local": "yyyy-MM-ddTHH:mm",
419
+ month: "yyyy-MM",
420
+ week: "yyyy-Www",
421
+ time: "HH:mm"
422
+ }, Xt = {
423
+ "yyyy-MM-dd": "YYYY-MM-DD",
424
+ "yyyy-MM-ddTHH:mm": "YYYY-MM-DDTHH:MM",
425
+ "yyyy-MM": "YYYY-MM",
426
+ "yyyy-Www": "YYYY-Www",
427
+ "HH:mm": "HH:MM"
428
+ };
429
+ function Kn(n) {
430
+ const i = (n || "").toLowerCase().replace("_", "-"), t = i.split("-")[0], l = {
431
+ // dd.MM.yyyy (dot)
432
+ pl: "dd.MM.yyyy",
433
+ "pl-pl": "dd.MM.yyyy",
434
+ de: "dd.MM.yyyy",
435
+ "de-de": "dd.MM.yyyy",
436
+ "de-at": "dd.MM.yyyy",
437
+ "de-ch": "dd.MM.yyyy",
438
+ cs: "dd.MM.yyyy",
439
+ "cs-cz": "dd.MM.yyyy",
440
+ sk: "dd.MM.yyyy",
441
+ "sk-sk": "dd.MM.yyyy",
442
+ ru: "dd.MM.yyyy",
443
+ "ru-ru": "dd.MM.yyyy",
444
+ fi: "dd.MM.yyyy",
445
+ "fi-fi": "dd.MM.yyyy",
446
+ no: "dd.MM.yyyy",
447
+ nb: "dd.MM.yyyy",
448
+ nn: "dd.MM.yyyy",
449
+ da: "dd.MM.yyyy",
450
+ "da-dk": "dd.MM.yyyy",
451
+ tr: "dd.MM.yyyy",
452
+ "tr-tr": "dd.MM.yyyy",
453
+ sl: "dd.MM.yyyy",
454
+ hr: "dd.MM.yyyy",
455
+ sr: "dd.MM.yyyy",
456
+ ro: "dd.MM.yyyy",
457
+ bg: "dd.MM.yyyy",
458
+ uk: "dd.MM.yyyy",
459
+ is: "dd.MM.yyyy",
460
+ et: "dd.MM.yyyy",
461
+ lv: "dd.MM.yyyy",
462
+ lt: "dd.MM.yyyy",
463
+ // dd/MM/yyyy (slash)
464
+ "en-gb": "dd/MM/yyyy",
465
+ "en-au": "dd/MM/yyyy",
466
+ "en-ie": "dd/MM/yyyy",
467
+ "en-nz": "dd/MM/yyyy",
468
+ "en-in": "dd/MM/yyyy",
469
+ fr: "dd/MM/yyyy",
470
+ "fr-fr": "dd/MM/yyyy",
471
+ "fr-be": "dd/MM/yyyy",
472
+ es: "dd/MM/yyyy",
473
+ "es-es": "dd/MM/yyyy",
474
+ pt: "dd/MM/yyyy",
475
+ "pt-pt": "dd/MM/yyyy",
476
+ "pt-br": "dd/MM/yyyy",
477
+ it: "dd/MM/yyyy",
478
+ "it-it": "dd/MM/yyyy",
479
+ nl: "dd-MM-yyyy",
480
+ "nl-nl": "dd-MM-yyyy",
481
+ "nl-be": "dd/MM/yyyy",
482
+ el: "dd/MM/yyyy",
483
+ hu: "yyyy.MM.dd",
484
+ // MM/dd/yyyy
485
+ en: "MM/dd/yyyy",
486
+ "en-us": "MM/dd/yyyy",
487
+ "en-ca": "MM/dd/yyyy",
488
+ // yyyy-MM-dd / yyyy/MM/dd
489
+ ja: "yyyy/MM/dd",
490
+ "ja-jp": "yyyy/MM/dd",
491
+ ko: "yyyy.MM.dd",
492
+ "ko-kr": "yyyy.MM.dd",
493
+ zh: "yyyy/MM/dd",
494
+ "zh-cn": "yyyy/MM/dd",
495
+ "zh-tw": "yyyy/MM/dd",
496
+ sv: "yyyy-MM-dd",
497
+ "sv-se": "yyyy-MM-dd"
498
+ };
499
+ if (l[i])
500
+ return l[i];
501
+ if (l[t])
502
+ return l[t];
503
+ try {
504
+ const o = new Intl.DateTimeFormat(n, {
505
+ year: "numeric",
506
+ month: "2-digit",
507
+ day: "2-digit"
508
+ }).formatToParts(new Date(2024, 0, 15));
509
+ let d = "";
510
+ for (const y of o)
511
+ if (y.type === "day")
512
+ d += "dd";
513
+ else if (y.type === "month")
514
+ d += "MM";
515
+ else if (y.type === "year")
516
+ d += "yyyy";
517
+ else if (y.type === "literal") {
518
+ const w = y.value.replace(/[\u00A0\u202F\u2009]/g, " ").trim();
519
+ d += w || ".";
520
+ }
521
+ return !/y/.test(d) || !/M/.test(d) || !/d/.test(d) ? "yyyy-MM-dd" : d;
522
+ } catch {
523
+ return "yyyy-MM-dd";
524
+ }
525
+ }
526
+ function Wt(n) {
527
+ const t = Kn(n).replace(/dd[^\w]*/g, "").replace(/[^\w]*dd/g, "");
528
+ return !/y/.test(t) || !/M/.test(t) ? "yyyy-MM" : t;
529
+ }
530
+ function ei() {
531
+ if (typeof document < "u") {
532
+ const n = document.documentElement?.lang;
533
+ if (n && /^[a-zA-Z]{2,}/.test(n))
534
+ return n;
535
+ }
536
+ return typeof navigator < "u" && navigator.language ? navigator.language : "en-US";
537
+ }
538
+ function ni(n, i, t, l = !1) {
539
+ rt[n] || (n = "date");
540
+ let a = rt[n];
541
+ l && (n === "datetime-local" || n === "time") && (a = a.replace("HH:mm", "HH:mm:ss"));
542
+ let o = a;
543
+ i && (n === "date" || n === "datetime-local" || n === "month") && (n === "date" ? o = Kn(t) : n === "datetime-local" ? o = `${Kn(t)} HH:mm${l ? ":ss" : ""}` : o = Wt(t)), n === "datetime-local" && (o = o.replace("T", " · "));
544
+ const d = Xt[o] ?? o.replace(/y/g, "Y").replace(/M/g, "M").replace(/d/g, "D").replace(/H/g, "H").replace(/m/g, "M").replace(/s/g, "S");
545
+ return { displayTpl: o, isoTpl: a, placeholder: d };
546
+ }
547
+ const ti = /* @__PURE__ */ new Set(["y", "M", "d", "H", "m", "s", "w"]);
548
+ function We(n) {
549
+ return ti.has(n);
550
+ }
551
+ function qn(n) {
552
+ let i = 0;
553
+ for (const t of n)
554
+ We(t) && i++;
555
+ return i;
556
+ }
557
+ function Jn(n, i) {
558
+ let t = "", l = 0;
559
+ for (const a of n)
560
+ if (We(a)) {
561
+ if (l >= i.length)
562
+ break;
563
+ t += i[l++];
564
+ } else {
565
+ if (l === 0)
566
+ break;
567
+ l >= i.length, t += a;
568
+ }
569
+ return t;
570
+ }
571
+ function ii(n, i, t) {
572
+ if (t.length === 0)
573
+ return "";
574
+ const l = {};
575
+ let a = 0;
576
+ for (const y of n)
577
+ We(y) && (a >= t.length ? (l[y] ?? (l[y] = [])).push("") : (l[y] ?? (l[y] = [])).push(t[a]), a++);
578
+ const o = {};
579
+ let d = "";
580
+ for (const y of i)
581
+ if (We(y)) {
582
+ const w = l[y] ?? [], B = o[y] ?? 0;
583
+ d += w[B] ?? "", o[y] = B + 1;
584
+ }
585
+ return d;
586
+ }
587
+ function fn(n, i, t) {
588
+ if (t.length === 0)
589
+ return "";
590
+ const l = {};
591
+ let a = 0;
592
+ for (const y of i)
593
+ We(y) && ((l[y] ?? (l[y] = [])).push(t[a] ?? ""), a++);
594
+ const o = {};
595
+ let d = "";
596
+ for (const y of n)
597
+ if (We(y)) {
598
+ const w = l[y] ?? [], B = o[y] ?? 0;
599
+ d += w[B] ?? "", o[y] = B + 1;
600
+ }
601
+ return d.replace(/\s+$/, "");
602
+ }
603
+ function st(n, i, t) {
604
+ const l = qn(i);
605
+ if (t.length < l)
606
+ return "";
607
+ const a = ii(n, i, t);
608
+ if (a.length < l)
609
+ return "";
610
+ let o = "", d = 0;
611
+ for (const y of i)
612
+ We(y) ? o += a[d++] : o += y;
613
+ return o;
614
+ }
615
+ function ct(n, i, t) {
616
+ return n && (i && n < i ? i : t && n > t ? t : n);
617
+ }
618
+ function Le(n) {
619
+ return n.toString().padStart(2, "0");
620
+ }
621
+ function xn(n) {
622
+ const i = /(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(n);
623
+ return i ? { hours: Number(i[1]), minutes: Number(i[2]), seconds: Number(i[3] ?? 0) } : null;
624
+ }
625
+ function ot(n, i, t, l, a) {
626
+ const o = a ? `${Le(i)}:${Le(t)}:${Le(l)}` : `${Le(i)}:${Le(t)}`;
627
+ return n.replace(/\d{2}:\d{2}(?::\d{2})?$/, o);
628
+ }
629
+ function ht(n, i) {
630
+ if (n <= 0)
631
+ return i;
632
+ const t = Math.floor(n / 864e5), l = `${Le(Math.floor(n % 864e5 / 36e5))}:${Le(Math.floor(n % 36e5 / 6e4))}:${Le(Math.floor(n % 6e4 / 1e3))}`;
633
+ return t > 0 ? `${t}d ${l}` : l;
634
+ }
635
+ function ai(n, i) {
636
+ if (n <= 0)
637
+ return i;
638
+ const t = Math.floor(n / 864e5), l = Math.floor(n % 864e5 / 36e5), a = Math.floor(n % 36e5 / 6e4), o = Math.floor(n % 6e4 / 1e3), d = [];
639
+ return t && d.push(`${t}d`), (t || l) && d.push(`${l}h`), (t || l || a) && d.push(`${a}m`), d.push(`${o}s`), d.join(" ");
640
+ }
641
+ function li(n, i) {
642
+ if (n <= 0)
643
+ return i;
644
+ const t = Math.floor(n / 1e3), l = Math.floor(t / 3600), a = Math.floor(t % 3600 / 60), o = t % 60;
645
+ return l > 0 ? `${Le(l)}:${Le(a)}:${Le(o)}` : `${Le(a)}:${Le(o)}`;
646
+ }
647
+ function ri(n, i) {
648
+ if (n <= 0)
649
+ return i;
650
+ const t = Math.floor(n / 1e3), l = Math.floor(t / 86400);
651
+ if (l)
652
+ return `${l}d`;
653
+ const a = Math.floor(t / 3600);
654
+ if (a)
655
+ return `${a}h`;
656
+ const o = Math.floor(t / 60);
657
+ return o ? `${o}m` : `${t}s`;
658
+ }
659
+ function si(n, i) {
660
+ if (n <= 0)
661
+ return i;
662
+ const t = Math.floor(n / 1e3), l = Math.floor(t / 86400), a = Math.floor(t % 86400 / 3600), o = Math.floor(t % 3600 / 60), d = [];
663
+ return l && d.push(`${l} ${l === 1 ? "day" : "days"}`), a && d.push(`${a} ${a === 1 ? "hour" : "hours"}`), o && d.push(`${o} ${o === 1 ? "minute" : "minutes"}`), d.length ? d.join(", ") : "less than a minute";
664
+ }
665
+ const ci = {
666
+ verbose: ht,
667
+ compact: ai,
668
+ short: li,
669
+ minimal: ri,
670
+ words: si
671
+ };
672
+ function oi(n, i, t) {
673
+ const l = n ? xn(n) : null, { hours: a, minutes: o, seconds: d } = l ?? { hours: 0, minutes: 0, seconds: 0 }, y = new Date(t);
674
+ if (i != null) {
675
+ const B = typeof i == "string" ? new Date(i) : new Date(i.getTime());
676
+ if (!Number.isNaN(B.getTime()))
677
+ return B.setHours(a, o, d, 0), B;
678
+ }
679
+ if (n && /^\d{4}-\d{2}-\d{2}T/.test(n)) {
680
+ const B = new Date(n);
681
+ if (!Number.isNaN(B.getTime()))
682
+ return B;
683
+ }
684
+ const w = new Date(y);
685
+ return w.setHours(a, o, d, 0), w.getTime() <= y.getTime() && w.setDate(w.getDate() + 1), w;
686
+ }
687
+ function wn(n, i) {
688
+ if (!n)
689
+ return "";
690
+ const t = n.replace(/[^0-9]/g, ""), l = qn(i);
691
+ return t.slice(0, l);
692
+ }
693
+ function Je(n, i, t) {
694
+ const l = Jn(n, t);
695
+ let a = 0;
696
+ const o = Math.min(i, l.length);
697
+ for (let d = 0; d < o; d++)
698
+ We(n[d]) && a++;
699
+ return Math.min(a, t.length);
700
+ }
701
+ function di(n, i, t) {
702
+ if (t <= 0)
703
+ return 0;
704
+ const l = Jn(n, i);
705
+ let a = 0;
706
+ for (let o = 0; o < l.length; o++)
707
+ if (We(n[o]) && (a++, a === t)) {
708
+ let d = o + 1;
709
+ for (; d < l.length && !We(n[d]); )
710
+ d++;
711
+ return d;
712
+ }
713
+ return l.length;
714
+ }
715
+ const Vn = 30, ui = ({
716
+ part: n,
717
+ label: i,
718
+ value: t,
719
+ max: l,
720
+ step: a,
721
+ onPick: o,
722
+ onStep: d,
723
+ startHold: y,
724
+ stopHold: w
725
+ }) => {
726
+ const B = Ce(null), ne = Ce(!1), k = Ce(null), T = Ce(null), H = ve(() => {
727
+ const _ = [], ie = a > 0 ? a : 1;
728
+ for (let Z = 0; Z <= l; Z += ie)
729
+ _.push(Z);
730
+ return _;
731
+ }, [l, a]), re = Math.max(0, Math.min(H.length - 1, Math.round(t / (a > 0 ? a : 1)))), G = Ce(!1);
732
+ ut(() => {
733
+ const _ = B.current;
734
+ if (!_)
735
+ return;
736
+ const ie = re * Vn;
737
+ if (Math.abs(_.scrollTop - ie) < 1)
738
+ return;
739
+ const Z = Math.abs(_.scrollTop / Vn - re);
740
+ ne.current = !0, k.current && (clearTimeout(k.current), k.current = null), _.scrollTo({ top: ie, behavior: G.current && Z <= 3 ? "smooth" : "auto" }), G.current = !0, T.current && clearTimeout(T.current), T.current = setTimeout(() => {
741
+ ne.current = !1;
742
+ }, 380);
743
+ }, [re]), Fe(
744
+ () => () => {
745
+ k.current && clearTimeout(k.current), T.current && clearTimeout(T.current);
746
+ },
747
+ []
748
+ );
749
+ const V = () => {
750
+ ne.current || (k.current && clearTimeout(k.current), k.current = setTimeout(() => {
751
+ const _ = B.current;
752
+ if (!_)
753
+ return;
754
+ const ie = Math.max(0, Math.min(H.length - 1, Math.round(_.scrollTop / Vn))), Z = H[ie];
755
+ Z !== t && o(Z);
756
+ }, 110));
757
+ }, j = (_) => {
758
+ _.key === "ArrowUp" ? (_.preventDefault(), d(-1)) : _.key === "ArrowDown" && (_.preventDefault(), d(1));
759
+ }, Y = (_) => {
760
+ const ie = _.replace(/\D/g, "");
761
+ if (!ie)
762
+ return;
763
+ const Z = Number(ie.slice(-2));
764
+ o(Math.max(0, Math.min(l, Z)));
765
+ }, me = (_) => {
766
+ B.current && B.current.scrollBy({ top: _.deltaY });
767
+ };
768
+ return /* @__PURE__ */ p("div", { className: "nice-datetime-popup__spinner", role: "group", "aria-label": i, children: [
769
+ /* @__PURE__ */ e(
770
+ "div",
771
+ {
772
+ ref: B,
773
+ className: "nice-datetime-popup__spin-column",
774
+ role: "listbox",
775
+ tabIndex: -1,
776
+ "aria-label": i,
777
+ "aria-activedescendant": `${n}-opt-${t}`,
778
+ onScroll: V,
779
+ children: H.map((_) => /* @__PURE__ */ e(
780
+ "button",
781
+ {
782
+ type: "button",
783
+ id: `${n}-opt-${_}`,
784
+ role: "option",
785
+ "aria-selected": _ === t,
786
+ className: `nice-datetime-popup__spin-item${_ === t ? " is-selected" : ""}`,
787
+ onClick: () => o(_),
788
+ tabIndex: -1,
789
+ children: Le(_)
790
+ },
791
+ _
792
+ ))
793
+ }
794
+ ),
795
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__spin-center", onWheel: me, children: [
796
+ /* @__PURE__ */ e(
797
+ "button",
798
+ {
799
+ type: "button",
800
+ className: "nice-datetime-popup__spin-btn",
801
+ onClick: () => d(-1),
802
+ onPointerDown: () => y(() => d(-1)),
803
+ onPointerUp: w,
804
+ onPointerLeave: w,
805
+ "aria-label": `${i} -`,
806
+ tabIndex: -1,
807
+ children: /* @__PURE__ */ e(ze, { name: "chevron-up", size: 14 })
808
+ }
809
+ ),
810
+ /* @__PURE__ */ e(
811
+ "input",
812
+ {
813
+ className: "nice-datetime-popup__spin-value",
814
+ inputMode: "numeric",
815
+ "aria-label": i,
816
+ value: Le(t),
817
+ onFocus: (_) => _.currentTarget.select(),
818
+ onChange: (_) => Y(_.target.value),
819
+ onKeyDown: j
820
+ }
821
+ ),
822
+ /* @__PURE__ */ e(
823
+ "button",
824
+ {
825
+ type: "button",
826
+ className: "nice-datetime-popup__spin-btn",
827
+ onClick: () => d(1),
828
+ onPointerDown: () => y(() => d(1)),
829
+ onPointerUp: w,
830
+ onPointerLeave: w,
831
+ "aria-label": `${i} +`,
832
+ tabIndex: -1,
833
+ children: /* @__PURE__ */ e(ze, { name: "chevron-down", size: 14 })
834
+ }
835
+ )
836
+ ] })
837
+ ] });
838
+ }, Un = vn(
839
+ ({
840
+ label: n,
841
+ helperText: i,
842
+ error: t,
843
+ required: l,
844
+ disabled: a,
845
+ readOnly: o,
846
+ size: d = "md",
847
+ name: y,
848
+ id: w,
849
+ className: B,
850
+ style: ne,
851
+ accessMode: k,
852
+ value: T,
853
+ onChange: H,
854
+ onBlur: re,
855
+ onKeyDown: G,
856
+ min: V,
857
+ max: j,
858
+ type: Y,
859
+ dateFormatPreset: me,
860
+ submitOnEnter: _,
861
+ onSubmit: ie,
862
+ showKeyboardHints: Z,
863
+ displayStyle: X,
864
+ labelPlacement: ae,
865
+ errorPlacement: z,
866
+ loading: R,
867
+ labelWidth: F,
868
+ controlWidth: D,
869
+ placeholder: K,
870
+ clearable: U = !1,
871
+ showPickerButton: O = !0,
872
+ displayLocale: W,
873
+ keyboardShortcuts: P = !0,
874
+ showSeconds: v = !1,
875
+ minuteStep: b = 1,
876
+ showNow: q = !1,
877
+ hourFormat: se = "24",
878
+ targetDate: u,
879
+ onTargetChange: C,
880
+ countdown: L = !1,
881
+ countdownFormat: te = "verbose",
882
+ formatCountdown: he,
883
+ countdownLabel: be,
884
+ countdownInterval: J = 1e3,
885
+ countdownDoneText: m
886
+ }, E) => {
887
+ const oe = On("input", X), xe = En("input", X), ke = sn(k, w), ee = ke === "hidden";
888
+ ke === "disabled" && (a = !0), ke === "readOnly" && (o = !0);
889
+ const { t: le } = Oe(), ye = cn(w), Se = Ce(null), f = Ce(null), c = Ce(null), N = Ce(null), [ue, de] = Te(!1), [Q, g] = Te(null), [Ye, Ze] = Te(""), pe = zt(Rt)?.portalTarget ?? (typeof document < "u" ? document.body : null), { start: A, stop: we } = Et(), Ve = me ? Qt[me] : null, Ne = Ve?.inputType ?? Y ?? "date", en = Ve?.localized ?? !1, nn = W ?? ei(), M = ve(
890
+ () => ni(Ne, en, nn, v),
891
+ [Ne, en, nn, v]
892
+ ), Ie = ve(() => qn(M.isoTpl), [M.isoTpl]), [tn, on] = Te(() => {
893
+ const s = wn(T, M.isoTpl);
894
+ return fn(M.displayTpl, M.isoTpl, s);
895
+ }), Qe = Ce(tn);
896
+ Fe(() => {
897
+ Qe.current = tn;
898
+ }, [tn]);
899
+ const qe = Ce(T ?? ""), an = Ce(null);
900
+ Fe(() => {
901
+ const s = T ?? "";
902
+ if (s === qe.current)
903
+ return;
904
+ const h = wn(s, M.isoTpl), S = fn(M.displayTpl, M.isoTpl, h);
905
+ on(S), qe.current = s;
906
+ }, [T, M.displayTpl, M.isoTpl]), Fe(() => {
907
+ const s = wn(T, M.isoTpl);
908
+ on(fn(M.displayTpl, M.isoTpl, s));
909
+ }, [M.displayTpl, M.isoTpl]), Fe(() => {
910
+ if (an.current == null)
911
+ return;
912
+ const s = an.current;
913
+ an.current = null;
914
+ const h = Se.current;
915
+ if (h && document.activeElement === h)
916
+ try {
917
+ h.setSelectionRange(s, s);
918
+ } catch {
919
+ }
920
+ });
921
+ const kn = ve(
922
+ () => Jn(M.displayTpl, tn),
923
+ [M.displayTpl, tn]
924
+ ), dn = K ?? M.placeholder, hn = Math.max(M.displayTpl.length + 1, 9), Fn = Ft({
925
+ enabled: _,
926
+ onSubmit: ie
927
+ }), Pe = x(
928
+ (s, h) => {
929
+ const S = s.slice(0, Ie);
930
+ Qe.current = S, on(S), an.current = di(
931
+ M.displayTpl,
932
+ S,
933
+ Math.max(0, Math.min(S.length, h))
934
+ );
935
+ const ge = ct(st(M.displayTpl, M.isoTpl, S), V, j);
936
+ ge !== qe.current && (qe.current = ge, H?.(ge));
937
+ },
938
+ [H, M.displayTpl, M.isoTpl, Ie, V, j]
939
+ ), gn = x(
940
+ (s) => {
941
+ const h = ct(s, V, j), S = wn(h, M.isoTpl);
942
+ qe.current = h, on(fn(M.displayTpl, M.isoTpl, S)), H?.(h);
943
+ },
944
+ [H, M.displayTpl, M.isoTpl, V, j]
945
+ ), ln = Ne === "time" || Ne === "datetime-local", rn = x(
946
+ () => st(M.displayTpl, M.isoTpl, Qe.current),
947
+ [M.displayTpl, M.isoTpl]
948
+ ), Tn = x(() => {
949
+ if (a || o)
950
+ return;
951
+ const s = rn(), h = s ? xn(s) : null;
952
+ if (!h)
953
+ return;
954
+ const S = h.hours >= 12 ? h.hours - 12 : h.hours + 12;
955
+ gn(ot(s, S, h.minutes, h.seconds, v));
956
+ }, [a, o, rn, gn, v]), Ln = (() => {
957
+ const s = xn(T ?? "");
958
+ return s && s.hours >= 12 ? "PM" : "AM";
959
+ })(), Hn = x(
960
+ (s) => {
961
+ if (Fn(s), o || a) {
962
+ G?.(s);
963
+ return;
964
+ }
965
+ const h = s.key;
966
+ if (s.ctrlKey || s.metaKey || s.altKey) {
967
+ G?.(s);
968
+ return;
969
+ }
970
+ if (ln && (h === "ArrowUp" || h === "ArrowDown")) {
971
+ const _e = rn(), Re = _e ? xn(_e) : null;
972
+ if (Re) {
973
+ s.preventDefault();
974
+ const Me = h === "ArrowUp" ? 1 : -1;
975
+ let { minutes: He, seconds: Ke } = Re;
976
+ v ? Ke = ((Ke + Me) % 60 + 60) % 60 : He = ((He + Me * b) % 60 + 60) % 60, gn(ot(_e, Re.hours, He, Ke, v)), G?.(s);
977
+ return;
978
+ }
979
+ }
980
+ const S = Qe.current;
981
+ if (h === "Escape" && S.length > 0) {
982
+ s.preventDefault(), Pe("", 0), G?.(s);
983
+ return;
984
+ }
985
+ if (P && (M.isoTpl === "yyyy-MM-dd" || M.isoTpl === "yyyy-MM-ddTHH:mm" || M.isoTpl === "yyyy-MM")) {
986
+ const _e = (Me) => {
987
+ const He = String(Me.getFullYear()).padStart(4, "0"), Ke = String(Me.getMonth() + 1).padStart(2, "0"), Mn = String(Me.getDate()).padStart(2, "0");
988
+ let $n = "";
989
+ if (M.isoTpl === "yyyy-MM")
990
+ $n = He + Ke;
991
+ else if (M.isoTpl === "yyyy-MM-dd")
992
+ $n = He + Ke + Mn;
993
+ else {
994
+ const Tt = String(Me.getHours()).padStart(2, "0"), Dt = String(Me.getMinutes()).padStart(2, "0");
995
+ $n = He + Ke + Mn + Tt + Dt;
996
+ }
997
+ Pe($n.slice(0, Ie), Ie);
998
+ }, Re = () => {
999
+ if (T && /^\d{4}-\d{2}/.test(T)) {
1000
+ const Me = new Date(T);
1001
+ if (!Number.isNaN(Me.getTime()))
1002
+ return Me;
1003
+ }
1004
+ return /* @__PURE__ */ new Date();
1005
+ };
1006
+ if (h === "t" || h === "T") {
1007
+ s.preventDefault(), _e(/* @__PURE__ */ new Date()), G?.(s);
1008
+ return;
1009
+ }
1010
+ if (h === "+" || h === "=" || h === "-") {
1011
+ s.preventDefault();
1012
+ const Me = h === "-" ? -1 : 1, He = Re();
1013
+ He.setDate(He.getDate() + Me), _e(He), G?.(s);
1014
+ return;
1015
+ }
1016
+ if (h === "m" || h === "M") {
1017
+ s.preventDefault();
1018
+ const Me = Re();
1019
+ Me.setMonth(Me.getMonth() + (h === "M" ? -1 : 1)), _e(Me), G?.(s);
1020
+ return;
1021
+ }
1022
+ if (h === "y" || h === "Y") {
1023
+ s.preventDefault();
1024
+ const Me = Re();
1025
+ Me.setFullYear(Me.getFullYear() + (h === "Y" ? -1 : 1)), _e(Me), G?.(s);
1026
+ return;
1027
+ }
1028
+ }
1029
+ const ge = s.currentTarget, Ue = ge.selectionStart ?? 0, Be = ge.selectionEnd ?? 0;
1030
+ if (/^[0-9]$/.test(h)) {
1031
+ s.preventDefault();
1032
+ const _e = Je(M.displayTpl, Ue, S), Re = Je(M.displayTpl, Be, S), Me = S.slice(0, _e), He = S.slice(Re);
1033
+ let Ke = (Me + h + He).slice(0, Ie);
1034
+ _e === Re && Me.length + 1 + He.length > Ie && (Ke = (Me + h + He.slice(1)).slice(0, Ie)), Pe(Ke, _e + 1), G?.(s);
1035
+ return;
1036
+ }
1037
+ if (h === "Backspace") {
1038
+ if (s.preventDefault(), Ue !== Be) {
1039
+ const _e = Je(M.displayTpl, Ue, S), Re = Je(M.displayTpl, Be, S), Me = S.slice(0, _e) + S.slice(Re);
1040
+ Pe(Me, _e);
1041
+ } else {
1042
+ const _e = Je(M.displayTpl, Ue, S);
1043
+ if (_e === 0) {
1044
+ G?.(s);
1045
+ return;
1046
+ }
1047
+ const Re = S.slice(0, _e - 1) + S.slice(_e);
1048
+ Pe(Re, _e - 1);
1049
+ }
1050
+ G?.(s);
1051
+ return;
1052
+ }
1053
+ if (h === "Delete") {
1054
+ if (s.preventDefault(), Ue !== Be) {
1055
+ const _e = Je(M.displayTpl, Ue, S), Re = Je(M.displayTpl, Be, S), Me = S.slice(0, _e) + S.slice(Re);
1056
+ Pe(Me, _e);
1057
+ } else {
1058
+ const _e = Je(M.displayTpl, Ue, S);
1059
+ if (_e >= S.length) {
1060
+ G?.(s);
1061
+ return;
1062
+ }
1063
+ const Re = S.slice(0, _e) + S.slice(_e + 1);
1064
+ Pe(Re, _e);
1065
+ }
1066
+ G?.(s);
1067
+ return;
1068
+ }
1069
+ G?.(s);
1070
+ },
1071
+ [
1072
+ Pe,
1073
+ a,
1074
+ Fn,
1075
+ G,
1076
+ o,
1077
+ M.displayTpl,
1078
+ M.isoTpl,
1079
+ Ie,
1080
+ P,
1081
+ T,
1082
+ ln,
1083
+ rn,
1084
+ gn,
1085
+ v,
1086
+ b
1087
+ ]
1088
+ ), [bn, Pn] = Te(() => Date.now());
1089
+ Fe(() => {
1090
+ if (!L)
1091
+ return;
1092
+ const s = window.setInterval(
1093
+ () => Pn(Date.now()),
1094
+ Math.max(100, J)
1095
+ );
1096
+ return () => window.clearInterval(s);
1097
+ }, [L, J]);
1098
+ const un = ve(
1099
+ () => oi(T, u, bn),
1100
+ [T, u, bn]
1101
+ ), In = Ce(0);
1102
+ Fe(() => {
1103
+ if (!C)
1104
+ return;
1105
+ const s = un.getTime();
1106
+ s !== In.current && (In.current = s, C(un));
1107
+ }, [un, C]);
1108
+ const Dn = ve(() => {
1109
+ if (!L)
1110
+ return null;
1111
+ const s = un.getTime() - bn;
1112
+ return he ? he(s, un) : (ci[te] ?? ht)(s, m ?? le("datetime.countdownDone", "Done"));
1113
+ }, [L, un, bn, he, te, m, le]), r = x(
1114
+ (s) => {
1115
+ if (o || a)
1116
+ return;
1117
+ const h = s.clipboardData.getData("text");
1118
+ if (!h)
1119
+ return;
1120
+ s.preventDefault();
1121
+ const S = Qe.current, ge = h.replace(/[^0-9]/g, "");
1122
+ let Ue;
1123
+ ge.length === Ie && (h.includes("-") || h.includes("T")) ? Ue = fn(M.displayTpl, M.isoTpl, ge) : Ue = ge.slice(0, Ie);
1124
+ const Be = s.currentTarget, _e = Be.selectionStart ?? 0, Re = Be.selectionEnd ?? 0, Me = Je(M.displayTpl, _e, S), He = Je(M.displayTpl, Re, S), Ke = S.slice(0, Me), Mn = S.slice(He), $n = (Ke + Ue + Mn).slice(0, Ie);
1125
+ Pe($n, Math.min(Ie, Ke.length + Ue.length));
1126
+ },
1127
+ [Pe, a, o, M.displayTpl, M.isoTpl, Ie]
1128
+ ), I = x(
1129
+ (s) => {
1130
+ const h = s;
1131
+ if (h.inputType === "insertText" || h.inputType === "insertCompositionText" || h.inputType === "insertFromComposition") {
1132
+ const S = h.data ?? "";
1133
+ if (!/^[0-9]+$/.test(S)) {
1134
+ s.preventDefault();
1135
+ return;
1136
+ }
1137
+ if (S.length > 1) {
1138
+ s.preventDefault();
1139
+ const ge = s.currentTarget, Ue = ge.selectionStart ?? 0, Be = ge.selectionEnd ?? 0, _e = Qe.current, Re = Je(M.displayTpl, Ue, _e), Me = Je(M.displayTpl, Be, _e), He = _e.slice(0, Re), Ke = _e.slice(Me), Mn = (He + S + Ke).slice(0, Ie);
1140
+ Pe(Mn, Math.min(Ie, He.length + S.length));
1141
+ }
1142
+ }
1143
+ },
1144
+ [Pe, M.displayTpl, Ie]
1145
+ ), ce = x(
1146
+ (s) => {
1147
+ if (o || a)
1148
+ return;
1149
+ const h = s.target.value, S = h.replace(/[^0-9]/g, "").slice(0, Ie);
1150
+ if (S !== Qe.current)
1151
+ if (S.length === Ie && (h.includes("-") || h.includes("T") || h.includes(":"))) {
1152
+ const ge = fn(M.displayTpl, M.isoTpl, S);
1153
+ Pe(ge, ge.length);
1154
+ } else
1155
+ Pe(S, S.length);
1156
+ },
1157
+ [Pe, a, o, M.displayTpl, M.isoTpl, Ie]
1158
+ ), $e = x(() => {
1159
+ Pe("", 0), requestAnimationFrame(() => Se.current?.focus());
1160
+ }, [Pe]), De = x(() => {
1161
+ if (a || o)
1162
+ return;
1163
+ if (Ne === "date" || Ne === "datetime-local" || Ne === "time") {
1164
+ de((S) => !S);
1165
+ return;
1166
+ }
1167
+ const s = f.current;
1168
+ if (!s)
1169
+ return;
1170
+ const h = s;
1171
+ try {
1172
+ if (typeof h.showPicker == "function") {
1173
+ h.showPicker();
1174
+ return;
1175
+ }
1176
+ } catch {
1177
+ }
1178
+ s.focus(), s.click();
1179
+ }, [a, o, Ne]), fe = x(
1180
+ (s) => {
1181
+ const h = s.target.value, S = wn(h, M.isoTpl), ge = fn(M.displayTpl, M.isoTpl, S);
1182
+ qe.current = h, on(ge), H?.(h), requestAnimationFrame(() => Se.current?.focus());
1183
+ },
1184
+ [H, M.displayTpl, M.isoTpl]
1185
+ ), Ee = x(() => {
1186
+ if (a || o)
1187
+ return;
1188
+ const s = /* @__PURE__ */ new Date(), h = (Re) => String(Re).padStart(2, "0"), S = `${s.getFullYear()}-${h(s.getMonth() + 1)}-${h(s.getDate())}`, ge = `${h(s.getHours())}:${h(s.getMinutes())}`, Ue = v ? `${ge}:${h(s.getSeconds())}` : ge;
1189
+ let Be;
1190
+ Ne === "time" ? Be = Ue : Ne === "datetime-local" ? Be = `${S}T${Ue}` : Ne === "month" ? Be = `${s.getFullYear()}-${h(s.getMonth() + 1)}` : Be = S;
1191
+ const _e = wn(Be, M.isoTpl);
1192
+ qe.current = Be, on(fn(M.displayTpl, M.isoTpl, _e)), H?.(Be);
1193
+ }, [a, o, Ne, v, H, M.displayTpl, M.isoTpl]), Ae = Ne === "date" || Ne === "datetime-local", je = (() => {
1194
+ const s = /^(\d{4}-\d{2}-\d{2})/.exec(T ?? "");
1195
+ return s ? s[1] : "";
1196
+ })(), yn = xn(T ?? "") ?? { hours: 0, minutes: 0, seconds: 0 }, Cn = () => {
1197
+ const s = /* @__PURE__ */ new Date();
1198
+ return `${s.getFullYear()}-${Le(s.getMonth() + 1)}-${Le(s.getDate())}`;
1199
+ }, pn = (s, h) => {
1200
+ const S = v ? `${Le(h.hours)}:${Le(h.minutes)}:${Le(h.seconds)}` : `${Le(h.hours)}:${Le(h.minutes)}`;
1201
+ let ge;
1202
+ Ne === "time" ? ge = S : Ne === "datetime-local" ? ge = `${s}T${S}` : ge = s, gn(ge);
1203
+ }, Sn = (s) => {
1204
+ s && pn(s, ln ? yn : { hours: 0, minutes: 0, seconds: 0 });
1205
+ }, Nn = (s, h) => {
1206
+ pn(Ae ? je || Cn() : "", { ...yn, [s]: h });
1207
+ }, zn = (s) => s === "hours" ? 23 : 59, Bn = (s) => s === "minutes" && b && b > 0 ? b : 1, An = (s, h) => {
1208
+ const S = zn(s), ge = Bn(s), Ue = S + 1, Be = ((yn[s] + h * ge) % Ue + Ue) % Ue;
1209
+ Nn(s, Be);
1210
+ }, Gn = (s, h, S) => /* @__PURE__ */ e(
1211
+ ui,
1212
+ {
1213
+ part: s,
1214
+ label: le(h, S),
1215
+ value: yn[s],
1216
+ max: zn(s),
1217
+ step: Bn(s),
1218
+ onPick: (ge) => Nn(s, ge),
1219
+ onStep: (ge) => An(s, ge),
1220
+ startHold: A,
1221
+ stopHold: we
1222
+ }
1223
+ ), Mt = () => {
1224
+ pn(Cn(), ln ? yn : { hours: 0, minutes: 0, seconds: 0 });
1225
+ }, $t = () => {
1226
+ de(!1), requestAnimationFrame(() => Se.current?.focus());
1227
+ };
1228
+ ut(() => {
1229
+ if (!ue)
1230
+ return;
1231
+ const s = c.current?.getBoundingClientRect();
1232
+ s && (g({ left: s.left, top: s.bottom + 6 }), Ze(Ht(c.current)));
1233
+ }, [ue]), Fe(() => {
1234
+ if (!ue)
1235
+ return;
1236
+ const s = (ge) => {
1237
+ const Ue = ge.target;
1238
+ c.current?.contains(Ue) || N.current?.contains(Ue) || de(!1);
1239
+ }, h = (ge) => {
1240
+ ge.key === "Escape" && de(!1);
1241
+ }, S = () => {
1242
+ const ge = c.current?.getBoundingClientRect();
1243
+ ge && g({ left: ge.left, top: ge.bottom + 6 });
1244
+ };
1245
+ return document.addEventListener("mousedown", s), document.addEventListener("keydown", h), window.addEventListener("scroll", S, !0), window.addEventListener("resize", S), () => {
1246
+ document.removeEventListener("mousedown", s), document.removeEventListener("keydown", h), window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S);
1247
+ };
1248
+ }, [ue]);
1249
+ const wt = x(
1250
+ (s) => {
1251
+ Se.current = s, typeof E == "function" ? E(s) : E && (E.current = s);
1252
+ },
1253
+ [E]
1254
+ ), nt = ve(() => {
1255
+ const s = [];
1256
+ return _ && s.push(Ge.submit), s.push({ key: "Esc", description: le("shortcuts.clearDate", "Clear value") }), s;
1257
+ }, [_, le]), kt = Ne === "time";
1258
+ return ee ? null : /* @__PURE__ */ p(
1259
+ "div",
1260
+ {
1261
+ className: `nice-field nice-field--${d}${ae ? ` nice-field--label-${ae}` : ""}${z === "right" ? " nice-field--error-right" : ""} ${R ? "nice-field--loading" : ""} ${B || ""}`,
1262
+ style: {
1263
+ ...ne,
1264
+ ...F != null && {
1265
+ "--nice-field-label-width": typeof F == "number" ? `${F}px` : F
1266
+ },
1267
+ ...D != null && {
1268
+ "--nice-field-control-width": typeof D == "number" ? `${D}px` : D
1269
+ }
1270
+ },
1271
+ "aria-busy": R || void 0,
1272
+ children: [
1273
+ n && /* @__PURE__ */ p(
1274
+ "label",
1275
+ {
1276
+ htmlFor: ye,
1277
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
1278
+ children: [
1279
+ n,
1280
+ Z && nt.length > 0 && /* @__PURE__ */ e(mn, { shortcuts: nt, size: "sm" })
1281
+ ]
1282
+ }
1283
+ ),
1284
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
1285
+ /* @__PURE__ */ p(
1286
+ "div",
1287
+ {
1288
+ ref: c,
1289
+ className: `nice-input nice-input--date nice-input--${d} nice-input--ds-${xe} ${t ? "nice-input--error" : ""} ${a ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`,
1290
+ style: { ...oe, width: "fit-content", position: "relative" },
1291
+ children: [
1292
+ /* @__PURE__ */ e(
1293
+ "input",
1294
+ {
1295
+ ref: wt,
1296
+ id: ye,
1297
+ className: "nice-input__native nice-masked-input",
1298
+ type: "text",
1299
+ name: y,
1300
+ value: kn,
1301
+ placeholder: dn,
1302
+ disabled: a || R,
1303
+ readOnly: o,
1304
+ autoComplete: "off",
1305
+ spellCheck: !1,
1306
+ inputMode: "numeric",
1307
+ "aria-invalid": !!t,
1308
+ "aria-label": n ? void 0 : le("controls.date", "Date"),
1309
+ "data-display-tpl": M.displayTpl,
1310
+ "data-iso-tpl": M.isoTpl,
1311
+ style: {
1312
+ width: `${hn}ch`,
1313
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
1314
+ fontVariantNumeric: "tabular-nums"
1315
+ },
1316
+ onBeforeInput: I,
1317
+ onChange: ce,
1318
+ onBlur: re,
1319
+ onKeyDown: Hn,
1320
+ onPaste: r
1321
+ }
1322
+ ),
1323
+ U && /* @__PURE__ */ e(
1324
+ "button",
1325
+ {
1326
+ type: "button",
1327
+ className: "nice-input__clear",
1328
+ onClick: $e,
1329
+ disabled: !T || a || o,
1330
+ "aria-label": le("controls.clear", "Clear"),
1331
+ tabIndex: T && !a && !o ? 0 : -1,
1332
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
1333
+ }
1334
+ ),
1335
+ O && /* @__PURE__ */ p(_n, { children: [
1336
+ /* @__PURE__ */ e(
1337
+ "button",
1338
+ {
1339
+ type: "button",
1340
+ className: "nice-input__picker-trigger",
1341
+ onClick: De,
1342
+ "aria-label": le("controls.openPicker", "Open picker"),
1343
+ tabIndex: -1,
1344
+ disabled: a || o,
1345
+ children: kt ? (
1346
+ /* Clock icon */
1347
+ /* @__PURE__ */ p(
1348
+ "svg",
1349
+ {
1350
+ width: "16",
1351
+ height: "16",
1352
+ viewBox: "0 0 24 24",
1353
+ fill: "none",
1354
+ "aria-hidden": "true",
1355
+ focusable: "false",
1356
+ children: [
1357
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", strokeWidth: "1.8" }),
1358
+ /* @__PURE__ */ e(
1359
+ "path",
1360
+ {
1361
+ d: "M12 7v5l3.5 2",
1362
+ stroke: "currentColor",
1363
+ strokeWidth: "1.8",
1364
+ strokeLinecap: "round",
1365
+ strokeLinejoin: "round"
1366
+ }
1367
+ )
1368
+ ]
1369
+ }
1370
+ )
1371
+ ) : (
1372
+ /* Calendar icon — outline style, matches NtdCalendar.outline */
1373
+ /* @__PURE__ */ p(
1374
+ "svg",
1375
+ {
1376
+ width: "16",
1377
+ height: "16",
1378
+ viewBox: "0 0 24 24",
1379
+ fill: "none",
1380
+ "aria-hidden": "true",
1381
+ focusable: "false",
1382
+ children: [
1383
+ /* @__PURE__ */ e(
1384
+ "rect",
1385
+ {
1386
+ x: "3.25",
1387
+ y: "4.5",
1388
+ width: "17.5",
1389
+ height: "16.5",
1390
+ rx: "2",
1391
+ stroke: "currentColor",
1392
+ strokeWidth: "1.7"
1393
+ }
1394
+ ),
1395
+ /* @__PURE__ */ e(
1396
+ "line",
1397
+ {
1398
+ x1: "16",
1399
+ y1: "2.5",
1400
+ x2: "16",
1401
+ y2: "6.5",
1402
+ stroke: "currentColor",
1403
+ strokeWidth: "1.7",
1404
+ strokeLinecap: "round"
1405
+ }
1406
+ ),
1407
+ /* @__PURE__ */ e(
1408
+ "line",
1409
+ {
1410
+ x1: "8",
1411
+ y1: "2.5",
1412
+ x2: "8",
1413
+ y2: "6.5",
1414
+ stroke: "currentColor",
1415
+ strokeWidth: "1.7",
1416
+ strokeLinecap: "round"
1417
+ }
1418
+ ),
1419
+ /* @__PURE__ */ e(
1420
+ "line",
1421
+ {
1422
+ x1: "3.25",
1423
+ y1: "9.75",
1424
+ x2: "20.75",
1425
+ y2: "9.75",
1426
+ stroke: "currentColor",
1427
+ strokeWidth: "1.5"
1428
+ }
1429
+ )
1430
+ ]
1431
+ }
1432
+ )
1433
+ )
1434
+ }
1435
+ ),
1436
+ /* @__PURE__ */ e(
1437
+ "input",
1438
+ {
1439
+ ref: f,
1440
+ type: Ne,
1441
+ className: "nice-input__picker-companion",
1442
+ value: T ?? "",
1443
+ min: V,
1444
+ max: j,
1445
+ step: Ne === "time" || Ne === "datetime-local" ? v ? 1 : b ? b * 60 : void 0 : void 0,
1446
+ onChange: fe,
1447
+ tabIndex: -1,
1448
+ "aria-hidden": "true",
1449
+ style: {
1450
+ position: "absolute",
1451
+ width: 0,
1452
+ height: 0,
1453
+ opacity: 0,
1454
+ pointerEvents: "none",
1455
+ border: 0,
1456
+ padding: 0,
1457
+ left: 0,
1458
+ bottom: 0
1459
+ }
1460
+ }
1461
+ )
1462
+ ] }),
1463
+ ln && se === "12" && !a && !o && /* @__PURE__ */ e(
1464
+ "button",
1465
+ {
1466
+ type: "button",
1467
+ className: "nice-input__ampm",
1468
+ onClick: Tn,
1469
+ disabled: !T,
1470
+ "aria-label": le("datetime.toggleAmPm", "Toggle AM/PM"),
1471
+ tabIndex: -1,
1472
+ children: Ln
1473
+ }
1474
+ ),
1475
+ q && !a && !o && /* @__PURE__ */ e("button", { type: "button", className: "nice-input__now", onClick: Ee, tabIndex: -1, children: le("controls.now", "Now") })
1476
+ ]
1477
+ }
1478
+ ),
1479
+ ue && Q && pe && ft(
1480
+ /* @__PURE__ */ p(
1481
+ "div",
1482
+ {
1483
+ ref: N,
1484
+ className: `nice-datetime-popup${Ye ? ` ${Ye}` : ""}`,
1485
+ style: {
1486
+ position: "fixed",
1487
+ left: Q.left,
1488
+ top: Q.top,
1489
+ zIndex: 1e3
1490
+ },
1491
+ role: "dialog",
1492
+ "aria-label": le("controls.openPicker", "Open picker"),
1493
+ children: [
1494
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__body", children: [
1495
+ Ae && /* @__PURE__ */ e("div", { className: "nice-datetime-popup__col nice-datetime-popup__col--date", children: /* @__PURE__ */ e(
1496
+ mt,
1497
+ {
1498
+ value: je,
1499
+ onChange: Sn,
1500
+ min: V && V.length >= 10 ? V.slice(0, 10) : void 0,
1501
+ max: j && j.length >= 10 ? j.slice(0, 10) : void 0
1502
+ }
1503
+ ) }),
1504
+ ln && /* @__PURE__ */ e("div", { className: "nice-datetime-popup__col nice-datetime-popup__col--time", children: /* @__PURE__ */ p("div", { className: "nice-datetime-popup__time", role: "group", children: [
1505
+ Gn("hours", "datetime.hours", "Hours"),
1506
+ /* @__PURE__ */ e("span", { className: "nice-datetime-popup__time-sep", children: ":" }),
1507
+ Gn("minutes", "datetime.minutes", "Minutes"),
1508
+ v && /* @__PURE__ */ p(_n, { children: [
1509
+ /* @__PURE__ */ e("span", { className: "nice-datetime-popup__time-sep", children: ":" }),
1510
+ Gn("seconds", "datetime.seconds", "Seconds")
1511
+ ] })
1512
+ ] }) })
1513
+ ] }),
1514
+ /* @__PURE__ */ p("div", { className: "nice-datetime-popup__footer", children: [
1515
+ U && /* @__PURE__ */ e(
1516
+ "button",
1517
+ {
1518
+ type: "button",
1519
+ className: "nice-datetime-popup__btn",
1520
+ onClick: $e,
1521
+ children: le("controls.clear", "Clear")
1522
+ }
1523
+ ),
1524
+ Ae && /* @__PURE__ */ e(
1525
+ "button",
1526
+ {
1527
+ type: "button",
1528
+ className: "nice-datetime-popup__btn",
1529
+ onClick: Mt,
1530
+ children: le("controls.today", "Today")
1531
+ }
1532
+ ),
1533
+ ln && /* @__PURE__ */ e("button", { type: "button", className: "nice-datetime-popup__btn", onClick: Ee, children: le("controls.now", "Now") }),
1534
+ /* @__PURE__ */ e(
1535
+ "button",
1536
+ {
1537
+ type: "button",
1538
+ className: "nice-datetime-popup__btn nice-datetime-popup__btn--primary",
1539
+ onClick: $t,
1540
+ children: le("controls.confirm", "Confirm")
1541
+ }
1542
+ )
1543
+ ] })
1544
+ ]
1545
+ }
1546
+ ),
1547
+ pe
1548
+ ),
1549
+ L && Dn != null && /* @__PURE__ */ p("span", { className: "nice-datetime__countdown", "aria-live": "polite", children: [
1550
+ be && /* @__PURE__ */ p("span", { className: "nice-datetime__countdown-label", children: [
1551
+ be,
1552
+ " "
1553
+ ] }),
1554
+ /* @__PURE__ */ e("span", { className: "nice-datetime__countdown-value", children: Dn })
1555
+ ] }),
1556
+ R && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1557
+ z === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
1558
+ z === "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
1559
+ ] }),
1560
+ z !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
1561
+ z !== "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
1562
+ ]
1563
+ }
1564
+ );
1565
+ }
1566
+ );
1567
+ Un.displayName = "NiceDateTimePicker";
1568
+ const Ii = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1569
+ __proto__: null,
1570
+ NiceDateTimePicker: Un
1571
+ }, Symbol.toStringTag, { value: "Module" })), gt = ({
1572
+ label: n,
1573
+ helperText: i,
1574
+ error: t,
1575
+ required: l,
1576
+ disabled: a,
1577
+ size: o = "md",
1578
+ name: d,
1579
+ id: y,
1580
+ className: w,
1581
+ style: B,
1582
+ accessMode: ne,
1583
+ options: k,
1584
+ value: T,
1585
+ onChange: H,
1586
+ direction: re = "horizontal",
1587
+ showKeyboardHints: G,
1588
+ displayStyle: V,
1589
+ labelPlacement: j,
1590
+ errorPlacement: Y,
1591
+ labelWidth: me,
1592
+ controlWidth: _,
1593
+ loading: ie,
1594
+ readOnly: Z
1595
+ }) => {
1596
+ En("toggle", V);
1597
+ const X = sn(ne, y), ae = X === "hidden";
1598
+ (X === "disabled" || X === "readOnly") && (a = !0);
1599
+ const { t: z } = Oe(), R = cn(y), F = d || R, D = ve(
1600
+ () => [
1601
+ { key: "ArrowUp", description: z("shortcuts.previousOption", "Previous option") },
1602
+ { key: "ArrowDown", description: z("shortcuts.nextOption", "Next option") },
1603
+ { key: "Space", description: z("shortcuts.select", "Select") }
1604
+ ],
1605
+ [z]
1606
+ );
1607
+ return ae ? null : /* @__PURE__ */ p(
1608
+ "div",
1609
+ {
1610
+ className: `nice-field nice-field--inline nice-field--inline-block nice-field--${o} ${j === "left" ? "nice-field--label-left" : ""} ${Y === "right" ? "nice-field--error-right" : ""} ${ie ? "nice-field--loading" : ""} ${w || ""}`,
1611
+ style: {
1612
+ ...B,
1613
+ ...me != null && {
1614
+ "--nice-field-label-width": typeof me == "number" ? `${me}px` : me
1615
+ },
1616
+ ..._ != null && {
1617
+ "--nice-field-control-width": typeof _ == "number" ? `${_}px` : _
1618
+ }
1619
+ },
1620
+ role: "radiogroup",
1621
+ "aria-labelledby": `${R}-label`,
1622
+ "aria-busy": ie || void 0,
1623
+ children: [
1624
+ n && /* @__PURE__ */ p(
1625
+ "span",
1626
+ {
1627
+ id: `${R}-label`,
1628
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
1629
+ children: [
1630
+ n,
1631
+ G && /* @__PURE__ */ e(mn, { shortcuts: D, size: "sm" })
1632
+ ]
1633
+ }
1634
+ ),
1635
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
1636
+ /* @__PURE__ */ e(
1637
+ "div",
1638
+ {
1639
+ className: `nice-radio-group ${re === "vertical" ? "nice-radio-group--vertical" : ""}`,
1640
+ children: k.map((K) => /* @__PURE__ */ p(
1641
+ "label",
1642
+ {
1643
+ className: `nice-radio ${a || K.disabled || ie ? "nice-radio--disabled" : ""} ${Z ? "nice-radio--readonly" : ""}`,
1644
+ children: [
1645
+ /* @__PURE__ */ e(
1646
+ "input",
1647
+ {
1648
+ type: "radio",
1649
+ className: "nice-radio__input",
1650
+ name: F,
1651
+ value: K.value,
1652
+ checked: T === K.value,
1653
+ disabled: a || K.disabled || ie,
1654
+ "aria-readonly": Z || void 0,
1655
+ onChange: () => {
1656
+ Z || H?.(K.value);
1657
+ }
1658
+ }
1659
+ ),
1660
+ /* @__PURE__ */ e("span", { className: "nice-radio__circle", children: /* @__PURE__ */ e("span", { className: "nice-radio__dot" }) }),
1661
+ /* @__PURE__ */ e("span", { children: K.label })
1662
+ ]
1663
+ },
1664
+ K.value
1665
+ ))
1666
+ }
1667
+ ),
1668
+ ie && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1669
+ Y === "right" && t && /* @__PURE__ */ e("div", { id: `${R}-error`, className: "nice-field__error", role: "alert", children: t }),
1670
+ Y === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${R}-helper`, className: "nice-field__helper", children: i })
1671
+ ] }),
1672
+ Y !== "right" && t && /* @__PURE__ */ e("div", { id: `${R}-error`, className: "nice-field__error", role: "alert", children: t }),
1673
+ Y !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${R}-helper`, className: "nice-field__helper", children: i })
1674
+ ]
1675
+ }
1676
+ );
1677
+ }, zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1678
+ __proto__: null,
1679
+ NiceRadioGroup: gt
1680
+ }, Symbol.toStringTag, { value: "Module" })), Qn = vn(
1681
+ ({
1682
+ label: n,
1683
+ helperText: i,
1684
+ error: t,
1685
+ required: l,
1686
+ disabled: a,
1687
+ id: o,
1688
+ className: d,
1689
+ style: y,
1690
+ accessMode: w,
1691
+ value: B = 0,
1692
+ onChange: ne,
1693
+ min: k = 0,
1694
+ max: T = 100,
1695
+ step: H = 1,
1696
+ showValue: re = !0,
1697
+ showMinMax: G = !1,
1698
+ formatValue: V,
1699
+ showKeyboardHints: j,
1700
+ displayStyle: Y,
1701
+ size: me = "md",
1702
+ labelPlacement: _,
1703
+ errorPlacement: ie,
1704
+ labelWidth: Z,
1705
+ controlWidth: X,
1706
+ loading: ae,
1707
+ showTicks: z = !1,
1708
+ tickInterval: R,
1709
+ maxTicks: F = 21,
1710
+ showTickLabels: D = !1
1711
+ }, K) => {
1712
+ En("input", Y);
1713
+ const U = sn(w, o), O = U === "hidden";
1714
+ (U === "disabled" || U === "readOnly") && (a = !0);
1715
+ const { t: W } = Oe(), P = cn(o), v = ve(() => (B - k) / (T - k) * 100, [B, k, T]), b = V ? V(B) : B.toString(), q = ve(() => {
1716
+ if (!z)
1717
+ return [];
1718
+ const C = T - k;
1719
+ if (C <= 0)
1720
+ return [k, T];
1721
+ let L = R ?? H, te = Math.floor(C / L) + 1;
1722
+ return te > F && (L = C / (F - 1), te = F), Array.from({ length: te }, (he, be) => {
1723
+ const J = k + be * L;
1724
+ return be === te - 1 ? T : J;
1725
+ });
1726
+ }, [z, k, T, H, R, F]), se = ve(
1727
+ () => [
1728
+ Ge.increment,
1729
+ Ge.decrement,
1730
+ Ge.first,
1731
+ Ge.last,
1732
+ Ge.incrementBig,
1733
+ Ge.decrementBig
1734
+ ],
1735
+ []
1736
+ ), u = _ === "left";
1737
+ return O ? null : /* @__PURE__ */ p(
1738
+ "div",
1739
+ {
1740
+ className: `nice-field nice-field--${me} ${u ? "nice-field--label-left" : ""} ${ae ? "nice-field--loading" : ""} ${d || ""}`,
1741
+ style: {
1742
+ ...y,
1743
+ ...Z != null && {
1744
+ "--nice-field-label-width": typeof Z == "number" ? `${Z}px` : Z
1745
+ },
1746
+ ...X != null && {
1747
+ "--nice-field-control-width": typeof X == "number" ? `${X}px` : X
1748
+ }
1749
+ },
1750
+ "aria-busy": ae || void 0,
1751
+ children: [
1752
+ u ? n && /* @__PURE__ */ p(
1753
+ "label",
1754
+ {
1755
+ htmlFor: P,
1756
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
1757
+ children: [
1758
+ n,
1759
+ j && /* @__PURE__ */ e(mn, { shortcuts: se, size: "sm" })
1760
+ ]
1761
+ }
1762
+ ) : (n || re || j) && /* @__PURE__ */ p("div", { className: "nice-slider__header", children: [
1763
+ n ? /* @__PURE__ */ p(
1764
+ "label",
1765
+ {
1766
+ htmlFor: P,
1767
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
1768
+ children: [
1769
+ n,
1770
+ j && /* @__PURE__ */ e(mn, { shortcuts: se, size: "sm" })
1771
+ ]
1772
+ }
1773
+ ) : /* @__PURE__ */ e("span", {}),
1774
+ re && /* @__PURE__ */ e("span", { className: "nice-slider__value nice-slider__value--header", children: b })
1775
+ ] }),
1776
+ /* @__PURE__ */ p("div", { className: "nice-field__control nice-field__control--slider", children: [
1777
+ /* @__PURE__ */ p(
1778
+ "div",
1779
+ {
1780
+ className: `nice-slider ${a || ae ? "nice-slider--disabled" : ""} ${z ? "nice-slider--with-ticks" : ""}`,
1781
+ children: [
1782
+ /* @__PURE__ */ p("div", { className: "nice-slider__track-wrapper", children: [
1783
+ /* @__PURE__ */ e("div", { className: "nice-slider__track", children: /* @__PURE__ */ e("div", { className: "nice-slider__fill", style: { width: `${v}%` } }) }),
1784
+ z && q.length > 0 && /* @__PURE__ */ e("div", { className: "nice-slider__ticks", "aria-hidden": "true", children: q.map((C, L) => {
1785
+ const te = (C - k) / (T - k) * 100, he = C <= B;
1786
+ return /* @__PURE__ */ e(
1787
+ "span",
1788
+ {
1789
+ className: `nice-slider__tick ${he ? "nice-slider__tick--active" : ""}`,
1790
+ style: { left: `${te}%` },
1791
+ children: D && /* @__PURE__ */ e("span", { className: "nice-slider__tick-label", children: V ? V(C) : C })
1792
+ },
1793
+ L
1794
+ );
1795
+ }) }),
1796
+ /* @__PURE__ */ e(
1797
+ "input",
1798
+ {
1799
+ ref: K,
1800
+ id: P,
1801
+ type: "range",
1802
+ className: "nice-slider__native",
1803
+ min: k,
1804
+ max: T,
1805
+ step: H,
1806
+ value: B,
1807
+ disabled: a || ae,
1808
+ "aria-valuenow": B,
1809
+ "aria-valuemin": k,
1810
+ "aria-valuemax": T,
1811
+ onChange: (C) => ne?.(parseFloat(C.target.value))
1812
+ }
1813
+ ),
1814
+ /* @__PURE__ */ e("div", { className: "nice-slider__thumb-visual", style: { left: `${v}%` } })
1815
+ ] }),
1816
+ G && /* @__PURE__ */ p("div", { className: "nice-slider__labels", children: [
1817
+ /* @__PURE__ */ e("span", { children: V ? V(k) : k }),
1818
+ /* @__PURE__ */ e("span", { children: V ? V(T) : T })
1819
+ ] })
1820
+ ]
1821
+ }
1822
+ ),
1823
+ u && re && /* @__PURE__ */ e("span", { className: "nice-slider__value nice-slider__value--inline", children: b }),
1824
+ ae && /* @__PURE__ */ e("span", { className: "nice-field__spinner nice-field__spinner--slider", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1825
+ ie === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error nice-field__error--slider", role: "alert", children: t }),
1826
+ ie === "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper nice-field__helper--slider", children: i })
1827
+ ] }),
1828
+ ie !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
1829
+ ie !== "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
1830
+ ]
1831
+ }
1832
+ );
1833
+ }
1834
+ );
1835
+ Qn.displayName = "NiceSlider";
1836
+ const Bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1837
+ __proto__: null,
1838
+ NiceSlider: Qn
1839
+ }, Symbol.toStringTag, { value: "Module" }));
1840
+ function pi({ text: n, query: i }) {
1841
+ if (!i)
1842
+ return /* @__PURE__ */ e(_n, { children: n });
1843
+ const t = n.toLowerCase().indexOf(i.toLowerCase());
1844
+ return t < 0 ? /* @__PURE__ */ e(_n, { children: n }) : /* @__PURE__ */ p("span", { children: [
1845
+ n.slice(0, t),
1846
+ /* @__PURE__ */ e("strong", { children: n.slice(t, t + i.length) }),
1847
+ n.slice(t + i.length)
1848
+ ] });
1849
+ }
1850
+ const fi = ({
1851
+ options: n,
1852
+ value: i,
1853
+ onChange: t,
1854
+ minSearchLength: l = 1,
1855
+ maxResults: a = 10,
1856
+ onSearch: o,
1857
+ clearable: d,
1858
+ loading: y,
1859
+ multiple: w,
1860
+ renderOption: B,
1861
+ highlightMatch: ne = !0,
1862
+ showAll: k = !0,
1863
+ menuGap: T,
1864
+ label: H,
1865
+ error: re,
1866
+ helperText: G,
1867
+ required: V,
1868
+ disabled: j,
1869
+ readOnly: Y,
1870
+ size: me = "md",
1871
+ id: _,
1872
+ className: ie,
1873
+ style: Z,
1874
+ accessMode: X,
1875
+ showKeyboardHints: ae,
1876
+ displayStyle: z,
1877
+ labelPlacement: R,
1878
+ errorPlacement: F,
1879
+ labelWidth: D,
1880
+ controlWidth: K
1881
+ }) => {
1882
+ On("input", z), En("input", z);
1883
+ const U = sn(X, _), O = U === "hidden";
1884
+ (U === "disabled" || U === "readOnly") && (j = !0);
1885
+ const W = cn(_), { t: P } = Oe(), v = ve(
1886
+ () => w ? Array.isArray(i) ? i : i ? [i] : [] : [],
1887
+ [i, w]
1888
+ ), [b, q] = Te(
1889
+ () => w || Array.isArray(i) ? "" : n.find((c) => String(c.value) === i)?.label ?? i ?? ""
1890
+ ), [se, u] = Te(!1), C = Ce(null), [L, te] = Te(-1), he = Ce(null), be = Ce(null), { popupRef: J, coords: m, themeClass: E, portalTarget: oe } = Pt(
1891
+ se,
1892
+ C,
1893
+ () => u(!1)
1894
+ ), xe = ve(() => {
1895
+ const c = [
1896
+ Ge.moveDown,
1897
+ Ge.moveUp,
1898
+ Ge.submit,
1899
+ Ge.cancel
1900
+ ];
1901
+ return w && c.push({ key: "Backspace", description: P("shortcuts.removeLastTag", "Remove last tag") }), c;
1902
+ }, [w, P]);
1903
+ Fe(() => {
1904
+ w || q(
1905
+ Array.isArray(i) ? "" : n.find((c) => String(c.value) === i)?.label ?? i ?? ""
1906
+ );
1907
+ }, [i, w, n]);
1908
+ const ke = ve(() => {
1909
+ if (b.length < l)
1910
+ return k ? (o ? n : [...n].sort((ue, de) => ue.label.localeCompare(de.label))).slice(0, a) : [];
1911
+ if (o)
1912
+ return n.slice(0, a);
1913
+ const c = b.toLowerCase();
1914
+ return n.filter((N) => N.label.toLowerCase().includes(c)).slice(0, a);
1915
+ }, [n, b, l, a, o, k]), ee = ve(() => {
1916
+ const c = /* @__PURE__ */ new Map();
1917
+ for (const N of ke) {
1918
+ const ue = N.group || "";
1919
+ c.has(ue) || c.set(ue, []), c.get(ue).push(N);
1920
+ }
1921
+ return c;
1922
+ }, [ke]), le = x(
1923
+ (c) => {
1924
+ Y || (q(c), u(c.length >= l), te(0), o?.(c));
1925
+ },
1926
+ [l, o, Y]
1927
+ ), ye = x(
1928
+ (c) => {
1929
+ if (!Y)
1930
+ if (w) {
1931
+ const N = String(c.value), ue = v.includes(N) ? v.filter((de) => de !== N) : [...v, N];
1932
+ t?.(ue), q("");
1933
+ } else
1934
+ q(c.label), t?.(String(c.value)), u(!1);
1935
+ },
1936
+ [t, w, v, Y]
1937
+ ), Se = (c) => {
1938
+ if (!Y) {
1939
+ if (w && c.key === "Backspace" && !b && v.length > 0) {
1940
+ t?.(v.slice(0, -1));
1941
+ return;
1942
+ }
1943
+ if (!se && (c.key === "ArrowDown" || c.key === "ArrowUp")) {
1944
+ c.preventDefault(), u(!0), te(0);
1945
+ return;
1946
+ }
1947
+ se && (c.key === "ArrowDown" ? (c.preventDefault(), te((N) => N < 0 ? 0 : Math.min(N + 1, ke.length - 1))) : c.key === "ArrowUp" ? (c.preventDefault(), te((N) => N <= 0 ? ke.length - 1 : N - 1)) : (c.key === "Enter" || c.key === "Tab") && L >= 0 && L < ke.length ? (c.preventDefault(), ye(ke[L])) : c.key === "Escape" && u(!1));
1948
+ }
1949
+ }, f = x(
1950
+ (c) => {
1951
+ Y || t?.(v.filter((N) => N !== c));
1952
+ },
1953
+ [v, t, Y]
1954
+ );
1955
+ return O ? null : /* @__PURE__ */ p(
1956
+ "div",
1957
+ {
1958
+ className: `nice-field nice-field--${me} ${R === "left" ? "nice-field--label-left" : ""} ${y ? "nice-field--loading" : ""} ${ie || ""}`,
1959
+ style: {
1960
+ width: "fit-content",
1961
+ ...Z,
1962
+ ...D != null && {
1963
+ "--nice-field-label-width": typeof D == "number" ? `${D}px` : D
1964
+ },
1965
+ ...K != null && {
1966
+ "--nice-field-control-width": typeof K == "number" ? `${K}px` : K
1967
+ },
1968
+ ...T != null && { "--nice-dropdown-gap": `${T}px` }
1969
+ },
1970
+ ref: he,
1971
+ "aria-busy": y || void 0,
1972
+ children: [
1973
+ H && /* @__PURE__ */ p(
1974
+ "label",
1975
+ {
1976
+ className: `nice-field__label ${V ? "nice-field__label--required" : ""}`,
1977
+ htmlFor: W,
1978
+ children: [
1979
+ H,
1980
+ ae && /* @__PURE__ */ e(mn, { shortcuts: xe, size: "sm" })
1981
+ ]
1982
+ }
1983
+ ),
1984
+ /* @__PURE__ */ p("div", { className: "nice-field__control", style: { position: "relative" }, children: [
1985
+ /* @__PURE__ */ e(
1986
+ "div",
1987
+ {
1988
+ ref: C,
1989
+ className: `nice-input nice-input--${me} ${re ? "nice-input--error" : ""} ${j ? "nice-input--disabled" : ""}`,
1990
+ style: { width: "220px" },
1991
+ children: /* @__PURE__ */ p(
1992
+ "div",
1993
+ {
1994
+ className: "nice-field__input-wrap",
1995
+ style: {
1996
+ display: "flex",
1997
+ flexWrap: w ? "wrap" : "nowrap",
1998
+ gap: 4,
1999
+ alignItems: "center",
2000
+ flex: 1,
2001
+ minWidth: 0
2002
+ },
2003
+ children: [
2004
+ w && v.map((c) => {
2005
+ const N = n.find((ue) => String(ue.value) === c);
2006
+ return /* @__PURE__ */ p("span", { className: "nice-autocomplete__tag", children: [
2007
+ N?.label || c,
2008
+ !Y && /* @__PURE__ */ e(
2009
+ "button",
2010
+ {
2011
+ type: "button",
2012
+ className: "nice-autocomplete__tag-remove",
2013
+ onClick: () => f(c),
2014
+ "aria-label": P("controls.remove", "Remove"),
2015
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
2016
+ }
2017
+ )
2018
+ ] }, c);
2019
+ }),
2020
+ /* @__PURE__ */ e(
2021
+ "input",
2022
+ {
2023
+ ref: be,
2024
+ id: W,
2025
+ type: "text",
2026
+ className: "nice-input__native",
2027
+ value: b,
2028
+ onChange: (c) => le(c.target.value),
2029
+ onFocus: () => !Y && (k || b.length >= l) && u(!0),
2030
+ onKeyDown: Se,
2031
+ disabled: j,
2032
+ readOnly: Y,
2033
+ required: V,
2034
+ role: "combobox",
2035
+ "aria-expanded": se,
2036
+ "aria-autocomplete": "list",
2037
+ autoComplete: "off",
2038
+ style: {
2039
+ flex: 1,
2040
+ minWidth: 60,
2041
+ border: "none",
2042
+ outline: "none",
2043
+ background: "transparent",
2044
+ color: "inherit",
2045
+ padding: 0,
2046
+ font: "inherit"
2047
+ }
2048
+ }
2049
+ ),
2050
+ d && !w && b && !j && !Y && /* @__PURE__ */ e(
2051
+ "button",
2052
+ {
2053
+ type: "button",
2054
+ className: "nice-input__clear",
2055
+ onClick: () => {
2056
+ q(""), t?.("");
2057
+ },
2058
+ "aria-label": P("controls.clear", "Clear"),
2059
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
2060
+ }
2061
+ )
2062
+ ]
2063
+ }
2064
+ )
2065
+ }
2066
+ ),
2067
+ se && ke.length > 0 && m && oe && ft(
2068
+ /* @__PURE__ */ e(
2069
+ "ul",
2070
+ {
2071
+ ref: J,
2072
+ className: `nice-dropdown__list${E ? ` ${E}` : ""}`,
2073
+ "data-theme": E === "nice-dark" ? "dark" : E === "nice-light" ? "light" : void 0,
2074
+ role: "listbox",
2075
+ style: {
2076
+ position: "fixed",
2077
+ left: m.left,
2078
+ top: m.top,
2079
+ width: m.width,
2080
+ minWidth: m.width,
2081
+ zIndex: 1e3
2082
+ },
2083
+ children: Array.from(ee.entries()).map(([c, N]) => /* @__PURE__ */ p(Rn.Fragment, { children: [
2084
+ c && /* @__PURE__ */ e("li", { className: "nice-dropdown__group-label", children: c }),
2085
+ N.map((ue) => {
2086
+ const Q = ke.indexOf(ue) === L, g = w && v.includes(String(ue.value));
2087
+ return /* @__PURE__ */ e(
2088
+ "li",
2089
+ {
2090
+ role: "option",
2091
+ className: `nice-dropdown__option ${Q ? "nice-dropdown__option--active" : ""} ${g ? "nice-dropdown__option--selected" : ""}`,
2092
+ onMouseDown: (Ye) => {
2093
+ Ye.preventDefault(), ye(ue);
2094
+ },
2095
+ "aria-selected": Q,
2096
+ children: B ? B(ue, b) : ne ? /* @__PURE__ */ e(pi, { text: ue.label, query: b }) : ue.label
2097
+ },
2098
+ String(ue.value)
2099
+ );
2100
+ })
2101
+ ] }, c))
2102
+ }
2103
+ ),
2104
+ oe
2105
+ ),
2106
+ y && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
2107
+ F === "right" && re && /* @__PURE__ */ e("div", { id: `${W}-error`, className: "nice-field__error", role: "alert", children: re }),
2108
+ F === "right" && !re && G && /* @__PURE__ */ e("div", { id: `${W}-helper`, className: "nice-field__helper", children: G })
2109
+ ] }),
2110
+ F !== "right" && re && /* @__PURE__ */ e("div", { id: `${W}-error`, className: "nice-field__error", role: "alert", children: re }),
2111
+ F !== "right" && !re && G && /* @__PURE__ */ e("div", { id: `${W}-helper`, className: "nice-field__helper", children: G })
2112
+ ]
2113
+ }
2114
+ );
2115
+ }, mi = ({
2116
+ options: n,
2117
+ suggestions: i,
2118
+ value: t,
2119
+ onChange: l,
2120
+ searchable: a = !0,
2121
+ clearable: o,
2122
+ maxTags: d,
2123
+ allowCustom: y,
2124
+ placeholder: w,
2125
+ label: B,
2126
+ error: ne,
2127
+ helperText: k,
2128
+ required: T,
2129
+ disabled: H,
2130
+ size: re = "md",
2131
+ loading: G,
2132
+ id: V,
2133
+ className: j,
2134
+ style: Y,
2135
+ accessMode: me,
2136
+ showKeyboardHints: _,
2137
+ labelPlacement: ie,
2138
+ errorPlacement: Z,
2139
+ labelWidth: X,
2140
+ controlWidth: ae,
2141
+ readOnly: z,
2142
+ autoExpand: R = !1
2143
+ }) => {
2144
+ const F = sn(me, V), D = F === "hidden";
2145
+ (F === "disabled" || F === "readOnly") && (H = !0);
2146
+ const K = cn(V), { t: U } = Oe(), [O, W] = Te(!1), [P, v] = Te(""), b = Ce(null), q = Ce(null);
2147
+ Lt(b, () => W(!1));
2148
+ const se = ve(
2149
+ () => [
2150
+ Ge.submit,
2151
+ Ge.cancel,
2152
+ { key: "Backspace", description: U("shortcuts.removeLastTag", "Remove last tag") }
2153
+ ],
2154
+ [U]
2155
+ ), u = ve(() => Array.isArray(n) && n.length > 0 ? n : Array.isArray(i) ? i.map((m) => ({ label: m, value: m })) : [], [n, i]), C = ve(() => Array.isArray(t) ? t : [], [t]), L = ve(() => {
2156
+ let m = u.filter((E) => !C.includes(String(E.value)));
2157
+ if (P) {
2158
+ const E = P.toLowerCase();
2159
+ m = m.filter((oe) => oe.label.toLowerCase().includes(E));
2160
+ }
2161
+ return m;
2162
+ }, [u, C, P]), te = x(
2163
+ (m) => {
2164
+ d && C.length >= d || (C.includes(m) || l([...C, m]), v(""));
2165
+ },
2166
+ [C, l, d]
2167
+ ), he = x(
2168
+ (m) => {
2169
+ l(C.filter((E) => E !== m));
2170
+ },
2171
+ [C, l]
2172
+ ), be = (m) => {
2173
+ z || (m.key === "Backspace" && !P && C.length > 0 ? he(C[C.length - 1]) : m.key === "Enter" && P ? (m.preventDefault(), L.length > 0 ? te(String(L[0].value)) : y && te(P)) : m.key === "Escape" && W(!1));
2174
+ }, J = (m) => u.find((E) => String(E.value) === m)?.label ?? m;
2175
+ return D ? null : /* @__PURE__ */ p(
2176
+ "div",
2177
+ {
2178
+ className: `nice-field nice-field--${re} ${ie === "left" ? "nice-field--label-left" : ""} ${G ? "nice-field--loading" : ""} ${j || ""}`,
2179
+ style: {
2180
+ ...Y,
2181
+ ...X != null && {
2182
+ "--nice-field-label-width": typeof X == "number" ? `${X}px` : X
2183
+ },
2184
+ ...ae != null && {
2185
+ "--nice-field-control-width": typeof ae == "number" ? `${ae}px` : ae
2186
+ }
2187
+ },
2188
+ ref: b,
2189
+ "aria-busy": G || void 0,
2190
+ children: [
2191
+ B && /* @__PURE__ */ p(
2192
+ "label",
2193
+ {
2194
+ className: `nice-field__label ${T ? "nice-field__label--required" : ""}`,
2195
+ htmlFor: K,
2196
+ children: [
2197
+ B,
2198
+ _ && /* @__PURE__ */ e(mn, { shortcuts: se, size: "sm" })
2199
+ ]
2200
+ }
2201
+ ),
2202
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
2203
+ /* @__PURE__ */ p(
2204
+ "div",
2205
+ {
2206
+ className: `nice-tagbox nice-tagbox--${re} ${R ? "nice-tagbox--expand" : "nice-tagbox--fixed"} ${ne ? "nice-tagbox--error" : ""} ${H ? "nice-tagbox--disabled" : ""} ${z ? "nice-tagbox--readonly" : ""}`,
2207
+ onClick: () => {
2208
+ !H && !G && !z && (W(!0), q.current?.focus());
2209
+ },
2210
+ style: {
2211
+ position: "relative",
2212
+ cursor: H || G ? "not-allowed" : z ? "default" : "text"
2213
+ },
2214
+ children: [
2215
+ /* @__PURE__ */ p("div", { className: "nice-tagbox__tags", children: [
2216
+ C.map((m) => /* @__PURE__ */ p("span", { className: "nice-tag nice-tagbox__tag", children: [
2217
+ J(m),
2218
+ !H && !z && /* @__PURE__ */ e(
2219
+ "button",
2220
+ {
2221
+ type: "button",
2222
+ className: "nice-tag__remove",
2223
+ onClick: (E) => {
2224
+ E.stopPropagation(), he(m);
2225
+ },
2226
+ "aria-label": U("controls.remove", "Remove"),
2227
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
2228
+ }
2229
+ )
2230
+ ] }, m)),
2231
+ a && /* @__PURE__ */ e(
2232
+ "input",
2233
+ {
2234
+ ref: q,
2235
+ id: K,
2236
+ type: "text",
2237
+ className: "nice-tagbox__input nice-input__native",
2238
+ value: P,
2239
+ onChange: (m) => {
2240
+ v(m.target.value), W(!0);
2241
+ },
2242
+ onFocus: () => W(!0),
2243
+ onKeyDown: be,
2244
+ placeholder: C.length === 0 ? w || U("controls.select", "Select...") : "",
2245
+ disabled: H || G,
2246
+ readOnly: z,
2247
+ autoComplete: "off",
2248
+ style: {
2249
+ border: "none",
2250
+ outline: "none",
2251
+ background: "transparent",
2252
+ color: "inherit",
2253
+ flex: 1,
2254
+ minWidth: 80,
2255
+ padding: 0,
2256
+ font: "inherit",
2257
+ caretColor: "var(--color-primary)"
2258
+ }
2259
+ }
2260
+ )
2261
+ ] }),
2262
+ o && C.length > 0 && !H && !z && /* @__PURE__ */ e(
2263
+ "button",
2264
+ {
2265
+ type: "button",
2266
+ className: "nice-input__clear",
2267
+ onClick: (m) => {
2268
+ m.stopPropagation(), l([]);
2269
+ },
2270
+ "aria-label": U("controls.clear", "Clear"),
2271
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
2272
+ }
2273
+ ),
2274
+ O && (L.length > 0 || y && P) && /* @__PURE__ */ p("ul", { className: "nice-dropdown__list nice-tagbox__dropdown", role: "listbox", children: [
2275
+ L.map((m) => /* @__PURE__ */ e(
2276
+ "li",
2277
+ {
2278
+ role: "option",
2279
+ className: "nice-dropdown__option",
2280
+ onMouseDown: (E) => {
2281
+ E.preventDefault(), te(String(m.value));
2282
+ },
2283
+ children: m.label
2284
+ },
2285
+ String(m.value)
2286
+ )),
2287
+ y && P && !L.some((m) => String(m.value).toLowerCase() === P.toLowerCase()) && /* @__PURE__ */ p(
2288
+ "li",
2289
+ {
2290
+ role: "option",
2291
+ className: "nice-dropdown__option nice-dropdown__option--add",
2292
+ onMouseDown: (m) => {
2293
+ m.preventDefault(), te(P);
2294
+ },
2295
+ children: [
2296
+ "+ ",
2297
+ U("controls.add", "Add"),
2298
+ " “",
2299
+ P,
2300
+ "”"
2301
+ ]
2302
+ }
2303
+ )
2304
+ ] })
2305
+ ]
2306
+ }
2307
+ ),
2308
+ G && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
2309
+ Z === "right" && ne && /* @__PURE__ */ e("div", { id: `${K}-error`, className: "nice-field__error", role: "alert", children: ne }),
2310
+ Z === "right" && !ne && k && /* @__PURE__ */ e("div", { id: `${K}-helper`, className: "nice-field__helper", children: k })
2311
+ ] }),
2312
+ Z !== "right" && ne && /* @__PURE__ */ e("div", { id: `${K}-error`, className: "nice-field__error", role: "alert", children: ne }),
2313
+ Z !== "right" && !ne && k && /* @__PURE__ */ e("div", { id: `${K}-helper`, className: "nice-field__helper", children: k })
2314
+ ]
2315
+ }
2316
+ );
2317
+ }, hi = {
2318
+ phone: "(999) 999-9999",
2319
+ "credit-card": "9999 9999 9999 9999",
2320
+ date: "99/99/9999",
2321
+ ssn: "999-99-9999",
2322
+ zip: "99-999",
2323
+ time: "99:99",
2324
+ iban: "aa99 9999 9999 9999 9999 9999"
2325
+ };
2326
+ function gi(n) {
2327
+ return [...n].map((i) => i === "9" ? { type: "digit" } : i === "a" ? { type: "letter" } : i === "*" ? { type: "alphanum" } : { type: "literal", literal: i });
2328
+ }
2329
+ function yi(n, i) {
2330
+ return i.type === "digit" ? /\d/.test(n) : i.type === "letter" ? /[a-zA-Z]/.test(n) : i.type === "alphanum" ? /[a-zA-Z0-9]/.test(n) : !1;
2331
+ }
2332
+ function dt(n, i, t) {
2333
+ let l = 0, a = "";
2334
+ for (const o of i)
2335
+ o.type === "literal" ? a += o.literal : l < n.length ? (a += n[l], l++) : a += t;
2336
+ return a;
2337
+ }
2338
+ function _i(n, i) {
2339
+ return n.map((t) => t.type === "literal" ? t.literal : i).join("");
2340
+ }
2341
+ const yt = vn(
2342
+ ({
2343
+ label: n,
2344
+ helperText: i,
2345
+ error: t,
2346
+ required: l,
2347
+ disabled: a,
2348
+ readOnly: o,
2349
+ size: d = "md",
2350
+ name: y,
2351
+ id: w,
2352
+ className: B,
2353
+ style: ne,
2354
+ value: k = "",
2355
+ onChange: T,
2356
+ onBlur: H,
2357
+ onKeyDown: re,
2358
+ mask: G,
2359
+ maskPreset: V,
2360
+ maskChar: j = "_",
2361
+ placeholder: Y,
2362
+ showMaskAsPlaceholder: me = !0,
2363
+ clearable: _ = !1,
2364
+ autoFocus: ie,
2365
+ labelPlacement: Z,
2366
+ errorPlacement: X,
2367
+ loading: ae,
2368
+ labelWidth: z,
2369
+ controlWidth: R,
2370
+ ...F
2371
+ }, D) => {
2372
+ const { t: K } = Oe(), U = cn(w), O = Ce(null), [W, P] = Te(!1), v = G || (V ? hi[V] : "") || "999", b = Rn.useMemo(() => gi(v), [v]), q = Rn.useMemo(
2373
+ () => dt(k, b, j),
2374
+ [k, b, j]
2375
+ ), se = W || k ? q : "", u = Y ?? (me ? _i(b, j) : void 0), C = x(
2376
+ (E) => {
2377
+ O.current = E, typeof D == "function" ? D(E) : D && (D.current = E);
2378
+ },
2379
+ [D]
2380
+ ), L = x(
2381
+ (E) => {
2382
+ const oe = dt(E, b, j);
2383
+ T?.(E, oe);
2384
+ },
2385
+ [T, b, j]
2386
+ ), te = x(
2387
+ (E) => {
2388
+ const oe = E.currentTarget, xe = oe.value, ke = oe.selectionStart ?? xe.length;
2389
+ let ee = "", le = 0;
2390
+ for (let ye = 0; ye < xe.length && le < b.length; ye++) {
2391
+ const Se = xe[ye];
2392
+ for (; le < b.length && b[le].type === "literal"; )
2393
+ le++;
2394
+ if (le >= b.length)
2395
+ break;
2396
+ yi(Se, b[le]) && (ee += Se, le++);
2397
+ }
2398
+ L(ee), requestAnimationFrame(() => {
2399
+ let ye = 0, Se = 0;
2400
+ for (let f = 0; f < b.length; f++) {
2401
+ if (b[f].type === "literal")
2402
+ ye = f + 1;
2403
+ else if (Se < ee.length)
2404
+ Se++, ye = f + 1;
2405
+ else {
2406
+ ye = f;
2407
+ break;
2408
+ }
2409
+ if (ye >= ke && Se >= ee.length)
2410
+ break;
2411
+ }
2412
+ Se >= ee.length && ee.length > 0 && (ye = Math.min(ye, b.length)), oe.setSelectionRange(ye, ye);
2413
+ });
2414
+ },
2415
+ [b, L]
2416
+ ), he = x(
2417
+ (E) => {
2418
+ if (E.key === "Backspace" && k.length > 0) {
2419
+ E.preventDefault();
2420
+ const oe = k.slice(0, -1);
2421
+ L(oe);
2422
+ }
2423
+ re?.(E);
2424
+ },
2425
+ [k, L, re]
2426
+ ), be = x(() => P(!0), []), J = x(
2427
+ (E) => {
2428
+ P(!1), H?.(E);
2429
+ },
2430
+ [H]
2431
+ ), m = x(() => {
2432
+ L(""), O.current?.focus();
2433
+ }, [L]);
2434
+ return /* @__PURE__ */ p(
2435
+ "div",
2436
+ {
2437
+ className: `nice-field nice-field--masked nice-field--${d} ${Z === "left" ? "nice-field--label-left" : ""} ${ae ? "nice-field--loading" : ""} ${B || ""}`,
2438
+ style: {
2439
+ ...ne,
2440
+ ...z != null && {
2441
+ "--nice-field-label-width": typeof z == "number" ? `${z}px` : z
2442
+ },
2443
+ ...R != null && {
2444
+ "--nice-field-control-width": typeof R == "number" ? `${R}px` : R
2445
+ }
2446
+ },
2447
+ "aria-busy": ae || void 0,
2448
+ children: [
2449
+ n && /* @__PURE__ */ e(
2450
+ "label",
2451
+ {
2452
+ htmlFor: U,
2453
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
2454
+ children: n
2455
+ }
2456
+ ),
2457
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
2458
+ /* @__PURE__ */ p(
2459
+ "div",
2460
+ {
2461
+ className: `nice-input nice-input--${d} ${t ? "nice-input--error" : ""} ${a ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`,
2462
+ style: { width: "fit-content", minWidth: 0 },
2463
+ children: [
2464
+ /* @__PURE__ */ e(
2465
+ "input",
2466
+ {
2467
+ ref: C,
2468
+ id: U,
2469
+ className: "nice-input__native nice-masked-input",
2470
+ type: "text",
2471
+ name: y,
2472
+ value: se,
2473
+ placeholder: u,
2474
+ disabled: a || ae,
2475
+ readOnly: o,
2476
+ autoFocus: ie,
2477
+ style: {
2478
+ width: `${v.length}ch`,
2479
+ minWidth: 0,
2480
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
2481
+ fontVariantNumeric: "tabular-nums"
2482
+ },
2483
+ "aria-invalid": !!t,
2484
+ "aria-describedby": t ? `${U}-error` : i ? `${U}-helper` : void 0,
2485
+ onInput: te,
2486
+ onChange: () => {
2487
+ },
2488
+ onKeyDown: he,
2489
+ onFocus: be,
2490
+ onBlur: J,
2491
+ ...F
2492
+ }
2493
+ ),
2494
+ _ && k && /* @__PURE__ */ e(
2495
+ "button",
2496
+ {
2497
+ type: "button",
2498
+ className: "nice-input__clear",
2499
+ disabled: a || o,
2500
+ onClick: m,
2501
+ "aria-label": K("controls.clear", "Clear"),
2502
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
2503
+ }
2504
+ )
2505
+ ]
2506
+ }
2507
+ ),
2508
+ ae && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
2509
+ X === "right" && t && /* @__PURE__ */ e("div", { id: `${U}-error`, className: "nice-field__error", role: "alert", children: t }),
2510
+ X === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${U}-helper`, className: "nice-field__helper", children: i })
2511
+ ] }),
2512
+ X !== "right" && t && /* @__PURE__ */ e("div", { id: `${U}-error`, className: "nice-field__error", role: "alert", children: t }),
2513
+ X !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${U}-helper`, className: "nice-field__helper", children: i })
2514
+ ]
2515
+ }
2516
+ );
2517
+ }
2518
+ );
2519
+ yt.displayName = "NiceMaskedInput";
2520
+ const vi = [
2521
+ { id: "length", label: "At least 8 characters", test: (n) => n.length >= 8 },
2522
+ { id: "uppercase", label: "At least one uppercase letter", test: (n) => /[A-Z]/.test(n) },
2523
+ { id: "lowercase", label: "At least one lowercase letter", test: (n) => /[a-z]/.test(n) },
2524
+ { id: "digit", label: "At least one digit", test: (n) => /\d/.test(n) },
2525
+ { id: "special", label: "At least one special character", test: (n) => /[^a-zA-Z0-9]/.test(n) }
2526
+ ];
2527
+ function bi(n, i) {
2528
+ if (!n)
2529
+ return { level: "none", passed: [], ratio: 0 };
2530
+ const t = i.filter((o) => o.test(n)).map((o) => o.id), l = t.length / i.length;
2531
+ let a = "weak";
2532
+ return l >= 1 ? a = "strong" : l >= 0.75 ? a = "good" : l >= 0.5 && (a = "fair"), { level: a, passed: t, ratio: l };
2533
+ }
2534
+ const _t = vn(
2535
+ ({
2536
+ label: n,
2537
+ helperText: i,
2538
+ error: t,
2539
+ required: l,
2540
+ disabled: a,
2541
+ readOnly: o,
2542
+ size: d = "md",
2543
+ name: y,
2544
+ id: w,
2545
+ className: B,
2546
+ style: ne,
2547
+ value: k = "",
2548
+ onChange: T,
2549
+ onBlur: H,
2550
+ onKeyDown: re,
2551
+ placeholder: G,
2552
+ maxLength: V,
2553
+ showToggle: j = !0,
2554
+ showStrength: Y = !1,
2555
+ strengthRules: me,
2556
+ validationPlacement: _ = "bottom",
2557
+ autoFocus: ie,
2558
+ autoComplete: Z,
2559
+ labelPlacement: X,
2560
+ errorPlacement: ae,
2561
+ loading: z,
2562
+ labelWidth: R,
2563
+ controlWidth: F,
2564
+ ...D
2565
+ }, K) => {
2566
+ const { t: U } = Oe(), O = cn(w), [W, P] = Te(!1), v = me ?? vi, b = ve(
2567
+ () => Y ? bi(k, v) : null,
2568
+ [Y, k, v]
2569
+ ), q = x(() => P((u) => !u), []), se = Y && b && k ? /* @__PURE__ */ p(
2570
+ "div",
2571
+ {
2572
+ className: `nice-password__strength ${_ === "right" ? "nice-password__strength--right" : ""}`,
2573
+ children: [
2574
+ /* @__PURE__ */ e("div", { className: "nice-password__meter", children: /* @__PURE__ */ e(
2575
+ "div",
2576
+ {
2577
+ className: `nice-password__meter-fill nice-password__meter-fill--${b.level}`,
2578
+ style: { width: `${b.ratio * 100}%` }
2579
+ }
2580
+ ) }),
2581
+ /* @__PURE__ */ e(
2582
+ "span",
2583
+ {
2584
+ className: `nice-password__strength-label nice-password__strength-label--${b.level}`,
2585
+ children: U(
2586
+ `password.strength.${b.level}`,
2587
+ b.level.charAt(0).toUpperCase() + b.level.slice(1)
2588
+ )
2589
+ }
2590
+ ),
2591
+ /* @__PURE__ */ e("ul", { className: "nice-password__rules", children: v.map((u) => {
2592
+ const C = b.passed.includes(u.id);
2593
+ return /* @__PURE__ */ p(
2594
+ "li",
2595
+ {
2596
+ className: `nice-password__rule ${C ? "nice-password__rule--passed" : ""}`,
2597
+ children: [
2598
+ /* @__PURE__ */ e("span", { className: "nice-password__rule-icon", children: /* @__PURE__ */ e(ze, { name: C ? "check" : "close", size: 14 }) }),
2599
+ u.label
2600
+ ]
2601
+ },
2602
+ u.id
2603
+ );
2604
+ }) })
2605
+ ]
2606
+ }
2607
+ ) : null;
2608
+ return /* @__PURE__ */ p(
2609
+ "div",
2610
+ {
2611
+ className: `nice-field nice-field--${d} ${X === "left" ? "nice-field--label-left" : ""} ${z ? "nice-field--loading" : ""} ${B || ""}`,
2612
+ style: {
2613
+ ...ne,
2614
+ ...R != null && {
2615
+ "--nice-field-label-width": typeof R == "number" ? `${R}px` : R
2616
+ },
2617
+ ...F != null && {
2618
+ "--nice-field-control-width": typeof F == "number" ? `${F}px` : F
2619
+ }
2620
+ },
2621
+ "aria-busy": z || void 0,
2622
+ children: [
2623
+ n && /* @__PURE__ */ e(
2624
+ "label",
2625
+ {
2626
+ htmlFor: O,
2627
+ className: `nice-field__label ${l ? "nice-field__label--required" : ""}`,
2628
+ style: _ === "right" && X === "left" ? (
2629
+ /* When validation block sits to the right of the input it makes
2630
+ `.nice-field__control` taller than a single input row. Without
2631
+ this override the grid row centres the label against the whole
2632
+ control (input + strength meter), pushing it visually too low.
2633
+ `align-self: flex-start` + matching padding keeps the label
2634
+ aligned with the input row only. */
2635
+ { alignSelf: "flex-start", paddingTop: 6 }
2636
+ ) : void 0,
2637
+ children: n
2638
+ }
2639
+ ),
2640
+ /* @__PURE__ */ p(
2641
+ "div",
2642
+ {
2643
+ className: "nice-field__control",
2644
+ style: _ === "right" ? { alignItems: "flex-start" } : void 0,
2645
+ children: [
2646
+ /* @__PURE__ */ p(
2647
+ "div",
2648
+ {
2649
+ style: _ === "right" ? { display: "flex", flexDirection: "column", flex: "1 1 auto", minWidth: 0 } : { display: "contents" },
2650
+ children: [
2651
+ /* @__PURE__ */ p(
2652
+ "div",
2653
+ {
2654
+ className: `nice-input nice-input--${d} ${t ? "nice-input--error" : ""} ${a ? "nice-input--disabled" : ""} ${o ? "nice-input--readonly" : ""}`,
2655
+ children: [
2656
+ /* @__PURE__ */ e(
2657
+ "input",
2658
+ {
2659
+ ref: K,
2660
+ id: O,
2661
+ className: "nice-input__native",
2662
+ type: W ? "text" : "password",
2663
+ name: y,
2664
+ value: k,
2665
+ placeholder: G,
2666
+ disabled: a || z,
2667
+ readOnly: o,
2668
+ maxLength: V,
2669
+ autoFocus: ie,
2670
+ autoComplete: Z,
2671
+ "aria-invalid": !!t,
2672
+ "aria-describedby": t ? `${O}-error` : i ? `${O}-helper` : void 0,
2673
+ onChange: (u) => T?.(u.target.value),
2674
+ onBlur: H,
2675
+ onKeyDown: re,
2676
+ ...D
2677
+ }
2678
+ ),
2679
+ j && /* @__PURE__ */ e(
2680
+ "button",
2681
+ {
2682
+ type: "button",
2683
+ className: "nice-password__toggle",
2684
+ onClick: q,
2685
+ disabled: a,
2686
+ tabIndex: -1,
2687
+ "aria-label": W ? U("password.hide", "Hide password") : U("password.show", "Show password"),
2688
+ children: /* @__PURE__ */ e(ze, { name: W ? "eye-off" : "eye", size: 18 })
2689
+ }
2690
+ )
2691
+ ]
2692
+ }
2693
+ ),
2694
+ _ === "right" && ae !== "right" && t && /* @__PURE__ */ e("div", { id: `${O}-error`, className: "nice-field__error", role: "alert", children: t }),
2695
+ _ === "right" && ae !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${O}-helper`, className: "nice-field__helper", children: i })
2696
+ ]
2697
+ }
2698
+ ),
2699
+ z && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
2700
+ _ === "right" && se,
2701
+ ae === "right" && t && /* @__PURE__ */ e("div", { id: `${O}-error`, className: "nice-field__error", role: "alert", children: t }),
2702
+ ae === "right" && !t && i && /* @__PURE__ */ e("div", { id: `${O}-helper`, className: "nice-field__helper", children: i })
2703
+ ]
2704
+ }
2705
+ ),
2706
+ _ !== "right" && se,
2707
+ _ !== "right" && ae !== "right" && t && /* @__PURE__ */ e("div", { id: `${O}-error`, className: "nice-field__error", role: "alert", children: t }),
2708
+ _ !== "right" && ae !== "right" && !t && i && /* @__PURE__ */ e("div", { id: `${O}-helper`, className: "nice-field__helper", children: i })
2709
+ ]
2710
+ }
2711
+ );
2712
+ }
2713
+ );
2714
+ _t.displayName = "NicePasswordInput";
2715
+ const Ci = ({
2716
+ filled: n,
2717
+ size: i
2718
+ }) => /* @__PURE__ */ p(
2719
+ "svg",
2720
+ {
2721
+ width: i,
2722
+ height: i,
2723
+ viewBox: "0 0 24 24",
2724
+ fill: "none",
2725
+ xmlns: "http://www.w3.org/2000/svg",
2726
+ children: [
2727
+ n === "half" && /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ p("linearGradient", { id: "halfGrad", children: [
2728
+ /* @__PURE__ */ e("stop", { offset: "50%", stopColor: "currentColor" }),
2729
+ /* @__PURE__ */ e("stop", { offset: "50%", stopColor: "transparent" })
2730
+ ] }) }),
2731
+ /* @__PURE__ */ e(
2732
+ "path",
2733
+ {
2734
+ d: "M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.27 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z",
2735
+ fill: n === "full" ? "currentColor" : n === "half" ? "url(#halfGrad)" : "none",
2736
+ stroke: "currentColor",
2737
+ strokeWidth: "1.5",
2738
+ strokeLinejoin: "round"
2739
+ }
2740
+ )
2741
+ ]
2742
+ }
2743
+ ), Ni = {
2744
+ xxs: 10,
2745
+ xs: 14,
2746
+ sm: 18,
2747
+ md: 22,
2748
+ lg: 28,
2749
+ xl: 34,
2750
+ xxl: 42,
2751
+ small: 18,
2752
+ medium: 22,
2753
+ large: 28
2754
+ }, Xn = vn(
2755
+ ({
2756
+ value: n = 0,
2757
+ onChange: i,
2758
+ count: t = 5,
2759
+ half: l = !1,
2760
+ readOnly: a = !1,
2761
+ disabled: o = !1,
2762
+ size: d = "md",
2763
+ label: y,
2764
+ icon: w,
2765
+ name: B,
2766
+ error: ne,
2767
+ helperText: k,
2768
+ required: T,
2769
+ id: H,
2770
+ className: re,
2771
+ style: G,
2772
+ labelPlacement: V,
2773
+ errorPlacement: j,
2774
+ labelWidth: Y,
2775
+ controlWidth: me,
2776
+ valuePlacement: _ = "none",
2777
+ valueTemplate: ie,
2778
+ loading: Z,
2779
+ ...X
2780
+ }, ae) => {
2781
+ const { t: z } = Oe(), R = cn(H), [F, D] = Te(null), K = Ni[d], U = !a && !o && !Z, O = F ?? n, W = (u) => O >= u + 1 ? "full" : l && O >= u + 0.5 ? "half" : "empty", P = x(
2782
+ (u, C) => {
2783
+ if (!U)
2784
+ return;
2785
+ const L = C && l ? u + 0.5 : u + 1;
2786
+ i?.(L === n ? 0 : L);
2787
+ },
2788
+ [U, l, i, n]
2789
+ ), v = x(
2790
+ (u, C) => {
2791
+ if (U)
2792
+ if (l) {
2793
+ const L = C.currentTarget.getBoundingClientRect(), te = C.clientX - L.left < L.width / 2;
2794
+ D(te ? u + 0.5 : u + 1);
2795
+ } else
2796
+ D(u + 1);
2797
+ },
2798
+ [U, l]
2799
+ ), b = x(() => {
2800
+ U && D(null);
2801
+ }, [U]), q = x(
2802
+ (u) => {
2803
+ if (!U)
2804
+ return;
2805
+ const C = l ? 0.5 : 1;
2806
+ if (u.key === "ArrowRight" || u.key === "ArrowUp") {
2807
+ u.preventDefault();
2808
+ const L = Math.min(t, n + C);
2809
+ i?.(L);
2810
+ } else if (u.key === "ArrowLeft" || u.key === "ArrowDown") {
2811
+ u.preventDefault();
2812
+ const L = Math.max(0, n - C);
2813
+ i?.(L);
2814
+ }
2815
+ },
2816
+ [U, l, t, n, i]
2817
+ ), se = ie ? ie.replace("{value}", String(n)) : String(n);
2818
+ return /* @__PURE__ */ p(
2819
+ "div",
2820
+ {
2821
+ className: `nice-field nice-field--${d} ${V === "left" ? "nice-field--label-left" : ""} ${Z ? "nice-field--loading" : ""} ${re || ""}`,
2822
+ style: {
2823
+ ...G,
2824
+ ...Y != null && {
2825
+ "--nice-field-label-width": typeof Y == "number" ? `${Y}px` : Y
2826
+ },
2827
+ ...me != null && {
2828
+ "--nice-field-control-width": typeof me == "number" ? `${me}px` : me
2829
+ }
2830
+ },
2831
+ "aria-busy": Z || void 0,
2832
+ ...X,
2833
+ children: [
2834
+ y && /* @__PURE__ */ e(
2835
+ "label",
2836
+ {
2837
+ htmlFor: R,
2838
+ className: `nice-field__label ${T ? "nice-field__label--required" : ""}`,
2839
+ children: y
2840
+ }
2841
+ ),
2842
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
2843
+ /* @__PURE__ */ p(
2844
+ "div",
2845
+ {
2846
+ ref: ae,
2847
+ id: R,
2848
+ className: `nice-rating nice-rating--${d} ${o ? "nice-rating--disabled" : ""} ${a ? "nice-rating--readonly" : ""}`,
2849
+ role: "slider",
2850
+ "aria-valuenow": n,
2851
+ "aria-valuemin": 0,
2852
+ "aria-valuemax": t,
2853
+ "aria-label": y || z("controls.rating", "Rating"),
2854
+ "aria-invalid": !!ne,
2855
+ tabIndex: U ? 0 : -1,
2856
+ onMouseLeave: b,
2857
+ onKeyDown: q,
2858
+ children: [
2859
+ B && /* @__PURE__ */ e("input", { type: "hidden", name: B, value: n }),
2860
+ Array.from({ length: t }, (u, C) => {
2861
+ const L = W(C);
2862
+ return /* @__PURE__ */ e(
2863
+ "span",
2864
+ {
2865
+ className: `nice-rating__star nice-rating__star--${L}`,
2866
+ onClick: (te) => {
2867
+ if (!U)
2868
+ return;
2869
+ const he = te.currentTarget.getBoundingClientRect(), be = l && te.clientX - he.left < he.width / 2;
2870
+ P(C, be);
2871
+ },
2872
+ onMouseMove: (te) => v(C, te),
2873
+ "aria-label": `${C + 1} ${z("controls.star", "star")}`,
2874
+ children: w ? w(L) : /* @__PURE__ */ e(Ci, { filled: L, size: K })
2875
+ },
2876
+ C
2877
+ );
2878
+ }),
2879
+ Z && /* @__PURE__ */ e("span", { className: "nice-rating__loading", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) })
2880
+ ]
2881
+ }
2882
+ ),
2883
+ _ === "right" && !Z && /* @__PURE__ */ e("span", { className: "nice-rating__value", children: se }),
2884
+ _ === "bottom" && !Z && /* @__PURE__ */ e("div", { className: "nice-rating__value nice-rating__value--bottom", children: se }),
2885
+ j === "right" && ne && /* @__PURE__ */ e("div", { id: `${R}-error`, className: "nice-field__error", role: "alert", children: ne }),
2886
+ j === "right" && !ne && k && /* @__PURE__ */ e("div", { id: `${R}-helper`, className: "nice-field__helper", children: k })
2887
+ ] }),
2888
+ j !== "right" && ne && /* @__PURE__ */ e("div", { id: `${R}-error`, className: "nice-field__error", role: "alert", children: ne }),
2889
+ j !== "right" && !ne && k && /* @__PURE__ */ e("div", { id: `${R}-helper`, className: "nice-field__helper", children: k })
2890
+ ]
2891
+ }
2892
+ );
2893
+ }
2894
+ );
2895
+ Xn.displayName = "NiceRating";
2896
+ const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2897
+ __proto__: null,
2898
+ NiceRating: Xn
2899
+ }, Symbol.toStringTag, { value: "Module" })), Mi = () => `file-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, jn = (n) => {
2900
+ if (n === 0)
2901
+ return "0 B";
2902
+ const i = 1024, t = ["B", "KB", "MB", "GB", "TB"], l = Math.floor(Math.log(n) / Math.log(i));
2903
+ return `${parseFloat((n / Math.pow(i, l)).toFixed(2))} ${t[l]}`;
2904
+ }, Wn = (n) => n.startsWith("image/"), et = (n) => n.startsWith("video/"), vt = (n) => n.startsWith("audio/"), $i = (n) => Wn(n) ? "image" : et(n) ? "video" : vt(n) ? "music" : /pdf|word|document|text|json|xml/.test(n) ? "file" : /excel|spreadsheet/.test(n) ? "table" : /powerpoint|presentation/.test(n) ? "monitor" : /zip|rar|7z/.test(n) ? "box" : "folder", wi = (n) => {
2905
+ if (Wn(n.type) || et(n.type) || vt(n.type))
2906
+ return URL.createObjectURL(n);
2907
+ }, ki = {
2908
+ xxs: 24,
2909
+ xs: 32,
2910
+ sm: 48,
2911
+ md: 80,
2912
+ lg: 120,
2913
+ xl: 160,
2914
+ xxl: 200
2915
+ }, Ti = (n, i) => (t) => {
2916
+ const l = new FormData();
2917
+ t.chunk ? (l.append("chunk", t.chunk), l.append("chunkIndex", String(t.chunkIndex)), l.append("totalChunks", String(t.totalChunks)), l.append("fileName", t.file.name), l.append("fileId", t.fileId || "")) : l.append("file", t.file);
2918
+ const a = new XMLHttpRequest();
2919
+ return new Promise((o) => {
2920
+ a.upload.addEventListener("progress", (d) => {
2921
+ d.lengthComputable && t.onProgress && t.onProgress(d.loaded / d.total * 100);
2922
+ }), a.addEventListener("load", () => {
2923
+ if (a.status >= 200 && a.status < 300)
2924
+ try {
2925
+ const d = JSON.parse(a.responseText);
2926
+ o({
2927
+ success: !0,
2928
+ url: d.url,
2929
+ fileId: d.fileId || d.id,
2930
+ metadata: d
2931
+ });
2932
+ } catch {
2933
+ o({ success: !0, url: a.responseText });
2934
+ }
2935
+ else
2936
+ o({ success: !1, error: `Upload failed: ${a.status} ${a.statusText}` });
2937
+ }), a.addEventListener("error", () => o({ success: !1, error: "Network error" })), a.addEventListener("abort", () => o({ success: !1, error: "Upload cancelled" })), t.signal && t.signal.addEventListener("abort", () => a.abort()), a.open("POST", n), i && Object.entries(i).forEach(([d, y]) => a.setRequestHeader(d, y)), a.send(l);
2938
+ });
2939
+ }, bt = vn((n, i) => {
2940
+ const {
2941
+ accept: t,
2942
+ multiple: l = !0,
2943
+ maxFileSize: a,
2944
+ maxFiles: o,
2945
+ minFileSize: d,
2946
+ onFilesSelected: y,
2947
+ uploadMode: w = "instant",
2948
+ labelText: B,
2949
+ text: ne,
2950
+ dropzoneText: k,
2951
+ browseText: T,
2952
+ dragActiveText: H,
2953
+ labelPlacement: re = "right",
2954
+ icon: G = "upload",
2955
+ showFileList: V = !0,
2956
+ imagePreview: j,
2957
+ showPreview: Y = !0,
2958
+ listMode: me = "list",
2959
+ previewSize: _ = "md",
2960
+ fileProgress: ie,
2961
+ renderPreview: Z,
2962
+ renderFileItem: X,
2963
+ variant: ae = "dropzone",
2964
+ trigger: z,
2965
+ dropChildren: R,
2966
+ autoUpload: F = !1,
2967
+ uploadHandler: D,
2968
+ uploadUrl: K,
2969
+ uploadHeaders: U,
2970
+ concurrentUploads: O = 3,
2971
+ maxRetries: W = 3,
2972
+ chunkSize: P = 5 * 1024 * 1024,
2973
+ chunkThreshold: v = 10 * 1024 * 1024,
2974
+ validateFile: b,
2975
+ keepFilesAfterUpload: q = !0,
2976
+ initialFiles: se,
2977
+ disabled: u,
2978
+ readOnly: C,
2979
+ onFilesAdded: L,
2980
+ onUploadComplete: te,
2981
+ onUploadError: he,
2982
+ onProgress: be,
2983
+ onFileRemoved: J,
2984
+ onChange: m,
2985
+ apiRef: E,
2986
+ pasteFromClipboard: oe,
2987
+ className: xe,
2988
+ style: ke
2989
+ } = n, { t: ee } = Oe(), [le, ye] = Te(() => se ?? []), [Se, f] = Te(!1), c = Ce(le), N = Ce(null), ue = Ce(/* @__PURE__ */ new Map()), de = Ce([]), Q = Ce(/* @__PURE__ */ new Set()), g = Ce(0), Ye = Ce(() => {
2990
+ }), Ze = Ce(m), $ = !!(D || K);
2991
+ Fe(() => {
2992
+ c.current = le;
2993
+ }, [le]), Fe(() => {
2994
+ Ze.current = m;
2995
+ }), Fe(() => {
2996
+ Ze.current?.(le);
2997
+ }, [le]), Fe(
2998
+ () => () => {
2999
+ c.current.forEach((r) => r.previewUrl && URL.revokeObjectURL(r.previewUrl));
3000
+ },
3001
+ []
3002
+ );
3003
+ const pe = x(
3004
+ (r) => y(r.map((I) => I.file)),
3005
+ [y]
3006
+ ), A = x(
3007
+ (r) => {
3008
+ if (b) {
3009
+ const I = b(r);
3010
+ if (I)
3011
+ return I;
3012
+ }
3013
+ if (a && r.size > a)
3014
+ return ee("fileUpload.error.tooLarge", "File is too large. Maximum size: {size}").replace(
3015
+ "{size}",
3016
+ jn(a)
3017
+ );
3018
+ if (d && r.size < d)
3019
+ return ee("fileUpload.error.tooSmall", "File is too small. Minimum size: {size}").replace(
3020
+ "{size}",
3021
+ jn(d)
3022
+ );
3023
+ if (t) {
3024
+ const I = t.split(",").map((fe) => fe.trim().toLowerCase()), ce = r.type.toLowerCase(), $e = "." + (r.name.split(".").pop()?.toLowerCase() ?? "");
3025
+ if (!I.some((fe) => fe.startsWith(".") ? $e === fe : fe.endsWith("/*") ? ce.startsWith(fe.replace("/*", "/")) : ce === fe))
3026
+ return ee(
3027
+ "fileUpload.error.badType",
3028
+ "File type not allowed. Accepted types: {accept}"
3029
+ ).replace("{accept}", t);
3030
+ }
3031
+ return null;
3032
+ },
3033
+ [b, a, d, t, ee]
3034
+ ), we = x(() => D || (K ? Ti(K, U) : null), [D, K, U]), Ve = x(
3035
+ async (r, I, ce) => {
3036
+ const $e = r.file, De = Math.ceil($e.size / P);
3037
+ let fe = 0, Ee = { success: !1 };
3038
+ for (let Ae = 0; Ae < De; Ae++) {
3039
+ if (ce.aborted)
3040
+ throw new Error("Upload cancelled");
3041
+ const je = Ae * P, yn = Math.min(je + P, $e.size), Cn = $e.slice(je, yn);
3042
+ let pn = 0, Sn = !1;
3043
+ for (; !Sn && pn < W; )
3044
+ try {
3045
+ Ee = await I({
3046
+ file: $e,
3047
+ chunk: Cn,
3048
+ chunkIndex: Ae,
3049
+ totalChunks: De,
3050
+ fileId: r.id,
3051
+ onProgress: (Nn) => {
3052
+ const zn = (fe + Cn.size * Nn / 100) / $e.size * 100;
3053
+ ye(
3054
+ (Bn) => Bn.map((An) => An.id === r.id ? { ...An, progress: zn } : An)
3055
+ );
3056
+ },
3057
+ signal: ce
3058
+ }), Ee.success ? (Sn = !0, fe += Cn.size) : pn++;
3059
+ } catch (Nn) {
3060
+ if (pn++, pn >= W)
3061
+ throw Nn;
3062
+ }
3063
+ if (!Sn)
3064
+ throw new Error(`Failed to upload chunk ${Ae + 1}/${De}`);
3065
+ }
3066
+ return Ee;
3067
+ },
3068
+ [P, W]
3069
+ ), Ne = x(
3070
+ async (r, I) => {
3071
+ const ce = c.current.find((De) => De.id === r);
3072
+ if (!ce || ce.status === "uploading" || ce.status === "success")
3073
+ return;
3074
+ const $e = new AbortController();
3075
+ ue.current.set(r, $e), Q.current.add(r), ye(
3076
+ (De) => De.map(
3077
+ (fe) => fe.id === r ? { ...fe, status: "uploading", progress: 0, error: void 0 } : fe
3078
+ )
3079
+ );
3080
+ try {
3081
+ const De = ce.file;
3082
+ let fe;
3083
+ if (De.size > v ? fe = await Ve(ce, I, $e.signal) : fe = await I({
3084
+ file: De,
3085
+ onProgress: (Ee) => {
3086
+ ye((Ae) => Ae.map((je) => je.id === r ? { ...je, progress: Ee } : je)), be?.(ce, Ee);
3087
+ },
3088
+ signal: $e.signal
3089
+ }), fe.success) {
3090
+ if (ye(
3091
+ (Ee) => Ee.map(
3092
+ (Ae) => Ae.id === r ? {
3093
+ ...Ae,
3094
+ status: "success",
3095
+ progress: 100,
3096
+ uploadedUrl: fe.url,
3097
+ uploadedAt: /* @__PURE__ */ new Date()
3098
+ } : Ae
3099
+ )
3100
+ ), te?.({ ...ce, status: "success", uploadedUrl: fe.url }), !q) {
3101
+ const Ee = c.current.find((Ae) => Ae.id === r);
3102
+ Ee?.previewUrl && URL.revokeObjectURL(Ee.previewUrl), ye((Ae) => Ae.filter((je) => je.id !== r));
3103
+ }
3104
+ } else
3105
+ throw new Error(fe.error || "Upload failed");
3106
+ } catch (De) {
3107
+ const fe = De;
3108
+ if (fe.name === "AbortError" || fe.message === "Upload cancelled")
3109
+ ye(
3110
+ (Ee) => Ee.map(
3111
+ (Ae) => Ae.id === r ? {
3112
+ ...Ae,
3113
+ status: "cancelled",
3114
+ error: ee("fileUpload.status.cancelled", "Cancelled")
3115
+ } : Ae
3116
+ )
3117
+ );
3118
+ else {
3119
+ const Ee = fe.message || ee("fileUpload.error.generic", "Upload error");
3120
+ ye(
3121
+ (Ae) => Ae.map((je) => je.id === r ? { ...je, status: "error", error: Ee } : je)
3122
+ ), he?.(ce, Ee);
3123
+ }
3124
+ } finally {
3125
+ ue.current.delete(r), Q.current.delete(r), Ye.current();
3126
+ }
3127
+ },
3128
+ [
3129
+ v,
3130
+ Ve,
3131
+ be,
3132
+ te,
3133
+ he,
3134
+ q,
3135
+ ee
3136
+ ]
3137
+ ), en = Ce(Ne);
3138
+ Fe(() => {
3139
+ en.current = Ne;
3140
+ });
3141
+ const nn = x(() => {
3142
+ const r = we();
3143
+ if (r)
3144
+ for (; de.current.length > 0 && Q.current.size < O; ) {
3145
+ const I = de.current.shift();
3146
+ I && en.current(I, r);
3147
+ }
3148
+ }, [we, O]);
3149
+ Fe(() => {
3150
+ Ye.current = nn;
3151
+ });
3152
+ const M = x(
3153
+ (r) => {
3154
+ const I = we();
3155
+ if (!I) {
3156
+ console.error("No upload handler configured");
3157
+ return;
3158
+ }
3159
+ en.current(r, I);
3160
+ },
3161
+ [we]
3162
+ ), Ie = x(
3163
+ (r) => {
3164
+ ue.current.get(r)?.abort(), ye(
3165
+ (I) => I.map(
3166
+ (ce) => ce.id === r && ce.status === "uploading" ? { ...ce, status: "cancelled", error: ee("fileUpload.status.cancelled", "Cancelled") } : ce
3167
+ )
3168
+ );
3169
+ },
3170
+ [ee]
3171
+ ), tn = x(
3172
+ (r) => {
3173
+ ye(
3174
+ (I) => I.map(
3175
+ (ce) => ce.id === r ? { ...ce, status: "pending", progress: 0, error: void 0 } : ce
3176
+ )
3177
+ ), M(r);
3178
+ },
3179
+ [M]
3180
+ ), on = x(
3181
+ (r) => {
3182
+ const I = c.current.find(($e) => $e.id === r);
3183
+ if (!I)
3184
+ return;
3185
+ ue.current.get(r)?.abort(), I.previewUrl && URL.revokeObjectURL(I.previewUrl);
3186
+ const ce = c.current.filter(($e) => $e.id !== r);
3187
+ c.current = ce, ye(($e) => $e.filter((De) => De.id !== r)), J?.(I), w === "instant" && pe(ce);
3188
+ },
3189
+ [J, w, pe]
3190
+ ), Qe = x(() => {
3191
+ c.current.filter((r) => r.status === "pending").forEach((r) => de.current.push(r.id)), nn();
3192
+ }, [nn]), qe = x(() => {
3193
+ ue.current.forEach((r) => r.abort()), ye(
3194
+ (r) => r.map(
3195
+ (I) => I.status === "uploading" ? { ...I, status: "cancelled", error: ee("fileUpload.status.cancelled", "Cancelled") } : I
3196
+ )
3197
+ );
3198
+ }, [ee]), an = x(() => {
3199
+ qe(), c.current.forEach((r) => r.previewUrl && URL.revokeObjectURL(r.previewUrl)), ye([]), w === "instant" && pe([]);
3200
+ }, [qe, w, pe]), kn = x(() => {
3201
+ c.current.filter((r) => r.status === "error").forEach((r) => tn(r.id));
3202
+ }, [tn]), dn = x(
3203
+ (r) => {
3204
+ if (u || C)
3205
+ return;
3206
+ const I = c.current;
3207
+ let ce = l ? r : r.slice(0, 1);
3208
+ o && (ce = ce.slice(0, Math.max(0, o - I.length)));
3209
+ const $e = ce.map((fe) => {
3210
+ const Ee = A(fe);
3211
+ return {
3212
+ id: Mi(),
3213
+ file: fe,
3214
+ name: fe.name,
3215
+ size: fe.size,
3216
+ type: fe.type,
3217
+ status: Ee ? "error" : "pending",
3218
+ progress: 0,
3219
+ error: Ee || void 0,
3220
+ previewUrl: wi(fe)
3221
+ };
3222
+ }), De = l ? [...I, ...$e] : $e;
3223
+ ye(De), c.current = De, L?.($e), w === "instant" && pe(De), F && ($e.filter((fe) => fe.status === "pending").forEach((fe) => de.current.push(fe.id)), nn());
3224
+ },
3225
+ [
3226
+ u,
3227
+ C,
3228
+ l,
3229
+ o,
3230
+ A,
3231
+ L,
3232
+ w,
3233
+ pe,
3234
+ F,
3235
+ nn
3236
+ ]
3237
+ ), hn = x(() => N.current?.click(), []);
3238
+ Bt(
3239
+ E,
3240
+ () => ({
3241
+ addFiles: dn,
3242
+ uploadAll: Qe,
3243
+ cancelAll: qe,
3244
+ clearAll: an,
3245
+ getFiles: () => c.current,
3246
+ getFile: (r) => c.current.find((I) => I.id === r),
3247
+ retryFailed: kn,
3248
+ openFileBrowser: hn
3249
+ }),
3250
+ [dn, Qe, qe, an, kn, hn]
3251
+ ), Fe(() => {
3252
+ if (!oe || u || C)
3253
+ return;
3254
+ const r = (I) => {
3255
+ const ce = I.clipboardData?.items;
3256
+ if (!ce)
3257
+ return;
3258
+ const $e = [];
3259
+ for (let De = 0; De < ce.length; De++)
3260
+ if (ce[De].kind === "file") {
3261
+ const fe = ce[De].getAsFile();
3262
+ fe && $e.push(fe);
3263
+ }
3264
+ $e.length > 0 && (I.preventDefault(), dn($e));
3265
+ };
3266
+ return document.addEventListener("paste", r), () => document.removeEventListener("paste", r);
3267
+ }, [oe, u, C, dn]);
3268
+ const Fn = (r) => {
3269
+ r.preventDefault(), !(u || C) && (g.current++, f(!0));
3270
+ }, Pe = (r) => {
3271
+ r.preventDefault(), g.current--, g.current <= 0 && (g.current = 0, f(!1));
3272
+ }, gn = (r) => {
3273
+ r.preventDefault(), g.current = 0, f(!1), !(u || C) && dn(Array.from(r.dataTransfer.files));
3274
+ }, ln = (r) => {
3275
+ r.target.files && dn(Array.from(r.target.files)), r.target.value = "";
3276
+ }, rn = ve(() => {
3277
+ const r = { total: le.length, pending: 0, uploading: 0, success: 0, error: 0 };
3278
+ for (const I of le)
3279
+ I.status === "pending" ? r.pending++ : I.status === "uploading" ? r.uploading++ : I.status === "success" ? r.success++ : I.status === "error" && r.error++;
3280
+ return r;
3281
+ }, [le]), Tn = B ?? ne ?? k ?? ee("dropOrClick", "Drop files here or click to browse"), Ln = H ?? ee("fileUpload.dropzone.dragActive", "Drop files here"), Hn = (r) => ee(
3282
+ `fileUpload.status.${r}`,
3283
+ {
3284
+ pending: "Pending",
3285
+ uploading: "Uploading…",
3286
+ success: "Uploaded",
3287
+ error: "Error",
3288
+ cancelled: "Cancelled"
3289
+ }[r]
3290
+ ), bn = (r) => $ || r.status !== "pending", Pn = (r) => {
3291
+ if (Z)
3292
+ return Z(r);
3293
+ const I = ki[_] ?? 80, ce = j ?? Y;
3294
+ return ce && r.previewUrl && Wn(r.type) ? /* @__PURE__ */ e(
3295
+ "img",
3296
+ {
3297
+ src: r.previewUrl,
3298
+ alt: r.name,
3299
+ className: "nice-fileuploader__thumb nice-upload__thumb nice-upload__preview",
3300
+ style: { width: I, height: I, objectFit: "cover" }
3301
+ }
3302
+ ) : ce && r.previewUrl && et(r.type) ? /* @__PURE__ */ p(
3303
+ "span",
3304
+ {
3305
+ className: "nice-upload__preview",
3306
+ style: { position: "relative", display: "inline-flex" },
3307
+ children: [
3308
+ /* @__PURE__ */ e("video", { src: r.previewUrl, muted: !0, style: { width: I, height: I, objectFit: "cover" } }),
3309
+ /* @__PURE__ */ e("span", { className: "nice-upload__preview-overlay", "aria-hidden": "true", children: /* @__PURE__ */ e(ze, { name: "play", size: 20 }) })
3310
+ ]
3311
+ }
3312
+ ) : /* @__PURE__ */ e("span", { className: "nice-upload__preview nice-upload__preview--icon", "aria-hidden": "true", children: /* @__PURE__ */ e(ze, { name: $i(r.type), size: Math.round(I * 0.5) }) });
3313
+ }, un = (r) => {
3314
+ const I = {
3315
+ upload: () => M(r.id),
3316
+ cancel: () => Ie(r.id),
3317
+ retry: () => tn(r.id),
3318
+ remove: () => on(r.id)
3319
+ };
3320
+ if (X)
3321
+ return /* @__PURE__ */ e(Rn.Fragment, { children: X(r, I) }, r.id);
3322
+ const ce = ie?.[r.name] ?? r.progress, $e = bn(r);
3323
+ return /* @__PURE__ */ p(
3324
+ "div",
3325
+ {
3326
+ className: `nice-fileuploader__file nice-upload__file nice-upload__item nice-upload__item--${r.status}`,
3327
+ children: [
3328
+ (j ?? Y) && Pn(r),
3329
+ /* @__PURE__ */ e("span", { className: "nice-fileuploader__filename nice-upload__filename", title: r.name, children: r.name }),
3330
+ /* @__PURE__ */ e("span", { className: "nice-fileuploader__filesize nice-upload__filesize", children: jn(r.size) }),
3331
+ $e && /* @__PURE__ */ e("span", { className: `nice-upload__badge nice-upload__badge--${r.status}`, children: Hn(r.status) }),
3332
+ (r.status === "uploading" || ce != null && ce > 0 && ce < 100) && /* @__PURE__ */ e("div", { className: "nice-fileuploader__progress nice-upload__progress", children: /* @__PURE__ */ e(
3333
+ "div",
3334
+ {
3335
+ className: "nice-fileuploader__progress-bar nice-upload__progress-bar",
3336
+ style: { width: `${Math.min(100, Math.max(0, ce))}%` }
3337
+ }
3338
+ ) }),
3339
+ r.error && r.status === "error" && /* @__PURE__ */ e("span", { className: "nice-upload__item-error", children: r.error }),
3340
+ r.uploadedUrl && /* @__PURE__ */ e(
3341
+ "a",
3342
+ {
3343
+ className: "nice-upload__link",
3344
+ href: r.uploadedUrl,
3345
+ target: "_blank",
3346
+ rel: "noopener noreferrer",
3347
+ children: ee("fileUpload.openFile", "Open file")
3348
+ }
3349
+ ),
3350
+ !C && !u && /* @__PURE__ */ p("span", { className: "nice-upload__item-actions", children: [
3351
+ $ && r.status === "pending" && /* @__PURE__ */ e(
3352
+ "button",
3353
+ {
3354
+ type: "button",
3355
+ className: "nice-upload__btn nice-upload__btn--upload",
3356
+ onClick: I.upload,
3357
+ title: ee("fileUpload.action.upload", "Upload"),
3358
+ "aria-label": ee("fileUpload.action.upload", "Upload"),
3359
+ children: /* @__PURE__ */ e(ze, { name: "upload", size: 14 })
3360
+ }
3361
+ ),
3362
+ r.status === "uploading" && /* @__PURE__ */ e(
3363
+ "button",
3364
+ {
3365
+ type: "button",
3366
+ className: "nice-upload__btn nice-upload__btn--cancel",
3367
+ onClick: I.cancel,
3368
+ title: ee("fileUpload.action.cancel", "Cancel"),
3369
+ "aria-label": ee("fileUpload.action.cancel", "Cancel"),
3370
+ children: /* @__PURE__ */ e(ze, { name: "stop", size: 14 })
3371
+ }
3372
+ ),
3373
+ $ && r.status === "error" && /* @__PURE__ */ e(
3374
+ "button",
3375
+ {
3376
+ type: "button",
3377
+ className: "nice-upload__btn nice-upload__btn--retry",
3378
+ onClick: I.retry,
3379
+ title: ee("fileUpload.action.retry", "Retry"),
3380
+ "aria-label": ee("fileUpload.action.retry", "Retry"),
3381
+ children: /* @__PURE__ */ e(ze, { name: "refresh", size: 14 })
3382
+ }
3383
+ ),
3384
+ r.status !== "uploading" && /* @__PURE__ */ e(
3385
+ "button",
3386
+ {
3387
+ type: "button",
3388
+ className: "nice-fileuploader__remove nice-upload__remove nice-upload__btn nice-upload__btn--remove",
3389
+ onClick: I.remove,
3390
+ title: ee("remove", "Remove"),
3391
+ "aria-label": ee("remove", "Remove"),
3392
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
3393
+ }
3394
+ )
3395
+ ] })
3396
+ ]
3397
+ },
3398
+ r.id
3399
+ );
3400
+ }, In = (r) => {
3401
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), hn());
3402
+ }, Dn = /* @__PURE__ */ e(
3403
+ "input",
3404
+ {
3405
+ ref: N,
3406
+ type: "file",
3407
+ accept: t,
3408
+ multiple: l,
3409
+ hidden: !0,
3410
+ disabled: u,
3411
+ onChange: ln
3412
+ }
3413
+ );
3414
+ return /* @__PURE__ */ p(
3415
+ "div",
3416
+ {
3417
+ ref: i,
3418
+ className: `nice-fileuploader nice-upload ${u ? "nice-fileuploader--disabled nice-upload--disabled" : ""} ${C ? "nice-upload--readonly" : ""} ${xe || ""}`,
3419
+ style: ke,
3420
+ children: [
3421
+ ae === "button" ? /* @__PURE__ */ p(_n, { children: [
3422
+ /* @__PURE__ */ e(
3423
+ "button",
3424
+ {
3425
+ type: "button",
3426
+ className: "nice-upload__trigger nice-btn nice-btn--primary",
3427
+ onClick: hn,
3428
+ disabled: u || C,
3429
+ children: z ?? ee("filePicker.label", "Choose files")
3430
+ }
3431
+ ),
3432
+ Dn
3433
+ ] }) : !C && /* @__PURE__ */ p(
3434
+ "div",
3435
+ {
3436
+ className: `nice-fileuploader__dropzone nice-upload__dropzone nice-upload__dropzone--label-${re} ${!R && !Tn ? "nice-upload__dropzone--icon-only" : ""} ${Se ? "nice-fileuploader__dropzone--active nice-upload__dropzone--active" : ""}`,
3437
+ role: "button",
3438
+ tabIndex: u ? -1 : 0,
3439
+ "aria-disabled": u || void 0,
3440
+ onDragEnter: Fn,
3441
+ onDragOver: (r) => r.preventDefault(),
3442
+ onDragLeave: Pe,
3443
+ onDrop: gn,
3444
+ onClick: () => !u && hn(),
3445
+ onKeyDown: In,
3446
+ children: [
3447
+ Dn,
3448
+ R ?? /* @__PURE__ */ p(_n, { children: [
3449
+ G && /* @__PURE__ */ e("div", { className: "nice-upload__icon", "aria-hidden": "true", children: /* @__PURE__ */ e(ze, { name: G, size: "lg" }) }),
3450
+ (Se ? Ln : Tn) && /* @__PURE__ */ p("div", { className: "nice-fileuploader__label nice-upload__label", children: [
3451
+ Se ? Ln : Tn,
3452
+ T && /* @__PURE__ */ p("span", { className: "nice-upload__browse", children: [
3453
+ " ",
3454
+ T
3455
+ ] })
3456
+ ] })
3457
+ ] })
3458
+ ]
3459
+ }
3460
+ ),
3461
+ V && le.length > 0 && /* @__PURE__ */ e("div", { className: `nice-fileuploader__list nice-upload__list nice-upload__list--${me}`, children: le.map(un) }),
3462
+ $ && le.length > 0 && !C && /* @__PURE__ */ p("div", { className: "nice-upload__bulk", children: [
3463
+ rn.pending > 0 && /* @__PURE__ */ e(
3464
+ "button",
3465
+ {
3466
+ type: "button",
3467
+ className: "nice-btn nice-btn--primary nice-btn--sm",
3468
+ onClick: Qe,
3469
+ children: ee("fileUpload.bulk.uploadAll", "Upload all ({n})").replace(
3470
+ "{n}",
3471
+ String(rn.pending)
3472
+ )
3473
+ }
3474
+ ),
3475
+ rn.error > 0 && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: kn, children: ee("fileUpload.bulk.retryFailed", "Retry failed ({n})").replace(
3476
+ "{n}",
3477
+ String(rn.error)
3478
+ ) }),
3479
+ /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: an, children: ee("fileUpload.bulk.clear", "Clear") })
3480
+ ] }),
3481
+ !$ && w === "useButtons" && le.length > 0 && !C && /* @__PURE__ */ p("div", { className: "nice-fileuploader__actions nice-upload__actions", children: [
3482
+ /* @__PURE__ */ e(
3483
+ "button",
3484
+ {
3485
+ type: "button",
3486
+ className: "nice-btn nice-btn--primary nice-btn--sm",
3487
+ onClick: () => pe(c.current),
3488
+ children: ee("upload", "Upload")
3489
+ }
3490
+ ),
3491
+ /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: an, children: ee("clearAll", "Clear All") })
3492
+ ] })
3493
+ ]
3494
+ }
3495
+ );
3496
+ });
3497
+ bt.displayName = "NiceUpload";
3498
+ const Di = [
3499
+ { label: "Polska", value: "PL" },
3500
+ { label: "Deutschland", value: "DE" },
3501
+ { label: "Česko", value: "CZ" },
3502
+ { label: "Slovensko", value: "SK" },
3503
+ { label: "United Kingdom", value: "GB" },
3504
+ { label: "United States", value: "US" },
3505
+ { label: "France", value: "FR" },
3506
+ { label: "Italia", value: "IT" },
3507
+ { label: "España", value: "ES" },
3508
+ { label: "Nederland", value: "NL" }
3509
+ ], Ct = ({
3510
+ label: n,
3511
+ helperText: i,
3512
+ error: t,
3513
+ errorPlacement: l = "bottom",
3514
+ required: a,
3515
+ disabled: o,
3516
+ readOnly: d,
3517
+ loading: y,
3518
+ size: w = "md",
3519
+ className: B,
3520
+ style: ne,
3521
+ accessMode: k,
3522
+ id: T,
3523
+ value: H,
3524
+ defaultValue: re,
3525
+ onChange: G,
3526
+ columns: V = 2,
3527
+ showState: j = !1,
3528
+ showBuilding: Y = !0,
3529
+ showApartment: me = !0,
3530
+ showCountry: _ = !0,
3531
+ countryOptions: ie = Di,
3532
+ defaultCountry: Z = "PL",
3533
+ fieldLabels: X,
3534
+ fieldPlaceholders: ae,
3535
+ showLabel: z = !0,
3536
+ labelPlacement: R,
3537
+ labelWidth: F,
3538
+ controlWidth: D
3539
+ }) => {
3540
+ const K = sn(k, T), U = K === "hidden";
3541
+ K === "disabled" && (o = !0), K === "readOnly" && (d = !0);
3542
+ const { t: O } = Oe(), W = H !== void 0, [P, v] = Rn.useState(re ?? {}), b = W ? H : P, q = (m) => {
3543
+ const E = { ...b, ...m };
3544
+ W || v(E), G?.(E);
3545
+ }, se = {
3546
+ street: X?.street ?? O("address.street", "Street"),
3547
+ building: X?.building ?? O("address.building", "Building"),
3548
+ apartment: X?.apartment ?? O("address.apartment", "Apt."),
3549
+ postalCode: X?.postalCode ?? O("address.postalCode", "Postal code"),
3550
+ city: X?.city ?? O("address.city", "City"),
3551
+ state: X?.state ?? O("address.state", "State / Region"),
3552
+ country: X?.country ?? O("address.country", "Country")
3553
+ }, u = ae ?? {}, C = b.country ?? Z, L = R === "left" ? "left" : "top", te = {
3554
+ ...ne,
3555
+ ...F != null && {
3556
+ "--nice-field-label-width": typeof F == "number" ? `${F}px` : F
3557
+ },
3558
+ ...D != null && {
3559
+ "--nice-field-control-width": typeof D == "number" ? `${D}px` : D
3560
+ }
3561
+ }, he = {
3562
+ display: "grid",
3563
+ gridTemplateColumns: `repeat(${V}, minmax(0, 1fr))`,
3564
+ gap: "8px 12px"
3565
+ }, be = V === 2 ? { gridColumn: "span 2" } : {}, J = {
3566
+ size: w,
3567
+ disabled: o || y,
3568
+ readOnly: d,
3569
+ labelPlacement: L
3570
+ };
3571
+ return U ? null : /* @__PURE__ */ p(
3572
+ "div",
3573
+ {
3574
+ className: `nice-field nice-field--${w} nice-address nice-address--cols-${V} ${y ? "nice-field--loading" : ""} ${B || ""}`,
3575
+ style: te,
3576
+ "aria-busy": y || void 0,
3577
+ children: [
3578
+ z && n && /* @__PURE__ */ e("label", { className: `nice-field__label ${a ? "nice-field__label--required" : ""}`, children: n }),
3579
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
3580
+ /* @__PURE__ */ p("div", { className: "nice-address__grid", style: he, children: [
3581
+ /* @__PURE__ */ e("div", { style: be, children: /* @__PURE__ */ e(
3582
+ Xe,
3583
+ {
3584
+ ...J,
3585
+ label: se.street,
3586
+ value: b.street ?? "",
3587
+ onChange: (m) => q({ street: m }),
3588
+ placeholder: u.street,
3589
+ required: a
3590
+ }
3591
+ ) }),
3592
+ Y && /* @__PURE__ */ e(
3593
+ Xe,
3594
+ {
3595
+ ...J,
3596
+ label: se.building,
3597
+ value: b.building ?? "",
3598
+ onChange: (m) => q({ building: m }),
3599
+ placeholder: u.building
3600
+ }
3601
+ ),
3602
+ me && /* @__PURE__ */ e(
3603
+ Xe,
3604
+ {
3605
+ ...J,
3606
+ label: se.apartment,
3607
+ value: b.apartment ?? "",
3608
+ onChange: (m) => q({ apartment: m }),
3609
+ placeholder: u.apartment
3610
+ }
3611
+ ),
3612
+ /* @__PURE__ */ e(
3613
+ Xe,
3614
+ {
3615
+ ...J,
3616
+ label: se.postalCode,
3617
+ value: b.postalCode ?? "",
3618
+ onChange: (m) => q({ postalCode: m }),
3619
+ placeholder: u.postalCode ?? "00-000",
3620
+ required: a
3621
+ }
3622
+ ),
3623
+ /* @__PURE__ */ e(
3624
+ Xe,
3625
+ {
3626
+ ...J,
3627
+ label: se.city,
3628
+ value: b.city ?? "",
3629
+ onChange: (m) => q({ city: m }),
3630
+ placeholder: u.city,
3631
+ required: a
3632
+ }
3633
+ ),
3634
+ j && /* @__PURE__ */ e(
3635
+ Xe,
3636
+ {
3637
+ ...J,
3638
+ label: se.state,
3639
+ value: b.state ?? "",
3640
+ onChange: (m) => q({ state: m }),
3641
+ placeholder: u.state
3642
+ }
3643
+ ),
3644
+ _ && /* @__PURE__ */ e(
3645
+ pt,
3646
+ {
3647
+ ...J,
3648
+ label: se.country,
3649
+ value: C,
3650
+ onChange: (m) => q({ country: typeof m == "string" ? m : String(m ?? "") }),
3651
+ options: ie,
3652
+ required: a
3653
+ }
3654
+ )
3655
+ ] }),
3656
+ y && /* @__PURE__ */ e("span", { className: "nice-field__spinner nice-field__spinner--address", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
3657
+ l === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
3658
+ l === "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
3659
+ ] }),
3660
+ l !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
3661
+ l !== "right" && !t && i && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: i })
3662
+ ]
3663
+ }
3664
+ );
3665
+ };
3666
+ Ct.displayName = "NiceAddress";
3667
+ const Si = [
3668
+ { code: "US", name: "United States", dialCode: "+1", flag: "🇺🇸" },
3669
+ { code: "GB", name: "United Kingdom", dialCode: "+44", flag: "🇬🇧" },
3670
+ { code: "DE", name: "Germany", dialCode: "+49", flag: "🇩🇪" },
3671
+ { code: "FR", name: "France", dialCode: "+33", flag: "🇫🇷" },
3672
+ { code: "PL", name: "Poland", dialCode: "+48", flag: "🇵🇱" },
3673
+ { code: "ES", name: "Spain", dialCode: "+34", flag: "🇪🇸" },
3674
+ { code: "IT", name: "Italy", dialCode: "+39", flag: "🇮🇹" },
3675
+ { code: "NL", name: "Netherlands", dialCode: "+31", flag: "🇳🇱" },
3676
+ { code: "BE", name: "Belgium", dialCode: "+32", flag: "🇧🇪" },
3677
+ { code: "AT", name: "Austria", dialCode: "+43", flag: "🇦🇹" },
3678
+ { code: "CH", name: "Switzerland", dialCode: "+41", flag: "🇨🇭" },
3679
+ { code: "SE", name: "Sweden", dialCode: "+46", flag: "🇸🇪" },
3680
+ { code: "NO", name: "Norway", dialCode: "+47", flag: "🇳🇴" },
3681
+ { code: "DK", name: "Denmark", dialCode: "+45", flag: "🇩🇰" },
3682
+ { code: "FI", name: "Finland", dialCode: "+358", flag: "🇫🇮" },
3683
+ { code: "PT", name: "Portugal", dialCode: "+351", flag: "🇵🇹" },
3684
+ { code: "IE", name: "Ireland", dialCode: "+353", flag: "🇮🇪" },
3685
+ { code: "CZ", name: "Czech Republic", dialCode: "+420", flag: "🇨🇿" },
3686
+ { code: "SK", name: "Slovakia", dialCode: "+421", flag: "🇸🇰" },
3687
+ { code: "HU", name: "Hungary", dialCode: "+36", flag: "🇭🇺" },
3688
+ { code: "RO", name: "Romania", dialCode: "+40", flag: "🇷🇴" },
3689
+ { code: "BG", name: "Bulgaria", dialCode: "+359", flag: "🇧🇬" },
3690
+ { code: "GR", name: "Greece", dialCode: "+30", flag: "🇬🇷" },
3691
+ { code: "UA", name: "Ukraine", dialCode: "+380", flag: "🇺🇦" },
3692
+ { code: "RU", name: "Russia", dialCode: "+7", flag: "🇷🇺" },
3693
+ { code: "CA", name: "Canada", dialCode: "+1", flag: "🇨🇦" },
3694
+ { code: "AU", name: "Australia", dialCode: "+61", flag: "🇦🇺" },
3695
+ { code: "NZ", name: "New Zealand", dialCode: "+64", flag: "🇳🇿" },
3696
+ { code: "JP", name: "Japan", dialCode: "+81", flag: "🇯🇵" },
3697
+ { code: "KR", name: "South Korea", dialCode: "+82", flag: "🇰🇷" },
3698
+ { code: "CN", name: "China", dialCode: "+86", flag: "🇨🇳" },
3699
+ { code: "IN", name: "India", dialCode: "+91", flag: "🇮🇳" },
3700
+ { code: "SG", name: "Singapore", dialCode: "+65", flag: "🇸🇬" },
3701
+ { code: "MY", name: "Malaysia", dialCode: "+60", flag: "🇲🇾" },
3702
+ { code: "TH", name: "Thailand", dialCode: "+66", flag: "🇹🇭" },
3703
+ { code: "VN", name: "Vietnam", dialCode: "+84", flag: "🇻🇳" },
3704
+ { code: "ID", name: "Indonesia", dialCode: "+62", flag: "🇮🇩" },
3705
+ { code: "PH", name: "Philippines", dialCode: "+63", flag: "🇵🇭" },
3706
+ { code: "BR", name: "Brazil", dialCode: "+55", flag: "🇧🇷" },
3707
+ { code: "MX", name: "Mexico", dialCode: "+52", flag: "🇲🇽" },
3708
+ { code: "AR", name: "Argentina", dialCode: "+54", flag: "🇦🇷" },
3709
+ { code: "CL", name: "Chile", dialCode: "+56", flag: "🇨🇱" },
3710
+ { code: "CO", name: "Colombia", dialCode: "+57", flag: "🇨🇴" },
3711
+ { code: "PE", name: "Peru", dialCode: "+51", flag: "🇵🇪" },
3712
+ { code: "ZA", name: "South Africa", dialCode: "+27", flag: "🇿🇦" },
3713
+ { code: "EG", name: "Egypt", dialCode: "+20", flag: "🇪🇬" },
3714
+ { code: "NG", name: "Nigeria", dialCode: "+234", flag: "🇳🇬" },
3715
+ { code: "KE", name: "Kenya", dialCode: "+254", flag: "🇰🇪" },
3716
+ { code: "AE", name: "United Arab Emirates", dialCode: "+971", flag: "🇦🇪" },
3717
+ { code: "SA", name: "Saudi Arabia", dialCode: "+966", flag: "🇸🇦" },
3718
+ { code: "IL", name: "Israel", dialCode: "+972", flag: "🇮🇱" },
3719
+ { code: "TR", name: "Turkey", dialCode: "+90", flag: "🇹🇷" },
3720
+ // Additional countries
3721
+ { code: "AF", name: "Afghanistan", dialCode: "+93", flag: "🇦🇫" },
3722
+ { code: "AL", name: "Albania", dialCode: "+355", flag: "🇦🇱" },
3723
+ { code: "DZ", name: "Algeria", dialCode: "+213", flag: "🇩🇿" },
3724
+ { code: "AD", name: "Andorra", dialCode: "+376", flag: "🇦🇩" },
3725
+ { code: "AO", name: "Angola", dialCode: "+244", flag: "🇦🇴" },
3726
+ { code: "AG", name: "Antigua and Barbuda", dialCode: "+1268", flag: "🇦🇬" },
3727
+ { code: "AM", name: "Armenia", dialCode: "+374", flag: "🇦🇲" },
3728
+ { code: "AZ", name: "Azerbaijan", dialCode: "+994", flag: "🇦🇿" },
3729
+ { code: "BS", name: "Bahamas", dialCode: "+1242", flag: "🇧🇸" },
3730
+ { code: "BH", name: "Bahrain", dialCode: "+973", flag: "🇧🇭" },
3731
+ { code: "BD", name: "Bangladesh", dialCode: "+880", flag: "🇧🇩" },
3732
+ { code: "BB", name: "Barbados", dialCode: "+1246", flag: "🇧🇧" },
3733
+ { code: "BY", name: "Belarus", dialCode: "+375", flag: "🇧🇾" },
3734
+ { code: "BZ", name: "Belize", dialCode: "+501", flag: "🇧🇿" },
3735
+ { code: "BJ", name: "Benin", dialCode: "+229", flag: "🇧🇯" },
3736
+ { code: "BT", name: "Bhutan", dialCode: "+975", flag: "🇧🇹" },
3737
+ { code: "BO", name: "Bolivia", dialCode: "+591", flag: "🇧🇴" },
3738
+ { code: "BA", name: "Bosnia and Herzegovina", dialCode: "+387", flag: "🇧🇦" },
3739
+ { code: "BW", name: "Botswana", dialCode: "+267", flag: "🇧🇼" },
3740
+ { code: "BN", name: "Brunei", dialCode: "+673", flag: "🇧🇳" },
3741
+ { code: "BF", name: "Burkina Faso", dialCode: "+226", flag: "🇧🇫" },
3742
+ { code: "BI", name: "Burundi", dialCode: "+257", flag: "🇧🇮" },
3743
+ { code: "CV", name: "Cape Verde", dialCode: "+238", flag: "🇨🇻" },
3744
+ { code: "KH", name: "Cambodia", dialCode: "+855", flag: "🇰🇭" },
3745
+ { code: "CM", name: "Cameroon", dialCode: "+237", flag: "🇨🇲" },
3746
+ { code: "CF", name: "Central African Republic", dialCode: "+236", flag: "🇨🇫" },
3747
+ { code: "TD", name: "Chad", dialCode: "+235", flag: "🇹🇩" },
3748
+ { code: "KM", name: "Comoros", dialCode: "+269", flag: "🇰🇲" },
3749
+ { code: "CG", name: "Congo", dialCode: "+242", flag: "🇨🇬" },
3750
+ { code: "CD", name: "DR Congo", dialCode: "+243", flag: "🇨🇩" },
3751
+ { code: "CR", name: "Costa Rica", dialCode: "+506", flag: "🇨🇷" },
3752
+ { code: "CI", name: "Côte d'Ivoire", dialCode: "+225", flag: "🇨🇮" },
3753
+ { code: "HR", name: "Croatia", dialCode: "+385", flag: "🇭🇷" },
3754
+ { code: "CU", name: "Cuba", dialCode: "+53", flag: "🇨🇺" },
3755
+ { code: "CY", name: "Cyprus", dialCode: "+357", flag: "🇨🇾" },
3756
+ { code: "DJ", name: "Djibouti", dialCode: "+253", flag: "🇩🇯" },
3757
+ { code: "DM", name: "Dominica", dialCode: "+1767", flag: "🇩🇲" },
3758
+ { code: "DO", name: "Dominican Republic", dialCode: "+1809", flag: "🇩🇴" },
3759
+ { code: "EC", name: "Ecuador", dialCode: "+593", flag: "🇪🇨" },
3760
+ { code: "SV", name: "El Salvador", dialCode: "+503", flag: "🇸🇻" },
3761
+ { code: "GQ", name: "Equatorial Guinea", dialCode: "+240", flag: "🇬🇶" },
3762
+ { code: "ER", name: "Eritrea", dialCode: "+291", flag: "🇪🇷" },
3763
+ { code: "EE", name: "Estonia", dialCode: "+372", flag: "🇪🇪" },
3764
+ { code: "SZ", name: "Eswatini", dialCode: "+268", flag: "🇸🇿" },
3765
+ { code: "ET", name: "Ethiopia", dialCode: "+251", flag: "🇪🇹" },
3766
+ { code: "FJ", name: "Fiji", dialCode: "+679", flag: "🇫🇯" },
3767
+ { code: "GA", name: "Gabon", dialCode: "+241", flag: "🇬🇦" },
3768
+ { code: "GM", name: "Gambia", dialCode: "+220", flag: "🇬🇲" },
3769
+ { code: "GE", name: "Georgia", dialCode: "+995", flag: "🇬🇪" },
3770
+ { code: "GH", name: "Ghana", dialCode: "+233", flag: "🇬🇭" },
3771
+ { code: "GD", name: "Grenada", dialCode: "+1473", flag: "🇬🇩" },
3772
+ { code: "GT", name: "Guatemala", dialCode: "+502", flag: "🇬🇹" },
3773
+ { code: "GN", name: "Guinea", dialCode: "+224", flag: "🇬🇳" },
3774
+ { code: "GW", name: "Guinea-Bissau", dialCode: "+245", flag: "🇬🇼" },
3775
+ { code: "GY", name: "Guyana", dialCode: "+592", flag: "🇬🇾" },
3776
+ { code: "HT", name: "Haiti", dialCode: "+509", flag: "🇭🇹" },
3777
+ { code: "HN", name: "Honduras", dialCode: "+504", flag: "🇭🇳" },
3778
+ { code: "HK", name: "Hong Kong", dialCode: "+852", flag: "🇭🇰" },
3779
+ { code: "IS", name: "Iceland", dialCode: "+354", flag: "🇮🇸" },
3780
+ { code: "IQ", name: "Iraq", dialCode: "+964", flag: "🇮🇶" },
3781
+ { code: "IR", name: "Iran", dialCode: "+98", flag: "🇮🇷" },
3782
+ { code: "JM", name: "Jamaica", dialCode: "+1876", flag: "🇯🇲" },
3783
+ { code: "JO", name: "Jordan", dialCode: "+962", flag: "🇯🇴" },
3784
+ { code: "KZ", name: "Kazakhstan", dialCode: "+7", flag: "🇰🇿" },
3785
+ { code: "KW", name: "Kuwait", dialCode: "+965", flag: "🇰🇼" },
3786
+ { code: "KG", name: "Kyrgyzstan", dialCode: "+996", flag: "🇰🇬" },
3787
+ { code: "LA", name: "Laos", dialCode: "+856", flag: "🇱🇦" },
3788
+ { code: "LV", name: "Latvia", dialCode: "+371", flag: "🇱🇻" },
3789
+ { code: "LB", name: "Lebanon", dialCode: "+961", flag: "🇱🇧" },
3790
+ { code: "LS", name: "Lesotho", dialCode: "+266", flag: "🇱🇸" },
3791
+ { code: "LR", name: "Liberia", dialCode: "+231", flag: "🇱🇷" },
3792
+ { code: "LY", name: "Libya", dialCode: "+218", flag: "🇱🇾" },
3793
+ { code: "LI", name: "Liechtenstein", dialCode: "+423", flag: "🇱🇮" },
3794
+ { code: "LT", name: "Lithuania", dialCode: "+370", flag: "🇱🇹" },
3795
+ { code: "LU", name: "Luxembourg", dialCode: "+352", flag: "🇱🇺" },
3796
+ { code: "MO", name: "Macau", dialCode: "+853", flag: "🇲🇴" },
3797
+ { code: "MK", name: "North Macedonia", dialCode: "+389", flag: "🇲🇰" },
3798
+ { code: "MG", name: "Madagascar", dialCode: "+261", flag: "🇲🇬" },
3799
+ { code: "MW", name: "Malawi", dialCode: "+265", flag: "🇲🇼" },
3800
+ { code: "MV", name: "Maldives", dialCode: "+960", flag: "🇲🇻" },
3801
+ { code: "ML", name: "Mali", dialCode: "+223", flag: "🇲🇱" },
3802
+ { code: "MT", name: "Malta", dialCode: "+356", flag: "🇲🇹" },
3803
+ { code: "MR", name: "Mauritania", dialCode: "+222", flag: "🇲🇷" },
3804
+ { code: "MU", name: "Mauritius", dialCode: "+230", flag: "🇲🇺" },
3805
+ { code: "MD", name: "Moldova", dialCode: "+373", flag: "🇲🇩" },
3806
+ { code: "MC", name: "Monaco", dialCode: "+377", flag: "🇲🇨" },
3807
+ { code: "MN", name: "Mongolia", dialCode: "+976", flag: "🇲🇳" },
3808
+ { code: "ME", name: "Montenegro", dialCode: "+382", flag: "🇲🇪" },
3809
+ { code: "MA", name: "Morocco", dialCode: "+212", flag: "🇲🇦" },
3810
+ { code: "MZ", name: "Mozambique", dialCode: "+258", flag: "🇲🇿" },
3811
+ { code: "MM", name: "Myanmar", dialCode: "+95", flag: "🇲🇲" },
3812
+ { code: "NA", name: "Namibia", dialCode: "+264", flag: "🇳🇦" },
3813
+ { code: "NP", name: "Nepal", dialCode: "+977", flag: "🇳🇵" },
3814
+ { code: "NI", name: "Nicaragua", dialCode: "+505", flag: "🇳🇮" },
3815
+ { code: "NE", name: "Niger", dialCode: "+227", flag: "🇳🇪" },
3816
+ { code: "KP", name: "North Korea", dialCode: "+850", flag: "🇰🇵" },
3817
+ { code: "OM", name: "Oman", dialCode: "+968", flag: "🇴🇲" },
3818
+ { code: "PK", name: "Pakistan", dialCode: "+92", flag: "🇵🇰" },
3819
+ { code: "PS", name: "Palestine", dialCode: "+970", flag: "🇵🇸" },
3820
+ { code: "PA", name: "Panama", dialCode: "+507", flag: "🇵🇦" },
3821
+ { code: "PG", name: "Papua New Guinea", dialCode: "+675", flag: "🇵🇬" },
3822
+ { code: "PY", name: "Paraguay", dialCode: "+595", flag: "🇵🇾" },
3823
+ { code: "QA", name: "Qatar", dialCode: "+974", flag: "🇶🇦" },
3824
+ { code: "RW", name: "Rwanda", dialCode: "+250", flag: "🇷🇼" },
3825
+ { code: "WS", name: "Samoa", dialCode: "+685", flag: "🇼🇸" },
3826
+ { code: "SM", name: "San Marino", dialCode: "+378", flag: "🇸🇲" },
3827
+ { code: "ST", name: "São Tomé and Príncipe", dialCode: "+239", flag: "🇸🇹" },
3828
+ { code: "SN", name: "Senegal", dialCode: "+221", flag: "🇸🇳" },
3829
+ { code: "RS", name: "Serbia", dialCode: "+381", flag: "🇷🇸" },
3830
+ { code: "SC", name: "Seychelles", dialCode: "+248", flag: "🇸🇨" },
3831
+ { code: "SL", name: "Sierra Leone", dialCode: "+232", flag: "🇸🇱" },
3832
+ { code: "SI", name: "Slovenia", dialCode: "+386", flag: "🇸🇮" },
3833
+ { code: "SB", name: "Solomon Islands", dialCode: "+677", flag: "🇸🇧" },
3834
+ { code: "SO", name: "Somalia", dialCode: "+252", flag: "🇸🇴" },
3835
+ { code: "SS", name: "South Sudan", dialCode: "+211", flag: "🇸🇸" },
3836
+ { code: "LK", name: "Sri Lanka", dialCode: "+94", flag: "🇱🇰" },
3837
+ { code: "SD", name: "Sudan", dialCode: "+249", flag: "🇸🇩" },
3838
+ { code: "SR", name: "Suriname", dialCode: "+597", flag: "🇸🇷" },
3839
+ { code: "SY", name: "Syria", dialCode: "+963", flag: "🇸🇾" },
3840
+ { code: "TW", name: "Taiwan", dialCode: "+886", flag: "🇹🇼" },
3841
+ { code: "TJ", name: "Tajikistan", dialCode: "+992", flag: "🇹🇯" },
3842
+ { code: "TZ", name: "Tanzania", dialCode: "+255", flag: "🇹🇿" },
3843
+ { code: "TL", name: "Timor-Leste", dialCode: "+670", flag: "🇹🇱" },
3844
+ { code: "TG", name: "Togo", dialCode: "+228", flag: "🇹🇬" },
3845
+ { code: "TO", name: "Tonga", dialCode: "+676", flag: "🇹🇴" },
3846
+ { code: "TT", name: "Trinidad and Tobago", dialCode: "+1868", flag: "🇹🇹" },
3847
+ { code: "TN", name: "Tunisia", dialCode: "+216", flag: "🇹🇳" },
3848
+ { code: "TM", name: "Turkmenistan", dialCode: "+993", flag: "🇹🇲" },
3849
+ { code: "UG", name: "Uganda", dialCode: "+256", flag: "🇺🇬" },
3850
+ { code: "UY", name: "Uruguay", dialCode: "+598", flag: "🇺🇾" },
3851
+ { code: "UZ", name: "Uzbekistan", dialCode: "+998", flag: "🇺🇿" },
3852
+ { code: "VU", name: "Vanuatu", dialCode: "+678", flag: "🇻🇺" },
3853
+ { code: "VA", name: "Vatican City", dialCode: "+379", flag: "🇻🇦" },
3854
+ { code: "VE", name: "Venezuela", dialCode: "+58", flag: "🇻🇪" },
3855
+ { code: "YE", name: "Yemen", dialCode: "+967", flag: "🇾🇪" },
3856
+ { code: "ZM", name: "Zambia", dialCode: "+260", flag: "🇿🇲" },
3857
+ { code: "ZW", name: "Zimbabwe", dialCode: "+263", flag: "🇿🇼" }
3858
+ ], Nt = ({
3859
+ value: n,
3860
+ defaultValue: i,
3861
+ onChange: t,
3862
+ placeholder: l,
3863
+ showSearch: a = !0,
3864
+ searchPlaceholder: o,
3865
+ showDialCode: d,
3866
+ showFlag: y,
3867
+ showFlagInValue: w,
3868
+ showFlagInMenu: B,
3869
+ showTextInValue: ne,
3870
+ showTextInMenu: k,
3871
+ showDialCodeInValue: T,
3872
+ showDialCodeInMenu: H,
3873
+ showCodeInValue: re = !1,
3874
+ showCodeInMenu: G = !1,
3875
+ compact: V = !1,
3876
+ variant: j = "default",
3877
+ dropdownAlign: Y,
3878
+ disabled: me = !1,
3879
+ countries: _,
3880
+ priorityCountries: ie = ["US", "GB", "DE", "FR", "PL"],
3881
+ allowClear: Z = !1,
3882
+ size: X = "md",
3883
+ className: ae = "",
3884
+ style: z,
3885
+ // NiceFormFieldProps extras (label/error/state placement etc.)
3886
+ label: R,
3887
+ helperText: F,
3888
+ error: D,
3889
+ required: K,
3890
+ readOnly: U,
3891
+ loading: O,
3892
+ labelPlacement: W,
3893
+ errorPlacement: P,
3894
+ labelWidth: v,
3895
+ controlWidth: b,
3896
+ id: q,
3897
+ "data-testid": se = "nice-country-picker"
3898
+ }) => {
3899
+ const { t: u } = Oe(), C = Ce(null), L = Ce(null), te = Ce(null), [he, be] = Te(i), [J, m] = Te(!1), [E, oe] = Te(""), [xe, ke] = Te(0), ee = w ?? y ?? !0, le = B ?? y ?? !0, ye = ne ?? !V, Se = k ?? !0, f = T ?? d ?? !V, c = H ?? d ?? !0, N = Gt(
3900
+ J,
3901
+ L,
3902
+ Y ?? (V ? "auto" : "left")
3903
+ ), ue = n !== void 0 ? n : he, de = ve(() => {
3904
+ let A = Si;
3905
+ if (_) {
3906
+ const we = new Set(_.map((Ve) => Ve.toUpperCase()));
3907
+ A = A.filter((Ve) => we.has(Ve.code));
3908
+ }
3909
+ return A;
3910
+ }, [_]), Q = ve(() => {
3911
+ if (!ie?.length)
3912
+ return de;
3913
+ const A = new Set(ie.map((Ne) => Ne.toUpperCase())), we = de.filter((Ne) => A.has(Ne.code)), Ve = de.filter((Ne) => !A.has(Ne.code));
3914
+ return [...we, ...Ve];
3915
+ }, [de, ie]), g = ve(() => {
3916
+ if (!E)
3917
+ return Q;
3918
+ const A = E.toLowerCase();
3919
+ return Q.filter(
3920
+ (we) => we.name.toLowerCase().includes(A) || we.code.toLowerCase().includes(A) || we.dialCode.includes(A)
3921
+ );
3922
+ }, [Q, E]), Ye = ve(() => ue ? de.find((A) => A.code === ue) ?? null : null, [ue, de]);
3923
+ Fe(() => {
3924
+ if (!J)
3925
+ return;
3926
+ const A = (we) => {
3927
+ C.current && !C.current.contains(we.target) && (m(!1), oe(""));
3928
+ };
3929
+ return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
3930
+ }, [J]), Fe(() => {
3931
+ J && a && te.current && te.current.focus();
3932
+ }, [J, a]), Fe(() => {
3933
+ ke(0);
3934
+ }, [E]);
3935
+ const Ze = x(
3936
+ (A) => {
3937
+ n === void 0 && be(A.code), t?.(A), m(!1), oe("");
3938
+ },
3939
+ [n, t]
3940
+ ), $ = x(
3941
+ (A) => {
3942
+ A.stopPropagation(), n === void 0 && be(void 0), t?.(null);
3943
+ },
3944
+ [n, t]
3945
+ ), pe = x(
3946
+ (A) => {
3947
+ if (!J) {
3948
+ (A.key === "Enter" || A.key === " " || A.key === "ArrowDown") && (A.preventDefault(), m(!0));
3949
+ return;
3950
+ }
3951
+ switch (A.key) {
3952
+ case "ArrowDown":
3953
+ A.preventDefault(), ke((we) => Math.min(we + 1, g.length - 1));
3954
+ break;
3955
+ case "ArrowUp":
3956
+ A.preventDefault(), ke((we) => Math.max(we - 1, 0));
3957
+ break;
3958
+ case "Enter":
3959
+ A.preventDefault(), g[xe] && Ze(g[xe]);
3960
+ break;
3961
+ case "Escape":
3962
+ A.preventDefault(), m(!1), oe("");
3963
+ break;
3964
+ }
3965
+ },
3966
+ [J, g, xe, Ze]
3967
+ );
3968
+ return /* @__PURE__ */ p(
3969
+ "div",
3970
+ {
3971
+ ref: C,
3972
+ className: `nice-field nice-field--${X} nice-field--country-picker ${W === "left" ? "nice-field--label-left" : ""} ${P === "right" ? "nice-field--error-right" : ""} ${D ? "nice-field--error" : ""} ${O ? "nice-field--loading" : ""} nice-country-picker nice-country-picker--${X} ${V ? "nice-country-picker--compact" : ""} ${j === "ghost" ? "nice-country-picker--ghost" : ""} ${J ? "nice-country-picker--open" : ""} ${me ? "nice-country-picker--disabled" : ""} ${ae}`,
3973
+ style: {
3974
+ ...z,
3975
+ ...v != null && {
3976
+ "--nice-field-label-width": typeof v == "number" ? `${v}px` : v
3977
+ },
3978
+ ...b != null && {
3979
+ "--nice-field-control-width": typeof b == "number" ? `${b}px` : b
3980
+ }
3981
+ },
3982
+ "data-testid": se,
3983
+ "aria-busy": O || void 0,
3984
+ children: [
3985
+ R && /* @__PURE__ */ p("label", { className: "nice-field__label", htmlFor: q, children: [
3986
+ R,
3987
+ K && /* @__PURE__ */ e("span", { className: "nice-field__required", children: "*" })
3988
+ ] }),
3989
+ /* @__PURE__ */ p("div", { className: "nice-field__control", children: [
3990
+ /* @__PURE__ */ p(
3991
+ "button",
3992
+ {
3993
+ ref: L,
3994
+ type: "button",
3995
+ className: "nice-country-picker__trigger",
3996
+ onClick: () => !me && !U && m(!J),
3997
+ onKeyDown: pe,
3998
+ disabled: me,
3999
+ id: q,
4000
+ "aria-haspopup": "listbox",
4001
+ "aria-expanded": J,
4002
+ "aria-invalid": D ? !0 : void 0,
4003
+ "data-testid": `${se}-trigger`,
4004
+ children: [
4005
+ Ye ? /* @__PURE__ */ p("span", { className: "nice-country-picker__value", children: [
4006
+ ee && /* @__PURE__ */ e("span", { className: "nice-country-picker__flag", "aria-hidden": "true", children: /* @__PURE__ */ e(tt, { code: Ye.code }) }),
4007
+ ye && /* @__PURE__ */ e("span", { className: "nice-country-picker__name", children: Ye.name }),
4008
+ re && /* @__PURE__ */ e("span", { className: "nice-country-picker__code", children: Ye.code }),
4009
+ f && /* @__PURE__ */ p("span", { className: "nice-country-picker__dial-code", children: [
4010
+ "(",
4011
+ Ye.dialCode,
4012
+ ")"
4013
+ ] })
4014
+ ] }) : /* @__PURE__ */ e("span", { className: "nice-country-picker__placeholder", children: V ? "" : l ?? u("controls.select", "Select country") }),
4015
+ /* @__PURE__ */ p("span", { className: "nice-country-picker__icons", children: [
4016
+ Z && Ye && !me && !U && /* @__PURE__ */ e(
4017
+ "span",
4018
+ {
4019
+ className: "nice-country-picker__clear",
4020
+ onClick: $,
4021
+ "aria-label": u("clear", "Clear"),
4022
+ children: /* @__PURE__ */ e(ze, { name: "close", size: 14 })
4023
+ }
4024
+ ),
4025
+ j !== "ghost" && /* @__PURE__ */ e("span", { className: "nice-country-picker__arrow", children: /* @__PURE__ */ e(ze, { name: J ? "chevron-up" : "chevron-down", size: 16 }) })
4026
+ ] })
4027
+ ]
4028
+ }
4029
+ ),
4030
+ J && /* @__PURE__ */ p(
4031
+ "div",
4032
+ {
4033
+ className: `nice-country-picker__dropdown nice-country-picker__dropdown--align-${N}`,
4034
+ role: "listbox",
4035
+ "data-testid": `${se}-dropdown`,
4036
+ children: [
4037
+ a && /* @__PURE__ */ e("div", { className: "nice-country-picker__search", children: /* @__PURE__ */ e(
4038
+ "input",
4039
+ {
4040
+ ref: te,
4041
+ type: "text",
4042
+ value: E,
4043
+ onChange: (A) => oe(A.target.value),
4044
+ onKeyDown: pe,
4045
+ placeholder: o ?? u("search", "Search"),
4046
+ className: "nice-country-picker__search-input",
4047
+ "data-testid": `${se}-search`
4048
+ }
4049
+ ) }),
4050
+ /* @__PURE__ */ e("div", { className: "nice-country-picker__list", children: g.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-country-picker__empty", children: u("noData", "No countries found") }) : g.map((A, we) => /* @__PURE__ */ p(
4051
+ "div",
4052
+ {
4053
+ className: `nice-country-picker__option ${A.code === ue ? "nice-country-picker__option--selected" : ""} ${we === xe ? "nice-country-picker__option--highlighted" : ""}`,
4054
+ onClick: () => Ze(A),
4055
+ onMouseEnter: () => ke(we),
4056
+ role: "option",
4057
+ "aria-selected": A.code === ue,
4058
+ "data-testid": `${se}-option-${A.code}`,
4059
+ children: [
4060
+ le && /* @__PURE__ */ e("span", { className: "nice-country-picker__flag", "aria-hidden": "true", children: /* @__PURE__ */ e(tt, { code: A.code }) }),
4061
+ Se && /* @__PURE__ */ e("span", { className: "nice-country-picker__name", children: A.name }),
4062
+ G && /* @__PURE__ */ e("span", { className: "nice-country-picker__code", children: A.code }),
4063
+ c && /* @__PURE__ */ e("span", { className: "nice-country-picker__dial-code", children: A.dialCode })
4064
+ ]
4065
+ },
4066
+ A.code
4067
+ )) })
4068
+ ]
4069
+ }
4070
+ ),
4071
+ O && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
4072
+ P === "right" && D && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: D }),
4073
+ P === "right" && !D && F && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: F })
4074
+ ] }),
4075
+ P !== "right" && D && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: D }),
4076
+ P !== "right" && !D && F && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: F })
4077
+ ]
4078
+ }
4079
+ );
4080
+ };
4081
+ Nt.displayName = "NiceCountryPicker";
4082
+ const Ai = ({
4083
+ items: n,
4084
+ data: i,
4085
+ onFieldChange: t,
4086
+ onSubmit: l,
4087
+ dataSource: a,
4088
+ recordKey: o,
4089
+ columns: d = 1,
4090
+ responsiveColumns: y,
4091
+ gap: w = 16,
4092
+ labelPosition: B = "top",
4093
+ size: ne = "md",
4094
+ readOnly: k,
4095
+ disabled: T,
4096
+ className: H,
4097
+ style: re,
4098
+ accessMode: G,
4099
+ id: V,
4100
+ autoSaveDelay: j,
4101
+ onDirtyChange: Y,
4102
+ showActions: me,
4103
+ submitLabel: _ = "Submit",
4104
+ resetLabel: ie = "Reset",
4105
+ onCancel: Z,
4106
+ cancelLabel: X = "Cancel"
4107
+ }) => {
4108
+ const ae = sn(G, V), z = ae === "hidden";
4109
+ ae === "disabled" && (T = !0), ae === "readOnly" && (k = !0);
4110
+ const R = It(a ?? null, o), F = !!a && o != null, D = F ? R.editData : i ?? {}, [K] = Te(() => ({ ...D })), [U, O] = Te([]), W = ve(() => Object.keys(D).some((f) => D[f] !== K[f]), [D, K]), P = Ce(!1);
4111
+ Fe(() => {
4112
+ W !== P.current && (P.current = W, Y?.(W));
4113
+ }, [W, Y]);
4114
+ const v = Ce(null), b = x(() => {
4115
+ j && (v.current && clearTimeout(v.current), v.current = setTimeout(() => {
4116
+ F ? R.save() : l?.(D);
4117
+ }, j));
4118
+ }, [j, F, R, l, D]), q = x(
4119
+ (f, c) => {
4120
+ k || T || (O((N) => [...N, { field: f, prev: D[f] }]), F ? R.set(f, c) : t?.(f, c), b());
4121
+ },
4122
+ [F, R, t, k, T, D, b]
4123
+ ), se = x(() => {
4124
+ if (U.length === 0)
4125
+ return;
4126
+ const f = U[U.length - 1];
4127
+ O((c) => c.slice(0, -1)), F ? R.set(f.field, f.prev) : t?.(f.field, f.prev);
4128
+ }, [U, F, R, t]), u = x(
4129
+ (f) => {
4130
+ f.preventDefault(), v.current && clearTimeout(v.current), F ? R.save() : l?.(D);
4131
+ },
4132
+ [D, l, F, R]
4133
+ ), C = Ce(null), [L, te] = Te(d);
4134
+ Fe(() => {
4135
+ if (!y || !C.current) {
4136
+ te(d);
4137
+ return;
4138
+ }
4139
+ const f = C.current, c = new ResizeObserver((N) => {
4140
+ const ue = N[0]?.contentRect.width ?? 0, de = Object.keys(y).map(Number).sort((Q, g) => g - Q);
4141
+ for (const Q of de)
4142
+ if (ue >= Q) {
4143
+ te(y[Q]);
4144
+ return;
4145
+ }
4146
+ te(d);
4147
+ });
4148
+ return c.observe(f), () => c.disconnect();
4149
+ }, [y, d]);
4150
+ const he = ve(
4151
+ () => n.filter((f) => !(f.visible === !1 || f.visibleWhen && !f.visibleWhen(D))),
4152
+ [n, D]
4153
+ ), be = ve(() => {
4154
+ const f = [];
4155
+ let c = null;
4156
+ for (const N of he)
4157
+ !c || c.name !== N.group ? (c = { name: N.group, items: [N] }, f.push(c)) : c.items.push(N);
4158
+ return f;
4159
+ }, [he]), J = x(
4160
+ (f) => {
4161
+ const c = D[f.field] !== void 0 ? D[f.field] : f.defaultValue, N = (g) => q(f.field, g);
4162
+ if (f.render)
4163
+ return f.render(c, N);
4164
+ const ue = f.type || "text", de = f.options?.map(
4165
+ (g) => typeof g == "string" ? { label: g, value: g } : { label: g.label, value: String(g.value) }
4166
+ ), Q = { size: ne, disabled: T, readOnly: k };
4167
+ switch (ue) {
4168
+ case "number":
4169
+ return /* @__PURE__ */ e(
4170
+ it,
4171
+ {
4172
+ ...Q,
4173
+ value: c ?? null,
4174
+ onChange: (g) => N(g),
4175
+ required: f.required
4176
+ }
4177
+ );
4178
+ case "currency":
4179
+ return /* @__PURE__ */ e(
4180
+ it,
4181
+ {
4182
+ ...Q,
4183
+ value: c ?? null,
4184
+ onChange: (g) => N(g),
4185
+ required: f.required,
4186
+ precision: f.precision ?? 2,
4187
+ step: f.step ?? 100,
4188
+ suffix: f.unit ?? "PLN",
4189
+ formatPreset: "money"
4190
+ }
4191
+ );
4192
+ case "textarea":
4193
+ return /* @__PURE__ */ e(Zn, { ...Q, value: c ?? "", onChange: (g) => N(g), rows: 3 });
4194
+ case "address":
4195
+ return /* @__PURE__ */ e(
4196
+ Ct,
4197
+ {
4198
+ ...Q,
4199
+ value: c ?? {},
4200
+ onChange: (g) => N(g),
4201
+ required: f.required,
4202
+ columns: f.columns ?? 2
4203
+ }
4204
+ );
4205
+ case "select":
4206
+ return /* @__PURE__ */ e(
4207
+ pt,
4208
+ {
4209
+ ...Q,
4210
+ value: c ?? "",
4211
+ onChange: (g) => N(g),
4212
+ options: de ?? []
4213
+ }
4214
+ );
4215
+ case "autocomplete":
4216
+ return /* @__PURE__ */ e(
4217
+ fi,
4218
+ {
4219
+ ...Q,
4220
+ value: c ?? "",
4221
+ onChange: (g) => N(g),
4222
+ options: de ?? [],
4223
+ suggestions: (de ?? []).map((g) => g.label)
4224
+ }
4225
+ );
4226
+ case "radio":
4227
+ return /* @__PURE__ */ e(
4228
+ gt,
4229
+ {
4230
+ ...Q,
4231
+ value: c ?? "",
4232
+ onChange: (g) => N(g),
4233
+ options: de ?? []
4234
+ }
4235
+ );
4236
+ case "checkbox":
4237
+ return /* @__PURE__ */ e(
4238
+ jt,
4239
+ {
4240
+ ...Q,
4241
+ checked: !!c,
4242
+ onChange: (g) => N(g),
4243
+ label: f.label
4244
+ }
4245
+ );
4246
+ case "toggle":
4247
+ return /* @__PURE__ */ e(Vt, { ...Q, checked: !!c, onChange: (g) => N(g) });
4248
+ case "date":
4249
+ return /* @__PURE__ */ e(Un, { ...Q, value: c ?? "", onChange: (g) => N(g) });
4250
+ case "time":
4251
+ return /* @__PURE__ */ e(
4252
+ Un,
4253
+ {
4254
+ ...Q,
4255
+ dateFormatPreset: "time",
4256
+ value: c ?? "",
4257
+ onChange: (g) => N(g)
4258
+ }
4259
+ );
4260
+ case "datetime":
4261
+ return /* @__PURE__ */ e(
4262
+ Un,
4263
+ {
4264
+ ...Q,
4265
+ dateFormatPreset: "datetime-local",
4266
+ value: c ?? "",
4267
+ onChange: (g) => N(g)
4268
+ }
4269
+ );
4270
+ case "color":
4271
+ return /* @__PURE__ */ e(
4272
+ Yt,
4273
+ {
4274
+ ...Q,
4275
+ value: c ?? "var(--text-primary, #000000)",
4276
+ onChange: (g) => N(g)
4277
+ }
4278
+ );
4279
+ case "slider":
4280
+ return /* @__PURE__ */ e(
4281
+ Qn,
4282
+ {
4283
+ ...Q,
4284
+ value: typeof c == "number" ? c : 0,
4285
+ onChange: (g) => N(g)
4286
+ }
4287
+ );
4288
+ case "rating":
4289
+ return /* @__PURE__ */ e(
4290
+ Xn,
4291
+ {
4292
+ ...Q,
4293
+ value: typeof c == "number" ? c : 0,
4294
+ onChange: (g) => N(g)
4295
+ }
4296
+ );
4297
+ case "password":
4298
+ return /* @__PURE__ */ e(
4299
+ _t,
4300
+ {
4301
+ ...Q,
4302
+ value: c ?? "",
4303
+ onChange: (g) => N(g),
4304
+ required: f.required
4305
+ }
4306
+ );
4307
+ case "phone":
4308
+ case "tel":
4309
+ return /* @__PURE__ */ e(
4310
+ Xe,
4311
+ {
4312
+ ...Q,
4313
+ type: "tel",
4314
+ value: c ?? "",
4315
+ onChange: (g) => N(g),
4316
+ required: f.required
4317
+ }
4318
+ );
4319
+ case "country":
4320
+ return /* @__PURE__ */ e(Nt, { ...Q, value: c ?? "", onChange: (g) => N(g) });
4321
+ case "tags":
4322
+ return /* @__PURE__ */ e(
4323
+ mi,
4324
+ {
4325
+ ...Q,
4326
+ value: Array.isArray(c) ? c : [],
4327
+ onChange: (g) => N(g),
4328
+ options: de ?? []
4329
+ }
4330
+ );
4331
+ case "masked":
4332
+ return /* @__PURE__ */ e(
4333
+ yt,
4334
+ {
4335
+ ...Q,
4336
+ value: c ?? "",
4337
+ mask: f.mask ?? "999-999-9999",
4338
+ onChange: (g) => N(g)
4339
+ }
4340
+ );
4341
+ case "file":
4342
+ return /* @__PURE__ */ e(bt, { ...Q, onFilesSelected: (g) => N(g) });
4343
+ case "email":
4344
+ return /* @__PURE__ */ e(
4345
+ Xe,
4346
+ {
4347
+ ...Q,
4348
+ type: "email",
4349
+ value: c ?? "",
4350
+ onChange: (g) => N(g),
4351
+ required: f.required
4352
+ }
4353
+ );
4354
+ case "url":
4355
+ return /* @__PURE__ */ e(
4356
+ Xe,
4357
+ {
4358
+ ...Q,
4359
+ type: "url",
4360
+ value: c ?? "",
4361
+ onChange: (g) => N(g),
4362
+ required: f.required
4363
+ }
4364
+ );
4365
+ default:
4366
+ return /* @__PURE__ */ e(
4367
+ Xe,
4368
+ {
4369
+ ...Q,
4370
+ value: c ?? "",
4371
+ onChange: (g) => N(g),
4372
+ required: f.required
4373
+ }
4374
+ );
4375
+ }
4376
+ },
4377
+ [D, q, T, k, ne]
4378
+ ), m = (f) => /* @__PURE__ */ p(
4379
+ "div",
4380
+ {
4381
+ className: "nice-form__item",
4382
+ style: { gridColumn: f.colSpan ? `span ${f.colSpan}` : void 0 },
4383
+ children: [
4384
+ f.label && /* @__PURE__ */ p("label", { className: "nice-form__label", children: [
4385
+ f.label,
4386
+ f.required && /* @__PURE__ */ e("span", { className: "nice-field__required", children: "*" })
4387
+ ] }),
4388
+ /* @__PURE__ */ e("div", { className: "nice-form__control", children: J(f) }),
4389
+ f.hint && /* @__PURE__ */ e("div", { className: "nice-form__hint", children: f.hint })
4390
+ ]
4391
+ },
4392
+ f.field
4393
+ ), E = {
4394
+ display: "grid",
4395
+ gridTemplateColumns: `repeat(${L}, 1fr)`,
4396
+ gap: w
4397
+ }, oe = be.some((f) => f.name != null), xe = ve(() => {
4398
+ const f = /* @__PURE__ */ new Set(), c = [];
4399
+ for (const N of he)
4400
+ N.tab && !f.has(N.tab) && (f.add(N.tab), c.push(N.tab));
4401
+ return c;
4402
+ }, [he]), ke = xe.length > 0, [ee, le] = Te("");
4403
+ Fe(() => {
4404
+ ke && !xe.includes(ee) && le(xe[0]);
4405
+ }, [ke, xe, ee]);
4406
+ const ye = (f) => {
4407
+ const c = [];
4408
+ let N = null;
4409
+ for (const de of f)
4410
+ !N || N.name !== de.group ? (N = { name: de.group, items: [de] }, c.push(N)) : N.items.push(de);
4411
+ return c.some((de) => de.name != null) ? c.map((de, Q) => /* @__PURE__ */ p(
4412
+ "fieldset",
4413
+ {
4414
+ className: de.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
4415
+ children: [
4416
+ de.name && /* @__PURE__ */ e("legend", { className: "nice-form__group-title", children: de.name }),
4417
+ /* @__PURE__ */ e("div", { style: E, children: de.items.map(m) })
4418
+ ]
4419
+ },
4420
+ Q
4421
+ )) : /* @__PURE__ */ e("div", { style: E, children: f.map(m) });
4422
+ }, Se = me ? /* @__PURE__ */ p("div", { className: "nice-form__actions", children: [
4423
+ /* @__PURE__ */ p("div", { className: "nice-form__actions-left", children: [
4424
+ Z && /* @__PURE__ */ e(Yn, { type: "button", variant: "secondary", size: ne, onClick: Z, children: X }),
4425
+ /* @__PURE__ */ e(
4426
+ Yn,
4427
+ {
4428
+ type: "button",
4429
+ variant: "ghost",
4430
+ size: ne,
4431
+ onClick: se,
4432
+ disabled: U.length === 0,
4433
+ children: ie
4434
+ }
4435
+ )
4436
+ ] }),
4437
+ /* @__PURE__ */ e("div", { className: "nice-form__actions-right", children: /* @__PURE__ */ e(Yn, { type: "submit", variant: "primary", size: ne, children: _ }) })
4438
+ ] }) : null;
4439
+ return z ? null : /* @__PURE__ */ p(
4440
+ "form",
4441
+ {
4442
+ ref: C,
4443
+ className: `nice-form nice-form--label-${B}${W ? " nice-form--dirty" : ""} ${H || ""}`,
4444
+ style: oe || ke ? { ...re } : { ...E, ...re },
4445
+ onSubmit: u,
4446
+ noValidate: !0,
4447
+ children: [
4448
+ ke ? /* @__PURE__ */ e(
4449
+ Kt,
4450
+ {
4451
+ className: "nice-form__tabs",
4452
+ activeTab: ee || xe[0],
4453
+ onChange: le,
4454
+ tabs: xe.map((f) => ({
4455
+ id: f,
4456
+ label: f,
4457
+ content: /* @__PURE__ */ e("div", { className: "nice-form__tab-panel", children: ye(he.filter((c) => (c.tab ?? xe[0]) === f)) })
4458
+ }))
4459
+ }
4460
+ ) : oe ? be.map((f, c) => /* @__PURE__ */ p(
4461
+ "fieldset",
4462
+ {
4463
+ className: f.name ? "nice-form__group" : "nice-form__group nice-form__group--no-title",
4464
+ children: [
4465
+ f.name && /* @__PURE__ */ e("legend", { className: "nice-form__group-title", children: f.name }),
4466
+ /* @__PURE__ */ e("div", { style: E, children: f.items.map(m) })
4467
+ ]
4468
+ },
4469
+ c
4470
+ )) : he.map(m),
4471
+ Se
4472
+ ]
4473
+ }
4474
+ );
4475
+ };
4476
+ Ai.displayName = "NiceForm";
4477
+ export {
4478
+ Si as C,
4479
+ hi as M,
4480
+ fi as N,
4481
+ mt as a,
4482
+ Nt as b,
4483
+ Un as c,
4484
+ Ai as d,
4485
+ yt as e,
4486
+ _t as f,
4487
+ gt as g,
4488
+ Xn as h,
4489
+ Qn as i,
4490
+ mi as j,
4491
+ Zn as k,
4492
+ bt as l,
4493
+ Ct as m,
4494
+ Li as n,
4495
+ Ii as o,
4496
+ zi as p,
4497
+ Bi as q,
4498
+ Hi as r
4499
+ };