import e from"react";function t(e){if(Array.isArray(e))return e}function n(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],l=!0,a=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){a=!0,i=e}finally{try{l||null==n.return||n.return()}finally{if(a)throw i}}return o}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){a=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(a)throw o}}}}function p(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n3&&void 0!==arguments[3])||arguments[3];t&&n&&("self"===r?this.relativePosition(t,n):(i&&(t.style.minWidth=e.getOuterWidth(n)+"px"),this.absolutePosition(t,n)))}},{key:"absolutePosition",value:function(e,t){if(e){var n,r,i=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:this.getHiddenElementDimensions(e),o=i.height,l=i.width,a=t.offsetHeight,s=t.offsetWidth,u=t.getBoundingClientRect(),c=this.getWindowScrollTop(),f=this.getWindowScrollLeft(),d=this.getViewport();u.top+a+o>d.height?((n=u.top+c-o)<0&&(n=c),e.style.transformOrigin="bottom"):(n=a+u.top+c,e.style.transformOrigin="top"),r=u.left+s+l>d.width?Math.max(0,u.left+f+s-l):u.left+f,e.style.top=n+"px",e.style.left=r+"px"}}},{key:"relativePosition",value:function(e,t){if(e){var n,r,i=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:this.getHiddenElementDimensions(e),o=t.offsetHeight,l=t.getBoundingClientRect(),a=this.getViewport();l.top+o+i.height>a.height?(l.top+(n=-1*i.height)<0&&(n=-1*l.top),e.style.transformOrigin="bottom"):(n=o,e.style.transformOrigin="top"),r=i.width>a.width?-1*l.left:l.left+i.width>a.width?-1*(l.left+i.width-a.width):0,e.style.top=n+"px",e.style.left=r+"px"}}},{key:"flipfitCollision",value:function(t,n){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left top",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"left bottom",l=arguments.length>4?arguments[4]:void 0,a=n.getBoundingClientRect(),s=this.getViewport(),u=i.split(" "),c=o.split(" "),f=function(e,t){return t?+e.substring(e.search(/(\+|-)/g))||0:e.substring(0,e.search(/(\+|-)/g))||e},d={my:{x:f(u[0]),y:f(u[1]||u[0]),offsetX:f(u[0],!0),offsetY:f(u[1]||u[0],!0)},at:{x:f(c[0]),y:f(c[1]||c[0]),offsetX:f(c[0],!0),offsetY:f(c[1]||c[0],!0)}},p={left:function(){return d.my.offsetX+d.at.offsetX+a.left+("left"===d.my.x?0:-1*("center"===d.my.x?r.getOuterWidth(t)/2:r.getOuterWidth(t)))},top:function(){return d.my.offsetY+d.at.offsetY+a.top+("top"===d.my.y?0:-1*("center"===d.my.y?r.getOuterHeight(t)/2:r.getOuterHeight(t)))}},h={count:{x:0,y:0},left:function(){var n=p.left(),r=e.getWindowScrollLeft();t.style.left=n+r+"px",2===this.count.x?(t.style.left=r+"px",this.count.x=0):n<0&&(this.count.x++,d.my.x="left",d.at.x="right",d.my.offsetX*=-1,d.at.offsetX*=-1,this.right())},right:function(){var r=p.left()+e.getOuterWidth(n),i=e.getWindowScrollLeft();t.style.left=r+i+"px",2===this.count.x?(t.style.left=s.width-e.getOuterWidth(t)+i+"px",this.count.x=0):r+e.getOuterWidth(t)>s.width&&(this.count.x++,d.my.x="right",d.at.x="left",d.my.offsetX*=-1,d.at.offsetX*=-1,this.left())},top:function(){var n=p.top(),r=e.getWindowScrollTop();t.style.top=n+r+"px",2===this.count.y?(t.style.left=r+"px",this.count.y=0):n<0&&(this.count.y++,d.my.y="top",d.at.y="bottom",d.my.offsetY*=-1,d.at.offsetY*=-1,this.bottom())},bottom:function(){var r=p.top()+e.getOuterHeight(n),i=e.getWindowScrollTop();t.style.top=r+i+"px",2===this.count.y?(t.style.left=s.height-e.getOuterHeight(t)+i+"px",this.count.y=0):r+e.getOuterHeight(n)>s.height&&(this.count.y++,d.my.y="bottom",d.at.y="top",d.my.offsetY*=-1,d.at.offsetY*=-1,this.top())},center:function(r){if("y"===r){var i=p.top()+e.getOuterHeight(n)/2;t.style.top=i+e.getWindowScrollTop()+"px",i<0?this.bottom():i+e.getOuterHeight(n)>s.height&&this.top()}else{var o=p.left()+e.getOuterWidth(n)/2;t.style.left=o+e.getWindowScrollLeft()+"px",o<0?this.left():o+e.getOuterWidth(t)>s.width&&this.right()}}};h[d.at.x]("x"),h[d.at.y]("y"),this.isFunction(l)&&l(d)}},{key:"findCollisionPosition",value:function(e){if(e){var t="left"===e?"right":"left";return"top"===e||"bottom"===e?{axis:"y",my:"center ".concat("top"===e?"bottom":"top"),at:"center ".concat(e)}:{axis:"x",my:"".concat(t," center"),at:"".concat(e," center")}}}},{key:"getParents",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return null===e.parentNode?t:this.getParents(e.parentNode,t.concat([e.parentNode]))}},{key:"getScrollableParents",value:function(e){var t=[];if(e){var n,r=this.getParents(e),i=/(auto|scroll)/,o=function(e){var t=e?getComputedStyle(e):null;return t&&(i.test(t.getPropertyValue("overflow"))||i.test(t.getPropertyValue("overflowX"))||i.test(t.getPropertyValue("overflowY")))},l=d(r);try{for(l.s();!(n=l.n()).done;){var a=n.value,s=1===a.nodeType&&a.dataset.scrollselectors;if(s){var u,c=d(s.split(","));try{for(c.s();!(u=c.n()).done;){var f=this.findSingle(a,u.value);f&&o(f)&&t.push(f)}}catch(e){c.e(e)}finally{c.f()}}9!==a.nodeType&&o(a)&&t.push(a)}}catch(e){l.e(e)}finally{l.f()}}return t}},{key:"getHiddenElementOuterHeight",value:function(e){if(e){e.style.visibility="hidden",e.style.display="block";var t=e.offsetHeight;return e.style.display="none",e.style.visibility="visible",t}return 0}},{key:"getHiddenElementOuterWidth",value:function(e){if(e){e.style.visibility="hidden",e.style.display="block";var t=e.offsetWidth;return e.style.display="none",e.style.visibility="visible",t}return 0}},{key:"getHiddenElementDimensions",value:function(e){var t={};return e&&(e.style.visibility="hidden",e.style.display="block",t.width=e.offsetWidth,t.height=e.offsetHeight,e.style.display="none",e.style.visibility="visible"),t}},{key:"fadeIn",value:function(e,t){if(e){e.style.opacity=0;var n=+new Date,r=0;!function i(){r=+e.style.opacity+((new Date).getTime()-n)/t,e.style.opacity=r,n=+new Date,+r<1&&(window.requestAnimationFrame&&requestAnimationFrame(i)||setTimeout(i,16))}()}}},{key:"fadeOut",value:function(e,t){if(e)var n=1,r=50/t,i=setInterval((function(){(n-=r)<=0&&(n=0,clearInterval(i)),e.style.opacity=n}),50)}},{key:"getUserAgent",value:function(){return navigator.userAgent}},{key:"isIOS",value:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}},{key:"isAndroid",value:function(){return/(android)/i.test(navigator.userAgent)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}},{key:"isFunction",value:function(e){return!!(e&&e.constructor&&e.call&&e.apply)}},{key:"appendChild",value:function(e,t){if(this.isElement(t))t.appendChild(e);else{if(!t.el||!t.el.nativeElement)throw new Error("Cannot append "+t+" to "+e);t.el.nativeElement.appendChild(e)}}},{key:"removeChild",value:function(e,t){if(this.isElement(t))t.removeChild(e);else{if(!t.el||!t.el.nativeElement)throw new Error("Cannot remove "+e+" from "+t);t.el.nativeElement.removeChild(e)}}},{key:"isElement",value:function(e){return"object"===("undefined"==typeof HTMLElement?"undefined":a(HTMLElement))?e instanceof HTMLElement:e&&"object"===a(e)&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName}},{key:"scrollInView",value:function(e,t){var n=getComputedStyle(e).getPropertyValue("borderTopWidth"),r=n?parseFloat(n):0,i=getComputedStyle(e).getPropertyValue("paddingTop"),o=i?parseFloat(i):0,l=e.getBoundingClientRect(),a=t.getBoundingClientRect().top+document.body.scrollTop-(l.top+document.body.scrollTop)-r-o,s=e.scrollTop,u=e.clientHeight,c=this.getOuterHeight(t);a<0?e.scrollTop=s+a:a+c>u&&(e.scrollTop=s+a-u+c)}},{key:"clearSelection",value:function(){if(window.getSelection)window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().rangeCount>0&&window.getSelection().getRangeAt(0).getClientRects().length>0&&window.getSelection().removeAllRanges();else if(document.selection&&document.selection.empty)try{document.selection.empty()}catch(e){}}},{key:"calculateScrollbarWidth",value:function(e){if(e){var t=getComputedStyle(e);return e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth)}if(null!=this.calculatedScrollbarWidth)return this.calculatedScrollbarWidth;var n=document.createElement("div");n.className="p-scrollbar-measure",document.body.appendChild(n);var r=n.offsetWidth-n.clientWidth;return document.body.removeChild(n),this.calculatedScrollbarWidth=r,r}},{key:"getBrowser",value:function(){if(!this.browser){var e=this.resolveUserAgent();this.browser={},e.browser&&(this.browser[e.browser]=!0,this.browser.version=e.version),this.browser.chrome?this.browser.webkit=!0:this.browser.webkit&&(this.browser.safari=!0)}return this.browser}},{key:"resolveUserAgent",value:function(){var e=navigator.userAgent.toLowerCase(),t=/(chrome)[ ]([\w.]+)/.exec(e)||/(webkit)[ ]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ ]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}}},{key:"isVisible",value:function(e){return e&&null!=e.offsetParent}},{key:"isExist",value:function(e){return null!=e&&e.nodeName&&e.parentNode}},{key:"hasDOM",value:function(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}},{key:"getFocusableElements",value:function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.find(t,'button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])'.concat(r,',\n [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(r,',\n input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(r,',\n select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(r,',\n textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(r,',\n [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(r,',\n [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])').concat(r)),o=[],l=d(i);try{for(l.s();!(n=l.n()).done;){var a=n.value;"none"!==getComputedStyle(a).display&&"hidden"!==getComputedStyle(a).visibility&&o.push(a)}}catch(e){l.e(e)}finally{l.f()}return o}},{key:"getFirstFocusableElement",value:function(t,n){var r=e.getFocusableElements(t,n);return r.length>0?r[0]:null}},{key:"getLastFocusableElement",value:function(t,n){var r=e.getFocusableElements(t,n);return r.length>0?r[r.length-1]:null}},{key:"getCursorOffset",value:function(e,t,n,r){if(e){var i=getComputedStyle(e),o=document.createElement("div");o.style.position="absolute",o.style.top="0px",o.style.left="0px",o.style.visibility="hidden",o.style.pointerEvents="none",o.style.overflow=i.overflow,o.style.width=i.width,o.style.height=i.height,o.style.padding=i.padding,o.style.border=i.border,o.style.overflowWrap=i.overflowWrap,o.style.whiteSpace=i.whiteSpace,o.style.lineHeight=i.lineHeight,o.innerHTML=t.replace(/\r\n|\r|\n/g,"
");var l=document.createElement("span");l.textContent=r,o.appendChild(l);var a=document.createTextNode(n);o.appendChild(a),document.body.appendChild(o);var s=l.offsetLeft,u=l.offsetTop,c=l.clientHeight;return document.body.removeChild(o),{left:Math.abs(s-e.scrollLeft),top:Math.abs(u-e.scrollTop)+c}}return{top:"auto",left:"auto"}}},{key:"invokeElementMethod",value:function(e,t,n){e[t].apply(e,n)}},{key:"isClickable",value:function(e){var t=e.nodeName,n=e.parentElement&&e.parentElement.nodeName;return"INPUT"===t||"TEXTAREA"===t||"BUTTON"===t||"A"===t||"INPUT"===n||"TEXTAREA"===n||"BUTTON"===n||"A"===n||this.hasClass(e,"p-button")||this.hasClass(e.parentElement,"p-button")||this.hasClass(e.parentElement,"p-checkbox")||this.hasClass(e.parentElement,"p-radiobutton")}},{key:"applyStyle",value:function(e,t){if("string"==typeof t)e.style.cssText=this.style;else for(var n in this.style)e.style[n]=t[n]}},{key:"exportCSV",value:function(t,n){var r=new Blob([t],{type:"application/csv;charset=utf-8;"});window.navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(r,n+".csv"):e.saveAs({name:n+".csv",src:URL.createObjectURL(r)})||(t="data:text/csv;charset=utf-8,"+t,window.open(encodeURI(t)))}},{key:"saveAs",value:function(e){if(e){var t=document.createElement("a");if(void 0!==t.download){var n=e.name;return t.setAttribute("href",e.src),t.setAttribute("download",n),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t),!0}}return!1}},{key:"createInlineStyle",value:function(e){var t=document.createElement("style");try{e||(e=process.env.REACT_APP_CSS_NONCE)}catch(e){}return e&&t.setAttribute("nonce",e),document.head.appendChild(t),t}},{key:"removeInlineStyle",value:function(e){if(this.isExist(e)){try{document.head.removeChild(e)}catch(e){}e=null}return e}}]),e}(),g=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};u(this,e),this.element=t,this.listener=n}return f(e,[{key:"bindScrollListener",value:function(){this.scrollableParents=y.getScrollableParents(this.element);for(var e=0;e>>0,1)},emit:function(t,n){var r=e.get(t);r&&r.slice().forEach((function(e){return e(n)}))}}}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t=0&&!n[e];);return e},k=function(e,t){var r,l;if(!(e<0)){for(r=e,l=b(t);rl.length){for(j(!0);a.begin>0&&!n[a.begin-1];)a.begin--;if(0===a.begin)for(;a.beginc.length){P(a+1,i);break}}else d[a]===c.charAt(u)&&u++,a=e.length)for(r=n-e.length;1+r--;)e.push(void 0);e.splice(n,0,e.splice(t,1)[0])}}},{key:"findIndexInList",value:function(e,t,n){var r=this;return t?t.findIndex(n?function(t){return r.equals(t,e,n)}:function(t){return t===e}):-1}},{key:"getJSXElement",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r-1&&(e=e.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),e}},{key:"isEmpty",value:function(e){return null==e||""===e||Array.isArray(e)&&0===e.length||!(e instanceof Date)&&"object"===a(e)&&0===Object.keys(e).length}},{key:"isNotEmpty",value:function(e){return!this.isEmpty(e)}}]),e}();function E(){return E=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"pr_id_";return A++,"".concat(e).concat(A)}function T(e){if(Array.isArray(e))return r(e)}function j(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function F(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e){return T(e)||j(e)||i(e)||F()}var W,H,R,D,I=(W=[],H=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:999,r=D(e,t,n),i=r.value+(r.key===e?0:n)+1;return W.push({key:e,value:i}),i},R=function(e,t){return D(e,t).value},D=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return L(W).reverse().find((function(n){return!!t||n.key===e}))||{key:e,value:n}},{get:function(e){return e&&parseInt(e.style.zIndex,10)||0},set:function(e,t,n,r){t&&(t.style.zIndex=String(H(e,n,r)))},clear:function(e){var t;e&&(t=I.get(e),W=W.filter((function(e){return e.value!==t})),e.style.zIndex="")},getCurrent:function(e,t){return R(e,t)}});export{g as ConnectedOverlayScrollHandler,y as DomHandler,v as EventBus,S as IconUtils,k as ObjectUtils,P as UniqueComponentId,I as ZIndexUtils,s as classNames,x as mask};