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