@featherk/composables 0.9.7 → 0.10.0

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