@featherk/composables 0.9.8 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { ref as U, onBeforeUnmount as Ve, nextTick as Z, computed as d, watchEffect as Fe, toValue as le, reactive as Re, watch as de, onMounted as Me, readonly as X, getCurrentScope as Le, onScopeDispose as qe, unref as Oe, shallowRef as Ue } from "vue";
1
+ import { ref as U, onBeforeUnmount as Ve, nextTick as H, computed as d, watchEffect as Fe, toValue as le, reactive as Re, watch as de, onMounted as Me, readonly as G, getCurrentScope as Le, onScopeDispose as qe, unref as Oe, shallowRef as Ue } from "vue";
2
2
  import { useFocusTrap as Ne } from "@vueuse/integrations/useFocusTrap";
3
3
  const ct = (e, t) => {
4
4
  const l = U(null);
@@ -12,10 +12,10 @@ const ct = (e, t) => {
12
12
  const u = o.closest(".k-grid-aria-root");
13
13
  if (u)
14
14
  return b.contains(u);
15
- const p = o.closest(
15
+ const f = o.closest(
16
16
  ".k-grid-header, .k-grid-content, .k-grid-content-locked"
17
17
  );
18
- return p ? b.contains(p) : !1;
18
+ return f ? b.contains(f) : !1;
19
19
  }, y = (o) => o.key === "Enter" || o.code === "Enter" || o.code === "NumpadEnter", R = () => e?.value?.columns, k = (o) => {
20
20
  const b = o.key || o.code;
21
21
  ([" ", "Spacebar", "Space"].includes(b) || y(o)) && (o.preventDefault(), o.stopPropagation(), l.value = o.target, o.target.click());
@@ -34,7 +34,7 @@ const ct = (e, t) => {
34
34
  );
35
35
  if (u) {
36
36
  if (o.code === "Tab") {
37
- const p = [
37
+ const f = [
38
38
  // ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
39
39
  // ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
40
40
  // ".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",
@@ -43,7 +43,7 @@ const ct = (e, t) => {
43
43
  "input.k-input-inner:not([tabindex='-1']):not([disabled])",
44
44
  "button:not([tabindex='-1']):not([disabled])",
45
45
  ".k-checkbox"
46
- ], E = t?.focusableMenuSelectors ?? p, v = Array.from(
46
+ ], E = t?.focusableMenuSelectors ?? f, v = Array.from(
47
47
  u.querySelectorAll(E.join(","))
48
48
  );
49
49
  if (v.length === 0) return;
@@ -55,17 +55,17 @@ const ct = (e, t) => {
55
55
  }
56
56
  } else if (o.code === "ArrowUp" || o.code === "ArrowDown") {
57
57
  o.preventDefault(), o.stopPropagation();
58
- const p = b.findIndex(
58
+ const f = b.findIndex(
59
59
  (v) => v === document.activeElement
60
60
  );
61
- let E = p;
62
- o.code === "ArrowUp" ? E = p > 0 ? p - 1 : b.length - 1 : o.code === "ArrowDown" && (E = p < b.length - 1 ? p + 1 : 0), b[E]?.focus();
61
+ let E = f;
62
+ o.code === "ArrowUp" ? E = f > 0 ? f - 1 : b.length - 1 : o.code === "ArrowDown" && (E = f < b.length - 1 ? f + 1 : 0), b[E]?.focus();
63
63
  return;
64
64
  }
65
65
  if (o.code === "Tab") {
66
66
  o.preventDefault(), o.stopPropagation();
67
- const p = l.value?.parentElement;
68
- (o.shiftKey ? p?.previousElementSibling : p?.nextElementSibling)?.querySelector(
67
+ const f = l.value?.parentElement;
68
+ (o.shiftKey ? f?.previousElementSibling : f?.nextElementSibling)?.querySelector(
69
69
  "button, [role='button'], .k-link"
70
70
  )?.focus();
71
71
  }
@@ -74,22 +74,22 @@ const ct = (e, t) => {
74
74
  o.forEach((b) => {
75
75
  b.addedNodes.forEach((u) => {
76
76
  if (u.nodeType === Node.ELEMENT_NODE) {
77
- const p = u;
78
- if (p.classList.contains("k-animation-container")) {
77
+ const f = u;
78
+ if (f.classList.contains("k-animation-container")) {
79
79
  const v = l.value;
80
- v && (v.dataset.featherKSortable === "true" || Z(() => {
81
- p.querySelectorAll(
80
+ v && (v.dataset.featherKSortable === "true" || H(() => {
81
+ f.querySelectorAll(
82
82
  ".k-columnmenu-item-wrapper"
83
83
  ).forEach((Y) => {
84
84
  Y.textContent?.toLowerCase().includes("sort") && Y.remove();
85
85
  });
86
- })), p.addEventListener(
86
+ })), f.addEventListener(
87
87
  "keydown",
88
88
  h
89
- ), Z(() => {
89
+ ), H(() => {
90
90
  const M = () => {
91
91
  const L = Array.from(
92
- p.querySelectorAll(
92
+ f.querySelectorAll(
93
93
  ".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
94
94
  )
95
95
  );
@@ -104,7 +104,7 @@ const ct = (e, t) => {
104
104
  M();
105
105
  });
106
106
  }
107
- p.querySelectorAll(
107
+ f.querySelectorAll(
108
108
  ".k-animation-container"
109
109
  ).forEach((v) => {
110
110
  v.addEventListener(
@@ -115,11 +115,11 @@ const ct = (e, t) => {
115
115
  }
116
116
  }), b.removedNodes.forEach((u) => {
117
117
  if (u.nodeType === Node.ELEMENT_NODE) {
118
- const p = u;
119
- p.classList.contains("k-animation-container") && p.removeEventListener(
118
+ const f = u;
119
+ f.classList.contains("k-animation-container") && f.removeEventListener(
120
120
  "keydown",
121
121
  h
122
- ), p.querySelectorAll(
122
+ ), f.querySelectorAll(
123
123
  ".k-animation-container"
124
124
  ).forEach((v) => {
125
125
  v.removeEventListener(
@@ -134,12 +134,12 @@ const ct = (e, t) => {
134
134
  childList: !0,
135
135
  subtree: !0
136
136
  });
137
- }, H = (o) => {
137
+ }, Z = (o) => {
138
138
  const b = o.tagName.toLowerCase();
139
139
  return !!(["input", "textarea", "select", "button"].includes(b) || o.closest(
140
140
  '.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'
141
141
  ));
142
- }, f = (o) => {
142
+ }, p = (o) => {
143
143
  if (!o.type || !o)
144
144
  return;
145
145
  const b = o.target;
@@ -149,10 +149,10 @@ const ct = (e, t) => {
149
149
  );
150
150
  if (!T(b))
151
151
  return;
152
- const p = ["ArrowLeft", "ArrowRight"].includes(
152
+ const f = ["ArrowLeft", "ArrowRight"].includes(
153
153
  o.code
154
154
  );
155
- if (!(H(b) && !(u && p))) {
155
+ if (!(Z(b) && !(u && f))) {
156
156
  if (o.code === "Escape") {
157
157
  const E = document.activeElement?.closest(".k-table-row[data-grid-row-index]");
158
158
  if (E) {
@@ -220,44 +220,44 @@ const ct = (e, t) => {
220
220
  }
221
221
  }
222
222
  }
223
- }, w = () => {
224
- Z(() => {
223
+ }, S = () => {
224
+ H(() => {
225
225
  const o = e.value?.$el;
226
226
  if (!o || typeof o.closest != "function") return;
227
227
  const b = o.closest(".k-grid");
228
228
  b && b.classList.add("fk-grid");
229
229
  });
230
- }, V = () => {
230
+ }, P = () => {
231
231
  if (!g)
232
232
  try {
233
233
  const o = () => {
234
234
  try {
235
- const p = Array.from(
235
+ const f = Array.from(
236
236
  e.value.$el.querySelectorAll(
237
237
  ".k-table-row[data-grid-row-index]"
238
238
  )
239
239
  );
240
- if (!p || p.length === 0 || p.filter(
240
+ if (!f || f.length === 0 || f.filter(
241
241
  (M) => M.getAttribute("tabindex") === "0"
242
242
  ).length === 1) return;
243
- const v = p.find(
243
+ const v = f.find(
244
244
  (M) => M === document.activeElement || M.contains(document.activeElement)
245
245
  );
246
- if (p.forEach((M) => M.setAttribute("tabindex", "-1")), v) {
246
+ if (f.forEach((M) => M.setAttribute("tabindex", "-1")), v) {
247
247
  v.setAttribute("tabindex", "0");
248
248
  return;
249
249
  }
250
- p[0].setAttribute("tabindex", "0");
251
- } catch (p) {
252
- console.error("ensureSingleTabindex error:", p);
250
+ f[0].setAttribute("tabindex", "0");
251
+ } catch (f) {
252
+ console.error("ensureSingleTabindex error:", f);
253
253
  }
254
254
  }, b = Array.from(
255
255
  e.value.$el.querySelectorAll(
256
256
  ".k-table-row[data-grid-row-index]"
257
257
  )
258
258
  );
259
- b.length > 0 && b.forEach((p, E) => {
260
- p.setAttribute("tabindex", E === 0 ? "0" : "-1");
259
+ b.length > 0 && b.forEach((f, E) => {
260
+ f.setAttribute("tabindex", E === 0 ? "0" : "-1");
261
261
  });
262
262
  const u = e.value.$el.querySelector(".k-table-tbody");
263
263
  u && (g = new MutationObserver(() => {
@@ -266,17 +266,17 @@ const ct = (e, t) => {
266
266
  } catch (o) {
267
267
  console.error("Error setting up row navigation:", o);
268
268
  }
269
- }, N = () => {
270
- Z(() => {
269
+ }, z = () => {
270
+ H(() => {
271
271
  const b = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
272
272
  b && b.forEach((u) => {
273
273
  u.setAttribute("role", "button"), u.addEventListener(
274
274
  "keydown",
275
275
  k
276
276
  );
277
- }), I(), j();
277
+ }), I(), J();
278
278
  });
279
- }, J = () => {
279
+ }, Q = () => {
280
280
  const b = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
281
281
  b && b.forEach((u) => {
282
282
  u.removeEventListener(
@@ -284,10 +284,10 @@ const ct = (e, t) => {
284
284
  k
285
285
  );
286
286
  }), m && (m.disconnect(), m = null), g && (g.disconnect(), g = null), C.forEach((u) => u()), C.length = 0;
287
- }, j = () => {
287
+ }, J = () => {
288
288
  document.querySelectorAll(
289
289
  ".k-grid-header .k-table-thead th"
290
- ).forEach((u, p) => {
290
+ ).forEach((u, f) => {
291
291
  if (u.dataset.featherKHeaderBound === "true")
292
292
  return;
293
293
  const E = u.querySelector(
@@ -295,14 +295,14 @@ const ct = (e, t) => {
295
295
  );
296
296
  if (!E) return;
297
297
  const v = R();
298
- if (v && v[p]) {
299
- const a = v[p].field ?? "";
298
+ if (v && v[f]) {
299
+ const a = v[f].field ?? "";
300
300
  u.setAttribute("data-feather-k-field", a), u.setAttribute(
301
301
  "data-feather-k-filterable",
302
- v[p].filterable === !1 ? "false" : "true"
302
+ v[f].filterable === !1 ? "false" : "true"
303
303
  ), u.setAttribute(
304
304
  "data-feather-k-sortable",
305
- v[p].sortable === !1 ? "false" : "true"
305
+ v[f].sortable === !1 ? "false" : "true"
306
306
  );
307
307
  }
308
308
  const M = u.dataset.featherKFilterable !== "false", L = u.dataset.featherKSortable !== "false";
@@ -337,9 +337,9 @@ const ct = (e, t) => {
337
337
  });
338
338
  const b = document.querySelector(".k-grid-header .k-table-thead");
339
339
  if (b && b.dataset.featherKHeaderBound !== "true") {
340
- const u = (p) => {
341
- const E = p.target.closest("th");
342
- E && (y(p) || p.code === "Space") && E.dataset.featherKFilterable === "false" && E.dataset.featherKSortable === "false" && (p.preventDefault(), p.stopImmediatePropagation());
340
+ const u = (f) => {
341
+ const E = f.target.closest("th");
342
+ E && (y(f) || f.code === "Space") && E.dataset.featherKFilterable === "false" && E.dataset.featherKSortable === "false" && (f.preventDefault(), f.stopImmediatePropagation());
343
343
  };
344
344
  b.addEventListener(
345
345
  "keydown",
@@ -355,9 +355,9 @@ const ct = (e, t) => {
355
355
  }), b.dataset.featherKHeaderBound = "true";
356
356
  }
357
357
  }, ee = function(o, b) {
358
- const u = o?.event?.event.target, p = R();
359
- if (!u || !p) return;
360
- const E = u.classList.contains("k-grid-header-menu"), v = u.classList.contains("k-columnmenu-item"), M = p.find((L) => L.field === o?.event?.field)?.sortable && !0;
358
+ const u = o?.event?.event.target, f = R();
359
+ if (!u || !f) return;
360
+ const E = u.classList.contains("k-grid-header-menu"), v = u.classList.contains("k-columnmenu-item"), M = f.find((L) => L.field === o?.event?.field)?.sortable && !0;
361
361
  if (!E) {
362
362
  if (v && !M) {
363
363
  o?.event?.sort?.filter(
@@ -365,27 +365,27 @@ const ct = (e, t) => {
365
365
  );
366
366
  return;
367
367
  }
368
- typeof b == "function" && Z(() => {
369
- l.value && l.value.focus(), b(o), Z(() => {
370
- j();
368
+ typeof b == "function" && H(() => {
369
+ l.value && l.value.focus(), b(o), H(() => {
370
+ J();
371
371
  });
372
372
  });
373
373
  }
374
- }, ie = () => {
374
+ }, oe = () => {
375
375
  if (!D)
376
376
  try {
377
- w(), V(), N(), D = !0;
377
+ S(), P(), z(), D = !0;
378
378
  } catch (o) {
379
- console.error("initA11y failed:", o), J();
379
+ console.error("initA11y failed:", o), Q();
380
380
  }
381
381
  };
382
382
  return Ve(() => {
383
- J();
383
+ Q();
384
384
  }), {
385
385
  activeFilterButton: l,
386
- handleGridKeyDown: f,
386
+ handleGridKeyDown: p,
387
387
  handleSortChange: ee,
388
- initA11y: ie
388
+ initA11y: oe
389
389
  };
390
390
  }, Ke = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), Be = (e) => !!e && typeof e == "object" && "field" in e, $e = (e, t) => !e || typeof e != "object" ? !1 : Ke(e) ? e.filters.some(
391
391
  (l) => $e(l, t)
@@ -401,9 +401,9 @@ const ct = (e, t) => {
401
401
  const h = m.value.length;
402
402
  return h === 5 || h === 9;
403
403
  }), C = d(() => l.value && !g.value), A = d(() => !l.value || g.value), x = d(() => l.value), T = (h, I) => {
404
- const H = Ze(I);
405
- Z(() => {
406
- h.isConnected && h.setSelectionRange(H, H);
404
+ const Z = Ze(I);
405
+ H(() => {
406
+ h.isConnected && h.setSelectionRange(Z, Z);
407
407
  });
408
408
  };
409
409
  return {
@@ -421,16 +421,16 @@ const ct = (e, t) => {
421
421
  textBoxValidate: x,
422
422
  // actions
423
423
  handleZipInput: (...h) => {
424
- const I = h[0], f = I?.event?.target, w = I?.value, V = Array.isArray(w) ? w.join("") : String(w ?? ""), N = f?.selectionStart !== void 0 && f.selectionStart !== null ? He(
425
- f.value,
426
- f.selectionStart
427
- ) : V.replace(/\D/g, "").length;
428
- t.value = Ie(V), f && T(f, N);
424
+ const I = h[0], p = I?.event?.target, S = I?.value, P = Array.isArray(S) ? S.join("") : String(S ?? ""), z = p?.selectionStart !== void 0 && p.selectionStart !== null ? He(
425
+ p.value,
426
+ p.selectionStart
427
+ ) : P.replace(/\D/g, "").length;
428
+ t.value = Ie(P), p && T(p, z);
429
429
  },
430
430
  submitAndValidate: (h) => {
431
431
  l.value = !0;
432
432
  const I = g.value;
433
- return !I && h?.focus && Z(() => {
433
+ return !I && h?.focus && H(() => {
434
434
  document.getElementById(
435
435
  e.id
436
436
  )?.focus();
@@ -641,31 +641,31 @@ function ft(e) {
641
641
  onCityInput: x,
642
642
  onStateChange: T,
643
643
  resetFormData: y
644
- } = Ge(), R = `${e.addressId}-zip`, { zipDisplay: k, isZipValid: h, zipWrapperClass: I, onZipInput: H, resetZip: f } = Je(g, R), {
645
- strictAddress1Valid: w,
646
- strictCityValid: V,
647
- strictStateValid: N,
648
- strictZipValid: J,
649
- strictAddressValid: j
644
+ } = Ge(), R = `${e.addressId}-zip`, { zipDisplay: k, isZipValid: h, zipWrapperClass: I, onZipInput: Z, resetZip: p } = Je(g, R), {
645
+ strictAddress1Valid: S,
646
+ strictCityValid: P,
647
+ strictStateValid: z,
648
+ strictZipValid: Q,
649
+ strictAddressValid: J
650
650
  } = Xe({
651
651
  formData: g,
652
652
  isZipValid: h
653
653
  }), ee = _e(t, {
654
654
  submitted: l,
655
- isValid: () => j.value
656
- }), { touched: ie, fieldsetValidate: o, onFocusout: b, reset: u } = ee, p = ee.createFieldValidationsMap({
657
- address1: w,
658
- city: V,
659
- state: N,
660
- zip: J,
661
- address: j
655
+ isValid: () => J.value
656
+ }), { touched: oe, fieldsetValidate: o, onFocusout: b, reset: u } = ee, f = ee.createFieldValidationsMap({
657
+ address1: S,
658
+ city: P,
659
+ state: z,
660
+ zip: Q,
661
+ address: J
662
662
  }), {
663
663
  address1: E,
664
664
  city: v,
665
665
  state: M,
666
666
  zip: L,
667
667
  address: Y
668
- } = p, ae = d(
668
+ } = f, ae = d(
669
669
  () => m.value ? o.value : !1
670
670
  ), se = d(
671
671
  () => m.value ? E.value : !0
@@ -675,21 +675,21 @@ function ft(e) {
675
675
  () => m.value ? M.value : !0
676
676
  ), $ = d(
677
677
  () => m.value ? L.value : !0
678
- ), K = d(
678
+ ), N = d(
679
679
  () => m.value ? Y.value : !0
680
- ), B = { value: null, label: "State" }, W = je.map(({ label: s, value: S }) => ({
680
+ ), K = { value: null, label: "State" }, W = je.map(({ label: s, value: w }) => ({
681
681
  label: s,
682
- value: S
682
+ value: w
683
683
  })), n = d(() => ({
684
684
  address1: g.address1.trim(),
685
685
  address2: g.address2.trim(),
686
686
  city: g.city.trim(),
687
687
  state: (g.state ?? "").trim().toUpperCase(),
688
688
  zip: g.zip.replace(/\D/g, "")
689
- })), i = d(() => g.address1.trim() === "" && g.address2.trim() === "" && g.city.trim() === "" && (g.state ?? "").trim() === "" && g.zip.replace(/\D/g, "") === ""), F = d(() => !i.value), q = d(() => !m.value && F.value && (!w.value || !V.value || !N.value)), _ = d(() => {
689
+ })), i = d(() => g.address1.trim() === "" && g.address2.trim() === "" && g.city.trim() === "" && (g.state ?? "").trim() === "" && g.zip.replace(/\D/g, "") === ""), F = d(() => !i.value), q = d(() => !m.value && F.value && (!S.value || !P.value || !z.value)), _ = d(() => {
690
690
  const s = g.zip.replace(/\D/g, "");
691
691
  return !m.value && F.value && s.length !== 5 && s.length !== 9;
692
- }), Q = d(() => !m.value && F.value && !j.value), O = d(() => !m.value && Q.value && (D.value || l.value));
692
+ }), X = d(() => !m.value && F.value && !J.value), O = d(() => !m.value && X.value && (D.value || l.value));
693
693
  return de(n, () => {
694
694
  m.value || (D.value = !1);
695
695
  }), de(m, (s) => {
@@ -697,18 +697,18 @@ function ft(e) {
697
697
  }), {
698
698
  formData: g,
699
699
  submitted: l,
700
- touched: ie,
700
+ touched: oe,
701
701
  addressValidate: ae,
702
702
  address1Valid: se,
703
703
  cityValid: a,
704
704
  stateValid: c,
705
705
  zipValid: $,
706
- addressValid: K,
706
+ addressValid: N,
707
707
  optionalFeedbackActive: O,
708
- optionalPartialInvalid: Q,
708
+ optionalPartialInvalid: X,
709
709
  optionalMissingRequiredFields: q,
710
710
  optionalZipInvalid: _,
711
- stateDefaultItem: B,
711
+ stateDefaultItem: K,
712
712
  stateOptions: W,
713
713
  zipDisplay: k,
714
714
  zipWrapperClass: I,
@@ -716,21 +716,21 @@ function ft(e) {
716
716
  onAddress2Input: A,
717
717
  onCityInput: x,
718
718
  onStateChange: T,
719
- onZipInput: H,
719
+ onZipInput: Z,
720
720
  onFieldsetFocusout: (s) => {
721
- const S = et(t.value, s);
722
- b(s), !m.value && S && (D.value = !0);
721
+ const w = et(t.value, s);
722
+ b(s), !m.value && w && (D.value = !0);
723
723
  },
724
724
  normalizedPayload: n,
725
- validateForSubmit: async () => m.value ? (l.value = !0, j.value ? {
725
+ validateForSubmit: async () => m.value ? (l.value = !0, J.value ? {
726
726
  isValid: !0,
727
727
  payload: n.value
728
- } : (await Z(), Qe(t.value), { isValid: !1, payload: null })) : i.value || j.value ? (l.value = !1, {
728
+ } : (await H(), Qe(t.value), { isValid: !1, payload: null })) : i.value || J.value ? (l.value = !1, {
729
729
  isValid: !0,
730
730
  payload: n.value
731
731
  }) : (l.value = !0, { isValid: !1, payload: null }),
732
732
  reset: () => {
733
- l.value = !1, D.value = !1, u(), y(), f();
733
+ l.value = !1, D.value = !1, u(), y(), p();
734
734
  }
735
735
  };
736
736
  }
@@ -744,7 +744,7 @@ function pt(e) {
744
744
  }), I = d(() => {
745
745
  const a = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
746
746
  return parseInt(a).toString().padStart(4, "0");
747
- }), H = (a) => {
747
+ }), Z = (a) => {
748
748
  if (y.value.length === 0) {
749
749
  e.onChange({ value: null, event: a });
750
750
  return;
@@ -754,64 +754,64 @@ function pt(e) {
754
754
  return;
755
755
  }
756
756
  if ((t.value ?? "").length === 10 && y.value.length === 8) {
757
- const [c, $, K] = t.value.split("/"), B = parseInt(c), W = parseInt($), n = parseInt(K);
758
- if (j(n, B, W)) {
759
- const i = N(n, B, W);
760
- f(i) ? e.onChange({ value: i, event: a }) : e.onChange({ value: null, event: a });
757
+ const [c, $, N] = t.value.split("/"), K = parseInt(c), W = parseInt($), n = parseInt(N);
758
+ if (J(n, K, W)) {
759
+ const i = z(n, K, W);
760
+ p(i) ? e.onChange({ value: i, event: a }) : e.onChange({ value: null, event: a });
761
761
  } else
762
762
  e.onChange({ value: null, event: a });
763
763
  }
764
- }, f = (a) => {
764
+ }, p = (a) => {
765
765
  const c = e.min ?? void 0, $ = e.max ?? void 0;
766
766
  return !(c && a < c || $ && a > $);
767
- }, w = d(() => {
767
+ }, S = d(() => {
768
768
  if ((t.value ?? "").length === 10 && y.value.length === 8) {
769
- const [a, c, $] = (t.value ?? "").split("/"), K = parseInt(a), B = parseInt(c), W = parseInt($);
770
- if (j(W, K, B))
771
- return N(W, K, B);
769
+ const [a, c, $] = (t.value ?? "").split("/"), N = parseInt(a), K = parseInt(c), W = parseInt($);
770
+ if (J(W, N, K))
771
+ return z(W, N, K);
772
772
  }
773
773
  return null;
774
- }), V = d(() => (t.value ?? "").length === 10 && y.value.length === 8), N = (a, c, $) => {
775
- const K = /* @__PURE__ */ new Date(0);
776
- return K.setFullYear(a, c - 1, $), K.setHours(0, 0, 0, 0), K;
777
- }, J = (a, c) => N(a, c + 1, 0).getDate(), j = (a, c, $) => c >= 1 && c <= 12 && a >= C && $ >= 1 && $ <= J(a, c), ee = (a) => {
774
+ }), P = d(() => (t.value ?? "").length === 10 && y.value.length === 8), z = (a, c, $) => {
775
+ const N = /* @__PURE__ */ new Date(0);
776
+ return N.setFullYear(a, c - 1, $), N.setHours(0, 0, 0, 0), N;
777
+ }, Q = (a, c) => z(a, c + 1, 0).getDate(), J = (a, c, $) => c >= 1 && c <= 12 && a >= C && $ >= 1 && $ <= Q(a, c), ee = (a) => {
778
778
  t.value = a.value;
779
779
  const c = a.event?.target;
780
- l.value = c?.selectionStart ?? 0, H(a);
781
- }, ie = (a) => {
780
+ l.value = c?.selectionStart ?? 0, Z(a);
781
+ }, oe = (a) => {
782
782
  l.value = a.target.selectionStart ?? 0;
783
783
  }, o = (a, c, $) => {
784
- const K = c?.selectionStart ?? l.value ?? 0;
785
- l.value = K;
786
- let B = parseInt(k.value), W = parseInt(h.value), n = parseInt(I.value);
787
- if (!(y.value.length >= 8) || !j(n, B, W)) {
788
- const z = e.defaultValue ?? /* @__PURE__ */ new Date();
789
- B = z.getMonth() + 1, W = z.getDate(), n = z.getFullYear(), t.value = `${String(B).padStart(2, "0")}/${String(W).padStart(
784
+ const N = c?.selectionStart ?? l.value ?? 0;
785
+ l.value = N;
786
+ let K = parseInt(k.value), W = parseInt(h.value), n = parseInt(I.value);
787
+ if (!(y.value.length >= 8) || !J(n, K, W)) {
788
+ const B = e.defaultValue ?? /* @__PURE__ */ new Date();
789
+ K = B.getMonth() + 1, W = B.getDate(), n = B.getFullYear(), t.value = `${String(K).padStart(2, "0")}/${String(W).padStart(
790
790
  2,
791
791
  "0"
792
792
  )}/${String(n)}`;
793
- const ue = N(n, B, W);
794
- e.onChange({ value: f(ue) ? ue : null, event: $ }), v({ useRAF: !0 });
793
+ const ue = z(n, K, W);
794
+ e.onChange({ value: p(ue) ? ue : null, event: $ }), v({ useRAF: !0 });
795
795
  return;
796
796
  }
797
- const F = R(K);
797
+ const F = R(N);
798
798
  if (F === "mm")
799
- B = a === "ArrowUp" ? B < 12 ? B + 1 : 1 : B > 1 ? B - 1 : 12;
799
+ K = a === "ArrowUp" ? K < 12 ? K + 1 : 1 : K > 1 ? K - 1 : 12;
800
800
  else if (F === "dd") {
801
- const z = new Date(n, B, 0).getDate();
802
- W = a === "ArrowUp" ? W < z ? W + 1 : 1 : W > 1 ? W - 1 : z;
801
+ const B = new Date(n, K, 0).getDate();
802
+ W = a === "ArrowUp" ? W < B ? W + 1 : 1 : W > 1 ? W - 1 : B;
803
803
  } else F === "yyyy" && (n = a === "ArrowUp" ? n + 1 : Math.max(1, n - 1));
804
- t.value = `${String(B).padStart(2, "0")}/${String(W).padStart(
804
+ t.value = `${String(K).padStart(2, "0")}/${String(W).padStart(
805
805
  2,
806
806
  "0"
807
807
  )}/${String(n)}`;
808
- const [q, _, Q] = t.value.split("/"), O = N(
809
- parseInt(Q),
808
+ const [q, _, X] = t.value.split("/"), O = z(
809
+ parseInt(X),
810
810
  parseInt(q),
811
811
  parseInt(_)
812
812
  );
813
- O.toString() !== "Invalid Date" && parseInt(Q) >= 1e3 ? e.onChange({
814
- value: f(O) ? O : null,
813
+ O.toString() !== "Invalid Date" && parseInt(X) >= 1e3 ? e.onChange({
814
+ value: p(O) ? O : null,
815
815
  event: $
816
816
  }) : e.onChange({ value: null, event: $ }), v({ useRAF: !0 });
817
817
  }, b = (a) => {
@@ -834,7 +834,7 @@ function pt(e) {
834
834
  a.preventDefault();
835
835
  const c = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
836
836
  o(c, a.target, a);
837
- }, p = (a) => {
837
+ }, f = (a) => {
838
838
  const c = a.target;
839
839
  if (T.includes(a.key)) {
840
840
  l.value = c?.selectionStart ?? 0;
@@ -854,13 +854,13 @@ function pt(e) {
854
854
  e.id
855
855
  );
856
856
  if (!$) return;
857
- const K = a?.pos ?? l.value ?? $.value.length;
857
+ const N = a?.pos ?? l.value ?? $.value.length;
858
858
  try {
859
- $.focus(), $.setSelectionRange(K, K);
859
+ $.focus(), $.setSelectionRange(N, N);
860
860
  } catch {
861
861
  }
862
862
  };
863
- Z(() => {
863
+ H(() => {
864
864
  if (a?.delay && a.delay > 0) {
865
865
  setTimeout(c, a.delay);
866
866
  return;
@@ -878,8 +878,8 @@ function pt(e) {
878
878
  if (a) {
879
879
  const c = new Date(a);
880
880
  if (c.toString() !== "Invalid Date") {
881
- const $ = (c.getMonth() + 1).toString().padStart(2, "0"), K = c.getDate().toString().padStart(2, "0"), B = c.getFullYear().toString();
882
- t.value = `${$}/${K}/${B}`, v({ delay: 50 });
881
+ const $ = (c.getMonth() + 1).toString().padStart(2, "0"), N = c.getDate().toString().padStart(2, "0"), K = c.getFullYear().toString();
882
+ t.value = `${$}/${N}/${K}`, v({ delay: 50 });
883
883
  return;
884
884
  }
885
885
  }
@@ -907,24 +907,24 @@ function pt(e) {
907
907
  ]
908
908
  ]), L = d(() => {
909
909
  if (!g.value) {
910
- if (!V.value) return !0;
911
- const c = w.value;
912
- return c ? f(c) : !1;
910
+ if (!P.value) return !0;
911
+ const c = S.value;
912
+ return c ? p(c) : !1;
913
913
  }
914
914
  if (!A.value) return !0;
915
- const a = w.value;
916
- return !V.value || !a ? !1 : f(a);
915
+ const a = S.value;
916
+ return !P.value || !a ? !1 : p(a);
917
917
  }), Y = d(() => {
918
918
  if (!g.value) {
919
- if (!V.value) return;
920
- const c = w.value;
921
- return c ? f(c) ? "valid" : "out-of-bounds" : "invalid-date";
919
+ if (!P.value) return;
920
+ const c = S.value;
921
+ return c ? p(c) ? "valid" : "out-of-bounds" : "invalid-date";
922
922
  }
923
923
  if (!A.value) return;
924
- if (y.value.length === 0 || !V.value)
924
+ if (y.value.length === 0 || !P.value)
925
925
  return "incomplete";
926
- const a = w.value;
927
- return a ? f(a) ? "valid" : "out-of-bounds" : "invalid-date";
926
+ const a = S.value;
927
+ return a ? p(a) ? "valid" : "out-of-bounds" : "invalid-date";
928
928
  }), ae = d(() => {
929
929
  const a = Y.value;
930
930
  if (!a || a === "valid") return "";
@@ -948,7 +948,7 @@ function pt(e) {
948
948
  }
949
949
  return "";
950
950
  }), se = () => {
951
- Z(() => {
951
+ H(() => {
952
952
  const a = document.getElementById(
953
953
  e.id
954
954
  );
@@ -981,18 +981,18 @@ function pt(e) {
981
981
  debugLines: M,
982
982
  placeholder: m,
983
983
  isValid: L,
984
- reason: X(Y),
984
+ reason: G(Y),
985
985
  validationMessage: ae,
986
986
  digitsOnly: y,
987
- month: X(k),
988
- day: X(h),
989
- year: X(I),
987
+ month: G(k),
988
+ day: G(h),
989
+ year: G(I),
990
990
  datePart: R,
991
991
  handleChange: ee,
992
992
  handleKeyDown: b,
993
993
  handleWheel: u,
994
- handleKeyUp: p,
995
- handleClick: ie,
994
+ handleKeyUp: f,
995
+ handleClick: oe,
996
996
  handleBlur: E,
997
997
  // Expose so consumers can re-run styling when needed
998
998
  initStyling: se
@@ -1001,42 +1001,39 @@ function pt(e) {
1001
1001
  function vt(e) {
1002
1002
  const t = U(""), l = U(void 0), D = U(!!e.debug), m = U(!1), g = 1440 * 60 * 1e3, C = 365 * g, A = /* @__PURE__ */ new Date(), x = new Date(A.getTime() - C), T = new Date(A.getTime() + C);
1003
1003
  e.min = e.min ?? x, e.max = e.max ?? T;
1004
- const y = d(() => (t.value ?? "").replace(/\D/g, "")), R = (r, s) => new Date(r, s, 0).getDate(), k = (r, s, S) => s >= 1 && s <= 12 && r >= 1e3 && S >= 1 && S <= R(r, s), h = (r) => Date.UTC(r.getFullYear(), r.getMonth(), r.getDate()), I = (r) => {
1004
+ const y = d(() => (t.value ?? "").replace(/\D/g, "")), R = (r, s) => new Date(r, s, 0).getDate(), k = (r, s, w) => s >= 1 && s <= 12 && r >= 1e3 && w >= 1 && w <= R(r, s), h = (r) => Date.UTC(r.getFullYear(), r.getMonth(), r.getDate()), I = (r) => {
1005
1005
  if (!r) return null;
1006
- const s = e.min ?? new Date(Date.now() - 90 * g), S = e.max ?? /* @__PURE__ */ new Date(), P = h(r);
1007
- return P < h(s) || P > h(S) ? null : r;
1008
- }, H = (r, s) => e.allowReverse ?? !1 ? !0 : r <= s, f = d(() => (t.value?.length ?? 0) >= 23 && y.value.length >= 16), w = (r) => {
1006
+ const s = e.min ?? new Date(Date.now() - 90 * g), w = e.max ?? /* @__PURE__ */ new Date(), V = h(r);
1007
+ return V < h(s) || V > h(w) ? null : r;
1008
+ }, Z = (r, s) => e.allowReverse ?? !1 ? !0 : r <= s, p = d(() => (t.value?.length ?? 0) >= 23 && y.value.length >= 16), S = (r) => {
1009
1009
  if ((r ?? "").length < 23 || y.value.length < 16)
1010
1010
  return { start: null, end: null };
1011
- const s = r.substring(0, 10), S = r.substring(13, 23), [P, te, ne] = s.split("/").map((pe) => parseInt(pe || "0", 10)), [fe, ve, me] = S.split("/").map((pe) => parseInt(pe || "0", 10)), ge = new Date(ne, P - 1, te), he = new Date(me, fe - 1, ve), we = k(ne, P, te) && ge.toString() !== "Invalid Date", Ae = k(me, fe, ve) && he.toString() !== "Invalid Date";
1011
+ const s = r.substring(0, 10), w = r.substring(13, 23), [V, te, ne] = s.split("/").map((pe) => parseInt(pe || "0", 10)), [fe, ve, me] = w.split("/").map((pe) => parseInt(pe || "0", 10)), ge = new Date(ne, V - 1, te), he = new Date(me, fe - 1, ve), we = k(ne, V, te) && ge.toString() !== "Invalid Date", Ae = k(me, fe, ve) && he.toString() !== "Invalid Date";
1012
1012
  return { start: we ? ge : null, end: Ae ? he : null };
1013
- }, V = e.externalValid ?? U(!0), N = d(() => w(t.value)), J = d(() => {
1014
- const r = I(N.value.start), s = I(N.value.end);
1013
+ }, P = e.externalValid ?? U(!0), z = d(() => S(t.value)), Q = d(() => {
1014
+ const r = I(z.value.start), s = I(z.value.end);
1015
1015
  return { start: r, end: s };
1016
- }), j = d(() => {
1017
- if (!f.value) return;
1018
- const r = J.value.start, s = J.value.end;
1016
+ }), J = d(() => {
1017
+ if (!p.value) return;
1018
+ const r = Q.value.start, s = Q.value.end;
1019
1019
  if (!r || !s) return;
1020
- const S = Math.abs(h(s) - h(r));
1021
- return Math.round(S / 864e5 + 1);
1022
- }), ee = d(() => {
1023
- if (!f.value) return !1;
1024
- const { start: r, end: s } = N.value;
1025
- if (!r || !s || !J.value.start || !J.value.end) return !1;
1026
- const S = J.value.start, P = J.value.end;
1027
- return !(!H(S, P) || typeof e.maxSpanDays == "number" && j.value !== void 0 && j.value > e.maxSpanDays);
1028
- }), ie = d(() => {
1029
- const { start: r, end: s } = N.value;
1030
- if (!f.value) return "incomplete";
1020
+ const w = Math.abs(h(s) - h(r));
1021
+ return Math.round(w / 864e5 + 1);
1022
+ }), ee = U(!1), oe = d(() => {
1023
+ if (!ee.value) return;
1024
+ const { start: r, end: s } = z.value;
1025
+ if (!p.value) return "incomplete";
1031
1026
  if (!r || !s) return "invalid-date";
1032
- if (!J.value.start || !J.value.end) return "out-of-bounds";
1033
- const S = J.value.start, P = J.value.end;
1034
- return H(S, P) ? typeof e.maxSpanDays == "number" && j.value !== void 0 && j.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
1035
- }), o = U(void 0), b = d(() => {
1036
- if (V.value !== !1) return "";
1037
- const { min: r, max: s } = e, S = o.value;
1038
- if (!S) return "";
1039
- switch (S) {
1027
+ if (!Q.value.start || !Q.value.end) return "out-of-bounds";
1028
+ const w = Q.value.start, V = Q.value.end;
1029
+ return Z(w, V) ? typeof e.maxSpanDays == "number" && J.value !== void 0 && J.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
1030
+ }), o = d(() => {
1031
+ const r = oe.value;
1032
+ return r === void 0 || r === "valid";
1033
+ }), b = d(() => {
1034
+ const { min: r, max: s } = e, w = oe.value;
1035
+ if (!w) return "";
1036
+ switch (w) {
1040
1037
  case "incomplete":
1041
1038
  return "Required";
1042
1039
  case "invalid-date":
@@ -1050,80 +1047,80 @@ function vt(e) {
1050
1047
  default:
1051
1048
  return "";
1052
1049
  }
1053
- }), u = ["ArrowUp", "ArrowDown"], p = ["ArrowLeft", "ArrowRight"], E = (r, s) => String(r).padStart(s, "0"), v = (r) => `${E(r.getMonth() + 1, 2)}/${E(r.getDate(), 2)}/${E(
1050
+ }), u = ["ArrowUp", "ArrowDown"], f = ["ArrowLeft", "ArrowRight"], E = (r, s) => String(r).padStart(s, "0"), v = (r) => `${E(r.getMonth() + 1, 2)}/${E(r.getDate(), 2)}/${E(
1054
1051
  r.getFullYear(),
1055
1052
  4
1056
- )}`, M = (r) => r <= 2 ? { side: "start", part: "mm" } : r <= 5 ? { side: "start", part: (r <= 3, "dd") } : r <= 11 ? { side: "start", part: "yyyy" } : r <= 15 ? { side: "end", part: "mm" } : r <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, L = (r, s, S) => {
1057
- const P = s?.selectionStart ?? l.value ?? 0;
1058
- l.value = P;
1059
- const { start: te, end: ne } = w(t.value);
1053
+ )}`, M = (r) => r <= 2 ? { side: "start", part: "mm" } : r <= 5 ? { side: "start", part: (r <= 3, "dd") } : r <= 11 ? { side: "start", part: "yyyy" } : r <= 15 ? { side: "end", part: "mm" } : r <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, L = (r, s, w) => {
1054
+ const V = s?.selectionStart ?? l.value ?? 0;
1055
+ l.value = V;
1056
+ const { start: te, end: ne } = S(t.value);
1060
1057
  if (!te && !ne) {
1061
- const G = /* @__PURE__ */ new Date(), ce = v(G);
1062
- t.value = `${ce} - ${ce}`, e.onChange({ value: { start: G, end: G }, event: S }), Z(() => {
1058
+ const j = /* @__PURE__ */ new Date(), ce = v(j);
1059
+ t.value = `${ce} - ${ce}`, e.onChange({ value: { start: j, end: j }, event: w }), H(() => {
1063
1060
  requestAnimationFrame(() => {
1064
1061
  const re = document.getElementById(
1065
1062
  e.id
1066
- ), oe = l.value ?? 0;
1067
- re && (re.focus(), re.setSelectionRange(oe, oe));
1063
+ ), ie = l.value ?? 0;
1064
+ re && (re.focus(), re.setSelectionRange(ie, ie));
1068
1065
  });
1069
1066
  });
1070
1067
  return;
1071
1068
  }
1072
- const fe = /* @__PURE__ */ new Date(), ve = M(P);
1069
+ const fe = /* @__PURE__ */ new Date(), ve = M(V);
1073
1070
  let me = te ? new Date(te) : new Date(fe), ge = ne ? new Date(ne) : new Date(fe);
1074
- const he = (G, ce) => {
1071
+ const he = (j, ce) => {
1075
1072
  if (ce === "mm") {
1076
- const re = G.getMonth() + 1, oe = r === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
1077
- G.setMonth(oe - 1);
1078
- const Se = R(G.getFullYear(), oe);
1079
- G.getDate() > Se && G.setDate(Se);
1073
+ const re = j.getMonth() + 1, ie = r === "ArrowUp" ? re < 12 ? re + 1 : 1 : re > 1 ? re - 1 : 12;
1074
+ j.setMonth(ie - 1);
1075
+ const Se = R(j.getFullYear(), ie);
1076
+ j.getDate() > Se && j.setDate(Se);
1080
1077
  } else if (ce === "dd") {
1081
- const re = R(G.getFullYear(), G.getMonth() + 1), oe = G.getDate(), Se = r === "ArrowUp" ? oe < re ? oe + 1 : 1 : oe > 1 ? oe - 1 : re;
1082
- G.setDate(Se);
1078
+ const re = R(j.getFullYear(), j.getMonth() + 1), ie = j.getDate(), Se = r === "ArrowUp" ? ie < re ? ie + 1 : 1 : ie > 1 ? ie - 1 : re;
1079
+ j.setDate(Se);
1083
1080
  } else if (ce === "yyyy") {
1084
- const re = G.getFullYear();
1085
- G.setFullYear(r === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
1086
- const oe = R(G.getFullYear(), G.getMonth() + 1);
1087
- G.getDate() > oe && G.setDate(oe);
1081
+ const re = j.getFullYear();
1082
+ j.setFullYear(r === "ArrowUp" ? re + 1 : Math.max(1, re - 1));
1083
+ const ie = R(j.getFullYear(), j.getMonth() + 1);
1084
+ j.getDate() > ie && j.setDate(ie);
1088
1085
  }
1089
1086
  };
1090
1087
  ve.side === "start" ? he(me, ve.part) : he(ge, ve.part);
1091
1088
  const we = v(me), Ae = v(ge);
1092
1089
  t.value = `${we} - ${Ae}`;
1093
1090
  const pe = I(me), ke = I(ge);
1094
- pe && ke && H(pe, ke) ? e.onChange({ value: { start: pe, end: ke }, event: S }) : e.onChange({ value: null, event: S }), Z(() => {
1091
+ pe && ke && Z(pe, ke) ? e.onChange({ value: { start: pe, end: ke }, event: w }) : e.onChange({ value: null, event: w }), H(() => {
1095
1092
  requestAnimationFrame(() => {
1096
- const G = document.getElementById(
1093
+ const j = document.getElementById(
1097
1094
  e.id
1098
1095
  ), ce = l.value ?? 0;
1099
- G && (G.focus(), G.setSelectionRange(ce, ce));
1096
+ j && (j.focus(), j.setSelectionRange(ce, ce));
1100
1097
  });
1101
1098
  });
1102
1099
  }, Y = (r) => {
1103
- const { start: s, end: S } = w(t.value);
1104
- if (!s || !S) {
1100
+ const { start: s, end: w } = S(t.value);
1101
+ if (!s || !w) {
1105
1102
  e.onChange({ value: null, event: r });
1106
1103
  return;
1107
1104
  }
1108
- const P = I(s), te = I(S);
1109
- if (!P || !te) {
1105
+ const V = I(s), te = I(w);
1106
+ if (!V || !te) {
1110
1107
  e.onChange({ value: null, event: r });
1111
1108
  return;
1112
1109
  }
1113
- if (!H(P, te)) {
1110
+ if (!Z(V, te)) {
1114
1111
  e.onChange({ value: null, event: r });
1115
1112
  return;
1116
1113
  }
1117
- e.onChange({ value: { start: P, end: te }, event: r });
1114
+ e.onChange({ value: { start: V, end: te }, event: r });
1118
1115
  }, ae = (r) => {
1119
- const s = r.value ?? "", S = r.event;
1120
- if (!s && S && S.type === "click") {
1121
- W(S);
1116
+ const s = r.value ?? "", w = r.event;
1117
+ if (!s && w && w.type === "click") {
1118
+ W(w);
1122
1119
  return;
1123
1120
  }
1124
1121
  t.value = s;
1125
- const P = S?.target;
1126
- l.value = P?.selectionStart ?? 0, Y(r);
1122
+ const V = w?.target;
1123
+ l.value = V?.selectionStart ?? 0, Y(r);
1127
1124
  }, se = (r) => {
1128
1125
  l.value = r.target.selectionStart ?? 0;
1129
1126
  }, a = (r) => {
@@ -1146,16 +1143,16 @@ function vt(e) {
1146
1143
  const s = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1147
1144
  L(s, r.target, r);
1148
1145
  }, $ = (r) => {
1149
- if (p.includes(r.key) || u.includes(r.key)) {
1146
+ if (f.includes(r.key) || u.includes(r.key)) {
1150
1147
  const s = r.target;
1151
1148
  l.value = s?.selectionStart ?? 0;
1152
1149
  }
1153
- }, K = () => {
1154
- o.value = ie.value, (e.manageValid ?? !0) && (V.value = ee.value);
1155
- }, B = (r) => {
1156
- K();
1150
+ }, N = () => {
1151
+ ee.value = !0, (e.manageValid ?? !0) && (P.value = o.value);
1152
+ }, K = (r) => {
1153
+ N();
1157
1154
  }, W = (r) => {
1158
- console.log("Clear event:", r), t.value = "", l.value = 0, e.onChange({ value: null, event: r }), K(), Z(() => {
1155
+ console.log("Clear event:", r), t.value = "", l.value = 0, e.onChange({ value: null, event: r }), N(), H(() => {
1159
1156
  const s = document.getElementById(
1160
1157
  e.id
1161
1158
  );
@@ -1165,13 +1162,13 @@ function vt(e) {
1165
1162
  e.externalValue && de(
1166
1163
  e.externalValue,
1167
1164
  (r) => {
1168
- const s = r?.start ?? null, S = r?.end ?? null;
1169
- if (s && S) {
1170
- if (t.value = `${v(s)} - ${v(S)}`, e.isOpen?.value && m.value && e.onRequestClose) {
1171
- const P = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
1165
+ const s = r?.start ?? null, w = r?.end ?? null;
1166
+ if (s && w) {
1167
+ if (t.value = `${v(s)} - ${v(w)}`, e.isOpen?.value && m.value && e.onRequestClose) {
1168
+ const V = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
1172
1169
  setTimeout(() => {
1173
- e.onRequestClose?.(), m.value = !1, K();
1174
- }, P);
1170
+ e.onRequestClose?.(), m.value = !1, N();
1171
+ }, V);
1175
1172
  }
1176
1173
  return;
1177
1174
  }
@@ -1188,10 +1185,10 @@ function vt(e) {
1188
1185
  () => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
1189
1186
  ), _ = d(
1190
1187
  () => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
1191
- ), Q = d(
1188
+ ), X = d(
1192
1189
  () => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
1193
1190
  ), O = d(() => {
1194
- const { start: r, end: s } = w(t.value);
1191
+ const { start: r, end: s } = S(t.value);
1195
1192
  return [
1196
1193
  {
1197
1194
  label: "Raw",
@@ -1215,33 +1212,33 @@ function vt(e) {
1215
1212
  label: "End",
1216
1213
  value: `${String(q.value).padStart(2, "0")} / ${String(
1217
1214
  _.value
1218
- ).padStart(2, "0")} / ${String(Q.value).padStart(4, "0")}`
1215
+ ).padStart(2, "0")} / ${String(X.value).padStart(4, "0")}`
1219
1216
  },
1220
1217
  { label: "Digits only", value: y.value },
1221
- { label: "Mask complete", value: `${f.value}` },
1218
+ { label: "Mask complete", value: `${p.value}` },
1222
1219
  {
1223
1220
  label: "Parsed",
1224
1221
  value: `${r ? r.toDateString() : "-"} | ${s ? s.toDateString() : "-"}`
1225
1222
  },
1226
1223
  {
1227
1224
  label: "Valid (managed)",
1228
- value: `${V.value ?? "-"}`
1225
+ value: `${P.value ?? "-"}`
1229
1226
  },
1230
- { label: "Span (days)", value: `${j.value ?? "-"}` },
1227
+ { label: "Span (days)", value: `${J.value ?? "-"}` },
1231
1228
  {
1232
1229
  label: "Reason",
1233
- value: `${ie.value ?? "-"}`
1230
+ value: `${oe.value ?? "-"}`
1234
1231
  },
1235
1232
  {
1236
1233
  label: "Cursor in",
1237
1234
  value: `${l.value ?? "-"} (${(() => {
1238
- const S = l.value ?? 0, P = M(S);
1239
- return `${P.side}.${P.part}`;
1235
+ const w = l.value ?? 0, V = M(w);
1236
+ return `${V.side}.${V.part}`;
1240
1237
  })()})`
1241
1238
  }
1242
1239
  ];
1243
- }), z = () => {
1244
- Z(() => {
1240
+ }), B = () => {
1241
+ H(() => {
1245
1242
  const r = document.getElementById(e.id);
1246
1243
  if (!r) {
1247
1244
  console.warn(`#${e.id} not found for styling.`);
@@ -1256,24 +1253,24 @@ function vt(e) {
1256
1253
  });
1257
1254
  };
1258
1255
  Me(() => {
1259
- z();
1256
+ B();
1260
1257
  });
1261
1258
  const ue = () => {
1262
- Z(() => {
1259
+ H(() => {
1263
1260
  try {
1264
1261
  const r = Array.from(
1265
1262
  document.querySelectorAll(".k-animation-container")
1266
1263
  );
1267
1264
  if (!r.length) return;
1268
- const S = [...r].reverse().find((ne) => ne.querySelector(".k-calendar"))?.querySelector(
1265
+ const w = [...r].reverse().find((ne) => ne.querySelector(".k-calendar"))?.querySelector(
1269
1266
  ".k-calendar"
1270
1267
  );
1271
- if (!S) return;
1272
- const P = S.querySelectorAll(
1268
+ if (!w) return;
1269
+ const V = w.querySelectorAll(
1273
1270
  ".k-calendar-table"
1274
1271
  );
1275
1272
  let te = !1;
1276
- P.forEach((ne) => {
1273
+ V.forEach((ne) => {
1277
1274
  ne.tabIndex === 0 && (te ? ne.tabIndex = -1 : te = !0);
1278
1275
  });
1279
1276
  } catch (r) {
@@ -1293,28 +1290,28 @@ function vt(e) {
1293
1290
  debugEnabled: D,
1294
1291
  debugLines: O,
1295
1292
  digitsOnly: y,
1296
- valid: V,
1297
- validComputed: X(ee),
1298
- reason: X(ie),
1299
- validationMessage: X(b),
1300
- spanDays: X(j),
1301
- month1: X(n),
1302
- day1: X(i),
1303
- year1: X(F),
1304
- month2: X(q),
1305
- day2: X(_),
1306
- year2: X(Q),
1293
+ valid: P,
1294
+ validComputed: G(o),
1295
+ reason: G(oe),
1296
+ validationMessage: G(b),
1297
+ spanDays: G(J),
1298
+ month1: G(n),
1299
+ day1: G(i),
1300
+ year1: G(F),
1301
+ month2: G(q),
1302
+ day2: G(_),
1303
+ year2: G(X),
1307
1304
  handleChange: ae,
1308
1305
  handleKeyDown: a,
1309
1306
  handleWheel: c,
1310
1307
  handleKeyUp: $,
1311
1308
  handleClick: se,
1312
- handleBlur: B,
1309
+ handleBlur: K,
1313
1310
  handleClear: W,
1314
1311
  onCalendarChange: () => {
1315
1312
  m.value = !0;
1316
1313
  },
1317
- initStyling: z
1314
+ initStyling: B
1318
1315
  };
1319
1316
  }
1320
1317
  function mt(e) {
@@ -1331,55 +1328,55 @@ function mt(e) {
1331
1328
  }), h = d(() => {
1332
1329
  const n = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(n);
1333
1330
  return Math.min(Math.max(i, 0), 59);
1334
- }), I = d(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), H = d(() => {
1331
+ }), I = d(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), Z = d(() => {
1335
1332
  const n = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = I.value;
1336
1333
  return n === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? n + 12 : n;
1337
- }), f = d(() => w.value ? `${String(H.value).padStart(2, "0")}:${String(h.value).padStart(2, "0")}:00` : null), w = d(
1334
+ }), p = d(() => S.value ? `${String(Z.value).padStart(2, "0")}:${String(h.value).padStart(2, "0")}:00` : null), S = d(
1338
1335
  () => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
1339
- ), V = (n, i, F) => {
1336
+ ), P = (n, i, F) => {
1340
1337
  let q = n % 12;
1341
1338
  return q === 0 && (q = 12), `${String(q).padStart(2, "0")}:${String(i).padStart(
1342
1339
  2,
1343
1340
  "0"
1344
1341
  )} ${F}`;
1345
- }, N = (n) => {
1342
+ }, z = (n) => {
1346
1343
  const i = n.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1347
1344
  if (!i) return null;
1348
1345
  const F = parseInt(i[1]), q = parseInt(i[2]), _ = i[3].toUpperCase();
1349
1346
  if (F < 1 || F > 12 || q < 0 || q > 59) return null;
1350
- let Q = F % 12;
1351
- _ === "PM" && (Q += 12);
1347
+ let X = F % 12;
1348
+ _ === "PM" && (X += 12);
1352
1349
  const O = /* @__PURE__ */ new Date();
1353
- return O.setSeconds(0, 0), O.setHours(Q), O.setMinutes(q), O;
1354
- }, J = (n) => {
1350
+ return O.setSeconds(0, 0), O.setHours(X), O.setMinutes(q), O;
1351
+ }, Q = (n) => {
1355
1352
  if (T.value.length === 0) {
1356
1353
  e.onChange({ value: null, event: n });
1357
1354
  return;
1358
1355
  }
1359
- if (!w.value) {
1356
+ if (!S.value) {
1360
1357
  e.onChange({ value: null, event: n });
1361
1358
  return;
1362
1359
  }
1363
- const i = N(t.value);
1360
+ const i = z(t.value);
1364
1361
  i && ee(i) ? e.onChange({ value: i, event: n }) : e.onChange({ value: null, event: n });
1365
- }, j = (n) => n.getHours() * 60 + n.getMinutes(), ee = (n) => {
1366
- const i = e.min ?? void 0, F = e.max ?? void 0, q = j(n);
1362
+ }, J = (n) => n.getHours() * 60 + n.getMinutes(), ee = (n) => {
1363
+ const i = e.min ?? void 0, F = e.max ?? void 0, q = J(n);
1367
1364
  if (i) {
1368
- const _ = j(i);
1365
+ const _ = J(i);
1369
1366
  if (q < _) return !1;
1370
1367
  }
1371
1368
  if (F) {
1372
- const _ = j(F);
1369
+ const _ = J(F);
1373
1370
  if (q > _) return !1;
1374
1371
  }
1375
1372
  return !0;
1376
- }, ie = (n) => {
1373
+ }, oe = (n) => {
1377
1374
  const i = n.getHours(), F = i >= 12 ? "PM" : "AM";
1378
- t.value = V(i, n.getMinutes(), F);
1375
+ t.value = P(i, n.getMinutes(), F);
1379
1376
  }, o = (n, i) => {
1380
1377
  e.onChange({ value: n, event: i });
1381
1378
  }, b = () => {
1382
- Z(() => {
1379
+ H(() => {
1383
1380
  requestAnimationFrame(() => {
1384
1381
  requestAnimationFrame(() => {
1385
1382
  const n = document.getElementById(
@@ -1396,7 +1393,7 @@ function mt(e) {
1396
1393
  }, u = (n) => {
1397
1394
  const i = n?.event?.target;
1398
1395
  return i ? i.closest(".k-time-now") ? "now" : i.closest(".k-time-accept") ? "set" : null : null;
1399
- }, p = (n, i) => {
1396
+ }, f = (n, i) => {
1400
1397
  n && ee(n) ? o(n, i) : o(null, i);
1401
1398
  }, E = (...n) => {
1402
1399
  const i = n[0];
@@ -1404,12 +1401,12 @@ function mt(e) {
1404
1401
  const F = u(i);
1405
1402
  if (F === "now") {
1406
1403
  const _ = /* @__PURE__ */ new Date();
1407
- ie(_), p(_, i), b();
1404
+ oe(_), f(_, i), b();
1408
1405
  return;
1409
1406
  }
1410
1407
  if (i?.value instanceof Date) {
1411
1408
  const _ = new Date(i.value);
1412
- ie(_), p(_, i), F === "set" && b();
1409
+ oe(_), f(_, i), F === "set" && b();
1413
1410
  return;
1414
1411
  }
1415
1412
  if (i?.value === null) {
@@ -1422,15 +1419,15 @@ function mt(e) {
1422
1419
  try {
1423
1420
  const _ = l.value ?? 0;
1424
1421
  if (R(_) === "ampm" && (t.value ?? "").length >= 8) {
1425
- const Q = t.value.charAt(6);
1426
- /[Aa]/.test(Q) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, Z(() => {
1422
+ const X = t.value.charAt(6);
1423
+ /[Aa]/.test(X) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, H(() => {
1427
1424
  requestAnimationFrame(() => {
1428
1425
  const O = document.getElementById(
1429
1426
  e.id
1430
1427
  );
1431
1428
  O && (O.focus(), O.setSelectionRange(8, 8));
1432
1429
  });
1433
- })) : /[Pp]/.test(Q) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, Z(() => {
1430
+ })) : /[Pp]/.test(X) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, H(() => {
1434
1431
  requestAnimationFrame(() => {
1435
1432
  const O = document.getElementById(
1436
1433
  e.id
@@ -1441,19 +1438,19 @@ function mt(e) {
1441
1438
  }
1442
1439
  } catch {
1443
1440
  }
1444
- J(i);
1441
+ Q(i);
1445
1442
  }, v = (n) => {
1446
1443
  l.value = n.target.selectionStart ?? 0;
1447
1444
  }, M = (n, i, F) => {
1448
1445
  const q = i?.selectionStart ?? l.value ?? 0;
1449
1446
  l.value = q;
1450
- const _ = R(q), Q = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1451
- if (!Q) {
1447
+ const _ = R(q), X = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1448
+ if (!X) {
1452
1449
  if ((t.value ?? "").length === 0 || T.value.length === 0) {
1453
- const s = /* @__PURE__ */ new Date(), S = s.getHours(), P = S >= 12 ? "PM" : "AM";
1454
- t.value = V(S, s.getMinutes(), P);
1455
- const te = N(t.value);
1456
- p(te, F), Z(() => {
1450
+ const s = /* @__PURE__ */ new Date(), w = s.getHours(), V = w >= 12 ? "PM" : "AM";
1451
+ t.value = P(w, s.getMinutes(), V);
1452
+ const te = z(t.value);
1453
+ f(te, F), H(() => {
1457
1454
  requestAnimationFrame(() => {
1458
1455
  const ne = document.getElementById(
1459
1456
  e.id
@@ -1464,34 +1461,34 @@ function mt(e) {
1464
1461
  }
1465
1462
  return;
1466
1463
  }
1467
- let O = parseInt(Q[1]), z = parseInt(Q[2]), ue = Q[3].toUpperCase();
1464
+ let O = parseInt(X[1]), B = parseInt(X[2]), ue = X[3].toUpperCase();
1468
1465
  if (_ === "hh")
1469
1466
  n === "ArrowUp" ? O = O < 12 ? O + 1 : 1 : O = O > 1 ? O - 1 : 12;
1470
1467
  else if (_ === "mm") {
1471
1468
  const s = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
1472
1469
  if (s === 1)
1473
- n === "ArrowUp" ? z = z < 59 ? z + 1 : 0 : z = z > 0 ? z - 1 : 59;
1470
+ n === "ArrowUp" ? B = B < 59 ? B + 1 : 0 : B = B > 0 ? B - 1 : 59;
1474
1471
  else if (n === "ArrowUp") {
1475
- const S = z % s;
1476
- let P = S === 0 ? z + s : z + (s - S);
1477
- P >= 60 && (P = 0), z = P;
1472
+ const w = B % s;
1473
+ let V = w === 0 ? B + s : B + (s - w);
1474
+ V >= 60 && (V = 0), B = V;
1478
1475
  } else {
1479
- const S = z % s;
1480
- let P = S === 0 ? z - s : z - S;
1481
- P < 0 && (P = 60 - s), z = P;
1476
+ const w = B % s;
1477
+ let V = w === 0 ? B - s : B - w;
1478
+ V < 0 && (V = 60 - s), B = V;
1482
1479
  }
1483
1480
  } else _ === "ampm" && (ue = ue === "AM" ? "PM" : "AM");
1484
- t.value = `${String(O).padStart(2, "0")}:${String(z).padStart(
1481
+ t.value = `${String(O).padStart(2, "0")}:${String(B).padStart(
1485
1482
  2,
1486
1483
  "0"
1487
1484
  )} ${ue}`;
1488
- const r = N(t.value);
1489
- p(r, F), Z(() => {
1485
+ const r = z(t.value);
1486
+ f(r, F), H(() => {
1490
1487
  requestAnimationFrame(() => {
1491
1488
  const s = document.getElementById(
1492
1489
  e.id
1493
- ), S = l.value ?? 0;
1494
- s && (s.focus(), s.setSelectionRange(S, S));
1490
+ ), w = l.value ?? 0;
1491
+ s && (s.focus(), s.setSelectionRange(w, w));
1495
1492
  });
1496
1493
  });
1497
1494
  }, L = (n) => {
@@ -1536,7 +1533,7 @@ function mt(e) {
1536
1533
  const i = new Date(n);
1537
1534
  if (i.toString() !== "Invalid Date") {
1538
1535
  const F = i.getHours(), q = F >= 12 ? "PM" : "AM";
1539
- t.value = V(F, i.getMinutes(), q);
1536
+ t.value = P(F, i.getMinutes(), q);
1540
1537
  return;
1541
1538
  }
1542
1539
  }
@@ -1546,10 +1543,10 @@ function mt(e) {
1546
1543
  const a = d(() => [
1547
1544
  ["Time", t.value || "--:-- --"],
1548
1545
  ["Hour (12h)", k.value],
1549
- ["Hour (24h)", H.value],
1546
+ ["Hour (24h)", Z.value],
1550
1547
  ["Minute", h.value],
1551
1548
  ["Period", I.value],
1552
- ["Time (24h)", f.value ?? "--:--:--"],
1549
+ ["Time (24h)", p.value ?? "--:--:--"],
1553
1550
  ["Digits only", T.value],
1554
1551
  [
1555
1552
  "Parsed Date",
@@ -1573,32 +1570,32 @@ function mt(e) {
1573
1570
  }) ?? null
1574
1571
  ],
1575
1572
  ["valid", $.value],
1576
- ["reason", K.value],
1577
- ["validationMessage", B.value]
1573
+ ["reason", N.value],
1574
+ ["validationMessage", K.value]
1578
1575
  ]), c = d(
1579
- () => N(t.value) ?? null
1576
+ () => z(t.value) ?? null
1580
1577
  ), $ = d(() => {
1581
1578
  if (!g.value) {
1582
- if (!w.value) return !0;
1579
+ if (!S.value) return !0;
1583
1580
  const i = c.value;
1584
1581
  return i ? ee(i) : !1;
1585
1582
  }
1586
1583
  if (!C.value) return !0;
1587
1584
  const n = c.value;
1588
- return !w.value || !n ? !1 : ee(n);
1589
- }), K = d(() => {
1585
+ return !S.value || !n ? !1 : ee(n);
1586
+ }), N = d(() => {
1590
1587
  if (!g.value) {
1591
- if (!w.value) return;
1588
+ if (!S.value) return;
1592
1589
  const i = c.value;
1593
1590
  return i ? ee(i) ? "valid" : "out-of-bounds" : "invalid-time";
1594
1591
  }
1595
1592
  if (!C.value) return;
1596
- if (T.value.length === 0 || !w.value)
1593
+ if (T.value.length === 0 || !S.value)
1597
1594
  return "incomplete";
1598
1595
  const n = c.value;
1599
1596
  return n ? ee(n) ? "valid" : "out-of-bounds" : "invalid-time";
1600
- }), B = d(() => {
1601
- const n = K.value;
1597
+ }), K = d(() => {
1598
+ const n = N.value;
1602
1599
  if (!n || n === "valid") return "";
1603
1600
  if (n === "incomplete")
1604
1601
  return "Required";
@@ -1615,7 +1612,7 @@ function mt(e) {
1615
1612
  }
1616
1613
  return "";
1617
1614
  }), W = () => {
1618
- Z(() => {
1615
+ H(() => {
1619
1616
  const n = document.getElementById(e.id);
1620
1617
  if (!n) {
1621
1618
  console.warn(`#${e.id} not found for styling.`);
@@ -1647,17 +1644,17 @@ function mt(e) {
1647
1644
  debugLines: a,
1648
1645
  placeholder: m,
1649
1646
  isValid: $,
1650
- reason: X(K),
1651
- validationMessage: B,
1652
- isComplete: w,
1647
+ reason: G(N),
1648
+ validationMessage: K,
1649
+ isComplete: S,
1653
1650
  inRangeTime: ee,
1654
1651
  cursorPos: l,
1655
- hour: X(k),
1656
- hour24: X(H),
1657
- minute: X(h),
1658
- period: X(I),
1659
- time24: X(f),
1660
- parsedRawTime: X(c),
1652
+ hour: G(k),
1653
+ hour24: G(Z),
1654
+ minute: G(h),
1655
+ period: G(I),
1656
+ time24: G(p),
1657
+ parsedRawTime: G(c),
1661
1658
  handleChange: E,
1662
1659
  handleKeyDown: L,
1663
1660
  handleKeyUp: ae,
@@ -1740,64 +1737,64 @@ function it(e, t, l = {}) {
1740
1737
  return A ? { stop: ye, cancel: ye, trigger: ye } : ye;
1741
1738
  if (rt && !Ce) {
1742
1739
  Ce = !0;
1743
- const f = { passive: !0 };
1744
- Array.from(D.document.body.children).forEach((w) => w.addEventListener("click", ye, f)), D.document.documentElement.addEventListener("click", ye, f);
1740
+ const p = { passive: !0 };
1741
+ Array.from(D.document.body.children).forEach((S) => S.addEventListener("click", ye, p)), D.document.documentElement.addEventListener("click", ye, p);
1745
1742
  }
1746
1743
  let x = !0;
1747
- const T = (f) => le(m).some((w) => {
1748
- if (typeof w == "string")
1749
- return Array.from(D.document.querySelectorAll(w)).some((V) => V === f.target || f.composedPath().includes(V));
1744
+ const T = (p) => le(m).some((S) => {
1745
+ if (typeof S == "string")
1746
+ return Array.from(D.document.querySelectorAll(S)).some((P) => P === p.target || p.composedPath().includes(P));
1750
1747
  {
1751
- const V = be(w);
1752
- return V && (f.target === V || f.composedPath().includes(V));
1748
+ const P = be(S);
1749
+ return P && (p.target === P || p.composedPath().includes(P));
1753
1750
  }
1754
1751
  });
1755
- function y(f) {
1756
- const w = le(f);
1757
- return w && w.$.subTree.shapeFlag === 16;
1752
+ function y(p) {
1753
+ const S = le(p);
1754
+ return S && S.$.subTree.shapeFlag === 16;
1758
1755
  }
1759
- function R(f, w) {
1760
- const V = le(f), N = V.$.subTree && V.$.subTree.children;
1761
- return N == null || !Array.isArray(N) ? !1 : N.some((J) => J.el === w.target || w.composedPath().includes(J.el));
1756
+ function R(p, S) {
1757
+ const P = le(p), z = P.$.subTree && P.$.subTree.children;
1758
+ return z == null || !Array.isArray(z) ? !1 : z.some((Q) => Q.el === S.target || S.composedPath().includes(Q.el));
1762
1759
  }
1763
- const k = (f) => {
1764
- const w = be(e);
1765
- if (f.target != null && !(!(w instanceof Element) && y(e) && R(e, f)) && !(!w || w === f.target || f.composedPath().includes(w))) {
1766
- if ("detail" in f && f.detail === 0 && (x = !T(f)), !x) {
1760
+ const k = (p) => {
1761
+ const S = be(e);
1762
+ if (p.target != null && !(!(S instanceof Element) && y(e) && R(e, p)) && !(!S || S === p.target || p.composedPath().includes(S))) {
1763
+ if ("detail" in p && p.detail === 0 && (x = !T(p)), !x) {
1767
1764
  x = !0;
1768
1765
  return;
1769
1766
  }
1770
- t(f);
1767
+ t(p);
1771
1768
  }
1772
1769
  };
1773
1770
  let h = !1;
1774
1771
  const I = [
1775
- xe(D, "click", (f) => {
1772
+ xe(D, "click", (p) => {
1776
1773
  h || (h = !0, setTimeout(() => {
1777
1774
  h = !1;
1778
- }, 0), k(f));
1775
+ }, 0), k(p));
1779
1776
  }, { passive: !0, capture: g }),
1780
- xe(D, "pointerdown", (f) => {
1781
- const w = be(e);
1782
- x = !T(f) && !!(w && !f.composedPath().includes(w));
1777
+ xe(D, "pointerdown", (p) => {
1778
+ const S = be(e);
1779
+ x = !T(p) && !!(S && !p.composedPath().includes(S));
1783
1780
  }, { passive: !0 }),
1784
- C && xe(D, "blur", (f) => {
1781
+ C && xe(D, "blur", (p) => {
1785
1782
  setTimeout(() => {
1786
- var w;
1787
- const V = be(e);
1788
- ((w = D.document.activeElement) == null ? void 0 : w.tagName) === "IFRAME" && !V?.contains(D.document.activeElement) && t(f);
1783
+ var S;
1784
+ const P = be(e);
1785
+ ((S = D.document.activeElement) == null ? void 0 : S.tagName) === "IFRAME" && !P?.contains(D.document.activeElement) && t(p);
1789
1786
  }, 0);
1790
1787
  }, { passive: !0 })
1791
- ].filter(Boolean), H = () => I.forEach((f) => f());
1788
+ ].filter(Boolean), Z = () => I.forEach((p) => p());
1792
1789
  return A ? {
1793
- stop: H,
1790
+ stop: Z,
1794
1791
  cancel: () => {
1795
1792
  x = !1;
1796
1793
  },
1797
- trigger: (f) => {
1798
- x = !0, k(f), x = !1;
1794
+ trigger: (p) => {
1795
+ x = !0, k(p), x = !1;
1799
1796
  }
1800
- } : H;
1797
+ } : Z;
1801
1798
  }
1802
1799
  function gt(e) {
1803
1800
  const t = Ue(null), l = [
@@ -1820,10 +1817,10 @@ function gt(e) {
1820
1817
  const y = (k, h) => {
1821
1818
  const I = Array.from(k.querySelectorAll(h));
1822
1819
  if (!I.length) return null;
1823
- const H = I.filter(
1824
- (f) => f.offsetParent !== null || f.getClientRects().length > 0
1820
+ const Z = I.filter(
1821
+ (p) => p.offsetParent !== null || p.getClientRects().length > 0
1825
1822
  );
1826
- return H[H.length - 1] ?? I[I.length - 1] ?? null;
1823
+ return Z[Z.length - 1] ?? I[I.length - 1] ?? null;
1827
1824
  }, R = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
1828
1825
  for (const k of D) {
1829
1826
  const h = y(R, k);
@@ -1840,12 +1837,12 @@ function gt(e) {
1840
1837
  }), de(
1841
1838
  () => e.isOpen.value,
1842
1839
  (y) => {
1843
- y ? (x.value = null, Z(() => {
1840
+ y ? (x.value = null, H(() => {
1844
1841
  const R = T();
1845
1842
  R && (t.value = R, setTimeout(() => g(), 0), A || (A = (k) => {
1846
1843
  k.key === "Escape" && (x.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", k));
1847
1844
  }, document.addEventListener("keydown", A, !0)));
1848
- })) : (C(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, x.value === "outside" && Z(() => {
1845
+ })) : (C(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, x.value === "outside" && H(() => {
1849
1846
  const R = () => {
1850
1847
  const k = e.triggerEl?.value, h = k?.querySelector("input"), I = document.activeElement;
1851
1848
  I && (I === h || k && k.contains(I)) && (h ?? k)?.blur?.();
@@ -1854,7 +1851,7 @@ function gt(e) {
1854
1851
  }), e.returnFocusToTrigger !== !1 && x.value === "escape" && e.triggerEl?.value && (console.log(
1855
1852
  "Returning focus to trigger element:",
1856
1853
  e.triggerEl.value
1857
- ), Z(() => {
1854
+ ), H(() => {
1858
1855
  const R = () => {
1859
1856
  const k = e.triggerEl?.value;
1860
1857
  if (!k) return;
@@ -1867,7 +1864,7 @@ function gt(e) {
1867
1864
  popupRef: t,
1868
1865
  activate: g,
1869
1866
  deactivate: C,
1870
- lastCloseReason: X(x),
1867
+ lastCloseReason: G(x),
1871
1868
  setPopupEl: (y) => t.value = y
1872
1869
  };
1873
1870
  }