@aiquants/period-slider 0.6.0 → 0.8.0

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