"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react/jsx-runtime"),l=require("react"),o=require("react-virtualized"),r=require("@material-ui/core"),n=require("../../../../constants.js"),i=require("../../../../stores/picker-props-store/usePickerPropsStore.js"),s=require("../../../../stores/view-store/useViewStore.js"),a=require("../SortableHeaderCell/SortableHeaderCell.js"),c=require("../WellNameHeaderCell/WellNameHeaderCell.js"),u=require("../MetricsHeaderCells/MetricsHeaderCells.js"),m=require("./OffsetWellsTableHead.module.css.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=d(e),p="OffsetWellsTableHead",C=l.memo((function(e){var d=e.columnsWithDict,C=e.metricsKeys,f=e.sortBy,S=e.sortDirection,W=e.indeterminate,b=e.isAllWellsSelected,h=e.onChangeSort,v=e.onUpdateMetricsKey,x=e.handleChangeAllOffsetWells,D=e.wellNameStyle,T=e.isImperial,j=e.isTaColumnVisible,H=e.isWellSectionColumnVisible,N=i.usePickerPropsStore((function(e){return e.open})),A=i.usePickerPropsStore((function(e){return e.isViewOnly})),k=s.useViewStore((function(e){return e.isWellNameExpand})),q=s.useViewStore((function(e){return e.toggleWellNameExpand})),g=l.useState(!1),w=y.default(g,2),K=w[0],O=w[1],_=null==d?void 0:d.some((function(e){return e.key===n.ColumnType.company})),B=null==d?void 0:d.some((function(e){return e.key===n.ColumnType.interventionAsset})),I=null==d?void 0:d.some((function(e){return e.key===n.ColumnType.padName})),M=null==d?void 0:d.some((function(e){return e.key===n.ColumnType.formation})),P=null==d?void 0:d.some((function(e){return e.key===n.ColumnType.rig})),V=null==d?void 0:d.some((function(e){return e.key===n.ColumnType.distance})),E=function(e){h(e,e===f&&S===o.SortDirection.ASC?o.SortDirection.DESC:o.SortDirection.ASC)};if(!d)return null;var L=d.find((function(e){return e.key===n.ColumnType.taScore})),R=d.find((function(e){return e.key===n.ColumnType.wellSection}));return t.jsxs(r.TableRow,{className:m.tableRow,children:[t.jsx(c.WellNameHeaderCell,{columnsWithDict:d,sortBy:f,sortDirection:S,indeterminate:W,isAllWellsSelected:b,handleChangeAllOffsetWells:x,wellNameStyle:D,isViewOnly:A,open:N,isWellNameExpand:k,toggleWellNameExpand:q,onSort:E}),_&&t.jsx(a.SortableHeaderCell,{testId:"".concat(p,"_company"),columnKey:n.ColumnType.company,label:"Company",columnsWithDict:d,sortBy:f,sortDirection:S,onSort:E}),B&&t.jsx(a.SortableHeaderCell,{testId:"".concat(p,"_interventionAsset"),columnKey:n.ColumnType.interventionAsset,label:"Intervention Asset",columnsWithDict:d,sortBy:f,sortDirection:S,onSort:E}),I&&t.jsx(a.SortableHeaderCell,{testId:"".concat(p,"_padName"),columnKey:n.ColumnType.padName,label:"Pad",columnsWithDict:d,sortBy:f,sortDirection:S,onSort:E}),M&&t.jsx(a.SortableHeaderCell,{testId:"".concat(p,"_formation"),columnKey:n.ColumnType.formation,label:"Formation",columnsWithDict:d,sortBy:f,sortDirection:S,onSort:E}),P&&t.jsx(a.SortableHeaderCell,{testId:"".concat(p,"_rig"),columnKey:n.ColumnType.rig,label:"Rig",columnsWithDict:d,sortBy:f,sortDirection:S,onSort:E}),V&&t.jsx(a.SortableHeaderCell,{testId:"".concat(p,"_distance"),columnKey:n.ColumnType.distance,label:"Distance (".concat(T?"miles":"km",")"),columnsWithDict:d,sortBy:f,sortDirection:S,onSort:E}),j&&t.jsx(r.TableCell,{"data-testid":"".concat(p,"_ta"),className:m.headCell,style:{minWidth:(null==L?void 0:L.minWidth)||0,flex:(null==L?void 0:L.flex)||0},children:t.jsx("div",{className:m.nameWrapper,children:"TA %"})}),t.jsx(a.SortableHeaderCell,{testId:"".concat(p,"_LastActive"),columnKey:n.ColumnType.lastActive,label:"Last Active",columnsWithDict:d,sortBy:f,sortDirection:S,onSort:E}),t.jsx(u.MetricsHeaderCells,{columnsWithDict:d,metricsKeys:C,sortBy:f,sortDirection:S,isMetricsMenuOpen:K,onSort:E,onUpdateMetricsKey:v,setIsMetricsMenuOpen:O}),H&&t.jsx(r.TableCell,{"data-testid":"".concat(p,"_WellSection"),className:m.headCell,style:{minWidth:(null==R?void 0:R.minWidth)||0,flex:(null==R?void 0:R.flex)||0},children:t.jsx("span",{className:m.headerLabel,children:"Well Section"})})]})}));C.displayName="OffsetWellsTableHead",exports.OffsetWellsTableHead=C;
//# sourceMappingURL=OffsetWellsTableHead.js.map
