import e from"@babel/runtime/helpers/defineProperty";import{jsxs as l,jsx as t}from"react/jsx-runtime";import{useMemo as i,useCallback as s}from"react";import r from"classnames";import{Table as n,TableHead as o}from"@material-ui/core";import{getIsImperial as a}from"../../utils/getIsImperial.js";import{Filter as c}from"../Filter/Filter.js";import"../Filter/components/MultiFilterSelect/MultiFilterSelect.js";import"../Filter/components/SingleFilterSelect/SingleFilterSelect.js";import"../Filter/components/StatusFilterSelect/StatusFilterSelect.js";import"../Filter/components/PeriodFilterSelect/PeriodFilterSelect.js";import"../Filter/components/WellSectionSelect/WellSectionSelect.js";import{OffsetWellsTable as d}from"../OffsetWellsTable/OffsetWellsTable.js";import{OffsetWellsTableHead as m}from"../OffsetWellsTable/components/OffsetWellsTableHead/OffsetWellsTableHead.js";import{AdvancedSearch as f}from"../OffsetWellsTable/AdvancedSearch/AdvancedSearch.js";import W from"../OffsetWellsTable/OffsetWellsTable.module.css.js";import u from"../../OffsetWellPickerV5.module.css.js";var p=function(p){var S=p.isMobile,h=p.isViewOnly,b=p.isFilterExpanded,g=p.isVScrollMoved,O=p.isTableFullLoading,v=p.isLimitedOffsetWells,C=p.isWellSectionColumnVisible,F=p.isAllWellsSelected,j=p.indeterminate,A=p.subjectWellId,I=p.selectedWellIds,y=p.selectedWellSection,T=p.sortedWells,w=p.tableWells,N=p.tableRowsCount,R=p.wellSections,x=p.metricsKeys,M=p.setMetricsKeys,V=p.columnsWithDict,D=p.taScores,L=p.filterOptions,H=p.loadingWellIds,K=p.loadingAssetIds,k=p.filters,G=p.sortBy,P=p.setSortBy,B=p.sortDirection,E=p.setSortDirection,U=p.maxOffsetWellNumber,q=p.handleChangeOffsetWell,z=p.handleChangeAllOffsetWells,J=p.handleChangeWellSection,Q=p.handleAddRemoveAssets,X=p.handleScroll,Y=p.setActiveWellId,Z=p.setIsAdvancedSearchHidden,$=p.wellsMapRef,_=p.headTableRef,ee=p.rightColumnRef,le=p.isAnimatingRef,te=i((function(){return a()}),[]),ie=s((function(){Z(!0)}),[Z]),se=s((function(e,l){M((function(t){return t.map((function(t){return t===e?l:t}))}))}),[M]),re=s((function(e,l){P(e),E(l)}),[P,E]);return l("div",{className:u.rightColumn,ref:ee,onScroll:X,children:[!S&&t(c,{isHidden:!b,filterOptions:L,wellSections:null!=R?R:[],selectedWellSection:y,onChangeExternalOffsets:J}),t("div",{className:W.stickyTableWrapper,children:l(n,{"aria-label":"ows table head",innerRef:_,className:W.stickyTable,children:[t(o,{children:t(m,{columnsWithDict:V,metricsKeys:x,sortBy:G,sortDirection:B,indeterminate:j,isAllWellsSelected:F,onChangeSort:re,onUpdateMetricsKey:se,handleChangeAllOffsetWells:z,wellNameStyle:W.wellNameFixed,isImperial:te,isTaColumnVisible:!!D.length,isWellSectionColumnVisible:C})}),h&&t("div",{className:r(u.topGradient,e({},u.topGradientScrolled,g))})]})}),!h&&l("div",{className:r(W.searchCellWrapper),children:[t("div",{className:W.searchCell,children:t(f,{companyIds:null,subjectWellId:A,onChange:Q,selectedWellIds:I,onHideAdvancedSearch:ie,loadingAssetIds:K,filters:k,isLimitedOffsetWells:v})}),t("div",{className:r(u.topGradient,e({},u.topGradientScrolled,g))})]}),t(d,{isTableLoading:O,subjectWellId:A,columnsWithDict:V,wells:w,metricsKeys:x,handleChangeOffsetWell:q,isLastWell:null!=T&&T.length<=N,isLimitedOffsetWells:v,maxOffsetWellNumber:U,wellSections:R,setActiveWellId:Y,onRowClick:function(e){var l;return null===(l=$.current)||void 0===l?void 0:l.flyToWell(e)},taScores:D,isWellSectionColumnVisible:C,loadingWellIds:H,scrollContainerRef:ee,isAnimatingRef:le})]})};export{p as TableSection};
//# sourceMappingURL=TableSection.js.map
