@nice2dev/ui 1.3.9 → 1.3.11

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 (62) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +16 -18
  3. package/dist/NiceColorPicker-BLwYNSXJ.cjs +1 -0
  4. package/dist/NiceColorPicker-DS59tNkP.js +552 -0
  5. package/dist/NiceDataGrid-CL2_7fS7.cjs +10 -0
  6. package/dist/NiceDataGrid-CpJrRN_H.js +2269 -0
  7. package/dist/NiceForm-BQj-K7p7.cjs +1 -0
  8. package/dist/NiceForm-HQ4h7hX_.js +5023 -0
  9. package/dist/NiceGantt-BygumlaY.cjs +1 -0
  10. package/dist/NiceGantt-DTC7OH-v.js +334 -0
  11. package/dist/NiceHtmlEditor-BtpuaLln.js +901 -0
  12. package/dist/NiceHtmlEditor-C1OVtLQ6.cjs +10 -0
  13. package/dist/NiceMention-CVxxCVtQ.js +11668 -0
  14. package/dist/NiceMention-Te66Oid1.cjs +430 -0
  15. package/dist/NiceModuleLifecyclePanel-DCrFyUH8.cjs +1 -0
  16. package/dist/NiceModuleLifecyclePanel-Mt80MdET.js +7441 -0
  17. package/dist/NicePagination-CKsAP38Q.cjs +1 -0
  18. package/dist/NicePagination-zOed5QxG.js +202 -0
  19. package/dist/NicePivotGrid-Clue9FM5.js +1184 -0
  20. package/dist/NicePivotGrid-Cnkr9WkC.cjs +152 -0
  21. package/dist/NicePropertyGrid.doc-BWNyWrWq.cjs +7 -0
  22. package/dist/NicePropertyGrid.doc-C_I3F4w8.js +31 -0
  23. package/dist/NiceSavedQueryPanel-NgG58w6i.js +6226 -0
  24. package/dist/NiceSavedQueryPanel-lTWY2plm.cjs +587 -0
  25. package/dist/NiceScheduler-BWwqFKEc.js +1712 -0
  26. package/dist/NiceScheduler-DqWEJU7g.cjs +5 -0
  27. package/dist/NiceSelect-BNPXs6FQ.cjs +1 -0
  28. package/dist/NiceSelect-DEruWHan.js +495 -0
  29. package/dist/NiceWindow-D3V7A69Q.js +2247 -0
  30. package/dist/NiceWindow-pgR4c-kQ.cjs +1 -0
  31. package/dist/core-lazy-Bjdu111n.js +351 -0
  32. package/dist/core-lazy-Bx_8BOlG.cjs +1 -0
  33. package/dist/data.cjs +1 -1
  34. package/dist/data.d.ts +47 -6
  35. package/dist/data.mjs +3 -3
  36. package/dist/devops-CqhA0rjL.js +9130 -0
  37. package/dist/devops-cgRBnZVX.cjs +18 -0
  38. package/dist/devops.cjs +1 -1
  39. package/dist/devops.mjs +1 -1
  40. package/dist/editors.cjs +1 -1
  41. package/dist/editors.mjs +7 -7
  42. package/dist/feedback.cjs +1 -1
  43. package/dist/feedback.mjs +1 -1
  44. package/dist/index.cjs +137 -151
  45. package/dist/index.css +1 -1
  46. package/dist/index.d.ts +113 -50
  47. package/dist/index.mjs +16556 -16423
  48. package/dist/lazy.cjs +1 -1
  49. package/dist/lazy.mjs +15 -15
  50. package/dist/navigation.cjs +1 -1
  51. package/dist/navigation.d.ts +2 -0
  52. package/dist/navigation.mjs +3 -3
  53. package/dist/no-code-BQqK8mvU.cjs +331 -0
  54. package/dist/no-code-Cppb-xz3.js +8320 -0
  55. package/dist/no-code.cjs +1 -1
  56. package/dist/no-code.mjs +1 -1
  57. package/dist/overlays.cjs +1 -1
  58. package/dist/overlays.mjs +1 -1
  59. package/dist/pickerCommons-BA3-D5RC.js +663 -0
  60. package/dist/pickerCommons-KrBqCBDn.cjs +1 -0
  61. package/dist/style.css +1 -1
  62. package/package.json +4 -4
