import e from"@babel/runtime/helpers/defineProperty";import{memo as t}from"react";import r from"prop-types";import{makeStyles as i,Dialog as o,DialogTitle as n,Typography as a,DialogContent as c,DialogActions as l,Button as p}from"@material-ui/core";import{Close as s,ArrowBackIos as d}from"@material-ui/icons";import"./DrillPipe/Browser.js";import m from"./DrillPipe/Editor.js";import"./CasingJoints/Browser.js";import u from"./CasingJoints/Editor.js";import{COMPONENT_FAMILIES as f}from"../../../../constants/casing.js";import{jsxs as g,jsx as h}from"react/jsx-runtime";function b(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 y(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?b(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):b(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var x=i((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 v(e){var t=e.component,r=e.isDraft,i=e.error,b=e.onChange,v=e.onUseSuggestion,C=e.onCancel,j=e.onSave,w=e.onClose,O={component:t,isDraft:r,error:i,onChange:b,onUseSuggestion:v,onCancel:C,onSave:j},k=x(),D=t.family;return g(o,{open:!0,onBackdropClick:w,onEscapeKeyDown:w,maxWidth:"xs",fullWidth:!0,fullScreen:!0,classes:{paper:k.paper},children:[h(n,{className:k.dialogTitle,children:g("div",{className:k.titleWrapper,children:[h(a,{className:k.title,children:function(e){if(!e)return"—";var t=f.find((function(t){return t.type===e}));return(null==t?void 0:t.name)||e.toUpperCase()}(D)}),h(s,{onClick:w,className:k.closeIcon})]})}),h(c,{className:k.dialogContent,children:g("div",{className:k.contentView,children:[g("div",{className:k.componentListView,children:[("dp"===D||"hwdp"===D)&&h(m,y(y({},O),{},{isMobile:!0})),"dp"!==D&&"hwdp"!==D&&h(u,y(y({},O),{},{isMobile:!0}))]}),h("div",{className:k.bottomGradient})]})}),g(l,{className:k.dialogActions,children:[h(p,{startIcon:h(d,{}),onClick:w}),g("div",{children:[h(p,{color:"primary",style:{marginRight:"12px"},onClick:w,children:"Cancel"}),h(p,{variant:"contained",color:"primary",onClick:j,children:"Save"})]})]})]})}v.propTypes={component:r.shape({family:r.string}).isRequired,isDraft:r.bool.isRequired,error:r.shape({}).isRequired,onChange:r.func.isRequired,onUseSuggestion:r.func.isRequired,onCancel:r.func.isRequired,onSave:r.func.isRequired,onClose:r.func.isRequired};var C=t(v);export{C as default};
