"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/objectWithoutProperties"),i=require("react/jsx-runtime"),n=require("react"),l=require("react-virtualized"),o=require("classnames"),s=require("./hooks/useContainerMaxHeight.js"),u=require("./VirtualizedListBox.module.css.js"),a=require("../../../../../../componentsV2/Autocomplete/Autocomplete.scss.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(e),f=c(r),p=c(t),h=c(o),b=["children","className"];function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function m(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach((function(r){d.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var y=n.forwardRef((function(e,r){var t=e.children,o=e.className,c=p.default(e,b),d=n.useRef(null),v=n.useState(!1),y=f.default(v,2),j=y[0],O=y[1],x=n.useState(null),g=f.default(x,2),w=g[0],P=g[1],q=s.useContainerMaxHeight(w),C=n.Children.toArray(t),N=C.length>0&&function(e){var r,t,i,l=null===(r=e.props)||void 0===r?void 0:r.children;if(!n.isValidElement(l))return!1;var o=null===(t=l.props)||void 0===t?void 0:t.children;if(!n.isValidElement(o))return!1;var s=null===(i=o.props)||void 0===i?void 0:i.className;return"string"==typeof s&&s.includes("sticky")}(C[0])?C[0]:null,S=N?C.slice(1):C,V=S.length,k=36*Math.min(V,16),z=q-(N?36:0),M=Math.min(k,Math.max(z,36)),A=function(e){var r=e.index,t=e.key,l=e.style,o=S[r];return n.isValidElement(o)?i.jsx("div",{style:l,className:u.row,children:o},t):null},E=n.useCallback((function(e){var r=e.scrollTop;O(r>0)}),[]),L=n.useCallback((function(e){P(e),"function"==typeof r?r(e):r&&(r.current=e)}),[r]);return i.jsxs("div",m(m({ref:L,className:h.default(o,u.listBox,j&&a.listboxScrolled)},c),{},{children:[N,V>0&&i.jsx(l.AutoSizer,{disableHeight:!0,children:function(e){var r=e.width;return i.jsx(l.List,{ref:d,width:r,height:M,rowCount:V,rowHeight:36,rowRenderer:A,overscanRowCount:5,onScroll:E,className:u.virtualizedList})}})]}))}));y.displayName="VirtualizedListBox",exports.VirtualizedListBox=y;
//# sourceMappingURL=VirtualizedListBox.js.map
