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 I from"../IconButton/index.js";import{useStyles as f}from"./styles.js";var h=function(h){var C=f(),b=i(),x=t(),k=x[0],v=x[1],B=t(),N=B[0],F=B[1];if(e((function(){setTimeout((function(){return F(h.open&&(h.anchorEl||b.current))}),100)})),r.count(h.children)>1)throw new Error("Hint expects a single reffable element as a child");var E=r.map(h.children,(function(o){return m(o)?l(o,{ref:b}):o}));return s(n,{children:[E,s(j,o({className:p(C.popper,h.className),transition:!0,open:!!N,anchorEl:N,placement:h.placement,modifiers:{flip:{enabled:!0},arrow:{enabled:!!k,element:k}}},{children:[c("div",{ref:v,className:C.arrow}),s("div",o({className:C.tooltip},{children:[h.title&&c("span",o({className:p(C.title,h.onClose&&C.hasClose)},{children:h.title})),h.onClose&&c(I,o({onClick:h.onClose,className:C.close,size:"small"},{children:c(u,{})})),h.content&&c(d,o({className:C.content},{children:h.content})),h.onConfirm&&c(a,o({color:"inherit",className:C.button,onClick:h.onConfirm},{children:h.confirmText||"Got It"}))]}))]}))]})};export{h as Hint};
