@aiquants/period-slider 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,384 @@
1
+ import { default as React } from 'react';
2
+ export type PeriodSliderUnit = "year" | "month" | "day";
3
+ export type PeriodSliderLabelPosition = "top" | "bottom";
4
+ /**
5
+ * Color theme preset for PeriodSlider.
6
+ * スライダーの配色テーマプリセット。
7
+ */
8
+ export type PeriodSliderColorScheme = "blue-rose" | "indigo-amber" | "teal-emerald" | "violet-fuchsia" | "slate-sky" | "monochrome";
9
+ export interface ColorSchemePalette {
10
+ macro: string;
11
+ macroLight: string;
12
+ micro: string;
13
+ microLight: string;
14
+ accent: string;
15
+ }
16
+ /**
17
+ * Color palette definitions for each colorScheme preset.
18
+ * 各カラーテーマプリセットのカラーパレット定義。
19
+ */
20
+ export declare const COLOR_SCHEME_PALETTES: Record<PeriodSliderColorScheme, ColorSchemePalette>;
21
+ export interface LabelSlantConfig {
22
+ /** Estimated width of the label in pixels / ラベルの推定横幅(ピクセル) */
23
+ estimatedWidthPx?: number;
24
+ /** Estimated height (thickness) of the label in pixels / ラベルの推定高さ・厚み(ピクセル) */
25
+ estimatedHeightPx?: number;
26
+ /** Extra clearance gap in pixels / 衝突検知時の余白マージン(ピクセル) */
27
+ paddingPx?: number;
28
+ /** Maximum slant angle in degrees (default: 90) / 最大傾斜角度(度、既定: 90) */
29
+ maxAngleDeg?: number;
30
+ /** Clearance from handle center in Y axis (pixels, default: 18) / つまみ中心とのY軸クリアランス(ピクセル、既定: 18) */
31
+ anchorGapY?: number;
32
+ }
33
+ export interface LabelSlantResult {
34
+ /** Low handle label angle in degrees (e.g., -90 to 0 for top) */
35
+ lowAngleDeg: number;
36
+ /** High handle label angle in degrees (e.g., -90 to 0 for top) */
37
+ highAngleDeg: number;
38
+ /** Low handle horizontal shift in pixels */
39
+ lowOffsetX: number;
40
+ /** High handle horizontal shift in pixels */
41
+ highOffsetX: number;
42
+ /** Low handle vertical shift in pixels (maintains boundary clearance) */
43
+ lowOffsetY: number;
44
+ /** High handle vertical shift in pixels (maintains boundary clearance) */
45
+ highOffsetY: number;
46
+ /** True if labels are currently slanted to avoid collision */
47
+ isSlanted: boolean;
48
+ /** Normalized collision proximity factor between 0 and 1 */
49
+ proximity: number;
50
+ }
51
+ export interface AccessibleSliderLabels {
52
+ /** Accessible name for lower handle / 下限つまみのアクセシブル名 (既定: "開始時期") */
53
+ lowerAriaLabel?: string;
54
+ /** Accessible name for upper handle / 上限つまみのアクセシブル名 (既定: "終了時期") */
55
+ upperAriaLabel?: string;
56
+ /** Accessible name for single point handle / 単一選択つまみのアクセシブル名 (既定: "選択時期") */
57
+ pointAriaLabel?: string;
58
+ /** Accessible name for macro lower handle / マクロ下限つまみ (既定: "マクロ開始時期") */
59
+ macroLowerAriaLabel?: string;
60
+ /** Accessible name for macro upper handle / マクロ上限つまみ (既定: "マクロ終了時期") */
61
+ macroUpperAriaLabel?: string;
62
+ /** Human-readable text formatter for screen readers / スクリーンリーダー専用読み上げフォーマッタ */
63
+ formatAriaValueText?: (date: Date, unit: PeriodSliderUnit) => string;
64
+ }
65
+ export interface BasePeriodSliderProps extends AccessibleSliderLabels {
66
+ unit: PeriodSliderUnit;
67
+ minDate?: Date;
68
+ maxDate?: Date;
69
+ allowedDates?: Date[];
70
+ snapMode?: "index" | "time";
71
+ debounceMs?: number;
72
+ disabled?: boolean;
73
+ className?: string;
74
+ /** Custom inline styles / カスタムインラインスタイル (CSS変数の直接注入等) */
75
+ style?: React.CSSProperties;
76
+ showStepper?: boolean;
77
+ tooltipStyle?: "always" | "hover" | "balloon";
78
+ /** Label position: "top" (default) or "bottom" / ラベル表示位置("top": 上側 [既定], "bottom": 下側) */
79
+ labelPosition?: PeriodSliderLabelPosition;
80
+ /** Whether to automatically slant labels when close in range mode (default: true) / Rangeモードで接近時に自動斜め表示するか(既定: true) */
81
+ autoSlantLabels?: boolean;
82
+ /** Alias for autoSlantLabels / autoSlantLabels のエイリアス */
83
+ preventCollisionSlant?: boolean;
84
+ isVertical?: boolean;
85
+ hideConnectBar?: boolean;
86
+ showTicks?: boolean;
87
+ formatLabel?: (date: Date) => string;
88
+ /** Color scheme theme preset for slider rails and handles (default: "blue-rose") / スライダーのカラーテーマプリセット(既定: "blue-rose") */
89
+ colorScheme?: PeriodSliderColorScheme;
90
+ }
91
+ export interface PeriodSliderRangeProps extends BasePeriodSliderProps {
92
+ mode: "range";
93
+ /** Selected date range tuple [lower, upper] / 選択期間タプル (優先指定) */
94
+ range?: [Date, Date];
95
+ /** Lower boundary date of selected range / 選択期間の開始日付 */
96
+ lowerDate?: Date;
97
+ /** Upper boundary date of selected range / 終了期間の終了日付 */
98
+ upperDate?: Date;
99
+ /** Initial date range tuple for uncontrolled usage / 非制御時の初期選択期間タプル */
100
+ defaultRange?: [Date, Date];
101
+ /** Initial date range tuple alias / 非制御時の初期選択期間タプル (エイリアス) */
102
+ initialRange?: [Date, Date];
103
+ /** Initial lower date for uncontrolled usage / 非制御時の初期開始日付 */
104
+ defaultLowerDate?: Date;
105
+ /** Initial lower date alias / 非制御時の初期開始日付 (エイリアス) */
106
+ initialLowerDate?: Date;
107
+ /** Initial upper date for uncontrolled usage / 非制御時の初期終了日付 */
108
+ defaultUpperDate?: Date;
109
+ /** Initial upper date alias / 非制御時の初期終了日付 (エイリアス) */
110
+ initialUpperDate?: Date;
111
+ /** Callback triggered when range changes / 期間変更時コールバック */
112
+ onChangeRange?: (lower: Date, upper: Date) => void;
113
+ /** Callback triggered with tuple [lower, upper] when range changes / 期間変更時タプルコールバック */
114
+ onChangeRangeTuple?: (range: [Date, Date]) => void;
115
+ /** Standard tuple callback alias / 標準タプルコールバック */
116
+ onChange?: (range: [Date, Date]) => void;
117
+ value?: never;
118
+ valueDate?: never;
119
+ onChangePoint?: never;
120
+ onChangeValue?: never;
121
+ macroRange?: never;
122
+ onChangeMacroRange?: never;
123
+ microRange?: never;
124
+ }
125
+ export interface PeriodSliderPointProps extends BasePeriodSliderProps {
126
+ mode: "point";
127
+ /** Selected point date / 選択日付 */
128
+ value?: Date;
129
+ /** Selected point date (legacy alias) / 選択日付(エイリアス) */
130
+ valueDate?: Date;
131
+ /** Initial point date for uncontrolled usage / 非制御時の初期選択日付 */
132
+ defaultValue?: Date;
133
+ /** Initial point date alias / 非制御時の初期選択日付 (セレクタ群と統一) */
134
+ initialDate?: Date;
135
+ /** Callback triggered when point changes / ポイント変更時コールバック */
136
+ onChangePoint?: (value: Date) => void;
137
+ /** Callback triggered when point changes (alias) / ポイント変更時コールバック(エイリアス) */
138
+ onChangeValue?: (value: Date) => void;
139
+ /** Standard Date callback alias / 標準日付コールバック */
140
+ onChange?: (value: Date) => void;
141
+ range?: never;
142
+ lowerDate?: never;
143
+ upperDate?: never;
144
+ onChangeRange?: never;
145
+ onChangeRangeTuple?: never;
146
+ macroRange?: never;
147
+ onChangeMacroRange?: never;
148
+ microRange?: never;
149
+ }
150
+ export interface PeriodSliderVernierProps extends BasePeriodSliderProps {
151
+ /** Vernier dual-scale integrated mode / ノギス型 2 段スケール一体型モード */
152
+ mode: "vernier";
153
+ /** Minimum selectable boundary date for entire macro range (required, no default) / 全期間マクロの下限日付 (必須) */
154
+ minDate: Date;
155
+ /** Maximum selectable boundary date for entire macro range (required, no default) / 全期間マクロの上限日付 (必須) */
156
+ maxDate: Date;
157
+ /** Macro window range [start, end] / マクロ側の広域表示窓 (必須) */
158
+ macroRange: [Date, Date];
159
+ /** Callback triggered when macro window changes / マクロ窓変更時コールバック */
160
+ onChangeMacroRange?: (lower: Date, upper: Date) => void;
161
+ /** Callback triggered with tuple [lower, upper] when macro window changes / マクロ窓変更時タプルコールバック */
162
+ onChangeMacroRangeTuple?: (range: [Date, Date]) => void;
163
+ /** Symmetrical alias for macro window changes / マクロ窓変更時コールバック (エイリアス) */
164
+ onChangeMacro?: (range: [Date, Date]) => void;
165
+ /** Micro selected range tuple [lower, upper] / ミクロ側の最終確定期間タプル (優先指定) */
166
+ microRange?: [Date, Date];
167
+ /** Micro selected lower date / ミクロ側の最終確定開始日付 */
168
+ lowerDate?: Date;
169
+ /** Micro selected upper date / ミクロ側の最終確定終了日付 */
170
+ upperDate?: Date;
171
+ /** Initial micro range tuple for uncontrolled usage / 非制御時の初期ミクロ選択期間タプル */
172
+ defaultMicroRange?: [Date, Date];
173
+ /** Initial micro range tuple alias / 非制御時の初期ミクロ選択期間タプル (エイリアス) */
174
+ initialMicroRange?: [Date, Date];
175
+ /** Initial lower date for uncontrolled usage / 非制御時の初期ミクロ開始日付 */
176
+ defaultLowerDate?: Date;
177
+ /** Initial lower date alias / 非制御時の初期ミクロ開始日付 (エイリアス) */
178
+ initialLowerDate?: Date;
179
+ /** Initial upper date for uncontrolled usage / 非制御時の初期ミクロ終了日付 */
180
+ defaultUpperDate?: Date;
181
+ /** Initial upper date alias / 非制御時の初期ミクロ終了日付 (エイリアス) */
182
+ initialUpperDate?: Date;
183
+ /** Callback triggered when micro range changes / ミクロ選択範囲変更時コールバック */
184
+ onChangeRange?: (lower: Date, upper: Date) => void;
185
+ /** Callback triggered with tuple [lower, upper] when micro range changes / ミクロ選択範囲変更時タプルコールバック */
186
+ onChangeRangeTuple?: (range: [Date, Date]) => void;
187
+ /** Symmetrical callback for micro range / ミクロ選択範囲変更時コールバック (対称命名) */
188
+ onChangeMicroRange?: (lower: Date, upper: Date) => void;
189
+ /** Symmetrical tuple callback for micro range / ミクロ選択範囲変更時タプルコールバック (対称命名) */
190
+ onChangeMicroRangeTuple?: (range: [Date, Date]) => void;
191
+ /** Symmetrical alias for micro callback / ミクロ選択範囲変更時コールバック (エイリアス) */
192
+ onChangeMicro?: (range: [Date, Date]) => void;
193
+ /** Vernier scale orientation: "macro-top" (default), "macro-bottom", "macro-left", or "macro-right" / ノギス配置方向 (既定: "macro-top") */
194
+ vernierOrientation?: "macro-top" | "macro-bottom" | "macro-left" | "macro-right";
195
+ /** Show semi-transparent trapezoid projection cone between macro and micro / 台形プロジェクション光の表示 (既定: true) */
196
+ showVernierProjection?: boolean;
197
+ /** Show adaptive scale ticks on macro and micro rails / アダプティブ目盛線の表示 (既定: true) */
198
+ showVernierTicks?: boolean;
199
+ /** Show 1px precision hairline pointer cursor on semicircles / 精密ヘアライン針の表示 (既定: true) */
200
+ showHairline?: boolean;
201
+ /** Adaptive zoom expansion animation toggle / 自動適応ズーム展開アニメーション (既定: false) */
202
+ adaptiveExpand?: boolean;
203
+ /** Macro scale unit (defaults to props.unit) / マクロ側の単位 (既定: props.unit) */
204
+ macroUnit?: PeriodSliderUnit;
205
+ /** Micro scale unit (defaults to props.unit) / ミクロ側の単位 (既定: props.unit) */
206
+ microUnit?: PeriodSliderUnit;
207
+ /** Macro discrete mode flag / マクロ側の離散モードフラグ */
208
+ macroIsDiscrete?: boolean;
209
+ /** Micro discrete mode flag / ミクロ側の離散モードフラグ */
210
+ microIsDiscrete?: boolean;
211
+ /** Macro allowed discrete dates / マクロ側の離散候補日付一覧 */
212
+ macroAllowedDates?: Date[];
213
+ /** Micro allowed discrete dates / ミクロ側の離散候補日付一覧 */
214
+ microAllowedDates?: Date[];
215
+ /** Custom label formatter for macro handles and tooltip / マクロ用カスタム日付フォーマッタ */
216
+ formatMacroLabel?: (date: Date) => string;
217
+ /** Custom label formatter for micro handles and tooltip / ミクロ用カスタム日付フォーマッタ */
218
+ formatMicroLabel?: (date: Date) => string;
219
+ range?: never;
220
+ value?: never;
221
+ valueDate?: never;
222
+ onChangePoint?: never;
223
+ onChangeValue?: never;
224
+ }
225
+ export type PeriodSliderProps = PeriodSliderRangeProps | PeriodSliderPointProps | PeriodSliderVernierProps;
226
+ /**
227
+ * Normalizes a date to the start of the specified unit.
228
+ * 指定した単位 (year, month, day) の先頭に日付を正規化します。
229
+ */
230
+ export declare const normalizeDateByUnit: (unit: PeriodSliderUnit, d: Date) => Date;
231
+ /**
232
+ * Encodes a normalized date into a numeric integer key for efficient comparison.
233
+ * 日付を比較用数値キーにエンコードします。
234
+ */
235
+ export declare const encode: (unit: PeriodSliderUnit, d: Date) => number;
236
+ /**
237
+ * Decodes a numeric integer key back to a normalized Date object.
238
+ * エンコードされた数値キーから Date オブジェクトを復元します。
239
+ */
240
+ export declare const decode: (unit: PeriodSliderUnit, val: number) => Date;
241
+ /**
242
+ * Adds or subtracts units from a given date.
243
+ * 日付に対して単位数を加減算します。
244
+ */
245
+ export declare const addUnit: (unit: PeriodSliderUnit, d: Date, amount: number) => Date;
246
+ /**
247
+ * Calculates the end boundary of a macro window in micro unit resolution.
248
+ * When the macro unit is coarser than the micro unit, expands the date to encompass
249
+ * the full terminal span (e.g. Month -> last day of month, Year -> Dec 31 or Dec).
250
+ * マクロ側の時間単位がミクロ側より粗い場合に、末尾期間全体を包含するように終了境界日を補正する関数。
251
+ *
252
+ * @param macroUnit - Macro scale unit / マクロ側の時間解像度単位
253
+ * @param microUnit - Micro scale unit / ミクロ側の時間解像度単位
254
+ * @param d - Macro range end date / マクロ範囲の終了日付
255
+ * @returns Corrected boundary Date in micro unit resolution / 補正後のミクロ解像度終了日付
256
+ */
257
+ export declare const getMacroWindowEndDate: (macroUnit: PeriodSliderUnit, microUnit: PeriodSliderUnit, d: Date) => Date;
258
+ /**
259
+ * Formats a Date object into a readable localized string.
260
+ * 日付を表示用文字列にフォーマットします。
261
+ */
262
+ export declare const formatLabel: (unit: PeriodSliderUnit, d: Date, customFormat?: (date: Date) => string) => string;
263
+ /**
264
+ * Generates an accessible, human-friendly label for screen readers.
265
+ * スクリーンリーダー向けの自然言語アクセシブルラベルを生成します。
266
+ *
267
+ * @param unit - The time unit of the slider
268
+ * @param d - The target date
269
+ * @param customFormat - Optional custom formatter
270
+ * @returns Human-friendly string (e.g. "2026年 9月 11日")
271
+ */
272
+ export declare const formatScreenReaderLabel: (unit: PeriodSliderUnit, d: Date, customFormat?: (date: Date) => string) => string;
273
+ /**
274
+ * Finds the index of the date in a sorted array closest to the target date via binary search.
275
+ * 昇順ソート済み日付配列の中から、対象日付に最も近い要素のインデックスを二分探索 ($O(\log N)$) で算出します。
276
+ */
277
+ export declare const findNearestDateIndex: (dates: Date[], target: Date, unit: PeriodSliderUnit) => number;
278
+ /**
279
+ * Pre-processes, normalizes, deduplicates, and sorts discrete dates.
280
+ * 離散日付配列を事前処理・正規化・重複排除・昇順ソートします。
281
+ */
282
+ export declare const getSortedAllowedDates: (allowedDates: Date[] | undefined, unit: PeriodSliderUnit, minDate?: Date, maxDate?: Date) => Date[];
283
+ /**
284
+ * Calculates dragging values when dragging knob handles.
285
+ * ハンドルドラッグ時の数値を算出します。
286
+ */
287
+ export declare const calculateHandleDragValues: (handle: "low" | "high", clampedVal: number, startLowVal: number, startHighVal: number, rangeMin: number, rangeMax: number, isPointMode: boolean) => [number, number];
288
+ /**
289
+ * Determines which handle ('low' or 'high') is actively under the pointer when dragging.
290
+ * ドラッグ操作中にポインターが現在操作しているハンドル ('low' または 'high') の判定。
291
+ *
292
+ * @param originalHandle - Originally grabbed handle on pointerdown ('low' or 'high')
293
+ * @param pointerVal - Current value calculated from pointer position
294
+ * @param startLowVal - Initial low value when drag began
295
+ * @param startHighVal - Initial high value when drag began
296
+ * @param isPointMode - Whether slider is in single-point mode
297
+ * @returns Handle name corresponding to the active pointer position
298
+ */
299
+ export declare const getActiveDragHandle: (originalHandle: "low" | "high", pointerVal: number, startLowVal: number, startHighVal: number, isPointMode: boolean) => "low" | "high";
300
+ /**
301
+ * Computes dragging values when translating/dragging the connection bar.
302
+ * 接続バー並進ドラッグ時の数値を算出します。
303
+ */
304
+ export declare const calculateConnectDragValues: (posDiffPct: number, startLowVal: number, startHighVal: number, rangeMin: number, rangeMax: number, isDiscrete: boolean, sortedAllowedDates: Date[]) => [number, number] | null;
305
+ /**
306
+ * Calculates the next [low, high] values based on keyboard input.
307
+ * キーボード操作時の移動先数値を算出します。
308
+ */
309
+ export declare const calculateKeyboardActionValues: (key: string, handle: "low" | "high", lowVal: number, highVal: number, rangeMin: number, rangeMax: number, isPointMode: boolean, step: number) => [number, number] | null;
310
+ /**
311
+ * Mathematically calculates smooth rotation angle and offsets to prevent label collision in range mode.
312
+ * Range モードにおいて、2つのつまみラベルの重複を回避するための滑らかな回転角とオフセットを数学的に計算します。
313
+ *
314
+ * Ken Perlin's Smootherstep function S(u) = 6u^5 - 15u^4 + 10u^3 ensures C^2 continuity (smooth acceleration and zero jerk).
315
+ *
316
+ * @param lowPct - Percent position of lower handle (0-100)
317
+ * @param highPct - Percent position of upper handle (0-100)
318
+ * @param trackWidthPx - Measured pixel width of the track (falls back to 400 if 0 or unavailable)
319
+ * @param labelPosition - "top" or "bottom"
320
+ * @param unit - "year" | "month" | "day"
321
+ * @param config - Optional configuration for fine-tuning
322
+ */
323
+ export declare const calculateLabelSlant: (lowPct: number, highPct: number, trackWidthPx: number, labelPosition?: PeriodSliderLabelPosition, unit?: PeriodSliderUnit, config?: LabelSlantConfig) => LabelSlantResult;
324
+ export type VernierHandle = "macro-low" | "macro-high" | "macro-connect" | "micro-low" | "micro-high" | "micro-connect";
325
+ /**
326
+ * Resolves the target Vernier handle based on pointer primary-axis ratio and cross-axis offset relative to track center.
327
+ * トラック中心線に対するポインターの直交軸オフセットと主軸比率から、操作対象となるノギスハンドル(マクロまたはミクロ)を判定します。
328
+ */
329
+ 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): VernierHandle;
330
+ /**
331
+ * Calculates updated macro window range when dragging a macro handle or connect bar, supporting crossover swapping.
332
+ * マクロハンドルまたはコネクトバードラッグ時の新マクロ範囲を算出します (上限下限反転スワップ対応)。
333
+ *
334
+ * @param handle - Dragged macro handle or connect bar
335
+ * @param pointerRatio - Current pointer ratio across track (0.0 - 1.0)
336
+ * @param startPointerRatio - Initial pointer ratio at drag start
337
+ * @param startMacroLowRatio - Initial macro low ratio at drag start
338
+ * @param startMacroHighRatio - Initial macro high ratio at drag start
339
+ * @returns Tuple of [nextLowRatio, nextHighRatio, activeHandle]
340
+ */
341
+ export declare function calculateVernierMacroDrag(handle: "macro-low" | "macro-high" | "macro-connect", pointerRatio: number, startPointerRatio: number, startMacroLowRatio: number, startMacroHighRatio: number): [number, number, "macro-low" | "macro-high" | "macro-connect"];
342
+ /**
343
+ * Calculates updated micro selection range when dragging a micro handle or connect bar, supporting crossover swapping.
344
+ * ミクロハンドルまたはコネクトバードラッグ時の新ミクロ範囲を算出します (上限下限反転スワップ対応)。
345
+ *
346
+ * @param handle - Dragged micro handle or connect bar
347
+ * @param pointerRatio - Current pointer ratio across track (0.0 - 1.0)
348
+ * @param startPointerRatio - Initial pointer ratio at drag start
349
+ * @param startMicroLowRatio - Initial micro low ratio at drag start
350
+ * @param startMicroHighRatio - Initial micro high ratio at drag start
351
+ * @returns Tuple of [nextLowRatio, nextHighRatio, activeHandle]
352
+ */
353
+ export declare function calculateVernierMicroDrag(handle: "micro-low" | "micro-high" | "micro-connect", pointerRatio: number, startPointerRatio: number, startMicroLowRatio: number, startMicroHighRatio: number): [number, number, "micro-low" | "micro-high" | "micro-connect"];
354
+ /**
355
+ * SVG vector semicircle knob for Vernier caliper handles.
356
+ * Rendered using mathematical arc commands to guarantee perfectly smooth round edges without raster distortion.
357
+ * ノギス半円つまみ用 SVG ベクター幾何学ドーム描画コンポーネント。
358
+ */
359
+ export declare const VernierKnobSvg: React.NamedExoticComponent<{
360
+ type: "macro" | "micro";
361
+ isTop?: boolean;
362
+ isVertical?: boolean;
363
+ isLeft?: boolean;
364
+ }>;
365
+ /**
366
+ * Helper to shallowly compare two CSSProperties style objects.
367
+ * 2 つの CSSProperties オブジェクトの浅い同値性を判定するヘルパー関数。
368
+ *
369
+ * @param a - First style object
370
+ * @param b - Second style object
371
+ * @returns True if style objects have identical keys and values
372
+ */
373
+ export declare const areStylesEqual: (a?: React.CSSProperties, b?: React.CSSProperties) => boolean;
374
+ /**
375
+ * Compares previous and next props for PeriodSlider to prevent unnecessary re-renders.
376
+ * PeriodSlider の不要な再レンダリングを防止するための Props 比較関数。
377
+ *
378
+ * @param prev - Previous props
379
+ * @param next - Next props
380
+ * @returns True if props are functionally equivalent, false otherwise
381
+ */
382
+ export declare const arePeriodSliderPropsEqual: (prev: PeriodSliderProps, next: PeriodSliderProps) => boolean;
383
+ export declare const PeriodSlider: React.NamedExoticComponent<PeriodSliderProps>;
384
+ //# sourceMappingURL=PeriodSlider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PeriodSlider.d.ts","sourceRoot":"","sources":["../src/PeriodSlider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,4BAA4B,CAAA;AAMnC,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;AACvD,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,QAAQ,CAAA;AAExD;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG,cAAc,GAAG,cAAc,GAAG,gBAAgB,GAAG,WAAW,GAAG,YAAY,CAAA;AAEnI,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CA2CrF,CAAA;AAED,MAAM,WAAW,gBAAgB;IAC7B,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB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AyB,GAAI,MAAM,iBAAiB,EAAE,MAAM,iBAAiB,KAAG,OAsG5F,CAAA;AAED,eAAO,MAAM,YAAY,+CAAyD,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { default as React } from 'react';
2
+ import { PeriodSliderUnit } from './PeriodSlider';
3
+ export interface YearSelectorProps {
4
+ /** Controlled selected date / 選択日付(外部制御用) */
5
+ value?: Date;
6
+ /** Initial selected date (defaults to current date) / 選択日付(未指定時は現在日) */
7
+ initialDate?: Date;
8
+ /** Time resolution unit (ignored by selector, accepted for hook interoperability) / 時間解像度単位 (フック相互運用用) */
9
+ unit?: PeriodSliderUnit;
10
+ /** Callback triggered when year changes / 年変更時コールバック */
11
+ onChange?(date: Date, year: number): void;
12
+ /** Child elements / 子要素 */
13
+ children?: React.ReactNode;
14
+ /** Minimum selectable year / ドロップダウン・可能範囲の最小年 */
15
+ minYear?: number;
16
+ /** Maximum selectable year / ドロップダウン・可能範囲の最大年 */
17
+ maxYear?: number;
18
+ /** Minimum selectable date / 選択可能範囲の最小日付 */
19
+ minDate?: Date;
20
+ /** Maximum selectable date / 選択可能範囲の最大日付 */
21
+ maxDate?: Date;
22
+ /** Additional CSS class name / 追加の CSS クラス名 */
23
+ className?: string;
24
+ /** Custom styles / スタイル */
25
+ style?: React.CSSProperties;
26
+ /** Disabled flag / 無効化フラグ */
27
+ disabled?: boolean;
28
+ /** Accessible label for previous year button / 前年ボタンのアクセシブル名 */
29
+ prevYearAriaLabel?: string;
30
+ /** Accessible label for next year button / 翌年ボタンのアクセシブル名 */
31
+ nextYearAriaLabel?: string;
32
+ /** Accessible label for year select combobox / 会計年セレクトのアクセシブル名 */
33
+ selectAriaLabel?: string;
34
+ }
35
+ export declare const YearSelector: React.MemoExoticComponent<(props: YearSelectorProps) => React.JSX.Element>;
36
+ //# sourceMappingURL=YearSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YearSelector.d.ts","sourceRoot":"","sources":["../src/YearSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,WAAW,iBAAiB;IAC9B,6CAA6C;IAC7C,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,wEAAwE;IACxE,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,0GAA0G;IAC1G,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,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,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,4CAA4C;IAC5C,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,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAA;CAC3B;AAgHD,eAAO,MAAM,YAAY,oCAzGa,iBAAiB,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA4HzE,CAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),Ae=require("date-fns"),r=require("react");function za(e,t,a,o){if(o&&o.length>0)return o.filter(n=>n&&!Number.isNaN(n.getTime())).map(n=>{const x=new Date(n);return x.setHours(0,0,0,0),x}).sort((n,x)=>x.getTime()-n.getTime()).map(n=>{const x=Ae.format(n,"yyyy-MM-dd");return{label:x,value:x}});const s=e.getFullYear(),c=t??new Date(s-1,0,1),m=a??new Date(s+1,11,31),M=new Date(Math.min(c.getTime(),e.getTime()));M.setHours(0,0,0,0);const d=new Date(Math.max(m.getTime(),e.getTime()));d.setHours(0,0,0,0);const g=[];let T=d;for(;T>=M;){const $=Ae.format(T,"yyyy-MM-dd");g.push({label:$,value:$}),T=Ae.addDays(T,-1)}return g}const Ba=e=>{const{value:t,initialDate:a,onChange:o,children:s,minYear:c,maxYear:m,minDate:M,maxDate:d,allowedDates:g,variant:T="dropdown",className:$="",style:n,disabled:x=!1,prevDateAriaLabel:G="前日",nextDateAriaLabel:U="翌日",selectAriaLabel:H="年月日"}=e,A=t??a,[z,V]=r.useState(()=>{const i=new Date(A??new Date);return i.setHours(0,0,0,0),i}),I=t!==void 0,b=r.useMemo(()=>{if(I){if(t&&!Number.isNaN(t.getTime())){const F=new Date(t);return F.setHours(0,0,0,0),F}const i=new Date;return i.setHours(0,0,0,0),i}return z},[I,t?.getTime(),z]),E=M?.getTime(),y=d?.getTime(),w=r.useMemo(()=>{if(M){const i=new Date(M);return i.setHours(0,0,0,0),i}if(c!==void 0){const i=new Date(c,0,1);return i.setFullYear(c),i.setHours(0,0,0,0),i}return null},[E,c]),p=r.useMemo(()=>{if(d){const i=new Date(d);return i.setHours(0,0,0,0),i}if(m!==void 0){const i=new Date(m,11,31);return i.setFullYear(m),i.setHours(0,0,0,0),i}return null},[y,m]),ne=A?.getTime();r.useEffect(()=>{if(!I&&A&&!Number.isNaN(A.getTime())){const i=new Date(A);i.setHours(0,0,0,0),V(i)}},[I,ne]);const N=i=>{if(x)return;let F=new Date(i);F.setHours(0,0,0,0),w&&F<w&&(F=new Date(w)),p&&F>p&&(F=new Date(p)),I||V(F),o?.(F)},_=r.useMemo(()=>Ae.addDays(b,-1),[b]),Y=r.useMemo(()=>Ae.addDays(b,1),[b]),X=x||w!==null&&_<w,W=x||p!==null&&Y>p,me=()=>N(_),ce=()=>N(Y),oe=i=>{if(i.target.value){const F=Ae.parseISO(i.target.value);Number.isNaN(F.getTime())||N(F)}},Q=i=>{if(i.target.value){const F=Ae.parseISO(i.target.value);Number.isNaN(F.getTime())||N(F)}},B=b.getFullYear(),se=b.getMonth()+1,He=b.getDate(),be=w?.getTime()??null,Te=p?.getTime()??null,Ce=b.getTime(),he=r.useMemo(()=>{if(g&&g.length>0)return g.map(Ne=>Ne.getTime()).join(",");const i=be??new Date(B-1,0,1).getTime(),F=Te??new Date(B+1,11,31).getTime(),D=Math.min(i,Ce),we=Math.max(F,Ce);return`${D}_${we}`},[g,be,Te,Ce,B]),ze=r.useMemo(()=>T!=="dropdown"?[]:za(b,w,p,g),[T,he,b]),je=r.useMemo(()=>{if(T!=="split-dropdown")return[];const i=w?w.getFullYear():B-10,F=p?p.getFullYear():B+1,D=Math.min(i,B),we=Math.max(F,B),Ne=[];for(let Fe=we;Fe>=D;Fe--)Ne.push(Fe);return Ne},[T,w,p,B]),k=r.useMemo(()=>{if(T!=="split-dropdown")return[];let i=1,F=12;w&&B===w.getFullYear()&&(i=w.getMonth()+1),p&&B===p.getFullYear()&&(F=p.getMonth()+1);const D=[];for(let we=i;we<=F;we++)D.push(we);return D},[T,w,p,B]),j=r.useMemo(()=>{if(T!=="split-dropdown")return[];const i=Ae.getDaysInMonth(b);let F=1,D=i;w&&B===w.getFullYear()&&se===w.getMonth()+1&&(F=w.getDate()),p&&B===p.getFullYear()&&se===p.getMonth()+1&&(D=p.getDate());const we=[];for(let Ne=F;Ne<=D;Ne++)we.push(Ne);return we},[T,w,p,b,B,se]),q=(i,F,D)=>{const we=Ae.getDaysInMonth(new Date(i,F-1,1)),Ne=Math.min(D,we),Fe=new Date(i,F-1,Ne);Fe.setFullYear(i),N(Fe)},te=Ae.format(b,"yyyy-MM-dd"),L=w?Ae.format(w,"yyyy-MM-dd"):void 0,re=p?Ae.format(p,"yyyy-MM-dd"):void 0,ee=T==="split-dropdown"?"w-auto":"w-38";return h.jsxs("div",{className:`inline-flex items-center ${ee} ${$}`,style:n,children:[h.jsx("button",{type:"button","aria-label":G,disabled:X,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:h.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"})}),T==="dropdown"?h.jsx("select",{"aria-label":H,disabled:x,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:te,onChange:Q,children:ze.map(i=>h.jsx("option",{value:i.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:i.label},i.value))}):T==="split-dropdown"?h.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[h.jsx("select",{"aria-label":"年",disabled:x,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:B,onChange:i=>q(Number(i.target.value),se,He),children:je.map(i=>h.jsxs("option",{value:i,className:"dark:bg-slate-700 dark:text-slate-100",children:[i,"年"]},i))}),h.jsx("select",{"aria-label":"月",disabled:x,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:se,onChange:i=>q(B,Number(i.target.value),He),children:k.map(i=>h.jsxs("option",{value:i,className:"dark:bg-slate-700 dark:text-slate-100",children:[String(i).padStart(2,"0"),"月"]},i))}),h.jsx("select",{"aria-label":"日",disabled:x,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:He,onChange:i=>q(B,se,Number(i.target.value)),children:j.map(i=>h.jsxs("option",{value:i,className:"dark:bg-slate-700 dark:text-slate-100",children:[String(i).padStart(2,"0"),"日"]},i))})]}):h.jsx("input",{"aria-label":H,disabled:x,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:te,min:L,max:re,onChange:oe,type:"date"}),h.jsx("button",{type:"button","aria-label":U,disabled:W,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:h.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"})}),s]})},Da=r.memo(Ba,(e,t)=>{const a=e.value??e.initialDate,o=t.value??t.initialDate,s=a&&!Number.isNaN(a.getTime())?a.getFullYear()*1e4+(a.getMonth()+1)*100+a.getDate():null,c=o&&!Number.isNaN(o.getTime())?o.getFullYear()*1e4+(o.getMonth()+1)*100+o.getDate():null;if(s!==c||e.variant!==t.variant||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear)return!1;const m=e.minDate&&!Number.isNaN(e.minDate.getTime())?e.minDate.getFullYear()*1e4+(e.minDate.getMonth()+1)*100+e.minDate.getDate():null,M=t.minDate&&!Number.isNaN(t.minDate.getTime())?t.minDate.getFullYear()*1e4+(t.minDate.getMonth()+1)*100+t.minDate.getDate():null;if(m!==M)return!1;const d=e.maxDate&&!Number.isNaN(e.maxDate.getTime())?e.maxDate.getFullYear()*1e4+(e.maxDate.getMonth()+1)*100+e.maxDate.getDate():null,g=t.maxDate&&!Number.isNaN(t.maxDate.getTime())?t.maxDate.getFullYear()*1e4+(t.maxDate.getMonth()+1)*100+t.maxDate.getDate():null;return!(d!==g||e.onChange!==t.onChange||e.allowedDates!==t.allowedDates||e.children!==t.children||e.prevDateAriaLabel!==t.prevDateAriaLabel||e.nextDateAriaLabel!==t.nextDateAriaLabel||e.selectAriaLabel!==t.selectAriaLabel)});Da.displayName="DateSelector";function Xa(e,t,a,o,s){const c=e.getFullYear(),m=t??(o?o.getFullYear():c-5),M=a??(s?s.getFullYear():c+5),d=Math.min(m,c),g=Math.max(M,c),T=o?new Date(o.getFullYear(),o.getMonth(),1).getTime():null,$=s?new Date(s.getFullYear(),s.getMonth(),1).getTime():null,n=[];for(let x=g;x>=d;x--)for(let G=12;G>=1;G--){const U=new Date(x,G-1,1);U.setFullYear(x);const H=U.getTime();if(T!==null&&H<T||$!==null&&H>$)continue;const A=String(G).padStart(2,"0"),z=`${x}-${A}`;n.push({label:z,value:z})}return n}const Ka=e=>{const{value:t,initialDate:a,onChange:o,children:s,variant:c="date",minYear:m,maxYear:M,minDate:d,maxDate:g,isWarning:T=!1,className:$="",style:n,disabled:x=!1,prevMonthAriaLabel:G="前月",nextMonthAriaLabel:U="翌月",selectAriaLabel:H="年月"}=e,A=t??a,[z,V]=r.useState(()=>{const L=A??new Date,re=new Date(L.getFullYear(),L.getMonth(),1);return re.setFullYear(L.getFullYear()),re}),I=t!==void 0,b=r.useMemo(()=>{if(I){if(t&&!Number.isNaN(t.getTime())){const L=new Date(t.getFullYear(),t.getMonth(),1);return L.setFullYear(t.getFullYear()),L}return new Date}return z},[I,t?.getTime(),z]),E=d?.getTime(),y=g?.getTime(),w=r.useMemo(()=>{if(d){const L=new Date(d.getFullYear(),d.getMonth(),1);return L.setFullYear(d.getFullYear()),L}if(m!==void 0){const L=new Date(m,0,1);return L.setFullYear(m),L}return null},[E,m]),p=r.useMemo(()=>{if(g){const L=new Date(g.getFullYear(),g.getMonth(),1);return L.setFullYear(g.getFullYear()),L}if(M!==void 0){const L=new Date(M,11,1);return L.setFullYear(M),L}return null},[y,M]),ne=A?.getTime();r.useEffect(()=>{if(!I&&A&&!Number.isNaN(A.getTime())){const L=new Date(A.getFullYear(),A.getMonth(),1);L.setFullYear(A.getFullYear()),V(L)}},[I,ne]);const N=L=>{if(x)return;let re=L;w&&re<w&&(re=new Date(w)),p&&re>p&&(re=new Date(p)),I||V(re);const ee=re.getFullYear()*100+(re.getMonth()+1);o?.(re,ee)},_=r.useMemo(()=>{const L=new Date(b.getFullYear(),b.getMonth()-1,1);return L.setFullYear(b.getMonth()===0?b.getFullYear()-1:b.getFullYear()),L},[b]),Y=r.useMemo(()=>{const L=new Date(b.getFullYear(),b.getMonth()+1,1);return L.setFullYear(b.getMonth()===11?b.getFullYear()+1:b.getFullYear()),L},[b]),X=x||w!==null&&_<w,W=x||p!==null&&Y>p,me=()=>{N(_)},ce=()=>{N(Y)},oe=L=>{const re=L.target.value;if(!re)return;const[ee,ie]=re.split("-"),i=Number(ee),F=Number(ie)-1;if(!(Number.isNaN(i)||Number.isNaN(F))){const D=new Date(i,F,1);D.setFullYear(i),N(D)}},Q=L=>{const re=L.target.value;if(!re)return;const[ee,ie]=re.split("-"),i=Number(ee),F=Number(ie)-1;if(!(Number.isNaN(i)||Number.isNaN(F))){const D=new Date(i,F,1);D.setFullYear(i),N(D)}},B=`${b.getFullYear()}-${String(b.getMonth()+1).padStart(2,"0")}`,se=w?`${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}`:void 0,He=p?`${p.getFullYear()}-${String(p.getMonth()+1).padStart(2,"0")}`:void 0,be=b.getFullYear(),Te=m??(d?d.getFullYear():be-5),Ce=M??(g?g.getFullYear():be+5),he=Math.min(Te,be),ze=Math.max(Ce,be),je=`${he}_${ze}_${E??"none"}_${y??"none"}`,k=r.useMemo(()=>c!=="dropdown"?[]:Xa(b,m,M,d,g),[c,je,b]),j=T?"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",q=`mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${j}`,te=`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] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 ${j}`;return h.jsxs("div",{className:`inline-flex w-38 items-center ${$}`,style:n,children:[h.jsx("button",{type:"button","aria-label":G,disabled:X,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:h.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"?h.jsx("select",{"aria-label":H,disabled:x,className:te,value:B,onChange:Q,children:k.map(L=>h.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))}):h.jsx("input",{"aria-label":H,disabled:x,className:q,value:B,min:se,max:He,onChange:oe,type:"month"}),h.jsx("button",{type:"button","aria-label":U,disabled:W,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:h.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"})}),s]})},va=r.memo(Ka,(e,t)=>{const a=e.value??e.initialDate,o=t.value??t.initialDate,s=a&&!Number.isNaN(a.getTime())?a.getFullYear()*12+a.getMonth():null,c=o&&!Number.isNaN(o.getTime())?o.getFullYear()*12+o.getMonth():null;if(s!==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 m=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,M=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(m!==M)return!1;const d=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,g=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(d!==g||e.onChange!==t.onChange||e.children!==t.children||e.prevMonthAriaLabel!==t.prevMonthAriaLabel||e.nextMonthAriaLabel!==t.nextMonthAriaLabel||e.selectAriaLabel!==t.selectAriaLabel)});va.displayName="MonthSelector";const zt={"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"}},le=(e,t)=>{if(!t||Number.isNaN(t.getTime()))return new Date;const a=new Date(t.getTime());return e==="year"?(a.setMonth(0,1),a.setHours(0,0,0,0)):(e==="month"&&a.setDate(1),a.setHours(0,0,0,0)),a},J=(e,t)=>{if(!t||Number.isNaN(t.getTime()))return 0;const a=le(e,t),o=a.getFullYear(),s=a.getMonth()+1,c=a.getDate();return e==="year"?o:e==="month"?o*12+(s-1):Math.floor(Date.UTC(o,s-1,c)/(1440*60*1e3))},de=(e,t)=>{if(e==="year")return new Date(t,0,1);if(e==="month"){const o=Math.floor(t/12),s=t%12;return new Date(o,s,1)}const a=new Date(t*24*60*60*1e3);return new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate())},xe=(e,t,a)=>{const o=new Date(t.getTime());return e==="year"?o.setFullYear(o.getFullYear()+a):e==="month"?o.setMonth(o.getMonth()+a):o.setDate(o.getDate()+a),o},jt=(e,t,a)=>{if(!a||Number.isNaN(a.getTime()))return new Date;if(e===t)return le(t,a);const o=a.getFullYear(),s=a.getMonth();if(e==="year"){if(t==="month")return new Date(o,11,1);if(t==="day")return new Date(o,11,31)}return e==="month"&&t==="day"?new Date(o,s+1,0):le(t,a)},Qe=(e,t,a)=>{if(!t||Number.isNaN(t.getTime()))return"";if(a)return a(t);const o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),c=String(t.getDate()).padStart(2,"0");return e==="year"?`${o}年`:e==="month"?`${o}年${s}月`:`${o}年${s}月${c}日`},at=(e,t,a)=>{if(!t||Number.isNaN(t.getTime()))return"";if(a)return a(t);const o=t.getFullYear(),s=t.getMonth()+1,c=t.getDate();return e==="year"?`${o}年`:e==="month"?`${o}年 ${s}月`:`${o}年 ${s}月 ${c}日`},Bt=(e,t,a)=>{if(!e||e.length===0||e.length===1)return 0;const o=J(a,t);let s=0,c=e.length-1;if(o<=J(a,e[s]))return 0;if(o>=J(a,e[c]))return c;for(;s<=c;){const d=s+c>>1,g=J(a,e[d]);if(g===o)return d;g<o?s=d+1:c=d-1}const m=Math.abs(J(a,e[s])-o),M=Math.abs(J(a,e[c])-o);return m<M?s:c},Ft=(e,t,a,o)=>{if(!Array.isArray(e)||e.length===0)return[];const s=e.filter(d=>d&&!Number.isNaN(d.getTime())).map(d=>le(t,d));if(s.length===0)return[];const c=new Map;for(const d of s){const g=J(t,d);c.has(g)||c.set(g,d)}let M=Array.from(c.keys()).sort((d,g)=>d-g).map(d=>c.get(d)).filter(d=>d!==void 0);if(a&&!Number.isNaN(a.getTime())){const d=J(t,a);M=M.filter(g=>J(t,g)>=d)}if(o&&!Number.isNaN(o.getTime())){const d=J(t,o);M=M.filter(g=>J(t,g)<=d)}return M},Xt=(e,t,a,o,s,c,m)=>{let M=a,d=o;return m?(M=t,d=t):e==="low"?t>o?(M=o,d=t):M=t:t<a?(d=a,M=t):d=t,[Math.max(s,Math.min(c,M)),Math.max(s,Math.min(c,d))]},_a=(e,t,a,o,s)=>s?"low":e==="low"?t>o?"high":"low":t<a?"low":"high",pa=(e,t,a,o,s,c,m)=>{const M=s-o;if(M<=0)return null;if(c){const $=Math.round(e*(m.length-1));if($===0)return null;let n=t+$,x=a+$;return n<0&&(x+=-n,n=0),x>m.length-1&&(n-=x-(m.length-1),x=m.length-1),n=Math.max(0,Math.min(m.length-1,n)),x=Math.max(0,Math.min(m.length-1,x)),[n,x]}const d=Math.round(e*M);if(d===0)return null;let g=t+d,T=a+d;return g<o&&(T+=o-g,g=o),T>s&&(g-=T-s,T=s),g=Math.max(o,Math.min(s,g)),T=Math.max(o,Math.min(s,T)),[g,T]},ya=(e,t,a,o,s,c,m,M)=>{let d=0,g=!1,T=!1;switch(e){case"ArrowRight":case"ArrowUp":d=M;break;case"ArrowLeft":case"ArrowDown":d=-M;break;case"PageUp":d=M*5;break;case"PageDown":d=-M*5;break;case"Home":g=!0;break;case"End":T=!0;break;default:return null}if(m){let x=a;return g?x=s:T?x=c:x=Math.max(s,Math.min(c,a+d)),[x,x]}let $=a,n=o;return t==="low"?g?$=s:T?$=o:$=Math.max(s,Math.min(o,a+d)):g?n=a:T?n=c:n=Math.max(a,Math.min(c,o+d)),[$,n]},Ta=(e,t,a,o="top",s="day",c)=>{const m=a>0?a:400,M=Math.max(0,t-e)/100*m,d=s==="year"?48:s==="month"?68:90,g=c?.estimatedWidthPx??d,T=c?.estimatedHeightPx??16,$=c?.paddingPx??12,n=c?.maxAngleDeg??90,x=8,G=c?.anchorGapY!==void 0?c.anchorGapY:2,U=x+G,H=U+T/2,A=o==="top"?-H:H,z=g+$;if(M>=z)return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:A,highOffsetY:A,isSlanted:!1,proximity:0};const V=Math.max(0,Math.min(1,(z-M)/z)),I=V*V*V*(V*(V*6-15)+10),b=I*n,E=o==="top"?-b:b,y=b*Math.PI/180,w=g/2*Math.abs(Math.sin(y))+T/2*Math.abs(Math.cos(y)),p=U+w,ne=o==="top"?-p:+p,_=T+4,Y=Math.max(0,_-M),X=I*(Y/2);return{lowAngleDeg:E,highAngleDeg:E,lowOffsetX:-X,highOffsetX:X,lowOffsetY:ne,highOffsetY:ne,isSlanted:V>.001,proximity:V}};function Ca(e,t,a,o,s,c,m="macro-top",M=.05){const d=m==="macro-top"||m==="macro-left",g=t<=0;if(d&&g||!(d||g)){const n=Math.abs(e-a),x=Math.abs(e-o);return n<=M&&n<=x?"macro-low":x<=M&&x<n?"macro-high":e>=a&&e<=o?"macro-connect":n<x?"macro-low":"macro-high"}const T=Math.abs(e-s),$=Math.abs(e-c);return T<=M&&T<=$?"micro-low":$<=M&&$<T?"micro-high":e>=s&&e<=c?"micro-connect":T<$?"micro-low":"micro-high"}function Na(e,t,a,o,s){if(e==="macro-connect"){const m=t-a,M=s-o,d=Math.max(0,Math.min(1-M,o+m)),g=d+M;return[d,g,"macro-connect"]}if(e==="macro-low"){const m=Math.max(0,Math.min(1,t));return m>s?[s,m,"macro-high"]:[m,s,"macro-low"]}const c=Math.max(0,Math.min(1,t));return c<o?[c,o,"macro-low"]:[o,c,"macro-high"]}function Ga(e,t,a,o,s){if(e==="micro-connect"){const m=t-a,M=s-o,d=Math.max(0,Math.min(1-M,o+m)),g=d+M;return[d,g,"micro-connect"]}if(e==="micro-low"){const m=Math.max(0,Math.min(1,t));return m>s?[s,m,"micro-high"]:[m,s,"micro-low"]}const c=Math.max(0,Math.min(1,t));return c<o?[c,o,"micro-low"]:[o,c,"micro-high"]}const Dt=r.memo(({type:e,isTop:t=!0,isVertical:a=!1,isLeft:o=!0})=>{let s,c;a?(s=o?"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 ${o?"is-semicircle-left":"is-semicircle-right"}`):(s=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 m=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return h.jsx("svg",{className:c,width:a?"8":"16",height:a?"16":"8",viewBox:a?"0 0 8 16":"0 0 16 8",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:h.jsx("path",{d:s,className:m,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});Dt.displayName="VernierKnobSvg";const Wa=e=>{const{unit:t,minDate:a,maxDate:o,allowedDates:s,snapMode:c="index",disabled:m=!1,className:M="",showStepper:d=!0,tooltipStyle:g="always",labelPosition:T="top",autoSlantLabels:$=!0,isVertical:n=!1,hideConnectBar:x=!1,showTicks:G=!1,colorScheme:U="blue-rose"}=e,H=zt[U]??zt["blue-rose"],A=r.useId(),z=r.useRef(e);z.current=e;const V=a?.getTime(),I=o?.getTime(),b=r.useMemo(()=>Ft(s,t,a,o),[s,t,V,I]),E=b.length>0,{rangeMin:y,rangeMax:w}=r.useMemo(()=>{if(E)return{rangeMin:0,rangeMax:b.length-1};const l=le(t,a??new Date(2020,0,1));let u=le(t,o??new Date(2030,0,1));const f=J(t,l);let v=J(t,u);return v<=f&&(u=xe(t,l,1),v=J(t,u)),{rangeMin:f,rangeMax:v}},[E,b,t,V,I]),p=e.mode==="point",ne=r.useCallback(l=>{if(E){const u=Math.max(0,Math.min(b.length-1,Math.round(l)));return b[u]??new Date}return de(t,Math.round(l))},[E,b,t]),N=r.useCallback(l=>{if(!l||Number.isNaN(l.getTime()))return y;const u=le(t,l);return E?Bt(b,u,t):J(t,u)},[E,b,t,y]),_=e.mode==="range"?e.range?e.range[0]:e.lowerDate??e.defaultRange?.[0]??e.initialRange?.[0]??e.defaultLowerDate??e.initialLowerDate:e.mode==="vernier"?e.microRange?e.microRange[0]:e.lowerDate??e.defaultMicroRange?.[0]??e.initialMicroRange?.[0]??e.defaultLowerDate??e.initialLowerDate:void 0,Y=e.mode==="range"?e.range?e.range[1]:e.upperDate??e.defaultRange?.[1]??e.initialRange?.[1]??e.defaultUpperDate??e.initialUpperDate:e.mode==="vernier"?e.microRange?e.microRange[1]:e.upperDate??e.defaultMicroRange?.[1]??e.initialMicroRange?.[1]??e.defaultUpperDate??e.initialUpperDate:void 0,X=e.mode==="point"?e.value??e.valueDate??e.defaultValue??e.initialDate:void 0,W=_??(E?b[0]:de(t,y)),me=Y??(E?b[b.length-1]:de(t,w)),ce=e.mode==="point"?X?.getTime():_?.getTime(),oe=e.mode==="range"?Y?.getTime():ce,[Q,B]=r.useMemo(()=>{if(e.mode==="point"){const f=N(X);return[f,f]}const l=N(_),u=N(Y);return[Math.min(l,u),Math.max(l,u)]},[e.mode,ce,oe,N,X,_,Y]),se=e.mode==="point"?e.value!==void 0||e.valueDate!==void 0:e.mode==="range"?e.range!==void 0||e.lowerDate!==void 0||e.upperDate!==void 0:e.microRange!==void 0||e.lowerDate!==void 0||e.upperDate!==void 0,[He,be]=r.useState(()=>[Q,B]);r.useEffect(()=>{se&&be([Q,B])},[se,Q,B]);const[Te,Ce]=r.useState(null),[he,ze]=r.useState(null),je=r.useRef(null);je.current=he;const[k,j]=r.useState("high"),[q,te]=r.useState(null),[L,re]=r.useState(null),ee=Te?Te[0]:se?Q:He[0],ie=Te?Te[1]:se?B:He[1],i=e.mode==="vernier",F=e.mode==="vernier"?e.vernierOrientation??(n?"macro-left":"macro-top"):"macro-top",D=F==="macro-top"||F==="macro-left",we=e.mode==="vernier"?e.showVernierProjection??!0:!1,Ne=e.mode==="vernier"?e.showVernierTicks??!0:!1,Fe=e.mode==="vernier"?e.showHairline??!0:!1,O=i?e.macroUnit??t:t,P=i?e.microUnit??t:t,_t=i?e.macroIsDiscrete??!1:E,Gt=i?e.microIsDiscrete??!1:E,Wt=i?e.macroAllowedDates??s:s,qt=i?e.microAllowedDates??s:s,vt=i?e.formatMacroLabel??e.formatLabel:e.formatLabel,pt=i?e.formatMicroLabel??e.formatLabel:e.formatLabel,Zt=i&&e.macroRange?e.macroRange[0]?.getTime():void 0,Jt=i&&e.macroRange?e.macroRange[1]?.getTime():void 0,La=e.mode!=="point"?e.lowerDate?.getTime():void 0,Ya=e.mode!=="point"?e.upperDate?.getTime():void 0,[De,yt]=r.useState(null),et=r.useRef(null);et.current=De;const[Re,Tt]=r.useState("micro-high"),ve=r.useMemo(()=>i?J(O,le(O,a??new Date(2020,0,1))):0,[i,V,O,a]),nt=r.useMemo(()=>{if(!i)return 1;const l=le(O,o??new Date(2030,0,1)),u=J(O,l);return u<=ve?ve+1:u},[i,I,ve,O,o]),ct=r.useMemo(()=>i?Ft(Wt,O,a,o):[],[i,Wt,O,a,o]),ut=r.useMemo(()=>i?Ft(qt,P,a,o):[],[i,qt,P,a,o]),Be=r.useMemo(()=>i&&e.macroRange?J(O,le(O,e.macroRange[0])):ve,[i,Zt,ve,O]),Xe=r.useMemo(()=>i&&e.macroRange?J(O,le(O,e.macroRange[1])):nt,[i,Jt,nt,O]),ge=r.useMemo(()=>i&&e.macroRange?J(P,le(P,e.macroRange[0])):0,[i,Zt,P]),Ke=r.useMemo(()=>{if(!(i&&e.macroRange))return 1;const l=jt(O,P,e.macroRange[1]),u=J(P,le(P,l));return u<=ge?ge+1:u},[i,Jt,ge,O,P]),ke=r.useMemo(()=>i&&_?J(P,le(P,_)):ge,[i,La,ge,P,_]),Le=r.useMemo(()=>i&&Y?J(P,le(P,Y)):Ke,[i,Ya,Ke,P,Y]),dt=Math.max(1,nt-ve),Me=Math.max(0,Math.min(1,(Be-ve)/dt)),Ye=Math.max(Me,Math.min(1,(Xe-ve)/dt)),mt=Math.max(1,Ke-ge),Pe=Math.max(0,Math.min(1,(ke-ge)/mt)),tt=Math.max(Pe,Math.min(1,(Le-ge)/mt)),Ee=r.useRef(null);r.useEffect(()=>()=>{Ee.current&&clearTimeout(Ee.current)},[]);const Qt=r.useRef(null),Ve=r.useCallback((l,u,f=!1)=>{const v=z.current,R=ne(l),K=ne(u),ae=v.mode==="point"?`${R.getTime()}`:`${R.getTime()}-${K.getTime()}`;if(ae===Qt.current&&!Ee.current)return;const C=()=>{Qt.current=ae,v.mode==="point"?(v.onChangePoint?.(R),v.onChangeValue?.(R),v.onChange?.(R)):v.mode==="range"?(v.onChangeRange?.(R,K),v.onChangeRangeTuple?.([R,K]),v.onChange?.([R,K])):v.mode==="vernier"&&(v.onChangeRange?.(R,K),v.onChangeRangeTuple?.([R,K]),v.onChangeMicroRange?.(R,K),v.onChangeMicroRangeTuple?.([R,K]),v.onChangeMicro?.([R,K]))};f||!v.debounceMs||v.debounceMs===0?(Ee.current&&(clearTimeout(Ee.current),Ee.current=null),C()):(Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(()=>{C(),Ee.current=null},v.debounceMs))},[ne]),Ct=r.useCallback(l=>{if(E&&c==="time"&&b.length>1){const v=Math.max(0,Math.min(b.length-1,Math.round(l))),R=b[0].getTime(),ae=b[b.length-1].getTime()-R;if(ae<=0)return 0;const C=b[v].getTime();return Math.max(0,Math.min(100,(C-R)/ae*100))}const u=w-y;if(u<=0)return 0;const f=(l-y)/u*100;return Math.max(0,Math.min(100,f))},[E,c,b,y,w]),Nt=r.useCallback(l=>{const u=Math.max(0,Math.min(100,l));if(E){if(c==="time"&&b.length>1){const R=b[0].getTime(),ae=b[b.length-1].getTime()-R,C=R+u/100*ae;return Bt(b,new Date(C),t)}const v=Math.round(u/100*(b.length-1));return Math.max(0,Math.min(b.length-1,v))}const f=y+u/100*(w-y);return Math.round(f)},[E,c,b,y,w,t]),Se=r.useRef(null),[Sa,ea]=r.useState(0),ta=Sa;r.useEffect(()=>{const l=Se.current;if(!l)return;const u=()=>{const f=l.getBoundingClientRect(),v=n?f.height:f.width;v>0&&ea(R=>Math.abs(R-v)<.5?R:v)};if(u(),typeof ResizeObserver<"u"){const f=new ResizeObserver(v=>{for(const R of v){const K=n?R.contentRect.height:R.contentRect.width;K>0&&ea(ae=>Math.abs(ae-K)<.5?ae:K)}});return f.observe(l),()=>f.disconnect()}return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[n]);const aa=r.useCallback((l,u,f)=>{if(n){const K=f.height>0?f.height:100,ae=f.bottom-u;return Math.max(0,Math.min(100,ae/K*100))}const v=f.width>0?f.width:100,R=l-f.left;return Math.max(0,Math.min(100,R/v*100))},[n]),Rt=r.useCallback((l,u)=>Se.current?aa(l,u,Se.current.getBoundingClientRect()):0,[aa]),kt=r.useRef(null),Ht=r.useRef(null),Ie=r.useRef(null),Pt=r.useRef(null),gt=r.useRef(null),na=r.useCallback(l=>{if(m)return;if(i){const S=Ht.current;if(!S||l.pointerId!==0&&l.pointerId!==S.pointerId||!Se.current)return;const fe=Se.current.getBoundingClientRect(),Ot=n?fe.height:fe.width;if(Ot<=0)return;const Ma=n?l.clientY:l.clientX,xa=Math.max(0,Math.min(1,n?(fe.bottom-Ma)/Ot:(Ma-fe.left)/Ot)),qe=z.current;if(!qe)return;if(S.handle==="macro-low"||S.handle==="macro-high"||S.handle==="macro-connect"){const[ft,ht,Ge]=Na(S.handle,xa,S.startPointerRatio,S.startMacroLowRatio,S.startMacroHighRatio);Ge!==et.current&&(et.current=Ge,yt(Ge),Tt(Ge));let ue,ye;if(_t&&ct.length>0){const Ue=ct.length-1,We=Math.max(0,Math.min(Ue,Math.round(ft*Ue))),Ze=Math.max(We,Math.min(Ue,Math.round(ht*Ue)));ue=ct[We]??new Date,ye=ct[Ze]??new Date}else{const Ue=Math.round(ve+ft*dt),We=Math.round(ve+ht*dt);ue=de(O,Ue),ye=de(O,We)}const bt=`${ue.getTime()}_${ye.getTime()}`;bt!==Pt.current&&(Pt.current=bt,qe.onChangeMacroRange?.(ue,ye),qe.onChangeMacroRangeTuple?.([ue,ye]),qe.onChangeMacro?.([ue,ye]));let $e,Oe;if(S.handle==="macro-connect"){const Ue=le(P,ue),We=jt(O,P,ye);let Ze,lt;if(O==="year"){const Je=ue.getFullYear()-S.startMacroLowDate.getFullYear();Ze=xe("year",S.initialMicroLowDate,Je),lt=xe("year",S.initialMicroHighDate,Je)}else if(O==="month"){const Je=(ue.getFullYear()-S.startMacroLowDate.getFullYear())*12+(ue.getMonth()-S.startMacroLowDate.getMonth());Ze=xe("month",S.initialMicroLowDate,Je),lt=xe("month",S.initialMicroHighDate,Je)}else{const Je=Math.round((ue.getTime()-S.startMacroLowDate.getTime())/864e5);Ze=xe("day",S.initialMicroLowDate,Je),lt=xe("day",S.initialMicroHighDate,Je)}const st=Ue.getTime(),Mt=We.getTime(),wa=S.initialMicroHighDate.getTime()-S.initialMicroLowDate.getTime();let xt=Ze.getTime(),wt=lt.getTime();xt<st&&(xt=st,wt=Math.min(Mt,xt+wa)),wt>Mt&&(wt=Mt,xt=Math.max(st,wt-wa)),$e=le(P,new Date(xt)),Oe=le(P,new Date(wt))}else{const Ue=ue.getTime(),We=jt(O,P,ye).getTime(),Ze=S.initialMicroLowDate.getTime(),lt=S.initialMicroHighDate.getTime(),st=Math.max(Ue,Math.min(We,Ze)),Mt=Math.max(st,Math.min(We,lt));$e=le(P,new Date(st)),Oe=le(P,new Date(Mt))}const At=`${$e.getTime()}_${Oe.getTime()}`;At!==gt.current&&(gt.current=At,qe.onChangeRange?.($e,Oe),qe.onChangeRangeTuple?.([$e,Oe]))}else if(S.handle==="micro-low"||S.handle==="micro-high"||S.handle==="micro-connect"){const[ft,ht,Ge]=Ga(S.handle,xa,S.startPointerRatio,S.startMicroLowRatio,S.startMicroHighRatio);Ge!==et.current&&(et.current=Ge,yt(Ge),Tt(Ge));let ue,ye;if(Gt&&ut.length>0){const $e=ut.length-1,Oe=Math.max(0,Math.min($e,Math.round(ft*$e))),At=Math.max(Oe,Math.min($e,Math.round(ht*$e)));ue=ut[Oe]??new Date,ye=ut[At]??new Date}else{const $e=Math.round(ge+ft*mt),Oe=Math.round(ge+ht*mt);ue=de(P,$e),ye=de(P,Oe)}const bt=`${ue.getTime()}_${ye.getTime()}`;bt!==gt.current&&(gt.current=bt,qe.onChangeRange?.(ue,ye),qe.onChangeRangeTuple?.([ue,ye]))}return}const u=kt.current;if(!u||l.pointerId!==0&&l.pointerId!==u.pointerId||!Se.current)return;const f=Se.current.getBoundingClientRect(),v=n?l.clientY:l.clientX,R=n?f.height:f.width;if(R<=0)return;if(u.handle==="connect"){const S=n?(u.startPointerPos-v)/R:(v-u.startPointerPos)/R,fe=pa(S,u.startLowVal,u.startHighVal,y,w,E,b);if(fe){if(Ie.current&&Ie.current[0]===fe[0]&&Ie.current[1]===fe[1])return;Ie.current=fe,Ce(fe),Ve(fe[0],fe[1],!1)}return}const K=Rt(l.clientX,l.clientY),ae=Nt(K),[C,Z]=Xt(u.handle,ae,u.startLowVal,u.startHighVal,y,w,p);if((!Ie.current||Ie.current[0]!==C||Ie.current[1]!==Z)&&(Ie.current=[C,Z],Ce([C,Z]),Ve(C,Z,!1)),!p&&(u.handle==="low"||u.handle==="high")){const S=_a(u.handle,ae,u.startLowVal,u.startHighVal,p);je.current!==S&&(je.current=S,ze(S),j(S))}},[m,i,n,O,P,_t,Gt,ct,ut,ve,dt,ge,mt,y,w,E,b,Rt,Nt,Ve,p]),ra=r.useCallback(l=>{if(i){Pt.current=null,gt.current=null,Ht.current=null,et.current=null,yt(null);return}const u=kt.current;if(!u||l.pointerId!==0&&l.pointerId!==u.pointerId)return;const f=Ie.current??Te;f&&(Ve(f[0],f[1],!0),be(f)),Ie.current=null,Ce(null),kt.current=null,je.current=null,ze(null)},[i,Te,Ve]),oa=r.useRef(na);oa.current=na;const ia=r.useRef(ra);ia.current=ra;const la=he!==null||De!==null;r.useEffect(()=>{if(!la)return;const l=f=>oa.current(f),u=f=>ia.current(f);return window.addEventListener("pointermove",l),window.addEventListener("pointerup",u),window.addEventListener("pointercancel",u),()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",u)}},[la]);const Et=r.useCallback((l,u,f)=>{kt.current={pointerId:l,handle:u,startPointerPos:f,startLowVal:ee,startHighVal:ie},je.current=u,ze(u),u!=="connect"&&j(u)},[ee,ie]),sa=r.useCallback((l,u,f)=>{const v=z.current;Ht.current={pointerId:l,handle:u,startPointerRatio:f,startMacroLowRatio:Me,startMacroHighRatio:Ye,startMicroLowRatio:Pe,startMicroHighRatio:tt,startMacroLowEnc:Be,startMacroHighEnc:Xe,startMicroLowEnc:ke,startMicroHighEnc:Le,startMacroLowDate:v.macroRange[0],startMacroHighDate:v.macroRange[1],initialMicroLowDate:W,initialMicroHighDate:me},et.current=u,yt(u),Tt(u)},[Me,Ye,Pe,tt,Be,Xe,ke,Le]),ca=l=>u=>{if(m)return;u.stopPropagation(),u.preventDefault(),j(l);const f=n?u.clientY:u.clientX;Et(u.pointerId,l,f)},rt=l=>u=>{if(m||(u.stopPropagation(),u.preventDefault(),!Se.current))return;const f=Se.current.getBoundingClientRect(),v=n?Math.max(0,Math.min(1,(f.bottom-u.clientY)/(f.height>0?f.height:100))):Math.max(0,Math.min(1,(u.clientX-f.left)/(f.width>0?f.width:100)));sa(u.pointerId,l,v)},$a=l=>{if(m||x)return;l.stopPropagation(),l.preventDefault();const u=n?l.clientY:l.clientX;Et(l.pointerId,"connect",u)},Aa=l=>{if(m)return;if(i){if(!Se.current)return;const C=Se.current.getBoundingClientRect(),Z=n?Math.max(0,Math.min(1,(C.bottom-l.clientY)/(C.height>0?C.height:100))):Math.max(0,Math.min(1,(l.clientX-C.left)/(C.width>0?C.width:100))),S=n?l.clientX-(C.left+C.width/2):l.clientY-(C.top+C.height/2),fe=Ca(Z,S,Me,Ye,Pe,tt,F);sa(l.pointerId,fe,Z);return}const u=Rt(l.clientX,l.clientY),f=Nt(u);let v="low";if(!p){const C=Math.abs(f-ee),Z=Math.abs(f-ie);C<Z?v="low":Z<C?v="high":v=f>ie?"high":"low"}j(v);const[R,K]=Xt(v,f,ee,ie,y,w,p);Ce([R,K]),Ve(R,K,!0);const ae=n?l.clientY:l.clientX;Et(l.pointerId,v,ae)},ja=l=>{if(m||he!==null)return;const u=Rt(l.clientX,l.clientY),f=Nt(u);te(f),re(Ct(f))},Fa=()=>{te(null),re(null)},ua=l=>u=>{if(m)return;j(l);const f=ya(u.key,l,ee,ie,y,w,p,1);f&&(u.preventDefault(),se||be(f),Ve(f[0],f[1],!0))},Lt=l=>u=>{if(m||!i||e.mode!=="vernier")return;Tt(l);let f=0,v=!1,R=!1;switch(u.key){case"ArrowRight":case"ArrowUp":f=1;break;case"ArrowLeft":case"ArrowDown":f=-1;break;case"PageUp":f=5;break;case"PageDown":f=-5;break;case"Home":v=!0;break;case"End":R=!0;break;default:return}u.preventDefault();const K=(C,Z)=>{e.onChangeMacroRange?.(C,Z),e.onChangeMacroRangeTuple?.([C,Z]),e.onChangeMacro?.([C,Z])},ae=(C,Z)=>{e.onChangeRange?.(C,Z),e.onChangeRangeTuple?.([C,Z]),e.onChangeMicroRange?.(C,Z),e.onChangeMicroRangeTuple?.([C,Z]),e.onChangeMicro?.([C,Z])};if(l==="macro-low"){let C;v?C=ve:R?C=Xe:C=Math.max(ve,Math.min(Xe,Be+f)),K(de(O,C),de(O,Xe))}else if(l==="macro-high"){let C;v?C=Be:R?C=nt:C=Math.max(Be,Math.min(nt,Xe+f)),K(de(O,Be),de(O,C))}else if(l==="micro-low"){let C;v?C=ge:R?C=Le:C=Math.max(ge,Math.min(Le,ke+f)),ae(de(P,C),de(P,Le))}else if(l==="micro-high"){let C;v?C=ke:R?C=Ke:C=Math.max(ke,Math.min(Ke,Le+f)),ae(de(P,ke),de(P,C))}},da=r.useCallback(l=>{const u=z.current;if(!u.disabled)if(u.mode==="point"){const f=Math.max(y,Math.min(w,ee+l));se||be([f,f]),Ve(f,f,!0)}else if(u.mode==="vernier"){const f=ke,v=Le,R=ge,K=Ke,ae=v-f;let C=f+l,Z=v+l;if(l<0&&C<R?(C=R,Z=Math.min(K,C+ae)):l>0&&Z>K&&(Z=K,C=Math.max(R,Z-ae)),C!==f||Z!==v){const S=de(P,C),fe=de(P,Z);u.onChangeRange?.(S,fe),u.onChangeRangeTuple?.([S,fe])}}else{const f=ie-ee;let v=ee+l,R=ie+l;l<0&&v<y?(v=y,R=Math.min(w,v+f)):l>0&&R>w&&(R=w,v=Math.max(y,R-f)),v<=R&&(se||be([v,R]),Ve(v,R,!0))}},[ee,ie,y,w,se,Ve,ke,Le,ge,Ke,P]),ot=Ct(ee),it=Ct(ie),Vt=ne(ee),It=ne(ie),pe=r.useMemo(()=>{const l=T==="top"?-18:18;return p||!$||n?{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:l,highOffsetY:l,isSlanted:!1,proximity:0}:Ta(ot,it,ta,T,t)},[p,$,n,ot,it,ta,T,t]),Yt=he==="low"||he!=="high"&&k==="low",St=!p&&(he==="high"||he!=="low"&&k==="high"),Ha=r.useMemo(()=>n?{"--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% + ${pe.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${pe.lowOffsetY}px)`,"--ps-tooltip-rot":`${pe.lowAngleDeg}deg`},[n,pe.lowOffsetX,pe.lowOffsetY,pe.lowAngleDeg]),Pa=r.useMemo(()=>n?{"--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% + ${pe.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${pe.highOffsetY}px)`,"--ps-tooltip-rot":`${pe.highAngleDeg}deg`},[n,pe.highOffsetX,pe.highOffsetY,pe.highAngleDeg]),$t=Math.min(ot,it),ma=Math.max(ot,it),Ea=n?{bottom:`${$t}%`,height:`${ma-$t}%`,top:"auto",left:"0",right:"0"}:{left:`${$t}%`,width:`${ma-$t}%`,top:"0",bottom:"0"},Va=Math.max(.01,Ye-Me),ga=Math.max(.06,Math.min(.25,.28*Math.sqrt(Va))),Ia=n?{bottom:`${ot}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:Yt?40:30}:{left:`${ot}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:Yt?40:30},Oa=n?{bottom:`${it}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:St?40:30}:{left:`${it}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:St?40:30},Ua=n?{bottom:`${L}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${L}%`,top:"50%",transform:"translate(-50%, -50%)"},fa=q!==null?ne(q):null,ha=m||(i?ke<=ge:p?ee<=y:ee<=y&&ie<=y),ba=m||(i?Le>=Ke:(p||ee>=w)&&ie>=w),_e=m?"cursor-not-allowed opacity-50":"cursor-pointer";return h.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${n?"flex-col":"flex-row"} ${M}`,"data-disabled":m?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":n?"vertical":"horizontal","data-label-position":T,"data-color-scheme":U,children:[d&&h.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-10px] after:content-[''] ${n?"period-slider-stepper-next period-slider-stepper-up":"period-slider-stepper-prev"} 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 ${_e}`,onClick:()=>da(n?1:-1),disabled:n?ba:ha,"aria-label":n?"1つ後へ":"1つ前へ",children:n?"▲":"◀"}),h.jsx("div",{ref:Se,"data-testid":"period-slider-track","data-orientation":n?"vertical":"horizontal","data-vernier-orientation":i?F:void 0,className:`period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${n?"h-48 w-2":"h-2 w-full"} ${_e}`,onPointerDown:Aa,onPointerMove:ja,onPointerLeave:Fa,children:i?h.jsxs(h.Fragment,{children:[we&&(n?h.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:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:A,x1:"0",y1:"0",x2:"1",y2:"0",children:[h.jsx("stop",{offset:"0%",stopColor:D?H.macro:H.micro,stopOpacity:"0.28"}),h.jsx("stop",{offset:"100%",stopColor:D?H.micro:H.macro,stopOpacity:ga})]})}),h.jsx("polygon",{points:D?`12,${(1-Ye)*100} 12,${(1-Me)*100} 20,100 20,0`:`12,0 12,100 20,${(1-Me)*100} 20,${(1-Ye)*100}`,fill:`url(#${A})`})]}):h.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:A,x1:"0",y1:"0",x2:"0",y2:"1",children:[h.jsx("stop",{offset:"0%",stopColor:D?H.macro:H.micro,stopOpacity:"0.28"}),h.jsx("stop",{offset:"100%",stopColor:D?H.micro:H.macro,stopOpacity:ga})]})}),h.jsx("polygon",{points:D?`${Me*100},12 ${Ye*100},12 100,20 0,20`:`0,12 100,12 ${Ye*100},20 ${Me*100},20`,fill:`url(#${A})`})]})),h.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:n?{bottom:`calc(${Me*100}% - 8px)`,height:`calc(${Math.max(0,(Ye-Me)*100)}% + 16px)`}:{left:`calc(${Me*100}% - 8px)`,width:`calc(${Math.max(0,(Ye-Me)*100)}% + 16px)`},onPointerDown:rt("macro-connect")}),h.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:n?{bottom:`calc(${Pe*100}% - 8px)`,height:`calc(${Math.max(0,(tt-Pe)*100)}% + 16px)`}:{left:`calc(${Pe*100}% - 8px)`,width:`calc(${Math.max(0,(tt-Pe)*100)}% + 16px)`},onPointerDown:rt("micro-connect")}),Ne&&h.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(l=>h.jsx("div",{className:"period-slider-tick period-slider-tick-macro",style:n?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`macro-tick-${l}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(l=>h.jsx("div",{className:"period-slider-tick period-slider-tick-micro",style:n?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`micro-tick-${l}`))]}),h.jsxs("div",{tabIndex:m?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"マクロ開始時期","aria-disabled":m?"true":void 0,"aria-valuemin":ve,"aria-valuemax":Xe,"aria-valuenow":Be,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(e.macroRange[0],O):at(O,e.macroRange[0],vt),"aria-orientation":n?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${n?"is-vertical":""} group absolute touch-none ${n?D?"after:absolute after:-inset-y-3 after:right-0 after:-left-3":"after:absolute after:-inset-y-3 after:-right-3 after:left-0":D?"after:absolute after:-inset-x-3 after:-top-3 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-3"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${_e}`,style:n?{bottom:`${Me*100}%`,left:D?0:"auto",right:D?"auto":0,transform:D?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:De==="macro-low"||Re==="macro-low"?30:15}:{left:`${Me*100}%`,top:D?0:"auto",bottom:D?"auto":0,transform:D?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:De==="macro-low"||Re==="macro-low"?30:15},onPointerDown:rt("macro-low"),onKeyDown:Lt("macro-low"),"data-active":De==="macro-low"?"true":void 0,"data-front":Re==="macro-low"?"true":void 0,"data-vernier-pos":n?D?"left":"right":D?"top":"bottom","data-handle-type":"macro-low",children:[h.jsx(Dt,{type:"macro",isTop:D,isVertical:n,isLeft:D}),Fe&&h.jsx("div",{className:"period-slider-hairline"}),h.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:Qe(O,e.macroRange[0],vt)})]}),h.jsxs("div",{tabIndex:m?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"マクロ終了時期","aria-disabled":m?"true":void 0,"aria-valuemin":Be,"aria-valuemax":nt,"aria-valuenow":Xe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(e.macroRange[1],O):at(O,e.macroRange[1],vt),"aria-orientation":n?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${n?"is-vertical":""} group absolute touch-none ${n?D?"after:absolute after:-inset-y-3 after:right-0 after:-left-3":"after:absolute after:-inset-y-3 after:-right-3 after:left-0":D?"after:absolute after:-inset-x-3 after:-top-3 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-3"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${_e}`,style:n?{bottom:`${Ye*100}%`,left:D?0:"auto",right:D?"auto":0,transform:D?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:De==="macro-high"||Re==="macro-high"?30:15}:{left:`${Ye*100}%`,top:D?0:"auto",bottom:D?"auto":0,transform:D?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:De==="macro-high"||Re==="macro-high"?30:15},onPointerDown:rt("macro-high"),onKeyDown:Lt("macro-high"),"data-active":De==="macro-high"?"true":void 0,"data-front":Re==="macro-high"?"true":void 0,"data-vernier-pos":n?D?"left":"right":D?"top":"bottom","data-handle-type":"macro-high",children:[h.jsx(Dt,{type:"macro",isTop:D,isVertical:n,isLeft:D}),Fe&&h.jsx("div",{className:"period-slider-hairline"}),h.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:Qe(O,e.macroRange[1],vt)})]}),h.jsxs("div",{tabIndex:m?-1:0,role:"slider","aria-label":e.lowerAriaLabel??"ミクロ開始時期","aria-disabled":m?"true":void 0,"aria-valuemin":ge,"aria-valuemax":Le,"aria-valuenow":ke,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(W,P):at(P,W,pt),"aria-orientation":n?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${n?"is-vertical":""} group absolute touch-none ${n?D?"after:absolute after:-inset-y-3 after:-right-3 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-3":D?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-3":"after:absolute after:-inset-x-3 after:-top-3 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${_e}`,style:n?{bottom:`${Pe*100}%`,left:D?"auto":0,right:D?0:"auto",transform:D?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:De==="micro-low"||Re==="micro-low"?30:20}:{left:`${Pe*100}%`,top:D?"auto":0,bottom:D?0:"auto",transform:D?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:De==="micro-low"||Re==="micro-low"?30:20},onPointerDown:rt("micro-low"),onKeyDown:Lt("micro-low"),"data-active":De==="micro-low"?"true":void 0,"data-front":Re==="micro-low"?"true":void 0,"data-vernier-pos":n?D?"right":"left":D?"bottom":"top","data-handle-type":"micro-low",children:[h.jsx(Dt,{type:"micro",isTop:!D,isVertical:n,isLeft:!D}),Fe&&h.jsx("div",{className:"period-slider-hairline"}),h.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:Qe(P,W,pt)})]}),h.jsxs("div",{tabIndex:m?-1:0,role:"slider","aria-label":e.upperAriaLabel??"ミクロ終了時期","aria-disabled":m?"true":void 0,"aria-valuemin":ke,"aria-valuemax":Ke,"aria-valuenow":Le,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(me,P):at(P,me,pt),"aria-orientation":n?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${n?"is-vertical":""} group absolute touch-none ${n?D?"after:absolute after:-inset-y-3 after:-right-3 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-3":D?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-3":"after:absolute after:-inset-x-3 after:-top-3 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${_e}`,style:n?{bottom:`${tt*100}%`,left:D?"auto":0,right:D?0:"auto",transform:D?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:De==="micro-high"||Re==="micro-high"?30:20}:{left:`${tt*100}%`,top:D?"auto":0,bottom:D?0:"auto",transform:D?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:De==="micro-high"||Re==="micro-high"?30:20},onPointerDown:rt("micro-high"),onKeyDown:Lt("micro-high"),"data-active":De==="micro-high"?"true":void 0,"data-front":Re==="micro-high"?"true":void 0,"data-vernier-pos":n?D?"right":"left":D?"bottom":"top","data-handle-type":"micro-high",children:[h.jsx(Dt,{type:"micro",isTop:!D,isVertical:n,isLeft:!D}),Fe&&h.jsx("div",{className:"period-slider-hairline"}),h.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:Qe(P,me,pt)})]})]}):h.jsxs(h.Fragment,{children:[!x&&h.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full bg-blue-500 hover:bg-blue-600 dark:bg-blue-400",style:Ea,onPointerDown:$a}),G&&E&&b.length>1&&h.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:b.map(l=>{const u=J(t,l),f=b.findIndex(K=>J(t,K)===u),v=Ct(f),R=n?{bottom:`${v}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${v}%`,top:"50%",transform:"translate(-50%, -50%)"};return h.jsx("div",{className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full bg-slate-400/60 dark:bg-slate-500/60",style:R},`tick-${u}`)})}),!m&&q!==null&&L!==null&&he===null&&fa&&h.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute z-20 h-2 w-2",style:Ua,children:[h.jsx("div",{className:"period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-sky-400/80 shadow-[0_0_6px_#38bdf8] dark:border-slate-800 dark:bg-sky-300/80"}),h.jsx("div",{className:`period-slider-hover-tooltip ${T==="bottom"&&!n?"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:Qe(t,fa,e.formatLabel)})]}),h.jsxs("div",{tabIndex:m?-1:0,role:"slider","aria-label":p?e.pointAriaLabel??"選択時期":e.lowerAriaLabel??"開始時期","aria-disabled":m?"true":void 0,"aria-valuemin":y,"aria-valuemax":p?w:ie,"aria-valuenow":ee,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Vt,t):at(t,Vt,e.formatLabel),"aria-orientation":n?"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 ${_e}`,style:Ia,onPointerDown:ca("low"),onKeyDown:ua("low"),"data-active":he==="low"?"true":void 0,"data-front":Yt?"true":void 0,children:[h.jsx("div",{className:"period-slider-knob h-full w-full rounded-full border-2 border-white bg-blue-600 shadow-md group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-blue-400"}),g!=="hover"&&h.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":T,"data-slanted":pe.isSlanted?"true":void 0,"data-front":Yt?"true":void 0,style:Ha,children:Qe(t,Vt,e.formatLabel)})]}),!p&&h.jsxs("div",{tabIndex:m?-1:0,role:"slider","aria-label":e.upperAriaLabel??"終了時期","aria-disabled":m?"true":void 0,"aria-valuemin":ee,"aria-valuemax":w,"aria-valuenow":ie,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(It,t):at(t,It,e.formatLabel),"aria-orientation":n?"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 ${_e}`,style:Oa,onPointerDown:ca("high"),onKeyDown:ua("high"),"data-active":he==="high"?"true":void 0,"data-front":St?"true":void 0,children:[h.jsx("div",{className:"period-slider-knob h-full w-full rounded-full border-2 border-white bg-blue-600 shadow-md group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-blue-400"}),g!=="hover"&&h.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":T,"data-slanted":pe.isSlanted?"true":void 0,"data-front":St?"true":void 0,style:Pa,children:Qe(t,It,e.formatLabel)})]})]})}),d&&h.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-10px] after:content-[''] ${n?"period-slider-stepper-prev period-slider-stepper-down":"period-slider-stepper-next"} 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 ${_e}`,onClick:()=>da(n?-1:1),disabled:n?ha:ba,"aria-label":n?"1つ前へ":"1つ後へ",children:n?"▼":"▶"})]})},Ut=(e,t)=>{if(e===t)return!0;if(!(e&&t)||e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a].getTime()!==t[a].getTime())return!1;return!0},qa=(e,t)=>{if(e===t)return!0;if(!(e&&t))return!1;const a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(const s of a)if(e[s]!==t[s])return!1;return!0},Za=(e,t)=>{if(e===t)return!0;if(e.mode!==t.mode||e.unit!==t.unit||(e.minDate?.getTime()??null)!==(t.minDate?.getTime()??null)||(e.maxDate?.getTime()??null)!==(t.maxDate?.getTime()??null)||e.labelPosition!==t.labelPosition||e.autoSlantLabels!==t.autoSlantLabels||e.preventCollisionSlant!==t.preventCollisionSlant||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||!qa(e.style,t.style)||e.snapMode!==t.snapMode||e.formatLabel!==t.formatLabel||e.lowerAriaLabel!==t.lowerAriaLabel||e.upperAriaLabel!==t.upperAriaLabel||e.pointAriaLabel!==t.pointAriaLabel||e.macroLowerAriaLabel!==t.macroLowerAriaLabel||e.macroUpperAriaLabel!==t.macroUpperAriaLabel||e.formatAriaValueText!==t.formatAriaValueText||!Ut(e.allowedDates,t.allowedDates))return!1;if(e.mode==="point"&&t.mode==="point"){const a=e.value?.getTime()??e.valueDate?.getTime()??null,o=t.value?.getTime()??t.valueDate?.getTime()??null;return!(a!==o||e.onChangePoint!==t.onChangePoint||e.onChangeValue!==t.onChangeValue||e.onChange!==t.onChange)}if(e.mode==="range"&&t.mode==="range"){const a=e.range?.[0]?.getTime()??e.lowerDate?.getTime()??null,o=e.range?.[1]?.getTime()??e.upperDate?.getTime()??null,s=t.range?.[0]?.getTime()??t.lowerDate?.getTime()??null,c=t.range?.[1]?.getTime()??t.upperDate?.getTime()??null;return!(a!==s||o!==c||e.onChangeRange!==t.onChangeRange||e.onChangeRangeTuple!==t.onChangeRangeTuple||e.onChange!==t.onChange)}if(e.mode==="vernier"&&t.mode==="vernier"){const a=e.microRange?.[0]?.getTime()??e.lowerDate?.getTime()??null,o=e.microRange?.[1]?.getTime()??e.upperDate?.getTime()??null,s=t.microRange?.[0]?.getTime()??t.lowerDate?.getTime()??null,c=t.microRange?.[1]?.getTime()??t.upperDate?.getTime()??null;if(a!==s||o!==c)return!1;const m=e.macroRange?.[0]?.getTime()??null,M=e.macroRange?.[1]?.getTime()??null,d=t.macroRange?.[0]?.getTime()??null,g=t.macroRange?.[1]?.getTime()??null;return!(m!==d||M!==g||e.vernierOrientation!==t.vernierOrientation||e.showVernierProjection!==t.showVernierProjection||e.showVernierTicks!==t.showVernierTicks||e.showHairline!==t.showHairline||e.adaptiveExpand!==t.adaptiveExpand||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.onChangeRange!==t.onChangeRange||e.onChangeRangeTuple!==t.onChangeRangeTuple||e.onChangeMicroRange!==t.onChangeMicroRange||e.onChangeMicroRangeTuple!==t.onChangeMicroRangeTuple||e.onChangeMicro!==t.onChangeMicro||e.onChangeMacroRange!==t.onChangeMacroRange||e.onChangeMacroRangeTuple!==t.onChangeMacroRangeTuple||e.onChangeMacro!==t.onChangeMacro||!Ut(e.macroAllowedDates,t.macroAllowedDates)||!Ut(e.microAllowedDates,t.microAllowedDates))}return!1},Ra=r.memo(Wa,Za);Ra.displayName="PeriodSlider";function Kt(e,t,a){return t&&e<t?t:a&&e>a?a:e}function Ja(e){const{unit:t,initialRange:a,defaultRange:o,minDate:s,maxDate:c,onChangeRange:m,onChangeRangeTuple:M,onChange:d,...g}=e,T=a??o??[s??new Date,c??new Date],$=r.useRef(T),[n,x]=r.useState(T),G=r.useRef(n);G.current=n;const U=r.useRef(m);U.current=m;const H=r.useRef(M);H.current=M;const A=r.useRef(d);A.current=d;const z=r.useCallback(N=>{let Y=G.current[1];N.getTime()>Y.getTime()&&(Y=N);const X=[N,Y];x(X),U.current?.(X[0],X[1]),H.current?.(X),A.current?.(X)},[]),V=r.useCallback(N=>{let Y=G.current[0];N.getTime()<Y.getTime()&&(Y=N);const X=[Y,N];x(X),U.current?.(X[0],X[1]),H.current?.(X),A.current?.(X)},[]),I=r.useCallback((N,_)=>{const Y=[N,_];x(Y),U.current?.(N,_),H.current?.(Y),A.current?.(Y)},[]),b=r.useCallback(N=>{x(N),U.current?.(N[0],N[1]),H.current?.(N),A.current?.(N)},[]),E=r.useCallback(N=>{const _=G.current,Y=xe(t,_[0],N),X=xe(t,_[1],N),W=Kt(Y,s,c),me=Kt(X,s,c),ce=[W,me];x(ce),U.current?.(ce[0],ce[1]),H.current?.(ce),A.current?.(ce)},[t,s,c]),y=r.useCallback(()=>{const N=$.current;x(N),U.current?.(N[0],N[1]),H.current?.(N),A.current?.(N)},[]),w=r.useMemo(()=>({value:n[0],onChange:z,minDate:s,maxDate:n[1],unit:t}),[n[0],n[1],z,s,t]),p=r.useMemo(()=>({value:n[1],onChange:V,minDate:n[0],maxDate:c,unit:t}),[n[0],n[1],V,c,t]),ne=r.useMemo(()=>({...g,mode:"range",unit:t,range:n,minDate:s,maxDate:c,onChangeRange:I,onChangeRangeTuple:b,onChange:b}),[g,t,n,s,c,I,b]);return{range:n,lowerDate:n[0],upperDate:n[1],setRange:x,setLowerDate:z,setUpperDate:V,shiftRange:E,resetRange:y,startSelectorProps:w,endSelectorProps:p,sliderProps:ne}}function Qa(e){const{unit:t,initialValue:a,initialDate:o,defaultValue:s,minDate:c,maxDate:m,onChangePoint:M,onChangeValue:d,onChange:g,...T}=e,$=a??o??s??c??new Date,n=r.useRef($),[x,G]=r.useState($),U=r.useRef(x);U.current=x;const H=r.useRef(M);H.current=M;const A=r.useRef(d);A.current=d;const z=r.useRef(g);z.current=g;const V=r.useCallback(w=>{G(w),H.current?.(w),A.current?.(w),z.current?.(w)},[]),I=r.useCallback(w=>{const p=U.current,ne=xe(t,p,w),N=Kt(ne,c,m);G(N),H.current?.(N),A.current?.(N),z.current?.(N)},[t,c,m]),b=r.useCallback(()=>{const w=n.current;G(w),H.current?.(w),A.current?.(w),z.current?.(w)},[]),E=r.useMemo(()=>({value:x,onChange:V,minDate:c,maxDate:m,unit:t}),[x,V,c,m,t]),y=r.useMemo(()=>({...T,mode:"point",unit:t,value:x,minDate:c,maxDate:m,onChangePoint:V,onChangeValue:V,onChange:V}),[T,t,x,c,m,V]);return{value:x,setValue:G,shiftValue:I,resetValue:b,selectorProps:E,sliderProps:y}}function en(e){const{minDate:t,maxDate:a,initialMacroRange:o,defaultMacroRange:s,initialMicroRange:c,defaultMicroRange:m,unit:M="month",macroUnit:d=M,microUnit:g=M,onChangeMacroRange:T,onChangeMacroRangeTuple:$,onChangeMacro:n,onChangeRange:x,onChangeRangeTuple:G,onChangeMicroRange:U,onChangeMicroRangeTuple:H,onChangeMicro:A,...z}=e,V=o??s??[t,a],I=c??m??V,b=r.useRef(V),E=r.useRef(I),[y,w]=r.useState(V),[p,ne]=r.useState(I),N=r.useRef(y);N.current=y;const _=r.useRef(p);_.current=p;const Y=r.useCallback((k,j)=>{w([k,j]),T?.(k,j),$?.([k,j]),n?.([k,j])},[T,$,n]),X=r.useCallback(k=>{Y(k[0],k[1])},[Y]),W=r.useCallback((k,j)=>{ne([k,j]),x?.(k,j),G?.([k,j]),U?.(k,j),H?.([k,j]),A?.([k,j])},[x,G,U,H,A]),me=r.useCallback(k=>{W(k[0],k[1])},[W]),ce=r.useCallback(k=>{const j=N.current[1],q=k<t?t:k,te=k>j?k:j;Y(q,te)},[t,Y]),oe=r.useCallback(k=>{const j=N.current[0],q=k>a?a:k,te=k<j?k:j;Y(te,q)},[a,Y]),Q=r.useCallback(k=>{const j=N.current,q=_.current,te=k<j[0]?j[0]:k,L=k>q[1]?k:q[1];W(te,L)},[W]),B=r.useCallback(k=>{const j=N.current,q=_.current,te=k>j[1]?j[1]:k,L=k<q[0]?k:q[0];W(L,te)},[W]),se=r.useCallback(k=>{const j=N.current,q=xe(d,j[0],k),te=xe(d,j[1],k);q<t||te>a||Y(q,te)},[d,t,a,Y]),He=r.useCallback(k=>{const j=N.current,q=_.current,te=xe(g,q[0],k),L=xe(g,q[1],k);te<j[0]||L>j[1]||W(te,L)},[g,W]),be=r.useCallback(()=>{const[k,j]=b.current,[q,te]=E.current;Y(k,j),W(q,te)},[Y,W]),Te=r.useMemo(()=>({value:y[0],onChange:ce,minDate:t,maxDate:y[1],unit:d}),[y,ce,t,d]),Ce=r.useMemo(()=>({value:y[1],onChange:oe,minDate:y[0],maxDate:a,unit:d}),[y,oe,a,d]),he=r.useMemo(()=>({value:p[0],onChange:Q,minDate:y[0],maxDate:p[1],unit:g}),[p,Q,y,g]),ze=r.useMemo(()=>({value:p[1],onChange:B,minDate:p[0],maxDate:y[1],unit:g}),[p,B,y,g]),je=r.useMemo(()=>({...z,mode:"vernier",unit:M,macroUnit:d,microUnit:g,minDate:t,maxDate:a,macroRange:y,microRange:p,onChangeMacroRange:Y,onChangeMacroRangeTuple:X,onChangeMacro:X,onChangeRange:W,onChangeRangeTuple:me,onChangeMicroRange:W,onChangeMicroRangeTuple:me,onChangeMicro:me}),[z,M,d,g,t,a,y,p,Y,X,W,me]);return{macroRange:y,setMacroRange:w,microRange:p,setMicroRange:ne,setMacroLowerDate:ce,setMacroUpperDate:oe,setMicroLowerDate:Q,setMicroUpperDate:B,shiftMacroRange:se,shiftMicroRange:He,resetVernier:be,macroStartSelectorProps:Te,macroEndSelectorProps:Ce,microStartSelectorProps:he,microEndSelectorProps:ze,sliderProps:je}}const tn=e=>{const{value:t,initialDate:a,onChange:o,children:s,minYear:c,maxYear:m,minDate:M,maxDate:d,className:g="",style:T,disabled:$=!1,prevYearAriaLabel:n="前年",nextYearAriaLabel:x="翌年",selectAriaLabel:G="会計年"}=e,U=t??a,[H,A]=r.useState(()=>(U??new Date).getFullYear()),z=M?.getTime(),V=d?.getTime(),I=r.useMemo(()=>{if(c!==void 0)return c;if(M)return M.getFullYear()},[c,z]),b=r.useMemo(()=>{if(m!==void 0)return m;if(d)return d.getFullYear()},[m,V]),E=t!==void 0,y=E?t&&!Number.isNaN(t.getTime())?t.getFullYear():I??new Date().getFullYear():H,w=U?.getTime();r.useEffect(()=>{!E&&U&&!Number.isNaN(U.getTime())&&A(U.getFullYear())},[E,w]);const p=oe=>{if($)return;let Q=oe;I!==void 0&&Q<I&&(Q=I),b!==void 0&&Q>b&&(Q=b),E||A(Q);const B=new Date(Q,0,1);B.setFullYear(Q),o?.(B,Q)},ne=$||I!==void 0&&y-1<I,N=$||b!==void 0&&y+1>b,_=I??Math.min(y-10,y),Y=b??Math.max(y+1,y),X=Math.min(_,y),W=Math.max(Y,y),me=`${X}_${W}`,ce=r.useMemo(()=>{const oe=[];for(let Q=W;Q>=X;Q--)oe.push(Q);return oe},[me]);return h.jsxs("div",{className:`inline-flex w-32 items-center ${g}`,style:T,children:[h.jsx("button",{type:"button","aria-label":n,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:()=>p(y-1),children:h.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"})}),h.jsx("select",{"aria-label":G,disabled:$,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:y,onChange:oe=>{oe.target.value&&p(Number(oe.target.value))},children:ce.map(oe=>h.jsx("option",{value:oe,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:oe},oe))}),h.jsx("button",{type:"button","aria-label":x,disabled:N,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:()=>p(y+1),children:h.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"})}),s]})},ka=r.memo(tn,(e,t)=>{const a=e.value??e.initialDate,o=t.value??t.initialDate,s=a&&!Number.isNaN(a.getTime())?a.getFullYear():null,c=o&&!Number.isNaN(o.getTime())?o.getFullYear():null;return!(s!==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)});ka.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=zt;exports.DateSelector=Da;exports.MonthSelector=va;exports.PeriodSlider=Ra;exports.YearSelector=ka;exports.addUnit=xe;exports.calculateConnectDragValues=pa;exports.calculateHandleDragValues=Xt;exports.calculateKeyboardActionValues=ya;exports.calculateLabelSlant=Ta;exports.calculateVernierMacroDrag=Na;exports.decode=de;exports.encode=J;exports.findNearestDateIndex=Bt;exports.formatLabel=Qe;exports.formatScreenReaderLabel=at;exports.getMacroWindowEndDate=jt;exports.getSortedAllowedDates=Ft;exports.normalizeDateByUnit=le;exports.resolveVernierTargetHandle=Ca;exports.usePeriodSliderPoint=Qa;exports.usePeriodSliderRange=Ja;exports.useVernierSlider=en;