@nice2dev/ui 1.2.2 → 1.3.1

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