"use strict";var e=require("@babel/runtime/helpers/defineProperty"),a=require("classnames"),s=require("prop-types"),r=require("@material-ui/core"),i=require("./ComparisonBar/ComparisonBar.js"),o=require("./ComparisonTable.css.js"),l=require("../../utils/convert.js"),t=require("../../utils/StageDesignVActualUtils.js"),n=require("../../constants/completion.js"),m=require("react/jsx-runtime");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(e),d=c(a),p=function(e){var a=e.rowKey,s=e.label,c=e.elemKey,p=e.unitType,h=e.elemMax,g=e.summaries,v=e.showBar,f=e.viewMode,j=r.useTheme(),C=g.designSummary,x=g.actualSummary,y=g.predictionSummary,N=C&&C[a],T=x&&x[a],b=y&&y[a],q=p?l.getUnitDisplay(p):"",w=t.getElemActualColor(a,c);(c&&(N=N&&N[c]&&N[c].amount,T=T&&T[c]&&T[c].amount),"volumeChemicals"===a||"massChemicals"===a)&&(b=y[(n.CHEMICALS_TYPES.find((function(e){return e.name===c}))||{}).key||null]);"flush_volume"===a&&(N=y?y.flush_volume_design:0);var S=b?(b-T)/b*100:"-",M="calc"===f?t.getDifference(N,b):t.getDifference(N,T);return m.jsxs("div",{className:d.default(o.comparisonRow,u.default({},o.comparisonRowLightTheme,j.isLightTheme)),children:[m.jsxs("div",{className:o.comparisonNameCol,children:[s," ",q?"(".concat(q,")"):""]}),m.jsxs("div",{className:o.comparisonDesignCol,children:[t.getFormattedValue(N),m.jsx("div",{className:o.comparisonSortIcon})]}),m.jsxs("div",{"data-testid":"".concat("comparisonRow","_strapsColumn"),className:o.comparisonActualCol,children:[t.getFormattedValue(T),m.jsx("div",{className:o.comparisonSortIcon})]}),m.jsxs("div",{className:o.comparisonActualCol,children:[t.getFormattedValue(b),m.jsx("div",{className:o.comparisonSortIcon})]}),m.jsx("div",{className:o.comparisonActualCol,children:t.getFormattedValue(S)}),m.jsx("div",{className:d.default(o.comparisonActualCol,u.default({},o.comparisonGreaterThanTenPercent,t.getIsGreaterThanTenPercent(M))),children:M}),v&&m.jsx("div",{className:o.comparisonChartCol,children:(Number.isFinite(T)||Number.isFinite(N))&&m.jsx(i,{designVal:N,actualVal:T,designColor:"#eee",actualColor:w,elemMax:h})})]},"".concat(a).concat(c))};p.propTypes={rowKey:s.string.isRequired,label:s.string,elemKey:s.string,unitType:s.string,elemMax:s.number,summaries:s.shape,showBar:s.bool,viewMode:s.string},p.defaultProps={label:"",elemKey:"",unitType:"",elemMax:null,summaries:{},showBar:!0,viewMode:null},module.exports=p;
