@nice2dev/ui 1.0.29 → 1.0.31

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 (108) hide show
  1. package/CHANGELOG.md +512 -0
  2. package/README.md +30 -31
  3. package/dist/NiceBackupStatusBadge.doc-Bx2bFmBQ.cjs +1 -0
  4. package/dist/NiceBackupStatusBadge.doc-CdDxIQ-M.js +25 -0
  5. package/dist/NiceCalendarScheduler.doc-BEtQkZjV.cjs +9 -0
  6. package/dist/NiceCalendarScheduler.doc-D__LRgOx.js +33 -0
  7. package/dist/NiceConfirmDialog-B57cl_F7.cjs +1 -0
  8. package/dist/NiceConfirmDialog-BiTJVR4-.js +81 -0
  9. package/dist/NiceConfirmDialog-Bjw_rN4o.cjs +1 -0
  10. package/dist/NiceConfirmDialog-N9fBTLYm.js +81 -0
  11. package/dist/NiceDrawingCanvas.doc-Dv5vB4gY.js +32 -0
  12. package/dist/NiceDrawingCanvas.doc-Ww9zz17x.cjs +8 -0
  13. package/dist/NiceErrorBoundary-1H751jK7.cjs +1 -0
  14. package/dist/NiceErrorBoundary-B-txoU3Y.js +709 -0
  15. package/dist/NiceErrorBoundary-BD-uqk_q.js +709 -0
  16. package/dist/NiceErrorBoundary-CIPXaYik.cjs +1 -0
  17. package/dist/NiceFileManagerViews.doc-CKlnm6cX.cjs +1 -0
  18. package/dist/NiceFileManagerViews.doc-Cg21DArG.js +25 -0
  19. package/dist/NiceForm-BNZB31Pg.js +4499 -0
  20. package/dist/NiceForm-CPyAXxBO.cjs +1 -0
  21. package/dist/NiceForm-DGUTmaZT.js +5014 -0
  22. package/dist/NiceForm-DmU-gmyv.cjs +382 -0
  23. package/dist/NiceMegaMenu.doc-7UyOCd3l.cjs +7 -0
  24. package/dist/NiceMegaMenu.doc-zeIyVa65.js +31 -0
  25. package/dist/NiceModal-BClAtR5T.js +95 -0
  26. package/dist/NiceModal-Bj53SKLI.js +95 -0
  27. package/dist/NiceModal-DC0UlQhc.cjs +1 -0
  28. package/dist/NiceModal-iKwtagFB.cjs +1 -0
  29. package/dist/NiceModuleLifecyclePanel-BBOg9g0b.cjs +1 -0
  30. package/dist/NiceModuleLifecyclePanel-BO8Hw_W9.js +7619 -0
  31. package/dist/NiceModuleLifecyclePanel-Ch7HRRoy.cjs +1 -0
  32. package/dist/NiceModuleLifecyclePanel-DtuXRiLR.js +6991 -0
  33. package/dist/NiceModuleLifecyclePanel.css +1 -1
  34. package/dist/NicePagination-BVo-4KAD.js +172 -0
  35. package/dist/NicePagination-Bjxy9aEc.js +172 -0
  36. package/dist/NicePagination-CaohvQsY.cjs +1 -0
  37. package/dist/NicePagination-CfFfNwrg.cjs +1 -0
  38. package/dist/NicePinCodeInput-DsyLuc0b.cjs +696 -0
  39. package/dist/NicePinCodeInput-nuRCN-9R.js +13223 -0
  40. package/dist/NiceSavedQueryPanel-BBFV4qiF.js +6969 -0
  41. package/dist/NiceSavedQueryPanel-CH5c3rUG.js +6988 -0
  42. package/dist/NiceSavedQueryPanel-CsiVNkCT.cjs +596 -0
  43. package/dist/NiceSavedQueryPanel-aQrEmmcC.cjs +596 -0
  44. package/dist/NiceScannerControl-Cd5KXJA9.js +12769 -0
  45. package/dist/NiceScannerControl-DZsERSw_.cjs +698 -0
  46. package/dist/NiceScannerControl.css +1 -0
  47. package/dist/NiceWindow-BoDzlGk-.js +1621 -0
  48. package/dist/NiceWindow-Cm9E6EAi.cjs +1 -0
  49. package/dist/NiceWindow-DgONWxBm.cjs +1 -0
  50. package/dist/NiceWindow-FMrVS7zo.js +1603 -0
  51. package/dist/charts-B90sSFeJ.cjs +761 -0
  52. package/dist/charts-Bs0aDM0X.js +4671 -0
  53. package/dist/charts-DaLf19vS.js +4671 -0
  54. package/dist/charts-DjjKkw0q.cjs +761 -0
  55. package/dist/charts.cjs +1 -1
  56. package/dist/charts.mjs +1 -1
  57. package/dist/core-BUTtIHg0.js +27766 -0
  58. package/dist/core-BUsZ7_vI.js +27914 -0
  59. package/dist/core-CESNSRyS.cjs +122 -0
  60. package/dist/core-CLfcCDKc.cjs +122 -0
  61. package/dist/data-branching-ByQdcjKO.cjs +1 -0
  62. package/dist/data-branching-D7l_kILW.cjs +1 -0
  63. package/dist/data-branching-lJ07lDN-.js +6255 -0
  64. package/dist/data-branching-psTzlcrT.js +6255 -0
  65. package/dist/data-branching.cjs +1 -1
  66. package/dist/data-branching.mjs +1 -1
  67. package/dist/data.cjs +1 -1
  68. package/dist/data.d.ts +41 -37
  69. package/dist/data.mjs +18 -19
  70. package/dist/devops-Bi8MXtko.js +8165 -0
  71. package/dist/devops-D7bQ3rE4.cjs +17 -0
  72. package/dist/devops-On_1wRf9.cjs +17 -0
  73. package/dist/devops-jCmpD6O-.js +8165 -0
  74. package/dist/devops.cjs +1 -1
  75. package/dist/devops.mjs +3 -3
  76. package/dist/editors.cjs +1 -1
  77. package/dist/editors.d.ts +219 -431
  78. package/dist/editors.mjs +48 -56
  79. package/dist/feedback.cjs +1 -1
  80. package/dist/feedback.mjs +3 -3
  81. package/dist/index-BDH1yDSg.js +69235 -0
  82. package/dist/index-BpixglWg.js +69337 -0
  83. package/dist/index-C9njkNOD.cjs +5470 -0
  84. package/dist/index-DLR-aWZR.cjs +5506 -0
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.css +1 -1
  87. package/dist/index.d.ts +798 -1059
  88. package/dist/index.mjs +741 -756
  89. package/dist/lazy.cjs +1 -1
  90. package/dist/lazy.mjs +24 -24
  91. package/dist/navigation.cjs +1 -1
  92. package/dist/navigation.d.ts +25 -213
  93. package/dist/navigation.mjs +143 -151
  94. package/dist/no-code-8lO7o6xi.js +7425 -0
  95. package/dist/no-code-BHo5WrXr.js +7425 -0
  96. package/dist/no-code-DyA_1_Th.cjs +332 -0
  97. package/dist/no-code-K8tOLNew.cjs +332 -0
  98. package/dist/no-code.cjs +1 -1
  99. package/dist/no-code.mjs +1 -1
  100. package/dist/overlays.cjs +1 -1
  101. package/dist/overlays.d.ts +12 -0
  102. package/dist/overlays.mjs +82 -82
  103. package/dist/pickerCommons-BEc3pZ_s.js +2044 -0
  104. package/dist/pickerCommons-CORo9j2a.js +2119 -0
  105. package/dist/pickerCommons-CrITwM88.cjs +1 -0
  106. package/dist/pickerCommons-D3WShRrR.cjs +1 -0
  107. package/dist/style.css +5 -5
  108. package/package.json +3 -3