@@ -0,0 +1,1712 @@
1
+ import { jsxs as g, jsx as t, Fragment as Je } from "react/jsx-runtime";
2
+ import { NiceIcon as $e, useNiceTranslation as Ge, useAccessibleClick as gt, useControllableState as pt } from "@nice2dev/ui-core";
3
+ import H, { useState as K, useRef as yt, useCallback as te, useMemo as Ne } from "react";
4
+ import { N as ne } from "./NiceButton-CnAIqCbd.js";
5
+ import { u as Te } from "./devops-CqhA0rjL.js";
6
+ import { d as ft, c as je } from "./NiceForm-HQ4h7hX_.js";
7
+ import { NiceColorPicker as _t } from "./NiceColorPicker-DS59tNkP.js";
8
+ import { N as vt } from "./NiceModal-CU9FqzIH.js";
9
+ const Be = ({
10
+ children: e,
11
+ className: n,
12
+ style: s,
13
+ "data-testid": d,
14
+ direction: a = "horizontal",
15
+ size: o,
16
+ disabled: D,
17
+ readOnly: N,
18
+ loading: S,
19
+ error: E,
20
+ errorPlacement: b = "bottom"
21
+ }) => {
22
+ const m = /* @__PURE__ */ g(
23
+ "div",
24
+ {
25
+ className: `nice-btn-group ${a === "vertical" ? "nice-btn-group--vertical" : ""} ${S ? "nice-btn-group--loading" : ""} ${N ? "nice-btn-group--readonly" : ""} ${n || ""}`,
26
+ style: s,
27
+ role: "group",
28
+ "data-testid": d,
29
+ "aria-busy": S || void 0,
30
+ children: [
31
+ H.Children.map(e, (r) => {
32
+ if (!H.isValidElement(r))
33
+ return r;
34
+ const w = {};
35
+ return D && (w.disabled = !0), N && (w.disabled = !0), S && (w.disabled = !0), o && (w.size = o), H.cloneElement(r, w);
36
+ }),
37
+ S && /* @__PURE__ */ t("span", { className: "nice-btn-group__spinner", children: /* @__PURE__ */ t("span", { className: "nice-spinner nice-spinner--sm" }) })
38
+ ]
39
+ }
40
+ );
41
+ if (!E)
42
+ return m;
43
+ const T = /* @__PURE__ */ t("div", { className: "nice-field__error", role: "alert", children: E });
44
+ return b === "right" ? /* @__PURE__ */ g("span", { className: `nice-btn-field nice-btn-field--right ${o ? `nice-field--${o}` : ""}`, children: [
45
+ m,
46
+ T
47
+ ] }) : /* @__PURE__ */ g("span", { className: `nice-btn-field nice-btn-field--bottom ${o ? `nice-field--${o}` : ""}`, children: [
48
+ m,
49
+ T
50
+ ] });
51
+ }, P = (e, n) => {
52
+ const s = new Date(e);
53
+ return s.setDate(s.getDate() + n), s;
54
+ }, j = (e, n) => e.getFullYear() === n.getFullYear() && e.getMonth() === n.getMonth() && e.getDate() === n.getDate(), Dt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Nt = [
55
+ "January",
56
+ "February",
57
+ "March",
58
+ "April",
59
+ "May",
60
+ "June",
61
+ "July",
62
+ "August",
63
+ "September",
64
+ "October",
65
+ "November",
66
+ "December"
67
+ ], wt = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], bt = [
68
+ "january",
69
+ "february",
70
+ "march",
71
+ "april",
72
+ "may",
73
+ "june",
74
+ "july",
75
+ "august",
76
+ "september",
77
+ "october",
78
+ "november",
79
+ "december"
80
+ ];
81
+ function he(e) {
82
+ return wt.map((n, s) => e(n, Dt[s]));
83
+ }
84
+ function St(e) {
85
+ return bt.map((n, s) => e(n, Nt[s]));
86
+ }
87
+ function Oe(e) {
88
+ const n = [
89
+ "Jan",
90
+ "Feb",
91
+ "Mar",
92
+ "Apr",
93
+ "May",
94
+ "Jun",
95
+ "Jul",
96
+ "Aug",
97
+ "Sep",
98
+ "Oct",
99
+ "Nov",
100
+ "Dec"
101
+ ];
102
+ return [
103
+ "janShort",
104
+ "febShort",
105
+ "marShort",
106
+ "aprShort",
107
+ "mayShort",
108
+ "junShort",
109
+ "julShort",
110
+ "augShort",
111
+ "sepShort",
112
+ "octShort",
113
+ "novShort",
114
+ "decShort"
115
+ ].map((d, a) => e(d, n[a]));
116
+ }
117
+ const kt = [
118
+ "Sunday",
119
+ "Monday",
120
+ "Tuesday",
121
+ "Wednesday",
122
+ "Thursday",
123
+ "Friday",
124
+ "Saturday"
125
+ ], Ct = [
126
+ "sunday",
127
+ "monday",
128
+ "tuesday",
129
+ "wednesday",
130
+ "thursday",
131
+ "friday",
132
+ "saturday"
133
+ ];
134
+ function xe(e) {
135
+ return Ct.map((n, s) => e(n, kt[s]));
136
+ }
137
+ function Mt(e, n, s, d = 1 / 0) {
138
+ const a = [], o = Math.max(1, Math.floor(e.interval ?? 1)), D = e.until ? new Date(e.until) : void 0, N = D && D < s ? D : s, S = Math.min(e.count && e.count > 0 ? e.count : 1 / 0, d), E = e.freq === "weekly" && e.byDay?.length ? [...new Set(e.byDay.filter((m) => Number.isInteger(m) && m >= 0 && m <= 6))].sort(
139
+ (m, T) => m - T
140
+ ) : [];
141
+ if (E.length > 0) {
142
+ const m = new Date(n);
143
+ m.setDate(n.getDate() - n.getDay());
144
+ for (let T = 0; a.length < S; T += o) {
145
+ const r = new Date(m);
146
+ if (r.setDate(m.getDate() + T * 7), r > N)
147
+ break;
148
+ for (const w of E) {
149
+ const k = new Date(r);
150
+ if (k.setDate(r.getDate() + w), !(k < n)) {
151
+ if (k > N || a.length >= S)
152
+ break;
153
+ a.push(k);
154
+ }
155
+ }
156
+ }
157
+ return a;
158
+ }
159
+ let b = new Date(n);
160
+ for (; b <= N && a.length < S; ) {
161
+ a.push(new Date(b));
162
+ const m = new Date(b);
163
+ e.freq === "daily" ? m.setDate(m.getDate() + o) : e.freq === "weekly" ? m.setDate(m.getDate() + 7 * o) : e.freq === "monthly" ? m.setMonth(m.getMonth() + o) : m.setFullYear(m.getFullYear() + o), b = m;
164
+ }
165
+ return a;
166
+ }
167
+ function Tt(e, n, s) {
168
+ const d = [];
169
+ for (const a of e) {
170
+ if (!a.recurrence) {
171
+ d.push(a);
172
+ continue;
173
+ }
174
+ const o = new Date(a.end).getTime() - new Date(a.start).getTime();
175
+ Mt(a.recurrence, new Date(a.start), s).forEach((D, N) => {
176
+ const S = new Date(D.getTime() + o);
177
+ S >= n && d.push({ ...a, id: `${a.id}_${N}`, start: D, end: S });
178
+ });
179
+ }
180
+ return d;
181
+ }
182
+ function Xe(e, n) {
183
+ return e.filter((s) => {
184
+ const d = new Date(s.start), a = new Date(s.end);
185
+ return n >= new Date(d.getFullYear(), d.getMonth(), d.getDate()) && n <= new Date(a.getFullYear(), a.getMonth(), a.getDate());
186
+ });
187
+ }
188
+ function $t(e = "r") {
189
+ return `${e}_${Math.random().toString(36).slice(2, 9)}`;
190
+ }
191
+ function xt(e = {}) {
192
+ return {
193
+ id: e.id ?? $t(),
194
+ title: e.title ?? "",
195
+ description: e.description ?? "",
196
+ servings: e.servings ?? 2,
197
+ prepMinutes: e.prepMinutes,
198
+ cookMinutes: e.cookMinutes,
199
+ difficulty: e.difficulty,
200
+ cuisine: e.cuisine,
201
+ tags: e.tags ?? [],
202
+ ingredients: e.ingredients ?? [],
203
+ steps: e.steps ?? [],
204
+ photos: e.photos ?? [],
205
+ nutrition: e.nutrition,
206
+ sourceUrl: e.sourceUrl,
207
+ createdAt: e.createdAt ?? /* @__PURE__ */ new Date(),
208
+ updatedAt: e.updatedAt ?? /* @__PURE__ */ new Date()
209
+ };
210
+ }
211
+ function Et(e) {
212
+ const n = (e.prepMinutes ?? 0) + (e.cookMinutes ?? 0);
213
+ return n > 0 ? n : void 0;
214
+ }
215
+ const ge = ({ ev: e, renderEvent: n, onClick: s, draggable: d, dragRef: a, onHover: o, categoryColor: D }) => {
216
+ const N = D || e.color || "var(--nice-color-primary, #3b82f6)", E = {
217
+ solid: { backgroundColor: N, color: "var(--nice-color-white, #fff)" },
218
+ striped: {
219
+ background: `repeating-linear-gradient(45deg, ${N}, ${N} 4px, transparent 4px, transparent 8px)`,
220
+ border: `1px solid ${N}`,
221
+ color: "var(--nice-text-primary, #333)"
222
+ },
223
+ outlined: { backgroundColor: "transparent", border: `2px solid ${N}`, color: N },
224
+ dashed: { backgroundColor: "transparent", border: `2px dashed ${N}`, color: N }
225
+ }[e.eventStyle || "solid"];
226
+ return (
227
+ // An event took only the pointer (1.3.0 C15): it is a Tab stop, Enter / Space open it as a
228
+ // click does, and focus shows its details as hovering does.
229
+ /* @__PURE__ */ t(
230
+ "div",
231
+ {
232
+ className: `nice-scheduler__event nice-scheduler__event--${e.eventStyle || "solid"}`,
233
+ style: E,
234
+ role: "button",
235
+ tabIndex: 0,
236
+ "aria-label": e.title,
237
+ draggable: d,
238
+ onDragStart: () => {
239
+ a.current = { event: e };
240
+ },
241
+ onDragEnd: () => {
242
+ a.current = null;
243
+ },
244
+ onClick: (b) => {
245
+ b.stopPropagation(), s?.(e);
246
+ },
247
+ onKeyDown: (b) => {
248
+ (b.key === "Enter" || b.key === " ") && (b.preventDefault(), b.stopPropagation(), s?.(e));
249
+ },
250
+ onMouseEnter: (b) => o(e, b.currentTarget.getBoundingClientRect()),
251
+ onMouseLeave: () => o(null),
252
+ onFocus: (b) => o(e, b.currentTarget.getBoundingClientRect()),
253
+ onBlur: () => o(null),
254
+ children: n ? n(e) : e.title
255
+ }
256
+ )
257
+ );
258
+ };
259
+ function re(e, n) {
260
+ if (!(!e.category || !n))
261
+ return n.find((s) => s.key === e.category)?.color;
262
+ }
263
+ const Rt = ({
264
+ events: e,
265
+ curDate: n,
266
+ firstDayOfWeek: s,
267
+ onSlotClick: d,
268
+ onEventClick: a,
269
+ draggable: o,
270
+ dragRef: D,
271
+ categories: N,
272
+ renderEvent: S,
273
+ onHoverEvent: E,
274
+ readOnly: b,
275
+ t: m
276
+ }) => {
277
+ const T = he(m), r = n.getFullYear(), w = n.getMonth(), k = new Date(r, w, 1), l = new Date(r, w + 1, 0), u = (k.getDay() - s + 7) % 7, R = l.getDate(), y = [];
278
+ for (let h = u - 1; h >= 0; h--)
279
+ y.push({ date: P(k, -h - 1), isCurrentMonth: !1 });
280
+ for (let h = 0; h < R; h++)
281
+ y.push({ date: new Date(r, w, h + 1), isCurrentMonth: !0 });
282
+ let I = 1;
283
+ for (; y.length < 42; )
284
+ y.push({ date: new Date(r, w + 1, I++), isCurrentMonth: !1 });
285
+ return /* @__PURE__ */ g("div", { className: "nice-scheduler__month", children: [
286
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (h, f) => /* @__PURE__ */ t("div", { className: "nice-scheduler__month-dayname", children: T[(s + f) % 7] }, f)) }),
287
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-grid", children: y.map((h, f) => {
288
+ const L = Xe(e, h.date), p = j(h.date, /* @__PURE__ */ new Date()), C = h.date.getDay(), A = C === 0 || C === 6;
289
+ return /* @__PURE__ */ g(
290
+ "div",
291
+ {
292
+ className: `nice-scheduler__month-cell ${h.isCurrentMonth ? "" : "nice-scheduler__month-cell--other"} ${p ? "nice-scheduler__month-cell--today" : ""} ${A ? "nice-scheduler__month-cell--weekend" : ""}`,
293
+ onClick: () => !b && d?.(h.date, P(h.date, 1)),
294
+ children: [
295
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-date", children: h.date.getDate() }),
296
+ L.slice(0, 3).map((Y) => /* @__PURE__ */ t(
297
+ ge,
298
+ {
299
+ ev: Y,
300
+ renderEvent: S,
301
+ onClick: a,
302
+ draggable: o && !b,
303
+ dragRef: D,
304
+ onHover: E,
305
+ categoryColor: re(Y, N)
306
+ },
307
+ Y.id
308
+ )),
309
+ L.length > 3 && /* @__PURE__ */ g("div", { className: "nice-scheduler__month-more", children: [
310
+ "+",
311
+ L.length - 3
312
+ ] })
313
+ ]
314
+ },
315
+ f
316
+ );
317
+ }) })
318
+ ] });
319
+ }, Lt = ({
320
+ events: e,
321
+ days: n,
322
+ startHour: s,
323
+ endHour: d,
324
+ draggable: a,
325
+ dragRef: o,
326
+ onEventClick: D,
327
+ onSlotClick: N,
328
+ onEventDrop: S,
329
+ categories: E,
330
+ workHours: b,
331
+ showCurrentTime: m,
332
+ renderEvent: T,
333
+ onHoverEvent: r,
334
+ readOnly: w,
335
+ t: k
336
+ }) => {
337
+ const l = [];
338
+ for (let p = s; p < d; p++)
339
+ l.push(p);
340
+ he(k);
341
+ const u = xe(k), R = H.useRef(null), y = /* @__PURE__ */ new Date(), I = y.getHours() * 60 + y.getMinutes(), h = (d - s) * 60, f = (I - s * 60) / h * 100, L = m && I >= s * 60 && I < d * 60;
342
+ return H.useEffect(() => {
343
+ const p = R.current;
344
+ if (!p)
345
+ return;
346
+ const C = /* @__PURE__ */ new Date(), A = e.filter((x) => n.some((z) => j(z, new Date(x.start)))), Y = A.filter((x) => j(new Date(x.start), C));
347
+ let q;
348
+ Y.length > 0 ? q = Math.min(...Y.map((x) => new Date(x.start).getHours())) : A.length > 0 ? q = Math.min(...A.map((x) => new Date(x.start).getHours())) : q = 8, q = Math.max(s, Math.min(q, d - 1));
349
+ const c = q - s, _ = p.children[c];
350
+ if (_) {
351
+ const x = p.closest(".nice-scheduler__content") ?? p.closest(".nice-scheduler__timegrid");
352
+ x && (x.scrollTop = _.offsetTop - 4);
353
+ }
354
+ }, []), /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid", children: [
355
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid-header", children: [
356
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter" }),
357
+ n.map((p, C) => {
358
+ const A = p.getDay() === 0 || p.getDay() === 6;
359
+ return /* @__PURE__ */ g(
360
+ "div",
361
+ {
362
+ className: `nice-scheduler__timegrid-day-header ${j(p, y) ? "nice-scheduler__timegrid-day-header--today" : ""} ${A ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
363
+ children: [
364
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-name", children: u[p.getDay()] }),
365
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-num", children: p.getDate() })
366
+ ]
367
+ },
368
+ C
369
+ );
370
+ })
371
+ ] }),
372
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid-body", ref: R, style: { position: "relative" }, children: [
373
+ l.map((p) => {
374
+ const C = b ? p >= b[0] && p < b[1] : !1;
375
+ return /* @__PURE__ */ g(
376
+ "div",
377
+ {
378
+ className: `nice-scheduler__timegrid-row ${C ? "nice-scheduler__timegrid-row--work" : ""}`,
379
+ children: [
380
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter", children: `${p.toString().padStart(2, "0")}:00` }),
381
+ n.map((A, Y) => {
382
+ const q = e.filter((c) => {
383
+ const _ = new Date(c.start);
384
+ return j(_, A) && _.getHours() === p;
385
+ });
386
+ return /* @__PURE__ */ t(
387
+ "div",
388
+ {
389
+ className: "nice-scheduler__timegrid-cell",
390
+ onDragOver: a && !w ? (c) => c.preventDefault() : void 0,
391
+ onDrop: a && !w ? () => {
392
+ if (!o.current || !S)
393
+ return;
394
+ const c = o.current.event, _ = new Date(c.end).getTime() - new Date(c.start).getTime(), x = new Date(A);
395
+ x.setHours(p, 0, 0, 0);
396
+ const z = new Date(x.getTime() + _);
397
+ S(c, x, z), o.current = null;
398
+ } : void 0,
399
+ onClick: () => !w && (() => {
400
+ const c = new Date(A);
401
+ c.setHours(p);
402
+ const _ = new Date(c);
403
+ _.setHours(p + 1), N?.(c, _);
404
+ })(),
405
+ children: q.map((c) => /* @__PURE__ */ t(
406
+ ge,
407
+ {
408
+ ev: c,
409
+ renderEvent: T,
410
+ onClick: D,
411
+ draggable: a && !w,
412
+ dragRef: o,
413
+ onHover: r,
414
+ categoryColor: re(c, E)
415
+ },
416
+ c.id
417
+ ))
418
+ },
419
+ Y
420
+ );
421
+ })
422
+ ]
423
+ },
424
+ p
425
+ );
426
+ }),
427
+ L && n.some((p) => j(p, y)) && /* @__PURE__ */ t("div", { className: "nice-scheduler__now-line", style: { top: `${f}%` }, children: /* @__PURE__ */ t("div", { className: "nice-scheduler__now-dot" }) })
428
+ ] })
429
+ ] });
430
+ }, Ft = ({
431
+ events: e,
432
+ curDate: n,
433
+ onEventClick: s,
434
+ categories: d,
435
+ t: a
436
+ }) => {
437
+ const o = [...e].filter(
438
+ (D) => new Date(D.start) >= new Date(n.getFullYear(), n.getMonth(), n.getDate())
439
+ ).sort((D, N) => new Date(D.start).getTime() - new Date(N.start).getTime()).slice(0, 50);
440
+ return /* @__PURE__ */ g("div", { className: "nice-scheduler__agenda", children: [
441
+ o.map((D) => /* @__PURE__ */ t(It, { ev: D, categories: d, onEventClick: s }, D.id)),
442
+ o.length === 0 && /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-empty", children: a("noEvents", "No upcoming events") })
443
+ ] });
444
+ }, Ke = ({ parts: e }) => /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-meta", children: e.map(([n, s], d) => /* @__PURE__ */ g(H.Fragment, { children: [
445
+ d > 0 && " · ",
446
+ /* @__PURE__ */ t($e, { name: n, size: 12, style: { verticalAlign: "-2px" } }),
447
+ " ",
448
+ s
449
+ ] }, n)) }), Qe = ({ ev: e }) => {
450
+ if (e.eventType === "recipe" && e.recipe) {
451
+ const n = Et(e.recipe), s = [];
452
+ return n !== void 0 && s.push(["clock", `${n} min`]), e.recipe.ingredients?.length && s.push(["list", `${e.recipe.ingredients.length} ingredients`]), e.recipe.servings && s.push(["utensils", `${e.recipe.servings} servings`]), s.length === 0 ? null : /* @__PURE__ */ t(Ke, { parts: s });
453
+ }
454
+ if (e.eventType === "service" && e.service) {
455
+ const n = e.service, s = [];
456
+ return n.serviceName && s.push(["bell", n.serviceName]), n.providerName && s.push(["user", n.providerName]), n.customerName && s.push(["arrow-right", n.customerName]), typeof n.price == "number" && s.push(["dollar", `${n.price}${n.currency ? " " + n.currency : ""}`]), s.length === 0 ? null : /* @__PURE__ */ t(Ke, { parts: s });
457
+ }
458
+ return null;
459
+ }, It = ({ ev: e, categories: n, onEventClick: s }) => {
460
+ const { t: d } = Ge(), a = gt({ onClick: () => s?.(e) });
461
+ return /* @__PURE__ */ g(
462
+ "div",
463
+ {
464
+ className: "nice-scheduler__agenda-item",
465
+ "aria-label": d("service.event", "Event {title}").replace("{title}", String(e.title)),
466
+ ...a,
467
+ children: [
468
+ /* @__PURE__ */ t(
469
+ "div",
470
+ {
471
+ className: "nice-scheduler__agenda-dot",
472
+ style: {
473
+ backgroundColor: re(e, n) || e.color || "var(--nice-color-primary, #3b82f6)"
474
+ }
475
+ }
476
+ ),
477
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__agenda-info", children: [
478
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-title", children: e.title }),
479
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__agenda-time", children: [
480
+ new Date(e.start).toLocaleString(),
481
+ " – ",
482
+ new Date(e.end).toLocaleString()
483
+ ] }),
484
+ e.description && /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-desc", children: e.description }),
485
+ /* @__PURE__ */ t(Qe, { ev: e })
486
+ ] }),
487
+ e.category && n && /* @__PURE__ */ t(
488
+ "span",
489
+ {
490
+ className: "nice-scheduler__agenda-badge",
491
+ style: { backgroundColor: re(e, n) || e.color },
492
+ children: n.find((o) => o.key === e.category)?.label
493
+ }
494
+ )
495
+ ]
496
+ }
497
+ );
498
+ }, At = ({
499
+ events: e,
500
+ curDate: n,
501
+ timelineDays: s,
502
+ resources: d,
503
+ draggable: a,
504
+ dragRef: o,
505
+ onEventClick: D,
506
+ onSlotClick: N,
507
+ onEventDrop: S,
508
+ categories: E,
509
+ renderEvent: b,
510
+ onHoverEvent: m,
511
+ readOnly: T,
512
+ t: r
513
+ }) => {
514
+ const w = Array.from({ length: s }, (u, R) => P(n, R)), k = d ?? [{ id: "__default", name: "" }], l = he(r);
515
+ return /* @__PURE__ */ g("div", { className: "nice-scheduler__timeline", children: [
516
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__timeline-header", children: [
517
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-res-label" }),
518
+ w.map((u, R) => /* @__PURE__ */ g(
519
+ "div",
520
+ {
521
+ className: `nice-scheduler__timeline-day ${j(u, /* @__PURE__ */ new Date()) ? "nice-scheduler__timeline-day--today" : ""}`,
522
+ children: [
523
+ l[u.getDay()],
524
+ " ",
525
+ u.getDate()
526
+ ]
527
+ },
528
+ R
529
+ ))
530
+ ] }),
531
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-body", children: k.map((u) => {
532
+ const R = e.filter((y) => !d || y.resourceId === u.id);
533
+ return /* @__PURE__ */ g("div", { className: "nice-scheduler__timeline-row", children: [
534
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-res-label", children: u.name }),
535
+ w.map((y, I) => {
536
+ const h = R.filter((f) => j(new Date(f.start), y));
537
+ return /* @__PURE__ */ t(
538
+ "div",
539
+ {
540
+ className: "nice-scheduler__timeline-cell",
541
+ onDragOver: a && !T ? (f) => f.preventDefault() : void 0,
542
+ onDrop: a && !T ? () => {
543
+ if (!o.current || !S)
544
+ return;
545
+ const f = o.current.event, L = new Date(f.end).getTime() - new Date(f.start).getTime(), p = new Date(y);
546
+ p.setHours(
547
+ new Date(f.start).getHours(),
548
+ new Date(f.start).getMinutes()
549
+ ), S(f, p, new Date(p.getTime() + L), u.id), o.current = null;
550
+ } : void 0,
551
+ onClick: () => !T && N?.(y, P(y, 1), u.id),
552
+ children: h.map((f) => /* @__PURE__ */ t(
553
+ ge,
554
+ {
555
+ ev: f,
556
+ renderEvent: b,
557
+ onClick: D,
558
+ draggable: a && !T,
559
+ dragRef: o,
560
+ onHover: m,
561
+ categoryColor: re(f, E)
562
+ },
563
+ f.id
564
+ ))
565
+ },
566
+ I
567
+ );
568
+ })
569
+ ] }, u.id);
570
+ }) })
571
+ ] });
572
+ }, Ue = ({ categories: e, events: n, filteredCategories: s, onToggleCategory: d, t: a }) => /* @__PURE__ */ g("div", { className: "nice-scheduler__legend", children: [
573
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__legend-title", children: a("legend", "Legend") }),
574
+ e.map((o) => {
575
+ const D = n.filter((S) => S.category === o.key).length, N = !s.has(o.key);
576
+ return /* @__PURE__ */ g(
577
+ "button",
578
+ {
579
+ className: `nice-scheduler__legend-item ${N ? "" : "nice-scheduler__legend-item--hidden"}`,
580
+ onClick: () => d(o.key),
581
+ children: [
582
+ /* @__PURE__ */ t(
583
+ "span",
584
+ {
585
+ className: "nice-scheduler__legend-dot",
586
+ style: { backgroundColor: N ? o.color : "var(--nice-border-color, #ccc)" }
587
+ }
588
+ ),
589
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__legend-label", children: o.label }),
590
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__legend-count", children: D })
591
+ ]
592
+ },
593
+ o.key
594
+ );
595
+ })
596
+ ] }), Pt = ({ curDate: e, onDateSelect: n, firstDayOfWeek: s, t: d }) => {
597
+ const [a, o] = H.useState(e.getMonth()), [D, N] = H.useState(e.getFullYear()), S = new Date(D, a, 1), E = new Date(D, a + 1, 0), b = (S.getDay() - s + 7) % 7, m = [];
598
+ for (let u = b - 1; u >= 0; u--)
599
+ m.push(P(S, -u - 1));
600
+ for (let u = 0; u < E.getDate(); u++)
601
+ m.push(new Date(D, a, u + 1));
602
+ const T = 7 - m.length % 7;
603
+ if (T < 7)
604
+ for (let u = 1; u <= T; u++)
605
+ m.push(new Date(D, a + 1, u));
606
+ const r = () => {
607
+ a === 0 ? (o(11), N((u) => u - 1)) : o((u) => u - 1);
608
+ }, w = () => {
609
+ a === 11 ? (o(0), N((u) => u + 1)) : o((u) => u + 1);
610
+ }, k = Oe(d), l = he(d);
611
+ return /* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal", children: [
612
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal-header", children: [
613
+ /* @__PURE__ */ t(
614
+ "button",
615
+ {
616
+ type: "button",
617
+ className: "nice-btn nice-btn--xs",
618
+ onClick: r,
619
+ "aria-label": d("scheduler.prevMonth", "Previous month"),
620
+ children: /* @__PURE__ */ t($e, { name: "chevron-left", size: "sm" })
621
+ }
622
+ ),
623
+ /* @__PURE__ */ g("span", { children: [
624
+ k[a],
625
+ " ",
626
+ D
627
+ ] }),
628
+ /* @__PURE__ */ t(
629
+ "button",
630
+ {
631
+ type: "button",
632
+ className: "nice-btn nice-btn--xs",
633
+ onClick: w,
634
+ "aria-label": d("scheduler.nextMonth", "Next month"),
635
+ children: /* @__PURE__ */ t($e, { name: "chevron-right", size: "sm" })
636
+ }
637
+ )
638
+ ] }),
639
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__mini-cal-grid", children: [
640
+ l.map((u, R) => /* @__PURE__ */ t("div", { className: "nice-scheduler__mini-cal-dayname", children: l[(s + R) % 7].charAt(0) }, R)),
641
+ m.map((u, R) => {
642
+ const y = j(u, /* @__PURE__ */ new Date()), I = j(u, e), h = u.getMonth() !== a;
643
+ return /* @__PURE__ */ t(
644
+ "button",
645
+ {
646
+ className: `nice-scheduler__mini-cal-day ${y ? "nice-scheduler__mini-cal-day--today" : ""} ${I ? "nice-scheduler__mini-cal-day--selected" : ""} ${h ? "nice-scheduler__mini-cal-day--other" : ""}`,
647
+ onClick: () => n(u),
648
+ children: u.getDate()
649
+ },
650
+ R
651
+ );
652
+ })
653
+ ] })
654
+ ] });
655
+ }, Yt = ({
656
+ events: e,
657
+ rangeStart: n,
658
+ rangeEnd: s,
659
+ startHour: d,
660
+ endHour: a,
661
+ draggable: o,
662
+ dragRef: D,
663
+ onEventClick: N,
664
+ onSlotClick: S,
665
+ onEventDrop: E,
666
+ categories: b,
667
+ workHours: m,
668
+ showCurrentTime: T,
669
+ renderEvent: r,
670
+ onHoverEvent: w,
671
+ readOnly: k,
672
+ t: l
673
+ }) => {
674
+ const u = [];
675
+ let R = new Date(n);
676
+ for (; R <= s; )
677
+ u.push(new Date(R)), R = P(R, 1);
678
+ const y = [];
679
+ for (let _ = d; _ < a; _++)
680
+ y.push(_);
681
+ const I = xe(l), h = H.useRef(null), f = H.useRef(null), L = H.useRef(null), p = /* @__PURE__ */ new Date(), C = p.getHours() * 60 + p.getMinutes(), A = (a - d) * 60, Y = (C - d * 60) / A * 100, q = T && C >= d * 60 && C < a * 60;
682
+ H.useEffect(() => {
683
+ const _ = h.current;
684
+ if (!_)
685
+ return;
686
+ const x = /* @__PURE__ */ new Date(), z = e.filter(
687
+ (F) => u.some((M) => j(M, x) && j(new Date(F.start), x))
688
+ );
689
+ let B = z.length > 0 ? Math.min(...z.map((F) => new Date(F.start).getHours())) : x.getHours();
690
+ B = Math.max(d, Math.min(B, a - 1));
691
+ const G = _.children[B - d];
692
+ if (G) {
693
+ const F = L.current ?? _.closest(".nice-scheduler__content") ?? _.closest(".nice-scheduler__timegrid");
694
+ F && (F.scrollTop = G.offsetTop - 4);
695
+ }
696
+ }, []);
697
+ const c = (_) => {
698
+ f.current && (f.current.scrollLeft = _.currentTarget.scrollLeft);
699
+ };
700
+ return /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid nice-scheduler__timegrid--range", children: [
701
+ /* @__PURE__ */ t(
702
+ "div",
703
+ {
704
+ className: "nice-scheduler__timegrid-header-scroll",
705
+ ref: f,
706
+ "aria-hidden": "true",
707
+ children: /* @__PURE__ */ g("div", { className: "nice-scheduler__timegrid-header", children: [
708
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter" }),
709
+ u.map((_, x) => {
710
+ const z = _.getDay() === 0 || _.getDay() === 6;
711
+ return /* @__PURE__ */ g(
712
+ "div",
713
+ {
714
+ className: `nice-scheduler__timegrid-day-header ${j(_, p) ? "nice-scheduler__timegrid-day-header--today" : ""} ${z ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
715
+ children: [
716
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-name", children: I[_.getDay()] }),
717
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-num", children: _.getDate() })
718
+ ]
719
+ },
720
+ x
721
+ );
722
+ })
723
+ ] })
724
+ }
725
+ ),
726
+ /* @__PURE__ */ t(
727
+ "div",
728
+ {
729
+ className: "nice-scheduler__timegrid-body-scroll",
730
+ ref: L,
731
+ onScroll: c,
732
+ children: /* @__PURE__ */ g(
733
+ "div",
734
+ {
735
+ className: "nice-scheduler__timegrid-body",
736
+ ref: h,
737
+ style: { position: "relative" },
738
+ children: [
739
+ y.map((_) => {
740
+ const x = m ? _ >= m[0] && _ < m[1] : !1;
741
+ return /* @__PURE__ */ g(
742
+ "div",
743
+ {
744
+ className: `nice-scheduler__timegrid-row ${x ? "nice-scheduler__timegrid-row--work" : ""}`,
745
+ children: [
746
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter", children: `${_.toString().padStart(2, "0")}:00` }),
747
+ u.map((z, B) => {
748
+ const G = e.filter((F) => {
749
+ const M = new Date(F.start);
750
+ return j(M, z) && M.getHours() === _;
751
+ });
752
+ return /* @__PURE__ */ t(
753
+ "div",
754
+ {
755
+ className: "nice-scheduler__timegrid-cell",
756
+ onDragOver: o && !k ? (F) => F.preventDefault() : void 0,
757
+ onDrop: o && !k ? () => {
758
+ if (!D.current || !E)
759
+ return;
760
+ const F = D.current.event, M = new Date(F.end).getTime() - new Date(F.start).getTime(), Q = new Date(z);
761
+ Q.setHours(_, 0, 0, 0), E(F, Q, new Date(Q.getTime() + M)), D.current = null;
762
+ } : void 0,
763
+ onClick: () => !k && (() => {
764
+ const F = new Date(z);
765
+ F.setHours(_);
766
+ const M = new Date(F);
767
+ M.setHours(_ + 1), S?.(F, M);
768
+ })(),
769
+ children: G.map((F) => /* @__PURE__ */ t(
770
+ ge,
771
+ {
772
+ ev: F,
773
+ renderEvent: r,
774
+ onClick: N,
775
+ draggable: o && !k,
776
+ dragRef: D,
777
+ onHover: w,
778
+ categoryColor: re(F, b)
779
+ },
780
+ F.id
781
+ ))
782
+ },
783
+ B
784
+ );
785
+ })
786
+ ]
787
+ },
788
+ _
789
+ );
790
+ }),
791
+ q && u.some((_) => j(_, p)) && /* @__PURE__ */ t("div", { className: "nice-scheduler__now-line", style: { top: `${Y}%` }, children: /* @__PURE__ */ t("div", { className: "nice-scheduler__now-dot" }) })
792
+ ]
793
+ }
794
+ )
795
+ }
796
+ )
797
+ ] });
798
+ }, Wt = ({
799
+ events: e,
800
+ rangeStart: n,
801
+ rangeEnd: s,
802
+ firstDayOfWeek: d,
803
+ onSlotClick: a,
804
+ onEventClick: o,
805
+ draggable: D,
806
+ dragRef: N,
807
+ categories: S,
808
+ renderEvent: E,
809
+ onHoverEvent: b,
810
+ readOnly: m,
811
+ t: T
812
+ }) => {
813
+ const r = he(T);
814
+ xe(T);
815
+ const w = [];
816
+ let k = new Date(n);
817
+ for (; k <= s; )
818
+ w.push(new Date(k)), k = P(k, 1);
819
+ const l = (w[0].getDay() - d + 7) % 7, u = [];
820
+ for (let y = l - 1; y >= 0; y--)
821
+ u.push({ date: P(w[0], -y - 1), inRange: !1 });
822
+ w.forEach((y) => u.push({ date: y, inRange: !0 }));
823
+ const R = 7 - u.length % 7;
824
+ if (R < 7) {
825
+ const y = w[w.length - 1];
826
+ for (let I = 1; I <= R; I++)
827
+ u.push({ date: P(y, I), inRange: !1 });
828
+ }
829
+ return /* @__PURE__ */ g("div", { className: "nice-scheduler__month nice-scheduler__month--range", children: [
830
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (y, I) => /* @__PURE__ */ t("div", { className: "nice-scheduler__month-dayname", children: r[(d + I) % 7] }, I)) }),
831
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-grid", children: u.map((y, I) => {
832
+ const h = Xe(e, y.date), f = j(y.date, /* @__PURE__ */ new Date()), L = y.date.getDay() === 0 || y.date.getDay() === 6;
833
+ return /* @__PURE__ */ g(
834
+ "div",
835
+ {
836
+ className: `nice-scheduler__month-cell ${y.inRange ? "" : "nice-scheduler__month-cell--other"} ${f ? "nice-scheduler__month-cell--today" : ""} ${L ? "nice-scheduler__month-cell--weekend" : ""}`,
837
+ onClick: () => !m && a?.(y.date, P(y.date, 1)),
838
+ children: [
839
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-date", children: y.date.getDate() === 1 || I === 0 ? /* @__PURE__ */ g(Je, { children: [
840
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__month-monthname", children: Oe(T)[y.date.getMonth()] }),
841
+ " ",
842
+ y.date.getDate()
843
+ ] }) : y.date.getDate() }),
844
+ h.slice(0, 3).map((p) => /* @__PURE__ */ t(
845
+ ge,
846
+ {
847
+ ev: p,
848
+ renderEvent: E,
849
+ onClick: o,
850
+ draggable: D && !m,
851
+ dragRef: N,
852
+ onHover: b,
853
+ categoryColor: re(p, S)
854
+ },
855
+ p.id
856
+ )),
857
+ h.length > 3 && /* @__PURE__ */ g("div", { className: "nice-scheduler__month-more", children: [
858
+ "+",
859
+ h.length - 3
860
+ ] })
861
+ ]
862
+ },
863
+ I
864
+ );
865
+ }) })
866
+ ] });
867
+ }, qt = ({ event: e, rect: n, categories: s, renderTooltip: d }) => {
868
+ if (d)
869
+ return /* @__PURE__ */ t(
870
+ "div",
871
+ {
872
+ className: "nice-scheduler__tooltip",
873
+ style: { position: "fixed", left: n.right + 8, top: n.top, zIndex: 1e4 },
874
+ children: d(e)
875
+ }
876
+ );
877
+ const a = s?.find((o) => o.key === e.category);
878
+ return /* @__PURE__ */ g(
879
+ "div",
880
+ {
881
+ className: "nice-scheduler__tooltip",
882
+ style: { position: "fixed", left: n.right + 8, top: n.top, zIndex: 1e4 },
883
+ children: [
884
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__tooltip-title", children: e.title }),
885
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__tooltip-time", children: [
886
+ new Date(e.start).toLocaleString(),
887
+ " – ",
888
+ new Date(e.end).toLocaleString()
889
+ ] }),
890
+ a && /* @__PURE__ */ g("div", { className: "nice-scheduler__tooltip-cat", children: [
891
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__tooltip-dot", style: { backgroundColor: a.color } }),
892
+ a.label
893
+ ] }),
894
+ e.description && /* @__PURE__ */ t("div", { className: "nice-scheduler__tooltip-desc", children: e.description }),
895
+ /* @__PURE__ */ t(Qe, { ev: e })
896
+ ]
897
+ }
898
+ );
899
+ }, zt = ({
900
+ event: e,
901
+ slotStart: n,
902
+ slotEnd: s,
903
+ categories: d,
904
+ resources: a,
905
+ formFields: o,
906
+ formFieldsByType: D,
907
+ eventTypes: N,
908
+ renderEditor: S,
909
+ saving: E,
910
+ onSave: b,
911
+ onDelete: m,
912
+ onClose: T,
913
+ t: r
914
+ }) => {
915
+ const w = !!e, k = H.useMemo(
916
+ () => ({
917
+ title: e?.title ?? "",
918
+ description: e?.description ?? "",
919
+ color: e?.color ?? "var(--nice-primary, #3b82f6)",
920
+ category: e?.category ?? "",
921
+ eventStyle: e?.eventStyle ?? "solid",
922
+ start: e?.start ?? n ?? /* @__PURE__ */ new Date(),
923
+ end: e?.end ?? s ?? /* @__PURE__ */ new Date(),
924
+ allDay: e?.allDay ?? !1,
925
+ resourceId: e?.resourceId ?? "",
926
+ eventType: e?.eventType ?? "task",
927
+ recurring: !!e?.recurrence,
928
+ recurrenceFreq: e?.recurrence?.freq ?? "weekly",
929
+ recurrenceInterval: e?.recurrence?.interval ?? 1,
930
+ recurrenceCount: e?.recurrence?.count,
931
+ // Recipe-specific
932
+ recipeTitle: e?.recipe?.title ?? "",
933
+ recipeServings: e?.recipe?.servings ?? 2,
934
+ recipePrep: e?.recipe?.prepMinutes,
935
+ recipeCook: e?.recipe?.cookMinutes,
936
+ recipeIngredients: (e?.recipe?.ingredients ?? []).map(
937
+ (h) => [h.quantity, h.unit, h.name].filter((f) => f !== void 0 && f !== "").join(" ")
938
+ ).join(`
939
+ `),
940
+ recipeSteps: (e?.recipe?.steps ?? []).map((h) => h.instruction).join(`
941
+ `),
942
+ // Service-specific
943
+ serviceName: e?.service?.serviceName ?? "",
944
+ serviceProvider: e?.service?.providerName ?? "",
945
+ serviceCustomer: e?.service?.customerName ?? "",
946
+ serviceContact: e?.service?.customerContact ?? "",
947
+ serviceLocation: e?.service?.location ?? "",
948
+ servicePrice: e?.service?.price,
949
+ serviceCurrency: e?.service?.currency ?? "PLN",
950
+ serviceNotes: e?.service?.notes ?? ""
951
+ }),
952
+ [e, n, s]
953
+ ), [l, u] = H.useState(k);
954
+ H.useEffect(() => {
955
+ u(k);
956
+ }, [k]);
957
+ const R = H.useCallback((h, f) => {
958
+ u((L) => ({ ...L, [h]: f }));
959
+ }, []), y = H.useMemo(() => {
960
+ if (o && o.length > 0)
961
+ return o;
962
+ const h = (c) => c.toString().padStart(2, "0"), f = (c) => `${c.getFullYear()}-${h(c.getMonth() + 1)}-${h(c.getDate())}`, L = (c) => `${h(c.getHours())}:${h(c.getMinutes())}`, p = (c, _) => {
963
+ const x = c instanceof Date ? c : new Date(c), z = isNaN(x.getTime()) ? /* @__PURE__ */ new Date() : x, B = f(z), G = L(z), F = (M, Q) => {
964
+ const [X, U, pe] = M.split("-").map((ie) => parseInt(ie, 10)), [ye, fe] = Q.split(":").map((ie) => parseInt(ie, 10)), oe = new Date(z);
965
+ !isNaN(X) && !isNaN(U) && !isNaN(pe) && oe.setFullYear(X, U - 1, pe), !isNaN(ye) && !isNaN(fe) && oe.setHours(ye, fe, 0, 0), _(oe);
966
+ };
967
+ return /* @__PURE__ */ g("div", { style: { display: "flex", gap: 12, flexWrap: "wrap", alignItems: "flex-end" }, children: [
968
+ /* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
969
+ /* @__PURE__ */ t("span", { style: { fontSize: "0.7rem", color: "var(--nice-text-muted, #888)" }, children: r("date", "Date") }),
970
+ /* @__PURE__ */ t(je, { value: B, onChange: (M) => F(M, G), size: "sm" })
971
+ ] }),
972
+ /* @__PURE__ */ g("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
973
+ /* @__PURE__ */ t("span", { style: { fontSize: "0.7rem", color: "var(--nice-text-muted, #888)" }, children: r("time", "Time") }),
974
+ /* @__PURE__ */ t(
975
+ je,
976
+ {
977
+ dateFormatPreset: "time",
978
+ value: G,
979
+ onChange: (M) => F(B, M),
980
+ size: "sm"
981
+ }
982
+ )
983
+ ] })
984
+ ] });
985
+ }, C = [];
986
+ N && N.length > 1 && C.push({
987
+ field: "eventType",
988
+ label: r("eventType", "Type"),
989
+ type: "select",
990
+ group: r("common", "Common"),
991
+ options: N.map((c) => ({
992
+ label: c.icon ? `${c.icon} ${c.label}` : c.label,
993
+ value: c.type
994
+ }))
995
+ }), C.push(
996
+ {
997
+ field: "title",
998
+ label: r("title", "Title"),
999
+ type: "text",
1000
+ required: !0,
1001
+ group: r("common", "Common")
1002
+ },
1003
+ {
1004
+ field: "start",
1005
+ label: r("start", "Start"),
1006
+ render: p,
1007
+ group: r("common", "Common")
1008
+ },
1009
+ {
1010
+ field: "end",
1011
+ label: r("end", "End"),
1012
+ render: p,
1013
+ group: r("common", "Common")
1014
+ },
1015
+ {
1016
+ field: "description",
1017
+ label: r("description", "Description"),
1018
+ type: "textarea",
1019
+ group: r("common", "Common")
1020
+ },
1021
+ {
1022
+ field: "color",
1023
+ label: r("color", "Color"),
1024
+ group: r("common", "Common"),
1025
+ render: (c, _) => /* @__PURE__ */ t(
1026
+ _t,
1027
+ {
1028
+ value: typeof c == "string" ? c : "var(--nice-primary, #3b82f6)",
1029
+ onChange: _,
1030
+ showInput: !1,
1031
+ showRandom: !1
1032
+ }
1033
+ )
1034
+ }
1035
+ ), d && d.length > 0 && C.push({
1036
+ field: "category",
1037
+ label: r("category", "Category"),
1038
+ type: "select",
1039
+ group: r("common", "Common"),
1040
+ options: [
1041
+ { label: r("none", "(none)"), value: "" },
1042
+ ...d.map((c) => ({ label: c.label, value: c.key }))
1043
+ ]
1044
+ }), a && a.length > 0 && C.push({
1045
+ field: "resourceId",
1046
+ label: r("resource", "Resource"),
1047
+ type: "select",
1048
+ group: r("common", "Common"),
1049
+ options: [
1050
+ { label: r("none", "(none)"), value: "" },
1051
+ ...a.map((c) => ({ label: c.name, value: String(c.id) }))
1052
+ ]
1053
+ });
1054
+ const A = r("recurring", "Recurring");
1055
+ C.push({
1056
+ field: "recurring",
1057
+ label: r("repeat", "Repeat"),
1058
+ type: "checkbox",
1059
+ group: A
1060
+ }), C.push({
1061
+ field: "recurrenceFreq",
1062
+ label: r("frequency", "Frequency"),
1063
+ type: "select",
1064
+ group: A,
1065
+ visibleWhen: (c) => !!c.recurring,
1066
+ options: [
1067
+ { label: r("daily", "Daily"), value: "daily" },
1068
+ { label: r("weekly", "Weekly"), value: "weekly" },
1069
+ { label: r("monthly", "Monthly"), value: "monthly" },
1070
+ { label: r("yearly", "Yearly"), value: "yearly" }
1071
+ ]
1072
+ }), C.push({
1073
+ field: "recurrenceInterval",
1074
+ label: r("interval", "Interval"),
1075
+ type: "number",
1076
+ group: A,
1077
+ visibleWhen: (c) => !!c.recurring
1078
+ }), C.push({
1079
+ field: "recurrenceCount",
1080
+ label: r("occurrences", "Occurrences (optional)"),
1081
+ type: "number",
1082
+ group: A,
1083
+ visibleWhen: (c) => !!c.recurring
1084
+ });
1085
+ const Y = l.eventType ?? "task", q = D?.[Y];
1086
+ if (q && q.length > 0)
1087
+ C.push(...q);
1088
+ else if (Y === "recipe") {
1089
+ const c = r("recipe.section", "Recipe");
1090
+ C.push(
1091
+ { field: "recipeTitle", label: r("recipe.title", "Recipe title"), type: "text", group: c },
1092
+ {
1093
+ field: "recipeServings",
1094
+ label: r("recipe.servings", "Servings"),
1095
+ type: "number",
1096
+ group: c
1097
+ },
1098
+ {
1099
+ field: "recipePrep",
1100
+ label: r("recipe.prepMinutes", "Prep (min)"),
1101
+ type: "number",
1102
+ group: c
1103
+ },
1104
+ {
1105
+ field: "recipeCook",
1106
+ label: r("recipe.cookMinutes", "Cook (min)"),
1107
+ type: "number",
1108
+ group: c
1109
+ },
1110
+ {
1111
+ field: "recipeIngredients",
1112
+ label: r("recipe.ingredients", "Ingredients (one per line)"),
1113
+ type: "textarea",
1114
+ group: c,
1115
+ hint: r("recipe.ingredients.hint", 'Format: "200 g flour"')
1116
+ },
1117
+ {
1118
+ field: "recipeSteps",
1119
+ label: r("recipe.steps", "Steps (one per line)"),
1120
+ type: "textarea",
1121
+ group: c
1122
+ }
1123
+ );
1124
+ } else if (Y === "service") {
1125
+ const c = r("service.section", "Service");
1126
+ C.push(
1127
+ {
1128
+ field: "serviceName",
1129
+ label: r("service.name", "Service name"),
1130
+ type: "text",
1131
+ group: c,
1132
+ required: !0
1133
+ },
1134
+ {
1135
+ field: "serviceProvider",
1136
+ label: r("service.provider", "Provider"),
1137
+ type: "text",
1138
+ group: c
1139
+ },
1140
+ {
1141
+ field: "serviceCustomer",
1142
+ label: r("service.customer", "Customer"),
1143
+ type: "text",
1144
+ group: c
1145
+ },
1146
+ { field: "serviceContact", label: r("service.contact", "Contact"), type: "text", group: c },
1147
+ {
1148
+ field: "serviceLocation",
1149
+ label: r("service.location", "Location"),
1150
+ type: "text",
1151
+ group: c
1152
+ },
1153
+ {
1154
+ field: "servicePrice",
1155
+ label: r("service.price", "Price"),
1156
+ type: "number",
1157
+ group: c
1158
+ },
1159
+ {
1160
+ field: "serviceCurrency",
1161
+ label: r("service.currency", "Currency"),
1162
+ type: "text",
1163
+ group: c
1164
+ },
1165
+ { field: "serviceNotes", label: r("service.notes", "Notes"), type: "textarea", group: c }
1166
+ );
1167
+ }
1168
+ return C;
1169
+ }, [o, D, N, d, a, l.eventType, r]), I = () => {
1170
+ const h = l.eventType ?? "task", f = {
1171
+ title: l.title,
1172
+ description: l.description || void 0,
1173
+ color: l.color,
1174
+ category: l.category || void 0,
1175
+ eventStyle: l.eventStyle,
1176
+ allDay: l.allDay,
1177
+ start: l.start instanceof Date ? l.start : new Date(l.start),
1178
+ end: l.end instanceof Date ? l.end : new Date(l.end),
1179
+ resourceId: l.resourceId || void 0,
1180
+ eventType: h
1181
+ };
1182
+ if (l.recurring) {
1183
+ const L = {
1184
+ freq: l.recurrenceFreq || "weekly",
1185
+ interval: typeof l.recurrenceInterval == "number" && l.recurrenceInterval > 0 ? l.recurrenceInterval : 1
1186
+ };
1187
+ typeof l.recurrenceCount == "number" && l.recurrenceCount > 0 && (L.count = l.recurrenceCount), f.recurrence = L;
1188
+ } else
1189
+ f.recurrence = void 0;
1190
+ if (h === "recipe") {
1191
+ const L = String(l.recipeIngredients || "").split(`
1192
+ `).map((Y) => Y.trim()).filter(Boolean).map((Y, q) => {
1193
+ const c = Y.match(/^([\d.,/]+)\s*(\S+)?\s+(.+)$/);
1194
+ if (c) {
1195
+ const _ = parseFloat(c[1].replace(",", "."));
1196
+ return {
1197
+ id: `ing-${q}`,
1198
+ name: c[3],
1199
+ quantity: isNaN(_) ? void 0 : _,
1200
+ unit: c[2]
1201
+ };
1202
+ }
1203
+ return { id: `ing-${q}`, name: Y };
1204
+ }), p = String(l.recipeSteps || "").split(`
1205
+ `).map((Y) => Y.trim()).filter(Boolean).map((Y, q) => ({
1206
+ id: `step-${q}`,
1207
+ order: q + 1,
1208
+ instruction: Y
1209
+ })), C = e?.recipe ?? xt(), A = {
1210
+ ...C,
1211
+ title: l.recipeTitle || l.title || C.title,
1212
+ servings: typeof l.recipeServings == "number" ? l.recipeServings : C.servings,
1213
+ prepMinutes: typeof l.recipePrep == "number" ? l.recipePrep : C.prepMinutes,
1214
+ cookMinutes: typeof l.recipeCook == "number" ? l.recipeCook : C.cookMinutes,
1215
+ ingredients: L,
1216
+ steps: p
1217
+ };
1218
+ f.recipe = A, f.service = void 0;
1219
+ } else if (h === "service") {
1220
+ const L = {
1221
+ serviceName: String(l.serviceName || ""),
1222
+ providerName: l.serviceProvider || void 0,
1223
+ customerName: l.serviceCustomer || void 0,
1224
+ customerContact: l.serviceContact || void 0,
1225
+ location: l.serviceLocation || void 0,
1226
+ price: typeof l.servicePrice == "number" ? l.servicePrice : void 0,
1227
+ currency: l.serviceCurrency || void 0,
1228
+ notes: l.serviceNotes || void 0
1229
+ };
1230
+ f.service = L, f.recipe = void 0;
1231
+ } else
1232
+ f.recipe = void 0, f.service = void 0;
1233
+ return w && (f.id = e.id), f;
1234
+ };
1235
+ return /* @__PURE__ */ t(
1236
+ vt,
1237
+ {
1238
+ open: !0,
1239
+ onClose: T,
1240
+ title: w ? r("editEvent", "Edit Event") : r("newEvent", "New Event"),
1241
+ size: "md",
1242
+ footer: S ? null : /* @__PURE__ */ g(Je, { children: [
1243
+ w && m && /* @__PURE__ */ t(
1244
+ ne,
1245
+ {
1246
+ type: "button",
1247
+ variant: "error",
1248
+ size: "sm",
1249
+ onClick: () => {
1250
+ m(e), T();
1251
+ },
1252
+ disabled: E,
1253
+ children: r("delete", "Delete")
1254
+ }
1255
+ ),
1256
+ /* @__PURE__ */ t("div", { style: { flex: 1 } }),
1257
+ /* @__PURE__ */ t(
1258
+ ne,
1259
+ {
1260
+ type: "button",
1261
+ variant: "secondary",
1262
+ size: "sm",
1263
+ onClick: T,
1264
+ disabled: E,
1265
+ children: r("cancel", "Cancel")
1266
+ }
1267
+ ),
1268
+ /* @__PURE__ */ t(
1269
+ ne,
1270
+ {
1271
+ type: "button",
1272
+ variant: "primary",
1273
+ size: "sm",
1274
+ onClick: () => {
1275
+ l.title && b(I());
1276
+ },
1277
+ disabled: E || !l.title,
1278
+ children: E ? r("saving", "Saving…") : r("save", "Save")
1279
+ }
1280
+ )
1281
+ ] }),
1282
+ children: /* @__PURE__ */ t(
1283
+ "div",
1284
+ {
1285
+ className: "nice-scheduler__form-body",
1286
+ onKeyDown: (h) => {
1287
+ h.key === "Enter" && h.target.tagName !== "TEXTAREA" && (h.preventDefault(), l.title && b(I()));
1288
+ },
1289
+ children: S ? S({
1290
+ event: e,
1291
+ slotStart: n,
1292
+ slotEnd: s,
1293
+ save: b,
1294
+ cancel: T,
1295
+ remove: m
1296
+ }) : /* @__PURE__ */ t(
1297
+ ft,
1298
+ {
1299
+ items: y,
1300
+ data: l,
1301
+ onFieldChange: R,
1302
+ columns: 1,
1303
+ gap: 12,
1304
+ size: "sm"
1305
+ }
1306
+ )
1307
+ }
1308
+ )
1309
+ }
1310
+ );
1311
+ }, Ht = [
1312
+ "day",
1313
+ "workWeek",
1314
+ "week",
1315
+ "dayRange",
1316
+ "month",
1317
+ "monthRange",
1318
+ "timeline",
1319
+ "agenda"
1320
+ ], Ze = ({
1321
+ events: e,
1322
+ defaultEvents: n,
1323
+ resources: s,
1324
+ currentDate: d,
1325
+ view: a,
1326
+ onDateChange: o,
1327
+ onViewChange: D,
1328
+ onEventClick: N,
1329
+ onSlotClick: S,
1330
+ onEventDrop: E,
1331
+ draggable: b = !1,
1332
+ timelineDays: m = 7,
1333
+ startHour: T = 0,
1334
+ endHour: r = 24,
1335
+ firstDayOfWeek: w = 1,
1336
+ categories: k,
1337
+ showLegend: l,
1338
+ showTooltip: u,
1339
+ renderEvent: R,
1340
+ renderTooltip: y,
1341
+ workHours: I,
1342
+ showCurrentTime: h = !0,
1343
+ showMiniCalendar: f,
1344
+ onEventCreate: L,
1345
+ onEventEdit: p,
1346
+ onEventDelete: C,
1347
+ editable: A = !0,
1348
+ formFields: Y,
1349
+ formFieldsByType: q,
1350
+ eventTypes: c,
1351
+ renderEventEditor: _,
1352
+ loadEvents: x,
1353
+ onEventsChange: z,
1354
+ accessMode: B = "full",
1355
+ className: G,
1356
+ style: F
1357
+ }) => {
1358
+ const { t: M } = Ge(), Q = B === "hidden", X = B === "readOnly" || B === "disabled", U = B === "disabled", [pe, ye] = K(d ?? /* @__PURE__ */ new Date()), [fe, oe] = K(a ?? "week"), ie = d !== void 0 && o !== void 0, Ee = a !== void 0 && D !== void 0, W = ie ? d : pe, $ = Ee ? a : fe;
1359
+ Te(
1360
+ "NiceScheduler",
1361
+ "currentDate",
1362
+ "onDateChange",
1363
+ d,
1364
+ ie
1365
+ ), Te("NiceScheduler", "view", "onViewChange", a, Ee);
1366
+ const et = yt(null), [J, we] = K(() => {
1367
+ const i = /* @__PURE__ */ new Date();
1368
+ return i.setHours(0, 0, 0, 0), i;
1369
+ }), [O, be] = K(() => P(/* @__PURE__ */ new Date(), 13)), [Se, Re] = K(
1370
+ null
1371
+ ), tt = te(
1372
+ (i, v) => {
1373
+ u && Re(i && v ? { event: i, rect: v } : null);
1374
+ },
1375
+ [u]
1376
+ ), [ce, le] = K(null), [nt, _e] = K(!1), ke = e !== void 0 && z !== void 0, [rt, Le] = pt({
1377
+ value: ke ? e : void 0,
1378
+ defaultValue: n,
1379
+ fallbackValue: [],
1380
+ onChange: z,
1381
+ componentName: "NiceScheduler"
1382
+ }), [Fe, it] = K(!1), [Ie, ct] = K(null), [Vt, Ae] = K(!1), Z = Ie ?? (ke || Fe || e === void 0 ? rt : e);
1383
+ Te(
1384
+ "NiceScheduler",
1385
+ "events",
1386
+ "onEventsChange",
1387
+ e,
1388
+ ke || !(Fe || Ie !== null),
1389
+ "the built-in editor has taken over the list"
1390
+ );
1391
+ const [de, st] = K(/* @__PURE__ */ new Set()), Pe = te((i) => {
1392
+ st((v) => {
1393
+ const V = new Set(v);
1394
+ return V.has(i) ? V.delete(i) : V.add(i), V;
1395
+ });
1396
+ }, []), ue = Ne(() => {
1397
+ if ($ === "month")
1398
+ return {
1399
+ start: new Date(W.getFullYear(), W.getMonth(), 1),
1400
+ end: new Date(W.getFullYear(), W.getMonth() + 2, 0)
1401
+ };
1402
+ if ($ === "timeline")
1403
+ return { start: new Date(W), end: P(W, m) };
1404
+ if ($ === "dayRange" || $ === "monthRange")
1405
+ return { start: new Date(J), end: P(O, 1) };
1406
+ const i = (() => {
1407
+ const v = new Date(W), V = (v.getDay() - w + 7) % 7;
1408
+ return P(v, -V);
1409
+ })();
1410
+ return { start: P(i, -1), end: P(i, 8) };
1411
+ }, [W, $, w, m, J, O]), Ce = Ne(() => {
1412
+ let i = Tt(Z, ue.start, ue.end);
1413
+ return de.size > 0 && (i = i.filter((v) => !v.category || !de.has(v.category))), i;
1414
+ }, [Z, ue, de]), se = (i) => {
1415
+ ye(i), o?.(i);
1416
+ }, at = (i) => {
1417
+ oe(i), D?.(i);
1418
+ }, Ye = (i) => {
1419
+ if ($ === "day")
1420
+ se(P(W, i));
1421
+ else if ($ === "week" || $ === "workWeek")
1422
+ se(P(W, i * 7));
1423
+ else if ($ === "timeline")
1424
+ se(P(W, i * m));
1425
+ else if ($ === "dayRange" || $ === "monthRange") {
1426
+ const v = Math.round((O.getTime() - J.getTime()) / 864e5) + 1;
1427
+ we(P(J, i * v)), be(P(O, i * v));
1428
+ } else {
1429
+ const v = new Date(W);
1430
+ v.setMonth(v.getMonth() + i), se(v);
1431
+ }
1432
+ }, Me = Ne(() => {
1433
+ const i = new Date(W), v = (i.getDay() - w + 7) % 7;
1434
+ return P(i, -v);
1435
+ }, [W, w]), ve = Ne(() => {
1436
+ if ($ === "day")
1437
+ return [W];
1438
+ if ($ === "workWeek") {
1439
+ const i = [];
1440
+ for (let v = 0; v < 7; v++) {
1441
+ const V = P(Me, v), ee = V.getDay();
1442
+ ee !== 0 && ee !== 6 && i.push(V);
1443
+ }
1444
+ return i;
1445
+ }
1446
+ return Array.from({ length: 7 }, (i, v) => P(Me, v));
1447
+ }, [$, W, Me]), ot = $ === "day" ? W.toLocaleDateString() : $ === "week" || $ === "workWeek" ? `${ve[0].toLocaleDateString()} – ${ve[ve.length - 1].toLocaleDateString()}` : $ === "timeline" ? `${W.toLocaleDateString()} – ${P(W, m - 1).toLocaleDateString()}` : $ === "dayRange" || $ === "monthRange" ? `${J.toLocaleDateString()} – ${O.toLocaleDateString()}` : `${St(M)[W.getMonth()]} ${W.getFullYear()}`, lt = te(
1448
+ (i, v, V) => {
1449
+ X || (A && le({ mode: "create", slotStart: i, slotEnd: v }), S?.(i, v, V));
1450
+ },
1451
+ [A, S, X]
1452
+ ), dt = te(
1453
+ (i) => {
1454
+ A && !X && le({ mode: "edit", event: i }), N?.(i);
1455
+ },
1456
+ [A, N, X]
1457
+ ), me = te(
1458
+ (i) => {
1459
+ it(!0), Le(i);
1460
+ },
1461
+ [Le]
1462
+ ), ut = te(
1463
+ async (i) => {
1464
+ const v = ce?.mode === "create";
1465
+ try {
1466
+ if (_e(!0), v) {
1467
+ const ee = (L ? await L(i) : void 0) ?? {
1468
+ ...i,
1469
+ id: typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `evt_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`
1470
+ }, De = Z.slice();
1471
+ De.push(ee), me(De);
1472
+ } else {
1473
+ const ee = (p ? await p(i) : void 0) ?? i, De = Z.map((Ve) => Ve.id === ee.id ? ee : Ve);
1474
+ me(De);
1475
+ }
1476
+ le(null);
1477
+ } finally {
1478
+ _e(!1);
1479
+ }
1480
+ },
1481
+ [ce, L, p, Z, me]
1482
+ ), mt = te(
1483
+ async (i) => {
1484
+ try {
1485
+ _e(!0), C && await C(i);
1486
+ const v = Z.filter((V) => V.id !== i.id);
1487
+ me(v), le(null);
1488
+ } finally {
1489
+ _e(!1);
1490
+ }
1491
+ },
1492
+ [C, Z, me]
1493
+ ), We = ue.start.getTime(), qe = ue.end.getTime();
1494
+ H.useEffect(() => {
1495
+ if (!x)
1496
+ return;
1497
+ let i = !1;
1498
+ return Ae(!0), x({ start: new Date(We), end: new Date(qe) }).then((v) => {
1499
+ i || ct(v);
1500
+ }).finally(() => {
1501
+ i || Ae(!1);
1502
+ }), () => {
1503
+ i = !0;
1504
+ };
1505
+ }, [x, We, qe]);
1506
+ const ht = (i) => ({
1507
+ day: M("day", "Day"),
1508
+ week: M("week", "Week"),
1509
+ workWeek: M("workWeek", "Work Week"),
1510
+ month: M("month", "Month"),
1511
+ timeline: M("timeline", "Timeline"),
1512
+ agenda: M("agenda", "Agenda"),
1513
+ dayRange: M("dayRange", "Day Range"),
1514
+ monthRange: M("monthRange", "Month Range")
1515
+ })[i], ae = {
1516
+ events: Ce,
1517
+ curDate: W,
1518
+ firstDayOfWeek: w,
1519
+ startHour: T,
1520
+ endHour: r,
1521
+ draggable: b,
1522
+ dragRef: et,
1523
+ onEventClick: dt,
1524
+ onSlotClick: lt,
1525
+ onEventDrop: E,
1526
+ resources: s,
1527
+ timelineDays: m,
1528
+ categories: k,
1529
+ workHours: I,
1530
+ showCurrentTime: h,
1531
+ renderEvent: R,
1532
+ showTooltip: u,
1533
+ renderTooltip: y,
1534
+ onHoverEvent: tt,
1535
+ readOnly: X,
1536
+ t: M
1537
+ }, ze = $ === "dayRange" || $ === "monthRange", He = (i) => {
1538
+ const v = (V) => V.toString().padStart(2, "0");
1539
+ return `${i.getFullYear()}-${v(i.getMonth() + 1)}-${v(i.getDate())}`;
1540
+ };
1541
+ return Q ? null : /* @__PURE__ */ g(
1542
+ "div",
1543
+ {
1544
+ className: `nice-scheduler ${U ? "nice-scheduler--disabled" : ""} ${G || ""}`,
1545
+ style: F,
1546
+ children: [
1547
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__toolbar", children: [
1548
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__nav", children: [
1549
+ /* @__PURE__ */ g(Be, { size: "sm", children: [
1550
+ /* @__PURE__ */ t(
1551
+ ne,
1552
+ {
1553
+ onClick: () => Ye(-1),
1554
+ disabled: U,
1555
+ "aria-label": M("previous", "Previous"),
1556
+ children: "‹"
1557
+ }
1558
+ ),
1559
+ /* @__PURE__ */ t(
1560
+ ne,
1561
+ {
1562
+ onClick: () => {
1563
+ if (ze) {
1564
+ const i = /* @__PURE__ */ new Date();
1565
+ i.setHours(0, 0, 0, 0);
1566
+ const v = Math.round((O.getTime() - J.getTime()) / 864e5);
1567
+ we(i), be(P(i, v));
1568
+ } else
1569
+ se(/* @__PURE__ */ new Date());
1570
+ },
1571
+ disabled: U,
1572
+ children: M("today", "Today")
1573
+ }
1574
+ ),
1575
+ /* @__PURE__ */ t(
1576
+ ne,
1577
+ {
1578
+ onClick: () => Ye(1),
1579
+ disabled: U,
1580
+ "aria-label": M("next", "Next"),
1581
+ children: "›"
1582
+ }
1583
+ )
1584
+ ] }),
1585
+ ze ? /* @__PURE__ */ g("span", { className: "nice-scheduler__range-picker", children: [
1586
+ /* @__PURE__ */ t(
1587
+ "input",
1588
+ {
1589
+ type: "date",
1590
+ className: "nice-textinput nice-textinput--sm",
1591
+ value: He(J),
1592
+ disabled: U,
1593
+ onChange: (i) => {
1594
+ const v = /* @__PURE__ */ new Date(i.target.value + "T00:00:00");
1595
+ isNaN(v.getTime()) || we(v);
1596
+ }
1597
+ }
1598
+ ),
1599
+ /* @__PURE__ */ t("span", { style: { margin: "0 4px" }, children: "–" }),
1600
+ /* @__PURE__ */ t(
1601
+ "input",
1602
+ {
1603
+ type: "date",
1604
+ className: "nice-textinput nice-textinput--sm",
1605
+ value: He(O),
1606
+ disabled: U,
1607
+ onChange: (i) => {
1608
+ const v = /* @__PURE__ */ new Date(i.target.value + "T00:00:00");
1609
+ !isNaN(v.getTime()) && v >= J && be(v);
1610
+ }
1611
+ }
1612
+ )
1613
+ ] }) : /* @__PURE__ */ t("span", { className: "nice-scheduler__title", children: ot })
1614
+ ] }),
1615
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__views", children: /* @__PURE__ */ t(Be, { size: "sm", children: Ht.map((i) => /* @__PURE__ */ t(
1616
+ ne,
1617
+ {
1618
+ variant: i === $ ? "primary" : "secondary",
1619
+ onClick: () => at(i),
1620
+ disabled: U,
1621
+ children: ht(i)
1622
+ },
1623
+ i
1624
+ )) }) })
1625
+ ] }),
1626
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__body", children: [
1627
+ f && /* @__PURE__ */ g("div", { className: "nice-scheduler__sidebar", children: [
1628
+ /* @__PURE__ */ t(
1629
+ Pt,
1630
+ {
1631
+ curDate: W,
1632
+ onDateSelect: (i) => se(i),
1633
+ firstDayOfWeek: w,
1634
+ t: M
1635
+ }
1636
+ ),
1637
+ l && k && /* @__PURE__ */ t(
1638
+ Ue,
1639
+ {
1640
+ categories: k,
1641
+ events: Ce,
1642
+ filteredCategories: de,
1643
+ onToggleCategory: Pe,
1644
+ t: M
1645
+ }
1646
+ )
1647
+ ] }),
1648
+ /* @__PURE__ */ g("div", { className: "nice-scheduler__content", children: [
1649
+ $ === "month" && /* @__PURE__ */ t(Rt, { ...ae }),
1650
+ ($ === "week" || $ === "day" || $ === "workWeek") && /* @__PURE__ */ t(Lt, { ...ae, days: ve }),
1651
+ $ === "dayRange" && /* @__PURE__ */ t(Yt, { ...ae, rangeStart: J, rangeEnd: O }),
1652
+ $ === "monthRange" && /* @__PURE__ */ t(Wt, { ...ae, rangeStart: J, rangeEnd: O }),
1653
+ $ === "timeline" && /* @__PURE__ */ t(At, { ...ae }),
1654
+ $ === "agenda" && /* @__PURE__ */ t(Ft, { ...ae })
1655
+ ] }),
1656
+ !f && l && k && /* @__PURE__ */ t("div", { className: "nice-scheduler__sidebar nice-scheduler__sidebar--right", children: /* @__PURE__ */ t(
1657
+ Ue,
1658
+ {
1659
+ categories: k,
1660
+ events: Ce,
1661
+ filteredCategories: de,
1662
+ onToggleCategory: Pe,
1663
+ t: M
1664
+ }
1665
+ ) })
1666
+ ] }),
1667
+ Se && /* @__PURE__ */ t(
1668
+ qt,
1669
+ {
1670
+ event: Se.event,
1671
+ rect: Se.rect,
1672
+ categories: k,
1673
+ renderTooltip: y
1674
+ }
1675
+ ),
1676
+ ce && A && /* @__PURE__ */ t(
1677
+ zt,
1678
+ {
1679
+ event: ce.event,
1680
+ slotStart: ce.slotStart,
1681
+ slotEnd: ce.slotEnd,
1682
+ categories: k,
1683
+ resources: s,
1684
+ formFields: Y,
1685
+ formFieldsByType: q,
1686
+ eventTypes: c,
1687
+ renderEditor: _,
1688
+ saving: nt,
1689
+ onSave: ut,
1690
+ onDelete: mt,
1691
+ onClose: () => le(null),
1692
+ t: M
1693
+ }
1694
+ )
1695
+ ]
1696
+ }
1697
+ );
1698
+ };
1699
+ process.env.NODE_ENV !== "production" && (Ze.displayName = "NiceScheduler");
1700
+ const Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1701
+ __proto__: null,
1702
+ NiceScheduler: Ze
1703
+ }, Symbol.toStringTag, { value: "Module" }));
1704
+ export {
1705
+ Be as N,
1706
+ Et as a,
1707
+ Ze as b,
1708
+ xt as c,
1709
+ Qt as d,
1710
+ $t as n,
1711
+ Mt as r
1712
+ };