@aiquants/period-slider 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -24
- package/dist/MonthSelector.d.ts +7 -4
- package/dist/MonthSelector.d.ts.map +1 -1
- package/dist/PeriodSlider.d.ts +66 -16
- package/dist/PeriodSlider.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1558 -1356
- package/dist/usePeriodSlider.d.ts +87 -3
- package/dist/usePeriodSlider.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/MonthSelector.tsx +133 -61
- package/src/PeriodSlider.tsx +384 -157
- package/src/index.ts +7 -0
- package/src/usePeriodSlider.ts +329 -4
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),Le=require("date-fns"),o=require("react"),On={"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"}},it=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(!it(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=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},Ie=(e,t,r)=>{if(!it(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${he(t)})`);return e==="year"?Le.addYears(t,r):e==="month"?Le.addMonths(t,r):Le.addDays(t,r)},ot=(e,t,r)=>{if(!it(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)},ka={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},kn=new Map,Pa=(e,t)=>{const r=`${e}\0${t}`,n=kn.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,ka[e]);return kn.set(r,a),a},Ca=(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}`},Oe=(e,t,r,n)=>it(t)?r?r(t):n===void 0?Ca(e,t):Pa(e,n).format(t):"",vt=(e,t,r,n)=>Oe(e,t,r,n),De=(e,t,r)=>{if(!e||e.length===0||e.length===1)return 0;const n=q(r,t);let a=0,s=e.length-1;if(n<=q(r,e[a]))return 0;if(n>=q(r,e[s]))return s;for(;a<=s;){const b=a+s>>1,f=q(r,e[b]);if(f===n)return b;f<n?a=b+1:s=b-1}const i=Math.abs(q(r,e[a])-n),u=Math.abs(q(r,e[s])-n);return i<u?a:s},Vt=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const a=q(t,r),s=q(t,n),i=new Map;for(const u of e){const b=qe(t,u),f=q(t,b);f<a||f>s||i.has(f)||i.set(f,b)}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((u,b)=>u-b).map(u=>i.get(u))},yr=(e,t,r,n)=>{const a=e.length-1;if(a<=0)return 0;const s=De(e,n,t);if(r==="time"){const i=e[0].getTime(),u=e[a].getTime()-i;return u<=0?0:Math.max(0,Math.min(1,(e[s].getTime()-i)/u))}return s/a},Tr=(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(),u=e[a].getTime()-i;return u<=0?0:De(e,new Date(i+s*u),t)}return Math.max(0,Math.min(a,Math.round(s*a)))},qr=(e,t,r,n,a,s,i)=>{let u=r,b=n;return i?(u=t,b=t):e==="low"?t>n?(u=n,b=t):u=t:t<r?(b=r,u=t):b=t,[Math.max(a,Math.min(s,u)),Math.max(a,Math.min(s,b))]},Fn=(e,t,r,n,a)=>a?"low":e==="low"?t>n?"high":"low":t<r?"low":"high",Vn=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:a,isDiscrete:s,sortedAllowedDates:i,snapMode:u,unit:b})=>{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(u==="time"){const Y=i[0].getTime(),U=i[V].getTime(),L=i[ee].getTime(),_=i[p].getTime()-L;let H=L+e*(U-Y),w=H+_;H<Y&&(H=Y,w=Y+_),w>U&&(w=U,H=U-_);const $=De(i,new Date(H),b),N=De(i,new Date(w),b);return[$,Math.max($,N)]}const J=Math.round(e*V);let I=ee+J,te=p+J;return I<0&&(te+=-I,I=0),te>V&&(I-=te-V,te=V),[Math.max(0,Math.min(V,I)),Math.max(0,Math.min(V,te))]}const f=V=>Math.max(n,Math.min(a,V)),P=a-n;if(P<=0)return[f(t),f(r)];const y=Math.round(e*P);let d=t+y,v=r+y;return d<n&&(v+=n-d,d=n),v>a&&(d-=v-a,v=a),[f(d),f(v)]},Un=(e,t,r,n,a,s,i,u)=>{let b=0,f=!1,P=!1;switch(e){case"ArrowRight":case"ArrowUp":b=u;break;case"ArrowLeft":case"ArrowDown":b=-u;break;case"PageUp":b=u*5;break;case"PageDown":b=-u*5;break;case"Home":f=!0;break;case"End":P=!0;break;default:return null}if(i){let v=r;return f?v=a:P?v=s:v=Math.max(a,Math.min(s,r+b)),[v,v]}let y=r,d=n;return t==="low"?f?y=a:P?y=n:y=Math.max(a,Math.min(n,r+b)):f?d=r:P?d=s:d=Math.max(r,Math.min(s,n+b)),[y,d]},Bn=8,zn=2,_n=16,Na=12,Ya=90,Zr=(e,t)=>{const r=t?.estimatedHeightPx??_n,a=Bn+(t?.anchorGapY??zn)+r/2,s=e==="top"?-a:a;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:s,highOffsetY:s,isSlanted:!1,proximity:0}},Qr=(e,t,r,n="top",a)=>{const s=a?.estimatedWidthPx,i=a?.estimatedHeightPx??_n,u=a?.paddingPx??Na,b=a?.maxAngleDeg??Ya,f=Bn+(a?.anchorGapY??zn),P=Zr(n,a);if(!(Number.isFinite(r)&&r>0)||s===void 0||!Number.isFinite(s)||s<=0)return P;const y=Math.max(0,t-e)/100*r,d=s+u;if(y>=d)return P;const v=Math.max(0,Math.min(1,(d-y)/d)),ee=v*v*v*(v*(v*6-15)+10)*b,p=n==="top"?-ee:ee,J=ee*Math.PI/180,I=s/2*Math.abs(Math.sin(J))+i/2*Math.abs(Math.cos(J)),te=f+I,Y=n==="top"?-te:+te,U=s*Math.abs(Math.cos(J))+i*Math.abs(Math.sin(J)),L=Math.max(0,(U+u-y)/2);return{lowAngleDeg:p,highAngleDeg:p,lowOffsetX:-L,highOffsetX:L,lowOffsetY:Y,highOffsetY:Y,isSlanted:v>.001,proximity:v}},Xn=e=>({...e,lowOffsetX:0,highOffsetX:0});function qn(e,t,r,n,a,s,i="macro-top",u=.05,b=!0){const f=i==="macro-top"||i==="macro-left",P=t<=0;if(f&&P||!(f||P)){const v=Math.abs(e-r),V=Math.abs(e-n);return v<=u&&v<=V?"macro-low":V<=u&&V<v?"macro-high":b&&e>=r&&e<=n?"macro-connect":v<V?"macro-low":"macro-high"}const y=Math.abs(e-a),d=Math.abs(e-s);return y<=u&&y<=d?"micro-low":d<=u&&d<y?"micro-high":b&&e>=a&&e<=s?"micro-connect":y<d?"micro-low":"micro-high"}function Kn(e,t,r,n,a){if(e==="macro-connect"){const i=t-r,u=a-n,b=Math.max(0,Math.min(1-u,n+i)),f=b+u;return[b,f,"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 Wn(e,t,r,n,a){if(e==="micro-connect"){const i=t-r,u=a-n,b=Math.max(0,Math.min(1-u,n+i)),f=b+u;return[b,f,"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 er=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 g.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:g.jsx("path",{d:a,className:i,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});er.displayName="VernierKnobSvg";const Aa=(e,t)=>{if(!it(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${he(e)})`);if(!it(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)})`)},kr=(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(!it(r))throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${he(r)})`);if(!it(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)})`)},Ea=(e,t)=>{if(!it(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${he(t)})`)},Ur=(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)})`)},Ia=(e,t,r)=>{if(e.mode==="range"){for(const n of["range","defaultRange"]){const a=e[n];a!==void 0&&(kr(n,a),Ur(`${n}[0]`,a[0],t,r),Ur(`${n}[1]`,a[1],t,r))}return}if(e.mode==="point")for(const n of["value","defaultValue"]){const a=e[n];a!==void 0&&(Ea(n,a),Ur(n,a,t,r))}},Ha=(e,t,r)=>{if(kr("macroRange",e),t!==void 0)return kr("microRange",t),t;if(r!==void 0)return kr("defaultMicroRange",r),r;throw new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)")},Sr=(e,t,r,n,a,s,i,u)=>{const b=De(e,n,t),f=De(e,a,t);return i?b:u?f:Math.max(b,Math.min(f,De(e,r,t)+s))},Br=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},ja=(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)})`)}},Ot=()=>{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 u of i){const b=u.borderBoxSize?.[0];b!==void 0&&t(f=>f!==null&&Math.abs(f.widthPx-b.inlineSize)<.5&&Math.abs(f.heightPx-b.blockSize)<.5?f:{widthPx:b.inlineSize,heightPx:b.blockSize})}});s.observe(a),r.current=s},[]);return o.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},zr=(e,t)=>{if(!(e===null||t===null))return{estimatedWidthPx:Math.max(e.widthPx,t.widthPx),estimatedHeightPx:Math.max(e.heightPx,t.heightPx)}},Pn=(e,t,r)=>({"--ps-tooltip-tx":`calc(-50% + ${e}px)`,"--ps-tooltip-ty":`${t}px`,"--ps-tooltip-rot":`${r}deg`}),Cn=(e,t,r,n,a,s,i)=>{const u=Zr(n,a);if(!i)return{slant:u,lowStyle:void 0,highStyle:void 0};const b=Qr(e*100,t*100,r,n,a),f=s?Xn(b):b;return{slant:f,lowStyle:Pn(f.lowOffsetX,f.lowOffsetY-u.lowOffsetY,f.lowAngleDeg),highStyle:Pn(f.highOffsetX,f.highOffsetY-u.highOffsetY,f.highAngleDeg)}},Oa={horizontal:{decrease:"◀",increase:"▶"},vertical:{decrease:"▼",increase:"▲"}},Fa={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"}},Va=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:a,snapMode:s="index",disabled:i=!1,className:u="",showStepper:b=!0,tooltipStyle:f="always",labelPosition:P="top",autoSlantLabels:y=!0,isVertical:d=!1,hideConnectBar:v=!1,showTicks:V=!1,colorScheme:ee="blue-rose",locale:p,decreaseAriaLabel:J="Decrease",increaseAriaLabel:I="Increase"}=e;Aa(r,n),Ia(e,r,n),p!==void 0&&ja("locale",p);const te=e.mode==="vernier"?Ha(e.macroRange,e.microRange,e.defaultMicroRange):null,Y=On[ee],U=o.useId(),L=o.useRef(e);L.current=e;const _=r.getTime(),H=n.getTime(),w=o.useMemo(()=>Vt(a,t,r,n),[a,t,_,H]),$=w.length>0,{rangeMin:N,rangeMax:O}=o.useMemo(()=>$?{rangeMin:0,rangeMax:w.length-1}:{rangeMin:q(t,r),rangeMax:q(t,n)},[$,w,t,_,H]),k=e.mode==="point",re=o.useCallback(l=>{if($){const c=Math.max(0,Math.min(w.length-1,Math.round(l)));return w[c]}return oe(t,Math.round(l))},[$,w,t]),ye=o.useCallback(l=>{if(l===void 0)return N;const c=qe(t,l);return $?De(w,c,t):q(t,c)},[$,w,t,N]),[Z,ne]=o.useState(()=>te),ie=e.mode!=="vernier"?null:e.microRange!==void 0?e.microRange:Z,me=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,ke=e.mode==="point"?K?.getTime():me?.getTime(),bt=e.mode==="range"?W?.getTime():ke,[He,Re]=o.useMemo(()=>{if(e.mode==="point"){const m=ye(K);return[m,m]}const l=ye(me),c=ye(W);return[Math.min(l,c),Math.max(l,c)]},[e.mode,ke,bt,ye,K,me,W]),fe=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:e.microRange!==void 0,[j,B]=o.useState(()=>[He,Re]),[G,ge]=o.useState(null),[R,xe]=o.useState(null),Fe=o.useRef(null);Fe.current=R;const[Qe,le]=o.useState("high"),[be,et]=o.useState(null),[Ut,nr]=o.useState(null),se=G?G[0]:fe?He:j[0],ce=G?G[1]:fe?Re:j[1],yt=o.useRef([se,ce]);yt.current=[se,ce];const Q=e.mode==="vernier",wt=e.mode==="vernier"?e.vernierOrientation??(d?"macro-left":"macro-top"):"macro-top",D=wt==="macro-top"||wt==="macro-left",ar=e.mode==="vernier"?e.showVernierProjection??!0:!1,or=e.mode==="vernier"?e.showVernierTicks??!0:!1,Tt=e.mode==="vernier"?e.showHairline??!0:!1,A=Q?e.macroUnit??t:t,x=Q?e.microUnit??t:t,Pr=Q?e.macroIsDiscrete??!1:$,St=Q?e.microIsDiscrete??!1:$,ir=Q?e.macroAllowedDates??a:a,Cr=Q?e.microAllowedDates??a:a,h=Q?e.formatMacroLabel??e.formatLabel:e.formatLabel,C=Q?e.formatMicroLabel??e.formatLabel:e.formatLabel,Pe=e.mode==="vernier"?e.macroRange[0].getTime():void 0,Lt=e.mode==="vernier"?e.macroRange[1].getTime():void 0,Mt=me?.getTime(),tt=W?.getTime(),[Ce,lr]=o.useState(null),lt=o.useRef(null);lt.current=Ce;const[Te,Bt]=o.useState("micro-high"),je=o.useMemo(()=>q(A,r),[_,A]),Rt=o.useMemo(()=>{const l=q(A,n);if(Q&&l<=je)throw new RangeError(`PeriodSlider: macroUnit "${A}" cannot distinguish minDate from maxDate (minDate: ${he(r)}, maxDate: ${he(n)})`);return l},[Q,_,H,je,A]),ve=o.useMemo(()=>Q?Vt(ir,A,r,n):[],[Q,ir,A,_,H]),Ne=o.useMemo(()=>e.mode!=="vernier"?je:q(A,e.macroRange[0]),[e.mode,Pe,je,A]),Ye=o.useMemo(()=>e.mode!=="vernier"?Rt:q(A,e.macroRange[1]),[e.mode,Lt,Rt,A]),sr=o.useMemo(()=>oe(A,Ne),[A,Ne]),cr=o.useMemo(()=>oe(A,Ye),[A,Ye]),Se=o.useMemo(()=>e.mode!=="vernier"?q(x,r):Math.max(q(x,e.macroRange[0]),q(x,r)),[e.mode,Pe,x,_]),Be=o.useMemo(()=>e.mode!=="vernier"?q(x,n):Math.min(q(x,ot(A,x,e.macroRange[1])),q(x,n)),[e.mode,Lt,A,x,H]),ae=o.useMemo(()=>Q?Vt(Cr,x,r,n).filter(c=>{const m=q(x,c);return m>=Se&&m<=Be}):[],[Q,Cr,x,_,H,Se,Be]),$t=Pr&&ve.length>0,We=St&&ae.length>0,we=o.useMemo(()=>ie===null?Se:q(x,ie[0]),[Mt,Se,x,ie]),Me=o.useMemo(()=>ie===null?Be:q(x,ie[1]),[tt,Be,x,ie]),st=o.useMemo(()=>oe(x,we),[x,we]),ct=o.useMemo(()=>oe(x,Me),[x,Me]),zt=Math.max(1,Rt-je),pe=$t?yr(ve,A,s,sr):Math.max(0,Math.min(1,(Ne-je)/zt)),Ae=Math.max(pe,$t?yr(ve,A,s,cr):Math.min(1,(Ye-je)/zt)),_t=Math.max(1,Be-Se),Ve=We?yr(ae,x,s,st):Math.max(0,Math.min(1,(we-Se)/_t)),rt=Math.max(Ve,We?yr(ae,x,s,ct):Math.min(1,(Me-Se)/_t)),Nr=o.useRef({timerId:null,emit:null}),Yr=o.useRef({timerId:null,emit:null}),Ar=o.useRef({timerId:null,emit:null});o.useEffect(()=>{const l=[Nr,Yr,Ar];return()=>{for(const c of l)Br(c.current)}},[]);const kt=o.useCallback((l,c,m)=>{Br(l);const{debounceMs:M}=L.current;if(m||!M||M<=0){c();return}l.emit=c,l.timerId=setTimeout(()=>{l.timerId=null,l.emit=null,c()},M)},[]),Er=o.useCallback(l=>{const c=l.emit;Br(l),c?.()},[]),Pt=o.useCallback(l=>new Date(Math.min(Math.max(l.getTime(),_),H)),[_,H]),Ge=o.useCallback((l,c,m=!1)=>{const[M,S]=yt.current;if((L.current.mode==="point"?l===M:l===M&&c===S)&&Nr.current.timerId===null)return;const z=re(l),E=re(c),X=()=>{const T=L.current;T.mode==="point"?T.onChangePoint?.(z):T.mode==="range"&&T.onChangeRange?.(z,E)};kt(Nr.current,X,m)},[re,kt]),Ct=o.useCallback((l,c,m=!1)=>{if(L.current.mode!=="vernier")return;const M=Pt(l),S=Pt(c);kt(Yr.current,()=>{const F=L.current;F.mode==="vernier"&&F.onChangeMacroRange?.(M,S)},m)},[Pt,kt]),ze=o.useCallback((l,c,m=!1)=>{const M=L.current;if(M.mode!=="vernier")return;const S=Pt(l),F=Pt(c);M.microRange===void 0&&ne([S,F]),kt(Ar.current,()=>{const z=L.current;z.mode==="vernier"&&z.onChangeMicroRange?.(S,F)},m)},[Pt,kt]),ur=o.useCallback(l=>{if($&&s==="time"&&w.length>1){const M=Math.max(0,Math.min(w.length-1,Math.round(l))),S=w[0].getTime(),z=w[w.length-1].getTime()-S;if(z<=0)return 0;const E=w[M].getTime();return Math.max(0,Math.min(100,(E-S)/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,w,N,O]),dr=o.useCallback(l=>{const c=Math.max(0,Math.min(100,l));if($){if(s==="time"&&w.length>1){const S=w[0].getTime(),z=w[w.length-1].getTime()-S,E=S+c/100*z;return De(w,new Date(E),t)}const M=Math.round(c/100*(w.length-1));return Math.max(0,Math.min(w.length-1,M))}const m=N+c/100*(O-N);return Math.round(m)},[$,s,w,N,O,t]),nt=o.useRef(null),[Nt,rn]=o.useState(0),[ra,Xt]=Ot(),[na,nn]=Ot(),[aa,an]=Ot(),[oa,on]=Ot(),[ia,ln]=Ot(),[la,sn]=Ot();o.useEffect(()=>{const l=nt.current;if(!l)return;const c=()=>{const m=l.getBoundingClientRect(),M=d?m.height:m.width;M>0&&rn(S=>Math.abs(S-M)<.5?S:M)};if(c(),typeof ResizeObserver<"u"){const m=new ResizeObserver(M=>{for(const S of M){const F=d?S.contentRect.height:S.contentRect.width;F>0&&rn(z=>Math.abs(z-F)<.5?z:F)}});return m.observe(l),()=>m.disconnect()}return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[d]);const xt=o.useCallback((l,c,m)=>{const M=d?m.height:m.width;if(!(Number.isFinite(M)&&M>0))return null;const S=d?m.bottom-c:l-m.left;return Number.isFinite(S)?Math.max(0,Math.min(1,S/M)):null},[d]),cn=o.useCallback((l,c)=>{const m=nt.current;if(!m)return null;const M=xt(l,c,m.getBoundingClientRect());return M===null?null:M*100},[xt]),mr=o.useRef(null),Ir=o.useRef(null),Je=o.useRef(null),Hr=o.useRef(null),qt=o.useRef(null),un=o.useCallback(l=>{if(i)return;if(Q){const T=Ir.current;if(!T||l.pointerId!==0&&l.pointerId!==T.pointerId||!nt.current)return;const ue=xt(l.clientX,l.clientY,nt.current.getBoundingClientRect());if(ue===null)return;if(T.handle==="macro-low"||T.handle==="macro-high"||T.handle==="macro-connect"){const[_e,dt,$e]=Kn(T.handle,ue,T.startPointerRatio,T.startMacroLowRatio,T.startMacroHighRatio);$e!==lt.current&&(lt.current=$e,lr($e),Bt($e));let de,Xe;if($t){const ft=Tr(ve,A,s,_e),gt=Math.max(ft,Tr(ve,A,s,dt));de=ve[ft],Xe=ve[gt]}else{const ft=Math.round(je+_e*zt),gt=Math.round(je+dt*zt);de=oe(A,ft),Xe=oe(A,gt)}const Gt=`${de.getTime()}_${Xe.getTime()}`;Gt!==Hr.current&&(Hr.current=Gt,Ct(de,Xe));let at,mt;if(T.handle==="macro-connect"){const ft=qe(x,de),gt=ot(A,x,Xe);let It,Ht;if(A==="year"){const ht=de.getFullYear()-T.startMacroLowDate.getFullYear();It=Ie("year",T.initialMicroLowDate,ht),Ht=Ie("year",T.initialMicroHighDate,ht)}else if(A==="month"){const ht=(de.getFullYear()-T.startMacroLowDate.getFullYear())*12+(de.getMonth()-T.startMacroLowDate.getMonth());It=Ie("month",T.initialMicroLowDate,ht),Ht=Ie("month",T.initialMicroHighDate,ht)}else{const ht=Math.round((de.getTime()-T.startMacroLowDate.getTime())/864e5);It=Ie("day",T.initialMicroLowDate,ht),Ht=Ie("day",T.initialMicroHighDate,ht)}const jt=ft.getTime(),Jt=gt.getTime(),$n=T.initialMicroHighDate.getTime()-T.initialMicroLowDate.getTime();let Zt=It.getTime(),Qt=Ht.getTime();Zt<jt&&(Zt=jt,Qt=Math.min(Jt,Zt+$n)),Qt>Jt&&(Qt=Jt,Zt=Math.max(jt,Qt-$n)),at=qe(x,new Date(Zt)),mt=qe(x,new Date(Qt))}else{const ft=de.getTime(),gt=ot(A,x,Xe).getTime(),It=T.initialMicroLowDate.getTime(),Ht=T.initialMicroHighDate.getTime(),jt=Math.max(ft,Math.min(gt,It)),Jt=Math.max(jt,Math.min(gt,Ht));at=qe(x,new Date(jt)),mt=qe(x,new Date(Jt))}const Rn=`${at.getTime()}_${mt.getTime()}`;Rn!==qt.current&&(qt.current=Rn,ze(at,mt))}else if(T.handle==="micro-low"||T.handle==="micro-high"||T.handle==="micro-connect"){const[_e,dt,$e]=Wn(T.handle,ue,T.startPointerRatio,T.startMicroLowRatio,T.startMicroHighRatio);$e!==lt.current&&(lt.current=$e,lr($e),Bt($e));let de,Xe;if(We){const at=Tr(ae,x,s,_e),mt=Math.max(at,Tr(ae,x,s,dt));de=ae[at],Xe=ae[mt]}else{const at=Math.round(Se+_e*_t),mt=Math.round(Se+dt*_t);de=oe(x,at),Xe=oe(x,mt)}const Gt=`${de.getTime()}_${Xe.getTime()}`;Gt!==qt.current&&(qt.current=Gt,ze(de,Xe))}return}const c=mr.current;if(!c||l.pointerId!==0&&l.pointerId!==c.pointerId||!nt.current)return;const m=nt.current.getBoundingClientRect(),M=d?l.clientY:l.clientX,S=d?m.height:m.width;if(!(Number.isFinite(S)&&S>0))return;if(c.handle==="connect"){const T=d?(c.startPointerPos-M)/S:(M-c.startPointerPos)/S,ue=Vn({posDiffPct:T,startLowVal:c.startLowVal,startHighVal:c.startHighVal,rangeMin:N,rangeMax:O,isDiscrete:$,sortedAllowedDates:w,snapMode:s,unit:t});if(Je.current&&Je.current[0]===ue[0]&&Je.current[1]===ue[1])return;Je.current=ue,ge(ue),Ge(ue[0],ue[1],!1);return}const F=xt(l.clientX,l.clientY,m);if(F===null)return;const z=dr(F*100),[E,X]=qr(c.handle,z,c.startLowVal,c.startHighVal,N,O,k);if((!Je.current||Je.current[0]!==E||Je.current[1]!==X)&&(Je.current=[E,X],ge([E,X]),Ge(E,X,!1)),!k&&(c.handle==="low"||c.handle==="high")){const T=Fn(c.handle,z,c.startLowVal,c.startHighVal,k);Fe.current!==T&&(Fe.current=T,xe(T),le(T))}},[i,Q,d,A,x,$t,We,ve,ae,je,zt,Se,_t,N,O,$,w,s,t,xt,dr,Ge,Ct,ze,k]),dn=o.useCallback(l=>{if(Q){Hr.current=null,qt.current=null,Ir.current=null,lt.current=null,lr(null),Er(Yr.current),Er(Ar.current);return}const c=mr.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,ge(null),mr.current=null,Fe.current=null,xe(null)},[Q,G,Ge,Er]),mn=o.useRef(un);mn.current=un;const fn=o.useRef(dn);fn.current=dn;const gn=R!==null||Ce!==null;o.useEffect(()=>{if(!gn)return;const l=m=>mn.current(m),c=m=>fn.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)}},[gn]);const jr=o.useCallback((l,c,m)=>{mr.current={pointerId:l,handle:c,startPointerPos:m,startLowVal:se,startHighVal:ce},Fe.current=c,xe(c),c!=="connect"&&le(c)},[se,ce]),hn=o.useCallback((l,c,m)=>{const M=L.current;M.mode==="vernier"&&(Ir.current={pointerId:l,handle:c,startPointerRatio:m,startMacroLowRatio:pe,startMacroHighRatio:Ae,startMicroLowRatio:Ve,startMicroHighRatio:rt,startMacroLowEnc:Ne,startMacroHighEnc:Ye,startMicroLowEnc:we,startMicroHighEnc:Me,startMacroLowDate:M.macroRange[0],startMacroHighDate:M.macroRange[1],initialMicroLowDate:st,initialMicroHighDate:ct},lt.current=c,lr(c),Bt(c))},[pe,Ae,Ve,rt,Ne,Ye,we,Me,st,ct]),bn=l=>c=>{if(i)return;c.stopPropagation(),c.preventDefault(),le(l);const m=d?c.clientY:c.clientX;jr(c.pointerId,l,m)},wn=l=>()=>{i||Fe.current!==null||le(l)},fr=l=>()=>{i||lt.current!==null||Bt(l)},Yt=l=>c=>{if(i)return;c.stopPropagation(),c.preventDefault();const m=nt.current;if(!m)return;const M=xt(c.clientX,c.clientY,m.getBoundingClientRect());M!==null&&hn(c.pointerId,l,M)},sa=l=>{if(i||v)return;l.stopPropagation(),l.preventDefault();const c=d?l.clientY:l.clientX;jr(l.pointerId,"connect",c)},ca=l=>{if(i)return;if(Q){const E=nt.current;if(!E)return;const X=E.getBoundingClientRect(),T=xt(l.clientX,l.clientY,X);if(T===null)return;const ue=d?l.clientX-(X.left+X.width/2):l.clientY-(X.top+X.height/2),_e=qn(T,ue,pe,Ae,Ve,rt,wt,void 0,!v);hn(l.pointerId,_e,T);return}const c=cn(l.clientX,l.clientY);if(c===null)return;const m=dr(c);let M="low";if(!k){const E=Math.abs(m-se),X=Math.abs(m-ce);E<X?M="low":X<E?M="high":M=m>ce?"high":"low"}le(M);const[S,F]=qr(M,m,se,ce,N,O,k);ge([S,F]),Ge(S,F,!0);const z=d?l.clientY:l.clientX;jr(l.pointerId,M,z)},ua=l=>{if(i||R!==null)return;const c=cn(l.clientX,l.clientY);if(c===null)return;const m=dr(c);et(m),nr(ur(m))},da=()=>{et(null),nr(null)},Mn=l=>c=>{if(i)return;le(l);const m=Un(c.key,l,se,ce,N,O,k,1);m&&(c.preventDefault(),fe||B(m),Ge(m[0],m[1],!0))},gr=(l,c)=>{const m=Math.max(q(x,l),q(x,r)),M=Math.min(q(x,ot(A,x,c)),q(x,n)),S=Math.max(m,Math.min(M,we)),F=Math.max(S,Math.min(M,Me));S===we&&F===Me||ze(oe(x,S),oe(x,F),!0)},hr=l=>c=>{if(i||!Q||e.mode!=="vernier")return;Bt(l);let m=0,M=!1,S=!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":M=!0;break;case"End":S=!0;break;default:return}if(c.preventDefault(),l==="macro-low"){const F=oe(A,Ne),z=oe(A,Ye);if($t){const T=Sr(ve,A,F,ve[0],z,m,M,S);if(T===De(ve,F,A))return;const ue=ve[T];Ct(ue,z,!0),gr(ue,z);return}let E;if(M?E=je:S?E=Ye:E=Math.max(je,Math.min(Ye,Ne+m)),E===Ne)return;const X=oe(A,E);Ct(X,z,!0),gr(X,z)}else if(l==="macro-high"){const F=oe(A,Ne),z=oe(A,Ye);if($t){const T=Sr(ve,A,z,F,ve[ve.length-1],m,M,S);if(T===De(ve,z,A))return;const ue=ve[T];Ct(F,ue,!0),gr(F,ue);return}let E;if(M?E=Ne:S?E=Rt:E=Math.max(Ne,Math.min(Rt,Ye+m)),E===Ye)return;const X=oe(A,E);Ct(F,X,!0),gr(F,X)}else if(l==="micro-low"){const F=oe(x,we),z=oe(x,Me);if(We){const X=Sr(ae,x,F,ae[0],z,m,M,S);if(X===De(ae,F,x))return;ze(ae[X],z,!0);return}let E;if(M?E=Se:S?E=Me:E=Math.max(Se,Math.min(Me,we+m)),E===we)return;ze(oe(x,E),z,!0)}else if(l==="micro-high"){const F=oe(x,we),z=oe(x,Me);if(We){const X=Sr(ae,x,z,F,ae[ae.length-1],m,M,S);if(X===De(ae,z,x))return;ze(F,ae[X],!0);return}let E;if(M?E=we:S?E=Be:E=Math.max(we,Math.min(Be,Me+m)),E===Me)return;ze(F,oe(x,E),!0)}},ma=o.useCallback(l=>{const c=L.current;if(!c.disabled)if(c.mode==="point"){const m=Math.max(N,Math.min(O,se+l));fe||B([m,m]),Ge(m,m,!0)}else if(c.mode==="vernier"){if(We){const T=ae.length-1,ue=De(ae,st,x),_e=De(ae,ct,x),dt=_e-ue;let $e=ue+l,de=_e+l;l<0&&$e<0?($e=0,de=Math.min(T,dt)):l>0&&de>T&&(de=T,$e=Math.max(0,T-dt)),($e!==ue||de!==_e)&&ze(ae[$e],ae[de],!0);return}const m=we,M=Me,S=Se,F=Be,z=M-m;let E=m+l,X=M+l;l<0&&E<S?(E=S,X=Math.min(F,E+z)):l>0&&X>F&&(X=F,E=Math.max(S,X-z)),(E!==m||X!==M)&&ze(oe(x,E),oe(x,X),!0)}else{const m=ce-se;let M=se+l,S=ce+l;l<0&&M<N?(M=N,S=Math.min(O,M+m)):l>0&&S>O&&(S=O,M=Math.max(N,S-m)),M<=S&&(fe||B([M,S]),Ge(M,S,!0))}},[se,ce,N,O,fe,Ge,ze,we,Me,Se,Be,x,We,ae,st,ct]),At=ur(se),Et=ur(ce),Or=re(se),Fr=re(ce),Vr=o.useMemo(()=>k?Xt===null?void 0:{estimatedWidthPx:Xt.widthPx,estimatedHeightPx:Xt.heightPx}:zr(Xt,nn),[k,Xt,nn]),br=!k&&se===ce,Ee=o.useMemo(()=>{if(k||!y||d)return Zr(P,Vr);const l=Qr(At,Et,Nt,P,Vr);return br?Xn(l):l},[k,br,y,d,At,Et,Nt,P,Vr]),Kt=R==="low"||R!=="high"&&Qe==="low",Wt=!k&&(R==="high"||R!=="low"&&Qe==="high"),wr=Ne===Ye,Mr=we===Me,fa=wr&&Te!=="macro-low",ga=wr&&Te==="macro-low",ha=Mr&&Te!=="micro-low",ba=Mr&&Te==="micro-low",xn=D?"top":"bottom",vn=D?"bottom":"top",pn=o.useMemo(()=>zr(an,on),[an,on]),Dn=o.useMemo(()=>zr(ln,sn),[ln,sn]),xr=y&&!d,vr=o.useMemo(()=>Cn(pe,Ae,Nt,xn,pn,wr,xr),[pe,Ae,Nt,xn,pn,wr,xr]),pr=o.useMemo(()=>Cn(Ve,rt,Nt,vn,Dn,Mr,xr),[Ve,rt,Nt,vn,Dn,Mr,xr]),wa=o.useMemo(()=>d?{"--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% + ${Ee.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Ee.lowOffsetY}px)`,"--ps-tooltip-rot":`${Ee.lowAngleDeg}deg`},[d,Ee.lowOffsetX,Ee.lowOffsetY,Ee.lowAngleDeg]),Ma=o.useMemo(()=>d?{"--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% + ${Ee.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Ee.highOffsetY}px)`,"--ps-tooltip-rot":`${Ee.highAngleDeg}deg`},[d,Ee.highOffsetX,Ee.highOffsetY,Ee.highAngleDeg]),Dr=Math.min(At,Et),yn=Math.max(At,Et),xa=d?{bottom:`${Dr}%`,height:`${yn-Dr}%`,top:"auto",left:"0",right:"0"}:{left:`${Dr}%`,width:`${yn-Dr}%`,top:"0",bottom:"0"},va=Math.max(.01,Ae-pe),Tn=Math.max(.06,Math.min(.25,.28*Math.sqrt(va))),pa=d?{bottom:`${At}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:Kt?40:30}:{left:`${At}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:Kt?40:30},Da=d?{bottom:`${Et}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:Wt?40:30}:{left:`${Et}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:Wt?40:30},ya=d?{bottom:`${Ut}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${Ut}%`,top:"50%",transform:"translate(-50%, -50%)"},Sn=be!==null?re(be):null,Ta=f!=="hover"&&be!==null&&(be===se||!k&&be===ce),Sa=We?q(x,ae[0]):Se,La=We?q(x,ae[ae.length-1]):Be,Ra=i||(Q?we<=Sa:k?se<=N:se<=N&&ce<=N),$a=i||(Q?Me>=La:(k||se>=O)&&ce>=O),ut=i?"cursor-not-allowed opacity-50":"cursor-pointer",Ln=l=>{const c=d?"vertical":"horizontal",m=l==="decrease",M=Fa[c][l];return g.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${M} 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 ${ut}`,onClick:()=>ma(m?-1:1),disabled:m?Ra:$a,"aria-label":m?J:I,children:Oa[c][l]})};return g.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${d?"flex-col":"flex-row"} ${u}`,"data-disabled":i?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":d?"vertical":"horizontal","data-label-position":P,"data-color-scheme":ee,children:[b&&Ln(d?"increase":"decrease"),g.jsx("div",{ref:nt,"data-testid":"period-slider-track","data-orientation":d?"vertical":"horizontal","data-vernier-orientation":Q?wt:void 0,className:`period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${d?"h-48 w-2":"h-2 w-full"} ${ut}`,onPointerDown:ca,onPointerMove:ua,onPointerLeave:da,children:Q?g.jsxs(g.Fragment,{children:[ar&&(d?g.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:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:U,x1:"0",y1:"0",x2:"1",y2:"0",children:[g.jsx("stop",{offset:"0%",stopColor:D?Y.macro:Y.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:D?Y.micro:Y.macro,stopOpacity:Tn})]})}),g.jsx("polygon",{points:D?`12,${(1-Ae)*100} 12,${(1-pe)*100} 20,100 20,0`:`12,0 12,100 20,${(1-pe)*100} 20,${(1-Ae)*100}`,fill:`url(#${U})`})]}):g.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:U,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:D?Y.macro:Y.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:D?Y.micro:Y.macro,stopOpacity:Tn})]})}),g.jsx("polygon",{points:D?`${pe*100},12 ${Ae*100},12 100,20 0,20`:`0,12 100,12 ${Ae*100},20 ${pe*100},20`,fill:`url(#${U})`})]})),!v&&g.jsxs(g.Fragment,{children:[g.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:d?{bottom:`calc(${pe*100}% - 8px)`,height:`calc(${Math.max(0,(Ae-pe)*100)}% + 16px)`}:{left:`calc(${pe*100}% - 8px)`,width:`calc(${Math.max(0,(Ae-pe)*100)}% + 16px)`},onPointerDown:Yt("macro-connect")}),g.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:d?{bottom:`calc(${Ve*100}% - 8px)`,height:`calc(${Math.max(0,(rt-Ve)*100)}% + 16px)`}:{left:`calc(${Ve*100}% - 8px)`,width:`calc(${Math.max(0,(rt-Ve)*100)}% + 16px)`},onPointerDown:Yt("micro-connect")})]}),or&&g.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(l=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:d?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`macro-tick-${l}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(l=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:d?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`micro-tick-${l}`))]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"Macro range start","aria-disabled":i?"true":void 0,"aria-valuemin":je,"aria-valuemax":Ye,"aria-valuenow":Ne,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(sr,A):vt(A,sr,h,p),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?D?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":D?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${ut}`,style:d?{bottom:`${pe*100}%`,left:D?0:"auto",right:D?"auto":0,transform:D?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ce==="macro-low"||Te==="macro-low"?30:15}:{left:`${pe*100}%`,top:D?0:"auto",bottom:D?"auto":0,transform:D?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ce==="macro-low"||Te==="macro-low"?30:15},onPointerDown:Yt("macro-low"),onKeyDown:hr("macro-low"),onFocus:fr("macro-low"),"data-active":Ce==="macro-low"?"true":void 0,"data-front":Te==="macro-low"?"true":void 0,"data-vernier-pos":d?D?"left":"right":D?"top":"bottom","data-handle-type":"macro-low",children:[g.jsx(er,{type:"macro",isTop:D,isVertical:d,isLeft:D}),Tt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":fa?"true":void 0,"data-slanted":vr.slant.isSlanted?"true":void 0,ref:aa,style:vr.lowStyle,children:Oe(A,sr,h,p)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"Macro range end","aria-disabled":i?"true":void 0,"aria-valuemin":Ne,"aria-valuemax":Rt,"aria-valuenow":Ye,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(cr,A):vt(A,cr,h,p),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?D?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":D?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${ut}`,style:d?{bottom:`${Ae*100}%`,left:D?0:"auto",right:D?"auto":0,transform:D?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ce==="macro-high"||Te==="macro-high"?30:15}:{left:`${Ae*100}%`,top:D?0:"auto",bottom:D?"auto":0,transform:D?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ce==="macro-high"||Te==="macro-high"?30:15},onPointerDown:Yt("macro-high"),onKeyDown:hr("macro-high"),onFocus:fr("macro-high"),"data-active":Ce==="macro-high"?"true":void 0,"data-front":Te==="macro-high"?"true":void 0,"data-vernier-pos":d?D?"left":"right":D?"top":"bottom","data-handle-type":"macro-high",children:[g.jsx(er,{type:"macro",isTop:D,isVertical:d,isLeft:D}),Tt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":ga?"true":void 0,"data-slanted":vr.slant.isSlanted?"true":void 0,ref:oa,style:vr.highStyle,children:Oe(A,cr,h,p)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.lowerAriaLabel??"Micro range start","aria-disabled":i?"true":void 0,"aria-valuemin":Se,"aria-valuemax":Me,"aria-valuenow":we,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(st,x):vt(x,st,C,p),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?D?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":D?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${ut}`,style:d?{bottom:`${Ve*100}%`,left:D?"auto":0,right:D?0:"auto",transform:D?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ce==="micro-low"||Te==="micro-low"?30:20}:{left:`${Ve*100}%`,top:D?"auto":0,bottom:D?0:"auto",transform:D?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ce==="micro-low"||Te==="micro-low"?30:20},onPointerDown:Yt("micro-low"),onKeyDown:hr("micro-low"),onFocus:fr("micro-low"),"data-active":Ce==="micro-low"?"true":void 0,"data-front":Te==="micro-low"?"true":void 0,"data-vernier-pos":d?D?"right":"left":D?"bottom":"top","data-handle-type":"micro-low",children:[g.jsx(er,{type:"micro",isTop:!D,isVertical:d,isLeft:!D}),Tt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":ha?"true":void 0,"data-slanted":pr.slant.isSlanted?"true":void 0,ref:ia,style:pr.lowStyle,children:Oe(x,st,C,p)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Micro range end","aria-disabled":i?"true":void 0,"aria-valuemin":we,"aria-valuemax":Be,"aria-valuenow":Me,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(ct,x):vt(x,ct,C,p),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?D?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":D?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${ut}`,style:d?{bottom:`${rt*100}%`,left:D?"auto":0,right:D?0:"auto",transform:D?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ce==="micro-high"||Te==="micro-high"?30:20}:{left:`${rt*100}%`,top:D?"auto":0,bottom:D?0:"auto",transform:D?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ce==="micro-high"||Te==="micro-high"?30:20},onPointerDown:Yt("micro-high"),onKeyDown:hr("micro-high"),onFocus:fr("micro-high"),"data-active":Ce==="micro-high"?"true":void 0,"data-front":Te==="micro-high"?"true":void 0,"data-vernier-pos":d?D?"right":"left":D?"bottom":"top","data-handle-type":"micro-high",children:[g.jsx(er,{type:"micro",isTop:!D,isVertical:d,isLeft:!D}),Tt&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":ba?"true":void 0,"data-slanted":pr.slant.isSlanted?"true":void 0,ref:la,style:pr.highStyle,children:Oe(x,ct,C,p)})]})]}):g.jsxs(g.Fragment,{children:[!v&&g.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:xa,onPointerDown:sa}),V&&$&&w.length>1&&g.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:w.map((l,c)=>{const m=q(t,l),M=ur(c),S=d?{bottom:`${M}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${M}%`,top:"50%",transform:"translate(-50%, -50%)"};return g.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:S},`tick-${m}`)})}),!i&&be!==null&&Ut!==null&&R===null&&Sn&&g.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:ya,children:[g.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"}),g.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":Ta?"true":void 0,className:`period-slider-hover-tooltip ${P==="bottom"&&!d?"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:Oe(t,Sn,e.formatLabel,p)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":k?e.pointAriaLabel??"Selected date":e.lowerAriaLabel??"Range start","aria-disabled":i?"true":void 0,"aria-valuemin":N,"aria-valuemax":k?O:ce,"aria-valuenow":se,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Or,t):vt(t,Or,e.formatLabel,p),"aria-orientation":d?"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 ${ut}`,style:pa,onPointerDown:bn("low"),onKeyDown:Mn("low"),onFocus:wn("low"),"data-active":R==="low"?"true":void 0,"data-front":Kt?"true":void 0,children:[g.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)] ${R==="low"?"":"shadow-md"}`}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":P,"data-slanted":Ee.isSlanted?"true":void 0,"data-front":Kt?"true":void 0,"data-duplicate":br&&!Kt?"true":void 0,ref:ra,style:wa,children:Oe(t,Or,e.formatLabel,p)})]}),!k&&g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Range end","aria-disabled":i?"true":void 0,"aria-valuemin":se,"aria-valuemax":O,"aria-valuenow":ce,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Fr,t):vt(t,Fr,e.formatLabel,p),"aria-orientation":d?"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 ${ut}`,style:Da,onPointerDown:bn("high"),onKeyDown:Mn("high"),onFocus:wn("high"),"data-active":R==="high"?"true":void 0,"data-front":Wt?"true":void 0,children:[g.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)] ${R==="high"?"":"shadow-md"}`}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":P,"data-slanted":Ee.isSlanted?"true":void 0,"data-front":Wt?"true":void 0,"data-duplicate":br&&!Wt?"true":void 0,ref:na,style:Ma,children:Oe(t,Fr,e.formatLabel,p)})]})]})}),b&&Ln(d?"decrease":"increase")]})},_r=(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},Gn=(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},Ua=(e,t)=>e===t?!0:e.mode!==t.mode||e.unit!==t.unit||e.minDate.getTime()!==t.minDate.getTime()||e.maxDate.getTime()!==t.maxDate.getTime()||e.labelPosition!==t.labelPosition||e.autoSlantLabels!==t.autoSlantLabels||e.isVertical!==t.isVertical||e.hideConnectBar!==t.hideConnectBar||e.showTicks!==t.showTicks||e.disabled!==t.disabled||e.showStepper!==t.showStepper||e.debounceMs!==t.debounceMs||e.tooltipStyle!==t.tooltipStyle||e.colorScheme!==t.colorScheme||e.className!==t.className||!Gn(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||!_r(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||!_r(e.macroAllowedDates,t.macroAllowedDates)||!_r(e.microAllowedDates,t.microAllowedDates)):!1,Jn=o.memo(Va,Ua);Jn.displayName="PeriodSlider";const Ze=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},tr=(e,t)=>{if(Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},Ba=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)})`)}},Dt=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},Nn=e=>Dt(e,1,1),za=e=>Dt(e,12,31),_a={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},Xa={year:4,month:2,day:2},qa={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},Yn=new Map,Ka=(e,t)=>{const r=`${e}\0${t}`,n=Yn.get(r);if(n!==void 0)return n;const a=new Intl.DateTimeFormat(t,_a[e]);return Yn.set(r,a),a},Xr=(e,t,r)=>r===void 0?String(qa[e](t)).padStart(Xa[e],"0"):Ka(e,r).format(t),Wa=(e,t,r)=>{const n=t?.getTime()??null,a=r?.getTime()??null,s=new Map;return e.forEach((i,u)=>{tr(`allowedDates[${u}]`,i);const b=Ze(i),f=b.getTime();n!==null&&f<n||a!==null&&f>a||s.has(f)||s.set(f,b)}),Array.from(s.keys()).sort((i,u)=>i-u).map(i=>s.get(i))},Ga=(e,t)=>{const r=[];let n=Ze(e);const a=Ze(t).getTime();for(;n.getTime()<=a;)r.push(n),n=Le.addDays(n,1);return r},An=(e,t)=>{const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Oe("day",e[n],void 0,t),value:Le.format(e[n],"yyyy-MM-dd")});return r},Ja=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:s,maxYear:i,minDate:u,maxDate:b,allowedDates:f,variant:P="date",className:y="",style:d,disabled:v=!1,prevDateAriaLabel:V="Previous day",nextDateAriaLabel:ee="Next day",selectAriaLabel:p="Date",yearAriaLabel:J="Year",monthAriaLabel:I="Month",dayAriaLabel:te="Day",locale:Y,formatYearOption:U,formatMonthOption:L,formatDayOption:_}=e;if(Ba(Y),t!==void 0&&tr("value",t),r!==void 0&&tr("initialDate",r),u!==void 0&&tr("minDate",u),b!==void 0&&tr("maxDate",b),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(P==="split-dropdown"&&f!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const H=t??r;if(H===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[w,$]=o.useState(()=>Ze(H)),N=t!==void 0,O=t?.getTime(),k=o.useMemo(()=>t!==void 0?Ze(t):w,[O,w]),re=u?.getTime(),ye=b?.getTime(),Z=o.useMemo(()=>{const h=u?Ze(u):null,C=s!==void 0?Nn(s):null;return h===null?C:C===null||h.getTime()>=C.getTime()?h:C},[re,s]),ne=o.useMemo(()=>{const h=b?Ze(b):null,C=i!==void 0?za(i):null;return h===null?C:C===null||h.getTime()<=C.getTime()?h:C},[ye,i]),ie=Z?.getTime()??null,me=ne?.getTime()??null;if(Z!==null&&ne!==null&&Z.getTime()>ne.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Le.format(Z,"yyyy-MM-dd")} is after max ${Le.format(ne,"yyyy-MM-dd")})`);if(P!=="date"&&f===void 0&&(Z===null||ne===null))throw new RangeError(`DateSelector: variant="${P}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${P==="dropdown"?' or supply "allowedDates"':""}`);const W=f===void 0?null:f.map(h=>h.getTime()).join(","),K=o.useMemo(()=>f===void 0?null:Wa(f,Z,ne),[W,ie,me]),ke=h=>{const C=h.getTime();return K!==null?K.some(Pe=>Pe.getTime()===C):!(ie!==null&&C<ie||me!==null&&C>me)},bt=H.getTime();o.useEffect(()=>{N||$(Ze(H))},[N,bt]);const He=h=>{if(v)return;const C=Ze(h);ke(C)&&(N||$(C),n?.(C))},Re=k.getTime(),fe=ke(k),j=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=Le.addDays(new Date(Re),-1);return ke(h)?h:null},[K,Re,ie,me]),B=o.useMemo(()=>{if(K!==null){for(const C of K)if(C.getTime()>Re)return C;return null}const h=Le.addDays(new Date(Re),1);return ke(h)?h:null},[K,Re,ie,me]),G=v||j===null,ge=v||B===null,R=()=>{j!==null&&He(j)},xe=()=>{B!==null&&He(B)},Fe=h=>{if(h.target.value){const C=Le.parseISO(h.target.value);Number.isNaN(C.getTime())||He(C)}},Qe=h=>{if(h.target.value){const C=Le.parseISO(h.target.value);Number.isNaN(C.getTime())||He(C)}},le=k.getFullYear(),be=k.getMonth()+1,et=k.getDate(),Ut=o.useMemo(()=>P!=="dropdown"?[]:K!==null?An(K,Y):Z===null||ne===null?[]:An(Ga(Z,ne),Y),[P,K,ie,me,Y]),nr=o.useMemo(()=>{if(P!=="split-dropdown"||Z===null||ne===null)return[];const h=[];for(let C=ne.getFullYear();C>=Z.getFullYear();C--)h.push(C);return h},[P,ie,me]),se=o.useMemo(()=>{if(P!=="split-dropdown"||Z===null||ne===null)return[];const h=Z,C=ne,Pe=le===h.getFullYear()?h.getMonth()+1:1,Lt=le===C.getFullYear()?C.getMonth()+1:12,Mt=[];for(let tt=Pe;tt<=Lt;tt++)Mt.push(tt);return Mt},[P,ie,me,le]),ce=o.useMemo(()=>{if(P!=="split-dropdown"||Z===null||ne===null)return[];const h=Z,C=ne,Pe=le===h.getFullYear()&&be===h.getMonth()+1?h.getDate():1,Lt=le===C.getFullYear()&&be===C.getMonth()+1?C.getDate():Le.getDaysInMonth(new Date(Re)),Mt=[];for(let tt=Pe;tt<=Lt;tt++)Mt.push(tt);return Mt},[P,ie,me,Re,le,be]),yt=(h,C,Pe)=>Pe>Le.getDaysInMonth(Dt(h,C,1))?!1:ke(Dt(h,C,Pe)),Q=(h,C,Pe)=>{yt(h,C,Pe)&&He(Dt(h,C,Pe))},wt=h=>U?U(h):Xr("year",Nn(h),Y),D=h=>L?L(h):Xr("month",Dt(le,h,1),Y),ar=h=>_?_(h):Xr("day",Dt(le,be,h),Y),or=Le.format(k,"yyyy-MM-dd"),Tt=Oe("day",k,void 0,Y),A=Z?Le.format(Z,"yyyy-MM-dd"):void 0,x=ne?Le.format(ne,"yyyy-MM-dd"):void 0,Pr=fe?or:"",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",ir=P==="split-dropdown"?"w-auto":"w-38";return g.jsxs("div",{className:`inline-flex items-center ${ir} ${y}`,style:d,"data-variant":P,"data-out-of-range":fe?void 0:"true",children:[g.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:R,children:g.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"?g.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:Pr,onChange:Qe,children:[fe?null:g.jsx("option",{value:"",disabled:!0,className:St,children:Tt}),Ut.map(h=>g.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"?g.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[g.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:fe?le:"",onChange:h=>Q(Number(h.target.value),be,et),children:[fe?null:g.jsx("option",{value:"",disabled:!0,className:St,children:wt(le)}),nr.map(h=>g.jsx("option",{value:h,disabled:!yt(h,be,et),className:"dark:bg-slate-700 dark:text-slate-100",children:wt(h)},h))]}),g.jsxs("select",{"aria-label":I,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:fe?be:"",onChange:h=>Q(le,Number(h.target.value),et),children:[fe?null:g.jsx("option",{value:"",disabled:!0,className:St,children:D(be)}),se.map(h=>g.jsx("option",{value:h,disabled:!yt(le,h,et),className:"dark:bg-slate-700 dark:text-slate-100",children:D(h)},h))]}),g.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:fe?et:"",onChange:h=>Q(le,be,Number(h.target.value)),children:[fe?null:g.jsx("option",{value:"",disabled:!0,className:St,children:ar(et)}),ce.map(h=>g.jsx("option",{value:h,className:"dark:bg-slate-700 dark:text-slate-100",children:ar(h)},h))]})]}):g.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:or,min:A,max:x,onChange:Fe,type:"date"}),g.jsx("button",{type:"button","aria-label":ee,disabled:ge,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:g.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]})},Ft=e=>e===void 0?null:Ze(e).getTime(),Zn=o.memo(Ja,(e,t)=>!(Ft(e.value??e.initialDate)!==Ft(t.value??t.initialDate)||Ft(e.minDate)!==Ft(t.minDate)||Ft(e.maxDate)!==Ft(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));Zn.displayName="DateSelector";function Ke(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 pt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`}function Lr(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 En(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function Za(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 Qa(e,t){const r=e===void 0?null:Ke(e,0),n=t===void 0?null:Ke(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function eo(e,t){const r=e===void 0?null:Ke(e,11),n=t===void 0?null:Ke(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function Qn(e,t){return{label:Oe("month",e,void 0,t),value:pt(e)}}function to(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(Qn(Ke(Math.floor(i/12),i%12),r));return s}const ro=e=>{const{value:t,initialDate:r,onChange:n,children:a,variant:s="date",minYear:i,maxYear:u,minDate:b,maxDate:f,isWarning:P=!1,className:y="",style:d,disabled:v=!1,prevMonthAriaLabel:V="Previous month",nextMonthAriaLabel:ee="Next month",selectAriaLabel:p="Month",locale:J}=e;Za(J),Lr(t,"value"),Lr(r,"initialDate"),Lr(b,"minDate"),Lr(f,"maxDate"),En(i,"minYear"),En(u,"maxYear");const I=t??r;if(I===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(()=>Ke(I.getFullYear(),I.getMonth())),U=t!==void 0,L=o.useMemo(()=>t!==void 0?Ke(t.getFullYear(),t.getMonth()):te,[t?.getTime(),te]),_=b?.getTime(),H=f?.getTime(),w=o.useMemo(()=>Qa(i,b),[i,_]),$=o.useMemo(()=>eo(u,f),[u,H]);if(w!==null&&$!==null&&w>$)throw new RangeError(`MonthSelector: the resolved lower bound ${pt(w)} is after the resolved upper bound ${pt($)}.`);if(s==="dropdown"&&(w===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=w!==null&&L<w||$!==null&&L>$,O=I.getTime();o.useEffect(()=>{if(U)return;const R=Ke(I.getFullYear(),I.getMonth());Y(xe=>xe.getTime()===R.getTime()?xe:R)},[U,O]);const k=R=>(w===null||R>=w)&&($===null||R<=$),re=R=>{if(v)return;if(!k(R))throw new RangeError(`MonthSelector: refusing to emit ${pt(R)}, which lies outside the declared bounds.`);U||Y(R);const xe=R.getFullYear()*100+(R.getMonth()+1);n?.(R,xe)},ye=o.useMemo(()=>{const R=Ke(L.getFullYear(),L.getMonth()-1);return k(R)?R:null},[L,w?.getTime(),$?.getTime()]),Z=o.useMemo(()=>{const R=Ke(L.getFullYear(),L.getMonth()+1);return k(R)?R:null},[L,w?.getTime(),$?.getTime()]),ne=v||ye===null,ie=v||Z===null,me=()=>{ye!==null&&re(ye)},W=()=>{Z!==null&&re(Z)},K=R=>{if(!R)return;const[xe,Fe]=R.split("-"),Qe=Number(xe),le=Number(Fe)-1;if(!(Number.isInteger(Qe)&&Number.isInteger(le)))return;const be=Ke(Qe,le);k(be)&&re(be)},ke=R=>{K(R.target.value)},bt=R=>{K(R.target.value)},He=pt(L),Re=w?pt(w):void 0,fe=$?pt($):void 0,j=o.useMemo(()=>{if(s!=="dropdown"||w===null||$===null)return[];const R=to(w,$,J);if(!N)return R;const xe=Qn(L,J);return[...R,xe].sort((Fe,Qe)=>Qe.value.localeCompare(Fe.value))},[s,w?.getTime(),$?.getTime(),N,L,J]),B=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",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}`,ge=`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 g.jsxs("div",{className:`inline-flex w-38 items-center ${y}`,style:d,children:[g.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:me,children:g.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"?g.jsx("select",{"aria-label":p,disabled:v,className:ge,value:He,onChange:bt,children:j.map(R=>g.jsx("option",{value:R.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:R.label},R.value))}):g.jsx("input",{"aria-label":p,disabled:v,className:G,value:He,min:Re,max:fe,onChange:ke,type:"month"}),g.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:g.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]})},ea=o.memo(ro,(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,u=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(i!==u)return!1;const b=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,f=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(b!==f||e.onChange!==t.onChange||e.children!==t.children||e.prevMonthAriaLabel!==t.prevMonthAriaLabel||e.nextMonthAriaLabel!==t.nextMonthAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});ea.displayName="MonthSelector";function rr(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 en(e,t,r){if(rr(e,"minDate",t),rr(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 Kr(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(rr(e,`${t}[0]`,r[0]),rr(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 Wr(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 Gr(e,t,r,n,a,s){Wr(e,`${t}[0]`,r[0],n,a,s),Wr(e,`${t}[1]`,r[1],n,a,s)}function Ue(e,t,r){return e<t?t:e>r?r:e}function Rr(e,t,r,n){const a=ot(t,r,n[1]);return[Ue(e[0],n[0],a),Ue(e[1],n[0],a)]}function Jr(e,t,r,n){const a=De(e,r,t)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function tn(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(u=>Object.is(r[u],n[u]))||(t.current=e),t.current}function no(e){const{unit:t,minDate:r,maxDate:n,initialRange:a,onChangeRange:s,...i}=e;en("usePeriodSliderRange",r,n),Kr("usePeriodSliderRange","initialRange",a),Gr("usePeriodSliderRange","initialRange",a,r,n,"[minDate, maxDate]");const u=tn(i),b=o.useRef(a),[f,P]=o.useState(a);let y=f;const d=[Ue(f[0],r,n),Ue(f[1],r,n)];(d[0]!==f[0]||d[1]!==f[1])&&(y=d,P(d));const v=o.useRef(y);v.current=y;const V=o.useRef({minDate:r,maxDate:n,allowedDates:u.allowedDates});V.current={minDate:r,maxDate:n,allowedDates:u.allowedDates};const ee=o.useRef(s);ee.current=s;const p=o.useCallback(w=>{const{minDate:$,maxDate:N}=V.current,O=Ue(w[0],$,N),k=Ue(w[1],$,N),re=v.current;O.getTime()===re[0].getTime()&&k.getTime()===re[1].getTime()||(v.current=[O,k],P([O,k]),ee.current?.(O,k))},[]),J=o.useCallback(w=>{const $=v.current,N=w.getTime()>$[1].getTime()?w:$[1];p([w,N])},[p]),I=o.useCallback(w=>{const $=v.current,N=w.getTime()<$[0].getTime()?w:$[0];p([N,w])},[p]),te=o.useCallback((w,$)=>{p([w,$])},[p]),Y=o.useCallback(w=>{const{minDate:$,maxDate:N,allowedDates:O}=V.current,k=v.current,re=Vt(O,t,$,N);if(re.length>0){p([Jr(re,t,k[0],w),Jr(re,t,k[1],w)]);return}p([Ie(t,k[0],w),Ie(t,k[1],w)])},[t,p]),U=o.useCallback(()=>{p(b.current)},[p]),L=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:I,minDate:y[0],maxDate:n,unit:t}),[y[0],y[1],I,n,t]),H=o.useMemo(()=>({...u,mode:"range",unit:t,range:y,minDate:r,maxDate:n,onChangeRange:te}),[u,t,y,r,n,te]);return{range:y,lowerDate:y[0],upperDate:y[1],setRange:P,setLowerDate:J,setUpperDate:I,shiftRange:Y,resetRange:U,startSelectorProps:L,endSelectorProps:_,sliderProps:H}}function ao(e){const{unit:t,minDate:r,maxDate:n,initialValue:a,onChangePoint:s,...i}=e;en("usePeriodSliderPoint",r,n),rr("usePeriodSliderPoint","initialValue",a),Wr("usePeriodSliderPoint","initialValue",a,r,n,"[minDate, maxDate]");const u=tn(i),b=o.useRef(a),[f,P]=o.useState(a);let y=f;const d=Ue(f,r,n);d!==f&&(y=d,P(d));const v=o.useRef(y);v.current=y;const V=o.useRef({minDate:r,maxDate:n,allowedDates:u.allowedDates});V.current={minDate:r,maxDate:n,allowedDates:u.allowedDates};const ee=o.useRef(s);ee.current=s;const p=o.useCallback(U=>{const{minDate:L,maxDate:_}=V.current,H=Ue(U,L,_);H.getTime()!==v.current.getTime()&&(v.current=H,P(H),ee.current?.(H))},[]),J=o.useCallback(U=>{const{minDate:L,maxDate:_,allowedDates:H}=V.current,w=Vt(H,t,L,_);if(w.length>0){p(Jr(w,t,v.current,U));return}p(Ie(t,v.current,U))},[t,p]),I=o.useCallback(()=>{p(b.current)},[p]),te=o.useMemo(()=>({value:y,onChange:p,minDate:r,maxDate:n,unit:t}),[y,p,r,n,t]),Y=o.useMemo(()=>({...u,mode:"point",unit:t,value:y,minDate:r,maxDate:n,onChangePoint:p}),[u,t,y,r,n,p]);return{value:y,setValue:P,shiftValue:J,resetValue:I,selectorProps:te,sliderProps:Y}}function oo(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:a,initialMicroRange:s,macroUnit:i=t,microUnit:u=t,onChangeMacroRange:b,onChangeMicroRange:f,...P}=e;en("useVernierSlider",r,n),Kr("useVernierSlider","initialMacroRange",a),Kr("useVernierSlider","initialMicroRange",s),Gr("useVernierSlider","initialMacroRange",a,r,n,"[minDate, maxDate]"),Gr("useVernierSlider","initialMicroRange",s,a[0],ot(i,u,a[1]),"the initial macro window");const y=tn(P),d=o.useRef(a),v=o.useRef(s),[V,ee]=o.useState(a),[p,J]=o.useState(s);let I=V;const te=[Ue(V[0],r,n),Ue(V[1],r,n)];(te[0]!==V[0]||te[1]!==V[1])&&(I=te,ee(te));let Y=p;const U=Rr(p,i,u,I);(U[0]!==p[0]||U[1]!==p[1])&&(Y=U,J(U));const L=o.useRef(I);L.current=I;const _=o.useRef(Y);_.current=Y;const H=o.useRef({minDate:r,maxDate:n});H.current={minDate:r,maxDate:n};const w=o.useRef(b);w.current=b;const $=o.useRef(f);$.current=f;const N=o.useCallback((j,B)=>{const G=L.current,ge=_.current;(j[0].getTime()!==G[0].getTime()||j[1].getTime()!==G[1].getTime())&&(L.current=j,ee(j),w.current?.(j[0],j[1])),(B[0].getTime()!==ge[0].getTime()||B[1].getTime()!==ge[1].getTime())&&(_.current=B,J(B),$.current?.(B[0],B[1]))},[]),O=o.useCallback((j,B)=>{const{minDate:G,maxDate:ge}=H.current,R=[Ue(j,G,ge),Ue(B,G,ge)];N(R,Rr(_.current,i,u,R))},[i,u,N]),k=o.useCallback((j,B)=>{N(L.current,Rr([j,B],i,u,L.current))},[i,u,N]),re=o.useCallback(j=>{const B=L.current[1],G=j>B?j:B;O(j,G)},[O]),ye=o.useCallback(j=>{const B=L.current[0],G=j<B?j:B;O(G,j)},[O]),Z=o.useCallback(j=>{const B=_.current[1],G=j>B?j:B;k(j,G)},[k]),ne=o.useCallback(j=>{const B=_.current[0],G=j<B?j:B;k(G,j)},[k]),ie=o.useCallback(j=>{const{minDate:B,maxDate:G}=H.current,ge=L.current,R=Ie(i,ge[0],j),xe=Ie(i,ge[1],j);R<B||xe>G||O(R,xe)},[i,O]),me=o.useCallback(j=>{const B=L.current,G=_.current,ge=Ie(u,G[0],j),R=Ie(u,G[1],j);ge<B[0]||R>ot(i,u,B[1])||k(ge,R)},[i,u,k]),W=o.useCallback(()=>{const j=d.current;N(j,Rr(v.current,i,u,j))},[i,u,N]),K=o.useMemo(()=>ot(i,u,I[1]),[i,u,I[1]]),ke=o.useMemo(()=>({value:I[0],onChange:re,minDate:r,maxDate:I[1],unit:i}),[I,re,r,i]),bt=o.useMemo(()=>({value:I[1],onChange:ye,minDate:I[0],maxDate:n,unit:i}),[I,ye,n,i]),He=o.useMemo(()=>({value:Y[0],onChange:Z,minDate:I[0],maxDate:Y[1],unit:u}),[Y,Z,I,u]),Re=o.useMemo(()=>({value:Y[1],onChange:ne,minDate:Y[0],maxDate:K,unit:u}),[Y,ne,K,u]),fe=o.useMemo(()=>({...y,mode:"vernier",unit:t,macroUnit:i,microUnit:u,minDate:r,maxDate:n,macroRange:I,microRange:Y,onChangeMacroRange:O,onChangeMicroRange:k}),[y,t,i,u,r,n,I,Y,O,k]);return{macroRange:I,setMacroRange:ee,microRange:Y,setMicroRange:J,setMacroLowerDate:re,setMacroUpperDate:ye,setMicroLowerDate:Z,setMicroUpperDate:ne,shiftMacroRange:ie,shiftMicroRange:me,resetVernier:W,macroStartSelectorProps:ke,macroEndSelectorProps:bt,microStartSelectorProps:He,microEndSelectorProps:Re,sliderProps:fe}}function In(e){const t=new Date(e,0,1);return t.setFullYear(e),t}function $r(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 Hn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function io(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 jn(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 lo=e=>{const{value:t,initialDate:r,onChange:n,children:a,minYear:s,maxYear:i,minDate:u,maxDate:b,className:f="",style:P,disabled:y=!1,prevYearAriaLabel:d="Previous year",nextYearAriaLabel:v="Next year",selectAriaLabel:V="Year",locale:ee}=e;$r(t,"value"),$r(r,"initialDate"),$r(u,"minDate"),$r(b,"maxDate"),Hn(s,"minYear"),Hn(i,"maxYear"),io(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,I]=o.useState(()=>p.getFullYear()),te=u?.getTime(),Y=b?.getTime(),U=o.useMemo(()=>jn(s,u,Math.max),[s,te]),L=o.useMemo(()=>jn(i,b,Math.min),[i,Y]);if(U===null||L===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>L)throw new RangeError(`YearSelector: the resolved lower bound ${U} is after the resolved upper bound ${L}.`);const _=t!==void 0,H=t!==void 0?t.getFullYear():J,w=H<U||H>L,$=p.getTime();o.useEffect(()=>{_||I(p.getFullYear())},[_,$]);const N=W=>W>=U&&W<=L,O=W=>{if(!y){if(!N(W))throw new RangeError(`YearSelector: refusing to emit ${W}, which lies outside the declared bounds ${U}-${L}.`);_||I(W),n?.(In(W),W)}},k=N(H-1)?H-1:null,re=N(H+1)?H+1:null,ye=y||k===null,Z=y||re===null,ne=()=>{k!==null&&O(k)},ie=()=>{re!==null&&O(re)},me=o.useMemo(()=>{const W=[];for(let K=L;K>=U;K--)W.push(K);return w&&(W.push(H),W.sort((K,ke)=>ke-K)),W},[U,L,w,H]);return g.jsxs("div",{className:`inline-flex w-32 items-center ${f}`,style:P,children:[g.jsx("button",{type:"button","aria-label":d,disabled:ye,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:g.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"})}),g.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:H,onChange:W=>{if(!W.target.value)return;const K=Number(W.target.value);Number.isInteger(K)&&O(K)},children:me.map(W=>g.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:Oe("year",In(W),void 0,ee)},W))}),g.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:g.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]})},ta=o.memo(lo,(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)});ta.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=On;exports.DateSelector=Zn;exports.MonthSelector=ea;exports.PeriodSlider=Jn;exports.YearSelector=ta;exports.addUnit=Ie;exports.areStylesEqual=Gn;exports.calculateConnectDragValues=Vn;exports.calculateHandleDragValues=qr;exports.calculateKeyboardActionValues=Un;exports.calculateLabelSlant=Qr;exports.calculateVernierMacroDrag=Kn;exports.calculateVernierMicroDrag=Wn;exports.decode=oe;exports.encode=q;exports.findNearestDateIndex=De;exports.formatLabel=Oe;exports.formatScreenReaderLabel=vt;exports.getActiveDragHandle=Fn;exports.getMacroWindowEndDate=ot;exports.getSortedAllowedDates=Vt;exports.normalizeDateByUnit=qe;exports.resolveVernierTargetHandle=qn;exports.usePeriodSliderPoint=ao;exports.usePeriodSliderRange=no;exports.useVernierSlider=oo;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),Ne=require("date-fns"),a=require("react"),Wn={"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"}},gt=e=>e instanceof Date&&!Number.isNaN(e.getTime()),De=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),tt=(e,t)=>{if(!gt(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${De(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},ee=(e,t)=>{const r=tt(e,t),n=r.getFullYear(),o=r.getMonth()+1,s=r.getDate();if(e==="year")return n;if(e==="month")return n*12+(o-1);const i=new Date(0);return i.setUTCFullYear(n,o-1,s),i.setUTCHours(0,0,0,0),Math.floor(i.getTime()/(1440*60*1e3))},de=(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 o=Math.floor(t/12),s=t-o*12;return r.setFullYear(o,s,1),r}const n=new Date(t*24*60*60*1e3);return r.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r},ke=(e,t,r)=>{if(!gt(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${De(t)})`);return e==="year"?Ne.addYears(t,r):e==="month"?Ne.addMonths(t,r):Ne.addDays(t,r)},qe=(e,t,r)=>{if(!gt(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${De(r)})`);if(e===t)return tt(t,r);const n=r.getFullYear(),o=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,o+1,0):tt(t,r)},Oa={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},Hn=new Map,Fa=(e,t)=>{const r=`${e}\0${t}`,n=Hn.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Oa[e]);return Hn.set(r,o),o},Ua=(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 o=String(t.getDate()).padStart(2,"0");return`${r}-${n}-${o}`},Ue=(e,t,r,n)=>gt(t)?r?r(t):n===void 0?Ua(e,t):Fa(e,n).format(t):"",St=(e,t,r,n)=>Ue(e,t,r,n),Te=(e,t,r)=>{if(!e||e.length===0||e.length===1)return 0;const n=ee(r,t);let o=0,s=e.length-1;if(n<=ee(r,e[o]))return 0;if(n>=ee(r,e[s]))return s;for(;o<=s;){const h=o+s>>1,f=ee(r,e[h]);if(f===n)return h;f<n?o=h+1:s=h-1}const i=Math.abs(ee(r,e[o])-n),c=Math.abs(ee(r,e[s])-n);return i<c?o:s},$t=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const o=ee(t,r),s=ee(t,n),i=new Map;for(const c of e){const h=tt(t,c),f=ee(t,h);f<o||f>s||i.has(f)||i.set(f,h)}if(i.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${De(r)}, maxDate: ${De(n)}, entries: ${e.length})`);return Array.from(i.keys()).sort((c,h)=>c-h).map(c=>i.get(c))},Sr=(e,t,r,n)=>{const o=e.length-1;if(o<=0)return 0;const s=Te(e,n,t);if(r==="time"){const i=e[0].getTime(),c=e[o].getTime()-i;return c<=0?0:Math.max(0,Math.min(1,(e[s].getTime()-i)/c))}return s/o},Lr=(e,t,r,n)=>{const o=e.length-1;if(o<=0)return 0;const s=Math.max(0,Math.min(1,n));if(r==="time"){const i=e[0].getTime(),c=e[o].getTime()-i;return c<=0?0:Te(e,new Date(i+s*c),t)}return Math.max(0,Math.min(o,Math.round(s*o)))},nn=(e,t,r,n,o,s,i)=>{let c=r,h=n;return i?(c=t,h=t):e==="low"?t>n?(c=n,h=t):c=t:t<r?(h=r,c=t):h=t,[Math.max(o,Math.min(s,c)),Math.max(o,Math.min(s,h))]},Gn=(e,t,r,n,o)=>o?"low":e==="low"?t>n?"high":"low":t<r?"low":"high",Jn=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:o,isDiscrete:s,sortedAllowedDates:i,snapMode:c,unit:h})=>{if(s){const E=i.length-1;if(E<=0)return[0,0];const W=Math.max(0,Math.min(E,Math.round(t))),y=Math.max(W,Math.min(E,Math.round(r)));if(c==="time"){const p=i[0].getTime(),F=i[E].getTime(),Y=i[W].getTime(),A=i[y].getTime()-Y;let V=Y+e*(F-p),j=V+A;V<p&&(V=p,j=p+A),j>F&&(j=F,V=F-A);const D=Te(i,new Date(V),h),$=Te(i,new Date(j),h);return[D,Math.max(D,$)]}const oe=Math.round(e*E);let R=W+oe,X=y+oe;return R<0&&(X+=-R,R=0),X>E&&(R-=X-E,X=E),[Math.max(0,Math.min(E,R)),Math.max(0,Math.min(E,X))]}const f=E=>Math.max(n,Math.min(o,E)),T=o-n;if(T<=0)return[f(t),f(r)];const v=Math.round(e*T);let d=t+v,P=r+v;return d<n&&(P+=n-d,d=n),P>o&&(d-=P-o,P=o),[f(d),f(P)]},Zn=(e,t,r,n,o,s,i,c)=>{let h=0,f=!1,T=!1;switch(e){case"ArrowRight":case"ArrowUp":h=c;break;case"ArrowLeft":case"ArrowDown":h=-c;break;case"PageUp":h=c*5;break;case"PageDown":h=-c*5;break;case"Home":f=!0;break;case"End":T=!0;break;default:return null}if(i){let P=r;return f?P=o:T?P=s:P=Math.max(o,Math.min(s,r+h)),[P,P]}let v=r,d=n;return t==="low"?f?v=o:T?v=n:v=Math.max(o,Math.min(n,r+h)):f?d=r:T?d=s:d=Math.max(r,Math.min(s,n+h)),[v,d]},Qn=8,ea=2,ta=16,Ba=12,za=90,on=(e,t)=>{const r=t?.estimatedHeightPx??ta,o=Qn+(t?.anchorGapY??ea)+r/2,s=e==="top"?-o:o;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:s,highOffsetY:s,isSlanted:!1,proximity:0}},ln=(e,t,r,n="top",o)=>{const s=o?.estimatedWidthPx,i=o?.estimatedHeightPx??ta,c=o?.paddingPx??Ba,h=o?.maxAngleDeg??za,f=Qn+(o?.anchorGapY??ea),T=on(n,o);if(!(Number.isFinite(r)&&r>0)||s===void 0||!Number.isFinite(s)||s<=0)return T;const v=Math.max(0,t-e)/100*r,d=s+c;if(v>=d)return T;const P=Math.max(0,Math.min(1,(d-v)/d)),W=P*P*P*(P*(P*6-15)+10)*h,y=n==="top"?-W:W,oe=W*Math.PI/180,R=s/2*Math.abs(Math.sin(oe))+i/2*Math.abs(Math.cos(oe)),X=f+R,p=n==="top"?-X:+X,F=s*Math.abs(Math.cos(oe))+i*Math.abs(Math.sin(oe)),Y=Math.max(0,(F+c-v)/2);return{lowAngleDeg:y,highAngleDeg:y,lowOffsetX:-Y,highOffsetX:Y,lowOffsetY:p,highOffsetY:p,isSlanted:P>.001,proximity:P}},ra=e=>({...e,lowOffsetX:0,highOffsetX:0});function na(e,t,r,n,o,s,i="macro-top",c=.05,h=!0,f="range"){const T=i==="macro-top"||i==="macro-left",v=t<=0;if(T&&v||!(T||v)){const E=Math.abs(e-r),W=Math.abs(e-n);return E<=c&&E<=W?"macro-low":W<=c&&W<E?"macro-high":h&&e>=r&&e<=n?"macro-connect":E<W?"macro-low":"macro-high"}if(f==="point")return"micro-point";const d=Math.abs(e-o),P=Math.abs(e-s);return d<=c&&d<=P?"micro-low":P<=c&&P<d?"micro-high":h&&e>=o&&e<=s?"micro-connect":d<P?"micro-low":"micro-high"}function aa(e,t,r,n,o){if(e==="macro-connect"){const i=t-r,c=o-n,h=Math.max(0,Math.min(1-c,n+i)),f=h+c;return[h,f,"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 s=Math.max(0,Math.min(1,t));return s<n?[s,n,"macro-low"]:[n,s,"macro-high"]}function oa(e,t,r,n,o){if(e==="micro-point"){const i=Math.max(0,Math.min(1,t));return[i,i,"micro-point"]}if(e==="micro-connect"){const i=t-r,c=o-n,h=Math.max(0,Math.min(1-c,n+i)),f=h+c;return[h,f,"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 s=Math.max(0,Math.min(1,t));return s<n?[s,n,"micro-low"]:[n,s,"micro-high"]}const cr=a.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let o,s;r?(o=n?"M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z",s=`period-slider-knob period-slider-knob-svg is-vertical ${n?"is-semicircle-left":"is-semicircle-right"}`):(o=t?"M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z":"M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z",s=`period-slider-knob period-slider-knob-svg ${t?"is-semicircle-top":"is-semicircle-bottom"}`);const i=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return g.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:g.jsx("path",{d:o,className:i,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});cr.displayName="VernierKnobSvg";const _a=(e,t)=>{if(!gt(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${De(e)})`);if(!gt(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${De(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${De(e)}, maxDate: ${De(t)})`)},Cr=(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: ${De(t)})`);const[r,n]=t;if(!gt(r))throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${De(r)})`);if(!gt(n))throw new RangeError(`PeriodSlider: ${e}[1] must be a valid Date (received: ${De(n)})`);if(n.getTime()<r.getTime())throw new RangeError(`PeriodSlider: ${e} must not be inverted (start: ${De(r)}, end: ${De(n)})`)},an=(e,t)=>{if(!gt(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${De(t)})`)},Zr=(e,t,r,n)=>{if(t.getTime()<r.getTime()||t.getTime()>n.getTime())throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${De(t)}, minDate: ${De(r)}, maxDate: ${De(n)})`)},qa=(e,t,r)=>{if(e.mode==="range"){for(const n of["range","defaultRange"]){const o=e[n];o!==void 0&&(Cr(n,o),Zr(`${n}[0]`,o[0],t,r),Zr(`${n}[1]`,o[1],t,r))}return}if(e.mode==="point")for(const n of["value","defaultValue"]){const o=e[n];o!==void 0&&(an(n,o),Zr(n,o,t,r))}},Xa=e=>{Cr("macroRange",e.macroRange);const t=e.microRange!==void 0||e.defaultMicroRange!==void 0||e.onChangeMicroRange!==void 0,r=e.microValue!==void 0||e.defaultMicroValue!==void 0||e.onChangeMicroPoint!==void 0;if(t&&r)throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");if(r){if(e.microValue!==void 0)return an("microValue",e.microValue),{shape:"point",selection:[e.microValue,e.microValue]};if(e.defaultMicroValue!==void 0)return an("defaultMicroValue",e.defaultMicroValue),{shape:"point",selection:[e.defaultMicroValue,e.defaultMicroValue]};throw new RangeError("PeriodSlider: vernier point mode requires a micro selection; supply microValue (controlled) or defaultMicroValue (uncontrolled)")}if(e.microRange!==void 0)return Cr("microRange",e.microRange),{shape:"range",selection:e.microRange};if(e.defaultMicroRange!==void 0)return Cr("defaultMicroRange",e.defaultMicroRange),{shape:"range",selection:e.defaultMicroRange};throw t?new RangeError("PeriodSlider: vernier range mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)"):new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange / defaultMicroRange for a period, or microValue / defaultMicroValue for a point")},lr=(e,t,r,n,o,s,i,c)=>{const h=Te(e,n,t),f=Te(e,o,t);return i?h:c?f:Math.max(h,Math.min(f,Te(e,r,t)+s))},Qr=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},Ka=(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)})`)}},qt=()=>{const[e,t]=a.useState(null),r=a.useRef(null),n=a.useCallback(o=>{if(r.current?.disconnect(),r.current=null,o===null){t(null);return}if(typeof ResizeObserver>"u")return;const s=new ResizeObserver(i=>{for(const c of i){const h=c.borderBoxSize?.[0];h!==void 0&&t(f=>f!==null&&Math.abs(f.widthPx-h.inlineSize)<.5&&Math.abs(f.heightPx-h.blockSize)<.5?f:{widthPx:h.inlineSize,heightPx:h.blockSize})}});s.observe(o),r.current=s},[]);return a.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},en=(e,t)=>{if(!(e===null||t===null))return{estimatedWidthPx:Math.max(e.widthPx,t.widthPx),estimatedHeightPx:Math.max(e.heightPx,t.heightPx)}},jn=(e,t,r)=>({"--ps-tooltip-tx":`calc(-50% + ${e}px)`,"--ps-tooltip-ty":`${t}px`,"--ps-tooltip-rot":`${r}deg`}),On=(e,t,r,n,o,s,i)=>{const c=on(n,o);if(!i)return{slant:c,lowStyle:void 0,highStyle:void 0};const h=ln(e*100,t*100,r,n,o),f=s?ra(h):h;return{slant:f,lowStyle:jn(f.lowOffsetX,f.lowOffsetY-c.lowOffsetY,f.lowAngleDeg),highStyle:jn(f.highOffsetX,f.highOffsetY-c.highOffsetY,f.highAngleDeg)}},Wa={horizontal:{decrease:"◀",increase:"▶"},vertical:{decrease:"▼",increase:"▲"}},Ga={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"}},Ja=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:o,snapMode:s="index",disabled:i=!1,className:c="",showStepper:h=!0,tooltipStyle:f="always",labelPosition:T="top",autoSlantLabels:v=!0,isVertical:d=!1,hideConnectBar:P=!1,showTicks:E=!1,colorScheme:W="blue-rose",locale:y,decreaseAriaLabel:oe="Decrease",increaseAriaLabel:R="Increase"}=e;_a(r,n),qa(e,r,n),y!==void 0&&Ka("locale",y);const X=e.mode==="vernier"?Xa(e):null,p=X!==null&&X.shape==="point",F=Wn[W],Y=a.useId(),A=a.useRef(e);A.current=e;const V=r.getTime(),j=n.getTime(),D=a.useMemo(()=>$t(o,t,r,n),[o,t,V,j]),$=D.length>0,{rangeMin:S,rangeMax:x}=a.useMemo(()=>$?{rangeMin:0,rangeMax:D.length-1}:{rangeMin:ee(t,r),rangeMax:ee(t,n)},[$,D,t,V,j]),_=e.mode==="point",te=a.useCallback(l=>{if($){const u=Math.max(0,Math.min(D.length-1,Math.round(l)));return D[u]}return de(t,Math.round(l))},[$,D,t]),G=a.useCallback(l=>{if(l===void 0)return S;const u=tt(t,l);return $?Te(D,u,t):ee(t,u)},[$,D,t,S]),[ue,Me]=a.useState(()=>X===null?null:X.selection);let ie=ue??(X===null?null:X.selection);if(p&&ie!==null&&ie[0].getTime()!==ie[1].getTime()){const l=[ie[0],ie[0]];ie=l,Me(l)}const re=e.mode==="vernier"?e.microValue?.getTime():void 0,Q=a.useMemo(()=>e.mode!=="vernier"||e.microValue===void 0?null:[e.microValue,e.microValue],[e.mode,re]),he=e.mode!=="vernier"?null:p?Q??ie:e.microRange!==void 0?e.microRange:ie,Xe=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?he?.[0]:void 0,q=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?he?.[1]:void 0,J=e.mode==="point"?e.value??e.defaultValue:void 0,le=e.mode==="point"?J?.getTime():Xe?.getTime(),N=e.mode==="range"?q?.getTime():le,[U,se]=a.useMemo(()=>{if(e.mode==="point"){const m=G(J);return[m,m]}const l=G(Xe),u=G(q);return[Math.min(l,u),Math.max(l,u)]},[e.mode,le,N,G,J,Xe,q]),ge=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:p?e.microValue!==void 0:e.microRange!==void 0,[Se,Be]=a.useState(()=>[U,se]),[Ke,rt]=a.useState(null),[ae,pe]=a.useState(null),Ye=a.useRef(null);Ye.current=ae;const[kt,K]=a.useState("high"),[ce,ht]=a.useState(null),[nt,ct]=a.useState(null),fe=Ke?Ke[0]:ge?U:Se[0],be=Ke?Ke[1]:ge?se:Se[1],Wt=a.useRef([fe,be]);Wt.current=[fe,be];const me=e.mode==="vernier",Ct=e.mode==="vernier"?e.vernierOrientation??(d?"macro-left":"macro-top"):"macro-top",C=Ct==="macro-top"||Ct==="macro-left",Hr=e.mode==="vernier"?e.showVernierProjection??!0:!1,jr=e.mode==="vernier"?e.showVernierTicks??!0:!1,ut=e.mode==="vernier"?e.showHairline??!0:!1,O=me?e.macroUnit??t:t,w=me?e.microUnit??t:t,b=me?e.macroIsDiscrete??!1:$,I=me?e.microIsDiscrete??!1:$,Ee=me?e.macroAllowedDates??o:o,Nt=me?e.microAllowedDates??o:o,at=me?e.formatMacroLabel??e.formatLabel:e.formatLabel,We=me?e.formatMicroLabel??e.formatLabel:e.formatLabel,sn=e.mode==="vernier"?e.macroRange[0].getTime():void 0,cn=e.mode==="vernier"?e.macroRange[1].getTime():void 0,da=Xe?.getTime(),ma=q?.getTime(),[Ve,dr]=a.useState(null),bt=a.useRef(null);bt.current=Ve;const[Gt,Yt]=a.useState(()=>p?"micro-point":"micro-high");let Le=Gt;const Or=p?Gt==="micro-low"||Gt==="micro-high"||Gt==="micro-connect"?"micro-point":null:Gt==="micro-point"?"micro-high":null;Or!==null&&(Le=Or,Yt(Or));const ze=a.useMemo(()=>ee(O,r),[V,O]),At=a.useMemo(()=>{const l=ee(O,n);if(me&&l<=ze)throw new RangeError(`PeriodSlider: macroUnit "${O}" cannot distinguish minDate from maxDate (minDate: ${De(r)}, maxDate: ${De(n)})`);return l},[me,V,j,ze,O]),Pe=a.useMemo(()=>me?$t(Ee,O,r,n):[],[me,Ee,O,V,j]),Ie=a.useMemo(()=>e.mode!=="vernier"?ze:ee(O,e.macroRange[0]),[e.mode,sn,ze,O]),He=a.useMemo(()=>e.mode!=="vernier"?At:ee(O,e.macroRange[1]),[e.mode,cn,At,O]),mr=a.useMemo(()=>de(O,Ie),[O,Ie]),fr=a.useMemo(()=>de(O,He),[O,He]),Re=a.useMemo(()=>e.mode!=="vernier"?ee(w,r):Math.max(ee(w,e.macroRange[0]),ee(w,r)),[e.mode,sn,w,V]),je=a.useMemo(()=>e.mode!=="vernier"?ee(w,n):Math.min(ee(w,qe(O,w,e.macroRange[1])),ee(w,n)),[e.mode,cn,O,w,j]),ne=a.useMemo(()=>me?$t(Nt,w,r,n).filter(u=>{const m=ee(w,u);return m>=Re&&m<=je}):[],[me,Nt,w,V,j,Re,je]),Et=b&&Pe.length>0,Ze=I&&ne.length>0,we=a.useMemo(()=>he===null?Re:ee(w,he[0]),[da,Re,w,he]),ye=a.useMemo(()=>he===null?je:ee(w,he[1]),[ma,je,w,he]),Mt=a.useMemo(()=>de(w,we),[w,we]),wt=a.useMemo(()=>de(w,ye),[w,ye]),Jt=Math.max(1,At-ze),$e=Et?Sr(Pe,O,s,mr):Math.max(0,Math.min(1,(Ie-ze)/Jt)),Oe=Math.max($e,Et?Sr(Pe,O,s,fr):Math.min(1,(He-ze)/Jt)),Zt=Math.max(1,je-Re),Ge=Ze?Sr(ne,w,s,Mt):Math.max(0,Math.min(1,(we-Re)/Zt)),dt=Math.max(Ge,Ze?Sr(ne,w,s,wt):Math.min(1,(ye-Re)/Zt)),Fr=a.useRef({timerId:null,emit:null}),Ur=a.useRef({timerId:null,emit:null}),Br=a.useRef({timerId:null,emit:null});a.useEffect(()=>{const l=[Fr,Ur,Br];return()=>{for(const u of l)Qr(u.current)}},[]);const Vt=a.useCallback((l,u,m)=>{Qr(l);const{debounceMs:M}=A.current;if(m||!M||M<=0){u();return}l.emit=u,l.timerId=setTimeout(()=>{l.timerId=null,l.emit=null,u()},M)},[]),zr=a.useCallback(l=>{const u=l.emit;Qr(l),u?.()},[]),It=a.useCallback(l=>new Date(Math.min(Math.max(l.getTime(),V),j)),[V,j]),ot=a.useCallback((l,u,m=!1)=>{const[M,L]=Wt.current;if((A.current.mode==="point"?l===M:l===M&&u===L)&&Fr.current.timerId===null)return;const z=te(l),H=te(u),Z=()=>{const k=A.current;k.mode==="point"?k.onChangePoint?.(z):k.mode==="range"&&k.onChangeRange?.(z,H)};Vt(Fr.current,Z,m)},[te,Vt]),Ht=a.useCallback((l,u,m=!1)=>{if(A.current.mode!=="vernier")return;const M=It(l),L=It(u);Vt(Ur.current,()=>{const B=A.current;B.mode==="vernier"&&B.onChangeMacroRange?.(M,L)},m)},[It,Vt]),_e=a.useCallback((l,u,m=!1)=>{const M=A.current;if(M.mode!=="vernier")return;const L=It(l),B=It(u);(p?M.microValue===void 0:M.microRange===void 0)&&Me([L,B]),Vt(Br.current,()=>{const z=A.current;if(z.mode==="vernier"){if(p){z.onChangeMicroPoint?.(L);return}z.onChangeMicroRange?.(L,B)}},m)},[It,Vt,p]),un=a.useCallback((l,u=!1)=>{_e(l,l,u)},[_e]),gr=a.useCallback(l=>{if($&&s==="time"&&D.length>1){const M=Math.max(0,Math.min(D.length-1,Math.round(l))),L=D[0].getTime(),z=D[D.length-1].getTime()-L;if(z<=0)return 0;const H=D[M].getTime();return Math.max(0,Math.min(100,(H-L)/z*100))}const u=x-S;if(u<=0)return 0;const m=(l-S)/u*100;return Math.max(0,Math.min(100,m))},[$,s,D,S,x]),hr=a.useCallback(l=>{const u=Math.max(0,Math.min(100,l));if($){if(s==="time"&&D.length>1){const L=D[0].getTime(),z=D[D.length-1].getTime()-L,H=L+u/100*z;return Te(D,new Date(H),t)}const M=Math.round(u/100*(D.length-1));return Math.max(0,Math.min(D.length-1,M))}const m=S+u/100*(x-S);return Math.round(m)},[$,s,D,S,x,t]),mt=a.useRef(null),[jt,dn]=a.useState(0),[fa,Qt]=qt(),[ga,mn]=qt(),[ha,fn]=qt(),[ba,gn]=qt(),[Ma,hn]=qt(),[wa,bn]=qt();a.useEffect(()=>{const l=mt.current;if(!l)return;const u=()=>{const m=l.getBoundingClientRect(),M=d?m.height:m.width;M>0&&dn(L=>Math.abs(L-M)<.5?L:M)};if(u(),typeof ResizeObserver<"u"){const m=new ResizeObserver(M=>{for(const L of M){const B=d?L.contentRect.height:L.contentRect.width;B>0&&dn(z=>Math.abs(z-B)<.5?z:B)}});return m.observe(l),()=>m.disconnect()}return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[d]);const Tt=a.useCallback((l,u,m)=>{const M=d?m.height:m.width;if(!(Number.isFinite(M)&&M>0))return null;const L=d?m.bottom-u:l-m.left;return Number.isFinite(L)?Math.max(0,Math.min(1,L/M)):null},[d]),Mn=a.useCallback((l,u)=>{const m=mt.current;if(!m)return null;const M=Tt(l,u,m.getBoundingClientRect());return M===null?null:M*100},[Tt]),br=a.useRef(null),_r=a.useRef(null),it=a.useRef(null),qr=a.useRef(null),er=a.useRef(null),wn=a.useCallback(l=>{if(i)return;if(me){const k=_r.current;if(!k||l.pointerId!==0&&l.pointerId!==k.pointerId||!mt.current)return;const xe=Tt(l.clientX,l.clientY,mt.current.getBoundingClientRect());if(xe===null)return;if(k.handle==="macro-low"||k.handle==="macro-high"||k.handle==="macro-connect"){const[Qe,vt,Ae]=aa(k.handle,xe,k.startPointerRatio,k.startMacroLowRatio,k.startMacroHighRatio);Ae!==bt.current&&(bt.current=Ae,dr(Ae),Yt(Ae));let ve,et;if(Et){const pt=Lr(Pe,O,s,Qe),yt=Math.max(pt,Lr(Pe,O,s,vt));ve=Pe[pt],et=Pe[yt]}else{const pt=Math.round(ze+Qe*Jt),yt=Math.round(ze+vt*Jt);ve=de(O,pt),et=de(O,yt)}const nr=`${ve.getTime()}_${et.getTime()}`;nr!==qr.current&&(qr.current=nr,Ht(ve,et));let ft,Dt;if(k.handle==="macro-connect"){const pt=tt(w,ve),yt=qe(O,w,et);let Bt,zt;if(O==="year"){const Rt=ve.getFullYear()-k.startMacroLowDate.getFullYear();Bt=ke("year",k.initialMicroLowDate,Rt),zt=ke("year",k.initialMicroHighDate,Rt)}else if(O==="month"){const Rt=(ve.getFullYear()-k.startMacroLowDate.getFullYear())*12+(ve.getMonth()-k.startMacroLowDate.getMonth());Bt=ke("month",k.initialMicroLowDate,Rt),zt=ke("month",k.initialMicroHighDate,Rt)}else{const Rt=Math.round((ve.getTime()-k.startMacroLowDate.getTime())/864e5);Bt=ke("day",k.initialMicroLowDate,Rt),zt=ke("day",k.initialMicroHighDate,Rt)}const _t=pt.getTime(),ar=yt.getTime(),In=k.initialMicroHighDate.getTime()-k.initialMicroLowDate.getTime();let or=Bt.getTime(),ir=zt.getTime();or<_t&&(or=_t,ir=Math.min(ar,or+In)),ir>ar&&(ir=ar,or=Math.max(_t,ir-In)),ft=tt(w,new Date(or)),Dt=tt(w,new Date(ir))}else{const pt=ve.getTime(),yt=qe(O,w,et).getTime(),Bt=k.initialMicroLowDate.getTime(),zt=k.initialMicroHighDate.getTime(),_t=Math.max(pt,Math.min(yt,Bt)),ar=Math.max(_t,Math.min(yt,zt));ft=tt(w,new Date(_t)),Dt=tt(w,new Date(ar))}const Vn=`${ft.getTime()}_${Dt.getTime()}`;Vn!==er.current&&(er.current=Vn,_e(ft,Dt))}else if(k.handle==="micro-low"||k.handle==="micro-high"||k.handle==="micro-connect"||k.handle==="micro-point"){const[Qe,vt,Ae]=oa(k.handle,xe,k.startPointerRatio,k.startMicroLowRatio,k.startMicroHighRatio);Ae!==bt.current&&(bt.current=Ae,dr(Ae),Yt(Ae));let ve,et;if(Ze){const ft=Lr(ne,w,s,Qe),Dt=Math.max(ft,Lr(ne,w,s,vt));ve=ne[ft],et=ne[Dt]}else{const ft=Math.round(Re+Qe*Zt),Dt=Math.round(Re+vt*Zt);ve=de(w,ft),et=de(w,Dt)}const nr=`${ve.getTime()}_${et.getTime()}`;nr!==er.current&&(er.current=nr,_e(ve,et))}return}const u=br.current;if(!u||l.pointerId!==0&&l.pointerId!==u.pointerId||!mt.current)return;const m=mt.current.getBoundingClientRect(),M=d?l.clientY:l.clientX,L=d?m.height:m.width;if(!(Number.isFinite(L)&&L>0))return;if(u.handle==="connect"){const k=d?(u.startPointerPos-M)/L:(M-u.startPointerPos)/L,xe=Jn({posDiffPct:k,startLowVal:u.startLowVal,startHighVal:u.startHighVal,rangeMin:S,rangeMax:x,isDiscrete:$,sortedAllowedDates:D,snapMode:s,unit:t});if(it.current&&it.current[0]===xe[0]&&it.current[1]===xe[1])return;it.current=xe,rt(xe),ot(xe[0],xe[1],!1);return}const B=Tt(l.clientX,l.clientY,m);if(B===null)return;const z=hr(B*100),[H,Z]=nn(u.handle,z,u.startLowVal,u.startHighVal,S,x,_);if((!it.current||it.current[0]!==H||it.current[1]!==Z)&&(it.current=[H,Z],rt([H,Z]),ot(H,Z,!1)),!_&&(u.handle==="low"||u.handle==="high")){const k=Gn(u.handle,z,u.startLowVal,u.startHighVal,_);Ye.current!==k&&(Ye.current=k,pe(k),K(k))}},[i,me,d,O,w,Et,Ze,Pe,ne,ze,Jt,Re,Zt,S,x,$,D,s,t,Tt,hr,ot,Ht,_e,_]),xn=a.useCallback(l=>{if(me){qr.current=null,er.current=null,_r.current=null,bt.current=null,dr(null),zr(Ur.current),zr(Br.current);return}const u=br.current;if(!u||l.pointerId!==0&&l.pointerId!==u.pointerId)return;const m=it.current??Ke;m&&(ot(m[0],m[1],!0),Be(m)),it.current=null,rt(null),br.current=null,Ye.current=null,pe(null)},[me,Ke,ot,zr]),vn=a.useRef(wn);vn.current=wn;const Dn=a.useRef(xn);Dn.current=xn;const pn=ae!==null||Ve!==null;a.useEffect(()=>{if(!pn)return;const l=m=>vn.current(m),u=m=>Dn.current(m);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)}},[pn]);const Xr=a.useCallback((l,u,m)=>{br.current={pointerId:l,handle:u,startPointerPos:m,startLowVal:fe,startHighVal:be},Ye.current=u,pe(u),u!=="connect"&&K(u)},[fe,be]),yn=a.useCallback((l,u,m)=>{const M=A.current;M.mode==="vernier"&&(_r.current={pointerId:l,handle:u,startPointerRatio:m,startMacroLowRatio:$e,startMacroHighRatio:Oe,startMicroLowRatio:Ge,startMicroHighRatio:dt,startMacroLowEnc:Ie,startMacroHighEnc:He,startMicroLowEnc:we,startMicroHighEnc:ye,startMacroLowDate:M.macroRange[0],startMacroHighDate:M.macroRange[1],initialMicroLowDate:Mt,initialMicroHighDate:wt},bt.current=u,dr(u),Yt(u))},[$e,Oe,Ge,dt,Ie,He,we,ye,Mt,wt]),Rn=l=>u=>{if(i)return;u.stopPropagation(),u.preventDefault(),K(l);const m=d?u.clientY:u.clientX;Xr(u.pointerId,l,m)},Tn=l=>()=>{i||Ye.current!==null||K(l)},Mr=l=>()=>{i||bt.current!==null||Yt(l)},Ot=l=>u=>{if(i)return;u.stopPropagation(),u.preventDefault();const m=mt.current;if(!m)return;const M=Tt(u.clientX,u.clientY,m.getBoundingClientRect());M!==null&&yn(u.pointerId,l,M)},xa=l=>{if(i||P)return;l.stopPropagation(),l.preventDefault();const u=d?l.clientY:l.clientX;Xr(l.pointerId,"connect",u)},va=l=>{if(i)return;if(me){const H=mt.current;if(!H)return;const Z=H.getBoundingClientRect(),k=Tt(l.clientX,l.clientY,Z);if(k===null)return;const xe=d?l.clientX-(Z.left+Z.width/2):l.clientY-(Z.top+Z.height/2),Qe=na(k,xe,$e,Oe,Ge,dt,Ct,void 0,!P,p?"point":"range");yn(l.pointerId,Qe,k);return}const u=Mn(l.clientX,l.clientY);if(u===null)return;const m=hr(u);let M="low";if(!_){const H=Math.abs(m-fe),Z=Math.abs(m-be);H<Z?M="low":Z<H?M="high":M=m>be?"high":"low"}K(M);const[L,B]=nn(M,m,fe,be,S,x,_);rt([L,B]),ot(L,B,!0);const z=d?l.clientY:l.clientX;Xr(l.pointerId,M,z)},Da=l=>{if(i||ae!==null)return;const u=Mn(l.clientX,l.clientY);if(u===null)return;const m=hr(u);ht(m),ct(gr(m))},pa=()=>{ht(null),ct(null)},Sn=l=>u=>{if(i)return;K(l);const m=Zn(u.key,l,fe,be,S,x,_,1);m&&(u.preventDefault(),ge||Be(m),ot(m[0],m[1],!0))},wr=(l,u)=>{const m=Math.max(ee(w,l),ee(w,r)),M=Math.min(ee(w,qe(O,w,u)),ee(w,n)),L=Math.max(m,Math.min(M,we)),B=Math.max(L,Math.min(M,ye));L===we&&B===ye||_e(de(w,L),de(w,B),!0)},xr=l=>u=>{if(i||!me||e.mode!=="vernier")return;Yt(l);let m=0,M=!1,L=!1;switch(u.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":M=!0;break;case"End":L=!0;break;default:return}if(u.preventDefault(),l==="macro-low"){const B=de(O,Ie),z=de(O,He);if(Et){const k=lr(Pe,O,B,Pe[0],z,m,M,L);if(k===Te(Pe,B,O))return;const xe=Pe[k];Ht(xe,z,!0),wr(xe,z);return}let H;if(M?H=ze:L?H=He:H=Math.max(ze,Math.min(He,Ie+m)),H===Ie)return;const Z=de(O,H);Ht(Z,z,!0),wr(Z,z)}else if(l==="macro-high"){const B=de(O,Ie),z=de(O,He);if(Et){const k=lr(Pe,O,z,B,Pe[Pe.length-1],m,M,L);if(k===Te(Pe,z,O))return;const xe=Pe[k];Ht(B,xe,!0),wr(B,xe);return}let H;if(M?H=Ie:L?H=At:H=Math.max(Ie,Math.min(At,He+m)),H===He)return;const Z=de(O,H);Ht(B,Z,!0),wr(B,Z)}else if(l==="micro-low"){const B=de(w,we),z=de(w,ye);if(Ze){const Z=lr(ne,w,B,ne[0],z,m,M,L);if(Z===Te(ne,B,w))return;_e(ne[Z],z,!0);return}let H;if(M?H=Re:L?H=ye:H=Math.max(Re,Math.min(ye,we+m)),H===we)return;_e(de(w,H),z,!0)}else if(l==="micro-high"){const B=de(w,we),z=de(w,ye);if(Ze){const Z=lr(ne,w,z,B,ne[ne.length-1],m,M,L);if(Z===Te(ne,z,w))return;_e(B,ne[Z],!0);return}let H;if(M?H=we:L?H=je:H=Math.max(we,Math.min(je,ye+m)),H===ye)return;_e(B,de(w,H),!0)}else if(l==="micro-point"){const B=de(w,we);if(Ze){const H=lr(ne,w,B,ne[0],ne[ne.length-1],m,M,L);if(H===Te(ne,B,w))return;un(ne[H],!0);return}let z;if(M?z=Re:L?z=je:z=Math.max(Re,Math.min(je,we+m)),z===we)return;un(de(w,z),!0)}},ya=a.useCallback(l=>{const u=A.current;if(!u.disabled)if(u.mode==="point"){const m=Math.max(S,Math.min(x,fe+l));ge||Be([m,m]),ot(m,m,!0)}else if(u.mode==="vernier"){if(Ze){const k=ne.length-1,xe=Te(ne,Mt,w),Qe=Te(ne,wt,w),vt=Qe-xe;let Ae=xe+l,ve=Qe+l;l<0&&Ae<0?(Ae=0,ve=Math.min(k,vt)):l>0&&ve>k&&(ve=k,Ae=Math.max(0,k-vt)),(Ae!==xe||ve!==Qe)&&_e(ne[Ae],ne[ve],!0);return}const m=we,M=ye,L=Re,B=je,z=M-m;let H=m+l,Z=M+l;l<0&&H<L?(H=L,Z=Math.min(B,H+z)):l>0&&Z>B&&(Z=B,H=Math.max(L,Z-z)),(H!==m||Z!==M)&&_e(de(w,H),de(w,Z),!0)}else{const m=be-fe;let M=fe+l,L=be+l;l<0&&M<S?(M=S,L=Math.min(x,M+m)):l>0&&L>x&&(L=x,M=Math.max(S,L-m)),M<=L&&(ge||Be([M,L]),ot(M,L,!0))}},[fe,be,S,x,ge,ot,_e,we,ye,Re,je,w,Ze,ne,Mt,wt]),Ft=gr(fe),Ut=gr(be),Kr=te(fe),Wr=te(be),Gr=a.useMemo(()=>_?Qt===null?void 0:{estimatedWidthPx:Qt.widthPx,estimatedHeightPx:Qt.heightPx}:en(Qt,mn),[_,Qt,mn]),vr=!_&&fe===be,Fe=a.useMemo(()=>{if(_||!v||d)return on(T,Gr);const l=ln(Ft,Ut,jt,T,Gr);return vr?ra(l):l},[_,vr,v,d,Ft,Ut,jt,T,Gr]),tr=ae==="low"||ae!=="high"&&kt==="low",rr=!_&&(ae==="high"||ae!=="low"&&kt==="high"),Dr=Ie===He,pr=!p&&we===ye,Ra=Dr&&Le!=="macro-low",Ta=Dr&&Le==="macro-low",Sa=pr&&Le!=="micro-low",La=pr&&Le==="micro-low",Ln=C?"top":"bottom",Pn=C?"bottom":"top",$n=a.useMemo(()=>en(fn,gn),[fn,gn]),kn=a.useMemo(()=>en(hn,bn),[hn,bn]),Jr=v&&!d,yr=a.useMemo(()=>On($e,Oe,jt,Ln,$n,Dr,Jr),[$e,Oe,jt,Ln,$n,Dr,Jr]),Cn=Jr&&!p,Rr=a.useMemo(()=>On(Ge,dt,jt,Pn,kn,pr,Cn),[Ge,dt,jt,Pn,kn,pr,Cn]),Pa=a.useMemo(()=>d?{"--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% + ${Fe.lowOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Fe.lowOffsetY}px)`,"--ps-tooltip-rot":`${Fe.lowAngleDeg}deg`},[d,Fe.lowOffsetX,Fe.lowOffsetY,Fe.lowAngleDeg]),$a=a.useMemo(()=>d?{"--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% + ${Fe.highOffsetX}px)`,"--ps-tooltip-ty":`calc(-50% + ${Fe.highOffsetY}px)`,"--ps-tooltip-rot":`${Fe.highAngleDeg}deg`},[d,Fe.highOffsetX,Fe.highOffsetY,Fe.highAngleDeg]),Tr=Math.min(Ft,Ut),Nn=Math.max(Ft,Ut),ka=d?{bottom:`${Tr}%`,height:`${Nn-Tr}%`,top:"auto",left:"0",right:"0"}:{left:`${Tr}%`,width:`${Nn-Tr}%`,top:"0",bottom:"0"},Ca=Math.max(.01,Oe-$e),Yn=Math.max(.06,Math.min(.25,.28*Math.sqrt(Ca))),Na=d?{bottom:`${Ft}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:tr?40:30}:{left:`${Ft}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:tr?40:30},Ya=d?{bottom:`${Ut}%`,left:"50%",transform:"translate(-50%, 50%)",zIndex:rr?40:30}:{left:`${Ut}%`,top:"50%",transform:"translate(-50%, -50%)",zIndex:rr?40:30},Aa=d?{bottom:`${nt}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${nt}%`,top:"50%",transform:"translate(-50%, -50%)"},An=ce!==null?te(ce):null,Ea=f!=="hover"&&ce!==null&&(ce===fe||!_&&ce===be),Va=Ze?ee(w,ne[0]):Re,Ia=Ze?ee(w,ne[ne.length-1]):je,Ha=i||(me?we<=Va:_?fe<=S:fe<=S&&be<=S),ja=i||(me?ye>=Ia:(_||fe>=x)&&be>=x),lt=p?"micro-point":"micro-low",xt=i?"cursor-not-allowed opacity-50":"cursor-pointer",En=l=>{const u=d?"vertical":"horizontal",m=l==="decrease",M=Ga[u][l];return g.jsx("button",{type:"button",className:`period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${M} flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-slate-300 bg-white font-bold text-[10px] text-slate-700 leading-none shadow-2xs transition-all hover:bg-slate-100 hover:text-indigo-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 active:scale-95 disabled:cursor-not-allowed disabled:opacity-30 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 ${xt}`,onClick:()=>ya(m?-1:1),disabled:m?Ha:ja,"aria-label":m?oe:R,children:Wa[u][l]})};return g.jsxs("div",{style:e.style,className:`period-slider flex select-none items-center gap-2 ${d?"flex-col":"flex-row"} ${c}`,"data-disabled":i?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":d?"vertical":"horizontal","data-label-position":T,"data-color-scheme":W,children:[h&&En(d?"increase":"decrease"),g.jsx("div",{ref:mt,"data-testid":"period-slider-track","data-orientation":d?"vertical":"horizontal","data-vernier-orientation":me?Ct:void 0,className:`period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${d?"h-48 w-2":"h-2 w-full"} ${xt}`,onPointerDown:va,onPointerMove:Da,onPointerLeave:pa,children:me?g.jsxs(g.Fragment,{children:[Hr&&(d?g.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:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:Y,x1:"0",y1:"0",x2:"1",y2:"0",children:[g.jsx("stop",{offset:"0%",stopColor:C?F.macro:F.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:C?F.micro:F.macro,stopOpacity:Yn})]})}),g.jsx("polygon",{points:C?`12,${(1-Oe)*100} 12,${(1-$e)*100} 20,100 20,0`:`12,0 12,100 20,${(1-$e)*100} 20,${(1-Oe)*100}`,fill:`url(#${Y})`})]}):g.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:Y,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:C?F.macro:F.micro,stopOpacity:"0.28"}),g.jsx("stop",{offset:"100%",stopColor:C?F.micro:F.macro,stopOpacity:Yn})]})}),g.jsx("polygon",{points:C?`${$e*100},12 ${Oe*100},12 100,20 0,20`:`0,12 100,12 ${Oe*100},20 ${$e*100},20`,fill:`url(#${Y})`})]})),!P&&g.jsxs(g.Fragment,{children:[g.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:d?{bottom:`calc(${$e*100}% - 8px)`,height:`calc(${Math.max(0,(Oe-$e)*100)}% + 16px)`}:{left:`calc(${$e*100}% - 8px)`,width:`calc(${Math.max(0,(Oe-$e)*100)}% + 16px)`},onPointerDown:Ot("macro-connect")}),!p&&g.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:d?{bottom:`calc(${Ge*100}% - 8px)`,height:`calc(${Math.max(0,(dt-Ge)*100)}% + 16px)`}:{left:`calc(${Ge*100}% - 8px)`,width:`calc(${Math.max(0,(dt-Ge)*100)}% + 16px)`},onPointerDown:Ot("micro-connect")})]}),jr&&g.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(l=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:d?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`macro-tick-${l}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(l=>g.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:d?{bottom:`${l*100}%`}:{left:`${l*100}%`}},`micro-tick-${l}`))]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroLowerAriaLabel??"Macro range start","aria-disabled":i?"true":void 0,"aria-valuemin":ze,"aria-valuemax":He,"aria-valuenow":Ie,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(mr,O):St(O,mr,at,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":C?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,style:d?{bottom:`${$e*100}%`,left:C?0:"auto",right:C?"auto":0,transform:C?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ve==="macro-low"||Le==="macro-low"?30:15}:{left:`${$e*100}%`,top:C?0:"auto",bottom:C?"auto":0,transform:C?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ve==="macro-low"||Le==="macro-low"?30:15},onPointerDown:Ot("macro-low"),onKeyDown:xr("macro-low"),onFocus:Mr("macro-low"),"data-active":Ve==="macro-low"?"true":void 0,"data-front":Le==="macro-low"?"true":void 0,"data-vernier-pos":d?C?"left":"right":C?"top":"bottom","data-handle-type":"macro-low",children:[g.jsx(cr,{type:"macro",isTop:C,isVertical:d,isLeft:C}),ut&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":Ra?"true":void 0,"data-slanted":yr.slant.isSlanted?"true":void 0,ref:ha,style:yr.lowStyle,children:Ue(O,mr,at,y)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.macroUpperAriaLabel??"Macro range end","aria-disabled":i?"true":void 0,"aria-valuemin":Ie,"aria-valuemax":At,"aria-valuenow":He,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(fr,O):St(O,fr,at,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:right-0 after:-left-4":"after:absolute after:-inset-y-3 after:-right-4 after:left-0":C?"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0":"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,style:d?{bottom:`${Oe*100}%`,left:C?0:"auto",right:C?"auto":0,transform:C?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:Ve==="macro-high"||Le==="macro-high"?30:15}:{left:`${Oe*100}%`,top:C?0:"auto",bottom:C?"auto":0,transform:C?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:Ve==="macro-high"||Le==="macro-high"?30:15},onPointerDown:Ot("macro-high"),onKeyDown:xr("macro-high"),onFocus:Mr("macro-high"),"data-active":Ve==="macro-high"?"true":void 0,"data-front":Le==="macro-high"?"true":void 0,"data-vernier-pos":d?C?"left":"right":C?"top":"bottom","data-handle-type":"macro-high",children:[g.jsx(cr,{type:"macro",isTop:C,isVertical:d,isLeft:C}),ut&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":Ta?"true":void 0,"data-slanted":yr.slant.isSlanted?"true":void 0,ref:ba,style:yr.highStyle,children:Ue(O,fr,at,y)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":p?e.pointAriaLabel??"Micro selected date":e.lowerAriaLabel??"Micro range start","aria-disabled":i?"true":void 0,"aria-valuemin":Re,"aria-valuemax":p?je:ye,"aria-valuenow":we,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Mt,w):St(w,Mt,We,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":C?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,style:d?{bottom:`${Ge*100}%`,left:C?"auto":0,right:C?0:"auto",transform:C?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ve===lt||Le===lt?30:20}:{left:`${Ge*100}%`,top:C?"auto":0,bottom:C?0:"auto",transform:C?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ve===lt||Le===lt?30:20},onPointerDown:Ot(lt),onKeyDown:xr(lt),onFocus:Mr(lt),"data-active":Ve===lt?"true":void 0,"data-front":Le===lt?"true":void 0,"data-vernier-pos":d?C?"right":"left":C?"bottom":"top","data-handle-type":lt,children:[g.jsx(cr,{type:"micro",isTop:!C,isVertical:d,isLeft:!C}),ut&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":Sa?"true":void 0,"data-slanted":Rr.slant.isSlanted?"true":void 0,ref:Ma,style:Rr.lowStyle,children:Ue(w,Mt,We,y)})]}),!p&&g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":e.upperAriaLabel??"Micro range end","aria-disabled":i?"true":void 0,"aria-valuemin":we,"aria-valuemax":je,"aria-valuenow":ye,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(wt,w):St(w,wt,We,y),"aria-orientation":d?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${d?"is-vertical":""} group absolute touch-none ${d?C?"after:absolute after:-inset-y-3 after:-right-4 after:left-0":"after:absolute after:-inset-y-3 after:right-0 after:-left-4":C?"after:absolute after:-inset-x-3 after:top-0 after:-bottom-4":"after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,style:d?{bottom:`${dt*100}%`,left:C?"auto":0,right:C?0:"auto",transform:C?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:Ve==="micro-high"||Le==="micro-high"?30:20}:{left:`${dt*100}%`,top:C?"auto":0,bottom:C?0:"auto",transform:C?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:Ve==="micro-high"||Le==="micro-high"?30:20},onPointerDown:Ot("micro-high"),onKeyDown:xr("micro-high"),onFocus:Mr("micro-high"),"data-active":Ve==="micro-high"?"true":void 0,"data-front":Le==="micro-high"?"true":void 0,"data-vernier-pos":d?C?"right":"left":C?"bottom":"top","data-handle-type":"micro-high",children:[g.jsx(cr,{type:"micro",isTop:!C,isVertical:d,isLeft:!C}),ut&&g.jsx("div",{className:"period-slider-hairline"}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-duplicate":La?"true":void 0,"data-slanted":Rr.slant.isSlanted?"true":void 0,ref:wa,style:Rr.highStyle,children:Ue(w,wt,We,y)})]})]}):g.jsxs(g.Fragment,{children:[!P&&g.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:ka,onPointerDown:xa}),E&&$&&D.length>1&&g.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:D.map((l,u)=>{const m=ee(t,l),M=gr(u),L=d?{bottom:`${M}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${M}%`,top:"50%",transform:"translate(-50%, -50%)"};return g.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-${m}`)})}),!i&&ce!==null&&nt!==null&&ae===null&&An&&g.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:Aa,children:[g.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"}),g.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":Ea?"true":void 0,className:`period-slider-hover-tooltip ${T==="bottom"&&!d?"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:Ue(t,An,e.formatLabel,y)})]}),g.jsxs("div",{tabIndex:i?-1:0,role:"slider","aria-label":_?e.pointAriaLabel??"Selected date":e.lowerAriaLabel??"Range start","aria-disabled":i?"true":void 0,"aria-valuemin":S,"aria-valuemax":_?x:be,"aria-valuenow":fe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Kr,t):St(t,Kr,e.formatLabel,y),"aria-orientation":d?"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 ${xt}`,style:Na,onPointerDown:Rn("low"),onKeyDown:Sn("low"),onFocus:Tn("low"),"data-active":ae==="low"?"true":void 0,"data-front":tr?"true":void 0,children:[g.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)] ${ae==="low"?"":"shadow-md"}`}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":T,"data-slanted":Fe.isSlanted?"true":void 0,"data-front":tr?"true":void 0,"data-duplicate":vr&&!tr?"true":void 0,ref:fa,style:Pa,children:Ue(t,Kr,e.formatLabel,y)})]}),!_&&g.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":x,"aria-valuenow":be,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Wr,t):St(t,Wr,e.formatLabel,y),"aria-orientation":d?"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 ${xt}`,style:Ya,onPointerDown:Rn("high"),onKeyDown:Sn("high"),onFocus:Tn("high"),"data-active":ae==="high"?"true":void 0,"data-front":rr?"true":void 0,children:[g.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)] ${ae==="high"?"":"shadow-md"}`}),f!=="hover"&&g.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${f==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":f,"data-label-position":T,"data-slanted":Fe.isSlanted?"true":void 0,"data-front":rr?"true":void 0,"data-duplicate":vr&&!rr?"true":void 0,ref:ga,style:$a,children:Ue(t,Wr,e.formatLabel,y)})]})]})}),h&&En(d?"decrease":"increase")]})},tn=(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},ia=(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 o of r)if(e[o]!==t[o])return!1;return!0},Za=(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||!ia(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||!tn(e.allowedDates,t.allowedDates)?!1:e.mode==="point"&&t.mode==="point"?!((e.value?.getTime()??null)!==(t.value?.getTime()??null)||(e.defaultValue?.getTime()??null)!==(t.defaultValue?.getTime()??null)||e.onChangePoint!==t.onChangePoint):e.mode==="range"&&t.mode==="range"?!((e.range?.[0]?.getTime()??null)!==(t.range?.[0]?.getTime()??null)||(e.range?.[1]?.getTime()??null)!==(t.range?.[1]?.getTime()??null)||(e.defaultRange?.[0]?.getTime()??null)!==(t.defaultRange?.[0]?.getTime()??null)||(e.defaultRange?.[1]?.getTime()??null)!==(t.defaultRange?.[1]?.getTime()??null)||e.onChangeRange!==t.onChangeRange):e.mode==="vernier"&&t.mode==="vernier"?!((e.microRange?.[0]?.getTime()??null)!==(t.microRange?.[0]?.getTime()??null)||(e.microRange?.[1]?.getTime()??null)!==(t.microRange?.[1]?.getTime()??null)||(e.defaultMicroRange?.[0]?.getTime()??null)!==(t.defaultMicroRange?.[0]?.getTime()??null)||(e.defaultMicroRange?.[1]?.getTime()??null)!==(t.defaultMicroRange?.[1]?.getTime()??null)||(e.microValue?.getTime()??null)!==(t.microValue?.getTime()??null)||(e.defaultMicroValue?.getTime()??null)!==(t.defaultMicroValue?.getTime()??null)||e.macroRange[0].getTime()!==t.macroRange[0].getTime()||e.macroRange[1].getTime()!==t.macroRange[1].getTime()||e.vernierOrientation!==t.vernierOrientation||e.showVernierProjection!==t.showVernierProjection||e.showVernierTicks!==t.showVernierTicks||e.showHairline!==t.showHairline||e.macroUnit!==t.macroUnit||e.microUnit!==t.microUnit||e.macroIsDiscrete!==t.macroIsDiscrete||e.microIsDiscrete!==t.microIsDiscrete||e.formatMacroLabel!==t.formatMacroLabel||e.formatMicroLabel!==t.formatMicroLabel||e.onChangeMicroRange!==t.onChangeMicroRange||e.onChangeMicroPoint!==t.onChangeMicroPoint||e.onChangeMacroRange!==t.onChangeMacroRange||!tn(e.macroAllowedDates,t.macroAllowedDates)||!tn(e.microAllowedDates,t.microAllowedDates)):!1,la=a.memo(Ja,Za);la.displayName="PeriodSlider";const st=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},ur=(e,t)=>{if(Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},Qa=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)})`)}},Pt=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},Fn=e=>Pt(e,1,1),eo=e=>Pt(e,12,31),to={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},ro={year:4,month:2,day:2},no={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},Un=new Map,ao=(e,t)=>{const r=`${e}\0${t}`,n=Un.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,to[e]);return Un.set(r,o),o},rn=(e,t,r)=>r===void 0?String(no[e](t)).padStart(ro[e],"0"):ao(e,r).format(t),oo=(e,t,r)=>{const n=t?.getTime()??null,o=r?.getTime()??null,s=new Map;return e.forEach((i,c)=>{ur(`allowedDates[${c}]`,i);const h=st(i),f=h.getTime();n!==null&&f<n||o!==null&&f>o||s.has(f)||s.set(f,h)}),Array.from(s.keys()).sort((i,c)=>i-c).map(i=>s.get(i))},io=(e,t)=>{const r=[];let n=st(e);const o=st(t).getTime();for(;n.getTime()<=o;)r.push(n),n=Ne.addDays(n,1);return r},Bn=(e,t)=>{const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Ue("day",e[n],void 0,t),value:Ne.format(e[n],"yyyy-MM-dd")});return r},lo=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:s,maxYear:i,minDate:c,maxDate:h,allowedDates:f,variant:T="date",className:v="",style:d,disabled:P=!1,prevDateAriaLabel:E="Previous day",nextDateAriaLabel:W="Next day",selectAriaLabel:y="Date",yearAriaLabel:oe="Year",monthAriaLabel:R="Month",dayAriaLabel:X="Day",locale:p,formatYearOption:F,formatMonthOption:Y,formatDayOption:A}=e;if(Qa(p),t!==void 0&&ur("value",t),r!==void 0&&ur("initialDate",r),c!==void 0&&ur("minDate",c),h!==void 0&&ur("maxDate",h),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(T==="split-dropdown"&&f!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const V=t??r;if(V===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[j,D]=a.useState(()=>st(V)),$=t!==void 0,S=t?.getTime(),x=a.useMemo(()=>t!==void 0?st(t):j,[S,j]),_=c?.getTime(),te=h?.getTime(),G=a.useMemo(()=>{const b=c?st(c):null,I=s!==void 0?Fn(s):null;return b===null?I:I===null||b.getTime()>=I.getTime()?b:I},[_,s]),ue=a.useMemo(()=>{const b=h?st(h):null,I=i!==void 0?eo(i):null;return b===null?I:I===null||b.getTime()<=I.getTime()?b:I},[te,i]),Me=G?.getTime()??null,ie=ue?.getTime()??null;if(G!==null&&ue!==null&&G.getTime()>ue.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Ne.format(G,"yyyy-MM-dd")} is after max ${Ne.format(ue,"yyyy-MM-dd")})`);if(T!=="date"&&f===void 0&&(G===null||ue===null))throw new RangeError(`DateSelector: variant="${T}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${T==="dropdown"?' or supply "allowedDates"':""}`);const re=f===void 0?null:f.map(b=>b.getTime()).join(","),Q=a.useMemo(()=>f===void 0?null:oo(f,G,ue),[re,Me,ie]),he=b=>{const I=b.getTime();return Q!==null?Q.some(Ee=>Ee.getTime()===I):!(Me!==null&&I<Me||ie!==null&&I>ie)},Xe=V.getTime();a.useEffect(()=>{$||D(st(V))},[$,Xe]);const q=b=>{if(P)return;const I=st(b);he(I)&&($||D(I),n?.(I))},J=x.getTime(),le=he(x),N=a.useMemo(()=>{if(Q!==null){for(let I=Q.length-1;I>=0;I--)if(Q[I].getTime()<J)return Q[I];return null}const b=Ne.addDays(new Date(J),-1);return he(b)?b:null},[Q,J,Me,ie]),U=a.useMemo(()=>{if(Q!==null){for(const I of Q)if(I.getTime()>J)return I;return null}const b=Ne.addDays(new Date(J),1);return he(b)?b:null},[Q,J,Me,ie]),se=P||N===null,ge=P||U===null,Se=()=>{N!==null&&q(N)},Be=()=>{U!==null&&q(U)},Ke=b=>{if(b.target.value){const I=Ne.parseISO(b.target.value);Number.isNaN(I.getTime())||q(I)}},rt=b=>{if(b.target.value){const I=Ne.parseISO(b.target.value);Number.isNaN(I.getTime())||q(I)}},ae=x.getFullYear(),pe=x.getMonth()+1,Ye=x.getDate(),kt=a.useMemo(()=>T!=="dropdown"?[]:Q!==null?Bn(Q,p):G===null||ue===null?[]:Bn(io(G,ue),p),[T,Q,Me,ie,p]),K=a.useMemo(()=>{if(T!=="split-dropdown"||G===null||ue===null)return[];const b=[];for(let I=ue.getFullYear();I>=G.getFullYear();I--)b.push(I);return b},[T,Me,ie]),ce=a.useMemo(()=>{if(T!=="split-dropdown"||G===null||ue===null)return[];const b=G,I=ue,Ee=ae===b.getFullYear()?b.getMonth()+1:1,Nt=ae===I.getFullYear()?I.getMonth()+1:12,at=[];for(let We=Ee;We<=Nt;We++)at.push(We);return at},[T,Me,ie,ae]),ht=a.useMemo(()=>{if(T!=="split-dropdown"||G===null||ue===null)return[];const b=G,I=ue,Ee=ae===b.getFullYear()&&pe===b.getMonth()+1?b.getDate():1,Nt=ae===I.getFullYear()&&pe===I.getMonth()+1?I.getDate():Ne.getDaysInMonth(new Date(J)),at=[];for(let We=Ee;We<=Nt;We++)at.push(We);return at},[T,Me,ie,J,ae,pe]),nt=(b,I,Ee)=>Ee>Ne.getDaysInMonth(Pt(b,I,1))?!1:he(Pt(b,I,Ee)),ct=(b,I,Ee)=>{nt(b,I,Ee)&&q(Pt(b,I,Ee))},fe=b=>F?F(b):rn("year",Fn(b),p),be=b=>Y?Y(b):rn("month",Pt(ae,b,1),p),Wt=b=>A?A(b):rn("day",Pt(ae,pe,b),p),me=Ne.format(x,"yyyy-MM-dd"),Ct=Ue("day",x,void 0,p),C=G?Ne.format(G,"yyyy-MM-dd"):void 0,Hr=ue?Ne.format(ue,"yyyy-MM-dd"):void 0,jr=le?me:"",ut="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",O=T==="split-dropdown"?"w-auto":"w-38";return g.jsxs("div",{className:`inline-flex items-center ${O} ${v}`,style:d,"data-variant":T,"data-out-of-range":le?void 0:"true",children:[g.jsx("button",{type:"button","aria-label":E,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:Se,children:g.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"?g.jsxs("select",{"aria-label":y,disabled:P,className:"mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:jr,onChange:rt,children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:Ct}),kt.map(b=>g.jsx("option",{value:b.value,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:b.label},b.value))]}):T==="split-dropdown"?g.jsxs("div",{className:"mx-1 my-auto inline-flex items-center gap-1",children:[g.jsxs("select",{"aria-label":oe,disabled:P,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?ae:"",onChange:b=>ct(Number(b.target.value),pe,Ye),children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:fe(ae)}),K.map(b=>g.jsx("option",{value:b,disabled:!nt(b,pe,Ye),className:"dark:bg-slate-700 dark:text-slate-100",children:fe(b)},b))]}),g.jsxs("select",{"aria-label":R,disabled:P,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?pe:"",onChange:b=>ct(ae,Number(b.target.value),Ye),children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:be(pe)}),ce.map(b=>g.jsx("option",{value:b,disabled:!nt(ae,b,Ye),className:"dark:bg-slate-700 dark:text-slate-100",children:be(b)},b))]}),g.jsxs("select",{"aria-label":X,disabled:P,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?Ye:"",onChange:b=>ct(ae,pe,Number(b.target.value)),children:[le?null:g.jsx("option",{value:"",disabled:!0,className:ut,children:Wt(Ye)}),ht.map(b=>g.jsx("option",{value:b,className:"dark:bg-slate-700 dark:text-slate-100",children:Wt(b)},b))]})]}):g.jsx("input",{"aria-label":y,disabled:P,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:me,min:C,max:Hr,onChange:Ke,type:"date"}),g.jsx("button",{type:"button","aria-label":W,disabled:ge,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:Be,children:g.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]})},Xt=e=>e===void 0?null:st(e).getTime(),sa=a.memo(lo,(e,t)=>!(Xt(e.value??e.initialDate)!==Xt(t.value??t.initialDate)||Xt(e.minDate)!==Xt(t.minDate)||Xt(e.maxDate)!==Xt(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));sa.displayName="DateSelector";function Je(e,t){const r=e+Math.floor(t/12),n=(t%12+12)%12,o=new Date(r,n,1);return o.setFullYear(r),o}function Lt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`}function sr(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 zn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function so(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 co(e,t){const r=e===void 0?null:Je(e,0),n=t===void 0?null:Je(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function uo(e,t){const r=e===void 0?null:Je(e,11),n=t===void 0?null:Je(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function mo(e,t,r){const n=new Map;for(const o of e){const s=Je(o.getFullYear(),o.getMonth());t!==null&&s<t||r!==null&&s>r||n.has(s.getTime())||n.set(s.getTime(),s)}return Array.from(n.values()).sort((o,s)=>o.getTime()-s.getTime())}function fo(e,t){const r=e.getFullYear()*12+e.getMonth(),n=t.getFullYear()*12+t.getMonth(),o=[];for(let s=r;s<=n;s++)o.push(Je(Math.floor(s/12),s%12));return o}function _n(e,t){const r=[];for(let n=e.length-1;n>=0;n--)r.push({label:Ue("month",e[n],void 0,t),value:Lt(e[n])});return r}const go=e=>{const{value:t,initialDate:r,onChange:n,children:o,variant:s="date",minYear:i,maxYear:c,minDate:h,maxDate:f,allowedMonths:T,isWarning:v=!1,className:d="",style:P,disabled:E=!1,prevMonthAriaLabel:W="Previous month",nextMonthAriaLabel:y="Next month",selectAriaLabel:oe="Month",locale:R}=e;so(R),sr(t,"value"),sr(r,"initialDate"),sr(h,"minDate"),sr(f,"maxDate"),zn(i,"minYear"),zn(c,"maxYear"),T?.forEach((K,ce)=>{sr(K,`allowedMonths[${ce}]`)});const X=t??r;if(X===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[p,F]=a.useState(()=>Je(X.getFullYear(),X.getMonth())),Y=t!==void 0,A=a.useMemo(()=>t!==void 0?Je(t.getFullYear(),t.getMonth()):p,[t?.getTime(),p]),V=h?.getTime(),j=f?.getTime(),D=a.useMemo(()=>co(i,h),[i,V]),$=a.useMemo(()=>uo(c,f),[c,j]),S=D?.getTime()??null,x=$?.getTime()??null;if(D!==null&&$!==null&&D>$)throw new RangeError(`MonthSelector: the resolved lower bound ${Lt(D)} is after the resolved upper bound ${Lt($)}.`);if(s==="dropdown"&&T===void 0&&(D===null||$===null))throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`), or `allowedMonths`; the option window is never invented.');const _=T===void 0?null:T.map(K=>K.getTime()).join(","),te=a.useMemo(()=>T===void 0?null:mo(T,D,$),[_,S,x]),G=K=>{const ce=K.getTime();return te!==null?te.some(ht=>ht.getTime()===ce):!(S!==null&&ce<S||x!==null&&ce>x)},ue=X.getTime();a.useEffect(()=>{if(Y)return;const K=Je(X.getFullYear(),X.getMonth());F(ce=>ce.getTime()===K.getTime()?ce:K)},[Y,ue]);const Me=K=>{if(E)return;if(!G(K))throw new RangeError(`MonthSelector: refusing to emit ${Lt(K)}, which lies outside the selectable months.`);Y||F(K);const ce=K.getFullYear()*100+(K.getMonth()+1);n?.(K,ce)},ie=A.getTime(),re=G(A),Q=a.useMemo(()=>{if(te!==null){for(let ce=te.length-1;ce>=0;ce--)if(te[ce].getTime()<ie)return te[ce];return null}const K=Je(A.getFullYear(),A.getMonth()-1);return G(K)?K:null},[te,ie,S,x]),he=a.useMemo(()=>{if(te!==null){for(const ce of te)if(ce.getTime()>ie)return ce;return null}const K=Je(A.getFullYear(),A.getMonth()+1);return G(K)?K:null},[te,ie,S,x]),Xe=E||Q===null,q=E||he===null,J=()=>{Q!==null&&Me(Q)},le=()=>{he!==null&&Me(he)},N=K=>{if(!K)return;const[ce,ht]=K.split("-"),nt=Number(ce),ct=Number(ht)-1;if(!(Number.isInteger(nt)&&Number.isInteger(ct)))return;const fe=Je(nt,ct);G(fe)&&Me(fe)},U=K=>{N(K.target.value)},se=K=>{N(K.target.value)},ge=Lt(A),Se=Ue("month",A,void 0,R),Be=D?Lt(D):void 0,Ke=$?Lt($):void 0,rt=a.useMemo(()=>s!=="dropdown"?[]:te!==null?_n(te,R):D===null||$===null?[]:_n(fo(D,$),R),[s,te,S,x,R]),ae=re?ge:"",pe=v?"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",Ye=`mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${pe}`,kt=`mx-1 my-auto w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${pe}`;return g.jsxs("div",{className:`inline-flex w-38 items-center ${d}`,style:P,"data-out-of-range":re?void 0:"true",children:[g.jsx("button",{type:"button","aria-label":W,disabled:Xe,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:J,children:g.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"?g.jsxs("select",{"aria-label":oe,disabled:E,className:kt,value:ae,onChange:se,children:[re?null:g.jsx("option",{value:"",disabled:!0,className:"text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400",children:Se}),rt.map(K=>g.jsx("option",{value:K.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:K.label},K.value))]}):g.jsx("input",{"aria-label":oe,disabled:E,className:Ye,value:ge,min:Be,max:Ke,onChange:U,type:"month"}),g.jsx("button",{type:"button","aria-label":y,disabled:q,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:le,children:g.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]})},ca=a.memo(go,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,o=r?r.getFullYear()*12+r.getMonth():null,s=n?n.getFullYear()*12+n.getMonth():null;if(o!==s||e.variant!==t.variant||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.isWarning!==t.isWarning||e.minYear!==t.minYear||e.maxYear!==t.maxYear)return!1;const i=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,c=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(i!==c)return!1;const h=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,f=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(h!==f||e.allowedMonths!==t.allowedMonths||e.onChange!==t.onChange||e.children!==t.children||e.prevMonthAriaLabel!==t.prevMonthAriaLabel||e.nextMonthAriaLabel!==t.nextMonthAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});ca.displayName="MonthSelector";function Kt(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(Kt(e,"minDate",t),Kt(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 Nr(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(Kt(e,`${t}[0]`,r[0]),Kt(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 Yr(e,t,r,n,o,s){if(r.getTime()<n.getTime()||r.getTime()>o.getTime())throw new RangeError(`${e}: ${t} must lie within ${s} (value: ${r.toISOString()}, lower: ${n.toISOString()}, upper: ${o.toISOString()})`)}function Ar(e,t,r,n,o,s){Yr(e,`${t}[0]`,r[0],n,o,s),Yr(e,`${t}[1]`,r[1],n,o,s)}function Ce(e,t,r){return e<t?t:e>r?r:e}function Pr(e,t,r,n){const o=qe(t,r,n[1]);return[Ce(e[0],n[0],o),Ce(e[1],n[0],o)]}function $r(e,t,r,n){return Ce(e,n[0],qe(t,r,n[1]))}function Er(e,t,r,n){const o=Te(e,r,t)+n;return e[Math.max(0,Math.min(e.length-1,o))]}function Ir(e){const t=a.useRef(e),r=t.current,n=e,o=Object.keys(r),s=Object.keys(n);return o.length===s.length&&s.every(c=>Object.is(r[c],n[c]))||(t.current=e),t.current}function ho(e){const{unit:t,minDate:r,maxDate:n,initialRange:o,onChangeRange:s,...i}=e;Vr("usePeriodSliderRange",r,n),Nr("usePeriodSliderRange","initialRange",o),Ar("usePeriodSliderRange","initialRange",o,r,n,"[minDate, maxDate]");const c=Ir(i),h=a.useRef(o),[f,T]=a.useState(o);let v=f;const d=[Ce(f[0],r,n),Ce(f[1],r,n)];(d[0]!==f[0]||d[1]!==f[1])&&(v=d,T(d));const P=a.useRef(v);P.current=v;const E=a.useRef({minDate:r,maxDate:n,allowedDates:c.allowedDates});E.current={minDate:r,maxDate:n,allowedDates:c.allowedDates};const W=a.useRef(s);W.current=s;const y=a.useCallback(j=>{const{minDate:D,maxDate:$}=E.current,S=Ce(j[0],D,$),x=Ce(j[1],D,$),_=P.current;S.getTime()===_[0].getTime()&&x.getTime()===_[1].getTime()||(P.current=[S,x],T([S,x]),W.current?.(S,x))},[]),oe=a.useCallback(j=>{const D=P.current,$=j.getTime()>D[1].getTime()?j:D[1];y([j,$])},[y]),R=a.useCallback(j=>{const D=P.current,$=j.getTime()<D[0].getTime()?j:D[0];y([$,j])},[y]),X=a.useCallback((j,D)=>{y([j,D])},[y]),p=a.useCallback(j=>{const{minDate:D,maxDate:$,allowedDates:S}=E.current,x=P.current,_=$t(S,t,D,$);if(_.length>0){y([Er(_,t,x[0],j),Er(_,t,x[1],j)]);return}y([ke(t,x[0],j),ke(t,x[1],j)])},[t,y]),F=a.useCallback(()=>{y(h.current)},[y]),Y=a.useMemo(()=>({value:v[0],onChange:oe,minDate:r,maxDate:v[1],unit:t}),[v[0],v[1],oe,r,t]),A=a.useMemo(()=>({value:v[1],onChange:R,minDate:v[0],maxDate:n,unit:t}),[v[0],v[1],R,n,t]),V=a.useMemo(()=>({...c,mode:"range",unit:t,range:v,minDate:r,maxDate:n,onChangeRange:X}),[c,t,v,r,n,X]);return{range:v,lowerDate:v[0],upperDate:v[1],setRange:T,setLowerDate:oe,setUpperDate:R,shiftRange:p,resetRange:F,startSelectorProps:Y,endSelectorProps:A,sliderProps:V}}function bo(e){const{unit:t,minDate:r,maxDate:n,initialValue:o,onChangePoint:s,...i}=e;Vr("usePeriodSliderPoint",r,n),Kt("usePeriodSliderPoint","initialValue",o),Yr("usePeriodSliderPoint","initialValue",o,r,n,"[minDate, maxDate]");const c=Ir(i),h=a.useRef(o),[f,T]=a.useState(o);let v=f;const d=Ce(f,r,n);d!==f&&(v=d,T(d));const P=a.useRef(v);P.current=v;const E=a.useRef({minDate:r,maxDate:n,allowedDates:c.allowedDates});E.current={minDate:r,maxDate:n,allowedDates:c.allowedDates};const W=a.useRef(s);W.current=s;const y=a.useCallback(F=>{const{minDate:Y,maxDate:A}=E.current,V=Ce(F,Y,A);V.getTime()!==P.current.getTime()&&(P.current=V,T(V),W.current?.(V))},[]),oe=a.useCallback(F=>{const{minDate:Y,maxDate:A,allowedDates:V}=E.current,j=$t(V,t,Y,A);if(j.length>0){y(Er(j,t,P.current,F));return}y(ke(t,P.current,F))},[t,y]),R=a.useCallback(()=>{y(h.current)},[y]),X=a.useMemo(()=>({value:v,onChange:y,minDate:r,maxDate:n,unit:t}),[v,y,r,n,t]),p=a.useMemo(()=>({...c,mode:"point",unit:t,value:v,minDate:r,maxDate:n,onChangePoint:y}),[c,t,v,r,n,y]);return{value:v,setValue:T,shiftValue:oe,resetValue:R,selectorProps:X,sliderProps:p}}function Mo(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroRange:s,macroUnit:i=t,microUnit:c=t,onChangeMacroRange:h,onChangeMicroRange:f,...T}=e;Vr("useVernierSlider",r,n),Nr("useVernierSlider","initialMacroRange",o),Nr("useVernierSlider","initialMicroRange",s),Ar("useVernierSlider","initialMacroRange",o,r,n,"[minDate, maxDate]"),Ar("useVernierSlider","initialMicroRange",s,o[0],qe(i,c,o[1]),"the initial macro window");const v=Ir(T),d=a.useRef(o),P=a.useRef(s),[E,W]=a.useState(o),[y,oe]=a.useState(s);let R=E;const X=[Ce(E[0],r,n),Ce(E[1],r,n)];(X[0]!==E[0]||X[1]!==E[1])&&(R=X,W(X));let p=y;const F=Pr(y,i,c,R);(F[0]!==y[0]||F[1]!==y[1])&&(p=F,oe(F));const Y=a.useRef(R);Y.current=R;const A=a.useRef(p);A.current=p;const V=a.useRef({minDate:r,maxDate:n});V.current={minDate:r,maxDate:n};const j=a.useRef(h);j.current=h;const D=a.useRef(f);D.current=f;const $=a.useCallback((N,U)=>{const se=Y.current,ge=A.current;(N[0].getTime()!==se[0].getTime()||N[1].getTime()!==se[1].getTime())&&(Y.current=N,W(N),j.current?.(N[0],N[1])),(U[0].getTime()!==ge[0].getTime()||U[1].getTime()!==ge[1].getTime())&&(A.current=U,oe(U),D.current?.(U[0],U[1]))},[]),S=a.useCallback((N,U)=>{const{minDate:se,maxDate:ge}=V.current,Se=[Ce(N,se,ge),Ce(U,se,ge)];$(Se,Pr(A.current,i,c,Se))},[i,c,$]),x=a.useCallback((N,U)=>{$(Y.current,Pr([N,U],i,c,Y.current))},[i,c,$]),_=a.useCallback(N=>{const U=Y.current[1],se=N>U?N:U;S(N,se)},[S]),te=a.useCallback(N=>{const U=Y.current[0],se=N<U?N:U;S(se,N)},[S]),G=a.useCallback(N=>{const U=A.current[1],se=N>U?N:U;x(N,se)},[x]),ue=a.useCallback(N=>{const U=A.current[0],se=N<U?N:U;x(se,N)},[x]),Me=a.useCallback(N=>{const{minDate:U,maxDate:se}=V.current,ge=Y.current,Se=ke(i,ge[0],N),Be=ke(i,ge[1],N);Se<U||Be>se||S(Se,Be)},[i,S]),ie=a.useCallback(N=>{const U=Y.current,se=A.current,ge=ke(c,se[0],N),Se=ke(c,se[1],N);ge<U[0]||Se>qe(i,c,U[1])||x(ge,Se)},[i,c,x]),re=a.useCallback(()=>{const N=d.current;$(N,Pr(P.current,i,c,N))},[i,c,$]),Q=a.useMemo(()=>qe(i,c,R[1]),[i,c,R[1]]),he=a.useMemo(()=>({value:R[0],onChange:_,minDate:r,maxDate:R[1],unit:i}),[R,_,r,i]),Xe=a.useMemo(()=>({value:R[1],onChange:te,minDate:R[0],maxDate:n,unit:i}),[R,te,n,i]),q=a.useMemo(()=>({value:p[0],onChange:G,minDate:R[0],maxDate:p[1],unit:c}),[p,G,R,c]),J=a.useMemo(()=>({value:p[1],onChange:ue,minDate:p[0],maxDate:Q,unit:c}),[p,ue,Q,c]),le=a.useMemo(()=>({...v,mode:"vernier",unit:t,macroUnit:i,microUnit:c,minDate:r,maxDate:n,macroRange:R,microRange:p,onChangeMacroRange:S,onChangeMicroRange:x}),[v,t,i,c,r,n,R,p,S,x]);return{macroRange:R,setMacroRange:W,microRange:p,setMicroRange:oe,setMacroLowerDate:_,setMacroUpperDate:te,setMicroLowerDate:G,setMicroUpperDate:ue,shiftMacroRange:Me,shiftMicroRange:ie,resetVernier:re,macroStartSelectorProps:he,macroEndSelectorProps:Xe,microStartSelectorProps:q,microEndSelectorProps:J,sliderProps:le}}function wo(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroValue:s,macroUnit:i=t,microUnit:c=t,onChangeMacroRange:h,onChangeMicroPoint:f,...T}=e;Vr("useVernierSliderPoint",r,n),Nr("useVernierSliderPoint","initialMacroRange",o),Kt("useVernierSliderPoint","initialMicroValue",s),Ar("useVernierSliderPoint","initialMacroRange",o,r,n,"[minDate, maxDate]"),Yr("useVernierSliderPoint","initialMicroValue",s,o[0],qe(i,c,o[1]),"the initial macro window");const v=Ir(T),d=a.useRef(o),P=a.useRef(s),[E,W]=a.useState(o),[y,oe]=a.useState(s);let R=E;const X=[Ce(E[0],r,n),Ce(E[1],r,n)];(X[0]!==E[0]||X[1]!==E[1])&&(R=X,W(X));let p=y;const F=$r(y,i,c,R);F!==y&&(p=F,oe(F));const Y=a.useRef(R);Y.current=R;const A=a.useRef(p);A.current=p;const V=a.useRef({minDate:r,maxDate:n,microIsDiscrete:v.microIsDiscrete,microAllowedDates:v.microAllowedDates,allowedDates:v.allowedDates});V.current={minDate:r,maxDate:n,microIsDiscrete:v.microIsDiscrete,microAllowedDates:v.microAllowedDates,allowedDates:v.allowedDates};const j=a.useRef(h);j.current=h;const D=a.useRef(f);D.current=f;const $=a.useCallback((q,J)=>{const le=Y.current,N=A.current;(q[0].getTime()!==le[0].getTime()||q[1].getTime()!==le[1].getTime())&&(Y.current=q,W(q),j.current?.(q[0],q[1])),J.getTime()!==N.getTime()&&(A.current=J,oe(J),D.current?.(J))},[]),S=a.useCallback((q,J)=>{const{minDate:le,maxDate:N}=V.current,U=[Ce(q,le,N),Ce(J,le,N)];$(U,$r(A.current,i,c,U))},[i,c,$]),x=a.useCallback(q=>{$(Y.current,$r(q,i,c,Y.current))},[i,c,$]),_=a.useCallback(q=>{const J=Y.current[1],le=q>J?q:J;S(q,le)},[S]),te=a.useCallback(q=>{const J=Y.current[0],le=q<J?q:J;S(le,q)},[S]),G=a.useCallback(q=>{const{minDate:J,maxDate:le}=V.current,N=Y.current,U=ke(i,N[0],q),se=ke(i,N[1],q);U<J||se>le||S(U,se)},[i,S]),ue=a.useCallback(q=>{const J=Y.current,le=qe(i,c,J[1]),{microIsDiscrete:N,microAllowedDates:U,allowedDates:se,minDate:ge,maxDate:Se}=V.current,Be=N===!0?$t(U??se,c,ge,Se):[],Ke=J[0].getTime(),rt=le.getTime(),ae=Be.filter(pe=>pe.getTime()>=Ke&&pe.getTime()<=rt);if(ae.length>0){x(Er(ae,c,A.current,q));return}x(ke(c,A.current,q))},[i,c,x]),Me=a.useCallback(()=>{const q=d.current;$(q,$r(P.current,i,c,q))},[i,c,$]),ie=a.useMemo(()=>qe(i,c,R[1]),[i,c,R[1]]),re=a.useMemo(()=>({value:R[0],onChange:_,minDate:r,maxDate:R[1],unit:i}),[R,_,r,i]),Q=a.useMemo(()=>({value:R[1],onChange:te,minDate:R[0],maxDate:n,unit:i}),[R,te,n,i]),he=a.useMemo(()=>({value:p,onChange:x,minDate:R[0],maxDate:ie,unit:c}),[p,x,R,ie,c]),Xe=a.useMemo(()=>({...v,mode:"vernier",unit:t,macroUnit:i,microUnit:c,minDate:r,maxDate:n,macroRange:R,microValue:p,onChangeMacroRange:S,onChangeMicroPoint:x}),[v,t,i,c,r,n,R,p,S,x]);return{macroRange:R,setMacroRange:W,microValue:p,setMicroValue:oe,setMacroLowerDate:_,setMacroUpperDate:te,setMicroDate:x,shiftMacroRange:G,shiftMicroValue:ue,resetVernier:Me,macroStartSelectorProps:re,macroEndSelectorProps:Q,microSelectorProps:he,sliderProps:Xe}}function qn(e){const t=new Date(e,0,1);return t.setFullYear(e),t}function kr(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 Xn(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function xo(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 Kn(e,t,r){const n=e===void 0?null:e,o=t===void 0?null:t.getFullYear();return n!==null&&o!==null?r(n,o):n!==null?n:o}const vo=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:s,maxYear:i,minDate:c,maxDate:h,className:f="",style:T,disabled:v=!1,prevYearAriaLabel:d="Previous year",nextYearAriaLabel:P="Next year",selectAriaLabel:E="Year",locale:W}=e;kr(t,"value"),kr(r,"initialDate"),kr(c,"minDate"),kr(h,"maxDate"),Xn(s,"minYear"),Xn(i,"maxYear"),xo(W);const y=t??r;if(y===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[oe,R]=a.useState(()=>y.getFullYear()),X=c?.getTime(),p=h?.getTime(),F=a.useMemo(()=>Kn(s,c,Math.max),[s,X]),Y=a.useMemo(()=>Kn(i,h,Math.min),[i,p]);if(F===null||Y===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(F>Y)throw new RangeError(`YearSelector: the resolved lower bound ${F} is after the resolved upper bound ${Y}.`);const A=t!==void 0,V=t!==void 0?t.getFullYear():oe,j=V<F||V>Y,D=y.getTime();a.useEffect(()=>{A||R(y.getFullYear())},[A,D]);const $=re=>re>=F&&re<=Y,S=re=>{if(!v){if(!$(re))throw new RangeError(`YearSelector: refusing to emit ${re}, which lies outside the declared bounds ${F}-${Y}.`);A||R(re),n?.(qn(re),re)}},x=$(V-1)?V-1:null,_=$(V+1)?V+1:null,te=v||x===null,G=v||_===null,ue=()=>{x!==null&&S(x)},Me=()=>{_!==null&&S(_)},ie=a.useMemo(()=>{const re=[];for(let Q=Y;Q>=F;Q--)re.push(Q);return j&&(re.push(V),re.sort((Q,he)=>he-Q)),re},[F,Y,j,V]);return g.jsxs("div",{className:`inline-flex w-32 items-center ${f}`,style:T,children:[g.jsx("button",{type:"button","aria-label":d,disabled:te,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:g.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"})}),g.jsx("select",{"aria-label":E,disabled:v,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:V,onChange:re=>{if(!re.target.value)return;const Q=Number(re.target.value);Number.isInteger(Q)&&S(Q)},children:ie.map(re=>g.jsx("option",{value:re,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:Ue("year",qn(re),void 0,W)},re))}),g.jsx("button",{type:"button","aria-label":P,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:Me,children:g.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]})},ua=a.memo(vo,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,o=r?r.getFullYear():null,s=n?n.getFullYear():null;return!(o!==s||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||e.minDate?.getFullYear()!==t.minDate?.getFullYear()||e.maxDate?.getFullYear()!==t.maxDate?.getFullYear()||e.onChange!==t.onChange||e.children!==t.children||e.prevYearAriaLabel!==t.prevYearAriaLabel||e.nextYearAriaLabel!==t.nextYearAriaLabel||e.selectAriaLabel!==t.selectAriaLabel||e.locale!==t.locale)});ua.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=Wn;exports.DateSelector=sa;exports.MonthSelector=ca;exports.PeriodSlider=la;exports.YearSelector=ua;exports.addUnit=ke;exports.areStylesEqual=ia;exports.calculateConnectDragValues=Jn;exports.calculateHandleDragValues=nn;exports.calculateKeyboardActionValues=Zn;exports.calculateLabelSlant=ln;exports.calculateVernierMacroDrag=aa;exports.calculateVernierMicroDrag=oa;exports.decode=de;exports.encode=ee;exports.findNearestDateIndex=Te;exports.formatLabel=Ue;exports.formatScreenReaderLabel=St;exports.getActiveDragHandle=Gn;exports.getMacroWindowEndDate=qe;exports.getSortedAllowedDates=$t;exports.normalizeDateByUnit=tt;exports.resolveVernierTargetHandle=na;exports.usePeriodSliderPoint=bo;exports.usePeriodSliderRange=ho;exports.useVernierSlider=Mo;exports.useVernierSliderPoint=wo;
|
package/dist/index.d.cts
CHANGED
|
@@ -19,10 +19,10 @@ export type { DateSelectorProps } from './DateSelector.js';
|
|
|
19
19
|
export { DateSelector } from './DateSelector.js';
|
|
20
20
|
export type { MonthSelectorProps } from './MonthSelector.js';
|
|
21
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';
|
|
22
|
+
export type { AccessibleSliderLabels, BasePeriodSliderProps, BasePeriodSliderVernierProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierPointProps, PeriodSliderVernierProps, PeriodSliderVernierRangeProps, VernierHandle, VernierMicroShape, } from './PeriodSlider.js';
|
|
23
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';
|
|
24
|
+
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn, UseVernierSliderOptions, UseVernierSliderPointOptions, UseVernierSliderPointReturn, UseVernierSliderReturn, } from './usePeriodSlider.js';
|
|
25
|
+
export { usePeriodSliderPoint, usePeriodSliderRange, useVernierSlider, useVernierSliderPoint, } from './usePeriodSlider.js';
|
|
26
26
|
export type { YearSelectorProps } from './YearSelector.js';
|
|
27
27
|
export { YearSelector } from './YearSelector.js';
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -19,10 +19,10 @@ export type { DateSelectorProps } from './DateSelector.js';
|
|
|
19
19
|
export { DateSelector } from './DateSelector.js';
|
|
20
20
|
export type { MonthSelectorProps } from './MonthSelector.js';
|
|
21
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';
|
|
22
|
+
export type { AccessibleSliderLabels, BasePeriodSliderProps, BasePeriodSliderVernierProps, ColorSchemePalette, ConnectDragValueOptions, LabelSlantConfig, LabelSlantResult, PeriodSliderColorScheme, PeriodSliderLabelPosition, PeriodSliderPointProps, PeriodSliderProps, PeriodSliderRangeProps, PeriodSliderSnapMode, PeriodSliderUnit, PeriodSliderVernierPointProps, PeriodSliderVernierProps, PeriodSliderVernierRangeProps, VernierHandle, VernierMicroShape, } from './PeriodSlider.js';
|
|
23
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';
|
|
24
|
+
export type { SelectorProps, UsePeriodSliderPointOptions, UsePeriodSliderPointReturn, UsePeriodSliderRangeOptions, UsePeriodSliderRangeReturn, UseVernierSliderOptions, UseVernierSliderPointOptions, UseVernierSliderPointReturn, UseVernierSliderReturn, } from './usePeriodSlider.js';
|
|
25
|
+
export { usePeriodSliderPoint, usePeriodSliderRange, useVernierSlider, useVernierSliderPoint, } from './usePeriodSlider.js';
|
|
26
26
|
export type { YearSelectorProps } from './YearSelector.js';
|
|
27
27
|
export { YearSelector } from './YearSelector.js';
|
|
28
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EACR,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EACR,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,6BAA6B,EAC7B,aAAa,EACb,iBAAiB,GACpB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACH,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,EACN,MAAM,EACN,oBAAoB,EACpB,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,0BAA0B,GAC7B,MAAM,gBAAgB,CAAA;AAIvB,YAAY,EACR,aAAa,EACb,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAC3B,sBAAsB,GACzB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACH,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|