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