@aiquants/period-slider 0.10.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,70 +1,70 @@
1
- import { jsx as I, jsxs as Me, Fragment as Zn } from "react/jsx-runtime";
2
- import { addYears as Ii, addMonths as Ci, addDays as bn, format as wr, getDaysInMonth as ua, parseISO as da } from "date-fns";
3
- import { memo as Br, useId as Vi, useRef as k, useMemo as C, useCallback as U, useState as ye, useEffect as lt, useLayoutEffect as Vr } from "react";
4
- const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
1
+ import { jsx as $, jsxs as we, Fragment as eo } from "react/jsx-runtime";
2
+ import { addYears as Yi, addMonths as Oi, addDays as vn, format as wr, getDaysInMonth as ba, parseISO as wa } from "date-fns";
3
+ import { memo as Ur, useId as Hi, useRef as V, useMemo as E, useCallback as z, useState as Pe, useEffect as it, useLayoutEffect as Nr } from "react";
4
+ const va = 120, to = "data-drag-snap", ro = "--ps-drag-snap-duration", _r = {
5
5
  flat: ["--ps-drag-low", "--ps-drag-high"],
6
6
  macro: ["--ps-drag-macro-low", "--ps-drag-macro-high"],
7
7
  micro: ["--ps-drag-micro-low", "--ps-drag-micro-high"]
8
- }, Va = ["low", "high"], Na = ["tx", "ty", "rot"], Ln = {
8
+ }, _a = ["low", "high"], za = ["tx", "ty", "rot"], yn = {
9
9
  flat: { low: "--ps-drag-label-low", high: "--ps-drag-label-high" },
10
10
  macro: { low: "--ps-drag-macro-label-low", high: "--ps-drag-macro-label-high" },
11
11
  micro: { low: "--ps-drag-micro-label-low", high: "--ps-drag-micro-label-high" }
12
- }, mo = (e, t) => `${e}-${t}`, eo = (e, t, r) => `var(${mo(e, t)}, ${r})`, Ni = (e, t, r) => {
13
- const n = Ln[t];
14
- for (const o of Va)
15
- for (const i of Na) e.style.setProperty(mo(n[o], i), r[o][i]);
16
- }, ka = (e) => Math.max(0, Math.min(1, e)), wn = (e, t, r, n) => {
17
- const o = ka(t);
12
+ }, ho = (e, t) => `${e}-${t}`, no = (e, t, r) => `var(${ho(e, t)}, ${r})`, Fi = (e, t, r) => {
13
+ const n = yn[t];
14
+ for (const o of _a)
15
+ for (const i of za) e.style.setProperty(ho(n[o], i), r[o][i]);
16
+ }, Ba = (e) => Math.max(0, Math.min(1, e)), pn = (e, t, r, n) => {
17
+ const o = Ba(t);
18
18
  if (e === "point") return [o, o];
19
19
  const i = e === "low" ? n : r;
20
20
  return [Math.min(o, i), Math.max(o, i)];
21
- }, fo = (e, t, r) => {
21
+ }, bo = (e, t, r) => {
22
22
  const n = r - t, o = Math.max(0, Math.min(1 - n, t + e));
23
23
  return [o, o + n];
24
- }, go = (e, t, r, n) => {
25
- const o = ka(t);
24
+ }, wo = (e, t, r, n) => {
25
+ const o = Ba(t);
26
26
  return e === "low" ? o > n ? "high" : "low" : o < r ? "low" : "high";
27
- }, to = (e, t, r, n) => {
27
+ }, oo = (e, t, r, n) => {
28
28
  if (r) {
29
- const l = (1 - e) * 100, c = (1 - t) * 100;
30
- return n ? `M 12 ${c} L 12 ${l} L 20 100 L 20 0 Z` : `M 12 0 L 12 100 L 20 ${l} L 20 ${c} Z`;
29
+ const l = (1 - e) * 100, s = (1 - t) * 100;
30
+ return n ? `M 12 ${s} L 12 ${l} L 20 100 L 20 0 Z` : `M 12 0 L 12 100 L 20 ${l} L 20 ${s} Z`;
31
31
  }
32
32
  const o = e * 100, i = t * 100;
33
33
  return n ? `M ${o} 12 L ${i} 12 L 100 20 L 0 20 Z` : `M 0 12 L 100 12 L ${i} 20 L ${o} 20 Z`;
34
- }, It = (e, t) => `var(${e}, ${t}%)`, ki = (e, t, r, n) => {
35
- const [o, i] = Fr[t];
34
+ }, Vt = (e, t) => `var(${e}, ${t}%)`, _i = (e, t, r, n) => {
35
+ const [o, i] = _r[t];
36
36
  e.style.setProperty(o, `${r * 100}%`), e.style.setProperty(i, `${n * 100}%`);
37
- }, Yi = (e) => {
38
- for (const [t, r] of Object.values(Fr))
37
+ }, zi = (e) => {
38
+ for (const [t, r] of Object.values(_r))
39
39
  e.style.removeProperty(t), e.style.removeProperty(r);
40
- for (const t of Object.values(Ln))
41
- for (const r of Va)
42
- for (const n of Na) e.style.removeProperty(mo(t[r], n));
43
- }, ro = (e, t) => e !== null && t !== null && "nodeType" in t && e.contains(t), fa = /* @__PURE__ */ new Set(["hidden", "clip", "scroll", "auto", "overlay"]), ga = ["paint", "strict", "content"], Oi = ["layout", "paint", "strict", "content"], Hi = ["transform", "perspective", "filter"], Nr = (e) => e !== void 0 && e !== "" && e !== "none", Fi = (e) => e !== void 0 && e !== "" && e !== "normal", cn = (e) => {
40
+ for (const t of Object.values(yn))
41
+ for (const r of _a)
42
+ for (const n of za) e.style.removeProperty(ho(t[r], n));
43
+ }, ao = (e, t) => e !== null && t !== null && "nodeType" in t && e.contains(t), pa = /* @__PURE__ */ new Set(["hidden", "clip", "scroll", "auto", "overlay"]), Da = ["paint", "strict", "content"], Bi = ["layout", "paint", "strict", "content"], Ui = ["transform", "perspective", "filter"], kr = (e) => e !== void 0 && e !== "" && e !== "none", Wi = (e) => e !== void 0 && e !== "" && e !== "normal", dn = (e) => {
44
44
  const t = Number.parseFloat(e ?? "");
45
45
  return Number.isFinite(t) ? t : 0;
46
- }, _i = (e) => e.position === "fixed" ? "fixed" : e.position === "absolute" ? "absolute" : null, zi = (e, t) => t === "absolute" && Nr(e.position) && e.position !== "static" || Nr(e.transform) || Nr(e.perspective) || Nr(e.filter) || Nr(e.backdropFilter) || Fi(e.containerType) || Oi.some((r) => e.contain.includes(r)) ? !0 : Hi.some((r) => e.willChange.includes(r)), Bi = (e, t, r, n, o, i) => {
46
+ }, Gi = (e) => e.position === "fixed" ? "fixed" : e.position === "absolute" ? "absolute" : null, Xi = (e, t) => t === "absolute" && kr(e.position) && e.position !== "static" || kr(e.transform) || kr(e.perspective) || kr(e.filter) || kr(e.backdropFilter) || Wi(e.containerType) || Bi.some((r) => e.contain.includes(r)) ? !0 : Ui.some((r) => e.willChange.includes(r)), Ki = (e, t, r, n, o, i) => {
47
47
  const l = t.ownerDocument.defaultView;
48
48
  if (l === null) return !1;
49
- const c = e.getBoundingClientRect();
50
- if (c.width === 0 || c.height === 0) return !1;
51
- const f = n ? 0 : r, g = n ? r : 0;
52
- if (o < c.left - f || o >= c.right + f || i < c.top - g || i >= c.bottom + g) return !1;
49
+ const s = e.getBoundingClientRect();
50
+ if (s.width === 0 || s.height === 0) return !1;
51
+ const g = n ? 0 : r, h = n ? r : 0;
52
+ if (o < s.left - g || o >= s.right + g || i < s.top - h || i >= s.bottom + h) return !1;
53
53
  const D = l.getComputedStyle(t);
54
54
  if (D.visibility !== "visible") return !1;
55
- let L = null;
56
- for (let s = t; s !== null; s = s.parentElement) {
57
- const x = s === t ? D : l.getComputedStyle(s);
58
- if (L !== null && !zi(x, L)) continue;
59
- const Z = fa.has(x.overflowX) || ga.some((R) => x.contain.includes(R)), ee = fa.has(x.overflowY) || ga.some((R) => x.contain.includes(R));
55
+ let R = null;
56
+ for (let c = t; c !== null; c = c.parentElement) {
57
+ const M = c === t ? D : l.getComputedStyle(c);
58
+ if (R !== null && !Xi(M, R)) continue;
59
+ const Z = pa.has(M.overflowX) || Da.some((x) => M.contain.includes(x)), ee = pa.has(M.overflowY) || Da.some((x) => M.contain.includes(x));
60
60
  if (Z || ee) {
61
- const R = s.getBoundingClientRect();
62
- if (Z && (o < R.left + cn(x.borderLeftWidth) || o >= R.right - cn(x.borderRightWidth)) || ee && (i < R.top + cn(x.borderTopWidth) || i >= R.bottom - cn(x.borderBottomWidth))) return !1;
61
+ const x = c.getBoundingClientRect();
62
+ if (Z && (o < x.left + dn(M.borderLeftWidth) || o >= x.right - dn(M.borderRightWidth)) || ee && (i < x.top + dn(M.borderTopWidth) || i >= x.bottom - dn(M.borderBottomWidth))) return !1;
63
63
  }
64
- L = _i(x);
64
+ R = Gi(M);
65
65
  }
66
66
  return !0;
67
- }, no = /* @__PURE__ */ new Map(), Ui = (e, t) => {
67
+ }, io = /* @__PURE__ */ new Map(), ji = (e, t) => {
68
68
  if (!(t.shiftKey && t.cancelable)) return;
69
69
  for (const o of e)
70
70
  if (o.ownsHit(t.target)) {
@@ -77,36 +77,36 @@ const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
77
77
  i === null || i >= n || (r = o, n = i);
78
78
  }
79
79
  r?.step(t);
80
- }, Wi = (e, t) => {
81
- let r = no.get(e);
80
+ }, qi = (e, t) => {
81
+ let r = io.get(e);
82
82
  if (r === void 0) {
83
- const i = /* @__PURE__ */ new Set(), l = (c) => Ui(i, c);
84
- r = { participants: i, listener: l }, no.set(e, r), e.addEventListener("wheel", l, { passive: !1, capture: !0 });
83
+ const i = /* @__PURE__ */ new Set(), l = (s) => ji(i, s);
84
+ r = { participants: i, listener: l }, io.set(e, r), e.addEventListener("wheel", l, { passive: !1, capture: !0 });
85
85
  }
86
86
  const { participants: n, listener: o } = r;
87
87
  return n.add(t), () => {
88
- n.delete(t), !(n.size > 0) && (no.delete(e), e.removeEventListener("wheel", o, { capture: !0 }));
88
+ n.delete(t), !(n.size > 0) && (io.delete(e), e.removeEventListener("wheel", o, { capture: !0 }));
89
89
  };
90
- }, zr = "gap-[11px]", gt = 6, ht = gt * 2, Ct = gt * 4 / 3, Gi = {
91
- left: `0,${ht / 2} ${gt},0 ${gt},${ht}`,
92
- right: `${Ct},${ht / 2} ${Ct - gt},0 ${Ct - gt},${ht}`,
93
- up: `${ht / 2},0 0,${gt} ${ht},${gt}`,
94
- down: `${ht / 2},${Ct} 0,${Ct - gt} ${ht},${Ct - gt}`
95
- }, oo = (e) => {
90
+ }, Br = "gap-[11px]", mt = 6, ft = mt * 2, Nt = mt * 4 / 3, Zi = {
91
+ left: `0,${ft / 2} ${mt},0 ${mt},${ft}`,
92
+ right: `${Nt},${ft / 2} ${Nt - mt},0 ${Nt - mt},${ft}`,
93
+ up: `${ft / 2},0 0,${mt} ${ft},${mt}`,
94
+ down: `${ft / 2},${Nt} 0,${Nt - mt} ${ft},${Nt - mt}`
95
+ }, lo = (e) => {
96
96
  e.preventDefault(), e.stopPropagation();
97
- }, Xi = {
98
- onMouseDownCapture: oo,
99
- onMouseUpCapture: oo,
100
- onClickCapture: oo
101
- }, Ki = "period-slider-step", ji = `${Ki} relative inline-flex size-[22px] shrink-0 items-center justify-center rounded-md after:absolute after:content-['']`, qi = "transition-colors motion-reduce:transition-none not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 dark:focus-visible:ring-blue-400 forced-colors:not-aria-disabled:hover:text-[Highlight] forced-colors:aria-disabled:text-[GrayText]", Zi = {
97
+ }, Ji = {
98
+ onMouseDownCapture: lo,
99
+ onMouseUpCapture: lo,
100
+ onClickCapture: lo
101
+ }, Qi = "period-slider-step", el = `${Qi} relative inline-flex size-[22px] shrink-0 items-center justify-center rounded-md after:absolute after:content-['']`, tl = "transition-colors motion-reduce:transition-none not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 dark:focus-visible:ring-blue-400 forced-colors:not-aria-disabled:hover:text-[Highlight] forced-colors:aria-disabled:text-[GrayText]", rl = {
102
102
  control: "text-slate-500 not-aria-disabled:hover:bg-slate-500/15 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-500/25 aria-disabled:text-slate-500/40 dark:text-slate-400 dark:not-aria-disabled:hover:text-slate-50 dark:aria-disabled:text-slate-400/40",
103
103
  rail: "border border-slate-300 bg-white text-slate-700 shadow-2xs not-aria-disabled:hover:border-slate-400 not-aria-disabled:hover:bg-slate-100 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-200 aria-disabled:border-slate-300/40 aria-disabled:bg-white/40 aria-disabled:text-slate-700/40 aria-disabled:shadow-none dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:not-aria-disabled:hover:border-slate-500 dark:not-aria-disabled:hover:bg-slate-700 dark:not-aria-disabled:hover:text-white dark:not-aria-disabled:active:bg-slate-600 dark:aria-disabled:border-slate-700/40 dark:aria-disabled:bg-slate-800/40 dark:aria-disabled:text-slate-200/40"
104
- }, un = "after:inset-[calc((100%-var(--ps-target-size))/2)]", ha = { horizontal: "px-[19px]", vertical: "py-[19px]" }, Ji = {
104
+ }, mn = "after:inset-[calc((100%-var(--ps-target-size))/2)]", Ma = { horizontal: "px-[19px]", vertical: "py-[19px]" }, nl = {
105
105
  control: {
106
- left: un,
107
- right: un,
108
- up: un,
109
- down: un
106
+ left: mn,
107
+ right: mn,
108
+ up: mn,
109
+ down: mn
110
110
  },
111
111
  rail: {
112
112
  left: "after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:left-[calc(100%-var(--ps-target-size)+4px)] after:-right-[4px]",
@@ -114,23 +114,23 @@ const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
114
114
  up: "after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-[calc(100%-var(--ps-target-size)+4px)] after:-bottom-[4px]",
115
115
  down: "after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-[4px] after:bottom-[calc(100%-var(--ps-target-size)+4px)]"
116
116
  }
117
- }, Wt = ({ direction: e, neighbour: t, disabled: r, canStep: n, onStep: o, ariaLabel: i, className: l, ref: c }) => {
118
- const f = e === "up" || e === "down", g = f ? ht : Ct, D = f ? Ct : ht, L = r || !n;
119
- return /* @__PURE__ */ I(
117
+ }, Xt = ({ direction: e, neighbour: t, disabled: r, canStep: n, onStep: o, ariaLabel: i, className: l, ref: s }) => {
118
+ const g = e === "up" || e === "down", h = g ? ft : Nt, D = g ? Nt : ft, R = r || !n;
119
+ return /* @__PURE__ */ $(
120
120
  "button",
121
121
  {
122
- ref: c,
122
+ ref: s,
123
123
  type: "button",
124
124
  "aria-label": i,
125
125
  disabled: r,
126
- "aria-disabled": L ? !0 : void 0,
127
- ...L ? Xi : null,
128
- onClick: L ? void 0 : o,
129
- className: `${l === void 0 ? "" : `${l} `}${ji} ${qi} ${Zi[t]} ${Ji[t][e]}`,
130
- children: /* @__PURE__ */ I("svg", { "aria-hidden": "true", focusable: "false", "data-arrow": e, width: g, height: D, viewBox: `0 0 ${g} ${D}`, fill: "currentColor", className: "pointer-events-none block shrink-0", children: /* @__PURE__ */ I("polygon", { points: Gi[e] }) })
126
+ "aria-disabled": R ? !0 : void 0,
127
+ ...R ? Ji : null,
128
+ onClick: R ? void 0 : o,
129
+ className: `${l === void 0 ? "" : `${l} `}${el} ${tl} ${rl[t]} ${nl[t][e]}`,
130
+ children: /* @__PURE__ */ $("svg", { "aria-hidden": "true", focusable: "false", "data-arrow": e, width: h, height: D, viewBox: `0 0 ${h} ${D}`, fill: "currentColor", className: "pointer-events-none block shrink-0", children: /* @__PURE__ */ $("polygon", { points: Zi[e] }) })
131
131
  }
132
132
  );
133
- }, Qi = {
133
+ }, ol = {
134
134
  "blue-rose": {
135
135
  macro: "#0284c7",
136
136
  macroLight: "#38bdf8",
@@ -173,17 +173,17 @@ const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
173
173
  microLight: "#71717a",
174
174
  accent: "#27272a"
175
175
  }
176
- }, et = (e) => e instanceof Date && !Number.isNaN(e.getTime()), De = (e) => e instanceof Date ? Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString() : String(e), je = (e, t) => {
177
- if (!et(t)) throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${De(t)})`);
176
+ }, tt = (e) => e instanceof Date && !Number.isNaN(e.getTime()), ve = (e) => e instanceof Date ? Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString() : String(e), Ze = (e, t) => {
177
+ if (!tt(t)) throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${ve(t)})`);
178
178
  const r = new Date(t.getTime());
179
179
  return e === "year" ? (r.setMonth(0, 1), r.setHours(0, 0, 0, 0)) : (e === "month" && r.setDate(1), r.setHours(0, 0, 0, 0)), r;
180
180
  }, Q = (e, t) => {
181
- const r = je(e, t), n = r.getFullYear(), o = r.getMonth() + 1, i = r.getDate();
181
+ const r = Ze(e, t), n = r.getFullYear(), o = r.getMonth() + 1, i = r.getDate();
182
182
  if (e === "year") return n;
183
183
  if (e === "month") return n * 12 + (o - 1);
184
184
  const l = /* @__PURE__ */ new Date(0);
185
185
  return l.setUTCFullYear(n, o - 1, i), l.setUTCHours(0, 0, 0, 0), Math.floor(l.getTime() / (1440 * 60 * 1e3));
186
- }, ie = (e, t) => {
186
+ }, le = (e, t) => {
187
187
  const r = /* @__PURE__ */ new Date(0);
188
188
  if (r.setHours(0, 0, 0, 0), e === "year")
189
189
  return r.setFullYear(t, 0, 1), r;
@@ -194,15 +194,15 @@ const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
194
194
  const n = new Date(t * 24 * 60 * 60 * 1e3);
195
195
  return r.setFullYear(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate()), r;
196
196
  }, Oe = (e, t, r) => {
197
- if (!et(t)) throw new RangeError(`addUnit: d must be a valid Date (received: ${De(t)})`);
198
- return e === "year" ? Ii(t, r) : e === "month" ? Ci(t, r) : bn(t, r);
199
- }, el = (e, t, r) => {
200
- if (!et(r)) throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${De(r)})`);
201
- return je(t, je(e, r));
202
- }, tl = (e, t, r) => {
203
- if (!et(r)) throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${De(r)})`);
197
+ if (!tt(t)) throw new RangeError(`addUnit: d must be a valid Date (received: ${ve(t)})`);
198
+ return e === "year" ? Yi(t, r) : e === "month" ? Oi(t, r) : vn(t, r);
199
+ }, al = (e, t, r) => {
200
+ if (!tt(r)) throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${ve(r)})`);
201
+ return Ze(t, Ze(e, r));
202
+ }, il = (e, t, r) => {
203
+ if (!tt(r)) throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${ve(r)})`);
204
204
  if (e === t)
205
- return je(t, r);
205
+ return Ze(t, r);
206
206
  const n = r.getFullYear(), o = r.getMonth();
207
207
  if (e === "year") {
208
208
  if (t === "month")
@@ -210,112 +210,112 @@ const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
210
210
  if (t === "day")
211
211
  return new Date(n, 11, 31);
212
212
  }
