import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/toConsumableArray";import{memo as r,Fragment as n}from"react";import a from"classnames";import i from"prop-types";import{IconButton as o,Grid as s}from"@material-ui/core";import l from"@material-ui/icons/Add";import m from"@material-ui/icons/Delete";import"../shared/CancelButton.js";import"../shared/ExpandCollapseButton.js";import"../shared/FormatedNumber.js";import{InputText as c}from"../shared/InputText.js";import"../shared/MoreButton.js";import"../shared/SaveButton.js";import{SelectField as u}from"../shared/SelectField.js";import{StaticField as p}from"../shared/StaticField.js";import"../shared/SharedEditorElements.js";import"../shared/ConfirmationPopup.js";import{useStyles as d}from"../sharedStyles.js";import{isMobileDetected as f}from"../../../../../utils/mobileDetect.js";import{getUnitDisplay as b}from"../../../../../utils/index.js";import{LWD_MEASUREMENT_TYPES as h}from"../../../../../constants/drillstring.js";import{jsxs as y,jsx as g}from"react/jsx-runtime";function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?j(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function v(r){var i,j=r.data,v=r.errors,P=r.isEditing,x=r.onChange,C=d({isMobile:f,isEditing:P}),N=v||[],M=function(e){return function(){x([].concat(t(j.slice(0,e)),t(j.slice(e+1))))}},w=function(t){return function(r,n){var a=j.map((function(a,i){return i===t?O(O({},a),{},e({},r,n)):a}));x(a)}};return 0!==j.length||P?y("div",{className:C.subGroup,children:[y("div",{className:a(C.subTitle,e({},C.subTitleEditing,P)),children:["LWD Measurements",P&&g(o,{"data-not-migrated-muiiconbutton":!0,className:C.addButton,onClick:function(){x([].concat(t(j),[{type:null,name:null,distance:null}]))},children:g(l,{className:C.addIcon,color:"primary"})})]}),g(s,{container:!0,spacing:2,className:a(C.detailedView,(i={},e(i,C.detailedViewMobile,f),e(i,C.eidtorNozzleView,P),i)),children:j.map((function(t,r){return y(n,{children:[P?g(u,{type:"type",options:h,label:"Measurement Type",value:t.type,error:N[r]&&N[r].type,xs:3,onChangeField:w(r)}):g(p,{label:"Measurement Type",value:t.type,format:null,xs:4}),P?g(c,{type:"name",label:"Measurement Name",value:t.name,error:N[r]&&N[r].name,xs:3,onChangeField:w(r)}):g(p,{label:"Measurement Name",value:t.name,format:null,xs:4}),P?g(c,{type:"distance",label:"M. Point distance (".concat(b("length"),")"),value:t.distance,error:N[r]&&N[r].distance,xs:3,onChangeField:w(r)}):g(p,{label:"Measure Point distance to Bit",unit:"length",value:t.distance,xs:4}),P&&g(s,{item:!0,xs:3,className:e({},C.cellInnerMobile,f),children:g(o,{"data-not-migrated-muiiconbutton":!0,className:C.addButton,onClick:M(r),children:g(m,{className:C.addIcon})})})]},r)}))})]}):null}v.propTypes={isEditing:i.bool.isRequired,data:i.arrayOf(i.shape({type:i.string,name:i.string,distance:i.number})),errors:i.arrayOf(i.shape({type:i.string,name:i.string,distance:i.string})),onChange:i.func},v.defaultProps={data:[],errors:[],onChange:null};var P=r(v);export{P as default};
//# sourceMappingURL=Measurement.js.map
