@keenmate/web-daterangepicker 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -111,9 +111,9 @@ function aa(e, a, t) {
111
111
  return i && n.push({ start: i, end: new Date(o) }), n;
112
112
  }
113
113
  function ut(e) {
114
- return pt(e, /* @__PURE__ */ new Date());
114
+ return gt(e, /* @__PURE__ */ new Date());
115
115
  }
116
- function pt(e, a) {
116
+ function gt(e, a) {
117
117
  return !e || !a ? !1 : e.getFullYear() === a.getFullYear() && e.getMonth() === a.getMonth() && e.getDate() === a.getDate();
118
118
  }
119
119
  function na(e, a, t) {
@@ -123,7 +123,7 @@ var ra = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
123
123
  function ia(e) {
124
124
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
125
125
  }
126
- var gt = { exports: {} };
126
+ var pt = { exports: {} };
127
127
  (function(e) {
128
128
  (function(a, t) {
129
129
  e.exports ? e.exports = t() : a.log = t();
@@ -167,10 +167,10 @@ var gt = { exports: {} };
167
167
  typeof console !== t && (c.call(this), this[h].apply(this, arguments));
168
168
  };
169
169
  }
170
- function p(h, v, m) {
170
+ function g(h, v, m) {
171
171
  return l(h) || u.apply(this, arguments);
172
172
  }
173
- function g(h, v) {
173
+ function p(h, v) {
174
174
  var m = this, M, C, x, D = "loglevel";
175
175
  typeof h == "string" ? D += ":" + h : typeof h == "symbol" && (D = void 0);
176
176
  function _(S) {
@@ -196,16 +196,16 @@ var gt = { exports: {} };
196
196
  }
197
197
  if (typeof S === t)
198
198
  try {
199
- var E = window.document.cookie, k = encodeURIComponent(D), A = E.indexOf(k + "=");
199
+ var E = window.document.cookie, T = encodeURIComponent(D), A = E.indexOf(T + "=");
200
200
  A !== -1 && (S = /^([^;]+)/.exec(
201
- E.slice(A + k.length + 1)
201
+ E.slice(A + T.length + 1)
202
202
  )[1]);
203
203
  } catch {
204
204
  }
205
205
  return m.levels[S] === void 0 && (S = void 0), S;
206
206
  }
207
207
  }
208
- function T() {
208
+ function k() {
209
209
  if (!(typeof window === t || !D)) {
210
210
  try {
211
211
  window.localStorage.removeItem(D);
@@ -230,14 +230,14 @@ var gt = { exports: {} };
230
230
  WARN: 3,
231
231
  ERROR: 4,
232
232
  SILENT: 5
233
- }, m.methodFactory = v || p, m.getLevel = function() {
233
+ }, m.methodFactory = v || g, m.getLevel = function() {
234
234
  return x ?? C ?? M;
235
235
  }, m.setLevel = function(S, E) {
236
236
  return x = y(S), E !== !1 && _(x), c.call(m);
237
237
  }, m.setDefaultLevel = function(S) {
238
238
  C = y(S), R() || m.setLevel(S, !1);
239
239
  }, m.resetLevel = function() {
240
- x = null, T(), c.call(m);
240
+ x = null, k(), c.call(m);
241
241
  }, m.enableAll = function(S) {
242
242
  m.setLevel(m.levels.TRACE, S);
243
243
  }, m.disableAll = function(S) {
@@ -252,11 +252,11 @@ var gt = { exports: {} };
252
252
  var I = R();
253
253
  I != null && (x = y(I)), c.call(m);
254
254
  }
255
- i = new g(), i.getLogger = function(v) {
255
+ i = new p(), i.getLogger = function(v) {
256
256
  if (typeof v != "symbol" && typeof v != "string" || v === "")
257
257
  throw new TypeError("You must supply a name when creating a logger.");
258
258
  var m = o[v];
259
- return m || (m = o[v] = new g(
259
+ return m || (m = o[v] = new p(
260
260
  v,
261
261
  i.methodFactory
262
262
  )), m;
@@ -268,8 +268,8 @@ var gt = { exports: {} };
268
268
  return o;
269
269
  }, i.default = i, i;
270
270
  });
271
- })(gt);
272
- var oa = gt.exports;
271
+ })(pt);
272
+ var oa = pt.exports;
273
273
  const O = /* @__PURE__ */ ia(oa), sa = [
274
274
  "DRP",
275
275
  "DRP:RENDERING",
@@ -309,12 +309,12 @@ function J(e) {
309
309
  }
310
310
  const L = J("DRP"), de = J("DRP:RENDERING"), oe = J("DRP:INTERACTION"), ie = J("DRP:SELECTION"), w = J("DRP:NAVIGATION"), H = J("DRP:UI"), Z = J("DRP:VALIDATION"), ee = J("DRP:DRAG");
311
311
  O.setLevel("silent");
312
- const We = (e) => {
312
+ const Ke = (e) => {
313
313
  O.setLevel(e), ht.forEach((a) => a.setLevel(e));
314
314
  }, ft = () => {
315
- We("debug");
315
+ Ke("debug");
316
316
  }, mt = () => {
317
- We("silent");
317
+ Ke("silent");
318
318
  }, ua = (e, a = "debug") => {
319
319
  const n = {
320
320
  DRP: L,
@@ -327,10 +327,10 @@ const We = (e) => {
327
327
  "DRP:DRAG": ee
328
328
  }[e];
329
329
  n && n.setLevel(a);
330
- }, pa = () => [...sa], le = Math.min, te = Math.max, Ie = Math.round, Me = Math.floor, j = (e) => ({
330
+ }, ga = () => [...sa], le = Math.min, te = Math.max, Ie = Math.round, Me = Math.floor, j = (e) => ({
331
331
  x: e,
332
332
  y: e
333
- }), ga = {
333
+ }), pa = {
334
334
  left: "right",
335
335
  right: "left",
336
336
  bottom: "top",
@@ -339,7 +339,7 @@ const We = (e) => {
339
339
  start: "end",
340
340
  end: "start"
341
341
  };
342
- function Ye(e, a, t) {
342
+ function Be(e, a, t) {
343
343
  return te(e, le(a, t));
344
344
  }
345
345
  function _e(e, a) {
@@ -354,27 +354,27 @@ function we(e) {
354
354
  function bt(e) {
355
355
  return e === "x" ? "y" : "x";
356
356
  }
357
- function Ke(e) {
357
+ function Ge(e) {
358
358
  return e === "y" ? "height" : "width";
359
359
  }
360
360
  const fa = /* @__PURE__ */ new Set(["top", "bottom"]);
361
361
  function G(e) {
362
362
  return fa.has(ne(e)) ? "y" : "x";
363
363
  }
364
- function Ge(e) {
364
+ function Xe(e) {
365
365
  return bt(G(e));
366
366
  }
367
367
  function ma(e, a, t) {
368
368
  t === void 0 && (t = !1);
369
- const n = we(e), r = Ge(e), o = Ke(r);
369
+ const n = we(e), r = Xe(e), o = Ge(r);
370
370
  let i = r === "x" ? n === (t ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
371
371
  return a.reference[o] > a.floating[o] && (i = Ee(i)), [i, Ee(i)];
372
372
  }
373
373
  function ba(e) {
374
374
  const a = Ee(e);
375
- return [Be(e), a, Be(a)];
375
+ return [Ve(e), a, Ve(a)];
376
376
  }
377
- function Be(e) {
377
+ function Ve(e) {
378
378
  return e.replace(/start|end/g, (a) => ha[a]);
379
379
  }
380
380
  const nt = ["left", "right"], rt = ["right", "left"], ya = ["top", "bottom"], va = ["bottom", "top"];
@@ -393,10 +393,10 @@ function Da(e, a, t) {
393
393
  function _a(e, a, t, n) {
394
394
  const r = we(e);
395
395
  let o = Da(ne(e), t === "start", n);
396
- return r && (o = o.map((i) => i + "-" + r), a && (o = o.concat(o.map(Be)))), o;
396
+ return r && (o = o.map((i) => i + "-" + r), a && (o = o.concat(o.map(Ve)))), o;
397
397
  }
398
398
  function Ee(e) {
399
- return e.replace(/left|right|bottom|top/g, (a) => ga[a]);
399
+ return e.replace(/left|right|bottom|top/g, (a) => pa[a]);
400
400
  }
401
401
  function wa(e) {
402
402
  return {
@@ -438,48 +438,48 @@ function it(e, a, t) {
438
438
  reference: n,
439
439
  floating: r
440
440
  } = e;
441
- const o = G(a), i = Ge(a), s = Ke(i), d = ne(a), l = o === "y", c = n.x + n.width / 2 - r.width / 2, u = n.y + n.height / 2 - r.height / 2, p = n[s] / 2 - r[s] / 2;
442
- let g;
441
+ const o = G(a), i = Xe(a), s = Ge(i), d = ne(a), l = o === "y", c = n.x + n.width / 2 - r.width / 2, u = n.y + n.height / 2 - r.height / 2, g = n[s] / 2 - r[s] / 2;
442
+ let p;
443
443
  switch (d) {
444
444
  case "top":
445
- g = {
445
+ p = {
446
446
  x: c,
447
447
  y: n.y - r.height
448
448
  };
449
449
  break;
450
450
  case "bottom":
451
- g = {
451
+ p = {
452
452
  x: c,
453
453
  y: n.y + n.height
454
454
  };
455
455
  break;
456
456
  case "right":
457
- g = {
457
+ p = {
458
458
  x: n.x + n.width,
459
459
  y: u
460
460
  };
461
461
  break;
462
462
  case "left":
463
- g = {
463
+ p = {
464
464
  x: n.x - r.width,
465
465
  y: u
466
466
  };
467
467
  break;
468
468
  default:
469
- g = {
469
+ p = {
470
470
  x: n.x,
471
471
  y: n.y
472
472
  };
473
473
  }
474
474
  switch (we(a)) {
475
475
  case "start":
476
- g[i] -= p * (t && l ? -1 : 1);
476
+ p[i] -= g * (t && l ? -1 : 1);
477
477
  break;
478
478
  case "end":
479
- g[i] += p * (t && l ? -1 : 1);
479
+ p[i] += g * (t && l ? -1 : 1);
480
480
  break;
481
481
  }
482
- return g;
482
+ return p;
483
483
  }
484
484
  const xa = async (e, a, t) => {
485
485
  const {
@@ -495,7 +495,7 @@ const xa = async (e, a, t) => {
495
495
  }), {
496
496
  x: c,
497
497
  y: u
498
- } = it(l, n, d), p = n, g = {}, f = 0;
498
+ } = it(l, n, d), g = n, p = {}, f = 0;
499
499
  for (let h = 0; h < s.length; h++) {
500
500
  const {
501
501
  name: v,
@@ -509,9 +509,9 @@ const xa = async (e, a, t) => {
509
509
  x: c,
510
510
  y: u,
511
511
  initialPlacement: n,
512
- placement: p,
512
+ placement: g,
513
513
  strategy: r,
514
- middlewareData: g,
514
+ middlewareData: p,
515
515
  rects: l,
516
516
  platform: i,
517
517
  elements: {
@@ -519,27 +519,27 @@ const xa = async (e, a, t) => {
519
519
  floating: a
520
520
  }
521
521
  });
522
- c = M ?? c, u = C ?? u, g = {
523
- ...g,
522
+ c = M ?? c, u = C ?? u, p = {
523
+ ...p,
524
524
  [v]: {
525
- ...g[v],
525
+ ...p[v],
526
526
  ...x
527
527
  }
528
- }, D && f <= 50 && (f++, typeof D == "object" && (D.placement && (p = D.placement), D.rects && (l = D.rects === !0 ? await i.getElementRects({
528
+ }, D && f <= 50 && (f++, typeof D == "object" && (D.placement && (g = D.placement), D.rects && (l = D.rects === !0 ? await i.getElementRects({
529
529
  reference: e,
530
530
  floating: a,
531
531
  strategy: r
532
532
  }) : D.rects), {
533
533
  x: c,
534
534
  y: u
535
- } = it(l, p, d)), h = -1);
535
+ } = it(l, g, d)), h = -1);
536
536
  }
537
537
  return {
538
538
  x: c,
539
539
  y: u,
540
- placement: p,
540
+ placement: g,
541
541
  strategy: r,
542
- middlewareData: g
542
+ middlewareData: p
543
543
  };
544
544
  };
545
545
  async function vt(e, a) {
@@ -556,9 +556,9 @@ async function vt(e, a) {
556
556
  boundary: l = "clippingAncestors",
557
557
  rootBoundary: c = "viewport",
558
558
  elementContext: u = "floating",
559
- altBoundary: p = !1,
560
- padding: g = 0
561
- } = _e(a, e), f = yt(g), v = s[p ? u === "floating" ? "reference" : "floating" : u], m = Re(await o.getClippingRect({
559
+ altBoundary: g = !1,
560
+ padding: p = 0
561
+ } = _e(a, e), f = yt(p), v = s[g ? u === "floating" ? "reference" : "floating" : u], m = Re(await o.getClippingRect({
562
562
  element: (t = await (o.isElement == null ? void 0 : o.isElement(v))) == null || t ? v : v.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(s.floating)),
563
563
  boundary: l,
564
564
  rootBoundary: c,
@@ -605,17 +605,17 @@ const Ma = (e) => ({
605
605
  } = _e(e, a) || {};
606
606
  if (l == null)
607
607
  return {};
608
- const u = yt(c), p = {
608
+ const u = yt(c), g = {
609
609
  x: t,
610
610
  y: n
611
- }, g = Ge(r), f = Ke(g), h = await i.getDimensions(l), v = g === "y", m = v ? "top" : "left", M = v ? "bottom" : "right", C = v ? "clientHeight" : "clientWidth", x = o.reference[f] + o.reference[g] - p[g] - o.floating[f], D = p[g] - o.reference[g], _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l));
611
+ }, p = Xe(r), f = Ge(p), h = await i.getDimensions(l), v = p === "y", m = v ? "top" : "left", M = v ? "bottom" : "right", C = v ? "clientHeight" : "clientWidth", x = o.reference[f] + o.reference[p] - g[p] - o.floating[f], D = g[p] - o.reference[p], _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l));
612
612
  let R = _ ? _[C] : 0;
613
613
  (!R || !await (i.isElement == null ? void 0 : i.isElement(_))) && (R = s.floating[C] || o.floating[f]);
614
- const T = x / 2 - D / 2, y = R / 2 - h[f] / 2 - 1, I = le(u[m], y), S = le(u[M], y), E = I, k = R - h[f] - S, A = R / 2 - h[f] / 2 + T, $ = Ye(E, A, k), N = !d.arrow && we(r) != null && A !== $ && o.reference[f] / 2 - (A < E ? I : S) - h[f] / 2 < 0, z = N ? A < E ? A - E : A - k : 0;
614
+ const k = x / 2 - D / 2, y = R / 2 - h[f] / 2 - 1, I = le(u[m], y), S = le(u[M], y), E = I, T = R - h[f] - S, A = R / 2 - h[f] / 2 + k, $ = Be(E, A, T), N = !d.arrow && we(r) != null && A !== $ && o.reference[f] / 2 - (A < E ? I : S) - h[f] / 2 < 0, z = N ? A < E ? A - E : A - T : 0;
615
615
  return {
616
- [g]: p[g] + z,
616
+ [p]: g[p] + z,
617
617
  data: {
618
- [g]: $,
618
+ [p]: $,
619
619
  centerOffset: A - $ - z,
620
620
  ...N && {
621
621
  alignmentOffset: z
@@ -640,21 +640,21 @@ const Ma = (e) => ({
640
640
  } = a, {
641
641
  mainAxis: c = !0,
642
642
  crossAxis: u = !0,
643
- fallbackPlacements: p,
644
- fallbackStrategy: g = "bestFit",
643
+ fallbackPlacements: g,
644
+ fallbackStrategy: p = "bestFit",
645
645
  fallbackAxisSideDirection: f = "none",
646
646
  flipAlignment: h = !0,
647
647
  ...v
648
648
  } = _e(e, a);
649
649
  if ((t = o.arrow) != null && t.alignmentOffset)
650
650
  return {};
651
- const m = ne(r), M = G(s), C = ne(s) === s, x = await (d.isRTL == null ? void 0 : d.isRTL(l.floating)), D = p || (C || !h ? [Ee(s)] : ba(s)), _ = f !== "none";
652
- !p && _ && D.push(..._a(s, h, f, x));
653
- const R = [s, ...D], T = await vt(a, v), y = [];
651
+ const m = ne(r), M = G(s), C = ne(s) === s, x = await (d.isRTL == null ? void 0 : d.isRTL(l.floating)), D = g || (C || !h ? [Ee(s)] : ba(s)), _ = f !== "none";
652
+ !g && _ && D.push(..._a(s, h, f, x));
653
+ const R = [s, ...D], k = await vt(a, v), y = [];
654
654
  let I = ((n = o.flip) == null ? void 0 : n.overflows) || [];
655
- if (c && y.push(T[m]), u) {
655
+ if (c && y.push(k[m]), u) {
656
656
  const A = ma(r, i, x);
657
- y.push(T[A[0]], T[A[1]]);
657
+ y.push(k[A[0]], k[A[1]]);
658
658
  }
659
659
  if (I = [...I, {
660
660
  placement: r,
@@ -676,10 +676,10 @@ const Ma = (e) => ({
676
676
  };
677
677
  let N = (E = I.filter((z) => z.overflows[0] <= 0).sort((z, P) => z.overflows[1] - P.overflows[1])[0]) == null ? void 0 : E.placement;
678
678
  if (!N)
679
- switch (g) {
679
+ switch (p) {
680
680
  case "bestFit": {
681
- var k;
682
- const z = (k = I.filter((P) => {
681
+ var T;
682
+ const z = (T = I.filter((P) => {
683
683
  if (_) {
684
684
  const V = G(P.placement);
685
685
  return V === M || // Create a bias to the `y` side axis due to horizontal
@@ -687,7 +687,7 @@ const Ma = (e) => ({
687
687
  V === "y";
688
688
  }
689
689
  return !0;
690
- }).map((P) => [P.placement, P.overflows.filter((V) => V > 0).reduce((V, q) => V + q, 0)]).sort((P, V) => P[1] - V[1])[0]) == null ? void 0 : k[0];
690
+ }).map((P) => [P.placement, P.overflows.filter((V) => V > 0).reduce((V, q) => V + q, 0)]).sort((P, V) => P[1] - V[1])[0]) == null ? void 0 : T[0];
691
691
  z && (N = z);
692
692
  break;
693
693
  }
@@ -713,8 +713,8 @@ async function Ia(e, a) {
713
713
  elements: r
714
714
  } = e, o = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), i = ne(t), s = we(t), d = G(t) === "y", l = Ca.has(i) ? -1 : 1, c = o && d ? -1 : 1, u = _e(a, e);
715
715
  let {
716
- mainAxis: p,
717
- crossAxis: g,
716
+ mainAxis: g,
717
+ crossAxis: p,
718
718
  alignmentAxis: f
719
719
  } = typeof u == "number" ? {
720
720
  mainAxis: u,
@@ -725,12 +725,12 @@ async function Ia(e, a) {
725
725
  crossAxis: u.crossAxis || 0,
726
726
  alignmentAxis: u.alignmentAxis
727
727
  };
728
- return s && typeof f == "number" && (g = s === "end" ? f * -1 : f), d ? {
729
- x: g * c,
730
- y: p * l
728
+ return s && typeof f == "number" && (p = s === "end" ? f * -1 : f), d ? {
729
+ x: p * c,
730
+ y: g * l
731
731
  } : {
732
- x: p * l,
733
- y: g * c
732
+ x: g * l,
733
+ y: p * c
734
734
  };
735
735
  }
736
736
  const Ea = function(e) {
@@ -783,19 +783,19 @@ const Ea = function(e) {
783
783
  } = _e(e, a), l = {
784
784
  x: t,
785
785
  y: n
786
- }, c = await vt(a, d), u = G(ne(r)), p = bt(u);
787
- let g = l[p], f = l[u];
786
+ }, c = await vt(a, d), u = G(ne(r)), g = bt(u);
787
+ let p = l[g], f = l[u];
788
788
  if (o) {
789
- const v = p === "y" ? "top" : "left", m = p === "y" ? "bottom" : "right", M = g + c[v], C = g - c[m];
790
- g = Ye(M, g, C);
789
+ const v = g === "y" ? "top" : "left", m = g === "y" ? "bottom" : "right", M = p + c[v], C = p - c[m];
790
+ p = Be(M, p, C);
791
791
  }
792
792
  if (i) {
793
793
  const v = u === "y" ? "top" : "left", m = u === "y" ? "bottom" : "right", M = f + c[v], C = f - c[m];
794
- f = Ye(M, f, C);
794
+ f = Be(M, f, C);
795
795
  }
796
796
  const h = s.fn({
797
797
  ...a,
798
- [p]: g,
798
+ [g]: p,
799
799
  [u]: f
800
800
  });
801
801
  return {
@@ -804,7 +804,7 @@ const Ea = function(e) {
804
804
  x: h.x - t,
805
805
  y: h.y - n,
806
806
  enabled: {
807
- [p]: o,
807
+ [g]: o,
808
808
  [u]: i
809
809
  }
810
810
  }
@@ -848,9 +848,9 @@ function xe(e) {
848
848
  } = B(e);
849
849
  return /auto|scroll|overlay|hidden|clip/.test(a + n + t) && !Aa.has(r);
850
850
  }
851
- const ka = /* @__PURE__ */ new Set(["table", "td", "th"]);
852
- function Ta(e) {
853
- return ka.has(he(e));
851
+ const Ta = /* @__PURE__ */ new Set(["table", "td", "th"]);
852
+ function ka(e) {
853
+ return Ta.has(he(e));
854
854
  }
855
855
  const La = [":popover-open", ":modal"];
856
856
  function Pe(e) {
@@ -863,14 +863,14 @@ function Pe(e) {
863
863
  });
864
864
  }
865
865
  const $a = ["transform", "translate", "scale", "rotate", "perspective"], za = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Pa = ["paint", "layout", "strict", "content"];
866
- function Xe(e) {
867
- const a = Je(), t = Y(e) ? B(e) : e;
866
+ function Je(e) {
867
+ const a = Qe(), t = Y(e) ? B(e) : e;
868
868
  return $a.some((n) => t[n] ? t[n] !== "none" : !1) || (t.containerType ? t.containerType !== "normal" : !1) || !a && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !a && (t.filter ? t.filter !== "none" : !1) || za.some((n) => (t.willChange || "").includes(n)) || Pa.some((n) => (t.contain || "").includes(n));
869
869
  }
870
870
  function Na(e) {
871
871
  let a = X(e);
872
872
  for (; W(a) && !ce(a); ) {
873
- if (Xe(a))
873
+ if (Je(a))
874
874
  return a;
875
875
  if (Pe(a))
876
876
  return null;
@@ -878,7 +878,7 @@ function Na(e) {
878
878
  }
879
879
  return null;
880
880
  }
881
- function Je() {
881
+ function Qe() {
882
882
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
883
883
  }
884
884
  const Fa = /* @__PURE__ */ new Set(["html", "body", "#document"]);
@@ -918,12 +918,12 @@ function ue(e, a, t) {
918
918
  a === void 0 && (a = []), t === void 0 && (t = !0);
919
919
  const r = _t(e), o = r === ((n = e.ownerDocument) == null ? void 0 : n.body), i = F(r);
920
920
  if (o) {
921
- const s = Ve(i);
921
+ const s = qe(i);
922
922
  return a.concat(i, i.visualViewport || [], xe(r) ? r : [], s && t ? ue(s) : []);
923
923
  }
924
924
  return a.concat(r, ue(r, [], t));
925
925
  }
926
- function Ve(e) {
926
+ function qe(e) {
927
927
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
928
928
  }
929
929
  function wt(e) {
@@ -936,11 +936,11 @@ function wt(e) {
936
936
  $: s
937
937
  };
938
938
  }
939
- function Qe(e) {
939
+ function Ze(e) {
940
940
  return Y(e) ? e : e.contextElement;
941
941
  }
942
942
  function se(e) {
943
- const a = Qe(e);
943
+ const a = Ze(e);
944
944
  if (!W(a))
945
945
  return j(1);
946
946
  const t = a.getBoundingClientRect(), {
@@ -957,7 +957,7 @@ function se(e) {
957
957
  const Ha = /* @__PURE__ */ j(0);
958
958
  function xt(e) {
959
959
  const a = F(e);
960
- return !Je() || !a.visualViewport ? Ha : {
960
+ return !Qe() || !a.visualViewport ? Ha : {
961
961
  x: a.visualViewport.offsetLeft,
962
962
  y: a.visualViewport.offsetTop
963
963
  };
@@ -967,17 +967,17 @@ function Oa(e, a, t) {
967
967
  }
968
968
  function re(e, a, t, n) {
969
969
  a === void 0 && (a = !1), t === void 0 && (t = !1);
970
- const r = e.getBoundingClientRect(), o = Qe(e);
970
+ const r = e.getBoundingClientRect(), o = Ze(e);
971
971
  let i = j(1);
972
972
  a && (n ? Y(n) && (i = se(n)) : i = se(e));
973
973
  const s = Oa(o, t, n) ? xt(o) : j(0);
974
974
  let d = (r.left + s.x) / i.x, l = (r.top + s.y) / i.y, c = r.width / i.x, u = r.height / i.y;
975
975
  if (o) {
976
- const p = F(o), g = n && Y(n) ? F(n) : n;
977
- let f = p, h = Ve(f);
978
- for (; h && n && g !== f; ) {
976
+ const g = F(o), p = n && Y(n) ? F(n) : n;
977
+ let f = g, h = qe(f);
978
+ for (; h && n && p !== f; ) {
979
979
  const v = se(h), m = h.getBoundingClientRect(), M = B(h), C = m.left + (h.clientLeft + parseFloat(M.paddingLeft)) * v.x, x = m.top + (h.clientTop + parseFloat(M.paddingTop)) * v.y;
980
- d *= v.x, l *= v.y, c *= v.x, u *= v.y, d += C, l += x, f = F(h), h = Ve(f);
980
+ d *= v.x, l *= v.y, c *= v.x, u *= v.y, d += C, l += x, f = F(h), h = qe(f);
981
981
  }
982
982
  }
983
983
  return Re({
@@ -1014,15 +1014,15 @@ function Ya(e) {
1014
1014
  }, l = j(1);
1015
1015
  const c = j(0), u = W(n);
1016
1016
  if ((u || !u && !o) && ((he(n) !== "body" || xe(i)) && (d = Ne(n)), W(n))) {
1017
- const g = re(n);
1018
- l = se(n), c.x = g.x + n.clientLeft, c.y = g.y + n.clientTop;
1017
+ const p = re(n);
1018
+ l = se(n), c.x = p.x + n.clientLeft, c.y = p.y + n.clientTop;
1019
1019
  }
1020
- const p = i && !u && !o ? Mt(i, d) : j(0);
1020
+ const g = i && !u && !o ? Mt(i, d) : j(0);
1021
1021
  return {
1022
1022
  width: t.width * l.x,
1023
1023
  height: t.height * l.y,
1024
- x: t.x * l.x - d.scrollLeft * l.x + c.x + p.x,
1025
- y: t.y * l.y - d.scrollTop * l.y + c.y + p.y
1024
+ x: t.x * l.x - d.scrollLeft * l.x + c.x + g.x,
1025
+ y: t.y * l.y - d.scrollTop * l.y + c.y + g.y
1026
1026
  };
1027
1027
  }
1028
1028
  function Ba(e) {
@@ -1045,12 +1045,12 @@ function qa(e, a) {
1045
1045
  let o = n.clientWidth, i = n.clientHeight, s = 0, d = 0;
1046
1046
  if (r) {
1047
1047
  o = r.width, i = r.height;
1048
- const c = Je();
1048
+ const c = Qe();
1049
1049
  (!c || c && a === "fixed") && (s = r.offsetLeft, d = r.offsetTop);
1050
1050
  }
1051
1051
  const l = Fe(n);
1052
1052
  if (l <= 0) {
1053
- const c = n.ownerDocument, u = c.body, p = getComputedStyle(u), g = c.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, f = Math.abs(n.clientWidth - u.clientWidth - g);
1053
+ const c = n.ownerDocument, u = c.body, g = getComputedStyle(u), p = c.compatMode === "CSS1Compat" && parseFloat(g.marginLeft) + parseFloat(g.marginRight) || 0, f = Math.abs(n.clientWidth - u.clientWidth - p);
1054
1054
  f <= st && (o -= f);
1055
1055
  } else l <= st && (o += l);
1056
1056
  return {
@@ -1101,7 +1101,7 @@ function Wa(e, a) {
1101
1101
  const o = B(e).position === "fixed";
1102
1102
  let i = o ? X(e) : e;
1103
1103
  for (; Y(i) && !ce(i); ) {
1104
- const s = B(i), d = Xe(i);
1104
+ const s = B(i), d = Je(i);
1105
1105
  !d && s.position === "fixed" && (r = null), (o ? !d && !r : !d && s.position === "static" && !!r && Ua.has(r.position) || xe(i) && !d && St(e, i)) ? n = n.filter((c) => c !== i) : r = s, i = X(i);
1106
1106
  }
1107
1107
  return a.set(e, n), n;
@@ -1146,19 +1146,19 @@ function Xa(e, a, t) {
1146
1146
  }
1147
1147
  if (n || !n && !o)
1148
1148
  if ((he(a) !== "body" || xe(r)) && (s = Ne(a)), n) {
1149
- const g = re(a, !0, o, a);
1150
- d.x = g.x + a.clientLeft, d.y = g.y + a.clientTop;
1149
+ const p = re(a, !0, o, a);
1150
+ d.x = p.x + a.clientLeft, d.y = p.y + a.clientTop;
1151
1151
  } else r && l();
1152
1152
  o && !n && r && l();
1153
- const c = r && !n && !o ? Mt(r, s) : j(0), u = i.left + s.scrollLeft - d.x - c.x, p = i.top + s.scrollTop - d.y - c.y;
1153
+ const c = r && !n && !o ? Mt(r, s) : j(0), u = i.left + s.scrollLeft - d.x - c.x, g = i.top + s.scrollTop - d.y - c.y;
1154
1154
  return {
1155
1155
  x: u,
1156
- y: p,
1156
+ y: g,
1157
1157
  width: i.width,
1158
1158
  height: i.height
1159
1159
  };
1160
1160
  }
1161
- function Oe(e) {
1161
+ function Ye(e) {
1162
1162
  return B(e).position === "static";
1163
1163
  }
1164
1164
  function lt(e, a) {
@@ -1176,16 +1176,16 @@ function Ct(e, a) {
1176
1176
  if (!W(e)) {
1177
1177
  let r = X(e);
1178
1178
  for (; r && !ce(r); ) {
1179
- if (Y(r) && !Oe(r))
1179
+ if (Y(r) && !Ye(r))
1180
1180
  return r;
1181
1181
  r = X(r);
1182
1182
  }
1183
1183
  return t;
1184
1184
  }
1185
1185
  let n = lt(e, a);
1186
- for (; n && Ta(n) && Oe(n); )
1186
+ for (; n && ka(n) && Ye(n); )
1187
1187
  n = lt(n, a);
1188
- return n && ce(n) && Oe(n) && !Xe(n) ? t : n || Na(e) || t;
1188
+ return n && ce(n) && Ye(n) && !Je(n) ? t : n || Na(e) || t;
1189
1189
  }
1190
1190
  const Ja = async function(e) {
1191
1191
  const a = this.getOffsetParent || Ct, t = this.getDimensions, n = await t(e.floating);
@@ -1229,12 +1229,12 @@ function Za(e, a) {
1229
1229
  const l = e.getBoundingClientRect(), {
1230
1230
  left: c,
1231
1231
  top: u,
1232
- width: p,
1233
- height: g
1232
+ width: g,
1233
+ height: p
1234
1234
  } = l;
1235
- if (s || a(), !p || !g)
1235
+ if (s || a(), !g || !p)
1236
1236
  return;
1237
- const f = Me(u), h = Me(r.clientWidth - (c + p)), v = Me(r.clientHeight - (u + g)), m = Me(c), C = {
1237
+ const f = Me(u), h = Me(r.clientWidth - (c + g)), v = Me(r.clientHeight - (u + p)), m = Me(c), C = {
1238
1238
  rootMargin: -f + "px " + -h + "px " + -v + "px " + -m + "px",
1239
1239
  threshold: te(0, le(1, d)) || 1
1240
1240
  };
@@ -1271,21 +1271,21 @@ function Rt(e, a, t, n) {
1271
1271
  elementResize: i = typeof ResizeObserver == "function",
1272
1272
  layoutShift: s = typeof IntersectionObserver == "function",
1273
1273
  animationFrame: d = !1
1274
- } = n, l = Qe(e), c = r || o ? [...l ? ue(l) : [], ...ue(a)] : [];
1274
+ } = n, l = Ze(e), c = r || o ? [...l ? ue(l) : [], ...ue(a)] : [];
1275
1275
  c.forEach((m) => {
1276
1276
  r && m.addEventListener("scroll", t, {
1277
1277
  passive: !0
1278
1278
  }), o && m.addEventListener("resize", t);
1279
1279
  });
1280
1280
  const u = l && s ? Za(l, t) : null;
1281
- let p = -1, g = null;
1282
- i && (g = new ResizeObserver((m) => {
1281
+ let g = -1, p = null;
1282
+ i && (p = new ResizeObserver((m) => {
1283
1283
  let [M] = m;
1284
- M && M.target === l && g && (g.unobserve(a), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1284
+ M && M.target === l && p && (p.unobserve(a), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
1285
1285
  var C;
1286
- (C = g) == null || C.observe(a);
1286
+ (C = p) == null || C.observe(a);
1287
1287
  })), t();
1288
- }), l && !d && g.observe(l), g.observe(a));
1288
+ }), l && !d && p.observe(l), p.observe(a));
1289
1289
  let f, h = d ? re(e) : null;
1290
1290
  d && v();
1291
1291
  function v() {
@@ -1296,10 +1296,10 @@ function Rt(e, a, t, n) {
1296
1296
  var m;
1297
1297
  c.forEach((M) => {
1298
1298
  r && M.removeEventListener("scroll", t), o && M.removeEventListener("resize", t);
1299
- }), u == null || u(), (m = g) == null || m.disconnect(), g = null, d && cancelAnimationFrame(f);
1299
+ }), u == null || u(), (m = p) == null || m.disconnect(), p = null, d && cancelAnimationFrame(f);
1300
1300
  };
1301
1301
  }
1302
- const Ae = Ea, ke = Ra, Ze = Sa, At = Ma, et = (e, a, t) => {
1302
+ const Ae = Ea, Te = Ra, et = Sa, At = Ma, tt = (e, a, t) => {
1303
1303
  const n = /* @__PURE__ */ new Map(), r = {
1304
1304
  platform: It,
1305
1305
  ...t
@@ -1315,300 +1315,730 @@ const Ae = Ea, ke = Ra, Ze = Sa, At = Ma, et = (e, a, t) => {
1315
1315
  __proto__: null,
1316
1316
  arrow: At,
1317
1317
  autoUpdate: Rt,
1318
- computePosition: et,
1319
- flip: Ze,
1318
+ computePosition: tt,
1319
+ flip: et,
1320
1320
  getOverflowAncestors: ue,
1321
1321
  offset: Ae,
1322
1322
  platform: It,
1323
- shift: ke
1323
+ shift: Te
1324
1324
  }, Symbol.toStringTag, { value: "Module" }));
1325
- let Se = null;
1326
- function kt(e) {
1327
- e.options.positioningMode !== "inline" && (H.debug("show() - adding visible class"), e.requiresApplyButton() && e.input && (e.originalInputValue = e.input.value, H.debug("show() - stored original input value:", e.originalInputValue)), e.isFirstRender && (e.renderCalendar(), e.isFirstRender = !1, Lt(e)), e.calendar.classList.add("drp-date-picker--visible"), e.isCalendarActive = !0, H.debug("show() - calendar classes:", e.calendar.className), qe(e), Se = Rt(e.input, e.calendar, () => {
1328
- qe(e);
1329
- }), e.clickOutsideHandler && setTimeout(() => {
1330
- document.addEventListener("click", e.clickOutsideHandler);
1331
- }, 0), setTimeout(() => {
1332
- const a = window.getComputedStyle(e.calendar);
1333
- H.debug("show() - computed styles - display:", a.display, "position:", a.position, "left:", a.left, "top:", a.top, "z-index:", a.zIndex);
1334
- }, 100));
1335
- }
1336
- function Tt(e) {
1337
- if (e.options.positioningMode !== "inline" && e.calendar.classList.contains("drp-date-picker--visible")) {
1338
- Se && (Se(), Se = null), e.clickOutsideHandler && document.removeEventListener("click", e.clickOutsideHandler), e.calendar.classList.remove("drp-date-picker--visible"), e.isCalendarActive = !1, e.requiresApplyButton() && e.pendingSelection && e.input && (H.debug("hide() - restoring original input value:", e.originalInputValue), e.originalInputValue !== null && (e.input.value = e.originalInputValue), e.options.selectionMode === "range" ? (e.selectedStartDate = e.committedStartDate, e.selectedEndDate = e.committedEndDate) : e.options.selectionMode === "single" && (e.selectedDate = e.committedDate), H.debug("hide() - reverted selection state")), e.pendingSelection = null;
1339
- for (let a = 0; a < e.showingRollingSelector.length; a++)
1340
- e.showingRollingSelector[a] = !1;
1341
- e.isFirstRender || e.renderCalendar(), e.lockedPlacement = void 0;
1325
+ async function Tt(e, a) {
1326
+ if (!e.options.beforeDateSelectCallback)
1327
+ return { isValid: !0 };
1328
+ try {
1329
+ e.isValidating = !0, Le(e);
1330
+ const t = await Promise.resolve(e.options.beforeDateSelectCallback(a));
1331
+ switch (ae(e), e.isValidating = !1, t.action) {
1332
+ case "accept":
1333
+ return { isValid: !0 };
1334
+ case "adjust":
1335
+ return a instanceof Date && t.adjustedDate ? { isValid: !0, adjustedDate: t.adjustedDate, message: t.message } : typeof a == "object" && "start" in a && t.adjustedStartDate && t.adjustedEndDate ? {
1336
+ isValid: !0,
1337
+ adjustedStart: t.adjustedStartDate,
1338
+ adjustedEnd: t.adjustedEndDate,
1339
+ message: t.message
1340
+ } : { isValid: !1, message: t.message || "Invalid adjustment" };
1341
+ case "restore":
1342
+ return { isValid: !1, message: t.message };
1343
+ case "clear":
1344
+ return e.clearSelection(), { isValid: !1, message: t.message };
1345
+ default:
1346
+ return { isValid: !1, message: "Unknown validation action" };
1347
+ }
1348
+ } catch (t) {
1349
+ return ae(e), e.isValidating = !1, O.error("beforeDateSelectCallback error:", t), { isValid: !1, message: "Validation error occurred" };
1342
1350
  }
1343
1351
  }
1344
- function tn(e) {
1345
- e.calendar.classList.contains("drp-date-picker--visible") ? Tt(e) : kt(e);
1352
+ async function kt(e, a, t) {
1353
+ if (Z.debug(" validateRangeAsync called - mode:", e.options.disabledDatesHandling, "start:", a, "end:", t), e.options.disabledDatesHandling === "prevent") {
1354
+ if (Z.debug(" Checking PREVENT mode"), e.hasDisabledDatesInRange(a, t))
1355
+ return Z.debug(" PREVENT mode - range contains disabled dates"), { isValid: !1, message: "Range contains disabled dates" };
1356
+ } else if (e.options.disabledDatesHandling === "block" && (Z.debug(" Checking BLOCK mode"), e.hasDisabledDatesInRange(a, t))) {
1357
+ Z.debug(" BLOCK mode - range contains disabled dates, adjusting");
1358
+ const r = e.findLastEnabledBeforeGap(a, t);
1359
+ return Z.debug(" BLOCK mode - adjusted end:", r), { isValid: !0, adjustedStart: a, adjustedEnd: r };
1360
+ }
1361
+ const n = await Tt(e, { start: a, end: t });
1362
+ return n.isValid ? n.adjustedStart || n.adjustedEnd ? {
1363
+ isValid: !0,
1364
+ adjustedStart: n.adjustedStart,
1365
+ adjustedEnd: n.adjustedEnd,
1366
+ message: n.message
1367
+ } : { isValid: !0 } : n;
1346
1368
  }
1347
- async function qe(e) {
1348
- if (H.debug("position() - locked placement:", e.lockedPlacement), !e.input)
1369
+ async function tn(e, a) {
1370
+ if (a.classList.contains("drp-date-picker__day--disabled")) return;
1371
+ if (!a.dataset || !a.dataset.date) {
1372
+ O.warn("selectDay() - called with invalid element:", a);
1349
1373
  return;
1350
- const a = e.lockedPlacement ? [Ae(8), ke({ padding: 8 })] : [Ae(8), Ze(), ke({ padding: 8 })], t = await et(e.input, e.calendar, {
1351
- placement: e.lockedPlacement || e.options.calendarPlacement,
1352
- middleware: a
1353
- });
1354
- H.debug("position() - FloatingUI computed - x:", t.x, "y:", t.y, "placement:", t.placement), e.lockedPlacement || (e.lockedPlacement = t.placement, H.debug("position() - locked placement to:", e.lockedPlacement)), e.calendar.style.left = `${t.x}px`, e.calendar.style.top = `${t.y}px`, H.debug("position() - applied styles to calendar");
1355
- }
1356
- async function an(e, a, t) {
1357
- if (!e.tooltip || !e.tooltipArrow) return;
1358
- e.currentTooltipTarget = a, e.tooltip.innerHTML = t, e.tooltip.appendChild(e.tooltipArrow), e.tooltip.classList.add("drp-date-picker__tooltip--visible");
1359
- const { x: n, y: r, placement: o, middlewareData: i } = await et(a, e.tooltip, {
1360
- placement: "top",
1361
- middleware: [
1362
- Ae(6),
1363
- Ze(),
1364
- ke({ padding: 5 }),
1365
- At({ element: e.tooltipArrow })
1366
- ]
1367
- });
1368
- if (Object.assign(e.tooltip.style, {
1369
- left: `${n}px`,
1370
- top: `${r}px`
1371
- }), i.arrow) {
1372
- const { x: s, y: d } = i.arrow, l = {
1373
- top: "bottom",
1374
- right: "left",
1375
- bottom: "top",
1376
- left: "right"
1377
- }[o.split("-")[0]];
1378
- Object.assign(e.tooltipArrow.style, {
1379
- left: s != null ? `${s}px` : "",
1380
- top: d != null ? `${d}px` : "",
1381
- right: "",
1382
- bottom: "",
1383
- [l]: "-4px"
1384
- });
1385
1374
  }
1386
- }
1387
- function nn(e) {
1388
- e.tooltip && (e.tooltip.classList.remove("drp-date-picker__tooltip--visible"), e.currentTooltipTarget = void 0);
1389
- }
1390
- function Te(e) {
1391
- if (e.loadingOverlay) return;
1392
- const a = document.createElement("div");
1393
- a.className = "drp-date-picker__loading-overlay", a.innerHTML = `
1394
- <div class="drp-date-picker__loading-spinner"></div>
1395
- `, e.calendar.appendChild(a), e.loadingOverlay = a;
1396
- }
1397
- function ae(e) {
1398
- e.loadingOverlay && (e.loadingOverlay.remove(), e.loadingOverlay = void 0);
1399
- }
1400
- function U(e, a, t) {
1401
- for (let n = 1; n <= 31; n++) {
1402
- const r = new Date(a, t, n);
1403
- if (r.getMonth() === t && !e.isDateDisabledInternal(r))
1404
- return !0;
1375
+ const [t, n, r] = a.dataset.date.split("-").map(Number), o = new Date(t, n - 1, r);
1376
+ a.classList.contains("drp-date-picker__day--other-month");
1377
+ const i = a.closest(".drp-date-picker__days");
1378
+ if (i && i instanceof HTMLElement) {
1379
+ e.activeMonthIndex = parseInt(i.dataset.monthIndex || "0") || 0, ie.debug(`Col${e.activeMonthIndex} selectDay - activeMonthIndex:`, e.activeMonthIndex);
1380
+ const s = i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
1381
+ e.focusedDayIndex = Array.from(s).indexOf(a), ie.debug(`Col${e.activeMonthIndex} selectDay - set focusedDayIndex to:`, e.focusedDayIndex);
1405
1382
  }
1406
- return !1;
1407
- }
1408
- async function Lt(e) {
1409
- var a, t, n, r;
1410
- if (e.options.beforeMonthChangedCallback) {
1411
- if (e.isMonthChanging) {
1412
- w.debug("handleInitialMonthLoad() - already changing month, skipping");
1383
+ if (e.options.selectionMode === "single") {
1384
+ const s = await Tt(e, o);
1385
+ if (!s.isValid) {
1386
+ ie.debug("Single mode selection prevented by beforeDateSelectCallback");
1413
1387
  return;
1414
1388
  }
1415
- try {
1416
- if (e.isMonthChanging = !0, e.options.unifiedNavigation) {
1417
- const o = e.options.unifiedNavigationAnchorIndex ?? 0, i = e.monthDates[o], s = i.getFullYear(), d = i.getMonth();
1418
- let l = 1 / 0, c = 1 / 0, u = -1 / 0, p = -1 / 0;
1419
- for (let I = 0; I < e.monthDates.length; I++) {
1420
- const S = e.monthDates[I], E = S.getFullYear(), k = S.getMonth();
1421
- (E < l || E === l && k < c) && (l = E, c = k), (E > u || E === u && k > p) && (u = E, p = k);
1422
- }
1423
- const h = (new Date(l, c, 1).getDay() - e.weekStartDay + 7) % 7, v = new Date(l, c, 1 - h), m = new Date(u, p + 1, 0).getDate(), C = new Date(u, p, m).getDay(), x = (e.weekStartDay + 6 - C) % 7, D = new Date(u, p, m + x), _ = {
1424
- year: s,
1425
- month: d,
1426
- monthIndex: o,
1427
- firstVisibleDate: v,
1428
- lastVisibleDate: D
1429
- };
1430
- w.debug(`handleInitialMonthLoad() [UNIFIED] - calling callback for ${s}-${d + 1}, range: ${v.toISOString().split("T")[0]} to ${D.toISOString().split("T")[0]}`);
1431
- const R = e.options.beforeMonthChangedCallback(_), T = R instanceof Promise;
1432
- T && Te(e);
1433
- const y = await Promise.resolve(R);
1434
- T && ae(e), w.debug(`handleInitialMonthLoad() [UNIFIED] - callback completed, metadata items: ${((a = y.metadata) == null ? void 0 : a.size) || 0}, monthHeaders: ${((t = y.monthHeaders) == null ? void 0 : t.size) || 0}`), y.metadata && (e.bulkMetadataCache = y.metadata, w.debug(`handleInitialMonthLoad() [UNIFIED] - bulk metadata cache updated with ${y.metadata.size} entries`)), y.monthHeaders && (e.monthHeadersCache = y.monthHeaders, w.debug(`handleInitialMonthLoad() [UNIFIED] - month headers cache updated with ${y.monthHeaders.size} entries`)), (y.metadata || y.monthHeaders) && e.renderCalendar();
1435
- } else {
1436
- w.debug(`handleInitialMonthLoad() [NON-UNIFIED] - calling callback for ${e.monthDates.length} months`);
1437
- const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1438
- let s = !1;
1439
- for (let d = 0; d < e.monthDates.length; d++) {
1440
- const l = e.monthDates[d], c = l.getFullYear(), u = l.getMonth(), f = (new Date(c, u, 1).getDay() - e.weekStartDay + 7) % 7, h = new Date(c, u, 1 - f), v = new Date(h);
1441
- v.setDate(h.getDate() + 41);
1442
- const m = {
1443
- year: c,
1444
- month: u,
1445
- monthIndex: d,
1446
- firstVisibleDate: h,
1447
- lastVisibleDate: v
1448
- };
1449
- w.debug(`handleInitialMonthLoad() [NON-UNIFIED] Col${d} - calling callback for ${c}-${u + 1}, range: ${h.toISOString().split("T")[0]} to ${v.toISOString().split("T")[0]}`);
1450
- const M = e.options.beforeMonthChangedCallback(m);
1451
- M instanceof Promise && !s && (s = !0, Te(e));
1452
- const x = await Promise.resolve(M);
1453
- w.debug(`handleInitialMonthLoad() [NON-UNIFIED] Col${d} - callback completed, metadata items: ${((n = x.metadata) == null ? void 0 : n.size) || 0}, monthHeaders: ${((r = x.monthHeaders) == null ? void 0 : r.size) || 0}`), x.metadata && x.metadata.forEach((D, _) => {
1454
- o.set(_, D);
1455
- }), x.monthHeaders && x.monthHeaders.forEach((D, _) => {
1456
- i.set(_, D);
1389
+ const d = s.adjustedDate || o;
1390
+ e.selectedDate = d, e.input && (e.requiresApplyButton() || (e.input.value = e.formatDate(d))), e.requiresApplyButton() ? e.pendingSelection = d : e.options.onSelect && e.options.onSelect(d), e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
1391
+ } else if (e.options.selectionMode === "multiple") {
1392
+ const s = `${o.getFullYear()}-${String(o.getMonth() + 1).padStart(2, "0")}-${String(o.getDate()).padStart(2, "0")}`, d = e.selectedDates.findIndex((l) => `${l.getFullYear()}-${String(l.getMonth() + 1).padStart(2, "0")}-${String(l.getDate()).padStart(2, "0")}` === s);
1393
+ if (d !== -1 ? e.selectedDates.splice(d, 1) : e.selectedDates.push(new Date(o)), e.input && !e.requiresApplyButton()) {
1394
+ const l = e.selectedDates.length + e.selectedRanges.length;
1395
+ e.input.value = l > 0 ? `${l} selection(s)` : "";
1396
+ }
1397
+ e.selectedRanges.length > 0 && e.selectedDates.length > 0 ? e.pendingSelection = [...e.selectedRanges, ...e.selectedDates] : e.selectedRanges.length > 0 ? e.pendingSelection = e.selectedRanges : e.pendingSelection = e.selectedDates;
1398
+ } else if (!e.selectedStartDate || e.selectedEndDate)
1399
+ e.selectedStartDate = o, e.selectedEndDate = null, e.input && (e.requiresApplyButton() || (e.input.value = `${e.formatDate(e.selectedStartDate)} - ...`));
1400
+ else {
1401
+ let s = e.selectedStartDate, d = o;
1402
+ o < e.selectedStartDate && (d = e.selectedStartDate, s = o), ie.debug(" selectDay - calling validateRangeAsync with:", s, d);
1403
+ const l = await kt(e, s, d);
1404
+ if (ie.debug(" selectDay - validation result:", l), !l.isValid) {
1405
+ l.message && O.warn("selectDay() - range validation failed:", l.message), e.renderCalendar(), e.updateSummary();
1406
+ return;
1407
+ }
1408
+ e.selectedStartDate = l.adjustedStart || s, e.selectedEndDate = l.adjustedEnd || d, e.input && (e.requiresApplyButton() || (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`));
1409
+ const c = { start: e.selectedStartDate, end: e.selectedEndDate };
1410
+ e.requiresApplyButton() ? e.pendingSelection = c : e.options.onSelect && e.options.onSelect(c), e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
1411
+ }
1412
+ if (e.renderCalendar(), e.updateSummary(), e.options.selectionMode === "range" && e.selectedEndDate) {
1413
+ const s = e.selectedEndDate;
1414
+ for (let d = 0; d < e.monthDates.length; d++) {
1415
+ const l = e.monthDates[d];
1416
+ if (s.getFullYear() === l.getFullYear() && s.getMonth() === l.getMonth()) {
1417
+ e.activeMonthIndex = d;
1418
+ const c = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${d}"]`);
1419
+ if (c) {
1420
+ const u = c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = Array.from(u).findIndex((p) => {
1421
+ const f = p.dataset.date;
1422
+ if (!f) return !1;
1423
+ const [h, v, m] = f.split("-").map(Number), M = new Date(h, v - 1, m);
1424
+ return e.isSameDay(M, s);
1457
1425
  });
1426
+ g !== -1 && (e.focusedDayIndex = g, u.forEach((p) => p.classList.remove("drp-date-picker__day--focused")), u[g] && u[g].classList.add("drp-date-picker__day--focused"));
1458
1427
  }
1459
- s && ae(e), o.size > 0 && (e.bulkMetadataCache = o, w.debug(`handleInitialMonthLoad() [NON-UNIFIED] - combined metadata cache updated with ${o.size} entries`)), i.size > 0 && (e.monthHeadersCache = i, w.debug(`handleInitialMonthLoad() [NON-UNIFIED] - combined month headers cache updated with ${i.size} entries`)), (o.size > 0 || i.size > 0) && e.renderCalendar();
1428
+ break;
1460
1429
  }
1461
- } catch (o) {
1462
- ae(e), w.debug("handleInitialMonthLoad() - error in callback:", o), console.error("[DateRangePicker] Error in beforeMonthChangedCallback (initial load):", o);
1463
- } finally {
1464
- e.isMonthChanging = !1;
1465
1430
  }
1466
1431
  }
1467
1432
  }
1468
- async function Q(e, a, t, n) {
1469
- var r, o;
1470
- if (!e.options.beforeMonthChangedCallback)
1471
- return !0;
1472
- if (e.isMonthChanging)
1473
- return w.debug("handleBeforeMonthChange() - already changing month, ignoring"), !1;
1474
- try {
1475
- e.isMonthChanging = !0;
1476
- let i, s;
1477
- if (e.options.unifiedNavigation) {
1478
- let p = 1 / 0, g = 1 / 0, f = -1 / 0, h = -1 / 0;
1479
- for (let R = 0; R < e.monthDates.length; R++) {
1480
- const T = e.monthDates[R], y = T.getFullYear(), I = T.getMonth();
1481
- (y < p || y === p && I < g) && (p = y, g = I), (y > f || y === f && I > h) && (f = y, h = I);
1482
- }
1483
- const M = (new Date(p, g, 1).getDay() - e.weekStartDay + 7) % 7;
1484
- i = new Date(p, g, 1 - M);
1485
- const C = new Date(f, h + 1, 0).getDate(), D = new Date(f, h, C).getDay(), _ = (e.weekStartDay + 6 - D) % 7;
1486
- s = new Date(f, h, C + _);
1487
- } else {
1488
- const f = (new Date(a, t, 1).getDay() - e.weekStartDay + 7) % 7;
1489
- i = new Date(a, t, 1 - f), s = new Date(i), s.setDate(i.getDate() + 41);
1433
+ function an(e) {
1434
+ e.monthDates[e.activeMonthIndex] = /* @__PURE__ */ new Date(), e.selectedDate = /* @__PURE__ */ new Date(), e.input && (e.requiresApplyButton() || (e.input.value = e.formatDate(e.selectedDate))), e.requiresApplyButton() ? e.pendingSelection = e.selectedDate : e.options.onSelect && e.options.onSelect(e.selectedDate), e.renderCalendar(), e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
1435
+ }
1436
+ function nn(e) {
1437
+ e.selectedDate = null, e.selectedStartDate = null, e.selectedEndDate = null, e.selectedRanges = [], e.selectedDates = [], e.pendingSelection = null, e.dragPreviewStart = null, e.dragPreviewEnd = null, e.focusedDayIndex = null, e.input && (e.input.value = ""), e.renderCalendar(), e.updateSummary();
1438
+ }
1439
+ function rn(e) {
1440
+ if (e.input) {
1441
+ if (e.options.selectionMode === "range" && e.selectedStartDate && e.selectedEndDate)
1442
+ e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`;
1443
+ else if (e.options.selectionMode === "single" && e.selectedDate)
1444
+ e.input.value = e.formatDate(e.selectedDate);
1445
+ else if (e.options.selectionMode === "multiple") {
1446
+ const a = e.selectedDates.length + e.selectedRanges.length;
1447
+ e.input.value = a > 0 ? `${a} selection(s)` : "";
1490
1448
  }
1491
- const d = {
1492
- year: a,
1493
- month: t,
1494
- monthIndex: n,
1495
- firstVisibleDate: i,
1496
- lastVisibleDate: s
1497
- };
1498
- w.debug(`handleBeforeMonthChange() - calling callback for ${a}-${t + 1}, range: ${i.toISOString().split("T")[0]} to ${s.toISOString().split("T")[0]}`);
1499
- const l = e.options.beforeMonthChangedCallback(d), c = l instanceof Promise;
1500
- c && Te(e);
1501
- const u = await Promise.resolve(l);
1502
- return c && ae(e), u.action === "block" ? (w.debug(`handleBeforeMonthChange() - navigation blocked: ${u.message || "no reason provided"}`), u.message && console.warn(`[DateRangePicker] Month navigation blocked: ${u.message}`), !1) : (w.debug(`handleBeforeMonthChange() - navigation accepted, metadata items: ${((r = u.metadata) == null ? void 0 : r.size) || 0}, monthHeaders: ${((o = u.monthHeaders) == null ? void 0 : o.size) || 0}`), u.metadata ? e.bulkMetadataCache ? (u.metadata.forEach((p, g) => {
1503
- e.bulkMetadataCache.set(g, p);
1504
- }), w.debug(`handleBeforeMonthChange() - merged ${u.metadata.size} entries into cache (total: ${e.bulkMetadataCache.size})`)) : (e.bulkMetadataCache = u.metadata, w.debug(`handleBeforeMonthChange() - bulk metadata cache created with ${u.metadata.size} entries`)) : e.bulkMetadataCache = null, u.monthHeaders && (e.monthHeadersCache ? (u.monthHeaders.forEach((p, g) => {
1505
- e.monthHeadersCache.set(g, p);
1506
- }), w.debug(`handleBeforeMonthChange() - merged ${u.monthHeaders.size} entries into headers cache (total: ${e.monthHeadersCache.size})`)) : (e.monthHeadersCache = u.monthHeaders, w.debug(`handleBeforeMonthChange() - month headers cache created with ${u.monthHeaders.size} entries`))), !0);
1507
- } catch (i) {
1508
- return ae(e), w.debug("handleBeforeMonthChange() - error in callback:", i), console.error("[DateRangePicker] Error in beforeMonthChangedCallback:", i), !1;
1509
- } finally {
1510
- e.isMonthChanging = !1;
1511
1449
  }
1450
+ e.pendingSelection && (e.options.onSelect && e.options.onSelect(e.pendingSelection), e.pendingSelection = null), e.options.selectionMode === "range" ? (e.committedStartDate = e.selectedStartDate, e.committedEndDate = e.selectedEndDate) : e.options.selectionMode === "single" && (e.committedDate = e.selectedDate), e.options.positioningMode === "floating" && e.hide();
1512
1451
  }
1513
- function rn(e, a) {
1514
- e.showingRollingSelector[a] = !e.showingRollingSelector[a], e.renderCalendar();
1452
+ function on(e) {
1453
+ e.options.selectionMode === "range" && e.calendar.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--disabled)").forEach((t) => {
1454
+ t.addEventListener("mousedown", (n) => {
1455
+ const r = n, o = t, i = r.clientX, s = r.clientY, d = 5;
1456
+ let l = !1, c = !1;
1457
+ const u = o.classList.contains("drp-date-picker__day--range-start"), g = o.classList.contains("drp-date-picker__day--range-end");
1458
+ let p;
1459
+ u && e.selectedStartDate && e.selectedEndDate ? p = "start" : g && e.selectedStartDate && e.selectedEndDate ? p = "end" : p = "start";
1460
+ const f = (v) => {
1461
+ const m = Math.abs(v.clientX - i), M = Math.abs(v.clientY - s);
1462
+ !l && (m > d || M > d) && (l = !0), l && !c && (c = !0, Lt(e, r, p, o), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", h));
1463
+ }, h = () => {
1464
+ document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", h);
1465
+ };
1466
+ document.addEventListener("mousemove", f), document.addEventListener("mouseup", h);
1467
+ });
1468
+ });
1515
1469
  }
1516
- async function on(e, a, t) {
1517
- const n = e.monthDates[t].getMonth();
1518
- if (!await Q(e, a, n, t)) {
1519
- w.debug(`selectYear() Col${t} - navigation blocked by callback`);
1520
- return;
1470
+ function Lt(e, a, t, n) {
1471
+ a.preventDefault(), a.stopPropagation(), e.isDragging = !0, e.draggingType = t;
1472
+ const r = n, o = r.dataset.date;
1473
+ let i = null;
1474
+ if (o) {
1475
+ const [s, d, l] = o.split("-").map(Number);
1476
+ i = new Date(s, d - 1, l);
1521
1477
  }
1522
- const o = e.monthDates[t].getFullYear();
1523
- e.monthDates[t].setFullYear(a), w.debug(`selectYear() Col${t} - changed from ${o} to ${a}`), pe(e, t), e.showingRollingSelector[t] = !1, e.renderCalendar();
1478
+ !e.selectedStartDate && !e.selectedEndDate ? i && (e.originalStartDate = i, e.originalEndDate = null, e.draggingType = "end") : i && e.selectedStartDate && !e.selectedEndDate ? i.getTime() === e.selectedStartDate.getTime() ? (e.originalStartDate = new Date(e.selectedStartDate), e.originalEndDate = null) : (e.selectedStartDate = null, e.selectedEndDate = null, e.focusedDayIndex = null, e.calendar.querySelectorAll(".drp-date-picker__day--range-start, .drp-date-picker__day--range-end, .drp-date-picker__day--selected, .drp-date-picker__day--focused").forEach((d) => {
1479
+ d.classList.remove("drp-date-picker__day--range-start", "drp-date-picker__day--range-end", "drp-date-picker__day--selected", "drp-date-picker__day--focused");
1480
+ }), e.originalStartDate = i, 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"), ee.debug(`Started dragging ${t} date`), e.onDragMoveBound = (s) => $t(e, s), e.onDragEndBound = async (s) => await zt(e), document.addEventListener("mousemove", e.onDragMoveBound), document.addEventListener("mouseup", e.onDragEndBound), document.body.style.cursor = "grabbing";
1524
1481
  }
1525
- async function sn(e, a, t) {
1526
- const n = e.monthDates[t].getFullYear();
1527
- if (!await Q(e, n, a, t)) {
1528
- w.debug(`selectMonth() Col${t} - navigation blocked by callback`);
1482
+ function $t(e, a) {
1483
+ if (!e.isDragging) return;
1484
+ let t = null;
1485
+ e.containerElement instanceof ShadowRoot && "elementsFromPoint" in e.containerElement ? t = e.containerElement.elementsFromPoint(a.clientX, a.clientY)[0] || null : t = document.elementFromPoint(a.clientX, a.clientY);
1486
+ const n = t == null ? void 0 : t.closest(".drp-date-picker__nav--prev"), r = t == null ? void 0 : t.closest(".drp-date-picker__nav--next");
1487
+ if (n || r) {
1488
+ if (!e.navInterval) {
1489
+ const g = (n || r).closest(".drp-date-picker__month");
1490
+ if (g && g instanceof HTMLElement) {
1491
+ const p = parseInt(g.dataset.monthIndex || "0"), f = !!n;
1492
+ f ? e.prevMonth(p) : e.nextMonth(p), e.navInterval = window.setInterval(() => {
1493
+ f ? e.prevMonth(p) : e.nextMonth(p);
1494
+ }, 1e3);
1495
+ }
1496
+ }
1529
1497
  return;
1498
+ } else
1499
+ e.navInterval && (clearInterval(e.navInterval), e.navInterval = null);
1500
+ const o = t;
1501
+ if (!o || !o.classList.contains("drp-date-picker__day")) return;
1502
+ const i = o.dataset.date;
1503
+ if (!i) return;
1504
+ const [s, d, l] = i.split("-").map(Number);
1505
+ let c = new Date(s, d - 1, l);
1506
+ if (o.classList.contains("drp-date-picker__day--disabled")) {
1507
+ const u = e.draggingType === "start" ? e.originalEndDate && c > e.originalEndDate ? "backward" : "forward" : e.originalStartDate && c < e.originalStartDate ? "forward" : "backward";
1508
+ c = ke(e, c, u);
1530
1509
  }
1531
- const o = e.monthDates[t].getMonth();
1532
- e.monthDates[t].setMonth(a), w.debug(`selectMonth() Col${t} - changed from ${o + 1} to ${a + 1}`), pe(e, t), e.showingRollingSelector[t] = !1, e.renderCalendar();
1533
- }
1534
- function pe(e, a) {
1535
- const t = e.monthDates[a];
1536
- if (a < e.monthDates.length - 1) {
1537
- const n = e.monthDates[a + 1];
1538
- if (Le(t, n)) {
1539
- w.debug(`checkAndResolveCollisions() Col${a} - collision with Col${a + 1}, shifting forward`);
1540
- const r = new Date(t.getFullYear(), t.getMonth() + 1, 1);
1541
- e.monthDates[a + 1] = r, pe(e, a + 1);
1510
+ 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) {
1511
+ const u = e.options.disabledDatesHandling;
1512
+ if (ee.debug("onDragMove - mode:", u, "start:", e.dragPreviewStart, "end:", e.dragPreviewEnd), u === "prevent" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
1513
+ ee.debug("PREVENT mode - range contains disabled dates, blocking preview update");
1514
+ return;
1542
1515
  }
1543
1516
  }
1544
- if (a > 0) {
1545
- const n = e.monthDates[a - 1];
1546
- if (Le(n, t)) {
1547
- w.debug(`checkAndResolveCollisions() Col${a} - collision with Col${a - 1}, shifting backward`);
1548
- const r = new Date(t.getFullYear(), t.getMonth() - 1, 1);
1549
- e.monthDates[a - 1] = r, pe(e, a - 1);
1517
+ e.updateDragPreview();
1518
+ }
1519
+ async function zt(e, a) {
1520
+ if (e.isDragging) {
1521
+ if (ee.debug("Ended dragging, finalizing selection"), e.dragPreviewStart && e.dragPreviewEnd) {
1522
+ let t = ke(e, e.dragPreviewStart, "forward"), n = ke(e, e.dragPreviewEnd, "backward");
1523
+ t > n && ([t, n] = [n, t]), ee.debug("onDragEnd - calling validateRangeAsync with:", t, n);
1524
+ const r = await kt(e, t, n);
1525
+ if (ee.debug("onDragEnd - validation result:", r), !r.isValid)
1526
+ r.message && O.warn("onDragEnd() - drag validation failed:", r.message);
1527
+ else {
1528
+ e.selectedStartDate = r.adjustedStart || t, e.selectedEndDate = r.adjustedEnd || n, e.input && (e.requiresApplyButton() || (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`));
1529
+ const o = { start: e.selectedStartDate, end: e.selectedEndDate };
1530
+ e.requiresApplyButton() ? e.pendingSelection = o : e.options.onSelect && e.options.onSelect(o);
1531
+ }
1532
+ }
1533
+ if (e.isDragging = !1, e.draggingType = null, e.dragPreviewStart = null, e.dragPreviewEnd = null, e.calendar.querySelectorAll(".drp-date-picker__day--dragging").forEach((t) => {
1534
+ t.classList.remove("drp-date-picker__day--dragging");
1535
+ }), 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) {
1536
+ const t = e.selectedEndDate;
1537
+ for (let n = 0; n < e.monthDates.length; n++) {
1538
+ const r = e.monthDates[n];
1539
+ if (t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth()) {
1540
+ e.activeMonthIndex = n;
1541
+ const o = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${n}"]`);
1542
+ if (o) {
1543
+ const i = o.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), s = Array.from(i).findIndex((d) => {
1544
+ const l = d.dataset.date;
1545
+ if (!l) return !1;
1546
+ const [c, u, g] = l.split("-").map(Number), p = new Date(c, u - 1, g);
1547
+ return e.isSameDay(p, t);
1548
+ });
1549
+ s !== -1 && (e.focusedDayIndex = s, i.forEach((d) => d.classList.remove("drp-date-picker__day--focused")), i[s] && i[s].classList.add("drp-date-picker__day--focused"));
1550
+ }
1551
+ break;
1552
+ }
1553
+ }
1550
1554
  }
1555
+ e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
1551
1556
  }
1552
1557
  }
1553
- function Le(e, a) {
1554
- const t = e.getFullYear(), n = e.getMonth(), r = a.getFullYear(), o = a.getMonth();
1555
- return t > r || t === r && n >= o;
1558
+ function ke(e, a, t = "forward") {
1559
+ let r = new Date(a);
1560
+ if (r.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(r))
1561
+ return r;
1562
+ const o = t === "forward" ? 1 : -1;
1563
+ for (let s = 1; s <= 60; s++) {
1564
+ const d = new Date(a);
1565
+ if (d.setDate(d.getDate() + s * o), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
1566
+ return d;
1567
+ }
1568
+ const i = -o;
1569
+ for (let s = 1; s <= 60; s++) {
1570
+ const d = new Date(a);
1571
+ if (d.setDate(d.getDate() + s * i), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
1572
+ return d;
1573
+ }
1574
+ return a;
1556
1575
  }
1557
- async function ye(e, a) {
1558
- const t = isNaN(a) ? e.activeMonthIndex : a;
1559
- e.showingRollingSelector[t] && (e.showingRollingSelector[t] = !1);
1560
- const n = e.monthDates[t], r = new Date(n.getFullYear(), n.getMonth() - 1, 1);
1561
- if (!U(e, r.getFullYear(), r.getMonth())) {
1562
- w.debug(`prevMonth() Col${t} - navigation blocked: target month has no enabled days`);
1563
- return;
1576
+ function sn(e, a) {
1577
+ const t = a.target, n = t.value, r = t.selectionStart || 0, o = e._previousInputValue || "", i = n.length < o.length, { separator: s } = e.formatInfo;
1578
+ if (e.options.selectionMode === "range") {
1579
+ const d = n.replace(new RegExp(`[^0-9${s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}to ]`, "gi"), ""), l = Pt(e, d);
1580
+ if (l !== n) {
1581
+ t.value = l;
1582
+ let c = r;
1583
+ if (i)
1584
+ c = r;
1585
+ else if (l.length > n.length)
1586
+ if (l.includes(" to ") && !n.includes(" to ")) {
1587
+ const u = l.indexOf(" to ");
1588
+ r >= u && r <= u + 4 ? c = u + 4 : c = r + (l.length - n.length);
1589
+ } else
1590
+ c = r + (l.length - n.length);
1591
+ t.setSelectionRange(c, c);
1592
+ }
1593
+ } else {
1594
+ const d = n.replace(new RegExp(`[^0-9${s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), l = ge(e, d);
1595
+ if (l !== n) {
1596
+ t.value = l;
1597
+ let c = r;
1598
+ if (i)
1599
+ c = r;
1600
+ else if (l.length > n.length && l[r] === s)
1601
+ c = r + 1;
1602
+ else if (l.length > n.length) {
1603
+ const u = (n.substring(0, r).match(new RegExp(s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length, p = (l.substring(0, r).match(new RegExp(s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length - u;
1604
+ c = r + p;
1605
+ }
1606
+ t.setSelectionRange(c, c);
1607
+ }
1564
1608
  }
1565
- if (!await Q(e, r.getFullYear(), r.getMonth(), t)) {
1566
- w.debug(`prevMonth() Col${t} - navigation blocked by callback`);
1609
+ e._previousInputValue = t.value, He(e);
1610
+ }
1611
+ function ge(e, a) {
1612
+ var c, u, g;
1613
+ const { separator: t, parts: n, maxLength: r } = e.formatInfo, o = a.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), ""), i = n.year ? n.year.length : 4, s = [
1614
+ { type: "year", pos: ((c = n.year) == null ? void 0 : c.index) ?? 0, length: i },
1615
+ { type: "month", pos: ((u = n.month) == null ? void 0 : u.index) ?? 1, length: 2 },
1616
+ { type: "day", pos: ((g = n.day) == null ? void 0 : g.index) ?? 2, length: 2 }
1617
+ ].sort((p, f) => p.pos - f.pos);
1618
+ let d = "", l = 0;
1619
+ for (let p = 0; p < s.length; p++) {
1620
+ const f = s[p], h = o.substring(l, l + f.length);
1621
+ if (!h) break;
1622
+ d += h, l += h.length, p < s.length - 1 && h.length === f.length && (d += t);
1623
+ }
1624
+ return d.substring(0, r);
1625
+ }
1626
+ function Pt(e, a) {
1627
+ const { separator: t, maxLength: n } = e.formatInfo, r = " to ";
1628
+ let o = "", i = "";
1629
+ if (a.includes(r)) {
1630
+ const d = a.split(r);
1631
+ o = d[0], i = d.slice(1).join(r);
1632
+ } else
1633
+ o = a;
1634
+ const s = ge(e, o);
1635
+ if (s.length === n)
1636
+ if (a.includes(r)) {
1637
+ const d = ge(e, i);
1638
+ return s + r + d;
1639
+ } else
1640
+ return s + r;
1641
+ else
1642
+ return s;
1643
+ }
1644
+ function dn(e, a) {
1645
+ const { key: t, ctrlKey: n, metaKey: r } = a, { separator: o } = e.formatInfo;
1646
+ if (e.calendar.classList.contains("drp-date-picker--visible") && ["ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"].includes(t)) {
1647
+ a.preventDefault();
1567
1648
  return;
1568
1649
  }
1569
- if (e.monthDates[t] = r, w.debug(`prevMonth() Col${t} - changed from ${n.getFullYear()}-${n.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), t > 0) {
1570
- const i = e.monthDates[t - 1];
1571
- Le(i, r) && (w.debug(`prevMonth() Col${t} - collision detected with Col${t - 1}, shifting previous columns back`), await ye(e, t - 1));
1650
+ if (!([
1651
+ "Backspace",
1652
+ "Delete",
1653
+ "Tab",
1654
+ "Escape",
1655
+ "Enter",
1656
+ "ArrowLeft",
1657
+ "ArrowRight",
1658
+ "ArrowUp",
1659
+ "ArrowDown",
1660
+ "Home",
1661
+ "End"
1662
+ ].includes(t) || n || r)) {
1663
+ if (t === o) {
1664
+ const s = a.target, d = s.selectionStart || 0, l = s.value;
1665
+ let c = 0;
1666
+ for (let g = d - 1; g >= 0; g--)
1667
+ if (l[g] === o || l[g] === " ") {
1668
+ c = g + 1;
1669
+ break;
1670
+ }
1671
+ const u = l.substring(c, d);
1672
+ if (/^\d$/.test(u)) {
1673
+ a.preventDefault();
1674
+ const g = l.substring(0, c) + "0" + u + o + l.substring(d);
1675
+ s.value = g;
1676
+ const p = c + 2 + o.length;
1677
+ s.setSelectionRange(p, p), e._previousInputValue = g, s.dispatchEvent(new Event("input", { bubbles: !0 }));
1678
+ return;
1679
+ }
1680
+ }
1681
+ e.options.selectionMode === "range" ? !/^\d$/.test(t) && t !== o && t !== " " && t.toLowerCase() !== "t" && t.toLowerCase() !== "o" && a.preventDefault() : !/^\d$/.test(t) && t !== o && a.preventDefault();
1572
1682
  }
1573
- e.renderCalendar();
1574
1683
  }
1575
- async function ve(e, a) {
1576
- const t = isNaN(a) ? e.activeMonthIndex : a;
1577
- e.showingRollingSelector[t] && (e.showingRollingSelector[t] = !1);
1578
- const n = e.monthDates[t], r = new Date(n.getFullYear(), n.getMonth() + 1, 1);
1579
- if (!U(e, r.getFullYear(), r.getMonth())) {
1580
- w.debug(`nextMonth() Col${t} - navigation blocked: target month has no enabled days`);
1684
+ function ln(e, a) {
1685
+ var g;
1686
+ a.preventDefault();
1687
+ const t = ((g = a.clipboardData) == null ? void 0 : g.getData("text")) || "", { separator: n } = e.formatInfo, r = t.replace(new RegExp(`[^0-9${n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), o = ge(e, r), i = a.target, s = i.selectionStart || 0, d = i.selectionEnd || 0, l = i.value, c = l.substring(0, s) + o + l.substring(d);
1688
+ i.value = ge(e, c);
1689
+ const u = s + o.length;
1690
+ i.setSelectionRange(u, u), i.dispatchEvent(new Event("input", { bubbles: !0 })), He(e);
1691
+ }
1692
+ function He(e) {
1693
+ if (!e.input) return;
1694
+ const a = e.input.value;
1695
+ if (oe.debug("updateCalendarFromInput - value:", a), !a) {
1696
+ e.clearSelection(), e.renderCalendar();
1581
1697
  return;
1582
1698
  }
1583
- if (!await Q(e, r.getFullYear(), r.getMonth(), t)) {
1584
- w.debug(`nextMonth() Col${t} - navigation blocked by callback`);
1699
+ const { separator: t, parts: n, maxLength: r } = e.formatInfo;
1700
+ if (oe.debug("Format info:", { separator: t, parts: n, maxLength: r }), e.options.selectionMode === "range" && a.includes(" to ")) {
1701
+ const i = a.split(" to "), s = i[0], d = i[1];
1702
+ oe.debug("Range parts - start:", s, "end:", d), Se(e, s, "start"), d ? Se(e, d, "end") : e.selectedEndDate = null;
1585
1703
  return;
1586
1704
  }
1587
- if (e.monthDates[t] = r, w.debug(`nextMonth() Col${t} - changed from ${n.getFullYear()}-${n.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), t < e.monthDates.length - 1) {
1588
- const i = e.monthDates[t + 1];
1589
- Le(r, i) && (w.debug(`nextMonth() Col${t} - collision detected with Col${t + 1}, shifting next columns forward`), await ve(e, t + 1));
1590
- }
1591
- e.renderCalendar();
1705
+ const o = e.options.selectionMode === "range" ? "start" : "single";
1706
+ Se(e, a, o);
1592
1707
  }
1593
- function me(e, a, t, n, r) {
1594
- let o = a, i = 0;
1595
- const s = 60;
1596
- for (; i < s; ) {
1597
- if (o >= 0 && o < n.length) {
1598
- const l = n[o].dataset.date;
1599
- if (l) {
1600
- const [c, u, p] = l.split("-").map(Number), g = new Date(c, u - 1, p);
1601
- if (!e.isDateDisabledInternal(g))
1602
- return { index: o, monthChanged: !1 };
1708
+ function Se(e, a, t = "single") {
1709
+ const { separator: n, parts: r, maxLength: o } = e.formatInfo, i = a.split(n);
1710
+ let s = null, d = null, l = null;
1711
+ if (i.forEach((c, u) => {
1712
+ if (c) {
1713
+ if (r.year && r.year.index === u) {
1714
+ const g = parseInt(c, 10);
1715
+ r.year.length === 4 && c.length === 4 ? s = g : r.year.length === 2 && c.length === 2 && (s = g < 100 ? g + 2e3 : g);
1716
+ } else if (r.month && r.month.index === u) {
1717
+ const g = parseInt(c, 10);
1718
+ c.length === 2 && g >= 1 && g <= 12 && (d = g);
1719
+ } else if (r.day && r.day.index === u) {
1720
+ const g = parseInt(c, 10);
1721
+ c.length === 2 && g >= 1 && g <= 31 && (l = g);
1603
1722
  }
1604
1723
  }
1605
- if (o += t, i++, o < 0 || o >= n.length)
1606
- return { index: null, monthChanged: !0, direction: t > 0 ? "next" : "prev" };
1724
+ }), oe.debug(`parseAndUpdateSingleDate(${t}) - year:`, s, "month:", d, "day:", l), s !== null || d !== null) {
1725
+ const c = s || (/* @__PURE__ */ new Date()).getFullYear(), u = d !== null ? d - 1 : (/* @__PURE__ */ new Date()).getMonth();
1726
+ if (e.options.selectionMode === "single") {
1727
+ e.monthDates = [];
1728
+ for (let g = 0; g < e.options.visibleMonthsCount; g++) {
1729
+ const p = new Date(c, u + g, 1);
1730
+ e.monthDates.push(p);
1731
+ }
1732
+ } else if (e.options.selectionMode === "range" && (t === "start" || !e.selectedStartDate)) {
1733
+ if (e.displayMonths = [
1734
+ { month: u, year: c }
1735
+ ], e.options.visibleMonthsCount > 1) {
1736
+ const g = new Date(c, u + 1, 1);
1737
+ e.displayMonths.push({
1738
+ month: g.getMonth(),
1739
+ year: g.getFullYear()
1740
+ });
1741
+ }
1742
+ e.monthDates = [];
1743
+ for (let g = 0; g < e.options.visibleMonthsCount; g++) {
1744
+ const p = e.displayMonths[g], f = new Date(p.year, p.month, 1);
1745
+ e.monthDates.push(f);
1746
+ }
1747
+ }
1748
+ e.renderCalendar();
1749
+ }
1750
+ if (s !== null && d !== null && l !== null) {
1751
+ const c = new Date(s, d - 1, l);
1752
+ c.getMonth() === d - 1 && (t === "single" ? e.selectedDate = c : t === "start" ? e.selectedStartDate = c : t === "end" && (e.selectedEndDate = c), e.renderCalendar(), e.options.selectionMode === "range" && e.updateSummary(), oe.debug(`Set ${t} date:`, c));
1607
1753
  }
1608
- return { index: null, monthChanged: !1 };
1609
1754
  }
1610
- function dn(e, a) {
1611
- var i, s, d, l;
1755
+ let Ce = null;
1756
+ function Nt(e) {
1757
+ e.options.positioningMode !== "inline" && (H.debug("show() - adding visible class"), e.requiresApplyButton() && e.input && (e.originalInputValue = e.input.value, H.debug("show() - stored original input value:", e.originalInputValue)), He(e), e.isFirstRender && (e.renderCalendar(), e.isFirstRender = !1, Ht(e)), e.calendar.classList.add("drp-date-picker--visible"), e.isCalendarActive = !0, H.debug("show() - calendar classes:", e.calendar.className), Ue(e), Ce = Rt(e.input, e.calendar, () => {
1758
+ Ue(e);
1759
+ }), e.clickOutsideHandler && setTimeout(() => {
1760
+ document.addEventListener("click", e.clickOutsideHandler);
1761
+ }, 0), setTimeout(() => {
1762
+ const a = window.getComputedStyle(e.calendar);
1763
+ H.debug("show() - computed styles - display:", a.display, "position:", a.position, "left:", a.left, "top:", a.top, "z-index:", a.zIndex);
1764
+ }, 100));
1765
+ }
1766
+ function Ft(e) {
1767
+ if (e.options.positioningMode !== "inline" && e.calendar.classList.contains("drp-date-picker--visible")) {
1768
+ Ce && (Ce(), Ce = null), e.clickOutsideHandler && document.removeEventListener("click", e.clickOutsideHandler), e.calendar.classList.remove("drp-date-picker--visible"), e.isCalendarActive = !1, e.requiresApplyButton() && e.pendingSelection && e.input && (H.debug("hide() - restoring original input value:", e.originalInputValue), e.originalInputValue !== null && (e.input.value = e.originalInputValue), e.options.selectionMode === "range" ? (e.selectedStartDate = e.committedStartDate, e.selectedEndDate = e.committedEndDate) : e.options.selectionMode === "single" && (e.selectedDate = e.committedDate), H.debug("hide() - reverted selection state")), e.pendingSelection = null;
1769
+ for (let a = 0; a < e.showingRollingSelector.length; a++)
1770
+ e.showingRollingSelector[a] = !1;
1771
+ e.isFirstRender || e.renderCalendar(), e.lockedPlacement = void 0;
1772
+ }
1773
+ }
1774
+ function cn(e) {
1775
+ e.calendar.classList.contains("drp-date-picker--visible") ? Ft(e) : Nt(e);
1776
+ }
1777
+ async function Ue(e) {
1778
+ if (H.debug("position() - locked placement:", e.lockedPlacement), !e.input)
1779
+ return;
1780
+ const a = e.lockedPlacement ? [Ae(8), Te({ padding: 8 })] : [Ae(8), et(), Te({ padding: 8 })], t = await tt(e.input, e.calendar, {
1781
+ placement: e.lockedPlacement || e.options.calendarPlacement,
1782
+ middleware: a
1783
+ });
1784
+ H.debug("position() - FloatingUI computed - x:", t.x, "y:", t.y, "placement:", t.placement), e.lockedPlacement || (e.lockedPlacement = t.placement, H.debug("position() - locked placement to:", e.lockedPlacement)), e.calendar.style.left = `${t.x}px`, e.calendar.style.top = `${t.y}px`, H.debug("position() - applied styles to calendar");
1785
+ }
1786
+ async function un(e, a, t) {
1787
+ if (!e.tooltip || !e.tooltipArrow) return;
1788
+ e.currentTooltipTarget = a, e.tooltip.innerHTML = t, e.tooltip.appendChild(e.tooltipArrow), e.tooltip.classList.add("drp-date-picker__tooltip--visible");
1789
+ const { x: n, y: r, placement: o, middlewareData: i } = await tt(a, e.tooltip, {
1790
+ placement: "top",
1791
+ middleware: [
1792
+ Ae(6),
1793
+ et(),
1794
+ Te({ padding: 5 }),
1795
+ At({ element: e.tooltipArrow })
1796
+ ]
1797
+ });
1798
+ if (Object.assign(e.tooltip.style, {
1799
+ left: `${n}px`,
1800
+ top: `${r}px`
1801
+ }), i.arrow) {
1802
+ const { x: s, y: d } = i.arrow, l = {
1803
+ top: "bottom",
1804
+ right: "left",
1805
+ bottom: "top",
1806
+ left: "right"
1807
+ }[o.split("-")[0]];
1808
+ Object.assign(e.tooltipArrow.style, {
1809
+ left: s != null ? `${s}px` : "",
1810
+ top: d != null ? `${d}px` : "",
1811
+ right: "",
1812
+ bottom: "",
1813
+ [l]: "-4px"
1814
+ });
1815
+ }
1816
+ }
1817
+ function gn(e) {
1818
+ e.tooltip && (e.tooltip.classList.remove("drp-date-picker__tooltip--visible"), e.currentTooltipTarget = void 0);
1819
+ }
1820
+ function Le(e) {
1821
+ if (e.loadingOverlay) return;
1822
+ const a = document.createElement("div");
1823
+ a.className = "drp-date-picker__loading-overlay", a.innerHTML = `
1824
+ <div class="drp-date-picker__loading-spinner"></div>
1825
+ `, e.calendar.appendChild(a), e.loadingOverlay = a;
1826
+ }
1827
+ function ae(e) {
1828
+ e.loadingOverlay && (e.loadingOverlay.remove(), e.loadingOverlay = void 0);
1829
+ }
1830
+ function U(e, a, t) {
1831
+ for (let n = 1; n <= 31; n++) {
1832
+ const r = new Date(a, t, n);
1833
+ if (r.getMonth() === t && !e.isDateDisabledInternal(r))
1834
+ return !0;
1835
+ }
1836
+ return !1;
1837
+ }
1838
+ async function Ht(e) {
1839
+ var a, t, n, r;
1840
+ if (e.options.beforeMonthChangedCallback) {
1841
+ if (e.isMonthChanging) {
1842
+ w.debug("handleInitialMonthLoad() - already changing month, skipping");
1843
+ return;
1844
+ }
1845
+ try {
1846
+ if (e.isMonthChanging = !0, e.options.unifiedNavigation) {
1847
+ const o = e.options.unifiedNavigationAnchorIndex ?? 0, i = e.monthDates[o], s = i.getFullYear(), d = i.getMonth();
1848
+ let l = 1 / 0, c = 1 / 0, u = -1 / 0, g = -1 / 0;
1849
+ for (let I = 0; I < e.monthDates.length; I++) {
1850
+ const S = e.monthDates[I], E = S.getFullYear(), T = S.getMonth();
1851
+ (E < l || E === l && T < c) && (l = E, c = T), (E > u || E === u && T > g) && (u = E, g = T);
1852
+ }
1853
+ const h = (new Date(l, c, 1).getDay() - e.weekStartDay + 7) % 7, v = new Date(l, c, 1 - h), m = new Date(u, g + 1, 0).getDate(), C = new Date(u, g, m).getDay(), x = (e.weekStartDay + 6 - C) % 7, D = new Date(u, g, m + x), _ = {
1854
+ year: s,
1855
+ month: d,
1856
+ monthIndex: o,
1857
+ firstVisibleDate: v,
1858
+ lastVisibleDate: D
1859
+ };
1860
+ w.debug(`handleInitialMonthLoad() [UNIFIED] - calling callback for ${s}-${d + 1}, range: ${v.toISOString().split("T")[0]} to ${D.toISOString().split("T")[0]}`);
1861
+ const R = e.options.beforeMonthChangedCallback(_), k = R instanceof Promise;
1862
+ k && Le(e);
1863
+ const y = await Promise.resolve(R);
1864
+ k && ae(e), w.debug(`handleInitialMonthLoad() [UNIFIED] - callback completed, metadata items: ${((a = y.metadata) == null ? void 0 : a.size) || 0}, monthHeaders: ${((t = y.monthHeaders) == null ? void 0 : t.size) || 0}`), y.metadata && (e.bulkMetadataCache = y.metadata, w.debug(`handleInitialMonthLoad() [UNIFIED] - bulk metadata cache updated with ${y.metadata.size} entries`)), y.monthHeaders && (e.monthHeadersCache = y.monthHeaders, w.debug(`handleInitialMonthLoad() [UNIFIED] - month headers cache updated with ${y.monthHeaders.size} entries`)), (y.metadata || y.monthHeaders) && e.renderCalendar();
1865
+ } else {
1866
+ w.debug(`handleInitialMonthLoad() [NON-UNIFIED] - calling callback for ${e.monthDates.length} months`);
1867
+ const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
1868
+ let s = !1;
1869
+ for (let d = 0; d < e.monthDates.length; d++) {
1870
+ const l = e.monthDates[d], c = l.getFullYear(), u = l.getMonth(), f = (new Date(c, u, 1).getDay() - e.weekStartDay + 7) % 7, h = new Date(c, u, 1 - f), v = new Date(h);
1871
+ v.setDate(h.getDate() + 41);
1872
+ const m = {
1873
+ year: c,
1874
+ month: u,
1875
+ monthIndex: d,
1876
+ firstVisibleDate: h,
1877
+ lastVisibleDate: v
1878
+ };
1879
+ w.debug(`handleInitialMonthLoad() [NON-UNIFIED] Col${d} - calling callback for ${c}-${u + 1}, range: ${h.toISOString().split("T")[0]} to ${v.toISOString().split("T")[0]}`);
1880
+ const M = e.options.beforeMonthChangedCallback(m);
1881
+ M instanceof Promise && !s && (s = !0, Le(e));
1882
+ const x = await Promise.resolve(M);
1883
+ w.debug(`handleInitialMonthLoad() [NON-UNIFIED] Col${d} - callback completed, metadata items: ${((n = x.metadata) == null ? void 0 : n.size) || 0}, monthHeaders: ${((r = x.monthHeaders) == null ? void 0 : r.size) || 0}`), x.metadata && x.metadata.forEach((D, _) => {
1884
+ o.set(_, D);
1885
+ }), x.monthHeaders && x.monthHeaders.forEach((D, _) => {
1886
+ i.set(_, D);
1887
+ });
1888
+ }
1889
+ s && ae(e), o.size > 0 && (e.bulkMetadataCache = o, w.debug(`handleInitialMonthLoad() [NON-UNIFIED] - combined metadata cache updated with ${o.size} entries`)), i.size > 0 && (e.monthHeadersCache = i, w.debug(`handleInitialMonthLoad() [NON-UNIFIED] - combined month headers cache updated with ${i.size} entries`)), (o.size > 0 || i.size > 0) && e.renderCalendar();
1890
+ }
1891
+ } catch (o) {
1892
+ ae(e), w.debug("handleInitialMonthLoad() - error in callback:", o), console.error("[DateRangePicker] Error in beforeMonthChangedCallback (initial load):", o);
1893
+ } finally {
1894
+ e.isMonthChanging = !1;
1895
+ }
1896
+ }
1897
+ }
1898
+ async function Q(e, a, t, n) {
1899
+ var r, o;
1900
+ if (!e.options.beforeMonthChangedCallback)
1901
+ return !0;
1902
+ if (e.isMonthChanging)
1903
+ return w.debug("handleBeforeMonthChange() - already changing month, ignoring"), !1;
1904
+ try {
1905
+ e.isMonthChanging = !0;
1906
+ let i, s;
1907
+ if (e.options.unifiedNavigation) {
1908
+ let g = 1 / 0, p = 1 / 0, f = -1 / 0, h = -1 / 0;
1909
+ for (let R = 0; R < e.monthDates.length; R++) {
1910
+ const k = e.monthDates[R], y = k.getFullYear(), I = k.getMonth();
1911
+ (y < g || y === g && I < p) && (g = y, p = I), (y > f || y === f && I > h) && (f = y, h = I);
1912
+ }
1913
+ const M = (new Date(g, p, 1).getDay() - e.weekStartDay + 7) % 7;
1914
+ i = new Date(g, p, 1 - M);
1915
+ const C = new Date(f, h + 1, 0).getDate(), D = new Date(f, h, C).getDay(), _ = (e.weekStartDay + 6 - D) % 7;
1916
+ s = new Date(f, h, C + _);
1917
+ } else {
1918
+ const f = (new Date(a, t, 1).getDay() - e.weekStartDay + 7) % 7;
1919
+ i = new Date(a, t, 1 - f), s = new Date(i), s.setDate(i.getDate() + 41);
1920
+ }
1921
+ const d = {
1922
+ year: a,
1923
+ month: t,
1924
+ monthIndex: n,
1925
+ firstVisibleDate: i,
1926
+ lastVisibleDate: s
1927
+ };
1928
+ w.debug(`handleBeforeMonthChange() - calling callback for ${a}-${t + 1}, range: ${i.toISOString().split("T")[0]} to ${s.toISOString().split("T")[0]}`);
1929
+ const l = e.options.beforeMonthChangedCallback(d), c = l instanceof Promise;
1930
+ c && Le(e);
1931
+ const u = await Promise.resolve(l);
1932
+ return c && ae(e), u.action === "block" ? (w.debug(`handleBeforeMonthChange() - navigation blocked: ${u.message || "no reason provided"}`), u.message && console.warn(`[DateRangePicker] Month navigation blocked: ${u.message}`), !1) : (w.debug(`handleBeforeMonthChange() - navigation accepted, metadata items: ${((r = u.metadata) == null ? void 0 : r.size) || 0}, monthHeaders: ${((o = u.monthHeaders) == null ? void 0 : o.size) || 0}`), u.metadata ? e.bulkMetadataCache ? (u.metadata.forEach((g, p) => {
1933
+ e.bulkMetadataCache.set(p, g);
1934
+ }), w.debug(`handleBeforeMonthChange() - merged ${u.metadata.size} entries into cache (total: ${e.bulkMetadataCache.size})`)) : (e.bulkMetadataCache = u.metadata, w.debug(`handleBeforeMonthChange() - bulk metadata cache created with ${u.metadata.size} entries`)) : e.bulkMetadataCache = null, u.monthHeaders && (e.monthHeadersCache ? (u.monthHeaders.forEach((g, p) => {
1935
+ e.monthHeadersCache.set(p, g);
1936
+ }), w.debug(`handleBeforeMonthChange() - merged ${u.monthHeaders.size} entries into headers cache (total: ${e.monthHeadersCache.size})`)) : (e.monthHeadersCache = u.monthHeaders, w.debug(`handleBeforeMonthChange() - month headers cache created with ${u.monthHeaders.size} entries`))), !0);
1937
+ } catch (i) {
1938
+ return ae(e), w.debug("handleBeforeMonthChange() - error in callback:", i), console.error("[DateRangePicker] Error in beforeMonthChangedCallback:", i), !1;
1939
+ } finally {
1940
+ e.isMonthChanging = !1;
1941
+ }
1942
+ }
1943
+ function pn(e, a) {
1944
+ e.showingRollingSelector[a] = !e.showingRollingSelector[a], e.renderCalendar();
1945
+ }
1946
+ async function hn(e, a, t) {
1947
+ const n = e.monthDates[t].getMonth();
1948
+ if (!await Q(e, a, n, t)) {
1949
+ w.debug(`selectYear() Col${t} - navigation blocked by callback`);
1950
+ return;
1951
+ }
1952
+ const o = e.monthDates[t].getFullYear();
1953
+ e.monthDates[t].setFullYear(a), w.debug(`selectYear() Col${t} - changed from ${o} to ${a}`), pe(e, t), e.showingRollingSelector[t] = !1, e.renderCalendar();
1954
+ }
1955
+ async function fn(e, a, t) {
1956
+ const n = e.monthDates[t].getFullYear();
1957
+ if (!await Q(e, n, a, t)) {
1958
+ w.debug(`selectMonth() Col${t} - navigation blocked by callback`);
1959
+ return;
1960
+ }
1961
+ const o = e.monthDates[t].getMonth();
1962
+ e.monthDates[t].setMonth(a), w.debug(`selectMonth() Col${t} - changed from ${o + 1} to ${a + 1}`), pe(e, t), e.showingRollingSelector[t] = !1, e.renderCalendar();
1963
+ }
1964
+ function pe(e, a) {
1965
+ const t = e.monthDates[a];
1966
+ if (a < e.monthDates.length - 1) {
1967
+ const n = e.monthDates[a + 1];
1968
+ if ($e(t, n)) {
1969
+ w.debug(`checkAndResolveCollisions() Col${a} - collision with Col${a + 1}, shifting forward`);
1970
+ const r = new Date(t.getFullYear(), t.getMonth() + 1, 1);
1971
+ e.monthDates[a + 1] = r, pe(e, a + 1);
1972
+ }
1973
+ }
1974
+ if (a > 0) {
1975
+ const n = e.monthDates[a - 1];
1976
+ if ($e(n, t)) {
1977
+ w.debug(`checkAndResolveCollisions() Col${a} - collision with Col${a - 1}, shifting backward`);
1978
+ const r = new Date(t.getFullYear(), t.getMonth() - 1, 1);
1979
+ e.monthDates[a - 1] = r, pe(e, a - 1);
1980
+ }
1981
+ }
1982
+ }
1983
+ function $e(e, a) {
1984
+ const t = e.getFullYear(), n = e.getMonth(), r = a.getFullYear(), o = a.getMonth();
1985
+ return t > r || t === r && n >= o;
1986
+ }
1987
+ async function ye(e, a) {
1988
+ const t = isNaN(a) ? e.activeMonthIndex : a;
1989
+ e.showingRollingSelector[t] && (e.showingRollingSelector[t] = !1);
1990
+ const n = e.monthDates[t], r = new Date(n.getFullYear(), n.getMonth() - 1, 1);
1991
+ if (!U(e, r.getFullYear(), r.getMonth())) {
1992
+ w.debug(`prevMonth() Col${t} - navigation blocked: target month has no enabled days`);
1993
+ return;
1994
+ }
1995
+ if (!await Q(e, r.getFullYear(), r.getMonth(), t)) {
1996
+ w.debug(`prevMonth() Col${t} - navigation blocked by callback`);
1997
+ return;
1998
+ }
1999
+ if (e.monthDates[t] = r, w.debug(`prevMonth() Col${t} - changed from ${n.getFullYear()}-${n.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), t > 0) {
2000
+ const i = e.monthDates[t - 1];
2001
+ $e(i, r) && (w.debug(`prevMonth() Col${t} - collision detected with Col${t - 1}, shifting previous columns back`), await ye(e, t - 1));
2002
+ }
2003
+ e.renderCalendar();
2004
+ }
2005
+ async function ve(e, a) {
2006
+ const t = isNaN(a) ? e.activeMonthIndex : a;
2007
+ e.showingRollingSelector[t] && (e.showingRollingSelector[t] = !1);
2008
+ const n = e.monthDates[t], r = new Date(n.getFullYear(), n.getMonth() + 1, 1);
2009
+ if (!U(e, r.getFullYear(), r.getMonth())) {
2010
+ w.debug(`nextMonth() Col${t} - navigation blocked: target month has no enabled days`);
2011
+ return;
2012
+ }
2013
+ if (!await Q(e, r.getFullYear(), r.getMonth(), t)) {
2014
+ w.debug(`nextMonth() Col${t} - navigation blocked by callback`);
2015
+ return;
2016
+ }
2017
+ if (e.monthDates[t] = r, w.debug(`nextMonth() Col${t} - changed from ${n.getFullYear()}-${n.getMonth() + 1} to ${r.getFullYear()}-${r.getMonth() + 1}`), t < e.monthDates.length - 1) {
2018
+ const i = e.monthDates[t + 1];
2019
+ $e(r, i) && (w.debug(`nextMonth() Col${t} - collision detected with Col${t + 1}, shifting next columns forward`), await ve(e, t + 1));
2020
+ }
2021
+ e.renderCalendar();
2022
+ }
2023
+ function me(e, a, t, n, r) {
2024
+ let o = a, i = 0;
2025
+ const s = 60;
2026
+ for (; i < s; ) {
2027
+ if (o >= 0 && o < n.length) {
2028
+ const l = n[o].dataset.date;
2029
+ if (l) {
2030
+ const [c, u, g] = l.split("-").map(Number), p = new Date(c, u - 1, g);
2031
+ if (!e.isDateDisabledInternal(p))
2032
+ return { index: o, monthChanged: !1 };
2033
+ }
2034
+ }
2035
+ if (o += t, i++, o < 0 || o >= n.length)
2036
+ return { index: null, monthChanged: !0, direction: t > 0 ? "next" : "prev" };
2037
+ }
2038
+ return { index: null, monthChanged: !1 };
2039
+ }
2040
+ function mn(e, a) {
2041
+ var i, s, d, l;
1612
2042
  w.debug(`moveFocus(${a}) Col${e.activeMonthIndex} - focusedDayIndex:`, e.focusedDayIndex);
1613
2043
  const t = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
1614
2044
  if (!t) {
@@ -1630,21 +2060,21 @@ function dn(e, a) {
1630
2060
  var f, h;
1631
2061
  const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
1632
2062
  if (!u) return;
1633
- const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = me(e, p.length - 1, -1, p);
1634
- g.index !== null && (e.focusedDayIndex = g.index, (f = p[e.focusedDayIndex]) == null || f.classList.add("drp-date-picker__day--focused"), (h = p[e.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
2063
+ const g = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = me(e, g.length - 1, -1, g);
2064
+ p.index !== null && (e.focusedDayIndex = p.index, (f = g[e.focusedDayIndex]) == null || f.classList.add("drp-date-picker__day--focused"), (h = g[e.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
1635
2065
  }, 0);
1636
2066
  else {
1637
- const p = n[e.focusedDayIndex].dataset.date;
1638
- if (p) {
1639
- const [g, f, h] = p.split("-").map(Number), m = new Date(g, f - 1, h).getDay();
2067
+ const g = n[e.focusedDayIndex].dataset.date;
2068
+ if (g) {
2069
+ const [p, f, h] = g.split("-").map(Number), m = new Date(p, f - 1, h).getDay();
1640
2070
  w.debug(`moveFocus() Col${c} - edge navigation UP: current day ${h} is weekday ${m}, going to prev month`), ye(e, e.activeMonthIndex), setTimeout(() => {
1641
2071
  var _, R;
1642
2072
  const M = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
1643
2073
  if (!M) return;
1644
2074
  const C = M.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), D = C[C.length - 1].dataset.date;
1645
2075
  if (D) {
1646
- const [T, y, I] = D.split("-").map(Number), E = new Date(T, y - 1, I).getDay(), k = (E - m + 7) % 7;
1647
- e.focusedDayIndex = C.length - 1 - k, w.debug(`moveFocus() Col${c} - last day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (_ = C[e.focusedDayIndex]) == null || _.classList.add("drp-date-picker__day--focused"), (R = C[e.focusedDayIndex]) == null || R.scrollIntoView({ block: "nearest" });
2076
+ const [k, y, I] = D.split("-").map(Number), E = new Date(k, y - 1, I).getDay(), T = (E - m + 7) % 7;
2077
+ e.focusedDayIndex = C.length - 1 - T, w.debug(`moveFocus() Col${c} - last day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (_ = C[e.focusedDayIndex]) == null || _.classList.add("drp-date-picker__day--focused"), (R = C[e.focusedDayIndex]) == null || R.scrollIntoView({ block: "nearest" });
1648
2078
  }
1649
2079
  }, 0);
1650
2080
  }
@@ -1657,21 +2087,21 @@ function dn(e, a) {
1657
2087
  var f, h;
1658
2088
  const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
1659
2089
  if (!u) return;
1660
- const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = me(e, 0, 1, p);
1661
- g.index !== null && (e.focusedDayIndex = g.index, (f = p[e.focusedDayIndex]) == null || f.classList.add("drp-date-picker__day--focused"), (h = p[e.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
2090
+ const g = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = me(e, 0, 1, g);
2091
+ p.index !== null && (e.focusedDayIndex = p.index, (f = g[e.focusedDayIndex]) == null || f.classList.add("drp-date-picker__day--focused"), (h = g[e.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
1662
2092
  }, 0);
1663
2093
  else {
1664
- const p = n[e.focusedDayIndex].dataset.date;
1665
- if (p) {
1666
- const [g, f, h] = p.split("-").map(Number), m = new Date(g, f - 1, h).getDay();
2094
+ const g = n[e.focusedDayIndex].dataset.date;
2095
+ if (g) {
2096
+ const [p, f, h] = g.split("-").map(Number), m = new Date(p, f - 1, h).getDay();
1667
2097
  w.debug(`moveFocus() Col${c} - edge navigation DOWN: current day ${h} is weekday ${m}, going to next month`), ve(e, e.activeMonthIndex), setTimeout(() => {
1668
2098
  var _, R;
1669
2099
  const M = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
1670
2100
  if (!M) return;
1671
2101
  const C = M.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), D = C[0].dataset.date;
1672
2102
  if (D) {
1673
- const [T, y, I] = D.split("-").map(Number), E = new Date(T, y - 1, I).getDay(), k = (m - E + 7) % 7;
1674
- e.focusedDayIndex = k, w.debug(`moveFocus() Col${c} - first day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (_ = C[e.focusedDayIndex]) == null || _.classList.add("drp-date-picker__day--focused"), (R = C[e.focusedDayIndex]) == null || R.scrollIntoView({ block: "nearest" });
2103
+ const [k, y, I] = D.split("-").map(Number), E = new Date(k, y - 1, I).getDay(), T = (m - E + 7) % 7;
2104
+ e.focusedDayIndex = T, w.debug(`moveFocus() Col${c} - first day weekday ${E}, target ${m}, focusing on day ${e.focusedDayIndex + 1}`), (_ = C[e.focusedDayIndex]) == null || _.classList.add("drp-date-picker__day--focused"), (R = C[e.focusedDayIndex]) == null || R.scrollIntoView({ block: "nearest" });
1675
2105
  }
1676
2106
  }, 0);
1677
2107
  }
@@ -1685,19 +2115,19 @@ function dn(e, a) {
1685
2115
  var f, h;
1686
2116
  const u = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${c}"] .drp-date-picker__days`);
1687
2117
  if (!u) return;
1688
- const p = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), g = me(
2118
+ const g = u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = me(
1689
2119
  e,
1690
- o.direction === "next" ? 0 : p.length - 1,
2120
+ o.direction === "next" ? 0 : g.length - 1,
1691
2121
  a,
1692
- p
2122
+ g
1693
2123
  );
1694
- g.index !== null && (e.focusedDayIndex = g.index, (f = p[e.focusedDayIndex]) == null || f.classList.add("drp-date-picker__day--focused"), (h = p[e.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
2124
+ p.index !== null && (e.focusedDayIndex = p.index, (f = g[e.focusedDayIndex]) == null || f.classList.add("drp-date-picker__day--focused"), (h = g[e.focusedDayIndex]) == null || h.scrollIntoView({ block: "nearest" }));
1695
2125
  }, 0);
1696
2126
  return;
1697
2127
  }
1698
2128
  o.index !== null ? (e.focusedDayIndex = o.index, (s = n[e.focusedDayIndex]) == null || s.classList.add("drp-date-picker__day--focused"), (d = n[e.focusedDayIndex]) == null || d.scrollIntoView({ block: "nearest" })) : (w.debug("moveFocus() - no enabled day found in search range"), (l = n[e.focusedDayIndex]) == null || l.classList.add("drp-date-picker__day--focused"));
1699
2129
  }
1700
- async function ln(e) {
2130
+ async function bn(e) {
1701
2131
  if (!e.options.unifiedNavigation) return;
1702
2132
  const a = e.options.unifiedNavigationAnchorIndex ?? 0, t = e.monthDates[a], n = new Date(t.getFullYear(), t.getMonth() + 1, 1);
1703
2133
  if (w.debug(`unifiedNextMonth() - anchor index: ${a}, current: ${t.getFullYear()}-${t.getMonth() + 1}, new: ${n.getFullYear()}-${n.getMonth() + 1}`), !U(e, n.getFullYear(), n.getMonth())) {
@@ -1712,7 +2142,7 @@ async function ln(e) {
1712
2142
  e.renderCalendar();
1713
2143
  }
1714
2144
  }
1715
- async function cn(e) {
2145
+ async function yn(e) {
1716
2146
  if (!e.options.unifiedNavigation) return;
1717
2147
  const a = e.options.unifiedNavigationAnchorIndex ?? 0, t = e.monthDates[a], n = new Date(t.getFullYear(), t.getMonth() - 1, 1);
1718
2148
  if (w.debug(`unifiedPrevMonth() - anchor index: ${a}, current: ${t.getFullYear()}-${t.getMonth() + 1}, new: ${n.getFullYear()}-${n.getMonth() + 1}`), !U(e, n.getFullYear(), n.getMonth())) {
@@ -1727,7 +2157,7 @@ async function cn(e) {
1727
2157
  e.renderCalendar();
1728
2158
  }
1729
2159
  }
1730
- async function un(e, a) {
2160
+ async function vn(e, a) {
1731
2161
  if (!e.options.unifiedNavigation) return;
1732
2162
  const t = e.options.unifiedNavigationAnchorIndex ?? 0, n = e.monthDates[t].getFullYear();
1733
2163
  if (w.debug(`setUnifiedMonth(${a}) - anchor index: ${t}, year: ${n}`), !!await Q(e, n, a, t)) {
@@ -1738,10 +2168,10 @@ async function un(e, a) {
1738
2168
  e.showingUnifiedRollingSelector = !1, e.renderCalendar();
1739
2169
  }
1740
2170
  }
1741
- function pn(e) {
2171
+ function Dn(e) {
1742
2172
  e.options.unifiedNavigation && (e.showingUnifiedRollingSelector = !e.showingUnifiedRollingSelector, w.debug(`toggleUnifiedRollingSelector() - now ${e.showingUnifiedRollingSelector ? "visible" : "hidden"}`), e.renderCalendar());
1743
2173
  }
1744
- async function gn(e, a) {
2174
+ async function _n(e, a) {
1745
2175
  if (!e.options.unifiedNavigation) return;
1746
2176
  const t = e.options.unifiedNavigationAnchorIndex ?? 0, n = e.monthDates[t].getMonth();
1747
2177
  if (w.debug(`setUnifiedYear(${a}) - anchor index: ${t}, month: ${n}`), !!await Q(e, a, n, t)) {
@@ -1752,7 +2182,7 @@ async function gn(e, a) {
1752
2182
  e.showingUnifiedRollingSelector = !1, e.renderCalendar();
1753
2183
  }
1754
2184
  }
1755
- function $t(e, a, t) {
2185
+ function Ot(e, a, t) {
1756
2186
  if (!e) {
1757
2187
  if (t != null && t.normalizedMinDate || t != null && t.normalizedMaxDate) {
1758
2188
  const n = t.normalizedMinDate ? t.normalizedMinDate.getFullYear() : a - 1, r = t.normalizedMaxDate ? t.normalizedMaxDate.getFullYear() : a + 1;
@@ -1768,16 +2198,16 @@ function $t(e, a, t) {
1768
2198
  return { min: n, max: n };
1769
2199
  }
1770
2200
  }
1771
- function zt(e) {
2201
+ function Yt(e) {
1772
2202
  if (!e)
1773
2203
  return { min: 1, max: 12 };
1774
2204
  const [a, t] = e.split("-");
1775
2205
  return { min: parseInt(a, 10), max: parseInt(t, 10) };
1776
2206
  }
1777
- function hn(e) {
1778
- de.debug("[DatePicker 18] renderCalendar called, showingRollingSelector:", e.showingRollingSelector, `activeCol: ${e.activeMonthIndex}`), de.debug("[DatePicker 18] monthDates array:", e.monthDates.map((a, t) => `Col${t}: ${a.getFullYear()}-${a.getMonth() + 1}`).join(", ")), e.options.unifiedNavigation && e.showingUnifiedRollingSelector && mn(e);
2207
+ function wn(e) {
2208
+ de.debug("[DatePicker 18] renderCalendar called, showingRollingSelector:", e.showingRollingSelector, `activeCol: ${e.activeMonthIndex}`), de.debug("[DatePicker 18] monthDates array:", e.monthDates.map((a, t) => `Col${t}: ${a.getFullYear()}-${a.getMonth() + 1}`).join(", ")), e.options.unifiedNavigation && e.showingUnifiedRollingSelector && Mn(e);
1779
2209
  for (let a = 0; a < e.options.visibleMonthsCount; a++)
1780
- e.showingRollingSelector[a] ? Ft(e, a) : Pt(e, a);
2210
+ e.showingRollingSelector[a] ? qt(e, a) : Bt(e, a);
1781
2211
  if (e.focusedDayIndex !== null) {
1782
2212
  const a = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${e.activeMonthIndex}"]`);
1783
2213
  if (a) {
@@ -1787,7 +2217,7 @@ function hn(e) {
1787
2217
  }
1788
2218
  e.options.selectionMode === "range" && !e.isDragging && e.initDragListeners(), e.actionsContainer && e.renderButtons(e.actionsContainer);
1789
2219
  }
1790
- function Pt(e, a) {
2220
+ function Bt(e, a) {
1791
2221
  var C;
1792
2222
  de.debug(`[DatePicker Col${a} 19] renderNormalView called for month`, a);
1793
2223
  const t = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${a}"]`);
@@ -1820,37 +2250,37 @@ function Pt(e, a) {
1820
2250
  const y = e.monthNames[x.getMonth()], I = e.monthNames[D.getMonth()], S = x.getFullYear(), E = D.getFullYear();
1821
2251
  S === E ? e.unifiedRangeDisplay.textContent = `${y} ${S} - ${I} ${E}` : e.unifiedRangeDisplay.textContent = `${y} ${S} - ${I} ${E}`;
1822
2252
  }
1823
- const T = e.unifiedHeader;
1824
- if (T) {
1825
- const y = x.getMonth() === 0 ? x.getFullYear() - 1 : x.getFullYear(), I = x.getMonth() === 0 ? 11 : x.getMonth() - 1, S = T.querySelector(".drp-date-picker__nav--prev");
2253
+ const k = e.unifiedHeader;
2254
+ if (k) {
2255
+ const y = x.getMonth() === 0 ? x.getFullYear() - 1 : x.getFullYear(), I = x.getMonth() === 0 ? 11 : x.getMonth() - 1, S = k.querySelector(".drp-date-picker__nav--prev");
1826
2256
  S && (U(e, y, I) ? (S.removeAttribute("disabled"), S.classList.remove("drp-date-picker__nav--disabled")) : (S.setAttribute("disabled", "true"), S.classList.add("drp-date-picker__nav--disabled")));
1827
- const E = D.getMonth() === 11 ? D.getFullYear() + 1 : D.getFullYear(), k = D.getMonth() === 11 ? 0 : D.getMonth() + 1, A = T.querySelector(".drp-date-picker__nav--next");
1828
- A && (U(e, E, k) ? (A.removeAttribute("disabled"), A.classList.remove("drp-date-picker__nav--disabled")) : (A.setAttribute("disabled", "true"), A.classList.add("drp-date-picker__nav--disabled")));
2257
+ const E = D.getMonth() === 11 ? D.getFullYear() + 1 : D.getFullYear(), T = D.getMonth() === 11 ? 0 : D.getMonth() + 1, A = k.querySelector(".drp-date-picker__nav--next");
2258
+ A && (U(e, E, T) ? (A.removeAttribute("disabled"), A.classList.remove("drp-date-picker__nav--disabled")) : (A.setAttribute("disabled", "true"), A.classList.add("drp-date-picker__nav--disabled")));
1829
2259
  }
1830
2260
  }
1831
- const l = r.getFullYear(), c = r.getMonth(), u = c === 0 ? 11 : c - 1, p = c === 0 ? l - 1 : l, g = t.querySelector(".drp-date-picker__nav--prev");
1832
- g && (U(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")));
2261
+ const l = r.getFullYear(), c = r.getMonth(), u = c === 0 ? 11 : c - 1, g = c === 0 ? l - 1 : l, p = t.querySelector(".drp-date-picker__nav--prev");
2262
+ p && (U(e, g, u) ? (p.removeAttribute("disabled"), p.classList.remove("drp-date-picker__nav--disabled")) : (p.setAttribute("disabled", "true"), p.classList.add("drp-date-picker__nav--disabled")));
1833
2263
  const f = c === 11 ? 0 : c + 1, h = c === 11 ? l + 1 : l, v = t.querySelector(".drp-date-picker__nav--next");
1834
2264
  v && (U(e, h, f) ? (v.removeAttribute("disabled"), v.classList.remove("drp-date-picker__nav--disabled")) : (v.setAttribute("disabled", "true"), v.classList.add("drp-date-picker__nav--disabled")));
1835
2265
  const m = t.querySelector(".drp-date-picker__weekdays"), M = [
1836
2266
  ...e.weekdayNames.slice(e.weekStartDay),
1837
2267
  ...e.weekdayNames.slice(0, e.weekStartDay)
1838
2268
  ];
1839
- m && (m.innerHTML = M.map((x) => `<div class="drp-date-picker__weekday">${x}</div>`).join("")), Nt(e, a, r);
2269
+ m && (m.innerHTML = M.map((x) => `<div class="drp-date-picker__weekday">${x}</div>`).join("")), Vt(e, a, r);
1840
2270
  }
1841
- function Nt(e, a, t) {
2271
+ function Vt(e, a, t) {
1842
2272
  de.debug(`[DatePicker Col${a} 20] renderDays called for month`, a);
1843
2273
  const n = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${a}"]`);
1844
2274
  if (!n) return;
1845
2275
  const r = n.querySelector(".drp-date-picker__days"), o = t.getFullYear(), i = t.getMonth();
1846
2276
  de.debug(`[DatePicker Col${a} 21] Rendering days for:`, o, i + 1);
1847
- const d = (new Date(o, i, 1).getDay() - e.weekStartDay + 7) % 7, l = new Date(o, i + 1, 0).getDate(), c = new Date(o, i, 0).getDate(), u = new Date(o, i - 1, 1), p = u.getFullYear(), g = u.getMonth(), f = new Date(o, i + 1, 1), h = f.getFullYear(), v = f.getMonth(), m = [];
2277
+ const d = (new Date(o, i, 1).getDay() - e.weekStartDay + 7) % 7, l = new Date(o, i + 1, 0).getDate(), c = new Date(o, i, 0).getDate(), u = new Date(o, i - 1, 1), g = u.getFullYear(), p = u.getMonth(), f = new Date(o, i + 1, 1), h = f.getFullYear(), v = f.getMonth(), m = [];
1848
2278
  for (let _ = d - 1; _ >= 0; _--) {
1849
- const R = c - _, T = new Date(p, g, R);
2279
+ const R = c - _, k = new Date(g, p, R);
1850
2280
  m.push({
1851
- date: T,
1852
- year: p,
1853
- month: g,
2281
+ date: k,
2282
+ year: g,
2283
+ month: p,
1854
2284
  day: R,
1855
2285
  isOtherMonth: !0
1856
2286
  });
@@ -1885,7 +2315,7 @@ function Nt(e, a, t) {
1885
2315
  const I = e.getDateInfoInternal(y.date);
1886
2316
  let S = (I == null ? void 0 : I.badgeTooltip) || "";
1887
2317
  if (e.options.badgeTooltipCallback && (I != null && I.badgeText)) {
1888
- const k = {
2318
+ const T = {
1889
2319
  date: y.date,
1890
2320
  dateString: be(y.date),
1891
2321
  dayNumber: y.day,
@@ -1901,7 +2331,7 @@ function Nt(e, a, t) {
1901
2331
  element: null,
1902
2332
  // Not available during string rendering
1903
2333
  picker: e
1904
- }, A = e.options.badgeTooltipCallback(k);
2334
+ }, A = e.options.badgeTooltipCallback(T);
1905
2335
  A !== null && (S = A);
1906
2336
  }
1907
2337
  return {
@@ -1915,677 +2345,247 @@ function Nt(e, a, t) {
1915
2345
  for (const y of R)
1916
2346
  if (y.text) {
1917
2347
  const I = y.tooltip ? ` data-tooltip="${y.tooltip.replace(/"/g, "&quot;")}"` : "", S = y.class ? ` ${y.class}` : "";
1918
- D += `<div class="drp-date-picker__badge-cell${S}"${I}>${y.text}</div>`;
1919
- } else
1920
- D += '<div class="drp-date-picker__badge-cell"></div>';
1921
- D += "</div>";
1922
- }
1923
- D += '<div class="drp-date-picker__date-row">';
1924
- for (const y of _) {
1925
- const I = ["drp-date-picker__day"];
1926
- y.isOtherMonth && I.push("drp-date-picker__day--other-month");
1927
- const S = e.getDateInfoInternal(y.date), E = S && S.isDisabled !== void 0 ? S.isDisabled : e.isDateDisabledInternal(y.date);
1928
- E && I.push("drp-date-picker__day--disabled"), S && S.dayClass && I.push(S.dayClass), e.isToday(y.date) && I.push("drp-date-picker__day--today");
1929
- let k = !1;
1930
- e.options.selectionMode === "single" ? k = e.isSameDay(y.date, e.selectedDate) : e.options.selectionMode === "multiple" && (k = e.selectedDates.some((q) => e.isSameDay(y.date, q))), k && I.push("drp-date-picker__day--selected");
1931
- let A = !1, $ = !1, N = !1;
1932
- if (e.options.selectionMode === "range")
1933
- A = e.isSameDay(y.date, e.selectedStartDate), $ = e.isSameDay(y.date, e.selectedEndDate), N = e.isInRange(y.date), A && I.push("drp-date-picker__day--range-start"), $ && I.push("drp-date-picker__day--range-end"), N && (!E || e.options.highlightDisabledInRange) && I.push("drp-date-picker__day--in-range");
1934
- else if (e.options.selectionMode === "multiple")
1935
- for (const q of e.selectedRanges)
1936
- e.isSameDay(y.date, q.start) && (A = !0, I.push("drp-date-picker__day--range-start")), e.isSameDay(y.date, q.end) && ($ = !0, I.push("drp-date-picker__day--range-end")), y.date >= q.start && y.date <= q.end && (N = !0, (!E || e.options.highlightDisabledInRange) && I.push("drp-date-picker__day--in-range"));
1937
- const z = `${y.year}-${String(y.month + 1).padStart(2, "0")}-${String(y.day).padStart(2, "0")}`;
1938
- let P = (S == null ? void 0 : S.dayTooltip) || "";
1939
- if (e.options.dayTooltipCallback) {
1940
- const q = {
1941
- date: y.date,
1942
- dateString: z,
1943
- dayNumber: y.day,
1944
- isDisabled: E,
1945
- isSelected: k,
1946
- isStartDate: A,
1947
- isEndDate: $,
1948
- isInRange: N,
1949
- isToday: e.isToday(y.date),
1950
- isWeekend: y.date.getDay() === 0 || y.date.getDay() === 6,
1951
- monthIndex: a,
1952
- element: null,
1953
- // Not available during string rendering
1954
- picker: e
1955
- }, at = e.options.dayTooltipCallback(q);
1956
- at !== null && (P = at);
1957
- }
1958
- const V = P ? ` data-tooltip="${P.replace(/"/g, "&quot;")}"` : "";
1959
- D += `<div class="${I.join(" ")}" data-date="${z}" data-day-number="${y.day}"${V}>`, D += `<slot name="day-${z}">${y.day}</slot>`, D += "</div>";
1960
- }
1961
- D += "</div>";
1962
- }
1963
- r && (r.innerHTML = D, fn(e, a, r));
1964
- }
1965
- function fn(e, a, t) {
1966
- if (!e.options.renderDayCallback && !e.options.renderDayContentCallback)
1967
- return;
1968
- t.querySelectorAll(".drp-date-picker__day").forEach((r) => {
1969
- const o = r, i = o.getAttribute("data-date"), s = parseInt(o.getAttribute("data-day-number") || "0", 10);
1970
- if (!i) return;
1971
- const [d, l, c] = i.split("-"), u = new Date(parseInt(d), parseInt(l) - 1, parseInt(c)), p = o.querySelector(`slot[name="day-${i}"]`);
1972
- if (p && p.assignedNodes().length > 0)
1973
- return;
1974
- const f = e.isDateDisabledInternal(u), h = e.isToday(u), v = u.getDay() === 0 || u.getDay() === 6, m = e.options.selectionMode === "single" && e.isSameDay(u, e.selectedDate), M = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedStartDate), C = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedEndDate), x = e.options.selectionMode === "range" && e.isInRange(u), D = {
1975
- date: u,
1976
- dateString: i,
1977
- dayNumber: s,
1978
- isDisabled: f,
1979
- isSelected: m || M || C,
1980
- isStartDate: M,
1981
- isEndDate: C,
1982
- isInRange: x,
1983
- isToday: h,
1984
- isWeekend: v,
1985
- monthIndex: a,
1986
- element: o,
1987
- picker: e
1988
- };
1989
- if (e.options.renderDayCallback)
1990
- try {
1991
- const _ = e.options.renderDayCallback(D);
1992
- _ != null && (typeof _ == "string" ? p && (p.innerHTML = _) : _ instanceof HTMLElement && p && (p.innerHTML = "", p.appendChild(_)));
1993
- } catch (_) {
1994
- console.error("[DatePicker] Error in renderDayCallback:", _);
1995
- }
1996
- else if (e.options.renderDayContentCallback)
1997
- try {
1998
- const _ = e.options.renderDayContentCallback(D);
1999
- _ != null && (typeof _ == "string" ? p && (p.innerHTML += _) : _ instanceof HTMLElement && p && p.appendChild(_));
2000
- } catch (_) {
2001
- console.error("[DatePicker] Error in renderDayContentCallback:", _);
2002
- }
2003
- });
2004
- }
2005
- function Ft(e, a) {
2006
- const t = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${a}"]`);
2007
- if (!t) return;
2008
- const n = t.querySelector(".drp-date-picker__rolling-selector");
2009
- n == null || n.classList.add("drp-date-picker__rolling-selector--visible");
2010
- const r = e.monthDates[a], o = r.getFullYear(), i = r.getMonth(), s = $t(e.options.rollingYearRange, o, e), d = zt(e.options.rollingMonthRange), l = n == null ? void 0 : n.querySelector('[data-list="years"]');
2011
- let c = "";
2012
- for (let p = s.min; p <= s.max; p++) {
2013
- const g = p === o ? "drp-date-picker__rolling-item--selected" : "", h = ct(e, p) ? "" : "drp-date-picker__rolling-item--disabled";
2014
- c += `<div class="drp-date-picker__rolling-item ${g} ${h}" data-year="${p}" data-month-index="${a}"><span class="drp-date-picker__rolling-item-text">${p}</span></div>`;
2015
- }
2016
- l && (l.innerHTML = c);
2017
- const u = n == null ? void 0 : n.querySelector('[data-list="months"]');
2018
- if (u) {
2019
- let p = "";
2020
- for (let g = d.min - 1; g <= d.max - 1; g++) {
2021
- const f = e.monthNames[g], h = g === i ? "drp-date-picker__rolling-item--selected" : "", m = U(e, o, g) ? "" : "drp-date-picker__rolling-item--disabled";
2022
- p += `<div class="drp-date-picker__rolling-item ${h} ${m}" data-month="${g}" data-month-index="${a}"><span class="drp-date-picker__rolling-item-text">${f}</span></div>`;
2023
- }
2024
- u.innerHTML = p;
2025
- }
2026
- }
2027
- function mn(e) {
2028
- if (!e.options.unifiedNavigation || !e.unifiedRollingSelector) return;
2029
- e.unifiedRollingSelector.classList.add("drp-date-picker__unified-rolling-selector--visible");
2030
- const a = e.options.unifiedNavigationAnchorIndex ?? 0, t = e.monthDates[a], n = t.getFullYear(), r = t.getMonth(), o = e.getEffectiveYearRange(), i = e.getEffectiveMonthRange(), s = e.unifiedRollingSelector.querySelector('[data-list="years"]');
2031
- let d = "";
2032
- for (let c = o.min; c <= o.max; c++) {
2033
- const u = c === n ? "drp-date-picker__rolling-item--selected" : "", g = ct(e, c) ? "" : "drp-date-picker__rolling-item--disabled";
2034
- d += `<div class="drp-date-picker__rolling-item ${u} ${g}" data-year="${c}" data-unified="true"><span class="drp-date-picker__rolling-item-text">${c}</span></div>`;
2035
- }
2036
- s && (s.innerHTML = d);
2037
- const l = e.unifiedRollingSelector.querySelector('[data-list="months"]');
2038
- if (l) {
2039
- let c = "";
2040
- for (let u = i.min - 1; u <= i.max - 1; u++) {
2041
- const p = e.monthNames[u], g = u === r ? "drp-date-picker__rolling-item--selected" : "", h = U(e, n, u) ? "" : "drp-date-picker__rolling-item--disabled";
2042
- c += `<div class="drp-date-picker__rolling-item ${g} ${h}" data-month="${u}" data-unified="true"><span class="drp-date-picker__rolling-item-text">${p}</span></div>`;
2043
- }
2044
- l.innerHTML = c;
2045
- }
2046
- }
2047
- function bn(e) {
2048
- if (e.options.selectionMode !== "range") return;
2049
- const a = e.calendar.querySelector(".drp-date-picker__summary");
2050
- if (a)
2051
- if (e.selectedStartDate && e.selectedEndDate) {
2052
- let t, n, r, o, i;
2053
- if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
2054
- n = e.getEnabledDatesInRange(
2055
- e.selectedStartDate,
2056
- e.selectedEndDate
2057
- ), t = n.length, o = n, e.options.disabledDatesHandling === "split" && (i = e.splitRangeByDisabled(
2058
- e.selectedStartDate,
2059
- e.selectedEndDate
2060
- ));
2061
- else if (e.options.disabledDatesHandling === "allow") {
2062
- n = e.getEnabledDatesInRange(
2063
- e.selectedStartDate,
2064
- e.selectedEndDate
2065
- ), r = e.getDisabledDatesInRange(
2066
- e.selectedStartDate,
2067
- e.selectedEndDate
2068
- );
2069
- const d = 1e3 * 60 * 60 * 24, l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
2070
- t = Math.floor(l / d) + 1;
2071
- } else {
2072
- const l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
2073
- t = Math.floor(l / 864e5) + 1;
2074
- }
2075
- const s = t > 0 ? t - 1 : 0;
2076
- if (a.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
2077
- const d = {
2078
- days: t,
2079
- nights: s,
2080
- startDate: e.selectedStartDate,
2081
- endDate: e.selectedEndDate,
2082
- selectionMode: e.options.selectionMode,
2083
- disabledDatesHandling: e.options.disabledDatesHandling,
2084
- localeStrings: e.localeStrings,
2085
- isPreview: !1
2086
- };
2087
- n && (d.enabledDates = n), r && (d.disabledDates = r), o && (d.dates = o), i && (d.dateRanges = i), a.innerHTML = e.options.formatSummaryCallback(d);
2088
- } else
2089
- a.innerHTML = `
2090
- <span class="drp-date-picker__summary-count">${t} ${t === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
2091
- <span>, </span>
2092
- <span class="drp-date-picker__summary-count">${s} ${s === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
2093
- `;
2094
- } else
2095
- a.className = "drp-date-picker__summary drp-date-picker__summary--hidden", a.innerHTML = "";
2096
- }
2097
- function Ht(e) {
2098
- if (e.options.selectionMode !== "range") return;
2099
- const a = e.calendar.querySelector(".drp-date-picker__summary");
2100
- if (a && e.dragPreviewStart && e.dragPreviewEnd) {
2101
- let t, n, r, o, i;
2102
- if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
2103
- n = e.getEnabledDatesInRange(
2104
- e.dragPreviewStart,
2105
- e.dragPreviewEnd
2106
- ), t = n.length, o = n, e.options.disabledDatesHandling === "split" && (i = e.splitRangeByDisabled(
2107
- e.dragPreviewStart,
2108
- e.dragPreviewEnd
2109
- ));
2110
- else if (e.options.disabledDatesHandling === "allow") {
2111
- n = e.getEnabledDatesInRange(
2112
- e.dragPreviewStart,
2113
- e.dragPreviewEnd
2114
- ), r = e.getDisabledDatesInRange(
2115
- e.dragPreviewStart,
2116
- e.dragPreviewEnd
2117
- );
2118
- const d = 1e3 * 60 * 60 * 24, l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
2119
- t = Math.floor(l / d) + 1;
2120
- } else {
2121
- const l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
2122
- t = Math.floor(l / 864e5) + 1;
2123
- }
2124
- const s = t > 0 ? t - 1 : 0;
2125
- if (a.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
2126
- const d = {
2127
- days: t,
2128
- nights: s,
2129
- startDate: e.dragPreviewStart,
2130
- endDate: e.dragPreviewEnd,
2131
- selectionMode: e.options.selectionMode,
2132
- disabledDatesHandling: e.options.disabledDatesHandling,
2133
- localeStrings: e.localeStrings,
2134
- isPreview: !0
2135
- };
2136
- n && (d.enabledDates = n), r && (d.disabledDates = r), o && (d.dates = o), i && (d.dateRanges = i), a.innerHTML = e.options.formatSummaryCallback(d);
2137
- } else
2138
- a.innerHTML = `
2139
- <span style="opacity: 0.7;">${e.localeStrings.preview}: </span>
2140
- <span class="drp-date-picker__summary-count">${t} ${t === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
2141
- <span>, </span>
2142
- <span class="drp-date-picker__summary-count">${s} ${s === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
2143
- `;
2144
- }
2145
- }
2146
- function yn(e) {
2147
- if (e.calendar.querySelectorAll(".drp-date-picker__day--drag-preview, .drp-date-picker__day--drag-invalid").forEach((r) => {
2148
- r.classList.remove("drp-date-picker__day--drag-preview", "drp-date-picker__day--drag-invalid");
2149
- }), !e.dragPreviewStart || !e.dragPreviewEnd) return;
2150
- const t = e.options.disabledDatesHandling === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd);
2151
- e.calendar.querySelectorAll(".drp-date-picker__day").forEach((r) => {
2152
- const o = r.dataset.date;
2153
- if (!o) return;
2154
- const [i, s, d] = o.split("-").map(Number), l = new Date(i, s - 1, d);
2155
- l >= e.dragPreviewStart && l <= e.dragPreviewEnd && (r.classList.add("drp-date-picker__day--drag-preview"), t && r.classList.add("drp-date-picker__day--drag-invalid"));
2156
- }), Ht(e);
2157
- }
2158
- async function Ot(e, a) {
2159
- if (!e.options.beforeDateSelectCallback)
2160
- return { isValid: !0 };
2161
- try {
2162
- e.isValidating = !0, Te(e);
2163
- const t = await Promise.resolve(e.options.beforeDateSelectCallback(a));
2164
- switch (ae(e), e.isValidating = !1, t.action) {
2165
- case "accept":
2166
- return { isValid: !0 };
2167
- case "adjust":
2168
- return a instanceof Date && t.adjustedDate ? { isValid: !0, adjustedDate: t.adjustedDate, message: t.message } : typeof a == "object" && "start" in a && t.adjustedStartDate && t.adjustedEndDate ? {
2169
- isValid: !0,
2170
- adjustedStart: t.adjustedStartDate,
2171
- adjustedEnd: t.adjustedEndDate,
2172
- message: t.message
2173
- } : { isValid: !1, message: t.message || "Invalid adjustment" };
2174
- case "restore":
2175
- return { isValid: !1, message: t.message };
2176
- case "clear":
2177
- return e.clearSelection(), { isValid: !1, message: t.message };
2178
- default:
2179
- return { isValid: !1, message: "Unknown validation action" };
2180
- }
2181
- } catch (t) {
2182
- return ae(e), e.isValidating = !1, O.error("beforeDateSelectCallback error:", t), { isValid: !1, message: "Validation error occurred" };
2183
- }
2184
- }
2185
- async function Yt(e, a, t) {
2186
- if (Z.debug(" validateRangeAsync called - mode:", e.options.disabledDatesHandling, "start:", a, "end:", t), e.options.disabledDatesHandling === "prevent") {
2187
- if (Z.debug(" Checking PREVENT mode"), e.hasDisabledDatesInRange(a, t))
2188
- return Z.debug(" PREVENT mode - range contains disabled dates"), { isValid: !1, message: "Range contains disabled dates" };
2189
- } else if (e.options.disabledDatesHandling === "block" && (Z.debug(" Checking BLOCK mode"), e.hasDisabledDatesInRange(a, t))) {
2190
- Z.debug(" BLOCK mode - range contains disabled dates, adjusting");
2191
- const r = e.findLastEnabledBeforeGap(a, t);
2192
- return Z.debug(" BLOCK mode - adjusted end:", r), { isValid: !0, adjustedStart: a, adjustedEnd: r };
2193
- }
2194
- const n = await Ot(e, { start: a, end: t });
2195
- return n.isValid ? n.adjustedStart || n.adjustedEnd ? {
2196
- isValid: !0,
2197
- adjustedStart: n.adjustedStart,
2198
- adjustedEnd: n.adjustedEnd,
2199
- message: n.message
2200
- } : { isValid: !0 } : n;
2201
- }
2202
- async function vn(e, a) {
2203
- if (a.classList.contains("drp-date-picker__day--disabled")) return;
2204
- if (!a.dataset || !a.dataset.date) {
2205
- O.warn("selectDay() - called with invalid element:", a);
2206
- return;
2207
- }
2208
- const [t, n, r] = a.dataset.date.split("-").map(Number), o = new Date(t, n - 1, r);
2209
- a.classList.contains("drp-date-picker__day--other-month");
2210
- const i = a.closest(".drp-date-picker__days");
2211
- if (i && i instanceof HTMLElement) {
2212
- e.activeMonthIndex = parseInt(i.dataset.monthIndex || "0") || 0, ie.debug(`Col${e.activeMonthIndex} selectDay - activeMonthIndex:`, e.activeMonthIndex);
2213
- const s = i.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
2214
- e.focusedDayIndex = Array.from(s).indexOf(a), ie.debug(`Col${e.activeMonthIndex} selectDay - set focusedDayIndex to:`, e.focusedDayIndex);
2215
- }
2216
- if (e.options.selectionMode === "single") {
2217
- const s = await Ot(e, o);
2218
- if (!s.isValid) {
2219
- ie.debug("Single mode selection prevented by beforeDateSelectCallback");
2220
- return;
2221
- }
2222
- const d = s.adjustedDate || o;
2223
- e.selectedDate = d, e.input && (e.requiresApplyButton() || (e.input.value = e.formatDate(d))), e.requiresApplyButton() ? e.pendingSelection = d : e.options.onSelect && e.options.onSelect(d), e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
2224
- } else if (e.options.selectionMode === "multiple") {
2225
- const s = `${o.getFullYear()}-${String(o.getMonth() + 1).padStart(2, "0")}-${String(o.getDate()).padStart(2, "0")}`, d = e.selectedDates.findIndex((l) => `${l.getFullYear()}-${String(l.getMonth() + 1).padStart(2, "0")}-${String(l.getDate()).padStart(2, "0")}` === s);
2226
- if (d !== -1 ? e.selectedDates.splice(d, 1) : e.selectedDates.push(new Date(o)), e.input && !e.requiresApplyButton()) {
2227
- const l = e.selectedDates.length + e.selectedRanges.length;
2228
- e.input.value = l > 0 ? `${l} selection(s)` : "";
2229
- }
2230
- e.selectedRanges.length > 0 && e.selectedDates.length > 0 ? e.pendingSelection = [...e.selectedRanges, ...e.selectedDates] : e.selectedRanges.length > 0 ? e.pendingSelection = e.selectedRanges : e.pendingSelection = e.selectedDates;
2231
- } else if (!e.selectedStartDate || e.selectedEndDate)
2232
- e.selectedStartDate = o, e.selectedEndDate = null, e.input && (e.requiresApplyButton() || (e.input.value = `${e.formatDate(e.selectedStartDate)} - ...`));
2233
- else {
2234
- let s = e.selectedStartDate, d = o;
2235
- o < e.selectedStartDate && (d = e.selectedStartDate, s = o), ie.debug(" selectDay - calling validateRangeAsync with:", s, d);
2236
- const l = await Yt(e, s, d);
2237
- if (ie.debug(" selectDay - validation result:", l), !l.isValid) {
2238
- l.message && O.warn("selectDay() - range validation failed:", l.message), e.renderCalendar(), e.updateSummary();
2239
- return;
2240
- }
2241
- e.selectedStartDate = l.adjustedStart || s, e.selectedEndDate = l.adjustedEnd || d, e.input && (e.requiresApplyButton() || (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`));
2242
- const c = { start: e.selectedStartDate, end: e.selectedEndDate };
2243
- e.requiresApplyButton() ? e.pendingSelection = c : e.options.onSelect && e.options.onSelect(c), e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
2244
- }
2245
- if (e.renderCalendar(), e.updateSummary(), e.options.selectionMode === "range" && e.selectedEndDate) {
2246
- const s = e.selectedEndDate;
2247
- for (let d = 0; d < e.monthDates.length; d++) {
2248
- const l = e.monthDates[d];
2249
- if (s.getFullYear() === l.getFullYear() && s.getMonth() === l.getMonth()) {
2250
- e.activeMonthIndex = d;
2251
- const c = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${d}"]`);
2252
- if (c) {
2253
- const u = c.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = Array.from(u).findIndex((g) => {
2254
- const f = g.dataset.date;
2255
- if (!f) return !1;
2256
- const [h, v, m] = f.split("-").map(Number), M = new Date(h, v - 1, m);
2257
- return e.isSameDay(M, s);
2258
- });
2259
- 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"));
2260
- }
2261
- break;
2262
- }
2263
- }
2264
- }
2265
- }
2266
- function Dn(e) {
2267
- e.monthDates[e.activeMonthIndex] = /* @__PURE__ */ new Date(), e.selectedDate = /* @__PURE__ */ new Date(), e.input && (e.requiresApplyButton() || (e.input.value = e.formatDate(e.selectedDate))), e.requiresApplyButton() ? e.pendingSelection = e.selectedDate : e.options.onSelect && e.options.onSelect(e.selectedDate), e.renderCalendar(), e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
2268
- }
2269
- function _n(e) {
2270
- e.selectedDate = null, e.selectedStartDate = null, e.selectedEndDate = null, e.selectedRanges = [], e.selectedDates = [], e.pendingSelection = null, e.input && (e.input.value = ""), e.renderCalendar(), e.updateSummary();
2271
- }
2272
- function wn(e) {
2273
- if (e.pendingSelection) {
2274
- if (e.input) {
2275
- if (e.options.selectionMode === "range")
2276
- e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`;
2277
- else if (e.options.selectionMode === "single")
2278
- e.input.value = e.formatDate(e.selectedDate);
2279
- else if (e.options.selectionMode === "multiple") {
2280
- const a = e.selectedDates.length + e.selectedRanges.length;
2281
- e.input.value = a > 0 ? `${a} selection(s)` : "";
2282
- }
2283
- }
2284
- e.options.onSelect && e.options.onSelect(e.pendingSelection), e.options.selectionMode === "range" ? (e.committedStartDate = e.selectedStartDate, e.committedEndDate = e.selectedEndDate) : e.options.selectionMode === "single" && (e.committedDate = e.selectedDate), e.pendingSelection = null;
2285
- }
2286
- e.options.autoClose !== "never" && e.options.positioningMode === "floating" && e.hide();
2287
- }
2288
- function xn(e) {
2289
- e.options.selectionMode === "range" && e.calendar.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--disabled)").forEach((t) => {
2290
- t.addEventListener("mousedown", (n) => {
2291
- const r = n, o = t, i = r.clientX, s = r.clientY, d = 5;
2292
- let l = !1, c = !1;
2293
- const u = o.classList.contains("drp-date-picker__day--range-start"), p = o.classList.contains("drp-date-picker__day--range-end");
2294
- let g;
2295
- u && e.selectedStartDate && e.selectedEndDate ? g = "start" : p && e.selectedStartDate && e.selectedEndDate ? g = "end" : g = "start";
2296
- const f = (v) => {
2297
- const m = Math.abs(v.clientX - i), M = Math.abs(v.clientY - s);
2298
- !l && (m > d || M > d) && (l = !0), l && !c && (c = !0, Bt(e, r, g, o), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", h));
2299
- }, h = () => {
2300
- document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", h);
2301
- };
2302
- document.addEventListener("mousemove", f), document.addEventListener("mouseup", h);
2303
- });
2304
- });
2305
- }
2306
- function Bt(e, a, t, n) {
2307
- a.preventDefault(), a.stopPropagation(), e.isDragging = !0, e.draggingType = t;
2308
- const r = n, o = r.dataset.date;
2309
- let i = null;
2310
- if (o) {
2311
- const [s, d, l] = o.split("-").map(Number);
2312
- i = new Date(s, d - 1, l);
2313
- }
2314
- !e.selectedStartDate && !e.selectedEndDate ? i && (e.originalStartDate = i, e.originalEndDate = null, e.draggingType = "end") : i && e.selectedStartDate && !e.selectedEndDate ? i.getTime() === e.selectedStartDate.getTime() ? (e.originalStartDate = new Date(e.selectedStartDate), e.originalEndDate = null) : (e.selectedStartDate = null, e.selectedEndDate = null, e.focusedDayIndex = null, e.calendar.querySelectorAll(".drp-date-picker__day--range-start, .drp-date-picker__day--range-end, .drp-date-picker__day--selected, .drp-date-picker__day--focused").forEach((d) => {
2315
- d.classList.remove("drp-date-picker__day--range-start", "drp-date-picker__day--range-end", "drp-date-picker__day--selected", "drp-date-picker__day--focused");
2316
- }), e.originalStartDate = i, 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"), ee.debug(`Started dragging ${t} date`), e.onDragMoveBound = (s) => Vt(e, s), e.onDragEndBound = async (s) => await qt(e), document.addEventListener("mousemove", e.onDragMoveBound), document.addEventListener("mouseup", e.onDragEndBound), document.body.style.cursor = "grabbing";
2317
- }
2318
- function Vt(e, a) {
2319
- if (!e.isDragging) return;
2320
- let t = null;
2321
- e.containerElement instanceof ShadowRoot && "elementsFromPoint" in e.containerElement ? t = e.containerElement.elementsFromPoint(a.clientX, a.clientY)[0] || null : t = document.elementFromPoint(a.clientX, a.clientY);
2322
- const n = t == null ? void 0 : t.closest(".drp-date-picker__nav--prev"), r = t == null ? void 0 : t.closest(".drp-date-picker__nav--next");
2323
- if (n || r) {
2324
- if (!e.navInterval) {
2325
- const p = (n || r).closest(".drp-date-picker__month");
2326
- if (p && p instanceof HTMLElement) {
2327
- const g = parseInt(p.dataset.monthIndex || "0"), f = !!n;
2328
- f ? e.prevMonth(g) : e.nextMonth(g), e.navInterval = window.setInterval(() => {
2329
- f ? e.prevMonth(g) : e.nextMonth(g);
2330
- }, 1e3);
2331
- }
2332
- }
2333
- return;
2334
- } else
2335
- e.navInterval && (clearInterval(e.navInterval), e.navInterval = null);
2336
- const o = t;
2337
- if (!o || !o.classList.contains("drp-date-picker__day")) return;
2338
- const i = o.dataset.date;
2339
- if (!i) return;
2340
- const [s, d, l] = i.split("-").map(Number);
2341
- let c = new Date(s, d - 1, l);
2342
- if (o.classList.contains("drp-date-picker__day--disabled")) {
2343
- const u = e.draggingType === "start" ? e.originalEndDate && c > e.originalEndDate ? "backward" : "forward" : e.originalStartDate && c < e.originalStartDate ? "forward" : "backward";
2344
- c = $e(e, c, u);
2345
- }
2346
- 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) {
2347
- const u = e.options.disabledDatesHandling;
2348
- if (ee.debug("onDragMove - mode:", u, "start:", e.dragPreviewStart, "end:", e.dragPreviewEnd), u === "prevent" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd)) {
2349
- ee.debug("PREVENT mode - range contains disabled dates, blocking preview update");
2350
- return;
2351
- }
2352
- }
2353
- e.updateDragPreview();
2354
- }
2355
- async function qt(e, a) {
2356
- if (e.isDragging) {
2357
- if (ee.debug("Ended dragging, finalizing selection"), e.dragPreviewStart && e.dragPreviewEnd) {
2358
- let t = $e(e, e.dragPreviewStart, "forward"), n = $e(e, e.dragPreviewEnd, "backward");
2359
- t > n && ([t, n] = [n, t]), ee.debug("onDragEnd - calling validateRangeAsync with:", t, n);
2360
- const r = await Yt(e, t, n);
2361
- if (ee.debug("onDragEnd - validation result:", r), !r.isValid)
2362
- r.message && O.warn("onDragEnd() - drag validation failed:", r.message);
2363
- else {
2364
- e.selectedStartDate = r.adjustedStart || t, e.selectedEndDate = r.adjustedEnd || n, e.input && (e.requiresApplyButton() || (e.input.value = `${e.formatDate(e.selectedStartDate)} - ${e.formatDate(e.selectedEndDate)}`));
2365
- const o = { start: e.selectedStartDate, end: e.selectedEndDate };
2366
- e.requiresApplyButton() ? e.pendingSelection = o : e.options.onSelect && e.options.onSelect(o);
2367
- }
2368
- }
2369
- if (e.isDragging = !1, e.draggingType = null, e.dragPreviewStart = null, e.dragPreviewEnd = null, e.calendar.querySelectorAll(".drp-date-picker__day--dragging").forEach((t) => {
2370
- t.classList.remove("drp-date-picker__day--dragging");
2371
- }), 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) {
2372
- const t = e.selectedEndDate;
2373
- for (let n = 0; n < e.monthDates.length; n++) {
2374
- const r = e.monthDates[n];
2375
- if (t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth()) {
2376
- e.activeMonthIndex = n;
2377
- const o = e.calendar.querySelector(`.drp-date-picker__days[data-month-index="${n}"]`);
2378
- if (o) {
2379
- const i = o.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), s = Array.from(i).findIndex((d) => {
2380
- const l = d.dataset.date;
2381
- if (!l) return !1;
2382
- const [c, u, p] = l.split("-").map(Number), g = new Date(c, u - 1, p);
2383
- return e.isSameDay(g, t);
2384
- });
2385
- s !== -1 && (e.focusedDayIndex = s, i.forEach((d) => d.classList.remove("drp-date-picker__day--focused")), i[s] && i[s].classList.add("drp-date-picker__day--focused"));
2386
- }
2387
- break;
2388
- }
2389
- }
2390
- }
2391
- e.options.positioningMode === "floating" && e.shouldAutoClose() && e.hide();
2392
- }
2393
- }
2394
- function $e(e, a, t = "forward") {
2395
- let r = new Date(a);
2396
- if (r.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(r))
2397
- return r;
2398
- const o = t === "forward" ? 1 : -1;
2399
- for (let s = 1; s <= 60; s++) {
2400
- const d = new Date(a);
2401
- if (d.setDate(d.getDate() + s * o), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
2402
- return d;
2403
- }
2404
- const i = -o;
2405
- for (let s = 1; s <= 60; s++) {
2406
- const d = new Date(a);
2407
- if (d.setDate(d.getDate() + s * i), d.setHours(0, 0, 0, 0), !e.isDateDisabledInternal(d))
2408
- return d;
2409
- }
2410
- return a;
2411
- }
2412
- function Mn(e, a) {
2413
- const t = a.target, n = t.value, r = t.selectionStart || 0, o = e._previousInputValue || "", i = n.length < o.length, { separator: s } = e.formatInfo;
2414
- if (e.options.selectionMode === "range") {
2415
- const d = n.replace(new RegExp(`[^0-9${s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}to ]`, "gi"), ""), l = Ut(e, d);
2416
- if (l !== n) {
2417
- t.value = l;
2418
- let c = r;
2419
- if (i)
2420
- c = r;
2421
- else if (l.length > n.length)
2422
- if (l.includes(" to ") && !n.includes(" to ")) {
2423
- const u = l.indexOf(" to ");
2424
- r >= u && r <= u + 4 ? c = u + 4 : c = r + (l.length - n.length);
2425
- } else
2426
- c = r + (l.length - n.length);
2427
- t.setSelectionRange(c, c);
2428
- }
2429
- } else {
2430
- const d = n.replace(new RegExp(`[^0-9${s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), l = ge(e, d);
2431
- if (l !== n) {
2432
- t.value = l;
2433
- let c = r;
2434
- if (i)
2435
- c = r;
2436
- else if (l.length > n.length && l[r] === s)
2437
- c = r + 1;
2438
- else if (l.length > n.length) {
2439
- const u = (n.substring(0, r).match(new RegExp(s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length, g = (l.substring(0, r).match(new RegExp(s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length - u;
2440
- c = r + g;
2441
- }
2442
- t.setSelectionRange(c, c);
2443
- }
2444
- }
2445
- e._previousInputValue = t.value, tt(e);
2446
- }
2447
- function ge(e, a) {
2448
- var c, u, p;
2449
- const { separator: t, parts: n, maxLength: r } = e.formatInfo, o = a.replace(new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), ""), i = n.year ? n.year.length : 4, s = [
2450
- { type: "year", pos: ((c = n.year) == null ? void 0 : c.index) ?? 0, length: i },
2451
- { type: "month", pos: ((u = n.month) == null ? void 0 : u.index) ?? 1, length: 2 },
2452
- { type: "day", pos: ((p = n.day) == null ? void 0 : p.index) ?? 2, length: 2 }
2453
- ].sort((g, f) => g.pos - f.pos);
2454
- let d = "", l = 0;
2455
- for (let g = 0; g < s.length; g++) {
2456
- const f = s[g], h = o.substring(l, l + f.length);
2457
- if (!h) break;
2458
- d += h, l += h.length, g < s.length - 1 && h.length === f.length && (d += t);
2459
- }
2460
- return d.substring(0, r);
2461
- }
2462
- function Ut(e, a) {
2463
- const { separator: t, maxLength: n } = e.formatInfo, r = " to ";
2464
- let o = "", i = "";
2465
- if (a.includes(r)) {
2466
- const d = a.split(r);
2467
- o = d[0], i = d.slice(1).join(r);
2468
- } else
2469
- o = a;
2470
- const s = ge(e, o);
2471
- if (s.length === n)
2472
- if (a.includes(r)) {
2473
- const d = ge(e, i);
2474
- return s + r + d;
2475
- } else
2476
- return s + r;
2477
- else
2478
- return s;
2479
- }
2480
- function Sn(e, a) {
2481
- const { key: t, ctrlKey: n, metaKey: r } = a, { separator: o } = e.formatInfo;
2482
- if (e.calendar.classList.contains("drp-date-picker--visible") && ["ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"].includes(t)) {
2483
- a.preventDefault();
2484
- return;
2485
- }
2486
- if (!([
2487
- "Backspace",
2488
- "Delete",
2489
- "Tab",
2490
- "Escape",
2491
- "Enter",
2492
- "ArrowLeft",
2493
- "ArrowRight",
2494
- "ArrowUp",
2495
- "ArrowDown",
2496
- "Home",
2497
- "End"
2498
- ].includes(t) || n || r)) {
2499
- if (t === o) {
2500
- const s = a.target, d = s.selectionStart || 0, l = s.value;
2501
- let c = 0;
2502
- for (let p = d - 1; p >= 0; p--)
2503
- if (l[p] === o || l[p] === " ") {
2504
- c = p + 1;
2505
- break;
2506
- }
2507
- const u = l.substring(c, d);
2508
- if (/^\d$/.test(u)) {
2509
- a.preventDefault();
2510
- const p = l.substring(0, c) + "0" + u + o + l.substring(d);
2511
- s.value = p;
2512
- const g = c + 2 + o.length;
2513
- s.setSelectionRange(g, g), e._previousInputValue = p, s.dispatchEvent(new Event("input", { bubbles: !0 }));
2514
- return;
2348
+ D += `<div class="drp-date-picker__badge-cell${S}"${I}>${y.text}</div>`;
2349
+ } else
2350
+ D += '<div class="drp-date-picker__badge-cell"></div>';
2351
+ D += "</div>";
2352
+ }
2353
+ D += '<div class="drp-date-picker__date-row">';
2354
+ for (const y of _) {
2355
+ const I = ["drp-date-picker__day"];
2356
+ y.isOtherMonth && I.push("drp-date-picker__day--other-month");
2357
+ const S = e.getDateInfoInternal(y.date), E = S && S.isDisabled !== void 0 ? S.isDisabled : e.isDateDisabledInternal(y.date);
2358
+ E && I.push("drp-date-picker__day--disabled"), S && S.dayClass && I.push(S.dayClass), e.isToday(y.date) && I.push("drp-date-picker__day--today");
2359
+ let T = !1;
2360
+ e.options.selectionMode === "single" ? T = e.isSameDay(y.date, e.selectedDate) : e.options.selectionMode === "multiple" && (T = e.selectedDates.some((q) => e.isSameDay(y.date, q))), T && I.push("drp-date-picker__day--selected");
2361
+ let A = !1, $ = !1, N = !1;
2362
+ if (e.options.selectionMode === "range")
2363
+ A = e.isSameDay(y.date, e.selectedStartDate), $ = e.isSameDay(y.date, e.selectedEndDate), N = e.isInRange(y.date), A && I.push("drp-date-picker__day--range-start"), $ && I.push("drp-date-picker__day--range-end"), N && (!E || e.options.highlightDisabledInRange) && I.push("drp-date-picker__day--in-range");
2364
+ else if (e.options.selectionMode === "multiple")
2365
+ for (const q of e.selectedRanges)
2366
+ e.isSameDay(y.date, q.start) && (A = !0, I.push("drp-date-picker__day--range-start")), e.isSameDay(y.date, q.end) && ($ = !0, I.push("drp-date-picker__day--range-end")), y.date >= q.start && y.date <= q.end && (N = !0, (!E || e.options.highlightDisabledInRange) && I.push("drp-date-picker__day--in-range"));
2367
+ const z = `${y.year}-${String(y.month + 1).padStart(2, "0")}-${String(y.day).padStart(2, "0")}`;
2368
+ let P = (S == null ? void 0 : S.dayTooltip) || "";
2369
+ if (e.options.dayTooltipCallback) {
2370
+ const q = {
2371
+ date: y.date,
2372
+ dateString: z,
2373
+ dayNumber: y.day,
2374
+ isDisabled: E,
2375
+ isSelected: T,
2376
+ isStartDate: A,
2377
+ isEndDate: $,
2378
+ isInRange: N,
2379
+ isToday: e.isToday(y.date),
2380
+ isWeekend: y.date.getDay() === 0 || y.date.getDay() === 6,
2381
+ monthIndex: a,
2382
+ element: null,
2383
+ // Not available during string rendering
2384
+ picker: e
2385
+ }, at = e.options.dayTooltipCallback(q);
2386
+ at !== null && (P = at);
2515
2387
  }
2388
+ const V = P ? ` data-tooltip="${P.replace(/"/g, "&quot;")}"` : "";
2389
+ D += `<div class="${I.join(" ")}" data-date="${z}" data-day-number="${y.day}"${V}>`, D += `<slot name="day-${z}">${y.day}</slot>`, D += "</div>";
2516
2390
  }
2517
- e.options.selectionMode === "range" ? !/^\d$/.test(t) && t !== o && t !== " " && t.toLowerCase() !== "t" && t.toLowerCase() !== "o" && a.preventDefault() : !/^\d$/.test(t) && t !== o && a.preventDefault();
2391
+ D += "</div>";
2518
2392
  }
2393
+ r && (r.innerHTML = D, xn(e, a, r));
2519
2394
  }
2520
- function Cn(e, a) {
2521
- var p;
2522
- a.preventDefault();
2523
- const t = ((p = a.clipboardData) == null ? void 0 : p.getData("text")) || "", { separator: n } = e.formatInfo, r = t.replace(new RegExp(`[^0-9${n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}]`, "g"), ""), o = ge(e, r), i = a.target, s = i.selectionStart || 0, d = i.selectionEnd || 0, l = i.value, c = l.substring(0, s) + o + l.substring(d);
2524
- i.value = ge(e, c);
2525
- const u = s + o.length;
2526
- i.setSelectionRange(u, u), i.dispatchEvent(new Event("input", { bubbles: !0 })), tt(e);
2527
- }
2528
- function tt(e) {
2529
- if (!e.input) return;
2530
- const a = e.input.value;
2531
- if (oe.debug("updateCalendarFromInput - value:", a), !a) return;
2532
- const { separator: t, parts: n, maxLength: r } = e.formatInfo;
2533
- if (oe.debug("Format info:", { separator: t, parts: n, maxLength: r }), e.options.selectionMode === "range" && a.includes(" to ")) {
2534
- const i = a.split(" to "), s = i[0], d = i[1];
2535
- oe.debug("Range parts - start:", s, "end:", d), Ce(e, s, "start"), d && Ce(e, d, "end");
2395
+ function xn(e, a, t) {
2396
+ if (!e.options.renderDayCallback && !e.options.renderDayContentCallback)
2536
2397
  return;
2398
+ t.querySelectorAll(".drp-date-picker__day").forEach((r) => {
2399
+ const o = r, i = o.getAttribute("data-date"), s = parseInt(o.getAttribute("data-day-number") || "0", 10);
2400
+ if (!i) return;
2401
+ const [d, l, c] = i.split("-"), u = new Date(parseInt(d), parseInt(l) - 1, parseInt(c)), g = o.querySelector(`slot[name="day-${i}"]`);
2402
+ if (g && g.assignedNodes().length > 0)
2403
+ return;
2404
+ const f = e.isDateDisabledInternal(u), h = e.isToday(u), v = u.getDay() === 0 || u.getDay() === 6, m = e.options.selectionMode === "single" && e.isSameDay(u, e.selectedDate), M = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedStartDate), C = e.options.selectionMode === "range" && e.isSameDay(u, e.selectedEndDate), x = e.options.selectionMode === "range" && e.isInRange(u), D = {
2405
+ date: u,
2406
+ dateString: i,
2407
+ dayNumber: s,
2408
+ isDisabled: f,
2409
+ isSelected: m || M || C,
2410
+ isStartDate: M,
2411
+ isEndDate: C,
2412
+ isInRange: x,
2413
+ isToday: h,
2414
+ isWeekend: v,
2415
+ monthIndex: a,
2416
+ element: o,
2417
+ picker: e
2418
+ };
2419
+ if (e.options.renderDayCallback)
2420
+ try {
2421
+ const _ = e.options.renderDayCallback(D);
2422
+ _ != null && (typeof _ == "string" ? g && (g.innerHTML = _) : _ instanceof HTMLElement && g && (g.innerHTML = "", g.appendChild(_)));
2423
+ } catch (_) {
2424
+ console.error("[DatePicker] Error in renderDayCallback:", _);
2425
+ }
2426
+ else if (e.options.renderDayContentCallback)
2427
+ try {
2428
+ const _ = e.options.renderDayContentCallback(D);
2429
+ _ != null && (typeof _ == "string" ? g && (g.innerHTML += _) : _ instanceof HTMLElement && g && g.appendChild(_));
2430
+ } catch (_) {
2431
+ console.error("[DatePicker] Error in renderDayContentCallback:", _);
2432
+ }
2433
+ });
2434
+ }
2435
+ function qt(e, a) {
2436
+ const t = e.calendar.querySelector(`.drp-date-picker__month[data-month-index="${a}"]`);
2437
+ if (!t) return;
2438
+ const n = t.querySelector(".drp-date-picker__rolling-selector");
2439
+ n == null || n.classList.add("drp-date-picker__rolling-selector--visible");
2440
+ const r = e.monthDates[a], o = r.getFullYear(), i = r.getMonth(), s = Ot(e.options.rollingYearRange, o, e), d = Yt(e.options.rollingMonthRange), l = n == null ? void 0 : n.querySelector('[data-list="years"]');
2441
+ let c = "";
2442
+ for (let g = s.min; g <= s.max; g++) {
2443
+ const p = g === o ? "drp-date-picker__rolling-item--selected" : "", h = ct(e, g) ? "" : "drp-date-picker__rolling-item--disabled";
2444
+ c += `<div class="drp-date-picker__rolling-item ${p} ${h}" data-year="${g}" data-month-index="${a}"><span class="drp-date-picker__rolling-item-text">${g}</span></div>`;
2445
+ }
2446
+ l && (l.innerHTML = c);
2447
+ const u = n == null ? void 0 : n.querySelector('[data-list="months"]');
2448
+ if (u) {
2449
+ let g = "";
2450
+ for (let p = d.min - 1; p <= d.max - 1; p++) {
2451
+ const f = e.monthNames[p], h = p === i ? "drp-date-picker__rolling-item--selected" : "", m = U(e, o, p) ? "" : "drp-date-picker__rolling-item--disabled";
2452
+ g += `<div class="drp-date-picker__rolling-item ${h} ${m}" data-month="${p}" data-month-index="${a}"><span class="drp-date-picker__rolling-item-text">${f}</span></div>`;
2453
+ }
2454
+ u.innerHTML = g;
2537
2455
  }
2538
- const o = e.options.selectionMode === "range" ? "start" : "single";
2539
- Ce(e, a, o);
2540
2456
  }
2541
- function Ce(e, a, t = "single") {
2542
- const { separator: n, parts: r, maxLength: o } = e.formatInfo, i = a.split(n);
2543
- let s = null, d = null, l = null;
2544
- if (i.forEach((c, u) => {
2545
- if (c) {
2546
- if (r.year && r.year.index === u) {
2547
- const p = parseInt(c, 10);
2548
- r.year.length === 4 && c.length === 4 ? s = p : r.year.length === 2 && c.length === 2 && (s = p < 100 ? p + 2e3 : p);
2549
- } else if (r.month && r.month.index === u) {
2550
- const p = parseInt(c, 10);
2551
- c.length === 2 && p >= 1 && p <= 12 && (d = p);
2552
- } else if (r.day && r.day.index === u) {
2553
- const p = parseInt(c, 10);
2554
- c.length === 2 && p >= 1 && p <= 31 && (l = p);
2555
- }
2457
+ function Mn(e) {
2458
+ if (!e.options.unifiedNavigation || !e.unifiedRollingSelector) return;
2459
+ e.unifiedRollingSelector.classList.add("drp-date-picker__unified-rolling-selector--visible");
2460
+ const a = e.options.unifiedNavigationAnchorIndex ?? 0, t = e.monthDates[a], n = t.getFullYear(), r = t.getMonth(), o = e.getEffectiveYearRange(), i = e.getEffectiveMonthRange(), s = e.unifiedRollingSelector.querySelector('[data-list="years"]');
2461
+ let d = "";
2462
+ for (let c = o.min; c <= o.max; c++) {
2463
+ const u = c === n ? "drp-date-picker__rolling-item--selected" : "", p = ct(e, c) ? "" : "drp-date-picker__rolling-item--disabled";
2464
+ d += `<div class="drp-date-picker__rolling-item ${u} ${p}" data-year="${c}" data-unified="true"><span class="drp-date-picker__rolling-item-text">${c}</span></div>`;
2465
+ }
2466
+ s && (s.innerHTML = d);
2467
+ const l = e.unifiedRollingSelector.querySelector('[data-list="months"]');
2468
+ if (l) {
2469
+ let c = "";
2470
+ for (let u = i.min - 1; u <= i.max - 1; u++) {
2471
+ const g = e.monthNames[u], p = u === r ? "drp-date-picker__rolling-item--selected" : "", h = U(e, n, u) ? "" : "drp-date-picker__rolling-item--disabled";
2472
+ c += `<div class="drp-date-picker__rolling-item ${p} ${h}" data-month="${u}" data-unified="true"><span class="drp-date-picker__rolling-item-text">${g}</span></div>`;
2556
2473
  }
2557
- }), oe.debug(`parseAndUpdateSingleDate(${t}) - year:`, s, "month:", d, "day:", l), s !== null || d !== null) {
2558
- const c = s || (/* @__PURE__ */ new Date()).getFullYear(), u = d !== null ? d - 1 : (/* @__PURE__ */ new Date()).getMonth();
2559
- if (e.options.selectionMode === "single") {
2560
- e.monthDates = [];
2561
- for (let p = 0; p < e.options.visibleMonthsCount; p++) {
2562
- const g = new Date(c, u + p, 1);
2563
- e.monthDates.push(g);
2564
- }
2565
- } else if (e.options.selectionMode === "range" && (t === "start" || !e.selectedStartDate)) {
2566
- if (e.displayMonths = [
2567
- { month: u, year: c }
2568
- ], e.options.visibleMonthsCount > 1) {
2569
- const p = new Date(c, u + 1, 1);
2570
- e.displayMonths.push({
2571
- month: p.getMonth(),
2572
- year: p.getFullYear()
2573
- });
2574
- }
2575
- e.monthDates = [];
2576
- for (let p = 0; p < e.options.visibleMonthsCount; p++) {
2577
- const g = e.displayMonths[p], f = new Date(g.year, g.month, 1);
2578
- e.monthDates.push(f);
2474
+ l.innerHTML = c;
2475
+ }
2476
+ }
2477
+ function Sn(e) {
2478
+ if (e.options.selectionMode !== "range") return;
2479
+ const a = e.calendar.querySelector(".drp-date-picker__summary");
2480
+ if (a)
2481
+ if (e.selectedStartDate && e.selectedEndDate) {
2482
+ let t, n, r, o, i;
2483
+ if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
2484
+ n = e.getEnabledDatesInRange(
2485
+ e.selectedStartDate,
2486
+ e.selectedEndDate
2487
+ ), t = n.length, o = n, e.options.disabledDatesHandling === "split" && (i = e.splitRangeByDisabled(
2488
+ e.selectedStartDate,
2489
+ e.selectedEndDate
2490
+ ));
2491
+ else if (e.options.disabledDatesHandling === "allow") {
2492
+ n = e.getEnabledDatesInRange(
2493
+ e.selectedStartDate,
2494
+ e.selectedEndDate
2495
+ ), r = e.getDisabledDatesInRange(
2496
+ e.selectedStartDate,
2497
+ e.selectedEndDate
2498
+ );
2499
+ const d = 1e3 * 60 * 60 * 24, l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
2500
+ t = Math.floor(l / d) + 1;
2501
+ } else {
2502
+ const l = e.selectedEndDate.getTime() - e.selectedStartDate.getTime();
2503
+ t = Math.floor(l / 864e5) + 1;
2579
2504
  }
2505
+ const s = t > 0 ? t - 1 : 0;
2506
+ if (a.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
2507
+ const d = {
2508
+ days: t,
2509
+ nights: s,
2510
+ startDate: e.selectedStartDate,
2511
+ endDate: e.selectedEndDate,
2512
+ selectionMode: e.options.selectionMode,
2513
+ disabledDatesHandling: e.options.disabledDatesHandling,
2514
+ localeStrings: e.localeStrings,
2515
+ isPreview: !1
2516
+ };
2517
+ n && (d.enabledDates = n), r && (d.disabledDates = r), o && (d.dates = o), i && (d.dateRanges = i), a.innerHTML = e.options.formatSummaryCallback(d);
2518
+ } else
2519
+ a.innerHTML = `
2520
+ <span class="drp-date-picker__summary-count">${t} ${t === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
2521
+ <span>, </span>
2522
+ <span class="drp-date-picker__summary-count">${s} ${s === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
2523
+ `;
2524
+ } else
2525
+ a.className = "drp-date-picker__summary drp-date-picker__summary--hidden", a.innerHTML = "";
2526
+ }
2527
+ function Ut(e) {
2528
+ if (e.options.selectionMode !== "range") return;
2529
+ const a = e.calendar.querySelector(".drp-date-picker__summary");
2530
+ if (a && e.dragPreviewStart && e.dragPreviewEnd) {
2531
+ let t, n, r, o, i;
2532
+ if (e.options.disabledDatesHandling === "individual" || e.options.disabledDatesHandling === "split")
2533
+ n = e.getEnabledDatesInRange(
2534
+ e.dragPreviewStart,
2535
+ e.dragPreviewEnd
2536
+ ), t = n.length, o = n, e.options.disabledDatesHandling === "split" && (i = e.splitRangeByDisabled(
2537
+ e.dragPreviewStart,
2538
+ e.dragPreviewEnd
2539
+ ));
2540
+ else if (e.options.disabledDatesHandling === "allow") {
2541
+ n = e.getEnabledDatesInRange(
2542
+ e.dragPreviewStart,
2543
+ e.dragPreviewEnd
2544
+ ), r = e.getDisabledDatesInRange(
2545
+ e.dragPreviewStart,
2546
+ e.dragPreviewEnd
2547
+ );
2548
+ const d = 1e3 * 60 * 60 * 24, l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
2549
+ t = Math.floor(l / d) + 1;
2550
+ } else {
2551
+ const l = e.dragPreviewEnd.getTime() - e.dragPreviewStart.getTime();
2552
+ t = Math.floor(l / 864e5) + 1;
2580
2553
  }
2581
- e.renderCalendar();
2582
- }
2583
- if (s !== null && d !== null && l !== null) {
2584
- const c = new Date(s, d - 1, l);
2585
- c.getMonth() === d - 1 && (t === "single" ? e.selectedDate = c : t === "start" ? e.selectedStartDate = c : t === "end" && (e.selectedEndDate = c), e.renderCalendar(), e.options.selectionMode === "range" && e.updateSummary(), oe.debug(`Set ${t} date:`, c));
2554
+ const s = t > 0 ? t - 1 : 0;
2555
+ if (a.className = "drp-date-picker__summary drp-date-picker__summary--visible", e.options.formatSummaryCallback) {
2556
+ const d = {
2557
+ days: t,
2558
+ nights: s,
2559
+ startDate: e.dragPreviewStart,
2560
+ endDate: e.dragPreviewEnd,
2561
+ selectionMode: e.options.selectionMode,
2562
+ disabledDatesHandling: e.options.disabledDatesHandling,
2563
+ localeStrings: e.localeStrings,
2564
+ isPreview: !0
2565
+ };
2566
+ n && (d.enabledDates = n), r && (d.disabledDates = r), o && (d.dates = o), i && (d.dateRanges = i), a.innerHTML = e.options.formatSummaryCallback(d);
2567
+ } else
2568
+ a.innerHTML = `
2569
+ <span style="opacity: 0.7;">${e.localeStrings.preview}: </span>
2570
+ <span class="drp-date-picker__summary-count">${t} ${t === 1 ? e.localeStrings.day : e.localeStrings.days}</span>
2571
+ <span>, </span>
2572
+ <span class="drp-date-picker__summary-count">${s} ${s === 1 ? e.localeStrings.night : e.localeStrings.nights}</span>
2573
+ `;
2586
2574
  }
2587
2575
  }
2588
- const Ue = {
2576
+ function Cn(e) {
2577
+ if (e.calendar.querySelectorAll(".drp-date-picker__day--drag-preview, .drp-date-picker__day--drag-invalid").forEach((r) => {
2578
+ r.classList.remove("drp-date-picker__day--drag-preview", "drp-date-picker__day--drag-invalid");
2579
+ }), !e.dragPreviewStart || !e.dragPreviewEnd) return;
2580
+ const t = e.options.disabledDatesHandling === "block" && e.hasDisabledDatesInRange(e.dragPreviewStart, e.dragPreviewEnd);
2581
+ e.calendar.querySelectorAll(".drp-date-picker__day").forEach((r) => {
2582
+ const o = r.dataset.date;
2583
+ if (!o) return;
2584
+ const [i, s, d] = o.split("-").map(Number), l = new Date(i, s - 1, d);
2585
+ l >= e.dragPreviewStart && l <= e.dragPreviewEnd && (r.classList.add("drp-date-picker__day--drag-preview"), t && r.classList.add("drp-date-picker__day--drag-invalid"));
2586
+ }), Ut(e);
2587
+ }
2588
+ const je = {
2589
2589
  en: {
2590
2590
  today: "Today",
2591
2591
  clear: "Clear",
@@ -2627,21 +2627,21 @@ const Ue = {
2627
2627
  nights: "noches"
2628
2628
  }
2629
2629
  };
2630
- function He(e) {
2630
+ function Oe(e) {
2631
2631
  if (e !== "auto")
2632
2632
  return e;
2633
2633
  if (typeof navigator < "u" && navigator.language) {
2634
2634
  const a = navigator.language.split("-")[0].toLowerCase();
2635
- return Ue[a] ? a : "en";
2635
+ return je[a] ? a : "en";
2636
2636
  }
2637
2637
  return "en";
2638
2638
  }
2639
2639
  function In(e, a) {
2640
- const t = He(e), n = Ue[t] || Ue.en;
2640
+ const t = Oe(e), n = je[t] || je.en;
2641
2641
  return a ? { ...n, ...a } : n;
2642
2642
  }
2643
2643
  function En(e) {
2644
- const a = He(e);
2644
+ const a = Oe(e);
2645
2645
  try {
2646
2646
  const t = new Intl.DateTimeFormat(a, { weekday: "short" }), n = [];
2647
2647
  for (let r = 0; r < 7; r++) {
@@ -2654,7 +2654,7 @@ function En(e) {
2654
2654
  }
2655
2655
  }
2656
2656
  function Rn(e) {
2657
- const a = He(e);
2657
+ const a = Oe(e);
2658
2658
  try {
2659
2659
  const t = new Intl.DateTimeFormat(a, { month: "long" }), n = [];
2660
2660
  for (let r = 0; r < 12; r++) {
@@ -2822,7 +2822,7 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
2822
2822
  const r = this.options.visibleMonthsCount - 1;
2823
2823
  (this.options.unifiedNavigationAnchorIndex < 0 || this.options.unifiedNavigationAnchorIndex > r) && (console.warn(`unifiedNavigationAnchorIndex (${this.options.unifiedNavigationAnchorIndex}) out of bounds. Using 0.`), this.options.unifiedNavigationAnchorIndex = 0);
2824
2824
  }
2825
- this.weekStartDay = Xt(this.options.weekStartDay), L.debug("Week starts on day:", this.weekStartDay), L.debug("disabledDatesHandling:", this.options.disabledDatesHandling), this.locale = He(this.options.locale), this.localeStrings = In(this.locale, this.options.customStrings), this.weekdayNames = En(this.locale), this.monthNames = this.options.monthNames || Rn(this.locale), L.debug("Locale:", this.locale, "Weekdays:", this.weekdayNames, "Months:", this.monthNames), this.initializeDateRestrictions(), this.formatInfo = this.parseFormat(this.options.dateFormatMask), L.debug("Format info:", this.formatInfo), this._previousInputValue = "", this.currentDate = /* @__PURE__ */ new Date();
2825
+ this.weekStartDay = Xt(this.options.weekStartDay), L.debug("Week starts on day:", this.weekStartDay), L.debug("disabledDatesHandling:", this.options.disabledDatesHandling), this.locale = Oe(this.options.locale), this.localeStrings = In(this.locale, this.options.customStrings), this.weekdayNames = En(this.locale), this.monthNames = this.options.monthNames || Rn(this.locale), L.debug("Locale:", this.locale, "Weekdays:", this.weekdayNames, "Months:", this.monthNames), this.initializeDateRestrictions(), this.formatInfo = this.parseFormat(this.options.dateFormatMask), L.debug("Format info:", this.formatInfo), this._previousInputValue = "", this.currentDate = /* @__PURE__ */ new Date();
2826
2826
  let n;
2827
2827
  if (this.options.initialDate)
2828
2828
  n = fe(this.options.initialDate) || /* @__PURE__ */ new Date(), L.debug(`Using initialDate: ${n.toISOString()}`);
@@ -2851,7 +2851,7 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
2851
2851
  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();
2852
2852
  }
2853
2853
  init() {
2854
- L.debug("Init called"), this.createCalendar(), this.input && (this.attachInputListeners(), this.input.value && (L.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, Lt(this), this.clickOutsideHandler && document.addEventListener("click", this.clickOutsideHandler)), L.debug("Init complete");
2854
+ L.debug("Init called"), this.createCalendar(), this.input && (this.attachInputListeners(), this.input.value && (L.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, Ht(this), this.clickOutsideHandler && document.addEventListener("click", this.clickOutsideHandler)), L.debug("Init complete");
2855
2855
  }
2856
2856
  /**
2857
2857
  * Initialize and normalize date restrictions
@@ -2882,7 +2882,7 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
2882
2882
  */
2883
2883
  getEffectiveYearRange() {
2884
2884
  const a = (/* @__PURE__ */ new Date()).getFullYear();
2885
- return $t(this.options.rollingYearRange, a, this);
2885
+ return Ot(this.options.rollingYearRange, a, this);
2886
2886
  }
2887
2887
  /**
2888
2888
  * Get effective month range considering all constraints
@@ -2890,7 +2890,7 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
2890
2890
  * Considers: rollingMonthRange option, or defaults to all months (1-12)
2891
2891
  */
2892
2892
  getEffectiveMonthRange() {
2893
- return zt(this.options.rollingMonthRange);
2893
+ return Yt(this.options.rollingMonthRange);
2894
2894
  }
2895
2895
  /**
2896
2896
  * Render action buttons based on configuration
@@ -3084,7 +3084,7 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3084
3084
  return ut(a);
3085
3085
  }
3086
3086
  isSameDay(a, t) {
3087
- return pt(a, t);
3087
+ return gt(a, t);
3088
3088
  }
3089
3089
  isInRange(a) {
3090
3090
  return na(a, this.selectedStartDate, this.selectedEndDate);
@@ -3094,7 +3094,7 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3094
3094
  * @returns true if Apply button is required and events should be deferred
3095
3095
  */
3096
3096
  requiresApplyButton() {
3097
- return this.options.autoClose === "apply" || this.options.showApplyButton && this.options.autoClose !== "selection";
3097
+ return this.options.autoClose === "apply";
3098
3098
  }
3099
3099
  /**
3100
3100
  * Determine if calendar should auto-close after selection
@@ -3308,19 +3308,19 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3308
3308
  if (a.ctrlKey || a.metaKey) {
3309
3309
  w.debug("Ctrl+Home: Navigate to year start");
3310
3310
  const d = this.getEffectiveYearRange(), l = this.getEffectiveMonthRange(), c = s === 0, u = this.focusedDayIndex === 0;
3311
- let p = i, g = Math.max(0, l.min - 1);
3312
- c && u && (p = i - 1), p < d.min && (w.debug("Ctrl+Home: Target year below min, clamping to", d.min), p = d.min);
3313
- const f = new Date(p, g, 1), h = this.monthDates[this.activeMonthIndex];
3314
- (f.getFullYear() !== h.getFullYear() || f.getMonth() !== h.getMonth() || this.focusedDayIndex !== 0) && (w.debug("Going to", g + 1, "/", p), this.monthDates[this.activeMonthIndex] = f, this.renderCalendar(), setTimeout(() => {
3311
+ let g = i, p = Math.max(0, l.min - 1);
3312
+ c && u && (g = i - 1), g < d.min && (w.debug("Ctrl+Home: Target year below min, clamping to", d.min), g = d.min);
3313
+ const f = new Date(g, p, 1), h = this.monthDates[this.activeMonthIndex];
3314
+ (f.getFullYear() !== h.getFullYear() || f.getMonth() !== h.getMonth() || this.focusedDayIndex !== 0) && (w.debug("Going to", p + 1, "/", g), this.monthDates[this.activeMonthIndex] = f, this.renderCalendar(), setTimeout(() => {
3315
3315
  var M, C;
3316
3316
  const v = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), m = v == null ? void 0 : v.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
3317
3317
  m && (this.focusedDayIndex = 0, (M = m[0]) == null || M.classList.add("drp-date-picker__day--focused"), (C = m[0]) == null || C.scrollIntoView({ block: "nearest" }));
3318
3318
  }, 0));
3319
3319
  } else if (w.debug("Home: Navigate to first day (cycles to previous month if already there)"), this.focusedDayIndex === 0)
3320
3320
  w.debug("Already on first day, going to previous month"), this.prevMonth(this.activeMonthIndex), setTimeout(() => {
3321
- var u, p;
3321
+ var u, g;
3322
3322
  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)");
3323
- 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" }));
3323
+ c && (this.focusedDayIndex = 0, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((p) => p.classList.remove("drp-date-picker__day--focused")), (u = c[0]) == null || u.classList.add("drp-date-picker__day--focused"), (g = c[0]) == null || g.scrollIntoView({ block: "nearest" }));
3324
3324
  }, 0);
3325
3325
  else {
3326
3326
  this.focusedDayIndex = 0;
@@ -3333,11 +3333,11 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3333
3333
  const i = this.monthDates[this.activeMonthIndex].getFullYear(), s = this.monthDates[this.activeMonthIndex].getMonth();
3334
3334
  if (a.ctrlKey || a.metaKey) {
3335
3335
  w.debug("Ctrl+End: Navigate to year end");
3336
- const d = this.getEffectiveYearRange(), l = this.getEffectiveMonthRange(), c = s === 11, 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)"), g = p && this.focusedDayIndex === p.length - 1;
3336
+ const d = this.getEffectiveYearRange(), l = this.getEffectiveMonthRange(), c = s === 11, u = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), g = u == null ? void 0 : u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)"), p = g && this.focusedDayIndex === g.length - 1;
3337
3337
  let f = i, h = Math.min(11, l.max - 1);
3338
- c && g && (f = i + 1), f > d.max && (w.debug("Ctrl+End: Target year above max, clamping to", d.max), f = d.max);
3338
+ c && p && (f = i + 1), f > d.max && (w.debug("Ctrl+End: Target year above max, clamping to", d.max), f = d.max);
3339
3339
  const v = new Date(f, h + 1, 0).getDate(), m = new Date(f, h, v), M = this.monthDates[this.activeMonthIndex];
3340
- (m.getFullYear() !== M.getFullYear() || m.getMonth() !== M.getMonth() || !g) && (w.debug("Going to", h + 1, "/", f), this.monthDates[this.activeMonthIndex] = m, this.renderCalendar(), setTimeout(() => {
3340
+ (m.getFullYear() !== M.getFullYear() || m.getMonth() !== M.getMonth() || !p) && (w.debug("Going to", h + 1, "/", f), this.monthDates[this.activeMonthIndex] = m, this.renderCalendar(), setTimeout(() => {
3341
3341
  var D, _;
3342
3342
  const C = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), x = C == null ? void 0 : C.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
3343
3343
  x && (this.focusedDayIndex = x.length - 1, (D = x[this.focusedDayIndex]) == null || D.classList.add("drp-date-picker__day--focused"), (_ = x[this.focusedDayIndex]) == null || _.scrollIntoView({ block: "nearest" }));
@@ -3347,9 +3347,9 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3347
3347
  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)");
3348
3348
  if (!l) return;
3349
3349
  this.focusedDayIndex === l.length - 1 ? (w.debug("Already on last day, going to next month"), this.nextMonth(this.activeMonthIndex), setTimeout(() => {
3350
- var g, f;
3351
- 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)");
3352
- p && (this.focusedDayIndex = p.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((h) => h.classList.remove("drp-date-picker__day--focused")), (g = p[this.focusedDayIndex]) == null || g.classList.add("drp-date-picker__day--focused"), (f = p[this.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
3350
+ var p, f;
3351
+ const u = this.calendar.querySelector(`.drp-date-picker__days[data-month-index="${this.activeMonthIndex}"]`), g = u == null ? void 0 : u.querySelectorAll(".drp-date-picker__day:not(.drp-date-picker__day--other-month)");
3352
+ g && (this.focusedDayIndex = g.length - 1, this.calendar.querySelectorAll(".drp-date-picker__day--focused").forEach((h) => h.classList.remove("drp-date-picker__day--focused")), (p = g[this.focusedDayIndex]) == null || p.classList.add("drp-date-picker__day--focused"), (f = g[this.focusedDayIndex]) == null || f.scrollIntoView({ block: "nearest" }));
3353
3353
  }, 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" }));
3354
3354
  }
3355
3355
  a.preventDefault();
@@ -3441,54 +3441,54 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3441
3441
  }
3442
3442
  // UI methods - wrappers for pure functions
3443
3443
  show() {
3444
- return kt(this);
3444
+ return Nt(this);
3445
3445
  }
3446
3446
  hide() {
3447
- return Tt(this);
3447
+ return Ft(this);
3448
3448
  }
3449
3449
  toggle() {
3450
- return tn(this);
3450
+ return cn(this);
3451
3451
  }
3452
3452
  position() {
3453
- return qe(this);
3453
+ return Ue(this);
3454
3454
  }
3455
3455
  showTooltip(a, t) {
3456
- return an(this, a, t);
3456
+ return un(this, a, t);
3457
3457
  }
3458
3458
  hideTooltip() {
3459
- return nn(this);
3459
+ return gn(this);
3460
3460
  }
3461
3461
  // Rendering methods - wrappers for pure functions
3462
3462
  renderCalendar() {
3463
- return hn(this);
3463
+ return wn(this);
3464
3464
  }
3465
3465
  renderNormalView(a) {
3466
- return Pt(this, a);
3466
+ return Bt(this, a);
3467
3467
  }
3468
3468
  renderDays(a, t) {
3469
- return Nt(this, a, t);
3469
+ return Vt(this, a, t);
3470
3470
  }
3471
3471
  renderRollingSelector(a) {
3472
- return Ft(this, a);
3472
+ return qt(this, a);
3473
3473
  }
3474
3474
  updateSummary() {
3475
- return bn(this);
3475
+ return Sn(this);
3476
3476
  }
3477
3477
  updateSummaryWithPreview() {
3478
- return Ht(this);
3478
+ return Ut(this);
3479
3479
  }
3480
3480
  updateDragPreview() {
3481
- return yn(this);
3481
+ return Cn(this);
3482
3482
  }
3483
3483
  // Navigation methods - wrappers for pure functions
3484
3484
  toggleRollingSelector(a) {
3485
- return rn(this, a);
3485
+ return pn(this, a);
3486
3486
  }
3487
3487
  selectYear(a, t) {
3488
- return on(this, a, t);
3488
+ return hn(this, a, t);
3489
3489
  }
3490
3490
  selectMonth(a, t) {
3491
- return sn(this, a, t);
3491
+ return fn(this, a, t);
3492
3492
  }
3493
3493
  checkAndResolveCollisions(a) {
3494
3494
  return pe(this, a);
@@ -3501,75 +3501,75 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3501
3501
  }
3502
3502
  // Unified navigation methods
3503
3503
  unifiedPrevMonth() {
3504
- return cn(this);
3504
+ return yn(this);
3505
3505
  }
3506
3506
  unifiedNextMonth() {
3507
- return ln(this);
3507
+ return bn(this);
3508
3508
  }
3509
3509
  toggleUnifiedRollingSelector() {
3510
- return pn(this);
3510
+ return Dn(this);
3511
3511
  }
3512
3512
  setUnifiedMonth(a) {
3513
- return un(this, a);
3513
+ return vn(this, a);
3514
3514
  }
3515
3515
  setUnifiedYear(a) {
3516
- return gn(this, a);
3516
+ return _n(this, a);
3517
3517
  }
3518
3518
  findNextEnabledDayIndex(a, t, n, r) {
3519
3519
  return me(this, a, t, n);
3520
3520
  }
3521
3521
  moveFocus(a) {
3522
- return dn(this, a);
3522
+ return mn(this, a);
3523
3523
  }
3524
3524
  // Selection methods - wrappers for pure functions
3525
3525
  async selectDay(a) {
3526
- return await vn(this, a);
3526
+ return await tn(this, a);
3527
3527
  }
3528
3528
  selectToday() {
3529
- return Dn(this);
3529
+ return an(this);
3530
3530
  }
3531
3531
  clearSelection() {
3532
- return _n(this);
3532
+ return nn(this);
3533
3533
  }
3534
3534
  apply() {
3535
- return wn(this);
3535
+ return rn(this);
3536
3536
  }
3537
3537
  // Interaction methods - wrappers for pure functions
3538
3538
  initDragListeners() {
3539
- return xn(this);
3539
+ return on(this);
3540
3540
  }
3541
3541
  startDrag(a, t, n) {
3542
- return Bt(this, a, t, n);
3542
+ return Lt(this, a, t, n);
3543
3543
  }
3544
3544
  onDragMove(a) {
3545
- return Vt(this, a);
3545
+ return $t(this, a);
3546
3546
  }
3547
3547
  async onDragEnd(a) {
3548
- return await qt(this);
3548
+ return await zt(this);
3549
3549
  }
3550
3550
  findNearestEnabledDate(a, t = "forward") {
3551
- return $e(this, a, t);
3551
+ return ke(this, a, t);
3552
3552
  }
3553
3553
  handleInputMask(a) {
3554
- return Mn(this, a);
3554
+ return sn(this, a);
3555
3555
  }
3556
3556
  applyMask(a) {
3557
3557
  return ge(this, a);
3558
3558
  }
3559
3559
  applyRangeMask(a) {
3560
- return Ut(this, a);
3560
+ return Pt(this, a);
3561
3561
  }
3562
3562
  handleKeydown(a) {
3563
- return Sn(this, a);
3563
+ return dn(this, a);
3564
3564
  }
3565
3565
  handlePaste(a) {
3566
- return Cn(this, a);
3566
+ return ln(this, a);
3567
3567
  }
3568
3568
  updateCalendarFromInput() {
3569
- return tt(this);
3569
+ return He(this);
3570
3570
  }
3571
3571
  parseAndUpdateSingleDate(a, t = "single") {
3572
- return Ce(this, a, t);
3572
+ return Se(this, a, t);
3573
3573
  }
3574
3574
  /**
3575
3575
  * Inject global styles for the date picker
@@ -3621,7 +3621,7 @@ const jt = ':host,:root{--drp-rem: 10px;font-family:var(--drp-font-family, var(-
3621
3621
  };
3622
3622
  // Static flag to track if styles have been injected
3623
3623
  b(De, "stylesInjected", !1);
3624
- let je = De;
3624
+ let We = De;
3625
3625
  class Wt extends HTMLElement {
3626
3626
  constructor() {
3627
3627
  super();
@@ -3809,7 +3809,7 @@ class Wt extends HTMLElement {
3809
3809
  showClearButton: this.hasAttribute("show-clear-button") ? this.getAttribute("show-clear-button") === "true" : void 0,
3810
3810
  showApplyButton: this.hasAttribute("show-apply-button") ? this.getAttribute("show-apply-button") === "true" : void 0
3811
3811
  }, d = t === "inline" ? null : this.inputElement;
3812
- if (this.picker = new je(d, s), this._customStylesCallback) {
3812
+ if (this.picker = new We(d, s), this._customStylesCallback) {
3813
3813
  const l = this._customStylesCallback();
3814
3814
  if (l) {
3815
3815
  const c = document.createElement("style");
@@ -4146,10 +4146,10 @@ function An() {
4146
4146
  return Array.from(document.querySelectorAll("web-daterangepicker"));
4147
4147
  }
4148
4148
  typeof window < "u" && (window.components = window.components || {}, window.components["web-daterangepicker"] = {
4149
- version: () => "1.8.0",
4149
+ version: () => "1.8.1",
4150
4150
  config: {
4151
4151
  name: "@keenmate/web-daterangepicker",
4152
- version: "1.8.0",
4152
+ version: "1.8.1",
4153
4153
  author: "Keenmate",
4154
4154
  license: "MIT",
4155
4155
  repository: "git+https://github.com/keenmate/web-daterangepicker.git",
@@ -4162,12 +4162,12 @@ typeof window < "u" && (window.components = window.components || {}, window.comp
4162
4162
  logging: {
4163
4163
  enableLogging: ft,
4164
4164
  disableLogging: mt,
4165
- setLogLevel: We,
4165
+ setLogLevel: Ke,
4166
4166
  setCategoryLevel: ua,
4167
- getCategories: pa
4167
+ getCategories: ga
4168
4168
  }
4169
4169
  }, window.components["web-daterangepicker"].register());
4170
4170
  export {
4171
- je as DateRangePicker,
4171
+ We as DateRangePicker,
4172
4172
  Wt as WebDaterangepickerElement
4173
4173
  };