213
- return e === "month" && t === "day" ? new Date(n, o + 1, 0) : je(t, r);
214
- }, ba = (e, t, r) => e < t ? t : e > r ? r : e, xt = (e, t, r, n, o) => {
215
- if (_r("macroRange", r, "resolveMacroWindow"), !et(n)) throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${De(n)})`);
216
- if (!et(o)) throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${De(o)})`);
217
- if (o.getTime() < n.getTime()) throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${De(n)}, maxDate: ${De(o)})`);
218
- return [je(t, ba(el(e, t, r[0]), n, o)), je(t, ba(tl(e, t, r[1]), n, o))];
219
- }, rl = {
213
+ return e === "month" && t === "day" ? new Date(n, o + 1, 0) : Ze(t, r);
214
+ }, xa = (e, t, r) => e < t ? t : e > r ? r : e, xt = (e, t, r, n, o) => {
215
+ if (zr("macroRange", r, "resolveMacroWindow"), !tt(n)) throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${ve(n)})`);
216
+ if (!tt(o)) throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${ve(o)})`);
217
+ if (o.getTime() < n.getTime()) throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${ve(n)}, maxDate: ${ve(o)})`);
218
+ return [Ze(t, xa(al(e, t, r[0]), n, o)), Ze(t, xa(il(e, t, r[1]), n, o))];
219
+ }, ll = {
220
220
  year: { year: "numeric" },
221
221
  month: { year: "numeric", month: "2-digit" },
222
222
  day: { year: "numeric", month: "2-digit", day: "2-digit" }
223
- }, wa = /* @__PURE__ */ new Map(), nl = (e, t) => {
224
- const r = `${e}\0${t}`, n = wa.get(r);
223
+ }, Ra = /* @__PURE__ */ new Map(), sl = (e, t) => {
224
+ const r = `${e}\0${t}`, n = Ra.get(r);
225
225
  if (n !== void 0) return n;
226
- const o = new Intl.DateTimeFormat(t, rl[e]);
227
- return wa.set(r, o), o;
228
- }, ol = (e, t) => {
226
+ const o = new Intl.DateTimeFormat(t, ll[e]);
227
+ return Ra.set(r, o), o;
228
+ }, cl = (e, t) => {
229
229
  const r = String(t.getFullYear()).padStart(4, "0");
230
230
  if (e === "year") return r;
231
231
  const n = String(t.getMonth() + 1).padStart(2, "0");
232
232
  if (e === "month") return `${r}-${n}`;
233
233
  const o = String(t.getDate()).padStart(2, "0");
234
234
  return `${r}-${n}-${o}`;
235
- }, Ke = (e, t, r, n) => et(t) ? r ? r(t) : n === void 0 ? ol(e, t) : nl(e, n).format(t) : "", gr = (e, t, r, n) => Ke(e, t, r, n), be = (e, t, r) => {
235
+ }, qe = (e, t, r, n) => tt(t) ? r ? r(t) : n === void 0 ? cl(e, t) : sl(e, n).format(t) : "", gr = (e, t, r, n) => qe(e, t, r, n), ge = (e, t, r) => {
236
236
  if (!e || e.length === 0 || e.length === 1) return 0;
237
237
  const n = Q(r, t);
238
238
  let o = 0, i = e.length - 1;
239
239
  if (n <= Q(r, e[o])) return 0;
240
240
  if (n >= Q(r, e[i])) return i;
241
241
  for (; o <= i; ) {
242
- const f = o + i >> 1, g = Q(r, e[f]);
243
- if (g === n) return f;
244
- g < n ? o = f + 1 : i = f - 1;
242
+ const g = o + i >> 1, h = Q(r, e[g]);
243
+ if (h === n) return g;
244
+ h < n ? o = g + 1 : i = g - 1;
245
245
  }
246
- const l = Math.abs(Q(r, e[o]) - n), c = Math.abs(Q(r, e[i]) - n);
247
- return l < c ? o : i;
248
- }, Vt = (e, t, r, n) => {
246
+ const l = Math.abs(Q(r, e[o]) - n), s = Math.abs(Q(r, e[i]) - n);
247
+ return l < s ? o : i;
248
+ }, kt = (e, t, r, n) => {
249
249
  if (!Array.isArray(e) || e.length === 0) return [];
250
250
  const o = Q(t, r), i = Q(t, n), l = /* @__PURE__ */ new Map();
251
- for (const c of e) {
252
- const f = je(t, c), g = Q(t, f);
253
- g < o || g > i || l.has(g) || l.set(g, f);
251
+ for (const s of e) {
252
+ const g = Ze(t, s), h = Q(t, g);
253
+ h < o || h > i || l.has(h) || l.set(h, g);
254
254
  }
255
255
  if (l.size === 0)
256
- throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${De(r)}, maxDate: ${De(n)}, entries: ${e.length})`);
257
- return Array.from(l.keys()).sort((c, f) => c - f).map((c) => l.get(c));
258
- }, dn = (e, t, r, n) => {
256
+ throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${ve(r)}, maxDate: ${ve(n)}, entries: ${e.length})`);
257
+ return Array.from(l.keys()).sort((s, g) => s - g).map((s) => l.get(s));
258
+ }, fn = (e, t, r, n) => {
259
259
  const o = e.length - 1;
260
260
  if (o <= 0) return 0;
261
- const i = be(e, n, t);
261
+ const i = ge(e, n, t);
262
262
  if (r === "time") {
263
- const l = e[0].getTime(), c = e[o].getTime() - l;
264
- return c <= 0 ? 0 : Math.max(0, Math.min(1, (e[i].getTime() - l) / c));
263
+ const l = e[0].getTime(), s = e[o].getTime() - l;
264
+ return s <= 0 ? 0 : Math.max(0, Math.min(1, (e[i].getTime() - l) / s));
265
265
  }
266
266
  return i / o;
267
- }, mn = (e, t, r, n) => {
267
+ }, gn = (e, t, r, n) => {
268
268
  const o = e.length - 1;
269
269
  if (o <= 0) return 0;
270
270
  const i = Math.max(0, Math.min(1, n));
271
271
  if (r === "time") {
272
- const l = e[0].getTime(), c = e[o].getTime() - l;
273
- return c <= 0 ? 0 : be(e, new Date(l + i * c), t);
272
+ const l = e[0].getTime(), s = e[o].getTime() - l;
273
+ return s <= 0 ? 0 : ge(e, new Date(l + i * s), t);
274
274
  }
275
275
  return Math.max(0, Math.min(o, Math.round(i * o)));
276
- }, va = (e, t, r, n, o, i, l) => {
277
- let c = r, f = n;
278
- return l ? (c = t, f = t) : e === "low" ? t > n ? (c = n, f = t) : c = t : t < r ? (f = r, c = t) : f = t, [Math.max(o, Math.min(i, c)), Math.max(o, Math.min(i, f))];
279
- }, al = ({ posDiffPct: e, startLowVal: t, startHighVal: r, rangeMin: n, rangeMax: o, isDiscrete: i, sortedAllowedDates: l, snapMode: c, unit: f }) => {
276
+ }, La = (e, t, r, n, o, i, l) => {
277
+ let s = r, g = n;
278
+ return l ? (s = t, g = t) : e === "low" ? t > n ? (s = n, g = t) : s = t : t < r ? (g = r, s = t) : g = t, [Math.max(o, Math.min(i, s)), Math.max(o, Math.min(i, g))];
279
+ }, ul = ({ posDiffPct: e, startLowVal: t, startHighVal: r, rangeMin: n, rangeMax: o, isDiscrete: i, sortedAllowedDates: l, snapMode: s, unit: g }) => {
280
280
  if (i) {
281
281
  const Z = l.length - 1;
282
282
  if (Z <= 0) return [0, 0];
283
- const ee = Math.max(0, Math.min(Z, Math.round(t))), R = Math.max(ee, Math.min(Z, Math.round(r)));
284
- if (c === "time") {
285
- const H = l[0].getTime(), W = l[Z].getTime(), ae = l[ee].getTime(), q = l[R].getTime() - ae;
286
- let G = ae + e * (W - H), y = G + q;
287
- G < H && (G = H, y = H + q), y > W && (y = W, G = W - q);
288
- const S = be(l, new Date(G), f), T = be(l, new Date(y), f);
289
- return [S, Math.max(S, T)];
283
+ const ee = Math.max(0, Math.min(Z, Math.round(t))), x = Math.max(ee, Math.min(Z, Math.round(r)));
284
+ if (s === "time") {
285
+ const O = l[0].getTime(), G = l[Z].getTime(), ie = l[ee].getTime(), j = l[x].getTime() - ie;
286
+ let X = ie + e * (G - O), S = X + j;
287
+ X < O && (X = O, S = O + j), S > G && (S = G, X = G - j);
288
+ const L = ge(l, new Date(X), g), y = ge(l, new Date(S), g);
289
+ return [L, Math.max(L, y)];
290
290
  }
291
- const de = Math.round(e * Z);
292
- let oe = ee + de, $ = R + de;
293
- return oe < 0 && ($ += -oe, oe = 0), $ > Z && (oe -= $ - Z, $ = Z), [Math.max(0, Math.min(Z, oe)), Math.max(0, Math.min(Z, $))];
291
+ const ue = Math.round(e * Z);
292
+ let ne = ee + ue, P = x + ue;
293
+ return ne < 0 && (P += -ne, ne = 0), P > Z && (ne -= P - Z, P = Z), [Math.max(0, Math.min(Z, ne)), Math.max(0, Math.min(Z, P))];
294
294
  }
295
- const g = (Z) => Math.max(n, Math.min(o, Z)), D = o - n;
296
- if (D <= 0) return [g(t), g(r)];
297
- const L = Math.round(e * D);
298
- let s = t + L, x = r + L;
299
- return s < n && (x += n - s, s = n), x > o && (s -= x - o, x = o), [g(s), g(x)];
300
- }, il = (e, t, r, n, o, i, l, c) => {
301
- let f = 0, g = !1, D = !1;
295
+ const h = (Z) => Math.max(n, Math.min(o, Z)), D = o - n;
296
+ if (D <= 0) return [h(t), h(r)];
297
+ const R = Math.round(e * D);
298
+ let c = t + R, M = r + R;
299
+ return c < n && (M += n - c, c = n), M > o && (c -= M - o, M = o), [h(c), h(M)];
300
+ }, dl = (e, t, r, n, o, i, l, s) => {
301
+ let g = 0, h = !1, D = !1;
302
302
  switch (e) {
303
303
  case "ArrowRight":
304
304
  case "ArrowUp":
305
- f = c;
305
+ g = s;
306
306
  break;
307
307
  case "ArrowLeft":
308
308
  case "ArrowDown":
309
- f = -c;
309
+ g = -s;
310
310
  break;
311
311
  case "PageUp":
312
- f = c * 5;
312
+ g = s * 5;
313
313
  break;
314
314
  case "PageDown":
315
- f = -c * 5;
315
+ g = -s * 5;
316
316
  break;
317
317
  case "Home":
318
- g = !0;
318
+ h = !0;
319
319
  break;
320
320
  case "End":
321
321
  D = !0;
@@ -324,16 +324,16 @@ const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
324
324
  return null;
325
325
  }
326
326
  if (l) {
327
- let x = r;
328
- return g ? x = o : D ? x = i : x = Math.max(o, Math.min(i, r + f)), [x, x];
327
+ let M = r;
328
+ return h ? M = o : D ? M = i : M = Math.max(o, Math.min(i, r + g)), [M, M];
329
329
  }
330
- let L = r, s = n;
331
- return t === "low" ? g ? L = o : D ? L = n : L = Math.max(o, Math.min(n, r + f)) : g ? s = r : D ? s = i : s = Math.max(r, Math.min(i, n + f)), [L, s];
332
- }, Ya = 8, Oa = 2, Ha = 16, ll = 12, sl = 90, Fa = (e, t, r) => {
330
+ let R = r, c = n;
331
+ return t === "low" ? h ? R = o : D ? R = n : R = Math.max(o, Math.min(n, r + g)) : h ? c = r : D ? c = i : c = Math.max(r, Math.min(i, n + g)), [R, c];
332
+ }, Ua = 8, Wa = 2, Ga = 16, ml = 12, fl = 90, Xa = (e, t, r) => {
333
333
  const n = r * Math.PI / 180, o = Math.abs(Math.sin(n)), i = Math.abs(Math.cos(n));
334
334
  return { alongPx: (e * i + t * o) / 2, acrossPx: (e * o + t * i) / 2 };
335
- }, ho = (e, t) => {
336
- const r = t?.estimatedHeightPx ?? Ha, o = Ya + (t?.anchorGapY ?? Oa) + r / 2, i = e === "top" ? -o : o;
335
+ }, vo = (e, t) => {
336
+ const r = t?.estimatedHeightPx ?? Ga, o = Ua + (t?.anchorGapY ?? Wa) + r / 2, i = e === "top" ? -o : o;
337
337
  return {
338
338
  lowAngleDeg: 0,
339
339
  highAngleDeg: 0,
@@ -344,230 +344,240 @@ const ma = 120, Jn = "data-drag-snap", Qn = "--ps-drag-snap-duration", Fr = {
344
344
  isSlanted: !1,
345
345
  proximity: 0
346
346
  };
347
- }, _a = (e, t, r, n = "top", o) => {
348
- const i = o?.estimatedWidthPx, l = o?.estimatedHeightPx ?? Ha, c = o?.paddingPx ?? ll, f = o?.maxAngleDeg ?? sl, g = Ya + (o?.anchorGapY ?? Oa), D = ho(n, o);
347
+ }, Ka = (e, t, r, n = "top", o) => {
348
+ const i = o?.estimatedWidthPx, l = o?.estimatedHeightPx ?? Ga, s = o?.paddingPx ?? ml, g = o?.maxAngleDeg ?? fl, h = Ua + (o?.anchorGapY ?? Wa), D = vo(n, o);
349
349
  if (!(Number.isFinite(r) && r > 0) || i === void 0 || !Number.isFinite(i) || i <= 0) return D;
350
- const L = Math.max(0, t - e) / 100 * r, s = i + c;
351
- if (L >= s) return D;
352
- const x = Math.max(0, Math.min(1, (s - L) / s)), ee = x * x * x * (x * (x * 6 - 15) + 10) * f, R = n === "top" ? -ee : ee, de = Fa(i, l, ee), oe = g + de.acrossPx, $ = n === "top" ? -oe : +oe, H = 2 * de.alongPx, W = Math.max(0, (H + c - L) / 2);
350
+ const R = Math.max(0, t - e) / 100 * r, c = i + s;
351
+ if (R >= c) return D;
352
+ const M = Math.max(0, Math.min(1, (c - R) / c)), ee = M * M * M * (M * (M * 6 - 15) + 10) * g, x = n === "top" ? -ee : ee, ue = Xa(i, l, ee), ne = h + ue.acrossPx, P = n === "top" ? -ne : +ne, O = 2 * ue.alongPx, G = Math.max(0, (O + s - R) / 2);
353
353
  return {
354
- lowAngleDeg: R,
355
- highAngleDeg: R,
356
- lowOffsetX: -W,
357
- highOffsetX: W,
358
- lowOffsetY: $,
359
- highOffsetY: $,
360
- isSlanted: x > 1e-3,
361
- proximity: x
354
+ lowAngleDeg: x,
355
+ highAngleDeg: x,
356
+ lowOffsetX: -G,
357
+ highOffsetX: G,
358
+ lowOffsetY: P,
359
+ highOffsetY: P,
360
+ isSlanted: M > 1e-3,
361
+ proximity: M
362
362
  };
363
- }, za = (e) => ({ ...e, lowOffsetX: 0, highOffsetX: 0 }), Ba = (e, t) => {
363
+ }, ja = (e) => ({ ...e, lowOffsetX: 0, highOffsetX: 0 }), qa = (e, t) => {
364
364
  const r = t === "macro-top" || t === "macro-left", n = e < 0;
365
365
  return r && n || !(r || n) ? "macro" : "micro";
366
- }, cl = (e, t, r) => {
366
+ }, gl = (e, t, r) => {
367
367
  const n = Math.abs(e) > Math.abs(t) ? e : t;
368
368
  return !Number.isFinite(n) || n === 0 ? 0 : (r ? n < 0 : n > 0) ? 1 : -1;
369
369
  };
370
- function ul(e, t, r, n, o, i, l = "macro-top", c = 0.05, f = !0, g = "range") {
371
- if (Ba(t, l) === "macro") {
372
- const s = Math.abs(e - r), x = Math.abs(e - n);
373
- return s <= c && s <= x ? "macro-low" : x <= c && x < s ? "macro-high" : f && e >= r && e <= n ? "macro-connect" : s < x ? "macro-low" : "macro-high";
370
+ function hl(e, t, r, n, o, i, l = "macro-top", s = 0.05, g = !0, h = "range") {
371
+ if (qa(t, l) === "macro") {
372
+ const c = Math.abs(e - r), M = Math.abs(e - n);
373
+ return c <= s && c <= M ? "macro-low" : M <= s && M < c ? "macro-high" : g && e >= r && e <= n ? "macro-connect" : c < M ? "macro-low" : "macro-high";
374
374
  }
375
- if (g === "point")
375
+ if (h === "point")
376
376
  return "micro-point";
377
- const D = Math.abs(e - o), L = Math.abs(e - i);
378
- return D <= c && D <= L ? "micro-low" : L <= c && L < D ? "micro-high" : f && e >= o && e <= i ? "micro-connect" : D < L ? "micro-low" : "micro-high";
377
+ const D = Math.abs(e - o), R = Math.abs(e - i);
378
+ return D <= s && D <= R ? "micro-low" : R <= s && R < D ? "micro-high" : g && e >= o && e <= i ? "micro-connect" : D < R ? "micro-low" : "micro-high";
379
379
  }
380
- function dl(e, t, r, n, o) {
380
+ function bl(e, t, r, n, o) {
381
381
  if (e === "macro-connect") {
382
- const [g, D] = fo(t - r, n, o);
383
- return [g, D, "macro-connect"];
382
+ const [h, D] = bo(t - r, n, o);
383
+ return [h, D, "macro-connect"];
384
384
  }
385
- const i = e === "macro-low" ? "low" : "high", [l, c] = wn(i, t, n, o), f = go(i, t, n, o);
386
- return [l, c, f === "low" ? "macro-low" : "macro-high"];
385
+ const i = e === "macro-low" ? "low" : "high", [l, s] = pn(i, t, n, o), g = wo(i, t, n, o);
386
+ return [l, s, g === "low" ? "macro-low" : "macro-high"];
387
387
  }
388
- function ml(e, t, r, n, o) {
388
+ function wl(e, t, r, n, o) {
389
389
  if (e === "micro-point") {
390
- const [g] = wn("point", t, n, o);
391
- return [g, g, "micro-point"];
390
+ const [h] = pn("point", t, n, o);
391
+ return [h, h, "micro-point"];
392
392
  }
393
393
  if (e === "micro-connect") {
394
- const [g, D] = fo(t - r, n, o);
395
- return [g, D, "micro-connect"];
394
+ const [h, D] = bo(t - r, n, o);
395
+ return [h, D, "micro-connect"];
396
396
  }
397
- const i = e === "micro-low" ? "low" : "high", [l, c] = wn(i, t, n, o), f = go(i, t, n, o);
398
- return [l, c, f === "low" ? "micro-low" : "micro-high"];
397
+ const i = e === "micro-low" ? "low" : "high", [l, s] = pn(i, t, n, o), g = wo(i, t, n, o);
398
+ return [l, s, g === "low" ? "micro-low" : "micro-high"];
399
399
  }
400
- const Or = Br(({ type: e, isTop: t = !0, isVertical: r = !1, isLeft: n = !0 }) => {
400
+ const Hr = Ur(({ type: e, isTop: t = !0, isVertical: r = !1, isLeft: n = !0 }) => {
401
401
  let o, i;
402
- return r ? (o = n ? "M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z", i = `period-slider-knob period-slider-knob-svg is-vertical ${n ? "is-semicircle-left" : "is-semicircle-right"}`) : (o = t ? "M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z", i = `period-slider-knob period-slider-knob-svg ${t ? "is-semicircle-top" : "is-semicircle-bottom"}`), /* @__PURE__ */ I("svg", { className: i, width: r ? "8" : "16", height: r ? "16" : "8", viewBox: r ? "0 0 8 16" : "0 0 16 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ I("path", { d: o, className: e === "macro" ? "period-slider-knob-path-macro" : "period-slider-knob-path-micro", shapeRendering: "geometricPrecision", strokeWidth: "1.25" }) });
402
+ return r ? (o = n ? "M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z", i = `period-slider-knob period-slider-knob-svg is-vertical ${n ? "is-semicircle-left" : "is-semicircle-right"}`) : (o = t ? "M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z", i = `period-slider-knob period-slider-knob-svg ${t ? "is-semicircle-top" : "is-semicircle-bottom"}`), /* @__PURE__ */ $("svg", { className: i, width: r ? "8" : "16", height: r ? "16" : "8", viewBox: r ? "0 0 8 16" : "0 0 16 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ $("path", { d: o, className: e === "macro" ? "period-slider-knob-path-macro" : "period-slider-knob-path-micro", shapeRendering: "geometricPrecision", strokeWidth: "1.25" }) });
403
403
  });
404
- Or.displayName = "VernierKnobSvg";
405
- const fl = (e, t) => {
406
- if (!et(e)) throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${De(e)})`);
407
- if (!et(t)) throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${De(t)})`);
404
+ Hr.displayName = "VernierKnobSvg";
405
+ const vl = (e, t) => {
406
+ if (!tt(e)) throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${ve(e)})`);
407
+ if (!tt(t)) throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${ve(t)})`);
408
408
  if (t.getTime() <= e.getTime())
409
- throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${De(e)}, maxDate: ${De(t)})`);
410
- }, _r = (e, t, r = "PeriodSlider") => {
409
+ throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${ve(e)}, maxDate: ${ve(t)})`);
410
+ }, zr = (e, t, r = "PeriodSlider") => {
411
411
  if (!Array.isArray(t) || t.length !== 2)
412
- throw new RangeError(`${r}: ${e} is required and must be a [start, end] Date tuple (received: ${De(t)})`);
412
+ throw new RangeError(`${r}: ${e} is required and must be a [start, end] Date tuple (received: ${ve(t)})`);
413
413
  const [n, o] = t;
414
- if (!et(n)) throw new RangeError(`${r}: ${e}[0] must be a valid Date (received: ${De(n)})`);
415
- if (!et(o)) throw new RangeError(`${r}: ${e}[1] must be a valid Date (received: ${De(o)})`);
414
+ if (!tt(n)) throw new RangeError(`${r}: ${e}[0] must be a valid Date (received: ${ve(n)})`);
415
+ if (!tt(o)) throw new RangeError(`${r}: ${e}[1] must be a valid Date (received: ${ve(o)})`);
416
416
  if (o.getTime() < n.getTime())
417
- throw new RangeError(`${r}: ${e} must not be inverted (start: ${De(n)}, end: ${De(o)})`);
418
- }, uo = (e, t) => {
419
- if (!et(t)) throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${De(t)})`);
420
- }, Dt = (e, t, r, n, o) => {
417
+ throw new RangeError(`${r}: ${e} must not be inverted (start: ${ve(n)}, end: ${ve(o)})`);
418
+ }, go = (e, t) => {
419
+ if (!tt(t)) throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${ve(t)})`);
420
+ }, Mt = (e, t, r, n, o) => {
421
421
  const i = Q(r, t);
422
422
  if (i < Q(r, n) || i > Q(r, o))
423
- throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${De(t)}, minDate: ${De(n)}, maxDate: ${De(o)})`);
424
- }, gl = (e, t, r) => {
423
+ throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${ve(t)}, minDate: ${ve(n)}, maxDate: ${ve(o)})`);
424
+ }, pl = (e, t, r) => {
425
425
  if (e.mode === "range") {
426
426
  for (const n of ["range", "defaultRange"]) {
427
427
  const o = e[n];
428
- o !== void 0 && (_r(n, o), Dt(`${n}[0]`, o[0], e.unit, t, r), Dt(`${n}[1]`, o[1], e.unit, t, r));
428
+ o !== void 0 && (zr(n, o), Mt(`${n}[0]`, o[0], e.unit, t, r), Mt(`${n}[1]`, o[1], e.unit, t, r));
429
429
  }
430
430
  return;
431
431
  }
432
432
  if (e.mode === "point")
433
433
  for (const n of ["value", "defaultValue"]) {
434
434
  const o = e[n];
435
- o !== void 0 && (uo(n, o), Dt(n, o, e.unit, t, r));
435
+ o !== void 0 && (go(n, o), Mt(n, o, e.unit, t, r));
436
436
  }
437
- }, hl = (e, t, r) => {
438
- _r("macroRange", e.macroRange);
437
+ }, Dl = (e, t, r) => {
438
+ zr("macroRange", e.macroRange);
439
439
  const n = e.microUnit ?? e.unit, o = e.microRange !== void 0 || e.defaultMicroRange !== void 0 || e.onChangeMicroRange !== void 0, i = e.microValue !== void 0 || e.defaultMicroValue !== void 0 || e.onChangeMicroPoint !== void 0;
440
440
  if (o && i)
441
441
  throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");
442
442
  if (i) {
443
443
  if (e.microValue !== void 0)
444
- return uo("microValue", e.microValue), Dt("microValue", e.microValue, n, t, r), { shape: "point", selection: [e.microValue, e.microValue] };
444
+ return go("microValue", e.microValue), Mt("microValue", e.microValue, n, t, r), { shape: "point", selection: [e.microValue, e.microValue] };
445
445
  if (e.defaultMicroValue !== void 0)
446
- return uo("defaultMicroValue", e.defaultMicroValue), Dt("defaultMicroValue", e.defaultMicroValue, n, t, r), { shape: "point", selection: [e.defaultMicroValue, e.defaultMicroValue] };
446
+ return go("defaultMicroValue", e.defaultMicroValue), Mt("defaultMicroValue", e.defaultMicroValue, n, t, r), { shape: "point", selection: [e.defaultMicroValue, e.defaultMicroValue] };
447
447
  throw new RangeError("PeriodSlider: vernier point mode requires a micro selection; supply microValue (controlled) or defaultMicroValue (uncontrolled)");
448
448
  }
449
449
  if (e.microRange !== void 0)
450
- return _r("microRange", e.microRange), Dt("microRange[0]", e.microRange[0], n, t, r), Dt("microRange[1]", e.microRange[1], n, t, r), { shape: "range", selection: e.microRange };
450
+ return zr("microRange", e.microRange), Mt("microRange[0]", e.microRange[0], n, t, r), Mt("microRange[1]", e.microRange[1], n, t, r), { shape: "range", selection: e.microRange };
451
451
  if (e.defaultMicroRange !== void 0)
452
- return _r("defaultMicroRange", e.defaultMicroRange), Dt("defaultMicroRange[0]", e.defaultMicroRange[0], n, t, r), Dt("defaultMicroRange[1]", e.defaultMicroRange[1], n, t, r), { shape: "range", selection: e.defaultMicroRange };
452
+ return zr("defaultMicroRange", e.defaultMicroRange), Mt("defaultMicroRange[0]", e.defaultMicroRange[0], n, t, r), Mt("defaultMicroRange[1]", e.defaultMicroRange[1], n, t, r), { shape: "range", selection: e.defaultMicroRange };
453
453
  throw o ? new RangeError("PeriodSlider: vernier range mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)") : new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange / defaultMicroRange for a period, or microValue / defaultMicroValue for a point");
454
- }, kr = (e, t, r, n, o, i, l, c) => {
455
- const f = be(e, n, t), g = be(e, o, t);
456
- return l ? f : c ? g : Math.max(f, Math.min(g, be(e, r, t) + i));
457
- }, ao = (e) => {
454
+ }, Yr = (e, t, r, n, o, i, l, s) => {
455
+ const g = ge(e, n, t), h = ge(e, o, t);
456
+ return l ? g : s ? h : Math.max(g, Math.min(h, ge(e, r, t) + i));
457
+ }, so = (e) => {
458
458
  e.timerId !== null && clearTimeout(e.timerId), e.timerId = null, e.emit = null;
459
- }, bl = (e, t) => {
459
+ }, Sa = () => {
460
+ const [e, t] = Pe(null), r = V(null), n = z((i, l) => {
461
+ const s = r.current;
462
+ if (s !== null && s[0].getTime() === i.getTime() && s[1].getTime() === l.getTime()) return;
463
+ const g = [i, l];
464
+ r.current = g, t(g);
465
+ }, []), o = z(() => {
466
+ r.current !== null && (r.current = null, t(null));
467
+ }, []);
468
+ return { shown: e, show: n, release: o };
469
+ }, Ml = (e, t) => {
460
470
  try {
461
471
  Intl.DateTimeFormat.supportedLocalesOf([t]);
462
472
  } catch {
463
473
  throw new RangeError(`PeriodSlider: ${e} must be a valid BCP 47 language tag (received: ${JSON.stringify(t)})`);
464
474
  }
465
475
  }, hr = () => {
466
- const [e, t] = ye(null), r = k(null), n = U((o) => {
476
+ const [e, t] = Pe(null), r = V(null), n = z((o) => {
467
477
  if (r.current?.disconnect(), r.current = null, o === null) {
468
478
  t(null);
469
479
  return;
470
480
  }
471
481
  if (typeof ResizeObserver > "u") return;
472
482
  const i = new ResizeObserver((l) => {
473
- for (const c of l) {
474
- const f = c.borderBoxSize?.[0];
475
- f !== void 0 && t((g) => g !== null && Math.abs(g.widthPx - f.inlineSize) < 0.5 && Math.abs(g.heightPx - f.blockSize) < 0.5 ? g : { widthPx: f.inlineSize, heightPx: f.blockSize });
483
+ for (const s of l) {
484
+ const g = s.borderBoxSize?.[0];
485
+ g !== void 0 && t((h) => h !== null && Math.abs(h.widthPx - g.inlineSize) < 0.5 && Math.abs(h.heightPx - g.blockSize) < 0.5 ? h : { widthPx: g.inlineSize, heightPx: g.blockSize });
476
486
  }
477
487
  });
478
488
  i.observe(o), r.current = i;
479
489
  }, []);
480
- return lt(
490
+ return it(
481
491
  () => () => {
482
492
  r.current?.disconnect(), r.current = null;
483
493
  },
484
494
  []
485
495
  ), [n, e];
486
- }, io = (e, t) => {
487
- const r = hn(e, t);
496
+ }, co = (e, t) => {
497
+ const r = wn(e, t);
488
498
  return r === null ? void 0 : { estimatedWidthPx: r.widthPx, estimatedHeightPx: r.heightPx };
489
- }, hn = (e, t) => e === null || t === null ? null : { widthPx: Math.max(e.widthPx, t.widthPx), heightPx: Math.max(e.heightPx, t.heightPx) }, wl = (e) => {
499
+ }, wn = (e, t) => e === null || t === null ? null : { widthPx: Math.max(e.widthPx, t.widthPx), heightPx: Math.max(e.heightPx, t.heightPx) }, xl = (e) => {
490
500
  const t = {};
491
501
  let r = 0;
492
502
  for (const o of e) {
493
503
  const { side: i, box: l } = o;
494
504
  if (l === null) continue;
495
- let c;
505
+ let s;
496
506
  if (o.reach === "inline-size")
497
- c = l.widthPx, r = Math.max(r, l.heightPx / 2);
507
+ s = l.widthPx, r = Math.max(r, l.heightPx / 2);
498
508
  else {
499
- const f = Fa(l.widthPx, l.heightPx, o.angleDeg);
500
- c = o.centreOffsetPx === null ? 2 * f.acrossPx : Math.abs(o.centreOffsetPx) + f.acrossPx, r = Math.max(r, f.alongPx + Math.abs(o.alongPushPx));
509
+ const g = Xa(l.widthPx, l.heightPx, o.angleDeg);
510
+ s = o.centreOffsetPx === null ? 2 * g.acrossPx : Math.abs(o.centreOffsetPx) + g.acrossPx, r = Math.max(r, g.alongPx + Math.abs(o.alongPushPx));
501
511
  }
502
- t[`--ps-label-reach-${i}`] = `${Math.ceil(c)}px`;
512
+ t[`--ps-label-reach-${i}`] = `${Math.ceil(s)}px`;
503
513
  }
504
514
  if (Object.keys(t).length === 0) return;
505
515
  const n = Math.ceil(r);
506
516
  return t["--ps-label-reach-main"] = `${n}px`, { style: t, mainPx: n };
507
- }, pa = (e, t, r) => ({
517
+ }, ya = (e, t, r) => ({
508
518
  tx: `calc(-50% + ${e}px)`,
509
519
  ty: `${t}px`,
510
520
  rot: `${r}deg`
511
- }), Ma = (e, t, r) => ({
521
+ }), Ta = (e, t, r) => ({
512
522
  tx: `calc(-50% + ${e}px)`,
513
523
  ty: `calc(-50% + ${t}px)`,
514
524
  rot: `${r}deg`
515
- }), vn = (e, t) => ({
516
- "--ps-tooltip-tx": eo(e, "tx", t.tx),
517
- "--ps-tooltip-ty": eo(e, "ty", t.ty),
518
- "--ps-tooltip-rot": eo(e, "rot", t.rot)
519
- }), lo = (e, t, r, n) => {
520
- const o = ho(n.labelPosition, n.config);
525
+ }), Dn = (e, t) => ({
526
+ "--ps-tooltip-tx": no(e, "tx", t.tx),
527
+ "--ps-tooltip-ty": no(e, "ty", t.ty),
528
+ "--ps-tooltip-rot": no(e, "rot", t.rot)
529
+ }), uo = (e, t, r, n) => {
530
+ const o = vo(n.labelPosition, n.config);
521
531
  if (!n.isSlantable) return { slant: o, lowStyle: void 0, highStyle: void 0, placements: null };
522
- const i = _a(t * 100, r * 100, n.trackLengthPx, n.labelPosition, n.config), l = n.isMerged ? za(i) : i, c = Ln[e], f = {
523
- low: pa(l.lowOffsetX, l.lowOffsetY - o.lowOffsetY, l.lowAngleDeg),
524
- high: pa(l.highOffsetX, l.highOffsetY - o.highOffsetY, l.highAngleDeg)
532
+ const i = Ka(t * 100, r * 100, n.trackLengthPx, n.labelPosition, n.config), l = n.isMerged ? ja(i) : i, s = yn[e], g = {
533
+ low: ya(l.lowOffsetX, l.lowOffsetY - o.lowOffsetY, l.lowAngleDeg),
534
+ high: ya(l.highOffsetX, l.highOffsetY - o.highOffsetY, l.highAngleDeg)
525
535
  };
526
536
  return {
527
537
  slant: l,
528
- lowStyle: vn(c.low, f.low),
529
- highStyle: vn(c.high, f.high),
530
- placements: f
538
+ lowStyle: Dn(s.low, g.low),
539
+ highStyle: Dn(s.high, g.high),
540
+ placements: g
531
541
  };
532
- }, Da = {
542
+ }, Pa = {
533
543
  "--ps-tooltip-origin": "100% 50%",
534
544
  "--ps-tooltip-tx": "0px",
535
545
  "--ps-tooltip-ty": "-50%",
536
546
  "--ps-tooltip-rot": "0deg"
537
- }, xa = (e, t, r) => {
538
- const n = ho(r.labelPosition, r.config);
539
- if (r.isVertical) return { slant: n, lowStyle: Da, highStyle: Da, placements: null };
547
+ }, Aa = (e, t, r) => {
548
+ const n = vo(r.labelPosition, r.config);
549
+ if (r.isVertical) return { slant: n, lowStyle: Pa, highStyle: Pa, placements: null };
540
550
  const o = r.autoSlantLabels && !r.isPointMode;
541
551
  let i = n;
542
552
  if (o) {
543
- const f = _a(e, t, r.trackLengthPx, r.labelPosition, r.config);
544
- i = r.isMerged ? za(f) : f;
553
+ const g = Ka(e, t, r.trackLengthPx, r.labelPosition, r.config);
554
+ i = r.isMerged ? ja(g) : g;
545
555
  }
546
- const l = Ln.flat, c = {
547
- low: Ma(i.lowOffsetX, i.lowOffsetY, i.lowAngleDeg),
548
- high: Ma(i.highOffsetX, i.highOffsetY, i.highAngleDeg)
556
+ const l = yn.flat, s = {
557
+ low: Ta(i.lowOffsetX, i.lowOffsetY, i.lowAngleDeg),
558
+ high: Ta(i.highOffsetX, i.highOffsetY, i.highAngleDeg)
549
559
  };
550
560
  return {
551
561
  slant: i,
552
- lowStyle: { "--ps-tooltip-origin": "50% 50%", ...vn(l.low, c.low) },
553
- highStyle: { "--ps-tooltip-origin": "50% 50%", ...vn(l.high, c.high) },
554
- placements: o ? c : null
562
+ lowStyle: { "--ps-tooltip-origin": "50% 50%", ...Dn(l.low, s.low) },
563
+ highStyle: { "--ps-tooltip-origin": "50% 50%", ...Dn(l.high, s.high) },
564
+ placements: o ? s : null
555
565
  };
556
- }, vl = {
566
+ }, Rl = {
557
567
  horizontal: { decrease: "left", increase: "right" },
558
568
  vertical: { decrease: "down", increase: "up" }
559
- }, pl = {
569
+ }, Ll = {
560
570
  horizontal: { decrease: "period-slider-stepper-prev", increase: "period-slider-stepper-next" },
561
571
  vertical: { decrease: "period-slider-stepper-prev period-slider-stepper-down", increase: "period-slider-stepper-next period-slider-stepper-up" }
562
- }, Ra = { horizontal: "px-[calc(var(--ps-target-size)/2)]", vertical: "py-[calc(var(--ps-target-size)/2)]" }, Ml = {
563
- horizontal: { withSteppers: `grid-cols-[auto_minmax(0,1fr)_auto] ${zr} ${ha.horizontal}`, railOnly: `grid-cols-[minmax(0,1fr)] ${Ra.horizontal}` },
564
- vertical: { withSteppers: `grid-rows-[auto_minmax(0,1fr)_auto] ${zr} ${ha.vertical}`, railOnly: `grid-rows-[minmax(0,1fr)] ${Ra.vertical}` }
565
- }, La = {
572
+ }, $a = { horizontal: "px-[calc(var(--ps-target-size)/2)]", vertical: "py-[calc(var(--ps-target-size)/2)]" }, Sl = {
573
+ horizontal: { withSteppers: `grid-cols-[auto_minmax(0,1fr)_auto] ${Br} ${Ma.horizontal}`, railOnly: `grid-cols-[minmax(0,1fr)] ${$a.horizontal}` },
574
+ vertical: { withSteppers: `grid-rows-[auto_minmax(0,1fr)_auto] ${Br} ${Ma.vertical}`, railOnly: `grid-rows-[minmax(0,1fr)] ${$a.vertical}` }
575
+ }, Ea = {
566
576
  horizontal: { leading: "col-start-1 row-start-1", rail: "col-start-2 row-start-1", railOnly: "col-start-1 row-start-1", trailing: "col-start-3 row-start-1" },
567
577
  vertical: { leading: "col-start-1 row-start-1", rail: "col-start-1 row-start-2", railOnly: "col-start-1 row-start-1", trailing: "col-start-1 row-start-3" }
568
- }, Sa = (e, t) => {
578
+ }, Ia = (e, t) => {
569
579
  e.setPointerCapture(t);
570
- }, Dl = (e) => {
580
+ }, yl = (e) => {
571
581
  const {
572
582
  unit: t,
573
583
  minDate: r,
@@ -575,938 +585,940 @@ const fl = (e, t) => {
575
585
  allowedDates: o,
576
586
  snapMode: i = "index",
577
587
  disabled: l = !1,
578
- className: c = "",
579
- showStepper: f = !0,
580
- tooltipStyle: g = "always",
588
+ className: s = "",
589
+ showStepper: g = !0,
590
+ tooltipStyle: h = "always",
581
591
  labelPosition: D = "top",
582
- autoSlantLabels: L = !0,
583
- isVertical: s = !1,
584
- hideConnectBar: x = !1,
592
+ autoSlantLabels: R = !0,
593
+ isVertical: c = !1,
594
+ hideConnectBar: M = !1,
585
595
  showTicks: Z = !1,
586
596
  colorScheme: ee = "blue-rose",
587
- locale: R,
588
- decreaseAriaLabel: de = "Decrease",
589
- increaseAriaLabel: oe = "Increase"
597
+ locale: x,
598
+ decreaseAriaLabel: ue = "Decrease",
599
+ increaseAriaLabel: ne = "Increase"
590
600
  } = e;
591
- fl(r, n), gl(e, r, n), R !== void 0 && bl("locale", R);
592
- const $ = e.mode === "vernier" ? hl(e, r, n) : null, H = $ !== null && $.shape === "point", W = Qi[ee], ae = Vi(), q = k(e), G = r.getTime(), y = n.getTime(), S = C(() => Vt(o, t, r, n), [o, t, G, y]), T = S.length > 0, { rangeMin: Y, rangeMax: V } = C(() => T ? { rangeMin: 0, rangeMax: S.length - 1 } : { rangeMin: Q(t, r), rangeMax: Q(t, n) }, [T, S, t, G, y]), ne = e.mode === "point", ue = U(
601
+ vl(r, n), pl(e, r, n), x !== void 0 && Ml("locale", x);
602
+ const P = e.mode === "vernier" ? Dl(e, r, n) : null, O = P !== null && P.shape === "point", G = ol[ee], ie = Hi(), j = V(e), X = r.getTime(), S = n.getTime(), L = E(() => kt(o, t, r, n), [o, t, X, S]), y = L.length > 0, { rangeMin: k, rangeMax: I } = E(() => y ? { rangeMin: 0, rangeMax: L.length - 1 } : { rangeMin: Q(t, r), rangeMax: Q(t, n) }, [y, L, t, X, S]), re = e.mode === "point", ce = z(
593
603
  (a) => {
594
- if (T) {
595
- const u = Math.max(0, Math.min(S.length - 1, Math.round(a)));
596
- return S[u];
604
+ if (y) {
605
+ const u = Math.max(0, Math.min(L.length - 1, Math.round(a)));
606
+ return L[u];
597
607
  }
598
- return ie(t, Math.round(a));
608
+ return le(t, Math.round(a));
599
609
  },
600
- [T, S, t]
601
- ), X = U(
610
+ [y, L, t]
611
+ ), K = z(
602
612
  (a) => {
603
- if (a === void 0) return Y;
604
- const u = je(t, a);
605
- return T ? be(S, u, t) : Q(t, u);
613
+ if (a === void 0) return k;
614
+ const u = Ze(t, a);
615
+ return y ? ge(L, u, t) : Q(t, u);
606
616
  },
607
- [T, S, t, Y]
608
- ), [J, z] = ye(() => $ === null ? null : $.selection);
609
- let F = J ?? ($ === null ? null : $.selection);
610
- if (H && F !== null && F[0].getTime() !== F[1].getTime()) {
611
- const a = [F[0], F[0]];
612
- F = a, z(a);
617
+ [y, L, t, k]
618
+ ), [J, B] = Pe(() => P === null ? null : P.selection);
619
+ let H = J ?? (P === null ? null : P.selection);
620
+ if (O && H !== null && H[0].getTime() !== H[1].getTime()) {
621
+ const a = [H[0], H[0]];
622
+ H = a, B(a);
613
623
  }
614
- const fe = e.mode === "vernier" ? e.microValue?.getTime() : void 0, ge = C(() => e.mode !== "vernier" || e.microValue === void 0 ? null : [e.microValue, e.microValue], [e.mode, fe]), le = e.mode !== "vernier" ? null : H ? ge ?? F : e.microRange !== void 0 ? e.microRange : F, ze = e.mode === "range" ? e.range?.[0] ?? e.defaultRange?.[0] : e.mode === "vernier" ? le?.[0] : void 0, Ee = e.mode === "range" ? e.range?.[1] ?? e.defaultRange?.[1] : e.mode === "vernier" ? le?.[1] : void 0, Te = e.mode === "point" ? e.value ?? e.defaultValue : void 0, Pe = e.mode === "point" ? Te?.getTime() : ze?.getTime(), qe = e.mode === "range" ? Ee?.getTime() : Pe, [Be, tt] = C(() => {
624
+ const de = e.mode === "vernier" ? e.microValue?.getTime() : void 0, me = E(() => e.mode !== "vernier" || e.microValue === void 0 ? null : [e.microValue, e.microValue], [e.mode, de]), De = Sa(), Ge = Sa(), Me = e.mode !== "vernier" ? null : O ? me ?? H : e.microRange !== void 0 ? e.microRange : H, pe = Me === null ? null : Ge.shown ?? Me, Le = e.mode === "range" ? e.range?.[0] ?? e.defaultRange?.[0] : e.mode === "vernier" ? pe?.[0] : void 0, He = e.mode === "range" ? e.range?.[1] ?? e.defaultRange?.[1] : e.mode === "vernier" ? pe?.[1] : void 0, Fe = e.mode === "point" ? e.value ?? e.defaultValue : void 0, rt = e.mode === "point" ? Fe?.getTime() : Le?.getTime(), ht = e.mode === "range" ? He?.getTime() : rt, [lt, q] = E(() => {
615
625
  if (e.mode === "point") {
616
- const d = X(Te);
617
- return [d, d];
626
+ const m = K(Fe);
627
+ return [m, m];
618
628
  }
619
- const a = X(ze), u = X(Ee);
629
+ const a = K(Le), u = K(He);
620
630
  return [Math.min(a, u), Math.max(a, u)];
621
- }, [e.mode, Pe, qe, X, Te, ze, Ee]), Ue = e.mode === "point" ? e.value !== void 0 : e.mode === "range" ? e.range !== void 0 : H ? e.microValue !== void 0 : e.microRange !== void 0, [st, K] = ye(() => [Be, tt]), [B, te] = ye(null), [v, O] = ye(null), M = k(null), [j, me] = ye("high"), [we, Ae] = ye(null), [He, rt] = ye(null), ve = B ? B[0] : Ue ? Be : st[0], pe = B ? B[1] : Ue ? tt : st[1], Ur = k([ve, pe]), se = e.mode === "vernier", Nt = e.mode === "vernier" ? e.vernierOrientation ?? (s ? "macro-left" : "macro-top") : "macro-top", A = Nt === "macro-top" || Nt === "macro-left", Gt = e.mode === "vernier" ? e.showVernierProjection ?? !0 : !1, bo = e.mode === "vernier" ? e.showVernierTicks ?? !0 : !1, w = e.mode === "vernier" ? e.showHairline ?? !0 : !1, h = se ? e.macroUnit ?? t : t, b = se ? e.microUnit ?? t : t, kt = se ? e.macroIsDiscrete ?? !1 : T, nt = se ? e.microIsDiscrete ?? !1 : T, ct = se ? e.macroAllowedDates ?? o : o, wo = se ? e.microAllowedDates ?? o : o, Wr = se ? e.formatMacroLabel ?? e.formatLabel : e.formatLabel, Gr = se ? e.formatMicroLabel ?? e.formatLabel : e.formatLabel, Ua = e.mode === "vernier" ? e.macroRange[0].getTime() : void 0, Wa = e.mode === "vernier" ? e.macroRange[1].getTime() : void 0, Ga = ze?.getTime(), Xa = Ee?.getTime(), [We, Xr] = ye(null), Rt = k(null), [Mr, Xt] = ye(() => H ? "micro-point" : "micro-high");
631
+ }, [e.mode, rt, ht, K, Fe, Le, He]), U = e.mode === "point" ? e.value !== void 0 : e.mode === "range" ? e.range !== void 0 : O ? e.microValue !== void 0 : e.microRange !== void 0, [oe, p] = Pe(() => [lt, q]), [N, v] = Pe(null), [Y, he] = Pe(null), be = V(null), [$e, Ie] = Pe("high"), [_e, Rt] = Pe(null), [bt, Wr] = Pe(null), Se = N ? N[0] : U ? lt : oe[0], ye = N ? N[1] : U ? q : oe[1], Gr = V([Se, ye]), ae = e.mode === "vernier", Kt = e.mode === "vernier" ? e.vernierOrientation ?? (c ? "macro-left" : "macro-top") : "macro-top", d = Kt === "macro-top" || Kt === "macro-left", W = e.mode === "vernier" ? e.showVernierProjection ?? !0 : !1, je = e.mode === "vernier" ? e.showVernierTicks ?? !0 : !1, Lt = e.mode === "vernier" ? e.showHairline ?? !0 : !1, F = ae ? e.macroUnit ?? t : t, b = ae ? e.microUnit ?? t : t, An = ae ? e.macroIsDiscrete ?? !1 : y, Dr = ae ? e.microIsDiscrete ?? !1 : y, po = ae ? e.macroAllowedDates ?? o : o, Do = ae ? e.microAllowedDates ?? o : o, Xr = ae ? e.formatMacroLabel ?? e.formatLabel : e.formatLabel, Kr = ae ? e.formatMicroLabel ?? e.formatLabel : e.formatLabel, Za = Le?.getTime(), Ja = He?.getTime(), [Xe, jr] = Pe(null), St = V(null), [Mr, jt] = Pe(() => O ? "micro-point" : "micro-high");
622
632
  let Ne = Mr;
623
- const Tn = H ? Mr === "micro-low" || Mr === "micro-high" || Mr === "micro-connect" ? "micro-point" : null : Mr === "micro-point" ? "micro-high" : null;
624
- Tn !== null && (Ne = Tn, Xt(Tn));
625
- const Ie = C(() => Q(h, r), [G, h]), Ze = C(() => {
626
- const a = Q(h, n);
627
- if (se && a <= Ie)
628
- throw new RangeError(`PeriodSlider: macroUnit "${h}" cannot distinguish minDate from maxDate (minDate: ${De(r)}, maxDate: ${De(n)})`);
633
+ const $n = O ? Mr === "micro-low" || Mr === "micro-high" || Mr === "micro-connect" ? "micro-point" : null : Mr === "micro-point" ? "micro-high" : null;
634
+ $n !== null && (Ne = $n, jt($n));
635
+ const ke = E(() => Q(F, r), [X, F]), st = E(() => {
636
+ const a = Q(F, n);
637
+ if (ae && a <= ke)
638
+ throw new RangeError(`PeriodSlider: macroUnit "${F}" cannot distinguish minDate from maxDate (minDate: ${ve(r)}, maxDate: ${ve(n)})`);
629
639
  return a;
630
- }, [se, G, y, Ie, h]), Le = C(() => se && kt ? Vt(ct, h, r, n) : [], [se, kt, ct, h, G, y]), ke = C(() => e.mode !== "vernier" ? Ie : Math.max(Ie, Math.min(Ze, Q(h, e.macroRange[0]))), [e.mode, Ua, Ie, Ze, h]), Ye = C(() => e.mode !== "vernier" ? Ze : Math.max(Ie, Math.min(Ze, Q(h, e.macroRange[1]))), [e.mode, Wa, Ie, Ze, h]), wt = C(() => ie(h, ke), [h, ke]), Yt = C(() => ie(h, Ye), [h, Ye]), Kr = C(() => e.mode !== "vernier" ? [r, n] : xt(h, b, [wt, Yt], r, n), [e.mode, wt, Yt, h, b, G, y]), xe = C(() => Q(b, Kr[0]), [b, Kr]), $e = C(() => Q(b, Kr[1]), [b, Kr]), vo = C(() => se && nt ? Vt(wo, b, r, n) : [], [se, nt, wo, b, G, y]), Pn = (a, u) => vo.filter((d) => {
631
- const m = Q(b, d);
632
- return m >= a && m <= u;
633
- }), ce = C(() => Pn(xe, $e), [vo, b, xe, $e]), Kt = kt && Le.length > 0, ot = nt && ce.length > 0, Lt = (a, u, d, m) => u.length > 0 ? Q(b, u[be(u, a, b)]) : Math.max(d, Math.min(m, Q(b, a))), jt = ot ? ce : [], Ce = C(() => le === null ? xe : Lt(le[0], jt, xe, $e), [Ga, xe, $e, b, le, jt]), Fe = C(() => le === null ? $e : Lt(le[1], jt, xe, $e), [Xa, xe, $e, b, le, jt]), St = C(() => ie(b, Ce), [b, Ce]), yt = C(() => ie(b, Fe), [b, Fe]), po = !se || le === null ? null : { macroUnit: h, macroLowEnc: ke, macroHighEnc: Ye, microUnit: b, microLowEnc: Q(b, le[0]), microHighEnc: Q(b, le[1]) }, An = k(po), jr = Math.max(1, Ze - Ie), at = Kt ? dn(Le, h, i, wt) : Math.max(0, Math.min(1, (ke - Ie) / jr)), ut = Math.max(at, Kt ? dn(Le, h, i, Yt) : Math.min(1, (Ye - Ie) / jr)), qr = Math.max(1, $e - xe), qt = ot ? dn(ce, b, i, St) : Math.max(0, Math.min(1, (Ce - xe) / qr)), Dr = Math.max(qt, ot ? dn(ce, b, i, yt) : Math.min(1, (Fe - xe) / qr)), $n = k({ timerId: null, emit: null }), Zr = k({ timerId: null, emit: null }), Jr = k({ timerId: null, emit: null });
634
- lt(() => {
635
- const a = [$n, Zr, Jr];
640
+ }, [ae, X, S, ke, F]), Te = E(() => ae && An ? kt(po, F, r, n) : [], [ae, An, po, F, X, S]), Mo = (a) => [Math.max(ke, Math.min(st, Q(F, a[0]))), Math.max(ke, Math.min(st, Q(F, a[1])))], [xo, Ro] = e.mode !== "vernier" ? [ke, st] : Mo(e.macroRange), [ze, Be] = De.shown === null ? [xo, Ro] : Mo(De.shown), wt = E(() => le(F, ze), [F, ze]), Yt = E(() => le(F, Be), [F, Be]), qr = E(() => e.mode !== "vernier" ? [r, n] : xt(F, b, [wt, Yt], r, n), [e.mode, wt, Yt, F, b, X, S]), xe = E(() => Q(b, qr[0]), [b, qr]), Ee = E(() => Q(b, qr[1]), [b, qr]), Lo = E(() => ae && Dr ? kt(Do, b, r, n) : [], [ae, Dr, Do, b, X, S]), En = (a, u) => Lo.filter((m) => {
641
+ const f = Q(b, m);
642
+ return f >= a && f <= u;
643
+ }), se = E(() => En(xe, Ee), [Lo, b, xe, Ee]), qt = An && Te.length > 0, nt = Dr && se.length > 0, yt = (a, u, m, f) => u.length > 0 ? Q(b, u[ge(u, a, b)]) : Math.max(m, Math.min(f, Q(b, a))), Zt = nt ? se : [], Ce = E(() => pe === null ? xe : yt(pe[0], Zt, xe, Ee), [Za, xe, Ee, b, pe, Zt]), Ue = E(() => pe === null ? Ee : yt(pe[1], Zt, xe, Ee), [Ja, xe, Ee, b, pe, Zt]), Tt = E(() => le(b, Ce), [b, Ce]), Pt = E(() => le(b, Ue), [b, Ue]), So = !ae || Me === null ? null : { macroUnit: F, macroLowEnc: xo, macroHighEnc: Ro, microUnit: b, microLowEnc: Q(b, Me[0]), microHighEnc: Q(b, Me[1]) }, In = V(So), Zr = Math.max(1, st - ke), ot = qt ? fn(Te, F, i, wt) : Math.max(0, Math.min(1, (ze - ke) / Zr)), ct = Math.max(ot, qt ? fn(Te, F, i, Yt) : Math.min(1, (Be - ke) / Zr)), Jr = Math.max(1, Ee - xe), Jt = nt ? fn(se, b, i, Tt) : Math.max(0, Math.min(1, (Ce - xe) / Jr)), xr = Math.max(Jt, nt ? fn(se, b, i, Pt) : Math.min(1, (Ue - xe) / Jr)), Cn = V({ timerId: null, emit: null }), Qr = V({ timerId: null, emit: null }), en = V({ timerId: null, emit: null });
644
+ it(() => {
645
+ const a = [Cn, Qr, en];
636
646
  return () => {
637
647
  for (const u of a)
638
- ao(u.current);
648
+ so(u.current);
639
649
  };
640
650
  }, []);
641
- const Zt = U((a, u, d) => {
642
- ao(a);
643
- const { debounceMs: m } = q.current;
644
- if (d || !m || m <= 0) {
651
+ const Qt = z((a, u, m) => {
652
+ so(a);
653
+ const { debounceMs: f } = j.current;
654
+ if (m || !f || f <= 0) {
645
655
  u();
646
656
  return;
647
657
  }
648
658
  a.emit = u, a.timerId = setTimeout(() => {
649
659
  a.timerId = null, a.emit = null, u();
650
- }, m);
651
- }, []), Mo = U((a) => {
660
+ }, f);
661
+ }, []), yo = z((a) => {
652
662
  const u = a.emit;
653
- ao(a), u?.();
654
- }, []), Jt = U((a) => new Date(Math.min(Math.max(a.getTime(), G), y)), [G, y]), Tt = U(
655
- (a, u, d = !1) => {
656
- const [m, p] = Ur.current;
657
- if ((q.current.mode === "point" ? a === m : a === m && u === p) && $n.current.timerId === null)
663
+ so(a), u?.();
664
+ }, []), er = z((a) => new Date(Math.min(Math.max(a.getTime(), X), S)), [X, S]), At = z(
665
+ (a, u, m = !1) => {
666
+ const [f, w] = Gr.current;
667
+ if ((j.current.mode === "point" ? a === f : a === f && u === w) && Cn.current.timerId === null)
658
668
  return;
659
- const N = ue(a), E = ue(u), re = () => {
660
- const he = q.current;
661
- he.mode === "point" ? he.onChangePoint?.(N) : he.mode === "range" && he.onChangeRange?.(N, E);
669
+ const C = ce(a), A = ce(u), te = () => {
670
+ const fe = j.current;
671
+ fe.mode === "point" ? fe.onChangePoint?.(C) : fe.mode === "range" && fe.onChangeRange?.(C, A);
662
672
  };
663
- Zt($n.current, re, d);
673
+ Qt(Cn.current, te, m);
664
674
  },
665
- [ue, Zt]
666
- ), Ot = U(
667
- (a, u, d = !1) => {
668
- const m = An.current;
669
- if (q.current.mode !== "vernier" || m === null) return;
670
- const p = Jt(a), P = Jt(u);
671
- Q(m.macroUnit, p) === m.macroLowEnc && Q(m.macroUnit, P) === m.macroHighEnc && Zr.current.timerId === null || Zt(
672
- Zr.current,
675
+ [ce, Qt]
676
+ ), Ot = z(
677
+ (a, u, m = !1) => {
678
+ const f = In.current;
679
+ if (j.current.mode !== "vernier" || f === null) return;
680
+ const w = er(a), T = er(u);
681
+ Q(f.macroUnit, w) === f.macroLowEnc && Q(f.macroUnit, T) === f.macroHighEnc && Qr.current.timerId === null || Qt(
682
+ Qr.current,
673
683
  () => {
674
- const N = q.current;
675
- N.mode === "vernier" && N.onChangeMacroRange?.(p, P);
684
+ const C = j.current;
685
+ C.mode === "vernier" && C.onChangeMacroRange?.(w, T);
676
686
  },
677
- d
687
+ m
678
688
  );
679
689
  },
680
- [Jt, Zt]
681
- ), Je = U(
682
- (a, u, d = !1) => {
683
- const m = q.current, p = An.current;
684
- if (m.mode !== "vernier" || p === null) return;
685
- const P = Jt(a), N = Jt(u);
686
- Q(p.microUnit, P) === p.microLowEnc && Q(p.microUnit, N) === p.microHighEnc && Jr.current.timerId === null || ((H ? m.microValue === void 0 : m.microRange === void 0) && z([P, N]), Zt(
687
- Jr.current,
690
+ [er, Qt]
691
+ ), Je = z(
692
+ (a, u, m = !1) => {
693
+ const f = j.current, w = In.current;
694
+ if (f.mode !== "vernier" || w === null) return;
695
+ const T = er(a), C = er(u);
696
+ Q(w.microUnit, T) === w.microLowEnc && Q(w.microUnit, C) === w.microHighEnc && en.current.timerId === null || ((O ? f.microValue === void 0 : f.microRange === void 0) && B([T, C]), Qt(
697
+ en.current,
688
698
  () => {
689
- const E = q.current;
690
- if (E.mode === "vernier") {
691
- if (H) {
692
- E.onChangeMicroPoint?.(P);
699
+ const A = j.current;
700
+ if (A.mode === "vernier") {
701
+ if (O) {
702
+ A.onChangeMicroPoint?.(T);
693
703
  return;
694
704
  }
695
- E.onChangeMicroRange?.(P, N);
705
+ A.onChangeMicroRange?.(T, C);
696
706
  }
697
707
  },
698
- d
708
+ m
699
709
  ));
700
710
  },
701
- [Jt, Zt, H]
702
- ), Do = U(
711
+ [er, Qt, O]
712
+ ), To = z(
703
713
  (a, u = !1) => {
704
714
  Je(a, a, u);
705
715
  },
706
716
  [Je]
707
- ), Ht = U(
717
+ ), Ht = z(
708
718
  (a) => {
709
- if (T && i === "time" && S.length > 1) {
710
- const m = Math.max(0, Math.min(S.length - 1, Math.round(a))), p = S[0].getTime(), N = S[S.length - 1].getTime() - p;
711
- if (N <= 0) return 0;
712
- const E = S[m].getTime();
713
- return Math.max(0, Math.min(100, (E - p) / N * 100));
719
+ if (y && i === "time" && L.length > 1) {
720
+ const f = Math.max(0, Math.min(L.length - 1, Math.round(a))), w = L[0].getTime(), C = L[L.length - 1].getTime() - w;
721
+ if (C <= 0) return 0;
722
+ const A = L[f].getTime();
723
+ return Math.max(0, Math.min(100, (A - w) / C * 100));
714
724
  }
715
- const u = V - Y;
725
+ const u = I - k;
716
726
  if (u <= 0) return 0;
717
- const d = (a - Y) / u * 100;
718
- return Math.max(0, Math.min(100, d));
727
+ const m = (a - k) / u * 100;
728
+ return Math.max(0, Math.min(100, m));
719
729
  },
720
- [T, i, S, Y, V]
721
- ), En = U(
730
+ [y, i, L, k, I]
731
+ ), Vn = z(
722
732
  (a) => {
723
733
  const u = Math.max(0, Math.min(100, a));
724
- if (T) {
725
- if (i === "time" && S.length > 1) {
726
- const p = S[0].getTime(), N = S[S.length - 1].getTime() - p, E = p + u / 100 * N;
727
- return be(S, new Date(E), t);
734
+ if (y) {
735
+ if (i === "time" && L.length > 1) {
736
+ const w = L[0].getTime(), C = L[L.length - 1].getTime() - w, A = w + u / 100 * C;
737
+ return ge(L, new Date(A), t);
728
738
  }
729
- const m = Math.round(u / 100 * (S.length - 1));
730
- return Math.max(0, Math.min(S.length - 1, m));
739
+ const f = Math.round(u / 100 * (L.length - 1));
740
+ return Math.max(0, Math.min(L.length - 1, f));
731
741
  }
732
- const d = Y + u / 100 * (V - Y);
733
- return Math.round(d);
742
+ const m = k + u / 100 * (I - k);
743
+ return Math.round(m);
734
744
  },
735
- [T, i, S, Y, V, t]
736
- ), xr = k(null), xo = k(null), Ro = k(0), Ge = k(null), In = k(null), Lo = k(null), So = k(null), [Cn, yo] = ye(0), [Ka, Qt] = hr(), [ja, To] = hr(), [qa, Po] = hr(), [Za, Ao] = hr(), [Ja, Vn] = hr(), [Qa, $o] = hr(), ei = ne ? Qt === null ? void 0 : { estimatedWidthPx: Qt.widthPx, estimatedHeightPx: Qt.heightPx } : io(Qt, To), Nn = !ne && ve === pe, kn = ke === Ye, Yn = !H && Ce === Fe, ti = A ? "top" : "bottom", ri = A ? "bottom" : "top", Eo = L && !s, ni = Eo && !H, On = { isPointMode: ne, isVertical: s, autoSlantLabels: L, isMerged: Nn, trackLengthPx: Cn, labelPosition: D, config: ei }, Hn = { trackLengthPx: Cn, labelPosition: ti, config: io(Po, Ao), isMerged: kn, isSlantable: Eo }, Fn = { trackLengthPx: Cn, labelPosition: ri, config: io(Vn, $o), isMerged: Yn, isSlantable: ni };
737
- lt(() => {
738
- const a = Ge.current;
745
+ [y, i, L, k, I, t]
746
+ ), Rr = V(null), Po = V(null), Ao = V(0), Ke = V(null), Nn = V(null), $o = V(null), Eo = V(null), [kn, Io] = Pe(0), [Qa, tr] = hr(), [ei, Co] = hr(), [ti, Vo] = hr(), [ri, No] = hr(), [ni, Yn] = hr(), [oi, ko] = hr(), ai = re ? tr === null ? void 0 : { estimatedWidthPx: tr.widthPx, estimatedHeightPx: tr.heightPx } : co(tr, Co), On = !re && Se === ye, Hn = ze === Be, Fn = !O && Ce === Ue, ii = d ? "top" : "bottom", li = d ? "bottom" : "top", Yo = R && !c, si = Yo && !O, _n = { isPointMode: re, isVertical: c, autoSlantLabels: R, isMerged: On, trackLengthPx: kn, labelPosition: D, config: ai }, zn = { trackLengthPx: kn, labelPosition: ii, config: co(Vo, No), isMerged: Hn, isSlantable: Yo }, Bn = { trackLengthPx: kn, labelPosition: li, config: co(Yn, ko), isMerged: Fn, isSlantable: si };
747
+ it(() => {
748
+ const a = Ke.current;
739
749
  if (!a) return;
740
750
  const u = () => {
741
- const m = a.getBoundingClientRect(), p = s ? m.height : m.width;
742
- p > 0 && yo((P) => Math.abs(P - p) < 0.5 ? P : p);
751
+ const f = a.getBoundingClientRect(), w = c ? f.height : f.width;
752
+ w > 0 && Io((T) => Math.abs(T - w) < 0.5 ? T : w);
743
753
  };
744
754
  if (u(), typeof ResizeObserver < "u") {
745
- const m = new ResizeObserver((p) => {
746
- for (const P of p) {
747
- const N = s ? P.contentRect.height : P.contentRect.width;
748
- N > 0 && yo((E) => Math.abs(E - N) < 0.5 ? E : N);
755
+ const f = new ResizeObserver((w) => {
756
+ for (const T of w) {
757
+ const C = c ? T.contentRect.height : T.contentRect.width;
758
+ C > 0 && Io((A) => Math.abs(A - C) < 0.5 ? A : C);
749
759
  }
750
760
  });
751
- return m.observe(a), () => m.disconnect();
761
+ return f.observe(a), () => f.disconnect();
752
762
  }
753
- const d = a.ownerDocument.defaultView;
754
- if (d)
755
- return d.addEventListener("resize", u), () => d.removeEventListener("resize", u);
756
- }, [s]);
757
- const er = U(
758
- (a, u, d) => {
759
- const m = s ? d.height : d.width;
760
- if (!(Number.isFinite(m) && m > 0)) return null;
761
- const p = s ? d.bottom - u : a - d.left;
762
- return Number.isFinite(p) ? Math.max(0, Math.min(1, p / m)) : null;
763
+ const m = a.ownerDocument.defaultView;
764
+ if (m)
765
+ return m.addEventListener("resize", u), () => m.removeEventListener("resize", u);
766
+ }, [c]);
767
+ const rr = z(
768
+ (a, u, m) => {
769
+ const f = c ? m.height : m.width;
770
+ if (!(Number.isFinite(f) && f > 0)) return null;
771
+ const w = c ? m.bottom - u : a - m.left;
772
+ return Number.isFinite(w) ? Math.max(0, Math.min(1, w / f)) : null;
763
773
  },
764
- [s]
765
- ), Io = U(
774
+ [c]
775
+ ), Oo = z(
766
776
  (a, u) => {
767
- const d = Ge.current;
768
- if (!d) return null;
769
- const m = er(a, u, d.getBoundingClientRect());
770
- return m === null ? null : m * 100;
777
+ const m = Ke.current;
778
+ if (!m) return null;
779
+ const f = rr(a, u, m.getBoundingClientRect());
780
+ return f === null ? null : f * 100;
771
781
  },
772
- [er]
773
- ), Rr = k(null), vt = k(null), Qr = k({ macroLowRatio: at, macroHighRatio: ut, isVertical: s, isMacroFirstRail: A }), Co = k({ flat: On, macro: Hn, micro: Fn });
774
- Vr(() => {
775
- Qr.current = { macroLowRatio: at, macroHighRatio: ut, isVertical: s, isMacroFirstRail: A }, Co.current = { flat: On, macro: Hn, micro: Fn }, q.current = e, Ur.current = [ve, pe], An.current = po, M.current = v, Rt.current = We;
782
+ [rr]
783
+ ), Lr = V(null), vt = V(null), tn = V({ macroLowRatio: ot, macroHighRatio: ct, isVertical: c, isMacroFirstRail: d }), Ho = V({ flat: _n, macro: zn, micro: Bn });
784
+ Nr(() => {
785
+ tn.current = { macroLowRatio: ot, macroHighRatio: ct, isVertical: c, isMacroFirstRail: d }, Ho.current = { flat: _n, macro: zn, micro: Bn }, j.current = e, Gr.current = [Se, ye], In.current = So, be.current = Y, St.current = Xe;
776
786
  });
777
- const Vo = (a, u) => {
778
- const d = Qr.current;
779
- In.current?.setAttribute("d", to(a, u, d.isVertical, d.isMacroFirstRail));
780
- }, oi = (a, u, d) => {
781
- const m = Co.current;
782
- return a === "flat" ? xa(u * 100, d * 100, m.flat).placements : lo(a, u, d, a === "macro" ? m.macro : m.micro).placements;
783
- }, Lr = (a, u, d) => {
784
- const m = Ge.current;
785
- if (!m) return;
786
- Rr.current = { rail: a, lowRatio: u, highRatio: d }, ki(m, a, u, d);
787
- const p = oi(a, u, d);
788
- p !== null && Ni(m, a, p), a === "macro" && Vo(u, d);
789
- }, Ft = U(() => {
787
+ const Fo = (a, u) => {
788
+ const m = tn.current;
789
+ Nn.current?.setAttribute("d", oo(a, u, m.isVertical, m.isMacroFirstRail));
790
+ }, ci = (a, u, m) => {
791
+ const f = Ho.current;
792
+ return a === "flat" ? Aa(u * 100, m * 100, f.flat).placements : uo(a, u, m, a === "macro" ? f.macro : f.micro).placements;
793
+ }, Sr = (a, u, m) => {
794
+ const f = Ke.current;
795
+ if (!f) return;
796
+ Lr.current = { rail: a, lowRatio: u, highRatio: m }, _i(f, a, u, m);
797
+ const w = ci(a, u, m);
798
+ w !== null && Fi(f, a, w), a === "macro" && Fo(u, m);
799
+ }, Ft = z(() => {
790
800
  vt.current !== null && (clearTimeout(vt.current), vt.current = null);
791
- const a = Ge.current;
792
- a && (a.removeAttribute(Jn), a.style.removeProperty(Qn));
793
- }, []), No = () => {
794
- const a = Ge.current;
795
- if (Rr.current === null || !a) {
796
- Rr.current = null;
801
+ const a = Ke.current;
802
+ a && (a.removeAttribute(to), a.style.removeProperty(ro));
803
+ }, []), _o = () => {
804
+ const a = Ke.current;
805
+ if (Lr.current === null || !a) {
806
+ Lr.current = null;
797
807
  return;
798
808
  }
799
- Rr.current = null, vt.current !== null && clearTimeout(vt.current), a.style.setProperty(Qn, `${ma}ms`), a.setAttribute(Jn, "true"), Yi(a), Vo(Qr.current.macroLowRatio, Qr.current.macroHighRatio), vt.current = setTimeout(() => {
800
- vt.current = null, a.removeAttribute(Jn), a.style.removeProperty(Qn);
801
- }, ma);
809
+ Lr.current = null, vt.current !== null && clearTimeout(vt.current), a.style.setProperty(ro, `${va}ms`), a.setAttribute(to, "true"), zi(a), Fo(tn.current.macroLowRatio, tn.current.macroHighRatio), vt.current = setTimeout(() => {
810
+ vt.current = null, a.removeAttribute(to), a.style.removeProperty(ro);
811
+ }, va);
802
812
  };
803
- Vr(() => {
804
- const a = Rr.current;
805
- a !== null && Lr(a.rail, a.lowRatio, a.highRatio);
806
- }), lt(
813
+ Nr(() => {
814
+ const a = Lr.current;
815
+ a !== null && Sr(a.rail, a.lowRatio, a.highRatio);
816
+ }), it(
807
817
  () => () => {
808
818
  vt.current !== null && clearTimeout(vt.current);
809
819
  },
810
820
  []
811
821
  );
812
- const tr = k(null), rr = k(null), dt = k(null), _n = k(null), Sr = k(null), Pt = U(() => tr.current !== null || rr.current !== null, []), ko = (a) => {
822
+ const nr = V(null), or = V(null), ut = V(null), Un = V(null), yr = V(null), $t = z(() => nr.current !== null || or.current !== null, []), zo = (a) => {
813
823
  if (l) return;
814
- if (se) {
815
- const _ = rr.current;
816
- if (!_ || a.pointerId !== _.pointerId || !Ge.current) return;
817
- const it = er(a.clientX, a.clientY, Ge.current.getBoundingClientRect());
818
- if (it === null) return;
824
+ if (ae) {
825
+ const _ = or.current;
826
+ if (!_ || a.pointerId !== _.pointerId || !Ke.current) return;
827
+ const at = rr(a.clientX, a.clientY, Ke.current.getBoundingClientRect());
828
+ if (at === null) return;
819
829
  if (_.handle === "macro-low" || _.handle === "macro-high" || _.handle === "macro-connect") {
820
- const [Ve, Se, pt] = dl(_.handle, it, _.startPointerRatio, _.startMacroLowRatio, _.startMacroHighRatio);
821
- Lr("macro", Ve, Se), pt !== Rt.current && (Rt.current = pt, Xr(pt), Xt(pt));
822
- let Xe, ft;
823
- if (Kt) {
824
- const At = mn(Le, h, i, Ve), $t = Math.max(At, mn(Le, h, i, Se));
825
- Xe = Le[At], ft = Le[$t];
830
+ const [Ve, Ae, pt] = bl(_.handle, at, _.startPointerRatio, _.startMacroLowRatio, _.startMacroHighRatio);
831
+ Sr("macro", Ve, Ae), pt !== St.current && (St.current = pt, jr(pt), jt(pt));
832
+ let Ye, Qe;
833
+ if (qt) {
834
+ const Et = gn(Te, F, i, Ve), It = Math.max(Et, gn(Te, F, i, Ae));
835
+ Ye = Te[Et], Qe = Te[It];
826
836
  } else {
827
- const At = Math.round(Ie + Ve * jr), $t = Math.round(Ie + Se * jr);
828
- Xe = ie(h, At), ft = ie(h, $t);
837
+ const Et = Math.round(ke + Ve * Zr), It = Math.round(ke + Ae * Zr);
838
+ Ye = le(F, Et), Qe = le(F, It);
829
839
  }
830
- const $r = `${Xe.getTime()}_${ft.getTime()}`;
831
- $r !== _n.current && (_n.current = $r, Ot(Xe, ft));
832
- const [Mt, zt] = xt(h, b, [Xe, ft], r, n), jn = Q(b, Mt), qn = Q(b, zt), ia = nt ? Pn(jn, qn) : [];
833
- let cr, ur;
840
+ De.show(Ye, Qe);
841
+ const Er = `${Ye.getTime()}_${Qe.getTime()}`;
842
+ Er !== Un.current && (Un.current = Er, Ot(Ye, Qe));
843
+ const [Dt, zt] = xt(F, b, [Ye, Qe], r, n), Jn = Q(b, Dt), Qn = Q(b, zt), ma = Dr ? En(Jn, Qn) : [];
844
+ let Bt, Ut;
834
845
  if (_.handle === "macro-connect") {
835
- const At = Mt, $t = zt;
846
+ const Et = Dt, It = zt;
836
847
  let dr, mr;
837
- if (h === "year") {
838
- const Et = Xe.getFullYear() - _.startMacroLowDate.getFullYear();
839
- dr = Oe("year", _.initialMicroLowDate, Et), mr = Oe("year", _.initialMicroHighDate, Et);
840
- } else if (h === "month") {
841
- const Et = (Xe.getFullYear() - _.startMacroLowDate.getFullYear()) * 12 + (Xe.getMonth() - _.startMacroLowDate.getMonth());
842
- dr = Oe("month", _.initialMicroLowDate, Et), mr = Oe("month", _.initialMicroHighDate, Et);
848
+ if (F === "year") {
849
+ const Ct = Ye.getFullYear() - _.startMacroLowDate.getFullYear();
850
+ dr = Oe("year", _.initialMicroLowDate, Ct), mr = Oe("year", _.initialMicroHighDate, Ct);
851
+ } else if (F === "month") {
852
+ const Ct = (Ye.getFullYear() - _.startMacroLowDate.getFullYear()) * 12 + (Ye.getMonth() - _.startMacroLowDate.getMonth());
853
+ dr = Oe("month", _.initialMicroLowDate, Ct), mr = Oe("month", _.initialMicroHighDate, Ct);
843
854
  } else {
844
- const Et = Math.round((Xe.getTime() - _.startMacroLowDate.getTime()) / 864e5);
845
- dr = Oe("day", _.initialMicroLowDate, Et), mr = Oe("day", _.initialMicroHighDate, Et);
855
+ const Ct = Math.round((Ye.getTime() - _.startMacroLowDate.getTime()) / 864e5);
856
+ dr = Oe("day", _.initialMicroLowDate, Ct), mr = Oe("day", _.initialMicroHighDate, Ct);
846
857
  }
847
- const fr = At.getTime(), Er = $t.getTime(), ca = _.initialMicroHighDate.getTime() - _.initialMicroLowDate.getTime();
848
- let Ir = dr.getTime(), Cr = mr.getTime();
849
- Ir < fr && (Ir = fr, Cr = Math.min(Er, Ir + ca)), Cr > Er && (Cr = Er, Ir = Math.max(fr, Cr - ca)), cr = je(b, new Date(Ir)), ur = je(b, new Date(Cr));
858
+ const fr = Et.getTime(), Ir = It.getTime(), ha = _.initialMicroHighDate.getTime() - _.initialMicroLowDate.getTime();
859
+ let Cr = dr.getTime(), Vr = mr.getTime();
860
+ Cr < fr && (Cr = fr, Vr = Math.min(Ir, Cr + ha)), Vr > Ir && (Vr = Ir, Cr = Math.max(fr, Vr - ha)), Bt = Ze(b, new Date(Cr)), Ut = Ze(b, new Date(Vr));
850
861
  } else {
851
- const At = Mt.getTime(), $t = zt.getTime(), dr = _.initialMicroLowDate.getTime(), mr = _.initialMicroHighDate.getTime(), fr = Math.max(At, Math.min($t, dr)), Er = Math.max(fr, Math.min($t, mr));
852
- cr = je(b, new Date(fr)), ur = je(b, new Date(Er));
862
+ const Et = Dt.getTime(), It = zt.getTime(), dr = _.initialMicroLowDate.getTime(), mr = _.initialMicroHighDate.getTime(), fr = Math.max(Et, Math.min(It, dr)), Ir = Math.max(fr, Math.min(It, mr));
863
+ Bt = Ze(b, new Date(fr)), Ut = Ze(b, new Date(Ir));
853
864
  }
854
- const la = Lt(cr, ia, jn, qn), Ei = Math.max(la, Lt(ur, ia, jn, qn));
855
- cr = ie(b, la), ur = ie(b, Ei);
856
- const sa = `${cr.getTime()}_${ur.getTime()}`;
857
- sa !== Sr.current && (Sr.current = sa, Je(cr, ur));
865
+ const fa = yt(Bt, ma, Jn, Qn), ki = Math.max(fa, yt(Ut, ma, Jn, Qn));
866
+ Bt = le(b, fa), Ut = le(b, ki), Ge.show(Bt, Ut);
867
+ const ga = `${Bt.getTime()}_${Ut.getTime()}`;
868
+ ga !== yr.current && (yr.current = ga, Je(Bt, Ut));
858
869
  } else if (_.handle === "micro-low" || _.handle === "micro-high" || _.handle === "micro-connect" || _.handle === "micro-point") {
859
- const [Ve, Se, pt] = ml(_.handle, it, _.startPointerRatio, _.startMicroLowRatio, _.startMicroHighRatio);
860
- Lr("micro", Ve, Se), pt !== Rt.current && (Rt.current = pt, Xr(pt), Xt(pt));
861
- let Xe, ft;
862
- if (ot) {
863
- const Mt = mn(ce, b, i, Ve), zt = Math.max(Mt, mn(ce, b, i, Se));
864
- Xe = ce[Mt], ft = ce[zt];
870
+ const [Ve, Ae, pt] = wl(_.handle, at, _.startPointerRatio, _.startMicroLowRatio, _.startMicroHighRatio);
871
+ Sr("micro", Ve, Ae), pt !== St.current && (St.current = pt, jr(pt), jt(pt));
872
+ let Ye, Qe;
873
+ if (nt) {
874
+ const Dt = gn(se, b, i, Ve), zt = Math.max(Dt, gn(se, b, i, Ae));
875
+ Ye = se[Dt], Qe = se[zt];
865
876
  } else {
866
- const Mt = Lt(ie(b, Math.round(xe + Ve * qr)), jt, xe, $e), zt = Math.max(Mt, Lt(ie(b, Math.round(xe + Se * qr)), jt, xe, $e));
867
- Xe = ie(b, Mt), ft = ie(b, zt);
877
+ const Dt = yt(le(b, Math.round(xe + Ve * Jr)), Zt, xe, Ee), zt = Math.max(Dt, yt(le(b, Math.round(xe + Ae * Jr)), Zt, xe, Ee));
878
+ Ye = le(b, Dt), Qe = le(b, zt);
868
879
  }
869
- const $r = `${Xe.getTime()}_${ft.getTime()}`;
870
- $r !== Sr.current && (Sr.current = $r, Je(Xe, ft));
880
+ Ge.show(Ye, Qe);
881
+ const Er = `${Ye.getTime()}_${Qe.getTime()}`;
882
+ Er !== yr.current && (yr.current = Er, Je(Ye, Qe));
871
883
  }
872
884
  return;
873
885
  }
874
- const u = tr.current;
875
- if (!u || a.pointerId !== u.pointerId || !Ge.current) return;
876
- const d = Ge.current.getBoundingClientRect(), m = s ? a.clientY : a.clientX, p = s ? d.height : d.width;
877
- if (!(Number.isFinite(p) && p > 0)) return;
886
+ const u = nr.current;
887
+ if (!u || a.pointerId !== u.pointerId || !Ke.current) return;
888
+ const m = Ke.current.getBoundingClientRect(), f = c ? a.clientY : a.clientX, w = c ? m.height : m.width;
889
+ if (!(Number.isFinite(w) && w > 0)) return;
878
890
  if (u.handle === "connect") {
879
- const _ = s ? (u.startPointerPos - m) / p : (m - u.startPointerPos) / p, [it, Ve] = fo(_, u.startLowRatio, u.startHighRatio);
880
- Lr("flat", it, Ve);
881
- const Se = al({
891
+ const _ = c ? (u.startPointerPos - f) / w : (f - u.startPointerPos) / w, [at, Ve] = bo(_, u.startLowRatio, u.startHighRatio);
892
+ Sr("flat", at, Ve);
893
+ const Ae = ul({
882
894
  posDiffPct: _,
883
895
  startLowVal: u.startLowVal,
884
896
  startHighVal: u.startHighVal,
885
- rangeMin: Y,
886
- rangeMax: V,
887
- isDiscrete: T,
888
- sortedAllowedDates: S,
897
+ rangeMin: k,
898
+ rangeMax: I,
899
+ isDiscrete: y,
900
+ sortedAllowedDates: L,
889
901
  snapMode: i,
890
902
  unit: t
891
903
  });
892
- if (dt.current && dt.current[0] === Se[0] && dt.current[1] === Se[1])
904
+ if (ut.current && ut.current[0] === Ae[0] && ut.current[1] === Ae[1])
893
905
  return;
894
- dt.current = Se, te(Se), Tt(Se[0], Se[1], !1);
906
+ ut.current = Ae, v(Ae), At(Ae[0], Ae[1], !1);
895
907
  return;
896
908
  }
897
- const P = er(a.clientX, a.clientY, d);
898
- if (P === null) return;
899
- const [N, E] = wn(ne ? "point" : u.handle, P, u.startLowRatio, u.startHighRatio);
900
- Lr("flat", N, E);
901
- const re = En(P * 100), [he, Re] = va(u.handle, re, u.startLowVal, u.startHighVal, Y, V, ne);
902
- if ((!dt.current || dt.current[0] !== he || dt.current[1] !== Re) && (dt.current = [he, Re], te([he, Re]), Tt(he, Re, !1)), !ne && (u.handle === "low" || u.handle === "high")) {
903
- const _ = go(u.handle, P, u.startLowRatio, u.startHighRatio);
904
- M.current !== _ && (M.current = _, O(_), me(_));
909
+ const T = rr(a.clientX, a.clientY, m);
910
+ if (T === null) return;
911
+ const [C, A] = pn(re ? "point" : u.handle, T, u.startLowRatio, u.startHighRatio);
912
+ Sr("flat", C, A);
913
+ const te = Vn(T * 100), [fe, Re] = La(u.handle, te, u.startLowVal, u.startHighVal, k, I, re);
914
+ if ((!ut.current || ut.current[0] !== fe || ut.current[1] !== Re) && (ut.current = [fe, Re], v([fe, Re]), At(fe, Re, !1)), !re && (u.handle === "low" || u.handle === "high")) {
915
+ const _ = wo(u.handle, T, u.startLowRatio, u.startHighRatio);
916
+ be.current !== _ && (be.current = _, he(_), Ie(_));
905
917
  }
906
- }, Yo = () => {
907
- No(), _n.current = null, Sr.current = null, rr.current = null, Rt.current = null, Xr(null), Mo(Zr.current), Mo(Jr.current);
908
- }, Oo = () => {
909
- No();
910
- const a = dt.current ?? B;
911
- a && (Tt(a[0], a[1], !0), K(a)), dt.current = null, te(null), tr.current = null, M.current = null, O(null);
912
- }, Ho = (a) => {
913
- if (se) {
914
- const d = rr.current;
915
- if (!d || a.pointerId !== d.pointerId) return;
916
- Yo();
918
+ }, Bo = () => {
919
+ _o(), Un.current = null, yr.current = null, or.current = null, St.current = null, jr(null), De.release(), Ge.release(), yo(Qr.current), yo(en.current);
920
+ }, Uo = () => {
921
+ _o();
922
+ const a = ut.current ?? N;
923
+ a && (At(a[0], a[1], !0), p(a)), ut.current = null, v(null), nr.current = null, be.current = null, he(null);
924
+ }, Wo = (a) => {
925
+ if (ae) {
926
+ const m = or.current;
927
+ if (!m || a.pointerId !== m.pointerId) return;
928
+ Bo();
917
929
  return;
918
930
  }
919
- const u = tr.current;
920
- !u || a.pointerId !== u.pointerId || Oo();
921
- }, Fo = () => {
922
- rr.current !== null && Yo(), tr.current !== null && Oo();
923
- }, zn = k(ko), _o = k(Ho), zo = k(Fo);
924
- Vr(() => {
925
- zn.current = ko, _o.current = Ho, zo.current = Fo;
931
+ const u = nr.current;
932
+ !u || a.pointerId !== u.pointerId || Uo();
933
+ }, Go = () => {
934
+ or.current !== null && Bo(), nr.current !== null && Uo();
935
+ }, Wn = V(zo), Xo = V(Wo), Ko = V(Go);
936
+ Nr(() => {
937
+ Wn.current = zo, Xo.current = Wo, Ko.current = Go;
926
938
  });
927
- const Bo = k(se);
928
- lt(() => {
929
- Bo.current !== se && (Bo.current = se, zo.current());
930
- }, [se]);
931
- const Uo = v !== null || We !== null;
932
- lt(() => {
933
- if (!Uo) return;
934
- const a = xr.current?.ownerDocument.defaultView;
939
+ const jo = V(ae);
940
+ it(() => {
941
+ jo.current !== ae && (jo.current = ae, Ko.current());
942
+ }, [ae]);
943
+ const qo = Y !== null || Xe !== null;
944
+ it(() => {
945
+ if (!qo) return;
946
+ const a = Rr.current?.ownerDocument.defaultView;
935
947
  if (!a) return;
936
- const u = (m) => zn.current(m), d = (m) => _o.current(m);
937
- return a.addEventListener("pointermove", u), a.addEventListener("pointerup", d), a.addEventListener("pointercancel", d), a.addEventListener("lostpointercapture", d), () => {
938
- a.removeEventListener("pointermove", u), a.removeEventListener("pointerup", d), a.removeEventListener("pointercancel", d), a.removeEventListener("lostpointercapture", d);
948
+ const u = (f) => Wn.current(f), m = (f) => Xo.current(f);
949
+ return a.addEventListener("pointermove", u), a.addEventListener("pointerup", m), a.addEventListener("pointercancel", m), a.addEventListener("lostpointercapture", m), () => {
950
+ a.removeEventListener("pointermove", u), a.removeEventListener("pointerup", m), a.removeEventListener("pointercancel", m), a.removeEventListener("lostpointercapture", m);
939
951
  };
940
- }, [Uo]);
941
- const Bn = U(
942
- (a, u, d, m) => {
943
- Ft(), Sa(a, u), tr.current = {
952
+ }, [qo]);
953
+ const Gn = z(
954
+ (a, u, m, f) => {
955
+ Ft(), Ia(a, u), nr.current = {
944
956
  pointerId: u,
945
- handle: d,
946
- startPointerPos: m,
947
- startLowVal: ve,
948
- startHighVal: pe,
957
+ handle: m,
958
+ startPointerPos: f,
959
+ startLowVal: Se,
960
+ startHighVal: ye,
949
961
  // 表示の出発点は「いま描かれている位置」。値を基準にすると、時間比例スナップのように
950
962
  // 値と位置が線形でないレールで、掴んでいない側の支点が実際の描画位置からずれる
951
- startLowRatio: Ht(ve) / 100,
952
- startHighRatio: Ht(pe) / 100
953
- }, M.current = d, O(d), d !== "connect" && me(d);
963
+ startLowRatio: Ht(Se) / 100,
964
+ startHighRatio: Ht(ye) / 100
965
+ }, be.current = m, he(m), m !== "connect" && Ie(m);
954
966
  },
955
- [ve, pe, Ht]
956
- ), Wo = U(
957
- (a, u, d, m) => {
958
- q.current.mode === "vernier" && (Ft(), Sa(a, u), rr.current = {
967
+ [Se, ye, Ht]
968
+ ), Zo = z(
969
+ (a, u, m, f) => {
970
+ j.current.mode === "vernier" && (Ft(), Ia(a, u), or.current = {
959
971
  pointerId: u,
960
- handle: d,
961
- startPointerRatio: m,
962
- startMacroLowRatio: at,
963
- startMacroHighRatio: ut,
964
- startMicroLowRatio: qt,
965
- startMicroHighRatio: Dr,
972
+ handle: m,
973
+ startPointerRatio: f,
974
+ startMacroLowRatio: ot,
975
+ startMacroHighRatio: ct,
976
+ startMicroLowRatio: Jt,
977
+ startMicroHighRatio: xr,
966
978
  // 平行移動量は暦差分で求めるため、基準は表示しているマクロ値 (期間先頭・定義域内) でなければならない。
967
979
  // 生の Props を基準にすると、期間の途中や定義域の外を指す開始日で日差分が半端になり、
968
980
  // 動いていない押下でも丸めで 1 単位ずれる
969
981
  startMacroLowDate: wt,
970
- initialMicroLowDate: St,
971
- initialMicroHighDate: yt
972
- }, Rt.current = d, Xr(d), Xt(d));
982
+ initialMicroLowDate: Tt,
983
+ initialMicroHighDate: Pt
984
+ }, St.current = m, jr(m), jt(m));
973
985
  },
974
- [at, ut, qt, Dr, wt, St, yt]
975
- ), Go = (a) => (u) => {
976
- if (l || Pt()) return;
977
- u.stopPropagation(), u.preventDefault(), me(a);
978
- const d = s ? u.clientY : u.clientX;
979
- Bn(u.currentTarget, u.pointerId, a, d);
980
- }, Xo = (a) => () => {
981
- l || M.current !== null || me(a);
982
- }, en = (a) => () => {
983
- l || Rt.current !== null || Xt(a);
984
- }, nr = (a) => (u) => {
985
- if (l || Pt()) return;
986
+ [ot, ct, Jt, xr, wt, Tt, Pt]
987
+ ), Jo = (a) => (u) => {
988
+ if (l || $t()) return;
989
+ u.stopPropagation(), u.preventDefault(), Ie(a);
990
+ const m = c ? u.clientY : u.clientX;
991
+ Gn(u.currentTarget, u.pointerId, a, m);
992
+ }, Qo = (a) => () => {
993
+ l || be.current !== null || Ie(a);
994
+ }, rn = (a) => () => {
995
+ l || St.current !== null || jt(a);
996
+ }, ar = (a) => (u) => {
997
+ if (l || $t()) return;
986
998
  u.stopPropagation(), u.preventDefault();
987
- const d = Ge.current;
988
- if (!d) return;
989
- const m = er(u.clientX, u.clientY, d.getBoundingClientRect());
990
- m !== null && Wo(u.currentTarget, u.pointerId, a, m);
991
- }, ai = (a) => {
992
- if (l || x || Pt()) return;
999
+ const m = Ke.current;
1000
+ if (!m) return;
1001
+ const f = rr(u.clientX, u.clientY, m.getBoundingClientRect());
1002
+ f !== null && Zo(u.currentTarget, u.pointerId, a, f);
1003
+ }, ui = (a) => {
1004
+ if (l || M || $t()) return;
993
1005
  a.stopPropagation(), a.preventDefault();
994
- const u = s ? a.clientY : a.clientX;
995
- Bn(a.currentTarget, a.pointerId, "connect", u);
996
- }, ii = (a) => {
997
- if (l || Pt()) return;
998
- if (se) {
999
- const E = Ge.current;
1000
- if (!E) return;
1001
- const re = E.getBoundingClientRect(), he = er(a.clientX, a.clientY, re);
1002
- if (he === null) return;
1003
- const Re = s ? a.clientX - (re.left + re.width / 2) : a.clientY - (re.top + re.height / 2), _ = ul(he, Re, at, ut, qt, Dr, Nt, void 0, !x, H ? "point" : "range");
1004
- Wo(a.currentTarget, a.pointerId, _, he), zn.current(a.nativeEvent);
1006
+ const u = c ? a.clientY : a.clientX;
1007
+ Gn(a.currentTarget, a.pointerId, "connect", u);
1008
+ }, di = (a) => {
1009
+ if (l || $t()) return;
1010
+ if (ae) {
1011
+ const A = Ke.current;
1012
+ if (!A) return;
1013
+ const te = A.getBoundingClientRect(), fe = rr(a.clientX, a.clientY, te);
1014
+ if (fe === null) return;
1015
+ const Re = c ? a.clientX - (te.left + te.width / 2) : a.clientY - (te.top + te.height / 2), _ = hl(fe, Re, ot, ct, Jt, xr, Kt, void 0, !M, O ? "point" : "range");
1016
+ Zo(a.currentTarget, a.pointerId, _, fe), Wn.current(a.nativeEvent);
1005
1017
  return;
1006
1018
  }
1007
- const u = Io(a.clientX, a.clientY);
1019
+ const u = Oo(a.clientX, a.clientY);
1008
1020
  if (u === null) return;
1009
- const d = En(u);
1010
- let m = "low";
1011
- if (!ne) {
1012
- const E = Math.abs(d - ve), re = Math.abs(d - pe);
1013
- E < re ? m = "low" : re < E ? m = "high" : m = d > pe ? "high" : "low";
1021
+ const m = Vn(u);
1022
+ let f = "low";
1023
+ if (!re) {
1024
+ const A = Math.abs(m - Se), te = Math.abs(m - ye);
1025
+ A < te ? f = "low" : te < A ? f = "high" : f = m > ye ? "high" : "low";
1014
1026
  }
1015
- me(m);
1016
- const [p, P] = va(m, d, ve, pe, Y, V, ne);
1017
- te([p, P]), Tt(p, P, !0);
1018
- const N = s ? a.clientY : a.clientX;
1019
- Bn(a.currentTarget, a.pointerId, m, N);
1020
- }, li = (a) => {
1021
- if (l || se || v !== null) return;
1022
- const u = Io(a.clientX, a.clientY);
1027
+ Ie(f);
1028
+ const [w, T] = La(f, m, Se, ye, k, I, re);
1029
+ v([w, T]), At(w, T, !0);
1030
+ const C = c ? a.clientY : a.clientX;
1031
+ Gn(a.currentTarget, a.pointerId, f, C);
1032
+ }, mi = (a) => {
1033
+ if (l || ae || Y !== null) return;
1034
+ const u = Oo(a.clientX, a.clientY);
1023
1035
  if (u === null) return;
1024
- const d = En(u);
1025
- Ae(d), rt(Ht(d));
1026
- }, si = () => {
1027
- Ae(null), rt(null);
1028
- }, Ko = (a) => (u) => {
1029
- if (l || Pt()) return;
1030
- me(a);
1031
- const d = il(u.key, a, ve, pe, Y, V, ne, 1);
1032
- d && (u.preventDefault(), Ft(), Ue || K(d), Tt(d[0], d[1], !0));
1033
- }, or = (a, u) => {
1034
- if (le === null) return;
1035
- const [d, m] = xt(h, b, [a, u], r, n), p = Q(b, d), P = Q(b, m), N = nt ? Pn(p, P) : [], E = Lt(le[0], N, p, P), re = Math.max(E, Lt(le[1], N, p, P));
1036
- Je(ie(b, E), ie(b, re), !0);
1037
- }, tn = (a) => (u) => {
1038
- if (l || !se || e.mode !== "vernier" || Pt()) return;
1039
- Xt(a);
1040
- let d = 0, m = !1, p = !1;
1036
+ const m = Vn(u);
1037
+ Rt(m), Wr(Ht(m));
1038
+ }, fi = () => {
1039
+ Rt(null), Wr(null);
1040
+ }, ea = (a) => (u) => {
1041
+ if (l || $t()) return;
1042
+ Ie(a);
1043
+ const m = dl(u.key, a, Se, ye, k, I, re, 1);
1044
+ m && (u.preventDefault(), Ft(), U || p(m), At(m[0], m[1], !0));
1045
+ }, ir = (a, u) => {
1046
+ if (Me === null) return;
1047
+ const [m, f] = xt(F, b, [a, u], r, n), w = Q(b, m), T = Q(b, f), C = Dr ? En(w, T) : [], A = yt(Me[0], C, w, T), te = Math.max(A, yt(Me[1], C, w, T));
1048
+ Je(le(b, A), le(b, te), !0);
1049
+ }, nn = (a) => (u) => {
1050
+ if (l || !ae || e.mode !== "vernier" || $t()) return;
1051
+ jt(a);
1052
+ let m = 0, f = !1, w = !1;
1041
1053
  switch (u.key) {
1042
1054
  case "ArrowRight":
1043
1055
  case "ArrowUp":
1044
- d = 1;
1056
+ m = 1;
1045
1057
  break;
1046
1058
  case "ArrowLeft":
1047
1059
  case "ArrowDown":
1048
- d = -1;
1060
+ m = -1;
1049
1061
  break;
1050
1062
  case "PageUp":
1051
- d = 5;
1063
+ m = 5;
1052
1064
  break;
1053
1065
  case "PageDown":
1054
- d = -5;
1066
+ m = -5;
1055
1067
  break;
1056
1068
  case "Home":
1057
- m = !0;
1069
+ f = !0;
1058
1070
  break;
1059
1071
  case "End":
1060
- p = !0;
1072
+ w = !0;
1061
1073
  break;
1062
1074
  default:
1063
1075
  return;
1064
1076
  }
1065
1077
  if (u.preventDefault(), Ft(), a === "macro-low") {
1066
- const P = ie(h, ke), N = ie(h, Ye);
1067
- if (Kt) {
1068
- const he = kr(Le, h, P, Le[0], N, d, m, p);
1069
- if (he === be(Le, P, h)) return;
1070
- const Re = Le[he];
1071
- Ot(Re, N, !0), or(Re, N);
1078
+ const T = le(F, ze), C = le(F, Be);
1079
+ if (qt) {
1080
+ const fe = Yr(Te, F, T, Te[0], C, m, f, w);
1081
+ if (fe === ge(Te, T, F)) return;
1082
+ const Re = Te[fe];
1083
+ Ot(Re, C, !0), ir(Re, C);
1072
1084
  return;
1073
1085
  }
1074
- let E;
1075
- if (m ? E = Ie : p ? E = Ye : E = Math.max(Ie, Math.min(Ye, ke + d)), E === ke) return;
1076
- const re = ie(h, E);
1077
- Ot(re, N, !0), or(re, N);
1086
+ let A;
1087
+ if (f ? A = ke : w ? A = Be : A = Math.max(ke, Math.min(Be, ze + m)), A === ze) return;
1088
+ const te = le(F, A);
1089
+ Ot(te, C, !0), ir(te, C);
1078
1090
  } else if (a === "macro-high") {
1079
- const P = ie(h, ke), N = ie(h, Ye);
1080
- if (Kt) {
1081
- const he = kr(Le, h, N, P, Le[Le.length - 1], d, m, p);
1082
- if (he === be(Le, N, h)) return;
1083
- const Re = Le[he];
1084
- Ot(P, Re, !0), or(P, Re);
1091
+ const T = le(F, ze), C = le(F, Be);
1092
+ if (qt) {
1093
+ const fe = Yr(Te, F, C, T, Te[Te.length - 1], m, f, w);
1094
+ if (fe === ge(Te, C, F)) return;
1095
+ const Re = Te[fe];
1096
+ Ot(T, Re, !0), ir(T, Re);
1085
1097
  return;
1086
1098
  }
1087
- let E;
1088
- if (m ? E = ke : p ? E = Ze : E = Math.max(ke, Math.min(Ze, Ye + d)), E === Ye) return;
1089
- const re = ie(h, E);
1090
- Ot(P, re, !0), or(P, re);
1099
+ let A;
1100
+ if (f ? A = ze : w ? A = st : A = Math.max(ze, Math.min(st, Be + m)), A === Be) return;
1101
+ const te = le(F, A);
1102
+ Ot(T, te, !0), ir(T, te);
1091
1103
  } else if (a === "micro-low") {
1092
- const P = ie(b, Ce), N = ie(b, Fe);
1093
- if (ot) {
1094
- const re = kr(ce, b, P, ce[0], N, d, m, p);
1095
- if (re === be(ce, P, b)) return;
1096
- Je(ce[re], N, !0);
1104
+ const T = le(b, Ce), C = le(b, Ue);
1105
+ if (nt) {
1106
+ const te = Yr(se, b, T, se[0], C, m, f, w);
1107
+ if (te === ge(se, T, b)) return;
1108
+ Je(se[te], C, !0);
1097
1109
  return;
1098
1110
  }
1099
- let E;
1100
- if (m ? E = xe : p ? E = Fe : E = Math.max(xe, Math.min(Fe, Ce + d)), E === Ce) return;
1101
- Je(ie(b, E), N, !0);
1111
+ let A;
1112
+ if (f ? A = xe : w ? A = Ue : A = Math.max(xe, Math.min(Ue, Ce + m)), A === Ce) return;
1113
+ Je(le(b, A), C, !0);
1102
1114
  } else if (a === "micro-high") {
1103
- const P = ie(b, Ce), N = ie(b, Fe);
1104
- if (ot) {
1105
- const re = kr(ce, b, N, P, ce[ce.length - 1], d, m, p);
1106
- if (re === be(ce, N, b)) return;
1107
- Je(P, ce[re], !0);
1115
+ const T = le(b, Ce), C = le(b, Ue);
1116
+ if (nt) {
1117
+ const te = Yr(se, b, C, T, se[se.length - 1], m, f, w);
1118
+ if (te === ge(se, C, b)) return;
1119
+ Je(T, se[te], !0);
1108
1120
  return;
1109
1121
  }
1110
- let E;
1111
- if (m ? E = Ce : p ? E = $e : E = Math.max(Ce, Math.min($e, Fe + d)), E === Fe) return;
1112
- Je(P, ie(b, E), !0);
1122
+ let A;
1123
+ if (f ? A = Ce : w ? A = Ee : A = Math.max(Ce, Math.min(Ee, Ue + m)), A === Ue) return;
1124
+ Je(T, le(b, A), !0);
1113
1125
  } else if (a === "micro-point") {
1114
- const P = ie(b, Ce);
1115
- if (ot) {
1116
- const E = kr(ce, b, P, ce[0], ce[ce.length - 1], d, m, p);
1117
- if (E === be(ce, P, b)) return;
1118
- Do(ce[E], !0);
1126
+ const T = le(b, Ce);
1127
+ if (nt) {
1128
+ const A = Yr(se, b, T, se[0], se[se.length - 1], m, f, w);
1129
+ if (A === ge(se, T, b)) return;
1130
+ To(se[A], !0);
1119
1131
  return;
1120
1132
  }
1121
- let N;
1122
- if (m ? N = xe : p ? N = $e : N = Math.max(xe, Math.min($e, Ce + d)), N === Ce) return;
1123
- Do(ie(b, N), !0);
1133
+ let C;
1134
+ if (f ? C = xe : w ? C = Ee : C = Math.max(xe, Math.min(Ee, Ce + m)), C === Ce) return;
1135
+ To(le(b, C), !0);
1124
1136
  }
1125
- }, ci = (a) => {
1137
+ }, gi = (a) => {
1126
1138
  if (e.mode !== "vernier") return;
1127
- if (Ft(), Kt) {
1128
- const N = Le.length - 1, E = be(Le, wt, h), re = be(Le, Yt, h), he = re - E;
1129
- let Re = E + a, _ = re + a;
1130
- if (a < 0 && Re < 0 ? (Re = 0, _ = Math.min(N, he)) : a > 0 && _ > N && (_ = N, Re = Math.max(0, N - he)), Re === E && _ === re) return;
1131
- const it = Le[Re], Ve = Le[_];
1132
- Ot(it, Ve, !0), or(it, Ve);
1139
+ if (Ft(), qt) {
1140
+ const C = Te.length - 1, A = ge(Te, wt, F), te = ge(Te, Yt, F), fe = te - A;
1141
+ let Re = A + a, _ = te + a;
1142
+ if (a < 0 && Re < 0 ? (Re = 0, _ = Math.min(C, fe)) : a > 0 && _ > C && (_ = C, Re = Math.max(0, C - fe)), Re === A && _ === te) return;
1143
+ const at = Te[Re], Ve = Te[_];
1144
+ Ot(at, Ve, !0), ir(at, Ve);
1133
1145
  return;
1134
1146
  }
1135
- const u = Ye - ke;
1136
- let d = ke + a, m = Ye + a;
1137
- if (a < 0 && d < Ie ? (d = Ie, m = Math.min(Ze, d + u)) : a > 0 && m > Ze && (m = Ze, d = Math.max(Ie, m - u)), d === ke && m === Ye) return;
1138
- const p = ie(h, d), P = ie(h, m);
1139
- Ot(p, P, !0), or(p, P);
1140
- }, Un = U(
1147
+ const u = Be - ze;
1148
+ let m = ze + a, f = Be + a;
1149
+ if (a < 0 && m < ke ? (m = ke, f = Math.min(st, m + u)) : a > 0 && f > st && (f = st, m = Math.max(ke, f - u)), m === ze && f === Be) return;
1150
+ const w = le(F, m), T = le(F, f);
1151
+ Ot(w, T, !0), ir(w, T);
1152
+ }, Xn = z(
1141
1153
  (a) => {
1142
- const u = q.current;
1143
- if (!(u.disabled || Pt()))
1154
+ const u = j.current;
1155
+ if (!(u.disabled || $t()))
1144
1156
  if (Ft(), u.mode === "point") {
1145
- const d = Math.max(Y, Math.min(V, ve + a));
1146
- Ue || K([d, d]), Tt(d, d, !0);
1157
+ const m = Math.max(k, Math.min(I, Se + a));
1158
+ U || p([m, m]), At(m, m, !0);
1147
1159
  } else if (u.mode === "vernier") {
1148
- if (ot) {
1149
- const he = ce.length - 1, Re = be(ce, St, b), _ = be(ce, yt, b), it = _ - Re;
1150
- let Ve = Re + a, Se = _ + a;
1151
- a < 0 && Ve < 0 ? (Ve = 0, Se = Math.min(he, it)) : a > 0 && Se > he && (Se = he, Ve = Math.max(0, he - it)), (Ve !== Re || Se !== _) && Je(ce[Ve], ce[Se], !0);
1160
+ if (nt) {
1161
+ const fe = se.length - 1, Re = ge(se, Tt, b), _ = ge(se, Pt, b), at = _ - Re;
1162
+ let Ve = Re + a, Ae = _ + a;
1163
+ a < 0 && Ve < 0 ? (Ve = 0, Ae = Math.min(fe, at)) : a > 0 && Ae > fe && (Ae = fe, Ve = Math.max(0, fe - at)), (Ve !== Re || Ae !== _) && Je(se[Ve], se[Ae], !0);
1152
1164
  return;
1153
1165
  }
1154
- const d = Ce, m = Fe, p = xe, P = $e, N = m - d;
1155
- let E = d + a, re = m + a;
1156
- a < 0 && E < p ? (E = p, re = Math.min(P, E + N)) : a > 0 && re > P && (re = P, E = Math.max(p, re - N)), (E !== d || re !== m) && Je(ie(b, E), ie(b, re), !0);
1166
+ const m = Ce, f = Ue, w = xe, T = Ee, C = f - m;
1167
+ let A = m + a, te = f + a;
1168
+ a < 0 && A < w ? (A = w, te = Math.min(T, A + C)) : a > 0 && te > T && (te = T, A = Math.max(w, te - C)), (A !== m || te !== f) && Je(le(b, A), le(b, te), !0);
1157
1169
  } else {
1158
- const d = pe - ve;
1159
- let m = ve + a, p = pe + a;
1160
- a < 0 && m < Y ? (m = Y, p = Math.min(V, m + d)) : a > 0 && p > V && (p = V, m = Math.max(Y, p - d)), m <= p && (Ue || K([m, p]), Tt(m, p, !0));
1170
+ const m = ye - Se;
1171
+ let f = Se + a, w = ye + a;
1172
+ a < 0 && f < k ? (f = k, w = Math.min(I, f + m)) : a > 0 && w > I && (w = I, f = Math.max(k, w - m)), f <= w && (U || p([f, w]), At(f, w, !0));
1161
1173
  }
1162
1174
  },
1163
1175
  [
1164
- ve,
1165
- pe,
1166
- Y,
1167
- V,
1168
- Ue,
1169
- Tt,
1176
+ Se,
1177
+ ye,
1178
+ k,
1179
+ I,
1180
+ U,
1181
+ At,
1170
1182
  Je,
1171
1183
  Ce,
1172
- Fe,
1184
+ Ue,
1173
1185
  xe,
1174
- $e,
1186
+ Ee,
1175
1187
  b,
1176
- ot,
1177
- ce,
1178
- St,
1179
- yt,
1188
+ nt,
1189
+ se,
1190
+ Tt,
1191
+ Pt,
1180
1192
  Ft
1181
1193
  ]
1182
- ), jo = (a) => !l && ro(xr.current, a), qo = (a, u) => {
1183
- const d = xo.current, m = Ge.current, p = xr.current;
1184
- if (l || d === null || m === null || p === null || !Bi(d, p, Ro.current, s, a, u)) return null;
1185
- const P = m.getBoundingClientRect();
1186
- return Math.abs(s ? a - (P.left + P.width / 2) : u - (P.top + P.height / 2));
1187
- }, Zo = (a) => {
1188
- if (l || Pt()) return;
1189
- const u = cl(a.deltaX, a.deltaY, s);
1194
+ ), ta = (a) => !l && ao(Rr.current, a), ra = (a, u) => {
1195
+ const m = Po.current, f = Ke.current, w = Rr.current;
1196
+ if (l || m === null || f === null || w === null || !Ki(m, w, Ao.current, c, a, u)) return null;
1197
+ const T = f.getBoundingClientRect();
1198
+ return Math.abs(c ? a - (T.left + T.width / 2) : u - (T.top + T.height / 2));
1199
+ }, na = (a) => {
1200
+ if (l || $t()) return;
1201
+ const u = gl(a.deltaX, a.deltaY, c);
1190
1202
  if (u === 0) return;
1191
1203
  a.preventDefault();
1192
- const d = a.target, m = ro(Lo.current, d) || ro(So.current, d);
1193
- if (!se || m) {
1194
- Un(u);
1204
+ const m = a.target, f = ao($o.current, m) || ao(Eo.current, m);
1205
+ if (!ae || f) {
1206
+ Xn(u);
1195
1207
  return;
1196
1208
  }
1197
- const p = Ge.current;
1198
- if (!p) return;
1199
- const P = p.getBoundingClientRect(), N = s ? a.clientX - (P.left + P.width / 2) : a.clientY - (P.top + P.height / 2);
1200
- if (Ba(N, Nt) === "macro") {
1201
- ci(u);
1209
+ const w = Ke.current;
1210
+ if (!w) return;
1211
+ const T = w.getBoundingClientRect(), C = c ? a.clientX - (T.left + T.width / 2) : a.clientY - (T.top + T.height / 2);
1212
+ if (qa(C, Kt) === "macro") {
1213
+ gi(u);
1202
1214
  return;
1203
1215
  }
1204
- Un(u);
1205
- }, rn = k({ ownsWheelHit: jo, distanceToRailPx: qo, stepFromRangeAreaWheel: Zo });
1206
- Vr(() => {
1207
- rn.current = { ownsWheelHit: jo, distanceToRailPx: qo, stepFromRangeAreaWheel: Zo };
1216
+ Xn(u);
1217
+ }, on = V({ ownsWheelHit: ta, distanceToRailPx: ra, stepFromRangeAreaWheel: na });
1218
+ Nr(() => {
1219
+ on.current = { ownsWheelHit: ta, distanceToRailPx: ra, stepFromRangeAreaWheel: na };
1208
1220
  });
1209
- const yr = k(null);
1210
- lt(() => {
1211
- const a = xr.current?.ownerDocument.defaultView ?? null, u = yr.current;
1221
+ const Tr = V(null);
1222
+ it(() => {
1223
+ const a = Rr.current?.ownerDocument.defaultView ?? null, u = Tr.current;
1212
1224
  if (u !== null && u.view === a) return;
1213
1225
  if (u?.unregister(), a === null) {
1214
- yr.current = null;
1226
+ Tr.current = null;
1215
1227
  return;
1216
1228
  }
1217
- const d = Wi(a, {
1218
- ownsHit: (m) => rn.current.ownsWheelHit(m),
1219
- distanceToRailPx: (m, p) => rn.current.distanceToRailPx(m, p),
1220
- step: (m) => rn.current.stepFromRangeAreaWheel(m)
1229
+ const m = qi(a, {
1230
+ ownsHit: (f) => on.current.ownsWheelHit(f),
1231
+ distanceToRailPx: (f, w) => on.current.distanceToRailPx(f, w),
1232
+ step: (f) => on.current.stepFromRangeAreaWheel(f)
1221
1233
  });
1222
- yr.current = { view: a, unregister: d };
1223
- }), lt(
1234
+ Tr.current = { view: a, unregister: m };
1235
+ }), it(
1224
1236
  () => () => {
1225
- yr.current?.unregister(), yr.current = null;
1237
+ Tr.current?.unregister(), Tr.current = null;
1226
1238
  },
1227
1239
  []
1228
1240
  );
1229
- const nn = Ht(ve), on = Ht(pe), Wn = ue(ve), Gn = ue(pe), Xn = xa(nn, on, On), Tr = Xn.slant, Pr = v === "low" || v !== "high" && j === "low", Ar = !ne && (v === "high" || v !== "low" && j === "high"), ui = kn && Ne !== "macro-low", di = kn && Ne === "macro-low", mi = Yn && Ne !== "micro-low", fi = Yn && Ne === "micro-low", ar = lo("macro", at, ut, Hn), ir = lo("micro", qt, Dr, Fn), gi = Math.min(nn, on), hi = Math.max(nn, on), [Jo, Qo] = Fr.flat, [bi, wi] = Fr.macro, [vi, pi] = Fr.micro, ea = It(Jo, nn), ta = It(Qo, on), Kn = It(Jo, gi), ra = `calc(${It(Qo, hi)} - ${Kn})`, lr = It(bi, at * 100), an = It(wi, ut * 100), sr = It(vi, qt * 100), ln = It(pi, Dr * 100), Mi = s ? {
1230
- bottom: Kn,
1231
- height: ra,
1241
+ const an = Ht(Se), ln = Ht(ye), Kn = ce(Se), jn = ce(ye), qn = Aa(an, ln, _n), Pr = qn.slant, Ar = Y === "low" || Y !== "high" && $e === "low", $r = !re && (Y === "high" || Y !== "low" && $e === "high"), hi = Hn && Ne !== "macro-low", bi = Hn && Ne === "macro-low", wi = Fn && Ne !== "micro-low", vi = Fn && Ne === "micro-low", lr = uo("macro", ot, ct, zn), sr = uo("micro", Jt, xr, Bn), pi = Math.min(an, ln), Di = Math.max(an, ln), [oa, aa] = _r.flat, [Mi, xi] = _r.macro, [Ri, Li] = _r.micro, ia = Vt(oa, an), la = Vt(aa, ln), Zn = Vt(oa, pi), sa = `calc(${Vt(aa, Di)} - ${Zn})`, cr = Vt(Mi, ot * 100), sn = Vt(xi, ct * 100), ur = Vt(Ri, Jt * 100), cn = Vt(Li, xr * 100), Si = c ? {
1242
+ bottom: Zn,
1243
+ height: sa,
1232
1244
  top: "auto",
1233
1245
  left: "0",
1234
1246
  right: "0"
1235
1247
  } : {
1236
- left: Kn,
1237
- width: ra,
1248
+ left: Zn,
1249
+ width: sa,
1238
1250
  top: "0",
1239
1251
  bottom: "0"
1240
- }, Di = Math.max(0.01, ut - at), na = Math.max(0.06, Math.min(0.25, 0.28 * Math.sqrt(Di))), xi = s ? { bottom: ea, left: "50%", transform: "translate(-50%, 50%)", zIndex: Pr ? 40 : 30 } : { left: ea, top: "50%", transform: "translate(-50%, -50%)", zIndex: Pr ? 40 : 30 }, Ri = s ? { bottom: ta, left: "50%", transform: "translate(-50%, 50%)", zIndex: Ar ? 40 : 30 } : { left: ta, top: "50%", transform: "translate(-50%, -50%)", zIndex: Ar ? 40 : 30 }, Li = s ? { bottom: `${He}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${He}%`, top: "50%", transform: "translate(-50%, -50%)" }, oa = we !== null ? ue(we) : null, Si = g !== "hover" && we !== null && (we === ve || !ne && we === pe), yi = ot ? Q(b, ce[0]) : xe, Ti = ot ? Q(b, ce[ce.length - 1]) : $e, Pi = se ? Ce > yi : ve > Y, Ai = se ? Fe < Ti : pe < V, sn = wl(
1241
- se ? [
1252
+ }, yi = Math.max(0.01, ct - ot), ca = Math.max(0.06, Math.min(0.25, 0.28 * Math.sqrt(yi))), Ti = c ? { bottom: ia, left: "50%", transform: "translate(-50%, 50%)", zIndex: Ar ? 40 : 30 } : { left: ia, top: "50%", transform: "translate(-50%, -50%)", zIndex: Ar ? 40 : 30 }, Pi = c ? { bottom: la, left: "50%", transform: "translate(-50%, 50%)", zIndex: $r ? 40 : 30 } : { left: la, top: "50%", transform: "translate(-50%, -50%)", zIndex: $r ? 40 : 30 }, Ai = c ? { bottom: `${bt}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${bt}%`, top: "50%", transform: "translate(-50%, -50%)" }, ua = _e !== null ? ce(_e) : null, $i = h !== "hover" && _e !== null && (_e === Se || !re && _e === ye), Ei = nt ? Q(b, se[0]) : xe, Ii = nt ? Q(b, se[se.length - 1]) : Ee, Ci = ae ? Ce > Ei : Se > k, Vi = ae ? Ue < Ii : ye < I, un = xl(
1253
+ ae ? [
1242
1254
  {
1243
- side: A ? "before" : "after",
1244
- box: hn(Po, Ao),
1245
- ...s ? { reach: "inline-size" } : { reach: "rotated", angleDeg: ar.slant.lowAngleDeg, centreOffsetPx: null, alongPushPx: ar.slant.lowOffsetX }
1255
+ side: d ? "before" : "after",
1256
+ box: wn(Vo, No),
1257
+ ...c ? { reach: "inline-size" } : { reach: "rotated", angleDeg: lr.slant.lowAngleDeg, centreOffsetPx: null, alongPushPx: lr.slant.lowOffsetX }
1246
1258
  },
1247
1259
  {
1248
- side: A ? "after" : "before",
1249
- box: H ? Vn : hn(Vn, $o),
1250
- ...s ? { reach: "inline-size" } : { reach: "rotated", angleDeg: ir.slant.lowAngleDeg, centreOffsetPx: null, alongPushPx: ir.slant.lowOffsetX }
1260
+ side: d ? "after" : "before",
1261
+ box: O ? Yn : wn(Yn, ko),
1262
+ ...c ? { reach: "inline-size" } : { reach: "rotated", angleDeg: sr.slant.lowAngleDeg, centreOffsetPx: null, alongPushPx: sr.slant.lowOffsetX }
1251
1263
  }
1252
1264
  ] : [
1253
1265
  {
1254
1266
  // 縦向きのラベルは labelPosition に関わらずスタイルシートが左へ置く
1255
- side: s || D === "top" ? "before" : "after",
1256
- box: ne ? Qt : hn(Qt, To),
1257
- ...s ? { reach: "inline-size" } : { reach: "rotated", angleDeg: Tr.lowAngleDeg, centreOffsetPx: Tr.lowOffsetY, alongPushPx: Tr.lowOffsetX }
1267
+ side: c || D === "top" ? "before" : "after",
1268
+ box: re ? tr : wn(tr, Co),
1269
+ ...c ? { reach: "inline-size" } : { reach: "rotated", angleDeg: Pr.lowAngleDeg, centreOffsetPx: Pr.lowOffsetY, alongPushPx: Pr.lowOffsetX }
1258
1270
  }
1259
1271
  ]
1260
- ), $i = sn === void 0 ? e.style : { ...e.style, ...sn.style };
1261
- Vr(() => {
1262
- Ro.current = sn === void 0 ? 0 : sn.mainPx;
1272
+ ), Ni = un === void 0 ? e.style : { ...e.style, ...un.style };
1273
+ Nr(() => {
1274
+ Ao.current = un === void 0 ? 0 : un.mainPx;
1263
1275
  });
1264
- const mt = H ? "micro-point" : "micro-low", _t = l ? "cursor-not-allowed opacity-50" : "cursor-pointer", aa = (a) => {
1265
- const u = s ? "vertical" : "horizontal", d = a === "decrease", m = s ? !d : d;
1266
- return /* @__PURE__ */ I(
1267
- Wt,
1276
+ const dt = O ? "micro-point" : "micro-low", _t = l ? "cursor-not-allowed opacity-50" : "cursor-pointer", da = (a) => {
1277
+ const u = c ? "vertical" : "horizontal", m = a === "decrease", f = c ? !m : m;
1278
+ return /* @__PURE__ */ $(
1279
+ Xt,
1268
1280
  {
1269
- ref: d ? Lo : So,
1281
+ ref: m ? $o : Eo,
1270
1282
  neighbour: "rail",
1271
- direction: vl[u][a],
1283
+ direction: Rl[u][a],
1272
1284
  disabled: l,
1273
- canStep: d ? Pi : Ai,
1274
- onStep: () => Un(d ? -1 : 1),
1275
- ariaLabel: d ? de : oe,
1276
- className: `period-slider-stepper-btn ${pl[u][a]} ${La[u][m ? "leading" : "trailing"]}`
1285
+ canStep: m ? Ci : Vi,
1286
+ onStep: () => Xn(m ? -1 : 1),
1287
+ ariaLabel: m ? ue : ne,
1288
+ className: `period-slider-stepper-btn ${Ll[u][a]} ${Ea[u][f ? "leading" : "trailing"]}`
1277
1289
  }
1278
1290
  );
1279
1291
  };
1280
- return /* @__PURE__ */ Me(
1292
+ return /* @__PURE__ */ we(
1281
1293
  "div",
1282
1294
  {
1283
- ref: xr,
1284
- style: $i,
1285
- className: `period-slider grid select-none place-items-center ${Ml[s ? "vertical" : "horizontal"][f ? "withSteppers" : "railOnly"]} ${c}`,
1295
+ ref: Rr,
1296
+ style: Ni,
1297
+ className: `period-slider grid select-none place-items-center ${Sl[c ? "vertical" : "horizontal"][g ? "withSteppers" : "railOnly"]} ${s}`,
1286
1298
  "data-disabled": l ? "true" : void 0,
1287
1299
  "data-unit": t,
1288
1300
  "data-mode": e.mode,
1289
- "data-orientation": s ? "vertical" : "horizontal",
1301
+ "data-orientation": c ? "vertical" : "horizontal",
1290
1302
  "data-label-position": D,
1291
1303
  "data-color-scheme": ee,
1292
1304
  children: [
1293
- /* @__PURE__ */ I("div", { ref: xo, "data-range-area": "true", "aria-hidden": "true", className: "period-slider-range-area" }),
1294
- f && aa(s ? "increase" : "decrease"),
1295
- /* @__PURE__ */ I(
1305
+ /* @__PURE__ */ $("div", { ref: Po, "data-range-area": "true", "aria-hidden": "true", className: "period-slider-range-area" }),
1306
+ g && da(c ? "increase" : "decrease"),
1307
+ /* @__PURE__ */ $(
1296
1308
  "div",
1297
1309
  {
1298
- ref: Ge,
1310
+ ref: Ke,
1299
1311
  "data-testid": "period-slider-track",
1300
- "data-orientation": s ? "vertical" : "horizontal",
1301
- "data-vernier-orientation": se ? Nt : void 0,
1302
- className: `period-slider-track relative touch-none rounded-full ${La[s ? "vertical" : "horizontal"][f ? "rail" : "railOnly"]} ${_t}`,
1303
- onPointerDown: ii,
1304
- onPointerMove: li,
1305
- onPointerLeave: si,
1306
- children: se ? /* @__PURE__ */ Me(Zn, { children: [
1307
- Gt && (s ? /* @__PURE__ */ Me("svg", { className: "period-slider-vernier-projection is-vertical", role: "presentation", "aria-hidden": "true", width: "32", height: "100%", viewBox: "0 0 32 100", preserveAspectRatio: "none", children: [
1308
- /* @__PURE__ */ I("defs", { children: /* @__PURE__ */ Me("linearGradient", { id: ae, x1: "0", y1: "0", x2: "1", y2: "0", children: [
1309
- /* @__PURE__ */ I("stop", { offset: "0%", stopColor: A ? W.macro : W.micro, stopOpacity: "0.28" }),
1310
- /* @__PURE__ */ I("stop", { offset: "100%", stopColor: A ? W.micro : W.macro, stopOpacity: na })
1312
+ "data-orientation": c ? "vertical" : "horizontal",
1313
+ "data-vernier-orientation": ae ? Kt : void 0,
1314
+ className: `period-slider-track relative touch-none rounded-full ${Ea[c ? "vertical" : "horizontal"][g ? "rail" : "railOnly"]} ${_t}`,
1315
+ onPointerDown: di,
1316
+ onPointerMove: mi,
1317
+ onPointerLeave: fi,
1318
+ children: ae ? /* @__PURE__ */ we(eo, { children: [
1319
+ W && (c ? /* @__PURE__ */ we("svg", { className: "period-slider-vernier-projection is-vertical", role: "presentation", "aria-hidden": "true", width: "32", height: "100%", viewBox: "0 0 32 100", preserveAspectRatio: "none", children: [
1320
+ /* @__PURE__ */ $("defs", { children: /* @__PURE__ */ we("linearGradient", { id: ie, x1: "0", y1: "0", x2: "1", y2: "0", children: [
1321
+ /* @__PURE__ */ $("stop", { offset: "0%", stopColor: d ? G.macro : G.micro, stopOpacity: "0.28" }),
1322
+ /* @__PURE__ */ $("stop", { offset: "100%", stopColor: d ? G.micro : G.macro, stopOpacity: ca })
1311
1323
  ] }) }),
1312
- /* @__PURE__ */ I("path", { ref: In, "data-testid": "period-slider-vernier-projection", d: to(at, ut, s, A), fill: `url(#${ae})` })
1313
- ] }) : /* @__PURE__ */ Me("svg", { className: "period-slider-vernier-projection", role: "presentation", "aria-hidden": "true", width: "100%", height: "32", viewBox: "0 0 100 32", preserveAspectRatio: "none", children: [
1314
- /* @__PURE__ */ I("defs", { children: /* @__PURE__ */ Me("linearGradient", { id: ae, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1315
- /* @__PURE__ */ I("stop", { offset: "0%", stopColor: A ? W.macro : W.micro, stopOpacity: "0.28" }),
1316
- /* @__PURE__ */ I("stop", { offset: "100%", stopColor: A ? W.micro : W.macro, stopOpacity: na })
1324
+ /* @__PURE__ */ $("path", { ref: Nn, "data-testid": "period-slider-vernier-projection", d: oo(ot, ct, c, d), fill: `url(#${ie})` })
1325
+ ] }) : /* @__PURE__ */ we("svg", { className: "period-slider-vernier-projection", role: "presentation", "aria-hidden": "true", width: "100%", height: "32", viewBox: "0 0 100 32", preserveAspectRatio: "none", children: [
1326
+ /* @__PURE__ */ $("defs", { children: /* @__PURE__ */ we("linearGradient", { id: ie, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1327
+ /* @__PURE__ */ $("stop", { offset: "0%", stopColor: d ? G.macro : G.micro, stopOpacity: "0.28" }),
1328
+ /* @__PURE__ */ $("stop", { offset: "100%", stopColor: d ? G.micro : G.macro, stopOpacity: ca })
1317
1329
  ] }) }),
1318
- /* @__PURE__ */ I("path", { ref: In, "data-testid": "period-slider-vernier-projection", d: to(at, ut, s, A), fill: `url(#${ae})` })
1330
+ /* @__PURE__ */ $("path", { ref: Nn, "data-testid": "period-slider-vernier-projection", d: oo(ot, ct, c, d), fill: `url(#${ie})` })
1319
1331
  ] })),
1320
- !x && /* @__PURE__ */ Me(Zn, { children: [
1321
- /* @__PURE__ */ I(
1332
+ !M && /* @__PURE__ */ we(eo, { children: [
1333
+ /* @__PURE__ */ $(
1322
1334
  "div",
1323
1335
  {
1324
1336
  "data-testid": "period-slider-connect-macro",
1325
1337
  className: "period-slider-connect-macro",
1326
- style: s ? {
1327
- bottom: `calc(${lr} - 8px)`,
1328
- height: `calc(${an} - ${lr} + 16px)`
1338
+ style: c ? {
1339
+ bottom: `calc(${cr} - 8px)`,
1340
+ height: `calc(${sn} - ${cr} + 16px)`
1329
1341
  } : {
1330
- left: `calc(${lr} - 8px)`,
1331
- width: `calc(${an} - ${lr} + 16px)`
1342
+ left: `calc(${cr} - 8px)`,
1343
+ width: `calc(${sn} - ${cr} + 16px)`
1332
1344
  },
1333
- onPointerDown: nr("macro-connect")
1345
+ onPointerDown: ar("macro-connect")
1334
1346
  }
1335
1347
  ),
1336
- !H && /* @__PURE__ */ I(
1348
+ !O && /* @__PURE__ */ $(
1337
1349
  "div",
1338
1350
  {
1339
1351
  "data-testid": "period-slider-connect-micro",
1340
1352
  className: "period-slider-connect-micro",
1341
- style: s ? {
1342
- bottom: `calc(${sr} - 8px)`,
1343
- height: `calc(${ln} - ${sr} + 16px)`
1353
+ style: c ? {
1354
+ bottom: `calc(${ur} - 8px)`,
1355
+ height: `calc(${cn} - ${ur} + 16px)`
1344
1356
  } : {
1345
- left: `calc(${sr} - 8px)`,
1346
- width: `calc(${ln} - ${sr} + 16px)`
1357
+ left: `calc(${ur} - 8px)`,
1358
+ width: `calc(${cn} - ${ur} + 16px)`
1347
1359
  },
1348
- onPointerDown: nr("micro-connect")
1360
+ onPointerDown: ar("micro-connect")
1349
1361
  }
1350
1362
  )
1351
1363
  ] }),
1352
- bo && /* @__PURE__ */ Me("div", { className: "period-slider-vernier-ticks pointer-events-none absolute inset-0", children: [
1353
- [0.2, 0.4, 0.6, 0.8].map((a) => /* @__PURE__ */ I("div", { "data-testid": "period-slider-tick", "data-tick-scale": "macro", className: "period-slider-tick period-slider-tick-macro", style: s ? { bottom: `${a * 100}%` } : { left: `${a * 100}%` } }, `macro-tick-${a}`)),
1354
- [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].map((a) => /* @__PURE__ */ I("div", { "data-testid": "period-slider-tick", "data-tick-scale": "micro", className: "period-slider-tick period-slider-tick-micro", style: s ? { bottom: `${a * 100}%` } : { left: `${a * 100}%` } }, `micro-tick-${a}`))
1364
+ je && /* @__PURE__ */ we("div", { className: "period-slider-vernier-ticks pointer-events-none absolute inset-0", children: [
1365
+ [0.2, 0.4, 0.6, 0.8].map((a) => /* @__PURE__ */ $("div", { "data-testid": "period-slider-tick", "data-tick-scale": "macro", className: "period-slider-tick period-slider-tick-macro", style: c ? { bottom: `${a * 100}%` } : { left: `${a * 100}%` } }, `macro-tick-${a}`)),
1366
+ [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].map((a) => /* @__PURE__ */ $("div", { "data-testid": "period-slider-tick", "data-tick-scale": "micro", className: "period-slider-tick period-slider-tick-micro", style: c ? { bottom: `${a * 100}%` } : { left: `${a * 100}%` } }, `micro-tick-${a}`))
1355
1367
  ] }),
1356
- /* @__PURE__ */ Me(
1368
+ /* @__PURE__ */ we(
1357
1369
  "div",
1358
1370
  {
1359
1371
  tabIndex: l ? -1 : 0,
1360
1372
  role: "slider",
1361
1373
  "aria-label": e.macroLowerAriaLabel ?? "Macro range start",
1362
1374
  "aria-disabled": l ? "true" : void 0,
1363
- "aria-valuemin": Ie,
1364
- "aria-valuemax": Ye,
1365
- "aria-valuenow": ke,
1366
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(wt, h) : gr(h, wt, Wr, R),
1367
- "aria-orientation": s ? "vertical" : "horizontal",
1368
- className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1369
- style: s ? {
1370
- bottom: lr,
1371
- left: A ? 0 : "auto",
1372
- right: A ? "auto" : 0,
1373
- transform: A ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1374
- zIndex: We === "macro-low" || Ne === "macro-low" ? 30 : 15
1375
+ "aria-valuemin": ke,
1376
+ "aria-valuemax": Be,
1377
+ "aria-valuenow": ze,
1378
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(wt, F) : gr(F, wt, Xr, x),
1379
+ "aria-orientation": c ? "vertical" : "horizontal",
1380
+ className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? d ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : d ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1381
+ style: c ? {
1382
+ bottom: cr,
1383
+ left: d ? 0 : "auto",
1384
+ right: d ? "auto" : 0,
1385
+ transform: d ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1386
+ zIndex: Xe === "macro-low" || Ne === "macro-low" ? 30 : 15
1375
1387
  } : {
1376
- left: lr,
1377
- top: A ? 0 : "auto",
1378
- bottom: A ? "auto" : 0,
1379
- transform: A ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1380
- zIndex: We === "macro-low" || Ne === "macro-low" ? 30 : 15
1388
+ left: cr,
1389
+ top: d ? 0 : "auto",
1390
+ bottom: d ? "auto" : 0,
1391
+ transform: d ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1392
+ zIndex: Xe === "macro-low" || Ne === "macro-low" ? 30 : 15
1381
1393
  },
1382
- onPointerDown: nr("macro-low"),
1383
- onKeyDown: tn("macro-low"),
1384
- onFocus: en("macro-low"),
1385
- "data-active": We === "macro-low" ? "true" : void 0,
1394
+ onPointerDown: ar("macro-low"),
1395
+ onKeyDown: nn("macro-low"),
1396
+ onFocus: rn("macro-low"),
1397
+ "data-active": Xe === "macro-low" ? "true" : void 0,
1386
1398
  "data-front": Ne === "macro-low" ? "true" : void 0,
1387
- "data-vernier-pos": s ? A ? "left" : "right" : A ? "top" : "bottom",
1399
+ "data-vernier-pos": c ? d ? "left" : "right" : d ? "top" : "bottom",
1388
1400
  "data-handle-type": "macro-low",
1389
1401
  children: [
1390
- /* @__PURE__ */ I(Or, { type: "macro", isTop: A, isVertical: s, isLeft: A }),
1391
- w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1392
- g !== "hover" && /* @__PURE__ */ I(
1402
+ /* @__PURE__ */ $(Hr, { type: "macro", isTop: d, isVertical: c, isLeft: d }),
1403
+ Lt && /* @__PURE__ */ $("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1404
+ h !== "hover" && /* @__PURE__ */ $(
1393
1405
  "div",
1394
1406
  {
1395
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1396
- "data-tooltip-style": g,
1397
- "data-duplicate": ui ? "true" : void 0,
1398
- "data-slanted": ar.slant.isSlanted ? "true" : void 0,
1399
- ref: qa,
1400
- style: ar.lowStyle,
1401
- children: Ke(h, wt, Wr, R)
1407
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1408
+ "data-tooltip-style": h,
1409
+ "data-duplicate": hi ? "true" : void 0,
1410
+ "data-slanted": lr.slant.isSlanted ? "true" : void 0,
1411
+ ref: ti,
1412
+ style: lr.lowStyle,
1413
+ children: qe(F, wt, Xr, x)
1402
1414
  }
1403
1415
  )
1404
1416
  ]
1405
1417
  }
1406
1418
  ),
1407
- /* @__PURE__ */ Me(
1419
+ /* @__PURE__ */ we(
1408
1420
  "div",
1409
1421
  {
1410
1422
  tabIndex: l ? -1 : 0,
1411
1423
  role: "slider",
1412
1424
  "aria-label": e.macroUpperAriaLabel ?? "Macro range end",
1413
1425
  "aria-disabled": l ? "true" : void 0,
1414
- "aria-valuemin": ke,
1415
- "aria-valuemax": Ze,
1416
- "aria-valuenow": Ye,
1417
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Yt, h) : gr(h, Yt, Wr, R),
1418
- "aria-orientation": s ? "vertical" : "horizontal",
1419
- className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1420
- style: s ? {
1421
- bottom: an,
1422
- left: A ? 0 : "auto",
1423
- right: A ? "auto" : 0,
1424
- transform: A ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1425
- zIndex: We === "macro-high" || Ne === "macro-high" ? 30 : 15
1426
+ "aria-valuemin": ze,
1427
+ "aria-valuemax": st,
1428
+ "aria-valuenow": Be,
1429
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Yt, F) : gr(F, Yt, Xr, x),
1430
+ "aria-orientation": c ? "vertical" : "horizontal",
1431
+ className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? d ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : d ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1432
+ style: c ? {
1433
+ bottom: sn,
1434
+ left: d ? 0 : "auto",
1435
+ right: d ? "auto" : 0,
1436
+ transform: d ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1437
+ zIndex: Xe === "macro-high" || Ne === "macro-high" ? 30 : 15
1426
1438
  } : {
1427
- left: an,
1428
- top: A ? 0 : "auto",
1429
- bottom: A ? "auto" : 0,
1430
- transform: A ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1431
- zIndex: We === "macro-high" || Ne === "macro-high" ? 30 : 15
1439
+ left: sn,
1440
+ top: d ? 0 : "auto",
1441
+ bottom: d ? "auto" : 0,
1442
+ transform: d ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1443
+ zIndex: Xe === "macro-high" || Ne === "macro-high" ? 30 : 15
1432
1444
  },
1433
- onPointerDown: nr("macro-high"),
1434
- onKeyDown: tn("macro-high"),
1435
- onFocus: en("macro-high"),
1436
- "data-active": We === "macro-high" ? "true" : void 0,
1445
+ onPointerDown: ar("macro-high"),
1446
+ onKeyDown: nn("macro-high"),
1447
+ onFocus: rn("macro-high"),
1448
+ "data-active": Xe === "macro-high" ? "true" : void 0,
1437
1449
  "data-front": Ne === "macro-high" ? "true" : void 0,
1438
- "data-vernier-pos": s ? A ? "left" : "right" : A ? "top" : "bottom",
1450
+ "data-vernier-pos": c ? d ? "left" : "right" : d ? "top" : "bottom",
1439
1451
  "data-handle-type": "macro-high",
1440
1452
  children: [
1441
- /* @__PURE__ */ I(Or, { type: "macro", isTop: A, isVertical: s, isLeft: A }),
1442
- w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1443
- g !== "hover" && /* @__PURE__ */ I(
1453
+ /* @__PURE__ */ $(Hr, { type: "macro", isTop: d, isVertical: c, isLeft: d }),
1454
+ Lt && /* @__PURE__ */ $("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1455
+ h !== "hover" && /* @__PURE__ */ $(
1444
1456
  "div",
1445
1457
  {
1446
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1447
- "data-tooltip-style": g,
1448
- "data-duplicate": di ? "true" : void 0,
1449
- "data-slanted": ar.slant.isSlanted ? "true" : void 0,
1450
- ref: Za,
1451
- style: ar.highStyle,
1452
- children: Ke(h, Yt, Wr, R)
1458
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1459
+ "data-tooltip-style": h,
1460
+ "data-duplicate": bi ? "true" : void 0,
1461
+ "data-slanted": lr.slant.isSlanted ? "true" : void 0,
1462
+ ref: ri,
1463
+ style: lr.highStyle,
1464
+ children: qe(F, Yt, Xr, x)
1453
1465
  }
1454
1466
  )
1455
1467
  ]
1456
1468
  }
1457
1469
  ),
1458
- /* @__PURE__ */ Me(
1470
+ /* @__PURE__ */ we(
1459
1471
  "div",
1460
1472
  {
1461
1473
  tabIndex: l ? -1 : 0,
1462
1474
  role: "slider",
1463
- "aria-label": H ? e.pointAriaLabel ?? "Micro selected date" : e.lowerAriaLabel ?? "Micro range start",
1475
+ "aria-label": O ? e.pointAriaLabel ?? "Micro selected date" : e.lowerAriaLabel ?? "Micro range start",
1464
1476
  "aria-disabled": l ? "true" : void 0,
1465
1477
  "aria-valuemin": xe,
1466
- "aria-valuemax": H ? $e : Fe,
1478
+ "aria-valuemax": O ? Ee : Ue,
1467
1479
  "aria-valuenow": Ce,
1468
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(St, b) : gr(b, St, Gr, R),
1469
- "aria-orientation": s ? "vertical" : "horizontal",
1470
- className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1471
- style: s ? {
1472
- bottom: sr,
1473
- left: A ? "auto" : 0,
1474
- right: A ? 0 : "auto",
1475
- transform: A ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1476
- zIndex: We === mt || Ne === mt ? 30 : 20
1480
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Tt, b) : gr(b, Tt, Kr, x),
1481
+ "aria-orientation": c ? "vertical" : "horizontal",
1482
+ className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? d ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : d ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1483
+ style: c ? {
1484
+ bottom: ur,
1485
+ left: d ? "auto" : 0,
1486
+ right: d ? 0 : "auto",
1487
+ transform: d ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1488
+ zIndex: Xe === dt || Ne === dt ? 30 : 20
1477
1489
  } : {
1478
- left: sr,
1479
- top: A ? "auto" : 0,
1480
- bottom: A ? 0 : "auto",
1481
- transform: A ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1482
- zIndex: We === mt || Ne === mt ? 30 : 20
1490
+ left: ur,
1491
+ top: d ? "auto" : 0,
1492
+ bottom: d ? 0 : "auto",
1493
+ transform: d ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1494
+ zIndex: Xe === dt || Ne === dt ? 30 : 20
1483
1495
  },
1484
- onPointerDown: nr(mt),
1485
- onKeyDown: tn(mt),
1486
- onFocus: en(mt),
1487
- "data-active": We === mt ? "true" : void 0,
1488
- "data-front": Ne === mt ? "true" : void 0,
1489
- "data-vernier-pos": s ? A ? "right" : "left" : A ? "bottom" : "top",
1490
- "data-handle-type": mt,
1496
+ onPointerDown: ar(dt),
1497
+ onKeyDown: nn(dt),
1498
+ onFocus: rn(dt),
1499
+ "data-active": Xe === dt ? "true" : void 0,
1500
+ "data-front": Ne === dt ? "true" : void 0,
1501
+ "data-vernier-pos": c ? d ? "right" : "left" : d ? "bottom" : "top",
1502
+ "data-handle-type": dt,
1491
1503
  children: [
1492
- /* @__PURE__ */ I(Or, { type: "micro", isTop: !A, isVertical: s, isLeft: !A }),
1493
- w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1494
- g !== "hover" && /* @__PURE__ */ I(
1504
+ /* @__PURE__ */ $(Hr, { type: "micro", isTop: !d, isVertical: c, isLeft: !d }),
1505
+ Lt && /* @__PURE__ */ $("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1506
+ h !== "hover" && /* @__PURE__ */ $(
1495
1507
  "div",
1496
1508
  {
1497
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1498
- "data-tooltip-style": g,
1499
- "data-duplicate": mi ? "true" : void 0,
1500
- "data-slanted": ir.slant.isSlanted ? "true" : void 0,
1501
- ref: Ja,
1502
- style: ir.lowStyle,
1503
- children: Ke(b, St, Gr, R)
1509
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1510
+ "data-tooltip-style": h,
1511
+ "data-duplicate": wi ? "true" : void 0,
1512
+ "data-slanted": sr.slant.isSlanted ? "true" : void 0,
1513
+ ref: ni,
1514
+ style: sr.lowStyle,
1515
+ children: qe(b, Tt, Kr, x)
1504
1516
  }
1505
1517
  )
1506
1518
  ]
1507
1519
  }
1508
1520
  ),
1509
- !H && /* @__PURE__ */ Me(
1521
+ !O && /* @__PURE__ */ we(
1510
1522
  "div",
1511
1523
  {
1512
1524
  tabIndex: l ? -1 : 0,
@@ -1514,150 +1526,150 @@ const fl = (e, t) => {
1514
1526
  "aria-label": e.upperAriaLabel ?? "Micro range end",
1515
1527
  "aria-disabled": l ? "true" : void 0,
1516
1528
  "aria-valuemin": Ce,
1517
- "aria-valuemax": $e,
1518
- "aria-valuenow": Fe,
1519
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(yt, b) : gr(b, yt, Gr, R),
1520
- "aria-orientation": s ? "vertical" : "horizontal",
1521
- className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1522
- style: s ? {
1523
- bottom: ln,
1524
- left: A ? "auto" : 0,
1525
- right: A ? 0 : "auto",
1526
- transform: A ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1527
- zIndex: We === "micro-high" || Ne === "micro-high" ? 30 : 20
1529
+ "aria-valuemax": Ee,
1530
+ "aria-valuenow": Ue,
1531
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Pt, b) : gr(b, Pt, Kr, x),
1532
+ "aria-orientation": c ? "vertical" : "horizontal",
1533
+ className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? d ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : d ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1534
+ style: c ? {
1535
+ bottom: cn,
1536
+ left: d ? "auto" : 0,
1537
+ right: d ? 0 : "auto",
1538
+ transform: d ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1539
+ zIndex: Xe === "micro-high" || Ne === "micro-high" ? 30 : 20
1528
1540
  } : {
1529
- left: ln,
1530
- top: A ? "auto" : 0,
1531
- bottom: A ? 0 : "auto",
1532
- transform: A ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1533
- zIndex: We === "micro-high" || Ne === "micro-high" ? 30 : 20
1541
+ left: cn,
1542
+ top: d ? "auto" : 0,
1543
+ bottom: d ? 0 : "auto",
1544
+ transform: d ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1545
+ zIndex: Xe === "micro-high" || Ne === "micro-high" ? 30 : 20
1534
1546
  },
1535
- onPointerDown: nr("micro-high"),
1536
- onKeyDown: tn("micro-high"),
1537
- onFocus: en("micro-high"),
1538
- "data-active": We === "micro-high" ? "true" : void 0,
1547
+ onPointerDown: ar("micro-high"),
1548
+ onKeyDown: nn("micro-high"),
1549
+ onFocus: rn("micro-high"),
1550
+ "data-active": Xe === "micro-high" ? "true" : void 0,
1539
1551
  "data-front": Ne === "micro-high" ? "true" : void 0,
1540
- "data-vernier-pos": s ? A ? "right" : "left" : A ? "bottom" : "top",
1552
+ "data-vernier-pos": c ? d ? "right" : "left" : d ? "bottom" : "top",
1541
1553
  "data-handle-type": "micro-high",
1542
1554
  children: [
1543
- /* @__PURE__ */ I(Or, { type: "micro", isTop: !A, isVertical: s, isLeft: !A }),
1544
- w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1545
- g !== "hover" && /* @__PURE__ */ I(
1555
+ /* @__PURE__ */ $(Hr, { type: "micro", isTop: !d, isVertical: c, isLeft: !d }),
1556
+ Lt && /* @__PURE__ */ $("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1557
+ h !== "hover" && /* @__PURE__ */ $(
1546
1558
  "div",
1547
1559
  {
1548
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1549
- "data-tooltip-style": g,
1550
- "data-duplicate": fi ? "true" : void 0,
1551
- "data-slanted": ir.slant.isSlanted ? "true" : void 0,
1552
- ref: Qa,
1553
- style: ir.highStyle,
1554
- children: Ke(b, yt, Gr, R)
1560
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1561
+ "data-tooltip-style": h,
1562
+ "data-duplicate": vi ? "true" : void 0,
1563
+ "data-slanted": sr.slant.isSlanted ? "true" : void 0,
1564
+ ref: oi,
1565
+ style: sr.highStyle,
1566
+ children: qe(b, Pt, Kr, x)
1555
1567
  }
1556
1568
  )
1557
1569
  ]
1558
1570
  }
1559
1571
  )
1560
- ] }) : /* @__PURE__ */ Me(Zn, { children: [
1561
- !x && /* @__PURE__ */ I("div", { "data-testid": "period-slider-connect", className: "period-slider-connect absolute rounded-full", style: Mi, onPointerDown: ai }),
1562
- Z && T && S.length > 1 && /* @__PURE__ */ I("div", { className: "period-slider-ticks pointer-events-none absolute inset-0", children: S.map((a, u) => {
1563
- const d = Q(t, a), m = Ht(u), p = s ? { bottom: `${m}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${m}%`, top: "50%", transform: "translate(-50%, -50%)" };
1564
- return /* @__PURE__ */ I("div", { "data-testid": "period-slider-tick", className: "period-slider-tick absolute h-1.5 w-1.5 rounded-full", style: p }, `tick-${d}`);
1572
+ ] }) : /* @__PURE__ */ we(eo, { children: [
1573
+ !M && /* @__PURE__ */ $("div", { "data-testid": "period-slider-connect", className: "period-slider-connect absolute rounded-full", style: Si, onPointerDown: ui }),
1574
+ Z && y && L.length > 1 && /* @__PURE__ */ $("div", { className: "period-slider-ticks pointer-events-none absolute inset-0", children: L.map((a, u) => {
1575
+ const m = Q(t, a), f = Ht(u), w = c ? { bottom: `${f}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${f}%`, top: "50%", transform: "translate(-50%, -50%)" };
1576
+ return /* @__PURE__ */ $("div", { "data-testid": "period-slider-tick", className: "period-slider-tick absolute h-1.5 w-1.5 rounded-full", style: w }, `tick-${m}`);
1565
1577
  }) }),
1566
- !l && we !== null && He !== null && v === null && oa && /* @__PURE__ */ Me("div", { "data-testid": "period-slider-hover-guide", className: "period-slider-hover-guide pointer-events-none absolute h-2 w-2", style: Li, children: [
1567
- /* @__PURE__ */ I("div", { "data-testid": "period-slider-hover-dot", className: "period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-[var(--aqps-accent-light)] shadow-[0_0_6px_var(--aqps-accent-glow)] dark:border-slate-800" }),
1568
- /* @__PURE__ */ I(
1578
+ !l && _e !== null && bt !== null && Y === null && ua && /* @__PURE__ */ we("div", { "data-testid": "period-slider-hover-guide", className: "period-slider-hover-guide pointer-events-none absolute h-2 w-2", style: Ai, children: [
1579
+ /* @__PURE__ */ $("div", { "data-testid": "period-slider-hover-dot", className: "period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-[var(--aqps-accent-light)] shadow-[0_0_6px_var(--aqps-accent-glow)] dark:border-slate-800" }),
1580
+ /* @__PURE__ */ $(
1569
1581
  "div",
1570
1582
  {
1571
1583
  "data-testid": "period-slider-hover-tooltip",
1572
- "data-duplicate": Si ? "true" : void 0,
1573
- className: `period-slider-hover-tooltip ${D === "bottom" && !s ? "period-slider-hover-tooltip-bottom" : ""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,
1574
- children: Ke(t, oa, e.formatLabel, R)
1584
+ "data-duplicate": $i ? "true" : void 0,
1585
+ className: `period-slider-hover-tooltip ${D === "bottom" && !c ? "period-slider-hover-tooltip-bottom" : ""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,
1586
+ children: qe(t, ua, e.formatLabel, x)
1575
1587
  }
1576
1588
  )
1577
1589
  ] }),
1578
- /* @__PURE__ */ Me(
1590
+ /* @__PURE__ */ we(
1579
1591
  "div",
1580
1592
  {
1581
1593
  tabIndex: l ? -1 : 0,
1582
1594
  role: "slider",
1583
- "aria-label": ne ? e.pointAriaLabel ?? "Selected date" : e.lowerAriaLabel ?? "Range start",
1595
+ "aria-label": re ? e.pointAriaLabel ?? "Selected date" : e.lowerAriaLabel ?? "Range start",
1584
1596
  "aria-disabled": l ? "true" : void 0,
1585
- "aria-valuemin": Y,
1586
- "aria-valuemax": ne ? V : pe,
1587
- "aria-valuenow": ve,
1588
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Wn, t) : gr(t, Wn, e.formatLabel, R),
1589
- "aria-orientation": s ? "vertical" : "horizontal",
1597
+ "aria-valuemin": k,
1598
+ "aria-valuemax": re ? I : ye,
1599
+ "aria-valuenow": Se,
1600
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Kn, t) : gr(t, Kn, e.formatLabel, x),
1601
+ "aria-orientation": c ? "vertical" : "horizontal",
1590
1602
  className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${_t}`,
1591
- style: xi,
1592
- onPointerDown: Go("low"),
1593
- onKeyDown: Ko("low"),
1594
- onFocus: Xo("low"),
1595
- "data-active": v === "low" ? "true" : void 0,
1596
- "data-front": Pr ? "true" : void 0,
1603
+ style: Ti,
1604
+ onPointerDown: Jo("low"),
1605
+ onKeyDown: ea("low"),
1606
+ onFocus: Qo("low"),
1607
+ "data-active": Y === "low" ? "true" : void 0,
1608
+ "data-front": Ar ? "true" : void 0,
1597
1609
  children: [
1598
- /* @__PURE__ */ I(
1610
+ /* @__PURE__ */ $(
1599
1611
  "div",
1600
1612
  {
1601
1613
  "data-testid": "period-slider-knob",
1602
- className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] dark:group-focus-visible:ring-blue-400 ${v === "low" ? "" : "shadow-md"}`
1614
+ className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] dark:group-focus-visible:ring-blue-400 ${Y === "low" ? "" : "shadow-md"}`
1603
1615
  }
1604
1616
  ),
1605
- g !== "hover" && /* @__PURE__ */ I(
1617
+ h !== "hover" && /* @__PURE__ */ $(
1606
1618
  "div",
1607
1619
  {
1608
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1609
- "data-tooltip-style": g,
1620
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1621
+ "data-tooltip-style": h,
1610
1622
  "data-label-position": D,
1611
- "data-slanted": Tr.isSlanted ? "true" : void 0,
1612
- "data-front": Pr ? "true" : void 0,
1613
- "data-duplicate": Nn && !Pr ? "true" : void 0,
1614
- ref: Ka,
1615
- style: Xn.lowStyle,
1616
- children: Ke(t, Wn, e.formatLabel, R)
1623
+ "data-slanted": Pr.isSlanted ? "true" : void 0,
1624
+ "data-front": Ar ? "true" : void 0,
1625
+ "data-duplicate": On && !Ar ? "true" : void 0,
1626
+ ref: Qa,
1627
+ style: qn.lowStyle,
1628
+ children: qe(t, Kn, e.formatLabel, x)
1617
1629
  }
1618
1630
  )
1619
1631
  ]
1620
1632
  }
1621
1633
  ),
1622
- !ne && /* @__PURE__ */ Me(
1634
+ !re && /* @__PURE__ */ we(
1623
1635
  "div",
1624
1636
  {
1625
1637
  tabIndex: l ? -1 : 0,
1626
1638
  role: "slider",
1627
1639
  "aria-label": e.upperAriaLabel ?? "Range end",
1628
1640
  "aria-disabled": l ? "true" : void 0,
1629
- "aria-valuemin": ve,
1630
- "aria-valuemax": V,
1631
- "aria-valuenow": pe,
1632
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Gn, t) : gr(t, Gn, e.formatLabel, R),
1633
- "aria-orientation": s ? "vertical" : "horizontal",
1641
+ "aria-valuemin": Se,
1642
+ "aria-valuemax": I,
1643
+ "aria-valuenow": ye,
1644
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(jn, t) : gr(t, jn, e.formatLabel, x),
1645
+ "aria-orientation": c ? "vertical" : "horizontal",
1634
1646
  className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${_t}`,
1635
- style: Ri,
1636
- onPointerDown: Go("high"),
1637
- onKeyDown: Ko("high"),
1638
- onFocus: Xo("high"),
1639
- "data-active": v === "high" ? "true" : void 0,
1640
- "data-front": Ar ? "true" : void 0,
1647
+ style: Pi,
1648
+ onPointerDown: Jo("high"),
1649
+ onKeyDown: ea("high"),
1650
+ onFocus: Qo("high"),
1651
+ "data-active": Y === "high" ? "true" : void 0,
1652
+ "data-front": $r ? "true" : void 0,
1641
1653
  children: [
1642
- /* @__PURE__ */ I(
1654
+ /* @__PURE__ */ $(
1643
1655
  "div",
1644
1656
  {
1645
1657
  "data-testid": "period-slider-knob",
1646
- className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] dark:group-focus-visible:ring-blue-400 ${v === "high" ? "" : "shadow-md"}`
1658
+ className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] dark:group-focus-visible:ring-blue-400 ${Y === "high" ? "" : "shadow-md"}`
1647
1659
  }
1648
1660
  ),
1649
- g !== "hover" && /* @__PURE__ */ I(
1661
+ h !== "hover" && /* @__PURE__ */ $(
1650
1662
  "div",
1651
1663
  {
1652
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1653
- "data-tooltip-style": g,
1664
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1665
+ "data-tooltip-style": h,
1654
1666
  "data-label-position": D,
1655
- "data-slanted": Tr.isSlanted ? "true" : void 0,
1656
- "data-front": Ar ? "true" : void 0,
1657
- "data-duplicate": Nn && !Ar ? "true" : void 0,
1658
- ref: ja,
1659
- style: Xn.highStyle,
1660
- children: Ke(t, Gn, e.formatLabel, R)
1667
+ "data-slanted": Pr.isSlanted ? "true" : void 0,
1668
+ "data-front": $r ? "true" : void 0,
1669
+ "data-duplicate": On && !$r ? "true" : void 0,
1670
+ ref: ei,
1671
+ style: qn.highStyle,
1672
+ children: qe(t, jn, e.formatLabel, x)
1661
1673
  }
1662
1674
  )
1663
1675
  ]
@@ -1666,17 +1678,17 @@ const fl = (e, t) => {
1666
1678
  ] })
1667
1679
  }
1668
1680
  ),
1669
- f && aa(s ? "decrease" : "increase")
1681
+ g && da(c ? "decrease" : "increase")
1670
1682
  ]
1671
1683
  }
1672
1684
  );
1673
- }, so = (e, t) => {
1685
+ }, mo = (e, t) => {
1674
1686
  if (e === t) return !0;
1675
1687
  if (!(e && t) || e.length !== t.length) return !1;
1676
1688
  for (let r = 0; r < e.length; r++)
1677
1689
  if (e[r].getTime() !== t[r].getTime()) return !1;
1678
1690
  return !0;
1679
- }, xl = (e, t) => {
1691
+ }, Tl = (e, t) => {
1680
1692
  if (e === t) return !0;
1681
1693
  if (!(e && t)) return !1;
1682
1694
  const r = Object.keys(e), n = Object.keys(t);
@@ -1684,61 +1696,61 @@ const fl = (e, t) => {
1684
1696
  for (const o of r)
1685
1697
  if (e[o] !== t[o]) return !1;
1686
1698
  return !0;
1687
- }, Rl = (e, t) => e === t ? !0 : e.mode !== t.mode || e.unit !== t.unit || e.minDate.getTime() !== t.minDate.getTime() || e.maxDate.getTime() !== t.maxDate.getTime() || e.labelPosition !== t.labelPosition || e.autoSlantLabels !== t.autoSlantLabels || e.isVertical !== t.isVertical || e.hideConnectBar !== t.hideConnectBar || e.showTicks !== t.showTicks || e.disabled !== t.disabled || e.showStepper !== t.showStepper || e.debounceMs !== t.debounceMs || e.tooltipStyle !== t.tooltipStyle || e.colorScheme !== t.colorScheme || e.className !== t.className || !xl(e.style, t.style) || e.snapMode !== t.snapMode || e.formatLabel !== t.formatLabel || e.locale !== t.locale || e.lowerAriaLabel !== t.lowerAriaLabel || e.upperAriaLabel !== t.upperAriaLabel || e.pointAriaLabel !== t.pointAriaLabel || e.macroLowerAriaLabel !== t.macroLowerAriaLabel || e.macroUpperAriaLabel !== t.macroUpperAriaLabel || e.decreaseAriaLabel !== t.decreaseAriaLabel || e.increaseAriaLabel !== t.increaseAriaLabel || e.formatAriaValueText !== t.formatAriaValueText || !so(e.allowedDates, t.allowedDates) ? !1 : e.mode === "point" && t.mode === "point" ? !((e.value?.getTime() ?? null) !== (t.value?.getTime() ?? null) || (e.defaultValue?.getTime() ?? null) !== (t.defaultValue?.getTime() ?? null) || e.onChangePoint !== t.onChangePoint) : e.mode === "range" && t.mode === "range" ? !((e.range?.[0]?.getTime() ?? null) !== (t.range?.[0]?.getTime() ?? null) || (e.range?.[1]?.getTime() ?? null) !== (t.range?.[1]?.getTime() ?? null) || (e.defaultRange?.[0]?.getTime() ?? null) !== (t.defaultRange?.[0]?.getTime() ?? null) || (e.defaultRange?.[1]?.getTime() ?? null) !== (t.defaultRange?.[1]?.getTime() ?? null) || e.onChangeRange !== t.onChangeRange) : e.mode === "vernier" && t.mode === "vernier" ? !((e.microRange?.[0]?.getTime() ?? null) !== (t.microRange?.[0]?.getTime() ?? null) || (e.microRange?.[1]?.getTime() ?? null) !== (t.microRange?.[1]?.getTime() ?? null) || (e.defaultMicroRange?.[0]?.getTime() ?? null) !== (t.defaultMicroRange?.[0]?.getTime() ?? null) || (e.defaultMicroRange?.[1]?.getTime() ?? null) !== (t.defaultMicroRange?.[1]?.getTime() ?? null) || (e.microValue?.getTime() ?? null) !== (t.microValue?.getTime() ?? null) || (e.defaultMicroValue?.getTime() ?? null) !== (t.defaultMicroValue?.getTime() ?? null) || e.macroRange[0].getTime() !== t.macroRange[0].getTime() || e.macroRange[1].getTime() !== t.macroRange[1].getTime() || e.vernierOrientation !== t.vernierOrientation || e.showVernierProjection !== t.showVernierProjection || e.showVernierTicks !== t.showVernierTicks || e.showHairline !== t.showHairline || e.macroUnit !== t.macroUnit || e.microUnit !== t.microUnit || e.macroIsDiscrete !== t.macroIsDiscrete || e.microIsDiscrete !== t.microIsDiscrete || e.formatMacroLabel !== t.formatMacroLabel || e.formatMicroLabel !== t.formatMicroLabel || e.onChangeMicroRange !== t.onChangeMicroRange || e.onChangeMicroPoint !== t.onChangeMicroPoint || e.onChangeMacroRange !== t.onChangeMacroRange || !so(e.macroAllowedDates, t.macroAllowedDates) || !so(e.microAllowedDates, t.microAllowedDates)) : !1, Ll = Br(Dl, Rl);
1688
- Ll.displayName = "PeriodSlider";
1689
- const bt = (e) => {
1699
+ }, Pl = (e, t) => e === t ? !0 : e.mode !== t.mode || e.unit !== t.unit || e.minDate.getTime() !== t.minDate.getTime() || e.maxDate.getTime() !== t.maxDate.getTime() || e.labelPosition !== t.labelPosition || e.autoSlantLabels !== t.autoSlantLabels || e.isVertical !== t.isVertical || e.hideConnectBar !== t.hideConnectBar || e.showTicks !== t.showTicks || e.disabled !== t.disabled || e.showStepper !== t.showStepper || e.debounceMs !== t.debounceMs || e.tooltipStyle !== t.tooltipStyle || e.colorScheme !== t.colorScheme || e.className !== t.className || !Tl(e.style, t.style) || e.snapMode !== t.snapMode || e.formatLabel !== t.formatLabel || e.locale !== t.locale || e.lowerAriaLabel !== t.lowerAriaLabel || e.upperAriaLabel !== t.upperAriaLabel || e.pointAriaLabel !== t.pointAriaLabel || e.macroLowerAriaLabel !== t.macroLowerAriaLabel || e.macroUpperAriaLabel !== t.macroUpperAriaLabel || e.decreaseAriaLabel !== t.decreaseAriaLabel || e.increaseAriaLabel !== t.increaseAriaLabel || e.formatAriaValueText !== t.formatAriaValueText || !mo(e.allowedDates, t.allowedDates) ? !1 : e.mode === "point" && t.mode === "point" ? !((e.value?.getTime() ?? null) !== (t.value?.getTime() ?? null) || (e.defaultValue?.getTime() ?? null) !== (t.defaultValue?.getTime() ?? null) || e.onChangePoint !== t.onChangePoint) : e.mode === "range" && t.mode === "range" ? !((e.range?.[0]?.getTime() ?? null) !== (t.range?.[0]?.getTime() ?? null) || (e.range?.[1]?.getTime() ?? null) !== (t.range?.[1]?.getTime() ?? null) || (e.defaultRange?.[0]?.getTime() ?? null) !== (t.defaultRange?.[0]?.getTime() ?? null) || (e.defaultRange?.[1]?.getTime() ?? null) !== (t.defaultRange?.[1]?.getTime() ?? null) || e.onChangeRange !== t.onChangeRange) : e.mode === "vernier" && t.mode === "vernier" ? !((e.microRange?.[0]?.getTime() ?? null) !== (t.microRange?.[0]?.getTime() ?? null) || (e.microRange?.[1]?.getTime() ?? null) !== (t.microRange?.[1]?.getTime() ?? null) || (e.defaultMicroRange?.[0]?.getTime() ?? null) !== (t.defaultMicroRange?.[0]?.getTime() ?? null) || (e.defaultMicroRange?.[1]?.getTime() ?? null) !== (t.defaultMicroRange?.[1]?.getTime() ?? null) || (e.microValue?.getTime() ?? null) !== (t.microValue?.getTime() ?? null) || (e.defaultMicroValue?.getTime() ?? null) !== (t.defaultMicroValue?.getTime() ?? null) || e.macroRange[0].getTime() !== t.macroRange[0].getTime() || e.macroRange[1].getTime() !== t.macroRange[1].getTime() || e.vernierOrientation !== t.vernierOrientation || e.showVernierProjection !== t.showVernierProjection || e.showVernierTicks !== t.showVernierTicks || e.showHairline !== t.showHairline || e.macroUnit !== t.macroUnit || e.microUnit !== t.microUnit || e.macroIsDiscrete !== t.macroIsDiscrete || e.microIsDiscrete !== t.microIsDiscrete || e.formatMacroLabel !== t.formatMacroLabel || e.formatMicroLabel !== t.formatMicroLabel || e.onChangeMicroRange !== t.onChangeMicroRange || e.onChangeMicroPoint !== t.onChangeMicroPoint || e.onChangeMacroRange !== t.onChangeMacroRange || !mo(e.macroAllowedDates, t.macroAllowedDates) || !mo(e.microAllowedDates, t.microAllowedDates)) : !1, Al = Ur(yl, Pl);
1700
+ Al.displayName = "PeriodSlider";
1701
+ const gt = (e) => {
1690
1702
  const t = new Date(e);
1691
1703
  return t.setHours(0, 0, 0, 0), t;
1692
- }, Hr = (e, t) => {
1704
+ }, Fr = (e, t) => {
1693
1705
  if (Number.isNaN(t.getTime()))
1694
1706
  throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`);
1695
- }, Sl = (e) => {
1707
+ }, $l = (e) => {
1696
1708
  if (e !== void 0)
1697
1709
  try {
1698
1710
  Intl.DateTimeFormat.supportedLocalesOf([e]);
1699
1711
  } catch {
1700
1712
  throw new RangeError(`DateSelector: "locale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`);
1701
1713
  }
1702
- }, Ut = (e, t, r) => {
1714
+ }, Gt = (e, t, r) => {
1703
1715
  const n = new Date(e, t - 1, r);
1704
1716
  return n.setFullYear(e), n.setHours(0, 0, 0, 0), n;
1705
- }, ya = (e) => Ut(e, 1, 1), yl = (e) => Ut(e, 12, 31), Tl = {
1717
+ }, Ca = (e) => Gt(e, 1, 1), El = (e) => Gt(e, 12, 31), Il = {
1706
1718
  year: { year: "numeric" },
1707
1719
  month: { month: "2-digit" },
1708
1720
  day: { day: "2-digit" }
1709
- }, Pl = {
1721
+ }, Cl = {
1710
1722
  year: 4,
1711
1723
  month: 2,
1712
1724
  day: 2
1713
- }, Al = {
1725
+ }, Vl = {
1714
1726
  year: (e) => e.getFullYear(),
1715
1727
  month: (e) => e.getMonth() + 1,
1716
1728
  day: (e) => e.getDate()
1717
- }, Ta = /* @__PURE__ */ new Map(), $l = (e, t) => {
1718
- const r = `${e}\0${t}`, n = Ta.get(r);
1729
+ }, Va = /* @__PURE__ */ new Map(), Nl = (e, t) => {
1730
+ const r = `${e}\0${t}`, n = Va.get(r);
1719
1731
  if (n !== void 0) return n;
1720
- const o = new Intl.DateTimeFormat(t, Tl[e]);
1721
- return Ta.set(r, o), o;
1722
- }, co = (e, t, r) => r === void 0 ? String(Al[e](t)).padStart(Pl[e], "0") : $l(e, r).format(t), El = (e, t, r) => {
1732
+ const o = new Intl.DateTimeFormat(t, Il[e]);
1733
+ return Va.set(r, o), o;
1734
+ }, fo = (e, t, r) => r === void 0 ? String(Vl[e](t)).padStart(Cl[e], "0") : Nl(e, r).format(t), kl = (e, t, r) => {
1723
1735
  const n = t?.getTime() ?? null, o = r?.getTime() ?? null, i = /* @__PURE__ */ new Map();
1724
- return e.forEach((l, c) => {
1725
- Hr(`allowedDates[${c}]`, l);
1726
- const f = bt(l), g = f.getTime();
1727
- n !== null && g < n || o !== null && g > o || i.has(g) || i.set(g, f);
1728
- }), Array.from(i.keys()).sort((l, c) => l - c).map((l) => i.get(l));
1729
- }, Il = (e, t) => {
1736
+ return e.forEach((l, s) => {
1737
+ Fr(`allowedDates[${s}]`, l);
1738
+ const g = gt(l), h = g.getTime();
1739
+ n !== null && h < n || o !== null && h > o || i.has(h) || i.set(h, g);
1740
+ }), Array.from(i.keys()).sort((l, s) => l - s).map((l) => i.get(l));
1741
+ }, Yl = (e, t) => {
1730
1742
  const r = [];
1731
- let n = bt(e);
1732
- const o = bt(t).getTime();
1743
+ let n = gt(e);
1744
+ const o = gt(t).getTime();
1733
1745
  for (; n.getTime() <= o; )
1734
- r.push(n), n = bn(n, 1);
1746
+ r.push(n), n = vn(n, 1);
1735
1747
  return r;
1736
- }, Pa = (e, t) => {
1748
+ }, Na = (e, t) => {
1737
1749
  const r = [];
1738
1750
  for (let n = e.length - 1; n >= 0; n--)
1739
- r.push({ label: Ke("day", e[n], void 0, t), value: wr(e[n], "yyyy-MM-dd") });
1751
+ r.push({ label: qe("day", e[n], void 0, t), value: wr(e[n], "yyyy-MM-dd") });
1740
1752
  return r;
1741
- }, Cl = (e) => {
1753
+ }, Ol = (e) => {
1742
1754
  const {
1743
1755
  value: t,
1744
1756
  initialDate: r,
@@ -1746,188 +1758,188 @@ const bt = (e) => {
1746
1758
  children: o,
1747
1759
  minYear: i,
1748
1760
  maxYear: l,
1749
- minDate: c,
1750
- maxDate: f,
1751
- allowedDates: g,
1761
+ minDate: s,
1762
+ maxDate: g,
1763
+ allowedDates: h,
1752
1764
  variant: D = "date",
1753
- className: L = "",
1754
- style: s,
1755
- disabled: x = !1,
1765
+ className: R = "",
1766
+ style: c,
1767
+ disabled: M = !1,
1756
1768
  prevDateAriaLabel: Z = "Previous day",
1757
1769
  nextDateAriaLabel: ee = "Next day",
1758
- selectAriaLabel: R = "Date",
1759
- yearAriaLabel: de = "Year",
1760
- monthAriaLabel: oe = "Month",
1761
- dayAriaLabel: $ = "Day",
1762
- locale: H,
1763
- formatYearOption: W,
1764
- formatMonthOption: ae,
1765
- formatDayOption: q
1770
+ selectAriaLabel: x = "Date",
1771
+ yearAriaLabel: ue = "Year",
1772
+ monthAriaLabel: ne = "Month",
1773
+ dayAriaLabel: P = "Day",
1774
+ locale: O,
1775
+ formatYearOption: G,
1776
+ formatMonthOption: ie,
1777
+ formatDayOption: j
1766
1778
  } = e;
1767
- if (Sl(H), t !== void 0 && Hr("value", t), r !== void 0 && Hr("initialDate", r), c !== void 0 && Hr("minDate", c), f !== void 0 && Hr("maxDate", f), i !== void 0 && !Number.isInteger(i))
1779
+ if ($l(O), t !== void 0 && Fr("value", t), r !== void 0 && Fr("initialDate", r), s !== void 0 && Fr("minDate", s), g !== void 0 && Fr("maxDate", g), i !== void 0 && !Number.isInteger(i))
1768
1780
  throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(i)})`);
1769
1781
  if (l !== void 0 && !Number.isInteger(l))
1770
1782
  throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(l)})`);
1771
- if (D === "split-dropdown" && g !== void 0)
1783
+ if (D === "split-dropdown" && h !== void 0)
1772
1784
  throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');
1773
- const G = t ?? r;
1774
- if (G === void 0)
1785
+ const X = t ?? r;
1786
+ if (X === void 0)
1775
1787
  throw new RangeError("DateSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected date is never inferred from the wall clock.");
1776
- const [y, S] = ye(() => bt(G)), T = t !== void 0, Y = t?.getTime(), V = C(() => t !== void 0 ? bt(t) : y, [Y, y]), ne = c?.getTime(), ue = f?.getTime(), X = C(() => {
1777
- const w = c ? bt(c) : null, h = i !== void 0 ? ya(i) : null;
1778
- return w === null ? h : h === null || w.getTime() >= h.getTime() ? w : h;
1779
- }, [ne, i]), J = C(() => {
1780
- const w = f ? bt(f) : null, h = l !== void 0 ? yl(l) : null;
1781
- return w === null ? h : h === null || w.getTime() <= h.getTime() ? w : h;
1782
- }, [ue, l]), z = X?.getTime() ?? null, F = J?.getTime() ?? null;
1783
- if (X !== null && J !== null && X.getTime() > J.getTime())
1784
- throw new RangeError(`DateSelector: the resolved range is empty (min ${wr(X, "yyyy-MM-dd")} is after max ${wr(J, "yyyy-MM-dd")})`);
1785
- if (D !== "date" && g === void 0 && (X === null || J === null))
1788
+ const [S, L] = Pe(() => gt(X)), y = t !== void 0, k = t?.getTime(), I = E(() => t !== void 0 ? gt(t) : S, [k, S]), re = s?.getTime(), ce = g?.getTime(), K = E(() => {
1789
+ const d = s ? gt(s) : null, W = i !== void 0 ? Ca(i) : null;
1790
+ return d === null ? W : W === null || d.getTime() >= W.getTime() ? d : W;
1791
+ }, [re, i]), J = E(() => {
1792
+ const d = g ? gt(g) : null, W = l !== void 0 ? El(l) : null;
1793
+ return d === null ? W : W === null || d.getTime() <= W.getTime() ? d : W;
1794
+ }, [ce, l]), B = K?.getTime() ?? null, H = J?.getTime() ?? null;
1795
+ if (K !== null && J !== null && K.getTime() > J.getTime())
1796
+ throw new RangeError(`DateSelector: the resolved range is empty (min ${wr(K, "yyyy-MM-dd")} is after max ${wr(J, "yyyy-MM-dd")})`);
1797
+ if (D !== "date" && h === void 0 && (K === null || J === null))
1786
1798
  throw new RangeError(`DateSelector: variant="${D}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${D === "dropdown" ? ' or supply "allowedDates"' : ""}`);
1787
- const fe = g === void 0 ? null : g.map((w) => w.getTime()).join(","), ge = C(() => g === void 0 ? null : El(g, X, J), [fe, z, F]), le = (w) => {
1788
- const h = w.getTime();
1789
- return ge !== null ? ge.some((b) => b.getTime() === h) : !(z !== null && h < z || F !== null && h > F);
1790
- }, ze = G.getTime();
1791
- lt(() => {
1792
- T || S(bt(G));
1793
- }, [T, ze]);
1794
- const Ee = (w) => {
1795
- if (x) return;
1796
- const h = bt(w);
1797
- le(h) && (T || S(h), n?.(h));
1798
- }, Te = V.getTime(), Pe = le(V), qe = C(() => {
1799
- if (ge !== null) {
1800
- for (let h = ge.length - 1; h >= 0; h--)
1801
- if (ge[h].getTime() < Te) return ge[h];
1799
+ const de = h === void 0 ? null : h.map((d) => d.getTime()).join(","), me = E(() => h === void 0 ? null : kl(h, K, J), [de, B, H]), De = (d) => {
1800
+ const W = d.getTime();
1801
+ return me !== null ? me.some((je) => je.getTime() === W) : !(B !== null && W < B || H !== null && W > H);
1802
+ }, Ge = X.getTime();
1803
+ it(() => {
1804
+ y || L(gt(X));
1805
+ }, [y, Ge]);
1806
+ const Me = (d) => {
1807
+ if (M) return;
1808
+ const W = gt(d);
1809
+ De(W) && (y || L(W), n?.(W));
1810
+ }, pe = I.getTime(), Le = De(I), He = E(() => {
1811
+ if (me !== null) {
1812
+ for (let W = me.length - 1; W >= 0; W--)
1813
+ if (me[W].getTime() < pe) return me[W];
1802
1814
  return null;
1803
1815
  }
1804
- const w = bn(new Date(Te), -1);
1805
- return le(w) ? w : null;
1806
- }, [ge, Te, z, F]), Be = C(() => {
1807
- if (ge !== null) {
1808
- for (const h of ge)
1809
- if (h.getTime() > Te) return h;
1816
+ const d = vn(new Date(pe), -1);
1817
+ return De(d) ? d : null;
1818
+ }, [me, pe, B, H]), Fe = E(() => {
1819
+ if (me !== null) {
1820
+ for (const W of me)
1821
+ if (W.getTime() > pe) return W;
1810
1822
  return null;
1811
1823
  }
1812
- const w = bn(new Date(Te), 1);
1813
- return le(w) ? w : null;
1814
- }, [ge, Te, z, F]), tt = () => {
1815
- qe !== null && Ee(qe);
1816
- }, Ue = () => {
1817
- Be !== null && Ee(Be);
1818
- }, st = (w) => {
1819
- if (w.target.value) {
1820
- const h = da(w.target.value);
1821
- Number.isNaN(h.getTime()) || Ee(h);
1824
+ const d = vn(new Date(pe), 1);
1825
+ return De(d) ? d : null;
1826
+ }, [me, pe, B, H]), rt = () => {
1827
+ He !== null && Me(He);
1828
+ }, ht = () => {
1829
+ Fe !== null && Me(Fe);
1830
+ }, lt = (d) => {
1831
+ if (d.target.value) {
1832
+ const W = wa(d.target.value);
1833
+ Number.isNaN(W.getTime()) || Me(W);
1822
1834
  }
1823
- }, K = (w) => {
1824
- if (w.target.value) {
1825
- const h = da(w.target.value);
1826
- Number.isNaN(h.getTime()) || Ee(h);
1835
+ }, q = (d) => {
1836
+ if (d.target.value) {
1837
+ const W = wa(d.target.value);
1838
+ Number.isNaN(W.getTime()) || Me(W);
1827
1839
  }
1828
- }, B = V.getFullYear(), te = V.getMonth() + 1, v = V.getDate(), O = C(() => D !== "dropdown" ? [] : ge !== null ? Pa(ge, H) : X === null || J === null ? [] : Pa(Il(X, J), H), [D, ge, z, F, H]), M = C(() => {
1829
- if (D !== "split-dropdown" || X === null || J === null) return [];
1830
- const w = [];
1831
- for (let h = J.getFullYear(); h >= X.getFullYear(); h--)
1832
- w.push(h);
1833
- return w;
1834
- }, [D, z, F]), j = C(() => {
1835
- if (D !== "split-dropdown" || X === null || J === null) return [];
1836
- const w = X, h = J, b = B === w.getFullYear() ? w.getMonth() + 1 : 1, kt = B === h.getFullYear() ? h.getMonth() + 1 : 12, nt = [];
1837
- for (let ct = b; ct <= kt; ct++)
1838
- nt.push(ct);
1839
- return nt;
1840
- }, [D, z, F, B]), me = C(() => {
1841
- if (D !== "split-dropdown" || X === null || J === null) return [];
1842
- const w = X, h = J, b = B === w.getFullYear() && te === w.getMonth() + 1 ? w.getDate() : 1, kt = B === h.getFullYear() && te === h.getMonth() + 1 ? h.getDate() : ua(new Date(Te)), nt = [];
1843
- for (let ct = b; ct <= kt; ct++)
1844
- nt.push(ct);
1845
- return nt;
1846
- }, [D, z, F, Te, B, te]), we = (w, h, b) => b > ua(Ut(w, h, 1)) ? !1 : le(Ut(w, h, b)), Ae = (w, h, b) => {
1847
- we(w, h, b) && Ee(Ut(w, h, b));
1848
- }, He = (w) => W ? W(w) : co("year", ya(w), H), rt = (w) => ae ? ae(w) : co("month", Ut(B, w, 1), H), ve = (w) => q ? q(w) : co("day", Ut(B, te, w), H), pe = wr(V, "yyyy-MM-dd"), Ur = Ke("day", V, void 0, H), se = X ? wr(X, "yyyy-MM-dd") : void 0, Nt = J ? wr(J, "yyyy-MM-dd") : void 0, A = Pe ? pe : "", Gt = "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";
1849
- return /* @__PURE__ */ Me("div", { className: `inline-flex items-center ${zr} ${L}`, style: s, "data-variant": D, "data-out-of-range": Pe ? void 0 : "true", children: [
1850
- /* @__PURE__ */ I(Wt, { neighbour: "control", direction: "left", disabled: x, canStep: qe !== null, onStep: tt, ariaLabel: Z }),
1851
- D === "dropdown" ? /* @__PURE__ */ Me("select", { "aria-label": R, disabled: x, className: "w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", value: A, onChange: K, children: [
1852
- Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Gt, children: Ur }),
1853
- O.map((w) => /* @__PURE__ */ I("option", { value: w.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: w.label }, w.value))
1854
- ] }) : D === "split-dropdown" ? /* @__PURE__ */ Me("div", { className: "inline-flex items-center gap-1", children: [
1855
- /* @__PURE__ */ Me(
1840
+ }, U = I.getFullYear(), oe = I.getMonth() + 1, p = I.getDate(), N = E(() => D !== "dropdown" ? [] : me !== null ? Na(me, O) : K === null || J === null ? [] : Na(Yl(K, J), O), [D, me, B, H, O]), v = E(() => {
1841
+ if (D !== "split-dropdown" || K === null || J === null) return [];
1842
+ const d = [];
1843
+ for (let W = J.getFullYear(); W >= K.getFullYear(); W--)
1844
+ d.push(W);
1845
+ return d;
1846
+ }, [D, B, H]), Y = E(() => {
1847
+ if (D !== "split-dropdown" || K === null || J === null) return [];
1848
+ const d = K, W = J, je = U === d.getFullYear() ? d.getMonth() + 1 : 1, Lt = U === W.getFullYear() ? W.getMonth() + 1 : 12, F = [];
1849
+ for (let b = je; b <= Lt; b++)
1850
+ F.push(b);
1851
+ return F;
1852
+ }, [D, B, H, U]), he = E(() => {
1853
+ if (D !== "split-dropdown" || K === null || J === null) return [];
1854
+ const d = K, W = J, je = U === d.getFullYear() && oe === d.getMonth() + 1 ? d.getDate() : 1, Lt = U === W.getFullYear() && oe === W.getMonth() + 1 ? W.getDate() : ba(new Date(pe)), F = [];
1855
+ for (let b = je; b <= Lt; b++)
1856
+ F.push(b);
1857
+ return F;
1858
+ }, [D, B, H, pe, U, oe]), be = (d, W, je) => je > ba(Gt(d, W, 1)) ? !1 : De(Gt(d, W, je)), $e = (d, W, je) => {
1859
+ be(d, W, je) && Me(Gt(d, W, je));
1860
+ }, Ie = (d) => G ? G(d) : fo("year", Ca(d), O), _e = (d) => ie ? ie(d) : fo("month", Gt(U, d, 1), O), Rt = (d) => j ? j(d) : fo("day", Gt(U, oe, d), O), bt = wr(I, "yyyy-MM-dd"), Wr = qe("day", I, void 0, O), Se = K ? wr(K, "yyyy-MM-dd") : void 0, ye = J ? wr(J, "yyyy-MM-dd") : void 0, Gr = Le ? bt : "", ae = "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";
1861
+ return /* @__PURE__ */ we("div", { className: `inline-flex items-center ${Br} ${R}`, style: c, "data-variant": D, "data-out-of-range": Le ? void 0 : "true", children: [
1862
+ /* @__PURE__ */ $(Xt, { neighbour: "control", direction: "left", disabled: M, canStep: He !== null, onStep: rt, ariaLabel: Z }),
1863
+ D === "dropdown" ? /* @__PURE__ */ we("select", { "aria-label": x, disabled: M, className: "w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", value: Gr, onChange: q, children: [
1864
+ Le ? null : /* @__PURE__ */ $("option", { value: "", disabled: !0, className: ae, children: Wr }),
1865
+ N.map((d) => /* @__PURE__ */ $("option", { value: d.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: d.label }, d.value))
1866
+ ] }) : D === "split-dropdown" ? /* @__PURE__ */ we("div", { className: "inline-flex items-center gap-1", children: [
1867
+ /* @__PURE__ */ we(
1856
1868
  "select",
1857
1869
  {
1858
- "aria-label": de,
1859
- disabled: x,
1870
+ "aria-label": ue,
1871
+ disabled: M,
1860
1872
  className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
1861
- value: Pe ? B : "",
1862
- onChange: (w) => Ae(Number(w.target.value), te, v),
1873
+ value: Le ? U : "",
1874
+ onChange: (d) => $e(Number(d.target.value), oe, p),
1863
1875
  children: [
1864
- Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Gt, children: He(B) }),
1865
- M.map((w) => /* @__PURE__ */ I("option", { value: w, disabled: !we(w, te, v), className: "dark:bg-slate-700 dark:text-slate-100", children: He(w) }, w))
1876
+ Le ? null : /* @__PURE__ */ $("option", { value: "", disabled: !0, className: ae, children: Ie(U) }),
1877
+ v.map((d) => /* @__PURE__ */ $("option", { value: d, disabled: !be(d, oe, p), className: "dark:bg-slate-700 dark:text-slate-100", children: Ie(d) }, d))
1866
1878
  ]
1867
1879
  }
1868
1880
  ),
1869
- /* @__PURE__ */ Me(
1881
+ /* @__PURE__ */ we(
1870
1882
  "select",
1871
1883
  {
1872
- "aria-label": oe,
1873
- disabled: x,
1884
+ "aria-label": ne,
1885
+ disabled: M,
1874
1886
  className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
1875
- value: Pe ? te : "",
1876
- onChange: (w) => Ae(B, Number(w.target.value), v),
1887
+ value: Le ? oe : "",
1888
+ onChange: (d) => $e(U, Number(d.target.value), p),
1877
1889
  children: [
1878
- Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Gt, children: rt(te) }),
1879
- j.map((w) => /* @__PURE__ */ I("option", { value: w, disabled: !we(B, w, v), className: "dark:bg-slate-700 dark:text-slate-100", children: rt(w) }, w))
1890
+ Le ? null : /* @__PURE__ */ $("option", { value: "", disabled: !0, className: ae, children: _e(oe) }),
1891
+ Y.map((d) => /* @__PURE__ */ $("option", { value: d, disabled: !be(U, d, p), className: "dark:bg-slate-700 dark:text-slate-100", children: _e(d) }, d))
1880
1892
  ]
1881
1893
  }
1882
1894
  ),
1883
- /* @__PURE__ */ Me(
1895
+ /* @__PURE__ */ we(
1884
1896
  "select",
1885
1897
  {
1886
- "aria-label": $,
1887
- disabled: x,
1898
+ "aria-label": P,
1899
+ disabled: M,
1888
1900
  className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
1889
- value: Pe ? v : "",
1890
- onChange: (w) => Ae(B, te, Number(w.target.value)),
1901
+ value: Le ? p : "",
1902
+ onChange: (d) => $e(U, oe, Number(d.target.value)),
1891
1903
  children: [
1892
- Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Gt, children: ve(v) }),
1893
- me.map((w) => /* @__PURE__ */ I("option", { value: w, className: "dark:bg-slate-700 dark:text-slate-100", children: ve(w) }, w))
1904
+ Le ? null : /* @__PURE__ */ $("option", { value: "", disabled: !0, className: ae, children: Rt(p) }),
1905
+ he.map((d) => /* @__PURE__ */ $("option", { value: d, className: "dark:bg-slate-700 dark:text-slate-100", children: Rt(d) }, d))
1894
1906
  ]
1895
1907
  }
1896
1908
  )
1897
- ] }) : /* @__PURE__ */ I(
1909
+ ] }) : /* @__PURE__ */ $(
1898
1910
  "input",
1899
1911
  {
1900
- "aria-label": R,
1901
- disabled: x,
1912
+ "aria-label": x,
1913
+ disabled: M,
1902
1914
  className: "period-slider-native-date-field w-28 rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",
1903
- value: pe,
1904
- min: se,
1905
- max: Nt,
1906
- onChange: st,
1915
+ value: bt,
1916
+ min: Se,
1917
+ max: ye,
1918
+ onChange: lt,
1907
1919
  type: "date"
1908
1920
  }
1909
1921
  ),
1910
- /* @__PURE__ */ I(Wt, { neighbour: "control", direction: "right", disabled: x, canStep: Be !== null, onStep: Ue, ariaLabel: ee }),
1922
+ /* @__PURE__ */ $(Xt, { neighbour: "control", direction: "right", disabled: M, canStep: Fe !== null, onStep: ht, ariaLabel: ee }),
1911
1923
  o
1912
1924
  ] });
1913
- }, br = (e) => e === void 0 ? null : bt(e).getTime(), Vl = Br(Cl, (e, t) => !(br(e.value ?? e.initialDate) !== br(t.value ?? t.initialDate) || br(e.minDate) !== br(t.minDate) || br(e.maxDate) !== br(t.maxDate) || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.onChange !== t.onChange || e.allowedDates !== t.allowedDates || e.children !== t.children || e.prevDateAriaLabel !== t.prevDateAriaLabel || e.nextDateAriaLabel !== t.nextDateAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.yearAriaLabel !== t.yearAriaLabel || e.monthAriaLabel !== t.monthAriaLabel || e.dayAriaLabel !== t.dayAriaLabel || e.locale !== t.locale || e.formatYearOption !== t.formatYearOption || e.formatMonthOption !== t.formatMonthOption || e.formatDayOption !== t.formatDayOption));
1914
- Vl.displayName = "DateSelector";
1915
- function Qe(e, t) {
1925
+ }, br = (e) => e === void 0 ? null : gt(e).getTime(), Hl = Ur(Ol, (e, t) => !(br(e.value ?? e.initialDate) !== br(t.value ?? t.initialDate) || br(e.minDate) !== br(t.minDate) || br(e.maxDate) !== br(t.maxDate) || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.onChange !== t.onChange || e.allowedDates !== t.allowedDates || e.children !== t.children || e.prevDateAriaLabel !== t.prevDateAriaLabel || e.nextDateAriaLabel !== t.nextDateAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.yearAriaLabel !== t.yearAriaLabel || e.monthAriaLabel !== t.monthAriaLabel || e.dayAriaLabel !== t.dayAriaLabel || e.locale !== t.locale || e.formatYearOption !== t.formatYearOption || e.formatMonthOption !== t.formatMonthOption || e.formatDayOption !== t.formatDayOption));
1926
+ Hl.displayName = "DateSelector";
1927
+ function et(e, t) {
1916
1928
  const r = e + Math.floor(t / 12), n = (t % 12 + 12) % 12, o = new Date(r, n, 1);
1917
1929
  return o.setFullYear(r), o;
1918
1930
  }
1919
- function Bt(e) {
1931
+ function Wt(e) {
1920
1932
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
1921
1933
  }
1922
- function Yr(e, t) {
1934
+ function Or(e, t) {
1923
1935
  if (e !== void 0 && (!(e instanceof Date) || Number.isNaN(e.getTime())))
1924
1936
  throw new RangeError(`MonthSelector: \`${t}\` must be a valid Date, received ${String(e)}.`);
1925
1937
  }
1926
- function Aa(e, t) {
1938
+ function ka(e, t) {
1927
1939
  if (e !== void 0 && !Number.isInteger(e))
1928
1940
  throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`);
1929
1941
  }
1930
- function Nl(e) {
1942
+ function Fl(e) {
1931
1943
  if (e !== void 0)
1932
1944
  try {
1933
1945
  Intl.DateTimeFormat.supportedLocalesOf([e]);
@@ -1935,35 +1947,35 @@ function Nl(e) {
1935
1947
  throw new RangeError(`MonthSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`);
1936
1948
  }
1937
1949
  }
1938
- function kl(e, t) {
1939
- const r = e === void 0 ? null : Qe(e, 0), n = t === void 0 ? null : Qe(t.getFullYear(), t.getMonth());
1950
+ function _l(e, t) {
1951
+ const r = e === void 0 ? null : et(e, 0), n = t === void 0 ? null : et(t.getFullYear(), t.getMonth());
1940
1952
  return r !== null && n !== null ? r >= n ? r : n : r !== null ? r : n;
1941
1953
  }
1942
- function Yl(e, t) {
1943
- const r = e === void 0 ? null : Qe(e, 11), n = t === void 0 ? null : Qe(t.getFullYear(), t.getMonth());
1954
+ function zl(e, t) {
1955
+ const r = e === void 0 ? null : et(e, 11), n = t === void 0 ? null : et(t.getFullYear(), t.getMonth());
1944
1956
  return r !== null && n !== null ? r <= n ? r : n : r !== null ? r : n;
1945
1957
  }
1946
- function Ol(e, t, r) {
1958
+ function Bl(e, t, r) {
1947
1959
  const n = /* @__PURE__ */ new Map();
1948
1960
  for (const o of e) {
1949
- const i = Qe(o.getFullYear(), o.getMonth());
1961
+ const i = et(o.getFullYear(), o.getMonth());
1950
1962
  t !== null && i < t || r !== null && i > r || n.has(i.getTime()) || n.set(i.getTime(), i);
1951
1963
  }
1952
1964
  return Array.from(n.values()).sort((o, i) => o.getTime() - i.getTime());
1953
1965
  }
1954
- function Hl(e, t) {
1966
+ function Ul(e, t) {
1955
1967
  const r = e.getFullYear() * 12 + e.getMonth(), n = t.getFullYear() * 12 + t.getMonth(), o = [];
1956
1968
  for (let i = r; i <= n; i++)
1957
- o.push(Qe(Math.floor(i / 12), i % 12));
1969
+ o.push(et(Math.floor(i / 12), i % 12));
1958
1970
  return o;
1959
1971
  }
1960
- function $a(e, t) {
1972
+ function Ya(e, t) {
1961
1973
  const r = [];
1962
1974
  for (let n = e.length - 1; n >= 0; n--)
1963
- r.push({ label: Ke("month", e[n], void 0, t), value: Bt(e[n]) });
1975
+ r.push({ label: qe("month", e[n], void 0, t), value: Wt(e[n]) });
1964
1976
  return r;
1965
1977
  }
1966
- const Fl = (e) => {
1978
+ const Wl = (e) => {
1967
1979
  const {
1968
1980
  value: t,
1969
1981
  initialDate: r,
@@ -1971,638 +1983,638 @@ const Fl = (e) => {
1971
1983
  children: o,
1972
1984
  variant: i = "date",
1973
1985
  minYear: l,
1974
- maxYear: c,
1975
- minDate: f,
1976
- maxDate: g,
1986
+ maxYear: s,
1987
+ minDate: g,
1988
+ maxDate: h,
1977
1989
  allowedMonths: D,
1978
- isWarning: L = !1,
1979
- className: s = "",
1980
- style: x,
1990
+ isWarning: R = !1,
1991
+ className: c = "",
1992
+ style: M,
1981
1993
  disabled: Z = !1,
1982
1994
  prevMonthAriaLabel: ee = "Previous month",
1983
- nextMonthAriaLabel: R = "Next month",
1984
- selectAriaLabel: de = "Month",
1985
- locale: oe
1995
+ nextMonthAriaLabel: x = "Next month",
1996
+ selectAriaLabel: ue = "Month",
1997
+ locale: ne
1986
1998
  } = e;
1987
- Nl(oe), Yr(t, "value"), Yr(r, "initialDate"), Yr(f, "minDate"), Yr(g, "maxDate"), Aa(l, "minYear"), Aa(c, "maxYear"), D?.forEach((M, j) => {
1988
- Yr(M, `allowedMonths[${j}]`);
1999
+ Fl(ne), Or(t, "value"), Or(r, "initialDate"), Or(g, "minDate"), Or(h, "maxDate"), ka(l, "minYear"), ka(s, "maxYear"), D?.forEach((v, Y) => {
2000
+ Or(v, `allowedMonths[${Y}]`);
1989
2001
  });
1990
- const $ = t ?? r;
1991
- if ($ === void 0)
2002
+ const P = t ?? r;
2003
+ if (P === void 0)
1992
2004
  throw new RangeError("MonthSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected month is never inferred from the wall clock.");
1993
- const [H, W] = ye(() => Qe($.getFullYear(), $.getMonth())), ae = t !== void 0, q = C(() => t !== void 0 ? Qe(t.getFullYear(), t.getMonth()) : H, [t?.getTime(), H]), G = f?.getTime(), y = g?.getTime(), S = C(() => kl(l, f), [l, G]), T = C(() => Yl(c, g), [c, y]), Y = S?.getTime() ?? null, V = T?.getTime() ?? null;
1994
- if (S !== null && T !== null && S > T)
1995
- throw new RangeError(`MonthSelector: the resolved lower bound ${Bt(S)} is after the resolved upper bound ${Bt(T)}.`);
1996
- if (i === "dropdown" && D === void 0 && (S === null || T === null))
2005
+ const [O, G] = Pe(() => et(P.getFullYear(), P.getMonth())), ie = t !== void 0, j = E(() => t !== void 0 ? et(t.getFullYear(), t.getMonth()) : O, [t?.getTime(), O]), X = g?.getTime(), S = h?.getTime(), L = E(() => _l(l, g), [l, X]), y = E(() => zl(s, h), [s, S]), k = L?.getTime() ?? null, I = y?.getTime() ?? null;
2006
+ if (L !== null && y !== null && L > y)
2007
+ throw new RangeError(`MonthSelector: the resolved lower bound ${Wt(L)} is after the resolved upper bound ${Wt(y)}.`);
2008
+ if (i === "dropdown" && D === void 0 && (L === null || y === null))
1997
2009
  throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`), or `allowedMonths`; the option window is never invented.');
1998
- const ne = D === void 0 ? null : D.map((M) => M.getTime()).join(","), ue = C(() => D === void 0 ? null : Ol(D, S, T), [ne, Y, V]), X = (M) => {
1999
- const j = M.getTime();
2000
- return ue !== null ? ue.some((me) => me.getTime() === j) : !(Y !== null && j < Y || V !== null && j > V);
2001
- }, J = $.getTime();
2002
- lt(() => {
2003
- if (ae) return;
2004
- const M = Qe($.getFullYear(), $.getMonth());
2005
- W((j) => j.getTime() === M.getTime() ? j : M);
2006
- }, [ae, J]);
2007
- const z = (M) => {
2010
+ const re = D === void 0 ? null : D.map((v) => v.getTime()).join(","), ce = E(() => D === void 0 ? null : Bl(D, L, y), [re, k, I]), K = (v) => {
2011
+ const Y = v.getTime();
2012
+ return ce !== null ? ce.some((he) => he.getTime() === Y) : !(k !== null && Y < k || I !== null && Y > I);
2013
+ }, J = P.getTime();
2014
+ it(() => {
2015
+ if (ie) return;
2016
+ const v = et(P.getFullYear(), P.getMonth());
2017
+ G((Y) => Y.getTime() === v.getTime() ? Y : v);
2018
+ }, [ie, J]);
2019
+ const B = (v) => {
2008
2020
  if (Z) return;
2009
- if (!X(M))
2010
- throw new RangeError(`MonthSelector: refusing to emit ${Bt(M)}, which lies outside the selectable months.`);
2011
- ae || W(M);
2012
- const j = M.getFullYear() * 100 + (M.getMonth() + 1);
2013
- n?.(M, j);
2014
- }, F = q.getTime(), fe = X(q), ge = C(() => {
2015
- if (ue !== null) {
2016
- for (let j = ue.length - 1; j >= 0; j--)
2017
- if (ue[j].getTime() < F) return ue[j];
2021
+ if (!K(v))
2022
+ throw new RangeError(`MonthSelector: refusing to emit ${Wt(v)}, which lies outside the selectable months.`);
2023
+ ie || G(v);
2024
+ const Y = v.getFullYear() * 100 + (v.getMonth() + 1);
2025
+ n?.(v, Y);
2026
+ }, H = j.getTime(), de = K(j), me = E(() => {
2027
+ if (ce !== null) {
2028
+ for (let Y = ce.length - 1; Y >= 0; Y--)
2029
+ if (ce[Y].getTime() < H) return ce[Y];
2018
2030
  return null;
2019
2031
  }
2020
- const M = Qe(q.getFullYear(), q.getMonth() - 1);
2021
- return X(M) ? M : null;
2022
- }, [ue, F, Y, V]), le = C(() => {
2023
- if (ue !== null) {
2024
- for (const j of ue)
2025
- if (j.getTime() > F) return j;
2032
+ const v = et(j.getFullYear(), j.getMonth() - 1);
2033
+ return K(v) ? v : null;
2034
+ }, [ce, H, k, I]), De = E(() => {
2035
+ if (ce !== null) {
2036
+ for (const Y of ce)
2037
+ if (Y.getTime() > H) return Y;
2026
2038
  return null;
2027
2039
  }
2028
- const M = Qe(q.getFullYear(), q.getMonth() + 1);
2029
- return X(M) ? M : null;
2030
- }, [ue, F, Y, V]), ze = () => {
2031
- ge !== null && z(ge);
2032
- }, Ee = () => {
2033
- le !== null && z(le);
2034
- }, Te = (M) => {
2035
- if (!M) return;
2036
- const [j, me] = M.split("-"), we = Number(j), Ae = Number(me) - 1;
2037
- if (!(Number.isInteger(we) && Number.isInteger(Ae))) return;
2038
- const He = Qe(we, Ae);
2039
- X(He) && z(He);
2040
- }, Pe = (M) => {
2041
- Te(M.target.value);
2042
- }, qe = (M) => {
2043
- Te(M.target.value);
2044
- }, Be = Bt(q), tt = Ke("month", q, void 0, oe), Ue = S ? Bt(S) : void 0, st = T ? Bt(T) : void 0, K = C(() => i !== "dropdown" ? [] : ue !== null ? $a(ue, oe) : S === null || T === null ? [] : $a(Hl(S, T), oe), [i, ue, Y, V, oe]), B = fe ? Be : "", te = L ? "border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200" : "border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", v = `period-slider-native-date-field w-28 rounded-md border py-0.5 px-1 text-center font-mono text-xs tabular-nums dark:placeholder:text-gray-400 disabled:opacity-50 ${te}`, O = `w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${te}`;
2045
- return /* @__PURE__ */ Me("div", { className: `inline-flex items-center ${zr} ${s}`, style: x, "data-out-of-range": fe ? void 0 : "true", children: [
2046
- /* @__PURE__ */ I(Wt, { neighbour: "control", direction: "left", disabled: Z, canStep: ge !== null, onStep: ze, ariaLabel: ee }),
2047
- i === "dropdown" ? /* @__PURE__ */ Me("select", { "aria-label": de, disabled: Z, className: O, value: B, onChange: qe, children: [
2048
- fe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400", children: tt }),
2049
- K.map((M) => /* @__PURE__ */ I("option", { value: M.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: M.label }, M.value))
2050
- ] }) : /* @__PURE__ */ I("input", { "aria-label": de, disabled: Z, className: v, value: Be, min: Ue, max: st, onChange: Pe, type: "month" }),
2051
- /* @__PURE__ */ I(Wt, { neighbour: "control", direction: "right", disabled: Z, canStep: le !== null, onStep: Ee, ariaLabel: R }),
2040
+ const v = et(j.getFullYear(), j.getMonth() + 1);
2041
+ return K(v) ? v : null;
2042
+ }, [ce, H, k, I]), Ge = () => {
2043
+ me !== null && B(me);
2044
+ }, Me = () => {
2045
+ De !== null && B(De);
2046
+ }, pe = (v) => {
2047
+ if (!v) return;
2048
+ const [Y, he] = v.split("-"), be = Number(Y), $e = Number(he) - 1;
2049
+ if (!(Number.isInteger(be) && Number.isInteger($e))) return;
2050
+ const Ie = et(be, $e);
2051
+ K(Ie) && B(Ie);
2052
+ }, Le = (v) => {
2053
+ pe(v.target.value);
2054
+ }, He = (v) => {
2055
+ pe(v.target.value);
2056
+ }, Fe = Wt(j), rt = qe("month", j, void 0, ne), ht = L ? Wt(L) : void 0, lt = y ? Wt(y) : void 0, q = E(() => i !== "dropdown" ? [] : ce !== null ? Ya(ce, ne) : L === null || y === null ? [] : Ya(Ul(L, y), ne), [i, ce, k, I, ne]), U = de ? Fe : "", oe = R ? "border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200" : "border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", p = `period-slider-native-date-field w-28 rounded-md border py-0.5 px-1 text-center font-mono text-xs tabular-nums dark:placeholder:text-gray-400 disabled:opacity-50 ${oe}`, N = `w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${oe}`;
2057
+ return /* @__PURE__ */ we("div", { className: `inline-flex items-center ${Br} ${c}`, style: M, "data-out-of-range": de ? void 0 : "true", children: [
2058
+ /* @__PURE__ */ $(Xt, { neighbour: "control", direction: "left", disabled: Z, canStep: me !== null, onStep: Ge, ariaLabel: ee }),
2059
+ i === "dropdown" ? /* @__PURE__ */ we("select", { "aria-label": ue, disabled: Z, className: N, value: U, onChange: He, children: [
2060
+ de ? null : /* @__PURE__ */ $("option", { value: "", disabled: !0, className: "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400", children: rt }),
2061
+ q.map((v) => /* @__PURE__ */ $("option", { value: v.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: v.label }, v.value))
2062
+ ] }) : /* @__PURE__ */ $("input", { "aria-label": ue, disabled: Z, className: p, value: Fe, min: ht, max: lt, onChange: Le, type: "month" }),
2063
+ /* @__PURE__ */ $(Xt, { neighbour: "control", direction: "right", disabled: Z, canStep: De !== null, onStep: Me, ariaLabel: x }),
2052
2064
  o
2053
2065
  ] });
2054
- }, _l = Br(Fl, (e, t) => {
2066
+ }, Gl = Ur(Wl, (e, t) => {
2055
2067
  const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, o = r ? r.getFullYear() * 12 + r.getMonth() : null, i = n ? n.getFullYear() * 12 + n.getMonth() : null;
2056
2068
  if (o !== i || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.isWarning !== t.isWarning || e.minYear !== t.minYear || e.maxYear !== t.maxYear) return !1;
2057
- const l = e.minDate ? e.minDate.getFullYear() * 12 + e.minDate.getMonth() : null, c = t.minDate ? t.minDate.getFullYear() * 12 + t.minDate.getMonth() : null;
2058
- if (l !== c) return !1;
2059
- const f = e.maxDate ? e.maxDate.getFullYear() * 12 + e.maxDate.getMonth() : null, g = t.maxDate ? t.maxDate.getFullYear() * 12 + t.maxDate.getMonth() : null;
2060
- return !(f !== g || e.allowedMonths !== t.allowedMonths || e.onChange !== t.onChange || e.children !== t.children || e.prevMonthAriaLabel !== t.prevMonthAriaLabel || e.nextMonthAriaLabel !== t.nextMonthAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
2069
+ const l = e.minDate ? e.minDate.getFullYear() * 12 + e.minDate.getMonth() : null, s = t.minDate ? t.minDate.getFullYear() * 12 + t.minDate.getMonth() : null;
2070
+ if (l !== s) return !1;
2071
+ const g = e.maxDate ? e.maxDate.getFullYear() * 12 + e.maxDate.getMonth() : null, h = t.maxDate ? t.maxDate.getFullYear() * 12 + t.maxDate.getMonth() : null;
2072
+ return !(g !== h || e.allowedMonths !== t.allowedMonths || e.onChange !== t.onChange || e.children !== t.children || e.prevMonthAriaLabel !== t.prevMonthAriaLabel || e.nextMonthAriaLabel !== t.nextMonthAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
2061
2073
  });
2062
- _l.displayName = "MonthSelector";
2074
+ Gl.displayName = "MonthSelector";
2063
2075
  function pr(e, t, r) {
2064
2076
  if (!(r instanceof Date) || Number.isNaN(r.getTime()))
2065
2077
  throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${String(r)})`);
2066
2078
  }
2067
- function Sn(e, t, r) {
2079
+ function Tn(e, t, r) {
2068
2080
  if (pr(e, "minDate", t), pr(e, "maxDate", r), r.getTime() <= t.getTime())
2069
2081
  throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${t.toISOString()}, maxDate: ${r.toISOString()})`);
2070
2082
  }
2071
- function pn(e, t, r) {
2083
+ function Mn(e, t, r) {
2072
2084
  if (!Array.isArray(r) || r.length !== 2)
2073
2085
  throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${String(r)})`);
2074
2086
  if (pr(e, `${t}[0]`, r[0]), pr(e, `${t}[1]`, r[1]), r[0].getTime() > r[1].getTime())
2075
2087
  throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${r[0].toISOString()}, upper: ${r[1].toISOString()})`);
2076
2088
  }
2077
- function Mn(e, t, r, n, o, i, l) {
2078
- const c = Q(r, n);
2079
- if (c < Q(r, o) || c > Q(r, i))
2089
+ function xn(e, t, r, n, o, i, l) {
2090
+ const s = Q(r, n);
2091
+ if (s < Q(r, o) || s > Q(r, i))
2080
2092
  throw new RangeError(`${e}: ${t} must lie within ${l} (value: ${n.toISOString()}, lower: ${o.toISOString()}, upper: ${i.toISOString()})`);
2081
2093
  }
2082
- function Dn(e, t, r, n, o, i, l) {
2083
- Mn(e, `${t}[0]`, r, n[0], o, i, l), Mn(e, `${t}[1]`, r, n[1], o, i, l);
2094
+ function Rn(e, t, r, n, o, i, l) {
2095
+ xn(e, `${t}[0]`, r, n[0], o, i, l), xn(e, `${t}[1]`, r, n[1], o, i, l);
2084
2096
  }
2085
- function _e(e, t, r) {
2097
+ function We(e, t, r) {
2086
2098
  return e < t ? t : e > r ? r : e;
2087
2099
  }
2088
- function xn(e, t, r, n, o, i) {
2100
+ function Ln(e, t, r, n, o, i) {
2089
2101
  if (r !== !0) return [];
2090
- const l = e[0].getTime(), c = e[1].getTime();
2091
- return Vt(n, t, o, i).filter((f) => f.getTime() >= l && f.getTime() <= c);
2102
+ const l = e[0].getTime(), s = e[1].getTime();
2103
+ return kt(n, t, o, i).filter((g) => g.getTime() >= l && g.getTime() <= s);
2092
2104
  }
2093
2105
  function vr(e, t, r, n) {
2094
- if (n.length === 0) return _e(e, r[0], r[1]);
2095
- const o = n[be(n, e, t)];
2106
+ if (n.length === 0) return We(e, r[0], r[1]);
2107
+ const o = n[ge(n, e, t)];
2096
2108
  return o.getTime() === e.getTime() ? e : o;
2097
2109
  }
2098
- function fn(e, t, r, n) {
2110
+ function hn(e, t, r, n) {
2099
2111
  const o = vr(e[0], t, r, n), i = vr(e[1], t, r, n);
2100
2112
  return [o, i < o ? o : i];
2101
2113
  }
2102
- function Rn(e, t, r, n) {
2103
- const o = be(e, r, t) + n;
2114
+ function Sn(e, t, r, n) {
2115
+ const o = ge(e, r, t) + n;
2104
2116
  return e[Math.max(0, Math.min(e.length - 1, o))];
2105
2117
  }
2106
- function yn(e) {
2107
- const t = k(e), r = t.current, n = e, o = Object.keys(r), i = Object.keys(n);
2108
- return o.length === i.length && i.every((c) => Object.is(r[c], n[c])) || (t.current = e), t.current;
2118
+ function Pn(e) {
2119
+ const t = V(e), r = t.current, n = e, o = Object.keys(r), i = Object.keys(n);
2120
+ return o.length === i.length && i.every((s) => Object.is(r[s], n[s])) || (t.current = e), t.current;
2109
2121
  }
2110
- function jl(e) {
2122
+ function es(e) {
2111
2123
  const { unit: t, minDate: r, maxDate: n, initialRange: o, onChangeRange: i, ...l } = e;
2112
- Sn("usePeriodSliderRange", r, n), pn("usePeriodSliderRange", "initialRange", o), Dn("usePeriodSliderRange", "initialRange", t, o, r, n, "[minDate, maxDate]");
2113
- const c = yn(l), f = k(o), [g, D] = ye(o);
2114
- let L = g;
2115
- const s = [_e(g[0], r, n), _e(g[1], r, n)];
2116
- (s[0] !== g[0] || s[1] !== g[1]) && (L = s, D(s));
2117
- const x = k(L);
2118
- x.current = L;
2119
- const Z = k({ minDate: r, maxDate: n, allowedDates: c.allowedDates });
2120
- Z.current = { minDate: r, maxDate: n, allowedDates: c.allowedDates };
2121
- const ee = k(i);
2124
+ Tn("usePeriodSliderRange", r, n), Mn("usePeriodSliderRange", "initialRange", o), Rn("usePeriodSliderRange", "initialRange", t, o, r, n, "[minDate, maxDate]");
2125
+ const s = Pn(l), g = V(o), [h, D] = Pe(o);
2126
+ let R = h;
2127
+ const c = [We(h[0], r, n), We(h[1], r, n)];
2128
+ (c[0] !== h[0] || c[1] !== h[1]) && (R = c, D(c));
2129
+ const M = V(R);
2130
+ M.current = R;
2131
+ const Z = V({ minDate: r, maxDate: n, allowedDates: s.allowedDates });
2132
+ Z.current = { minDate: r, maxDate: n, allowedDates: s.allowedDates };
2133
+ const ee = V(i);
2122
2134
  ee.current = i;
2123
- const R = U((y) => {
2124
- const { minDate: S, maxDate: T } = Z.current, Y = _e(y[0], S, T), V = _e(y[1], S, T), ne = x.current;
2125
- Y.getTime() === ne[0].getTime() && V.getTime() === ne[1].getTime() || (x.current = [Y, V], D([Y, V]), ee.current?.(Y, V));
2126
- }, []), de = U(
2127
- (y) => {
2128
- const S = x.current, T = y.getTime() > S[1].getTime() ? y : S[1];
2129
- R([y, T]);
2135
+ const x = z((S) => {
2136
+ const { minDate: L, maxDate: y } = Z.current, k = We(S[0], L, y), I = We(S[1], L, y), re = M.current;
2137
+ k.getTime() === re[0].getTime() && I.getTime() === re[1].getTime() || (M.current = [k, I], D([k, I]), ee.current?.(k, I));
2138
+ }, []), ue = z(
2139
+ (S) => {
2140
+ const L = M.current, y = S.getTime() > L[1].getTime() ? S : L[1];
2141
+ x([S, y]);
2130
2142
  },
2131
- [R]
2132
- ), oe = U(
2133
- (y) => {
2134
- const S = x.current, T = y.getTime() < S[0].getTime() ? y : S[0];
2135
- R([T, y]);
2143
+ [x]
2144
+ ), ne = z(
2145
+ (S) => {
2146
+ const L = M.current, y = S.getTime() < L[0].getTime() ? S : L[0];
2147
+ x([y, S]);
2136
2148
  },
2137
- [R]
2138
- ), $ = U(
2139
- (y, S) => {
2140
- R([y, S]);
2149
+ [x]
2150
+ ), P = z(
2151
+ (S, L) => {
2152
+ x([S, L]);
2141
2153
  },
2142
- [R]
2143
- ), H = U(
2144
- (y) => {
2145
- const { minDate: S, maxDate: T, allowedDates: Y } = Z.current, V = x.current, ne = Vt(Y, t, S, T);
2146
- if (ne.length > 0) {
2147
- R([Rn(ne, t, V[0], y), Rn(ne, t, V[1], y)]);
2154
+ [x]
2155
+ ), O = z(
2156
+ (S) => {
2157
+ const { minDate: L, maxDate: y, allowedDates: k } = Z.current, I = M.current, re = kt(k, t, L, y);
2158
+ if (re.length > 0) {
2159
+ x([Sn(re, t, I[0], S), Sn(re, t, I[1], S)]);
2148
2160
  return;
2149
2161
  }
2150
- R([Oe(t, V[0], y), Oe(t, V[1], y)]);
2162
+ x([Oe(t, I[0], S), Oe(t, I[1], S)]);
2151
2163
  },
2152
- [t, R]
2153
- ), W = U(() => {
2154
- R(f.current);
2155
- }, [R]), ae = C(
2164
+ [t, x]
2165
+ ), G = z(() => {
2166
+ x(g.current);
2167
+ }, [x]), ie = E(
2156
2168
  () => ({
2157
- value: L[0],
2158
- onChange: de,
2169
+ value: R[0],
2170
+ onChange: ue,
2159
2171
  minDate: r,
2160
- maxDate: L[1],
2172
+ maxDate: R[1],
2161
2173
  unit: t
2162
2174
  }),
2163
- [L[0], L[1], de, r, t]
2164
- ), q = C(
2175
+ [R[0], R[1], ue, r, t]
2176
+ ), j = E(
2165
2177
  () => ({
2166
- value: L[1],
2167
- onChange: oe,
2168
- minDate: L[0],
2178
+ value: R[1],
2179
+ onChange: ne,
2180
+ minDate: R[0],
2169
2181
  maxDate: n,
2170
2182
  unit: t
2171
2183
  }),
2172
- [L[0], L[1], oe, n, t]
2173
- ), G = C(
2184
+ [R[0], R[1], ne, n, t]
2185
+ ), X = E(
2174
2186
  () => ({
2175
- ...c,
2187
+ ...s,
2176
2188
  mode: "range",
2177
2189
  unit: t,
2178
- range: L,
2190
+ range: R,
2179
2191
  minDate: r,
2180
2192
  maxDate: n,
2181
- onChangeRange: $
2193
+ onChangeRange: P
2182
2194
  }),
2183
- [c, t, L, r, n, $]
2195
+ [s, t, R, r, n, P]
2184
2196
  );
2185
2197
  return {
2186
- range: L,
2187
- lowerDate: L[0],
2188
- upperDate: L[1],
2198
+ range: R,
2199
+ lowerDate: R[0],
2200
+ upperDate: R[1],
2189
2201
  setRange: D,
2190
- setLowerDate: de,
2191
- setUpperDate: oe,
2192
- shiftRange: H,
2193
- resetRange: W,
2194
- startSelectorProps: ae,
2195
- endSelectorProps: q,
2196
- sliderProps: G
2202
+ setLowerDate: ue,
2203
+ setUpperDate: ne,
2204
+ shiftRange: O,
2205
+ resetRange: G,
2206
+ startSelectorProps: ie,
2207
+ endSelectorProps: j,
2208
+ sliderProps: X
2197
2209
  };
2198
2210
  }
2199
- function ql(e) {
2211
+ function ts(e) {
2200
2212
  const { unit: t, minDate: r, maxDate: n, initialValue: o, onChangePoint: i, ...l } = e;
2201
- Sn("usePeriodSliderPoint", r, n), pr("usePeriodSliderPoint", "initialValue", o), Mn("usePeriodSliderPoint", "initialValue", t, o, r, n, "[minDate, maxDate]");
2202
- const c = yn(l), f = k(o), [g, D] = ye(o);
2203
- let L = g;
2204
- const s = _e(g, r, n);
2205
- s !== g && (L = s, D(s));
2206
- const x = k(L);
2207
- x.current = L;
2208
- const Z = k({ minDate: r, maxDate: n, allowedDates: c.allowedDates });
2209
- Z.current = { minDate: r, maxDate: n, allowedDates: c.allowedDates };
2210
- const ee = k(i);
2213
+ Tn("usePeriodSliderPoint", r, n), pr("usePeriodSliderPoint", "initialValue", o), xn("usePeriodSliderPoint", "initialValue", t, o, r, n, "[minDate, maxDate]");
2214
+ const s = Pn(l), g = V(o), [h, D] = Pe(o);
2215
+ let R = h;
2216
+ const c = We(h, r, n);
2217
+ c !== h && (R = c, D(c));
2218
+ const M = V(R);
2219
+ M.current = R;
2220
+ const Z = V({ minDate: r, maxDate: n, allowedDates: s.allowedDates });
2221
+ Z.current = { minDate: r, maxDate: n, allowedDates: s.allowedDates };
2222
+ const ee = V(i);
2211
2223
  ee.current = i;
2212
- const R = U((W) => {
2213
- const { minDate: ae, maxDate: q } = Z.current, G = _e(W, ae, q);
2214
- G.getTime() !== x.current.getTime() && (x.current = G, D(G), ee.current?.(G));
2215
- }, []), de = U(
2216
- (W) => {
2217
- const { minDate: ae, maxDate: q, allowedDates: G } = Z.current, y = Vt(G, t, ae, q);
2218
- if (y.length > 0) {
2219
- R(Rn(y, t, x.current, W));
2224
+ const x = z((G) => {
2225
+ const { minDate: ie, maxDate: j } = Z.current, X = We(G, ie, j);
2226
+ X.getTime() !== M.current.getTime() && (M.current = X, D(X), ee.current?.(X));
2227
+ }, []), ue = z(
2228
+ (G) => {
2229
+ const { minDate: ie, maxDate: j, allowedDates: X } = Z.current, S = kt(X, t, ie, j);
2230
+ if (S.length > 0) {
2231
+ x(Sn(S, t, M.current, G));
2220
2232
  return;
2221
2233
  }
2222
- R(Oe(t, x.current, W));
2234
+ x(Oe(t, M.current, G));
2223
2235
  },
2224
- [t, R]
2225
- ), oe = U(() => {
2226
- R(f.current);
2227
- }, [R]), $ = C(
2236
+ [t, x]
2237
+ ), ne = z(() => {
2238
+ x(g.current);
2239
+ }, [x]), P = E(
2228
2240
  () => ({
2229
- value: L,
2230
- onChange: R,
2241
+ value: R,
2242
+ onChange: x,
2231
2243
  minDate: r,
2232
2244
  maxDate: n,
2233
2245
  unit: t
2234
2246
  }),
2235
- [L, R, r, n, t]
2236
- ), H = C(
2247
+ [R, x, r, n, t]
2248
+ ), O = E(
2237
2249
  () => ({
2238
- ...c,
2250
+ ...s,
2239
2251
  mode: "point",
2240
2252
  unit: t,
2241
- value: L,
2253
+ value: R,
2242
2254
  minDate: r,
2243
2255
  maxDate: n,
2244
- onChangePoint: R
2256
+ onChangePoint: x
2245
2257
  }),
2246
- [c, t, L, r, n, R]
2258
+ [s, t, R, r, n, x]
2247
2259
  );
2248
2260
  return {
2249
- value: L,
2261
+ value: R,
2250
2262
  setValue: D,
2251
- shiftValue: de,
2252
- resetValue: oe,
2253
- selectorProps: $,
2254
- sliderProps: H
2263
+ shiftValue: ue,
2264
+ resetValue: ne,
2265
+ selectorProps: P,
2266
+ sliderProps: O
2255
2267
  };
2256
2268
  }
2257
- function Zl(e) {
2258
- const { unit: t, minDate: r, maxDate: n, initialMacroRange: o, initialMicroRange: i, macroUnit: l = t, microUnit: c = t, onChangeMacroRange: f, onChangeMicroRange: g, ...D } = e;
2259
- Sn("useVernierSliderRange", r, n), pn("useVernierSliderRange", "initialMacroRange", o), pn("useVernierSliderRange", "initialMicroRange", i), Dn("useVernierSliderRange", "initialMacroRange", l, o, r, n, "[minDate, maxDate]");
2260
- const L = xt(l, c, o, r, n);
2261
- Dn("useVernierSliderRange", "initialMicroRange", c, i, L[0], L[1], "the initial macro window");
2262
- const s = yn(D), x = k(o), Z = k(i), [ee, R] = ye(o), [de, oe] = ye(i);
2263
- let $ = ee;
2264
- const H = [_e(ee[0], r, n), _e(ee[1], r, n)];
2265
- (H[0] !== ee[0] || H[1] !== ee[1]) && ($ = H, R(H));
2266
- const W = C(() => xt(l, c, $, r, n), [l, c, $, r, n]), ae = C(
2267
- () => xn(W, c, s.microIsDiscrete, s.microAllowedDates ?? s.allowedDates, r, n),
2268
- [W, c, s.microIsDiscrete, s.microAllowedDates, s.allowedDates, r, n]
2269
- ), q = C(
2270
- () => s.macroIsDiscrete === !0 ? Vt(s.macroAllowedDates ?? s.allowedDates, l, r, n) : [],
2271
- [s.macroIsDiscrete, s.macroAllowedDates, s.allowedDates, l, r, n]
2272
- ), G = k(q);
2273
- G.current = q;
2274
- let y = de;
2275
- const S = fn(de, c, W, ae);
2276
- (S[0] !== de[0] || S[1] !== de[1]) && (y = S, oe(S));
2277
- const T = k($);
2278
- T.current = $;
2279
- const Y = k(y);
2280
- Y.current = y;
2281
- const V = k({ minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates });
2282
- V.current = { minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates };
2283
- const ne = k(f);
2284
- ne.current = f;
2285
- const ue = k(g);
2286
- ue.current = g;
2287
- const X = U(
2288
- (v) => {
2289
- const { minDate: O, maxDate: M } = V.current;
2290
- return xt(l, c, v, O, M);
2269
+ function rs(e) {
2270
+ const { unit: t, minDate: r, maxDate: n, initialMacroRange: o, initialMicroRange: i, macroUnit: l = t, microUnit: s = t, onChangeMacroRange: g, onChangeMicroRange: h, ...D } = e;
2271
+ Tn("useVernierSliderRange", r, n), Mn("useVernierSliderRange", "initialMacroRange", o), Mn("useVernierSliderRange", "initialMicroRange", i), Rn("useVernierSliderRange", "initialMacroRange", l, o, r, n, "[minDate, maxDate]");
2272
+ const R = xt(l, s, o, r, n);
2273
+ Rn("useVernierSliderRange", "initialMicroRange", s, i, R[0], R[1], "the initial macro window");
2274
+ const c = Pn(D), M = V(o), Z = V(i), [ee, x] = Pe(o), [ue, ne] = Pe(i);
2275
+ let P = ee;
2276
+ const O = [We(ee[0], r, n), We(ee[1], r, n)];
2277
+ (O[0] !== ee[0] || O[1] !== ee[1]) && (P = O, x(O));
2278
+ const G = E(() => xt(l, s, P, r, n), [l, s, P, r, n]), ie = E(
2279
+ () => Ln(G, s, c.microIsDiscrete, c.microAllowedDates ?? c.allowedDates, r, n),
2280
+ [G, s, c.microIsDiscrete, c.microAllowedDates, c.allowedDates, r, n]
2281
+ ), j = E(
2282
+ () => c.macroIsDiscrete === !0 ? kt(c.macroAllowedDates ?? c.allowedDates, l, r, n) : [],
2283
+ [c.macroIsDiscrete, c.macroAllowedDates, c.allowedDates, l, r, n]
2284
+ ), X = V(j);
2285
+ X.current = j;
2286
+ let S = ue;
2287
+ const L = hn(ue, s, G, ie);
2288
+ (L[0] !== ue[0] || L[1] !== ue[1]) && (S = L, ne(L));
2289
+ const y = V(P);
2290
+ y.current = P;
2291
+ const k = V(S);
2292
+ k.current = S;
2293
+ const I = V({ minDate: r, maxDate: n, macroIsDiscrete: c.macroIsDiscrete, macroAllowedDates: c.macroAllowedDates, microIsDiscrete: c.microIsDiscrete, microAllowedDates: c.microAllowedDates, allowedDates: c.allowedDates });
2294
+ I.current = { minDate: r, maxDate: n, macroIsDiscrete: c.macroIsDiscrete, macroAllowedDates: c.macroAllowedDates, microIsDiscrete: c.microIsDiscrete, microAllowedDates: c.microAllowedDates, allowedDates: c.allowedDates };
2295
+ const re = V(g);
2296
+ re.current = g;
2297
+ const ce = V(h);
2298
+ ce.current = h;
2299
+ const K = z(
2300
+ (p) => {
2301
+ const { minDate: N, maxDate: v } = I.current;
2302
+ return xt(l, s, p, N, v);
2291
2303
  },
2292
- [l, c]
2293
- ), J = U(
2294
- (v) => {
2295
- const { microIsDiscrete: O, microAllowedDates: M, allowedDates: j, minDate: me, maxDate: we } = V.current;
2296
- return xn(v, c, O, M ?? j, me, we);
2304
+ [l, s]
2305
+ ), J = z(
2306
+ (p) => {
2307
+ const { microIsDiscrete: N, microAllowedDates: v, allowedDates: Y, minDate: he, maxDate: be } = I.current;
2308
+ return Ln(p, s, N, v ?? Y, he, be);
2297
2309
  },
2298
- [c]
2299
- ), z = U((v, O) => {
2300
- const M = T.current, j = Y.current;
2301
- (v[0].getTime() !== M[0].getTime() || v[1].getTime() !== M[1].getTime()) && (T.current = v, R(v), ne.current?.(v[0], v[1])), (O[0].getTime() !== j[0].getTime() || O[1].getTime() !== j[1].getTime()) && (Y.current = O, oe(O), ue.current?.(O[0], O[1]));
2302
- }, []), F = U(
2303
- (v, O) => {
2304
- const { minDate: M, maxDate: j } = V.current, me = [_e(v, M, j), _e(O, M, j)], we = X(me);
2305
- z(me, fn(Y.current, c, we, J(we)));
2310
+ [s]
2311
+ ), B = z((p, N) => {
2312
+ const v = y.current, Y = k.current;
2313
+ (p[0].getTime() !== v[0].getTime() || p[1].getTime() !== v[1].getTime()) && (y.current = p, x(p), re.current?.(p[0], p[1])), (N[0].getTime() !== Y[0].getTime() || N[1].getTime() !== Y[1].getTime()) && (k.current = N, ne(N), ce.current?.(N[0], N[1]));
2314
+ }, []), H = z(
2315
+ (p, N) => {
2316
+ const { minDate: v, maxDate: Y } = I.current, he = [We(p, v, Y), We(N, v, Y)], be = K(he);
2317
+ B(he, hn(k.current, s, be, J(be)));
2306
2318
  },
2307
- [c, X, J, z]
2308
- ), fe = U(
2309
- (v, O) => {
2310
- const M = X(T.current);
2311
- z(T.current, fn([v, O], c, M, J(M)));
2319
+ [s, K, J, B]
2320
+ ), de = z(
2321
+ (p, N) => {
2322
+ const v = K(y.current);
2323
+ B(y.current, hn([p, N], s, v, J(v)));
2312
2324
  },
2313
- [c, X, J, z]
2314
- ), ge = U(
2315
- (v) => {
2316
- const O = T.current[1], M = v > O ? v : O;
2317
- F(v, M);
2325
+ [s, K, J, B]
2326
+ ), me = z(
2327
+ (p) => {
2328
+ const N = y.current[1], v = p > N ? p : N;
2329
+ H(p, v);
2318
2330
  },
2319
- [F]
2320
- ), le = U(
2321
- (v) => {
2322
- const O = T.current[0], M = v < O ? v : O;
2323
- F(M, v);
2331
+ [H]
2332
+ ), De = z(
2333
+ (p) => {
2334
+ const N = y.current[0], v = p < N ? p : N;
2335
+ H(v, p);
2324
2336
  },
2325
- [F]
2326
- ), ze = U(
2327
- (v) => {
2328
- const O = Y.current[1], M = v > O ? v : O;
2329
- fe(v, M);
2337
+ [H]
2338
+ ), Ge = z(
2339
+ (p) => {
2340
+ const N = k.current[1], v = p > N ? p : N;
2341
+ de(p, v);
2330
2342
  },
2331
- [fe]
2332
- ), Ee = U(
2333
- (v) => {
2334
- const O = Y.current[0], M = v < O ? v : O;
2335
- fe(M, v);
2343
+ [de]
2344
+ ), Me = z(
2345
+ (p) => {
2346
+ const N = k.current[0], v = p < N ? p : N;
2347
+ de(v, p);
2336
2348
  },
2337
- [fe]
2338
- ), Te = U(
2339
- (v) => {
2340
- const { minDate: O, maxDate: M } = V.current, j = T.current, me = G.current;
2341
- if (me.length > 0) {
2342
- const He = be(me, j[0], l) + v, rt = be(me, j[1], l) + v;
2343
- if (He < 0 || rt > me.length - 1) return;
2344
- F(me[He], me[rt]);
2349
+ [de]
2350
+ ), pe = z(
2351
+ (p) => {
2352
+ const { minDate: N, maxDate: v } = I.current, Y = y.current, he = X.current;
2353
+ if (he.length > 0) {
2354
+ const Ie = ge(he, Y[0], l) + p, _e = ge(he, Y[1], l) + p;
2355
+ if (Ie < 0 || _e > he.length - 1) return;
2356
+ H(he[Ie], he[_e]);
2345
2357
  return;
2346
2358
  }
2347
- const we = Oe(l, j[0], v), Ae = Oe(l, j[1], v);
2348
- we < O || Ae > M || F(we, Ae);
2359
+ const be = Oe(l, Y[0], p), $e = Oe(l, Y[1], p);
2360
+ be < N || $e > v || H(be, $e);
2349
2361
  },
2350
- [l, F]
2351
- ), Pe = U(
2352
- (v) => {
2353
- const O = T.current, M = Y.current, j = X(O), [me, we] = j, Ae = J(j);
2354
- if (Ae.length > 0) {
2355
- const ve = be(Ae, M[0], c) + v, pe = be(Ae, M[1], c) + v;
2356
- if (ve < 0 || pe > Ae.length - 1) return;
2357
- fe(Ae[ve], Ae[pe]);
2362
+ [l, H]
2363
+ ), Le = z(
2364
+ (p) => {
2365
+ const N = y.current, v = k.current, Y = K(N), [he, be] = Y, $e = J(Y);
2366
+ if ($e.length > 0) {
2367
+ const Rt = ge($e, v[0], s) + p, bt = ge($e, v[1], s) + p;
2368
+ if (Rt < 0 || bt > $e.length - 1) return;
2369
+ de($e[Rt], $e[bt]);
2358
2370
  return;
2359
2371
  }
2360
- const He = Oe(c, M[0], v), rt = Oe(c, M[1], v);
2361
- He < me || rt > we || fe(He, rt);
2372
+ const Ie = Oe(s, v[0], p), _e = Oe(s, v[1], p);
2373
+ Ie < he || _e > be || de(Ie, _e);
2362
2374
  },
2363
- [c, X, J, fe]
2364
- ), qe = U(() => {
2365
- const v = x.current, O = X(v);
2366
- z(v, fn(Z.current, c, O, J(O)));
2367
- }, [c, X, J, z]), [Be, tt] = W, Ue = C(
2375
+ [s, K, J, de]
2376
+ ), He = z(() => {
2377
+ const p = M.current, N = K(p);
2378
+ B(p, hn(Z.current, s, N, J(N)));
2379
+ }, [s, K, J, B]), [Fe, rt] = G, ht = E(
2368
2380
  () => ({
2369
- value: $[0],
2370
- onChange: ge,
2381
+ value: P[0],
2382
+ onChange: me,
2371
2383
  minDate: r,
2372
- maxDate: $[1],
2384
+ maxDate: P[1],
2373
2385
  unit: l
2374
2386
  }),
2375
- [$, ge, r, l]
2376
- ), st = C(
2387
+ [P, me, r, l]
2388
+ ), lt = E(
2377
2389
  () => ({
2378
- value: $[1],
2379
- onChange: le,
2380
- minDate: $[0],
2390
+ value: P[1],
2391
+ onChange: De,
2392
+ minDate: P[0],
2381
2393
  maxDate: n,
2382
2394
  unit: l
2383
2395
  }),
2384
- [$, le, n, l]
2385
- ), K = C(
2396
+ [P, De, n, l]
2397
+ ), q = E(
2386
2398
  () => ({
2387
- value: y[0],
2388
- onChange: ze,
2389
- minDate: Be,
2390
- maxDate: y[1],
2391
- unit: c
2399
+ value: S[0],
2400
+ onChange: Ge,
2401
+ minDate: Fe,
2402
+ maxDate: S[1],
2403
+ unit: s
2392
2404
  }),
2393
- [y, ze, Be, c]
2394
- ), B = C(
2405
+ [S, Ge, Fe, s]
2406
+ ), U = E(
2395
2407
  () => ({
2396
- value: y[1],
2397
- onChange: Ee,
2398
- minDate: y[0],
2399
- maxDate: tt,
2400
- unit: c
2408
+ value: S[1],
2409
+ onChange: Me,
2410
+ minDate: S[0],
2411
+ maxDate: rt,
2412
+ unit: s
2401
2413
  }),
2402
- [y, Ee, tt, c]
2403
- ), te = C(
2414
+ [S, Me, rt, s]
2415
+ ), oe = E(
2404
2416
  () => ({
2405
- ...s,
2417
+ ...c,
2406
2418
  mode: "vernier",
2407
2419
  unit: t,
2408
2420
  macroUnit: l,
2409
- microUnit: c,
2421
+ microUnit: s,
2410
2422
  minDate: r,
2411
2423
  maxDate: n,
2412
- macroRange: $,
2413
- microRange: y,
2414
- onChangeMacroRange: F,
2415
- onChangeMicroRange: fe
2424
+ macroRange: P,
2425
+ microRange: S,
2426
+ onChangeMacroRange: H,
2427
+ onChangeMicroRange: de
2416
2428
  }),
2417
- [s, t, l, c, r, n, $, y, F, fe]
2429
+ [c, t, l, s, r, n, P, S, H, de]
2418
2430
  );
2419
2431
  return {
2420
- macroRange: $,
2421
- setMacroRange: R,
2422
- microRange: y,
2423
- setMicroRange: oe,
2424
- setMacroLowerDate: ge,
2425
- setMacroUpperDate: le,
2426
- setMicroLowerDate: ze,
2427
- setMicroUpperDate: Ee,
2428
- shiftMacroRange: Te,
2429
- shiftMicroRange: Pe,
2430
- resetVernier: qe,
2431
- macroStartSelectorProps: Ue,
2432
- macroEndSelectorProps: st,
2433
- microStartSelectorProps: K,
2434
- microEndSelectorProps: B,
2435
- sliderProps: te
2432
+ macroRange: P,
2433
+ setMacroRange: x,
2434
+ microRange: S,
2435
+ setMicroRange: ne,
2436
+ setMacroLowerDate: me,
2437
+ setMacroUpperDate: De,
2438
+ setMicroLowerDate: Ge,
2439
+ setMicroUpperDate: Me,
2440
+ shiftMacroRange: pe,
2441
+ shiftMicroRange: Le,
2442
+ resetVernier: He,
2443
+ macroStartSelectorProps: ht,
2444
+ macroEndSelectorProps: lt,
2445
+ microStartSelectorProps: q,
2446
+ microEndSelectorProps: U,
2447
+ sliderProps: oe
2436
2448
  };
2437
2449
  }
2438
- function Jl(e) {
2439
- const { unit: t, minDate: r, maxDate: n, initialMacroRange: o, initialMicroValue: i, macroUnit: l = t, microUnit: c = t, onChangeMacroRange: f, onChangeMicroPoint: g, ...D } = e;
2440
- Sn("useVernierSliderPoint", r, n), pn("useVernierSliderPoint", "initialMacroRange", o), pr("useVernierSliderPoint", "initialMicroValue", i), Dn("useVernierSliderPoint", "initialMacroRange", l, o, r, n, "[minDate, maxDate]");
2441
- const L = xt(l, c, o, r, n);
2442
- Mn("useVernierSliderPoint", "initialMicroValue", c, i, L[0], L[1], "the initial macro window");
2443
- const s = yn(D), x = k(o), Z = k(i), [ee, R] = ye(o), [de, oe] = ye(i);
2444
- let $ = ee;
2445
- const H = [_e(ee[0], r, n), _e(ee[1], r, n)];
2446
- (H[0] !== ee[0] || H[1] !== ee[1]) && ($ = H, R(H));
2447
- const W = C(() => xt(l, c, $, r, n), [l, c, $, r, n]), ae = C(
2448
- () => xn(W, c, s.microIsDiscrete, s.microAllowedDates ?? s.allowedDates, r, n),
2449
- [W, c, s.microIsDiscrete, s.microAllowedDates, s.allowedDates, r, n]
2450
- ), q = C(
2451
- () => s.macroIsDiscrete === !0 ? Vt(s.macroAllowedDates ?? s.allowedDates, l, r, n) : [],
2452
- [s.macroIsDiscrete, s.macroAllowedDates, s.allowedDates, l, r, n]
2453
- ), G = k(q);
2454
- G.current = q;
2455
- let y = de;
2456
- const S = vr(de, c, W, ae);
2457
- S !== de && (y = S, oe(S));
2458
- const T = k($);
2459
- T.current = $;
2460
- const Y = k(y);
2461
- Y.current = y;
2462
- const V = k({ minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates });
2463
- V.current = { minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates };
2464
- const ne = k(f);
2465
- ne.current = f;
2466
- const ue = k(g);
2467
- ue.current = g;
2468
- const X = U(
2469
- (K) => {
2470
- const { minDate: B, maxDate: te } = V.current;
2471
- return xt(l, c, K, B, te);
2450
+ function ns(e) {
2451
+ const { unit: t, minDate: r, maxDate: n, initialMacroRange: o, initialMicroValue: i, macroUnit: l = t, microUnit: s = t, onChangeMacroRange: g, onChangeMicroPoint: h, ...D } = e;
2452
+ Tn("useVernierSliderPoint", r, n), Mn("useVernierSliderPoint", "initialMacroRange", o), pr("useVernierSliderPoint", "initialMicroValue", i), Rn("useVernierSliderPoint", "initialMacroRange", l, o, r, n, "[minDate, maxDate]");
2453
+ const R = xt(l, s, o, r, n);
2454
+ xn("useVernierSliderPoint", "initialMicroValue", s, i, R[0], R[1], "the initial macro window");
2455
+ const c = Pn(D), M = V(o), Z = V(i), [ee, x] = Pe(o), [ue, ne] = Pe(i);
2456
+ let P = ee;
2457
+ const O = [We(ee[0], r, n), We(ee[1], r, n)];
2458
+ (O[0] !== ee[0] || O[1] !== ee[1]) && (P = O, x(O));
2459
+ const G = E(() => xt(l, s, P, r, n), [l, s, P, r, n]), ie = E(
2460
+ () => Ln(G, s, c.microIsDiscrete, c.microAllowedDates ?? c.allowedDates, r, n),
2461
+ [G, s, c.microIsDiscrete, c.microAllowedDates, c.allowedDates, r, n]
2462
+ ), j = E(
2463
+ () => c.macroIsDiscrete === !0 ? kt(c.macroAllowedDates ?? c.allowedDates, l, r, n) : [],
2464
+ [c.macroIsDiscrete, c.macroAllowedDates, c.allowedDates, l, r, n]
2465
+ ), X = V(j);
2466
+ X.current = j;
2467
+ let S = ue;
2468
+ const L = vr(ue, s, G, ie);
2469
+ L !== ue && (S = L, ne(L));
2470
+ const y = V(P);
2471
+ y.current = P;
2472
+ const k = V(S);
2473
+ k.current = S;
2474
+ const I = V({ minDate: r, maxDate: n, macroIsDiscrete: c.macroIsDiscrete, macroAllowedDates: c.macroAllowedDates, microIsDiscrete: c.microIsDiscrete, microAllowedDates: c.microAllowedDates, allowedDates: c.allowedDates });
2475
+ I.current = { minDate: r, maxDate: n, macroIsDiscrete: c.macroIsDiscrete, macroAllowedDates: c.macroAllowedDates, microIsDiscrete: c.microIsDiscrete, microAllowedDates: c.microAllowedDates, allowedDates: c.allowedDates };
2476
+ const re = V(g);
2477
+ re.current = g;
2478
+ const ce = V(h);
2479
+ ce.current = h;
2480
+ const K = z(
2481
+ (q) => {
2482
+ const { minDate: U, maxDate: oe } = I.current;
2483
+ return xt(l, s, q, U, oe);
2472
2484
  },
2473
- [l, c]
2474
- ), J = U(
2475
- (K) => {
2476
- const { microIsDiscrete: B, microAllowedDates: te, allowedDates: v, minDate: O, maxDate: M } = V.current;
2477
- return xn(K, c, B, te ?? v, O, M);
2485
+ [l, s]
2486
+ ), J = z(
2487
+ (q) => {
2488
+ const { microIsDiscrete: U, microAllowedDates: oe, allowedDates: p, minDate: N, maxDate: v } = I.current;
2489
+ return Ln(q, s, U, oe ?? p, N, v);
2478
2490
  },
2479
- [c]
2480
- ), z = U((K, B) => {
2481
- const te = T.current, v = Y.current;
2482
- (K[0].getTime() !== te[0].getTime() || K[1].getTime() !== te[1].getTime()) && (T.current = K, R(K), ne.current?.(K[0], K[1])), B.getTime() !== v.getTime() && (Y.current = B, oe(B), ue.current?.(B));
2483
- }, []), F = U(
2484
- (K, B) => {
2485
- const { minDate: te, maxDate: v } = V.current, O = [_e(K, te, v), _e(B, te, v)], M = X(O);
2486
- z(O, vr(Y.current, c, M, J(M)));
2491
+ [s]
2492
+ ), B = z((q, U) => {
2493
+ const oe = y.current, p = k.current;
2494
+ (q[0].getTime() !== oe[0].getTime() || q[1].getTime() !== oe[1].getTime()) && (y.current = q, x(q), re.current?.(q[0], q[1])), U.getTime() !== p.getTime() && (k.current = U, ne(U), ce.current?.(U));
2495
+ }, []), H = z(
2496
+ (q, U) => {
2497
+ const { minDate: oe, maxDate: p } = I.current, N = [We(q, oe, p), We(U, oe, p)], v = K(N);
2498
+ B(N, vr(k.current, s, v, J(v)));
2487
2499
  },
2488
- [c, X, J, z]
2489
- ), fe = U(
2490
- (K) => {
2491
- const B = X(T.current);
2492
- z(T.current, vr(K, c, B, J(B)));
2500
+ [s, K, J, B]
2501
+ ), de = z(
2502
+ (q) => {
2503
+ const U = K(y.current);
2504
+ B(y.current, vr(q, s, U, J(U)));
2493
2505
  },
2494
- [c, X, J, z]
2495
- ), ge = U(
2496
- (K) => {
2497
- const B = T.current[1], te = K > B ? K : B;
2498
- F(K, te);
2506
+ [s, K, J, B]
2507
+ ), me = z(
2508
+ (q) => {
2509
+ const U = y.current[1], oe = q > U ? q : U;
2510
+ H(q, oe);
2499
2511
  },
2500
- [F]
2501
- ), le = U(
2502
- (K) => {
2503
- const B = T.current[0], te = K < B ? K : B;
2504
- F(te, K);
2512
+ [H]
2513
+ ), De = z(
2514
+ (q) => {
2515
+ const U = y.current[0], oe = q < U ? q : U;
2516
+ H(oe, q);
2505
2517
  },
2506
- [F]
2507
- ), ze = U(
2508
- (K) => {
2509
- const { minDate: B, maxDate: te } = V.current, v = T.current, O = G.current;
2510
- if (O.length > 0) {
2511
- const me = be(O, v[0], l) + K, we = be(O, v[1], l) + K;
2512
- if (me < 0 || we > O.length - 1) return;
2513
- F(O[me], O[we]);
2518
+ [H]
2519
+ ), Ge = z(
2520
+ (q) => {
2521
+ const { minDate: U, maxDate: oe } = I.current, p = y.current, N = X.current;
2522
+ if (N.length > 0) {
2523
+ const he = ge(N, p[0], l) + q, be = ge(N, p[1], l) + q;
2524
+ if (he < 0 || be > N.length - 1) return;
2525
+ H(N[he], N[be]);
2514
2526
  return;
2515
2527
  }
2516
- const M = Oe(l, v[0], K), j = Oe(l, v[1], K);
2517
- M < B || j > te || F(M, j);
2528
+ const v = Oe(l, p[0], q), Y = Oe(l, p[1], q);
2529
+ v < U || Y > oe || H(v, Y);
2518
2530
  },
2519
- [l, F]
2520
- ), Ee = U(
2521
- (K) => {
2522
- const B = T.current, te = X(B), v = J(te);
2523
- if (v.length > 0) {
2524
- fe(Rn(v, c, Y.current, K));
2531
+ [l, H]
2532
+ ), Me = z(
2533
+ (q) => {
2534
+ const U = y.current, oe = K(U), p = J(oe);
2535
+ if (p.length > 0) {
2536
+ de(Sn(p, s, k.current, q));
2525
2537
  return;
2526
2538
  }
2527
- fe(Oe(c, Y.current, K));
2539
+ de(Oe(s, k.current, q));
2528
2540
  },
2529
- [c, X, J, fe]
2530
- ), Te = U(() => {
2531
- const K = x.current, B = X(K);
2532
- z(K, vr(Z.current, c, B, J(B)));
2533
- }, [c, X, J, z]), [Pe, qe] = W, Be = C(
2541
+ [s, K, J, de]
2542
+ ), pe = z(() => {
2543
+ const q = M.current, U = K(q);
2544
+ B(q, vr(Z.current, s, U, J(U)));
2545
+ }, [s, K, J, B]), [Le, He] = G, Fe = E(
2534
2546
  () => ({
2535
- value: $[0],
2536
- onChange: ge,
2547
+ value: P[0],
2548
+ onChange: me,
2537
2549
  minDate: r,
2538
- maxDate: $[1],
2550
+ maxDate: P[1],
2539
2551
  unit: l
2540
2552
  }),
2541
- [$, ge, r, l]
2542
- ), tt = C(
2553
+ [P, me, r, l]
2554
+ ), rt = E(
2543
2555
  () => ({
2544
- value: $[1],
2545
- onChange: le,
2546
- minDate: $[0],
2556
+ value: P[1],
2557
+ onChange: De,
2558
+ minDate: P[0],
2547
2559
  maxDate: n,
2548
2560
  unit: l
2549
2561
  }),
2550
- [$, le, n, l]
2551
- ), Ue = C(
2562
+ [P, De, n, l]
2563
+ ), ht = E(
2552
2564
  () => ({
2553
- value: y,
2554
- onChange: fe,
2555
- minDate: Pe,
2556
- maxDate: qe,
2557
- unit: c
2565
+ value: S,
2566
+ onChange: de,
2567
+ minDate: Le,
2568
+ maxDate: He,
2569
+ unit: s
2558
2570
  }),
2559
- [y, fe, Pe, qe, c]
2560
- ), st = C(
2571
+ [S, de, Le, He, s]
2572
+ ), lt = E(
2561
2573
  () => ({
2562
- ...s,
2574
+ ...c,
2563
2575
  mode: "vernier",
2564
2576
  unit: t,
2565
2577
  macroUnit: l,
2566
- microUnit: c,
2578
+ microUnit: s,
2567
2579
  minDate: r,
2568
2580
  maxDate: n,
2569
- macroRange: $,
2570
- microValue: y,
2571
- onChangeMacroRange: F,
2572
- onChangeMicroPoint: fe
2581
+ macroRange: P,
2582
+ microValue: S,
2583
+ onChangeMacroRange: H,
2584
+ onChangeMicroPoint: de
2573
2585
  }),
2574
- [s, t, l, c, r, n, $, y, F, fe]
2586
+ [c, t, l, s, r, n, P, S, H, de]
2575
2587
  );
2576
2588
  return {
2577
- macroRange: $,
2578
- setMacroRange: R,
2579
- microValue: y,
2580
- setMicroValue: oe,
2581
- setMacroLowerDate: ge,
2582
- setMacroUpperDate: le,
2583
- setMicroDate: fe,
2584
- shiftMacroRange: ze,
2585
- shiftMicroValue: Ee,
2586
- resetVernier: Te,
2587
- macroStartSelectorProps: Be,
2588
- macroEndSelectorProps: tt,
2589
- microSelectorProps: Ue,
2590
- sliderProps: st
2589
+ macroRange: P,
2590
+ setMacroRange: x,
2591
+ microValue: S,
2592
+ setMicroValue: ne,
2593
+ setMacroLowerDate: me,
2594
+ setMacroUpperDate: De,
2595
+ setMicroDate: de,
2596
+ shiftMacroRange: Ge,
2597
+ shiftMicroValue: Me,
2598
+ resetVernier: pe,
2599
+ macroStartSelectorProps: Fe,
2600
+ macroEndSelectorProps: rt,
2601
+ microSelectorProps: ht,
2602
+ sliderProps: lt
2591
2603
  };
2592
2604
  }
2593
- function Ea(e) {
2605
+ function Oa(e) {
2594
2606
  const t = new Date(e, 0, 1);
2595
2607
  return t.setFullYear(e), t;
2596
2608
  }
2597
- function gn(e, t) {
2609
+ function bn(e, t) {
2598
2610
  if (e !== void 0 && (!(e instanceof Date) || Number.isNaN(e.getTime())))
2599
2611
  throw new RangeError(`YearSelector: \`${t}\` must be a valid Date, received ${String(e)}.`);
2600
2612
  }
2601
- function Ia(e, t) {
2613
+ function Ha(e, t) {
2602
2614
  if (e !== void 0 && !Number.isInteger(e))
2603
2615
  throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`);
2604
2616
  }
2605
- function zl(e) {
2617
+ function Xl(e) {
2606
2618
  if (e !== void 0)
2607
2619
  try {
2608
2620
  Intl.DateTimeFormat.supportedLocalesOf([e]);
@@ -2610,96 +2622,96 @@ function zl(e) {
2610
2622
  throw new RangeError(`YearSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`);
2611
2623
  }
2612
2624
  }
2613
- function Ca(e, t, r) {
2625
+ function Fa(e, t, r) {
2614
2626
  const n = e === void 0 ? null : e, o = t === void 0 ? null : t.getFullYear();
2615
2627
  return n !== null && o !== null ? r(n, o) : n !== null ? n : o;
2616
2628
  }
2617
- const Bl = (e) => {
2618
- const { value: t, initialDate: r, onChange: n, children: o, minYear: i, maxYear: l, minDate: c, maxDate: f, className: g = "", style: D, disabled: L = !1, prevYearAriaLabel: s = "Previous year", nextYearAriaLabel: x = "Next year", selectAriaLabel: Z = "Year", locale: ee } = e;
2619
- gn(t, "value"), gn(r, "initialDate"), gn(c, "minDate"), gn(f, "maxDate"), Ia(i, "minYear"), Ia(l, "maxYear"), zl(ee);
2620
- const R = t ?? r;
2621
- if (R === void 0)
2629
+ const Kl = (e) => {
2630
+ const { value: t, initialDate: r, onChange: n, children: o, minYear: i, maxYear: l, minDate: s, maxDate: g, className: h = "", style: D, disabled: R = !1, prevYearAriaLabel: c = "Previous year", nextYearAriaLabel: M = "Next year", selectAriaLabel: Z = "Year", locale: ee } = e;
2631
+ bn(t, "value"), bn(r, "initialDate"), bn(s, "minDate"), bn(g, "maxDate"), Ha(i, "minYear"), Ha(l, "maxYear"), Xl(ee);
2632
+ const x = t ?? r;
2633
+ if (x === void 0)
2622
2634
  throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");
2623
- const [de, oe] = ye(() => R.getFullYear()), $ = c?.getTime(), H = f?.getTime(), W = C(() => Ca(i, c, Math.max), [i, $]), ae = C(() => Ca(l, f, Math.min), [l, H]);
2624
- if (W === null || ae === null)
2635
+ const [ue, ne] = Pe(() => x.getFullYear()), P = s?.getTime(), O = g?.getTime(), G = E(() => Fa(i, s, Math.max), [i, P]), ie = E(() => Fa(l, g, Math.min), [l, O]);
2636
+ if (G === null || ie === null)
2625
2637
  throw new RangeError("YearSelector: a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`) are both required; the year option list is never invented.");
2626
- if (W > ae)
2627
- throw new RangeError(`YearSelector: the resolved lower bound ${W} is after the resolved upper bound ${ae}.`);
2628
- const q = t !== void 0, G = t !== void 0 ? t.getFullYear() : de, y = G < W || G > ae, S = R.getTime();
2629
- lt(() => {
2630
- q || oe(R.getFullYear());
2631
- }, [q, S]);
2632
- const T = (z) => z >= W && z <= ae, Y = (z) => {
2633
- if (!L) {
2634
- if (!T(z))
2635
- throw new RangeError(`YearSelector: refusing to emit ${z}, which lies outside the declared bounds ${W}-${ae}.`);
2636
- q || oe(z), n?.(Ea(z), z);
2638
+ if (G > ie)
2639
+ throw new RangeError(`YearSelector: the resolved lower bound ${G} is after the resolved upper bound ${ie}.`);
2640
+ const j = t !== void 0, X = t !== void 0 ? t.getFullYear() : ue, S = X < G || X > ie, L = x.getTime();
2641
+ it(() => {
2642
+ j || ne(x.getFullYear());
2643
+ }, [j, L]);
2644
+ const y = (B) => B >= G && B <= ie, k = (B) => {
2645
+ if (!R) {
2646
+ if (!y(B))
2647
+ throw new RangeError(`YearSelector: refusing to emit ${B}, which lies outside the declared bounds ${G}-${ie}.`);
2648
+ j || ne(B), n?.(Oa(B), B);
2637
2649
  }
2638
- }, V = T(G - 1) ? G - 1 : null, ne = T(G + 1) ? G + 1 : null, ue = () => {
2639
- V !== null && Y(V);
2640
- }, X = () => {
2641
- ne !== null && Y(ne);
2642
- }, J = C(() => {
2643
- const z = [];
2644
- for (let F = ae; F >= W; F--)
2645
- z.push(F);
2646
- return y && (z.push(G), z.sort((F, fe) => fe - F)), z;
2647
- }, [W, ae, y, G]);
2648
- return /* @__PURE__ */ Me("div", { className: `inline-flex items-center ${zr} ${g}`, style: D, children: [
2649
- /* @__PURE__ */ I(Wt, { neighbour: "control", direction: "left", disabled: L, canStep: V !== null, onStep: ue, ariaLabel: s }),
2650
- /* @__PURE__ */ I(
2650
+ }, I = y(X - 1) ? X - 1 : null, re = y(X + 1) ? X + 1 : null, ce = () => {
2651
+ I !== null && k(I);
2652
+ }, K = () => {
2653
+ re !== null && k(re);
2654
+ }, J = E(() => {
2655
+ const B = [];
2656
+ for (let H = ie; H >= G; H--)
2657
+ B.push(H);
2658
+ return S && (B.push(X), B.sort((H, de) => de - H)), B;
2659
+ }, [G, ie, S, X]);
2660
+ return /* @__PURE__ */ we("div", { className: `inline-flex items-center ${Br} ${h}`, style: D, children: [
2661
+ /* @__PURE__ */ $(Xt, { neighbour: "control", direction: "left", disabled: R, canStep: I !== null, onStep: ce, ariaLabel: c }),
2662
+ /* @__PURE__ */ $(
2651
2663
  "select",
2652
2664
  {
2653
2665
  "aria-label": Z,
2654
- disabled: L,
2666
+ disabled: R,
2655
2667
  className: "w-18 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",
2656
- value: G,
2657
- onChange: (z) => {
2658
- if (!z.target.value) return;
2659
- const F = Number(z.target.value);
2660
- Number.isInteger(F) && Y(F);
2668
+ value: X,
2669
+ onChange: (B) => {
2670
+ if (!B.target.value) return;
2671
+ const H = Number(B.target.value);
2672
+ Number.isInteger(H) && k(H);
2661
2673
  },
2662
- children: J.map((z) => /* @__PURE__ */ I("option", { value: z, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: Ke("year", Ea(z), void 0, ee) }, z))
2674
+ children: J.map((B) => /* @__PURE__ */ $("option", { value: B, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: qe("year", Oa(B), void 0, ee) }, B))
2663
2675
  }
2664
2676
  ),
2665
- /* @__PURE__ */ I(Wt, { neighbour: "control", direction: "right", disabled: L, canStep: ne !== null, onStep: X, ariaLabel: x }),
2677
+ /* @__PURE__ */ $(Xt, { neighbour: "control", direction: "right", disabled: R, canStep: re !== null, onStep: K, ariaLabel: M }),
2666
2678
  o
2667
2679
  ] });
2668
- }, Ul = Br(Bl, (e, t) => {
2680
+ }, jl = Ur(Kl, (e, t) => {
2669
2681
  const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, o = r ? r.getFullYear() : null, i = n ? n.getFullYear() : null;
2670
2682
  return !(o !== i || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.minDate?.getFullYear() !== t.minDate?.getFullYear() || e.maxDate?.getFullYear() !== t.maxDate?.getFullYear() || e.onChange !== t.onChange || e.children !== t.children || e.prevYearAriaLabel !== t.prevYearAriaLabel || e.nextYearAriaLabel !== t.nextYearAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
2671
2683
  });
2672
- Ul.displayName = "YearSelector";
2684
+ jl.displayName = "YearSelector";
2673
2685
  export {
2674
- Qi as COLOR_SCHEME_PALETTES,
2675
- Vl as DateSelector,
2676
- _l as MonthSelector,
2677
- Ll as PeriodSlider,
2678
- Ul as YearSelector,
2686
+ ol as COLOR_SCHEME_PALETTES,
2687
+ Hl as DateSelector,
2688
+ Gl as MonthSelector,
2689
+ Al as PeriodSlider,
2690
+ jl as YearSelector,
2679
2691
  Oe as addUnit,
2680
- xl as areStylesEqual,
2681
- al as calculateConnectDragValues,
2682
- va as calculateHandleDragValues,
2683
- il as calculateKeyboardActionValues,
2684
- _a as calculateLabelSlant,
2685
- dl as calculateVernierMacroDrag,
2686
- ml as calculateVernierMicroDrag,
2687
- ie as decode,
2692
+ Tl as areStylesEqual,
2693
+ ul as calculateConnectDragValues,
2694
+ La as calculateHandleDragValues,
2695
+ dl as calculateKeyboardActionValues,
2696
+ Ka as calculateLabelSlant,
2697
+ bl as calculateVernierMacroDrag,
2698
+ wl as calculateVernierMicroDrag,
2699
+ le as decode,
2688
2700
  Q as encode,
2689
- be as findNearestDateIndex,
2690
- Ke as formatLabel,
2701
+ ge as findNearestDateIndex,
2702
+ qe as formatLabel,
2691
2703
  gr as formatScreenReaderLabel,
2692
- tl as getMacroWindowEndDate,
2693
- el as getMacroWindowStartDate,
2694
- Vt as getSortedAllowedDates,
2695
- je as normalizeDateByUnit,
2696
- go as resolveDraggedEdge,
2704
+ il as getMacroWindowEndDate,
2705
+ al as getMacroWindowStartDate,
2706
+ kt as getSortedAllowedDates,
2707
+ Ze as normalizeDateByUnit,
2708
+ wo as resolveDraggedEdge,
2697
2709
  xt as resolveMacroWindow,
2698
- Ba as resolveVernierRailZone,
2699
- ul as resolveVernierTargetHandle,
2700
- cl as resolveWheelStep,
2701
- ql as usePeriodSliderPoint,
2702
- jl as usePeriodSliderRange,
2703
- Jl as useVernierSliderPoint,
2704
- Zl as useVernierSliderRange
2710
+ qa as resolveVernierRailZone,
2711
+ hl as resolveVernierTargetHandle,
2712
+ gl as resolveWheelStep,
2713
+ ts as usePeriodSliderPoint,
2714
+ es as usePeriodSliderRange,
2715
+ ns as useVernierSliderPoint,
2716
+ rs as useVernierSliderRange
2705
2717
  };