"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),t=require("moment-timezone"),o=require("@material-ui/core"),i=require("classnames"),n=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/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");var c=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(t),d=l(i),j=function(e,t){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",{}),t&&"Last active: ".concat(m.default(t).format("MMM D YYYY, hh:mm A"))]})};exports.LiveButtonState=r.LiveButtonState,exports.LiveButton=function(t){var i,l=t.size,m=void 0===l?"medium":l,q=t.state,v=void 0===q?r.LiveButtonState.Default:q,I=t.startIcon,p=t.children,x=void 0===p?"Live":p,L=t.className,f=t.tooltipProps,S=t.lastActiveAt,h=e.__rest(t,["size","state","startIcon","children","className","tooltipProps","lastActiveAt"]),B=a.useStyles({size:m}),b=B[m],C={placement:"bottom",title:j(v,S)},_="small"===m,A=I||s.jsx(n.RightSmallIcon,{size:_?20:24});return s.jsx(o.Tooltip,e.__assign({},C,f,{children:s.jsxs(c,e.__assign({},h,{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&&A},{children:[x,s.jsx(u.LiveButtonStateIndicator,{state:v})]}))}))},exports.getTooltipText=j;
