@aiquants/period-slider 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),lt=require("date-fns"),i=require("react"),Ot=require("@aiquants/virtualscroll"),vl=require("react-dom"),Pa=120,io="data-drag-snap",lo="--ps-drag-snap-duration",jr={flat:["--ps-drag-low","--ps-drag-high"],macro:["--ps-drag-macro-low","--ps-drag-macro-high"],micro:["--ps-drag-micro-low","--ps-drag-micro-high"]},Ja=["low","high"],ei=["tx","ty","rot"],Tn={flat:{low:"--ps-drag-label-low",high:"--ps-drag-label-high"},macro:{low:"--ps-drag-macro-label-low",high:"--ps-drag-macro-label-high"},micro:{low:"--ps-drag-micro-label-low",high:"--ps-drag-micro-label-high"}},yo=(e,t)=>`${e}-${t}`,so=(e,t,r)=>`var(${yo(e,t)}, ${r})`,Dl=(e,t,r)=>{const n=Tn[t];for(const o of Ja)for(const a of ei)e.style.setProperty(yo(n[o],a),r[o][a])},ti=e=>Math.max(0,Math.min(1,e)),pn=(e,t,r,n)=>{const o=ti(t);if(e==="point")return[o,o];const a=e==="low"?n:r;return[Math.min(o,a),Math.max(o,a)]},To=(e,t,r)=>{const n=r-t,o=Math.max(0,Math.min(1-n,t+e));return[o,o+n]},Pn=(e,t,r,n)=>{const o=ti(t);return e==="low"?o>n?"high":"low":o<r?"low":"high"},co=(e,t,r,n)=>{if(r){const l=(1-e)*100,c=(1-t)*100;return n?`M 12 ${c} L 12 ${l} L 20 100 L 20 0 Z`:`M 12 0 L 12 100 L 20 ${l} L 20 ${c} Z`}const o=e*100,a=t*100;return n?`M ${o} 12 L ${a} 12 L 100 20 L 0 20 Z`:`M 0 12 L 100 12 L ${a} 20 L ${o} 20 Z`},$t=(e,t)=>`var(${e}, ${t}%)`,pl=(e,t,r,n)=>{const[o,a]=jr[t];e.style.setProperty(o,`${r*100}%`),e.style.setProperty(a,`${n*100}%`)},Ml=e=>{for(const[t,r]of Object.values(jr))e.style.removeProperty(t),e.style.removeProperty(r);for(const t of Object.values(Tn))for(const r of Ja)for(const n of ei)e.style.removeProperty(yo(t[r],n))},ri=["rangeStart","rangeEnd","selectedDate","macroRangeStart","macroRangeEnd","microRangeStart","microRangeEnd","microSelectedDate","decrease","increase","previousYear","nextYear","yearSelect","previousMonth","nextMonth","monthSelect","previousDay","nextDay","dateSelect","splitYear","splitMonth","splitDay"],En=[...Ot.VIRTUAL_SCROLL_LABEL_KEYS,...ri],xo=Object.freeze({en:Object.freeze({rangeStart:"Range start",rangeEnd:"Range end",selectedDate:"Selected date",macroRangeStart:"Macro range start",macroRangeEnd:"Macro range end",microRangeStart:"Micro range start",microRangeEnd:"Micro range end",microSelectedDate:"Micro selected date",decrease:"Decrease",increase:"Increase",previousYear:"Previous year",nextYear:"Next year",yearSelect:"Year",previousMonth:"Previous month",nextMonth:"Next month",monthSelect:"Month",previousDay:"Previous day",nextDay:"Next day",dateSelect:"Date",splitYear:"Year",splitMonth:"Month",splitDay:"Day"}),ja:Object.freeze({rangeStart:"期間の開始",rangeEnd:"期間の終了",selectedDate:"選択日",macroRangeStart:"広域期間の開始",macroRangeEnd:"広域期間の終了",microRangeStart:"詳細期間の開始",microRangeEnd:"詳細期間の終了",microSelectedDate:"詳細の選択日",decrease:"前へ",increase:"次へ",previousYear:"前年",nextYear:"翌年",yearSelect:"年",previousMonth:"前月",nextMonth:"翌月",monthSelect:"年月",previousDay:"前日",nextDay:"翌日",dateSelect:"日付",splitYear:"年",splitMonth:"月",splitDay:"日"})}),ni=Object.freeze({en:Object.freeze({...Ot.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...xo.en}),ja:Object.freeze({...Ot.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...xo.ja})}),Ea=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,xl=e=>En.includes(e),Rl=(e,t)=>{const r={};let n=!1;for(const o of Ot.VIRTUAL_SCROLL_LABEL_KEYS){const a=t.has(o)?e[o]:void 0;a!==void 0&&(r[o]=a,n=!0)}return n?r:void 0},Sl=e=>{try{return Ot.resolveVirtualScrollLocale(e)}catch(t){throw t instanceof RangeError?new RangeError(`[period-slider] locale is the UI language, not a BCP 47 tag (date formatting reads formatLocale): ${t.message}`,{cause:t}):t}},oi=(e,t)=>{const r=Sl(e);if(t===void 0)return ni[r];if(t===null||typeof t!="object")throw new RangeError(`[period-slider] labels must be an object; got ${Ea(t)}`);const n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new RangeError(`[period-slider] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);const o=new Set(Object.keys(t));for(const c of o)if(!xl(c))throw new RangeError(`[period-slider] labels.${c} is not a known label key; expected one of ${En.join(", ")}`);const l={...Ot.resolveVirtualScrollLabels(r,Rl(t,o)),...xo[r]};for(const c of ri){const d=o.has(c)?t[c]:void 0;if(d!==void 0){if(typeof d!="string"||d.trim()==="")throw new RangeError(`[period-slider] labels.${c} must be a non-blank string; got ${Ea(d)}`);l[c]=d}}return Object.freeze(l)},Ll=e=>{const t={};for(const r of Ot.VIRTUAL_SCROLL_LABEL_KEYS)t[r]=e[r];return Object.freeze(t)},yl=(e,t)=>e===t||En.every(r=>e[r]===t[r]),Cn=(e,t)=>{if(e===t)return!0;if(e===void 0||t===void 0||e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const r=new Set(Object.keys(e)),n=Object.keys(t);if(r.size!==n.length)return!1;const o=e,a=t;return n.every(l=>r.has(l)&&Object.is(o[l],a[l]))},uo=(e,t)=>e!==null&&t!==null&&"nodeType"in t&&e.contains(t),Ca=new Set(["hidden","clip","scroll","auto","overlay"]),Ia=["paint","strict","content"],Tl=["layout","paint","strict","content"],Pl=["transform","perspective","filter"],kr=e=>e!==void 0&&e!==""&&e!=="none",El=e=>e!==void 0&&e!==""&&e!=="normal",cn=e=>{const t=Number.parseFloat(e??"");return Number.isFinite(t)?t:0},Cl=e=>e.position==="fixed"?"fixed":e.position==="absolute"?"absolute":null,Il=(e,t)=>t==="absolute"&&kr(e.position)&&e.position!=="static"||kr(e.transform)||kr(e.perspective)||kr(e.filter)||kr(e.backdropFilter)||El(e.containerType)||Tl.some(r=>e.contain.includes(r))?!0:Pl.some(r=>e.willChange.includes(r)),Al=(e,t,r,n,o,a)=>{const l=t.ownerDocument.defaultView;if(l===null)return!1;const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return!1;const d=n?0:r,g=n?r:0;if(o<c.left-d||o>=c.right+d||a<c.top-g||a>=c.bottom+g)return!1;const D=l.getComputedStyle(t);if(D.visibility!=="visible")return!1;let k=null;for(let b=t;b!==null;b=b.parentElement){const h=b===t?D:l.getComputedStyle(b);if(k!==null&&!Il(h,k))continue;const S=Ca.has(h.overflowX)||Ia.some(C=>h.contain.includes(C)),R=Ca.has(h.overflowY)||Ia.some(C=>h.contain.includes(C));if(S||R){const C=b.getBoundingClientRect();if(S&&(o<C.left+cn(h.borderLeftWidth)||o>=C.right-cn(h.borderRightWidth))||R&&(a<C.top+cn(h.borderTopWidth)||a>=C.bottom-cn(h.borderBottomWidth)))return!1}k=Cl(h)}return!0},mo=new Map,$l=(e,t)=>{if(!(t.shiftKey&&t.cancelable))return;for(const o of e)if(o.ownsHit(t.target)){o.step(t);return}let r=null,n=Number.POSITIVE_INFINITY;for(const o of e){const a=o.distanceToRailPx(t.clientX,t.clientY);a===null||a>=n||(r=o,n=a)}r?.step(t)},kl=(e,t)=>{let r=mo.get(e);if(r===void 0){const a=new Set,l=c=>$l(a,c);r={participants:a,listener:l},mo.set(e,r),e.addEventListener("wheel",l,{passive:!1,capture:!0})}const{participants:n,listener:o}=r;return n.add(t),()=>{n.delete(t),!(n.size>0)&&(mo.delete(e),e.removeEventListener("wheel",o,{capture:!0}))}},zr="gap-[11px]",ft=6,gt=ft*2,kt=ft*4/3,Ol={left:`0,${gt/2} ${ft},0 ${ft},${gt}`,right:`${kt},${gt/2} ${kt-ft},0 ${kt-ft},${gt}`,up:`${gt/2},0 0,${ft} ${gt},${ft}`,down:`${gt/2},${kt} 0,${kt-ft} ${gt},${kt-ft}`},fo=e=>{e.preventDefault(),e.stopPropagation()},Vl={onMouseDownCapture:fo,onMouseUpCapture:fo,onClickCapture:fo},Nl="period-slider-step",Yl=`${Nl} relative inline-flex size-[22px] shrink-0 items-center justify-center rounded-md after:absolute after:content-['']`,_l="transition-colors motion-reduce:transition-none not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 dark:focus-visible:ring-blue-400 forced-colors:not-aria-disabled:hover:text-[Highlight] forced-colors:aria-disabled:text-[GrayText]",Hl={control:"text-slate-500 not-aria-disabled:hover:bg-slate-500/15 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-500/25 aria-disabled:text-slate-500/40 dark:text-slate-400 dark:not-aria-disabled:hover:text-slate-50 dark:aria-disabled:text-slate-400/40",rail:"border border-slate-300 bg-white text-slate-700 shadow-2xs not-aria-disabled:hover:border-slate-400 not-aria-disabled:hover:bg-slate-100 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-200 aria-disabled:border-slate-300/40 aria-disabled:bg-white/40 aria-disabled:text-slate-700/40 aria-disabled:shadow-none dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:not-aria-disabled:hover:border-slate-500 dark:not-aria-disabled:hover:bg-slate-700 dark:not-aria-disabled:hover:text-white dark:not-aria-disabled:active:bg-slate-600 dark:aria-disabled:border-slate-700/40 dark:aria-disabled:bg-slate-800/40 dark:aria-disabled:text-slate-200/40"},un="after:inset-[calc((100%-var(--ps-target-size))/2)]",Aa={horizontal:"px-[19px]",vertical:"py-[19px]"},jl={control:{left:un,right:un,up:un,down:un},rail:{left:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:left-[calc(100%-var(--ps-target-size)+4px)] after:-right-[4px]",right:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-left-[4px] after:right-[calc(100%-var(--ps-target-size)+4px)]",up:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-[calc(100%-var(--ps-target-size)+4px)] after:-bottom-[4px]",down:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-[4px] after:bottom-[calc(100%-var(--ps-target-size)+4px)]"}},Kt=({direction:e,neighbour:t,disabled:r,canStep:n,onStep:o,ariaLabel:a,className:l,ref:c})=>{const d=e==="up"||e==="down",g=d?gt:kt,D=d?kt:gt,k=r||!n;return x.jsx("button",{ref:c,type:"button","aria-label":a,disabled:r,"aria-disabled":k?!0:void 0,...k?Vl:null,onClick:k?void 0:o,className:`${l===void 0?"":`${l} `}${Yl} ${_l} ${Hl[t]} ${jl[t][e]}`,children:x.jsx("svg",{"aria-hidden":"true",focusable:"false","data-arrow":e,width:g,height:D,viewBox:`0 0 ${g} ${D}`,fill:"currentColor",className:"pointer-events-none block shrink-0",children:x.jsx("polygon",{points:Ol[e]})})})},In=(e,t)=>{const r=i.useMemo(()=>oi(e,t),[e,t]),n=i.useRef(r);return yl(n.current,r)||(n.current=r),n.current},ai={"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"}},Xe=e=>e instanceof Date&&!Number.isNaN(e.getTime()),ve=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),st=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t)||t<0||t>11)throw new RangeError(`${e}: yearStartMonth must be an integer between 0 and 11 (received: ${ve(t)})`)},vr=(e,t)=>t===void 0?0:(st(e,t),t),Ne=(e,t,r=0)=>{if(!Xe(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${ve(t)})`);st("normalizeDateByUnit",r);const n=new Date(t.getTime());if(e==="year"){const o=t.getFullYear()-(t.getMonth()<r?1:0);n.setFullYear(o,r,1),n.setHours(0,0,0,0)}else e==="month"&&n.setDate(1),n.setHours(0,0,0,0);return n},re=(e,t,r=0)=>{st("encode",r);const n=Ne(e,t,r),o=n.getFullYear(),a=n.getMonth()+1,l=n.getDate();if(e==="year")return o;if(e==="month")return o*12+(a-1);const c=new Date(0);return c.setUTCFullYear(o,a-1,l),c.setUTCHours(0,0,0,0),Math.floor(c.getTime()/(1440*60*1e3))},me=(e,t,r=0)=>{st("decode",r);const n=new Date(0);if(n.setHours(0,0,0,0),e==="year")return n.setFullYear(t,r,1),n;if(e==="month"){const a=Math.floor(t/12),l=t-a*12;return n.setFullYear(a,l,1),n}const o=new Date(t*24*60*60*1e3);return n.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),n},je=(e,t,r)=>{if(!Xe(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${ve(t)})`);return e==="year"?lt.addYears(t,r):e==="month"?lt.addMonths(t,r):lt.addDays(t,r)},ii=(e,t,r,n=0)=>{if(!Xe(r))throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${ve(r)})`);return st("getMacroWindowStartDate",n),Ne(t,Ne(e,r,n),n)},li=(e,t,r,n=0)=>{if(!Xe(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${ve(r)})`);if(st("getMacroWindowEndDate",n),e===t)return Ne(t,r,n);const o=r.getFullYear(),a=r.getMonth();if(e==="year"){const l=Ne("year",r,n),c=lt.addMonths(l,11);if(t==="month")return c;if(t==="day")return Ne("day",lt.addDays(lt.addMonths(l,12),-1))}return e==="month"&&t==="day"?new Date(o,a+1,0):Ne(t,r,n)},$a=(e,t,r)=>e<t?t:e>r?r:e,ht=(e,t,r,n,o,a=0)=>{if(st("resolveMacroWindow",a),Fr("macroRange",r,"resolveMacroWindow"),!Xe(n))throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${ve(n)})`);if(!Xe(o))throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${ve(o)})`);if(o.getTime()<n.getTime())throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${ve(n)}, maxDate: ${ve(o)})`);return[Ne(t,$a(ii(e,t,r[0],a),n,o),a),Ne(t,$a(li(e,t,r[1],a),n,o),a)]},si=(e,t)=>{if(!Xe(e))throw new RangeError(`resolveQuarter: d must be a valid Date (received: ${ve(e)})`);st("resolveQuarter",t);const r=Ne("year",e,t).getFullYear(),n=((e.getMonth()-t)%12+12)%12,o=Math.floor(n/3)+1,a=new Date(e.getTime());return a.setFullYear(r,t+3*(o-1),1),a.setHours(0,0,0,0),{year:r,quarter:o,startDate:a}},Fl={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},ka=new Map,zl=(e,t)=>{const r=`${e}\0${t}`,n=ka.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Fl[e]);return ka.set(r,o),o},Bl=4,Ul=6,An=e=>e>=0?String(e).padStart(Bl,"0"):`-${String(-e).padStart(Ul,"0")}`,Wl=(e,t)=>{const r=An(t.getFullYear());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}`},He=(e,t,r,n)=>Xe(t)?r?r(t,e,"period"):n===void 0?Wl(e,t):zl(e,n).format(t):"",Bt=(e,t,r,n)=>He(e,t,r,n),Gl=(e,t)=>{if(!Xe(e))return"";st("formatQuarterLabel",t);const{quarter:r}=si(e,t);return`${He("year",Ne("year",e,t))}-Q${r}`},be=(e,t,r,n=0)=>{if(st("findNearestDateIndex",n),!e||e.length===0||e.length===1)return 0;const o=re(r,t,n);let a=0,l=e.length-1;if(o<=re(r,e[a],n))return 0;if(o>=re(r,e[l],n))return l;for(;a<=l;){const g=a+l>>1,D=re(r,e[g],n);if(D===o)return g;D<o?a=g+1:l=g-1}const c=Math.abs(re(r,e[a],n)-o),d=Math.abs(re(r,e[l],n)-o);return c<d?a:l},Rt=(e,t,r,n,o=0)=>{if(st("getSortedAllowedDates",o),!Array.isArray(e)||e.length===0)return[];const a=re(t,r,o),l=re(t,n,o),c=new Map;for(const d of e){const g=Ne(t,d,o),D=re(t,g,o);D<a||D>l||c.has(D)||c.set(D,g)}if(c.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${ve(r)}, maxDate: ${ve(n)}, entries: ${e.length})`);return Array.from(c.keys()).sort((d,g)=>d-g).map(d=>c.get(d))},dn=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const l=be(e,n,t,o);if(r==="time"){const c=e[0].getTime(),d=e[a].getTime()-c;return d<=0?0:Math.max(0,Math.min(1,(e[l].getTime()-c)/d))}return l/a},mn=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const l=Math.max(0,Math.min(1,n));if(r==="time"){const c=e[0].getTime(),d=e[a].getTime()-c;return d<=0?0:be(e,new Date(c+l*d),t,o)}return Math.max(0,Math.min(a,Math.round(l*a)))},Ro=(e,t,r,n,o,a,l)=>{let c=r,d=n;return l?(c=t,d=t):e==="low"?t>n?(c=n,d=t):c=t:t<r?(d=r,c=t):d=t,[Math.max(o,Math.min(a,c)),Math.max(o,Math.min(a,d))]},ci=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:o,isDiscrete:a,sortedAllowedDates:l,snapMode:c,unit:d,yearStartMonth:g=0})=>{if(a){const R=l.length-1;if(R<=0)return[0,0];const C=Math.max(0,Math.min(R,Math.round(t))),u=Math.max(C,Math.min(R,Math.round(r)));if(c==="time"){const J=l[0].getTime(),j=l[R].getTime(),ae=l[C].getTime(),N=l[u].getTime()-ae;let ne=ae+e*(j-J),z=ne+N;ne<J&&(ne=J,z=J+N),z>j&&(z=j,ne=j-N);const T=be(l,new Date(ne),d,g),p=be(l,new Date(z),d,g);return[T,Math.max(T,p)]}const q=Math.round(e*R);let L=C+q,K=u+q;return L<0&&(K+=-L,L=0),K>R&&(L-=K-R,K=R),[Math.max(0,Math.min(R,L)),Math.max(0,Math.min(R,K))]}const D=R=>Math.max(n,Math.min(o,R)),k=o-n;if(k<=0)return[D(t),D(r)];const b=Math.round(e*k);let h=t+b,S=r+b;return h<n&&(S+=n-h,h=n),S>o&&(h-=S-o,S=o),[D(h),D(S)]},ui=(e,t,r,n,o,a,l,c)=>{let d=0,g=!1,D=!1;switch(e){case"ArrowRight":case"ArrowUp":d=c;break;case"ArrowLeft":case"ArrowDown":d=-c;break;case"PageUp":d=c*5;break;case"PageDown":d=-c*5;break;case"Home":g=!0;break;case"End":D=!0;break;default:return null}if(l){let h=r;return g?h=o:D?h=a:h=Math.max(o,Math.min(a,r+d)),[h,h]}let k=r,b=n;return t==="low"?g?k=o:D?k=n:k=Math.max(o,Math.min(n,r+d)):g?b=r:D?b=a:b=Math.max(r,Math.min(a,n+d)),[k,b]},di=8,mi=2,fi=16,Kl=12,Xl=90,gi=(e,t,r)=>{const n=r*Math.PI/180,o=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));return{alongPx:(e*a+t*o)/2,acrossPx:(e*o+t*a)/2}},Po=(e,t)=>{const r=t?.estimatedHeightPx??fi,o=di+(t?.anchorGapY??mi)+r/2,a=e==="top"?-o:o;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:a,highOffsetY:a,isSlanted:!1,proximity:0}},Eo=(e,t,r,n="top",o)=>{const a=o?.estimatedWidthPx,l=o?.estimatedHeightPx??fi,c=o?.paddingPx??Kl,d=o?.maxAngleDeg??Xl,g=di+(o?.anchorGapY??mi),D=Po(n,o);if(!(Number.isFinite(r)&&r>0)||a===void 0||!Number.isFinite(a)||a<=0)return D;const k=Math.max(0,t-e)/100*r,b=a+c;if(k>=b)return D;const h=Math.max(0,Math.min(1,(b-k)/b)),R=h*h*h*(h*(h*6-15)+10)*d,C=n==="top"?-R:R,u=gi(a,l,R),q=g+u.acrossPx,L=n==="top"?-q:+q,K=2*u.alongPx,J=Math.max(0,(K+c-k)/2);return{lowAngleDeg:C,highAngleDeg:C,lowOffsetX:-J,highOffsetX:J,lowOffsetY:L,highOffsetY:L,isSlanted:h>.001,proximity:h}},hi=e=>({...e,lowOffsetX:0,highOffsetX:0}),Co=(e,t)=>{const r=t==="macro-top"||t==="macro-left",n=e<0;return r&&n||!(r||n)?"macro":"micro"},bi=(e,t,r)=>{const n=Math.abs(e)>Math.abs(t)?e:t;return!Number.isFinite(n)||n===0?0:(r?n<0:n>0)?1:-1};function wi(e,t,r,n,o,a,l="macro-top",c=.05,d=!0,g="range"){if(Co(t,l)==="macro"){const b=Math.abs(e-r),h=Math.abs(e-n);return b<=c&&b<=h?"macro-low":h<=c&&h<b?"macro-high":d&&e>=r&&e<=n?"macro-connect":b<h?"macro-low":"macro-high"}if(g==="point")return"micro-point";const D=Math.abs(e-o),k=Math.abs(e-a);return D<=c&&D<=k?"micro-low":k<=c&&k<D?"micro-high":d&&e>=o&&e<=a?"micro-connect":D<k?"micro-low":"micro-high"}function vi(e,t,r,n,o){if(e==="macro-connect"){const[g,D]=To(t-r,n,o);return[g,D,"macro-connect"]}const a=e==="macro-low"?"low":"high",[l,c]=pn(a,t,n,o),d=Pn(a,t,n,o);return[l,c,d==="low"?"macro-low":"macro-high"]}function Di(e,t,r,n,o){if(e==="micro-point"){const[g]=pn("point",t,n,o);return[g,g,"micro-point"]}if(e==="micro-connect"){const[g,D]=To(t-r,n,o);return[g,D,"micro-connect"]}const a=e==="micro-low"?"low":"high",[l,c]=pn(a,t,n,o),d=Pn(a,t,n,o);return[l,c,d==="low"?"micro-low":"micro-high"]}const Hr=i.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let o,a;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",a=`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",a=`period-slider-knob period-slider-knob-svg ${t?"is-semicircle-top":"is-semicircle-bottom"}`);const l=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return x.jsx("svg",{className:a,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:x.jsx("path",{d:o,className:l,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});Hr.displayName="VernierKnobSvg";const ql=(e,t)=>{if(!Xe(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${ve(e)})`);if(!Xe(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${ve(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${ve(e)}, maxDate: ${ve(t)})`)},Fr=(e,t,r="PeriodSlider")=>{if(!Array.isArray(t)||t.length!==2)throw new RangeError(`${r}: ${e} is required and must be a [start, end] Date tuple (received: ${ve(t)})`);const[n,o]=t;if(!Xe(n))throw new RangeError(`${r}: ${e}[0] must be a valid Date (received: ${ve(n)})`);if(!Xe(o))throw new RangeError(`${r}: ${e}[1] must be a valid Date (received: ${ve(o)})`);if(o.getTime()<n.getTime())throw new RangeError(`${r}: ${e} must not be inverted (start: ${ve(n)}, end: ${ve(o)})`)},So=(e,t)=>{if(!Xe(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${ve(t)})`)},xt=(e,t,r,n,o,a)=>{const l=re(r,t,a);if(l<re(r,n,a)||l>re(r,o,a))throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${ve(t)}, minDate: ${ve(n)}, maxDate: ${ve(o)})`)},Zl=(e,t,r)=>{const n=e.yearStartMonth??0;if(e.mode==="range"){for(const o of["range","defaultRange"]){const a=e[o];a!==void 0&&(Fr(o,a),xt(`${o}[0]`,a[0],e.unit,t,r,n),xt(`${o}[1]`,a[1],e.unit,t,r,n))}return}if(e.mode==="point")for(const o of["value","defaultValue"]){const a=e[o];a!==void 0&&(So(o,a),xt(o,a,e.unit,t,r,n))}},Ql=(e,t,r)=>{const n=e.yearStartMonth??0;Fr("macroRange",e.macroRange);const o=e.microUnit??e.unit,a=e.microRange!==void 0||e.defaultMicroRange!==void 0||e.onChangeMicroRange!==void 0,l=e.microValue!==void 0||e.defaultMicroValue!==void 0||e.onChangeMicroPoint!==void 0;if(a&&l)throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");if(l){if(e.microValue!==void 0)return So("microValue",e.microValue),xt("microValue",e.microValue,o,t,r,n),{shape:"point",selection:[e.microValue,e.microValue]};if(e.defaultMicroValue!==void 0)return So("defaultMicroValue",e.defaultMicroValue),xt("defaultMicroValue",e.defaultMicroValue,o,t,r,n),{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 Fr("microRange",e.microRange),xt("microRange[0]",e.microRange[0],o,t,r,n),xt("microRange[1]",e.microRange[1],o,t,r,n),{shape:"range",selection:e.microRange};if(e.defaultMicroRange!==void 0)return Fr("defaultMicroRange",e.defaultMicroRange),xt("defaultMicroRange[0]",e.defaultMicroRange[0],o,t,r,n),xt("defaultMicroRange[1]",e.defaultMicroRange[1],o,t,r,n),{shape:"range",selection:e.defaultMicroRange};throw a?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")},Or=(e,t,r,n,o,a,l,c,d)=>{const g=be(e,n,t,d),D=be(e,o,t,d);return l?g:c?D:Math.max(g,Math.min(D,be(e,r,t,d)+a))},go=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},Oa=()=>{const[e,t]=i.useState(null),r=i.useRef(null),n=i.useCallback((a,l)=>{const c=r.current;if(c!==null&&c[0].getTime()===a.getTime()&&c[1].getTime()===l.getTime())return;const d=[a,l];r.current=d,t(d)},[]),o=i.useCallback(()=>{r.current!==null&&(r.current=null,t(null))},[]);return{shown:e,show:n,release:o}},Jl=(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)})`)}},gr=()=>{const[e,t]=i.useState(null),r=i.useRef(null),n=i.useCallback(o=>{if(r.current?.disconnect(),r.current=null,o===null){t(null);return}if(typeof ResizeObserver>"u")return;const a=new ResizeObserver(l=>{for(const c of l){const d=c.borderBoxSize?.[0];d!==void 0&&t(g=>g!==null&&Math.abs(g.widthPx-d.inlineSize)<.5&&Math.abs(g.heightPx-d.blockSize)<.5?g:{widthPx:d.inlineSize,heightPx:d.blockSize})}});a.observe(o),r.current=a},[]);return i.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},ho=(e,t)=>{const r=wn(e,t);return r===null?void 0:{estimatedWidthPx:r.widthPx,estimatedHeightPx:r.heightPx}},wn=(e,t)=>e===null||t===null?null:{widthPx:Math.max(e.widthPx,t.widthPx),heightPx:Math.max(e.heightPx,t.heightPx)},es=e=>{const t={};let r=0;for(const o of e){const{side:a,box:l}=o;if(l===null)continue;let c;if(o.reach==="inline-size")c=l.widthPx,r=Math.max(r,l.heightPx/2);else{const d=gi(l.widthPx,l.heightPx,o.angleDeg);c=o.centreOffsetPx===null?2*d.acrossPx:Math.abs(o.centreOffsetPx)+d.acrossPx,r=Math.max(r,d.alongPx+Math.abs(o.alongPushPx))}t[`--ps-label-reach-${a}`]=`${Math.ceil(c)}px`}if(Object.keys(t).length===0)return;const n=Math.ceil(r);return t["--ps-label-reach-main"]=`${n}px`,{style:t,mainPx:n}},Va=(e,t,r)=>({tx:`calc(-50% + ${e}px)`,ty:`${t}px`,rot:`${r}deg`}),Na=(e,t,r)=>({tx:`calc(-50% + ${e}px)`,ty:`calc(-50% + ${t}px)`,rot:`${r}deg`}),Mn=(e,t)=>({"--ps-tooltip-tx":so(e,"tx",t.tx),"--ps-tooltip-ty":so(e,"ty",t.ty),"--ps-tooltip-rot":so(e,"rot",t.rot)}),bo=(e,t,r,n)=>{const o=Po(n.labelPosition,n.config);if(!n.isSlantable)return{slant:o,lowStyle:void 0,highStyle:void 0,placements:null};const a=Eo(t*100,r*100,n.trackLengthPx,n.labelPosition,n.config),l=n.isMerged?hi(a):a,c=Tn[e],d={low:Va(l.lowOffsetX,l.lowOffsetY-o.lowOffsetY,l.lowAngleDeg),high:Va(l.highOffsetX,l.highOffsetY-o.highOffsetY,l.highAngleDeg)};return{slant:l,lowStyle:Mn(c.low,d.low),highStyle:Mn(c.high,d.high),placements:d}},Ya={"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"},_a=(e,t,r)=>{const n=Po(r.labelPosition,r.config);if(r.isVertical)return{slant:n,lowStyle:Ya,highStyle:Ya,placements:null};const o=r.autoSlantLabels&&!r.isPointMode;let a=n;if(o){const d=Eo(e,t,r.trackLengthPx,r.labelPosition,r.config);a=r.isMerged?hi(d):d}const l=Tn.flat,c={low:Na(a.lowOffsetX,a.lowOffsetY,a.lowAngleDeg),high:Na(a.highOffsetX,a.highOffsetY,a.highAngleDeg)};return{slant:a,lowStyle:{"--ps-tooltip-origin":"50% 50%",...Mn(l.low,c.low)},highStyle:{"--ps-tooltip-origin":"50% 50%",...Mn(l.high,c.high)},placements:o?c:null}},ts={horizontal:{decrease:"left",increase:"right"},vertical:{decrease:"down",increase:"up"}},rs={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"}},Ha={horizontal:"px-[calc(var(--ps-target-size)/2)]",vertical:"py-[calc(var(--ps-target-size)/2)]"},ns={horizontal:{withSteppers:`grid-cols-[auto_minmax(0,1fr)_auto] ${zr} ${Aa.horizontal}`,railOnly:`grid-cols-[minmax(0,1fr)] ${Ha.horizontal}`},vertical:{withSteppers:`grid-rows-[auto_minmax(0,1fr)_auto] ${zr} ${Aa.vertical}`,railOnly:`grid-rows-[minmax(0,1fr)] ${Ha.vertical}`}},ja={horizontal:{leading:"col-start-1 row-start-1",rail:"col-start-2 row-start-1",railOnly:"col-start-1 row-start-1",trailing:"col-start-3 row-start-1"},vertical:{leading:"col-start-1 row-start-1",rail:"col-start-1 row-start-2",railOnly:"col-start-1 row-start-1",trailing:"col-start-1 row-start-3"}},Fa=(e,t)=>{e.setPointerCapture(t)},os=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:o,snapMode:a="index",disabled:l=!1,className:c="",showStepper:d=!0,tooltipStyle:g="always",labelPosition:D="top",autoSlantLabels:k=!0,isVertical:b=!1,hideConnectBar:h=!1,showTicks:S=!1,colorScheme:R="blue-rose",formatLocale:C}=e,u=vr("PeriodSlider",e.yearStartMonth);ql(r,n),Zl(e,r,n),C!==void 0&&Jl("formatLocale",C);const q=e.mode==="vernier"?Ql(e,r,n):null,L=q!==null&&q.shape==="point",K=In(e.locale,e.labels),J=ai[R],j=i.useId(),ae=i.useRef(e),N=r.getTime(),ne=n.getTime(),z=i.useMemo(()=>Rt(o,t,r,n,u),[o,t,N,ne,u]),T=z.length>0,{rangeMin:p,rangeMax:E}=i.useMemo(()=>T?{rangeMin:0,rangeMax:z.length-1}:{rangeMin:re(t,r,u),rangeMax:re(t,n,u)},[T,z,t,N,ne,u]),O=e.mode==="point",oe=i.useCallback(s=>{if(T){const m=Math.max(0,Math.min(z.length-1,Math.round(s)));return z[m]}return me(t,Math.round(s),u)},[T,z,t,u]),F=i.useCallback(s=>{if(s===void 0)return p;const m=Ne(t,s,u);return T?be(z,m,t,u):re(t,m,u)},[T,z,t,p,u]),[U,Re]=i.useState(()=>q===null?null:q.selection);let ee=U??(q===null?null:q.selection);if(L&&ee!==null&&ee[0].getTime()!==ee[1].getTime()){const s=[ee[0],ee[0]];ee=s,Re(s)}const ce=e.mode==="vernier"?e.microValue?.getTime():void 0,W=i.useMemo(()=>e.mode!=="vernier"||e.microValue===void 0?null:[e.microValue,e.microValue],[e.mode,ce]),G=Oa(),ue=Oa(),pe=e.mode!=="vernier"?null:L?W??ee:e.microRange!==void 0?e.microRange:ee,Me=pe===null?null:ue.shown??pe,$e=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?Me?.[0]:void 0,I=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?Me?.[1]:void 0,ie=e.mode==="point"?e.value??e.defaultValue:void 0,le=e.mode==="point"?ie?.getTime():$e?.getTime(),Se=e.mode==="range"?I?.getTime():le,[Ce,Le]=i.useMemo(()=>{if(e.mode==="point"){const f=F(ie);return[f,f]}const s=F($e),m=F(I);return[Math.min(s,m),Math.max(s,m)]},[e.mode,le,Se,F,ie,$e,I]),ke=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:L?e.microValue!==void 0:e.microRange!==void 0,[Be,Z]=i.useState(()=>[Ce,Le]),[te,ge]=i.useState(null),[v,P]=i.useState(null),X=i.useRef(null),[De,he]=i.useState("high"),[xe,Ye]=i.useState(null),[Qe,bt]=i.useState(null),M=te?te[0]:ke?Ce:Be[0],V=te?te[1]:ke?Le:Be[1],Je=i.useRef([M,V]),de=e.mode==="vernier",nt=e.mode==="vernier"?e.vernierOrientation??(b?"macro-left":"macro-top"):"macro-top",$=nt==="macro-top"||nt==="macro-left",Ci=e.mode==="vernier"?e.showVernierProjection??!0:!1,Ii=e.mode==="vernier"?e.showVernierTicks??!0:!1,Br=e.mode==="vernier"?e.showHairline??!0:!1,Q=de?e.macroUnit??t:t,A=de?e.microUnit??t:t,On=de?e.macroIsDiscrete??!1:T,Dr=de?e.microIsDiscrete??!1:T,Io=de?e.macroAllowedDates??o:o,Ao=de?e.microAllowedDates??o:o,Ur=de?e.formatMacroLabel??e.formatLabel:e.formatLabel,Wr=de?e.formatMicroLabel??e.formatLabel:e.formatLabel,Ai=$e?.getTime(),$i=I?.getTime(),[qe,Gr]=i.useState(null),St=i.useRef(null),[pr,Xt]=i.useState(()=>L?"micro-point":"micro-high");let _e=pr;const Vn=L?pr==="micro-low"||pr==="micro-high"||pr==="micro-connect"?"micro-point":null:pr==="micro-point"?"micro-high":null;Vn!==null&&(_e=Vn,Xt(Vn));const Fe=i.useMemo(()=>re(Q,r,u),[N,Q,u]),ct=i.useMemo(()=>{const s=re(Q,n,u);if(de&&s<=Fe)throw new RangeError(`PeriodSlider: macroUnit "${Q}" cannot distinguish minDate from maxDate (minDate: ${ve(r)}, maxDate: ${ve(n)})`);return s},[de,N,ne,Fe,Q,u]),Ee=i.useMemo(()=>de&&On?Rt(Io,Q,r,n,u):[],[de,On,Io,Q,N,ne,u]),$o=s=>[Math.max(Fe,Math.min(ct,re(Q,s[0],u))),Math.max(Fe,Math.min(ct,re(Q,s[1],u)))],[ko,Oo]=e.mode!=="vernier"?[Fe,ct]:$o(e.macroRange),[Ue,We]=G.shown===null?[ko,Oo]:$o(G.shown),wt=i.useMemo(()=>me(Q,Ue,u),[Q,Ue,u]),Vt=i.useMemo(()=>me(Q,We,u),[Q,We,u]),Kr=i.useMemo(()=>e.mode!=="vernier"?[r,n]:ht(Q,A,[wt,Vt],r,n,u),[e.mode,wt,Vt,Q,A,N,ne,u]),ye=i.useMemo(()=>re(A,Kr[0],u),[A,Kr,u]),Ae=i.useMemo(()=>re(A,Kr[1],u),[A,Kr,u]),Vo=i.useMemo(()=>de&&Dr?Rt(Ao,A,r,n,u):[],[de,Dr,Ao,A,N,ne,u]),Nn=(s,m)=>Vo.filter(f=>{const w=re(A,f,u);return w>=s&&w<=m}),fe=i.useMemo(()=>Nn(ye,Ae),[Vo,A,ye,Ae]),qt=On&&Ee.length>0,ot=Dr&&fe.length>0,Lt=(s,m,f,w)=>m.length>0?re(A,m[be(m,s,A,u)],u):Math.max(f,Math.min(w,re(A,s,u))),Zt=ot?fe:[],Oe=i.useMemo(()=>Me===null?ye:Lt(Me[0],Zt,ye,Ae),[Ai,ye,Ae,A,Me,Zt]),Ge=i.useMemo(()=>Me===null?Ae:Lt(Me[1],Zt,ye,Ae),[$i,ye,Ae,A,Me,Zt]),yt=i.useMemo(()=>me(A,Oe,u),[A,Oe,u]),Tt=i.useMemo(()=>me(A,Ge,u),[A,Ge,u]),No=!de||pe===null?null:{macroUnit:Q,macroLowEnc:ko,macroHighEnc:Oo,microUnit:A,microLowEnc:re(A,pe[0],u),microHighEnc:re(A,pe[1],u)},Yn=i.useRef(No),Xr=Math.max(1,ct-Fe),at=qt?dn(Ee,Q,a,wt,u):Math.max(0,Math.min(1,(Ue-Fe)/Xr)),ut=Math.max(at,qt?dn(Ee,Q,a,Vt,u):Math.min(1,(We-Fe)/Xr)),qr=Math.max(1,Ae-ye),Qt=ot?dn(fe,A,a,yt,u):Math.max(0,Math.min(1,(Oe-ye)/qr)),Mr=Math.max(Qt,ot?dn(fe,A,a,Tt,u):Math.min(1,(Ge-ye)/qr)),_n=i.useRef({timerId:null,emit:null}),Zr=i.useRef({timerId:null,emit:null}),Qr=i.useRef({timerId:null,emit:null});i.useEffect(()=>{const s=[_n,Zr,Qr];return()=>{for(const m of s)go(m.current)}},[]);const Jt=i.useCallback((s,m,f)=>{go(s);const{debounceMs:w}=ae.current;if(f||!w||w<=0){m();return}s.emit=m,s.timerId=setTimeout(()=>{s.timerId=null,s.emit=null,m()},w)},[]),Yo=i.useCallback(s=>{const m=s.emit;go(s),m?.()},[]),er=i.useCallback(s=>new Date(Math.min(Math.max(s.getTime(),N),ne)),[N,ne]),Pt=i.useCallback((s,m,f=!1)=>{const[w,y]=Je.current;if((ae.current.mode==="point"?s===w:s===w&&m===y)&&_n.current.timerId===null)return;const H=oe(s),_=oe(m),se=()=>{const we=ae.current;we.mode==="point"?we.onChangePoint?.(H):we.mode==="range"&&we.onChangeRange?.(H,_)};Jt(_n.current,se,f)},[oe,Jt]),Nt=i.useCallback((s,m,f=!1)=>{const w=Yn.current;if(ae.current.mode!=="vernier"||w===null)return;const y=er(s),Y=er(m);re(w.macroUnit,y,u)===w.macroLowEnc&&re(w.macroUnit,Y,u)===w.macroHighEnc&&Zr.current.timerId===null||Jt(Zr.current,()=>{const H=ae.current;H.mode==="vernier"&&H.onChangeMacroRange?.(y,Y)},f)},[er,Jt,u]),et=i.useCallback((s,m,f=!1)=>{const w=ae.current,y=Yn.current;if(w.mode!=="vernier"||y===null)return;const Y=er(s),H=er(m);re(y.microUnit,Y,u)===y.microLowEnc&&re(y.microUnit,H,u)===y.microHighEnc&&Qr.current.timerId===null||((L?w.microValue===void 0:w.microRange===void 0)&&Re([Y,H]),Jt(Qr.current,()=>{const _=ae.current;if(_.mode==="vernier"){if(L){_.onChangeMicroPoint?.(Y);return}_.onChangeMicroRange?.(Y,H)}},f))},[er,Jt,L,u]),_o=i.useCallback((s,m=!1)=>{et(s,s,m)},[et]),Yt=i.useCallback(s=>{if(T&&a==="time"&&z.length>1){const w=Math.max(0,Math.min(z.length-1,Math.round(s))),y=z[0].getTime(),H=z[z.length-1].getTime()-y;if(H<=0)return 0;const _=z[w].getTime();return Math.max(0,Math.min(100,(_-y)/H*100))}const m=E-p;if(m<=0)return 0;const f=(s-p)/m*100;return Math.max(0,Math.min(100,f))},[T,a,z,p,E]),Hn=i.useCallback(s=>{const m=Math.max(0,Math.min(100,s));if(T){if(a==="time"&&z.length>1){const y=z[0].getTime(),H=z[z.length-1].getTime()-y,_=y+m/100*H;return be(z,new Date(_),t,u)}const w=Math.round(m/100*(z.length-1));return Math.max(0,Math.min(z.length-1,w))}const f=p+m/100*(E-p);return Math.round(f)},[T,a,z,p,E,t,u]),xr=i.useRef(null),Ho=i.useRef(null),jo=i.useRef(0),Ze=i.useRef(null),jn=i.useRef(null),Fo=i.useRef(null),zo=i.useRef(null),[Fn,Bo]=i.useState(0),[ki,tr]=gr(),[Oi,Uo]=gr(),[Vi,Wo]=gr(),[Ni,Go]=gr(),[Yi,zn]=gr(),[_i,Ko]=gr(),Hi=O?tr===null?void 0:{estimatedWidthPx:tr.widthPx,estimatedHeightPx:tr.heightPx}:ho(tr,Uo),Bn=!O&&M===V,Un=Ue===We,Wn=!L&&Oe===Ge,ji=$?"top":"bottom",Fi=$?"bottom":"top",Xo=k&&!b,zi=Xo&&!L,Gn={isPointMode:O,isVertical:b,autoSlantLabels:k,isMerged:Bn,trackLengthPx:Fn,labelPosition:D,config:Hi},Kn={trackLengthPx:Fn,labelPosition:ji,config:ho(Wo,Go),isMerged:Un,isSlantable:Xo},Xn={trackLengthPx:Fn,labelPosition:Fi,config:ho(zn,Ko),isMerged:Wn,isSlantable:zi};i.useEffect(()=>{const s=Ze.current;if(!s)return;const m=()=>{const w=s.getBoundingClientRect(),y=b?w.height:w.width;y>0&&Bo(Y=>Math.abs(Y-y)<.5?Y:y)};if(m(),typeof ResizeObserver<"u"){const w=new ResizeObserver(y=>{for(const Y of y){const H=b?Y.contentRect.height:Y.contentRect.width;H>0&&Bo(_=>Math.abs(_-H)<.5?_:H)}});return w.observe(s),()=>w.disconnect()}const f=s.ownerDocument.defaultView;if(f)return f.addEventListener("resize",m),()=>f.removeEventListener("resize",m)},[b]);const rr=i.useCallback((s,m,f)=>{const w=b?f.height:f.width;if(!(Number.isFinite(w)&&w>0))return null;const y=b?f.bottom-m:s-f.left;return Number.isFinite(y)?Math.max(0,Math.min(1,y/w)):null},[b]),qo=i.useCallback((s,m)=>{const f=Ze.current;if(!f)return null;const w=rr(s,m,f.getBoundingClientRect());return w===null?null:w*100},[rr]),Rr=i.useRef(null),vt=i.useRef(null),Jr=i.useRef({macroLowRatio:at,macroHighRatio:ut,isVertical:b,isMacroFirstRail:$}),Zo=i.useRef({flat:Gn,macro:Kn,micro:Xn});i.useLayoutEffect(()=>{Jr.current={macroLowRatio:at,macroHighRatio:ut,isVertical:b,isMacroFirstRail:$},Zo.current={flat:Gn,macro:Kn,micro:Xn},ae.current=e,Je.current=[M,V],Yn.current=No,X.current=v,St.current=qe});const Qo=(s,m)=>{const f=Jr.current;jn.current?.setAttribute("d",co(s,m,f.isVertical,f.isMacroFirstRail))},Bi=(s,m,f)=>{const w=Zo.current;return s==="flat"?_a(m*100,f*100,w.flat).placements:bo(s,m,f,s==="macro"?w.macro:w.micro).placements},Sr=(s,m,f)=>{const w=Ze.current;if(!w)return;Rr.current={rail:s,lowRatio:m,highRatio:f},pl(w,s,m,f);const y=Bi(s,m,f);y!==null&&Dl(w,s,y),s==="macro"&&Qo(m,f)},_t=i.useCallback(()=>{vt.current!==null&&(clearTimeout(vt.current),vt.current=null);const s=Ze.current;s&&(s.removeAttribute(io),s.style.removeProperty(lo))},[]),Jo=()=>{const s=Ze.current;if(Rr.current===null||!s){Rr.current=null;return}Rr.current=null,vt.current!==null&&clearTimeout(vt.current),s.style.setProperty(lo,`${Pa}ms`),s.setAttribute(io,"true"),Ml(s),Qo(Jr.current.macroLowRatio,Jr.current.macroHighRatio),vt.current=setTimeout(()=>{vt.current=null,s.removeAttribute(io),s.style.removeProperty(lo)},Pa)};i.useLayoutEffect(()=>{const s=Rr.current;s!==null&&Sr(s.rail,s.lowRatio,s.highRatio)}),i.useEffect(()=>()=>{vt.current!==null&&clearTimeout(vt.current)},[]);const nr=i.useRef(null),or=i.useRef(null),dt=i.useRef(null),qn=i.useRef(null),Lr=i.useRef(null),Et=i.useCallback(()=>nr.current!==null||or.current!==null,[]),ea=s=>{if(l)return;if(de){const B=or.current;if(!B||s.pointerId!==B.pointerId||!Ze.current)return;const it=rr(s.clientX,s.clientY,Ze.current.getBoundingClientRect());if(it===null)return;if(B.handle==="macro-low"||B.handle==="macro-high"||B.handle==="macro-connect"){const[Ve,Ie,Dt]=vi(B.handle,it,B.startPointerRatio,B.startMacroLowRatio,B.startMacroHighRatio);Sr("macro",Ve,Ie),Dt!==St.current&&(St.current=Dt,Gr(Dt),Xt(Dt));let ze,tt;if(qt){const Ct=mn(Ee,Q,a,Ve,u),It=Math.max(Ct,mn(Ee,Q,a,Ie,u));ze=Ee[Ct],tt=Ee[It]}else{const Ct=Math.round(Fe+Ve*Xr),It=Math.round(Fe+Ie*Xr);ze=me(Q,Ct,u),tt=me(Q,It,u)}G.show(ze,tt);const Cr=`${ze.getTime()}_${tt.getTime()}`;Cr!==qn.current&&(qn.current=Cr,Nt(ze,tt));const[pt,jt]=ht(Q,A,[ze,tt],r,n,u),oo=re(A,pt,u),ao=re(A,jt,u),Sa=Dr?Nn(oo,ao):[];let Ft,zt;if(B.handle==="macro-connect"){const Ct=pt,It=jt;let dr,mr;if(Q==="year"){const At=ze.getFullYear()-B.startMacroLowDate.getFullYear();dr=je("year",B.initialMicroLowDate,At),mr=je("year",B.initialMicroHighDate,At)}else if(Q==="month"){const At=(ze.getFullYear()-B.startMacroLowDate.getFullYear())*12+(ze.getMonth()-B.startMacroLowDate.getMonth());dr=je("month",B.initialMicroLowDate,At),mr=je("month",B.initialMicroHighDate,At)}else{const At=Math.round((ze.getTime()-B.startMacroLowDate.getTime())/864e5);dr=je("day",B.initialMicroLowDate,At),mr=je("day",B.initialMicroHighDate,At)}const fr=Ct.getTime(),Ir=It.getTime(),Ta=B.initialMicroHighDate.getTime()-B.initialMicroLowDate.getTime();let Ar=dr.getTime(),$r=mr.getTime();Ar<fr&&(Ar=fr,$r=Math.min(Ir,Ar+Ta)),$r>Ir&&($r=Ir,Ar=Math.max(fr,$r-Ta)),Ft=Ne(A,new Date(Ar),u),zt=Ne(A,new Date($r),u)}else{const Ct=pt.getTime(),It=jt.getTime(),dr=B.initialMicroLowDate.getTime(),mr=B.initialMicroHighDate.getTime(),fr=Math.max(Ct,Math.min(It,dr)),Ir=Math.max(fr,Math.min(It,mr));Ft=Ne(A,new Date(fr),u),zt=Ne(A,new Date(Ir),u)}const La=Lt(Ft,Sa,oo,ao),wl=Math.max(La,Lt(zt,Sa,oo,ao));Ft=me(A,La,u),zt=me(A,wl,u),ue.show(Ft,zt);const ya=`${Ft.getTime()}_${zt.getTime()}`;ya!==Lr.current&&(Lr.current=ya,et(Ft,zt))}else if(B.handle==="micro-low"||B.handle==="micro-high"||B.handle==="micro-connect"||B.handle==="micro-point"){const[Ve,Ie,Dt]=Di(B.handle,it,B.startPointerRatio,B.startMicroLowRatio,B.startMicroHighRatio);Sr("micro",Ve,Ie),Dt!==St.current&&(St.current=Dt,Gr(Dt),Xt(Dt));let ze,tt;if(ot){const pt=mn(fe,A,a,Ve,u),jt=Math.max(pt,mn(fe,A,a,Ie,u));ze=fe[pt],tt=fe[jt]}else{const pt=Lt(me(A,Math.round(ye+Ve*qr),u),Zt,ye,Ae),jt=Math.max(pt,Lt(me(A,Math.round(ye+Ie*qr),u),Zt,ye,Ae));ze=me(A,pt,u),tt=me(A,jt,u)}ue.show(ze,tt);const Cr=`${ze.getTime()}_${tt.getTime()}`;Cr!==Lr.current&&(Lr.current=Cr,et(ze,tt))}return}const m=nr.current;if(!m||s.pointerId!==m.pointerId||!Ze.current)return;const f=Ze.current.getBoundingClientRect(),w=b?s.clientY:s.clientX,y=b?f.height:f.width;if(!(Number.isFinite(y)&&y>0))return;if(m.handle==="connect"){const B=b?(m.startPointerPos-w)/y:(w-m.startPointerPos)/y,[it,Ve]=To(B,m.startLowRatio,m.startHighRatio);Sr("flat",it,Ve);const Ie=ci({posDiffPct:B,startLowVal:m.startLowVal,startHighVal:m.startHighVal,rangeMin:p,rangeMax:E,isDiscrete:T,sortedAllowedDates:z,snapMode:a,unit:t,yearStartMonth:u});if(dt.current&&dt.current[0]===Ie[0]&&dt.current[1]===Ie[1])return;dt.current=Ie,ge(Ie),Pt(Ie[0],Ie[1],!1);return}const Y=rr(s.clientX,s.clientY,f);if(Y===null)return;const[H,_]=pn(O?"point":m.handle,Y,m.startLowRatio,m.startHighRatio);Sr("flat",H,_);const se=Hn(Y*100),[we,Te]=Ro(m.handle,se,m.startLowVal,m.startHighVal,p,E,O);if((!dt.current||dt.current[0]!==we||dt.current[1]!==Te)&&(dt.current=[we,Te],ge([we,Te]),Pt(we,Te,!1)),!O&&(m.handle==="low"||m.handle==="high")){const B=Pn(m.handle,Y,m.startLowRatio,m.startHighRatio);X.current!==B&&(X.current=B,P(B),he(B))}},ta=()=>{Jo(),qn.current=null,Lr.current=null,or.current=null,St.current=null,Gr(null),G.release(),ue.release(),Yo(Zr.current),Yo(Qr.current)},ra=()=>{Jo();const s=dt.current??te;s&&(Pt(s[0],s[1],!0),Z(s)),dt.current=null,ge(null),nr.current=null,X.current=null,P(null)},na=s=>{if(de){const f=or.current;if(!f||s.pointerId!==f.pointerId)return;ta();return}const m=nr.current;!m||s.pointerId!==m.pointerId||ra()},oa=()=>{or.current!==null&&ta(),nr.current!==null&&ra()},Zn=i.useRef(ea),aa=i.useRef(na),ia=i.useRef(oa);i.useLayoutEffect(()=>{Zn.current=ea,aa.current=na,ia.current=oa});const la=i.useRef(de);i.useEffect(()=>{la.current!==de&&(la.current=de,ia.current())},[de]);const sa=v!==null||qe!==null;i.useEffect(()=>{if(!sa)return;const s=xr.current?.ownerDocument.defaultView;if(!s)return;const m=w=>Zn.current(w),f=w=>aa.current(w);return s.addEventListener("pointermove",m),s.addEventListener("pointerup",f),s.addEventListener("pointercancel",f),s.addEventListener("lostpointercapture",f),()=>{s.removeEventListener("pointermove",m),s.removeEventListener("pointerup",f),s.removeEventListener("pointercancel",f),s.removeEventListener("lostpointercapture",f)}},[sa]);const Qn=i.useCallback((s,m,f,w)=>{_t(),Fa(s,m),nr.current={pointerId:m,handle:f,startPointerPos:w,startLowVal:M,startHighVal:V,startLowRatio:Yt(M)/100,startHighRatio:Yt(V)/100},X.current=f,P(f),f!=="connect"&&he(f)},[M,V,Yt]),ca=i.useCallback((s,m,f,w)=>{ae.current.mode==="vernier"&&(_t(),Fa(s,m),or.current={pointerId:m,handle:f,startPointerRatio:w,startMacroLowRatio:at,startMacroHighRatio:ut,startMicroLowRatio:Qt,startMicroHighRatio:Mr,startMacroLowDate:wt,initialMicroLowDate:yt,initialMicroHighDate:Tt},St.current=f,Gr(f),Xt(f))},[at,ut,Qt,Mr,wt,yt,Tt]),ua=s=>m=>{if(l||Et())return;m.stopPropagation(),m.preventDefault(),he(s);const f=b?m.clientY:m.clientX;Qn(m.currentTarget,m.pointerId,s,f)},da=s=>()=>{l||X.current!==null||he(s)},en=s=>()=>{l||St.current!==null||Xt(s)},ar=s=>m=>{if(l||Et())return;m.stopPropagation(),m.preventDefault();const f=Ze.current;if(!f)return;const w=rr(m.clientX,m.clientY,f.getBoundingClientRect());w!==null&&ca(m.currentTarget,m.pointerId,s,w)},Ui=s=>{if(l||h||Et())return;s.stopPropagation(),s.preventDefault();const m=b?s.clientY:s.clientX;Qn(s.currentTarget,s.pointerId,"connect",m)},Wi=s=>{if(l||Et())return;if(de){const _=Ze.current;if(!_)return;const se=_.getBoundingClientRect(),we=rr(s.clientX,s.clientY,se);if(we===null)return;const Te=b?s.clientX-(se.left+se.width/2):s.clientY-(se.top+se.height/2),B=wi(we,Te,at,ut,Qt,Mr,nt,void 0,!h,L?"point":"range");ca(s.currentTarget,s.pointerId,B,we),Zn.current(s.nativeEvent);return}const m=qo(s.clientX,s.clientY);if(m===null)return;const f=Hn(m);let w="low";if(!O){const _=Math.abs(f-M),se=Math.abs(f-V);_<se?w="low":se<_?w="high":w=f>V?"high":"low"}he(w);const[y,Y]=Ro(w,f,M,V,p,E,O);ge([y,Y]),Pt(y,Y,!0);const H=b?s.clientY:s.clientX;Qn(s.currentTarget,s.pointerId,w,H)},Gi=s=>{if(l||de||v!==null)return;const m=qo(s.clientX,s.clientY);if(m===null)return;const f=Hn(m);Ye(f),bt(Yt(f))},Ki=()=>{Ye(null),bt(null)},ma=s=>m=>{if(l||Et())return;he(s);const f=ui(m.key,s,M,V,p,E,O,1);f&&(m.preventDefault(),_t(),ke||Z(f),Pt(f[0],f[1],!0))},ir=(s,m)=>{if(pe===null)return;const[f,w]=ht(Q,A,[s,m],r,n,u),y=re(A,f,u),Y=re(A,w,u),H=Dr?Nn(y,Y):[],_=Lt(pe[0],H,y,Y),se=Math.max(_,Lt(pe[1],H,y,Y));et(me(A,_,u),me(A,se,u),!0)},tn=s=>m=>{if(l||!de||e.mode!=="vernier"||Et())return;Xt(s);let f=0,w=!1,y=!1;switch(m.key){case"ArrowRight":case"ArrowUp":f=1;break;case"ArrowLeft":case"ArrowDown":f=-1;break;case"PageUp":f=5;break;case"PageDown":f=-5;break;case"Home":w=!0;break;case"End":y=!0;break;default:return}if(m.preventDefault(),_t(),s==="macro-low"){const Y=me(Q,Ue,u),H=me(Q,We,u);if(qt){const we=Or(Ee,Q,Y,Ee[0],H,f,w,y,u);if(we===be(Ee,Y,Q,u))return;const Te=Ee[we];Nt(Te,H,!0),ir(Te,H);return}let _;if(w?_=Fe:y?_=We:_=Math.max(Fe,Math.min(We,Ue+f)),_===Ue)return;const se=me(Q,_,u);Nt(se,H,!0),ir(se,H)}else if(s==="macro-high"){const Y=me(Q,Ue,u),H=me(Q,We,u);if(qt){const we=Or(Ee,Q,H,Y,Ee[Ee.length-1],f,w,y,u);if(we===be(Ee,H,Q,u))return;const Te=Ee[we];Nt(Y,Te,!0),ir(Y,Te);return}let _;if(w?_=Ue:y?_=ct:_=Math.max(Ue,Math.min(ct,We+f)),_===We)return;const se=me(Q,_,u);Nt(Y,se,!0),ir(Y,se)}else if(s==="micro-low"){const Y=me(A,Oe,u),H=me(A,Ge,u);if(ot){const se=Or(fe,A,Y,fe[0],H,f,w,y,u);if(se===be(fe,Y,A,u))return;et(fe[se],H,!0);return}let _;if(w?_=ye:y?_=Ge:_=Math.max(ye,Math.min(Ge,Oe+f)),_===Oe)return;et(me(A,_,u),H,!0)}else if(s==="micro-high"){const Y=me(A,Oe,u),H=me(A,Ge,u);if(ot){const se=Or(fe,A,H,Y,fe[fe.length-1],f,w,y,u);if(se===be(fe,H,A,u))return;et(Y,fe[se],!0);return}let _;if(w?_=Oe:y?_=Ae:_=Math.max(Oe,Math.min(Ae,Ge+f)),_===Ge)return;et(Y,me(A,_,u),!0)}else if(s==="micro-point"){const Y=me(A,Oe,u);if(ot){const _=Or(fe,A,Y,fe[0],fe[fe.length-1],f,w,y,u);if(_===be(fe,Y,A,u))return;_o(fe[_],!0);return}let H;if(w?H=ye:y?H=Ae:H=Math.max(ye,Math.min(Ae,Oe+f)),H===Oe)return;_o(me(A,H,u),!0)}},Xi=s=>{if(e.mode!=="vernier")return;if(_t(),qt){const H=Ee.length-1,_=be(Ee,wt,Q,u),se=be(Ee,Vt,Q,u),we=se-_;let Te=_+s,B=se+s;if(s<0&&Te<0?(Te=0,B=Math.min(H,we)):s>0&&B>H&&(B=H,Te=Math.max(0,H-we)),Te===_&&B===se)return;const it=Ee[Te],Ve=Ee[B];Nt(it,Ve,!0),ir(it,Ve);return}const m=We-Ue;let f=Ue+s,w=We+s;if(s<0&&f<Fe?(f=Fe,w=Math.min(ct,f+m)):s>0&&w>ct&&(w=ct,f=Math.max(Fe,w-m)),f===Ue&&w===We)return;const y=me(Q,f,u),Y=me(Q,w,u);Nt(y,Y,!0),ir(y,Y)},Jn=i.useCallback(s=>{const m=ae.current;if(!(m.disabled||Et()))if(_t(),m.mode==="point"){const f=Math.max(p,Math.min(E,M+s));ke||Z([f,f]),Pt(f,f,!0)}else if(m.mode==="vernier"){if(ot){const we=fe.length-1,Te=be(fe,yt,A,u),B=be(fe,Tt,A,u),it=B-Te;let Ve=Te+s,Ie=B+s;s<0&&Ve<0?(Ve=0,Ie=Math.min(we,it)):s>0&&Ie>we&&(Ie=we,Ve=Math.max(0,we-it)),(Ve!==Te||Ie!==B)&&et(fe[Ve],fe[Ie],!0);return}const f=Oe,w=Ge,y=ye,Y=Ae,H=w-f;let _=f+s,se=w+s;s<0&&_<y?(_=y,se=Math.min(Y,_+H)):s>0&&se>Y&&(se=Y,_=Math.max(y,se-H)),(_!==f||se!==w)&&et(me(A,_,u),me(A,se,u),!0)}else{const f=V-M;let w=M+s,y=V+s;s<0&&w<p?(w=p,y=Math.min(E,w+f)):s>0&&y>E&&(y=E,w=Math.max(p,y-f)),w<=y&&(ke||Z([w,y]),Pt(w,y,!0))}},[M,V,p,E,ke,Pt,et,Oe,Ge,ye,Ae,A,ot,fe,yt,Tt,_t,u]),fa=s=>!l&&uo(xr.current,s),ga=(s,m)=>{const f=Ho.current,w=Ze.current,y=xr.current;if(l||f===null||w===null||y===null||!Al(f,y,jo.current,b,s,m))return null;const Y=w.getBoundingClientRect();return Math.abs(b?s-(Y.left+Y.width/2):m-(Y.top+Y.height/2))},ha=s=>{if(l||Et())return;const m=bi(s.deltaX,s.deltaY,b);if(m===0)return;s.preventDefault();const f=s.target,w=uo(Fo.current,f)||uo(zo.current,f);if(!de||w){Jn(m);return}const y=Ze.current;if(!y)return;const Y=y.getBoundingClientRect(),H=b?s.clientX-(Y.left+Y.width/2):s.clientY-(Y.top+Y.height/2);if(Co(H,nt)==="macro"){Xi(m);return}Jn(m)},rn=i.useRef({ownsWheelHit:fa,distanceToRailPx:ga,stepFromRangeAreaWheel:ha});i.useLayoutEffect(()=>{rn.current={ownsWheelHit:fa,distanceToRailPx:ga,stepFromRangeAreaWheel:ha}});const yr=i.useRef(null);i.useEffect(()=>{const s=xr.current?.ownerDocument.defaultView??null,m=yr.current;if(m!==null&&m.view===s)return;if(m?.unregister(),s===null){yr.current=null;return}const f=kl(s,{ownsHit:w=>rn.current.ownsWheelHit(w),distanceToRailPx:(w,y)=>rn.current.distanceToRailPx(w,y),step:w=>rn.current.stepFromRangeAreaWheel(w)});yr.current={view:s,unregister:f}}),i.useEffect(()=>()=>{yr.current?.unregister(),yr.current=null},[]);const nn=Yt(M),on=Yt(V),eo=oe(M),to=oe(V),ro=_a(nn,on,Gn),Tr=ro.slant,Pr=v==="low"||v!=="high"&&De==="low",Er=!O&&(v==="high"||v!=="low"&&De==="high"),qi=Un&&_e!=="macro-low",Zi=Un&&_e==="macro-low",Qi=Wn&&_e!=="micro-low",Ji=Wn&&_e==="micro-low",lr=bo("macro",at,ut,Kn),sr=bo("micro",Qt,Mr,Xn),el=Math.min(nn,on),tl=Math.max(nn,on),[ba,wa]=jr.flat,[rl,nl]=jr.macro,[ol,al]=jr.micro,va=$t(ba,nn),Da=$t(wa,on),no=$t(ba,el),pa=`calc(${$t(wa,tl)} - ${no})`,cr=$t(rl,at*100),an=$t(nl,ut*100),ur=$t(ol,Qt*100),ln=$t(al,Mr*100),il=b?{bottom:no,height:pa,top:"auto",left:"0",right:"0"}:{left:no,width:pa,top:"0",bottom:"0"},ll=Math.max(.01,ut-at),Ma=Math.max(.06,Math.min(.25,.28*Math.sqrt(ll))),sl=b?{bottom:va,left:"50%",transform:"translate(-50%, 50%)",zIndex:Pr?40:30}:{left:va,top:"50%",transform:"translate(-50%, -50%)",zIndex:Pr?40:30},cl=b?{bottom:Da,left:"50%",transform:"translate(-50%, 50%)",zIndex:Er?40:30}:{left:Da,top:"50%",transform:"translate(-50%, -50%)",zIndex:Er?40:30},ul=b?{bottom:`${Qe}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${Qe}%`,top:"50%",transform:"translate(-50%, -50%)"},xa=xe!==null?oe(xe):null,dl=g!=="hover"&&xe!==null&&(xe===M||!O&&xe===V),ml=ot?re(A,fe[0],u):ye,fl=ot?re(A,fe[fe.length-1],u):Ae,gl=de?Oe>ml:M>p,hl=de?Ge<fl:V<E,sn=es(de?[{side:$?"before":"after",box:wn(Wo,Go),...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:lr.slant.lowAngleDeg,centreOffsetPx:null,alongPushPx:lr.slant.lowOffsetX}},{side:$?"after":"before",box:L?zn:wn(zn,Ko),...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:sr.slant.lowAngleDeg,centreOffsetPx:null,alongPushPx:sr.slant.lowOffsetX}}]:[{side:b||D==="top"?"before":"after",box:O?tr:wn(tr,Uo),...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:Tr.lowAngleDeg,centreOffsetPx:Tr.lowOffsetY,alongPushPx:Tr.lowOffsetX}}]),bl=sn===void 0?e.style:{...e.style,...sn.style};i.useLayoutEffect(()=>{jo.current=sn===void 0?0:sn.mainPx});const mt=L?"micro-point":"micro-low",Ht=l?"cursor-not-allowed opacity-50":"cursor-pointer",Ra=s=>{const m=b?"vertical":"horizontal",f=s==="decrease",w=b?!f:f;return x.jsx(Kt,{ref:f?Fo:zo,neighbour:"rail",direction:ts[m][s],disabled:l,canStep:f?gl:hl,onStep:()=>Jn(f?-1:1),ariaLabel:f?K.decrease:K.increase,className:`period-slider-stepper-btn ${rs[m][s]} ${ja[m][w?"leading":"trailing"]}`})};return x.jsxs("div",{ref:xr,style:bl,className:`period-slider grid select-none place-items-center ${ns[b?"vertical":"horizontal"][d?"withSteppers":"railOnly"]} ${c}`,"data-disabled":l?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":b?"vertical":"horizontal","data-label-position":D,"data-color-scheme":R,children:[x.jsx("div",{ref:Ho,"data-range-area":"true","aria-hidden":"true",className:"period-slider-range-area"}),d&&Ra(b?"increase":"decrease"),x.jsx("div",{ref:Ze,"data-testid":"period-slider-track","data-orientation":b?"vertical":"horizontal","data-vernier-orientation":de?nt:void 0,className:`period-slider-track relative touch-none rounded-full ${ja[b?"vertical":"horizontal"][d?"rail":"railOnly"]} ${Ht}`,onPointerDown:Wi,onPointerMove:Gi,onPointerLeave:Ki,children:de?x.jsxs(x.Fragment,{children:[Ci&&(b?x.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:[x.jsx("defs",{children:x.jsxs("linearGradient",{id:j,x1:"0",y1:"0",x2:"1",y2:"0",children:[x.jsx("stop",{offset:"0%",stopColor:$?J.macro:J.micro,stopOpacity:"0.28"}),x.jsx("stop",{offset:"100%",stopColor:$?J.micro:J.macro,stopOpacity:Ma})]})}),x.jsx("path",{ref:jn,"data-testid":"period-slider-vernier-projection",d:co(at,ut,b,$),fill:`url(#${j})`})]}):x.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[x.jsx("defs",{children:x.jsxs("linearGradient",{id:j,x1:"0",y1:"0",x2:"0",y2:"1",children:[x.jsx("stop",{offset:"0%",stopColor:$?J.macro:J.micro,stopOpacity:"0.28"}),x.jsx("stop",{offset:"100%",stopColor:$?J.micro:J.macro,stopOpacity:Ma})]})}),x.jsx("path",{ref:jn,"data-testid":"period-slider-vernier-projection",d:co(at,ut,b,$),fill:`url(#${j})`})]})),!h&&x.jsxs(x.Fragment,{children:[x.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:b?{bottom:`calc(${cr} - 8px)`,height:`calc(${an} - ${cr} + 16px)`}:{left:`calc(${cr} - 8px)`,width:`calc(${an} - ${cr} + 16px)`},onPointerDown:ar("macro-connect")}),!L&&x.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:b?{bottom:`calc(${ur} - 8px)`,height:`calc(${ln} - ${ur} + 16px)`}:{left:`calc(${ur} - 8px)`,width:`calc(${ln} - ${ur} + 16px)`},onPointerDown:ar("micro-connect")})]}),Ii&&x.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(s=>x.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:b?{bottom:`${s*100}%`}:{left:`${s*100}%`}},`macro-tick-${s}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(s=>x.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:b?{bottom:`${s*100}%`}:{left:`${s*100}%`}},`micro-tick-${s}`))]}),x.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":K.macroRangeStart,"aria-disabled":l?"true":void 0,"aria-valuemin":Fe,"aria-valuemax":We,"aria-valuenow":Ue,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(wt,Q,"period"):Bt(Q,wt,Ur,C),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?$?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":$?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Ht}`,style:b?{bottom:cr,left:$?0:"auto",right:$?"auto":0,transform:$?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:qe==="macro-low"||_e==="macro-low"?30:15}:{left:cr,top:$?0:"auto",bottom:$?"auto":0,transform:$?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:qe==="macro-low"||_e==="macro-low"?30:15},onPointerDown:ar("macro-low"),onKeyDown:tn("macro-low"),onFocus:en("macro-low"),"data-active":qe==="macro-low"?"true":void 0,"data-front":_e==="macro-low"?"true":void 0,"data-vernier-pos":b?$?"left":"right":$?"top":"bottom","data-handle-type":"macro-low",children:[x.jsx(Hr,{type:"macro",isTop:$,isVertical:b,isLeft:$}),Br&&x.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),g!=="hover"&&x.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-duplicate":qi?"true":void 0,"data-slanted":lr.slant.isSlanted?"true":void 0,ref:Vi,style:lr.lowStyle,children:He(Q,wt,Ur,C)})]}),x.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":K.macroRangeEnd,"aria-disabled":l?"true":void 0,"aria-valuemin":Ue,"aria-valuemax":ct,"aria-valuenow":We,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Vt,Q,"period"):Bt(Q,Vt,Ur,C),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?$?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":$?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Ht}`,style:b?{bottom:an,left:$?0:"auto",right:$?"auto":0,transform:$?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:qe==="macro-high"||_e==="macro-high"?30:15}:{left:an,top:$?0:"auto",bottom:$?"auto":0,transform:$?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:qe==="macro-high"||_e==="macro-high"?30:15},onPointerDown:ar("macro-high"),onKeyDown:tn("macro-high"),onFocus:en("macro-high"),"data-active":qe==="macro-high"?"true":void 0,"data-front":_e==="macro-high"?"true":void 0,"data-vernier-pos":b?$?"left":"right":$?"top":"bottom","data-handle-type":"macro-high",children:[x.jsx(Hr,{type:"macro",isTop:$,isVertical:b,isLeft:$}),Br&&x.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),g!=="hover"&&x.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-duplicate":Zi?"true":void 0,"data-slanted":lr.slant.isSlanted?"true":void 0,ref:Ni,style:lr.highStyle,children:He(Q,Vt,Ur,C)})]}),x.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":L?K.microSelectedDate:K.microRangeStart,"aria-disabled":l?"true":void 0,"aria-valuemin":ye,"aria-valuemax":L?Ae:Ge,"aria-valuenow":Oe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(yt,A,"period"):Bt(A,yt,Wr,C),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?$?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":$?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Ht}`,style:b?{bottom:ur,left:$?"auto":0,right:$?0:"auto",transform:$?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:qe===mt||_e===mt?30:20}:{left:ur,top:$?"auto":0,bottom:$?0:"auto",transform:$?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:qe===mt||_e===mt?30:20},onPointerDown:ar(mt),onKeyDown:tn(mt),onFocus:en(mt),"data-active":qe===mt?"true":void 0,"data-front":_e===mt?"true":void 0,"data-vernier-pos":b?$?"right":"left":$?"bottom":"top","data-handle-type":mt,children:[x.jsx(Hr,{type:"micro",isTop:!$,isVertical:b,isLeft:!$}),Br&&x.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),g!=="hover"&&x.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-duplicate":Qi?"true":void 0,"data-slanted":sr.slant.isSlanted?"true":void 0,ref:Yi,style:sr.lowStyle,children:He(A,yt,Wr,C)})]}),!L&&x.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":K.microRangeEnd,"aria-disabled":l?"true":void 0,"aria-valuemin":Oe,"aria-valuemax":Ae,"aria-valuenow":Ge,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Tt,A,"period"):Bt(A,Tt,Wr,C),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?$?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":$?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${Ht}`,style:b?{bottom:ln,left:$?"auto":0,right:$?0:"auto",transform:$?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:qe==="micro-high"||_e==="micro-high"?30:20}:{left:ln,top:$?"auto":0,bottom:$?0:"auto",transform:$?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:qe==="micro-high"||_e==="micro-high"?30:20},onPointerDown:ar("micro-high"),onKeyDown:tn("micro-high"),onFocus:en("micro-high"),"data-active":qe==="micro-high"?"true":void 0,"data-front":_e==="micro-high"?"true":void 0,"data-vernier-pos":b?$?"right":"left":$?"bottom":"top","data-handle-type":"micro-high",children:[x.jsx(Hr,{type:"micro",isTop:!$,isVertical:b,isLeft:!$}),Br&&x.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),g!=="hover"&&x.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-duplicate":Ji?"true":void 0,"data-slanted":sr.slant.isSlanted?"true":void 0,ref:_i,style:sr.highStyle,children:He(A,Tt,Wr,C)})]})]}):x.jsxs(x.Fragment,{children:[!h&&x.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:il,onPointerDown:Ui}),S&&T&&z.length>1&&x.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:z.map((s,m)=>{const f=re(t,s,u),w=Yt(m),y=b?{bottom:`${w}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${w}%`,top:"50%",transform:"translate(-50%, -50%)"};return x.jsx("div",{"data-testid":"period-slider-tick",className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full",style:y},`tick-${f}`)})}),!l&&xe!==null&&Qe!==null&&v===null&&xa&&x.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:ul,children:[x.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"}),x.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":dl?"true":void 0,className:`period-slider-hover-tooltip ${D==="bottom"&&!b?"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:He(t,xa,e.formatLabel,C)})]}),x.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":O?K.selectedDate:K.rangeStart,"aria-disabled":l?"true":void 0,"aria-valuemin":p,"aria-valuemax":O?E:V,"aria-valuenow":M,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(eo,t,"period"):Bt(t,eo,e.formatLabel,C),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${Ht}`,style:sl,onPointerDown:ua("low"),onKeyDown:ma("low"),onFocus:da("low"),"data-active":v==="low"?"true":void 0,"data-front":Pr?"true":void 0,children:[x.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)] dark:group-focus-visible:ring-blue-400 ${v==="low"?"":"shadow-md"}`}),g!=="hover"&&x.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-label-position":D,"data-slanted":Tr.isSlanted?"true":void 0,"data-front":Pr?"true":void 0,"data-duplicate":Bn&&!Pr?"true":void 0,ref:ki,style:ro.lowStyle,children:He(t,eo,e.formatLabel,C)})]}),!O&&x.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":K.rangeEnd,"aria-disabled":l?"true":void 0,"aria-valuemin":M,"aria-valuemax":E,"aria-valuenow":V,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(to,t,"period"):Bt(t,to,e.formatLabel,C),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${Ht}`,style:cl,onPointerDown:ua("high"),onKeyDown:ma("high"),onFocus:da("high"),"data-active":v==="high"?"true":void 0,"data-front":Er?"true":void 0,children:[x.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)] dark:group-focus-visible:ring-blue-400 ${v==="high"?"":"shadow-md"}`}),g!=="hover"&&x.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":g,"data-label-position":D,"data-slanted":Tr.isSlanted?"true":void 0,"data-front":Er?"true":void 0,"data-duplicate":Bn&&!Er?"true":void 0,ref:Oi,style:ro.highStyle,children:He(t,to,e.formatLabel,C)})]})]})}),d&&Ra(b?"decrease":"increase")]})},wo=(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},pi=(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},as=(e,t)=>e===t?!0:e.mode!==t.mode||e.unit!==t.unit||e.yearStartMonth!==t.yearStartMonth||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||!pi(e.style,t.style)||e.snapMode!==t.snapMode||e.formatLabel!==t.formatLabel||e.formatLocale!==t.formatLocale||e.locale!==t.locale||!Cn(e.labels,t.labels)||e.formatAriaValueText!==t.formatAriaValueText||!wo(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||!wo(e.macroAllowedDates,t.macroAllowedDates)||!wo(e.microAllowedDates,t.microAllowedDates)):!1,Mi=i.memo(os,as);Mi.displayName="PeriodSlider";const xi=864e5,za=2,Pe=-1,vn=e=>{const t=e.getFullYear(),r=new Date(Date.UTC(t,e.getMonth(),e.getDate()));return r.setUTCFullYear(t),Math.floor(r.getTime()/xi)},Ri=e=>{const t=new Date(e*xi),r=new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return r.setFullYear(t.getUTCFullYear()),r.setHours(0,0,0,0),r},Vr=e=>`${An(e.getFullYear())}-${String(e.getMonth()+1).padStart(za,"0")}-${String(e.getDate()).padStart(za,"0")}`,is=(e,t,r,n)=>{const o=vn(e),a=vn(t),l=a>=o?a-o+1:0,c=d=>Ri(a-d);return{count:l,dateAt:c,labelAt:d=>He("day",c(d),n,r),indexOf:d=>{const g=vn(d);return g<o||g>a?Pe:a-g}}},ls=(e,t,r,n,o)=>{const a=r>=t?r-t+1:0,l=c=>e[r-c];return{count:a,dateAt:l,labelAt:c=>He("day",l(c),o,n),indexOf:c=>{const d=c.getTime();let g=t,D=r;for(;g<=D;){const k=g+D>>1,b=e[k].getTime();if(b===d)return r-k;b<d?g=k+1:D=k-1}return Pe}}},ss={count:0,dateAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(e)})`)},labelAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(e)})`)},indexOf:()=>Pe},cs=(e,t,r)=>{const n=c=>{let d=0,g=e.length;for(;d<g;){const D=d+g>>1;e[D].getTime()<c?d=D+1:g=D}return d},o=c=>{let d=0,g=e.length;for(;d<g;){const D=d+g>>1;e[D].getTime()<=c?d=D+1:g=D}return d},a=t===null?0:n(t.getTime()),l=(r===null?e.length:o(r.getTime()))-1;return{loIndex:a,hiIndex:l}},Ba=(e,t,r,n,o)=>{let a=t,l=r,c=null;for(;a<=l;){const d=a+l>>1,g=e[d].getTime();o===-1?g<n?(c=e[d],a=d+1):l=d-1:g>n?(c=e[d],l=d-1):a=d+1}return c},us=(e,t)=>{const r=new Map;return e.forEach((n,o)=>{t(o,n);const a=new Date(n);a.setHours(0,0,0,0);const l=a.getTime();r.has(l)||r.set(l,a)}),Array.from(r.keys()).sort((n,o)=>n-o).map(n=>r.get(n))},ds={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},ms={month:2,day:2},Ua={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},Wa=new Map,fs=(e,t)=>{const r=`${e}\0${t}`,n=Wa.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,ds[e]);return Wa.set(r,o),o},gs=(e,t,r)=>r!==void 0?fs(e,r).format(t):e==="year"?An(Ua.year(t)):String(Ua[e](t)).padStart(ms[e],"0"),Si=(e,t,r,n)=>{if(t!=="year"&&t!=="month"&&t!=="day")throw new RangeError(`formatOptionText: unit must be "year", "month" or "day" (received: ${String(t)})`);if(r!=="period"&&r!=="part")throw new RangeError(`formatOptionText: scope must be "period" or "part" (received: ${String(r)})`);return Xe(e)?r==="part"?gs(t,e,n):He(t,e,void 0,n):""},Dn=44,Ga=7,fn=8,hs=2,Li=10,bs=1e3,Lo=8,vo=6,Do=4,po=12,Nr=(e,t)=>{const r=new Date(e,t-1,1);return r.setFullYear(e),vn(r)},ws=(e,t)=>{if(e.length<Do||t.count===0)return Pe;const r=Number(e.slice(0,Do));if(!Number.isInteger(r))return Pe;const n=e.length>=vo,o=n?Number(e.slice(Do,vo)):po;if(o<1||o>po)return Pe;const a=e.length>=Lo,l=a?Number(e.slice(vo,Lo)):0,c=Nr(r,o),d=(o===po?Nr(r+1,1):Nr(r,o+1))-1,g=a?c+l-1:n?c:Nr(r,1),D=a?g:n?d:Nr(r+1,1)-1;if(a&&(l<1||g>d))return Pe;for(let k=D;k>=g;k--){const b=t.indexOf(Ri(k));if(b!==Pe)return b}return Pe},vs=e=>e.closest(".dark")===null?"light":"dark",Ds=(e,t,r,n)=>{const o=r-e.bottom-fn,a=e.top-fn,l=o>=t||o>=a,d=Math.max(Dn,Math.min(t,l?o:a)),g=l?e.bottom:e.top-d,D=e.width+Li,k=Math.max(fn,Math.min(e.left,n-D-fn));return{top:g,left:k,width:D,height:d}},yi=({domain:e,selectedIndex:t,displayLabel:r,machineValue:n,disabled:o,ariaLabel:a,locale:l,labels:c,onCommitIndex:d,controlClassName:g})=>{const D=i.useId(),k=i.useMemo(()=>Ll(c),[c]),b=`period-slider-date-listbox-${D}`,h=I=>`period-slider-date-option-${D}-${I}`,[S,R]=i.useState(!1),[C,u]=i.useState(Pe),[q,L]=i.useState(!0),[K,J]=i.useState(null),[j,ae]=i.useState(null),N=i.useRef(null),ne=i.useRef(null),z=i.useRef(null),T=i.useRef({buffer:"",at:0}),p=i.useRef(e);p.current=e;const E=e.count,O=Math.min(E,Ga)*Dn,oe=Math.max(1,Math.min(E,Ga)),F=i.useCallback(()=>{const I=N.current;if(I===null)return;const ie=I.getBoundingClientRect();J(Ds(ie,O,window.innerHeight,window.innerWidth))},[O]),U=i.useCallback(()=>{R(!1),u(Pe),T.current={buffer:"",at:0}},[]),Re=i.useCallback(I=>{o||E===0||(u(I),R(!0))},[o,E]);i.useLayoutEffect(()=>{if(!S){J(null),ae(null);return}const I=N.current;return I!==null&&ae(vs(I)),F(),window.addEventListener("scroll",F,!0),window.addEventListener("resize",F),()=>{window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",F)}},[S,F]),i.useEffect(()=>{if(!S)return;const I=ie=>{const le=ie.target;le!==null&&ne.current?.contains(le)!==!0&&N.current?.contains(le)!==!0&&U()};return document.addEventListener("pointerdown",I,!0),()=>document.removeEventListener("pointerdown",I,!0)},[S,U]);const ee=i.useRef(C);ee.current=C,i.useEffect(()=>{S&&(o||E===0)&&U()},[S,o,E,U]),i.useEffect(()=>{if(!S)return;const I=ee.current;if(I===Pe)return;const ie=Math.min(I,E-1);ie!==I&&u(ie),z.current?.scrollToIndex(ie,{align:"center"})},[E,S]);const ce=I=>{if(E===0)return;const ie=Math.max(0,Math.min(I,E-1));u(ie),z.current?.scrollToIndex(ie,{align:"center"})},W=I=>{I<0||I>=E||(d(I),U(),N.current?.focus())},G=I=>{if(o)return;const ie=C!==Pe?C:t!==Pe?t:0;switch(I.key){case"ArrowDown":if(I.preventDefault(),!S){Re(ie);return}ce(ie+1);return;case"ArrowUp":if(I.preventDefault(),!S){Re(ie);return}ce(ie-1);return;case"Home":if(!S)return;I.preventDefault(),ce(0);return;case"End":if(!S)return;I.preventDefault(),ce(E-1);return;case"PageDown":if(!S)return;I.preventDefault(),ce(ie+oe);return;case"PageUp":if(!S)return;I.preventDefault(),ce(ie-oe);return;case"Enter":if(I.preventDefault(),!S){Re(ie);return}W(C!==Pe?C:ie);return;case"Escape":if(!S)return;I.preventDefault(),U();return;case"Tab":S&&U();return}if(I.key.length!==1)return;const le=I.key>="0"&&I.key<="9",Se=I.key==="-"||I.key==="/"||I.key===".";if(!(le||Se))return;I.preventDefault();const Ce=Date.now(),Le=Ce-T.current.at>bs?"":T.current.buffer,ke=le?`${Le}${I.key}`.slice(0,Lo):Le;T.current={buffer:ke,at:Ce};const Be=ws(ke,p.current);if(Be!==Pe){if(!S){Re(Be);return}ce(Be)}},ue=i.useCallback(I=>I,[]),pe=i.useCallback(()=>Dn,[]),Me=i.useCallback(I=>{const ie=ee.current;L(ie===Pe||ie>=I.renderingStartIndex&&ie<=I.renderingEndIndex)},[]),$e=S&&K!==null&&j!==null&&E>0?x.jsx("div",{ref:ne,className:"period-slider-date-popup","data-testid":"period-slider-date-popup","data-color-mode":j,style:{top:K.top,left:K.left,width:K.width,height:K.height},onMouseDown:I=>{I.preventDefault()},children:x.jsx(Ot.VirtualScroll,{ref:z,itemCount:E,getItem:ue,getItemHeight:pe,viewportSize:K.height-hs,initialScrollIndex:C!==Pe?C:void 0,onRangeChange:Me,className:"h-full w-full",testId:"period-slider-date-listbox-pane",locale:l,labels:k,contentProps:{id:b,role:"listbox","aria-label":a},scrollBarOptions:{width:Li,enableArrowButtons:!1,enableThumbDrag:!0,enableTrackClick:!0,tapScrollCircleOptions:{enabled:!1}},behaviorOptions:{enableKeyboardNavigation:!1,overscrollBehavior:"contain"},children:I=>{const ie=I===t,le=I===C;return x.jsx("div",{id:h(I),role:"option","aria-selected":ie,"aria-posinset":I+1,"aria-setsize":E,"data-testid":"period-slider-date-option","data-active":le?"true":void 0,className:"period-slider-date-option",style:{height:Dn},onClick:()=>W(I),children:p.current.labelAt(I)})}})}):null;return x.jsxs(x.Fragment,{children:[x.jsx("input",{ref:N,type:"text",role:"combobox",readOnly:!0,"aria-label":a,"aria-expanded":S,"aria-controls":S?b:void 0,"aria-haspopup":"listbox","aria-autocomplete":"none","aria-activedescendant":S&&C!==Pe&&q?h(C):void 0,disabled:o,value:r,className:g,"data-testid":"period-slider-date-combobox","data-value":n,onKeyDown:G,onMouseDown:I=>{o||(I.preventDefault(),N.current?.focus(),S?U():Re(t!==Pe?t:0))},onBlur:()=>{S&&U()}}),$e===null?null:vl.createPortal($e,document.body)]})};yi.displayName="VirtualDateDropdown";const Ut=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},Yr=(e,t)=>{if(!(t instanceof Date)||Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},ps=e=>{if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`DateSelector: "formatLocale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`)}},Mt=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},Mo=e=>Mt(e,1,1),Ms=e=>Mt(e,12,31),xs=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:a,maxYear:l,minDate:c,maxDate:d,allowedDates:g,variant:D="date",className:k="",style:b,disabled:h=!1,locale:S,labels:R,formatLocale:C,formatOption:u}=e;if(ps(C),t!==void 0&&Yr("value",t),r!==void 0&&Yr("initialDate",r),c!==void 0&&Yr("minDate",c),d!==void 0&&Yr("maxDate",d),a!==void 0&&!Number.isInteger(a))throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(a)})`);if(l!==void 0&&!Number.isInteger(l))throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(l)})`);if(D==="split-dropdown"&&g!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const q=t??r;if(q===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 L=In(S,R),[K,J]=i.useState(()=>Ut(q)),j=t!==void 0,ae=t?.getTime(),N=i.useMemo(()=>t!==void 0?Ut(t):K,[ae,K]),ne=c?.getTime(),z=d?.getTime(),T=i.useMemo(()=>{const M=c?Ut(c):null,V=a!==void 0?Mo(a):null;return M===null?V:V===null||M.getTime()>=V.getTime()?M:V},[ne,a]),p=i.useMemo(()=>{const M=d?Ut(d):null,V=l!==void 0?Ms(l):null;return M===null?V:V===null||M.getTime()<=V.getTime()?M:V},[z,l]),E=T?.getTime()??null,O=p?.getTime()??null;if(T!==null&&p!==null&&T.getTime()>p.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Vr(T)} is after max ${Vr(p)})`);if(D!=="date"&&g===void 0&&(T===null||p===null))throw new RangeError(`DateSelector: variant="${D}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${D==="dropdown"?' or supply "allowedDates"':""}`);const oe=i.useMemo(()=>g===void 0?null:g.map(M=>M.getTime()).join(","),[g]),F=i.useMemo(()=>g===void 0?null:us(g,(M,V)=>Yr(`allowedDates[${M}]`,V)),[oe]),U=i.useMemo(()=>F===null?null:{ascending:F,...cs(F,T,p)},[F,E,O]),Re=i.useMemo(()=>U!==null?ls(U.ascending,U.loIndex,U.hiIndex,C,u):T===null||p===null?ss:is(T,p,C,u),[U,E,O,C,u]),ee=M=>{if(U!==null)return Re.indexOf(M)!==Pe;const V=M.getTime();return!(E!==null&&V<E||O!==null&&V>O)},ce=q.getTime();i.useEffect(()=>{j||J(Ut(q))},[j,ce]);const W=M=>{if(h)return;const V=Ut(M);ee(V)&&(j||J(V),n?.(V))},G=N.getTime(),ue=ee(N),pe=i.useMemo(()=>{if(U!==null)return Ba(U.ascending,U.loIndex,U.hiIndex,G,-1);const M=lt.addDays(new Date(G),-1);return ee(M)?M:null},[U,G,E,O]),Me=i.useMemo(()=>{if(U!==null)return Ba(U.ascending,U.loIndex,U.hiIndex,G,1);const M=lt.addDays(new Date(G),1);return ee(M)?M:null},[U,G,E,O]),$e=()=>{pe!==null&&W(pe)},I=()=>{Me!==null&&W(Me)},ie=M=>{if(M.target.value){const V=lt.parseISO(M.target.value);Number.isNaN(V.getTime())||W(V)}},le=N.getFullYear(),Se=N.getMonth()+1,Ce=N.getDate(),Le=i.useCallback((M,V)=>u?u(V,M,"part"):Si(V,M,"part",C),[u,C]),ke=i.useMemo(()=>{if(D!=="split-dropdown"||T===null||p===null)return[];const M=[];for(let V=p.getFullYear();V>=T.getFullYear();V--)M.push({value:V,label:Le("year",Mo(V))});return M},[D,E,O,Le]),Be=i.useMemo(()=>{if(D!=="split-dropdown"||T===null||p===null)return[];const M=T,V=p,Je=le===M.getFullYear()?M.getMonth()+1:1,de=le===V.getFullYear()?V.getMonth()+1:12,nt=[];for(let $=Je;$<=de;$++)nt.push({value:$,label:Le("month",Mt(le,$,1))});return nt},[D,E,O,le,Le]),Z=i.useMemo(()=>{if(D!=="split-dropdown"||T===null||p===null)return[];const M=T,V=p,Je=le===M.getFullYear()&&Se===M.getMonth()+1?M.getDate():1,de=le===V.getFullYear()&&Se===V.getMonth()+1?V.getDate():lt.getDaysInMonth(new Date(G)),nt=[];for(let $=Je;$<=de;$++)nt.push({value:$,label:Le("day",Mt(le,Se,$))});return nt},[D,E,O,G,le,Se,Le]),te=(M,V,Je)=>Je>lt.getDaysInMonth(Mt(M,V,1))?!1:ee(Mt(M,V,Je)),ge=(M,V,Je)=>{te(M,V,Je)&&W(Mt(M,V,Je))},v=ke.some(M=>M.value===le),P=Be.some(M=>M.value===Se),X=Z.some(M=>M.value===Ce),De=Vr(N),he=D==="dropdown"?He("day",N,u,C):"",xe=T?Vr(T):void 0,Ye=p?Vr(p):void 0,Qe="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";return x.jsxs("div",{className:`inline-flex items-center ${zr} ${k}`,style:b,"data-variant":D,"data-out-of-range":ue?void 0:"true",children:[x.jsx(Kt,{neighbour:"control",direction:"left",disabled:h,canStep:pe!==null,onStep:$e,ariaLabel:L.previousDay}),D==="dropdown"?x.jsx(yi,{domain:Re,selectedIndex:ue?Re.indexOf(N):Pe,displayLabel:he,machineValue:De,disabled:h,ariaLabel:L.dateSelect,locale:S,labels:L,onCommitIndex:M=>W(Re.dateAt(M)),controlClassName:"period-slider-date-combobox-field 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"}):D==="split-dropdown"?x.jsxs("div",{className:"inline-flex items-center gap-1",children:[x.jsxs("select",{"aria-label":L.splitYear,disabled:h,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:v?le:"",onChange:M=>ge(Number(M.target.value),Se,Ce),children:[v?null:x.jsx("option",{value:"",disabled:!0,className:Qe,children:Le("year",Mo(le))}),ke.map(M=>x.jsx("option",{value:M.value,disabled:!te(M.value,Se,Ce),className:"dark:bg-slate-700 dark:text-slate-100",children:M.label},M.value))]}),x.jsxs("select",{"aria-label":L.splitMonth,disabled:h,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:P?Se:"",onChange:M=>ge(le,Number(M.target.value),Ce),children:[P?null:x.jsx("option",{value:"",disabled:!0,className:Qe,children:Le("month",Mt(le,Se,1))}),Be.map(M=>x.jsx("option",{value:M.value,disabled:!te(le,M.value,Ce),className:"dark:bg-slate-700 dark:text-slate-100",children:M.label},M.value))]}),x.jsxs("select",{"aria-label":L.splitDay,disabled:h,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:X?Ce:"",onChange:M=>ge(le,Se,Number(M.target.value)),children:[X?null:x.jsx("option",{value:"",disabled:!0,className:Qe,children:Le("day",Mt(le,Se,Ce))}),Z.map(M=>x.jsx("option",{value:M.value,disabled:!te(le,Se,M.value),className:"dark:bg-slate-700 dark:text-slate-100",children:M.label},M.value))]})]}):x.jsx("input",{"aria-label":L.dateSelect,disabled:h,className:"period-slider-native-date-field w-28 rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",value:De,min:xe,max:Ye,onChange:ie,type:"date"}),x.jsx(Kt,{neighbour:"control",direction:"right",disabled:h,canStep:Me!==null,onStep:I,ariaLabel:L.nextDay}),o]})},hr=e=>e===void 0?null:Ut(e).getTime(),Ti=i.memo(xs,(e,t)=>!(hr(e.value??e.initialDate)!==hr(t.value??t.initialDate)||hr(e.minDate)!==hr(t.minDate)||hr(e.maxDate)!==hr(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.locale!==t.locale||!Cn(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption));Ti.displayName="DateSelector";function rt(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 Wt(e){return`${An(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}`}function _r(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 Ka(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function Rs(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`MonthSelector: \`formatLocale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function Ss(e,t){const r=e===void 0?null:rt(e,0),n=t===void 0?null:rt(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function Ls(e,t){const r=e===void 0?null:rt(e,11),n=t===void 0?null:rt(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function ys(e,t,r){const n=new Map;for(const o of e){const a=rt(o.getFullYear(),o.getMonth());t!==null&&a<t||r!==null&&a>r||n.has(a.getTime())||n.set(a.getTime(),a)}return Array.from(n.values()).sort((o,a)=>o.getTime()-a.getTime())}function Ts(e,t){const r=e.getFullYear()*12+e.getMonth(),n=t.getFullYear()*12+t.getMonth(),o=[];for(let a=r;a<=n;a++)o.push(rt(Math.floor(a/12),(a%12+12)%12));return o}function Xa(e,t,r){const n=[];for(let o=e.length-1;o>=0;o--)n.push({label:He("month",e[o],r,t),value:Wt(e[o])});return n}const Ps=e=>{const{value:t,initialDate:r,onChange:n,children:o,variant:a="date",minYear:l,maxYear:c,minDate:d,maxDate:g,allowedMonths:D,isWarning:k=!1,className:b="",style:h,disabled:S=!1,locale:R,labels:C,formatLocale:u,formatOption:q}=e;Rs(u),_r(t,"value"),_r(r,"initialDate"),_r(d,"minDate"),_r(g,"maxDate"),Ka(l,"minYear"),Ka(c,"maxYear"),D?.forEach((v,P)=>{_r(v,`allowedMonths[${P}]`)});const L=t??r;if(L===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 K=In(R,C),[J,j]=i.useState(()=>rt(L.getFullYear(),L.getMonth())),ae=t!==void 0,N=i.useMemo(()=>t!==void 0?rt(t.getFullYear(),t.getMonth()):J,[t?.getTime(),J]),ne=d?.getTime(),z=g?.getTime(),T=i.useMemo(()=>Ss(l,d),[l,ne]),p=i.useMemo(()=>Ls(c,g),[c,z]),E=T?.getTime()??null,O=p?.getTime()??null;if(T!==null&&p!==null&&T>p)throw new RangeError(`MonthSelector: the resolved lower bound ${Wt(T)} is after the resolved upper bound ${Wt(p)}.`);if(a==="dropdown"&&D===void 0&&(T===null||p===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 oe=D===void 0?null:D.map(v=>v.getTime()).join(","),F=i.useMemo(()=>D===void 0?null:ys(D,T,p),[oe,E,O]),U=v=>{const P=v.getTime();return F!==null?F.some(X=>X.getTime()===P):!(E!==null&&P<E||O!==null&&P>O)},Re=L.getTime();i.useEffect(()=>{if(ae)return;const v=rt(L.getFullYear(),L.getMonth());j(P=>P.getTime()===v.getTime()?P:v)},[ae,Re]);const ee=v=>{if(S)return;if(!U(v))throw new RangeError(`MonthSelector: refusing to emit ${Wt(v)}, which lies outside the selectable months.`);ae||j(v);const P=v.getFullYear()*100+(v.getMonth()+1);n?.(v,P)},ce=N.getTime(),W=U(N),G=i.useMemo(()=>{if(F!==null){for(let P=F.length-1;P>=0;P--)if(F[P].getTime()<ce)return F[P];return null}const v=rt(N.getFullYear(),N.getMonth()-1);return U(v)?v:null},[F,ce,E,O]),ue=i.useMemo(()=>{if(F!==null){for(const P of F)if(P.getTime()>ce)return P;return null}const v=rt(N.getFullYear(),N.getMonth()+1);return U(v)?v:null},[F,ce,E,O]),pe=()=>{G!==null&&ee(G)},Me=()=>{ue!==null&&ee(ue)},$e=v=>{if(!v)return;const P=v.lastIndexOf("-");if(P<=0)return;const X=v.slice(0,P),De=v.slice(P+1),he=Number(X),xe=Number(De)-1;if(!(Number.isInteger(he)&&Number.isInteger(xe)))return;const Ye=rt(he,xe);U(Ye)&&ee(Ye)},I=v=>{$e(v.target.value)},ie=v=>{$e(v.target.value)},le=Wt(N),Se=a==="dropdown"&&!W?He("month",N,q,u):"",Ce=T?Wt(T):void 0,Le=p?Wt(p):void 0,ke=i.useMemo(()=>a!=="dropdown"?[]:F!==null?Xa(F,u,q):T===null||p===null?[]:Xa(Ts(T,p),u,q),[a,F,E,O,u,q]),Be=W?le:"",Z=k?"border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200":"border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",te=`period-slider-native-date-field w-28 rounded-md border py-0.5 px-1 text-center font-mono text-xs tabular-nums dark:placeholder:text-gray-400 disabled:opacity-50 ${Z}`,ge=`w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${Z}`;return x.jsxs("div",{className:`inline-flex items-center ${zr} ${b}`,style:h,"data-out-of-range":W?void 0:"true",children:[x.jsx(Kt,{neighbour:"control",direction:"left",disabled:S,canStep:G!==null,onStep:pe,ariaLabel:K.previousMonth}),a==="dropdown"?x.jsxs("select",{"aria-label":K.monthSelect,disabled:S,className:ge,value:Be,onChange:ie,children:[W?null:x.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}),ke.map(v=>x.jsx("option",{value:v.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:v.label},v.value))]}):x.jsx("input",{"aria-label":K.monthSelect,disabled:S,className:te,value:le,min:Ce,max:Le,onChange:I,type:"month"}),x.jsx(Kt,{neighbour:"control",direction:"right",disabled:S,canStep:ue!==null,onStep:Me,ariaLabel:K.nextMonth}),o]})},Pi=i.memo(Ps,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,o=r?r.getFullYear()*12+r.getMonth():null,a=n?n.getFullYear()*12+n.getMonth():null;if(o!==a||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 l=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,c=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(l!==c)return!1;const d=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,g=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(d!==g||e.allowedMonths!==t.allowedMonths||e.onChange!==t.onChange||e.children!==t.children||e.locale!==t.locale||!Cn(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption)});Pi.displayName="MonthSelector";function wr(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 $n(e,t,r){if(wr(e,"minDate",t),wr(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 xn(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(wr(e,`${t}[0]`,r[0]),wr(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 Rn(e,t,r,n,o,a,l,c){const d=re(r,n,c);if(d<re(r,o,c)||d>re(r,a,c))throw new RangeError(`${e}: ${t} must lie within ${l} (value: ${n.toISOString()}, lower: ${o.toISOString()}, upper: ${a.toISOString()})`)}function Sn(e,t,r,n,o,a,l,c){Rn(e,`${t}[0]`,r,n[0],o,a,l,c),Rn(e,`${t}[1]`,r,n[1],o,a,l,c)}function Ke(e,t,r){return e<t?t:e>r?r:e}function Ln(e,t,r,n,o,a,l){if(r!==!0)return[];const c=e[0].getTime(),d=e[1].getTime();return Rt(n,t,o,a,l).filter(g=>g.getTime()>=c&&g.getTime()<=d)}function br(e,t,r,n,o){if(n.length===0)return Ke(e,r[0],r[1]);const a=n[be(n,e,t,o)];return a.getTime()===e.getTime()?e:a}function gn(e,t,r,n,o){const a=br(e[0],t,r,n,o),l=br(e[1],t,r,n,o);return[a,l<a?a:l]}function yn(e,t,r,n,o){const a=be(e,r,t,o)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function kn(e){const t=i.useRef(e),r=t.current,n=e,o=Object.keys(r),a=Object.keys(n);return o.length===a.length&&a.every(c=>Object.is(r[c],n[c]))||(t.current=e),t.current}function Es(e){const{unit:t,minDate:r,maxDate:n,initialRange:o,onChangeRange:a,yearStartMonth:l,formatOption:c,...d}=e,g=vr("usePeriodSliderRange",l);$n("usePeriodSliderRange",r,n),xn("usePeriodSliderRange","initialRange",o),Sn("usePeriodSliderRange","initialRange",t,o,r,n,"[minDate, maxDate]",g);const D=kn(d),k=i.useRef(o),[b,h]=i.useState(o);let S=b;const R=[Ke(b[0],r,n),Ke(b[1],r,n)];(R[0]!==b[0]||R[1]!==b[1])&&(S=R,h(R));const C=i.useRef(S);C.current=S;const u=i.useRef({minDate:r,maxDate:n,allowedDates:D.allowedDates});u.current={minDate:r,maxDate:n,allowedDates:D.allowedDates};const q=i.useRef(a);q.current=a;const L=i.useCallback(p=>{const{minDate:E,maxDate:O}=u.current,oe=Ke(p[0],E,O),F=Ke(p[1],E,O),U=C.current;oe.getTime()===U[0].getTime()&&F.getTime()===U[1].getTime()||(C.current=[oe,F],h([oe,F]),q.current?.(oe,F))},[]),K=i.useCallback(p=>{const E=C.current,O=p.getTime()>E[1].getTime()?p:E[1];L([p,O])},[L]),J=i.useCallback(p=>{const E=C.current,O=p.getTime()<E[0].getTime()?p:E[0];L([O,p])},[L]),j=i.useCallback((p,E)=>{L([p,E])},[L]),ae=i.useCallback(p=>{const{minDate:E,maxDate:O,allowedDates:oe}=u.current,F=C.current,U=Rt(oe,t,E,O,g);if(U.length>0){L([yn(U,t,F[0],p,g),yn(U,t,F[1],p,g)]);return}L([je(t,F[0],p),je(t,F[1],p)])},[t,L,g]),N=i.useCallback(()=>{L(k.current)},[L]),ne=i.useMemo(()=>({value:S[0],onChange:K,minDate:r,maxDate:S[1],unit:t,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:c}),[S[0],S[1],K,r,t,g,e.formatLocale,e.locale,e.labels,c]),z=i.useMemo(()=>({value:S[1],onChange:J,minDate:S[0],maxDate:n,unit:t,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:c}),[S[0],S[1],J,n,t,g,e.formatLocale,e.locale,e.labels,c]),T=i.useMemo(()=>({...D,mode:"range",unit:t,yearStartMonth:g,range:S,minDate:r,maxDate:n,onChangeRange:j}),[D,t,S,r,n,j,g]);return{range:S,lowerDate:S[0],upperDate:S[1],setRange:h,setLowerDate:K,setUpperDate:J,shiftRange:ae,resetRange:N,startSelectorProps:ne,endSelectorProps:z,sliderProps:T}}function Cs(e){const{unit:t,minDate:r,maxDate:n,initialValue:o,onChangePoint:a,yearStartMonth:l,formatOption:c,...d}=e,g=vr("usePeriodSliderPoint",l);$n("usePeriodSliderPoint",r,n),wr("usePeriodSliderPoint","initialValue",o),Rn("usePeriodSliderPoint","initialValue",t,o,r,n,"[minDate, maxDate]",g);const D=kn(d),k=i.useRef(o),[b,h]=i.useState(o);let S=b;const R=Ke(b,r,n);R!==b&&(S=R,h(R));const C=i.useRef(S);C.current=S;const u=i.useRef({minDate:r,maxDate:n,allowedDates:D.allowedDates});u.current={minDate:r,maxDate:n,allowedDates:D.allowedDates};const q=i.useRef(a);q.current=a;const L=i.useCallback(N=>{const{minDate:ne,maxDate:z}=u.current,T=Ke(N,ne,z);T.getTime()!==C.current.getTime()&&(C.current=T,h(T),q.current?.(T))},[]),K=i.useCallback(N=>{const{minDate:ne,maxDate:z,allowedDates:T}=u.current,p=Rt(T,t,ne,z,g);if(p.length>0){L(yn(p,t,C.current,N,g));return}L(je(t,C.current,N))},[t,L,g]),J=i.useCallback(()=>{L(k.current)},[L]),j=i.useMemo(()=>({value:S,onChange:L,minDate:r,maxDate:n,unit:t,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:c}),[S,L,r,n,t,g,e.formatLocale,e.locale,e.labels,c]),ae=i.useMemo(()=>({...D,mode:"point",unit:t,yearStartMonth:g,value:S,minDate:r,maxDate:n,onChangePoint:L}),[D,t,S,r,n,L,g]);return{value:S,setValue:h,shiftValue:K,resetValue:J,selectorProps:j,sliderProps:ae}}function Is(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroRange:a,macroUnit:l=t,microUnit:c=t,onChangeMacroRange:d,onChangeMicroRange:g,yearStartMonth:D,formatOption:k,...b}=e,h=vr("useVernierSliderRange",D);$n("useVernierSliderRange",r,n),xn("useVernierSliderRange","initialMacroRange",o),xn("useVernierSliderRange","initialMicroRange",a),Sn("useVernierSliderRange","initialMacroRange",l,o,r,n,"[minDate, maxDate]",h);const S=ht(l,c,o,r,n,h);Sn("useVernierSliderRange","initialMicroRange",c,a,S[0],S[1],"the initial macro window",h);const R=kn(b),C=i.useRef(o),u=i.useRef(a),[q,L]=i.useState(o),[K,J]=i.useState(a);let j=q;const ae=[Ke(q[0],r,n),Ke(q[1],r,n)];(ae[0]!==q[0]||ae[1]!==q[1])&&(j=ae,L(ae));const N=i.useMemo(()=>ht(l,c,j,r,n,h),[l,c,j,r,n,h]),ne=i.useMemo(()=>Ln(N,c,R.microIsDiscrete,R.microAllowedDates??R.allowedDates,r,n,h),[N,c,R.microIsDiscrete,R.microAllowedDates,R.allowedDates,r,n,h]),z=i.useMemo(()=>R.macroIsDiscrete===!0?Rt(R.macroAllowedDates??R.allowedDates,l,r,n,h):[],[R.macroIsDiscrete,R.macroAllowedDates,R.allowedDates,l,r,n,h]),T=i.useRef(z);T.current=z;let p=K;const E=gn(K,c,N,ne,h);(E[0]!==K[0]||E[1]!==K[1])&&(p=E,J(E));const O=i.useRef(j);O.current=j;const oe=i.useRef(p);oe.current=p;const F=i.useRef({minDate:r,maxDate:n,macroIsDiscrete:R.macroIsDiscrete,macroAllowedDates:R.macroAllowedDates,microIsDiscrete:R.microIsDiscrete,microAllowedDates:R.microAllowedDates,allowedDates:R.allowedDates});F.current={minDate:r,maxDate:n,macroIsDiscrete:R.macroIsDiscrete,macroAllowedDates:R.macroAllowedDates,microIsDiscrete:R.microIsDiscrete,microAllowedDates:R.microAllowedDates,allowedDates:R.allowedDates};const U=i.useRef(d);U.current=d;const Re=i.useRef(g);Re.current=g;const ee=i.useCallback(v=>{const{minDate:P,maxDate:X}=F.current;return ht(l,c,v,P,X,h)},[l,c,h]),ce=i.useCallback(v=>{const{microIsDiscrete:P,microAllowedDates:X,allowedDates:De,minDate:he,maxDate:xe}=F.current;return Ln(v,c,P,X??De,he,xe,h)},[c,h]),W=i.useCallback((v,P)=>{const X=O.current,De=oe.current;(v[0].getTime()!==X[0].getTime()||v[1].getTime()!==X[1].getTime())&&(O.current=v,L(v),U.current?.(v[0],v[1])),(P[0].getTime()!==De[0].getTime()||P[1].getTime()!==De[1].getTime())&&(oe.current=P,J(P),Re.current?.(P[0],P[1]))},[]),G=i.useCallback((v,P)=>{const{minDate:X,maxDate:De}=F.current,he=[Ke(v,X,De),Ke(P,X,De)],xe=ee(he);W(he,gn(oe.current,c,xe,ce(xe),h))},[c,ee,ce,W,h]),ue=i.useCallback((v,P)=>{const X=ee(O.current);W(O.current,gn([v,P],c,X,ce(X),h))},[c,ee,ce,W,h]),pe=i.useCallback(v=>{const P=O.current[1],X=v>P?v:P;G(v,X)},[G]),Me=i.useCallback(v=>{const P=O.current[0],X=v<P?v:P;G(X,v)},[G]),$e=i.useCallback(v=>{const P=oe.current[1],X=v>P?v:P;ue(v,X)},[ue]),I=i.useCallback(v=>{const P=oe.current[0],X=v<P?v:P;ue(X,v)},[ue]),ie=i.useCallback(v=>{const{minDate:P,maxDate:X}=F.current,De=O.current,he=T.current;if(he.length>0){const Qe=be(he,De[0],l,h)+v,bt=be(he,De[1],l,h)+v;if(Qe<0||bt>he.length-1)return;G(he[Qe],he[bt]);return}const xe=je(l,De[0],v),Ye=je(l,De[1],v);xe<P||Ye>X||G(xe,Ye)},[l,G,h]),le=i.useCallback(v=>{const P=O.current,X=oe.current,De=ee(P),[he,xe]=De,Ye=ce(De);if(Ye.length>0){const M=be(Ye,X[0],c,h)+v,V=be(Ye,X[1],c,h)+v;if(M<0||V>Ye.length-1)return;ue(Ye[M],Ye[V]);return}const Qe=je(c,X[0],v),bt=je(c,X[1],v);Qe<he||bt>xe||ue(Qe,bt)},[c,ee,ce,ue,h]),Se=i.useCallback(()=>{const v=C.current,P=ee(v);W(v,gn(u.current,c,P,ce(P),h))},[c,ee,ce,W,h]),[Ce,Le]=N,ke=i.useMemo(()=>({value:j[0],onChange:pe,minDate:r,maxDate:j[1],unit:l,yearStartMonth:h,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:k}),[j,pe,r,l,h,e.formatLocale,e.locale,e.labels,k]),Be=i.useMemo(()=>({value:j[1],onChange:Me,minDate:j[0],maxDate:n,unit:l,yearStartMonth:h,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:k}),[j,Me,n,l,h,e.formatLocale,e.locale,e.labels,k]),Z=i.useMemo(()=>({value:p[0],onChange:$e,minDate:Ce,maxDate:p[1],unit:c,yearStartMonth:h,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:k}),[p,$e,Ce,c,h,e.formatLocale,e.locale,e.labels,k]),te=i.useMemo(()=>({value:p[1],onChange:I,minDate:p[0],maxDate:Le,unit:c,yearStartMonth:h,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:k}),[p,I,Le,c,h,e.formatLocale,e.locale,e.labels,k]),ge=i.useMemo(()=>({...R,mode:"vernier",unit:t,yearStartMonth:h,macroUnit:l,microUnit:c,minDate:r,maxDate:n,macroRange:j,microRange:p,onChangeMacroRange:G,onChangeMicroRange:ue}),[R,t,l,c,r,n,j,p,G,ue,h]);return{macroRange:j,setMacroRange:L,microRange:p,setMicroRange:J,setMacroLowerDate:pe,setMacroUpperDate:Me,setMicroLowerDate:$e,setMicroUpperDate:I,shiftMacroRange:ie,shiftMicroRange:le,resetVernier:Se,macroStartSelectorProps:ke,macroEndSelectorProps:Be,microStartSelectorProps:Z,microEndSelectorProps:te,sliderProps:ge}}function As(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroValue:a,macroUnit:l=t,microUnit:c=t,onChangeMacroRange:d,onChangeMicroPoint:g,yearStartMonth:D,formatOption:k,...b}=e,h=vr("useVernierSliderPoint",D);$n("useVernierSliderPoint",r,n),xn("useVernierSliderPoint","initialMacroRange",o),wr("useVernierSliderPoint","initialMicroValue",a),Sn("useVernierSliderPoint","initialMacroRange",l,o,r,n,"[minDate, maxDate]",h);const S=ht(l,c,o,r,n,h);Rn("useVernierSliderPoint","initialMicroValue",c,a,S[0],S[1],"the initial macro window",h);const R=kn(b),C=i.useRef(o),u=i.useRef(a),[q,L]=i.useState(o),[K,J]=i.useState(a);let j=q;const ae=[Ke(q[0],r,n),Ke(q[1],r,n)];(ae[0]!==q[0]||ae[1]!==q[1])&&(j=ae,L(ae));const N=i.useMemo(()=>ht(l,c,j,r,n,h),[l,c,j,r,n,h]),ne=i.useMemo(()=>Ln(N,c,R.microIsDiscrete,R.microAllowedDates??R.allowedDates,r,n,h),[N,c,R.microIsDiscrete,R.microAllowedDates,R.allowedDates,r,n,h]),z=i.useMemo(()=>R.macroIsDiscrete===!0?Rt(R.macroAllowedDates??R.allowedDates,l,r,n,h):[],[R.macroIsDiscrete,R.macroAllowedDates,R.allowedDates,l,r,n,h]),T=i.useRef(z);T.current=z;let p=K;const E=br(K,c,N,ne,h);E!==K&&(p=E,J(E));const O=i.useRef(j);O.current=j;const oe=i.useRef(p);oe.current=p;const F=i.useRef({minDate:r,maxDate:n,macroIsDiscrete:R.macroIsDiscrete,macroAllowedDates:R.macroAllowedDates,microIsDiscrete:R.microIsDiscrete,microAllowedDates:R.microAllowedDates,allowedDates:R.allowedDates});F.current={minDate:r,maxDate:n,macroIsDiscrete:R.macroIsDiscrete,macroAllowedDates:R.macroAllowedDates,microIsDiscrete:R.microIsDiscrete,microAllowedDates:R.microAllowedDates,allowedDates:R.allowedDates};const U=i.useRef(d);U.current=d;const Re=i.useRef(g);Re.current=g;const ee=i.useCallback(Z=>{const{minDate:te,maxDate:ge}=F.current;return ht(l,c,Z,te,ge,h)},[l,c,h]),ce=i.useCallback(Z=>{const{microIsDiscrete:te,microAllowedDates:ge,allowedDates:v,minDate:P,maxDate:X}=F.current;return Ln(Z,c,te,ge??v,P,X,h)},[c,h]),W=i.useCallback((Z,te)=>{const ge=O.current,v=oe.current;(Z[0].getTime()!==ge[0].getTime()||Z[1].getTime()!==ge[1].getTime())&&(O.current=Z,L(Z),U.current?.(Z[0],Z[1])),te.getTime()!==v.getTime()&&(oe.current=te,J(te),Re.current?.(te))},[]),G=i.useCallback((Z,te)=>{const{minDate:ge,maxDate:v}=F.current,P=[Ke(Z,ge,v),Ke(te,ge,v)],X=ee(P);W(P,br(oe.current,c,X,ce(X),h))},[c,ee,ce,W,h]),ue=i.useCallback(Z=>{const te=ee(O.current);W(O.current,br(Z,c,te,ce(te),h))},[c,ee,ce,W,h]),pe=i.useCallback(Z=>{const te=O.current[1],ge=Z>te?Z:te;G(Z,ge)},[G]),Me=i.useCallback(Z=>{const te=O.current[0],ge=Z<te?Z:te;G(ge,Z)},[G]),$e=i.useCallback(Z=>{const{minDate:te,maxDate:ge}=F.current,v=O.current,P=T.current;if(P.length>0){const he=be(P,v[0],l,h)+Z,xe=be(P,v[1],l,h)+Z;if(he<0||xe>P.length-1)return;G(P[he],P[xe]);return}const X=je(l,v[0],Z),De=je(l,v[1],Z);X<te||De>ge||G(X,De)},[l,G,h]),I=i.useCallback(Z=>{const te=O.current,ge=ee(te),v=ce(ge);if(v.length>0){ue(yn(v,c,oe.current,Z,h));return}ue(je(c,oe.current,Z))},[c,ee,ce,ue,h]),ie=i.useCallback(()=>{const Z=C.current,te=ee(Z);W(Z,br(u.current,c,te,ce(te),h))},[c,ee,ce,W,h]),[le,Se]=N,Ce=i.useMemo(()=>({value:j[0],onChange:pe,minDate:r,maxDate:j[1],unit:l,yearStartMonth:h,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:k}),[j,pe,r,l,h,e.formatLocale,e.locale,e.labels,k]),Le=i.useMemo(()=>({value:j[1],onChange:Me,minDate:j[0],maxDate:n,unit:l,yearStartMonth:h,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:k}),[j,Me,n,l,h,e.formatLocale,e.locale,e.labels,k]),ke=i.useMemo(()=>({value:p,onChange:ue,minDate:le,maxDate:Se,unit:c,yearStartMonth:h,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:k}),[p,ue,le,Se,c,h,e.formatLocale,e.locale,e.labels,k]),Be=i.useMemo(()=>({...R,mode:"vernier",unit:t,yearStartMonth:h,macroUnit:l,microUnit:c,minDate:r,maxDate:n,macroRange:j,microValue:p,onChangeMacroRange:G,onChangeMicroPoint:ue}),[R,t,l,c,r,n,j,p,G,ue,h]);return{macroRange:j,setMacroRange:L,microValue:p,setMicroValue:J,setMacroLowerDate:pe,setMacroUpperDate:Me,setMicroDate:ue,shiftMacroRange:$e,shiftMicroValue:I,resetVernier:ie,macroStartSelectorProps:Ce,macroEndSelectorProps:Le,microSelectorProps:ke,sliderProps:Be}}function qa(e,t){const r=new Date(e,t,1);return r.setFullYear(e),r}function Gt(e,t){return e.getFullYear()-(e.getMonth()<t?1:0)}function hn(e,t){return e===void 0?null:Gt(e,t)}function bn(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 Za(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function $s(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`YearSelector: \`formatLocale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function Qa(e,t,r,n){const o=e===void 0?null:e,a=t===void 0?null:Gt(t,n);return o!==null&&a!==null?r(o,a):o!==null?o:a}const ks=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:a,maxYear:l,minDate:c,maxDate:d,className:g="",style:D,disabled:k=!1,locale:b,labels:h,formatLocale:S,formatOption:R,yearStartMonth:C}=e,u=vr("YearSelector",C);bn(t,"value"),bn(r,"initialDate"),bn(c,"minDate"),bn(d,"maxDate"),Za(a,"minYear"),Za(l,"maxYear"),$s(S);const q=t??r;if(q===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 L=In(b,h),[K,J]=i.useState(()=>Gt(q,u)),j=c?.getTime(),ae=d?.getTime(),N=i.useMemo(()=>Qa(a,c,Math.max,u),[a,j,u]),ne=i.useMemo(()=>Qa(l,d,Math.min,u),[l,ae,u]);if(N===null||ne===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(N>ne)throw new RangeError(`YearSelector: the resolved lower bound ${N} is after the resolved upper bound ${ne}.`);const z=t!==void 0,T=t!==void 0?Gt(t,u):K,p=T<N||T>ne,E=q.getTime();i.useEffect(()=>{z||J(Gt(q,u))},[z,E,u]);const O=W=>W>=N&&W<=ne,oe=W=>{if(!k){if(!O(W))throw new RangeError(`YearSelector: refusing to emit ${W}, which lies outside the declared bounds ${N}-${ne}.`);z||J(W),n?.(qa(W,u),W)}},F=O(T-1)?T-1:null,U=O(T+1)?T+1:null,Re=()=>{F!==null&&oe(F)},ee=()=>{U!==null&&oe(U)},ce=i.useMemo(()=>{const W=[];for(let G=ne;G>=N;G--)W.push(G);return p&&(W.push(T),W.sort((G,ue)=>ue-G)),W.map(G=>({value:G,label:He("year",qa(G,u),R,S)}))},[N,ne,p,T,u,S,R]);return x.jsxs("div",{className:`inline-flex items-center ${zr} ${g}`,style:D,"data-out-of-range":p?"true":void 0,children:[x.jsx(Kt,{neighbour:"control",direction:"left",disabled:k,canStep:F!==null,onStep:Re,ariaLabel:L.previousYear}),x.jsx("select",{"aria-label":L.yearSelect,disabled:k,className:"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:T,onChange:W=>{if(!W.target.value)return;const G=Number(W.target.value);Number.isInteger(G)&&oe(G)},children:ce.map(W=>x.jsx("option",{value:W.value,disabled:p&&W.value===T,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:W.label},W.value))}),x.jsx(Kt,{neighbour:"control",direction:"right",disabled:k,canStep:U!==null,onStep:ee,ariaLabel:L.nextYear}),o]})},Ei=i.memo(ks,(e,t)=>{const r=e.yearStartMonth??0,n=t.yearStartMonth??0;if(r!==n)return!1;const o=e.value??e.initialDate,a=t.value??t.initialDate,l=o?Gt(o,r):null,c=a?Gt(a,n):null;return!(l!==c||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||hn(e.minDate,r)!==hn(t.minDate,n)||hn(e.maxDate,r)!==hn(t.maxDate,n)||e.onChange!==t.onChange||e.children!==t.children||e.locale!==t.locale||!Cn(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption)});Ei.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=ai;exports.DateSelector=Ti;exports.MonthSelector=Pi;exports.PERIOD_SLIDER_LABEL_CATALOGS=ni;exports.PERIOD_SLIDER_LABEL_KEYS=En;exports.PeriodSlider=Mi;exports.YearSelector=Ei;exports.addUnit=je;exports.areStylesEqual=pi;exports.calculateConnectDragValues=ci;exports.calculateHandleDragValues=Ro;exports.calculateKeyboardActionValues=ui;exports.calculateLabelSlant=Eo;exports.calculateVernierMacroDrag=vi;exports.calculateVernierMicroDrag=Di;exports.decode=me;exports.encode=re;exports.findNearestDateIndex=be;exports.formatLabel=He;exports.formatOptionText=Si;exports.formatQuarterLabel=Gl;exports.formatScreenReaderLabel=Bt;exports.getMacroWindowEndDate=li;exports.getMacroWindowStartDate=ii;exports.getSortedAllowedDates=Rt;exports.normalizeDateByUnit=Ne;exports.resolveDraggedEdge=Pn;exports.resolveMacroWindow=ht;exports.resolvePeriodSliderLabels=oi;exports.resolveQuarter=si;exports.resolveVernierRailZone=Co;exports.resolveVernierTargetHandle=wi;exports.resolveWheelStep=bi;exports.usePeriodSliderPoint=Cs;exports.usePeriodSliderRange=Es;exports.useVernierSliderPoint=As;exports.useVernierSliderRange=Is;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),St=require("date-fns"),i=require("react"),Yt=require("@aiquants/virtualscroll"),Tl=require("react-dom"),Ha=120,uo="data-drag-snap",mo="--ps-drag-snap-duration",jr={flat:["--ps-drag-low","--ps-drag-high"],macro:["--ps-drag-macro-low","--ps-drag-macro-high"],micro:["--ps-drag-micro-low","--ps-drag-micro-high"]},di=["low","high"],mi=["tx","ty","rot"],In={flat:{low:"--ps-drag-label-low",high:"--ps-drag-label-high"},macro:{low:"--ps-drag-macro-label-low",high:"--ps-drag-macro-label-high"},micro:{low:"--ps-drag-micro-label-low",high:"--ps-drag-micro-label-high"}},Ao=(e,t)=>`${e}-${t}`,fo=(e,t,r)=>`var(${Ao(e,t)}, ${r})`,Pl=(e,t,r)=>{const n=In[t];for(const o of di)for(const a of mi)e.style.setProperty(Ao(n[o],a),r[o][a])},fi=e=>Math.max(0,Math.min(1,e)),vn=(e,t,r,n)=>{const o=fi(t);if(e==="point")return[o,o];const a=e==="low"?n:r;return[Math.min(o,a),Math.max(o,a)]},$o=(e,t,r)=>{const n=r-t,o=Math.max(0,Math.min(1-n,t+e));return[o,o+n]},Cn=(e,t,r,n)=>{const o=fi(t);return e==="low"?o>n?"high":"low":o<r?"low":"high"},go=(e,t,r,n)=>{if(r){const l=(1-e)*100,c=(1-t)*100;return n?`M 12 ${c} L 12 ${l} L 20 100 L 20 0 Z`:`M 12 0 L 12 100 L 20 ${l} L 20 ${c} Z`}const o=e*100,a=t*100;return n?`M ${o} 12 L ${a} 12 L 100 20 L 0 20 Z`:`M 0 12 L 100 12 L ${a} 20 L ${o} 20 Z`},kt=(e,t)=>`var(${e}, ${t}%)`,El=(e,t,r,n)=>{const[o,a]=jr[t];e.style.setProperty(o,`${r*100}%`),e.style.setProperty(a,`${n*100}%`)},Il=e=>{for(const[t,r]of Object.values(jr))e.style.removeProperty(t),e.style.removeProperty(r);for(const t of Object.values(In))for(const r of di)for(const n of mi)e.style.removeProperty(Ao(t[r],n))},gi=["rangeStart","rangeEnd","selectedDate","macroRangeStart","macroRangeEnd","microRangeStart","microRangeEnd","microSelectedDate","decrease","increase","previousYear","nextYear","yearSelect","previousMonth","nextMonth","monthSelect","previousDay","nextDay","dateSelect","splitYear","splitMonth","splitDay"],An=[...Yt.VIRTUAL_SCROLL_LABEL_KEYS,...gi],Lo=Object.freeze({en:Object.freeze({rangeStart:"Range start",rangeEnd:"Range end",selectedDate:"Selected date",macroRangeStart:"Macro range start",macroRangeEnd:"Macro range end",microRangeStart:"Micro range start",microRangeEnd:"Micro range end",microSelectedDate:"Micro selected date",decrease:"Decrease",increase:"Increase",previousYear:"Previous year",nextYear:"Next year",yearSelect:"Year",previousMonth:"Previous month",nextMonth:"Next month",monthSelect:"Month",previousDay:"Previous day",nextDay:"Next day",dateSelect:"Date",splitYear:"Year",splitMonth:"Month",splitDay:"Day"}),ja:Object.freeze({rangeStart:"期間の開始",rangeEnd:"期間の終了",selectedDate:"選択日",macroRangeStart:"広域期間の開始",macroRangeEnd:"広域期間の終了",microRangeStart:"詳細期間の開始",microRangeEnd:"詳細期間の終了",microSelectedDate:"詳細の選択日",decrease:"前へ",increase:"次へ",previousYear:"前年",nextYear:"翌年",yearSelect:"年",previousMonth:"前月",nextMonth:"翌月",monthSelect:"年月",previousDay:"前日",nextDay:"翌日",dateSelect:"日付",splitYear:"年",splitMonth:"月",splitDay:"日"})}),hi=Object.freeze({en:Object.freeze({...Yt.VIRTUAL_SCROLL_LABEL_CATALOGS.en,...Lo.en}),ja:Object.freeze({...Yt.VIRTUAL_SCROLL_LABEL_CATALOGS.ja,...Lo.ja})}),ja=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Cl=e=>An.includes(e),Al=(e,t)=>{const r={};let n=!1;for(const o of Yt.VIRTUAL_SCROLL_LABEL_KEYS){const a=t.has(o)?e[o]:void 0;a!==void 0&&(r[o]=a,n=!0)}return n?r:void 0},$l=e=>{try{return Yt.resolveVirtualScrollLocale(e)}catch(t){throw t instanceof RangeError?new RangeError(`[period-slider] locale is the UI language, not a BCP 47 tag (date formatting reads formatLocale): ${t.message}`,{cause:t}):t}},bi=(e,t)=>{const r=$l(e);if(t===void 0)return hi[r];if(t===null||typeof t!="object")throw new RangeError(`[period-slider] labels must be an object; got ${ja(t)}`);const n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new RangeError(`[period-slider] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);const o=new Set(Object.keys(t));for(const c of o)if(!Cl(c))throw new RangeError(`[period-slider] labels.${c} is not a known label key; expected one of ${An.join(", ")}`);const l={...Yt.resolveVirtualScrollLabels(r,Al(t,o)),...Lo[r]};for(const c of gi){const f=o.has(c)?t[c]:void 0;if(f!==void 0){if(typeof f!="string"||f.trim()==="")throw new RangeError(`[period-slider] labels.${c} must be a non-blank string; got ${ja(f)}`);l[c]=f}}return Object.freeze(l)},kl=e=>{const t={};for(const r of Yt.VIRTUAL_SCROLL_LABEL_KEYS)t[r]=e[r];return Object.freeze(t)},Ol=(e,t)=>e===t||An.every(r=>e[r]===t[r]),$n=(e,t)=>{if(e===t)return!0;if(e===void 0||t===void 0||e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const r=new Set(Object.keys(e)),n=Object.keys(t);if(r.size!==n.length)return!1;const o=e,a=t;return n.every(l=>r.has(l)&&Object.is(o[l],a[l]))},ho=(e,t)=>e!==null&&t!==null&&"nodeType"in t&&e.contains(t),Fa=new Set(["hidden","clip","scroll","auto","overlay"]),za=["paint","strict","content"],Vl=["layout","paint","strict","content"],Nl=["transform","perspective","filter"],$r=e=>e!==void 0&&e!==""&&e!=="none",Yl=e=>e!==void 0&&e!==""&&e!=="normal",dn=e=>{const t=Number.parseFloat(e??"");return Number.isFinite(t)?t:0},_l=e=>e.position==="fixed"?"fixed":e.position==="absolute"?"absolute":null,Hl=(e,t)=>t==="absolute"&&$r(e.position)&&e.position!=="static"||$r(e.transform)||$r(e.perspective)||$r(e.filter)||$r(e.backdropFilter)||Yl(e.containerType)||Vl.some(r=>e.contain.includes(r))?!0:Nl.some(r=>e.willChange.includes(r)),jl=(e,t,r,n,o,a)=>{const l=t.ownerDocument.defaultView;if(l===null)return!1;const c=e.getBoundingClientRect();if(c.width===0||c.height===0)return!1;const f=n?0:r,d=n?r:0;if(o<c.left-f||o>=c.right+f||a<c.top-d||a>=c.bottom+d)return!1;const p=l.getComputedStyle(t);if(p.visibility!=="visible")return!1;let L=null;for(let b=t;b!==null;b=b.parentElement){const g=b===t?p:l.getComputedStyle(b);if(L!==null&&!Hl(g,L))continue;const V=Fa.has(g.overflowX)||za.some(A=>g.contain.includes(A)),w=Fa.has(g.overflowY)||za.some(A=>g.contain.includes(A));if(V||w){const A=b.getBoundingClientRect();if(V&&(o<A.left+dn(g.borderLeftWidth)||o>=A.right-dn(g.borderRightWidth))||w&&(a<A.top+dn(g.borderTopWidth)||a>=A.bottom-dn(g.borderBottomWidth)))return!1}L=_l(g)}return!0},bo=new Map,Fl=(e,t)=>{if(!(t.shiftKey&&t.cancelable))return;for(const o of e)if(o.ownsHit(t.target)){o.step(t);return}let r=null,n=Number.POSITIVE_INFINITY;for(const o of e){const a=o.distanceToRailPx(t.clientX,t.clientY);a===null||a>=n||(r=o,n=a)}r?.step(t)},zl=(e,t)=>{let r=bo.get(e);if(r===void 0){const a=new Set,l=c=>Fl(a,c);r={participants:a,listener:l},bo.set(e,r),e.addEventListener("wheel",l,{passive:!1,capture:!0})}const{participants:n,listener:o}=r;return n.add(t),()=>{n.delete(t),!(n.size>0)&&(bo.delete(e),e.removeEventListener("wheel",o,{capture:!0}))}},zr="gap-[11px]",ft=6,gt=ft*2,Ot=ft*4/3,Ul={left:`0,${gt/2} ${ft},0 ${ft},${gt}`,right:`${Ot},${gt/2} ${Ot-ft},0 ${Ot-ft},${gt}`,up:`${gt/2},0 0,${ft} ${gt},${ft}`,down:`${gt/2},${Ot} 0,${Ot-ft} ${gt},${Ot-ft}`},wo=e=>{e.preventDefault(),e.stopPropagation()},Bl={onMouseDownCapture:wo,onMouseUpCapture:wo,onClickCapture:wo},Wl="period-slider-step",Gl=`${Wl} relative inline-flex size-[22px] shrink-0 items-center justify-center rounded-md after:absolute after:content-['']`,Kl="transition-colors motion-reduce:transition-none not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 dark:focus-visible:ring-blue-400 forced-colors:not-aria-disabled:hover:text-[Highlight] forced-colors:aria-disabled:text-[GrayText]",Xl={control:"text-slate-500 not-aria-disabled:hover:bg-slate-500/15 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-500/25 aria-disabled:text-slate-500/40 dark:text-slate-400 dark:not-aria-disabled:hover:text-slate-50 dark:aria-disabled:text-slate-400/40",rail:"border border-slate-300 bg-white text-slate-700 shadow-2xs not-aria-disabled:hover:border-slate-400 not-aria-disabled:hover:bg-slate-100 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-200 aria-disabled:border-slate-300/40 aria-disabled:bg-white/40 aria-disabled:text-slate-700/40 aria-disabled:shadow-none dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:not-aria-disabled:hover:border-slate-500 dark:not-aria-disabled:hover:bg-slate-700 dark:not-aria-disabled:hover:text-white dark:not-aria-disabled:active:bg-slate-600 dark:aria-disabled:border-slate-700/40 dark:aria-disabled:bg-slate-800/40 dark:aria-disabled:text-slate-200/40"},mn="after:inset-[calc((100%-var(--ps-target-size))/2)]",Ua={horizontal:"px-[19px]",vertical:"py-[19px]"},ql={control:{left:mn,right:mn,up:mn,down:mn},rail:{left:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:left-[calc(100%-var(--ps-target-size)+4px)] after:-right-[4px]",right:"after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-left-[4px] after:right-[calc(100%-var(--ps-target-size)+4px)]",up:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-[calc(100%-var(--ps-target-size)+4px)] after:-bottom-[4px]",down:"after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-[4px] after:bottom-[calc(100%-var(--ps-target-size)+4px)]"}},qt=({direction:e,neighbour:t,disabled:r,canStep:n,onStep:o,ariaLabel:a,className:l,ref:c})=>{const f=e==="up"||e==="down",d=f?gt:Ot,p=f?Ot:gt,L=r||!n;return R.jsx("button",{ref:c,type:"button","aria-label":a,disabled:r,"aria-disabled":L?!0:void 0,...L?Bl:null,onClick:L?void 0:o,className:`${l===void 0?"":`${l} `}${Gl} ${Kl} ${Xl[t]} ${ql[t][e]}`,children:R.jsx("svg",{"aria-hidden":"true",focusable:"false","data-arrow":e,width:d,height:p,viewBox:`0 0 ${d} ${p}`,fill:"currentColor",className:"pointer-events-none block shrink-0",children:R.jsx("polygon",{points:Ul[e]})})})},kn=(e,t)=>{const r=i.useMemo(()=>bi(e,t),[e,t]),n=i.useRef(r);return Ol(n.current,r)||(n.current=r),n.current},lt=(e,t,r)=>{if(!Number.isInteger(r))throw new RangeError(`${e}: ${t} must be a finite integer (received: ${String(r)})`)},xr=(e,t)=>{if(t.kind==="range"){if(t.min!==null&&lt(e,"values.min",t.min),t.max!==null&&lt(e,"values.max",t.max),t.min!==null&&t.max!==null&&t.max<t.min)throw new RangeError(`${e}: values.max must not precede values.min (min: ${t.min}, max: ${t.max})`);return}lt(e,"values.loIndex",t.loIndex),lt(e,"values.hiIndex",t.hiIndex)},Ur=e=>e.kind==="candidates"&&e.hiIndex<e.loIndex,ko=(e,t)=>{let r=e.loIndex,n=e.hiIndex+1;for(;r<n;){const o=r+n>>1;e.ascending[o]<t?r=o+1:n=o}return r},Ba=(e,t)=>(xr("drawnValuesEdge",e),e.kind==="range"?t===-1?e.min:e.max:Ur(e)?null:e.ascending[t===-1?e.loIndex:e.hiIndex]),To=(e,t)=>{if(xr("drawnValuesHas",e),lt("drawnValuesHas","value",t),e.kind==="range")return(e.min===null||t>=e.min)&&(e.max===null||t<=e.max);if(Ur(e))return!1;const r=ko(e,t);return r<=e.hiIndex&&e.ascending[r]===t},Rn=(e,t)=>{if(xr("drawnValuesNearest",e),lt("drawnValuesNearest","value",t),e.kind==="range")return e.min!==null&&t<e.min?e.min:e.max!==null&&t>e.max?e.max:t;if(Ur(e))return null;const r=ko(e,t);if(r>e.hiIndex)return e.ascending[e.hiIndex];if(e.ascending[r]===t||r===e.loIndex)return e.ascending[r];const n=e.ascending[r-1],o=e.ascending[r];return t-n<=o-t?n:o},br=(e,t,r)=>{if(xr("drawnValuesNeighbour",e),lt("drawnValuesNeighbour","value",t),e.kind==="range"){if(r===-1){const l=e.max===null?t-1:Math.min(t-1,e.max);return e.min!==null&&l<e.min?null:l}const a=e.min===null?t+1:Math.max(t+1,e.min);return e.max!==null&&a>e.max?null:a}if(Ur(e))return null;const n=ko(e,t);if(r===-1){const a=n-1;return a<e.loIndex?null:e.ascending[a]}const o=n<=e.hiIndex&&e.ascending[n]===t?n+1:n;return o>e.hiIndex?null:e.ascending[o]},xn=(e,t,r)=>{if(xr("clampPairIntoDrawnValues",e),lt("clampPairIntoDrawnValues","low",t),lt("clampPairIntoDrawnValues","high",r),r<t)throw new RangeError(`clampPairIntoDrawnValues: high must not precede low (low: ${t}, high: ${r})`);const n=Rn(e,t),o=Rn(e,r);return n===null||o===null?null:[n,Math.max(n,o)]},Zl=(e,t,r)=>{if(xr("carryPairIntoDrawnValues",e),lt("carryPairIntoDrawnValues","low",t),lt("carryPairIntoDrawnValues","high",r),r<t)throw new RangeError(`carryPairIntoDrawnValues: high must not precede low (low: ${t}, high: ${r})`);if(Ur(e))return null;const n=Ba(e,-1),o=Ba(e,1),a=r-t;return o!==null&&t>o?xn(e,o-a,o):n!==null&&r<n?xn(e,n,n+a):xn(e,t,r)},wi={"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"}},Ke=e=>e instanceof Date&&!Number.isNaN(e.getTime()),Se=e=>e instanceof Date?Number.isNaN(e.getTime())?"Invalid Date":e.toISOString():String(e),st=(e,t)=>{if(typeof t!="number"||!Number.isInteger(t)||t<0||t>11)throw new RangeError(`${e}: yearStartMonth must be an integer between 0 and 11 (received: ${Se(t)})`)},pr=(e,t)=>t===void 0?0:(st(e,t),t),Qe=(e,t,r=0)=>{if(!Ke(t))throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${Se(t)})`);st("normalizeDateByUnit",r);const n=new Date(t.getTime());if(e==="year"){const o=t.getFullYear()-(t.getMonth()<r?1:0);n.setFullYear(o,r,1),n.setHours(0,0,0,0)}else e==="month"&&n.setDate(1),n.setHours(0,0,0,0);return n},W=(e,t,r=0)=>{st("encode",r);const n=Qe(e,t,r),o=n.getFullYear(),a=n.getMonth()+1,l=n.getDate();if(e==="year")return o;if(e==="month")return o*12+(a-1);const c=new Date(0);return c.setUTCFullYear(o,a-1,l),c.setUTCHours(0,0,0,0),Math.floor(c.getTime()/(1440*60*1e3))},re=(e,t,r=0)=>{st("decode",r);const n=new Date(0);if(n.setHours(0,0,0,0),e==="year")return n.setFullYear(t,r,1),n;if(e==="month"){const a=Math.floor(t/12),l=t-a*12;return n.setFullYear(a,l,1),n}const o=new Date(t*24*60*60*1e3);return n.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),n},Fe=(e,t,r)=>{if(!Ke(t))throw new RangeError(`addUnit: d must be a valid Date (received: ${Se(t)})`);return e==="year"?St.addYears(t,r):e==="month"?St.addMonths(t,r):St.addDays(t,r)},xi=(e,t,r,n=0)=>{if(!Ke(r))throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${Se(r)})`);return st("getMacroWindowStartDate",n),Qe(t,Qe(e,r,n),n)},pi=(e,t,r,n=0)=>{if(!Ke(r))throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${Se(r)})`);if(st("getMacroWindowEndDate",n),e===t)return Qe(t,r,n);const o=r.getFullYear(),a=r.getMonth();if(e==="year"){const l=Qe("year",r,n),c=St.addMonths(l,11);if(t==="month")return c;if(t==="day")return Qe("day",St.addDays(St.addMonths(l,12),-1))}return e==="month"&&t==="day"?new Date(o,a+1,0):Qe(t,r,n)},Wa=(e,t,r)=>e<t?t:e>r?r:e,bt=(e,t,r,n,o,a=0)=>{if(st("resolveMacroWindow",a),Fr("macroRange",r,"resolveMacroWindow"),!Ke(n))throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${Se(n)})`);if(!Ke(o))throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${Se(o)})`);if(o.getTime()<n.getTime())throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${Se(n)}, maxDate: ${Se(o)})`);return[Qe(t,Wa(xi(e,t,r[0],a),n,o),a),Qe(t,Wa(pi(e,t,r[1],a),n,o),a)]},Di=(e,t)=>{if(!Ke(e))throw new RangeError(`resolveQuarter: d must be a valid Date (received: ${Se(e)})`);st("resolveQuarter",t);const r=Qe("year",e,t).getFullYear(),n=((e.getMonth()-t)%12+12)%12,o=Math.floor(n/3)+1,a=new Date(e.getTime());return a.setFullYear(r,t+3*(o-1),1),a.setHours(0,0,0,0),{year:r,quarter:o,startDate:a}},Ql={year:{year:"numeric"},month:{year:"numeric",month:"2-digit"},day:{year:"numeric",month:"2-digit",day:"2-digit"}},Ga=new Map,Jl=(e,t)=>{const r=`${e}\0${t}`,n=Ga.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Ql[e]);return Ga.set(r,o),o},es=4,ts=6,On=e=>e>=0?String(e).padStart(es,"0"):`-${String(-e).padStart(ts,"0")}`,rs=(e,t)=>{const r=On(t.getFullYear());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}`},je=(e,t,r,n)=>Ke(t)?r?r(t,e,"period"):n===void 0?rs(e,t):Jl(e,n).format(t):"",Gt=(e,t,r,n)=>je(e,t,r,n),ns=(e,t)=>{if(!Ke(e))return"";st("formatQuarterLabel",t);const{quarter:r}=Di(e,t);return`${je("year",Qe("year",e,t))}-Q${r}`},Re=(e,t,r,n=0)=>{if(st("findNearestDateIndex",n),!e||e.length===0||e.length===1)return 0;const o=W(r,t,n);let a=0,l=e.length-1;if(o<=W(r,e[a],n))return 0;if(o>=W(r,e[l],n))return l;for(;a<=l;){const d=a+l>>1,p=W(r,e[d],n);if(p===o)return d;p<o?a=d+1:l=d-1}const c=Math.abs(W(r,e[a],n)-o),f=Math.abs(W(r,e[l],n)-o);return c<f?a:l},yt=(e,t,r,n,o=0)=>{if(st("getSortedAllowedDates",o),!Array.isArray(e)||e.length===0)return[];const a=W(t,r,o),l=W(t,n,o),c=new Map;for(const f of e){const d=Qe(t,f,o),p=W(t,d,o);p<a||p>l||c.has(p)||c.set(p,d)}if(c.size===0)throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${Se(r)}, maxDate: ${Se(n)}, entries: ${e.length})`);return Array.from(c.keys()).sort((f,d)=>f-d).map(f=>c.get(f))},fn=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const l=Re(e,n,t,o);if(r==="time"){const c=e[0].getTime(),f=e[a].getTime()-c;return f<=0?0:Math.max(0,Math.min(1,(e[l].getTime()-c)/f))}return l/a},gn=(e,t,r,n,o)=>{const a=e.length-1;if(a<=0)return 0;const l=Math.max(0,Math.min(1,n));if(r==="time"){const c=e[0].getTime(),f=e[a].getTime()-c;return f<=0?0:Re(e,new Date(c+l*f),t,o)}return Math.max(0,Math.min(a,Math.round(l*a)))},Po=(e,t,r,n,o,a,l)=>{let c=r,f=n;return l?(c=t,f=t):e==="low"?t>n?(c=n,f=t):c=t:t<r?(f=r,c=t):f=t,[Math.max(o,Math.min(a,c)),Math.max(o,Math.min(a,f))]},Mi=({posDiffPct:e,startLowVal:t,startHighVal:r,rangeMin:n,rangeMax:o,isDiscrete:a,sortedAllowedDates:l,snapMode:c,unit:f,yearStartMonth:d=0})=>{if(a){const w=l.length-1;if(w<=0)return[0,0];const A=Math.max(0,Math.min(w,Math.round(t))),u=Math.max(A,Math.min(w,Math.round(r)));if(c==="time"){const Q=l[0].getTime(),j=l[w].getTime(),ae=l[A].getTime(),U=l[u].getTime()-ae;let ne=ae+e*(j-Q),F=ne+U;ne<Q&&(ne=Q,F=Q+U),F>j&&(F=j,ne=j-U);const C=Re(l,new Date(ne),f,d),D=Re(l,new Date(F),f,d);return[C,Math.max(C,D)]}const Y=Math.round(e*w);let S=A+Y,X=u+Y;return S<0&&(X+=-S,S=0),X>w&&(S-=X-w,X=w),[Math.max(0,Math.min(w,S)),Math.max(0,Math.min(w,X))]}const p=w=>Math.max(n,Math.min(o,w)),L=o-n;if(L<=0)return[p(t),p(r)];const b=Math.round(e*L);let g=t+b,V=r+b;return g<n&&(V+=n-g,g=n),V>o&&(g-=V-o,V=o),[p(g),p(V)]},vi=(e,t,r,n,o,a,l,c)=>{let f=0,d=!1,p=!1;switch(e){case"ArrowRight":case"ArrowUp":f=c;break;case"ArrowLeft":case"ArrowDown":f=-c;break;case"PageUp":f=c*5;break;case"PageDown":f=-c*5;break;case"Home":d=!0;break;case"End":p=!0;break;default:return null}if(l){let g=r;return d?g=o:p?g=a:g=Math.max(o,Math.min(a,r+f)),[g,g]}let L=r,b=n;return t==="low"?d?L=o:p?L=n:L=Math.max(o,Math.min(n,r+f)):d?b=r:p?b=a:b=Math.max(r,Math.min(a,n+f)),[L,b]},Ri=8,Si=2,yi=16,os=12,as=90,Li=(e,t,r)=>{const n=r*Math.PI/180,o=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));return{alongPx:(e*a+t*o)/2,acrossPx:(e*o+t*a)/2}},Oo=(e,t)=>{const r=t?.estimatedHeightPx??yi,o=Ri+(t?.anchorGapY??Si)+r/2,a=e==="top"?-o:o;return{lowAngleDeg:0,highAngleDeg:0,lowOffsetX:0,highOffsetX:0,lowOffsetY:a,highOffsetY:a,isSlanted:!1,proximity:0}},Vo=(e,t,r,n="top",o)=>{const a=o?.estimatedWidthPx,l=o?.estimatedHeightPx??yi,c=o?.paddingPx??os,f=o?.maxAngleDeg??as,d=Ri+(o?.anchorGapY??Si),p=Oo(n,o);if(!(Number.isFinite(r)&&r>0)||a===void 0||!Number.isFinite(a)||a<=0)return p;const L=Math.max(0,t-e)/100*r,b=a+c;if(L>=b)return p;const g=Math.max(0,Math.min(1,(b-L)/b)),w=g*g*g*(g*(g*6-15)+10)*f,A=n==="top"?-w:w,u=Li(a,l,w),Y=d+u.acrossPx,S=n==="top"?-Y:+Y,X=2*u.alongPx,Q=Math.max(0,(X+c-L)/2);return{lowAngleDeg:A,highAngleDeg:A,lowOffsetX:-Q,highOffsetX:Q,lowOffsetY:S,highOffsetY:S,isSlanted:g>.001,proximity:g}},Ti=e=>({...e,lowOffsetX:0,highOffsetX:0}),pn=(e,t,r,n)=>e==="pan"?Zl(t,r,Math.max(r,n)):xn(t,r,Math.max(r,n)),No=(e,t)=>{const r=t==="macro-top"||t==="macro-left",n=e<0;return r&&n||!(r||n)?"macro":"micro"},Pi=(e,t,r)=>{const n=Math.abs(e)>Math.abs(t)?e:t;return!Number.isFinite(n)||n===0?0:(r?n<0:n>0)?1:-1};function Ei(e,t,r,n,o,a,l="macro-top",c=.05,f=!0,d="range"){if(No(t,l)==="macro"){const b=Math.abs(e-r),g=Math.abs(e-n);return b<=c&&b<=g?"macro-low":g<=c&&g<b?"macro-high":f&&e>=r&&e<=n?"macro-connect":b<g?"macro-low":"macro-high"}if(d==="point")return"micro-point";const p=Math.abs(e-o),L=Math.abs(e-a);return p<=c&&p<=L?"micro-low":L<=c&&L<p?"micro-high":f&&e>=o&&e<=a?"micro-connect":p<L?"micro-low":"micro-high"}function Ii(e,t,r,n,o){if(e==="macro-connect"){const[d,p]=$o(t-r,n,o);return[d,p,"macro-connect"]}const a=e==="macro-low"?"low":"high",[l,c]=vn(a,t,n,o),f=Cn(a,t,n,o);return[l,c,f==="low"?"macro-low":"macro-high"]}function Ci(e,t,r,n,o){if(e==="micro-point"){const[d]=vn("point",t,n,o);return[d,d,"micro-point"]}if(e==="micro-connect"){const[d,p]=$o(t-r,n,o);return[d,p,"micro-connect"]}const a=e==="micro-low"?"low":"high",[l,c]=vn(a,t,n,o),f=Cn(a,t,n,o);return[l,c,f==="low"?"micro-low":"micro-high"]}const Hr=i.memo(({type:e,isTop:t=!0,isVertical:r=!1,isLeft:n=!0})=>{let o,a;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",a=`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",a=`period-slider-knob period-slider-knob-svg ${t?"is-semicircle-top":"is-semicircle-bottom"}`);const l=e==="macro"?"period-slider-knob-path-macro":"period-slider-knob-path-micro";return R.jsx("svg",{className:a,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:R.jsx("path",{d:o,className:l,shapeRendering:"geometricPrecision",strokeWidth:"1.25"})})});Hr.displayName="VernierKnobSvg";const is=(e,t)=>{if(!Ke(e))throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${Se(e)})`);if(!Ke(t))throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${Se(t)})`);if(t.getTime()<=e.getTime())throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${Se(e)}, maxDate: ${Se(t)})`)},Fr=(e,t,r="PeriodSlider")=>{if(!Array.isArray(t)||t.length!==2)throw new RangeError(`${r}: ${e} is required and must be a [start, end] Date tuple (received: ${Se(t)})`);const[n,o]=t;if(!Ke(n))throw new RangeError(`${r}: ${e}[0] must be a valid Date (received: ${Se(n)})`);if(!Ke(o))throw new RangeError(`${r}: ${e}[1] must be a valid Date (received: ${Se(o)})`);if(o.getTime()<n.getTime())throw new RangeError(`${r}: ${e} must not be inverted (start: ${Se(n)}, end: ${Se(o)})`)},Eo=(e,t)=>{if(!Ke(t))throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${Se(t)})`)},vt=(e,t,r,n,o,a)=>{const l=W(r,t,a);if(l<W(r,n,a)||l>W(r,o,a))throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${Se(t)}, minDate: ${Se(n)}, maxDate: ${Se(o)})`)},ls=(e,t,r)=>{const n=e.yearStartMonth??0;if(e.mode==="range"){for(const o of["range","defaultRange"]){const a=e[o];a!==void 0&&(Fr(o,a),vt(`${o}[0]`,a[0],e.unit,t,r,n),vt(`${o}[1]`,a[1],e.unit,t,r,n))}return}if(e.mode==="point")for(const o of["value","defaultValue"]){const a=e[o];a!==void 0&&(Eo(o,a),vt(o,a,e.unit,t,r,n))}},ss=(e,t,r)=>{const n=e.yearStartMonth??0;Fr("macroRange",e.macroRange);const o=e.microUnit??e.unit,a=e.microRange!==void 0||e.defaultMicroRange!==void 0||e.onChangeMicroRange!==void 0,l=e.microValue!==void 0||e.defaultMicroValue!==void 0||e.onChangeMicroPoint!==void 0;if(a&&l)throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");if(l){if(e.microValue!==void 0)return Eo("microValue",e.microValue),vt("microValue",e.microValue,o,t,r,n),{shape:"point",selection:[e.microValue,e.microValue]};if(e.defaultMicroValue!==void 0)return Eo("defaultMicroValue",e.defaultMicroValue),vt("defaultMicroValue",e.defaultMicroValue,o,t,r,n),{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 Fr("microRange",e.microRange),vt("microRange[0]",e.microRange[0],o,t,r,n),vt("microRange[1]",e.microRange[1],o,t,r,n),{shape:"range",selection:e.microRange};if(e.defaultMicroRange!==void 0)return Fr("defaultMicroRange",e.defaultMicroRange),vt("defaultMicroRange[0]",e.defaultMicroRange[0],o,t,r,n),vt("defaultMicroRange[1]",e.defaultMicroRange[1],o,t,r,n),{shape:"range",selection:e.defaultMicroRange};throw a?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")},kr=(e,t,r,n,o,a,l,c,f)=>{const d=Re(e,n,t,f),p=Re(e,o,t,f);return l?d:c?p:Math.max(d,Math.min(p,Re(e,r,t,f)+a))},xo=e=>{e.timerId!==null&&clearTimeout(e.timerId),e.timerId=null,e.emit=null},Ka=()=>{const[e,t]=i.useState(null),r=i.useRef(null),n=i.useCallback((a,l)=>{const c=r.current;if(c!==null&&c[0].getTime()===a.getTime()&&c[1].getTime()===l.getTime())return;const f=[a,l];r.current=f,t(f)},[]),o=i.useCallback(()=>{r.current!==null&&(r.current=null,t(null))},[]);return{shown:e,show:n,release:o}},cs=(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)})`)}},fr=()=>{const[e,t]=i.useState(null),r=i.useRef(null),n=i.useCallback(o=>{if(r.current?.disconnect(),r.current=null,o===null){t(null);return}if(typeof ResizeObserver>"u")return;const a=new ResizeObserver(l=>{for(const c of l){const f=c.borderBoxSize?.[0];f!==void 0&&t(d=>d!==null&&Math.abs(d.widthPx-f.inlineSize)<.5&&Math.abs(d.heightPx-f.blockSize)<.5?d:{widthPx:f.inlineSize,heightPx:f.blockSize})}});a.observe(o),r.current=a},[]);return i.useEffect(()=>()=>{r.current?.disconnect(),r.current=null},[]),[n,e]},po=(e,t)=>{const r=Dn(e,t);return r===null?void 0:{estimatedWidthPx:r.widthPx,estimatedHeightPx:r.heightPx}},Dn=(e,t)=>e===null||t===null?null:{widthPx:Math.max(e.widthPx,t.widthPx),heightPx:Math.max(e.heightPx,t.heightPx)},us=e=>{const t={};let r=0;for(const o of e){const{side:a,box:l}=o;if(l===null)continue;let c;if(o.reach==="inline-size")c=l.widthPx,r=Math.max(r,l.heightPx/2);else{const f=Li(l.widthPx,l.heightPx,o.angleDeg);c=o.centreOffsetPx===null?2*f.acrossPx:Math.abs(o.centreOffsetPx)+f.acrossPx,r=Math.max(r,f.alongPx+Math.abs(o.alongPushPx))}t[`--ps-label-reach-${a}`]=`${Math.ceil(c)}px`}if(Object.keys(t).length===0)return;const n=Math.ceil(r);return t["--ps-label-reach-main"]=`${n}px`,{style:t,mainPx:n}},Xa=(e,t,r)=>({tx:`calc(-50% + ${e}px)`,ty:`${t}px`,rot:`${r}deg`}),qa=(e,t,r)=>({tx:`calc(-50% + ${e}px)`,ty:`calc(-50% + ${t}px)`,rot:`${r}deg`}),Sn=(e,t)=>({"--ps-tooltip-tx":fo(e,"tx",t.tx),"--ps-tooltip-ty":fo(e,"ty",t.ty),"--ps-tooltip-rot":fo(e,"rot",t.rot)}),Do=(e,t,r,n)=>{const o=Oo(n.labelPosition,n.config);if(!n.isSlantable)return{slant:o,lowStyle:void 0,highStyle:void 0,placements:null};const a=Vo(t*100,r*100,n.trackLengthPx,n.labelPosition,n.config),l=n.isMerged?Ti(a):a,c=In[e],f={low:Xa(l.lowOffsetX,l.lowOffsetY-o.lowOffsetY,l.lowAngleDeg),high:Xa(l.highOffsetX,l.highOffsetY-o.highOffsetY,l.highAngleDeg)};return{slant:l,lowStyle:Sn(c.low,f.low),highStyle:Sn(c.high,f.high),placements:f}},Za={"--ps-tooltip-origin":"100% 50%","--ps-tooltip-tx":"0px","--ps-tooltip-ty":"-50%","--ps-tooltip-rot":"0deg"},Qa=(e,t,r)=>{const n=Oo(r.labelPosition,r.config);if(r.isVertical)return{slant:n,lowStyle:Za,highStyle:Za,placements:null};const o=r.autoSlantLabels&&!r.isPointMode;let a=n;if(o){const f=Vo(e,t,r.trackLengthPx,r.labelPosition,r.config);a=r.isMerged?Ti(f):f}const l=In.flat,c={low:qa(a.lowOffsetX,a.lowOffsetY,a.lowAngleDeg),high:qa(a.highOffsetX,a.highOffsetY,a.highAngleDeg)};return{slant:a,lowStyle:{"--ps-tooltip-origin":"50% 50%",...Sn(l.low,c.low)},highStyle:{"--ps-tooltip-origin":"50% 50%",...Sn(l.high,c.high)},placements:o?c:null}},ds={horizontal:{decrease:"left",increase:"right"},vertical:{decrease:"down",increase:"up"}},ms={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={horizontal:"px-[calc(var(--ps-target-size)/2)]",vertical:"py-[calc(var(--ps-target-size)/2)]"},fs={horizontal:{withSteppers:`grid-cols-[auto_minmax(0,1fr)_auto] ${zr} ${Ua.horizontal}`,railOnly:`grid-cols-[minmax(0,1fr)] ${Ja.horizontal}`},vertical:{withSteppers:`grid-rows-[auto_minmax(0,1fr)_auto] ${zr} ${Ua.vertical}`,railOnly:`grid-rows-[minmax(0,1fr)] ${Ja.vertical}`}},ei={horizontal:{leading:"col-start-1 row-start-1",rail:"col-start-2 row-start-1",railOnly:"col-start-1 row-start-1",trailing:"col-start-3 row-start-1"},vertical:{leading:"col-start-1 row-start-1",rail:"col-start-1 row-start-2",railOnly:"col-start-1 row-start-1",trailing:"col-start-1 row-start-3"}},ti=(e,t)=>{e.setPointerCapture(t)},gs=e=>{const{unit:t,minDate:r,maxDate:n,allowedDates:o,snapMode:a="index",disabled:l=!1,className:c="",showStepper:f=!0,tooltipStyle:d="always",labelPosition:p="top",autoSlantLabels:L=!0,isVertical:b=!1,hideConnectBar:g=!1,showTicks:V=!1,colorScheme:w="blue-rose",formatLocale:A}=e,u=pr("PeriodSlider",e.yearStartMonth);is(r,n),ls(e,r,n),A!==void 0&&cs("formatLocale",A);const Y=e.mode==="vernier"?ss(e,r,n):null,S=Y!==null&&Y.shape==="point",X=kn(e.locale,e.labels),Q=wi[w],j=i.useId(),ae=i.useRef(e),U=r.getTime(),ne=n.getTime(),F=i.useMemo(()=>yt(o,t,r,n,u),[o,t,U,ne,u]),C=F.length>0,{rangeMin:D,rangeMax:_}=i.useMemo(()=>C?{rangeMin:0,rangeMax:F.length-1}:{rangeMin:W(t,r,u),rangeMax:W(t,n,u)},[C,F,t,U,ne,u]),T=e.mode==="point",J=i.useCallback(s=>{if(C){const m=Math.max(0,Math.min(F.length-1,Math.round(s)));return F[m]}return re(t,Math.round(s),u)},[C,F,t,u]),Z=i.useCallback(s=>{if(s===void 0)return D;const m=Qe(t,s,u);return C?Re(F,m,t,u):W(t,m,u)},[C,F,t,D,u]),[le,ie]=i.useState(()=>Y===null?null:Y.selection);let ee=le??(Y===null?null:Y.selection);if(S&&ee!==null&&ee[0].getTime()!==ee[1].getTime()){const s=[ee[0],ee[0]];ee=s,ie(s)}const fe=e.mode==="vernier"?e.microValue?.getTime():void 0,ue=i.useMemo(()=>e.mode!=="vernier"||e.microValue===void 0?null:[e.microValue,e.microValue],[e.mode,fe]),ce=Ka(),be=Ka(),z=e.mode!=="vernier"?null:S?ue??ee:e.microRange!==void 0?e.microRange:ee,de=z===null?null:be.shown??z,Ae=e.mode==="range"?e.range?.[0]??e.defaultRange?.[0]:e.mode==="vernier"?de?.[0]:void 0,$e=e.mode==="range"?e.range?.[1]??e.defaultRange?.[1]:e.mode==="vernier"?de?.[1]:void 0,E=e.mode==="point"?e.value??e.defaultValue:void 0,B=e.mode==="point"?E?.getTime():Ae?.getTime(),we=e.mode==="range"?$e?.getTime():B,[ke,Pe]=i.useMemo(()=>{if(e.mode==="point"){const h=Z(E);return[h,h]}const s=Z(Ae),m=Z($e);return[Math.min(s,m),Math.max(s,m)]},[e.mode,B,we,Z,E,Ae,$e]),Ce=e.mode==="point"?e.value!==void 0:e.mode==="range"?e.range!==void 0:S?e.microValue!==void 0:e.microRange!==void 0,[Xe,K]=i.useState(()=>[ke,Pe]),[te,pe]=i.useState(null),[me,M]=i.useState(null),O=i.useRef(null),[se,Me]=i.useState("high"),[ve,Ne]=i.useState(null),[Te,wt]=i.useState(null),v=te?te[0]:Ce?ke:Xe[0],$=te?te[1]:Ce?Pe:Xe[1],Ye=i.useRef([v,$]),ge=e.mode==="vernier",rt=e.mode==="vernier"?e.vernierOrientation??(b?"macro-left":"macro-top"):"macro-top",I=rt==="macro-top"||rt==="macro-left",ji=e.mode==="vernier"?e.showVernierProjection??!0:!1,Fi=e.mode==="vernier"?e.showVernierTicks??!0:!1,Br=e.mode==="vernier"?e.showHairline??!0:!1,q=ge?e.macroUnit??t:t,y=ge?e.microUnit??t:t,Yn=ge?e.macroIsDiscrete??!1:C,Dr=ge?e.microIsDiscrete??!1:C,_o=ge?e.macroAllowedDates??o:o,Ho=ge?e.microAllowedDates??o:o,Wr=ge?e.formatMacroLabel??e.formatLabel:e.formatLabel,Gr=ge?e.formatMicroLabel??e.formatLabel:e.formatLabel,zi=Ae?.getTime(),Ui=$e?.getTime(),[qe,Kr]=i.useState(null),Lt=i.useRef(null),[Mr,Zt]=i.useState(()=>S?"micro-point":"micro-high");let _e=Mr;const _n=S?Mr==="micro-low"||Mr==="micro-high"||Mr==="micro-connect"?"micro-point":null:Mr==="micro-point"?"micro-high":null;_n!==null&&(_e=_n,Zt(_n));const Je=i.useMemo(()=>W(q,r,u),[U,q,u]),ct=i.useMemo(()=>W(q,n,u),[ne,q,u]),ye=i.useMemo(()=>ge&&Yn?yt(_o,q,r,n,u):[],[ge,Yn,_o,q,U,ne,u]),jo=s=>[Math.max(Je,Math.min(ct,W(q,s[0],u))),Math.max(Je,Math.min(ct,W(q,s[1],u)))],[Fo,zo]=e.mode!=="vernier"?[Je,ct]:jo(e.macroRange),[Ue,Be]=ce.shown===null?[Fo,zo]:jo(ce.shown),xt=i.useMemo(()=>re(q,Ue,u),[q,Ue,u]),_t=i.useMemo(()=>re(q,Be,u),[q,Be,u]),Xr=i.useMemo(()=>e.mode!=="vernier"?[r,n]:bt(q,y,[xt,_t],r,n,u),[e.mode,xt,_t,q,y,U,ne,u]),Ee=i.useMemo(()=>W(y,Xr[0],u),[y,Xr,u]),He=i.useMemo(()=>W(y,Xr[1],u),[y,Xr,u]),Uo=i.useMemo(()=>ge&&Dr?yt(Ho,y,r,n,u):[],[ge,Dr,Ho,y,U,ne,u]),Hn=(s,m)=>Uo.filter(h=>{const x=W(y,h,u);return x>=s&&x<=m}),he=i.useMemo(()=>Hn(Ee,He),[Uo,y,Ee,He]),Tt=Yn&&ye.length>0,nt=Dr&&he.length>0,Bo=Tt?W(q,ye[0],u):Je,Wo=Tt?W(q,ye[ye.length-1],u):ct,Go=nt?W(y,he[0],u):Ee,jn=nt?W(y,he[he.length-1],u):He,Pt=(s,m,h,x)=>m.length>0?W(y,m[Re(m,s,y,u)],u):Math.max(h,Math.min(x,W(y,s,u))),Qt=nt?he:[],Oe=i.useMemo(()=>de===null?Ee:Pt(de[0],Qt,Ee,He),[zi,Ee,He,y,de,Qt]),We=i.useMemo(()=>de===null?He:Pt(de[1],Qt,Ee,He),[Ui,Ee,He,y,de,Qt]),Et=i.useMemo(()=>re(y,Oe,u),[y,Oe,u]),It=i.useMemo(()=>re(y,We,u),[y,We,u]),Ko=!ge||z===null?null:{macroUnit:q,macroLowEnc:Fo,macroHighEnc:zo,microUnit:y,microLowEnc:W(y,z[0],u),microHighEnc:W(y,z[1],u)},Fn=i.useRef(Ko),zn=Math.max(1,ct-Je),ot=Tt?fn(ye,q,a,xt,u):Math.max(0,Math.min(1,(Ue-Je)/zn)),ut=Math.max(ot,Tt?fn(ye,q,a,_t,u):Math.min(1,(Be-Je)/zn)),Xo=s=>Math.max(Bo,Math.min(Wo,Math.round(Je+s*zn))),qr=Math.max(1,He-Ee),Jt=nt?fn(he,y,a,Et,u):Math.max(0,Math.min(1,(Oe-Ee)/qr)),vr=Math.max(Jt,nt?fn(he,y,a,It,u):Math.min(1,(We-Ee)/qr)),Un=i.useRef({timerId:null,emit:null}),Zr=i.useRef({timerId:null,emit:null}),Qr=i.useRef({timerId:null,emit:null});i.useEffect(()=>{const s=[Un,Zr,Qr];return()=>{for(const m of s)xo(m.current)}},[]);const er=i.useCallback((s,m,h)=>{xo(s);const{debounceMs:x}=ae.current;if(h||!x||x<=0){m();return}s.emit=m,s.timerId=setTimeout(()=>{s.timerId=null,s.emit=null,m()},x)},[]),qo=i.useCallback(s=>{const m=s.emit;xo(s),m?.()},[]),tr=i.useCallback(s=>new Date(Math.min(Math.max(s.getTime(),U),ne)),[U,ne]),Ct=i.useCallback((s,m,h=!1)=>{const[x,P]=Ye.current;if((ae.current.mode==="point"?s===x:s===x&&m===P)&&Un.current.timerId===null)return;const H=J(s),N=J(m),oe=()=>{const De=ae.current;De.mode==="point"?De.onChangePoint?.(H):De.mode==="range"&&De.onChangeRange?.(H,N)};er(Un.current,oe,h)},[J,er]),Ht=i.useCallback((s,m,h=!1)=>{const x=Fn.current;if(ae.current.mode!=="vernier"||x===null)return;const P=tr(s),k=tr(m);W(x.macroUnit,P,u)===x.macroLowEnc&&W(x.macroUnit,k,u)===x.macroHighEnc&&Zr.current.timerId===null||er(Zr.current,()=>{const H=ae.current;H.mode==="vernier"&&H.onChangeMacroRange?.(P,k)},h)},[tr,er,u]),et=i.useCallback((s,m,h=!1)=>{const x=ae.current,P=Fn.current;if(x.mode!=="vernier"||P===null)return;const k=tr(s),H=tr(m);W(P.microUnit,k,u)===P.microLowEnc&&W(P.microUnit,H,u)===P.microHighEnc&&Qr.current.timerId===null||((S?x.microValue===void 0:x.microRange===void 0)&&ie([k,H]),er(Qr.current,()=>{const N=ae.current;if(N.mode==="vernier"){if(S){N.onChangeMicroPoint?.(k);return}N.onChangeMicroRange?.(k,H)}},h))},[tr,er,S,u]),Zo=i.useCallback((s,m=!1)=>{et(s,s,m)},[et]),jt=i.useCallback(s=>{if(C&&a==="time"&&F.length>1){const x=Math.max(0,Math.min(F.length-1,Math.round(s))),P=F[0].getTime(),H=F[F.length-1].getTime()-P;if(H<=0)return 0;const N=F[x].getTime();return Math.max(0,Math.min(100,(N-P)/H*100))}const m=_-D;if(m<=0)return 0;const h=(s-D)/m*100;return Math.max(0,Math.min(100,h))},[C,a,F,D,_]),Bn=i.useCallback(s=>{const m=Math.max(0,Math.min(100,s));if(C){if(a==="time"&&F.length>1){const P=F[0].getTime(),H=F[F.length-1].getTime()-P,N=P+m/100*H;return Re(F,new Date(N),t,u)}const x=Math.round(m/100*(F.length-1));return Math.max(0,Math.min(F.length-1,x))}const h=D+m/100*(_-D);return Math.round(h)},[C,a,F,D,_,t,u]),Rr=i.useRef(null),Qo=i.useRef(null),Jo=i.useRef(0),Ze=i.useRef(null),Wn=i.useRef(null),ea=i.useRef(null),ta=i.useRef(null),[Gn,ra]=i.useState(0),[Bi,rr]=fr(),[Wi,na]=fr(),[Gi,oa]=fr(),[Ki,aa]=fr(),[Xi,Kn]=fr(),[qi,ia]=fr(),Zi=T?rr===null?void 0:{estimatedWidthPx:rr.widthPx,estimatedHeightPx:rr.heightPx}:po(rr,na),Xn=!T&&v===$,qn=Ue===Be,Zn=!S&&Oe===We,Qi=I?"top":"bottom",Ji=I?"bottom":"top",la=L&&!b,el=la&&!S,Qn={isPointMode:T,isVertical:b,autoSlantLabels:L,isMerged:Xn,trackLengthPx:Gn,labelPosition:p,config:Zi},Jn={trackLengthPx:Gn,labelPosition:Qi,config:po(oa,aa),isMerged:qn,isSlantable:la},eo={trackLengthPx:Gn,labelPosition:Ji,config:po(Kn,ia),isMerged:Zn,isSlantable:el};i.useEffect(()=>{const s=Ze.current;if(!s)return;const m=()=>{const x=s.getBoundingClientRect(),P=b?x.height:x.width;P>0&&ra(k=>Math.abs(k-P)<.5?k:P)};if(m(),typeof ResizeObserver<"u"){const x=new ResizeObserver(P=>{for(const k of P){const H=b?k.contentRect.height:k.contentRect.width;H>0&&ra(N=>Math.abs(N-H)<.5?N:H)}});return x.observe(s),()=>x.disconnect()}const h=s.ownerDocument.defaultView;if(h)return h.addEventListener("resize",m),()=>h.removeEventListener("resize",m)},[b]);const nr=i.useCallback((s,m,h)=>{const x=b?h.height:h.width;if(!(Number.isFinite(x)&&x>0))return null;const P=b?h.bottom-m:s-h.left;return Number.isFinite(P)?Math.max(0,Math.min(1,P/x)):null},[b]),sa=i.useCallback((s,m)=>{const h=Ze.current;if(!h)return null;const x=nr(s,m,h.getBoundingClientRect());return x===null?null:x*100},[nr]),Sr=i.useRef(null),pt=i.useRef(null),Jr=i.useRef({macroLowRatio:ot,macroHighRatio:ut,isVertical:b,isMacroFirstRail:I}),ca=i.useRef({flat:Qn,macro:Jn,micro:eo});i.useLayoutEffect(()=>{Jr.current={macroLowRatio:ot,macroHighRatio:ut,isVertical:b,isMacroFirstRail:I},ca.current={flat:Qn,macro:Jn,micro:eo},ae.current=e,Ye.current=[v,$],Fn.current=Ko,O.current=me,Lt.current=qe});const ua=(s,m)=>{const h=Jr.current;Wn.current?.setAttribute("d",go(s,m,h.isVertical,h.isMacroFirstRail))},tl=(s,m,h)=>{const x=ca.current;return s==="flat"?Qa(m*100,h*100,x.flat).placements:Do(s,m,h,s==="macro"?x.macro:x.micro).placements},yr=(s,m,h)=>{const x=Ze.current;if(!x)return;Sr.current={rail:s,lowRatio:m,highRatio:h},El(x,s,m,h);const P=tl(s,m,h);P!==null&&Pl(x,s,P),s==="macro"&&ua(m,h)},Ft=i.useCallback(()=>{pt.current!==null&&(clearTimeout(pt.current),pt.current=null);const s=Ze.current;s&&(s.removeAttribute(uo),s.style.removeProperty(mo))},[]),da=()=>{const s=Ze.current;if(Sr.current===null||!s){Sr.current=null;return}Sr.current=null,pt.current!==null&&clearTimeout(pt.current),s.style.setProperty(mo,`${Ha}ms`),s.setAttribute(uo,"true"),Il(s),ua(Jr.current.macroLowRatio,Jr.current.macroHighRatio),pt.current=setTimeout(()=>{pt.current=null,s.removeAttribute(uo),s.style.removeProperty(mo)},Ha)};i.useLayoutEffect(()=>{const s=Sr.current;s!==null&&yr(s.rail,s.lowRatio,s.highRatio)}),i.useEffect(()=>()=>{pt.current!==null&&clearTimeout(pt.current)},[]);const or=i.useRef(null),ar=i.useRef(null),dt=i.useRef(null),to=i.useRef(null),Lr=i.useRef(null),At=i.useCallback(()=>or.current!==null||ar.current!==null,[]),ma=s=>{if(l)return;if(ge){const G=ar.current;if(!G||s.pointerId!==G.pointerId||!Ze.current)return;const at=nr(s.clientX,s.clientY,Ze.current.getBoundingClientRect());if(at===null)return;if(G.handle==="macro-low"||G.handle==="macro-high"||G.handle==="macro-connect"){const[Ve,Ie,Dt]=Ii(G.handle,at,G.startPointerRatio,G.startMacroLowRatio,G.startMacroHighRatio);yr("macro",Ve,Ie),Dt!==Lt.current&&(Lt.current=Dt,Kr(Dt),Zt(Dt));let ze,tt;if(Tt){const it=gn(ye,q,a,Ve,u),mr=Math.max(it,gn(ye,q,a,Ie,u));ze=ye[it],tt=ye[mr]}else ze=re(q,Xo(Ve),u),tt=re(q,Xo(Ie),u);ce.show(ze,tt);const Cr=`${ze.getTime()}_${tt.getTime()}`;Cr!==to.current&&(to.current=Cr,Ht(ze,tt));const[Ut,Ar]=bt(q,y,[ze,tt],r,n,u),cn=W(y,Ut,u),un=W(y,Ar,u),Va=Dr?Hn(cn,un):[],Na={kind:"range",min:cn,max:un};let Bt,Wt;if(G.handle==="macro-connect"){let it,mr;if(q==="year"){const $t=ze.getFullYear()-G.startMacroLowDate.getFullYear();it=Fe("year",G.initialMicroLowDate,$t),mr=Fe("year",G.initialMicroHighDate,$t)}else if(q==="month"){const $t=(ze.getFullYear()-G.startMacroLowDate.getFullYear())*12+(ze.getMonth()-G.startMacroLowDate.getMonth());it=Fe("month",G.initialMicroLowDate,$t),mr=Fe("month",G.initialMicroHighDate,$t)}else{const $t=Math.round((ze.getTime()-G.startMacroLowDate.getTime())/864e5);it=Fe("day",G.initialMicroLowDate,$t),mr=Fe("day",G.initialMicroHighDate,$t)}const co=pn("pan",Na,W(y,it,u),W(y,mr,u));if(co===null)return;Bt=re(y,co[0],u),Wt=re(y,co[1],u)}else{const it=pn("resize",Na,W(y,G.initialMicroLowDate,u),W(y,G.initialMicroHighDate,u));if(it===null)return;Bt=re(y,it[0],u),Wt=re(y,it[1],u)}const Ya=Pt(Bt,Va,cn,un),Ll=Math.max(Ya,Pt(Wt,Va,cn,un));Bt=re(y,Ya,u),Wt=re(y,Ll,u),be.show(Bt,Wt);const _a=`${Bt.getTime()}_${Wt.getTime()}`;_a!==Lr.current&&(Lr.current=_a,et(Bt,Wt))}else if(G.handle==="micro-low"||G.handle==="micro-high"||G.handle==="micro-connect"||G.handle==="micro-point"){const[Ve,Ie,Dt]=Ci(G.handle,at,G.startPointerRatio,G.startMicroLowRatio,G.startMicroHighRatio);yr("micro",Ve,Ie),Dt!==Lt.current&&(Lt.current=Dt,Kr(Dt),Zt(Dt));let ze,tt;if(nt){const Ut=gn(he,y,a,Ve,u),Ar=Math.max(Ut,gn(he,y,a,Ie,u));ze=he[Ut],tt=he[Ar]}else{const Ut=Pt(re(y,Math.round(Ee+Ve*qr),u),Qt,Ee,He),Ar=Math.max(Ut,Pt(re(y,Math.round(Ee+Ie*qr),u),Qt,Ee,He));ze=re(y,Ut,u),tt=re(y,Ar,u)}be.show(ze,tt);const Cr=`${ze.getTime()}_${tt.getTime()}`;Cr!==Lr.current&&(Lr.current=Cr,et(ze,tt))}return}const m=or.current;if(!m||s.pointerId!==m.pointerId||!Ze.current)return;const h=Ze.current.getBoundingClientRect(),x=b?s.clientY:s.clientX,P=b?h.height:h.width;if(!(Number.isFinite(P)&&P>0))return;if(m.handle==="connect"){const G=b?(m.startPointerPos-x)/P:(x-m.startPointerPos)/P,[at,Ve]=$o(G,m.startLowRatio,m.startHighRatio);yr("flat",at,Ve);const Ie=Mi({posDiffPct:G,startLowVal:m.startLowVal,startHighVal:m.startHighVal,rangeMin:D,rangeMax:_,isDiscrete:C,sortedAllowedDates:F,snapMode:a,unit:t,yearStartMonth:u});if(dt.current&&dt.current[0]===Ie[0]&&dt.current[1]===Ie[1])return;dt.current=Ie,pe(Ie),Ct(Ie[0],Ie[1],!1);return}const k=nr(s.clientX,s.clientY,h);if(k===null)return;const[H,N]=vn(T?"point":m.handle,k,m.startLowRatio,m.startHighRatio);yr("flat",H,N);const oe=Bn(k*100),[De,Le]=Po(m.handle,oe,m.startLowVal,m.startHighVal,D,_,T);if((!dt.current||dt.current[0]!==De||dt.current[1]!==Le)&&(dt.current=[De,Le],pe([De,Le]),Ct(De,Le,!1)),!T&&(m.handle==="low"||m.handle==="high")){const G=Cn(m.handle,k,m.startLowRatio,m.startHighRatio);O.current!==G&&(O.current=G,M(G),Me(G))}},fa=()=>{da(),to.current=null,Lr.current=null,ar.current=null,Lt.current=null,Kr(null),ce.release(),be.release(),qo(Zr.current),qo(Qr.current)},ga=()=>{da();const s=dt.current??te;s&&(Ct(s[0],s[1],!0),K(s)),dt.current=null,pe(null),or.current=null,O.current=null,M(null)},ha=s=>{if(ge){const h=ar.current;if(!h||s.pointerId!==h.pointerId)return;fa();return}const m=or.current;!m||s.pointerId!==m.pointerId||ga()},ba=()=>{ar.current!==null&&fa(),or.current!==null&&ga()},ro=i.useRef(ma),wa=i.useRef(ha),xa=i.useRef(ba);i.useLayoutEffect(()=>{ro.current=ma,wa.current=ha,xa.current=ba});const pa=i.useRef(ge);i.useEffect(()=>{pa.current!==ge&&(pa.current=ge,xa.current())},[ge]);const Da=me!==null||qe!==null;i.useEffect(()=>{if(!Da)return;const s=Rr.current?.ownerDocument.defaultView;if(!s)return;const m=x=>ro.current(x),h=x=>wa.current(x);return s.addEventListener("pointermove",m),s.addEventListener("pointerup",h),s.addEventListener("pointercancel",h),s.addEventListener("lostpointercapture",h),()=>{s.removeEventListener("pointermove",m),s.removeEventListener("pointerup",h),s.removeEventListener("pointercancel",h),s.removeEventListener("lostpointercapture",h)}},[Da]);const no=i.useCallback((s,m,h,x)=>{Ft(),ti(s,m),or.current={pointerId:m,handle:h,startPointerPos:x,startLowVal:v,startHighVal:$,startLowRatio:jt(v)/100,startHighRatio:jt($)/100},O.current=h,M(h),h!=="connect"&&Me(h)},[v,$,jt]),Ma=i.useCallback((s,m,h,x)=>{ae.current.mode==="vernier"&&(Ft(),ti(s,m),ar.current={pointerId:m,handle:h,startPointerRatio:x,startMacroLowRatio:ot,startMacroHighRatio:ut,startMicroLowRatio:Jt,startMicroHighRatio:vr,startMacroLowDate:xt,initialMicroLowDate:Et,initialMicroHighDate:It},Lt.current=h,Kr(h),Zt(h))},[ot,ut,Jt,vr,xt,Et,It]),va=s=>m=>{if(l||At())return;m.stopPropagation(),m.preventDefault(),Me(s);const h=b?m.clientY:m.clientX;no(m.currentTarget,m.pointerId,s,h)},Ra=s=>()=>{l||O.current!==null||Me(s)},en=s=>()=>{l||Lt.current!==null||Zt(s)},ir=s=>m=>{if(l||At())return;m.stopPropagation(),m.preventDefault();const h=Ze.current;if(!h)return;const x=nr(m.clientX,m.clientY,h.getBoundingClientRect());x!==null&&Ma(m.currentTarget,m.pointerId,s,x)},rl=s=>{if(l||g||At())return;s.stopPropagation(),s.preventDefault();const m=b?s.clientY:s.clientX;no(s.currentTarget,s.pointerId,"connect",m)},nl=s=>{if(l||At())return;if(ge){const N=Ze.current;if(!N)return;const oe=N.getBoundingClientRect(),De=nr(s.clientX,s.clientY,oe);if(De===null)return;const Le=b?s.clientX-(oe.left+oe.width/2):s.clientY-(oe.top+oe.height/2),G=Ei(De,Le,ot,ut,Jt,vr,rt,void 0,!g,S?"point":"range");Ma(s.currentTarget,s.pointerId,G,De),ro.current(s.nativeEvent);return}const m=sa(s.clientX,s.clientY);if(m===null)return;const h=Bn(m);let x="low";if(!T){const N=Math.abs(h-v),oe=Math.abs(h-$);N<oe?x="low":oe<N?x="high":x=h>$?"high":"low"}Me(x);const[P,k]=Po(x,h,v,$,D,_,T);pe([P,k]),Ct(P,k,!0);const H=b?s.clientY:s.clientX;no(s.currentTarget,s.pointerId,x,H)},ol=s=>{if(l||ge||me!==null)return;const m=sa(s.clientX,s.clientY);if(m===null)return;const h=Bn(m);Ne(h),wt(jt(h))},al=()=>{Ne(null),wt(null)},Sa=s=>m=>{if(l||At())return;Me(s);const h=vi(m.key,s,v,$,D,_,T,1);h&&(m.preventDefault(),Ft(),Ce||K(h),Ct(h[0],h[1],!0))},lr=(s,m,h)=>{if(z===null)return;const[x,P]=bt(q,y,[s,m],r,n,u),k=W(y,x,u),H=W(y,P,u),N=Dr?Hn(k,H):[],oe=pn(h,{kind:"range",min:k,max:H},W(y,z[0],u),W(y,z[1],u));if(oe===null)return;const De=Pt(re(y,oe[0],u),N,k,H),Le=Math.max(De,Pt(re(y,oe[1],u),N,k,H));et(re(y,De,u),re(y,Le,u),!0)},tn=s=>m=>{if(l||!ge||e.mode!=="vernier"||At())return;Zt(s);let h=0,x=!1,P=!1;switch(m.key){case"ArrowRight":case"ArrowUp":h=1;break;case"ArrowLeft":case"ArrowDown":h=-1;break;case"PageUp":h=5;break;case"PageDown":h=-5;break;case"Home":x=!0;break;case"End":P=!0;break;default:return}if(m.preventDefault(),Ft(),s==="macro-low"){const k=re(q,Ue,u),H=re(q,Be,u);if(Tt){const De=kr(ye,q,k,ye[0],H,h,x,P,u);if(De===Re(ye,k,q,u))return;const Le=ye[De];Ht(Le,H,!0),lr(Le,H,"resize");return}let N;if(x?N=Je:P?N=Be:N=Math.max(Je,Math.min(Be,Ue+h)),N===Ue)return;const oe=re(q,N,u);Ht(oe,H,!0),lr(oe,H,"resize")}else if(s==="macro-high"){const k=re(q,Ue,u),H=re(q,Be,u);if(Tt){const De=kr(ye,q,H,k,ye[ye.length-1],h,x,P,u);if(De===Re(ye,H,q,u))return;const Le=ye[De];Ht(k,Le,!0),lr(k,Le,"resize");return}let N;if(x?N=Ue:P?N=ct:N=Math.max(Ue,Math.min(ct,Be+h)),N===Be)return;const oe=re(q,N,u);Ht(k,oe,!0),lr(k,oe,"resize")}else if(s==="micro-low"){const k=re(y,Oe,u),H=re(y,We,u);if(nt){const oe=kr(he,y,k,he[0],H,h,x,P,u);if(oe===Re(he,k,y,u))return;et(he[oe],H,!0);return}let N;if(x?N=Ee:P?N=We:N=Math.max(Ee,Math.min(We,Oe+h)),N===Oe)return;et(re(y,N,u),H,!0)}else if(s==="micro-high"){const k=re(y,Oe,u),H=re(y,We,u);if(nt){const oe=kr(he,y,H,k,he[he.length-1],h,x,P,u);if(oe===Re(he,H,y,u))return;et(k,he[oe],!0);return}let N;if(x?N=Oe:P?N=He:N=Math.max(Oe,Math.min(He,We+h)),N===We)return;et(k,re(y,N,u),!0)}else if(s==="micro-point"){const k=re(y,Oe,u);if(nt){const N=kr(he,y,k,he[0],he[he.length-1],h,x,P,u);if(N===Re(he,k,y,u))return;Zo(he[N],!0);return}let H;if(x?H=Ee:P?H=He:H=Math.max(Ee,Math.min(He,Oe+h)),H===Oe)return;Zo(re(y,H,u),!0)}},il=s=>{if(e.mode!=="vernier")return;if(Ft(),Tt){const H=ye.length-1,N=Re(ye,xt,q,u),oe=Re(ye,_t,q,u),De=oe-N;let Le=N+s,G=oe+s;if(s<0&&Le<0?(Le=0,G=Math.min(H,De)):s>0&&G>H&&(G=H,Le=Math.max(0,H-De)),Le===N&&G===oe)return;const at=ye[Le],Ve=ye[G];Ht(at,Ve,!0),lr(at,Ve,"pan");return}const m=Be-Ue;let h=Ue+s,x=Be+s;if(s<0&&h<Je?(h=Je,x=Math.min(ct,h+m)):s>0&&x>ct&&(x=ct,h=Math.max(Je,x-m)),h===Ue&&x===Be)return;const P=re(q,h,u),k=re(q,x,u);Ht(P,k,!0),lr(P,k,"pan")},oo=i.useCallback(s=>{const m=ae.current;if(!(m.disabled||At()))if(Ft(),m.mode==="point"){const h=Math.max(D,Math.min(_,v+s));Ce||K([h,h]),Ct(h,h,!0)}else if(m.mode==="vernier"){if(nt){const De=he.length-1,Le=Re(he,Et,y,u),G=Re(he,It,y,u),at=G-Le;let Ve=Le+s,Ie=G+s;s<0&&Ve<0?(Ve=0,Ie=Math.min(De,at)):s>0&&Ie>De&&(Ie=De,Ve=Math.max(0,De-at)),(Ve!==Le||Ie!==G)&&et(he[Ve],he[Ie],!0);return}const h=Oe,x=We,P=Ee,k=He,H=x-h;let N=h+s,oe=x+s;s<0&&N<P?(N=P,oe=Math.min(k,N+H)):s>0&&oe>k&&(oe=k,N=Math.max(P,oe-H)),(N!==h||oe!==x)&&et(re(y,N,u),re(y,oe,u),!0)}else{const h=$-v;let x=v+s,P=$+s;s<0&&x<D?(x=D,P=Math.min(_,x+h)):s>0&&P>_&&(P=_,x=Math.max(D,P-h)),x<=P&&(Ce||K([x,P]),Ct(x,P,!0))}},[v,$,D,_,Ce,Ct,et,Oe,We,Ee,He,y,nt,he,Et,It,Ft,u]),ya=s=>!l&&ho(Rr.current,s),La=(s,m)=>{const h=Qo.current,x=Ze.current,P=Rr.current;if(l||h===null||x===null||P===null||!jl(h,P,Jo.current,b,s,m))return null;const k=x.getBoundingClientRect();return Math.abs(b?s-(k.left+k.width/2):m-(k.top+k.height/2))},Ta=s=>{if(l||At())return;const m=Pi(s.deltaX,s.deltaY,b);if(m===0)return;s.preventDefault();const h=s.target,x=ho(ea.current,h)||ho(ta.current,h);if(!ge||x){oo(m);return}const P=Ze.current;if(!P)return;const k=P.getBoundingClientRect(),H=b?s.clientX-(k.left+k.width/2):s.clientY-(k.top+k.height/2);if(No(H,rt)==="macro"){il(m);return}oo(m)},rn=i.useRef({ownsWheelHit:ya,distanceToRailPx:La,stepFromRangeAreaWheel:Ta});i.useLayoutEffect(()=>{rn.current={ownsWheelHit:ya,distanceToRailPx:La,stepFromRangeAreaWheel:Ta}});const Tr=i.useRef(null);i.useEffect(()=>{const s=Rr.current?.ownerDocument.defaultView??null,m=Tr.current;if(m!==null&&m.view===s)return;if(m?.unregister(),s===null){Tr.current=null;return}const h=zl(s,{ownsHit:x=>rn.current.ownsWheelHit(x),distanceToRailPx:(x,P)=>rn.current.distanceToRailPx(x,P),step:x=>rn.current.stepFromRangeAreaWheel(x)});Tr.current={view:s,unregister:h}}),i.useEffect(()=>()=>{Tr.current?.unregister(),Tr.current=null},[]);const nn=jt(v),on=jt($),ao=J(v),io=J($),lo=Qa(nn,on,Qn),Pr=lo.slant,Er=me==="low"||me!=="high"&&se==="low",Ir=!T&&(me==="high"||me!=="low"&&se==="high"),ll=qn&&_e!=="macro-low",sl=qn&&_e==="macro-low",cl=Zn&&_e!=="micro-low",ul=Zn&&_e==="micro-low",sr=Do("macro",ot,ut,Jn),cr=Do("micro",Jt,vr,eo),dl=Math.min(nn,on),ml=Math.max(nn,on),[Pa,Ea]=jr.flat,[fl,gl]=jr.macro,[hl,bl]=jr.micro,Ia=kt(Pa,nn),Ca=kt(Ea,on),so=kt(Pa,dl),Aa=`calc(${kt(Ea,ml)} - ${so})`,ur=kt(fl,ot*100),an=kt(gl,ut*100),dr=kt(hl,Jt*100),ln=kt(bl,vr*100),wl=b?{bottom:so,height:Aa,top:"auto",left:"0",right:"0"}:{left:so,width:Aa,top:"0",bottom:"0"},xl=Math.max(.01,ut-ot),$a=Math.max(.06,Math.min(.25,.28*Math.sqrt(xl))),pl=b?{bottom:Ia,left:"50%",transform:"translate(-50%, 50%)",zIndex:Er?40:30}:{left:Ia,top:"50%",transform:"translate(-50%, -50%)",zIndex:Er?40:30},Dl=b?{bottom:Ca,left:"50%",transform:"translate(-50%, 50%)",zIndex:Ir?40:30}:{left:Ca,top:"50%",transform:"translate(-50%, -50%)",zIndex:Ir?40:30},Ml=b?{bottom:`${Te}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${Te}%`,top:"50%",transform:"translate(-50%, -50%)"},ka=ve!==null?J(ve):null,vl=d!=="hover"&&ve!==null&&(ve===v||!T&&ve===$),Rl=ge?Oe>Go:v>D,Sl=ge?We<jn:$<_,sn=us(ge?[{side:I?"before":"after",box:Dn(oa,aa),...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:sr.slant.lowAngleDeg,centreOffsetPx:null,alongPushPx:sr.slant.lowOffsetX}},{side:I?"after":"before",box:S?Kn:Dn(Kn,ia),...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:cr.slant.lowAngleDeg,centreOffsetPx:null,alongPushPx:cr.slant.lowOffsetX}}]:[{side:b||p==="top"?"before":"after",box:T?rr:Dn(rr,na),...b?{reach:"inline-size"}:{reach:"rotated",angleDeg:Pr.lowAngleDeg,centreOffsetPx:Pr.lowOffsetY,alongPushPx:Pr.lowOffsetX}}]),yl=sn===void 0?e.style:{...e.style,...sn.style};i.useLayoutEffect(()=>{Jo.current=sn===void 0?0:sn.mainPx});const mt=S?"micro-point":"micro-low",zt=l?"cursor-not-allowed opacity-50":"cursor-pointer",Oa=s=>{const m=b?"vertical":"horizontal",h=s==="decrease",x=b?!h:h;return R.jsx(qt,{ref:h?ea:ta,neighbour:"rail",direction:ds[m][s],disabled:l,canStep:h?Rl:Sl,onStep:()=>oo(h?-1:1),ariaLabel:h?X.decrease:X.increase,className:`period-slider-stepper-btn ${ms[m][s]} ${ei[m][x?"leading":"trailing"]}`})};return R.jsxs("div",{ref:Rr,style:yl,className:`period-slider grid select-none place-items-center ${fs[b?"vertical":"horizontal"][f?"withSteppers":"railOnly"]} ${c}`,"data-disabled":l?"true":void 0,"data-unit":t,"data-mode":e.mode,"data-orientation":b?"vertical":"horizontal","data-label-position":p,"data-color-scheme":w,children:[R.jsx("div",{ref:Qo,"data-range-area":"true","aria-hidden":"true",className:"period-slider-range-area"}),f&&Oa(b?"increase":"decrease"),R.jsx("div",{ref:Ze,"data-testid":"period-slider-track","data-orientation":b?"vertical":"horizontal","data-vernier-orientation":ge?rt:void 0,className:`period-slider-track relative touch-none rounded-full ${ei[b?"vertical":"horizontal"][f?"rail":"railOnly"]} ${zt}`,onPointerDown:nl,onPointerMove:ol,onPointerLeave:al,children:ge?R.jsxs(R.Fragment,{children:[ji&&(b?R.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:[R.jsx("defs",{children:R.jsxs("linearGradient",{id:j,x1:"0",y1:"0",x2:"1",y2:"0",children:[R.jsx("stop",{offset:"0%",stopColor:I?Q.macro:Q.micro,stopOpacity:"0.28"}),R.jsx("stop",{offset:"100%",stopColor:I?Q.micro:Q.macro,stopOpacity:$a})]})}),R.jsx("path",{ref:Wn,"data-testid":"period-slider-vernier-projection",d:go(ot,ut,b,I),fill:`url(#${j})`})]}):R.jsxs("svg",{className:"period-slider-vernier-projection",role:"presentation","aria-hidden":"true",width:"100%",height:"32",viewBox:"0 0 100 32",preserveAspectRatio:"none",children:[R.jsx("defs",{children:R.jsxs("linearGradient",{id:j,x1:"0",y1:"0",x2:"0",y2:"1",children:[R.jsx("stop",{offset:"0%",stopColor:I?Q.macro:Q.micro,stopOpacity:"0.28"}),R.jsx("stop",{offset:"100%",stopColor:I?Q.micro:Q.macro,stopOpacity:$a})]})}),R.jsx("path",{ref:Wn,"data-testid":"period-slider-vernier-projection",d:go(ot,ut,b,I),fill:`url(#${j})`})]})),!g&&R.jsxs(R.Fragment,{children:[R.jsx("div",{"data-testid":"period-slider-connect-macro",className:"period-slider-connect-macro",style:b?{bottom:`calc(${ur} - 8px)`,height:`calc(${an} - ${ur} + 16px)`}:{left:`calc(${ur} - 8px)`,width:`calc(${an} - ${ur} + 16px)`},onPointerDown:ir("macro-connect")}),!S&&R.jsx("div",{"data-testid":"period-slider-connect-micro",className:"period-slider-connect-micro",style:b?{bottom:`calc(${dr} - 8px)`,height:`calc(${ln} - ${dr} + 16px)`}:{left:`calc(${dr} - 8px)`,width:`calc(${ln} - ${dr} + 16px)`},onPointerDown:ir("micro-connect")})]}),Fi&&R.jsxs("div",{className:"period-slider-vernier-ticks pointer-events-none absolute inset-0",children:[[.2,.4,.6,.8].map(s=>R.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"macro",className:"period-slider-tick period-slider-tick-macro",style:b?{bottom:`${s*100}%`}:{left:`${s*100}%`}},`macro-tick-${s}`)),[.1,.2,.3,.4,.5,.6,.7,.8,.9].map(s=>R.jsx("div",{"data-testid":"period-slider-tick","data-tick-scale":"micro",className:"period-slider-tick period-slider-tick-micro",style:b?{bottom:`${s*100}%`}:{left:`${s*100}%`}},`micro-tick-${s}`))]}),R.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":X.macroRangeStart,"aria-disabled":l?"true":void 0,"aria-valuemin":Bo,"aria-valuemax":Be,"aria-valuenow":Ue,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(xt,q,"period"):Gt(q,xt,Wr,A),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?I?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":I?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${zt}`,style:b?{bottom:ur,left:I?0:"auto",right:I?"auto":0,transform:I?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:qe==="macro-low"||_e==="macro-low"?30:15}:{left:ur,top:I?0:"auto",bottom:I?"auto":0,transform:I?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:qe==="macro-low"||_e==="macro-low"?30:15},onPointerDown:ir("macro-low"),onKeyDown:tn("macro-low"),onFocus:en("macro-low"),"data-active":qe==="macro-low"?"true":void 0,"data-front":_e==="macro-low"?"true":void 0,"data-vernier-pos":b?I?"left":"right":I?"top":"bottom","data-handle-type":"macro-low",children:[R.jsx(Hr,{type:"macro",isTop:I,isVertical:b,isLeft:I}),Br&&R.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&R.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":ll?"true":void 0,"data-slanted":sr.slant.isSlanted?"true":void 0,ref:Gi,style:sr.lowStyle,children:je(q,xt,Wr,A)})]}),R.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":X.macroRangeEnd,"aria-disabled":l?"true":void 0,"aria-valuemin":Ue,"aria-valuemax":Wo,"aria-valuenow":Be,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(_t,q,"period"):Gt(q,_t,Wr,A),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?I?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":I?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${zt}`,style:b?{bottom:an,left:I?0:"auto",right:I?"auto":0,transform:I?"translate(-100%, 50%)":"translate(100%, 50%)",zIndex:qe==="macro-high"||_e==="macro-high"?30:15}:{left:an,top:I?0:"auto",bottom:I?"auto":0,transform:I?"translate(-50%, -100%)":"translate(-50%, 100%)",zIndex:qe==="macro-high"||_e==="macro-high"?30:15},onPointerDown:ir("macro-high"),onKeyDown:tn("macro-high"),onFocus:en("macro-high"),"data-active":qe==="macro-high"?"true":void 0,"data-front":_e==="macro-high"?"true":void 0,"data-vernier-pos":b?I?"left":"right":I?"top":"bottom","data-handle-type":"macro-high",children:[R.jsx(Hr,{type:"macro",isTop:I,isVertical:b,isLeft:I}),Br&&R.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&R.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":sl?"true":void 0,"data-slanted":sr.slant.isSlanted?"true":void 0,ref:Ki,style:sr.highStyle,children:je(q,_t,Wr,A)})]}),R.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":S?X.microSelectedDate:X.microRangeStart,"aria-disabled":l?"true":void 0,"aria-valuemin":Go,"aria-valuemax":S?jn:We,"aria-valuenow":Oe,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(Et,y,"period"):Gt(y,Et,Gr,A),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?I?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":I?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${zt}`,style:b?{bottom:dr,left:I?"auto":0,right:I?0:"auto",transform:I?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:qe===mt||_e===mt?30:20}:{left:dr,top:I?"auto":0,bottom:I?0:"auto",transform:I?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:qe===mt||_e===mt?30:20},onPointerDown:ir(mt),onKeyDown:tn(mt),onFocus:en(mt),"data-active":qe===mt?"true":void 0,"data-front":_e===mt?"true":void 0,"data-vernier-pos":b?I?"right":"left":I?"bottom":"top","data-handle-type":mt,children:[R.jsx(Hr,{type:"micro",isTop:!I,isVertical:b,isLeft:!I}),Br&&R.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&R.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":cl?"true":void 0,"data-slanted":cr.slant.isSlanted?"true":void 0,ref:Xi,style:cr.lowStyle,children:je(y,Et,Gr,A)})]}),!S&&R.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":X.microRangeEnd,"aria-disabled":l?"true":void 0,"aria-valuemin":Oe,"aria-valuemax":jn,"aria-valuenow":We,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(It,y,"period"):Gt(y,It,Gr,A),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle period-slider-handle-vernier ${b?"is-vertical":""} group absolute touch-none ${b?I?"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0":"after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4":I?"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4":"after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${zt}`,style:b?{bottom:ln,left:I?"auto":0,right:I?0:"auto",transform:I?"translate(100%, 50%)":"translate(-100%, 50%)",zIndex:qe==="micro-high"||_e==="micro-high"?30:20}:{left:ln,top:I?"auto":0,bottom:I?0:"auto",transform:I?"translate(-50%, 100%)":"translate(-50%, -100%)",zIndex:qe==="micro-high"||_e==="micro-high"?30:20},onPointerDown:ir("micro-high"),onKeyDown:tn("micro-high"),onFocus:en("micro-high"),"data-active":qe==="micro-high"?"true":void 0,"data-front":_e==="micro-high"?"true":void 0,"data-vernier-pos":b?I?"right":"left":I?"bottom":"top","data-handle-type":"micro-high",children:[R.jsx(Hr,{type:"micro",isTop:!I,isVertical:b,isLeft:!I}),Br&&R.jsx("div",{"data-testid":"period-slider-hairline",className:"period-slider-hairline"}),d!=="hover"&&R.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-duplicate":ul?"true":void 0,"data-slanted":cr.slant.isSlanted?"true":void 0,ref:qi,style:cr.highStyle,children:je(y,It,Gr,A)})]})]}):R.jsxs(R.Fragment,{children:[!g&&R.jsx("div",{"data-testid":"period-slider-connect",className:"period-slider-connect absolute rounded-full",style:wl,onPointerDown:rl}),V&&C&&F.length>1&&R.jsx("div",{className:"period-slider-ticks pointer-events-none absolute inset-0",children:F.map((s,m)=>{const h=W(t,s,u),x=jt(m),P=b?{bottom:`${x}%`,left:"50%",transform:"translate(-50%, 50%)"}:{left:`${x}%`,top:"50%",transform:"translate(-50%, -50%)"};return R.jsx("div",{"data-testid":"period-slider-tick",className:"period-slider-tick absolute h-1.5 w-1.5 rounded-full",style:P},`tick-${h}`)})}),!l&&ve!==null&&Te!==null&&me===null&&ka&&R.jsxs("div",{"data-testid":"period-slider-hover-guide",className:"period-slider-hover-guide pointer-events-none absolute h-2 w-2",style:Ml,children:[R.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"}),R.jsx("div",{"data-testid":"period-slider-hover-tooltip","data-duplicate":vl?"true":void 0,className:`period-slider-hover-tooltip ${p==="bottom"&&!b?"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:je(t,ka,e.formatLabel,A)})]}),R.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":T?X.selectedDate:X.rangeStart,"aria-disabled":l?"true":void 0,"aria-valuemin":D,"aria-valuemax":T?_:$,"aria-valuenow":v,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(ao,t,"period"):Gt(t,ao,e.formatLabel,A),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${zt}`,style:pl,onPointerDown:va("low"),onKeyDown:Sa("low"),onFocus:Ra("low"),"data-active":me==="low"?"true":void 0,"data-front":Er?"true":void 0,children:[R.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)] dark:group-focus-visible:ring-blue-400 ${me==="low"?"":"shadow-md"}`}),d!=="hover"&&R.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-label-position":p,"data-slanted":Pr.isSlanted?"true":void 0,"data-front":Er?"true":void 0,"data-duplicate":Xn&&!Er?"true":void 0,ref:Bi,style:lo.lowStyle,children:je(t,ao,e.formatLabel,A)})]}),!T&&R.jsxs("div",{tabIndex:l?-1:0,role:"slider","aria-label":X.rangeEnd,"aria-disabled":l?"true":void 0,"aria-valuemin":v,"aria-valuemax":_,"aria-valuenow":$,"aria-valuetext":e.formatAriaValueText?e.formatAriaValueText(io,t,"period"):Gt(t,io,e.formatLabel,A),"aria-orientation":b?"vertical":"horizontal",className:`period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${zt}`,style:Dl,onPointerDown:va("high"),onKeyDown:Sa("high"),onFocus:Ra("high"),"data-active":me==="high"?"true":void 0,"data-front":Ir?"true":void 0,children:[R.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)] dark:group-focus-visible:ring-blue-400 ${me==="high"?"":"shadow-md"}`}),d!=="hover"&&R.jsx("div",{className:`period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${d==="balloon"?"period-slider-tooltip-balloon":""}`,"data-tooltip-style":d,"data-label-position":p,"data-slanted":Pr.isSlanted?"true":void 0,"data-front":Ir?"true":void 0,"data-duplicate":Xn&&!Ir?"true":void 0,ref:Wi,style:lo.highStyle,children:je(t,io,e.formatLabel,A)})]})]})}),f&&Oa(b?"decrease":"increase")]})},Mo=(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},Ai=(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},hs=(e,t)=>e===t?!0:e.mode!==t.mode||e.unit!==t.unit||e.yearStartMonth!==t.yearStartMonth||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||!Ai(e.style,t.style)||e.snapMode!==t.snapMode||e.formatLabel!==t.formatLabel||e.formatLocale!==t.formatLocale||e.locale!==t.locale||!$n(e.labels,t.labels)||e.formatAriaValueText!==t.formatAriaValueText||!Mo(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||!Mo(e.macroAllowedDates,t.macroAllowedDates)||!Mo(e.microAllowedDates,t.microAllowedDates)):!1,$i=i.memo(gs,hs);$i.displayName="PeriodSlider";const ki=864e5,ri=2,xe=-1,Rt=e=>{const t=e.getFullYear(),r=new Date(Date.UTC(t,e.getMonth(),e.getDate()));return r.setUTCFullYear(t),Math.floor(r.getTime()/ki)},Yo=e=>{const t=new Date(e*ki),r=new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return r.setFullYear(t.getUTCFullYear()),r.setHours(0,0,0,0),r},Or=e=>`${On(e.getFullYear())}-${String(e.getMonth()+1).padStart(ri,"0")}-${String(e.getDate()).padStart(ri,"0")}`,bs=(e,t,r,n)=>{const o=Rt(e),a=Rt(t),l=a>=o?a-o+1:0,c=d=>Yo(a-d),f={kind:"range",min:o,max:a};return{count:l,dateAt:c,labelAt:d=>je("day",c(d),n,r),indexOf:d=>{const p=Rt(d);return p<o||p>a?xe:a-p},nearestIndexOf:d=>{if(l===0)return xe;const p=Rn(f,Rt(d));return p===null?xe:a-p},neighbourIndexOf:(d,p)=>{if(l===0)return xe;const L=br(f,Rt(d),p);return L===null?xe:a-L}}},ws=(e,t,r,n,o,a)=>{const l=n>=r?n-r+1:0,c=L=>e[n-L],f={kind:"candidates",ascending:t,loIndex:r,hiIndex:n},d=L=>{const b=L.getTime();let g=r,V=n;for(;g<=V;){const w=g+V>>1,A=e[w].getTime();if(A===b)return n-w;A<b?g=w+1:V=w-1}return xe},p=L=>L===null?xe:d(Yo(L));return{count:l,dateAt:c,labelAt:L=>je("day",c(L),a,o),indexOf:d,nearestIndexOf:L=>p(Rn(f,Rt(L))),neighbourIndexOf:(L,b)=>p(br(f,Rt(L),b))}},xs={count:0,dateAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(e)})`)},labelAt:e=>{throw new RangeError(`DateSelector: the option domain is empty (requested index ${String(e)})`)},indexOf:()=>xe,nearestIndexOf:()=>xe,neighbourIndexOf:()=>xe},ps=(e,t,r)=>{const n=c=>{let f=0,d=e.length;for(;f<d;){const p=f+d>>1;e[p].getTime()<c?f=p+1:d=p}return f},o=c=>{let f=0,d=e.length;for(;f<d;){const p=f+d>>1;e[p].getTime()<=c?f=p+1:d=p}return f},a=t===null?0:n(t.getTime()),l=(r===null?e.length:o(r.getTime()))-1;return{loIndex:a,hiIndex:l}},Ds=(e,t)=>{const r=new Map;return e.forEach((n,o)=>{t(o,n);const a=new Date(n);a.setHours(0,0,0,0);const l=a.getTime();r.has(l)||r.set(l,a)}),Array.from(r.keys()).sort((n,o)=>n-o).map(n=>r.get(n))},Ms={year:{year:"numeric"},month:{month:"2-digit"},day:{day:"2-digit"}},vs={month:2,day:2},ni={year:e=>e.getFullYear(),month:e=>e.getMonth()+1,day:e=>e.getDate()},oi=new Map,Rs=(e,t)=>{const r=`${e}\0${t}`,n=oi.get(r);if(n!==void 0)return n;const o=new Intl.DateTimeFormat(t,Ms[e]);return oi.set(r,o),o},Ss=(e,t,r)=>r!==void 0?Rs(e,r).format(t):e==="year"?On(ni.year(t)):String(ni[e](t)).padStart(vs[e],"0"),Oi=(e,t,r,n)=>{if(t!=="year"&&t!=="month"&&t!=="day")throw new RangeError(`formatOptionText: unit must be "year", "month" or "day" (received: ${String(t)})`);if(r!=="period"&&r!=="part")throw new RangeError(`formatOptionText: scope must be "period" or "part" (received: ${String(r)})`);return Ke(e)?r==="part"?Ss(t,e,n):je(t,e,void 0,n):""},Mn=44,ai=7,hn=8,ys=2,Vi=10,Ls=1e3,Io=8,vo=6,Ro=4,So=12,Vr=(e,t)=>{const r=new Date(e,t-1,1);return r.setFullYear(e),Rt(r)},Ts=(e,t)=>{if(e.length<Ro||t.count===0)return xe;const r=Number(e.slice(0,Ro));if(!Number.isInteger(r))return xe;const n=e.length>=vo,o=n?Number(e.slice(Ro,vo)):So;if(o<1||o>So)return xe;const a=e.length>=Io,l=a?Number(e.slice(vo,Io)):0,c=Vr(r,o),f=(o===So?Vr(r+1,1):Vr(r,o+1))-1,d=a?c+l-1:n?c:Vr(r,1),p=a?d:n?f:Vr(r+1,1)-1;if(a&&(l<1||d>f))return xe;for(let L=p;L>=d;L--){const b=t.indexOf(Yo(L));if(b!==xe)return b}return xe},Ps=e=>e.closest(".dark")===null?"light":"dark",Es=(e,t,r,n)=>{const o=r-e.bottom-hn,a=e.top-hn,l=o>=t||o>=a,f=Math.max(Mn,Math.min(t,l?o:a)),d=l?e.bottom:e.top-f,p=e.width+Vi,L=Math.max(hn,Math.min(e.left,n-p-hn));return{top:d,left:L,width:p,height:f}},Ni=({domain:e,selectedIndex:t,openAnchorIndex:r,displayLabel:n,machineValue:o,disabled:a,ariaLabel:l,locale:c,labels:f,onCommitIndex:d,controlClassName:p})=>{const L=i.useId(),b=i.useMemo(()=>kl(f),[f]),g=`period-slider-date-listbox-${L}`,V=E=>`period-slider-date-option-${L}-${E}`,[w,A]=i.useState(!1),[u,Y]=i.useState(xe),[S,X]=i.useState(!0),[Q,j]=i.useState(null),[ae,U]=i.useState(null),ne=i.useRef(null),F=i.useRef(null),C=i.useRef(null),D=i.useRef({buffer:"",at:0}),_=i.useRef(e);_.current=e;const T=e.count,J=Math.min(T,ai)*Mn,Z=Math.max(1,Math.min(T,ai)),le=i.useCallback(()=>{const E=ne.current;if(E===null)return;const B=E.getBoundingClientRect();j(Es(B,J,window.innerHeight,window.innerWidth))},[J]),ie=i.useCallback(()=>{A(!1),Y(xe),D.current={buffer:"",at:0}},[]),ee=i.useCallback(E=>{a||T===0||(Y(E),A(!0))},[a,T]);i.useLayoutEffect(()=>{if(!w){j(null),U(null);return}const E=ne.current;return E!==null&&U(Ps(E)),le(),window.addEventListener("scroll",le,!0),window.addEventListener("resize",le),()=>{window.removeEventListener("scroll",le,!0),window.removeEventListener("resize",le)}},[w,le]),i.useEffect(()=>{if(!w)return;const E=B=>{const we=B.target;we!==null&&F.current?.contains(we)!==!0&&ne.current?.contains(we)!==!0&&ie()};return document.addEventListener("pointerdown",E,!0),()=>document.removeEventListener("pointerdown",E,!0)},[w,ie]);const fe=i.useRef(u);fe.current=u,i.useEffect(()=>{w&&(a||T===0)&&ie()},[w,a,T,ie]),i.useEffect(()=>{if(!w)return;const E=fe.current;if(E===xe)return;const B=Math.min(E,T-1);B!==E&&Y(B),C.current?.scrollToIndex(B,{align:"center"})},[T,w]);const ue=E=>{if(T===0)return;const B=Math.max(0,Math.min(E,T-1));Y(B),C.current?.scrollToIndex(B,{align:"center"})},ce=E=>{E<0||E>=T||(d(E),ie(),ne.current?.focus())},be=E=>{if(a)return;const B=u!==xe?u:t!==xe?t:r;switch(E.key){case"ArrowDown":if(E.preventDefault(),!w){ee(B);return}ue(B+1);return;case"ArrowUp":if(E.preventDefault(),!w){ee(B);return}ue(B-1);return;case"Home":if(!w)return;E.preventDefault(),ue(0);return;case"End":if(!w)return;E.preventDefault(),ue(T-1);return;case"PageDown":if(!w)return;E.preventDefault(),ue(B+Z);return;case"PageUp":if(!w)return;E.preventDefault(),ue(B-Z);return;case"Enter":if(E.preventDefault(),!w){ee(B);return}ce(u!==xe?u:B);return;case"Escape":if(!w)return;E.preventDefault(),ie();return;case"Tab":w&&ie();return}if(E.key.length!==1)return;const we=E.key>="0"&&E.key<="9",ke=E.key==="-"||E.key==="/"||E.key===".";if(!(we||ke))return;E.preventDefault();const Pe=Date.now(),Ce=Pe-D.current.at>Ls?"":D.current.buffer,Xe=we?`${Ce}${E.key}`.slice(0,Io):Ce;D.current={buffer:Xe,at:Pe};const K=Ts(Xe,_.current);if(K!==xe){if(!w){ee(K);return}ue(K)}},z=i.useCallback(E=>E,[]),de=i.useCallback(()=>Mn,[]),Ae=i.useCallback(E=>{const B=fe.current;X(B===xe||B>=E.renderingStartIndex&&B<=E.renderingEndIndex)},[]),$e=w&&Q!==null&&ae!==null&&T>0?R.jsx("div",{ref:F,className:"period-slider-date-popup","data-testid":"period-slider-date-popup","data-color-mode":ae,style:{top:Q.top,left:Q.left,width:Q.width,height:Q.height},onMouseDown:E=>{E.preventDefault()},children:R.jsx(Yt.VirtualScroll,{ref:C,itemCount:T,getItem:z,getItemHeight:de,viewportSize:Q.height-ys,initialScrollIndex:u!==xe?u:void 0,onRangeChange:Ae,className:"h-full w-full",testId:"period-slider-date-listbox-pane",locale:c,labels:b,contentProps:{id:g,role:"listbox","aria-label":l},scrollBarOptions:{width:Vi,enableArrowButtons:!1,enableThumbDrag:!0,enableTrackClick:!0,tapScrollCircleOptions:{enabled:!1}},behaviorOptions:{enableKeyboardNavigation:!1,overscrollBehavior:"contain"},children:E=>{const B=E===t,we=E===u;return R.jsx("div",{id:V(E),role:"option","aria-selected":B,"aria-posinset":E+1,"aria-setsize":T,"data-testid":"period-slider-date-option","data-active":we?"true":void 0,className:"period-slider-date-option",style:{height:Mn},onClick:()=>ce(E),children:_.current.labelAt(E)})}})}):null;return R.jsxs(R.Fragment,{children:[R.jsx("input",{ref:ne,type:"text",role:"combobox",readOnly:!0,"aria-label":l,"aria-expanded":w,"aria-controls":w?g:void 0,"aria-haspopup":"listbox","aria-autocomplete":"none","aria-activedescendant":w&&u!==xe&&S?V(u):void 0,disabled:a,value:n,className:p,"data-testid":"period-slider-date-combobox","data-value":o,onKeyDown:be,onMouseDown:E=>{a||(E.preventDefault(),ne.current?.focus(),w?ie():ee(t!==xe?t:r))},onBlur:()=>{w&&ie()}}),$e===null?null:Tl.createPortal($e,document.body)]})};Ni.displayName="VirtualDateDropdown";const Kt=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},Nr=(e,t)=>{if(!(t instanceof Date)||Number.isNaN(t.getTime()))throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`)},Is=e=>{if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`DateSelector: "formatLocale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`)}},Mt=(e,t,r)=>{const n=new Date(e,t-1,r);return n.setFullYear(e),n.setHours(0,0,0,0),n},yo=e=>Mt(e,1,1),Cs=e=>Mt(e,12,31),As=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:a,maxYear:l,minDate:c,maxDate:f,allowedDates:d,variant:p="date",className:L="",style:b,disabled:g=!1,locale:V,labels:w,formatLocale:A,formatOption:u}=e;if(Is(A),t!==void 0&&Nr("value",t),r!==void 0&&Nr("initialDate",r),c!==void 0&&Nr("minDate",c),f!==void 0&&Nr("maxDate",f),a!==void 0&&!Number.isInteger(a))throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(a)})`);if(l!==void 0&&!Number.isInteger(l))throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(l)})`);if(p==="split-dropdown"&&d!==void 0)throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');const Y=t??r;if(Y===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 S=kn(V,w),[X,Q]=i.useState(()=>Kt(Y)),j=t!==void 0,ae=t?.getTime(),U=i.useMemo(()=>t!==void 0?Kt(t):X,[ae,X]),ne=c?.getTime(),F=f?.getTime(),C=i.useMemo(()=>{const v=c?Kt(c):null,$=a!==void 0?yo(a):null;return v===null?$:$===null||v.getTime()>=$.getTime()?v:$},[ne,a]),D=i.useMemo(()=>{const v=f?Kt(f):null,$=l!==void 0?Cs(l):null;return v===null?$:$===null||v.getTime()<=$.getTime()?v:$},[F,l]),_=C?.getTime()??null,T=D?.getTime()??null;if(C!==null&&D!==null&&C.getTime()>D.getTime())throw new RangeError(`DateSelector: the resolved range is empty (min ${Or(C)} is after max ${Or(D)})`);if(p!=="date"&&d===void 0&&(C===null||D===null))throw new RangeError(`DateSelector: variant="${p}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${p==="dropdown"?' or supply "allowedDates"':""}`);const J=i.useMemo(()=>d===void 0?null:d.map(v=>v.getTime()).join(","),[d]),Z=i.useMemo(()=>{if(d===void 0)return null;const v=Ds(d,($,Ye)=>Nr(`allowedDates[${$}]`,Ye));return{ascending:v,ascendingSerials:v.map(Rt)}},[J]),le=i.useMemo(()=>Z===null?null:{...Z,...ps(Z.ascending,C,D)},[Z,_,T]),ie=i.useMemo(()=>le!==null?ws(le.ascending,le.ascendingSerials,le.loIndex,le.hiIndex,A,u):C===null||D===null?xs:bs(C,D,A,u),[le,_,T,A,u]),ee=v=>{if(le!==null)return ie.indexOf(v)!==xe;const $=v.getTime();return!(_!==null&&$<_||T!==null&&$>T)},fe=Y.getTime();i.useEffect(()=>{j||Q(Kt(Y))},[j,fe]);const ue=v=>{if(g)return;const $=Kt(v);ee($)&&(j||Q($),n?.($))},ce=U.getTime(),be=ee(U),z=i.useMemo(()=>{const v=ie.neighbourIndexOf(U,-1);return v===xe?null:ie.dateAt(v)},[ie,ce]),de=i.useMemo(()=>{const v=ie.neighbourIndexOf(U,1);return v===xe?null:ie.dateAt(v)},[ie,ce]),Ae=()=>{z!==null&&ue(z)},$e=()=>{de!==null&&ue(de)},E=v=>{if(v.target.value){const $=St.parseISO(v.target.value);Number.isNaN($.getTime())||ue($)}},B=U.getFullYear(),we=U.getMonth()+1,ke=U.getDate(),Pe=i.useCallback((v,$)=>u?u($,v,"part"):Oi($,v,"part",A),[u,A]),Ce=i.useMemo(()=>{if(p!=="split-dropdown"||C===null||D===null)return[];const v=[];for(let $=D.getFullYear();$>=C.getFullYear();$--)v.push({value:$,label:Pe("year",yo($))});return v},[p,_,T,Pe]),Xe=i.useMemo(()=>{if(p!=="split-dropdown"||C===null||D===null)return[];const v=C,$=D,Ye=B===v.getFullYear()?v.getMonth()+1:1,ge=B===$.getFullYear()?$.getMonth()+1:12,rt=[];for(let I=Ye;I<=ge;I++)rt.push({value:I,label:Pe("month",Mt(B,I,1))});return rt},[p,_,T,B,Pe]),K=i.useMemo(()=>{if(p!=="split-dropdown"||C===null||D===null)return[];const v=C,$=D,Ye=B===v.getFullYear()&&we===v.getMonth()+1?v.getDate():1,ge=B===$.getFullYear()&&we===$.getMonth()+1?$.getDate():St.getDaysInMonth(new Date(ce)),rt=[];for(let I=Ye;I<=ge;I++)rt.push({value:I,label:Pe("day",Mt(B,we,I))});return rt},[p,_,T,ce,B,we,Pe]),te=(v,$,Ye)=>Ye>St.getDaysInMonth(Mt(v,$,1))?!1:ee(Mt(v,$,Ye)),pe=(v,$,Ye)=>{te(v,$,Ye)&&ue(Mt(v,$,Ye))},me=Ce.some(v=>v.value===B),M=Xe.some(v=>v.value===we),O=K.some(v=>v.value===ke),se=Or(U),Me=p==="dropdown"?je("day",U,u,A):"",ve=C?Or(C):void 0,Ne=D?Or(D):void 0,Te="text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";return R.jsxs("div",{className:`inline-flex items-center ${zr} ${L}`,style:b,"data-variant":p,"data-out-of-range":be?void 0:"true",children:[R.jsx(qt,{neighbour:"control",direction:"left",disabled:g,canStep:z!==null,onStep:Ae,ariaLabel:S.previousDay}),p==="dropdown"?R.jsx(Ni,{domain:ie,selectedIndex:be?ie.indexOf(U):xe,openAnchorIndex:ie.nearestIndexOf(U),displayLabel:Me,machineValue:se,disabled:g,ariaLabel:S.dateSelect,locale:V,labels:S,onCommitIndex:v=>ue(ie.dateAt(v)),controlClassName:"period-slider-date-combobox-field 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"}):p==="split-dropdown"?R.jsxs("div",{className:"inline-flex items-center gap-1",children:[R.jsxs("select",{"aria-label":S.splitYear,disabled:g,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:me?B:"",onChange:v=>pe(Number(v.target.value),we,ke),children:[me?null:R.jsx("option",{value:"",disabled:!0,className:Te,children:Pe("year",yo(B))}),Ce.map(v=>R.jsx("option",{value:v.value,disabled:!te(v.value,we,ke),className:"dark:bg-slate-700 dark:text-slate-100",children:v.label},v.value))]}),R.jsxs("select",{"aria-label":S.splitMonth,disabled:g,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:M?we:"",onChange:v=>pe(B,Number(v.target.value),ke),children:[M?null:R.jsx("option",{value:"",disabled:!0,className:Te,children:Pe("month",Mt(B,we,1))}),Xe.map(v=>R.jsx("option",{value:v.value,disabled:!te(B,v.value,ke),className:"dark:bg-slate-700 dark:text-slate-100",children:v.label},v.value))]}),R.jsxs("select",{"aria-label":S.splitDay,disabled:g,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:O?ke:"",onChange:v=>pe(B,we,Number(v.target.value)),children:[O?null:R.jsx("option",{value:"",disabled:!0,className:Te,children:Pe("day",Mt(B,we,ke))}),K.map(v=>R.jsx("option",{value:v.value,disabled:!te(B,we,v.value),className:"dark:bg-slate-700 dark:text-slate-100",children:v.label},v.value))]})]}):R.jsx("input",{"aria-label":S.dateSelect,disabled:g,className:"period-slider-native-date-field w-28 rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",value:se,min:ve,max:Ne,onChange:E,type:"date"}),R.jsx(qt,{neighbour:"control",direction:"right",disabled:g,canStep:de!==null,onStep:$e,ariaLabel:S.nextDay}),o]})},gr=e=>e===void 0?null:Kt(e).getTime(),Yi=i.memo(As,(e,t)=>!(gr(e.value??e.initialDate)!==gr(t.value??t.initialDate)||gr(e.minDate)!==gr(t.minDate)||gr(e.maxDate)!==gr(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.locale!==t.locale||!$n(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption));Yi.displayName="DateSelector";function ht(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 Xt(e){return`${On(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}`}function Yr(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 ii(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function $s(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`MonthSelector: \`formatLocale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function ks(e,t){const r=e===void 0?null:ht(e,0),n=t===void 0?null:ht(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r>=n?r:n:r!==null?r:n}function Os(e,t){const r=e===void 0?null:ht(e,11),n=t===void 0?null:ht(t.getFullYear(),t.getMonth());return r!==null&&n!==null?r<=n?r:n:r!==null?r:n}function Vt(e){return e.getFullYear()*12+e.getMonth()}function Co(e){return ht(Math.floor(e/12),(e%12+12)%12)}function Vs(e,t,r){const n=new Map;for(const o of e){const a=ht(o.getFullYear(),o.getMonth());t!==null&&a<t||r!==null&&a>r||n.has(a.getTime())||n.set(a.getTime(),a)}return Array.from(n.values()).sort((o,a)=>o.getTime()-a.getTime())}function Ns(e,t){const r=[];for(let n=Vt(e);n<=Vt(t);n++)r.push(Co(n));return r}function li(e,t,r){const n=[];for(let o=e.length-1;o>=0;o--)n.push({label:je("month",e[o],r,t),value:Xt(e[o])});return n}const Ys=e=>{const{value:t,initialDate:r,onChange:n,children:o,variant:a="date",minYear:l,maxYear:c,minDate:f,maxDate:d,allowedMonths:p,isWarning:L=!1,className:b="",style:g,disabled:V=!1,locale:w,labels:A,formatLocale:u,formatOption:Y}=e;$s(u),Yr(t,"value"),Yr(r,"initialDate"),Yr(f,"minDate"),Yr(d,"maxDate"),ii(l,"minYear"),ii(c,"maxYear"),p?.forEach((M,O)=>{Yr(M,`allowedMonths[${O}]`)});const S=t??r;if(S===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 X=kn(w,A),[Q,j]=i.useState(()=>ht(S.getFullYear(),S.getMonth())),ae=t!==void 0,U=i.useMemo(()=>t!==void 0?ht(t.getFullYear(),t.getMonth()):Q,[t?.getTime(),Q]),ne=f?.getTime(),F=d?.getTime(),C=i.useMemo(()=>ks(l,f),[l,ne]),D=i.useMemo(()=>Os(c,d),[c,F]),_=C?.getTime()??null,T=D?.getTime()??null;if(C!==null&&D!==null&&C>D)throw new RangeError(`MonthSelector: the resolved lower bound ${Xt(C)} is after the resolved upper bound ${Xt(D)}.`);if(a==="dropdown"&&p===void 0&&(C===null||D===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 J=p===void 0?null:p.map(M=>M.getTime()).join(","),Z=i.useMemo(()=>p===void 0?null:Vs(p,C,D),[J,_,T]),le=i.useMemo(()=>{if(Z!==null){const M=Z.map(Vt);return{kind:"candidates",ascending:M,loIndex:0,hiIndex:M.length-1}}return{kind:"range",min:C===null?null:Vt(C),max:D===null?null:Vt(D)}},[Z,_,T]),ie=M=>To(le,Vt(M)),ee=S.getTime();i.useEffect(()=>{if(ae)return;const M=ht(S.getFullYear(),S.getMonth());j(O=>O.getTime()===M.getTime()?O:M)},[ae,ee]);const fe=M=>{if(V)return;if(!ie(M))throw new RangeError(`MonthSelector: refusing to emit ${Xt(M)}, which lies outside the selectable months.`);ae||j(M);const O=M.getFullYear()*100+(M.getMonth()+1);n?.(M,O)},ue=U.getTime(),ce=ie(U),be=i.useMemo(()=>{const M=br(le,Vt(U),-1);return M===null?null:Co(M)},[le,ue]),z=i.useMemo(()=>{const M=br(le,Vt(U),1);return M===null?null:Co(M)},[le,ue]),de=()=>{be!==null&&fe(be)},Ae=()=>{z!==null&&fe(z)},$e=M=>{if(!M)return;const O=M.lastIndexOf("-");if(O<=0)return;const se=M.slice(0,O),Me=M.slice(O+1),ve=Number(se),Ne=Number(Me)-1;if(!(Number.isInteger(ve)&&Number.isInteger(Ne)))return;const Te=ht(ve,Ne);ie(Te)&&fe(Te)},E=M=>{$e(M.target.value)},B=M=>{$e(M.target.value)},we=Xt(U),ke=a==="dropdown"&&!ce?je("month",U,Y,u):"",Pe=C?Xt(C):void 0,Ce=D?Xt(D):void 0,Xe=i.useMemo(()=>a!=="dropdown"?[]:Z!==null?li(Z,u,Y):C===null||D===null?[]:li(Ns(C,D),u,Y),[a,Z,_,T,u,Y]),K=ce?we:"",te=L?"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",pe=`period-slider-native-date-field w-28 rounded-md border py-0.5 px-1 text-center font-mono text-xs tabular-nums dark:placeholder:text-gray-400 disabled:opacity-50 ${te}`,me=`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 ${te}`;return R.jsxs("div",{className:`inline-flex items-center ${zr} ${b}`,style:g,"data-out-of-range":ce?void 0:"true",children:[R.jsx(qt,{neighbour:"control",direction:"left",disabled:V,canStep:be!==null,onStep:de,ariaLabel:X.previousMonth}),a==="dropdown"?R.jsxs("select",{"aria-label":X.monthSelect,disabled:V,className:me,value:K,onChange:B,children:[ce?null:R.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:ke}),Xe.map(M=>R.jsx("option",{value:M.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:M.label},M.value))]}):R.jsx("input",{"aria-label":X.monthSelect,disabled:V,className:pe,value:we,min:Pe,max:Ce,onChange:E,type:"month"}),R.jsx(qt,{neighbour:"control",direction:"right",disabled:V,canStep:z!==null,onStep:Ae,ariaLabel:X.nextMonth}),o]})},_i=i.memo(Ys,(e,t)=>{const r=e.value??e.initialDate,n=t.value??t.initialDate,o=r?r.getFullYear()*12+r.getMonth():null,a=n?n.getFullYear()*12+n.getMonth():null;if(o!==a||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 l=e.minDate?e.minDate.getFullYear()*12+e.minDate.getMonth():null,c=t.minDate?t.minDate.getFullYear()*12+t.minDate.getMonth():null;if(l!==c)return!1;const f=e.maxDate?e.maxDate.getFullYear()*12+e.maxDate.getMonth():null,d=t.maxDate?t.maxDate.getFullYear()*12+t.maxDate.getMonth():null;return!(f!==d||e.allowedMonths!==t.allowedMonths||e.onChange!==t.onChange||e.children!==t.children||e.locale!==t.locale||!$n(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption)});_i.displayName="MonthSelector";function wr(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 Vn(e,t,r){if(wr(e,"minDate",t),wr(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 yn(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(wr(e,`${t}[0]`,r[0]),wr(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 Ln(e,t,r,n,o,a,l,c){const f=W(r,n,c);if(f<W(r,o,c)||f>W(r,a,c))throw new RangeError(`${e}: ${t} must lie within ${l} (value: ${n.toISOString()}, lower: ${o.toISOString()}, upper: ${a.toISOString()})`)}function Tn(e,t,r,n,o,a,l,c){Ln(e,`${t}[0]`,r,n[0],o,a,l,c),Ln(e,`${t}[1]`,r,n[1],o,a,l,c)}function Ge(e,t,r){return e<t?t:e>r?r:e}function Pn(e,t,r,n,o,a,l){if(r!==!0)return[];const c=e[0].getTime(),f=e[1].getTime();return yt(n,t,o,a,l).filter(d=>d.getTime()>=c&&d.getTime()<=f)}function hr(e,t,r,n,o){if(n.length===0)return Ge(e,r[0],r[1]);const a=n[Re(n,e,t,o)];return a.getTime()===e.getTime()?e:a}function bn(e,t,r,n,o,a){const l=W(t,e[0],o),c=W(t,e[1],o),f=pn(a,{kind:"range",min:W(t,r[0],o),max:W(t,r[1],o)},l,c);if(f===null)return e;const d=hr(f[0]===l?e[0]:re(t,f[0],o),t,r,n,o),p=hr(f[1]===c?e[1]:re(t,f[1],o),t,r,n,o);return[d,p<d?d:p]}function En(e,t,r,n,o){const a=Re(e,r,t,o)+n;return e[Math.max(0,Math.min(e.length-1,a))]}function Nn(e){const t=i.useRef(e),r=t.current,n=e,o=Object.keys(r),a=Object.keys(n);return o.length===a.length&&a.every(c=>Object.is(r[c],n[c]))||(t.current=e),t.current}function _s(e){const{unit:t,minDate:r,maxDate:n,initialRange:o,onChangeRange:a,yearStartMonth:l,formatOption:c,...f}=e,d=pr("usePeriodSliderRange",l);Vn("usePeriodSliderRange",r,n),yn("usePeriodSliderRange","initialRange",o),Tn("usePeriodSliderRange","initialRange",t,o,r,n,"[minDate, maxDate]",d);const p=Nn(f),L=i.useRef(o),[b,g]=i.useState(o);let V=b;const w=[Ge(b[0],r,n),Ge(b[1],r,n)];(w[0]!==b[0]||w[1]!==b[1])&&(V=w,g(w));const A=i.useRef(V);A.current=V;const u=i.useRef({minDate:r,maxDate:n,allowedDates:p.allowedDates});u.current={minDate:r,maxDate:n,allowedDates:p.allowedDates};const Y=i.useRef(a);Y.current=a;const S=i.useCallback(D=>{const{minDate:_,maxDate:T}=u.current,J=Ge(D[0],_,T),Z=Ge(D[1],_,T),le=A.current;J.getTime()===le[0].getTime()&&Z.getTime()===le[1].getTime()||(A.current=[J,Z],g([J,Z]),Y.current?.(J,Z))},[]),X=i.useCallback(D=>{const _=A.current,T=D.getTime()>_[1].getTime()?D:_[1];S([D,T])},[S]),Q=i.useCallback(D=>{const _=A.current,T=D.getTime()<_[0].getTime()?D:_[0];S([T,D])},[S]),j=i.useCallback((D,_)=>{S([D,_])},[S]),ae=i.useCallback(D=>{const{minDate:_,maxDate:T,allowedDates:J}=u.current,Z=A.current,le=yt(J,t,_,T,d);if(le.length>0){S([En(le,t,Z[0],D,d),En(le,t,Z[1],D,d)]);return}S([Fe(t,Z[0],D),Fe(t,Z[1],D)])},[t,S,d]),U=i.useCallback(()=>{S(L.current)},[S]),ne=i.useMemo(()=>({value:V[0],onChange:X,minDate:r,maxDate:V[1],unit:t,yearStartMonth:d,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:c}),[V[0],V[1],X,r,t,d,e.formatLocale,e.locale,e.labels,c]),F=i.useMemo(()=>({value:V[1],onChange:Q,minDate:V[0],maxDate:n,unit:t,yearStartMonth:d,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:c}),[V[0],V[1],Q,n,t,d,e.formatLocale,e.locale,e.labels,c]),C=i.useMemo(()=>({...p,mode:"range",unit:t,yearStartMonth:d,range:V,minDate:r,maxDate:n,onChangeRange:j}),[p,t,V,r,n,j,d]);return{range:V,lowerDate:V[0],upperDate:V[1],setRange:g,setLowerDate:X,setUpperDate:Q,shiftRange:ae,resetRange:U,startSelectorProps:ne,endSelectorProps:F,sliderProps:C}}function Hs(e){const{unit:t,minDate:r,maxDate:n,initialValue:o,onChangePoint:a,yearStartMonth:l,formatOption:c,...f}=e,d=pr("usePeriodSliderPoint",l);Vn("usePeriodSliderPoint",r,n),wr("usePeriodSliderPoint","initialValue",o),Ln("usePeriodSliderPoint","initialValue",t,o,r,n,"[minDate, maxDate]",d);const p=Nn(f),L=i.useRef(o),[b,g]=i.useState(o);let V=b;const w=Ge(b,r,n);w!==b&&(V=w,g(w));const A=i.useRef(V);A.current=V;const u=i.useRef({minDate:r,maxDate:n,allowedDates:p.allowedDates});u.current={minDate:r,maxDate:n,allowedDates:p.allowedDates};const Y=i.useRef(a);Y.current=a;const S=i.useCallback(U=>{const{minDate:ne,maxDate:F}=u.current,C=Ge(U,ne,F);C.getTime()!==A.current.getTime()&&(A.current=C,g(C),Y.current?.(C))},[]),X=i.useCallback(U=>{const{minDate:ne,maxDate:F,allowedDates:C}=u.current,D=yt(C,t,ne,F,d);if(D.length>0){S(En(D,t,A.current,U,d));return}S(Fe(t,A.current,U))},[t,S,d]),Q=i.useCallback(()=>{S(L.current)},[S]),j=i.useMemo(()=>({value:V,onChange:S,minDate:r,maxDate:n,unit:t,yearStartMonth:d,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:c}),[V,S,r,n,t,d,e.formatLocale,e.locale,e.labels,c]),ae=i.useMemo(()=>({...p,mode:"point",unit:t,yearStartMonth:d,value:V,minDate:r,maxDate:n,onChangePoint:S}),[p,t,V,r,n,S,d]);return{value:V,setValue:g,shiftValue:X,resetValue:Q,selectorProps:j,sliderProps:ae}}function js(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroRange:a,macroUnit:l=t,microUnit:c=t,onChangeMacroRange:f,onChangeMicroRange:d,yearStartMonth:p,formatOption:L,...b}=e,g=pr("useVernierSliderRange",p);Vn("useVernierSliderRange",r,n),yn("useVernierSliderRange","initialMacroRange",o),yn("useVernierSliderRange","initialMicroRange",a),Tn("useVernierSliderRange","initialMacroRange",l,o,r,n,"[minDate, maxDate]",g);const V=bt(l,c,o,r,n,g);Tn("useVernierSliderRange","initialMicroRange",c,a,V[0],V[1],"the initial macro window",g);const w=Nn(b),A=i.useRef(o),u=i.useRef(a),[Y,S]=i.useState(o),[X,Q]=i.useState(a);let j=Y;const ae=[Ge(Y[0],r,n),Ge(Y[1],r,n)];(ae[0]!==Y[0]||ae[1]!==Y[1])&&(j=ae,S(ae));const U=i.useMemo(()=>bt(l,c,j,r,n,g),[l,c,j,r,n,g]),ne=i.useMemo(()=>Pn(U,c,w.microIsDiscrete,w.microAllowedDates??w.allowedDates,r,n,g),[U,c,w.microIsDiscrete,w.microAllowedDates,w.allowedDates,r,n,g]),F=i.useMemo(()=>w.macroIsDiscrete===!0?yt(w.macroAllowedDates??w.allowedDates,l,r,n,g):[],[w.macroIsDiscrete,w.macroAllowedDates,w.allowedDates,l,r,n,g]),C=i.useRef(F);C.current=F;let D=X;const _=bn(X,c,U,ne,g,"resize");(_[0]!==X[0]||_[1]!==X[1])&&(D=_,Q(_));const T=i.useRef(j);T.current=j;const J=i.useRef(D);J.current=D;const Z=i.useRef({minDate:r,maxDate:n,macroIsDiscrete:w.macroIsDiscrete,macroAllowedDates:w.macroAllowedDates,microIsDiscrete:w.microIsDiscrete,microAllowedDates:w.microAllowedDates,allowedDates:w.allowedDates});Z.current={minDate:r,maxDate:n,macroIsDiscrete:w.macroIsDiscrete,macroAllowedDates:w.macroAllowedDates,microIsDiscrete:w.microIsDiscrete,microAllowedDates:w.microAllowedDates,allowedDates:w.allowedDates};const le=i.useRef(f);le.current=f;const ie=i.useRef(d);ie.current=d;const ee=i.useCallback(M=>{const{minDate:O,maxDate:se}=Z.current;return bt(l,c,M,O,se,g)},[l,c,g]),fe=i.useCallback(M=>{const{microIsDiscrete:O,microAllowedDates:se,allowedDates:Me,minDate:ve,maxDate:Ne}=Z.current;return Pn(M,c,O,se??Me,ve,Ne,g)},[c,g]),ue=i.useCallback((M,O)=>{const se=T.current,Me=J.current;(M[0].getTime()!==se[0].getTime()||M[1].getTime()!==se[1].getTime())&&(T.current=M,S(M),le.current?.(M[0],M[1])),(O[0].getTime()!==Me[0].getTime()||O[1].getTime()!==Me[1].getTime())&&(J.current=O,Q(O),ie.current?.(O[0],O[1]))},[]),ce=i.useCallback((M,O,se)=>{const{minDate:Me,maxDate:ve}=Z.current,Ne=[Ge(M,Me,ve),Ge(O,Me,ve)],Te=ee(Ne);ue(Ne,bn(J.current,c,Te,fe(Te),g,se))},[c,ee,fe,ue,g]),be=i.useCallback((M,O)=>ce(M,O,"resize"),[ce]),z=i.useCallback((M,O)=>{const se=ee(T.current);ue(T.current,bn([M,O],c,se,fe(se),g,"resize"))},[c,ee,fe,ue,g]),de=i.useCallback(M=>{const O=T.current[1],se=M>O?M:O;be(M,se)},[be]),Ae=i.useCallback(M=>{const O=T.current[0],se=M<O?M:O;be(se,M)},[be]),$e=i.useCallback(M=>{const O=J.current[1],se=M>O?M:O;z(M,se)},[z]),E=i.useCallback(M=>{const O=J.current[0],se=M<O?M:O;z(se,M)},[z]),B=i.useCallback(M=>{const{minDate:O,maxDate:se}=Z.current,Me=T.current,ve=C.current;if(ve.length>0){const wt=Re(ve,Me[0],l,g)+M,v=Re(ve,Me[1],l,g)+M;if(wt<0||v>ve.length-1)return;ce(ve[wt],ve[v],"pan");return}const Ne=Fe(l,Me[0],M),Te=Fe(l,Me[1],M);Ne<O||Te>se||ce(Ne,Te,"pan")},[l,ce,g]),we=i.useCallback(M=>{const O=T.current,se=J.current,Me=ee(O),[ve,Ne]=Me,Te=fe(Me);if(Te.length>0){const $=Re(Te,se[0],c,g)+M,Ye=Re(Te,se[1],c,g)+M;if($<0||Ye>Te.length-1)return;z(Te[$],Te[Ye]);return}const wt=Fe(c,se[0],M),v=Fe(c,se[1],M);wt<ve||v>Ne||z(wt,v)},[c,ee,fe,z,g]),ke=i.useCallback(()=>{const M=A.current,O=ee(M);ue(M,bn(u.current,c,O,fe(O),g,"resize"))},[c,ee,fe,ue,g]),[Pe,Ce]=U,Xe=i.useMemo(()=>({value:j[0],onChange:de,minDate:r,maxDate:j[1],unit:l,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:L}),[j,de,r,l,g,e.formatLocale,e.locale,e.labels,L]),K=i.useMemo(()=>({value:j[1],onChange:Ae,minDate:j[0],maxDate:n,unit:l,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:L}),[j,Ae,n,l,g,e.formatLocale,e.locale,e.labels,L]),te=i.useMemo(()=>({value:D[0],onChange:$e,minDate:Pe,maxDate:D[1],unit:c,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:L}),[D,$e,Pe,c,g,e.formatLocale,e.locale,e.labels,L]),pe=i.useMemo(()=>({value:D[1],onChange:E,minDate:D[0],maxDate:Ce,unit:c,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:L}),[D,E,Ce,c,g,e.formatLocale,e.locale,e.labels,L]),me=i.useMemo(()=>({...w,mode:"vernier",unit:t,yearStartMonth:g,macroUnit:l,microUnit:c,minDate:r,maxDate:n,macroRange:j,microRange:D,onChangeMacroRange:be,onChangeMicroRange:z}),[w,t,l,c,r,n,j,D,be,z,g]);return{macroRange:j,setMacroRange:S,microRange:D,setMicroRange:Q,setMacroLowerDate:de,setMacroUpperDate:Ae,setMicroLowerDate:$e,setMicroUpperDate:E,shiftMacroRange:B,shiftMicroRange:we,resetVernier:ke,macroStartSelectorProps:Xe,macroEndSelectorProps:K,microStartSelectorProps:te,microEndSelectorProps:pe,sliderProps:me}}function Fs(e){const{unit:t,minDate:r,maxDate:n,initialMacroRange:o,initialMicroValue:a,macroUnit:l=t,microUnit:c=t,onChangeMacroRange:f,onChangeMicroPoint:d,yearStartMonth:p,formatOption:L,...b}=e,g=pr("useVernierSliderPoint",p);Vn("useVernierSliderPoint",r,n),yn("useVernierSliderPoint","initialMacroRange",o),wr("useVernierSliderPoint","initialMicroValue",a),Tn("useVernierSliderPoint","initialMacroRange",l,o,r,n,"[minDate, maxDate]",g);const V=bt(l,c,o,r,n,g);Ln("useVernierSliderPoint","initialMicroValue",c,a,V[0],V[1],"the initial macro window",g);const w=Nn(b),A=i.useRef(o),u=i.useRef(a),[Y,S]=i.useState(o),[X,Q]=i.useState(a);let j=Y;const ae=[Ge(Y[0],r,n),Ge(Y[1],r,n)];(ae[0]!==Y[0]||ae[1]!==Y[1])&&(j=ae,S(ae));const U=i.useMemo(()=>bt(l,c,j,r,n,g),[l,c,j,r,n,g]),ne=i.useMemo(()=>Pn(U,c,w.microIsDiscrete,w.microAllowedDates??w.allowedDates,r,n,g),[U,c,w.microIsDiscrete,w.microAllowedDates,w.allowedDates,r,n,g]),F=i.useMemo(()=>w.macroIsDiscrete===!0?yt(w.macroAllowedDates??w.allowedDates,l,r,n,g):[],[w.macroIsDiscrete,w.macroAllowedDates,w.allowedDates,l,r,n,g]),C=i.useRef(F);C.current=F;let D=X;const _=hr(X,c,U,ne,g);_!==X&&(D=_,Q(_));const T=i.useRef(j);T.current=j;const J=i.useRef(D);J.current=D;const Z=i.useRef({minDate:r,maxDate:n,macroIsDiscrete:w.macroIsDiscrete,macroAllowedDates:w.macroAllowedDates,microIsDiscrete:w.microIsDiscrete,microAllowedDates:w.microAllowedDates,allowedDates:w.allowedDates});Z.current={minDate:r,maxDate:n,macroIsDiscrete:w.macroIsDiscrete,macroAllowedDates:w.macroAllowedDates,microIsDiscrete:w.microIsDiscrete,microAllowedDates:w.microAllowedDates,allowedDates:w.allowedDates};const le=i.useRef(f);le.current=f;const ie=i.useRef(d);ie.current=d;const ee=i.useCallback(K=>{const{minDate:te,maxDate:pe}=Z.current;return bt(l,c,K,te,pe,g)},[l,c,g]),fe=i.useCallback(K=>{const{microIsDiscrete:te,microAllowedDates:pe,allowedDates:me,minDate:M,maxDate:O}=Z.current;return Pn(K,c,te,pe??me,M,O,g)},[c,g]),ue=i.useCallback((K,te)=>{const pe=T.current,me=J.current;(K[0].getTime()!==pe[0].getTime()||K[1].getTime()!==pe[1].getTime())&&(T.current=K,S(K),le.current?.(K[0],K[1])),te.getTime()!==me.getTime()&&(J.current=te,Q(te),ie.current?.(te))},[]),ce=i.useCallback((K,te)=>{const{minDate:pe,maxDate:me}=Z.current,M=[Ge(K,pe,me),Ge(te,pe,me)],O=ee(M);ue(M,hr(J.current,c,O,fe(O),g))},[c,ee,fe,ue,g]),be=i.useCallback(K=>{const te=ee(T.current);ue(T.current,hr(K,c,te,fe(te),g))},[c,ee,fe,ue,g]),z=i.useCallback(K=>{const te=T.current[1],pe=K>te?K:te;ce(K,pe)},[ce]),de=i.useCallback(K=>{const te=T.current[0],pe=K<te?K:te;ce(pe,K)},[ce]),Ae=i.useCallback(K=>{const{minDate:te,maxDate:pe}=Z.current,me=T.current,M=C.current;if(M.length>0){const Me=Re(M,me[0],l,g)+K,ve=Re(M,me[1],l,g)+K;if(Me<0||ve>M.length-1)return;ce(M[Me],M[ve]);return}const O=Fe(l,me[0],K),se=Fe(l,me[1],K);O<te||se>pe||ce(O,se)},[l,ce,g]),$e=i.useCallback(K=>{const te=T.current,pe=ee(te),me=fe(pe);if(me.length>0){be(En(me,c,J.current,K,g));return}be(Fe(c,J.current,K))},[c,ee,fe,be,g]),E=i.useCallback(()=>{const K=A.current,te=ee(K);ue(K,hr(u.current,c,te,fe(te),g))},[c,ee,fe,ue,g]),[B,we]=U,ke=i.useMemo(()=>({value:j[0],onChange:z,minDate:r,maxDate:j[1],unit:l,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:L}),[j,z,r,l,g,e.formatLocale,e.locale,e.labels,L]),Pe=i.useMemo(()=>({value:j[1],onChange:de,minDate:j[0],maxDate:n,unit:l,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:L}),[j,de,n,l,g,e.formatLocale,e.locale,e.labels,L]),Ce=i.useMemo(()=>({value:D,onChange:be,minDate:B,maxDate:we,unit:c,yearStartMonth:g,formatLocale:e.formatLocale,locale:e.locale,labels:e.labels,formatOption:L}),[D,be,B,we,c,g,e.formatLocale,e.locale,e.labels,L]),Xe=i.useMemo(()=>({...w,mode:"vernier",unit:t,yearStartMonth:g,macroUnit:l,microUnit:c,minDate:r,maxDate:n,macroRange:j,microValue:D,onChangeMacroRange:ce,onChangeMicroPoint:be}),[w,t,l,c,r,n,j,D,ce,be,g]);return{macroRange:j,setMacroRange:S,microValue:D,setMicroValue:Q,setMacroLowerDate:z,setMacroUpperDate:de,setMicroDate:be,shiftMacroRange:Ae,shiftMicroValue:$e,resetVernier:E,macroStartSelectorProps:ke,macroEndSelectorProps:Pe,microSelectorProps:Ce,sliderProps:Xe}}function si(e,t){const r=new Date(e,t,1);return r.setFullYear(e),r}function Nt(e,t){return e.getFullYear()-(e.getMonth()<t?1:0)}function wn(e,t){return e===void 0?null:Nt(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 ci(e,t){if(e!==void 0&&!Number.isInteger(e))throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`)}function zs(e){if(e!==void 0)try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{throw new RangeError(`YearSelector: \`formatLocale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`)}}function ui(e,t,r,n){const o=e===void 0?null:e,a=t===void 0?null:Nt(t,n);return o!==null&&a!==null?r(o,a):o!==null?o:a}function Us(e,t,r,n){const o=new Set;for(const a of e){const l=Nt(a,n);t!==null&&l<t||r!==null&&l>r||o.add(l)}return Array.from(o).sort((a,l)=>a-l)}function Bs(e,t,r,n){return e!==void 0?{kind:"discrete",ascending:Us(e,t,r,n)}:t===null||r===null?null:{kind:"bounded",minYear:t,maxYear:r}}function Ws(e,t){const r=[];for(let n=t;n>=e;n--)r.push(n);return r}const Gs=e=>{const{value:t,initialDate:r,onChange:n,children:o,minYear:a,maxYear:l,minDate:c,maxDate:f,allowedYears:d,className:p="",style:L,disabled:b=!1,locale:g,labels:V,formatLocale:w,formatOption:A,yearStartMonth:u}=e,Y=pr("YearSelector",u);_r(t,"value"),_r(r,"initialDate"),_r(c,"minDate"),_r(f,"maxDate"),ci(a,"minYear"),ci(l,"maxYear"),d?.forEach((z,de)=>{_r(z,`allowedYears[${de}]`)}),zs(w);const S=t??r;if(S===void 0)throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");const X=kn(g,V),[Q,j]=i.useState(()=>Nt(S,Y)),ae=c?.getTime(),U=f?.getTime(),ne=i.useMemo(()=>ui(a,c,Math.max,Y),[a,ae,Y]),F=i.useMemo(()=>ui(l,f,Math.min,Y),[l,U,Y]);if(ne!==null&&F!==null&&ne>F)throw new RangeError(`YearSelector: the resolved lower bound ${ne} is after the resolved upper bound ${F}.`);const C=d===void 0?null:d.map(z=>z.getTime()).join(","),D=i.useMemo(()=>Bs(d,ne,F,Y),[C,ne,F,Y]);if(D===null)throw new RangeError("YearSelector: a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`), or `allowedYears`, are required; the year option list is never invented.");const _=i.useMemo(()=>D.kind==="discrete"?{kind:"candidates",ascending:D.ascending,loIndex:0,hiIndex:D.ascending.length-1}:{kind:"range",min:D.minYear,max:D.maxYear},[D]),T=t!==void 0,J=t!==void 0?Nt(t,Y):Q,Z=!To(_,J),le=S.getTime();i.useEffect(()=>{T||j(Nt(S,Y))},[T,le,Y]);const ie=z=>{if(!b){if(!To(_,z))throw new RangeError(`YearSelector: refusing to emit ${z}, which lies outside the selectable years.`);T||j(z),n?.(si(z,Y),z)}},ee=br(_,J,-1),fe=br(_,J,1),ue=()=>{ee!==null&&ie(ee)},ce=()=>{fe!==null&&ie(fe)},be=i.useMemo(()=>{const z=D.kind==="discrete"?[...D.ascending].reverse():Ws(D.minYear,D.maxYear);return Z&&(z.push(J),z.sort((de,Ae)=>Ae-de)),z.map(de=>({value:de,label:je("year",si(de,Y),A,w)}))},[D,Z,J,Y,w,A]);return R.jsxs("div",{className:`inline-flex items-center ${zr} ${p}`,style:L,"data-out-of-range":Z?"true":void 0,children:[R.jsx(qt,{neighbour:"control",direction:"left",disabled:b,canStep:ee!==null,onStep:ue,ariaLabel:X.previousYear}),R.jsx("select",{"aria-label":X.yearSelect,disabled:b,className:"w-18 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",value:J,onChange:z=>{if(!z.target.value)return;const de=Number(z.target.value);Number.isInteger(de)&&ie(de)},children:be.map(z=>R.jsx("option",{value:z.value,disabled:Z&&z.value===J,className:"text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100",children:z.label},z.value))}),R.jsx(qt,{neighbour:"control",direction:"right",disabled:b,canStep:fe!==null,onStep:ce,ariaLabel:X.nextYear}),o]})},Hi=i.memo(Gs,(e,t)=>{const r=e.yearStartMonth??0,n=t.yearStartMonth??0;if(r!==n)return!1;const o=e.value??e.initialDate,a=t.value??t.initialDate,l=o?Nt(o,r):null,c=a?Nt(a,n):null;return!(l!==c||e.disabled!==t.disabled||e.className!==t.className||e.style!==t.style||e.minYear!==t.minYear||e.maxYear!==t.maxYear||wn(e.minDate,r)!==wn(t.minDate,n)||wn(e.maxDate,r)!==wn(t.maxDate,n)||e.allowedYears!==t.allowedYears||e.onChange!==t.onChange||e.children!==t.children||e.locale!==t.locale||!$n(e.labels,t.labels)||e.formatLocale!==t.formatLocale||e.formatOption!==t.formatOption)});Hi.displayName="YearSelector";exports.COLOR_SCHEME_PALETTES=wi;exports.DateSelector=Yi;exports.MonthSelector=_i;exports.PERIOD_SLIDER_LABEL_CATALOGS=hi;exports.PERIOD_SLIDER_LABEL_KEYS=An;exports.PeriodSlider=$i;exports.YearSelector=Hi;exports.addUnit=Fe;exports.areStylesEqual=Ai;exports.calculateConnectDragValues=Mi;exports.calculateHandleDragValues=Po;exports.calculateKeyboardActionValues=vi;exports.calculateLabelSlant=Vo;exports.calculateVernierMacroDrag=Ii;exports.calculateVernierMicroDrag=Ci;exports.decode=re;exports.encode=W;exports.findNearestDateIndex=Re;exports.formatLabel=je;exports.formatOptionText=Oi;exports.formatQuarterLabel=ns;exports.formatScreenReaderLabel=Gt;exports.getMacroWindowEndDate=pi;exports.getMacroWindowStartDate=xi;exports.getSortedAllowedDates=yt;exports.normalizeDateByUnit=Qe;exports.resolveDraggedEdge=Cn;exports.resolveMacroWindow=bt;exports.resolvePeriodSliderLabels=bi;exports.resolveQuarter=Di;exports.resolveVernierRailZone=No;exports.resolveVernierTargetHandle=Ei;exports.resolveWheelStep=Pi;exports.usePeriodSliderPoint=Hs;exports.usePeriodSliderRange=_s;exports.useVernierSliderPoint=Fs;exports.useVernierSliderRange=js;