import{__assign as o}from'./../../ext-esm/tslib/tslib.es6.js';import{jsxs as s,Fragment as n,jsx as c}from"react/jsx-runtime";import{useRef as i,useState as t,useEffect as e,Children as r,isValidElement as m,cloneElement as l}from"react";import p from"classnames";import a from"../Button/components/Button/index.js";import"moment-timezone";import"@material-ui/core";import{CloseIcon as u}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../Button/components/LiveButton/components/LiveButtonStateIndicator/index.js";import"../Button/components/LiveButton/styles.js";import{Regular14 as d}from"../Typography.js";import{Popper as j}from"../Popper/Popper.js";import h from"../IconButton/index.js";import{useStyles as I}from"./styles.js";var f=function(f){var C=I(),b=i(),x=t(),v=x[0],k=x[1],B=t(),E=B[0],N=B[1];if(e((function(){setTimeout((function(){return N(f.open?f.anchorEl||b.current:void 0)}),100)})),!f.anchorEl&&r.count(f.children)>1)throw new Error("Hint expects a single reffable element as a child");var F=f.anchorEl?f.children:r.map(f.children,(function(o){return m(o)?l(o,{ref:b}):o}));return s(n,{children:[F,s(j,o({className:p(C.popper,f.className),transition:!0,open:!!E,anchorEl:E,placement:f.placement,modifiers:{flip:{enabled:!0},arrow:{enabled:!!v,element:v}}},{children:[c("div",{ref:k,className:C.arrow}),s("div",o({className:C.tooltip},{children:[f.title&&c("span",o({className:p(C.title,f.onClose&&C.hasClose)},{children:f.title})),f.onClose&&c(h,o({onClick:f.onClose,className:C.close,size:"small"},{children:c(u,{})})),f.content&&c(d,o({className:C.content},{children:f.content})),f.onConfirm&&c(a,o({color:"inherit",className:C.button,onClick:f.onConfirm},{children:f.confirmText||"Got It"}))]}))]}))]})};export{f as Hint};
