"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),o=t(e),n=t(require("react-dom"));function r(){return(r=Object.assign||function(t){for(var e=1;e=d.top+d.height||v.left+v.width>=d.left+d.width))break;s++}return f}(lt.current.getBoundingClientRect(),ct.current.getBoundingClientRect(),q,G,{offsetX:Q,offsetY:V},nt);ct.current.style.top=o.top+window.scrollY+"px",ct.current.style.left=o.left+window.scrollX+"px",G&&ft.current&&(ft.current.style.transform=o.transform,ft.current.style.setProperty("-ms-transform",o.transform),ft.current.style.setProperty("-webkit-transform",o.transform),ft.current.style.top=(null===(t=z.top)||void 0===t?void 0:t.toString())||o.arrowTop,ft.current.style.left=(null===(e=z.left)||void 0===e?void 0:e.toString())||o.arrowLeft)}};void 0===(At=R)&&(At=!0),e.useEffect((function(){if(At){var t=function(t){"Escape"===t.key&&Lt(t)};return document.addEventListener("keyup",t),function(){At&&document.removeEventListener("keyup",t)}}}),[Lt=ht,At]),function(t,o){void 0===o&&(o=!0),e.useEffect((function(){if(o){var e=function(e){if(9===e.keyCode){var o,n=null==t||null===(o=t.current)||void 0===o?void 0:o.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),r=Array.prototype.slice.call(n);if(1===r.length)return void e.preventDefault();var i=r[0],a=r[r.length-1];e.shiftKey&&document.activeElement===i?(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),i.focus())}};return document.addEventListener("keydown",e),function(){o&&document.removeEventListener("keydown",e)}}}),[t,o])}(ct,at&&pt),function(t,o){void 0===o&&(o=!0),e.useEffect((function(){if(o){var e=function(){t()};return window.addEventListener("resize",e),function(){o&&window.removeEventListener("resize",e)}}}),[t,o])}(Ct,T),function(t,o,n){void 0===n&&(n=!0),e.useEffect((function(){if(n){var e=function(e){var n=Array.isArray(t)?t:[t],r=!1;n.forEach((function(t){t.current&&!t.current.contains(e.target)||(r=!0)})),e.stopPropagation(),r||o(e)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){n&&(document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e))}}}),[t,o,n])}(d?[ct,lt]:[ct],ht,A&&!x);var Tt,Ot=function(){return o.createElement("div",Object.assign({},(t=pt?a.popupContent.modal:a.popupContent.tooltip,e={className:"popup-content "+(""!==M?M.split(" ").map((function(t){return t+"-content"})).join(" "):""),style:r({},t,Y,{pointerEvents:"auto"}),ref:ct,onClick:function(t){t.stopPropagation()}},!H&&X.indexOf("hover")>=0&&(e.onMouseEnter=gt,e.onMouseLeave=bt),e),{key:"C",role:pt?"dialog":"tooltip",id:dt.current}),G&&!pt&&o.createElement("div",{ref:ft,style:a.popupArrow},o.createElement("svg",{"data-testid":"arrow",className:"popup-arrow "+(""!==M?M.split(" ").map((function(t){return t+"-arrow"})).join(" "):""),viewBox:"0 0 32 16",style:r({position:"absolute"},z)},o.createElement("path",{d:"M16 0l16 16H0z",fill:"currentcolor"}))),rt&&"function"==typeof rt?rt(ht,at):rt);var t,e},Rt=!(X.indexOf("hover")>=0),St=pt?a.overlay.modal:a.overlay.tooltip,Xt=[Rt&&o.createElement("div",{key:"O","data-testid":"overlay","data-popup":pt?"modal":"tooltip",className:"popup-overlay "+(""!==M?M.split(" ").map((function(t){return t+"-overlay"})).join(" "):""),style:r({},St,I,{pointerEvents:A&&x||pt?"auto":"none"}),onClick:A&&x?ht:void 0,tabIndex:-1},pt&&Ot()),!pt&&Ot()];return o.createElement(o.Fragment,null,function(){for(var t={key:"T",ref:lt,"aria-describedby":dt.current},e=Array.isArray(X)?X:[X],n=0,r=e.length;n