@featherk/composables 0.9.2 → 0.9.5

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