"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),n=require("@material-ui/core"),o=require("@material-ui/icons"),i=require("react/jsx-runtime");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(e),l=a(t);function u(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 s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){c.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var d=n.makeStyles((function(e){return{root:{display:"flex"},assetEditorWrapper:{width:"100%"},iconButtonWrapper:{height:36,marginTop:10,marginLeft:16},iconButton:{color:e.palette.primary.text6,width:36,height:36,"&:hover":{backgroundColor:e.palette.background.b7}}}}));module.exports=function(e){return function(t){var a=d(),c=t.onChangeEditorField,u=t.onSettingsChange,p=r.useState(!0),f=l.default(p,2),b=f[0],h=f[1],m=r.useState(!0),j=l.default(m,2),O=j[0],g=j[1],y=function(){c("assetId",null),c("replacedAssetId",null),c("replacedAssetTime",null)},v=function(){u({rigId:null,wellId:null})};r.useEffect((function(){O||g(!0)}),[O]);var x=b?o.LockOutlined:o.ReplayOutlined;return i.jsxs("div",{className:a.root,children:[i.jsx(n.Tooltip,{title:b?"This app is using current dashboard asset.":"",placement:"bottom",children:i.jsx("div",{className:a.assetEditorWrapper,children:O&&i.jsx(e,s(s({},t),{},{disabled:b}))})}),i.jsx(n.Tooltip,{title:b?"Unlock Asset":"Return default",placement:"bottom",children:i.jsx("div",{className:a.iconButtonWrapper,children:i.jsx(n.IconButton,{className:a.iconButton,"data-testid":"".concat(b?"UnlockAsset":"ReturnDefault","_IconButton"),onClick:function(){var e=!b;(h(e),e)&&((c?y:v)(),g(!1))},children:i.jsx(x,{})})})})]})}};
