@featherk/composables 0.8.0 → 0.8.2

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