@aiquants/virtualscroll 3.1.0 → 3.4.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 q=require("react/jsx-runtime"),t=require("react"),Mt=require("tailwind-merge"),Rr=n=>{const{quantum:e,resetOnDirectionChange:r=!0}=n;if(!(Number.isFinite(e)&&e>0))throw new TypeError(`[createResidualQuantizer] quantum must be a finite positive number, received ${e}`);let s=0;return{push:i=>{if(!Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER)return 0;r&&s!==0&&i!==0&&Math.sign(i)!==Math.sign(s)&&(s=0),s+=i;const o=Math.trunc(s/e)*e+0;return s-=o,o},peekResidue:()=>s,reset:()=>{s=0}}};class M{level;prefix;impl;constructor(e=2,r="[virtualscroll]",s=console){this.level=e,this.prefix=r,this.impl=s}static instance=new M(2,"[virtualscroll]");static setLevel(e){M.instance.setLevel(e)}setLevel(e){this.level=e}static setImplementation(e){M.instance.setImplementation(e)}setImplementation(e){this.impl=e}static setPrefix(e){M.instance.setPrefix(e)}setPrefix(e){this.prefix=e}static isEnabled(e){return M.instance.isEnabled(e)}isEnabled(e){return this.level<=e}static resolveLazy(e){if(typeof e!="function")return e;try{return e()}catch{return e}}formatMessage(e){return typeof e=="string"?[`${this.prefix} ${e}`]:[this.prefix,e]}static debug(e,...r){M.instance.debug(e,...r)}debug(e,...r){this.level<=0&&this.impl.debug(...this.formatMessage(M.resolveLazy(e)),...r.map(M.resolveLazy))}static info(e,...r){M.instance.info(e,...r)}info(e,...r){this.level<=1&&this.impl.info(...this.formatMessage(M.resolveLazy(e)),...r.map(M.resolveLazy))}static warn(e,...r){M.instance.warn(e,...r)}warn(e,...r){this.level<=2&&this.impl.warn(...this.formatMessage(M.resolveLazy(e)),...r.map(M.resolveLazy))}static error(e,...r){M.instance.error(e,...r)}error(e,...r){this.level<=3&&this.impl.error(...this.formatMessage(M.resolveLazy(e)),...r.map(M.resolveLazy))}}const sr={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},Xt=6,Pr=8,yr=({dragState:n,normalizedDistance:e})=>{const r=1+e*.18,s=.16+e*.24,i=.38+e*.28,o=n.active?"80ms ease-out":"220ms ease";return q.jsxs(q.Fragment,{children:[q.jsx("div",{className:"aqvs-tap-scroll-circle-visual-outer",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",boxShadow:`0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${s})`,transform:`scale(${r})`,transition:`${o}, ${n.active?"80ms":"260ms"} box-shadow ease`}}),q.jsx("div",{className:"aqvs-tap-scroll-circle-inner",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",boxShadow:"inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",opacity:i,transition:n.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},mr=t.memo(t.forwardRef(({onDragChange:n,className:e,maxVisualDistance:r=160,size:s=40,style:i,opacity:o=1,renderVisual:c},d)=>{const[p,b]=t.useState(sr),S=t.useRef(null),I=t.useRef(null),N=t.useRef({x:0,y:0}),g=t.useRef(null),A=t.useRef(0),$=t.useCallback(v=>{b(v),n(v)},[n]),V=t.useCallback((v,W,ue=!1)=>{const{x:He,y:qe}=N.current,k=v-He,Ae=W-qe,Xe=Math.abs(Ae),Ee=Xe<Xt?0:Ae<0?-1:1,Le=A.current;let je=Ee;const Ne=Xt+Pr;Ee===0?Le!==0&&Xe<Ne?je=Le:(je=0,ue||(A.current=0)):Ee!==Le&&Le!==0&&Xe<Ne?je=Le:A.current=Ee,$({active:ue||Xe>=Xt,offsetX:k,offsetY:Ae,distance:Xe,direction:je,pointerId:S.current})},[$]),ae=t.useCallback(v=>{if(v===null)return;const W=g.current;W?.hasPointerCapture(v)&&W.releasePointerCapture(v)},[]),le=t.useCallback((v=!1)=>{v&&ae(S.current),S.current=null,I.current=null,A.current=0,$(sr)},[$,ae]),re=t.useCallback(v=>{if(S.current!==null&&S.current!==v.pointerId){I.current={pointerId:v.pointerId,clientX:v.clientX,clientY:v.clientY},v.preventDefault(),v.stopPropagation();return}v.preventDefault(),v.stopPropagation();const W=g.current??v.currentTarget,{left:ue,top:He,width:qe,height:k}=W.getBoundingClientRect();N.current={x:ue+qe/2,y:He+k/2},S.current=v.pointerId;try{W.setPointerCapture(v.pointerId)}catch{}V(v.clientX,v.clientY,!0)},[V]),se=t.useCallback(v=>{if(S.current!==v.pointerId){I.current!==null&&I.current.pointerId===v.pointerId&&(I.current={pointerId:v.pointerId,clientX:v.clientX,clientY:v.clientY});return}v.preventDefault(),V(v.clientX,v.clientY)},[V]),ce=t.useCallback(v=>{if(S.current!==v.pointerId){I.current!==null&&I.current.pointerId===v.pointerId&&(I.current=null);return}v.preventDefault(),v.stopPropagation();const W=I.current;if(I.current=null,W!==null){ae(v.pointerId);const ue=g.current;let He=!0;if(ue!==null&&typeof ue.setPointerCapture=="function")try{ue.setPointerCapture(W.pointerId)}catch(qe){(typeof qe=="object"&&qe!==null&&"name"in qe?qe.name:void 0)==="NotFoundError"&&(He=!1)}if(He){S.current=W.pointerId,V(W.clientX,W.clientY,!0);return}}le(!0)},[le,ae,V]),R=t.useCallback(v=>{v.target===v.currentTarget&&S.current===v.pointerId&&le(!1)},[le]);t.useImperativeHandle(d,()=>({reset:()=>{le(!0)},getElement:()=>g.current}),[le]);const F=Math.min(Math.max(o,0),1),w=s/64,G=Math.min(p.distance,r)/r,Z=p.direction*G*10*w,U=c??yr,me={dragState:p,normalizedDistance:G,sizeScale:w,size:s,opacity:F},z={...i,width:s,height:s,transform:`translateY(${Z}px)`};return z.opacity=F,q.jsx("div",{ref:g,"data-testid":"virtual-scroll-tap-circle",className:Mt.twMerge("aqvs-tap-scroll-circle",e),style:z,tabIndex:-1,onPointerDown:re,onPointerMove:se,onPointerUp:ce,onPointerCancel:ce,onLostPointerCapture:R,role:"presentation",children:U(me)})}));mr.displayName="TapScrollCircle";const te=(n,e,r)=>Math.max(e,Math.min(r,n)),Kt="virtualscroll:tap-scroll-cancel",ir=20,Er=250,Cr=60,kr=20,Nr=20,Gt={maxDistance:240,minSpeedMultiplier:.2},Vr=Gt.maxDistance,or={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},jt=2.2,zr=8,Dr=120,Ar=1/10,ot={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:Vr,minSpeedMultiplier:Gt.minSpeedMultiplier,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},Lr=n=>n?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,r)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"aqvs-scrollbar-horizontal",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,r)=>r,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"aqvs-scrollbar-vertical",orientation:"vertical"},Or=(n,e)=>{const r=n?.maxSpeedMultiplier,s=typeof r=="number"?r:hr(e);return{enabled:n?.enabled??ot.enabled,size:n?.size??ot.size,offsetX:n?.offsetX??ot.offsetX,offsetY:n?.offsetY??ot.offsetY,className:n?.className??ot.className,maxVisualDistance:n?.maxVisualDistance??ot.maxVisualDistance,maxSpeedMultiplier:s,minSpeedMultiplier:Math.max(n?.minSpeedMultiplier??ot.minSpeedMultiplier,0),opacity:te(n?.opacity??ot.opacity,0,1),renderVisual:n?.renderVisual??ot.renderVisual,maxSpeedCurve:n?.maxSpeedCurve??ot.maxSpeedCurve}},_r=({isDragging:n,isThumbHovered:e,enableThumbDrag:r})=>t.useMemo(()=>r?n?"dragging":e?"hover":"idle":"disabled",[r,n,e]),Fr=({canUseArrowButtons:n,enableArrowButtons:e,resetTapScroll:r,scrollByStep:s})=>{const i=t.useRef(null),o=t.useRef(null),c=t.useRef(null),d=t.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null),o.current!==null&&(window.clearTimeout(o.current),o.current=null),c.current!==null&&(window.removeEventListener("pointerup",c.current),window.removeEventListener("pointercancel",c.current),window.removeEventListener("blur",c.current),c.current=null)},[]),p=t.useCallback(()=>{d()},[d]),b=t.useCallback(I=>N=>{if(!n)return;N.cancelable&&N.preventDefault(),N.stopPropagation(),r(),d(),s(I),o.current=window.setTimeout(()=>{i.current=window.setInterval(()=>{s(I)},Cr)},Er);const g=()=>d();c.current=g,window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g),window.addEventListener("blur",g)},[n,d,r,s]),S=t.useCallback(I=>N=>{e&&(N.key==="Enter"||N.key===" "||N.key==="Spacebar")&&(N.preventDefault(),s(I))},[e,s]);return t.useEffect(()=>{n||d()},[n,d]),t.useEffect(()=>()=>{d()},[d]),{handleArrowPointerDown:b,handleArrowPointerUp:p,handleArrowKeyDown:S}},Yr=700,gt=(n,e)=>typeof n=="number"&&Number.isFinite(n)?n:e,pr=({distance:n,maxDistance:e,viewportSize:r,minSpeedMultiplier:s,maxSpeedMultiplier:i,hasCustomMaxSpeedMultiplier:o,curve:c})=>{const d=Math.max(gt(n,0),0),p=gt(e,0),b=p>0?Math.min(d,p)/p:1,S=Math.max(gt(r,0),0),I=Math.max(gt(s,0),0),N=Math.max(gt(i,0),0),g=Math.max(S*I,40),A=o?g:1200,$=Math.max(S*N,A),V=c?Math.max(gt(c.exponentialScale,N),0):0,ae=c?Math.min($,Math.max(S*V,g)):$,le=Math.max(ae,g);let re=b**1.1;if(c){const ce=Math.min(Math.max(gt(c.exponentialSteepness,0),0),Yr);if(ce===0)re=b;else{const R=Math.expm1(ce)||1;re=Math.min(Math.max(Math.expm1(ce*b)/R,0),1)}}const se=Math.min(Math.max(gt(c?.easedOffset,0),0),1);return g+(le-g)*(se+(1-se)*re)},hr=n=>{if(!n||n<=0)return jt;const e=Math.max(1,n),r=Math.log10(e),s=jt+r*zr;return te(s,jt,Dr)},gr=({contentSize:n,viewportSize:e,scrollPosition:r,onScroll:s,enableThumbDrag:i=!0,enableTrackClick:o=!0,enableArrowButtons:c=!0,horizontal:d=!1,scrollBarWidth:p=12,className:b,ariaControls:S,tapScrollCircleOptions:I,itemCount:N,renderThumbOverlay:g,visibleStartIndex:A,visibleEndIndex:$})=>{const[V,ae]=t.useState(!1),[le,re]=t.useState(!1),[se,ce]=t.useState(!1),R=t.useRef(null),F=t.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null}),w=t.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}),G=t.useRef(r),Z=t.useRef(s),U=t.useRef(or),me=t.useRef(null),z=t.useRef(null),v=t.useRef(null),W=t.useRef(0),ue=t.useRef(0),He=t.useMemo(()=>Or(I,N),[N,I]),qe=t.useMemo(()=>Lr(d),[d]),{enabled:k,size:Ae,offsetX:Xe,offsetY:Ee,className:Le,maxVisualDistance:je,maxSpeedMultiplier:Ne,minSpeedMultiplier:Te,opacity:Ce,renderVisual:he,maxSpeedCurve:Se}=He,K=t.useRef({viewportSize:e,maxScrollPosition:Math.max(n-e,0),scrollBarVisible:n>e,effectiveTapMaxDistance:Math.max(je,1),tapCircleMaxSpeedMultiplier:Ne,tapCircleMinSpeedMultiplier:Te,tapCircleMaxSpeedCurve:Se,tapScrollCircleOptions:I,effectiveTrackLength:0,onScroll:s,scrollPosition:r}),{mainSizeKey:Ge,crossSizeKey:$e,positionKey:at,selectDelta:et,getPointerCoordinate:E,arrowLabels:dt,arrowIcons:ne,directionClass:C,orientation:tt}=qe,Ue=Math.max(je,1),lt=e/n,Ve=Math.max(e-p*2,0),m=lt*Ve,T=Math.min(Math.max(ir,m||0),Ve||ir),H=n-e,B=Math.max(Ve-T,0),Q=H<=0||B<=0?0:te(r/H*B,0,B),ve=Q+T/2,J=n>e||V,ge=J&&c;t.useLayoutEffect(()=>{K.current={viewportSize:e,maxScrollPosition:H,scrollBarVisible:J,effectiveTapMaxDistance:Ue,tapCircleMaxSpeedMultiplier:Ne,tapCircleMinSpeedMultiplier:Te,tapCircleMaxSpeedCurve:Se,tapScrollCircleOptions:I,effectiveTrackLength:B,onScroll:s,scrollPosition:r}}),t.useLayoutEffect(()=>{G.current=r},[r]),t.useLayoutEffect(()=>{Z.current=s},[s]),t.useEffect(()=>{i||re(!1)},[i]);const Me=_r({isDragging:V,isThumbHovered:le,enableThumbDrag:i}),X=t.useCallback((l,x)=>{const y=K.current,D=x??G.current;if(Z.current){const Fe=Z.current(l,D);if(typeof Fe=="number"&&Number.isFinite(Fe))return G.current=Fe,Fe}const j=typeof l=="function"?l(D):l,be=Math.max(y.maxScrollPosition,0),_e=y.scrollBarVisible?te(j,0,be):0;return G.current=_e,_e},[]),Re=t.useCallback(l=>{const x=K.current,y=G.current;if(!x.scrollBarVisible||x.maxScrollPosition<=0){const We=X(0,y),ct=We-y;return{nextPosition:We,actualDelta:ct,reachedBoundary:!0}}if(l===0)return{nextPosition:y,actualDelta:0,reachedBoundary:!1};const j=X(We=>te(We+l,0,x.maxScrollPosition),y),be=j-y,_e=l<0&&y+l<=0,Fe=l>0&&y+l>=x.maxScrollPosition,nt=l<0&&(j<=0||_e&&be===0)||l>0&&(j>=x.maxScrollPosition||Fe&&be===0);return{nextPosition:j,actualDelta:be,reachedBoundary:nt}},[X]),ke=t.useCallback((l,x)=>{l.current+=x;const y=Math.max(K.current.maxScrollPosition,0);y>0&&(l.current=te(l.current,-y,y));const D=Re(l.current);return l.current-=D.actualDelta,D.reachedBoundary&&(l.current=0),D},[Re]),fe=t.useCallback(()=>{z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null),v.current=null,W.current=0,ue.current=0},[]),Pe=t.useCallback(()=>{U.current={...or},ce(!1),me.current?.reset(),fe()},[fe]),Ze=t.useCallback(l=>{const x=U.current,y=K.current;if(!x.active||x.direction===0){fe();return}if(!y.scrollBarVisible||y.maxScrollPosition<=0){fe();return}const D=v.current??l,j=Math.max((l-D)/1e3,0),be=Math.min(j,Ar);if(v.current=l,be<=0){z.current=window.requestAnimationFrame(Ze);return}const _e=pr({distance:x.distance,maxDistance:y.effectiveTapMaxDistance,viewportSize:y.viewportSize,minSpeedMultiplier:y.tapCircleMinSpeedMultiplier,maxSpeedMultiplier:y.tapCircleMaxSpeedMultiplier,hasCustomMaxSpeedMultiplier:typeof y.tapScrollCircleOptions?.maxSpeedMultiplier=="number",curve:y.tapCircleMaxSpeedCurve});ue.current!==x.direction&&(ue.current=x.direction,W.current=0);const{reachedBoundary:Fe}=ke(W,x.direction*_e*be);if(Fe){fe();return}z.current=window.requestAnimationFrame(Ze)},[ke,fe]),ze=t.useCallback(()=>{z.current===null&&(v.current=null,W.current=0,z.current=window.requestAnimationFrame(Ze))},[Ze]);t.useEffect(()=>{const l=U.current;!l.active||l.direction===0||ze()},[n,e,ze]),t.useEffect(()=>()=>{fe()},[fe]);const rt=t.useCallback(l=>{U.current=l,ce(l.active),l.active&&l.direction!==0?ze():fe()},[ze,fe]);t.useEffect(()=>{k||Pe()},[Pe,k]),t.useEffect(()=>{const l=x=>{const D=x.detail?.paneId;D&&S&&D!==S||Pe()};return window.addEventListener(Kt,l),()=>{window.removeEventListener(Kt,l)}},[S,Pe]),t.useEffect(()=>{if(!k)return;const l=x=>{if(!U.current.active||U.current.pointerId===x.pointerId)return;const y=x.target;if(!(y instanceof Node)){Pe();return}me.current?.getElement()?.contains(y)||Pe()};return document.addEventListener("pointerdown",l,!0),()=>{document.removeEventListener("pointerdown",l,!0)}},[Pe,k]);const we=l=>{if(!J||B<=0||H<=0)return 0;const x=te(l,0,B);return te(x/B*H,0,H)},Qe=t.useCallback(l=>{const{scrollBarVisible:x,effectiveTrackLength:y,maxScrollPosition:D}=K.current;if(M.debug("[ScrollBar] calculateScrollPositionFromThumb",()=>({thumbPos:l,trackLen:y,maxScroll:D})),y<=0||D<=0)return null;const j=te(l,0,y);return te(j/y*D,0,D)},[]),h=t.useCallback(l=>{const x=l.getBoundingClientRect(),y=d?x.width:x.height,D=nt=>{const We=Number.parseFloat(nt);return Number.isFinite(We)?We:0},j=window.getComputedStyle(l),be=D(d?j.width:j.height),_e=be>0?be+D(d?j.paddingLeft:j.paddingTop)+D(d?j.paddingRight:j.paddingBottom)+D(d?j.borderLeftWidth:j.borderTopWidth)+D(d?j.borderRightWidth:j.borderBottomWidth):0,Fe=_e>0?_e:d?l.offsetWidth:l.offsetHeight;return Fe<=0||y<=0?1:y/Fe},[d]),P=t.useCallback(l=>{const x=F.current;if(x.pointerId!==l.pointerId)return;const y=l.clientX-x.startClientX,D=l.clientY-x.startClientY,j=et(y,D)/(x.scale||1);M.debug("[ScrollBar] handleThumbPointerMove",()=>({delta:j,startThumbPosition:x.startThumbPosition,clientY:l.clientY,startClientY:x.startClientY,metrics:K.current}));const be=Qe(x.startThumbPosition+j);be!==null&&X(be),l.cancelable&&l.preventDefault()},[et,Qe,X]),ie=t.useCallback(l=>{const x=F.current;if(x.pointerId!==l.pointerId)return;document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",ie),document.removeEventListener("pointercancel",ie);const y=x.captureTarget;if(y?.hasPointerCapture?.(l.pointerId)&&y.releasePointerCapture(l.pointerId),F.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null},ae(!1),R.current){const D=R.current.getBoundingClientRect();l.clientX>=D.left&&l.clientX<=D.right&&l.clientY>=D.top&&l.clientY<=D.bottom||re(!1)}else re(!1)},[P]);t.useEffect(()=>()=>{document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",ie),document.removeEventListener("pointercancel",ie)},[P,ie]);const Je=t.useRef(0),ye=t.useRef(0),Rt=t.useCallback(l=>{const x=Math.max(Math.round(K.current.viewportSize/Nr),kr);ye.current!==l&&(ye.current=l,Je.current=0),ke(Je,l*x)},[ke]),{handleArrowPointerDown:st,handleArrowPointerUp:Oe,handleArrowKeyDown:mt}=Fr({canUseArrowButtons:ge,enableArrowButtons:c,resetTapScroll:Pe,scrollByStep:Rt}),St=l=>{if(!J)return;if(!i){l.preventDefault(),l.stopPropagation();return}if(l.pointerType==="mouse"&&l.button!==0||l.ctrlKey)return;Pe();const x=l.currentTarget,y=h(x);let D=null;if(x.setPointerCapture)try{x.setPointerCapture(l.pointerId),D=x}catch{D=null}F.current={pointerId:l.pointerId,startThumbPosition:Q,startClientX:l.clientX,startClientY:l.clientY,scale:y,captureTarget:D},document.addEventListener("pointermove",P),document.addEventListener("pointerup",ie),document.addEventListener("pointercancel",ie),ae(!0),re(!0),l.preventDefault(),l.stopPropagation()},zt=l=>{if(!J)return;if(!o){l.preventDefault(),l.stopPropagation();return}if(l.pointerType==="mouse"&&l.button!==0||l.ctrlKey)return;const x=l.currentTarget,y=x.getBoundingClientRect(),D=E(l),j=h(x),be=(D-(d?y.left:y.top))/j;Pe();const _e=be-T/2,Fe=we(_e);if(X(Fe),x.setPointerCapture)try{x.setPointerCapture(l.pointerId)}catch{}w.current={pointerId:l.pointerId,startThumbPosition:_e,startClientX:l.clientX,startClientY:l.clientY,scale:j},l.preventDefault(),l.stopPropagation()},it=()=>{w.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}},vt=l=>{const x=w.current;if(x.pointerId!==l.pointerId)return;if(l.pointerType==="mouse"&&l.buttons===0){it();return}const y=l.clientX-x.startClientX,D=l.clientY-x.startClientY,j=et(y,D)/(x.scale||1),be=we(x.startThumbPosition+j);X(be),l.cancelable&&l.preventDefault()},Dt=l=>{if(w.current.pointerId!==l.pointerId)return;const x=l.currentTarget;x.hasPointerCapture?.(l.pointerId)&&x.releasePointerCapture(l.pointerId),it(),l.preventDefault(),l.stopPropagation()},Pt=l=>{if(w.current.pointerId!==l.pointerId)return;const x=l.currentTarget;x.hasPointerCapture?.(l.pointerId)&&x.releasePointerCapture(l.pointerId),it()},At=l=>{l.target===l.currentTarget&&w.current.pointerId===l.pointerId&&it()},pe=t.useMemo(()=>te((se?1:.8)*Ce,0,1),[se,Ce]),pt=t.useMemo(()=>{const x=`calc(50% - ${Ae/2}px + ${Ee}px)`;return{left:Xe,top:x}},[Xe,Ee,Ae]),yt=(l,x,y,D)=>q.jsx("button",{type:"button",tabIndex:0,className:"aqvs-scrollbar-arrow-button",style:{[Ge]:p,[$e]:p},"aria-label":x,onPointerDown:st(l),onPointerUp:Oe,onPointerLeave:Oe,onPointerCancel:Oe,onKeyDown:mt(l),"aria-disabled":!c,disabled:!ge,children:q.jsx("span",{"aria-hidden":"true",children:y})},D),Et=g&&J?{orientation:tt,scrollPosition:r,maxScrollPosition:H,contentSize:n,viewportSize:e,thumbSize:T,thumbPosition:Q,thumbCenter:ve,trackSize:Ve,isDragging:V,isTapScrollActive:se,visibleStartIndex:A,visibleEndIndex:$}:null;return q.jsxs("div",{className:Mt.twMerge("aqvs-scrollbar",C,b),style:{[Ge]:e,[$e]:p},"data-visible":J?"true":"false",role:"scrollbar",tabIndex:-1,"aria-controls":S,"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":H,"aria-orientation":d?"horizontal":"vertical",children:[!d&&J&&k&&q.jsx(mr,{ref:me,className:Mt.twMerge("aqvs-scrollbar-tap-circle-wrapper",Le),size:Ae,maxVisualDistance:Ue,style:pt,opacity:pe,renderVisual:he,onDragChange:rt},"tap-circle"),yt(-1,dt[0],ne[0],"arrow-start"),q.jsxs("div",{className:"aqvs-scrollbar-track",style:{borderRadius:p/2},onPointerDown:zt,onPointerMove:vt,onPointerUp:Dt,onPointerCancel:Pt,onLostPointerCapture:At,"aria-disabled":!o,children:[Et&&q.jsx("div",{className:"aqvs-scrollbar-overlay","aria-hidden":!0,children:g?.(Et)},"overlay"),q.jsx("div",{className:"aqvs-scrollbar-thumb-wrapper",style:{[Ge]:T,[at]:Q,...d?{top:0,bottom:0}:{left:0,right:0}},"data-visible":J||V?"true":"false",onPointerDown:St,role:"slider","aria-orientation":d?"horizontal":"vertical","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":H,"aria-disabled":!i,tabIndex:-1,children:q.jsx("div",{ref:R,className:Mt.twMerge("aqvs-scrollbar-thumb",d?"aqvs-scrollbar-thumb-horizontal":"aqvs-scrollbar-thumb-vertical"),"data-testid":"aqvs-scrollbar-thumb","data-thumb-state":Me,style:{borderRadius:p-1,cursor:i?"pointer":"default"},onMouseEnter:()=>{i&&re(!0)},onMouseLeave:()=>{i&&re(!1)}},"thumb")},"thumb-wrapper")]},"track"),yt(1,dt[1],ne[1],"arrow-end")]})},Br=16,ar=(n,e,r)=>e===1?n*Br:e===2?n*r:n,Hr=(n,e)=>{const r=n.shiftKey&&n.deltaX===0,s=r?n.deltaY:n.deltaX,i=r?0:n.deltaY,o=s!==0&&Math.abs(s)>=Math.abs(i);return{isZoomGesture:n.ctrlKey,isHorizontalDominant:o,horizontalDelta:ar(s,n.deltaMode,e),verticalDelta:ar(i,n.deltaMode,e)}},br=new WeakSet,lr=n=>{br.add(n)},qr=n=>br.has(n),Xr=["mouse","pen","touch"],$t=(n,e)=>!(n==="mouse"||n==="pen"||n==="touch")||e.includes(n),jr=n=>n==="mouse"||n==="pen",Nt={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},Ot=(n,e,r)=>{for(const[s,i,o]of e)r==="add"?n.addEventListener(s,i,o):n.removeEventListener(s,i,o)},xr=t.forwardRef(({children:n,contentSize:e,viewportSize:r,onViewportSizeChange:s,scrollBarWidth:i=12,enableThumbDrag:o=!0,enableTrackClick:c=!0,enableArrowButtons:d=!0,enablePointerDrag:p=!0,pointerDragInputs:b=Xr,onScroll:S,className:I,testId:N,style:g,background:A,tapScrollCircleOptions:$,inertiaOptions:V,itemCount:ae,renderThumbOverlay:le,wheelSpeedMultiplier:re=1,overscrollBehavior:se="auto",onWheelHorizontal:ce,contentInsets:R,visibleStartIndex:F,visibleEndIndex:w,renderOverlay:G,initialScrollPosition:Z=0,contentProps:U},me)=>{const z=t.useRef(Number.isFinite(Z)?Math.max(0,Z):0),v=t.useRef(null),W=t.useRef(null),ue=r===void 0,[He,qe]=t.useState(0),k=r??He,Ae=t.useRef(null);t.useLayoutEffect(()=>{if(!ue)return;const m=W.current;if(!m)return;const T=()=>{const B=m.offsetHeight;if(B>0){qe(Q=>Q===B?Q:B);return}m.offsetParent!==null&&e>0&&Ae.current!=="zero"&&(Ae.current="zero",M.warn("[ScrollPane] The self-measured viewport is 0px. Give the scroll pane's host element a definite height (e.g. h-full, flex-1 + min-h-0, an explicit px height), or pass viewportSize explicitly."))};if(T(),typeof ResizeObserver!="function")return;const H=new ResizeObserver(T);return H.observe(m),()=>{H.disconnect()}},[e,ue]),t.useLayoutEffect(()=>{ue&&s?.(He)},[ue,He,s]),t.useLayoutEffect(()=>{if(ue)return;const m=v.current;if(!m)return;const T=()=>{const B=m.clientHeight;if(B<=0||Math.abs(B-k)<=1)return;const Q=`${k}/${B}`;Ae.current!==Q&&(Ae.current=Q,M.warn(`[ScrollPane] viewportSize=${k} but the host band is ${B}px. The clip window, max scroll position, thumb mapping, rendered row count and scrollability all derive from viewportSize, so they are now wrong. Omit viewportSize to let the pane measure itself.`))};if(T(),typeof ResizeObserver!="function")return;const H=new ResizeObserver(T);return H.observe(m),()=>{H.disconnect()}},[ue,k]);const Xe=t.useRef(ce);t.useEffect(()=>{Xe.current=ce},[ce]);const Ee=t.useRef({frame:null,velocity:0,lastTimestamp:null,generation:0}),Le=t.useMemo(()=>({maxVelocity:V?.maxVelocity??Nt.maxVelocity,minVelocity:V?.minVelocity??Nt.minVelocity,deceleration:V?.deceleration??Nt.deceleration,velocitySampleWindow:V?.velocitySampleWindow??Nt.velocitySampleWindow,startVelocityThreshold:V?.startVelocityThreshold??Nt.startVelocityThreshold}),[V]),je=t.useMemo(()=>({top:Math.max(0,R?.top??0),bottom:Math.max(0,R?.bottom??0)}),[R]);M.debug("[ScrollPane] ScrollPane rendered",()=>({contentSize:e,viewportSize:k,scrollBarWidth:i,className:I,style:g,tapScrollCircleOptions:$,inertiaOptions:V,enablePointerDrag:p,contentInsets:je}));const Ne=t.useRef({contentSize:e,viewportSize:k}),Te=t.useMemo(()=>e>k,[e,k]),Ce=t.useCallback((m,T)=>{let H=T??Ne.current;T&&!(Number.isFinite(T.contentSize)&&Number.isFinite(T.viewportSize))&&(M.warn("[ScrollPane] scrollTo received non-finite dimsOverride; falling back to the committed dims",{dimsOverride:T}),H=Ne.current);const{contentSize:B,viewportSize:Q}=H,ve=B>Q,J=z.current;if(M.debug("[ScrollPane] scrollTo called",()=>({newPosition:m,contentSize:B,viewportSize:Q,currentIsScrollable:ve,prevPosition:J})),!ve)return z.current!==0&&(z.current=0,S?.(0,J)),z.current;const ge=typeof m=="function"?m(z.current):m;if(!Number.isFinite(ge))return M.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position",{nextPosition:ge}),z.current;const Me=Math.max(B-Q,0),X=te(ge,0,Me);return z.current!==X&&(z.current=X,S?.(X,J)),z.current},[S]),he=t.useRef(Ce);t.useEffect(()=>{he.current=Ce},[Ce]);const Se=t.useCallback(()=>{const m=Ee.current;m.generation+=1,m.frame!==null&&cancelAnimationFrame(m.frame),m.frame=null,m.velocity=0,m.lastTimestamp=null},[]),K=t.useRef(Se);t.useEffect(()=>{K.current=Se},[Se]),t.useEffect(()=>()=>{K.current()},[]);const Ge=t.useCallback(m=>{if(!Te)return;const{maxVelocity:T,minVelocity:H,deceleration:B,startVelocityThreshold:Q}=Le,ve=te(m,-T,T);if(Math.abs(ve)<Q)return;Se(),Ee.current.velocity=ve,Ee.current.lastTimestamp=null;const J=Ee.current.generation,ge=Me=>{const X=Ee.current;if(X.generation!==J)return;if(X.lastTimestamp===null){X.lastTimestamp=Me,X.frame=requestAnimationFrame(ge);return}const Re=Me-X.lastTimestamp;if(X.lastTimestamp=Me,Re<=0){X.frame=requestAnimationFrame(ge);return}const ke=X.velocity;let fe=ke;const Pe=B*Re;ke>0?fe=Math.max(0,ke-Pe):ke<0&&(fe=Math.min(0,ke+Pe));const ze=(ke+fe)/2*Re,rt=z.current;if(ze!==0&&he.current(Je=>Je+ze),Ee.current.generation!==J)return;const we=z.current,{contentSize:Qe,viewportSize:h}=Ne.current,P=Math.max(Qe-h,0);X.velocity=fe;const ie=we===rt||we<=0&&fe<=0||we>=P&&fe>=0;if(Math.abs(fe)<H||ie){Se();return}X.frame=requestAnimationFrame(ge)};Ee.current.frame=requestAnimationFrame(ge)},[Te,Le,Se]),$e=t.useRef(Ge);t.useEffect(()=>{$e.current=Ge},[Ge]),t.useLayoutEffect(()=>{Ne.current={contentSize:e,viewportSize:k}},[e,k]),t.useLayoutEffect(()=>{const m=W.current;if(!m)return;const T=()=>{m.scrollTop!==0&&(M.debug("[ScrollPane] Native scroll detected, resetting to 0",()=>({scrollTop:m.scrollTop})),m.scrollTop=0),m.scrollLeft!==0&&(m.scrollLeft=0)};return m.addEventListener("scroll",T),()=>m.removeEventListener("scroll",T)},[]),t.useLayoutEffect(()=>{if(Te){M.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",()=>({contentSize:e,viewportSize:k,scrollPosition:z.current}));const m=te(e-k,0,e);z.current>m&&Ce(m)}else Ce(0)},[Te,Ce,e,k]);const at=t.useRef({isScrollable:Te,viewportSize:k,wheelSpeedMultiplier:re,overscrollBehavior:se});t.useLayoutEffect(()=>{at.current={isScrollable:Te,viewportSize:k,wheelSpeedMultiplier:re,overscrollBehavior:se}},[Te,k,re,se]);const et=t.useCallback(m=>{if(qr(m))return!1;const{isScrollable:T,viewportSize:H,wheelSpeedMultiplier:B,overscrollBehavior:Q}=at.current,ve=Hr(m,H);if(ve.isZoomGesture)return!1;if(ve.isHorizontalDominant)return Xe.current?(lr(m),m.preventDefault(),Se(),Xe.current(ve.horizontalDelta),!0):!1;if(!T||ve.verticalDelta===0)return!1;let J=ve.verticalDelta;if(B!==1&&(J*=B),Q!=="contain"){const ge=z.current,Me=Math.max(Ne.current.contentSize-H,0);if(J>0&&ge>=Me||J<0&&ge<=0)return!1}return lr(m),m.preventDefault(),Se(),M.debug("[ScrollPane] wheel event",()=>({deltaY:J,scrollPosition:z.current,wheelSpeedMultiplier:B,deltaMode:m.deltaMode,scrollTop:W.current?.scrollTop})),Ce(ge=>ge+J),!0},[Ce,Se]);t.useEffect(()=>{const m=B=>{et(B)},T=()=>{Se()},H=v.current;return H&&(H.addEventListener("wheel",m,{passive:!1}),H.addEventListener("pointerdown",T,{capture:!0,passive:!0})),()=>{H&&(H.removeEventListener("wheel",m),H.removeEventListener("pointerdown",T,{capture:!0}))}},[et,Se]),t.useImperativeHandle(me,()=>({scrollTo:(m,T)=>(Se(),Ce(m,T)),getScrollPosition:()=>z.current,getContentSize:()=>e,getViewportSize:()=>k,applyWheel:et}),[Ce,e,k,Se,et]);const E=t.useId(),dt=U?.id??E,ne=t.useRef({pointerType:"",pointerId:null,startClientY:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[]}),C=t.useRef(p),tt=t.useRef(b);t.useEffect(()=>{C.current=p},[p]),t.useEffect(()=>{tt.current=b},[b]);const Ue=t.useRef(Te);t.useEffect(()=>{Ue.current=Te},[Te]);const lt=t.useRef(Le);t.useEffect(()=>{lt.current=Le},[Le]),t.useEffect(()=>{const m=ne.current;if(p&&Te&&(m.pointerId===null||$t(m.pointerType,b))||m.pointerId===null)return;const T=W.current;m.clickResetTimer!==null&&(window.clearTimeout(m.clickResetTimer),m.clickResetTimer=null);const H=m.isDragging&&m.shouldCancelNextClick,B=m.pointerId;m.pointerId=null,m.pointerType="",m.startClientY=0,m.startScroll=0,m.isDragging=!1,m.shouldCancelNextClick=H,m.velocitySamples=[],T?.hasPointerCapture(B)&&T.releasePointerCapture(B)},[p,b,Te]),t.useEffect(()=>{const m=W.current;if(!m)return;const T=6,H=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),B=()=>{const h=ne.current;h.pointerId=null,h.pointerType="",h.startClientY=0,h.startScroll=0,h.isDragging=!1,h.velocitySamples=[]},Q=()=>{const h=ne.current;h.clickResetTimer!==null&&(window.clearTimeout(h.clickResetTimer),h.clickResetTimer=null)},ve=h=>{const P=ne.current,ie=H();P.velocitySamples.push({clientY:h,time:ie});const Je=lt.current.velocitySampleWindow;P.velocitySamples=P.velocitySamples.filter(ye=>ie-ye.time<=Je)},J=h=>h instanceof HTMLElement&&h.closest("[data-scrollpane-ignore-drag='true']")!==null,ge=h=>{const P=ne.current;P.shouldCancelNextClick&&(h.preventDefault(),h.stopPropagation(),P.shouldCancelNextClick=!1)},Me=h=>{const P=ne.current;if(!P.isDragging){if(P.isDragging=!0,P.shouldCancelNextClick=!0,!m.hasPointerCapture(h.pointerId))try{m.setPointerCapture(h.pointerId)}catch{}ve(h.clientY)}},X=h=>h.isTrusted||h.target===m,Re=h=>{const P=ne.current;m.hasPointerCapture(h)&&m.releasePointerCapture(h),P.shouldCancelNextClick=!1,Q(),B()},ke=h=>{const P=ne.current;if(P.pointerId!==h.pointerId)return;if(h.buttons===0&&jr(h.pointerType)){Re(h.pointerId);return}if(!(C.current&&Ue.current)||!$t(h.pointerType,tt.current)||!P.isDragging&&(Math.abs(h.clientY-P.startClientY)<T||(Me(h),!P.isDragging)))return;ve(h.clientY);const ie=h.clientY-P.startClientY,Je=P.startScroll-ie;he.current(Je),h.cancelable&&h.preventDefault()},fe=()=>{const h=ne.current;return h.pointerId!==null||!h.shouldCancelNextClick?!1:(Q(),h.clickResetTimer=window.setTimeout(()=>{const P=ne.current;P.shouldCancelNextClick=!1,P.clickResetTimer=null},0),!0)},Pe=h=>{const P=ne.current;if(P.pointerId!==h.pointerId){fe();return}P.isDragging&&P.shouldCancelNextClick&&h.cancelable&&(h.preventDefault(),h.stopPropagation()),P.isDragging&&ve(h.clientY);let ie=0;if(P.isDragging&&P.velocitySamples.length>=2){const ye=P.velocitySamples,Rt=lt.current.velocitySampleWindow,st=ye[ye.length-1],Oe=ye.find(mt=>st.time-mt.time<=Rt)??ye[0];if(st&&Oe&&st.time!==Oe.time){const mt=st.clientY-Oe.clientY,St=st.time-Oe.time;ie=-(mt/St)}}Q(),P.shouldCancelNextClick&&(P.clickResetTimer=window.setTimeout(()=>{const ye=ne.current;ye.shouldCancelNextClick=!1,ye.clickResetTimer=null},0));const Je=lt.current.startVelocityThreshold;B(),m.hasPointerCapture(h.pointerId)&&m.releasePointerCapture(h.pointerId),Math.abs(ie)>=Je&&$e.current?.(ie)},Ze=h=>{if(ne.current.pointerId!==null){if(!h.isPrimary||h.pointerType!==ne.current.pointerType)return;Re(ne.current.pointerId)}if(ne.current.shouldCancelNextClick&&(Q(),ne.current.shouldCancelNextClick=!1),!(C.current&&Ue.current)||!$t(h.pointerType,tt.current)||h.button!==0&&h.pointerType==="mouse"||h.ctrlKey||h.metaKey||h.altKey||J(h.target))return;window.dispatchEvent(new CustomEvent(Kt,{detail:{paneId:E}})),K.current?.();const P=ne.current;Q(),P.pointerId=h.pointerId,P.pointerType=h.pointerType,P.startClientY=h.clientY,P.startScroll=z.current,P.isDragging=!1,P.shouldCancelNextClick=!1,P.velocitySamples=[]},ze=h=>{if(ne.current.pointerId!==h.pointerId){fe();return}X(h)&&Re(h.pointerId)},we=[["click",ge,!0],["pointerdown",Ze,{passive:!1}],["lostpointercapture",h=>{h.target!==m||ne.current.pointerId!==h.pointerId||Re(h.pointerId)},void 0]],Qe=[["pointermove",ke,{passive:!1}],["pointerup",Pe,void 0],["pointercancel",ze,void 0]];return Ot(m,we,"add"),Ot(window,Qe,"add"),()=>{Ot(m,we,"remove"),Ot(window,Qe,"remove");const h=ne.current;h.pointerId!==null&&m.hasPointerCapture(h.pointerId)&&m.releasePointerCapture(h.pointerId),Q(),B()}},[E]);const Ve=t.useCallback(m=>(Se(),Ce(m)),[Ce,Se]);return q.jsxs("div",{ref:v,"data-testid":N,"data-self-measured":ue?"true":void 0,className:Mt.twMerge("aqvs-scroll-pane",I),style:g,children:[q.jsxs("div",{ref:W,className:Mt.twMerge("aqvs-scroll-pane-content"),"data-testid":"aqvs-scroll-pane-content",style:{height:ue?void 0:k,paddingTop:je.top,paddingBottom:je.bottom,...p&&Te&&b.some(m=>m==="touch"||m==="pen")?{touchAction:"none"}:{}},...U,id:dt,children:[A,n(z.current)]}),q.jsx(gr,{contentSize:e,viewportSize:k,scrollPosition:z.current,onScroll:Ve,enableThumbDrag:o,enableTrackClick:c,enableArrowButtons:d,scrollBarWidth:i,ariaControls:dt,tapScrollCircleOptions:$,itemCount:ae,renderThumbOverlay:le,visibleStartIndex:F,visibleEndIndex:w},"scrollbar"),G?.()]})}),cr=(n,e,r)=>Math.min(Math.max(n,e),r),$r=({dragState:n,normalizedDistance:e,sizeScale:r,size:s})=>{const i=Math.max(s/2,1),o=1+e*.65,c=Math.max(.65,1-e*.25),d=n.direction*e*26*r,p=.8+e*.18,b=3*r,S=6*r,I=22*r,N=Math.abs(d)+S,g=d>0?b:-Math.abs(d)-b,A=Math.max(2.5,3*r),$=cr(n.offsetX,-i,i),V=cr(n.offsetY,-i,i),ae=i*.35,le=$/i*ae,re=V/i*ae,se=le*.45,ce=re*.45,R=Math.max(I*.38,6),F=.65+e*.2,w=n.active;return q.jsxs(q.Fragment,{children:[q.jsx("div",{className:"aqvs-tap-scroll-circle-gradient",style:{transform:`scale(${c}, ${o})`,transition:w?"40ms transform ease-out":"200ms ease transform"}}),q.jsx("div",{className:"aqvs-sample-visual-pupil",style:{width:I,height:I,transform:`translate(calc(-50% + ${le}px), calc(-50% + ${re}px)) scale(${c}, ${p*o})`,transition:w?"70ms transform ease-out":"200ms ease transform"}}),q.jsx("div",{className:"aqvs-sample-visual-highlight",style:{width:R,height:R,transform:`translate(calc(-50% + ${se}px), calc(-50% + ${ce}px)) scale(${c}, ${o})`,opacity:F,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:w?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),q.jsx("div",{className:"aqvs-sample-visual-rod",style:{width:A,height:N,transform:`translate(-50%, ${g}px)`,opacity:e,transition:w?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},_t=100,Ur=n=>{if(!Number.isFinite(n))return 0n;const e=Math.trunc(n);return e<=0?0n:BigInt(e)},Ut=(n,e)=>{if(!Number.isFinite(n))throw new Error(`valueFn returned a non-finite value at index ${e}: ${n}`);return n},Tt=n=>{if(n<=0||!Number.isFinite(n))return 0;const e=Math.trunc(n);if(e<=2147483647)return e&-e;const r=BigInt(e)&-BigInt(e);return Number(r)};class ft{tree;deltas;size;baseValue;valueFn;total;constructor(e,r,s){this.reset(e,r,s)}reset(e,r,s){const i=Number.isFinite(e)&&e>0?Math.trunc(e):0;if(typeof r!="function"){this.size=i,this.tree=new Map,this.deltas=new Map,this.valueFn=void 0,this.baseValue=r,this.total=this.baseValue*this.size;return}let o=0,c;if(i>0){const d=s?.sampleRange??{from:0,to:Math.min(_t-1,i-1)};let p=Math.max(0,Math.trunc(d.from)),b=Math.min(Math.trunc(d.to),i-1);if(p>b&&(p=0,b=Math.min(_t-1,i-1)),i>_t)o=ft._sampleBaseValueStrided(r,i,_t),s?.materialize&&(c={from:p,values:ft._collectValidatedValues(r,p,b)});else{const S=ft._collectValidatedValues(r,p,b);o=ft._modeOrMedian([...S]),s?.materialize&&(c={from:p,values:S})}}if(this.size=i,this.tree=new Map,this.deltas=new Map,this.total=void 0,this.valueFn=r,this.baseValue=o,c)for(let d=0;d<c.values.length;d++){const p=c.from+d;if(p>=this.size)break;const b=c.values[d]-this.baseValue;b!==0&&(this.deltas.set(p,b),this._updateTree(p,b))}this.total=this.getTotal()}setValueFn(e,r){if(r?.reset){this.reset(this.size,e);return}typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e,this.total=this._computeTreeTotal())}static _collectValidatedValues(e,r,s){const i=[];for(let o=r;o<=s;o++)i.push(Ut(e(o),o));return i}static _modeOrMedian(e){if(e.length===0)return 0;e.sort((c,d)=>c-d);const r=Math.floor(e.length/2);let s;e.length%2===0?s=Math.floor((e[r-1]+e[r])/2):s=e[r];const i=new Map;let o=0;for(const c of e){const d=(i.get(c)??0)+1;i.set(c,d),d>o&&(o=d)}if(o>e.length*.2){const c=[];for(const[p,b]of i.entries())b===o&&c.push(p);const d=c.reduce((p,b)=>p+b,0);s=Math.floor(d/c.length)}return s}static _sampleBaseValueStrided(e,r,s){if(r<=0)return 0;let i=Math.max(1,Math.ceil(r/s));i%2===0&&(i+=1);const o=[];for(let c=0;c<r&&o.length<s;c+=i)o.push(Ut(e(c),c));return ft._modeOrMedian(o)}update(e,r){return this.updates([{index:e,value:r}])}updates(e){const r=this._buildDeltaUpdates(e);return r.length>0?this.updateDeltas(r):this.total}updateDelta(e,r){return this.updateDeltas([{index:e,change:r}])}updateDeltas(e){const r=new Map;for(const{index:s,change:i}of e){if(s<0||s>=this.size)throw new Error(`Index ${s} out of bounds`);if(!Number.isInteger(s))throw new Error(`Index must be an integer: ${s}`);if(!Number.isFinite(i))throw new Error(`Change must be a finite number: ${i}`);const c=(r.get(s)??this.deltas.get(s)??0)+i;if(c+this.baseValue<-1e-9)throw new Error(`Change would make the value at index ${s} negative: ${c+this.baseValue}`);r.set(s,c)}for(const{index:s,change:i}of e){const c=(this.deltas.get(s)??0)+i;c===0?this.deltas.delete(s):this.deltas.set(s,c),this._updateTree(s,i)}return this.total}_updateTree(e,r){if(r===0)return;let s=e+1;for(;s<=this.size;){this.tree.set(s,(this.tree.get(s)??0)+r);const i=Tt(s);if(i===0)break;s+=i}this.total!==void 0&&(this.total+=r)}_buildDeltaUpdates(e){const r=[],s=new Map;for(const{index:i,value:o}of e){if(i<0||i>=this.size)throw new Error(`Index ${i} out of bounds`);if(!Number.isInteger(i))throw new Error(`Index must be an integer: ${i}`);if(!Number.isFinite(o))throw new Error(`Value must be a finite number: ${o}`);if(o<0)throw new Error("Value cannot be negative.");const c=s.has(i)?s.get(i)??0:this.deltas.get(i)??0,d=c+this.baseValue,p=o-d;p!==0&&r.push({index:i,change:p}),s.set(i,c+p)}return r}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,r=this.size;for(;r>0;){e+=this.tree.get(r)??0;const s=Tt(r);if(s===0)break;r-=s}return e+this.baseValue*this.size}_materialize(e,r=!0){if(this.valueFn){const s=this.deltas.get(e)??0,o=Ut(this.valueFn(e),e)-this.baseValue;if(o!==s&&(o===0?this.deltas.delete(e):this.deltas.set(e,o),r)){const c=o-s;this._updateTree(e,c)}}}_materializeRanges(e,r,s=!1){if(!(e?.materialize&&this.valueFn))return;const i=e.ranges;if(i&&i.length>0){for(const d of i){const p=Math.max(0,Math.trunc(d.from)),b=Math.min(Math.trunc(d.to),this.size-1);for(let S=p;S<=b;S++)this._materialize(S)}if(r===void 0)return;if(s){this._materialize(r);return}const o=i[0].from,c=i[i.length-1].to;r>=o&&r<=c&&this._materialize(r);return}r!==void 0&&this._materialize(r)}_findIndex(e,r={},s){if(this.size>=1073741824)return this._findIndexLarge(e,r,s);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(r.materializeOption);const i=r.materializeOption?.materialize===!0;let o;for(;;){if(o=this._descend(e,s),o<0||o>=this.size)return{index:-1,total:this.total??this.getTotal(),cumulative:void 0,currentValue:void 0,safeIndex:void 0};if(!i)break;const d=this.deltas.get(o)??0;if(this._materialize(o),(this.deltas.get(o)??0)===d)break}const c=this.prefixSum(o);return{index:o,total:this.total??c.total,cumulative:c.cumulative,currentValue:c.currentValue,safeIndex:c.safeIndex}}_descend(e,r){let s=0,i=0,o=1;for(;o<<1<=this.size;)o<<=1;for(;o>0;o>>=1){const c=s+o;if(c<=this.size){const p=(this.tree.get(c)??0)+this.baseValue*o;(r?i+p<e:i+p<=e)&&(s=c,i+=p)}}return r?s:s-1}_findIndexLarge(e,r,s){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const i=Ur(this.size);if(i===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(r.materializeOption);const o=r.materializeOption?.materialize===!0;for(;;){let c=0n,d=i-1n,p,b,S=this.total;for(;c<=d;){const g=c+d>>1n,A=Number(g),$=this.prefixSum(A);if(S=$.total,s?$.cumulative>=e:$.cumulative<=e)if(p=g,b=$,s){if(g===0n)break;d=g-1n}else c=g+1n;else if(s)c=g+1n;else{if(g===0n)break;d=g-1n}}const I=b,N=p!==void 0?Number(p):-1;if(o&&N>=0){const g=this.deltas.get(N)??0;if(this._materialize(N),(this.deltas.get(N)??0)!==g)continue}return{index:N,total:S,cumulative:I?.cumulative,currentValue:I?.currentValue,safeIndex:I?.safeIndex}}}prefixSum(e,r){if(e<0||Number.isNaN(e))return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};if(this.size===0)return{cumulative:0,total:this.total??0,currentValue:0,safeIndex:0};const s=te(Math.trunc(e),0,this.size-1),i=r?.materializeOption;this._materializeRanges(i,s,!0);let o=0,c=s+1;for(;c>0;){const p=this.tree.get(c)??0;o+=p;const b=Tt(c);if(b===0)break;c-=b}const d=i?.materialize?this.get(s):(this.deltas.get(s)||0)+this.baseValue;return{cumulative:o+this.baseValue*(s+1),total:this.total,currentValue:d,safeIndex:s}}get(e,r){if(this.size===0)return 0;if(!Number.isInteger(e)||e<0||e>=this.size)throw new Error("Index out of bounds");const s=r?.materializeOption;return this._materializeRanges(s,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const r=e?.materializeOption;if(this._materializeRanges(r),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const s=this.prefixSum(this.getSize()-1);s.cumulative!==s.total&&M.error("Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const s=this.valueFn;this.reset(this.size,i=>s(i),{materialize:!0});return}const r=new Map;for(const[s,i]of this.deltas.entries()){if(i===0)continue;let o=s+1;for(;o<=this.size;){r.set(o,(r.get(o)??0)+i);const c=Tt(o);if(c===0)break;o+=c}}this.tree=r,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const[r,s]of this.deltas)r<this.size&&(e+=s);return this.total-e}changeSize(e){if(!Number.isFinite(e))throw new Error(`Size must be a finite number: ${e}`);const r=Math.max(0,Math.trunc(e)),s=this.size;if(r===s)return;if(r>s)if(s===0&&this.deltas.size>0){for(const o of this.deltas.keys())o>=r&&this.deltas.delete(o);this.size=r,this.rebuildTree()}else this._growSize(s,r);else{if(r>0)for(const o of this.deltas.keys())o>=r&&this.deltas.delete(o);this.size=r,this.rebuildTree()}const i=this.prefixSum(this.getSize()-1);i.cumulative!==i.total&&M.error("Inconsistent Fenwick Tree state")}static _minCoveredLowBound(e,r){let s=1;for(;;){const i=s*2;if(Math.floor(r/i)*i<=e)break;s=i}return s*Math.floor(e/s)}_propagateDeltaToGrownNodes(e,r,s,i){let o=e+1;for(;o<=s;){const c=Tt(o);if(c===0)break;o+=c}for(;o<=i;){this.tree.set(o,(this.tree.get(o)??0)+r);const c=Tt(o);if(c===0)break;o+=c}}_growSize(e,r){if(this.size=r,this.deltas.size>0){const s=ft._minCoveredLowBound(e,r);if(e-s<this.deltas.size)for(let o=s;o<e;o++){const c=this.deltas.get(o);c===void 0||c===0||this._propagateDeltaToGrownNodes(o,c,e,r)}else for(const[o,c]of this.deltas.entries())c===0||o<s||this._propagateDeltaToGrownNodes(o,c,e,r)}this.total=this._computeTreeTotal()}getSize(){return this.size}get base(){return this.baseValue}findIndexAtOrAfter(e,r){return this._findIndex(e,r??{},!0)}findIndexAtOrBefore(e,r){return this._findIndex(e,r??{},!1)}}const Wr=(n,e)=>{const r=n?.sampleRange,s=e?.sampleRange;return r===s?!1:r&&s?r.from!==s.from||r.to!==s.to:!0},Sr=(n,e,r)=>{const s=Number.isFinite(n)&&n>0?Math.trunc(n):0,i=t.useRef(null),o=t.useRef({size:s,valueOrFn:e,options:r});i.current===null&&(i.current=new ft(s,e,r));const c=i.current,d=o.current,p=d.size!==s,b=d.valueOrFn!==e,S=Wr(d.options,r),I=d.size===0&&s>0&&(!i.current||i.current.base===0);if(b||S){const N=r?.resetOnValueFnChange??!0;S||b&&N||I?(r?.debug&&M.debug("[useFenwickMapTree] reset",{valueOrFnChanged:b,optionsChanged:S}),c.reset(s,e,r)):(p&&(r?.debug&&M.debug("[useFenwickMapTree] resize (with valueFn change)",{from:d.size,to:s}),c.changeSize(s)),r?.debug&&M.debug("[useFenwickMapTree] setValueFn (no reset)",{valueOrFnChanged:b}),c.setValueFn(e,{reset:!1})),o.current={size:s,valueOrFn:e,options:r}}else p&&(r?.debug&&M.debug("[useFenwickMapTree] resize",{from:d.size,to:s}),I?c.reset(s,e,r):c.changeSize(s),o.current={size:s,valueOrFn:e,options:r});return c};class Kr{key;value;prev=null;next=null;constructor(e,r){this.key=e,this.value=r}}class Wt{head=null;tail=null;addToTail(e){this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=null,e.next=null}removeHead(){const e=this.head;return e&&this.remove(e),e}moveToTail(e){this.remove(e),this.addToTail(e)}}function vr(n){const e=t.useRef(new Map),r=t.useRef(new Wt),s=Math.floor(n),i=t.useRef(s);t.useEffect(()=>{if(i.current=s,Number.isNaN(s)||s<0){M.warn(`useLruCache: invalid capacity ${n}; the cache will not store any entries.`),e.current.clear(),r.current=new Wt;return}if(Number.isFinite(s))for(;e.current.size>s;){const S=r.current.removeHead();if(S)e.current.delete(S.key);else break}},[n,s]);const o=t.useCallback(S=>{const I=e.current.get(S);if(I)return r.current.moveToTail(I),I.value},[]),c=t.useCallback((S,I)=>{const N=i.current;if(Number.isNaN(N)||N<=0)return;let g=e.current.get(S);if(g)g.value=I,r.current.moveToTail(g);else{if(e.current.size>=N){const A=r.current.removeHead();A&&e.current.delete(A.key)}g=new Kr(S,I),e.current.set(S,g),r.current.addToTail(g)}},[]),d=t.useCallback(S=>e.current.has(S),[]),p=t.useCallback(S=>{const I=e.current.get(S);I&&(r.current.remove(I),e.current.delete(S))},[]),b=t.useCallback(()=>{e.current.clear(),r.current=new Wt},[]);return t.useMemo(()=>({get:o,set:c,has:d,remove:p,clear:b}),[o,c,d,p,b])}const Gr=1e4,Zr=()=>{const{get:n,set:e,has:r,clear:s}=vr(Gr);return t.useMemo(()=>({get:n,set:e,has:r,clear:s}),[n,e,r,s])},Qr=(n,e)=>{const r=t.useRef(e),s=t.useRef(n);t.useLayoutEffect(()=>{r.current=e,s.current=n},[e,n]);const i=t.useRef(new WeakMap);return t.useCallback(o=>{if(!o||i.current.has(o))return;const c=d=>{r.current?.enableBridge!==!1&&s.current.current?.applyWheel(d)};return o.addEventListener("wheel",c,{passive:!1}),i.current.set(o,c),()=>{i.current.get(o)===c&&(o.removeEventListener("wheel",c),i.current.delete(o))}},[])},xe=(n,e)=>e<=0?0:te(n,0,e-1),ur=n=>({top:Math.max(0,n?.top??0),bottom:Math.max(0,n?.bottom??0)}),Ke=(n,e)=>n<=e?0:n-e,xt=(n,e)=>n<=0?0:n+e,Ft=1e3,fr=2e3,Jr=1048576,en=40,Vt=n=>{if(!Number.isFinite(n))return 0n;const e=Math.trunc(n);return e<=0?0n:BigInt(e)},tn=(n,e,r,s,i,o,c,d)=>{const p=Vt(s);if(p===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const b=R=>R<0n?0n:R>=p?p-1n:R,S={materializeOption:{materialize:!1}},{index:I,cumulative:N}=o.findIndexAtOrAfter(n,S);let g;I===-1?g=p-1n:(N===n?g=Vt(I+1):g=Vt(I),g>=p&&(g=p-1n)),n<=0&&(g=0n),d&&n>=c&&(g=p-1n);const A=R=>{const F=Number(R);if(!Number.isSafeInteger(F))return null;const{cumulative:w}=o.prefixSum(F,{materializeOption:{materialize:!1}});if(!Number.isFinite(w))return null;const{index:G}=o.findIndexAtOrAfter(w+.5,{materializeOption:{materialize:!1}});if(G===-1)return null;const Z=Vt(G);return Z>R?Z:null},$=R=>{let F=0,w=R,G=R,Z=0n,U=0;for(;w<p&&F<e;){const me=Number(w),z=i(me);if(F+=z,G=w,w+=1n,Z+=1n,!Number.isFinite(z)||z<0)break;if(z===0){if(U+=1,U>Ft){const v=A(G);if(v!==null&&v>w)w=v,U=0;else if(v!==null&&v===w&&i(Number(w))>0)U=0;else break}}else U=0}return Z===0n&&(G=R),{height:F,end:G}};let{height:V,end:ae}=$(g);if(V<e&&g>0n){let R=g,F=V,w=0;for(;R>0n&&F<e;){R-=1n;const Z=Number(R),U=i(Z);if(F+=U,!Number.isFinite(U)||U<0)break;if(U===0){if(w+=1,w>Ft){const me=Number(R);if(!Number.isSafeInteger(me))break;const{cumulative:z}=o.prefixSum(me,{materializeOption:{materialize:!1}});if(!Number.isFinite(z))break;const{index:v}=o.findIndexAtOrAfter(z-.5,{materializeOption:{materialize:!1}}),W=v===-1?-1n:Vt(v);if(W>=0n&&W<R)R=W+1n,w=0;else if(W===R&&R>=1n&&i(Number(R-1n))>0)w=0;else break}}else w=0}g=b(R);const G=$(g);V=G.height,ae=G.end}const le=b(g),re=b(ae),se=b(le-BigInt(Math.max(0,r))),ce=b(re+BigInt(Math.max(0,r)));return{renderingStartIndex:xe(Number(se),s),renderingEndIndex:xe(Number(ce),s),visibleStartIndex:xe(Number(le),s),visibleEndIndex:xe(Number(re),s)}},rn=(n,e,r,s,i,o,c)=>{if(s===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const d=Number.isFinite(c),p=d?Math.min(Math.max(0,n),c):Math.max(0,n);if(s>=Number.MAX_SAFE_INTEGER)return tn(p,e,r,s,i,o,c,d);const{index:b,cumulative:S,currentValue:I}=o.findIndexAtOrAfter(p,{materializeOption:{materialize:!1}}),N=b===-1?e<=0||(S??0)<p+(I??0)?s-1:0:b;let g=xe(N,s),A=0;if(b!==-1&&S===p)g=xe(b+1,s),A=0;else if(g===b&&S!==void 0&&I!==void 0)A=S-I-p;else{const{cumulative:R,currentValue:F}=o.prefixSum(g,{materializeOption:{materialize:!1}});A=(R??0)-(F??0)-p}const $=A,V=(R,F)=>{let w=R,G=F,Z=0;for(;w<s&&G<e;){const U=i(w);if(G+=U,w++,!Number.isFinite(U)||U<0)break;if(U===0){if(Z++,Z>Ft){const{cumulative:me}=o.prefixSum(w-1,{materializeOption:{materialize:!1}}),{index:z}=Number.isFinite(me)?o.findIndexAtOrAfter(me+.5,{materializeOption:{materialize:!1}}):{index:-1};if(z>w)w=z,Z=0;else if(z===w&&i(w)>0)Z=0;else break}}else Z=0}return{cursor:w,height:G}},ae=V(g,A);let le=ae.cursor;if(A=ae.height,A<e&&g>0){let R=A+Math.abs(Math.min(0,$)),F=g-1,w=0;for(;F>=0&&R<e;){const Z=i(F);if(R+=Z,!Number.isFinite(Z)||Z<0){F--;break}if(Z===0){if(w++,w>Ft){const{cumulative:U}=o.prefixSum(F,{materializeOption:{materialize:!1}}),{index:me}=Number.isFinite(U)?o.findIndexAtOrAfter(U-.5,{materializeOption:{materialize:!1}}):{index:-1};if(me!==-1&&me<F){F=me,w=0;continue}if(me===F&&F>=1&&i(F-1)>0)w=0;else{F--;break}}}else w=0;F--}g=xe(F+1,s);const G=V(g,0);le=G.cursor,A=G.height}const re=xe(g-r,s),se=xe(Math.max(le-1,g),s),ce=xe(se+r,s);return{renderingStartIndex:re,renderingEndIndex:ce,visibleStartIndex:g,visibleEndIndex:se}},dr=(n,e,r)=>{const s=Math.max(0,e??0),i=t.useRef({last:0,id:null,arg:null}).current;return t.useEffect(()=>()=>{if(i.id!==null&&(cancelAnimationFrame(i.id),i.id=null),i.arg!==null&&n.current){try{r(n.current,i.arg)}catch(o){console.error("[useThrottledInvoker] Error flushing pending callback on unmount",o)}i.arg=null}},[i,n,r]),t.useCallback(o=>{if(i.arg=o,i.id!==null)return;const c=d=>{if(i.id=null,i.arg===null)return;const p=d-i.last;if(s===0||i.last===0||p>=s){if(n.current)try{r(n.current,i.arg)}catch(b){console.error("[useThrottledInvoker] Error invoking callback",b)}i.arg=null,i.last=d}i.arg!==null&&(i.id=requestAnimationFrame(c))};i.id=requestAnimationFrame(c)},[s,r,n,i])},nn=t.memo(({index:n,top:e,height:r,item:s,children:i,clipItemHeight:o,enableKeyboardNavigation:c,onKeyDown:d,onEscapeKeyDown:p,onFocus:b,registerItemRef:S})=>{const I=t.useCallback(V=>S(n,V),[n,S]),N=t.useCallback(V=>d(V,n),[n,d]),g=t.useCallback(V=>p?.(V,n),[n,p]),A=t.useCallback(()=>b(n),[n,b]),$=t.useCallback(V=>{V.currentTarget.focus({preventScroll:!0})},[]);return q.jsx("div",{ref:I,"data-index":n,"data-virtualscroll-item":"true",className:"aqvs-item-container",style:{top:e,height:r,overflow:o?"hidden":void 0},tabIndex:c?-1:void 0,onPointerDown:c?$:void 0,onKeyDownCapture:c?N:void 0,onKeyDown:c&&p?g:void 0,onFocusCapture:c?A:void 0,children:i(s,n)})}),sn=({itemCount:n,getItem:e,getItemKey:r,getItemHeight:s,viewportSize:i,overscanCount:o=15,className:c,testId:d,onScroll:p,onRangeChange:b,children:S,background:I,initialScrollIndex:N,initialScrollOffset:g,initialScrollAnchor:A,callbackThrottleMs:$=5,contentInsets:V,onItemFocus:ae,scrollBarOptions:le,behaviorOptions:re,onWheelHorizontal:se,horizontalKeyInputs:ce,horizontalKeyStep:R=en,contentProps:F,liveRegion:w},G)=>{const{width:Z,enableThumbDrag:U,enableTrackClick:me,enableArrowButtons:z,enableScrollToTopBottomButtons:v,renderThumbOverlay:W,tapScrollCircleOptions:ue}=le??{},{enablePointerDrag:He,pointerDragInputs:qe,enableKeyboardNavigation:k=!0,enableEscapeRowReturn:Ae=!1,wheelSpeedMultiplier:Xe,inertiaOptions:Ee,overscrollBehavior:Le,clipItemHeight:je=!1,resetOnGetItemHeightChange:Ne=!1}=re??{},[Te,Ce]=t.useState(0),he=i??Te,Se=t.useCallback(a=>{Ce(u=>u===a?u:a)},[]),K=t.useRef(null),Ge=t.useRef({renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0,scrollPosition:0,totalHeight:0}),$e=t.useRef(A&&n>0?{index:te(Math.trunc(A.index),0,n-1),align:"top",offset:-Math.max(0,A.offsetPx??0)}:null),at=t.useRef(!1),et=t.useRef(!0);t.useEffect(()=>{if(et.current){et.current=!1;return}Ne&&($e.current=null)},[Ne,s]);const E=t.useMemo(()=>ur(V),[V]),[dt]=t.useState(()=>{const u=A?.index??N,f=typeof u=="number"&&Number.isFinite(u)?Math.max(0,Math.trunc(u)):0;return{from:Math.max(0,f-50),to:f+50}}),ne=t.useMemo(()=>({sampleRange:dt,resetOnValueFnChange:Ne,materialize:!0}),[Ne,dt]),C=Sr(n,s,ne),[tt]=t.useState(()=>{let a=0,u=0;if(A&&n>0){const f=te(Math.trunc(A.index),0,n-1),L=Math.max(0,A.offsetPx??0),O=te(f-o*2,0,n-1),_=te(f+o*2,0,n-1),Y=f>0||L>0?{materializeOption:{materialize:!0,ranges:[{from:O,to:_}]}}:void 0,{cumulative:ee,total:Ie,currentValue:de}=C.prefixSum(f,Y),oe=Math.max(ee-de+L,0);a=xt(oe,E.top),u=Ie??C.getTotal()}else if(typeof N=="number"){const f=te(N,0,n-1),L=te(f-o*2,0,n-1),O=te(f+o*2,0,n-1),_=N>0?{materializeOption:{materialize:!0,ranges:[{from:L,to:O}]}}:void 0,{cumulative:Y,total:ee,currentValue:Ie}=C.prefixSum(N,_),de=Math.max(Y-Ie,0);a=xt(de,E.top),u=ee??C.getTotal()}else typeof g=="number"&&(a=xt(Math.max(g,0),E.top)),u=C.getTotal();return{position:a,total:u}}),[Ue,lt]=t.useState(tt.position),[Ve,m]=t.useState(tt.total),T=t.useRef(tt.position),H=t.useRef(E.top),B=t.useRef(p??void 0),Q=t.useRef(b??void 0),ve=t.useRef(se),J=(ce?.length??0)>0,ge=!!se;t.useEffect(()=>{J&&(k||M.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."),ge||M.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."),Number.isFinite(R)&&R>0||M.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${R}. Horizontal arrow keys are left untouched.`))},[J,ge,k,R]);const Me=t.useRef(new Map),X=t.useRef(null),Re=t.useRef(null),[ke,fe]=t.useState(null),[Pe,Ze]=t.useState(!1),ze=t.useRef(null),rt=t.useRef(!1),we=t.useRef(0),Qe=t.useRef(!1),h=t.useRef(!1),P=t.useRef(n);P.current!==n&&(P.current=n,h.current=!0),t.useLayoutEffect(()=>{B.current=p??void 0,Q.current=b??void 0,ve.current=se},[b,p,se]);const ie=t.useCallback(a=>{if(k&&a&&typeof a.focus=="function")try{a.focus({preventScroll:!0})}catch{a.focus()}},[k]),Je=t.useCallback((a,{position:u,totalHeight:f})=>{a(u,f)},[]),ye=dr(B,$,Je),Rt=t.useCallback((a,u)=>{a(u)},[]),st=dr(Q,$,Rt),Oe=t.useRef(E.top);Oe.current=E.top;const mt=t.useRef(ye);mt.current=ye,t.useEffect(()=>(at.current=!1,()=>{at.current=!0,ze.current&&(clearTimeout(ze.current),ze.current=null)}),[]),t.useEffect(()=>{k||(Me.current.clear(),X.current=null,Re.current=null)},[k]);const St=t.useCallback((a,u)=>{if(!u){Me.current.delete(a);return}k&&(Me.current.set(a,u),X.current===a&&(X.current=null,Re.current=a,ie(u)))},[k,ie]),zt=.01,it=t.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:tt.position}),vt=t.useCallback(()=>{const a=it.current;a.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.rafId),a.rafId=null,a.loopActive=!1,a.idleFrames=0},[]);t.useEffect(()=>()=>{vt()},[vt]);const Dt=t.useRef(()=>{}),Pt=t.useCallback(()=>{const a=it.current;a.rafId=null;const u=T.current,f=Ke(u,Oe.current),L=C.getTotal();if(lt(_=>Math.abs(_-u)<zt?_:u),Math.abs(a.lastRenderedPosition-u)>=zt?(mt.current({position:f,totalHeight:L}),a.lastRenderedPosition=u,a.idleFrames=0):a.idleFrames+=1,a.idleFrames>=2){vt();return}if(typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(_=>Dt.current(_));return}a.loopActive=!1},[C,vt]);Dt.current=Pt;const At=t.useCallback(()=>{const a=it.current;if(a.idleFrames=0,!a.loopActive){if(a.loopActive=!0,typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(Pt);return}a.loopActive=!1}},[Pt]),pe=t.useCallback((a,u)=>{const f=u?.immediate??!1,L=Ke(a,E.top);if(T.current=a,f){it.current.lastRenderedPosition=a,it.current.idleFrames=0,lt(a),ye({position:L,totalHeight:C.getTotal()});return}At()},[At,C,E.top,ye]),pt=t.useCallback((a,u=0)=>{const f=K.current;if(!f)return a;const L=f.getScrollPosition();we.current+=1;const O=f.getContentSize()+u,_=f.getViewportSize(),Y=f.scrollTo(a,{contentSize:O,viewportSize:_});return Y===L&&(we.current=Math.max(0,we.current-1)),Math.abs(Y-a)>.5&&(Qe.current=!0),Y},[]),yt=t.useRef(!1);t.useEffect(()=>{if(!yt.current)if(yt.current=!0,A==null&&typeof N!="number"&&typeof g=="number"){const a=xt(Math.max(g,0),E.top),u=Math.abs(a-T.current)>.5;pe(a,{immediate:!0}),u&&K.current?.scrollTo(a)}else pe(T.current,{immediate:!0})},[A,N,g,E.top,pe]),t.useEffect(()=>{const a=C.getTotal();if(Ve!==a){m(a);return}if(Qe.current){Qe.current=!1;const u=K.current;if(u&&Math.abs(u.getScrollPosition()-T.current)>.5){const f=pt(T.current);Qe.current=!1,pe(f,{immediate:!0})}}},[C,Ve,n,pt,pe]),t.useEffect(()=>{if($e.current!==null){const{index:a,align:u,offset:f}=$e.current,L=xe(a,n),{cumulative:O,currentValue:_}=C.prefixSum(L,{materializeOption:{materialize:!1}});if(O!==void 0&&_!==void 0){const Y=Math.max(O-_,0);let ee=Y;u==="bottom"?ee=O-he:u==="center"&&(ee=Y+_/2-he/2),f&&(ee-=f),ee=Math.max(0,ee);const Ie=Math.max(0,Ve+E.top+E.bottom-he),de=Math.min(xt(ee,E.top),Ie);Math.abs(de-T.current)>1&&(M.debug("[VirtualScroll] Drift correction",{from:T.current,to:de,targetIndex:L}),we.current===0&&(we.current+=1),K.current?.scrollTo(de),pe(de,{immediate:!0}))}}h.current=!1},[Ve,C,n,E.top,pe,he,E.bottom]),t.useEffect(()=>{const a=H.current;if(a===E.top||(H.current=E.top,$e.current))return;const u=Ke(T.current,a),f=xt(u,E.top);T.current=f,K.current?.scrollTo(f),pe(f,{immediate:!0})},[E.top,pe]);const Et=t.useCallback((a,u)=>{if(n===0)return;const f=xe(a,n),L=C.get(f),O=u-L,_=C.update(f,u);_!==void 0&&m(_),M.debug("[VirtualScroll] Updated item size manually",{index:f,size:u,total:_});let Y=$e.current?$e.current.index:null;if(Y===null){const ee=T.current,Ie=ur(V).top,de=Ke(ee,Ie),{index:oe,cumulative:Ye}=C.findIndexAtOrAfter(de,{materializeOption:{materialize:!1}});Y=Ye!==void 0&&Ye===de?oe+1:oe}if(Y!==-1&&f<Y&&O!==0){const ee=T.current,Ie=ee+O;pt(Ie,O),pe(Ie,{immediate:!0}),M.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)",{from:ee,to:Ie,causedByIndex:f,delta:O,activeVisibleStartIndex:Y})}},[C,n,pt,pe,V]),l=t.useCallback((a,u)=>{if(!K.current||n===0)return;const f=xe(a,n),L=xe(f-o*2,n),O=xe(f+o*2,n),{cumulative:_,total:Y,currentValue:ee}=C.prefixSum(f,{materializeOption:{materialize:!0,ranges:[{from:L,to:O}]}});if(M.debug("[VirtualScroll] Scrolling to index:",f,"ItemBottom:",_,"Total height:",Y,"ItemHeight:",ee,"safeIndexFrom:",L,"safeIndexTo:",O),!Y)return;const Ie=Math.max(_-ee,0);let de=Ie;u?.align==="bottom"?de=_-he:u?.align==="center"&&(de=Ie+ee/2-he/2),u?.offset&&(de-=u.offset),de=Math.max(0,de);const oe=xt(de,E.top),Ye=K.current?.getContentSize()??Y+E.top+E.bottom,De=Math.max(0,Ye-he),Be=Math.min(oe,De);$e.current={index:f,align:u?.align,offset:u?.offset};const kt=K.current?.getScrollPosition()??-1,qt=Math.abs(kt-Be)>.5;rt.current=!1,we.current=0,qt&&(rt.current=!0,we.current+=1,K.current?.scrollTo(Be)),m(Y),pe(Be,{immediate:!0}),M.debug("[VirtualScroll] Setting scroll position to:",Be,{original:oe,max:De})},[C,o,n,E.top,E.bottom,he,pe]),x=t.useRef(A&&n===0?A:null);t.useEffect(()=>{const a=x.current;!a||n===0||(x.current=null,l(te(Math.trunc(a.index),0,n-1),{align:"top",offset:-Math.max(0,a.offsetPx??0)}))},[n,l]);const y=t.useCallback(a=>{if(!K.current||n===0)return;const u=C.getTotal(),f=te(Math.floor(a),0,u),{index:L,cumulative:O,currentValue:_}=C.findIndexAtOrAfter(f,{materializeOption:{materialize:!1}}),ee=(O??0)-(_??0)-f;l(L,{offset:ee})},[C,n,l]),D=t.useCallback(()=>{if(n===0)return null;const a=Ke(T.current,E.top),{index:u,cumulative:f,currentValue:L}=C.findIndexAtOrAfter(a,{materializeOption:{materialize:!1}});if(u===-1)return{index:n-1,offsetPx:0};if(f===a)return{index:te(u+1,0,n-1),offsetPx:0};const O=(f??0)-(L??0);return{index:u,offsetPx:Math.max(0,a-O)}},[C,n,E.top]),j=t.useCallback(a=>{const u=Ke(T.current,E.top),f=typeof a=="function"?a(u):a;y(f);const L=K.current?.getScrollPosition(),O=typeof L=="number"?L:T.current;return pe(O),Ke(O,Oe.current)},[E.top,y,pe]),be=t.useCallback(a=>{const u=K.current;if(!u)return Ke(T.current,Oe.current);const f=u.scrollTo(L=>L+a);return Ke(f,Oe.current)},[]),_e=t.useCallback(a=>K.current?.applyWheel(a)??!1,[]),Fe=t.useCallback((a,u)=>{M.debug("[VirtualScroll] Scroll position changed:",a);const f=rt.current;f&&(rt.current=!1);const L=we.current>0;L&&(we.current=0);const O=h.current&&P.current===n;if(f||L||O||($e.current=null),pe(a),v){if(f||L)return;const _=a-u;if(M.debug("[VirtualScroll] Scroll diff:",_,"New:",a,"Prev:",u),Math.abs(_)>1){const Y=_>0?"down":"up";fe(Y),Ze(!0),M.debug("[VirtualScroll] Showing scroll buttons. Direction:",Y),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>{Ze(!1),M.debug("[VirtualScroll] Hiding scroll buttons")},2e3)}}},[pe,v,n]),nt=t.useMemo(()=>Ke(Ue,E.top),[E.top,Ue]),We=t.useMemo(()=>{const a=C.getTotal(),u=rn(nt,he,o,n,s,C,a);return M.debug("[VirtualScroll] Calculated rendering range:",()=>({...u,scrollPosition:nt,renderingContentSize:a,overscanCount:o,viewportSize:he})),u},[nt,he,o,n,s,C]),{renderingStartIndex:ct,renderingEndIndex:bt,visibleStartIndex:ht,visibleEndIndex:It}=We,ut=t.useCallback((a,u)=>{if(!k||n===0)return;const f=xe(a,n);if(!(u?.ensureVisible??!0)){const De=Me.current.get(f);De&&(X.current=null,Re.current=f,ie(De));return}const O=C.prefixSum(f,{materializeOption:{materialize:!1}}),_=O.currentValue,Y=Math.max(O.cumulative-_,0),ee=Y+_,Ie=Ke(T.current,E.top),de=Ie+he;if(Y<Ie||ee>de){l(f);const De=Me.current.get(f);De?(X.current=null,Re.current=f,ie(De)):X.current=f;return}const Ye=Me.current.get(f);if(Ye){X.current=null,Re.current=f,ie(Ye);return}X.current=f},[k,n,C,E.top,l,ie,he]),Zt=t.useCallback((a,u)=>{if(!(!k||a.defaultPrevented)&&!(a.altKey||a.metaKey||a.ctrlKey)&&a.target===a.currentTarget&&!a.currentTarget.isContentEditable){if(a.key==="ArrowLeft"||a.key==="ArrowRight"){const f=ve.current;if(!f||a.shiftKey||!ce?.includes("arrow")||!(Number.isFinite(R)&&R>0))return;a.preventDefault(),f(a.key==="ArrowLeft"?-R:R);return}if(a.key==="ArrowDown"){u<n-1&&(a.preventDefault(),ut(u+1));return}if(a.key==="ArrowUp"){u>0&&(a.preventDefault(),ut(u-1));return}if(a.key==="PageDown"){if(u<n-1){a.preventDefault();const{visibleStartIndex:f,visibleEndIndex:L}=Ge.current,O=Math.max(L-f+1,1),_=Math.max(O,1),Y=xe(Math.min(u+_,n-1),n);ut(Y)}return}if(a.key==="PageUp"&&u>0){a.preventDefault();const{visibleStartIndex:f,visibleEndIndex:L}=Ge.current,O=Math.max(L-f+1,1),_=Math.max(O,1),Y=xe(u-_,n);ut(Y)}}},[k,n,ut,ce,R]),Qt=t.useCallback((a,u)=>{if(a.key!=="Escape"||a.defaultPrevented||a.nativeEvent.isComposing||a.target===a.currentTarget)return;const f=a.target;f instanceof HTMLInputElement||f instanceof HTMLTextAreaElement||f instanceof HTMLSelectElement||f.isContentEditable||(a.preventDefault(),ut(u))},[ut]),Jt=t.useCallback(a=>{if(!k)return;const u=xe(a,n);X.current=null,Re.current=u,ae?.(u)},[k,n,ae]);t.useEffect(()=>{const a=K.current?.getScrollPosition()??0,u=T.current,f=Ke(u,E.top);M.debug("[VirtualScroll] Range change effect triggered",()=>({renderingStartIndex:ct,renderingEndIndex:bt,visibleStartIndex:ht,visibleEndIndex:It,scrollPositionState:Ue,paneScrollPosition:u,logicalScrollPosition:f,contentSize:Ve,scrollPaneScrollPosition:a})),st({renderingStartIndex:ct,renderingEndIndex:bt,visibleStartIndex:ht,visibleEndIndex:It,scrollPosition:f,totalHeight:Ve})},[Ve,bt,ct,E.top,st,Ue,It,ht]);const Ir=t.useCallback(()=>{if(!v)return null;const a=Pe&&ke!==null,u=ke==="up";return q.jsx("div",{className:"aqvs-scroll-to-edge-overlay","data-visible":a,inert:!a,children:u?q.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top",children:q.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",tabIndex:a?0:-1,onClick:f=>{f.stopPropagation(),rt.current=!0,l(0),Ze(!1)},children:"Top"})}):q.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom",children:q.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",tabIndex:a?0:-1,onClick:f=>{f.stopPropagation(),rt.current=!0,l(n-1),Ze(!1)},children:"Bottom"})})})},[v,Pe,ke,l,n]),Yt=t.useRef(0),{visibleItems:Bt,renderAnchor:Ht}=t.useMemo(()=>{if(n===0)return{visibleItems:q.jsx("div",{className:"aqvs-no-items-container",children:q.jsx("div",{className:"aqvs-no-items-text",children:"No items"})}),renderAnchor:0};const a=xe(ct,n),u=xe(bt,n),{cumulative:f,currentValue:L}=C.prefixSum(a,{materializeOption:{materialize:!1}}),O=f-L;Number.isFinite(O)&&Math.abs(O-Yt.current)>Jr&&(Yt.current=O);const _=Yt.current,Y=[],ee=[];let Ie=0,de=O;for(let oe=a;oe<=u;oe++){if(ee.length>=fr){M.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.",{cap:fr,safeRenderingStartIndex:a,safeRenderingEndIndex:u});break}const Ye=s(oe),De=C.get(oe),Be=Ye-De;Be!==0&&Y.push({index:oe,value:Ye});const kt=de+Ie,qt=r?r(oe):oe;ee.push(q.jsx(nn,{index:oe,top:kt-_,height:Ye,item:e(oe),clipItemHeight:je,enableKeyboardNavigation:k,onKeyDown:Zt,onEscapeKeyDown:Ae?Qt:void 0,onFocus:Jt,registerItemRef:St,children:S},qt)),Ie+=Be,de+=De}return Y.length>0&&Promise.resolve().then(()=>{if(at.current)return;let oe=0;for(const Be of Y)if(Be.index<ht){const kt=C.get(Be.index);oe+=Be.value-kt}const Ye=C.updates(Y);if(at.current||typeof Ye!="number")return;m(Ye),M.debug("[VirtualScroll] Updated heights for items",Y,"New total height:",Ye);const De=K.current?.getScrollPosition()??T.current;if(oe!==0){const Be=De+oe;pt(Be,oe),pe(Be,{immediate:!0}),M.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)",{from:De,to:Be,shiftAmount:oe})}else De!==T.current&&pe(De)}),{visibleItems:ee,renderAnchor:_}},[S,je,Ve,k,n,C,e,r,s,Jt,Zt,Ae,Qt,pt,St,bt,ct,pe,ht]),wr=t.useCallback(a=>{const u=($??0)>0,f=Math.abs(a-Ue),L=u&&f>.5?Ue:a,O=Ke(L,E.top);if(M.debug("[VirtualScroll] Rendering visible items",()=>({currentScrollPosition:a,effectiveScrollPosition:O,renderingStartIndex:ct,renderingEndIndex:bt,itemCount:n,viewportSize:he,callbackThrottleMs:$,diff:f,rawEffectiveScrollPosition:L})),n===0)return Bt;const _=E.top+Ht-L,Y=E.bottom>0?q.jsx("div",{className:"aqvs-bottom-inset",style:{top:C.getTotal()-Ht,height:E.bottom}},"virtualscroll-bottom-inset"):null;return M.debug("[VirtualScroll] Rendering items",()=>({containerTop:_,logicalScrollPosition:nt,resolvedInsets:E,effectiveScrollPosition:O})),q.jsxs("div",{className:"aqvs-items-wrapper",style:{top:0,transform:`translateY(${_}px)`,willChange:"transform"},children:[Bt,Y]})},[$,n,C,nt,Ht,bt,ct,E,Ue,he,Bt]),er=t.useMemo(()=>({renderingStartIndex:We.renderingStartIndex,renderingEndIndex:We.renderingEndIndex,visibleStartIndex:We.visibleStartIndex,visibleEndIndex:We.visibleEndIndex,scrollPosition:nt,totalHeight:C.getTotal()}),[We,nt,C,Ve]);t.useEffect(()=>{Ge.current=er},[er]);const[Tr,tr]=t.useState(""),rr=t.useRef(w);t.useLayoutEffect(()=>{rr.current=w},[w]);const wt=w?.debounceMs??400,Lt=Number.isFinite(wt)&&wt>=0,Ct=w!==void 0;t.useEffect(()=>{Ct&&!Lt&&M.warn(`[VirtualScroll] liveRegion.debounceMs must be a finite number >= 0, received ${wt}. Announcements are disabled.`)},[Ct,Lt,wt]),t.useEffect(()=>{if(!(Ct&&Lt)){tr("");return}const a=setTimeout(()=>{const u=rr.current?.format;if(!u)return;const f=u({visibleStartIndex:ht,visibleEndIndex:It,itemCount:n});tr(f)},wt);return()=>clearTimeout(a)},[Ct,Lt,wt,ht,It,n]),t.useImperativeHandle(G,()=>({getScrollPosition:()=>{const a=K.current?.getScrollPosition();return typeof a=="number"?Ke(a,Oe.current):-1},getContentSize:()=>K.current?.getContentSize()??-1,getViewportSize:()=>K.current?.getViewportSize()??-1,scrollTo:j,scrollBy:be,applyWheel:_e,scrollToIndex:l,getFenwickTreeTotalHeight:()=>C.getTotal(),getFenwickSize:()=>C.getSize(),focusItemAtIndex:ut,getRange:()=>Ge.current,getScrollAnchor:D,updateItemSize:Et}),[j,be,_e,l,C,ut,D,Et]);const Mr=C.getTotal()+E.top+E.bottom,nr=q.jsx(xr,{ref:K,contentSize:Mr,viewportSize:i,onViewportSizeChange:Se,className:c,testId:d,onScroll:Fe,background:I,tapScrollCircleOptions:ue,inertiaOptions:Ee,overscrollBehavior:Le,itemCount:n,scrollBarWidth:Z,enableThumbDrag:U,enableTrackClick:me,enableArrowButtons:z,enablePointerDrag:He,pointerDragInputs:qe,renderThumbOverlay:W,wheelSpeedMultiplier:Xe,onWheelHorizontal:se,contentInsets:E,contentProps:F,visibleStartIndex:ht,visibleEndIndex:It,renderOverlay:Ir,initialScrollPosition:tt.position,children:wr});return Ct?q.jsxs(q.Fragment,{children:[nr,q.jsx("div",{className:"aqvs-live-region",role:"status","aria-live":"polite","aria-atomic":"true","data-aqvs-live-region":"",children:Tr})]}):nr},on=t.forwardRef(sn);exports.FenwickMapTree=ft;exports.ScrollBar=gr;exports.ScrollPane=xr;exports.TAP_SCROLL_SPEED_DEFAULTS=Gt;exports.VirtualScroll=on;exports.computeAutoTapScrollMaxSpeedMultiplier=hr;exports.computeTapScrollSpeed=pr;exports.createResidualQuantizer=Rr;exports.minmax=te;exports.tapScrollCircleSampleVisual=$r;exports.useFenwickMapTree=Sr;exports.useHeightCache=Zr;exports.useLruCache=vr;exports.useWheelBridge=Qr;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("react/jsx-runtime"),t=require("react"),xt=require("tailwind-merge"),_r=r=>{const{quantum:e,resetOnDirectionChange:n=!0}=r;if(!(Number.isFinite(e)&&e>0))throw new TypeError(`[createResidualQuantizer] quantum must be a finite positive number, received ${e}`);let i=0;return{push:a=>{if(!Number.isFinite(a)||Math.abs(a)>Number.MAX_SAFE_INTEGER)return 0;n&&i!==0&&a!==0&&Math.sign(a)!==Math.sign(i)&&(i=0),i+=a;const o=Math.trunc(i/e)*e+0;return i-=o,o},peekResidue:()=>i,reset:()=>{i=0}}};class z{level;prefix;impl;constructor(e=2,n="[virtualscroll]",i=console){this.level=e,this.prefix=n,this.impl=i}static instance=new z(2,"[virtualscroll]");static setLevel(e){z.instance.setLevel(e)}setLevel(e){this.level=e}static setImplementation(e){z.instance.setImplementation(e)}setImplementation(e){this.impl=e}static setPrefix(e){z.instance.setPrefix(e)}setPrefix(e){this.prefix=e}static isEnabled(e){return z.instance.isEnabled(e)}isEnabled(e){return this.level<=e}static resolveLazy(e){if(typeof e!="function")return e;try{return e()}catch{return e}}formatMessage(e){return typeof e=="string"?[`${this.prefix} ${e}`]:[this.prefix,e]}static debug(e,...n){z.instance.debug(e,...n)}debug(e,...n){this.level<=0&&this.impl.debug(...this.formatMessage(z.resolveLazy(e)),...n.map(z.resolveLazy))}static info(e,...n){z.instance.info(e,...n)}info(e,...n){this.level<=1&&this.impl.info(...this.formatMessage(z.resolveLazy(e)),...n.map(z.resolveLazy))}static warn(e,...n){z.instance.warn(e,...n)}warn(e,...n){this.level<=2&&this.impl.warn(...this.formatMessage(z.resolveLazy(e)),...n.map(z.resolveLazy))}static error(e,...n){z.instance.error(e,...n)}error(e,...n){this.level<=3&&this.impl.error(...this.formatMessage(z.resolveLazy(e)),...n.map(z.resolveLazy))}}const br={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},sr=6,Or=8,Fr=({dragState:r,normalizedDistance:e})=>{const n=1+e*.18,i=.16+e*.24,a=.38+e*.28,o=r.active?"80ms ease-out":"220ms ease";return H.jsxs(H.Fragment,{children:[H.jsx("div",{className:"aqvs-tap-scroll-circle-visual-outer",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",boxShadow:`0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${i})`,transform:`scale(${n})`,transition:`${o}, ${r.active?"80ms":"260ms"} box-shadow ease`}}),H.jsx("div",{className:"aqvs-tap-scroll-circle-inner",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",boxShadow:"inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",opacity:a,transition:r.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},Er=t.memo(t.forwardRef(({onDragChange:r,className:e,maxVisualDistance:n=160,size:i=40,style:a,opacity:o=1,renderVisual:l,axis:m="y"},h)=>{const[x,S]=t.useState(br),M=t.useRef(null),T=t.useRef(null),v=t.useRef({x:0,y:0}),V=t.useRef(null),J=t.useRef(0),$=t.useCallback(C=>{S(C),r(C)},[r]),oe=t.useCallback((C,j,ce=!1)=>{const{x:Xe,y:qe}=v.current,D=C-Xe,Ze=j-qe,it=m==="x"?D:Ze,Ye=Math.abs(it),xe=Ye<sr?0:it<0?-1:1,ve=J.current;let Re=xe;const Qe=sr+Or;xe===0?ve!==0&&Ye<Qe?Re=ve:(Re=0,ce||(J.current=0)):xe!==ve&&ve!==0&&Ye<Qe?Re=ve:J.current=xe,$({active:ce||Ye>=sr,offsetX:D,offsetY:Ze,distance:Ye,direction:Re,pointerId:M.current})},[$,m]),be=t.useCallback(C=>{if(C===null)return;const j=V.current;j?.hasPointerCapture(C)&&j.releasePointerCapture(C)},[]),ue=t.useCallback((C=!1)=>{C&&be(M.current),M.current=null,T.current=null,J.current=0,$(br)},[$,be]),le=t.useCallback(C=>{if(M.current!==null&&M.current!==C.pointerId){T.current={pointerId:C.pointerId,clientX:C.clientX,clientY:C.clientY},C.preventDefault(),C.stopPropagation();return}C.preventDefault(),C.stopPropagation();const j=V.current??C.currentTarget,{left:ce,top:Xe,width:qe,height:D}=j.getBoundingClientRect();v.current={x:ce+qe/2,y:Xe+D/2},M.current=C.pointerId;try{j.setPointerCapture(C.pointerId)}catch{}oe(C.clientX,C.clientY,!0)},[oe]),ne=t.useCallback(C=>{if(M.current!==C.pointerId){T.current!==null&&T.current.pointerId===C.pointerId&&(T.current={pointerId:C.pointerId,clientX:C.clientX,clientY:C.clientY});return}C.preventDefault(),oe(C.clientX,C.clientY)},[oe]),_=t.useCallback(C=>{if(M.current!==C.pointerId){T.current!==null&&T.current.pointerId===C.pointerId&&(T.current=null);return}C.preventDefault(),C.stopPropagation();const j=T.current;if(T.current=null,j!==null){be(C.pointerId);const ce=V.current;let Xe=!0;if(ce!==null&&typeof ce.setPointerCapture=="function")try{ce.setPointerCapture(j.pointerId)}catch(qe){(typeof qe=="object"&&qe!==null&&"name"in qe?qe.name:void 0)==="NotFoundError"&&(Xe=!1)}if(Xe){M.current=j.pointerId,oe(j.clientX,j.clientY,!0);return}}ue(!0)},[ue,be,oe]),O=t.useCallback(C=>{C.target===C.currentTarget&&M.current===C.pointerId&&ue(!1)},[ue]);t.useImperativeHandle(h,()=>({reset:()=>{ue(!0)},getElement:()=>V.current}),[ue]);const N=Math.min(Math.max(o,0),1),K=i/64,Q=Math.min(x.distance,n)/n,re=x.direction*Q*10*K,se=l??Fr,ye={dragState:x,normalizedDistance:Q,sizeScale:K,size:i,opacity:N},A={...a,width:i,height:i,transform:`translateY(${re}px)`};return A.opacity=N,H.jsx("div",{ref:V,"data-testid":"virtual-scroll-tap-circle",className:xt.twMerge("aqvs-tap-scroll-circle",e),style:A,tabIndex:-1,onPointerDown:le,onPointerMove:ne,onPointerUp:_,onPointerCancel:_,onLostPointerCapture:O,role:"presentation",children:se(ye)})}));Er.displayName="TapScrollCircle";const G=(r,e,n)=>Math.max(e,Math.min(n,r)),cr=(r,e)=>{const n=e==="x",i=r.getBoundingClientRect(),a=n?i.width:i.height,o=S=>{const M=Number.parseFloat(S);return Number.isFinite(M)?M:0},l=window.getComputedStyle(r),m=o(n?l.width:l.height),h=m>0?m+o(n?l.paddingLeft:l.paddingTop)+o(n?l.paddingRight:l.paddingBottom)+o(n?l.borderLeftWidth:l.borderTopWidth)+o(n?l.borderRightWidth:l.borderBottomWidth):0,x=h>0?h:n?r.offsetWidth:r.offsetHeight;return x<=0||a<=0?1:a/x},ur="virtualscroll:tap-scroll-cancel",xr=20,Hr=250,Xr=60,qr=20,Yr=20,hr={maxDistance:240,minSpeedMultiplier:.2},Br=hr.maxDistance,vr={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},ir=2.2,Wr=8,$r=120,jr=1/10,It={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:Br,minSpeedMultiplier:hr.minSpeedMultiplier,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},Ur=r=>r?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,n)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"aqvs-scrollbar-horizontal",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,n)=>n,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"aqvs-scrollbar-vertical",orientation:"vertical"},Gr=(r,e)=>{const n=r?.maxSpeedMultiplier,i=typeof n=="number"?n:Pr(e);return{enabled:r?.enabled??It.enabled,size:r?.size??It.size,offsetX:r?.offsetX??It.offsetX,offsetY:r?.offsetY??It.offsetY,className:r?.className??It.className,maxVisualDistance:r?.maxVisualDistance??It.maxVisualDistance,maxSpeedMultiplier:i,minSpeedMultiplier:Math.max(r?.minSpeedMultiplier??It.minSpeedMultiplier,0),opacity:G(r?.opacity??It.opacity,0,1),renderVisual:r?.renderVisual??It.renderVisual,maxSpeedCurve:r?.maxSpeedCurve??It.maxSpeedCurve}},Kr=({isDragging:r,isThumbHovered:e,enableThumbDrag:n})=>t.useMemo(()=>n?r?"dragging":e?"hover":"idle":"disabled",[n,r,e]),Zr=({canUseArrowButtons:r,enableArrowButtons:e,resetTapScroll:n,scrollByStep:i})=>{const a=t.useRef(null),o=t.useRef(null),l=t.useRef(null),m=t.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null),o.current!==null&&(window.clearTimeout(o.current),o.current=null),l.current!==null&&(window.removeEventListener("pointerup",l.current),window.removeEventListener("pointercancel",l.current),window.removeEventListener("blur",l.current),l.current=null)},[]),h=t.useCallback(()=>{m()},[m]),x=t.useCallback(M=>T=>{if(!r)return;T.cancelable&&T.preventDefault(),T.stopPropagation(),n(),m(),i(M),o.current=window.setTimeout(()=>{a.current=window.setInterval(()=>{i(M)},Xr)},Hr);const v=()=>m();l.current=v,window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),window.addEventListener("blur",v)},[r,m,n,i]),S=t.useCallback(M=>T=>{e&&(T.key==="Enter"||T.key===" "||T.key==="Spacebar")&&(T.preventDefault(),i(M))},[e,i]);return t.useEffect(()=>{r||m()},[r,m]),t.useEffect(()=>()=>{m()},[m]),{handleArrowPointerDown:x,handleArrowPointerUp:h,handleArrowKeyDown:S}},Qr=700,zt=(r,e)=>typeof r=="number"&&Number.isFinite(r)?r:e,Cr=({distance:r,maxDistance:e,viewportSize:n,minSpeedMultiplier:i,maxSpeedMultiplier:a,hasCustomMaxSpeedMultiplier:o,curve:l})=>{const m=Math.max(zt(r,0),0),h=zt(e,0),x=h>0?Math.min(m,h)/h:1,S=Math.max(zt(n,0),0),M=Math.max(zt(i,0),0),T=Math.max(zt(a,0),0),v=Math.max(S*M,40),V=o?v:1200,J=Math.max(S*T,V),$=l?Math.max(zt(l.exponentialScale,T),0):0,oe=l?Math.min(J,Math.max(S*$,v)):J,be=Math.max(oe,v);let ue=x**1.1;if(l){const ne=Math.min(Math.max(zt(l.exponentialSteepness,0),0),Qr);if(ne===0)ue=x;else{const _=Math.expm1(ne)||1;ue=Math.min(Math.max(Math.expm1(ne*x)/_,0),1)}}const le=Math.min(Math.max(zt(l?.easedOffset,0),0),1);return v+(be-v)*(le+(1-le)*ue)},Pr=r=>{if(!r||r<=0)return ir;const e=Math.max(1,r),n=Math.log10(e),i=ir+n*Wr;return G(i,ir,$r)},pr=({contentSize:r,viewportSize:e,scrollPosition:n,onScroll:i,enableThumbDrag:a=!0,enableTrackClick:o=!0,enableArrowButtons:l=!0,horizontal:m=!1,enableHorizontalTapCircle:h=!1,scrollBarWidth:x=12,className:S,ariaControls:M,tapScrollCircleOptions:T,itemCount:v,renderThumbOverlay:V,visibleStartIndex:J,visibleEndIndex:$})=>{const[oe,be]=t.useState(!1),[ue,le]=t.useState(!1),[ne,_]=t.useState(!1),O=t.useRef(null),N=t.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null}),K=t.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}),Q=t.useRef(n),re=t.useRef(i),se=t.useRef(vr),ye=t.useRef(null),A=t.useRef(null),C=t.useRef(null),j=t.useRef(0),ce=t.useRef(0),Xe=t.useMemo(()=>Gr(T,v),[v,T]),qe=t.useMemo(()=>Ur(m),[m]),{enabled:D,size:Ze,offsetX:it,offsetY:Ye,className:xe,maxVisualDistance:ve,maxSpeedMultiplier:Re,minSpeedMultiplier:Qe,opacity:ee,renderVisual:te,maxSpeedCurve:mt}=Xe,P=t.useRef({viewportSize:e,maxScrollPosition:Math.max(r-e,0),scrollBarVisible:r>e,effectiveTapMaxDistance:Math.max(ve,1),tapCircleMaxSpeedMultiplier:Re,tapCircleMinSpeedMultiplier:Qe,tapCircleMaxSpeedCurve:mt,tapScrollCircleOptions:T,effectiveTrackLength:0,onScroll:i,scrollPosition:n}),{mainSizeKey:Me,crossSizeKey:F,positionKey:We,selectDelta:ut,getPointerCoordinate:k,arrowLabels:ht,arrowIcons:yt,directionClass:I,orientation:Oe}=qe,$e=Math.max(ve,1),pt=e/r,Ce=Math.max(e-x*2,0),vt=pt*Ce,d=Math.min(Math.max(xr,vt||0),Ce||xr),q=Math.max(r-e,0),Z=Math.max(Ce-d,0),U=q<=0||Z<=0?0:G(n/q*Z,0,Z),me=U+d/2,B=r>e||oe,ie=B&&l;t.useLayoutEffect(()=>{P.current={viewportSize:e,maxScrollPosition:q,scrollBarVisible:B,effectiveTapMaxDistance:$e,tapCircleMaxSpeedMultiplier:Re,tapCircleMinSpeedMultiplier:Qe,tapCircleMaxSpeedCurve:mt,tapScrollCircleOptions:T,effectiveTrackLength:Z,onScroll:i,scrollPosition:n}}),t.useLayoutEffect(()=>{Q.current=n},[n]),t.useLayoutEffect(()=>{re.current=i},[i]),t.useEffect(()=>{a||le(!1)},[a]);const ge=Kr({isDragging:oe,isThumbHovered:ue,enableThumbDrag:a}),W=t.useCallback((u,E)=>{const L=P.current,Y=E??Q.current;if(re.current){const De=re.current(u,Y);if(typeof De=="number"&&Number.isFinite(De))return Q.current=De,De}const de=typeof u=="function"?u(Y):u,Ve=Math.max(L.maxScrollPosition,0),Ne=L.scrollBarVisible?G(de,0,Ve):0;return Q.current=Ne,Ne},[]),he=t.useCallback(u=>{const E=P.current,L=Q.current;if(!E.scrollBarVisible||E.maxScrollPosition<=0){const He=W(0,L),nt=He-L;return{nextPosition:He,actualDelta:nt,reachedBoundary:!0}}if(u===0)return{nextPosition:L,actualDelta:0,reachedBoundary:!1};const de=W(He=>G(He+u,0,E.maxScrollPosition),L),Ve=de-L,Ne=u<0&&L+u<=0,De=u>0&&L+u>=E.maxScrollPosition,Ge=u<0&&(de<=0||Ne&&Ve===0)||u>0&&(de>=E.maxScrollPosition||De&&Ve===0);return{nextPosition:de,actualDelta:Ve,reachedBoundary:Ge}},[W]),Pe=t.useCallback((u,E)=>{u.current+=E;const L=Math.max(P.current.maxScrollPosition,0);L>0&&(u.current=G(u.current,-L,L));const Y=he(u.current);return u.current-=Y.actualDelta,Y.reachedBoundary&&(u.current=0),Y},[he]),Ie=t.useCallback(()=>{A.current!==null&&(window.cancelAnimationFrame(A.current),A.current=null),C.current=null,j.current=0,ce.current=0},[]),fe=t.useCallback(()=>{se.current={...vr},_(!1),ye.current?.reset(),Ie()},[Ie]),je=t.useCallback(u=>{const E=se.current,L=P.current;if(!E.active||E.direction===0){Ie();return}if(!L.scrollBarVisible||L.maxScrollPosition<=0){Ie();return}const Y=C.current??u,de=Math.max((u-Y)/1e3,0),Ve=Math.min(de,jr);if(C.current=u,Ve<=0){A.current=window.requestAnimationFrame(je);return}const Ne=Cr({distance:E.distance,maxDistance:L.effectiveTapMaxDistance,viewportSize:L.viewportSize,minSpeedMultiplier:L.tapCircleMinSpeedMultiplier,maxSpeedMultiplier:L.tapCircleMaxSpeedMultiplier,hasCustomMaxSpeedMultiplier:typeof L.tapScrollCircleOptions?.maxSpeedMultiplier=="number",curve:L.tapCircleMaxSpeedCurve});ce.current!==E.direction&&(ce.current=E.direction,j.current=0);const{reachedBoundary:De}=Pe(j,E.direction*Ne*Ve);if(De){Ie();return}A.current=window.requestAnimationFrame(je)},[Pe,Ie]),ze=t.useCallback(()=>{A.current===null&&(C.current=null,j.current=0,A.current=window.requestAnimationFrame(je))},[je]);t.useEffect(()=>{const u=se.current;!u.active||u.direction===0||ze()},[r,e,ze]),t.useEffect(()=>()=>{Ie()},[Ie]);const Le=t.useCallback(u=>{se.current=u,_(u.active),u.active&&u.direction!==0?ze():Ie()},[ze,Ie]);t.useEffect(()=>{D||fe()},[fe,D]),t.useEffect(()=>{const u=E=>{const Y=E.detail?.paneId;Y&&M&&Y!==M||fe()};return window.addEventListener(ur,u),()=>{window.removeEventListener(ur,u)}},[M,fe]),t.useEffect(()=>{if(!D)return;const u=E=>{if(!se.current.active||se.current.pointerId===E.pointerId)return;const L=E.target;if(!(L instanceof Node)){fe();return}ye.current?.getElement()?.contains(L)||fe()};return document.addEventListener("pointerdown",u,!0),()=>{document.removeEventListener("pointerdown",u,!0)}},[fe,D]);const we=u=>{if(!B||Z<=0||q<=0)return 0;const E=G(u,0,Z);return G(E/Z*q,0,q)},Be=t.useCallback(u=>{const{scrollBarVisible:E,effectiveTrackLength:L,maxScrollPosition:Y}=P.current;if(z.debug("[ScrollBar] calculateScrollPositionFromThumb",()=>({thumbPos:u,trackLen:L,maxScroll:Y})),L<=0||Y<=0)return null;const de=G(u,0,L);return G(de/L*Y,0,Y)},[]),at=t.useCallback(u=>cr(u,m?"x":"y"),[m]),b=t.useCallback(u=>{const E=N.current;if(E.pointerId!==u.pointerId)return;const L=u.clientX-E.startClientX,Y=u.clientY-E.startClientY,de=ut(L,Y)/(E.scale||1);z.debug("[ScrollBar] handleThumbPointerMove",()=>({delta:de,startThumbPosition:E.startThumbPosition,clientY:u.clientY,startClientY:E.startClientY,metrics:P.current}));const Ve=Be(E.startThumbPosition+de);Ve!==null&&W(Ve),u.cancelable&&u.preventDefault()},[ut,Be,W]),w=t.useCallback(u=>{const E=N.current;if(E.pointerId!==u.pointerId)return;document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w);const L=E.captureTarget;if(L?.hasPointerCapture?.(u.pointerId)&&L.releasePointerCapture(u.pointerId),N.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1,captureTarget:null},be(!1),O.current){const Y=O.current.getBoundingClientRect();u.clientX>=Y.left&&u.clientX<=Y.right&&u.clientY>=Y.top&&u.clientY<=Y.bottom||le(!1)}else le(!1)},[b]);t.useEffect(()=>()=>{document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)},[b,w]);const ke=t.useRef(0),Fe=t.useRef(0),_e=t.useCallback(u=>{const E=Math.max(Math.round(P.current.viewportSize/Yr),qr);Fe.current!==u&&(Fe.current=u,ke.current=0),Pe(ke,u*E)},[Pe]),{handleArrowPointerDown:Ue,handleArrowPointerUp:Ee,handleArrowKeyDown:gt}=Zr({canUseArrowButtons:ie,enableArrowButtons:l,resetTapScroll:fe,scrollByStep:_e}),wt=u=>{if(!B)return;if(!a){u.preventDefault(),u.stopPropagation();return}if(u.pointerType==="mouse"&&u.button!==0||u.ctrlKey)return;fe();const E=u.currentTarget,L=at(E);let Y=null;if(E.setPointerCapture)try{E.setPointerCapture(u.pointerId),Y=E}catch{Y=null}N.current={pointerId:u.pointerId,startThumbPosition:U,startClientX:u.clientX,startClientY:u.clientY,scale:L,captureTarget:Y},document.addEventListener("pointermove",b),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w),be(!0),le(!0),u.preventDefault(),u.stopPropagation()},ft=u=>{if(!B)return;if(!o){u.preventDefault(),u.stopPropagation();return}if(u.pointerType==="mouse"&&u.button!==0||u.ctrlKey)return;const E=u.currentTarget,L=E.getBoundingClientRect(),Y=k(u),de=at(E),Ve=(Y-(m?L.left:L.top))/de;fe();const Ne=Ve-d/2,De=we(Ne);if(W(De),E.setPointerCapture)try{E.setPointerCapture(u.pointerId)}catch{}K.current={pointerId:u.pointerId,startThumbPosition:Ne,startClientX:u.clientX,startClientY:u.clientY,scale:de},u.preventDefault(),u.stopPropagation()},ot=()=>{K.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0,scale:1}},St=u=>{const E=K.current;if(E.pointerId!==u.pointerId)return;if(u.pointerType==="mouse"&&u.buttons===0){ot();return}const L=u.clientX-E.startClientX,Y=u.clientY-E.startClientY,de=ut(L,Y)/(E.scale||1),Ve=we(E.startThumbPosition+de);W(Ve),u.cancelable&&u.preventDefault()},kt=u=>{if(K.current.pointerId!==u.pointerId)return;const E=u.currentTarget;E.hasPointerCapture?.(u.pointerId)&&E.releasePointerCapture(u.pointerId),ot(),u.preventDefault(),u.stopPropagation()},Et=u=>{if(K.current.pointerId!==u.pointerId)return;const E=u.currentTarget;E.hasPointerCapture?.(u.pointerId)&&E.releasePointerCapture(u.pointerId),ot()},Rt=u=>{u.target===u.currentTarget&&K.current.pointerId===u.pointerId&&ot()},Te=t.useMemo(()=>G((ne?1:.8)*ee,0,1),[ne,ee]),bt=t.useMemo(()=>{const E=`calc(50% - ${Ze/2}px + ${Ye}px)`;return{left:it,top:E}},[it,Ye,Ze]),Nt=(u,E,L,Y)=>H.jsx("button",{type:"button",tabIndex:0,className:"aqvs-scrollbar-arrow-button",style:{[Me]:x,[F]:x},"aria-label":E,onPointerDown:Ue(u),onPointerUp:Ee,onPointerLeave:Ee,onPointerCancel:Ee,onKeyDown:gt(u),"aria-disabled":!l,disabled:!ie,children:H.jsx("span",{"aria-hidden":"true",children:L})},Y),Vt=V&&B?{orientation:Oe,scrollPosition:n,maxScrollPosition:q,contentSize:r,viewportSize:e,thumbSize:d,thumbPosition:U,thumbCenter:me,trackSize:Ce,isDragging:oe,isTapScrollActive:ne,visibleStartIndex:J,visibleEndIndex:$}:null;return H.jsxs("div",{className:xt.twMerge("aqvs-scrollbar",I,S),style:{[Me]:e,[F]:x},"data-visible":B?"true":"false",role:"scrollbar",tabIndex:-1,"aria-controls":M,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":q,"aria-orientation":m?"horizontal":"vertical",children:[(!m||h)&&B&&D&&H.jsx(Er,{axis:m?"x":"y",ref:ye,className:xt.twMerge("aqvs-scrollbar-tap-circle-wrapper",xe),size:Ze,maxVisualDistance:$e,style:bt,opacity:Te,renderVisual:te,onDragChange:Le},"tap-circle"),Nt(-1,ht[0],yt[0],"arrow-start"),H.jsxs("div",{className:"aqvs-scrollbar-track",style:{borderRadius:x/2},onPointerDown:ft,onPointerMove:St,onPointerUp:kt,onPointerCancel:Et,onLostPointerCapture:Rt,"aria-disabled":!o,children:[Vt&&H.jsx("div",{className:"aqvs-scrollbar-overlay","aria-hidden":!0,children:V?.(Vt)},"overlay"),H.jsx("div",{className:"aqvs-scrollbar-thumb-wrapper",style:{[Me]:d,[We]:U,...m?{top:0,bottom:0}:{left:0,right:0}},"data-visible":B||oe?"true":"false",onPointerDown:wt,role:"slider","aria-orientation":m?"horizontal":"vertical","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":q,"aria-disabled":!a,tabIndex:-1,children:H.jsx("div",{ref:O,className:xt.twMerge("aqvs-scrollbar-thumb",m?"aqvs-scrollbar-thumb-horizontal":"aqvs-scrollbar-thumb-vertical"),"data-testid":"aqvs-scrollbar-thumb","data-thumb-state":ge,style:{borderRadius:x-1,cursor:a?"pointer":"default"},onMouseEnter:()=>{a&&le(!0)},onMouseLeave:()=>{a&&le(!1)}},"thumb")},"thumb-wrapper")]},"track"),Nt(1,ht[1],yt[1],"arrow-end")]})},Jr=16,wr=(r,e,n)=>e===1?r*Jr:e===2?r*n:r,en=(r,e)=>{const n=r.shiftKey&&r.deltaX===0,i=n?r.deltaY:r.deltaX,a=n?0:r.deltaY,o=i!==0&&Math.abs(i)>=Math.abs(a);return{isZoomGesture:r.ctrlKey,isHorizontalDominant:o,horizontalDelta:wr(i,r.deltaMode,e),verticalDelta:wr(a,r.deltaMode,e)}},zr=new WeakSet,Sr=r=>{zr.add(r)},tn=r=>zr.has(r),rn=["mouse","pen","touch"],ar=(r,e)=>!(r==="mouse"||r==="pen"||r==="touch")||e.includes(r),nn=r=>r==="mouse"||r==="pen",Wt={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},tr=(r,e,n)=>{for(const[i,a,o]of e)n==="add"?r.addEventListener(i,a,o):r.removeEventListener(i,a,o)},kr=t.forwardRef(({children:r,contentSize:e,viewportSize:n,onViewportSizeChange:i,scrollBarWidth:a=12,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:m=!0,enablePointerDrag:h=!0,pointerDragInputs:x=rn,onScroll:S,className:M,testId:T,style:v,background:V,tapScrollCircleOptions:J,inertiaOptions:$,itemCount:oe,renderThumbOverlay:be,wheelSpeedMultiplier:ue=1,overscrollBehavior:le="auto",onWheelHorizontal:ne,onPanHorizontal:_,contentInsets:O,visibleStartIndex:N,visibleEndIndex:K,renderOverlay:Q,initialScrollPosition:re=0,contentProps:se},ye)=>{const A=t.useRef(Number.isFinite(re)?Math.max(0,re):0),C=t.useRef(null),j=t.useRef(null),ce=n===void 0,[Xe,qe]=t.useState(0),D=n??Xe,Ze=t.useRef(null);t.useLayoutEffect(()=>{if(!ce)return;const d=j.current;if(!d)return;const q=()=>{const U=d.offsetHeight;if(U>0){qe(me=>me===U?me:U);return}d.offsetParent!==null&&e>0&&Ze.current!=="zero"&&(Ze.current="zero",z.warn("[ScrollPane] The self-measured viewport is 0px. Give the scroll pane's host element a definite height (e.g. h-full, flex-1 + min-h-0, an explicit px height), or pass viewportSize explicitly."))};if(q(),typeof ResizeObserver!="function")return;const Z=new ResizeObserver(q);return Z.observe(d),()=>{Z.disconnect()}},[e,ce]),t.useLayoutEffect(()=>{ce&&i?.(Xe)},[ce,Xe,i]),t.useLayoutEffect(()=>{if(ce)return;const d=C.current;if(!d)return;const q=()=>{const U=d.clientHeight;if(U<=0||Math.abs(U-D)<=1)return;const me=`${D}/${U}`;Ze.current!==me&&(Ze.current=me,z.warn(`[ScrollPane] viewportSize=${D} but the host band is ${U}px. The clip window, max scroll position, thumb mapping, rendered row count and scrollability all derive from viewportSize, so they are now wrong. Omit viewportSize to let the pane measure itself.`))};if(q(),typeof ResizeObserver!="function")return;const Z=new ResizeObserver(q);return Z.observe(d),()=>{Z.disconnect()}},[ce,D]);const it=t.useRef(ne);t.useEffect(()=>{it.current=ne},[ne]);const Ye=t.useRef(_);t.useEffect(()=>{Ye.current=_},[_]);const xe=t.useRef({frame:null,velocity:0,lastTimestamp:null,generation:0}),ve=t.useMemo(()=>({maxVelocity:$?.maxVelocity??Wt.maxVelocity,minVelocity:$?.minVelocity??Wt.minVelocity,deceleration:$?.deceleration??Wt.deceleration,velocitySampleWindow:$?.velocitySampleWindow??Wt.velocitySampleWindow,startVelocityThreshold:$?.startVelocityThreshold??Wt.startVelocityThreshold}),[$]),Re=t.useMemo(()=>({top:Math.max(0,O?.top??0),bottom:Math.max(0,O?.bottom??0)}),[O]);z.debug("[ScrollPane] ScrollPane rendered",()=>({contentSize:e,viewportSize:D,scrollBarWidth:a,className:M,style:v,tapScrollCircleOptions:J,inertiaOptions:$,enablePointerDrag:h,contentInsets:Re}));const Qe=t.useRef({contentSize:e,viewportSize:D}),ee=t.useMemo(()=>e>D,[e,D]),te=t.useCallback((d,q)=>{let Z=q??Qe.current;q&&!(Number.isFinite(q.contentSize)&&Number.isFinite(q.viewportSize))&&(z.warn("[ScrollPane] scrollTo received non-finite dimsOverride; falling back to the committed dims",{dimsOverride:q}),Z=Qe.current);const{contentSize:U,viewportSize:me}=Z,B=U>me,ie=A.current;if(z.debug("[ScrollPane] scrollTo called",()=>({newPosition:d,contentSize:U,viewportSize:me,currentIsScrollable:B,prevPosition:ie})),!B)return A.current!==0&&(A.current=0,S?.(0,ie)),A.current;const ge=typeof d=="function"?d(A.current):d;if(!Number.isFinite(ge))return z.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position",{nextPosition:ge}),A.current;const W=Math.max(U-me,0),he=G(ge,0,W);return A.current!==he&&(A.current=he,S?.(he,ie)),A.current},[S]),mt=t.useRef(te);t.useEffect(()=>{mt.current=te},[te]);const P=t.useCallback(()=>{const d=xe.current;d.generation+=1,d.frame!==null&&cancelAnimationFrame(d.frame),d.frame=null,d.velocity=0,d.lastTimestamp=null},[]),Me=t.useRef(P);t.useEffect(()=>{Me.current=P},[P]),t.useEffect(()=>()=>{Me.current()},[]);const F=t.useCallback(d=>{if(!ee)return;const{maxVelocity:q,minVelocity:Z,deceleration:U,startVelocityThreshold:me}=ve,B=G(d,-q,q);if(Math.abs(B)<me)return;P(),xe.current.velocity=B,xe.current.lastTimestamp=null;const ie=xe.current.generation,ge=W=>{const he=xe.current;if(he.generation!==ie)return;if(he.lastTimestamp===null){he.lastTimestamp=W,he.frame=requestAnimationFrame(ge);return}const Pe=W-he.lastTimestamp;if(he.lastTimestamp=W,Pe<=0){he.frame=requestAnimationFrame(ge);return}const Ie=he.velocity;let fe=Ie;const je=U*Pe;Ie>0?fe=Math.max(0,Ie-je):Ie<0&&(fe=Math.min(0,Ie+je));const Le=(Ie+fe)/2*Pe,we=A.current;if(Le!==0&&mt.current(Fe=>Fe+Le),xe.current.generation!==ie)return;const Be=A.current,{contentSize:at,viewportSize:b}=Qe.current,w=Math.max(at-b,0);he.velocity=fe;const ke=Be===we||Be<=0&&fe<=0||Be>=w&&fe>=0;if(Math.abs(fe)<Z||ke){P();return}he.frame=requestAnimationFrame(ge)};xe.current.frame=requestAnimationFrame(ge)},[ee,ve,P]),We=t.useRef(F);t.useEffect(()=>{We.current=F},[F]),t.useLayoutEffect(()=>{Qe.current={contentSize:e,viewportSize:D}},[e,D]),t.useLayoutEffect(()=>{const d=j.current;if(!d)return;const q=()=>{d.scrollTop!==0&&(z.debug("[ScrollPane] Native scroll detected, resetting to 0",()=>({scrollTop:d.scrollTop})),d.scrollTop=0),d.scrollLeft!==0&&(d.scrollLeft=0)};return d.addEventListener("scroll",q),()=>d.removeEventListener("scroll",q)},[]),t.useLayoutEffect(()=>{if(ee){z.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",()=>({contentSize:e,viewportSize:D,scrollPosition:A.current}));const d=G(e-D,0,e);A.current>d&&te(d)}else te(0)},[ee,te,e,D]);const ut=t.useRef({isScrollable:ee,viewportSize:D,wheelSpeedMultiplier:ue,overscrollBehavior:le});t.useLayoutEffect(()=>{ut.current={isScrollable:ee,viewportSize:D,wheelSpeedMultiplier:ue,overscrollBehavior:le}},[ee,D,ue,le]);const k=t.useCallback(d=>{if(tn(d))return!1;const{isScrollable:q,viewportSize:Z,wheelSpeedMultiplier:U,overscrollBehavior:me}=ut.current,B=en(d,Z);if(B.isZoomGesture)return!1;if(B.isHorizontalDominant)return it.current?(Sr(d),d.preventDefault(),P(),it.current(B.horizontalDelta),!0):!1;if(!q||B.verticalDelta===0)return!1;let ie=B.verticalDelta;if(U!==1&&(ie*=U),me!=="contain"){const ge=A.current,W=Math.max(Qe.current.contentSize-Z,0);if(ie>0&&ge>=W||ie<0&&ge<=0)return!1}return Sr(d),d.preventDefault(),P(),z.debug("[ScrollPane] wheel event",()=>({deltaY:ie,scrollPosition:A.current,wheelSpeedMultiplier:U,deltaMode:d.deltaMode,scrollTop:j.current?.scrollTop})),te(ge=>ge+ie),!0},[te,P]);t.useEffect(()=>{const d=U=>{k(U)},q=()=>{P()},Z=C.current;return Z&&(Z.addEventListener("wheel",d,{passive:!1}),Z.addEventListener("pointerdown",q,{capture:!0,passive:!0})),()=>{Z&&(Z.removeEventListener("wheel",d),Z.removeEventListener("pointerdown",q,{capture:!0}))}},[k,P]),t.useImperativeHandle(ye,()=>({scrollTo:(d,q)=>(P(),te(d,q)),getScrollPosition:()=>A.current,getContentSize:()=>e,getViewportSize:()=>D,applyWheel:k}),[te,e,D,P,k]);const ht=t.useId(),yt=se?.id??ht,I=t.useRef({pointerType:"",pointerId:null,startClientY:0,startClientX:0,lastPanClientX:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[],scale:1,scaleX:1}),Oe=t.useRef(h),$e=t.useRef(x);t.useEffect(()=>{Oe.current=h},[h]),t.useEffect(()=>{$e.current=x},[x]);const pt=t.useRef(ee);t.useEffect(()=>{pt.current=ee},[ee]);const Ce=t.useRef(ve);t.useEffect(()=>{Ce.current=ve},[ve]),t.useEffect(()=>{const d=I.current;if(h&&ee&&(d.pointerId===null||ar(d.pointerType,x))||d.pointerId===null)return;const q=j.current;d.clickResetTimer!==null&&(window.clearTimeout(d.clickResetTimer),d.clickResetTimer=null);const Z=d.isDragging&&d.shouldCancelNextClick,U=d.pointerId;d.pointerId=null,d.pointerType="",d.startClientY=0,d.startScroll=0,d.isDragging=!1,d.shouldCancelNextClick=Z,d.velocitySamples=[],d.scale=1,q?.hasPointerCapture(U)&&q.releasePointerCapture(U)},[h,x,ee]),t.useEffect(()=>{const d=j.current;if(!d)return;const q=6,Z=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),U=()=>{const b=I.current;b.pointerId=null,b.pointerType="",b.startClientY=0,b.startScroll=0,b.isDragging=!1,b.velocitySamples=[],b.scale=1},me=()=>{const b=I.current;b.clickResetTimer!==null&&(window.clearTimeout(b.clickResetTimer),b.clickResetTimer=null)},B=b=>{const w=I.current,ke=Z();w.velocitySamples.push({clientY:b,time:ke});const Fe=Ce.current.velocitySampleWindow;w.velocitySamples=w.velocitySamples.filter(_e=>ke-_e.time<=Fe)},ie=b=>b instanceof HTMLElement&&b.closest("[data-scrollpane-ignore-drag='true']")!==null,ge=b=>{const w=I.current;w.shouldCancelNextClick&&(b.preventDefault(),b.stopPropagation(),w.shouldCancelNextClick=!1)},W=b=>{const w=I.current;if(!w.isDragging){if(w.isDragging=!0,w.shouldCancelNextClick=!0,!d.hasPointerCapture(b.pointerId))try{d.setPointerCapture(b.pointerId)}catch{}B(b.clientY)}},he=b=>b.isTrusted||b.target===d,Pe=b=>{const w=I.current;d.hasPointerCapture(b)&&d.releasePointerCapture(b),w.shouldCancelNextClick=!1,me(),U()},Ie=b=>{const w=I.current;if(w.pointerId!==b.pointerId)return;if(b.buttons===0&&nn(b.pointerType)){Pe(b.pointerId);return}if(!(Oe.current&&pt.current)||!ar(b.pointerType,$e.current))return;if(!w.isDragging){const Ue=Math.abs(b.clientY-w.startClientY),Ee=Ye.current?Math.abs(b.clientX-w.startClientX):0;if(Math.max(Ue,Ee)<q||(W(b),!w.isDragging))return}B(b.clientY);const ke=(b.clientY-w.startClientY)/(w.scale||1),Fe=w.startScroll-ke;mt.current(Fe);const _e=Ye.current;if(_e){const Ue=b.clientX-w.lastPanClientX;w.lastPanClientX=b.clientX,Ue!==0&&_e(-Ue/(w.scaleX||1))}b.cancelable&&b.preventDefault()},fe=()=>{const b=I.current;return b.pointerId!==null||!b.shouldCancelNextClick?!1:(me(),b.clickResetTimer=window.setTimeout(()=>{const w=I.current;w.shouldCancelNextClick=!1,w.clickResetTimer=null},0),!0)},je=b=>{const w=I.current;if(w.pointerId!==b.pointerId){fe();return}w.isDragging&&w.shouldCancelNextClick&&b.cancelable&&(b.preventDefault(),b.stopPropagation()),w.isDragging&&B(b.clientY);let ke=0;if(w.isDragging&&w.velocitySamples.length>=2){const _e=w.velocitySamples,Ue=Ce.current.velocitySampleWindow,Ee=_e[_e.length-1],gt=_e.find(wt=>Ee.time-wt.time<=Ue)??_e[0];if(Ee&&gt&&Ee.time!==gt.time){const wt=Ee.clientY-gt.clientY,ft=Ee.time-gt.time;ke=-(wt/ft)/(w.scale||1)}}me(),w.shouldCancelNextClick&&(w.clickResetTimer=window.setTimeout(()=>{const _e=I.current;_e.shouldCancelNextClick=!1,_e.clickResetTimer=null},0));const Fe=Ce.current.startVelocityThreshold;U(),d.hasPointerCapture(b.pointerId)&&d.releasePointerCapture(b.pointerId),Math.abs(ke)>=Fe&&We.current?.(ke)},ze=b=>{if(I.current.pointerId!==null){if(!b.isPrimary||b.pointerType!==I.current.pointerType)return;Pe(I.current.pointerId)}if(I.current.shouldCancelNextClick&&(me(),I.current.shouldCancelNextClick=!1),!(Oe.current&&pt.current)||!ar(b.pointerType,$e.current)||b.button!==0&&b.pointerType==="mouse"||b.ctrlKey||b.metaKey||b.altKey||ie(b.target))return;window.dispatchEvent(new CustomEvent(ur,{detail:{paneId:ht}})),Me.current?.();const w=I.current;me(),w.pointerId=b.pointerId,w.pointerType=b.pointerType,w.startClientY=b.clientY,w.startClientX=b.clientX,w.lastPanClientX=b.clientX,w.startScroll=A.current,w.scale=cr(d,"y"),w.scaleX=Ye.current?cr(d,"x"):1,w.isDragging=!1,w.shouldCancelNextClick=!1,w.velocitySamples=[]},Le=b=>{if(I.current.pointerId!==b.pointerId){fe();return}he(b)&&Pe(b.pointerId)},Be=[["click",ge,!0],["pointerdown",ze,{passive:!1}],["lostpointercapture",b=>{b.target!==d||I.current.pointerId!==b.pointerId||Pe(b.pointerId)},void 0]],at=[["pointermove",Ie,{passive:!1}],["pointerup",je,void 0],["pointercancel",Le,void 0]];return tr(d,Be,"add"),tr(window,at,"add"),()=>{tr(d,Be,"remove"),tr(window,at,"remove");const b=I.current;b.pointerId!==null&&d.hasPointerCapture(b.pointerId)&&d.releasePointerCapture(b.pointerId),me(),U()}},[ht]);const vt=t.useCallback(d=>(P(),te(d)),[te,P]);return H.jsxs("div",{ref:C,"data-testid":T,"data-self-measured":ce?"true":void 0,className:xt.twMerge("aqvs-scroll-pane",M),style:v,children:[H.jsxs("div",{ref:j,className:xt.twMerge("aqvs-scroll-pane-content"),"data-testid":"aqvs-scroll-pane-content",style:{height:ce?void 0:D,paddingTop:Re.top,paddingBottom:Re.bottom,...h&&ee&&x.some(d=>d==="touch"||d==="pen")?{touchAction:"none"}:{}},...se,id:yt,children:[V,r(A.current)]}),H.jsx(pr,{contentSize:e,viewportSize:D,scrollPosition:A.current,onScroll:vt,enableThumbDrag:o,enableTrackClick:l,enableArrowButtons:m,scrollBarWidth:a,ariaControls:yt,tapScrollCircleOptions:J,itemCount:oe,renderThumbOverlay:be,visibleStartIndex:N,visibleEndIndex:K},"scrollbar"),Q?.()]})}),Rr=(r,e,n)=>Math.min(Math.max(r,e),n),sn=({dragState:r,normalizedDistance:e,sizeScale:n,size:i})=>{const a=Math.max(i/2,1),o=1+e*.65,l=Math.max(.65,1-e*.25),m=r.direction*e*26*n,h=.8+e*.18,x=3*n,S=6*n,M=22*n,T=Math.abs(m)+S,v=m>0?x:-Math.abs(m)-x,V=Math.max(2.5,3*n),J=Rr(r.offsetX,-a,a),$=Rr(r.offsetY,-a,a),oe=a*.35,be=J/a*oe,ue=$/a*oe,le=be*.45,ne=ue*.45,_=Math.max(M*.38,6),O=.65+e*.2,N=r.active;return H.jsxs(H.Fragment,{children:[H.jsx("div",{className:"aqvs-tap-scroll-circle-gradient",style:{transform:`scale(${l}, ${o})`,transition:N?"40ms transform ease-out":"200ms ease transform"}}),H.jsx("div",{className:"aqvs-sample-visual-pupil",style:{width:M,height:M,transform:`translate(calc(-50% + ${be}px), calc(-50% + ${ue}px)) scale(${l}, ${h*o})`,transition:N?"70ms transform ease-out":"200ms ease transform"}}),H.jsx("div",{className:"aqvs-sample-visual-highlight",style:{width:_,height:_,transform:`translate(calc(-50% + ${le}px), calc(-50% + ${ne}px)) scale(${l}, ${o})`,opacity:O,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:N?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),H.jsx("div",{className:"aqvs-sample-visual-rod",style:{width:V,height:T,transform:`translate(-50%, ${v}px)`,opacity:e,transition:N?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},Ot=100,an=r=>{if(!Number.isFinite(r))return 0n;const e=Math.trunc(r);return e<=0?0n:BigInt(e)},or=(r,e)=>{if(!Number.isFinite(r))throw new Error(`valueFn returned a non-finite value at index ${e}: ${r}`);return r},Ft=r=>{if(r<=0||!Number.isFinite(r))return 0;const e=Math.trunc(r);if(e<=2147483647)return e&-e;const n=BigInt(e)&-BigInt(e);return Number(n)};class Tt{tree;deltas;size;baseValue;valueFn;total;constructor(e,n,i){this.reset(e,n,i)}reset(e,n,i){const a=Number.isFinite(e)&&e>0?Math.trunc(e):0;if(typeof n!="function"){this.size=a,this.tree=new Map,this.deltas=new Map,this.valueFn=void 0,this.baseValue=n,this.total=this.baseValue*this.size;return}let o=0,l;const m=i?.baseValue;if(m!==void 0&&!(Number.isFinite(m)&&m>=0))throw new RangeError(`[FenwickMapTree] options.baseValue must be a finite number >= 0, received ${m}.`);if(a>0&&m!==void 0){if(o=m,i?.materialize){const h=i?.sampleRange??{from:0,to:Math.min(Ot-1,a-1)};let x=Math.max(0,Math.trunc(h.from)),S=Math.min(Math.trunc(h.to),a-1);x>S&&(x=0,S=Math.min(Ot-1,a-1)),l={from:x,values:Tt._collectValidatedValues(n,x,S)}}}else if(a>0){const h=i?.sampleRange??{from:0,to:Math.min(Ot-1,a-1)};let x=Math.max(0,Math.trunc(h.from)),S=Math.min(Math.trunc(h.to),a-1);if(x>S&&(x=0,S=Math.min(Ot-1,a-1)),a>Ot)o=Tt._sampleBaseValueStrided(n,a,Ot),i?.materialize&&(l={from:x,values:Tt._collectValidatedValues(n,x,S)});else{const M=Tt._collectValidatedValues(n,x,S);o=Tt._modeOrMedian([...M]),i?.materialize&&(l={from:x,values:M})}}if(this.size=a,this.tree=new Map,this.deltas=new Map,this.total=void 0,this.valueFn=n,this.baseValue=o,l)for(let h=0;h<l.values.length;h++){const x=l.from+h;if(x>=this.size)break;const S=l.values[h]-this.baseValue;S!==0&&(this.deltas.set(x,S),this._updateTree(x,S))}this.total=this.getTotal()}setValueFn(e,n){if(n?.reset){this.reset(this.size,e);return}typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e,this.total=this._computeTreeTotal())}static _collectValidatedValues(e,n,i){const a=[];for(let o=n;o<=i;o++)a.push(or(e(o),o));return a}static _modeOrMedian(e){if(e.length===0)return 0;e.sort((l,m)=>l-m);const n=Math.floor(e.length/2);let i;e.length%2===0?i=Math.floor((e[n-1]+e[n])/2):i=e[n];const a=new Map;let o=0;for(const l of e){const m=(a.get(l)??0)+1;a.set(l,m),m>o&&(o=m)}if(o>e.length*.2){const l=[];for(const[h,x]of a.entries())x===o&&l.push(h);const m=l.reduce((h,x)=>h+x,0);i=Math.floor(m/l.length)}return i}static _sampleBaseValueStrided(e,n,i){if(n<=0)return 0;let a=Math.max(1,Math.ceil(n/i));a%2===0&&(a+=1);const o=[];for(let l=0;l<n&&o.length<i;l+=a)o.push(or(e(l),l));return Tt._modeOrMedian(o)}update(e,n){return this.updates([{index:e,value:n}])}updates(e){const n=this._buildDeltaUpdates(e);return n.length>0?this.updateDeltas(n):this.total}updateDelta(e,n){return this.updateDeltas([{index:e,change:n}])}updateDeltas(e){const n=new Map;for(const{index:i,change:a}of e){if(i<0||i>=this.size)throw new Error(`Index ${i} out of bounds`);if(!Number.isInteger(i))throw new Error(`Index must be an integer: ${i}`);if(!Number.isFinite(a))throw new Error(`Change must be a finite number: ${a}`);const l=(n.get(i)??this.deltas.get(i)??0)+a;if(l+this.baseValue<-1e-9)throw new Error(`Change would make the value at index ${i} negative: ${l+this.baseValue}`);n.set(i,l)}for(const{index:i,change:a}of e){const l=(this.deltas.get(i)??0)+a;l===0?this.deltas.delete(i):this.deltas.set(i,l),this._updateTree(i,a)}return this.total}_updateTree(e,n){if(n===0)return;let i=e+1;for(;i<=this.size;){this.tree.set(i,(this.tree.get(i)??0)+n);const a=Ft(i);if(a===0)break;i+=a}this.total!==void 0&&(this.total+=n)}_buildDeltaUpdates(e){const n=[],i=new Map;for(const{index:a,value:o}of e){if(a<0||a>=this.size)throw new Error(`Index ${a} out of bounds`);if(!Number.isInteger(a))throw new Error(`Index must be an integer: ${a}`);if(!Number.isFinite(o))throw new Error(`Value must be a finite number: ${o}`);if(o<0)throw new Error("Value cannot be negative.");const l=i.has(a)?i.get(a)??0:this.deltas.get(a)??0,m=l+this.baseValue,h=o-m;h!==0&&n.push({index:a,change:h}),i.set(a,l+h)}return n}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,n=this.size;for(;n>0;){e+=this.tree.get(n)??0;const i=Ft(n);if(i===0)break;n-=i}return e+this.baseValue*this.size}_materialize(e,n=!0){if(this.valueFn){const i=this.deltas.get(e)??0,o=or(this.valueFn(e),e)-this.baseValue;if(o!==i&&(o===0?this.deltas.delete(e):this.deltas.set(e,o),n)){const l=o-i;this._updateTree(e,l)}}}_materializeRanges(e,n,i=!1){if(!(e?.materialize&&this.valueFn))return;const a=e.ranges;if(a&&a.length>0){for(const m of a){const h=Math.max(0,Math.trunc(m.from)),x=Math.min(Math.trunc(m.to),this.size-1);for(let S=h;S<=x;S++)this._materialize(S)}if(n===void 0)return;if(i){this._materialize(n);return}const o=a[0].from,l=a[a.length-1].to;n>=o&&n<=l&&this._materialize(n);return}n!==void 0&&this._materialize(n)}_findIndex(e,n={},i){if(this.size>=1073741824)return this._findIndexLarge(e,n,i);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(n.materializeOption);const a=n.materializeOption?.materialize===!0;let o;for(;;){if(o=this._descend(e,i),o<0||o>=this.size)return{index:-1,total:this.total??this.getTotal(),cumulative:void 0,currentValue:void 0,safeIndex:void 0};if(!a)break;const m=this.deltas.get(o)??0;if(this._materialize(o),(this.deltas.get(o)??0)===m)break}const l=this.prefixSum(o);return{index:o,total:this.total??l.total,cumulative:l.cumulative,currentValue:l.currentValue,safeIndex:l.safeIndex}}_descend(e,n){let i=0,a=0,o=1;for(;o<<1<=this.size;)o<<=1;for(;o>0;o>>=1){const l=i+o;if(l<=this.size){const h=(this.tree.get(l)??0)+this.baseValue*o;(n?a+h<e:a+h<=e)&&(i=l,a+=h)}}return n?i:i-1}_findIndexLarge(e,n,i){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const a=an(this.size);if(a===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};this._materializeRanges(n.materializeOption);const o=n.materializeOption?.materialize===!0;for(;;){let l=0n,m=a-1n,h,x,S=this.total;for(;l<=m;){const v=l+m>>1n,V=Number(v),J=this.prefixSum(V);if(S=J.total,i?J.cumulative>=e:J.cumulative<=e)if(h=v,x=J,i){if(v===0n)break;m=v-1n}else l=v+1n;else if(i)l=v+1n;else{if(v===0n)break;m=v-1n}}const M=x,T=h!==void 0?Number(h):-1;if(o&&T>=0){const v=this.deltas.get(T)??0;if(this._materialize(T),(this.deltas.get(T)??0)!==v)continue}return{index:T,total:S,cumulative:M?.cumulative,currentValue:M?.currentValue,safeIndex:M?.safeIndex}}}prefixSum(e,n){if(e<0||Number.isNaN(e))return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};if(this.size===0)return{cumulative:0,total:this.total??0,currentValue:0,safeIndex:0};const i=G(Math.trunc(e),0,this.size-1),a=n?.materializeOption;this._materializeRanges(a,i,!0);let o=0,l=i+1;for(;l>0;){const h=this.tree.get(l)??0;o+=h;const x=Ft(l);if(x===0)break;l-=x}const m=a?.materialize?this.get(i):(this.deltas.get(i)||0)+this.baseValue;return{cumulative:o+this.baseValue*(i+1),total:this.total,currentValue:m,safeIndex:i}}get(e,n){if(this.size===0)return 0;if(!Number.isInteger(e)||e<0||e>=this.size)throw new Error("Index out of bounds");const i=n?.materializeOption;return this._materializeRanges(i,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const n=e?.materializeOption;if(this._materializeRanges(n),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const i=this.prefixSum(this.getSize()-1);i.cumulative!==i.total&&z.error("Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const i=this.valueFn;this.reset(this.size,a=>i(a),{materialize:!0});return}const n=new Map;for(const[i,a]of this.deltas.entries()){if(a===0)continue;let o=i+1;for(;o<=this.size;){n.set(o,(n.get(o)??0)+a);const l=Ft(o);if(l===0)break;o+=l}}this.tree=n,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const[n,i]of this.deltas)n<this.size&&(e+=i);return this.total-e}changeSize(e){if(!Number.isFinite(e))throw new Error(`Size must be a finite number: ${e}`);const n=Math.max(0,Math.trunc(e)),i=this.size;if(n===i)return;if(n>i)if(i===0&&this.deltas.size>0){for(const o of this.deltas.keys())o>=n&&this.deltas.delete(o);this.size=n,this.rebuildTree()}else this._growSize(i,n);else{if(n>0)for(const o of this.deltas.keys())o>=n&&this.deltas.delete(o);this.size=n,this.rebuildTree()}const a=this.prefixSum(this.getSize()-1);a.cumulative!==a.total&&z.error("Inconsistent Fenwick Tree state")}static _minCoveredLowBound(e,n){let i=1;for(;;){const a=i*2;if(Math.floor(n/a)*a<=e)break;i=a}return i*Math.floor(e/i)}_propagateDeltaToGrownNodes(e,n,i,a){let o=e+1;for(;o<=i;){const l=Ft(o);if(l===0)break;o+=l}for(;o<=a;){this.tree.set(o,(this.tree.get(o)??0)+n);const l=Ft(o);if(l===0)break;o+=l}}_growSize(e,n){if(this.size=n,this.deltas.size>0){const i=Tt._minCoveredLowBound(e,n);if(e-i<this.deltas.size)for(let o=i;o<e;o++){const l=this.deltas.get(o);l===void 0||l===0||this._propagateDeltaToGrownNodes(o,l,e,n)}else for(const[o,l]of this.deltas.entries())l===0||o<i||this._propagateDeltaToGrownNodes(o,l,e,n)}this.total=this._computeTreeTotal()}getSize(){return this.size}get base(){return this.baseValue}findIndexAtOrAfter(e,n){return this._findIndex(e,n??{},!0)}findIndexAtOrBefore(e,n){return this._findIndex(e,n??{},!1)}}const on=(r,e)=>{const n=r?.sampleRange,i=e?.sampleRange;return n===i?!1:n&&i?n.from!==i.from||n.to!==i.to:!0},gr=(r,e,n)=>{const i=Number.isFinite(r)&&r>0?Math.trunc(r):0,a=t.useRef(null),o=t.useRef({size:i,valueOrFn:e,options:n});a.current===null&&(a.current=new Tt(i,e,n));const l=a.current,m=o.current,h=m.size!==i,x=m.valueOrFn!==e,S=on(m.options,n)||m.options?.baseValue!==n?.baseValue,M=m.size===0&&i>0&&(!a.current||a.current.base===0);if(x||S){const T=n?.resetOnValueFnChange??!0;S||x&&T||M?(n?.debug&&z.debug("[useFenwickMapTree] reset",{valueOrFnChanged:x,optionsChanged:S}),l.reset(i,e,n)):(h&&(n?.debug&&z.debug("[useFenwickMapTree] resize (with valueFn change)",{from:m.size,to:i}),l.changeSize(i)),n?.debug&&z.debug("[useFenwickMapTree] setValueFn (no reset)",{valueOrFnChanged:x}),l.setValueFn(e,{reset:!1})),o.current={size:i,valueOrFn:e,options:n}}else h&&(n?.debug&&z.debug("[useFenwickMapTree] resize",{from:m.size,to:i}),M?l.reset(i,e,n):l.changeSize(i),o.current={size:i,valueOrFn:e,options:n});return l};class ln{key;value;prev=null;next=null;constructor(e,n){this.key=e,this.value=n}}class lr{head=null;tail=null;addToTail(e){this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=null,e.next=null}removeHead(){const e=this.head;return e&&this.remove(e),e}moveToTail(e){this.remove(e),this.addToTail(e)}}function Nr(r){const e=t.useRef(new Map),n=t.useRef(new lr),i=Math.floor(r),a=t.useRef(i);t.useEffect(()=>{if(a.current=i,Number.isNaN(i)||i<0){z.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`),e.current.clear(),n.current=new lr;return}if(Number.isFinite(i))for(;e.current.size>i;){const S=n.current.removeHead();if(S)e.current.delete(S.key);else break}},[r,i]);const o=t.useCallback(S=>{const M=e.current.get(S);if(M)return n.current.moveToTail(M),M.value},[]),l=t.useCallback((S,M)=>{const T=a.current;if(Number.isNaN(T)||T<=0)return;let v=e.current.get(S);if(v)v.value=M,n.current.moveToTail(v);else{if(e.current.size>=T){const V=n.current.removeHead();V&&e.current.delete(V.key)}v=new ln(S,M),e.current.set(S,v),n.current.addToTail(v)}},[]),m=t.useCallback(S=>e.current.has(S),[]),h=t.useCallback(S=>{const M=e.current.get(S);M&&(n.current.remove(M),e.current.delete(S))},[]),x=t.useCallback(()=>{e.current.clear(),n.current=new lr},[]);return t.useMemo(()=>({get:o,set:l,has:m,remove:h,clear:x}),[o,l,m,h,x])}const cn=1e4,un=()=>{const{get:r,set:e,has:n,clear:i}=Nr(cn);return t.useMemo(()=>({get:r,set:e,has:n,clear:i}),[r,e,n,i])},fn=(r,e)=>{const n=t.useRef(e),i=t.useRef(r);t.useLayoutEffect(()=>{n.current=e,i.current=r},[e,r]);const a=t.useRef(new WeakMap);return t.useCallback(o=>{if(!o||a.current.has(o))return;const l=m=>{n.current?.enableBridge!==!1&&i.current.current?.applyWheel(m)};return o.addEventListener("wheel",l,{passive:!1}),a.current.set(o,l),()=>{a.current.get(o)===l&&(o.removeEventListener("wheel",l),a.current.delete(o))}},[])},Ae=(r,e)=>e<=0?0:G(r,0,e-1),Mr=r=>({top:Math.max(0,r?.top??0),bottom:Math.max(0,r?.bottom??0)}),st=(r,e)=>r<=e?0:r-e,Lt=(r,e)=>r<=0?0:r+e,jt=1e3,fr=2e3,Vr=1048576,dn=40,$t=r=>{if(!Number.isFinite(r))return 0n;const e=Math.trunc(r);return e<=0?0n:BigInt(e)},mn=(r,e,n,i,a,o,l,m)=>{const h=$t(i);if(h===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const x=_=>_<0n?0n:_>=h?h-1n:_,S={materializeOption:{materialize:!1}},{index:M,cumulative:T}=o.findIndexAtOrAfter(r,S);let v;M===-1?v=h-1n:(T===r?v=$t(M+1):v=$t(M),v>=h&&(v=h-1n)),r<=0&&(v=0n),m&&r>=l&&(v=h-1n);const V=_=>{const O=Number(_);if(!Number.isSafeInteger(O))return null;const{cumulative:N}=o.prefixSum(O,{materializeOption:{materialize:!1}});if(!Number.isFinite(N))return null;const{index:K}=o.findIndexAtOrAfter(N+.5,{materializeOption:{materialize:!1}});if(K===-1)return null;const Q=$t(K);return Q>_?Q:null},J=_=>{let O=0,N=_,K=_,Q=0n,re=0;for(;N<h&&O<e;){const se=Number(N),ye=a(se);if(O+=ye,K=N,N+=1n,Q+=1n,!Number.isFinite(ye)||ye<0)break;if(ye===0){if(re+=1,re>jt){const A=V(K);if(A!==null&&A>N)N=A,re=0;else if(A!==null&&A===N&&a(Number(N))>0)re=0;else break}}else re=0}return Q===0n&&(K=_),{height:O,end:K}};let{height:$,end:oe}=J(v);if($<e&&v>0n){let _=v,O=$,N=0;for(;_>0n&&O<e;){_-=1n;const Q=Number(_),re=a(Q);if(O+=re,!Number.isFinite(re)||re<0)break;if(re===0){if(N+=1,N>jt){const se=Number(_);if(!Number.isSafeInteger(se))break;const{cumulative:ye}=o.prefixSum(se,{materializeOption:{materialize:!1}});if(!Number.isFinite(ye))break;const{index:A}=o.findIndexAtOrAfter(ye-.5,{materializeOption:{materialize:!1}}),C=A===-1?-1n:$t(A);if(C>=0n&&C<_)_=C+1n,N=0;else if(C===_&&_>=1n&&a(Number(_-1n))>0)N=0;else break}}else N=0}v=x(_);const K=J(v);$=K.height,oe=K.end}const be=x(v),ue=x(oe),le=x(be-BigInt(Math.max(0,n))),ne=x(ue+BigInt(Math.max(0,n)));return{renderingStartIndex:Ae(Number(le),i),renderingEndIndex:Ae(Number(ne),i),visibleStartIndex:Ae(Number(be),i),visibleEndIndex:Ae(Number(ue),i)}},Ar=(r,e,n,i,a,o,l)=>{if(i===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const m=Number.isFinite(l),h=m?Math.min(Math.max(0,r),l):Math.max(0,r);if(i>=Number.MAX_SAFE_INTEGER)return mn(h,e,n,i,a,o,l,m);const{index:x,cumulative:S,currentValue:M}=o.findIndexAtOrAfter(h,{materializeOption:{materialize:!1}}),T=x===-1?e<=0||(S??0)<h+(M??0)?i-1:0:x;let v=Ae(T,i),V=0;if(x!==-1&&S===h)v=Ae(x+1,i),V=0;else if(v===x&&S!==void 0&&M!==void 0)V=S-M-h;else{const{cumulative:_,currentValue:O}=o.prefixSum(v,{materializeOption:{materialize:!1}});V=(_??0)-(O??0)-h}const J=V,$=(_,O)=>{let N=_,K=O,Q=0;for(;N<i&&K<e;){const re=a(N);if(K+=re,N++,!Number.isFinite(re)||re<0)break;if(re===0){if(Q++,Q>jt){const{cumulative:se}=o.prefixSum(N-1,{materializeOption:{materialize:!1}}),{index:ye}=Number.isFinite(se)?o.findIndexAtOrAfter(se+.5,{materializeOption:{materialize:!1}}):{index:-1};if(ye>N)N=ye,Q=0;else if(ye===N&&a(N)>0)Q=0;else break}}else Q=0}return{cursor:N,height:K}},oe=$(v,V);let be=oe.cursor;if(V=oe.height,V<e&&v>0){let _=V+Math.abs(Math.min(0,J)),O=v-1,N=0;for(;O>=0&&_<e;){const Q=a(O);if(_+=Q,!Number.isFinite(Q)||Q<0){O--;break}if(Q===0){if(N++,N>jt){const{cumulative:re}=o.prefixSum(O,{materializeOption:{materialize:!1}}),{index:se}=Number.isFinite(re)?o.findIndexAtOrAfter(re-.5,{materializeOption:{materialize:!1}}):{index:-1};if(se!==-1&&se<O){O=se,N=0;continue}if(se===O&&O>=1&&a(O-1)>0)N=0;else{O--;break}}}else N=0;O--}v=Ae(O+1,i);const K=$(v,0);be=K.cursor,V=K.height}const ue=Ae(v-n,i),le=Ae(Math.max(be-1,v),i),ne=Ae(le+n,i);return{renderingStartIndex:ue,renderingEndIndex:ne,visibleStartIndex:v,visibleEndIndex:le}},Ir=(r,e,n)=>{const i=Math.max(0,e??0),a=t.useRef({last:0,id:null,arg:null}).current;return t.useEffect(()=>()=>{if(a.id!==null&&(cancelAnimationFrame(a.id),a.id=null),a.arg!==null&&r.current){try{n(r.current,a.arg)}catch(o){console.error("[useThrottledInvoker] Error flushing pending callback on unmount",o)}a.arg=null}},[a,r,n]),t.useCallback(o=>{if(a.arg=o,a.id!==null)return;const l=m=>{if(a.id=null,a.arg===null)return;const h=m-a.last;if(i===0||a.last===0||h>=i){if(r.current)try{n(r.current,a.arg)}catch(x){console.error("[useThrottledInvoker] Error invoking callback",x)}a.arg=null,a.last=m}a.arg!==null&&(a.id=requestAnimationFrame(l))};a.id=requestAnimationFrame(l)},[i,n,r,a])},hn=t.memo(({index:r,top:e,height:n,item:i,children:a,clipItemHeight:o,enableKeyboardNavigation:l,onKeyDown:m,onEscapeKeyDown:h,onFocus:x,registerItemRef:S})=>{const M=t.useCallback($=>S(r,$),[r,S]),T=t.useCallback($=>m($,r),[r,m]),v=t.useCallback($=>h?.($,r),[r,h]),V=t.useCallback(()=>x(r),[r,x]),J=t.useCallback($=>{$.currentTarget.focus({preventScroll:!0})},[]);return H.jsx("div",{ref:M,"data-index":r,"data-virtualscroll-item":"true",className:"aqvs-item-container",style:{top:e,height:n,overflow:o?"hidden":void 0},tabIndex:l?-1:void 0,onPointerDown:l?J:void 0,onKeyDownCapture:l?T:void 0,onKeyDown:l&&h?v:void 0,onFocusCapture:l?V:void 0,children:a(i,r)})}),pn=({itemCount:r,getItem:e,getItemKey:n,getItemHeight:i,viewportSize:a,overscanCount:o=15,className:l,testId:m,onScroll:h,onRangeChange:x,children:S,background:M,initialScrollIndex:T,initialScrollOffset:v,initialScrollAnchor:V,callbackThrottleMs:J=5,contentInsets:$,onItemFocus:oe,scrollBarOptions:be,behaviorOptions:ue,onWheelHorizontal:le,onPanHorizontal:ne,horizontalKeyInputs:_,horizontalKeyStep:O=dn,contentProps:N,liveRegion:K},Q)=>{const{width:re,enableThumbDrag:se,enableTrackClick:ye,enableArrowButtons:A,enableScrollToTopBottomButtons:C,renderThumbOverlay:j,tapScrollCircleOptions:ce}=be??{},{enablePointerDrag:Xe,pointerDragInputs:qe,enableKeyboardNavigation:D=!0,enableEscapeRowReturn:Ze=!1,wheelSpeedMultiplier:it,inertiaOptions:Ye,overscrollBehavior:xe,clipItemHeight:ve=!1,resetOnGetItemHeightChange:Re=!1}=ue??{},[Qe,ee]=t.useState(0),te=a??Qe,mt=t.useCallback(c=>{ee(g=>g===c?g:c)},[]),P=t.useRef(null),Me=t.useRef({renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0,scrollPosition:0,totalHeight:0}),F=t.useRef(V&&r>0?{index:G(Math.trunc(V.index),0,r-1),align:"top",offset:-Math.max(0,V.offsetPx??0)}:null),We=t.useRef(!1),ut=t.useRef(!0);t.useEffect(()=>{if(ut.current){ut.current=!1;return}Re&&(F.current=null)},[Re,i]);const k=t.useMemo(()=>Mr($),[$]),[ht]=t.useState(()=>{const g=V?.index??T,s=typeof g=="number"&&Number.isFinite(g)?Math.max(0,Math.trunc(g)):0;return{from:Math.max(0,s-50),to:s+50}}),yt=t.useMemo(()=>({sampleRange:ht,resetOnValueFnChange:Re,materialize:!0}),[Re,ht]),I=gr(r,i,yt),[Oe]=t.useState(()=>{let c=0,g=0;if(V&&r>0){const s=G(Math.trunc(V.index),0,r-1),f=Math.max(0,V.offsetPx??0),p=G(s-o*2,0,r-1),R=G(s+o*2,0,r-1),y=s>0||f>0?{materializeOption:{materialize:!0,ranges:[{from:p,to:R}]}}:void 0,{cumulative:X,total:Se,currentValue:ae}=I.prefixSum(s,y),pe=Math.max(X-ae+f,0);c=Lt(pe,k.top),g=Se??I.getTotal()}else if(typeof T=="number"){const s=G(T,0,r-1),f=G(s-o*2,0,r-1),p=G(s+o*2,0,r-1),R=T>0?{materializeOption:{materialize:!0,ranges:[{from:f,to:p}]}}:void 0,{cumulative:y,total:X,currentValue:Se}=I.prefixSum(T,R),ae=Math.max(y-Se,0);c=Lt(ae,k.top),g=X??I.getTotal()}else typeof v=="number"&&(c=Lt(Math.max(v,0),k.top)),g=I.getTotal();return{position:c,total:g}}),[$e,pt]=t.useState(Oe.position),[Ce,vt]=t.useState(Oe.total),d=t.useRef(Oe.position),q=t.useRef(k.top),Z=t.useRef(h??void 0),U=t.useRef(x??void 0),me=t.useRef(le),B=(_?.length??0)>0,ie=!!le;t.useEffect(()=>{B&&(D||z.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."),ie||z.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."),Number.isFinite(O)&&O>0||z.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${O}. Horizontal arrow keys are left untouched.`))},[B,ie,D,O]);const ge=t.useRef(new Map),W=t.useRef(null),he=t.useRef(null),[Pe,Ie]=t.useState(null),[fe,je]=t.useState(!1),ze=t.useRef(null),Le=t.useRef(!1),we=t.useRef(0),Be=t.useRef(!1),at=t.useRef(!1),b=t.useRef(r);b.current!==r&&(b.current=r,at.current=!0),t.useLayoutEffect(()=>{Z.current=h??void 0,U.current=x??void 0,me.current=le},[x,h,le]);const w=t.useCallback(c=>{if(D&&c&&typeof c.focus=="function")try{c.focus({preventScroll:!0})}catch{c.focus()}},[D]),ke=t.useCallback((c,{position:g,totalHeight:s})=>{c(g,s)},[]),Fe=Ir(Z,J,ke),_e=t.useCallback((c,g)=>{c(g)},[]),Ue=Ir(U,J,_e),Ee=t.useRef(k.top);Ee.current=k.top;const gt=t.useRef(Fe);gt.current=Fe,t.useEffect(()=>(We.current=!1,()=>{We.current=!0,ze.current&&(clearTimeout(ze.current),ze.current=null)}),[]),t.useEffect(()=>{D||(ge.current.clear(),W.current=null,he.current=null)},[D]);const wt=t.useCallback((c,g)=>{if(!g){ge.current.delete(c);return}D&&(ge.current.set(c,g),W.current===c&&(W.current=null,he.current=c,w(g)))},[D,w]),ft=.01,ot=t.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:Oe.position}),St=t.useCallback(()=>{const c=ot.current;c.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c.rafId),c.rafId=null,c.loopActive=!1,c.idleFrames=0},[]);t.useEffect(()=>()=>{St()},[St]);const kt=t.useRef(()=>{}),Et=t.useCallback(()=>{const c=ot.current;c.rafId=null;const g=d.current,s=st(g,Ee.current),f=I.getTotal();if(pt(R=>Math.abs(R-g)<ft?R:g),Math.abs(c.lastRenderedPosition-g)>=ft?(gt.current({position:s,totalHeight:f}),c.lastRenderedPosition=g,c.idleFrames=0):c.idleFrames+=1,c.idleFrames>=2){St();return}if(typeof requestAnimationFrame=="function"){c.rafId=requestAnimationFrame(R=>kt.current(R));return}c.loopActive=!1},[I,St]);kt.current=Et;const Rt=t.useCallback(()=>{const c=ot.current;if(c.idleFrames=0,!c.loopActive){if(c.loopActive=!0,typeof requestAnimationFrame=="function"){c.rafId=requestAnimationFrame(Et);return}c.loopActive=!1}},[Et]),Te=t.useCallback((c,g)=>{const s=g?.immediate??!1,f=st(c,k.top);if(d.current=c,s){ot.current.lastRenderedPosition=c,ot.current.idleFrames=0,pt(c),Fe({position:f,totalHeight:I.getTotal()});return}Rt()},[Rt,I,k.top,Fe]),bt=t.useCallback((c,g=0)=>{const s=P.current;if(!s)return c;const f=s.getScrollPosition();we.current+=1;const p=s.getContentSize()+g,R=s.getViewportSize(),y=s.scrollTo(c,{contentSize:p,viewportSize:R});return y===f&&(we.current=Math.max(0,we.current-1)),Math.abs(y-c)>.5&&(Be.current=!0),y},[]),Nt=t.useRef(!1);t.useEffect(()=>{if(!Nt.current)if(Nt.current=!0,V==null&&typeof T!="number"&&typeof v=="number"){const c=Lt(Math.max(v,0),k.top),g=Math.abs(c-d.current)>.5;Te(c,{immediate:!0}),g&&P.current?.scrollTo(c)}else Te(d.current,{immediate:!0})},[V,T,v,k.top,Te]),t.useEffect(()=>{const c=I.getTotal();if(Ce!==c){vt(c);return}if(Be.current){Be.current=!1;const g=P.current;if(g&&Math.abs(g.getScrollPosition()-d.current)>.5){const s=bt(d.current);Be.current=!1,Te(s,{immediate:!0})}}},[I,Ce,r,bt,Te]),t.useEffect(()=>{if(F.current!==null){const{index:c,align:g,offset:s}=F.current,f=Ae(c,r),{cumulative:p,currentValue:R}=I.prefixSum(f,{materializeOption:{materialize:!1}});if(p!==void 0&&R!==void 0){const y=Math.max(p-R,0);let X=y;g==="bottom"?X=p-te:g==="center"&&(X=y+R/2-te/2),s&&(X-=s),X=Math.max(0,X);const Se=Math.max(0,Ce+k.top+k.bottom-te),ae=Math.min(Lt(X,k.top),Se);Math.abs(ae-d.current)>1&&(z.debug("[VirtualScroll] Drift correction",{from:d.current,to:ae,targetIndex:f}),we.current===0&&(we.current+=1),P.current?.scrollTo(ae),Te(ae,{immediate:!0}))}}at.current=!1},[Ce,I,r,k.top,Te,te,k.bottom]),t.useEffect(()=>{const c=q.current;if(c===k.top||(q.current=k.top,F.current))return;const g=st(d.current,c),s=Lt(g,k.top);d.current=s,P.current?.scrollTo(s),Te(s,{immediate:!0})},[k.top,Te]);const Vt=t.useCallback((c,g)=>{if(r===0)return;const s=Ae(c,r),f=I.get(s),p=g-f,R=I.update(s,g);R!==void 0&&vt(R),z.debug("[VirtualScroll] Updated item size manually",{index:s,size:g,total:R});let y=F.current?F.current.index:null;if(y===null){const X=d.current,Se=Mr($).top,ae=st(X,Se),{index:pe,cumulative:tt}=I.findIndexAtOrAfter(ae,{materializeOption:{materialize:!1}});y=tt!==void 0&&tt===ae?pe+1:pe}if(y!==-1&&s<y&&p!==0){const X=d.current,Se=X+p;bt(Se,p),Te(Se,{immediate:!0}),z.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)",{from:X,to:Se,causedByIndex:s,delta:p,activeVisibleStartIndex:y})}},[I,r,bt,Te,$]),u=t.useCallback((c,g)=>{if(!P.current||r===0)return;const s=Ae(c,r),f=Ae(s-o*2,r),p=Ae(s+o*2,r),{cumulative:R,total:y,currentValue:X}=I.prefixSum(s,{materializeOption:{materialize:!0,ranges:[{from:f,to:p}]}});if(z.debug("[VirtualScroll] Scrolling to index:",s,"ItemBottom:",R,"Total height:",y,"ItemHeight:",X,"safeIndexFrom:",f,"safeIndexTo:",p),!y)return;const Se=Math.max(R-X,0);let ae=Se;g?.align==="bottom"?ae=R-te:g?.align==="center"&&(ae=Se+X/2-te/2),g?.offset&&(ae-=g.offset),ae=Math.max(0,ae);const pe=Lt(ae,k.top),tt=P.current?.getContentSize()??y+k.top+k.bottom,Ke=Math.max(0,tt-te),rt=Math.min(pe,Ke);F.current={index:s,align:g?.align,offset:g?.offset};const Bt=P.current?.getScrollPosition()??-1,nr=Math.abs(Bt-rt)>.5;Le.current=!1,we.current=0,nr&&(Le.current=!0,we.current+=1,P.current?.scrollTo(rt)),vt(y),Te(rt,{immediate:!0}),z.debug("[VirtualScroll] Setting scroll position to:",rt,{original:pe,max:Ke})},[I,o,r,k.top,k.bottom,te,Te]),E=t.useRef(V&&r===0?V:null);t.useEffect(()=>{const c=E.current;!c||r===0||(E.current=null,u(G(Math.trunc(c.index),0,r-1),{align:"top",offset:-Math.max(0,c.offsetPx??0)}))},[r,u]);const L=t.useCallback(c=>{if(!P.current||r===0)return;const g=I.getTotal(),s=G(Math.floor(c),0,g),{index:f,cumulative:p,currentValue:R}=I.findIndexAtOrAfter(s,{materializeOption:{materialize:!1}}),X=(p??0)-(R??0)-s;u(f,{offset:X})},[I,r,u]),Y=t.useCallback(()=>{if(r===0)return null;const c=st(d.current,k.top),{index:g,cumulative:s,currentValue:f}=I.findIndexAtOrAfter(c,{materializeOption:{materialize:!1}});if(g===-1)return{index:r-1,offsetPx:0};if(s===c)return{index:G(g+1,0,r-1),offsetPx:0};const p=(s??0)-(f??0);return{index:g,offsetPx:Math.max(0,c-p)}},[I,r,k.top]),de=t.useCallback(c=>{const g=st(d.current,k.top),s=typeof c=="function"?c(g):c;L(s);const f=P.current?.getScrollPosition(),p=typeof f=="number"?f:d.current;return Te(p),st(p,Ee.current)},[k.top,L,Te]),Ve=t.useCallback(c=>{const g=P.current;if(!g)return st(d.current,Ee.current);const s=g.scrollTo(f=>f+c);return st(s,Ee.current)},[]),Ne=t.useCallback(c=>P.current?.applyWheel(c)??!1,[]),De=t.useCallback((c,g)=>{z.debug("[VirtualScroll] Scroll position changed:",c);const s=Le.current;s&&(Le.current=!1);const f=we.current>0;f&&(we.current=0);const p=at.current&&b.current===r;if(s||f||p||(F.current=null),Te(c),C){if(s||f)return;const R=c-g;if(z.debug("[VirtualScroll] Scroll diff:",R,"New:",c,"Prev:",g),Math.abs(R)>1){const y=R>0?"down":"up";Ie(y),je(!0),z.debug("[VirtualScroll] Showing scroll buttons. Direction:",y),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>{je(!1),z.debug("[VirtualScroll] Hiding scroll buttons")},2e3)}}},[Te,C,r]),Ge=t.useMemo(()=>st($e,k.top),[k.top,$e]),He=t.useMemo(()=>{const c=I.getTotal(),g=Ar(Ge,te,o,r,i,I,c);return z.debug("[VirtualScroll] Calculated rendering range:",()=>({...g,scrollPosition:Ge,renderingContentSize:c,overscanCount:o,viewportSize:te})),g},[Ge,te,o,r,i,I]),{renderingStartIndex:nt,renderingEndIndex:lt,visibleStartIndex:Je,visibleEndIndex:et}=He,dt=t.useCallback((c,g)=>{if(!D||r===0)return;const s=Ae(c,r);if(!(g?.ensureVisible??!0)){const Ke=ge.current.get(s);Ke&&(W.current=null,he.current=s,w(Ke));return}const p=I.prefixSum(s,{materializeOption:{materialize:!1}}),R=p.currentValue,y=Math.max(p.cumulative-R,0),X=y+R,Se=st(d.current,k.top),ae=Se+te;if(y<Se||X>ae){u(s);const Ke=ge.current.get(s);Ke?(W.current=null,he.current=s,w(Ke)):W.current=s;return}const tt=ge.current.get(s);if(tt){W.current=null,he.current=s,w(tt);return}W.current=s},[D,r,I,k.top,u,w,te]),Gt=t.useCallback((c,g)=>{if(!(!D||c.defaultPrevented)&&!(c.altKey||c.metaKey||c.ctrlKey)&&c.target===c.currentTarget&&!c.currentTarget.isContentEditable){if(c.key==="ArrowLeft"||c.key==="ArrowRight"){const s=me.current;if(!s||c.shiftKey||!_?.includes("arrow")||!(Number.isFinite(O)&&O>0))return;c.preventDefault(),s(c.key==="ArrowLeft"?-O:O);return}if(c.key==="ArrowDown"){g<r-1&&(c.preventDefault(),dt(g+1));return}if(c.key==="ArrowUp"){g>0&&(c.preventDefault(),dt(g-1));return}if(c.key==="PageDown"){if(g<r-1){c.preventDefault();const{visibleStartIndex:s,visibleEndIndex:f}=Me.current,p=Math.max(f-s+1,1),R=Math.max(p,1),y=Ae(Math.min(g+R,r-1),r);dt(y)}return}if(c.key==="PageUp"&&g>0){c.preventDefault();const{visibleStartIndex:s,visibleEndIndex:f}=Me.current,p=Math.max(f-s+1,1),R=Math.max(p,1),y=Ae(g-R,r);dt(y)}}},[D,r,dt,_,O]),Ht=t.useCallback((c,g)=>{if(c.key!=="Escape"||c.defaultPrevented||c.nativeEvent.isComposing||c.target===c.currentTarget)return;const s=c.target;s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement||s.isContentEditable||(c.preventDefault(),dt(g))},[dt]),Xt=t.useCallback(c=>{if(!D)return;const g=Ae(c,r);W.current=null,he.current=g,oe?.(g)},[D,r,oe]);t.useEffect(()=>{const c=P.current?.getScrollPosition()??0,g=d.current,s=st(g,k.top);z.debug("[VirtualScroll] Range change effect triggered",()=>({renderingStartIndex:nt,renderingEndIndex:lt,visibleStartIndex:Je,visibleEndIndex:et,scrollPositionState:$e,paneScrollPosition:g,logicalScrollPosition:s,contentSize:Ce,scrollPaneScrollPosition:c})),Ue({renderingStartIndex:nt,renderingEndIndex:lt,visibleStartIndex:Je,visibleEndIndex:et,scrollPosition:s,totalHeight:Ce})},[Ce,lt,nt,k.top,Ue,$e,et,Je]);const Kt=t.useCallback(()=>{if(!C)return null;const c=fe&&Pe!==null,g=Pe==="up";return H.jsx("div",{className:"aqvs-scroll-to-edge-overlay","data-visible":c,inert:!c,children:g?H.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top",children:H.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",tabIndex:c?0:-1,onClick:s=>{s.stopPropagation(),Le.current=!0,u(0),je(!1)},children:"Top"})}):H.jsx("div",{className:"aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom",children:H.jsx("button",{type:"button",className:"aqvs-scroll-to-edge-button",tabIndex:c?0:-1,onClick:s=>{s.stopPropagation(),Le.current=!0,u(r-1),je(!1)},children:"Bottom"})})})},[C,fe,Pe,u,r]),At=t.useRef(0),{visibleItems:Ct,renderAnchor:Pt}=t.useMemo(()=>{if(r===0)return{visibleItems:H.jsx("div",{className:"aqvs-no-items-container",children:H.jsx("div",{className:"aqvs-no-items-text",children:"No items"})}),renderAnchor:0};const c=Ae(nt,r),g=Ae(lt,r),{cumulative:s,currentValue:f}=I.prefixSum(c,{materializeOption:{materialize:!1}}),p=s-f;Number.isFinite(p)&&Math.abs(p-At.current)>Vr&&(At.current=p);const R=At.current,y=[],X=[];let Se=0,ae=p;for(let pe=c;pe<=g;pe++){if(X.length>=fr){z.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.",{cap:fr,safeRenderingStartIndex:c,safeRenderingEndIndex:g});break}const tt=i(pe),Ke=I.get(pe),rt=tt-Ke;rt!==0&&y.push({index:pe,value:tt});const Bt=ae+Se,nr=n?n(pe):pe;X.push(H.jsx(hn,{index:pe,top:Bt-R,height:tt,item:e(pe),clipItemHeight:ve,enableKeyboardNavigation:D,onKeyDown:Gt,onEscapeKeyDown:Ze?Ht:void 0,onFocus:Xt,registerItemRef:wt,children:S},nr)),Se+=rt,ae+=Ke}return y.length>0&&Promise.resolve().then(()=>{if(We.current)return;let pe=0;for(const rt of y)if(rt.index<Je){const Bt=I.get(rt.index);pe+=rt.value-Bt}const tt=I.updates(y);if(We.current||typeof tt!="number")return;vt(tt),z.debug("[VirtualScroll] Updated heights for items",y,"New total height:",tt);const Ke=P.current?.getScrollPosition()??d.current;if(pe!==0){const rt=Ke+pe;bt(rt,pe),Te(rt,{immediate:!0}),z.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)",{from:Ke,to:rt,shiftAmount:pe})}else Ke!==d.current&&Te(Ke)}),{visibleItems:X,renderAnchor:R}},[S,ve,Ce,D,r,I,e,n,i,Xt,Gt,Ze,Ht,bt,wt,lt,nt,Te,Je]),Zt=t.useCallback(c=>{const g=(J??0)>0,s=Math.abs(c-$e),f=g&&s>.5?$e:c,p=st(f,k.top);if(z.debug("[VirtualScroll] Rendering visible items",()=>({currentScrollPosition:c,effectiveScrollPosition:p,renderingStartIndex:nt,renderingEndIndex:lt,itemCount:r,viewportSize:te,callbackThrottleMs:J,diff:s,rawEffectiveScrollPosition:f})),r===0)return Ct;const R=k.top+Pt-f,y=k.bottom>0?H.jsx("div",{className:"aqvs-bottom-inset",style:{top:I.getTotal()-Pt,height:k.bottom}},"virtualscroll-bottom-inset"):null;return z.debug("[VirtualScroll] Rendering items",()=>({containerTop:R,logicalScrollPosition:Ge,resolvedInsets:k,effectiveScrollPosition:p})),H.jsxs("div",{className:"aqvs-items-wrapper",style:{top:0,transform:`translateY(${R}px)`,willChange:"transform"},children:[Ct,y]})},[J,r,I,Ge,Pt,lt,nt,k,$e,te,Ct]),qt=t.useMemo(()=>({renderingStartIndex:He.renderingStartIndex,renderingEndIndex:He.renderingEndIndex,visibleStartIndex:He.visibleStartIndex,visibleEndIndex:He.visibleEndIndex,scrollPosition:Ge,totalHeight:I.getTotal()}),[He,Ge,I,Ce]);t.useEffect(()=>{Me.current=qt},[qt]);const[Qt,Jt]=t.useState(""),er=t.useRef(K);t.useLayoutEffect(()=>{er.current=K},[K]);const ct=K?.debounceMs??400,Dt=Number.isFinite(ct)&&ct>=0,Mt=K!==void 0;t.useEffect(()=>{Mt&&!Dt&&z.warn(`[VirtualScroll] liveRegion.debounceMs must be a finite number >= 0, received ${ct}. Announcements are disabled.`)},[Mt,Dt,ct]),t.useEffect(()=>{if(!(Mt&&Dt)){Jt("");return}const c=setTimeout(()=>{const g=er.current?.format;if(!g)return;const s=g({visibleStartIndex:Je,visibleEndIndex:et,itemCount:r});Jt(s)},ct);return()=>clearTimeout(c)},[Mt,Dt,ct,Je,et,r]),t.useImperativeHandle(Q,()=>({getScrollPosition:()=>{const c=P.current?.getScrollPosition();return typeof c=="number"?st(c,Ee.current):-1},getContentSize:()=>P.current?.getContentSize()??-1,getViewportSize:()=>P.current?.getViewportSize()??-1,scrollTo:de,scrollBy:Ve,applyWheel:Ne,scrollToIndex:u,getFenwickTreeTotalHeight:()=>I.getTotal(),getFenwickSize:()=>I.getSize(),focusItemAtIndex:dt,getRange:()=>Me.current,getScrollAnchor:Y,updateItemSize:Vt}),[de,Ve,Ne,u,I,dt,Y,Vt]);const _t=I.getTotal()+k.top+k.bottom,Yt=H.jsx(kr,{ref:P,contentSize:_t,viewportSize:a,onViewportSizeChange:mt,className:l,testId:m,onScroll:De,background:M,tapScrollCircleOptions:ce,inertiaOptions:Ye,overscrollBehavior:xe,itemCount:r,scrollBarWidth:re,enableThumbDrag:se,enableTrackClick:ye,enableArrowButtons:A,enablePointerDrag:Xe,pointerDragInputs:qe,renderThumbOverlay:j,wheelSpeedMultiplier:it,onWheelHorizontal:le,onPanHorizontal:ne,contentInsets:k,contentProps:N,visibleStartIndex:Je,visibleEndIndex:et,renderOverlay:Kt,initialScrollPosition:Oe.position,children:Zt});return Mt?H.jsxs(H.Fragment,{children:[Yt,H.jsx("div",{className:"aqvs-live-region",role:"status","aria-live":"polite","aria-atomic":"true","data-aqvs-live-region":"",children:Qt})]}):Yt},Dr=t.forwardRef(pn),Ut=262144,Tr=3,Lr=32768,dr=128,mr=128,yr=10,gn=(r,e)=>Math.max(1,Math.floor((r??Lr)/Math.max(1,e))),bn=(r,e,n,i,a)=>{let o=0,l=0,m=Math.max(0,Math.min(i,n-1));for(;m<n&&o<r&&l<fr;)o+=e(m),l+=1,m+=1;return Math.max(1,l+2*a+2)},rr=(r,e,n)=>{if(!(Number.isInteger(r)&&r>=0&&r<=Ut))throw new RangeError(`[VirtualGrid] ${e==="row"?"getRowHeight":"getColWidth"}(${n}) returned ${r} — must be an integer in [0, ${Ut}] (0 = hidden). Oversized tracks would pierce the browser layout-coordinate wall (see the design plan §3.1/§6).`);return r},xn=(r,e,n,i,a,o,l,m)=>{const h=Ar(r,e,n,i,a,o,l);if(i===0)return{renderingColStart:0,renderingColEnd:0,visibleColStart:0,visibleColEnd:0,colAnchor:0};const x=G(h.renderingStartIndex,0,i-1),{cumulative:S,currentValue:M}=o.prefixSum(x,{materializeOption:{materialize:!1}}),T=S-M,v=Number.isFinite(T)&&Math.abs(T-m)>Vr?T:m;return{renderingColStart:h.renderingStartIndex,renderingColEnd:h.renderingEndIndex,visibleColStart:h.visibleStartIndex,visibleColEnd:h.visibleEndIndex,colAnchor:v}},vn=[],wn=(r,e,n,i,a)=>{const o=[],l=[];if(e<r)return{columns:o,widthUpdates:l,truncated:0};const m=i.prefixSum(r,{materializeOption:{materialize:!1}});let h=m.cumulative-m.currentValue,x=0,S=r;for(;S<=e;){if(o.length>=a)return{columns:o,widthUpdates:l,truncated:e-S+1};const M=n(S),T=i.get(S);if(M!==T&&l.push({index:S,value:M}),M>0){o.push({col:S,left:h,width:M}),h+=T,x=0,S+=1;continue}if(h+=T,x+=1,S+=1,x>jt){const v=i.findIndexAtOrAfter(h+.5,{materializeOption:{materialize:!1}});if(v.index===-1||v.index<=S||!Number.isSafeInteger(v.index))break;const V=i.prefixSum(v.index,{materializeOption:{materialize:!1}});h=V.cumulative-V.currentValue,S=v.index,x=0}}return{columns:o,widthUpdates:l,truncated:0}},Sn=(r,e,n)=>{const i=[],a=[];let o=0;for(let l=0;l<r;l+=1){const m=e(l),h=n.get(l);m!==h&&a.push({index:l,value:m}),m>0&&i.push({col:l,left:o,width:m}),o+=h}return{columns:i,widthUpdates:a,width:o}},Rn={renderingColStart:0,renderingColEnd:0,visibleColStart:0,visibleColEnd:0,colAnchor:0,key:"0:0:0"},Mn=({rowCount:r,colCount:e,getRowHeight:n,getColWidth:i,getCell:a,getCellKey:o,children:l,getCellProps:m,getRowProps:h,contentProps:x,background:S,contentInsets:M,onRowFocus:T,frozenLeadingCols:v=0,frozenLeadingRows:V=0,horizontalKeyInputs:J,horizontalKeyStep:$,onScroll:oe,onRangeChange:be,onRenderTruncated:ue,callbackThrottleMs:le,initialScrollAnchor:ne,overscanRows:_=Tr,overscanCols:O=Tr,viewportSize:N,__maxRenderedCells:K,behaviorOptions:Q,scrollBarOptions:re,liveRegion:se,className:ye,testId:A},C)=>{const j=t.useRef(null),ce=t.useRef(null),Xe=t.useRef(n);Xe.current=n;const qe=t.useRef(i);qe.current=i;const D=Q?.resetOnGetColWidthChange===!0,it=Q?.resetOnGetItemHeightChange===!0?n:null,Ye=D?i:null,xe=t.useCallback(s=>rr(Xe.current(s),"row",s),[it]),ve=t.useCallback(s=>rr(qe.current(s),"col",s),[Ye]),Re=Q?.defaultColWidth,Qe=t.useMemo(()=>{if(Re!==void 0&&!(Number.isInteger(Re)&&Re>=0&&Re<=Ut))throw new RangeError(`[VirtualGrid] behaviorOptions.defaultColWidth must be an integer in [0, ${Ut}], received ${Re}.`);return{resetOnValueFnChange:D,baseValue:Re}},[D,Re]),ee=gr(e,ve,Qe),[te,mt]=t.useState(0);if(!(Number.isInteger(v)&&v>=0&&v<=dr))throw new RangeError(`[VirtualGrid] frozenLeadingCols must be an integer in [0, ${dr}], received ${v}.`);const P=Math.min(v,e),Me=t.useRef(0);if(!(Number.isInteger(V)&&V>=0&&V<=mr))throw new RangeError(`[VirtualGrid] frozenLeadingRows must be an integer in [0, ${mr}], received ${V}.`);const F=Math.min(V,r),We=Math.max(0,r-F),ut=t.useRef(!1),k=t.useRef(0),[ht,yt]=t.useState(0),{frozenRows:I,frozenHeight:Oe}=t.useMemo(()=>{if(F===0)return{frozenRows:[],frozenHeight:0};const s=[];let f=0;for(let p=0;p<F;p+=1){const R=xe(p);R>0&&s.push({row:p,top:f,height:R}),f+=R}return{frozenRows:s,frozenHeight:f}},[F,ht,xe]);k.current=Oe;const $e=t.useCallback(s=>xe(s+F),[xe,F]),pt=t.useRef(T);pt.current=T;const Ce=T!==void 0,vt=t.useMemo(()=>Ce?s=>pt.current?.(s+F):void 0,[F,Ce]),d=Oe,[q,Z]=t.useState(F),U=t.useRef(null),me=t.useRef(!1);if(q!==F){Z(F),me.current=!0;const s=j.current?.getScrollAnchor()??null;U.current=s===null?null:{row:s.index+q,offsetPx:s.offsetPx}}const B=t.useRef(0),ie=t.useRef(0),ge=t.useRef(!1),[W,he]=t.useState(Rn),Pe=t.useRef(W);Pe.current=W;const Ie=t.useRef(0),[fe,je]=t.useState(()=>ee.getTotal()??0),ze=t.useRef(fe);ze.current=fe;const Le=t.useCallback(s=>{typeof s=="number"&&Number.isFinite(s)&&(ze.current=s,je(s))},[]);t.useLayoutEffect(()=>{const s=ee.getTotal();typeof s=="number"&&Number.isFinite(s)&&s!==ze.current&&Le(s)});const we=re?.width??12,Be=N===void 0?null:{width:Math.max(0,Math.round(N.width)-we),height:Math.max(0,Math.round(N.height)-we)},[at,b]=t.useState({width:0,height:0}),w=Be??at,ke=t.useRef(w);ke.current=w;const Fe=w.height>0&&w.height-Oe<=0;ut.current=Fe;const _e=Be!==null;t.useLayoutEffect(()=>{if(_e)return;const s=ce.current;if(s===null)return;const f=()=>{const R=Math.max(0,Math.round(s.clientWidth)-we),y=Math.max(0,Math.round(s.clientHeight)-we);b(X=>X.width===R&&X.height===y?X:{width:R,height:y})};f();const p=new ResizeObserver(f);return p.observe(s),()=>p.disconnect()},[we,_e]);const Ue=t.useCallback(()=>{const s=ce.current;s!==null&&s.style.setProperty("--aqvs-grid-hx-residual",`${Ie.current-B.current}px`)},[]),Ee=t.useCallback(()=>{const s=Math.max(0,ke.current.width-Me.current),f=xn(Me.current+B.current,s,O,e,ve,ee,ze.current,Pe.current.colAnchor);P>0&&(f.renderingColStart=Math.max(f.renderingColStart,P),f.visibleColStart=Math.max(f.visibleColStart,P),s<=0&&(f.renderingColStart=e,f.renderingColEnd=e-1,f.visibleColStart=e,f.visibleColEnd=e-1));const p=`${f.renderingColStart}:${f.renderingColEnd}:${f.colAnchor}`;p!==Pe.current.key&&he({...f,key:p})},[O,e,ve,ee,P]),[gt,wt]=t.useState(0),ft=t.useRef(null),ot=t.useCallback(()=>{ft.current===null&&(ft.current=requestAnimationFrame(()=>{ft.current=null,wt(B.current)}))},[]);t.useEffect(()=>()=>{ft.current!==null&&cancelAnimationFrame(ft.current)},[]);const St=t.useRef(oe);St.current=oe;const kt=t.useRef(be);kt.current=be;const Et=t.useRef(ue);Et.current=ue;const Rt=t.useRef(null),[Te,bt]=t.useState(null),[Nt,Vt]=t.useState(w.height);Nt!==w.height&&(Vt(w.height),bt(null));const u=ne===void 0||r===0?0:G(Math.trunc(ne.row),0,r-1),E=t.useMemo(()=>{const s=Rt.current?.renderingStartIndex??u;return bn(Math.max(0,w.height-k.current),xe,r,s,_)},[w.height,xe,r,u,_,d]),L=Te??E,Y=t.useCallback(()=>{const s=Rt.current;if(s===null)return null;const f=Pe.current;return{renderingRowStart:s.renderingStartIndex,renderingRowEnd:s.renderingEndIndex,visibleRowStart:s.visibleStartIndex,visibleRowEnd:s.visibleEndIndex,renderingColStart:f.renderingColStart,renderingColEnd:f.renderingColEnd,visibleColStart:f.visibleColStart,visibleColEnd:f.visibleColEnd,scrollX:B.current,scrollY:ie.current,totalWidth:ze.current,totalHeight:s.totalHeight+k.current}},[]),de=t.useCallback(()=>{const s=Y();s!==null&&kt.current?.(s)},[Y]),Ve=t.useCallback(s=>{const f=Math.max(0,ke.current.width-Me.current),p=Math.max(0,ze.current-Me.current-f),R=G(s,0,p);return R!==B.current&&(B.current=R,Ue(),Ee(),ot(),St.current?.({x:R,y:ie.current})),R},[Ue,Ee,ot]),Ne=t.useRef(Ve);Ne.current=Ve,t.useLayoutEffect(()=>{Ie.current=W.colAnchor,Ue(),de()},[W,Ue,de]),t.useLayoutEffect(()=>{Rt.current!==null&&de()},[Oe,de]);const De=t.useRef(null),Ge=t.useCallback(s=>{const f=G(s.col,0,Math.max(0,e-1)),p=ee.prefixSum(f,{materializeOption:{materialize:!1}}),R=p.cumulative-p.currentValue,y=p.currentValue,X=Math.max(0,ke.current.width-Me.current);return(s.alignX==="end"?R+y-Me.current-X:s.alignX==="center"?R+y/2-Me.current-X/2:R-Me.current)+s.offsetX},[ee,e]),He=t.useRef(null),nt=t.useCallback(()=>{const s=He.current;He.current=null,!(s===null||s.length===0)&&(Le(ee.updates(s)),mt(f=>f+1))},[ee,Le]),lt=t.useRef({count:0,warned:!1}),{frozenColumns:Je,frozenWidth:et}=t.useMemo(()=>{if(P===0)return lt.current.count=0,lt.current.warned=!1,{frozenColumns:vn,frozenWidth:0};const{columns:s,widthUpdates:f,width:p}=Sn(P,ve,ee);if(f.length>0){const R=lt.current;R.count>=yr?R.warned||(R.warned=!0,z.warn("[VirtualGrid] getColWidth keeps disagreeing with its own previous values inside the frozen band; width self-heal is suspended until a converged pass re-arms it (unstable accessor).",{frozenCols:P,pendingUpdates:f.length})):(R.count+=1,He.current=[...He.current??[],...f],Promise.resolve().then(nt))}else lt.current.count=0,lt.current.warned=!1;return{frozenColumns:s,frozenWidth:p}},[P,te,ve,ee,nt]);Me.current=et,t.useLayoutEffect(()=>{P>0?ce.current?.style.setProperty("--aqvs-grid-frozen-width",`${et}px`):ce.current?.style.removeProperty("--aqvs-grid-frozen-width")},[et,P]),t.useLayoutEffect(()=>{const s=De.current;s===null?Ne.current(B.current):Ne.current(Ge(s)),Ee()},[w.width,fe,te,et,Ee,Ge]);const dt=t.useRef(!1);t.useLayoutEffect(()=>{if(dt.current||ne===void 0||e===0)return;dt.current=!0;const s=G(Math.trunc(ne.col),0,e-1);if(s<P)return;const f={col:s,alignX:"start",offsetX:Math.max(0,ne.offsetX)};De.current=f,Ne.current(Ge(f))},[ne,e,Ge,P]);const Gt=t.useCallback(s=>{ie.current=s,ge.current=!0,St.current?.({x:B.current,y:s})},[]),Ht=t.useCallback(s=>{if(We===0||ut.current)Rt.current={renderingStartIndex:r,renderingEndIndex:r-1,visibleStartIndex:r,visibleEndIndex:r-1,scrollPosition:0,totalHeight:We===0?0:s.totalHeight},ie.current=0;else{const f=F;Rt.current={renderingStartIndex:s.renderingStartIndex+f,renderingEndIndex:s.renderingEndIndex+f,visibleStartIndex:s.visibleStartIndex+f,visibleEndIndex:s.visibleEndIndex+f,scrollPosition:s.scrollPosition,totalHeight:s.totalHeight},ie.current=s.scrollPosition}bt(f=>{const p=Math.max(1,s.renderingEndIndex-s.renderingStartIndex+1);return p===f?f:p}),de()},[de,F,We,r]),Xt=t.useCallback(s=>{De.current=null,Ne.current(B.current+s)},[]),Kt=gn(K,L+I.length),At=t.useRef({count:0,warned:!1}),{placedColumns:Ct,truncatedCols:Pt}=t.useMemo(()=>{const s=Math.max(0,w.width-et);if(e===0||s<=0)return{placedColumns:[],truncatedCols:0};if(W.renderingColStart>W.renderingColEnd)return{placedColumns:[],truncatedCols:0};const f=Math.max(1,Kt-Je.length),{columns:p,widthUpdates:R,truncated:y}=wn(G(W.renderingColStart,0,e-1),G(W.renderingColEnd,0,e-1),ve,ee,f);if(R.length>0){const X=At.current;X.count>=yr?X.warned||(X.warned=!0,z.warn("[VirtualGrid] getColWidth keeps disagreeing with its own previous values; width self-heal is suspended until a converged (zero-deviation) pass re-arms it (unstable accessor — the accessor must be index-stable while the ordering is unchanged).",{window:W.key,pendingUpdates:R.length})):(X.count+=1,He.current=[...He.current??[],...R],Promise.resolve().then(nt))}else At.current.count=0,At.current.warned=!1;return{placedColumns:p,truncatedCols:y}},[W,e,w.width,et,Je.length,te,ve,ee,Kt,nt]),Zt=t.useRef("");t.useEffect(()=>{if(Pt>0){const s=`${W.key}:${Pt}`;s!==Zt.current&&(Zt.current=s,Et.current?.({renderedCells:(Ct.length+Je.length)*(L+I.length),droppedCols:Pt}))}},[Pt,W.key,Ct.length,Je.length,L,I.length]);const qt=W.colAnchor,Qt=t.useCallback(s=>{const f=h?.(s),p=xe(s)===0,R=p?null:Ct.map(({col:y,left:X,width:Se})=>{const ae=m?.(s,y),pe={...ae?.style,left:X-qt,width:Se};return t.createElement("div",{...ae,key:o?o(s,y):y,className:xt.twMerge("aqvs-grid-cell",ae?.className),style:pe},l(a(s,y),s,y))});return P===0?H.jsx("div",{...f,className:xt.twMerge("aqvs-grid-row",f?.className),style:f?.style,children:R}):H.jsxs("div",{...f,"data-aqvs-frozen-row":"",className:xt.twMerge("aqvs-grid-row aqvs-grid-row-frozen-host",f?.className),style:f?.style,children:[p?null:Je.map(({col:y,left:X,width:Se})=>{const ae=m?.(s,y),pe={...ae?.style,left:X,width:Se};return t.createElement("div",{...ae,"data-aqvs-frozen-cell":"",key:o?o(s,y):y,className:xt.twMerge("aqvs-grid-cell",ae?.className),style:pe},l(a(s,y),s,y))}),p?null:H.jsx("div",{className:"aqvs-grid-row-scroll",children:H.jsx("div",{className:"aqvs-grid-row-scroll-inner",children:R})})]})},[Ct,Je,P,qt,h,m,o,a,l,xe]),[Jt,er]=t.useState(""),ct=t.useRef(null),Dt=t.useRef(se);Dt.current=se;const Mt=t.useCallback(()=>{const s=Dt.current;if(s===void 0)return;const f=s.debounceMs??400;Number.isFinite(f)&&f>=0&&(ct.current!==null&&window.clearTimeout(ct.current),ct.current=window.setTimeout(()=>{ct.current=null;const p=Y();p!==null&&er(R=>{const y=s.buildMessage(p);return y===R?R:y})},f))},[Y]),_t=se?.debounceMs??400,Yt=Number.isFinite(_t)&&_t>=0,c=se!==void 0;t.useEffect(()=>{c&&!Yt&&z.warn(`[VirtualGrid] liveRegion.debounceMs must be a finite number >= 0, received ${_t}. Announcements are disabled.`)},[c,Yt,_t]),t.useEffect(()=>()=>{ct.current!==null&&window.clearTimeout(ct.current)},[]),t.useEffect(()=>{Mt()},[W,Mt]);const g=t.useCallback(s=>{Ht(s),Mt()},[Ht,Mt]);return t.useImperativeHandle(C,()=>({scrollTo:s=>{const f=j.current;let p=ie.current;s.y!==void 0&&f!==null&&(f.scrollTo(s.y),p=f.getScrollPosition(),ie.current=p);let R=B.current;return s.x!==void 0&&(De.current=null,R=Ne.current(s.x)),{x:R,y:p}},scrollBy:s=>{const f=j.current;let p=ie.current;s.y!==void 0&&s.y!==0&&f!==null&&(p=f.scrollBy(s.y),ie.current=p);let R=B.current;return s.x!==void 0&&s.x!==0&&(De.current=null,R=Ne.current(B.current+s.x)),{x:R,y:p}},scrollToCell:(s,f,p)=>{const R=j.current;if(R!==null&&r>0){const y=G(Math.trunc(s),0,r-1);y>=F&&R.scrollToIndex(y-F,{align:p?.alignY??"top",offset:p?.offsetY})}if(e>0){const y=G(Math.trunc(f),0,e-1);if(y>=P){const X={col:y,alignX:p?.alignX??"start",offsetX:p?.offsetX??0};De.current=X,Ne.current(Ge(X))}}},getScrollPosition:()=>ge.current||j.current!==null?{x:B.current,y:j.current?.getScrollPosition()??ie.current}:{x:-1,y:-1},getScrollAnchor:()=>{if(r===0||e===0)return null;const s=j.current?.getScrollAnchor()??null;if(s===null)return null;const f=Me.current+B.current,p=ee.findIndexAtOrAfter(f,{materializeOption:{materialize:!1}});if(p.index===-1)return{row:s.index+F,col:e-1,offsetX:0,offsetY:s.offsetPx};if(p.cumulative===f)return{row:s.index+F,col:G(p.index+1,0,e-1),offsetX:0,offsetY:s.offsetPx};const R=(p.cumulative??0)-(p.currentValue??0);return{row:s.index+F,col:p.index,offsetX:Math.max(0,f-R),offsetY:s.offsetPx}},getViewportSize:()=>({width:ke.current.width,height:ke.current.height}),getContentSize:()=>({width:ze.current,height:j.current===null?0:k.current+Math.max(0,j.current.getContentSize())}),getRange:Y,updateRowSize:(s,f)=>{rr(f,"row",s),Math.trunc(s)<F?yt(p=>p+1):j.current?.updateItemSize(Math.trunc(s)-F,f)},updateColSize:(s,f)=>{rr(f,"col",s),Le(ee.update(G(Math.trunc(s),0,Math.max(0,e-1)),f)),mt(p=>p+1)},getFrozenSize:()=>({cols:P,width:Me.current,rows:F,height:k.current}),applyWheel:s=>j.current?.applyWheel(s)??!1,focusRowAtIndex:(s,f)=>{const p=Math.trunc(s);p<F?ce.current?.querySelector(`[data-aqvs-frozen-band-row="${p}"]`)?.focus():j.current?.focusItemAtIndex(p-F,f)}}),[r,e,ee,Y,Le,Ge,P,F]),H.jsxs("div",{ref:ce,className:xt.twMerge("aqvs-grid",F>0?"aqvs-grid-has-frozen-rows":"",ye),"data-testid":A,children:[F>0?H.jsx("div",{className:"aqvs-grid-frozen-rows",style:{height:Oe},"data-testid":A?`${A}-frozen-rows`:void 0,children:I.map(({row:s,top:f,height:p})=>H.jsx("div",{"data-aqvs-frozen-band-row":s,className:"aqvs-grid-frozen-band-row",style:{top:f,height:p,right:we},tabIndex:-1,onFocus:()=>T?.(s),children:Qt(s)},s))}):null,H.jsx("div",{className:"aqvs-grid-main","data-testid":A?`${A}-main`:void 0,children:H.jsx(Dr,{ref:j,itemCount:Fe?0:We,getItem:s=>s+F,getItemKey:s=>s+F,getItemHeight:$e,overscanCount:_,viewportSize:w.height>0?Math.max(0,w.height-Oe):void 0,callbackThrottleMs:le,behaviorOptions:Q,scrollBarOptions:re,contentProps:x,background:S,contentInsets:M,onItemFocus:vt,horizontalKeyInputs:J,horizontalKeyStep:$,initialScrollAnchor:me.current?U.current!==null&&U.current.row>=F&&We>0?{index:U.current.row-F,offsetPx:U.current.offsetPx}:void 0:ne!==void 0&&We>0&&Math.trunc(ne.row)>=F?{index:Math.trunc(ne.row)-F,offsetPx:ne.offsetY}:void 0,onScroll:Gt,onRangeChange:g,onWheelHorizontal:Xt,onPanHorizontal:Xt,testId:A?`${A}-rows`:void 0,children:Qt},F)}),H.jsx("div",{className:"aqvs-grid-hbar-strip",style:{height:we,paddingRight:we},"data-testid":A?`${A}-hbar`:void 0,children:H.jsx(pr,{horizontal:!0,enableHorizontalTapCircle:!0,contentSize:Math.max(0,fe-et),viewportSize:Math.max(0,w.width-et),scrollPosition:gt,itemCount:Math.max(0,e-P),tapScrollCircleOptions:re?.tapScrollCircleOptions,onScroll:(s,f)=>(De.current=null,Ne.current(typeof s=="function"?s(f??B.current):s)),scrollBarWidth:we})}),se!==void 0?H.jsx("div",{className:"aqvs-grid-live-region","aria-live":"polite","data-testid":A?`${A}-live`:void 0,children:Jt}):null]})},In=t.forwardRef(Mn);exports.FenwickMapTree=Tt;exports.MAX_FROZEN_LEADING_COLS=dr;exports.MAX_FROZEN_LEADING_ROWS=mr;exports.MAX_RENDERED_CELLS=Lr;exports.MAX_TRACK_SIZE=Ut;exports.ScrollBar=pr;exports.ScrollPane=kr;exports.TAP_SCROLL_SPEED_DEFAULTS=hr;exports.VirtualGrid=In;exports.VirtualScroll=Dr;exports.computeAutoTapScrollMaxSpeedMultiplier=Pr;exports.computeTapScrollSpeed=Cr;exports.createResidualQuantizer=_r;exports.minmax=G;exports.tapScrollCircleSampleVisual=sn;exports.useFenwickMapTree=gr;exports.useHeightCache=un;exports.useLruCache=Nr;exports.useWheelBridge=fn;
package/dist/index.d.cts CHANGED
@@ -14,4 +14,5 @@ export { useHeightCache } from './useHeightCache.cjs';
14
14
  export { useLruCache } from './useLruCache.cjs';
15
15
  export { useWheelBridge, type WheelBridgeOptions, type WheelBridgeTarget } from './useWheelBridge.cjs';
16
16
  export { minmax } from './utils.cjs';
17
+ export { MAX_FROZEN_LEADING_COLS, MAX_FROZEN_LEADING_ROWS, MAX_RENDERED_CELLS, MAX_TRACK_SIZE, VirtualGrid, type VirtualGridBehaviorOptions, type VirtualGridHandle, type VirtualGridLiveRegionOptions, type VirtualGridProps, type VirtualGridRange } from './VirtualGrid.cjs';
17
18
  export { VirtualScroll, type VirtualScrollBehaviorOptions, type VirtualScrollHandle, type VirtualScrollLiveRegionOptions, type VirtualScrollLiveRegionRange, type VirtualScrollProps, type VirtualScrollRange, type VirtualScrollScrollBarOptions, } from './VirtualScroll.cjs';
package/dist/index.d.ts CHANGED
@@ -14,5 +14,6 @@ export { useHeightCache } from './useHeightCache.ts';
14
14
  export { useLruCache } from './useLruCache.ts';
15
15
  export { useWheelBridge, type WheelBridgeOptions, type WheelBridgeTarget } from './useWheelBridge.ts';
16
16
  export { minmax } from './utils.ts';
17
+ export { MAX_FROZEN_LEADING_COLS, MAX_FROZEN_LEADING_ROWS, MAX_RENDERED_CELLS, MAX_TRACK_SIZE, VirtualGrid, type VirtualGridBehaviorOptions, type VirtualGridHandle, type VirtualGridLiveRegionOptions, type VirtualGridProps, type VirtualGridRange } from './VirtualGrid.tsx';
17
18
  export { VirtualScroll, type VirtualScrollBehaviorOptions, type VirtualScrollHandle, type VirtualScrollLiveRegionOptions, type VirtualScrollLiveRegionRange, type VirtualScrollProps, type VirtualScrollRange, type VirtualScrollScrollBarOptions, } from './VirtualScroll.tsx';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACvH,OAAO,EAAE,sCAAsC,EAAE,qBAAqB,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,yBAAyB,EAAE,KAAK,gCAAgC,EAAE,yBAAyB,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC3P,OAAO,EAAE,UAAU,EAAE,KAAK,uBAAuB,EAAE,KAAK,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvJ,YAAY,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EACH,aAAa,EACb,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,GACrC,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACvH,OAAO,EAAE,sCAAsC,EAAE,qBAAqB,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,yBAAyB,EAAE,KAAK,gCAAgC,EAAE,yBAAyB,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC3P,OAAO,EAAE,UAAU,EAAE,KAAK,uBAAuB,EAAE,KAAK,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvJ,YAAY,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,0BAA0B,EAAE,KAAK,iBAAiB,EAAE,KAAK,4BAA4B,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC/Q,OAAO,EACH,aAAa,EACb,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,GACrC,MAAM,qBAAqB,CAAA"}