import{r as t,e,h as i,f as s}from"./p-15c07fa9.js";import{A as r}from"./p-6a4b21dd.js";const l=class{constructor(i){t(this,i),this.actionSelected=e(this,"actionSelected",7),this.OFFSET_HEIGHT=5,this.getMessage=void 0,this.hasDefaultFilter=!1,this._opened=!1}repositionDropDown(){if(!this._refIcon||!this._refDropdown)return;const t=this._refIcon.getBoundingClientRect(),e=this._refDropdown.getBoundingClientRect();this._refDropdown.style.top=t.y+t.height+this.OFFSET_HEIGHT+"px",this._refDropdown.style.left=t.x+t.width/2-e.width+"px"}toggleDropdown(){this._opened=!this._opened}closeDropdown(t){const e=null==t?void 0:t.target;e&&(e.closest("#dropdown-parent-demo")||(this._opened=!1))}buildItems(){return[{id:r.EDIT,label:this.getMessage("defaultFilter.edit")},{id:r.REMOVE,label:this.getMessage("defaultFilter.remove")}]}onValueSelected({detail:t}){this._opened=!1,this.actionSelected.emit(t.id)}openCreateNewFilter(){this.actionSelected.emit(r.CREATE)}componentDidRender(){this.repositionDropDown()}componentWillLoad(){this._items=this.buildItems(),document.removeEventListener("scroll",this.repositionDropDown.bind(this)),document.addEventListener("scroll",this.repositionDropDown.bind(this))}render(){return this.hasDefaultFilter?i(s,null,i("button",{class:"default_container",onClick:this.toggleDropdown.bind(this)},i("span",null,this.getMessage("defaultFilter.title")),i("ez-icon",{ref:t=>this._refIcon=t,iconName:"dots-vertical"})),this._opened&&i("ez-dropdown",{ref:t=>this._refDropdown=t,items:this._items,onEzClick:this.onValueSelected.bind(this),onEzOutsideClick:this.closeDropdown.bind(this)})):i(s,null,i("button",{class:"default_container new_filter",onClick:this.openCreateNewFilter.bind(this)},i("span",null,this.getMessage("defaultFilter.create"))))}};l.style=".sc-snk-default-filter-h{display:flex;justify-content:flex-end}.default_container.sc-snk-default-filter{border:none;background:none;display:flex;align-items:center;gap:var(--space--3xs, 4px);font-family:var(--font-pattern);color:var(--title--primary, #2b3a54);font-size:var(--text--medium, 14px);padding:0;outline:none}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter{cursor:pointer}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter:hover{color:var(--color--primary-600)}.new_filter.sc-snk-default-filter{cursor:pointer;margin:0 var(--space--3xs, 4px)}.new_filter.sc-snk-default-filter:hover{color:var(--color--primary-600)}";export{l as snk_default_filter}