@@ -0,0 +1,2044 @@
1
+ import { jsxs as b, jsx as e, Fragment as Re } from "react/jsx-runtime";
2
+ import { $ as xe, G as Te, a as Ae, r as Fe, b as ke, s as Pe, Q as Ve, c as Ie, d as je, o as He, e as Ge, K as We, v as en, f as nn, g as cn } from "./core-BUTtIHg0.js";
3
+ import Ze, { forwardRef as Se, useCallback as ne, useMemo as pe, useState as ue, useRef as De, useLayoutEffect as Ke, useEffect as Ye } from "react";
4
+ import tn from "react-dom";
5
+ import { F as fn } from "./vendor-DF586kuF.js";
6
+ const Oe = Se(
7
+ ({
8
+ label: c,
9
+ helperText: s,
10
+ error: t,
11
+ required: a,
12
+ disabled: i,
13
+ readOnly: n,
14
+ size: f = "md",
15
+ name: _,
16
+ id: d,
17
+ className: u,
18
+ style: p,
19
+ accessMode: y,
20
+ displayStyle: P,
21
+ variant: m,
22
+ value: k,
23
+ defaultValue: E,
24
+ onChange: h,
25
+ onBlur: O,
26
+ onKeyDown: R,
27
+ placeholder: M,
28
+ type: D = "text",
29
+ maxLength: g,
30
+ prefix: S,
31
+ suffix: j,
32
+ clearable: C,
33
+ autoFocus: T,
34
+ submitOnEnter: H,
35
+ onSubmit: w,
36
+ showKeyboardHints: F,
37
+ labelPlacement: B,
38
+ errorPlacement: q,
39
+ loading: J,
40
+ labelWidth: ie,
41
+ controlWidth: Q,
42
+ displayMode: X,
43
+ ...re
44
+ }, W) => {
45
+ const v = xe(y, d), $ = v === "hidden";
46
+ v === "disabled" && (i = !0), v === "readOnly" && (n = !0);
47
+ const { t: A } = Te(), x = Ae(d), Z = Fe("input", P), V = ke("input", P), he = m === "filled" ? "filled" : m === "underlined" ? "underlined" : "", ee = ne(() => h?.(""), [h]), Y = Pe({ enabled: X, readOnly: n, disabled: i }), de = Ve({
48
+ enabled: H,
49
+ onSubmit: w
50
+ }), te = ne(
51
+ (l) => {
52
+ de(l), R?.(l);
53
+ },
54
+ [de, R]
55
+ ), fe = pe(() => {
56
+ const l = [];
57
+ return H && l.push({ key: "Enter", description: A("shortcuts.submit", "Submit") }), C && l.push({ key: "Escape", description: A("shortcuts.clear", "Clear") }), l;
58
+ }, [H, C, A]);
59
+ return $ ? null : /* @__PURE__ */ b(
60
+ "div",
61
+ {
62
+ className: `nice-field nice-field--${f} ${B === "left" ? "nice-field--label-left" : ""} ${B === "inside" ? "nice-field--label-inside" : ""} ${J ? "nice-field--loading" : ""} ${u || ""}`,
63
+ style: {
64
+ ...p,
65
+ ...ie != null && {
66
+ "--nice-field-label-width": typeof ie == "number" ? `${ie}px` : ie
67
+ },
68
+ ...Q != null && {
69
+ "--nice-field-control-width": typeof Q == "number" ? `${Q}px` : Q
70
+ }
71
+ },
72
+ "aria-busy": J || void 0,
73
+ "data-floating": B === "inside" && k ? "true" : void 0,
74
+ children: [
75
+ c && B !== "inside" && /* @__PURE__ */ b(
76
+ "label",
77
+ {
78
+ htmlFor: x,
79
+ className: `nice-field__label ${a ? "nice-field__label--required" : ""}`,
80
+ children: [
81
+ c,
82
+ F && fe.length > 0 && /* @__PURE__ */ e(Ie, { shortcuts: fe, size: "sm" })
83
+ ]
84
+ }
85
+ ),
86
+ /* @__PURE__ */ b("div", { className: "nice-field__control", children: [
87
+ Y.isDisplay ? /* @__PURE__ */ e(
88
+ je,
89
+ {
90
+ value: k ?? E ?? "",
91
+ placeholder: M,
92
+ disabled: i,
93
+ readOnly: n,
94
+ onActivate: Y.enterEdit,
95
+ ariaLabel: c
96
+ }
97
+ ) : /* @__PURE__ */ b(
98
+ "div",
99
+ {
100
+ className: `nice-input nice-input--${f} nice-input--ds-${he || V} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
101
+ style: m ? void 0 : Z,
102
+ children: [
103
+ S && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: S }),
104
+ /* @__PURE__ */ e(
105
+ "input",
106
+ {
107
+ ref: (l) => {
108
+ typeof W == "function" ? W(l) : W && (W.current = l), Y.autoFocusRef(l);
109
+ },
110
+ id: x,
111
+ className: "nice-input__native",
112
+ type: D,
113
+ name: _,
114
+ value: k,
115
+ defaultValue: E,
116
+ placeholder: M,
117
+ disabled: i || J,
118
+ readOnly: n,
119
+ maxLength: g,
120
+ autoFocus: T,
121
+ "aria-invalid": !!t,
122
+ "aria-describedby": t ? `${x}-error` : s ? `${x}-helper` : void 0,
123
+ onChange: (l) => h?.(l.target.value),
124
+ onBlur: (l) => {
125
+ X && Y.exitEdit(), O?.(l);
126
+ },
127
+ onKeyDown: te,
128
+ ...re
129
+ }
130
+ ),
131
+ C && k && /* @__PURE__ */ e(
132
+ "button",
133
+ {
134
+ type: "button",
135
+ className: "nice-input__clear",
136
+ onClick: ee,
137
+ "aria-label": A("controls.clear", "Clear"),
138
+ children: /* @__PURE__ */ e(He, { name: "close", size: 14 })
139
+ }
140
+ ),
141
+ j && /* @__PURE__ */ e("span", { className: "nice-input__icon", children: j }),
142
+ c && B === "inside" && /* @__PURE__ */ e(
143
+ "label",
144
+ {
145
+ htmlFor: x,
146
+ className: `nice-input__floating-label ${a ? "nice-input__floating-label--required" : ""}`,
147
+ children: c
148
+ }
149
+ )
150
+ ]
151
+ }
152
+ ),
153
+ J && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
154
+ q === "right" && t && /* @__PURE__ */ e("div", { id: `${x}-error`, className: "nice-field__error", role: "alert", children: t }),
155
+ q === "right" && !t && s && /* @__PURE__ */ e("div", { id: `${x}-helper`, className: "nice-field__helper", children: s })
156
+ ] }),
157
+ q !== "right" && t && /* @__PURE__ */ e("div", { id: `${x}-error`, className: "nice-field__error", role: "alert", children: t }),
158
+ q !== "right" && !t && s && /* @__PURE__ */ e("div", { id: `${x}-helper`, className: "nice-field__helper", children: s })
159
+ ]
160
+ }
161
+ );
162
+ }
163
+ );
164
+ Oe.displayName = "NiceTextInput";
165
+ const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
166
+ __proto__: null,
167
+ NiceTextInput: Oe
168
+ }, Symbol.toStringTag, { value: "Module" })), Je = Se(
169
+ ({
170
+ label: c,
171
+ helperText: s,
172
+ error: t,
173
+ required: a,
174
+ disabled: i,
175
+ readOnly: n,
176
+ size: f = "md",
177
+ name: _,
178
+ id: d,
179
+ className: u,
180
+ style: p,
181
+ accessMode: y,
182
+ displayStyle: P,
183
+ value: m,
184
+ onChange: k,
185
+ onBlur: E,
186
+ onKeyDown: h,
187
+ placeholder: O,
188
+ min: R,
189
+ max: M,
190
+ step: D = 1,
191
+ precision: g,
192
+ prefix: S,
193
+ prefixType: j = "label",
194
+ prefixOptions: C,
195
+ prefixValue: T,
196
+ onPrefixChange: H,
197
+ suffix: w,
198
+ showStepper: F = !0,
199
+ submitOnEnter: B,
200
+ onSubmit: q,
201
+ showKeyboardHints: J,
202
+ labelPlacement: ie,
203
+ errorPlacement: Q,
204
+ loading: X,
205
+ labelWidth: re,
206
+ controlWidth: W,
207
+ formatPreset: v,
208
+ format: $,
209
+ suffixType: A = "label",
210
+ suffixOptions: x,
211
+ suffixValue: Z,
212
+ onSuffixChange: V,
213
+ displayMode: he
214
+ }, ee) => {
215
+ const Y = xe(y, d), de = Y === "hidden";
216
+ Y === "disabled" && (i = !0), Y === "readOnly" && (n = !0);
217
+ const { t: te } = Te(), fe = Ae(d), l = Fe("input", P), G = ke("input", P), [I, L] = ue(!1), [z, oe] = ue(null), Ne = Pe({ enabled: he, readOnly: n, disabled: i }), me = pe(() => {
218
+ let r = 3;
219
+ return M != null && (r = String(Math.abs(Math.floor(M))).length), R != null && R < 0 && (r += 1), g && (r += g + 1), Math.max(3, r) + 1;
220
+ }, [M, R, g]), Ce = ne(
221
+ (r) => {
222
+ if ($)
223
+ return $(r);
224
+ if (!v)
225
+ return g != null ? r.toFixed(g) : String(r);
226
+ switch (v) {
227
+ case "integer":
228
+ return Math.round(r).toLocaleString();
229
+ case "decimal":
230
+ return r.toLocaleString(void 0, {
231
+ minimumFractionDigits: g ?? 2,
232
+ maximumFractionDigits: g ?? 2
233
+ });
234
+ case "money":
235
+ return r.toLocaleString(void 0, {
236
+ minimumFractionDigits: g ?? 2,
237
+ maximumFractionDigits: g ?? 2,
238
+ useGrouping: !0
239
+ });
240
+ case "percent":
241
+ return (r * 100).toLocaleString(void 0, {
242
+ minimumFractionDigits: g ?? 0,
243
+ maximumFractionDigits: g ?? 2
244
+ }) + "%";
245
+ default:
246
+ return String(r);
247
+ }
248
+ },
249
+ [$, v, g]
250
+ ), ye = pe(() => I && z !== null ? z : m == null ? "" : I ? g != null ? m.toFixed(g) : String(m) : Ce(m), [m, I, z, Ce, g]), _e = m != null && m < 0, le = !!(S || j === "select" && C && C.length > 0), ce = _e && le && !I, Be = ce ? ye.replace(/^[-−]/, "") : ye, be = ne(
251
+ (r) => {
252
+ let N = r;
253
+ return R !== void 0 && (N = Math.max(R, N)), M !== void 0 && (N = Math.min(M, N)), g !== void 0 && (N = parseFloat(N.toFixed(g))), N;
254
+ },
255
+ [R, M, g]
256
+ ), Ue = ne(
257
+ (r) => {
258
+ const N = r.target.value;
259
+ if (oe(N), N === "" || N === "-" || N === "." || N === "-.") {
260
+ N === "" && k?.(null);
261
+ return;
262
+ }
263
+ const se = parseFloat(N);
264
+ if (!isNaN(se)) {
265
+ let ve = se;
266
+ R !== void 0 && (ve = Math.max(R, ve)), M !== void 0 && (ve = Math.min(M, ve)), k?.(ve);
267
+ }
268
+ },
269
+ [k, R, M]
270
+ ), $e = ne(() => {
271
+ const r = we.current, N = be((r ?? 0) + D);
272
+ we.current = N, k?.(N);
273
+ }, [D, k, be]), Le = ne(() => {
274
+ const r = we.current, N = be((r ?? 0) - D);
275
+ we.current = N, k?.(N);
276
+ }, [D, k, be]), we = De(m);
277
+ we.current = m;
278
+ const o = De(null), U = ne(() => {
279
+ o.current && (clearTimeout(o.current), o.current = null);
280
+ }, []), K = ne(
281
+ (r) => {
282
+ U();
283
+ let N = 300;
284
+ const se = () => {
285
+ r(), N = Math.max(30, N * 0.82), o.current = setTimeout(se, N);
286
+ };
287
+ o.current = setTimeout(se, 400);
288
+ },
289
+ [U]
290
+ ), ge = Ve({
291
+ enabled: B,
292
+ onSubmit: q
293
+ }), Ee = ne(
294
+ (r) => {
295
+ ge(r), r.key === "ArrowUp" ? (r.preventDefault(), $e()) : r.key === "ArrowDown" && (r.preventDefault(), Le()), h?.(r);
296
+ },
297
+ [ge, h, $e, Le]
298
+ ), ae = pe(() => {
299
+ const r = [];
300
+ return B && r.push(Ge.submit), F && (r.push({ key: "ArrowUp", description: te("shortcuts.increment", "Increase value") }), r.push({ key: "ArrowDown", description: te("shortcuts.decrement", "Decrease value") })), r;
301
+ }, [B, F, te]);
302
+ return de ? null : /* @__PURE__ */ b(
303
+ "div",
304
+ {
305
+ className: `nice-field nice-field--${f} ${ie === "left" ? "nice-field--label-left" : ""} ${X ? "nice-field--loading" : ""} ${u || ""}`,
306
+ style: {
307
+ ...p,
308
+ ...re != null && {
309
+ "--nice-field-label-width": typeof re == "number" ? `${re}px` : re
310
+ },
311
+ ...W != null && {
312
+ "--nice-field-control-width": typeof W == "number" ? `${W}px` : W
313
+ }
314
+ },
315
+ "aria-busy": X || void 0,
316
+ children: [
317
+ c && /* @__PURE__ */ b(
318
+ "label",
319
+ {
320
+ htmlFor: fe,
321
+ className: `nice-field__label ${a ? "nice-field__label--required" : ""}`,
322
+ children: [
323
+ c,
324
+ J && ae.length > 0 && /* @__PURE__ */ e(Ie, { shortcuts: ae, size: "sm" })
325
+ ]
326
+ }
327
+ ),
328
+ /* @__PURE__ */ b("div", { className: "nice-field__control", children: [
329
+ Ne.isDisplay ? /* @__PURE__ */ e(
330
+ je,
331
+ {
332
+ value: m == null ? "" : S ? /* @__PURE__ */ b(Re, { children: [
333
+ S,
334
+ ye
335
+ ] }) : ye,
336
+ placeholder: O,
337
+ disabled: i,
338
+ readOnly: n,
339
+ onActivate: Ne.enterEdit,
340
+ ariaLabel: c
341
+ }
342
+ ) : /* @__PURE__ */ e(Re, { children: /* @__PURE__ */ b(
343
+ "div",
344
+ {
345
+ className: `nice-input nice-input--number nice-input--${f} nice-input--ds-${G} ${t ? "nice-input--error" : ""} ${i ? "nice-input--disabled" : ""} ${n ? "nice-input--readonly" : ""}`,
346
+ style: l,
347
+ children: [
348
+ F && !n && /* @__PURE__ */ e(
349
+ "button",
350
+ {
351
+ type: "button",
352
+ className: "nice-input__clear nice-input__minus",
353
+ onClick: Le,
354
+ onMouseDown: () => K(Le),
355
+ onMouseUp: U,
356
+ onMouseLeave: U,
357
+ disabled: i,
358
+ "aria-label": te("controls.decrement", "Decrement"),
359
+ children: /* @__PURE__ */ e(He, { name: "minus", size: 16 })
360
+ }
361
+ ),
362
+ j === "select" && C && C.length > 0 ? /* @__PURE__ */ b(Re, { children: [
363
+ ce && /* @__PURE__ */ e("span", { className: "nice-input__sign", children: "−" }),
364
+ /* @__PURE__ */ e(
365
+ "select",
366
+ {
367
+ className: "nice-input__suffix-select nice-input__icon--prefix",
368
+ value: T ?? C[0]?.value,
369
+ disabled: i,
370
+ onChange: (r) => {
371
+ const N = r.target.value, se = C.find(
372
+ (Me) => Me.value === (T ?? C[0]?.value)
373
+ ), ve = C.find((Me) => Me.value === N);
374
+ H?.(N, se?.weight, ve?.weight);
375
+ },
376
+ children: C.map((r) => /* @__PURE__ */ e("option", { value: r.value, children: r.label }, r.value))
377
+ }
378
+ )
379
+ ] }) : S ? /* @__PURE__ */ b("span", { className: "nice-input__icon nice-input__icon--prefix", children: [
380
+ ce && /* @__PURE__ */ e("span", { className: "nice-input__sign", children: "−" }),
381
+ S
382
+ ] }) : null,
383
+ /* @__PURE__ */ e(
384
+ "input",
385
+ {
386
+ ref: (r) => {
387
+ typeof ee == "function" ? ee(r) : ee && (ee.current = r), Ne.autoFocusRef(r);
388
+ },
389
+ id: fe,
390
+ className: "nice-input__native",
391
+ type: !I && ($ || v) ? "text" : "number",
392
+ name: _,
393
+ value: Be,
394
+ placeholder: O,
395
+ min: R,
396
+ max: M,
397
+ step: D,
398
+ disabled: i || X,
399
+ readOnly: n,
400
+ "aria-invalid": !!t,
401
+ onChange: Ue,
402
+ onFocus: (r) => {
403
+ L(!0), oe(null), r.target.select();
404
+ },
405
+ onBlur: (r) => {
406
+ if (L(!1), oe(null), m != null && g !== void 0) {
407
+ const N = parseFloat(m.toFixed(g));
408
+ N !== m && k?.(N);
409
+ }
410
+ he && Ne.exitEdit(), E?.(r);
411
+ },
412
+ onKeyDown: Ee,
413
+ style: { width: `${me}ch` }
414
+ }
415
+ ),
416
+ A === "select" && x && x.length > 0 ? /* @__PURE__ */ e(
417
+ "select",
418
+ {
419
+ className: "nice-input__suffix-select nice-input__icon--suffix",
420
+ value: Z ?? x[0]?.value,
421
+ disabled: i,
422
+ onChange: (r) => {
423
+ const N = r.target.value, se = x.find(
424
+ (Me) => Me.value === (Z ?? x[0]?.value)
425
+ ), ve = x.find((Me) => Me.value === N);
426
+ V?.(N, se?.weight, ve?.weight);
427
+ },
428
+ children: x.map((r) => /* @__PURE__ */ e("option", { value: r.value, children: r.label }, r.value))
429
+ }
430
+ ) : w ? /* @__PURE__ */ e("span", { className: "nice-input__icon nice-input__icon--suffix", children: w }) : null,
431
+ F && !n && /* @__PURE__ */ e(
432
+ "button",
433
+ {
434
+ type: "button",
435
+ className: "nice-input__clear nice-input__plus",
436
+ onClick: $e,
437
+ onMouseDown: () => K($e),
438
+ onMouseUp: U,
439
+ onMouseLeave: U,
440
+ disabled: i,
441
+ "aria-label": te("controls.increment", "Increment"),
442
+ children: /* @__PURE__ */ e(He, { name: "plus", size: 16 })
443
+ }
444
+ )
445
+ ]
446
+ }
447
+ ) }),
448
+ X && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
449
+ Q === "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
450
+ Q === "right" && !t && s && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: s })
451
+ ] }),
452
+ Q !== "right" && t && /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: t }),
453
+ Q !== "right" && !t && s && /* @__PURE__ */ e("div", { className: "nice-field__helper", children: s })
454
+ ]
455
+ }
456
+ );
457
+ }
458
+ );
459
+ Je.displayName = "NiceNumberInput";
460
+ const Cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
461
+ __proto__: null,
462
+ NiceNumberInput: Je
463
+ }, Symbol.toStringTag, { value: "Module" })), qe = Se(
464
+ ({
465
+ label: c,
466
+ helperText: s,
467
+ error: t,
468
+ required: a,
469
+ disabled: i,
470
+ size: n = "md",
471
+ name: f,
472
+ id: _,
473
+ className: d,
474
+ style: u,
475
+ accessMode: p,
476
+ displayStyle: y,
477
+ options: P,
478
+ value: m,
479
+ onChange: k,
480
+ placeholder: E,
481
+ multiple: h = !1,
482
+ searchable: O = !1,
483
+ clearable: R = !1,
484
+ emptyText: M,
485
+ maxHeight: D = 240,
486
+ optionsSource: g,
487
+ valueField: S,
488
+ labelField: j,
489
+ virtualScroll: C,
490
+ optionHeight: T = 36,
491
+ onSearch: H,
492
+ loading: w,
493
+ renderOption: F,
494
+ multipleAutosize: B = !1,
495
+ showKeyboardHints: q,
496
+ labelPlacement: J,
497
+ errorPlacement: ie,
498
+ labelWidth: Q,
499
+ controlWidth: X,
500
+ displayMode: re
501
+ }, W) => {
502
+ const v = xe(p, _), $ = v === "hidden";
503
+ (v === "disabled" || v === "readOnly") && (i = !0);
504
+ const { t: A } = Te(), x = Fe("input", y), Z = ke("input", y), V = Ae(_), he = Pe({ enabled: re, disabled: i }), [ee, Y] = ue(!1), [de, te] = ue(""), [fe, l] = ue(-1), [G, I] = ue(0), L = De(null), z = De(null), [oe, Ne] = ue(null);
505
+ Ke(() => {
506
+ !w && z.current && Ne(z.current.offsetWidth);
507
+ }, [w, m, y]);
508
+ const [me, Ce] = ue(null);
509
+ Ke(() => {
510
+ h && !B && z.current && me == null && Ce(z.current.offsetWidth);
511
+ }, [h, B, me]);
512
+ const ye = We(
513
+ g ?? null,
514
+ S ?? g?.keyField ?? "id",
515
+ j ?? "name"
516
+ ), _e = g ? ye.options : (P ?? []).map(
517
+ (o) => typeof o == "string" ? { value: o, label: o } : o
518
+ );
519
+ en(L, () => {
520
+ Y(!1), te("");
521
+ });
522
+ const le = pe(() => m ? Array.isArray(m) ? m : [m] : [], [m]), ce = pe(() => {
523
+ if (!de && !H || H)
524
+ return _e;
525
+ const o = de.toLowerCase();
526
+ return _e.filter(
527
+ (U) => U.label.toLowerCase().includes(o) || String(U.value).toLowerCase().includes(o)
528
+ );
529
+ }, [_e, de, H]), Be = pe(() => {
530
+ const o = /* @__PURE__ */ new Map();
531
+ for (const U of ce) {
532
+ const K = U.group || "";
533
+ o.has(K) || o.set(K, []), o.get(K).push(U);
534
+ }
535
+ return o;
536
+ }, [ce]), be = ne(
537
+ (o) => {
538
+ if (h) {
539
+ const U = le.includes(o) ? le.filter((K) => K !== o) : [...le, o];
540
+ k?.(U);
541
+ } else
542
+ k?.(o), Y(!1), te("");
543
+ },
544
+ [h, le, k]
545
+ ), Ue = ne(
546
+ (o) => {
547
+ if (o.key === "Escape") {
548
+ Y(!1), te("");
549
+ return;
550
+ }
551
+ if (o.key === "Enter" || o.key === " ") {
552
+ if (!ee) {
553
+ Y(!0), o.preventDefault();
554
+ return;
555
+ }
556
+ fe >= 0 && ce[fe] && (be(ce[fe].value), o.preventDefault());
557
+ return;
558
+ }
559
+ o.key === "ArrowDown" && (o.preventDefault(), l((U) => Math.min(U + 1, ce.length - 1))), o.key === "ArrowUp" && (o.preventDefault(), l((U) => Math.max(U - 1, 0)));
560
+ },
561
+ [ee, fe, ce, be]
562
+ ), $e = pe(() => le.length === 0 ? null : h ? le.map((o) => _e.find((U) => U.value === o)?.label || o).join(", ") : _e.find((o) => o.value === le[0])?.label || le[0], [le, _e, h]), Le = ne(
563
+ (o) => {
564
+ o.stopPropagation(), k?.(h ? [] : "");
565
+ },
566
+ [k, h]
567
+ ), we = pe(
568
+ () => [
569
+ { key: "Enter", description: A("shortcuts.select", "Select") },
570
+ { key: "Space", description: A("shortcuts.openDropdown", "Open dropdown") },
571
+ Ge.moveUp,
572
+ Ge.moveDown,
573
+ Ge.cancel
574
+ ],
575
+ [A]
576
+ );
577
+ return $ ? null : /* @__PURE__ */ b(
578
+ "div",
579
+ {
580
+ className: `nice-field ${X == null ? "nice-field--select-auto" : ""} nice-field--${n} ${J === "left" ? "nice-field--label-left" : ""} ${w ? "nice-field--loading" : ""} ${d || ""}`,
581
+ style: {
582
+ ...u,
583
+ ...Q != null && {
584
+ "--nice-field-label-width": typeof Q == "number" ? `${Q}px` : Q
585
+ },
586
+ ...X != null && {
587
+ "--nice-field-control-width": typeof X == "number" ? `${X}px` : X
588
+ },
589
+ ...w && oe != null && { "--nice-select-locked-width": `${oe}px` }
590
+ },
591
+ "aria-busy": w || void 0,
592
+ children: [
593
+ c && /* @__PURE__ */ b(
594
+ "label",
595
+ {
596
+ htmlFor: V,
597
+ className: `nice-field__label ${a ? "nice-field__label--required" : ""}`,
598
+ children: [
599
+ c,
600
+ q && /* @__PURE__ */ e(Ie, { shortcuts: we, size: "sm" })
601
+ ]
602
+ }
603
+ ),
604
+ /* @__PURE__ */ b("div", { className: "nice-field__control", children: [
605
+ he.isDisplay ? /* @__PURE__ */ e(
606
+ je,
607
+ {
608
+ value: $e,
609
+ placeholder: E || A("controls.select", "Select..."),
610
+ disabled: i,
611
+ onActivate: () => {
612
+ he.enterEdit(), Y(!0);
613
+ },
614
+ ariaLabel: c
615
+ }
616
+ ) : /* @__PURE__ */ b("div", { className: "nice-select", ref: L, children: [
617
+ /* @__PURE__ */ b(
618
+ "button",
619
+ {
620
+ ref: (o) => {
621
+ z.current = o, typeof W == "function" ? W(o) : W && (W.current = o);
622
+ },
623
+ type: "button",
624
+ id: V,
625
+ role: "combobox",
626
+ "aria-expanded": ee,
627
+ "aria-haspopup": "listbox",
628
+ "aria-invalid": !!t,
629
+ className: `nice-select__trigger nice-select__trigger--${n} nice-select--ds-${Z} ${ee ? "nice-select__trigger--open" : ""} ${t ? "nice-select__trigger--error" : ""} ${i ? "nice-select__trigger--disabled" : ""}`,
630
+ style: {
631
+ ...x,
632
+ ...h && !B && me != null ? {
633
+ width: me,
634
+ maxWidth: me,
635
+ overflow: "hidden"
636
+ } : {}
637
+ },
638
+ disabled: i,
639
+ onClick: () => Y(!ee),
640
+ onKeyDown: Ue,
641
+ children: [
642
+ $e ? /* @__PURE__ */ e(
643
+ "span",
644
+ {
645
+ style: h && !B ? {
646
+ flex: 1,
647
+ minWidth: 0,
648
+ overflow: "hidden",
649
+ textOverflow: "ellipsis",
650
+ whiteSpace: "nowrap"
651
+ } : void 0,
652
+ children: $e
653
+ }
654
+ ) : /* @__PURE__ */ e("span", { className: "nice-select__placeholder", children: E || A("controls.select", "Select...") }),
655
+ /* @__PURE__ */ b("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
656
+ R && le.length > 0 && /* @__PURE__ */ e(
657
+ "span",
658
+ {
659
+ className: "nice-input__clear",
660
+ onClick: Le,
661
+ role: "button",
662
+ "aria-label": A("controls.clear", "Clear"),
663
+ children: /* @__PURE__ */ e(He, { name: "close", size: 14 })
664
+ }
665
+ ),
666
+ /* @__PURE__ */ e(
667
+ "span",
668
+ {
669
+ className: `nice-select__chevron ${ee ? "nice-select__chevron--open" : ""}`,
670
+ children: /* @__PURE__ */ e(He, { name: "chevron-down", size: 16 })
671
+ }
672
+ )
673
+ ] })
674
+ ]
675
+ }
676
+ ),
677
+ ee && /* @__PURE__ */ b(
678
+ "div",
679
+ {
680
+ className: "nice-select__dropdown",
681
+ role: "listbox",
682
+ style: { maxHeight: D },
683
+ onScroll: C ? (o) => I(o.currentTarget.scrollTop) : void 0,
684
+ children: [
685
+ (O || H) && /* @__PURE__ */ e("div", { className: "nice-select__search", children: /* @__PURE__ */ e(
686
+ "input",
687
+ {
688
+ type: "text",
689
+ value: de,
690
+ onChange: (o) => {
691
+ te(o.target.value), l(0), H?.(o.target.value);
692
+ },
693
+ placeholder: A("controls.search", "Search..."),
694
+ autoFocus: !0
695
+ }
696
+ ) }),
697
+ w && /* @__PURE__ */ e("div", { className: "nice-select__loading", children: /* @__PURE__ */ e(
698
+ "div",
699
+ {
700
+ className: "nice-spinner nice-spinner--sm",
701
+ style: { margin: "8px auto" }
702
+ }
703
+ ) }),
704
+ !w && ce.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-select__empty", children: M || A("controls.noResults", "No results found") }) : C && !Array.from(Be.keys()).some((o) => o !== "") ? (() => {
705
+ const U = ce.length * T, K = Math.max(
706
+ 0,
707
+ Math.floor(G / T) - 3
708
+ ), ge = Math.min(
709
+ ce.length,
710
+ Math.ceil((G + D) / T) + 3
711
+ ), Ee = ce.slice(K, ge);
712
+ return /* @__PURE__ */ e("div", { style: { height: U, position: "relative" }, children: Ee.map((ae, r) => {
713
+ const N = K + r, se = le.includes(ae.value);
714
+ return /* @__PURE__ */ e(
715
+ "div",
716
+ {
717
+ role: "option",
718
+ "aria-selected": se,
719
+ className: `nice-select__option ${se ? "nice-select__option--selected" : ""} ${N === fe ? "nice-select__option--highlighted" : ""} ${ae.disabled ? "nice-select__option--disabled" : ""}`,
720
+ style: {
721
+ position: "absolute",
722
+ top: N * T,
723
+ left: 0,
724
+ right: 0,
725
+ height: T,
726
+ display: "flex",
727
+ alignItems: "center",
728
+ padding: "0 12px"
729
+ },
730
+ onClick: () => !ae.disabled && be(String(ae.value)),
731
+ onMouseEnter: () => l(N),
732
+ children: F ? F(ae, se) : /* @__PURE__ */ b(Re, { children: [
733
+ ae.icon && /* @__PURE__ */ e("span", { children: ae.icon }),
734
+ /* @__PURE__ */ b("div", { style: { flex: 1 }, children: [
735
+ /* @__PURE__ */ e("div", { children: ae.label }),
736
+ ae.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: ae.description })
737
+ ] }),
738
+ se && /* @__PURE__ */ e(
739
+ "svg",
740
+ {
741
+ className: "nice-select__option-check",
742
+ viewBox: "0 0 20 20",
743
+ fill: "currentColor",
744
+ children: /* @__PURE__ */ e(
745
+ "path",
746
+ {
747
+ fillRule: "evenodd",
748
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
749
+ clipRule: "evenodd"
750
+ }
751
+ )
752
+ }
753
+ )
754
+ ] })
755
+ },
756
+ ae.value
757
+ );
758
+ }) });
759
+ })() : Array.from(Be.entries()).map(([o, U]) => /* @__PURE__ */ b(Ze.Fragment, { children: [
760
+ o && /* @__PURE__ */ e("div", { className: "nice-select__group-label", children: o }),
761
+ U.map((K) => {
762
+ const ge = le.includes(K.value), Ee = ce.indexOf(K);
763
+ return /* @__PURE__ */ e(
764
+ "div",
765
+ {
766
+ role: "option",
767
+ "aria-selected": ge,
768
+ className: `nice-select__option ${ge ? "nice-select__option--selected" : ""} ${Ee === fe ? "nice-select__option--highlighted" : ""} ${K.disabled ? "nice-select__option--disabled" : ""}`,
769
+ onClick: () => !K.disabled && be(String(K.value)),
770
+ onMouseEnter: () => l(Ee),
771
+ children: F ? F(K, ge) : /* @__PURE__ */ b(Re, { children: [
772
+ K.icon && /* @__PURE__ */ e("span", { children: K.icon }),
773
+ /* @__PURE__ */ b("div", { style: { flex: 1 }, children: [
774
+ /* @__PURE__ */ e("div", { children: K.label }),
775
+ K.description && /* @__PURE__ */ e("div", { className: "nice-select__option-desc", children: K.description })
776
+ ] }),
777
+ ge && /* @__PURE__ */ e(
778
+ "svg",
779
+ {
780
+ className: "nice-select__option-check",
781
+ viewBox: "0 0 20 20",
782
+ fill: "currentColor",
783
+ children: /* @__PURE__ */ e(
784
+ "path",
785
+ {
786
+ fillRule: "evenodd",
787
+ d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",
788
+ clipRule: "evenodd"
789
+ }
790
+ )
791
+ }
792
+ )
793
+ ] })
794
+ },
795
+ K.value
796
+ );
797
+ })
798
+ ] }, o))
799
+ ]
800
+ }
801
+ )
802
+ ] }),
803
+ w && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
804
+ ie === "right" && t && /* @__PURE__ */ e("div", { id: `${V}-error`, className: "nice-field__error", role: "alert", children: t }),
805
+ ie === "right" && !t && s && /* @__PURE__ */ e("div", { id: `${V}-helper`, className: "nice-field__helper", children: s })
806
+ ] }),
807
+ ie !== "right" && t && /* @__PURE__ */ e("div", { id: `${V}-error`, className: "nice-field__error", role: "alert", children: t }),
808
+ ie !== "right" && !t && s && /* @__PURE__ */ e("div", { id: `${V}-helper`, className: "nice-field__helper", children: s })
809
+ ]
810
+ }
811
+ );
812
+ }
813
+ );
814
+ qe.displayName = "NiceSelect";
815
+ const Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
816
+ __proto__: null,
817
+ NiceSelect: qe
818
+ }, Symbol.toStringTag, { value: "Module" })), Qe = Se(
819
+ ({
820
+ label: c,
821
+ checked: s = !1,
822
+ indeterminate: t = !1,
823
+ onChange: a,
824
+ disabled: i,
825
+ readOnly: n,
826
+ loading: f,
827
+ required: _,
828
+ size: d = "md",
829
+ name: u,
830
+ id: p,
831
+ className: y,
832
+ style: P,
833
+ error: m,
834
+ helperText: k,
835
+ accessMode: E,
836
+ displayStyle: h,
837
+ showKeyboardHints: O,
838
+ labelPlacement: R,
839
+ errorPlacement: M,
840
+ labelWidth: D,
841
+ controlWidth: g
842
+ }, S) => {
843
+ const j = xe(E, p), C = j === "hidden";
844
+ (j === "disabled" || j === "readOnly") && (i = !0);
845
+ const { t: T } = Te(), H = Ae(p);
846
+ ke("toggle", h);
847
+ const w = pe(
848
+ () => [{ key: "Space", description: T("shortcuts.toggle", "Toggle") }],
849
+ [T]
850
+ ), F = Ze.useCallback(
851
+ (B) => {
852
+ B && (B.indeterminate = t), typeof S == "function" ? S(B) : S && (S.current = B);
853
+ },
854
+ [t, S]
855
+ );
856
+ return C ? null : /* @__PURE__ */ b(
857
+ "div",
858
+ {
859
+ className: `nice-field nice-field--inline nice-field--${d} ${R === "left" ? "nice-field--label-left" : ""} ${M === "right" ? "nice-field--error-right" : ""} ${f ? "nice-field--loading" : ""} ${y || ""}`,
860
+ style: {
861
+ ...P,
862
+ ...D != null && {
863
+ "--nice-field-label-width": typeof D == "number" ? `${D}px` : D
864
+ },
865
+ ...g != null && {
866
+ "--nice-field-control-width": typeof g == "number" ? `${g}px` : g
867
+ }
868
+ },
869
+ "aria-busy": f || void 0,
870
+ children: [
871
+ R === "left" && c && /* @__PURE__ */ e("span", { className: `nice-field__label ${_ ? "nice-field__label--required" : ""}`, children: c }),
872
+ /* @__PURE__ */ b("div", { className: "nice-field__control", children: [
873
+ /* @__PURE__ */ b(
874
+ "label",
875
+ {
876
+ className: `nice-checkbox ${d !== "md" ? `nice-checkbox--${d}` : ""} ${i || f ? "nice-checkbox--disabled" : ""}`,
877
+ htmlFor: H,
878
+ children: [
879
+ /* @__PURE__ */ e(
880
+ "input",
881
+ {
882
+ ref: F,
883
+ id: H,
884
+ type: "checkbox",
885
+ className: "nice-checkbox__input",
886
+ name: u,
887
+ checked: s,
888
+ disabled: i || f,
889
+ readOnly: n,
890
+ "aria-invalid": !!m,
891
+ onChange: (B) => {
892
+ n || f || a?.(B.target.checked);
893
+ }
894
+ }
895
+ ),
896
+ /* @__PURE__ */ e("span", { className: "nice-checkbox__box", children: /* @__PURE__ */ e(
897
+ "svg",
898
+ {
899
+ viewBox: "0 0 12 12",
900
+ fill: "none",
901
+ stroke: "currentColor",
902
+ strokeWidth: "2",
903
+ strokeLinecap: "round",
904
+ strokeLinejoin: "round",
905
+ children: t ? /* @__PURE__ */ e("line", { x1: "2", y1: "6", x2: "10", y2: "6" }) : /* @__PURE__ */ e("polyline", { points: "2 6 5 9 10 3" })
906
+ }
907
+ ) }),
908
+ R !== "left" && c && /* @__PURE__ */ e("span", { children: c }),
909
+ O && /* @__PURE__ */ e(Ie, { shortcuts: w, size: "sm" })
910
+ ]
911
+ }
912
+ ),
913
+ f && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
914
+ M === "right" && m && /* @__PURE__ */ e("div", { id: `${H}-error`, className: "nice-field__error", role: "alert", children: m }),
915
+ M === "right" && !m && k && /* @__PURE__ */ e("div", { id: `${H}-helper`, className: "nice-field__helper", children: k })
916
+ ] }),
917
+ M !== "right" && m && /* @__PURE__ */ e("div", { id: `${H}-error`, className: "nice-field__error", role: "alert", children: m }),
918
+ M !== "right" && !m && k && /* @__PURE__ */ e("div", { id: `${H}-helper`, className: "nice-field__helper", children: k })
919
+ ]
920
+ }
921
+ );
922
+ }
923
+ );
924
+ Qe.displayName = "NiceCheckbox";
925
+ const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
926
+ __proto__: null,
927
+ NiceCheckbox: Qe
928
+ }, Symbol.toStringTag, { value: "Module" })), ln = Se(
929
+ ({
930
+ label: c,
931
+ checked: s = !1,
932
+ onChange: t,
933
+ disabled: a,
934
+ readOnly: i,
935
+ loading: n,
936
+ required: f,
937
+ size: _ = "md",
938
+ name: d,
939
+ id: u,
940
+ className: p,
941
+ style: y,
942
+ accessMode: P,
943
+ displayStyle: m,
944
+ showKeyboardHints: k,
945
+ error: E,
946
+ helperText: h,
947
+ labelPlacement: O,
948
+ errorPlacement: R,
949
+ labelWidth: M,
950
+ controlWidth: D
951
+ }, g) => {
952
+ const S = xe(P, u), j = S === "hidden";
953
+ (S === "disabled" || S === "readOnly") && (a = !0);
954
+ const { t: C } = Te(), T = Ae(u);
955
+ Fe("toggle", m);
956
+ const H = ke("toggle", m), w = pe(
957
+ () => [{ key: "Space", description: C("shortcuts.toggle", "Toggle on/off") }],
958
+ [C]
959
+ );
960
+ return j ? null : /* @__PURE__ */ b(
961
+ "div",
962
+ {
963
+ className: `nice-field nice-field--inline nice-field--${_} ${O === "left" ? "nice-field--label-left" : ""} ${n ? "nice-field--loading" : ""} ${p || ""}`,
964
+ style: {
965
+ ...y,
966
+ ...M != null && {
967
+ "--nice-field-label-width": typeof M == "number" ? `${M}px` : M
968
+ },
969
+ ...D != null && {
970
+ "--nice-field-control-width": typeof D == "number" ? `${D}px` : D
971
+ }
972
+ },
973
+ "aria-busy": n || void 0,
974
+ children: [
975
+ O === "left" && c && /* @__PURE__ */ e("span", { className: `nice-field__label ${f ? "nice-field__label--required" : ""}`, children: c }),
976
+ /* @__PURE__ */ b("div", { className: "nice-field__control", children: [
977
+ /* @__PURE__ */ b(
978
+ "label",
979
+ {
980
+ className: `nice-toggle nice-toggle--ds-${H} ${_ !== "md" ? `nice-toggle--${_}` : ""} ${a || n ? "nice-toggle--disabled" : ""}`,
981
+ htmlFor: T,
982
+ children: [
983
+ /* @__PURE__ */ e(
984
+ "input",
985
+ {
986
+ ref: g,
987
+ id: T,
988
+ type: "checkbox",
989
+ className: "nice-toggle__input",
990
+ name: d,
991
+ checked: s,
992
+ disabled: a || n,
993
+ readOnly: i,
994
+ role: "switch",
995
+ "aria-checked": s,
996
+ "aria-invalid": !!E,
997
+ onChange: (F) => {
998
+ i || n || t?.(F.target.checked);
999
+ }
1000
+ }
1001
+ ),
1002
+ /* @__PURE__ */ e("span", { className: "nice-toggle__track", children: /* @__PURE__ */ e("span", { className: "nice-toggle__thumb" }) }),
1003
+ O !== "left" && c && /* @__PURE__ */ e("span", { children: c }),
1004
+ k && /* @__PURE__ */ e(Ie, { shortcuts: w, size: "sm" })
1005
+ ]
1006
+ }
1007
+ ),
1008
+ n && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1009
+ R === "right" && E && /* @__PURE__ */ e("div", { id: `${T}-error`, className: "nice-field__error", role: "alert", children: E }),
1010
+ R === "right" && !E && h && /* @__PURE__ */ e("div", { id: `${T}-helper`, className: "nice-field__helper", children: h })
1011
+ ] }),
1012
+ R !== "right" && E && /* @__PURE__ */ e("div", { id: `${T}-error`, className: "nice-field__error", role: "alert", children: E }),
1013
+ R !== "right" && !E && h && /* @__PURE__ */ e("div", { id: `${T}-helper`, className: "nice-field__helper", children: h })
1014
+ ]
1015
+ }
1016
+ );
1017
+ }
1018
+ );
1019
+ ln.displayName = "NiceToggle";
1020
+ const an = [
1021
+ "var(--nice-danger, #ef4444)",
1022
+ "var(--nice-warning, #f97316)",
1023
+ "var(--nice-warning, #f59e0b)",
1024
+ "var(--nice-success, #84cc16)",
1025
+ "var(--nice-success, #10b981)",
1026
+ "var(--nice-info, #06b6d4)",
1027
+ "var(--nice-primary, #3b82f6)",
1028
+ "var(--nice-info, #6366f1)",
1029
+ "var(--nice-accent, #8b5cf6)",
1030
+ "var(--nice-accent-pink, #ec4899)",
1031
+ "var(--nice-text-secondary, #64748b)",
1032
+ "var(--nice-text, #1e293b)"
1033
+ ];
1034
+ function sn() {
1035
+ return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
1036
+ }
1037
+ function rn(c) {
1038
+ const s = /^#?([0-9a-f]{6})$/i.exec(c.trim());
1039
+ if (!s)
1040
+ return { r: 0, g: 0, b: 0 };
1041
+ const t = parseInt(s[1], 16);
1042
+ return { r: t >> 16 & 255, g: t >> 8 & 255, b: t & 255 };
1043
+ }
1044
+ function on(c, s, t) {
1045
+ const a = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
1046
+ return `#${a(c)}${a(s)}${a(t)}`;
1047
+ }
1048
+ function dn(c, s, t) {
1049
+ const a = c / 255, i = s / 255, n = t / 255, f = Math.max(a, i, n), _ = Math.min(a, i, n), d = (f + _) / 2;
1050
+ let u = 0, p = 0;
1051
+ if (f !== _) {
1052
+ const y = f - _;
1053
+ switch (p = d > 0.5 ? y / (2 - f - _) : y / (f + _), f) {
1054
+ case a:
1055
+ u = (i - n) / y + (i < n ? 6 : 0);
1056
+ break;
1057
+ case i:
1058
+ u = (n - a) / y + 2;
1059
+ break;
1060
+ case n:
1061
+ u = (a - i) / y + 4;
1062
+ break;
1063
+ }
1064
+ u *= 60;
1065
+ }
1066
+ return { h: Math.round(u), s: Math.round(p * 100), l: Math.round(d * 100) };
1067
+ }
1068
+ function un(c, s, t) {
1069
+ const a = s / 100, i = t / 100, n = (1 - Math.abs(2 * i - 1)) * a, f = n * (1 - Math.abs(c / 60 % 2 - 1)), _ = i - n / 2;
1070
+ let d = 0, u = 0, p = 0;
1071
+ return c < 60 ? [d, u, p] = [n, f, 0] : c < 120 ? [d, u, p] = [f, n, 0] : c < 180 ? [d, u, p] = [0, n, f] : c < 240 ? [d, u, p] = [0, f, n] : c < 300 ? [d, u, p] = [f, 0, n] : [d, u, p] = [n, 0, f], {
1072
+ r: Math.round((d + _) * 255),
1073
+ g: Math.round((u + _) * 255),
1074
+ b: Math.round((p + _) * 255)
1075
+ };
1076
+ }
1077
+ function pn(c, s, t) {
1078
+ const a = c / 255, i = s / 255, n = t / 255, f = Math.max(a, i, n), _ = Math.min(a, i, n), d = f - _;
1079
+ let u = 0;
1080
+ d !== 0 && (f === a ? u = (i - n) / d % 6 : f === i ? u = (n - a) / d + 2 : u = (a - i) / d + 4, u *= 60, u < 0 && (u += 360));
1081
+ const p = f === 0 ? 0 : d / f;
1082
+ return { h: Math.round(u), s: Math.round(p * 100), v: Math.round(f * 100) };
1083
+ }
1084
+ function hn(c, s, t) {
1085
+ const a = s / 100, i = t / 100, n = i * a, f = n * (1 - Math.abs(c / 60 % 2 - 1)), _ = i - n;
1086
+ let d = 0, u = 0, p = 0;
1087
+ return c < 60 ? [d, u, p] = [n, f, 0] : c < 120 ? [d, u, p] = [f, n, 0] : c < 180 ? [d, u, p] = [0, n, f] : c < 240 ? [d, u, p] = [0, f, n] : c < 300 ? [d, u, p] = [f, 0, n] : [d, u, p] = [n, 0, f], {
1088
+ r: Math.round((d + _) * 255),
1089
+ g: Math.round((u + _) * 255),
1090
+ b: Math.round((p + _) * 255)
1091
+ };
1092
+ }
1093
+ function mn(c) {
1094
+ const s = /^#?([0-9a-f]{6})$/i.exec(c.trim()), t = /^#?([0-9a-f]{8})$/i.exec(c.trim());
1095
+ if (t) {
1096
+ const a = t[1];
1097
+ return {
1098
+ r: parseInt(a.slice(0, 2), 16),
1099
+ g: parseInt(a.slice(2, 4), 16),
1100
+ b: parseInt(a.slice(4, 6), 16),
1101
+ a: parseInt(a.slice(6, 8), 16) / 255
1102
+ };
1103
+ }
1104
+ if (s) {
1105
+ const a = parseInt(s[1], 16);
1106
+ return { r: a >> 16 & 255, g: a >> 8 & 255, b: a & 255, a: 1 };
1107
+ }
1108
+ return { r: 0, g: 0, b: 0, a: 1 };
1109
+ }
1110
+ function _n(c, s, t, a, i) {
1111
+ const n = (_) => Math.max(0, Math.min(255, Math.round(_))).toString(16).padStart(2, "0"), f = `#${n(c)}${n(s)}${n(t)}`;
1112
+ return i ? `${f}${n(a * 255)}` : f;
1113
+ }
1114
+ const Xe = Se(
1115
+ ({
1116
+ label: c,
1117
+ helperText: s,
1118
+ error: t,
1119
+ required: a,
1120
+ disabled: i,
1121
+ id: n,
1122
+ className: f,
1123
+ style: _,
1124
+ accessMode: d,
1125
+ displayStyle: u,
1126
+ value: p = "var(--nice-primary, #3b82f6)",
1127
+ onChange: y,
1128
+ presets: P = an,
1129
+ showInput: m = !0,
1130
+ showRandom: k = !0,
1131
+ withAlpha: E = !1,
1132
+ compact: h = !1,
1133
+ showKeyboardHints: O,
1134
+ size: R = "md",
1135
+ labelPlacement: M,
1136
+ errorPlacement: D,
1137
+ labelWidth: g,
1138
+ controlWidth: S,
1139
+ loading: j
1140
+ }, C) => {
1141
+ const T = xe(d, n), H = T === "hidden";
1142
+ (T === "disabled" || T === "readOnly") && (i = !0);
1143
+ const { t: w } = Te(), F = Ae(n);
1144
+ ke("input", u);
1145
+ const B = ne(() => {
1146
+ i || y?.(sn());
1147
+ }, [i, y]), [q, J] = ue(!1), [ie, Q] = ue(null), X = De(null), re = De(null);
1148
+ Ke(() => {
1149
+ if (!q || !re.current)
1150
+ return;
1151
+ const v = () => {
1152
+ const $ = re.current?.getBoundingClientRect();
1153
+ if (!$)
1154
+ return;
1155
+ const A = 280, x = 360;
1156
+ let Z = $.left, V = $.bottom + 6;
1157
+ Z + A > window.innerWidth - 8 && (Z = Math.max(8, window.innerWidth - A - 8)), V + x > window.innerHeight - 8 && (V = Math.max(8, $.top - x - 6)), Q({ left: Z, top: V });
1158
+ };
1159
+ return v(), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v), () => {
1160
+ window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v);
1161
+ };
1162
+ }, [q]), Ye(() => {
1163
+ if (!q)
1164
+ return;
1165
+ const v = (A) => {
1166
+ const x = A.target;
1167
+ X.current?.contains(x) || re.current?.contains(x) || J(!1);
1168
+ }, $ = (A) => {
1169
+ A.key === "Escape" && J(!1);
1170
+ };
1171
+ return document.addEventListener("mousedown", v), document.addEventListener("keydown", $), () => {
1172
+ document.removeEventListener("mousedown", v), document.removeEventListener("keydown", $);
1173
+ };
1174
+ }, [q]);
1175
+ const W = pe(
1176
+ () => [
1177
+ { key: "Enter", description: w("shortcuts.openPicker", "Open color picker") },
1178
+ { key: "Arrow keys", description: w("shortcuts.navigatePresets", "Navigate presets") }
1179
+ ],
1180
+ [w]
1181
+ );
1182
+ return H ? null : /* @__PURE__ */ b(
1183
+ "div",
1184
+ {
1185
+ className: `nice-field nice-field--${R} ${M === "left" ? "nice-field--label-left" : ""} ${h ? "nice-color-picker--compact" : ""} ${j ? "nice-field--loading" : ""} ${f || ""}`,
1186
+ style: {
1187
+ ..._,
1188
+ ...g != null && {
1189
+ "--nice-field-label-width": typeof g == "number" ? `${g}px` : g
1190
+ },
1191
+ ...S != null && {
1192
+ "--nice-field-control-width": typeof S == "number" ? `${S}px` : S
1193
+ }
1194
+ },
1195
+ "aria-busy": j || void 0,
1196
+ children: [
1197
+ c && /* @__PURE__ */ b(
1198
+ "label",
1199
+ {
1200
+ htmlFor: F,
1201
+ className: `nice-field__label ${a ? "nice-field__label--required" : ""}`,
1202
+ children: [
1203
+ c,
1204
+ O && /* @__PURE__ */ e(Ie, { shortcuts: W, size: "sm" })
1205
+ ]
1206
+ }
1207
+ ),
1208
+ /* @__PURE__ */ e("div", { className: "nice-field__control", children: /* @__PURE__ */ b("div", { className: "nice-color-picker", children: [
1209
+ /* @__PURE__ */ b("div", { className: "nice-color-picker__preview-row", children: [
1210
+ /* @__PURE__ */ e(
1211
+ "div",
1212
+ {
1213
+ ref: re,
1214
+ className: "nice-color-picker__swatch",
1215
+ id: F,
1216
+ style: { background: p },
1217
+ onClick: (v) => {
1218
+ v.stopPropagation(), i || J(($) => !$);
1219
+ },
1220
+ onKeyDown: (v) => {
1221
+ !i && (v.key === "Enter" || v.key === " ") && (v.preventDefault(), J(($) => !$));
1222
+ },
1223
+ role: "button",
1224
+ tabIndex: 0,
1225
+ "aria-label": w("colorPicker.openPalette", "Open color palette"),
1226
+ "aria-haspopup": "dialog",
1227
+ "aria-expanded": q,
1228
+ children: /* @__PURE__ */ e(
1229
+ "input",
1230
+ {
1231
+ ref: (v) => {
1232
+ typeof C == "function" ? C(v) : C && (C.current = v);
1233
+ },
1234
+ type: "hidden",
1235
+ value: p,
1236
+ disabled: i,
1237
+ readOnly: !0
1238
+ }
1239
+ )
1240
+ }
1241
+ ),
1242
+ m && /* @__PURE__ */ e(
1243
+ "div",
1244
+ {
1245
+ className: "nice-input nice-input--sm",
1246
+ style: h ? { flex: 1, minWidth: 0 } : { width: 100 },
1247
+ children: /* @__PURE__ */ e(
1248
+ "input",
1249
+ {
1250
+ className: "nice-input__native",
1251
+ type: "text",
1252
+ value: p,
1253
+ disabled: i,
1254
+ onChange: (v) => y?.(v.target.value),
1255
+ maxLength: 7
1256
+ }
1257
+ )
1258
+ }
1259
+ ),
1260
+ k && !h && /* @__PURE__ */ e(
1261
+ "button",
1262
+ {
1263
+ type: "button",
1264
+ className: "nice-btn nice-btn--outline nice-btn--sm nice-color-picker__random",
1265
+ onClick: B,
1266
+ disabled: i,
1267
+ title: w("colorPicker.random", "Random"),
1268
+ "aria-label": w("colorPicker.random", "Random"),
1269
+ style: {
1270
+ fontSize: "0.65rem",
1271
+ textTransform: "uppercase",
1272
+ letterSpacing: "0.05em"
1273
+ },
1274
+ children: w("colorPicker.random", "Random")
1275
+ }
1276
+ ),
1277
+ j && /* @__PURE__ */ e("span", { className: "nice-field__spinner", children: /* @__PURE__ */ e("span", { className: "nice-spinner nice-spinner--sm" }) }),
1278
+ D === "right" && t && /* @__PURE__ */ e("div", { id: `${F}-error`, className: "nice-field__error", role: "alert", children: t }),
1279
+ D === "right" && !t && s && /* @__PURE__ */ e("div", { id: `${F}-helper`, className: "nice-field__helper", children: s })
1280
+ ] }),
1281
+ q && ie && typeof document < "u" && tn.createPortal(
1282
+ /* @__PURE__ */ e(
1283
+ "div",
1284
+ {
1285
+ ref: X,
1286
+ className: "nice-color-picker__popup nice-color-picker__popup--portal",
1287
+ role: "dialog",
1288
+ "aria-label": w("colorPicker.palette", "Color palette"),
1289
+ style: { position: "fixed", left: ie.left, top: ie.top },
1290
+ onClick: (v) => v.stopPropagation(),
1291
+ children: (() => {
1292
+ const v = mn(p), $ = { r: v.r, g: v.g, b: v.b }, A = E ? v.a : 1, x = dn($.r, $.g, $.b), Z = pn($.r, $.g, $.b), V = (l, G, I, L = A) => y?.(_n(l, G, I, L, E)), he = (l, G, I) => V(l, G, I), ee = (l, G, I) => {
1293
+ const L = un(l, G, I);
1294
+ V(L.r, L.g, L.b);
1295
+ }, Y = (l, G, I) => {
1296
+ const L = hn(l, G, I);
1297
+ V(L.r, L.g, L.b);
1298
+ }, de = (l) => V($.r, $.g, $.b, l), te = (l) => {
1299
+ if (i)
1300
+ return;
1301
+ const G = l.currentTarget, I = (z) => {
1302
+ const oe = G.getBoundingClientRect(), Ne = Math.max(0, Math.min(oe.width, z.clientX - oe.left)), me = Math.max(0, Math.min(oe.height, z.clientY - oe.top)), Ce = Math.round(Ne / oe.width * 100), ye = 100 - Math.round(me / oe.height * 100);
1303
+ Y(Z.h, Ce, ye);
1304
+ };
1305
+ I(l);
1306
+ const L = () => {
1307
+ document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", L);
1308
+ };
1309
+ document.addEventListener("pointermove", I), document.addEventListener("pointerup", L);
1310
+ }, fe = `hsl(${Z.h}, 100%, 50%)`;
1311
+ return /* @__PURE__ */ b(Re, { children: [
1312
+ /* @__PURE__ */ e("div", { className: "nice-color-picker__popup-header", children: /* @__PURE__ */ e(
1313
+ "input",
1314
+ {
1315
+ type: "text",
1316
+ className: "nice-input__native nice-color-picker__popup-hex",
1317
+ value: p,
1318
+ disabled: i,
1319
+ onChange: (l) => y?.(l.target.value),
1320
+ maxLength: E ? 9 : 7,
1321
+ "aria-label": w("colorPicker.hexValue", "Hex value")
1322
+ }
1323
+ ) }),
1324
+ /* @__PURE__ */ e(
1325
+ "input",
1326
+ {
1327
+ type: "range",
1328
+ min: 0,
1329
+ max: 360,
1330
+ value: Z.h,
1331
+ disabled: i,
1332
+ onChange: (l) => Y(Number(l.target.value), Z.s, Z.v),
1333
+ className: "nice-color-picker__hue-slider",
1334
+ "aria-label": w("colorPicker.hue", "Hue")
1335
+ }
1336
+ ),
1337
+ /* @__PURE__ */ e(
1338
+ "div",
1339
+ {
1340
+ className: "nice-color-picker__sv",
1341
+ style: {
1342
+ background: `linear-gradient(to top, var(--nice-text, #000), transparent), linear-gradient(to right, var(--nice-bg, #FFF), ${fe})`
1343
+ },
1344
+ onPointerDown: te,
1345
+ role: "application",
1346
+ "aria-label": w("colorPicker.svPalette", "Saturation/value palette"),
1347
+ children: /* @__PURE__ */ e(
1348
+ "span",
1349
+ {
1350
+ className: "nice-color-picker__sv-marker",
1351
+ style: { left: `${Z.s}%`, top: `${100 - Z.v}%` }
1352
+ }
1353
+ )
1354
+ }
1355
+ ),
1356
+ /* @__PURE__ */ b("div", { className: "nice-color-picker__sliders", children: [
1357
+ /* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["h", "s", "l"].map((l) => {
1358
+ const G = l === "h" ? 360 : 100, I = x[l], L = (z) => ee(
1359
+ l === "h" ? z : x.h,
1360
+ l === "s" ? z : x.s,
1361
+ l === "l" ? z : x.l
1362
+ );
1363
+ return /* @__PURE__ */ b("div", { className: "nice-color-picker__slider-row", children: [
1364
+ /* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: l.toUpperCase() }),
1365
+ /* @__PURE__ */ e(
1366
+ "input",
1367
+ {
1368
+ type: "range",
1369
+ min: 0,
1370
+ max: G,
1371
+ value: I,
1372
+ disabled: i,
1373
+ onChange: (z) => L(Number(z.target.value))
1374
+ }
1375
+ ),
1376
+ /* @__PURE__ */ e(
1377
+ "input",
1378
+ {
1379
+ type: "number",
1380
+ min: 0,
1381
+ max: G,
1382
+ value: I,
1383
+ disabled: i,
1384
+ onChange: (z) => L(Number(z.target.value) || 0),
1385
+ className: "nice-input__native nice-color-picker__slider-num"
1386
+ }
1387
+ )
1388
+ ] }, l);
1389
+ }) }),
1390
+ /* @__PURE__ */ e("div", { className: "nice-color-picker__slider-col", children: ["r", "g", "b"].map((l) => {
1391
+ const G = $[l], I = (L) => he(
1392
+ l === "r" ? L : $.r,
1393
+ l === "g" ? L : $.g,
1394
+ l === "b" ? L : $.b
1395
+ );
1396
+ return /* @__PURE__ */ b("div", { className: "nice-color-picker__slider-row", children: [
1397
+ /* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: l.toUpperCase() }),
1398
+ /* @__PURE__ */ e(
1399
+ "input",
1400
+ {
1401
+ type: "range",
1402
+ min: 0,
1403
+ max: 255,
1404
+ value: G,
1405
+ disabled: i,
1406
+ onChange: (L) => I(Number(L.target.value))
1407
+ }
1408
+ ),
1409
+ /* @__PURE__ */ e(
1410
+ "input",
1411
+ {
1412
+ type: "number",
1413
+ min: 0,
1414
+ max: 255,
1415
+ value: G,
1416
+ disabled: i,
1417
+ onChange: (L) => I(Number(L.target.value) || 0),
1418
+ className: "nice-input__native nice-color-picker__slider-num"
1419
+ }
1420
+ )
1421
+ ] }, l);
1422
+ }) })
1423
+ ] }),
1424
+ E && /* @__PURE__ */ b("div", { className: "nice-color-picker__alpha-row", children: [
1425
+ /* @__PURE__ */ e("label", { className: "nice-color-picker__slider-label", children: "A" }),
1426
+ /* @__PURE__ */ e(
1427
+ "input",
1428
+ {
1429
+ type: "range",
1430
+ min: 0,
1431
+ max: 100,
1432
+ value: Math.round(A * 100),
1433
+ disabled: i,
1434
+ onChange: (l) => de(Number(l.target.value) / 100),
1435
+ className: "nice-color-picker__alpha-slider",
1436
+ style: {
1437
+ background: `linear-gradient(to right, transparent, rgb(${$.r},${$.g},${$.b}))`
1438
+ },
1439
+ "aria-label": w("colorPicker.alpha", "Alpha")
1440
+ }
1441
+ ),
1442
+ /* @__PURE__ */ e(
1443
+ "input",
1444
+ {
1445
+ type: "number",
1446
+ min: 0,
1447
+ max: 100,
1448
+ value: Math.round(A * 100),
1449
+ disabled: i,
1450
+ onChange: (l) => de((Number(l.target.value) || 0) / 100),
1451
+ className: "nice-input__native nice-color-picker__slider-num"
1452
+ }
1453
+ )
1454
+ ] }),
1455
+ P.length > 0 && /* @__PURE__ */ e("div", { className: "nice-color-picker__popup-presets", children: P.map((l) => /* @__PURE__ */ e(
1456
+ "div",
1457
+ {
1458
+ className: `nice-color-picker__preset ${p === l ? "nice-color-picker__preset--active" : ""}`,
1459
+ style: { background: l },
1460
+ onClick: () => {
1461
+ y?.(l), J(!1);
1462
+ },
1463
+ role: "button",
1464
+ tabIndex: 0,
1465
+ "aria-label": l,
1466
+ onKeyDown: (G) => {
1467
+ (G.key === "Enter" || G.key === " ") && (G.preventDefault(), y?.(l), J(!1));
1468
+ }
1469
+ },
1470
+ l
1471
+ )) })
1472
+ ] });
1473
+ })()
1474
+ }
1475
+ ),
1476
+ document.body
1477
+ )
1478
+ ] }) }),
1479
+ D !== "right" && t && /* @__PURE__ */ e("div", { id: `${F}-error`, className: "nice-field__error", role: "alert", children: t }),
1480
+ D !== "right" && !t && s && /* @__PURE__ */ e("div", { id: `${F}-helper`, className: "nice-field__helper", children: s })
1481
+ ]
1482
+ }
1483
+ );
1484
+ }
1485
+ );
1486
+ Xe.displayName = "NiceColorPicker";
1487
+ const Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1488
+ __proto__: null,
1489
+ NiceColorPicker: Xe,
1490
+ hexToRgb: rn,
1491
+ rgbToHex: on
1492
+ }, Symbol.toStringTag, { value: "Module" })), bn = Se(
1493
+ ({
1494
+ children: c,
1495
+ variant: s = "primary",
1496
+ size: t = "md",
1497
+ type: a = "button",
1498
+ disabled: i,
1499
+ loading: n,
1500
+ fullWidth: f,
1501
+ onClick: _,
1502
+ leftIcon: d,
1503
+ rightIcon: u,
1504
+ error: p,
1505
+ errorPlacement: y = "bottom",
1506
+ ariaLabel: P,
1507
+ className: m,
1508
+ style: k,
1509
+ id: E,
1510
+ accessMode: h,
1511
+ displayStyle: O,
1512
+ ...R
1513
+ }, M) => {
1514
+ const D = nn(s), g = cn(t), S = xe(h, E), j = S === "hidden";
1515
+ (S === "disabled" || S === "readOnly") && (i = !0);
1516
+ const C = Fe("button", O), T = ke("button", O), H = D !== "primary" ? (({ background: B, color: q, ...J }) => J)(
1517
+ C
1518
+ ) : C, w = /* @__PURE__ */ b(
1519
+ "button",
1520
+ {
1521
+ ref: M,
1522
+ type: a,
1523
+ id: E,
1524
+ className: `nice-btn nice-btn--${D} nice-btn--${g} nice-btn--ds-${T} ${f ? "nice-btn--full-width" : ""} ${n ? "nice-btn--loading" : ""} ${p && !y ? "nice-btn--has-error" : ""} ${m || ""}`,
1525
+ style: { ...H, ...k },
1526
+ disabled: i || n,
1527
+ "aria-busy": n || void 0,
1528
+ "aria-disabled": i || n || void 0,
1529
+ "aria-label": P,
1530
+ onClick: _,
1531
+ ...R,
1532
+ children: [
1533
+ n && /* @__PURE__ */ e(
1534
+ "svg",
1535
+ {
1536
+ className: "nice-btn__spinner",
1537
+ viewBox: "0 0 24 24",
1538
+ fill: "none",
1539
+ stroke: "currentColor",
1540
+ strokeWidth: "3",
1541
+ "aria-hidden": "true",
1542
+ children: /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "31.4 31.4", strokeLinecap: "round" })
1543
+ }
1544
+ ),
1545
+ !n && d && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: d }),
1546
+ !n && /* @__PURE__ */ e("span", { children: c }),
1547
+ n && /* @__PURE__ */ e("span", { style: { visibility: "hidden" }, "aria-hidden": "true", children: c }),
1548
+ !n && u && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: u })
1549
+ ]
1550
+ }
1551
+ );
1552
+ if (j)
1553
+ return null;
1554
+ if (!p)
1555
+ return w;
1556
+ const F = /* @__PURE__ */ e("div", { className: "nice-field__error", role: "alert", children: p });
1557
+ return y === "right" ? /* @__PURE__ */ b(
1558
+ "span",
1559
+ {
1560
+ className: `nice-btn-field nice-btn-field--right nice-field--${g}`,
1561
+ style: {
1562
+ display: "inline-flex",
1563
+ flexDirection: "row",
1564
+ alignItems: "center",
1565
+ gap: "8px",
1566
+ width: "fit-content"
1567
+ },
1568
+ children: [
1569
+ w,
1570
+ F
1571
+ ]
1572
+ }
1573
+ ) : j ? null : /* @__PURE__ */ b(
1574
+ "span",
1575
+ {
1576
+ className: `nice-btn-field nice-btn-field--bottom nice-field--${g}`,
1577
+ style: {
1578
+ display: "inline-flex",
1579
+ flexDirection: "column",
1580
+ alignItems: "flex-start",
1581
+ gap: "4px",
1582
+ width: "fit-content"
1583
+ },
1584
+ children: [
1585
+ w,
1586
+ F
1587
+ ]
1588
+ }
1589
+ );
1590
+ }
1591
+ );
1592
+ bn.displayName = "NiceButton";
1593
+ const Dn = ({
1594
+ tabs: c,
1595
+ activeTab: s,
1596
+ onChange: t,
1597
+ variant: a = "default",
1598
+ vertical: i,
1599
+ size: n = "md",
1600
+ className: f,
1601
+ style: _,
1602
+ displayStyle: d
1603
+ }) => {
1604
+ const u = Fe("tab", d), p = ke("tab", d), [y, P] = ue(s || c[0]?.id), m = s ?? y, k = ne(
1605
+ (h) => {
1606
+ P(h), t?.(h);
1607
+ },
1608
+ [t]
1609
+ ), E = c.find((h) => h.id === m)?.content;
1610
+ return /* @__PURE__ */ b(
1611
+ "div",
1612
+ {
1613
+ className: `nice-tabs nice-tabs--${n} nice-tabs--ds-${p} ${f || ""}`,
1614
+ style: { ...u, ..._, ...i ? { display: "flex", gap: 16 } : {} },
1615
+ children: [
1616
+ /* @__PURE__ */ e(
1617
+ "div",
1618
+ {
1619
+ className: `nice-tabs__list ${a !== "default" ? `nice-tabs__list--${a}` : ""} ${i ? "nice-tabs__list--vertical" : ""}`,
1620
+ role: "tablist",
1621
+ children: c.map((h) => /* @__PURE__ */ b(
1622
+ "button",
1623
+ {
1624
+ type: "button",
1625
+ role: "tab",
1626
+ "aria-selected": m === h.id,
1627
+ className: `nice-tabs__tab ${m === h.id ? "nice-tabs__tab--active" : ""} ${h.disabled ? "nice-tabs__tab--disabled" : ""}`,
1628
+ disabled: h.disabled,
1629
+ onClick: () => k(h.id),
1630
+ children: [
1631
+ h.icon,
1632
+ /* @__PURE__ */ e("span", { children: h.label }),
1633
+ h.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-tabs__badge", children: h.badge })
1634
+ ]
1635
+ },
1636
+ h.id
1637
+ ))
1638
+ }
1639
+ ),
1640
+ E && /* @__PURE__ */ e("div", { className: "nice-tabs__panel", role: "tabpanel", children: E })
1641
+ ]
1642
+ }
1643
+ );
1644
+ }, gn = Object.freeze({
1645
+ AR: ["#74acdf", "#ffffff", "#74acdf"],
1646
+ AT: ["#ed2939", "#ffffff", "#ed2939"],
1647
+ AU: ["#012169", "#ffffff", "#e4002b"],
1648
+ BE: ["#000000", "#fae042", "#ed2939"],
1649
+ BR: ["#009c3b", "#ffdf00", "#002776"],
1650
+ CA: ["#ff0000", "#ffffff", "#ff0000"],
1651
+ CH: ["#d52b1e", "#ffffff", "#d52b1e"],
1652
+ CN: ["#de2910", "#ffde00", "#de2910"],
1653
+ CZ: ["#11457e", "#ffffff", "#d7141a"],
1654
+ DE: ["#000000", "#dd0000", "#ffce00"],
1655
+ DK: ["#c8102e", "#ffffff", "#c8102e"],
1656
+ EE: ["#0072ce", "#000000", "#ffffff"],
1657
+ EG: ["#ce1126", "#ffffff", "#000000"],
1658
+ ES: ["#aa151b", "#f1bf00", "#aa151b"],
1659
+ FI: ["#ffffff", "#003580", "#ffffff"],
1660
+ FR: ["#0055a4", "#ffffff", "#ef4135"],
1661
+ GB: ["#012169", "#ffffff", "#c8102e"],
1662
+ GR: ["#0d5eaf", "#ffffff", "#0d5eaf"],
1663
+ HR: ["#171796", "#ffffff", "#ff0000"],
1664
+ HU: ["#ce2939", "#ffffff", "#477050"],
1665
+ IE: ["#169b62", "#ffffff", "#ff883e"],
1666
+ IL: ["#ffffff", "#0038b8", "#ffffff"],
1667
+ IN: ["#ff9933", "#ffffff", "#138808"],
1668
+ IS: ["#02529c", "#ffffff", "#dc1e35"],
1669
+ IT: ["#009246", "#ffffff", "#ce2b37"],
1670
+ JP: ["#ffffff", "#bc002d", "#ffffff"],
1671
+ KR: ["#ffffff", "#cd2e3a", "#0047a0"],
1672
+ LT: ["#fdb913", "#006a44", "#c1272d"],
1673
+ LU: ["#ed2939", "#ffffff", "#00a1de"],
1674
+ LV: ["#9e3039", "#ffffff", "#9e3039"],
1675
+ MX: ["#006847", "#ffffff", "#ce1126"],
1676
+ NL: ["#ae1c28", "#ffffff", "#21468b"],
1677
+ NO: ["#ef2b2d", "#ffffff", "#002868"],
1678
+ NZ: ["#012169", "#ffffff", "#cc142b"],
1679
+ PL: ["#ffffff", "#dc143c"],
1680
+ PT: ["#006600", "#ff0000"],
1681
+ RO: ["#002b7f", "#fcd116", "#ce1126"],
1682
+ RU: ["#ffffff", "#0039a6", "#d52b1e"],
1683
+ SE: ["#006aa7", "#fecc00", "#006aa7"],
1684
+ SK: ["#ffffff", "#0b4ea2", "#ee1c25"],
1685
+ TR: ["#e30a17", "#ffffff", "#e30a17"],
1686
+ UA: ["#005bbb", "#ffd500"],
1687
+ US: ["#b22234", "#ffffff", "#3c3b6e"],
1688
+ VN: ["#da251d", "#ffff00", "#da251d"],
1689
+ ZA: ["#007a4d", "#ffffff", "#de3831"],
1690
+ // ── Round 22 expansion: cover the full COUNTRIES catalogue ─────
1691
+ AD: ["#10069f", "#fedf00", "#d50032"],
1692
+ AE: ["#00732f", "#ffffff", "#000000"],
1693
+ AF: ["#000000", "#d32011", "#007a36"],
1694
+ AG: ["#ce1126", "#fcd116", "#000000"],
1695
+ AL: ["#e41e20", "#000000", "#e41e20"],
1696
+ AM: ["#d90012", "#0033a0", "#f2a800"],
1697
+ AO: ["#ce1126", "#000000", "#ffc500"],
1698
+ AZ: ["#0092bc", "#ed2939", "#509e2f"],
1699
+ BA: ["#002395", "#fecb00", "#ffffff"],
1700
+ BB: ["#00267f", "#ffc726", "#00267f"],
1701
+ BD: ["#006a4e", "#f42a41", "#006a4e"],
1702
+ BF: ["#ef2b2d", "#009e49", "#fcd116"],
1703
+ BG: ["#ffffff", "#00966e", "#d62612"],
1704
+ BH: ["#ffffff", "#ce1126", "#ce1126"],
1705
+ BI: ["#1eb53a", "#ffffff", "#ce1126"],
1706
+ BJ: ["#008751", "#fcd116", "#e8112d"],
1707
+ BN: ["#f7e017", "#ffffff", "#000000"],
1708
+ BO: ["#d52b1e", "#f9e300", "#007934"],
1709
+ BS: ["#00778b", "#ffc72c", "#000000"],
1710
+ BT: ["#ffcc33", "#ff4e12", "#ffcc33"],
1711
+ BW: ["#75aadb", "#ffffff", "#000000"],
1712
+ BY: ["#c8313e", "#007c30", "#ffffff"],
1713
+ BZ: ["#003f87", "#ce1126", "#003f87"],
1714
+ CD: ["#007fff", "#f7d618", "#ce1021"],
1715
+ CF: ["#003082", "#ffffff", "#289728"],
1716
+ CG: ["#009543", "#fbde4a", "#dc241f"],
1717
+ CI: ["#f77f00", "#ffffff", "#009e60"],
1718
+ CM: ["#007a5e", "#ce1126", "#fcd116"],
1719
+ CO: ["#fcd116", "#003893", "#ce1126"],
1720
+ CR: ["#002b7f", "#ffffff", "#ce1126"],
1721
+ CU: ["#002590", "#ffffff", "#cf142b"],
1722
+ CV: ["#003893", "#ffffff", "#cf2027"],
1723
+ CY: ["#ffffff", "#d57800", "#ffffff"],
1724
+ DJ: ["#6ab2e7", "#ffffff", "#12ad2b"],
1725
+ DM: ["#006b3f", "#ffffff", "#000000"],
1726
+ DO: ["#002d62", "#ffffff", "#ce1126"],
1727
+ DZ: ["#006233", "#ffffff", "#d21034"],
1728
+ EC: ["#ffd100", "#034ea2", "#ed1c24"],
1729
+ ER: ["#ea0437", "#0084c9", "#418fde"],
1730
+ ET: ["#078930", "#fcdd09", "#da121a"],
1731
+ FJ: ["#68bfe5", "#cc0000", "#ffffff"],
1732
+ GA: ["#3a75c4", "#ffe700", "#009e60"],
1733
+ GD: ["#ce1126", "#fcd116", "#007a5e"],
1734
+ GE: ["#ffffff", "#ff0000", "#ffffff"],
1735
+ GH: ["#ce1126", "#fcd116", "#006b3f"],
1736
+ GM: ["#ce1126", "#ffffff", "#0c1c8c"],
1737
+ GN: ["#ce1126", "#fcd116", "#009460"],
1738
+ GQ: ["#3e9a00", "#ffffff", "#e32118"],
1739
+ GT: ["#4997d0", "#ffffff", "#4997d0"],
1740
+ GW: ["#ce1126", "#fcd116", "#009e49"],
1741
+ GY: ["#009e49", "#ffffff", "#fcd116"],
1742
+ HK: ["#de2910", "#ffffff", "#de2910"],
1743
+ HN: ["#0073cf", "#ffffff", "#0073cf"],
1744
+ HT: ["#00209f", "#d21034", "#00209f"],
1745
+ ID: ["#ff0000", "#ffffff", "#ff0000"],
1746
+ IQ: ["#ce1126", "#ffffff", "#000000"],
1747
+ IR: ["#239f40", "#ffffff", "#da0000"],
1748
+ JM: ["#000000", "#fed100", "#009b3a"],
1749
+ JO: ["#000000", "#ffffff", "#007a3d"],
1750
+ KE: ["#000000", "#bb0000", "#006600"],
1751
+ KG: ["#ff0000", "#fcd116", "#ff0000"],
1752
+ KH: ["#032ea1", "#e00025", "#032ea1"],
1753
+ KM: ["#fcd116", "#ffffff", "#ce1126"],
1754
+ KP: ["#024fa2", "#ed1c27", "#024fa2"],
1755
+ KW: ["#007a3d", "#ffffff", "#ce1126"],
1756
+ KZ: ["#00afca", "#fec50c", "#00afca"],
1757
+ LA: ["#ce1126", "#002868", "#ce1126"],
1758
+ LB: ["#ed1c24", "#ffffff", "#ed1c24"],
1759
+ LI: ["#002780", "#ce1126", "#002780"],
1760
+ LK: ["#ffbe29", "#8d153a", "#00534e"],
1761
+ LR: ["#bf0a30", "#ffffff", "#002868"],
1762
+ LS: ["#00209f", "#ffffff", "#009543"],
1763
+ LY: ["#e70013", "#000000", "#239e46"],
1764
+ MA: ["#c1272d", "#006233", "#c1272d"],
1765
+ MD: ["#0046ae", "#ffd200", "#cc092f"],
1766
+ ME: ["#d4af37", "#cc0033", "#d4af37"],
1767
+ MG: ["#ffffff", "#fc3d32", "#007e3a"],
1768
+ MH: ["#003893", "#dd7500", "#ffffff"],
1769
+ MK: ["#d20000", "#ffe600", "#d20000"],
1770
+ ML: ["#14b53a", "#fcd116", "#ce1126"],
1771
+ MM: ["#fecb00", "#34b233", "#ea2839"],
1772
+ MN: ["#c4272f", "#015197", "#c4272f"],
1773
+ MO: ["#00785a", "#ffd700", "#ffffff"],
1774
+ MR: ["#006233", "#ffc400", "#d01c1f"],
1775
+ MT: ["#ffffff", "#cf142b", "#ffffff"],
1776
+ MU: ["#ea2839", "#1a206d", "#00a04d"],
1777
+ MV: ["#d21034", "#007e3a", "#ffffff"],
1778
+ MW: ["#000000", "#ce1126", "#339e35"],
1779
+ MY: ["#cc0000", "#ffffff", "#010066"],
1780
+ MZ: ["#009a44", "#ffffff", "#000000"],
1781
+ NA: ["#003580", "#ffffff", "#009543"],
1782
+ NE: ["#ff8000", "#ffffff", "#0db02b"],
1783
+ NG: ["#008753", "#ffffff", "#008753"],
1784
+ NI: ["#0067c6", "#ffffff", "#0067c6"],
1785
+ NP: ["#dc143c", "#003893", "#dc143c"],
1786
+ OM: ["#dc241f", "#ffffff", "#008000"],
1787
+ PA: ["#ffffff", "#cc0033", "#005aa7"],
1788
+ PE: ["#d91023", "#ffffff", "#d91023"],
1789
+ PG: ["#ce1126", "#000000", "#fcd116"],
1790
+ PH: ["#0038a8", "#ffffff", "#ce1126"],
1791
+ PK: ["#ffffff", "#01411c", "#01411c"],
1792
+ PS: ["#000000", "#ffffff", "#007a3d"],
1793
+ PY: ["#d52b1e", "#ffffff", "#0038a8"],
1794
+ QA: ["#ffffff", "#8a1538", "#8a1538"],
1795
+ RS: ["#c6363c", "#0c4076", "#ffffff"],
1796
+ RW: ["#00a1de", "#fad201", "#00a651"],
1797
+ SA: ["#006c35", "#ffffff", "#006c35"],
1798
+ SB: ["#0051ba", "#fcd116", "#215b33"],
1799
+ SC: ["#003f87", "#fcd116", "#d62828"],
1800
+ SD: ["#d21034", "#ffffff", "#000000"],
1801
+ SG: ["#ed2939", "#ffffff", "#ed2939"],
1802
+ SI: ["#ffffff", "#0000ff", "#ff0000"],
1803
+ SL: ["#1eb53a", "#ffffff", "#0072c6"],
1804
+ SM: ["#ffffff", "#5eb6e4", "#ffffff"],
1805
+ SN: ["#00853f", "#fdef42", "#e31b23"],
1806
+ SO: ["#4189dd", "#ffffff", "#4189dd"],
1807
+ SR: ["#377e3f", "#ffffff", "#b40a2d"],
1808
+ SS: ["#000000", "#ce1126", "#078930"],
1809
+ ST: ["#12ad2b", "#ffce00", "#d21034"],
1810
+ SV: ["#0047ab", "#ffffff", "#0047ab"],
1811
+ SY: ["#ce1126", "#ffffff", "#000000"],
1812
+ SZ: ["#3e5eb9", "#ffd900", "#b10c0c"],
1813
+ TD: ["#002664", "#fecb00", "#c60c30"],
1814
+ TG: ["#006a4e", "#fcd116", "#d21034"],
1815
+ TH: ["#ed1c24", "#ffffff", "#241d4f"],
1816
+ TJ: ["#cc0000", "#ffffff", "#006600"],
1817
+ TL: ["#dc241f", "#ffc726", "#000000"],
1818
+ TM: ["#00853e", "#ffffff", "#cc0000"],
1819
+ TN: ["#e70013", "#ffffff", "#e70013"],
1820
+ TO: ["#ffffff", "#c10000", "#c10000"],
1821
+ TT: ["#ce1126", "#ffffff", "#000000"],
1822
+ TW: ["#fe0000", "#000095", "#fe0000"],
1823
+ TZ: ["#1eb53a", "#fcd116", "#00a3dd"],
1824
+ UG: ["#000000", "#fcdc04", "#d90000"],
1825
+ UY: ["#ffffff", "#0038a8", "#ffffff"],
1826
+ UZ: ["#1eb53a", "#ffffff", "#0099b5"],
1827
+ VA: ["#ffe000", "#ffffff", "#ffe000"],
1828
+ VE: ["#fcd116", "#00247d", "#cf142b"],
1829
+ VU: ["#000000", "#ce1126", "#009543"],
1830
+ WS: ["#002b7f", "#ffffff", "#cc0033"],
1831
+ YE: ["#ce1126", "#ffffff", "#000000"],
1832
+ ZM: ["#198a00", "#de2010", "#ef7d00"],
1833
+ ZW: ["#078930", "#fcd116", "#cf2027"]
1834
+ }), ze = ["#cbd5e1", "#94a3b8", "#cbd5e1"];
1835
+ function vn(c) {
1836
+ return c ? gn[c.toUpperCase()] ?? ze : ze;
1837
+ }
1838
+ const Nn = fn, Tn = ({
1839
+ code: c,
1840
+ size: s = 22,
1841
+ className: t
1842
+ }) => {
1843
+ const a = c?.toUpperCase(), i = a ? Nn[a] : void 0, n = s, f = Math.round(s * 2 / 3);
1844
+ return i ? /* @__PURE__ */ e(
1845
+ "span",
1846
+ {
1847
+ className: t,
1848
+ role: "img",
1849
+ "aria-label": `${a} flag`,
1850
+ style: {
1851
+ display: "inline-block",
1852
+ width: n,
1853
+ height: f,
1854
+ boxSizing: "content-box",
1855
+ border: "1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",
1856
+ borderRadius: 2,
1857
+ overflow: "hidden",
1858
+ flexShrink: 0,
1859
+ verticalAlign: "middle",
1860
+ lineHeight: 0
1861
+ },
1862
+ dangerouslySetInnerHTML: {
1863
+ __html: i.replace(
1864
+ "<svg ",
1865
+ `<svg width="${n}" height="${f}" preserveAspectRatio="xMidYMid slice" `
1866
+ )
1867
+ }
1868
+ }
1869
+ ) : /* @__PURE__ */ e(yn, { code: c, size: s, className: t });
1870
+ }, yn = ({
1871
+ code: c,
1872
+ size: s = 18,
1873
+ className: t
1874
+ }) => {
1875
+ const a = vn(c);
1876
+ return /* @__PURE__ */ e(
1877
+ "span",
1878
+ {
1879
+ className: t,
1880
+ role: "img",
1881
+ "aria-label": `${c} flag`,
1882
+ style: {
1883
+ display: "inline-flex",
1884
+ width: s,
1885
+ height: Math.round(s * 0.7),
1886
+ boxSizing: "content-box",
1887
+ border: "1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",
1888
+ borderRadius: 2,
1889
+ overflow: "hidden",
1890
+ flexShrink: 0,
1891
+ verticalAlign: "middle"
1892
+ },
1893
+ children: a.map((i, n) => /* @__PURE__ */ e("span", { style: { flex: 1, background: i } }, n))
1894
+ }
1895
+ );
1896
+ };
1897
+ function An(c, s, t, a = 280) {
1898
+ const [i, n] = ue(t === "left" ? "left" : "right"), f = ne(() => {
1899
+ if (t !== "auto") {
1900
+ n(t);
1901
+ return;
1902
+ }
1903
+ const _ = s.current;
1904
+ if (!_ || typeof window > "u")
1905
+ return;
1906
+ const d = _.getBoundingClientRect(), p = window.innerWidth - d.left, y = d.right;
1907
+ p >= a && p > y ? n("left") : n("right");
1908
+ }, [t, s, a]);
1909
+ return Ye(() => {
1910
+ if (c)
1911
+ return f(), window.addEventListener("resize", f), window.addEventListener("scroll", f, !0), () => {
1912
+ window.removeEventListener("resize", f), window.removeEventListener("scroll", f, !0);
1913
+ };
1914
+ }, [c, f]), i;
1915
+ }
1916
+ const Fn = ({ colors: c, size: s = 28, shape: t = "page", className: a }) => {
1917
+ const i = s, n = Math.round(s * 0.75), f = c.border ?? "color-mix(in srgb, currentColor 30%, transparent)";
1918
+ if (t === "swatch") {
1919
+ const P = [
1920
+ c.primary,
1921
+ c.background,
1922
+ c.backgroundSecondary ?? c.background,
1923
+ c.textColor
1924
+ ];
1925
+ return /* @__PURE__ */ e(
1926
+ "span",
1927
+ {
1928
+ className: a,
1929
+ role: "img",
1930
+ "aria-label": "Theme preview",
1931
+ style: {
1932
+ display: "inline-flex",
1933
+ width: i,
1934
+ height: n,
1935
+ border: `1px solid ${f}`,
1936
+ borderRadius: 2,
1937
+ overflow: "hidden",
1938
+ flexShrink: 0,
1939
+ verticalAlign: "middle"
1940
+ },
1941
+ children: P.map((m, k) => /* @__PURE__ */ e("span", { style: { flex: 1, background: m } }, k))
1942
+ }
1943
+ );
1944
+ }
1945
+ const _ = Math.max(2, Math.round(n * 0.22)), d = c.backgroundSecondary ? Math.max(3, Math.round(i * 0.28)) : 0, u = Math.max(1, Math.round(n * 0.08)), p = Math.max(1, Math.round(n * 0.05)), y = Math.max(2, Math.round(i * 0.08));
1946
+ return /* @__PURE__ */ b(
1947
+ "span",
1948
+ {
1949
+ className: a,
1950
+ role: "img",
1951
+ "aria-label": "Theme preview",
1952
+ style: {
1953
+ position: "relative",
1954
+ display: "inline-block",
1955
+ width: i,
1956
+ height: n,
1957
+ boxSizing: "content-box",
1958
+ background: c.background,
1959
+ border: `1px solid ${f}`,
1960
+ borderRadius: 2,
1961
+ overflow: "hidden",
1962
+ flexShrink: 0,
1963
+ verticalAlign: "middle"
1964
+ },
1965
+ children: [
1966
+ /* @__PURE__ */ e(
1967
+ "span",
1968
+ {
1969
+ style: {
1970
+ position: "absolute",
1971
+ top: 0,
1972
+ left: 0,
1973
+ right: 0,
1974
+ height: _,
1975
+ background: c.primary
1976
+ }
1977
+ }
1978
+ ),
1979
+ d > 0 && /* @__PURE__ */ e(
1980
+ "span",
1981
+ {
1982
+ style: {
1983
+ position: "absolute",
1984
+ top: _,
1985
+ left: 0,
1986
+ bottom: 0,
1987
+ width: d,
1988
+ background: c.backgroundSecondary
1989
+ }
1990
+ }
1991
+ ),
1992
+ /* @__PURE__ */ e(
1993
+ "span",
1994
+ {
1995
+ style: {
1996
+ position: "absolute",
1997
+ top: _ + p,
1998
+ left: d + y,
1999
+ right: y,
2000
+ height: u,
2001
+ background: c.textColor,
2002
+ opacity: 0.8,
2003
+ borderRadius: 1
2004
+ }
2005
+ }
2006
+ ),
2007
+ /* @__PURE__ */ e(
2008
+ "span",
2009
+ {
2010
+ style: {
2011
+ position: "absolute",
2012
+ top: _ + p * 2 + u,
2013
+ left: d + y,
2014
+ width: `${Math.max(20, i - d - y * 2 - 4)}px`,
2015
+ height: u,
2016
+ background: c.textColor,
2017
+ opacity: 0.5,
2018
+ borderRadius: 1
2019
+ }
2020
+ }
2021
+ )
2022
+ ]
2023
+ }
2024
+ );
2025
+ };
2026
+ export {
2027
+ Tn as F,
2028
+ Qe as N,
2029
+ Fn as T,
2030
+ Xe as a,
2031
+ Je as b,
2032
+ qe as c,
2033
+ Oe as d,
2034
+ ln as e,
2035
+ Dn as f,
2036
+ bn as g,
2037
+ yn as h,
2038
+ Sn as i,
2039
+ Cn as j,
2040
+ Ln as k,
2041
+ En as l,
2042
+ Rn as m,
2043
+ An as u
2044
+ };