@aiquants/virtualscroll 1.5.0 → 1.6.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 +1 -1
- package/dist/index.js +188 -185
- package/dist/src/VirtualScroll.d.ts.map +1 -1
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),n=require("react"),Ue=require("tailwind-merge"),ct={active:!1,offsetX:0,offsetY:0,distance:0,direction:0},ot=6,_t=8,Ft=({dragState:s,normalizedDistance:e})=>{const t=1+e*.18,r=.16+e*.24,o=.38+e*.28,l=s.active?"80ms ease-out":"220ms ease";return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"absolute inset-0 rounded-full",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,${r})`,transform:`scale(${t})`,transition:`${l}, ${s.active?"80ms":"260ms"} box-shadow ease`}}),L.jsx("div",{className:"aqvs:tap-scroll-circle-inner absolute rounded-full",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:o,transition:s.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},gt=n.forwardRef(({onDragChange:s,className:e,maxVisualDistance:t=160,size:r=40,style:o,opacity:l=1,renderVisual:f},p)=>{const[c,u]=n.useState(ct),d=n.useRef(null),g=n.useRef({x:0,y:0}),C=n.useRef(null),T=n.useRef(0),F=n.useCallback(R=>{u(R),s(R)},[s]),V=n.useCallback((R,S,W=!1)=>{const{x:te,y:ve}=g.current,ne=R-te,U=S-ve,ae=Math.abs(U),ue=ae<ot?0:U<0?-1:1,y=T.current;let P=ue;const M=ot+_t;ue===0?y!==0&&ae<M?P=y:(P=0,W||(T.current=0)):ue!==y&&y!==0&&ae<M?P=y:T.current=ue,F({active:W||ae>=ot,offsetX:ne,offsetY:U,distance:ae,direction:P})},[F]),J=n.useCallback(R=>{if(R===null)return;const S=C.current;S?.hasPointerCapture(R)&&S.releasePointerCapture(R)},[]),O=n.useCallback((R=!1)=>{R&&J(d.current),d.current=null,T.current=0,F(ct)},[F,J]),ce=n.useCallback(R=>{R.preventDefault(),R.stopPropagation();const S=C.current??R.currentTarget,{left:W,top:te,width:ve,height:ne}=S.getBoundingClientRect();g.current={x:W+ve/2,y:te+ne/2},d.current=R.pointerId,S.setPointerCapture(R.pointerId),V(R.clientX,R.clientY,!0)},[V]),E=n.useCallback(R=>{d.current===R.pointerId&&(R.preventDefault(),V(R.clientX,R.clientY))},[V]),k=n.useCallback(R=>{d.current===R.pointerId&&(R.preventDefault(),R.stopPropagation(),O(!0))},[O]);n.useImperativeHandle(p,()=>({reset:()=>{O(!0)},getElement:()=>C.current}),[O]);const z=Math.min(Math.max(l,0),1),N=r/64,w=Math.min(c.distance,t)/t,H=c.direction*w*10*N,j=f??Ft,_={dragState:c,normalizedDistance:w,sizeScale:N,size:r,opacity:z},x={...o,width:r,height:r,transform:`translateY(${H}px)`};return x.opacity=z,L.jsx("div",{ref:C,"data-testid":"virtual-scroll-tap-circle",className:Ue.twMerge("relative flex touch-none select-none items-center justify-center","transition-transform duration-100 ease-out",e),style:x,tabIndex:-1,onPointerDown:ce,onPointerMove:E,onPointerUp:k,onPointerCancel:k,role:"presentation",children:j(_)})});gt.displayName="TapScrollCircle";const le=(s,e,t)=>Math.min(t,Math.max(e,s)),at="virtualscroll:tap-scroll-cancel",ut=20,Nt=250,Lt=60,Ot=20,Yt=20,zt=240,ft={active:!1,offsetX:0,offsetY:0,distance:0,direction:0},it=2.2,Ht=8,Xt=120,jt=1/60,Fe={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:zt,minSpeedMultiplier:.2,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},qt=s=>s?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,t)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"flex flex-row items-stretch",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,t)=>t,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"flex flex-col items-stretch",orientation:"vertical"},Ut=(s,e)=>{const t=s?.maxSpeedMultiplier,r=typeof t=="number"?t:Wt(e);return{enabled:s?.enabled??Fe.enabled,size:s?.size??Fe.size,offsetX:s?.offsetX??Fe.offsetX,offsetY:s?.offsetY??Fe.offsetY,className:s?.className??Fe.className,maxVisualDistance:s?.maxVisualDistance??Fe.maxVisualDistance,maxSpeedMultiplier:r,minSpeedMultiplier:Math.max(s?.minSpeedMultiplier??Fe.minSpeedMultiplier,0),opacity:le(s?.opacity??Fe.opacity,0,1),renderVisual:s?.renderVisual??Fe.renderVisual,maxSpeedCurve:s?.maxSpeedCurve??Fe.maxSpeedCurve}},Bt=({isDragging:s,isThumbHovered:e,enableThumbDrag:t})=>n.useMemo(()=>t?s?"dragging":e?"hover":"idle":"disabled",[t,s,e]),$t=({canUseArrowButtons:s,enableArrowButtons:e,resetTapScroll:t,scrollByStep:r})=>{const o=n.useRef(null),l=n.useRef(null),f=n.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),p=n.useCallback(()=>{f()},[f]),c=n.useCallback(d=>g=>{s&&(g.preventDefault(),g.stopPropagation(),t(),f(),r(d),l.current=window.setTimeout(()=>{o.current=window.setInterval(()=>{r(d)},Lt)},Nt))},[s,f,t,r]),u=n.useCallback(d=>g=>{e&&(g.key==="Enter"||g.key===" "||g.key==="Spacebar")&&(g.preventDefault(),r(d))},[e,r]);return n.useEffect(()=>()=>{f()},[f]),{handleArrowPointerDown:c,handleArrowPointerUp:p,handleArrowKeyDown:u}},Wt=s=>{if(!s||s<=0)return it;const e=Math.max(1,s),t=Math.log10(e),r=it+t*Ht;return le(r,it,Xt)},xt=({contentSize:s,viewportSize:e,scrollPosition:t,onScroll:r,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,horizontal:p=!1,scrollBarWidth:c=12,className:u,ariaControls:d,tapScrollCircleOptions:g,itemCount:C,renderThumbOverlay:T})=>{const[F,V]=n.useState(!1),[J,O]=n.useState(!1),[ce,E]=n.useState(!1),k=n.useRef(null),z=n.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),N=n.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),w=n.useRef(t),H=n.useRef(ft),j=n.useRef(null),_=n.useRef(null),x=n.useRef(null),R=n.useMemo(()=>Ut(g,C),[C,g]),S=n.useMemo(()=>qt(p),[p]),{enabled:W,size:te,offsetX:ve,offsetY:ne,className:U,maxVisualDistance:ae,maxSpeedMultiplier:ue,minSpeedMultiplier:y,opacity:P,renderVisual:M,maxSpeedCurve:re}=R,B=n.useRef({viewportSize:e,maxScrollPosition:Math.max(s-e,0),scrollBarVisible:s>e,effectiveTapMaxDistance:Math.max(ae,1),tapCircleMaxSpeedMultiplier:ue,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:re,tapScrollCircleOptions:g}),{mainSizeKey:K,crossSizeKey:fe,positionKey:Q,selectDelta:se,getPointerCoordinate:ee,arrowLabels:me,arrowIcons:de,directionClass:he,orientation:Te}=S,ye=Math.max(ae,1),Ee=e/s,m=c,h=Math.max(e-m*2,0),pe=Ee*h,G=Math.min(Math.max(ut,pe||0),h||ut),Y=s-e,Re=Math.max(h-G,0),ge=Y<=0||Re<=0?0:t/Y*Re,we=ge+G/2,xe=s>e,Ae=xe&&f;B.current={viewportSize:e,maxScrollPosition:Y,scrollBarVisible:xe,effectiveTapMaxDistance:ye,tapCircleMaxSpeedMultiplier:ue,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:re,tapScrollCircleOptions:g},n.useEffect(()=>{w.current=t},[t]),n.useEffect(()=>{o||O(!1)},[o]);const Ye=Bt({isDragging:F,isThumbHovered:J,enableThumbDrag:o}),Ce=n.useCallback((i,b)=>{const A=B.current,Z=b??w.current;if(r){const De=r(i,Z);if(typeof De=="number"&&Number.isFinite(De))return w.current=De,De}const be=typeof i=="function"?i(Z):i,Ie=Math.max(A.maxScrollPosition,0),Ve=A.scrollBarVisible?le(be,0,Ie):0;return w.current=Ve,Ve},[r]),_e=n.useCallback(i=>{const b=B.current,A=w.current;if(!b.scrollBarVisible||b.maxScrollPosition<=0){const De=Ce(0,A),rt=De-A;return{nextPosition:De,actualDelta:rt,reachedBoundary:!0}}if(i===0)return{nextPosition:A,actualDelta:0,reachedBoundary:!1};const be=Ce(De=>le(De+i,0,b.maxScrollPosition),A),Ie=be-A,Ve=Ie===0||i<0&&be<=0||i>0&&be>=b.maxScrollPosition;return{nextPosition:be,actualDelta:Ie,reachedBoundary:Ve}},[Ce]),oe=n.useCallback(()=>{_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),x.current=null},[]),Se=n.useCallback(()=>{H.current={...ft},E(!1),j.current?.reset(),oe()},[oe]),He=n.useCallback(i=>{const b=H.current,A=B.current;if(!b.active||b.direction===0){oe();return}if(!A.scrollBarVisible||A.maxScrollPosition<=0){oe();return}const Z=x.current??i,be=Math.max((i-Z)/1e3,0),Ie=Math.min(be,jt);if(x.current=i,Ie<=0){_.current=window.requestAnimationFrame(He);return}const Ve=Math.min(b.distance,A.effectiveTapMaxDistance)/A.effectiveTapMaxDistance,De=Ve**1.1,rt=typeof A.tapScrollCircleOptions?.maxSpeedMultiplier=="number",Be=Math.max(A.viewportSize*A.tapCircleMinSpeedMultiplier,40),St=rt?Be:1200;let st=Math.max(A.viewportSize*A.tapCircleMaxSpeedMultiplier,St);const Ze=A.tapCircleMaxSpeedCurve;if(Ze){const Je=Math.max(Ze.exponentialSteepness,0),At=Math.max(Ze.exponentialScale??A.tapCircleMaxSpeedMultiplier,0),kt=Je===0?Ve:Math.expm1(Je*Ve),lt=Je===0?1:Math.expm1(Je)||1,Vt=lt===0?Ve:Math.min(Math.max(kt/lt,0),1),Dt=A.viewportSize*At*Vt;st=Math.min(st,Math.max(Dt,Be))}const Pt=Math.max(st,Be),Mt=Math.max(Ze?.easedOffset??0,0),vt=Math.min(1,De+Mt),Rt=Be+(Pt-Be)*vt,wt=b.direction*Rt*Ie,{actualDelta:yt,reachedBoundary:Et}=_e(wt);if(Et||yt===0){oe();return}_.current=window.requestAnimationFrame(He)},[_e,oe]),Ke=n.useCallback(()=>{_.current===null&&(x.current=null,_.current=window.requestAnimationFrame(He))},[He]);n.useEffect(()=>()=>{oe()},[oe]);const tt=n.useCallback(i=>{H.current=i,E(i.active),i.active&&i.direction!==0?Ke():oe()},[Ke,oe]);n.useEffect(()=>{W||Se()},[Se,W]),n.useEffect(()=>{const i=b=>{const Z=b.detail?.paneId;Z&&d&&Z!==d||Se()};return window.addEventListener(at,i),()=>{window.removeEventListener(at,i)}},[d,Se]),n.useEffect(()=>{if(!W)return;const i=b=>{if(!H.current.active)return;const A=b.target;if(!(A instanceof Node)){Se();return}j.current?.getElement()?.contains(A)||Se()};return document.addEventListener("pointerdown",i,!0),()=>{document.removeEventListener("pointerdown",i,!0)}},[Se,W]);const a=i=>{if(!xe||Re<=0||Y<=0)return 0;const b=le(i,0,Re);return le(b/Re*Y,0,Y)},I=i=>{const b=Math.max(Math.round(e/Yt),Ot);_e(i*b)},{handleArrowPointerDown:v,handleArrowPointerUp:D,handleArrowKeyDown:q}=$t({canUseArrowButtons:Ae,enableArrowButtons:f,resetTapScroll:Se,scrollByStep:I}),$=i=>{if(!xe)return;if(!o){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;Se();const b=i.currentTarget;b.setPointerCapture&&b.setPointerCapture(i.pointerId),z.current={pointerId:i.pointerId,startThumbPosition:ge,startClientX:i.clientX,startClientY:i.clientY},V(!0),O(!0),i.preventDefault(),i.stopPropagation()},Pe=i=>{const b=z.current;if(b.pointerId!==i.pointerId)return;const A=i.clientX-b.startClientX,Z=i.clientY-b.startClientY,be=se(A,Z),Ie=a(b.startThumbPosition+be);Ce(Ie),i.cancelable&&i.preventDefault()},Ne=i=>{if(z.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),z.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},V(!1),k.current&&!k.current.matches(":hover")&&O(!1),i.preventDefault(),i.stopPropagation()},ke=i=>{if(z.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),z.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},V(!1),k.current&&!k.current.matches(":hover")&&O(!1)},Le=i=>{if(!xe)return;if(!l){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;const b=i.currentTarget,A=b.getBoundingClientRect(),be=ee(i)-(p?A.left:A.top);Se();const Ie=be-G/2,Ve=a(Ie);Ce(Ve),b.setPointerCapture&&b.setPointerCapture(i.pointerId),N.current={pointerId:i.pointerId,startThumbPosition:Ie,startClientX:i.clientX,startClientY:i.clientY},i.preventDefault(),i.stopPropagation()},Xe=i=>{const b=N.current;if(b.pointerId!==i.pointerId)return;const A=i.clientX-b.startClientX,Z=i.clientY-b.startClientY,be=se(A,Z),Ie=a(b.startThumbPosition+be);Ce(Ie),i.cancelable&&i.preventDefault()},Oe=i=>{if(N.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),N.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},i.preventDefault(),i.stopPropagation()},je=i=>{if(N.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),N.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}},X=n.useMemo(()=>le((ce?1:.8)*P,0,1),[ce,P]),qe=n.useMemo(()=>{const b=`calc(50% - ${te/2}px + ${ne}px)`;return{left:ve,top:b}},[ve,ne,te]),nt=(i,b,A)=>L.jsx("button",{type:"button",tabIndex:-1,className:"aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",style:{[K]:m,[fe]:c},"aria-label":b,onMouseDown:v(i),onTouchStart:v(i),onMouseUp:D,onMouseLeave:D,onTouchEnd:D,onTouchCancel:D,onKeyDown:q(i),"aria-disabled":!f,disabled:!Ae,children:L.jsx("span",{"aria-hidden":"true",children:A})}),Ge=T&&xe?{orientation:Te,scrollPosition:t,maxScrollPosition:Y,contentSize:s,viewportSize:e,thumbSize:G,thumbPosition:ge,thumbCenter:we,trackSize:h,isDragging:F,isTapScrollActive:ce}:null;return L.jsxs("div",{className:Ue.twMerge("group relative cursor-default select-none",he,u),style:{[K]:e,[fe]:c,backgroundColor:"white",userSelect:"none",position:"relative",touchAction:"none"},role:"scrollbar",tabIndex:-1,"aria-controls":d,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":Y,"aria-orientation":p?"horizontal":"vertical",children:[!p&&xe&&W&&L.jsx(gt,{ref:j,className:Ue.twMerge("pointer-events-auto absolute transition-opacity duration-150",U),size:te,maxVisualDistance:ye,style:qe,opacity:X,renderVisual:M,onDragChange:tt}),nt(-1,me[0],de[0]),L.jsxs("div",{className:"aqvs:scrollbar-track relative flex-1",style:{borderRadius:c/2,touchAction:"none"},onPointerDown:Le,onPointerMove:Xe,onPointerUp:Oe,onPointerCancel:je,"aria-disabled":!l,children:[Ge&&L.jsx("div",{className:"pointer-events-none absolute inset-0","aria-hidden":!0,children:T?.(Ge)}),xe&&L.jsx("div",{className:"group absolute",style:{[K]:G,[Q]:ge,...p?{top:0,bottom:0}:{left:0,right:0},touchAction:"none"},onPointerDown:$,onPointerMove:Pe,onPointerUp:Ne,onPointerCancel:ke,role:"slider","aria-orientation":p?"horizontal":"vertical","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":Y,"aria-disabled":!o,tabIndex:-1,children:L.jsx("div",{ref:k,className:Ue.twMerge("aqvs:scrollbar-thumb absolute",p?"aqvs:scrollbar-thumb-horizontal":"aqvs:scrollbar-thumb-vertical"),"data-thumb-state":Ye,style:{borderRadius:c-1,cursor:o?"pointer":"default"},onMouseEnter:()=>{o&&O(!0)},onMouseLeave:()=>{o&&O(!1)}})})]}),nt(1,me[1],de[1])]})},Me={debug(s,...e){typeof window<"u"&&window.localStorage?.getItem("debug")==="true"&&console.debug(`[VirtualScroll] ${s}`,...e)},warn(s,...e){console.warn(`[VirtualScroll] ${s}`,...e)},error(s,...e){console.error(`[VirtualScroll] ${s}`,...e)}},$e={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},Qe=(s,e,t)=>{for(const[r,o,l]of e)t==="add"?s.addEventListener(r,o,l):s.removeEventListener(r,o,l)},bt=n.forwardRef(({children:s,contentSize:e,viewportSize:t,scrollBarWidth:r=12,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,enablePointerDrag:p=!0,onScroll:c,className:u,style:d,background:g,tapScrollCircleOptions:C,inertiaOptions:T,itemCount:F,renderThumbOverlay:V,wheelSpeedMultiplier:J=1,contentInsets:O},ce)=>{const E=n.useRef(0),k=n.useRef(null),z=n.useRef(null),N=n.useRef({frame:null,velocity:0,lastTimestamp:null}),w=n.useMemo(()=>({maxVelocity:T?.maxVelocity??$e.maxVelocity,minVelocity:T?.minVelocity??$e.minVelocity,deceleration:T?.deceleration??$e.deceleration,velocitySampleWindow:T?.velocitySampleWindow??$e.velocitySampleWindow,startVelocityThreshold:T?.startVelocityThreshold??$e.startVelocityThreshold}),[T]),H=n.useMemo(()=>({top:Math.max(0,O?.top??0),bottom:Math.max(0,O?.bottom??0)}),[O]);Me.debug("[ScrollPane] ScrollPane rendered",{contentSize:e,viewportSize:t,scrollBarWidth:r,className:u,style:d,tapScrollCircleOptions:C,inertiaOptions:T,enablePointerDrag:p,contentInsets:H});const j=n.useRef({contentSize:e,viewportSize:t}),_=n.useMemo(()=>e>t,[e,t]),x=n.useCallback(P=>{const{contentSize:M,viewportSize:re}=j.current,B=M>re,K=E.current;if(Me.debug("[ScrollPane] scrollTo called",{newPosition:P,contentSize:M,viewportSize:re,currentIsScrollable:B,prevPosition:K}),!B)return E.current!==0&&(E.current=0,c?.(0,K)),E.current;const fe=typeof P=="function"?P(E.current):P,Q=Math.max(M-re,0),se=le(fe,0,Q);return E.current!==se&&(E.current=se,c?.(se,K)),E.current},[c]),R=n.useCallback(()=>{const P=N.current;P.frame!==null&&cancelAnimationFrame(P.frame),P.frame=null,P.velocity=0,P.lastTimestamp=null},[]),S=n.useRef(R);n.useEffect(()=>{S.current=R},[R]);const W=n.useCallback(P=>{if(!_)return;const{maxVelocity:M,minVelocity:re,deceleration:B,startVelocityThreshold:K}=w,fe=le(P,-M,M);if(Math.abs(fe)<K)return;R(),N.current.velocity=fe,N.current.lastTimestamp=null;const Q=se=>{const ee=N.current;if(ee.lastTimestamp===null){ee.lastTimestamp=se,ee.frame=requestAnimationFrame(Q);return}const me=se-ee.lastTimestamp;if(ee.lastTimestamp=se,me<=0){ee.frame=requestAnimationFrame(Q);return}const de=ee.velocity;let he=de;const Te=B*me;de>0?he=Math.max(0,de-Te):de<0&&(he=Math.min(0,de+Te));const Ee=(de+he)/2*me,m=E.current;Ee!==0&&x(ge=>ge+Ee);const h=E.current,{contentSize:pe,viewportSize:G}=j.current,Y=Math.max(pe-G,0);ee.velocity=he;const Re=h===m||h<=0&&he<=0||h>=Y&&he>=0;if(Math.abs(he)<re||Re){R();return}ee.frame=requestAnimationFrame(Q)};N.current.frame=requestAnimationFrame(Q)},[_,w,x,R]),te=n.useRef(W);n.useEffect(()=>{te.current=W},[W]),n.useLayoutEffect(()=>{j.current={contentSize:e,viewportSize:t}},[e,t]),n.useLayoutEffect(()=>{if(_){Me.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",{contentSize:e,viewportSize:t,scrollPosition:E.current});const P=le(e-t,0,e);E.current>P&&x(P)}else x(0)},[_,x,e,t]),n.useEffect(()=>{const P=re=>{if(!_)return;re.preventDefault(),R();let B=re.deltaY;re.deltaMode===1?B*=16:re.deltaMode===2&&(B*=t),J!==1&&(B*=J),Me.debug("[ScrollPane] wheel event",{deltaY:B,scrollPosition:E.current,wheelSpeedMultiplier:J}),x(K=>K+B)},M=k.current;return M&&M.addEventListener("wheel",P,{passive:!1}),()=>{M&&M.removeEventListener("wheel",P)}},[_,x,R,t,J]),n.useImperativeHandle(ce,()=>({scrollTo:x,getScrollPosition:()=>E.current,getContentSize:()=>e,getViewportSize:()=>t}),[x,e,t]);const ve=n.useRef(x);n.useEffect(()=>{ve.current=x},[x]);const ne=n.useId(),U=n.useRef({pointerId:null,startClientY:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[]}),ae=n.useRef(p);n.useEffect(()=>{ae.current=p},[p]);const ue=n.useRef(_);n.useEffect(()=>{ue.current=_},[_]);const y=n.useRef(w);return n.useEffect(()=>{y.current=w},[w]),n.useEffect(()=>{if(p)return;const P=z.current,M=U.current;M.pointerId!==null&&P&&P.hasPointerCapture(M.pointerId)&&P.releasePointerCapture(M.pointerId),M.clickResetTimer!==null&&(window.clearTimeout(M.clickResetTimer),M.clickResetTimer=null),M.pointerId=null,M.startClientY=0,M.startScroll=0,M.isDragging=!1,M.shouldCancelNextClick=!1,M.velocitySamples=[]},[p]),n.useEffect(()=>{const P=z.current;if(!P)return;const M=6,re=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),B=()=>{const m=U.current;m.pointerId=null,m.startClientY=0,m.startScroll=0,m.isDragging=!1,m.velocitySamples=[]},K=()=>{const m=U.current;m.clickResetTimer!==null&&(window.clearTimeout(m.clickResetTimer),m.clickResetTimer=null)},fe=m=>{const h=U.current,pe=re();h.velocitySamples.push({clientY:m,time:pe});const G=y.current.velocitySampleWindow;h.velocitySamples=h.velocitySamples.filter(Y=>pe-Y.time<=G)},Q=m=>m instanceof HTMLElement&&m.closest("[data-scrollpane-ignore-drag='true']")!==null,se=m=>{const h=U.current;h.shouldCancelNextClick&&(m.preventDefault(),m.stopPropagation(),h.shouldCancelNextClick=!1)},ee=m=>{const h=U.current;h.isDragging||(h.isDragging=!0,h.shouldCancelNextClick=!0,P.hasPointerCapture(m.pointerId)||P.setPointerCapture(m.pointerId),fe(m.clientY))},me=m=>{const h=U.current;if(h.pointerId!==m.pointerId||!(ae.current&&ue.current)||!h.isDragging&&(Math.abs(m.clientY-h.startClientY)<M||(ee(m),!h.isDragging)))return;fe(m.clientY);const pe=m.clientY-h.startClientY,G=h.startScroll-pe;ve.current(G),m.cancelable&&m.preventDefault()},de=m=>{const h=U.current;if(h.pointerId!==m.pointerId)return;h.isDragging&&h.shouldCancelNextClick&&m.cancelable&&(m.preventDefault(),m.stopPropagation()),P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId);let pe=0;if(h.isDragging&&h.velocitySamples.length>=2){const Y=h.velocitySamples,Re=y.current.velocitySampleWindow,ge=Y[Y.length-1],we=Y.find(xe=>ge.time-xe.time<=Re)??Y[0];if(ge&&we&&ge.time!==we.time){const xe=ge.clientY-we.clientY,Ae=ge.time-we.time;pe=-(xe/Ae)}}K(),h.shouldCancelNextClick&&(h.clickResetTimer=window.setTimeout(()=>{const Y=U.current;Y.shouldCancelNextClick=!1,Y.clickResetTimer=null},0));const G=y.current.startVelocityThreshold;B(),Math.abs(pe)>=G&&te.current?.(pe)},he=m=>{if(!(ae.current&&ue.current)||m.button!==0&&m.pointerType==="mouse"||m.ctrlKey||m.metaKey||m.altKey||Q(m.target))return;window.dispatchEvent(new CustomEvent(at,{detail:{paneId:ne}})),S.current?.();const h=U.current;K(),h.pointerId=m.pointerId,h.startClientY=m.clientY,h.startScroll=E.current,h.isDragging=!1,h.shouldCancelNextClick=!1,h.velocitySamples=[]},Te=m=>{const h=U.current;h.pointerId===m.pointerId&&(h.shouldCancelNextClick=!1,P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId),K(),B())},ye=[["click",se,!0],["pointerdown",he,{passive:!1}],["pointermove",me,{passive:!1}],["pointerup",de,void 0],["pointercancel",Te,void 0]],Ee=[["pointermove",me,{passive:!1}],["pointerup",de,void 0],["pointercancel",Te,void 0]];return Qe(P,ye,"add"),Qe(window,Ee,"add"),()=>{Qe(P,ye,"remove"),Qe(window,Ee,"remove");const m=U.current;m.pointerId!==null&&P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId),K(),B()}},[ne]),L.jsxs("div",{ref:k,className:Ue.twMerge("flex",u),style:d,children:[L.jsxs("div",{ref:z,className:Ue.twMerge("relative h-full flex-1 overflow-hidden"),style:{height:t,paddingTop:H.top,paddingBottom:H.bottom,...p?{touchAction:"none"}:{}},id:ne,children:[g,s(E.current)]}),_&&L.jsx(xt,{contentSize:e,viewportSize:t,scrollPosition:E.current,onScroll:x,enableThumbDrag:o,enableTrackClick:l,enableArrowButtons:f,scrollBarWidth:r,ariaControls:ne,tapScrollCircleOptions:C,itemCount:F,renderThumbOverlay:V})]})}),dt=(s,e,t)=>Math.min(Math.max(s,e),t),Kt=({dragState:s,normalizedDistance:e,sizeScale:t,size:r})=>{const o=Math.max(r/2,1),l=1+e*.65,f=Math.max(.65,1-e*.25),p=s.direction*e*26*t,c=.8+e*.18,u=3*t,d=6*t,g=22*t,C=Math.abs(p)+d,T=p>0?u:-Math.abs(p)-u,F=Math.max(2.5,3*t),V=dt(s.offsetX,-o,o),J=dt(s.offsetY,-o,o),O=o*.35,ce=V/o*O,E=J/o*O,k=ce*.45,z=E*.45,N=Math.max(g*.38,6),w=.65+e*.2,H=s.active;return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"aqvs:tap-scroll-circle-gradient absolute inset-0 rounded-full border border-white/40 shadow-md",style:{transform:`scale(${f}, ${l})`,transition:H?"40ms transform ease-out":"200ms ease transform"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full border border-white/50 bg-white/85",style:{width:g,height:g,transform:`translate(calc(-50% + ${ce}px), calc(-50% + ${E}px)) scale(${f}, ${c*l})`,transition:H?"70ms transform ease-out":"200ms ease transform"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/80",style:{width:N,height:N,transform:`translate(calc(-50% + ${k}px), calc(-50% + ${z}px)) scale(${f}, ${l})`,opacity:w,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:H?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/50",style:{width:F,height:C,transform:`translate(-50%, ${T}px)`,opacity:e,transition:H?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},Gt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},et=s=>{if(s<=0||!Number.isFinite(s))return 0;const e=Math.trunc(s),t=BigInt(e)&-BigInt(e);return Number(t)};class It{tree;deltas;size;baseValue;valueFn;total;constructor(e,t,r){this.reset(e,t,r)}reset(e,t,r){if(this.size=e,this.tree=new Map,this.deltas=new Map,this.total=void 0,typeof t=="function"){if(this.valueFn=t,this.size>0){const l=r?.sampleRange??{from:0,to:Math.min(99,this.size-1)},{mode:f,materializedValues:p}=this._calculateMode(l.from,l.to);if(this.baseValue=f,r?.materialize)for(let c=0;c<p.length;c++){const u=p[c],d=l.from+c;if(d>=this.size)break;const g=u-this.baseValue;this.deltas.set(d,g),this._updateTree(d,g)}}else this.baseValue=0;this.total=this.getTotal()}else this.valueFn=void 0,this.baseValue=t,this.total=this.baseValue*this.size}setValueFn(e){typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e)}_calculateMode(e,t){if(!this.valueFn)return{mode:0,materializedValues:[]};const r=[];for(let u=e;u<=t&&!(u>=this.size);u++)r.push(this.valueFn(u));const o=[...r];if(r.length===0)return{mode:0,materializedValues:[]};r.sort((u,d)=>u-d);const l=Math.floor(r.length/2);let f;r.length%2===0?f=Math.floor((r[l-1]+r[l])/2):f=r[l];const p=new Map;let c=0;for(const u of r){const d=(p.get(u)??0)+1;p.set(u,d),d>c&&(c=d)}if(c>1){const u=[];for(const[g,C]of p.entries())C===c&&u.push(g);const d=u.reduce((g,C)=>g+C,0);f=Math.floor(d/u.length)}return{mode:f,materializedValues:o}}update(e,t){return this.updates([{index:e,value:t}])}updates(e){const t=this._buildDeltaUpdates(e);return t.length>0?this.updateDeltas(t):this.total}updateDelta(e,t){return this.updateDeltas([{index:e,change:t}])}updateDeltas(e){for(const{index:t,change:r}of e){if(t<0||t>=this.size)throw new Error(`Index ${t} out of bounds`);const o=this.deltas.get(t)??0;this.deltas.set(t,o+r),this._updateTree(t,r)}return this.total}_updateTree(e,t){if(t===0)return;let r=e+1;for(;r<=this.size;){this.tree.set(r,(this.tree.get(r)??0)+t);const o=et(r);if(o===0)break;r+=o}this.total!==void 0&&(this.total+=t)}_buildDeltaUpdates(e){const t=[];for(const{index:r,value:o}of e){if(r<0||r>=this.size)throw new Error(`Index ${r} out of bounds`);if(o<0)throw new Error("Value cannot be negative.");const l=this.deltas.has(r)?(this.deltas.get(r)??0)+this.baseValue:this.baseValue,f=o-l;f!==0&&t.push({index:r,change:f})}return t}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,t=this.size;for(;t>0;){e+=this.tree.get(t)??0;const r=et(t);if(r===0)break;t-=r}return e+this.baseValue*this.size}_materialize(e,t=!0){if(this.valueFn){const r=this.deltas.get(e)??0,l=this.valueFn(e)-this.baseValue;if(l!==r&&(this.deltas.set(e,l),t)){const f=l-r;this._updateTree(e,f)}}}_materializeRanges(e,t,r=!1){if(!(e?.materialize&&this.valueFn))return;const o=e.ranges;if(o&&o.length>0){for(const p of o){const c=p.from,u=Math.min(p.to,this.size-1);for(let d=c;d<=u;d++)this._materialize(d)}if(t===void 0)return;if(r){this._materialize(t);return}const l=o[0].from,f=o[o.length-1].to;t>=l&&t<=f&&this._materialize(t);return}t!==void 0&&this._materialize(t)}_findIndex(e,t={},r){if(this.size>=Number.MAX_SAFE_INTEGER)return this._findIndexLarge(e,t,r);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let o=0,l=this.size-1,f=-1,p,c=this.total;for(;o<=l;){const u=Math.floor((o+l)/2);p=this.prefixSum(u,t),c=p.total,(r?p.cumulative>=e:p.cumulative<=e)?(f=u,r?l=u-1:o=u+1):r?o=u+1:l=u-1}return{index:f,total:c,cumulative:p?.cumulative,currentValue:p?.currentValue,safeIndex:p?.safeIndex}}_findIndexLarge(e,t,r){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const o=Gt(this.size);if(o===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let l=0n,f=o-1n,p,c,u,d=this.total;for(;l<=f;){const T=l+f>>1n,F=Number(T),V=this.prefixSum(F,t);if(u=V,d=V.total,r?V.cumulative>=e:V.cumulative<=e)if(p=T,c=V,r){if(T===0n)break;f=T-1n}else l=T+1n;else if(r)l=T+1n;else{if(T===0n)break;f=T-1n}}const g=c??u;return{index:p!==void 0?Number(p):-1,total:d,cumulative:g?.cumulative,currentValue:g?.currentValue,safeIndex:g?.safeIndex}}prefixSum(e,t){if(e<0)return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};const r=le(e,0,this.size-1),o=t?.materializeOption;this._materializeRanges(o,r,!0);let l=0,f=r+1;for(;f>0;){const c=this.tree.get(f)??0;l+=c;const u=et(f);if(u===0)break;f-=u}const p=o?.materialize?this.get(r):(this.deltas.get(r)||0)+this.baseValue;return{cumulative:l+this.baseValue*(r+1),total:this.total,currentValue:p,safeIndex:r}}get(e,t){if(e<0||e>=this.size)throw new Error("Index out of bounds");const r=t?.materializeOption;return this._materializeRanges(r,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const t=e?.materializeOption;if(this._materializeRanges(t),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const r=this.prefixSum(this.getSize()-1);console.assert(r.cumulative===r.total,"Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const r=this.valueFn;this.reset(this.size,o=>r(o),{materialize:!0});return}const t=new Map;for(const[r,o]of this.deltas.entries()){if(o===0)continue;let l=r+1;for(;l<=this.size;){t.set(l,(t.get(l)??0)+o);const f=et(l);if(f===0)break;l+=f}}this.tree=t,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const t of this.deltas.values())e+=t;return this.total-e}changeSize(e){const t=this.size;if(e===t)return;if(e<t)for(const o of this.deltas.keys())o>=e&&this.deltas.delete(o);this.size=e,this.rebuildTree();const r=this.prefixSum(this.getSize()-1);console.assert(r.cumulative===r.total,"Inconsistent Fenwick Tree state")}getSize(){return this.size}findIndexAtOrAfter(e,t){return this._findIndex(e,t??{},!0)}findIndexAtOrBefore(e,t){return this._findIndex(e,t??{},!1)}}const Tt=(s,e,t)=>{const r=Math.max(0,s),o=n.useRef(null),l=n.useMemo(()=>new It(r,e,t),[r,e,t]);return Object.is(o.current,l)||console.warn("[useFenwickMapTree] instance changed"),o.current=l,l};class Zt{key;value;prev=null;next=null;constructor(e,t){this.key=e,this.value=t}}class pt{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 Ct(s){const e=n.useRef(new Map),t=n.useRef(new pt);n.useEffect(()=>{for(;e.current.size>s;){const d=t.current.removeHead();if(d)e.current.delete(d.key);else break}},[s]);const r=n.useCallback(d=>{const g=e.current.get(d);if(g)return t.current.moveToTail(g),g.value},[]),o=n.useCallback((d,g)=>{if(s<=0)return;let C=e.current.get(d);if(C)C.value=g,t.current.moveToTail(C);else{if(e.current.size>=s){const T=t.current.removeHead();T&&e.current.delete(T.key)}C=new Zt(d,g),e.current.set(d,C),t.current.addToTail(C)}},[s]),l=n.useCallback(d=>e.current.has(d),[]),f=n.useCallback(d=>{const g=e.current.get(d);g&&(t.current.remove(g),e.current.delete(d))},[]),p=n.useCallback(()=>{e.current.clear(),t.current=new pt},[]),[c,u]=n.useState(()=>({get:r,set:o,has:l,remove:f,clear:p}));return n.useEffect(()=>u({get:r,set:o,has:l,remove:f,clear:p}),[r,o,l,f,p]),c}const Jt=1e4,Qt=()=>{const{get:s,set:e,has:t,clear:r}=Ct(Jt);return{get:s,set:e,has:t,clear:r}},ie=(s,e)=>e<=0?0:le(s,0,e-1),en=s=>({top:Math.max(0,s?.top??0),bottom:Math.max(0,s?.bottom??0)}),ze=(s,e)=>s<=e?0:s-e,We=(s,e)=>s<=0?e:s+e,mt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},tn=(s,e,t,r,o,l,f,p)=>{const c=mt(r);if(c===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const u=k=>k<0n?0n:k>=c?c-1n:k,d={materializeOption:{materialize:!1}},{index:g}=l.findIndexAtOrAfter(s,d);let C;g===-1?C=c-1n:(C=mt(g),C>=c&&(C=c-1n)),s<=0&&(C=0n),p&&s>=f&&(C=c-1n);const T=k=>{let z=0,N=k,w=k,H=0n;for(;N<c&&z<e;){const j=Number(N),_=o(j);if(z+=_,w=N,N+=1n,H+=1n,!Number.isFinite(_)||_<=0)break}return H===0n&&(w=k),{height:z,end:w}};let{height:F,end:V}=T(C);if(F<e&&C>0n){let k=C,z=F;for(;k>0n&&z<e;){k-=1n;const w=Number(k),H=o(w);if(z+=H,!Number.isFinite(H)||H<=0)break}C=u(k);const N=T(C);F=N.height,V=N.end}const J=u(C),O=u(V),ce=u(J-BigInt(Math.max(0,t))),E=u(O+BigInt(Math.max(0,t)));return{renderingStartIndex:ie(Number(ce),r),renderingEndIndex:ie(Number(E),r),visibleStartIndex:ie(Number(J),r),visibleEndIndex:ie(Number(O),r)}},nn=(s,e,t,r,o,l)=>{if(r===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const f=l.getTotal(),p=Number.isFinite(f),c=p?Math.min(s,f):s;if(r>Number.MAX_SAFE_INTEGER)return tn(c,e,t,r,o,l,f,p);const{index:u,cumulative:d,currentValue:g}=l.findIndexAtOrAfter(c,{materializeOption:{materialize:!1}}),C=u===-1?e<=0||(d??0)<c+(g??0)?r-1:0:u;let T=ie(C,r),F=0,V=T;for(;V<r&&F<e;)F+=o(V),V++;if(F<e&&T>0){let E=F,k=T-1;for(;k>=0&&E<e;)E+=o(k),k--;for(T=ie(k+1,r),F=0,V=T;V<r&&F<e;)F+=o(V),V++}const J=ie(T-t,r),O=ie(Math.max(V-1,T),r),ce=ie(O+t,r);return{renderingStartIndex:J,renderingEndIndex:ce,visibleStartIndex:T,visibleEndIndex:O}},rn=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),ht=(s,e,t)=>{const r=Math.max(0,e??0),o=n.useRef({lastInvokeAt:0,rafId:null,pendingPayload:null,loopActive:!1,normalizedThrottle:r}),l=n.useCallback(()=>{const c=o.current;c.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c.rafId),c.rafId=null,c.loopActive=!1},[]),f=n.useCallback(c=>{const u=o.current;u.rafId=null;const d=typeof c=="number"?c:rn(),g=u.normalizedThrottle,C=u.pendingPayload,T=s.current;if(C!==null&&T){const F=d-u.lastInvokeAt;(g===0||u.lastInvokeAt===0||F>=g)&&(u.pendingPayload=null,u.lastInvokeAt=d,t(T,C))}if(u.pendingPayload!==null){typeof requestAnimationFrame=="function"?u.rafId=requestAnimationFrame(f):u.loopActive=!1;return}u.loopActive=!1},[s,t]),p=n.useCallback(()=>{const c=o.current;if(!c.loopActive){if(c.loopActive=!0,typeof requestAnimationFrame=="function"){c.rafId=requestAnimationFrame(f);return}c.loopActive=!1}},[f]);return n.useEffect(()=>()=>{l(),o.current.pendingPayload=null},[l]),n.useEffect(()=>{l();const c=o.current;c.lastInvokeAt=0,c.pendingPayload=null,c.normalizedThrottle=r},[r,l]),n.useCallback(c=>{const u=o.current;u.pendingPayload=c,p()},[p])},sn=({itemCount:s,getItem:e,getItemHeight:t,viewportSize:r,overscanCount:o=15,className:l,onScroll:f,onRangeChange:p,children:c,background:u,initialScrollIndex:d,initialScrollOffset:g,tapScrollCircleOptions:C,scrollBarWidth:T,enableThumbDrag:F,enableTrackClick:V,enableArrowButtons:J,enablePointerDrag:O,inertiaOptions:ce,callbackThrottleMs:E=5,renderThumbOverlay:k,wheelSpeedMultiplier:z,contentInsets:N,enableKeyboardNavigation:w=!0},H)=>{const j=n.useRef(null),_=n.useRef(!1),x=n.useMemo(()=>en(N),[N]),R=n.useRef({size:s,valueOrFn:t,options:{sampleRange:{from:0,to:100}}}),S=Tt(R.current.size,R.current.valueOrFn,R.current.options),[W]=n.useState(()=>{let a=x.top,I=0;if(typeof d=="number"){const v=le(d,0,s-1),D=le(v-o*2,0,s-1),q=le(v+o*2,0,s-1),$=d>0?{materializeOption:{materialize:!0,ranges:[{from:D,to:q}]}}:void 0,{cumulative:Pe,total:Ne,currentValue:ke}=S.prefixSum(d,$),Le=Math.max(Pe-ke,0);a=We(Le,x.top),I=Ne??S.getTotal()}else typeof g=="number"&&(a=We(Math.max(g,0),x.top)),I=S.getTotal();return{position:a,total:I}}),[te,ve]=n.useState(W.position),[ne,U]=n.useState(W.total),[ae,ue]=n.useState(W.position),[y,P]=n.useState(s),M=n.useRef(W.position),re=n.useRef(x.top),B=n.useRef(f??void 0),K=n.useRef(p??void 0),fe=n.useRef(new Map),Q=n.useRef(null),se=n.useRef(null);n.useEffect(()=>{B.current=f??void 0,K.current=p??void 0},[p,f]);const ee=n.useCallback(a=>{if(w&&a&&typeof a.focus=="function")try{a.focus({preventScroll:!0})}catch{a.focus()}},[w]),me=ht(B,E,(a,{position:I,totalHeight:v})=>{a(I,v)}),de=ht(K,E,(a,{renderingStartIndex:I,renderingEndIndex:v,visibleStartIndex:D,visibleEndIndex:q,scrollPosition:$,totalHeight:Pe})=>{a(I,v,D,q,$,Pe)});n.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]),n.useEffect(()=>{w||(fe.current.clear(),Q.current=null,se.current=null)},[w]);const he=.01,Te=n.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:W.position}),ye=n.useCallback(()=>{const a=Te.current;a.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.rafId),a.rafId=null,a.loopActive=!1,a.idleFrames=0},[]);n.useEffect(()=>()=>{ye()},[ye]);const Ee=n.useCallback(()=>{const a=Te.current;a.rafId=null;const I=M.current,v=ze(I,x.top),D=S.getTotal();if(ve($=>Math.abs($-I)<he?$:I),me({position:v,totalHeight:D}),Math.abs(a.lastRenderedPosition-I)>=he?(a.lastRenderedPosition=I,a.idleFrames=0):a.idleFrames+=1,a.idleFrames>=2){ye();return}if(typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(Ee);return}a.loopActive=!1},[S,x.top,me,ye]),m=n.useCallback(()=>{const a=Te.current;if(a.idleFrames=0,!a.loopActive){if(a.loopActive=!0,typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(Ee);return}a.loopActive=!1}},[Ee]),h=n.useCallback((a,I)=>{const v=I?.immediate??!1,D=ze(a,x.top);if(M.current=a,v){Te.current.lastRenderedPosition=a,Te.current.idleFrames=0,ve(a),me({position:D,totalHeight:S.getTotal()});return}m()},[m,S,x.top,me]),pe=n.useRef(!1);n.useEffect(()=>{if(!pe.current)if(pe.current=!0,typeof g=="number"){const a=We(Math.max(g,0),x.top),I=Math.abs(a-M.current)>.5;h(a,{immediate:!0}),I&&ue(a)}else h(M.current,{immediate:!0})},[g,x.top,h]),n.useLayoutEffect(()=>{S.setValueFn(t),y!==s&&(S.changeSize(s),P(s));const a=S.getTotal();ne!==a&&U(a)},[S,y,s,ne,t]),n.useLayoutEffect(()=>{ae!==null&&j.current&&(Me.debug("[VirtualScroll] Scrolling to position:",ae),j.current.scrollTo(ae),ue(null))},[ae]),n.useEffect(()=>{const a=re.current;if(a===x.top)return;const I=ze(M.current,a),v=We(I,x.top);re.current=x.top,M.current=v,ue(v),h(v,{immediate:!0})},[x.top,h]);const G=n.useCallback(a=>{if(!j.current)return;const I=ie(a,y),v=ie(I-o*2,y),D=ie(I+o*2,y),{cumulative:q,total:$,currentValue:Pe}=S.prefixSum(I,{materializeOption:{materialize:!0,ranges:[{from:v,to:D}]}});if(Me.debug("[VirtualScroll] Scrolling to index:",I,"Offset:",q,"Total height:",$,"Current value:",Pe,"safeIndexFrom:",v,"safeIndexTo:",D),!$)return;const Ne=Math.max(q-Pe,0),ke=We(Ne,x.top);U($),ue(ke),Me.debug("[VirtualScroll] Setting scroll position to:",ke)},[S,o,y,x.top]),Y=n.useCallback(a=>{if(!j.current)return;const I=S.getTotal(),v=le(Math.floor(a),0,I),D=S.findIndexAtOrAfter(v,{materializeOption:{materialize:!1}}).index;G(D)},[S,G]),Re=n.useCallback(a=>{const I=ze(M.current,x.top),v=typeof a=="function"?a(I):a;Y(v);const D=j.current?.getScrollPosition(),q=typeof D=="number"?D:M.current;return h(q),q},[x.top,Y,h]),ge=n.useCallback((a,I)=>{Me.debug("[VirtualScroll] Scroll position changed:",a),h(a)},[h]),we=n.useMemo(()=>ze(te,x.top),[x.top,te]),xe=n.useMemo(()=>{const a=nn(we,r,o,y,t,S);return Me.debug("[VirtualScroll] Calculated rendering range:",{...a,scrollPosition:we,renderingContentSize:S.getTotal(),overscanCount:o,viewportSize:r}),a},[we,r,o,y,t,S]),{renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e}=xe,oe=n.useCallback((a,I)=>{if(!w||y===0)return;const v=ie(a,y);if(!(I?.ensureVisible??!0)){const je=fe.current.get(v);je&&(Q.current=null,se.current=v,ee(je));return}const q=S.prefixSum(v,{materializeOption:{materialize:!1}}),$=q.currentValue,Pe=Math.max(q.cumulative-$,0),Ne=Pe+$,ke=ze(M.current,x.top),Le=ke+r;if(Pe<ke||Ne>Le){Q.current=v,G(v);return}const Oe=fe.current.get(v);if(Oe){Q.current=null,se.current=v,ee(Oe);return}Q.current=v},[w,y,S,x.top,G,ee,r]),Se=n.useCallback((a,I)=>{if(!w||a.defaultPrevented||a.altKey||a.metaKey||a.ctrlKey)return;const v=a.target;if(v){const D=v.tagName;if(D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||v.isContentEditable)return}if(a.key==="ArrowDown"){I<y-1&&(a.preventDefault(),oe(I+1));return}if(a.key==="ArrowUp"){I>0&&(a.preventDefault(),oe(I-1));return}if(a.key==="PageDown"){if(I<y-1){a.preventDefault();const D=Math.max(_e-Ce+1,1),q=Math.max(D,1),$=ie(Math.min(I+q,y-1),y);oe($)}return}if(a.key==="PageUp"&&I>0){a.preventDefault();const D=Math.max(_e-Ce+1,1),q=Math.max(D,1),$=ie(I-q,y);oe($)}},[w,y,oe,_e,Ce]),He=n.useCallback(a=>{if(!w)return;const I=ie(a,y);Q.current=null,se.current=I},[w,y]);n.useEffect(()=>{const a=j.current?.getScrollPosition()??0,I=M.current,v=ze(I,x.top);Me.debug("[VirtualScroll] Range change effect triggered",{renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e,scrollPositionState:te,paneScrollPosition:I,logicalScrollPosition:v,contentSize:ne,scrollPaneScrollPosition:a}),de({renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e,scrollPosition:v,totalHeight:ne})},[ne,Ye,Ae,x.top,de,te,_e,Ce]);const Ke=n.useCallback(a=>{const I=(E??0)>0,v=Math.abs(a-te),D=I&&v>.5?te:a,q=ze(D,x.top);if(Me.debug("[VirtualScroll] Rendering visible items",{currentScrollPosition:a,effectiveScrollPosition:q,renderingStartIndex:Ae,renderingEndIndex:Ye,fenwickSize:y,viewportSize:r,callbackThrottleMs:E,diff:v,rawEffectiveScrollPosition:D}),y===0)return L.jsx("div",{className:"absolute w-full",style:{top:0},children:L.jsx("div",{className:"text-center text-gray-500",children:"No items"})});const $=ie(Ae,y),Pe=ie(Ye,y),{cumulative:Ne,currentValue:ke}=S.prefixSum($,{materializeOption:{materialize:!1}}),Le=Ne-ke,Xe=[],Oe=[];for(let X=$;X<=Pe;X++){const qe=t(X);S.get(X)!==qe&&Xe.push({index:X,value:qe});const{cumulative:Ge,currentValue:i}=S.prefixSum(X,{materializeOption:{materialize:!1}}),b=Ge-i,A=Z=>{if(!Z){fe.current.delete(X);return}w&&(fe.current.set(X,Z),Q.current===X&&(Q.current=null,se.current=X,ee(Z)))};Oe.push(L.jsx("div",{ref:A,"data-index":X,"data-virtualscroll-item":"true",style:{position:"absolute",top:b-Le+x.top,width:"100%"},tabIndex:w?-1:void 0,onKeyDownCapture:w?Z=>Se(Z,X):void 0,onFocusCapture:w?()=>He(X):void 0,children:c(e(X),X)},X))}Xe.length>0&&Promise.resolve().then(()=>{if(!_.current)return;const X=S.updates(Xe);if(!_.current||typeof X!="number")return;U(X),Me.debug("[VirtualScroll] Updated heights for items",Xe,"New total height:",X);const qe=j.current?.getScrollPosition()??M.current;qe===M.current||!_.current||h(qe)});const je=Le-q;if(x.bottom>0){const X=S.getTotal()+x.top-Le;Oe.push(L.jsx("div",{style:{position:"absolute",top:X,height:x.bottom,width:"100%"}},"virtualscroll-bottom-inset"))}return Me.debug("[VirtualScroll] Rendering items",{nodeCount:Oe.length,containerTop:je,logicalScrollPosition:we,resolvedInsets:x,effectiveScrollPosition:q}),L.jsx("div",{className:"absolute w-full",style:{top:je},children:Oe})},[E,c,w,S,y,e,t,He,Se,we,Ye,Ae,x,te,ee,h,r]);n.useImperativeHandle(H,()=>({getScrollPosition:()=>j.current?.getScrollPosition()??-1,getContentSize:()=>j.current?.getContentSize()??-1,getViewportSize:()=>j.current?.getViewportSize()??-1,scrollTo:Re,scrollToIndex:G,getFenwickTreeTotalHeight:()=>S.getTotal(),getFenwickSize:()=>S.getSize(),focusItemAtIndex:oe}),[Re,G,S,oe]);const tt=ne+x.top+x.bottom;return L.jsx(bt,{ref:j,contentSize:tt,viewportSize:r,className:l,onScroll:ge,background:u,tapScrollCircleOptions:C,inertiaOptions:ce,itemCount:s,scrollBarWidth:T,enableThumbDrag:F,enableTrackClick:V,enableArrowButtons:J,enablePointerDrag:O,renderThumbOverlay:k,wheelSpeedMultiplier:z,contentInsets:x,children:Ke})},on=n.forwardRef(sn);exports.FenwickMapTree=It;exports.ScrollBar=xt;exports.ScrollPane=bt;exports.VirtualScroll=on;exports.minmax=le;exports.tapScrollCircleSampleVisual=Kt;exports.useFenwickMapTree=Tt;exports.useHeightCache=Qt;exports.useLruCache=Ct;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),n=require("react"),Ue=require("tailwind-merge"),ct={active:!1,offsetX:0,offsetY:0,distance:0,direction:0},ot=6,_t=8,Ft=({dragState:s,normalizedDistance:e})=>{const t=1+e*.18,r=.16+e*.24,o=.38+e*.28,l=s.active?"80ms ease-out":"220ms ease";return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"absolute inset-0 rounded-full",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,${r})`,transform:`scale(${t})`,transition:`${l}, ${s.active?"80ms":"260ms"} box-shadow ease`}}),L.jsx("div",{className:"aqvs:tap-scroll-circle-inner absolute rounded-full",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:o,transition:s.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},gt=n.forwardRef(({onDragChange:s,className:e,maxVisualDistance:t=160,size:r=40,style:o,opacity:l=1,renderVisual:f},p)=>{const[c,u]=n.useState(ct),d=n.useRef(null),g=n.useRef({x:0,y:0}),C=n.useRef(null),T=n.useRef(0),F=n.useCallback(w=>{u(w),s(w)},[s]),V=n.useCallback((w,S,K=!1)=>{const{x:te,y:ve}=g.current,ne=w-te,U=S-ve,ae=Math.abs(U),ue=ae<ot?0:U<0?-1:1,y=T.current;let P=ue;const M=ot+_t;ue===0?y!==0&&ae<M?P=y:(P=0,K||(T.current=0)):ue!==y&&y!==0&&ae<M?P=y:T.current=ue,F({active:K||ae>=ot,offsetX:ne,offsetY:U,distance:ae,direction:P})},[F]),J=n.useCallback(w=>{if(w===null)return;const S=C.current;S?.hasPointerCapture(w)&&S.releasePointerCapture(w)},[]),O=n.useCallback((w=!1)=>{w&&J(d.current),d.current=null,T.current=0,F(ct)},[F,J]),ce=n.useCallback(w=>{w.preventDefault(),w.stopPropagation();const S=C.current??w.currentTarget,{left:K,top:te,width:ve,height:ne}=S.getBoundingClientRect();g.current={x:K+ve/2,y:te+ne/2},d.current=w.pointerId,S.setPointerCapture(w.pointerId),V(w.clientX,w.clientY,!0)},[V]),E=n.useCallback(w=>{d.current===w.pointerId&&(w.preventDefault(),V(w.clientX,w.clientY))},[V]),k=n.useCallback(w=>{d.current===w.pointerId&&(w.preventDefault(),w.stopPropagation(),O(!0))},[O]);n.useImperativeHandle(p,()=>({reset:()=>{O(!0)},getElement:()=>C.current}),[O]);const z=Math.min(Math.max(l,0),1),N=r/64,R=Math.min(c.distance,t)/t,H=c.direction*R*10*N,j=f??Ft,_={dragState:c,normalizedDistance:R,sizeScale:N,size:r,opacity:z},x={...o,width:r,height:r,transform:`translateY(${H}px)`};return x.opacity=z,L.jsx("div",{ref:C,"data-testid":"virtual-scroll-tap-circle",className:Ue.twMerge("relative flex touch-none select-none items-center justify-center","transition-transform duration-100 ease-out",e),style:x,tabIndex:-1,onPointerDown:ce,onPointerMove:E,onPointerUp:k,onPointerCancel:k,role:"presentation",children:j(_)})});gt.displayName="TapScrollCircle";const le=(s,e,t)=>Math.min(t,Math.max(e,s)),at="virtualscroll:tap-scroll-cancel",ut=20,Nt=250,Lt=60,Ot=20,Yt=20,zt=240,ft={active:!1,offsetX:0,offsetY:0,distance:0,direction:0},it=2.2,Ht=8,Xt=120,jt=1/60,Fe={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:zt,minSpeedMultiplier:.2,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},qt=s=>s?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,t)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"flex flex-row items-stretch",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,t)=>t,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"flex flex-col items-stretch",orientation:"vertical"},Ut=(s,e)=>{const t=s?.maxSpeedMultiplier,r=typeof t=="number"?t:Wt(e);return{enabled:s?.enabled??Fe.enabled,size:s?.size??Fe.size,offsetX:s?.offsetX??Fe.offsetX,offsetY:s?.offsetY??Fe.offsetY,className:s?.className??Fe.className,maxVisualDistance:s?.maxVisualDistance??Fe.maxVisualDistance,maxSpeedMultiplier:r,minSpeedMultiplier:Math.max(s?.minSpeedMultiplier??Fe.minSpeedMultiplier,0),opacity:le(s?.opacity??Fe.opacity,0,1),renderVisual:s?.renderVisual??Fe.renderVisual,maxSpeedCurve:s?.maxSpeedCurve??Fe.maxSpeedCurve}},Bt=({isDragging:s,isThumbHovered:e,enableThumbDrag:t})=>n.useMemo(()=>t?s?"dragging":e?"hover":"idle":"disabled",[t,s,e]),$t=({canUseArrowButtons:s,enableArrowButtons:e,resetTapScroll:t,scrollByStep:r})=>{const o=n.useRef(null),l=n.useRef(null),f=n.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),p=n.useCallback(()=>{f()},[f]),c=n.useCallback(d=>g=>{s&&(g.preventDefault(),g.stopPropagation(),t(),f(),r(d),l.current=window.setTimeout(()=>{o.current=window.setInterval(()=>{r(d)},Lt)},Nt))},[s,f,t,r]),u=n.useCallback(d=>g=>{e&&(g.key==="Enter"||g.key===" "||g.key==="Spacebar")&&(g.preventDefault(),r(d))},[e,r]);return n.useEffect(()=>()=>{f()},[f]),{handleArrowPointerDown:c,handleArrowPointerUp:p,handleArrowKeyDown:u}},Wt=s=>{if(!s||s<=0)return it;const e=Math.max(1,s),t=Math.log10(e),r=it+t*Ht;return le(r,it,Xt)},xt=({contentSize:s,viewportSize:e,scrollPosition:t,onScroll:r,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,horizontal:p=!1,scrollBarWidth:c=12,className:u,ariaControls:d,tapScrollCircleOptions:g,itemCount:C,renderThumbOverlay:T})=>{const[F,V]=n.useState(!1),[J,O]=n.useState(!1),[ce,E]=n.useState(!1),k=n.useRef(null),z=n.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),N=n.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),R=n.useRef(t),H=n.useRef(ft),j=n.useRef(null),_=n.useRef(null),x=n.useRef(null),w=n.useMemo(()=>Ut(g,C),[C,g]),S=n.useMemo(()=>qt(p),[p]),{enabled:K,size:te,offsetX:ve,offsetY:ne,className:U,maxVisualDistance:ae,maxSpeedMultiplier:ue,minSpeedMultiplier:y,opacity:P,renderVisual:M,maxSpeedCurve:re}=w,B=n.useRef({viewportSize:e,maxScrollPosition:Math.max(s-e,0),scrollBarVisible:s>e,effectiveTapMaxDistance:Math.max(ae,1),tapCircleMaxSpeedMultiplier:ue,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:re,tapScrollCircleOptions:g}),{mainSizeKey:G,crossSizeKey:fe,positionKey:Q,selectDelta:se,getPointerCoordinate:ee,arrowLabels:me,arrowIcons:de,directionClass:he,orientation:Te}=S,ye=Math.max(ae,1),Ee=e/s,m=c,h=Math.max(e-m*2,0),pe=Ee*h,Z=Math.min(Math.max(ut,pe||0),h||ut),Y=s-e,we=Math.max(h-Z,0),ge=Y<=0||we<=0?0:t/Y*we,Re=ge+Z/2,xe=s>e,Ae=xe&&f;B.current={viewportSize:e,maxScrollPosition:Y,scrollBarVisible:xe,effectiveTapMaxDistance:ye,tapCircleMaxSpeedMultiplier:ue,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:re,tapScrollCircleOptions:g},n.useEffect(()=>{R.current=t},[t]),n.useEffect(()=>{o||O(!1)},[o]);const Ye=Bt({isDragging:F,isThumbHovered:J,enableThumbDrag:o}),Ce=n.useCallback((i,b)=>{const A=B.current,W=b??R.current;if(r){const De=r(i,W);if(typeof De=="number"&&Number.isFinite(De))return R.current=De,De}const be=typeof i=="function"?i(W):i,Ie=Math.max(A.maxScrollPosition,0),Ve=A.scrollBarVisible?le(be,0,Ie):0;return R.current=Ve,Ve},[r]),_e=n.useCallback(i=>{const b=B.current,A=R.current;if(!b.scrollBarVisible||b.maxScrollPosition<=0){const De=Ce(0,A),rt=De-A;return{nextPosition:De,actualDelta:rt,reachedBoundary:!0}}if(i===0)return{nextPosition:A,actualDelta:0,reachedBoundary:!1};const be=Ce(De=>le(De+i,0,b.maxScrollPosition),A),Ie=be-A,Ve=Ie===0||i<0&&be<=0||i>0&&be>=b.maxScrollPosition;return{nextPosition:be,actualDelta:Ie,reachedBoundary:Ve}},[Ce]),oe=n.useCallback(()=>{_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),x.current=null},[]),Se=n.useCallback(()=>{H.current={...ft},E(!1),j.current?.reset(),oe()},[oe]),He=n.useCallback(i=>{const b=H.current,A=B.current;if(!b.active||b.direction===0){oe();return}if(!A.scrollBarVisible||A.maxScrollPosition<=0){oe();return}const W=x.current??i,be=Math.max((i-W)/1e3,0),Ie=Math.min(be,jt);if(x.current=i,Ie<=0){_.current=window.requestAnimationFrame(He);return}const Ve=Math.min(b.distance,A.effectiveTapMaxDistance)/A.effectiveTapMaxDistance,De=Ve**1.1,rt=typeof A.tapScrollCircleOptions?.maxSpeedMultiplier=="number",Be=Math.max(A.viewportSize*A.tapCircleMinSpeedMultiplier,40),St=rt?Be:1200;let st=Math.max(A.viewportSize*A.tapCircleMaxSpeedMultiplier,St);const Ze=A.tapCircleMaxSpeedCurve;if(Ze){const Je=Math.max(Ze.exponentialSteepness,0),At=Math.max(Ze.exponentialScale??A.tapCircleMaxSpeedMultiplier,0),kt=Je===0?Ve:Math.expm1(Je*Ve),lt=Je===0?1:Math.expm1(Je)||1,Vt=lt===0?Ve:Math.min(Math.max(kt/lt,0),1),Dt=A.viewportSize*At*Vt;st=Math.min(st,Math.max(Dt,Be))}const Pt=Math.max(st,Be),Mt=Math.max(Ze?.easedOffset??0,0),vt=Math.min(1,De+Mt),wt=Be+(Pt-Be)*vt,Rt=b.direction*wt*Ie,{actualDelta:yt,reachedBoundary:Et}=_e(Rt);if(Et||yt===0){oe();return}_.current=window.requestAnimationFrame(He)},[_e,oe]),Ke=n.useCallback(()=>{_.current===null&&(x.current=null,_.current=window.requestAnimationFrame(He))},[He]);n.useEffect(()=>()=>{oe()},[oe]);const tt=n.useCallback(i=>{H.current=i,E(i.active),i.active&&i.direction!==0?Ke():oe()},[Ke,oe]);n.useEffect(()=>{K||Se()},[Se,K]),n.useEffect(()=>{const i=b=>{const W=b.detail?.paneId;W&&d&&W!==d||Se()};return window.addEventListener(at,i),()=>{window.removeEventListener(at,i)}},[d,Se]),n.useEffect(()=>{if(!K)return;const i=b=>{if(!H.current.active)return;const A=b.target;if(!(A instanceof Node)){Se();return}j.current?.getElement()?.contains(A)||Se()};return document.addEventListener("pointerdown",i,!0),()=>{document.removeEventListener("pointerdown",i,!0)}},[Se,K]);const a=i=>{if(!xe||we<=0||Y<=0)return 0;const b=le(i,0,we);return le(b/we*Y,0,Y)},I=i=>{const b=Math.max(Math.round(e/Yt),Ot);_e(i*b)},{handleArrowPointerDown:v,handleArrowPointerUp:D,handleArrowKeyDown:q}=$t({canUseArrowButtons:Ae,enableArrowButtons:f,resetTapScroll:Se,scrollByStep:I}),$=i=>{if(!xe)return;if(!o){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;Se();const b=i.currentTarget;b.setPointerCapture&&b.setPointerCapture(i.pointerId),z.current={pointerId:i.pointerId,startThumbPosition:ge,startClientX:i.clientX,startClientY:i.clientY},V(!0),O(!0),i.preventDefault(),i.stopPropagation()},Pe=i=>{const b=z.current;if(b.pointerId!==i.pointerId)return;const A=i.clientX-b.startClientX,W=i.clientY-b.startClientY,be=se(A,W),Ie=a(b.startThumbPosition+be);Ce(Ie),i.cancelable&&i.preventDefault()},Ne=i=>{if(z.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),z.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},V(!1),k.current&&!k.current.matches(":hover")&&O(!1),i.preventDefault(),i.stopPropagation()},ke=i=>{if(z.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),z.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},V(!1),k.current&&!k.current.matches(":hover")&&O(!1)},Le=i=>{if(!xe)return;if(!l){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;const b=i.currentTarget,A=b.getBoundingClientRect(),be=ee(i)-(p?A.left:A.top);Se();const Ie=be-Z/2,Ve=a(Ie);Ce(Ve),b.setPointerCapture&&b.setPointerCapture(i.pointerId),N.current={pointerId:i.pointerId,startThumbPosition:Ie,startClientX:i.clientX,startClientY:i.clientY},i.preventDefault(),i.stopPropagation()},Xe=i=>{const b=N.current;if(b.pointerId!==i.pointerId)return;const A=i.clientX-b.startClientX,W=i.clientY-b.startClientY,be=se(A,W),Ie=a(b.startThumbPosition+be);Ce(Ie),i.cancelable&&i.preventDefault()},Oe=i=>{if(N.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),N.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},i.preventDefault(),i.stopPropagation()},je=i=>{if(N.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),N.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}},X=n.useMemo(()=>le((ce?1:.8)*P,0,1),[ce,P]),qe=n.useMemo(()=>{const b=`calc(50% - ${te/2}px + ${ne}px)`;return{left:ve,top:b}},[ve,ne,te]),nt=(i,b,A)=>L.jsx("button",{type:"button",tabIndex:-1,className:"aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",style:{[G]:m,[fe]:c},"aria-label":b,onMouseDown:v(i),onTouchStart:v(i),onMouseUp:D,onMouseLeave:D,onTouchEnd:D,onTouchCancel:D,onKeyDown:q(i),"aria-disabled":!f,disabled:!Ae,children:L.jsx("span",{"aria-hidden":"true",children:A})}),Ge=T&&xe?{orientation:Te,scrollPosition:t,maxScrollPosition:Y,contentSize:s,viewportSize:e,thumbSize:Z,thumbPosition:ge,thumbCenter:Re,trackSize:h,isDragging:F,isTapScrollActive:ce}:null;return L.jsxs("div",{className:Ue.twMerge("group relative cursor-default select-none",he,u),style:{[G]:e,[fe]:c,backgroundColor:"white",userSelect:"none",position:"relative",touchAction:"none"},role:"scrollbar",tabIndex:-1,"aria-controls":d,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":Y,"aria-orientation":p?"horizontal":"vertical",children:[!p&&xe&&K&&L.jsx(gt,{ref:j,className:Ue.twMerge("pointer-events-auto absolute transition-opacity duration-150",U),size:te,maxVisualDistance:ye,style:qe,opacity:X,renderVisual:M,onDragChange:tt}),nt(-1,me[0],de[0]),L.jsxs("div",{className:"aqvs:scrollbar-track relative flex-1",style:{borderRadius:c/2,touchAction:"none"},onPointerDown:Le,onPointerMove:Xe,onPointerUp:Oe,onPointerCancel:je,"aria-disabled":!l,children:[Ge&&L.jsx("div",{className:"pointer-events-none absolute inset-0","aria-hidden":!0,children:T?.(Ge)}),xe&&L.jsx("div",{className:"group absolute",style:{[G]:Z,[Q]:ge,...p?{top:0,bottom:0}:{left:0,right:0},touchAction:"none"},onPointerDown:$,onPointerMove:Pe,onPointerUp:Ne,onPointerCancel:ke,role:"slider","aria-orientation":p?"horizontal":"vertical","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":Y,"aria-disabled":!o,tabIndex:-1,children:L.jsx("div",{ref:k,className:Ue.twMerge("aqvs:scrollbar-thumb absolute",p?"aqvs:scrollbar-thumb-horizontal":"aqvs:scrollbar-thumb-vertical"),"data-thumb-state":Ye,style:{borderRadius:c-1,cursor:o?"pointer":"default"},onMouseEnter:()=>{o&&O(!0)},onMouseLeave:()=>{o&&O(!1)}})})]}),nt(1,me[1],de[1])]})},Me={debug(s,...e){typeof window<"u"&&window.localStorage?.getItem("debug")==="true"&&console.debug(`[VirtualScroll] ${s}`,...e)},warn(s,...e){console.warn(`[VirtualScroll] ${s}`,...e)},error(s,...e){console.error(`[VirtualScroll] ${s}`,...e)}},$e={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},Qe=(s,e,t)=>{for(const[r,o,l]of e)t==="add"?s.addEventListener(r,o,l):s.removeEventListener(r,o,l)},bt=n.forwardRef(({children:s,contentSize:e,viewportSize:t,scrollBarWidth:r=12,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,enablePointerDrag:p=!0,onScroll:c,className:u,style:d,background:g,tapScrollCircleOptions:C,inertiaOptions:T,itemCount:F,renderThumbOverlay:V,wheelSpeedMultiplier:J=1,contentInsets:O},ce)=>{const E=n.useRef(0),k=n.useRef(null),z=n.useRef(null),N=n.useRef({frame:null,velocity:0,lastTimestamp:null}),R=n.useMemo(()=>({maxVelocity:T?.maxVelocity??$e.maxVelocity,minVelocity:T?.minVelocity??$e.minVelocity,deceleration:T?.deceleration??$e.deceleration,velocitySampleWindow:T?.velocitySampleWindow??$e.velocitySampleWindow,startVelocityThreshold:T?.startVelocityThreshold??$e.startVelocityThreshold}),[T]),H=n.useMemo(()=>({top:Math.max(0,O?.top??0),bottom:Math.max(0,O?.bottom??0)}),[O]);Me.debug("[ScrollPane] ScrollPane rendered",{contentSize:e,viewportSize:t,scrollBarWidth:r,className:u,style:d,tapScrollCircleOptions:C,inertiaOptions:T,enablePointerDrag:p,contentInsets:H});const j=n.useRef({contentSize:e,viewportSize:t}),_=n.useMemo(()=>e>t,[e,t]),x=n.useCallback(P=>{const{contentSize:M,viewportSize:re}=j.current,B=M>re,G=E.current;if(Me.debug("[ScrollPane] scrollTo called",{newPosition:P,contentSize:M,viewportSize:re,currentIsScrollable:B,prevPosition:G}),!B)return E.current!==0&&(E.current=0,c?.(0,G)),E.current;const fe=typeof P=="function"?P(E.current):P,Q=Math.max(M-re,0),se=le(fe,0,Q);return E.current!==se&&(E.current=se,c?.(se,G)),E.current},[c]),w=n.useCallback(()=>{const P=N.current;P.frame!==null&&cancelAnimationFrame(P.frame),P.frame=null,P.velocity=0,P.lastTimestamp=null},[]),S=n.useRef(w);n.useEffect(()=>{S.current=w},[w]);const K=n.useCallback(P=>{if(!_)return;const{maxVelocity:M,minVelocity:re,deceleration:B,startVelocityThreshold:G}=R,fe=le(P,-M,M);if(Math.abs(fe)<G)return;w(),N.current.velocity=fe,N.current.lastTimestamp=null;const Q=se=>{const ee=N.current;if(ee.lastTimestamp===null){ee.lastTimestamp=se,ee.frame=requestAnimationFrame(Q);return}const me=se-ee.lastTimestamp;if(ee.lastTimestamp=se,me<=0){ee.frame=requestAnimationFrame(Q);return}const de=ee.velocity;let he=de;const Te=B*me;de>0?he=Math.max(0,de-Te):de<0&&(he=Math.min(0,de+Te));const Ee=(de+he)/2*me,m=E.current;Ee!==0&&x(ge=>ge+Ee);const h=E.current,{contentSize:pe,viewportSize:Z}=j.current,Y=Math.max(pe-Z,0);ee.velocity=he;const we=h===m||h<=0&&he<=0||h>=Y&&he>=0;if(Math.abs(he)<re||we){w();return}ee.frame=requestAnimationFrame(Q)};N.current.frame=requestAnimationFrame(Q)},[_,R,x,w]),te=n.useRef(K);n.useEffect(()=>{te.current=K},[K]),n.useLayoutEffect(()=>{j.current={contentSize:e,viewportSize:t}},[e,t]),n.useLayoutEffect(()=>{if(_){Me.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",{contentSize:e,viewportSize:t,scrollPosition:E.current});const P=le(e-t,0,e);E.current>P&&x(P)}else x(0)},[_,x,e,t]),n.useEffect(()=>{const P=re=>{if(!_)return;re.preventDefault(),w();let B=re.deltaY;re.deltaMode===1?B*=16:re.deltaMode===2&&(B*=t),J!==1&&(B*=J),Me.debug("[ScrollPane] wheel event",{deltaY:B,scrollPosition:E.current,wheelSpeedMultiplier:J}),x(G=>G+B)},M=k.current;return M&&M.addEventListener("wheel",P,{passive:!1}),()=>{M&&M.removeEventListener("wheel",P)}},[_,x,w,t,J]),n.useImperativeHandle(ce,()=>({scrollTo:x,getScrollPosition:()=>E.current,getContentSize:()=>e,getViewportSize:()=>t}),[x,e,t]);const ve=n.useRef(x);n.useEffect(()=>{ve.current=x},[x]);const ne=n.useId(),U=n.useRef({pointerId:null,startClientY:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[]}),ae=n.useRef(p);n.useEffect(()=>{ae.current=p},[p]);const ue=n.useRef(_);n.useEffect(()=>{ue.current=_},[_]);const y=n.useRef(R);return n.useEffect(()=>{y.current=R},[R]),n.useEffect(()=>{if(p)return;const P=z.current,M=U.current;M.pointerId!==null&&P&&P.hasPointerCapture(M.pointerId)&&P.releasePointerCapture(M.pointerId),M.clickResetTimer!==null&&(window.clearTimeout(M.clickResetTimer),M.clickResetTimer=null),M.pointerId=null,M.startClientY=0,M.startScroll=0,M.isDragging=!1,M.shouldCancelNextClick=!1,M.velocitySamples=[]},[p]),n.useEffect(()=>{const P=z.current;if(!P)return;const M=6,re=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),B=()=>{const m=U.current;m.pointerId=null,m.startClientY=0,m.startScroll=0,m.isDragging=!1,m.velocitySamples=[]},G=()=>{const m=U.current;m.clickResetTimer!==null&&(window.clearTimeout(m.clickResetTimer),m.clickResetTimer=null)},fe=m=>{const h=U.current,pe=re();h.velocitySamples.push({clientY:m,time:pe});const Z=y.current.velocitySampleWindow;h.velocitySamples=h.velocitySamples.filter(Y=>pe-Y.time<=Z)},Q=m=>m instanceof HTMLElement&&m.closest("[data-scrollpane-ignore-drag='true']")!==null,se=m=>{const h=U.current;h.shouldCancelNextClick&&(m.preventDefault(),m.stopPropagation(),h.shouldCancelNextClick=!1)},ee=m=>{const h=U.current;h.isDragging||(h.isDragging=!0,h.shouldCancelNextClick=!0,P.hasPointerCapture(m.pointerId)||P.setPointerCapture(m.pointerId),fe(m.clientY))},me=m=>{const h=U.current;if(h.pointerId!==m.pointerId||!(ae.current&&ue.current)||!h.isDragging&&(Math.abs(m.clientY-h.startClientY)<M||(ee(m),!h.isDragging)))return;fe(m.clientY);const pe=m.clientY-h.startClientY,Z=h.startScroll-pe;ve.current(Z),m.cancelable&&m.preventDefault()},de=m=>{const h=U.current;if(h.pointerId!==m.pointerId)return;h.isDragging&&h.shouldCancelNextClick&&m.cancelable&&(m.preventDefault(),m.stopPropagation()),P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId);let pe=0;if(h.isDragging&&h.velocitySamples.length>=2){const Y=h.velocitySamples,we=y.current.velocitySampleWindow,ge=Y[Y.length-1],Re=Y.find(xe=>ge.time-xe.time<=we)??Y[0];if(ge&&Re&&ge.time!==Re.time){const xe=ge.clientY-Re.clientY,Ae=ge.time-Re.time;pe=-(xe/Ae)}}G(),h.shouldCancelNextClick&&(h.clickResetTimer=window.setTimeout(()=>{const Y=U.current;Y.shouldCancelNextClick=!1,Y.clickResetTimer=null},0));const Z=y.current.startVelocityThreshold;B(),Math.abs(pe)>=Z&&te.current?.(pe)},he=m=>{if(!(ae.current&&ue.current)||m.button!==0&&m.pointerType==="mouse"||m.ctrlKey||m.metaKey||m.altKey||Q(m.target))return;window.dispatchEvent(new CustomEvent(at,{detail:{paneId:ne}})),S.current?.();const h=U.current;G(),h.pointerId=m.pointerId,h.startClientY=m.clientY,h.startScroll=E.current,h.isDragging=!1,h.shouldCancelNextClick=!1,h.velocitySamples=[]},Te=m=>{const h=U.current;h.pointerId===m.pointerId&&(h.shouldCancelNextClick=!1,P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId),G(),B())},ye=[["click",se,!0],["pointerdown",he,{passive:!1}],["pointermove",me,{passive:!1}],["pointerup",de,void 0],["pointercancel",Te,void 0]],Ee=[["pointermove",me,{passive:!1}],["pointerup",de,void 0],["pointercancel",Te,void 0]];return Qe(P,ye,"add"),Qe(window,Ee,"add"),()=>{Qe(P,ye,"remove"),Qe(window,Ee,"remove");const m=U.current;m.pointerId!==null&&P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId),G(),B()}},[ne]),L.jsxs("div",{ref:k,className:Ue.twMerge("flex",u),style:d,children:[L.jsxs("div",{ref:z,className:Ue.twMerge("relative h-full flex-1 overflow-hidden"),style:{height:t,paddingTop:H.top,paddingBottom:H.bottom,...p?{touchAction:"none"}:{}},id:ne,children:[g,s(E.current)]}),_&&L.jsx(xt,{contentSize:e,viewportSize:t,scrollPosition:E.current,onScroll:x,enableThumbDrag:o,enableTrackClick:l,enableArrowButtons:f,scrollBarWidth:r,ariaControls:ne,tapScrollCircleOptions:C,itemCount:F,renderThumbOverlay:V})]})}),dt=(s,e,t)=>Math.min(Math.max(s,e),t),Kt=({dragState:s,normalizedDistance:e,sizeScale:t,size:r})=>{const o=Math.max(r/2,1),l=1+e*.65,f=Math.max(.65,1-e*.25),p=s.direction*e*26*t,c=.8+e*.18,u=3*t,d=6*t,g=22*t,C=Math.abs(p)+d,T=p>0?u:-Math.abs(p)-u,F=Math.max(2.5,3*t),V=dt(s.offsetX,-o,o),J=dt(s.offsetY,-o,o),O=o*.35,ce=V/o*O,E=J/o*O,k=ce*.45,z=E*.45,N=Math.max(g*.38,6),R=.65+e*.2,H=s.active;return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"aqvs:tap-scroll-circle-gradient absolute inset-0 rounded-full border border-white/40 shadow-md",style:{transform:`scale(${f}, ${l})`,transition:H?"40ms transform ease-out":"200ms ease transform"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full border border-white/50 bg-white/85",style:{width:g,height:g,transform:`translate(calc(-50% + ${ce}px), calc(-50% + ${E}px)) scale(${f}, ${c*l})`,transition:H?"70ms transform ease-out":"200ms ease transform"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/80",style:{width:N,height:N,transform:`translate(calc(-50% + ${k}px), calc(-50% + ${z}px)) scale(${f}, ${l})`,opacity:R,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:H?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/50",style:{width:F,height:C,transform:`translate(-50%, ${T}px)`,opacity:e,transition:H?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},Gt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},et=s=>{if(s<=0||!Number.isFinite(s))return 0;const e=Math.trunc(s),t=BigInt(e)&-BigInt(e);return Number(t)};class It{tree;deltas;size;baseValue;valueFn;total;constructor(e,t,r){this.reset(e,t,r)}reset(e,t,r){if(this.size=e,this.tree=new Map,this.deltas=new Map,this.total=void 0,typeof t=="function"){if(this.valueFn=t,this.size>0){const l=r?.sampleRange??{from:0,to:Math.min(99,this.size-1)},{mode:f,materializedValues:p}=this._calculateMode(l.from,l.to);if(this.baseValue=f,r?.materialize)for(let c=0;c<p.length;c++){const u=p[c],d=l.from+c;if(d>=this.size)break;const g=u-this.baseValue;this.deltas.set(d,g),this._updateTree(d,g)}}else this.baseValue=0;this.total=this.getTotal()}else this.valueFn=void 0,this.baseValue=t,this.total=this.baseValue*this.size}setValueFn(e){typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e)}_calculateMode(e,t){if(!this.valueFn)return{mode:0,materializedValues:[]};const r=[];for(let u=e;u<=t&&!(u>=this.size);u++)r.push(this.valueFn(u));const o=[...r];if(r.length===0)return{mode:0,materializedValues:[]};r.sort((u,d)=>u-d);const l=Math.floor(r.length/2);let f;r.length%2===0?f=Math.floor((r[l-1]+r[l])/2):f=r[l];const p=new Map;let c=0;for(const u of r){const d=(p.get(u)??0)+1;p.set(u,d),d>c&&(c=d)}if(c>1){const u=[];for(const[g,C]of p.entries())C===c&&u.push(g);const d=u.reduce((g,C)=>g+C,0);f=Math.floor(d/u.length)}return{mode:f,materializedValues:o}}update(e,t){return this.updates([{index:e,value:t}])}updates(e){const t=this._buildDeltaUpdates(e);return t.length>0?this.updateDeltas(t):this.total}updateDelta(e,t){return this.updateDeltas([{index:e,change:t}])}updateDeltas(e){for(const{index:t,change:r}of e){if(t<0||t>=this.size)throw new Error(`Index ${t} out of bounds`);const o=this.deltas.get(t)??0;this.deltas.set(t,o+r),this._updateTree(t,r)}return this.total}_updateTree(e,t){if(t===0)return;let r=e+1;for(;r<=this.size;){this.tree.set(r,(this.tree.get(r)??0)+t);const o=et(r);if(o===0)break;r+=o}this.total!==void 0&&(this.total+=t)}_buildDeltaUpdates(e){const t=[];for(const{index:r,value:o}of e){if(r<0||r>=this.size)throw new Error(`Index ${r} out of bounds`);if(o<0)throw new Error("Value cannot be negative.");const l=this.deltas.has(r)?(this.deltas.get(r)??0)+this.baseValue:this.baseValue,f=o-l;f!==0&&t.push({index:r,change:f})}return t}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,t=this.size;for(;t>0;){e+=this.tree.get(t)??0;const r=et(t);if(r===0)break;t-=r}return e+this.baseValue*this.size}_materialize(e,t=!0){if(this.valueFn){const r=this.deltas.get(e)??0,l=this.valueFn(e)-this.baseValue;if(l!==r&&(this.deltas.set(e,l),t)){const f=l-r;this._updateTree(e,f)}}}_materializeRanges(e,t,r=!1){if(!(e?.materialize&&this.valueFn))return;const o=e.ranges;if(o&&o.length>0){for(const p of o){const c=p.from,u=Math.min(p.to,this.size-1);for(let d=c;d<=u;d++)this._materialize(d)}if(t===void 0)return;if(r){this._materialize(t);return}const l=o[0].from,f=o[o.length-1].to;t>=l&&t<=f&&this._materialize(t);return}t!==void 0&&this._materialize(t)}_findIndex(e,t={},r){if(this.size>=Number.MAX_SAFE_INTEGER)return this._findIndexLarge(e,t,r);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let o=0,l=this.size-1,f=-1,p,c=this.total;for(;o<=l;){const u=Math.floor((o+l)/2);p=this.prefixSum(u,t),c=p.total,(r?p.cumulative>=e:p.cumulative<=e)?(f=u,r?l=u-1:o=u+1):r?o=u+1:l=u-1}return{index:f,total:c,cumulative:p?.cumulative,currentValue:p?.currentValue,safeIndex:p?.safeIndex}}_findIndexLarge(e,t,r){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const o=Gt(this.size);if(o===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let l=0n,f=o-1n,p,c,u,d=this.total;for(;l<=f;){const T=l+f>>1n,F=Number(T),V=this.prefixSum(F,t);if(u=V,d=V.total,r?V.cumulative>=e:V.cumulative<=e)if(p=T,c=V,r){if(T===0n)break;f=T-1n}else l=T+1n;else if(r)l=T+1n;else{if(T===0n)break;f=T-1n}}const g=c??u;return{index:p!==void 0?Number(p):-1,total:d,cumulative:g?.cumulative,currentValue:g?.currentValue,safeIndex:g?.safeIndex}}prefixSum(e,t){if(e<0)return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};const r=le(e,0,this.size-1),o=t?.materializeOption;this._materializeRanges(o,r,!0);let l=0,f=r+1;for(;f>0;){const c=this.tree.get(f)??0;l+=c;const u=et(f);if(u===0)break;f-=u}const p=o?.materialize?this.get(r):(this.deltas.get(r)||0)+this.baseValue;return{cumulative:l+this.baseValue*(r+1),total:this.total,currentValue:p,safeIndex:r}}get(e,t){if(e<0||e>=this.size)throw new Error("Index out of bounds");const r=t?.materializeOption;return this._materializeRanges(r,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const t=e?.materializeOption;if(this._materializeRanges(t),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const r=this.prefixSum(this.getSize()-1);console.assert(r.cumulative===r.total,"Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const r=this.valueFn;this.reset(this.size,o=>r(o),{materialize:!0});return}const t=new Map;for(const[r,o]of this.deltas.entries()){if(o===0)continue;let l=r+1;for(;l<=this.size;){t.set(l,(t.get(l)??0)+o);const f=et(l);if(f===0)break;l+=f}}this.tree=t,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const t of this.deltas.values())e+=t;return this.total-e}changeSize(e){const t=this.size;if(e===t)return;if(e<t)for(const o of this.deltas.keys())o>=e&&this.deltas.delete(o);this.size=e,this.rebuildTree();const r=this.prefixSum(this.getSize()-1);console.assert(r.cumulative===r.total,"Inconsistent Fenwick Tree state")}getSize(){return this.size}findIndexAtOrAfter(e,t){return this._findIndex(e,t??{},!0)}findIndexAtOrBefore(e,t){return this._findIndex(e,t??{},!1)}}const Tt=(s,e,t)=>{const r=Math.max(0,s),o=n.useRef(null),l=n.useMemo(()=>new It(r,e,t),[r,e,t]);return Object.is(o.current,l)||console.warn("[useFenwickMapTree] instance changed"),o.current=l,l};class Zt{key;value;prev=null;next=null;constructor(e,t){this.key=e,this.value=t}}class pt{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 Ct(s){const e=n.useRef(new Map),t=n.useRef(new pt);n.useEffect(()=>{for(;e.current.size>s;){const d=t.current.removeHead();if(d)e.current.delete(d.key);else break}},[s]);const r=n.useCallback(d=>{const g=e.current.get(d);if(g)return t.current.moveToTail(g),g.value},[]),o=n.useCallback((d,g)=>{if(s<=0)return;let C=e.current.get(d);if(C)C.value=g,t.current.moveToTail(C);else{if(e.current.size>=s){const T=t.current.removeHead();T&&e.current.delete(T.key)}C=new Zt(d,g),e.current.set(d,C),t.current.addToTail(C)}},[s]),l=n.useCallback(d=>e.current.has(d),[]),f=n.useCallback(d=>{const g=e.current.get(d);g&&(t.current.remove(g),e.current.delete(d))},[]),p=n.useCallback(()=>{e.current.clear(),t.current=new pt},[]),[c,u]=n.useState(()=>({get:r,set:o,has:l,remove:f,clear:p}));return n.useEffect(()=>u({get:r,set:o,has:l,remove:f,clear:p}),[r,o,l,f,p]),c}const Jt=1e4,Qt=()=>{const{get:s,set:e,has:t,clear:r}=Ct(Jt);return{get:s,set:e,has:t,clear:r}},ie=(s,e)=>e<=0?0:le(s,0,e-1),en=s=>({top:Math.max(0,s?.top??0),bottom:Math.max(0,s?.bottom??0)}),ze=(s,e)=>s<=e?0:s-e,We=(s,e)=>s<=0?e:s+e,mt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},tn=(s,e,t,r,o,l,f,p)=>{const c=mt(r);if(c===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const u=k=>k<0n?0n:k>=c?c-1n:k,d={materializeOption:{materialize:!1}},{index:g}=l.findIndexAtOrAfter(s,d);let C;g===-1?C=c-1n:(C=mt(g),C>=c&&(C=c-1n)),s<=0&&(C=0n),p&&s>=f&&(C=c-1n);const T=k=>{let z=0,N=k,R=k,H=0n;for(;N<c&&z<e;){const j=Number(N),_=o(j);if(z+=_,R=N,N+=1n,H+=1n,!Number.isFinite(_)||_<=0)break}return H===0n&&(R=k),{height:z,end:R}};let{height:F,end:V}=T(C);if(F<e&&C>0n){let k=C,z=F;for(;k>0n&&z<e;){k-=1n;const R=Number(k),H=o(R);if(z+=H,!Number.isFinite(H)||H<=0)break}C=u(k);const N=T(C);F=N.height,V=N.end}const J=u(C),O=u(V),ce=u(J-BigInt(Math.max(0,t))),E=u(O+BigInt(Math.max(0,t)));return{renderingStartIndex:ie(Number(ce),r),renderingEndIndex:ie(Number(E),r),visibleStartIndex:ie(Number(J),r),visibleEndIndex:ie(Number(O),r)}},nn=(s,e,t,r,o,l)=>{if(r===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const f=l.getTotal(),p=Number.isFinite(f),c=p?Math.min(s,f):s;if(r>Number.MAX_SAFE_INTEGER)return tn(c,e,t,r,o,l,f,p);const{index:u,cumulative:d,currentValue:g}=l.findIndexAtOrAfter(c,{materializeOption:{materialize:!1}}),C=u===-1?e<=0||(d??0)<c+(g??0)?r-1:0:u;let T=ie(C,r),F=0,V=T;for(;V<r&&F<e;)F+=o(V),V++;if(F<e&&T>0){let E=F,k=T-1;for(;k>=0&&E<e;)E+=o(k),k--;for(T=ie(k+1,r),F=0,V=T;V<r&&F<e;)F+=o(V),V++}const J=ie(T-t,r),O=ie(Math.max(V-1,T),r),ce=ie(O+t,r);return{renderingStartIndex:J,renderingEndIndex:ce,visibleStartIndex:T,visibleEndIndex:O}},rn=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),ht=(s,e,t)=>{const r=Math.max(0,e??0),o=n.useRef({lastInvokeAt:0,rafId:null,pendingPayload:null,loopActive:!1,normalizedThrottle:r}),l=n.useCallback(()=>{const c=o.current;c.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c.rafId),c.rafId=null,c.loopActive=!1},[]),f=n.useCallback(c=>{const u=o.current;u.rafId=null;const d=typeof c=="number"?c:rn(),g=u.normalizedThrottle,C=u.pendingPayload,T=s.current;if(C!==null&&T){const F=d-u.lastInvokeAt;(g===0||u.lastInvokeAt===0||F>=g)&&(u.pendingPayload=null,u.lastInvokeAt=d,t(T,C))}if(u.pendingPayload!==null){typeof requestAnimationFrame=="function"?u.rafId=requestAnimationFrame(f):u.loopActive=!1;return}u.loopActive=!1},[s,t]),p=n.useCallback(()=>{const c=o.current;if(!c.loopActive){if(c.loopActive=!0,typeof requestAnimationFrame=="function"){c.rafId=requestAnimationFrame(f);return}c.loopActive=!1}},[f]);return n.useEffect(()=>()=>{l(),o.current.pendingPayload=null},[l]),n.useEffect(()=>{l();const c=o.current;c.lastInvokeAt=0,c.pendingPayload=null,c.normalizedThrottle=r},[r,l]),n.useCallback(c=>{const u=o.current;u.pendingPayload=c,p()},[p])},sn=({itemCount:s,getItem:e,getItemHeight:t,viewportSize:r,overscanCount:o=15,className:l,onScroll:f,onRangeChange:p,children:c,background:u,initialScrollIndex:d,initialScrollOffset:g,tapScrollCircleOptions:C,scrollBarWidth:T,enableThumbDrag:F,enableTrackClick:V,enableArrowButtons:J,enablePointerDrag:O,inertiaOptions:ce,callbackThrottleMs:E=5,renderThumbOverlay:k,wheelSpeedMultiplier:z,contentInsets:N,enableKeyboardNavigation:R=!0},H)=>{const j=n.useRef(null),_=n.useRef(!1),x=n.useMemo(()=>en(N),[N]),w=n.useRef({size:s,valueOrFn:t,options:{sampleRange:{from:0,to:100}}}),S=Tt(w.current.size,w.current.valueOrFn,w.current.options),[K]=n.useState(()=>{let a=x.top,I=0;if(typeof d=="number"){const v=le(d,0,s-1),D=le(v-o*2,0,s-1),q=le(v+o*2,0,s-1),$=d>0?{materializeOption:{materialize:!0,ranges:[{from:D,to:q}]}}:void 0,{cumulative:Pe,total:Ne,currentValue:ke}=S.prefixSum(d,$),Le=Math.max(Pe-ke,0);a=We(Le,x.top),I=Ne??S.getTotal()}else typeof g=="number"&&(a=We(Math.max(g,0),x.top)),I=S.getTotal();return{position:a,total:I}}),[te,ve]=n.useState(K.position),[ne,U]=n.useState(K.total),[ae,ue]=n.useState(K.position),[y,P]=n.useState(s),M=n.useRef(K.position),re=n.useRef(x.top),B=n.useRef(f??void 0),G=n.useRef(p??void 0),fe=n.useRef(new Map),Q=n.useRef(null),se=n.useRef(null);n.useEffect(()=>{B.current=f??void 0,G.current=p??void 0},[p,f]);const ee=n.useCallback(a=>{if(R&&a&&typeof a.focus=="function")try{a.focus({preventScroll:!0})}catch{a.focus()}},[R]),me=ht(B,E,(a,{position:I,totalHeight:v})=>{a(I,v)}),de=ht(G,E,(a,{renderingStartIndex:I,renderingEndIndex:v,visibleStartIndex:D,visibleEndIndex:q,scrollPosition:$,totalHeight:Pe})=>{a(I,v,D,q,$,Pe)});n.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]),n.useEffect(()=>{R||(fe.current.clear(),Q.current=null,se.current=null)},[R]);const he=.01,Te=n.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:K.position}),ye=n.useCallback(()=>{const a=Te.current;a.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.rafId),a.rafId=null,a.loopActive=!1,a.idleFrames=0},[]);n.useEffect(()=>()=>{ye()},[ye]);const Ee=n.useCallback(()=>{const a=Te.current;a.rafId=null;const I=M.current,v=ze(I,x.top),D=S.getTotal();if(ve($=>Math.abs($-I)<he?$:I),me({position:v,totalHeight:D}),Math.abs(a.lastRenderedPosition-I)>=he?(a.lastRenderedPosition=I,a.idleFrames=0):a.idleFrames+=1,a.idleFrames>=2){ye();return}if(typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(Ee);return}a.loopActive=!1},[S,x.top,me,ye]),m=n.useCallback(()=>{const a=Te.current;if(a.idleFrames=0,!a.loopActive){if(a.loopActive=!0,typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(Ee);return}a.loopActive=!1}},[Ee]),h=n.useCallback((a,I)=>{const v=I?.immediate??!1,D=ze(a,x.top);if(M.current=a,v){Te.current.lastRenderedPosition=a,Te.current.idleFrames=0,ve(a),me({position:D,totalHeight:S.getTotal()});return}m()},[m,S,x.top,me]),pe=n.useRef(!1);n.useEffect(()=>{if(!pe.current)if(pe.current=!0,typeof g=="number"){const a=We(Math.max(g,0),x.top),I=Math.abs(a-M.current)>.5;h(a,{immediate:!0}),I&&ue(a)}else h(M.current,{immediate:!0})},[g,x.top,h]),n.useLayoutEffect(()=>{S.setValueFn(t),y!==s&&(S.changeSize(s),P(s));const a=S.getTotal();ne!==a&&U(a)},[S,y,s,ne,t]),n.useLayoutEffect(()=>{ae!==null&&j.current&&(Me.debug("[VirtualScroll] Scrolling to position:",ae),j.current.scrollTo(ae),ue(null))},[ae]),n.useEffect(()=>{const a=re.current;if(a===x.top)return;const I=ze(M.current,a),v=We(I,x.top);re.current=x.top,M.current=v,ue(v),h(v,{immediate:!0})},[x.top,h]);const Z=n.useCallback(a=>{if(!j.current)return;const I=ie(a,y),v=ie(I-o*2,y),D=ie(I+o*2,y),{cumulative:q,total:$,currentValue:Pe}=S.prefixSum(I,{materializeOption:{materialize:!0,ranges:[{from:v,to:D}]}});if(Me.debug("[VirtualScroll] Scrolling to index:",I,"Offset:",q,"Total height:",$,"Current value:",Pe,"safeIndexFrom:",v,"safeIndexTo:",D),!$)return;const Ne=Math.max(q-Pe,0),ke=We(Ne,x.top);U($),ue(ke),Me.debug("[VirtualScroll] Setting scroll position to:",ke)},[S,o,y,x.top]),Y=n.useCallback(a=>{if(!j.current)return;const I=S.getTotal(),v=le(Math.floor(a),0,I),D=S.findIndexAtOrAfter(v,{materializeOption:{materialize:!1}}).index;Z(D)},[S,Z]),we=n.useCallback(a=>{const I=ze(M.current,x.top),v=typeof a=="function"?a(I):a;Y(v);const D=j.current?.getScrollPosition(),q=typeof D=="number"?D:M.current;return h(q),q},[x.top,Y,h]),ge=n.useCallback((a,I)=>{Me.debug("[VirtualScroll] Scroll position changed:",a),h(a)},[h]),Re=n.useMemo(()=>ze(te,x.top),[x.top,te]),xe=n.useMemo(()=>{const a=nn(Re,r,o,y,t,S);return Me.debug("[VirtualScroll] Calculated rendering range:",{...a,scrollPosition:Re,renderingContentSize:S.getTotal(),overscanCount:o,viewportSize:r}),a},[Re,r,o,y,t,S]),{renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e}=xe,oe=n.useCallback((a,I)=>{if(!R||y===0)return;const v=ie(a,y);if(!(I?.ensureVisible??!0)){const je=fe.current.get(v);je&&(Q.current=null,se.current=v,ee(je));return}const q=S.prefixSum(v,{materializeOption:{materialize:!1}}),$=q.currentValue,Pe=Math.max(q.cumulative-$,0),Ne=Pe+$,ke=ze(M.current,x.top),Le=ke+r;if(Pe<ke||Ne>Le){Q.current=v,Z(v);return}const Oe=fe.current.get(v);if(Oe){Q.current=null,se.current=v,ee(Oe);return}Q.current=v},[R,y,S,x.top,Z,ee,r]),Se=n.useCallback((a,I)=>{if(!R||a.defaultPrevented||a.altKey||a.metaKey||a.ctrlKey)return;const v=a.target;if(v){const D=v.tagName;if(D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||v.isContentEditable)return}if(a.key==="ArrowDown"){I<y-1&&(a.preventDefault(),oe(I+1));return}if(a.key==="ArrowUp"){I>0&&(a.preventDefault(),oe(I-1));return}if(a.key==="PageDown"){if(I<y-1){a.preventDefault();const D=Math.max(_e-Ce+1,1),q=Math.max(D,1),$=ie(Math.min(I+q,y-1),y);oe($)}return}if(a.key==="PageUp"&&I>0){a.preventDefault();const D=Math.max(_e-Ce+1,1),q=Math.max(D,1),$=ie(I-q,y);oe($)}},[R,y,oe,_e,Ce]),He=n.useCallback(a=>{if(!R)return;const I=ie(a,y);Q.current=null,se.current=I},[R,y]);n.useEffect(()=>{const a=j.current?.getScrollPosition()??0,I=M.current,v=ze(I,x.top);Me.debug("[VirtualScroll] Range change effect triggered",{renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e,scrollPositionState:te,paneScrollPosition:I,logicalScrollPosition:v,contentSize:ne,scrollPaneScrollPosition:a}),de({renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e,scrollPosition:v,totalHeight:ne})},[ne,Ye,Ae,x.top,de,te,_e,Ce]);const Ke=n.useCallback(a=>{const I=(E??0)>0,v=Math.abs(a-te),D=I&&v>.5?te:a,q=ze(D,x.top);if(Me.debug("[VirtualScroll] Rendering visible items",{currentScrollPosition:a,effectiveScrollPosition:q,renderingStartIndex:Ae,renderingEndIndex:Ye,fenwickSize:y,viewportSize:r,callbackThrottleMs:E,diff:v,rawEffectiveScrollPosition:D}),y===0)return L.jsx("div",{className:"absolute w-full",style:{top:0},children:L.jsx("div",{className:"text-center text-gray-500",children:"No items"})});const $=ie(Ae,y),Pe=ie(Ye,y),{cumulative:Ne,currentValue:ke}=S.prefixSum($,{materializeOption:{materialize:!1}}),Le=Ne-ke,Xe=[],Oe=[];for(let X=$;X<=Pe;X++){const qe=t(X);S.get(X)!==qe&&Xe.push({index:X,value:qe});const{cumulative:Ge,currentValue:i}=S.prefixSum(X,{materializeOption:{materialize:!1}}),b=Ge-i,A=W=>{if(!W){fe.current.delete(X);return}R&&(fe.current.set(X,W),Q.current===X&&(Q.current=null,se.current=X,ee(W)))};Oe.push(L.jsx("div",{ref:A,"data-index":X,"data-virtualscroll-item":"true",style:{position:"absolute",top:b-Le+x.top,width:"100%"},tabIndex:R?-1:void 0,onPointerDown:R?W=>{W.currentTarget.focus({preventScroll:!0})}:void 0,onKeyDownCapture:R?W=>Se(W,X):void 0,onFocusCapture:R?()=>He(X):void 0,children:c(e(X),X)},X))}Xe.length>0&&Promise.resolve().then(()=>{if(!_.current)return;const X=S.updates(Xe);if(!_.current||typeof X!="number")return;U(X),Me.debug("[VirtualScroll] Updated heights for items",Xe,"New total height:",X);const qe=j.current?.getScrollPosition()??M.current;qe===M.current||!_.current||h(qe)});const je=Le-q;if(x.bottom>0){const X=S.getTotal()+x.top-Le;Oe.push(L.jsx("div",{style:{position:"absolute",top:X,height:x.bottom,width:"100%"}},"virtualscroll-bottom-inset"))}return Me.debug("[VirtualScroll] Rendering items",{nodeCount:Oe.length,containerTop:je,logicalScrollPosition:Re,resolvedInsets:x,effectiveScrollPosition:q}),L.jsx("div",{className:"absolute w-full",style:{top:je},children:Oe})},[E,c,R,S,y,e,t,He,Se,Re,Ye,Ae,x,te,ee,h,r]);n.useImperativeHandle(H,()=>({getScrollPosition:()=>j.current?.getScrollPosition()??-1,getContentSize:()=>j.current?.getContentSize()??-1,getViewportSize:()=>j.current?.getViewportSize()??-1,scrollTo:we,scrollToIndex:Z,getFenwickTreeTotalHeight:()=>S.getTotal(),getFenwickSize:()=>S.getSize(),focusItemAtIndex:oe}),[we,Z,S,oe]);const tt=ne+x.top+x.bottom;return L.jsx(bt,{ref:j,contentSize:tt,viewportSize:r,className:l,onScroll:ge,background:u,tapScrollCircleOptions:C,inertiaOptions:ce,itemCount:s,scrollBarWidth:T,enableThumbDrag:F,enableTrackClick:V,enableArrowButtons:J,enablePointerDrag:O,renderThumbOverlay:k,wheelSpeedMultiplier:z,contentInsets:x,children:Ke})},on=n.forwardRef(sn);exports.FenwickMapTree=It;exports.ScrollBar=xt;exports.ScrollPane=bt;exports.VirtualScroll=on;exports.minmax=le;exports.tapScrollCircleSampleVisual=Kt;exports.useFenwickMapTree=Tt;exports.useHeightCache=Qt;exports.useLruCache=Ct;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as Q, jsxs as Gt, Fragment as
|
|
2
|
-
import { forwardRef as me, useState as Yt, useRef as
|
|
1
|
+
import { jsx as Q, jsxs as Gt, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as me, useState as Yt, useRef as M, useCallback as y, useImperativeHandle as he, useMemo as Vt, useEffect as L, useLayoutEffect as se, useId as Le } from "react";
|
|
3
3
|
import { twMerge as jt } from "tailwind-merge";
|
|
4
4
|
const xe = {
|
|
5
5
|
active: !1,
|
|
@@ -9,7 +9,7 @@ const xe = {
|
|
|
9
9
|
direction: 0
|
|
10
10
|
}, de = 6, Ye = 8, ze = ({ dragState: r, normalizedDistance: t }) => {
|
|
11
11
|
const e = 1 + t * 0.18, n = 0.16 + t * 0.24, o = 0.38 + t * 0.28, a = r.active ? "80ms ease-out" : "220ms ease";
|
|
12
|
-
return /* @__PURE__ */ Gt(
|
|
12
|
+
return /* @__PURE__ */ Gt(we, { children: [
|
|
13
13
|
/* @__PURE__ */ Q(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
@@ -35,19 +35,19 @@ const xe = {
|
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
] });
|
|
38
|
-
},
|
|
39
|
-
const [l, c] = Yt(xe), d =
|
|
38
|
+
}, ye = me(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: o, opacity: a = 1, renderVisual: u }, f) => {
|
|
39
|
+
const [l, c] = Yt(xe), d = M(null), h = M({ x: 0, y: 0 }), b = M(null), T = M(0), k = y(
|
|
40
40
|
(C) => {
|
|
41
41
|
c(C), r(C);
|
|
42
42
|
},
|
|
43
43
|
[r]
|
|
44
|
-
), _ =
|
|
45
|
-
(C, P,
|
|
44
|
+
), _ = y(
|
|
45
|
+
(C, P, G = !1) => {
|
|
46
46
|
const { x: rt, y: Ct } = h.current, ot = C - rt, $ = P - Ct, ct = Math.abs($), dt = ct < de ? 0 : $ < 0 ? -1 : 1, A = T.current;
|
|
47
47
|
let S = dt;
|
|
48
48
|
const v = de + Ye;
|
|
49
|
-
dt === 0 ? A !== 0 && ct < v ? S = A : (S = 0,
|
|
50
|
-
active:
|
|
49
|
+
dt === 0 ? A !== 0 && ct < v ? S = A : (S = 0, G || (T.current = 0)) : dt !== A && A !== 0 && ct < v ? S = A : T.current = dt, k({
|
|
50
|
+
active: G || ct >= de,
|
|
51
51
|
offsetX: ot,
|
|
52
52
|
offsetY: $,
|
|
53
53
|
distance: ct,
|
|
@@ -55,29 +55,29 @@ const xe = {
|
|
|
55
55
|
});
|
|
56
56
|
},
|
|
57
57
|
[k]
|
|
58
|
-
), tt =
|
|
58
|
+
), tt = y((C) => {
|
|
59
59
|
if (C === null)
|
|
60
60
|
return;
|
|
61
61
|
const P = b.current;
|
|
62
62
|
P?.hasPointerCapture(C) && P.releasePointerCapture(C);
|
|
63
|
-
}, []), Y =
|
|
63
|
+
}, []), Y = y(
|
|
64
64
|
(C = !1) => {
|
|
65
65
|
C && tt(d.current), d.current = null, T.current = 0, k(xe);
|
|
66
66
|
},
|
|
67
67
|
[k, tt]
|
|
68
|
-
), ut =
|
|
68
|
+
), ut = y(
|
|
69
69
|
(C) => {
|
|
70
70
|
C.preventDefault(), C.stopPropagation();
|
|
71
|
-
const P = b.current ?? C.currentTarget, { left:
|
|
72
|
-
h.current = { x:
|
|
71
|
+
const P = b.current ?? C.currentTarget, { left: G, top: rt, width: Ct, height: ot } = P.getBoundingClientRect();
|
|
72
|
+
h.current = { x: G + Ct / 2, y: rt + ot / 2 }, d.current = C.pointerId, P.setPointerCapture(C.pointerId), _(C.clientX, C.clientY, !0);
|
|
73
73
|
},
|
|
74
74
|
[_]
|
|
75
|
-
), V =
|
|
75
|
+
), V = y(
|
|
76
76
|
(C) => {
|
|
77
77
|
d.current === C.pointerId && (C.preventDefault(), _(C.clientX, C.clientY));
|
|
78
78
|
},
|
|
79
79
|
[_]
|
|
80
|
-
), D =
|
|
80
|
+
), D = y(
|
|
81
81
|
(C) => {
|
|
82
82
|
d.current === C.pointerId && (C.preventDefault(), C.stopPropagation(), Y(!0));
|
|
83
83
|
},
|
|
@@ -122,7 +122,7 @@ const xe = {
|
|
|
122
122
|
}
|
|
123
123
|
);
|
|
124
124
|
});
|
|
125
|
-
|
|
125
|
+
ye.displayName = "TapScrollCircle";
|
|
126
126
|
const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scroll-cancel", Ie = 20, Xe = 250, He = 60, Ue = 20, qe = 20, Be = 240, Te = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0 }, fe = 2.2, $e = 8, We = 120, Ke = 1 / 60, Lt = {
|
|
127
127
|
enabled: !0,
|
|
128
128
|
size: 40,
|
|
@@ -170,11 +170,11 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
170
170
|
maxSpeedCurve: r?.maxSpeedCurve ?? Lt.maxSpeedCurve
|
|
171
171
|
};
|
|
172
172
|
}, Ze = ({ isDragging: r, isThumbHovered: t, enableThumbDrag: e }) => Vt(() => e ? r ? "dragging" : t ? "hover" : "idle" : "disabled", [e, r, t]), Je = ({ canUseArrowButtons: r, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
|
|
173
|
-
const o =
|
|
173
|
+
const o = M(null), a = M(null), u = y(() => {
|
|
174
174
|
o.current !== null && (window.clearInterval(o.current), o.current = null), a.current !== null && (window.clearTimeout(a.current), a.current = null);
|
|
175
|
-
}, []), f =
|
|
175
|
+
}, []), f = y(() => {
|
|
176
176
|
u();
|
|
177
|
-
}, [u]), l =
|
|
177
|
+
}, [u]), l = y(
|
|
178
178
|
(d) => (h) => {
|
|
179
179
|
r && (h.preventDefault(), h.stopPropagation(), e(), u(), n(d), a.current = window.setTimeout(() => {
|
|
180
180
|
o.current = window.setInterval(() => {
|
|
@@ -183,7 +183,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
183
183
|
}, Xe));
|
|
184
184
|
},
|
|
185
185
|
[r, u, e, n]
|
|
186
|
-
), c =
|
|
186
|
+
), c = y(
|
|
187
187
|
(d) => (h) => {
|
|
188
188
|
t && (h.key === "Enter" || h.key === " " || h.key === "Spacebar") && (h.preventDefault(), n(d));
|
|
189
189
|
},
|
|
@@ -213,8 +213,8 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
213
213
|
itemCount: b,
|
|
214
214
|
renderThumbOverlay: T
|
|
215
215
|
}) => {
|
|
216
|
-
const [k, _] = Yt(!1), [tt, Y] = Yt(!1), [ut, V] = Yt(!1), D =
|
|
217
|
-
enabled:
|
|
216
|
+
const [k, _] = Yt(!1), [tt, Y] = Yt(!1), [ut, V] = Yt(!1), D = M(null), X = M({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), O = M({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), R = M(e), H = M(Te), q = M(null), N = M(null), g = M(null), C = Vt(() => Ge(h, b), [b, h]), P = Vt(() => je(f), [f]), {
|
|
217
|
+
enabled: G,
|
|
218
218
|
size: rt,
|
|
219
219
|
offsetX: Ct,
|
|
220
220
|
offsetY: ot,
|
|
@@ -225,7 +225,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
225
225
|
opacity: S,
|
|
226
226
|
renderVisual: v,
|
|
227
227
|
maxSpeedCurve: it
|
|
228
|
-
} = C, W =
|
|
228
|
+
} = C, W = M({
|
|
229
229
|
viewportSize: t,
|
|
230
230
|
maxScrollPosition: Math.max(r - t, 0),
|
|
231
231
|
scrollBarVisible: r > t,
|
|
@@ -234,7 +234,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
234
234
|
tapCircleMinSpeedMultiplier: A,
|
|
235
235
|
tapCircleMaxSpeedCurve: it,
|
|
236
236
|
tapScrollCircleOptions: h
|
|
237
|
-
}), { mainSizeKey:
|
|
237
|
+
}), { mainSizeKey: Z, crossSizeKey: ft, positionKey: et, selectDelta: st, getPointerCoordinate: nt, arrowLabels: gt, arrowIcons: mt, directionClass: xt, orientation: St } = P, Et = Math.max(ct, 1), Dt = t / r, p = l, m = Math.max(t - p * 2, 0), ht = Dt * m, J = Math.min(Math.max(Ie, ht || 0), m || Ie), z = r - t, Rt = Math.max(m - J, 0), It = z <= 0 || Rt <= 0 ? 0 : e / z * Rt, At = It + J / 2, Tt = r > t, _t = Tt && u;
|
|
238
238
|
W.current = {
|
|
239
239
|
viewportSize: t,
|
|
240
240
|
maxScrollPosition: z,
|
|
@@ -249,19 +249,19 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
249
249
|
}, [e]), L(() => {
|
|
250
250
|
o || Y(!1);
|
|
251
251
|
}, [o]);
|
|
252
|
-
const Ut = Ze({ isDragging: k, isThumbHovered: tt, enableThumbDrag: o }), vt =
|
|
252
|
+
const Ut = Ze({ isDragging: k, isThumbHovered: tt, enableThumbDrag: o }), vt = y(
|
|
253
253
|
(i, x) => {
|
|
254
|
-
const E = W.current,
|
|
254
|
+
const E = W.current, j = x ?? R.current;
|
|
255
255
|
if (n) {
|
|
256
|
-
const kt = n(i,
|
|
256
|
+
const kt = n(i, j);
|
|
257
257
|
if (typeof kt == "number" && Number.isFinite(kt))
|
|
258
258
|
return R.current = kt, kt;
|
|
259
259
|
}
|
|
260
|
-
const bt = typeof i == "function" ? i(
|
|
260
|
+
const bt = typeof i == "function" ? i(j) : i, Pt = Math.max(E.maxScrollPosition, 0), Nt = E.scrollBarVisible ? pt(bt, 0, Pt) : 0;
|
|
261
261
|
return R.current = Nt, Nt;
|
|
262
262
|
},
|
|
263
263
|
[n]
|
|
264
|
-
), Ot =
|
|
264
|
+
), Ot = y(
|
|
265
265
|
(i) => {
|
|
266
266
|
const x = W.current, E = R.current;
|
|
267
267
|
if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
|
|
@@ -274,11 +274,11 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
274
274
|
return { nextPosition: bt, actualDelta: Pt, reachedBoundary: Nt };
|
|
275
275
|
},
|
|
276
276
|
[vt]
|
|
277
|
-
), at =
|
|
277
|
+
), at = y(() => {
|
|
278
278
|
N.current !== null && (window.cancelAnimationFrame(N.current), N.current = null), g.current = null;
|
|
279
|
-
}, []),
|
|
279
|
+
}, []), wt = y(() => {
|
|
280
280
|
H.current = { ...Te }, V(!1), q.current?.reset(), at();
|
|
281
|
-
}, [at]), Bt =
|
|
281
|
+
}, [at]), Bt = y(
|
|
282
282
|
(i) => {
|
|
283
283
|
const x = H.current, E = W.current;
|
|
284
284
|
if (!x.active || x.direction === 0) {
|
|
@@ -289,13 +289,13 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
289
289
|
at();
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
const
|
|
292
|
+
const j = g.current ?? i, bt = Math.max((i - j) / 1e3, 0), Pt = Math.min(bt, Ke);
|
|
293
293
|
if (g.current = i, Pt <= 0) {
|
|
294
294
|
N.current = window.requestAnimationFrame(Bt);
|
|
295
295
|
return;
|
|
296
296
|
}
|
|
297
|
-
const Nt = Math.min(x.distance, E.effectiveTapMaxDistance) / E.effectiveTapMaxDistance, kt = Nt ** 1.1, ce = typeof E.tapScrollCircleOptions?.maxSpeedMultiplier == "number", Zt = Math.max(E.viewportSize * E.tapCircleMinSpeedMultiplier, 40),
|
|
298
|
-
let ue = Math.max(E.viewportSize * E.tapCircleMaxSpeedMultiplier,
|
|
297
|
+
const Nt = Math.min(x.distance, E.effectiveTapMaxDistance) / E.effectiveTapMaxDistance, kt = Nt ** 1.1, ce = typeof E.tapScrollCircleOptions?.maxSpeedMultiplier == "number", Zt = Math.max(E.viewportSize * E.tapCircleMinSpeedMultiplier, 40), Me = ce ? Zt : 1200;
|
|
298
|
+
let ue = Math.max(E.viewportSize * E.tapCircleMaxSpeedMultiplier, Me);
|
|
299
299
|
const ne = E.tapCircleMaxSpeedCurve;
|
|
300
300
|
if (ne) {
|
|
301
301
|
const re = Math.max(ne.exponentialSteepness, 0), Fe = Math.max(ne.exponentialScale ?? E.tapCircleMaxSpeedMultiplier, 0), Ne = re === 0 ? Nt : Math.expm1(re * Nt), ge = re === 0 ? 1 : Math.expm1(re) || 1, ke = ge === 0 ? Nt : Math.min(Math.max(Ne / ge, 0), 1), Oe = E.viewportSize * Fe * ke;
|
|
@@ -309,45 +309,45 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
309
309
|
N.current = window.requestAnimationFrame(Bt);
|
|
310
310
|
},
|
|
311
311
|
[Ot, at]
|
|
312
|
-
), te =
|
|
312
|
+
), te = y(() => {
|
|
313
313
|
N.current === null && (g.current = null, N.current = window.requestAnimationFrame(Bt));
|
|
314
314
|
}, [Bt]);
|
|
315
315
|
L(() => () => {
|
|
316
316
|
at();
|
|
317
317
|
}, [at]);
|
|
318
|
-
const ae =
|
|
318
|
+
const ae = y(
|
|
319
319
|
(i) => {
|
|
320
320
|
H.current = i, V(i.active), i.active && i.direction !== 0 ? te() : at();
|
|
321
321
|
},
|
|
322
322
|
[te, at]
|
|
323
323
|
);
|
|
324
324
|
L(() => {
|
|
325
|
-
|
|
326
|
-
}, [
|
|
325
|
+
G || wt();
|
|
326
|
+
}, [wt, G]), L(() => {
|
|
327
327
|
const i = (x) => {
|
|
328
|
-
const
|
|
329
|
-
|
|
328
|
+
const j = x.detail?.paneId;
|
|
329
|
+
j && d && j !== d || wt();
|
|
330
330
|
};
|
|
331
331
|
return window.addEventListener(pe, i), () => {
|
|
332
332
|
window.removeEventListener(pe, i);
|
|
333
333
|
};
|
|
334
|
-
}, [d,
|
|
335
|
-
if (!
|
|
334
|
+
}, [d, wt]), L(() => {
|
|
335
|
+
if (!G)
|
|
336
336
|
return;
|
|
337
337
|
const i = (x) => {
|
|
338
338
|
if (!H.current.active)
|
|
339
339
|
return;
|
|
340
340
|
const E = x.target;
|
|
341
341
|
if (!(E instanceof Node)) {
|
|
342
|
-
|
|
342
|
+
wt();
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
|
-
q.current?.getElement()?.contains(E) ||
|
|
345
|
+
q.current?.getElement()?.contains(E) || wt();
|
|
346
346
|
};
|
|
347
347
|
return document.addEventListener("pointerdown", i, !0), () => {
|
|
348
348
|
document.removeEventListener("pointerdown", i, !0);
|
|
349
349
|
};
|
|
350
|
-
}, [
|
|
350
|
+
}, [wt, G]);
|
|
351
351
|
const s = (i) => {
|
|
352
352
|
if (!Tt || Rt <= 0 || z <= 0)
|
|
353
353
|
return 0;
|
|
@@ -356,10 +356,10 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
356
356
|
}, I = (i) => {
|
|
357
357
|
const x = Math.max(Math.round(t / qe), Ue);
|
|
358
358
|
Ot(i * x);
|
|
359
|
-
}, { handleArrowPointerDown:
|
|
359
|
+
}, { handleArrowPointerDown: w, handleArrowPointerUp: F, handleArrowKeyDown: B } = Je({
|
|
360
360
|
canUseArrowButtons: _t,
|
|
361
361
|
enableArrowButtons: u,
|
|
362
|
-
resetTapScroll:
|
|
362
|
+
resetTapScroll: wt,
|
|
363
363
|
scrollByStep: I
|
|
364
364
|
}), K = (i) => {
|
|
365
365
|
if (!Tt)
|
|
@@ -370,7 +370,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
370
370
|
}
|
|
371
371
|
if (i.pointerType === "mouse" && i.button !== 0 || i.ctrlKey)
|
|
372
372
|
return;
|
|
373
|
-
|
|
373
|
+
wt();
|
|
374
374
|
const x = i.currentTarget;
|
|
375
375
|
x.setPointerCapture && x.setPointerCapture(i.pointerId), X.current = {
|
|
376
376
|
pointerId: i.pointerId,
|
|
@@ -378,11 +378,11 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
378
378
|
startClientX: i.clientX,
|
|
379
379
|
startClientY: i.clientY
|
|
380
380
|
}, _(!0), Y(!0), i.preventDefault(), i.stopPropagation();
|
|
381
|
-
},
|
|
381
|
+
}, yt = (i) => {
|
|
382
382
|
const x = X.current;
|
|
383
383
|
if (x.pointerId !== i.pointerId)
|
|
384
384
|
return;
|
|
385
|
-
const E = i.clientX - x.startClientX,
|
|
385
|
+
const E = i.clientX - x.startClientX, j = i.clientY - x.startClientY, bt = st(E, j), Pt = s(x.startThumbPosition + bt);
|
|
386
386
|
vt(Pt), i.cancelable && i.preventDefault();
|
|
387
387
|
}, zt = (i) => {
|
|
388
388
|
if (X.current.pointerId !== i.pointerId)
|
|
@@ -404,8 +404,8 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
404
404
|
if (i.pointerType === "mouse" && i.button !== 0 || i.ctrlKey)
|
|
405
405
|
return;
|
|
406
406
|
const x = i.currentTarget, E = x.getBoundingClientRect(), bt = nt(i) - (f ? E.left : E.top);
|
|
407
|
-
|
|
408
|
-
const Pt = bt -
|
|
407
|
+
wt();
|
|
408
|
+
const Pt = bt - J / 2, Nt = s(Pt);
|
|
409
409
|
vt(Nt), x.setPointerCapture && x.setPointerCapture(i.pointerId), O.current = {
|
|
410
410
|
pointerId: i.pointerId,
|
|
411
411
|
startThumbPosition: Pt,
|
|
@@ -416,7 +416,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
416
416
|
const x = O.current;
|
|
417
417
|
if (x.pointerId !== i.pointerId)
|
|
418
418
|
return;
|
|
419
|
-
const E = i.clientX - x.startClientX,
|
|
419
|
+
const E = i.clientX - x.startClientX, j = i.clientY - x.startClientY, bt = st(E, j), Pt = s(x.startThumbPosition + bt);
|
|
420
420
|
vt(Pt), i.cancelable && i.preventDefault();
|
|
421
421
|
}, Ht = (i) => {
|
|
422
422
|
if (O.current.pointerId !== i.pointerId)
|
|
@@ -441,12 +441,12 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
441
441
|
tabIndex: -1,
|
|
442
442
|
className: "aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
443
443
|
style: {
|
|
444
|
-
[
|
|
444
|
+
[Z]: p,
|
|
445
445
|
[ft]: l
|
|
446
446
|
},
|
|
447
447
|
"aria-label": x,
|
|
448
|
-
onMouseDown:
|
|
449
|
-
onTouchStart:
|
|
448
|
+
onMouseDown: w(i),
|
|
449
|
+
onTouchStart: w(i),
|
|
450
450
|
onMouseUp: F,
|
|
451
451
|
onMouseLeave: F,
|
|
452
452
|
onTouchEnd: F,
|
|
@@ -462,7 +462,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
462
462
|
maxScrollPosition: z,
|
|
463
463
|
contentSize: r,
|
|
464
464
|
viewportSize: t,
|
|
465
|
-
thumbSize:
|
|
465
|
+
thumbSize: J,
|
|
466
466
|
thumbPosition: It,
|
|
467
467
|
thumbCenter: At,
|
|
468
468
|
trackSize: m,
|
|
@@ -474,7 +474,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
474
474
|
{
|
|
475
475
|
className: jt("group relative cursor-default select-none", xt, c),
|
|
476
476
|
style: {
|
|
477
|
-
[
|
|
477
|
+
[Z]: t,
|
|
478
478
|
[ft]: l,
|
|
479
479
|
backgroundColor: "white",
|
|
480
480
|
userSelect: "none",
|
|
@@ -489,8 +489,8 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
489
489
|
"aria-valuemax": z,
|
|
490
490
|
"aria-orientation": f ? "horizontal" : "vertical",
|
|
491
491
|
children: [
|
|
492
|
-
!f && Tt &&
|
|
493
|
-
|
|
492
|
+
!f && Tt && G && /* @__PURE__ */ Q(
|
|
493
|
+
ye,
|
|
494
494
|
{
|
|
495
495
|
ref: q,
|
|
496
496
|
className: jt("pointer-events-auto absolute transition-opacity duration-150", $),
|
|
@@ -524,13 +524,13 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
524
524
|
{
|
|
525
525
|
className: "group absolute",
|
|
526
526
|
style: {
|
|
527
|
-
[
|
|
527
|
+
[Z]: J,
|
|
528
528
|
[et]: It,
|
|
529
529
|
...f ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
|
|
530
530
|
touchAction: "none"
|
|
531
531
|
},
|
|
532
532
|
onPointerDown: K,
|
|
533
|
-
onPointerMove:
|
|
533
|
+
onPointerMove: yt,
|
|
534
534
|
onPointerUp: zt,
|
|
535
535
|
onPointerCancel: Ft,
|
|
536
536
|
role: "slider",
|
|
@@ -567,7 +567,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
567
567
|
]
|
|
568
568
|
}
|
|
569
569
|
);
|
|
570
|
-
},
|
|
570
|
+
}, Mt = {
|
|
571
571
|
debug(r, ...t) {
|
|
572
572
|
typeof window < "u" && window.localStorage?.getItem("debug") === "true" && console.debug(`[VirtualScroll] ${r}`, ...t);
|
|
573
573
|
},
|
|
@@ -607,7 +607,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
607
607
|
wheelSpeedMultiplier: tt = 1,
|
|
608
608
|
contentInsets: Y
|
|
609
609
|
}, ut) => {
|
|
610
|
-
const V =
|
|
610
|
+
const V = M(0), D = M(null), X = M(null), O = M({
|
|
611
611
|
frame: null,
|
|
612
612
|
velocity: 0,
|
|
613
613
|
lastTimestamp: null
|
|
@@ -624,7 +624,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
624
624
|
top: Math.max(0, Y?.top ?? 0),
|
|
625
625
|
bottom: Math.max(0, Y?.bottom ?? 0)
|
|
626
626
|
}), [Y]);
|
|
627
|
-
|
|
627
|
+
Mt.debug("[ScrollPane] ScrollPane rendered", {
|
|
628
628
|
contentSize: t,
|
|
629
629
|
viewportSize: e,
|
|
630
630
|
scrollBarWidth: n,
|
|
@@ -635,28 +635,28 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
635
635
|
enablePointerDrag: f,
|
|
636
636
|
contentInsets: H
|
|
637
637
|
});
|
|
638
|
-
const q =
|
|
638
|
+
const q = M({ contentSize: t, viewportSize: e }), N = Vt(() => t > e, [t, e]), g = y(
|
|
639
639
|
(S) => {
|
|
640
|
-
const { contentSize: v, viewportSize: it } = q.current, W = v > it,
|
|
641
|
-
if (
|
|
642
|
-
return V.current !== 0 && (V.current = 0, l?.(0,
|
|
640
|
+
const { contentSize: v, viewportSize: it } = q.current, W = v > it, Z = V.current;
|
|
641
|
+
if (Mt.debug("[ScrollPane] scrollTo called", { newPosition: S, contentSize: v, viewportSize: it, currentIsScrollable: W, prevPosition: Z }), !W)
|
|
642
|
+
return V.current !== 0 && (V.current = 0, l?.(0, Z)), V.current;
|
|
643
643
|
const ft = typeof S == "function" ? S(V.current) : S, et = Math.max(v - it, 0), st = pt(ft, 0, et);
|
|
644
|
-
return V.current !== st && (V.current = st, l?.(st,
|
|
644
|
+
return V.current !== st && (V.current = st, l?.(st, Z)), V.current;
|
|
645
645
|
},
|
|
646
646
|
[l]
|
|
647
|
-
), C =
|
|
647
|
+
), C = y(() => {
|
|
648
648
|
const S = O.current;
|
|
649
649
|
S.frame !== null && cancelAnimationFrame(S.frame), S.frame = null, S.velocity = 0, S.lastTimestamp = null;
|
|
650
|
-
}, []), P =
|
|
650
|
+
}, []), P = M(C);
|
|
651
651
|
L(() => {
|
|
652
652
|
P.current = C;
|
|
653
653
|
}, [C]);
|
|
654
|
-
const
|
|
654
|
+
const G = y(
|
|
655
655
|
(S) => {
|
|
656
656
|
if (!N)
|
|
657
657
|
return;
|
|
658
|
-
const { maxVelocity: v, minVelocity: it, deceleration: W, startVelocityThreshold:
|
|
659
|
-
if (Math.abs(ft) <
|
|
658
|
+
const { maxVelocity: v, minVelocity: it, deceleration: W, startVelocityThreshold: Z } = R, ft = pt(S, -v, v);
|
|
659
|
+
if (Math.abs(ft) < Z)
|
|
660
660
|
return;
|
|
661
661
|
C(), O.current.velocity = ft, O.current.lastTimestamp = null;
|
|
662
662
|
const et = (st) => {
|
|
@@ -676,7 +676,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
676
676
|
mt > 0 ? xt = Math.max(0, mt - St) : mt < 0 && (xt = Math.min(0, mt + St));
|
|
677
677
|
const Dt = (mt + xt) / 2 * gt, p = V.current;
|
|
678
678
|
Dt !== 0 && g((It) => It + Dt);
|
|
679
|
-
const m = V.current, { contentSize: ht, viewportSize:
|
|
679
|
+
const m = V.current, { contentSize: ht, viewportSize: J } = q.current, z = Math.max(ht - J, 0);
|
|
680
680
|
nt.velocity = xt;
|
|
681
681
|
const Rt = m === p || m <= 0 && xt <= 0 || m >= z && xt >= 0;
|
|
682
682
|
if (Math.abs(xt) < it || Rt) {
|
|
@@ -688,14 +688,14 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
688
688
|
O.current.frame = requestAnimationFrame(et);
|
|
689
689
|
},
|
|
690
690
|
[N, R, g, C]
|
|
691
|
-
), rt =
|
|
691
|
+
), rt = M(G);
|
|
692
692
|
L(() => {
|
|
693
|
-
rt.current =
|
|
694
|
-
}, [
|
|
693
|
+
rt.current = G;
|
|
694
|
+
}, [G]), se(() => {
|
|
695
695
|
q.current = { contentSize: t, viewportSize: e };
|
|
696
696
|
}, [t, e]), se(() => {
|
|
697
697
|
if (N) {
|
|
698
|
-
|
|
698
|
+
Mt.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: V.current });
|
|
699
699
|
const S = pt(t - e, 0, t);
|
|
700
700
|
V.current > S && g(S);
|
|
701
701
|
} else
|
|
@@ -706,7 +706,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
706
706
|
return;
|
|
707
707
|
it.preventDefault(), C();
|
|
708
708
|
let W = it.deltaY;
|
|
709
|
-
it.deltaMode === 1 ? W *= 16 : it.deltaMode === 2 && (W *= e), tt !== 1 && (W *= tt),
|
|
709
|
+
it.deltaMode === 1 ? W *= 16 : it.deltaMode === 2 && (W *= e), tt !== 1 && (W *= tt), Mt.debug("[ScrollPane] wheel event", { deltaY: W, scrollPosition: V.current, wheelSpeedMultiplier: tt }), g((Z) => Z + W);
|
|
710
710
|
}, v = D.current;
|
|
711
711
|
return v && v.addEventListener("wheel", S, { passive: !1 }), () => {
|
|
712
712
|
v && v.removeEventListener("wheel", S);
|
|
@@ -721,11 +721,11 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
721
721
|
}),
|
|
722
722
|
[g, t, e]
|
|
723
723
|
);
|
|
724
|
-
const Ct =
|
|
724
|
+
const Ct = M(g);
|
|
725
725
|
L(() => {
|
|
726
726
|
Ct.current = g;
|
|
727
727
|
}, [g]);
|
|
728
|
-
const ot = Le(), $ =
|
|
728
|
+
const ot = Le(), $ = M({
|
|
729
729
|
pointerId: null,
|
|
730
730
|
startClientY: 0,
|
|
731
731
|
startScroll: 0,
|
|
@@ -733,15 +733,15 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
733
733
|
shouldCancelNextClick: !1,
|
|
734
734
|
clickResetTimer: null,
|
|
735
735
|
velocitySamples: []
|
|
736
|
-
}), ct =
|
|
736
|
+
}), ct = M(f);
|
|
737
737
|
L(() => {
|
|
738
738
|
ct.current = f;
|
|
739
739
|
}, [f]);
|
|
740
|
-
const dt =
|
|
740
|
+
const dt = M(N);
|
|
741
741
|
L(() => {
|
|
742
742
|
dt.current = N;
|
|
743
743
|
}, [N]);
|
|
744
|
-
const A =
|
|
744
|
+
const A = M(R);
|
|
745
745
|
return L(() => {
|
|
746
746
|
A.current = R;
|
|
747
747
|
}, [R]), L(() => {
|
|
@@ -756,14 +756,14 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
756
756
|
const v = 6, it = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), W = () => {
|
|
757
757
|
const p = $.current;
|
|
758
758
|
p.pointerId = null, p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.velocitySamples = [];
|
|
759
|
-
},
|
|
759
|
+
}, Z = () => {
|
|
760
760
|
const p = $.current;
|
|
761
761
|
p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
|
|
762
762
|
}, ft = (p) => {
|
|
763
763
|
const m = $.current, ht = it();
|
|
764
764
|
m.velocitySamples.push({ clientY: p, time: ht });
|
|
765
|
-
const
|
|
766
|
-
m.velocitySamples = m.velocitySamples.filter((z) => ht - z.time <=
|
|
765
|
+
const J = A.current.velocitySampleWindow;
|
|
766
|
+
m.velocitySamples = m.velocitySamples.filter((z) => ht - z.time <= J);
|
|
767
767
|
}, et = (p) => p instanceof HTMLElement && p.closest("[data-scrollpane-ignore-drag='true']") !== null, st = (p) => {
|
|
768
768
|
const m = $.current;
|
|
769
769
|
m.shouldCancelNextClick && (p.preventDefault(), p.stopPropagation(), m.shouldCancelNextClick = !1);
|
|
@@ -775,8 +775,8 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
775
775
|
if (m.pointerId !== p.pointerId || !(ct.current && dt.current) || !m.isDragging && (Math.abs(p.clientY - m.startClientY) < v || (nt(p), !m.isDragging)))
|
|
776
776
|
return;
|
|
777
777
|
ft(p.clientY);
|
|
778
|
-
const ht = p.clientY - m.startClientY,
|
|
779
|
-
Ct.current(
|
|
778
|
+
const ht = p.clientY - m.startClientY, J = m.startScroll - ht;
|
|
779
|
+
Ct.current(J), p.cancelable && p.preventDefault();
|
|
780
780
|
}, mt = (p) => {
|
|
781
781
|
const m = $.current;
|
|
782
782
|
if (m.pointerId !== p.pointerId)
|
|
@@ -790,21 +790,21 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
790
790
|
ht = -(Tt / _t);
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
|
|
793
|
+
Z(), m.shouldCancelNextClick && (m.clickResetTimer = window.setTimeout(() => {
|
|
794
794
|
const z = $.current;
|
|
795
795
|
z.shouldCancelNextClick = !1, z.clickResetTimer = null;
|
|
796
796
|
}, 0));
|
|
797
|
-
const
|
|
798
|
-
W(), Math.abs(ht) >=
|
|
797
|
+
const J = A.current.startVelocityThreshold;
|
|
798
|
+
W(), Math.abs(ht) >= J && rt.current?.(ht);
|
|
799
799
|
}, xt = (p) => {
|
|
800
800
|
if (!(ct.current && dt.current) || p.button !== 0 && p.pointerType === "mouse" || p.ctrlKey || p.metaKey || p.altKey || et(p.target))
|
|
801
801
|
return;
|
|
802
802
|
window.dispatchEvent(new CustomEvent(pe, { detail: { paneId: ot } })), P.current?.();
|
|
803
803
|
const m = $.current;
|
|
804
|
-
|
|
804
|
+
Z(), m.pointerId = p.pointerId, m.startClientY = p.clientY, m.startScroll = V.current, m.isDragging = !1, m.shouldCancelNextClick = !1, m.velocitySamples = [];
|
|
805
805
|
}, St = (p) => {
|
|
806
806
|
const m = $.current;
|
|
807
|
-
m.pointerId === p.pointerId && (m.shouldCancelNextClick = !1, S.hasPointerCapture(p.pointerId) && S.releasePointerCapture(p.pointerId),
|
|
807
|
+
m.pointerId === p.pointerId && (m.shouldCancelNextClick = !1, S.hasPointerCapture(p.pointerId) && S.releasePointerCapture(p.pointerId), Z(), W());
|
|
808
808
|
}, Et = [
|
|
809
809
|
["click", st, !0],
|
|
810
810
|
["pointerdown", xt, { passive: !1 }],
|
|
@@ -819,7 +819,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
819
819
|
return oe(S, Et, "add"), oe(window, Dt, "add"), () => {
|
|
820
820
|
oe(S, Et, "remove"), oe(window, Dt, "remove");
|
|
821
821
|
const p = $.current;
|
|
822
|
-
p.pointerId !== null && S.hasPointerCapture(p.pointerId) && S.releasePointerCapture(p.pointerId),
|
|
822
|
+
p.pointerId !== null && S.hasPointerCapture(p.pointerId) && S.releasePointerCapture(p.pointerId), Z(), W();
|
|
823
823
|
};
|
|
824
824
|
}, [ot]), /* @__PURE__ */ Gt("div", { ref: D, className: jt("flex", c), style: d, children: [
|
|
825
825
|
/* @__PURE__ */ Gt(
|
|
@@ -861,7 +861,7 @@ const pt = (r, t, e) => Math.min(e, Math.max(t, r)), pe = "virtualscroll:tap-scr
|
|
|
861
861
|
}
|
|
862
862
|
), be = (r, t, e) => Math.min(Math.max(r, t), e), In = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
|
|
863
863
|
const o = Math.max(n / 2, 1), a = 1 + t * 0.65, u = Math.max(0.65, 1 - t * 0.25), f = r.direction * t * 26 * e, l = 0.8 + t * 0.18, c = 3 * e, d = 6 * e, h = 22 * e, b = Math.abs(f) + d, T = f > 0 ? c : -Math.abs(f) - c, k = Math.max(2.5, 3 * e), _ = be(r.offsetX, -o, o), tt = be(r.offsetY, -o, o), Y = o * 0.35, ut = _ / o * Y, V = tt / o * Y, D = ut * 0.45, X = V * 0.45, O = Math.max(h * 0.38, 6), R = 0.65 + t * 0.2, H = r.active;
|
|
864
|
-
return /* @__PURE__ */ Gt(
|
|
864
|
+
return /* @__PURE__ */ Gt(we, { children: [
|
|
865
865
|
/* @__PURE__ */ Q(
|
|
866
866
|
"div",
|
|
867
867
|
{
|
|
@@ -1411,7 +1411,7 @@ class rn {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
const on = (r, t, e) => {
|
|
1414
|
-
const n = Math.max(0, r), o =
|
|
1414
|
+
const n = Math.max(0, r), o = M(null), a = Vt(() => new rn(n, t, e), [n, t, e]);
|
|
1415
1415
|
return Object.is(o.current, a) || console.warn("[useFenwickMapTree] instance changed"), o.current = a, a;
|
|
1416
1416
|
};
|
|
1417
1417
|
class sn {
|
|
@@ -1465,7 +1465,7 @@ class Pe {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
1467
|
function an(r) {
|
|
1468
|
-
const t =
|
|
1468
|
+
const t = M(/* @__PURE__ */ new Map()), e = M(new Pe());
|
|
1469
1469
|
L(() => {
|
|
1470
1470
|
for (; t.current.size > r; ) {
|
|
1471
1471
|
const d = e.current.removeHead();
|
|
@@ -1475,11 +1475,11 @@ function an(r) {
|
|
|
1475
1475
|
break;
|
|
1476
1476
|
}
|
|
1477
1477
|
}, [r]);
|
|
1478
|
-
const n =
|
|
1478
|
+
const n = y((d) => {
|
|
1479
1479
|
const h = t.current.get(d);
|
|
1480
1480
|
if (h)
|
|
1481
1481
|
return e.current.moveToTail(h), h.value;
|
|
1482
|
-
}, []), o =
|
|
1482
|
+
}, []), o = y(
|
|
1483
1483
|
(d, h) => {
|
|
1484
1484
|
if (r <= 0)
|
|
1485
1485
|
return;
|
|
@@ -1495,10 +1495,10 @@ function an(r) {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
},
|
|
1497
1497
|
[r]
|
|
1498
|
-
), a =
|
|
1498
|
+
), a = y((d) => t.current.has(d), []), u = y((d) => {
|
|
1499
1499
|
const h = t.current.get(d);
|
|
1500
1500
|
h && (e.current.remove(h), t.current.delete(d));
|
|
1501
|
-
}, []), f =
|
|
1501
|
+
}, []), f = y(() => {
|
|
1502
1502
|
t.current.clear(), e.current = new Pe();
|
|
1503
1503
|
}, []), [l, c] = Yt(() => ({ get: n, set: o, has: a, remove: u, clear: f }));
|
|
1504
1504
|
return L(() => c({ get: n, set: o, has: a, remove: u, clear: f }), [n, o, a, u, f]), l;
|
|
@@ -1570,16 +1570,16 @@ const ln = 1e4, Tn = () => {
|
|
|
1570
1570
|
const tt = lt(T - e, n), Y = lt(Math.max(_ - 1, T), n), ut = lt(Y + e, n);
|
|
1571
1571
|
return { renderingStartIndex: tt, renderingEndIndex: ut, visibleStartIndex: T, visibleEndIndex: Y };
|
|
1572
1572
|
}, fn = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), ve = (r, t, e) => {
|
|
1573
|
-
const n = Math.max(0, t ?? 0), o =
|
|
1573
|
+
const n = Math.max(0, t ?? 0), o = M({
|
|
1574
1574
|
lastInvokeAt: 0,
|
|
1575
1575
|
rafId: null,
|
|
1576
1576
|
pendingPayload: null,
|
|
1577
1577
|
loopActive: !1,
|
|
1578
1578
|
normalizedThrottle: n
|
|
1579
|
-
}), a =
|
|
1579
|
+
}), a = y(() => {
|
|
1580
1580
|
const l = o.current;
|
|
1581
1581
|
l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1;
|
|
1582
|
-
}, []), u =
|
|
1582
|
+
}, []), u = y(
|
|
1583
1583
|
(l) => {
|
|
1584
1584
|
const c = o.current;
|
|
1585
1585
|
c.rafId = null;
|
|
@@ -1595,7 +1595,7 @@ const ln = 1e4, Tn = () => {
|
|
|
1595
1595
|
c.loopActive = !1;
|
|
1596
1596
|
},
|
|
1597
1597
|
[r, e]
|
|
1598
|
-
), f =
|
|
1598
|
+
), f = y(() => {
|
|
1599
1599
|
const l = o.current;
|
|
1600
1600
|
if (!l.loopActive) {
|
|
1601
1601
|
if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
@@ -1611,7 +1611,7 @@ const ln = 1e4, Tn = () => {
|
|
|
1611
1611
|
a();
|
|
1612
1612
|
const l = o.current;
|
|
1613
1613
|
l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle = n;
|
|
1614
|
-
}, [n, a]),
|
|
1614
|
+
}, [n, a]), y(
|
|
1615
1615
|
(l) => {
|
|
1616
1616
|
const c = o.current;
|
|
1617
1617
|
c.pendingPayload = l, f();
|
|
@@ -1644,18 +1644,18 @@ const ln = 1e4, Tn = () => {
|
|
|
1644
1644
|
contentInsets: O,
|
|
1645
1645
|
enableKeyboardNavigation: R = !0
|
|
1646
1646
|
}, H) => {
|
|
1647
|
-
const q =
|
|
1647
|
+
const q = M(null), N = M(!1), g = Vt(() => cn(O), [O]), C = M({ size: r, valueOrFn: e, options: { sampleRange: { from: 0, to: 100 } } }), P = on(C.current.size, C.current.valueOrFn, C.current.options), [G] = Yt(() => {
|
|
1648
1648
|
let s = g.top, I = 0;
|
|
1649
1649
|
if (typeof d == "number") {
|
|
1650
|
-
const
|
|
1650
|
+
const w = pt(d, 0, r - 1), F = pt(w - o * 2, 0, r - 1), B = pt(w + o * 2, 0, r - 1), K = d > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: F, to: B }] } } : void 0, { cumulative: yt, total: zt, currentValue: Ft } = P.prefixSum(d, K), Xt = Math.max(yt - Ft, 0);
|
|
1651
1651
|
s = Qt(Xt, g.top), I = zt ?? P.getTotal();
|
|
1652
1652
|
} else typeof h == "number" && (s = Qt(Math.max(h, 0), g.top)), I = P.getTotal();
|
|
1653
1653
|
return { position: s, total: I };
|
|
1654
|
-
}), [rt, Ct] = Yt(
|
|
1654
|
+
}), [rt, Ct] = Yt(G.position), [ot, $] = Yt(G.total), [ct, dt] = Yt(G.position), [A, S] = Yt(r), v = M(G.position), it = M(g.top), W = M(u ?? void 0), Z = M(f ?? void 0), ft = M(/* @__PURE__ */ new Map()), et = M(null), st = M(null);
|
|
1655
1655
|
L(() => {
|
|
1656
|
-
W.current = u ?? void 0,
|
|
1656
|
+
W.current = u ?? void 0, Z.current = f ?? void 0;
|
|
1657
1657
|
}, [f, u]);
|
|
1658
|
-
const nt =
|
|
1658
|
+
const nt = y(
|
|
1659
1659
|
(s) => {
|
|
1660
1660
|
if (R && s && typeof s.focus == "function")
|
|
1661
1661
|
try {
|
|
@@ -1665,22 +1665,22 @@ const ln = 1e4, Tn = () => {
|
|
|
1665
1665
|
}
|
|
1666
1666
|
},
|
|
1667
1667
|
[R]
|
|
1668
|
-
), gt = ve(W, V, (s, { position: I, totalHeight:
|
|
1669
|
-
s(I,
|
|
1670
|
-
}), mt = ve(
|
|
1671
|
-
s(I,
|
|
1668
|
+
), gt = ve(W, V, (s, { position: I, totalHeight: w }) => {
|
|
1669
|
+
s(I, w);
|
|
1670
|
+
}), mt = ve(Z, V, (s, { renderingStartIndex: I, renderingEndIndex: w, visibleStartIndex: F, visibleEndIndex: B, scrollPosition: K, totalHeight: yt }) => {
|
|
1671
|
+
s(I, w, F, B, K, yt);
|
|
1672
1672
|
});
|
|
1673
1673
|
L(() => (N.current = !0, () => {
|
|
1674
1674
|
N.current = !1;
|
|
1675
1675
|
}), []), L(() => {
|
|
1676
1676
|
R || (ft.current.clear(), et.current = null, st.current = null);
|
|
1677
1677
|
}, [R]);
|
|
1678
|
-
const xt = 0.01, St =
|
|
1678
|
+
const xt = 0.01, St = M({
|
|
1679
1679
|
rafId: null,
|
|
1680
1680
|
loopActive: !1,
|
|
1681
1681
|
idleFrames: 0,
|
|
1682
|
-
lastRenderedPosition:
|
|
1683
|
-
}), Et =
|
|
1682
|
+
lastRenderedPosition: G.position
|
|
1683
|
+
}), Et = y(() => {
|
|
1684
1684
|
const s = St.current;
|
|
1685
1685
|
s.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(s.rafId), s.rafId = null, s.loopActive = !1, s.idleFrames = 0;
|
|
1686
1686
|
}, []);
|
|
@@ -1690,11 +1690,11 @@ const ln = 1e4, Tn = () => {
|
|
|
1690
1690
|
},
|
|
1691
1691
|
[Et]
|
|
1692
1692
|
);
|
|
1693
|
-
const Dt =
|
|
1693
|
+
const Dt = y(() => {
|
|
1694
1694
|
const s = St.current;
|
|
1695
1695
|
s.rafId = null;
|
|
1696
|
-
const I = v.current,
|
|
1697
|
-
if (Ct((K) => Math.abs(K - I) < xt ? K : I), gt({ position:
|
|
1696
|
+
const I = v.current, w = qt(I, g.top), F = P.getTotal();
|
|
1697
|
+
if (Ct((K) => Math.abs(K - I) < xt ? K : I), gt({ position: w, totalHeight: F }), Math.abs(s.lastRenderedPosition - I) >= xt ? (s.lastRenderedPosition = I, s.idleFrames = 0) : s.idleFrames += 1, s.idleFrames >= 2) {
|
|
1698
1698
|
Et();
|
|
1699
1699
|
return;
|
|
1700
1700
|
}
|
|
@@ -1703,7 +1703,7 @@ const ln = 1e4, Tn = () => {
|
|
|
1703
1703
|
return;
|
|
1704
1704
|
}
|
|
1705
1705
|
s.loopActive = !1;
|
|
1706
|
-
}, [P, g.top, gt, Et]), p =
|
|
1706
|
+
}, [P, g.top, gt, Et]), p = y(() => {
|
|
1707
1707
|
const s = St.current;
|
|
1708
1708
|
if (s.idleFrames = 0, !s.loopActive) {
|
|
1709
1709
|
if (s.loopActive = !0, typeof requestAnimationFrame == "function") {
|
|
@@ -1712,17 +1712,17 @@ const ln = 1e4, Tn = () => {
|
|
|
1712
1712
|
}
|
|
1713
1713
|
s.loopActive = !1;
|
|
1714
1714
|
}
|
|
1715
|
-
}, [Dt]), m =
|
|
1715
|
+
}, [Dt]), m = y(
|
|
1716
1716
|
(s, I) => {
|
|
1717
|
-
const
|
|
1718
|
-
if (v.current = s,
|
|
1717
|
+
const w = I?.immediate ?? !1, F = qt(s, g.top);
|
|
1718
|
+
if (v.current = s, w) {
|
|
1719
1719
|
St.current.lastRenderedPosition = s, St.current.idleFrames = 0, Ct(s), gt({ position: F, totalHeight: P.getTotal() });
|
|
1720
1720
|
return;
|
|
1721
1721
|
}
|
|
1722
1722
|
p();
|
|
1723
1723
|
},
|
|
1724
1724
|
[p, P, g.top, gt]
|
|
1725
|
-
), ht =
|
|
1725
|
+
), ht = M(!1);
|
|
1726
1726
|
L(() => {
|
|
1727
1727
|
if (!ht.current)
|
|
1728
1728
|
if (ht.current = !0, typeof h == "number") {
|
|
@@ -1735,86 +1735,86 @@ const ln = 1e4, Tn = () => {
|
|
|
1735
1735
|
const s = P.getTotal();
|
|
1736
1736
|
ot !== s && $(s);
|
|
1737
1737
|
}, [P, A, r, ot, e]), se(() => {
|
|
1738
|
-
ct !== null && q.current && (
|
|
1738
|
+
ct !== null && q.current && (Mt.debug("[VirtualScroll] Scrolling to position:", ct), q.current.scrollTo(ct), dt(null));
|
|
1739
1739
|
}, [ct]), L(() => {
|
|
1740
1740
|
const s = it.current;
|
|
1741
1741
|
if (s === g.top)
|
|
1742
1742
|
return;
|
|
1743
|
-
const I = qt(v.current, s),
|
|
1744
|
-
it.current = g.top, v.current =
|
|
1743
|
+
const I = qt(v.current, s), w = Qt(I, g.top);
|
|
1744
|
+
it.current = g.top, v.current = w, dt(w), m(w, { immediate: !0 });
|
|
1745
1745
|
}, [g.top, m]);
|
|
1746
|
-
const
|
|
1746
|
+
const J = y(
|
|
1747
1747
|
(s) => {
|
|
1748
1748
|
if (!q.current)
|
|
1749
1749
|
return;
|
|
1750
|
-
const I = lt(s, A),
|
|
1751
|
-
if (
|
|
1750
|
+
const I = lt(s, A), w = lt(I - o * 2, A), F = lt(I + o * 2, A), { cumulative: B, total: K, currentValue: yt } = P.prefixSum(I, { materializeOption: { materialize: !0, ranges: [{ from: w, to: F }] } });
|
|
1751
|
+
if (Mt.debug("[VirtualScroll] Scrolling to index:", I, "Offset:", B, "Total height:", K, "Current value:", yt, "safeIndexFrom:", w, "safeIndexTo:", F), !K)
|
|
1752
1752
|
return;
|
|
1753
|
-
const zt = Math.max(B -
|
|
1754
|
-
$(K), dt(Ft),
|
|
1753
|
+
const zt = Math.max(B - yt, 0), Ft = Qt(zt, g.top);
|
|
1754
|
+
$(K), dt(Ft), Mt.debug("[VirtualScroll] Setting scroll position to:", Ft);
|
|
1755
1755
|
},
|
|
1756
1756
|
[P, o, A, g.top]
|
|
1757
|
-
), z =
|
|
1757
|
+
), z = y(
|
|
1758
1758
|
(s) => {
|
|
1759
1759
|
if (!q.current)
|
|
1760
1760
|
return;
|
|
1761
|
-
const I = P.getTotal(),
|
|
1762
|
-
|
|
1761
|
+
const I = P.getTotal(), w = pt(Math.floor(s), 0, I), F = P.findIndexAtOrAfter(w, { materializeOption: { materialize: !1 } }).index;
|
|
1762
|
+
J(F);
|
|
1763
1763
|
},
|
|
1764
|
-
[P,
|
|
1765
|
-
), Rt =
|
|
1764
|
+
[P, J]
|
|
1765
|
+
), Rt = y(
|
|
1766
1766
|
(s) => {
|
|
1767
|
-
const I = qt(v.current, g.top),
|
|
1768
|
-
z(
|
|
1767
|
+
const I = qt(v.current, g.top), w = typeof s == "function" ? s(I) : s;
|
|
1768
|
+
z(w);
|
|
1769
1769
|
const F = q.current?.getScrollPosition(), B = typeof F == "number" ? F : v.current;
|
|
1770
1770
|
return m(B), B;
|
|
1771
1771
|
},
|
|
1772
1772
|
[g.top, z, m]
|
|
1773
|
-
), It =
|
|
1773
|
+
), It = y(
|
|
1774
1774
|
(s, I) => {
|
|
1775
|
-
|
|
1775
|
+
Mt.debug("[VirtualScroll] Scroll position changed:", s), m(s);
|
|
1776
1776
|
},
|
|
1777
1777
|
[m]
|
|
1778
1778
|
), At = Vt(() => qt(rt, g.top), [g.top, rt]), Tt = Vt(() => {
|
|
1779
1779
|
const s = dn(At, n, o, A, e, P);
|
|
1780
|
-
return
|
|
1780
|
+
return Mt.debug("[VirtualScroll] Calculated rendering range:", {
|
|
1781
1781
|
...s,
|
|
1782
1782
|
scrollPosition: At,
|
|
1783
1783
|
renderingContentSize: P.getTotal(),
|
|
1784
1784
|
overscanCount: o,
|
|
1785
1785
|
viewportSize: n
|
|
1786
1786
|
}), s;
|
|
1787
|
-
}, [At, n, o, A, e, P]), { renderingStartIndex: _t, renderingEndIndex: Ut, visibleStartIndex: vt, visibleEndIndex: Ot } = Tt, at =
|
|
1787
|
+
}, [At, n, o, A, e, P]), { renderingStartIndex: _t, renderingEndIndex: Ut, visibleStartIndex: vt, visibleEndIndex: Ot } = Tt, at = y(
|
|
1788
1788
|
(s, I) => {
|
|
1789
1789
|
if (!R || A === 0)
|
|
1790
1790
|
return;
|
|
1791
|
-
const
|
|
1791
|
+
const w = lt(s, A);
|
|
1792
1792
|
if (!(I?.ensureVisible ?? !0)) {
|
|
1793
|
-
const Wt = ft.current.get(
|
|
1794
|
-
Wt && (et.current = null, st.current =
|
|
1793
|
+
const Wt = ft.current.get(w);
|
|
1794
|
+
Wt && (et.current = null, st.current = w, nt(Wt));
|
|
1795
1795
|
return;
|
|
1796
1796
|
}
|
|
1797
|
-
const B = P.prefixSum(
|
|
1798
|
-
if (
|
|
1799
|
-
et.current =
|
|
1797
|
+
const B = P.prefixSum(w, { materializeOption: { materialize: !1 } }), K = B.currentValue, yt = Math.max(B.cumulative - K, 0), zt = yt + K, Ft = qt(v.current, g.top), Xt = Ft + n;
|
|
1798
|
+
if (yt < Ft || zt > Xt) {
|
|
1799
|
+
et.current = w, J(w);
|
|
1800
1800
|
return;
|
|
1801
1801
|
}
|
|
1802
|
-
const Ht = ft.current.get(
|
|
1802
|
+
const Ht = ft.current.get(w);
|
|
1803
1803
|
if (Ht) {
|
|
1804
|
-
et.current = null, st.current =
|
|
1804
|
+
et.current = null, st.current = w, nt(Ht);
|
|
1805
1805
|
return;
|
|
1806
1806
|
}
|
|
1807
|
-
et.current =
|
|
1807
|
+
et.current = w;
|
|
1808
1808
|
},
|
|
1809
|
-
[R, A, P, g.top,
|
|
1810
|
-
),
|
|
1809
|
+
[R, A, P, g.top, J, nt, n]
|
|
1810
|
+
), wt = y(
|
|
1811
1811
|
(s, I) => {
|
|
1812
1812
|
if (!R || s.defaultPrevented || s.altKey || s.metaKey || s.ctrlKey)
|
|
1813
1813
|
return;
|
|
1814
|
-
const
|
|
1815
|
-
if (
|
|
1816
|
-
const F =
|
|
1817
|
-
if (F === "INPUT" || F === "TEXTAREA" || F === "SELECT" ||
|
|
1814
|
+
const w = s.target;
|
|
1815
|
+
if (w) {
|
|
1816
|
+
const F = w.tagName;
|
|
1817
|
+
if (F === "INPUT" || F === "TEXTAREA" || F === "SELECT" || w.isContentEditable)
|
|
1818
1818
|
return;
|
|
1819
1819
|
}
|
|
1820
1820
|
if (s.key === "ArrowDown") {
|
|
@@ -1840,7 +1840,7 @@ const ln = 1e4, Tn = () => {
|
|
|
1840
1840
|
}
|
|
1841
1841
|
},
|
|
1842
1842
|
[R, A, at, Ot, vt]
|
|
1843
|
-
), Bt =
|
|
1843
|
+
), Bt = y(
|
|
1844
1844
|
(s) => {
|
|
1845
1845
|
if (!R)
|
|
1846
1846
|
return;
|
|
@@ -1850,15 +1850,15 @@ const ln = 1e4, Tn = () => {
|
|
|
1850
1850
|
[R, A]
|
|
1851
1851
|
);
|
|
1852
1852
|
L(() => {
|
|
1853
|
-
const s = q.current?.getScrollPosition() ?? 0, I = v.current,
|
|
1854
|
-
|
|
1853
|
+
const s = q.current?.getScrollPosition() ?? 0, I = v.current, w = qt(I, g.top);
|
|
1854
|
+
Mt.debug("[VirtualScroll] Range change effect triggered", {
|
|
1855
1855
|
renderingStartIndex: _t,
|
|
1856
1856
|
renderingEndIndex: Ut,
|
|
1857
1857
|
visibleStartIndex: vt,
|
|
1858
1858
|
visibleEndIndex: Ot,
|
|
1859
1859
|
scrollPositionState: rt,
|
|
1860
1860
|
paneScrollPosition: I,
|
|
1861
|
-
logicalScrollPosition:
|
|
1861
|
+
logicalScrollPosition: w,
|
|
1862
1862
|
contentSize: ot,
|
|
1863
1863
|
scrollPaneScrollPosition: s
|
|
1864
1864
|
}), mt({
|
|
@@ -1866,14 +1866,14 @@ const ln = 1e4, Tn = () => {
|
|
|
1866
1866
|
renderingEndIndex: Ut,
|
|
1867
1867
|
visibleStartIndex: vt,
|
|
1868
1868
|
visibleEndIndex: Ot,
|
|
1869
|
-
scrollPosition:
|
|
1869
|
+
scrollPosition: w,
|
|
1870
1870
|
totalHeight: ot
|
|
1871
1871
|
});
|
|
1872
1872
|
}, [ot, Ut, _t, g.top, mt, rt, Ot, vt]);
|
|
1873
|
-
const te =
|
|
1873
|
+
const te = y(
|
|
1874
1874
|
(s) => {
|
|
1875
|
-
const I = (V ?? 0) > 0,
|
|
1876
|
-
if (
|
|
1875
|
+
const I = (V ?? 0) > 0, w = Math.abs(s - rt), F = I && w > 0.5 ? rt : s, B = qt(F, g.top);
|
|
1876
|
+
if (Mt.debug("[VirtualScroll] Rendering visible items", {
|
|
1877
1877
|
currentScrollPosition: s,
|
|
1878
1878
|
effectiveScrollPosition: B,
|
|
1879
1879
|
renderingStartIndex: _t,
|
|
@@ -1881,20 +1881,20 @@ const ln = 1e4, Tn = () => {
|
|
|
1881
1881
|
fenwickSize: A,
|
|
1882
1882
|
viewportSize: n,
|
|
1883
1883
|
callbackThrottleMs: V,
|
|
1884
|
-
diff:
|
|
1884
|
+
diff: w,
|
|
1885
1885
|
rawEffectiveScrollPosition: F
|
|
1886
1886
|
}), A === 0)
|
|
1887
1887
|
return /* @__PURE__ */ Q("div", { className: "absolute w-full", style: { top: 0 }, children: /* @__PURE__ */ Q("div", { className: "text-center text-gray-500", children: "No items" }) });
|
|
1888
|
-
const K = lt(_t, A),
|
|
1889
|
-
for (let U = K; U <=
|
|
1888
|
+
const K = lt(_t, A), yt = lt(Ut, A), { cumulative: zt, currentValue: Ft } = P.prefixSum(K, { materializeOption: { materialize: !1 } }), Xt = zt - Ft, $t = [], Ht = [];
|
|
1889
|
+
for (let U = K; U <= yt; U++) {
|
|
1890
1890
|
const Kt = e(U);
|
|
1891
1891
|
P.get(U) !== Kt && $t.push({ index: U, value: Kt });
|
|
1892
|
-
const { cumulative: ee, currentValue: i } = P.prefixSum(U, { materializeOption: { materialize: !1 } }), x = ee - i, E = (
|
|
1893
|
-
if (!
|
|
1892
|
+
const { cumulative: ee, currentValue: i } = P.prefixSum(U, { materializeOption: { materialize: !1 } }), x = ee - i, E = (j) => {
|
|
1893
|
+
if (!j) {
|
|
1894
1894
|
ft.current.delete(U);
|
|
1895
1895
|
return;
|
|
1896
1896
|
}
|
|
1897
|
-
R && (ft.current.set(U,
|
|
1897
|
+
R && (ft.current.set(U, j), et.current === U && (et.current = null, st.current = U, nt(j)));
|
|
1898
1898
|
};
|
|
1899
1899
|
Ht.push(
|
|
1900
1900
|
/* @__PURE__ */ Q(
|
|
@@ -1909,7 +1909,10 @@ const ln = 1e4, Tn = () => {
|
|
|
1909
1909
|
width: "100%"
|
|
1910
1910
|
},
|
|
1911
1911
|
tabIndex: R ? -1 : void 0,
|
|
1912
|
-
|
|
1912
|
+
onPointerDown: R ? (j) => {
|
|
1913
|
+
j.currentTarget.focus({ preventScroll: !0 });
|
|
1914
|
+
} : void 0,
|
|
1915
|
+
onKeyDownCapture: R ? (j) => wt(j, U) : void 0,
|
|
1913
1916
|
onFocusCapture: R ? () => Bt(U) : void 0,
|
|
1914
1917
|
children: l(t(U), U)
|
|
1915
1918
|
},
|
|
@@ -1923,7 +1926,7 @@ const ln = 1e4, Tn = () => {
|
|
|
1923
1926
|
const U = P.updates($t);
|
|
1924
1927
|
if (!N.current || typeof U != "number")
|
|
1925
1928
|
return;
|
|
1926
|
-
$(U),
|
|
1929
|
+
$(U), Mt.debug("[VirtualScroll] Updated heights for items", $t, "New total height:", U);
|
|
1927
1930
|
const Kt = q.current?.getScrollPosition() ?? v.current;
|
|
1928
1931
|
Kt === v.current || !N.current || m(Kt);
|
|
1929
1932
|
});
|
|
@@ -1945,7 +1948,7 @@ const ln = 1e4, Tn = () => {
|
|
|
1945
1948
|
)
|
|
1946
1949
|
);
|
|
1947
1950
|
}
|
|
1948
|
-
return
|
|
1951
|
+
return Mt.debug("[VirtualScroll] Rendering items", {
|
|
1949
1952
|
nodeCount: Ht.length,
|
|
1950
1953
|
containerTop: Wt,
|
|
1951
1954
|
logicalScrollPosition: At,
|
|
@@ -1962,7 +1965,7 @@ const ln = 1e4, Tn = () => {
|
|
|
1962
1965
|
t,
|
|
1963
1966
|
e,
|
|
1964
1967
|
Bt,
|
|
1965
|
-
|
|
1968
|
+
wt,
|
|
1966
1969
|
At,
|
|
1967
1970
|
Ut,
|
|
1968
1971
|
_t,
|
|
@@ -1980,12 +1983,12 @@ const ln = 1e4, Tn = () => {
|
|
|
1980
1983
|
getContentSize: () => q.current?.getContentSize() ?? -1,
|
|
1981
1984
|
getViewportSize: () => q.current?.getViewportSize() ?? -1,
|
|
1982
1985
|
scrollTo: Rt,
|
|
1983
|
-
scrollToIndex:
|
|
1986
|
+
scrollToIndex: J,
|
|
1984
1987
|
getFenwickTreeTotalHeight: () => P.getTotal(),
|
|
1985
1988
|
getFenwickSize: () => P.getSize(),
|
|
1986
1989
|
focusItemAtIndex: at
|
|
1987
1990
|
}),
|
|
1988
|
-
[Rt,
|
|
1991
|
+
[Rt, J, P, at]
|
|
1989
1992
|
);
|
|
1990
1993
|
const ae = ot + g.top + g.bottom;
|
|
1991
1994
|
return /* @__PURE__ */ Q(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualScroll.d.ts","sourceRoot":"","sources":["../../src/VirtualScroll.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAA2F,MAAM,OAAO,CAAA;AAE3I,OAAO,EAA4C,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,yBAAyB,EAAE,MAAM,MAAM,CAAA;IACvC,cAAc,EAAE,MAAM,MAAM,CAAA;IAC5B,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;CACnF,CAAA;AAED,KAAK,kBAAkB,CAAC,CAAC,IAAI;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAA;IAC7B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAChE,aAAa,CAAC,EAAE,CAAC,mBAAmB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACjL,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAA;IAC/C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,sBAAsB,CAAC,EAAE,eAAe,CAAC,wBAAwB,CAAC,CAAA;IAClE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAA;IACpD,gBAAgB,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAA;IACtD,kBAAkB,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IAC1D,iBAAiB,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAA;IACxD,cAAc,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAClD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IAC1D,oBAAoB,CAAC,EAAE,eAAe,CAAC,sBAAsB,CAAC,CAAA;IAC9D,aAAa,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAA;IAChD,wBAAwB,CAAC,EAAE,OAAO,CAAA;CACrC,CAAA;AA+ID;;;;GAIG;AACH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,MAAM,EAAE,cAAc,MAAM,EAAE,eAAe,MAAM,EAAE,UAAU,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,aAAa,UAAU,CAAC,OAAO,iBAAiB,CAAC;;;;;CAiDxN,CAAA;
|
|
1
|
+
{"version":3,"file":"VirtualScroll.d.ts","sourceRoot":"","sources":["../../src/VirtualScroll.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAA2F,MAAM,OAAO,CAAA;AAE3I,OAAO,EAA4C,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,yBAAyB,EAAE,MAAM,MAAM,CAAA;IACvC,cAAc,EAAE,MAAM,MAAM,CAAA;IAC5B,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;CACnF,CAAA;AAED,KAAK,kBAAkB,CAAC,CAAC,IAAI;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAA;IAC7B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAChE,aAAa,CAAC,EAAE,CAAC,mBAAmB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACjL,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAA;IAC/C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,sBAAsB,CAAC,EAAE,eAAe,CAAC,wBAAwB,CAAC,CAAA;IAClE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAA;IACpD,gBAAgB,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAA;IACtD,kBAAkB,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IAC1D,iBAAiB,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAA;IACxD,cAAc,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAClD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IAC1D,oBAAoB,CAAC,EAAE,eAAe,CAAC,sBAAsB,CAAC,CAAA;IAC9D,aAAa,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAA;IAChD,wBAAwB,CAAC,EAAE,OAAO,CAAA;CACrC,CAAA;AA+ID;;;;GAIG;AACH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,MAAM,EAAE,cAAc,MAAM,EAAE,eAAe,MAAM,EAAE,UAAU,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,aAAa,UAAU,CAAC,OAAO,iBAAiB,CAAC;;;;;CAiDxN,CAAA;AA40BD,eAAO,MAAM,aAAa,EAAqC,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;CAAE,KAAK,KAAK,CAAC,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiquants/virtualscroll",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "High-performance virtual scrolling component for React with variable item heights",
|
|
5
|
+
"sideEffects": [
|
|
6
|
+
"**/*.css"
|
|
7
|
+
],
|
|
5
8
|
"type": "module",
|
|
6
9
|
"main": "./dist/index.cjs",
|
|
7
10
|
"module": "./dist/index.js",
|