@radix-ui/react-scroll-area
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -50,3 +50,3 @@ import * as React from "react"; | ||
unstable_prefersReducedMotion?: boolean; | ||
dir?: 'rtl' | 'ltr'; | ||
dir?: TextDirection; | ||
}; | ||
@@ -72,6 +72,8 @@ export const ScrollArea: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", ScrollAreaOwnProps>; | ||
export const Corner: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", ScrollAreaCornerProps>; | ||
export const unstable_ScrollAreaNoNativeFallback: import("@radix-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", Pick<ScrollAreaOwnProps, "children" | "dir" | "overflowX" | "overflowY" | "scrollbarVisibility" | "scrollbarVisibilityRestTimeout" | "trackClickBehavior" | "unstable_prefersReducedMotion">>; | ||
type OverflowBehavior = 'auto' | 'hidden' | 'scroll' | 'visible'; | ||
type ScrollbarVisibility = 'always' | 'scroll' | 'hover'; | ||
type TrackClickBehavior = 'page' | 'relative'; | ||
type TextDirection = 'ltr' | 'rtl'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
var e,t,r=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),n=require("@radix-ui/utils"),o=n.canUseDOM,i=n.clamp,a=n.getPartDataAttrObj,l=n.getResizeObserverEntryBorderBoxSize,c=n.isMainClick,s=n.namespaced,u=require("@radix-ui/react-polymorphic").forwardRefWithAs,f=require("@radix-ui/react-utils"),d=f.composeEventHandlers,p=f.createContext,v=f.getOwnerGlobals,h=f.useCallbackRef,b=f.useComposedRefs,m=f.useConstant,y=f.useLayoutEffect,S=f.usePrefersReducedMotion;var g,w,x="function"==typeof Float32Array;function R(e,t){return 1-3*t+3*e}function E(e,t){return 3*t-6*e}function A(e){return 3*e}function T(e,t,r){return((R(t,r)*e+E(t,r))*e+A(t))*e}function I(e,t,r){return 3*R(t,r)*e*e+2*E(t,r)*e+A(t)}function k(e){return e}function P(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return k;for(var o=x?new Float32Array(11):new Array(11),i=0;i<11;++i)o[i]=T(.1*i,e,r);function a(t){for(var n=0,i=1;10!==i&&o[i]<=t;++i)n+=.1;--i;var a=n+.1*((t-o[i])/(o[i+1]-o[i])),l=I(a,e,r);return l>=.001?function(e,t,r,n){for(var o=0;o<4;++o){var i=I(t,r,n);if(0===i)return t;t-=(T(t,r,n)-e)/i}return t}(t,a,e,r):0===l?a:function(e,t,r,n,o){var i,a,l=0;do{(i=T(a=t+(r-t)/2,n,o)-e)>0?r=a:t=a}while(Math.abs(i)>1e-7&&++l<10);return a}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:T(a(e),t,n)}}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}(w=g||(g={}))[w.Idle=0]="Idle",w[w.Stopped=1]="Stopped",w[w.Queuing=2]="Queuing",w[w.Pending=3]="Pending",w[w.Resolved=4]="Resolved",w[w.Error=5]="Error";var C=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),z(this,"queue",[]),z(this,"_state",g.Idle)}var t,r,n;return t=e,(r=[{key:"restart",value:function(){this.state===g.Stopped&&(this._state=g.Idle)}},{key:"rejectItem",value:function(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Error:g.Queuing,e(t),this.dequeue())}},{key:"resolveItem",value:function(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Resolved:g.Queuing,e(t),this.dequeue())}},{key:"enqueue",value:function(e){var t=this;return this.restart(),new Promise((function(r,n){t.queue.push({promise:e,resolve:r,reject:n}),t.dequeue()}))}},{key:"dequeue",value:function(){var e=this;if(this.stateIs(g.Error,g.Resolved,g.Idle,g.Queuing)){if(this.isEmpty())return;var t=this.queue.shift();try{this._state=g.Pending,t.promise().then((function(r){e.resolveItem(t.resolve,r)})).catch((function(r){e.rejectItem(t.reject,r)}))}catch(e){this.rejectItem(t.reject,e)}}}},{key:"stateIs",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.includes(this.state)}},{key:"isEmpty",value:function(){return this.queue.length<=0}},{key:"stop",value:function(){this.stateIs(g.Pending,g.Queuing)&&(this._state=g.Stopped,this.queue=[])}},{key:"isBusy",get:function(){return this.state===g.Queuing||this.state===g.Pending}},{key:"state",get:function(){return this._state}}])&&O(t.prototype,r),n&&O(t,n),e}();function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Y=!1,L=0;function B(e){"touch"===e.pointerType&&(Y=!0,setTimeout((function(){Y=!1}),50))}function H(){if("undefined"!=typeof document)return document.addEventListener("pointerup",B),L++,function(){--L>0||document.removeEventListener("pointerup",B)}}function j(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onHoverStart,n=e.onHoverChange,o=e.onHoverEnd,i=e.isDisabled,a=r.useState(!1),l=V(a,2),c=l[0],s=l[1],u=r.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;r.useEffect(H,[]);var f=r.useMemo((function(){return{onPointerEnter:function(e){Y&&"mouse"===e.pointerType||function(e,r){if(!i&&"touch"!==r&&!u.isHovered){u.isHovered=!0;var o=e.target;t&&t({type:"hoverstart",target:o,pointerType:r}),n&&n(!0),s(!0)}}(e,e.pointerType)},onPointerLeave:function(e){!function(e,t){if(!i&&"touch"!==t&&u.isHovered){u.isHovered=!1;var r=e.target;o&&o({type:"hoverend",target:r,pointerType:t}),n&&n(!1),s(!1)}}(e,e.pointerType)}}}),[i,u,t,n,o]);return{hoverProps:f,isHovered:c}}function M(e){return function(e){if(Array.isArray(e))return U(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||F(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?W(Object(r),!0).forEach((function(t){q(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _(){return(_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function Q(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return r}(e,t)||F(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){if(e){if("string"==typeof e)return U(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var $,G,J,K,Z=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return D(D({},e),{},q({},t,(r=t,"--".concat(s("ScrollArea".concat((n=r,n.charAt(0).toUpperCase()+n.slice(1))))))));var r,n}),{});exports.SCROLL_AREA_CSS_PROPS=Z,(G=$||($={})).Idle="Idle",G.Thumbing="Thumbing",G.Tracking="Tracking",G.ButtonScrolling="ButtonScrolling",(K=J||(J={}))[K.DeriveStateFromProps=0]="DeriveStateFromProps",K[K.HandleScrollAreaResize=1]="HandleScrollAreaResize",K[K.HandleViewportResize=2]="HandleViewportResize",K[K.HandleScrollbarResize=3]="HandleScrollbarResize",K[K.HandleTrackResize=4]="HandleTrackResize",K[K.SetContentOverflowing=5]="SetContentOverflowing",K[K.SetExplicitResize=6]="SetExplicitResize",K[K.StartTracking=7]="StartTracking",K[K.StopTracking=8]="StopTracking",K[K.StartThumbing=9]="StartThumbing",K[K.StopThumbing=10]="StopThumbing",K[K.StartButtonPress=11]="StartButtonPress",K[K.StopButtonPress=12]="StopButtonPress",K[K.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";var ee=N(p("ScrollAreaRefsContext","ScrollArea"),2),te=ee[0],re=ee[1],ne=N(p("ScrollAreaContext","ScrollArea"),2),oe=ne[0],ie=ne[1],ae=r.createContext({});function le(){return r.useContext(ae)}ae.displayName="ScrollAreaStateContext";var ce=r.createContext(!0),se=function(){return r.useContext(ce)},ue=N(p("DispatchContext","ScrollArea"),2),fe=ue[0],de=ue[1],pe=u((function(e,t){var n=e.as,i=void 0===n?"div":n,l=e.children,c=e.overflowX,s=void 0===c?"auto":c,u=e.overflowY,f=void 0===u?"auto":u,d=e.scrollbarVisibility,p=void 0===d?"hover":d,v=e.scrollbarVisibilityRestTimeout,h=void 0===v?600:v,b=e.dir,m=void 0===b?"ltr":b,S=e.trackClickBehavior,g=void 0===S?"relative":S,w=e.unstable_forceNative,x=void 0!==w&&w,R=e.unstable_prefersReducedMotion,E=void 0!==R&&R,A=Q(e,["as","children","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","dir","trackClickBehavior","unstable_forceNative","unstable_prefersReducedMotion"]),T=N(r.useState(!0),2),I=T[0],k=T[1];y((function(){k(x||!("ResizeObserver"in window&&function(){var e,t;if(!o())return!1;var r=!1;try{document.querySelector("::-webkit-scrollbar"),r=!0}catch(e){}return!(!(null===(e=window.CSS)||void 0===e||null===(t=e.supports)||void 0===t?void 0:t.call(e,"scrollbar-width: none"))&&!r)}()))}),[x]);var P=I?ve:me,O=r.useRef(null),z=r.useRef(null);return function(e,t,n){r.useImperativeHandle(e,(function(){var e=t.current,r=n.current||e,o={scrollIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scroll).call.apply(e,[r].concat(n))},scrollByIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollBy).call.apply(e,[r].concat(n))},scrollIntoViewIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollIntoView).call.apply(e,[r].concat(n))},scrollToIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollTo).call.apply(e,[r].concat(n))},get scrollTopIntent(){return r.scrollTop},set scrollTopIntent(e){r.scrollTop=e},get scrollLeftIntent(){return r.scrollLeft},set scrollLeftIntent(e){r.scrollLeft=e},get scrollHeightIntent(){return r.scrollHeight},get scrollWidthIntent(){return r.scrollWidth},addScrollListener:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.addEventListener.apply(r,["scroll"].concat(t))},removeScrollListener:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.removeEventListener.apply(r,["scroll"].concat(t))}};return Object.assign(e,o)}))}(t,z,O),r.createElement(P,_({},a("ScrollArea"),A,{as:i,overflowX:s,overflowY:f,scrollbarVisibility:p,scrollbarVisibilityRestTimeout:h,dir:m,positionRef:O,scrollAreaRef:z,trackClickBehavior:g,unstable_prefersReducedMotion:E,ref:t}),r.createElement(ce.Provider,{value:I},l))}));exports.ScrollArea=pe;var ve=u((function(e,t){var n=e.as,o=void 0===n?"div":n,i=e.overflowX,a=e.overflowY,l=(e.scrollbarVisibility,e.scrollbarVisibilityRestTimeout,e.trackClickBehavior,e.unstable_prefersReducedMotion,e.scrollAreaRef),c=(e.positionRef,Q(e,["as","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"])),s=b(l,t);return r.createElement(o,_({ref:s},c,{style:D(D({},c.style),{},{overflowX:i,overflowY:a,resize:"none"})}))})),he={width:0,height:0},be={state:$.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:he,viewport:he,position:he,scrollbarY:he,scrollbarX:he,trackY:he,trackX:he}},me=u((function(e,t){var n,o=e.as,i=void 0===o?"div":o,a=e.children,l=e.onScroll,c=e.overflowX,s=e.overflowY,u=e.scrollbarVisibility,f=e.scrollbarVisibilityRestTimeout,p=e.trackClickBehavior,m=e.unstable_prefersReducedMotion,y=e.positionRef,g=e.scrollAreaRef,w=Q(e,["as","children","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),x=h(l),R=r.useRef(null),E=r.useRef(null),A=r.useRef(null),T=r.useRef(null),I=r.useRef(null),k=r.useRef(null),P=r.useRef(null),O=r.useRef(null),z=r.useRef(null),C=r.useRef(null),V=r.useRef(null),X=r.useMemo((function(){return{buttonDownRef:R,buttonLeftRef:E,buttonRightRef:A,buttonUpRef:T,viewportRef:I,positionRef:y,scrollAreaRef:g,scrollbarXRef:k,scrollbarYRef:P,thumbXRef:O,thumbYRef:z,trackXRef:C,trackYRef:V}}),[]),Y=S(g),L=null!=m?m:Y,B=N(r.useReducer(De,D(D({},be),{},{scrollbarIsVisibleX:"always"===u,scrollbarIsVisibleY:"always"===u})),2),H=B[0],M=B[1],W=j(),F=W.hoverProps,U=F.onPointerEnter,$=F.onPointerLeave,G=W.isHovered,K=r.useMemo((function(){return{dir:e.dir||"ltr",isHovered:G,onScroll:x,overflowX:c,overflowY:s,prefersReducedMotion:L,scrollbarVisibility:u,scrollbarVisibilityRestTimeout:f,trackClickBehavior:p}}),[e.dir,x,G,c,s,L,u,f,p]),ee=b(t,g);qe(g,(function(e,t){var r=v(g).ownerWindow.getComputedStyle(t);M({type:J.HandleScrollAreaResize,scrollAreaComputedStyle:r,width:e.inlineSize,height:e.blockSize})}));var re="always"===u&&("scroll"===c||"auto"===c&&H.contentIsOverflowingX),ne="always"===u&&("scroll"===s||"auto"===s&&H.contentIsOverflowingY),ie=H.domSizes,le=(q(n={},Z.scrollbarXOffset,re&&ie.scrollbarX.height?ie.scrollbarX.height+"px":0),q(n,Z.scrollbarYOffset,ne&&ie.scrollbarY.width?ie.scrollbarY.width+"px":0),q(n,Z.positionWidth,ie.position.width?ie.position.width+"px":"auto"),q(n,Z.positionHeight,ie.position.height?ie.position.height+"px":"auto"),n);return r.createElement(fe.Provider,{value:M},r.createElement(te.Provider,{value:X},r.createElement(oe.Provider,{value:K},r.createElement(ae.Provider,{value:H},r.createElement(i,_({},w,{ref:ee,style:D(D({},w.style),le),onPointerEnter:d(e.onPointerEnter,U),onPointerLeave:d(e.onPointerLeave,$)}),a)))))})),ye=u((function(e,t){var n=e.as,o=void 0===n?"div":n,i=Q(e,["as"]),l=re("ScrollAreaViewport"),c=l.positionRef,s=l.thumbXRef,u=l.thumbYRef,f=l.trackXRef,p=l.trackYRef,v=l.viewportRef,h=ie("ScrollAreaViewport"),m=h.onScroll,S=h.overflowX,g=h.overflowY,w=h.scrollbarVisibility,x=le(),R=de("ScrollAreaViewport"),E=b(t,v);qe(v,(function(e){R({type:J.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));var A=r.useCallback((function(){var e=c.current,t=s.current,r=u.current,n=f.current,o=p.current;t&&n&&e&>({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&o&&e&>({thumbElement:r,trackElement:o,axis:"y",positionElement:e})}),[c,s,u,f,p]),T=r.useRef(0),I=r.useRef(0);var k=d(m,(function(){c.current&&(A(),function(){if(c.current){var e=c.current.scrollTop,t=c.current.scrollLeft,r=e!==T.current,n=t!==I.current;r===x.scrollbarIsVisibleY&&n===x.scrollbarIsVisibleX||R({type:J.SetScrollbarIsVisible,scrollbarVisibility:w,x:n,y:r}),T.current=e<=0?0:e,I.current=t<=0?0:t}}())}));return y((function(){A()}),[A]),y((function(){var e=c.current;if(e){var t=yt(e,{axis:"x"}),r=yt(e,{axis:"y"});t===x.contentIsOverflowingX&&r===x.contentIsOverflowingY||R({type:J.SetContentOverflowing,x:t,y:r})}}),[x.contentIsOverflowingX,x.contentIsOverflowingY,R,c,x.domSizes.position.height,x.domSizes.position.width,x.domSizes.viewport.height,x.domSizes.viewport.width]),r.createElement("div",_({},a("ScrollAreaPosition"),{ref:c,onScroll:k,style:{zIndex:1,width:"var(".concat(Z.positionWidth,")"),height:"var(".concat(Z.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:S,overflowY:g}}),r.createElement("div",_({},a("ScrollAreaPositionInner"),{style:{display:"table",width:"100%",paddingBottom:"var(".concat(Z.scrollbarXOffset,")"),paddingRight:"var(".concat(Z.scrollbarYOffset,")")}}),r.createElement(o,_({},a("ScrollAreaViewport"),{ref:E},i))))})),Se=u((function(e,t){var n=e.as,o=void 0===n?"div":n,i=Q(e,["as"]);return se()?r.createElement(o,_({},a("ScrollAreaViewport"),{ref:t},i)):r.createElement(ye,_({ref:t,as:o},i))}));exports.ScrollAreaViewport=Se,Se.displayName="ScrollAreaViewport";var ge=N(p("ScrollbarContext","ScrollAreaScrollbarImpl"),2),we=ge[0],xe=ge[1],Re=u((function(e,t){var n,o=e.as,i=void 0===o?"div":o,a=e.axis,l=e.name,c=e.onWheel,s=e.onPointerDown,u=e.onPointerUp,f=e.onPointerMove,p=Q(e,["as","axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),v=de(l),h=ie(l),y=h.scrollbarVisibility,S=h.scrollbarVisibilityRestTimeout,g=h.isHovered,w=le(),x=w["x"===a?"contentIsOverflowingX":"contentIsOverflowingY"],R=w["x"===a?"scrollbarIsVisibleX":"scrollbarIsVisibleY"],E=re(l),A=E.positionRef,T=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(a,E),I=b(T,t),k=m((function(){return new C}));qe(T,(function(e){v({type:J.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:a})}));var P=d(c,(function(e){var t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);A.current&&(t>0&&t>r&&(A.current.scrollLeft+=e.deltaX),r>0&&r>t&&(A.current.scrollTop+=e.deltaY))})),O=r.useRef();function z(){clearTimeout(O.current),O.current=setTimeout((function(){v(q({type:J.SetScrollbarIsVisible,scrollbarVisibility:y},a,!1))}),S)}r.useEffect((function(){if(R)return O.current=setTimeout((function(){v(q({type:J.SetScrollbarIsVisible,scrollbarVisibility:y},a,!1))}),S),function(){clearTimeout(O.current)}}),[a,v,R,y,S]);var V=r.useRef(!1),X=d(s,(function(e){V.current=!0,clearTimeout(O.current)})),Y=d(u,(function(e){V.current=!1,z()})),L=d(f,(function(e){V.current||z()})),B=function(){var e,t,r=(null===(e=p.style)||void 0===e?void 0:e.opacity)||1;switch(y){case"always":return null===(t=p.style)||void 0===t?void 0:t.opacity;case"scroll":return R?r:0;case"hover":return g||R?r:0}}(),H=function(){var e,t,r=(null===(e=p.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(y){case"always":return null===(t=p.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return R?r:"none";case"hover":return g||R?r:"none"}}(),j=r.useMemo((function(){return{axis:a,scrollAnimationQueue:k}}),[a,k]);return r.createElement(we.Provider,{value:j},r.createElement(i,_({ref:I},p,{style:D(D({},p.style),{},{display:x?null===(n=p.style)||void 0===n?void 0:n.display:"none",opacity:B,pointerEvents:H}),onPointerDown:X,onPointerUp:Y,onPointerMove:L,onWheel:P})))})),Ee=u((function(e,t){var n=le().domSizes;return se()?null:r.createElement(Re,_({},a("ScrollAreaScrollbarX"),{ref:t},e,{axis:"x",name:"ScrollAreaScrollbarX",style:D(D({},e.style),{},q({},Z.scrollbarXSize,n.scrollbarX.height?n.scrollbarX.height+"px":0))}))}));exports.ScrollAreaScrollbarX=Ee,Ee.displayName="ScrollAreaScrollbarX";var Ae=u((function(e,t){var n=le().domSizes;return se()?null:r.createElement(Re,_({},a("ScrollAreaScrollbarY"),{ref:t},e,{axis:"y",name:"ScrollAreaScrollbarY",style:D(D({},e.style),{},q({},Z.scrollbarYSize,n.scrollbarY.width?n.scrollbarY.width+"px":0))}))}));exports.ScrollAreaScrollbarY=Ae,Ae.displayName="ScrollAreaScrollbarY";var Te=u((function(e,t){var n=e.as,o=void 0===n?"div":n,l=e.onPointerDown,s=Q(e,["as","onPointerDown"]),u=xe("ScrollAreaTrack"),f=u.axis,p=u.scrollAnimationQueue,m=de("ScrollAreaTrack"),y=re("ScrollAreaTrack"),S=ie("ScrollAreaTrack"),g=S.trackClickBehavior,w=S.prefersReducedMotion,x=y.positionRef,R=Ue(f,y),E=Fe(f,y),A=b(R,t),T=h(l);qe(R,(function(e){m({type:J.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:f})}));var I=r.useRef();return r.useEffect((function(){var e=null,t=null,r=Ge(R),n=Je(E),o=Ke(x),a=v(x).ownerDocument,l=d(T,(function(l){if(c(l)&&l.target!==n&&!n.contains(l.target)){var d=function(e){var t=e.event,r=e.axis,n=e.thumbElement;return lt(t)[r]<n.getBoundingClientRect()["y"===r?"top":"left"]?"start":"end"}({event:l,axis:f,thumbElement:n});if(clearTimeout(t),"page"===g){if(m({type:J.StartTracking}),a.addEventListener("pointermove",s),a.addEventListener("pointerup",u),r.setPointerCapture(l.pointerId),w){var v=et({direction:d,positionElement:o,axis:f}),h=ht(o,{direction:d,distance:v,axis:f});nt(o,{axis:f,value:h})}else p.enqueue((function(){return _e({duration:200,timing:P(.16,0,.73,1),draw:Qe({positionElement:o,direction:d,axis:f}),rafIdRef:I})}));return e=setTimeout((function(){var t=lt(l),n=Ze({axis:f,direction:d,pointerPosition:t,positionElement:o,trackElement:r});if(!("start"===d&&n>0||"end"===d&&n<0)){if(w){var a=ht(o,{direction:d,distance:n,axis:f});nt(o,{axis:f,value:a})}else{var c=Math.round(Math.abs(n)),s=i(c,[100,500]);p.enqueue((function(){return _e({duration:s,timing:function(e){return e},draw:Ne({axis:f,direction:d,pointerPosition:t,positionElement:o,trackElement:r}),rafIdRef:I})}))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}var b=lt(l),y=Ze({axis:f,direction:d,pointerPosition:b,positionElement:o,trackElement:r}),S=ht(o,{direction:d,distance:y,axis:f});nt(o,{axis:f,value:S});var x=new PointerEvent("pointerdown",l);requestAnimationFrame((function(){n.dispatchEvent(x)}))}}));return r.addEventListener("pointerdown",l),function(){cancelAnimationFrame(I.current),clearTimeout(e),clearTimeout(t),r.removeEventListener("pointerdown",l),a.removeEventListener("pointermove",s),a.removeEventListener("pointerup",u),m({type:J.StopTracking}),p.stop()};function s(t){"mouse"===t.pointerType&&mt(t,r)&&(clearTimeout(e),a.removeEventListener("pointermove",s),p.stop())}function u(n){r.releasePointerCapture(n.pointerId),clearTimeout(e),a.removeEventListener("pointermove",s),a.removeEventListener("pointerup",u),p.stop(),m({type:J.StopTracking}),t=setTimeout((function(){p.stop()}),200)}}),[f,w,g,m,T,x,p,E,R]),r.createElement(o,_({},a("ScrollAreaTrack"),{ref:A},s,{"data-axis":f}))}));exports.ScrollAreaTrack=Te,Te.displayName="ScrollAreaTrack";var Ie=u((function(e,t){var n,o,i=e.as,l=void 0===i?"div":i,s=e.onPointerDown,u=Q(e,["as","onPointerDown"]),f=xe("ScrollAreaThumb").axis,p=re("ScrollAreaThumb"),m=de("ScrollAreaThumb"),S=p.positionRef,g=Fe(f,p),w=Ue(f,p),x=b(g,t),R=le(),E=h(s),A=r.useRef(0),T=r.useRef(0),I=r.useRef({size:0,positionStart:0}),k=r.useRef({size:0,positionStart:0}),P=r.useRef(!1);y((function(){P.current?gt({thumbElement:Je(g),trackElement:Ge(w),positionElement:Ke(S),axis:f}):P.current=!0}),[g,w,S,f].concat(M(bt(R.domSizes))));var O="x"===f?R.domSizes.trackX.width:R.domSizes.trackY.height,z=r.useRef(O);y((function(){z.current=O})),r.useEffect((function(){var e=Je(g),t=Ge(w),r=Ke(S),n=v(S).ownerDocument,o=d(E,(function(r){if(c(r)){var o=lt(r)[f];I.current=at(e,{axis:f}),k.current=at(t,{axis:f}),T.current=o,A.current=o,e.setPointerCapture(r.pointerId),n.addEventListener("pointerup",l),n.addEventListener("pointermove",a),m({type:J.StartThumbing})}}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),i()};function i(){n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",l),m({type:J.StopThumbing})}function a(e){var t=lt(e)[f],n=t-T.current,o=z.current;if(St(r,{axis:f,delta:n})){var i=k.current.positionStart,a=I.current.positionStart,l=A.current-a,c=Math.round(t-i),s=Math.round((c-l)/o*100)/100,u=it(r,{axis:f});nt(r,{axis:f,value:s*u}),T.current=t,m({type:J.StartThumbing})}}function l(t){e.releasePointerCapture(t.pointerId),i()}}),[f,E,m,S,p,g,w]);var C=N(r.useState({}),2),V=C[0],X=C[1];return y((function(){var e=S.current,t=w.current;X(function(e){var t=e.trackElement,r=e.positionElement,n=e.axis;if(!t||!r)return{};var o=tt(r,{axis:n}),i=ot(t,{axis:n}),a=o*i;if(!yt(r,{axis:n}))return{display:"none",width:0,height:0};return q({},"x"===n?"width":"height",a)}({positionElement:e,trackElement:t,axis:f}))}),[f,S,w].concat(M(bt(R.domSizes)))),r.createElement(l,_({},a("ScrollAreaThumb"),{ref:x},u,{"data-axis":f,style:D(D(D({},u.style),V),"x"===f?(n={},q(n,Z.scrollbarThumbWillChange,"left"),q(n,Z.scrollbarThumbHeight,"100%"),q(n,Z.scrollbarThumbWidth,"auto"),n):(o={},q(o,Z.scrollbarThumbWillChange,"top"),q(o,Z.scrollbarThumbHeight,"auto"),q(o,Z.scrollbarThumbWidth,"100%"),o))}))}));exports.ScrollAreaThumb=Ie,Ie.displayName="ScrollAreaThumb";var ke=u((function(e,t){var n=e.as,o=void 0===n?"div":n,i=e.direction,a=e.name,l=e.onPointerDown,s=Q(e,["as","direction","name","onPointerDown"]),u=xe(a),f=u.axis,p=u.scrollAnimationQueue,m=de(a),y=re(a),S=ie(a).prefersReducedMotion,g=y.positionRef,w=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(i,f,y),x=b(w,t),R=r.useRef(),E=h(l);return r.useEffect((function(){var e,t=function(e,t){var r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return $e(e,"A ref for ".concat(r," was not placed as expected. ").concat(r," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}(w,i),r=Ke(g),n=v(g).ownerDocument,o=null,a=d(E,(function(a){if(c(a)){t.setPointerCapture(a.pointerId),n.addEventListener("pointerup",s),n.addEventListener("pointermove",l),m({type:J.StartButtonPress});var u="start"===i?-1:1;S?ct(r,{axis:f,value:51*u}):St(r,{axis:f,delta:u})&&p.enqueue((function(){return _e({duration:135,timing:P(.16,0,.73,1),draw:function(e){ct(r,{axis:f,value:15*e*u})},rafIdRef:R})})),e=setTimeout((function(){if(S)o=setInterval((function(){St(r,{axis:f,delta:u})?ct(r,{axis:f,value:60*u}):clearInterval(o)}),135);else{var n=a.pointerId;!function e(){St(r,{axis:f,delta:u})&&p.enqueue((function(){return _e({duration:135,timing:function(e){return e},draw:function(e){ct(r,{axis:f,value:e*(15*u)})},done:t.hasPointerCapture(n)?e:void 0,rafIdRef:R})}))}()}clearTimeout(e)}),400)}}));return t.addEventListener("pointerdown",a),function(){t.removeEventListener("pointerdown",a),n.removeEventListener("pointerup",s),n.removeEventListener("pointermove",l),clearTimeout(e),clearInterval(o),cancelAnimationFrame(R.current),m({type:J.StopButtonPress})};function l(r){"mouse"===r.pointerType&&mt(r,t)&&(clearTimeout(e),n.removeEventListener("pointermove",l))}function s(r){clearTimeout(e),clearInterval(o),t.releasePointerCapture(r.pointerId),t.removeEventListener("pointerup",s),m({type:J.StopButtonPress})}}),[f,i,S,w,m,E,p,g]),r.createElement(o,_({},s,{ref:x,"data-axis":f}))})),Pe=u((function(e,t){return r.createElement(ke,_({},e,{name:"ScrollAreaButtonStart",direction:"start"},a("ScrollAreaButtonStart"),{ref:t}))}));exports.ScrollAreaButtonStart=Pe,Pe.displayName="ScrollAreaButtonStart";var Oe=u((function(e,t){return r.createElement(ke,_({},e,{name:"ScrollAreaButtonEnd",direction:"end"},a("ScrollAreaButtonEnd"),{ref:t}))}));exports.ScrollAreaButtonEnd=Oe,Oe.displayName="ScrollAreaButtonEnd";var ze=u((function(e,t){var n,o=e.as,i=void 0===o?"div":o,l=Q(e,["as"]),c=re("ScrollAreaCorner").positionRef,s=de("ScrollAreaCorner"),u=ie("ScrollAreaCorner").dir,f=le().domSizes,d="rtl"===u,p=(q(n={},Z.cornerLeft,d?0:"unset"),q(n,Z.cornerRight,d?"unset":0),q(n,Z.cornerHeight,f.scrollbarX.height?f.scrollbarX.height+"px":f.scrollbarY.width?f.scrollbarY.width+"px":"16px"),q(n,Z.cornerWidth,f.scrollbarY.width?f.scrollbarY.width+"px":f.scrollbarX.height?f.scrollbarX.height+"px":"16px"),q(n,"position","absolute"),n);return y((function(){if(c.current){var e=v(c).ownerWindow.getComputedStyle(c.current);s({type:J.SetExplicitResize,value:e.resize})}}),[s,c]),r.createElement(i,_({},a("ScrollAreaCorner"),{ref:t},l,{style:D(D({},l.style),p)}))})),Ce=u((function(e,t){return se()?null:r.createElement(ze,_({ref:t},e))}));exports.ScrollAreaCorner=Ce,Ce.displayName="ScrollAreaCorner";var Ve=pe;exports.Root=Ve;var Xe=Se;exports.Viewport=Xe;var Ye=Ee;exports.ScrollbarX=Ye;var Le=Ae;exports.ScrollbarY=Le;var Be=Pe;exports.ButtonStart=Be;var He=Oe;exports.ButtonEnd=He;var je=Te;exports.Track=je;var Me=Ie;exports.Thumb=Me;var We=Ce;function De(e,t){switch(t.type){case J.SetExplicitResize:return D(D({},e),{},{explicitResize:t.value});case J.HandleScrollAreaResize:var r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),a=parseInt(r.borderLeftWidth),l=parseInt(r.paddingTop),c=parseInt(r.paddingRight),s=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return D(D({},e),{},{domSizes:D(D({},e.domSizes),{},{scrollArea:{width:t.width,height:t.height},position:{width:t.width-a-o-u-c,height:t.height-n-i-l-s}})});case J.SetContentOverflowing:return D(D({},e),{},{contentIsOverflowingX:t.x,contentIsOverflowingY:t.y});case J.SetScrollbarIsVisible:var f,d;return"always"===t.scrollbarVisibility?D(D({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):D(D({},e),{},{scrollbarIsVisibleX:null!==(f=t.x)&&void 0!==f?f:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(d=t.y)&&void 0!==d?d:e.scrollbarIsVisibleY});case J.HandleViewportResize:return D(D({},e),{},{domSizes:D(D({},e.domSizes),{},{viewport:{width:t.width,height:t.height}})});case J.HandleScrollbarResize:return D(D({},e),{},{domSizes:D(D({},e.domSizes),{},q({},"x"===t.axis?"scrollbarX":"scrollbarY",{height:t.height,width:t.width}))});case J.HandleTrackResize:return D(D({},e),{},{domSizes:D(D({},e.domSizes),{},q({},"x"===t.axis?"trackX":"trackY",{height:t.height,width:t.width}))});case J.StartTracking:return D(D({},e),{},{state:$.Tracking});case J.StopTracking:return D(D({},e),{},{state:$.Idle});case J.StartThumbing:return D(D({},e),{},{state:$.Thumbing});case J.StopThumbing:return D(D({},e),{},{state:$.Idle});case J.StartButtonPress:return D(D({},e),{},{state:$.ButtonScrolling});case J.StopButtonPress:return D(D({},e),{},{state:$.Idle})}return e}function qe(e,t){var r=h(t);y((function(){var t,n=e.current;if(n){var o=new ResizeObserver((function(e){var t=N(e,1)[0],n=l(t);r(n,t.target)})),i=n.getBoundingClientRect();return r({inlineSize:i.width,blockSize:i.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}}),[r,e])}function _e(e){var t=e.duration,r=e.draw,n=e.timing,o=e.done,a=e.rafIdRef;return new Promise((function(e){var l=performance.now(),c=!1;a.current=requestAnimationFrame((function s(u){var f=i((u-(l=u<l?u:l))/t,[0,1]);r(n(f)),f<1?!c&&(a.current=requestAnimationFrame(s)):(c=!0,cancelAnimationFrame(a.current),e("done"),o&&o())}))}))}function Qe(e){var t=e.axis,r=e.direction,n=e.positionElement,o=et({axis:t,direction:r,positionElement:n});return function(e){var i=o*Math.min(e,1),a=ht(n,{direction:r,distance:i,axis:t});o-=i,nt(n,{axis:t,value:a})}}function Ne(e){var t=e.axis,r=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,a=Ze({axis:t,direction:r,pointerPosition:n,positionElement:o,trackElement:i});return function(e){var n=Math.pow(10,3),i=Math.round(a*Math.min(e,1)*n)/n,l=ht(o,{direction:r,distance:i,axis:t});a-=i,nt(o,{axis:t,value:l})}}function Fe(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function Ue(e,t){return"x"===e?t.trackXRef:t.trackYRef}function $e(e,t){var r=e.current;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function Ge(e){return $e(e,"A ref for ".concat("ScrollAreaTrack"," was not placed as expected. ").concat("ScrollAreaTrack"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function Je(e){return $e(e,"A ref for ".concat("ScrollAreaThumb"," was not placed as expected. ").concat("ScrollAreaThumb"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function Ke(e){return $e(e,"A ref for an internal component in ".concat("ScrollAreaViewport"," was not placed as expected. ").concat("ScrollAreaViewport"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function Ze(e){var t=e.axis,r=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,a=rt(o,{axis:t}),l=it(o,{axis:t}),c=ot(o,{axis:t}),s=at(i,{axis:t}),u=s.positionStart,f=s.size,d=Math.round(n[t]-u),p=Math.round(d/f*100)/100,v="start"===r?p*l:p*l-c;return v<a?v-a-c/2:v-a+c/2}function et(e){var t=e.axis,r=e.direction;return(ot(e.positionElement,{axis:t})-40)*("end"===r?1:-1)}function tt(e,t){var r=t.axis,n=it(e,{axis:r});return ot(e,{axis:r})/n}function rt(e,t){return e["x"===t.axis?"scrollLeft":"scrollTop"]}function nt(e,t){var r=t.axis,n=t.value;e["x"===r?"scrollLeft":"scrollTop"]=n}function ot(e,t){return e["x"===t.axis?"clientWidth":"clientHeight"]}function it(e,t){return e["x"===t.axis?"scrollWidth":"scrollHeight"]}function at(e,t){var r=t.axis,n=e.getBoundingClientRect();return{coord:n[r],positionStart:n["y"===r?"top":"left"],positionEnd:n["y"===r?"bottom":"right"],size:n["y"===r?"height":"width"]}}function lt(e){return{x:e.clientX,y:e.clientY}}function ct(e,t){var r=t.axis,n=t.value;e["x"===r?"scrollLeft":"scrollTop"]+=n}function st(e){return!(!e||0!==e.scrollTop)}function ut(e){return!(!e||e.scrollLeft!==vt(e))}function ft(e){return!(!e||e.scrollTop!==pt(e))}function dt(e){return!(!e||0!==e.scrollLeft)}function pt(e){return e.scrollHeight-e.clientHeight}function vt(e){return e.scrollWidth-e.clientWidth}function ht(e,t){var r=t.direction,n=t.distance,o=t.axis,i=e["x"===o?"scrollLeft":"scrollTop"]+n,a="end"===r?function(e,t){return"x"===t?vt(e):pt(e)}(e,o):0;return"end"===r?Math.min(a,i):Math.max(a,i)}function bt(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var o=e[n[r]];t.push(o.height,o.width)}return t}function mt(e,t,r){r=r||t.getBoundingClientRect();var n=lt(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function yt(e,t){return tt(e,{axis:t.axis})<1}function St(e,t){var r=t.axis,n=t.delta;return!(0===n||n<0&&("x"===r?dt:st)(e)||n>0&&("x"===r?ut:ft)(e))}function gt(e){var t=e.thumbElement,r=e.positionElement,n=e.axis,o=it(r,{axis:n}),i=ot(r,{axis:n}),a=rt(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left="".concat(100*a,"%"):"y"===n&&(t.style.top="".concat(100*a,"%")))}exports.Corner=We; | ||
var e,t,r=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),n=require("@radix-ui/utils"),o=n.canUseDOM,i=n.clamp,a=n.getSelector,l=n.getSelectorObj,c=n.getResizeObserverEntryBorderBoxSize,s=n.isMainClick,u=n.namespaced,f=require("@radix-ui/react-primitive").Primitive,d=require("@radix-ui/react-utils"),p=d.composeEventHandlers,v=d.createContext,h=d.getOwnerGlobals,m=d.useCallbackRef,b=d.useComposedRefs,y=d.useConstant,S=d.useLayoutEffect,w=d.usePrefersReducedMotion;var g,x,R="function"==typeof Float32Array;function E(e,t){return 1-3*t+3*e}function A(e,t){return 3*t-6*e}function T(e){return 3*e}function I(e,t,r){return((E(t,r)*e+A(t,r))*e+T(t))*e}function k(e,t,r){return 3*E(t,r)*e*e+2*A(t,r)*e+T(t)}function P(e){return e}function O(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return P;for(var o=R?new Float32Array(11):new Array(11),i=0;i<11;++i)o[i]=I(.1*i,e,r);function a(t){for(var n=0,i=1;10!==i&&o[i]<=t;++i)n+=.1;--i;var a=n+.1*((t-o[i])/(o[i+1]-o[i])),l=k(a,e,r);return l>=.001?function(e,t,r,n){for(var o=0;o<4;++o){var i=k(t,r,n);if(0===i)return t;t-=(I(t,r,n)-e)/i}return t}(t,a,e,r):0===l?a:function(e,t,r,n,o){var i,a,l=0;do{(i=I(a=t+(r-t)/2,n,o)-e)>0?r=a:t=a}while(Math.abs(i)>1e-7&&++l<10);return a}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:I(a(e),t,n)}}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}(x=g||(g={}))[x.Idle=0]="Idle",x[x.Stopped=1]="Stopped",x[x.Queuing=2]="Queuing",x[x.Pending=3]="Pending",x[x.Resolved=4]="Resolved",x[x.Error=5]="Error";var X=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),C(this,"queue",[]),C(this,"_state",g.Idle)}var t,r,n;return t=e,(r=[{key:"restart",value:function(){this.state===g.Stopped&&(this._state=g.Idle)}},{key:"rejectItem",value:function(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Error:g.Queuing,e(t),this.dequeue())}},{key:"resolveItem",value:function(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Resolved:g.Queuing,e(t),this.dequeue())}},{key:"enqueue",value:function(e){var t=this;return this.restart(),new Promise((function(r,n){t.queue.push({promise:e,resolve:r,reject:n}),t.dequeue()}))}},{key:"dequeue",value:function(){var e=this;if(this.stateIs(g.Error,g.Resolved,g.Idle,g.Queuing)){if(this.isEmpty())return;var t=this.queue.shift();try{this._state=g.Pending,t.promise().then((function(r){e.resolveItem(t.resolve,r)})).catch((function(r){e.rejectItem(t.reject,r)}))}catch(e){this.rejectItem(t.reject,e)}}}},{key:"stateIs",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.includes(this.state)}},{key:"isEmpty",value:function(){return this.queue.length<=0}},{key:"stop",value:function(){this.stateIs(g.Pending,g.Queuing)&&(this._state=g.Stopped,this.queue=[])}},{key:"isBusy",get:function(){return this.state===g.Queuing||this.state===g.Pending}},{key:"state",get:function(){return this._state}}])&&z(t.prototype,r),n&&z(t,n),e}();function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return V(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return V(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var L=!1,H=0;function B(e){"touch"===e.pointerType&&(L=!0,setTimeout((function(){L=!1}),50))}function j(){if("undefined"!=typeof document)return document.addEventListener("pointerup",B),H++,function(){--H>0||document.removeEventListener("pointerup",B)}}function M(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onHoverStart,n=e.onHoverChange,o=e.onHoverEnd,i=e.isDisabled,a=r.useState(!1),l=Y(a,2),c=l[0],s=l[1],u=r.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;r.useEffect(j,[]);var f=r.useMemo((function(){return{onPointerEnter:function(e){L&&"mouse"===e.pointerType||function(e,r){if(!i&&"touch"!==r&&!u.isHovered){u.isHovered=!0;var o=e.target;t&&t({type:"hoverstart",target:o,pointerType:r}),n&&n(!0),s(!0)}}(e,e.pointerType)},onPointerLeave:function(e){!function(e,t){if(!i&&"touch"!==t&&u.isHovered){u.isHovered=!1;var r=e.target;o&&o({type:"hoverend",target:r,pointerType:t}),n&&n(!1),s(!1)}}(e,e.pointerType)}}}),[i,u,t,n,o]);return{hoverProps:f,isHovered:c}}function W(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||U(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return r}(e,t)||U(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){if(e){if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(e,t):void 0}}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var G,J,K,Z,ee=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return _(_({},e),{},N({},t,(r=t,"--".concat(u("ScrollArea".concat((n=r,n.charAt(0).toUpperCase()+n.slice(1))))))));var r,n}),{});exports.SCROLL_AREA_CSS_PROPS=ee,(J=G||(G={})).Idle="Idle",J.Thumbing="Thumbing",J.Tracking="Tracking",J.ButtonScrolling="ButtonScrolling",(Z=K||(K={}))[Z.DeriveStateFromProps=0]="DeriveStateFromProps",Z[Z.HandleScrollAreaResize=1]="HandleScrollAreaResize",Z[Z.HandleViewportResize=2]="HandleViewportResize",Z[Z.HandleScrollbarResize=3]="HandleScrollbarResize",Z[Z.HandleTrackResize=4]="HandleTrackResize",Z[Z.SetContentOverflowing=5]="SetContentOverflowing",Z[Z.SetExplicitResize=6]="SetExplicitResize",Z[Z.StartTracking=7]="StartTracking",Z[Z.StopTracking=8]="StopTracking",Z[Z.StartThumbing=9]="StartThumbing",Z[Z.StopThumbing=10]="StopThumbing",Z[Z.StartButtonPress=11]="StartButtonPress",Z[Z.StopButtonPress=12]="StopButtonPress",Z[Z.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";var te={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},re=F(v("ScrollAreaRefsContext","ScrollArea"),2),ne=re[0],oe=re[1],ie=F(v("ScrollAreaContext","ScrollArea"),2),ae=ie[0],le=ie[1],ce=r.createContext({});function se(){return r.useContext(ce)}ce.displayName="ScrollAreaStateContext";var ue=r.createContext(!0),fe=function(){return r.useContext(ue)},de=F(v("DispatchContext","ScrollArea"),2),pe=de[0],ve=de[1],he=r.forwardRef((function(e,t){var n=_(_({},te),e),i=n.unstable_forceNative,a=void 0!==i&&i,l=n.children,c=Q(n,["unstable_forceNative","children"]),s=F(r.useState(!0),2),u=s[0],f=s[1];S((function(){f(a||!("ResizeObserver"in window&&function(){var e,t;if(!o())return!1;var r=!1;try{document.querySelector("::-webkit-scrollbar"),r=!0}catch(e){}return!(!(null===(e=window.CSS)||void 0===e||null===(t=e.supports)||void 0===t?void 0:t.call(e,"scrollbar-width: none"))&&!r)}()))}),[a]);var d=u?be:we,p=r.useRef(null),v=r.useRef(null);return function(e,t,n){r.useImperativeHandle(e,(function(){var e=t.current,r=n.current||e,o={scrollIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scroll).call.apply(e,[r].concat(n))},scrollByIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollBy).call.apply(e,[r].concat(n))},scrollIntoViewIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollIntoView).call.apply(e,[r].concat(n))},scrollToIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollTo).call.apply(e,[r].concat(n))},get scrollTopIntent(){return r.scrollTop},set scrollTopIntent(e){r.scrollTop=e},get scrollLeftIntent(){return r.scrollLeft},set scrollLeftIntent(e){r.scrollLeft=e},get scrollHeightIntent(){return r.scrollHeight},get scrollWidthIntent(){return r.scrollWidth},addScrollListener:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.addEventListener.apply(r,["scroll"].concat(t))},removeScrollListener:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.removeEventListener.apply(r,["scroll"].concat(t))}};return Object.assign(e,o)}))}(t,v,p),r.createElement(d,D({positionRef:p,scrollAreaRef:v},c,{ref:t}),r.createElement(ue.Provider,{value:u},l))}));exports.ScrollArea=he;var me=r.forwardRef((function(e,t){var n=_(_({},te),e),o=n.children,i=Q(n,["children"]),a=r.useRef(null),l=r.useRef(null);return r.createElement(we,D({positionRef:a,scrollAreaRef:l},i,{ref:t}),r.createElement(ue.Provider,{value:!1},o))})),be=r.forwardRef((function(e,t){var n=_(_({},te),e),o=n.overflowX,i=n.overflowY,l=(n.scrollbarVisibility,n.scrollbarVisibilityRestTimeout,n.trackClickBehavior,n.unstable_prefersReducedMotion,n.scrollAreaRef),c=(n.positionRef,Q(n,["overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"])),s=b(l,t);return r.createElement(f,D({selector:a("ScrollArea")},c,{ref:s,style:_(_({},c.style),{},{overflowX:o,overflowY:i,resize:"none"})}))})),ye={width:0,height:0},Se={state:G.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:ye,viewport:ye,position:ye,scrollbarY:ye,scrollbarX:ye,trackY:ye,trackX:ye}},we=r.forwardRef((function(e,t){var n,o=_(_({},te),e),i=o.children,l=o.onScroll,c=o.overflowX,s=o.overflowY,u=o.scrollbarVisibility,d=o.scrollbarVisibilityRestTimeout,v=o.trackClickBehavior,y=o.unstable_prefersReducedMotion,S=o.positionRef,g=o.scrollAreaRef,x=Q(o,["children","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),R=m(l),E=r.useRef(null),A=r.useRef(null),T=r.useRef(null),I=r.useRef(null),k=r.useRef(null),P=r.useRef(null),O=r.useRef(null),z=r.useRef(null),C=r.useRef(null),X=r.useRef(null),Y=r.useRef(null),V=r.useMemo((function(){return{buttonDownRef:E,buttonLeftRef:A,buttonRightRef:T,buttonUpRef:I,viewportRef:k,positionRef:S,scrollAreaRef:g,scrollbarXRef:P,scrollbarYRef:O,thumbXRef:z,thumbYRef:C,trackXRef:X,trackYRef:Y}}),[]),L=w(g),H=null!=y?y:L,B=F(r.useReducer(Qe,_(_({},Se),{},{scrollbarIsVisibleX:"always"===u,scrollbarIsVisibleY:"always"===u})),2),j=B[0],W=B[1],q=M(),U=q.hoverProps,$=U.onPointerEnter,G=U.onPointerLeave,J=q.isHovered,Z=r.useMemo((function(){return{dir:e.dir,isHovered:J,onScroll:R,overflowX:c,overflowY:s,prefersReducedMotion:H,scrollbarVisibility:u,scrollbarVisibilityRestTimeout:d,trackClickBehavior:v}}),[e.dir,R,J,c,s,H,u,d,v]),re=b(t,g);Fe(g,(function(e,t){var r=h(g).ownerWindow.getComputedStyle(t);W({type:K.HandleScrollAreaResize,scrollAreaComputedStyle:r,width:e.inlineSize,height:e.blockSize})}));var oe="always"===u&&("scroll"===c||"auto"===c&&j.contentIsOverflowingX),ie="always"===u&&("scroll"===s||"auto"===s&&j.contentIsOverflowingY),le=j.domSizes,se=(N(n={},ee.scrollbarXOffset,oe&&le.scrollbarX.height?le.scrollbarX.height+"px":0),N(n,ee.scrollbarYOffset,ie&&le.scrollbarY.width?le.scrollbarY.width+"px":0),N(n,ee.positionWidth,le.position.width?le.position.width+"px":"auto"),N(n,ee.positionHeight,le.position.height?le.position.height+"px":"auto"),n);return r.createElement(pe.Provider,{value:W},r.createElement(ne.Provider,{value:V},r.createElement(ae.Provider,{value:Z},r.createElement(ce.Provider,{value:j},r.createElement(f,D({selector:a("ScrollArea")},x,{ref:re,style:_(_({},x.style),se),onPointerEnter:p(e.onPointerEnter,$),onPointerLeave:p(e.onPointerLeave,G)}),i)))))})),ge=r.forwardRef((function(e,t){var n=e.selector,o=void 0===n?a("ScrollAreaViewport"):n,i=Q(e,["selector"]),c=oe("ScrollAreaViewport"),s=c.positionRef,u=c.thumbXRef,d=c.thumbYRef,v=c.trackXRef,h=c.trackYRef,m=c.viewportRef,y=le("ScrollAreaViewport"),w=y.onScroll,g=y.overflowX,x=y.overflowY,R=y.scrollbarVisibility,E=se(),A=ve("ScrollAreaViewport"),T=b(t,m);Fe(m,(function(e){A({type:K.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));var I=r.useCallback((function(){var e=s.current,t=u.current,r=d.current,n=v.current,o=h.current;t&&n&&e&&Et({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&o&&e&&Et({thumbElement:r,trackElement:o,axis:"y",positionElement:e})}),[s,u,d,v,h]),k=r.useRef(0),P=r.useRef(0);var O=p(w,(function(){s.current&&(I(),function(){if(s.current){var e=s.current.scrollTop,t=s.current.scrollLeft,r=e!==k.current,n=t!==P.current;r===E.scrollbarIsVisibleY&&n===E.scrollbarIsVisibleX||A({type:K.SetScrollbarIsVisible,scrollbarVisibility:R,x:n,y:r}),k.current=e<=0?0:e,P.current=t<=0?0:t}}())}));return S((function(){I()}),[I]),S((function(){var e=s.current;if(e){var t=xt(e,{axis:"x"}),r=xt(e,{axis:"y"});t===E.contentIsOverflowingX&&r===E.contentIsOverflowingY||A({type:K.SetContentOverflowing,x:t,y:r})}}),[E.contentIsOverflowingX,E.contentIsOverflowingY,A,s,E.domSizes.position.height,E.domSizes.position.width,E.domSizes.viewport.height,E.domSizes.viewport.width]),r.createElement("div",D({},o?l(o+"-position"):void 0,{ref:s,onScroll:O,style:{zIndex:1,width:"var(".concat(ee.positionWidth,")"),height:"var(".concat(ee.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:g,overflowY:x}}),r.createElement("div",D({},o?l(o+"-position-inner"):void 0,{style:{display:"table",width:"100%",paddingBottom:"var(".concat(ee.scrollbarXOffset,")"),paddingRight:"var(".concat(ee.scrollbarYOffset,")")}}),r.createElement(f,D({selector:o},i,{ref:T}))))})),xe=r.forwardRef((function(e,t){return fe()?r.createElement(f,D({selector:a("ScrollAreaViewport")},e,{ref:t})):r.createElement(ge,D({},e,{ref:t}))}));exports.ScrollAreaViewport=xe,xe.displayName="ScrollAreaViewport";var Re=F(v("ScrollbarContext","ScrollAreaScrollbar"),2),Ee=Re[0],Ae=Re[1],Te=r.forwardRef((function(e,t){var n,o=e.axis,i=e.name,a=e.onWheel,l=e.onPointerDown,c=e.onPointerUp,s=e.onPointerMove,u=Q(e,["axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),d=ve(i),v=le(i),h=v.scrollbarVisibility,m=v.scrollbarVisibilityRestTimeout,S=v.isHovered,w=se(),g=w["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"],x=w["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"],R=oe(i),E=R.positionRef,A=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,R),T=b(A,t),I=y((function(){return new X}));Fe(A,(function(e){d({type:K.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));var k=p(a,(function(e){var t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);E.current&&(t>0&&t>r&&(E.current.scrollLeft+=e.deltaX),r>0&&r>t&&(E.current.scrollTop+=e.deltaY))})),P=r.useRef();function O(){clearTimeout(P.current),P.current=setTimeout((function(){d(N({type:K.SetScrollbarIsVisible,scrollbarVisibility:h},o,!1))}),m)}r.useEffect((function(){if(x)return P.current=setTimeout((function(){d(N({type:K.SetScrollbarIsVisible,scrollbarVisibility:h},o,!1))}),m),function(){clearTimeout(P.current)}}),[o,d,x,h,m]);var z=r.useRef(!1),C=p(l,(function(e){z.current=!0,clearTimeout(P.current)})),Y=p(c,(function(e){z.current=!1,O()})),V=p(s,(function(e){z.current||O()})),L=function(){var e,t,r=(null===(e=u.style)||void 0===e?void 0:e.opacity)||1;switch(h){case"always":return null===(t=u.style)||void 0===t?void 0:t.opacity;case"scroll":return x?r:0;case"hover":return S||x?r:0}}(),H=function(){var e,t,r=(null===(e=u.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(h){case"always":return null===(t=u.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return x?r:"none";case"hover":return S||x?r:"none"}}(),B=r.useMemo((function(){return{axis:o,scrollAnimationQueue:I}}),[o,I]);return r.createElement(Ee.Provider,{value:B},r.createElement(f,D({},u,{ref:T,style:_(_({},u.style),{},{display:g?null===(n=u.style)||void 0===n?void 0:n.display:"none",opacity:L,pointerEvents:H}),onPointerDown:C,onPointerUp:Y,onPointerMove:V,onWheel:k})))})),Ie=r.forwardRef((function(e,t){var n=se().domSizes;return fe()?null:r.createElement(Te,D({selector:a("ScrollAreaScrollbarX")},e,{ref:t,axis:"x",name:"ScrollAreaScrollbarX",style:_(_({},e.style),{},N({},ee.scrollbarXSize,n.scrollbarX.height?n.scrollbarX.height+"px":0))}))}));exports.ScrollAreaScrollbarX=Ie,Ie.displayName="ScrollAreaScrollbarX";var ke=r.forwardRef((function(e,t){var n=se().domSizes;return fe()?null:r.createElement(Te,D({selector:a("ScrollAreaScrollbarY")},e,{ref:t,axis:"y",name:"ScrollAreaScrollbarY",style:_(_({},e.style),{},N({},ee.scrollbarYSize,n.scrollbarY.width?n.scrollbarY.width+"px":0))}))}));exports.ScrollAreaScrollbarY=ke,ke.displayName="ScrollAreaScrollbarY";var Pe=r.forwardRef((function(e,t){var n=e.onPointerDown,o=Q(e,["onPointerDown"]),l=Ae("ScrollAreaTrack"),c=l.axis,u=l.scrollAnimationQueue,d=ve("ScrollAreaTrack"),v=oe("ScrollAreaTrack"),y=le("ScrollAreaTrack"),S=y.trackClickBehavior,w=y.prefersReducedMotion,g=v.positionRef,x=Ke(c,v),R=Je(c,v),E=b(x,t),A=m(n);Fe(x,(function(e){d({type:K.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:c})}));var T=r.useRef();return r.useEffect((function(){var e=null,t=null,r=et(x),n=tt(R),o=rt(g),a=h(g).ownerDocument,l=p(A,(function(l){if(s(l)&&l.target!==n&&!n.contains(l.target)){var p=function(e){var t=e.event,r=e.axis,n=e.thumbElement;return ft(t)[r]<n.getBoundingClientRect()["y"===r?"top":"left"]?"start":"end"}({event:l,axis:c,thumbElement:n});if(clearTimeout(t),"page"===S){if(d({type:K.StartTracking}),a.addEventListener("pointermove",f),a.addEventListener("pointerup",v),r.setPointerCapture(l.pointerId),w){var h=ot({direction:p,positionElement:o,axis:c}),m=St(o,{direction:p,distance:h,axis:c});lt(o,{axis:c,value:m})}else u.enqueue((function(){return Ue({duration:200,timing:O(.16,0,.73,1),draw:$e({positionElement:o,direction:p,axis:c}),rafIdRef:T})}));return e=setTimeout((function(){var t=ft(l),n=nt({axis:c,direction:p,pointerPosition:t,positionElement:o,trackElement:r});if(!("start"===p&&n>0||"end"===p&&n<0)){if(w){var a=St(o,{direction:p,distance:n,axis:c});lt(o,{axis:c,value:a})}else{var s=Math.round(Math.abs(n)),f=i(s,[100,500]);u.enqueue((function(){return Ue({duration:f,timing:function(e){return e},draw:Ge({axis:c,direction:p,pointerPosition:t,positionElement:o,trackElement:r}),rafIdRef:T})}))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}var b=ft(l),y=nt({axis:c,direction:p,pointerPosition:b,positionElement:o,trackElement:r}),g=St(o,{direction:p,distance:y,axis:c});lt(o,{axis:c,value:g});var x=new PointerEvent("pointerdown",l);requestAnimationFrame((function(){n.dispatchEvent(x)}))}}));return r.addEventListener("pointerdown",l),function(){cancelAnimationFrame(T.current),clearTimeout(e),clearTimeout(t),r.removeEventListener("pointerdown",l),a.removeEventListener("pointermove",f),a.removeEventListener("pointerup",v),d({type:K.StopTracking}),u.stop()};function f(t){"mouse"===t.pointerType&>(t,r)&&(clearTimeout(e),a.removeEventListener("pointermove",f),u.stop())}function v(n){r.releasePointerCapture(n.pointerId),clearTimeout(e),a.removeEventListener("pointermove",f),a.removeEventListener("pointerup",v),u.stop(),d({type:K.StopTracking}),t=setTimeout((function(){u.stop()}),200)}}),[c,w,S,d,A,g,u,R,x]),r.createElement(f,D({selector:a("ScrollAreaTrack")},o,{ref:E,"data-axis":c}))}));exports.ScrollAreaTrack=Pe,Pe.displayName="ScrollAreaTrack";var Oe=r.forwardRef((function(e,t){var n,o,i=e.onPointerDown,l=Q(e,["onPointerDown"]),c=Ae("ScrollAreaThumb").axis,u=oe("ScrollAreaThumb"),d=ve("ScrollAreaThumb"),v=u.positionRef,y=Je(c,u),w=Ke(c,u),g=b(y,t),x=se(),R=m(i),E=r.useRef(0),A=r.useRef(0),T=r.useRef({size:0,positionStart:0}),I=r.useRef({size:0,positionStart:0}),k=r.useRef(!1);S((function(){k.current?Et({thumbElement:tt(y),trackElement:et(w),positionElement:rt(v),axis:c}):k.current=!0}),[y,w,v,c].concat(W(wt(x.domSizes))));var P="x"===c?x.domSizes.trackX.width:x.domSizes.trackY.height,O=r.useRef(P);S((function(){O.current=P})),r.useEffect((function(){var e=tt(y),t=et(w),r=rt(v),n=h(v).ownerDocument,o=p(R,(function(r){if(s(r)){var o=ft(r)[c];T.current=ut(e,{axis:c}),I.current=ut(t,{axis:c}),A.current=o,E.current=o,e.setPointerCapture(r.pointerId),n.addEventListener("pointerup",l),n.addEventListener("pointermove",a),d({type:K.StartThumbing})}}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),i()};function i(){n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",l),d({type:K.StopThumbing})}function a(e){var t=ft(e)[c],n=t-A.current,o=O.current;if(Rt(r,{axis:c,delta:n})){var i=I.current.positionStart,a=T.current.positionStart,l=E.current-a,s=Math.round(t-i),u=Math.round((s-l)/o*100)/100,f=st(r,{axis:c});lt(r,{axis:c,value:u*f}),A.current=t,d({type:K.StartThumbing})}}function l(t){e.releasePointerCapture(t.pointerId),i()}}),[c,R,d,v,u,y,w]);var z=F(r.useState({}),2),C=z[0],X=z[1];return S((function(){var e=v.current,t=w.current;X(function(e){var t=e.trackElement,r=e.positionElement,n=e.axis;if(!t||!r)return{};var o=it(r,{axis:n}),i=ct(t,{axis:n}),a=o*i;if(!xt(r,{axis:n}))return{display:"none",width:0,height:0};return N({},"x"===n?"width":"height",a)}({positionElement:e,trackElement:t,axis:c}))}),[c,v,w].concat(W(wt(x.domSizes)))),r.createElement(f,D({selector:a("ScrollAreaThumb")},l,{ref:g,"data-axis":c,style:_(_(_({},l.style),C),"x"===c?(n={},N(n,ee.scrollbarThumbWillChange,"left"),N(n,ee.scrollbarThumbHeight,"100%"),N(n,ee.scrollbarThumbWidth,"auto"),n):(o={},N(o,ee.scrollbarThumbWillChange,"top"),N(o,ee.scrollbarThumbHeight,"auto"),N(o,ee.scrollbarThumbWidth,"100%"),o))}))}));exports.ScrollAreaThumb=Oe,Oe.displayName="ScrollAreaThumb";var ze=r.forwardRef((function(e,t){var n=e.direction,o=e.name,i=e.onPointerDown,a=Q(e,["direction","name","onPointerDown"]),l=Ae(o),c=l.axis,u=l.scrollAnimationQueue,d=ve(o),v=oe(o),y=le(o).prefersReducedMotion,S=v.positionRef,w=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(n,c,v),g=b(w,t),x=r.useRef(),R=m(i);return r.useEffect((function(){var e,t=function(e,t){var r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return Ze(e,"A ref for ".concat(r," was not placed as expected. ").concat(r," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}(w,n),r=rt(S),o=h(S).ownerDocument,i=null,a=p(R,(function(a){if(s(a)){t.setPointerCapture(a.pointerId),o.addEventListener("pointerup",f),o.addEventListener("pointermove",l),d({type:K.StartButtonPress});var p="start"===n?-1:1;y?dt(r,{axis:c,value:51*p}):Rt(r,{axis:c,delta:p})&&u.enqueue((function(){return Ue({duration:135,timing:O(.16,0,.73,1),draw:function(e){dt(r,{axis:c,value:15*e*p})},rafIdRef:x})})),e=setTimeout((function(){if(y)i=setInterval((function(){Rt(r,{axis:c,delta:p})?dt(r,{axis:c,value:60*p}):clearInterval(i)}),135);else{var n=a.pointerId;!function e(){Rt(r,{axis:c,delta:p})&&u.enqueue((function(){return Ue({duration:135,timing:function(e){return e},draw:function(e){dt(r,{axis:c,value:e*(15*p)})},done:t.hasPointerCapture(n)?e:void 0,rafIdRef:x})}))}()}clearTimeout(e)}),400)}}));return t.addEventListener("pointerdown",a),function(){t.removeEventListener("pointerdown",a),o.removeEventListener("pointerup",f),o.removeEventListener("pointermove",l),clearTimeout(e),clearInterval(i),cancelAnimationFrame(x.current),d({type:K.StopButtonPress})};function l(r){"mouse"===r.pointerType&>(r,t)&&(clearTimeout(e),o.removeEventListener("pointermove",l))}function f(r){clearTimeout(e),clearInterval(i),t.releasePointerCapture(r.pointerId),t.removeEventListener("pointerup",f),d({type:K.StopButtonPress})}}),[c,n,y,w,d,R,u,S]),r.createElement(f,D({},a,{ref:g,"data-axis":c}))})),Ce=r.forwardRef((function(e,t){return r.createElement(ze,D({selector:a("ScrollAreaButtonStart")},e,{ref:t,name:"ScrollAreaButtonStart",direction:"start"}))}));exports.ScrollAreaButtonStart=Ce,Ce.displayName="ScrollAreaButtonStart";var Xe=r.forwardRef((function(e,t){return r.createElement(ze,D({selector:a("ScrollAreaButtonEnd")},e,{ref:t,name:"ScrollAreaButtonEnd",direction:"end"}))}));exports.ScrollAreaButtonEnd=Xe,Xe.displayName="ScrollAreaButtonEnd";var Ye=r.forwardRef((function(e,t){var n,o=oe("ScrollAreaCorner").positionRef,i=ve("ScrollAreaCorner"),l=le("ScrollAreaCorner").dir,c=se().domSizes,s="rtl"===l,u=(N(n={},ee.cornerLeft,s?0:"unset"),N(n,ee.cornerRight,s?"unset":0),N(n,ee.cornerHeight,c.scrollbarX.height?c.scrollbarX.height+"px":c.scrollbarY.width?c.scrollbarY.width+"px":"16px"),N(n,ee.cornerWidth,c.scrollbarY.width?c.scrollbarY.width+"px":c.scrollbarX.height?c.scrollbarX.height+"px":"16px"),N(n,"position","absolute"),n);return S((function(){if(o.current){var e=h(o).ownerWindow.getComputedStyle(o.current);i({type:K.SetExplicitResize,value:e.resize})}}),[i,o]),r.createElement(f,D({selector:a("ScrollAreaCorner")},e,{ref:t,style:_(_({},e.style),u)}))})),Ve=r.forwardRef((function(e,t){return fe()?null:r.createElement(Ye,D({},e,{ref:t}))}));exports.ScrollAreaCorner=Ve,Ve.displayName="ScrollAreaCorner";var Le=he;exports.Root=Le;var He=xe;exports.Viewport=He;var Be=Ie;exports.ScrollbarX=Be;var je=ke;exports.ScrollbarY=je;var Me=Ce;exports.ButtonStart=Me;var We=Xe;exports.ButtonEnd=We;var De=Pe;exports.Track=De;var qe=Oe;exports.Thumb=qe;var _e=Ve;exports.Corner=_e;var Ne=me;function Qe(e,t){switch(t.type){case K.SetExplicitResize:return _(_({},e),{},{explicitResize:t.value});case K.HandleScrollAreaResize:var r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),a=parseInt(r.borderLeftWidth),l=parseInt(r.paddingTop),c=parseInt(r.paddingRight),s=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},{scrollArea:{width:t.width,height:t.height},position:{width:t.width-a-o-u-c,height:t.height-n-i-l-s}})});case K.SetContentOverflowing:return _(_({},e),{},{contentIsOverflowingX:t.x,contentIsOverflowingY:t.y});case K.SetScrollbarIsVisible:var f,d;return"always"===t.scrollbarVisibility?_(_({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):_(_({},e),{},{scrollbarIsVisibleX:null!==(f=t.x)&&void 0!==f?f:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(d=t.y)&&void 0!==d?d:e.scrollbarIsVisibleY});case K.HandleViewportResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},{viewport:{width:t.width,height:t.height}})});case K.HandleScrollbarResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},N({},"x"===t.axis?"scrollbarX":"scrollbarY",{height:t.height,width:t.width}))});case K.HandleTrackResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},N({},"x"===t.axis?"trackX":"trackY",{height:t.height,width:t.width}))});case K.StartTracking:return _(_({},e),{},{state:G.Tracking});case K.StopTracking:return _(_({},e),{},{state:G.Idle});case K.StartThumbing:return _(_({},e),{},{state:G.Thumbing});case K.StopThumbing:return _(_({},e),{},{state:G.Idle});case K.StartButtonPress:return _(_({},e),{},{state:G.ButtonScrolling});case K.StopButtonPress:return _(_({},e),{},{state:G.Idle})}return e}function Fe(e,t){var r=m(t);S((function(){var t,n=e.current;if(n){var o=new ResizeObserver((function(e){var t=F(e,1)[0],n=c(t);r(n,t.target)})),i=n.getBoundingClientRect();return r({inlineSize:i.width,blockSize:i.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}}),[r,e])}function Ue(e){var t=e.duration,r=e.draw,n=e.timing,o=e.done,a=e.rafIdRef;return new Promise((function(e){var l=performance.now(),c=!1;a.current=requestAnimationFrame((function s(u){var f=i((u-(l=u<l?u:l))/t,[0,1]);r(n(f)),f<1?!c&&(a.current=requestAnimationFrame(s)):(c=!0,cancelAnimationFrame(a.current),e("done"),o&&o())}))}))}function $e(e){var t=e.axis,r=e.direction,n=e.positionElement,o=ot({axis:t,direction:r,positionElement:n});return function(e){var i=o*Math.min(e,1),a=St(n,{direction:r,distance:i,axis:t});o-=i,lt(n,{axis:t,value:a})}}function Ge(e){var t=e.axis,r=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,a=nt({axis:t,direction:r,pointerPosition:n,positionElement:o,trackElement:i});return function(e){var n=Math.pow(10,3),i=Math.round(a*Math.min(e,1)*n)/n,l=St(o,{direction:r,distance:i,axis:t});a-=i,lt(o,{axis:t,value:l})}}function Je(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function Ke(e,t){return"x"===e?t.trackXRef:t.trackYRef}function Ze(e,t){var r=e.current;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function et(e){return Ze(e,"A ref for ".concat("ScrollAreaTrack"," was not placed as expected. ").concat("ScrollAreaTrack"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function tt(e){return Ze(e,"A ref for ".concat("ScrollAreaThumb"," was not placed as expected. ").concat("ScrollAreaThumb"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function rt(e){return Ze(e,"A ref for an internal component in ".concat("ScrollAreaViewport"," was not placed as expected. ").concat("ScrollAreaViewport"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function nt(e){var t=e.axis,r=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,a=at(o,{axis:t}),l=st(o,{axis:t}),c=ct(o,{axis:t}),s=ut(i,{axis:t}),u=s.positionStart,f=s.size,d=Math.round(n[t]-u),p=Math.round(d/f*100)/100,v="start"===r?p*l:p*l-c;return v<a?v-a-c/2:v-a+c/2}function ot(e){var t=e.axis,r=e.direction;return(ct(e.positionElement,{axis:t})-40)*("end"===r?1:-1)}function it(e,t){var r=t.axis,n=st(e,{axis:r});return ct(e,{axis:r})/n}function at(e,t){return e["x"===t.axis?"scrollLeft":"scrollTop"]}function lt(e,t){var r=t.axis,n=t.value;e["x"===r?"scrollLeft":"scrollTop"]=n}function ct(e,t){return e["x"===t.axis?"clientWidth":"clientHeight"]}function st(e,t){return e["x"===t.axis?"scrollWidth":"scrollHeight"]}function ut(e,t){var r=t.axis,n=e.getBoundingClientRect();return{coord:n[r],positionStart:n["y"===r?"top":"left"],positionEnd:n["y"===r?"bottom":"right"],size:n["y"===r?"height":"width"]}}function ft(e){return{x:e.clientX,y:e.clientY}}function dt(e,t){var r=t.axis,n=t.value;e["x"===r?"scrollLeft":"scrollTop"]+=n}function pt(e){return!(!e||0!==e.scrollTop)}function vt(e){return!(!e||e.scrollLeft!==yt(e))}function ht(e){return!(!e||e.scrollTop!==bt(e))}function mt(e){return!(!e||0!==e.scrollLeft)}function bt(e){return e.scrollHeight-e.clientHeight}function yt(e){return e.scrollWidth-e.clientWidth}function St(e,t){var r=t.direction,n=t.distance,o=t.axis,i=e["x"===o?"scrollLeft":"scrollTop"]+n,a="end"===r?function(e,t){return"x"===t?yt(e):bt(e)}(e,o):0;return"end"===r?Math.min(a,i):Math.max(a,i)}function wt(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var o=e[n[r]];t.push(o.height,o.width)}return t}function gt(e,t,r){r=r||t.getBoundingClientRect();var n=ft(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function xt(e,t){return it(e,{axis:t.axis})<1}function Rt(e,t){var r=t.axis,n=t.delta;return!(0===n||n<0&&("x"===r?mt:pt)(e)||n>0&&("x"===r?vt:ht)(e))}function Et(e){var t=e.thumbElement,r=e.positionElement,n=e.axis,o=st(r,{axis:n}),i=ct(r,{axis:n}),a=at(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left="".concat(100*a,"%"):"y"===n&&(t.style.top="".concat(100*a,"%")))}exports.unstable_ScrollAreaNoNativeFallback=Ne; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import*as e from"react";import{canUseDOM as t,clamp as r,getPartDataAttrObj as n,getResizeObserverEntryBorderBoxSize as o,isMainClick as i,namespaced as l}from"@radix-ui/utils";import{forwardRefWithAs as s}from"@radix-ui/react-polymorphic";import{composeEventHandlers as c,createContext as a,getOwnerGlobals as u,useCallbackRef as d,useComposedRefs as f,useConstant as p,useLayoutEffect as S,usePrefersReducedMotion as h}from"@radix-ui/react-utils";const m="function"==typeof Float32Array;function b(e,t){return 1-3*t+3*e}function v(e,t){return 3*t-6*e}function R(e){return 3*e}function w(e,t,r){return((b(t,r)*e+v(t,r))*e+R(t))*e}function g(e,t,r){return 3*b(t,r)*e*e+2*v(t,r)*e+R(t)}function x(e){return e}function y(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return x;const o=m?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=w(.1*t,e,r);function i(t){let n=0,i=1;for(;10!==i&&o[i]<=t;++i)n+=.1;--i;const l=n+.1*((t-o[i])/(o[i+1]-o[i])),s=g(l,e,r);return s>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=g(t,r,n);if(0===o)return t;t-=(w(t,r,n)-e)/o}return t}(t,l,e,r):0===s?l:function(e,t,r,n,o){let i,l,s=0;do{l=t+(r-t)/2,i=w(l,n,o)-e,i>0?r=l:t=l}while(Math.abs(i)>1e-7&&++s<10);return l}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:w(i(e),t,n)}}function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var E,P;(P=E||(E={}))[P.Idle=0]="Idle",P[P.Stopped=1]="Stopped",P[P.Queuing=2]="Queuing",P[P.Pending=3]="Pending",P[P.Resolved=4]="Resolved",P[P.Error=5]="Error";class T{constructor(){A(this,"queue",[]),A(this,"_state",E.Idle)}restart(){this.state===E.Stopped&&(this._state=E.Idle)}rejectItem(e,t){this.stateIs(E.Pending,E.Queuing)&&(this._state=this.isEmpty()?E.Error:E.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(E.Pending,E.Queuing)&&(this._state=this.isEmpty()?E.Resolved:E.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===E.Queuing||this.state===E.Pending}enqueue(e){return this.restart(),new Promise(((t,r)=>{this.queue.push({promise:e,resolve:t,reject:r}),this.dequeue()}))}dequeue(){if(this.stateIs(E.Error,E.Resolved,E.Idle,E.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=E.Pending,e.promise().then((t=>{this.resolveItem(e.resolve,t)})).catch((t=>{this.rejectItem(e.reject,t)}))}catch(t){this.rejectItem(e.reject,t)}}}get state(){return this._state}stateIs(...e){return e.includes(this.state)}isEmpty(){return this.queue.length<=0}stop(){this.stateIs(E.Pending,E.Queuing)&&(this._state=E.Stopped,this.queue=[])}}let O=!1,C=0;function I(e){"touch"===e.pointerType&&(O=!0,setTimeout((function(){O=!1}),50))}function L(){if("undefined"!=typeof document)return document.addEventListener("pointerup",I),C++,function(){C--,C>0||document.removeEventListener("pointerup",I)}}function k(t={}){const{onHoverStart:r,onHoverChange:n,onHoverEnd:o,isDisabled:i}=t,[l,s]=e.useState(!1),c=e.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;e.useEffect(L,[]);return{hoverProps:e.useMemo((function(){return{onPointerEnter(e){O&&"mouse"===e.pointerType||function(e,t){if(i||"touch"===t||c.isHovered)return;c.isHovered=!0;const o=e.target;r&&r({type:"hoverstart",target:o,pointerType:t}),n&&n(!0),s(!0)}(e,e.pointerType)},onPointerLeave(e){!function(e,t){if(i||"touch"===t||!c.isHovered)return;c.isHovered=!1;const r=e.target;o&&o({type:"hoverend",target:r,pointerType:t}),n&&n(!1),s(!1)}(e,e.pointerType)}}}),[i,c,r,n,o]),isHovered:l}}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){V(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X(){return(X=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function Y(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}export const SCROLL_AREA_CSS_PROPS=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return z(z({},e),{},{[t]:(n=t,"--".concat(l("ScrollArea".concat((r=n,r.charAt(0).toUpperCase()+r.slice(1))))))});var r;var n}),{});var B,H,M,j;(H=B||(B={})).Idle="Idle",H.Thumbing="Thumbing",H.Tracking="Tracking",H.ButtonScrolling="ButtonScrolling",(j=M||(M={}))[j.DeriveStateFromProps=0]="DeriveStateFromProps",j[j.HandleScrollAreaResize=1]="HandleScrollAreaResize",j[j.HandleViewportResize=2]="HandleViewportResize",j[j.HandleScrollbarResize=3]="HandleScrollbarResize",j[j.HandleTrackResize=4]="HandleTrackResize",j[j.SetContentOverflowing=5]="SetContentOverflowing",j[j.SetExplicitResize=6]="SetExplicitResize",j[j.StartTracking=7]="StartTracking",j[j.StopTracking=8]="StopTracking",j[j.StartThumbing=9]="StartThumbing",j[j.StopThumbing=10]="StopThumbing",j[j.StartButtonPress=11]="StartButtonPress",j[j.StopButtonPress=12]="StopButtonPress",j[j.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";const W="div",[D,q]=a("ScrollAreaRefsContext","ScrollArea"),[Q,N]=a("ScrollAreaContext","ScrollArea"),F=e.createContext({});function U(){return e.useContext(F)}F.displayName="ScrollAreaStateContext";const G=e.createContext(!0),J=()=>e.useContext(G),[K,Z]=a("DispatchContext","ScrollArea");export const ScrollArea=s((function(r,o){const{as:i=W,children:l,overflowX:s="auto",overflowY:c="auto",scrollbarVisibility:a="hover",scrollbarVisibilityRestTimeout:u=600,dir:d="ltr",trackClickBehavior:f="relative",unstable_forceNative:p=!1,unstable_prefersReducedMotion:h=!1}=r,m=Y(r,["as","children","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","dir","trackClickBehavior","unstable_forceNative","unstable_prefersReducedMotion"]),[b,v]=e.useState(!0);S((()=>{v(p||!("ResizeObserver"in window&&function(){var e,r;if(!t())return!1;let n=!1;try{document.querySelector("::-webkit-scrollbar"),n=!0}catch(e){}return!(!(null===(e=window.CSS)||void 0===e||null===(r=e.supports)||void 0===r?void 0:r.call(e,"scrollbar-width: none"))&&!n)}()))}),[p]);const R=b?$:re,w=e.useRef(null),g=e.useRef(null);return function(t,r,n){e.useImperativeHandle(t,(()=>{const e=r.current,t=n.current||e,o={scrollIntent(...e){t.scroll.call(t,...e)},scrollByIntent(...e){t.scrollBy.call(t,...e)},scrollIntoViewIntent(...e){t.scrollIntoView.call(t,...e)},scrollToIntent(...e){t.scrollTo.call(t,...e)},get scrollTopIntent(){return t.scrollTop},set scrollTopIntent(e){t.scrollTop=e},get scrollLeftIntent(){return t.scrollLeft},set scrollLeftIntent(e){t.scrollLeft=e},get scrollHeightIntent(){return t.scrollHeight},get scrollWidthIntent(){return t.scrollWidth},addScrollListener(...e){t.addEventListener("scroll",...e)},removeScrollListener(...e){t.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(o,g,w),e.createElement(R,X({},n("ScrollArea"),m,{as:i,overflowX:s,overflowY:c,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:u,dir:d,positionRef:w,scrollAreaRef:g,trackClickBehavior:f,unstable_prefersReducedMotion:h,ref:o}),e.createElement(G.Provider,{value:b},l))}));const $=s((function(t,r){const{as:n=W,overflowX:o,overflowY:i,scrollbarVisibility:l,scrollbarVisibilityRestTimeout:s,trackClickBehavior:c,unstable_prefersReducedMotion:a,scrollAreaRef:u,positionRef:d}=t,p=Y(t,["as","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"]),S=f(u,r);return e.createElement(n,X({ref:S},p,{style:z(z({},p.style),{},{overflowX:o,overflowY:i,resize:"none"})}))})),ee={width:0,height:0},te={state:B.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:ee,viewport:ee,position:ee,scrollbarY:ee,scrollbarX:ee,trackY:ee,trackX:ee}},re=s((function(t,r){const{as:n=W,children:o,onScroll:i,overflowX:l,overflowY:s,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:p,trackClickBehavior:S,unstable_prefersReducedMotion:m,positionRef:b,scrollAreaRef:v}=t,R=Y(t,["as","children","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),w=d(i),g=e.useRef(null),x=e.useRef(null),y=e.useRef(null),A=e.useRef(null),E=e.useRef(null),P=e.useRef(null),T=e.useRef(null),O=e.useRef(null),C=e.useRef(null),I=e.useRef(null),L=e.useRef(null),_=e.useMemo((()=>({buttonDownRef:g,buttonLeftRef:x,buttonRightRef:y,buttonUpRef:A,viewportRef:E,positionRef:b,scrollAreaRef:v,scrollbarXRef:P,scrollbarYRef:T,thumbXRef:O,thumbYRef:C,trackXRef:I,trackYRef:L})),[]),V=h(v),B=null!=m?m:V,[H,j]=e.useReducer(he,z(z({},te),{},{scrollbarIsVisibleX:"always"===a,scrollbarIsVisibleY:"always"===a})),{hoverProps:{onPointerEnter:q,onPointerLeave:N},isHovered:U}=k(),G=e.useMemo((()=>({dir:t.dir||"ltr",isHovered:U,onScroll:w,overflowX:l,overflowY:s,prefersReducedMotion:B,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:p,trackClickBehavior:S})),[t.dir,w,U,l,s,B,a,p,S]),J=f(r,v);me(v,((e,t)=>{const{ownerWindow:r}=u(v),n=r.getComputedStyle(t);j({type:M.HandleScrollAreaResize,scrollAreaComputedStyle:n,width:e.inlineSize,height:e.blockSize})}));const Z="always"===a&&("scroll"===l||"auto"===l&&H.contentIsOverflowingX),$="always"===a&&("scroll"===s||"auto"===s&&H.contentIsOverflowingY),{domSizes:ee}=H,re={[SCROLL_AREA_CSS_PROPS.scrollbarXOffset]:Z&&ee.scrollbarX.height?ee.scrollbarX.height+"px":0,[SCROLL_AREA_CSS_PROPS.scrollbarYOffset]:$&&ee.scrollbarY.width?ee.scrollbarY.width+"px":0,[SCROLL_AREA_CSS_PROPS.positionWidth]:ee.position.width?ee.position.width+"px":"auto",[SCROLL_AREA_CSS_PROPS.positionHeight]:ee.position.height?ee.position.height+"px":"auto"};return e.createElement(K.Provider,{value:j},e.createElement(D.Provider,{value:_},e.createElement(Q.Provider,{value:G},e.createElement(F.Provider,{value:H},e.createElement(n,X({},R,{ref:J,style:z(z({},R.style),re),onPointerEnter:c(t.onPointerEnter,q),onPointerLeave:c(t.onPointerLeave,N)}),o)))))})),ne="div",oe=s((function(t,r){const{as:o=ne}=t,i=Y(t,["as"]),{positionRef:l,thumbXRef:s,thumbYRef:a,trackXRef:u,trackYRef:d,viewportRef:p}=q("ScrollAreaViewport"),{onScroll:h,overflowX:m,overflowY:b,scrollbarVisibility:v}=N("ScrollAreaViewport"),R=U(),w=Z("ScrollAreaViewport"),g=f(r,p);me(p,(e=>{w({type:M.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const x=e.useCallback((function(){const e=l.current,t=s.current,r=a.current,n=u.current,o=d.current;t&&n&&e&&Fe({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&o&&e&&Fe({thumbElement:r,trackElement:o,axis:"y",positionElement:e})}),[l,s,a,u,d]),y=e.useRef(0),A=e.useRef(0);const E=c(h,(function(){l.current&&(x(),function(){if(!l.current)return;const e=l.current.scrollTop,t=l.current.scrollLeft,r=e!==y.current,n=t!==A.current;r===R.scrollbarIsVisibleY&&n===R.scrollbarIsVisibleX||w({type:M.SetScrollbarIsVisible,scrollbarVisibility:v,x:n,y:r}),y.current=e<=0?0:e,A.current=t<=0?0:t}())}));return S((()=>{x()}),[x]),S((function(){const e=l.current;if(!e)return;const t=Qe(e,{axis:"x"}),r=Qe(e,{axis:"y"});t===R.contentIsOverflowingX&&r===R.contentIsOverflowingY||w({type:M.SetContentOverflowing,x:t,y:r})}),[R.contentIsOverflowingX,R.contentIsOverflowingY,w,l,R.domSizes.position.height,R.domSizes.position.width,R.domSizes.viewport.height,R.domSizes.viewport.width]),e.createElement("div",X({},n("ScrollAreaPosition"),{ref:l,onScroll:E,style:{zIndex:1,width:"var(".concat(SCROLL_AREA_CSS_PROPS.positionWidth,")"),height:"var(".concat(SCROLL_AREA_CSS_PROPS.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:m,overflowY:b}}),e.createElement("div",X({},n("ScrollAreaPositionInner"),{style:{display:"table",width:"100%",paddingBottom:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarXOffset,")"),paddingRight:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarYOffset,")")}}),e.createElement(o,X({},n("ScrollAreaViewport"),{ref:g},i))))}));export const ScrollAreaViewport=s((function(t,r){const{as:o=ne}=t,i=Y(t,["as"]);return J()?e.createElement(o,X({},n("ScrollAreaViewport"),{ref:r},i)):e.createElement(oe,X({ref:r,as:o},i))}));ScrollAreaViewport.displayName="ScrollAreaViewport";const ie="div",[le,se]=a("ScrollbarContext","ScrollAreaScrollbarImpl"),ce=s((function(t,r){var n;const{as:o=ie,axis:i,name:l,onWheel:s,onPointerDown:a,onPointerUp:u,onPointerMove:d}=t,S=Y(t,["as","axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),h=Z(l),{scrollbarVisibility:m,scrollbarVisibilityRestTimeout:b,isHovered:v}=N(l),{["x"===i?"contentIsOverflowingX":"contentIsOverflowingY"]:R,["x"===i?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:w}=U(),g=q(l),{positionRef:x}=g,y=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(i,g),A=f(y,r),E=p((()=>new T));me(y,(e=>{h({type:M.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:i})}));const P=c(s,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);x.current&&(t>0&&t>r&&(x.current.scrollLeft+=e.deltaX),r>0&&r>t&&(x.current.scrollTop+=e.deltaY))})),O=e.useRef();function C(){clearTimeout(O.current),O.current=setTimeout((()=>{h({type:M.SetScrollbarIsVisible,scrollbarVisibility:m,[i]:!1})}),b)}e.useEffect((()=>{if(w)return O.current=setTimeout((()=>{h({type:M.SetScrollbarIsVisible,scrollbarVisibility:m,[i]:!1})}),b),function(){clearTimeout(O.current)}}),[i,h,w,m,b]);const I=e.useRef(!1),L=c(a,(e=>{I.current=!0,clearTimeout(O.current)})),k=c(u,(e=>{I.current=!1,C()})),_=c(d,(e=>{I.current||C()})),V=function(){var e,t;const r=(null===(e=S.style)||void 0===e?void 0:e.opacity)||1;switch(m){case"always":return null===(t=S.style)||void 0===t?void 0:t.opacity;case"scroll":return w?r:0;case"hover":return v||w?r:0}}(),B=function(){var e,t;const r=(null===(e=S.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(m){case"always":return null===(t=S.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return w?r:"none";case"hover":return v||w?r:"none"}}(),H=e.useMemo((()=>({axis:i,scrollAnimationQueue:E})),[i,E]);return e.createElement(le.Provider,{value:H},e.createElement(o,X({ref:A},S,{style:z(z({},S.style),{},{display:R?null===(n=S.style)||void 0===n?void 0:n.display:"none",opacity:V,pointerEvents:B}),onPointerDown:L,onPointerUp:k,onPointerMove:_,onWheel:P})))}));export const ScrollAreaScrollbarX=s((function(t,r){const{domSizes:o}=U();return J()?null:e.createElement(ce,X({},n("ScrollAreaScrollbarX"),{ref:r},t,{axis:"x",name:"ScrollAreaScrollbarX",style:z(z({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarXSize]:o.scrollbarX.height?o.scrollbarX.height+"px":0})}))}));ScrollAreaScrollbarX.displayName="ScrollAreaScrollbarX";export const ScrollAreaScrollbarY=s((function(t,r){const{domSizes:o}=U();return J()?null:e.createElement(ce,X({},n("ScrollAreaScrollbarY"),{ref:r},t,{axis:"y",name:"ScrollAreaScrollbarY",style:z(z({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarYSize]:o.scrollbarY.width?o.scrollbarY.width+"px":0})}))}));ScrollAreaScrollbarY.displayName="ScrollAreaScrollbarY";const ae="div";export const ScrollAreaTrack=s((function(t,o){const{as:l=ae,onPointerDown:s}=t,a=Y(t,["as","onPointerDown"]),{axis:p,scrollAnimationQueue:S}=se("ScrollAreaTrack"),h=Z("ScrollAreaTrack"),m=q("ScrollAreaTrack"),{trackClickBehavior:b,prefersReducedMotion:v}=N("ScrollAreaTrack"),{positionRef:R}=m,w=ge(p,m),g=we(p,m),x=f(w,o),A=d(s);me(w,(e=>{h({type:M.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:p})}));const E=e.useRef();return e.useEffect((()=>{let e=null,t=null;const n=ye(w),o=Ae(g),l=Ee(R),{ownerDocument:s}=u(R),a=c(A,(function(c){if(!i(c)||c.target===o||o.contains(c.target))return;const a=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=ze(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:c,axis:p,thumbElement:o});if(clearTimeout(t),"page"===b){if(h({type:M.StartTracking}),s.addEventListener("pointermove",d),s.addEventListener("pointerup",f),n.setPointerCapture(c.pointerId),v){const e=Te({direction:a,positionElement:l,axis:p}),t=We(l,{direction:a,distance:e,axis:p});Ie(l,{axis:p,value:t})}else S.enqueue((()=>be({duration:200,timing:y(.16,0,.73,1),draw:ve({positionElement:l,direction:a,axis:p}),rafIdRef:E})));return e=setTimeout((()=>{const t=ze(c),o=Pe({axis:p,direction:a,pointerPosition:t,positionElement:l,trackElement:n});if(!("start"===a&&o>0||"end"===a&&o<0)){if(v){const e=We(l,{direction:a,distance:o,axis:p});Ie(l,{axis:p,value:e})}else{const e=Math.round(Math.abs(o)),i=r(e,[100,500]);S.enqueue((()=>be({duration:i,timing:e=>e,draw:Re({axis:p,direction:a,pointerPosition:t,positionElement:l,trackElement:n}),rafIdRef:E})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=ze(c),t=Pe({axis:p,direction:a,pointerPosition:e,positionElement:l,trackElement:n}),r=We(l,{direction:a,distance:t,axis:p});Ie(l,{axis:p,value:r});const i=new PointerEvent("pointerdown",c);requestAnimationFrame((()=>{o.dispatchEvent(i)}))}}));return n.addEventListener("pointerdown",a),function(){cancelAnimationFrame(E.current),clearTimeout(e),clearTimeout(t),n.removeEventListener("pointerdown",a),s.removeEventListener("pointermove",d),s.removeEventListener("pointerup",f),h({type:M.StopTracking}),S.stop()};function d(t){"mouse"===t.pointerType&&qe(t,n)&&(clearTimeout(e),s.removeEventListener("pointermove",d),S.stop())}function f(r){n.releasePointerCapture(r.pointerId),clearTimeout(e),s.removeEventListener("pointermove",d),s.removeEventListener("pointerup",f),S.stop(),h({type:M.StopTracking}),t=setTimeout((()=>{S.stop()}),200)}}),[p,v,b,h,A,R,S,g,w]),e.createElement(l,X({},n("ScrollAreaTrack"),{ref:x},a,{"data-axis":p}))}));ScrollAreaTrack.displayName="ScrollAreaTrack";const ue="div";export const ScrollAreaThumb=s((function(t,r){const{as:o=ue,onPointerDown:l}=t,s=Y(t,["as","onPointerDown"]),{axis:a}=se("ScrollAreaThumb"),p=q("ScrollAreaThumb"),h=Z("ScrollAreaThumb"),{positionRef:m}=p,b=we(a,p),v=ge(a,p),R=f(b,r),w=U(),g=d(l),x=e.useRef(0),y=e.useRef(0),A=e.useRef({size:0,positionStart:0}),E=e.useRef({size:0,positionStart:0}),P=e.useRef(!1);S((()=>{if(!P.current)return void(P.current=!0);Fe({thumbElement:Ae(b),trackElement:ye(v),positionElement:Ee(m),axis:a})}),[b,v,m,a,...De(w.domSizes)]);const T="x"===a?w.domSizes.trackX.width:w.domSizes.trackY.height,O=e.useRef(T);S((()=>{O.current=T})),e.useEffect((()=>{const e=Ae(b),t=ye(v),r=Ee(m),{ownerDocument:n}=u(m),o=c(g,(function(r){if(!i(r))return;const o=ze(r)[a];A.current=_e(e,{axis:a}),E.current=_e(t,{axis:a}),y.current=o,x.current=o,e.setPointerCapture(r.pointerId),n.addEventListener("pointerup",d),n.addEventListener("pointermove",s),h({type:M.StartThumbing})}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),l()};function l(){n.removeEventListener("pointermove",s),n.removeEventListener("pointerup",d),h({type:M.StopThumbing})}function s(e){const t=ze(e)[a],n=t-y.current,o=O.current;if(Ne(r,{axis:a,delta:n})){const{positionStart:e}=E.current,{positionStart:n}=A.current,i=x.current-n,l=Math.round(t-e),s=Math.round((l-i)/o*100)/100,c=ke(r,{axis:a});Ie(r,{axis:a,value:s*c}),y.current=t,h({type:M.StartThumbing})}}function d(t){e.releasePointerCapture(t.pointerId),l()}}),[a,g,h,m,p,b,v]);const[C,I]=e.useState({});return S((()=>{const e=m.current,t=v.current;I(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=Oe(r,{axis:n}),i=Le(t,{axis:n}),l=o*i;if(!Qe(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:l}}({positionElement:e,trackElement:t,axis:a}))}),[a,m,v,...De(w.domSizes)]),e.createElement(o,X({},n("ScrollAreaThumb"),{ref:R},s,{"data-axis":a,style:z(z(z({},s.style),C),"x"===a?{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"left",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"100%",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"auto"}:{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"top",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"auto",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"100%"})}))}));ScrollAreaThumb.displayName="ScrollAreaThumb";const de="div",fe=s((function(t,r){const{as:n=de,direction:o,name:l,onPointerDown:s}=t,a=Y(t,["as","direction","name","onPointerDown"]),{axis:p,scrollAnimationQueue:S}=se(l),h=Z(l),m=q(l),{prefersReducedMotion:b}=N(l),{positionRef:v}=m,R=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(o,p,m),w=f(R,r),g=e.useRef(),x=d(s);return e.useEffect((()=>{const e=function(e,t){const r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return xe(e,"A ref for ".concat(r," was not placed as expected. ").concat(r," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}(R,o),t=Ee(v),{ownerDocument:r}=u(v);let n,l=null;const s=c(x,(function(s){if(!i(s))return;e.setPointerCapture(s.pointerId),r.addEventListener("pointerup",d),r.addEventListener("pointermove",a),h({type:M.StartButtonPress});const c="start"===o?-1:1;b?Ve(t,{axis:p,value:51*c}):Ne(t,{axis:p,delta:c})&&S.enqueue((()=>be({duration:135,timing:y(.16,0,.73,1),draw(e){Ve(t,{axis:p,value:15*e*c})},rafIdRef:g}))),n=setTimeout((()=>{if(b)l=setInterval((()=>{Ne(t,{axis:p,delta:c})?Ve(t,{axis:p,value:60*c}):clearInterval(l)}),135);else{const r=s.pointerId;!function n(){Ne(t,{axis:p,delta:c})&&S.enqueue((()=>be({duration:135,timing:e=>e,draw(e){Ve(t,{axis:p,value:e*(15*c)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:g})))}()}clearTimeout(n)}),400)}));return e.addEventListener("pointerdown",s),function(){e.removeEventListener("pointerdown",s),r.removeEventListener("pointerup",d),r.removeEventListener("pointermove",a),clearTimeout(n),clearInterval(l),cancelAnimationFrame(g.current),h({type:M.StopButtonPress})};function a(t){"mouse"===t.pointerType&&qe(t,e)&&(clearTimeout(n),r.removeEventListener("pointermove",a))}function d(t){clearTimeout(n),clearInterval(l),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",d),h({type:M.StopButtonPress})}}),[p,o,b,R,h,x,S,v]),e.createElement(n,X({},a,{ref:w,"data-axis":p}))}));export const ScrollAreaButtonStart=s((function(t,r){return e.createElement(fe,X({},t,{name:"ScrollAreaButtonStart",direction:"start"},n("ScrollAreaButtonStart"),{ref:r}))}));ScrollAreaButtonStart.displayName="ScrollAreaButtonStart";export const ScrollAreaButtonEnd=s((function(t,r){return e.createElement(fe,X({},t,{name:"ScrollAreaButtonEnd",direction:"end"},n("ScrollAreaButtonEnd"),{ref:r}))}));ScrollAreaButtonEnd.displayName="ScrollAreaButtonEnd";const pe="div",Se=s((function(t,r){const{as:o=pe}=t,i=Y(t,["as"]),{positionRef:l}=q("ScrollAreaCorner"),s=Z("ScrollAreaCorner"),{dir:c}=N("ScrollAreaCorner"),{domSizes:a}=U(),d="rtl"===c,f={[SCROLL_AREA_CSS_PROPS.cornerLeft]:d?0:"unset",[SCROLL_AREA_CSS_PROPS.cornerRight]:d?"unset":0,[SCROLL_AREA_CSS_PROPS.cornerHeight]:a.scrollbarX.height?a.scrollbarX.height+"px":a.scrollbarY.width?a.scrollbarY.width+"px":"16px",[SCROLL_AREA_CSS_PROPS.cornerWidth]:a.scrollbarY.width?a.scrollbarY.width+"px":a.scrollbarX.height?a.scrollbarX.height+"px":"16px",position:"absolute"};return S((()=>{if(l.current){const{ownerWindow:e}=u(l),t=e.getComputedStyle(l.current);s({type:M.SetExplicitResize,value:t.resize})}}),[s,l]),e.createElement(o,X({},n("ScrollAreaCorner"),{ref:r},i,{style:z(z({},i.style),f)}))}));export const ScrollAreaCorner=s((function(t,r){return J()?null:e.createElement(Se,X({ref:r},t))}));ScrollAreaCorner.displayName="ScrollAreaCorner";export const Root=ScrollArea;export const Viewport=ScrollAreaViewport;export const ScrollbarX=ScrollAreaScrollbarX;export const ScrollbarY=ScrollAreaScrollbarY;export const ButtonStart=ScrollAreaButtonStart;export const ButtonEnd=ScrollAreaButtonEnd;export const Track=ScrollAreaTrack;export const Thumb=ScrollAreaThumb;export const Corner=ScrollAreaCorner;function he(e,t){switch(t.type){case M.SetExplicitResize:return z(z({},e),{},{explicitResize:t.value});case M.HandleScrollAreaResize:{const r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),l=parseInt(r.borderLeftWidth),s=parseInt(r.paddingTop),c=parseInt(r.paddingRight),a=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return z(z({},e),{},{domSizes:z(z({},e.domSizes),{},{scrollArea:{width:t.width,height:t.height},position:{width:t.width-l-o-u-c,height:t.height-n-i-s-a}})})}case M.SetContentOverflowing:return z(z({},e),{},{contentIsOverflowingX:t.x,contentIsOverflowingY:t.y});case M.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?z(z({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):z(z({},e),{},{scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY});case M.HandleViewportResize:return z(z({},e),{},{domSizes:z(z({},e.domSizes),{},{viewport:{width:t.width,height:t.height}})});case M.HandleScrollbarResize:return z(z({},e),{},{domSizes:z(z({},e.domSizes),{},{["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}})});case M.HandleTrackResize:return z(z({},e),{},{domSizes:z(z({},e.domSizes),{},{["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}})});case M.StartTracking:return z(z({},e),{},{state:B.Tracking});case M.StopTracking:return z(z({},e),{},{state:B.Idle});case M.StartThumbing:return z(z({},e),{},{state:B.Thumbing});case M.StopThumbing:return z(z({},e),{},{state:B.Idle});case M.StartButtonPress:return z(z({},e),{},{state:B.ButtonScrolling});case M.StopButtonPress:return z(z({},e),{},{state:B.Idle})}return e}function me(e,t){const r=d(t);S((()=>{var t;const n=e.current;if(!n)return;const i=new ResizeObserver((([e])=>{const t=o(e);r(t,e.target)})),l=n.getBoundingClientRect();return r({inlineSize:l.width,blockSize:l.height},n),null===(t=i.observe)||void 0===t||t.call(i,n),function(){i.disconnect()}}),[r,e])}function be({duration:e,draw:t,timing:n,done:o,rafIdRef:i}){return new Promise((l=>{let s=performance.now(),c=!1;i.current=requestAnimationFrame((function a(u){s=u<s?u:s;const d=r((u-s)/e,[0,1]);t(n(d)),d<1?!c&&(i.current=requestAnimationFrame(a)):(c=!0,cancelAnimationFrame(i.current),l("done"),o&&o())}))}))}function ve({axis:e,direction:t,positionElement:r}){let n=Te({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),l=We(r,{direction:t,distance:i,axis:e});n-=i,Ie(r,{axis:e,value:l})}}function Re({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=Pe({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o});return function(r){const o=Math.pow(10,3),l=Math.round(i*Math.min(r,1)*o)/o,s=We(n,{direction:t,distance:l,axis:e});i-=l,Ie(n,{axis:e,value:s})}}function we(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function ge(e,t){return"x"===e?t.trackXRef:t.trackYRef}function xe(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function ye(e){return xe(e,"A ref for ".concat("ScrollAreaTrack"," was not placed as expected. ").concat("ScrollAreaTrack"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function Ae(e){return xe(e,"A ref for ".concat("ScrollAreaThumb"," was not placed as expected. ").concat("ScrollAreaThumb"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function Ee(e){return xe(e,"A ref for an internal component in ".concat("ScrollAreaViewport"," was not placed as expected. ").concat("ScrollAreaViewport"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function Pe({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=Ce(n,{axis:e}),l=ke(n,{axis:e}),s=Le(n,{axis:e}),{positionStart:c,size:a}=_e(o,{axis:e}),u=Math.round(r[e]-c),d=Math.round(u/a*100)/100,f="start"===t?d*l:d*l-s;return f<i?f-i-s/2:f-i+s/2}function Te({axis:e,direction:t,positionElement:r}){return(Le(r,{axis:e})-40)*("end"===t?1:-1)}function Oe(e,{axis:t}){const r=ke(e,{axis:t});return Le(e,{axis:t})/r}function Ce(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function Ie(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function Le(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function ke(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function _e(e,{axis:t}){const{[t]:r,["y"===t?"top":"left"]:n,["y"===t?"bottom":"right"]:o,["y"===t?"height":"width"]:i}=e.getBoundingClientRect();return{coord:r,positionStart:n,positionEnd:o,size:i}}function ze(e){return{x:e.clientX,y:e.clientY}}function Ve(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function Xe(e){return!(!e||0!==e.scrollTop)}function Ye(e){return!(!e||e.scrollLeft!==je(e))}function Be(e){return!(!e||e.scrollTop!==Me(e))}function He(e){return!(!e||0!==e.scrollLeft)}function Me(e){return e.scrollHeight-e.clientHeight}function je(e){return e.scrollWidth-e.clientWidth}function We(e,{direction:t,distance:r,axis:n}){const{["x"===n?"scrollLeft":"scrollTop"]:o}=e,i=o+r,l="end"===t?function(e,t){return"x"===t?je(e):Me(e)}(e,n):0;return"end"===t?Math.min(l,i):Math.max(l,i)}function De(e){const t=[];for(const r of Object.keys(e)){const n=e[r];t.push(n.height,n.width)}return t}function qe(e,t,r){r=r||t.getBoundingClientRect();const n=ze(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function Qe(e,{axis:t}){return Oe(e,{axis:t})<1}function Ne(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?He:Xe)(e)||r>0&&("x"===t?Ye:Be)(e))}function Fe(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=ke(r,{axis:n}),i=Le(r,{axis:n}),l=Ce(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left="".concat(100*l,"%"):"y"===n&&(t.style.top="".concat(100*l,"%")))} | ||
import*as e from"react";import{canUseDOM as t,clamp as r,getSelector as n,getSelectorObj as o,getResizeObserverEntryBorderBoxSize as i,isMainClick as l,namespaced as s}from"@radix-ui/utils";import{Primitive as c}from"@radix-ui/react-primitive";import{composeEventHandlers as a,createContext as u,getOwnerGlobals as d,useCallbackRef as f,useComposedRefs as p,useConstant as S,useLayoutEffect as h,usePrefersReducedMotion as m}from"@radix-ui/react-utils";const b="function"==typeof Float32Array;function v(e,t){return 1-3*t+3*e}function R(e,t){return 3*t-6*e}function w(e){return 3*e}function g(e,t,r){return((v(t,r)*e+R(t,r))*e+w(t))*e}function x(e,t,r){return 3*v(t,r)*e*e+2*R(t,r)*e+w(t)}function y(e){return e}function E(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return y;const o=b?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=g(.1*t,e,r);function i(t){let n=0,i=1;for(;10!==i&&o[i]<=t;++i)n+=.1;--i;const l=n+.1*((t-o[i])/(o[i+1]-o[i])),s=x(l,e,r);return s>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=x(t,r,n);if(0===o)return t;t-=(g(t,r,n)-e)/o}return t}(t,l,e,r):0===s?l:function(e,t,r,n,o){let i,l,s=0;do{l=t+(r-t)/2,i=g(l,n,o)-e,i>0?r=l:t=l}while(Math.abs(i)>1e-7&&++s<10);return l}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:g(i(e),t,n)}}function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var P,T;(T=P||(P={}))[T.Idle=0]="Idle",T[T.Stopped=1]="Stopped",T[T.Queuing=2]="Queuing",T[T.Pending=3]="Pending",T[T.Resolved=4]="Resolved",T[T.Error=5]="Error";class O{constructor(){A(this,"queue",[]),A(this,"_state",P.Idle)}restart(){this.state===P.Stopped&&(this._state=P.Idle)}rejectItem(e,t){this.stateIs(P.Pending,P.Queuing)&&(this._state=this.isEmpty()?P.Error:P.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(P.Pending,P.Queuing)&&(this._state=this.isEmpty()?P.Resolved:P.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===P.Queuing||this.state===P.Pending}enqueue(e){return this.restart(),new Promise(((t,r)=>{this.queue.push({promise:e,resolve:t,reject:r}),this.dequeue()}))}dequeue(){if(this.stateIs(P.Error,P.Resolved,P.Idle,P.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=P.Pending,e.promise().then((t=>{this.resolveItem(e.resolve,t)})).catch((t=>{this.rejectItem(e.reject,t)}))}catch(t){this.rejectItem(e.reject,t)}}}get state(){return this._state}stateIs(...e){return e.includes(this.state)}isEmpty(){return this.queue.length<=0}stop(){this.stateIs(P.Pending,P.Queuing)&&(this._state=P.Stopped,this.queue=[])}}let C=!1,L=0;function I(e){"touch"===e.pointerType&&(C=!0,setTimeout((function(){C=!1}),50))}function _(){if("undefined"!=typeof document)return document.addEventListener("pointerup",I),L++,function(){L--,L>0||document.removeEventListener("pointerup",I)}}function k(t={}){const{onHoverStart:r,onHoverChange:n,onHoverEnd:o,isDisabled:i}=t,[l,s]=e.useState(!1),c=e.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;e.useEffect(_,[]);return{hoverProps:e.useMemo((function(){return{onPointerEnter(e){C&&"mouse"===e.pointerType||function(e,t){if(i||"touch"===t||c.isHovered)return;c.isHovered=!0;const o=e.target;r&&r({type:"hoverstart",target:o,pointerType:t}),n&&n(!0),s(!0)}(e,e.pointerType)},onPointerLeave(e){!function(e,t){if(i||"touch"===t||!c.isHovered)return;c.isHovered=!1;const r=e.target;o&&o({type:"hoverend",target:r,pointerType:t}),n&&n(!1),s(!1)}(e,e.pointerType)}}}),[i,c,r,n,o]),isHovered:l}}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach((function(t){V(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}export const SCROLL_AREA_CSS_PROPS=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return Y(Y({},e),{},{[t]:(n=t,"--".concat(s("ScrollArea".concat((r=n,r.charAt(0).toUpperCase()+r.slice(1))))))});var r;var n}),{});var H,M,j,W;(M=H||(H={})).Idle="Idle",M.Thumbing="Thumbing",M.Tracking="Tracking",M.ButtonScrolling="ButtonScrolling",(W=j||(j={}))[W.DeriveStateFromProps=0]="DeriveStateFromProps",W[W.HandleScrollAreaResize=1]="HandleScrollAreaResize",W[W.HandleViewportResize=2]="HandleViewportResize",W[W.HandleScrollbarResize=3]="HandleScrollbarResize",W[W.HandleTrackResize=4]="HandleTrackResize",W[W.SetContentOverflowing=5]="SetContentOverflowing",W[W.SetExplicitResize=6]="SetExplicitResize",W[W.StartTracking=7]="StartTracking",W[W.StopTracking=8]="StopTracking",W[W.StartThumbing=9]="StartThumbing",W[W.StopThumbing=10]="StopThumbing",W[W.StartButtonPress=11]="StartButtonPress",W[W.StopButtonPress=12]="StopButtonPress",W[W.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";const D={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},[q,N]=u("ScrollAreaRefsContext","ScrollArea"),[Q,F]=u("ScrollAreaContext","ScrollArea"),U=e.createContext({});function G(){return e.useContext(U)}U.displayName="ScrollAreaStateContext";const J=e.createContext(!0),K=()=>e.useContext(J),[Z,$]=u("DispatchContext","ScrollArea");export const ScrollArea=e.forwardRef((function(r,n){const o=Y(Y({},D),r),{unstable_forceNative:i=!1,children:l}=o,s=B(o,["unstable_forceNative","children"]),[c,a]=e.useState(!0);h((()=>{a(i||!("ResizeObserver"in window&&function(){var e,r;if(!t())return!1;let n=!1;try{document.querySelector("::-webkit-scrollbar"),n=!0}catch(e){}return!(!(null===(e=window.CSS)||void 0===e||null===(r=e.supports)||void 0===r?void 0:r.call(e,"scrollbar-width: none"))&&!n)}()))}),[i]);const u=c?te:oe,d=e.useRef(null),f=e.useRef(null);return function(t,r,n){e.useImperativeHandle(t,(()=>{const e=r.current,t=n.current||e,o={scrollIntent(...e){t.scroll.call(t,...e)},scrollByIntent(...e){t.scrollBy.call(t,...e)},scrollIntoViewIntent(...e){t.scrollIntoView.call(t,...e)},scrollToIntent(...e){t.scrollTo.call(t,...e)},get scrollTopIntent(){return t.scrollTop},set scrollTopIntent(e){t.scrollTop=e},get scrollLeftIntent(){return t.scrollLeft},set scrollLeftIntent(e){t.scrollLeft=e},get scrollHeightIntent(){return t.scrollHeight},get scrollWidthIntent(){return t.scrollWidth},addScrollListener(...e){t.addEventListener("scroll",...e)},removeScrollListener(...e){t.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(n,f,d),e.createElement(u,z({positionRef:d,scrollAreaRef:f},s,{ref:n}),e.createElement(J.Provider,{value:c},l))}));const ee=e.forwardRef((function(t,r){const n=Y(Y({},D),t),{children:o}=n,i=B(n,["children"]),l=e.useRef(null),s=e.useRef(null);return e.createElement(oe,z({positionRef:l,scrollAreaRef:s},i,{ref:r}),e.createElement(J.Provider,{value:!1},o))})),te=e.forwardRef((function(t,r){const o=Y(Y({},D),t),{overflowX:i,overflowY:l,scrollbarVisibility:s,scrollbarVisibilityRestTimeout:a,trackClickBehavior:u,unstable_prefersReducedMotion:d,scrollAreaRef:f,positionRef:S}=o,h=B(o,["overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"]),m=p(f,r);return e.createElement(c,z({selector:n("ScrollArea")},h,{ref:m,style:Y(Y({},h.style),{},{overflowX:i,overflowY:l,resize:"none"})}))})),re={width:0,height:0},ne={state:H.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:re,viewport:re,position:re,scrollbarY:re,scrollbarX:re,trackY:re,trackX:re}},oe=e.forwardRef((function(t,r){const o=Y(Y({},D),t),{children:i,onScroll:l,overflowX:s,overflowY:u,scrollbarVisibility:S,scrollbarVisibilityRestTimeout:h,trackClickBehavior:b,unstable_prefersReducedMotion:v,positionRef:R,scrollAreaRef:w}=o,g=B(o,["children","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),x=f(l),y=e.useRef(null),E=e.useRef(null),A=e.useRef(null),P=e.useRef(null),T=e.useRef(null),O=e.useRef(null),C=e.useRef(null),L=e.useRef(null),I=e.useRef(null),_=e.useRef(null),X=e.useRef(null),V=e.useMemo((()=>({buttonDownRef:y,buttonLeftRef:E,buttonRightRef:A,buttonUpRef:P,viewportRef:T,positionRef:R,scrollAreaRef:w,scrollbarXRef:O,scrollbarYRef:C,thumbXRef:L,thumbYRef:I,trackXRef:_,trackYRef:X})),[]),H=m(w),M=null!=v?v:H,[W,N]=e.useReducer(fe,Y(Y({},ne),{},{scrollbarIsVisibleX:"always"===S,scrollbarIsVisibleY:"always"===S})),{hoverProps:{onPointerEnter:F,onPointerLeave:G},isHovered:J}=k(),K=e.useMemo((()=>({dir:t.dir,isHovered:J,onScroll:x,overflowX:s,overflowY:u,prefersReducedMotion:M,scrollbarVisibility:S,scrollbarVisibilityRestTimeout:h,trackClickBehavior:b})),[t.dir,x,J,s,u,M,S,h,b]),$=p(r,w);pe(w,((e,t)=>{const{ownerWindow:r}=d(w),n=r.getComputedStyle(t);N({type:j.HandleScrollAreaResize,scrollAreaComputedStyle:n,width:e.inlineSize,height:e.blockSize})}));const ee="always"===S&&("scroll"===s||"auto"===s&&W.contentIsOverflowingX),te="always"===S&&("scroll"===u||"auto"===u&&W.contentIsOverflowingY),{domSizes:re}=W,oe={[SCROLL_AREA_CSS_PROPS.scrollbarXOffset]:ee&&re.scrollbarX.height?re.scrollbarX.height+"px":0,[SCROLL_AREA_CSS_PROPS.scrollbarYOffset]:te&&re.scrollbarY.width?re.scrollbarY.width+"px":0,[SCROLL_AREA_CSS_PROPS.positionWidth]:re.position.width?re.position.width+"px":"auto",[SCROLL_AREA_CSS_PROPS.positionHeight]:re.position.height?re.position.height+"px":"auto"};return e.createElement(Z.Provider,{value:N},e.createElement(q.Provider,{value:V},e.createElement(Q.Provider,{value:K},e.createElement(U.Provider,{value:W},e.createElement(c,z({selector:n("ScrollArea")},g,{ref:$,style:Y(Y({},g.style),oe),onPointerEnter:a(t.onPointerEnter,F),onPointerLeave:a(t.onPointerLeave,G)}),i)))))})),ie="ScrollAreaViewport",le=e.forwardRef((function(t,r){const{selector:i=n(ie)}=t,l=B(t,["selector"]),{positionRef:s,thumbXRef:u,thumbYRef:d,trackXRef:f,trackYRef:S,viewportRef:m}=N(ie),{onScroll:b,overflowX:v,overflowY:R,scrollbarVisibility:w}=F(ie),g=G(),x=$(ie),y=p(r,m);pe(m,(e=>{x({type:j.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const E=e.useCallback((function(){const e=s.current,t=u.current,r=d.current,n=f.current,o=S.current;t&&n&&e&&qe({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&o&&e&&qe({thumbElement:r,trackElement:o,axis:"y",positionElement:e})}),[s,u,d,f,S]),A=e.useRef(0),P=e.useRef(0);const T=a(b,(function(){s.current&&(E(),function(){if(!s.current)return;const e=s.current.scrollTop,t=s.current.scrollLeft,r=e!==A.current,n=t!==P.current;r===g.scrollbarIsVisibleY&&n===g.scrollbarIsVisibleX||x({type:j.SetScrollbarIsVisible,scrollbarVisibility:w,x:n,y:r}),A.current=e<=0?0:e,P.current=t<=0?0:t}())}));return h((()=>{E()}),[E]),h((function(){const e=s.current;if(!e)return;const t=We(e,{axis:"x"}),r=We(e,{axis:"y"});t===g.contentIsOverflowingX&&r===g.contentIsOverflowingY||x({type:j.SetContentOverflowing,x:t,y:r})}),[g.contentIsOverflowingX,g.contentIsOverflowingY,x,s,g.domSizes.position.height,g.domSizes.position.width,g.domSizes.viewport.height,g.domSizes.viewport.width]),e.createElement("div",z({},i?o(i+"-position"):void 0,{ref:s,onScroll:T,style:{zIndex:1,width:"var(".concat(SCROLL_AREA_CSS_PROPS.positionWidth,")"),height:"var(".concat(SCROLL_AREA_CSS_PROPS.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:v,overflowY:R}}),e.createElement("div",z({},i?o(i+"-position-inner"):void 0,{style:{display:"table",width:"100%",paddingBottom:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarXOffset,")"),paddingRight:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarYOffset,")")}}),e.createElement(c,z({selector:i},l,{ref:y}))))}));export const ScrollAreaViewport=e.forwardRef((function(t,r){return K()?e.createElement(c,z({selector:n(ie)},t,{ref:r})):e.createElement(le,z({},t,{ref:r}))}));ScrollAreaViewport.displayName=ie;const[se,ce]=u("ScrollbarContext","ScrollAreaScrollbar"),ae=e.forwardRef((function(t,r){var n;const{axis:o,name:i,onWheel:l,onPointerDown:s,onPointerUp:u,onPointerMove:d}=t,f=B(t,["axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),h=$(i),{scrollbarVisibility:m,scrollbarVisibilityRestTimeout:b,isHovered:v}=F(i),{["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"]:R,["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:w}=G(),g=N(i),{positionRef:x}=g,y=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,g),E=p(y,r),A=S((()=>new O));pe(y,(e=>{h({type:j.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));const P=a(l,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);x.current&&(t>0&&t>r&&(x.current.scrollLeft+=e.deltaX),r>0&&r>t&&(x.current.scrollTop+=e.deltaY))})),T=e.useRef();function C(){clearTimeout(T.current),T.current=setTimeout((()=>{h({type:j.SetScrollbarIsVisible,scrollbarVisibility:m,[o]:!1})}),b)}e.useEffect((()=>{if(w)return T.current=setTimeout((()=>{h({type:j.SetScrollbarIsVisible,scrollbarVisibility:m,[o]:!1})}),b),function(){clearTimeout(T.current)}}),[o,h,w,m,b]);const L=e.useRef(!1),I=a(s,(e=>{L.current=!0,clearTimeout(T.current)})),_=a(u,(e=>{L.current=!1,C()})),k=a(d,(e=>{L.current||C()})),X=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.opacity)||1;switch(m){case"always":return null===(t=f.style)||void 0===t?void 0:t.opacity;case"scroll":return w?r:0;case"hover":return v||w?r:0}}(),V=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(m){case"always":return null===(t=f.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return w?r:"none";case"hover":return v||w?r:"none"}}(),H=e.useMemo((()=>({axis:o,scrollAnimationQueue:A})),[o,A]);return e.createElement(se.Provider,{value:H},e.createElement(c,z({},f,{ref:E,style:Y(Y({},f.style),{},{display:R?null===(n=f.style)||void 0===n?void 0:n.display:"none",opacity:X,pointerEvents:V}),onPointerDown:I,onPointerUp:_,onPointerMove:k,onWheel:P})))}));export const ScrollAreaScrollbarX=e.forwardRef((function(t,r){const{domSizes:o}=G();return K()?null:e.createElement(ae,z({selector:n("ScrollAreaScrollbarX")},t,{ref:r,axis:"x",name:"ScrollAreaScrollbarX",style:Y(Y({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarXSize]:o.scrollbarX.height?o.scrollbarX.height+"px":0})}))}));ScrollAreaScrollbarX.displayName="ScrollAreaScrollbarX";export const ScrollAreaScrollbarY=e.forwardRef((function(t,r){const{domSizes:o}=G();return K()?null:e.createElement(ae,z({selector:n("ScrollAreaScrollbarY")},t,{ref:r,axis:"y",name:"ScrollAreaScrollbarY",style:Y(Y({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarYSize]:o.scrollbarY.width?o.scrollbarY.width+"px":0})}))}));ScrollAreaScrollbarY.displayName="ScrollAreaScrollbarY";export const ScrollAreaTrack=e.forwardRef((function(t,o){const{onPointerDown:i}=t,s=B(t,["onPointerDown"]),{axis:u,scrollAnimationQueue:S}=ce("ScrollAreaTrack"),h=$("ScrollAreaTrack"),m=N("ScrollAreaTrack"),{trackClickBehavior:b,prefersReducedMotion:v}=F("ScrollAreaTrack"),{positionRef:R}=m,w=ve(u,m),g=be(u,m),x=p(w,o),y=f(i);pe(w,(e=>{h({type:j.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:u})}));const A=e.useRef();return e.useEffect((()=>{let e=null,t=null;const n=we(w),o=ge(g),i=xe(R),{ownerDocument:s}=d(R),c=a(y,(function(c){if(!l(c)||c.target===o||o.contains(c.target))return;const a=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=Ie(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:c,axis:u,thumbElement:o});if(clearTimeout(t),"page"===b){if(h({type:j.StartTracking}),s.addEventListener("pointermove",f),s.addEventListener("pointerup",p),n.setPointerCapture(c.pointerId),v){const e=Ee({direction:a,positionElement:i,axis:u}),t=He(i,{direction:a,distance:e,axis:u});Te(i,{axis:u,value:t})}else S.enqueue((()=>Se({duration:200,timing:E(.16,0,.73,1),draw:he({positionElement:i,direction:a,axis:u}),rafIdRef:A})));return e=setTimeout((()=>{const t=Ie(c),o=ye({axis:u,direction:a,pointerPosition:t,positionElement:i,trackElement:n});if(!("start"===a&&o>0||"end"===a&&o<0)){if(v){const e=He(i,{direction:a,distance:o,axis:u});Te(i,{axis:u,value:e})}else{const e=Math.round(Math.abs(o)),l=r(e,[100,500]);S.enqueue((()=>Se({duration:l,timing:e=>e,draw:me({axis:u,direction:a,pointerPosition:t,positionElement:i,trackElement:n}),rafIdRef:A})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=Ie(c),t=ye({axis:u,direction:a,pointerPosition:e,positionElement:i,trackElement:n}),r=He(i,{direction:a,distance:t,axis:u});Te(i,{axis:u,value:r});const l=new PointerEvent("pointerdown",c);requestAnimationFrame((()=>{o.dispatchEvent(l)}))}}));return n.addEventListener("pointerdown",c),function(){cancelAnimationFrame(A.current),clearTimeout(e),clearTimeout(t),n.removeEventListener("pointerdown",c),s.removeEventListener("pointermove",f),s.removeEventListener("pointerup",p),h({type:j.StopTracking}),S.stop()};function f(t){"mouse"===t.pointerType&&je(t,n)&&(clearTimeout(e),s.removeEventListener("pointermove",f),S.stop())}function p(r){n.releasePointerCapture(r.pointerId),clearTimeout(e),s.removeEventListener("pointermove",f),s.removeEventListener("pointerup",p),S.stop(),h({type:j.StopTracking}),t=setTimeout((()=>{S.stop()}),200)}}),[u,v,b,h,y,R,S,g,w]),e.createElement(c,z({selector:n("ScrollAreaTrack")},s,{ref:x,"data-axis":u}))}));ScrollAreaTrack.displayName="ScrollAreaTrack";export const ScrollAreaThumb=e.forwardRef((function(t,r){const{onPointerDown:o}=t,i=B(t,["onPointerDown"]),{axis:s}=ce("ScrollAreaThumb"),u=N("ScrollAreaThumb"),S=$("ScrollAreaThumb"),{positionRef:m}=u,b=be(s,u),v=ve(s,u),R=p(b,r),w=G(),g=f(o),x=e.useRef(0),y=e.useRef(0),E=e.useRef({size:0,positionStart:0}),A=e.useRef({size:0,positionStart:0}),P=e.useRef(!1);h((()=>{if(!P.current)return void(P.current=!0);qe({thumbElement:ge(b),trackElement:we(v),positionElement:xe(m),axis:s})}),[b,v,m,s,...Me(w.domSizes)]);const T="x"===s?w.domSizes.trackX.width:w.domSizes.trackY.height,O=e.useRef(T);h((()=>{O.current=T})),e.useEffect((()=>{const e=ge(b),t=we(v),r=xe(m),{ownerDocument:n}=d(m),o=a(g,(function(r){if(!l(r))return;const o=Ie(r)[s];E.current=Le(e,{axis:s}),A.current=Le(t,{axis:s}),y.current=o,x.current=o,e.setPointerCapture(r.pointerId),n.addEventListener("pointerup",u),n.addEventListener("pointermove",c),S({type:j.StartThumbing})}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),i()};function i(){n.removeEventListener("pointermove",c),n.removeEventListener("pointerup",u),S({type:j.StopThumbing})}function c(e){const t=Ie(e)[s],n=t-y.current,o=O.current;if(De(r,{axis:s,delta:n})){const{positionStart:e}=A.current,{positionStart:n}=E.current,i=x.current-n,l=Math.round(t-e),c=Math.round((l-i)/o*100)/100,a=Ce(r,{axis:s});Te(r,{axis:s,value:c*a}),y.current=t,S({type:j.StartThumbing})}}function u(t){e.releasePointerCapture(t.pointerId),i()}}),[s,g,S,m,u,b,v]);const[C,L]=e.useState({});return h((()=>{const e=m.current,t=v.current;L(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=Ae(r,{axis:n}),i=Oe(t,{axis:n}),l=o*i;if(!We(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:l}}({positionElement:e,trackElement:t,axis:s}))}),[s,m,v,...Me(w.domSizes)]),e.createElement(c,z({selector:n("ScrollAreaThumb")},i,{ref:R,"data-axis":s,style:Y(Y(Y({},i.style),C),"x"===s?{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"left",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"100%",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"auto"}:{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"top",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"auto",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"100%"})}))}));ScrollAreaThumb.displayName="ScrollAreaThumb";const ue=e.forwardRef((function(t,r){const{direction:n,name:o,onPointerDown:i}=t,s=B(t,["direction","name","onPointerDown"]),{axis:u,scrollAnimationQueue:S}=ce(o),h=$(o),m=N(o),{prefersReducedMotion:b}=F(o),{positionRef:v}=m,R=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(n,u,m),w=p(R,r),g=e.useRef(),x=f(i);return e.useEffect((()=>{const e=function(e,t){const r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return Re(e,"A ref for ".concat(r," was not placed as expected. ").concat(r," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}(R,n),t=xe(v),{ownerDocument:r}=d(v);let o,i=null;const s=a(x,(function(s){if(!l(s))return;e.setPointerCapture(s.pointerId),r.addEventListener("pointerup",f),r.addEventListener("pointermove",c),h({type:j.StartButtonPress});const a="start"===n?-1:1;b?_e(t,{axis:u,value:51*a}):De(t,{axis:u,delta:a})&&S.enqueue((()=>Se({duration:135,timing:E(.16,0,.73,1),draw(e){_e(t,{axis:u,value:15*e*a})},rafIdRef:g}))),o=setTimeout((()=>{if(b)i=setInterval((()=>{De(t,{axis:u,delta:a})?_e(t,{axis:u,value:60*a}):clearInterval(i)}),135);else{const r=s.pointerId;!function n(){De(t,{axis:u,delta:a})&&S.enqueue((()=>Se({duration:135,timing:e=>e,draw(e){_e(t,{axis:u,value:e*(15*a)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:g})))}()}clearTimeout(o)}),400)}));return e.addEventListener("pointerdown",s),function(){e.removeEventListener("pointerdown",s),r.removeEventListener("pointerup",f),r.removeEventListener("pointermove",c),clearTimeout(o),clearInterval(i),cancelAnimationFrame(g.current),h({type:j.StopButtonPress})};function c(t){"mouse"===t.pointerType&&je(t,e)&&(clearTimeout(o),r.removeEventListener("pointermove",c))}function f(t){clearTimeout(o),clearInterval(i),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",f),h({type:j.StopButtonPress})}}),[u,n,b,R,h,x,S,v]),e.createElement(c,z({},s,{ref:w,"data-axis":u}))}));export const ScrollAreaButtonStart=e.forwardRef((function(t,r){return e.createElement(ue,z({selector:n("ScrollAreaButtonStart")},t,{ref:r,name:"ScrollAreaButtonStart",direction:"start"}))}));ScrollAreaButtonStart.displayName="ScrollAreaButtonStart";export const ScrollAreaButtonEnd=e.forwardRef((function(t,r){return e.createElement(ue,z({selector:n("ScrollAreaButtonEnd")},t,{ref:r,name:"ScrollAreaButtonEnd",direction:"end"}))}));ScrollAreaButtonEnd.displayName="ScrollAreaButtonEnd";const de=e.forwardRef((function(t,r){const{positionRef:o}=N("ScrollAreaCorner"),i=$("ScrollAreaCorner"),{dir:l}=F("ScrollAreaCorner"),{domSizes:s}=G(),a="rtl"===l,u={[SCROLL_AREA_CSS_PROPS.cornerLeft]:a?0:"unset",[SCROLL_AREA_CSS_PROPS.cornerRight]:a?"unset":0,[SCROLL_AREA_CSS_PROPS.cornerHeight]:s.scrollbarX.height?s.scrollbarX.height+"px":s.scrollbarY.width?s.scrollbarY.width+"px":"16px",[SCROLL_AREA_CSS_PROPS.cornerWidth]:s.scrollbarY.width?s.scrollbarY.width+"px":s.scrollbarX.height?s.scrollbarX.height+"px":"16px",position:"absolute"};return h((()=>{if(o.current){const{ownerWindow:e}=d(o),t=e.getComputedStyle(o.current);i({type:j.SetExplicitResize,value:t.resize})}}),[i,o]),e.createElement(c,z({selector:n("ScrollAreaCorner")},t,{ref:r,style:Y(Y({},t.style),u)}))}));export const ScrollAreaCorner=e.forwardRef((function(t,r){return K()?null:e.createElement(de,z({},t,{ref:r}))}));ScrollAreaCorner.displayName="ScrollAreaCorner";export const Root=ScrollArea;export const Viewport=ScrollAreaViewport;export const ScrollbarX=ScrollAreaScrollbarX;export const ScrollbarY=ScrollAreaScrollbarY;export const ButtonStart=ScrollAreaButtonStart;export const ButtonEnd=ScrollAreaButtonEnd;export const Track=ScrollAreaTrack;export const Thumb=ScrollAreaThumb;export const Corner=ScrollAreaCorner;export const unstable_ScrollAreaNoNativeFallback=ee;function fe(e,t){switch(t.type){case j.SetExplicitResize:return Y(Y({},e),{},{explicitResize:t.value});case j.HandleScrollAreaResize:{const r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),l=parseInt(r.borderLeftWidth),s=parseInt(r.paddingTop),c=parseInt(r.paddingRight),a=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{scrollArea:{width:t.width,height:t.height},position:{width:t.width-l-o-u-c,height:t.height-n-i-s-a}})})}case j.SetContentOverflowing:return Y(Y({},e),{},{contentIsOverflowingX:t.x,contentIsOverflowingY:t.y});case j.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?Y(Y({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):Y(Y({},e),{},{scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY});case j.HandleViewportResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{viewport:{width:t.width,height:t.height}})});case j.HandleScrollbarResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}})});case j.HandleTrackResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}})});case j.StartTracking:return Y(Y({},e),{},{state:H.Tracking});case j.StopTracking:return Y(Y({},e),{},{state:H.Idle});case j.StartThumbing:return Y(Y({},e),{},{state:H.Thumbing});case j.StopThumbing:return Y(Y({},e),{},{state:H.Idle});case j.StartButtonPress:return Y(Y({},e),{},{state:H.ButtonScrolling});case j.StopButtonPress:return Y(Y({},e),{},{state:H.Idle})}return e}function pe(e,t){const r=f(t);h((()=>{var t;const n=e.current;if(!n)return;const o=new ResizeObserver((([e])=>{const t=i(e);r(t,e.target)})),l=n.getBoundingClientRect();return r({inlineSize:l.width,blockSize:l.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}),[r,e])}function Se({duration:e,draw:t,timing:n,done:o,rafIdRef:i}){return new Promise((l=>{let s=performance.now(),c=!1;i.current=requestAnimationFrame((function a(u){s=u<s?u:s;const d=r((u-s)/e,[0,1]);t(n(d)),d<1?!c&&(i.current=requestAnimationFrame(a)):(c=!0,cancelAnimationFrame(i.current),l("done"),o&&o())}))}))}function he({axis:e,direction:t,positionElement:r}){let n=Ee({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),l=He(r,{direction:t,distance:i,axis:e});n-=i,Te(r,{axis:e,value:l})}}function me({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=ye({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o});return function(r){const o=Math.pow(10,3),l=Math.round(i*Math.min(r,1)*o)/o,s=He(n,{direction:t,distance:l,axis:e});i-=l,Te(n,{axis:e,value:s})}}function be(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function ve(e,t){return"x"===e?t.trackXRef:t.trackYRef}function Re(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function we(e){return Re(e,"A ref for ".concat("ScrollAreaTrack"," was not placed as expected. ").concat("ScrollAreaTrack"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function ge(e){return Re(e,"A ref for ".concat("ScrollAreaThumb"," was not placed as expected. ").concat("ScrollAreaThumb"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function xe(e){return Re(e,"A ref for an internal component in ".concat(ie," was not placed as expected. ").concat(ie," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function ye({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=Pe(n,{axis:e}),l=Ce(n,{axis:e}),s=Oe(n,{axis:e}),{positionStart:c,size:a}=Le(o,{axis:e}),u=Math.round(r[e]-c),d=Math.round(u/a*100)/100,f="start"===t?d*l:d*l-s;return f<i?f-i-s/2:f-i+s/2}function Ee({axis:e,direction:t,positionElement:r}){return(Oe(r,{axis:e})-40)*("end"===t?1:-1)}function Ae(e,{axis:t}){const r=Ce(e,{axis:t});return Oe(e,{axis:t})/r}function Pe(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function Te(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function Oe(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function Ce(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function Le(e,{axis:t}){const{[t]:r,["y"===t?"top":"left"]:n,["y"===t?"bottom":"right"]:o,["y"===t?"height":"width"]:i}=e.getBoundingClientRect();return{coord:r,positionStart:n,positionEnd:o,size:i}}function Ie(e){return{x:e.clientX,y:e.clientY}}function _e(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function ke(e){return!(!e||0!==e.scrollTop)}function ze(e){return!(!e||e.scrollLeft!==Be(e))}function Xe(e){return!(!e||e.scrollTop!==Ve(e))}function Ye(e){return!(!e||0!==e.scrollLeft)}function Ve(e){return e.scrollHeight-e.clientHeight}function Be(e){return e.scrollWidth-e.clientWidth}function He(e,{direction:t,distance:r,axis:n}){const{["x"===n?"scrollLeft":"scrollTop"]:o}=e,i=o+r,l="end"===t?function(e,t){return"x"===t?Be(e):Ve(e)}(e,n):0;return"end"===t?Math.min(l,i):Math.max(l,i)}function Me(e){const t=[];for(const r of Object.keys(e)){const n=e[r];t.push(n.height,n.width)}return t}function je(e,t,r){r=r||t.getBoundingClientRect();const n=Ie(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function We(e,{axis:t}){return Ae(e,{axis:t})<1}function De(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?Ye:ke)(e)||r>0&&("x"===t?ze:Xe)(e))}function qe(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=Ce(r,{axis:n}),i=Oe(r,{axis:n}),l=Pe(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left="".concat(100*l,"%"):"y"===n&&(t.style.top="".concat(100*l,"%")))} | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-scroll-area", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "MIT", | ||
@@ -21,9 +21,9 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@radix-ui/react-polymorphic": "0.0.1", | ||
"@radix-ui/react-utils": "0.0.1", | ||
"@radix-ui/utils": "0.0.1" | ||
"@radix-ui/react-polymorphic": "0.0.2", | ||
"@radix-ui/react-primitive": "0.0.1", | ||
"@radix-ui/react-utils": "0.0.2", | ||
"@radix-ui/utils": "0.0.2" | ||
}, | ||
"devDependencies": { | ||
"@stitches/react": "canary", | ||
"parcel": "^2.0.0-beta.1" | ||
"@stitches/react": "canary" | ||
}, | ||
@@ -30,0 +30,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
359532
1
334
5
1
+ Added@radix-ui/react-polymorphic@0.0.2(transitive)
+ Added@radix-ui/react-primitive@0.0.1(transitive)
+ Added@radix-ui/react-utils@0.0.2(transitive)
+ Added@radix-ui/utils@0.0.2(transitive)
- Removed@radix-ui/react-polymorphic@0.0.1(transitive)
- Removed@radix-ui/react-utils@0.0.1(transitive)
- Removed@radix-ui/utils@0.0.1(transitive)
Updated@radix-ui/react-utils@0.0.2
Updated@radix-ui/utils@0.0.2