@aiquants/period-slider 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DateSelector.d.ts +0 -3
- package/dist/DateSelector.d.ts.map +1 -1
- package/dist/MonthSelector.d.ts +0 -3
- package/dist/MonthSelector.d.ts.map +1 -1
- package/dist/PeriodSlider.d.ts +15 -4
- package/dist/PeriodSlider.d.ts.map +1 -1
- package/dist/YearSelector.d.ts +0 -3
- package/dist/YearSelector.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +1366 -1247
- package/dist/usePeriodSlider.d.ts +25 -1
- package/dist/usePeriodSlider.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/DateSelector.tsx +24 -11
- package/src/MonthSelector.tsx +25 -14
- package/src/PeriodSlider.tsx +361 -91
- package/src/YearSelector.tsx +30 -13
- package/src/usePeriodSlider.ts +24 -0
package/dist/DateSelector.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { PeriodSliderUnit } from './PeriodSlider';
|
|
3
2
|
/**
|
|
4
3
|
* Props of the day-resolution selector.
|
|
5
4
|
* 日単位セレクタの Props。
|
|
@@ -16,8 +15,6 @@ export interface DateSelectorProps {
|
|
|
16
15
|
value?: Date;
|
|
17
16
|
/** Initial selected date; required unless `value` is supplied; must be a valid Date / 初期選択日付(非制御用・`value` 未指定時は必須・Invalid Date 不可) */
|
|
18
17
|
initialDate?: Date;
|
|
19
|
-
/** Time resolution unit (ignored by selector, accepted for hook interoperability) / 時間解像度単位 (フック相互運用用) */
|
|
20
|
-
unit?: PeriodSliderUnit;
|
|
21
18
|
/** Callback triggered when a selectable date is chosen / 選択可能な日付が選ばれた時のコールバック */
|
|
22
19
|
onChange?(date: Date): void;
|
|
23
20
|
/** Child elements / 子要素 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateSelector.d.ts","sourceRoot":"","sources":["../src/DateSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"DateSelector.d.ts","sourceRoot":"","sources":["../src/DateSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAC9B,oJAAoJ;IACpJ,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,sIAAsI;IACtI,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,iFAAiF;IACjF,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;IAC3B,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,+GAA+G;IAC/G,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+GAA+G;IAC/G,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gHAAgH;IAChH,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,gHAAgH;IAChH,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,4GAA4G;IAC5G,YAAY,CAAC,EAAE,IAAI,EAAE,CAAA;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAAA;IAChD,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qFAAqF;IACrF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,6EAA6E;IAC7E,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qFAAqF;IACrF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,sGAAsG;IACtG,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kGAAkG;IAClG,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0PAA0P;IAC1P,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gKAAgK;IAChK,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAC3C,oMAAoM;IACpM,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC7C,gMAAgM;IAChM,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;CAC5C;AAqmBD;;;GAGG;AACH,eAAO,MAAM,YAAY,oCA/Xa,iBAAiB,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAuZzE,CAAA"}
|
package/dist/MonthSelector.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { PeriodSliderUnit } from './PeriodSlider';
|
|
3
2
|
/**
|
|
4
3
|
* Props of the month-resolution selector.
|
|
5
4
|
* 月単位セレクタの Props。
|
|
@@ -16,8 +15,6 @@ export interface MonthSelectorProps {
|
|
|
16
15
|
value?: Date;
|
|
17
16
|
/** Initial selected date; required unless `value` is supplied / 選択日付(非制御用・`value` 未指定時は必須) */
|
|
18
17
|
initialDate?: Date;
|
|
19
|
-
/** Time resolution unit (ignored by selector, accepted for hook interoperability) / 時間解像度単位 (フック相互運用用) */
|
|
20
|
-
unit?: PeriodSliderUnit;
|
|
21
18
|
/** Callback triggered when month changes / 月変更時コールバック */
|
|
22
19
|
onChange?(date: Date, yyyymm: number): void;
|
|
23
20
|
/** Child elements / 子要素 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthSelector.d.ts","sourceRoot":"","sources":["../src/MonthSelector.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"MonthSelector.d.ts","sourceRoot":"","sources":["../src/MonthSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAC/B,8GAA8G;IAC9G,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,8FAA8F;IAC9F,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,yDAAyD;IACzD,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3C,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC7B,kOAAkO;IAClO,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oOAAoO;IACpO,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+IAA+I;IAC/I,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,+IAA+I;IAC/I,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wFAAwF;IACxF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oPAAoP;IACpP,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB;AA8UD;;;GAGG;AACH,eAAO,MAAM,aAAa,oCAzLa,kBAAkB,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAmN3E,CAAA"}
|
package/dist/PeriodSlider.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export interface PeriodSliderRangeProps extends BasePeriodSliderProps {
|
|
|
167
167
|
mode: "range";
|
|
168
168
|
/** Controlled selected date range tuple [lower, upper] / 制御時の選択期間タプル */
|
|
169
169
|
range?: [Date, Date];
|
|
170
|
-
/** Initial date range tuple for uncontrolled usage /
|
|
170
|
+
/** Initial date range tuple for uncontrolled usage; with `range` also omitted the selection starts at the domain bounds / 非制御時の初期選択期間タプル。`range` ともに未指定なら選択は定義域の両端から開始 */
|
|
171
171
|
defaultRange?: [Date, Date];
|
|
172
172
|
/** Callback triggered when the selected range changes / 期間変更時コールバック */
|
|
173
173
|
onChangeRange?: (lower: Date, upper: Date) => void;
|
|
@@ -189,7 +189,7 @@ export interface PeriodSliderPointProps extends BasePeriodSliderProps {
|
|
|
189
189
|
mode: "point";
|
|
190
190
|
/** Controlled selected point date / 制御時の選択日付 */
|
|
191
191
|
value?: Date;
|
|
192
|
-
/** Initial point date for uncontrolled usage /
|
|
192
|
+
/** Initial point date for uncontrolled usage; with `value` also omitted the selection starts at the domain start / 非制御時の初期選択日付。`value` ともに未指定なら選択は定義域の先頭から開始 */
|
|
193
193
|
defaultValue?: Date;
|
|
194
194
|
/** Callback triggered when the selected point changes / ポイント変更時コールバック */
|
|
195
195
|
onChangePoint?: (value: Date) => void;
|
|
@@ -450,8 +450,19 @@ export type VernierHandle = "macro-low" | "macro-high" | "macro-connect" | "micr
|
|
|
450
450
|
/**
|
|
451
451
|
* Resolves the target Vernier handle based on pointer primary-axis ratio and cross-axis offset relative to track center.
|
|
452
452
|
* トラック中心線に対するポインターの直交軸オフセットと主軸比率から、操作対象となるノギスハンドル(マクロまたはミクロ)を判定します。
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
*
|
|
454
|
+
* @param pointerPrimaryRatio - Pointer position along the track as a 0-1 ratio / トラック主軸上のポインター位置比率 (0-1)
|
|
455
|
+
* @param pointerCrossAxisOffset - Signed pointer offset from the track center line in pixels / トラック中心線からのポインター直交軸オフセット (ピクセル、符号付き)
|
|
456
|
+
* @param macroLowRatio - Macro window start position as a 0-1 ratio / マクロ窓開始位置の比率 (0-1)
|
|
457
|
+
* @param macroHighRatio - Macro window end position as a 0-1 ratio / マクロ窓終了位置の比率 (0-1)
|
|
458
|
+
* @param microLowRatio - Micro selection start position as a 0-1 ratio / ミクロ選択開始位置の比率 (0-1)
|
|
459
|
+
* @param microHighRatio - Micro selection end position as a 0-1 ratio / ミクロ選択終了位置の比率 (0-1)
|
|
460
|
+
* @param orientation - Which rail the macro scale is drawn on (default: "macro-top") / マクロスケールを描くレール (既定: "macro-top")
|
|
461
|
+
* @param handleHitSlopRatio - Hit slop around a knob as a 0-1 ratio (default: 0.05) / つまみ周辺の当たり判定余裕 (0-1 比率、既定: 0.05)
|
|
462
|
+
* @param allowConnectHandles - Whether a press inside a band may grab the band itself (default: true) / 帯の内側の押下で帯自体を掴めるか (既定: true)
|
|
463
|
+
* @returns Handle the press targets / 押下が対象とするハンドル
|
|
464
|
+
*/
|
|
465
|
+
export declare function resolveVernierTargetHandle(pointerPrimaryRatio: number, pointerCrossAxisOffset: number, macroLowRatio: number, macroHighRatio: number, microLowRatio: number, microHighRatio: number, orientation?: "macro-top" | "macro-bottom" | "macro-left" | "macro-right", handleHitSlopRatio?: number, allowConnectHandles?: boolean): VernierHandle;
|
|
455
466
|
/**
|
|
456
467
|
* Calculates updated macro window range when dragging a macro handle or connect bar, supporting crossover swapping.
|
|
457
468
|
* マクロハンドルまたはコネクトバードラッグ時の新マクロ範囲を算出します (上限下限反転スワップ対応)。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodSlider.d.ts","sourceRoot":"","sources":["../src/PeriodSlider.tsx"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"PeriodSlider.d.ts","sourceRoot":"","sources":["../src/PeriodSlider.tsx"],"names":[],"mappings":"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"}
|
package/dist/YearSelector.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { PeriodSliderUnit } from './PeriodSlider';
|
|
3
2
|
/**
|
|
4
3
|
* Props of the year-resolution selector.
|
|
5
4
|
* 年単位セレクタの Props。
|
|
@@ -16,8 +15,6 @@ export interface YearSelectorProps {
|
|
|
16
15
|
value?: Date;
|
|
17
16
|
/** Initial selected date; required unless `value` is supplied / 選択日付(非制御用・`value` 未指定時は必須) */
|
|
18
17
|
initialDate?: Date;
|
|
19
|
-
/** Time resolution unit (ignored by selector, accepted for hook interoperability) / 時間解像度単位 (フック相互運用用) */
|
|
20
|
-
unit?: PeriodSliderUnit;
|
|
21
18
|
/** Callback triggered when year changes / 年変更時コールバック */
|
|
22
19
|
onChange?(date: Date, year: number): void;
|
|
23
20
|
/** Child elements / 子要素 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YearSelector.d.ts","sourceRoot":"","sources":["../src/YearSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"YearSelector.d.ts","sourceRoot":"","sources":["../src/YearSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAC9B,8GAA8G;IAC9G,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,8FAA8F;IAC9F,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,wDAAwD;IACxD,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,mKAAmK;IACnK,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mKAAmK;IACnK,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+IAA+I;IAC/I,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,+IAA+I;IAC/I,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sFAAsF;IACtF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4KAA4K;IAC5K,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB;AA4ND;;;GAGG;AACH,eAAO,MAAM,YAAY,oCArIa,iBAAiB,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAyJzE,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),ge=require("date-fns"),n=require("react"),ca={"blue-rose":{macro:"#0284c7",macroLight:"#38bdf8",micro:"#e11d48",microLight:"#fb7185",accent:"#0284c7"},"indigo-amber":{macro:"#4f46e5",macroLight:"#818cf8",micro:"#d97706",microLight:"#fbbf24",accent:"#4f46e5"},"teal-emerald":{macro:"#0d9488",macroLight:"#2dd4bf",micro:"#059669",microLight:"#34d399",accent:"#0d9488"},"violet-fuchsia":{macro:"#7c3aed",macroLight:"#a78bfa",micro:"#c026d3",microLight:"#e879f9",accent:"#7c3aed"},"slate-sky":{macro:"#475569",macroLight:"#94a3b8",micro:"#0284c7",microLight:"#38bdf8",accent:"#475569"},monochrome:{macro:"#52525b",macroLight:"#a1a1aa",micro:"#18181b",microLight:"#71717a",accent:"#27272a"}},ct=e=>e instanceof Date&&!Number.isNaN(e.getTime()),he=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),Oe=(e,t)=>{if(!ct(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${he(t)})`);const r=new Date(t.getTime());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},Q=(e,t)=>{const r=Oe(e,t),a=r.getFullYear(),o=r.getMonth()+1,c=r.getDate();return e==="year"?a:e==="month"?a*12+(o-1):Math.floor(Date.UTC(a,o-1,c)/(1440*60*1e3))},oe=(e,t)=>{if(e==="year")return new Date(t,0,1);if(e==="month"){const a=Math.floor(t/12),o=t%12;return new Date(a,o,1)}const r=new Date(t*24*60*60*1e3);return new Date(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate())},Te=(e,t,r)=>{if(!ct(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${he(t)})`);return e==="year"?ge.addYears(t,r):e==="month"?ge.addMonths(t,r):ge.addDays(t,r)},st=(e,t,r)=>{if(!ct(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${he(r)})`);if(e===t)return Oe(t,r);const a=r.getFullYear(),o=r.getMonth();if(e==="year"){if(t==="month")return new Date(a,11,1);if(t==="day")return new Date(a,11,31)}return e==="month"&&t==="day"?new Date(a,o+1,0):Oe(t,r)},Ba={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},ea=new Map,za=(e,t)=>{const r=`${e}\0${t}`,a=ea.get(r);if(a!==void 0)return a;const o=new Intl.DateTimeFormat(t,Ba[e]);return ea.set(r,o),o},_a=(e,t)=>{const r=String(t.getFullYear()).padStart(4,"0");if(e==="year")return r;const a=String(t.getMonth()+1).padStart(2,"0");if(e==="month")return`${r}-${a}`;const o=String(t.getDate()).padStart(2,"0");return`${r}-${a}-${o}`},Le=(e,t,r,a)=>ct(t)?r?r(t):a===void 0?_a(e,t):za(e,a).format(t):"",Mt=(e,t,r,a)=>Le(e,t,r,a),at=(e,t,r)=>{if(!e||e.length===0||e.length===1)return 0;const a=Q(r,t);let o=0,c=e.length-1;if(a<=Q(r,e[o]))return 0;if(a>=Q(r,e[c]))return c;for(;o<=c;){const b=o+c>>1,w=Q(r,e[b]);if(w===a)return b;w<a?o=b+1:c=b-1}const i=Math.abs(Q(r,e[o])-a),m=Math.abs(Q(r,e[c])-a);return i<m?o:c},Yt=(e,t,r,a)=>{if(!Array.isArray(e)||e.length===0)return[];const o=Q(t,r),c=Q(t,a),i=new Map;for(const m of e){const b=Oe(t,m),w=Q(t,b);w<o||w>c||i.has(w)||i.set(w,b)}if(i.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${he(r)}, maxDate: ${he(a)}, entries: ${e.length})`);return Array.from(i.keys()).sort((m,b)=>m-b).map(m=>i.get(m))},Cr=(e,t,r,a,o,c,i)=>{let m=r,b=a;return i?(m=t,b=t):e==="low"?t>a?(m=a,b=t):m=t:t<r?(b=r,m=t):b=t,[Math.max(o,Math.min(c,m)),Math.max(o,Math.min(c,b))]},ua=(e,t,r,a,o)=>o?"low":e==="low"?t>a?"high":"low":t<r?"low":"high",da=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:a,rangeMax:o,isDiscrete:c,sortedAllowedDates:i,snapMode:m,unit:b})=>{if(c){const B=i.length-1;if(B<=0)return[0,0];const W=Math.max(0,Math.min(B,Math.round(t))),D=Math.max(W,Math.min(B,Math.round(r)));if(m==="time"){const A=i[0].getTime(),H=i[B].getTime(),T=i[W].getTime(),F=i[D].getTime()-T;let E=T+e*(H-A),g=E+F;E<A&&(E=A,g=A+F),g>H&&(g=H,E=H-F);const S=at(i,new Date(E),b),k=at(i,new Date(g),b);return[S,Math.max(S,k)]}const X=Math.round(e*B);let Y=W+X,J=D+X;return Y<0&&(J+=-Y,Y=0),J>B&&(Y-=J-B,J=B),[Math.max(0,Math.min(B,Y)),Math.max(0,Math.min(B,J))]}const w=B=>Math.max(a,Math.min(o,B)),p=o-a;if(p<=0)return[w(t),w(r)];const y=Math.round(e*p);let u=t+y,v=r+y;return u<a&&(v+=a-u,u=a),v>o&&(u-=v-o,v=o),[w(u),w(v)]},ma=(e,t,r,a,o,c,i,m)=>{let b=0,w=!1,p=!1;switch(e){case"ArrowRight":case"ArrowUp":b=m;break;case"ArrowLeft":case"ArrowDown":b=-m;break;case"PageUp":b=m*5;break;case"PageDown":b=-m*5;break;case"Home":w=!0;break;case"End":p=!0;break;default:return null}if(i){let v=r;return w?v=o:p?v=c:v=Math.max(o,Math.min(c,r+b)),[v,v]}let y=r,u=a;return t==="low"?w?y=o:p?y=a:y=Math.max(o,Math.min(a,r+b)):w?u=r:p?u=c:u=Math.max(r,Math.min(c,a+b)),[y,u]},fa=8,ga=2,ha=16,qa=12,Ka=90,ba=(e,t)=>{const r=t?.estimatedHeightPx??ha,o=fa+(t?.anchorGapY??ga)+r/2,c=e==="top"?-o:o;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:c,highOffsetY:c,isSlanted:!1,proximity:0}},wa=(e,t,r,a="top",o)=>{const c=o?.estimatedWidthPx,i=o?.estimatedHeightPx??ha,m=o?.paddingPx??qa,b=o?.maxAngleDeg??Ka,w=fa+(o?.anchorGapY??ga),p=ba(a,o);if(!(Number.isFinite(r)&&r>0)||c===void 0||!Number.isFinite(c)||c<=0)return p;const y=Math.max(0,t-e)/100*r,u=c+m;if(y>=u)return p;const v=Math.max(0,Math.min(1,(u-y)/u)),W=v*v*v*(v*(v*6-15)+10)*b,D=a==="top"?-W:W,X=W*Math.PI/180,Y=c/2*Math.abs(Math.sin(X))+i/2*Math.abs(Math.cos(X)),J=w+Y,A=a==="top"?-J:+J,H=c*Math.abs(Math.cos(X))+i*Math.abs(Math.sin(X)),T=Math.max(0,(H+m-y)/2);return{lowAngleDeg:D,highAngleDeg:D,lowOffsetX:-T,highOffsetX:T,lowOffsetY:A,highOffsetY:A,isSlanted:v>.001,proximity:v}};function xa(e,t,r,a,o,c,i="macro-top",m=.05){const b=i==="macro-top"||i==="macro-left",w=t<=0;if(b&&w||!(b||w)){const u=Math.abs(e-r),v=Math.abs(e-a);return u<=m&&u<=v?"macro-low":v<=m&&v<u?"macro-high":e>=r&&e<=a?"macro-connect":u<v?"macro-low":"macro-high"}const p=Math.abs(e-o),y=Math.abs(e-c);return p<=m&&p<=y?"micro-low":y<=m&&y<p?"micro-high":e>=o&&e<=c?"micro-connect":p<y?"micro-low":"micro-high"}function Ma(e,t,r,a,o){if(e==="macro-connect"){const i=t-r,m=o-a,b=Math.max(0,Math.min(1-m,a+i)),w=b+m;return[b,w,"macro-connect"]}if(e==="macro-low"){const i=Math.max(0,Math.min(1,t));return i>o?[o,i,"macro-high"]:[i,o,"macro-low"]}const c=Math.max(0,Math.min(1,t));return c<a?[c,a,"macro-low"]:[a,c,"macro-high"]}function va(e,t,r,a,o){if(e==="micro-connect"){const i=t-r,m=o-a,b=Math.max(0,Math.min(1-m,a+i)),w=b+m;return[b,w,"micro-connect"]}if(e==="micro-low"){const i=Math.max(0,Math.min(1,t));return i>o?[o,i,"micro-high"]:[i,o,"micro-low"]}const c=Math.max(0,Math.min(1,t));return c<a?[c,a,"micro-low"]:[a,c,"micro-high"]}const Kt=n.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:a=!0})=>{let o,c;r?(o=a?"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",c=`period-slider-knob period-slider-knob-svg is-vertical ${a?"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",c=`period-slider-knob period-slider-knob-svg ${t?"is-semicircle-top":"is-semicircle-bottom"}`);const i=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return f.jsx("svg",{className:c,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:f.jsx("path",{d:o,className:i,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});Kt.displayName="VernierKnobSvg";const Xa=(e,t)=>{if(!ct(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${he(e)})`);if(!ct(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${he(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${he(e)}, maxDate: ${he(t)})`)},Sr=(e,t)=>{if(!Array.isArray(t)||t.length!==2)throw new RangeError(`PeriodSlider: ${e} is required and must be a [start, end] Date tuple (received: ${he(t)})`);const[r,a]=t;if(!ct(r))throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${he(r)})`);if(!ct(a))throw new RangeError(`PeriodSlider: ${e}[1] must be a valid Date (received: ${he(a)})`);if(a.getTime()<r.getTime())throw new RangeError(`PeriodSlider: ${e} must not be inverted (start: ${he(r)}, end: ${he(a)})`)},Ga=(e,t,r)=>{if(Sr("macroRange",e),t!==void 0)return Sr("microRange",t),t;if(r!==void 0)return Sr("defaultMicroRange",r),r;throw new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)")},dr=(e,t,r,a,o,c,i,m)=>{const b=at(e,a,t),w=at(e,o,t);if(i)return e[b];if(m)return e[w];const p=Math.max(b,Math.min(w,at(e,r,t)+c));return e[p]},Lr=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},Wa=(e,t)=>{try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{throw new RangeError(`PeriodSlider: ${e} must be a valid BCP 47 language tag (received: ${JSON.stringify(t)})`)}},ta=()=>{const[e,t]=n.useState(null),r=n.useRef(null),a=n.useCallback(o=>{if(r.current?.disconnect(),r.current=null,o===null){t(null);return}if(typeof ResizeObserver>"u")return;const c=new ResizeObserver(i=>{for(const m of i){const b=m.borderBoxSize?.[0];b!==void 0&&t(w=>w!==null&&Math.abs(w.widthPx-b.inlineSize)<.5&&Math.abs(w.heightPx-b.blockSize)<.5?w:{widthPx:b.inlineSize,heightPx:b.blockSize})}});c.observe(o),r.current=c},[]);return n.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[a,e]},Ja={horizontal:{decrease:"◀",increase:"▶"},vertical:{decrease:"▼",increase:"▲"}},Za={horizontal:{decrease:"period-slider-stepper-prev",increase:"period-slider-stepper-next"},vertical:{decrease:"period-slider-stepper-prev period-slider-stepper-down",increase:"period-slider-stepper-next period-slider-stepper-up"}},Qa=e=>{const{unit:t,minDate:r,maxDate:a,allowedDates:o,snapMode:c="index",disabled:i=!1,className:m="",showStepper:b=!0,tooltipStyle:w="always",labelPosition:p="top",autoSlantLabels:y=!0,isVertical:u=!1,hideConnectBar:v=!1,showTicks:B=!1,colorScheme:W="blue-rose",locale:D,decreaseAriaLabel:X="Decrease",increaseAriaLabel:Y="Increase"}=e;Xa(r,a),D!==void 0&&Wa("locale",D);const J=e.mode==="vernier"?Ga(e.macroRange,e.microRange,e.defaultMicroRange):null,A=ca[W],H=n.useId(),T=n.useRef(e);T.current=e;const F=r.getTime(),E=a.getTime(),g=n.useMemo(()=>Yt(o,t,r,a),[o,t,F,E]),S=g.length>0,{rangeMin:k,rangeMax:j}=n.useMemo(()=>S?{rangeMin:0,rangeMax:g.length-1}:{rangeMin:Q(t,r),rangeMax:Q(t,a)},[S,g,t,F,E]),P=e.mode==="point",te=n.useCallback(l=>{if(S){const s=Math.max(0,Math.min(g.length-1,Math.round(l)));return g[s]}return oe(t,Math.round(l))},[S,g,t]),_=n.useCallback(l=>{if(l===void 0)return k;const s=Oe(t,l);return S?at(g,s,t):Q(t,s)},[S,g,t,k]),[z,ee]=n.useState(()=>J),re=e.mode!=="vernier"?null:e.microRange!==void 0?e.microRange:z,ce=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?re?.[0]:void 0,Fe=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?re?.[1]:void 0,ae=e.mode==="point"?e.value??e.defaultValue:void 0,Ge=e.mode==="point"?ae?.getTime():ce?.getTime(),ut=e.mode==="range"?Fe?.getTime():Ge,[Re,be]=n.useMemo(()=>{if(e.mode==="point"){const d=_(ae);return[d,d]}const l=_(ce),s=_(Fe);return[Math.min(l,s),Math.max(l,s)]},[e.mode,Ge,ut,_,ae,ce,Fe]),le=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:e.microRange!==void 0,[I,O]=n.useState(()=>[Re,be]),[K,se]=n.useState(null),[$,me]=n.useState(null),Ne=n.useRef(null);Ne.current=$;const[We,ie]=n.useState("high"),[we,dt]=n.useState(null),[Et,Wt]=n.useState(null),ue=K?K[0]:le?Re:I[0],de=K?K[1]:le?be:I[1],G=e.mode==="vernier",mt=e.mode==="vernier"?e.vernierOrientation??(u?"macro-left":"macro-top"):"macro-top",R=mt==="macro-top"||mt==="macro-left",Jt=e.mode==="vernier"?e.showVernierProjection??!0:!1,Zt=e.mode==="vernier"?e.showVernierTicks??!0:!1,Dt=e.mode==="vernier"?e.showHairline??!0:!1,U=G?e.macroUnit??t:t,N=G?e.microUnit??t:t,It=G?e.macroIsDiscrete??!1:S,nt=G?e.microIsDiscrete??!1:S,Qt=G?e.macroAllowedDates??o:o,hr=G?e.microAllowedDates??o:o,h=G?e.formatMacroLabel??e.formatLabel:e.formatLabel,C=G?e.formatMicroLabel??e.formatLabel:e.formatLabel,Ae=e.mode==="vernier"?e.macroRange[0].getTime():void 0,pt=e.mode==="vernier"?e.macroRange[1].getTime():void 0,ft=ce?.getTime(),Je=Fe?.getTime(),[pe,er]=n.useState(null),gt=n.useRef(null);gt.current=pe;const[ke,tr]=n.useState("micro-high"),Se=n.useMemo(()=>Q(U,r),[F,U]),yt=n.useMemo(()=>{const l=Q(U,a);if(G&&l<=Se)throw new RangeError(`PeriodSlider: macroUnit "${U}" cannot distinguish minDate from maxDate (minDate: ${he(r)}, maxDate: ${he(a)})`);return l},[G,F,E,Se,U]),Ye=n.useMemo(()=>G?Yt(Qt,U,r,a):[],[G,Qt,U,F,E]),Ue=n.useMemo(()=>e.mode!=="vernier"?Se:Q(U,e.macroRange[0]),[e.mode,Ae,Se,U]),Be=n.useMemo(()=>e.mode!=="vernier"?yt:Q(U,e.macroRange[1]),[e.mode,pt,yt,U]),fe=n.useMemo(()=>e.mode!=="vernier"?Q(N,r):Math.max(Q(N,e.macroRange[0]),Q(N,r)),[e.mode,Ae,N,F]),Ee=n.useMemo(()=>e.mode!=="vernier"?Q(N,a):Math.min(Q(N,st(U,N,e.macroRange[1])),Q(N,a)),[e.mode,pt,U,N,E]),Ie=n.useMemo(()=>G?Yt(hr,N,r,a).filter(s=>{const d=Q(N,s);return d>=fe&&d<=Ee}):[],[G,hr,N,F,E,fe,Ee]),xe=n.useMemo(()=>re===null?fe:Q(N,re[0]),[ft,fe,N,re]),Me=n.useMemo(()=>re===null?Ee:Q(N,re[1]),[Je,Ee,N,re]),jt=n.useMemo(()=>oe(N,xe),[N,xe]),Ht=n.useMemo(()=>oe(N,Me),[N,Me]),Ot=Math.max(1,yt-Se),ve=Math.max(0,Math.min(1,(Ue-Se)/Ot)),$e=Math.max(ve,Math.min(1,(Be-Se)/Ot)),Vt=Math.max(1,Ee-fe),ze=Math.max(0,Math.min(1,(xe-fe)/Vt)),ht=Math.max(ze,Math.min(1,(Me-fe)/Vt)),br=n.useRef({timerId:null,emit:null}),wr=n.useRef({timerId:null,emit:null}),xr=n.useRef({timerId:null,emit:null});n.useEffect(()=>{const l=[br,wr,xr];return()=>{for(const s of l)Lr(s.current)}},[]);const Tt=n.useCallback((l,s,d)=>{Lr(l);const{debounceMs:x}=T.current;if(d||!x||x<=0){s();return}l.emit=s,l.timerId=setTimeout(()=>{l.timerId=null,l.emit=null,s()},x)},[]),Mr=n.useCallback(l=>{const s=l.emit;Lr(l),s?.()},[]),Rt=n.useCallback(l=>new Date(Math.min(Math.max(l.getTime(),F),E)),[F,E]),jr=n.useRef(null),_e=n.useCallback((l,s,d=!1)=>{const x=te(l),L=te(s),Z=T.current.mode==="point"?`${x.getTime()}`:`${x.getTime()}-${L.getTime()}`;if(Z===jr.current&&br.current.timerId===null)return;const ne=()=>{jr.current=Z;const V=T.current;V.mode==="point"?V.onChangePoint?.(x):V.mode==="range"&&V.onChangeRange?.(x,L)};Tt(br.current,ne,d)},[te,Tt]),St=n.useCallback((l,s,d=!1)=>{if(T.current.mode!=="vernier")return;const x=Rt(l),L=Rt(s);Tt(wr.current,()=>{const Z=T.current;Z.mode==="vernier"&&Z.onChangeMacroRange?.(x,L)},d)},[Rt,Tt]),Ze=n.useCallback((l,s,d=!1)=>{const x=T.current;if(x.mode!=="vernier")return;const L=Rt(l),Z=Rt(s);x.microRange===void 0&&ee([L,Z]),Tt(xr.current,()=>{const ne=T.current;ne.mode==="vernier"&&ne.onChangeMicroRange?.(L,Z)},d)},[Rt,Tt]),rr=n.useCallback(l=>{if(S&&c==="time"&&g.length>1){const x=Math.max(0,Math.min(g.length-1,Math.round(l))),L=g[0].getTime(),ne=g[g.length-1].getTime()-L;if(ne<=0)return 0;const V=g[x].getTime();return Math.max(0,Math.min(100,(V-L)/ne*100))}const s=j-k;if(s<=0)return 0;const d=(l-k)/s*100;return Math.max(0,Math.min(100,d))},[S,c,g,k,j]),ar=n.useCallback(l=>{const s=Math.max(0,Math.min(100,l));if(S){if(c==="time"&&g.length>1){const L=g[0].getTime(),ne=g[g.length-1].getTime()-L,V=L+s/100*ne;return at(g,new Date(V),t)}const x=Math.round(s/100*(g.length-1));return Math.max(0,Math.min(g.length-1,x))}const d=k+s/100*(j-k);return Math.round(d)},[S,c,g,k,j,t]),Qe=n.useRef(null),[Hr,Or]=n.useState(0),[La,bt]=ta(),[ka,nr]=ta();n.useEffect(()=>{const l=Qe.current;if(!l)return;const s=()=>{const d=l.getBoundingClientRect(),x=u?d.height:d.width;x>0&&Or(L=>Math.abs(L-x)<.5?L:x)};if(s(),typeof ResizeObserver<"u"){const d=new ResizeObserver(x=>{for(const L of x){const Z=u?L.contentRect.height:L.contentRect.width;Z>0&&Or(ne=>Math.abs(ne-Z)<.5?ne:Z)}});return d.observe(l),()=>d.disconnect()}return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[u]);const wt=n.useCallback((l,s,d)=>{const x=u?d.height:d.width;if(!(Number.isFinite(x)&&x>0))return null;const L=u?d.bottom-s:l-d.left;return Number.isFinite(L)?Math.max(0,Math.min(1,L/x)):null},[u]),Vr=n.useCallback((l,s)=>{const d=Qe.current;if(!d)return null;const x=wt(l,s,d.getBoundingClientRect());return x===null?null:x*100},[wt]),or=n.useRef(null),vr=n.useRef(null),qe=n.useRef(null),Dr=n.useRef(null),Ft=n.useRef(null),Fr=n.useCallback(l=>{if(i)return;if(G){const M=vr.current;if(!M||l.pointerId!==0&&l.pointerId!==M.pointerId||!Qe.current)return;const Ce=wt(l.clientX,l.clientY,Qe.current.getBoundingClientRect());if(Ce===null)return;if(M.handle==="macro-low"||M.handle==="macro-high"||M.handle==="macro-connect"){const[xt,Ut,et]=Ma(M.handle,Ce,M.startPointerRatio,M.startMacroLowRatio,M.startMacroHighRatio);et!==gt.current&&(gt.current=et,er(et),tr(et));let De,je;if(It&&Ye.length>0){const Ke=Ye.length-1,rt=Math.max(0,Math.min(Ke,Math.round(xt*Ke))),it=Math.max(rt,Math.min(Ke,Math.round(Ut*Ke)));De=Ye[rt],je=Ye[it]}else{const Ke=Math.round(Se+xt*Ot),rt=Math.round(Se+Ut*Ot);De=oe(U,Ke),je=oe(U,rt)}const Bt=`${De.getTime()}_${je.getTime()}`;Bt!==Dr.current&&(Dr.current=Bt,St(De,je));let He,tt;if(M.handle==="macro-connect"){const Ke=Oe(N,De),rt=st(U,N,je);let it,Ct;if(U==="year"){const lt=De.getFullYear()-M.startMacroLowDate.getFullYear();it=Te("year",M.initialMicroLowDate,lt),Ct=Te("year",M.initialMicroHighDate,lt)}else if(U==="month"){const lt=(De.getFullYear()-M.startMacroLowDate.getFullYear())*12+(De.getMonth()-M.startMacroLowDate.getMonth());it=Te("month",M.initialMicroLowDate,lt),Ct=Te("month",M.initialMicroHighDate,lt)}else{const lt=Math.round((De.getTime()-M.startMacroLowDate.getTime())/864e5);it=Te("day",M.initialMicroLowDate,lt),Ct=Te("day",M.initialMicroHighDate,lt)}const Pt=Ke.getTime(),zt=rt.getTime(),Qr=M.initialMicroHighDate.getTime()-M.initialMicroLowDate.getTime();let _t=it.getTime(),qt=Ct.getTime();_t<Pt&&(_t=Pt,qt=Math.min(zt,_t+Qr)),qt>zt&&(qt=zt,_t=Math.max(Pt,qt-Qr)),He=Oe(N,new Date(_t)),tt=Oe(N,new Date(qt))}else{const Ke=De.getTime(),rt=st(U,N,je).getTime(),it=M.initialMicroLowDate.getTime(),Ct=M.initialMicroHighDate.getTime(),Pt=Math.max(Ke,Math.min(rt,it)),zt=Math.max(Pt,Math.min(rt,Ct));He=Oe(N,new Date(Pt)),tt=Oe(N,new Date(zt))}const ur=`${He.getTime()}_${tt.getTime()}`;ur!==Ft.current&&(Ft.current=ur,Ze(He,tt))}else if(M.handle==="micro-low"||M.handle==="micro-high"||M.handle==="micro-connect"){const[xt,Ut,et]=va(M.handle,Ce,M.startPointerRatio,M.startMicroLowRatio,M.startMicroHighRatio);et!==gt.current&&(gt.current=et,er(et),tr(et));let De,je;if(nt&&Ie.length>0){const He=Ie.length-1,tt=Math.max(0,Math.min(He,Math.round(xt*He))),ur=Math.max(tt,Math.min(He,Math.round(Ut*He)));De=Ie[tt],je=Ie[ur]}else{const He=Math.round(fe+xt*Vt),tt=Math.round(fe+Ut*Vt);De=oe(N,He),je=oe(N,tt)}const Bt=`${De.getTime()}_${je.getTime()}`;Bt!==Ft.current&&(Ft.current=Bt,Ze(De,je))}return}const s=or.current;if(!s||l.pointerId!==0&&l.pointerId!==s.pointerId||!Qe.current)return;const d=Qe.current.getBoundingClientRect(),x=u?l.clientY:l.clientX,L=u?d.height:d.width;if(!(Number.isFinite(L)&&L>0))return;if(s.handle==="connect"){const M=u?(s.startPointerPos-x)/L:(x-s.startPointerPos)/L,Ce=da({posDiffPct:M,startLowVal:s.startLowVal,startHighVal:s.startHighVal,rangeMin:k,rangeMax:j,isDiscrete:S,sortedAllowedDates:g,snapMode:c,unit:t});if(qe.current&&qe.current[0]===Ce[0]&&qe.current[1]===Ce[1])return;qe.current=Ce,se(Ce),_e(Ce[0],Ce[1],!1);return}const Z=wt(l.clientX,l.clientY,d);if(Z===null)return;const ne=ar(Z*100),[V,q]=Cr(s.handle,ne,s.startLowVal,s.startHighVal,k,j,P);if((!qe.current||qe.current[0]!==V||qe.current[1]!==q)&&(qe.current=[V,q],se([V,q]),_e(V,q,!1)),!P&&(s.handle==="low"||s.handle==="high")){const M=ua(s.handle,ne,s.startLowVal,s.startHighVal,P);Ne.current!==M&&(Ne.current=M,me(M),ie(M))}},[i,G,u,U,N,It,nt,Ye,Ie,Se,Ot,fe,Vt,k,j,S,g,c,t,wt,ar,_e,St,Ze,P]),Ur=n.useCallback(l=>{if(G){Dr.current=null,Ft.current=null,vr.current=null,gt.current=null,er(null),Mr(wr.current),Mr(xr.current);return}const s=or.current;if(!s||l.pointerId!==0&&l.pointerId!==s.pointerId)return;const d=qe.current??K;d&&(_e(d[0],d[1],!0),O(d)),qe.current=null,se(null),or.current=null,Ne.current=null,me(null)},[G,K,_e,Mr]),Br=n.useRef(Fr);Br.current=Fr;const zr=n.useRef(Ur);zr.current=Ur;const _r=$!==null||pe!==null;n.useEffect(()=>{if(!_r)return;const l=d=>Br.current(d),s=d=>zr.current(d);return window.addEventListener("pointermove",l),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[_r]);const pr=n.useCallback((l,s,d)=>{or.current={pointerId:l,handle:s,startPointerPos:d,startLowVal:ue,startHighVal:de},Ne.current=s,me(s),s!=="connect"&&ie(s)},[ue,de]),qr=n.useCallback((l,s,d)=>{const x=T.current;x.mode==="vernier"&&(vr.current={pointerId:l,handle:s,startPointerRatio:d,startMacroLowRatio:ve,startMacroHighRatio:$e,startMicroLowRatio:ze,startMicroHighRatio:ht,startMacroLowEnc:Ue,startMacroHighEnc:Be,startMicroLowEnc:xe,startMicroHighEnc:Me,startMacroLowDate:x.macroRange[0],startMacroHighDate:x.macroRange[1],initialMicroLowDate:jt,initialMicroHighDate:Ht},gt.current=s,er(s),tr(s))},[ve,$e,ze,ht,Ue,Be,xe,Me,jt,Ht]),Kr=l=>s=>{if(i)return;s.stopPropagation(),s.preventDefault(),ie(l);const d=u?s.clientY:s.clientX;pr(s.pointerId,l,d)},Lt=l=>s=>{if(i)return;s.stopPropagation(),s.preventDefault();const d=Qe.current;if(!d)return;const x=wt(s.clientX,s.clientY,d.getBoundingClientRect());x!==null&&qr(s.pointerId,l,x)},$a=l=>{if(i||v)return;l.stopPropagation(),l.preventDefault();const s=u?l.clientY:l.clientX;pr(l.pointerId,"connect",s)},Ca=l=>{if(i)return;if(G){const V=Qe.current;if(!V)return;const q=V.getBoundingClientRect(),M=wt(l.clientX,l.clientY,q);if(M===null)return;const Ce=u?l.clientX-(q.left+q.width/2):l.clientY-(q.top+q.height/2),xt=xa(M,Ce,ve,$e,ze,ht,mt);qr(l.pointerId,xt,M);return}const s=Vr(l.clientX,l.clientY);if(s===null)return;const d=ar(s);let x="low";if(!P){const V=Math.abs(d-ue),q=Math.abs(d-de);V<q?x="low":q<V?x="high":x=d>de?"high":"low"}ie(x);const[L,Z]=Cr(x,d,ue,de,k,j,P);se([L,Z]),_e(L,Z,!0);const ne=u?l.clientY:l.clientX;pr(l.pointerId,x,ne)},Pa=l=>{if(i||$!==null)return;const s=Vr(l.clientX,l.clientY);if(s===null)return;const d=ar(s);dt(d),Wt(rr(d))},Na=()=>{dt(null),Wt(null)},Xr=l=>s=>{if(i)return;ie(l);const d=ma(s.key,l,ue,de,k,j,P,1);d&&(s.preventDefault(),le||O(d),_e(d[0],d[1],!0))},ir=l=>s=>{if(i||!G||e.mode!=="vernier")return;tr(l);let d=0,x=!1,L=!1;switch(s.key){case"ArrowRight":case"ArrowUp":d=1;break;case"ArrowLeft":case"ArrowDown":d=-1;break;case"PageUp":d=5;break;case"PageDown":d=-5;break;case"Home":x=!0;break;case"End":L=!0;break;default:return}s.preventDefault();const Z=It&&Ye.length>0,ne=nt&&Ie.length>0;if(l==="macro-low"){const V=oe(U,Ue),q=oe(U,Be);if(Z){St(dr(Ye,U,V,Ye[0],q,d,x,L),q,!0);return}let M;x?M=Se:L?M=Be:M=Math.max(Se,Math.min(Be,Ue+d)),St(oe(U,M),q,!0)}else if(l==="macro-high"){const V=oe(U,Ue),q=oe(U,Be);if(Z){St(V,dr(Ye,U,q,V,Ye[Ye.length-1],d,x,L),!0);return}let M;x?M=Ue:L?M=yt:M=Math.max(Ue,Math.min(yt,Be+d)),St(V,oe(U,M),!0)}else if(l==="micro-low"){const V=oe(N,xe),q=oe(N,Me);if(ne){Ze(dr(Ie,N,V,Ie[0],q,d,x,L),q,!0);return}let M;x?M=fe:L?M=Me:M=Math.max(fe,Math.min(Me,xe+d)),Ze(oe(N,M),q,!0)}else if(l==="micro-high"){const V=oe(N,xe),q=oe(N,Me);if(ne){Ze(V,dr(Ie,N,q,V,Ie[Ie.length-1],d,x,L),!0);return}let M;x?M=xe:L?M=Ee:M=Math.max(xe,Math.min(Ee,Me+d)),Ze(V,oe(N,M),!0)}},Aa=n.useCallback(l=>{const s=T.current;if(!s.disabled)if(s.mode==="point"){const d=Math.max(k,Math.min(j,ue+l));le||O([d,d]),_e(d,d,!0)}else if(s.mode==="vernier"){const d=xe,x=Me,L=fe,Z=Ee,ne=x-d;let V=d+l,q=x+l;l<0&&V<L?(V=L,q=Math.min(Z,V+ne)):l>0&&q>Z&&(q=Z,V=Math.max(L,q-ne)),(V!==d||q!==x)&&Ze(oe(N,V),oe(N,q),!0)}else{const d=de-ue;let x=ue+l,L=de+l;l<0&&x<k?(x=k,L=Math.min(j,x+d)):l>0&&L>j&&(L=j,x=Math.max(k,L-d)),x<=L&&(le||O([x,L]),_e(x,L,!0))}},[ue,de,k,j,le,_e,Ze,xe,Me,fe,Ee,N]),kt=rr(ue),$t=rr(de),yr=te(ue),Tr=te(de),Rr=n.useMemo(()=>{if(P)return bt===null?void 0:{estimatedWidthPx:bt.widthPx,estimatedHeightPx:bt.heightPx};if(!(bt===null||nr===null))return{estimatedWidthPx:Math.max(bt.widthPx,nr.widthPx),estimatedHeightPx:Math.max(bt.heightPx,nr.heightPx)}},[P,bt,nr]),ye=n.useMemo(()=>P||!y||u?ba(p,Rr):wa(kt,$t,Hr,p,Rr),[P,y,u,kt,$t,Hr,p,Rr]),lr=$==="low"||$!=="high"&&We==="low",sr=!P&&($==="high"||$!=="low"&&We==="high"),Ya=n.useMemo(()=>u?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${ye.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${ye.lowOffsetY}px)`,"--ps-tooltip-rot":`${ye.lowAngleDeg}deg`},[u,ye.lowOffsetX,ye.lowOffsetY,ye.lowAngleDeg]),Ea=n.useMemo(()=>u?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${ye.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${ye.highOffsetY}px)`,"--ps-tooltip-rot":`${ye.highAngleDeg}deg`},[u,ye.highOffsetX,ye.highOffsetY,ye.highAngleDeg]),cr=Math.min(kt,$t),Gr=Math.max(kt,$t),Ia=u?{bottom:`${cr}%`,height:`${Gr-cr}%`,top:"auto",left:"0",right:"0"}:{left:`${cr}%`,width:`${Gr-cr}%`,top:"0",bottom:"0"},ja=Math.max(.01,$e-ve),Wr=Math.max(.06,Math.min(.25,.28*Math.sqrt(ja))),Ha=u?{bottom:`${kt}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:lr?40:30}:{left:`${kt}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:lr?40:30},Oa=u?{bottom:`${$t}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:sr?40:30}:{left:`${$t}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:sr?40:30},Va=u?{bottom:`${Et}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${Et}%`,top:"50%",transform:"translate(-50%, -50%)"},Jr=we!==null?te(we):null,Fa=i||(G?xe<=fe:P?ue<=k:ue<=k&&de<=k),Ua=i||(G?Me>=Ee:(P||ue>=j)&&de>=j),ot=i?"cursor-not-allowed opacity-50":"cursor-pointer",Zr=l=>{const s=u?"vertical":"horizontal",d=l==="decrease",x=Za[s][l];return f.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${x} 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 ${ot}`,onClick:()=>Aa(d?-1:1),disabled:d?Fa:Ua,"aria-label":d?X:Y,children:Ja[s][l]})};return f.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${u?"flex-col":"flex-row"} ${m}`,"data-disabled":i?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":u?"vertical":"horizontal","data-label-position":p,"data-color-scheme":W,children:[b&&Zr(u?"increase":"decrease"),f.jsx("div",{ref:Qe,"data-testid":"period-slider-track","data-orientation":u?"vertical":"horizontal","data-vernier-orientation":G?mt:void 0,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"} ${ot}`,onPointerDown:Ca,onPointerMove:Pa,onPointerLeave:Na,children:G?f.jsxs(f.Fragment,{children:[Jt&&(u?f.jsxs("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:[f.jsx("defs",{children:f.jsxs("linearGradient",{id:H,x1:"0",y1:"0",x2:"1",y2:"0",children:[f.jsx("stop",{offset:"0%",stopColor:R?A.macro:A.micro,stopOpacity:"0.28"}),f.jsx("stop",{offset:"100%",stopColor:R?A.micro:A.macro,stopOpacity:Wr})]})}),f.jsx("polygon",{points:R?`12,${(1-$e)*100} 12,${(1-ve)*100} 20,100 20,0`:`12,0 12,100 20,${(1-ve)*100} 20,${(1-$e)*100}`,fill:`url(#${H})`})]}):f.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[f.jsx("defs",{children:f.jsxs("linearGradient",{id:H,x1:"0",y1:"0",x2:"0",y2:"1",children:[f.jsx("stop",{offset:"0%",stopColor:R?A.macro:A.micro,stopOpacity:"0.28"}),f.jsx("stop",{offset:"100%",stopColor:R?A.micro:A.macro,stopOpacity:Wr})]})}),f.jsx("polygon",{points:R?`${ve*100},12 ${$e*100},12 100,20 0,20`:`0,12 100,12 ${$e*100},20 ${ve*100},20`,fill:`url(#${H})`})]})),f.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:u?{bottom:`calc(${ve*100}% - 8px)`,height:`calc(${Math.max(0,($e-ve)*100)}% + 16px)`}:{left:`calc(${ve*100}% - 8px)`,width:`calc(${Math.max(0,($e-ve)*100)}% + 16px)`},onPointerDown:Lt("macro-connect")}),f.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:u?{bottom:`calc(${ze*100}% - 8px)`,height:`calc(${Math.max(0,(ht-ze)*100)}% + 16px)`}:{left:`calc(${ze*100}% - 8px)`,width:`calc(${Math.max(0,(ht-ze)*100)}% + 16px)`},onPointerDown:Lt("micro-connect")}),Zt&&f.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(l=>f.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:u?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`macro-tick-${l}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(l=>f.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:u?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`micro-tick-${l}`))]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"Macro range start","aria-disabled":i?"true":void 0,"aria-valuemin":Se,"aria-valuemax":Be,"aria-valuenow":Ue,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(e.macroRange[0],U):Mt(U,e.macroRange[0],h,D),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?R?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":R?"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 ${ot}`,style:u?{bottom:`${ve*100}%`,left:R?0:"auto",right:R?"auto":0,transform:R?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:pe==="macro-low"||ke==="macro-low"?30:15}:{left:`${ve*100}%`,top:R?0:"auto",bottom:R?"auto":0,transform:R?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:pe==="macro-low"||ke==="macro-low"?30:15},onPointerDown:Lt("macro-low"),onKeyDown:ir("macro-low"),"data-active":pe==="macro-low"?"true":void 0,"data-front":ke==="macro-low"?"true":void 0,"data-vernier-pos":u?R?"left":"right":R?"top":"bottom","data-handle-type":"macro-low",children:[f.jsx(Kt,{type:"macro",isTop:R,isVertical:u,isLeft:R}),Dt&&f.jsx("div",{className:"period-slider-hairline"}),f.jsx("div",{className:"period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800",children:Le(U,e.macroRange[0],h,D)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"Macro range end","aria-disabled":i?"true":void 0,"aria-valuemin":Ue,"aria-valuemax":yt,"aria-valuenow":Be,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(e.macroRange[1],U):Mt(U,e.macroRange[1],h,D),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?R?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":R?"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 ${ot}`,style:u?{bottom:`${$e*100}%`,left:R?0:"auto",right:R?"auto":0,transform:R?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:pe==="macro-high"||ke==="macro-high"?30:15}:{left:`${$e*100}%`,top:R?0:"auto",bottom:R?"auto":0,transform:R?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:pe==="macro-high"||ke==="macro-high"?30:15},onPointerDown:Lt("macro-high"),onKeyDown:ir("macro-high"),"data-active":pe==="macro-high"?"true":void 0,"data-front":ke==="macro-high"?"true":void 0,"data-vernier-pos":u?R?"left":"right":R?"top":"bottom","data-handle-type":"macro-high",children:[f.jsx(Kt,{type:"macro",isTop:R,isVertical:u,isLeft:R}),Dt&&f.jsx("div",{className:"period-slider-hairline"}),f.jsx("div",{className:"period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800",children:Le(U,e.macroRange[1],h,D)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.lowerAriaLabel??"Micro range start","aria-disabled":i?"true":void 0,"aria-valuemin":fe,"aria-valuemax":Me,"aria-valuenow":xe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(jt,N):Mt(N,jt,C,D),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?R?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":R?"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 ${ot}`,style:u?{bottom:`${ze*100}%`,left:R?"auto":0,right:R?0:"auto",transform:R?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:pe==="micro-low"||ke==="micro-low"?30:20}:{left:`${ze*100}%`,top:R?"auto":0,bottom:R?0:"auto",transform:R?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:pe==="micro-low"||ke==="micro-low"?30:20},onPointerDown:Lt("micro-low"),onKeyDown:ir("micro-low"),"data-active":pe==="micro-low"?"true":void 0,"data-front":ke==="micro-low"?"true":void 0,"data-vernier-pos":u?R?"right":"left":R?"bottom":"top","data-handle-type":"micro-low",children:[f.jsx(Kt,{type:"micro",isTop:!R,isVertical:u,isLeft:!R}),Dt&&f.jsx("div",{className:"period-slider-hairline"}),f.jsx("div",{className:"period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800",children:Le(N,jt,C,D)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Micro range end","aria-disabled":i?"true":void 0,"aria-valuemin":xe,"aria-valuemax":Ee,"aria-valuenow":Me,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Ht,N):Mt(N,Ht,C,D),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?R?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":R?"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 ${ot}`,style:u?{bottom:`${ht*100}%`,left:R?"auto":0,right:R?0:"auto",transform:R?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:pe==="micro-high"||ke==="micro-high"?30:20}:{left:`${ht*100}%`,top:R?"auto":0,bottom:R?0:"auto",transform:R?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:pe==="micro-high"||ke==="micro-high"?30:20},onPointerDown:Lt("micro-high"),onKeyDown:ir("micro-high"),"data-active":pe==="micro-high"?"true":void 0,"data-front":ke==="micro-high"?"true":void 0,"data-vernier-pos":u?R?"right":"left":R?"bottom":"top","data-handle-type":"micro-high",children:[f.jsx(Kt,{type:"micro",isTop:!R,isVertical:u,isLeft:!R}),Dt&&f.jsx("div",{className:"period-slider-hairline"}),f.jsx("div",{className:"period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800",children:Le(N,Ht,C,D)})]})]}):f.jsxs(f.Fragment,{children:[!v&&f.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:Ia,onPointerDown:$a}),B&&S&&g.length>1&&f.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:g.map((l,s)=>{const d=Q(t,l),x=rr(s),L=u?{bottom:`${x}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${x}%`,top:"50%",transform:"translate(-50%, -50%)"};return f.jsx("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:L},`tick-${d}`)})}),!i&&we!==null&&Et!==null&&$===null&&Jr&&f.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute z-20 h-2 w-2",style:Va,children:[f.jsx("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"}),f.jsx("div",{className:`period-slider-hover-tooltip ${p==="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`,children:Le(t,Jr,e.formatLabel,D)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":P?e.pointAriaLabel??"Selected date":e.lowerAriaLabel??"Range start","aria-disabled":i?"true":void 0,"aria-valuemin":k,"aria-valuemax":P?j:de,"aria-valuenow":ue,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(yr,t):Mt(t,yr,e.formatLabel,D),"aria-orientation":u?"vertical":"horizontal",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 ${ot}`,style:Ha,onPointerDown:Kr("low"),onKeyDown:Xr("low"),"data-active":$==="low"?"true":void 0,"data-front":lr?"true":void 0,children:[f.jsx("div",{"data-testid":"period-slider-knob",className:`period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${$==="low"?"":"shadow-md"}`}),w!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${w==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":w,"data-label-position":p,"data-slanted":ye.isSlanted?"true":void 0,"data-front":lr?"true":void 0,ref:La,style:Ya,children:Le(t,yr,e.formatLabel,D)})]}),!P&&f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Range end","aria-disabled":i?"true":void 0,"aria-valuemin":ue,"aria-valuemax":j,"aria-valuenow":de,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Tr,t):Mt(t,Tr,e.formatLabel,D),"aria-orientation":u?"vertical":"horizontal",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 ${ot}`,style:Oa,onPointerDown:Kr("high"),onKeyDown:Xr("high"),"data-active":$==="high"?"true":void 0,"data-front":sr?"true":void 0,children:[f.jsx("div",{"data-testid":"period-slider-knob",className:`period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${$==="high"?"":"shadow-md"}`}),w!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${w==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":w,"data-label-position":p,"data-slanted":ye.isSlanted?"true":void 0,"data-front":sr?"true":void 0,ref:ka,style:Ea,children:Le(t,Tr,e.formatLabel,D)})]})]})}),b&&Zr(u?"decrease":"increase")]})},kr=(e,t)=>{if(e===t)return!0;if(!(e&&t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].getTime()!==t[r].getTime())return!1;return!0},Da=(e,t)=>{if(e===t)return!0;if(!(e&&t))return!1;const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(const o of r)if(e[o]!==t[o])return!1;return!0},en=(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||!Da(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||!kr(e.allowedDates,t.allowedDates)?!1:e.mode==="point"&&t.mode==="point"?!((e.value?.getTime()??null)!==(t.value?.getTime()??null)||(e.defaultValue?.getTime()??null)!==(t.defaultValue?.getTime()??null)||e.onChangePoint!==t.onChangePoint):e.mode==="range"&&t.mode==="range"?!((e.range?.[0]?.getTime()??null)!==(t.range?.[0]?.getTime()??null)||(e.range?.[1]?.getTime()??null)!==(t.range?.[1]?.getTime()??null)||(e.defaultRange?.[0]?.getTime()??null)!==(t.defaultRange?.[0]?.getTime()??null)||(e.defaultRange?.[1]?.getTime()??null)!==(t.defaultRange?.[1]?.getTime()??null)||e.onChangeRange!==t.onChangeRange):e.mode==="vernier"&&t.mode==="vernier"?!((e.microRange?.[0]?.getTime()??null)!==(t.microRange?.[0]?.getTime()??null)||(e.microRange?.[1]?.getTime()??null)!==(t.microRange?.[1]?.getTime()??null)||(e.defaultMicroRange?.[0]?.getTime()??null)!==(t.defaultMicroRange?.[0]?.getTime()??null)||(e.defaultMicroRange?.[1]?.getTime()??null)!==(t.defaultMicroRange?.[1]?.getTime()??null)||e.macroRange[0].getTime()!==t.macroRange[0].getTime()||e.macroRange[1].getTime()!==t.macroRange[1].getTime()||e.vernierOrientation!==t.vernierOrientation||e.showVernierProjection!==t.showVernierProjection||e.showVernierTicks!==t.showVernierTicks||e.showHairline!==t.showHairline||e.macroUnit!==t.macroUnit||e.microUnit!==t.microUnit||e.macroIsDiscrete!==t.macroIsDiscrete||e.microIsDiscrete!==t.microIsDiscrete||e.formatMacroLabel!==t.formatMacroLabel||e.formatMicroLabel!==t.formatMicroLabel||e.onChangeMicroRange!==t.onChangeMicroRange||e.onChangeMacroRange!==t.onChangeMacroRange||!kr(e.macroAllowedDates,t.macroAllowedDates)||!kr(e.microAllowedDates,t.microAllowedDates)):!1,pa=n.memo(Qa,en);pa.displayName="PeriodSlider";const Xe=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},Xt=(e,t)=>{if(Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},tn=e=>{if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`DateSelector: "locale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`)}},At=(e,t,r)=>{const a=new Date(e,t-1,r);return a.setFullYear(e),a.setHours(0,0,0,0),a},ra=e=>At(e,1,1),rn=e=>At(e,12,31),an={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},nn={year:4,month:2,day:2},on={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},aa=new Map,ln=(e,t)=>{const r=`${e}\0${t}`,a=aa.get(r);if(a!==void 0)return a;const o=new Intl.DateTimeFormat(t,an[e]);return aa.set(r,o),o},$r=(e,t,r)=>r===void 0?String(on[e](t)).padStart(nn[e],"0"):ln(e,r).format(t),sn=(e,t,r)=>{const a=t?.getTime()??null,o=r?.getTime()??null,c=new Map;return e.forEach((i,m)=>{Xt(`allowedDates[${m}]`,i);const b=Xe(i),w=b.getTime();a!==null&&w<a||o!==null&&w>o||c.has(w)||c.set(w,b)}),Array.from(c.keys()).sort((i,m)=>i-m).map(i=>c.get(i))},cn=(e,t)=>{const r=[];let a=Xe(e);const o=Xe(t).getTime();for(;a.getTime()<=o;)r.push(a),a=ge.addDays(a,1);return r},na=(e,t)=>{const r=[];for(let a=e.length-1;a>=0;a--)r.push({label:Le("day",e[a],void 0,t),value:ge.format(e[a],"yyyy-MM-dd")});return r},un=e=>{const{value:t,initialDate:r,onChange:a,children:o,minYear:c,maxYear:i,minDate:m,maxDate:b,allowedDates:w,variant:p="date",className:y="",style:u,disabled:v=!1,prevDateAriaLabel:B="Previous day",nextDateAriaLabel:W="Next day",selectAriaLabel:D="Date",yearAriaLabel:X="Year",monthAriaLabel:Y="Month",dayAriaLabel:J="Day",locale:A,formatYearOption:H,formatMonthOption:T,formatDayOption:F}=e;if(tn(A),t!==void 0&&Xt("value",t),r!==void 0&&Xt("initialDate",r),m!==void 0&&Xt("minDate",m),b!==void 0&&Xt("maxDate",b),c!==void 0&&!Number.isInteger(c))throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(c)})`);if(i!==void 0&&!Number.isInteger(i))throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(i)})`);if(p==="split-dropdown"&&w!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const E=t??r;if(E===void 0)throw new RangeError("DateSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected date is never inferred from the wall clock.");const[g,S]=n.useState(()=>Xe(E)),k=t!==void 0,j=t?.getTime(),P=n.useMemo(()=>t!==void 0?Xe(t):g,[j,g]),te=m?.getTime(),_=b?.getTime(),z=n.useMemo(()=>{const h=m?Xe(m):null,C=c!==void 0?ra(c):null;return h===null?C:C===null||h.getTime()>=C.getTime()?h:C},[te,c]),ee=n.useMemo(()=>{const h=b?Xe(b):null,C=i!==void 0?rn(i):null;return h===null?C:C===null||h.getTime()<=C.getTime()?h:C},[_,i]),re=z?.getTime()??null,ce=ee?.getTime()??null;if(z!==null&&ee!==null&&z.getTime()>ee.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${ge.format(z,"yyyy-MM-dd")} is after max ${ge.format(ee,"yyyy-MM-dd")})`);if(p!=="date"&&w===void 0&&(z===null||ee===null))throw new RangeError(`DateSelector: variant="${p}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${p==="dropdown"?' or supply "allowedDates"':""}`);const Fe=w===void 0?null:w.map(h=>h.getTime()).join(","),ae=n.useMemo(()=>w===void 0?null:sn(w,z,ee),[Fe,re,ce]),Ge=h=>{const C=h.getTime();return ae!==null?ae.some(Ae=>Ae.getTime()===C):!(re!==null&&C<re||ce!==null&&C>ce)},ut=E.getTime();n.useEffect(()=>{k||S(Xe(E))},[k,ut]);const Re=h=>{if(v)return;const C=Xe(h);Ge(C)&&(k||S(C),a?.(C))},be=P.getTime(),le=Ge(P),I=n.useMemo(()=>{if(ae!==null){for(let C=ae.length-1;C>=0;C--)if(ae[C].getTime()<be)return ae[C];return null}const h=ge.addDays(new Date(be),-1);return re!==null&&h.getTime()<re?null:h},[ae,be,re]),O=n.useMemo(()=>{if(ae!==null){for(const C of ae)if(C.getTime()>be)return C;return null}const h=ge.addDays(new Date(be),1);return ce!==null&&h.getTime()>ce?null:h},[ae,be,ce]),K=v||I===null,se=v||O===null,$=()=>{I!==null&&Re(I)},me=()=>{O!==null&&Re(O)},Ne=h=>{if(h.target.value){const C=ge.parseISO(h.target.value);Number.isNaN(C.getTime())||Re(C)}},We=h=>{if(h.target.value){const C=ge.parseISO(h.target.value);Number.isNaN(C.getTime())||Re(C)}},ie=P.getFullYear(),we=P.getMonth()+1,dt=P.getDate(),Et=n.useMemo(()=>p!=="dropdown"?[]:ae!==null?na(ae,A):z===null||ee===null?[]:na(cn(z,ee),A),[p,ae,re,ce,A]),Wt=n.useMemo(()=>{if(p!=="split-dropdown"||z===null||ee===null)return[];const h=[];for(let C=ee.getFullYear();C>=z.getFullYear();C--)h.push(C);return h},[p,re,ce]),ue=n.useMemo(()=>{if(p!=="split-dropdown"||z===null||ee===null)return[];const h=z,C=ee,Ae=ie===h.getFullYear()?h.getMonth()+1:1,pt=ie===C.getFullYear()?C.getMonth()+1:12,ft=[];for(let Je=Ae;Je<=pt;Je++)ft.push(Je);return ft},[p,re,ce,ie]),de=n.useMemo(()=>{if(p!=="split-dropdown"||z===null||ee===null)return[];const h=z,C=ee,Ae=ie===h.getFullYear()&&we===h.getMonth()+1?h.getDate():1,pt=ie===C.getFullYear()&&we===C.getMonth()+1?C.getDate():ge.getDaysInMonth(new Date(be)),ft=[];for(let Je=Ae;Je<=pt;Je++)ft.push(Je);return ft},[p,re,ce,be,ie,we]),G=(h,C,Ae)=>{Ae>ge.getDaysInMonth(At(h,C,1))||Re(At(h,C,Ae))},mt=h=>H?H(h):$r("year",ra(h),A),R=h=>T?T(h):$r("month",At(ie,h,1),A),Jt=h=>F?F(h):$r("day",At(ie,we,h),A),Zt=ge.format(P,"yyyy-MM-dd"),Dt=Le("day",P,void 0,A),U=z?ge.format(z,"yyyy-MM-dd"):void 0,N=ee?ge.format(ee,"yyyy-MM-dd"):void 0,It=le?Zt:"",nt="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",Qt=p==="split-dropdown"?"w-auto":"w-38";return f.jsxs("div",{className:`inline-flex items-center ${Qt} ${y}`,style:u,"data-variant":p,"data-out-of-range":le?void 0:"true",children:[f.jsx("button",{type:"button","aria-label":B,disabled:K,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",onClick:$,children:f.jsx("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"})}),p==="dropdown"?f.jsxs("select",{"aria-label":D,disabled:v,className:"mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:It,onChange:We,children:[le?null:f.jsx("option",{value:"",disabled:!0,className:nt,children:Dt}),Et.map(h=>f.jsx("option",{value:h.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:h.label},h.value))]}):p==="split-dropdown"?f.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[f.jsxs("select",{"aria-label":X,disabled:v,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",value:le?ie:"",onChange:h=>G(Number(h.target.value),we,dt),children:[le?null:f.jsx("option",{value:"",disabled:!0,className:nt,children:mt(ie)}),Wt.map(h=>f.jsx("option",{value:h,className:"dark:bg-slate-700 dark:text-slate-100",children:mt(h)},h))]}),f.jsxs("select",{"aria-label":Y,disabled:v,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",value:le?we:"",onChange:h=>G(ie,Number(h.target.value),dt),children:[le?null:f.jsx("option",{value:"",disabled:!0,className:nt,children:R(we)}),ue.map(h=>f.jsx("option",{value:h,className:"dark:bg-slate-700 dark:text-slate-100",children:R(h)},h))]}),f.jsxs("select",{"aria-label":J,disabled:v,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",value:le?dt:"",onChange:h=>G(ie,we,Number(h.target.value)),children:[le?null:f.jsx("option",{value:"",disabled:!0,className:nt,children:Jt(dt)}),de.map(h=>f.jsx("option",{value:h,className:"dark:bg-slate-700 dark:text-slate-100",children:Jt(h)},h))]})]}):f.jsx("input",{"aria-label":D,disabled:v,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",value:Zt,min:U,max:N,onChange:Ne,type:"date"}),f.jsx("button",{type:"button","aria-label":W,disabled:se,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",onClick:me,children:f.jsx("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"})}),o]})},Nt=e=>e===void 0?null:Xe(e).getTime(),ya=n.memo(un,(e,t)=>!(Nt(e.value??e.initialDate)!==Nt(t.value??t.initialDate)||Nt(e.minDate)!==Nt(t.minDate)||Nt(e.maxDate)!==Nt(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));ya.displayName="DateSelector";function Ve(e,t){const r=e+Math.floor(t/12),a=(t%12+12)%12,o=new Date(r,a,1);return o.setFullYear(r),o}function vt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`}function mr(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`MonthSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function oa(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function dn(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`MonthSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function mn(e,t){const r=e===void 0?null:Ve(e,0),a=t===void 0?null:Ve(t.getFullYear(),t.getMonth());return r!==null&&a!==null?r>=a?r:a:r!==null?r:a}function fn(e,t){const r=e===void 0?null:Ve(e,11),a=t===void 0?null:Ve(t.getFullYear(),t.getMonth());return r!==null&&a!==null?r<=a?r:a:r!==null?r:a}function Ta(e,t){return{label:Le("month",e,void 0,t),value:vt(e)}}function gn(e,t,r){const a=e.getFullYear()*12+e.getMonth(),o=t.getFullYear()*12+t.getMonth(),c=[];for(let i=o;i>=a;i--)c.push(Ta(Ve(Math.floor(i/12),i%12),r));return c}const hn=e=>{const{value:t,initialDate:r,onChange:a,children:o,variant:c="date",minYear:i,maxYear:m,minDate:b,maxDate:w,isWarning:p=!1,className:y="",style:u,disabled:v=!1,prevMonthAriaLabel:B="Previous month",nextMonthAriaLabel:W="Next month",selectAriaLabel:D="Month",locale:X}=e;dn(X),mr(t,"value"),mr(r,"initialDate"),mr(b,"minDate"),mr(w,"maxDate"),oa(i,"minYear"),oa(m,"maxYear");const Y=t??r;if(Y===void 0)throw new RangeError("MonthSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected month is never inferred from the wall clock.");const[J,A]=n.useState(()=>Ve(Y.getFullYear(),Y.getMonth())),H=t!==void 0,T=n.useMemo(()=>t!==void 0?Ve(t.getFullYear(),t.getMonth()):J,[t?.getTime(),J]),F=b?.getTime(),E=w?.getTime(),g=n.useMemo(()=>mn(i,b),[i,F]),S=n.useMemo(()=>fn(m,w),[m,E]);if(g!==null&&S!==null&&g>S)throw new RangeError(`MonthSelector: the resolved lower bound ${vt(g)} is after the resolved upper bound ${vt(S)}.`);if(c==="dropdown"&&(g===null||S===null))throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`); the option window is never invented.');const k=g!==null&&T<g||S!==null&&T>S,j=Y.getTime();n.useEffect(()=>{if(H)return;const $=Ve(Y.getFullYear(),Y.getMonth());A(me=>me.getTime()===$.getTime()?me:$)},[H,j]);const P=$=>(g===null||$>=g)&&(S===null||$<=S),te=$=>{if(v)return;if(!P($))throw new RangeError(`MonthSelector: refusing to emit ${vt($)}, which lies outside the declared bounds.`);H||A($);const me=$.getFullYear()*100+($.getMonth()+1);a?.($,me)},_=n.useMemo(()=>Ve(T.getFullYear(),T.getMonth()-1),[T]),z=n.useMemo(()=>Ve(T.getFullYear(),T.getMonth()+1),[T]),ee=v||g!==null&&_<g,re=v||S!==null&&z>S,ce=()=>{te(_)},Fe=()=>{te(z)},ae=$=>{if(!$)return;const[me,Ne]=$.split("-"),We=Number(me),ie=Number(Ne)-1;if(!(Number.isInteger(We)&&Number.isInteger(ie)))return;const we=Ve(We,ie);P(we)&&te(we)},Ge=$=>{ae($.target.value)},ut=$=>{ae($.target.value)},Re=vt(T),be=g?vt(g):void 0,le=S?vt(S):void 0,I=n.useMemo(()=>{if(c!=="dropdown"||g===null||S===null)return[];const $=gn(g,S,X);if(!k)return $;const me=Ta(T,X);return[...$,me].sort((Ne,We)=>We.value.localeCompare(Ne.value))},[c,g?.getTime(),S?.getTime(),k,T,X]),O=p?"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",K=`mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${O}`,se=`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 ${O}`;return f.jsxs("div",{className:`inline-flex w-38 items-center ${y}`,style:u,children:[f.jsx("button",{type:"button","aria-label":B,disabled:ee,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",onClick:ce,children:f.jsx("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"})}),c==="dropdown"?f.jsx("select",{"aria-label":D,disabled:v,className:se,value:Re,onChange:ut,children:I.map($=>f.jsx("option",{value:$.value,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:$.label},$.value))}):f.jsx("input",{"aria-label":D,disabled:v,className:K,value:Re,min:be,max:le,onChange:Ge,type:"month"}),f.jsx("button",{type:"button","aria-label":W,disabled:re,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",onClick:Fe,children:f.jsx("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"})}),o]})},Ra=n.memo(hn,(e,t)=>{const r=e.value??e.initialDate,a=t.value??t.initialDate,o=r?r.getFullYear()*12+r.getMonth():null,c=a?a.getFullYear()*12+a.getMonth():null;if(o!==c||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;const i=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,m=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(i!==m)return!1;const b=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,w=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(b!==w||e.onChange!==t.onChange||e.children!==t.children||e.prevMonthAriaLabel!==t.prevMonthAriaLabel||e.nextMonthAriaLabel!==t.nextMonthAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});Ra.displayName="MonthSelector";function Gt(e,t,r){if(!(r instanceof Date)||Number.isNaN(r.getTime()))throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${String(r)})`)}function Er(e,t,r){if(Gt(e,"minDate",t),Gt(e,"maxDate",r),r.getTime()<=t.getTime())throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${t.toISOString()}, maxDate: ${r.toISOString()})`)}function Pr(e,t,r){if(!Array.isArray(r)||r.length!==2)throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${String(r)})`);if(Gt(e,`${t}[0]`,r[0]),Gt(e,`${t}[1]`,r[1]),r[0].getTime()>r[1].getTime())throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${r[0].toISOString()}, upper: ${r[1].toISOString()})`)}function Nr(e,t,r,a,o,c){if(r.getTime()<a.getTime()||r.getTime()>o.getTime())throw new RangeError(`${e}: ${t} must lie within ${c} (value: ${r.toISOString()}, lower: ${a.toISOString()}, upper: ${o.toISOString()})`)}function Ar(e,t,r,a,o,c){Nr(e,`${t}[0]`,r[0],a,o,c),Nr(e,`${t}[1]`,r[1],a,o,c)}function Pe(e,t,r){return e<t?t:e>r?r:e}function fr(e,t,r,a){const o=st(t,r,a[1]);return[Pe(e[0],a[0],o),Pe(e[1],a[0],o)]}function Yr(e,t,r,a){const o=at(e,r,t)+a;return e[Math.max(0,Math.min(e.length-1,o))]}function Ir(e){const t=n.useRef(e),r=t.current,a=e,o=Object.keys(r),c=Object.keys(a);return o.length===c.length&&c.every(m=>Object.is(r[m],a[m]))||(t.current=e),t.current}function bn(e){const{unit:t,minDate:r,maxDate:a,initialRange:o,onChangeRange:c,...i}=e;Er("usePeriodSliderRange",r,a),Pr("usePeriodSliderRange","initialRange",o),Ar("usePeriodSliderRange","initialRange",o,r,a,"[minDate, maxDate]");const m=Ir(i),b=n.useRef(o),[w,p]=n.useState(o);let y=w;const u=[Pe(w[0],r,a),Pe(w[1],r,a)];(u[0]!==w[0]||u[1]!==w[1])&&(y=u,p(u));const v=n.useRef(y);v.current=y;const B=n.useRef({minDate:r,maxDate:a,allowedDates:m.allowedDates});B.current={minDate:r,maxDate:a,allowedDates:m.allowedDates};const W=n.useRef(c);W.current=c;const D=n.useCallback(g=>{const{minDate:S,maxDate:k}=B.current,j=Pe(g[0],S,k),P=Pe(g[1],S,k),te=v.current;j.getTime()===te[0].getTime()&&P.getTime()===te[1].getTime()||(v.current=[j,P],p([j,P]),W.current?.(j,P))},[]),X=n.useCallback(g=>{const S=v.current,k=g.getTime()>S[1].getTime()?g:S[1];D([g,k])},[D]),Y=n.useCallback(g=>{const S=v.current,k=g.getTime()<S[0].getTime()?g:S[0];D([k,g])},[D]),J=n.useCallback((g,S)=>{D([g,S])},[D]),A=n.useCallback(g=>{const{minDate:S,maxDate:k,allowedDates:j}=B.current,P=v.current,te=Yt(j,t,S,k);if(te.length>0){D([Yr(te,t,P[0],g),Yr(te,t,P[1],g)]);return}D([Te(t,P[0],g),Te(t,P[1],g)])},[t,D]),H=n.useCallback(()=>{D(b.current)},[D]),T=n.useMemo(()=>({value:y[0],onChange:X,minDate:r,maxDate:y[1],unit:t}),[y[0],y[1],X,r,t]),F=n.useMemo(()=>({value:y[1],onChange:Y,minDate:y[0],maxDate:a,unit:t}),[y[0],y[1],Y,a,t]),E=n.useMemo(()=>({...m,mode:"range",unit:t,range:y,minDate:r,maxDate:a,onChangeRange:J}),[m,t,y,r,a,J]);return{range:y,lowerDate:y[0],upperDate:y[1],setRange:p,setLowerDate:X,setUpperDate:Y,shiftRange:A,resetRange:H,startSelectorProps:T,endSelectorProps:F,sliderProps:E}}function wn(e){const{unit:t,minDate:r,maxDate:a,initialValue:o,onChangePoint:c,...i}=e;Er("usePeriodSliderPoint",r,a),Gt("usePeriodSliderPoint","initialValue",o),Nr("usePeriodSliderPoint","initialValue",o,r,a,"[minDate, maxDate]");const m=Ir(i),b=n.useRef(o),[w,p]=n.useState(o);let y=w;const u=Pe(w,r,a);u!==w&&(y=u,p(u));const v=n.useRef(y);v.current=y;const B=n.useRef({minDate:r,maxDate:a,allowedDates:m.allowedDates});B.current={minDate:r,maxDate:a,allowedDates:m.allowedDates};const W=n.useRef(c);W.current=c;const D=n.useCallback(H=>{const{minDate:T,maxDate:F}=B.current,E=Pe(H,T,F);E.getTime()!==v.current.getTime()&&(v.current=E,p(E),W.current?.(E))},[]),X=n.useCallback(H=>{const{minDate:T,maxDate:F,allowedDates:E}=B.current,g=Yt(E,t,T,F);if(g.length>0){D(Yr(g,t,v.current,H));return}D(Te(t,v.current,H))},[t,D]),Y=n.useCallback(()=>{D(b.current)},[D]),J=n.useMemo(()=>({value:y,onChange:D,minDate:r,maxDate:a,unit:t}),[y,D,r,a,t]),A=n.useMemo(()=>({...m,mode:"point",unit:t,value:y,minDate:r,maxDate:a,onChangePoint:D}),[m,t,y,r,a,D]);return{value:y,setValue:p,shiftValue:X,resetValue:Y,selectorProps:J,sliderProps:A}}function xn(e){const{unit:t,minDate:r,maxDate:a,initialMacroRange:o,initialMicroRange:c,macroUnit:i=t,microUnit:m=t,onChangeMacroRange:b,onChangeMicroRange:w,...p}=e;Er("useVernierSlider",r,a),Pr("useVernierSlider","initialMacroRange",o),Pr("useVernierSlider","initialMicroRange",c),Ar("useVernierSlider","initialMacroRange",o,r,a,"[minDate, maxDate]"),Ar("useVernierSlider","initialMicroRange",c,o[0],st(i,m,o[1]),"the initial macro window");const y=Ir(p),u=n.useRef(o),v=n.useRef(c),[B,W]=n.useState(o),[D,X]=n.useState(c);let Y=B;const J=[Pe(B[0],r,a),Pe(B[1],r,a)];(J[0]!==B[0]||J[1]!==B[1])&&(Y=J,W(J));let A=D;const H=fr(D,i,m,Y);(H[0]!==D[0]||H[1]!==D[1])&&(A=H,X(H));const T=n.useRef(Y);T.current=Y;const F=n.useRef(A);F.current=A;const E=n.useRef({minDate:r,maxDate:a});E.current={minDate:r,maxDate:a};const g=n.useRef(b);g.current=b;const S=n.useRef(w);S.current=w;const k=n.useCallback((I,O)=>{const K=T.current,se=F.current;(I[0].getTime()!==K[0].getTime()||I[1].getTime()!==K[1].getTime())&&(T.current=I,W(I),g.current?.(I[0],I[1])),(O[0].getTime()!==se[0].getTime()||O[1].getTime()!==se[1].getTime())&&(F.current=O,X(O),S.current?.(O[0],O[1]))},[]),j=n.useCallback((I,O)=>{const{minDate:K,maxDate:se}=E.current,$=[Pe(I,K,se),Pe(O,K,se)];k($,fr(F.current,i,m,$))},[i,m,k]),P=n.useCallback((I,O)=>{k(T.current,fr([I,O],i,m,T.current))},[i,m,k]),te=n.useCallback(I=>{const O=T.current[1],K=I>O?I:O;j(I,K)},[j]),_=n.useCallback(I=>{const O=T.current[0],K=I<O?I:O;j(K,I)},[j]),z=n.useCallback(I=>{const O=F.current[1],K=I>O?I:O;P(I,K)},[P]),ee=n.useCallback(I=>{const O=F.current[0],K=I<O?I:O;P(K,I)},[P]),re=n.useCallback(I=>{const{minDate:O,maxDate:K}=E.current,se=T.current,$=Te(i,se[0],I),me=Te(i,se[1],I);$<O||me>K||j($,me)},[i,j]),ce=n.useCallback(I=>{const O=T.current,K=F.current,se=Te(m,K[0],I),$=Te(m,K[1],I);se<O[0]||$>st(i,m,O[1])||P(se,$)},[i,m,P]),Fe=n.useCallback(()=>{const I=u.current;k(I,fr(v.current,i,m,I))},[i,m,k]),ae=n.useMemo(()=>st(i,m,Y[1]),[i,m,Y[1]]),Ge=n.useMemo(()=>({value:Y[0],onChange:te,minDate:r,maxDate:Y[1],unit:i}),[Y,te,r,i]),ut=n.useMemo(()=>({value:Y[1],onChange:_,minDate:Y[0],maxDate:a,unit:i}),[Y,_,a,i]),Re=n.useMemo(()=>({value:A[0],onChange:z,minDate:Y[0],maxDate:A[1],unit:m}),[A,z,Y,m]),be=n.useMemo(()=>({value:A[1],onChange:ee,minDate:A[0],maxDate:ae,unit:m}),[A,ee,ae,m]),le=n.useMemo(()=>({...y,mode:"vernier",unit:t,macroUnit:i,microUnit:m,minDate:r,maxDate:a,macroRange:Y,microRange:A,onChangeMacroRange:j,onChangeMicroRange:P}),[y,t,i,m,r,a,Y,A,j,P]);return{macroRange:Y,setMacroRange:W,microRange:A,setMicroRange:X,setMacroLowerDate:te,setMacroUpperDate:_,setMicroLowerDate:z,setMicroUpperDate:ee,shiftMacroRange:re,shiftMicroRange:ce,resetVernier:Fe,macroStartSelectorProps:Ge,macroEndSelectorProps:ut,microStartSelectorProps:Re,microEndSelectorProps:be,sliderProps:le}}function ia(e){const t=new Date(e,0,1);return t.setFullYear(e),t}function gr(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`YearSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function la(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function Mn(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`YearSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function sa(e,t,r){const a=e===void 0?null:e,o=t===void 0?null:t.getFullYear();return a!==null&&o!==null?r(a,o):a!==null?a:o}const vn=e=>{const{value:t,initialDate:r,onChange:a,children:o,minYear:c,maxYear:i,minDate:m,maxDate:b,className:w="",style:p,disabled:y=!1,prevYearAriaLabel:u="Previous year",nextYearAriaLabel:v="Next year",selectAriaLabel:B="Year",locale:W}=e;gr(t,"value"),gr(r,"initialDate"),gr(m,"minDate"),gr(b,"maxDate"),la(c,"minYear"),la(i,"maxYear"),Mn(W);const D=t??r;if(D===void 0)throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");const[X,Y]=n.useState(()=>D.getFullYear()),J=m?.getTime(),A=b?.getTime(),H=n.useMemo(()=>sa(c,m,Math.max),[c,J]),T=n.useMemo(()=>sa(i,b,Math.min),[i,A]);if(H===null||T===null)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.");if(H>T)throw new RangeError(`YearSelector: the resolved lower bound ${H} is after the resolved upper bound ${T}.`);const F=t!==void 0,E=t!==void 0?t.getFullYear():X,g=E<H||E>T,S=D.getTime();n.useEffect(()=>{F||Y(D.getFullYear())},[F,S]);const k=_=>{if(!y){if(_<H||_>T)throw new RangeError(`YearSelector: refusing to emit ${_}, which lies outside the declared bounds ${H}-${T}.`);F||Y(_),a?.(ia(_),_)}},j=y||E-1<H,P=y||E+1>T,te=n.useMemo(()=>{const _=[];for(let z=T;z>=H;z--)_.push(z);return g&&(_.push(E),_.sort((z,ee)=>ee-z)),_},[H,T,g,E]);return f.jsxs("div",{className:`inline-flex w-32 items-center ${w}`,style:p,children:[f.jsx("button",{type:"button","aria-label":u,disabled:j,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",onClick:()=>k(E-1),children:f.jsx("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"})}),f.jsx("select",{"aria-label":B,disabled:y,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",value:E,onChange:_=>{if(!_.target.value)return;const z=Number(_.target.value);Number.isInteger(z)&&k(z)},children:te.map(_=>f.jsx("option",{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:Le("year",ia(_),void 0,W)},_))}),f.jsx("button",{type:"button","aria-label":v,disabled:P,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",onClick:()=>k(E+1),children:f.jsx("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"})}),o]})},Sa=n.memo(vn,(e,t)=>{const r=e.value??e.initialDate,a=t.value??t.initialDate,o=r?r.getFullYear():null,c=a?a.getFullYear():null;return!(o!==c||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)});Sa.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=ca;exports.DateSelector=ya;exports.MonthSelector=Ra;exports.PeriodSlider=pa;exports.YearSelector=Sa;exports.addUnit=Te;exports.areStylesEqual=Da;exports.calculateConnectDragValues=da;exports.calculateHandleDragValues=Cr;exports.calculateKeyboardActionValues=ma;exports.calculateLabelSlant=wa;exports.calculateVernierMacroDrag=Ma;exports.calculateVernierMicroDrag=va;exports.decode=oe;exports.encode=Q;exports.findNearestDateIndex=at;exports.formatLabel=Le;exports.formatScreenReaderLabel=Mt;exports.getActiveDragHandle=ua;exports.getMacroWindowEndDate=st;exports.getSortedAllowedDates=Yt;exports.normalizeDateByUnit=Oe;exports.resolveVernierTargetHandle=xa;exports.usePeriodSliderPoint=wn;exports.usePeriodSliderRange=bn;exports.useVernierSlider=xn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),Te=require("date-fns"),o=require("react"),bn={"blue-rose":{macro:"#0284c7",macroLight:"#38bdf8",micro:"#e11d48",microLight:"#fb7185",accent:"#0284c7"},"indigo-amber":{macro:"#4f46e5",macroLight:"#818cf8",micro:"#d97706",microLight:"#fbbf24",accent:"#4f46e5"},"teal-emerald":{macro:"#0d9488",macroLight:"#2dd4bf",micro:"#059669",microLight:"#34d399",accent:"#0d9488"},"violet-fuchsia":{macro:"#7c3aed",macroLight:"#a78bfa",micro:"#c026d3",microLight:"#e879f9",accent:"#7c3aed"},"slate-sky":{macro:"#475569",macroLight:"#94a3b8",micro:"#0284c7",microLight:"#38bdf8",accent:"#475569"},monochrome:{macro:"#52525b",macroLight:"#a1a1aa",micro:"#18181b",microLight:"#71717a",accent:"#27272a"}},ot=e=>e instanceof Date&&!Number.isNaN(e.getTime()),he=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),qe=(e,t)=>{if(!ot(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${he(t)})`);const r=new Date(t.getTime());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},X=(e,t)=>{const r=qe(e,t),n=r.getFullYear(),a=r.getMonth()+1,s=r.getDate();if(e==="year")return n;if(e==="month")return n*12+(a-1);const i=new Date(0);return i.setUTCFullYear(n,a-1,s),i.setUTCHours(0,0,0,0),Math.floor(i.getTime()/(1440*60*1e3))},oe=(e,t)=>{const r=new Date(0);if(r.setHours(0,0,0,0),e==="year")return r.setFullYear(t,0,1),r;if(e==="month"){const a=Math.floor(t/12),s=t-a*12;return r.setFullYear(a,s,1),r}const n=new Date(t*24*60*60*1e3);return r.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r},Ne=(e,t,r)=>{if(!ot(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${he(t)})`);return e==="year"?Te.addYears(t,r):e==="month"?Te.addMonths(t,r):Te.addDays(t,r)},at=(e,t,r)=>{if(!ot(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${he(r)})`);if(e===t)return qe(t,r);const n=r.getFullYear(),a=r.getMonth();if(e==="year"){if(t==="month")return new Date(n,11,1);if(t==="day")return new Date(n,11,31)}return e==="month"&&t==="day"?new Date(n,a+1,0):qe(t,r)},Zn={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},ln=new Map,Qn=(e,t)=>{const r=`${e}\0${t}`,n=ln.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,Zn[e]);return ln.set(r,a),a},ea=(e,t)=>{const r=String(t.getFullYear()).padStart(4,"0");if(e==="year")return r;const n=String(t.getMonth()+1).padStart(2,"0");if(e==="month")return`${r}-${n}`;const a=String(t.getDate()).padStart(2,"0");return`${r}-${n}-${a}`},Ee=(e,t,r,n)=>ot(t)?r?r(t):n===void 0?ea(e,t):Qn(e,n).format(t):"",pt=(e,t,r,n)=>Ee(e,t,r,n),ve=(e,t,r)=>{if(!e||e.length===0||e.length===1)return 0;const n=X(r,t);let a=0,s=e.length-1;if(n<=X(r,e[a]))return 0;if(n>=X(r,e[s]))return s;for(;a<=s;){const w=a+s>>1,g=X(r,e[w]);if(g===n)return w;g<n?a=w+1:s=w-1}const i=Math.abs(X(r,e[a])-n),d=Math.abs(X(r,e[s])-n);return i<d?a:s},Ft=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const a=X(t,r),s=X(t,n),i=new Map;for(const d of e){const w=qe(t,d),g=X(t,w);g<a||g>s||i.has(g)||i.set(g,w)}if(i.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${he(r)}, maxDate: ${he(n)}, entries: ${e.length})`);return Array.from(i.keys()).sort((d,w)=>d-w).map(d=>i.get(d))},fr=(e,t,r,n)=>{const a=e.length-1;if(a<=0)return 0;const s=ve(e,n,t);if(r==="time"){const i=e[0].getTime(),d=e[a].getTime()-i;return d<=0?0:Math.max(0,Math.min(1,(e[s].getTime()-i)/d))}return s/a},gr=(e,t,r,n)=>{const a=e.length-1;if(a<=0)return 0;const s=Math.max(0,Math.min(1,n));if(r==="time"){const i=e[0].getTime(),d=e[a].getTime()-i;return d<=0?0:ve(e,new Date(i+s*d),t)}return Math.max(0,Math.min(a,Math.round(s*a)))},Ir=(e,t,r,n,a,s,i)=>{let d=r,w=n;return i?(d=t,w=t):e==="low"?t>n?(d=n,w=t):d=t:t<r?(w=r,d=t):w=t,[Math.max(a,Math.min(s,d)),Math.max(a,Math.min(s,w))]},wn=(e,t,r,n,a)=>a?"low":e==="low"?t>n?"high":"low":t<r?"low":"high",xn=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:a,isDiscrete:s,sortedAllowedDates:i,snapMode:d,unit:w})=>{if(s){const V=i.length-1;if(V<=0)return[0,0];const ee=Math.max(0,Math.min(V,Math.round(t))),p=Math.max(ee,Math.min(V,Math.round(r)));if(d==="time"){const Y=i[0].getTime(),U=i[V].getTime(),S=i[ee].getTime(),_=i[p].getTime()-S;let j=S+e*(U-Y),b=j+_;j<Y&&(j=Y,b=Y+_),b>U&&(b=U,j=U-_);const $=ve(i,new Date(j),w),N=ve(i,new Date(b),w);return[$,Math.max($,N)]}const J=Math.round(e*V);let E=ee+J,te=p+J;return E<0&&(te+=-E,E=0),te>V&&(E-=te-V,te=V),[Math.max(0,Math.min(V,E)),Math.max(0,Math.min(V,te))]}const g=V=>Math.max(n,Math.min(a,V)),k=a-n;if(k<=0)return[g(t),g(r)];const y=Math.round(e*k);let u=t+y,v=r+y;return u<n&&(v+=n-u,u=n),v>a&&(u-=v-a,v=a),[g(u),g(v)]},Mn=(e,t,r,n,a,s,i,d)=>{let w=0,g=!1,k=!1;switch(e){case"ArrowRight":case"ArrowUp":w=d;break;case"ArrowLeft":case"ArrowDown":w=-d;break;case"PageUp":w=d*5;break;case"PageDown":w=-d*5;break;case"Home":g=!0;break;case"End":k=!0;break;default:return null}if(i){let v=r;return g?v=a:k?v=s:v=Math.max(a,Math.min(s,r+w)),[v,v]}let y=r,u=n;return t==="low"?g?y=a:k?y=n:y=Math.max(a,Math.min(n,r+w)):g?u=r:k?u=s:u=Math.max(r,Math.min(s,n+w)),[y,u]},vn=8,pn=2,Dn=16,ta=12,ra=90,yn=(e,t)=>{const r=t?.estimatedHeightPx??Dn,a=vn+(t?.anchorGapY??pn)+r/2,s=e==="top"?-a:a;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:s,highOffsetY:s,isSlanted:!1,proximity:0}},Tn=(e,t,r,n="top",a)=>{const s=a?.estimatedWidthPx,i=a?.estimatedHeightPx??Dn,d=a?.paddingPx??ta,w=a?.maxAngleDeg??ra,g=vn+(a?.anchorGapY??pn),k=yn(n,a);if(!(Number.isFinite(r)&&r>0)||s===void 0||!Number.isFinite(s)||s<=0)return k;const y=Math.max(0,t-e)/100*r,u=s+d;if(y>=u)return k;const v=Math.max(0,Math.min(1,(u-y)/u)),ee=v*v*v*(v*(v*6-15)+10)*w,p=n==="top"?-ee:ee,J=ee*Math.PI/180,E=s/2*Math.abs(Math.sin(J))+i/2*Math.abs(Math.cos(J)),te=g+E,Y=n==="top"?-te:+te,U=s*Math.abs(Math.cos(J))+i*Math.abs(Math.sin(J)),S=Math.max(0,(U+d-y)/2);return{lowAngleDeg:p,highAngleDeg:p,lowOffsetX:-S,highOffsetX:S,lowOffsetY:Y,highOffsetY:Y,isSlanted:v>.001,proximity:v}};function Rn(e,t,r,n,a,s,i="macro-top",d=.05,w=!0){const g=i==="macro-top"||i==="macro-left",k=t<=0;if(g&&k||!(g||k)){const v=Math.abs(e-r),V=Math.abs(e-n);return v<=d&&v<=V?"macro-low":V<=d&&V<v?"macro-high":w&&e>=r&&e<=n?"macro-connect":v<V?"macro-low":"macro-high"}const y=Math.abs(e-a),u=Math.abs(e-s);return y<=d&&y<=u?"micro-low":u<=d&&u<y?"micro-high":w&&e>=a&&e<=s?"micro-connect":y<u?"micro-low":"micro-high"}function Sn(e,t,r,n,a){if(e==="macro-connect"){const i=t-r,d=a-n,w=Math.max(0,Math.min(1-d,n+i)),g=w+d;return[w,g,"macro-connect"]}if(e==="macro-low"){const i=Math.max(0,Math.min(1,t));return i>a?[a,i,"macro-high"]:[i,a,"macro-low"]}const s=Math.max(0,Math.min(1,t));return s<n?[s,n,"macro-low"]:[n,s,"macro-high"]}function Ln(e,t,r,n,a){if(e==="micro-connect"){const i=t-r,d=a-n,w=Math.max(0,Math.min(1-d,n+i)),g=w+d;return[w,g,"micro-connect"]}if(e==="micro-low"){const i=Math.max(0,Math.min(1,t));return i>a?[a,i,"micro-high"]:[i,a,"micro-low"]}const s=Math.max(0,Math.min(1,t));return s<n?[s,n,"micro-low"]:[n,s,"micro-high"]}const Wt=o.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let a,s;r?(a=n?"M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z",s=`period-slider-knob period-slider-knob-svg is-vertical ${n?"is-semicircle-left":"is-semicircle-right"}`):(a=t?"M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z",s=`period-slider-knob period-slider-knob-svg ${t?"is-semicircle-top":"is-semicircle-bottom"}`);const i=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return f.jsx("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:f.jsx("path",{d:a,className:i,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});Wt.displayName="VernierKnobSvg";const na=(e,t)=>{if(!ot(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${he(e)})`);if(!ot(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${he(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${he(e)}, maxDate: ${he(t)})`)},Mr=(e,t)=>{if(!Array.isArray(t)||t.length!==2)throw new RangeError(`PeriodSlider: ${e} is required and must be a [start, end] Date tuple (received: ${he(t)})`);const[r,n]=t;if(!ot(r))throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${he(r)})`);if(!ot(n))throw new RangeError(`PeriodSlider: ${e}[1] must be a valid Date (received: ${he(n)})`);if(n.getTime()<r.getTime())throw new RangeError(`PeriodSlider: ${e} must not be inverted (start: ${he(r)}, end: ${he(n)})`)},aa=(e,t)=>{if(!ot(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${he(t)})`)},Nr=(e,t,r,n)=>{if(t.getTime()<r.getTime()||t.getTime()>n.getTime())throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${he(t)}, minDate: ${he(r)}, maxDate: ${he(n)})`)},oa=(e,t,r)=>{if(e.mode==="range"){for(const n of["range","defaultRange"]){const a=e[n];a!==void 0&&(Mr(n,a),Nr(`${n}[0]`,a[0],t,r),Nr(`${n}[1]`,a[1],t,r))}return}if(e.mode==="point")for(const n of["value","defaultValue"]){const a=e[n];a!==void 0&&(aa(n,a),Nr(n,a,t,r))}},ia=(e,t,r)=>{if(Mr("macroRange",e),t!==void 0)return Mr("microRange",t),t;if(r!==void 0)return Mr("defaultMicroRange",r),r;throw new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)")},hr=(e,t,r,n,a,s,i,d)=>{const w=ve(e,n,t),g=ve(e,a,t);return i?w:d?g:Math.max(w,Math.min(g,ve(e,r,t)+s))},Yr=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},la=(e,t)=>{try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{throw new RangeError(`PeriodSlider: ${e} must be a valid BCP 47 language tag (received: ${JSON.stringify(t)})`)}},sn=()=>{const[e,t]=o.useState(null),r=o.useRef(null),n=o.useCallback(a=>{if(r.current?.disconnect(),r.current=null,a===null){t(null);return}if(typeof ResizeObserver>"u")return;const s=new ResizeObserver(i=>{for(const d of i){const w=d.borderBoxSize?.[0];w!==void 0&&t(g=>g!==null&&Math.abs(g.widthPx-w.inlineSize)<.5&&Math.abs(g.heightPx-w.blockSize)<.5?g:{widthPx:w.inlineSize,heightPx:w.blockSize})}});s.observe(a),r.current=s},[]);return o.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},sa={horizontal:{decrease:"◀",increase:"▶"},vertical:{decrease:"▼",increase:"▲"}},ca={horizontal:{decrease:"period-slider-stepper-prev",increase:"period-slider-stepper-next"},vertical:{decrease:"period-slider-stepper-prev period-slider-stepper-down",increase:"period-slider-stepper-next period-slider-stepper-up"}},ua=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:a,snapMode:s="index",disabled:i=!1,className:d="",showStepper:w=!0,tooltipStyle:g="always",labelPosition:k="top",autoSlantLabels:y=!0,isVertical:u=!1,hideConnectBar:v=!1,showTicks:V=!1,colorScheme:ee="blue-rose",locale:p,decreaseAriaLabel:J="Decrease",increaseAriaLabel:E="Increase"}=e;na(r,n),oa(e,r,n),p!==void 0&&la("locale",p);const te=e.mode==="vernier"?ia(e.macroRange,e.microRange,e.defaultMicroRange):null,Y=bn[ee],U=o.useId(),S=o.useRef(e);S.current=e;const _=r.getTime(),j=n.getTime(),b=o.useMemo(()=>Ft(a,t,r,n),[a,t,_,j]),$=b.length>0,{rangeMin:N,rangeMax:O}=o.useMemo(()=>$?{rangeMin:0,rangeMax:b.length-1}:{rangeMin:X(t,r),rangeMax:X(t,n)},[$,b,t,_,j]),P=e.mode==="point",re=o.useCallback(l=>{if($){const c=Math.max(0,Math.min(b.length-1,Math.round(l)));return b[c]}return oe(t,Math.round(l))},[$,b,t]),pe=o.useCallback(l=>{if(l===void 0)return N;const c=qe(t,l);return $?ve(b,c,t):X(t,c)},[$,b,t,N]),[Z,ne]=o.useState(()=>te),ie=e.mode!=="vernier"?null:e.microRange!==void 0?e.microRange:Z,ue=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?ie?.[0]:void 0,W=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?ie?.[1]:void 0,K=e.mode==="point"?e.value??e.defaultValue:void 0,$e=e.mode==="point"?K?.getTime():ue?.getTime(),gt=e.mode==="range"?W?.getTime():$e,[Ye,Re]=o.useMemo(()=>{if(e.mode==="point"){const m=pe(K);return[m,m]}const l=pe(ue),c=pe(W);return[Math.min(l,c),Math.max(l,c)]},[e.mode,$e,gt,pe,K,ue,W]),de=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:e.microRange!==void 0,[H,B]=o.useState(()=>[Ye,Re]),[G,me]=o.useState(null),[L,xe]=o.useState(null),Ve=o.useRef(null);Ve.current=L;const[Qe,le]=o.useState("high"),[De,et]=o.useState(null),[Vt,Zt]=o.useState(null),fe=G?G[0]:de?Ye:H[0],ge=G?G[1]:de?Re:H[1],Tt=o.useRef([fe,ge]);Tt.current=[fe,ge];const Q=e.mode==="vernier",ht=e.mode==="vernier"?e.vernierOrientation??(u?"macro-left":"macro-top"):"macro-top",T=ht==="macro-top"||ht==="macro-left",Qt=e.mode==="vernier"?e.showVernierProjection??!0:!1,er=e.mode==="vernier"?e.showVernierTicks??!0:!1,Rt=e.mode==="vernier"?e.showHairline??!0:!1,I=Q?e.macroUnit??t:t,M=Q?e.microUnit??t:t,vr=Q?e.macroIsDiscrete??!1:$,St=Q?e.microIsDiscrete??!1:$,tr=Q?e.macroAllowedDates??a:a,pr=Q?e.microAllowedDates??a:a,h=Q?e.formatMacroLabel??e.formatLabel:e.formatLabel,C=Q?e.formatMicroLabel??e.formatLabel:e.formatLabel,ke=e.mode==="vernier"?e.macroRange[0].getTime():void 0,Lt=e.mode==="vernier"?e.macroRange[1].getTime():void 0,bt=ue?.getTime(),tt=W?.getTime(),[Pe,rr]=o.useState(null),wt=o.useRef(null);wt.current=Pe;const[Ie,nr]=o.useState("micro-high"),Ae=o.useMemo(()=>X(I,r),[_,I]),$t=o.useMemo(()=>{const l=X(I,n);if(Q&&l<=Ae)throw new RangeError(`PeriodSlider: macroUnit "${I}" cannot distinguish minDate from maxDate (minDate: ${he(r)}, maxDate: ${he(n)})`);return l},[Q,_,j,Ae,I]),Me=o.useMemo(()=>Q?Ft(tr,I,r,n):[],[Q,tr,I,_,j]),je=o.useMemo(()=>e.mode!=="vernier"?Ae:X(I,e.macroRange[0]),[e.mode,ke,Ae,I]),He=o.useMemo(()=>e.mode!=="vernier"?$t:X(I,e.macroRange[1]),[e.mode,Lt,$t,I]),ye=o.useMemo(()=>e.mode!=="vernier"?X(M,r):Math.max(X(M,e.macroRange[0]),X(M,r)),[e.mode,ke,M,_]),Ue=o.useMemo(()=>e.mode!=="vernier"?X(M,n):Math.min(X(M,at(I,M,e.macroRange[1])),X(M,n)),[e.mode,Lt,I,M,j]),ae=o.useMemo(()=>Q?Ft(pr,M,r,n).filter(c=>{const m=X(M,c);return m>=ye&&m<=Ue}):[],[Q,pr,M,_,j,ye,Ue]),kt=vr&&Me.length>0,Ke=St&&ae.length>0,be=o.useMemo(()=>ie===null?ye:X(M,ie[0]),[bt,ye,M,ie]),we=o.useMemo(()=>ie===null?Ue:X(M,ie[1]),[tt,Ue,M,ie]),it=o.useMemo(()=>oe(M,be),[M,be]),lt=o.useMemo(()=>oe(M,we),[M,we]),Ut=Math.max(1,$t-Ae),Se=kt?fr(Me,I,s,oe(I,je)):Math.max(0,Math.min(1,(je-Ae)/Ut)),Oe=Math.max(Se,kt?fr(Me,I,s,oe(I,He)):Math.min(1,(He-Ae)/Ut)),Bt=Math.max(1,Ue-ye),We=Ke?fr(ae,M,s,it):Math.max(0,Math.min(1,(be-ye)/Bt)),xt=Math.max(We,Ke?fr(ae,M,s,lt):Math.min(1,(we-ye)/Bt)),Dr=o.useRef({timerId:null,emit:null}),yr=o.useRef({timerId:null,emit:null}),Tr=o.useRef({timerId:null,emit:null});o.useEffect(()=>{const l=[Dr,yr,Tr];return()=>{for(const c of l)Yr(c.current)}},[]);const Pt=o.useCallback((l,c,m)=>{Yr(l);const{debounceMs:x}=S.current;if(m||!x||x<=0){c();return}l.emit=c,l.timerId=setTimeout(()=>{l.timerId=null,l.emit=null,c()},x)},[]),Rr=o.useCallback(l=>{const c=l.emit;Yr(l),c?.()},[]),Ct=o.useCallback(l=>new Date(Math.min(Math.max(l.getTime(),_),j)),[_,j]),Ge=o.useCallback((l,c,m=!1)=>{const[x,R]=Tt.current;if((S.current.mode==="point"?l===x:l===x&&c===R)&&Dr.current.timerId===null)return;const z=re(l),A=re(c),q=()=>{const D=S.current;D.mode==="point"?D.onChangePoint?.(z):D.mode==="range"&&D.onChangeRange?.(z,A)};Pt(Dr.current,q,m)},[re,Pt]),Nt=o.useCallback((l,c,m=!1)=>{if(S.current.mode!=="vernier")return;const x=Ct(l),R=Ct(c);Pt(yr.current,()=>{const F=S.current;F.mode==="vernier"&&F.onChangeMacroRange?.(x,R)},m)},[Ct,Pt]),Be=o.useCallback((l,c,m=!1)=>{const x=S.current;if(x.mode!=="vernier")return;const R=Ct(l),F=Ct(c);x.microRange===void 0&&ne([R,F]),Pt(Tr.current,()=>{const z=S.current;z.mode==="vernier"&&z.onChangeMicroRange?.(R,F)},m)},[Ct,Pt]),ar=o.useCallback(l=>{if($&&s==="time"&&b.length>1){const x=Math.max(0,Math.min(b.length-1,Math.round(l))),R=b[0].getTime(),z=b[b.length-1].getTime()-R;if(z<=0)return 0;const A=b[x].getTime();return Math.max(0,Math.min(100,(A-R)/z*100))}const c=O-N;if(c<=0)return 0;const m=(l-N)/c*100;return Math.max(0,Math.min(100,m))},[$,s,b,N,O]),or=o.useCallback(l=>{const c=Math.max(0,Math.min(100,l));if($){if(s==="time"&&b.length>1){const R=b[0].getTime(),z=b[b.length-1].getTime()-R,A=R+c/100*z;return ve(b,new Date(A),t)}const x=Math.round(c/100*(b.length-1));return Math.max(0,Math.min(b.length-1,x))}const m=N+c/100*(O-N);return Math.round(m)},[$,s,b,N,O,t]),rt=o.useRef(null),[Br,zr]=o.useState(0),[An,Mt]=sn(),[En,ir]=sn();o.useEffect(()=>{const l=rt.current;if(!l)return;const c=()=>{const m=l.getBoundingClientRect(),x=u?m.height:m.width;x>0&&zr(R=>Math.abs(R-x)<.5?R:x)};if(c(),typeof ResizeObserver<"u"){const m=new ResizeObserver(x=>{for(const R of x){const F=u?R.contentRect.height:R.contentRect.width;F>0&&zr(z=>Math.abs(z-F)<.5?z:F)}});return m.observe(l),()=>m.disconnect()}return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[u]);const vt=o.useCallback((l,c,m)=>{const x=u?m.height:m.width;if(!(Number.isFinite(x)&&x>0))return null;const R=u?m.bottom-c:l-m.left;return Number.isFinite(R)?Math.max(0,Math.min(1,R/x)):null},[u]),_r=o.useCallback((l,c)=>{const m=rt.current;if(!m)return null;const x=vt(l,c,m.getBoundingClientRect());return x===null?null:x*100},[vt]),lr=o.useRef(null),Sr=o.useRef(null),Je=o.useRef(null),Lr=o.useRef(null),zt=o.useRef(null),qr=o.useCallback(l=>{if(i)return;if(Q){const D=Sr.current;if(!D||l.pointerId!==0&&l.pointerId!==D.pointerId||!rt.current)return;const se=vt(l.clientX,l.clientY,rt.current.getBoundingClientRect());if(se===null)return;if(D.handle==="macro-low"||D.handle==="macro-high"||D.handle==="macro-connect"){const[ze,ct,Le]=Sn(D.handle,se,D.startPointerRatio,D.startMacroLowRatio,D.startMacroHighRatio);Le!==wt.current&&(wt.current=Le,rr(Le),nr(Le));let ce,_e;if(kt){const dt=gr(Me,I,s,ze),mt=Math.max(dt,gr(Me,I,s,ct));ce=Me[dt],_e=Me[mt]}else{const dt=Math.round(Ae+ze*Ut),mt=Math.round(Ae+ct*Ut);ce=oe(I,dt),_e=oe(I,mt)}const _t=`${ce.getTime()}_${_e.getTime()}`;_t!==Lr.current&&(Lr.current=_t,Nt(ce,_e));let nt,ut;if(D.handle==="macro-connect"){const dt=qe(M,ce),mt=at(I,M,_e);let It,jt;if(I==="year"){const ft=ce.getFullYear()-D.startMacroLowDate.getFullYear();It=Ne("year",D.initialMicroLowDate,ft),jt=Ne("year",D.initialMicroHighDate,ft)}else if(I==="month"){const ft=(ce.getFullYear()-D.startMacroLowDate.getFullYear())*12+(ce.getMonth()-D.startMacroLowDate.getMonth());It=Ne("month",D.initialMicroLowDate,ft),jt=Ne("month",D.initialMicroHighDate,ft)}else{const ft=Math.round((ce.getTime()-D.startMacroLowDate.getTime())/864e5);It=Ne("day",D.initialMicroLowDate,ft),jt=Ne("day",D.initialMicroHighDate,ft)}const Ht=dt.getTime(),qt=mt.getTime(),on=D.initialMicroHighDate.getTime()-D.initialMicroLowDate.getTime();let Xt=It.getTime(),Kt=jt.getTime();Xt<Ht&&(Xt=Ht,Kt=Math.min(qt,Xt+on)),Kt>qt&&(Kt=qt,Xt=Math.max(Ht,Kt-on)),nt=qe(M,new Date(Xt)),ut=qe(M,new Date(Kt))}else{const dt=ce.getTime(),mt=at(I,M,_e).getTime(),It=D.initialMicroLowDate.getTime(),jt=D.initialMicroHighDate.getTime(),Ht=Math.max(dt,Math.min(mt,It)),qt=Math.max(Ht,Math.min(mt,jt));nt=qe(M,new Date(Ht)),ut=qe(M,new Date(qt))}const an=`${nt.getTime()}_${ut.getTime()}`;an!==zt.current&&(zt.current=an,Be(nt,ut))}else if(D.handle==="micro-low"||D.handle==="micro-high"||D.handle==="micro-connect"){const[ze,ct,Le]=Ln(D.handle,se,D.startPointerRatio,D.startMicroLowRatio,D.startMicroHighRatio);Le!==wt.current&&(wt.current=Le,rr(Le),nr(Le));let ce,_e;if(Ke){const nt=gr(ae,M,s,ze),ut=Math.max(nt,gr(ae,M,s,ct));ce=ae[nt],_e=ae[ut]}else{const nt=Math.round(ye+ze*Bt),ut=Math.round(ye+ct*Bt);ce=oe(M,nt),_e=oe(M,ut)}const _t=`${ce.getTime()}_${_e.getTime()}`;_t!==zt.current&&(zt.current=_t,Be(ce,_e))}return}const c=lr.current;if(!c||l.pointerId!==0&&l.pointerId!==c.pointerId||!rt.current)return;const m=rt.current.getBoundingClientRect(),x=u?l.clientY:l.clientX,R=u?m.height:m.width;if(!(Number.isFinite(R)&&R>0))return;if(c.handle==="connect"){const D=u?(c.startPointerPos-x)/R:(x-c.startPointerPos)/R,se=xn({posDiffPct:D,startLowVal:c.startLowVal,startHighVal:c.startHighVal,rangeMin:N,rangeMax:O,isDiscrete:$,sortedAllowedDates:b,snapMode:s,unit:t});if(Je.current&&Je.current[0]===se[0]&&Je.current[1]===se[1])return;Je.current=se,me(se),Ge(se[0],se[1],!1);return}const F=vt(l.clientX,l.clientY,m);if(F===null)return;const z=or(F*100),[A,q]=Ir(c.handle,z,c.startLowVal,c.startHighVal,N,O,P);if((!Je.current||Je.current[0]!==A||Je.current[1]!==q)&&(Je.current=[A,q],me([A,q]),Ge(A,q,!1)),!P&&(c.handle==="low"||c.handle==="high")){const D=wn(c.handle,z,c.startLowVal,c.startHighVal,P);Ve.current!==D&&(Ve.current=D,xe(D),le(D))}},[i,Q,u,I,M,kt,Ke,Me,ae,Ae,Ut,ye,Bt,N,O,$,b,s,t,vt,or,Ge,Nt,Be,P]),Xr=o.useCallback(l=>{if(Q){Lr.current=null,zt.current=null,Sr.current=null,wt.current=null,rr(null),Rr(yr.current),Rr(Tr.current);return}const c=lr.current;if(!c||l.pointerId!==0&&l.pointerId!==c.pointerId)return;const m=Je.current??G;m&&(Ge(m[0],m[1],!0),B(m)),Je.current=null,me(null),lr.current=null,Ve.current=null,xe(null)},[Q,G,Ge,Rr]),Kr=o.useRef(qr);Kr.current=qr;const Wr=o.useRef(Xr);Wr.current=Xr;const Gr=L!==null||Pe!==null;o.useEffect(()=>{if(!Gr)return;const l=m=>Kr.current(m),c=m=>Wr.current(m);return window.addEventListener("pointermove",l),window.addEventListener("pointerup",c),window.addEventListener("pointercancel",c),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",c),window.removeEventListener("pointercancel",c)}},[Gr]);const $r=o.useCallback((l,c,m)=>{lr.current={pointerId:l,handle:c,startPointerPos:m,startLowVal:fe,startHighVal:ge},Ve.current=c,xe(c),c!=="connect"&&le(c)},[fe,ge]),Jr=o.useCallback((l,c,m)=>{const x=S.current;x.mode==="vernier"&&(Sr.current={pointerId:l,handle:c,startPointerRatio:m,startMacroLowRatio:Se,startMacroHighRatio:Oe,startMicroLowRatio:We,startMicroHighRatio:xt,startMacroLowEnc:je,startMacroHighEnc:He,startMicroLowEnc:be,startMicroHighEnc:we,startMacroLowDate:x.macroRange[0],startMacroHighDate:x.macroRange[1],initialMicroLowDate:it,initialMicroHighDate:lt},wt.current=c,rr(c),nr(c))},[Se,Oe,We,xt,je,He,be,we,it,lt]),Zr=l=>c=>{if(i)return;c.stopPropagation(),c.preventDefault(),le(l);const m=u?c.clientY:c.clientX;$r(c.pointerId,l,m)},Yt=l=>c=>{if(i)return;c.stopPropagation(),c.preventDefault();const m=rt.current;if(!m)return;const x=vt(c.clientX,c.clientY,m.getBoundingClientRect());x!==null&&Jr(c.pointerId,l,x)},In=l=>{if(i||v)return;l.stopPropagation(),l.preventDefault();const c=u?l.clientY:l.clientX;$r(l.pointerId,"connect",c)},jn=l=>{if(i)return;if(Q){const A=rt.current;if(!A)return;const q=A.getBoundingClientRect(),D=vt(l.clientX,l.clientY,q);if(D===null)return;const se=u?l.clientX-(q.left+q.width/2):l.clientY-(q.top+q.height/2),ze=Rn(D,se,Se,Oe,We,xt,ht,void 0,!v);Jr(l.pointerId,ze,D);return}const c=_r(l.clientX,l.clientY);if(c===null)return;const m=or(c);let x="low";if(!P){const A=Math.abs(m-fe),q=Math.abs(m-ge);A<q?x="low":q<A?x="high":x=m>ge?"high":"low"}le(x);const[R,F]=Ir(x,m,fe,ge,N,O,P);me([R,F]),Ge(R,F,!0);const z=u?l.clientY:l.clientX;$r(l.pointerId,x,z)},Hn=l=>{if(i||L!==null)return;const c=_r(l.clientX,l.clientY);if(c===null)return;const m=or(c);et(m),Zt(ar(m))},On=()=>{et(null),Zt(null)},Qr=l=>c=>{if(i)return;le(l);const m=Mn(c.key,l,fe,ge,N,O,P,1);m&&(c.preventDefault(),de||B(m),Ge(m[0],m[1],!0))},sr=(l,c)=>{const m=Math.max(X(M,l),X(M,r)),x=Math.min(X(M,at(I,M,c)),X(M,n)),R=Math.max(m,Math.min(x,be)),F=Math.max(R,Math.min(x,we));R===be&&F===we||Be(oe(M,R),oe(M,F),!0)},cr=l=>c=>{if(i||!Q||e.mode!=="vernier")return;nr(l);let m=0,x=!1,R=!1;switch(c.key){case"ArrowRight":case"ArrowUp":m=1;break;case"ArrowLeft":case"ArrowDown":m=-1;break;case"PageUp":m=5;break;case"PageDown":m=-5;break;case"Home":x=!0;break;case"End":R=!0;break;default:return}if(c.preventDefault(),l==="macro-low"){const F=oe(I,je),z=oe(I,He);if(kt){const D=hr(Me,I,F,Me[0],z,m,x,R);if(D===ve(Me,F,I))return;const se=Me[D];Nt(se,z,!0),sr(se,z);return}let A;if(x?A=Ae:R?A=He:A=Math.max(Ae,Math.min(He,je+m)),A===je)return;const q=oe(I,A);Nt(q,z,!0),sr(q,z)}else if(l==="macro-high"){const F=oe(I,je),z=oe(I,He);if(kt){const D=hr(Me,I,z,F,Me[Me.length-1],m,x,R);if(D===ve(Me,z,I))return;const se=Me[D];Nt(F,se,!0),sr(F,se);return}let A;if(x?A=je:R?A=$t:A=Math.max(je,Math.min($t,He+m)),A===He)return;const q=oe(I,A);Nt(F,q,!0),sr(F,q)}else if(l==="micro-low"){const F=oe(M,be),z=oe(M,we);if(Ke){const q=hr(ae,M,F,ae[0],z,m,x,R);if(q===ve(ae,F,M))return;Be(ae[q],z,!0);return}let A;if(x?A=ye:R?A=we:A=Math.max(ye,Math.min(we,be+m)),A===be)return;Be(oe(M,A),z,!0)}else if(l==="micro-high"){const F=oe(M,be),z=oe(M,we);if(Ke){const q=hr(ae,M,z,F,ae[ae.length-1],m,x,R);if(q===ve(ae,z,M))return;Be(F,ae[q],!0);return}let A;if(x?A=be:R?A=Ue:A=Math.max(be,Math.min(Ue,we+m)),A===we)return;Be(F,oe(M,A),!0)}},Fn=o.useCallback(l=>{const c=S.current;if(!c.disabled)if(c.mode==="point"){const m=Math.max(N,Math.min(O,fe+l));de||B([m,m]),Ge(m,m,!0)}else if(c.mode==="vernier"){if(Ke){const D=ae.length-1,se=ve(ae,it,M),ze=ve(ae,lt,M),ct=ze-se;let Le=se+l,ce=ze+l;l<0&&Le<0?(Le=0,ce=Math.min(D,ct)):l>0&&ce>D&&(ce=D,Le=Math.max(0,D-ct)),(Le!==se||ce!==ze)&&Be(ae[Le],ae[ce],!0);return}const m=be,x=we,R=ye,F=Ue,z=x-m;let A=m+l,q=x+l;l<0&&A<R?(A=R,q=Math.min(F,A+z)):l>0&&q>F&&(q=F,A=Math.max(R,q-z)),(A!==m||q!==x)&&Be(oe(M,A),oe(M,q),!0)}else{const m=ge-fe;let x=fe+l,R=ge+l;l<0&&x<N?(x=N,R=Math.min(O,x+m)):l>0&&R>O&&(R=O,x=Math.max(N,R-m)),x<=R&&(de||B([x,R]),Ge(x,R,!0))}},[fe,ge,N,O,de,Ge,Be,be,we,ye,Ue,M,Ke,ae,it,lt]),At=ar(fe),Et=ar(ge),kr=re(fe),Pr=re(ge),Cr=o.useMemo(()=>{if(P)return Mt===null?void 0:{estimatedWidthPx:Mt.widthPx,estimatedHeightPx:Mt.heightPx};if(!(Mt===null||ir===null))return{estimatedWidthPx:Math.max(Mt.widthPx,ir.widthPx),estimatedHeightPx:Math.max(Mt.heightPx,ir.heightPx)}},[P,Mt,ir]),Ce=o.useMemo(()=>P||!y||u?yn(k,Cr):Tn(At,Et,Br,k,Cr),[P,y,u,At,Et,Br,k,Cr]),ur=L==="low"||L!=="high"&&Qe==="low",dr=!P&&(L==="high"||L!=="low"&&Qe==="high"),Vn=o.useMemo(()=>u?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${Ce.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Ce.lowOffsetY}px)`,"--ps-tooltip-rot":`${Ce.lowAngleDeg}deg`},[u,Ce.lowOffsetX,Ce.lowOffsetY,Ce.lowAngleDeg]),Un=o.useMemo(()=>u?{"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"}:{"--ps-tooltip-origin":"50% 50%","--ps-tooltip-tx":`calc(-50% + ${Ce.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Ce.highOffsetY}px)`,"--ps-tooltip-rot":`${Ce.highAngleDeg}deg`},[u,Ce.highOffsetX,Ce.highOffsetY,Ce.highAngleDeg]),mr=Math.min(At,Et),en=Math.max(At,Et),Bn=u?{bottom:`${mr}%`,height:`${en-mr}%`,top:"auto",left:"0",right:"0"}:{left:`${mr}%`,width:`${en-mr}%`,top:"0",bottom:"0"},zn=Math.max(.01,Oe-Se),tn=Math.max(.06,Math.min(.25,.28*Math.sqrt(zn))),_n=u?{bottom:`${At}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:ur?40:30}:{left:`${At}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:ur?40:30},qn=u?{bottom:`${Et}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:dr?40:30}:{left:`${Et}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:dr?40:30},Xn=u?{bottom:`${Vt}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${Vt}%`,top:"50%",transform:"translate(-50%, -50%)"},rn=De!==null?re(De):null,Kn=Ke?X(M,ae[0]):ye,Wn=Ke?X(M,ae[ae.length-1]):Ue,Gn=i||(Q?be<=Kn:P?fe<=N:fe<=N&&ge<=N),Jn=i||(Q?we>=Wn:(P||fe>=O)&&ge>=O),st=i?"cursor-not-allowed opacity-50":"cursor-pointer",nn=l=>{const c=u?"vertical":"horizontal",m=l==="decrease",x=ca[c][l];return f.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${x} 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 ${st}`,onClick:()=>Fn(m?-1:1),disabled:m?Gn:Jn,"aria-label":m?J:E,children:sa[c][l]})};return f.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${u?"flex-col":"flex-row"} ${d}`,"data-disabled":i?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":u?"vertical":"horizontal","data-label-position":k,"data-color-scheme":ee,children:[w&&nn(u?"increase":"decrease"),f.jsx("div",{ref:rt,"data-testid":"period-slider-track","data-orientation":u?"vertical":"horizontal","data-vernier-orientation":Q?ht:void 0,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"} ${st}`,onPointerDown:jn,onPointerMove:Hn,onPointerLeave:On,children:Q?f.jsxs(f.Fragment,{children:[Qt&&(u?f.jsxs("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:[f.jsx("defs",{children:f.jsxs("linearGradient",{id:U,x1:"0",y1:"0",x2:"1",y2:"0",children:[f.jsx("stop",{offset:"0%",stopColor:T?Y.macro:Y.micro,stopOpacity:"0.28"}),f.jsx("stop",{offset:"100%",stopColor:T?Y.micro:Y.macro,stopOpacity:tn})]})}),f.jsx("polygon",{points:T?`12,${(1-Oe)*100} 12,${(1-Se)*100} 20,100 20,0`:`12,0 12,100 20,${(1-Se)*100} 20,${(1-Oe)*100}`,fill:`url(#${U})`})]}):f.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[f.jsx("defs",{children:f.jsxs("linearGradient",{id:U,x1:"0",y1:"0",x2:"0",y2:"1",children:[f.jsx("stop",{offset:"0%",stopColor:T?Y.macro:Y.micro,stopOpacity:"0.28"}),f.jsx("stop",{offset:"100%",stopColor:T?Y.micro:Y.macro,stopOpacity:tn})]})}),f.jsx("polygon",{points:T?`${Se*100},12 ${Oe*100},12 100,20 0,20`:`0,12 100,12 ${Oe*100},20 ${Se*100},20`,fill:`url(#${U})`})]})),!v&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:u?{bottom:`calc(${Se*100}% - 8px)`,height:`calc(${Math.max(0,(Oe-Se)*100)}% + 16px)`}:{left:`calc(${Se*100}% - 8px)`,width:`calc(${Math.max(0,(Oe-Se)*100)}% + 16px)`},onPointerDown:Yt("macro-connect")}),f.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:u?{bottom:`calc(${We*100}% - 8px)`,height:`calc(${Math.max(0,(xt-We)*100)}% + 16px)`}:{left:`calc(${We*100}% - 8px)`,width:`calc(${Math.max(0,(xt-We)*100)}% + 16px)`},onPointerDown:Yt("micro-connect")})]}),er&&f.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(l=>f.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:u?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`macro-tick-${l}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(l=>f.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:u?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`micro-tick-${l}`))]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"Macro range start","aria-disabled":i?"true":void 0,"aria-valuemin":Ae,"aria-valuemax":He,"aria-valuenow":je,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(e.macroRange[0],I):pt(I,e.macroRange[0],h,p),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?T?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":T?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${st}`,style:u?{bottom:`${Se*100}%`,left:T?0:"auto",right:T?"auto":0,transform:T?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Pe==="macro-low"||Ie==="macro-low"?30:15}:{left:`${Se*100}%`,top:T?0:"auto",bottom:T?"auto":0,transform:T?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Pe==="macro-low"||Ie==="macro-low"?30:15},onPointerDown:Yt("macro-low"),onKeyDown:cr("macro-low"),"data-active":Pe==="macro-low"?"true":void 0,"data-front":Ie==="macro-low"?"true":void 0,"data-vernier-pos":u?T?"left":"right":T?"top":"bottom","data-handle-type":"macro-low",children:[f.jsx(Wt,{type:"macro",isTop:T,isVertical:u,isLeft:T}),Rt&&f.jsx("div",{className:"period-slider-hairline"}),g!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,children:Ee(I,e.macroRange[0],h,p)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"Macro range end","aria-disabled":i?"true":void 0,"aria-valuemin":je,"aria-valuemax":$t,"aria-valuenow":He,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(e.macroRange[1],I):pt(I,e.macroRange[1],h,p),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?T?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":T?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${st}`,style:u?{bottom:`${Oe*100}%`,left:T?0:"auto",right:T?"auto":0,transform:T?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Pe==="macro-high"||Ie==="macro-high"?30:15}:{left:`${Oe*100}%`,top:T?0:"auto",bottom:T?"auto":0,transform:T?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Pe==="macro-high"||Ie==="macro-high"?30:15},onPointerDown:Yt("macro-high"),onKeyDown:cr("macro-high"),"data-active":Pe==="macro-high"?"true":void 0,"data-front":Ie==="macro-high"?"true":void 0,"data-vernier-pos":u?T?"left":"right":T?"top":"bottom","data-handle-type":"macro-high",children:[f.jsx(Wt,{type:"macro",isTop:T,isVertical:u,isLeft:T}),Rt&&f.jsx("div",{className:"period-slider-hairline"}),g!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,children:Ee(I,e.macroRange[1],h,p)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.lowerAriaLabel??"Micro range start","aria-disabled":i?"true":void 0,"aria-valuemin":ye,"aria-valuemax":we,"aria-valuenow":be,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(it,M):pt(M,it,C,p),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?T?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":T?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${st}`,style:u?{bottom:`${We*100}%`,left:T?"auto":0,right:T?0:"auto",transform:T?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Pe==="micro-low"||Ie==="micro-low"?30:20}:{left:`${We*100}%`,top:T?"auto":0,bottom:T?0:"auto",transform:T?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Pe==="micro-low"||Ie==="micro-low"?30:20},onPointerDown:Yt("micro-low"),onKeyDown:cr("micro-low"),"data-active":Pe==="micro-low"?"true":void 0,"data-front":Ie==="micro-low"?"true":void 0,"data-vernier-pos":u?T?"right":"left":T?"bottom":"top","data-handle-type":"micro-low",children:[f.jsx(Wt,{type:"micro",isTop:!T,isVertical:u,isLeft:!T}),Rt&&f.jsx("div",{className:"period-slider-hairline"}),g!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,children:Ee(M,it,C,p)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Micro range end","aria-disabled":i?"true":void 0,"aria-valuemin":be,"aria-valuemax":Ue,"aria-valuenow":we,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(lt,M):pt(M,lt,C,p),"aria-orientation":u?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${u?"is-vertical":""} group absolute touch-none ${u?T?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":T?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${st}`,style:u?{bottom:`${xt*100}%`,left:T?"auto":0,right:T?0:"auto",transform:T?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Pe==="micro-high"||Ie==="micro-high"?30:20}:{left:`${xt*100}%`,top:T?"auto":0,bottom:T?0:"auto",transform:T?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Pe==="micro-high"||Ie==="micro-high"?30:20},onPointerDown:Yt("micro-high"),onKeyDown:cr("micro-high"),"data-active":Pe==="micro-high"?"true":void 0,"data-front":Ie==="micro-high"?"true":void 0,"data-vernier-pos":u?T?"right":"left":T?"bottom":"top","data-handle-type":"micro-high",children:[f.jsx(Wt,{type:"micro",isTop:!T,isVertical:u,isLeft:!T}),Rt&&f.jsx("div",{className:"period-slider-hairline"}),g!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,children:Ee(M,lt,C,p)})]})]}):f.jsxs(f.Fragment,{children:[!v&&f.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:Bn,onPointerDown:In}),V&&$&&b.length>1&&f.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:b.map((l,c)=>{const m=X(t,l),x=ar(c),R=u?{bottom:`${x}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${x}%`,top:"50%",transform:"translate(-50%, -50%)"};return f.jsx("div",{"data-testid":"period-slider-tick",className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full bg-slate-400/60 dark:bg-slate-500/60",style:R},`tick-${m}`)})}),!i&&De!==null&&Vt!==null&&L===null&&rn&&f.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute z-20 h-2 w-2",style:Xn,children:[f.jsx("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"}),f.jsx("div",{className:`period-slider-hover-tooltip ${k==="bottom"&&!u?"period-slider-hover-tooltip-bottom":""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,children:Ee(t,rn,e.formatLabel,p)})]}),f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":P?e.pointAriaLabel??"Selected date":e.lowerAriaLabel??"Range start","aria-disabled":i?"true":void 0,"aria-valuemin":N,"aria-valuemax":P?O:ge,"aria-valuenow":fe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(kr,t):pt(t,kr,e.formatLabel,p),"aria-orientation":u?"vertical":"horizontal",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 ${st}`,style:_n,onPointerDown:Zr("low"),onKeyDown:Qr("low"),"data-active":L==="low"?"true":void 0,"data-front":ur?"true":void 0,children:[f.jsx("div",{"data-testid":"period-slider-knob",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)] ${L==="low"?"":"shadow-md"}`}),g!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-label-position":k,"data-slanted":Ce.isSlanted?"true":void 0,"data-front":ur?"true":void 0,ref:An,style:Vn,children:Ee(t,kr,e.formatLabel,p)})]}),!P&&f.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Range end","aria-disabled":i?"true":void 0,"aria-valuemin":fe,"aria-valuemax":O,"aria-valuenow":ge,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Pr,t):pt(t,Pr,e.formatLabel,p),"aria-orientation":u?"vertical":"horizontal",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 ${st}`,style:qn,onPointerDown:Zr("high"),onKeyDown:Qr("high"),"data-active":L==="high"?"true":void 0,"data-front":dr?"true":void 0,children:[f.jsx("div",{"data-testid":"period-slider-knob",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)] ${L==="high"?"":"shadow-md"}`}),g!=="hover"&&f.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-label-position":k,"data-slanted":Ce.isSlanted?"true":void 0,"data-front":dr?"true":void 0,ref:En,style:Un,children:Ee(t,Pr,e.formatLabel,p)})]})]})}),w&&nn(u?"decrease":"increase")]})},Ar=(e,t)=>{if(e===t)return!0;if(!(e&&t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].getTime()!==t[r].getTime())return!1;return!0},$n=(e,t)=>{if(e===t)return!0;if(!(e&&t))return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r)if(e[a]!==t[a])return!1;return!0},da=(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||!$n(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||!Ar(e.allowedDates,t.allowedDates)?!1:e.mode==="point"&&t.mode==="point"?!((e.value?.getTime()??null)!==(t.value?.getTime()??null)||(e.defaultValue?.getTime()??null)!==(t.defaultValue?.getTime()??null)||e.onChangePoint!==t.onChangePoint):e.mode==="range"&&t.mode==="range"?!((e.range?.[0]?.getTime()??null)!==(t.range?.[0]?.getTime()??null)||(e.range?.[1]?.getTime()??null)!==(t.range?.[1]?.getTime()??null)||(e.defaultRange?.[0]?.getTime()??null)!==(t.defaultRange?.[0]?.getTime()??null)||(e.defaultRange?.[1]?.getTime()??null)!==(t.defaultRange?.[1]?.getTime()??null)||e.onChangeRange!==t.onChangeRange):e.mode==="vernier"&&t.mode==="vernier"?!((e.microRange?.[0]?.getTime()??null)!==(t.microRange?.[0]?.getTime()??null)||(e.microRange?.[1]?.getTime()??null)!==(t.microRange?.[1]?.getTime()??null)||(e.defaultMicroRange?.[0]?.getTime()??null)!==(t.defaultMicroRange?.[0]?.getTime()??null)||(e.defaultMicroRange?.[1]?.getTime()??null)!==(t.defaultMicroRange?.[1]?.getTime()??null)||e.macroRange[0].getTime()!==t.macroRange[0].getTime()||e.macroRange[1].getTime()!==t.macroRange[1].getTime()||e.vernierOrientation!==t.vernierOrientation||e.showVernierProjection!==t.showVernierProjection||e.showVernierTicks!==t.showVernierTicks||e.showHairline!==t.showHairline||e.macroUnit!==t.macroUnit||e.microUnit!==t.microUnit||e.macroIsDiscrete!==t.macroIsDiscrete||e.microIsDiscrete!==t.microIsDiscrete||e.formatMacroLabel!==t.formatMacroLabel||e.formatMicroLabel!==t.formatMicroLabel||e.onChangeMicroRange!==t.onChangeMicroRange||e.onChangeMacroRange!==t.onChangeMacroRange||!Ar(e.macroAllowedDates,t.macroAllowedDates)||!Ar(e.microAllowedDates,t.microAllowedDates)):!1,kn=o.memo(ua,da);kn.displayName="PeriodSlider";const Ze=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},Gt=(e,t)=>{if(Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},ma=e=>{if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`DateSelector: "locale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`)}},yt=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},cn=e=>yt(e,1,1),fa=e=>yt(e,12,31),ga={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},ha={year:4,month:2,day:2},ba={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},un=new Map,wa=(e,t)=>{const r=`${e}\0${t}`,n=un.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,ga[e]);return un.set(r,a),a},Er=(e,t,r)=>r===void 0?String(ba[e](t)).padStart(ha[e],"0"):wa(e,r).format(t),xa=(e,t,r)=>{const n=t?.getTime()??null,a=r?.getTime()??null,s=new Map;return e.forEach((i,d)=>{Gt(`allowedDates[${d}]`,i);const w=Ze(i),g=w.getTime();n!==null&&g<n||a!==null&&g>a||s.has(g)||s.set(g,w)}),Array.from(s.keys()).sort((i,d)=>i-d).map(i=>s.get(i))},Ma=(e,t)=>{const r=[];let n=Ze(e);const a=Ze(t).getTime();for(;n.getTime()<=a;)r.push(n),n=Te.addDays(n,1);return r},dn=(e,t)=>{const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Ee("day",e[n],void 0,t),value:Te.format(e[n],"yyyy-MM-dd")});return r},va=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:s,maxYear:i,minDate:d,maxDate:w,allowedDates:g,variant:k="date",className:y="",style:u,disabled:v=!1,prevDateAriaLabel:V="Previous day",nextDateAriaLabel:ee="Next day",selectAriaLabel:p="Date",yearAriaLabel:J="Year",monthAriaLabel:E="Month",dayAriaLabel:te="Day",locale:Y,formatYearOption:U,formatMonthOption:S,formatDayOption:_}=e;if(ma(Y),t!==void 0&&Gt("value",t),r!==void 0&&Gt("initialDate",r),d!==void 0&&Gt("minDate",d),w!==void 0&&Gt("maxDate",w),s!==void 0&&!Number.isInteger(s))throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(s)})`);if(i!==void 0&&!Number.isInteger(i))throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(i)})`);if(k==="split-dropdown"&&g!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const j=t??r;if(j===void 0)throw new RangeError("DateSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected date is never inferred from the wall clock.");const[b,$]=o.useState(()=>Ze(j)),N=t!==void 0,O=t?.getTime(),P=o.useMemo(()=>t!==void 0?Ze(t):b,[O,b]),re=d?.getTime(),pe=w?.getTime(),Z=o.useMemo(()=>{const h=d?Ze(d):null,C=s!==void 0?cn(s):null;return h===null?C:C===null||h.getTime()>=C.getTime()?h:C},[re,s]),ne=o.useMemo(()=>{const h=w?Ze(w):null,C=i!==void 0?fa(i):null;return h===null?C:C===null||h.getTime()<=C.getTime()?h:C},[pe,i]),ie=Z?.getTime()??null,ue=ne?.getTime()??null;if(Z!==null&&ne!==null&&Z.getTime()>ne.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Te.format(Z,"yyyy-MM-dd")} is after max ${Te.format(ne,"yyyy-MM-dd")})`);if(k!=="date"&&g===void 0&&(Z===null||ne===null))throw new RangeError(`DateSelector: variant="${k}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${k==="dropdown"?' or supply "allowedDates"':""}`);const W=g===void 0?null:g.map(h=>h.getTime()).join(","),K=o.useMemo(()=>g===void 0?null:xa(g,Z,ne),[W,ie,ue]),$e=h=>{const C=h.getTime();return K!==null?K.some(ke=>ke.getTime()===C):!(ie!==null&&C<ie||ue!==null&&C>ue)},gt=j.getTime();o.useEffect(()=>{N||$(Ze(j))},[N,gt]);const Ye=h=>{if(v)return;const C=Ze(h);$e(C)&&(N||$(C),n?.(C))},Re=P.getTime(),de=$e(P),H=o.useMemo(()=>{if(K!==null){for(let C=K.length-1;C>=0;C--)if(K[C].getTime()<Re)return K[C];return null}const h=Te.addDays(new Date(Re),-1);return $e(h)?h:null},[K,Re,ie,ue]),B=o.useMemo(()=>{if(K!==null){for(const C of K)if(C.getTime()>Re)return C;return null}const h=Te.addDays(new Date(Re),1);return $e(h)?h:null},[K,Re,ie,ue]),G=v||H===null,me=v||B===null,L=()=>{H!==null&&Ye(H)},xe=()=>{B!==null&&Ye(B)},Ve=h=>{if(h.target.value){const C=Te.parseISO(h.target.value);Number.isNaN(C.getTime())||Ye(C)}},Qe=h=>{if(h.target.value){const C=Te.parseISO(h.target.value);Number.isNaN(C.getTime())||Ye(C)}},le=P.getFullYear(),De=P.getMonth()+1,et=P.getDate(),Vt=o.useMemo(()=>k!=="dropdown"?[]:K!==null?dn(K,Y):Z===null||ne===null?[]:dn(Ma(Z,ne),Y),[k,K,ie,ue,Y]),Zt=o.useMemo(()=>{if(k!=="split-dropdown"||Z===null||ne===null)return[];const h=[];for(let C=ne.getFullYear();C>=Z.getFullYear();C--)h.push(C);return h},[k,ie,ue]),fe=o.useMemo(()=>{if(k!=="split-dropdown"||Z===null||ne===null)return[];const h=Z,C=ne,ke=le===h.getFullYear()?h.getMonth()+1:1,Lt=le===C.getFullYear()?C.getMonth()+1:12,bt=[];for(let tt=ke;tt<=Lt;tt++)bt.push(tt);return bt},[k,ie,ue,le]),ge=o.useMemo(()=>{if(k!=="split-dropdown"||Z===null||ne===null)return[];const h=Z,C=ne,ke=le===h.getFullYear()&&De===h.getMonth()+1?h.getDate():1,Lt=le===C.getFullYear()&&De===C.getMonth()+1?C.getDate():Te.getDaysInMonth(new Date(Re)),bt=[];for(let tt=ke;tt<=Lt;tt++)bt.push(tt);return bt},[k,ie,ue,Re,le,De]),Tt=(h,C,ke)=>ke>Te.getDaysInMonth(yt(h,C,1))?!1:$e(yt(h,C,ke)),Q=(h,C,ke)=>{Tt(h,C,ke)&&Ye(yt(h,C,ke))},ht=h=>U?U(h):Er("year",cn(h),Y),T=h=>S?S(h):Er("month",yt(le,h,1),Y),Qt=h=>_?_(h):Er("day",yt(le,De,h),Y),er=Te.format(P,"yyyy-MM-dd"),Rt=Ee("day",P,void 0,Y),I=Z?Te.format(Z,"yyyy-MM-dd"):void 0,M=ne?Te.format(ne,"yyyy-MM-dd"):void 0,vr=de?er:"",St="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",tr=k==="split-dropdown"?"w-auto":"w-38";return f.jsxs("div",{className:`inline-flex items-center ${tr} ${y}`,style:u,"data-variant":k,"data-out-of-range":de?void 0:"true",children:[f.jsx("button",{type:"button","aria-label":V,disabled:G,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",onClick:L,children:f.jsx("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"})}),k==="dropdown"?f.jsxs("select",{"aria-label":p,disabled:v,className:"mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:vr,onChange:Qe,children:[de?null:f.jsx("option",{value:"",disabled:!0,className:St,children:Rt}),Vt.map(h=>f.jsx("option",{value:h.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:h.label},h.value))]}):k==="split-dropdown"?f.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[f.jsxs("select",{"aria-label":J,disabled:v,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",value:de?le:"",onChange:h=>Q(Number(h.target.value),De,et),children:[de?null:f.jsx("option",{value:"",disabled:!0,className:St,children:ht(le)}),Zt.map(h=>f.jsx("option",{value:h,disabled:!Tt(h,De,et),className:"dark:bg-slate-700 dark:text-slate-100",children:ht(h)},h))]}),f.jsxs("select",{"aria-label":E,disabled:v,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",value:de?De:"",onChange:h=>Q(le,Number(h.target.value),et),children:[de?null:f.jsx("option",{value:"",disabled:!0,className:St,children:T(De)}),fe.map(h=>f.jsx("option",{value:h,disabled:!Tt(le,h,et),className:"dark:bg-slate-700 dark:text-slate-100",children:T(h)},h))]}),f.jsxs("select",{"aria-label":te,disabled:v,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",value:de?et:"",onChange:h=>Q(le,De,Number(h.target.value)),children:[de?null:f.jsx("option",{value:"",disabled:!0,className:St,children:Qt(et)}),ge.map(h=>f.jsx("option",{value:h,className:"dark:bg-slate-700 dark:text-slate-100",children:Qt(h)},h))]})]}):f.jsx("input",{"aria-label":p,disabled:v,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",value:er,min:I,max:M,onChange:Ve,type:"date"}),f.jsx("button",{type:"button","aria-label":ee,disabled:me,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",onClick:xe,children:f.jsx("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"})}),a]})},Ot=e=>e===void 0?null:Ze(e).getTime(),Pn=o.memo(va,(e,t)=>!(Ot(e.value??e.initialDate)!==Ot(t.value??t.initialDate)||Ot(e.minDate)!==Ot(t.minDate)||Ot(e.maxDate)!==Ot(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));Pn.displayName="DateSelector";function Xe(e,t){const r=e+Math.floor(t/12),n=(t%12+12)%12,a=new Date(r,n,1);return a.setFullYear(r),a}function Dt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`}function br(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`MonthSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function mn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function pa(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`MonthSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function Da(e,t){const r=e===void 0?null:Xe(e,0),n=t===void 0?null:Xe(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function ya(e,t){const r=e===void 0?null:Xe(e,11),n=t===void 0?null:Xe(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function Cn(e,t){return{label:Ee("month",e,void 0,t),value:Dt(e)}}function Ta(e,t,r){const n=e.getFullYear()*12+e.getMonth(),a=t.getFullYear()*12+t.getMonth(),s=[];for(let i=a;i>=n;i--)s.push(Cn(Xe(Math.floor(i/12),i%12),r));return s}const Ra=e=>{const{value:t,initialDate:r,onChange:n,children:a,variant:s="date",minYear:i,maxYear:d,minDate:w,maxDate:g,isWarning:k=!1,className:y="",style:u,disabled:v=!1,prevMonthAriaLabel:V="Previous month",nextMonthAriaLabel:ee="Next month",selectAriaLabel:p="Month",locale:J}=e;pa(J),br(t,"value"),br(r,"initialDate"),br(w,"minDate"),br(g,"maxDate"),mn(i,"minYear"),mn(d,"maxYear");const E=t??r;if(E===void 0)throw new RangeError("MonthSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected month is never inferred from the wall clock.");const[te,Y]=o.useState(()=>Xe(E.getFullYear(),E.getMonth())),U=t!==void 0,S=o.useMemo(()=>t!==void 0?Xe(t.getFullYear(),t.getMonth()):te,[t?.getTime(),te]),_=w?.getTime(),j=g?.getTime(),b=o.useMemo(()=>Da(i,w),[i,_]),$=o.useMemo(()=>ya(d,g),[d,j]);if(b!==null&&$!==null&&b>$)throw new RangeError(`MonthSelector: the resolved lower bound ${Dt(b)} is after the resolved upper bound ${Dt($)}.`);if(s==="dropdown"&&(b===null||$===null))throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`); the option window is never invented.');const N=b!==null&&S<b||$!==null&&S>$,O=E.getTime();o.useEffect(()=>{if(U)return;const L=Xe(E.getFullYear(),E.getMonth());Y(xe=>xe.getTime()===L.getTime()?xe:L)},[U,O]);const P=L=>(b===null||L>=b)&&($===null||L<=$),re=L=>{if(v)return;if(!P(L))throw new RangeError(`MonthSelector: refusing to emit ${Dt(L)}, which lies outside the declared bounds.`);U||Y(L);const xe=L.getFullYear()*100+(L.getMonth()+1);n?.(L,xe)},pe=o.useMemo(()=>{const L=Xe(S.getFullYear(),S.getMonth()-1);return P(L)?L:null},[S,b?.getTime(),$?.getTime()]),Z=o.useMemo(()=>{const L=Xe(S.getFullYear(),S.getMonth()+1);return P(L)?L:null},[S,b?.getTime(),$?.getTime()]),ne=v||pe===null,ie=v||Z===null,ue=()=>{pe!==null&&re(pe)},W=()=>{Z!==null&&re(Z)},K=L=>{if(!L)return;const[xe,Ve]=L.split("-"),Qe=Number(xe),le=Number(Ve)-1;if(!(Number.isInteger(Qe)&&Number.isInteger(le)))return;const De=Xe(Qe,le);P(De)&&re(De)},$e=L=>{K(L.target.value)},gt=L=>{K(L.target.value)},Ye=Dt(S),Re=b?Dt(b):void 0,de=$?Dt($):void 0,H=o.useMemo(()=>{if(s!=="dropdown"||b===null||$===null)return[];const L=Ta(b,$,J);if(!N)return L;const xe=Cn(S,J);return[...L,xe].sort((Ve,Qe)=>Qe.value.localeCompare(Ve.value))},[s,b?.getTime(),$?.getTime(),N,S,J]),B=k?"border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200":"border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",G=`mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${B}`,me=`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 ${B}`;return f.jsxs("div",{className:`inline-flex w-38 items-center ${y}`,style:u,children:[f.jsx("button",{type:"button","aria-label":V,disabled:ne,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",onClick:ue,children:f.jsx("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"})}),s==="dropdown"?f.jsx("select",{"aria-label":p,disabled:v,className:me,value:Ye,onChange:gt,children:H.map(L=>f.jsx("option",{value:L.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:L.label},L.value))}):f.jsx("input",{"aria-label":p,disabled:v,className:G,value:Ye,min:Re,max:de,onChange:$e,type:"month"}),f.jsx("button",{type:"button","aria-label":ee,disabled:ie,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",onClick:W,children:f.jsx("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"})}),a]})},Nn=o.memo(Ra,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,a=r?r.getFullYear()*12+r.getMonth():null,s=n?n.getFullYear()*12+n.getMonth():null;if(a!==s||e.variant!==t.variant||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.isWarning!==t.isWarning||e.minYear!==t.minYear||e.maxYear!==t.maxYear)return!1;const i=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,d=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(i!==d)return!1;const w=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,g=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(w!==g||e.onChange!==t.onChange||e.children!==t.children||e.prevMonthAriaLabel!==t.prevMonthAriaLabel||e.nextMonthAriaLabel!==t.nextMonthAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});Nn.displayName="MonthSelector";function Jt(e,t,r){if(!(r instanceof Date)||Number.isNaN(r.getTime()))throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${String(r)})`)}function Vr(e,t,r){if(Jt(e,"minDate",t),Jt(e,"maxDate",r),r.getTime()<=t.getTime())throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${t.toISOString()}, maxDate: ${r.toISOString()})`)}function jr(e,t,r){if(!Array.isArray(r)||r.length!==2)throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${String(r)})`);if(Jt(e,`${t}[0]`,r[0]),Jt(e,`${t}[1]`,r[1]),r[0].getTime()>r[1].getTime())throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${r[0].toISOString()}, upper: ${r[1].toISOString()})`)}function Hr(e,t,r,n,a,s){if(r.getTime()<n.getTime()||r.getTime()>a.getTime())throw new RangeError(`${e}: ${t} must lie within ${s} (value: ${r.toISOString()}, lower: ${n.toISOString()}, upper: ${a.toISOString()})`)}function Or(e,t,r,n,a,s){Hr(e,`${t}[0]`,r[0],n,a,s),Hr(e,`${t}[1]`,r[1],n,a,s)}function Fe(e,t,r){return e<t?t:e>r?r:e}function wr(e,t,r,n){const a=at(t,r,n[1]);return[Fe(e[0],n[0],a),Fe(e[1],n[0],a)]}function Fr(e,t,r,n){const a=ve(e,r,t)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function Ur(e){const t=o.useRef(e),r=t.current,n=e,a=Object.keys(r),s=Object.keys(n);return a.length===s.length&&s.every(d=>Object.is(r[d],n[d]))||(t.current=e),t.current}function Sa(e){const{unit:t,minDate:r,maxDate:n,initialRange:a,onChangeRange:s,...i}=e;Vr("usePeriodSliderRange",r,n),jr("usePeriodSliderRange","initialRange",a),Or("usePeriodSliderRange","initialRange",a,r,n,"[minDate, maxDate]");const d=Ur(i),w=o.useRef(a),[g,k]=o.useState(a);let y=g;const u=[Fe(g[0],r,n),Fe(g[1],r,n)];(u[0]!==g[0]||u[1]!==g[1])&&(y=u,k(u));const v=o.useRef(y);v.current=y;const V=o.useRef({minDate:r,maxDate:n,allowedDates:d.allowedDates});V.current={minDate:r,maxDate:n,allowedDates:d.allowedDates};const ee=o.useRef(s);ee.current=s;const p=o.useCallback(b=>{const{minDate:$,maxDate:N}=V.current,O=Fe(b[0],$,N),P=Fe(b[1],$,N),re=v.current;O.getTime()===re[0].getTime()&&P.getTime()===re[1].getTime()||(v.current=[O,P],k([O,P]),ee.current?.(O,P))},[]),J=o.useCallback(b=>{const $=v.current,N=b.getTime()>$[1].getTime()?b:$[1];p([b,N])},[p]),E=o.useCallback(b=>{const $=v.current,N=b.getTime()<$[0].getTime()?b:$[0];p([N,b])},[p]),te=o.useCallback((b,$)=>{p([b,$])},[p]),Y=o.useCallback(b=>{const{minDate:$,maxDate:N,allowedDates:O}=V.current,P=v.current,re=Ft(O,t,$,N);if(re.length>0){p([Fr(re,t,P[0],b),Fr(re,t,P[1],b)]);return}p([Ne(t,P[0],b),Ne(t,P[1],b)])},[t,p]),U=o.useCallback(()=>{p(w.current)},[p]),S=o.useMemo(()=>({value:y[0],onChange:J,minDate:r,maxDate:y[1],unit:t}),[y[0],y[1],J,r,t]),_=o.useMemo(()=>({value:y[1],onChange:E,minDate:y[0],maxDate:n,unit:t}),[y[0],y[1],E,n,t]),j=o.useMemo(()=>({...d,mode:"range",unit:t,range:y,minDate:r,maxDate:n,onChangeRange:te}),[d,t,y,r,n,te]);return{range:y,lowerDate:y[0],upperDate:y[1],setRange:k,setLowerDate:J,setUpperDate:E,shiftRange:Y,resetRange:U,startSelectorProps:S,endSelectorProps:_,sliderProps:j}}function La(e){const{unit:t,minDate:r,maxDate:n,initialValue:a,onChangePoint:s,...i}=e;Vr("usePeriodSliderPoint",r,n),Jt("usePeriodSliderPoint","initialValue",a),Hr("usePeriodSliderPoint","initialValue",a,r,n,"[minDate, maxDate]");const d=Ur(i),w=o.useRef(a),[g,k]=o.useState(a);let y=g;const u=Fe(g,r,n);u!==g&&(y=u,k(u));const v=o.useRef(y);v.current=y;const V=o.useRef({minDate:r,maxDate:n,allowedDates:d.allowedDates});V.current={minDate:r,maxDate:n,allowedDates:d.allowedDates};const ee=o.useRef(s);ee.current=s;const p=o.useCallback(U=>{const{minDate:S,maxDate:_}=V.current,j=Fe(U,S,_);j.getTime()!==v.current.getTime()&&(v.current=j,k(j),ee.current?.(j))},[]),J=o.useCallback(U=>{const{minDate:S,maxDate:_,allowedDates:j}=V.current,b=Ft(j,t,S,_);if(b.length>0){p(Fr(b,t,v.current,U));return}p(Ne(t,v.current,U))},[t,p]),E=o.useCallback(()=>{p(w.current)},[p]),te=o.useMemo(()=>({value:y,onChange:p,minDate:r,maxDate:n,unit:t}),[y,p,r,n,t]),Y=o.useMemo(()=>({...d,mode:"point",unit:t,value:y,minDate:r,maxDate:n,onChangePoint:p}),[d,t,y,r,n,p]);return{value:y,setValue:k,shiftValue:J,resetValue:E,selectorProps:te,sliderProps:Y}}function $a(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:a,initialMicroRange:s,macroUnit:i=t,microUnit:d=t,onChangeMacroRange:w,onChangeMicroRange:g,...k}=e;Vr("useVernierSlider",r,n),jr("useVernierSlider","initialMacroRange",a),jr("useVernierSlider","initialMicroRange",s),Or("useVernierSlider","initialMacroRange",a,r,n,"[minDate, maxDate]"),Or("useVernierSlider","initialMicroRange",s,a[0],at(i,d,a[1]),"the initial macro window");const y=Ur(k),u=o.useRef(a),v=o.useRef(s),[V,ee]=o.useState(a),[p,J]=o.useState(s);let E=V;const te=[Fe(V[0],r,n),Fe(V[1],r,n)];(te[0]!==V[0]||te[1]!==V[1])&&(E=te,ee(te));let Y=p;const U=wr(p,i,d,E);(U[0]!==p[0]||U[1]!==p[1])&&(Y=U,J(U));const S=o.useRef(E);S.current=E;const _=o.useRef(Y);_.current=Y;const j=o.useRef({minDate:r,maxDate:n});j.current={minDate:r,maxDate:n};const b=o.useRef(w);b.current=w;const $=o.useRef(g);$.current=g;const N=o.useCallback((H,B)=>{const G=S.current,me=_.current;(H[0].getTime()!==G[0].getTime()||H[1].getTime()!==G[1].getTime())&&(S.current=H,ee(H),b.current?.(H[0],H[1])),(B[0].getTime()!==me[0].getTime()||B[1].getTime()!==me[1].getTime())&&(_.current=B,J(B),$.current?.(B[0],B[1]))},[]),O=o.useCallback((H,B)=>{const{minDate:G,maxDate:me}=j.current,L=[Fe(H,G,me),Fe(B,G,me)];N(L,wr(_.current,i,d,L))},[i,d,N]),P=o.useCallback((H,B)=>{N(S.current,wr([H,B],i,d,S.current))},[i,d,N]),re=o.useCallback(H=>{const B=S.current[1],G=H>B?H:B;O(H,G)},[O]),pe=o.useCallback(H=>{const B=S.current[0],G=H<B?H:B;O(G,H)},[O]),Z=o.useCallback(H=>{const B=_.current[1],G=H>B?H:B;P(H,G)},[P]),ne=o.useCallback(H=>{const B=_.current[0],G=H<B?H:B;P(G,H)},[P]),ie=o.useCallback(H=>{const{minDate:B,maxDate:G}=j.current,me=S.current,L=Ne(i,me[0],H),xe=Ne(i,me[1],H);L<B||xe>G||O(L,xe)},[i,O]),ue=o.useCallback(H=>{const B=S.current,G=_.current,me=Ne(d,G[0],H),L=Ne(d,G[1],H);me<B[0]||L>at(i,d,B[1])||P(me,L)},[i,d,P]),W=o.useCallback(()=>{const H=u.current;N(H,wr(v.current,i,d,H))},[i,d,N]),K=o.useMemo(()=>at(i,d,E[1]),[i,d,E[1]]),$e=o.useMemo(()=>({value:E[0],onChange:re,minDate:r,maxDate:E[1],unit:i}),[E,re,r,i]),gt=o.useMemo(()=>({value:E[1],onChange:pe,minDate:E[0],maxDate:n,unit:i}),[E,pe,n,i]),Ye=o.useMemo(()=>({value:Y[0],onChange:Z,minDate:E[0],maxDate:Y[1],unit:d}),[Y,Z,E,d]),Re=o.useMemo(()=>({value:Y[1],onChange:ne,minDate:Y[0],maxDate:K,unit:d}),[Y,ne,K,d]),de=o.useMemo(()=>({...y,mode:"vernier",unit:t,macroUnit:i,microUnit:d,minDate:r,maxDate:n,macroRange:E,microRange:Y,onChangeMacroRange:O,onChangeMicroRange:P}),[y,t,i,d,r,n,E,Y,O,P]);return{macroRange:E,setMacroRange:ee,microRange:Y,setMicroRange:J,setMacroLowerDate:re,setMacroUpperDate:pe,setMicroLowerDate:Z,setMicroUpperDate:ne,shiftMacroRange:ie,shiftMicroRange:ue,resetVernier:W,macroStartSelectorProps:$e,macroEndSelectorProps:gt,microStartSelectorProps:Ye,microEndSelectorProps:Re,sliderProps:de}}function fn(e){const t=new Date(e,0,1);return t.setFullYear(e),t}function xr(e,t){if(e!==void 0&&(!(e instanceof Date)||Number.isNaN(e.getTime())))throw new RangeError(`YearSelector: \`${t}\` must be a valid Date, received ${String(e)}.`)}function gn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function ka(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`YearSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function hn(e,t,r){const n=e===void 0?null:e,a=t===void 0?null:t.getFullYear();return n!==null&&a!==null?r(n,a):n!==null?n:a}const Pa=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:s,maxYear:i,minDate:d,maxDate:w,className:g="",style:k,disabled:y=!1,prevYearAriaLabel:u="Previous year",nextYearAriaLabel:v="Next year",selectAriaLabel:V="Year",locale:ee}=e;xr(t,"value"),xr(r,"initialDate"),xr(d,"minDate"),xr(w,"maxDate"),gn(s,"minYear"),gn(i,"maxYear"),ka(ee);const p=t??r;if(p===void 0)throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");const[J,E]=o.useState(()=>p.getFullYear()),te=d?.getTime(),Y=w?.getTime(),U=o.useMemo(()=>hn(s,d,Math.max),[s,te]),S=o.useMemo(()=>hn(i,w,Math.min),[i,Y]);if(U===null||S===null)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.");if(U>S)throw new RangeError(`YearSelector: the resolved lower bound ${U} is after the resolved upper bound ${S}.`);const _=t!==void 0,j=t!==void 0?t.getFullYear():J,b=j<U||j>S,$=p.getTime();o.useEffect(()=>{_||E(p.getFullYear())},[_,$]);const N=W=>W>=U&&W<=S,O=W=>{if(!y){if(!N(W))throw new RangeError(`YearSelector: refusing to emit ${W}, which lies outside the declared bounds ${U}-${S}.`);_||E(W),n?.(fn(W),W)}},P=N(j-1)?j-1:null,re=N(j+1)?j+1:null,pe=y||P===null,Z=y||re===null,ne=()=>{P!==null&&O(P)},ie=()=>{re!==null&&O(re)},ue=o.useMemo(()=>{const W=[];for(let K=S;K>=U;K--)W.push(K);return b&&(W.push(j),W.sort((K,$e)=>$e-K)),W},[U,S,b,j]);return f.jsxs("div",{className:`inline-flex w-32 items-center ${g}`,style:k,children:[f.jsx("button",{type:"button","aria-label":u,disabled:pe,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",onClick:ne,children:f.jsx("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"})}),f.jsx("select",{"aria-label":V,disabled:y,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",value:j,onChange:W=>{if(!W.target.value)return;const K=Number(W.target.value);Number.isInteger(K)&&O(K)},children:ue.map(W=>f.jsx("option",{value:W,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:Ee("year",fn(W),void 0,ee)},W))}),f.jsx("button",{type:"button","aria-label":v,disabled:Z,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",onClick:ie,children:f.jsx("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"})}),a]})},Yn=o.memo(Pa,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,a=r?r.getFullYear():null,s=n?n.getFullYear():null;return!(a!==s||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.minDate?.getFullYear()!==t.minDate?.getFullYear()||e.maxDate?.getFullYear()!==t.maxDate?.getFullYear()||e.onChange!==t.onChange||e.children!==t.children||e.prevYearAriaLabel!==t.prevYearAriaLabel||e.nextYearAriaLabel!==t.nextYearAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});Yn.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=bn;exports.DateSelector=Pn;exports.MonthSelector=Nn;exports.PeriodSlider=kn;exports.YearSelector=Yn;exports.addUnit=Ne;exports.areStylesEqual=$n;exports.calculateConnectDragValues=xn;exports.calculateHandleDragValues=Ir;exports.calculateKeyboardActionValues=Mn;exports.calculateLabelSlant=Tn;exports.calculateVernierMacroDrag=Sn;exports.calculateVernierMicroDrag=Ln;exports.decode=oe;exports.encode=X;exports.findNearestDateIndex=ve;exports.formatLabel=Ee;exports.formatScreenReaderLabel=pt;exports.getActiveDragHandle=wn;exports.getMacroWindowEndDate=at;exports.getSortedAllowedDates=Ft;exports.normalizeDateByUnit=qe;exports.resolveVernierTargetHandle=Rn;exports.usePeriodSliderPoint=La;exports.usePeriodSliderRange=Sa;exports.useVernierSlider=$a;
|
package/dist/index.d.cts
CHANGED
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
* ISO 8601 表記。`locale` (BCP 47) 指定で `Intl.DateTimeFormat` 書式へ切替、
|
|
16
16
|
* ラベル・選択肢のフォーマッタ Props はその双方に優先。
|
|
17
17
|
*/
|
|
18
|
-
export type { DateSelectorProps } from './DateSelector';
|
|
19
|
-
export { DateSelector } from './DateSelector';
|
|
20
|
-
export type { MonthSelectorProps } from './MonthSelector';
|
|
21
|
-
export { MonthSelector } from './MonthSelector';
|
|
22
|
-
export type { AccessibleSliderLabels, BasePeriodSliderProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierProps, VernierHandle, } from './PeriodSlider';
|
|
23
|
-
export { addUnit, areStylesEqual, COLOR_SCHEME_PALETTES, calculateConnectDragValues, calculateHandleDragValues, calculateKeyboardActionValues, calculateLabelSlant, calculateVernierMacroDrag, calculateVernierMicroDrag, decode, encode, findNearestDateIndex, formatLabel, formatScreenReaderLabel, getActiveDragHandle, getMacroWindowEndDate, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveVernierTargetHandle, } from './PeriodSlider';
|
|
24
|
-
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn, UseVernierSliderOptions, UseVernierSliderReturn, } from './usePeriodSlider';
|
|
25
|
-
export { usePeriodSliderPoint, usePeriodSliderRange, useVernierSlider, } from './usePeriodSlider';
|
|
26
|
-
export type { YearSelectorProps } from './YearSelector';
|
|
27
|
-
export { YearSelector } from './YearSelector';
|
|
18
|
+
export type { DateSelectorProps } from './DateSelector.js';
|
|
19
|
+
export { DateSelector } from './DateSelector.js';
|
|
20
|
+
export type { MonthSelectorProps } from './MonthSelector.js';
|
|
21
|
+
export { MonthSelector } from './MonthSelector.js';
|
|
22
|
+
export type { AccessibleSliderLabels, BasePeriodSliderProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierProps, VernierHandle, } from './PeriodSlider.js';
|
|
23
|
+
export { addUnit, areStylesEqual, COLOR_SCHEME_PALETTES, calculateConnectDragValues, calculateHandleDragValues, calculateKeyboardActionValues, calculateLabelSlant, calculateVernierMacroDrag, calculateVernierMicroDrag, decode, encode, findNearestDateIndex, formatLabel, formatScreenReaderLabel, getActiveDragHandle, getMacroWindowEndDate, getSortedAllowedDates, normalizeDateByUnit, PeriodSlider, resolveVernierTargetHandle, } from './PeriodSlider.js';
|
|
24
|
+
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn, UseVernierSliderOptions, UseVernierSliderReturn, } from './usePeriodSlider.js';
|
|
25
|
+
export { usePeriodSliderPoint, usePeriodSliderRange, useVernierSlider, } from './usePeriodSlider.js';
|
|
26
|
+
export type { YearSelectorProps } from './YearSelector.js';
|
|
27
|
+
export { YearSelector } from './YearSelector.js';
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|