@featherk/composables 0.6.6 → 0.6.8

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,115 +1,127 @@
1
- import { ref as _, onBeforeUnmount as Ie, nextTick as N, computed as h, watch as ve, onMounted as xe, readonly as K, getCurrentScope as Le, onScopeDispose as Pe, toValue as ce, unref as Te, shallowRef as Re } from "vue";
1
+ import { ref as _, onBeforeUnmount as Te, nextTick as j, computed as h, watch as ve, onMounted as xe, readonly as N, getCurrentScope as Le, onScopeDispose as Pe, toValue as ce, unref as Fe, shallowRef as Re } from "vue";
2
2
  import { useFocusTrap as qe } from "@vueuse/integrations/useFocusTrap";
3
- const We = (e) => {
4
- const t = _(null);
5
- let c = !1, P = null, T = null;
6
- const V = [], W = ".k-table-row[data-grid-row-index] [tabindex]", k = () => e?.value?.columns, b = (o) => {
3
+ const _e = (e, t) => {
4
+ const u = _(null);
5
+ let q = !1, I = null, L = null;
6
+ const V = [], A = ".k-table-row[data-grid-row-index] [tabindex]", k = () => e?.value?.columns, S = (o) => {
7
7
  const m = o.key || o.code;
8
- [" ", "Spacebar", "Space", "Enter"].includes(m) && (o.preventDefault(), o.stopPropagation(), t.value = o.target, o.target.click());
9
- }, y = (o) => {
10
- if (!t.value) return;
8
+ [" ", "Spacebar", "Space", "Enter"].includes(m) && (o.preventDefault(), o.stopPropagation(), u.value = o.target, o.target.click());
9
+ }, g = (o) => {
10
+ if (!u.value) return;
11
11
  if (o.code === "Escape") {
12
- o.preventDefault(), o.stopPropagation(), t.value && t.value.focus();
12
+ o.stopPropagation(), u.value && u.value.focus();
13
13
  return;
14
14
  }
15
15
  const m = Array.from(
16
16
  document.querySelectorAll(
17
17
  ".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
18
18
  )
19
- ), l = document.querySelector(".k-filter-menu-container");
19
+ ), l = document.querySelector(
20
+ ".k-animation-container .k-popup .k-column-menu .k-filter-menu-container"
21
+ );
20
22
  if (l) {
21
23
  if (o.code === "Tab") {
22
- const i = [
23
- ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
24
- ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
25
- ".k-filter-menu-container button:not([tabindex='-1']):not([disabled])"
26
- ], p = Array.from(
27
- l.querySelectorAll(i.join(","))
24
+ const s = [
25
+ // ".k-filter-menu-container .k-dropdownlist[tabindex='0']",
26
+ // ".k-filter-menu-container input.k-input-inner:not([tabindex='-1']):not([disabled])",
27
+ // ".k-filter-menu-container button:not([tabindex='-1']):not([disabled])",
28
+ // ".k-checkbox",
29
+ ".k-dropdownlist[tabindex='0']",
30
+ "input.k-input-inner:not([tabindex='-1']):not([disabled])",
31
+ "button:not([tabindex='-1']):not([disabled])",
32
+ ".k-checkbox"
33
+ ], v = t?.focusableMenuSelectors ?? s, b = Array.from(
34
+ l.querySelectorAll(v.join(","))
28
35
  );
29
- if (p.length === 0) return;
30
- const A = p.findIndex(
31
- (I) => I === document.activeElement
36
+ if (b.length === 0) return;
37
+ const D = b.findIndex(
38
+ (H) => H === document.activeElement
32
39
  );
33
- let S;
34
- A === -1 ? S = 0 : o.shiftKey ? S = (A - 1 + p.length) % p.length : S = (A + 1) % p.length, o.preventDefault(), o.stopPropagation(), p[S]?.focus();
35
- return;
40
+ let $;
41
+ D === -1 ? $ = 0 : o.shiftKey ? $ = (D - 1 + b.length) % b.length : $ = (D + 1) % b.length, o.preventDefault(), o.stopPropagation(), b[$]?.focus();
36
42
  }
37
43
  } else if (o.code === "ArrowUp" || o.code === "ArrowDown") {
38
44
  o.preventDefault(), o.stopPropagation();
39
- const i = m.findIndex(
40
- (A) => A === document.activeElement
45
+ const s = m.findIndex(
46
+ (b) => b === document.activeElement
41
47
  );
42
- let p = i;
43
- o.code === "ArrowUp" ? p = i > 0 ? i - 1 : m.length - 1 : o.code === "ArrowDown" && (p = i < m.length - 1 ? i + 1 : 0), m[p]?.focus();
48
+ let v = s;
49
+ o.code === "ArrowUp" ? v = s > 0 ? s - 1 : m.length - 1 : o.code === "ArrowDown" && (v = s < m.length - 1 ? s + 1 : 0), m[v]?.focus();
44
50
  return;
45
51
  }
46
- o.code === "Tab" && (o.preventDefault(), o.stopPropagation(), o.shiftKey ? (t.value?.previousElementSibling).focus() : (t.value?.nextElementSibling).focus());
47
- }, w = () => {
48
- P = new MutationObserver((o) => {
52
+ if (o.code === "Tab") {
53
+ o.preventDefault(), o.stopPropagation();
54
+ const s = u.value?.parentElement;
55
+ (o.shiftKey ? s?.previousElementSibling : s?.nextElementSibling)?.querySelector(
56
+ "button, [role='button'], .k-link"
57
+ )?.focus();
58
+ }
59
+ }, P = () => {
60
+ I = new MutationObserver((o) => {
49
61
  o.forEach((m) => {
50
62
  m.addedNodes.forEach((l) => {
51
63
  if (l.nodeType === Node.ELEMENT_NODE) {
52
- const i = l;
53
- if (i.classList.contains("k-animation-container")) {
54
- const A = t.value;
55
- A && (A.dataset.featherKSortable === "true" || N(() => {
56
- i.querySelectorAll(
64
+ const s = l;
65
+ if (s.classList.contains("k-animation-container")) {
66
+ const b = u.value;
67
+ b && (b.dataset.featherKSortable === "true" || j(() => {
68
+ s.querySelectorAll(
57
69
  ".k-columnmenu-item-wrapper"
58
- ).forEach((G) => {
59
- G.textContent?.toLowerCase().includes("sort") && G.remove();
70
+ ).forEach((H) => {
71
+ H.textContent?.toLowerCase().includes("sort") && H.remove();
60
72
  });
61
- })), i.addEventListener(
73
+ })), s.addEventListener(
62
74
  "keydown",
63
- y
64
- ), N(() => {
65
- const S = () => {
66
- const I = Array.from(
67
- i.querySelectorAll(
75
+ g
76
+ ), j(() => {
77
+ const D = () => {
78
+ const $ = Array.from(
79
+ s.querySelectorAll(
68
80
  ".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"
69
81
  )
70
82
  );
71
- if (I.length === 1)
72
- I[0].focus(), I[0].click(), S.attempts = 0;
73
- else if (I.length > 1) {
74
- S.attempts = 0;
83
+ if ($.length === 1)
84
+ $[0].focus(), $[0].click(), D.attempts = 0;
85
+ else if ($.length > 1) {
86
+ D.attempts = 0;
75
87
  return;
76
88
  } else
77
- S.attempts === void 0 && (S.attempts = 0), S.attempts++ < 3 && setTimeout(S, 200);
89
+ D.attempts === void 0 && (D.attempts = 0), D.attempts++ < 3 && setTimeout(D, 200);
78
90
  };
79
- S();
91
+ D();
80
92
  });
81
93
  }
82
- i.querySelectorAll(
94
+ s.querySelectorAll(
83
95
  ".k-animation-container"
84
- ).forEach((A) => {
85
- A.addEventListener(
96
+ ).forEach((b) => {
97
+ b.addEventListener(
86
98
  "keydown",
87
- y
99
+ g
88
100
  );
89
101
  });
90
102
  }
91
103
  }), m.removedNodes.forEach((l) => {
92
104
  if (l.nodeType === Node.ELEMENT_NODE) {
93
- const i = l;
94
- i.classList.contains("k-animation-container") && i.removeEventListener(
105
+ const s = l;
106
+ s.classList.contains("k-animation-container") && s.removeEventListener(
95
107
  "keydown",
96
- y
97
- ), i.querySelectorAll(
108
+ g
109
+ ), s.querySelectorAll(
98
110
  ".k-animation-container"
99
- ).forEach((A) => {
100
- A.removeEventListener(
111
+ ).forEach((b) => {
112
+ b.removeEventListener(
101
113
  "keydown",
102
- y
114
+ g
103
115
  );
104
116
  });
105
117
  }
106
118
  });
107
119
  });
108
- }), P.observe(document.body, {
120
+ }), I.observe(document.body, {
109
121
  childList: !0,
110
122
  subtree: !0
111
123
  });
112
- }, L = (o) => {
124
+ }, E = (o) => {
113
125
  if (!o.type || !o)
114
126
  return;
115
127
  const m = o.target;
@@ -123,7 +135,7 @@ const We = (e) => {
123
135
  e?.value.$el.querySelectorAll(
124
136
  ".k-table-row[data-grid-row-index]"
125
137
  )
126
- ).forEach((p) => p.setAttribute("tabindex", "-1"));
138
+ ).forEach((v) => v.setAttribute("tabindex", "-1"));
127
139
  } catch {
128
140
  }
129
141
  l.setAttribute("tabindex", "0"), l.focus();
@@ -139,7 +151,7 @@ const We = (e) => {
139
151
  "Space"
140
152
  ].includes(o.code)) {
141
153
  if (o.preventDefault(), m.classList.contains("k-grid-header-menu") && m.classList.contains("k-grid-column-menu")) {
142
- t.value = m;
154
+ u.value = m;
143
155
  return;
144
156
  }
145
157
  const l = m.closest(
@@ -147,132 +159,132 @@ const We = (e) => {
147
159
  );
148
160
  if (l) {
149
161
  if (["ArrowDown", "ArrowUp"].includes(o.code)) {
150
- const i = (A, S) => {
151
- let I = S === "next" ? A.nextElementSibling : A.previousElementSibling;
152
- for (; I; ) {
153
- const G = I;
162
+ const s = (b, D) => {
163
+ let $ = D === "next" ? b.nextElementSibling : b.previousElementSibling;
164
+ for (; $; ) {
165
+ const H = $;
154
166
  try {
155
- if (G.hasAttribute && G.classList.contains("k-table-row"))
156
- return G;
167
+ if (H.hasAttribute && H.classList.contains("k-table-row"))
168
+ return H;
157
169
  } catch {
158
170
  }
159
- I = S === "next" ? I.nextElementSibling : I.previousElementSibling;
171
+ $ = D === "next" ? $.nextElementSibling : $.previousElementSibling;
160
172
  }
161
173
  return null;
162
- }, p = o.code === "ArrowDown" ? i(l, "next") : i(l, "previous");
163
- p && (l.setAttribute("tabindex", "-1"), p.setAttribute("tabindex", "0"), p.focus());
174
+ }, v = o.code === "ArrowDown" ? s(l, "next") : s(l, "previous");
175
+ v && (l.setAttribute("tabindex", "-1"), v.setAttribute("tabindex", "0"), v.focus());
164
176
  return;
165
177
  }
166
178
  if (["ArrowLeft", "ArrowRight"].includes(o.code)) {
167
179
  o.preventDefault();
168
- const i = l.querySelectorAll(
169
- W
180
+ const s = l.querySelectorAll(
181
+ A
170
182
  );
171
- if (i.length === 0) return;
172
- let p = Array.from(i).findIndex(
173
- (A) => A === document.activeElement
183
+ if (s.length === 0) return;
184
+ let v = Array.from(s).findIndex(
185
+ (b) => b === document.activeElement
174
186
  );
175
- if (p === -1 && document.activeElement === l) {
176
- i[0].focus();
187
+ if (v === -1 && document.activeElement === l) {
188
+ s[0].focus();
177
189
  return;
178
190
  }
179
- o.code === "ArrowRight" ? p = p === i.length - 1 ? 0 : p + 1 : o.code === "ArrowLeft" && (p = p === i.length - 1 ? p - 1 : i.length - 1), i[p].focus();
191
+ o.code === "ArrowRight" ? v = v === s.length - 1 ? 0 : v + 1 : o.code === "ArrowLeft" && (v = v === s.length - 1 ? v - 1 : s.length - 1), s[v].focus();
180
192
  return;
181
193
  }
182
194
  }
183
195
  }
184
196
  }
185
- }, D = () => {
186
- N(() => {
197
+ }, C = () => {
198
+ j(() => {
187
199
  const o = e.value.$el.closest(".k-grid");
188
200
  o && o.classList.add("fk-grid");
189
201
  });
190
- }, x = () => {
191
- if (!T)
202
+ }, T = () => {
203
+ if (!L)
192
204
  try {
193
205
  const o = () => {
194
206
  try {
195
- const i = Array.from(
207
+ const s = Array.from(
196
208
  e.value.$el.querySelectorAll(
197
209
  ".k-table-row[data-grid-row-index]"
198
210
  )
199
211
  );
200
- if (!i || i.length === 0 || i.filter(
201
- (S) => S.getAttribute("tabindex") === "0"
212
+ if (!s || s.length === 0 || s.filter(
213
+ (D) => D.getAttribute("tabindex") === "0"
202
214
  ).length === 1) return;
203
- const A = i.find(
204
- (S) => S === document.activeElement || S.contains(document.activeElement)
215
+ const b = s.find(
216
+ (D) => D === document.activeElement || D.contains(document.activeElement)
205
217
  );
206
- if (i.forEach((S) => S.setAttribute("tabindex", "-1")), A) {
207
- A.setAttribute("tabindex", "0");
218
+ if (s.forEach((D) => D.setAttribute("tabindex", "-1")), b) {
219
+ b.setAttribute("tabindex", "0");
208
220
  return;
209
221
  }
210
- i[0].setAttribute("tabindex", "0");
211
- } catch (i) {
212
- console.error("ensureSingleTabindex error:", i);
222
+ s[0].setAttribute("tabindex", "0");
223
+ } catch (s) {
224
+ console.error("ensureSingleTabindex error:", s);
213
225
  }
214
226
  }, m = Array.from(
215
227
  e.value.$el.querySelectorAll(
216
228
  ".k-table-row[data-grid-row-index]"
217
229
  )
218
230
  );
219
- m.length > 0 && m.forEach((i, p) => {
220
- i.setAttribute("tabindex", p === 0 ? "0" : "-1");
231
+ m.length > 0 && m.forEach((s, v) => {
232
+ s.setAttribute("tabindex", v === 0 ? "0" : "-1");
221
233
  });
222
234
  const l = e.value.$el.querySelector(".k-table-tbody");
223
- l && (T = new MutationObserver(() => {
235
+ l && (L = new MutationObserver(() => {
224
236
  o();
225
- }), T.observe(l, { childList: !0, subtree: !0 }));
237
+ }), L.observe(l, { childList: !0, subtree: !0 }));
226
238
  } catch (o) {
227
239
  console.error("Error setting up row navigation:", o);
228
240
  }
229
- }, C = () => {
230
- N(() => {
241
+ }, U = () => {
242
+ j(() => {
231
243
  const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
232
244
  m && m.forEach((l) => {
233
245
  l.setAttribute("role", "button"), l.addEventListener(
234
246
  "keydown",
235
- b
247
+ S
236
248
  );
237
- }), w(), f();
249
+ }), P(), y();
238
250
  });
239
- }, R = () => {
251
+ }, f = () => {
240
252
  const m = document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");
241
253
  m && m.forEach((l) => {
242
254
  l.removeEventListener(
243
255
  "keydown",
244
- b
256
+ S
245
257
  );
246
- }), P && (P.disconnect(), P = null), T && (T.disconnect(), T = null), V.forEach((l) => l()), V.length = 0;
247
- }, f = () => {
258
+ }), I && (I.disconnect(), I = null), L && (L.disconnect(), L = null), V.forEach((l) => l()), V.length = 0;
259
+ }, y = () => {
248
260
  document.querySelectorAll(
249
261
  ".k-grid-header .k-table-thead th"
250
- ).forEach((l, i) => {
251
- const p = l.querySelector(
262
+ ).forEach((l, s) => {
263
+ const v = l.querySelector(
252
264
  ".k-grid-header-menu.k-grid-column-menu"
253
265
  );
254
- if (!p) return;
255
- const A = k();
256
- if (A && A[i]) {
257
- const H = A[i].field ?? "";
258
- l.setAttribute("data-feather-k-field", H), l.setAttribute(
266
+ if (!v) return;
267
+ const b = k();
268
+ if (b && b[s]) {
269
+ const F = b[s].field ?? "";
270
+ l.setAttribute("data-feather-k-field", F), l.setAttribute(
259
271
  "data-feather-k-filterable",
260
- A[i].filterable === !1 ? "false" : "true"
272
+ b[s].filterable === !1 ? "false" : "true"
261
273
  ), l.setAttribute(
262
274
  "data-feather-k-sortable",
263
- A[i].sortable === !1 ? "false" : "true"
275
+ b[s].sortable === !1 ? "false" : "true"
264
276
  );
265
277
  }
266
- const S = l.dataset.featherKFilterable !== "false", I = l.dataset.featherKSortable !== "false";
267
- p.setAttribute("tabindex", "-1"), S || I ? l.style.cursor = "pointer" : l.style.cursor = "default", S ? (l.setAttribute("tabindex", "0"), l.setAttribute("role", "button"), l.setAttribute("aria-haspopup", "menu")) : (l.setAttribute("tabindex", "0"), l.setAttribute("role", "columnheader"), l.removeAttribute("aria-haspopup"));
268
- const G = (H) => {
269
- H.target?.closest(".k-column-resizer") || (t.value = l, p.click());
270
- }, oe = (H) => {
271
- if (S)
272
- t.value = l, H.preventDefault(), H.stopPropagation(), G(H);
273
- else if (I) {
274
- t.value = l;
275
- const j = new KeyboardEvent("keydown", {
278
+ const D = l.dataset.featherKFilterable !== "false", $ = l.dataset.featherKSortable !== "false";
279
+ v.setAttribute("tabindex", "-1"), D || $ ? l.style.cursor = "pointer" : l.style.cursor = "default", D ? (l.setAttribute("tabindex", "0"), l.setAttribute("role", "button"), l.setAttribute("aria-haspopup", "menu")) : (l.setAttribute("tabindex", "0"), l.setAttribute("role", "columnheader"), l.removeAttribute("aria-haspopup"));
280
+ const H = (F) => {
281
+ F.target?.closest(".k-column-resizer") || (u.value = l, v.click());
282
+ }, J = (F) => {
283
+ if (D)
284
+ u.value = l, F.preventDefault(), F.stopPropagation(), H(F);
285
+ else if ($) {
286
+ u.value = l;
287
+ const ne = new KeyboardEvent("keydown", {
276
288
  key: "Enter",
277
289
  code: "Enter",
278
290
  keyCode: 13,
@@ -280,31 +292,31 @@ const We = (e) => {
280
292
  bubbles: !0,
281
293
  cancelable: !0
282
294
  });
283
- l.dispatchEvent(j);
295
+ l.dispatchEvent(ne);
284
296
  }
285
297
  };
286
- l.addEventListener("click", oe), V.push(() => {
287
- l.removeEventListener("click", oe);
298
+ l.addEventListener("click", J), V.push(() => {
299
+ l.removeEventListener("click", J);
288
300
  });
289
- const Q = (H) => {
290
- if ((H.code === "Enter" || H.code === "Space") && (S || I)) {
291
- if (t.value = l, t.value.focus(), S)
292
- H.preventDefault(), H.stopPropagation(), G(H);
293
- else if (I) {
294
- const j = l.querySelector(".k-link");
295
- j && j.click();
301
+ const oe = (F) => {
302
+ if ((F.code === "Enter" || F.code === "Space") && (D || $)) {
303
+ if (u.value = l, u.value.focus(), D)
304
+ F.preventDefault(), F.stopPropagation(), H(F);
305
+ else if ($) {
306
+ const ne = l.querySelector(".k-link");
307
+ ne && ne.click();
296
308
  }
297
309
  }
298
310
  };
299
- l.addEventListener("keydown", Q, !0), V.push(() => {
300
- l.removeEventListener("keydown", Q, !0);
311
+ l.addEventListener("keydown", oe, !0), V.push(() => {
312
+ l.removeEventListener("keydown", oe, !0);
301
313
  });
302
314
  });
303
315
  const m = document.querySelector(".k-grid-header .k-table-thead");
304
316
  if (m) {
305
- const l = (i) => {
306
- const p = i.target.closest("th");
307
- p && (i.code === "Enter" || i.code === "Space") && p.dataset.featherKFilterable === "false" && p.dataset.featherKSortable === "false" && (i.preventDefault(), i.stopImmediatePropagation());
317
+ const l = (s) => {
318
+ const v = s.target.closest("th");
319
+ v && (s.code === "Enter" || s.code === "Space") && v.dataset.featherKFilterable === "false" && v.dataset.featherKSortable === "false" && (s.preventDefault(), s.stopImmediatePropagation());
308
320
  };
309
321
  m.addEventListener(
310
322
  "keydown",
@@ -319,154 +331,167 @@ const We = (e) => {
319
331
  );
320
332
  });
321
333
  }
322
- }, g = function(o, m) {
323
- const l = o?.event.event.target, i = k();
324
- if (!l || !i) return;
325
- const p = l.classList.contains("k-link"), A = l.classList.contains("k-columnmenu-item"), S = i.find((I) => I.field === o.event.field)?.sortable && !0;
326
- if (!p) {
327
- if (A && !S) {
334
+ }, O = function(o, m) {
335
+ const l = o?.event.event.target, s = k();
336
+ if (!l || !s) return;
337
+ const v = l.classList.contains("k-link"), b = l.classList.contains("k-columnmenu-item"), D = s.find(($) => $.field === o.event.field)?.sortable && !0;
338
+ if (!v) {
339
+ if (b && !D) {
328
340
  (o.event.sort && void 0)?.filter(
329
- (G) => G.field !== o.event.field
341
+ (H) => H.field !== o.event.field
330
342
  );
331
343
  return;
332
344
  }
333
- typeof m == "function" && N(() => {
334
- t.value && t.value.focus(), m(o);
345
+ typeof m == "function" && j(() => {
346
+ u.value && u.value.focus(), m(o);
335
347
  });
336
348
  }
337
- }, F = () => {
338
- if (!c)
349
+ }, G = () => {
350
+ if (!q)
339
351
  try {
340
- D(), x(), C(), c = !0;
352
+ C(), T(), U(), q = !0;
341
353
  } catch (o) {
342
- console.error("initA11y failed:", o), R();
354
+ console.error("initA11y failed:", o), f();
343
355
  }
344
356
  };
345
- return Ie(() => {
346
- R();
357
+ return Te(() => {
358
+ f();
347
359
  }), {
348
- activeFilterButton: t,
349
- handleGridKeyDown: L,
350
- handleSortChange: g,
351
- initA11y: F
360
+ activeFilterButton: u,
361
+ handleGridKeyDown: E,
362
+ handleSortChange: O,
363
+ initA11y: G
352
364
  };
353
365
  };
354
- function _e(e) {
355
- const t = _(""), c = _(void 0), P = _(!!e.debug), T = _(e.dateFormat ?? "mm/dd/yyyy"), V = h(() => !!e.required), W = _(!1), k = ["ArrowUp", "ArrowDown"], b = ["ArrowLeft", "ArrowRight"], y = h(() => (t.value ?? "").replace(/\D/g, "")), w = (a) => a <= 2 ? "mm" : a <= 5 ? "dd" : y.value.length <= 10 ? "yyyy" : "mm", L = h(() => {
366
+ function ze(e) {
367
+ const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(e.dateFormat ?? "mm/dd/yyyy"), L = h(() => !!e.required), V = _(!1), A = ["ArrowUp", "ArrowDown"], k = ["ArrowLeft", "ArrowRight"], S = h(() => (t.value ?? "").replace(/\D/g, "")), g = (a) => a <= 2 ? "mm" : a <= 5 ? "dd" : S.value.length <= 10 ? "yyyy" : "mm", P = h(() => {
356
368
  const a = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0";
357
369
  return parseInt(a).toString().padStart(2, "0");
358
- }), D = h(() => {
370
+ }), E = h(() => {
359
371
  const a = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0";
360
372
  return parseInt(a).toString().padStart(2, "0");
361
- }), x = h(() => {
373
+ }), C = h(() => {
362
374
  const a = t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0";
363
375
  return parseInt(a).toString().padStart(4, "0");
364
- }), C = (a) => {
365
- if (y.value.length === 0) {
376
+ }), T = (a) => {
377
+ if (S.value.length === 0) {
366
378
  e.onChange({ value: null, event: a });
367
379
  return;
368
380
  }
369
- if (y.value.length < 8) {
381
+ if (S.value.length < 8) {
370
382
  e.onChange({ value: null, event: a });
371
383
  return;
372
384
  }
373
- if ((t.value ?? "").length === 10 && y.value.length === 8) {
374
- const [d, M, ee] = t.value.split("/"), r = parseInt(d), u = parseInt(M), v = parseInt(ee);
375
- if (o(v, r, u)) {
376
- const $ = new Date(v, r - 1, u);
377
- R($) ? e.onChange({ value: $, event: a }) : e.onChange({ value: null, event: a });
385
+ if ((t.value ?? "").length === 10 && S.value.length === 8) {
386
+ const [d, M, r] = t.value.split("/"), i = parseInt(d), p = parseInt(M), w = parseInt(r);
387
+ if (G(w, i, p)) {
388
+ const B = new Date(w, i - 1, p);
389
+ U(B) ? e.onChange({ value: B, event: a }) : e.onChange({ value: null, event: a });
378
390
  } else
379
391
  e.onChange({ value: null, event: a });
380
392
  }
381
- }, R = (a) => {
393
+ }, U = (a) => {
382
394
  const d = e.min ?? void 0, M = e.max ?? void 0;
383
395
  return !(d && a < d || M && a > M);
384
396
  }, f = h(() => {
385
- if ((t.value ?? "").length === 10 && y.value.length === 8) {
386
- const [a, d, M] = (t.value ?? "").split("/"), ee = parseInt(a), r = parseInt(d), u = parseInt(M);
387
- if (o(u, ee, r))
388
- return new Date(u, ee - 1, r);
397
+ if ((t.value ?? "").length === 10 && S.value.length === 8) {
398
+ const [a, d, M] = (t.value ?? "").split("/"), r = parseInt(a), i = parseInt(d), p = parseInt(M);
399
+ if (G(p, r, i))
400
+ return new Date(p, r - 1, i);
389
401
  }
390
402
  return null;
391
- }), g = h(() => (t.value ?? "").length === 10 && y.value.length === 8), F = (a, d) => new Date(a, d, 0).getDate(), o = (a, d, M) => d >= 1 && d <= 12 && a >= 1900 && M >= 1 && M <= F(a, d), m = (a) => {
403
+ }), y = h(() => (t.value ?? "").length === 10 && S.value.length === 8), O = (a, d) => new Date(a, d, 0).getDate(), G = (a, d, M) => d >= 1 && d <= 12 && a >= 1900 && M >= 1 && M <= O(a, d), o = (a) => {
392
404
  t.value = a.value;
393
405
  const d = a.event?.target;
394
- c.value = d?.selectionStart ?? 0, C(a);
395
- }, l = (a) => {
396
- c.value = a.target.selectionStart ?? 0;
397
- }, i = (a, d, M) => {
398
- const ee = d?.selectionStart ?? c.value ?? 0;
399
- c.value = ee;
400
- let r = parseInt(L.value), u = parseInt(D.value), v = parseInt(x.value);
401
- if (!(y.value.length >= 8) || !o(v, r, u)) {
402
- const X = e.defaultValue ?? /* @__PURE__ */ new Date();
403
- r = X.getMonth() + 1, u = X.getDate(), v = X.getFullYear(), t.value = `${String(r).padStart(2, "0")}/${String(u).padStart(
406
+ u.value = d?.selectionStart ?? 0, T(a);
407
+ }, m = (a) => {
408
+ u.value = a.target.selectionStart ?? 0;
409
+ }, l = (a, d, M) => {
410
+ const r = d?.selectionStart ?? u.value ?? 0;
411
+ u.value = r;
412
+ let i = parseInt(P.value), p = parseInt(E.value), w = parseInt(C.value);
413
+ if (!(S.value.length >= 8) || !G(w, i, p)) {
414
+ const K = e.defaultValue ?? /* @__PURE__ */ new Date();
415
+ i = K.getMonth() + 1, p = K.getDate(), w = K.getFullYear(), t.value = `${String(i).padStart(2, "0")}/${String(p).padStart(
404
416
  2,
405
417
  "0"
406
- )}/${String(v)}`;
407
- const O = new Date(v, r - 1, u);
408
- e.onChange({ value: R(O) ? O : null, event: M }), N(() => {
409
- requestAnimationFrame(() => {
410
- const J = document.getElementById(
411
- e.id
412
- ), Z = c.value ?? 0;
413
- J && (J.focus(), J.setSelectionRange(Z, Z));
414
- });
415
- });
418
+ )}/${String(w)}`;
419
+ const X = new Date(w, i - 1, p);
420
+ e.onChange({ value: U(X) ? X : null, event: M }), $({ useRAF: !0 });
416
421
  return;
417
422
  }
418
- const U = w(ee);
419
- if (U === "mm")
420
- r = a === "ArrowUp" ? r < 12 ? r + 1 : 1 : r > 1 ? r - 1 : 12;
421
- else if (U === "dd") {
422
- const X = new Date(v, r, 0).getDate();
423
- u = a === "ArrowUp" ? u < X ? u + 1 : 1 : u > 1 ? u - 1 : X;
424
- } else U === "yyyy" && (v = a === "ArrowUp" ? v + 1 : Math.max(1, v - 1));
425
- t.value = `${String(r).padStart(2, "0")}/${String(u).padStart(
423
+ const Q = g(r);
424
+ if (Q === "mm")
425
+ i = a === "ArrowUp" ? i < 12 ? i + 1 : 1 : i > 1 ? i - 1 : 12;
426
+ else if (Q === "dd") {
427
+ const K = new Date(w, i, 0).getDate();
428
+ p = a === "ArrowUp" ? p < K ? p + 1 : 1 : p > 1 ? p - 1 : K;
429
+ } else Q === "yyyy" && (w = a === "ArrowUp" ? w + 1 : Math.max(1, w - 1));
430
+ t.value = `${String(i).padStart(2, "0")}/${String(p).padStart(
426
431
  2,
427
432
  "0"
428
- )}/${String(v)}`;
429
- const [ae, z, Y] = t.value.split("/"), ie = new Date(
430
- parseInt(Y),
431
- parseInt(ae) - 1,
432
- parseInt(z)
433
+ )}/${String(w)}`;
434
+ const [z, W, ie] = t.value.split("/"), le = new Date(
435
+ parseInt(ie),
436
+ parseInt(z) - 1,
437
+ parseInt(W)
433
438
  );
434
- ie.toString() !== "Invalid Date" && parseInt(Y) >= 1e3 ? e.onChange({
435
- value: R(ie) ? ie : null,
439
+ le.toString() !== "Invalid Date" && parseInt(ie) >= 1e3 ? e.onChange({
440
+ value: U(le) ? le : null,
436
441
  event: M
437
- }) : e.onChange({ value: null, event: M }), N(() => {
438
- requestAnimationFrame(() => {
439
- const X = document.getElementById(
440
- e.id
441
- ), O = c.value ?? 0;
442
- X && (X.focus(), X.setSelectionRange(O, O));
443
- });
444
- });
445
- }, p = (a) => {
442
+ }) : e.onChange({ value: null, event: M }), $({ useRAF: !0 });
443
+ }, s = (a) => {
446
444
  if (a.code === "Space" || a.key === " ") {
447
445
  e.onShowCalendar(a);
448
446
  return;
449
447
  }
450
- if (k.includes(a.key)) {
448
+ if (A.includes(a.key)) {
449
+ if (a.altKey) return;
451
450
  a.preventDefault();
452
451
  const d = a.target;
453
- i(a.key, d, a);
452
+ l(a.key, d, a);
454
453
  }
455
- }, A = (a) => {
454
+ }, v = (a) => {
456
455
  a.preventDefault();
457
456
  const d = a.deltaY < 0 ? "ArrowUp" : "ArrowDown";
458
- i(d, a.target, a);
459
- }, S = (a) => {
457
+ l(d, a.target, a);
458
+ }, b = (a) => {
460
459
  const d = a.target;
461
- if (b.includes(a.key)) {
462
- c.value = d?.selectionStart ?? 0;
460
+ if (k.includes(a.key)) {
461
+ u.value = d?.selectionStart ?? 0;
463
462
  return;
464
463
  }
465
- k.includes(a.key) && (a.preventDefault(), c.value = d?.selectionStart ?? 0);
466
- }, I = (a) => {
467
- W.value = !0, V.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && y.value.length === 0 && (e.externalValue.value = "");
464
+ if (A.includes(a.key)) {
465
+ if (a.altKey) return;
466
+ a.preventDefault(), u.value = d?.selectionStart ?? 0;
467
+ }
468
+ }, D = (a) => {
469
+ V.value = !0, L.value && !e.defaultValue && e.externalValue && e.externalValue.value === void 0 && S.value.length === 0 && (e.externalValue.value = "");
468
470
  const d = a.target;
469
- d && (c.value = d.selectionStart ?? 0);
471
+ d && (u.value = d.selectionStart ?? 0);
472
+ }, $ = (a) => {
473
+ const d = () => {
474
+ const M = document.getElementById(
475
+ e.id
476
+ );
477
+ if (!M) return;
478
+ const r = a?.pos ?? u.value ?? M.value.length;
479
+ try {
480
+ M.focus(), M.setSelectionRange(r, r);
481
+ } catch {
482
+ }
483
+ };
484
+ j(() => {
485
+ if (a?.delay && a.delay > 0) {
486
+ setTimeout(d, a.delay);
487
+ return;
488
+ }
489
+ if (a?.useRAF) {
490
+ requestAnimationFrame(d);
491
+ return;
492
+ }
493
+ d();
494
+ });
470
495
  };
471
496
  e.externalValue && ve(
472
497
  e.externalValue,
@@ -474,17 +499,17 @@ function _e(e) {
474
499
  if (a) {
475
500
  const d = new Date(a);
476
501
  if (d.toString() !== "Invalid Date") {
477
- const M = (d.getMonth() + 1).toString().padStart(2, "0"), ee = d.getDate().toString().padStart(2, "0"), r = d.getFullYear().toString();
478
- t.value = `${M}/${ee}/${r}`;
502
+ const M = (d.getMonth() + 1).toString().padStart(2, "0"), r = d.getDate().toString().padStart(2, "0"), i = d.getFullYear().toString();
503
+ t.value = `${M}/${r}/${i}`, $({ delay: 50 });
479
504
  return;
480
505
  }
481
506
  }
482
507
  },
483
508
  { immediate: !0 }
484
509
  );
485
- const G = h(() => [
486
- ["Date", `${L.value} / ${D.value} / ${x.value}`],
487
- ["Digits only", y.value],
510
+ const H = h(() => [
511
+ ["Date", `${P.value} / ${E.value} / ${C.value}`],
512
+ ["Digits only", S.value],
488
513
  [
489
514
  "min",
490
515
  e.min?.toLocaleDateString("en-US", {
@@ -501,33 +526,33 @@ function _e(e) {
501
526
  day: "2-digit"
502
527
  }) ?? null
503
528
  ]
504
- ]), oe = h(() => {
505
- if (!V.value) {
506
- if (!g.value) return !0;
529
+ ]), J = h(() => {
530
+ if (!L.value) {
531
+ if (!y.value) return !0;
507
532
  const d = f.value;
508
- return d ? R(d) : !1;
533
+ return d ? U(d) : !1;
509
534
  }
510
- if (!W.value) return !0;
535
+ if (!V.value) return !0;
511
536
  const a = f.value;
512
- return !g.value || !a ? !1 : R(a);
513
- }), Q = h(() => {
514
- if (!V.value) {
515
- if (!g.value) return;
537
+ return !y.value || !a ? !1 : U(a);
538
+ }), oe = h(() => {
539
+ if (!L.value) {
540
+ if (!y.value) return;
516
541
  const d = f.value;
517
- return d ? R(d) ? "valid" : "out-of-bounds" : "invalid-date";
542
+ return d ? U(d) ? "valid" : "out-of-bounds" : "invalid-date";
518
543
  }
519
- if (!W.value) return;
520
- if (y.value.length === 0 || !g.value)
544
+ if (!V.value) return;
545
+ if (S.value.length === 0 || !y.value)
521
546
  return "incomplete";
522
547
  const a = f.value;
523
- return a ? R(a) ? "valid" : "out-of-bounds" : "invalid-date";
524
- }), H = h(() => {
525
- const a = Q.value;
548
+ return a ? U(a) ? "valid" : "out-of-bounds" : "invalid-date";
549
+ }), F = h(() => {
550
+ const a = oe.value;
526
551
  if (!a || a === "valid") return "";
527
552
  if (a === "incomplete")
528
553
  return "Required";
529
554
  if (a === "invalid-date")
530
- return `Must be in ${T.value} format.`;
555
+ return `Must be in ${I.value} format.`;
531
556
  const d = e.min ? e.min.toLocaleDateString("en-US", {
532
557
  year: "numeric",
533
558
  month: "2-digit",
@@ -543,8 +568,8 @@ function _e(e) {
543
568
  if (M) return `Must be on or before ${M}.`;
544
569
  }
545
570
  return "";
546
- }), j = () => {
547
- N(() => {
571
+ }), ne = () => {
572
+ j(() => {
548
573
  const a = document.getElementById(
549
574
  e.id
550
575
  );
@@ -569,70 +594,70 @@ function _e(e) {
569
594
  });
570
595
  };
571
596
  return xe(() => {
572
- j();
597
+ ne();
573
598
  }), {
574
599
  raw: t,
575
- cursorPos: c,
576
- debugEnabled: P,
577
- debugLines: G,
578
- placeholder: T,
579
- isValid: oe,
580
- reason: K(Q),
581
- validationMessage: H,
582
- digitsOnly: y,
583
- month: K(L),
584
- day: K(D),
585
- year: K(x),
586
- datePart: w,
587
- handleChange: m,
588
- handleKeyDown: p,
589
- handleWheel: A,
590
- handleKeyUp: S,
591
- handleClick: l,
592
- handleBlur: I,
600
+ cursorPos: u,
601
+ debugEnabled: q,
602
+ debugLines: H,
603
+ placeholder: I,
604
+ isValid: J,
605
+ reason: N(oe),
606
+ validationMessage: F,
607
+ digitsOnly: S,
608
+ month: N(P),
609
+ day: N(E),
610
+ year: N(C),
611
+ datePart: g,
612
+ handleChange: o,
613
+ handleKeyDown: s,
614
+ handleWheel: v,
615
+ handleKeyUp: b,
616
+ handleClick: m,
617
+ handleBlur: D,
593
618
  // Expose so consumers can re-run styling when needed
594
- initStyling: j
619
+ initStyling: ne
595
620
  };
596
621
  }
597
- function Ge(e) {
598
- const t = _(""), c = _(void 0), P = _(!!e.debug), T = _(!1), W = 365 * (1440 * 60 * 1e3), k = /* @__PURE__ */ new Date(), b = new Date(k.getTime() - W), y = new Date(k.getTime() + W);
599
- e.min = e.min ?? b, e.max = e.max ?? y;
600
- const w = h(() => (t.value ?? "").replace(/\D/g, "")), L = (n, s) => new Date(n, s, 0).getDate(), D = (n, s, E) => s >= 1 && s <= 12 && n >= 1e3 && E >= 1 && E <= L(n, s), x = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), C = (n) => {
622
+ function Xe(e) {
623
+ const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(!1), V = 365 * (1440 * 60 * 1e3), A = /* @__PURE__ */ new Date(), k = new Date(A.getTime() - V), S = new Date(A.getTime() + V);
624
+ e.min = e.min ?? k, e.max = e.max ?? S;
625
+ const g = h(() => (t.value ?? "").replace(/\D/g, "")), P = (n, c) => new Date(n, c, 0).getDate(), E = (n, c, x) => c >= 1 && c <= 12 && n >= 1e3 && x >= 1 && x <= P(n, c), C = (n) => Date.UTC(n.getFullYear(), n.getMonth(), n.getDate()), T = (n) => {
601
626
  if (!n) return null;
602
- const s = e.min, E = e.max, q = x(n);
603
- return q < x(s) || q > x(E) ? null : n;
604
- }, R = (n, s) => e.allowReverse ?? !1 ? !0 : n <= s, f = h(() => (t.value?.length ?? 0) >= 23 && w.value.length >= 16), g = (n) => {
605
- if ((n ?? "").length < 23 || w.value.length < 16)
627
+ const c = e.min, x = e.max, R = C(n);
628
+ return R < C(c) || R > C(x) ? null : n;
629
+ }, U = (n, c) => e.allowReverse ?? !1 ? !0 : n <= c, f = h(() => (t.value?.length ?? 0) >= 23 && g.value.length >= 16), y = (n) => {
630
+ if ((n ?? "").length < 23 || g.value.length < 16)
606
631
  return { start: null, end: null };
607
- const s = n.substring(0, 10), E = n.substring(13, 23), [q, ne, le] = s.split("/").map((se) => parseInt(se || "0", 10)), [ye, de, fe] = E.split("/").map((se) => parseInt(se || "0", 10)), me = new Date(le, q - 1, ne), he = new Date(fe, ye - 1, de), we = D(le, q, ne) && me.toString() !== "Invalid Date", ke = D(fe, ye, de) && he.toString() !== "Invalid Date";
608
- return { start: we ? me : null, end: ke ? he : null };
609
- }, F = e.externalValid ?? _(!0), o = h(() => g(t.value)), m = h(() => {
610
- const n = C(o.value.start), s = C(o.value.end);
611
- return { start: n, end: s };
612
- }), l = h(() => {
632
+ const c = n.substring(0, 10), x = n.substring(13, 23), [R, ee, ae] = c.split("/").map((se) => parseInt(se || "0", 10)), [ge, de, fe] = x.split("/").map((se) => parseInt(se || "0", 10)), pe = new Date(ae, R - 1, ee), he = new Date(fe, ge - 1, de), we = E(ae, R, ee) && pe.toString() !== "Invalid Date", ke = E(fe, ge, de) && he.toString() !== "Invalid Date";
633
+ return { start: we ? pe : null, end: ke ? he : null };
634
+ }, O = e.externalValid ?? _(!0), G = h(() => y(t.value)), o = h(() => {
635
+ const n = T(G.value.start), c = T(G.value.end);
636
+ return { start: n, end: c };
637
+ }), m = h(() => {
613
638
  if (!f.value) return;
614
- const n = m.value.start, s = m.value.end;
615
- if (!n || !s) return;
616
- const E = Math.abs(x(s) - x(n));
617
- return Math.round(E / 864e5 + 1);
618
- }), i = h(() => {
639
+ const n = o.value.start, c = o.value.end;
640
+ if (!n || !c) return;
641
+ const x = Math.abs(C(c) - C(n));
642
+ return Math.round(x / 864e5 + 1);
643
+ }), l = h(() => {
619
644
  if (!f.value) return !1;
620
- const { start: n, end: s } = o.value;
621
- if (!n || !s || !m.value.start || !m.value.end) return !1;
622
- const E = m.value.start, q = m.value.end;
623
- return !(!R(E, q) || typeof e.maxSpanDays == "number" && l.value !== void 0 && l.value > e.maxSpanDays);
624
- }), p = h(() => {
625
- const { start: n, end: s } = o.value;
645
+ const { start: n, end: c } = G.value;
646
+ if (!n || !c || !o.value.start || !o.value.end) return !1;
647
+ const x = o.value.start, R = o.value.end;
648
+ return !(!U(x, R) || typeof e.maxSpanDays == "number" && m.value !== void 0 && m.value > e.maxSpanDays);
649
+ }), s = h(() => {
650
+ const { start: n, end: c } = G.value;
626
651
  if (!f.value) return "incomplete";
627
- if (!n || !s) return "invalid-date";
628
- if (!m.value.start || !m.value.end) return "out-of-bounds";
629
- const E = m.value.start, q = m.value.end;
630
- return R(E, q) ? typeof e.maxSpanDays == "number" && l.value !== void 0 && l.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
631
- }), A = _(void 0), S = h(() => {
632
- if (F.value !== !1) return "";
633
- const { min: n, max: s } = e, E = A.value;
634
- if (!E) return "";
635
- switch (E) {
652
+ if (!n || !c) return "invalid-date";
653
+ if (!o.value.start || !o.value.end) return "out-of-bounds";
654
+ const x = o.value.start, R = o.value.end;
655
+ return U(x, R) ? typeof e.maxSpanDays == "number" && m.value !== void 0 && m.value > e.maxSpanDays ? "span-exceeds-limit" : "valid" : "reversed-range";
656
+ }), v = _(void 0), b = h(() => {
657
+ if (O.value !== !1) return "";
658
+ const { min: n, max: c } = e, x = v.value;
659
+ if (!x) return "";
660
+ switch (x) {
636
661
  case "incomplete":
637
662
  return "Required";
638
663
  case "invalid-date":
@@ -640,90 +665,90 @@ function Ge(e) {
640
665
  case "reversed-range":
641
666
  return "End Date must be on or after Start Date.";
642
667
  case "out-of-bounds":
643
- return n && s ? `Dates must be between ${Q(n)} and ${Q(s)}.` : "Dates must be within the allowed range.";
668
+ return n && c ? `Dates must be between ${J(n)} and ${J(c)}.` : "Dates must be within the allowed range.";
644
669
  case "span-exceeds-limit":
645
670
  return typeof e.maxSpanDays == "number" ? `Date range exceeds ${e.maxSpanDays} days.` : "Date range exceeds maximum allowed span.";
646
671
  case "valid":
647
672
  default:
648
673
  return "";
649
674
  }
650
- }), I = ["ArrowUp", "ArrowDown"], G = ["ArrowLeft", "ArrowRight"], oe = (n, s) => String(n).padStart(s, "0"), Q = (n) => `${oe(n.getMonth() + 1, 2)}/${oe(n.getDate(), 2)}/${oe(
675
+ }), D = ["ArrowUp", "ArrowDown"], $ = ["ArrowLeft", "ArrowRight"], H = (n, c) => String(n).padStart(c, "0"), J = (n) => `${H(n.getMonth() + 1, 2)}/${H(n.getDate(), 2)}/${H(
651
676
  n.getFullYear(),
652
677
  4
653
- )}`, H = (n) => n <= 2 ? { side: "start", part: "mm" } : n <= 5 ? { side: "start", part: (n <= 3, "dd") } : n <= 11 ? { side: "start", part: "yyyy" } : n <= 15 ? { side: "end", part: "mm" } : n <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, j = (n, s, E) => {
654
- const q = s?.selectionStart ?? c.value ?? 0;
655
- c.value = q;
656
- const { start: ne, end: le } = g(t.value);
657
- if (!ne && !le) {
658
- const B = /* @__PURE__ */ new Date(), ue = Q(B);
659
- t.value = `${ue} - ${ue}`, e.onChange({ value: { start: B, end: B }, event: E }), N(() => {
678
+ )}`, oe = (n) => n <= 2 ? { side: "start", part: "mm" } : n <= 5 ? { side: "start", part: (n <= 3, "dd") } : n <= 11 ? { side: "start", part: "yyyy" } : n <= 15 ? { side: "end", part: "mm" } : n <= 18 ? { side: "end", part: "dd" } : { side: "end", part: "yyyy" }, F = (n, c, x) => {
679
+ const R = c?.selectionStart ?? u.value ?? 0;
680
+ u.value = R;
681
+ const { start: ee, end: ae } = y(t.value);
682
+ if (!ee && !ae) {
683
+ const Y = /* @__PURE__ */ new Date(), ue = J(Y);
684
+ t.value = `${ue} - ${ue}`, e.onChange({ value: { start: Y, end: Y }, event: x }), j(() => {
660
685
  requestAnimationFrame(() => {
661
- const te = document.getElementById(
686
+ const Z = document.getElementById(
662
687
  e.id
663
- ), re = c.value ?? 0;
664
- te && (te.focus(), te.setSelectionRange(re, re));
688
+ ), te = u.value ?? 0;
689
+ Z && (Z.focus(), Z.setSelectionRange(te, te));
665
690
  });
666
691
  });
667
692
  return;
668
693
  }
669
- const ye = /* @__PURE__ */ new Date(), de = H(q);
670
- let fe = ne ? new Date(ne) : new Date(ye), me = le ? new Date(le) : new Date(ye);
671
- const he = (B, ue) => {
694
+ const ge = /* @__PURE__ */ new Date(), de = oe(R);
695
+ let fe = ee ? new Date(ee) : new Date(ge), pe = ae ? new Date(ae) : new Date(ge);
696
+ const he = (Y, ue) => {
672
697
  if (ue === "mm") {
673
- const te = B.getMonth() + 1, re = n === "ArrowUp" ? te < 12 ? te + 1 : 1 : te > 1 ? te - 1 : 12;
674
- B.setMonth(re - 1);
675
- const be = L(B.getFullYear(), re);
676
- B.getDate() > be && B.setDate(be);
698
+ const Z = Y.getMonth() + 1, te = n === "ArrowUp" ? Z < 12 ? Z + 1 : 1 : Z > 1 ? Z - 1 : 12;
699
+ Y.setMonth(te - 1);
700
+ const Se = P(Y.getFullYear(), te);
701
+ Y.getDate() > Se && Y.setDate(Se);
677
702
  } else if (ue === "dd") {
678
- const te = L(B.getFullYear(), B.getMonth() + 1), re = B.getDate(), be = n === "ArrowUp" ? re < te ? re + 1 : 1 : re > 1 ? re - 1 : te;
679
- B.setDate(be);
703
+ const Z = P(Y.getFullYear(), Y.getMonth() + 1), te = Y.getDate(), Se = n === "ArrowUp" ? te < Z ? te + 1 : 1 : te > 1 ? te - 1 : Z;
704
+ Y.setDate(Se);
680
705
  } else if (ue === "yyyy") {
681
- const te = B.getFullYear();
682
- B.setFullYear(n === "ArrowUp" ? te + 1 : Math.max(1, te - 1));
683
- const re = L(B.getFullYear(), B.getMonth() + 1);
684
- B.getDate() > re && B.setDate(re);
706
+ const Z = Y.getFullYear();
707
+ Y.setFullYear(n === "ArrowUp" ? Z + 1 : Math.max(1, Z - 1));
708
+ const te = P(Y.getFullYear(), Y.getMonth() + 1);
709
+ Y.getDate() > te && Y.setDate(te);
685
710
  }
686
711
  };
687
- de.side === "start" ? he(fe, de.part) : he(me, de.part);
688
- const we = Q(fe), ke = Q(me);
712
+ de.side === "start" ? he(fe, de.part) : he(pe, de.part);
713
+ const we = J(fe), ke = J(pe);
689
714
  t.value = `${we} - ${ke}`;
690
- const se = C(fe), De = C(me);
691
- se && De && R(se, De) ? e.onChange({ value: { start: se, end: De }, event: E }) : e.onChange({ value: null, event: E }), N(() => {
715
+ const se = T(fe), De = T(pe);
716
+ se && De && U(se, De) ? e.onChange({ value: { start: se, end: De }, event: x }) : e.onChange({ value: null, event: x }), j(() => {
692
717
  requestAnimationFrame(() => {
693
- const B = document.getElementById(
718
+ const Y = document.getElementById(
694
719
  e.id
695
- ), ue = c.value ?? 0;
696
- B && (B.focus(), B.setSelectionRange(ue, ue));
720
+ ), ue = u.value ?? 0;
721
+ Y && (Y.focus(), Y.setSelectionRange(ue, ue));
697
722
  });
698
723
  });
699
- }, a = (n) => {
700
- const { start: s, end: E } = g(t.value);
701
- if (!s || !E) {
724
+ }, ne = (n) => {
725
+ const { start: c, end: x } = y(t.value);
726
+ if (!c || !x) {
702
727
  e.onChange({ value: null, event: n });
703
728
  return;
704
729
  }
705
- const q = C(s), ne = C(E);
706
- if (!q || !ne) {
730
+ const R = T(c), ee = T(x);
731
+ if (!R || !ee) {
707
732
  e.onChange({ value: null, event: n });
708
733
  return;
709
734
  }
710
- if (!R(q, ne)) {
735
+ if (!U(R, ee)) {
711
736
  e.onChange({ value: null, event: n });
712
737
  return;
713
738
  }
714
- e.onChange({ value: { start: q, end: ne }, event: n });
715
- }, d = (n) => {
716
- const s = n.value ?? "", E = n.event;
717
- if (!s && E && E.type === "click") {
718
- U(E);
739
+ e.onChange({ value: { start: R, end: ee }, event: n });
740
+ }, a = (n) => {
741
+ const c = n.value ?? "", x = n.event;
742
+ if (!c && x && x.type === "click") {
743
+ B(x);
719
744
  return;
720
745
  }
721
- t.value = s;
722
- const q = E?.target;
723
- c.value = q?.selectionStart ?? 0, a(n);
746
+ t.value = c;
747
+ const R = x?.target;
748
+ u.value = R?.selectionStart ?? 0, ne(n);
749
+ }, d = (n) => {
750
+ u.value = n.target.selectionStart ?? 0;
724
751
  }, M = (n) => {
725
- c.value = n.target.selectionStart ?? 0;
726
- }, ee = (n) => {
727
752
  if (n.code === "Space" || n.key === " ") {
728
753
  n.preventDefault(), e.onShowCalendar(n);
729
754
  return;
@@ -732,63 +757,63 @@ function Ge(e) {
732
757
  n.preventDefault(), e.onShowCalendar(n);
733
758
  return;
734
759
  }
735
- if (I.includes(n.key)) {
760
+ if (D.includes(n.key)) {
736
761
  n.preventDefault();
737
- const s = n.target;
738
- j(n.key, s, n);
762
+ const c = n.target;
763
+ F(n.key, c, n);
739
764
  }
740
765
  }, r = (n) => {
741
766
  n.preventDefault();
742
- const s = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
743
- j(s, n.target, n);
744
- }, u = (n) => {
745
- if (G.includes(n.key) || I.includes(n.key)) {
767
+ const c = n.deltaY < 0 ? "ArrowUp" : "ArrowDown";
768
+ F(c, n.target, n);
769
+ }, i = (n) => {
770
+ if ($.includes(n.key) || D.includes(n.key)) {
746
771
  n.preventDefault();
747
- const s = n.target;
748
- c.value = s?.selectionStart ?? 0;
772
+ const c = n.target;
773
+ u.value = c?.selectionStart ?? 0;
749
774
  }
750
- }, v = () => {
751
- A.value = p.value, (e.manageValid ?? !0) && (F.value = i.value);
752
- }, $ = (n) => {
753
- v();
754
- }, U = (n) => {
755
- console.log("Clear event:", n), t.value = "", c.value = 0, e.onChange({ value: null, event: n }), v(), N(() => {
756
- const s = document.getElementById(
775
+ }, p = () => {
776
+ v.value = s.value, (e.manageValid ?? !0) && (O.value = l.value);
777
+ }, w = (n) => {
778
+ p();
779
+ }, B = (n) => {
780
+ console.log("Clear event:", n), t.value = "", u.value = 0, e.onChange({ value: null, event: n }), p(), j(() => {
781
+ const c = document.getElementById(
757
782
  e.id
758
783
  );
759
- s && (s.focus(), s.setSelectionRange(0, 0));
784
+ c && (c.focus(), c.setSelectionRange(0, 0));
760
785
  });
761
786
  };
762
787
  e.externalValue && ve(
763
788
  e.externalValue,
764
789
  (n) => {
765
- const s = n?.start ?? null, E = n?.end ?? null;
766
- if (s && E) {
767
- if (t.value = `${Q(s)} - ${Q(E)}`, e.isOpen?.value && T.value && e.onRequestClose) {
768
- const q = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
790
+ const c = n?.start ?? null, x = n?.end ?? null;
791
+ if (c && x) {
792
+ if (t.value = `${J(c)} - ${J(x)}`, e.isOpen?.value && I.value && e.onRequestClose) {
793
+ const R = typeof e.closeDelay == "number" ? e.closeDelay : e.closeDelay?.value ?? 0;
769
794
  setTimeout(() => {
770
- e.onRequestClose?.(), T.value = !1, v();
771
- }, q);
795
+ e.onRequestClose?.(), I.value = !1, p();
796
+ }, R);
772
797
  }
773
798
  return;
774
799
  }
775
800
  },
776
801
  { immediate: !0 }
777
802
  );
778
- const ae = h(
803
+ const Q = h(
779
804
  () => t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0"
780
805
  ), z = h(
781
806
  () => t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0"
782
- ), Y = h(
807
+ ), W = h(
783
808
  () => t.value && t.value.substring(6, 10).replace(/\D/g, "0") || "0"
784
809
  ), ie = h(
785
810
  () => t.value && t.value.substring(13, 15).replace(/\D/g, "0") || "0"
786
- ), X = h(
811
+ ), le = h(
787
812
  () => t.value && t.value.substring(16, 18).replace(/\D/g, "0") || "0"
788
- ), O = h(
813
+ ), K = h(
789
814
  () => t.value && t.value.substring(19, 23).replace(/\D/g, "0") || "0"
790
- ), J = h(() => {
791
- const { start: n, end: s } = g(t.value);
815
+ ), X = h(() => {
816
+ const { start: n, end: c } = y(t.value);
792
817
  return [
793
818
  {
794
819
  label: "Raw",
@@ -804,74 +829,74 @@ function Ge(e) {
804
829
  },
805
830
  {
806
831
  label: "Start",
807
- value: `${String(ae.value).padStart(2, "0")} / ${String(
832
+ value: `${String(Q.value).padStart(2, "0")} / ${String(
808
833
  z.value
809
- ).padStart(2, "0")} / ${String(Y.value).padStart(4, "0")}`
834
+ ).padStart(2, "0")} / ${String(W.value).padStart(4, "0")}`
810
835
  },
811
836
  {
812
837
  label: "End",
813
838
  value: `${String(ie.value).padStart(2, "0")} / ${String(
814
- X.value
815
- ).padStart(2, "0")} / ${String(O.value).padStart(4, "0")}`
839
+ le.value
840
+ ).padStart(2, "0")} / ${String(K.value).padStart(4, "0")}`
816
841
  },
817
- { label: "Digits only", value: w.value },
842
+ { label: "Digits only", value: g.value },
818
843
  { label: "Mask complete", value: `${f.value}` },
819
844
  {
820
845
  label: "Parsed",
821
- value: `${n ? n.toDateString() : "-"} | ${s ? s.toDateString() : "-"}`
846
+ value: `${n ? n.toDateString() : "-"} | ${c ? c.toDateString() : "-"}`
822
847
  },
823
848
  {
824
849
  label: "Valid (managed)",
825
- value: `${F.value ?? "-"}`
850
+ value: `${O.value ?? "-"}`
826
851
  },
827
- { label: "Span (days)", value: `${l.value ?? "-"}` },
852
+ { label: "Span (days)", value: `${m.value ?? "-"}` },
828
853
  {
829
854
  label: "Reason",
830
- value: `${p.value ?? "-"}`
855
+ value: `${s.value ?? "-"}`
831
856
  },
832
857
  {
833
858
  label: "Cursor in",
834
- value: `${c.value ?? "-"} (${(() => {
835
- const E = c.value ?? 0, q = H(E);
836
- return `${q.side}.${q.part}`;
859
+ value: `${u.value ?? "-"} (${(() => {
860
+ const x = u.value ?? 0, R = oe(x);
861
+ return `${R.side}.${R.part}`;
837
862
  })()})`
838
863
  }
839
864
  ];
840
- }), Z = () => {
841
- N(() => {
865
+ }), re = () => {
866
+ j(() => {
842
867
  const n = document.getElementById(e.id);
843
868
  if (!n) {
844
869
  console.warn(`#${e.id} not found for styling.`);
845
870
  return;
846
871
  }
847
- const s = n.closest("div");
848
- if (!s) {
872
+ const c = n.closest("div");
873
+ if (!c) {
849
874
  console.warn(`Parent div of #${e.id} not found for styling.`);
850
875
  return;
851
876
  }
852
- s.classList.contains("fk-daterangepicker") || s.classList.add("fk-daterangepicker");
877
+ c.classList.contains("fk-daterangepicker") || c.classList.add("fk-daterangepicker");
853
878
  });
854
879
  };
855
880
  xe(() => {
856
- Z();
881
+ re();
857
882
  });
858
- const ge = () => {
859
- N(() => {
883
+ const ye = () => {
884
+ j(() => {
860
885
  try {
861
886
  const n = Array.from(
862
887
  document.querySelectorAll(".k-animation-container")
863
888
  );
864
889
  if (!n.length) return;
865
- const E = [...n].reverse().find((le) => le.querySelector(".k-calendar"))?.querySelector(
890
+ const x = [...n].reverse().find((ae) => ae.querySelector(".k-calendar"))?.querySelector(
866
891
  ".k-calendar"
867
892
  );
868
- if (!E) return;
869
- const q = E.querySelectorAll(
893
+ if (!x) return;
894
+ const R = x.querySelectorAll(
870
895
  ".k-calendar-table"
871
896
  );
872
- let ne = !1;
873
- q.forEach((le) => {
874
- le.tabIndex === 0 && (ne ? le.tabIndex = -1 : ne = !0);
897
+ let ee = !1;
898
+ R.forEach((ae) => {
899
+ ae.tabIndex === 0 && (ee ? ae.tabIndex = -1 : ee = !0);
875
900
  });
876
901
  } catch (n) {
877
902
  console.warn(n);
@@ -881,225 +906,225 @@ function Ge(e) {
881
906
  return e.isOpen && ve(
882
907
  e.isOpen,
883
908
  (n) => {
884
- n && setTimeout(() => ge(), 0);
909
+ n && setTimeout(() => ye(), 0);
885
910
  },
886
911
  { immediate: !1 }
887
912
  ), {
888
913
  raw: t,
889
- cursorPos: c,
890
- debugEnabled: P,
891
- debugLines: J,
892
- digitsOnly: w,
893
- valid: F,
894
- validComputed: K(i),
895
- reason: K(p),
896
- validationMessage: K(S),
897
- spanDays: K(l),
898
- month1: K(ae),
899
- day1: K(z),
900
- year1: K(Y),
901
- month2: K(ie),
902
- day2: K(X),
903
- year2: K(O),
904
- handleChange: d,
905
- handleKeyDown: ee,
914
+ cursorPos: u,
915
+ debugEnabled: q,
916
+ debugLines: X,
917
+ digitsOnly: g,
918
+ valid: O,
919
+ validComputed: N(l),
920
+ reason: N(s),
921
+ validationMessage: N(b),
922
+ spanDays: N(m),
923
+ month1: N(Q),
924
+ day1: N(z),
925
+ year1: N(W),
926
+ month2: N(ie),
927
+ day2: N(le),
928
+ year2: N(K),
929
+ handleChange: a,
930
+ handleKeyDown: M,
906
931
  handleWheel: r,
907
- handleKeyUp: u,
908
- handleClick: M,
909
- handleBlur: $,
910
- handleClear: U,
932
+ handleKeyUp: i,
933
+ handleClick: d,
934
+ handleBlur: w,
935
+ handleClear: B,
911
936
  onCalendarChange: () => {
912
- T.value = !0;
937
+ I.value = !0;
913
938
  },
914
- initStyling: Z
939
+ initStyling: re
915
940
  };
916
941
  }
917
- function je(e) {
918
- const t = _(""), c = _(void 0), P = _(!!e.debug), T = _(e.timeFormat ?? "hh:mm AM"), V = h(() => !!e.required), W = _(!1), k = ["ArrowUp", "ArrowDown"], b = ["ArrowLeft", "ArrowRight"], y = h(() => (t.value ?? "").replace(/\D/g, "")), w = {
942
+ function Je(e) {
943
+ const t = _(""), u = _(void 0), q = _(!!e.debug), I = _(e.timeFormat ?? "hh:mm AM"), L = h(() => !!e.required), V = _(!1), A = ["ArrowUp", "ArrowDown"], k = ["ArrowLeft", "ArrowRight"], S = h(() => (t.value ?? "").replace(/\D/g, "")), g = {
919
944
  H: /[0-9]/,
920
945
  h: /[0-9]/,
921
946
  M: /[0-9]/,
922
947
  m: /[0-9]/,
923
948
  A: /[AaPp]/,
924
949
  a: /[Mm]/
925
- }, L = (r) => r <= 2 ? "hh" : r <= 5 ? "mm" : "ampm", D = h(() => {
926
- const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", u = parseInt(r);
927
- return Math.min(Math.max(u, 0), 23);
928
- }), x = h(() => {
929
- const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", u = parseInt(r);
930
- return Math.min(Math.max(u, 0), 59);
931
- }), C = h(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), R = h(() => {
932
- const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), u = C.value;
933
- return r === 12 ? u === "AM" ? 0 : 12 : u === "PM" ? r + 12 : r;
934
- }), f = h(() => g.value ? `${String(R.value).padStart(2, "0")}:${String(x.value).padStart(2, "0")}:00` : null), g = h(
950
+ }, P = (r) => r <= 2 ? "hh" : r <= 5 ? "mm" : "ampm", E = h(() => {
951
+ const r = t.value && t.value.substring(0, 2).replace(/\D/g, "0") || "0", i = parseInt(r);
952
+ return Math.min(Math.max(i, 0), 23);
953
+ }), C = h(() => {
954
+ const r = t.value && t.value.substring(3, 5).replace(/\D/g, "0") || "0", i = parseInt(r);
955
+ return Math.min(Math.max(i, 0), 59);
956
+ }), T = h(() => (t.value?.substring(6, 8) || "AM").toUpperCase().startsWith("P") ? "PM" : "AM"), U = h(() => {
957
+ const r = parseInt(t.value?.substring(0, 2).replace(/\D/g, "0") || "0"), i = T.value;
958
+ return r === 12 ? i === "AM" ? 0 : 12 : i === "PM" ? r + 12 : r;
959
+ }), f = h(() => y.value ? `${String(U.value).padStart(2, "0")}:${String(C.value).padStart(2, "0")}:00` : null), y = h(
935
960
  () => /^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value ?? "")
936
- ), F = (r, u, v) => {
937
- let $ = r % 12;
938
- return $ === 0 && ($ = 12), `${String($).padStart(2, "0")}:${String(u).padStart(
961
+ ), O = (r, i, p) => {
962
+ let w = r % 12;
963
+ return w === 0 && (w = 12), `${String(w).padStart(2, "0")}:${String(i).padStart(
939
964
  2,
940
965
  "0"
941
- )} ${v}`;
942
- }, o = (r) => {
943
- const u = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
944
- if (!u) return null;
945
- const v = parseInt(u[1]), $ = parseInt(u[2]), U = u[3].toUpperCase();
946
- if (v < 1 || v > 12 || $ < 0 || $ > 59) return null;
947
- let ae = v % 12;
948
- U === "PM" && (ae += 12);
966
+ )} ${p}`;
967
+ }, G = (r) => {
968
+ const i = r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
969
+ if (!i) return null;
970
+ const p = parseInt(i[1]), w = parseInt(i[2]), B = i[3].toUpperCase();
971
+ if (p < 1 || p > 12 || w < 0 || w > 59) return null;
972
+ let Q = p % 12;
973
+ B === "PM" && (Q += 12);
949
974
  const z = /* @__PURE__ */ new Date();
950
- return z.setSeconds(0, 0), z.setHours(ae), z.setMinutes($), z;
951
- }, m = (r) => {
952
- if (y.value.length === 0) {
975
+ return z.setSeconds(0, 0), z.setHours(Q), z.setMinutes(w), z;
976
+ }, o = (r) => {
977
+ if (S.value.length === 0) {
953
978
  e.onChange({ value: null, event: r });
954
979
  return;
955
980
  }
956
- if (!g.value) {
981
+ if (!y.value) {
957
982
  e.onChange({ value: null, event: r });
958
983
  return;
959
984
  }
960
- const u = o(t.value);
961
- u && i(u) ? e.onChange({ value: u, event: r }) : e.onChange({ value: null, event: r });
962
- }, l = (r) => r.getHours() * 60 + r.getMinutes(), i = (r) => {
963
- const u = e.min ?? void 0, v = e.max ?? void 0, $ = l(r);
964
- if (u) {
965
- const U = l(u);
966
- if ($ < U) return !1;
985
+ const i = G(t.value);
986
+ i && l(i) ? e.onChange({ value: i, event: r }) : e.onChange({ value: null, event: r });
987
+ }, m = (r) => r.getHours() * 60 + r.getMinutes(), l = (r) => {
988
+ const i = e.min ?? void 0, p = e.max ?? void 0, w = m(r);
989
+ if (i) {
990
+ const B = m(i);
991
+ if (w < B) return !1;
967
992
  }
968
- if (v) {
969
- const U = l(v);
970
- if ($ > U) return !1;
993
+ if (p) {
994
+ const B = m(p);
995
+ if (w > B) return !1;
971
996
  }
972
997
  return !0;
973
- }, p = (r) => {
998
+ }, s = (r) => {
974
999
  t.value = r.value;
975
- const u = r.event?.target;
976
- c.value = u?.selectionStart ?? 0;
1000
+ const i = r.event?.target;
1001
+ u.value = i?.selectionStart ?? 0;
977
1002
  try {
978
- const v = c.value ?? 0;
979
- if (L(v) === "ampm" && (t.value ?? "").length >= 8) {
980
- const $ = t.value.charAt(6);
981
- /[Aa]/.test($) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, N(() => {
1003
+ const p = u.value ?? 0;
1004
+ if (P(p) === "ampm" && (t.value ?? "").length >= 8) {
1005
+ const w = t.value.charAt(6);
1006
+ /[Aa]/.test(w) ? (t.value = `${t.value.slice(0, 6)}AM${t.value.slice(8)}`, j(() => {
982
1007
  requestAnimationFrame(() => {
983
- const U = document.getElementById(
1008
+ const B = document.getElementById(
984
1009
  e.id
985
1010
  );
986
- U && (U.focus(), U.setSelectionRange(8, 8));
1011
+ B && (B.focus(), B.setSelectionRange(8, 8));
987
1012
  });
988
- })) : /[Pp]/.test($) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, N(() => {
1013
+ })) : /[Pp]/.test(w) && (t.value = `${t.value.slice(0, 6)}PM${t.value.slice(8)}`, j(() => {
989
1014
  requestAnimationFrame(() => {
990
- const U = document.getElementById(
1015
+ const B = document.getElementById(
991
1016
  e.id
992
1017
  );
993
- U && (U.focus(), U.setSelectionRange(8, 8));
1018
+ B && (B.focus(), B.setSelectionRange(8, 8));
994
1019
  });
995
1020
  }));
996
1021
  }
997
1022
  } catch {
998
1023
  }
999
- m(r);
1000
- }, A = (r) => {
1001
- c.value = r.target.selectionStart ?? 0;
1002
- }, S = (r, u, v) => {
1003
- const $ = u?.selectionStart ?? c.value ?? 0;
1004
- c.value = $;
1005
- const U = L($), ae = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1006
- if (!ae) {
1007
- if ((t.value ?? "").length === 0 || y.value.length === 0) {
1008
- const O = /* @__PURE__ */ new Date(), J = O.getHours(), Z = J >= 12 ? "PM" : "AM";
1009
- t.value = F(J, O.getMinutes(), Z);
1010
- const ge = o(t.value);
1011
- ge && i(ge) ? e.onChange({ value: ge, event: v }) : e.onChange({ value: null, event: v }), N(() => {
1024
+ o(r);
1025
+ }, v = (r) => {
1026
+ u.value = r.target.selectionStart ?? 0;
1027
+ }, b = (r, i, p) => {
1028
+ const w = i?.selectionStart ?? u.value ?? 0;
1029
+ u.value = w;
1030
+ const B = P(w), Q = (t.value ?? "").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);
1031
+ if (!Q) {
1032
+ if ((t.value ?? "").length === 0 || S.value.length === 0) {
1033
+ const K = /* @__PURE__ */ new Date(), X = K.getHours(), re = X >= 12 ? "PM" : "AM";
1034
+ t.value = O(X, K.getMinutes(), re);
1035
+ const ye = G(t.value);
1036
+ ye && l(ye) ? e.onChange({ value: ye, event: p }) : e.onChange({ value: null, event: p }), j(() => {
1012
1037
  requestAnimationFrame(() => {
1013
1038
  const n = document.getElementById(
1014
1039
  e.id
1015
- ), s = c.value ?? 0;
1016
- n && (n.focus(), n.setSelectionRange(s, s));
1040
+ ), c = u.value ?? 0;
1041
+ n && (n.focus(), n.setSelectionRange(c, c));
1017
1042
  });
1018
1043
  });
1019
1044
  }
1020
1045
  return;
1021
1046
  }
1022
- let z = parseInt(ae[1]), Y = parseInt(ae[2]), ie = ae[3].toUpperCase();
1023
- if (U === "hh")
1047
+ let z = parseInt(Q[1]), W = parseInt(Q[2]), ie = Q[3].toUpperCase();
1048
+ if (B === "hh")
1024
1049
  r === "ArrowUp" ? z = z < 12 ? z + 1 : 1 : z = z > 1 ? z - 1 : 12;
1025
- else if (U === "mm") {
1026
- const O = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
1027
- if (O === 1)
1028
- r === "ArrowUp" ? Y = Y < 59 ? Y + 1 : 0 : Y = Y > 0 ? Y - 1 : 59;
1050
+ else if (B === "mm") {
1051
+ const K = e.minuteStepRef?.value ?? e.minuteStep ?? 1;
1052
+ if (K === 1)
1053
+ r === "ArrowUp" ? W = W < 59 ? W + 1 : 0 : W = W > 0 ? W - 1 : 59;
1029
1054
  else if (r === "ArrowUp") {
1030
- const J = Y % O;
1031
- let Z = J === 0 ? Y + O : Y + (O - J);
1032
- Z >= 60 && (Z = 0), Y = Z;
1055
+ const X = W % K;
1056
+ let re = X === 0 ? W + K : W + (K - X);
1057
+ re >= 60 && (re = 0), W = re;
1033
1058
  } else {
1034
- const J = Y % O;
1035
- let Z = J === 0 ? Y - O : Y - J;
1036
- Z < 0 && (Z = 60 - O), Y = Z;
1059
+ const X = W % K;
1060
+ let re = X === 0 ? W - K : W - X;
1061
+ re < 0 && (re = 60 - K), W = re;
1037
1062
  }
1038
- } else U === "ampm" && (ie = ie === "AM" ? "PM" : "AM");
1039
- t.value = `${String(z).padStart(2, "0")}:${String(Y).padStart(
1063
+ } else B === "ampm" && (ie = ie === "AM" ? "PM" : "AM");
1064
+ t.value = `${String(z).padStart(2, "0")}:${String(W).padStart(
1040
1065
  2,
1041
1066
  "0"
1042
1067
  )} ${ie}`;
1043
- const X = o(t.value);
1044
- X && i(X) ? e.onChange({ value: X, event: v }) : e.onChange({ value: null, event: v }), N(() => {
1068
+ const le = G(t.value);
1069
+ le && l(le) ? e.onChange({ value: le, event: p }) : e.onChange({ value: null, event: p }), j(() => {
1045
1070
  requestAnimationFrame(() => {
1046
- const O = document.getElementById(
1071
+ const K = document.getElementById(
1047
1072
  e.id
1048
- ), J = c.value ?? 0;
1049
- O && (O.focus(), O.setSelectionRange(J, J));
1073
+ ), X = u.value ?? 0;
1074
+ K && (K.focus(), K.setSelectionRange(X, X));
1050
1075
  });
1051
1076
  });
1052
- }, I = (r) => {
1077
+ }, D = (r) => {
1053
1078
  if (r.code === "Space" || r.key === " ") {
1054
1079
  e.onShowPicker(r);
1055
1080
  return;
1056
1081
  }
1057
- if (k.includes(r.key)) {
1082
+ if (A.includes(r.key)) {
1058
1083
  r.preventDefault();
1059
- const u = r.target;
1060
- S(r.key, u, r);
1084
+ const i = r.target;
1085
+ b(r.key, i, r);
1061
1086
  }
1062
- }, G = (r) => {
1087
+ }, $ = (r) => {
1063
1088
  r.preventDefault();
1064
- const u = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1065
- S(u, r.target, r);
1066
- }, oe = (r) => {
1067
- const u = r.target;
1068
- if (b.includes(r.key)) {
1069
- c.value = u?.selectionStart ?? 0;
1089
+ const i = r.deltaY < 0 ? "ArrowUp" : "ArrowDown";
1090
+ b(i, r.target, r);
1091
+ }, H = (r) => {
1092
+ const i = r.target;
1093
+ if (k.includes(r.key)) {
1094
+ u.value = i?.selectionStart ?? 0;
1070
1095
  return;
1071
1096
  }
1072
- k.includes(r.key) && (r.preventDefault(), c.value = u?.selectionStart ?? 0);
1073
- }, Q = (r) => {
1074
- W.value = !0, V.value && e.externalValue && e.externalValue.value === void 0 && y.value.length === 0 && (e.externalValue.value = "");
1075
- const u = r.target;
1076
- u && (c.value = u.selectionStart ?? 0);
1097
+ A.includes(r.key) && (r.preventDefault(), u.value = i?.selectionStart ?? 0);
1098
+ }, J = (r) => {
1099
+ V.value = !0, L.value && e.externalValue && e.externalValue.value === void 0 && S.value.length === 0 && (e.externalValue.value = "");
1100
+ const i = r.target;
1101
+ i && (u.value = i.selectionStart ?? 0);
1077
1102
  };
1078
1103
  e.externalValue && ve(
1079
1104
  e.externalValue,
1080
1105
  (r) => {
1081
1106
  if (r) {
1082
- const u = new Date(r);
1083
- if (u.toString() !== "Invalid Date") {
1084
- const v = u.getHours(), $ = v >= 12 ? "PM" : "AM";
1085
- t.value = F(v, u.getMinutes(), $);
1107
+ const i = new Date(r);
1108
+ if (i.toString() !== "Invalid Date") {
1109
+ const p = i.getHours(), w = p >= 12 ? "PM" : "AM";
1110
+ t.value = O(p, i.getMinutes(), w);
1086
1111
  return;
1087
1112
  }
1088
1113
  }
1089
1114
  },
1090
1115
  { immediate: !0 }
1091
1116
  );
1092
- const H = h(() => [
1117
+ const oe = h(() => [
1093
1118
  ["Time", t.value || "--:-- --"],
1094
- ["Hour (12h)", D.value],
1095
- ["Hour (24h)", R.value],
1096
- ["Minute", x.value],
1097
- ["Period", C.value],
1119
+ ["Hour (12h)", E.value],
1120
+ ["Hour (24h)", U.value],
1121
+ ["Minute", C.value],
1122
+ ["Period", T.value],
1098
1123
  ["Time (24h)", f.value ?? "--:--:--"],
1099
- ["Digits only", y.value],
1124
+ ["Digits only", S.value],
1100
1125
  [
1101
1126
  "Parsed Date",
1102
- j.value?.toLocaleDateString("en-US", {
1127
+ F.value?.toLocaleDateString("en-US", {
1103
1128
  hour: "2-digit",
1104
1129
  minute: "2-digit"
1105
1130
  }) ?? null
@@ -1118,309 +1143,325 @@ function je(e) {
1118
1143
  minute: "2-digit"
1119
1144
  }) ?? null
1120
1145
  ],
1121
- ["valid", a.value],
1122
- ["reason", d.value],
1123
- ["validationMessage", M.value]
1124
- ]), j = h(
1125
- () => o(t.value) ?? null
1126
- ), a = h(() => {
1127
- if (!V.value) {
1128
- if (!g.value) return !0;
1129
- const u = j.value;
1130
- return u ? i(u) : !1;
1146
+ ["valid", ne.value],
1147
+ ["reason", a.value],
1148
+ ["validationMessage", d.value]
1149
+ ]), F = h(
1150
+ () => G(t.value) ?? null
1151
+ ), ne = h(() => {
1152
+ if (!L.value) {
1153
+ if (!y.value) return !0;
1154
+ const i = F.value;
1155
+ return i ? l(i) : !1;
1131
1156
  }
1132
- if (!W.value) return !0;
1133
- const r = j.value;
1134
- return !g.value || !r ? !1 : i(r);
1135
- }), d = h(() => {
1136
- if (!V.value) {
1137
- if (!g.value) return;
1138
- const u = j.value;
1139
- return u ? i(u) ? "valid" : "out-of-bounds" : "invalid-time";
1157
+ if (!V.value) return !0;
1158
+ const r = F.value;
1159
+ return !y.value || !r ? !1 : l(r);
1160
+ }), a = h(() => {
1161
+ if (!L.value) {
1162
+ if (!y.value) return;
1163
+ const i = F.value;
1164
+ return i ? l(i) ? "valid" : "out-of-bounds" : "invalid-time";
1140
1165
  }
1141
- if (!W.value) return;
1142
- if (y.value.length === 0 || !g.value)
1166
+ if (!V.value) return;
1167
+ if (S.value.length === 0 || !y.value)
1143
1168
  return "incomplete";
1144
- const r = j.value;
1145
- return r ? i(r) ? "valid" : "out-of-bounds" : "invalid-time";
1146
- }), M = h(() => {
1147
- const r = d.value;
1169
+ const r = F.value;
1170
+ return r ? l(r) ? "valid" : "out-of-bounds" : "invalid-time";
1171
+ }), d = h(() => {
1172
+ const r = a.value;
1148
1173
  if (!r || r === "valid") return "";
1149
1174
  if (r === "incomplete")
1150
1175
  return "Required";
1151
1176
  if (r === "invalid-time")
1152
- return `Must be in ${T.value} format.`;
1153
- const u = {
1177
+ return `Must be in ${I.value} format.`;
1178
+ const i = {
1154
1179
  hour: "2-digit",
1155
1180
  minute: "2-digit"
1156
- }, v = e.min ? e.min.toLocaleTimeString("en-US", u) : null, $ = e.max ? e.max.toLocaleTimeString("en-US", u) : null;
1181
+ }, p = e.min ? e.min.toLocaleTimeString("en-US", i) : null, w = e.max ? e.max.toLocaleTimeString("en-US", i) : null;
1157
1182
  if (r === "out-of-bounds") {
1158
- if (v && $) return `Must be between ${v} and ${$}.`;
1159
- if (v) return `Must be ${v} or later.`;
1160
- if ($) return `Must be ${$} or earlier.`;
1183
+ if (p && w) return `Must be between ${p} and ${w}.`;
1184
+ if (p) return `Must be ${p} or later.`;
1185
+ if (w) return `Must be ${w} or earlier.`;
1161
1186
  }
1162
1187
  return "";
1163
- }), ee = () => {
1164
- N(() => {
1188
+ }), M = () => {
1189
+ j(() => {
1165
1190
  const r = document.getElementById(e.id);
1166
1191
  if (!r) {
1167
1192
  console.warn(`#${e.id} not found for styling.`);
1168
1193
  return;
1169
1194
  }
1170
- const u = r.closest(".k-timepicker");
1171
- if (!u) {
1195
+ const i = r.closest(".k-timepicker");
1196
+ if (!i) {
1172
1197
  console.warn(
1173
1198
  `.k-timepicker parent of #${e.id} not found for styling.`
1174
1199
  );
1175
1200
  return;
1176
1201
  }
1177
- const v = u.parentElement;
1178
- if (!v) {
1202
+ const p = i.parentElement;
1203
+ if (!p) {
1179
1204
  console.warn(
1180
1205
  `Parent of .k-timepicker not found for #${e.id} styling.`
1181
1206
  );
1182
1207
  return;
1183
1208
  }
1184
- v.classList.contains("fk-timepicker") || v.classList.add("fk-timepicker");
1209
+ p.classList.contains("fk-timepicker") || p.classList.add("fk-timepicker");
1185
1210
  });
1186
1211
  };
1187
1212
  return xe(() => {
1188
- ee();
1213
+ M();
1189
1214
  }), {
1190
1215
  raw: t,
1191
- rules: w,
1192
- debugEnabled: P,
1193
- debugLines: H,
1194
- placeholder: T,
1195
- isValid: a,
1196
- reason: K(d),
1197
- validationMessage: M,
1198
- isComplete: g,
1199
- inRangeTime: i,
1200
- cursorPos: c,
1201
- hour: K(D),
1202
- hour24: K(R),
1203
- minute: K(x),
1204
- period: K(C),
1205
- time24: K(f),
1206
- parsedRawTime: K(j),
1207
- handleChange: p,
1208
- handleKeyDown: I,
1209
- handleKeyUp: oe,
1210
- handleClick: A,
1211
- handleWheel: G,
1212
- handleBlur: Q,
1216
+ rules: g,
1217
+ debugEnabled: q,
1218
+ debugLines: oe,
1219
+ placeholder: I,
1220
+ isValid: ne,
1221
+ reason: N(a),
1222
+ validationMessage: d,
1223
+ isComplete: y,
1224
+ inRangeTime: l,
1225
+ cursorPos: u,
1226
+ hour: N(E),
1227
+ hour24: N(U),
1228
+ minute: N(C),
1229
+ period: N(T),
1230
+ time24: N(f),
1231
+ parsedRawTime: N(F),
1232
+ handleChange: s,
1233
+ handleKeyDown: D,
1234
+ handleKeyUp: H,
1235
+ handleClick: v,
1236
+ handleWheel: $,
1237
+ handleBlur: J,
1213
1238
  // Expose so consumers can reapply theming when Kendo updates DOM
1214
- initStyling: ee
1239
+ initStyling: M
1215
1240
  };
1216
1241
  }
1217
- function Fe(e) {
1242
+ function Ue(e) {
1218
1243
  return Le() ? (Pe(e), !0) : !1;
1219
1244
  }
1220
- const $e = typeof window < "u" && typeof document < "u";
1245
+ const Ce = typeof window < "u" && typeof document < "u";
1221
1246
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
1222
- const Ue = Object.prototype.toString, Oe = (e) => Ue.call(e) === "[object Object]", pe = () => {
1223
- }, Be = /* @__PURE__ */ Ke();
1224
- function Ke() {
1247
+ const Oe = Object.prototype.toString, Be = (e) => Oe.call(e) === "[object Object]", me = () => {
1248
+ }, Ke = /* @__PURE__ */ Ve();
1249
+ function Ve() {
1225
1250
  var e, t;
1226
- return $e && ((e = window?.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window?.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
1251
+ return Ce && ((e = window?.navigator) == null ? void 0 : e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window?.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
1227
1252
  }
1228
1253
  function Ae(e) {
1229
1254
  return Array.isArray(e) ? e : [e];
1230
1255
  }
1231
- function Ve(e, t, c) {
1256
+ function Ye(e, t, u) {
1232
1257
  return ve(
1233
1258
  e,
1234
1259
  t,
1235
1260
  {
1236
- ...c,
1261
+ ...u,
1237
1262
  immediate: !0
1238
1263
  }
1239
1264
  );
1240
1265
  }
1241
- const Ce = $e ? window : void 0;
1242
- function Se(e) {
1266
+ const $e = Ce ? window : void 0;
1267
+ function be(e) {
1243
1268
  var t;
1244
- const c = ce(e);
1245
- return (t = c?.$el) != null ? t : c;
1269
+ const u = ce(e);
1270
+ return (t = u?.$el) != null ? t : u;
1246
1271
  }
1247
1272
  function Ee(...e) {
1248
- const t = [], c = () => {
1249
- t.forEach((k) => k()), t.length = 0;
1250
- }, P = (k, b, y, w) => (k.addEventListener(b, y, w), () => k.removeEventListener(b, y, w)), T = h(() => {
1251
- const k = Ae(ce(e[0])).filter((b) => b != null);
1252
- return k.every((b) => typeof b != "string") ? k : void 0;
1253
- }), V = Ve(
1273
+ const t = [], u = () => {
1274
+ t.forEach((A) => A()), t.length = 0;
1275
+ }, q = (A, k, S, g) => (A.addEventListener(k, S, g), () => A.removeEventListener(k, S, g)), I = h(() => {
1276
+ const A = Ae(ce(e[0])).filter((k) => k != null);
1277
+ return A.every((k) => typeof k != "string") ? A : void 0;
1278
+ }), L = Ye(
1254
1279
  () => {
1255
- var k, b;
1280
+ var A, k;
1256
1281
  return [
1257
- (b = (k = T.value) == null ? void 0 : k.map((y) => Se(y))) != null ? b : [Ce].filter((y) => y != null),
1258
- Ae(ce(T.value ? e[1] : e[0])),
1259
- Ae(Te(T.value ? e[2] : e[1])),
1282
+ (k = (A = I.value) == null ? void 0 : A.map((S) => be(S))) != null ? k : [$e].filter((S) => S != null),
1283
+ Ae(ce(I.value ? e[1] : e[0])),
1284
+ Ae(Fe(I.value ? e[2] : e[1])),
1260
1285
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
1261
- ce(T.value ? e[3] : e[2])
1286
+ ce(I.value ? e[3] : e[2])
1262
1287
  ];
1263
1288
  },
1264
- ([k, b, y, w]) => {
1265
- if (c(), !k?.length || !b?.length || !y?.length)
1289
+ ([A, k, S, g]) => {
1290
+ if (u(), !A?.length || !k?.length || !S?.length)
1266
1291
  return;
1267
- const L = Oe(w) ? { ...w } : w;
1292
+ const P = Be(g) ? { ...g } : g;
1268
1293
  t.push(
1269
- ...k.flatMap(
1270
- (D) => b.flatMap(
1271
- (x) => y.map((C) => P(D, x, C, L))
1294
+ ...A.flatMap(
1295
+ (E) => k.flatMap(
1296
+ (C) => S.map((T) => q(E, C, T, P))
1272
1297
  )
1273
1298
  )
1274
1299
  );
1275
1300
  },
1276
1301
  { flush: "post" }
1277
- ), W = () => {
1278
- V(), c();
1302
+ ), V = () => {
1303
+ L(), u();
1279
1304
  };
1280
- return Fe(c), W;
1305
+ return Ue(u), V;
1281
1306
  }
1282
1307
  let Me = !1;
1283
- function Ye(e, t, c = {}) {
1284
- const { window: P = Ce, ignore: T = [], capture: V = !0, detectIframe: W = !1, controls: k = !1 } = c;
1285
- if (!P)
1286
- return k ? { stop: pe, cancel: pe, trigger: pe } : pe;
1287
- if (Be && !Me) {
1308
+ function Ne(e, t, u = {}) {
1309
+ const { window: q = $e, ignore: I = [], capture: L = !0, detectIframe: V = !1, controls: A = !1 } = u;
1310
+ if (!q)
1311
+ return A ? { stop: me, cancel: me, trigger: me } : me;
1312
+ if (Ke && !Me) {
1288
1313
  Me = !0;
1289
1314
  const f = { passive: !0 };
1290
- Array.from(P.document.body.children).forEach((g) => g.addEventListener("click", pe, f)), P.document.documentElement.addEventListener("click", pe, f);
1315
+ Array.from(q.document.body.children).forEach((y) => y.addEventListener("click", me, f)), q.document.documentElement.addEventListener("click", me, f);
1291
1316
  }
1292
- let b = !0;
1293
- const y = (f) => ce(T).some((g) => {
1294
- if (typeof g == "string")
1295
- return Array.from(P.document.querySelectorAll(g)).some((F) => F === f.target || f.composedPath().includes(F));
1317
+ let k = !0;
1318
+ const S = (f) => ce(I).some((y) => {
1319
+ if (typeof y == "string")
1320
+ return Array.from(q.document.querySelectorAll(y)).some((O) => O === f.target || f.composedPath().includes(O));
1296
1321
  {
1297
- const F = Se(g);
1298
- return F && (f.target === F || f.composedPath().includes(F));
1322
+ const O = be(y);
1323
+ return O && (f.target === O || f.composedPath().includes(O));
1299
1324
  }
1300
1325
  });
1301
- function w(f) {
1302
- const g = ce(f);
1303
- return g && g.$.subTree.shapeFlag === 16;
1326
+ function g(f) {
1327
+ const y = ce(f);
1328
+ return y && y.$.subTree.shapeFlag === 16;
1304
1329
  }
1305
- function L(f, g) {
1306
- const F = ce(f), o = F.$.subTree && F.$.subTree.children;
1307
- return o == null || !Array.isArray(o) ? !1 : o.some((m) => m.el === g.target || g.composedPath().includes(m.el));
1330
+ function P(f, y) {
1331
+ const O = ce(f), G = O.$.subTree && O.$.subTree.children;
1332
+ return G == null || !Array.isArray(G) ? !1 : G.some((o) => o.el === y.target || y.composedPath().includes(o.el));
1308
1333
  }
1309
- const D = (f) => {
1310
- const g = Se(e);
1311
- if (f.target != null && !(!(g instanceof Element) && w(e) && L(e, f)) && !(!g || g === f.target || f.composedPath().includes(g))) {
1312
- if ("detail" in f && f.detail === 0 && (b = !y(f)), !b) {
1313
- b = !0;
1334
+ const E = (f) => {
1335
+ const y = be(e);
1336
+ if (f.target != null && !(!(y instanceof Element) && g(e) && P(e, f)) && !(!y || y === f.target || f.composedPath().includes(y))) {
1337
+ if ("detail" in f && f.detail === 0 && (k = !S(f)), !k) {
1338
+ k = !0;
1314
1339
  return;
1315
1340
  }
1316
1341
  t(f);
1317
1342
  }
1318
1343
  };
1319
- let x = !1;
1320
- const C = [
1321
- Ee(P, "click", (f) => {
1322
- x || (x = !0, setTimeout(() => {
1323
- x = !1;
1324
- }, 0), D(f));
1325
- }, { passive: !0, capture: V }),
1326
- Ee(P, "pointerdown", (f) => {
1327
- const g = Se(e);
1328
- b = !y(f) && !!(g && !f.composedPath().includes(g));
1344
+ let C = !1;
1345
+ const T = [
1346
+ Ee(q, "click", (f) => {
1347
+ C || (C = !0, setTimeout(() => {
1348
+ C = !1;
1349
+ }, 0), E(f));
1350
+ }, { passive: !0, capture: L }),
1351
+ Ee(q, "pointerdown", (f) => {
1352
+ const y = be(e);
1353
+ k = !S(f) && !!(y && !f.composedPath().includes(y));
1329
1354
  }, { passive: !0 }),
1330
- W && Ee(P, "blur", (f) => {
1355
+ V && Ee(q, "blur", (f) => {
1331
1356
  setTimeout(() => {
1332
- var g;
1333
- const F = Se(e);
1334
- ((g = P.document.activeElement) == null ? void 0 : g.tagName) === "IFRAME" && !F?.contains(P.document.activeElement) && t(f);
1357
+ var y;
1358
+ const O = be(e);
1359
+ ((y = q.document.activeElement) == null ? void 0 : y.tagName) === "IFRAME" && !O?.contains(q.document.activeElement) && t(f);
1335
1360
  }, 0);
1336
1361
  }, { passive: !0 })
1337
- ].filter(Boolean), R = () => C.forEach((f) => f());
1338
- return k ? {
1339
- stop: R,
1362
+ ].filter(Boolean), U = () => T.forEach((f) => f());
1363
+ return A ? {
1364
+ stop: U,
1340
1365
  cancel: () => {
1341
- b = !1;
1366
+ k = !1;
1342
1367
  },
1343
1368
  trigger: (f) => {
1344
- b = !0, D(f), b = !1;
1369
+ k = !0, E(f), k = !1;
1345
1370
  }
1346
- } : R;
1371
+ } : U;
1347
1372
  }
1348
- function ze(e) {
1349
- const t = Re(null), c = [
1373
+ function Qe(e) {
1374
+ const t = Re(null), u = [
1350
1375
  ".k-animation-container .k-popup",
1351
1376
  ".k-popup",
1352
1377
  ".k-timepicker-popup",
1353
1378
  ".k-menu-popup"
1354
- ], P = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? c].flat(), T = (w) => w ? typeof e.initialFocus == "string" ? w.querySelector(e.initialFocus) ?? w : typeof e.initialFocus == "function" ? e.initialFocus(w) ?? w : w.querySelector(
1379
+ ], q = Array.isArray(e.popupSelector) ? e.popupSelector : [e.popupSelector ?? u].flat(), I = (g) => g ? typeof e.initialFocus == "string" ? g.querySelector(e.initialFocus) ?? g : typeof e.initialFocus == "function" ? e.initialFocus(g) ?? g : g.querySelector(
1355
1380
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
1356
- ) ?? w : null, { activate: V, deactivate: W } = qe(t, {
1381
+ ) ?? g : null, { activate: L, deactivate: V } = qe(t, {
1357
1382
  escapeDeactivates: !1,
1358
1383
  clickOutsideDeactivates: !1,
1359
1384
  fallbackFocus: () => t.value,
1360
- initialFocus: () => T(t.value),
1385
+ initialFocus: () => I(t.value),
1361
1386
  ...e.focusTrapOptions ?? {}
1362
1387
  });
1363
- let k = null, b = _(null);
1364
- const y = () => {
1388
+ let A = null, k = _(null);
1389
+ const S = () => {
1365
1390
  if (e.resolvePopupEl) return e.resolvePopupEl();
1366
- const w = (D, x) => {
1367
- const C = Array.from(D.querySelectorAll(x));
1368
- if (!C.length) return null;
1369
- const R = C.filter(
1391
+ const g = (E, C) => {
1392
+ const T = Array.from(E.querySelectorAll(C));
1393
+ if (!T.length) return null;
1394
+ const U = T.filter(
1370
1395
  (f) => f.offsetParent !== null || f.getClientRects().length > 0
1371
1396
  );
1372
- return R[R.length - 1] ?? C[C.length - 1] ?? null;
1373
- }, L = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
1374
- for (const D of P) {
1375
- const x = w(L, D);
1376
- if (x) return x;
1397
+ return U[U.length - 1] ?? T[T.length - 1] ?? null;
1398
+ }, P = e.triggerEl?.value?.closest?.(".k-animation-container") ?? document.body;
1399
+ for (const E of q) {
1400
+ const C = g(P, E);
1401
+ if (C) return C;
1377
1402
  }
1378
- for (const D of P) {
1379
- const x = w(document, D);
1380
- if (x) return x;
1403
+ for (const E of q) {
1404
+ const C = g(document, E);
1405
+ if (C) return C;
1381
1406
  }
1382
1407
  return null;
1383
1408
  };
1384
- return Ye(t, (w) => {
1385
- b.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", w);
1409
+ return Ne(t, (g) => {
1410
+ k.value = "outside", e.isOpen.value && e.onRequestClose?.("outside", g);
1386
1411
  }), ve(
1387
1412
  () => e.isOpen.value,
1388
- (w) => {
1389
- w ? (b.value = null, N(() => {
1390
- const L = y();
1391
- L && (t.value = L, setTimeout(() => V(), 0), k || (k = (D) => {
1392
- D.key === "Escape" && (b.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", D));
1393
- }, document.addEventListener("keydown", k, !0)));
1394
- })) : (W(), k && (document.removeEventListener("keydown", k, !0), k = null), t.value = null, b.value === "outside" && N(() => {
1395
- const L = () => {
1396
- const D = e.triggerEl?.value, x = D?.querySelector("input"), C = document.activeElement;
1397
- C && (C === x || D && D.contains(C)) && (x ?? D)?.blur?.();
1413
+ (g) => {
1414
+ g ? (k.value = null, j(() => {
1415
+ const P = S();
1416
+ P && (t.value = P, setTimeout(() => L(), 0), A || (A = (E) => {
1417
+ E.key === "Escape" && (k.value = "escape", e.isOpen.value && e.onRequestClose?.("escape", E));
1418
+ }, document.addEventListener("keydown", A, !0)));
1419
+ })) : (V(), A && (document.removeEventListener("keydown", A, !0), A = null), t.value = null, k.value === "outside" && j(() => {
1420
+ const P = () => {
1421
+ const E = e.triggerEl?.value, C = E?.querySelector("input"), T = document.activeElement;
1422
+ T && (T === C || E && E.contains(T)) && (C ?? E)?.blur?.();
1398
1423
  };
1399
- requestAnimationFrame(() => setTimeout(L, 0));
1400
- }), e.returnFocusToTrigger !== !1 && b.value === "escape" && e.triggerEl?.value && (console.log(
1424
+ requestAnimationFrame(() => setTimeout(P, 0));
1425
+ }), e.returnFocusToTrigger !== !1 && k.value === "escape" && e.triggerEl?.value && (console.log(
1401
1426
  "Returning focus to trigger element:",
1402
1427
  e.triggerEl.value
1403
- ), N(() => {
1404
- const L = () => {
1405
- const D = e.triggerEl?.value;
1406
- if (!D) return;
1407
- (D.querySelector("input") ?? D)?.focus?.();
1428
+ ), j(() => {
1429
+ const P = () => {
1430
+ const E = e.triggerEl?.value;
1431
+ if (!E) return;
1432
+ (E.querySelector("input") ?? E)?.focus?.();
1408
1433
  };
1409
- requestAnimationFrame(() => setTimeout(L, 0));
1434
+ requestAnimationFrame(() => setTimeout(P, 0));
1410
1435
  })));
1411
1436
  }
1412
1437
  ), {
1413
1438
  popupRef: t,
1414
- activate: V,
1415
- deactivate: W,
1416
- lastCloseReason: K(b),
1417
- setPopupEl: (w) => t.value = w
1439
+ activate: L,
1440
+ deactivate: V,
1441
+ lastCloseReason: N(k),
1442
+ setPopupEl: (g) => t.value = g
1418
1443
  };
1419
1444
  }
1445
+ const He = (e) => !!e && typeof e == "object" && "filters" in e && Array.isArray(e.filters), We = (e) => !!e && typeof e == "object" && "field" in e, Ie = (e, t) => !e || typeof e != "object" ? !1 : He(e) ? e.filters.some(
1446
+ (u) => Ie(u, t)
1447
+ ) : We(e) ? e.field === t : !1, Ze = (e) => {
1448
+ const t = _({}), u = (I) => !e.value || !e.value.filters ? !1 : e.value.filters.some(
1449
+ (L) => Ie(L, I)
1450
+ );
1451
+ return {
1452
+ activeClasses: t,
1453
+ hasFieldFilter: u,
1454
+ updateActiveClass: (I) => {
1455
+ const L = u(I);
1456
+ console.log("updateActiveClass for", I, "hasFilter:", L), t.value[I] = L ? "active" : "", console.log("activeClasses after update", t.value);
1457
+ }
1458
+ };
1459
+ };
1420
1460
  export {
1421
- We as useGridA11y,
1422
- _e as useMaskedDateInput,
1423
- Ge as useMaskedDateRangeInput,
1424
- je as useMaskedTimeInput,
1425
- ze as usePopupTrap
1461
+ _e as useGridA11y,
1462
+ Ze as useGridFilter,
1463
+ ze as useMaskedDateInput,
1464
+ Xe as useMaskedDateRangeInput,
1465
+ Je as useMaskedTimeInput,
1466
+ Qe as usePopupTrap
1426
1467
  };