"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/toConsumableArray"),r=require("react"),i=require("classnames"),n=require("prop-types"),a=require("@material-ui/core"),s=require("@material-ui/icons/Add"),u=require("@material-ui/icons/Delete");require("../shared/CancelButton.js"),require("../shared/ExpandCollapseButton.js"),require("../shared/FormatedNumber.js");var l=require("../shared/InputText.js");require("../shared/MoreButton.js"),require("../shared/SaveButton.js"),require("../shared/SelectField.js");var o=require("../shared/StaticField.js");require("../shared/SharedEditorElements.js"),require("../shared/ConfirmationPopup.js");var c=require("../sharedStyles.js"),d=require("../../../../../utils/mobileDetect.js"),f=require("../../../../../utils/index.js"),p=require("react/jsx-runtime");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=b(e),j=b(t),m=b(i),g=b(n),x=b(s),y=b(u);function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){h.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function v(e){var t,i=e.data,n=e.errors,s=e.isEditing,u=e.onChange,b=c.useStyles({isMobile:d.isMobileDetected}),g=n||[],q="in"===f.getUnitPreference("shortLength")?"".concat(f.getUnitDisplay("shortLength"),"/32"):"".concat(f.getUnitDisplay("shortLength")),v=function(e){return function(){u([].concat(j.default(i.slice(0,e)),j.default(i.slice(e+1))))}},O=function(e){return function(t,r){var n=i.map((function(i,n){return n===e?z(z({},i),{},h.default({},t,r)):i}));u(n)}};return 0!==i.length||s?p.jsxs("div",{className:b.subGroup,children:[p.jsxs("div",{className:m.default(b.subTitle,h.default({},b.subTitleEditing,s)),children:["Nozzle Sizes",s&&p.jsx(a.IconButton,{"data-not-migrated-muiiconbutton":!0,className:b.addButton,onClick:function(){u([].concat(j.default(i),[{size:null,count:null}]))},children:p.jsx(x.default,{className:b.addIcon,color:"primary"})})]}),p.jsx(a.Grid,{container:!0,spacing:2,className:m.default(b.detailedView,(t={},h.default(t,b.detailedViewMobile,d.isMobileDetected),h.default(t,b.eidtorNozzleView,s),t)),children:i.map((function(e,t){return p.jsxs(r.Fragment,{children:[s?p.jsx(l.InputText,{type:"count",label:"# of this size",value:e.count,error:g[t]&&g[t].count,xs:d.isMobileDetected?5:4,onChangeField:O(t)}):p.jsx(o.StaticField,{label:"# of this size",value:e.count,xs:6}),s?p.jsx(l.InputText,{type:"size",label:"Nozzle Size (".concat(q,")"),value:e.size,error:g[t]&&g[t].size,xs:d.isMobileDetected?5:4,onChangeField:O(t)}):p.jsx(o.StaticField,{label:"Nozzle Size",unit:"shortLength",value:e.size,xs:6}),s&&p.jsx(a.Grid,{item:!0,xs:d.isMobileDetected?2:4,className:h.default({},b.cellInnerMobile,d.isMobileDetected),children:p.jsx(a.IconButton,{"data-not-migrated-muiiconbutton":!0,className:b.addButton,onClick:v(t),children:p.jsx(y.default,{className:b.addIcon})})})]},t)}))})]}):null}v.propTypes={isEditing:g.default.bool.isRequired,data:g.default.arrayOf(g.default.shape({count:g.default.number,size:g.default.number})),errors:g.default.arrayOf(g.default.shape({count:g.default.string,size:g.default.string})),onChange:g.default.func},v.defaultProps={data:[],errors:[],onChange:null};var O=r.memo(v);module.exports=O;
//# sourceMappingURL=index.js.map
