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