@featherk/composables 0.8.2 → 0.9.1

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