"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),o=require("moment-timezone"),t=require("@material-ui/core"),i=require("classnames"),c=require("../../../../icons/iconParkIcons.js");require("../../../../icons/customIcons/icons/AddMessage.js"),require("../../../../icons/customIcons/icons/Attention.js"),require("../../../../icons/customIcons/icons/Collapse.js"),require("../../../../icons/customIcons/icons/Dashboard.js"),require("../../../../icons/customIcons/icons/Expand.js"),require("../../../../icons/customIcons/icons/FolderClosed.js"),require("../../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../../icons/customIcons/icons/FolderOpened.js"),require("../../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../../icons/customIcons/icons/Search.js"),require("../../../../icons/customIcons/icons/Wellhub.js"),require("../../../../icons/customIcons/icons/MultiRuler.js"),require("../../../../icons/customIcons/icons/Checkbox.js"),require("../../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../../icons/customIcons/icons/Radio.js"),require("../../../../icons/customIcons/icons/RadioChecked.js"),require("../../../../icons/customIcons/icons/SimulFrac.js"),require("../../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../../icons/customIcons/icons/CautionFilled.js"),require("../../../../icons/customIcons/icons/MoreApp.js");var n=require("../Button/index.js"),r=require("./constants.js"),u=require("./components/LiveButtonStateIndicator/index.js"),a=require("./styles.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=l(o),d=l(i),j=function(e,o){return e===r.LiveButtonState.Default?"Go to Live data":e===r.LiveButtonState.Live?"Data receiving in real-time":s.jsxs("div",{children:["Asset isn't Live",s.jsx("br",{}),o&&"Last active: ".concat(m.default(o).format("MMM D YYYY, hh:mm A"))]})};exports.LiveButtonState=r.LiveButtonState,exports.LiveButton=function(o){var i,l=o.size,m=void 0===l?"medium":l,q=o.state,v=void 0===q?r.LiveButtonState.Default:q,I=o.startIcon,p=o.children,x=void 0===p?"Live":p,L=o.className,f=o.tooltipProps,h=o.lastActiveAt,S=e.__rest(o,["size","state","startIcon","children","className","tooltipProps","lastActiveAt"]),B=a.useStyles({size:m}),b=B[m],A={placement:"bottom",title:j(v,h)},C="small"===m,_=I||s.jsx(c.RightSmallIcon,{size:C?20:24});return s.jsx(t.Tooltip,e.__assign({},A,f,{children:s.jsxs(n,e.__assign({},S,{className:d.default(B.root,b,(i={},i[B.liveState]=v===r.LiveButtonState.Live,i[B.offlineState]=v===r.LiveButtonState.Offline,i),L),size:m,startIcon:v===r.LiveButtonState.Default&&_,children:[x,s.jsx(u.LiveButtonStateIndicator,{state:v})]}))}))},exports.getTooltipText=j;
