@keenmate/web-daterangepicker 1.0.0-rc03 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3053 +0,0 @@
1
- var At = Object.defineProperty;
2
- var kt = (e, t, n) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var v = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n);
4
- function Rt(e) {
5
- if (e !== "auto")
6
- return e;
7
- try {
8
- const a = new Intl.Locale(navigator.language);
9
- if ("weekInfo" in a && a.weekInfo && "firstDay" in a.weekInfo) {
10
- const r = a.weekInfo.firstDay;
11
- return r === 7 ? 0 : r;
12
- }
13
- } catch {
14
- }
15
- const t = navigator.language.toLowerCase();
16
- return [
17
- "en-us",
18
- "en-ca",
19
- // US, Canada
20
- "ja",
21
- "ja-jp",
22
- // Japan
23
- "he",
24
- "he-il",
25
- // Israel
26
- "ar-sa",
27
- "ar-ae",
28
- // Saudi Arabia, UAE
29
- "ko",
30
- "ko-kr"
31
- // South Korea
32
- ].some((a) => t.startsWith(a)) ? 0 : 1;
33
- }
34
- function ye(e) {
35
- if (!e) return null;
36
- let t;
37
- return typeof e == "string" ? t = /* @__PURE__ */ new Date(e + "T00:00:00") : t = new Date(e), t.setHours(0, 0, 0, 0), isNaN(t.getTime()) ? null : t;
38
- }
39
- function ve(e) {
40
- const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0");
41
- return `${t}-${n}-${a}`;
42
- }
43
- function $t(e, t, n, a, r, o) {
44
- const s = ve(e), i = e.getDay();
45
- return !!(t && e < t || n && e > n || r && r.includes(i) || a.has(s) || o && o(e));
46
- }
47
- function Pt(e, t, n) {
48
- const a = new Date(e), r = new Date(t);
49
- a.setHours(0, 0, 0, 0), r.setHours(0, 0, 0, 0);
50
- const o = new Date(a);
51
- for (; o <= r; ) {
52
- if (n(o))
53
- return !0;
54
- o.setDate(o.getDate() + 1);
55
- }
56
- return !1;
57
- }
58
- function Tt(e, t, n) {
59
- const a = [], r = new Date(e), o = new Date(t);
60
- r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
61
- const s = new Date(r);
62
- for (; s <= o; )
63
- n(s) || a.push(new Date(s)), s.setDate(s.getDate() + 1);
64
- return a;
65
- }
66
- function zt(e, t, n) {
67
- const a = [], r = new Date(e), o = new Date(t);
68
- r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
69
- const s = new Date(r);
70
- for (; s <= o; )
71
- n(s) && a.push(new Date(s)), s.setDate(s.getDate() + 1);
72
- return a;
73
- }
74
- function Ft(e, t, n) {
75
- const a = new Date(e), r = new Date(t);
76
- a.setHours(0, 0, 0, 0), r.setHours(0, 0, 0, 0);
77
- let o = new Date(a);
78
- const s = new Date(a);
79
- for (s.setDate(s.getDate() + 1); s <= r; ) {
80
- if (n(s))
81
- return o;
82
- o = new Date(s), s.setDate(s.getDate() + 1);
83
- }
84
- return r;
85
- }
86
- function Nt(e, t, n) {
87
- const a = [], r = new Date(e), o = new Date(t);
88
- r.setHours(0, 0, 0, 0), o.setHours(0, 0, 0, 0);
89
- let s = null;
90
- const i = new Date(r);
91
- for (; i <= o; ) {
92
- if (!n(i))
93
- s || (s = new Date(i));
94
- else if (s) {
95
- const d = new Date(i);
96
- d.setDate(d.getDate() - 1), a.push({ start: s, end: d }), s = null;
97
- }
98
- i.setDate(i.getDate() + 1);
99
- }
100
- return s && a.push({ start: s, end: new Date(o) }), a;
101
- }
102
- function Ot(e) {
103
- return Je(e, /* @__PURE__ */ new Date());
104
- }
105
- function Je(e, t) {
106
- return !e || !t ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
107
- }
108
- function Ht(e, t, n) {
109
- return !t || !n ? !1 : e > t && e < n;
110
- }
111
- var Qe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
112
- function Ze(e) {
113
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
114
- }
115
- var et = { exports: {} };
116
- (function(e) {
117
- (function(t, n) {
118
- e.exports ? e.exports = n() : t.log = n();
119
- })(Qe, function() {
120
- var t = function() {
121
- }, n = "undefined", a = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), r = [
122
- "trace",
123
- "debug",
124
- "info",
125
- "warn",
126
- "error"
127
- ], o = {}, s = null;
128
- function i(f, y) {
129
- var m = f[y];
130
- if (typeof m.bind == "function")
131
- return m.bind(f);
132
- try {
133
- return Function.prototype.bind.call(m, f);
134
- } catch {
135
- return function() {
136
- return Function.prototype.apply.apply(m, [f, arguments]);
137
- };
138
- }
139
- }
140
- function d() {
141
- console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
142
- }
143
- function l(f) {
144
- return f === "debug" && (f = "log"), typeof console === n ? !1 : f === "trace" && a ? d : console[f] !== void 0 ? i(console, f) : console.log !== void 0 ? i(console, "log") : t;
145
- }
146
- function c() {
147
- for (var f = this.getLevel(), y = 0; y < r.length; y++) {
148
- var m = r[y];
149
- this[m] = y < f ? t : this.methodFactory(m, f, this.name);
150
- }
151
- if (this.log = this.debug, typeof console === n && f < this.levels.SILENT)
152
- return "No console available for logging";
153
- }
154
- function u(f) {
155
- return function() {
156
- typeof console !== n && (c.call(this), this[f].apply(this, arguments));
157
- };
158
- }
159
- function p(f, y, m) {
160
- return l(f) || u.apply(this, arguments);
161
- }
162
- function g(f, y) {
163
- var m = this, x, E, L, b = "loglevel";
164
- typeof f == "string" ? b += ":" + f : typeof f == "symbol" && (b = void 0);
165
- function S(_) {
166
- var I = (r[_] || "silent").toUpperCase();
167
- if (!(typeof window === n || !b)) {
168
- try {
169
- window.localStorage[b] = I;
170
- return;
171
- } catch {
172
- }
173
- try {
174
- window.document.cookie = encodeURIComponent(b) + "=" + I + ";";
175
- } catch {
176
- }
177
- }
178
- }
179
- function C() {
180
- var _;
181
- if (!(typeof window === n || !b)) {
182
- try {
183
- _ = window.localStorage[b];
184
- } catch {
185
- }
186
- if (typeof _ === n)
187
- try {
188
- var I = window.document.cookie, $ = encodeURIComponent(b), k = I.indexOf($ + "=");
189
- k !== -1 && (_ = /^([^;]+)/.exec(
190
- I.slice(k + $.length + 1)
191
- )[1]);
192
- } catch {
193
- }
194
- return m.levels[_] === void 0 && (_ = void 0), _;
195
- }
196
- }
197
- function A() {
198
- if (!(typeof window === n || !b)) {
199
- try {
200
- window.localStorage.removeItem(b);
201
- } catch {
202
- }
203
- try {
204
- window.document.cookie = encodeURIComponent(b) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
205
- } catch {
206
- }
207
- }
208
- }
209
- function w(_) {
210
- var I = _;
211
- if (typeof I == "string" && m.levels[I.toUpperCase()] !== void 0 && (I = m.levels[I.toUpperCase()]), typeof I == "number" && I >= 0 && I <= m.levels.SILENT)
212
- return I;
213
- throw new TypeError("log.setLevel() called with invalid level: " + _);
214
- }
215
- m.name = f, m.levels = {
216
- TRACE: 0,
217
- DEBUG: 1,
218
- INFO: 2,
219
- WARN: 3,
220
- ERROR: 4,
221
- SILENT: 5
222
- }, m.methodFactory = y || p, m.getLevel = function() {
223
- return L ?? E ?? x;
224
- }, m.setLevel = function(_, I) {
225
- return L = w(_), I !== !1 && S(L), c.call(m);
226
- }, m.setDefaultLevel = function(_) {
227
- E = w(_), C() || m.setLevel(_, !1);
228
- }, m.resetLevel = function() {
229
- L = null, A(), c.call(m);
230
- }, m.enableAll = function(_) {
231
- m.setLevel(m.levels.TRACE, _);
232
- }, m.disableAll = function(_) {
233
- m.setLevel(m.levels.SILENT, _);
234
- }, m.rebuild = function() {
235
- if (s !== m && (x = w(s.getLevel())), c.call(m), s === m)
236
- for (var _ in o)
237
- o[_].rebuild();
238
- }, x = w(
239
- s ? s.getLevel() : "WARN"
240
- );
241
- var D = C();
242
- D != null && (L = w(D)), c.call(m);
243
- }
244
- s = new g(), s.getLogger = function(y) {
245
- if (typeof y != "symbol" && typeof y != "string" || y === "")
246
- throw new TypeError("You must supply a name when creating a logger.");
247
- var m = o[y];
248
- return m || (m = o[y] = new g(
249
- y,
250
- s.methodFactory
251
- )), m;
252
- };
253
- var h = typeof window !== n ? window.log : void 0;
254
- return s.noConflict = function() {
255
- return typeof window !== n && window.log === s && (window.log = h), s;
256
- }, s.getLoggers = function() {
257
- return o;
258
- }, s.default = s, s;
259
- });
260
- })(et);
261
- var Vt = et.exports;
262
- const R = /* @__PURE__ */ Ze(Vt);
263
- var tt = { exports: {} };
264
- (function(e) {
265
- (function(t, n) {
266
- e.exports ? e.exports = n() : t.prefix = n(t);
267
- })(Qe, function(t) {
268
- var n = function(c) {
269
- for (var u = 1, p = arguments.length, g; u < p; u++)
270
- for (g in arguments[u])
271
- Object.prototype.hasOwnProperty.call(arguments[u], g) && (c[g] = arguments[u][g]);
272
- return c;
273
- }, a = {
274
- template: "[%t] %l:",
275
- levelFormatter: function(c) {
276
- return c.toUpperCase();
277
- },
278
- nameFormatter: function(c) {
279
- return c || "root";
280
- },
281
- timestampFormatter: function(c) {
282
- return c.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
283
- },
284
- format: void 0
285
- }, r, o = {}, s = function(c) {
286
- if (!c || !c.getLogger)
287
- throw new TypeError("Argument is not a root logger");
288
- r = c;
289
- }, i = function(c, u) {
290
- if (!c || !c.setLevel)
291
- throw new TypeError("Argument is not a logger");
292
- var p = c.methodFactory, g = c.name || "", h = o[g] || o[""] || a;
293
- function f(y, m, x) {
294
- var E = p(y, m, x), L = o[x] || o[""], b = L.template.indexOf("%t") !== -1, S = L.template.indexOf("%l") !== -1, C = L.template.indexOf("%n") !== -1;
295
- return function() {
296
- for (var A = "", w = arguments.length, D = Array(w), _ = 0; _ < w; _++)
297
- D[_] = arguments[_];
298
- if (g || !o[x]) {
299
- var I = L.timestampFormatter(/* @__PURE__ */ new Date()), $ = L.levelFormatter(y), k = L.nameFormatter(x);
300
- L.format ? A += L.format($, k, I) : (A += L.template, b && (A = A.replace(/%t/, I)), S && (A = A.replace(/%l/, $)), C && (A = A.replace(/%n/, k))), D.length && typeof D[0] == "string" ? D[0] = A + " " + D[0] : D.unshift(A);
301
- }
302
- E.apply(void 0, D);
303
- };
304
- }
305
- return o[g] || (c.methodFactory = f), u = u || {}, u.template && (u.format = void 0), o[g] = n({}, h, u), c.setLevel(c.getLevel()), r || c.warn(
306
- "It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"
307
- ), c;
308
- }, d = {
309
- reg: s,
310
- apply: i
311
- }, l;
312
- return t && (l = t.prefix, d.noConflict = function() {
313
- return t.prefix === d && (t.prefix = l), d;
314
- }), d;
315
- });
316
- })(tt);
317
- var Yt = tt.exports;
318
- const j = /* @__PURE__ */ Ze(Yt);
319
- j.reg(R);
320
- j.apply(R, {
321
- format(e, t, n) {
322
- return `[${n}] [${e}] ${t ? `[${t}]` : ""}`;
323
- },
324
- timestampFormatter(e) {
325
- return e.toTimeString().split(" ")[0] + "." + e.getMilliseconds().toString().padStart(3, "0");
326
- }
327
- });
328
- const P = R.getLogger("INIT"), U = R.getLogger("VALIDATION"), z = R.getLogger("DRAG"), te = R.getLogger("SELECTION"), V = R.getLogger("RENDERING"), Y = R.getLogger("UI"), M = R.getLogger("NAVIGATION"), Z = R.getLogger("INTERACTION");
329
- j.apply(P);
330
- j.apply(U);
331
- j.apply(z);
332
- j.apply(te);
333
- j.apply(V);
334
- j.apply(Y);
335
- j.apply(M);
336
- j.apply(Z);
337
- const X = "silent";
338
- R.setLevel(X);
339
- P.setLevel(X);
340
- U.setLevel(X);
341
- z.setLevel(X);
342
- te.setLevel(X);
343
- V.setLevel(X);
344
- Y.setLevel(X);
345
- M.setLevel(X);
346
- Z.setLevel(X);
347
- const qt = (e) => {
348
- const t = e ? "debug" : "silent";
349
- R.setLevel(t), P.setLevel(t), U.setLevel(t), z.setLevel(t), te.setLevel(t), V.setLevel(t), Y.setLevel(t), M.setLevel(t), Z.setLevel(t);
350
- };
351
- function Ye(e, t, n) {
352
- for (let a = 1; a <= 31; a++) {
353
- const r = new Date(t, n, a);
354
- if (r.getMonth() === n && !e.isDateDisabledInternal(r))
355
- return !0;
356
- }
357
- return !1;
358
- }
359
- function Bt(e, t) {
360
- e.showingRollingSelector[t] = !e.showingRollingSelector[t], e.renderCalendar();
361
- }
362
- function jt(e, t, n) {
363
- const a = e.monthDates[n].getFullYear();
364
- e.monthDates[n].setFullYear(t), M.debug(`selectYear() Col${n} - changed from ${a} to ${t}`), pe(e, n), e.showingRollingSelector[n] = !1, e.renderCalendar();
365
- }
366
- function Wt(e, t, n) {
367
- const a = e.monthDates[n].getMonth();
368
- e.monthDates[n].setMonth(t), M.debug(`selectMonth() Col${n} - changed from ${a + 1} to ${t + 1}`), pe(e, n), e.showingRollingSelector[n] = !1, e.renderCalendar();
369
- }
370
- function pe(e, t) {
371
- const n = e.monthDates[t];
372
- if (t < e.monthDates.length - 1) {
373
- const a = e.monthDates[t + 1];
374
- if (De(n, a)) {
375
- M.debug(`checkAndResolveCollisions() Col${t} - collision with Col${t + 1}, shifting forward`);
376
- const r = new Date(n.getFullYear(), n.getMonth() + 1, 1);
377
- e.monthDates[t + 1] = r, pe(e, t + 1);
378
- }
379
- }
380
- if (t > 0) {
381
- const a = e.monthDates[t - 1];
382
- if (De(a, n)) {
383
- M.debug(`checkAndResolveCollisions() Col${t} - collision with Col${t - 1}, shifting backward`);
384
- const r = new Date(n.getFullYear(), n.getMonth() - 1, 1);
385
- e.monthDates[t - 1] = r, pe(e, t - 1);
386
- }
387
- }
388
- }
389
- function De(e, t) {
390
- const n = e.getFullYear(), a = e.getMonth(), r = t.getFullYear(), o = t.getMonth();
391
- return n > r || n === r && a >= o;
392
- }
393
- function le(e, t) {
394
- const n = isNaN(t) ? e.activeMonthIndex : t;
395
- e.showingRollingSelector[n] && (e.showingRollingSelector[n] = !1);
396
- const a = e.monthDates[n], r = new Date(a.getFullYear(), a.getMonth() - 1, 1);
397
- if (e.monthDates[n] = r, M.debug(`prevMonth() Col${n} - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), n > 0) {
398
- const o = e.monthDates[n - 1];
399
- De(o, r) && (M.debug(`prevMonth() Col${n} - collision detected with Col${n - 1}, shifting previous columns back`), le(e, n - 1));
400
- }
401
- e.renderCalendar();
402
- }
403
- function ce(e, t) {
404
- const n = isNaN(t) ? e.activeMonthIndex : t;
405
- e.showingRollingSelector[n] && (e.showingRollingSelector[n] = !1);
406
- const a = e.monthDates[n], r = new Date(a.getFullYear(), a.getMonth() + 1, 1);
407
- if (e.monthDates[n] = r, M.debug(`nextMonth() Col${n} - changed from ${a.getFullYear()}-${a.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), n < e.monthDates.length - 1) {
408
- const o = e.monthDates[n + 1];
409
- De(r, o) && (M.debug(`nextMonth() Col${n} - collision detected with Col${n + 1}, shifting next columns forward`), ce(e, n + 1));
410
- }
411
- e.renderCalendar();
412
- }
413
- function de(e, t, n, a, r) {
414
- let o = t, s = 0;
415
- const i = 60;
416
- for (; s < i; ) {
417
- if (o >= 0 && o < a.length) {
418
- const l = a[o].dataset.date;
419
- if (l) {
420
- const [c, u, p] = l.split("-").map(Number), g = new Date(c, u, p);
421
- if (!e.isDateDisabledInternal(g))
422
- return { index: o, monthChanged: !1 };
423
- }
424
- }
425
- if (o += n, s++, o < 0 || o >= a.length)
426
- return { index: null, monthChanged: !0, direction: n > 0 ? "next" : "prev" };
427
- }
428
- return { index: null, monthChanged: !1 };
429
- }
430
- function Kt(e, t) {
431
- var s, i, d, l;
432
- M.debug(`moveFocus(${t}) Col${e.activeMonthIndex} - focusedDayIndex:`, e.focusedDayIndex);
433
- const n = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
434
- if (!n) {
435
- M.debug(`moveFocus() Col${e.activeMonthIndex} - ERROR: daysContainer not found!`);
436
- return;
437
- }
438
- const a = n.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
439
- if (M.debug(`moveFocus() Col${e.activeMonthIndex} - found ${a.length} days in column`), a.length === 0) return;
440
- if (e.focusedDayIndex === null) {
441
- const c = Array.from(a).findIndex((u) => u.classList.contains("drp-date-picker__day--today"));
442
- e.focusedDayIndex = c !== -1 ? c : 0, M.debug(`moveFocus() Col${e.activeMonthIndex} - initialized focusedDayIndex to ${e.focusedDayIndex} (today or first day), will move by offset ${t}`);
443
- }
444
- (s = a[e.focusedDayIndex]) == null || s.classList.remove("drp-date-picker__day--focused");
445
- const r = e.focusedDayIndex + t;
446
- if (r < 0) {
447
- const c = e.activeMonthIndex;
448
- if (t === -1)
449
- M.debug(`moveFocus() Col${c} - edge navigation LEFT: going to last enabled day of prev month`), le(e, e.activeMonthIndex), setTimeout(() => {
450
- var h, f;
451
- const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
452
- if (!u) return;
453
- const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = de(e, p.length - 1, -1, p);
454
- g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
455
- }, 0);
456
- else {
457
- const p = a[e.focusedDayIndex].dataset.date;
458
- if (p) {
459
- const [g, h, f] = p.split("-").map(Number), m = new Date(g, h, f).getDay();
460
- M.debug(`moveFocus() Col${c} - edge navigation UP: current day ${f} is weekday ${m}, going to prev month`), le(e, e.activeMonthIndex), setTimeout(() => {
461
- var S, C;
462
- const x = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
463
- if (!x) return;
464
- const E = x.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), b = E[E.length - 1].dataset.date;
465
- if (b) {
466
- const [A, w, D] = b.split("-").map(Number), I = new Date(A, w, D).getDay(), $ = (I - m + 7) % 7;
467
- e.focusedDayIndex = E.length - 1 - $, M.debug(`moveFocus() Col${c} - last day weekday ${I}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (S = E[e.focusedDayIndex]) == null || S.classList.add("drp-date-picker__day--focused"), (C = E[e.focusedDayIndex]) == null || C.scrollIntoView({ block: "nearest" });
468
- }
469
- }, 0);
470
- }
471
- }
472
- return;
473
- } else if (r >= a.length) {
474
- const c = e.activeMonthIndex;
475
- if (t === 1)
476
- M.debug(`moveFocus() Col${c} - edge navigation RIGHT: going to first enabled day of next month`), ce(e, e.activeMonthIndex), setTimeout(() => {
477
- var h, f;
478
- const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
479
- if (!u) return;
480
- const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = de(e, 0, 1, p);
481
- g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
482
- }, 0);
483
- else {
484
- const p = a[e.focusedDayIndex].dataset.date;
485
- if (p) {
486
- const [g, h, f] = p.split("-").map(Number), m = new Date(g, h, f).getDay();
487
- M.debug(`moveFocus() Col${c} - edge navigation DOWN: current day ${f} is weekday ${m}, going to next month`), ce(e, e.activeMonthIndex), setTimeout(() => {
488
- var S, C;
489
- const x = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
490
- if (!x) return;
491
- const E = x.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), b = E[0].dataset.date;
492
- if (b) {
493
- const [A, w, D] = b.split("-").map(Number), I = new Date(A, w, D).getDay(), $ = (m - I + 7) % 7;
494
- e.focusedDayIndex = $, M.debug(`moveFocus() Col${c} - first day weekday ${I}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (S = E[e.focusedDayIndex]) == null || S.classList.add("drp-date-picker__day--focused"), (C = E[e.focusedDayIndex]) == null || C.scrollIntoView({ block: "nearest" });
495
- }
496
- }, 0);
497
- }
498
- }
499
- return;
500
- }
501
- const o = de(e, r, t, a, e.activeMonthIndex);
502
- if (o.monthChanged) {
503
- const c = e.activeMonthIndex;
504
- o.direction === "next" ? ce(e, e.activeMonthIndex) : le(e, e.activeMonthIndex), setTimeout(() => {
505
- var h, f;
506
- const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
507
- if (!u) return;
508
- const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = de(
509
- e,
510
- o.direction === "next" ? 0 : p.length - 1,
511
- t,
512
- p
513
- );
514
- g.index !== null && (e.focusedDayIndex = g.index, (h = p[e.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = p[e.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
515
- }, 0);
516
- return;
517
- }
518
- o.index !== null ? (e.focusedDayIndex = o.index, (i = a[e.focusedDayIndex]) == null || i.classList.add("drp-date-picker__day--focused"), (d = a[e.focusedDayIndex]) == null || d.scrollIntoView({ block: "nearest" })) : (M.debug("moveFocus() - no enabled day found in search range"), (l = a[e.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"));
519
- }
520
- function Ut(e) {
521
- V.debug("[DatePicker 18] renderCalendar called, showingRollingSelector:", e.showingRollingSelector, `activeCol: ${e.activeMonthIndex}`), V.debug("[DatePicker 18] monthDates array:", e.monthDates.map((t, n) => `Col${n}: ${t.getFullYear()}-${t.getMonth() + 1}`).join(", "));
522
- for (let t = 0; t < e.options.visibleMonthsCount; t++)
523
- e.showingRollingSelector[t] ? rt(e, t) : nt(e, t);
524
- if (requestAnimationFrame(() => {
525
- if (!e.calendarContentHeight && !e.showingRollingSelector[0]) {
526
- const t = e.calendar.querySelector('.drp-date-picker__month[data-month-index="0"]');
527
- if (t) {
528
- const n = t.querySelector(".drp-date-picker__weekdays"), a = t.querySelector(".drp-date-picker__days");
529
- if (n && a) {
530
- const r = n.offsetHeight, o = a.offsetHeight, s = getComputedStyle(n), i = parseInt(s.marginBottom) || 0;
531
- e.calendarContentHeight = r + i + o, V.debug("[DatePicker] Captured calendar content height:", {
532
- weekdaysHeight: r,
533
- weekdaysMargin: i,
534
- daysHeight: o,
535
- totalHeight: e.calendarContentHeight
536
- });
537
- }
538
- }
539
- }
540
- if (e.calendarContentHeight)
541
- for (let t = 0; t < e.options.visibleMonthsCount; t++) {
542
- const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
543
- if (!n) continue;
544
- const a = n.querySelector(".drp-date-picker__rolling-selector");
545
- if (a) {
546
- const r = a.classList.contains("drp-date-picker__rolling-selector--visible");
547
- if (a.style.height = `${e.calendarContentHeight}px`, r) {
548
- const o = a.offsetHeight;
549
- V.debug(`[DatePicker] Applied height to rolling selector ${t}:`, {
550
- targetHeight: e.calendarContentHeight,
551
- actualHeight: o,
552
- difference: o - e.calendarContentHeight
553
- });
554
- }
555
- }
556
- }
557
- }), e.focusedDayIndex !== null) {
558
- const t = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
559
- if (t) {
560
- const n = t.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
561
- n[e.focusedDayIndex] && n[e.focusedDayIndex].classList.add("drp-date-picker__day--focused");
562
- }
563
- }
564
- e.options.selectionMode === "range" && !e.isDragging && e.initDragListeners();
565
- }
566
- function nt(e, t) {
567
- V.debug(`[DatePicker Col${t} 19] renderNormalView called for month`, t);
568
- const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
569
- if (!n) return;
570
- const a = n.querySelector(".drp-date-picker__rolling-selector");
571
- a == null || a.classList.remove("drp-date-picker__rolling-selector--visible");
572
- const r = e.monthDates[t], o = n.querySelector(".drp-date-picker__month-year");
573
- o && (o.textContent = `${e.monthNames[r.getMonth()]} ${r.getFullYear()}`);
574
- const s = r.getFullYear(), i = r.getMonth(), d = i === 0 ? 11 : i - 1, l = i === 0 ? s - 1 : s, c = n.querySelector(".drp-date-picker__nav--prev");
575
- c && (Ye(e, l, d) ? (c.removeAttribute("disabled"), c.classList.remove("drp-date-picker__nav--disabled")) : (c.setAttribute("disabled", "true"), c.classList.add("drp-date-picker__nav--disabled")));
576
- const u = i === 11 ? 0 : i + 1, p = i === 11 ? s + 1 : s, g = n.querySelector(".drp-date-picker__nav--next");
577
- g && (Ye(e, p, u) ? (g.removeAttribute("disabled"), g.classList.remove("drp-date-picker__nav--disabled")) : (g.setAttribute("disabled", "true"), g.classList.add("drp-date-picker__nav--disabled")));
578
- const h = n.querySelector(".drp-date-picker__weekdays"), f = [
579
- ...e.weekdayNames.slice(e.weekStartDay),
580
- ...e.weekdayNames.slice(0, e.weekStartDay)
581
- ];
582
- h && (h.innerHTML = f.map((y) => `<div class="drp-date-picker__weekday">${y}</div>`).join("")), at(e, t, r);
583
- }
584
- function at(e, t, n) {
585
- V.debug(`[DatePicker Col${t} 20] renderDays called for month`, t);
586
- const a = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
587
- if (!a) return;
588
- const r = a.querySelector(".drp-date-picker__days"), o = n.getFullYear(), s = n.getMonth();
589
- V.debug(`[DatePicker Col${t} 21] Rendering days for:`, o, s + 1);
590
- const d = (new Date(o, s, 1).getDay() - e.weekStartDay + 7) % 7, l = new Date(o, s + 1, 0).getDate(), c = new Date(o, s, 0).getDate(), u = new Date(o, s - 1, 1), p = u.getFullYear(), g = u.getMonth(), h = new Date(o, s + 1, 1), f = h.getFullYear(), y = h.getMonth(), m = [];
591
- for (let S = d - 1; S >= 0; S--) {
592
- const C = c - S, A = new Date(p, g, C);
593
- m.push({
594
- date: A,
595
- year: p,
596
- month: g,
597
- day: C,
598
- isOtherMonth: !0
599
- });
600
- }
601
- for (let S = 1; S <= l; S++) {
602
- const C = new Date(o, s, S);
603
- m.push({
604
- date: C,
605
- year: o,
606
- month: s,
607
- day: S,
608
- isOtherMonth: !1
609
- });
610
- }
611
- const E = Math.ceil((d + l) / 7) * 7 - (d + l);
612
- for (let S = 1; S <= E; S++) {
613
- const C = new Date(f, y, S);
614
- m.push({
615
- date: C,
616
- year: f,
617
- month: y,
618
- day: S,
619
- isOtherMonth: !0
620
- });
621
- }
622
- const L = [];
623
- for (let S = 0; S < m.length; S += 7)
624
- L.push(m.slice(S, S + 7));
625
- let b = "";
626
- for (const S of L) {
627
- const C = S.map((w) => {
628
- const D = e.getDateInfoInternal(w.date);
629
- return {
630
- label: (D == null ? void 0 : D.label) || "",
631
- tooltip: (D == null ? void 0 : D.tooltip) || "",
632
- class: (D == null ? void 0 : D.class) || ""
633
- };
634
- });
635
- if (C.some((w) => w.label)) {
636
- b += '<div class="drp-date-picker__badge-row">';
637
- for (const w of C)
638
- if (w.label) {
639
- const D = w.tooltip ? ` data-tooltip="${w.tooltip.replace(/"/g, "&quot;")}"` : "", _ = w.class ? ` ${w.class}` : "";
640
- b += `<div class="drp-date-picker__badge-cell${_}"${D}>${w.label}</div>`;
641
- } else
642
- b += '<div class="drp-date-picker__badge-cell"></div>';
643
- b += "</div>";
644
- }
645
- b += '<div class="drp-date-picker__date-row">';
646
- for (const w of S) {
647
- const D = ["drp-date-picker__day"];
648
- w.isOtherMonth && D.push("drp-date-picker__day--other-month");
649
- const _ = e.isDateDisabledInternal(w.date);
650
- _ && D.push("drp-date-picker__day--disabled");
651
- const I = e.getDateInfoInternal(w.date);
652
- I && I.class && D.push(I.class), e.isToday(w.date) && D.push("drp-date-picker__day--today"), e.options.selectionMode === "single" && e.isSameDay(w.date, e.selectedDate) && D.push("drp-date-picker__day--selected"), e.options.selectionMode === "range" && (e.isSameDay(w.date, e.selectedStartDate) && D.push("drp-date-picker__day--range-start"), e.isSameDay(w.date, e.selectedEndDate) && D.push("drp-date-picker__day--range-end"), e.isInRange(w.date) && (!_ || e.options.highlightDisabledInRange) && D.push("drp-date-picker__day--in-range")), b += `<div class="${D.join(" ")}" data-date="${w.year}-${w.month}-${w.day}">${w.day}</div>`;
653
- }
654
- b += "</div>";
655
- }
656
- r && (r.innerHTML = b);
657
- }
658
- function rt(e, t) {
659
- var c, u;
660
- const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${t}"]`);
661
- if (!n) return;
662
- const a = n.querySelector(".drp-date-picker__rolling-selector");
663
- a == null || a.classList.add("drp-date-picker__rolling-selector--visible");
664
- const r = e.monthDates[t], o = a == null ? void 0 : a.querySelector('[data-list="years"]'), s = r.getFullYear();
665
- let i = "";
666
- for (let p = s - 50; p <= s + 50; p++)
667
- i += `<div class="drp-date-picker__rolling-item ${p === s ? "drp-date-picker__rolling-item--selected" : ""}" data-year="${p}" data-month-index="${t}">${p}</div>`;
668
- o && (o.innerHTML = i, (c = o.querySelector(".drp-date-picker__rolling-item--selected")) == null || c.scrollIntoView({ block: "center", inline: "nearest", behavior: "auto" }));
669
- const d = a == null ? void 0 : a.querySelector('[data-list="months"]'), l = r.getMonth();
670
- d && (d.innerHTML = e.monthNames.map((p, g) => `<div class="drp-date-picker__rolling-item ${g === l ? "drp-date-picker__rolling-item--selected" : ""}" data-month="${g}" data-month-index="${t}">${p}</div>`).join(""), (u = d.querySelector(".drp-date-picker__rolling-item--selected")) == null || u.scrollIntoView({ block: "center", inline: "nearest", behavior: "auto" }));
671
- }
672
- function Xt(e) {
673
- if (e.options.selectionMode !== "range") return;
674
- const t = e.calendar.querySelector(".drp-date-picker__summary");
675
- if (t)
676
- if (e.selectedStartDate && e.selectedEndDate) {
677
- let n, a, r, o, s;
678
- if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
679
- a = e.getEnabledDatesInRange(
680
- e.selectedStartDate,
681
- e.selectedEndDate
682
- ), n = a.length, o = a, e.options.disabledDatesHandling === "split" && (s = e.splitRangeByDisabled(
683
- e.selectedStartDate,
684
- e.selectedEndDate
685
- ));
686
- else if (e.options.disabledDatesHandling === "allow") {
687
- a = e.getEnabledDatesInRange(
688
- e.selectedStartDate,
689
- e.selectedEndDate
690
- ), r = e.getDisabledDatesInRange(
691
- e.selectedStartDate,
692
- e.selectedEndDate
693
- );
694
- const d = 1e3 * 60 * 60 * 24, l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
695
- n = Math.floor(l / d) + 1;
696
- } else {
697
- const l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
698
- n = Math.floor(l / 864e5) + 1;
699
- }
700
- const i = n > 0 ? n - 1 : 0;
701
- if (t.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
702
- const d = {
703
- days: n,
704
- nights: i,
705
- startDate: e.selectedStartDate,
706
- endDate: e.selectedEndDate,
707
- selectionMode: e.options.selectionMode,
708
- disabledDatesHandling: e.options.disabledDatesHandling,
709
- localeStrings: e.localeStrings,
710
- isPreview: !1
711
- };
712
- a && (d.enabledDates = a), r && (d.disabledDates = r), o && (d.dates = o), s && (d.dateRanges = s), t.innerHTML = e.options.formatSummaryCallback(d);
713
- } else
714
- t.innerHTML = `
715
- <span class="drp-date-picker__summary-count">${n} ${n === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
716
- <span>, </span>
717
- <span class="drp-date-picker__summary-count">${i} ${i === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
718
- `;
719
- } else
720
- t.className = "drp-date-picker__summary drp-date-picker__summary--hidden", t.innerHTML = "";
721
- }
722
- function st(e) {
723
- if (e.options.selectionMode !== "range") return;
724
- const t = e.calendar.querySelector(".drp-date-picker__summary");
725
- if (t && e.dragPreviewStart && e.dragPreviewEnd) {
726
- let n, a, r, o, s;
727
- if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
728
- a = e.getEnabledDatesInRange(
729
- e.dragPreviewStart,
730
- e.dragPreviewEnd
731
- ), n = a.length, o = a, e.options.disabledDatesHandling === "split" && (s = e.splitRangeByDisabled(
732
- e.dragPreviewStart,
733
- e.dragPreviewEnd
734
- ));
735
- else if (e.options.disabledDatesHandling === "allow") {
736
- a = e.getEnabledDatesInRange(
737
- e.dragPreviewStart,
738
- e.dragPreviewEnd
739
- ), r = e.getDisabledDatesInRange(
740
- e.dragPreviewStart,
741
- e.dragPreviewEnd
742
- );
743
- const d = 1e3 * 60 * 60 * 24, l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
744
- n = Math.floor(l / d) + 1;
745
- } else {
746
- const l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
747
- n = Math.floor(l / 864e5) + 1;
748
- }
749
- const i = n > 0 ? n - 1 : 0;
750
- if (t.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
751
- const d = {
752
- days: n,
753
- nights: i,
754
- startDate: e.dragPreviewStart,
755
- endDate: e.dragPreviewEnd,
756
- selectionMode: e.options.selectionMode,
757
- disabledDatesHandling: e.options.disabledDatesHandling,
758
- localeStrings: e.localeStrings,
759
- isPreview: !0
760
- };
761
- a && (d.enabledDates = a), r && (d.disabledDates = r), o && (d.dates = o), s && (d.dateRanges = s), t.innerHTML = e.options.formatSummaryCallback(d);
762
- } else
763
- t.innerHTML = `
764
- <span style="opacity: 0.7;">${e.localeStrings.preview}: </span>
765
- <span class="drp-date-picker__summary-count">${n} ${n === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
766
- <span>, </span>
767
- <span class="drp-date-picker__summary-count">${i} ${i === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
768
- `;
769
- }
770
- }
771
- function Gt(e) {
772
- if (e.calendar.querySelectorAll(".drp-date-picker__day--drag-preview, .drp-date-picker__day--drag-invalid").forEach((r) => {
773
- r.classList.remove("drp-date-picker__day--drag-preview", "drp-date-picker__day--drag-invalid");
774
- }), !e.dragPreviewStart || !e.dragPreviewEnd) return;
775
- const n = e.options.disabledDatesHandling === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd);
776
- e.calendar.querySelectorAll(".drp-date-picker__day").forEach((r) => {
777
- const o = r.dataset.date;
778
- if (!o) return;
779
- const [s, i, d] = o.split("-").map(Number), l = new Date(s, i, d);
780
- l >= e.dragPreviewStart && l <= e.dragPreviewEnd && (r.classList.add("drp-date-picker__day--drag-preview"), n && r.classList.add("drp-date-picker__day--drag-invalid"));
781
- }), st(e);
782
- }
783
- const ue = Math.min, ae = Math.max, we = Math.round, q = (e) => ({
784
- x: e,
785
- y: e
786
- }), Jt = {
787
- left: "right",
788
- right: "left",
789
- bottom: "top",
790
- top: "bottom"
791
- }, Qt = {
792
- start: "end",
793
- end: "start"
794
- };
795
- function ke(e, t, n) {
796
- return ae(e, ue(t, n));
797
- }
798
- function fe(e, t) {
799
- return typeof e == "function" ? e(t) : e;
800
- }
801
- function ne(e) {
802
- return e.split("-")[0];
803
- }
804
- function he(e) {
805
- return e.split("-")[1];
806
- }
807
- function ot(e) {
808
- return e === "x" ? "y" : "x";
809
- }
810
- function Fe(e) {
811
- return e === "y" ? "height" : "width";
812
- }
813
- const Zt = /* @__PURE__ */ new Set(["top", "bottom"]);
814
- function Q(e) {
815
- return Zt.has(ne(e)) ? "y" : "x";
816
- }
817
- function Ne(e) {
818
- return ot(Q(e));
819
- }
820
- function en(e, t, n) {
821
- n === void 0 && (n = !1);
822
- const a = he(e), r = Ne(e), o = Fe(r);
823
- let s = r === "x" ? a === (n ? "end" : "start") ? "right" : "left" : a === "start" ? "bottom" : "top";
824
- return t.reference[o] > t.floating[o] && (s = _e(s)), [s, _e(s)];
825
- }
826
- function tn(e) {
827
- const t = _e(e);
828
- return [Re(e), t, Re(t)];
829
- }
830
- function Re(e) {
831
- return e.replace(/start|end/g, (t) => Qt[t]);
832
- }
833
- const qe = ["left", "right"], Be = ["right", "left"], nn = ["top", "bottom"], an = ["bottom", "top"];
834
- function rn(e, t, n) {
835
- switch (e) {
836
- case "top":
837
- case "bottom":
838
- return n ? t ? Be : qe : t ? qe : Be;
839
- case "left":
840
- case "right":
841
- return t ? nn : an;
842
- default:
843
- return [];
844
- }
845
- }
846
- function sn(e, t, n, a) {
847
- const r = he(e);
848
- let o = rn(ne(e), n === "start", a);
849
- return r && (o = o.map((s) => s + "-" + r), t && (o = o.concat(o.map(Re)))), o;
850
- }
851
- function _e(e) {
852
- return e.replace(/left|right|bottom|top/g, (t) => Jt[t]);
853
- }
854
- function on(e) {
855
- return {
856
- top: 0,
857
- right: 0,
858
- bottom: 0,
859
- left: 0,
860
- ...e
861
- };
862
- }
863
- function it(e) {
864
- return typeof e != "number" ? on(e) : {
865
- top: e,
866
- right: e,
867
- bottom: e,
868
- left: e
869
- };
870
- }
871
- function xe(e) {
872
- const {
873
- x: t,
874
- y: n,
875
- width: a,
876
- height: r
877
- } = e;
878
- return {
879
- width: a,
880
- height: r,
881
- top: n,
882
- left: t,
883
- right: t + a,
884
- bottom: n + r,
885
- x: t,
886
- y: n
887
- };
888
- }
889
- function je(e, t, n) {
890
- let {
891
- reference: a,
892
- floating: r
893
- } = e;
894
- const o = Q(t), s = Ne(t), i = Fe(s), d = ne(t), l = o === "y", c = a.x + a.width / 2 - r.width / 2, u = a.y + a.height / 2 - r.height / 2, p = a[i] / 2 - r[i] / 2;
895
- let g;
896
- switch (d) {
897
- case "top":
898
- g = {
899
- x: c,
900
- y: a.y - r.height
901
- };
902
- break;
903
- case "bottom":
904
- g = {
905
- x: c,
906
- y: a.y + a.height
907
- };
908
- break;
909
- case "right":
910
- g = {
911
- x: a.x + a.width,
912
- y: u
913
- };
914
- break;
915
- case "left":
916
- g = {
917
- x: a.x - r.width,
918
- y: u
919
- };
920
- break;
921
- default:
922
- g = {
923
- x: a.x,
924
- y: a.y
925
- };
926
- }
927
- switch (he(t)) {
928
- case "start":
929
- g[s] -= p * (n && l ? -1 : 1);
930
- break;
931
- case "end":
932
- g[s] += p * (n && l ? -1 : 1);
933
- break;
934
- }
935
- return g;
936
- }
937
- const dn = async (e, t, n) => {
938
- const {
939
- placement: a = "bottom",
940
- strategy: r = "absolute",
941
- middleware: o = [],
942
- platform: s
943
- } = n, i = o.filter(Boolean), d = await (s.isRTL == null ? void 0 : s.isRTL(t));
944
- let l = await s.getElementRects({
945
- reference: e,
946
- floating: t,
947
- strategy: r
948
- }), {
949
- x: c,
950
- y: u
951
- } = je(l, a, d), p = a, g = {}, h = 0;
952
- for (let f = 0; f < i.length; f++) {
953
- const {
954
- name: y,
955
- fn: m
956
- } = i[f], {
957
- x,
958
- y: E,
959
- data: L,
960
- reset: b
961
- } = await m({
962
- x: c,
963
- y: u,
964
- initialPlacement: a,
965
- placement: p,
966
- strategy: r,
967
- middlewareData: g,
968
- rects: l,
969
- platform: s,
970
- elements: {
971
- reference: e,
972
- floating: t
973
- }
974
- });
975
- c = x ?? c, u = E ?? u, g = {
976
- ...g,
977
- [y]: {
978
- ...g[y],
979
- ...L
980
- }
981
- }, b && h <= 50 && (h++, typeof b == "object" && (b.placement && (p = b.placement), b.rects && (l = b.rects === !0 ? await s.getElementRects({
982
- reference: e,
983
- floating: t,
984
- strategy: r
985
- }) : b.rects), {
986
- x: c,
987
- y: u
988
- } = je(l, p, d)), f = -1);
989
- }
990
- return {
991
- x: c,
992
- y: u,
993
- placement: p,
994
- strategy: r,
995
- middlewareData: g
996
- };
997
- };
998
- async function dt(e, t) {
999
- var n;
1000
- t === void 0 && (t = {});
1001
- const {
1002
- x: a,
1003
- y: r,
1004
- platform: o,
1005
- rects: s,
1006
- elements: i,
1007
- strategy: d
1008
- } = e, {
1009
- boundary: l = "clippingAncestors",
1010
- rootBoundary: c = "viewport",
1011
- elementContext: u = "floating",
1012
- altBoundary: p = !1,
1013
- padding: g = 0
1014
- } = fe(t, e), h = it(g), y = i[p ? u === "floating" ? "reference" : "floating" : u], m = xe(await o.getClippingRect({
1015
- element: (n = await (o.isElement == null ? void 0 : o.isElement(y))) == null || n ? y : y.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(i.floating)),
1016
- boundary: l,
1017
- rootBoundary: c,
1018
- strategy: d
1019
- })), x = u === "floating" ? {
1020
- x: a,
1021
- y: r,
1022
- width: s.floating.width,
1023
- height: s.floating.height
1024
- } : s.reference, E = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(i.floating)), L = await (o.isElement == null ? void 0 : o.isElement(E)) ? await (o.getScale == null ? void 0 : o.getScale(E)) || {
1025
- x: 1,
1026
- y: 1
1027
- } : {
1028
- x: 1,
1029
- y: 1
1030
- }, b = xe(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
1031
- elements: i,
1032
- rect: x,
1033
- offsetParent: E,
1034
- strategy: d
1035
- }) : x);
1036
- return {
1037
- top: (m.top - b.top + h.top) / L.y,
1038
- bottom: (b.bottom - m.bottom + h.bottom) / L.y,
1039
- left: (m.left - b.left + h.left) / L.x,
1040
- right: (b.right - m.right + h.right) / L.x
1041
- };
1042
- }
1043
- const ln = (e) => ({
1044
- name: "arrow",
1045
- options: e,
1046
- async fn(t) {
1047
- const {
1048
- x: n,
1049
- y: a,
1050
- placement: r,
1051
- rects: o,
1052
- platform: s,
1053
- elements: i,
1054
- middlewareData: d
1055
- } = t, {
1056
- element: l,
1057
- padding: c = 0
1058
- } = fe(e, t) || {};
1059
- if (l == null)
1060
- return {};
1061
- const u = it(c), p = {
1062
- x: n,
1063
- y: a
1064
- }, g = Ne(r), h = Fe(g), f = await s.getDimensions(l), y = g === "y", m = y ? "top" : "left", x = y ? "bottom" : "right", E = y ? "clientHeight" : "clientWidth", L = o.reference[h] + o.reference[g] - p[g] - o.floating[h], b = p[g] - o.reference[g], S = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l));
1065
- let C = S ? S[E] : 0;
1066
- (!C || !await (s.isElement == null ? void 0 : s.isElement(S))) && (C = i.floating[E] || o.floating[h]);
1067
- const A = L / 2 - b / 2, w = C / 2 - f[h] / 2 - 1, D = ue(u[m], w), _ = ue(u[x], w), I = D, $ = C - f[h] - _, k = C / 2 - f[h] / 2 + A, W = ke(I, k, $), K = !d.arrow && he(r) != null && k !== W && o.reference[h] / 2 - (k < I ? D : _) - f[h] / 2 < 0, F = K ? k < I ? k - I : k - $ : 0;
1068
- return {
1069
- [g]: p[g] + F,
1070
- data: {
1071
- [g]: W,
1072
- centerOffset: k - W - F,
1073
- ...K && {
1074
- alignmentOffset: F
1075
- }
1076
- },
1077
- reset: K
1078
- };
1079
- }
1080
- }), cn = function(e) {
1081
- return e === void 0 && (e = {}), {
1082
- name: "flip",
1083
- options: e,
1084
- async fn(t) {
1085
- var n, a;
1086
- const {
1087
- placement: r,
1088
- middlewareData: o,
1089
- rects: s,
1090
- initialPlacement: i,
1091
- platform: d,
1092
- elements: l
1093
- } = t, {
1094
- mainAxis: c = !0,
1095
- crossAxis: u = !0,
1096
- fallbackPlacements: p,
1097
- fallbackStrategy: g = "bestFit",
1098
- fallbackAxisSideDirection: h = "none",
1099
- flipAlignment: f = !0,
1100
- ...y
1101
- } = fe(e, t);
1102
- if ((n = o.arrow) != null && n.alignmentOffset)
1103
- return {};
1104
- const m = ne(r), x = Q(i), E = ne(i) === i, L = await (d.isRTL == null ? void 0 : d.isRTL(l.floating)), b = p || (E || !f ? [_e(i)] : tn(i)), S = h !== "none";
1105
- !p && S && b.push(...sn(i, f, h, L));
1106
- const C = [i, ...b], A = await dt(t, y), w = [];
1107
- let D = ((a = o.flip) == null ? void 0 : a.overflows) || [];
1108
- if (c && w.push(A[m]), u) {
1109
- const k = en(r, s, L);
1110
- w.push(A[k[0]], A[k[1]]);
1111
- }
1112
- if (D = [...D, {
1113
- placement: r,
1114
- overflows: w
1115
- }], !w.every((k) => k <= 0)) {
1116
- var _, I;
1117
- const k = (((_ = o.flip) == null ? void 0 : _.index) || 0) + 1, W = C[k];
1118
- if (W && (!(u === "alignment" ? x !== Q(W) : !1) || // We leave the current main axis only if every placement on that axis
1119
- // overflows the main axis.
1120
- D.every((N) => Q(N.placement) === x ? N.overflows[0] > 0 : !0)))
1121
- return {
1122
- data: {
1123
- index: k,
1124
- overflows: D
1125
- },
1126
- reset: {
1127
- placement: W
1128
- }
1129
- };
1130
- let K = (I = D.filter((F) => F.overflows[0] <= 0).sort((F, N) => F.overflows[1] - N.overflows[1])[0]) == null ? void 0 : I.placement;
1131
- if (!K)
1132
- switch (g) {
1133
- case "bestFit": {
1134
- var $;
1135
- const F = ($ = D.filter((N) => {
1136
- if (S) {
1137
- const J = Q(N.placement);
1138
- return J === x || // Create a bias to the `y` side axis due to horizontal
1139
- // reading directions favoring greater width.
1140
- J === "y";
1141
- }
1142
- return !0;
1143
- }).map((N) => [N.placement, N.overflows.filter((J) => J > 0).reduce((J, Ct) => J + Ct, 0)]).sort((N, J) => N[1] - J[1])[0]) == null ? void 0 : $[0];
1144
- F && (K = F);
1145
- break;
1146
- }
1147
- case "initialPlacement":
1148
- K = i;
1149
- break;
1150
- }
1151
- if (r !== K)
1152
- return {
1153
- reset: {
1154
- placement: K
1155
- }
1156
- };
1157
- }
1158
- return {};
1159
- }
1160
- };
1161
- }, pn = /* @__PURE__ */ new Set(["left", "top"]);
1162
- async function un(e, t) {
1163
- const {
1164
- placement: n,
1165
- platform: a,
1166
- elements: r
1167
- } = e, o = await (a.isRTL == null ? void 0 : a.isRTL(r.floating)), s = ne(n), i = he(n), d = Q(n) === "y", l = pn.has(s) ? -1 : 1, c = o && d ? -1 : 1, u = fe(t, e);
1168
- let {
1169
- mainAxis: p,
1170
- crossAxis: g,
1171
- alignmentAxis: h
1172
- } = typeof u == "number" ? {
1173
- mainAxis: u,
1174
- crossAxis: 0,
1175
- alignmentAxis: null
1176
- } : {
1177
- mainAxis: u.mainAxis || 0,
1178
- crossAxis: u.crossAxis || 0,
1179
- alignmentAxis: u.alignmentAxis
1180
- };
1181
- return i && typeof h == "number" && (g = i === "end" ? h * -1 : h), d ? {
1182
- x: g * c,
1183
- y: p * l
1184
- } : {
1185
- x: p * l,
1186
- y: g * c
1187
- };
1188
- }
1189
- const gn = function(e) {
1190
- return e === void 0 && (e = 0), {
1191
- name: "offset",
1192
- options: e,
1193
- async fn(t) {
1194
- var n, a;
1195
- const {
1196
- x: r,
1197
- y: o,
1198
- placement: s,
1199
- middlewareData: i
1200
- } = t, d = await un(t, e);
1201
- return s === ((n = i.offset) == null ? void 0 : n.placement) && (a = i.arrow) != null && a.alignmentOffset ? {} : {
1202
- x: r + d.x,
1203
- y: o + d.y,
1204
- data: {
1205
- ...d,
1206
- placement: s
1207
- }
1208
- };
1209
- }
1210
- };
1211
- }, fn = function(e) {
1212
- return e === void 0 && (e = {}), {
1213
- name: "shift",
1214
- options: e,
1215
- async fn(t) {
1216
- const {
1217
- x: n,
1218
- y: a,
1219
- placement: r
1220
- } = t, {
1221
- mainAxis: o = !0,
1222
- crossAxis: s = !1,
1223
- limiter: i = {
1224
- fn: (y) => {
1225
- let {
1226
- x: m,
1227
- y: x
1228
- } = y;
1229
- return {
1230
- x: m,
1231
- y: x
1232
- };
1233
- }
1234
- },
1235
- ...d
1236
- } = fe(e, t), l = {
1237
- x: n,
1238
- y: a
1239
- }, c = await dt(t, d), u = Q(ne(r)), p = ot(u);
1240
- let g = l[p], h = l[u];
1241
- if (o) {
1242
- const y = p === "y" ? "top" : "left", m = p === "y" ? "bottom" : "right", x = g + c[y], E = g - c[m];
1243
- g = ke(x, g, E);
1244
- }
1245
- if (s) {
1246
- const y = u === "y" ? "top" : "left", m = u === "y" ? "bottom" : "right", x = h + c[y], E = h - c[m];
1247
- h = ke(x, h, E);
1248
- }
1249
- const f = i.fn({
1250
- ...t,
1251
- [p]: g,
1252
- [u]: h
1253
- });
1254
- return {
1255
- ...f,
1256
- data: {
1257
- x: f.x - n,
1258
- y: f.y - a,
1259
- enabled: {
1260
- [p]: o,
1261
- [u]: s
1262
- }
1263
- }
1264
- };
1265
- }
1266
- };
1267
- };
1268
- function Ie() {
1269
- return typeof window < "u";
1270
- }
1271
- function ie(e) {
1272
- return lt(e) ? (e.nodeName || "").toLowerCase() : "#document";
1273
- }
1274
- function T(e) {
1275
- var t;
1276
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1277
- }
1278
- function G(e) {
1279
- var t;
1280
- return (t = (lt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1281
- }
1282
- function lt(e) {
1283
- return Ie() ? e instanceof Node || e instanceof T(e).Node : !1;
1284
- }
1285
- function O(e) {
1286
- return Ie() ? e instanceof Element || e instanceof T(e).Element : !1;
1287
- }
1288
- function B(e) {
1289
- return Ie() ? e instanceof HTMLElement || e instanceof T(e).HTMLElement : !1;
1290
- }
1291
- function We(e) {
1292
- return !Ie() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof T(e).ShadowRoot;
1293
- }
1294
- const hn = /* @__PURE__ */ new Set(["inline", "contents"]);
1295
- function me(e) {
1296
- const {
1297
- overflow: t,
1298
- overflowX: n,
1299
- overflowY: a,
1300
- display: r
1301
- } = H(e);
1302
- return /auto|scroll|overlay|hidden|clip/.test(t + a + n) && !hn.has(r);
1303
- }
1304
- const mn = /* @__PURE__ */ new Set(["table", "td", "th"]);
1305
- function yn(e) {
1306
- return mn.has(ie(e));
1307
- }
1308
- const vn = [":popover-open", ":modal"];
1309
- function Me(e) {
1310
- return vn.some((t) => {
1311
- try {
1312
- return e.matches(t);
1313
- } catch {
1314
- return !1;
1315
- }
1316
- });
1317
- }
1318
- const bn = ["transform", "translate", "scale", "rotate", "perspective"], Dn = ["transform", "translate", "scale", "rotate", "perspective", "filter"], wn = ["paint", "layout", "strict", "content"];
1319
- function Oe(e) {
1320
- const t = He(), n = O(e) ? H(e) : e;
1321
- return bn.some((a) => n[a] ? n[a] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || Dn.some((a) => (n.willChange || "").includes(a)) || wn.some((a) => (n.contain || "").includes(a));
1322
- }
1323
- function _n(e) {
1324
- let t = ee(e);
1325
- for (; B(t) && !se(t); ) {
1326
- if (Oe(t))
1327
- return t;
1328
- if (Me(t))
1329
- return null;
1330
- t = ee(t);
1331
- }
1332
- return null;
1333
- }
1334
- function He() {
1335
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1336
- }
1337
- const xn = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1338
- function se(e) {
1339
- return xn.has(ie(e));
1340
- }
1341
- function H(e) {
1342
- return T(e).getComputedStyle(e);
1343
- }
1344
- function Ee(e) {
1345
- return O(e) ? {
1346
- scrollLeft: e.scrollLeft,
1347
- scrollTop: e.scrollTop
1348
- } : {
1349
- scrollLeft: e.scrollX,
1350
- scrollTop: e.scrollY
1351
- };
1352
- }
1353
- function ee(e) {
1354
- if (ie(e) === "html")
1355
- return e;
1356
- const t = (
1357
- // Step into the shadow DOM of the parent of a slotted node.
1358
- e.assignedSlot || // DOM Element detected.
1359
- e.parentNode || // ShadowRoot detected.
1360
- We(e) && e.host || // Fallback.
1361
- G(e)
1362
- );
1363
- return We(t) ? t.host : t;
1364
- }
1365
- function ct(e) {
1366
- const t = ee(e);
1367
- return se(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : B(t) && me(t) ? t : ct(t);
1368
- }
1369
- function pt(e, t, n) {
1370
- var a;
1371
- t === void 0 && (t = []);
1372
- const r = ct(e), o = r === ((a = e.ownerDocument) == null ? void 0 : a.body), s = T(r);
1373
- return o ? ($e(s), t.concat(s, s.visualViewport || [], me(r) ? r : [], [])) : t.concat(r, pt(r, []));
1374
- }
1375
- function $e(e) {
1376
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1377
- }
1378
- function ut(e) {
1379
- const t = H(e);
1380
- let n = parseFloat(t.width) || 0, a = parseFloat(t.height) || 0;
1381
- const r = B(e), o = r ? e.offsetWidth : n, s = r ? e.offsetHeight : a, i = we(n) !== o || we(a) !== s;
1382
- return i && (n = o, a = s), {
1383
- width: n,
1384
- height: a,
1385
- $: i
1386
- };
1387
- }
1388
- function gt(e) {
1389
- return O(e) ? e : e.contextElement;
1390
- }
1391
- function re(e) {
1392
- const t = gt(e);
1393
- if (!B(t))
1394
- return q(1);
1395
- const n = t.getBoundingClientRect(), {
1396
- width: a,
1397
- height: r,
1398
- $: o
1399
- } = ut(t);
1400
- let s = (o ? we(n.width) : n.width) / a, i = (o ? we(n.height) : n.height) / r;
1401
- return (!s || !Number.isFinite(s)) && (s = 1), (!i || !Number.isFinite(i)) && (i = 1), {
1402
- x: s,
1403
- y: i
1404
- };
1405
- }
1406
- const Sn = /* @__PURE__ */ q(0);
1407
- function ft(e) {
1408
- const t = T(e);
1409
- return !He() || !t.visualViewport ? Sn : {
1410
- x: t.visualViewport.offsetLeft,
1411
- y: t.visualViewport.offsetTop
1412
- };
1413
- }
1414
- function In(e, t, n) {
1415
- return t === void 0 && (t = !1), !n || t && n !== T(e) ? !1 : t;
1416
- }
1417
- function ge(e, t, n, a) {
1418
- t === void 0 && (t = !1), n === void 0 && (n = !1);
1419
- const r = e.getBoundingClientRect(), o = gt(e);
1420
- let s = q(1);
1421
- t && (a ? O(a) && (s = re(a)) : s = re(e));
1422
- const i = In(o, n, a) ? ft(o) : q(0);
1423
- let d = (r.left + i.x) / s.x, l = (r.top + i.y) / s.y, c = r.width / s.x, u = r.height / s.y;
1424
- if (o) {
1425
- const p = T(o), g = a && O(a) ? T(a) : a;
1426
- let h = p, f = $e(h);
1427
- for (; f && a && g !== h; ) {
1428
- const y = re(f), m = f.getBoundingClientRect(), x = H(f), E = m.left + (f.clientLeft + parseFloat(x.paddingLeft)) * y.x, L = m.top + (f.clientTop + parseFloat(x.paddingTop)) * y.y;
1429
- d *= y.x, l *= y.y, c *= y.x, u *= y.y, d += E, l += L, h = T(f), f = $e(h);
1430
- }
1431
- }
1432
- return xe({
1433
- width: c,
1434
- height: u,
1435
- x: d,
1436
- y: l
1437
- });
1438
- }
1439
- function Le(e, t) {
1440
- const n = Ee(e).scrollLeft;
1441
- return t ? t.left + n : ge(G(e)).left + n;
1442
- }
1443
- function ht(e, t) {
1444
- const n = e.getBoundingClientRect(), a = n.left + t.scrollLeft - Le(e, n), r = n.top + t.scrollTop;
1445
- return {
1446
- x: a,
1447
- y: r
1448
- };
1449
- }
1450
- function Mn(e) {
1451
- let {
1452
- elements: t,
1453
- rect: n,
1454
- offsetParent: a,
1455
- strategy: r
1456
- } = e;
1457
- const o = r === "fixed", s = G(a), i = t ? Me(t.floating) : !1;
1458
- if (a === s || i && o)
1459
- return n;
1460
- let d = {
1461
- scrollLeft: 0,
1462
- scrollTop: 0
1463
- }, l = q(1);
1464
- const c = q(0), u = B(a);
1465
- if ((u || !u && !o) && ((ie(a) !== "body" || me(s)) && (d = Ee(a)), B(a))) {
1466
- const g = ge(a);
1467
- l = re(a), c.x = g.x + a.clientLeft, c.y = g.y + a.clientTop;
1468
- }
1469
- const p = s && !u && !o ? ht(s, d) : q(0);
1470
- return {
1471
- width: n.width * l.x,
1472
- height: n.height * l.y,
1473
- x: n.x * l.x - d.scrollLeft * l.x + c.x + p.x,
1474
- y: n.y * l.y - d.scrollTop * l.y + c.y + p.y
1475
- };
1476
- }
1477
- function En(e) {
1478
- return Array.from(e.getClientRects());
1479
- }
1480
- function Ln(e) {
1481
- const t = G(e), n = Ee(e), a = e.ownerDocument.body, r = ae(t.scrollWidth, t.clientWidth, a.scrollWidth, a.clientWidth), o = ae(t.scrollHeight, t.clientHeight, a.scrollHeight, a.clientHeight);
1482
- let s = -n.scrollLeft + Le(e);
1483
- const i = -n.scrollTop;
1484
- return H(a).direction === "rtl" && (s += ae(t.clientWidth, a.clientWidth) - r), {
1485
- width: r,
1486
- height: o,
1487
- x: s,
1488
- y: i
1489
- };
1490
- }
1491
- const Ke = 25;
1492
- function Cn(e, t) {
1493
- const n = T(e), a = G(e), r = n.visualViewport;
1494
- let o = a.clientWidth, s = a.clientHeight, i = 0, d = 0;
1495
- if (r) {
1496
- o = r.width, s = r.height;
1497
- const c = He();
1498
- (!c || c && t === "fixed") && (i = r.offsetLeft, d = r.offsetTop);
1499
- }
1500
- const l = Le(a);
1501
- if (l <= 0) {
1502
- const c = a.ownerDocument, u = c.body, p = getComputedStyle(u), g = c.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, h = Math.abs(a.clientWidth - u.clientWidth - g);
1503
- h <= Ke && (o -= h);
1504
- } else l <= Ke && (o += l);
1505
- return {
1506
- width: o,
1507
- height: s,
1508
- x: i,
1509
- y: d
1510
- };
1511
- }
1512
- const An = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1513
- function kn(e, t) {
1514
- const n = ge(e, !0, t === "fixed"), a = n.top + e.clientTop, r = n.left + e.clientLeft, o = B(e) ? re(e) : q(1), s = e.clientWidth * o.x, i = e.clientHeight * o.y, d = r * o.x, l = a * o.y;
1515
- return {
1516
- width: s,
1517
- height: i,
1518
- x: d,
1519
- y: l
1520
- };
1521
- }
1522
- function Ue(e, t, n) {
1523
- let a;
1524
- if (t === "viewport")
1525
- a = Cn(e, n);
1526
- else if (t === "document")
1527
- a = Ln(G(e));
1528
- else if (O(t))
1529
- a = kn(t, n);
1530
- else {
1531
- const r = ft(e);
1532
- a = {
1533
- x: t.x - r.x,
1534
- y: t.y - r.y,
1535
- width: t.width,
1536
- height: t.height
1537
- };
1538
- }
1539
- return xe(a);
1540
- }
1541
- function mt(e, t) {
1542
- const n = ee(e);
1543
- return n === t || !O(n) || se(n) ? !1 : H(n).position === "fixed" || mt(n, t);
1544
- }
1545
- function Rn(e, t) {
1546
- const n = t.get(e);
1547
- if (n)
1548
- return n;
1549
- let a = pt(e, []).filter((i) => O(i) && ie(i) !== "body"), r = null;
1550
- const o = H(e).position === "fixed";
1551
- let s = o ? ee(e) : e;
1552
- for (; O(s) && !se(s); ) {
1553
- const i = H(s), d = Oe(s);
1554
- !d && i.position === "fixed" && (r = null), (o ? !d && !r : !d && i.position === "static" && !!r && An.has(r.position) || me(s) && !d && mt(e, s)) ? a = a.filter((c) => c !== s) : r = i, s = ee(s);
1555
- }
1556
- return t.set(e, a), a;
1557
- }
1558
- function $n(e) {
1559
- let {
1560
- element: t,
1561
- boundary: n,
1562
- rootBoundary: a,
1563
- strategy: r
1564
- } = e;
1565
- const s = [...n === "clippingAncestors" ? Me(t) ? [] : Rn(t, this._c) : [].concat(n), a], i = s[0], d = s.reduce((l, c) => {
1566
- const u = Ue(t, c, r);
1567
- return l.top = ae(u.top, l.top), l.right = ue(u.right, l.right), l.bottom = ue(u.bottom, l.bottom), l.left = ae(u.left, l.left), l;
1568
- }, Ue(t, i, r));
1569
- return {
1570
- width: d.right - d.left,
1571
- height: d.bottom - d.top,
1572
- x: d.left,
1573
- y: d.top
1574
- };
1575
- }
1576
- function Pn(e) {
1577
- const {
1578
- width: t,
1579
- height: n
1580
- } = ut(e);
1581
- return {
1582
- width: t,
1583
- height: n
1584
- };
1585
- }
1586
- function Tn(e, t, n) {
1587
- const a = B(t), r = G(t), o = n === "fixed", s = ge(e, !0, o, t);
1588
- let i = {
1589
- scrollLeft: 0,
1590
- scrollTop: 0
1591
- };
1592
- const d = q(0);
1593
- function l() {
1594
- d.x = Le(r);
1595
- }
1596
- if (a || !a && !o)
1597
- if ((ie(t) !== "body" || me(r)) && (i = Ee(t)), a) {
1598
- const g = ge(t, !0, o, t);
1599
- d.x = g.x + t.clientLeft, d.y = g.y + t.clientTop;
1600
- } else r && l();
1601
- o && !a && r && l();
1602
- const c = r && !a && !o ? ht(r, i) : q(0), u = s.left + i.scrollLeft - d.x - c.x, p = s.top + i.scrollTop - d.y - c.y;
1603
- return {
1604
- x: u,
1605
- y: p,
1606
- width: s.width,
1607
- height: s.height
1608
- };
1609
- }
1610
- function Ae(e) {
1611
- return H(e).position === "static";
1612
- }
1613
- function Xe(e, t) {
1614
- if (!B(e) || H(e).position === "fixed")
1615
- return null;
1616
- if (t)
1617
- return t(e);
1618
- let n = e.offsetParent;
1619
- return G(e) === n && (n = n.ownerDocument.body), n;
1620
- }
1621
- function yt(e, t) {
1622
- const n = T(e);
1623
- if (Me(e))
1624
- return n;
1625
- if (!B(e)) {
1626
- let r = ee(e);
1627
- for (; r && !se(r); ) {
1628
- if (O(r) && !Ae(r))
1629
- return r;
1630
- r = ee(r);
1631
- }
1632
- return n;
1633
- }
1634
- let a = Xe(e, t);
1635
- for (; a && yn(a) && Ae(a); )
1636
- a = Xe(a, t);
1637
- return a && se(a) && Ae(a) && !Oe(a) ? n : a || _n(e) || n;
1638
- }
1639
- const zn = async function(e) {
1640
- const t = this.getOffsetParent || yt, n = this.getDimensions, a = await n(e.floating);
1641
- return {
1642
- reference: Tn(e.reference, await t(e.floating), e.strategy),
1643
- floating: {
1644
- x: 0,
1645
- y: 0,
1646
- width: a.width,
1647
- height: a.height
1648
- }
1649
- };
1650
- };
1651
- function Fn(e) {
1652
- return H(e).direction === "rtl";
1653
- }
1654
- const Nn = {
1655
- convertOffsetParentRelativeRectToViewportRelativeRect: Mn,
1656
- getDocumentElement: G,
1657
- getClippingRect: $n,
1658
- getOffsetParent: yt,
1659
- getElementRects: zn,
1660
- getClientRects: En,
1661
- getDimensions: Pn,
1662
- getScale: re,
1663
- isElement: O,
1664
- isRTL: Fn
1665
- }, Pe = gn, Te = fn, vt = cn, On = ln, bt = (e, t, n) => {
1666
- const a = /* @__PURE__ */ new Map(), r = {
1667
- platform: Nn,
1668
- ...n
1669
- }, o = {
1670
- ...r.platform,
1671
- _c: a
1672
- };
1673
- return dn(e, t, {
1674
- ...r,
1675
- platform: o
1676
- });
1677
- };
1678
- function Dt(e) {
1679
- e.options.positioningMode !== "inline" && (Y.debug("show() - adding visible class"), e.isFirstRender && (e.renderCalendar(), e.isFirstRender = !1), e.calendar.classList.add("drp-date-picker--visible"), e.isCalendarActive = !0, Y.debug("show() - calendar classes:", e.calendar.className), _t(e), setTimeout(() => {
1680
- const t = window.getComputedStyle(e.calendar);
1681
- Y.debug("show() - computed styles - display:", t.display, "position:", t.position, "left:", t.left, "top:", t.top, "z-index:", t.zIndex);
1682
- }, 100));
1683
- }
1684
- function wt(e) {
1685
- if (e.options.positioningMode !== "inline" && e.calendar.classList.contains("drp-date-picker--visible")) {
1686
- e.calendar.classList.remove("drp-date-picker--visible"), e.isCalendarActive = !1;
1687
- for (let t = 0; t < e.showingRollingSelector.length; t++)
1688
- e.showingRollingSelector[t] = !1;
1689
- e.isFirstRender || e.renderCalendar(), e.lockedPlacement = void 0;
1690
- }
1691
- }
1692
- function Hn(e) {
1693
- e.calendar.classList.contains("drp-date-picker--visible") ? wt(e) : Dt(e);
1694
- }
1695
- async function _t(e) {
1696
- if (Y.debug("position() - locked placement:", e.lockedPlacement), !e.input) return;
1697
- const t = e.lockedPlacement ? [Pe(8), Te({ padding: 8 })] : [Pe(8), vt(), Te({ padding: 8 })], n = await bt(e.input, e.calendar, {
1698
- placement: e.lockedPlacement || e.options.calendarPlacement,
1699
- middleware: t
1700
- });
1701
- Y.debug("position() - FloatingUI computed - x:", n.x, "y:", n.y, "placement:", n.placement), e.lockedPlacement || (e.lockedPlacement = n.placement, Y.debug("position() - locked placement to:", e.lockedPlacement)), e.calendar.style.left = `${n.x}px`, e.calendar.style.top = `${n.y}px`, Y.debug("position() - applied styles to calendar");
1702
- }
1703
- async function Vn(e, t, n) {
1704
- if (!e.tooltip || !e.tooltipArrow) return;
1705
- e.currentTooltipTarget = t, e.tooltip.textContent = n, e.tooltip.appendChild(e.tooltipArrow), e.tooltip.classList.add("drp-date-picker__tooltip--visible");
1706
- const { x: a, y: r, placement: o, middlewareData: s } = await bt(t, e.tooltip, {
1707
- placement: "top",
1708
- middleware: [
1709
- Pe(6),
1710
- vt(),
1711
- Te({ padding: 5 }),
1712
- On({ element: e.tooltipArrow })
1713
- ]
1714
- });
1715
- if (Object.assign(e.tooltip.style, {
1716
- left: `${a}px`,
1717
- top: `${r}px`
1718
- }), s.arrow) {
1719
- const { x: i, y: d } = s.arrow, l = {
1720
- top: "bottom",
1721
- right: "left",
1722
- bottom: "top",
1723
- left: "right"
1724
- }[o.split("-")[0]];
1725
- Object.assign(e.tooltipArrow.style, {
1726
- left: i != null ? `${i}px` : "",
1727
- top: d != null ? `${d}px` : "",
1728
- right: "",
1729
- bottom: "",
1730
- [l]: "-4px"
1731
- });
1732
- }
1733
- }
1734
- function Yn(e) {
1735
- e.tooltip && (e.tooltip.classList.remove("drp-date-picker__tooltip--visible"), e.currentTooltipTarget = void 0);
1736
- }
1737
- function qn(e) {
1738
- if (e.loadingOverlay) return;
1739
- const t = document.createElement("div");
1740
- t.className = "drp-date-picker__loading-overlay", t.innerHTML = `
1741
- <div class="drp-date-picker__loading-spinner"></div>
1742
- `, e.calendar.appendChild(t), e.loadingOverlay = t;
1743
- }
1744
- function Ge(e) {
1745
- e.loadingOverlay && (e.loadingOverlay.remove(), e.loadingOverlay = void 0);
1746
- }
1747
- async function xt(e, t, n) {
1748
- if (U.debug(" validateRangeAsync called - mode:", e.options.disabledDatesHandling, "start:", t, "end:", n), e.options.disabledDatesHandling === "prevent") {
1749
- if (U.debug(" Checking PREVENT mode"), e.hasDisabledDatesInRange(t, n))
1750
- return U.debug(" PREVENT mode - range contains disabled dates"), { isValid: !1, message: "Range contains disabled dates" };
1751
- } else if (e.options.disabledDatesHandling === "block" && (U.debug(" Checking BLOCK mode"), e.hasDisabledDatesInRange(t, n))) {
1752
- U.debug(" BLOCK mode - range contains disabled dates, adjusting");
1753
- const a = e.findLastEnabledBeforeGap(t, n);
1754
- return U.debug(" BLOCK mode - adjusted end:", a), { isValid: !0, adjustedStart: t, adjustedEnd: a };
1755
- }
1756
- if (e.options.validateRangeCallback)
1757
- try {
1758
- e.isValidating = !0, qn(e);
1759
- const a = await e.options.validateRangeCallback(t, n);
1760
- switch (Ge(e), e.isValidating = !1, a.action) {
1761
- case "accept":
1762
- return { isValid: !0 };
1763
- case "adjust":
1764
- return a.adjustedStartDate && a.adjustedEndDate ? {
1765
- isValid: !0,
1766
- adjustedStart: a.adjustedStartDate,
1767
- adjustedEnd: a.adjustedEndDate,
1768
- message: a.message
1769
- } : { isValid: !1, message: a.message || "Invalid adjustment" };
1770
- case "restore":
1771
- return { isValid: !1, message: a.message };
1772
- case "clear":
1773
- return e.clearSelection(), { isValid: !1, message: a.message };
1774
- default:
1775
- return { isValid: !1, message: "Unknown validation action" };
1776
- }
1777
- } catch (a) {
1778
- return Ge(e), e.isValidating = !1, R.error("validateRangeAsync() - async validation error:", a), { isValid: !1, message: "Validation error occurred" };
1779
- }
1780
- return { isValid: !0 };
1781
- }
1782
- async function Bn(e, t) {
1783
- if (t.classList.contains("drp-date-picker__day--disabled")) return;
1784
- if (!t.dataset || !t.dataset.date) {
1785
- R.warn("selectDay() - called with invalid element:", t);
1786
- return;
1787
- }
1788
- const [n, a, r] = t.dataset.date.split("-").map(Number), o = new Date(n, a, r);
1789
- t.classList.contains("drp-date-picker__day--other-month");
1790
- const s = t.closest(".drp-date-picker__days");
1791
- if (s && s instanceof HTMLElement) {
1792
- e.activeMonthIndex = parseInt(s.dataset.monthIndex || "0") || 0, te.debug(`Col${e.activeMonthIndex} selectDay - activeMonthIndex:`, e.activeMonthIndex);
1793
- const i = s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
1794
- e.focusedDayIndex = Array.from(i).indexOf(t), te.debug(`Col${e.activeMonthIndex} selectDay - set focusedDayIndex to:`, e.focusedDayIndex);
1795
- }
1796
- if (e.options.selectionMode === "single")
1797
- e.selectedDate = o, e.input && (e.input.value = e.formatDate(o)), e.options.onSelect && e.options.onSelect(o), e.options.positioningMode === "floating" && e.hide();
1798
- else if (!e.selectedStartDate || e.selectedEndDate)
1799
- e.selectedStartDate = o, e.selectedEndDate = null, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ...`);
1800
- else {
1801
- let i = e.selectedStartDate, d = o;
1802
- o < e.selectedStartDate && (d = e.selectedStartDate, i = o), te.debug(" selectDay - calling validateRangeAsync with:", i, d);
1803
- const l = await xt(e, i, d);
1804
- if (te.debug(" selectDay - validation result:", l), !l.isValid) {
1805
- l.message && R.warn("selectDay() - range validation failed:", l.message), e.renderCalendar(), e.updateSummary();
1806
- return;
1807
- }
1808
- e.selectedStartDate = l.adjustedStart || i, e.selectedEndDate = l.adjustedEnd || d, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`), e.options.onSelect && e.options.onSelect({ start: e.selectedStartDate, end: e.selectedEndDate });
1809
- }
1810
- if (e.renderCalendar(), e.updateSummary(), e.options.selectionMode === "range" && e.selectedEndDate) {
1811
- const i = e.selectedEndDate;
1812
- for (let d = 0; d < e.monthDates.length; d++) {
1813
- const l = e.monthDates[d];
1814
- if (i.getFullYear() === l.getFullYear() && i.getMonth() === l.getMonth()) {
1815
- e.activeMonthIndex = d;
1816
- const c = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${d}"]`);
1817
- if (c) {
1818
- const u = c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = Array.from(u).findIndex((g) => {
1819
- const h = g.dataset.date;
1820
- if (!h) return !1;
1821
- const [f, y, m] = h.split("-").map(Number), x = new Date(f, y, m);
1822
- return e.isSameDay(x, i);
1823
- });
1824
- p !== -1 && (e.focusedDayIndex = p, u.forEach((g) => g.classList.remove("drp-date-picker__day--focused")), u[p] && u[p].classList.add("drp-date-picker__day--focused"));
1825
- }
1826
- break;
1827
- }
1828
- }
1829
- }
1830
- }
1831
- function jn(e) {
1832
- e.monthDates[e.activeMonthIndex] = /* @__PURE__ */ new Date(), e.selectedDate = /* @__PURE__ */ new Date(), e.input && (e.input.value = e.formatDate(e.selectedDate)), e.options.onSelect && e.options.onSelect(e.selectedDate), e.renderCalendar(), e.options.selectionMode === "single" && e.hide();
1833
- }
1834
- function Wn(e) {
1835
- e.selectedDate = null, e.selectedStartDate = null, e.selectedEndDate = null, e.input && (e.input.value = ""), e.renderCalendar(), e.updateSummary();
1836
- }
1837
- function Kn(e) {
1838
- e.selectedStartDate && e.selectedEndDate && e.hide();
1839
- }
1840
- function Un(e) {
1841
- e.options.selectionMode === "range" && e.calendar.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--disabled):not(.drp-date-picker__day--other-month)").forEach((n) => {
1842
- n.addEventListener("mousedown", (a) => {
1843
- const r = a, o = n, s = r.clientX, i = r.clientY, d = 5;
1844
- let l = !1, c = !1;
1845
- const u = o.classList.contains("drp-date-picker__day--range-start"), p = o.classList.contains("drp-date-picker__day--range-end");
1846
- let g;
1847
- u && e.selectedStartDate && e.selectedEndDate ? g = "start" : p && e.selectedStartDate && e.selectedEndDate ? g = "end" : g = "start";
1848
- const h = (y) => {
1849
- const m = Math.abs(y.clientX - s), x = Math.abs(y.clientY - i);
1850
- !l && (m > d || x > d) && (l = !0), l && !c && (c = !0, St(e, r, g, o), document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", f));
1851
- }, f = () => {
1852
- document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", f);
1853
- };
1854
- document.addEventListener("mousemove", h), document.addEventListener("mouseup", f);
1855
- });
1856
- });
1857
- }
1858
- function St(e, t, n, a) {
1859
- t.preventDefault(), t.stopPropagation(), e.isDragging = !0, e.draggingType = n;
1860
- const r = a, o = r.dataset.date;
1861
- let s = null;
1862
- if (o) {
1863
- const [i, d, l] = o.split("-").map(Number);
1864
- s = new Date(i, d, l);
1865
- }
1866
- !e.selectedStartDate && !e.selectedEndDate ? s && (e.originalStartDate = s, e.originalEndDate = null, e.draggingType = "end") : s && e.selectedStartDate && !e.selectedEndDate ? s.getTime() === e.selectedStartDate.getTime() ? (e.originalStartDate = new Date(e.selectedStartDate), e.originalEndDate = null) : (e.selectedStartDate = null, e.selectedEndDate = null, e.originalStartDate = s, e.originalEndDate = null, e.draggingType = "end") : (e.selectedStartDate && (e.originalStartDate = new Date(e.selectedStartDate)), e.selectedEndDate && (e.originalEndDate = new Date(e.selectedEndDate))), r.classList.add("drp-date-picker__day--dragging"), z.debug(`Started dragging ${n} date`), e.onDragMoveBound = (i) => It(e, i), e.onDragEndBound = async (i) => await Mt(e), document.addEventListener("mousemove", e.onDragMoveBound), document.addEventListener("mouseup", e.onDragEndBound), document.body.style.cursor = "grabbing";
1867
- }
1868
- function It(e, t) {
1869
- if (!e.isDragging) return;
1870
- let n = null;
1871
- e.containerElement instanceof ShadowRoot && "elementsFromPoint" in e.containerElement ? n = e.containerElement.elementsFromPoint(t.clientX, t.clientY)[0] || null : n = document.elementFromPoint(t.clientX, t.clientY);
1872
- const a = n == null ? void 0 : n.closest(".drp-date-picker__nav--prev"), r = n == null ? void 0 : n.closest(".drp-date-picker__nav--next");
1873
- if (a || r) {
1874
- if (!e.navInterval) {
1875
- const p = (a || r).closest(".drp-date-picker__month");
1876
- if (p && p instanceof HTMLElement) {
1877
- const g = parseInt(p.dataset.monthIndex || "0"), h = !!a;
1878
- h ? e.prevMonth(g) : e.nextMonth(g), e.navInterval = window.setInterval(() => {
1879
- h ? e.prevMonth(g) : e.nextMonth(g);
1880
- }, 1e3);
1881
- }
1882
- }
1883
- return;
1884
- } else
1885
- e.navInterval && (clearInterval(e.navInterval), e.navInterval = null);
1886
- const o = n;
1887
- if (!o || !o.classList.contains("drp-date-picker__day")) return;
1888
- const s = o.dataset.date;
1889
- if (!s) return;
1890
- const [i, d, l] = s.split("-").map(Number);
1891
- let c = new Date(i, d, l);
1892
- if (o.classList.contains("drp-date-picker__day--disabled")) {
1893
- const u = e.draggingType === "start" ? e.originalEndDate && c > e.originalEndDate ? "backward" : "forward" : e.originalStartDate && c < e.originalStartDate ? "forward" : "backward";
1894
- c = Se(e, c, u);
1895
- }
1896
- if (e.draggingType === "start" && e.originalEndDate ? (e.dragPreviewStart = c, e.dragPreviewEnd = e.originalEndDate, e.dragPreviewStart > e.dragPreviewEnd && ([e.dragPreviewStart, e.dragPreviewEnd] = [e.dragPreviewEnd, e.dragPreviewStart], e.draggingType = "end")) : e.originalStartDate && (e.dragPreviewStart = e.originalStartDate, e.dragPreviewEnd = c, e.dragPreviewEnd < e.dragPreviewStart && ([e.dragPreviewStart, e.dragPreviewEnd] = [e.dragPreviewEnd, e.dragPreviewStart], e.draggingType = "start")), e.dragPreviewStart && e.dragPreviewEnd) {
1897
- const u = e.options.disabledDatesHandling;
1898
- if (z.debug("onDragMove - mode:", u, "start:", e.dragPreviewStart, "end:", e.dragPreviewEnd), u === "prevent" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
1899
- z.debug("PREVENT mode - range contains disabled dates, blocking preview update");
1900
- return;
1901
- } else if (u === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
1902
- if (z.debug("BLOCK mode - range contains disabled dates, adjusting preview"), e.draggingType === "start" && e.originalEndDate) {
1903
- const p = e.findLastEnabledBeforeGap(e.dragPreviewStart, e.originalEndDate);
1904
- z.debug("BLOCK mode - adjusted end (dragging start):", p), e.dragPreviewEnd = p;
1905
- } else if (e.originalStartDate) {
1906
- const p = e.findLastEnabledBeforeGap(e.originalStartDate, e.dragPreviewEnd);
1907
- z.debug("BLOCK mode - adjusted end (dragging end):", p), e.dragPreviewEnd = p;
1908
- }
1909
- }
1910
- }
1911
- e.updateDragPreview();
1912
- }
1913
- async function Mt(e, t) {
1914
- if (e.isDragging) {
1915
- if (z.debug("Ended dragging, finalizing selection"), e.dragPreviewStart && e.dragPreviewEnd) {
1916
- let n = Se(e, e.dragPreviewStart, "forward"), a = Se(e, e.dragPreviewEnd, "backward");
1917
- n > a && ([n, a] = [a, n]), z.debug("onDragEnd - calling validateRangeAsync with:", n, a);
1918
- const r = await xt(e, n, a);
1919
- z.debug("onDragEnd - validation result:", r), r.isValid ? (e.selectedStartDate = r.adjustedStart || n, e.selectedEndDate = r.adjustedEnd || a, e.input && (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`), e.options.onSelect && e.options.onSelect({ start: e.selectedStartDate, end: e.selectedEndDate })) : r.message && R.warn("onDragEnd() - drag validation failed:", r.message);
1920
- }
1921
- if (e.isDragging = !1, e.draggingType = null, e.dragPreviewStart = null, e.dragPreviewEnd = null, e.calendar.querySelectorAll(".drp-date-picker__day--dragging").forEach((n) => {
1922
- n.classList.remove("drp-date-picker__day--dragging");
1923
- }), e.onDragMoveBound && document.removeEventListener("mousemove", e.onDragMoveBound), e.onDragEndBound && document.removeEventListener("mouseup", e.onDragEndBound), e.navInterval && (clearInterval(e.navInterval), e.navInterval = null), document.body.style.cursor = "", e.renderCalendar(), e.updateSummary(), e.selectedEndDate) {
1924
- const n = e.selectedEndDate;
1925
- for (let a = 0; a < e.monthDates.length; a++) {
1926
- const r = e.monthDates[a];
1927
- if (n.getFullYear() === r.getFullYear() && n.getMonth() === r.getMonth()) {
1928
- e.activeMonthIndex = a;
1929
- const o = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${a}"]`);
1930
- if (o) {
1931
- const s = o.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), i = Array.from(s).findIndex((d) => {
1932
- const l = d.dataset.date;
1933
- if (!l) return !1;
1934
- const [c, u, p] = l.split("-").map(Number), g = new Date(c, u, p);
1935
- return e.isSameDay(g, n);
1936
- });
1937
- i !== -1 && (e.focusedDayIndex = i, s.forEach((d) => d.classList.remove("drp-date-picker__day--focused")), s[i] && s[i].classList.add("drp-date-picker__day--focused"));
1938
- }
1939
- break;
1940
- }
1941
- }
1942
- }
1943
- }
1944
- }
1945
- function Se(e, t, n = "forward") {
1946
- let r = new Date(t);
1947
- if (r.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(r))
1948
- return r;
1949
- const o = n === "forward" ? 1 : -1;
1950
- for (let i = 1; i <= 60; i++) {
1951
- const d = new Date(t);
1952
- if (d.setDate(d.getDate() + i * o), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
1953
- return d;
1954
- }
1955
- const s = -o;
1956
- for (let i = 1; i <= 60; i++) {
1957
- const d = new Date(t);
1958
- if (d.setDate(d.getDate() + i * s), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
1959
- return d;
1960
- }
1961
- return t;
1962
- }
1963
- function Xn(e, t) {
1964
- const n = t.target, a = n.value, r = n.selectionStart || 0, o = e._previousInputValue || "", s = a.length < o.length, { separator: i } = e.formatInfo;
1965
- if (e.options.selectionMode === "range") {
1966
- const d = a.replace(new RegExp(`[^0-9${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}to ]`, "gi"), ""), l = Et(e, d);
1967
- if (l !== a) {
1968
- n.value = l;
1969
- let c = r;
1970
- if (s)
1971
- c = r;
1972
- else if (l.length > a.length)
1973
- if (l.includes(" to ") && !a.includes(" to ")) {
1974
- const u = l.indexOf(" to ");
1975
- r >= u && r <= u + 4 ? c = u + 4 : c = r + (l.length - a.length);
1976
- } else
1977
- c = r + (l.length - a.length);
1978
- n.setSelectionRange(c, c);
1979
- }
1980
- } else {
1981
- const d = a.replace(new RegExp(`[^0-9${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), l = oe(e, d);
1982
- if (l !== a) {
1983
- n.value = l;
1984
- let c = r;
1985
- if (s)
1986
- c = r;
1987
- else if (l.length > a.length && l[r] === i)
1988
- c = r + 1;
1989
- else if (l.length > a.length) {
1990
- const u = (a.substring(0, r).match(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length, g = (l.substring(0, r).match(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length - u;
1991
- c = r + g;
1992
- }
1993
- n.setSelectionRange(c, c);
1994
- }
1995
- }
1996
- e._previousInputValue = n.value, Ve(e);
1997
- }
1998
- function oe(e, t) {
1999
- var c, u, p;
2000
- const { separator: n, parts: a, maxLength: r } = e.formatInfo, o = t.replace(new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), ""), s = a.year ? a.year.length : 4, i = [
2001
- { type: "year", pos: ((c = a.year) == null ? void 0 : c.index) ?? 0, length: s },
2002
- { type: "month", pos: ((u = a.month) == null ? void 0 : u.index) ?? 1, length: 2 },
2003
- { type: "day", pos: ((p = a.day) == null ? void 0 : p.index) ?? 2, length: 2 }
2004
- ].sort((g, h) => g.pos - h.pos);
2005
- let d = "", l = 0;
2006
- for (let g = 0; g < i.length; g++) {
2007
- const h = i[g], f = o.substring(l, l + h.length);
2008
- if (!f) break;
2009
- d += f, l += f.length, g < i.length - 1 && f.length === h.length && (d += n);
2010
- }
2011
- return d.substring(0, r);
2012
- }
2013
- function Et(e, t) {
2014
- const { separator: n, maxLength: a } = e.formatInfo, r = " to ";
2015
- let o = "", s = "";
2016
- if (t.includes(r)) {
2017
- const d = t.split(r);
2018
- o = d[0], s = d.slice(1).join(r);
2019
- } else
2020
- o = t;
2021
- const i = oe(e, o);
2022
- if (i.length === a)
2023
- if (t.includes(r)) {
2024
- const d = oe(e, s);
2025
- return i + r + d;
2026
- } else
2027
- return i + r;
2028
- else
2029
- return i;
2030
- }
2031
- function Gn(e, t) {
2032
- const { key: n, ctrlKey: a, metaKey: r } = t, { separator: o } = e.formatInfo;
2033
- if (e.calendar.classList.contains("drp-date-picker--visible") && ["ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"].includes(n)) {
2034
- t.preventDefault();
2035
- return;
2036
- }
2037
- if (!([
2038
- "Backspace",
2039
- "Delete",
2040
- "Tab",
2041
- "Escape",
2042
- "Enter",
2043
- "ArrowLeft",
2044
- "ArrowRight",
2045
- "ArrowUp",
2046
- "ArrowDown",
2047
- "Home",
2048
- "End"
2049
- ].includes(n) || a || r)) {
2050
- if (n === o) {
2051
- const i = t.target, d = i.selectionStart || 0, l = i.value;
2052
- let c = 0;
2053
- for (let p = d - 1; p >= 0; p--)
2054
- if (l[p] === o || l[p] === " ") {
2055
- c = p + 1;
2056
- break;
2057
- }
2058
- const u = l.substring(c, d);
2059
- if (/^\d$/.test(u)) {
2060
- t.preventDefault();
2061
- const p = l.substring(0, c) + "0" + u + o + l.substring(d);
2062
- i.value = p;
2063
- const g = c + 2 + o.length;
2064
- i.setSelectionRange(g, g), e._previousInputValue = p, i.dispatchEvent(new Event("input", { bubbles: !0 }));
2065
- return;
2066
- }
2067
- }
2068
- e.options.selectionMode === "range" ? !/^\d$/.test(n) && n !== o && n !== " " && n.toLowerCase() !== "t" && n.toLowerCase() !== "o" && t.preventDefault() : !/^\d$/.test(n) && n !== o && t.preventDefault();
2069
- }
2070
- }
2071
- function Jn(e, t) {
2072
- var p;
2073
- t.preventDefault();
2074
- const n = ((p = t.clipboardData) == null ? void 0 : p.getData("text")) || "", { separator: a } = e.formatInfo, r = n.replace(new RegExp(`[^0-9${a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), o = oe(e, r), s = t.target, i = s.selectionStart || 0, d = s.selectionEnd || 0, l = s.value, c = l.substring(0, i) + o + l.substring(d);
2075
- s.value = oe(e, c);
2076
- const u = i + o.length;
2077
- s.setSelectionRange(u, u), s.dispatchEvent(new Event("input", { bubbles: !0 })), Ve(e);
2078
- }
2079
- function Ve(e) {
2080
- if (!e.input) return;
2081
- const t = e.input.value;
2082
- if (Z.debug("updateCalendarFromInput - value:", t), !t) return;
2083
- const { separator: n, parts: a, maxLength: r } = e.formatInfo;
2084
- if (Z.debug("Format info:", { separator: n, parts: a, maxLength: r }), e.options.selectionMode === "range" && t.includes(" to ")) {
2085
- const s = t.split(" to "), i = s[0], d = s[1];
2086
- Z.debug("Range parts - start:", i, "end:", d), be(e, i, "start"), d && be(e, d, "end");
2087
- return;
2088
- }
2089
- const o = e.options.selectionMode === "range" ? "start" : "single";
2090
- be(e, t, o);
2091
- }
2092
- function be(e, t, n = "single") {
2093
- const { separator: a, parts: r, maxLength: o } = e.formatInfo, s = t.split(a);
2094
- let i = null, d = null, l = null;
2095
- if (s.forEach((c, u) => {
2096
- if (c) {
2097
- if (r.year && r.year.index === u) {
2098
- const p = parseInt(c, 10);
2099
- r.year.length === 4 && c.length === 4 ? i = p : r.year.length === 2 && c.length === 2 && (i = p < 100 ? p + 2e3 : p);
2100
- } else if (r.month && r.month.index === u) {
2101
- const p = parseInt(c, 10);
2102
- c.length === 2 && p >= 1 && p <= 12 && (d = p);
2103
- } else if (r.day && r.day.index === u) {
2104
- const p = parseInt(c, 10);
2105
- c.length === 2 && p >= 1 && p <= 31 && (l = p);
2106
- }
2107
- }
2108
- }), Z.debug(`parseAndUpdateSingleDate(${n}) - year:`, i, "month:", d, "day:", l), i !== null || d !== null) {
2109
- const c = i || (/* @__PURE__ */ new Date()).getFullYear(), u = d !== null ? d - 1 : (/* @__PURE__ */ new Date()).getMonth();
2110
- if (e.options.selectionMode === "single") {
2111
- e.monthDates = [];
2112
- for (let p = 0; p < e.options.visibleMonthsCount; p++) {
2113
- const g = new Date(c, u + p, 1);
2114
- e.monthDates.push(g);
2115
- }
2116
- } else if (e.options.selectionMode === "range" && (n === "start" || !e.selectedStartDate)) {
2117
- if (e.displayMonths = [
2118
- { month: u, year: c }
2119
- ], e.options.visibleMonthsCount > 1) {
2120
- const p = new Date(c, u + 1, 1);
2121
- e.displayMonths.push({
2122
- month: p.getMonth(),
2123
- year: p.getFullYear()
2124
- });
2125
- }
2126
- e.monthDates = [];
2127
- for (let p = 0; p < e.options.visibleMonthsCount; p++) {
2128
- const g = e.displayMonths[p], h = new Date(g.year, g.month, 1);
2129
- e.monthDates.push(h);
2130
- }
2131
- }
2132
- e.renderCalendar();
2133
- }
2134
- if (i !== null && d !== null && l !== null) {
2135
- const c = new Date(i, d - 1, l);
2136
- c.getMonth() === d - 1 && (n === "single" ? e.selectedDate = c : n === "start" ? e.selectedStartDate = c : n === "end" && (e.selectedEndDate = c), e.renderCalendar(), e.options.selectionMode === "range" && e.updateSummary(), Z.debug(`Set ${n} date:`, c));
2137
- }
2138
- }
2139
- const ze = {
2140
- en: {
2141
- today: "Today",
2142
- clear: "Clear",
2143
- apply: "Apply",
2144
- preview: "Preview",
2145
- day: "day",
2146
- days: "days",
2147
- night: "night",
2148
- nights: "nights"
2149
- },
2150
- de: {
2151
- today: "Heute",
2152
- clear: "Löschen",
2153
- apply: "Anwenden",
2154
- preview: "Vorschau",
2155
- day: "Tag",
2156
- days: "Tage",
2157
- night: "Nacht",
2158
- nights: "Nächte"
2159
- },
2160
- fr: {
2161
- today: "Aujourd'hui",
2162
- clear: "Effacer",
2163
- apply: "Appliquer",
2164
- preview: "Aperçu",
2165
- day: "jour",
2166
- days: "jours",
2167
- night: "nuit",
2168
- nights: "nuits"
2169
- },
2170
- es: {
2171
- today: "Hoy",
2172
- clear: "Limpiar",
2173
- apply: "Aplicar",
2174
- preview: "Vista previa",
2175
- day: "día",
2176
- days: "días",
2177
- night: "noche",
2178
- nights: "noches"
2179
- }
2180
- };
2181
- function Ce(e) {
2182
- if (e !== "auto")
2183
- return e;
2184
- if (typeof navigator < "u" && navigator.language) {
2185
- const t = navigator.language.split("-")[0].toLowerCase();
2186
- return ze[t] ? t : "en";
2187
- }
2188
- return "en";
2189
- }
2190
- function Qn(e, t) {
2191
- const n = Ce(e), a = ze[n] || ze.en;
2192
- return t ? { ...a, ...t } : a;
2193
- }
2194
- function Zn(e) {
2195
- const t = Ce(e);
2196
- try {
2197
- const n = new Intl.DateTimeFormat(t, { weekday: "short" }), a = [];
2198
- for (let r = 0; r < 7; r++) {
2199
- const o = new Date(2017, 0, r + 1);
2200
- a.push(n.format(o));
2201
- }
2202
- return a;
2203
- } catch (n) {
2204
- return R.warn("getWeekdayNames() - Intl.DateTimeFormat failed, using English weekdays", n), ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
2205
- }
2206
- }
2207
- function ea(e) {
2208
- const t = Ce(e);
2209
- try {
2210
- const n = new Intl.DateTimeFormat(t, { month: "long" }), a = [];
2211
- for (let r = 0; r < 12; r++) {
2212
- const o = new Date(2017, r, 1);
2213
- a.push(n.format(o));
2214
- }
2215
- return a;
2216
- } catch (n) {
2217
- return R.warn("getMonthNames() - Intl.DateTimeFormat failed, using English months", n), [
2218
- "January",
2219
- "February",
2220
- "March",
2221
- "April",
2222
- "May",
2223
- "June",
2224
- "July",
2225
- "August",
2226
- "September",
2227
- "October",
2228
- "November",
2229
- "December"
2230
- ];
2231
- }
2232
- }
2233
- class ta {
2234
- constructor(t, n = {}) {
2235
- v(this, "input");
2236
- v(this, "options");
2237
- v(this, "formatInfo");
2238
- v(this, "_previousInputValue");
2239
- v(this, "currentDate");
2240
- v(this, "monthDates");
2241
- v(this, "displayMonths");
2242
- v(this, "selectedDate");
2243
- v(this, "selectedStartDate");
2244
- v(this, "selectedEndDate");
2245
- v(this, "focusedDayIndex");
2246
- v(this, "activeMonthIndex");
2247
- v(this, "showingRollingSelector");
2248
- v(this, "draggingType");
2249
- v(this, "isDragging");
2250
- v(this, "dragStartDate");
2251
- v(this, "originalStartDate");
2252
- v(this, "originalEndDate");
2253
- v(this, "dragPreviewStart");
2254
- v(this, "dragPreviewEnd");
2255
- v(this, "autoScrollInterval");
2256
- v(this, "navInterval");
2257
- v(this, "calendar");
2258
- v(this, "containerElement");
2259
- v(this, "onDragMoveBound");
2260
- v(this, "onDragEndBound");
2261
- v(this, "clickOutsideHandler");
2262
- v(this, "isFirstRender", !0);
2263
- v(this, "lockedPlacement");
2264
- // Store the initial placement to prevent jumping
2265
- v(this, "calendarContentHeight");
2266
- // Store calendar height for rolling selector
2267
- v(this, "isCalendarActive", !1);
2268
- // Track if this calendar is actively focused (for inline mode)
2269
- // Async validation state
2270
- v(this, "isValidating", !1);
2271
- v(this, "loadingOverlay");
2272
- // Floating UI tooltips
2273
- v(this, "tooltip");
2274
- v(this, "tooltipArrow");
2275
- v(this, "currentTooltipTarget");
2276
- // Week start and date restrictions
2277
- v(this, "weekStartDay", 0);
2278
- // 0 = Sunday, 1 = Monday, etc.
2279
- v(this, "normalizedMinDate", null);
2280
- v(this, "normalizedMaxDate", null);
2281
- v(this, "normalizedDisabledDates", /* @__PURE__ */ new Set());
2282
- // Store as 'YYYY-MM-DD' strings
2283
- v(this, "normalizedSpecialDates", /* @__PURE__ */ new Map());
2284
- // Store as 'YYYY-MM-DD' -> DecoratedDate
2285
- // Internationalization
2286
- v(this, "locale", "en");
2287
- v(this, "localeStrings");
2288
- v(this, "weekdayNames", []);
2289
- v(this, "monthNames", []);
2290
- this.input = t, this.containerElement = n.container || document.body, this.options = {
2291
- selectionMode: n.selectionMode || "single",
2292
- calendarPlacement: n.calendarPlacement || (n.monthLayout === "grid" ? "bottom" : "bottom-start"),
2293
- visibleMonthsCount: n.visibleMonthsCount || (n.selectionMode === "range" ? 2 : 1),
2294
- dateFormatMask: n.dateFormatMask || "YYYY-MM-DD",
2295
- calendarOpenTrigger: n.calendarOpenTrigger || "auto",
2296
- onSelect: n.onSelect || void 0,
2297
- container: this.containerElement,
2298
- positioningMode: n.positioningMode || "floating",
2299
- monthLayout: n.monthLayout || "horizontal",
2300
- gridRows: n.gridRows,
2301
- gridColumns: n.gridColumns,
2302
- weekStartDay: n.weekStartDay !== void 0 ? n.weekStartDay : "auto",
2303
- minDate: n.minDate,
2304
- maxDate: n.maxDate,
2305
- disabledDates: n.disabledDates,
2306
- disabledWeekdays: n.disabledWeekdays,
2307
- specialDates: n.specialDates,
2308
- isDateDisabled: n.isDateDisabled,
2309
- getDateMetadata: n.getDateMetadata,
2310
- disabledDatesHandling: n.disabledDatesHandling || "allow",
2311
- highlightDisabledInRange: n.highlightDisabledInRange !== void 0 ? n.highlightDisabledInRange : !0,
2312
- locale: n.locale || "auto",
2313
- displayFormatMask: n.displayFormatMask,
2314
- customStrings: n.customStrings,
2315
- formatSummaryCallback: n.formatSummaryCallback,
2316
- validateRangeCallback: n.validateRangeCallback,
2317
- showDebugInfo: n.showDebugInfo || !1
2318
- }, qt(this.options.showDebugInfo), this.weekStartDay = Rt(this.options.weekStartDay), P.debug("Week starts on day:", this.weekStartDay), P.debug("disabledDatesHandling:", this.options.disabledDatesHandling), this.locale = Ce(this.options.locale), this.localeStrings = Qn(this.locale, this.options.customStrings), this.weekdayNames = Zn(this.locale), this.monthNames = ea(this.locale), P.debug("Locale:", this.locale, "Weekdays:", this.weekdayNames, "Months:", this.monthNames), this.initializeDateRestrictions(), this.formatInfo = this.parseFormat(this.options.dateFormatMask), P.debug("Format info:", this.formatInfo), this._previousInputValue = "", this.currentDate = /* @__PURE__ */ new Date(), this.monthDates = [];
2319
- const a = /* @__PURE__ */ new Date();
2320
- for (let r = 0; r < this.options.visibleMonthsCount; r++) {
2321
- const o = new Date(a.getFullYear(), a.getMonth() + r, 1);
2322
- this.monthDates.push(o), P.debug(`monthDates[${r}] = ${o.getFullYear()}-${o.getMonth() + 1}`);
2323
- }
2324
- if (this.options.selectionMode === "range") {
2325
- this.displayMonths = [];
2326
- for (let r = 0; r < this.options.visibleMonthsCount; r++) {
2327
- const o = new Date(a.getFullYear(), a.getMonth() + r, 1);
2328
- this.displayMonths.push({
2329
- month: o.getMonth(),
2330
- year: o.getFullYear()
2331
- });
2332
- }
2333
- }
2334
- this.selectedDate = null, this.selectedStartDate = null, this.selectedEndDate = null, this.focusedDayIndex = null, this.activeMonthIndex = 0, this.showingRollingSelector = [];
2335
- for (let r = 0; r < this.options.visibleMonthsCount; r++)
2336
- this.showingRollingSelector.push(!1);
2337
- this.draggingType = null, this.isDragging = !1, this.dragStartDate = null, this.originalStartDate = null, this.originalEndDate = null, this.dragPreviewStart = null, this.dragPreviewEnd = null, this.autoScrollInterval = null, this.init();
2338
- }
2339
- init() {
2340
- P.debug("Init called"), this.createCalendar(), this.input && (this.attachInputListeners(), this.input.value && (P.debug("Parsing pre-filled value:", this.input.value), this.updateCalendarFromInput())), this.options.positioningMode === "inline" && (this.renderCalendar(), this.calendar.classList.add("drp-date-picker--visible", "drp-date-picker--inline"), this.isCalendarActive = !0, this.isFirstRender = !1), P.debug("Init complete");
2341
- }
2342
- /**
2343
- * Initialize and normalize date restrictions
2344
- */
2345
- initializeDateRestrictions() {
2346
- this.options.minDate && (this.normalizedMinDate = ye(this.options.minDate)), this.options.maxDate && (this.normalizedMaxDate = ye(this.options.maxDate)), this.options.disabledDates && this.options.disabledDates.length > 0 && this.options.disabledDates.forEach((t) => {
2347
- const n = ye(t);
2348
- if (n) {
2349
- const a = ve(n);
2350
- this.normalizedDisabledDates.add(a);
2351
- }
2352
- }), this.options.specialDates && this.options.specialDates.length > 0 && this.options.specialDates.forEach((t) => {
2353
- const n = ye(t.date);
2354
- if (n) {
2355
- const a = ve(n);
2356
- this.normalizedSpecialDates.set(a, t);
2357
- }
2358
- });
2359
- }
2360
- /**
2361
- * Check if a date should be disabled
2362
- */
2363
- isDateDisabledInternal(t) {
2364
- return $t(
2365
- t,
2366
- this.normalizedMinDate,
2367
- this.normalizedMaxDate,
2368
- this.normalizedDisabledDates,
2369
- this.options.disabledWeekdays,
2370
- this.options.isDateDisabled
2371
- );
2372
- }
2373
- /**
2374
- * Get additional info for a date (special styling, labels, etc.)
2375
- */
2376
- getDateInfoInternal(t) {
2377
- const n = ve(t);
2378
- if (this.normalizedSpecialDates.has(n)) {
2379
- const a = this.normalizedSpecialDates.get(n);
2380
- return {
2381
- disabled: this.isDateDisabledInternal(t),
2382
- class: a.class,
2383
- label: a.label,
2384
- tooltip: a.tooltip
2385
- };
2386
- }
2387
- if (this.options.getDateMetadata) {
2388
- const a = this.options.getDateMetadata(t);
2389
- if (a)
2390
- return {
2391
- ...a,
2392
- disabled: a.disabled !== void 0 ? a.disabled : this.isDateDisabledInternal(t)
2393
- };
2394
- }
2395
- return null;
2396
- }
2397
- /**
2398
- * Check if there are any disabled dates in a range
2399
- */
2400
- hasDisabledDatesInRange(t, n) {
2401
- return Pt(t, n, (a) => this.isDateDisabledInternal(a));
2402
- }
2403
- /**
2404
- * Get all enabled dates in a range
2405
- */
2406
- getEnabledDatesInRange(t, n) {
2407
- return Tt(t, n, (a) => this.isDateDisabledInternal(a));
2408
- }
2409
- /**
2410
- * Get all disabled dates in a range
2411
- */
2412
- getDisabledDatesInRange(t, n) {
2413
- return zt(t, n, (a) => this.isDateDisabledInternal(a));
2414
- }
2415
- /**
2416
- * For 'block' mode: Find the last enabled date before hitting a disabled date
2417
- */
2418
- findLastEnabledBeforeGap(t, n) {
2419
- return Ft(t, n, (a) => this.isDateDisabledInternal(a));
2420
- }
2421
- /**
2422
- * For 'split' mode: Split a range into multiple ranges separated by disabled dates
2423
- */
2424
- splitRangeByDisabled(t, n) {
2425
- return Nt(t, n, (a) => this.isDateDisabledInternal(a));
2426
- }
2427
- isToday(t) {
2428
- return Ot(t);
2429
- }
2430
- isSameDay(t, n) {
2431
- return Je(t, n);
2432
- }
2433
- isInRange(t) {
2434
- return Ht(t, this.selectedStartDate, this.selectedEndDate);
2435
- }
2436
- createCalendar() {
2437
- P.debug("Creating calendar"), this.calendar = document.createElement("div"), this.calendar.className = "drp-date-picker";
2438
- const t = document.createElement("div");
2439
- this.options.monthLayout === "grid" ? (t.className = "drp-date-picker__months drp-date-picker__months--grid", this.options.gridRows && t.style.setProperty("--drp-grid-rows", String(this.options.gridRows)), this.options.gridColumns && t.style.setProperty("--drp-grid-columns", String(this.options.gridColumns))) : t.className = "drp-date-picker__months drp-date-picker__months--horizontal";
2440
- for (let a = 0; a < this.options.visibleMonthsCount; a++) {
2441
- const r = document.createElement("div");
2442
- r.className = "drp-date-picker__month", r.dataset.monthIndex = String(a), r.innerHTML = `
2443
- <div class="drp-date-picker__header">
2444
- <button class="drp-date-picker__nav drp-date-picker__nav--prev" data-action="prev" data-month-index="${a}"></button>
2445
- <div class="drp-date-picker__month-year" data-action="toggle-rolling" data-month-index="${a}"></div>
2446
- <button class="drp-date-picker__nav drp-date-picker__nav--next" data-action="next" data-month-index="${a}"></button>
2447
- </div>
2448
- <div class="drp-date-picker__rolling-selector" data-month-index="${a}">
2449
- <div class="drp-date-picker__rolling-list" data-list="years" data-month-index="${a}"></div>
2450
- <div class="drp-date-picker__rolling-list" data-list="months" data-month-index="${a}"></div>
2451
- </div>
2452
- <div class="drp-date-picker__weekdays"></div>
2453
- <div class="drp-date-picker__days" data-month-index="${a}"></div>
2454
- `, t.appendChild(r);
2455
- }
2456
- if (this.calendar.appendChild(t), this.options.selectionMode === "range") {
2457
- const a = document.createElement("div");
2458
- a.className = "drp-date-picker__summary drp-date-picker__summary--hidden", this.calendar.appendChild(a);
2459
- }
2460
- const n = document.createElement("div");
2461
- n.className = "drp-date-picker__actions", n.innerHTML = `
2462
- <button class="drp-date-picker__button drp-date-picker__button--today" data-action="today">${this.localeStrings.today}</button>
2463
- <button class="drp-date-picker__button drp-date-picker__button--clear" data-action="clear">${this.localeStrings.clear}</button>
2464
- ${this.options.selectionMode === "range" ? `<button class="drp-date-picker__button drp-date-picker__button--apply" data-action="apply">${this.localeStrings.apply}</button>` : ""}
2465
- `, this.calendar.appendChild(n), this.containerElement.appendChild(this.calendar), P.debug("Calendar appended to container:", this.calendar), this.tooltip = document.createElement("div"), this.tooltip.className = "drp-date-picker__tooltip", this.tooltipArrow = document.createElement("div"), this.tooltipArrow.className = "drp-date-picker__tooltip-arrow", this.tooltip.appendChild(this.tooltipArrow), this.containerElement.appendChild(this.tooltip), this.attachCalendarListeners(), this.showingRollingSelector = new Array(this.options.visibleMonthsCount).fill(!1);
2466
- }
2467
- attachInputListeners() {
2468
- this.input && (P.debug("Attaching input listeners"), this.options.calendarOpenTrigger === "auto" && (this.input.addEventListener("click", () => {
2469
- P.debug("Input clicked"), this.show();
2470
- }), this.input.addEventListener("focus", () => {
2471
- P.debug("Input focused"), this.show();
2472
- })), this.input.addEventListener("input", (t) => this.handleInputMask(t)), this.input.addEventListener("keydown", (t) => this.handleKeydown(t)), this.input.addEventListener("paste", (t) => this.handlePaste(t)));
2473
- }
2474
- attachCalendarListeners() {
2475
- this.calendar.addEventListener("click", async (t) => {
2476
- const n = t.target;
2477
- t.stopPropagation();
2478
- const a = n.dataset.action, r = n.dataset.monthIndex, o = r ? parseInt(r) : 0;
2479
- if (a === "prev") this.prevMonth(o);
2480
- else if (a === "next") this.nextMonth(o);
2481
- else if (a === "toggle-rolling") this.toggleRollingSelector(o);
2482
- else if (a === "today") this.selectToday();
2483
- else if (a === "clear") this.clearSelection();
2484
- else if (a === "apply") this.apply();
2485
- else if (n.closest(".drp-date-picker__day:not(.drp-date-picker__day--disabled)"))
2486
- await this.selectDay(n.closest(".drp-date-picker__day"));
2487
- else if (n.closest("[data-year]")) {
2488
- const s = n.closest("[data-year]"), i = s.dataset.year, d = s.dataset.monthIndex;
2489
- i && d && this.selectYear(parseInt(i), parseInt(d));
2490
- } else if (n.closest("[data-month]")) {
2491
- const s = n.closest("[data-month]"), i = s.dataset.month, d = s.dataset.monthIndex;
2492
- i && d && this.selectMonth(parseInt(i), parseInt(d));
2493
- }
2494
- }), this.calendar.addEventListener("mouseenter", (t) => {
2495
- const n = t.target, a = n.closest(".drp-date-picker__day"), r = n.closest(".drp-date-picker__badge-cell"), o = a || r;
2496
- if (o && o instanceof HTMLElement) {
2497
- const s = o.dataset.tooltip;
2498
- s && this.showTooltip(o, s);
2499
- }
2500
- }, !0), this.calendar.addEventListener("mouseleave", (t) => {
2501
- const n = t.target, a = n.closest(".drp-date-picker__day"), r = n.closest(".drp-date-picker__badge-cell"), o = a || r;
2502
- o && this.currentTooltipTarget === o && this.hideTooltip();
2503
- }, !0), this.calendar.addEventListener("mousedown", (t) => {
2504
- this.isCalendarActive = !0, t.stopPropagation();
2505
- }), this.calendar.addEventListener("focusin", () => {
2506
- this.isCalendarActive = !0;
2507
- }), document.addEventListener("mousedown", (t) => {
2508
- this.calendar.contains(t.target) || (this.isCalendarActive = !1);
2509
- }, !0), document.addEventListener("keydown", (t) => {
2510
- var n, a, r, o;
2511
- if (this.calendar.classList.contains("drp-date-picker--visible") && this.isCalendarActive) {
2512
- if (P.debug("Keydown", t.key, "Ctrl:", t.ctrlKey, "Meta:", t.metaKey, "Shift:", t.shiftKey, "Alt:", t.altKey), t.key === "Escape")
2513
- this.hide(), t.preventDefault();
2514
- else if (t.key === "ArrowUp")
2515
- this.moveFocus(-7), t.preventDefault();
2516
- else if (t.key === "ArrowDown")
2517
- this.moveFocus(7), t.preventDefault();
2518
- else if (t.key === "ArrowLeft") {
2519
- if (t.ctrlKey || t.metaKey) {
2520
- M.debug("Ctrl+Left: Navigate to previous month");
2521
- const s = this.focusedDayIndex;
2522
- this.prevMonth(this.activeMonthIndex), setTimeout(() => {
2523
- var l, c;
2524
- const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2525
- d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
2526
- }, 0);
2527
- } else
2528
- this.moveFocus(-1);
2529
- t.preventDefault();
2530
- } else if (t.key === "ArrowRight") {
2531
- if (t.ctrlKey || t.metaKey) {
2532
- M.debug("Ctrl+Right: Navigate to next month");
2533
- const s = this.focusedDayIndex;
2534
- this.nextMonth(this.activeMonthIndex), setTimeout(() => {
2535
- var l, c;
2536
- const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2537
- d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
2538
- }, 0);
2539
- } else
2540
- this.moveFocus(1);
2541
- t.preventDefault();
2542
- } else if (t.key === "Enter") {
2543
- if (this.focusedDayIndex !== null) {
2544
- const s = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), i = s == null ? void 0 : s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), d = i == null ? void 0 : i[this.focusedDayIndex];
2545
- d && d.click();
2546
- } else
2547
- this.hide();
2548
- t.preventDefault();
2549
- } else if (t.key === "Tab") {
2550
- if (this.options.visibleMonthsCount > 1) {
2551
- const s = t.shiftKey ? -1 : 1, i = this.activeMonthIndex + s;
2552
- if (i >= 0 && i < this.monthDates.length) {
2553
- M.debug(`Tab: switching from Col${this.activeMonthIndex} to Col${i}`);
2554
- const d = this.focusedDayIndex ?? 0;
2555
- this.activeMonthIndex = i;
2556
- const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`);
2557
- if (l) {
2558
- const c = l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2559
- this.focusedDayIndex = Math.min(d, c.length - 1), M.debug(`Col${this.activeMonthIndex} Tab: set focusedDayIndex to ${this.focusedDayIndex}`);
2560
- }
2561
- this.renderCalendar();
2562
- }
2563
- t.preventDefault();
2564
- }
2565
- } else if (t.key === "t" || t.key === "T")
2566
- this.monthDates[this.activeMonthIndex] = /* @__PURE__ */ new Date(), this.renderCalendar(), setTimeout(() => {
2567
- const s = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), i = s == null ? void 0 : s.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2568
- if (i) {
2569
- const d = Array.from(i).findIndex((l) => l.classList.contains("drp-date-picker__day--today"));
2570
- d !== -1 && (this.focusedDayIndex = d, i[d].classList.add("drp-date-picker__day--focused"), i[d].scrollIntoView({ block: "nearest" }));
2571
- }
2572
- }, 0), t.preventDefault();
2573
- else if (t.key === "PageUp") {
2574
- const s = this.focusedDayIndex;
2575
- this.prevMonth(this.activeMonthIndex), setTimeout(() => {
2576
- var l, c;
2577
- const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2578
- d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
2579
- }, 0), t.preventDefault();
2580
- } else if (t.key === "PageDown") {
2581
- const s = this.focusedDayIndex;
2582
- this.nextMonth(this.activeMonthIndex), setTimeout(() => {
2583
- var l, c;
2584
- const i = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), d = i == null ? void 0 : i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2585
- d && (this.focusedDayIndex = Math.min(s !== null ? s : 0, d.length - 1), (l = d[this.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"), (c = d[this.focusedDayIndex]) == null || c.scrollIntoView({ block: "nearest" }));
2586
- }, 0), t.preventDefault();
2587
- } else if (t.key === "Home") {
2588
- M.debug("Home key pressed, Ctrl:", t.ctrlKey, "Meta:", t.metaKey);
2589
- const s = this.monthDates[this.activeMonthIndex].getFullYear(), i = this.monthDates[this.activeMonthIndex].getMonth();
2590
- if (t.ctrlKey || t.metaKey) {
2591
- M.debug("Ctrl+Home: Navigate to year start");
2592
- const d = i === 0, l = this.focusedDayIndex === 0;
2593
- d && l ? (M.debug("Already at Jan 1, going to previous year"), this.monthDates[this.activeMonthIndex] = new Date(s - 1, 0, 1)) : (M.debug("Going to Jan 1 of current year"), this.monthDates[this.activeMonthIndex] = new Date(s, 0, 1)), this.renderCalendar(), setTimeout(() => {
2594
- var p, g;
2595
- const c = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), u = c == null ? void 0 : c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2596
- u && (this.focusedDayIndex = 0, (p = u[0]) == null || p.classList.add("drp-date-picker__day--focused"), (g = u[0]) == null || g.scrollIntoView({ block: "nearest" }));
2597
- }, 0);
2598
- } else if (M.debug("Home: Navigate to first day (cycles to previous month if already there)"), this.focusedDayIndex === 0)
2599
- M.debug("Already on first day, going to previous month"), this.prevMonth(this.activeMonthIndex), setTimeout(() => {
2600
- var u, p;
2601
- const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2602
- c && (this.focusedDayIndex = 0, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((g) => g.classList.remove("drp-date-picker__day--focused")), (u = c[0]) == null || u.classList.add("drp-date-picker__day--focused"), (p = c[0]) == null || p.scrollIntoView({ block: "nearest" }));
2603
- }, 0);
2604
- else {
2605
- this.focusedDayIndex = 0;
2606
- const l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2607
- c && (this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((u) => u.classList.remove("drp-date-picker__day--focused")), (n = c[0]) == null || n.classList.add("drp-date-picker__day--focused"), (a = c[0]) == null || a.scrollIntoView({ block: "nearest" }));
2608
- }
2609
- t.preventDefault();
2610
- } else if (t.key === "End") {
2611
- M.debug("End key pressed, Ctrl:", t.ctrlKey, "Meta:", t.metaKey);
2612
- const s = this.monthDates[this.activeMonthIndex].getFullYear(), i = this.monthDates[this.activeMonthIndex].getMonth();
2613
- if (t.ctrlKey || t.metaKey) {
2614
- M.debug("Ctrl+End: Navigate to year end");
2615
- const d = i === 11, l = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), c = l == null ? void 0 : l.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), u = c && this.focusedDayIndex === c.length - 1;
2616
- d && u ? this.monthDates[this.activeMonthIndex] = new Date(s + 1, 11, 31) : this.monthDates[this.activeMonthIndex] = new Date(s, 11, 31), this.renderCalendar(), setTimeout(() => {
2617
- var h, f;
2618
- const p = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), g = p == null ? void 0 : p.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2619
- g && (this.focusedDayIndex = g.length - 1, (h = g[this.focusedDayIndex]) == null || h.classList.add("drp-date-picker__day--focused"), (f = g[this.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
2620
- }, 0);
2621
- } else {
2622
- M.debug("End: Navigate to last day (cycles to next month if already there)");
2623
- const d = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), l = d == null ? void 0 : d.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2624
- if (!l) return;
2625
- this.focusedDayIndex === l.length - 1 ? (M.debug("Already on last day, going to next month"), this.nextMonth(this.activeMonthIndex), setTimeout(() => {
2626
- var g, h;
2627
- const u = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), p = u == null ? void 0 : u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2628
- p && (this.focusedDayIndex = p.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((f) => f.classList.remove("drp-date-picker__day--focused")), (g = p[this.focusedDayIndex]) == null || g.classList.add("drp-date-picker__day--focused"), (h = p[this.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
2629
- }, 0)) : (this.focusedDayIndex = l.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((u) => u.classList.remove("drp-date-picker__day--focused")), (r = l[this.focusedDayIndex]) == null || r.classList.add("drp-date-picker__day--focused"), (o = l[this.focusedDayIndex]) == null || o.scrollIntoView({ block: "nearest" }));
2630
- }
2631
- t.preventDefault();
2632
- }
2633
- }
2634
- }), this.options.positioningMode === "floating" && (this.clickOutsideHandler = (t) => {
2635
- var i;
2636
- const n = t.composedPath(), a = n[0], r = n.includes(this.calendar), o = this.input && n.includes(this.input), s = (i = a.closest) == null ? void 0 : i.call(a, "[data-calendar-button]");
2637
- !r && !o && !s && this.hide();
2638
- }, document.addEventListener("click", this.clickOutsideHandler));
2639
- }
2640
- // Helper methods
2641
- parseFormat(t) {
2642
- const n = {};
2643
- let a = "";
2644
- return t.includes("-") ? a = "-" : t.includes("/") ? a = "/" : t.includes(".") && (a = "."), t.split(a).forEach((o, s) => {
2645
- o === "YYYY" || o === "YY" ? n.year = { index: s, length: o.length } : o === "MM" || o === "M" ? n.month = { index: s, length: 2 } : (o === "DD" || o === "D") && (n.day = { index: s, length: 2 });
2646
- }), {
2647
- format: t,
2648
- separator: a,
2649
- parts: n,
2650
- maxLength: t.length
2651
- };
2652
- }
2653
- formatDate(t) {
2654
- if (!t) return "";
2655
- const n = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0"), { format: o, separator: s, parts: i } = this.formatInfo, d = [];
2656
- for (let l = 0; l < 3; l++)
2657
- i.year && i.year.index === l ? d.push(i.year.length === 2 ? String(n).slice(-2) : n) : i.month && i.month.index === l ? d.push(a) : i.day && i.day.index === l && d.push(r);
2658
- return d.join(s);
2659
- }
2660
- destroy() {
2661
- this.clickOutsideHandler && document.removeEventListener("click", this.clickOutsideHandler), this.calendar.remove(), this.tooltip && this.tooltip.remove();
2662
- }
2663
- // UI methods - wrappers for pure functions
2664
- show() {
2665
- return Dt(this);
2666
- }
2667
- hide() {
2668
- return wt(this);
2669
- }
2670
- toggle() {
2671
- return Hn(this);
2672
- }
2673
- position() {
2674
- return _t(this);
2675
- }
2676
- showTooltip(t, n) {
2677
- return Vn(this, t, n);
2678
- }
2679
- hideTooltip() {
2680
- return Yn(this);
2681
- }
2682
- // Rendering methods - wrappers for pure functions
2683
- renderCalendar() {
2684
- return Ut(this);
2685
- }
2686
- renderNormalView(t) {
2687
- return nt(this, t);
2688
- }
2689
- renderDays(t, n) {
2690
- return at(this, t, n);
2691
- }
2692
- renderRollingSelector(t) {
2693
- return rt(this, t);
2694
- }
2695
- updateSummary() {
2696
- return Xt(this);
2697
- }
2698
- updateSummaryWithPreview() {
2699
- return st(this);
2700
- }
2701
- updateDragPreview() {
2702
- return Gt(this);
2703
- }
2704
- // Navigation methods - wrappers for pure functions
2705
- toggleRollingSelector(t) {
2706
- return Bt(this, t);
2707
- }
2708
- selectYear(t, n) {
2709
- return jt(this, t, n);
2710
- }
2711
- selectMonth(t, n) {
2712
- return Wt(this, t, n);
2713
- }
2714
- checkAndResolveCollisions(t) {
2715
- return pe(this, t);
2716
- }
2717
- prevMonth(t) {
2718
- return le(this, t);
2719
- }
2720
- nextMonth(t) {
2721
- return ce(this, t);
2722
- }
2723
- findNextEnabledDayIndex(t, n, a, r) {
2724
- return de(this, t, n, a);
2725
- }
2726
- moveFocus(t) {
2727
- return Kt(this, t);
2728
- }
2729
- // Selection methods - wrappers for pure functions
2730
- async selectDay(t) {
2731
- return await Bn(this, t);
2732
- }
2733
- selectToday() {
2734
- return jn(this);
2735
- }
2736
- clearSelection() {
2737
- return Wn(this);
2738
- }
2739
- apply() {
2740
- return Kn(this);
2741
- }
2742
- // Interaction methods - wrappers for pure functions
2743
- initDragListeners() {
2744
- return Un(this);
2745
- }
2746
- startDrag(t, n) {
2747
- return St(this, t, n);
2748
- }
2749
- onDragMove(t) {
2750
- return It(this, t);
2751
- }
2752
- async onDragEnd(t) {
2753
- return await Mt(this);
2754
- }
2755
- findNearestEnabledDate(t, n = "forward") {
2756
- return Se(this, t, n);
2757
- }
2758
- handleInputMask(t) {
2759
- return Xn(this, t);
2760
- }
2761
- applyMask(t) {
2762
- return oe(this, t);
2763
- }
2764
- applyRangeMask(t) {
2765
- return Et(this, t);
2766
- }
2767
- handleKeydown(t) {
2768
- return Gn(this, t);
2769
- }
2770
- handlePaste(t) {
2771
- return Jn(this, t);
2772
- }
2773
- updateCalendarFromInput() {
2774
- return Ve(this);
2775
- }
2776
- parseAndUpdateSingleDate(t, n = "single") {
2777
- return be(this, t, n);
2778
- }
2779
- }
2780
- const na = '@charset "UTF-8";:host{--drp-card-bg: #ffffff;--drp-border-color: #e5e7eb;--drp-primary-bg: #f3f4f6;--drp-primary-bg-hover: #e5e7eb;--drp-accent-color: #3b82f6;--drp-accent-color-hover: #2563eb;--drp-text-primary: #111827;--drp-text-secondary: #6b7280;--drp-accent-text-color: #ffffff;--drp-button-text-color: #ffffff;--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem;--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem;--drp-font-weight-medium: 500;--drp-font-weight-semibold: 600;--drp-border-width-base: 1px;--drp-border-radius: .375rem;--drp-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);--drp-transition-fast: .15s;--drp-easing-snappy: cubic-bezier(.4, 0, .2, 1);--drp-input-padding-h: .75rem;--drp-grid-columns: 3;--drp-grid-rows: 2}.drp-date-picker-input{position:relative;cursor:pointer}.drp-date-picker-input:after{content:"📅";position:absolute;right:var(--drp-input-padding-h);top:50%;transform:translateY(-50%);pointer-events:none;opacity:.6}.drp-date-picker{position:absolute;z-index:9500;background:var(--drp-card-bg);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);box-shadow:var(--drp-shadow-xl);padding:var(--drp-spacing-md);min-width:280px;max-width:calc(100vw - 2rem);box-sizing:border-box;-webkit-user-select:none;user-select:none}.drp-date-picker:not(.drp-date-picker--visible){display:none}.drp-date-picker--inline{position:relative!important;display:block!important;z-index:auto;min-width:0;max-width:100%;width:fit-content;box-sizing:border-box}.drp-date-picker__months{display:flex;gap:var(--drp-spacing-lg)}.drp-date-picker--inline .drp-date-picker__months{flex-wrap:wrap}.drp-date-picker__months--grid{display:grid;grid-template-columns:repeat(var(--drp-grid-columns, 3),minmax(0,1fr));grid-template-rows:repeat(var(--drp-grid-rows, 2),auto);gap:var(--drp-spacing-lg);width:100%}@media (max-width: 1200px){.drp-date-picker__months--grid{grid-template-columns:repeat(min(var(--drp-grid-columns, 3),3),minmax(0,1fr))}}@media (max-width: 768px){.drp-date-picker__months--grid{grid-template-columns:repeat(min(var(--drp-grid-columns, 3),2),minmax(0,1fr))}}@media (max-width: 480px){.drp-date-picker__months--grid{grid-template-columns:minmax(0,1fr)}}.drp-date-picker__month{flex:1;min-width:280px}.drp-date-picker--inline .drp-date-picker__month{min-width:250px}.drp-date-picker__months--grid .drp-date-picker__month{min-width:0;width:100%}.drp-date-picker__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--drp-spacing-md);gap:var(--drp-spacing-sm)}.drp-date-picker__month-year{flex:1;text-align:center;font-weight:var(--drp-font-weight-semibold);font-size:var(--drp-font-size-base);color:var(--drp-text-primary);padding:var(--drp-spacing-sm) var(--drp-spacing-md);border-radius:var(--drp-border-radius);cursor:pointer;transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__month-year:hover{background-color:var(--drp-primary-bg)}.drp-date-picker__month-year:active{background-color:var(--drp-primary-bg-hover)}.drp-date-picker__nav{width:2rem;height:2rem;display:flex;align-items:center;justify-content:center;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);font-size:var(--drp-font-size-lg);color:var(--drp-text-primary)}.drp-date-picker__nav:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__nav:active{background-color:var(--drp-primary-bg-hover)}.drp-date-picker__nav--disabled,.drp-date-picker__nav[disabled]{opacity:.6;cursor:not-allowed;pointer-events:none}.drp-date-picker__nav--disabled:hover,.drp-date-picker__nav[disabled]:hover{background-color:transparent;border-color:var(--drp-border-color)}.drp-date-picker__nav--prev:before{content:"‹"}.drp-date-picker__nav--next:before{content:"›"}.drp-date-picker__rolling-selector{display:none}.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible{display:flex}.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible~.drp-date-picker__weekdays,.drp-date-picker__rolling-selector.drp-date-picker__rolling-selector--visible~.drp-date-picker__days{display:none}.drp-date-picker__rolling-selector{gap:var(--drp-spacing-md);margin-bottom:var(--drp-spacing-md)}.drp-date-picker__rolling-list{flex:1;height:100%;overflow-y:auto;border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);scroll-behavior:smooth}.drp-date-picker__rolling-list::-webkit-scrollbar{width:6px}.drp-date-picker__rolling-list::-webkit-scrollbar-track{background:var(--drp-primary-bg)}.drp-date-picker__rolling-list::-webkit-scrollbar-thumb{background:var(--drp-border-color);border-radius:3px}.drp-date-picker__rolling-list::-webkit-scrollbar-thumb:hover{background:var(--drp-accent-color)}.drp-date-picker__rolling-item{padding:var(--drp-spacing-sm) var(--drp-spacing-md);text-align:center;cursor:pointer;font-size:var(--drp-font-size-sm);transition:background-color var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__rolling-item:hover{background-color:var(--drp-primary-bg)}.drp-date-picker__rolling-item--selected{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__rolling-item--selected:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-sm)}.drp-date-picker__weekday{text-align:center;font-size:var(--drp-font-size-xs);font-weight:var(--drp-font-weight-semibold);color:var(--drp-text-secondary);padding:var(--drp-spacing-xs);text-transform:uppercase}.drp-date-picker__days{display:flex;flex-direction:column;gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-md)}.drp-date-picker__date-row{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs)}.drp-date-picker__day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:var(--drp-font-size-sm);color:var(--drp-text-primary);border-radius:var(--drp-border-radius);cursor:pointer;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);border:2px solid transparent;position:relative}.drp-date-picker__day:hover:not(.drp-date-picker__day--disabled):not(.drp-date-picker__day--other-month){background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__day--today{border-color:var(--drp-accent-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__day--selected{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold)}.drp-date-picker__day--selected:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__day--focused{outline:2px solid var(--drp-accent-color);outline-offset:2px}.drp-date-picker__day--disabled{color:var(--drp-text-secondary);opacity:.6;cursor:not-allowed;position:relative}.drp-date-picker__day--disabled:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background-image:repeating-linear-gradient(45deg,rgba(0,0,0,.1) 0px,rgba(0,0,0,.1) 1px,transparent 1px,transparent 6px);border-radius:var(--drp-border-radius);pointer-events:none}.drp-date-picker__day--disabled:hover{background-color:transparent;border-color:transparent}.drp-date-picker__day--other-month{color:var(--drp-text-secondary);opacity:.5}.drp-date-picker__day--other-month.drp-date-picker__day--range-start,.drp-date-picker__day--other-month.drp-date-picker__day--range-end,.drp-date-picker__day--other-month.drp-date-picker__day--in-range,.drp-date-picker__day--other-month.drp-date-picker__day--drag-preview{opacity:1}.drp-date-picker__day--range-start,.drp-date-picker__day--range-end{background-color:var(--drp-accent-color);color:var(--drp-accent-text-color);font-weight:var(--drp-font-weight-semibold);cursor:grab;-webkit-user-select:none;user-select:none}.drp-date-picker__day--range-start:active,.drp-date-picker__day--range-end:active{cursor:grabbing}.drp-date-picker__day--in-range{background-color:color-mix(in srgb,var(--drp-accent-color) 15%,transparent)}.drp-date-picker__day--in-range:hover{background-color:color-mix(in srgb,var(--drp-accent-color) 25%,transparent)}.drp-date-picker__day--dragging{cursor:grabbing!important;opacity:.7;transform:scale(1.1);transition:transform var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__day--drag-preview{background-color:color-mix(in srgb,var(--drp-accent-color) 30%,transparent);border:2px dashed var(--drp-accent-color)}.drp-date-picker__day--drag-preview.drp-date-picker__day--range-start,.drp-date-picker__day--drag-preview.drp-date-picker__day--range-end{background-color:color-mix(in srgb,var(--drp-accent-color) 60%,transparent);color:var(--drp-accent-text-color)}.drp-date-picker__day--drag-invalid{background-color:color-mix(in srgb,#ef4444 20%,transparent)!important;border-color:#ef4444!important;border-style:dashed!important}.drp-date-picker__day.holiday{background-color:color-mix(in srgb,#ef4444 10%,transparent)}.drp-date-picker__day.holiday:hover:not(.drp-date-picker__day--disabled){background-color:color-mix(in srgb,#ef4444 20%,transparent)}.drp-date-picker__day.event{background-color:color-mix(in srgb,#10b981 10%,transparent)}.drp-date-picker__day.event:hover:not(.drp-date-picker__day--disabled){background-color:color-mix(in srgb,#10b981 20%,transparent)}.drp-date-picker__badge-row{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--drp-spacing-xs);margin-bottom:var(--drp-spacing-xs);max-height:1rem;min-height:1rem}.drp-date-picker__badge-cell{display:flex;align-items:center;justify-content:center;font-size:var(--drp-font-size-2xs);padding:1px 2px;border-radius:2px;transition:all var(--drp-transition-fast) var(--drp-easing-snappy);cursor:pointer;height:100%;max-height:1rem}.drp-date-picker__badge-cell:empty{visibility:hidden}.drp-date-picker__badge-cell:hover:not(:empty){transform:scale(1.05)}.drp-date-picker__badge-cell.badge-number{background-color:#10b981;color:#fff;font-size:.7rem;font-weight:600}.drp-date-picker__badge-cell.badge-count{background-color:#ef4444;color:#fff;font-size:.7rem;font-weight:700}.drp-date-picker__badge-cell.badge-text{background-color:#6b7280;color:#fff;font-size:.65rem;font-weight:700;text-transform:uppercase}.drp-date-picker__summary{text-align:center;padding:var(--drp-spacing-md);border-top:var(--drp-border-width-base) solid var(--drp-border-color);font-size:var(--drp-font-size-sm);color:var(--drp-text-secondary)}.drp-date-picker__summary--visible{display:block}.drp-date-picker__summary--hidden{display:none}.drp-date-picker__summary-count{font-weight:var(--drp-font-weight-semibold);color:var(--drp-accent-color);font-size:var(--drp-font-size-base)}.drp-date-picker__actions{display:flex;gap:var(--drp-spacing-sm);justify-content:space-between;padding-top:var(--drp-spacing-sm);border-top:var(--drp-border-width-base) solid var(--drp-border-color)}.drp-date-picker__button{flex:1;padding:var(--drp-spacing-sm) var(--drp-spacing-md);border:var(--drp-border-width-base) solid var(--drp-border-color);border-radius:var(--drp-border-radius);background:transparent;cursor:pointer;font-size:var(--drp-font-size-sm);font-weight:var(--drp-font-weight-medium);transition:all var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__button:hover{background-color:var(--drp-primary-bg);border-color:var(--drp-accent-color)}.drp-date-picker__button--today{color:var(--drp-accent-color)}.drp-date-picker__button--clear{color:var(--drp-text-secondary)}.drp-date-picker__button--apply{background-color:var(--drp-accent-color);color:var(--drp-button-text-color);border-color:var(--drp-accent-color)}.drp-date-picker__button--apply:hover{background-color:var(--drp-accent-color-hover)}.drp-date-picker__button--cancel{color:var(--drp-text-secondary)}.drp-date-picker__tooltip{position:absolute;z-index:9999;background-color:var(--drp-text-primary);color:#fff;padding:var(--drp-spacing-xs) var(--drp-spacing-sm);border-radius:var(--drp-border-radius);font-size:var(--drp-font-size-xs);line-height:1.4;max-width:200px;word-wrap:break-word;pointer-events:none;opacity:0;transition:opacity var(--drp-transition-fast) var(--drp-easing-snappy)}.drp-date-picker__tooltip--visible{opacity:1}.drp-date-picker__tooltip-arrow{position:absolute;background-color:var(--drp-text-primary);width:8px;height:8px;transform:rotate(45deg)}.drp-date-picker__loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#fffc;display:flex;align-items:center;justify-content:center;z-index:9500;border-radius:.375rem}.drp-date-picker__loading-spinner{width:40px;height:40px;border:4px solid #e5e7eb;border-top-color:#3b82f6;border-radius:50%;animation:drp-spin .8s linear infinite}@keyframes drp-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.drp-font-xs{--drp-font-size-2xs: .4375rem;--drp-font-size-xs: .525rem;--drp-font-size-sm: .6125rem;--drp-font-size-base: .7rem;--drp-font-size-lg: .7875rem;--drp-font-size-xl: .875rem;--drp-font-size-2xl: 1.05rem}.drp-font-sm{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}.drp-font-lg{--drp-font-size-2xs: .75rem;--drp-font-size-xs: .9rem;--drp-font-size-sm: 1.05rem;--drp-font-size-base: 1.2rem;--drp-font-size-lg: 1.35rem;--drp-font-size-xl: 1.5rem;--drp-font-size-2xl: 1.8rem}.drp-font-xl{--drp-font-size-2xs: .875rem;--drp-font-size-xs: 1.05rem;--drp-font-size-sm: 1.225rem;--drp-font-size-base: 1.4rem;--drp-font-size-lg: 1.575rem;--drp-font-size-xl: 1.75rem;--drp-font-size-2xl: 2.1rem}.drp-spacing-xs{--drp-spacing-xs: .175rem;--drp-spacing-sm: .35rem;--drp-spacing-md: .7rem;--drp-spacing-lg: 1.05rem;--drp-spacing-xl: 1.4rem}.drp-spacing-xs .drp-date-picker__month{min-width:196px}.drp-spacing-sm{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-spacing-sm .drp-date-picker__month{min-width:238px}.drp-spacing-lg{--drp-spacing-xs: .3rem;--drp-spacing-sm: .6rem;--drp-spacing-md: 1.2rem;--drp-spacing-lg: 1.8rem;--drp-spacing-xl: 2.4rem}.drp-spacing-lg .drp-date-picker__month{min-width:336px}.drp-spacing-xl{--drp-spacing-xs: .35rem;--drp-spacing-sm: .7rem;--drp-spacing-md: 1.4rem;--drp-spacing-lg: 2.1rem;--drp-spacing-xl: 2.8rem}.drp-spacing-xl .drp-date-picker__month{min-width:392px}@media (max-width: 1200px){.drp-responsive.drp-font-xl{--drp-font-size-2xs: .75rem;--drp-font-size-xs: .9rem;--drp-font-size-sm: 1.05rem;--drp-font-size-base: 1.2rem;--drp-font-size-lg: 1.35rem;--drp-font-size-xl: 1.5rem;--drp-font-size-2xl: 1.8rem}}@media (max-width: 768px){.drp-responsive.drp-font-xl{--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem}}@media (max-width: 1200px){.drp-responsive.drp-font-lg{--drp-font-size-2xs: .625rem;--drp-font-size-xs: .75rem;--drp-font-size-sm: .875rem;--drp-font-size-base: 1rem;--drp-font-size-lg: 1.125rem;--drp-font-size-xl: 1.25rem;--drp-font-size-2xl: 1.5rem}}@media (max-width: 768px){.drp-responsive.drp-font-lg{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}}@media (max-width: 768px){.drp-responsive.drp-font-md{--drp-font-size-2xs: .53125rem;--drp-font-size-xs: .6375rem;--drp-font-size-sm: .74375rem;--drp-font-size-base: .85rem;--drp-font-size-lg: .95625rem;--drp-font-size-xl: 1.0625rem;--drp-font-size-2xl: 1.275rem}}@media (max-width: 768px){.drp-responsive.drp-font-sm{--drp-font-size-2xs: .4375rem;--drp-font-size-xs: .525rem;--drp-font-size-sm: .6125rem;--drp-font-size-base: .7rem;--drp-font-size-lg: .7875rem;--drp-font-size-xl: .875rem;--drp-font-size-2xl: 1.05rem}}@media (max-width: 1200px){.drp-responsive.drp-spacing-xl{--drp-spacing-xs: .3rem;--drp-spacing-sm: .6rem;--drp-spacing-md: 1.2rem;--drp-spacing-lg: 1.8rem;--drp-spacing-xl: 2.4rem}.drp-responsive.drp-spacing-xl .drp-date-picker__month{min-width:336px}}@media (max-width: 768px){.drp-responsive.drp-spacing-xl{--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem}.drp-responsive.drp-spacing-xl .drp-date-picker__month{min-width:280px}}@media (max-width: 1200px){.drp-responsive.drp-spacing-lg{--drp-spacing-xs: .25rem;--drp-spacing-sm: .5rem;--drp-spacing-md: 1rem;--drp-spacing-lg: 1.5rem;--drp-spacing-xl: 2rem}.drp-responsive.drp-spacing-lg .drp-date-picker__month{min-width:280px}}@media (max-width: 768px){.drp-responsive.drp-spacing-lg{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-responsive.drp-spacing-lg .drp-date-picker__month{min-width:238px}}@media (max-width: 768px){.drp-responsive.drp-spacing-md{--drp-spacing-xs: .2125rem;--drp-spacing-sm: .425rem;--drp-spacing-md: .85rem;--drp-spacing-lg: 1.275rem;--drp-spacing-xl: 1.7rem}.drp-responsive.drp-spacing-md .drp-date-picker__month{min-width:238px}}@media (max-width: 768px){.drp-responsive.drp-spacing-sm{--drp-spacing-xs: .175rem;--drp-spacing-sm: .35rem;--drp-spacing-md: .7rem;--drp-spacing-lg: 1.05rem;--drp-spacing-xl: 1.4rem}.drp-responsive.drp-spacing-sm .drp-date-picker__month{min-width:196px}}.drp-date-picker--xs{padding:var(--drp-spacing-sm);min-width:240px}.drp-date-picker--xs .drp-date-picker__month-year{font-size:var(--drp-font-size-xs);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.drp-date-picker--xs .drp-date-picker__nav{width:1.5rem;height:1.5rem;font-size:var(--drp-font-size-sm)}.drp-date-picker--xs .drp-date-picker__weekday{font-size:var(--drp-font-size-2xs)}.drp-date-picker--xs .drp-date-picker__day{font-size:var(--drp-font-size-xs)}.drp-date-picker--sm{padding:var(--drp-spacing-sm);min-width:260px}.drp-date-picker--sm .drp-date-picker__month-year{font-size:var(--drp-font-size-sm);padding:var(--drp-spacing-xs) var(--drp-spacing-sm)}.drp-date-picker--sm .drp-date-picker__nav{width:1.75rem;height:1.75rem;font-size:var(--drp-font-size-base)}.drp-date-picker--sm .drp-date-picker__day{font-size:var(--drp-font-size-xs)}.drp-date-picker--lg{padding:var(--drp-spacing-lg);min-width:320px}.drp-date-picker--lg .drp-date-picker__month-year{font-size:var(--drp-font-size-lg);padding:var(--drp-spacing-md) var(--drp-spacing-lg)}.drp-date-picker--lg .drp-date-picker__nav{width:2.5rem;height:2.5rem;font-size:var(--drp-font-size-xl)}.drp-date-picker--lg .drp-date-picker__day{font-size:var(--drp-font-size-base)}.drp-date-picker--xl{padding:var(--drp-spacing-xl);min-width:360px}.drp-date-picker--xl .drp-date-picker__month-year{font-size:var(--drp-font-size-xl);padding:var(--drp-spacing-lg) var(--drp-spacing-xl)}.drp-date-picker--xl .drp-date-picker__nav{width:3rem;height:3rem;font-size:var(--drp-font-size-2xl)}.drp-date-picker--xl .drp-date-picker__day{font-size:var(--drp-font-size-lg)}.drp-date-picker--inline{position:static;display:block;box-shadow:none}';
2781
- class Lt extends HTMLElement {
2782
- constructor() {
2783
- super();
2784
- v(this, "picker");
2785
- v(this, "inputElement");
2786
- v(this, "shadow");
2787
- // Properties for complex data (not attributes)
2788
- v(this, "_specialDates");
2789
- v(this, "_disabledDates");
2790
- v(this, "_isDateDisabled");
2791
- v(this, "_getDateMetadata");
2792
- this.shadow = this.attachShadow({ mode: "open" });
2793
- }
2794
- static get observedAttributes() {
2795
- return [
2796
- "selection-mode",
2797
- "date-format-mask",
2798
- "visible-months-count",
2799
- "calendar-open-trigger",
2800
- "value",
2801
- "disabled",
2802
- "placeholder",
2803
- "week-start-day",
2804
- "min-date",
2805
- "max-date",
2806
- "disabled-weekdays",
2807
- "disabled-dates-handling",
2808
- "highlight-disabled-in-range",
2809
- "positioning-mode",
2810
- "month-layout",
2811
- "grid-rows",
2812
- "grid-columns",
2813
- "calendar-placement",
2814
- "locale",
2815
- "display-format-mask",
2816
- "show-debug-info"
2817
- ];
2818
- }
2819
- connectedCallback() {
2820
- this.render(), this.initializePicker();
2821
- }
2822
- disconnectedCallback() {
2823
- this.picker && this.picker.destroy();
2824
- }
2825
- attributeChangedCallback(n, a, r) {
2826
- a !== r && (this.picker && n !== "value" && n !== "placeholder" && (this.picker.destroy(), this.initializePicker()), n === "value" && this.inputElement && r !== null && (this.inputElement.value = r), n === "placeholder" && this.inputElement && r !== null && (this.inputElement.placeholder = r), n === "disabled" && this.inputElement && (r !== null ? this.inputElement.disabled = !0 : this.inputElement.disabled = !1));
2827
- }
2828
- render() {
2829
- const n = document.createElement("style");
2830
- if (n.textContent = na, this.shadow.appendChild(n), (this.getAttribute("positioning-mode") || "floating") === "floating") {
2831
- this.inputElement = document.createElement("input"), this.inputElement.type = "text", this.inputElement.classList.add("drp-input", "drp-date-picker-input");
2832
- const r = this.getAttribute("placeholder");
2833
- r && (this.inputElement.placeholder = r);
2834
- const o = this.getAttribute("value");
2835
- o && (this.inputElement.value = o), this.hasAttribute("disabled") && (this.inputElement.disabled = !0), this.shadow.appendChild(this.inputElement);
2836
- }
2837
- }
2838
- initializePicker() {
2839
- const n = this.getAttribute("positioning-mode") || "floating";
2840
- if (n === "floating" && !this.inputElement) return;
2841
- let a;
2842
- const r = this.getAttribute("disabled-weekdays");
2843
- r && (a = r.split(",").map((l) => parseInt(l.trim())).filter((l) => !isNaN(l) && l >= 0 && l <= 6));
2844
- let o;
2845
- const s = this.getAttribute("week-start-day");
2846
- if (s)
2847
- if (s === "auto")
2848
- o = "auto";
2849
- else {
2850
- const l = parseInt(s);
2851
- !isNaN(l) && l >= 0 && l <= 6 && (o = l);
2852
- }
2853
- const i = {
2854
- selectionMode: this.getAttribute("selection-mode") || "single",
2855
- dateFormatMask: this.getAttribute("date-format-mask") || "YYYY-MM-DD",
2856
- visibleMonthsCount: parseInt(this.getAttribute("visible-months-count") || "0") || void 0,
2857
- calendarOpenTrigger: this.getAttribute("calendar-open-trigger") || "auto",
2858
- onSelect: (l) => this.handleDateSelect(l),
2859
- container: this.shadow,
2860
- // Append calendar to shadow root
2861
- positioningMode: n,
2862
- // Layout options
2863
- monthLayout: this.getAttribute("month-layout") || void 0,
2864
- gridRows: parseInt(this.getAttribute("grid-rows") || "0") || void 0,
2865
- gridColumns: parseInt(this.getAttribute("grid-columns") || "0") || void 0,
2866
- // Positioning
2867
- calendarPlacement: this.getAttribute("calendar-placement") || void 0,
2868
- // New options
2869
- weekStartDay: o,
2870
- minDate: this.getAttribute("min-date") || void 0,
2871
- maxDate: this.getAttribute("max-date") || void 0,
2872
- disabledWeekdays: a,
2873
- disabledDates: this._disabledDates,
2874
- specialDates: this._specialDates,
2875
- isDateDisabled: this._isDateDisabled,
2876
- getDateMetadata: this._getDateMetadata,
2877
- disabledDatesHandling: this.getAttribute("disabled-dates-handling") || void 0,
2878
- highlightDisabledInRange: this.hasAttribute("highlight-disabled-in-range") ? this.getAttribute("highlight-disabled-in-range") === "true" : void 0,
2879
- locale: this.getAttribute("locale") || "auto",
2880
- displayFormatMask: this.getAttribute("display-format-mask") || void 0,
2881
- showDebugInfo: this.hasAttribute("show-debug-info")
2882
- }, d = n === "inline" ? null : this.inputElement;
2883
- this.picker = new ta(d, i);
2884
- }
2885
- handleDateSelect(n) {
2886
- var o;
2887
- const a = {
2888
- date: n instanceof Date ? n : void 0,
2889
- dateRange: n instanceof Date ? void 0 : n,
2890
- formattedValue: ((o = this.inputElement) == null ? void 0 : o.value) || ""
2891
- };
2892
- if (!this.picker) {
2893
- this.dispatchEvent(new CustomEvent("date-select", { detail: a, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: a, bubbles: !0, composed: !0 }));
2894
- return;
2895
- }
2896
- const r = this.picker.options.disabledDatesHandling;
2897
- if (!(n instanceof Date) && n.start && n.end) {
2898
- const s = n.start, i = n.end;
2899
- switch (r) {
2900
- case "allow":
2901
- a.enabledDates = this.picker.getEnabledDatesInRange(s, i), a.disabledDates = this.picker.getDisabledDatesInRange(s, i), a.getEnabledDateCount = () => a.enabledDates.length, a.getTotalDays = () => Math.floor((i.getTime() - s.getTime()) / 864e5) + 1;
2902
- break;
2903
- case "split":
2904
- a.dateRanges = this.picker.splitRangeByDisabled(s, i), a.dates = this.picker.getEnabledDatesInRange(s, i), a.dateRanges.length > 0 && (a.formattedValue = a.dateRanges.map((d) => `${this.picker.formatDate(d.start)} - ${this.picker.formatDate(d.end)}`).join(", "));
2905
- break;
2906
- case "individual":
2907
- a.dates = this.picker.getEnabledDatesInRange(s, i), a.dateRange = null, a.dates.length > 0 && (a.formattedValue = a.dates.map((d) => this.picker.formatDate(d)).join(", "));
2908
- break;
2909
- case "block":
2910
- a.dates = this.picker.getEnabledDatesInRange(s, i);
2911
- break;
2912
- }
2913
- }
2914
- this.dispatchEvent(new CustomEvent("date-select", {
2915
- detail: a,
2916
- bubbles: !0,
2917
- composed: !0
2918
- })), this.dispatchEvent(new CustomEvent("change", {
2919
- detail: a,
2920
- bubbles: !0,
2921
- composed: !0
2922
- }));
2923
- }
2924
- // Public API methods
2925
- show() {
2926
- var n;
2927
- (n = this.picker) == null || n.show();
2928
- }
2929
- hide() {
2930
- var n;
2931
- (n = this.picker) == null || n.hide();
2932
- }
2933
- toggle() {
2934
- var n;
2935
- (n = this.picker) == null || n.toggle();
2936
- }
2937
- clearSelection() {
2938
- var n;
2939
- (n = this.picker) == null || n.clearSelection();
2940
- }
2941
- getInputValue() {
2942
- var n;
2943
- return ((n = this.inputElement) == null ? void 0 : n.value) || "";
2944
- }
2945
- setInputValue(n) {
2946
- this.inputElement && (this.inputElement.value = n), this.setAttribute("value", n);
2947
- }
2948
- // Property accessors
2949
- get selectionMode() {
2950
- return this.getAttribute("selection-mode") || "single";
2951
- }
2952
- set selectionMode(n) {
2953
- this.setAttribute("selection-mode", n);
2954
- }
2955
- get dateFormatMask() {
2956
- return this.getAttribute("date-format-mask") || "YYYY-MM-DD";
2957
- }
2958
- set dateFormatMask(n) {
2959
- this.setAttribute("date-format-mask", n);
2960
- }
2961
- get value() {
2962
- return this.getInputValue();
2963
- }
2964
- set value(n) {
2965
- this.setInputValue(n);
2966
- }
2967
- get disabled() {
2968
- return this.hasAttribute("disabled");
2969
- }
2970
- set disabled(n) {
2971
- n ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
2972
- }
2973
- // Week start day property
2974
- get weekStartDay() {
2975
- const n = this.getAttribute("week-start-day");
2976
- if (n === "auto") return "auto";
2977
- const a = parseInt(n || "");
2978
- return !isNaN(a) && a >= 0 && a <= 6 ? a : "auto";
2979
- }
2980
- set weekStartDay(n) {
2981
- this.setAttribute("week-start-day", n.toString());
2982
- }
2983
- // Min/Max date properties
2984
- get minDate() {
2985
- return this.getAttribute("min-date") || void 0;
2986
- }
2987
- set minDate(n) {
2988
- n ? this.setAttribute("min-date", n) : this.removeAttribute("min-date");
2989
- }
2990
- get maxDate() {
2991
- return this.getAttribute("max-date") || void 0;
2992
- }
2993
- set maxDate(n) {
2994
- n ? this.setAttribute("max-date", n) : this.removeAttribute("max-date");
2995
- }
2996
- // Disabled weekdays property
2997
- get disabledWeekdays() {
2998
- const n = this.getAttribute("disabled-weekdays");
2999
- if (n)
3000
- return n.split(",").map((a) => parseInt(a.trim())).filter((a) => !isNaN(a) && a >= 0 && a <= 6);
3001
- }
3002
- set disabledWeekdays(n) {
3003
- n && n.length > 0 ? this.setAttribute("disabled-weekdays", n.join(",")) : this.removeAttribute("disabled-weekdays");
3004
- }
3005
- // Complex data properties (not attributes)
3006
- get specialDates() {
3007
- return this._specialDates;
3008
- }
3009
- set specialDates(n) {
3010
- this._specialDates = n, this.picker && (this.picker.destroy(), this.initializePicker());
3011
- }
3012
- get disabledDates() {
3013
- return this._disabledDates;
3014
- }
3015
- set disabledDates(n) {
3016
- this._disabledDates = n, this.picker && (this.picker.destroy(), this.initializePicker());
3017
- }
3018
- get isDateDisabled() {
3019
- return this._isDateDisabled;
3020
- }
3021
- set isDateDisabled(n) {
3022
- this._isDateDisabled = n, this.picker && (this.picker.destroy(), this.initializePicker());
3023
- }
3024
- get getDateMetadata() {
3025
- return this._getDateMetadata;
3026
- }
3027
- set getDateMetadata(n) {
3028
- this._getDateMetadata = n, this.picker && (this.picker.destroy(), this.initializePicker());
3029
- }
3030
- }
3031
- customElements.get("date-range-picker") || customElements.define("date-range-picker", Lt);
3032
- function aa() {
3033
- return Array.from(document.querySelectorAll("date-range-picker"));
3034
- }
3035
- typeof window < "u" && (window.keenmate = window.keenmate || {}, window.keenmate.daterangepicker = {
3036
- version: () => "1.0.0-rc03",
3037
- config: {
3038
- name: "@keenmate/web-daterangepicker",
3039
- version: "1.0.0-rc03",
3040
- author: "Keenmate",
3041
- license: "MIT",
3042
- repository: "git+https://github.com/keenmate/web-daterangepicker.git",
3043
- homepage: "https://github.com/keenmate/web-daterangepicker#readme"
3044
- },
3045
- register: () => {
3046
- typeof customElements < "u" && !customElements.get("date-range-picker") && customElements.define("date-range-picker", Lt);
3047
- },
3048
- getInstances: () => aa()
3049
- }, window.keenmate.daterangepicker.register());
3050
- export {
3051
- Lt as DateRangePickerElement,
3052
- ta as PureDatePicker
3053
- };