import{r as t,h as s,g as i}from"./p-c063aff1.js";import{e as a}from"./p-9158fc11.js";const o=class{constructor(s){t(this,s),this.scrollListener=()=>this.onScroll(window),this.arrow=!0,this.dismiss="explicit",this.placement="top"}componentWillLoad(){this.onScroll=a(this.onScroll.bind(this),50)}async disconnectedCallback(){"auto"===this.dismiss&&(this.target=void 0,window.removeEventListener("scroll",this.scrollListener)),this.overlay&&await this.overlay.popper()&&this.overlay.remove()}async display(t){const s=await this.overlay.popper();if(!s)return"auto"===this.dismiss&&(this.target=t,window.addEventListener("scroll",this.scrollListener)),this.overlay.open(t);s.reference=t,s.scheduleUpdate()}async hide(){this.disconnectedCallback(),await this.overlay.close()}async toggle(t){return await this.overlay.popper()?this.hide():this.display(t)}async showing(){return!!(await this.overlay.popper())}async onScroll(t){if(t.scrollY>this.target.offsetTop+this.target.offsetHeight||t.scrollY<this.target.offsetTop-this.target.offsetHeight)return this.hide()}render(){return s("anj-overlay",{class:"anj-popover",dismiss:this.dismiss,scrollable:!0,placement:this.placement,offset:this.arrow?"0, 15":"0, 5",ref:t=>this.overlay=t},this.arrow?s("anj-arrow",null):"",s("div",{class:"anj-popover-content"},s("slot",null)))}get element(){return i(this)}static get style(){return".sc-anj-popover-h{display:none}"}},r=class{constructor(s){t(this,s)}static get style(){return"anj-popover-header{border-bottom:0;color:var(--anj-primary);display:block;font-size:.75rem;padding:0 0 .5rem}"}};export{o as anj_popover,r as anj_popover_header};