import{p as t,H as s,c as e,h as o,d as c,t as i}from"./p-yZBlG3YQ.js";const n=()=>``;const l="10001";const r=t(class t extends s{constructor(t){super();if(t!==false){this.__registerHost()}this.clickAway=e(this,"clickAway");this.moved=false;this.voffset=0}handleScroll(){this.calculatePosition()}handleResize(){this.calculatePosition()}handleClick(t){var s;const e=t.target.closest(".verdocs-portal");if(!this.element.contains(t.target)&&!e){(s=this.clickAway)===null||s===void 0?void 0:s.emit()}document.querySelectorAll(".verdocs-multiselect-dropdown").forEach((t=>t.remove()))}calculateLeft(){var t;const s=document.getElementById(this.anchor);if(!s)return 0;const e=s.getBoundingClientRect();const o=document.documentElement.clientWidth+document.documentElement.scrollLeft;const c=Math.max(e.left,0);const i=((t=this.element)===null||t===void 0?void 0:t.offsetWidth)||400;const n=c+i>o;return n?o-i-20:c}calculateTop(){var t;const s=document.getElementById(this.anchor);if(!s)return 0;const e=s.getBoundingClientRect();const o=document.documentElement.clientHeight+document.documentElement.scrollTop;const c=e.bottom+this.voffset+document.documentElement.scrollTop;const i=((t=this.element)===null||t===void 0?void 0:t.offsetHeight)||300;const n=c+i>o;return n?c-i-e.height:c}calculatePosition(){this.portal.style.top=`${this.calculateTop()}px`;this.portal.style.left=`${this.calculateLeft()}px`}componentWillLoad(){var t;const s=`${this.anchor}-portal`;(t=document.getElementById(s))===null||t===void 0?void 0:t.remove();this.portal=document.createElement("div");this.portal.setAttribute("id",s);this.portal.style.zIndex=l;this.portal.style.position="absolute";this.portal.className="verdocs-portal-wrapper";document.body.append(this.portal)}componentDidLoad(){this.portal.appendChild(this.element);this.calculatePosition()}disconnectedCallback(){this.moved?this.portal.remove():this.moved=true}render(){return o(c,{key:"1929676c1774efb3f2e80f6e1bb13fbfa7f12ac2",ref:t=>this.element=t,class:"verdocs-portal"},o("slot",{key:"c4a0e9f8797ac7269f5c9d6c3fb7ce234884b68a"}))}static get style(){return n()}},[260,"verdocs-portal",{anchor:[1],voffset:[2]},[[11,"scroll","handleScroll"],[9,"resize","handleResize"],[4,"click","handleClick"]]]);function a(){if(typeof customElements==="undefined"){return}const t=["verdocs-portal"];t.forEach((t=>{switch(t){case"verdocs-portal":if(!customElements.get(i(t))){customElements.define(i(t),r)}break}}))}export{r as V,a as d};
//# sourceMappingURL=p-DQTI8vRX.js.map