"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../../Checkbox/Checkbox.js"),l=require("../../../components/Table/TableCell/TableCell.js"),i=require("@material-ui/core"),s=require("./TableSortLabel.js"),n=require("./helpers/sortPads.js"),o=require("./helpers/columns.js"),c=require("./PadsTableHead.scss.js"),a=r.memo((function(a){var d=a.handleSelectPads,u=a.allWellIds,h=a.selectedOffsetWellIds,C=a.setSortBy,S=a.setSortDirection,m=a.sortBy,b=a.sortDirection,j=r.useMemo((function(){return{padsIntermediate:(null==u?void 0:u.length)!==(null==h?void 0:h.length)&&!(null==h||!h.length),isAllPadsSelected:h.length===(null==u?void 0:u.length)}}),[u,h]),x=j.padsIntermediate,q=j.isAllPadsSelected,v=r.useCallback((function(e){C(e),S(e===m&&b===n.SortDirection.ASC?n.SortDirection.DESC:n.SortDirection.ASC)}),[C,S,m,b]);return e.jsx(i.TableRow,{children:o.COLUMNS.map((function(r,i){var a=r.title,u=r.sortBy;return e.jsx(l.TableCell,{className:c.headCell,style:{width:o.COLUMNS[i].width},children:e.jsxs("div",{className:c.cellContent,children:[!i&&e.jsx(t.Checkbox,{size:"medium",onChange:function(e){return d(e)},checked:q,indeterminate:x}),e.jsx(s,{title:"Sort",active:m===u,sortBy:u,direction:m===u&&b===n.SortDirection.DESC?"desc":"asc",onClick:v,children:a})]})},a)}))})}));module.exports=a;
//# sourceMappingURL=PadsTableHead.js.map
