import e from"@babel/runtime/helpers/defineProperty";import t from"prop-types";import i from"classnames";import{get as n}from"lodash";import a from"../CasingTileIcon.js";import{useStyles as l}from"./style.js";import{COMPONENT_FAMILIES as o}from"../../../constants/casing.js";import{convertValue as s,getUnitPreference as r,getUnitDisplay as c}from"../../../utils/index.js";import{jsxs as m,jsx as d}from"react/jsx-runtime";var p=[{key:"tv",label:"Total Volume"},{key:"tpt",label:"Total Pumping Time"},{key:"lt",label:"Lead TOC"},{key:"tt",label:"Tail TOC"}];function h(t){var h=t.tileData,u=t.onSelect,f=t.isMobile,b=t.isMetricsHidden,v=l({isMobile:f}),g=n(h,["data","components"])||[],C=function(e){var t=[],i=o.map((function(e){return e.type}));return e.forEach((function(e){var n=e.family;i.includes(n)&&t.push({family:n})})),t.slice(-8)}(g),N=s(n(h,["data","outer_diameter"]),"shortLength","in");return m("div",{className:v.tileContainer,onClick:function(){return u(h)},children:[m("div",{className:v.header,children:[d("div",{className:v.casingTitle,children:m("span",{className:v.bhaCaption,children:[N,"in"===r("shortLength")?'"':c("shortLength")," Casing"]})}),m("div",{className:v.componentsCount,children:["Components: ",g.length]})]}),g.length>0&&d("div",{className:i(v.schematic,e({},v.schematicMobile,f)),children:C.map((function(e,t){return d(a,{component:e,width:"calc(100% / ".concat(C.length," - 1px)")},"casing-tile-".concat(t))}))}),!b&&!f&&g.length>0&&d("div",{className:v.metricsContainer,children:p.map((function(e,t){return m("div",{className:v.metricItem,children:[m("div",{className:v.metricItemContent,children:[d("div",{className:v.metricItemLabel,children:e.label}),d("div",{className:v.metricItemValue,children:"0.0"})]}),t!==p.length-1&&d("div",{className:v.metricItemSplit})]},e.key)}))}),0===g.length&&d("div",{className:i(v.noComponents,e({},v.noComponentsMobile,f)),children:"No Components"})]})}h.propTypes={tileData:t.shape({}),onSelect:t.func.isRequired,isMobile:t.bool,isMetricsHidden:t.bool},h.defaultProps={tileData:{},isMobile:!1,isMetricsHidden:!0};export{h as default};
