"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),r=require("prop-types"),i=require("@material-ui/core"),n=require("@material-ui/icons");require("./DrillPipe/Browser.js");var o=require("./DrillPipe/Editor.js");require("./CasingJoints/Browser.js");var a=require("./CasingJoints/Editor.js"),s=require("../../../../constants/casing.js"),l=require("react/jsx-runtime");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(e),u=c(r);function d(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 f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){p.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var g=i.makeStyles((function(e){return{paper:{background:e.isLightTheme?e.palette.primary.text1:e.palette.background.b5},dialogTitle:{padding:"12px 0",borderBottom:"1px solid ".concat(e.palette.background.b7)},titleWrapper:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px"},title:{fontSize:"20px",fontWeight:400},closeIcon:{color:e.palette.primary.text6,"&:hover":{color:e.palette.primary.text1}},dialogContent:{padding:"0px 0px 0px 16px",flexDirection:"column",height:"100%",width:"100%",position:"relative"},dialogActions:{padding:"8px 16px",justifyContent:"space-between"},contentView:{display:"flex",height:"100%"},componentListView:{height:"100%",flex:1,overflowY:"auto",paddingRight:"16px"},bottomGradient:{position:"absolute",height:"16px",left:0,right:0,bottom:0,background:"linear-gradient(180deg, rgba(33, 33, 33, 0) 0%, ".concat(e.palette.background.b5," 100%)")}}}));function h(e){var t=e.component,r=e.isDraft,c=e.error,p=e.onChange,u=e.onUseSuggestion,d=e.onCancel,h=e.onSave,m=e.onClose,x={component:t,isDraft:r,error:c,onChange:p,onUseSuggestion:u,onCancel:d,onSave:h},j=g(),b=t.family;return l.jsxs(i.Dialog,{open:!0,onBackdropClick:m,onEscapeKeyDown:m,maxWidth:"xs",fullWidth:!0,fullScreen:!0,classes:{paper:j.paper},children:[l.jsx(i.DialogTitle,{className:j.dialogTitle,children:l.jsxs("div",{className:j.titleWrapper,children:[l.jsx(i.Typography,{className:j.title,children:function(e){if(!e)return"—";var t=s.COMPONENT_FAMILIES.find((function(t){return t.type===e}));return(null==t?void 0:t.name)||e.toUpperCase()}(b)}),l.jsx(n.Close,{onClick:m,className:j.closeIcon})]})}),l.jsx(i.DialogContent,{className:j.dialogContent,children:l.jsxs("div",{className:j.contentView,children:[l.jsxs("div",{className:j.componentListView,children:[("dp"===b||"hwdp"===b)&&l.jsx(o,f(f({},x),{},{isMobile:!0})),"dp"!==b&&"hwdp"!==b&&l.jsx(a,f(f({},x),{},{isMobile:!0}))]}),l.jsx("div",{className:j.bottomGradient})]})}),l.jsxs(i.DialogActions,{className:j.dialogActions,children:[l.jsx(i.Button,{startIcon:l.jsx(n.ArrowBackIos,{}),onClick:m}),l.jsxs("div",{children:[l.jsx(i.Button,{color:"primary",style:{marginRight:"12px"},onClick:m,children:"Cancel"}),l.jsx(i.Button,{variant:"contained",color:"primary",onClick:h,children:"Save"})]})]})]})}h.propTypes={component:u.default.shape({family:u.default.string}).isRequired,isDraft:u.default.bool.isRequired,error:u.default.shape({}).isRequired,onChange:u.default.func.isRequired,onUseSuggestion:u.default.func.isRequired,onCancel:u.default.func.isRequired,onSave:u.default.func.isRequired,onClose:u.default.func.isRequired};var m=t.memo(h);module.exports=m;
//# sourceMappingURL=EditComponentDialog.js.map
