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